From 248ac3e4e5ae157c9a5eed592b17aa450cb29a15 Mon Sep 17 00:00:00 2001 From: Kacper Szarkiewicz Date: Thu, 28 May 2026 19:10:35 +0100 Subject: [PATCH 001/176] add Alfredpay (USD/MXN/COP) on/off-ramp support to SDK --- packages/sdk/README.md | 54 +++++++ packages/sdk/src/VortexSdk.ts | 38 ++++- packages/sdk/src/errors.ts | 33 ++++ packages/sdk/src/handlers/AlfredpayHandler.ts | 151 ++++++++++++++++++ packages/sdk/src/types.ts | 88 +++++++--- 5 files changed, 342 insertions(+), 22 deletions(-) create mode 100644 packages/sdk/src/handlers/AlfredpayHandler.ts diff --git a/packages/sdk/README.md b/packages/sdk/README.md index 44c914024..54172be7c 100644 --- a/packages/sdk/README.md +++ b/packages/sdk/README.md @@ -51,6 +51,60 @@ console.log("Please do the pix transfer using the following code: ", depositQrCo const startedRamp = await sdk.startRamp(rampProcess.id); ``` +### Alfredpay (USD / MXN / COP) onramp + +```typescript +import { VortexSdk, FiatToken, EvmToken, Networks, RampDirection } from "@vortexfi/sdk"; + +const sdk = new VortexSdk({ apiBaseUrl: "http://localhost:3000" }); + +const quote = await sdk.createQuote({ + inputAmount: "100", + inputCurrency: FiatToken.COP, + outputCurrency: EvmToken.USDC, + rampType: RampDirection.BUY, + to: Networks.Polygon +}); + +const { rampProcess } = await sdk.registerRamp(quote, { + destinationAddress: "0x1234567890123456789012345678901234567890", + fiatAccountId: "", + walletAddress: "0x1234567890123456789012345678901234567890" +}); + +// Inspect off-chain fiat payment instructions before starting. +const startedRamp = await sdk.startRamp(rampProcess.id); +console.log("Pay via:", startedRamp.achPaymentData); +``` + +### Alfredpay (USD / MXN / COP) offramp + +```typescript +const quote = await sdk.createQuote({ + from: Networks.Polygon, + inputAmount: "10", + inputCurrency: EvmToken.USDC, + outputCurrency: FiatToken.MXN, + rampType: RampDirection.SELL +}); + +const { rampProcess, unsignedTransactions } = await sdk.registerRamp(quote, { + fiatAccountId: "", + walletAddress: "0x1234567890123456789012345678901234567890" +}); + +// Sign and submit the user-side EVM transactions (squidRouter approve/swap, etc.) +// then push the resulting hashes back to Vortex: +const updated = await sdk.updateRamp(quote, rampProcess.id, { + squidRouterApproveHash: "0x...", + squidRouterSwapHash: "0x..." +}); + +const startedRamp = await sdk.startRamp(updated.id); +``` + +> `fiatAccountId` is opaque to the SDK. Consumers create or look up the user's Alfredpay fiat account out-of-band (via the Vortex backend) and pass the ID in. + ## Core Features - **Ephemerals abstracted**: No need to keep track of the ephemeral accounts used in the ramp process. If `storeEphemeralKeys` is enabled, keys are stored in a JSON file in Node.js. - **Stateless Design**: No internal state management - you control persistence of the rampId for status checking diff --git a/packages/sdk/src/VortexSdk.ts b/packages/sdk/src/VortexSdk.ts index c96f938bc..4d5a08ad9 100644 --- a/packages/sdk/src/VortexSdk.ts +++ b/packages/sdk/src/VortexSdk.ts @@ -6,6 +6,7 @@ import { createStellarEphemeral, EphemeralAccount, EphemeralAccountType, + isAlfredpayToken, QuoteResponse, RampDirection, RampProcess, @@ -13,11 +14,15 @@ import { UnsignedTx } from "@vortexfi/shared"; import { TransactionSigningError } from "./errors"; +import { AlfredpayHandler } from "./handlers/AlfredpayHandler"; import { BrlHandler } from "./handlers/BrlHandler"; import { ApiService } from "./services/ApiService"; import { NetworkManager } from "./services/NetworkManager"; import { storeEphemeralKeys } from "./storage"; import type { + AlfredpayOfframpAdditionalData, + AlfredpayOfframpUpdateAdditionalData, + AlfredpayOnrampAdditionalData, BrlOfframpAdditionalData, BrlOfframpUpdateAdditionalData, BrlOnrampAdditionalData, @@ -32,6 +37,7 @@ export class VortexSdk { private publicKey: string | undefined; private networkManager: NetworkManager; private brlHandler: BrlHandler; + private alfredpayHandler: AlfredpayHandler; private initializationPromise: Promise; private storeEphemeralKeys: boolean; @@ -48,6 +54,13 @@ export class VortexSdk { this.signTransactions.bind(this) ); + this.alfredpayHandler = new AlfredpayHandler( + this.apiService, + this, + this.generateEphemerals.bind(this), + this.signTransactions.bind(this) + ); + this.initializationPromise = this.networkManager.waitForInitialization(); } @@ -86,7 +99,13 @@ export class VortexSdk { let unsignedTransactions: UnsignedTx[] = []; if (quote.rampType === RampDirection.BUY) { - if (quote.from === "pix") { + if (isAlfredpayToken(quote.inputCurrency)) { + rampProcess = await this.alfredpayHandler.registerAlfredpayOnramp( + quote.id, + additionalData as AlfredpayOnrampAdditionalData + ); + unsignedTransactions = []; + } else if (quote.from === "pix") { rampProcess = await this.brlHandler.registerBrlOnramp(quote.id, additionalData as BrlOnrampAdditionalData); unsignedTransactions = []; } else if (quote.from === "sepa") { @@ -95,7 +114,11 @@ export class VortexSdk { throw new Error(`Unsupported onramp from: ${quote.from}`); } } else if (quote.rampType === RampDirection.SELL) { - if (quote.to === "pix") { + if (isAlfredpayToken(quote.outputCurrency)) { + const offrampData = additionalData as AlfredpayOfframpAdditionalData; + rampProcess = await this.alfredpayHandler.registerAlfredpayOfframp(quote.id, offrampData); + unsignedTransactions = await this.getUserTransactions(rampProcess, offrampData.walletAddress); + } else if (quote.to === "pix") { rampProcess = await this.brlHandler.registerBrlOfframp(quote.id, additionalData as BrlOfframpAdditionalData); const userAddress = (additionalData as BrlOfframpAdditionalData).walletAddress; unsignedTransactions = await this.getUserTransactions(rampProcess, userAddress); @@ -117,13 +140,20 @@ export class VortexSdk { additionalUpdateData: UpdateRampAdditionalData ): Promise { if (quote.rampType === RampDirection.BUY) { - if (quote.from === "pix") { + if (isAlfredpayToken(quote.inputCurrency)) { + throw new Error("Alfredpay onramp does not require any further data"); + } else if (quote.from === "pix") { throw new Error("Brl onramp does not require any further data"); } else if (quote.from === "sepa") { throw new Error("Euro onramp handler not implemented yet"); } } else if (quote.rampType === RampDirection.SELL) { - if (quote.to === "pix") { + if (isAlfredpayToken(quote.outputCurrency)) { + return this.alfredpayHandler.updateAlfredpayOfframp( + rampId, + additionalUpdateData as AlfredpayOfframpUpdateAdditionalData + ); + } else if (quote.to === "pix") { return this.brlHandler.updateBrlOfframp(rampId, additionalUpdateData as BrlOfframpUpdateAdditionalData); } else if (quote.to === "sepa") { throw new Error("Euro offramp handler not implemented yet"); diff --git a/packages/sdk/src/errors.ts b/packages/sdk/src/errors.ts index c111618bb..4bb279ae5 100644 --- a/packages/sdk/src/errors.ts +++ b/packages/sdk/src/errors.ts @@ -137,6 +137,36 @@ export class InvalidPixKeyError extends BrlOfframpError { } } +// Alfredpay Onramp specific errors +export class AlfredpayOnrampError extends RegisterRampError { + constructor(message: string, status = 400) { + super(message, status); + this.name = "AlfredpayOnrampError"; + } +} + +export class MissingAlfredpayOnrampParametersError extends AlfredpayOnrampError { + constructor() { + super("Parameters destinationAddress and fiatAccountId are required for Alfredpay onramp", 400); + this.name = "MissingAlfredpayOnrampParametersError"; + } +} + +// Alfredpay Offramp specific errors +export class AlfredpayOfframpError extends RegisterRampError { + constructor(message: string, status = 400) { + super(message, status); + this.name = "AlfredpayOfframpError"; + } +} + +export class MissingAlfredpayOfframpParametersError extends AlfredpayOfframpError { + constructor() { + super("Parameters fiatAccountId and walletAddress are required for Alfredpay offramp", 400); + this.name = "MissingAlfredpayOfframpParametersError"; + } +} + // Monerium specific errors export class MoneriumError extends RegisterRampError { constructor(message: string, status = 400) { @@ -362,6 +392,9 @@ export function parseAPIError(response: any): VortexSdkError { if (errorMessage === "Invalid pixKey or receiverTaxId") { return new InvalidPixKeyError(); } + if (errorMessage === "Parameter destinationAddress is required for Alfredpay onramp") { + return new MissingAlfredpayOnrampParametersError(); + } if (errorMessage === "Parameters moneriumAuthToken and destinationAddress are required for Monerium onramp") { return new MissingMoneriumOnrampParametersError(); } diff --git a/packages/sdk/src/handlers/AlfredpayHandler.ts b/packages/sdk/src/handlers/AlfredpayHandler.ts new file mode 100644 index 000000000..1febfb44c --- /dev/null +++ b/packages/sdk/src/handlers/AlfredpayHandler.ts @@ -0,0 +1,151 @@ +import { + AccountMeta, + EphemeralAccount, + EphemeralAccountType, + RampProcess, + RegisterRampRequest, + UnsignedTx, + UpdateRampRequest +} from "@vortexfi/shared"; +import { MissingAlfredpayOfframpParametersError, MissingAlfredpayOnrampParametersError } from "../errors"; +import type { ApiService } from "../services/ApiService"; +import type { + AlfredpayOfframpAdditionalData, + AlfredpayOfframpUpdateAdditionalData, + AlfredpayOnrampAdditionalData, + RampHandler, + VortexSdkContext +} from "../types"; + +export class AlfredpayHandler implements RampHandler { + private apiService: ApiService; + private context: VortexSdkContext; + private generateEphemerals: () => Promise<{ + ephemerals: { [key in EphemeralAccountType]?: EphemeralAccount }; + accountMetas: AccountMeta[]; + }>; + private signTransactions: ( + unsignedTxs: UnsignedTx[], + ephemerals: { + stellarEphemeral?: EphemeralAccount; + substrateEphemeral?: EphemeralAccount; + evmEphemeral?: EphemeralAccount; + } + ) => Promise; + + constructor( + apiService: ApiService, + context: VortexSdkContext, + generateEphemerals: () => Promise<{ + ephemerals: { [key in EphemeralAccountType]?: EphemeralAccount }; + accountMetas: AccountMeta[]; + }>, + signTransactions: ( + unsignedTxs: UnsignedTx[], + ephemerals: { + stellarEphemeral?: EphemeralAccount; + substrateEphemeral?: EphemeralAccount; + evmEphemeral?: EphemeralAccount; + } + ) => Promise + ) { + this.apiService = apiService; + this.context = context; + this.generateEphemerals = generateEphemerals; + this.signTransactions = signTransactions; + } + + async registerAlfredpayOnramp(quoteId: string, additionalData: AlfredpayOnrampAdditionalData): Promise { + if (!additionalData.destinationAddress || !additionalData.fiatAccountId) { + throw new MissingAlfredpayOnrampParametersError(); + } + + const { ephemerals, accountMetas } = await this.generateEphemerals(); + + const registerRequest: RegisterRampRequest = { + additionalData: { + destinationAddress: additionalData.destinationAddress, + fiatAccountId: additionalData.fiatAccountId, + sessionId: additionalData.sessionId, + walletAddress: additionalData.walletAddress + }, + quoteId, + signingAccounts: accountMetas + }; + + const rampProcess = await this.apiService.registerRamp(registerRequest); + + await this.context.storeEphemerals(ephemerals, rampProcess.id); + + const signedTxs = await this.signTransactions(rampProcess.unsignedTxs || [], { + evmEphemeral: ephemerals.EVM, + stellarEphemeral: ephemerals.Stellar, + substrateEphemeral: ephemerals.Substrate + }); + + const updateRequest: UpdateRampRequest = { + additionalData: {}, + presignedTxs: signedTxs, + rampId: rampProcess.id + }; + + return this.apiService.updateRamp(updateRequest); + } + + async registerAlfredpayOfframp(quoteId: string, additionalData: AlfredpayOfframpAdditionalData): Promise { + if (!additionalData.fiatAccountId || !additionalData.walletAddress) { + throw new MissingAlfredpayOfframpParametersError(); + } + + const { ephemerals, accountMetas } = await this.generateEphemerals(); + + const registerRequest: RegisterRampRequest = { + additionalData: { + fiatAccountId: additionalData.fiatAccountId, + sessionId: additionalData.sessionId, + walletAddress: additionalData.walletAddress + }, + quoteId, + signingAccounts: accountMetas + }; + + const rampProcess = await this.apiService.registerRamp(registerRequest); + + await this.context.storeEphemerals(ephemerals, rampProcess.id); + + const signedTxs = await this.signTransactions(rampProcess.unsignedTxs || [], { + evmEphemeral: ephemerals.EVM, + stellarEphemeral: ephemerals.Stellar, + substrateEphemeral: ephemerals.Substrate + }); + + const updateRequest: UpdateRampRequest = { + additionalData: {}, + presignedTxs: signedTxs, + rampId: rampProcess.id + }; + + return this.apiService.updateRamp(updateRequest); + } + + async updateAlfredpayOfframp(rampId: string, additionalData: AlfredpayOfframpUpdateAdditionalData): Promise { + const rampProcess = await this.apiService.getRampStatus(rampId); + if (rampProcess.currentPhase !== "initial") { + throw new Error( + `Invalid ramp id. Ramp must be on initial phase to be updated. Current phase: ${rampProcess.currentPhase}` + ); + } + + const updateRequest: UpdateRampRequest = { + additionalData: { + assethubToPendulumHash: additionalData.assethubToPendulumHash, + squidRouterApproveHash: additionalData.squidRouterApproveHash, + squidRouterSwapHash: additionalData.squidRouterSwapHash + }, + presignedTxs: [], + rampId: rampProcess.id + }; + + return this.apiService.updateRamp(updateRequest); + } +} diff --git a/packages/sdk/src/types.ts b/packages/sdk/src/types.ts index 81c7cc700..5a1b6a762 100644 --- a/packages/sdk/src/types.ts +++ b/packages/sdk/src/types.ts @@ -26,7 +26,15 @@ export { EvmTransactionData }; -export type AnyQuote = BrlOnrampQuote | EurOnrampQuote | BrlOfframpQuote | EurOfframpQuote; +export type AnyQuote = + | BrlOnrampQuote + | EurOnrampQuote + | AlfredpayOnrampQuote + | BrlOfframpQuote + | EurOfframpQuote + | AlfredpayOfframpQuote; + +export type AlfredpayCurrency = FiatToken.USD | FiatToken.MXN | FiatToken.COP; export type BrlOnrampQuote = QuoteResponse & { rampType: RampDirection.BUY; @@ -38,6 +46,11 @@ export type EurOnrampQuote = QuoteResponse & { from: "sepa"; }; +export type AlfredpayOnrampQuote = QuoteResponse & { + rampType: RampDirection.BUY; + inputCurrency: AlfredpayCurrency; +}; + export type BrlOfframpQuote = QuoteResponse & { rampType: RampDirection.SELL; to: "pix"; @@ -48,31 +61,46 @@ export type EurOfframpQuote = QuoteResponse & { to: "sepa"; }; +export type AlfredpayOfframpQuote = QuoteResponse & { + rampType: RampDirection.SELL; + outputCurrency: AlfredpayCurrency; +}; + export type ExtendedQuoteResponse = T extends { rampType: RampDirection.BUY; from: "pix" } ? BrlOnrampQuote : T extends { rampType: RampDirection.BUY; from: "sepa" } ? EurOnrampQuote - : T extends { rampType: RampDirection.SELL; to: "pix" } - ? BrlOfframpQuote - : T extends { rampType: RampDirection.SELL; to: "sepa" } - ? EurOfframpQuote - : AnyQuote; + : T extends { rampType: RampDirection.BUY; inputCurrency: AlfredpayCurrency } + ? AlfredpayOnrampQuote + : T extends { rampType: RampDirection.SELL; to: "pix" } + ? BrlOfframpQuote + : T extends { rampType: RampDirection.SELL; to: "sepa" } + ? EurOfframpQuote + : T extends { rampType: RampDirection.SELL; outputCurrency: AlfredpayCurrency } + ? AlfredpayOfframpQuote + : AnyQuote; export type AnyAdditionalData = | BrlOfframpAdditionalData | EurOfframpAdditionalData + | AlfredpayOfframpAdditionalData | BrlOnrampAdditionalData - | EurOnrampAdditionalData; + | EurOnrampAdditionalData + | AlfredpayOnrampAdditionalData; export type RegisterRampAdditionalData = Q extends BrlOnrampQuote ? BrlOnrampAdditionalData : Q extends EurOnrampQuote ? EurOnrampAdditionalData - : Q extends BrlOfframpQuote - ? BrlOfframpAdditionalData - : Q extends EurOfframpQuote - ? EurOfframpAdditionalData - : AnyAdditionalData; + : Q extends AlfredpayOnrampQuote + ? AlfredpayOnrampAdditionalData + : Q extends BrlOfframpQuote + ? BrlOfframpAdditionalData + : Q extends EurOfframpQuote + ? EurOfframpAdditionalData + : Q extends AlfredpayOfframpQuote + ? AlfredpayOfframpAdditionalData + : AnyAdditionalData; export interface BrlOnrampAdditionalData { destinationAddress: string; @@ -83,6 +111,13 @@ export interface EurOnrampAdditionalData { moneriumAuthToken: string; } +export interface AlfredpayOnrampAdditionalData { + destinationAddress: string; + fiatAccountId: string; + walletAddress?: string; + sessionId?: string; +} + export interface BrlOfframpAdditionalData { pixDestination: string; receiverTaxId: string; @@ -95,20 +130,31 @@ export interface EurOfframpAdditionalData { walletAddress: string; } +export interface AlfredpayOfframpAdditionalData { + fiatAccountId: string; + walletAddress: string; + sessionId?: string; +} + export type AnyUpdateAdditionalData = | EurOnrampUpdateAdditionalData | BrlOfframpUpdateAdditionalData - | EurOfframpUpdateAdditionalData; + | EurOfframpUpdateAdditionalData + | AlfredpayOfframpUpdateAdditionalData; export type UpdateRampAdditionalData = Q extends BrlOnrampQuote ? never // No additional data required from the user for this type of ramp. : Q extends EurOnrampQuote ? EurOnrampUpdateAdditionalData - : Q extends BrlOfframpQuote - ? BrlOfframpUpdateAdditionalData - : Q extends EurOfframpQuote - ? EurOfframpUpdateAdditionalData - : AnyUpdateAdditionalData; + : Q extends AlfredpayOnrampQuote + ? never // Alfredpay onramp settles fiat off-chain; no user transactions to update. + : Q extends BrlOfframpQuote + ? BrlOfframpUpdateAdditionalData + : Q extends EurOfframpQuote + ? EurOfframpUpdateAdditionalData + : Q extends AlfredpayOfframpQuote + ? AlfredpayOfframpUpdateAdditionalData + : AnyUpdateAdditionalData; export interface EurOnrampUpdateAdditionalData { squidRouterApproveHash: string; @@ -127,6 +173,12 @@ export interface EurOfframpUpdateAdditionalData { assethubToPendulumHash?: string; } +export interface AlfredpayOfframpUpdateAdditionalData { + squidRouterApproveHash?: string; + squidRouterSwapHash?: string; + assethubToPendulumHash?: string; +} + export interface BrlKycResponse { evmAddress: string; kycLevel: number; From e5a7af0d646839c26079dccb6e920e6b549573c3 Mon Sep 17 00:00:00 2001 From: Kacper Szarkiewicz Date: Wed, 3 Jun 2026 19:08:42 +0100 Subject: [PATCH 002/176] fix example --- packages/sdk/README.md | 8 ++++++-- packages/sdk/src/errors.ts | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/sdk/README.md b/packages/sdk/README.md index 54172be7c..cf37ffe4e 100644 --- a/packages/sdk/README.md +++ b/packages/sdk/README.md @@ -54,13 +54,15 @@ const startedRamp = await sdk.startRamp(rampProcess.id); ### Alfredpay (USD / MXN / COP) onramp ```typescript -import { VortexSdk, FiatToken, EvmToken, Networks, RampDirection } from "@vortexfi/sdk"; +import { VortexSdk, FiatToken, EvmToken, EPaymentMethod, Networks, RampDirection } from "@vortexfi/sdk"; const sdk = new VortexSdk({ apiBaseUrl: "http://localhost:3000" }); const quote = await sdk.createQuote({ + from: EPaymentMethod.ACH, // USD and COP settle via ACH; MXN uses EPaymentMethod.SPEI inputAmount: "100", inputCurrency: FiatToken.COP, + network: Networks.Polygon, outputCurrency: EvmToken.USDC, rampType: RampDirection.BUY, to: Networks.Polygon @@ -84,8 +86,10 @@ const quote = await sdk.createQuote({ from: Networks.Polygon, inputAmount: "10", inputCurrency: EvmToken.USDC, + network: Networks.Polygon, outputCurrency: FiatToken.MXN, - rampType: RampDirection.SELL + rampType: RampDirection.SELL, + to: EPaymentMethod.SPEI // USD and COP settle via EPaymentMethod.ACH }); const { rampProcess, unsignedTransactions } = await sdk.registerRamp(quote, { diff --git a/packages/sdk/src/errors.ts b/packages/sdk/src/errors.ts index 4bb279ae5..0e6bfd525 100644 --- a/packages/sdk/src/errors.ts +++ b/packages/sdk/src/errors.ts @@ -395,6 +395,9 @@ export function parseAPIError(response: any): VortexSdkError { if (errorMessage === "Parameter destinationAddress is required for Alfredpay onramp") { return new MissingAlfredpayOnrampParametersError(); } + if (errorMessage === "fiatAccountId is required for Alfredpay offramp") { + return new MissingAlfredpayOfframpParametersError(); + } if (errorMessage === "Parameters moneriumAuthToken and destinationAddress are required for Monerium onramp") { return new MissingMoneriumOnrampParametersError(); } From 5c43865de4c69663c8fb1f1403f9f871be378471 Mon Sep 17 00:00:00 2001 From: Kacper Szarkiewicz Date: Wed, 3 Jun 2026 19:21:23 +0100 Subject: [PATCH 003/176] test(sdk): add Alfredpay handler regression tests; dedupe offramp-update types --- packages/sdk/src/types.ts | 16 +- packages/sdk/test/alfredpayHandler.test.ts | 163 +++++++++++++++++++++ 2 files changed, 168 insertions(+), 11 deletions(-) create mode 100644 packages/sdk/test/alfredpayHandler.test.ts diff --git a/packages/sdk/src/types.ts b/packages/sdk/src/types.ts index 5a1b6a762..7a76b5682 100644 --- a/packages/sdk/src/types.ts +++ b/packages/sdk/src/types.ts @@ -162,22 +162,16 @@ export interface EurOnrampUpdateAdditionalData { moneriumOfframpSignature: string; } -export interface BrlOfframpUpdateAdditionalData { - squidRouterApproveHash?: string; - squidRouterSwapHash?: string; - assethubToPendulumHash?: string; -} -export interface EurOfframpUpdateAdditionalData { +export interface OfframpUpdateAdditionalData { squidRouterApproveHash?: string; squidRouterSwapHash?: string; assethubToPendulumHash?: string; } -export interface AlfredpayOfframpUpdateAdditionalData { - squidRouterApproveHash?: string; - squidRouterSwapHash?: string; - assethubToPendulumHash?: string; -} +// BRL, EUR, and Alfredpay offramps all push back the same on-chain tx hashes. +export type BrlOfframpUpdateAdditionalData = OfframpUpdateAdditionalData; +export type EurOfframpUpdateAdditionalData = OfframpUpdateAdditionalData; +export type AlfredpayOfframpUpdateAdditionalData = OfframpUpdateAdditionalData; export interface BrlKycResponse { evmAddress: string; diff --git a/packages/sdk/test/alfredpayHandler.test.ts b/packages/sdk/test/alfredpayHandler.test.ts new file mode 100644 index 000000000..4f7783980 --- /dev/null +++ b/packages/sdk/test/alfredpayHandler.test.ts @@ -0,0 +1,163 @@ +// Regression coverage for the Alfredpay (USD / MXN / COP) on/off-ramp flows. +// Exercises the real AlfredpayHandler against an in-memory backend (no network, +// RPC, KYC, or on-chain funds) to lock in routing, request payloads, and call +// ordering. Run: cd packages/sdk && bun test + +import { describe, expect, test } from "bun:test"; +import { FiatToken, isAlfredpayToken } from "@vortexfi/shared"; +import { MissingAlfredpayOfframpParametersError, MissingAlfredpayOnrampParametersError } from "../src/errors"; +import { AlfredpayHandler } from "../src/handlers/AlfredpayHandler"; + +const WALLET = "0x1234567890123456789012345678901234567890"; +const FIAT_ACCOUNT = "fa_demo"; + +type Call = { method: string; payload: any }; + +function setup(overrides: { unsignedTxs?: any[]; currentPhase?: string } = {}) { + const calls: Call[] = []; + const unsignedTxs = overrides.unsignedTxs ?? []; + + const apiService = { + getRampStatus: async (id: string) => { + calls.push({ method: "getRampStatus", payload: id }); + return { currentPhase: overrides.currentPhase ?? "initial", id, unsignedTxs }; + }, + registerRamp: async (req: any) => { + calls.push({ method: "registerRamp", payload: req }); + return { currentPhase: "initial", id: "ramp_1", unsignedTxs }; + }, + updateRamp: async (req: any) => { + calls.push({ method: "updateRamp", payload: req }); + return { currentPhase: "initial", id: req.rampId, unsignedTxs }; + } + }; + + const context = { + storeEphemerals: async (...args: any[]) => { + calls.push({ method: "storeEphemerals", payload: args }); + } + }; + + const generateEphemerals = async () => ({ + accountMetas: [ + { address: "GSTELLAR", type: "Stellar" }, + { address: "5SUBSTRATE", type: "Substrate" }, + { address: "0xEVM", type: "EVM" } + ], + ephemerals: { + EVM: { address: "0xEVM", secret: "s" }, + Stellar: { address: "GSTELLAR", secret: "s" }, + Substrate: { address: "5SUBSTRATE", secret: "s" } + } + }); + + const signTransactions = async (txs: any[]) => { + calls.push({ method: "signTransactions", payload: txs }); + return txs.map((_t, i) => ({ id: `presigned_${i}` })); + }; + + const handler = new AlfredpayHandler(apiService as any, context as any, generateEphemerals as any, signTransactions as any); + return { calls, handler }; +} + +describe("isAlfredpayToken routing", () => { + test("USD/MXN/COP route to Alfredpay", () => { + for (const t of [FiatToken.USD, FiatToken.MXN, FiatToken.COP]) { + expect(isAlfredpayToken(t)).toBe(true); + } + }); + + test("BRL/EURC/ARS do not route to Alfredpay", () => { + for (const t of [FiatToken.BRL, FiatToken.EURC, FiatToken.ARS]) { + expect(isAlfredpayToken(t)).toBe(false); + } + }); +}); + +describe("AlfredpayHandler onramp", () => { + test("registers, stores ephemerals, signs, then updates", async () => { + const { calls, handler } = setup({ unsignedTxs: [{ phase: "fundEphemeral", signer: "5SUBSTRATE" }] }); + + const result = await handler.registerAlfredpayOnramp("quote_1", { + destinationAddress: WALLET, + fiatAccountId: FIAT_ACCOUNT, + walletAddress: WALLET + }); + + expect(result.id).toBe("ramp_1"); + expect(calls.map(c => c.method)).toEqual(["registerRamp", "storeEphemerals", "signTransactions", "updateRamp"]); + + const reg = calls.find(c => c.method === "registerRamp")!.payload; + expect(reg.quoteId).toBe("quote_1"); + expect(reg.additionalData.destinationAddress).toBe(WALLET); + expect(reg.additionalData.fiatAccountId).toBe(FIAT_ACCOUNT); + expect(reg.signingAccounts).toHaveLength(3); + + const upd = calls.find(c => c.method === "updateRamp")!.payload; + expect(upd.presignedTxs).toHaveLength(1); + expect(upd.additionalData).toEqual({}); + }); + + test("throws when destinationAddress missing", async () => { + const { handler } = setup(); + await expect( + handler.registerAlfredpayOnramp("q", { destinationAddress: "", fiatAccountId: FIAT_ACCOUNT } as any) + ).rejects.toBeInstanceOf(MissingAlfredpayOnrampParametersError); + }); + + test("throws when fiatAccountId missing", async () => { + const { handler } = setup(); + await expect( + handler.registerAlfredpayOnramp("q", { destinationAddress: WALLET, fiatAccountId: "" } as any) + ).rejects.toBeInstanceOf(MissingAlfredpayOnrampParametersError); + }); +}); + +describe("AlfredpayHandler offramp", () => { + test("registers with fiatAccountId + walletAddress (no destinationAddress)", async () => { + const { calls, handler } = setup({ unsignedTxs: [{ phase: "squidRouterApprove", signer: WALLET }] }); + + const result = await handler.registerAlfredpayOfframp("quote_2", { fiatAccountId: FIAT_ACCOUNT, walletAddress: WALLET }); + + expect(result.id).toBe("ramp_1"); + expect(calls.map(c => c.method)).toEqual(["registerRamp", "storeEphemerals", "signTransactions", "updateRamp"]); + + const reg = calls.find(c => c.method === "registerRamp")!.payload; + expect(reg.additionalData.fiatAccountId).toBe(FIAT_ACCOUNT); + expect(reg.additionalData.walletAddress).toBe(WALLET); + expect(reg.additionalData.destinationAddress).toBeUndefined(); + }); + + test("throws when fiatAccountId missing", async () => { + const { handler } = setup(); + await expect( + handler.registerAlfredpayOfframp("q", { fiatAccountId: "", walletAddress: WALLET } as any) + ).rejects.toBeInstanceOf(MissingAlfredpayOfframpParametersError); + }); + + test("throws when walletAddress missing", async () => { + const { handler } = setup(); + await expect( + handler.registerAlfredpayOfframp("q", { fiatAccountId: FIAT_ACCOUNT, walletAddress: "" } as any) + ).rejects.toBeInstanceOf(MissingAlfredpayOfframpParametersError); + }); +}); + +describe("AlfredpayHandler offramp update", () => { + test("forwards squidRouter hashes with no presignedTxs after phase check", async () => { + const { calls, handler } = setup({ currentPhase: "initial" }); + + await handler.updateAlfredpayOfframp("ramp_1", { squidRouterApproveHash: "0xA", squidRouterSwapHash: "0xS" }); + + expect(calls.map(c => c.method)).toEqual(["getRampStatus", "updateRamp"]); + const upd = calls.find(c => c.method === "updateRamp")!.payload; + expect(upd.additionalData.squidRouterApproveHash).toBe("0xA"); + expect(upd.additionalData.squidRouterSwapHash).toBe("0xS"); + expect(upd.presignedTxs).toHaveLength(0); + }); + + test("throws when ramp is not on the initial phase", async () => { + const { handler } = setup({ currentPhase: "started" }); + await expect(handler.updateAlfredpayOfframp("ramp_1", {})).rejects.toThrow(/initial phase/); + }); +}); From c3f5d6a1a0b51cea37f18430e80c403b86fb55b5 Mon Sep 17 00:00:00 2001 From: Kacper Szarkiewicz Date: Wed, 17 Jun 2026 11:58:32 +0200 Subject: [PATCH 004/176] feat(frontend): tag and group Sentry API errors by domain and endpoint --- .../src/machines/actors/sign.actor.ts | 5 +- apps/frontend/src/services/api/api-client.ts | 53 +++++++++++++++++-- 2 files changed, 53 insertions(+), 5 deletions(-) diff --git a/apps/frontend/src/machines/actors/sign.actor.ts b/apps/frontend/src/machines/actors/sign.actor.ts index f83df4b6b..a5d597cbb 100644 --- a/apps/frontend/src/machines/actors/sign.actor.ts +++ b/apps/frontend/src/machines/actors/sign.actor.ts @@ -7,6 +7,7 @@ import { PresignedTx } from "@vortexfi/shared"; import { RampService } from "../../services/api"; +import type { DomainError } from "../../services/api/api-client"; import { signAndSubmitEvmTransaction, signAndSubmitSubstrateTransaction, @@ -19,8 +20,10 @@ export enum SignRampErrorType { UserRejected = "USER_REJECTED", UnknownError = "UNKNOWN_ERROR" } -export class SignRampError extends Error { +export class SignRampError extends Error implements DomainError { type: SignRampErrorType; + // Tagged as the "wallet" business area in Sentry's beforeSend. + domain = "wallet"; constructor(message: string, type: SignRampErrorType) { super(message); this.type = type; diff --git a/apps/frontend/src/services/api/api-client.ts b/apps/frontend/src/services/api/api-client.ts index 66f9c66a1..656c9a4da 100644 --- a/apps/frontend/src/services/api/api-client.ts +++ b/apps/frontend/src/services/api/api-client.ts @@ -1,14 +1,22 @@ import { SIGNING_SERVICE_URL } from "../../constants/constants"; import { AuthService } from "../auth"; -export class ApiError extends Error { +// Errors carrying a `domain` are tagged by business area (kyc/kyb/quote/ramp/auth/wallet) +// in Sentry's beforeSend. Implemented by ApiError and SignRampError. +export interface DomainError { + domain: string; +} + +export class ApiError extends Error implements DomainError { status: number; data: { error?: string; message?: string; details?: string }; + domain: string; - constructor(status: number, data: { error?: string; message?: string; details?: string }, message: string) { + constructor(status: number, data: { error?: string; message?: string; details?: string }, message: string, domain: string) { super(message); this.status = status; this.data = data; + this.domain = domain; } } @@ -16,6 +24,37 @@ export function isApiError(error: unknown): error is ApiError { return error instanceof ApiError; } +// Replace dynamic path segments (uuids, numeric ids, wallet addresses/long tokens) with ":id" +// so Sentry groups errors by endpoint instead of creating one issue per id. Also keeps +// addresses out of issue titles. +function normalizePath(path: string): string { + return path + .replace(/\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}(?=\/|$)/g, "/:id") + .replace(/\/\d+(?=\/|$)/g, "/:id") + .replace(/\/[A-Za-z0-9]{20,}(?=\/|$)/g, "/:id"); +} + +// Map an endpoint path to a coarse business domain for Sentry tagging. +function getApiDomain(path: string): string { + if (path.toLowerCase().includes("kyb")) return "kyb"; + const segment = path.split("/").filter(Boolean)[0]?.toLowerCase(); + switch (segment) { + case "ramp": + case "subsidize": + return "ramp"; + case "quotes": + return "quote"; + case "brla": + case "alfredpay": + case "mykobo": + return "kyc"; + case "siwe": + return "auth"; + default: + return segment ?? "api"; + } +} + async function apiFetch( method: string, path: string, @@ -52,8 +91,14 @@ async function apiFetch( const errorData = (await response.json().catch(() => ({}))) as { error?: string; message?: string }; console.error("API Error:", errorData); const serverMessage = errorData.error ?? errorData.message ?? response.statusText; - // Prefix with method/status/path so Sentry groups by endpoint instead of one generic bucket. - throw new ApiError(response.status, errorData, `${method.toUpperCase()} ${path} (${response.status}): ${serverMessage}`); + // Prefix with method/status/normalized-path so Sentry groups by endpoint (one issue per + // endpoint, not per id) instead of one generic bucket. + throw new ApiError( + response.status, + errorData, + `${method.toUpperCase()} ${normalizePath(path)} (${response.status}): ${serverMessage}`, + getApiDomain(path) + ); } if (response.status === 204) return undefined as T; From 00a0dfa8dbc78838bbe966f092973d82cc43fe23 Mon Sep 17 00:00:00 2001 From: Kacper Szarkiewicz Date: Wed, 17 Jun 2026 11:58:40 +0200 Subject: [PATCH 005/176] feat(frontend): filter Sentry noise and scrub PII in beforeSend --- apps/frontend/src/helpers/sentry.ts | 71 +++++++++++++++++++++++++++++ apps/frontend/src/main.tsx | 19 ++++++-- 2 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 apps/frontend/src/helpers/sentry.ts diff --git a/apps/frontend/src/helpers/sentry.ts b/apps/frontend/src/helpers/sentry.ts new file mode 100644 index 000000000..5f72aa172 --- /dev/null +++ b/apps/frontend/src/helpers/sentry.ts @@ -0,0 +1,71 @@ +import type { ErrorEvent, EventHint } from "@sentry/react"; +import { type DomainError, isApiError } from "../services/api/api-client"; + +// Expected, unactionable noise we never want to report: wallet user-rejections, +// browser-extension internals, benign ResizeObserver warnings, and cancelled requests. +// Note: TimeoutError is intentionally NOT ignored — a request timeout can signal a slow backend. +export const SENTRY_IGNORE_ERRORS: (string | RegExp)[] = [ + "User rejected the request", + "User denied", + "User rejected", + "Rejected by user", + /ResizeObserver loop completed/, + /ResizeObserver loop limit exceeded/, + "Extension context invalidated", + "AbortError", + "The user aborted a request" +]; + +// Drop events whose top frame comes from a browser-extension injected script. +export const SENTRY_DENY_URLS: RegExp[] = [ + /^chrome-extension:\/\//, + /^moz-extension:\/\//, + /^safari-extension:\/\//, + /^chrome:\/\// +]; + +// Query strings can carry PII (session ids, tax ids, wallet addresses, callback urls). +// The path alone is enough for debugging, so redact everything after "?". +function stripQueryString(url: string): string { + const queryIndex = url.indexOf("?"); + return queryIndex === -1 ? url : `${url.slice(0, queryIndex)}?[Filtered]`; +} + +// Client errors that are user-driven or expected (auth, rate-limit, not-found) rather than bugs. +// 400/422 are kept — they usually mean we sent a bad request, which is worth reporting. +const EXPECTED_CLIENT_STATUSES = new Set([401, 403, 404, 409, 429]); + +function hasDomain(error: unknown): error is DomainError { + return typeof error === "object" && error !== null && typeof (error as DomainError).domain === "string"; +} + +// Tag events by business domain (when the originating error carries one), drop expected +// client errors, and strip PII from URLs before the event leaves the browser. +export function sentryBeforeSend(event: ErrorEvent, hint: EventHint): ErrorEvent | null { + const original = hint.originalException; + + // Don't report expected client errors (auth/rate-limit/not-found) — user-driven, not bugs. + if (isApiError(original) && EXPECTED_CLIENT_STATUSES.has(original.status)) { + return null; + } + + if (hasDomain(original)) { + event.tags = { ...event.tags, domain: original.domain }; + } + + if (event.request?.url) { + event.request.url = stripQueryString(event.request.url); + } + if (event.request?.query_string) { + event.request.query_string = "[Filtered]"; + } + if (event.breadcrumbs) { + event.breadcrumbs = event.breadcrumbs.map(breadcrumb => + typeof breadcrumb.data?.url === "string" + ? { ...breadcrumb, data: { ...breadcrumb.data, url: stripQueryString(breadcrumb.data.url) } } + : breadcrumb + ); + } + + return event; +} diff --git a/apps/frontend/src/main.tsx b/apps/frontend/src/main.tsx index 8a9045f5b..09be9723c 100644 --- a/apps/frontend/src/main.tsx +++ b/apps/frontend/src/main.tsx @@ -16,6 +16,7 @@ import { WagmiProvider } from "wagmi"; import { config } from "./config"; import { PolkadotNodeProvider } from "./contexts/polkadotNode"; import { PolkadotWalletStateProvider } from "./contexts/polkadotWallet"; +import { SENTRY_DENY_URLS, SENTRY_IGNORE_ERRORS, sentryBeforeSend } from "./helpers/sentry"; import { initializeEvmTokens } from "./services/tokens"; import { wagmiConfig } from "./wagmiConfig"; import "./helpers/googleTranslate"; @@ -57,15 +58,25 @@ declare module "@tanstack/react-router" { const sentryDsn = import.meta.env.VITE_SENTRY_DSN; if (sentryDsn) { Sentry.init({ + beforeSend: sentryBeforeSend, + denyUrls: SENTRY_DENY_URLS, dsn: sentryDsn, enabled: !window.location.hostname.includes("localhost"), // Disable sentry entirely when testing locally - environment: config.isProd ? "production" : "development", - integrations: [Sentry.tanstackRouterBrowserTracingIntegration(router), Sentry.replayIntegration()], + environment: config.env, // production | staging | development — keeps preview/QA noise out of prod + ignoreErrors: SENTRY_IGNORE_ERRORS, + // Explicit replay masking — these are the defaults, but pinned for a KYC/KYB app so a future + // default change can't start leaking user input into replays. + integrations: [ + Sentry.tanstackRouterBrowserTracingIntegration(router), + Sentry.replayIntegration({ blockAllMedia: true, maskAllText: true }) + ], // Capture 100% of sessions where an error occurs; sample plain sessions only in prod. replaysOnErrorSampleRate: 1.0, replaysSessionSampleRate: config.isProd ? 0.1 : 1.0, - // Allow all targets to account for different Netlify URLs which depend on the branch name. - tracePropagationTargets: ["*"], + // Only propagate trace headers to our own (same-origin) API. The API is served same-origin + // (/api/...), so this works across all Netlify branch URLs and avoids leaking headers to + // third parties (Squid, RPCs). + tracePropagationTargets: [window.location.origin], tracesSampleRate: config.isProd ? 0.2 : 1.0 }); } From 63bc6f31db5d77f44e439f93b9187e07011f45ab Mon Sep 17 00:00:00 2001 From: Kacper Szarkiewicz Date: Wed, 17 Jun 2026 11:58:54 +0200 Subject: [PATCH 006/176] feat(frontend): report ramp money-flow failures and add widget error boundary --- apps/frontend/src/machines/ramp.machine.ts | 25 ++++++++++++++++------ apps/frontend/src/pages/widget/index.tsx | 18 +++++++++++++++- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/apps/frontend/src/machines/ramp.machine.ts b/apps/frontend/src/machines/ramp.machine.ts index f7540af07..11a445d2b 100644 --- a/apps/frontend/src/machines/ramp.machine.ts +++ b/apps/frontend/src/machines/ramp.machine.ts @@ -1,3 +1,4 @@ +import * as Sentry from "@sentry/react"; import { FiatToken, RampDirection } from "@vortexfi/shared"; import { assign, emit, fromCallback, fromPromise, setup } from "xstate"; import { ToastMessage } from "../helpers/notifications"; @@ -64,6 +65,15 @@ function getActorErrorMessage(event: unknown): string { export const rampMachine = setup({ actions: { + // Report genuine money-flow failures to Sentry. User-rejected signatures are expected, + // not bugs, so they are skipped here regardless of how the transition was routed. + captureActorError: ({ event }) => { + const error = (event as { error?: unknown }).error; + if (!error || (error instanceof SignRampError && error.type === SignRampErrorType.UserRejected)) { + return; + } + Sentry.captureException(error); + }, refreshQuoteActionWithDelay: async ({ context, self }) => { const { quote, quoteLocked, apiKey, partnerId } = context; if (quoteLocked || !quote) { @@ -355,12 +365,15 @@ export const rampMachine = setup({ } }, Error: { - entry: assign(({ context }) => ({ - ...context, - rampSigningPhase: undefined, - rampSigningPhaseCurrent: undefined, - rampSigningPhaseMax: undefined - })), + entry: [ + "captureActorError", + assign(({ context }) => ({ + ...context, + rampSigningPhase: undefined, + rampSigningPhaseCurrent: undefined, + rampSigningPhaseMax: undefined + })) + ], on: { RESET_RAMP: { target: "Resetting" diff --git a/apps/frontend/src/pages/widget/index.tsx b/apps/frontend/src/pages/widget/index.tsx index 0cf6e0428..a37d8d58d 100644 --- a/apps/frontend/src/pages/widget/index.tsx +++ b/apps/frontend/src/pages/widget/index.tsx @@ -1,6 +1,8 @@ +import * as Sentry from "@sentry/react"; import { isValidCnpj } from "@vortexfi/shared"; import { useSelector } from "@xstate/react"; import { motion } from "motion/react"; +import { useTranslation } from "react-i18next"; import { AlfredpayKycFlow } from "../../components/Alfredpay/AlfredpayKycFlow"; import { LoadingScreen } from "../../components/Alfredpay/LoadingScreen"; import { AveniaKYBFlow } from "../../components/Avenia/AveniaKYBFlow"; @@ -34,6 +36,18 @@ export interface WidgetProps { className?: string; } +const WidgetErrorFallback = ({ onReset }: { onReset: () => void }) => { + const { t } = useTranslation(); + return ( +
+

{t("toasts.genericError")}

+ +
+ ); +}; + export const Widget = ({ className }: WidgetProps) => (
( className )} > - + }> + +
From 75ddce90d67218dbe7a74d3c2f0af0d93856f978 Mon Sep 17 00:00:00 2001 From: Kacper Szarkiewicz Date: Wed, 17 Jun 2026 17:03:28 +0200 Subject: [PATCH 007/176] improve Sentry Tags --- .../src/machines/actors/sign.actor.ts | 6 +-- apps/frontend/src/services/api/api-client.ts | 48 +++++++++++-------- 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/apps/frontend/src/machines/actors/sign.actor.ts b/apps/frontend/src/machines/actors/sign.actor.ts index a5d597cbb..cf03a2882 100644 --- a/apps/frontend/src/machines/actors/sign.actor.ts +++ b/apps/frontend/src/machines/actors/sign.actor.ts @@ -7,7 +7,7 @@ import { PresignedTx } from "@vortexfi/shared"; import { RampService } from "../../services/api"; -import type { DomainError } from "../../services/api/api-client"; +import { type DomainError, SentryDomain } from "../../services/api/api-client"; import { signAndSubmitEvmTransaction, signAndSubmitSubstrateTransaction, @@ -22,8 +22,8 @@ export enum SignRampErrorType { } export class SignRampError extends Error implements DomainError { type: SignRampErrorType; - // Tagged as the "wallet" business area in Sentry's beforeSend. - domain = "wallet"; + // Tagged as the wallet business area in Sentry's beforeSend. + domain = SentryDomain.Wallet; constructor(message: string, type: SignRampErrorType) { super(message); this.type = type; diff --git a/apps/frontend/src/services/api/api-client.ts b/apps/frontend/src/services/api/api-client.ts index 656c9a4da..2b8e5023b 100644 --- a/apps/frontend/src/services/api/api-client.ts +++ b/apps/frontend/src/services/api/api-client.ts @@ -1,8 +1,19 @@ import { SIGNING_SERVICE_URL } from "../../constants/constants"; import { AuthService } from "../auth"; -// Errors carrying a `domain` are tagged by business area (kyc/kyb/quote/ramp/auth/wallet) -// in Sentry's beforeSend. Implemented by ApiError and SignRampError. +// Named business areas used as the Sentry `domain` tag. API errors map to these by endpoint; +// unmapped endpoints fall through to their raw path segment (see getApiDomain). +export enum SentryDomain { + Kyc = "kyc", + Kyb = "kyb", + Quote = "quote", + Ramp = "ramp", + Auth = "auth", + Wallet = "wallet" +} + +// Errors carrying a `domain` are tagged by business area in Sentry's beforeSend. +// Implemented by ApiError and SignRampError. export interface DomainError { domain: string; } @@ -34,25 +45,22 @@ function normalizePath(path: string): string { .replace(/\/[A-Za-z0-9]{20,}(?=\/|$)/g, "/:id"); } -// Map an endpoint path to a coarse business domain for Sentry tagging. +const DOMAIN_BY_SEGMENT: Record = { + alfredpay: SentryDomain.Kyc, + brla: SentryDomain.Kyc, + mykobo: SentryDomain.Kyc, + quotes: SentryDomain.Quote, + ramp: SentryDomain.Ramp, + siwe: SentryDomain.Auth, + subsidize: SentryDomain.Ramp +}; + +// Map an endpoint path to a business domain for Sentry tagging. Unmapped endpoints fall +// through to their raw path segment. function getApiDomain(path: string): string { - if (path.toLowerCase().includes("kyb")) return "kyb"; - const segment = path.split("/").filter(Boolean)[0]?.toLowerCase(); - switch (segment) { - case "ramp": - case "subsidize": - return "ramp"; - case "quotes": - return "quote"; - case "brla": - case "alfredpay": - case "mykobo": - return "kyc"; - case "siwe": - return "auth"; - default: - return segment ?? "api"; - } + if (path.toLowerCase().includes("kyb")) return SentryDomain.Kyb; + const segment = path.split("/").filter(Boolean)[0]?.toLowerCase() ?? "api"; + return DOMAIN_BY_SEGMENT[segment] ?? segment; } async function apiFetch( From 7291e6d0ad34539a4acb1584dac514927ac72673 Mon Sep 17 00:00:00 2001 From: Kacper Szarkiewicz Date: Wed, 17 Jun 2026 17:12:11 +0200 Subject: [PATCH 008/176] add sentry-vortex skill --- .agents/skills/sentry-vortex/SKILL.md | 72 +++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .agents/skills/sentry-vortex/SKILL.md diff --git a/.agents/skills/sentry-vortex/SKILL.md b/.agents/skills/sentry-vortex/SKILL.md new file mode 100644 index 000000000..c99f1a9ff --- /dev/null +++ b/.agents/skills/sentry-vortex/SKILL.md @@ -0,0 +1,72 @@ +--- +name: sentry-vortex +description: Audit code against Vortex's Sentry conventions and guide correct error instrumentation. Triggers on: sentry, captureException, error reporting, error monitoring, beforeSend, ignoreErrors, adding an API service method, new error class, new XState machine error handling, ErrorBoundary, "is this reported to Sentry". +user-invocable: true +argument-hint: "[files or 'current changes' — defaults to the working-tree diff]" +--- + +Audit changed code against Vortex's established Sentry conventions and report violations with concrete fixes; also the authority for how to instrument new code correctly. + +## MANDATORY PREPARATION + +1. Read the canonical implementation so you check against real code, not memory: + - `apps/frontend/src/helpers/sentry.ts` + - `apps/frontend/src/services/api/api-client.ts` + - `apps/frontend/src/machines/ramp.machine.ts` +2. Determine scope: the argument, or `git diff --name-only HEAD` if blank. + +--- + +## Diagnostic Scan + +Check each rule. Report a finding only when violated. + +### Configuration (single source of truth) +- All filtering lives in `helpers/sentry.ts`. New ignore/deny/scrub logic edits that file — **NEVER** inline new filter config into `Sentry.init` in `main.tsx`. +- `environment: config.env` (never `config.isProd ? ... : ...`). Sampling stays prod-gated. +- Session Replay keeps `maskAllText: true` + `blockAllMedia: true`. + +### Error classes +- A custom `Error` whose failures should be filterable by business area **must** `implements DomainError` and set `domain`. API errors derive it from `getApiDomain()` (the source of truth for domain values); non-API errors set it directly (e.g. `SignRampError` → `wallet`). + +### API layer (`services/api/`) +- A new top-level path segment (e.g. `/payouts/...`) **must** be added to `getApiDomain()`. +- `ApiError` messages run through `normalizePath()` — **CRITICAL**: never interpolate raw ids/addresses into an error message or Sentry tag; it fragments grouping and can leak PII. + +### Capture points +- Money-flow / machine failures are captured at the machine's terminal error state (`captureActorError` pattern), skipping `SignRampError` `UserRejected`. +- **NEVER** call `Sentry.captureException` inside React components, render paths, or fetch/TanStack-Query interceptors — let errors propagate to the machine error state or the global handler. +- Risky subtrees (widget/KYC/ramp) are wrapped in `Sentry.ErrorBoundary` with a fallback. + +### Noise & privacy +- `ignoreErrors` covers wallet user-rejections, `ResizeObserver` loops, extension-context errors, `AbortError`. **IMPORTANT**: keep `TimeoutError` reportable — a timeout can mean a slow backend. +- `beforeSend` drops expected client 4xx (`401/403/404/409/429`); `400/422` and all `5xx` are kept. +- No PII in query params, tags, contexts, or messages — `beforeSend` strips query strings, but new code must not route PII somewhere it can't reach. + +## Generate Report + +Group findings by file, `file:line`, each with the violated rule and a concrete fix. End with a one-line compliance verdict. + +``` +## apps/frontend/src/services/api/payouts.service.ts +payouts.service.ts:14 - new "/payouts" segment not mapped in getApiDomain() → add case "payouts": return "ramp" + +## apps/frontend/src/components/Foo.tsx +Foo.tsx:88 - Sentry.captureException in a component → remove; let it propagate to the machine Error state + +Verdict: 2 violations — not compliant. +``` + +**NEVER:** +- Report a violation without the exact fix. +- Flag `Sentry.captureException` at the sanctioned capture point (`captureActorError`) as a violation. +- Recommend blanket-ignoring `Failed to fetch` / `NetworkError` / `Loading chunk failed` — monitor volume first. +- Recommend adding `SENTRY_AUTH_TOKEN` or `VITE_ENVIRONMENT` in code — they are Netlify build env vars; flag as infra TODOs only. + +## Verify Audit + +- Every changed `services/api/`, error class, and XState machine error path was checked. +- Every finding has a `file:line` and a fix. +- No false positives against the sanctioned patterns in the canonical files. + +A trustworthy Sentry is one where every reported issue is real and actionable — audit to keep noise out and signal in. From 2d61816685ed131d877a5c286256a5f0c3d46855 Mon Sep 17 00:00:00 2001 From: Kacper Szarkiewicz Date: Thu, 18 Jun 2026 12:14:21 +0200 Subject: [PATCH 009/176] merge with staging; address PR comments --- .clinerules/01-general-rules.md | 2 +- .gitignore | 2 + CLAUDE.md | 6 + PR_SUMMARY.md | 49 + apps/api/.env.example | 12 +- apps/api/.gitignore | 2 + apps/api/package.json | 4 +- .../admin/apiClientEvents.controller.test.ts | 187 + .../admin/apiClientEvents.controller.ts | 157 + ...ofilePartnerAssignments.controller.test.ts | 227 + .../profilePartnerAssignments.controller.ts | 262 + .../api/controllers/alfredpay.controller.ts | 73 +- .../api/controllers/monerium.controller.ts | 31 - .../src/api/controllers/mykobo.controller.ts | 131 + .../api/controllers/pendulum.controller.ts | 3 +- .../src/api/controllers/quote.controller.ts | 146 +- .../src/api/controllers/ramp.controller.ts | 145 +- .../src/api/controllers/stellar.controller.ts | 127 - .../src/api/controllers/storage.controller.ts | 20 +- .../api/controllers/subsidize.controller.ts | 3 +- apps/api/src/api/errors/api-error.ts | 6 +- apps/api/src/api/errors/extendable-error.ts | 6 +- apps/api/src/api/helpers/anchors.ts | 40 - apps/api/src/api/helpers/clientIp.test.ts | 37 + apps/api/src/api/helpers/clientIp.ts | 101 + apps/api/src/api/middlewares/apiKeyAuth.ts | 46 + apps/api/src/api/middlewares/dualAuth.test.ts | 12 + apps/api/src/api/middlewares/dualAuth.ts | 31 + apps/api/src/api/middlewares/error.test.ts | 61 + apps/api/src/api/middlewares/error.ts | 13 +- .../api/middlewares/maintenanceGuard.test.ts | 242 + .../src/api/middlewares/maintenanceGuard.ts | 117 + .../api/middlewares/metricsDashboardAuth.ts | 90 + apps/api/src/api/middlewares/ownershipAuth.ts | 57 +- apps/api/src/api/middlewares/publicKeyAuth.ts | 24 + .../src/api/middlewares/validators.test.ts | 141 + apps/api/src/api/middlewares/validators.ts | 147 +- .../apiClientEvent.service.test.ts | 174 + .../observability/apiClientEvent.service.ts | 230 + .../api/observability/errorClassifier.test.ts | 35 + .../src/api/observability/errorClassifier.ts | 54 + apps/api/src/api/observability/metrics.ts | 6 + .../src/api/observability/operationLogger.ts | 30 + .../api/observability/requestContext.test.ts | 40 + .../src/api/observability/requestContext.ts | 37 + apps/api/src/api/observability/types.ts | 60 + .../v1/admin/api-client-events.route.ts | 17 + .../profile-partner-assignments.route.ts | 31 + apps/api/src/api/routes/v1/alfredpay.route.ts | 9 +- apps/api/src/api/routes/v1/index.ts | 34 +- apps/api/src/api/routes/v1/monerium.route.ts | 8 - apps/api/src/api/routes/v1/mykobo.route.ts | 18 + apps/api/src/api/routes/v1/quote.route.ts | 3 + apps/api/src/api/routes/v1/ramp.route.ts | 22 +- apps/api/src/api/routes/v1/stellar.route.ts | 17 - ...pi-client-events-retention.service.test.ts | 94 + .../api-client-events-retention.service.ts | 83 + apps/api/src/api/services/hydration/swap.ts | 51 +- apps/api/src/api/services/monerium/index.ts | 259 - .../mykobo/mykobo-customer.service.ts | 47 + .../handlers/brla-onramp-mint-handler.ts | 34 +- .../handlers/destination-transfer-handler.ts | 40 +- .../handlers/distribute-fees-handler.ts | 4 +- .../handlers/final-settlement-subsidy.ts | 34 +- .../phases/handlers/fund-ephemeral-handler.ts | 142 +- .../api/services/phases/handlers/helpers.ts | 38 +- .../phases/handlers/initial-phase-handler.ts | 2 +- .../handlers/monerium-onramp-mint-handler.ts | 88 - .../monerium-onramp-self-transfer-handler.ts | 428 - .../handlers/mykobo-onramp-deposit-handler.ts | 145 + .../phases/handlers/mykobo-payout-handler.ts | 112 + .../phases/handlers/nabla-approve-handler.ts | 18 +- .../handlers/nabla-swap-handler.test.ts | 196 + .../phases/handlers/nabla-swap-handler.ts | 81 +- .../handlers/spacewalk-redeem-handler.ts | 142 - .../handlers/squid-router-phase-handler.ts | 145 +- .../handlers/stellar-payment-handler.ts | 85 - .../handlers/subsidize-post-swap-handler.ts | 85 +- .../handlers/subsidize-pre-swap-handler.ts | 9 +- .../phases/helpers/brla-onramp-hold.test.ts | 73 + .../phases/helpers/brla-onramp-hold.ts | 36 + .../post-swap-subsidy-breakdown.test.ts | 56 + .../helpers/post-swap-subsidy-breakdown.ts | 49 + .../helpers/stellar-payment-verifier.ts | 99 - .../helpers/stellar-sequence-validator.ts | 46 - .../api/services/phases/meta-state-types.ts | 30 +- .../mykobo-eur-offramp.integration.test.ts | 331 + .../mykobo-eur-onramp.integration.test.ts | 338 + .../phase-processor.integration.test.ts | 282 - ...phase-processor.onramp.integration.test.ts | 14 +- .../api/services/phases/phase-processor.ts | 8 + .../base-chain-post-process-handler.ts | 2 +- .../api/services/phases/post-process/index.ts | 7 +- .../stellar-post-process-handler.ts | 95 - .../api/services/phases/register-handlers.ts | 12 +- .../api/src/api/services/priceFeed.service.ts | 15 +- .../api/services/quote/core/errors.test.ts | 26 + .../api/src/api/services/quote/core/errors.ts | 25 + .../src/api/services/quote/core/helpers.ts | 1 + apps/api/src/api/services/quote/core/nabla.ts | 41 +- .../quote/core/partner-resolution.test.ts | 152 + .../services/quote/core/partner-resolution.ts | 123 + .../api/services/quote/core/quote-context.ts | 10 +- .../src/api/services/quote/core/quote-fees.ts | 4 - .../api/services/quote/core/squidrouter.ts | 86 +- apps/api/src/api/services/quote/core/types.ts | 37 +- .../quote/engines/discount/helpers.test.ts | 55 + .../engines/discount/offramp-alfredpay.ts | 2 +- .../quote/engines/discount/offramp.ts | 2 +- .../engines/discount/onramp-alfredpay.ts | 2 +- .../services/quote/engines/discount/onramp.ts | 43 +- .../quote/engines/fee/offramp-mykobo.ts | 29 + .../quote/engines/fee/offramp-stellar.ts | 21 - .../fee/onramp-monerium-to-assethub.ts | 24 - .../engines/fee/onramp-monerium-to-evm.ts | 24 - .../quote/engines/fee/onramp-mykobo-to-evm.ts | 84 + .../quote/engines/finalize/index.test.ts | 84 + .../services/quote/engines/finalize/index.ts | 5 +- .../quote/engines/finalize/offramp.ts | 13 +- .../quote/engines/finalize/onramp.test.ts | 46 + .../services/quote/engines/finalize/onramp.ts | 13 +- .../initialize/offramp-from-evm-alfredpay.ts | 15 +- .../initialize/offramp-from-evm-avenia.ts | 44 + .../initialize/offramp-from-evm-mykobo.ts | 44 + .../engines/initialize/onramp-monerium.ts | 36 - .../quote/engines/initialize/onramp-mykobo.ts | 55 + .../engines/merge-subsidy/offramp-evm.test.ts | 81 + .../quote/engines/nabla-swap/base-evm.test.ts | 90 + .../quote/engines/nabla-swap/base-evm.ts | 2 + .../quote/engines/nabla-swap/onramp-evm.ts | 47 +- .../engines/nabla-swap/onramp-mykobo-evm.ts | 73 + .../quote/engines/pendulum-transfers/index.ts | 21 +- .../pendulum-transfers/offramp-stellar.ts | 56 - .../quote/engines/squidrouter/index.test.ts | 60 + .../quote/engines/squidrouter/index.ts | 5 +- .../engines/squidrouter/onramp-base-to-evm.ts | 54 +- .../squidrouter/onramp-polygon-to-evm.ts | 57 - .../squidrouter/onramp-polygon-to-moonbeam.ts | 46 - apps/api/src/api/services/quote/index.ts | 86 +- .../services/quote/routes/route-definition.ts | 15 - .../quote/routes/route-resolver.test.ts | 61 + .../services/quote/routes/route-resolver.ts | 32 +- .../offramp-evm-to-alfredpay.strategy.ts | 5 +- .../offramp-to-pix-base.strategy.ts | 6 +- .../offramp-to-sepa-evm.strategy.ts | 22 + .../strategies/offramp-to-stellar.strategy.ts | 32 - .../onramp-avenia-to-assethub.strategy.ts | 8 +- .../onramp-avenia-to-evm.strategy-base.ts | 4 +- .../onramp-monerium-to-assethub.strategy.ts | 33 - .../onramp-monerium-to-evm.strategy.ts | 17 - .../onramp-mykobo-to-evm.strategy.ts | 22 + apps/api/src/api/services/quote/utils.ts | 18 + .../api/services/ramp/base.service.test.ts | 95 + .../api/src/api/services/ramp/base.service.ts | 65 +- .../services/ramp/ephemeral-freshness.test.ts | 124 + .../api/services/ramp/ephemeral-freshness.ts | 98 + .../api/src/api/services/ramp/helpers.test.ts | 96 + apps/api/src/api/services/ramp/helpers.ts | 95 +- .../api/services/ramp/monerium-permit.test.ts | 200 - .../src/api/services/ramp/monerium-permit.ts | 138 - .../ramp/monerium-self-transfer.test.ts | 54 - .../services/ramp/monerium-self-transfer.ts | 121 - .../ramp/ramp-transaction-preparation.test.ts | 33 +- .../ramp/ramp-transaction-preparation.ts | 12 +- .../ramp/ramp.service.get-ramp-status.test.ts | 164 + .../api/src/api/services/ramp/ramp.service.ts | 386 +- apps/api/src/api/services/sep10/helpers.ts | 92 - .../src/api/services/sep10/sep10.service.ts | 73 - apps/api/src/api/services/stellar.service.ts | 67 - .../src/api/services/stellar/checkBalance.ts | 58 - .../api/src/api/services/stellar/getVaults.ts | 49 - .../src/api/services/stellar/loadAccount.ts | 34 - .../src/api/services/stellar/vaultService.ts | 110 - .../transactions/common/feeDistribution.ts | 16 +- .../offramp/common/transactions.ts | 160 - .../transactions/offramp/common/types.ts | 7 +- .../transactions/offramp/common/validation.ts | 68 +- .../services/transactions/offramp/index.ts | 24 +- .../offramp/routes/assethub-to-brl.ts | 3 + .../offramp/routes/assethub-to-stellar.ts | 161 - .../offramp/routes/evm-to-alfredpay.ts | 30 +- .../offramp/routes/evm-to-brl-base.ts | 30 +- .../offramp/routes/evm-to-monerium-evm.ts | 102 - .../offramp/routes/evm-to-mykobo.ts | 254 + .../offramp/routes/evm-to-stellar.ts | 163 - .../onramp/common/monerium.test.ts | 8 - .../transactions/onramp/common/monerium.ts | 35 - .../onramp/common/transactions.test.ts | 136 + .../onramp/common/transactions.ts | 17 +- .../transactions/onramp/common/types.ts | 5 +- .../transactions/onramp/common/validation.ts | 33 +- .../api/services/transactions/onramp/index.ts | 22 +- .../onramp/routes/alfredpay-to-evm.ts | 60 +- .../onramp/routes/avenia-to-evm-base.test.ts | 230 + .../onramp/routes/avenia-to-evm-base.ts | 117 +- .../onramp/routes/avenia-to-evm.ts | 18 +- .../onramp/routes/monerium-to-assethub.ts | 289 - .../onramp/routes/monerium-to-evm.ts | 234 - .../onramp/routes/mykobo-to-evm.ts | 404 + .../services/transactions/spacewalk/redeem.ts | 36 - .../stellar/offrampTransaction.ts | 209 - .../services/transactions/validation.test.ts | 309 +- .../api/services/transactions/validation.ts | 207 +- .../api-client-events-retention.worker.ts | 42 + .../src/api/workers/cleanup.worker.test.ts | 31 +- apps/api/src/api/workers/cleanup.worker.ts | 2 + .../src/api/workers/ramp-recovery.worker.ts | 5 +- .../api/workers/unhandled-payment.worker.ts | 3 + apps/api/src/config/express.ts | 8 +- apps/api/src/config/vars.test.ts | 12 + apps/api/src/config/vars.ts | 59 +- apps/api/src/constants/constants.ts | 32 +- .../migrations/028-add-flow-variant.ts | 30 + .../migrations/028-remove-stellar-anchors.ts | 49 + .../029-create-mykobo-customers-table.ts | 82 + .../030-add-expired-quote-cleanup-index.ts | 15 + .../031-add-quote-created-at-index.ts | 14 + .../032-create-api-client-events-table.ts | 56 + .../033-profile-partner-assignments.ts | 126 + apps/api/src/index.ts | 8 +- apps/api/src/models/apiClientEvent.model.ts | 99 + apps/api/src/models/index.ts | 18 + apps/api/src/models/mykoboCustomer.model.ts | 117 + .../models/profilePartnerAssignment.model.ts | 143 + apps/api/src/models/quoteTicket.model.ts | 42 + apps/api/src/models/rampState.model.ts | 13 + apps/frontend/package.json | 7 +- .../components/Alfredpay/AlfredpayKycFlow.tsx | 23 +- .../components/Alfredpay/ArKycFormScreen.tsx | 184 + .../components/Alfredpay/ColKycFormScreen.tsx | 317 +- .../components/Alfredpay/KycFormScreen.tsx | 165 + .../Alfredpay/MxnDocumentUploadScreen.tsx | 56 +- .../components/Alfredpay/MxnKycFormScreen.tsx | 219 +- .../components/AssetNumericInput/index.tsx | 7 +- .../src/components/Avenia/AveniaKYBForm.tsx | 13 +- .../components/ContactForm/ContactInfo.tsx | 2 +- .../frontend/src/components/CountUp/index.tsx | 111 + .../DoneScreen.tsx => DoneScreen/index.tsx} | 14 +- apps/frontend/src/components/Footer/index.tsx | 7 - .../src/components/Mykobo/MykoboKycFlow.tsx | 93 + .../src/components/Mykobo/MykoboKycForm.tsx | 237 + .../src/components/NetworkSelector/index.tsx | 3 +- .../src/components/NumericInput/index.tsx | 95 +- .../components/QuoteSubmitButtons/index.tsx | 4 +- .../src/components/Ramp/Offramp/index.tsx | 8 +- .../src/components/Ramp/Onramp/index.tsx | 8 +- .../RampSubmitButton/RampSubmitButton.tsx | 179 +- .../TokenSelectionList/helpers.tsx | 45 +- .../src/components/ui/DropdownSelector.tsx | 4 +- .../DetailsStep/DetailsStepForm.tsx | 6 +- .../widget-steps/DetailsStep/index.tsx | 36 +- .../MoneriumAssethubFormStep/index.tsx | 70 - .../MoneriumRedirectStep/index.tsx | 46 - .../widget-steps/RegionSelectStep/index.tsx | 95 + .../SummaryStep/ARSOnrampDetails.tsx | 79 + .../SummaryStep/EUROnrampDetails.tsx | 45 +- .../widget-steps/SummaryStep/FeeDetails.tsx | 10 +- .../SummaryStep/TransactionTokensDisplay.tsx | 41 +- .../widget-steps/SummaryStep/index.tsx | 69 +- .../src/config/networkAvailability.ts | 26 + .../src/constants/fiatAccountForms.ts | 32 + .../src/constants/fiatAccountMethods.ts | 18 +- apps/frontend/src/constants/kybRegions.ts | 37 + apps/frontend/src/constants/localStorage.ts | 4 - apps/frontend/src/contexts/events.tsx | 10 +- apps/frontend/src/contexts/network.tsx | 20 +- apps/frontend/src/contexts/polkadotNode.tsx | 81 +- apps/frontend/src/contexts/rampState.tsx | 286 +- apps/frontend/src/helpers/crypto.ts | 22 +- apps/frontend/src/helpers/notifications.ts | 28 +- .../src/hooks/brla/useKYBForm/index.tsx | 15 +- .../src/hooks/monerium/useMoneriumFlow.ts | 35 - .../useRampService/useRegisterRamp/helpers.ts | 9 +- .../offramp/useSEP24/useTrackSEP24Events.ts | 23 - apps/frontend/src/hooks/ramp/schema.ts | 9 +- .../ramp/useIsQuoteComponentDisplayed.ts | 5 +- .../src/hooks/ramp/useRampNavigation.ts | 11 +- .../src/hooks/ramp/useRampSubmission.ts | 32 +- .../src/hooks/ramp/useRampValidation.ts | 125 +- .../src/hooks/useInitTokenBalances.ts | 6 +- apps/frontend/src/hooks/useLocalStorage.ts | 5 +- .../src/hooks/useOnchainTokenBalances.ts | 39 +- apps/frontend/src/hooks/useRampUrlParams.ts | 48 +- apps/frontend/src/hooks/useSignChallenge.ts | 131 - apps/frontend/src/hooks/useSigningBoxState.ts | 18 +- .../src/hooks/useStepBackNavigation.ts | 15 + apps/frontend/src/hooks/useTokenIcon.ts | 6 +- .../actors/brla/createSubaccount.actor.ts | 16 +- .../machines/actors/register.actor.test.ts | 43 + .../src/machines/actors/register.actor.ts | 102 +- .../machines/actors/registerAdditionalData.ts | 93 + .../src/machines/actors/sign.actor.ts | 96 +- .../actors/stellar/sep24Second.actor.ts | 48 - .../actors/stellar/startSep24.actor.ts | 72 - .../src/machines/alfredpayKyc.machine.ts | 49 +- apps/frontend/src/machines/kyc.states.ts | 241 +- .../src/machines/moneriumKyc.machine.ts | 235 - .../src/machines/mykoboKyc.machine.ts | 228 + apps/frontend/src/machines/ramp.context.ts | 3 + apps/frontend/src/machines/ramp.machine.ts | 198 +- .../src/machines/stellarKyc.machine.ts | 201 - apps/frontend/src/machines/types.ts | 52 +- apps/frontend/src/main.tsx | 43 +- apps/frontend/src/pages/privacy/index.tsx | 16 - apps/frontend/src/pages/progress/index.tsx | 64 +- .../src/pages/progress/phaseFlows.test.ts | 1 + .../frontend/src/pages/progress/phaseFlows.ts | 75 +- .../src/pages/progress/phaseMessages.ts | 12 +- apps/frontend/src/pages/ramp/index.tsx | 11 +- apps/frontend/src/pages/widget/index.tsx | 64 +- apps/frontend/src/routes/{-$locale}.tsx | 10 +- .../src/sections/individuals/Hero/index.tsx | 2 +- .../individuals/PopularTokens/index.tsx | 15 +- .../src/services/anchor/sep10/challenge.ts | 42 - .../src/services/anchor/sep10/index.ts | 74 - .../src/services/anchor/sep10/utils.ts | 70 - .../src/services/anchor/sep24/first.ts | 45 - .../src/services/anchor/sep24/second.ts | 64 - apps/frontend/src/services/api/api-client.ts | 4 +- apps/frontend/src/services/api/index.ts | 1 - .../src/services/api/monerium.service.ts | 42 - .../src/services/api/moonbeam.service.ts | 10 +- .../src/services/api/mykobo.service.ts | 72 + .../src/services/api/pendulum.service.ts | 10 +- .../frontend/src/services/api/ramp.service.ts | 7 +- .../src/services/api/stellar.service.ts | 70 - .../src/services/api/storage.service.ts | 34 - .../src/services/monerium/moneriumAuth.ts | 144 - apps/frontend/src/services/signingService.tsx | 138 +- apps/frontend/src/services/stellar/index.ts | 22 - .../src/services/transactions/userSigning.ts | 4 +- .../src/stores/quote/useQuoteFormStore.ts | 20 +- .../src/stores/quote/useQuoteStore.ts | 10 +- .../MoneriumAssethubFormStep.stories.tsx | 125 - .../stories/MoneriumRedirectStep.stories.tsx | 102 - apps/frontend/src/translations/en.json | 163 +- apps/frontend/src/translations/pt.json | 163 +- apps/frontend/src/types/phases.ts | 2 - apps/frontend/src/types/searchParams.ts | 5 + apps/frontend/src/types/sep.ts | 28 - apps/frontend/vite.config.ts | 4 +- apps/rebalancer/.env.example | 30 +- apps/rebalancer/README.md | 5 +- apps/rebalancer/src/index.ts | 300 +- .../src/rebalance/brla-to-axlusdc/index.ts | 22 +- .../src/rebalance/brla-to-axlusdc/steps.ts | 39 +- .../src/rebalance/brla-to-usdc-base/guards.ts | 5 + .../src/rebalance/brla-to-usdc-base/index.ts | 108 + .../brla-to-usdc-base/notifications.test.ts | 44 + .../brla-to-usdc-base/notifications.ts | 38 + .../src/rebalance/brla-to-usdc-base/steps.ts | 377 + .../usdc-brla-usdc-base/guards.test.ts | 121 + .../rebalance/usdc-brla-usdc-base/guards.ts | 169 + .../rebalance/usdc-brla-usdc-base/index.ts | 338 + .../usdc-brla-usdc-base/notifications.test.ts | 49 + .../usdc-brla-usdc-base/notifications.ts | 92 + .../rebalance/usdc-brla-usdc-base/steps.ts | 926 + apps/rebalancer/src/services/indexer/index.ts | 72 + apps/rebalancer/src/services/stateManager.ts | 396 +- apps/rebalancer/src/utils/brla.test.ts | 20 + apps/rebalancer/src/utils/brla.ts | 36 + apps/rebalancer/src/utils/config.test.ts | 110 + apps/rebalancer/src/utils/config.ts | 117 +- apps/rebalancer/src/utils/nonce.ts | 18 + bun.lock | 1346 +- contracts/relayer/.env.example | 5 +- contracts/relayer/hardhat.config.ts | 37 +- .../TokenRelayer#TokenRelayer.dbg.json | 4 + .../artifacts/TokenRelayer#TokenRelayer.json | 454 + .../1f88a3ad5921d6bc8b511a85d672df5a.json | 137942 +++++++++++++++ .../chain-1/deployed_addresses.json | 3 + .../deployments/chain-1/journal.jsonl | 8 + .../TokenRelayer#TokenRelayer.dbg.json | 4 + .../artifacts/TokenRelayer#TokenRelayer.json | 454 + .../1f88a3ad5921d6bc8b511a85d672df5a.json | 137942 +++++++++++++++ .../chain-43114/deployed_addresses.json | 3 + .../deployments/chain-43114/journal.jsonl | 8 + .../TokenRelayer#TokenRelayer.dbg.json | 4 + .../artifacts/TokenRelayer#TokenRelayer.json | 454 + .../1f88a3ad5921d6bc8b511a85d672df5a.json | 137942 +++++++++++++++ .../chain-56/deployed_addresses.json | 3 + .../deployments/chain-56/journal.jsonl | 8 + contracts/relayer/package.json | 5 +- docs/api/apidog/page-manifest.json | 6 + docs/api/openapi/vortex.openapi.d.ts | 111 +- docs/api/openapi/vortex.openapi.json | 83 +- docs/api/pages/06-quotes-and-pricing.md | 26 + docs/api/pages/13-kyb-deep-link.md | 67 + docs/features/mykobo-eur-offramp.md | 247 + .../00-system-overview/architecture.md | 12 +- docs/security-spec/01-auth/admin-auth.md | 2 +- docs/security-spec/01-auth/supabase-otp.md | 2 +- .../02-signing-keys/ephemeral-accounts.md | 14 + .../03-ramp-engine/discount-mechanism.md | 22 +- .../03-ramp-engine/ephemeral-accounts.md | 14 +- .../03-ramp-engine/fee-integrity.md | 10 +- .../03-ramp-engine/profile-partner-pricing.md | 74 + .../03-ramp-engine/quote-lifecycle.md | 32 +- .../03-ramp-engine/ramp-phase-flows.md | 199 +- .../03-ramp-engine/transaction-validation.md | 7 +- .../05-integrations/alfredpay.md | 41 +- docs/security-spec/05-integrations/brla.md | 21 +- .../security-spec/05-integrations/monerium.md | 4 + docs/security-spec/05-integrations/mykobo.md | 143 + .../05-integrations/squid-router.md | 11 +- .../05-integrations/stellar-anchors.md | 16 +- .../06-cross-chain/bridge-security.md | 2 +- .../06-cross-chain/fund-routing.md | 13 +- .../07-operations/api-surface.md | 30 +- .../07-operations/client-observability.md | 57 + .../security-spec/07-operations/rebalancer.md | 234 +- .../07-operations/secret-management.md | 15 +- docs/security-spec/AUDIT-RESULTS.md | 76 +- docs/security-spec/FINDINGS.md | 256 +- .../security-spec/PUBLIC-RELEASE-READINESS.md | 6 +- docs/security-spec/README.md | 17 +- docs/security-spec/SPEC-DELTA-2026-05.md | 6 +- package.json | 8 +- packages/sdk/README.md | 29 +- packages/sdk/src/VortexSdk.ts | 33 +- packages/sdk/src/errors.ts | 41 +- packages/sdk/src/handlers/AlfredpayHandler.ts | 6 +- packages/sdk/src/handlers/BrlHandler.ts | 4 - packages/sdk/src/services/ApiService.ts | 6 +- packages/sdk/src/services/NetworkManager.ts | 108 +- packages/sdk/src/types.ts | 33 +- packages/sdk/test/alfredpayHandler.test.ts | 26 +- packages/shared/package.json | 2 +- packages/shared/src/constants.ts | 7 + .../shared/src/endpoints/brla.endpoints.ts | 3 +- packages/shared/src/endpoints/index.ts | 2 - packages/shared/src/endpoints/monerium.ts | 95 - .../shared/src/endpoints/quote.endpoints.ts | 6 +- .../shared/src/endpoints/ramp.endpoints.ts | 28 +- .../shared/src/endpoints/stellar.endpoints.ts | 40 - .../shared/src/endpoints/storage.endpoints.ts | 21 - packages/shared/src/helpers/conversions.ts | 5 - packages/shared/src/helpers/ephemerals.ts | 8 - packages/shared/src/helpers/networks.ts | 12 +- packages/shared/src/helpers/parseNumbers.ts | 22 - packages/shared/src/helpers/signUnsigned.ts | 75 +- .../services/alfredpay/alfredpayApiService.ts | 18 +- .../shared/src/services/alfredpay/types.ts | 39 +- .../src/services/brla/brlaApiService.ts | 6 +- packages/shared/src/services/brla/types.ts | 10 +- .../src/services/evm/clientManager.test.ts | 41 +- .../shared/src/services/evm/clientManager.ts | 17 +- packages/shared/src/services/index.ts | 1 + packages/shared/src/services/mykobo/index.ts | 2 + .../src/services/mykobo/mykoboApiService.ts | 284 + packages/shared/src/services/mykobo/types.ts | 169 + .../src/services/nabla/transactions/index.ts | 8 +- .../src/services/pendulum/apiManager.ts | 41 +- .../shared/src/services/squidrouter/onramp.ts | 48 - .../src/substrateEvents/eventListener.ts | 44 +- .../src/substrateEvents/eventParsers.ts | 168 - packages/shared/src/substrateEvents/index.ts | 2 +- .../shared/src/substrateEvents/xcmParsers.ts | 30 + packages/shared/src/tokens/constants/misc.ts | 52 +- packages/shared/src/tokens/evm/config.ts | 10 + .../shared/src/tokens/freeTokens/config.ts | 52 + packages/shared/src/tokens/index.ts | 2 - packages/shared/src/tokens/stellar/config.ts | 96 - packages/shared/src/tokens/tokenConfig.ts | 116 +- packages/shared/src/tokens/types/base.ts | 3 +- packages/shared/src/tokens/types/evm.ts | 3 +- packages/shared/src/tokens/types/stellar.ts | 26 - .../shared/src/tokens/utils/helpers.test.ts | 36 - packages/shared/src/tokens/utils/helpers.ts | 63 +- .../shared/src/tokens/utils/typeGuards.ts | 28 +- 470 files changed, 434997 insertions(+), 11927 deletions(-) create mode 100644 PR_SUMMARY.md create mode 100644 apps/api/src/api/controllers/admin/apiClientEvents.controller.test.ts create mode 100644 apps/api/src/api/controllers/admin/apiClientEvents.controller.ts create mode 100644 apps/api/src/api/controllers/admin/profilePartnerAssignments.controller.test.ts create mode 100644 apps/api/src/api/controllers/admin/profilePartnerAssignments.controller.ts delete mode 100644 apps/api/src/api/controllers/monerium.controller.ts create mode 100644 apps/api/src/api/controllers/mykobo.controller.ts delete mode 100644 apps/api/src/api/controllers/stellar.controller.ts delete mode 100644 apps/api/src/api/helpers/anchors.ts create mode 100644 apps/api/src/api/helpers/clientIp.test.ts create mode 100644 apps/api/src/api/helpers/clientIp.ts create mode 100644 apps/api/src/api/middlewares/error.test.ts create mode 100644 apps/api/src/api/middlewares/maintenanceGuard.test.ts create mode 100644 apps/api/src/api/middlewares/maintenanceGuard.ts create mode 100644 apps/api/src/api/middlewares/metricsDashboardAuth.ts create mode 100644 apps/api/src/api/middlewares/validators.test.ts create mode 100644 apps/api/src/api/observability/apiClientEvent.service.test.ts create mode 100644 apps/api/src/api/observability/apiClientEvent.service.ts create mode 100644 apps/api/src/api/observability/errorClassifier.test.ts create mode 100644 apps/api/src/api/observability/errorClassifier.ts create mode 100644 apps/api/src/api/observability/metrics.ts create mode 100644 apps/api/src/api/observability/operationLogger.ts create mode 100644 apps/api/src/api/observability/requestContext.test.ts create mode 100644 apps/api/src/api/observability/requestContext.ts create mode 100644 apps/api/src/api/observability/types.ts create mode 100644 apps/api/src/api/routes/v1/admin/api-client-events.route.ts create mode 100644 apps/api/src/api/routes/v1/admin/profile-partner-assignments.route.ts delete mode 100644 apps/api/src/api/routes/v1/monerium.route.ts create mode 100644 apps/api/src/api/routes/v1/mykobo.route.ts delete mode 100644 apps/api/src/api/routes/v1/stellar.route.ts create mode 100644 apps/api/src/api/services/api-client-events-retention.service.test.ts create mode 100644 apps/api/src/api/services/api-client-events-retention.service.ts delete mode 100644 apps/api/src/api/services/monerium/index.ts create mode 100644 apps/api/src/api/services/mykobo/mykobo-customer.service.ts delete mode 100644 apps/api/src/api/services/phases/handlers/monerium-onramp-mint-handler.ts delete mode 100644 apps/api/src/api/services/phases/handlers/monerium-onramp-self-transfer-handler.ts create mode 100644 apps/api/src/api/services/phases/handlers/mykobo-onramp-deposit-handler.ts create mode 100644 apps/api/src/api/services/phases/handlers/mykobo-payout-handler.ts create mode 100644 apps/api/src/api/services/phases/handlers/nabla-swap-handler.test.ts delete mode 100644 apps/api/src/api/services/phases/handlers/spacewalk-redeem-handler.ts delete mode 100644 apps/api/src/api/services/phases/handlers/stellar-payment-handler.ts create mode 100644 apps/api/src/api/services/phases/helpers/brla-onramp-hold.test.ts create mode 100644 apps/api/src/api/services/phases/helpers/brla-onramp-hold.ts create mode 100644 apps/api/src/api/services/phases/helpers/post-swap-subsidy-breakdown.test.ts create mode 100644 apps/api/src/api/services/phases/helpers/post-swap-subsidy-breakdown.ts delete mode 100644 apps/api/src/api/services/phases/helpers/stellar-payment-verifier.ts delete mode 100644 apps/api/src/api/services/phases/helpers/stellar-sequence-validator.ts create mode 100644 apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts create mode 100644 apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts delete mode 100644 apps/api/src/api/services/phases/phase-processor.integration.test.ts delete mode 100644 apps/api/src/api/services/phases/post-process/stellar-post-process-handler.ts create mode 100644 apps/api/src/api/services/quote/core/errors.test.ts create mode 100644 apps/api/src/api/services/quote/core/errors.ts create mode 100644 apps/api/src/api/services/quote/core/partner-resolution.test.ts create mode 100644 apps/api/src/api/services/quote/core/partner-resolution.ts create mode 100644 apps/api/src/api/services/quote/engines/discount/helpers.test.ts create mode 100644 apps/api/src/api/services/quote/engines/fee/offramp-mykobo.ts delete mode 100644 apps/api/src/api/services/quote/engines/fee/offramp-stellar.ts delete mode 100644 apps/api/src/api/services/quote/engines/fee/onramp-monerium-to-assethub.ts delete mode 100644 apps/api/src/api/services/quote/engines/fee/onramp-monerium-to-evm.ts create mode 100644 apps/api/src/api/services/quote/engines/fee/onramp-mykobo-to-evm.ts create mode 100644 apps/api/src/api/services/quote/engines/finalize/index.test.ts create mode 100644 apps/api/src/api/services/quote/engines/finalize/onramp.test.ts create mode 100644 apps/api/src/api/services/quote/engines/initialize/offramp-from-evm-avenia.ts create mode 100644 apps/api/src/api/services/quote/engines/initialize/offramp-from-evm-mykobo.ts delete mode 100644 apps/api/src/api/services/quote/engines/initialize/onramp-monerium.ts create mode 100644 apps/api/src/api/services/quote/engines/initialize/onramp-mykobo.ts create mode 100644 apps/api/src/api/services/quote/engines/merge-subsidy/offramp-evm.test.ts create mode 100644 apps/api/src/api/services/quote/engines/nabla-swap/base-evm.test.ts create mode 100644 apps/api/src/api/services/quote/engines/nabla-swap/onramp-mykobo-evm.ts delete mode 100644 apps/api/src/api/services/quote/engines/pendulum-transfers/offramp-stellar.ts create mode 100644 apps/api/src/api/services/quote/engines/squidrouter/index.test.ts delete mode 100644 apps/api/src/api/services/quote/engines/squidrouter/onramp-polygon-to-evm.ts delete mode 100644 apps/api/src/api/services/quote/engines/squidrouter/onramp-polygon-to-moonbeam.ts create mode 100644 apps/api/src/api/services/quote/routes/route-resolver.test.ts create mode 100644 apps/api/src/api/services/quote/routes/strategies/offramp-to-sepa-evm.strategy.ts delete mode 100644 apps/api/src/api/services/quote/routes/strategies/offramp-to-stellar.strategy.ts delete mode 100644 apps/api/src/api/services/quote/routes/strategies/onramp-monerium-to-assethub.strategy.ts delete mode 100644 apps/api/src/api/services/quote/routes/strategies/onramp-monerium-to-evm.strategy.ts create mode 100644 apps/api/src/api/services/quote/routes/strategies/onramp-mykobo-to-evm.strategy.ts create mode 100644 apps/api/src/api/services/quote/utils.ts create mode 100644 apps/api/src/api/services/ramp/base.service.test.ts create mode 100644 apps/api/src/api/services/ramp/ephemeral-freshness.test.ts create mode 100644 apps/api/src/api/services/ramp/ephemeral-freshness.ts create mode 100644 apps/api/src/api/services/ramp/helpers.test.ts delete mode 100644 apps/api/src/api/services/ramp/monerium-permit.test.ts delete mode 100644 apps/api/src/api/services/ramp/monerium-permit.ts delete mode 100644 apps/api/src/api/services/ramp/monerium-self-transfer.test.ts delete mode 100644 apps/api/src/api/services/ramp/monerium-self-transfer.ts create mode 100644 apps/api/src/api/services/ramp/ramp.service.get-ramp-status.test.ts delete mode 100644 apps/api/src/api/services/sep10/helpers.ts delete mode 100644 apps/api/src/api/services/sep10/sep10.service.ts delete mode 100644 apps/api/src/api/services/stellar.service.ts delete mode 100644 apps/api/src/api/services/stellar/checkBalance.ts delete mode 100644 apps/api/src/api/services/stellar/getVaults.ts delete mode 100644 apps/api/src/api/services/stellar/loadAccount.ts delete mode 100644 apps/api/src/api/services/stellar/vaultService.ts delete mode 100644 apps/api/src/api/services/transactions/offramp/routes/assethub-to-stellar.ts delete mode 100644 apps/api/src/api/services/transactions/offramp/routes/evm-to-monerium-evm.ts create mode 100644 apps/api/src/api/services/transactions/offramp/routes/evm-to-mykobo.ts delete mode 100644 apps/api/src/api/services/transactions/offramp/routes/evm-to-stellar.ts delete mode 100644 apps/api/src/api/services/transactions/onramp/common/monerium.test.ts delete mode 100644 apps/api/src/api/services/transactions/onramp/common/monerium.ts create mode 100644 apps/api/src/api/services/transactions/onramp/common/transactions.test.ts create mode 100644 apps/api/src/api/services/transactions/onramp/routes/avenia-to-evm-base.test.ts delete mode 100644 apps/api/src/api/services/transactions/onramp/routes/monerium-to-assethub.ts delete mode 100644 apps/api/src/api/services/transactions/onramp/routes/monerium-to-evm.ts create mode 100644 apps/api/src/api/services/transactions/onramp/routes/mykobo-to-evm.ts delete mode 100644 apps/api/src/api/services/transactions/spacewalk/redeem.ts delete mode 100644 apps/api/src/api/services/transactions/stellar/offrampTransaction.ts create mode 100644 apps/api/src/api/workers/api-client-events-retention.worker.ts create mode 100644 apps/api/src/database/migrations/028-add-flow-variant.ts create mode 100644 apps/api/src/database/migrations/028-remove-stellar-anchors.ts create mode 100644 apps/api/src/database/migrations/029-create-mykobo-customers-table.ts create mode 100644 apps/api/src/database/migrations/030-add-expired-quote-cleanup-index.ts create mode 100644 apps/api/src/database/migrations/031-add-quote-created-at-index.ts create mode 100644 apps/api/src/database/migrations/032-create-api-client-events-table.ts create mode 100644 apps/api/src/database/migrations/033-profile-partner-assignments.ts create mode 100644 apps/api/src/models/apiClientEvent.model.ts create mode 100644 apps/api/src/models/mykoboCustomer.model.ts create mode 100644 apps/api/src/models/profilePartnerAssignment.model.ts create mode 100644 apps/frontend/src/components/Alfredpay/ArKycFormScreen.tsx create mode 100644 apps/frontend/src/components/Alfredpay/KycFormScreen.tsx create mode 100644 apps/frontend/src/components/CountUp/index.tsx rename apps/frontend/src/components/{Alfredpay/DoneScreen.tsx => DoneScreen/index.tsx} (66%) create mode 100644 apps/frontend/src/components/Mykobo/MykoboKycFlow.tsx create mode 100644 apps/frontend/src/components/Mykobo/MykoboKycForm.tsx delete mode 100644 apps/frontend/src/components/widget-steps/MoneriumAssethubFormStep/index.tsx delete mode 100644 apps/frontend/src/components/widget-steps/MoneriumRedirectStep/index.tsx create mode 100644 apps/frontend/src/components/widget-steps/RegionSelectStep/index.tsx create mode 100644 apps/frontend/src/components/widget-steps/SummaryStep/ARSOnrampDetails.tsx create mode 100644 apps/frontend/src/config/networkAvailability.ts create mode 100644 apps/frontend/src/constants/kybRegions.ts delete mode 100644 apps/frontend/src/hooks/monerium/useMoneriumFlow.ts delete mode 100644 apps/frontend/src/hooks/offramp/useSEP24/useTrackSEP24Events.ts delete mode 100644 apps/frontend/src/hooks/useSignChallenge.ts create mode 100644 apps/frontend/src/machines/actors/register.actor.test.ts create mode 100644 apps/frontend/src/machines/actors/registerAdditionalData.ts delete mode 100644 apps/frontend/src/machines/actors/stellar/sep24Second.actor.ts delete mode 100644 apps/frontend/src/machines/actors/stellar/startSep24.actor.ts delete mode 100644 apps/frontend/src/machines/moneriumKyc.machine.ts create mode 100644 apps/frontend/src/machines/mykoboKyc.machine.ts delete mode 100644 apps/frontend/src/machines/stellarKyc.machine.ts delete mode 100644 apps/frontend/src/services/anchor/sep10/challenge.ts delete mode 100644 apps/frontend/src/services/anchor/sep10/index.ts delete mode 100644 apps/frontend/src/services/anchor/sep10/utils.ts delete mode 100644 apps/frontend/src/services/anchor/sep24/first.ts delete mode 100644 apps/frontend/src/services/anchor/sep24/second.ts delete mode 100644 apps/frontend/src/services/api/monerium.service.ts create mode 100644 apps/frontend/src/services/api/mykobo.service.ts delete mode 100644 apps/frontend/src/services/api/stellar.service.ts delete mode 100644 apps/frontend/src/services/monerium/moneriumAuth.ts delete mode 100644 apps/frontend/src/services/stellar/index.ts delete mode 100644 apps/frontend/src/stories/MoneriumAssethubFormStep.stories.tsx delete mode 100644 apps/frontend/src/stories/MoneriumRedirectStep.stories.tsx delete mode 100644 apps/frontend/src/types/sep.ts create mode 100644 apps/rebalancer/src/rebalance/brla-to-usdc-base/guards.ts create mode 100644 apps/rebalancer/src/rebalance/brla-to-usdc-base/index.ts create mode 100644 apps/rebalancer/src/rebalance/brla-to-usdc-base/notifications.test.ts create mode 100644 apps/rebalancer/src/rebalance/brla-to-usdc-base/notifications.ts create mode 100644 apps/rebalancer/src/rebalance/brla-to-usdc-base/steps.ts create mode 100644 apps/rebalancer/src/rebalance/usdc-brla-usdc-base/guards.test.ts create mode 100644 apps/rebalancer/src/rebalance/usdc-brla-usdc-base/guards.ts create mode 100644 apps/rebalancer/src/rebalance/usdc-brla-usdc-base/index.ts create mode 100644 apps/rebalancer/src/rebalance/usdc-brla-usdc-base/notifications.test.ts create mode 100644 apps/rebalancer/src/rebalance/usdc-brla-usdc-base/notifications.ts create mode 100644 apps/rebalancer/src/rebalance/usdc-brla-usdc-base/steps.ts create mode 100644 apps/rebalancer/src/utils/brla.test.ts create mode 100644 apps/rebalancer/src/utils/brla.ts create mode 100644 apps/rebalancer/src/utils/config.test.ts create mode 100644 apps/rebalancer/src/utils/nonce.ts create mode 100644 contracts/relayer/ignition/deployments/chain-1/artifacts/TokenRelayer#TokenRelayer.dbg.json create mode 100644 contracts/relayer/ignition/deployments/chain-1/artifacts/TokenRelayer#TokenRelayer.json create mode 100644 contracts/relayer/ignition/deployments/chain-1/build-info/1f88a3ad5921d6bc8b511a85d672df5a.json create mode 100644 contracts/relayer/ignition/deployments/chain-1/deployed_addresses.json create mode 100644 contracts/relayer/ignition/deployments/chain-1/journal.jsonl create mode 100644 contracts/relayer/ignition/deployments/chain-43114/artifacts/TokenRelayer#TokenRelayer.dbg.json create mode 100644 contracts/relayer/ignition/deployments/chain-43114/artifacts/TokenRelayer#TokenRelayer.json create mode 100644 contracts/relayer/ignition/deployments/chain-43114/build-info/1f88a3ad5921d6bc8b511a85d672df5a.json create mode 100644 contracts/relayer/ignition/deployments/chain-43114/deployed_addresses.json create mode 100644 contracts/relayer/ignition/deployments/chain-43114/journal.jsonl create mode 100644 contracts/relayer/ignition/deployments/chain-56/artifacts/TokenRelayer#TokenRelayer.dbg.json create mode 100644 contracts/relayer/ignition/deployments/chain-56/artifacts/TokenRelayer#TokenRelayer.json create mode 100644 contracts/relayer/ignition/deployments/chain-56/build-info/1f88a3ad5921d6bc8b511a85d672df5a.json create mode 100644 contracts/relayer/ignition/deployments/chain-56/deployed_addresses.json create mode 100644 contracts/relayer/ignition/deployments/chain-56/journal.jsonl create mode 100644 docs/api/pages/13-kyb-deep-link.md create mode 100644 docs/features/mykobo-eur-offramp.md create mode 100644 docs/security-spec/03-ramp-engine/profile-partner-pricing.md create mode 100644 docs/security-spec/05-integrations/mykobo.md create mode 100644 docs/security-spec/07-operations/client-observability.md delete mode 100644 packages/shared/src/endpoints/monerium.ts delete mode 100644 packages/shared/src/endpoints/stellar.endpoints.ts create mode 100644 packages/shared/src/services/mykobo/index.ts create mode 100644 packages/shared/src/services/mykobo/mykoboApiService.ts create mode 100644 packages/shared/src/services/mykobo/types.ts delete mode 100644 packages/shared/src/substrateEvents/eventParsers.ts create mode 100644 packages/shared/src/substrateEvents/xcmParsers.ts delete mode 100644 packages/shared/src/tokens/stellar/config.ts delete mode 100644 packages/shared/src/tokens/types/stellar.ts delete mode 100644 packages/shared/src/tokens/utils/helpers.test.ts diff --git a/.clinerules/01-general-rules.md b/.clinerules/01-general-rules.md index 2aea4808c..90f08874a 100644 --- a/.clinerules/01-general-rules.md +++ b/.clinerules/01-general-rules.md @@ -7,7 +7,7 @@ ## Architecture Decision Records -Create ADRs in /docs/adr for: +Create ADRs in /docs/adr for: - Major dependency changes - Architectural pattern changes diff --git a/.gitignore b/.gitignore index 89bd1ba39..a97f19a87 100644 --- a/.gitignore +++ b/.gitignore @@ -42,6 +42,8 @@ dist-ssr **/failedRampStateRecovery.json **/lastRampState.json **/lastRampStateOnramp.json +**/lastRampStateMykoboEur.json +**/lastRampStateMykoboEurOnramp.json *storybook.log diff --git a/CLAUDE.md b/CLAUDE.md index 71371528c..79d7bfd4e 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -158,6 +158,12 @@ cd apps/frontend bun test ``` +## Security Spec Sync + +`docs/security-spec/` is the audit-facing source of truth for security-sensitive behavior. When changing auth, admin routes, quote/ramp state, signing, fees, partner pricing, integrations, migrations/schema that affect invariants, or cross-chain fund flow, do a quick targeted check for the matching spec file and update it in the same change if behavior changed. + +Keep this lightweight: grep/read only the relevant spec path from `docs/security-spec/README.md`; skip this for cosmetic refactors, test-only changes, or implementation changes that do not alter security-relevant behavior. + ## Type Issues If IDE doesn't detect `@pendulum-chain/types` properly, ensure all `@polkadot/*` packages match versions in the types package. The root `package.json` uses `catalog:` for version management. diff --git a/PR_SUMMARY.md b/PR_SUMMARY.md new file mode 100644 index 000000000..6331336fe --- /dev/null +++ b/PR_SUMMARY.md @@ -0,0 +1,49 @@ +# Quote-less KYB deep link with region selector + +Adds a partner-facing deep link that takes business users straight into KYB verification - no quote required. Partners can send their users to the widget with a single URL and have them complete business verification for any supported region. + +## Flow + +``` +?kyb / ?kybLocked → email/OTP auth → region selector → provider KYB → success screen +``` + +- **Brazil** → Avenia KYB. The company name and CNPJ are collected **together on a single company form** (no separate CNPJ card). The CNPJ field is editable in the deep-link flow and validated as **CNPJ-only** (KYB is business-only); in the normal quoted flow it stays read-only and pre-filled from the quote. +- **Mexico / Colombia / USA** → Alfredpay business KYB (the business customer type is preselected). MX/CO business deep links are routed to the company KYB form, not the individual KYC form. +- **Europe / Mykobo** is intentionally excluded (individual KYC only, requires a connected wallet). +- After success, the user lands on a **"KYB Completed"** screen; *Continue* resets to the standard quote form with the session still authenticated and the deep-link params stripped from the URL. + +## URL parameters + +| URL | Behavior | +|---|---| +| `?kyb` | KYB mode, region selector shown | +| `?kyb=BR` \| `MX` \| `CO` \| `US` | Selector shown with the region preselected (user can change it) | +| `?kybLocked=BR` \| `MX` \| `CO` \| `US` | Selector skipped, region pinned, back navigation disabled | +| `?kybLocked=BR` (specifically) | Additionally defaults the widget locale to `pt-BR` (an explicit locale in the path still wins, e.g. `/en/widget?kybLocked=BR`) | +| unknown / empty region code (e.g. `?kybLocked=ZZ`, bare `?kybLocked`) | Degrades gracefully to the **open selector** - the region is **not** treated as locked | + +> Query keys are case-sensitive per the W3C/RFC URL spec: the parameter is `kybLocked` (lowercase `k`). A re-cased `KybLocked` is a different key and is ignored. + +`externalSessionId`, `partnerId`, and `apiKey` are forwarded in KYB mode, so partner/session attribution works the same as in the quoted flow. + +## Implementation notes + +- **`kybLink` context object** - all KYB deep-link state (`fiatToken`, `regionLocked`) lives in a single optional context object whose *presence* enables the mode. It is registered in `initialRampContext`, so `RESET_RAMP` fully exits KYB mode. +- **New machine states** - `SelectRegion` (region picker, auto-skipped when locked and resolved to a fiat token), `KybLinkComplete` (terminal success screen), and `PostAuthRouting` (a transient state that routes a successful login - token check or OTP - to the destination recorded in `postAuthTarget`, replacing the duplicated transition branches in `CheckAuth`/`VerifyingOTP`). A chosen region routes straight to the shared `KYC` node; Brazil collects its CNPJ on the Avenia company form rather than on a dedicated step. +- **Graceful region-lock degradation** - `?kybLocked=` only pins the region when the code resolves to a known region. An unknown or empty code yields `regionLocked: false`, so the selector is shown with working back navigation instead of a dead-end. +- **Locked-region back behavior** - with `?kybLocked=`, the parent KYC `GO_BACK` is an explicit guarded no-op (it would otherwise restart the child KYC machine). The back button is **hidden** on the locked KYB entry screen and on the region selector (the selector is the root of the flow). Deeper KYB steps that own their own back navigation keep the button. +- **CNPJ-only validation** - `useKYBForm` gains a `requireCnpj` flag; when the tax ID is user-typed (the quote-less deep link), it must be a CNPJ, so a "business" entry can't silently resolve to an individual account downstream. +- **Region table as single source of truth** - `KYB_REGIONS` maps each region code to its fiat token (provider routing), label key, and optional `defaultLocale`. Adding Spanish for MX/CO later is a data-only change. +- **Shared package & backend** - `BrlaCreateSubaccountRequest.quoteId` is now optional; the backend stores it as a nullable `initialQuoteId` (provenance only, never an authorization input). The subaccount actor only requires a quote in the normal flow and skips the quote-bound KYC-status lookup in deep-link mode. +- **Misc** - the dropdown trigger press scale now actually animates (`transition-property` previously covered only colors), and the panel no longer animates on initial mount. + +## Docs + +- **OpenAPI** (`docs/api/openapi/vortex.openapi.json`) - `createSubaccount` `quoteId` is now documented as optional, with the quote-less KYB deep-link case described. +- **API guide** - new partner-facing page `docs/api/pages/13-kyb-deep-link.md` (registered in the Apidog page manifest) covering the flow, URL parameters, attribution, and embedding. +- **Security spec** (`docs/security-spec/05-integrations/brla.md`) - documents quote-less subaccount creation and that the nullable `initialQuoteId` does not weaken any access check. + +## Testing + +- `bun typecheck` clean, Biome clean on changed files, frontend test suite passing (23/23). diff --git a/apps/api/.env.example b/apps/api/.env.example index 7596c38e8..aefc6a09f 100644 --- a/apps/api/.env.example +++ b/apps/api/.env.example @@ -12,6 +12,10 @@ SANDBOX_ENABLED=false # Example: openssl rand -base64 32 ADMIN_SECRET=your-secure-admin-secret-here +# Internal metrics dashboard authentication +# Use a different secret than ADMIN_SECRET to reduce blast radius. +METRICS_DASHBOARD_SECRET=your-secure-metrics-dashboard-secret-here + # Supabase Configuration SUPABASE_URL=https://your-project-id.supabase.co SUPABASE_ANON_KEY=your-anon-key-here @@ -29,6 +33,10 @@ DB_SSL_CA_CERT_PATH= # Blockchain AMPLITUDE_WSS=wss://rpc-amplitude.pendulumchain.tech PENDULUM_WSS=wss://rpc-pendulum.prd.pendulumchain.tech +# Optional Substrate RPC overrides. Comma-separate multiple URLs for failover. +ASSETHUB_WSS=wss://dot-rpc.stakeworld.io/assethub +HYDRATION_WSS=wss://rpc.hydradx.cloud +MOONBEAM_WSS=wss://wss.api.moonbeam.network,wss://moonbeam.api.onfinality.io/public-ws,wss://moonbeam.ibp.network FUNDING_SECRET=your-funding-secret PENDULUM_FUNDING_SEED=your-pendulum-funding-seed MOONBEAM_EXECUTOR_PRIVATE_KEY=your-moonbeam-executor-private-key @@ -51,10 +59,6 @@ COINGECKO_API_KEY=your-coingecko-api-key COINGECKO_API_URL=https://pro-api.coingecko.com/api/v3 SUBSCAN_API_KEY=your-subscan-api-key -# EUR / Monerium -MONERIUM_CLIENT_ID_APP=your-monerium-client-id -MONERIUM_CLIENT_SECRET=your-monerium-client-secret - # Price Feed Cache Configuration CRYPTO_CACHE_TTL_MS=300000 FIAT_CACHE_TTL_MS=300000 diff --git a/apps/api/.gitignore b/apps/api/.gitignore index 58b011667..b1fa2d19f 100644 --- a/apps/api/.gitignore +++ b/apps/api/.gitignore @@ -49,3 +49,5 @@ jspm_packages */failedRampStateRecovery.json */lastRampState.json */lastRampStateOnramp.json +*/lastRampStateMykoboEur.json +*/lastRampStateMykoboEurOnramp.json diff --git a/apps/api/package.json b/apps/api/package.json index b4037afe5..efe344e22 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -10,7 +10,7 @@ "@polkadot/keyring": "catalog:", "@polkadot/util": "catalog:", "@polkadot/util-crypto": "catalog:", - "@scure/bip39": "^1.5.4", + "@scure/bip39": "catalog:", "@supabase/supabase-js": "catalog:", "@types/multer": "^2.1.0", "@vortexfi/shared": "workspace:*", @@ -88,7 +88,7 @@ "name": "vortex-backend", "scripts": { "build": "bun run swc src -d dist --strip-leading-paths", - "dev": "concurrently -n 'shared,backend' -c '#ffa500,007755' 'cd ../../packages/shared && bun run dev' 'bun --watch src/index.ts'", + "dev": "NODE_ENV=development bun --watch src/index.ts", "migrate": "bun -r @swc-node/register src/database/migrator.ts", "migrate:revert": "bun -r @swc-node/register src/database/migrator.ts revert-all", "migrate:revert-last": "bun -r @swc-node/register src/database/migrator.ts revert", diff --git a/apps/api/src/api/controllers/admin/apiClientEvents.controller.test.ts b/apps/api/src/api/controllers/admin/apiClientEvents.controller.test.ts new file mode 100644 index 000000000..e808705f7 --- /dev/null +++ b/apps/api/src/api/controllers/admin/apiClientEvents.controller.test.ts @@ -0,0 +1,187 @@ +import { afterEach, describe, expect, it, mock } from "bun:test"; +import express from "express"; +import httpStatus from "http-status"; +import { config } from "../../../config/vars"; +import ApiClientEvent from "../../../models/apiClientEvent.model"; +import apiClientEventsRoutes from "../../routes/v1/admin/api-client-events.route"; +import { listApiClientEvents } from "./apiClientEvents.controller"; + +type ResponseRecorder = { + body: unknown; + statusCode: number; + json: ReturnType; + status: ReturnType; +}; + +function createResponse() { + const res: ResponseRecorder = { + body: undefined, + json: mock((body: unknown) => { + res.body = body; + return res; + }), + status: mock((statusCode: number) => { + res.statusCode = statusCode; + return res; + }), + statusCode: Number(httpStatus.OK) + }; + + return res; +} + +describe("api client events admin route", () => { + const originalAdminSecret = config.adminSecret; + const originalMetricsDashboardSecret = config.metricsDashboardSecret; + + afterEach(() => { + config.adminSecret = originalAdminSecret; + config.metricsDashboardSecret = originalMetricsDashboardSecret; + }); + + async function fetchFromTestRoute(authorization?: string) { + const app = express(); + app.use("/v1/admin/api-client-events", apiClientEventsRoutes); + + const server = app.listen(0); + const address = server.address(); + + if (!address || typeof address === "string") { + server.close(); + throw new Error("Could not bind test server"); + } + + try { + return await fetch(`http://127.0.0.1:${address.port}/v1/admin/api-client-events`, { + ...(authorization ? { headers: { Authorization: authorization } } : {}) + }); + } finally { + server.close(); + } + } + + it("rejects requests without metrics dashboard authentication before querying events", async () => { + const response = await fetchFromTestRoute(); + const body = await response.json(); + + expect(response.status).toBe(httpStatus.UNAUTHORIZED); + expect(body.error.code).toBe("METRICS_DASHBOARD_AUTH_REQUIRED"); + }); + + it("rejects the admin secret because metrics access has a dedicated secret", async () => { + config.adminSecret = "admin-secret"; + config.metricsDashboardSecret = "metrics-dashboard-secret"; + + const response = await fetchFromTestRoute("Bearer admin-secret"); + const body = await response.json(); + + expect(response.status).toBe(httpStatus.FORBIDDEN); + expect(body.error.code).toBe("INVALID_METRICS_DASHBOARD_TOKEN"); + }); +}); + +describe("listApiClientEvents", () => { + const originalFindAndCountAll = ApiClientEvent.findAndCountAll; + const originalFindAll = ApiClientEvent.findAll; + + afterEach(() => { + ApiClientEvent.findAndCountAll = originalFindAndCountAll; + ApiClientEvent.findAll = originalFindAll; + }); + + it("returns safe event fields, pagination, filters, and summary counts", async () => { + const findAndCountAllMock = mock(async (_options: unknown) => ({ + count: 2, + rows: [ + { + apiKeyPrefix: "sk_live_1234", + createdAt: new Date("2026-01-02T00:00:00.000Z"), + durationMs: 25, + errorMessage: null, + errorType: "none", + httpStatus: 200, + id: "event-1", + metadata: { endpoint: "/v1/quotes" }, + operation: "quote_create", + partnerName: "Partner", + quoteId: "quote-1", + rampId: null, + requestId: "request-1", + status: "success" + } + ] + })); + const findAllMock = mock(async (_options: unknown) => [ + { errorType: "none", operation: "quote_create", status: "success" }, + { errorType: "internal_error", operation: "ramp_start", status: "failure" } + ]); + + ApiClientEvent.findAndCountAll = findAndCountAllMock as unknown as typeof ApiClientEvent.findAndCountAll; + ApiClientEvent.findAll = findAllMock as unknown as typeof ApiClientEvent.findAll; + + const res = createResponse(); + await listApiClientEvents( + { + query: { + endDate: "2026-01-03T00:00:00.000Z", + limit: "500", + offset: "5", + operation: "quote_create", + partnerName: "Partner", + startDate: "2026-01-01T00:00:00.000Z", + status: "success" + } + } as Parameters[0], + res as unknown as Parameters[1] + ); + + const firstFindCall = findAndCountAllMock.mock.calls[0]; + expect(firstFindCall).toBeDefined(); + + const findOptions = firstFindCall?.[0] as { + attributes: string[]; + limit: number; + offset: number; + where: Record; + }; + + expect(res.statusCode).toBe(httpStatus.OK); + expect(findOptions.limit).toBe(200); + expect(findOptions.offset).toBe(5); + expect(findOptions.attributes).not.toContain("partnerId"); + expect(findOptions.attributes).not.toContain("userId"); + expect(findOptions.where.operation).toBe("quote_create"); + expect(findOptions.where.partnerName).toBe("Partner"); + expect(findOptions.where.status).toBe("success"); + expect(res.body).toEqual({ + events: [ + { + apiKeyPrefix: "sk_live_1234", + createdAt: new Date("2026-01-02T00:00:00.000Z"), + durationMs: 25, + errorMessage: null, + errorType: "none", + httpStatus: 200, + id: "event-1", + metadata: { endpoint: "/v1/quotes" }, + operation: "quote_create", + partnerName: "Partner", + quoteId: "quote-1", + rampId: null, + requestId: "request-1", + status: "success" + } + ], + limit: 200, + offset: 5, + summary: { + byErrorType: { internal_error: 1, none: 1 }, + byOperation: { quote_create: 1, ramp_start: 1 }, + byStatus: { failure: 1, success: 1 }, + sampleSize: 2, + total: 2 + }, + total: 2 + }); + }); +}); diff --git a/apps/api/src/api/controllers/admin/apiClientEvents.controller.ts b/apps/api/src/api/controllers/admin/apiClientEvents.controller.ts new file mode 100644 index 000000000..9da8c1f2e --- /dev/null +++ b/apps/api/src/api/controllers/admin/apiClientEvents.controller.ts @@ -0,0 +1,157 @@ +import { Request, Response } from "express"; +import httpStatus from "http-status"; +import { Op, WhereOptions } from "sequelize"; +import logger from "../../../config/logger"; +import ApiClientEvent, { ApiClientEventAttributes } from "../../../models/apiClientEvent.model"; +import { ApiClientErrorType, ApiClientEventStatus, ApiClientOperation } from "../../observability/types"; + +type ApiClientEventsQuery = { + apiKeyPrefix?: string; + endDate?: string; + errorType?: ApiClientErrorType; + limit?: string; + offset?: string; + operation?: ApiClientOperation; + partnerName?: string; + quoteId?: string; + rampId?: string; + requestId?: string; + startDate?: string; + status?: ApiClientEventStatus; +}; + +const DEFAULT_LIMIT = 50; +const MAX_LIMIT = 200; + +const SAFE_EVENT_ATTRIBUTES = [ + "id", + "requestId", + "operation", + "status", + "httpStatus", + "errorType", + "errorMessage", + "partnerName", + "apiKeyPrefix", + "quoteId", + "rampId", + "rampType", + "network", + "paymentMethod", + "durationMs", + "metadata", + "createdAt" +] satisfies (keyof ApiClientEventAttributes)[]; + +function parseInteger(value: string | undefined, fallback: number, maximum?: number): number { + if (!value) return fallback; + + const parsed = Number.parseInt(value, 10); + if (!Number.isFinite(parsed) || parsed < 0) return fallback; + + return maximum ? Math.min(parsed, maximum) : parsed; +} + +function parseDate(value: string | undefined): Date | null { + if (!value) return null; + + const date = new Date(value); + if (Number.isNaN(date.getTime())) return null; + + return date; +} + +function buildWhere(query: ApiClientEventsQuery): WhereOptions { + const where: WhereOptions = {}; + + if (query.apiKeyPrefix) where.apiKeyPrefix = query.apiKeyPrefix; + if (query.errorType) where.errorType = query.errorType; + if (query.operation) where.operation = query.operation; + if (query.partnerName) where.partnerName = query.partnerName; + if (query.quoteId) where.quoteId = query.quoteId; + if (query.rampId) where.rampId = query.rampId; + if (query.requestId) where.requestId = query.requestId; + if (query.status) where.status = query.status; + + const startDate = parseDate(query.startDate); + const endDate = parseDate(query.endDate); + + if (startDate || endDate) { + where.createdAt = { + ...(startDate ? { [Op.gte]: startDate } : {}), + ...(endDate ? { [Op.lte]: endDate } : {}) + }; + } + + return where; +} + +function buildCounts( + events: Pick[], + key: string +) { + return events.reduce>( + (counts, event) => { + const value = event[key as keyof typeof event]; + if (typeof value === "string") { + counts[value as T] = (counts[value as T] ?? 0) + 1; + } + return counts; + }, + {} as Record + ); +} + +/** + * GET /v1/admin/api-client-events + * List sanitized API client observability events for internal dashboards. + */ +export async function listApiClientEvents( + req: Request, + res: Response +): Promise { + try { + const limit = parseInteger(req.query.limit, DEFAULT_LIMIT, MAX_LIMIT); + const offset = parseInteger(req.query.offset, 0); + const where = buildWhere(req.query); + + const [eventsResult, summaryEvents] = await Promise.all([ + ApiClientEvent.findAndCountAll({ + attributes: SAFE_EVENT_ATTRIBUTES, + limit, + offset, + order: [["createdAt", "DESC"]], + where + }), + ApiClientEvent.findAll({ + attributes: ["operation", "status", "errorType"], + limit: 1000, + order: [["createdAt", "DESC"]], + where + }) + ]); + + res.status(httpStatus.OK).json({ + events: eventsResult.rows, + limit, + offset, + summary: { + byErrorType: buildCounts(summaryEvents, "errorType"), + byOperation: buildCounts(summaryEvents, "operation"), + byStatus: buildCounts(summaryEvents, "status"), + sampleSize: summaryEvents.length, + total: eventsResult.count + }, + total: eventsResult.count + }); + } catch (error) { + logger.error("Error listing API client events:", error); + res.status(httpStatus.INTERNAL_SERVER_ERROR).json({ + error: { + code: "INTERNAL_SERVER_ERROR", + message: "Failed to list API client events", + status: httpStatus.INTERNAL_SERVER_ERROR + } + }); + } +} diff --git a/apps/api/src/api/controllers/admin/profilePartnerAssignments.controller.test.ts b/apps/api/src/api/controllers/admin/profilePartnerAssignments.controller.test.ts new file mode 100644 index 000000000..80d0eeca5 --- /dev/null +++ b/apps/api/src/api/controllers/admin/profilePartnerAssignments.controller.test.ts @@ -0,0 +1,227 @@ +import {afterEach, describe, expect, it, mock} from "bun:test"; +import {RampDirection} from "@vortexfi/shared"; +import {Request, Response} from "express"; +import httpStatus from "http-status"; +import {Op, Transaction, UniqueConstraintError} from "sequelize"; +import sequelize from "../../../config/database"; +import Partner from "../../../models/partner.model"; +import ProfilePartnerAssignment from "../../../models/profilePartnerAssignment.model"; +import User from "../../../models/user.model"; +import {createProfilePartnerAssignment, listProfilePartnerAssignments} from "./profilePartnerAssignments.controller"; + +interface AssignmentFindAllOptions { + where: { + isActive?: boolean; + [Op.or]?: unknown[]; + }; +} + +function createResponse() { + const res = { + body: undefined as unknown, + send: mock(() => res), + statusCode: Number(httpStatus.OK), + json: mock((body: unknown) => { + res.body = body; + return res; + }), + status: mock((statusCode: number) => { + res.statusCode = statusCode; + return res; + }) + }; + + return res; +} + +describe("createProfilePartnerAssignment", () => { + const originalTransaction = sequelize.transaction; + const originalUserFindByPk = User.findByPk; + const originalPartnerFindAll = Partner.findAll; + const originalAssignmentUpdate = ProfilePartnerAssignment.update; + const originalAssignmentCreate = ProfilePartnerAssignment.create; + const originalAssignmentFindAll = ProfilePartnerAssignment.findAll; + + const transaction = { id: "profile-assignment-tx" }; + const createdAt = new Date("2026-06-03T12:00:00.000Z"); + const updatedAt = new Date("2026-06-03T12:00:01.000Z"); + + afterEach(() => { + sequelize.transaction = originalTransaction; + User.findByPk = originalUserFindByPk; + Partner.findAll = originalPartnerFindAll; + ProfilePartnerAssignment.update = originalAssignmentUpdate; + ProfilePartnerAssignment.create = originalAssignmentCreate; + ProfilePartnerAssignment.findAll = originalAssignmentFindAll; + }); + + function mockValidAssignmentDependencies() { + const transactionMock = mock(async (callback: (tx: unknown) => Promise) => callback(transaction)); + const userFindByPkMock = mock(async () => ({ id: "user-1" })); + const partnerFindAllMock = mock(async () => [ + { id: "buy-partner-1", name: "Acme", rampType: RampDirection.BUY }, + { id: "sell-partner-1", name: "Acme", rampType: RampDirection.SELL } + ]); + const assignmentUpdateMock = mock(async () => [1]); + const assignmentCreateMock = mock(async () => ({ + createdAt, + expiresAt: null, + buyPartnerId: "buy-partner-1", + id: "assignment-2", + isActive: true, + partnerName: "Acme", + sellPartnerId: "sell-partner-1", + updatedAt, + userId: "user-1" + })); + + sequelize.transaction = transactionMock as unknown as typeof sequelize.transaction; + User.findByPk = userFindByPkMock as unknown as typeof User.findByPk; + Partner.findAll = partnerFindAllMock as unknown as typeof Partner.findAll; + ProfilePartnerAssignment.update = assignmentUpdateMock as unknown as typeof ProfilePartnerAssignment.update; + ProfilePartnerAssignment.create = assignmentCreateMock as unknown as typeof ProfilePartnerAssignment.create; + + return { + assignmentCreateMock, + assignmentUpdateMock, + partnerFindAllMock, + transactionMock, + userFindByPkMock + }; + } + + it("replaces the active assignment inside a transaction after locking the profile row", async () => { + const { assignmentCreateMock, assignmentUpdateMock, transactionMock, userFindByPkMock } = mockValidAssignmentDependencies(); + const res = createResponse(); + + await createProfilePartnerAssignment( + { + body: { + partnerName: "Acme", + userId: "user-1" + } + } as unknown as Request, + res as unknown as Response + ); + + expect(res.statusCode).toBe(httpStatus.CREATED); + expect(transactionMock).toHaveBeenCalledTimes(1); + expect(userFindByPkMock).toHaveBeenCalledWith("user-1", { + lock: Transaction.LOCK.UPDATE, + transaction + }); + expect(assignmentUpdateMock).toHaveBeenCalledWith( + { isActive: false }, + { + transaction, + where: { + isActive: true, + userId: "user-1" + } + } + ); + expect(assignmentCreateMock).toHaveBeenCalledWith( + { + buyPartnerId: "buy-partner-1", + expiresAt: null, + isActive: true, + partnerName: "Acme", + sellPartnerId: "sell-partner-1", + userId: "user-1" + }, + { transaction } + ); + }); + + it("returns 409 when the active-assignment unique index rejects a concurrent replacement", async () => { + const { assignmentCreateMock } = mockValidAssignmentDependencies(); + assignmentCreateMock.mockImplementation(async () => { + throw new UniqueConstraintError({ message: "active assignment already exists" }); + }); + const res = createResponse(); + + await createProfilePartnerAssignment( + { + body: { + partnerName: "Acme", + userId: "user-1" + } + } as unknown as Request, + res as unknown as Response + ); + + expect(res.statusCode).toBe(httpStatus.CONFLICT); + expect(res.body).toEqual({ + error: { + code: "ASSIGNMENT_CONFLICT", + message: "An active assignment already exists for this profile. Please retry the request.", + status: httpStatus.CONFLICT + } + }); + }); + + it("rejects ambiguous active partners for the same ramp type", async () => { + mockValidAssignmentDependencies(); + Partner.findAll = mock(async () => [ + { id: "buy-partner-1", name: "Acme", rampType: RampDirection.BUY }, + { id: "buy-partner-2", name: "Acme", rampType: RampDirection.BUY } + ]) as unknown as typeof Partner.findAll; + const res = createResponse(); + + await createProfilePartnerAssignment( + { + body: { + partnerName: "Acme", + userId: "user-1" + } + } as unknown as Request, + res as unknown as Response + ); + + expect(res.statusCode).toBe(httpStatus.CONFLICT); + expect(res.body).toEqual({ + error: { + code: "AMBIGUOUS_PARTNER_ASSIGNMENT", + message: `Multiple active ${RampDirection.BUY} partners found with this name`, + status: httpStatus.CONFLICT + } + }); + }); + + it("excludes expired assignments from the default list", async () => { + const assignmentFindAllMock = mock(async (_options: AssignmentFindAllOptions) => []); + ProfilePartnerAssignment.findAll = assignmentFindAllMock as unknown as typeof ProfilePartnerAssignment.findAll; + const res = createResponse(); + + await listProfilePartnerAssignments({ query: {} } as unknown as Request, res as unknown as Response); + + expect(res.statusCode).toBe(httpStatus.OK); + expect(assignmentFindAllMock).toHaveBeenCalledTimes(1); + const findOptions = assignmentFindAllMock.mock.calls[0]?.[0]; + expect(findOptions).toBeDefined(); + if (!findOptions) { + throw new Error("ProfilePartnerAssignment.findAll was not called with options"); + } + expect(findOptions.where.isActive).toBe(true); + expect(findOptions.where[Op.or]).toHaveLength(2); + }); + + it("includes expired assignments when includeInactive is true", async () => { + const assignmentFindAllMock = mock(async (_options: AssignmentFindAllOptions) => []); + ProfilePartnerAssignment.findAll = assignmentFindAllMock as unknown as typeof ProfilePartnerAssignment.findAll; + const res = createResponse(); + + await listProfilePartnerAssignments( + { query: { includeInactive: "true" } } as unknown as Request, + res as unknown as Response + ); + + const findOptions = assignmentFindAllMock.mock.calls[0]?.[0]; + expect(findOptions).toBeDefined(); + if (!findOptions) { + throw new Error("ProfilePartnerAssignment.findAll was not called with options"); + } + expect(findOptions.where).not.toHaveProperty("isActive"); + expect(findOptions.where[Op.or]).toBeUndefined(); + }); +}); diff --git a/apps/api/src/api/controllers/admin/profilePartnerAssignments.controller.ts b/apps/api/src/api/controllers/admin/profilePartnerAssignments.controller.ts new file mode 100644 index 000000000..78df9239c --- /dev/null +++ b/apps/api/src/api/controllers/admin/profilePartnerAssignments.controller.ts @@ -0,0 +1,262 @@ +import { RampDirection } from "@vortexfi/shared"; +import { Request, Response } from "express"; +import httpStatus from "http-status"; +import { Op, Transaction, UniqueConstraintError, WhereOptions } from "sequelize"; +import sequelize from "../../../config/database"; +import logger from "../../../config/logger"; +import Partner from "../../../models/partner.model"; +import ProfilePartnerAssignment, { ProfilePartnerAssignmentAttributes } from "../../../models/profilePartnerAssignment.model"; +import User from "../../../models/user.model"; + +const PROFILE_NOT_FOUND_AFTER_LOCK = "PROFILE_NOT_FOUND_AFTER_LOCK"; + +function getUniquePartnerIdForRamp(partners: Partner[], rampType: RampDirection): string | null { + const rampPartners = partners.filter(partner => partner.rampType === rampType); + if (rampPartners.length > 1) { + throw new Error(`Multiple active ${rampType} partners found with this name`); + } + + return rampPartners[0]?.id ?? null; +} + +function parseExpiration(expiresAt: unknown): Date | null { + if (!expiresAt) { + return null; + } + + if (typeof expiresAt !== "string") { + throw new Error("expiresAt must be an ISO date string"); + } + + const expirationDate = new Date(expiresAt); + if (Number.isNaN(expirationDate.getTime())) { + throw new Error("expiresAt must be a valid ISO date string"); + } + + return expirationDate; +} + +function serializeAssignment(assignment: ProfilePartnerAssignment) { + return { + buyPartnerId: assignment.buyPartnerId, + createdAt: assignment.createdAt, + expiresAt: assignment.expiresAt, + id: assignment.id, + isActive: assignment.isActive, + partnerName: assignment.partnerName, + sellPartnerId: assignment.sellPartnerId, + updatedAt: assignment.updatedAt, + userId: assignment.userId + }; +} + +export async function createProfilePartnerAssignment(req: Request, res: Response): Promise { + try { + const { userId, partnerName, expiresAt } = req.body; + + if (!userId || typeof userId !== "string" || !partnerName || typeof partnerName !== "string") { + res.status(httpStatus.BAD_REQUEST).json({ + error: { + code: "INVALID_ASSIGNMENT_INPUT", + message: "userId and partnerName are required string fields", + status: httpStatus.BAD_REQUEST + } + }); + return; + } + + const user = await User.findByPk(userId); + if (!user) { + res.status(httpStatus.NOT_FOUND).json({ + error: { + code: "USER_NOT_FOUND", + message: "Profile was not found", + status: httpStatus.NOT_FOUND + } + }); + return; + } + + const partners = await Partner.findAll({ + where: { + isActive: true, + name: partnerName + } + }); + + if (partners.length === 0) { + res.status(httpStatus.NOT_FOUND).json({ + error: { + code: "PARTNER_NOT_FOUND", + message: `No active partners found with name: ${partnerName}`, + status: httpStatus.NOT_FOUND + } + }); + return; + } + + const buyPartnerId = getUniquePartnerIdForRamp(partners, RampDirection.BUY); + const sellPartnerId = getUniquePartnerIdForRamp(partners, RampDirection.SELL); + + const expirationDate = parseExpiration(expiresAt); + + const assignment = await sequelize.transaction(async transaction => { + const lockedUser = await User.findByPk(userId, { + lock: Transaction.LOCK.UPDATE, + transaction + }); + + if (!lockedUser) { + throw new Error(PROFILE_NOT_FOUND_AFTER_LOCK); + } + + await ProfilePartnerAssignment.update( + { isActive: false }, + { + transaction, + where: { + isActive: true, + userId + } + } + ); + + return ProfilePartnerAssignment.create( + { + buyPartnerId, + expiresAt: expirationDate, + isActive: true, + partnerName, + sellPartnerId, + userId + }, + { transaction } + ); + }); + + res.status(httpStatus.CREATED).json({ + assignment: serializeAssignment(assignment), + partnerCount: partners.length + }); + } catch (error) { + if (error instanceof Error && error.message.startsWith("Multiple active")) { + res.status(httpStatus.CONFLICT).json({ + error: { + code: "AMBIGUOUS_PARTNER_ASSIGNMENT", + message: error.message, + status: httpStatus.CONFLICT + } + }); + return; + } + + if (error instanceof Error && error.message.startsWith("expiresAt")) { + res.status(httpStatus.BAD_REQUEST).json({ + error: { + code: "INVALID_EXPIRES_AT", + message: error.message, + status: httpStatus.BAD_REQUEST + } + }); + return; + } + + if (error instanceof Error && error.message === PROFILE_NOT_FOUND_AFTER_LOCK) { + res.status(httpStatus.NOT_FOUND).json({ + error: { + code: "USER_NOT_FOUND", + message: "Profile was not found", + status: httpStatus.NOT_FOUND + } + }); + return; + } + + if (error instanceof UniqueConstraintError) { + res.status(httpStatus.CONFLICT).json({ + error: { + code: "ASSIGNMENT_CONFLICT", + message: "An active assignment already exists for this profile. Please retry the request.", + status: httpStatus.CONFLICT + } + }); + return; + } + + logger.error("Error creating profile partner assignment:", error); + res.status(httpStatus.INTERNAL_SERVER_ERROR).json({ + error: { + code: "INTERNAL_SERVER_ERROR", + message: "Failed to create profile partner assignment", + status: httpStatus.INTERNAL_SERVER_ERROR + } + }); + } +} + +export async function listProfilePartnerAssignments( + req: Request, + res: Response +): Promise { + try { + const { includeInactive, partnerName, userId } = req.query; + const where: WhereOptions = { + ...(includeInactive === "true" + ? {} + : { + [Op.or]: [{ expiresAt: null }, { expiresAt: { [Op.gt]: new Date() } }], + isActive: true + }), + ...(partnerName ? { partnerName } : {}), + ...(userId ? { userId } : {}) + }; + + const assignments = await ProfilePartnerAssignment.findAll({ + order: [["createdAt", "DESC"]], + where + }); + + res.status(httpStatus.OK).json({ + assignments: assignments.map(serializeAssignment) + }); + } catch (error) { + logger.error("Error listing profile partner assignments:", error); + res.status(httpStatus.INTERNAL_SERVER_ERROR).json({ + error: { + code: "INTERNAL_SERVER_ERROR", + message: "Failed to list profile partner assignments", + status: httpStatus.INTERNAL_SERVER_ERROR + } + }); + } +} + +export async function revokeProfilePartnerAssignment(req: Request<{ assignmentId: string }>, res: Response): Promise { + try { + const { assignmentId } = req.params; + const assignment = await ProfilePartnerAssignment.findByPk(assignmentId); + + if (!assignment) { + res.status(httpStatus.NOT_FOUND).json({ + error: { + code: "ASSIGNMENT_NOT_FOUND", + message: "Profile partner assignment was not found", + status: httpStatus.NOT_FOUND + } + }); + return; + } + + await assignment.update({ isActive: false }); + res.status(httpStatus.NO_CONTENT).send(); + } catch (error) { + logger.error("Error revoking profile partner assignment:", error); + res.status(httpStatus.INTERNAL_SERVER_ERROR).json({ + error: { + code: "INTERNAL_SERVER_ERROR", + message: "Failed to revoke profile partner assignment", + status: httpStatus.INTERNAL_SERVER_ERROR + } + }); + } +} diff --git a/apps/api/src/api/controllers/alfredpay.controller.ts b/apps/api/src/api/controllers/alfredpay.controller.ts index a745a1ba6..7f72d0555 100644 --- a/apps/api/src/api/controllers/alfredpay.controller.ts +++ b/apps/api/src/api/controllers/alfredpay.controller.ts @@ -150,8 +150,20 @@ export class AlfredpayController { const alfredpayService = AlfredpayApiService.getInstance(); - const newCustomer = await alfredpayService.createCustomer(userEmail, AlfredpayCustomerType.INDIVIDUAL, country); - const customerId = newCustomer.customerId; + let customerId: string; + try { + const newCustomer = await alfredpayService.createCustomer(userEmail, AlfredpayCustomerType.INDIVIDUAL, country); + customerId = newCustomer.customerId; + } catch (error) { + const errorMessage = (error as Error)?.message || ""; + if (errorMessage.includes("409") || errorMessage.includes("already registered")) { + logger.info("Customer already exists in Alfredpay, fetching existing customer"); + const existingCustomer = await alfredpayService.findCustomer(userEmail, country); + customerId = existingCustomer.customerId; + } else { + throw error; + } + } await AlfredPayCustomer.create({ alfredPayId: customerId, @@ -360,7 +372,7 @@ export class AlfredpayController { const linkResponse = await alfredpayService.getKybRedirectLink(alfredPayCustomer.alfredPayId); await alfredPayCustomer.update({ status: AlfredPayStatus.Consulted }); return res.json(linkResponse as AlfredpayGetKybRedirectLinkResponse); - } else if (country === "MX" || country === "CO") { + } else if (country === "MX" || country === "CO" || country === "AR") { // MX/CO use API-based (form) KYC — no redirect link needed. // Just reset status so the user can re-fill the form. await alfredPayCustomer.update({ status: AlfredPayStatus.Consulted }); @@ -399,8 +411,20 @@ export class AlfredpayController { const alfredpayService = AlfredpayApiService.getInstance(); - const newCustomer = await alfredpayService.createCustomer(userEmail, type, country); - const customerId = newCustomer.customerId; + let customerId: string; + try { + const newCustomer = await alfredpayService.createCustomer(userEmail, type, country); + customerId = newCustomer.customerId; + } catch (error) { + const errorMessage = (error as Error)?.message || ""; + if (errorMessage.includes("409") || errorMessage.includes("already registered")) { + logger.info("Business customer already exists in Alfredpay, fetching existing customer"); + const existingCustomer = await alfredpayService.findCustomer(userEmail, country); + customerId = existingCustomer.customerId; + } else { + throw error; + } + } await AlfredPayCustomer.create({ alfredPayId: customerId, @@ -463,7 +487,7 @@ export class AlfredpayController { static async submitKycInformation(req: Request, res: Response) { try { - const { country, ...kycData } = req.body as SubmitKycInformationRequest & { country: string }; + const { country, ...kycData } = req.body as SubmitKycInformationRequest; const userId = req.userId!; const alfredPayCustomer = await AlfredPayCustomer.findOne({ @@ -475,7 +499,21 @@ export class AlfredpayController { } const alfredpayService = AlfredpayApiService.getInstance(); - const result = await alfredpayService.submitKycInformation(alfredPayCustomer.alfredPayId, { ...kycData, country }); + let result: Awaited>; + try { + result = await alfredpayService.submitKycInformation(alfredPayCustomer.alfredPayId, { ...kycData, country }); + } catch (error) { + const errorMessage = (error as Error)?.message || ""; + if (errorMessage.includes("422") && errorMessage.includes("KYC record cannot be retried")) { + logger.info("KYC record cannot be retried, fetching existing submission"); + const existingSubmission = await alfredpayService.getLastKycSubmission(alfredPayCustomer.alfredPayId); + result = { submissionId: existingSubmission.submissionId } as Awaited< + ReturnType + >; + } else { + throw error; + } + } res.json(result); } catch (error) { @@ -557,7 +595,21 @@ export class AlfredpayController { } const alfredpayService = AlfredpayApiService.getInstance(); - const result = await alfredpayService.submitKybInformation(alfredPayCustomer.alfredPayId, { ...kybData, country }); + let result: Awaited>; + try { + result = await alfredpayService.submitKybInformation(alfredPayCustomer.alfredPayId, { ...kybData, country }); + } catch (error) { + const errorMessage = (error as Error)?.message || ""; + if (errorMessage.includes("422") && errorMessage.includes("KYC record cannot be retried")) { + logger.info("KYB record cannot be retried, fetching existing submission"); + const existingSubmission = await alfredpayService.getLastKybSubmission(alfredPayCustomer.alfredPayId); + result = { submissionId: existingSubmission.submissionId } as Awaited< + ReturnType + >; + } else { + throw error; + } + } res.json(result); } catch (error) { @@ -749,6 +801,11 @@ export class AlfredpayController { accountType: accountType ?? "", metadata: { accountHolderName: accountName, documentNumber, documentType } }; + } else if (alfredpayFiatAccountType === AlfredpayFiatAccountType.COELSA) { + fiatAccountFields = { + accountNumber, + accountType: accountType ?? "" + }; } else { // BANK_USA — external accounts need address fields inside metadata fiatAccountFields = isExternal diff --git a/apps/api/src/api/controllers/monerium.controller.ts b/apps/api/src/api/controllers/monerium.controller.ts deleted file mode 100644 index ba8180c0a..000000000 --- a/apps/api/src/api/controllers/monerium.controller.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Networks } from "@vortexfi/shared"; -import { Request, Response } from "express"; -import httpStatus from "http-status"; -import logger from "../../config/logger"; -import { checkAddressExists } from "../services/monerium"; - -export const checkAddressExistsController = async (req: Request, res: Response): Promise => { - const { address, network } = req.query; - - if (!address || typeof address !== "string") { - res.status(httpStatus.BAD_REQUEST).json({ error: "Invalid address parameter" }); - return; - } - - if (!network || typeof network !== "string") { - res.status(httpStatus.BAD_REQUEST).json({ error: "Invalid network parameter" }); - return; - } - - try { - const result = await checkAddressExists(address, network as Networks); - if (result) { - res.json(result); - } else { - res.status(httpStatus.NOT_FOUND).json({ error: "Address not found" }); - } - } catch (error) { - logger.error("Error in checkAddressExistsController:", error); - res.status(httpStatus.INTERNAL_SERVER_ERROR).json({ error: "Internal Server Error" }); - } -}; diff --git a/apps/api/src/api/controllers/mykobo.controller.ts b/apps/api/src/api/controllers/mykobo.controller.ts new file mode 100644 index 000000000..0812d0457 --- /dev/null +++ b/apps/api/src/api/controllers/mykobo.controller.ts @@ -0,0 +1,131 @@ +import { MykoboApiError, MykoboApiService, MykoboProfile } from "@vortexfi/shared"; +import { Request, Response } from "express"; +import httpStatus from "http-status"; +import { isAddress } from "viem"; +import logger from "../../config/logger"; +import { upsertMykoboCustomerFromProfile } from "../services/mykobo/mykobo-customer.service"; + +const PROFILE_TEXT_FIELDS = [ + "first_name", + "last_name", + "additional_name", + "email_address", + "mobile_number", + "birth_date", + "birth_country_code", + "address_line_1", + "city", + "id_country_code", + "id_type", + "bank_account_number", + "bank_number", + "wallet_address", + "source_of_funds", + "tax_country", + "tax_id", + "tax_id_name", + "memo" +] as const; + +const PROFILE_FILE_FIELDS = ["front", "back", "face", "utility_bill"] as const; + +const toFrontendProfile = (p: MykoboProfile) => ({ + bankAccountNumber: p.bank_account_number, + createdAt: p.created_at, + emailAddress: p.email_address, + firstName: p.first_name, + kycStatus: { + receivedAt: p.kyc_status.received_at, + reviewStatus: p.kyc_status.review_status + }, + lastName: p.last_name +}); + +const emailsMatch = (a: string | undefined, b: string | undefined): boolean => + !!a && !!b && a.trim().toLowerCase() === b.trim().toLowerCase(); + +export const getProfileController = async (req: Request, res: Response): Promise => { + const { email, memo } = req.query; + const userEmail = req.userEmail; + + if (!userEmail) { + res.status(httpStatus.UNAUTHORIZED).json({ error: "Authenticated user email missing" }); + return; + } + if (!email || typeof email !== "string" || !emailsMatch(email, userEmail)) { + res.status(httpStatus.BAD_REQUEST).json({ error: "Invalid email parameter" }); + return; + } + + try { + const memoParam = typeof memo === "string" && memo.length > 0 ? memo : undefined; + const { profile } = await MykoboApiService.getInstance().getProfileByEmail(userEmail, memoParam); + if (!emailsMatch(profile.email_address, userEmail)) { + res.status(httpStatus.NOT_FOUND).json({ error: "Profile not found" }); + return; + } + if (req.userId) { + try { + await upsertMykoboCustomerFromProfile(req.userId, userEmail, profile); + } catch (mirrorError) { + logger.error("Failed to update Mykobo customer mirror in getProfileController:", mirrorError); + } + } + res.json({ profile: toFrontendProfile(profile) }); + } catch (error) { + if (error instanceof MykoboApiError && error.status === 404) { + res.status(httpStatus.NOT_FOUND).json({ error: "Profile not found" }); + return; + } + logger.error("Error in getProfileController:", error); + res.status(httpStatus.INTERNAL_SERVER_ERROR).json({ error: "Internal Server Error" }); + } +}; + +export const createProfileController = async (req: Request, res: Response): Promise => { + const userEmail = req.userEmail; + if (!userEmail) { + res.status(httpStatus.UNAUTHORIZED).json({ error: "Authenticated user email missing" }); + return; + } + + try { + const body = (req.body ?? {}) as Record; + + const walletAddress = body.wallet_address; + if (typeof walletAddress !== "string" || !isAddress(walletAddress)) { + res.status(httpStatus.BAD_REQUEST).json({ error: "Invalid wallet_address" }); + return; + } + + const formData = new FormData(); + for (const field of PROFILE_TEXT_FIELDS) { + if (field === "email_address") continue; + const value = body[field]; + if (typeof value === "string" && value.length > 0) { + formData.append(field, value); + } + } + formData.append("email_address", userEmail); + + const files = (req as Request & { files?: Record }).files; + if (files && typeof files === "object") { + for (const fieldname of PROFILE_FILE_FIELDS) { + const file = files[fieldname]?.[0]; + if (!file) continue; + formData.append(fieldname, new Blob([new Uint8Array(file.buffer)], { type: file.mimetype }), file.originalname); + } + } + + const { profile } = await MykoboApiService.getInstance().createProfile(formData); + res.status(httpStatus.CREATED).json({ profile: toFrontendProfile(profile) }); + } catch (error) { + if (error instanceof MykoboApiError) { + logger.warn(`Mykobo /profiles upstream error: status=${error.status}`); + res.status(error.status).json({ error: "Mykobo profile creation failed" }); + return; + } + logger.error("Error in createProfileController:", error); + res.status(httpStatus.INTERNAL_SERVER_ERROR).json({ error: "Internal Server Error" }); + } +}; diff --git a/apps/api/src/api/controllers/pendulum.controller.ts b/apps/api/src/api/controllers/pendulum.controller.ts index 61717da30..5b4f869df 100644 --- a/apps/api/src/api/controllers/pendulum.controller.ts +++ b/apps/api/src/api/controllers/pendulum.controller.ts @@ -3,7 +3,6 @@ import { PendulumFundEphemeralErrorResponse, PendulumFundEphemeralRequest, PendulumFundEphemeralResponse, - StellarTokenConfig, TOKEN_CONFIG, XCMTokenConfig } from "@vortexfi/shared"; @@ -66,7 +65,7 @@ export const sendStatusWithPk = async (): Promise => { // Wait for all required token balances check. await Promise.all( - Object.entries(TOKEN_CONFIG).map(async ([token, tokenConfig]: [string, StellarTokenConfig | XCMTokenConfig]) => { + Object.entries(TOKEN_CONFIG).map(async ([token, tokenConfig]: [string, XCMTokenConfig]) => { logger.info(`Checking token ${token} balance...`); if (!tokenConfig.pendulumCurrencyId) { throw new Error(`Token ${token} does not have a currency id.`); diff --git a/apps/api/src/api/controllers/quote.controller.ts b/apps/api/src/api/controllers/quote.controller.ts index 90e74df30..471f36b85 100644 --- a/apps/api/src/api/controllers/quote.controller.ts +++ b/apps/api/src/api/controllers/quote.controller.ts @@ -1,4 +1,5 @@ import { + CreateBestQuoteRequest, CreateQuoteRequest, GetQuoteRequest, getNetworkFromDestination, @@ -10,6 +11,13 @@ import { NextFunction, Request, Response } from "express"; import httpStatus from "http-status"; import logger from "../../config/logger"; import { APIError } from "../errors/api-error"; +import { + buildApiClientRequestMetadata, + getSafeApiKeyPrefix, + observeApiClientEvent +} from "../observability/apiClientEvent.service"; +import { classifyApiClientError, getErrorMessage } from "../observability/errorClassifier"; +import { getRequestDurationMs } from "../observability/requestContext"; import quoteService from "../services/quote"; /** @@ -52,9 +60,33 @@ export const createQuote = async ( userId: req.userId }); + observeApiClientEvent({ + apiKeyPrefix: getSafeApiKeyPrefix(publicApiKey, ["pk_"]), + durationMs: getRequestDurationMs(req), + httpStatus: httpStatus.CREATED, + network, + operation: "quote_create", + partnerId: req.authenticatedPartner?.id || partnerId || null, + partnerName: req.authenticatedPartner?.name || publicKeyPartnerName || null, + paymentMethod: quote.paymentMethod, + quoteId: quote.id, + rampType, + requestId: req.requestId, + status: "success", + userId: req.userId || null + }); + res.status(httpStatus.CREATED).json(quote); } catch (error) { - logger.error(`Error creating quote: ${error instanceof Error ? error.message : String(error)}`); + logger.error("Error creating quote", { errorType: classifyApiClientError(error), requestId: req.requestId }); + observeQuoteFailure(req, "quote_create", error, { + apiKeyPrefix: getSafeApiKeyPrefix(req.body?.apiKey || req.validatedPublicKey?.apiKey, ["pk_"]), + network: getNetworkFromDestination(req.body?.rampType === RampDirection.BUY ? req.body?.to : req.body?.from), + partnerId: req.authenticatedPartner?.id || req.body?.partnerId || null, + partnerName: req.authenticatedPartner?.name || req.validatedPublicKey?.partnerName || null, + paymentMethod: req.body?.paymentMethod, + rampType: req.body?.rampType + }); next(error); } }; @@ -64,12 +96,13 @@ export const createQuote = async ( * @public */ export const createBestQuote = async ( - req: Request>, + req: Request, res: Response, next: NextFunction ): Promise => { try { - const { rampType, from, to, inputAmount, inputCurrency, outputCurrency, partnerId, apiKey, countryCode } = req.body; + const { rampType, from, to, inputAmount, inputCurrency, outputCurrency, partnerId, apiKey, countryCode, networks } = + req.body; // Get apiKey from body or from validated public key middleware const publicApiKey = apiKey || req.validatedPublicKey?.apiKey; @@ -82,6 +115,7 @@ export const createBestQuote = async ( from, inputAmount, inputCurrency, + networks, outputCurrency, partnerId, partnerName: publicKeyPartnerName, @@ -90,9 +124,31 @@ export const createBestQuote = async ( userId: req.userId }); + observeApiClientEvent({ + apiKeyPrefix: getSafeApiKeyPrefix(publicApiKey, ["pk_"]), + durationMs: getRequestDurationMs(req), + httpStatus: httpStatus.CREATED, + network: quote.network, + operation: "quote_create_best", + partnerId: req.authenticatedPartner?.id || partnerId || null, + partnerName: req.authenticatedPartner?.name || publicKeyPartnerName || null, + paymentMethod: quote.paymentMethod, + quoteId: quote.id, + rampType, + requestId: req.requestId, + status: "success", + userId: req.userId || null + }); + res.status(httpStatus.CREATED).json(quote); } catch (error) { - logger.error(`Error creating best quote: ${error instanceof Error ? error.message : String(error)}`); + logger.error("Error creating best quote", { errorType: classifyApiClientError(error), requestId: req.requestId }); + observeQuoteFailure(req, "quote_create_best", error, { + apiKeyPrefix: getSafeApiKeyPrefix(req.body?.apiKey || req.validatedPublicKey?.apiKey, ["pk_"]), + partnerId: req.authenticatedPartner?.id || req.body?.partnerId || null, + partnerName: req.authenticatedPartner?.name || req.validatedPublicKey?.partnerName || null, + rampType: req.body?.rampType + }); next(error); } }; @@ -118,9 +174,89 @@ export const getQuote = async ( }); } + observeApiClientEvent({ + durationMs: getRequestDurationMs(req), + httpStatus: httpStatus.OK, + network: quote.network, + operation: "quote_get", + paymentMethod: quote.paymentMethod, + quoteId: quote.id, + rampType: quote.rampType, + requestId: req.requestId, + status: "success", + userId: req.userId || null + }); + res.status(httpStatus.OK).json(quote); } catch (error) { - logger.error("Error getting quote:", error); + logger.error("Error getting quote", { errorType: classifyApiClientError(error), requestId: req.requestId }); + observeQuoteFailure(req, "quote_get", error, { quoteId: req.params.id }); next(error); } }; + +type QuoteOperation = "quote_create" | "quote_create_best" | "quote_get"; + +interface ObservedQuoteRequest { + body?: unknown; + method?: string; + params?: unknown; + path?: string; + query?: unknown; + requestId?: string; + requestStartedAt?: number; + userId?: string; +} + +function observeQuoteFailure( + req: ObservedQuoteRequest, + operation: QuoteOperation, + error: unknown, + context: { + apiKeyPrefix?: string | null; + network?: string | null; + partnerId?: string | null; + partnerName?: string | null; + paymentMethod?: string | null; + quoteId?: string | null; + rampType?: string | null; + } = {} +): void { + const status = getHttpStatus(error); + observeApiClientEvent({ + ...context, + durationMs: getRequestDurationMs(req), + errorMessage: getErrorMessage(error), + errorType: classifyApiClientError(error, status), + httpStatus: status, + metadata: buildQuoteRequestMetadata(req, operation), + operation, + requestId: req.requestId, + status: "failure", + userId: req.userId || null + }); +} + +function buildQuoteRequestMetadata(req: ObservedQuoteRequest, operation: QuoteOperation): Record { + if (operation === "quote_get") { + return buildApiClientRequestMetadata(req, { paramKeys: ["id"] }); + } + + return buildApiClientRequestMetadata(req, { + bodyKeys: [ + "countryCode", + "from", + "inputAmount", + "inputCurrency", + "networks", + "outputCurrency", + "partnerId", + "rampType", + "to" + ] + }); +} + +function getHttpStatus(error: unknown): number { + return error instanceof APIError ? error.status || httpStatus.INTERNAL_SERVER_ERROR : httpStatus.INTERNAL_SERVER_ERROR; +} diff --git a/apps/api/src/api/controllers/ramp.controller.ts b/apps/api/src/api/controllers/ramp.controller.ts index e0d3498a8..71c7be684 100644 --- a/apps/api/src/api/controllers/ramp.controller.ts +++ b/apps/api/src/api/controllers/ramp.controller.ts @@ -15,7 +15,12 @@ import { NextFunction, Request, Response } from "express"; import httpStatus from "http-status"; import logger from "../../config/logger"; import { APIError } from "../errors/api-error"; +import { enrichAdditionalDataWithClientIp } from "../helpers/clientIp"; import { assertQuoteOwnership, assertRampOwnership } from "../middlewares/ownershipAuth"; +import { buildApiClientRequestMetadata, observeApiClientEvent } from "../observability/apiClientEvent.service"; +import { classifyApiClientError, getErrorMessage } from "../observability/errorClassifier"; +import { getRequestDurationMs } from "../observability/requestContext"; +import { ApiClientOperation } from "../observability/types"; import rampService from "../services/ramp/ramp.service"; /** @@ -36,17 +41,26 @@ export const registerRamp = async (req: Request, res: Response, nex await assertQuoteOwnership(req, quoteId); - // Start ramping process + const enrichedAdditionalData = await enrichAdditionalDataWithClientIp(additionalData, req); + const ramp = await rampService.registerRamp({ - additionalData, + additionalData: enrichedAdditionalData, quoteId, signingAccounts, userId: req.userId }); + observeRampSuccess(req, "ramp_register", httpStatus.CREATED, { + paymentMethod: ramp.paymentMethod, + quoteId, + rampId: ramp.id, + rampType: ramp.type + }); + res.status(httpStatus.CREATED).json(ramp); } catch (error) { - logger.error("Error registering ramp:", error); + logger.error("Error registering ramp", { errorType: classifyApiClientError(error), requestId: req.requestId }); + observeRampFailure(req, "ramp_register", error, { quoteId: req.body?.quoteId || null }); next(error); } }; @@ -88,9 +102,17 @@ export const updateRamp = async ( rampId }); + observeRampSuccess(req, "ramp_update", httpStatus.OK, { + paymentMethod: ramp.paymentMethod, + quoteId: ramp.quoteId, + rampId, + rampType: ramp.type + }); + res.status(httpStatus.OK).json(ramp); } catch (error) { - logger.error("Error updating ramp:", error); + logger.error("Error updating ramp", { errorType: classifyApiClientError(error), requestId: req.requestId }); + observeRampFailure(req, "ramp_update", error, { rampId: req.body?.rampId || null }); next(error); } }; @@ -122,9 +144,17 @@ export const startRamp = async ( rampId }); + observeRampSuccess(req, "ramp_start", httpStatus.OK, { + paymentMethod: ramp.paymentMethod, + quoteId: ramp.quoteId, + rampId, + rampType: ramp.type + }); + res.status(httpStatus.OK).json(ramp); } catch (error) { - logger.error("Error starting ramp:", error); + logger.error("Error starting ramp", { errorType: classifyApiClientError(error), requestId: req.requestId }); + observeRampFailure(req, "ramp_start", error, { rampId: req.body?.rampId || null }); next(error); } }; @@ -153,9 +183,17 @@ export const getRampStatus = async ( }); } + observeRampSuccess(req, "ramp_status", httpStatus.OK, { + paymentMethod: ramp.paymentMethod, + quoteId: ramp.quoteId, + rampId: id, + rampType: ramp.type + }); + res.status(httpStatus.OK).json(ramp); } catch (error) { - logger.error("Error getting ramp status:", error); + logger.error("Error getting ramp status", { errorType: classifyApiClientError(error), requestId: req.requestId }); + observeRampFailure(req, "ramp_status", error, { rampId: req.params.id }); next(error); } }; @@ -183,9 +221,12 @@ export const getErrorLogs = async ( }); } + observeRampSuccess(req, "ramp_errors", httpStatus.OK, { rampId: id }); + res.status(httpStatus.OK).json(errorLogs); } catch (error) { - logger.error("Error getting error logs:", error); + logger.error("Error getting error logs", { errorType: classifyApiClientError(error), requestId: req.requestId }); + observeRampFailure(req, "ramp_errors", error, { rampId: req.params.id }); next(error); } }; @@ -232,3 +273,93 @@ export const getRampHistory = async ( next(error); } }; + +type RampObservedOperation = Extract< + ApiClientOperation, + "ramp_register" | "ramp_update" | "ramp_start" | "ramp_status" | "ramp_errors" +>; + +interface RampObservationContext { + paymentMethod?: string | null; + quoteId?: string | null; + rampId?: string | null; + rampType?: string | null; +} + +interface ObservedRampRequest { + authenticatedPartner?: { id: string; name: string }; + body?: unknown; + method?: string; + params?: unknown; + path?: string; + query?: unknown; + requestId?: string; + requestStartedAt?: number; + userId?: string; +} + +function observeRampSuccess( + req: ObservedRampRequest, + operation: RampObservedOperation, + status: number, + context: RampObservationContext +): void { + observeApiClientEvent({ + ...context, + durationMs: getRequestDurationMs(req), + httpStatus: status, + operation, + partnerId: req.authenticatedPartner?.id || null, + partnerName: req.authenticatedPartner?.name || null, + requestId: req.requestId, + status: "success", + userId: req.userId || null + }); +} + +function observeRampFailure( + req: ObservedRampRequest, + operation: RampObservedOperation, + error: unknown, + context: RampObservationContext +): void { + const status = getHttpStatus(error); + observeApiClientEvent({ + ...context, + durationMs: getRequestDurationMs(req), + errorMessage: getErrorMessage(error), + errorType: classifyApiClientError(error, status), + httpStatus: status, + metadata: buildRampRequestMetadata(req, operation), + operation, + partnerId: req.authenticatedPartner?.id || null, + partnerName: req.authenticatedPartner?.name || null, + requestId: req.requestId, + status: "failure", + userId: req.userId || null + }); +} + +function buildRampRequestMetadata(req: ObservedRampRequest, operation: RampObservedOperation): Record { + if (operation === "ramp_register") { + return buildApiClientRequestMetadata(req, { bodyKeys: ["quoteId", "signingAccounts", "additionalData"] }); + } + + if (operation === "ramp_update") { + return buildApiClientRequestMetadata(req, { bodyKeys: ["rampId", "presignedTxs", "additionalData"] }); + } + + if (operation === "ramp_start") { + return buildApiClientRequestMetadata(req, { bodyKeys: ["rampId"] }); + } + + if (operation === "ramp_status") { + return buildApiClientRequestMetadata(req, { paramKeys: ["id"], queryKeys: ["showUnsignedTxs"] }); + } + + return buildApiClientRequestMetadata(req, { paramKeys: ["id"] }); +} + +function getHttpStatus(error: unknown): number { + return error instanceof APIError ? error.status || httpStatus.INTERNAL_SERVER_ERROR : httpStatus.INTERNAL_SERVER_ERROR; +} diff --git a/apps/api/src/api/controllers/stellar.controller.ts b/apps/api/src/api/controllers/stellar.controller.ts deleted file mode 100644 index 06a7627a0..000000000 --- a/apps/api/src/api/controllers/stellar.controller.ts +++ /dev/null @@ -1,127 +0,0 @@ -import { - CreateStellarTransactionRequest, - CreateStellarTransactionResponse, - GetSep10MasterPKResponse, - SignSep10ChallengeRequest, - SignSep10ChallengeResponse, - StellarErrorResponse -} from "@vortexfi/shared"; -import { NextFunction, Request, Response } from "express"; -import httpStatus from "http-status"; -import { Keypair } from "stellar-sdk"; -import logger from "../../config/logger"; -import { config, SEP10_MASTER_SECRET } from "../../config/vars"; -import { STELLAR_FUNDING_AMOUNT_UNITS } from "../../constants/constants"; -import { signSep10Challenge } from "../services/sep10/sep10.service"; -import { SlackNotifier } from "../services/slack.service"; -import { buildCreationStellarTx, horizonServer } from "../services/stellar.service"; - -const FUNDING_PUBLIC_KEY = config.secrets.stellarFundingSecret - ? Keypair.fromSecret(config.secrets.stellarFundingSecret).publicKey() - : ""; - -export const createStellarTransactionHandler = async ( - req: Request, - res: Response, - _next: NextFunction -): Promise => { - try { - if (!config.secrets.stellarFundingSecret) { - throw new Error("FUNDING_SECRET is not configured"); - } - const { signature, sequence } = await buildCreationStellarTx( - config.secrets.stellarFundingSecret, - req.body.accountId, - req.body.maxTime, - req.body.assetCode, - req.body.baseFee - ); - res.json({ public: FUNDING_PUBLIC_KEY, sequence, signature }); - return; - } catch (error) { - logger.error("Error in createStellarTransaction:", error); - res.status(httpStatus.INTERNAL_SERVER_ERROR).json({ - details: (error as Error).message, - error: "Failed to create transaction" - }); - } -}; - -export const signSep10ChallengeHandler = async ( - req: Request, - res: Response, - _next: NextFunction -): Promise => { - try { - const { masterClientSignature, masterClientPublic, clientSignature, clientPublic } = await signSep10Challenge( - req.body.challengeXDR, - req.body.outToken, - req.body.clientPublicKey, - req.derivedMemo - ); - res.json({ - clientPublic: clientPublic ?? "", - clientSignature: clientSignature ?? "", - masterClientPublic: masterClientPublic ?? "", - masterClientSignature: masterClientSignature ?? "" - }); - return; - } catch (error) { - logger.error("Error in signSep10Challenge:", error); - res.status(httpStatus.INTERNAL_SERVER_ERROR).json({ - details: (error as Error).message, - error: "Failed to sign challenge" - }); - } -}; - -export const getSep10MasterPKHandler = async ( - _: Request, - res: Response, - _next: NextFunction -): Promise => { - try { - if (!SEP10_MASTER_SECRET) { - throw new Error("SEP10_MASTER_SECRET is not configured"); - } - const masterSep10Public = Keypair.fromSecret(SEP10_MASTER_SECRET).publicKey(); - res.json({ masterSep10Public }); - return; - } catch (error) { - logger.error("Error in getSep10MasterPK:", error); - res.status(httpStatus.INTERNAL_SERVER_ERROR).json({ - details: (error as Error).message, - error: "Failed to get master public key" - }); - } -}; - -interface StatusResult { - status: boolean; - public: string; -} - -export async function sendStatusWithPk(): Promise { - const slackNotifier = new SlackNotifier(); - - try { - const account = await horizonServer.loadAccount(FUNDING_PUBLIC_KEY); - const stellarBalance = account.balances.find( - (balance: { asset_type: string; balance: string }) => balance.asset_type === "native" - ); - - if (!stellarBalance || Number(stellarBalance.balance) < Number(STELLAR_FUNDING_AMOUNT_UNITS)) { - await slackNotifier.sendMessage({ - text: `Current balance of funding account is ${ - stellarBalance?.balance ?? 0 - } XLM please charge the account ${FUNDING_PUBLIC_KEY}.` - }); - return { public: FUNDING_PUBLIC_KEY, status: false }; - } - - return { public: FUNDING_PUBLIC_KEY, status: true }; - } catch (error) { - logger.error("Couldn't load Stellar account:", error); - return { public: FUNDING_PUBLIC_KEY, status: false }; - } -} diff --git a/apps/api/src/api/controllers/storage.controller.ts b/apps/api/src/api/controllers/storage.controller.ts index fd9fa9c48..0c115fc5f 100644 --- a/apps/api/src/api/controllers/storage.controller.ts +++ b/apps/api/src/api/controllers/storage.controller.ts @@ -19,22 +19,6 @@ export const DUMP_SHEET_COMMON_HEADERS = [ "outputTokenType" ]; -export const DUMP_SHEET_HEADER_VALUES_ASSETHUB_TO_STELLAR = [ - ...DUMP_SHEET_COMMON_HEADERS, - "offramperAddress", - "stellarEphemeralPublicKey", - "spacewalkRedeemTx", - "stellarOfframpTx", - "stellarCleanupTx" -]; - -export const DUMP_SHEET_HEADER_VALUES_EVM_TO_STELLAR = [ - ...DUMP_SHEET_COMMON_HEADERS, - "offramperAddress", - "squidRouterReceiverId", - "squidRouterReceiverHash" -]; - export const DUMP_SHEET_HEADER_VALUES_ASSETHUB_TO_BRLA = [ ...DUMP_SHEET_COMMON_HEADERS, "offramperAddress", @@ -65,11 +49,9 @@ export const DUMP_SHEET_HEADER_VALUES_BRLA_TO_ASSETHUB = [ export const FLOW_HEADERS: Record = { "assethub-to-brla": DUMP_SHEET_HEADER_VALUES_ASSETHUB_TO_BRLA, - "assethub-to-stellar": DUMP_SHEET_HEADER_VALUES_ASSETHUB_TO_STELLAR, "brla-to-assethub": DUMP_SHEET_HEADER_VALUES_BRLA_TO_ASSETHUB, "brla-to-evm": DUMP_SHEET_HEADER_VALUES_BRLA_TO_EVM, - "evm-to-brla": DUMP_SHEET_HEADER_VALUES_EVM_TO_BRLA, - "evm-to-stellar": DUMP_SHEET_HEADER_VALUES_EVM_TO_STELLAR + "evm-to-brla": DUMP_SHEET_HEADER_VALUES_EVM_TO_BRLA }; export const storeData = async (req: Request, res: Response): Promise => { if (!spreadsheet.storageSheetId) { diff --git a/apps/api/src/api/controllers/subsidize.controller.ts b/apps/api/src/api/controllers/subsidize.controller.ts index f1b273c41..f8d5db4ca 100644 --- a/apps/api/src/api/controllers/subsidize.controller.ts +++ b/apps/api/src/api/controllers/subsidize.controller.ts @@ -1,7 +1,6 @@ import { Keyring } from "@polkadot/api"; import { ApiManager, - StellarTokenConfig, SubsidizeErrorResponse, SubsidizePostSwapRequest, SubsidizePostSwapResponse, @@ -42,7 +41,7 @@ const validateSubsidyAmount = (amount: string, maxAmount: string) => { } }; -const getPendulumCurrencyConfig = (token: string): StellarTokenConfig | XCMTokenConfig => { +const getPendulumCurrencyConfig = (token: string): XCMTokenConfig => { const normalizedToken = token.toUpperCase() as keyof typeof TOKEN_CONFIG; const config = TOKEN_CONFIG[normalizedToken]; diff --git a/apps/api/src/api/errors/api-error.ts b/apps/api/src/api/errors/api-error.ts index cf147b707..6d49c80b5 100644 --- a/apps/api/src/api/errors/api-error.ts +++ b/apps/api/src/api/errors/api-error.ts @@ -7,6 +7,7 @@ interface APIErrorParams { stack?: string; status?: number; isPublic?: boolean; + type?: string; } /** @@ -20,13 +21,14 @@ export class APIError extends ExtendableError { * @param {number} status - HTTP status code of error. * @param {boolean} isPublic - Whether the message should be visible to user or not. */ - constructor({ message, errors, stack, status = httpStatus.INTERNAL_SERVER_ERROR, isPublic = false }: APIErrorParams) { + constructor({ message, errors, stack, status = httpStatus.INTERNAL_SERVER_ERROR, isPublic = false, type }: APIErrorParams) { super({ errors, isPublic, message, stack, - status + status, + type }); } } diff --git a/apps/api/src/api/errors/extendable-error.ts b/apps/api/src/api/errors/extendable-error.ts index 8085fd103..1c525a542 100644 --- a/apps/api/src/api/errors/extendable-error.ts +++ b/apps/api/src/api/errors/extendable-error.ts @@ -4,6 +4,7 @@ interface ExtendableErrorParams { status?: number; isPublic?: boolean; stack?: string; + type?: string; } /** @@ -19,7 +20,9 @@ class ExtendableError extends Error { readonly isOperational: boolean; - constructor({ message, errors, status, isPublic = false, stack }: ExtendableErrorParams) { + readonly type?: string; + + constructor({ message, errors, status, isPublic = false, stack, type }: ExtendableErrorParams) { super(message); this.name = this.constructor.name; this.message = message; @@ -28,6 +31,7 @@ class ExtendableError extends Error { this.isPublic = isPublic; this.isOperational = true; this.stack = stack; + this.type = type; // Error.captureStackTrace(this, this.constructor.name); } } diff --git a/apps/api/src/api/helpers/anchors.ts b/apps/api/src/api/helpers/anchors.ts deleted file mode 100644 index 5e96ef412..000000000 --- a/apps/api/src/api/helpers/anchors.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { fetchWithTimeout } from "./fetchWithTimeout"; - -interface TomlValues { - signingKey: string | undefined; - webAuthEndpoint: string | undefined; - sep24Url: string | undefined; - sep6Url: string | undefined; - kycServer: string | undefined; -} - -const TOML_KEYS = { - KYC_SERVER: "KYC_SERVER", - SIGNING_KEY: "SIGNING_KEY", - TRANSFER_SERVER: "TRANSFER_SERVER", - TRANSFER_SERVER_SEP0024: "TRANSFER_SERVER_SEP0024", - WEB_AUTH_ENDPOINT: "WEB_AUTH_ENDPOINT" -} as const; - -const fetchTomlValues = async (tomlFileUrl: string): Promise => { - const response = await fetchWithTimeout(tomlFileUrl); - if (!response.ok) { - throw new Error(`Failed to fetch TOML file: ${response.statusText}`); - } - - const tomlFileContent = (await response.text()).split("\n"); - const findValueInToml = (key: string): string | undefined => { - const keyValue = tomlFileContent.find(line => line.includes(key)); - return keyValue?.split("=")[1]?.trim().replace(/"/g, ""); - }; - - return { - kycServer: findValueInToml(TOML_KEYS.KYC_SERVER), - sep6Url: findValueInToml(TOML_KEYS.TRANSFER_SERVER), - sep24Url: findValueInToml(TOML_KEYS.TRANSFER_SERVER_SEP0024), - signingKey: findValueInToml(TOML_KEYS.SIGNING_KEY), - webAuthEndpoint: findValueInToml(TOML_KEYS.WEB_AUTH_ENDPOINT) - }; -}; - -export { fetchTomlValues, type TomlValues }; diff --git a/apps/api/src/api/helpers/clientIp.test.ts b/apps/api/src/api/helpers/clientIp.test.ts new file mode 100644 index 000000000..8b0434978 --- /dev/null +++ b/apps/api/src/api/helpers/clientIp.test.ts @@ -0,0 +1,37 @@ +import {describe, expect, it} from "bun:test"; +import {enrichAdditionalDataWithClientIp, normalizeClientIp} from "./clientIp"; + +describe("normalizeClientIp", () => { + it("normalizes IPv6 localhost to IPv4 localhost", () => { + expect(normalizeClientIp("::1")).toBe("127.0.0.1"); + }); + + it("normalizes IPv4-mapped IPv6 addresses to IPv4", () => { + expect(normalizeClientIp("::ffff:203.0.113.42")).toBe("203.0.113.42"); + }); + + it("keeps regular IPv4 addresses unchanged", () => { + expect(normalizeClientIp("198.51.100.24")).toBe("198.51.100.24"); + }); +}); + +describe("enrichAdditionalDataWithClientIp", () => { + it("adds the normalized request IP when additional data does not include one", async () => { + const additionalData = await enrichAdditionalDataWithClientIp({ email: "user@example.com" }, { ip: "::1" }); + + expect(additionalData?.email).toBe("user@example.com"); + expect(typeof additionalData?.ipAddress).toBe("string"); + }); + + it("keeps a provided IPv4 address over the request IP", async () => { + const additionalData = await enrichAdditionalDataWithClientIp({ ipAddress: "198.51.100.24" }, { ip: "::1" }); + + expect(additionalData?.ipAddress).toBe("198.51.100.24"); + }); + + it("normalizes a provided IPv4-mapped address", async () => { + const additionalData = await enrichAdditionalDataWithClientIp({ ipAddress: "::ffff:198.51.100.24" }, { ip: "::1" }); + + expect(additionalData?.ipAddress).toBe("198.51.100.24"); + }); +}); diff --git a/apps/api/src/api/helpers/clientIp.ts b/apps/api/src/api/helpers/clientIp.ts new file mode 100644 index 000000000..5c8ebf825 --- /dev/null +++ b/apps/api/src/api/helpers/clientIp.ts @@ -0,0 +1,101 @@ +import { isIP } from "node:net"; +import { RegisterRampRequest } from "@vortexfi/shared"; +import logger from "../../config/logger"; +import { config } from "../../config/vars"; + +const IPV4_MAPPED_IPV6_PREFIX = "::ffff:"; +const PUBLIC_IP_LOOKUP_URL = "https://api.ipify.org?format=json"; +const PUBLIC_IP_LOOKUP_TIMEOUT_MS = 2000; +const PUBLIC_IP_CACHE_TTL_MS = 10 * 60 * 1000; + +interface RequestIpSource { + ip?: string; +} + +let cachedHostPublicIp: { value: string; expiresAt: number } | undefined; + +function isLoopbackIp(ipAddress: string): boolean { + return ( + ipAddress === "127.0.0.1" || + ipAddress.startsWith("10.") || + /^192\.168\./.test(ipAddress) || + /^172\.(1[6-9]|2\d|3[01])\./.test(ipAddress) + ); +} + +async function fetchHostPublicIp(): Promise { + const now = Date.now(); + if (cachedHostPublicIp && cachedHostPublicIp.expiresAt > now) { + return cachedHostPublicIp.value; + } + + try { + const controller = new AbortController(); + const timeoutId = setTimeout(() => controller.abort(), PUBLIC_IP_LOOKUP_TIMEOUT_MS); + const response = await fetch(PUBLIC_IP_LOOKUP_URL, { signal: controller.signal }); + clearTimeout(timeoutId); + + if (!response.ok) { + logger.warn(`Public IP lookup returned status ${response.status}`); + return undefined; + } + + const body = (await response.json()) as { ip?: unknown }; + const ipAddress = typeof body.ip === "string" ? body.ip : undefined; + + if (!ipAddress || isIP(ipAddress) === 0) { + logger.warn(`Public IP lookup returned invalid payload: ${JSON.stringify(body)}`); + return undefined; + } + + cachedHostPublicIp = { expiresAt: now + PUBLIC_IP_CACHE_TTL_MS, value: ipAddress }; + return ipAddress; + } catch (error) { + logger.warn(`Public IP lookup failed: ${(error as Error).message}`); + return undefined; + } +} + +export function normalizeClientIp(ipAddress: string | undefined): string | undefined { + const trimmedIpAddress = ipAddress?.trim(); + + if (!trimmedIpAddress) { + return undefined; + } + + if (trimmedIpAddress === "::1") { + return "127.0.0.1"; + } + + if (trimmedIpAddress.toLowerCase().startsWith(IPV4_MAPPED_IPV6_PREFIX)) { + const mappedIpv4Address = trimmedIpAddress.slice(IPV4_MAPPED_IPV6_PREFIX.length); + + if (isIP(mappedIpv4Address) === 4) { + return mappedIpv4Address; + } + } + + return trimmedIpAddress; +} + +export async function enrichAdditionalDataWithClientIp( + additionalData: RegisterRampRequest["additionalData"], + request: RequestIpSource +): Promise { + const providedIpAddress = + typeof additionalData?.ipAddress === "string" ? normalizeClientIp(additionalData.ipAddress) : undefined; + + let resolvedIpAddress = providedIpAddress ?? normalizeClientIp(request.ip); + + if (config.deploymentEnv !== "production" && (!resolvedIpAddress || isLoopbackIp(resolvedIpAddress))) { + const hostPublicIp = await fetchHostPublicIp(); + if (hostPublicIp) { + resolvedIpAddress = hostPublicIp; + } + } + + return { + ...(additionalData ?? {}), + ipAddress: resolvedIpAddress + }; +} diff --git a/apps/api/src/api/middlewares/apiKeyAuth.ts b/apps/api/src/api/middlewares/apiKeyAuth.ts index 276cb11a6..76fa3a03e 100644 --- a/apps/api/src/api/middlewares/apiKeyAuth.ts +++ b/apps/api/src/api/middlewares/apiKeyAuth.ts @@ -1,10 +1,18 @@ import { NextFunction, Request, Response } from "express"; import logger from "../../config/logger"; import Partner from "../../models/partner.model"; +import { + buildApiClientRequestMetadata, + getSafeApiKeyPrefix, + observeApiClientEvent +} from "../observability/apiClientEvent.service"; +import { getRequestDurationMs } from "../observability/requestContext"; +import { ApiClientErrorType } from "../observability/types"; import { AuthenticatedPartner, getKeyType, isValidSecretKeyFormat, validateApiKey } from "./apiKeyAuth.helpers"; // Extend Express Request type to include authenticatedPartner declare global { + // biome-ignore lint/style/noNamespace: Express request augmentation follows the existing backend pattern. namespace Express { interface Request { authenticatedPartner?: AuthenticatedPartner; @@ -31,6 +39,7 @@ export function apiKeyAuth(options: ApiKeyAuthOptions = {}) { // No API key provided if (!apiKey) { if (options.required) { + recordAuthFailure(req, 401, "auth_missing_api_key"); return res.status(401).json({ error: { code: "API_KEY_REQUIRED", @@ -46,6 +55,7 @@ export function apiKeyAuth(options: ApiKeyAuthOptions = {}) { // Validate that it's a secret key format (sk_*) const keyType = getKeyType(apiKey); if (keyType !== "secret") { + recordAuthFailure(req, 401, "auth_invalid_api_key", getSafeApiKeyPrefix(apiKey, ["sk_"])); return res.status(401).json({ error: { code: "INVALID_SECRET_KEY", @@ -57,6 +67,7 @@ export function apiKeyAuth(options: ApiKeyAuthOptions = {}) { } if (!isValidSecretKeyFormat(apiKey)) { + recordAuthFailure(req, 401, "auth_invalid_api_key", getSafeApiKeyPrefix(apiKey, ["sk_"])); return res.status(401).json({ error: { code: "INVALID_SECRET_KEY_FORMAT", @@ -70,6 +81,7 @@ export function apiKeyAuth(options: ApiKeyAuthOptions = {}) { const partner = await validateApiKey(apiKey); if (!partner) { + recordAuthFailure(req, 401, "auth_invalid_api_key", getSafeApiKeyPrefix(apiKey, ["sk_"])); return res.status(401).json({ error: { code: "INVALID_API_KEY", @@ -96,6 +108,7 @@ export function apiKeyAuth(options: ApiKeyAuthOptions = {}) { const requestedPartner = await Partner.findByPk(partnerIdOrName); if (!requestedPartner) { + recordAuthFailure(req, 404, "auth_partner_not_found", getSafeApiKeyPrefix(apiKey, ["sk_"]), partner); return res.status(404).json({ error: { code: "PARTNER_NOT_FOUND", @@ -113,6 +126,7 @@ export function apiKeyAuth(options: ApiKeyAuthOptions = {}) { // Compare partner names since one API key works for all partners with same name if (requestedPartnerName !== partner.name) { + recordAuthFailure(req, 403, "auth_partner_mismatch", getSafeApiKeyPrefix(apiKey, ["sk_"]), partner); return res.status(403).json({ error: { code: "PARTNER_MISMATCH", @@ -148,6 +162,7 @@ export function enforcePartnerAuth() { if (req.body?.partnerId) { // Partner must be authenticated if (!req.authenticatedPartner) { + recordAuthFailure(req, 403, "auth_missing_api_key"); return res.status(403).json({ error: { code: "AUTHENTICATION_REQUIRED", @@ -169,6 +184,7 @@ export function enforcePartnerAuth() { const requestedPartner = await Partner.findByPk(partnerIdOrName); if (!requestedPartner) { + recordAuthFailure(req, 404, "auth_partner_not_found", null, req.authenticatedPartner); return res.status(404).json({ error: { code: "PARTNER_NOT_FOUND", @@ -186,6 +202,7 @@ export function enforcePartnerAuth() { // Compare partner names (not IDs) since one API key works for all partners with same name if (requestedPartnerName !== req.authenticatedPartner.name) { + recordAuthFailure(req, 403, "auth_partner_mismatch", null, req.authenticatedPartner); return res.status(403).json({ error: { code: "PARTNER_MISMATCH", @@ -203,3 +220,32 @@ export function enforcePartnerAuth() { next(); }; } + +function recordAuthFailure( + req: Request, + httpStatus: number, + errorType: Extract< + ApiClientErrorType, + | "auth_missing_api_key" + | "auth_invalid_api_key" + | "auth_invalid_public_key" + | "auth_partner_not_found" + | "auth_partner_mismatch" + >, + apiKeyPrefix?: string | null, + partner?: AuthenticatedPartner +): void { + observeApiClientEvent({ + apiKeyPrefix, + durationMs: getRequestDurationMs(req), + errorType, + httpStatus, + metadata: buildApiClientRequestMetadata(req, { bodyKeys: ["partnerId"] }), + operation: "auth_api_key", + partnerId: partner?.id || req.authenticatedPartner?.id || null, + partnerName: partner?.name || req.authenticatedPartner?.name || null, + requestId: req.requestId, + status: "failure", + userId: req.userId || null + }); +} diff --git a/apps/api/src/api/middlewares/dualAuth.test.ts b/apps/api/src/api/middlewares/dualAuth.test.ts index 97d2a31e5..41a40fcd0 100644 --- a/apps/api/src/api/middlewares/dualAuth.test.ts +++ b/apps/api/src/api/middlewares/dualAuth.test.ts @@ -27,6 +27,17 @@ describe("assertQuoteOwnership", () => { it("allows a Supabase user registering their own quote", async () => { QuoteTicket.findByPk = mock(async () => ({ partnerId: null, + pricingPartnerId: null, + userId: "user-1" + })) as typeof QuoteTicket.findByPk; + + await expect(assertQuoteOwnership({ userId: "user-1" }, "quote-1")).resolves.toBeUndefined(); + }); + + it("allows a Supabase user registering their own profile-priced quote", async () => { + QuoteTicket.findByPk = mock(async () => ({ + partnerId: null, + pricingPartnerId: "pricing-partner-id", userId: "user-1" })) as typeof QuoteTicket.findByPk; @@ -49,6 +60,7 @@ describe("assertQuoteOwnership", () => { })) as typeof QuoteTicket.findByPk; Partner.findByPk = mock(async () => ({ id: "quote-partner-id", + isActive: true, name: "Partner" })) as typeof Partner.findByPk; diff --git a/apps/api/src/api/middlewares/dualAuth.ts b/apps/api/src/api/middlewares/dualAuth.ts index a7ca0e554..361021d69 100644 --- a/apps/api/src/api/middlewares/dualAuth.ts +++ b/apps/api/src/api/middlewares/dualAuth.ts @@ -1,5 +1,11 @@ import { NextFunction, Request, Response } from "express"; import logger from "../../config/logger"; +import { + buildApiClientRequestMetadata, + getSafeApiKeyPrefix, + observeApiClientEvent +} from "../observability/apiClientEvent.service"; +import { getRequestDurationMs } from "../observability/requestContext"; import { SupabaseAuthService } from "../services/auth"; import { getKeyType, isValidSecretKeyFormat, validateSecretApiKey } from "./apiKeyAuth.helpers"; @@ -35,6 +41,7 @@ function dualAuthHandler({ requireCredentials }: { requireCredentials: boolean } if (apiKey) { const keyType = getKeyType(apiKey); if (keyType !== "secret" || !isValidSecretKeyFormat(apiKey)) { + recordDualAuthFailure(req, 401, "auth_invalid_api_key", getSafeApiKeyPrefix(apiKey, ["sk_"])); return res.status(401).json({ error: { code: "INVALID_SECRET_KEY", @@ -46,6 +53,7 @@ function dualAuthHandler({ requireCredentials }: { requireCredentials: boolean } const partner = await validateSecretApiKey(apiKey); if (!partner) { + recordDualAuthFailure(req, 401, "auth_invalid_api_key", getSafeApiKeyPrefix(apiKey, ["sk_"])); return res.status(401).json({ error: { code: "INVALID_API_KEY", @@ -63,6 +71,7 @@ function dualAuthHandler({ requireCredentials }: { requireCredentials: boolean } const token = authHeader.slice(7); const result = await SupabaseAuthService.verifyToken(token); if (!result.valid) { + recordDualAuthFailure(req, 401, "auth_invalid_api_key"); return res.status(401).json({ error: { code: "INVALID_BEARER_TOKEN", @@ -81,6 +90,7 @@ function dualAuthHandler({ requireCredentials }: { requireCredentials: boolean } return next(); } + recordDualAuthFailure(req, 401, "auth_missing_api_key"); return res.status(401).json({ error: { code: "AUTHENTICATION_REQUIRED", @@ -94,3 +104,24 @@ function dualAuthHandler({ requireCredentials }: { requireCredentials: boolean } } }; } + +function recordDualAuthFailure( + req: Request, + httpStatus: number, + errorType: "auth_missing_api_key" | "auth_invalid_api_key", + apiKeyPrefix?: string | null +): void { + observeApiClientEvent({ + apiKeyPrefix, + durationMs: getRequestDurationMs(req), + errorType, + httpStatus, + metadata: buildApiClientRequestMetadata(req, { bodyKeys: ["partnerId"] }), + operation: "auth_dual", + partnerId: req.authenticatedPartner?.id || null, + partnerName: req.authenticatedPartner?.name || null, + requestId: req.requestId, + status: "failure", + userId: req.userId || null + }); +} diff --git a/apps/api/src/api/middlewares/error.test.ts b/apps/api/src/api/middlewares/error.test.ts new file mode 100644 index 000000000..f5e0ec0e3 --- /dev/null +++ b/apps/api/src/api/middlewares/error.test.ts @@ -0,0 +1,61 @@ +import {describe, expect, it} from "bun:test"; +import httpStatus from "http-status"; +import {APIError} from "../errors/api-error"; +import {handler} from "./error"; + +function createMockResponse() { + const response = { + body: undefined as unknown, + statusCode: undefined as number | undefined, + json(body: unknown) { + response.body = body; + return response; + }, + status(statusCode: number) { + response.statusCode = statusCode; + return response; + } + }; + + return response; +} + +describe("error middleware", () => { + it("masks non-public internal server errors in production-like environments", () => { + const response = createMockResponse(); + + handler( + new APIError({ message: "provider secret details", status: httpStatus.INTERNAL_SERVER_ERROR }), + undefined as never, + response as never, + undefined as never + ); + + expect(response.statusCode).toBe(httpStatus.INTERNAL_SERVER_ERROR); + expect(response.body).toMatchObject({ + code: httpStatus.INTERNAL_SERVER_ERROR, + message: "Internal server error" + }); + }); + + it("preserves explicitly public internal server error messages", () => { + const response = createMockResponse(); + + handler( + new APIError({ + isPublic: true, + message: "This route is temporarily unavailable due to low liquidity. Please try a smaller amount or check back soon.", + status: httpStatus.INTERNAL_SERVER_ERROR + }), + undefined as never, + response as never, + undefined as never + ); + + expect(response.statusCode).toBe(httpStatus.INTERNAL_SERVER_ERROR); + expect(response.body).toMatchObject({ + code: httpStatus.INTERNAL_SERVER_ERROR, + message: "This route is temporarily unavailable due to low liquidity. Please try a smaller amount or check back soon." + }); + }); +}); diff --git a/apps/api/src/api/middlewares/error.ts b/apps/api/src/api/middlewares/error.ts index a893e334a..49fd1058f 100644 --- a/apps/api/src/api/middlewares/error.ts +++ b/apps/api/src/api/middlewares/error.ts @@ -12,6 +12,8 @@ interface ErrorResponse { message: string; errors?: unknown[]; stack?: string; + statusCode?: number; + type?: string; } /** @@ -29,10 +31,19 @@ const handler = (err: APIError | Error, _req: Request, res: Response, _next: Nex stack: err.stack }; + if (apiError.type) { + response.statusCode = statusCode; + response.type = apiError.type; + } + if (env !== "development") { delete response.stack; if (statusCode >= 500) { - response.message = "Internal server error"; + // Preserve messages for intentional 5xx codes (e.g. 503 SERVICE_UNAVAILABLE used by + // ephemeral freshness checks). Only mask unexpected internal server errors (500). + if (statusCode === httpStatus.INTERNAL_SERVER_ERROR && !apiError.isPublic) { + response.message = "Internal server error"; + } } } diff --git a/apps/api/src/api/middlewares/maintenanceGuard.test.ts b/apps/api/src/api/middlewares/maintenanceGuard.test.ts new file mode 100644 index 000000000..a67bb9fc2 --- /dev/null +++ b/apps/api/src/api/middlewares/maintenanceGuard.test.ts @@ -0,0 +1,242 @@ +import {afterEach, describe, expect, it, mock} from "bun:test"; +import type {NextFunction, Request, Response} from "express"; +import express from "express"; +import httpStatus from "http-status"; +import {APIError} from "../errors/api-error"; +import type {ApiClientEventInput} from "../observability/types"; +import {MaintenanceService} from "../services/maintenance.service"; +import {handler as errorHandler} from "./error"; + +const observedEvents: ApiClientEventInput[] = []; +const controllerCalls: string[] = []; + +mock.module("../observability/apiClientEvent.service", () => ({ + buildApiClientRequestMetadata: mock(() => ({})), + getSafeApiKeyPrefix: mock((apiKey: string | null | undefined) => apiKey?.slice(0, 16) || null), + observeApiClientEvent: mock((event: ApiClientEventInput) => { + observedEvents.push(event); + }) +})); + +function controllerHandler(name: string) { + return (_req: Request, res: Response) => { + controllerCalls.push(name); + res.status(httpStatus.IM_A_TEAPOT).json({ reached: name }); + }; +} + +mock.module("../controllers/quote.controller", () => ({ + createBestQuote: mock(controllerHandler("quote_create_best_controller")), + createQuote: mock(controllerHandler("quote_create_controller")), + getQuote: mock(controllerHandler("quote_get_controller")) +})); + +mock.module("../controllers/ramp.controller", () => ({ + getErrorLogs: mock(controllerHandler("ramp_errors_controller")), + getRampHistory: mock(controllerHandler("ramp_history_controller")), + getRampStatus: mock(controllerHandler("ramp_status_controller")), + registerRamp: mock(controllerHandler("ramp_register_controller")), + startRamp: mock(controllerHandler("ramp_start_controller")), + updateRamp: mock(controllerHandler("ramp_update_controller")) +})); + +mock.module("../services/auth", () => ({ + SupabaseAuthService: { + verifyToken: mock(async () => ({ valid: false })) + } +})); + +const { rejectDuringActiveMaintenance } = await import("./maintenanceGuard"); +const { default: quoteRoutes } = await import("../routes/v1/quote.route"); +const { default: rampRoutes } = await import("../routes/v1/ramp.route"); + +type MaintenanceStatus = Awaited>; +type MaintenanceHttpResponse = { + code: number; + errors?: Record[]; + statusCode?: number; + type?: string; +}; + +const maintenanceService = MaintenanceService.getInstance(); +const originalGetMaintenanceStatus = maintenanceService.getMaintenanceStatus; + +function buildResponse() { + const headers: Record = {}; + const res: Partial & { headers: Record } = { headers }; + + res.setHeader = mock((name: string, value: number | string | readonly string[]) => { + headers[name] = Array.isArray(value) ? value.join(", ") : String(value); + return res as Response; + }) as Response["setHeader"]; + + return res as Response & { headers: Record }; +} + +function mockMaintenanceStatus(status: MaintenanceStatus) { + maintenanceService.getMaintenanceStatus = mock(async () => status) as unknown as MaintenanceService["getMaintenanceStatus"]; +} + +async function fetchFromGuardedRoutes(path: string) { + const app = express(); + app.use(express.json()); + app.use("/v1/quotes", quoteRoutes); + app.use("/v1/ramp", rampRoutes); + app.use(errorHandler); + + const server = app.listen(0); + const address = server.address(); + + if (!address || typeof address === "string") { + server.close(); + throw new Error("Could not bind test server"); + } + + try { + return await fetch(`http://127.0.0.1:${address.port}${path}`, { + body: JSON.stringify({ malformed: true }), + headers: { "Content-Type": "application/json" }, + method: "POST" + }); + } finally { + server.close(); + } +} + +describe("rejectDuringActiveMaintenance", () => { + afterEach(() => { + controllerCalls.length = 0; + observedEvents.length = 0; + maintenanceService.getMaintenanceStatus = originalGetMaintenanceStatus; + }); + + it("passes through when there is no active maintenance window", async () => { + mockMaintenanceStatus({ is_maintenance_active: false, maintenance_details: null }); + + const res = buildResponse(); + const next: NextFunction = mock(() => undefined) as unknown as NextFunction; + + await rejectDuringActiveMaintenance("quote_create")({} as Request, res, next); + + expect(next).toHaveBeenCalledTimes(1); + expect(next).toHaveBeenCalledWith(); + expect(observedEvents).toEqual([]); + expect(res.headers["Retry-After"]).toBeUndefined(); + }); + + it("rejects with 503 and downtime metadata during active maintenance", async () => { + const start = new Date(Date.now() - 60_000).toISOString(); + const end = new Date(Date.now() + 30 * 60_000).toISOString(); + + mockMaintenanceStatus({ + is_maintenance_active: true, + maintenance_details: { + end_datetime: end, + estimated_time_remaining_seconds: 1800, + message: "Scheduled database maintenance", + start_datetime: start, + title: "Database upgrade" + } + }); + + const res = buildResponse(); + const next: NextFunction = mock(() => undefined) as unknown as NextFunction; + + await rejectDuringActiveMaintenance("quote_create")( + { + body: { + apiKey: "pk_live_1234567890abcdef", + paymentMethod: "pix", + quoteId: "quote-1", + rampType: "BUY" + }, + requestId: "request-1", + requestStartedAt: Date.now() - 50 + } as Request, + res, + next + ); + + expect(next).toHaveBeenCalledTimes(1); + const error = (next as ReturnType).mock.calls[0][0] as APIError; + + expect(error).toBeInstanceOf(APIError); + expect(error.status).toBe(503); + expect(error.type).toBe("https://api.vortexfinance.co/problems/maintenance-window"); + expect(error.message).toContain("scheduled maintenance"); + expect(error.message).toContain("Database upgrade"); + expect(error.message).toContain("Scheduled database maintenance"); + expect(error.errors).toEqual([ + { + detail: "Scheduled database maintenance", + maintenance_end: end, + maintenance_start: start, + operations: ["quote_create", "quote_create_best", "ramp_register", "ramp_update", "ramp_start"], + retry_after_seconds: expect.any(Number), + title: "Database upgrade", + type: "https://api.vortexfinance.co/problems/maintenance-window" + } + ]); + expect(res.headers["Retry-After"]).toBe(new Date(end).toUTCString()); + expect(res.headers["Cache-Control"]).toBe("no-store"); + expect(observedEvents).toEqual([ + expect.objectContaining({ + apiKeyPrefix: "pk_live_", + errorType: "service_unavailable", + httpStatus: 503, + metadata: { + maintenance_end: end, + maintenance_start: start, + maintenance_title: "Database upgrade" + }, + operation: "quote_create", + paymentMethod: "pix", + quoteId: "quote-1", + rampType: "BUY", + requestId: "request-1", + status: "failure" + }) + ]); + }); + + it("rejects every guarded quote and ramp route before controllers run", async () => { + const start = new Date(Date.now() - 60_000).toISOString(); + const end = new Date(Date.now() + 30 * 60_000).toISOString(); + + mockMaintenanceStatus({ + is_maintenance_active: true, + maintenance_details: { + end_datetime: end, + estimated_time_remaining_seconds: 1800, + message: "Scheduled database maintenance", + start_datetime: start, + title: "Database upgrade" + } + }); + + const guardedPaths = ["/v1/quotes", "/v1/quotes/best", "/v1/ramp/register", "/v1/ramp/update", "/v1/ramp/start"]; + + for (const path of guardedPaths) { + const response = await fetchFromGuardedRoutes(path); + const body = (await response.json()) as MaintenanceHttpResponse; + + expect(response.status).toBe(httpStatus.SERVICE_UNAVAILABLE); + expect(response.headers.get("Retry-After")).toBe(new Date(end).toUTCString()); + expect(response.headers.get("Cache-Control")).toBe("no-store"); + expect(body.code).toBe(httpStatus.SERVICE_UNAVAILABLE); + expect(body.statusCode).toBe(httpStatus.SERVICE_UNAVAILABLE); + expect(body.type).toBe("https://api.vortexfinance.co/problems/maintenance-window"); + expect(body.errors?.[0]).toEqual( + expect.objectContaining({ + maintenance_end: end, + maintenance_start: start, + operations: ["quote_create", "quote_create_best", "ramp_register", "ramp_update", "ramp_start"], + retry_after_seconds: expect.any(Number), + type: "https://api.vortexfinance.co/problems/maintenance-window" + }) + ); + } + + expect(controllerCalls).toEqual([]); + }); +}); diff --git a/apps/api/src/api/middlewares/maintenanceGuard.ts b/apps/api/src/api/middlewares/maintenanceGuard.ts new file mode 100644 index 000000000..3c1d8422d --- /dev/null +++ b/apps/api/src/api/middlewares/maintenanceGuard.ts @@ -0,0 +1,117 @@ +import type { NextFunction, Request, RequestHandler, Response } from "express"; +import httpStatus from "http-status"; +import { APIError } from "../errors/api-error"; +import { observeApiClientEvent } from "../observability/apiClientEvent.service"; +import { classifyApiClientError, getErrorMessage } from "../observability/errorClassifier"; +import { getRequestDurationMs } from "../observability/requestContext"; +import type { ApiClientOperation } from "../observability/types"; +import { MaintenanceService } from "../services/maintenance.service"; + +const MAINTENANCE_PROBLEM_TYPE = "https://api.vortexfinance.co/problems/maintenance-window"; +const BLOCKED_OPERATIONS = [ + "quote_create", + "quote_create_best", + "ramp_register", + "ramp_update", + "ramp_start" +] as const satisfies readonly ApiClientOperation[]; +type BlockedMaintenanceOperation = (typeof BLOCKED_OPERATIONS)[number]; + +export function rejectDuringActiveMaintenance(operation: BlockedMaintenanceOperation): RequestHandler { + return async (req: Request, res: Response, next: NextFunction): Promise => { + try { + const status = await MaintenanceService.getInstance().getMaintenanceStatus(); + + if (!status.is_maintenance_active || !status.maintenance_details) { + next(); + return; + } + + const maintenanceEnd = new Date(status.maintenance_details.end_datetime); + const retryAfterSeconds = Math.max(0, Math.ceil((maintenanceEnd.getTime() - Date.now()) / 1000)); + + res.setHeader("Retry-After", maintenanceEnd.toUTCString()); + res.setHeader("Cache-Control", "no-store"); + const message = `Vortex services are temporarily unavailable during scheduled maintenance: ${status.maintenance_details.title} - ${status.maintenance_details.message}`; + + const error = new APIError({ + errors: [ + { + detail: status.maintenance_details.message, + maintenance_end: status.maintenance_details.end_datetime, + maintenance_start: status.maintenance_details.start_datetime, + operations: BLOCKED_OPERATIONS, + retry_after_seconds: retryAfterSeconds, + title: status.maintenance_details.title, + type: MAINTENANCE_PROBLEM_TYPE + } + ], + message, + status: httpStatus.SERVICE_UNAVAILABLE, + type: MAINTENANCE_PROBLEM_TYPE + }); + + observeMaintenanceDenial(req, operation, error, status.maintenance_details); + next(error); + } catch (error) { + next(error); + } + }; +} + +function observeMaintenanceDenial( + req: Request, + operation: BlockedMaintenanceOperation, + error: APIError, + maintenanceDetails: { + end_datetime: string; + message: string; + start_datetime: string; + title: string; + } +): void { + const body = getRequestBody(req); + const publicApiKey = getString(body.apiKey) || req.validatedPublicKey?.apiKey; + const secretApiKey = getHeaderValue(req.headers?.["x-api-key"]); + + observeApiClientEvent({ + apiKeyPrefix: getSafeApiKeyPrefix(secretApiKey || publicApiKey), + durationMs: getRequestDurationMs(req), + errorMessage: getErrorMessage(error), + errorType: classifyApiClientError(error, httpStatus.SERVICE_UNAVAILABLE), + httpStatus: httpStatus.SERVICE_UNAVAILABLE, + metadata: { + maintenance_end: maintenanceDetails.end_datetime, + maintenance_start: maintenanceDetails.start_datetime, + maintenance_title: maintenanceDetails.title + }, + operation, + partnerId: req.authenticatedPartner?.id || getString(body.partnerId), + partnerName: req.authenticatedPartner?.name || req.validatedPublicKey?.partnerName || null, + paymentMethod: getString(body.paymentMethod), + quoteId: getString(body.quoteId), + rampId: getString(body.rampId), + rampType: getString(body.rampType), + requestId: req.requestId, + status: "failure", + userId: req.userId || null + }); +} + +function getRequestBody(req: Request): Record { + return typeof req.body === "object" && req.body !== null ? (req.body as Record) : {}; +} + +function getString(value: unknown): string | null { + return typeof value === "string" ? value : null; +} + +function getHeaderValue(value: string | string[] | undefined): string | null { + if (Array.isArray(value)) return value[0] || null; + return value || null; +} + +function getSafeApiKeyPrefix(apiKey: string | null | undefined): string | null { + if (!apiKey?.startsWith("pk_") && !apiKey?.startsWith("sk_")) return null; + return apiKey.slice(0, 8); +} diff --git a/apps/api/src/api/middlewares/metricsDashboardAuth.ts b/apps/api/src/api/middlewares/metricsDashboardAuth.ts new file mode 100644 index 000000000..188e33822 --- /dev/null +++ b/apps/api/src/api/middlewares/metricsDashboardAuth.ts @@ -0,0 +1,90 @@ +import crypto from "crypto"; +import { NextFunction, Request, Response } from "express"; +import httpStatus from "http-status"; +import logger from "../../config/logger"; +import { config } from "../../config/vars"; + +/** + * Authenticates internal observability dashboard requests with a dedicated bearer token. + */ +export function metricsDashboardAuth(req: Request, res: Response, next: NextFunction): void { + try { + const authHeader = req.headers.authorization; + + if (!authHeader) { + logger.warn("Metrics dashboard auth attempt without Authorization header", { + ip: req.ip, + path: req.path + }); + res.status(httpStatus.UNAUTHORIZED).json({ + error: { + code: "METRICS_DASHBOARD_AUTH_REQUIRED", + message: "Metrics dashboard authentication required. Provide Authorization header with Bearer token.", + status: httpStatus.UNAUTHORIZED + } + }); + return; + } + + const parts = authHeader.split(" "); + if (parts.length !== 2 || parts[0] !== "Bearer") { + res.status(httpStatus.UNAUTHORIZED).json({ + error: { + code: "INVALID_AUTH_FORMAT", + message: "Invalid authorization format. Use: Authorization: Bearer ", + status: httpStatus.UNAUTHORIZED + } + }); + return; + } + + if (!config.metricsDashboardSecret) { + logger.error("METRICS_DASHBOARD_SECRET not configured in environment variables"); + res.status(httpStatus.INTERNAL_SERVER_ERROR).json({ + error: { + code: "METRICS_DASHBOARD_AUTH_NOT_CONFIGURED", + message: "Metrics dashboard authentication is not properly configured", + status: httpStatus.INTERNAL_SERVER_ERROR + } + }); + return; + } + + if (!safeCompare(parts[1], config.metricsDashboardSecret)) { + logger.warn("Failed metrics dashboard auth attempt", { + ip: req.ip, + path: req.path + }); + res.status(httpStatus.FORBIDDEN).json({ + error: { + code: "INVALID_METRICS_DASHBOARD_TOKEN", + message: "Invalid metrics dashboard token", + status: httpStatus.FORBIDDEN + } + }); + return; + } + + next(); + } catch (error) { + logger.error("Error in metrics dashboard authentication:", error); + res.status(httpStatus.INTERNAL_SERVER_ERROR).json({ + error: { + code: "METRICS_DASHBOARD_AUTH_ERROR", + message: "An error occurred during metrics dashboard authentication", + status: httpStatus.INTERNAL_SERVER_ERROR + } + }); + } +} + +function safeCompare(a: string, b: string): boolean { + const bufA = Buffer.from(a); + const bufB = Buffer.from(b); + if (bufA.length !== bufB.length) { + const dummyBuf = Buffer.alloc(bufA.length); + crypto.timingSafeEqual(bufA, dummyBuf); + return false; + } + return crypto.timingSafeEqual(bufA, bufB); +} diff --git a/apps/api/src/api/middlewares/ownershipAuth.ts b/apps/api/src/api/middlewares/ownershipAuth.ts index e4fc5ff27..1d84bbfe4 100644 --- a/apps/api/src/api/middlewares/ownershipAuth.ts +++ b/apps/api/src/api/middlewares/ownershipAuth.ts @@ -1,11 +1,24 @@ -import { Request } from "express"; import httpStatus from "http-status"; import Partner from "../../models/partner.model"; import QuoteTicket from "../../models/quoteTicket.model"; import RampState from "../../models/rampState.model"; import { APIError } from "../errors/api-error"; +import { buildApiClientRequestMetadata, observeApiClientEvent } from "../observability/apiClientEvent.service"; +import { getRequestDurationMs } from "../observability/requestContext"; import type { AuthenticatedPartner } from "./apiKeyAuth.helpers"; +interface OwnershipRequest { + authenticatedPartner?: AuthenticatedPartner; + body?: unknown; + method?: string; + params?: unknown; + path?: string; + query?: unknown; + requestId?: string; + requestStartedAt?: number; + userId?: string; +} + async function ownsPartnerRecord(authenticatedPartner: AuthenticatedPartner, partnerId: string | null): Promise { if (!partnerId) { return false; @@ -23,21 +36,21 @@ async function ownsPartnerRecord(authenticatedPartner: AuthenticatedPartner, par * or req.body.rampId. Partner principals must match the quote's partnerId; * user principals must match the ramp state's userId. */ -export async function assertRampOwnership( - req: Pick, - rampId: string -): Promise { +export async function assertRampOwnership(req: OwnershipRequest, rampId: string): Promise { const ramp = await RampState.findByPk(rampId); if (!ramp) { + recordOwnershipFailure(req, httpStatus.NOT_FOUND, "ramp_not_found", { rampId }); throw new APIError({ message: "Ramp not found", status: httpStatus.NOT_FOUND }); } if (req.authenticatedPartner) { const quote = await QuoteTicket.findByPk(ramp.quoteId); if (!quote) { + recordOwnershipFailure(req, httpStatus.NOT_FOUND, "quote_not_found", { quoteId: ramp.quoteId, rampId }); throw new APIError({ message: "Associated quote not found", status: httpStatus.NOT_FOUND }); } if (!(await ownsPartnerRecord(req.authenticatedPartner, quote.partnerId))) { + recordOwnershipFailure(req, httpStatus.FORBIDDEN, "ownership_denied", { quoteId: ramp.quoteId, rampId }); throw new APIError({ message: "Authenticated partner does not own this ramp", status: httpStatus.FORBIDDEN @@ -48,6 +61,7 @@ export async function assertRampOwnership( if (req.userId) { if (ramp.userId !== req.userId) { + recordOwnershipFailure(req, httpStatus.FORBIDDEN, "ownership_denied", { quoteId: ramp.quoteId, rampId }); throw new APIError({ message: "Authenticated user does not own this ramp", status: httpStatus.FORBIDDEN @@ -62,6 +76,7 @@ export async function assertRampOwnership( if (ramp.userId === null) { const quote = await QuoteTicket.findByPk(ramp.quoteId); if (!quote) { + recordOwnershipFailure(req, httpStatus.NOT_FOUND, "quote_not_found", { quoteId: ramp.quoteId, rampId }); throw new APIError({ message: "Associated quote not found", status: httpStatus.NOT_FOUND }); } if (quote.partnerId === null) { @@ -69,23 +84,23 @@ export async function assertRampOwnership( } } + recordOwnershipFailure(req, httpStatus.UNAUTHORIZED, "ownership_denied", { quoteId: ramp.quoteId, rampId }); throw new APIError({ message: "Authentication required", status: httpStatus.UNAUTHORIZED }); } /** * Ownership check for flows that reference a quote before a ramp exists. */ -export async function assertQuoteOwnership( - req: Pick, - quoteId: string -): Promise { +export async function assertQuoteOwnership(req: OwnershipRequest, quoteId: string): Promise { const quote = await QuoteTicket.findByPk(quoteId); if (!quote) { + recordOwnershipFailure(req, httpStatus.NOT_FOUND, "quote_not_found", { quoteId }); throw new APIError({ message: "Quote not found", status: httpStatus.NOT_FOUND }); } if (req.authenticatedPartner) { if (!(await ownsPartnerRecord(req.authenticatedPartner, quote.partnerId))) { + recordOwnershipFailure(req, httpStatus.FORBIDDEN, "ownership_denied", { quoteId }); throw new APIError({ message: "Authenticated partner does not own this quote", status: httpStatus.FORBIDDEN @@ -96,12 +111,14 @@ export async function assertQuoteOwnership( if (req.userId) { if (quote.partnerId !== null) { + recordOwnershipFailure(req, httpStatus.FORBIDDEN, "ownership_denied", { quoteId }); throw new APIError({ message: "This quote belongs to a partner; user authentication is not sufficient", status: httpStatus.FORBIDDEN }); } if (quote.userId !== null && quote.userId !== req.userId) { + recordOwnershipFailure(req, httpStatus.FORBIDDEN, "ownership_denied", { quoteId }); throw new APIError({ message: "Authenticated user does not own this quote", status: httpStatus.FORBIDDEN @@ -117,5 +134,27 @@ export async function assertQuoteOwnership( return; } + recordOwnershipFailure(req, httpStatus.UNAUTHORIZED, "ownership_denied", { quoteId }); throw new APIError({ message: "Authentication required", status: httpStatus.UNAUTHORIZED }); } + +function recordOwnershipFailure( + req: OwnershipRequest, + status: number, + errorType: "ownership_denied" | "quote_not_found" | "ramp_not_found", + context: { quoteId?: string | null; rampId?: string | null } +): void { + observeApiClientEvent({ + ...context, + durationMs: getRequestDurationMs(req), + errorType, + httpStatus: status, + metadata: buildApiClientRequestMetadata(req, { bodyKeys: ["quoteId", "rampId"], paramKeys: ["id"] }), + operation: "auth_ownership", + partnerId: req.authenticatedPartner?.id || null, + partnerName: req.authenticatedPartner?.name || null, + requestId: req.requestId, + status: "failure", + userId: req.userId || null + }); +} diff --git a/apps/api/src/api/middlewares/publicKeyAuth.ts b/apps/api/src/api/middlewares/publicKeyAuth.ts index bb581f391..9b66e542b 100644 --- a/apps/api/src/api/middlewares/publicKeyAuth.ts +++ b/apps/api/src/api/middlewares/publicKeyAuth.ts @@ -1,9 +1,16 @@ import { NextFunction, Request, Response } from "express"; import logger from "../../config/logger"; +import { + buildApiClientRequestMetadata, + getSafeApiKeyPrefix, + observeApiClientEvent +} from "../observability/apiClientEvent.service"; +import { getRequestDurationMs } from "../observability/requestContext"; import { getKeyType, isValidApiKeyFormat, validatePublicApiKey } from "./apiKeyAuth.helpers"; // Extend Express Request type to include validated public key declare global { + // biome-ignore lint/style/noNamespace: Express request augmentation follows the existing backend pattern. namespace Express { interface Request { validatedPublicKey?: { @@ -33,6 +40,7 @@ export function validatePublicKey() { // Validate API key format if (!isValidApiKeyFormat(apiKey)) { + recordPublicKeyFailure(req, 400, getSafeApiKeyPrefix(apiKey)); return res.status(400).json({ error: { code: "INVALID_API_KEY_FORMAT", @@ -45,6 +53,7 @@ export function validatePublicKey() { // Check if it's a public key const keyType = getKeyType(apiKey); if (keyType !== "public") { + recordPublicKeyFailure(req, 400, getSafeApiKeyPrefix(apiKey)); return res.status(400).json({ error: { code: "INVALID_KEY_TYPE", @@ -58,6 +67,7 @@ export function validatePublicKey() { const partnerName = await validatePublicApiKey(apiKey); if (!partnerName) { + recordPublicKeyFailure(req, 401, getSafeApiKeyPrefix(apiKey)); return res.status(401).json({ error: { code: "INVALID_PUBLIC_KEY", @@ -80,3 +90,17 @@ export function validatePublicKey() { } }; } + +function recordPublicKeyFailure(req: Request, httpStatus: number, apiKeyPrefix: string | null): void { + observeApiClientEvent({ + apiKeyPrefix, + durationMs: getRequestDurationMs(req), + errorType: "auth_invalid_public_key", + httpStatus, + metadata: buildApiClientRequestMetadata(req), + operation: "auth_public_key", + requestId: req.requestId, + status: "failure", + userId: req.userId || null + }); +} diff --git a/apps/api/src/api/middlewares/validators.test.ts b/apps/api/src/api/middlewares/validators.test.ts new file mode 100644 index 000000000..d8c647b2b --- /dev/null +++ b/apps/api/src/api/middlewares/validators.test.ts @@ -0,0 +1,141 @@ +import { Networks, QuoteError, RampDirection } from "@vortexfi/shared"; +import { describe, expect, it, mock } from "bun:test"; +import type { NextFunction, Request, Response } from "express"; +import httpStatus from "http-status"; +import { APIError } from "../errors/api-error"; +import { validateCreateBestQuoteInput, validateKycSubmission } from "./validators"; + +function buildRes() { + const res: Partial & { statusCode?: number; body?: unknown } = {}; + res.status = mock((code: number) => { + res.statusCode = code; + return res as Response; + }) as Response["status"]; + res.json = mock((payload: unknown) => { + res.body = payload; + return res as Response; + }) as Response["json"]; + return res as Response & { statusCode?: number; body?: unknown }; +} + +function runValidator(body: Record) { + const req = { body } as unknown as Request; + const res = buildRes(); + const next: NextFunction = mock(() => undefined) as unknown as NextFunction; + validateCreateBestQuoteInput(req, res, next); + return { next, res }; +} + +const baseBody = { + inputAmount: "100", + inputCurrency: "BRL", + outputCurrency: "USDC", + rampType: RampDirection.BUY, + from: "pix" +}; + +describe("validateCreateBestQuoteInput - networks whitelist", () => { + it("passes when networks is omitted (preserves existing behavior)", () => { + const { next, res } = runValidator({ ...baseBody }); + expect(next).toHaveBeenCalledTimes(1); + expect(res.statusCode).toBeUndefined(); + }); + + it("passes when networks is a valid array of Networks values", () => { + const { next, res } = runValidator({ ...baseBody, networks: [Networks.Base, Networks.Polygon] }); + expect(next).toHaveBeenCalledTimes(1); + expect(res.statusCode).toBeUndefined(); + }); + + it("normalizes case-insensitive networks entries to canonical Networks values", () => { + const body: Record = { ...baseBody, networks: ["BASE", "Polygon", "BASE-SEPOLIA", "polygonamoy"] }; + const req = { body } as unknown as Request; + const res = buildRes(); + const nextMock = mock((_error?: unknown) => undefined); + const next = nextMock as unknown as NextFunction; + validateCreateBestQuoteInput(req, res, next); + expect(next).toHaveBeenCalledTimes(1); + expect(res.statusCode).toBeUndefined(); + expect(body.networks).toEqual([Networks.Base, Networks.Polygon, Networks.BaseSepolia, Networks.PolygonAmoy]); + }); + + it("passes when networks is an empty array (treated as omitted)", () => { + const { next, res } = runValidator({ ...baseBody, networks: [] }); + expect(next).toHaveBeenCalledTimes(1); + expect(res.statusCode).toBeUndefined(); + }); + + it("rejects with 400 when networks contains an unknown identifier", () => { + const { next, res } = runValidator({ ...baseBody, networks: ["base", "not-a-real-chain"] }); + expect(next).not.toHaveBeenCalled(); + expect(res.statusCode).toBe(httpStatus.BAD_REQUEST); + expect(res.body).toEqual({ message: QuoteError.InvalidNetworks }); + }); + + it("rejects with 400 when networks is not an array", () => { + const { next, res } = runValidator({ ...baseBody, networks: "base" }); + expect(next).not.toHaveBeenCalled(); + expect(res.statusCode).toBe(httpStatus.BAD_REQUEST); + expect(res.body).toEqual({ message: QuoteError.InvalidNetworks }); + }); + + it("rejects with 400 when networks contains a non-string entry", () => { + const { next, res } = runValidator({ ...baseBody, networks: [Networks.Base, 42] }); + expect(next).not.toHaveBeenCalled(); + expect(res.statusCode).toBe(httpStatus.BAD_REQUEST); + expect(res.body).toEqual({ message: QuoteError.InvalidNetworks }); + }); + + it("rejects with 400 when required fields are missing even if networks is valid", () => { + const { next, res } = runValidator({ rampType: RampDirection.BUY, networks: [Networks.Base] }); + expect(next).not.toHaveBeenCalled(); + expect(res.statusCode).toBe(httpStatus.BAD_REQUEST); + expect(res.body).toEqual({ message: QuoteError.MissingRequiredFields }); + }); +}); + +describe("validateKycSubmission", () => { + it("forwards structured API errors for invalid Argentina submissions", () => { + const req = { + body: { + country: "AR", + pep: false, + phoneNumber: "+5511999999999" + } + } as unknown as Request; + const res = buildRes(); + const nextMock = mock((_error?: unknown) => undefined); + const next = nextMock as unknown as NextFunction; + + validateKycSubmission(req, res, next); + + expect(res.statusCode).toBeUndefined(); + expect(next).toHaveBeenCalledTimes(1); + const error = nextMock.mock.calls[0][0]; + expect(error).toBeInstanceOf(APIError); + expect((error as APIError).status).toBe(httpStatus.BAD_REQUEST); + expect((error as APIError).message).toBe("Phone number must use Argentina country code (+54)"); + expect((error as APIError).errors).toEqual([{ message: "Phone number must use Argentina country code (+54)" }]); + }); + + it("accepts valid Argentina-specific fields", () => { + const req = { + body: { + country: "AR", + cuit: "20123456789", + nationalities: ["AR"], + pep: false, + phoneNumber: "+5491112345678" + } + } as unknown as Request; + const res = buildRes(); + const nextMock = mock((_error?: unknown) => undefined); + const next = nextMock as unknown as NextFunction; + + validateKycSubmission(req, res, next); + + expect(next).toHaveBeenCalledTimes(1); + expect(nextMock.mock.calls[0]?.[0]).toBeUndefined(); + expect(res.statusCode).toBeUndefined(); + }); +}); diff --git a/apps/api/src/api/middlewares/validators.ts b/apps/api/src/api/middlewares/validators.ts index 303090653..77885dfe0 100644 --- a/apps/api/src/api/middlewares/validators.ts +++ b/apps/api/src/api/middlewares/validators.ts @@ -1,31 +1,38 @@ import { AveniaKYCDataUploadRequest, CreateAveniaSubaccountRequest, + CreateBestQuoteRequest, CreateQuoteRequest, Currency, GetWidgetUrlLocked, GetWidgetUrlRefresh, + getCaseSensitiveNetwork, isSupportedFiatCurrency, isValidAveniaAccountType, isValidCurrencyForDirection, isValidDirection, isValidKYCDocType, isValidPriceProvider, + Networks, PriceProvider, QuoteError, RampDirection, + SubmitKycInformationRequest, TokenConfig, VALID_CRYPTO_CURRENCIES, VALID_FIAT_CURRENCIES, VALID_PROVIDERS } from "@vortexfi/shared"; -import { RequestHandler, Response } from "express"; +import { Request, RequestHandler, Response } from "express"; import httpStatus from "http-status"; import logger from "../../config/logger"; import { CONTACT_SHEET_HEADER_VALUES } from "../controllers/contact.controller"; import { EMAIL_SHEET_HEADER_VALUES } from "../controllers/email.controller"; import { RATING_SHEET_HEADER_VALUES } from "../controllers/rating.controller"; import { FLOW_HEADERS } from "../controllers/storage.controller"; +import { APIError } from "../errors/api-error"; +import { buildApiClientRequestMetadata, observeApiClientEvent } from "../observability/apiClientEvent.service"; +import { getRequestDurationMs } from "../observability/requestContext"; interface CreationBody { accountId: string; @@ -54,12 +61,6 @@ interface SwapBody { token?: keyof TokenConfig; } -interface Sep10Body { - challengeXDR: string; - outToken: string; - clientPublicKey: string; -} - interface SiweCreateBody { walletAddress: string; } @@ -316,26 +317,6 @@ export const validatePostSwapSubsidizationInput: RequestHandler = (req, res, nex next(); }; -export const validateSep10Input: RequestHandler = (req, res, next) => { - const { challengeXDR, outToken, clientPublicKey } = req.body as Sep10Body; - - if (!challengeXDR) { - res.status(httpStatus.BAD_REQUEST).json({ error: "Missing Anchor challenge: challengeXDR" }); - return; - } - - if (!outToken) { - res.status(httpStatus.BAD_REQUEST).json({ error: "Missing offramp token identifier: outToken" }); - return; - } - - if (!clientPublicKey) { - res.status(httpStatus.BAD_REQUEST).json({ error: "Missing Stellar ephemeral public key: clientPublicKey" }); - return; - } - next(); -}; - export const validateSiweCreate: RequestHandler = (req, res, next) => { const { walletAddress } = req.body as SiweCreateBody; @@ -403,55 +384,83 @@ export const validateCreateQuoteInput: RequestHandler> = ( - req, - res, - next -) => { +export const validateCreateBestQuoteInput: RequestHandler = (req, res, next) => { if (req.body) { - req.body.inputCurrency = normalizeAxlUsdcCurrency(req.body.inputCurrency) as CreateQuoteRequest["inputCurrency"]; - req.body.outputCurrency = normalizeAxlUsdcCurrency(req.body.outputCurrency) as CreateQuoteRequest["outputCurrency"]; + req.body.inputCurrency = normalizeAxlUsdcCurrency(req.body.inputCurrency) as CreateBestQuoteRequest["inputCurrency"]; + req.body.outputCurrency = normalizeAxlUsdcCurrency(req.body.outputCurrency) as CreateBestQuoteRequest["outputCurrency"]; } - const { rampType, from, to, inputAmount, inputCurrency, outputCurrency } = req.body; + const { rampType, from, to, inputAmount, inputCurrency, outputCurrency, networks } = req.body; if (!rampType || !inputAmount || !inputCurrency || !outputCurrency) { + observeQuoteValidationFailure(req, "quote_create_best"); res.status(httpStatus.BAD_REQUEST).json({ message: QuoteError.MissingRequiredFields }); return; } if (rampType !== RampDirection.BUY && rampType !== RampDirection.SELL) { + observeQuoteValidationFailure(req, "quote_create_best"); res.status(httpStatus.BAD_REQUEST).json({ message: QuoteError.InvalidRampType }); return; } if (rampType === RampDirection.BUY && !from) { + observeQuoteValidationFailure(req, "quote_create_best"); res.status(httpStatus.BAD_REQUEST).json({ message: QuoteError.MissingFromField }); return; } if (rampType === RampDirection.SELL && !to) { + observeQuoteValidationFailure(req, "quote_create_best"); res.status(httpStatus.BAD_REQUEST).json({ message: QuoteError.MissingToField }); return; } + if (networks !== undefined) { + if (!Array.isArray(networks)) { + observeQuoteValidationFailure(req, "quote_create_best"); + res.status(httpStatus.BAD_REQUEST).json({ message: QuoteError.InvalidNetworks }); + return; + } + const normalized: Networks[] = []; + for (const entry of networks) { + if (typeof entry !== "string") { + observeQuoteValidationFailure(req, "quote_create_best"); + res.status(httpStatus.BAD_REQUEST).json({ message: QuoteError.InvalidNetworks }); + return; + } + const canonical = getCaseSensitiveNetwork(entry); + if (!canonical) { + observeQuoteValidationFailure(req, "quote_create_best"); + res.status(httpStatus.BAD_REQUEST).json({ message: QuoteError.InvalidNetworks }); + return; + } + normalized.push(canonical); + } + req.body.networks = normalized; + } + if (!validateSupportedFiatCurrency(rampType, inputCurrency, outputCurrency, res)) { + observeQuoteValidationFailure(req, "quote_create_best"); return; } @@ -464,6 +473,40 @@ const normalizeAxlUsdcCurrency = (value: unknown): unknown => { return value.toLowerCase() === "axlusdc" ? "USDC.axl" : value; }; +function observeQuoteValidationFailure( + req: Request, + operation: "quote_create" | "quote_create_best" +): void { + observeApiClientEvent({ + durationMs: getRequestDurationMs(req), + errorType: "validation_error", + httpStatus: httpStatus.BAD_REQUEST, + metadata: buildQuoteValidationRequestMetadata(req, operation), + operation, + requestId: req.requestId, + status: "failure", + userId: req.userId || null + }); +} + +function buildQuoteValidationRequestMetadata( + req: Request, + operation: "quote_create" | "quote_create_best" +): Record { + return buildApiClientRequestMetadata(req, { + bodyKeys: [ + ...(operation === "quote_create_best" ? ["countryCode", "networks"] : []), + "from", + "inputAmount", + "inputCurrency", + "outputCurrency", + "partnerId", + "rampType", + "to" + ] + }); +} + export const validateGetWidgetUrlInput: RequestHandler = ( req, res, @@ -483,6 +526,40 @@ export const validateGetWidgetUrlInput: RequestHandler string | null> = { + AR: ({ phoneNumber, cuit, nationalities, pep }) => { + if (!phoneNumber) return "Phone number is required for Argentina"; + if (!phoneNumber.startsWith("+54")) return "Phone number must use Argentina country code (+54)"; + if (cuit && !/^\d{11}$/.test(cuit)) return "CUIT must be exactly 11 digits"; + if (nationalities && !nationalities.every(n => /^[A-Z]{2}$/.test(n))) return "Nationalities must use alpha-2 country codes"; + if (typeof pep !== "boolean") return "PEP declaration is required for Argentina"; + return null; + } +}; + +export const validateKycSubmission: RequestHandler = (req, res, next) => { + const body = req.body as SubmitKycInformationRequest; + const validator = countryValidators[body.country]; + + if (!validator) { + return next(); + } + + const error = validator(body); + if (error) { + next( + new APIError({ + errors: [{ message: error }], + message: error, + status: httpStatus.BAD_REQUEST + }) + ); + return; + } + + next(); +}; + export const validateStartKyc2: RequestHandler = (req, res, next) => { const { documentType } = req.body as AveniaKYCDataUploadRequest; diff --git a/apps/api/src/api/observability/apiClientEvent.service.test.ts b/apps/api/src/api/observability/apiClientEvent.service.test.ts new file mode 100644 index 000000000..1d45d779d --- /dev/null +++ b/apps/api/src/api/observability/apiClientEvent.service.test.ts @@ -0,0 +1,174 @@ +import { afterEach, describe, expect, it, mock } from "bun:test"; +import ApiClientEvent from "../../models/apiClientEvent.model"; +import { + buildApiClientRequestMetadata, + getSafeApiKeyPrefix, + recordApiClientEventSafe, + sanitizeApiClientEvent +} from "./apiClientEvent.service"; + +describe("sanitizeApiClientEvent", () => { + it("removes sensitive metadata and replaces raw error messages", () => { + const sanitized = sanitizeApiClientEvent({ + apiKeyPrefix: "pk_live_1234567890", + errorMessage: "Invalid EVM address format: 0x1234567890abcdef with taxId 12345678900", + errorType: "invalid_ephemerals", + metadata: { + apiKey: "pk_live_secret", + endpoint: "/v1/ramp/start", + nested: { unsafe: true }, + taxId: "12345678900" + }, + operation: "ramp_start", + partnerName: "p".repeat(150), + status: "failure" + }); + + expect(sanitized.apiKeyPrefix).toHaveLength(16); + expect(sanitized.errorMessage).toBe("Ephemeral account validation failed."); + expect(sanitized.errorMessage).not.toContain("0x1234567890abcdef"); + expect(sanitized.errorMessage).not.toContain("12345678900"); + expect(sanitized.errorType).toBe("invalid_ephemerals"); + expect(sanitized.metadata).toEqual({ endpoint: "/v1/ramp/start" }); + expect(sanitized.partnerName).toHaveLength(100); + }); + + it("keeps sanitized request summaries while stripping raw request details", () => { + const sanitized = sanitizeApiClientEvent({ + errorType: "validation_error", + metadata: { + authorization: "Bearer token", + requestBodyInputAmount: "100\n200", + requestBodyNetworksCount: 2, + requestMethod: "POST", + rawBody: { inputAmount: "100" } + }, + operation: "quote_create_best", + status: "failure" + }); + + expect(sanitized.metadata).toEqual({ + requestBodyInputAmount: "100 200", + requestBodyNetworksCount: 2, + requestMethod: "POST" + }); + }); + + it("defaults successful events to the none error type", () => { + const sanitized = sanitizeApiClientEvent({ operation: "quote_get", status: "success" }); + + expect(sanitized.errorType).toBe("none"); + expect(sanitized.errorMessage).toBeNull(); + }); + + it("uses a distinct safe message for missing partner records", () => { + const sanitized = sanitizeApiClientEvent({ + errorMessage: "Partner 123e4567-e89b-12d3-a456-426614174000 was not found", + errorType: "auth_partner_not_found", + operation: "auth_api_key", + status: "failure" + }); + + expect(sanitized.errorType).toBe("auth_partner_not_found"); + expect(sanitized.errorMessage).toBe("Requested partner was not found."); + expect(sanitized.errorMessage).not.toContain("123e4567-e89b-12d3-a456-426614174000"); + }); +}); + +describe("buildApiClientRequestMetadata", () => { + it("builds a scalar request summary from allowlisted request fields", () => { + const metadata = buildApiClientRequestMetadata( + { + body: { + additionalData: { taxId: "12345678900" }, + apiKey: "pk_live_secret", + inputAmount: "100", + networks: ["Polygon", "Base"] + }, + method: "POST", + params: { id: "ramp-1" }, + path: "/v1/quotes/best", + query: { showUnsignedTxs: "true" } + }, + { bodyKeys: ["apiKey", "inputAmount", "networks", "additionalData"], paramKeys: ["id"], queryKeys: ["showUnsignedTxs"] } + ); + + expect(metadata).toEqual({ + hasRequestBodyAdditionalData: true, + requestBodyInputAmount: "100", + requestBodyNetworksCount: 2, + requestMethod: "POST", + requestParamId: "ramp-1", + requestPath: "/v1/quotes/best", + requestQueryShowUnsignedTxs: "true" + }); + }); + + it("templates route param values out of request paths", () => { + const metadata = buildApiClientRequestMetadata( + { + method: "GET", + params: { walletAddress: "0xabc123" }, + path: "/v1/ramp/history/0xabc123" + }, + { paramKeys: [] } + ); + + expect(metadata).toEqual({ + requestMethod: "GET", + requestPath: "/v1/ramp/history/:walletAddress" + }); + }); + + it("records only counts or presence flags for allowlisted sensitive payload fields", () => { + const metadata = buildApiClientRequestMetadata( + { + body: { + additionalData: { receiverTaxId: "12345678900" }, + presignedTxs: ["signed-payload"], + signingAccounts: ["wallet-address-1", "wallet-address-2"], + taxId: "12345678900" + }, + method: "POST", + path: "/v1/ramp/register" + }, + { bodyKeys: ["additionalData", "presignedTxs", "signingAccounts", "taxId"] } + ); + + expect(metadata).toEqual({ + hasRequestBodyAdditionalData: true, + requestBodyPresignedTxsCount: 1, + requestBodySigningAccountsCount: 2, + requestMethod: "POST", + requestPath: "/v1/ramp/register" + }); + }); +}); + +describe("getSafeApiKeyPrefix", () => { + it("keeps enough key-specific characters to identify an API key", () => { + expect(getSafeApiKeyPrefix("pk_live_1234567890abcdef")).toBe("pk_live_12345678"); + expect(getSafeApiKeyPrefix("sk_live_abcdef1234567890", ["sk_"])).toBe("sk_live_abcdef12"); + }); + + it("rejects disallowed key types", () => { + expect(getSafeApiKeyPrefix("sk_live_abcdef1234567890", ["pk_"])).toBeNull(); + expect(getSafeApiKeyPrefix("not-a-key")).toBeNull(); + }); +}); + +describe("recordApiClientEventSafe", () => { + const originalCreate = ApiClientEvent.create; + + afterEach(() => { + ApiClientEvent.create = originalCreate; + }); + + it("swallows persistence failures", async () => { + ApiClientEvent.create = mock(async () => { + throw new Error("database unavailable"); + }) as typeof ApiClientEvent.create; + + await expect(recordApiClientEventSafe({ operation: "quote_create", status: "failure" })).resolves.toBeUndefined(); + }); +}); diff --git a/apps/api/src/api/observability/apiClientEvent.service.ts b/apps/api/src/api/observability/apiClientEvent.service.ts new file mode 100644 index 000000000..32be8c975 --- /dev/null +++ b/apps/api/src/api/observability/apiClientEvent.service.ts @@ -0,0 +1,230 @@ +import logger from "../../config/logger"; +import ApiClientEvent from "../../models/apiClientEvent.model"; +import { recordApiClientMetricsSafe } from "./metrics"; +import { logApiClientOperationSafe } from "./operationLogger"; +import { ApiClientErrorType, ApiClientEventInput } from "./types"; + +const API_KEY_PREFIX_LENGTH = 16; + +const SENSITIVE_METADATA_KEYS = new Set([ + "additionaldata", + "apikey", + "authorization", + "depositqrcode", + "ephemeralaccounts", + "ibanpaymentdata", + "pixdestination", + "presignedtxs", + "rawbody", + "receivertaxid", + "secretkey", + "signingaccounts", + "taxid", + "token", + "walletaddress", + "x-api-key" +]); + +type RequestMetadataValue = string | number | boolean | null; + +interface ApiClientRequestLike { + body?: unknown; + method?: string; + params?: unknown; + path?: string; + query?: unknown; +} + +interface RequestMetadataOptions { + bodyKeys?: string[]; + paramKeys?: string[]; + queryKeys?: string[]; +} + +export function observeApiClientEvent(event: ApiClientEventInput): void { + try { + const sanitizedEvent = sanitizeApiClientEvent(event); + logApiClientOperationSafe(sanitizedEvent); + recordApiClientMetricsSafe(sanitizedEvent); + void recordApiClientEventSafe(sanitizedEvent); + } catch (error) { + logger.warn("Failed to observe API client event", { error: error instanceof Error ? error.message : String(error) }); + } +} + +export async function recordApiClientEventSafe(event: ApiClientEventInput): Promise { + try { + await ApiClientEvent.create(sanitizeApiClientEvent(event)); + } catch (error) { + logger.warn("Failed to record API client event", { error: error instanceof Error ? error.message : String(error) }); + } +} + +export function sanitizeApiClientEvent(event: ApiClientEventInput): ApiClientEventInput { + const errorType = event.errorType || (event.status === "success" ? "none" : "unknown_error"); + return { + ...event, + apiKeyPrefix: trimString(event.apiKeyPrefix, API_KEY_PREFIX_LENGTH), + errorMessage: getSafeErrorMessage(errorType), + errorType, + metadata: sanitizeMetadata(event.metadata), + partnerName: trimString(event.partnerName, 100), + status: event.status + }; +} + +export function getSafeApiKeyPrefix( + apiKey: string | null | undefined, + allowedPrefixes: ("pk_" | "sk_")[] = ["pk_", "sk_"] +): string | null { + if (!apiKey || !allowedPrefixes.some(prefix => apiKey.startsWith(prefix))) return null; + + return apiKey.slice(0, API_KEY_PREFIX_LENGTH); +} + +export function buildApiClientRequestMetadata( + req: ApiClientRequestLike, + options: RequestMetadataOptions = {} +): Record { + const metadata: Record = { + requestMethod: req.method || null, + requestPath: buildTemplatedRequestPath(req.path, req.params) + }; + + addSelectedValues(metadata, "requestBody", req.body, options.bodyKeys); + addSelectedValues(metadata, "requestParam", req.params, options.paramKeys); + addSelectedValues(metadata, "requestQuery", req.query, options.queryKeys); + + return metadata; +} + +function sanitizeMetadata(metadata: Record | null | undefined): Record | null { + if (!metadata) return null; + + const sanitized: Record = {}; + for (const [key, value] of Object.entries(metadata)) { + if (isSensitiveMetadataKey(key) || typeof value === "object") { + continue; + } + sanitized[key] = typeof value === "string" ? trimString(value, 100) : value; + } + + return Object.keys(sanitized).length > 0 ? sanitized : null; +} + +function addSelectedValues( + metadata: Record, + prefix: string, + values: unknown, + keys: string[] | undefined +): void { + if (!isPlainObject(values) || !keys || keys.length === 0) return; + + for (const key of keys) { + const value = values[key]; + if (value === undefined) continue; + + if (isSensitiveMetadataKey(key) && !Array.isArray(value) && !isPlainObject(value)) continue; + + const metadataKey = `${prefix}${toPascalCase(key)}`; + if (Array.isArray(value)) { + metadata[`${metadataKey}Count`] = value.length; + continue; + } + if (isPlainObject(value)) { + metadata[`has${prefix.replace(/^request/, "Request")}${toPascalCase(key)}`] = true; + continue; + } + + metadata[metadataKey] = sanitizeRequestMetadataValue(value); + } +} + +function isSensitiveMetadataKey(key: string): boolean { + return SENSITIVE_METADATA_KEYS.has(key.toLowerCase()); +} + +function buildTemplatedRequestPath(path: string | undefined, params: unknown): string | null { + if (!path) return null; + if (!isPlainObject(params)) return path; + + const paramEntries = Object.entries(params) + .filter(([, value]) => isScalarPathParam(value)) + .map(([key, value]) => [key, String(value)] as const); + + if (paramEntries.length === 0) return path; + + return path + .split("/") + .map(segment => { + const decodedSegment = decodePathSegment(segment); + const matchingParam = paramEntries.find(([, value]) => segment === value || decodedSegment === value); + return matchingParam ? `:${matchingParam[0]}` : segment; + }) + .join("/"); +} + +function sanitizeRequestMetadataValue(value: unknown): RequestMetadataValue { + if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean") { + return value; + } + + return String(value); +} + +function isPlainObject(value: unknown): value is Record { + return Boolean(value) && typeof value === "object" && !Array.isArray(value); +} + +function isScalarPathParam(value: unknown): value is string | number | boolean { + return typeof value === "string" || typeof value === "number" || typeof value === "boolean"; +} + +function decodePathSegment(segment: string): string { + try { + return decodeURIComponent(segment); + } catch { + return segment; + } +} + +function toPascalCase(value: string): string { + return value.charAt(0).toUpperCase() + value.slice(1); +} + +function trimString(value: string | null | undefined, maxLength: number): string | null { + if (!value) return null; + return value.replace(/[\r\n\t]/g, " ").slice(0, maxLength); +} + +function getSafeErrorMessage(errorType: ApiClientErrorType): string | null { + if (errorType === "none") return null; + + const messages: Record = { + auth_inactive_partner: "Partner authentication is inactive.", + auth_invalid_api_key: "API authentication failed.", + auth_invalid_public_key: "Public API key validation failed.", + auth_missing_api_key: "API authentication is missing.", + auth_partner_mismatch: "Authenticated partner does not match the requested partner.", + auth_partner_not_found: "Requested partner was not found.", + internal_error: "Internal server error.", + invalid_ephemerals: "Ephemeral account validation failed.", + invalid_presigned_transactions: "Presigned transaction validation failed.", + missing_presigned_transactions: "Required presigned transactions are missing.", + none: null, + ownership_denied: "Authenticated principal does not own the resource.", + provider_error: "Provider operation failed.", + quote_consumed: "Quote is already consumed.", + quote_expired: "Quote is expired.", + quote_not_found: "Quote was not found.", + ramp_not_found: "Ramp was not found.", + ramp_not_in_initial_state: "Ramp is not in an updatable state.", + ramp_not_updatable: "Ramp cannot be updated.", + service_unavailable: "Service is unavailable.", + time_window_exceeded: "Allowed time window was exceeded.", + unknown_error: "Unknown API client operation error.", + validation_error: "Request validation failed." + }; + + return messages[errorType]; +} diff --git a/apps/api/src/api/observability/errorClassifier.test.ts b/apps/api/src/api/observability/errorClassifier.test.ts new file mode 100644 index 000000000..1a01f35b0 --- /dev/null +++ b/apps/api/src/api/observability/errorClassifier.test.ts @@ -0,0 +1,35 @@ +import {describe, expect, it} from "bun:test"; +import httpStatus from "http-status"; +import {APIError} from "../errors/api-error"; +import {classifyApiClientError} from "./errorClassifier"; + +describe("classifyApiClientError", () => { + it("classifies common quote and ramp errors", () => { + expect(classifyApiClientError(new APIError({ message: "Quote not found", status: httpStatus.NOT_FOUND }))).toBe( + "quote_not_found" + ); + expect(classifyApiClientError(new APIError({ message: "Quote has expired", status: httpStatus.BAD_REQUEST }))).toBe( + "quote_expired" + ); + expect(classifyApiClientError(new APIError({ message: "No presigned transactions found", status: httpStatus.BAD_REQUEST }))).toBe( + "missing_presigned_transactions" + ); + expect( + classifyApiClientError( + new APIError({ + message: "This route is temporarily unavailable due to low liquidity. Please try a smaller amount or check back soon.", + status: httpStatus.INTERNAL_SERVER_ERROR + }) + ) + ).toBe("provider_error"); + }); + + it("classifies auth and ownership failures", () => { + expect(classifyApiClientError(new APIError({ message: "Authentication required", status: httpStatus.UNAUTHORIZED }))).toBe( + "auth_missing_api_key" + ); + expect(classifyApiClientError(new APIError({ message: "Authenticated user does not own this ramp", status: httpStatus.FORBIDDEN }))).toBe( + "ownership_denied" + ); + }); +}); diff --git a/apps/api/src/api/observability/errorClassifier.ts b/apps/api/src/api/observability/errorClassifier.ts new file mode 100644 index 000000000..c4acba3ae --- /dev/null +++ b/apps/api/src/api/observability/errorClassifier.ts @@ -0,0 +1,54 @@ +import httpStatus from "http-status"; +import { APIError } from "../errors/api-error"; +import { ApiClientErrorType } from "./types"; + +export function classifyApiClientError(error: unknown, fallbackStatus?: number | null): ApiClientErrorType { + const message = getErrorMessage(error).toLowerCase(); + const status = error instanceof APIError ? error.status : fallbackStatus; + + if (message.includes("authentication required")) return "auth_missing_api_key"; + if (message.includes("does not own") || message.includes("ownership")) return "ownership_denied"; + if (status === httpStatus.FORBIDDEN) return "ownership_denied"; + if (status === httpStatus.UNAUTHORIZED) return "auth_invalid_api_key"; + if (status === httpStatus.SERVICE_UNAVAILABLE) return "service_unavailable"; + + if (message.includes("low liquidity")) return "provider_error"; + + if (status === httpStatus.BAD_REQUEST) { + if (message.includes("expired")) return "quote_expired"; + if (message.includes("no presigned transactions")) return "missing_presigned_transactions"; + if (message.includes("presigned")) return "invalid_presigned_transactions"; + if (message.includes("ephemeral")) return "invalid_ephemerals"; + if (message.includes("time window")) return "time_window_exceeded"; + return "validation_error"; + } + + if (status === httpStatus.NOT_FOUND) { + if (message.includes("quote")) return "quote_not_found"; + if (message.includes("ramp")) return "ramp_not_found"; + } + + if (status === httpStatus.CONFLICT) { + if (message.includes("quote")) return "quote_consumed"; + if (message.includes("initial") || message.includes("allows updates")) return "ramp_not_in_initial_state"; + return "ramp_not_updatable"; + } + + if (status && status >= 500) return "internal_error"; + + if (message.includes("quote not found")) return "quote_not_found"; + if (message.includes("ramp not found")) return "ramp_not_found"; + if (message.includes("quote has expired") || message.includes("quote is expired")) return "quote_expired"; + if (message.includes("quote already consumed") || message.includes("quote is consumed")) return "quote_consumed"; + if (message.includes("no presigned transactions")) return "missing_presigned_transactions"; + if (message.includes("presigned")) return "invalid_presigned_transactions"; + if (message.includes("ephemeral")) return "invalid_ephemerals"; + if (message.includes("time window")) return "time_window_exceeded"; + if (message.includes("provider") || message.includes("failed to calculate quote")) return "provider_error"; + + return "unknown_error"; +} + +export function getErrorMessage(error: unknown): string { + return error instanceof Error ? error.message : String(error); +} diff --git a/apps/api/src/api/observability/metrics.ts b/apps/api/src/api/observability/metrics.ts new file mode 100644 index 000000000..cb82505bc --- /dev/null +++ b/apps/api/src/api/observability/metrics.ts @@ -0,0 +1,6 @@ +import { ApiClientEventInput } from "./types"; + +export function recordApiClientMetricsSafe(_event: ApiClientEventInput): void { + // Persistent api_client_events rows are the durable metric source for this phase. + // This hook is intentionally kept as a safe extension point for Prometheus/Datadog exporters. +} diff --git a/apps/api/src/api/observability/operationLogger.ts b/apps/api/src/api/observability/operationLogger.ts new file mode 100644 index 000000000..1fa39b0f0 --- /dev/null +++ b/apps/api/src/api/observability/operationLogger.ts @@ -0,0 +1,30 @@ +import logger from "../../config/logger"; +import { ApiClientEventInput } from "./types"; + +export function logApiClientOperationSafe(event: ApiClientEventInput): void { + try { + const payload = { + apiKeyPrefix: event.apiKeyPrefix, + durationMs: event.durationMs, + errorMessage: event.errorMessage, + errorType: event.errorType, + httpStatus: event.httpStatus, + operation: event.operation, + partnerId: event.partnerId, + partnerName: event.partnerName, + quoteId: event.quoteId, + rampId: event.rampId, + requestId: event.requestId, + userId: event.userId + }; + + if (event.status === "failure") { + logger.warn("Partner API operation failed", payload); + return; + } + + logger.info("Partner API operation completed", payload); + } catch (error) { + logger.warn("Failed to log API client operation", { error: error instanceof Error ? error.message : String(error) }); + } +} diff --git a/apps/api/src/api/observability/requestContext.test.ts b/apps/api/src/api/observability/requestContext.test.ts new file mode 100644 index 000000000..a2bdb9713 --- /dev/null +++ b/apps/api/src/api/observability/requestContext.test.ts @@ -0,0 +1,40 @@ +import { describe, expect, it } from "bun:test"; +import { NextFunction, Request, Response } from "express"; +import { getRequestDurationMs, requestContext } from "./requestContext"; + +describe("requestContext", () => { + it("uses an incoming request ID and returns it in the response header", () => { + const req = { headers: { "x-request-id": "req-123" } } as unknown as Request; + const headers: Record = {}; + const res = { setHeader: (key: string, value: string) => { headers[key] = value; } } as Response; + let calledNext = false; + const next: NextFunction = () => { calledNext = true; }; + + requestContext(req, res, next); + + expect(req.requestId).toBe("req-123"); + expect(headers["X-Request-ID"]).toBe("req-123"); + expect(req.requestStartedAt).toBeNumber(); + expect(calledNext).toBe(true); + }); + + it.each(["x".repeat(129), "request id with spaces"])("rejects unsafe incoming request ID %p", requestId => { + const req = { headers: { "x-request-id": requestId } } as unknown as Request; + const headers: Record = {}; + const res = { setHeader: (key: string, value: string) => { headers[key] = value; } } as Response; + + requestContext(req, res, () => {}); + + expect(req.requestId).toBeDefined(); + expect(req.requestId).not.toBe(requestId); + expect(req.requestId || "").toHaveLength(36); + expect(headers["X-Request-ID"]).toBe(req.requestId || ""); + }); + + it("calculates request duration when a start time exists", () => { + const duration = getRequestDurationMs({ requestStartedAt: Date.now() - 5 }); + + expect(duration).not.toBeNull(); + expect(duration).toBeGreaterThanOrEqual(0); + }); +}); diff --git a/apps/api/src/api/observability/requestContext.ts b/apps/api/src/api/observability/requestContext.ts new file mode 100644 index 000000000..322a6cbf5 --- /dev/null +++ b/apps/api/src/api/observability/requestContext.ts @@ -0,0 +1,37 @@ +import { randomUUID } from "node:crypto"; +import { NextFunction, Request, Response } from "express"; + +const MAX_REQUEST_ID_LENGTH = 128; +const SAFE_REQUEST_ID_PATTERN = /^[A-Za-z0-9._:-]+$/; + +declare global { + // biome-ignore lint/style/noNamespace: Express request augmentation follows the existing backend pattern. + namespace Express { + interface Request { + requestId?: string; + requestStartedAt?: number; + } + } +} + +export function requestContext(req: Request, res: Response, next: NextFunction): void { + const requestId = + getSafeRequestId(req.headers["x-request-id"]) || getSafeRequestId(req.headers["x-correlation-id"]) || randomUUID(); + + req.requestId = requestId; + req.requestStartedAt = Date.now(); + res.setHeader("X-Request-ID", requestId); + + next(); +} + +export function getRequestDurationMs(req: { requestStartedAt?: number }): number | null { + if (!req.requestStartedAt) return null; + return Date.now() - req.requestStartedAt; +} + +function getSafeRequestId(value: string | string[] | undefined): string | null { + const requestId = Array.isArray(value) ? value[0] : value; + if (!requestId || requestId.length > MAX_REQUEST_ID_LENGTH || !SAFE_REQUEST_ID_PATTERN.test(requestId)) return null; + return requestId; +} diff --git a/apps/api/src/api/observability/types.ts b/apps/api/src/api/observability/types.ts new file mode 100644 index 000000000..60ac1ab6a --- /dev/null +++ b/apps/api/src/api/observability/types.ts @@ -0,0 +1,60 @@ +export type ApiClientOperation = + | "auth_api_key" + | "auth_public_key" + | "auth_dual" + | "auth_ownership" + | "quote_create" + | "quote_create_best" + | "quote_get" + | "ramp_register" + | "ramp_update" + | "ramp_start" + | "ramp_status" + | "ramp_errors"; + +export type ApiClientEventStatus = "success" | "failure"; + +export type ApiClientErrorType = + | "none" + | "validation_error" + | "auth_missing_api_key" + | "auth_invalid_api_key" + | "auth_invalid_public_key" + | "auth_partner_not_found" + | "auth_partner_mismatch" + | "auth_inactive_partner" + | "ownership_denied" + | "quote_not_found" + | "quote_expired" + | "quote_consumed" + | "invalid_ephemerals" + | "invalid_presigned_transactions" + | "missing_presigned_transactions" + | "time_window_exceeded" + | "ramp_not_found" + | "ramp_not_updatable" + | "ramp_not_in_initial_state" + | "service_unavailable" + | "provider_error" + | "internal_error" + | "unknown_error"; + +export interface ApiClientEventInput { + requestId?: string | null; + operation: ApiClientOperation; + status: ApiClientEventStatus; + httpStatus?: number | null; + errorType?: ApiClientErrorType | null; + errorMessage?: string | null; + partnerId?: string | null; + partnerName?: string | null; + apiKeyPrefix?: string | null; + userId?: string | null; + quoteId?: string | null; + rampId?: string | null; + rampType?: string | null; + network?: string | null; + paymentMethod?: string | null; + durationMs?: number | null; + metadata?: Record | null; +} diff --git a/apps/api/src/api/routes/v1/admin/api-client-events.route.ts b/apps/api/src/api/routes/v1/admin/api-client-events.route.ts new file mode 100644 index 000000000..eac5e5784 --- /dev/null +++ b/apps/api/src/api/routes/v1/admin/api-client-events.route.ts @@ -0,0 +1,17 @@ +import { Router } from "express"; +import { listApiClientEvents } from "../../../controllers/admin/apiClientEvents.controller"; +import { metricsDashboardAuth } from "../../../middlewares/metricsDashboardAuth"; + +const router: Router = Router({ mergeParams: true }); + +router.use(metricsDashboardAuth); + +/** + * GET /v1/admin/api-client-events + * List sanitized API client observability events for internal dashboards. + * + * Authentication: Requires Authorization: Bearer + */ +router.get("/", listApiClientEvents); + +export default router; diff --git a/apps/api/src/api/routes/v1/admin/profile-partner-assignments.route.ts b/apps/api/src/api/routes/v1/admin/profile-partner-assignments.route.ts new file mode 100644 index 000000000..cad5181c1 --- /dev/null +++ b/apps/api/src/api/routes/v1/admin/profile-partner-assignments.route.ts @@ -0,0 +1,31 @@ +import { Router } from "express"; +import { + createProfilePartnerAssignment, + listProfilePartnerAssignments, + revokeProfilePartnerAssignment +} from "../../../controllers/admin/profilePartnerAssignments.controller"; +import { adminAuth } from "../../../middlewares/adminAuth"; + +const router: Router = Router({ mergeParams: true }); + +router.use(adminAuth); + +/** + * POST /v1/admin/profile-partner-assignments + * Assign a Supabase profile to a partner name for pricing-only quote behavior. + */ +router.post("/", createProfilePartnerAssignment); + +/** + * GET /v1/admin/profile-partner-assignments + * List active profile partner assignments by default. + */ +router.get("/", listProfilePartnerAssignments); + +/** + * DELETE /v1/admin/profile-partner-assignments/:assignmentId + * Revoke (soft delete) a profile partner assignment. + */ +router.delete("/:assignmentId", revokeProfilePartnerAssignment); + +export default router; diff --git a/apps/api/src/api/routes/v1/alfredpay.route.ts b/apps/api/src/api/routes/v1/alfredpay.route.ts index e2009db8e..862fc869f 100644 --- a/apps/api/src/api/routes/v1/alfredpay.route.ts +++ b/apps/api/src/api/routes/v1/alfredpay.route.ts @@ -3,6 +3,7 @@ import multer from "multer"; import { AlfredpayController } from "../../controllers/alfredpay.controller"; import { validateResultCountry } from "../../middlewares/alfredpay.middleware"; import { requireAuth } from "../../middlewares/supabaseAuth"; +import { validateKycSubmission } from "../../middlewares/validators"; const router = Router(); const upload = multer({ limits: { fileSize: 5 * 1024 * 1024 }, storage: multer.memoryStorage() }); @@ -18,7 +19,13 @@ router.post("/createBusinessCustomer", requireAuth, validateResultCountry, Alfre router.get("/getKybRedirectLink", requireAuth, validateResultCountry, AlfredpayController.getKybRedirectLink); // MXN/CO API-based KYC -router.post("/submitKycInformation", requireAuth, validateResultCountry, AlfredpayController.submitKycInformation); +router.post( + "/submitKycInformation", + requireAuth, + validateResultCountry, + validateKycSubmission, + AlfredpayController.submitKycInformation +); router.post("/submitKycFile", requireAuth, upload.single("file"), validateResultCountry, AlfredpayController.submitKycFile); router.post("/sendKycSubmission", requireAuth, validateResultCountry, AlfredpayController.sendKycSubmission); diff --git a/apps/api/src/api/routes/v1/index.ts b/apps/api/src/api/routes/v1/index.ts index 293774ea4..88c3203bc 100644 --- a/apps/api/src/api/routes/v1/index.ts +++ b/apps/api/src/api/routes/v1/index.ts @@ -1,8 +1,9 @@ import { Request, Response, Router } from "express"; import { sendStatusWithPk as sendMoonbeamStatusWithPk } from "../../controllers/moonbeam.controller"; import { sendStatusWithPk as sendPendulumStatusWithPk } from "../../controllers/pendulum.controller"; -import { sendStatusWithPk as sendStellarStatusWithPk } from "../../controllers/stellar.controller"; +import apiClientEventsRoutes from "./admin/api-client-events.route"; import partnerApiKeysRoutes from "./admin/partner-api-keys.route"; +import profilePartnerAssignmentsRoutes from "./admin/profile-partner-assignments.route"; import alfredpayRoutes from "./alfredpay.route"; import authRoutes from "./auth.route"; import brlaRoutes from "./brla.route"; @@ -13,7 +14,7 @@ import emailRoutes from "./email.route"; import fiatRoutes from "./fiat.route"; import maintenanceRoutes from "./maintenance.route"; import metricsRoutes from "./metrics.route"; -import moneriumRoutes from "./monerium.route"; +import mykoboRoutes from "./mykobo.route"; import paymentMethodsRoutes from "./payment-methods.route"; import priceRoutes from "./price.route"; import publicKeyRoutes from "./public-key.route"; @@ -22,12 +23,10 @@ import rampRoutes from "./ramp.route"; import ratingRoutes from "./rating.route"; import sessionRoutes from "./session.route"; import siweRoutes from "./siwe.route"; -import stellarRoutes from "./stellar.route"; import storageRoutes from "./storage.route"; import webhookRoutes from "./webhook.route"; type ChainStatus = { - stellar: unknown; pendulum: unknown; moonbeam: unknown; }; @@ -37,8 +36,7 @@ const router: Router = Router({ mergeParams: true }); async function sendStatusWithPk(_: Request, res: Response): Promise { const chainStatus: ChainStatus = { moonbeam: await sendMoonbeamStatusWithPk(), - pendulum: await sendPendulumStatusWithPk(), - stellar: await sendStellarStatusWithPk() + pendulum: await sendPendulumStatusWithPk() }; res.json(chainStatus); @@ -65,11 +63,6 @@ router.use("/prices", priceRoutes); */ router.use("/quotes", quoteRoutes); -/** - * POST v1/stellar - */ -router.use("/stellar", stellarRoutes); - /** * POST v1/storage */ @@ -153,9 +146,10 @@ router.use("/auth", authRoutes); router.use("/alfredpay", alfredpayRoutes); /** - * GET v1/monerium + * GET v1/mykobo/profiles + * POST v1/mykobo/profiles */ -router.use("/monerium", moneriumRoutes); +router.use("/mykobo", mykoboRoutes); /** * POST v1/webhook @@ -182,6 +176,20 @@ router.use("/metrics", metricsRoutes); */ router.use("/admin/partners/:partnerName/api-keys", partnerApiKeysRoutes); +/** + * Admin routes for profile partner pricing assignments + * POST /v1/admin/profile-partner-assignments + * GET /v1/admin/profile-partner-assignments + * DELETE /v1/admin/profile-partner-assignments/:assignmentId + */ +router.use("/admin/profile-partner-assignments", profilePartnerAssignmentsRoutes); + +/** + * Admin routes for API client observability dashboards + * GET /v1/admin/api-client-events + */ +router.use("/admin/api-client-events", apiClientEventsRoutes); + router.get("/ip", (request: Request, response: Response) => { response.send(request.ip); }); diff --git a/apps/api/src/api/routes/v1/monerium.route.ts b/apps/api/src/api/routes/v1/monerium.route.ts deleted file mode 100644 index af54ff49a..000000000 --- a/apps/api/src/api/routes/v1/monerium.route.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Router } from "express"; -import * as moneriumController from "../../controllers/monerium.controller"; - -const router: Router = Router({ mergeParams: true }); - -router.route("/address-exists").get(moneriumController.checkAddressExistsController); - -export default router; diff --git a/apps/api/src/api/routes/v1/mykobo.route.ts b/apps/api/src/api/routes/v1/mykobo.route.ts new file mode 100644 index 000000000..d5fa77e7e --- /dev/null +++ b/apps/api/src/api/routes/v1/mykobo.route.ts @@ -0,0 +1,18 @@ +import { Router } from "express"; +import multer from "multer"; +import * as mykoboController from "../../controllers/mykobo.controller"; +import { requireAuth } from "../../middlewares/supabaseAuth"; + +const router: Router = Router({ mergeParams: true }); +const upload = multer({ limits: { fileSize: 10 * 1024 * 1024 }, storage: multer.memoryStorage() }); +const profileUpload = upload.fields([ + { maxCount: 1, name: "front" }, + { maxCount: 1, name: "back" }, + { maxCount: 1, name: "face" }, + { maxCount: 1, name: "utility_bill" } +]); + +router.route("/profiles").get(requireAuth, mykoboController.getProfileController); +router.route("/profiles").post(requireAuth, profileUpload, mykoboController.createProfileController); + +export default router; diff --git a/apps/api/src/api/routes/v1/quote.route.ts b/apps/api/src/api/routes/v1/quote.route.ts index 2387bed83..c8225e1dd 100644 --- a/apps/api/src/api/routes/v1/quote.route.ts +++ b/apps/api/src/api/routes/v1/quote.route.ts @@ -1,6 +1,7 @@ import { Router } from "express"; import { createBestQuote, createQuote, getQuote } from "../../controllers/quote.controller"; import { apiKeyAuth, enforcePartnerAuth } from "../../middlewares/apiKeyAuth"; +import { rejectDuringActiveMaintenance } from "../../middlewares/maintenanceGuard"; import { validatePublicKey } from "../../middlewares/publicKeyAuth"; import { optionalAuth } from "../../middlewares/supabaseAuth"; import { validateCreateBestQuoteInput, validateCreateQuoteInput } from "../../middlewares/validators"; @@ -44,6 +45,7 @@ const router: Router = Router({ mergeParams: true }); router .route("/") .post( + rejectDuringActiveMaintenance("quote_create"), validateCreateQuoteInput, optionalAuth, validatePublicKey(), @@ -105,6 +107,7 @@ router router .route("/best") .post( + rejectDuringActiveMaintenance("quote_create_best"), validateCreateBestQuoteInput, optionalAuth, validatePublicKey(), diff --git a/apps/api/src/api/routes/v1/ramp.route.ts b/apps/api/src/api/routes/v1/ramp.route.ts index 2ecae7553..aa8e589b3 100644 --- a/apps/api/src/api/routes/v1/ramp.route.ts +++ b/apps/api/src/api/routes/v1/ramp.route.ts @@ -1,6 +1,7 @@ import { RequestHandler, Router } from "express"; import * as rampController from "../../controllers/ramp.controller"; import { optionalPartnerOrUserAuth, requirePartnerOrUserAuth } from "../../middlewares/dualAuth"; +import { rejectDuringActiveMaintenance } from "../../middlewares/maintenanceGuard"; const router = Router(); @@ -30,7 +31,12 @@ const router = Router(); * @apiError (Not Found 404) NotFound Quote does not exist */ -router.post("/register", optionalPartnerOrUserAuth(), rampController.registerRamp as unknown as RequestHandler); +router.post( + "/register", + rejectDuringActiveMaintenance("ramp_register"), + optionalPartnerOrUserAuth(), + rampController.registerRamp as unknown as RequestHandler +); /** * @api {post} v1/ramp/update Update ramping process @@ -57,7 +63,12 @@ router.post("/register", optionalPartnerOrUserAuth(), rampController.registerRam * @apiError (Not Found 404) NotFound Ramp does not exist * @apiError (Conflict 409) ConflictError Ramp is not in a state that allows updates */ -router.post("/update", optionalPartnerOrUserAuth(), rampController.updateRamp as unknown as RequestHandler); +router.post( + "/update", + rejectDuringActiveMaintenance("ramp_update"), + optionalPartnerOrUserAuth(), + rampController.updateRamp as unknown as RequestHandler +); /** * @api {post} v1/ramp/start Start ramping process @@ -83,7 +94,12 @@ router.post("/update", optionalPartnerOrUserAuth(), rampController.updateRamp as * @apiError (Bad Request 400) ValidationError Some parameters may contain invalid values * @apiError (Not Found 404) NotFound Quote does not exist */ -router.post("/start", optionalPartnerOrUserAuth(), rampController.startRamp as unknown as RequestHandler); +router.post( + "/start", + rejectDuringActiveMaintenance("ramp_start"), + optionalPartnerOrUserAuth(), + rampController.startRamp as unknown as RequestHandler +); /** * @api {get} v1/ramp/:id Get ramp status diff --git a/apps/api/src/api/routes/v1/stellar.route.ts b/apps/api/src/api/routes/v1/stellar.route.ts deleted file mode 100644 index 9df107089..000000000 --- a/apps/api/src/api/routes/v1/stellar.route.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Router } from "express"; -import * as stellarController from "../../controllers/stellar.controller"; -import { getMemoFromCookiesMiddleware } from "../../middlewares/auth"; -import { requireAuth } from "../../middlewares/supabaseAuth"; -import { validateCreationInput, validateSep10Input } from "../../middlewares/validators"; - -const router: Router = Router({ mergeParams: true }); - -router.route("/create").post(requireAuth, validateCreationInput, stellarController.createStellarTransactionHandler); - -// Only authorized route. Does not reject the request, but rather passes the memo (if any) derived from a valid cookie in the request. -router - .route("/sep10") - .post([validateSep10Input, getMemoFromCookiesMiddleware], stellarController.signSep10ChallengeHandler) - .get(stellarController.getSep10MasterPKHandler); - -export default router; diff --git a/apps/api/src/api/services/api-client-events-retention.service.test.ts b/apps/api/src/api/services/api-client-events-retention.service.test.ts new file mode 100644 index 000000000..aae9ef6ac --- /dev/null +++ b/apps/api/src/api/services/api-client-events-retention.service.test.ts @@ -0,0 +1,94 @@ +import { afterEach, describe, expect, it, mock } from "bun:test"; +import { Transaction } from "sequelize"; +import sequelize from "../../config/database"; +import ApiClientEvent from "../../models/apiClientEvent.model"; +import { + API_CLIENT_EVENT_RETENTION_DAYS, + ApiClientEventsRetentionService, + getApiClientEventRetentionCutoff +} from "./api-client-events-retention.service"; + +describe("getApiClientEventRetentionCutoff", () => { + it("keeps the current UTC calendar day and the previous six days", () => { + const cutoff = getApiClientEventRetentionCutoff(new Date("2026-06-09T18:30:00.000Z")); + + expect(API_CLIENT_EVENT_RETENTION_DAYS).toBe(7); + expect(cutoff.toISOString()).toBe("2026-06-03T00:00:00.000Z"); + }); + + it("uses the UTC calendar day instead of the local clock time", () => { + const cutoff = getApiClientEventRetentionCutoff(new Date("2026-01-01T00:30:00.000Z")); + + expect(cutoff.toISOString()).toBe("2025-12-26T00:00:00.000Z"); + }); +}); + +describe("ApiClientEventsRetentionService", () => { + const originalTransaction = sequelize.transaction; + const originalQuery = sequelize.query; + const originalFindAll = ApiClientEvent.findAll; + const originalDestroy = ApiClientEvent.destroy; + + afterEach(() => { + sequelize.transaction = originalTransaction; + sequelize.query = originalQuery; + ApiClientEvent.findAll = originalFindAll; + ApiClientEvent.destroy = originalDestroy; + }); + + it("deletes expired events until all batches are drained", async () => { + const transaction = {} as Transaction; + const transactionMock = mock(async (callback: (transaction: Transaction) => Promise) => callback(transaction)); + const queryMock = mock(async () => [{ acquired: true }]); + let findAllCallCount = 0; + let destroyCallCount = 0; + const findAllMock = mock(async () => { + findAllCallCount += 1; + if (findAllCallCount === 1) { + return Array.from({ length: 10000 }, (_, index) => ({ id: `first-${index}` })); + } + + return [{ id: "second-1" }, { id: "second-2" }]; + }); + const destroyMock = mock(async () => { + destroyCallCount += 1; + return destroyCallCount === 1 ? 10000 : 2; + }); + + sequelize.transaction = transactionMock as typeof sequelize.transaction; + sequelize.query = queryMock as unknown as typeof sequelize.query; + ApiClientEvent.findAll = findAllMock as unknown as typeof ApiClientEvent.findAll; + ApiClientEvent.destroy = destroyMock as typeof ApiClientEvent.destroy; + + const deletedEventsCount = await new ApiClientEventsRetentionService().cleanupExpiredEvents( + new Date("2026-06-09T18:30:00.000Z") + ); + + expect(deletedEventsCount).toBe(10002); + expect(transactionMock).toHaveBeenCalledTimes(2); + expect(queryMock).toHaveBeenCalledTimes(2); + expect(findAllMock).toHaveBeenCalledTimes(2); + expect(destroyMock).toHaveBeenCalledTimes(2); + }); + + it("stops without deleting when another worker holds the cleanup lock", async () => { + const transaction = {} as Transaction; + const transactionMock = mock(async (callback: (transaction: Transaction) => Promise) => callback(transaction)); + const queryMock = mock(async () => [{ acquired: false }]); + const findAllMock = mock(async () => [{ id: "expired-event" }]); + const destroyMock = mock(async () => 1); + + sequelize.transaction = transactionMock as typeof sequelize.transaction; + sequelize.query = queryMock as unknown as typeof sequelize.query; + ApiClientEvent.findAll = findAllMock as unknown as typeof ApiClientEvent.findAll; + ApiClientEvent.destroy = destroyMock as typeof ApiClientEvent.destroy; + + const deletedEventsCount = await new ApiClientEventsRetentionService().cleanupExpiredEvents(); + + expect(deletedEventsCount).toBe(0); + expect(transactionMock).toHaveBeenCalledTimes(1); + expect(queryMock).toHaveBeenCalledTimes(1); + expect(findAllMock).not.toHaveBeenCalled(); + expect(destroyMock).not.toHaveBeenCalled(); + }); +}); diff --git a/apps/api/src/api/services/api-client-events-retention.service.ts b/apps/api/src/api/services/api-client-events-retention.service.ts new file mode 100644 index 000000000..e7cce15d3 --- /dev/null +++ b/apps/api/src/api/services/api-client-events-retention.service.ts @@ -0,0 +1,83 @@ +import { Op, QueryTypes, Transaction } from "sequelize"; +import sequelize from "../../config/database"; +import logger from "../../config/logger"; +import ApiClientEvent from "../../models/apiClientEvent.model"; + +export const API_CLIENT_EVENT_RETENTION_DAYS = 7; +const API_CLIENT_EVENT_DELETE_BATCH_SIZE = 10000; +const API_CLIENT_EVENT_CLEANUP_ADVISORY_LOCK_NAMESPACE = 918522; +const API_CLIENT_EVENT_CLEANUP_ADVISORY_LOCK_KEY = 1; + +export function getApiClientEventRetentionCutoff(now = new Date()): Date { + return new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate() - (API_CLIENT_EVENT_RETENTION_DAYS - 1))); +} + +export class ApiClientEventsRetentionService { + public async cleanupExpiredEvents(now = new Date()): Promise { + const cutoff = getApiClientEventRetentionCutoff(now); + let deletedEventsCount = 0; + + while (true) { + const deletedBatchCount = await this.cleanupExpiredEventsBatch(cutoff); + deletedEventsCount += deletedBatchCount; + + if (deletedBatchCount < API_CLIENT_EVENT_DELETE_BATCH_SIZE) { + return deletedEventsCount; + } + } + } + + private async cleanupExpiredEventsBatch(cutoff: Date): Promise { + return sequelize.transaction(async transaction => { + const [lock] = await sequelize.query<{ acquired: boolean }>( + "SELECT pg_try_advisory_xact_lock(:namespace, :key) AS acquired", + { + replacements: { + key: API_CLIENT_EVENT_CLEANUP_ADVISORY_LOCK_KEY, + namespace: API_CLIENT_EVENT_CLEANUP_ADVISORY_LOCK_NAMESPACE + }, + transaction, + type: QueryTypes.SELECT + } + ); + + if (!lock?.acquired) { + logger.info("Skipping API client events cleanup because another worker holds the cleanup lock"); + return 0; + } + + return this.cleanupExpiredEventsWithLock(cutoff, transaction); + }); + } + + private async cleanupExpiredEventsWithLock(cutoff: Date, transaction: Transaction): Promise { + const expiredEventBatch = await ApiClientEvent.findAll({ + attributes: ["id"], + limit: API_CLIENT_EVENT_DELETE_BATCH_SIZE, + order: [["createdAt", "ASC"]], + transaction, + where: { + createdAt: { + [Op.lt]: cutoff + } + } + }); + + const expiredEventIds = expiredEventBatch.map(event => event.id); + if (expiredEventIds.length === 0) { + return 0; + } + + return ApiClientEvent.destroy({ + transaction, + where: { + createdAt: { + [Op.lt]: cutoff + }, + id: { + [Op.in]: expiredEventIds + } + } + }); + } +} diff --git a/apps/api/src/api/services/hydration/swap.ts b/apps/api/src/api/services/hydration/swap.ts index fd6cc6854..337a27ede 100644 --- a/apps/api/src/api/services/hydration/swap.ts +++ b/apps/api/src/api/services/hydration/swap.ts @@ -11,30 +11,40 @@ const CACHED_ASSET_IDS = [ ]; export class HydrationRouter { - private sdk: Promise; + private sdk?: Promise; private cachedXcmFees: Record; + private xcmFeeRefreshInterval?: ReturnType; constructor() { - const apiManager = ApiManager.getInstance(); this.cachedXcmFees = {}; - this.sdk = apiManager.getApi("hydration").then(async ({ api }) => { - return createSdkContext(api, { - router: { includeOnly: [PoolType.Omni, PoolType.Stable, PoolType.Aave] } - }); - }); - - // Refresh transaction fees every hour - void this.refreshCachedXcmTransactionFeeToAssethub(); - setInterval(() => this.refreshCachedXcmTransactionFeeToAssethub, 60 * 60 * 1000); + } + + private getSdk(): Promise { + if (!this.sdk) { + const apiManager = ApiManager.getInstance(); + this.sdk = apiManager + .getApi("hydration") + .then(async ({ api }) => { + return createSdkContext(api, { + router: { includeOnly: [PoolType.Omni, PoolType.Stable, PoolType.Aave] } + }); + }) + .catch(error => { + this.sdk = undefined; + throw error; + }); + } + + return this.sdk; } async getBestSellPriceFor(assetIn: string, assetOut: string, amountIn: string): Promise { - const sdk = await this.sdk; + const sdk = await this.getSdk(); return sdk.api.router.getBestSell(assetIn, assetOut, amountIn); } async createTransactionForTrade(trade: Trade, beneficiaryAddress: string, slippage = 0.1): Promise { - const sdk = await this.sdk; + const sdk = await this.getSdk(); const txBuilder = sdk.tx.trade(trade); txBuilder.withBeneficiary(beneficiaryAddress); txBuilder.withSlippage(slippage); @@ -47,10 +57,25 @@ export class HydrationRouter { return this.cachedXcmFees[assetId]; } else { await this.refreshCachedXcmTransactionFeeToAssethub(); + this.startXcmFeeRefreshInterval(); return this.cachedXcmFees[assetId]; } } + private startXcmFeeRefreshInterval() { + if (!this.xcmFeeRefreshInterval) { + this.xcmFeeRefreshInterval = setInterval( + () => { + this.refreshCachedXcmTransactionFeeToAssethub().catch(error => { + const message = error instanceof Error ? error.message : String(error); + logger.error(`HydrationRouter: Error refreshing cached XCM transaction fees: ${message}`); + }); + }, + 60 * 60 * 1000 + ); + } + } + private async refreshCachedXcmTransactionFeeToAssethub() { logger.info("HydrationRouter: Refreshing cached XCM transaction fees.."); const placeholderSenderAddress = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"; diff --git a/apps/api/src/api/services/monerium/index.ts b/apps/api/src/api/services/monerium/index.ts deleted file mode 100644 index a304967a0..000000000 --- a/apps/api/src/api/services/monerium/index.ts +++ /dev/null @@ -1,259 +0,0 @@ -import { - AddressExistsResponse, - AuthContext, - BeneficiaryDetails, - EvmNetworks, - FetchIbansParams, - FetchProfileParams, - IbanData, - IbanDataResponse, - MoneriumAddressStatus, - MoneriumErrors, - MoneriumResponse, - MoneriumTokenResponse, - MoneriumUserProfile, - Networks -} from "@vortexfi/shared"; -import logger from "../../../config/logger"; -import { config } from "../../../config/vars"; -import { fetchWithTimeout } from "../../helpers/fetchWithTimeout"; - -const MONERIUM_API_URL = config.sandboxEnabled ? "https://api.monerium.dev" : "https://api.monerium.app"; -export const MONERIUM_MINT_CHAIN = config.sandboxEnabled ? "amoy" : "polygon"; -const HEADER_ACCEPT_V2 = { Accept: "application/vnd.monerium.api-v2+json" }; -const HEADER_CONTENT_TYPE_FORM = { "Content-Type": "application/x-www-form-urlencoded" }; - -const authorize = async (): Promise => { - const url = `${MONERIUM_API_URL}/auth/token`; - const headers = HEADER_CONTENT_TYPE_FORM; - const body = new URLSearchParams({ - client_id: config.integrations.monerium.clientId || "", - client_secret: config.integrations.monerium.clientSecret || "", - grant_type: "client_credentials" - }); - - const response = await fetchWithTimeout(url, { - body, - headers, - method: "POST" - }); - - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - - return response.json(); -}; - -export const checkAddressExists = async (address: string, network: Networks): Promise => { - const { access_token } = await authorize(); - const url = `${MONERIUM_API_URL}/addresses/${address}`; - const headers = { - ...HEADER_ACCEPT_V2, - Authorization: `Bearer ${access_token}` - }; - - try { - const response = await fetchWithTimeout(url, { headers }); - if (!response.ok) { - if (response.status === 404) { - return null; - } - throw new Error(`HTTP error! status: ${response.status}`); - } - - const data: AddressExistsResponse = await response.json(); - if (data.chains.includes(network)) { - return data; - } - return null; - } catch (error) { - logger.error("Failed to fetch address:", error); - return null; - } -}; - -export const getFirstMoneriumLinkedAddress = async (token: string): Promise => { - const url = `${MONERIUM_API_URL}/addresses`; - const headers = { - ...HEADER_ACCEPT_V2, - Authorization: `Bearer ${token}` - }; - - try { - const response = await fetchWithTimeout(url, { headers }); - - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - - const data: MoneriumResponse = await response.json(); - - if (data.addresses && data.addresses.length > 0) { - const mostRecentAddress = data.addresses[data.addresses.length - 1]; // Ordered by creation date, so last is the most recent. - - if (mostRecentAddress.status === MoneriumAddressStatus.REQUESTED) { - throw new Error(MoneriumErrors.USER_MINT_ADDRESS_IS_NOT_READY); - } - - return mostRecentAddress.address; - } else { - logger.info("No addresses found in the response."); - return null; - } - } catch (error) { - logger.error("Failed to fetch addresses:", error); - throw error; - } -}; - -export const getAuthContext = async (authToken: string): Promise => { - const url = `${MONERIUM_API_URL}/auth/context`; - const headers = { - ...HEADER_ACCEPT_V2, - Authorization: `Bearer ${authToken}` - }; - - try { - const response = await fetchWithTimeout(url, { headers }); - - if (!response.ok) { - throw new Error(`No auth context found: ${response.status} ${response.statusText}`); - } - - return response.json(); - } catch (error) { - logger.error("Failed to fetch auth context:", error); - throw error; - } -}; - -export const getMoneriumEvmDefaultMintAddress = async (token: string): Promise => { - // Assumption is the first linked address is the default mint address for Monerium EVM transactions. - // TODO: this needs to be confirmed. - return getFirstMoneriumLinkedAddress(token); -}; - -export const getIbanForAddress = async (walletAddress: string, authToken: string, network: EvmNetworks): Promise => { - const approvedAddresses = await getMoneriumLinkedIbans(authToken); - - // Check if the wallet address is in the list of approved addresses - // and that it matches polygon/amoy network. - const ibanData = approvedAddresses.find( - item => item.address.toLowerCase() === walletAddress.toLowerCase() && item.chain === MONERIUM_MINT_CHAIN - ); - - if (!ibanData) { - throw new Error(MoneriumErrors.USER_MINT_ADDRESS_NOT_FOUND); - } - return ibanData; -}; - -export const getMoneriumUserIban = async ({ authToken, profileId }: FetchIbansParams): Promise => { - const baseUrl = `${MONERIUM_API_URL}/ibans`; - const url = new URL(baseUrl); - - url.searchParams.append("profile", profileId); - const headers = new Headers({ - ...HEADER_ACCEPT_V2, - Authorization: `Bearer ${authToken}` - }); - - try { - const response = await fetchWithTimeout(url.toString(), { - headers: headers, - method: "GET" - }); - - if (!response.ok) { - throw new Error(`API request failed with status ${response.status}: ${response.statusText}`); - } - const data: IbanDataResponse = await response.json(); - // Look for the IBAN data specifically for the Polygon chain. - // We choose Polygon as the default chain for Monerium EUR minting, - // so user registered with us should always have a Polygon-linked address. - const ibanData = data.ibans.find(item => item.chain === "polygon"); - if (!ibanData) { - throw new Error("No IBAN found for the specified chain (polygon)"); - } - - return ibanData; - } catch (error) { - logger.error("Error fetching IBANs:", error); - throw error; - } -}; - -export const getMoneriumLinkedIbans = async (authToken: string): Promise => { - const authContext = await getAuthContext(authToken); - const profileId = authContext.defaultProfile; - - const baseUrl = `${MONERIUM_API_URL}/ibans`; - const url = new URL(baseUrl); - - url.searchParams.append("profile", profileId); - const headers = new Headers({ - ...HEADER_ACCEPT_V2, - Authorization: `Bearer ${authToken}` - }); - - try { - const response = await fetchWithTimeout(url.toString(), { - headers: headers, - method: "GET" - }); - if (!response.ok) { - throw new Error(`API request failed with status ${response.status}: ${response.statusText}`); - } - - const data = (await response.json()) as { ibans: Array }; - const approvedIbans = data.ibans.filter(item => item.state === "approved" && item.iban !== undefined && item.iban !== null); - - if (approvedIbans.length === 0) { - throw new Error(MoneriumErrors.USER_MINT_ADDRESS_NOT_FOUND); - } - - return approvedIbans; - } catch (error) { - logger.error("Error fetching linked IBANs:", error); - throw error; - } -}; - -export const getMoneriumUserProfile = async ({ authToken, profileId }: FetchProfileParams): Promise => { - const profileUrl = `${MONERIUM_API_URL}/profiles/${profileId}`; - const headers = new Headers({ - ...HEADER_ACCEPT_V2, - Authorization: `Bearer ${authToken}` - }); - - try { - const profileResponse = await fetchWithTimeout(profileUrl, { - headers: headers, - method: "GET" - }); - - if (!profileResponse.ok) { - throw new Error(`Profile API request failed with status ${profileResponse.status}: ${profileResponse.statusText}`); - } - - const profileData: MoneriumUserProfile = await profileResponse.json(); - return profileData; - } catch (error) { - logger.error("Error fetching user profile:", error); - throw error; - } -}; - -export function createEpcQrCodeData(details: BeneficiaryDetails): string { - const { name, iban, bic, amount } = details; - - if (!name || !iban || !bic || !amount) { - throw new Error("Beneficiary name, IBAN, and BIC are required to create EPC QR code data."); - } - - // EPC QR code data format; https://en.wikipedia.org/wiki/EPC_QR_code. - const data = ["BCD", "001", "1", "SCT", bic, name, iban, `EUR${amount}`]; - - return data.join("\n"); -} diff --git a/apps/api/src/api/services/mykobo/mykobo-customer.service.ts b/apps/api/src/api/services/mykobo/mykobo-customer.service.ts new file mode 100644 index 000000000..767570fa0 --- /dev/null +++ b/apps/api/src/api/services/mykobo/mykobo-customer.service.ts @@ -0,0 +1,47 @@ +import { MykoboApiError, MykoboApiService, MykoboCustomerStatus, MykoboProfile, mapMykoboReviewStatus } from "@vortexfi/shared"; +import logger from "../../../config/logger"; +import MykoboCustomer from "../../../models/mykoboCustomer.model"; + +interface UpsertArgs { + userId: string; + email: string; + status: MykoboCustomerStatus; + statusExternal: string | null; +} + +async function upsertMykoboCustomer({ userId, email, status, statusExternal }: UpsertArgs): Promise { + const existing = await MykoboCustomer.findOne({ where: { userId } }); + if (existing) { + await existing.update({ email, status, statusExternal }); + return; + } + await MykoboCustomer.create({ email, status, statusExternal, userId }); +} + +export async function upsertMykoboCustomerFromProfile(userId: string, email: string, profile: MykoboProfile): Promise { + const reviewStatus = profile.kyc_status?.review_status ?? null; + await upsertMykoboCustomer({ + email, + status: mapMykoboReviewStatus(reviewStatus), + statusExternal: reviewStatus, + userId + }); +} + +export async function syncMykoboCustomerKyc(userId: string, email: string): Promise { + try { + const { profile } = await MykoboApiService.getInstance().getProfileByEmail(email); + await upsertMykoboCustomerFromProfile(userId, email, profile); + } catch (error) { + if (error instanceof MykoboApiError && error.status === 404) { + await upsertMykoboCustomer({ + email, + status: MykoboCustomerStatus.CONSULTED, + statusExternal: null, + userId + }); + return; + } + logger.error("Failed to sync Mykobo customer KYC mirror:", error); + } +} diff --git a/apps/api/src/api/services/phases/handlers/brla-onramp-mint-handler.ts b/apps/api/src/api/services/phases/handlers/brla-onramp-mint-handler.ts index 016ae5846..a82dfd06b 100644 --- a/apps/api/src/api/services/phases/handlers/brla-onramp-mint-handler.ts +++ b/apps/api/src/api/services/phases/handlers/brla-onramp-mint-handler.ts @@ -23,6 +23,7 @@ import RampState from "../../../../models/rampState.model"; import TaxId from "../../../../models/taxId.model"; import { APIError } from "../../../errors/api-error"; import { BasePhaseHandler } from "../base-phase-handler"; +import { syncAveniaOnHoldState } from "../helpers/brla-onramp-hold"; import { StateMetadata } from "../meta-state-types"; // The rationale for these difference is that it allows for a finer check over the payment timeout in @@ -30,6 +31,7 @@ import { StateMetadata } from "../meta-state-types"; // process loop and check for the operation timestamp. const PAYMENT_TIMEOUT_MS = 30 * 60 * 1000; // 30 minutes const EVM_BALANCE_CHECK_TIMEOUT_MS = 5 * 60 * 1000; // 5 minutes +const AVENIA_HOLD_STATUS_CHECK_INTERVAL_MS = 60 * 1000; // 1 minute // The pre-computed expected amount stored at quote-creation time can be slightly higher than the // amount actually transferred due to fee differences at execution time. We allow a 5% tolerance @@ -85,9 +87,7 @@ export class BrlaOnrampMintHandler extends BasePhaseHandler { // transferred to the ephemeral. We accept a balance of at least 95% of the // pre-computed expected amount to account for fee differences between quote // creation time and execution time. - const recoveryThresholdRaw = new Big(preComputedExpectedAmountRaw) - .times(EPHEMERAL_FUNDED_TOLERANCE_FACTOR) - .toFixed(0, 0); + const recoveryThresholdRaw = new Big(preComputedExpectedAmountRaw).times(EPHEMERAL_FUNDED_TOLERANCE_FACTOR).toFixed(0, 0); if (await this.ephemeralAlreadyFunded(tokenDetails.erc20AddressSourceChain, evmEphemeralAddress, recoveryThresholdRaw)) { logger.info( @@ -97,6 +97,7 @@ export class BrlaOnrampMintHandler extends BasePhaseHandler { } const brlaApiService = BrlaApiService.getInstance(); + let lastAveniaHoldStatusCheckAt = 0; try { logger.info( `BrlaOnrampMintHandler: Waiting for Avenia balance to have at least ${quote.metadata.aveniaMint.outputAmountDecimal} BRL` @@ -107,6 +108,28 @@ export class BrlaOnrampMintHandler extends BasePhaseHandler { return false; } + const now = Date.now(); + if (now - lastAveniaHoldStatusCheckAt >= AVENIA_HOLD_STATUS_CHECK_INTERVAL_MS) { + lastAveniaHoldStatusCheckAt = now; + const ticketFound = await syncAveniaOnHoldState( + state.state, + updatedState => + state.update({ + state: { + ...state.state, + ...updatedState + } + }), + brlaApiService, + taxIdRecord.subAccountId + ); + if (!ticketFound) { + logger.warn( + `BrlaOnrampMintHandler: Avenia ticket ${state.state.aveniaTicketId} was not found while checking hold status.` + ); + } + } + // Check internal balance of Avenia subaccount const { balances } = await brlaApiService.getAccountBalance(taxIdRecord.subAccountId); if (!balances || balances.BRLA === undefined || balances.BRLA === null) { @@ -149,10 +172,7 @@ export class BrlaOnrampMintHandler extends BasePhaseHandler { // Derive the expected on-chain amount from the live quote's outputAmount rather than // the stale pre-computed metadata value. The live quote accounts for the actual fees // applied at execution time, so this is the amount that will truly arrive on Base. - const expectedAmountReceived = multiplyByPowerOfTen( - new Big(aveniaQuote.outputAmount), - tokenDetails.decimals - ).toFixed(0, 0); + const expectedAmountReceived = multiplyByPowerOfTen(new Big(aveniaQuote.outputAmount), tokenDetails.decimals).toFixed(0, 0); logger.info( `BrlaOnrampMintHandler: Live Avenia quote output is ${aveniaQuote.outputAmount} BRLA (raw: ${expectedAmountReceived}). Pre-computed metadata value was ${preComputedExpectedAmountRaw}.` diff --git a/apps/api/src/api/services/phases/handlers/destination-transfer-handler.ts b/apps/api/src/api/services/phases/handlers/destination-transfer-handler.ts index fc639b609..eeb09cf77 100644 --- a/apps/api/src/api/services/phases/handlers/destination-transfer-handler.ts +++ b/apps/api/src/api/services/phases/handlers/destination-transfer-handler.ts @@ -11,6 +11,7 @@ import { decodeFunctionData, erc20Abi, parseTransaction } from "viem"; import logger from "../../../../config/logger"; import QuoteTicket from "../../../../models/quoteTicket.model"; import RampState from "../../../../models/rampState.model"; +import { UnrecoverablePhaseError } from "../../../errors/phase-error"; import { BasePhaseHandler } from "../base-phase-handler"; import { StateMetadata } from "../meta-state-types"; @@ -77,7 +78,7 @@ export class DestinationTransferHandler extends BasePhaseHandler { } const { txData: destinationTransfer } = this.getPresignedTransaction(state, "destinationTransfer"); - const expectedAmountRaw = multiplyByPowerOfTen(quote.outputAmount, outTokenDetails.decimals).toString(); + const expectedAmountRaw = multiplyByPowerOfTen(quote.outputAmount, outTokenDetails.decimals).toFixed(0, 0); const destinationNetwork = quote.network as EvmNetworks; // We can assert this type due to checks before const { destinationTransferTxHash, destinationAddress } = state.state as StateMetadata; @@ -104,6 +105,43 @@ export class DestinationTransferHandler extends BasePhaseHandler { } } + // Nonce-gap guard: a presigned nonce ahead of the live ephemeral nonce can never be mined and would + // silently retry until the processor gives up, stranding user funds. Raise it for manual review. + // Reading the live nonce is best-effort: an RPC failure must not block the happy path. + if (!destinationTransferTxHash && state.state.evmEphemeralAddress) { + try { + const presignedNonce = parseTransaction(destinationTransfer as `0x${string}`).nonce; + if (presignedNonce !== undefined) { + try { + const liveNonce = await evmClientManager.getClient(destinationNetwork).getTransactionCount({ + address: state.state.evmEphemeralAddress as `0x${string}`, + blockTag: "pending" + }); + if (presignedNonce > liveNonce) { + throw this.createUnrecoverableError( + `DestinationTransferHandler: presigned nonce ${presignedNonce} is ahead of the ephemeral live nonce ${liveNonce}. ` + + "The transfer can never broadcast (nonce gap); manual review required." + ); + } + } catch (error) { + if (error instanceof UnrecoverablePhaseError) { + throw error; + } + logger.warn( + `DestinationTransferHandler: could not verify ephemeral nonce before broadcast - ${(error as Error).message}` + ); + } + } + } catch (error) { + if (error instanceof UnrecoverablePhaseError) { + throw error; + } + logger.warn( + `DestinationTransferHandler: could not parse presigned destination transfer for nonce check - ${(error as Error).message}` + ); + } + } + // main phase execution loop: try { await checkEvmBalanceForToken({ diff --git a/apps/api/src/api/services/phases/handlers/distribute-fees-handler.ts b/apps/api/src/api/services/phases/handlers/distribute-fees-handler.ts index 463720e3f..b88456f7f 100644 --- a/apps/api/src/api/services/phases/handlers/distribute-fees-handler.ts +++ b/apps/api/src/api/services/phases/handlers/distribute-fees-handler.ts @@ -78,8 +78,8 @@ export class DistributeFeesHandler extends BasePhaseHandler { // Check if we already have a hash stored const existingHash = state.state.distributeFeeHash || null; - // For BRL flows, distribution happens on EVM (Base). - const isEvmTransaction = quote.inputCurrency === "BRL" || quote.outputCurrency === "BRL"; + // For EVM-ephemeral flows (BRL, Mykobo EUR, ...), distribution happens on EVM (Base). + const isEvmTransaction = !!quote.metadata.nablaSwapEvm; const evmNetwork = isEvmTransaction ? (Networks.Base as EvmNetworks) : undefined; if (existingHash) { diff --git a/apps/api/src/api/services/phases/handlers/final-settlement-subsidy.ts b/apps/api/src/api/services/phases/handlers/final-settlement-subsidy.ts index 24fa55e9b..8ebe2b380 100644 --- a/apps/api/src/api/services/phases/handlers/final-settlement-subsidy.ts +++ b/apps/api/src/api/services/phases/handlers/final-settlement-subsidy.ts @@ -28,11 +28,14 @@ import { MAX_FINAL_SETTLEMENT_SUBSIDY_USD } from "../../../../constants/constant import QuoteTicket from "../../../../models/quoteTicket.model"; import RampState from "../../../../models/rampState.model"; import { priceFeedService } from "../../priceFeed.service"; +import { isFiatToOwnStablecoinBaseDirect } from "../../quote/utils"; import { BasePhaseHandler } from "../base-phase-handler"; import { getEvmFundingAccount } from "../evm-funding"; const BALANCE_POLLING_TIME_MS = 5000; const EVM_BALANCE_CHECK_TIMEOUT_MS = 3 * 60 * 1000; // 3 minutes +// Wait for >=90% of expected bridge delivery to absorb slippage while still waiting for actual bridge arrival. +const MIN_BRIDGE_DELIVERY_RATIO = 0.9; const NATIVE_TOKENS: Record = { [Networks.Ethereum]: { decimals: 18, symbol: "ETH" }, @@ -62,17 +65,32 @@ export class FinalSettlementSubsidyHandler extends BasePhaseHandler { protected async executePhase(state: RampState): Promise { logger.debug(`FinalSettlementSubsidyHandler: Starting phase execution for ramp ${state.id}, type=${state.type}`); - const evmClientManager = EvmClientManager.getInstance(); - const fundingAccount = getEvmFundingAccount(Networks.Moonbeam); const quote = await QuoteTicket.findByPk(state.quoteId); if (!quote) { throw new Error("FinalSettlementSubsidyHandler: Quote not found for the given state"); } + + if ( + state.state.isDirectTransfer === true && + !(state.type === RampDirection.SELL && isAlfredpayToken(quote.outputCurrency as FiatToken)) + ) { + logger.info(`FinalSettlementSubsidyHandler: Skipping subsidy for direct-transfer ramp ${state.id}`); + return this.transitionToNextPhase(state, this.getNextPhase(state, quote)); + } + + const evmClientManager = EvmClientManager.getInstance(); + const fundingAccount = getEvmFundingAccount(Networks.Moonbeam); + logger.debug( `FinalSettlementSubsidyHandler: Quote found. inputCurrency=${quote.inputCurrency}, outputCurrency=${quote.outputCurrency}, network=${quote.network}` ); + if (isFiatToOwnStablecoinBaseDirect(quote.inputCurrency, quote.outputCurrency, quote.network)) { + logger.info(`FinalSettlementSubsidyHandler: Skipping subsidy for Base direct-transfer route (ramp ${state.id})`); + return this.transitionToNextPhase(state, this.getNextPhase(state, quote)); + } + const isAlfredpaySell = state.type === RampDirection.SELL && isAlfredpayToken(quote.outputCurrency as FiatToken); const outTokenDetails = @@ -138,7 +156,7 @@ export class FinalSettlementSubsidyHandler extends BasePhaseHandler { `FinalSettlementSubsidyHandler: Polling ephemeral balance for ${ephemeralAddress} on ${destinationNetwork} (timeout=${EVM_BALANCE_CHECK_TIMEOUT_MS}ms, interval=${BALANCE_POLLING_TIME_MS}ms)` ); const actualBalance = await checkEvmBalanceForToken({ - amountDesiredRaw: "1", // If we passed expectedAmountRaw, we might timeout if the bridge slipped and delivered slightly less. + amountDesiredRaw: expectedAmountRaw.mul(MIN_BRIDGE_DELIVERY_RATIO).toFixed(0, 0), chain: destinationNetwork, intervalMs: BALANCE_POLLING_TIME_MS, ownerAddress: ephemeralAddress, @@ -147,6 +165,10 @@ export class FinalSettlementSubsidyHandler extends BasePhaseHandler { }); logger.debug(`FinalSettlementSubsidyHandler: Ephemeral balance=${actualBalance.toString()}`); + const preBalance = new Big(state.state.preSettlementBalance ?? "0"); + const deliveredRaw = actualBalance.minus(preBalance); + const delivered = deliveredRaw.gte(0) ? deliveredRaw : new Big(0); + // 3. Check funding account balance (handles both native and ERC-20 automatically) logger.debug(`FinalSettlementSubsidyHandler: Checking funding account balance at ${fundingAccount.address}`); const actualBalanceFundingAccount = await getEvmBalance({ @@ -156,14 +178,14 @@ export class FinalSettlementSubsidyHandler extends BasePhaseHandler { }); logger.debug(`FinalSettlementSubsidyHandler: Funding account balance=${actualBalanceFundingAccount.toString()}`); - const subsidyAmountRaw = expectedAmountRaw.minus(actualBalance); + const subsidyAmountRaw = expectedAmountRaw.minus(delivered); logger.debug( - `FinalSettlementSubsidyHandler: subsidyAmountRaw=${subsidyAmountRaw.toString()} (expected=${expectedAmountRaw.toString()} - actual=${actualBalance.toString()})` + `FinalSettlementSubsidyHandler: subsidyAmountRaw=${subsidyAmountRaw.toString()} (expected=${expectedAmountRaw.toString()} - delivered=${delivered.toString()}, actualBalance=${actualBalance.toString()}, preSettlementBalance=${preBalance.toString()})` ); if (subsidyAmountRaw.lte(0)) { logger.info( - `FinalSettlementSubsidyHandler: Actual balance (${actualBalance.toString()}) meets expected amount. No subsidy needed.` + `FinalSettlementSubsidyHandler: Delivered amount (${delivered.toString()}) meets expected amount with actualBalance=${actualBalance.toString()} and preSettlementBalance=${preBalance.toString()}. No subsidy needed.` ); return this.transitionToNextPhase(state, this.getNextPhase(state, quote)); } diff --git a/apps/api/src/api/services/phases/handlers/fund-ephemeral-handler.ts b/apps/api/src/api/services/phases/handlers/fund-ephemeral-handler.ts index 0e413f750..8cc7737aa 100644 --- a/apps/api/src/api/services/phases/handlers/fund-ephemeral-handler.ts +++ b/apps/api/src/api/services/phases/handlers/fund-ephemeral-handler.ts @@ -11,7 +11,6 @@ import { RampPhase, waitUntilTrueWithTimeout } from "@vortexfi/shared"; -import { NetworkError, Transaction } from "stellar-sdk"; import { type Hex, parseTransaction } from "viem"; import logger from "../../../../config/logger"; import { @@ -24,32 +23,19 @@ import RampState from "../../../../models/rampState.model"; import { UnrecoverablePhaseError } from "../../../errors/phase-error"; import { multiplyByPowerOfTen } from "../../pendulum/helpers"; import { fundEphemeralAccount } from "../../pendulum/pendulum.service"; +import { isFiatToOwnStablecoinBaseDirect } from "../../quote/utils"; import { BasePhaseHandler } from "../base-phase-handler"; import { getEvmFundingAccount } from "../evm-funding"; -import { validateStellarPaymentSequenceNumber } from "../helpers/stellar-sequence-validator"; import { verifyUserSubmittedTxByHash } from "../helpers/user-tx-verifier"; import { StateMetadata } from "../meta-state-types"; import { DESTINATION_EVM_FUNDING_AMOUNTS, - horizonServer, isBaseEphemeralFunded, isDestinationEvmEphemeralFunded, isPendulumEphemeralFunded, - isPolygonEphemeralFunded, - isStellarEphemeralFunded, - NETWORK_PASSPHRASE + isPolygonEphemeralFunded } from "./helpers"; -export function isStellarNetworkError(error: unknown): error is NetworkError { - return ( - error instanceof Error && - "response" in error && - error.response !== null && - typeof error.response === "object" && - "data" in error.response - ); -} - function isOnramp(state: RampState): boolean { return state.type === RampDirection.BUY; } @@ -60,13 +46,11 @@ export class FundEphemeralPhaseHandler extends BasePhaseHandler { } protected getRequiresPendulumEphemeralAddress(state: RampState, inputCurrency?: string, outputCurrency?: string): boolean { - // Pendulum ephemeral address is required for all cases except when doing a Monerium/Alfredpay to EVM onramp, - // or alfredpay offramp - if ( - isOnramp(state) && - (inputCurrency === FiatToken.EURC || isAlfredpayToken(inputCurrency as FiatToken)) && - state.to !== Networks.AssetHub - ) { + if (inputCurrency === FiatToken.EURC || outputCurrency === FiatToken.EURC) { + return false; + } + + if (isOnramp(state) && isAlfredpayToken(inputCurrency as FiatToken) && state.to !== Networks.AssetHub) { return false; } @@ -81,8 +65,8 @@ export class FundEphemeralPhaseHandler extends BasePhaseHandler { } protected getRequiresPolygonEphemeralAddress(state: RampState, inputCurrency?: string, outputCurrency?: string): boolean { - // Only required for Monerium and Alfredpay onramps and offramps. - if (isOnramp(state) && (inputCurrency === FiatToken.EURC || isAlfredpayToken(inputCurrency as FiatToken))) { + // Only required for Alfredpay onramps and offramps. Mykobo (EUR) runs on Base, not Polygon. + if (isOnramp(state) && isAlfredpayToken(inputCurrency as FiatToken)) { return true; } if (!isOnramp(state) && isAlfredpayToken(outputCurrency as FiatToken)) { @@ -93,10 +77,12 @@ export class FundEphemeralPhaseHandler extends BasePhaseHandler { } protected getRequiresBaseEphemeralAddress(inputCurrency?: string, outputCurrency?: string): boolean { - // Only required for BRLA onramps. if (inputCurrency === FiatToken.BRL || outputCurrency === FiatToken.BRL) { return true; } + if (inputCurrency === FiatToken.EURC || outputCurrency === FiatToken.EURC) { + return true; + } return false; } @@ -124,6 +110,23 @@ export class FundEphemeralPhaseHandler extends BasePhaseHandler { const fromNetwork = state.from as EvmNetworks; if (!isNetworkEVM(fromNetwork)) return; + // Base+USDC direct path: the user broadcasts a single ERC20 transfer instead of squid + // approve+swap. Verify that hash before we fund the ephemeral and spend gas on Nabla. + const hasNoPermitTransferBlueprint = state.unsignedTxs.some(tx => tx.phase === "squidRouterNoPermitTransfer"); + if (hasNoPermitTransferBlueprint) { + await verifyUserSubmittedTxByHash({ + fromNetwork, + hash: state.state.squidRouterNoPermitTransferHash as `0x${string}` | undefined, + label: "User direct USDC transfer to ephemeral", + presignedPhase: "squidRouterNoPermitTransfer", + state + }); + return; + } + + const hasSquidApproveBlueprint = state.unsignedTxs.some(tx => tx.phase === "squidRouterApprove"); + if (!hasSquidApproveBlueprint) return; + await verifyUserSubmittedTxByHash({ fromNetwork, hash: state.state.squidRouterApproveHash as `0x${string}` | undefined, @@ -191,16 +194,6 @@ export class FundEphemeralPhaseHandler extends BasePhaseHandler { ? await isDestinationEvmEphemeralFunded(evmEphemeralAddress, destinationNetwork) : true; - if (state.state.stellarTarget) { - const isFunded = await isStellarEphemeralFunded( - state.state.stellarEphemeralAccountId, - state.state.stellarTarget.stellarTokenDetails - ); - if (!isFunded) { - await this.fundStellarEphemeralAccount(state); - } - } - if (!isPendulumFunded) { logger.info(`Funding PEN ephemeral account ${substrateEphemeralAddress}`); if (isOnramp(state) && state.to !== Networks.AssetHub) { @@ -248,18 +241,26 @@ export class FundEphemeralPhaseHandler extends BasePhaseHandler { } protected nextPhaseSelector(state: RampState, quote: QuoteTicket): RampPhase { + if ( + (state.state.isDirectTransfer === true && + !(state.type === RampDirection.SELL && isAlfredpayToken(quote.outputCurrency as FiatToken))) || + (isOnramp(state) && isFiatToOwnStablecoinBaseDirect(quote.inputCurrency, quote.outputCurrency, quote.network)) + ) { + return "destinationTransfer"; + } + // brla onramp case if (isOnramp(state) && quote.inputCurrency === FiatToken.BRL) { return "subsidizePreSwap"; } + // mykobo (EURC) onramp case + if (isOnramp(state) && quote.inputCurrency === FiatToken.EURC) { + return "subsidizePreSwap"; + } // alfredpay onramp case if (isOnramp(state) && isAlfredpayToken(quote.inputCurrency as FiatToken)) { return "subsidizePreSwap"; } - // monerium onramp case - if (isOnramp(state) && quote.inputCurrency === FiatToken.EURC) { - return "moneriumOnrampSelfTransfer"; - } // off ramp cases if (state.type === RampDirection.SELL && state.from === Networks.AssetHub) { @@ -268,70 +269,13 @@ export class FundEphemeralPhaseHandler extends BasePhaseHandler { return "finalSettlementSubsidy"; } else if (state.type === RampDirection.SELL && quote.outputCurrency === FiatToken.BRL) { return "distributeFees"; + } else if (state.type === RampDirection.SELL && quote.outputCurrency === FiatToken.EURC) { + return "distributeFees"; } else { return "moonbeamToPendulum"; // Via contract.subsidizePreSwap } } - protected async fundStellarEphemeralAccount(state: RampState): Promise { - const { txData: stellarCreationTransactionXDR } = this.getPresignedTransaction(state, "stellarCreateAccount"); - if (typeof stellarCreationTransactionXDR !== "string") { - throw new Error( - "FundEphemeralHandler: `stellarCreateAccount` transaction is not a string -> not an encoded Stellar transaction." - ); - } - - try { - const stellarCreationTransaction = new Transaction(stellarCreationTransactionXDR, NETWORK_PASSPHRASE); - logger.info( - `Submitting stellar account creation transaction to create ephemeral account: ${state.state.stellarEphemeralAccountId}` - ); - await horizonServer.submitTransaction(stellarCreationTransaction); - - logger.info("Validating stellar payment sequence number after account creation"); - try { - await validateStellarPaymentSequenceNumber(state, state.state.stellarEphemeralAccountId); - } catch (validationError) { - logger.error(`Stellar payment sequence validation failed after account creation: ${validationError}`); - throw this.createUnrecoverableError("Stellar payment sequence validation failed after account creation"); - } - } catch (e) { - if (e instanceof UnrecoverablePhaseError) { - throw e; - } - - // when validateStellarPaymentSequenceNumber throws an error, it's not NetworkError - if (isStellarNetworkError(e)) { - if (e.response.data?.status === 400) { - logger.info( - `Could not submit the stellar account creation transaction ${JSON.stringify(e.response.data.extras.result_codes)}` - ); - - // TODO this error may need adjustment, as the `tx_bad_seq` may be due to parallel ramps and ephemeral creations. - if (e.response.data.extras.result_codes.transaction === "tx_bad_seq") { - logger.info("Recovery mode: Creation already performed."); - - try { - logger.info("Validating stellar payment sequence number in recovery mode"); - await validateStellarPaymentSequenceNumber(state, state.state.stellarEphemeralAccountId); - } catch (validationError) { - logger.error(`Sequence number validation failed in recovery mode: ${validationError}`); - throw this.createUnrecoverableError("Stellar payment sequence validation failed after account creation recovery"); - } - } - logger.error(`Could not submit the stellar creation transaction: ${e.response.data.extras}`); - throw new Error("Could not submit the stellar creation transaction"); - } else { - logger.error(`Could not submit the stellar creation transaction: ${e.response.data}`); - throw new Error("Could not submit the stellar creation transaction"); - } - } else { - logger.error(`Error in stellar account creation: ${e}`); - throw new Error("Could not submit the stellar creation transaction"); - } - } - } - protected async fundEvmEphemeralAccount(state: RampState, network: EvmNetworks): Promise { try { const evmClientManager = EvmClientManager.getInstance(); diff --git a/apps/api/src/api/services/phases/handlers/helpers.ts b/apps/api/src/api/services/phases/handlers/helpers.ts index bdf637285..f745eed0d 100644 --- a/apps/api/src/api/services/phases/handlers/helpers.ts +++ b/apps/api/src/api/services/phases/handlers/helpers.ts @@ -1,16 +1,6 @@ -import { - API, - EvmClientManager, - EvmNetworks, - HORIZON_URL, - StellarTokenDetails, - Networks as VortexNetworks -} from "@vortexfi/shared"; +import { API, EvmClientManager, EvmNetworks, Networks as VortexNetworks } from "@vortexfi/shared"; import Big from "big.js"; -import { Horizon, Networks } from "stellar-sdk"; import { base, polygon } from "viem/chains"; -import logger from "../../../../config/logger"; -import { config } from "../../../../config/vars"; import { BASE_EPHEMERAL_STARTING_BALANCE_UNITS, GLMR_FUNDING_AMOUNT_RAW, @@ -19,32 +9,6 @@ import { } from "../../../../constants/constants"; import { multiplyByPowerOfTen } from "../../pendulum/helpers"; -export const horizonServer = new Horizon.Server(HORIZON_URL); -export const NETWORK_PASSPHRASE = config.sandboxEnabled ? Networks.TESTNET : Networks.PUBLIC; - -export async function isStellarEphemeralFunded(accountId: string, stellarTokenDetails: StellarTokenDetails): Promise { - try { - // We check if the Stellar target account exists and has the respective trustline. - const account = await horizonServer.loadAccount(accountId); - - const trustlineExists = account.balances.some( - balance => - balance.asset_type === "credit_alphanum4" && - balance.asset_code === stellarTokenDetails.stellarAsset.code.string && - balance.asset_issuer === stellarTokenDetails.stellarAsset.issuer.stellarEncoding - ); - return trustlineExists; - } catch (error) { - if (error?.toString().includes("NotFoundError")) { - logger.info(`Stellar target account ${accountId} does not exist.`); - return false; - } else { - // We return an error here to ensure that the phase fails and can be retried. - throw new Error(`${error?.toString()} while checking Stellar target account.`); - } - } -} - export async function isPendulumEphemeralFunded(pendulumEphemeralAddress: string, pendulumNode: API): Promise { const fundingAmountUnits = Big(PENDULUM_EPHEMERAL_STARTING_BALANCE_UNITS); const fundingAmountRaw = multiplyByPowerOfTen(fundingAmountUnits, pendulumNode.decimals).toFixed(); diff --git a/apps/api/src/api/services/phases/handlers/initial-phase-handler.ts b/apps/api/src/api/services/phases/handlers/initial-phase-handler.ts index 0711ad87c..d3ccd8d34 100644 --- a/apps/api/src/api/services/phases/handlers/initial-phase-handler.ts +++ b/apps/api/src/api/services/phases/handlers/initial-phase-handler.ts @@ -37,7 +37,7 @@ export class InitialPhaseHandler extends BasePhaseHandler { if (state.type === RampDirection.BUY && quote.inputCurrency === FiatToken.BRL) { return this.transitionToNextPhase(state, "brlaOnrampMint"); } else if (state.type === RampDirection.BUY && quote.inputCurrency === FiatToken.EURC) { - return this.transitionToNextPhase(state, "moneriumOnrampMint"); + return this.transitionToNextPhase(state, "mykoboOnrampDeposit"); } else if (state.type === RampDirection.BUY && isAlfredpayToken(quote.inputCurrency as FiatToken)) { return this.transitionToNextPhase(state, "alfredpayOnrampMint"); } else if (state.type === RampDirection.SELL && isAlfredpayToken(quote.outputCurrency as FiatToken)) { diff --git a/apps/api/src/api/services/phases/handlers/monerium-onramp-mint-handler.ts b/apps/api/src/api/services/phases/handlers/monerium-onramp-mint-handler.ts deleted file mode 100644 index eea5dbc1c..000000000 --- a/apps/api/src/api/services/phases/handlers/monerium-onramp-mint-handler.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { - BalanceCheckError, - BalanceCheckErrorType, - checkEvmBalancePeriodically, - ERC20_EURE_POLYGON_V2, - Networks, - RampPhase -} from "@vortexfi/shared"; -import logger from "../../../../config/logger"; -import QuoteTicket from "../../../../models/quoteTicket.model"; -import RampState from "../../../../models/rampState.model"; -import { BasePhaseHandler } from "../base-phase-handler"; -import { StateMetadata } from "../meta-state-types"; - -// Same rationale as in brla-onramp-mint-handler.ts -const PAYMENT_TIMEOUT_MS = 30 * 60 * 1000; // 30 minutes -const EVM_BALANCE_CHECK_TIMEOUT_MS = 5 * 60 * 1000; // 5 minutes - -export class MoneriumOnrampMintPhaseHandler extends BasePhaseHandler { - public getPhaseName(): RampPhase { - return "moneriumOnrampMint"; - } - - protected async executePhase(state: RampState): Promise { - const { moneriumWalletAddress: walletAddress } = state.state as StateMetadata; - - if (!walletAddress) { - throw new Error("MoneriumOnrampMintPhaseHandler: State metadata corrupted. This is a bug."); - } - - const quote = await QuoteTicket.findByPk(state.quoteId); - if (!quote) { - throw new Error("Quote not found for the given state"); - } - - if (!quote.metadata.moneriumMint?.outputAmountRaw) { - throw new Error("MoneriumOnrampMintPhaseHandler: Missing moneriumMint metadata."); - } - - const inputAmountBeforeSwapRaw = quote.metadata.moneriumMint.outputAmountRaw; - - try { - const pollingTimeMs = 1000; - - await checkEvmBalancePeriodically( - ERC20_EURE_POLYGON_V2, - walletAddress, - inputAmountBeforeSwapRaw, - pollingTimeMs, - EVM_BALANCE_CHECK_TIMEOUT_MS, - Networks.Polygon - ); - - // Add delay to ensure the transaction is settled - await new Promise(resolve => setTimeout(resolve, 30000)); // 30 seconds. - } catch (error) { - if (!(error instanceof BalanceCheckError)) throw error; - - const isCheckTimeout = error.type === BalanceCheckErrorType.Timeout; - if (isCheckTimeout && this.isPaymentTimeoutReached(state)) { - logger.error("Payment timeout. Cancelling ramp."); - - return this.transitionToNextPhase(state, "failed"); - } - - throw isCheckTimeout - ? this.createRecoverableError(`MoneriumOnrampMintPhaseHandler: ${error}`) - : new Error(`Error checking Moonbeam balance: ${error}`); - } - - return this.transitionToNextPhase(state, "fundEphemeral"); - } - - protected isPaymentTimeoutReached(state: RampState): boolean { - const thisPhaseEntry = state.phaseHistory.find(phaseHistoryEntry => phaseHistoryEntry.phase === this.getPhaseName()); - if (!thisPhaseEntry) { - throw new Error("MoneriumOnrampMintPhaseHandler: Phase not found in history. State corrupted."); - } - - const initialTimestamp = new Date(thisPhaseEntry.timestamp); - if (initialTimestamp.getTime() + PAYMENT_TIMEOUT_MS < Date.now()) { - return true; - } - return false; - } -} - -export default new MoneriumOnrampMintPhaseHandler(); diff --git a/apps/api/src/api/services/phases/handlers/monerium-onramp-self-transfer-handler.ts b/apps/api/src/api/services/phases/handlers/monerium-onramp-self-transfer-handler.ts deleted file mode 100644 index 40e5db926..000000000 --- a/apps/api/src/api/services/phases/handlers/monerium-onramp-self-transfer-handler.ts +++ /dev/null @@ -1,428 +0,0 @@ -import { - ERC20_EURE_POLYGON_TOKEN_NAME, - ERC20_EURE_POLYGON_V2, - EvmClientManager, - getEvmTokenBalance, - getNetworkId, - Networks, - RampDirection, - RampPhase -} from "@vortexfi/shared"; -import Big from "big.js"; -import { encodeFunctionData, isAddress, PublicClient, TransactionReceipt } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import logger from "../../../../config/logger"; -import { config } from "../../../../config/vars"; -import erc20ABI from "../../../../contracts/ERC20"; -import { permitAbi } from "../../../../contracts/PermitAbi"; -import QuoteTicket from "../../../../models/quoteTicket.model"; -import RampState from "../../../../models/rampState.model"; -import { analyzeMoneriumPermitPreflight, MoneriumPermitDiagnostics } from "../../ramp/monerium-permit"; -import { inspectMoneriumSelfTransferTransaction, moneriumTransferFromAbi } from "../../ramp/monerium-self-transfer"; -import { BasePhaseHandler } from "../base-phase-handler"; - -const permitNonceAbi = [ - { - inputs: [{ name: "owner", type: "address" }], - name: "nonces", - outputs: [{ name: "", type: "uint256" }], - stateMutability: "view", - type: "function" - } -] as const; - -/** - * Handler for the monerium self-transfer phase - */ -export class MoneriumOnrampSelfTransferHandler extends BasePhaseHandler { - private polygonClient: PublicClient; - private evmClientManager: EvmClientManager; - - constructor() { - super(); - this.evmClientManager = EvmClientManager.getInstance(); - this.polygonClient = this.evmClientManager.getClient(Networks.Polygon); - } - - /** - * Get the phase name - */ - public getPhaseName(): RampPhase { - return "moneriumOnrampSelfTransfer"; - } - - /** - * Execute the phase - * @param state The current ramp state - * @returns The updated ramp state - */ - protected async executePhase(state: RampState): Promise { - logger.info(`Executing moneriumOnrampSelfTransfer phase for ramp ${state.id}`); - - if (state.type === RampDirection.SELL) { - logger.info("MoneriumOnrampSelfTransfer phase is not supported for off-ramp"); - return state; - } - - const quote = await QuoteTicket.findByPk(state.quoteId); - if (!quote) { - throw new Error("Quote not found for the given state"); - } - - if (!quote.metadata.moneriumMint?.outputAmountRaw) { - throw new Error("MoneriumOnrampSelfTransfer: Missing moneriumMint metadata."); - } - - const { evmEphemeralAddress, moneriumOnrampPermit, moneriumWalletAddress } = state.state; - if (!evmEphemeralAddress) { - throw new Error("MoneriumOnrampSelfTransfer: Polygon ephemeral address not defined in the state. This is a bug."); - } - if (!moneriumOnrampPermit) { - throw new Error("MoneriumOnrampSelfTransfer: Missing Monerium permit in state metadata. State corrupted."); - } - if (!moneriumWalletAddress) { - throw new Error("MoneriumOnrampSelfTransfer: Missing Monerium wallet address in state metadata. State corrupted."); - } - - const mintedAmountRaw = quote.metadata.moneriumMint.outputAmountRaw; - - const didTokensArriveOnEvm = async () => { - const balance = await getEvmTokenBalance({ - chain: Networks.Polygon, - ownerAddress: evmEphemeralAddress as `0x${string}`, - tokenAddress: ERC20_EURE_POLYGON_V2 - }); - return balance.gte(Big(mintedAmountRaw)); - }; - - try { - if (await didTokensArriveOnEvm()) { - logger.info(`Tokens have arrived on Polygon ephemeral address: ${evmEphemeralAddress}. Skipping self-transfer.`); - return this.transitionToNextPhase(state, "squidRouterSwap"); - } - } catch (error) { - // inability to check balance is not a critical error and should be temporal, we can proceed throw a recoverable. - throw this.createRecoverableError(`MoneriumOnrampSelfTransferHandler: Error checking Polygon balance: ${error}`); - } - - try { - const account = privateKeyToAccount(config.secrets.moonbeamExecutorPrivateKey as `0x${string}`); - if (!isAddress(account.address)) { - throw new Error(`Configured executor account produced invalid EVM address ${account.address}`); - } - const executorAddress = account.address as `0x${string}`; - let permitHash: string; - - if (state.state.permitTxHash) { - logger.info(`Permit transaction already sent with hash: ${state.state.permitTxHash}. Skipping permit sending.`); - permitHash = state.state.permitTxHash; - } else { - const owner = moneriumWalletAddress as `0x${string}`; - const spender = evmEphemeralAddress as `0x${string}`; - const permitExpectation = { - expectedOwner: owner, - expectedSpender: spender, - expectedTokenAddress: ERC20_EURE_POLYGON_V2, - expectedTokenName: ERC20_EURE_POLYGON_TOKEN_NAME, - expectedValueRaw: mintedAmountRaw, - network: Networks.Polygon - }; - const permitDiagnostics = await this.getPermitDiagnostics(owner, spender); - const signedPermitContext = moneriumOnrampPermit.context; - logger.info( - `[${state.id}] Monerium permit preflight: ${JSON.stringify({ - allowanceRaw: permitDiagnostics.allowanceRaw.toString(), - balanceRaw: permitDiagnostics.balanceRaw.toString(), - deadline: moneriumOnrampPermit.context?.deadline ?? moneriumOnrampPermit.deadline, - deadlineIso: new Date( - Number(moneriumOnrampPermit.context?.deadline ?? moneriumOnrampPermit.deadline) * 1000 - ).toISOString(), - executor: executorAddress, - expectedValueRaw: mintedAmountRaw, - nonce: permitDiagnostics.nonce.toString(), - owner, - signedChainId: signedPermitContext?.chainId, - signedNonce: signedPermitContext?.nonce, - signedTokenAddress: signedPermitContext?.tokenAddress, - signedTokenName: signedPermitContext?.tokenName, - signedTokenVersion: signedPermitContext?.tokenVersion, - signedValueRaw: signedPermitContext?.valueRaw, - spender, - tokenAddress: ERC20_EURE_POLYGON_V2, - tokenName: permitDiagnostics.tokenName - })}` - ); - - const permitPreflight = analyzeMoneriumPermitPreflight(moneriumOnrampPermit, permitExpectation, permitDiagnostics); - if (!permitPreflight.shouldSendPermit) { - logger.info( - `[${state.id}] Existing Monerium allowance covers ${mintedAmountRaw}. Skipping permit transaction (${permitPreflight.reason}).` - ); - } else if (permitDiagnostics.balanceRaw < BigInt(mintedAmountRaw)) { - logger.warn( - `[${state.id}] Monerium wallet balance ${permitDiagnostics.balanceRaw.toString()} is below expected transfer amount ${mintedAmountRaw}. Permit may still succeed, but transferFrom will wait for sufficient balance.` - ); - } - - const permitArgs = [ - owner, - spender, - BigInt(mintedAmountRaw), - moneriumOnrampPermit.deadline, - moneriumOnrampPermit.v, - moneriumOnrampPermit.r, - moneriumOnrampPermit.s - ] as const; - - if (!permitPreflight.shouldSendPermit) { - permitHash = ""; - } else { - await this.simulatePermit(state.id, executorAddress, permitArgs); - - const walletClient = this.evmClientManager.getWalletClient(Networks.Polygon, account); - permitHash = await walletClient.sendTransaction({ - data: encodeFunctionData({ - abi: permitAbi, - args: permitArgs, - functionName: "permit" - }), - to: ERC20_EURE_POLYGON_V2 - }); - } - } - - if (permitHash) { - logger.info(`Permit transaction executed with hash: ${permitHash}`); - - await this.waitForTransactionConfirmation(permitHash); - logger.info(`Permit transaction confirmed: ${permitHash}`); - - state.state.permitTxHash = permitHash; - await state.update({ state: state.state }); - } - - const transferTransaction = this.getPresignedTransaction(state, "moneriumOnrampSelfTransfer"); - - if (!transferTransaction) { - throw new Error("Missing presigned transactions for moneriumOnrampSelfTransfer phase. State corrupted."); - } - - let transferHash = state.state.moneriumOnrampSelfTransferHash; - if (transferHash) { - logger.info(`Transfer transaction already sent with hash: ${transferHash}. Waiting for confirmation.`); - } else { - await this.preflightSignedSelfTransfer( - state.id, - transferTransaction.txData as string, - moneriumWalletAddress as `0x${string}`, - evmEphemeralAddress as `0x${string}`, - mintedAmountRaw - ); - - // Execute the transfer transaction - transferHash = await this.executeTransaction(transferTransaction.txData as string); - state.state.moneriumOnrampSelfTransferHash = transferHash; - await state.update({ state: state.state }); - logger.info(`Transfer transaction executed with hash: ${transferHash}`); - } - - await this.waitForTransactionConfirmation(transferHash); - logger.info(`TransferFrom transaction confirmed: ${transferHash}`); - - // RPC nodes occasionally lag behind the chain tip; the next phase reads the ephemeral's - // EURe balance and would otherwise race against an under-replicated read replica. - logger.info("Waiting 30 seconds to ensure balance is updated..."); - await new Promise(resolve => setTimeout(resolve, 30000)); - - // Transition to the next phase - return this.transitionToNextPhase(state, "squidRouterSwap"); - } catch (error: unknown) { - logger.error(`Error in self-transfer phase for ramp ${state.id}:`, error); - throw this.createRecoverableError( - `MoneriumOnrampSelfTransferHandler: Error while sending self-transfer transaction: ${error}` - ); - } - } - - private async preflightSignedSelfTransfer( - rampId: string, - txData: string, - expectedOwner: `0x${string}`, - expectedSpender: `0x${string}`, - expectedAmountRaw: string - ): Promise { - const transfer = await inspectMoneriumSelfTransferTransaction(txData, { - expectedAmountRaw, - expectedChainId: getNetworkId(Networks.Polygon), - expectedOwner, - expectedRecipient: expectedSpender, - expectedSigner: expectedSpender, - expectedTokenAddress: ERC20_EURE_POLYGON_V2, - rampId - }); - const expectedAmount = BigInt(expectedAmountRaw); - - const transferDiagnostics = await this.getPermitDiagnostics(expectedOwner, expectedSpender); - const currentNonce = await this.polygonClient.getTransactionCount({ address: transfer.signer }); - let estimatedGas: bigint; - try { - estimatedGas = await this.polygonClient.estimateContractGas({ - abi: moneriumTransferFromAbi, - account: transfer.signer, - address: ERC20_EURE_POLYGON_V2, - args: [transfer.owner, transfer.recipient, transfer.amountRaw], - functionName: "transferFrom" - }); - } catch (error) { - throw new Error( - `[${rampId}] Self-transfer gas estimate failed before broadcast: ${error instanceof Error ? error.message : error}` - ); - } - - logger.info( - `[${rampId}] Monerium self-transfer preflight: ${JSON.stringify({ - allowanceRaw: transferDiagnostics.allowanceRaw.toString(), - amountRaw: expectedAmountRaw, - balanceRaw: transferDiagnostics.balanceRaw.toString(), - currentNonce, - estimatedGas: estimatedGas.toString(), - owner: transfer.owner, - recipient: transfer.recipient, - signedGas: transfer.signedGas.toString(), - signedNonce: transfer.signedNonce, - signer: transfer.signer, - tokenAddress: ERC20_EURE_POLYGON_V2 - })}` - ); - - if (currentNonce !== transfer.signedNonce) { - // Strict equality: a gap (currentNonce < signedNonce) would leave the broadcast tx stuck pending - // in mempool forever because the ephemeral account will never fill the missing nonces. - // A past nonce (currentNonce > signedNonce) means the tx was already consumed. - const reason = - currentNonce > transfer.signedNonce - ? `signed nonce ${transfer.signedNonce} has already been consumed (current nonce ${currentNonce}). Do not resend this raw transaction; regenerate the presigned self-transfer transaction or inspect the previous nonce-${transfer.signedNonce} transaction` - : `signed nonce ${transfer.signedNonce} is ahead of current account nonce ${currentNonce}. Broadcasting would stall the tx in mempool until the missing nonces are filled (which will never happen for an ephemeral account). Regenerate the presigned self-transfer transaction`; - throw new Error(`[${rampId}] Self-transfer ${reason} for signer ${transfer.signer}.`); - } - if (transferDiagnostics.allowanceRaw < expectedAmount) { - throw new Error( - `[${rampId}] Self-transfer allowance ${transferDiagnostics.allowanceRaw.toString()} is below expected ${expectedAmountRaw}` - ); - } - if (transferDiagnostics.balanceRaw < expectedAmount) { - throw new Error( - `[${rampId}] Self-transfer balance ${transferDiagnostics.balanceRaw.toString()} is below expected ${expectedAmountRaw}` - ); - } - if (transfer.signedGas < estimatedGas) { - throw new Error( - `[${rampId}] Self-transfer signed gas limit ${transfer.signedGas.toString()} is below estimated gas ${estimatedGas.toString()}` - ); - } - - try { - await this.polygonClient.simulateContract({ - abi: moneriumTransferFromAbi, - account: transfer.signer, - address: ERC20_EURE_POLYGON_V2, - args: [transfer.owner, transfer.recipient, transfer.amountRaw], - functionName: "transferFrom", - gas: transfer.signedGas - }); - } catch (error) { - throw new Error( - `[${rampId}] Self-transfer simulation failed before broadcast: ${error instanceof Error ? error.message : error}` - ); - } - } - - private async getPermitDiagnostics(owner: `0x${string}`, spender: `0x${string}`): Promise { - const [allowanceRaw, balanceRaw, nonce, tokenName] = await Promise.all([ - this.evmClientManager.readContractWithRetry(Networks.Polygon, { - abi: erc20ABI, - address: ERC20_EURE_POLYGON_V2, - args: [owner, spender], - functionName: "allowance" - }), - this.evmClientManager.readContractWithRetry(Networks.Polygon, { - abi: erc20ABI, - address: ERC20_EURE_POLYGON_V2, - args: [owner], - functionName: "balanceOf" - }), - this.evmClientManager.readContractWithRetry(Networks.Polygon, { - abi: permitNonceAbi, - address: ERC20_EURE_POLYGON_V2, - args: [owner], - functionName: "nonces" - }), - this.evmClientManager.readContractWithRetry(Networks.Polygon, { - abi: erc20ABI, - address: ERC20_EURE_POLYGON_V2, - functionName: "name" - }) - ]); - - return { allowanceRaw, balanceRaw, nonce, tokenName }; - } - - private async simulatePermit( - rampId: string, - executorAddress: `0x${string}`, - permitArgs: readonly [`0x${string}`, `0x${string}`, bigint, number, number, `0x${string}`, `0x${string}`] - ): Promise { - try { - await this.polygonClient.simulateContract({ - abi: permitAbi, - account: executorAddress, - address: ERC20_EURE_POLYGON_V2, - args: permitArgs, - functionName: "permit" - }); - } catch (error) { - throw new Error( - `[${rampId}] Monerium permit simulation failed before broadcast: ${error instanceof Error ? error.message : error}` - ); - } - } - - /** - * Execute a transaction - * @param txData The transaction data - * @returns The transaction hash - */ - private async executeTransaction(txData: string): Promise { - try { - const evmClientManager = EvmClientManager.getInstance(); - const txHash = await evmClientManager.sendRawTransactionWithRetry(Networks.Polygon, txData as `0x${string}`); - return txHash; - } catch (error) { - logger.error("Error sending raw transaction", error); - throw new Error("Failed to send transaction"); - } - } - - /** - * Wait for a transaction to be confirmed - * @param txHash The transaction hash - * @param chainId The chain ID - */ - private async waitForTransactionConfirmation(txHash: string): Promise { - try { - const receipt = await this.polygonClient.waitForTransactionReceipt({ - hash: txHash as `0x${string}` - }); - if (!receipt || receipt.status !== "success") { - throw new Error( - `moneriumOnrampSelfTransferHandler: Transaction ${txHash} failed or was not found (status: ${receipt?.status ?? "missing"}, block: ${receipt?.blockNumber?.toString() ?? "unknown"}, gasUsed: ${receipt?.gasUsed?.toString() ?? "unknown"})` - ); - } - return receipt; - } catch (error) { - throw new Error(`moneriumOnrampSelfTransferHandler: Error waiting for transaction confirmation: ${error}`); - } - } -} - -export default new MoneriumOnrampSelfTransferHandler(); diff --git a/apps/api/src/api/services/phases/handlers/mykobo-onramp-deposit-handler.ts b/apps/api/src/api/services/phases/handlers/mykobo-onramp-deposit-handler.ts new file mode 100644 index 000000000..ade234875 --- /dev/null +++ b/apps/api/src/api/services/phases/handlers/mykobo-onramp-deposit-handler.ts @@ -0,0 +1,145 @@ +import { + BalanceCheckError, + BalanceCheckErrorType, + checkEvmBalancePeriodically, + EvmAddress, + EvmToken, + evmTokenConfig, + getEvmTokenBalance, + Networks, + RampPhase +} from "@vortexfi/shared"; +import Big from "big.js"; +import logger from "../../../../config/logger"; +import QuoteTicket from "../../../../models/quoteTicket.model"; +import RampState from "../../../../models/rampState.model"; +import { BasePhaseHandler } from "../base-phase-handler"; +import { StateMetadata } from "../meta-state-types"; + +// Mykobo SEPA settlement can take significantly longer than card-based onramps. +// 24h is a generous upper bound matching SEPA business-day cutoffs. +const PAYMENT_TIMEOUT_MS = 24 * 60 * 60 * 1000; +const EVM_BALANCE_CHECK_TIMEOUT_MS = 5 * 60 * 1000; +const POLL_INTERVAL_MS = 5000; + +// The pre-computed deliveredEurc value stored at quote-creation time can be slightly +// higher than the amount actually transferred due to fee differences at execution time. +// Allow 5% tolerance in the recovery shortcut so an already-funded ephemeral is not missed. +const EPHEMERAL_FUNDED_TOLERANCE_FACTOR = 0.95; + +// Phase description: wait for the EURC to arrive at the Base ephemeral address from Mykobo's +// SEPA→on-chain settlement. If the timeout is reached, we assume the user has NOT made the +// SEPA transfer and we cancel the ramp. +export class MykoboOnrampDepositHandler extends BasePhaseHandler { + public getPhaseName(): RampPhase { + return "mykoboOnrampDeposit"; + } + + protected async executePhase(state: RampState): Promise { + const { evmEphemeralAddress } = state.state as StateMetadata; + + if (!evmEphemeralAddress) { + throw new Error("MykoboOnrampDepositHandler: Missing evmEphemeralAddress in state. This is a bug."); + } + + const quote = await QuoteTicket.findByPk(state.quoteId); + if (!quote) { + throw new Error("MykoboOnrampDepositHandler: Quote not found for the given state."); + } + + if (!quote.metadata.mykoboMint?.outputAmountRaw) { + throw new Error("MykoboOnrampDepositHandler: Missing 'mykoboMint.outputAmountRaw' in quote metadata."); + } + + const tokenDetails = evmTokenConfig[Networks.Base][EvmToken.EURC]; + if (!tokenDetails) { + throw new Error("MykoboOnrampDepositHandler: EURC token details not found for Base network."); + } + + const expectedAmountRaw = quote.metadata.mykoboMint.outputAmountRaw; + + // Recovery shortcut: a previous run may have already received Mykobo's settlement on the + // ephemeral. Accept a balance of at least 95% of the pre-computed expected amount to account + // for any fee variance between quote-creation time and settlement. + const recoveryThresholdRaw = new Big(expectedAmountRaw).times(EPHEMERAL_FUNDED_TOLERANCE_FACTOR).toFixed(0, 0); + + if (await this.ephemeralAlreadyFunded(tokenDetails.erc20AddressSourceChain, evmEphemeralAddress, recoveryThresholdRaw)) { + logger.info( + `MykoboOnrampDepositHandler: Ephemeral ${evmEphemeralAddress} already holds at least 95% of the expected ${expectedAmountRaw} EURC (threshold: ${recoveryThresholdRaw}). Skipping deposit wait.` + ); + return this.transitionToNextPhase(state, "fundEphemeral"); + } + + logger.info( + `MykoboOnrampDepositHandler: Waiting for ${expectedAmountRaw} (raw, ${tokenDetails.decimals} decimals) EURC ` + + `on Base at ephemeral address ${evmEphemeralAddress}.` + ); + + try { + await checkEvmBalancePeriodically( + tokenDetails.erc20AddressSourceChain, + evmEphemeralAddress, + expectedAmountRaw, + POLL_INTERVAL_MS, + EVM_BALANCE_CHECK_TIMEOUT_MS, + Networks.Base + ); + } catch (error) { + if (!(error instanceof BalanceCheckError)) { + throw new Error(`MykoboOnrampDepositHandler: Error checking Base EURC balance: ${error}`); + } + + const isCheckTimeout = error.type === BalanceCheckErrorType.Timeout; + if (isCheckTimeout && this.isPaymentTimeoutReached(state)) { + logger.error("MykoboOnrampDepositHandler: Payment timeout reached. Cancelling ramp."); + return this.transitionToNextPhase(state, "failed"); + } + + throw isCheckTimeout + ? this.createRecoverableError( + `MykoboOnrampDepositHandler: balance-check timeout reached waiting for Mykobo settlement: ${error}` + ) + : new Error(`MykoboOnrampDepositHandler: Error checking Base EURC balance: ${error}`); + } + + logger.info( + `MykoboOnrampDepositHandler: EURC deposit received on Base ephemeral ${evmEphemeralAddress}. Proceeding to fundEphemeral.` + ); + + return this.transitionToNextPhase(state, "fundEphemeral"); + } + + private async ephemeralAlreadyFunded( + tokenAddress: string, + ownerAddress: string, + expectedAmountRaw: string + ): Promise { + try { + const balance = await getEvmTokenBalance({ + chain: Networks.Base, + ownerAddress: ownerAddress as EvmAddress, + tokenAddress: tokenAddress as EvmAddress + }); + return balance.gte(new Big(expectedAmountRaw)); + } catch (error) { + // Treat read failures as "not funded" so we fall through to the regular flow + // rather than aborting the phase on a transient RPC error. + logger.warn( + `MykoboOnrampDepositHandler: ephemeral balance pre-check failed for ${ownerAddress}, falling back to wait loop: ${error}` + ); + return false; + } + } + + protected isPaymentTimeoutReached(state: RampState): boolean { + const thisPhaseEntry = state.phaseHistory.find(phaseHistoryEntry => phaseHistoryEntry.phase === this.getPhaseName()); + if (!thisPhaseEntry) { + throw new Error("MykoboOnrampDepositHandler: Phase not found in history. This is a bug."); + } + + const initialTimestamp = new Date(thisPhaseEntry.timestamp); + return initialTimestamp.getTime() + PAYMENT_TIMEOUT_MS < Date.now(); + } +} + +export default new MykoboOnrampDepositHandler(); diff --git a/apps/api/src/api/services/phases/handlers/mykobo-payout-handler.ts b/apps/api/src/api/services/phases/handlers/mykobo-payout-handler.ts new file mode 100644 index 000000000..ad07596eb --- /dev/null +++ b/apps/api/src/api/services/phases/handlers/mykobo-payout-handler.ts @@ -0,0 +1,112 @@ +import { EvmClientManager, MykoboApiService, MykoboTransactionStatus, Networks, RampPhase } from "@vortexfi/shared"; +import logger from "../../../../config/logger"; +import RampState from "../../../../models/rampState.model"; +import { PhaseError } from "../../../errors/phase-error"; +import { BasePhaseHandler } from "../base-phase-handler"; +import { StateMetadata } from "../meta-state-types"; + +const POLL_INTERVAL_MS = 5_000; +const POLL_TIMEOUT_MS = 10 * 60 * 1000; + +export class MykoboPayoutOnBasePhaseHandler extends BasePhaseHandler { + public getPhaseName(): RampPhase { + return "mykoboPayoutOnBase"; + } + + protected async executePhase(state: RampState): Promise { + const { mykoboTransactionId, mykoboPayoutTxHash } = state.state as StateMetadata; + + if (!mykoboTransactionId) { + throw new Error("MykoboPayoutOnBasePhaseHandler: mykoboTransactionId missing in state. This is a bug."); + } + + await this.sendMykoboPayoutTransaction(state, mykoboPayoutTxHash); + await this.pollMykoboUntilCompleted(mykoboTransactionId); + + return this.transitionToNextPhase(state, "complete"); + } + + private async sendMykoboPayoutTransaction(state: RampState, mykoboPayoutTxHash?: `0x${string}`): Promise { + try { + const evmClientManager = EvmClientManager.getInstance(); + const baseClient = evmClientManager.getClient(Networks.Base); + const { txData: payoutTx } = this.getPresignedTransaction(state, "mykoboPayoutOnBase"); + + if (!payoutTx) { + throw new Error("Missing presigned transaction for mykoboPayoutOnBase"); + } + + if (mykoboPayoutTxHash) { + logger.info(`MykoboPayoutOnBasePhaseHandler: Found existing tx ${mykoboPayoutTxHash}. Waiting for receipt...`); + const receipt = await baseClient.waitForTransactionReceipt({ hash: mykoboPayoutTxHash }); + if (receipt.status === "success") { + logger.info(`MykoboPayoutOnBasePhaseHandler: Existing tx ${mykoboPayoutTxHash} succeeded.`); + return; + } + logger.warn(`MykoboPayoutOnBasePhaseHandler: Existing tx ${mykoboPayoutTxHash} failed. Re-sending.`); + } + + const txHash = (await evmClientManager.sendRawTransactionWithRetry( + Networks.Base, + payoutTx as `0x${string}` + )) as `0x${string}`; + logger.info(`MykoboPayoutOnBasePhaseHandler: Sent EURC transfer tx ${txHash}. Waiting for receipt...`); + + const receipt = await baseClient.waitForTransactionReceipt({ hash: txHash }); + if (receipt.status !== "success") { + throw new Error(`Transaction ${txHash} failed on chain`); + } + + await state.update({ + state: { + ...state.state, + mykoboPayoutTxHash: txHash + } + }); + logger.info(`MykoboPayoutOnBasePhaseHandler: Transaction ${txHash} confirmed.`); + } catch (error) { + logger.error("MykoboPayoutOnBasePhaseHandler: Failed to send Mykobo payout tx.", error); + throw this.createRecoverableError("Failed to send Mykobo payout transaction"); + } + } + + private async pollMykoboUntilCompleted(transactionId: string): Promise { + const mykobo = MykoboApiService.getInstance(); + const startTime = Date.now(); + let lastError: unknown; + + while (Date.now() - startTime < POLL_TIMEOUT_MS) { + try { + const { transaction } = await mykobo.getTransaction(transactionId); + logger.debug(`MykoboPayoutOnBasePhaseHandler: tx ${transactionId} status=${transaction.status}`); + + if (transaction.status === MykoboTransactionStatus.COMPLETED) { + return; + } + if ( + transaction.status === MykoboTransactionStatus.FAILED || + transaction.status === MykoboTransactionStatus.CANCELLED || + transaction.status === MykoboTransactionStatus.EXPIRED + ) { + throw this.createUnrecoverableError( + `MykoboPayoutOnBasePhaseHandler: Mykobo transaction ${transactionId} ended with status ${transaction.status}` + ); + } + } catch (error) { + if (error instanceof PhaseError) throw error; + lastError = error; + logger.warn("MykoboPayoutOnBasePhaseHandler: Polling Mykobo transaction failed. Retrying...", error); + } + await new Promise(resolve => setTimeout(resolve, POLL_INTERVAL_MS)); + } + + if (lastError) { + throw this.createRecoverableError( + `MykoboPayoutOnBasePhaseHandler: Polling timed out with transient error: ${(lastError as Error).message}` + ); + } + throw this.createRecoverableError("MykoboPayoutOnBasePhaseHandler: Polling for Mykobo transaction status timed out."); + } +} + +export default new MykoboPayoutOnBasePhaseHandler(); diff --git a/apps/api/src/api/services/phases/handlers/nabla-approve-handler.ts b/apps/api/src/api/services/phases/handlers/nabla-approve-handler.ts index defed096a..052dcb785 100644 --- a/apps/api/src/api/services/phases/handlers/nabla-approve-handler.ts +++ b/apps/api/src/api/services/phases/handlers/nabla-approve-handler.ts @@ -1,14 +1,6 @@ import { createExecuteMessageExtrinsic, ExecuteMessageResult, submitExtrinsic } from "@pendulum-chain/api-solang"; import { Abi } from "@polkadot/api-contract"; -import { - ApiManager, - decodeSubmittableExtrinsic, - EvmClientManager, - FiatToken, - NABLA_ROUTER, - Networks, - RampPhase -} from "@vortexfi/shared"; +import { ApiManager, decodeSubmittableExtrinsic, EvmClientManager, NABLA_ROUTER, Networks, RampPhase } from "@vortexfi/shared"; import Big from "big.js"; import logger from "../../../../config/logger"; import { erc20WrapperAbi } from "../../../../contracts/ERC20Wrapper"; @@ -35,13 +27,15 @@ export class NablaApprovePhaseHandler extends BasePhaseHandler { const { substrateEphemeralAddress } = state.state as StateMetadata; - // BRL flows, use evm instance of Nabla. - if (quote.inputCurrency === FiatToken.BRL || quote.outputCurrency === FiatToken.BRL) { + // EVM-ephemeral flows (BRL, Mykobo EUR, ...) use the EVM Nabla instance. + if (quote.metadata.nablaSwapEvm) { return this.executeEvmApprove(state); } else if (substrateEphemeralAddress) { return this.executeSubstrateApprove(state, quote); } else { - throw new Error("NablaApprovePhaseHandler: Invalid state. Missing substrate ephemeral address for a non-BRL quote."); + throw new Error( + "NablaApprovePhaseHandler: Invalid state. Missing substrate ephemeral address for a non-EVM-ephemeral quote." + ); } } diff --git a/apps/api/src/api/services/phases/handlers/nabla-swap-handler.test.ts b/apps/api/src/api/services/phases/handlers/nabla-swap-handler.test.ts new file mode 100644 index 000000000..8aca4d8bf --- /dev/null +++ b/apps/api/src/api/services/phases/handlers/nabla-swap-handler.test.ts @@ -0,0 +1,196 @@ +// eslint-disable-next-line import/no-unresolved +import {beforeEach, describe, expect, it, mock} from "bun:test"; +import {privateKeyToAccount} from "viem/accounts"; +import {parseTransaction} from "viem"; + +const Networks = { + Base: "base" +} as const; + +const RampDirection = { + SELL: "SELL" +} as const; + +const EvmToken = { + USDC: "USDC" +} as const; + +const EVM_EPHEMERAL_ACCOUNT = privateKeyToAccount( + "0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +); +const UNEXPECTED_EVM_EPHEMERAL_ADDRESS = "0x1111111111111111111111111111111111111111"; +const NABLA_ROUTER_ADDRESS = "0x2222222222222222222222222222222222222222"; +const SWAP_TX_HASH = "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; +const SWAP_TX = await EVM_EPHEMERAL_ACCOUNT.signTransaction({ + chainId: 8453, + data: "0x12345678", + gas: 500000n, + maxFeePerGas: 2000000000n, + maxPriorityFeePerGas: 1000000n, + nonce: 0, + to: NABLA_ROUTER_ADDRESS, + type: "eip1559", + value: 0n +}); + +const call = mock(async () => ({ data: "0x" })); +const sendRawTransaction = mock(async () => SWAP_TX_HASH); +const waitForTransactionReceipt = mock(async () => ({ status: "success" })); +const checkEvmBalanceForToken = mock(async () => undefined); +const appendErrorLog = mock(async (_rampId: string, _errorLog: { error: string; recoverable: boolean }) => undefined); + +mock.module("@vortexfi/shared", () => ({ + ApiManager: { + getInstance: () => ({}) + }, + checkEvmBalanceForToken, + decodeSubmittableExtrinsic: mock(), + defaultReadLimits: {}, + EvmClientManager: { + getInstance: () => ({ + getClient: () => ({ + call, + sendRawTransaction, + waitForTransactionReceipt + }) + }) + }, + EvmToken, + EvmTokenDetails: {}, + evmTokenConfig: { + [Networks.Base]: { + [EvmToken.USDC]: { + assetSymbol: EvmToken.USDC, + decimals: 6, + erc20AddressSourceChain: "0x3333333333333333333333333333333333333333", + isNative: false, + network: Networks.Base + } + } + }, + NABLA_ROUTER: "0x4444444444444444444444444444444444444444", + Networks, + RampPhase: {}, + RampDirection +})); + +mock.module("../../ramp/ramp.service", () => ({ + default: { + appendErrorLog + } +})); + +const { default: QuoteTicket } = await import("../../../../models/quoteTicket.model"); +const { NablaSwapPhaseHandler } = await import("./nabla-swap-handler"); + +type NablaSwapState = Parameters["execute"]>[0]; + +QuoteTicket.findByPk = mock(async () => ({ + metadata: { + nablaSwapEvm: { + inputAmountForSwapRaw: "1000000", + inputCurrency: EvmToken.USDC + } + } +})) as typeof QuoteTicket.findByPk; + +function makeState(overrides: Record = {}) { + const state = { + currentPhase: "nablaSwap", + errorLogs: [], + get() { + const { get: _get, update: _update, ...data } = this; + return data; + }, + id: "ramp-1", + phaseHistory: [], + presignedTxs: [ + { + meta: {}, + network: Networks.Base, + nonce: 0, + phase: "nablaSwap", + signer: EVM_EPHEMERAL_ACCOUNT.address, + txData: SWAP_TX + } + ], + quoteId: "quote-1", + state: { + evmEphemeralAddress: EVM_EPHEMERAL_ACCOUNT.address + }, + type: RampDirection.SELL, + async update(updateData: Record) { + Object.assign(this, updateData); + return this; + }, + ...overrides + }; + + return state as unknown as NablaSwapState; +} + +describe("NablaSwapPhaseHandler", () => { + beforeEach(() => { + call.mockClear(); + sendRawTransaction.mockClear(); + waitForTransactionReceipt.mockClear(); + checkEvmBalanceForToken.mockClear(); + appendErrorLog.mockClear(); + }); + + it("dry-runs the decoded EVM swap transaction before broadcasting", async () => { + const decodedSwapTx = parseTransaction(SWAP_TX); + const handler = new NablaSwapPhaseHandler(); + const updatedState = await handler.execute(makeState()); + + expect(call).toHaveBeenCalledTimes(1); + expect(call).toHaveBeenCalledWith({ + accessList: decodedSwapTx.accessList, + account: EVM_EPHEMERAL_ACCOUNT.address, + blockTag: "pending", + data: decodedSwapTx.data, + gas: decodedSwapTx.gas, + maxFeePerGas: decodedSwapTx.maxFeePerGas, + maxPriorityFeePerGas: decodedSwapTx.maxPriorityFeePerGas, + to: decodedSwapTx.to, + type: "eip1559", + value: decodedSwapTx.value + }); + expect(sendRawTransaction).toHaveBeenCalledTimes(1); + expect(sendRawTransaction).toHaveBeenCalledWith({ serializedTransaction: SWAP_TX }); + expect(updatedState.currentPhase).toBe("subsidizePostSwap"); + }); + + it("does not broadcast when the EVM swap dry-run reverts", async () => { + call.mockRejectedValueOnce(new Error("SP:quoteSwapInto:EXCEEDS_MAX_COVERAGE_RATIO")); + + const handler = new NablaSwapPhaseHandler(); + + await expect(handler.execute(makeState())).rejects.toThrow("SP:quoteSwapInto:EXCEEDS_MAX_COVERAGE_RATIO"); + + expect(call).toHaveBeenCalledTimes(1); + expect(sendRawTransaction).not.toHaveBeenCalled(); + expect(appendErrorLog).toHaveBeenCalledTimes(1); + expect(appendErrorLog.mock.calls[0][1].error).toContain("SP:quoteSwapInto:EXCEEDS_MAX_COVERAGE_RATIO"); + expect(appendErrorLog.mock.calls[0][1].recoverable).toBe(true); + }); + + it("rejects EVM swap transactions signed by an unexpected sender", async () => { + const handler = new NablaSwapPhaseHandler(); + + await expect( + handler.execute( + makeState({ + state: { + evmEphemeralAddress: UNEXPECTED_EVM_EPHEMERAL_ADDRESS + } + }) + ) + ).rejects.toThrow("EVM swap transaction sender mismatch"); + + expect(call).not.toHaveBeenCalled(); + expect(sendRawTransaction).not.toHaveBeenCalled(); + expect(appendErrorLog).toHaveBeenCalledTimes(1); + expect(appendErrorLog.mock.calls[0][1].recoverable).toBe(false); + }); +}); diff --git a/apps/api/src/api/services/phases/handlers/nabla-swap-handler.ts b/apps/api/src/api/services/phases/handlers/nabla-swap-handler.ts index 6693682bc..62ac1c1f6 100644 --- a/apps/api/src/api/services/phases/handlers/nabla-swap-handler.ts +++ b/apps/api/src/api/services/phases/handlers/nabla-swap-handler.ts @@ -8,17 +8,18 @@ import { EvmClientManager, EvmTokenDetails, evmTokenConfig, - FiatToken, NABLA_ROUTER, Networks, RampDirection, RampPhase } from "@vortexfi/shared"; import Big from "big.js"; +import { parseTransaction, recoverTransactionAddress } from "viem"; import logger from "../../../../config/logger"; import { routerAbi } from "../../../../contracts/Router"; import QuoteTicket from "../../../../models/quoteTicket.model"; import RampState from "../../../../models/rampState.model"; +import { PhaseError } from "../../../errors/phase-error"; import { BasePhaseHandler } from "../base-phase-handler"; import { StateMetadata } from "../meta-state-types"; @@ -36,12 +37,14 @@ export class NablaSwapPhaseHandler extends BasePhaseHandler { const { substrateEphemeralAddress } = state.state as StateMetadata; - if (quote.inputCurrency === FiatToken.BRL || quote.outputCurrency === FiatToken.BRL) { + if (quote.metadata.nablaSwapEvm) { return this.executeEvmSwap(state, quote); } else if (substrateEphemeralAddress) { return this.executeSubstrateSwap(state, quote); } else { - throw new Error("NablaSwapPhaseHandler: Invalid state. Missing substrate ephemeral address for a non-BRL quote."); + throw new Error( + "NablaSwapPhaseHandler: Invalid state. Missing substrate ephemeral address for a non-EVM-ephemeral quote." + ); } } @@ -192,6 +195,8 @@ export class NablaSwapPhaseHandler extends BasePhaseHandler { throw new Error("NablaSwapPhaseHandler: Invalid EVM transaction data. This is a bug."); } + await this.dryRunEvmSwap(nablaSwapTransaction as `0x${string}`, evmEphemeralAddress as `0x${string}`); + const txHash = await baseClient.sendRawTransaction({ serializedTransaction: nablaSwapTransaction as `0x${string}` }); @@ -207,6 +212,10 @@ export class NablaSwapPhaseHandler extends BasePhaseHandler { logger.info(`NablaSwapPhaseHandler: EVM swap transaction successful: ${txHash}`); } catch (e) { logger.error(`Could not swap token on EVM: ${(e as Error).message}`); + if (e instanceof PhaseError) { + throw e; + } + // unrecoverable by default. // TODO do we want to add automatic recovery? Issue is, invalid swaps now revert. // We can add a retry with up to 1 or 2 backups. Or try to differentiate based on the revert message. @@ -218,6 +227,72 @@ export class NablaSwapPhaseHandler extends BasePhaseHandler { const nextPhase = state.type === RampDirection.BUY ? "distributeFees" : "subsidizePostSwap"; return this.transitionToNextPhase(state, nextPhase); } + + private async dryRunEvmSwap(serializedTransaction: `0x${string}`, expectedSenderAddress: `0x${string}`): Promise { + const evmClientManager = EvmClientManager.getInstance(); + const baseClient = evmClientManager.getClient(Networks.Base); + const transaction = parseTransaction(serializedTransaction); + type RecoverTransactionAddressParams = Parameters[0]; + const transactionSender = await recoverTransactionAddress({ + serializedTransaction: serializedTransaction as RecoverTransactionAddressParams["serializedTransaction"] + }); + + if (transactionSender.toLowerCase() !== expectedSenderAddress.toLowerCase()) { + throw new Error( + `NablaSwapPhaseHandler: EVM swap transaction sender mismatch. Expected ${expectedSenderAddress}, got ${transactionSender}` + ); + } + + if (!transaction.to) { + throw new Error("NablaSwapPhaseHandler: Cannot dry-run EVM swap transaction without a recipient address."); + } + + try { + const callParameters = { + account: transactionSender, + blockTag: "pending" as const, + data: transaction.data, + gas: transaction.gas, + to: transaction.to, + value: transaction.value + }; + + if (transaction.type === "legacy" || transaction.type === undefined) { + await baseClient.call({ + ...callParameters, + gasPrice: transaction.gasPrice, + type: "legacy" + }); + } else if (transaction.type === "eip2930") { + await baseClient.call({ + ...callParameters, + accessList: transaction.accessList, + gasPrice: transaction.gasPrice, + type: "eip2930" + }); + } else if (transaction.type === "eip1559") { + await baseClient.call({ + ...callParameters, + accessList: transaction.accessList, + maxFeePerGas: transaction.maxFeePerGas, + maxPriorityFeePerGas: transaction.maxPriorityFeePerGas, + type: "eip1559" + }); + } else { + throw new Error(`Unsupported EVM swap transaction type for dry-run: ${transaction.type}`); + } + } catch (error) { + if (error instanceof Error) { + const recoverableError = this.createRecoverableError( + `NablaSwapPhaseHandler: EVM swap dry-run failed: ${error.message}` + ); + recoverableError.stack = error.stack; + throw recoverableError; + } + + throw this.createRecoverableError(`NablaSwapPhaseHandler: EVM swap dry-run failed: ${String(error)}`); + } + } } export default new NablaSwapPhaseHandler(); diff --git a/apps/api/src/api/services/phases/handlers/spacewalk-redeem-handler.ts b/apps/api/src/api/services/phases/handlers/spacewalk-redeem-handler.ts deleted file mode 100644 index 7f9953fbf..000000000 --- a/apps/api/src/api/services/phases/handlers/spacewalk-redeem-handler.ts +++ /dev/null @@ -1,142 +0,0 @@ -import { ApiManager, decodeSubmittableExtrinsic, RampPhase } from "@vortexfi/shared"; -import Big from "big.js"; -import logger from "../../../../config/logger"; -import QuoteTicket from "../../../../models/quoteTicket.model"; -import RampState from "../../../../models/rampState.model"; -import { checkBalancePeriodically } from "../../stellar/checkBalance"; -import { createVaultService } from "../../stellar/vaultService"; -import { BasePhaseHandler } from "../base-phase-handler"; -import { validateStellarPaymentSequenceNumber } from "../helpers/stellar-sequence-validator"; -import { StateMetadata } from "../meta-state-types"; -import { isStellarEphemeralFunded } from "./helpers"; - -const maxWaitingTimeMinutes = 10; -const maxWaitingTimeMs = maxWaitingTimeMinutes * 60 * 1000; - -export class SpacewalkRedeemPhaseHandler extends BasePhaseHandler { - public getPhaseName(): RampPhase { - return "spacewalkRedeem"; - } - - protected async executePhase(state: RampState): Promise { - const apiManager = ApiManager.getInstance(); - const networkName = "pendulum"; - const pendulumNode = await apiManager.getApi(networkName); - - const quote = await QuoteTicket.findByPk(state.quoteId); - - const { substrateEphemeralAddress, stellarTarget, executeSpacewalkNonce, stellarEphemeralAccountId } = - state.state as StateMetadata; - - if (!substrateEphemeralAddress || !stellarTarget || !executeSpacewalkNonce || !stellarEphemeralAccountId) { - logger.error("SpacewalkRedeemPhaseHandler: State metadata corrupted. This is a bug."); - return this.transitionToNextPhase(state, "failed"); - } - - if (!quote) { - throw new Error("Quote not found for the given state"); - } - - if (!quote.metadata.pendulumToStellar?.outputAmountDecimal || !quote.metadata.pendulumToStellar?.outputAmountRaw) { - throw new Error("Missing output amount for Spacewalk Redeem in quote metadata"); - } - - const outputAmountUnits = quote.metadata.pendulumToStellar?.outputAmountDecimal.toString(); - const outputAmountRaw = quote.metadata.pendulumToStellar?.outputAmountRaw; - - // Check if Stellar target account exists on the network and has the respective trustline. - // Otherwise, the redeem will end up with a 'claimable-payment' operation on Stellar that we cannot claim. - if (!(await isStellarEphemeralFunded(stellarEphemeralAccountId, stellarTarget.stellarTokenDetails))) { - logger.error( - `SpacewalkRedeemPhaseHandler: Stellar target account ${stellarEphemeralAccountId} does not exist or does not have the required trustline.` - ); - return this.transitionToNextPhase(state, "failed"); - } - - try { - logger.info("Validating stellar payment sequence number before spacewalk redeem"); - await validateStellarPaymentSequenceNumber(state, stellarEphemeralAccountId); - } catch (validationError) { - logger.error(`Stellar payment sequence validation failed before spacewalk redeem: ${validationError}`); - return this.transitionToNextPhase(state, "failed"); - } - - const { txData: spacewalkRedeemTransaction } = this.getPresignedTransaction(state, "spacewalkRedeem"); - if (typeof spacewalkRedeemTransaction !== "string") { - logger.error("SpacewalkRedeemPhaseHandler: Presigned transaction is not a string -> not an encoded Stellar transaction."); - return this.transitionToNextPhase(state, "failed"); - } - - try { - const accountData = await pendulumNode.api.query.system.account(substrateEphemeralAddress); - const accountJson = accountData.toJSON() as { nonce?: number } | null; - const currentEphemeralAccountNonce = accountJson?.nonce; - - // Re-execution guard - if (currentEphemeralAccountNonce !== undefined && currentEphemeralAccountNonce > executeSpacewalkNonce) { - await this.waitForOutputTokensToArriveOnStellar( - outputAmountUnits, - stellarEphemeralAccountId, - stellarTarget.stellarTokenDetails.stellarAsset.code.string - ); - return this.transitionToNextPhase(state, "stellarPayment"); - } - - const vaultService = await createVaultService( - pendulumNode, - stellarTarget.stellarTokenDetails.stellarAsset.code.hex, - stellarTarget.stellarTokenDetails.stellarAsset.issuer.hex, - outputAmountRaw - ); - logger.info(`Requesting redeem of ${outputAmountUnits} tokens for vault ${vaultService.vaultId}`); - - const redeemExtrinsic = decodeSubmittableExtrinsic(spacewalkRedeemTransaction, pendulumNode.api); - const redeemRequestEvent = await vaultService.submitRedeem(substrateEphemeralAddress, redeemExtrinsic); - - logger.info(`Successfully posed redeem request ${redeemRequestEvent.redeemId} for vault ${vaultService.vaultId}`); - - await this.waitForOutputTokensToArriveOnStellar( - outputAmountUnits, - stellarEphemeralAccountId, - stellarTarget.stellarTokenDetails.stellarAsset.code.string - ); - - return this.transitionToNextPhase(state, "stellarPayment"); - } catch (e) { - // This is a potentially recoverable error (due to redeem request done before app shut down, but not registered) - if ((e as Error).message.includes("AmountExceedsUserBalance")) { - logger.info("Recovery mode: Redeem already performed. Waiting for execution and Stellar balance arrival."); - await this.waitForOutputTokensToArriveOnStellar( - outputAmountUnits, - stellarEphemeralAccountId, - stellarTarget.stellarTokenDetails.stellarAsset.code.string - ); - return this.transitionToNextPhase(state, "stellarPayment"); - } - - // Generic failure of the extrinsic itself OR lack of funds to even make the transaction - logger.error(`Failed to request redeem: ${e}`); - throw new Error("Failed to request redeem"); - } - } - - private async waitForOutputTokensToArriveOnStellar( - outputAmountUnits: string, - targetAccount: string, - stellarAssetCode: string - ): Promise { - // We wait for up to 10 minutes - - const amountUnitsBig = new Big(outputAmountUnits); - const stellarPollingTimeMs = 1000; - - try { - await checkBalancePeriodically(targetAccount, stellarAssetCode, amountUnitsBig, stellarPollingTimeMs, maxWaitingTimeMs); - logger.info("Balance check completed successfully."); - } catch (_balanceCheckError) { - throw new Error("Stellar balance did not arrive on time"); - } - } -} - -export default new SpacewalkRedeemPhaseHandler(); diff --git a/apps/api/src/api/services/phases/handlers/squid-router-phase-handler.ts b/apps/api/src/api/services/phases/handlers/squid-router-phase-handler.ts index 5119bbaf1..a36b98fd0 100644 --- a/apps/api/src/api/services/phases/handlers/squid-router-phase-handler.ts +++ b/apps/api/src/api/services/phases/handlers/squid-router-phase-handler.ts @@ -1,12 +1,15 @@ import { + ALFREDPAY_EVM_TOKEN, checkEvmBalanceForToken, EvmClientManager, EvmNetworks, + EvmTokenDetails, + evmTokenConfig, FiatToken, - getEvmTokenDetailsByAddress, - getNetworkFromDestination, - getNetworkId, + getEvmBalance, + getOnChainTokenDetails, isAlfredpayToken, + isEvmTokenDetails, Networks, RampDirection, RampPhase @@ -15,22 +18,15 @@ import { PublicClient } from "viem"; import logger from "../../../../config/logger"; import QuoteTicket from "../../../../models/quoteTicket.model"; import RampState from "../../../../models/rampState.model"; +import { isFiatToOwnStablecoinBaseDirect } from "../../quote/utils"; import { BasePhaseHandler } from "../base-phase-handler"; /** * Handler for the squidRouter phase */ export class SquidRouterPhaseHandler extends BasePhaseHandler { - private moonbeamClient: PublicClient; - private polygonClient: PublicClient; - private baseClient: PublicClient; - - constructor() { - super(); - const evmClientManager = EvmClientManager.getInstance(); - this.moonbeamClient = evmClientManager.getClient(Networks.Moonbeam); - this.polygonClient = evmClientManager.getClient(Networks.Polygon); - this.baseClient = evmClientManager.getClient(Networks.Base); + private getClient(network: EvmNetworks): PublicClient { + return EvmClientManager.getInstance().getClient(network); } /** @@ -48,23 +44,34 @@ export class SquidRouterPhaseHandler extends BasePhaseHandler { protected async executePhase(state: RampState): Promise { logger.info(`Executing squidRouter phase for ramp ${state.id}`); + if (state.state.isDirectTransfer === true) { + logger.info(`SquidRouterPhaseHandler: Skipping squidRouter for direct-transfer ramp ${state.id}`); + return this.transitionToNextPhase(state, "destinationTransfer"); + } + const quote = await QuoteTicket.findByPk(state.quoteId); if (!quote) { throw new Error("Quote not found for the given state"); } + if (isFiatToOwnStablecoinBaseDirect(quote.inputCurrency, quote.outputCurrency, quote.network)) { + logger.info(`SquidRouterPhaseHandler: Skipping squidRouter for Base direct-transfer route (ramp ${state.id})`); + return this.transitionToNextPhase(state, "destinationTransfer"); + } + if (state.type === RampDirection.SELL) { logger.info("SquidRouter phase is not supported for off-ramp"); return state; } - // Alfredpay onramps mint directly to Polygon in the alfredpay token (e.g. USDT), - // so no squidRouter swap is needed — skip straight to destination transfer. + // Alfredpay mints USDT directly on Polygon. Skip the swap ONLY when the requested + // output is that direct token; metadata.to is the destination network, not the output + // token, so other Polygon outputs (e.g. USDC) still need a real USDT→output swap. const isAlfredpayOnramp = state.type === RampDirection.BUY && isAlfredpayToken(quote.inputCurrency as FiatToken) && !!quote.metadata.alfredpayMint; - if (isAlfredpayOnramp && quote.metadata.to === Networks.Polygon) { - logger.info(`SquidRouterPhaseHandler: Skipping squidRouter for Alfredpay onramp (ramp ${state.id})`); + if (isAlfredpayOnramp && quote.metadata.request.to === Networks.Polygon && quote.outputCurrency === ALFREDPAY_EVM_TOKEN) { + logger.info(`SquidRouterPhaseHandler: Skipping squidRouter for Alfredpay direct-token onramp (ramp ${state.id})`); return this.transitionToNextPhase(state, "finalSettlementSubsidy"); } @@ -93,7 +100,9 @@ export class SquidRouterPhaseHandler extends BasePhaseHandler { } const sourceNetwork = bridgeMeta.fromNetwork as EvmNetworks; - const sourceTokenDetails = getEvmTokenDetailsByAddress(sourceNetwork, bridgeMeta.fromToken); + const sourceTokenDetails = Object.values(evmTokenConfig[sourceNetwork] || {}).find( + token => token.erc20AddressSourceChain.toLowerCase() === bridgeMeta.fromToken.toLowerCase() + ) as EvmTokenDetails | undefined; if (!sourceTokenDetails) { throw new Error( @@ -128,21 +137,15 @@ export class SquidRouterPhaseHandler extends BasePhaseHandler { let approveHash = state.state.squidRouterApproveHash; // Check if the approve transaction has already been sent if (!approveHash) { - const accountNonce = await this.getNonce(state, approveTransaction.signer as `0x${string}`); + const accountNonce = await this.getNonce(sourceNetwork, approveTransaction.signer as `0x${string}`); if (approveTransaction.nonce && approveTransaction.nonce !== accountNonce) { logger.warn( `Nonce mismatch for approve transaction of account ${approveTransaction.signer}: expected ${accountNonce}, got ${approveTransaction.nonce}` ); } - const destinationNetwork = getNetworkFromDestination(state.to); - const chainId = destinationNetwork ? getNetworkId(destinationNetwork) : null; - if (!chainId) { - throw new Error("Invalid destination network"); - } - // Execute the approve transaction - approveHash = await this.executeTransaction(state, approveTransaction.txData as string); + approveHash = await this.executeTransaction(sourceNetwork, approveTransaction.txData as string); logger.info(`Approve transaction executed with hash: ${approveHash}`); // Update the state with the approve hash immediately after sending the transaction @@ -155,15 +158,15 @@ export class SquidRouterPhaseHandler extends BasePhaseHandler { } // Wait for the approve transaction to be confirmed - await this.waitForTransactionConfirmation(state, approveHash); + await this.waitForTransactionConfirmation(sourceNetwork, approveHash); logger.info(`Approve transaction confirmed: ${approveHash}`); // Execute the swap transaction - const swapHash = await this.executeTransaction(state, swapTransaction.txData as string); + const swapHash = await this.executeTransaction(sourceNetwork, swapTransaction.txData as string); logger.info(`Swap transaction executed with hash: ${swapHash}`); // Update the state with the transaction hashes - const updatedState = await state.update({ + let updatedState = await state.update({ state: { ...state.state, squidRouterSwapHash: swapHash @@ -171,55 +174,49 @@ export class SquidRouterPhaseHandler extends BasePhaseHandler { }); // Wait for the swap transaction to be confirmed - await this.waitForTransactionConfirmation(state, swapHash); + await this.waitForTransactionConfirmation(sourceNetwork, swapHash); logger.info(`Swap transaction confirmed: ${swapHash}`); - // Transition to the next phase - return this.transitionToNextPhase(updatedState, "squidRouterPay"); - } catch (error) { - logger.error(`Error in squidRouter phase for ramp ${state.id}:`, error); - throw error; - } - } + let preSettlementBalance = "0"; + try { + const destinationNetwork = quote.network as EvmNetworks; + const outTokenDetails = getOnChainTokenDetails(quote.network, quote.outputCurrency); - /** - * Get the appropriate public client based on the input token - * Monerium's EUR uses polygon, BRL uses Base - * @param state The current ramp state - * @returns The appropriate public client - */ - private async getPublicClient(state: RampState): Promise { - try { - const quote = await QuoteTicket.findByPk(state.quoteId); - if (!quote) { - throw new Error(`Quote not found for ramp ${state.id}`); - } + if (!outTokenDetails || !isEvmTokenDetails(outTokenDetails)) { + throw new Error(`Could not resolve destination token details for ${quote.outputCurrency} on ${destinationNetwork}`); + } - if (quote.inputCurrency === FiatToken.EURC || isAlfredpayToken(quote.inputCurrency as FiatToken)) { - return this.polygonClient; - } else if (quote.inputCurrency === FiatToken.BRL) { - return this.baseClient; - } else { - logger.info( - `SquidRouterPhaseHandler: Using Moonbeam client as default for input currency: ${quote.inputCurrency}. This is a bug.` + preSettlementBalance = ( + await getEvmBalance({ + chain: destinationNetwork, + ownerAddress: state.state.evmEphemeralAddress as `0x${string}`, + tokenDetails: outTokenDetails + }) + ).toString(); + } catch (error) { + logger.warn( + `SquidRouterPhaseHandler: Failed to snapshot pre-settlement balance for ramp ${state.id}; storing 0. Error: ${error}` ); - return this.moonbeamClient; } + + updatedState = await updatedState.update({ + state: { + ...updatedState.state, + preSettlementBalance + } + }); + + // Transition to the next phase + return this.transitionToNextPhase(updatedState, "squidRouterPay"); } catch (error) { - logger.error("SquidRouterPhaseHandler: Error determining public client, defaulting to moonbeam", error); - return this.moonbeamClient; + logger.error(`Error in squidRouter phase for ramp ${state.id}:`, error); + throw error; } } - /** - * Execute a transaction - * @param state The current ramp state - * @param txData The transaction data - * @returns The transaction hash - */ - private async executeTransaction(state: RampState, txData: string): Promise { + private async executeTransaction(network: EvmNetworks, txData: string): Promise { try { - const publicClient = await this.getPublicClient(state); + const publicClient = this.getClient(network); const txHash = await publicClient.sendRawTransaction({ serializedTransaction: txData as `0x${string}` }); @@ -230,19 +227,14 @@ export class SquidRouterPhaseHandler extends BasePhaseHandler { } } - /** - * Wait for a transaction to be confirmed with exponential backoff - * @param state The current ramp state - * @param txHash The transaction hash - */ - private async waitForTransactionConfirmation(state: RampState, txHash: string): Promise { + private async waitForTransactionConfirmation(network: EvmNetworks, txHash: string): Promise { const maxRetries = 3; const baseDelay = 5000; // 5 seconds const maxDelay = 30000; // 30 seconds for (let attempt = 0; attempt <= maxRetries; attempt++) { try { - const publicClient = await this.getPublicClient(state); + const publicClient = this.getClient(network); const receipt = await publicClient.waitForTransactionReceipt({ hash: txHash as `0x${string}` }); @@ -282,10 +274,9 @@ export class SquidRouterPhaseHandler extends BasePhaseHandler { } } - private async getNonce(state: RampState, address: `0x${string}`): Promise { + private async getNonce(network: EvmNetworks, address: `0x${string}`): Promise { try { - const publicClient = await this.getPublicClient(state); - // List all transactions for the address to get the nonce + const publicClient = this.getClient(network); return await publicClient.getTransactionCount({ address }); } catch (error) { logger.error("Error getting nonce", error); diff --git a/apps/api/src/api/services/phases/handlers/stellar-payment-handler.ts b/apps/api/src/api/services/phases/handlers/stellar-payment-handler.ts deleted file mode 100644 index 838ec9924..000000000 --- a/apps/api/src/api/services/phases/handlers/stellar-payment-handler.ts +++ /dev/null @@ -1,85 +0,0 @@ -import { HORIZON_URL, RampPhase } from "@vortexfi/shared"; -import { Horizon, NetworkError, Networks, Transaction } from "stellar-sdk"; -import logger from "../../../../config/logger"; -import { config } from "../../../../config/vars"; -import RampState from "../../../../models/rampState.model"; -import { BasePhaseHandler } from "../base-phase-handler"; -import { verifyStellarPaymentSuccess } from "../helpers/stellar-payment-verifier"; -import { StateMetadata } from "../meta-state-types"; -import { isStellarNetworkError } from "./fund-ephemeral-handler"; - -const NETWORK_PASSPHRASE = config.sandboxEnabled ? Networks.TESTNET : Networks.PUBLIC; - -const horizonServer = new Horizon.Server(HORIZON_URL); - -export class StellarPaymentPhaseHandler extends BasePhaseHandler { - public getPhaseName(): RampPhase { - return "stellarPayment"; - } - - protected async executePhase(state: RampState): Promise { - const { stellarPaymentTxHash } = state.state as StateMetadata; - - if (stellarPaymentTxHash) { - logger.info(`StellarPaymentPhaseHandler: Transaction already submitted (${stellarPaymentTxHash}), skipping to complete`); - return this.transitionToNextPhase(state, "complete"); - } - - const { txData: offrampingTransactionXDR } = this.getPresignedTransaction(state, "stellarPayment"); - if (typeof offrampingTransactionXDR !== "string") { - throw new Error("Invalid transaction data"); - } - - try { - const offrampingTransaction = new Transaction(offrampingTransactionXDR, NETWORK_PASSPHRASE); - const submissionResult = await horizonServer.submitTransaction(offrampingTransaction); - - state.state = { - ...state.state, - stellarPaymentTxHash: submissionResult.hash - }; - await state.update({ state: state.state }); - - return this.transitionToNextPhase(state, "complete"); - } catch (e) { - const horizonError = e as NetworkError; - - if (isStellarNetworkError(horizonError) && horizonError.response.data?.status === 400) { - logger.error( - `Could not submit the offramp transaction ${JSON.stringify(horizonError.response.data.extras.result_codes)}` - ); - // check https://developers.stellar.org/docs/data/horizon/api-reference/errors/result-codes/transactions - if (horizonError.response.data.extras.result_codes.transaction === "tx_bad_seq") { - logger.info("tx_bad_seq error detected. Verifying if payment was actually successful..."); - - try { - const paymentSuccessful = await verifyStellarPaymentSuccess(state); - - if (paymentSuccessful) { - logger.info( - "Payment verification confirmed: all tokens transferred from ephemeral account. Proceeding to complete." - ); - return this.transitionToNextPhase(state, "complete"); - } else { - logger.error( - "Payment verification failed: tokens are still present in ephemeral account. Payment did not succeed." - ); - throw new Error("Stellar payment failed - tokens still present in ephemeral account despite tx_bad_seq error"); - } - } catch (verificationError) { - logger.error(`Failed to verify payment success: ${verificationError}`); - throw new Error(`Could not verify stellar payment success: ${verificationError}`); - } - } - - logger.error(horizonError.response.data.extras); - throw new Error("Could not submit the offramping transaction"); - } else { - logger.error("Error while submitting the offramp transaction", e); - throw new Error("Could not submit the offramping transaction"); - } - } - } -} - -export default new StellarPaymentPhaseHandler(); diff --git a/apps/api/src/api/services/phases/handlers/subsidize-post-swap-handler.ts b/apps/api/src/api/services/phases/handlers/subsidize-post-swap-handler.ts index e6b352530..032e56e2e 100644 --- a/apps/api/src/api/services/phases/handlers/subsidize-post-swap-handler.ts +++ b/apps/api/src/api/services/phases/handlers/subsidize-post-swap-handler.ts @@ -18,7 +18,7 @@ import { import Big from "big.js"; import { encodeFunctionData, erc20Abi } from "viem"; import logger from "../../../../config/logger"; -import { MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION } from "../../../../constants/constants"; +import { config } from "../../../../config/vars"; import QuoteTicket from "../../../../models/quoteTicket.model"; import RampState from "../../../../models/rampState.model"; import { SubsidyToken } from "../../../../models/subsidy.model"; @@ -27,6 +27,7 @@ import { PhaseError } from "../../../errors/phase-error"; import { priceFeedService } from "../../priceFeed.service"; import { BasePhaseHandler } from "../base-phase-handler"; import { getEvmFundingAccount } from "../evm-funding"; +import { calculatePostSwapSubsidyComponents } from "../helpers/post-swap-subsidy-breakdown"; import { StateMetadata } from "../meta-state-types"; export class SubsidizePostSwapPhaseHandler extends BasePhaseHandler { @@ -44,7 +45,7 @@ export class SubsidizePostSwapPhaseHandler extends BasePhaseHandler { throw new Error("Quote not found for the given state"); } - if (quote.inputCurrency === FiatToken.BRL || quote.outputCurrency === FiatToken.BRL) { + if (quote.metadata.nablaSwapEvm) { return this.executeEvmSubsidize(state, quote); } @@ -99,8 +100,6 @@ export class SubsidizePostSwapPhaseHandler extends BasePhaseHandler { } else { if (quote.metadata.pendulumToMoonbeamXcm) { expectedSwapOutputAmountRaw = Big(quote.metadata.pendulumToMoonbeamXcm.inputAmountRaw); - } else if (quote.metadata.pendulumToStellar) { - expectedSwapOutputAmountRaw = Big(quote.metadata.pendulumToStellar.inputAmountRaw); } } @@ -134,7 +133,7 @@ export class SubsidizePostSwapPhaseHandler extends BasePhaseHandler { } logger.info( - `Subsidizing post-swap with ${requiredAmount.toFixed()} to reach target value of ${expectedSwapOutputAmountRaw}` + `Subsidizing post-swap with ${requiredAmount.toFixed()} to reach target value of ${expectedSwapOutputAmountRaw.toFixed(0, 0)}` ); const result = await apiManager.executeApiCall( api => @@ -215,7 +214,7 @@ export class SubsidizePostSwapPhaseHandler extends BasePhaseHandler { quote.metadata.subsidy.subsidyAmountInOutputTokenRaw ); - logger.debug(`SubsidizePostSwapHandler (EVM): expectedSwapOutputAmountRaw ${expectedSwapOutputAmountRaw.toString()}`); + logger.debug(`SubsidizePostSwapHandler (EVM): expectedSwapOutputAmountRaw ${expectedSwapOutputAmountRaw.toFixed(0, 0)}`); // Try to find the required amount to subsidize on the quote metadata if (state.type === RampDirection.BUY) { @@ -225,32 +224,70 @@ export class SubsidizePostSwapPhaseHandler extends BasePhaseHandler { expectedSwapOutputAmountRaw = Big(quote.metadata.nablaSwapEvm.outputAmountRaw); } - const requiredAmount = Big(expectedSwapOutputAmountRaw).sub(currentBalance); - logger.debug(`SubsidizePostSwapHandler (EVM): requiredAmount ${requiredAmount.toString()}`); + const subsidyComponents = calculatePostSwapSubsidyComponents({ + currentBalanceRaw: currentBalance, + discountSubsidyAmountRaw: quote.metadata.subsidy.subsidyAmountInOutputTokenRaw, + expectedOutputAmountRaw: expectedSwapOutputAmountRaw, + quotedActualOutputAmountRaw: quote.metadata.subsidy.actualOutputAmountRaw + }); + const requiredAmount = subsidyComponents.requiredAmountRaw; + logger.debug( + `SubsidizePostSwapHandler (EVM): requiredAmount ${requiredAmount.toFixed(0, 0)}, ` + + `discrepancyAmount ${subsidyComponents.discrepancyAmountRaw.toFixed(0, 0)}, ` + + `discountAmount ${subsidyComponents.discountAmountRaw.toFixed(0, 0)}` + ); if (requiredAmount.gt(Big(0))) { - const subsidyDecimal = nativeToDecimal(requiredAmount, quote.metadata.nablaSwapEvm.outputDecimals).toString(); - const subsidyUsd = await priceFeedService.convertCurrency( - subsidyDecimal, - outputToken as RampCurrency, - EvmToken.USDC as RampCurrency - ); + const discrepancySubsidyDecimal = nativeToDecimal( + subsidyComponents.discrepancyAmountRaw, + quote.metadata.nablaSwapEvm.outputDecimals + ).toFixed(); + const discountSubsidyDecimal = nativeToDecimal( + subsidyComponents.discountAmountRaw, + quote.metadata.nablaSwapEvm.outputDecimals + ).toFixed(); + const discrepancySubsidyUsd = subsidyComponents.discrepancyAmountRaw.gt(0) + ? await priceFeedService.convertCurrency( + discrepancySubsidyDecimal, + outputToken as RampCurrency, + EvmToken.USDC as RampCurrency + ) + : "0"; + const discountSubsidyUsd = subsidyComponents.discountAmountRaw.gt(0) + ? await priceFeedService.convertCurrency( + discountSubsidyDecimal, + outputToken as RampCurrency, + EvmToken.USDC as RampCurrency + ) + : "0"; const quoteOutputUsd = await priceFeedService.convertCurrency( quote.outputAmount, quote.outputCurrency as RampCurrency, EvmToken.USDC as RampCurrency ); - const subsidyCapUsd = Big(quoteOutputUsd).mul(MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION); - if (Big(subsidyUsd).gt(subsidyCapUsd)) { + const discrepancySubsidyCapFraction = config.subsidy.evmSwapSubsidyQuoteFraction; + const discrepancySubsidyCapUsd = Big(quoteOutputUsd).mul(discrepancySubsidyCapFraction); + if (Big(discrepancySubsidyUsd).gt(discrepancySubsidyCapUsd)) { + // Pause for operator intervention without moving the ramp to failed. + throw this.createRecoverableError( + `SubsidizePostSwapPhaseHandler: Required swap discrepancy subsidy $${discrepancySubsidyUsd} exceeds cap $${discrepancySubsidyCapUsd.toFixed(2)} (${discrepancySubsidyCapFraction} of quote output $${quoteOutputUsd}).` + ); + } + + const discountSubsidyCapFraction = config.subsidy.evmPostSwapDiscountSubsidyQuoteFraction; + const discountSubsidyCapUsd = Big(quoteOutputUsd).mul(discountSubsidyCapFraction); + if (Big(discountSubsidyUsd).gt(discountSubsidyCapUsd)) { // Pause for operator intervention without moving the ramp to failed. throw this.createRecoverableError( - `SubsidizePostSwapPhaseHandler: Required subsidy $${subsidyUsd} exceeds cap $${subsidyCapUsd.toFixed(2)} (${MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION} of quote output $${quoteOutputUsd}).` + `SubsidizePostSwapPhaseHandler: Required discount subsidy $${discountSubsidyUsd} exceeds cap $${discountSubsidyCapUsd.toFixed(2)} (${discountSubsidyCapFraction} of quote output $${quoteOutputUsd}).` ); } + const subsidyUsd = Big(discrepancySubsidyUsd).plus(discountSubsidyUsd).toFixed(); + // Do the actual subsidizing on EVM logger.info( - `Subsidizing post-swap EVM with ${requiredAmount.toFixed()} to reach target value of ${expectedSwapOutputAmountRaw}` + `Subsidizing post-swap EVM with ${requiredAmount.toFixed()} ($${subsidyUsd}) to reach target value of ${expectedSwapOutputAmountRaw.toFixed(0, 0)}` ); const evmClientManager = EvmClientManager.getInstance(); @@ -290,7 +327,7 @@ export class SubsidizePostSwapPhaseHandler extends BasePhaseHandler { } } - return this.transitionToNextPhase(state, this.evmNextPhaseSelector(state)); + return this.transitionToNextPhase(state, this.evmNextPhaseSelector(state, quote)); } catch (e) { logger.error("Error in subsidizePostSwap (EVM):", e); if (e instanceof PhaseError) { @@ -321,7 +358,7 @@ export class SubsidizePostSwapPhaseHandler extends BasePhaseHandler { } if (state.type === RampDirection.SELL) { - return "spacewalkRedeem"; + throw new Error("SubsidizePostSwapPhaseHandler: Unsupported non-BRL offramp route after Stellar deprecation"); } throw new Error( @@ -329,12 +366,14 @@ export class SubsidizePostSwapPhaseHandler extends BasePhaseHandler { ); } - protected evmNextPhaseSelector(state: RampState): RampPhase { + protected evmNextPhaseSelector(state: RampState, quote: QuoteTicket): RampPhase { if (state.type === RampDirection.BUY) { return "squidRouterSwap"; - } else { - return "brlaPayoutOnBase"; } + if (quote.outputCurrency === FiatToken.EURC) { + return "mykoboPayoutOnBase"; + } + return "brlaPayoutOnBase"; } } diff --git a/apps/api/src/api/services/phases/handlers/subsidize-pre-swap-handler.ts b/apps/api/src/api/services/phases/handlers/subsidize-pre-swap-handler.ts index e60b74b2d..ce51a4db4 100644 --- a/apps/api/src/api/services/phases/handlers/subsidize-pre-swap-handler.ts +++ b/apps/api/src/api/services/phases/handlers/subsidize-pre-swap-handler.ts @@ -21,7 +21,7 @@ import { import Big from "big.js"; import { encodeFunctionData, erc20Abi } from "viem"; import logger from "../../../../config/logger"; -import { MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION } from "../../../../constants/constants"; +import { config } from "../../../../config/vars"; import QuoteTicket from "../../../../models/quoteTicket.model"; import RampState from "../../../../models/rampState.model"; import { SubsidyToken } from "../../../../models/subsidy.model"; @@ -47,7 +47,7 @@ export class SubsidizePreSwapPhaseHandler extends BasePhaseHandler { throw new Error("Quote not found for the given state"); } - if (quote.inputCurrency === FiatToken.BRL || quote.outputCurrency === FiatToken.BRL) { + if (quote.metadata.nablaSwapEvm) { return this.executeEvmSubsidize(state, quote); } @@ -243,11 +243,12 @@ export class SubsidizePreSwapPhaseHandler extends BasePhaseHandler { quote.outputCurrency as RampCurrency, EvmToken.USDC as RampCurrency ); - const subsidyCapUsd = Big(quoteOutputUsd).mul(MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION); + const subsidyCapFraction = config.subsidy.evmSwapSubsidyQuoteFraction; + const subsidyCapUsd = Big(quoteOutputUsd).mul(subsidyCapFraction); if (Big(subsidyUsd).gt(subsidyCapUsd)) { // Pause for operator intervention without moving the ramp to failed. throw this.createRecoverableError( - `SubsidizePreSwapPhaseHandler: Required subsidy $${subsidyUsd} exceeds cap $${subsidyCapUsd.toFixed(2)} (${MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION} of quote output $${quoteOutputUsd}).` + `SubsidizePreSwapPhaseHandler: Required subsidy $${subsidyUsd} exceeds cap $${subsidyCapUsd.toFixed(2)} (${subsidyCapFraction} of quote output $${quoteOutputUsd}).` ); } diff --git a/apps/api/src/api/services/phases/helpers/brla-onramp-hold.test.ts b/apps/api/src/api/services/phases/helpers/brla-onramp-hold.test.ts new file mode 100644 index 000000000..9f9444a04 --- /dev/null +++ b/apps/api/src/api/services/phases/helpers/brla-onramp-hold.test.ts @@ -0,0 +1,73 @@ +import { beforeEach, describe, expect, it, mock } from "bun:test"; +import { syncAveniaOnHoldState } from "./brla-onramp-hold"; + +const getAveniaPayinTickets = mock(async () => [{ id: "ticket-1", status: "ON-HOLD" }]); + +const brlaApiService = { + getAveniaPayinTickets +}; + +function makeState(initialOnHold?: boolean) { + const state: { aveniaTicketId: string; onHold?: boolean } = { + aveniaTicketId: "ticket-1", + onHold: initialOnHold + }; + return { + state: { + ...state + } + }; +} + +describe("syncAveniaOnHoldState", () => { + beforeEach(() => { + getAveniaPayinTickets.mockClear(); + getAveniaPayinTickets.mockImplementation(async () => [{ id: "ticket-1", status: "ON-HOLD" }]); + }); + + it("marks the ramp as on hold when the Avenia pay-in ticket is ON-HOLD", async () => { + const state = makeState(false); + + const ticketFound = await syncAveniaOnHoldState(state.state, async nextState => { + Object.assign(state.state, nextState); + }, brlaApiService, "subaccount-1"); + + expect(ticketFound).toBe(true); + expect(getAveniaPayinTickets).toHaveBeenCalledWith("subaccount-1"); + expect(state.state.onHold).toBe(true); + }); + + it("normalizes Avenia ticket status casing", async () => { + getAveniaPayinTickets.mockImplementationOnce(async () => [{ id: "ticket-1", status: "on-hold" }]); + const state = makeState(false); + + await syncAveniaOnHoldState(state.state, async nextState => { + Object.assign(state.state, nextState); + }, brlaApiService, "subaccount-1"); + + expect(state.state.onHold).toBe(true); + }); + + it("clears the on-hold flag when the Avenia pay-in ticket is no longer ON-HOLD", async () => { + getAveniaPayinTickets.mockImplementationOnce(async () => [{ id: "ticket-1", status: "PAID" }]); + const state = makeState(true); + + await syncAveniaOnHoldState(state.state, async nextState => { + Object.assign(state.state, nextState); + }, brlaApiService, "subaccount-1"); + + expect(state.state.onHold).toBe(false); + }); + + it("does not update state when the Avenia pay-in ticket is missing", async () => { + getAveniaPayinTickets.mockImplementationOnce(async () => []); + const state = makeState(false); + + const ticketFound = await syncAveniaOnHoldState(state.state, async nextState => { + Object.assign(state.state, nextState); + }, brlaApiService, "subaccount-1"); + + expect(ticketFound).toBe(false); + expect(state.state.onHold).toBe(false); + }); +}); diff --git a/apps/api/src/api/services/phases/helpers/brla-onramp-hold.ts b/apps/api/src/api/services/phases/helpers/brla-onramp-hold.ts new file mode 100644 index 000000000..c21fa8076 --- /dev/null +++ b/apps/api/src/api/services/phases/helpers/brla-onramp-hold.ts @@ -0,0 +1,36 @@ +import { AveniaTicketStatus } from "@vortexfi/shared"; + +interface AveniaPayinTicketClient { + getAveniaPayinTickets(subAccountId: string): Promise<{ id: string; status: string }[]>; +} + +interface RampOnHoldMetadata { + aveniaTicketId: string; + onHold?: boolean; +} + +export async function syncAveniaOnHoldState( + state: RampOnHoldMetadata, + updateState: (state: RampOnHoldMetadata) => Promise, + brlaApiService: AveniaPayinTicketClient, + subAccountId: string +): Promise { + const ticket = (await brlaApiService.getAveniaPayinTickets(subAccountId)).find( + aveniaTicket => aveniaTicket.id === state.aveniaTicketId + ); + + if (!ticket) { + return false; + } + + const isOnHold = ticket.status.trim().toUpperCase() === AveniaTicketStatus.ON_HOLD; + if (state.onHold === isOnHold) { + return true; + } + + await updateState({ + ...state, + onHold: isOnHold + }); + return true; +} diff --git a/apps/api/src/api/services/phases/helpers/post-swap-subsidy-breakdown.test.ts b/apps/api/src/api/services/phases/helpers/post-swap-subsidy-breakdown.test.ts new file mode 100644 index 000000000..e74a7f6f7 --- /dev/null +++ b/apps/api/src/api/services/phases/helpers/post-swap-subsidy-breakdown.test.ts @@ -0,0 +1,56 @@ +// eslint-disable-next-line import/no-unresolved +import {describe, expect, it} from "bun:test"; +import {calculatePostSwapSubsidyComponents} from "./post-swap-subsidy-breakdown"; + +describe("calculatePostSwapSubsidyComponents", () => { + it("splits live shortfall below the quoted actual output into discrepancy plus discount", () => { + const result = calculatePostSwapSubsidyComponents({ + currentBalanceRaw: "90", + discountSubsidyAmountRaw: "5", + expectedOutputAmountRaw: "105", + quotedActualOutputAmountRaw: "100" + }); + + expect(result.requiredAmountRaw.toFixed(0, 0)).toBe("15"); + expect(result.discrepancyAmountRaw.toFixed(0, 0)).toBe("10"); + expect(result.discountAmountRaw.toFixed(0, 0)).toBe("5"); + }); + + it("treats shortfall above the quoted actual output as discount only", () => { + const result = calculatePostSwapSubsidyComponents({ + currentBalanceRaw: "102", + discountSubsidyAmountRaw: "5", + expectedOutputAmountRaw: "105", + quotedActualOutputAmountRaw: "100" + }); + + expect(result.requiredAmountRaw.toFixed(0, 0)).toBe("3"); + expect(result.discrepancyAmountRaw.toFixed(0, 0)).toBe("0"); + expect(result.discountAmountRaw.toFixed(0, 0)).toBe("3"); + }); + + it("falls back to expected output minus discount when quoted actual output is unavailable", () => { + const result = calculatePostSwapSubsidyComponents({ + currentBalanceRaw: "90", + discountSubsidyAmountRaw: "5", + expectedOutputAmountRaw: "105" + }); + + expect(result.requiredAmountRaw.toFixed(0, 0)).toBe("15"); + expect(result.discrepancyAmountRaw.toFixed(0, 0)).toBe("10"); + expect(result.discountAmountRaw.toFixed(0, 0)).toBe("5"); + }); + + it("returns zero components when the live balance already reaches the target", () => { + const result = calculatePostSwapSubsidyComponents({ + currentBalanceRaw: "106", + discountSubsidyAmountRaw: "5", + expectedOutputAmountRaw: "105", + quotedActualOutputAmountRaw: "100" + }); + + expect(result.requiredAmountRaw.toFixed(0, 0)).toBe("0"); + expect(result.discrepancyAmountRaw.toFixed(0, 0)).toBe("0"); + expect(result.discountAmountRaw.toFixed(0, 0)).toBe("0"); + }); +}); diff --git a/apps/api/src/api/services/phases/helpers/post-swap-subsidy-breakdown.ts b/apps/api/src/api/services/phases/helpers/post-swap-subsidy-breakdown.ts new file mode 100644 index 000000000..0f3d282a8 --- /dev/null +++ b/apps/api/src/api/services/phases/helpers/post-swap-subsidy-breakdown.ts @@ -0,0 +1,49 @@ +import Big from "big.js"; + +type BigSource = string | number | Big; + +interface PostSwapSubsidyComponentsInput { + currentBalanceRaw: BigSource; + discountSubsidyAmountRaw: BigSource; + expectedOutputAmountRaw: BigSource; + quotedActualOutputAmountRaw?: BigSource; +} + +export interface PostSwapSubsidyComponents { + discountAmountRaw: Big; + discrepancyAmountRaw: Big; + requiredAmountRaw: Big; +} + +function positive(value: Big): Big { + return value.gt(0) ? value : Big(0); +} + +function minBig(a: Big, b: Big): Big { + return a.lt(b) ? a : b; +} + +export function calculatePostSwapSubsidyComponents({ + currentBalanceRaw, + discountSubsidyAmountRaw, + expectedOutputAmountRaw, + quotedActualOutputAmountRaw +}: PostSwapSubsidyComponentsInput): PostSwapSubsidyComponents { + const currentBalance = Big(currentBalanceRaw); + const expectedOutputAmount = Big(expectedOutputAmountRaw); + const discountSubsidyAmount = positive(Big(discountSubsidyAmountRaw)); + const quotedActualOutputAmount = + quotedActualOutputAmountRaw === undefined + ? expectedOutputAmount.minus(discountSubsidyAmount) + : Big(quotedActualOutputAmountRaw); + + const requiredAmountRaw = positive(expectedOutputAmount.minus(currentBalance)); + const discrepancyBaselineRaw = minBig(positive(quotedActualOutputAmount), expectedOutputAmount); + const discrepancyAmountRaw = positive(discrepancyBaselineRaw.minus(currentBalance)); + + return { + discountAmountRaw: positive(requiredAmountRaw.minus(discrepancyAmountRaw)), + discrepancyAmountRaw, + requiredAmountRaw + }; +} diff --git a/apps/api/src/api/services/phases/helpers/stellar-payment-verifier.ts b/apps/api/src/api/services/phases/helpers/stellar-payment-verifier.ts deleted file mode 100644 index ae267aea2..000000000 --- a/apps/api/src/api/services/phases/helpers/stellar-payment-verifier.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { HORIZON_URL } from "@vortexfi/shared"; -import Big from "big.js"; -import { Horizon } from "stellar-sdk"; -import logger from "../../../../config/logger"; -import QuoteTicket from "../../../../models/quoteTicket.model"; -import RampState from "../../../../models/rampState.model"; -import { StateMetadata } from "../meta-state-types"; - -/** - * Verifies if a stellar payment was successful by checking if the tokens - * are still present in the ephemeral account - */ -export async function verifyStellarPaymentSuccess(state: RampState): Promise { - const stateMetadata = state.state as StateMetadata; - const quote = await QuoteTicket.findByPk(state.quoteId); - - const { stellarEphemeralAccountId, stellarTarget } = stateMetadata; - - if (!quote) { - throw new Error("Quote not found for the given state"); - } - - if (!stellarEphemeralAccountId) { - throw new Error("Stellar ephemeral account ID not found in state metadata"); - } - - if (!stellarTarget) { - throw new Error("Stellar target information not found in state metadata"); - } - - if (!quote.metadata.nablaSwap?.outputAmountDecimal) { - throw new Error("Missing output amount in quote metadata for Nabla Swap"); - } - - const { stellarTokenDetails } = stellarTarget; - const expectedPaymentAmount = new Big(quote.metadata.nablaSwap.outputAmountDecimal); - - try { - logger.info( - `Verifying stellar payment success for account ${stellarEphemeralAccountId}, ` + - `asset ${stellarTokenDetails.stellarAsset.code.string}, ` + - `expected payment amount: ${expectedPaymentAmount.toString()}` - ); - - const currentBalance = await getStellarTokenBalance( - stellarEphemeralAccountId, - stellarTokenDetails.stellarAsset.code.string, - stellarTokenDetails.stellarAsset.issuer.stellarEncoding - ); - - logger.info(`Current balance: ${currentBalance.toString()}, expected payment: ${expectedPaymentAmount.toString()}`); - - // For Stellar payment operations, the transaction either succeeds completely or fails completely. - // If the payment succeeded, ALL tokens should have been transferred, leaving exactly 0 balance. - // Any remaining balance indicates the payment did not complete successfully. - if (currentBalance.eq(0)) { - logger.info( - `Payment succeeded: current balance is exactly 0, all ${expectedPaymentAmount.toString()} tokens were transferred` - ); - return true; // Payment succeeded - no tokens left - } else { - logger.warn( - `Payment failed: ${currentBalance.toString()} tokens still remain on account ` + - `(expected all ${expectedPaymentAmount.toString()} tokens to be transferred)` - ); - return false; // Payment failed - tokens still present - } - } catch (error) { - logger.error(`Error verifying stellar payment success: ${error}`); - throw new Error(`Failed to verify stellar payment success: ${error}`); - } -} - -/** - * Gets the balance of a specific token for a Stellar account - */ -async function getStellarTokenBalance(accountId: string, assetCode: string, assetIssuer: string): Promise { - try { - const server = new Horizon.Server(HORIZON_URL); - const account = await server.loadAccount(accountId); - - const assetBalance = account.balances.find(balance => { - if (balance.asset_type === "credit_alphanum4" || balance.asset_type === "credit_alphanum12") { - return balance.asset_code === assetCode && balance.asset_issuer === assetIssuer; - } - return false; - }); - - if (!assetBalance) { - logger.warn(`Asset ${assetCode} not found in account ${accountId} balances`); - return new Big(0); - } - - return new Big(assetBalance.balance); - } catch (error) { - logger.error(`Error getting stellar token balance for account ${accountId}: ${error}`); - throw error; - } -} diff --git a/apps/api/src/api/services/phases/helpers/stellar-sequence-validator.ts b/apps/api/src/api/services/phases/helpers/stellar-sequence-validator.ts deleted file mode 100644 index 4a127cb38..000000000 --- a/apps/api/src/api/services/phases/helpers/stellar-sequence-validator.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { Horizon } from "stellar-sdk"; -import logger from "../../../../config/logger"; -import RampState from "../../../../models/rampState.model"; -import { horizonServer } from "../handlers/helpers"; - -/** - * Validates that the stellarPayment transaction can execute by comparing - * the expected sequence number with the current ephemeral account sequence number - */ -export async function validateStellarPaymentSequenceNumber(state: RampState, stellarEphemeralAccountId: string): Promise { - try { - const stellarPaymentTx = state.presignedTxs?.find(tx => tx.phase === "stellarPayment"); - - if (!stellarPaymentTx?.meta?.expectedSequenceNumber) { - throw new Error("Expected sequence number not found in stellarPayment transaction metadata"); - } - - const expectedSequenceNumber = stellarPaymentTx.meta.expectedSequenceNumber as string; - - let currentAccount: Horizon.AccountResponse; - try { - currentAccount = await horizonServer.loadAccount(stellarEphemeralAccountId); - } catch (error) { - throw new Error(`Failed to load Stellar ephemeral account ${stellarEphemeralAccountId}: ${error}`); - } - - const currentSequenceNumber = currentAccount.sequenceNumber(); - - logger.info( - `Validating sequence numbers for ephemeral account ${stellarEphemeralAccountId}: ` + - `expected=${expectedSequenceNumber}, current=${currentSequenceNumber}` - ); - - const expectedBigInt = BigInt(expectedSequenceNumber); - const currentBigInt = BigInt(currentSequenceNumber); - - if (expectedBigInt <= currentBigInt) { - throw new Error( - `Stellar payment transaction sequence validation failed: expected sequence number ${expectedSequenceNumber} is not greater than the current account sequence number ${currentSequenceNumber}. The stellarPayment transaction may not be able to execute.` - ); - } - } catch (error) { - logger.error(`Stellar payment sequence number validation failed: ${error}`); - throw error; - } -} diff --git a/apps/api/src/api/services/phases/meta-state-types.ts b/apps/api/src/api/services/phases/meta-state-types.ts index 6d6c2037b..a1b81f1e5 100644 --- a/apps/api/src/api/services/phases/meta-state-types.ts +++ b/apps/api/src/api/services/phases/meta-state-types.ts @@ -1,30 +1,17 @@ -import { - AlfredpayFiatPaymentInstructions, - ExtrinsicOptions, - IbanPaymentData, - PermitSignature, - StellarTokenDetails -} from "@vortexfi/shared"; +import { AlfredpayFiatPaymentInstructions, ExtrinsicOptions, IbanPaymentData } from "@vortexfi/shared"; export interface StateMetadata { nablaSoftMinimumOutputRaw: string; // Only used in offramp squidRouterReceiverId: string; squidRouterReceiverHash: string; - // Only used in offramp - eurc & ars route - stellarEphemeralAccountId: string; - stellarTarget: { - stellarTargetAccountId: string; - stellarTokenDetails: StellarTokenDetails; - }; - executeSpacewalkNonce: number; distributeFeeHash: string; // Only used in onramp - brla aveniaTicketId: string; + onHold?: boolean; taxId: string; pixDestination: string; brlaEvmAddress: string; - moneriumWalletAddress: string | undefined; walletAddress: string | undefined; destinationAddress: string; receiverTaxId: string; @@ -54,8 +41,6 @@ export interface StateMetadata { presignChecksPass?: boolean; payOutTicketId: string | undefined; brlaPayoutTxHash?: `0x${string}`; - // Only used in onramp, offramp - monerium - moneriumOnrampPermit?: PermitSignature; permitTxHash?: string; moneriumOnrampSelfTransferHash?: string; ibanPaymentData: IbanPaymentData; @@ -65,6 +50,8 @@ export interface StateMetadata { // Final transaction hash and explorer link (computed once when ramp is complete) finalTransactionHash?: string; finalTransactionExplorerLink?: string; + finalTransactionHashV2?: string; + finalTransactionExplorerLinkV2?: string; // Alfredpay alfredpayUserId?: string; alfredpayTransactionId?: string; @@ -76,9 +63,10 @@ export interface StateMetadata { alfredpayOfframpTransferTxHash?: string; squidRouterPermitExecutionHash?: string; squidRouterPermitExecutionValue?: string; - stellarPaymentTxHash?: string; nablaSwapTxHash?: string; isDirectTransfer?: boolean; + // Snapshot of destination-token raw balance on the ephemeral, recorded immediately before squidRouterPay so finalSettlementSubsidy can compute actual bridge delivery rather than total balance (which may include leftover dust from prior phases). + preSettlementBalance?: string; // Fallback path used when input ERC20 does not support EIP-2612 permit. // The user submits the substituting transaction(s) from their own wallet and // reports back the resulting tx hashes via UpdateRampRequest.additionalData. @@ -86,4 +74,10 @@ export interface StateMetadata { squidRouterNoPermitTransferHash?: string; squidRouterNoPermitApproveHash?: string; squidRouterNoPermitSwapHash?: string; + // Mykobo - EUR offramp on Base + mykoboEmail?: string; + mykoboTransactionId?: string; + mykoboReceivablesAddress?: string; + mykoboPayoutTxHash?: `0x${string}`; + mykoboTransactionReference?: string; } diff --git a/apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts b/apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts new file mode 100644 index 000000000..ad97c5de7 --- /dev/null +++ b/apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts @@ -0,0 +1,331 @@ +import { describe, expect, it, mock } from "bun:test"; +import fs from "node:fs"; +import path from "node:path"; +import Big from "big.js"; +import { Keyring } from "@polkadot/api"; +import { mnemonicGenerate } from "@polkadot/util-crypto"; + +// Mock the EVM Nabla swap quote function before importing QuoteService so the +// quote engine does not hit Base RPC for the (currently illiquid) USDC<->EURC pool. +mock.module("../quote/core/nabla", () => { + return { + calculateNablaSwapOutputEvm: async (request: { + inputAmountForSwap: string; + inputTokenDetails: { decimals: number }; + outputTokenDetails: { decimals: number }; + }) => { + console.log("[MOCK] calculateNablaSwapOutputEvm called with", request.inputAmountForSwap); + const decimalOut = new Big(request.inputAmountForSwap).times("0.92"); + const rawOut = decimalOut.times(new Big(10).pow(request.outputTokenDetails.decimals)).toFixed(0, 0); + return { + effectiveExchangeRate: "0.92", + nablaOutputAmountDecimal: decimalOut, + nablaOutputAmountRaw: rawOut + }; + }, + calculateNablaSwapOutput: async () => { + throw new Error("calculateNablaSwapOutput should not be called in EVM-only test"); + } + }; +}); +import { + AccountMeta, + BrlaApiService, + DestinationType, + EPaymentMethod, + EphemeralAccount, + EphemeralAccountType, + EvmToken, + FiatToken, + MYKOBO_ACCESS_KEY, + MYKOBO_BASE_URL, + MYKOBO_SECRET_KEY, + MykoboApiService, + MykoboCurrency, + MykoboFeeKind, + MykoboTransactionStatus, + MykoboTransactionType, + Networks, + RampDirection, + RegisterRampRequest +} from "@vortexfi/shared"; +import { UpdateOptions } from "sequelize"; +import QuoteTicket, { QuoteTicketAttributes, QuoteTicketCreationAttributes } from "../../../models/quoteTicket.model"; +import RampState, { RampStateAttributes, RampStateCreationAttributes } from "../../../models/rampState.model"; +import RampRecoveryWorker from "../../workers/ramp-recovery.worker"; +import { QuoteService } from "../quote"; +import { RampService } from "../ramp/ramp.service"; +import registerPhaseHandlers from "./register-handlers"; +import { StateMetadata } from "./meta-state-types"; + +const EVM_TESTING_ADDRESS = "0x30a300612ab372CC73e53ffE87fB73d62Ed68Da3"; +const EVM_DESTINATION_ADDRESS = "0x7ba99e99bc669b3508aff9cc0a898e869459f877"; +const TEST_INPUT_AMOUNT = "35"; +const TEST_EMAIL = "mail@test.com"; +const TEST_IP_ADDRESS = "203.0.113.42"; + +const filePath = path.join(__dirname, "lastRampStateMykoboEur.json"); +const EVM_ADDRESS_REGEX = /^0x[a-fA-F0-9]{40}$/; + +interface TestSigningAccounts { + EVM: EphemeralAccount; + Substrate: EphemeralAccount; +} + +async function createSubstrateEphemeral(): Promise { + const seedPhrase = mnemonicGenerate(); + const keyring = new Keyring({ type: "sr25519" }); + await new Promise(resolve => setTimeout(resolve, 1000)); + const kp = keyring.addFromUri(seedPhrase); + return { address: kp.address, secret: seedPhrase }; +} + +async function createMoonbeamEphemeralSeed(): Promise { + const seedPhrase = mnemonicGenerate(); + const keyring = new Keyring({ type: "ethereum" }); + const kp = keyring.addFromUri(`${seedPhrase}/m/44'/60'/0'/0/0`); + return { address: kp.address, secret: seedPhrase }; +} + +const testSigningAccounts: TestSigningAccounts = { + EVM: await createMoonbeamEphemeralSeed(), + Substrate: await createSubstrateEphemeral() +}; + +const testSigningAccountsMeta: AccountMeta[] = Object.keys(testSigningAccounts).map(networkKey => ({ + address: testSigningAccounts[networkKey as keyof TestSigningAccounts].address, + type: networkKey as EphemeralAccountType +})); + +let rampState: RampState; +let quoteTicket: QuoteTicket; + +type RampStateUpdateData = Partial; +type QuoteTicketUpdateData = Partial; + +RampState.update = mock(async function (updateData: RampStateUpdateData) { + rampState = { ...rampState, ...updateData, updatedAt: new Date() } as RampState; + fs.writeFileSync(filePath, JSON.stringify(rampState, null, 2)); + return rampState; +}) as unknown as typeof RampState.update; + +RampState.findByPk = mock(async (_id: string): Promise => rampState) as typeof RampState.findByPk; + +RampState.create = mock(async (data: RampStateCreationAttributes): Promise => { + rampState = { + ...data, + createdAt: new Date(), + id: data.id || "test-mykobo-ramp-id", + reload: async function (_options?: UpdateOptions): Promise { + return rampState; + }, + update: async function ( + updateData: RampStateUpdateData, + _options?: UpdateOptions + ): Promise { + rampState = { ...rampState, ...updateData, updatedAt: new Date() } as RampState; + fs.writeFileSync(filePath, JSON.stringify(rampState, null, 2)); + return rampState; + }, + updatedAt: new Date() + } as RampState; + fs.writeFileSync(filePath, JSON.stringify(rampState, null, 2)); + return rampState; +}) as typeof RampState.create; + +QuoteTicket.findByPk = mock(async (_id: string): Promise => quoteTicket) as typeof QuoteTicket.findByPk; + +QuoteTicket.update = mock(async (data: QuoteTicketUpdateData) => { + quoteTicket = { ...quoteTicket, ...data } as QuoteTicket; + return [1, [quoteTicket]]; +}) as unknown as typeof QuoteTicket.update; + +QuoteTicket.create = mock(async (data: QuoteTicketCreationAttributes): Promise => { + quoteTicket = { + ...data, + createdAt: new Date(), + id: data.id || "test-mykobo-quote-id", + update: async function ( + updateData: QuoteTicketUpdateData, + _options?: UpdateOptions + ): Promise { + quoteTicket = { ...quoteTicket, ...updateData } as QuoteTicket; + return quoteTicket; + }, + updatedAt: new Date() + } as QuoteTicket; + return quoteTicket; +}) as typeof QuoteTicket.create; + +const mockBrlaApiService = { + acknowledgeEvents: mock(async (): Promise => Promise.resolve()), + createFastQuote: mock(async () => ({ basePrice: "100" })), + createSubaccount: mock(async () => ({ id: "subaccount123" })), + generateBrCode: mock(async () => ({ brCode: "brcode123" })), + getAllEventsByUser: mock(async () => []), + getOnChainHistoryOut: mock(async () => []), + getPayInHistory: mock(async () => []), + getSubaccount: mock(async () => ({ brCode: "brcode123", wallets: { evm: EVM_DESTINATION_ADDRESS } })), + login: mock(async (): Promise => Promise.resolve()), + sendRequest: mock(async () => ({})), + swapRequest: mock(async () => ({ id: "swap123" })), + triggerOfframp: mock(async () => ({ id: "offramp123" })), + validatePixKey: mock(async () => ({ bankName: "Test Bank", name: "Test", taxId: "x" })) +}; + +BrlaApiService.getInstance = mock(() => mockBrlaApiService as unknown as BrlaApiService); + +RampRecoveryWorker.prototype.start = mock(async (): Promise => { + // worker disabled in test +}); + +describe("Mykobo EUR offramp contract test (real sandbox, no on-chain submission)", () => { + it("requires Mykobo sandbox credentials in the environment", () => { + if (!MYKOBO_ACCESS_KEY || !MYKOBO_SECRET_KEY) { + throw new Error("MYKOBO_ACCESS_KEY and MYKOBO_SECRET_KEY must be set to run this test"); + } + expect(MYKOBO_BASE_URL).toMatch(/mykobo/); + }); + + it("hits Mykobo /fees and returns a numeric total for WITHDRAW", async () => { + const mykobo = MykoboApiService.getInstance(); + const fees = await mykobo.lookupFees({ kind: MykoboFeeKind.WITHDRAW, value: TEST_INPUT_AMOUNT }); + console.log("Mykobo /fees response:", fees); + expect(fees).toBeDefined(); + expect(fees.total).toBeDefined(); + expect(Number.isFinite(Number(fees.total))).toBe(true); + }); + + it("creates a Mykobo WITHDRAW intent and returns withdraw instructions with an EVM address", async () => { + const mykobo = MykoboApiService.getInstance(); + let intent; + try { + intent = await mykobo.createTransactionIntent({ + currency: MykoboCurrency.EURC, + email_address: TEST_EMAIL, + ip_address: TEST_IP_ADDRESS, + transaction_type: MykoboTransactionType.WITHDRAW, + value: "3.000000", + wallet_address: testSigningAccounts.EVM.address + }); + } catch (e) { + const err = e as { body?: unknown; status?: number }; + console.log("Mykobo intent error status:", err.status); + console.log("Mykobo intent error body:", JSON.stringify(err.body, null, 2)); + throw e; + } + console.log("Mykobo intent response:", JSON.stringify(intent, null, 2)); + + expect(intent.transaction).toBeDefined(); + expect(intent.transaction.id).toBeTruthy(); + expect(intent.transaction.reference).toBeTruthy(); + expect(intent.transaction.status).toBeDefined(); + expect(intent.transaction.value).toBeDefined(); + expect(intent.transaction.wallet_address).toBe(testSigningAccounts.EVM.address); + expect(intent.instructions).toBeDefined(); + if (!intent.instructions || !("address" in intent.instructions)) { + throw new Error("Expected withdraw instructions with `address` field"); + } + expect(intent.instructions.address).toMatch(EVM_ADDRESS_REGEX); + + const fetched = await mykobo.getTransaction(intent.transaction.id); + console.log("Mykobo getTransaction response:", fetched); + expect(fetched.transaction.id).toBe(intent.transaction.id); + expect(Object.values(MykoboTransactionStatus)).toContain(fetched.transaction.status as MykoboTransactionStatus); + }); + + it("creates a EUR offramp quote on Base via QuoteService and populates nablaSwapEvm metadata", async () => { + const quoteService = new QuoteService(); + + const quote = await quoteService.createQuote({ + from: Networks.Base as DestinationType, + inputAmount: TEST_INPUT_AMOUNT, + inputCurrency: EvmToken.USDC, + network: Networks.Base, + outputCurrency: FiatToken.EURC, + rampType: RampDirection.SELL, + to: EPaymentMethod.SEPA as DestinationType + }); + + console.log("Quote created:", { + id: quote.id, + inputAmount: quote.inputAmount, + outputAmount: quote.outputAmount, + totalFeeFiat: quote.totalFeeFiat + }); + console.log("nablaSwapEvm metadata:", quoteTicket.metadata.nablaSwapEvm); + + expect(quote.inputCurrency).toBe(EvmToken.USDC); + expect(quote.outputCurrency).toBe(FiatToken.EURC); + expect(Number(quote.outputAmount)).toBeGreaterThan(0); + expect(Number(quote.totalFeeFiat)).toBeGreaterThan(0); + expect(quoteTicket.metadata.nablaSwapEvm).toBeDefined(); + expect(quoteTicket.metadata.nablaSwapEvm?.outputAmountDecimal).toBeDefined(); + expect(quoteTicket.metadata.nablaSwapEvm?.outputAmountRaw).toBeDefined(); + expect(Number(quoteTicket.metadata.nablaSwapEvm?.outputAmountDecimal)).toBeGreaterThan(0); + }); + + it("registers a Base+USDC ramp and prepares the Mykobo phase set (no squid, no broadcast)", async () => { + const rampService = new RampService(); + const quoteService = new QuoteService(); + + registerPhaseHandlers(); + + const quote = await quoteService.createQuote({ + from: Networks.Base as DestinationType, + inputAmount: TEST_INPUT_AMOUNT, + inputCurrency: EvmToken.USDC, + network: Networks.Base, + outputCurrency: FiatToken.EURC, + rampType: RampDirection.SELL, + to: EPaymentMethod.SEPA as DestinationType + }); + + const additionalData: RegisterRampRequest["additionalData"] = { + destinationAddress: EVM_DESTINATION_ADDRESS, + email: TEST_EMAIL, + ipAddress: TEST_IP_ADDRESS, + walletAddress: EVM_TESTING_ADDRESS + }; + + const registered = await rampService.registerRamp({ + additionalData, + quoteId: quote.id, + signingAccounts: testSigningAccountsMeta + }); + + if (!registered.unsignedTxs) { + throw new Error("Expected registerRamp to return unsigned transactions"); + } + + const phases = registered.unsignedTxs.map(tx => tx.phase); + console.log("Prepared phases:", phases); + + expect(phases).not.toContain("squidRouterApprove"); + expect(phases).not.toContain("squidRouterSwap"); + expect(phases).toContain("nablaApprove"); + expect(phases).toContain("nablaSwap"); + expect(phases).toContain("mykoboPayoutOnBase"); + expect(phases).toContain("baseCleanupUsdc"); + expect(phases).toContain("baseCleanupEurc"); + expect(phases).toContain("baseCleanupAxlUsdc"); + + const state = rampState.state as StateMetadata; + expect(state.mykoboEmail).toBe(TEST_EMAIL); + expect(state.mykoboTransactionId).toBeTruthy(); + expect(state.mykoboReceivablesAddress).toMatch(EVM_ADDRESS_REGEX); + expect(state.mykoboTransactionReference).toBeTruthy(); + expect(state.evmEphemeralAddress).toBe(testSigningAccounts.EVM.address); + console.log("StateMeta (Mykobo fields):", { + mykoboEmail: state.mykoboEmail, + mykoboReceivablesAddress: state.mykoboReceivablesAddress, + mykoboTransactionId: state.mykoboTransactionId, + mykoboTransactionReference: state.mykoboTransactionReference + }); + + const payoutTx = registered.unsignedTxs.find(tx => tx.phase === "mykoboPayoutOnBase"); + expect(payoutTx).toBeDefined(); + expect(payoutTx?.signer).toBe(testSigningAccounts.EVM.address); + expect(payoutTx?.network).toBe(Networks.Base); + }); +}); diff --git a/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts b/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts new file mode 100644 index 000000000..c8aa982b8 --- /dev/null +++ b/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts @@ -0,0 +1,338 @@ +import { describe, expect, it, mock } from "bun:test"; +import fs from "node:fs"; +import path from "node:path"; +import Big from "big.js"; +import { Keyring } from "@polkadot/api"; +import { mnemonicGenerate } from "@polkadot/util-crypto"; + +// Mock the EVM Nabla swap quote function before importing QuoteService so the +// quote engine does not hit Base RPC for the (currently illiquid) EURC<->USDC pool. +mock.module("../quote/core/nabla", () => { + return { + calculateNablaSwapOutputEvm: async (request: { + inputAmountForSwap: string; + inputTokenDetails: { decimals: number }; + outputTokenDetails: { decimals: number }; + }) => { + console.log("[MOCK] calculateNablaSwapOutputEvm called with", request.inputAmountForSwap); + const decimalOut = new Big(request.inputAmountForSwap).times("1.05"); + const rawOut = decimalOut.times(new Big(10).pow(request.outputTokenDetails.decimals)).toFixed(0, 0); + return { + effectiveExchangeRate: "1.05", + nablaOutputAmountDecimal: decimalOut, + nablaOutputAmountRaw: rawOut + }; + }, + calculateNablaSwapOutput: async () => { + throw new Error("calculateNablaSwapOutput should not be called in EVM-only test"); + } + }; +}); +import { + AccountMeta, + BrlaApiService, + DestinationType, + EPaymentMethod, + EphemeralAccount, + EphemeralAccountType, + EvmToken, + FiatToken, + IbanPaymentData, + MYKOBO_ACCESS_KEY, + MYKOBO_BASE_URL, + MYKOBO_SECRET_KEY, + MykoboApiService, + MykoboCurrency, + MykoboFeeKind, + MykoboTransactionStatus, + MykoboTransactionType, + Networks, + RampDirection, + RegisterRampRequest +} from "@vortexfi/shared"; +import { UpdateOptions } from "sequelize"; +import QuoteTicket, { QuoteTicketAttributes, QuoteTicketCreationAttributes } from "../../../models/quoteTicket.model"; +import RampState, { RampStateAttributes, RampStateCreationAttributes } from "../../../models/rampState.model"; +import RampRecoveryWorker from "../../workers/ramp-recovery.worker"; +import { QuoteService } from "../quote"; +import { RampService } from "../ramp/ramp.service"; +import registerPhaseHandlers from "./register-handlers"; +import { StateMetadata } from "./meta-state-types"; + +const EVM_TESTING_ADDRESS = "0x30a300612ab372CC73e53ffE87fB73d62Ed68Da3"; +const EVM_DESTINATION_ADDRESS = "0x7ba99e99bc669b3508aff9cc0a898e869459f877"; +const TEST_INPUT_AMOUNT = "35"; +const TEST_EMAIL = "mail@test.com"; +const TEST_IP_ADDRESS = "203.0.113.42"; + +const filePath = path.join(__dirname, "lastRampStateMykoboEurOnramp.json"); +const EVM_ADDRESS_REGEX = /^0x[a-fA-F0-9]{40}$/; +const IBAN_REGEX = /^[A-Z]{2}[0-9A-Z]{2}[0-9A-Z]{4,30}$/; + +interface TestSigningAccounts { + EVM: EphemeralAccount; + Substrate: EphemeralAccount; +} + +async function createSubstrateEphemeral(): Promise { + const seedPhrase = mnemonicGenerate(); + const keyring = new Keyring({ type: "sr25519" }); + await new Promise(resolve => setTimeout(resolve, 1000)); + const kp = keyring.addFromUri(seedPhrase); + return { address: kp.address, secret: seedPhrase }; +} + +async function createMoonbeamEphemeralSeed(): Promise { + const seedPhrase = mnemonicGenerate(); + const keyring = new Keyring({ type: "ethereum" }); + const kp = keyring.addFromUri(`${seedPhrase}/m/44'/60'/0'/0/0`); + return { address: kp.address, secret: seedPhrase }; +} + +const testSigningAccounts: TestSigningAccounts = { + EVM: await createMoonbeamEphemeralSeed(), + Substrate: await createSubstrateEphemeral() +}; + +const testSigningAccountsMeta: AccountMeta[] = Object.keys(testSigningAccounts).map(networkKey => ({ + address: testSigningAccounts[networkKey as keyof TestSigningAccounts].address, + type: networkKey as EphemeralAccountType +})); + +let rampState: RampState; +let quoteTicket: QuoteTicket; + +type RampStateUpdateData = Partial; +type QuoteTicketUpdateData = Partial; + +RampState.update = mock(async function (updateData: RampStateUpdateData) { + rampState = { ...rampState, ...updateData, updatedAt: new Date() } as RampState; + fs.writeFileSync(filePath, JSON.stringify(rampState, null, 2)); + return rampState; +}) as unknown as typeof RampState.update; + +RampState.findByPk = mock(async (_id: string): Promise => rampState) as typeof RampState.findByPk; + +RampState.create = mock(async (data: RampStateCreationAttributes): Promise => { + rampState = { + ...data, + createdAt: new Date(), + id: data.id || "test-mykobo-onramp-ramp-id", + reload: async function (_options?: UpdateOptions): Promise { + return rampState; + }, + update: async function ( + updateData: RampStateUpdateData, + _options?: UpdateOptions + ): Promise { + rampState = { ...rampState, ...updateData, updatedAt: new Date() } as RampState; + fs.writeFileSync(filePath, JSON.stringify(rampState, null, 2)); + return rampState; + }, + updatedAt: new Date() + } as RampState; + fs.writeFileSync(filePath, JSON.stringify(rampState, null, 2)); + return rampState; +}) as typeof RampState.create; + +QuoteTicket.findByPk = mock(async (_id: string): Promise => quoteTicket) as typeof QuoteTicket.findByPk; + +QuoteTicket.update = mock(async (data: QuoteTicketUpdateData) => { + quoteTicket = { ...quoteTicket, ...data } as QuoteTicket; + return [1, [quoteTicket]]; +}) as unknown as typeof QuoteTicket.update; + +QuoteTicket.create = mock(async (data: QuoteTicketCreationAttributes): Promise => { + quoteTicket = { + ...data, + createdAt: new Date(), + id: data.id || "test-mykobo-onramp-quote-id", + update: async function ( + updateData: QuoteTicketUpdateData, + _options?: UpdateOptions + ): Promise { + quoteTicket = { ...quoteTicket, ...updateData } as QuoteTicket; + return quoteTicket; + }, + updatedAt: new Date() + } as QuoteTicket; + return quoteTicket; +}) as typeof QuoteTicket.create; + +const mockBrlaApiService = { + acknowledgeEvents: mock(async (): Promise => Promise.resolve()), + createFastQuote: mock(async () => ({ basePrice: "100" })), + createSubaccount: mock(async () => ({ id: "subaccount123" })), + generateBrCode: mock(async () => ({ brCode: "brcode123" })), + getAllEventsByUser: mock(async () => []), + getOnChainHistoryOut: mock(async () => []), + getPayInHistory: mock(async () => []), + getSubaccount: mock(async () => ({ brCode: "brcode123", wallets: { evm: EVM_DESTINATION_ADDRESS } })), + login: mock(async (): Promise => Promise.resolve()), + sendRequest: mock(async () => ({})), + swapRequest: mock(async () => ({ id: "swap123" })), + triggerOfframp: mock(async () => ({ id: "offramp123" })), + validatePixKey: mock(async () => ({ bankName: "Test Bank", name: "Test", taxId: "x" })) +}; + +BrlaApiService.getInstance = mock(() => mockBrlaApiService as unknown as BrlaApiService); + +RampRecoveryWorker.prototype.start = mock(async (): Promise => { + // worker disabled in test +}); + +describe("Mykobo EUR onramp contract test (real sandbox, no on-chain submission)", () => { + it("requires Mykobo sandbox credentials in the environment", () => { + if (!MYKOBO_ACCESS_KEY || !MYKOBO_SECRET_KEY) { + throw new Error("MYKOBO_ACCESS_KEY and MYKOBO_SECRET_KEY must be set to run this test"); + } + expect(MYKOBO_BASE_URL).toMatch(/mykobo/); + }); + + it("hits Mykobo /fees and returns a numeric total for DEPOSIT", async () => { + const mykobo = MykoboApiService.getInstance(); + const fees = await mykobo.lookupFees({ kind: MykoboFeeKind.DEPOSIT, value: TEST_INPUT_AMOUNT }); + console.log("Mykobo /fees response:", fees); + expect(fees).toBeDefined(); + expect(fees.total).toBeDefined(); + expect(Number.isFinite(Number(fees.total))).toBe(true); + }); + + it("creates a Mykobo DEPOSIT intent and returns IBAN instructions", async () => { + const mykobo = MykoboApiService.getInstance(); + let intent; + try { + intent = await mykobo.createTransactionIntent({ + currency: MykoboCurrency.EURC, + email_address: TEST_EMAIL, + ip_address: TEST_IP_ADDRESS, + transaction_type: MykoboTransactionType.DEPOSIT, + value: "3.000000", + wallet_address: testSigningAccounts.EVM.address + }); + } catch (e) { + const err = e as { body?: unknown; status?: number }; + console.log("Mykobo intent error status:", err.status); + console.log("Mykobo intent error body:", JSON.stringify(err.body, null, 2)); + throw e; + } + console.log("Mykobo intent response:", JSON.stringify(intent, null, 2)); + + expect(intent.transaction).toBeDefined(); + expect(intent.transaction.id).toBeTruthy(); + expect(intent.transaction.reference).toBeTruthy(); + expect(intent.transaction.status).toBeDefined(); + expect(intent.transaction.value).toBeDefined(); + expect(intent.transaction.wallet_address).toBe(testSigningAccounts.EVM.address); + expect(intent.instructions).toBeDefined(); + if (!intent.instructions || !("iban" in intent.instructions)) { + throw new Error("Expected deposit instructions with `iban` field"); + } + expect(intent.instructions.iban).toMatch(IBAN_REGEX); + expect(intent.instructions.bank_account_name).toBeTruthy(); + + const fetched = await mykobo.getTransaction(intent.transaction.id); + console.log("Mykobo getTransaction response:", fetched); + expect(fetched.transaction.id).toBe(intent.transaction.id); + expect(Object.values(MykoboTransactionStatus)).toContain(fetched.transaction.status as MykoboTransactionStatus); + }); + + it("creates a EUR onramp quote on Base via QuoteService and populates mykoboMint metadata", async () => { + const quoteService = new QuoteService(); + + const quote = await quoteService.createQuote({ + from: EPaymentMethod.SEPA as DestinationType, + inputAmount: TEST_INPUT_AMOUNT, + inputCurrency: FiatToken.EURC, + network: Networks.Base, + outputCurrency: EvmToken.USDC, + rampType: RampDirection.BUY, + to: Networks.Base as DestinationType + }); + + console.log("Quote created:", { + id: quote.id, + inputAmount: quote.inputAmount, + outputAmount: quote.outputAmount, + totalFeeFiat: quote.totalFeeFiat + }); + console.log("mykoboMint metadata:", quoteTicket.metadata.mykoboMint); + + expect(quote.inputCurrency).toBe(FiatToken.EURC); + expect(quote.outputCurrency).toBe(EvmToken.USDC); + expect(Number(quote.outputAmount)).toBeGreaterThan(0); + expect(Number(quote.totalFeeFiat)).toBeGreaterThanOrEqual(0); + expect(quoteTicket.metadata.mykoboMint).toBeDefined(); + expect(quoteTicket.metadata.mykoboMint?.outputAmountRaw).toBeDefined(); + expect(Number(quoteTicket.metadata.mykoboMint?.outputAmountRaw)).toBeGreaterThan(0); + }); + + it("registers a EUR->Base USDC onramp and prepares the Mykobo phase set (no squid, no broadcast)", async () => { + const rampService = new RampService(); + const quoteService = new QuoteService(); + + registerPhaseHandlers(); + + const quote = await quoteService.createQuote({ + from: EPaymentMethod.SEPA as DestinationType, + inputAmount: TEST_INPUT_AMOUNT, + inputCurrency: FiatToken.EURC, + network: Networks.Base, + outputCurrency: EvmToken.USDC, + rampType: RampDirection.BUY, + to: Networks.Base as DestinationType + }); + + const additionalData: RegisterRampRequest["additionalData"] = { + destinationAddress: EVM_DESTINATION_ADDRESS, + email: TEST_EMAIL, + ipAddress: TEST_IP_ADDRESS, + walletAddress: EVM_TESTING_ADDRESS + }; + + const registered = await rampService.registerRamp({ + additionalData, + quoteId: quote.id, + signingAccounts: testSigningAccountsMeta + }); + + if (!registered.unsignedTxs) { + throw new Error("Expected registerRamp to return unsigned transactions"); + } + + const phases = registered.unsignedTxs.map(tx => tx.phase); + console.log("Prepared phases:", phases); + + expect(phases).not.toContain("squidRouterApprove"); + expect(phases).not.toContain("squidRouterSwap"); + expect(phases).toContain("nablaApprove"); + expect(phases).toContain("nablaSwap"); + expect(phases).toContain("destinationTransfer"); + expect(phases).toContain("baseCleanupEurc"); + expect(phases).toContain("baseCleanupUsdc"); + + const state = rampState.state as StateMetadata; + expect(state.mykoboEmail).toBe(TEST_EMAIL); + expect(state.mykoboTransactionId).toBeTruthy(); + expect(state.mykoboTransactionReference).toBeTruthy(); + expect(state.evmEphemeralAddress).toBe(testSigningAccounts.EVM.address); + + const ibanPaymentData = (rampState.state as StateMetadata & { ibanPaymentData?: IbanPaymentData }).ibanPaymentData; + expect(ibanPaymentData).toBeDefined(); + expect(ibanPaymentData?.iban).toMatch(IBAN_REGEX); + expect(ibanPaymentData?.receiverName).toBeTruthy(); + expect(ibanPaymentData?.reference).toBe(state.mykoboTransactionReference); + + console.log("StateMeta (Mykobo fields):", { + ibanPaymentData, + mykoboEmail: state.mykoboEmail, + mykoboTransactionId: state.mykoboTransactionId, + mykoboTransactionReference: state.mykoboTransactionReference + }); + + const destinationTx = registered.unsignedTxs.find(tx => tx.phase === "destinationTransfer"); + expect(destinationTx).toBeDefined(); + expect(destinationTx?.signer).toBe(testSigningAccounts.EVM.address); + expect(destinationTx?.network).toBe(Networks.Base); + }); +}); diff --git a/apps/api/src/api/services/phases/phase-processor.integration.test.ts b/apps/api/src/api/services/phases/phase-processor.integration.test.ts deleted file mode 100644 index 464cd9db4..000000000 --- a/apps/api/src/api/services/phases/phase-processor.integration.test.ts +++ /dev/null @@ -1,282 +0,0 @@ -import {describe, it, mock} from "bun:test"; -import fs from "node:fs"; -import path from "node:path"; -import { - AccountMeta, - API, - ApiManager, - BrlaApiService, - DestinationType, - EPaymentMethod, - EphemeralAccount, - EphemeralAccountType, - EvmToken, - FiatToken, - Networks, - RampDirection, - RegisterRampRequest, - signUnsignedTransactions, -} from "@vortexfi/shared"; -import {Keyring} from "@polkadot/api"; -import {mnemonicGenerate} from "@polkadot/util-crypto"; -import Big from "big.js"; -import {UpdateOptions} from "sequelize"; -import {Keypair} from "stellar-sdk"; -import QuoteTicket, {QuoteTicketAttributes, QuoteTicketCreationAttributes} from "../../../models/quoteTicket.model"; -import RampState, {RampStateAttributes, RampStateCreationAttributes} from "../../../models/rampState.model"; -import RampRecoveryWorker from "../../workers/ramp-recovery.worker"; -import {QuoteService} from "../quote"; -import {RampService} from "../ramp/ramp.service"; -import registerPhaseHandlers from "./register-handlers"; - -const EVM_TESTING_ADDRESS = "0x30a300612ab372CC73e53ffE87fB73d62Ed68Da3"; -const EVM_DESTINATION_ADDRESS = "0x7ba99e99bc669b3508aff9cc0a898e869459f877"; -const STELLAR_MOCK_ANCHOR_ACCOUNT = "GAXW7RTC4LA3MGNEA3LO626ABUCZBW3FDQPYBTH6VQA5BFHXXYZUQWY7"; -const TEST_INPUT_AMOUNT = "1"; -const TEST_INPUT_CURRENCY = EvmToken.USDC; -const TEST_OUTPUT_CURRENCY = FiatToken.ARS; - -const QUOTE_TO = EPaymentMethod.SEPA; -const QUOTE_FROM = "evm"; - -const filePath = path.join(__dirname, "lastRampState.json"); - -interface TestSigningAccounts { - EVM: EphemeralAccount; - Substrate: EphemeralAccount; - Stellar: EphemeralAccount; -} - -async function getPendulumNode(): Promise { - const apiManager = ApiManager.getInstance(); - const networkName = "pendulum"; - return await apiManager.getApi(networkName); -} - -async function getMoonbeamNode(): Promise { - const apiManager = ApiManager.getInstance(); - const networkName = "moonbeam"; - return await apiManager.getApi(networkName); -} - -async function getHydrationNode(): Promise { - const apiManager = ApiManager.getInstance(); - const networkName = "hydration"; - return await apiManager.getApi(networkName); -} - -export async function createSubstrateEphemeral(): Promise { - const seedPhrase = mnemonicGenerate(); - - const keyring = new Keyring({ type: "sr25519" }); - await new Promise(resolve => setTimeout(resolve, 1000)); - const ephemeralAccountKeypair = keyring.addFromUri(seedPhrase); - - return { address: ephemeralAccountKeypair.address, secret: seedPhrase }; -} - -export function createStellarEphemeral(): EphemeralAccount { - const ephemeralKeys = Keypair.random(); - const address = ephemeralKeys.publicKey(); - - return { address, secret: ephemeralKeys.secret() }; -} - -export async function createMoonbeamEphemeralSeed(): Promise { - const seedPhrase = mnemonicGenerate(); - const keyring = new Keyring({ type: "ethereum" }); - - const ephemeralAccountKeypair = keyring.addFromUri(`${seedPhrase}/m/44'/60'/${0}'/${0}/${0}`); - - return { address: ephemeralAccountKeypair.address, secret: seedPhrase }; -} - -const testSigningAccounts: TestSigningAccounts = { - EVM: await createMoonbeamEphemeralSeed(), - Substrate: await createSubstrateEphemeral(), - Stellar: createStellarEphemeral() -}; - -const testSigningAccountsMeta: AccountMeta[] = Object.keys(testSigningAccounts).map(networkKey => { - const address = testSigningAccounts[networkKey as keyof typeof testSigningAccounts].address; - const network = networkKey as EphemeralAccountType; - return { address, type: network }; -}); - -console.log("Test Signing Accounts:", testSigningAccountsMeta); - -let rampState: RampState; -let quoteTicket: QuoteTicket; - -// Proper Sequelize types -type RampStateUpdateData = Partial; -type QuoteTicketUpdateData = Partial; - -// Mock RampState.update - static method returns [affectedCount, affectedRows] -RampState.update = mock(async function (updateData: RampStateUpdateData) { - rampState = { ...rampState, ...updateData, updatedAt: new Date() } as RampState; - - fs.writeFileSync(filePath, JSON.stringify(rampState, null, 2)); - return rampState; -}) as unknown as typeof RampState.update; - -RampState.findByPk = mock(async (_id: string): Promise => { - return rampState; -}) as typeof RampState.findByPk; - -RampState.create = mock(async (data: RampStateCreationAttributes): Promise => { - rampState = { - ...data, - createdAt: new Date(), - id: data.id || "test-id", - reload: async function (_options?: UpdateOptions): Promise { - return rampState; - }, - update: async function ( - updateData: RampStateUpdateData, - _options?: UpdateOptions - ): Promise { - rampState = { ...rampState, ...updateData, updatedAt: new Date() } as RampState; - - fs.writeFileSync(filePath, JSON.stringify(rampState, null, 2)); - return rampState; - }, - updatedAt: new Date() - } as RampState; - - fs.writeFileSync(filePath, JSON.stringify(rampState, null, 2)); - return rampState; -}) as typeof RampState.create; - -QuoteTicket.findByPk = mock(async (_id: string): Promise => { - return quoteTicket; -}) as typeof QuoteTicket.findByPk; - -QuoteTicket.create = mock(async (data: QuoteTicketCreationAttributes): Promise => { - quoteTicket = { - ...data, - createdAt: new Date(), - id: data.id || "test-quote-id", - update: async function ( - updateData: QuoteTicketUpdateData, - _options?: UpdateOptions - ): Promise { - quoteTicket = { ...quoteTicket, ...updateData } as QuoteTicket; - return quoteTicket; - }, - updatedAt: new Date() - } as QuoteTicket; - - console.log("Created QuoteTicket:", quoteTicket); - return quoteTicket; -}) as typeof QuoteTicket.create; - -const mockSubaccountData: { wallets: { evm: string }; brCode: string } = { - brCode: "brcode123", - wallets: { - evm: EVM_DESTINATION_ADDRESS, - } -}; - -const mockBrlaApiService = { - acknowledgeEvents: mock(async (): Promise => Promise.resolve()), - createFastQuote: mock(async () => ({ basePrice: "100" })), - createSubaccount: mock(async () => ({ id: "subaccount123" })), - generateBrCode: mock(async () => ({ brCode: "brcode123" })), - getAllEventsByUser: mock(async () => []), - getOnChainHistoryOut: mock(async () => []), - getPayInHistory: mock(async () => []), - getSubaccount: mock(async (): Promise<{ wallets: { evm: string }; brCode: string }> => mockSubaccountData), - login: mock(async (): Promise => Promise.resolve()), - sendRequest: mock(async () => ({})), - swapRequest: mock(async () => ({ id: "swap123" })), - triggerOfframp: mock(async () => ({ id: "offramp123" })), - validatePixKey: mock(async () => ({ - bankName: "Test Bank", - name: "Test Receiver", - taxId: "758.444.017-77" - })) -}; - -const mockVerifyReferenceLabel = mock(async (reference: string, receiverAddress: string): Promise => { - console.log("Verifying reference label:", reference, receiverAddress); - return true; -}); - -mock.module("../brla/helpers", () => { - return { - verifyReferenceLabel: mockVerifyReferenceLabel - }; -}); - -BrlaApiService.getInstance = mock(() => mockBrlaApiService as unknown as BrlaApiService); - -RampService.prototype.validateBrlaOfframpRequest = mock(async (): Promise<{ wallets: { evm: string }; brCode: string }> => mockSubaccountData); - -RampRecoveryWorker.prototype.start = mock(async (): Promise => { - // do nothing -}); - -describe("PhaseProcessor Integration Test", () => { - it("should process an offramp (evm -> sepa) through multiple phases until completion", async () => { - try { - const rampService = new RampService(); - const quoteService = new QuoteService(); - - registerPhaseHandlers(); - - const quoteTicket = await quoteService.createQuote({ - from: QUOTE_FROM as DestinationType, - inputAmount: TEST_INPUT_AMOUNT, - inputCurrency: TEST_INPUT_CURRENCY, - network: Networks.Ethereum, // Offramp from EVM network - outputCurrency: TEST_OUTPUT_CURRENCY, - rampType: RampDirection.SELL, - to: QUOTE_TO as DestinationType - }); - - const additionalData: RegisterRampRequest["additionalData"] = { - paymentData: { - amount: new Big(quoteTicket.outputAmount).add(new Big(quoteTicket.totalFeeFiat)).toString(), - anchorTargetAccount: STELLAR_MOCK_ANCHOR_ACCOUNT, - memo: "1204asjfnaksf10982e4", - memoType: "text" as const - }, - pixDestination: "758.444.017-77", - receiverTaxId: "758.444.017-77", - taxId: "758.444.017-77", - walletAddress: EVM_TESTING_ADDRESS - }; - - const registeredRamp = await rampService.registerRamp({ - additionalData, - quoteId: quoteTicket.id, - signingAccounts: testSigningAccountsMeta - }); - - console.log("register ramp:", registeredRamp); - - const pendulumNode = await getPendulumNode(); - const moonbeamNode = await getMoonbeamNode(); - const hydrationNode = await getHydrationNode(); - - const presignedTxs = await signUnsignedTransactions( - registeredRamp?.unsignedTxs || [], - { - evmEphemeral: testSigningAccounts.EVM, - substrateEphemeral: testSigningAccounts.Substrate, - stellarEphemeral: testSigningAccounts.Stellar - }, - pendulumNode.api, - moonbeamNode.api, - hydrationNode.api - ); - console.log("Presigned transactions:", presignedTxs); - } catch (error: unknown) { - console.error("Error during test execution:", error); - - fs.writeFileSync(filePath, JSON.stringify(rampState, null, 2)); - throw error; - } - }); -}); diff --git a/apps/api/src/api/services/phases/phase-processor.onramp.integration.test.ts b/apps/api/src/api/services/phases/phase-processor.onramp.integration.test.ts index fc956cbe3..ed24757d1 100644 --- a/apps/api/src/api/services/phases/phase-processor.onramp.integration.test.ts +++ b/apps/api/src/api/services/phases/phase-processor.onramp.integration.test.ts @@ -18,7 +18,6 @@ import { } from "@vortexfi/shared"; import {Keyring} from "@polkadot/api"; import {mnemonicGenerate} from "@polkadot/util-crypto"; -import {Keypair} from "stellar-sdk"; import QuoteTicket from "../../../models/quoteTicket.model"; import RampState from "../../../models/rampState.model"; import {QuoteService} from "../quote"; @@ -70,13 +69,6 @@ export async function createSubstrateEphemeral(): Promise { return { address: ephemeralAccountKeypair.address, secret: seedPhrase }; } -export function createStellarEphemeral(): EphemeralAccount { - const ephemeralKeys = Keypair.random(); - const address = ephemeralKeys.publicKey(); - - return { address, secret: ephemeralKeys.secret() }; -} - // only for onramp.... export async function createMoonbeamEphemeralSeed() { const seedPhrase = mnemonicGenerate(); @@ -90,8 +82,7 @@ export async function createMoonbeamEphemeralSeed() { const testSigningAccounts = { moonbeam: await createMoonbeamEphemeralSeed(), - pendulum: await createSubstrateEphemeral(), - stellar: createStellarEphemeral() + pendulum: await createSubstrateEphemeral() }; // convert into AccountMeta @@ -221,8 +212,7 @@ describe("Onramp PhaseProcessor Integration Test", () => { registeredRamp?.unsignedTxs || [], { evmEphemeral: testSigningAccounts.moonbeam, - substrateEphemeral: testSigningAccounts.pendulum, - stellarEphemeral: testSigningAccounts.stellar + substrateEphemeral: testSigningAccounts.pendulum }, pendulumNode.api, moonbeamNode.api, diff --git a/apps/api/src/api/services/phases/phase-processor.ts b/apps/api/src/api/services/phases/phase-processor.ts index fc765a2d1..fad4828e0 100644 --- a/apps/api/src/api/services/phases/phase-processor.ts +++ b/apps/api/src/api/services/phases/phase-processor.ts @@ -1,6 +1,7 @@ import httpStatus from "http-status"; import logger from "../../../config/logger"; import { runWithRampContext } from "../../../config/ramp-context"; +import { config } from "../../../config/vars"; import RampState from "../../../models/rampState.model"; import { APIError } from "../../errors/api-error"; import { PhaseError, RecoverablePhaseError } from "../../errors/phase-error"; @@ -40,6 +41,13 @@ export class PhaseProcessor { }); } + if (state.flowVariant !== config.flowVariant) { + logger.warn( + `Refusing to process ramp ${rampId}: belongs to flow ${state.flowVariant}, this backend is ${config.flowVariant}` + ); + return; + } + // Try to acquire the lock let lockAcquired = await this.acquireLock(state); if (!lockAcquired) { diff --git a/apps/api/src/api/services/phases/post-process/base-chain-post-process-handler.ts b/apps/api/src/api/services/phases/post-process/base-chain-post-process-handler.ts index ab1edc4b4..a7f1b2548 100644 --- a/apps/api/src/api/services/phases/post-process/base-chain-post-process-handler.ts +++ b/apps/api/src/api/services/phases/post-process/base-chain-post-process-handler.ts @@ -6,7 +6,7 @@ import RampState from "../../../../models/rampState.model"; import { getEvmFundingAccount } from "../evm-funding"; import { BasePostProcessHandler } from "./base-post-process-handler"; -const BASE_CLEANUP_PHASES: CleanupPhase[] = ["baseCleanupBrla", "baseCleanupUsdc", "baseCleanupAxlUsdc"]; +const BASE_CLEANUP_PHASES: CleanupPhase[] = ["baseCleanupBrla", "baseCleanupUsdc", "baseCleanupEurc", "baseCleanupAxlUsdc"]; export class BaseChainPostProcessHandler extends BasePostProcessHandler { public getCleanupName(): CleanupPhase { diff --git a/apps/api/src/api/services/phases/post-process/index.ts b/apps/api/src/api/services/phases/post-process/index.ts index 95ecbd07b..f1d8067c3 100644 --- a/apps/api/src/api/services/phases/post-process/index.ts +++ b/apps/api/src/api/services/phases/post-process/index.ts @@ -1,26 +1,21 @@ import assetHubPostProcessHandler from "./assethub-post-process-handler"; import baseChainPostProcessHandler from "./base-chain-post-process-handler"; import { BasePostProcessHandler } from "./base-post-process-handler"; -import hydrationPostProcessHandler from "./hydration-post-process-handler"; import moonbeamPostProcessHandler from "./moonbeam-post-process-handler"; import pendulumPostProcessHandler from "./pendulum-post-process-handler"; import polygonPostProcessHandler from "./polygon-post-process-handler"; -import stellarPostProcessHandler from "./stellar-post-process-handler"; /** * All available post-process handlers */ const postProcessHandlers: BasePostProcessHandler[] = [ - stellarPostProcessHandler, pendulumPostProcessHandler, moonbeamPostProcessHandler, polygonPostProcessHandler, baseChainPostProcessHandler, - hydrationPostProcessHandler, assetHubPostProcessHandler ]; -export { postProcessHandlers }; export { AssetHubPostProcessHandler } from "./assethub-post-process-handler"; export { BaseChainPostProcessHandler } from "./base-chain-post-process-handler"; export { BasePostProcessHandler } from "./base-post-process-handler"; @@ -28,4 +23,4 @@ export { HydrationPostProcessHandler } from "./hydration-post-process-handler"; export { MoonbeamPostProcessHandler } from "./moonbeam-post-process-handler"; export { PendulumPostProcessHandler } from "./pendulum-post-process-handler"; export { PolygonPostProcessHandler } from "./polygon-post-process-handler"; -export { StellarPostProcessHandler } from "./stellar-post-process-handler"; +export { postProcessHandlers }; diff --git a/apps/api/src/api/services/phases/post-process/stellar-post-process-handler.ts b/apps/api/src/api/services/phases/post-process/stellar-post-process-handler.ts deleted file mode 100644 index cb0701cf2..000000000 --- a/apps/api/src/api/services/phases/post-process/stellar-post-process-handler.ts +++ /dev/null @@ -1,95 +0,0 @@ -import { CleanupPhase, FiatToken, HORIZON_URL, RampDirection } from "@vortexfi/shared"; -import { Horizon, NetworkError, Networks as StellarNetworks, Transaction } from "stellar-sdk"; -import logger from "../../../../config/logger"; -import { config } from "../../../../config/vars"; -import { SEQUENCE_TIME_WINDOWS } from "../../../../constants/constants"; -import QuoteTicket from "../../../../models/quoteTicket.model"; -import RampState from "../../../../models/rampState.model"; -import { isStellarNetworkError } from "../handlers/fund-ephemeral-handler"; -import { BasePostProcessHandler } from "./base-post-process-handler"; - -const NETWORK_PASSPHRASE = config.sandboxEnabled ? StellarNetworks.TESTNET : StellarNetworks.PUBLIC; - -const horizonServer = new Horizon.Server(HORIZON_URL); - -/** - * Post process handler for Stellar cleanup operations - */ -export class StellarPostProcessHandler extends BasePostProcessHandler { - /** - * Check if this handler should process the given state - */ - public shouldProcess(state: RampState): boolean { - if (state.currentPhase !== "complete") { - return false; - } - - if (state.type !== RampDirection.SELL || this.getPresignedTransaction(state, "stellarCleanup") === undefined) { - return false; - } - - return true; - } - - /** - * Get the name of the cleanup handler - */ - public getCleanupName(): CleanupPhase { - return "stellarCleanup"; - } - - /** - * Process the Stellar cleanup for the given state - * @returns A tuple with [success, error] where success is true if the process completed successfully, - * and error is null if successful or an Error if it failed - */ - public async process(state: RampState): Promise<[boolean, Error | null]> { - const quote = await QuoteTicket.findByPk(state.quoteId); - if (!quote) { - return [false, this.createErrorObject("Quote not found for the given state")]; - } - - if (quote.outputCurrency === FiatToken.BRL) { - return [false, this.createErrorObject("Stellar cleanup not needed for BRL offramps")]; - } - - try { - const expectedLedgerTimeMs = state.createdAt.getTime() + SEQUENCE_TIME_WINDOWS.FIRST_TX * 1.1 * 1000; // Add some safety margin in case ledger production was slower. - if (expectedLedgerTimeMs > Date.now()) { - return [false, this.createErrorObject(`Stellar cleanup for ramp state ${state.id} cannot be processed yet.`)]; - } - const { txData: stellarCleanupTransactionXDR } = this.getPresignedTransaction(state, "stellarCleanup"); - - const stellarCleanupTransactionTransaction = new Transaction(stellarCleanupTransactionXDR as string, NETWORK_PASSPHRASE); - await horizonServer.submitTransaction(stellarCleanupTransactionTransaction); - - logger.info(`Successfully processed Stellar cleanup for ramp state ${state.id}`); - return [true, null]; - } catch (e) { - try { - const horizonError = e as NetworkError; - if (isStellarNetworkError(horizonError) && horizonError.response.data?.status === 400) { - logger.info( - `Could not submit the cleanup transaction ${JSON.stringify(horizonError.response?.data?.extras.result_codes)}` - ); - - if (horizonError.response.data.extras.result_codes.transaction === "tx_bad_seq") { - logger.info("Recovery mode: Cleanup already performed."); - return [true, null]; - } - - logger.error(horizonError.response.data.extras); - return [false, this.createErrorObject("Could not submit the cleanup transaction")]; - } - - logger.error("Error while submitting the cleanup transaction", e); - return [false, this.createErrorObject("Could not submit the cleanup transaction")]; - } catch (_parseError) { - // If we can't parse the error as a Horizon error, it's a different type of error - return [false, this.createErrorObject(e instanceof Error ? e : String(e))]; - } - } - } -} - -export default new StellarPostProcessHandler(); diff --git a/apps/api/src/api/services/phases/register-handlers.ts b/apps/api/src/api/services/phases/register-handlers.ts index 50ff490bf..eb48061c1 100644 --- a/apps/api/src/api/services/phases/register-handlers.ts +++ b/apps/api/src/api/services/phases/register-handlers.ts @@ -10,20 +10,18 @@ import fundEphemeralHandler from "./handlers/fund-ephemeral-handler"; import hydrationSwapHandler from "./handlers/hydration-swap-handler"; import hydrationToAssethubXcmPhaseHandler from "./handlers/hydration-to-assethub-xcm-phase-handler"; import initialPhaseHandler from "./handlers/initial-phase-handler"; -import moneriumOnrampMintPhaseHandler from "./handlers/monerium-onramp-mint-handler"; -import moneriumOnrampSelfTransferHandler from "./handlers/monerium-onramp-self-transfer-handler"; import moonbeamToPendulumPhaseHandler from "./handlers/moonbeam-to-pendulum-handler"; import moonbeamToPendulumXcmHandler from "./handlers/moonbeam-to-pendulum-xcm-handler"; +import mykoboOnrampDepositHandler from "./handlers/mykobo-onramp-deposit-handler"; +import mykoboPayoutHandler from "./handlers/mykobo-payout-handler"; import nablaApproveHandler from "./handlers/nabla-approve-handler"; import nablaSwapHandler from "./handlers/nabla-swap-handler"; import pendulumToAssethubPhaseHandler from "./handlers/pendulum-to-assethub-phase-handler"; import pendulumToHydrationXcmPhaseHandler from "./handlers/pendulum-to-hydration-xcm-phase-handler"; import pendulumToMoonbeamXcmHandler from "./handlers/pendulum-to-moonbeam-xcm-handler"; -import spacewalkRedeemHandler from "./handlers/spacewalk-redeem-handler"; import squidRouterPayPhaseHandler from "./handlers/squid-router-pay-phase-handler"; import squidRouterPhaseHandler from "./handlers/squid-router-phase-handler"; import squidRouterPermitExecutionHandler from "./handlers/squidrouter-permit-execution-handler"; -import stellarPaymentHandler from "./handlers/stellar-payment-handler"; import subsidizePostSwapPhaseHandler from "./handlers/subsidize-post-swap-handler"; import subsidizePreSwapPhaseHandler from "./handlers/subsidize-pre-swap-handler"; import phaseRegistry from "./phase-registry"; @@ -39,12 +37,12 @@ export function registerPhaseHandlers(): void { phaseRegistry.registerHandler(squidRouterPhaseHandler); phaseRegistry.registerHandler(nablaApproveHandler); phaseRegistry.registerHandler(nablaSwapHandler); - phaseRegistry.registerHandler(stellarPaymentHandler); - phaseRegistry.registerHandler(spacewalkRedeemHandler); phaseRegistry.registerHandler(subsidizePostSwapPhaseHandler); phaseRegistry.registerHandler(subsidizePreSwapPhaseHandler); phaseRegistry.registerHandler(moonbeamToPendulumPhaseHandler); phaseRegistry.registerHandler(brlaPayoutBaseHandler); + phaseRegistry.registerHandler(mykoboPayoutHandler); + phaseRegistry.registerHandler(mykoboOnrampDepositHandler); phaseRegistry.registerHandler(fundEphemeralHandler); phaseRegistry.registerHandler(alfredpayOnrampMintHandler); phaseRegistry.registerHandler(alfredpayOfframpTransferHandler); @@ -52,8 +50,6 @@ export function registerPhaseHandlers(): void { phaseRegistry.registerHandler(pendulumToAssethubPhaseHandler); phaseRegistry.registerHandler(squidRouterPayPhaseHandler); phaseRegistry.registerHandler(distributeFeesHandler); - phaseRegistry.registerHandler(moneriumOnrampSelfTransferHandler); - phaseRegistry.registerHandler(moneriumOnrampMintPhaseHandler); phaseRegistry.registerHandler(moonbeamToPendulumXcmHandler); phaseRegistry.registerHandler(pendulumToMoonbeamXcmHandler); phaseRegistry.registerHandler(pendulumToHydrationXcmPhaseHandler); diff --git a/apps/api/src/api/services/priceFeed.service.ts b/apps/api/src/api/services/priceFeed.service.ts index d3fdcabf1..fcbec5388 100644 --- a/apps/api/src/api/services/priceFeed.service.ts +++ b/apps/api/src/api/services/priceFeed.service.ts @@ -63,19 +63,6 @@ export class PriceFeedService { logger.info(`PriceFeedService initialized with CoinGecko API URL: ${this.coingeckoApiBaseUrl}`); logger.info(`Cache TTLs configured - Crypto: ${this.cryptoCacheTtlMs}ms, Fiat: ${this.fiatCacheTtlMs}ms`); - - // Start cron job to check onchain oracle prices - this.checkOnchainOraclePricesUpToDate().catch(error => { - logger.error(`Error checking onchain oracle prices: ${error.message}`); - }); - setInterval( - () => { - this.checkOnchainOraclePricesUpToDate().catch(error => { - logger.error(`Error checking onchain oracle prices: ${error.message}`); - }); - }, - 24 * 60 * 60 * 1000 - ); // Check every 24 hours } /** @@ -200,7 +187,7 @@ export class PriceFeedService { } // Check if the currency has a Pendulum representative (Nabla pool). - // Currencies like MXN and COP are TokenType.Fiat with no Pendulum pool — use CoinGecko for those. + // Currencies like MXN, COP, and ARS are TokenType.Fiat with no Pendulum pool — use CoinGecko for those. let outputTokenPendulumDetails; try { outputTokenPendulumDetails = getPendulumDetails(toCurrency); diff --git a/apps/api/src/api/services/quote/core/errors.test.ts b/apps/api/src/api/services/quote/core/errors.test.ts new file mode 100644 index 000000000..f3656f0a9 --- /dev/null +++ b/apps/api/src/api/services/quote/core/errors.test.ts @@ -0,0 +1,26 @@ +import {QuoteError} from "@vortexfi/shared"; +import {describe, expect, it} from "bun:test"; +import httpStatus from "http-status"; +import {createLowLiquidityQuoteError, isLowLiquidityQuoteError} from "./errors"; + +describe("quote error helpers", () => { + it("recognizes low-liquidity provider failures", () => { + expect(isLowLiquidityQuoteError(new Error("Low liquidity for selected route"))).toBe(true); + expect(isLowLiquidityQuoteError(new Error("Please reduce swap amount and try again"))).toBe(true); + expect(isLowLiquidityQuoteError(new Error("insufficientLiquidity"))).toBe(true); + expect(isLowLiquidityQuoteError(new Error("SwapPool: EXCEEDS_MAX_COVERAGE_RATIO"))).toBe(true); + }); + + it("does not classify unrelated provider failures as low liquidity", () => { + expect(isLowLiquidityQuoteError(new Error("Invalid Squidrouter response"))).toBe(false); + }); + + it("creates a user-facing 500 quote error", () => { + const error = createLowLiquidityQuoteError(); + + expect(error.isPublic).toBe(true); + expect(error.message).toBe(QuoteError.LowLiquidity); + expect(error.status).toBe(httpStatus.INTERNAL_SERVER_ERROR); + expect(error.type).toBeUndefined(); + }); +}); diff --git a/apps/api/src/api/services/quote/core/errors.ts b/apps/api/src/api/services/quote/core/errors.ts new file mode 100644 index 000000000..617c4d044 --- /dev/null +++ b/apps/api/src/api/services/quote/core/errors.ts @@ -0,0 +1,25 @@ +import { QuoteError } from "@vortexfi/shared"; +import httpStatus from "http-status"; +import { APIError } from "../../../errors/api-error"; + +const LOW_LIQUIDITY_ERROR_PATTERNS = [ + "low liquidity", + "reduce swap amount", + "insufficientliquidity", + "exceeds_max_coverage_ratio" +]; + +export function isLowLiquidityQuoteError(error: unknown): boolean { + const errorMessage = error instanceof Error ? error.message : String(error); + const normalizedMessage = errorMessage.toLowerCase().replace(/\s+/g, ""); + + return LOW_LIQUIDITY_ERROR_PATTERNS.some(pattern => normalizedMessage.includes(pattern.replace(/\s+/g, ""))); +} + +export function createLowLiquidityQuoteError(): APIError { + return new APIError({ + isPublic: true, + message: QuoteError.LowLiquidity, + status: httpStatus.INTERNAL_SERVER_ERROR + }); +} diff --git a/apps/api/src/api/services/quote/core/helpers.ts b/apps/api/src/api/services/quote/core/helpers.ts index abb6b96ca..01a3dd1c5 100644 --- a/apps/api/src/api/services/quote/core/helpers.ts +++ b/apps/api/src/api/services/quote/core/helpers.ts @@ -31,6 +31,7 @@ export const SUPPORTED_CHAINS: { from: [ EPaymentMethod.PIX as DestinationType, EPaymentMethod.SEPA as DestinationType, + EPaymentMethod.CBU as DestinationType, EPaymentMethod.ACH as DestinationType, EPaymentMethod.SPEI as DestinationType ], diff --git a/apps/api/src/api/services/quote/core/nabla.ts b/apps/api/src/api/services/quote/core/nabla.ts index bc7c3edec..d426a4949 100644 --- a/apps/api/src/api/services/quote/core/nabla.ts +++ b/apps/api/src/api/services/quote/core/nabla.ts @@ -2,10 +2,9 @@ import { ApiManager, EvmClientManager, EvmTokenDetails, + getNablaBasePool, getTokenOutAmount, multiplyByPowerOfTen, - NABLA_QUOTER_BASE, - NABLA_ROUTER_BASE, Networks, PendulumTokenDetails, parseContractBalanceResponse, @@ -17,6 +16,7 @@ import { Big } from "big.js"; import httpStatus from "http-status"; import logger from "../../../../config/logger"; import { APIError } from "../../../errors/api-error"; +import { createLowLiquidityQuoteError, isLowLiquidityQuoteError } from "./errors"; export interface NablaSwapRequest { inputAmountForSwap: string; @@ -78,16 +78,14 @@ export async function calculateNablaSwapOutput(request: NablaSwapRequest): Promi } ]; + const inputAddr = inputTokenPendulumDetails.erc20WrapperAddress as `0x${string}`; + const outputAddr = outputTokenPendulumDetails.erc20WrapperAddress as `0x${string}`; + const { router } = getNablaBasePool(inputAddr, outputAddr); + const result = await evmClientManager.readContractWithRetry<[bigint, bigint]>(Networks.Base, { abi: swapAbi, - address: NABLA_ROUTER_BASE, - args: [ - BigInt(amountIn), - [ - inputTokenPendulumDetails.erc20WrapperAddress as `0x${string}`, - outputTokenPendulumDetails.erc20WrapperAddress as `0x${string}` - ] - ], + address: router, + args: [BigInt(amountIn), [inputAddr, outputAddr]], functionName: "getAmountOut" }); @@ -125,6 +123,10 @@ export async function calculateNablaSwapOutput(request: NablaSwapRequest): Promi } } catch (error) { logger.error("Error calculating Nabla swap output:", error); + if (isLowLiquidityQuoteError(error)) { + throw createLowLiquidityQuoteError(); + } + throw new APIError({ message: QuoteError.FailedToCalculateQuote, status: httpStatus.INTERNAL_SERVER_ERROR @@ -167,17 +169,14 @@ export async function calculateNablaSwapOutputEvm(request: NablaSwapEvmRequest): } ]; + const inputAddr = inputTokenDetails.erc20AddressSourceChain as `0x${string}`; + const outputAddr = outputTokenDetails.erc20AddressSourceChain as `0x${string}`; + const { router, quoter } = getNablaBasePool(inputAddr, outputAddr); + const result = await evmClientManager.readContractWithRetry(Networks.Base, { abi: swapAbi, - address: NABLA_QUOTER_BASE, - args: [ - BigInt(amountIn), - [ - inputTokenDetails.erc20AddressSourceChain as `0x${string}`, - outputTokenDetails.erc20AddressSourceChain as `0x${string}` - ], - [NABLA_ROUTER_BASE] - ], + address: quoter, + args: [BigInt(amountIn), [inputAddr, outputAddr], [router]], functionName: "quoteSwapExactTokensForTokens" }); @@ -196,6 +195,10 @@ export async function calculateNablaSwapOutputEvm(request: NablaSwapEvmRequest): }; } catch (error) { logger.error("Error calculating EVM Nabla swap output:", error); + if (isLowLiquidityQuoteError(error)) { + throw createLowLiquidityQuoteError(); + } + throw new APIError({ message: QuoteError.FailedToCalculateQuote, status: httpStatus.INTERNAL_SERVER_ERROR diff --git a/apps/api/src/api/services/quote/core/partner-resolution.test.ts b/apps/api/src/api/services/quote/core/partner-resolution.test.ts new file mode 100644 index 000000000..04d880341 --- /dev/null +++ b/apps/api/src/api/services/quote/core/partner-resolution.test.ts @@ -0,0 +1,152 @@ +import {afterEach, describe, expect, it, mock} from "bun:test"; +import {EPaymentMethod, EvmToken, FiatToken, Networks, RampDirection} from "@vortexfi/shared"; +import Partner from "../../../../models/partner.model"; +import ProfilePartnerAssignment from "../../../../models/profilePartnerAssignment.model"; +import {resolveQuotePartner} from "./partner-resolution"; + +const baseRequest = { + from: EPaymentMethod.PIX, + inputAmount: "100", + inputCurrency: FiatToken.BRL, + network: Networks.Base, + outputCurrency: EvmToken.USDC, + rampType: RampDirection.BUY, + to: Networks.Base +}; + +describe("resolveQuotePartner", () => { + const originalPartnerFindOne = Partner.findOne; + const originalAssignmentFindOne = ProfilePartnerAssignment.findOne; + + afterEach(() => { + Partner.findOne = originalPartnerFindOne; + ProfilePartnerAssignment.findOne = originalAssignmentFindOne; + }); + + it("uses explicit partnerId before public keys or profile assignments", async () => { + let assignmentLookupCount = 0; + Partner.findOne = mock(async ({ where }: { where: { name?: string } }) => { + if (where.name === "ExplicitPartner") { + return { id: "explicit-buy-id", name: "ExplicitPartner" }; + } + return null; + }) as typeof Partner.findOne; + ProfilePartnerAssignment.findOne = mock(async () => { + assignmentLookupCount++; + return { buyPartnerId: "assigned-buy-id", sellPartnerId: "assigned-sell-id" }; + }) as typeof ProfilePartnerAssignment.findOne; + + const result = await resolveQuotePartner({ + ...baseRequest, + partnerId: "ExplicitPartner", + partnerName: "PublicKeyPartner", + userId: "user-1" + }); + + expect(result.source).toBe("request"); + expect(result.pricingPartnerId).toBe("explicit-buy-id"); + expect(result.ownerPartnerId).toBe("explicit-buy-id"); + expect(assignmentLookupCount).toBe(0); + }); + + it("keeps public-key partner quotes partner-owned for compatibility", async () => { + Partner.findOne = mock(async ({ where }: { where: { name?: string } }) => { + if (where.name === "PublicKeyPartner") { + return { id: "public-key-buy-id", name: "PublicKeyPartner" }; + } + return null; + }) as typeof Partner.findOne; + ProfilePartnerAssignment.findOne = mock(async () => ({ + buyPartnerId: "assigned-buy-id", + sellPartnerId: "assigned-sell-id" + })) as typeof ProfilePartnerAssignment.findOne; + + const result = await resolveQuotePartner({ + ...baseRequest, + partnerName: "PublicKeyPartner", + userId: "user-1" + }); + + expect(result.source).toBe("publicKey"); + expect(result.pricingPartnerId).toBe("public-key-buy-id"); + expect(result.ownerPartnerId).toBe("public-key-buy-id"); + }); + + it("applies the buy profile assignment as pricing-only for authenticated buy users", async () => { + ProfilePartnerAssignment.findOne = mock(async () => ({ + buyPartnerId: "assigned-buy-id", + sellPartnerId: "assigned-sell-id" + })) as typeof ProfilePartnerAssignment.findOne; + Partner.findOne = mock(async ({ where }: { where: { id?: string; rampType?: RampDirection } }) => { + if (where.id === "assigned-buy-id" && where.rampType === RampDirection.BUY) { + return { id: "assigned-buy-id", name: "AssignedPartner" }; + } + return null; + }) as typeof Partner.findOne; + + const result = await resolveQuotePartner({ + ...baseRequest, + userId: "user-1" + }); + + expect(result.source).toBe("profileAssignment"); + expect(result.pricingPartnerId).toBe("assigned-buy-id"); + expect(result.ownerPartnerId).toBeNull(); + }); + + it("applies the sell profile assignment as pricing-only for authenticated sell users", async () => { + ProfilePartnerAssignment.findOne = mock(async () => ({ + buyPartnerId: "assigned-buy-id", + sellPartnerId: "assigned-sell-id" + })) as typeof ProfilePartnerAssignment.findOne; + Partner.findOne = mock(async ({ where }: { where: { id?: string; rampType?: RampDirection } }) => { + if (where.id === "assigned-sell-id" && where.rampType === RampDirection.SELL) { + return { id: "assigned-sell-id", name: "AssignedPartner" }; + } + return null; + }) as typeof Partner.findOne; + + const result = await resolveQuotePartner({ + ...baseRequest, + rampType: RampDirection.SELL, + userId: "user-1" + }); + + expect(result.source).toBe("profileAssignment"); + expect(result.pricingPartnerId).toBe("assigned-sell-id"); + expect(result.ownerPartnerId).toBeNull(); + }); + + it("falls back to default pricing when no partner id is assigned for the ramp type", async () => { + ProfilePartnerAssignment.findOne = mock(async () => ({ + buyPartnerId: null, + sellPartnerId: "assigned-sell-id" + })) as typeof ProfilePartnerAssignment.findOne; + Partner.findOne = mock(async () => ({ id: "unexpected" })) as typeof Partner.findOne; + + const result = await resolveQuotePartner({ + ...baseRequest, + userId: "user-1" + }); + + expect(result.source).toBe("none"); + expect(result.pricingPartnerId).toBeNull(); + expect(result.ownerPartnerId).toBeNull(); + }); + + it("does not apply profile assignments to anonymous requests", async () => { + let assignmentLookupCount = 0; + ProfilePartnerAssignment.findOne = mock(async () => { + assignmentLookupCount++; + return { buyPartnerId: "assigned-buy-id", sellPartnerId: "assigned-sell-id" }; + }) as typeof ProfilePartnerAssignment.findOne; + Partner.findOne = mock(async () => null) as typeof Partner.findOne; + + const result = await resolveQuotePartner(baseRequest); + + expect(result.source).toBe("none"); + expect(result.pricingPartnerId).toBeNull(); + expect(result.ownerPartnerId).toBeNull(); + expect(assignmentLookupCount).toBe(0); + }); +}); diff --git a/apps/api/src/api/services/quote/core/partner-resolution.ts b/apps/api/src/api/services/quote/core/partner-resolution.ts new file mode 100644 index 000000000..89b36c971 --- /dev/null +++ b/apps/api/src/api/services/quote/core/partner-resolution.ts @@ -0,0 +1,123 @@ +import { CreateQuoteRequest, RampDirection } from "@vortexfi/shared"; +import { Op } from "sequelize"; +import logger from "../../../../config/logger"; +import Partner from "../../../../models/partner.model"; +import ProfilePartnerAssignment from "../../../../models/profilePartnerAssignment.model"; +import type { PartnerPricingSource } from "./types"; + +type QuotePartnerResolutionRequest = CreateQuoteRequest & { + partnerName?: string | null; + userId?: string; +}; + +export interface ResolvedQuotePartner { + ownerPartnerId: string | null; + partner: Partner | null; + pricingPartnerId: string | null; + source: PartnerPricingSource; +} + +const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i; + +async function findPartnerForRamp( + partnerRef: string, + rampType: RampDirection, + source: PartnerPricingSource +): Promise { + const isUuid = source === "request" && UUID_PATTERN.test(partnerRef); + const partner = await Partner.findOne({ + where: { + ...(isUuid ? { id: partnerRef } : { name: partnerRef }), + isActive: true, + rampType + } + }); + + if (!partner) { + logger.warn( + `Partner '${partnerRef}' from ${source} not found or not active for rampType=${rampType}. Proceeding with default fees.` + ); + } + + return partner; +} + +async function findPartnerByIdForRamp(partnerId: string, rampType: RampDirection): Promise { + const partner = await Partner.findOne({ + where: { + id: partnerId, + isActive: true, + rampType + } + }); + + if (!partner) { + logger.warn( + `Assigned partner '${partnerId}' not found or not active for rampType=${rampType}. Proceeding with default fees.` + ); + } + + return partner; +} + +async function findAssignedPartnerId(userId: string, rampType: RampDirection, now: Date): Promise { + const assignment = await ProfilePartnerAssignment.findOne({ + order: [["createdAt", "DESC"]], + where: { + [Op.or]: [{ expiresAt: null }, { expiresAt: { [Op.gt]: now } }], + isActive: true, + userId + } + }); + + if (!assignment) { + return null; + } + + return rampType === RampDirection.BUY ? assignment.buyPartnerId : assignment.sellPartnerId; +} + +export async function resolveQuotePartner( + request: QuotePartnerResolutionRequest, + now = new Date() +): Promise { + if (request.partnerId) { + const partner = await findPartnerForRamp(request.partnerId, request.rampType, "request"); + return { + ownerPartnerId: partner?.id ?? null, + partner, + pricingPartnerId: partner?.id ?? null, + source: "request" + }; + } + + if (request.partnerName) { + const partner = await findPartnerForRamp(request.partnerName, request.rampType, "publicKey"); + return { + ownerPartnerId: partner?.id ?? null, + partner, + pricingPartnerId: partner?.id ?? null, + source: "publicKey" + }; + } + + if (request.userId) { + const assignedPartnerId = await findAssignedPartnerId(request.userId, request.rampType, now); + if (assignedPartnerId) { + const partner = await findPartnerByIdForRamp(assignedPartnerId, request.rampType); + return { + ownerPartnerId: null, + partner, + pricingPartnerId: partner?.id ?? null, + source: "profileAssignment" + }; + } + } + + return { + ownerPartnerId: null, + partner: null, + pricingPartnerId: null, + source: "none" + }; +} diff --git a/apps/api/src/api/services/quote/core/quote-context.ts b/apps/api/src/api/services/quote/core/quote-context.ts index 05d7820d3..3e7097a4b 100644 --- a/apps/api/src/api/services/quote/core/quote-context.ts +++ b/apps/api/src/api/services/quote/core/quote-context.ts @@ -8,12 +8,15 @@ */ import { CreateQuoteRequest, RampCurrency, RampDirection } from "@vortexfi/shared"; -import type { QuoteContext as IQuoteContext, PartnerInfo } from "./types"; +import type { QuoteContext as IQuoteContext, PartnerInfo, PartnerPricingSource } from "./types"; export function createQuoteContext(args: { - request: CreateQuoteRequest; + request: CreateQuoteRequest & { partnerName?: string | null; userId?: string }; targetFeeFiatCurrency: RampCurrency; partner: PartnerInfo | null; + partnerOwnerId?: string | null; + partnerPricingSource?: PartnerPricingSource; + pricingPartnerId?: string | null; now?: Date; }): IQuoteContext { let notes: string[] | undefined; @@ -41,6 +44,9 @@ export function createQuoteContext(args: { }, now: args.now ?? new Date(), partner: args.partner, + partnerOwnerId: args.partnerOwnerId ?? null, + partnerPricingSource: args.partnerPricingSource ?? "none", + pricingPartnerId: args.pricingPartnerId ?? null, // Provide a default object to keep stage logic simple; optional by interface. request: args.request, diff --git a/apps/api/src/api/services/quote/core/quote-fees.ts b/apps/api/src/api/services/quote/core/quote-fees.ts index b68be0486..473caf5be 100644 --- a/apps/api/src/api/services/quote/core/quote-fees.ts +++ b/apps/api/src/api/services/quote/core/quote-fees.ts @@ -221,10 +221,6 @@ async function calculateAnchorFee( anchorIdentifier = "moonbeam_brla"; } else if (rampType === RampDirection.SELL && to === "pix") { anchorIdentifier = "moonbeam_brla"; - } else if (rampType === RampDirection.SELL && to === "sepa") { - anchorIdentifier = "stellar_eurc"; - } else if (rampType === RampDirection.SELL && to === "cbu") { - anchorIdentifier = "stellar_ars"; } const anchorFeeConfigs = await Anchor.findAll({ diff --git a/apps/api/src/api/services/quote/core/squidrouter.ts b/apps/api/src/api/services/quote/core/squidrouter.ts index 7089d3146..8cd6fae41 100644 --- a/apps/api/src/api/services/quote/core/squidrouter.ts +++ b/apps/api/src/api/services/quote/core/squidrouter.ts @@ -14,7 +14,9 @@ import { RampDirection, RouteParams, SquidrouterCachedRoute, + SquidrouterCachedRouteResult, SquidrouterRoute, + SquidrouterRouteResult, stringifyBigWithSignificantDecimals } from "@vortexfi/shared"; import { Big } from "big.js"; @@ -24,6 +26,7 @@ import logger from "../../../../config/logger"; import { APIError } from "../../../errors/api-error"; import { multiplyByPowerOfTen } from "../../pendulum/helpers"; import { priceFeedService } from "../../priceFeed.service"; +import { createLowLiquidityQuoteError, isLowLiquidityQuoteError } from "./errors"; export interface EvmBridgeRequest { amountRaw: string; // Raw amount to bridge/swap via Squidrouter @@ -46,6 +49,7 @@ export interface EvmBridgeQuoteRequest { export interface EvmBridgeResult { finalGrossOutputAmountDecimal: Big; // Final amount after Squidrouter + finalGrossOutputAmountRaw: string; // Final amount in destination token raw units networkFeeUSD: string; // Squidrouter specific fee finalEffectiveExchangeRate?: string; outputTokenDecimals: number; @@ -114,26 +118,51 @@ function prepareSquidrouterRouteParams(params: { }); } -/** - * Helper to calculate Squidrouter network fee including GLMR price fetching and fallback. - * Works with both full routes and cached routes (which include the value field needed for calculation). - */ -async function calculateSquidrouterNetworkFee(route: SquidrouterRoute | SquidrouterCachedRoute): Promise { +// Squid swap gas is paid in the source chain's native token. The CoinGecko ID +// depends on the source network — using GLMR for everything would severely +// under-report the fee for non-Moonbeam routes (e.g. ETH on Base is ~30,000x +// more expensive than GLMR). +function getNativeTokenCoingeckoId(network: Networks): string { + switch (network) { + case Networks.Base: + case Networks.Arbitrum: + case Networks.Ethereum: + case Networks.BaseSepolia: + return "ethereum"; + case Networks.Polygon: + case Networks.PolygonAmoy: + return "polygon-ecosystem-token"; + case Networks.Avalanche: + return "avalanche-2"; + case Networks.BSC: + return "binancecoin"; + case Networks.Moonbeam: + return "moonbeam"; + default: + return "moonbeam"; + } +} + +async function calculateSquidrouterNetworkFee( + route: SquidrouterRoute | SquidrouterCachedRoute, + fromNetwork: Networks +): Promise { const squidRouterSwapValue = multiplyByPowerOfTen(Big(route.transactionRequest.value), -18); + const nativeTokenId = getNativeTokenCoingeckoId(fromNetwork); try { - // Get current GLMR price in USD from price feed service - const glmrPriceUSD = await priceFeedService.getCryptoPrice("moonbeam", "usd"); - const squidFeeUSD = squidRouterSwapValue.mul(glmrPriceUSD).toFixed(6); - logger.debug(`Network fee calculated using GLMR price: $${glmrPriceUSD}, fee: $${squidFeeUSD}`); + const nativePriceUSD = await priceFeedService.getCryptoPrice(nativeTokenId, "usd"); + const squidFeeUSD = squidRouterSwapValue.mul(nativePriceUSD).toFixed(6); + logger.debug(`Network fee calculated using ${nativeTokenId} price: $${nativePriceUSD}, fee: $${squidFeeUSD}`); return squidFeeUSD; } catch (error) { - // If price feed fails, log the error and use a fallback price - logger.error(`Failed to get GLMR price, using fallback: ${error instanceof Error ? error.message : "Unknown error"}`); - // Fallback to previous hardcoded value as safety measure - const fallbackGlmrPrice = 0.08; - const squidFeeUSD = squidRouterSwapValue.mul(fallbackGlmrPrice).toFixed(6); - logger.warn(`Using fallback GLMR price: $${fallbackGlmrPrice}, fee: $${squidFeeUSD}`); + logger.error( + `Failed to get ${nativeTokenId} price, using fallback: ${error instanceof Error ? error.message : "Unknown error"}` + ); + // Conservative per-chain fallback so we never silently report ~$0 for ETH-priced chains. + const fallbackPriceUSD = nativeTokenId === "ethereum" ? 2500 : nativeTokenId === "polygon-ecosystem-token" ? 0.5 : 0.08; + const squidFeeUSD = squidRouterSwapValue.mul(fallbackPriceUSD).toFixed(6); + logger.warn(`Using fallback ${nativeTokenId} price: $${fallbackPriceUSD}, fee: $${squidFeeUSD}`); return squidFeeUSD; } } @@ -170,8 +199,17 @@ function buildRouteRequest(request: EvmBridgeQuoteRequest) { }); } -async function getSquidrouterRouteData(routeParams: RouteParams) { - const routeResult = await getRoute(routeParams, { useCache: true }); +async function getSquidrouterRouteData(routeParams: RouteParams, fromNetwork: Networks) { + let routeResult: SquidrouterRouteResult | SquidrouterCachedRouteResult; + try { + routeResult = await getRoute(routeParams, { useCache: true }); + } catch (error) { + if (isLowLiquidityQuoteError(error)) { + throw createLowLiquidityQuoteError(); + } + + throw error; + } if (!routeResult?.data?.route?.estimate) { throw new APIError({ @@ -184,7 +222,7 @@ async function getSquidrouterRouteData(routeParams: RouteParams) { const outputTokenDecimals = routeData.route.estimate.toToken.decimals; const outputAmountRaw = routeData.route.estimate.toAmount; const outputAmountDecimal = parseContractBalanceResponse(outputTokenDecimals, BigInt(outputAmountRaw)).preciseBigDecimal; - const networkFeeUSD = await calculateSquidrouterNetworkFee(routeData.route); + const networkFeeUSD = await calculateSquidrouterNetworkFee(routeData.route, fromNetwork); return { fromToken: routeParams.fromToken, @@ -216,7 +254,7 @@ export async function calculateEvmBridgeAndNetworkFee(request: EvmBridgeRequest) }); // Execute Squidrouter route and validate response - const { networkFeeUSD, routeData, outputTokenDecimals } = await getSquidrouterRouteData(routeParams); + const { networkFeeUSD, routeData, outputTokenDecimals } = await getSquidrouterRouteData(routeParams, fromNetwork); // Calculate network fee (Squidrouter fee) // Parse final gross output amount @@ -236,6 +274,7 @@ export async function calculateEvmBridgeAndNetworkFee(request: EvmBridgeRequest) return { finalEffectiveExchangeRate, finalGrossOutputAmountDecimal, + finalGrossOutputAmountRaw: finalGrossOutputAmount, networkFeeUSD, outputTokenDecimals }; @@ -244,11 +283,8 @@ export async function calculateEvmBridgeAndNetworkFee(request: EvmBridgeRequest) logger.error(`Error calculating EVM bridge and network fee: ${errorMessage}`); // Check for specific SquidRouter error types - if (errorMessage.toLowerCase().includes("low liquidity") || errorMessage.toLowerCase().includes("reduce swap amount")) { - throw new APIError({ - message: QuoteError.LowLiquidity, - status: httpStatus.BAD_REQUEST - }); + if (isLowLiquidityQuoteError(error)) { + throw createLowLiquidityQuoteError(); } // Default to generic error for other cases @@ -261,5 +297,5 @@ export async function calculateEvmBridgeAndNetworkFee(request: EvmBridgeRequest) export async function getEvmBridgeQuote(request: EvmBridgeQuoteRequest) { const routeParams = buildRouteRequest(request); - return getSquidrouterRouteData(routeParams); + return getSquidrouterRouteData(routeParams, request.fromNetwork); } diff --git a/apps/api/src/api/services/quote/core/types.ts b/apps/api/src/api/services/quote/core/types.ts index a0b98a0e4..f4138e233 100644 --- a/apps/api/src/api/services/quote/core/types.ts +++ b/apps/api/src/api/services/quote/core/types.ts @@ -63,15 +63,6 @@ export interface XcmMeta { xcmFees: XcmFees; } -export interface StellarMeta { - inputAmountDecimal: Big; - inputAmountRaw: string; - outputAmountDecimal: Big; - outputAmountRaw: string; - fee: Big; - currency: RampCurrency; -} - // Partner info shared type export interface PartnerInfo { id: string | null; @@ -82,6 +73,8 @@ export interface PartnerInfo { minDynamicDifference?: number; } +export type PartnerPricingSource = "request" | "publicKey" | "profileAssignment" | "none"; + // Strategy for a specific route/path export interface IRouteStrategy { // Optional: human-friendly name for logging @@ -97,12 +90,18 @@ export interface IRouteStrategy { // Re-export here for convenience to avoid deep imports. export interface QuoteContext { // immutable request details - readonly request: CreateQuoteRequest & { userId?: string }; + readonly request: CreateQuoteRequest & { partnerName?: string | null; userId?: string }; readonly now: Date; // Partner info (if any) partner: PartnerInfo | null; + // Quote ownership and pricing provenance. `partnerOwnerId` is used for + // partner-principal ownership; `pricingPartnerId` is used for custom rates. + partnerOwnerId?: string | null; + pricingPartnerId?: string | null; + partnerPricingSource?: PartnerPricingSource; + // The fiat currency used for displaying fee breakdown (per helpers.getTargetFiatCurrency) targetFeeFiatCurrency: RampCurrency; @@ -140,6 +139,8 @@ export interface QuoteContext { inputDecimals: number; outputAmountRaw: string; outputAmountDecimal: Big; + ammOutputAmountRaw?: string; + ammOutputAmountDecimal?: Big; outputCurrency: EvmToken; outputDecimals: number; outputToken: string; // ERC20 address @@ -159,16 +160,18 @@ export interface QuoteContext { slippagePercent: number; }; - moneriumMint?: { + alfredpayMint?: { inputAmountDecimal: Big; inputAmountRaw: string; outputAmountDecimal: Big; outputAmountRaw: string; fee: Big; currency: RampCurrency; + quoteId: string; + expirationDate: Date; }; - alfredpayMint?: { + alfredpayOfframp?: { inputAmountDecimal: Big; inputAmountRaw: string; outputAmountDecimal: Big; @@ -179,18 +182,16 @@ export interface QuoteContext { expirationDate: Date; }; - alfredpayOfframp?: { + aveniaMint?: { inputAmountDecimal: Big; inputAmountRaw: string; outputAmountDecimal: Big; outputAmountRaw: string; fee: Big; currency: RampCurrency; - quoteId: string; - expirationDate: Date; }; - aveniaMint?: { + aveniaTransfer?: { inputAmountDecimal: Big; inputAmountRaw: string; outputAmountDecimal: Big; @@ -199,7 +200,7 @@ export interface QuoteContext { currency: RampCurrency; }; - aveniaTransfer?: { + mykoboMint?: { inputAmountDecimal: Big; inputAmountRaw: string; outputAmountDecimal: Big; @@ -228,8 +229,6 @@ export interface QuoteContext { pendulumToMoonbeamXcm?: XcmMeta; - pendulumToStellar?: StellarMeta; - // Fees in baseline and display currency fees?: { // Baseline normalization currency: USD diff --git a/apps/api/src/api/services/quote/engines/discount/helpers.test.ts b/apps/api/src/api/services/quote/engines/discount/helpers.test.ts new file mode 100644 index 000000000..549ac5b9d --- /dev/null +++ b/apps/api/src/api/services/quote/engines/discount/helpers.test.ts @@ -0,0 +1,55 @@ +import { describe, expect, it } from "bun:test"; +import Big from "big.js"; +import { calculateSubsidyAmount } from "./helpers"; + +describe("calculateSubsidyAmount", () => { + it("returns 0 when actual output meets expected output", () => { + const result = calculateSubsidyAmount(new Big(100), new Big(100), 0); + expect(result.toString()).toBe("0"); + }); + + it("returns 0 when actual output exceeds expected output", () => { + const result = calculateSubsidyAmount(new Big(100), new Big(110), 0); + expect(result.toString()).toBe("0"); + }); + + it("returns full shortfall when no maxSubsidy cap", () => { + const result = calculateSubsidyAmount(new Big(100), new Big(90), 0); + expect(result.toString()).toBe("10"); + }); + + it("caps subsidy at maxSubsidy fraction of expected output", () => { + const result = calculateSubsidyAmount(new Big(100), new Big(80), 0.05); + // shortfall=20, maxAllowed=100*0.05=5 + expect(result.toString()).toBe("5"); + }); + + it("returns full shortfall when it is less than maxSubsidy cap", () => { + const result = calculateSubsidyAmount(new Big(100), new Big(95), 0.1); + // shortfall=5, maxAllowed=100*0.1=10 + expect(result.toString()).toBe("5"); + }); + + describe("negative targetDiscount scenarios (rate floor)", () => { + it("subsidizes when actual is below negative-target expected output", () => { + const result = calculateSubsidyAmount(new Big(99.9), new Big(99.5), 0); + expect(result.toString()).toBe("0.4"); + }); + + it("returns 0 when actual already meets negative-target expected output", () => { + const result = calculateSubsidyAmount(new Big(99.9), new Big(99.9), 0); + expect(result.toString()).toBe("0"); + }); + + it("returns 0 when actual exceeds negative-target expected output", () => { + const result = calculateSubsidyAmount(new Big(99.9), new Big(100.5), 0); + expect(result.toString()).toBe("0"); + }); + + it("caps subsidy at maxSubsidy for negative target", () => { + const result = calculateSubsidyAmount(new Big(99.9), new Big(98.0), 0.01); + // shortfall=1.9, maxAllowed=99.9*0.01=0.999 + expect(result.toString()).toBe("0.999"); + }); + }); +}); diff --git a/apps/api/src/api/services/quote/engines/discount/offramp-alfredpay.ts b/apps/api/src/api/services/quote/engines/discount/offramp-alfredpay.ts index cff901312..b1ac53a0e 100644 --- a/apps/api/src/api/services/quote/engines/discount/offramp-alfredpay.ts +++ b/apps/api/src/api/services/quote/engines/discount/offramp-alfredpay.ts @@ -68,7 +68,7 @@ export class OffRampAlfredpayDiscountEngine extends BaseDiscountEngine { const idealSubsidyDecimal = expectedOutputDecimal.gt(finalOutput) ? expectedOutputDecimal.minus(finalOutput) : new Big(0); const actualSubsidyDecimal = - targetDiscount > 0 ? calculateSubsidyAmount(expectedOutputDecimal, finalOutput, maxSubsidy) : new Big(0); + targetDiscount !== 0 ? calculateSubsidyAmount(expectedOutputDecimal, finalOutput, maxSubsidy) : new Big(0); const targetOutputDecimal = finalOutput.plus(actualSubsidyDecimal); diff --git a/apps/api/src/api/services/quote/engines/discount/offramp.ts b/apps/api/src/api/services/quote/engines/discount/offramp.ts index 5f3eedb4f..aa6e7b547 100644 --- a/apps/api/src/api/services/quote/engines/discount/offramp.ts +++ b/apps/api/src/api/services/quote/engines/discount/offramp.ts @@ -74,7 +74,7 @@ export class OffRampDiscountEngine extends BaseDiscountEngine { // Calculate actual subsidy (capped by maxSubsidy) const actualSubsidyAmountDecimal = - targetDiscount > 0 + targetDiscount !== 0 ? calculateSubsidyAmount(adjustedExpectedOutputDecimal, actualOutputAmountDecimal, maxSubsidy) : Big(0); const actualSubsidyAmountRaw = multiplyByPowerOfTen(actualSubsidyAmountDecimal, nablaSwap.outputDecimals).toFixed(0, 0); diff --git a/apps/api/src/api/services/quote/engines/discount/onramp-alfredpay.ts b/apps/api/src/api/services/quote/engines/discount/onramp-alfredpay.ts index 1e4d20c7f..54962943c 100644 --- a/apps/api/src/api/services/quote/engines/discount/onramp-alfredpay.ts +++ b/apps/api/src/api/services/quote/engines/discount/onramp-alfredpay.ts @@ -51,7 +51,7 @@ export class OnRampAlfredpayDiscountEngine extends BaseDiscountEngine { const idealSubsidyDecimal = expectedOutputDecimal.gt(finalOutput) ? expectedOutputDecimal.minus(finalOutput) : new Big(0); const actualSubsidyDecimal = - targetDiscount > 0 ? calculateSubsidyAmount(expectedOutputDecimal, finalOutput, maxSubsidy) : new Big(0); + targetDiscount !== 0 ? calculateSubsidyAmount(expectedOutputDecimal, finalOutput, maxSubsidy) : new Big(0); const targetOutputDecimal = finalOutput.plus(actualSubsidyDecimal); diff --git a/apps/api/src/api/services/quote/engines/discount/onramp.ts b/apps/api/src/api/services/quote/engines/discount/onramp.ts index 3be9689aa..8b0d5b8a3 100644 --- a/apps/api/src/api/services/quote/engines/discount/onramp.ts +++ b/apps/api/src/api/services/quote/engines/discount/onramp.ts @@ -10,6 +10,7 @@ import Big from "big.js"; import logger from "../../../../../config/logger"; import { getEvmBridgeQuote } from "../../core/squidrouter"; import { QuoteContext } from "../../core/types"; +import { isBrlToBrlaBaseDirect, isEurToEurcBaseDirect } from "../../utils"; import { BaseDiscountEngine, DiscountComputation } from "."; import { calculateExpectedOutput, calculateSubsidyAmount, resolveDiscountPartner } from "./helpers"; @@ -26,6 +27,12 @@ export class OnRampDiscountEngine extends BaseDiscountEngine { throw new Error("OnRampDiscountEngine requires either nablaSwap or nablaSwapEvm to be defined"); } + // Direct fiat->own-stablecoin passthrough (EUR->EURC, BRL->BRLA on Base) is 1:1: the nabla + // engine intentionally skips the oracle, so don't require oraclePrice here. + if (isFiatToOwnStablecoinDirect(ctx)) { + return; + } + const nablaSwap = ctx.nablaSwap || ctx.nablaSwapEvm; if (!nablaSwap?.oraclePrice) { throw new Error("OnRampDiscountEngine requires nablaSwap.oraclePrice to be defined"); @@ -154,6 +161,10 @@ export class OnRampDiscountEngine extends BaseDiscountEngine { } protected async compute(ctx: QuoteContext): Promise { + if (isFiatToOwnStablecoinDirect(ctx)) { + return buildPassthroughDiscountComputation(ctx); + } + // Determine which nabla swap we're using (Base EVM or Pendulum) const isBaseFlow = !!ctx.nablaSwapEvm; const nablaSwap = ctx.nablaSwapEvm || ctx.nablaSwap!; @@ -207,7 +218,7 @@ export class OnRampDiscountEngine extends BaseDiscountEngine { // Calculate actual subsidy (capped by maxSubsidy) const actualSubsidyAmountDecimal = - targetDiscount > 0 + targetDiscount !== 0 ? calculateSubsidyAmount(adjustedExpectedOutputDecimal, actualOutputAmountDecimal, maxSubsidy) : Big(0); const actualSubsidyAmountRaw = multiplyByPowerOfTen(actualSubsidyAmountDecimal, nablaSwap.outputDecimals).toFixed(0, 0); @@ -237,3 +248,33 @@ export class OnRampDiscountEngine extends BaseDiscountEngine { }; } } + +function isFiatToOwnStablecoinDirect(ctx: QuoteContext): boolean { + const { inputCurrency, outputCurrency, to } = ctx.request; + return isEurToEurcBaseDirect(inputCurrency, outputCurrency, to) || isBrlToBrlaBaseDirect(inputCurrency, outputCurrency, to); +} + +function buildPassthroughDiscountComputation(ctx: QuoteContext): DiscountComputation { + // biome-ignore lint/style/noNonNullAssertion: validate() guarantees one nabla swap is set + const nablaSwap = ctx.nablaSwapEvm || ctx.nablaSwap!; + const outputAmountDecimal = nablaSwap.outputAmountDecimal; + const outputAmountRaw = multiplyByPowerOfTen(outputAmountDecimal, nablaSwap.outputDecimals).toFixed(0, 0); + const zero = new Big(0); + + return { + actualOutputAmountDecimal: outputAmountDecimal, + actualOutputAmountRaw: outputAmountRaw, + adjustedDifference: zero, + adjustedTargetDiscount: zero, + expectedOutputAmountDecimal: outputAmountDecimal, + expectedOutputAmountRaw: outputAmountRaw, + idealSubsidyAmountInOutputTokenDecimal: zero, + idealSubsidyAmountInOutputTokenRaw: "0", + partnerId: null, + subsidyAmountInOutputTokenDecimal: zero, + subsidyAmountInOutputTokenRaw: "0", + subsidyRate: zero, + targetOutputAmountDecimal: outputAmountDecimal, + targetOutputAmountRaw: outputAmountRaw + }; +} diff --git a/apps/api/src/api/services/quote/engines/fee/offramp-mykobo.ts b/apps/api/src/api/services/quote/engines/fee/offramp-mykobo.ts new file mode 100644 index 000000000..73f5aa709 --- /dev/null +++ b/apps/api/src/api/services/quote/engines/fee/offramp-mykobo.ts @@ -0,0 +1,29 @@ +import { EvmToken, FiatToken, MykoboApiService, RampCurrency, RampDirection } from "@vortexfi/shared"; +import { QuoteContext } from "../../core/types"; +import { BaseFeeEngine, FeeComputation, FeeConfig } from "./index"; + +export class OffRampFeeMykoboEngine extends BaseFeeEngine { + readonly config: FeeConfig = { + direction: RampDirection.SELL, + skipNote: "Skipped for on-ramp request" + }; + + protected validate(ctx: QuoteContext): void { + if (!ctx.nablaSwapEvm) { + throw new Error("OffRampFeeMykoboEngine requires nablaSwapEvm in context"); + } + } + + protected async compute(ctx: QuoteContext, _anchorFee: string, _feeCurrency: RampCurrency): Promise { + // biome-ignore lint/style/noNonNullAssertion: validated above + const swapOutputEurc = ctx.nablaSwapEvm!.outputAmountDecimal.toFixed(2, 0); + + const mykoboFee = await MykoboApiService.getInstance().defaultWithdrawFee(swapOutputEurc); + const anchorFeeCurrency = FiatToken.EURC as RampCurrency; + + return { + anchor: { amount: mykoboFee.total, currency: anchorFeeCurrency }, + network: { amount: "0", currency: EvmToken.USDC as RampCurrency } + }; + } +} diff --git a/apps/api/src/api/services/quote/engines/fee/offramp-stellar.ts b/apps/api/src/api/services/quote/engines/fee/offramp-stellar.ts deleted file mode 100644 index 1431550ff..000000000 --- a/apps/api/src/api/services/quote/engines/fee/offramp-stellar.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { EvmToken, RampCurrency, RampDirection } from "@vortexfi/shared"; -import { QuoteContext } from "../../core/types"; -import { BaseFeeEngine, FeeComputation, FeeConfig } from "./index"; - -export class OffRampFeeStellarEngine extends BaseFeeEngine { - readonly config: FeeConfig = { - direction: RampDirection.SELL, - skipNote: "Skipped for on-ramp request" - }; - - protected validate(ctx: QuoteContext): void { - // No specific validation needed - } - - protected async compute(ctx: QuoteContext, anchorFee: string, feeCurrency: RampCurrency): Promise { - return { - anchor: { amount: anchorFee, currency: feeCurrency }, - network: { amount: "0", currency: EvmToken.USDC as RampCurrency } - }; - } -} diff --git a/apps/api/src/api/services/quote/engines/fee/onramp-monerium-to-assethub.ts b/apps/api/src/api/services/quote/engines/fee/onramp-monerium-to-assethub.ts deleted file mode 100644 index 96947b153..000000000 --- a/apps/api/src/api/services/quote/engines/fee/onramp-monerium-to-assethub.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { EvmToken, RampCurrency, RampDirection } from "@vortexfi/shared"; -import { QuoteContext } from "../../core/types"; -import { BaseFeeEngine, FeeComputation, FeeConfig } from "./index"; - -export class OnRampMoneriumToAssethubFeeEngine extends BaseFeeEngine { - readonly config: FeeConfig = { - direction: RampDirection.BUY, - skipNote: "Skipped for off-ramp request" - }; - - protected validate(ctx: QuoteContext): void { - if (!ctx.evmToMoonbeam) { - throw new Error("OnRampMoneriumToAssethubFeeEngine: evmToMoonbeam quote data is required"); - } - } - - protected async compute(ctx: QuoteContext, anchorFee: string, feeCurrency: RampCurrency): Promise { - return { - anchor: { amount: anchorFee, currency: feeCurrency }, - // biome-ignore lint/style/noNonNullAssertion: Context is validated in `validate` - network: { amount: ctx.evmToMoonbeam!.networkFeeUSD, currency: EvmToken.USDC as RampCurrency } - }; - } -} diff --git a/apps/api/src/api/services/quote/engines/fee/onramp-monerium-to-evm.ts b/apps/api/src/api/services/quote/engines/fee/onramp-monerium-to-evm.ts deleted file mode 100644 index d3fe2f467..000000000 --- a/apps/api/src/api/services/quote/engines/fee/onramp-monerium-to-evm.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { EvmToken, FiatToken, RampCurrency, RampDirection } from "@vortexfi/shared"; -import { QuoteContext } from "../../core/types"; -import { BaseFeeEngine, FeeComputation, FeeConfig } from "./index"; - -export class OnRampMoneriumToEvmFeeEngine extends BaseFeeEngine { - readonly config: FeeConfig = { - direction: RampDirection.BUY, - skipNote: "Skipped for off-ramp request" - }; - - protected validate(ctx: QuoteContext): void { - // No specific validation needed - } - - protected async compute(ctx: QuoteContext, anchorFee: string, feeCurrency: RampCurrency): Promise { - // For this specific engine, no fees are applied, so we return zero amounts for all fee components - return { - anchor: { amount: "0", currency: FiatToken.EURC as RampCurrency }, - forcedPartnerMarkupFee: { amount: "0", currency: feeCurrency }, - forcedVortexFee: { amount: "0", currency: feeCurrency }, - network: { amount: "0", currency: EvmToken.USDC as RampCurrency } - }; - } -} diff --git a/apps/api/src/api/services/quote/engines/fee/onramp-mykobo-to-evm.ts b/apps/api/src/api/services/quote/engines/fee/onramp-mykobo-to-evm.ts new file mode 100644 index 000000000..f0cc3d81a --- /dev/null +++ b/apps/api/src/api/services/quote/engines/fee/onramp-mykobo-to-evm.ts @@ -0,0 +1,84 @@ +import { + EvmNetworks, + EvmToken, + evmTokenConfig, + getNetworkFromDestination, + isNetworkEVM, + multiplyByPowerOfTen, + Networks, + OnChainToken, + RampCurrency, + RampDirection +} from "@vortexfi/shared"; +import { calculateEvmBridgeAndNetworkFee, getTokenDetailsForEvmDestination } from "../../core/squidrouter"; +import { QuoteContext } from "../../core/types"; +import { BaseFeeEngine, FeeComputation, FeeConfig } from "./index"; + +export class OnRampMykoboToEvmFeeEngine extends BaseFeeEngine { + readonly config: FeeConfig = { + direction: RampDirection.BUY, + skipNote: "Skipped for off-ramp request" + }; + + constructor( + private readonly fromNetwork: Networks, + private readonly fromToken: EvmToken + ) { + super(); + if (!isNetworkEVM(fromNetwork)) { + throw new Error(`OnRampMykoboToEvmFeeEngine: ${fromNetwork} is not an EVM network`); + } + } + + protected validate(ctx: QuoteContext): void { + if (!ctx.mykoboMint) { + throw new Error("OnRampMykoboToEvmFeeEngine requires mykoboMint in context"); + } + } + + protected async compute(ctx: QuoteContext, _anchorFee: string, _feeCurrency: RampCurrency): Promise { + const { request } = ctx; + + // biome-ignore lint/style/noNonNullAssertion: Context is validated in `validate` + const computedAnchorFee = ctx.mykoboMint!.fee.toString(); + // biome-ignore lint/style/noNonNullAssertion: Context is validated in `validate` + const anchorFeeCurrency = ctx.mykoboMint!.currency as RampCurrency; + + const toNetwork = getNetworkFromDestination(request.to); + if (!toNetwork) { + throw new Error(`OnRampMykoboToEvmFeeEngine: invalid network for destination: ${request.to}`); + } + + const toToken = getTokenDetailsForEvmDestination(request.outputCurrency as OnChainToken, toNetwork).erc20AddressSourceChain; + + const swapNetwork = this.fromNetwork as EvmNetworks; + const fromTokenDetails = evmTokenConfig[swapNetwork]?.[this.fromToken]; + if (!fromTokenDetails) { + throw new Error(`OnRampMykoboToEvmFeeEngine: invalid token configuration for ${this.fromToken} on ${swapNetwork}`); + } + + if (swapNetwork === toNetwork && fromTokenDetails.erc20AddressSourceChain.toLowerCase() === toToken.toLowerCase()) { + return { + anchor: { amount: computedAnchorFee, currency: anchorFeeCurrency }, + network: { amount: "0", currency: "USD" as RampCurrency } + }; + } + + const amountRaw = multiplyByPowerOfTen(request.inputAmount, fromTokenDetails.decimals).toFixed(0, 0); + + const bridgeResult = await calculateEvmBridgeAndNetworkFee({ + amountRaw, + fromNetwork: swapNetwork, + fromToken: fromTokenDetails.erc20AddressSourceChain, + originalInputAmountForRateCalc: request.inputAmount, + rampType: request.rampType, + toNetwork, + toToken + }); + + return { + anchor: { amount: computedAnchorFee, currency: anchorFeeCurrency }, + network: { amount: bridgeResult.networkFeeUSD, currency: "USD" as RampCurrency } + }; + } +} diff --git a/apps/api/src/api/services/quote/engines/finalize/index.test.ts b/apps/api/src/api/services/quote/engines/finalize/index.test.ts new file mode 100644 index 000000000..3ad8001ea --- /dev/null +++ b/apps/api/src/api/services/quote/engines/finalize/index.test.ts @@ -0,0 +1,84 @@ +import {afterEach, describe, expect, it, mock} from "bun:test"; +import {EPaymentMethod, EvmToken, FiatToken, Networks, RampDirection} from "@vortexfi/shared"; +import Big from "big.js"; +import QuoteTicket from "../../../../../models/quoteTicket.model"; +import {QuoteContext} from "../../core/types"; +import {BaseFinalizeEngine, FinalizeComputation} from "."; + +class TestFinalizeEngine extends BaseFinalizeEngine { + readonly config = { + direction: RampDirection.BUY, + missingFeesMessage: "Missing test fees", + skipNote: "Skip sell quotes" + }; + + protected async computeOutput(_ctx: QuoteContext): Promise { + return { + amount: new Big(99), + decimals: 2 + }; + } +} + +describe("BaseFinalizeEngine", () => { + const originalQuoteTicketCreate = QuoteTicket.create; + + afterEach(() => { + QuoteTicket.create = originalQuoteTicketCreate; + }); + + it("persists profile-priced quotes as user-owned with a separate pricing partner", async () => { + const createdAt = new Date("2026-06-03T12:00:00.000Z"); + const expiresAt = new Date("2026-06-03T12:10:00.000Z"); + const quoteCreateMock = mock(async data => ({ + ...data, + createdAt, + expiresAt, + id: "quote-1" + })); + QuoteTicket.create = quoteCreateMock as unknown as typeof QuoteTicket.create; + + const ctx = { + addNote: mock(() => undefined), + fees: { + displayFiat: { + anchor: "1", + currency: FiatToken.BRL, + network: "0", + partnerMarkup: "2", + total: "13", + vortex: "10" + }, + usd: { + anchor: "0.2", + network: "0", + partnerMarkup: "0.4", + total: "2.6", + vortex: "2" + } + }, + partnerOwnerId: null, + pricingPartnerId: "pricing-partner-id", + request: { + from: EPaymentMethod.PIX, + inputAmount: "100", + inputCurrency: FiatToken.BRL, + network: Networks.Base, + outputCurrency: EvmToken.USDC, + rampType: RampDirection.BUY, + to: Networks.Base, + userId: "user-1" + } + } as unknown as QuoteContext; + + await new TestFinalizeEngine().execute(ctx); + + expect(quoteCreateMock).toHaveBeenCalledTimes(1); + expect(quoteCreateMock.mock.calls[0][0]).toMatchObject({ + partnerId: null, + pricingPartnerId: "pricing-partner-id", + status: "pending", + userId: "user-1" + }); + }); +}); diff --git a/apps/api/src/api/services/quote/engines/finalize/index.ts b/apps/api/src/api/services/quote/engines/finalize/index.ts index 6d25bc285..a4134adde 100644 --- a/apps/api/src/api/services/quote/engines/finalize/index.ts +++ b/apps/api/src/api/services/quote/engines/finalize/index.ts @@ -1,6 +1,7 @@ import { getPaymentMethodFromDestinations, QuoteResponse, RampDirection } from "@vortexfi/shared"; import Big from "big.js"; import httpStatus from "http-status"; +import { config } from "../../../../../config/vars"; import QuoteTicket from "../../../../../models/quoteTicket.model"; import { APIError } from "../../../../errors/api-error"; import { trimTrailingZeros } from "../../core/helpers"; @@ -149,6 +150,7 @@ export abstract class BaseFinalizeEngine implements Stage { apiKey: request.apiKey || null, countryCode: request.countryCode, expiresAt, + flowVariant: config.flowVariant, from: request.from, inputAmount: request.inputAmount, inputCurrency: request.inputCurrency, @@ -156,8 +158,9 @@ export abstract class BaseFinalizeEngine implements Stage { network: request.network, outputAmount: outputAmountStr, outputCurrency: request.outputCurrency, - partnerId: ctx.partner?.id || null, + partnerId: ctx.partnerOwnerId || null, paymentMethod, + pricingPartnerId: ctx.pricingPartnerId || null, rampType: request.rampType, status: "pending", to: request.to, diff --git a/apps/api/src/api/services/quote/engines/finalize/offramp.ts b/apps/api/src/api/services/quote/engines/finalize/offramp.ts index d881bc31e..c3adfea42 100644 --- a/apps/api/src/api/services/quote/engines/finalize/offramp.ts +++ b/apps/api/src/api/services/quote/engines/finalize/offramp.ts @@ -17,20 +17,21 @@ export class OffRampFinalizeEngine extends BaseFinalizeEngine { const offrampAmount = ctx.request.to === "pix" ? (ctx.nablaSwapEvm?.outputAmountDecimal ?? ctx.pendulumToMoonbeamXcm?.outputAmountDecimal) - : ctx.alfredpayOfframp - ? ctx.alfredpayOfframp.outputAmountDecimal - : ctx.pendulumToStellar?.outputAmountDecimal; + : ctx.request.to === "sepa" + ? ctx.nablaSwapEvm?.outputAmountDecimal + : ctx.alfredpayOfframp + ? ctx.alfredpayOfframp.outputAmountDecimal + : undefined; if (!offrampAmount) { throw new APIError({ - message: - "OffRampFinalizeEngine requires nablaSwapEvm, pendulumToMoonbeamXcm, alfredpayOfframp or pendulumToStellar output", + message: "OffRampFinalizeEngine requires nablaSwapEvm, pendulumToMoonbeamXcm or alfredpayOfframp output", status: httpStatus.INTERNAL_SERVER_ERROR }); } // AlfredPay's toAmount is already net-of-fees, so no fee subtraction needed. - // For other providers (Stellar, BRLA), the anchor fee must still be subtracted. + // For other providers (e.g. BRLA), the anchor fee must still be subtracted. const isAlfredpay = !!ctx.alfredpayOfframp; let amount: Big; diff --git a/apps/api/src/api/services/quote/engines/finalize/onramp.test.ts b/apps/api/src/api/services/quote/engines/finalize/onramp.test.ts new file mode 100644 index 000000000..ed6c96078 --- /dev/null +++ b/apps/api/src/api/services/quote/engines/finalize/onramp.test.ts @@ -0,0 +1,46 @@ +import {describe, expect, it} from "bun:test"; +import {EvmToken, FiatToken, Networks, RampDirection} from "@vortexfi/shared"; +import Big from "big.js"; +import {OnRampFinalizeEngine} from "./onramp"; + +class TestOnRampFinalizeEngine extends OnRampFinalizeEngine { + compute(ctx: Parameters[0]) { + return this.computeOutput(ctx); + } +} + +describe("OnRampFinalizeEngine", () => { + it("uses destination EVM token decimals for BRL onramp output precision", async () => { + const result = await new TestOnRampFinalizeEngine().compute({ + evmToEvm: { + outputAmountDecimal: new Big("4817.805726163073314321") + }, + request: { + inputCurrency: FiatToken.BRL, + outputCurrency: EvmToken.USDT, + rampType: RampDirection.BUY, + to: Networks.BSC + } + } as never); + + expect(result.decimals).toBe(18); + expect(result.amount.toFixed(result.decimals, 0)).toBe("4817.805726163073314321"); + }); + + it("uses destination EVM token decimals for Alfredpay routed onramp output precision", async () => { + const result = await new TestOnRampFinalizeEngine().compute({ + evmToEvm: { + outputAmountDecimal: new Big("4817.805726163073314321") + }, + request: { + inputCurrency: FiatToken.USD, + outputCurrency: EvmToken.USDT, + rampType: RampDirection.BUY, + to: Networks.BSC + } + } as never); + + expect(result.decimals).toBe(18); + expect(result.amount.toFixed(result.decimals, 0)).toBe("4817.805726163073314321"); + }); +}); diff --git a/apps/api/src/api/services/quote/engines/finalize/onramp.ts b/apps/api/src/api/services/quote/engines/finalize/onramp.ts index 081043479..0e3f6f4f6 100644 --- a/apps/api/src/api/services/quote/engines/finalize/onramp.ts +++ b/apps/api/src/api/services/quote/engines/finalize/onramp.ts @@ -1,7 +1,8 @@ -import { AssetHubToken, FiatToken, RampDirection } from "@vortexfi/shared"; +import { AssetHubToken, FiatToken, OnChainToken, RampDirection } from "@vortexfi/shared"; import Big from "big.js"; import httpStatus from "http-status"; import { APIError } from "../../../../errors/api-error"; +import { getTokenDetailsForEvmDestination } from "../../core/squidrouter"; import { QuoteContext } from "../../core/types"; import { applyAlfredpayLimits, validateAmountLimits } from "../../core/validation-helpers"; import { BaseFinalizeEngine, FinalizeComputation } from "."; @@ -17,6 +18,7 @@ export class OnRampFinalizeEngine extends BaseFinalizeEngine { const { request } = ctx; let finalOutputAmountDecimal: Big; + let finalOutputDecimals = 6; if (request.to === "assethub") { if (request.outputCurrency === AssetHubToken.USDC) { const output = ctx.pendulumToAssethubXcm?.outputAmountDecimal; @@ -46,10 +48,12 @@ export class OnRampFinalizeEngine extends BaseFinalizeEngine { }); } finalOutputAmountDecimal = new Big(output); + finalOutputDecimals = getTokenDetailsForEvmDestination(request.outputCurrency as OnChainToken, request.to).decimals; } else if ( request.inputCurrency === FiatToken.USD || request.inputCurrency === FiatToken.MXN || - request.inputCurrency === FiatToken.COP + request.inputCurrency === FiatToken.COP || + request.inputCurrency === FiatToken.ARS ) { // evmToEvm is set when Squid Router ran (e.g. USDC Polygon → USDT Arbitrum). // When destination is USDC on Polygon, Squid Router is skipped (skipRouteCalculation) @@ -62,6 +66,9 @@ export class OnRampFinalizeEngine extends BaseFinalizeEngine { }); } let amount = new Big(output); + if (ctx.evmToEvm) { + finalOutputDecimals = getTokenDetailsForEvmDestination(request.outputCurrency as OnChainToken, request.to).decimals; + } if (!ctx.evmToEvm && ctx.alfredpayMint) { const usdFees = ctx.fees?.usd; const feesToDeduct = usdFees ? new Big(usdFees.vortex).plus(usdFees.partnerMarkup) : new Big(0); @@ -88,7 +95,7 @@ export class OnRampFinalizeEngine extends BaseFinalizeEngine { return { amount: finalOutputAmountDecimal, - decimals: 6 + decimals: finalOutputDecimals }; } diff --git a/apps/api/src/api/services/quote/engines/initialize/offramp-from-evm-alfredpay.ts b/apps/api/src/api/services/quote/engines/initialize/offramp-from-evm-alfredpay.ts index 0e1fe432e..5df6ced51 100644 --- a/apps/api/src/api/services/quote/engines/initialize/offramp-from-evm-alfredpay.ts +++ b/apps/api/src/api/services/quote/engines/initialize/offramp-from-evm-alfredpay.ts @@ -4,17 +4,11 @@ import { EvmBridgeQuoteRequest, getEvmBridgeQuote } from "../../core/squidrouter import { QuoteContext } from "../../core/types"; import { assignPreNablaContext, BaseInitializeEngine } from "./index"; -export class OffRampFromEvmInitializeEngine extends BaseInitializeEngine { - private readonly network: Networks; - - constructor(network: Networks) { - super(); - this.network = network; - } - +export class OffRampFromEvmInitializeAlfredpayEngine extends BaseInitializeEngine { readonly config = { direction: RampDirection.SELL, - skipNote: "OffRampFromEvmInitializeEngine: Skipped because rampType is BUY, this engine handles SELL operations only" + skipNote: + "OffRampFromEvmInitializeAlfredpayEngine: Skipped because rampType is BUY, this engine handles SELL operations only" }; protected async executeInternal(ctx: QuoteContext): Promise { @@ -28,9 +22,8 @@ export class OffRampFromEvmInitializeEngine extends BaseInitializeEngine { inputCurrency: req.inputCurrency as OnChainToken, outputCurrency: ALFREDPAY_EVM_TOKEN, rampType: req.rampType, - toNetwork: this.network + toNetwork: Networks.Polygon }; - const bridgeQuote = await getEvmBridgeQuote(quoteRequest); ctx.evmToEvm = { diff --git a/apps/api/src/api/services/quote/engines/initialize/offramp-from-evm-avenia.ts b/apps/api/src/api/services/quote/engines/initialize/offramp-from-evm-avenia.ts new file mode 100644 index 000000000..450eac9b2 --- /dev/null +++ b/apps/api/src/api/services/quote/engines/initialize/offramp-from-evm-avenia.ts @@ -0,0 +1,44 @@ +import { EvmToken, Networks, OnChainToken, RampDirection } from "@vortexfi/shared"; +import Big from "big.js"; +import { EvmBridgeQuoteRequest, getEvmBridgeQuote } from "../../core/squidrouter"; +import { QuoteContext } from "../../core/types"; +import { assignPreNablaContext, BaseInitializeEngine } from "./index"; + +export class OffRampFromEvmInitializeAveniaEngine extends BaseInitializeEngine { + readonly config = { + direction: RampDirection.SELL, + skipNote: "OffRampFromEvmInitializeAveniaEngine: Skipped because rampType is BUY, this engine handles SELL operations only" + }; + + protected async executeInternal(ctx: QuoteContext): Promise { + const req = ctx.request; + + await assignPreNablaContext(ctx); + + const quoteRequest: EvmBridgeQuoteRequest = { + amountDecimal: req.inputAmount, + fromNetwork: req.from as Networks, + inputCurrency: req.inputCurrency as OnChainToken, + outputCurrency: EvmToken.USDC, + rampType: req.rampType, + toNetwork: Networks.Base + }; + + const bridgeQuote = await getEvmBridgeQuote(quoteRequest); + + ctx.evmToEvm = { + ...quoteRequest, + fromToken: bridgeQuote.fromToken, + inputAmountDecimal: Big(quoteRequest.amountDecimal), + inputAmountRaw: bridgeQuote.inputAmountRaw, + networkFeeUSD: bridgeQuote.networkFeeUSD, + outputAmountDecimal: bridgeQuote.outputAmountDecimal, + outputAmountRaw: bridgeQuote.outputAmountRaw, + toToken: bridgeQuote.toToken + }; + + ctx.addNote?.( + `Initialized: input=${req.inputAmount} ${req.inputCurrency}, raw=${ctx.evmToEvm?.inputAmountRaw}, output=${ctx.evmToEvm?.outputAmountDecimal.toString()} ${ctx.evmToEvm?.toToken}, raw=${ctx.evmToEvm?.outputAmountRaw}` + ); + } +} diff --git a/apps/api/src/api/services/quote/engines/initialize/offramp-from-evm-mykobo.ts b/apps/api/src/api/services/quote/engines/initialize/offramp-from-evm-mykobo.ts new file mode 100644 index 000000000..6f9fb8117 --- /dev/null +++ b/apps/api/src/api/services/quote/engines/initialize/offramp-from-evm-mykobo.ts @@ -0,0 +1,44 @@ +import { EvmToken, Networks, OnChainToken, RampDirection } from "@vortexfi/shared"; +import Big from "big.js"; +import { EvmBridgeQuoteRequest, getEvmBridgeQuote } from "../../core/squidrouter"; +import { QuoteContext } from "../../core/types"; +import { assignPreNablaContext, BaseInitializeEngine } from "./index"; + +export class OffRampFromEvmInitializeMykoboEngine extends BaseInitializeEngine { + readonly config = { + direction: RampDirection.SELL, + skipNote: "OffRampFromEvmInitializeMykoboEngine: Skipped because rampType is BUY, this engine handles SELL operations only" + }; + + protected async executeInternal(ctx: QuoteContext): Promise { + const req = ctx.request; + + await assignPreNablaContext(ctx); + + const quoteRequest: EvmBridgeQuoteRequest = { + amountDecimal: req.inputAmount, + fromNetwork: req.from as Networks, + inputCurrency: req.inputCurrency as OnChainToken, + outputCurrency: EvmToken.USDC, + rampType: req.rampType, + toNetwork: Networks.Base + }; + + const bridgeQuote = await getEvmBridgeQuote(quoteRequest); + + ctx.evmToEvm = { + ...quoteRequest, + fromToken: bridgeQuote.fromToken, + inputAmountDecimal: Big(quoteRequest.amountDecimal), + inputAmountRaw: bridgeQuote.inputAmountRaw, + networkFeeUSD: bridgeQuote.networkFeeUSD, + outputAmountDecimal: bridgeQuote.outputAmountDecimal, + outputAmountRaw: bridgeQuote.outputAmountRaw, + toToken: bridgeQuote.toToken + }; + + ctx.addNote?.( + `Initialized: input=${req.inputAmount} ${req.inputCurrency}, raw=${ctx.evmToEvm?.inputAmountRaw}, output=${ctx.evmToEvm?.outputAmountDecimal.toString()} ${ctx.evmToEvm?.toToken}, raw=${ctx.evmToEvm?.outputAmountRaw}` + ); + } +} diff --git a/apps/api/src/api/services/quote/engines/initialize/onramp-monerium.ts b/apps/api/src/api/services/quote/engines/initialize/onramp-monerium.ts deleted file mode 100644 index 3f1617050..000000000 --- a/apps/api/src/api/services/quote/engines/initialize/onramp-monerium.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ERC20_EURE_POLYGON_DECIMALS, multiplyByPowerOfTen, RampDirection } from "@vortexfi/shared"; -import Big from "big.js"; -import { QuoteContext } from "../../core/types"; -import { BaseInitializeEngine } from "./index"; - -export class OnRampInitializeMoneriumEngine extends BaseInitializeEngine { - readonly config = { - direction: RampDirection.BUY, - skipNote: "OnRampInitializeMoneriumEngine: Skipped because rampType is SELL, this engine handles BUY operations only" - }; - - protected async executeInternal(ctx: QuoteContext): Promise { - const req = ctx.request; - - // Calculate Monerium input and output (of minting/deposit) - const eurTokenDecimals = ERC20_EURE_POLYGON_DECIMALS; - const inputAmountDecimal = new Big(req.inputAmount); - const inputAmountRaw = multiplyByPowerOfTen(inputAmountDecimal, eurTokenDecimals).toFixed(0, 0); - const moneriumFee = Big(0); - const outputAmountDecimal = inputAmountDecimal.minus(moneriumFee); - const outputAmountRaw = multiplyByPowerOfTen(outputAmountDecimal, eurTokenDecimals).toFixed(0, 0); - - ctx.moneriumMint = { - currency: ctx.request.inputCurrency, - fee: moneriumFee, - inputAmountDecimal: inputAmountDecimal, - inputAmountRaw: inputAmountRaw, - outputAmountDecimal, - outputAmountRaw - }; - - ctx.addNote?.( - `Initialized: ${inputAmountDecimal.toString()} ${req.inputCurrency} -> ${outputAmountDecimal.toString()} ${req.outputCurrency} (fee: ${moneriumFee.toString()})` - ); - } -} diff --git a/apps/api/src/api/services/quote/engines/initialize/onramp-mykobo.ts b/apps/api/src/api/services/quote/engines/initialize/onramp-mykobo.ts new file mode 100644 index 000000000..e19f692ef --- /dev/null +++ b/apps/api/src/api/services/quote/engines/initialize/onramp-mykobo.ts @@ -0,0 +1,55 @@ +import { + EvmToken, + FiatToken, + getOnChainTokenDetails, + MykoboApiService, + multiplyByPowerOfTen, + Networks, + RampDirection +} from "@vortexfi/shared"; +import Big from "big.js"; +import { QuoteContext } from "../../core/types"; +import { BaseInitializeEngine } from "./index"; + +export class OnRampInitializeMykoboEngine extends BaseInitializeEngine { + readonly config = { + direction: RampDirection.BUY, + skipNote: "OnRampInitializeMykoboEngine: Skipped because rampType is SELL, this engine handles BUY operations only" + }; + + protected async executeInternal(ctx: QuoteContext): Promise { + const req = ctx.request; + + const eurcBaseDetails = getOnChainTokenDetails(Networks.Base, EvmToken.EURC); + if (!eurcBaseDetails) { + throw new Error("OnRampInitializeMykoboEngine: EURC token details not found for Base"); + } + + const inputAmountDecimal = new Big(req.inputAmount); + const inputAmountRaw = multiplyByPowerOfTen(inputAmountDecimal, eurcBaseDetails.decimals).toFixed(0, 0); + + const mykoboFeeResponse = await MykoboApiService.getInstance().defaultDepositFee(inputAmountDecimal.toFixed(2, 0)); + const mykoboFeeDecimal = new Big(mykoboFeeResponse.total); + + const deliveredEurcDecimal = inputAmountDecimal.minus(mykoboFeeDecimal); + if (deliveredEurcDecimal.lte(0)) { + throw new Error( + `OnRampInitializeMykoboEngine: Mykobo deposit fee ${mykoboFeeDecimal.toFixed()} EUR is greater than or equal to input amount ${inputAmountDecimal.toFixed()} EUR` + ); + } + const deliveredEurcRaw = multiplyByPowerOfTen(deliveredEurcDecimal, eurcBaseDetails.decimals).toFixed(0, 0); + + ctx.mykoboMint = { + currency: FiatToken.EURC, + fee: mykoboFeeDecimal, + inputAmountDecimal, + inputAmountRaw, + outputAmountDecimal: deliveredEurcDecimal, + outputAmountRaw: deliveredEurcRaw + }; + + ctx.addNote?.( + `Assuming ${deliveredEurcDecimal.toFixed()} EURC delivered on Base ephemeral after ${mykoboFeeDecimal.toFixed()} EUR Mykobo deposit fee` + ); + } +} diff --git a/apps/api/src/api/services/quote/engines/merge-subsidy/offramp-evm.test.ts b/apps/api/src/api/services/quote/engines/merge-subsidy/offramp-evm.test.ts new file mode 100644 index 000000000..2d45e593f --- /dev/null +++ b/apps/api/src/api/services/quote/engines/merge-subsidy/offramp-evm.test.ts @@ -0,0 +1,81 @@ +import {describe, expect, it, mock} from "bun:test"; +import {RampDirection} from "@vortexfi/shared"; +import Big from "big.js"; +import {QuoteContext} from "../../core/types"; +import {OffRampMergeSubsidyEvmEngine} from "./offramp-evm"; + +function createContext(nablaSwapEvm: QuoteContext["nablaSwapEvm"]): QuoteContext { + return { + addNote: mock(() => undefined), + nablaSwapEvm, + request: { + rampType: RampDirection.SELL + }, + subsidy: { + actualOutputAmountDecimal: new Big("100"), + actualOutputAmountRaw: "100000000", + adjustedDifference: new Big("0"), + adjustedTargetDiscount: 0, + expectedOutputAmountDecimal: new Big("110"), + expectedOutputAmountRaw: "110000000", + idealSubsidyAmountInOutputTokenDecimal: new Big("10"), + idealSubsidyAmountInOutputTokenRaw: "10000000", + partnerId: "partner-1", + subsidyAmountInOutputTokenDecimal: new Big("10"), + subsidyAmountInOutputTokenRaw: "10000000", + subsidyRate: new Big("0.1"), + targetOutputAmountDecimal: new Big("110"), + targetOutputAmountRaw: "110000000" + } + } as unknown as QuoteContext; +} + +describe("OffRampMergeSubsidyEvmEngine", () => { + it("preserves AMM-only output before writing the merged subsidized output", async () => { + const ctx = createContext({ + ammOutputAmountDecimal: new Big("100"), + ammOutputAmountRaw: "100000000", + inputAmountForSwapDecimal: "100", + inputAmountForSwapRaw: "100000000", + inputCurrency: "USDC", + inputDecimals: 6, + inputToken: "0xinput", + outputAmountDecimal: new Big("100"), + outputAmountRaw: "100000000", + outputCurrency: "BRLA", + outputDecimals: 6, + outputToken: "0xoutput" + } as QuoteContext["nablaSwapEvm"]); + + await new OffRampMergeSubsidyEvmEngine().execute(ctx); + + expect(ctx.nablaSwapEvm?.ammOutputAmountDecimal?.toFixed()).toBe("100"); + expect(ctx.nablaSwapEvm?.ammOutputAmountRaw).toBe("100000000"); + expect(ctx.nablaSwapEvm?.outputAmountDecimal.toFixed()).toBe("110"); + expect(ctx.nablaSwapEvm?.outputAmountRaw).toBe("110000000"); + }); + + it("does not change the AMM-only output when subsidy is merged again", async () => { + const ctx = createContext({ + ammOutputAmountDecimal: new Big("100"), + ammOutputAmountRaw: "100000000", + inputAmountForSwapDecimal: "100", + inputAmountForSwapRaw: "100000000", + inputCurrency: "USDC", + inputDecimals: 6, + inputToken: "0xinput", + outputAmountDecimal: new Big("110"), + outputAmountRaw: "110000000", + outputCurrency: "BRLA", + outputDecimals: 6, + outputToken: "0xoutput" + } as QuoteContext["nablaSwapEvm"]); + + await new OffRampMergeSubsidyEvmEngine().execute(ctx); + + expect(ctx.nablaSwapEvm?.ammOutputAmountDecimal?.toFixed()).toBe("100"); + expect(ctx.nablaSwapEvm?.ammOutputAmountRaw).toBe("100000000"); + expect(ctx.nablaSwapEvm?.outputAmountDecimal.toFixed()).toBe("120"); + expect(ctx.nablaSwapEvm?.outputAmountRaw).toBe("120000000"); + }); +}); diff --git a/apps/api/src/api/services/quote/engines/nabla-swap/base-evm.test.ts b/apps/api/src/api/services/quote/engines/nabla-swap/base-evm.test.ts new file mode 100644 index 000000000..58f816d48 --- /dev/null +++ b/apps/api/src/api/services/quote/engines/nabla-swap/base-evm.test.ts @@ -0,0 +1,90 @@ +import {describe, expect, it, mock} from "bun:test"; +import Big from "big.js"; +import type {QuoteContext} from "../../core/types"; + +const mockedEvmToken = { + BRLA: "BRLA", + USDC: "USDC" +} as const; + +const mockedNetworks = { + Base: "base" +} as const; + +const mockedRampDirection = { + BUY: "BUY", + SELL: "SELL" +} as const; + +mock.module("@vortexfi/shared", () => ({ + EvmToken: mockedEvmToken, + getOnChainTokenDetails: (_network: string, token: string) => ({ + assetSymbol: token, + decimals: 6, + erc20AddressSourceChain: token === mockedEvmToken.USDC ? "0xusdc" : "0xbrla", + isNative: false, + network: mockedNetworks.Base, + type: "evm" + }), + Networks: mockedNetworks, + RampDirection: mockedRampDirection +})); + +mock.module("../../core/nabla", () => ({ + calculateNablaSwapOutputEvm: mock(async () => ({ + effectiveExchangeRate: "0.99", + nablaOutputAmountDecimal: new Big("99"), + nablaOutputAmountRaw: "99000000" + })) +})); + +mock.module("../../../priceFeed.service", () => ({ + priceFeedService: { + getOnchainOraclePrice: mock(async () => ({ price: new Big("1") })) + } +})); + +mock.module("../../../../../config/logger", () => ({ + default: { + warn: mock(() => undefined) + } +})); + +const {EvmToken, RampDirection} = await import("@vortexfi/shared"); +const {BaseNablaSwapEngineEvm} = await import("./base-evm"); + +class TestNablaSwapEngineEvm extends BaseNablaSwapEngineEvm { + readonly config = { + direction: RampDirection.SELL, + skipNote: "skip" + } as const; + + protected validate(): void {} + + protected compute() { + return { + inputAmountPreFees: new Big("100"), + inputToken: EvmToken.USDC, + outputToken: EvmToken.BRLA + }; + } +} + +describe("BaseNablaSwapEngineEvm", () => { + it("stores AMM-only output fields when assigning Nabla swap context", async () => { + const ctx = { + addNote: mock(() => undefined), + request: { + outputCurrency: "BRL", + rampType: RampDirection.SELL + } + } as unknown as QuoteContext; + + await new TestNablaSwapEngineEvm().execute(ctx); + + expect(ctx.nablaSwapEvm?.ammOutputAmountDecimal?.toFixed()).toBe("99"); + expect(ctx.nablaSwapEvm?.ammOutputAmountRaw).toBe("99000000"); + expect(ctx.nablaSwapEvm?.outputAmountDecimal.toFixed()).toBe("99"); + expect(ctx.nablaSwapEvm?.outputAmountRaw).toBe("99000000"); + }); +}); diff --git a/apps/api/src/api/services/quote/engines/nabla-swap/base-evm.ts b/apps/api/src/api/services/quote/engines/nabla-swap/base-evm.ts index 550f62588..f566695a8 100644 --- a/apps/api/src/api/services/quote/engines/nabla-swap/base-evm.ts +++ b/apps/api/src/api/services/quote/engines/nabla-swap/base-evm.ts @@ -110,6 +110,8 @@ export abstract class BaseNablaSwapEngineEvm implements Stage { ): void { ctx.nablaSwapEvm = { ...ctx.nablaSwapEvm, + ammOutputAmountDecimal: result.nablaOutputAmountDecimal, + ammOutputAmountRaw: result.nablaOutputAmountRaw, effectiveExchangeRate: result.effectiveExchangeRate, inputAmountForSwapDecimal, inputAmountForSwapRaw, diff --git a/apps/api/src/api/services/quote/engines/nabla-swap/onramp-evm.ts b/apps/api/src/api/services/quote/engines/nabla-swap/onramp-evm.ts index 77e7a7825..3b8436d29 100644 --- a/apps/api/src/api/services/quote/engines/nabla-swap/onramp-evm.ts +++ b/apps/api/src/api/services/quote/engines/nabla-swap/onramp-evm.ts @@ -1,5 +1,7 @@ -import { EvmToken, RampDirection } from "@vortexfi/shared"; +import { EvmToken, getOnChainTokenDetails, Networks, RampDirection } from "@vortexfi/shared"; +import { Big } from "big.js"; import { QuoteContext } from "../../core/types"; +import { isBrlToBrlaBaseDirect } from "../../utils"; import { BaseNablaSwapEngineEvm, NablaSwapEvmComputation } from "./base-evm"; export class OnRampSwapEngineEvm extends BaseNablaSwapEngineEvm { @@ -14,6 +16,49 @@ export class OnRampSwapEngineEvm extends BaseNablaSwapEngineEvm { } } + async execute(ctx: QuoteContext): Promise { + if (ctx.request.rampType !== RampDirection.BUY) { + ctx.addNote?.(this.config.skipNote); + return; + } + + this.validate(ctx); + + if (isBrlToBrlaBaseDirect(ctx.request.inputCurrency, ctx.request.outputCurrency, ctx.request.to)) { + if (!ctx.aveniaTransfer) { + throw new Error( + "OnRampSwapEngineEvm: Missing aveniaTransfer quote data from previous stage - ensure initialize stage ran successfully" + ); + } + const inputAmountPreFees = ctx.aveniaTransfer.outputAmountDecimal; + const brlaTokenDetails = getOnChainTokenDetails(Networks.Base, EvmToken.BRLA); + if (!brlaTokenDetails || brlaTokenDetails.type !== "evm") { + throw new Error("OnRampSwapEngineEvm: BRLA token details not found for Base"); + } + + const inputAmountForSwapRaw = inputAmountPreFees.times(new Big(10).pow(brlaTokenDetails.decimals)).toFixed(0, 0); + ctx.nablaSwapEvm = { + ammOutputAmountDecimal: inputAmountPreFees, + ammOutputAmountRaw: inputAmountForSwapRaw, + effectiveExchangeRate: "1", + inputAmountForSwapDecimal: inputAmountPreFees.toString(), + inputAmountForSwapRaw, + inputCurrency: EvmToken.BRLA, + inputDecimals: brlaTokenDetails.decimals, + inputToken: brlaTokenDetails.erc20AddressSourceChain, + outputAmountDecimal: inputAmountPreFees, + outputAmountRaw: inputAmountForSwapRaw, + outputCurrency: EvmToken.BRLA, + outputDecimals: brlaTokenDetails.decimals, + outputToken: brlaTokenDetails.erc20AddressSourceChain + }; + ctx.addNote?.(`Nabla swap bypassed for BRL→BRLA on Base, passthrough amount ${inputAmountPreFees.toFixed()} BRLA (1:1)`); + return; + } + + await super.execute(ctx); + } + protected compute(ctx: QuoteContext): NablaSwapEvmComputation { if (!ctx.aveniaTransfer) { throw new Error( diff --git a/apps/api/src/api/services/quote/engines/nabla-swap/onramp-mykobo-evm.ts b/apps/api/src/api/services/quote/engines/nabla-swap/onramp-mykobo-evm.ts new file mode 100644 index 000000000..9218533b5 --- /dev/null +++ b/apps/api/src/api/services/quote/engines/nabla-swap/onramp-mykobo-evm.ts @@ -0,0 +1,73 @@ +import { EvmToken, getOnChainTokenDetails, Networks, RampDirection } from "@vortexfi/shared"; +import { Big } from "big.js"; +import { QuoteContext } from "../../core/types"; +import { isEurToEurcBaseDirect } from "../../utils"; +import { BaseNablaSwapEngineEvm, NablaSwapEvmComputation } from "./base-evm"; + +export class OnRampSwapEngineMykoboEvm extends BaseNablaSwapEngineEvm { + readonly config = { + direction: RampDirection.BUY, + skipNote: "OnRampSwapEngineMykoboEvm: Skipped because rampType is SELL, this engine handles BUY operations only" + } as const; + + protected validate(ctx: QuoteContext): void { + if (!ctx.fees?.usd) { + throw new Error("OnRampSwapEngineMykoboEvm: Fees in USD must be calculated first - ensure fee stage ran successfully"); + } + if (!ctx.mykoboMint) { + throw new Error( + "OnRampSwapEngineMykoboEvm: Missing mykoboMint quote data from previous stage - ensure initialize stage ran successfully" + ); + } + } + + async execute(ctx: QuoteContext): Promise { + if (ctx.request.rampType !== RampDirection.BUY) { + ctx.addNote?.(this.config.skipNote); + return; + } + + this.validate(ctx); + + if (isEurToEurcBaseDirect(ctx.request.inputCurrency, ctx.request.outputCurrency, ctx.request.to)) { + // biome-ignore lint/style/noNonNullAssertion: validated above + const inputAmountPreFees = ctx.mykoboMint!.outputAmountDecimal; + const eurcTokenDetails = getOnChainTokenDetails(Networks.Base, EvmToken.EURC); + if (!eurcTokenDetails || eurcTokenDetails.type !== "evm") { + throw new Error("OnRampSwapEngineMykoboEvm: EURC token details not found for Base"); + } + + const inputAmountForSwapRaw = inputAmountPreFees.times(new Big(10).pow(eurcTokenDetails.decimals)).toFixed(0, 0); + ctx.nablaSwapEvm = { + ammOutputAmountDecimal: inputAmountPreFees, + ammOutputAmountRaw: inputAmountForSwapRaw, + effectiveExchangeRate: "1", + inputAmountForSwapDecimal: inputAmountPreFees.toString(), + inputAmountForSwapRaw, + inputCurrency: EvmToken.EURC, + inputDecimals: eurcTokenDetails.decimals, + inputToken: eurcTokenDetails.erc20AddressSourceChain, + outputAmountDecimal: inputAmountPreFees, + outputAmountRaw: inputAmountForSwapRaw, + outputCurrency: EvmToken.EURC, + outputDecimals: eurcTokenDetails.decimals, + outputToken: eurcTokenDetails.erc20AddressSourceChain + }; + ctx.addNote?.(`Nabla swap bypassed for EUR→EURC on Base, passthrough amount ${inputAmountPreFees.toFixed()} EURC (1:1)`); + return; + } + + await super.execute(ctx); + } + + protected compute(ctx: QuoteContext): NablaSwapEvmComputation { + // biome-ignore lint/style/noNonNullAssertion: validated above + const inputAmountPreFees = ctx.mykoboMint!.outputAmountDecimal; + + return { + inputAmountPreFees, + inputToken: EvmToken.EURC, + outputToken: EvmToken.USDC + }; + } +} diff --git a/apps/api/src/api/services/quote/engines/pendulum-transfers/index.ts b/apps/api/src/api/services/quote/engines/pendulum-transfers/index.ts index de6c4a965..1e1723f26 100644 --- a/apps/api/src/api/services/quote/engines/pendulum-transfers/index.ts +++ b/apps/api/src/api/services/quote/engines/pendulum-transfers/index.ts @@ -1,6 +1,6 @@ import { RampDirection } from "@vortexfi/shared"; import Big from "big.js"; -import { QuoteContext, Stage, StageKey, StellarMeta, XcmMeta } from "../../core/types"; +import { QuoteContext, Stage, StageKey, XcmMeta } from "../../core/types"; export interface PendulumTransferConfig { direction: RampDirection; @@ -8,8 +8,8 @@ export interface PendulumTransferConfig { } export interface PendulumTransferComputation { - type: "xcm" | "stellar"; - data: XcmMeta | StellarMeta; + type: "xcm"; + data: XcmMeta; } export abstract class BasePendulumTransferEngine implements Stage { @@ -71,16 +71,9 @@ export abstract class BasePendulumTransferEngine implements Stage { } private addNote(ctx: QuoteContext, computation: PendulumTransferComputation): void { - if (computation.type === "xcm") { - const xcmData = computation.data as XcmMeta; - ctx.addNote?.( - `Calculated XCM transfer with ${xcmData.xcmFees.origin.amount} ${xcmData.xcmFees.origin.currency} origin fee and ${xcmData.xcmFees.destination.amount} ${xcmData.xcmFees.destination.currency} destination fee` - ); - } else { - const stellarData = computation.data as StellarMeta; - ctx.addNote?.( - `Calculated Stellar transfer with amount ${stellarData.inputAmountDecimal.toString()} ${stellarData.currency}` - ); - } + const xcmData = computation.data; + ctx.addNote?.( + `Calculated XCM transfer with ${xcmData.xcmFees.origin.amount} ${xcmData.xcmFees.origin.currency} origin fee and ${xcmData.xcmFees.destination.amount} ${xcmData.xcmFees.destination.currency} destination fee` + ); } } diff --git a/apps/api/src/api/services/quote/engines/pendulum-transfers/offramp-stellar.ts b/apps/api/src/api/services/quote/engines/pendulum-transfers/offramp-stellar.ts deleted file mode 100644 index 4682f2f97..000000000 --- a/apps/api/src/api/services/quote/engines/pendulum-transfers/offramp-stellar.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { RampDirection } from "@vortexfi/shared"; -import Big from "big.js"; -import { QuoteContext, StellarMeta } from "../../core/types"; -import { BasePendulumTransferEngine, PendulumTransferComputation, PendulumTransferConfig } from "./index"; - -export class OffRampToStellarPendulumTransferEngine extends BasePendulumTransferEngine { - readonly config: PendulumTransferConfig = { - direction: RampDirection.SELL, - skipNote: - "OffRampToStellarPendulumTransferEngine: Skipped because rampType is BUY, this engine handles SELL operations only" - }; - - protected validate(ctx: QuoteContext): void { - if (!ctx.nablaSwap) { - throw new Error( - "OffRampToStellarPendulumTransferEngine: Missing nablaSwap in context - ensure nabla-swap stage ran successfully" - ); - } - - if (!ctx.subsidy) { - throw new Error( - "OffRampToStellarPendulumTransferEngine: Missing subsidy in context - ensure subsidy calculation ran successfully" - ); - } - } - - protected async compute(ctx: QuoteContext): Promise { - // biome-ignore lint/style/noNonNullAssertion: Context is validated in validate - const nablaSwap = ctx.nablaSwap!; - - const fee = new Big(0); // The fee is not paid in the token being transferred - - // Trim the amounts to 2 decimals as higher precision is irrelevant for the fiat anchors - const inputAmountDecimal = this.mergeSubsidy(ctx, new Big(nablaSwap.outputAmountDecimal)).round(2, Big.roundDown); - const inputAmountRaw = inputAmountDecimal.mul(new Big(10).pow(nablaSwap.outputDecimals)).toFixed(0, 0); - - const stellarData: StellarMeta = { - currency: nablaSwap.outputCurrency, - fee, - inputAmountDecimal, - inputAmountRaw, - // The fees are not paid in the token being transferred, so amountOut = amountIn - outputAmountDecimal: inputAmountDecimal, - outputAmountRaw: inputAmountRaw - }; - - return { - data: stellarData, - type: "stellar" - }; - } - - protected assign(ctx: QuoteContext, computation: PendulumTransferComputation): void { - ctx.pendulumToStellar = computation.data as StellarMeta; - } -} diff --git a/apps/api/src/api/services/quote/engines/squidrouter/index.test.ts b/apps/api/src/api/services/quote/engines/squidrouter/index.test.ts new file mode 100644 index 000000000..659fbf89d --- /dev/null +++ b/apps/api/src/api/services/quote/engines/squidrouter/index.test.ts @@ -0,0 +1,60 @@ +import {describe, expect, it, mock} from "bun:test"; +import {EvmToken, Networks, RampDirection} from "@vortexfi/shared"; +import Big from "big.js"; +import {QuoteContext} from "../../core/types"; + +const BSC_USDT_OUTPUT_RAW = "4817805726163073314321"; + +mock.module("../../core/squidrouter", () => ({ + calculateEvmBridgeAndNetworkFee: mock(async () => ({ + finalEffectiveExchangeRate: "1", + finalGrossOutputAmountDecimal: new Big("4817.805726163073314321"), + finalGrossOutputAmountRaw: BSC_USDT_OUTPUT_RAW, + networkFeeUSD: "0.061741", + outputTokenDecimals: 18 + })) +})); + +const { BaseSquidRouterEngine } = await import("./index"); + +class TestSquidRouterEngine extends BaseSquidRouterEngine { + readonly config = { + direction: RampDirection.BUY, + skipNote: "skip" + } as const; + + protected validate(): void {} + + protected compute() { + return { + data: { + amountRaw: "4817744605", + fromNetwork: Networks.Base, + fromToken: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" as const, + inputAmountDecimal: new Big("4817.744605"), + inputAmountRaw: "4817744605", + outputDecimals: 6, + toNetwork: Networks.BSC, + toToken: "0x55d398326f99059fF775485246999027B3197955" as const + }, + type: "evm-to-evm" as const + }; + } +} + +describe("BaseSquidRouterEngine", () => { + it("stores Squid destination raw output instead of rebuilding it with source decimals", async () => { + const ctx = { + addNote: mock(() => undefined), + request: { + outputCurrency: EvmToken.USDT, + rampType: RampDirection.BUY + } + } as unknown as QuoteContext; + + await new TestSquidRouterEngine().execute(ctx); + + expect(ctx.evmToEvm?.outputAmountDecimal.toFixed()).toBe("4817.805726163073314321"); + expect(ctx.evmToEvm?.outputAmountRaw).toBe(BSC_USDT_OUTPUT_RAW); + }); +}); diff --git a/apps/api/src/api/services/quote/engines/squidrouter/index.ts b/apps/api/src/api/services/quote/engines/squidrouter/index.ts index 4c0dd63e2..c6885283e 100644 --- a/apps/api/src/api/services/quote/engines/squidrouter/index.ts +++ b/apps/api/src/api/services/quote/engines/squidrouter/index.ts @@ -50,6 +50,7 @@ export abstract class BaseSquidRouterEngine implements Stage { const passthroughResult: EvmBridgeResult = { finalEffectiveExchangeRate: "1", finalGrossOutputAmountDecimal: computation.data.inputAmountDecimal, + finalGrossOutputAmountRaw: computation.data.inputAmountRaw, networkFeeUSD: "0", outputTokenDecimals: computation.data.outputDecimals }; @@ -110,9 +111,7 @@ export abstract class BaseSquidRouterEngine implements Stage { inputAmountRaw: data.inputAmountRaw, networkFeeUSD: bridgeResult.networkFeeUSD, outputAmountDecimal: bridgeResult.finalGrossOutputAmountDecimal, - outputAmountRaw: new Big(bridgeResult.finalGrossOutputAmountDecimal) - .times(new Big(10).pow(data.outputDecimals)) - .toFixed(0, 0), + outputAmountRaw: bridgeResult.finalGrossOutputAmountRaw, toNetwork: data.toNetwork, toToken: data.toToken }; diff --git a/apps/api/src/api/services/quote/engines/squidrouter/onramp-base-to-evm.ts b/apps/api/src/api/services/quote/engines/squidrouter/onramp-base-to-evm.ts index eb660dd61..cd5e2af8a 100644 --- a/apps/api/src/api/services/quote/engines/squidrouter/onramp-base-to-evm.ts +++ b/apps/api/src/api/services/quote/engines/squidrouter/onramp-base-to-evm.ts @@ -1,6 +1,7 @@ import { EvmToken, getNetworkFromDestination, + getOnChainTokenDetails, multiplyByPowerOfTen, Networks, OnChainToken, @@ -11,9 +12,10 @@ import httpStatus from "http-status"; import { APIError } from "../../../../errors/api-error"; import { getTokenDetailsForEvmDestination } from "../../core/squidrouter"; import { QuoteContext } from "../../core/types"; +import { isBrlToBrlaBaseDirect, isEurToEurcBaseDirect } from "../../utils"; import { BaseSquidRouterEngine, SquidRouterComputation, SquidRouterConfig } from "./index"; -export class OnRampSquidRouterBrlToEvmEngineBase extends BaseSquidRouterEngine { +export class OnRampSquidRouterToBaseEngine extends BaseSquidRouterEngine { readonly config: SquidRouterConfig = { direction: RampDirection.BUY, skipNote: "OnRampSquidRouterBrlToEvmEngine: Skipped because rampType is SELL, this engine handles BUY operations only" @@ -46,6 +48,56 @@ export class OnRampSquidRouterBrlToEvmEngineBase extends BaseSquidRouterEngine { // biome-ignore lint/style/noNonNullAssertion: Context is validated in validate const nablaSwap = ctx.nablaSwapEvm!; + if (isEurToEurcBaseDirect(ctx.request.inputCurrency, ctx.request.outputCurrency, ctx.request.to)) { + const eurcBaseTokenDetails = getOnChainTokenDetails(Networks.Base, EvmToken.EURC); + if (!eurcBaseTokenDetails || eurcBaseTokenDetails.type !== "evm") { + throw new Error("OnRampSquidRouterToBaseEngine: EURC Base token details not found"); + } + + const inputAmountDecimal = this.mergeSubsidy(ctx, new Big(nablaSwap.outputAmountDecimal)); + const inputAmountRaw = this.mergeSubsidyRaw(ctx, new Big(nablaSwap.outputAmountRaw)).toFixed(0, 0); + + return { + data: { + amountRaw: inputAmountRaw, + fromNetwork: Networks.Base, + fromToken: eurcBaseTokenDetails.erc20AddressSourceChain, + inputAmountDecimal, + inputAmountRaw, + outputDecimals: eurcBaseTokenDetails.decimals, + skipRouteCalculation: true, + toNetwork: Networks.Base, + toToken: eurcBaseTokenDetails.erc20AddressSourceChain + }, + type: "evm-to-evm" + }; + } + + if (isBrlToBrlaBaseDirect(ctx.request.inputCurrency, ctx.request.outputCurrency, ctx.request.to)) { + const brlaBaseTokenDetails = getOnChainTokenDetails(Networks.Base, EvmToken.BRLA); + if (!brlaBaseTokenDetails || brlaBaseTokenDetails.type !== "evm") { + throw new Error("OnRampSquidRouterToBaseEngine: BRLA Base token details not found"); + } + + const inputAmountDecimal = this.mergeSubsidy(ctx, new Big(nablaSwap.outputAmountDecimal)); + const inputAmountRaw = this.mergeSubsidyRaw(ctx, new Big(nablaSwap.outputAmountRaw)).toFixed(0, 0); + + return { + data: { + amountRaw: inputAmountRaw, + fromNetwork: Networks.Base, + fromToken: brlaBaseTokenDetails.erc20AddressSourceChain, + inputAmountDecimal, + inputAmountRaw, + outputDecimals: brlaBaseTokenDetails.decimals, + skipRouteCalculation: true, + toNetwork: Networks.Base, + toToken: brlaBaseTokenDetails.erc20AddressSourceChain + }, + type: "evm-to-evm" + }; + } + const usdFeesDistributedDecimal = Big(usdFees.network).plus(usdFees.vortex).plus(usdFees.partnerMarkup); const usdFeesDistributedRaw = multiplyByPowerOfTen(usdFeesDistributedDecimal, nablaSwap.outputDecimals); diff --git a/apps/api/src/api/services/quote/engines/squidrouter/onramp-polygon-to-evm.ts b/apps/api/src/api/services/quote/engines/squidrouter/onramp-polygon-to-evm.ts deleted file mode 100644 index 8764edc9a..000000000 --- a/apps/api/src/api/services/quote/engines/squidrouter/onramp-polygon-to-evm.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { ERC20_EURE_POLYGON_V1, getNetworkFromDestination, Networks, OnChainToken, RampDirection } from "@vortexfi/shared"; -import httpStatus from "http-status"; -import { APIError } from "../../../../errors/api-error"; -import { getTokenDetailsForEvmDestination } from "../../core/squidrouter"; -import { QuoteContext } from "../../core/types"; -import { BaseSquidRouterEngine, SquidRouterComputation, SquidRouterConfig } from "./index"; - -export class OnRampSquidRouterEurToEvmEngine extends BaseSquidRouterEngine { - readonly config: SquidRouterConfig = { - direction: RampDirection.BUY, - skipNote: "OnRampSquidRouterEurToEvmEngine: Skipped because rampType is SELL, this engine handles BUY operations only" - }; - - protected validate(ctx: QuoteContext): void { - if (ctx.request.to === "assethub") { - throw new Error( - "OnRampSquidRouterEurToEvmEngine: Skipped because destination is assethub, this engine handles EVM destinations only" - ); - } - - if (!ctx.moneriumMint?.outputAmountDecimal) { - throw new Error( - "OnRampSquidRouterEurToEvmEngine: Missing moneriumMint.amountOut in context - ensure initialize stage ran successfully" - ); - } - } - - protected compute(ctx: QuoteContext): SquidRouterComputation { - const req = ctx.request; - const toNetwork = getNetworkFromDestination(req.to); - if (!toNetwork) { - throw new APIError({ - message: `Invalid network for destination: ${req.to} `, - status: httpStatus.BAD_REQUEST - }); - } - - const toToken = getTokenDetailsForEvmDestination(req.outputCurrency as OnChainToken, req.to); - const toTokenAddress = toToken.erc20AddressSourceChain; - // biome-ignore lint/style/noNonNullAssertion: Context is validated in validate - const moneriumMint = ctx.moneriumMint!; - - return { - data: { - amountRaw: moneriumMint.outputAmountRaw, - fromNetwork: Networks.Polygon, - fromToken: ERC20_EURE_POLYGON_V1, - inputAmountDecimal: moneriumMint.outputAmountDecimal, - inputAmountRaw: moneriumMint.outputAmountRaw, - outputDecimals: toToken.decimals, - toNetwork, - toToken: toTokenAddress - }, - type: "evm-to-evm" - }; - } -} diff --git a/apps/api/src/api/services/quote/engines/squidrouter/onramp-polygon-to-moonbeam.ts b/apps/api/src/api/services/quote/engines/squidrouter/onramp-polygon-to-moonbeam.ts deleted file mode 100644 index 3c87d24ea..000000000 --- a/apps/api/src/api/services/quote/engines/squidrouter/onramp-polygon-to-moonbeam.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { AXL_USDC_MOONBEAM_DETAILS, ERC20_EURE_POLYGON_V1, Networks, RampDirection } from "@vortexfi/shared"; -import { QuoteContext } from "../../core/types"; -import { BaseSquidRouterEngine, SquidRouterComputation, SquidRouterConfig } from "./index"; - -export class OnRampSquidRouterEurToAssetHubEngine extends BaseSquidRouterEngine { - readonly config: SquidRouterConfig = { - direction: RampDirection.BUY, - skipNote: "OnRampSquidRouterEurToAssetHubEngine: Skipped because rampType is SELL, this engine handles BUY operations only" - }; - - protected validate(ctx: QuoteContext): void { - if (ctx.request.to !== "assethub") { - throw new Error( - "OnRampSquidRouterEurToAssetHubEngine: Skipped because destination is not assethub, this engine handles assethub destinations only" - ); - } - - if (!ctx.moneriumMint) { - throw new Error( - "OnRampSquidRouterEurToAssetHubEngine: Missing moneriumMint in context - ensure initialize stage ran successfully" - ); - } - } - - protected compute(ctx: QuoteContext): SquidRouterComputation { - // biome-ignore lint/style/noNonNullAssertion: Context is validated in validate - const moneriumMint = ctx.moneriumMint!; - - const toToken = AXL_USDC_MOONBEAM_DETAILS; - const toTokenAddress = toToken.erc20AddressSourceChain; - - return { - data: { - amountRaw: moneriumMint.outputAmountRaw, - fromNetwork: Networks.Polygon, - fromToken: ERC20_EURE_POLYGON_V1, - inputAmountDecimal: moneriumMint.outputAmountDecimal, - inputAmountRaw: moneriumMint.outputAmountRaw, - outputDecimals: toToken.decimals, - toNetwork: Networks.Moonbeam, - toToken: toTokenAddress - }, - type: "evm-to-moonbeam" - }; - } -} diff --git a/apps/api/src/api/services/quote/index.ts b/apps/api/src/api/services/quote/index.ts index 29b0c6a3f..094354f82 100644 --- a/apps/api/src/api/services/quote/index.ts +++ b/apps/api/src/api/services/quote/index.ts @@ -15,15 +15,22 @@ import Big from "big.js"; import httpStatus from "http-status"; import pLimit from "p-limit"; import logger from "../../../config/logger"; -import Partner from "../../../models/partner.model"; +import { config } from "../../../config/vars"; import { APIError } from "../../errors/api-error"; import { BaseRampService } from "../ramp/base.service"; +import { createLowLiquidityQuoteError, isLowLiquidityQuoteError } from "./core/errors"; import { getTargetFiatCurrency, SUPPORTED_CHAINS, validateChainSupport } from "./core/helpers"; +import { resolveQuotePartner } from "./core/partner-resolution"; import { createQuoteContext } from "./core/quote-context"; import { QuoteOrchestrator } from "./core/quote-orchestrator"; import { buildQuoteResponse } from "./engines/finalize"; import { RouteResolver } from "./routes/route-resolver"; +type BestQuoteFailure = { + error: unknown; + network: Networks; +}; + export class QuoteService extends BaseRampService { public async createQuote( request: CreateQuoteRequest & { apiKey?: string | null; partnerName?: string | null; userId?: string } @@ -38,6 +45,10 @@ export class QuoteService extends BaseRampService { return null; } + if (quote.flowVariant !== config.flowVariant) { + return null; + } + return buildQuoteResponse(quote); } @@ -49,14 +60,22 @@ export class QuoteService extends BaseRampService { public async createBestQuote( request: CreateBestQuoteRequest & { apiKey?: string | null; partnerName?: string | null; userId?: string } ): Promise { - const { rampType, from, to } = request; + const { rampType, from, to, networks } = request; // Determine eligible networks based on the corridor - const eligibleNetworks = this.getEligibleNetworks(rampType, from, to); + const allEligibleNetworks = this.getEligibleNetworks(rampType, from, to); + + // Apply optional client-provided whitelist (empty array is treated as "no whitelist") + const eligibleNetworks = + networks && networks.length > 0 ? allEligibleNetworks.filter(network => networks.includes(network)) : allEligibleNetworks; if (eligibleNetworks.length === 0) { + const message = + networks && networks.length > 0 + ? `No eligible networks found for ${rampType} from ${from} to ${to} within the requested networks: ${networks.join(", ")}` + : `No eligible networks found for ${rampType} from ${from} to ${to}`; throw new APIError({ - message: `No eligible networks found for ${rampType} from ${from} to ${to}`, + message, status: httpStatus.BAD_REQUEST }); } @@ -88,15 +107,22 @@ export class QuoteService extends BaseRampService { return { network, quote }; } catch (error) { logger.warn(`Failed to get quote for network ${network}: ${error instanceof Error ? error.message : String(error)}`); - return null; + return { error, network }; } }) ); const quoteResults = await Promise.all(quotePromises); - const validQuotes = quoteResults.filter((result): result is { network: Networks; quote: QuoteResponse } => result !== null); + const validQuotes = quoteResults.filter( + (result): result is { network: Networks; quote: QuoteResponse } => "quote" in result + ); if (validQuotes.length === 0) { + const failures = quoteResults.filter((result): result is BestQuoteFailure => "error" in result); + if (failures.length > 0 && failures.every(failure => isLowLiquidityQuoteError(failure.error))) { + throw createLowLiquidityQuoteError(); + } + throw new APIError({ message: QuoteError.FailedToCalculateQuote, status: httpStatus.INTERNAL_SERVER_ERROR @@ -139,22 +165,8 @@ export class QuoteService extends BaseRampService { throw new APIError({ message: QuoteError.FailedToCalculateQuote, status: httpStatus.INTERNAL_SERVER_ERROR }); } - let partner = null; - const partnerNameToUse = request.partnerId || request.partnerName; - - if (partnerNameToUse) { - partner = await Partner.findOne({ - where: { - isActive: true, - name: partnerNameToUse, - rampType: request.rampType - } - }); - - if (!partner) { - logger.warn(`Partner with name '${partnerNameToUse}' not found or not active. Proceeding with default fees.`); - } - } + const resolvedPartner = await resolveQuotePartner(request); + const partner = resolvedPartner.partner; if (partner && partner.markupType !== "none" && partner.payoutAddressEvm === null && requiresEvmPartnerPayout(request)) { logger.error( @@ -179,6 +191,9 @@ export class QuoteService extends BaseRampService { targetDiscount: partner.targetDiscount } : { id: null }, + partnerOwnerId: resolvedPartner.ownerPartnerId, + partnerPricingSource: resolvedPartner.source, + pricingPartnerId: resolvedPartner.pricingPartnerId, request: { ...request, apiKey: request.apiKey || undefined }, targetFeeFiatCurrency }); @@ -202,15 +217,13 @@ export class QuoteService extends BaseRampService { throw error; } + if (isLowLiquidityQuoteError(error)) { + throw createLowLiquidityQuoteError(); + } + // Detect Alfredpay trade limit error and surface it as a user-facing limit error if (error instanceof AlfredpayTradeLimitError) { - const isOnramp = ctx.request.rampType === RampDirection.BUY; - throw new APIError({ - message: isOnramp - ? `${QuoteError.BelowLowerLimitBuy} ${error.minQuantity} ${error.fromCurrency}` - : `${QuoteError.BelowLowerLimitSell} ${error.minQuantity} ${error.fromCurrency}`, - status: httpStatus.BAD_REQUEST - }); + throw mapAlfredpayLimitErrorToApiError(error, ctx.request.rampType === RampDirection.BUY); } // Wrap unexpected errors as generic failure @@ -252,6 +265,21 @@ export class QuoteService extends BaseRampService { } } +function mapAlfredpayLimitErrorToApiError(error: AlfredpayTradeLimitError, isOnramp: boolean): APIError { + const prefix = selectAlfredpayLimitPrefix(error.kind === "above", isOnramp); + return new APIError({ + message: `${prefix} ${error.quantity} ${error.fromCurrency}`, + status: httpStatus.BAD_REQUEST + }); +} + +function selectAlfredpayLimitPrefix(isAboveMax: boolean, isOnramp: boolean): QuoteError { + if (isAboveMax && isOnramp) return QuoteError.AboveUpperLimitBuy; + if (isAboveMax) return QuoteError.AboveUpperLimitSell; + if (isOnramp) return QuoteError.BelowLowerLimitBuy; + return QuoteError.BelowLowerLimitSell; +} + function requiresEvmPartnerPayout(request: CreateQuoteRequest): boolean { if (request.rampType === RampDirection.SELL && request.outputCurrency === FiatToken.BRL) { const fromNetwork = getNetworkFromDestination(request.from); diff --git a/apps/api/src/api/services/quote/routes/route-definition.ts b/apps/api/src/api/services/quote/routes/route-definition.ts index 75e2754db..c851e33e7 100644 --- a/apps/api/src/api/services/quote/routes/route-definition.ts +++ b/apps/api/src/api/services/quote/routes/route-definition.ts @@ -20,18 +20,3 @@ export function defineRouteStrategy(definition: RouteDefinition): IRouteStrategy name: definition.name }; } - -export function withHydrationForNonUsdc(stages: readonly StageKey[]): StageListFactory { - return ctx => { - if (ctx.request.outputCurrency === "USDC") { - return [...stages]; - } - - const finalizeIndex = stages.indexOf(StageKey.Finalize); - if (finalizeIndex === -1) { - return [...stages, StageKey.HydrationSwap]; - } - - return [...stages.slice(0, finalizeIndex), StageKey.HydrationSwap, ...stages.slice(finalizeIndex)]; - }; -} diff --git a/apps/api/src/api/services/quote/routes/route-resolver.test.ts b/apps/api/src/api/services/quote/routes/route-resolver.test.ts new file mode 100644 index 000000000..d50934d74 --- /dev/null +++ b/apps/api/src/api/services/quote/routes/route-resolver.test.ts @@ -0,0 +1,61 @@ +import {describe, expect, it} from "bun:test"; +import {AssetHubToken, EPaymentMethod, FiatToken, Networks, RampDirection} from "@vortexfi/shared"; +import {APIError} from "../../../errors/api-error"; +import {createQuoteContext} from "../core/quote-context"; +import {RouteResolver} from "./route-resolver"; + +describe("RouteResolver", () => { + it("rejects AssetHub to CBU before creating an unexecutable Alfredpay quote", () => { + const ctx = createQuoteContext({ + partner: null, + request: { + from: Networks.AssetHub, + inputAmount: "100", + inputCurrency: AssetHubToken.USDC, + network: Networks.AssetHub, + outputCurrency: FiatToken.ARS, + rampType: RampDirection.SELL, + to: EPaymentMethod.CBU + }, + targetFeeFiatCurrency: FiatToken.ARS + }); + + expect(() => new RouteResolver().resolve(ctx)).toThrow(APIError); + }); + + it("rejects BRL onramp to non-USDC AssetHub before selecting the disabled Hydration route", () => { + const ctx = createQuoteContext({ + partner: null, + request: { + from: EPaymentMethod.PIX, + inputAmount: "100", + inputCurrency: FiatToken.BRL, + network: Networks.AssetHub, + outputCurrency: AssetHubToken.USDT, + rampType: RampDirection.BUY, + to: Networks.AssetHub + }, + targetFeeFiatCurrency: FiatToken.BRL + }); + + expect(() => new RouteResolver().resolve(ctx)).toThrow(APIError); + }); + + it("keeps BRL onramp to AssetHub USDC available", () => { + const ctx = createQuoteContext({ + partner: null, + request: { + from: EPaymentMethod.PIX, + inputAmount: "100", + inputCurrency: FiatToken.BRL, + network: Networks.AssetHub, + outputCurrency: AssetHubToken.USDC, + rampType: RampDirection.BUY, + to: Networks.AssetHub + }, + targetFeeFiatCurrency: FiatToken.BRL + }); + + expect(new RouteResolver().resolve(ctx).name).toBe("OnRampAveniaToAssetHub"); + }); +}); diff --git a/apps/api/src/api/services/quote/routes/route-resolver.ts b/apps/api/src/api/services/quote/routes/route-resolver.ts index a581ee6ad..5048b4c0c 100644 --- a/apps/api/src/api/services/quote/routes/route-resolver.ts +++ b/apps/api/src/api/services/quote/routes/route-resolver.ts @@ -17,14 +17,18 @@ import { IRouteStrategy } from "../core/types"; import { offrampEvmToAlfredpayStrategy } from "./strategies/offramp-evm-to-alfredpay.strategy"; import { offrampToPixStrategy } from "./strategies/offramp-to-pix.strategy"; import { offrampToPixEvmStrategy } from "./strategies/offramp-to-pix-base.strategy"; -import { offrampToStellarStrategy } from "./strategies/offramp-to-stellar.strategy"; +import { offrampToSepaEvmStrategy } from "./strategies/offramp-to-sepa-evm.strategy"; import { onrampAlfredpayToEvmStrategy } from "./strategies/onramp-alfredpay-to-evm.strategy"; import { onrampAveniaToAssethubStrategy } from "./strategies/onramp-avenia-to-assethub.strategy"; import { onrampAveniaToEvmBaseStrategy } from "./strategies/onramp-avenia-to-evm.strategy-base"; -import { onrampMoneriumToAssethubStrategy } from "./strategies/onramp-monerium-to-assethub.strategy"; -import { onrampMoneriumToEvmStrategy } from "./strategies/onramp-monerium-to-evm.strategy"; +import { onrampMykoboToEvmStrategy } from "./strategies/onramp-mykobo-to-evm.strategy"; -const ALFREDPAY_PAYMENT_METHODS: ReadonlySet = new Set([EPaymentMethod.ACH, EPaymentMethod.SPEI, EPaymentMethod.WIRE]); +const ALFREDPAY_PAYMENT_METHODS: ReadonlySet = new Set([ + EPaymentMethod.ACH, + EPaymentMethod.CBU, + EPaymentMethod.SPEI, + EPaymentMethod.WIRE +]); export class RouteResolver { resolve(ctx: QuoteContext): IRouteStrategy { @@ -34,14 +38,19 @@ export class RouteResolver { if (isAlfredpayToken(ctx.request.inputCurrency as FiatToken)) { throw new APIError({ message: QuoteError.AssetHubNotSupportedForAlfredPay, status: httpStatus.BAD_REQUEST }); } - if (ctx.from === "pix") { - return onrampAveniaToAssethubStrategy; - } else { - return onrampMoneriumToAssethubStrategy; + if (ctx.request.inputCurrency === FiatToken.EURC) { + throw new APIError({ + message: "EUR onramp to AssetHub is not supported; please choose an EVM destination chain", + status: httpStatus.BAD_REQUEST + }); + } + if (ctx.request.outputCurrency !== AssetHubToken.USDC) { + throw new APIError({ message: QuoteError.UnsupportedCurrency, status: httpStatus.BAD_REQUEST }); } + return onrampAveniaToAssethubStrategy; } else { if (ctx.request.inputCurrency === FiatToken.EURC) { - return onrampMoneriumToEvmStrategy; + return onrampMykoboToEvmStrategy; } else if (isAlfredpayToken(ctx.request.inputCurrency as FiatToken)) { return onrampAlfredpayToEvmStrategy; } else { @@ -70,11 +79,12 @@ export class RouteResolver { case "wire": case "ach": case "spei": + case "cbu": return offrampEvmToAlfredpayStrategy; case "sepa": - case "cbu": + return offrampToSepaEvmStrategy; default: - return offrampToStellarStrategy; + throw new APIError({ message: `Unsupported offramp payment method: ${ctx.to}`, status: httpStatus.BAD_REQUEST }); } } } diff --git a/apps/api/src/api/services/quote/routes/strategies/offramp-evm-to-alfredpay.strategy.ts b/apps/api/src/api/services/quote/routes/strategies/offramp-evm-to-alfredpay.strategy.ts index ecce16594..6dccd0a8c 100644 --- a/apps/api/src/api/services/quote/routes/strategies/offramp-evm-to-alfredpay.strategy.ts +++ b/apps/api/src/api/services/quote/routes/strategies/offramp-evm-to-alfredpay.strategy.ts @@ -1,16 +1,15 @@ -import { Networks } from "@vortexfi/shared"; import { StageKey } from "../../core/types"; import { OffRampAlfredpayDiscountEngine } from "../../engines/discount/offramp-alfredpay"; import { OffRampEvmToAlfredpayFeeEngine } from "../../engines/fee/offramp-evm-to-alfredpay"; import { OffRampFinalizeEngine } from "../../engines/finalize/offramp"; -import { OffRampFromEvmInitializeEngine } from "../../engines/initialize/offramp-from-evm-alfredpay"; +import { OffRampFromEvmInitializeAlfredpayEngine } from "../../engines/initialize/offramp-from-evm-alfredpay"; import { OfframpTransactionAlfredpayEngine } from "../../engines/partners/offramp-alfredpay"; import { defineRouteStrategy } from "../route-definition"; export const offrampEvmToAlfredpayStrategy = defineRouteStrategy({ engines: () => ({ - [StageKey.Initialize]: new OffRampFromEvmInitializeEngine(Networks.Polygon), + [StageKey.Initialize]: new OffRampFromEvmInitializeAlfredpayEngine(), [StageKey.Fee]: new OffRampEvmToAlfredpayFeeEngine(), [StageKey.Discount]: new OffRampAlfredpayDiscountEngine(), [StageKey.PartnerOperation]: new OfframpTransactionAlfredpayEngine(), diff --git a/apps/api/src/api/services/quote/routes/strategies/offramp-to-pix-base.strategy.ts b/apps/api/src/api/services/quote/routes/strategies/offramp-to-pix-base.strategy.ts index c98b6d0fd..b6815d509 100644 --- a/apps/api/src/api/services/quote/routes/strategies/offramp-to-pix-base.strategy.ts +++ b/apps/api/src/api/services/quote/routes/strategies/offramp-to-pix-base.strategy.ts @@ -1,16 +1,16 @@ -import { EvmToken, Networks } from "@vortexfi/shared"; +import { EvmToken } from "@vortexfi/shared"; import { StageKey } from "../../core/types"; import { OffRampDiscountEngine } from "../../engines/discount/offramp"; import { OffRampFeeAveniaEngine } from "../../engines/fee/offramp-avenia"; import { OffRampFinalizeEngine } from "../../engines/finalize/offramp"; -import { OffRampFromEvmInitializeEngine } from "../../engines/initialize/offramp-from-evm-alfredpay"; +import { OffRampFromEvmInitializeAveniaEngine } from "../../engines/initialize/offramp-from-evm-avenia"; import { OffRampMergeSubsidyEvmEngine } from "../../engines/merge-subsidy/offramp-evm"; import { OffRampSwapEngineEvm } from "../../engines/nabla-swap/offramp-evm"; import { defineRouteStrategy } from "../route-definition"; export const offrampToPixEvmStrategy = defineRouteStrategy({ engines: () => ({ - [StageKey.Initialize]: new OffRampFromEvmInitializeEngine(Networks.Base), + [StageKey.Initialize]: new OffRampFromEvmInitializeAveniaEngine(), [StageKey.NablaSwap]: new OffRampSwapEngineEvm(EvmToken.BRLA), [StageKey.Fee]: new OffRampFeeAveniaEngine(), [StageKey.Discount]: new OffRampDiscountEngine(), diff --git a/apps/api/src/api/services/quote/routes/strategies/offramp-to-sepa-evm.strategy.ts b/apps/api/src/api/services/quote/routes/strategies/offramp-to-sepa-evm.strategy.ts new file mode 100644 index 000000000..97d2ddf6d --- /dev/null +++ b/apps/api/src/api/services/quote/routes/strategies/offramp-to-sepa-evm.strategy.ts @@ -0,0 +1,22 @@ +import { EvmToken } from "@vortexfi/shared"; +import { StageKey } from "../../core/types"; +import { OffRampDiscountEngine } from "../../engines/discount/offramp"; +import { OffRampFeeMykoboEngine } from "../../engines/fee/offramp-mykobo"; +import { OffRampFinalizeEngine } from "../../engines/finalize/offramp"; +import { OffRampFromEvmInitializeMykoboEngine } from "../../engines/initialize/offramp-from-evm-mykobo"; +import { OffRampMergeSubsidyEvmEngine } from "../../engines/merge-subsidy/offramp-evm"; +import { OffRampSwapEngineEvm } from "../../engines/nabla-swap/offramp-evm"; +import { defineRouteStrategy } from "../route-definition"; + +export const offrampToSepaEvmStrategy = defineRouteStrategy({ + engines: () => ({ + [StageKey.Initialize]: new OffRampFromEvmInitializeMykoboEngine(), + [StageKey.NablaSwap]: new OffRampSwapEngineEvm(EvmToken.EURC), + [StageKey.Fee]: new OffRampFeeMykoboEngine(), + [StageKey.Discount]: new OffRampDiscountEngine(), + [StageKey.MergeSubsidy]: new OffRampMergeSubsidyEvmEngine(), + [StageKey.Finalize]: new OffRampFinalizeEngine() + }), + name: "OfframpToSepaEvm", + stages: [StageKey.Initialize, StageKey.NablaSwap, StageKey.Fee, StageKey.Discount, StageKey.MergeSubsidy, StageKey.Finalize] +}); diff --git a/apps/api/src/api/services/quote/routes/strategies/offramp-to-stellar.strategy.ts b/apps/api/src/api/services/quote/routes/strategies/offramp-to-stellar.strategy.ts deleted file mode 100644 index edb3e1f78..000000000 --- a/apps/api/src/api/services/quote/routes/strategies/offramp-to-stellar.strategy.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { StageKey } from "../../core/types"; -import { OffRampDiscountEngine } from "../../engines/discount/offramp"; -import { OffRampFeeStellarEngine } from "../../engines/fee/offramp-stellar"; -import { OffRampFinalizeEngine } from "../../engines/finalize/offramp"; -import { OffRampFromAssethubInitializeEngine } from "../../engines/initialize/offramp-from-assethub"; -import { OffRampFromEvmInitializeEngineMoonbeam } from "../../engines/initialize/offramp-from-evm"; -import { OffRampSwapEngine } from "../../engines/nabla-swap/offramp"; -import { OffRampToStellarPendulumTransferEngine } from "../../engines/pendulum-transfers/offramp-stellar"; -import { defineRouteStrategy } from "../route-definition"; - -export const offrampToStellarStrategy = defineRouteStrategy({ - engines: ctx => ({ - [StageKey.Initialize]: - ctx.request.from === "assethub" - ? new OffRampFromAssethubInitializeEngine() - : new OffRampFromEvmInitializeEngineMoonbeam(), - [StageKey.NablaSwap]: new OffRampSwapEngine(), - [StageKey.Fee]: new OffRampFeeStellarEngine(), - [StageKey.Discount]: new OffRampDiscountEngine(), - [StageKey.PendulumTransfer]: new OffRampToStellarPendulumTransferEngine(), - [StageKey.Finalize]: new OffRampFinalizeEngine() - }), - name: "OffRampStellar", - stages: [ - StageKey.Initialize, - StageKey.NablaSwap, - StageKey.Fee, - StageKey.Discount, - StageKey.PendulumTransfer, - StageKey.Finalize - ] -}); diff --git a/apps/api/src/api/services/quote/routes/strategies/onramp-avenia-to-assethub.strategy.ts b/apps/api/src/api/services/quote/routes/strategies/onramp-avenia-to-assethub.strategy.ts index f4eda2aea..3073da78d 100644 --- a/apps/api/src/api/services/quote/routes/strategies/onramp-avenia-to-assethub.strategy.ts +++ b/apps/api/src/api/services/quote/routes/strategies/onramp-avenia-to-assethub.strategy.ts @@ -2,11 +2,10 @@ import { StageKey } from "../../core/types"; import { OnRampDiscountEngine } from "../../engines/discount/onramp"; import { OnRampAveniaToAssethubFeeEngine } from "../../engines/fee/onramp-brl-to-assethub"; import { OnRampFinalizeEngine } from "../../engines/finalize/onramp"; -import { OnRampHydrationEngine } from "../../engines/hydration/onramp"; import { OnRampInitializeAveniaEngine } from "../../engines/initialize/onramp-avenia"; import { OnRampSwapEngine } from "../../engines/nabla-swap/onramp"; import { OnRampPendulumTransferEngine } from "../../engines/pendulum-transfers/onramp"; -import { defineRouteStrategy, withHydrationForNonUsdc } from "../route-definition"; +import { defineRouteStrategy } from "../route-definition"; export const onrampAveniaToAssethubStrategy = defineRouteStrategy({ engines: () => ({ @@ -15,16 +14,15 @@ export const onrampAveniaToAssethubStrategy = defineRouteStrategy({ [StageKey.NablaSwap]: new OnRampSwapEngine(), [StageKey.Discount]: new OnRampDiscountEngine(), [StageKey.PendulumTransfer]: new OnRampPendulumTransferEngine(), - [StageKey.HydrationSwap]: new OnRampHydrationEngine(), [StageKey.Finalize]: new OnRampFinalizeEngine() }), name: "OnRampAveniaToAssetHub", - stages: withHydrationForNonUsdc([ + stages: [ StageKey.Initialize, StageKey.Fee, StageKey.NablaSwap, StageKey.Discount, StageKey.PendulumTransfer, StageKey.Finalize - ]) + ] }); diff --git a/apps/api/src/api/services/quote/routes/strategies/onramp-avenia-to-evm.strategy-base.ts b/apps/api/src/api/services/quote/routes/strategies/onramp-avenia-to-evm.strategy-base.ts index 00f5b6c8a..48e564890 100644 --- a/apps/api/src/api/services/quote/routes/strategies/onramp-avenia-to-evm.strategy-base.ts +++ b/apps/api/src/api/services/quote/routes/strategies/onramp-avenia-to-evm.strategy-base.ts @@ -5,7 +5,7 @@ import { OnRampAveniaToEvmFeeEngine } from "../../engines/fee/onramp-brl-to-evm" import { OnRampFinalizeEngine } from "../../engines/finalize/onramp"; import { OnRampInitializeAveniaEngine } from "../../engines/initialize/onramp-avenia"; import { OnRampSwapEngineEvm } from "../../engines/nabla-swap/onramp-evm"; -import { OnRampSquidRouterBrlToEvmEngineBase } from "../../engines/squidrouter/onramp-base-to-evm"; +import { OnRampSquidRouterToBaseEngine } from "../../engines/squidrouter/onramp-base-to-evm"; import { defineRouteStrategy } from "../route-definition"; export const onrampAveniaToEvmBaseStrategy = defineRouteStrategy({ @@ -14,7 +14,7 @@ export const onrampAveniaToEvmBaseStrategy = defineRouteStrategy({ [StageKey.Fee]: new OnRampAveniaToEvmFeeEngine(Networks.Base, EvmToken.USDC), [StageKey.NablaSwap]: new OnRampSwapEngineEvm(), [StageKey.Discount]: new OnRampDiscountEngine(), - [StageKey.SquidRouter]: new OnRampSquidRouterBrlToEvmEngineBase(), + [StageKey.SquidRouter]: new OnRampSquidRouterToBaseEngine(), [StageKey.Finalize]: new OnRampFinalizeEngine() }), name: "OnRampAveniaToEvmBase", diff --git a/apps/api/src/api/services/quote/routes/strategies/onramp-monerium-to-assethub.strategy.ts b/apps/api/src/api/services/quote/routes/strategies/onramp-monerium-to-assethub.strategy.ts deleted file mode 100644 index b478f9ef9..000000000 --- a/apps/api/src/api/services/quote/routes/strategies/onramp-monerium-to-assethub.strategy.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { StageKey } from "../../core/types"; -import { OnRampDiscountEngine } from "../../engines/discount/onramp"; -import { OnRampMoneriumToAssethubFeeEngine } from "../../engines/fee/onramp-monerium-to-assethub"; -import { OnRampFinalizeEngine } from "../../engines/finalize/onramp"; -import { OnRampHydrationEngine } from "../../engines/hydration/onramp"; -import { OnRampInitializeMoneriumEngine } from "../../engines/initialize/onramp-monerium"; -import { OnRampSwapEngine } from "../../engines/nabla-swap/onramp"; -import { OnRampPendulumTransferEngine } from "../../engines/pendulum-transfers/onramp"; -import { OnRampSquidRouterEurToAssetHubEngine } from "../../engines/squidrouter/onramp-polygon-to-moonbeam"; -import { defineRouteStrategy, withHydrationForNonUsdc } from "../route-definition"; - -export const onrampMoneriumToAssethubStrategy = defineRouteStrategy({ - engines: () => ({ - [StageKey.Initialize]: new OnRampInitializeMoneriumEngine(), - [StageKey.SquidRouter]: new OnRampSquidRouterEurToAssetHubEngine(), - [StageKey.Fee]: new OnRampMoneriumToAssethubFeeEngine(), - [StageKey.NablaSwap]: new OnRampSwapEngine(), - [StageKey.Discount]: new OnRampDiscountEngine(), - [StageKey.PendulumTransfer]: new OnRampPendulumTransferEngine(), - [StageKey.HydrationSwap]: new OnRampHydrationEngine(), - [StageKey.Finalize]: new OnRampFinalizeEngine() - }), - name: "OnRampMoneriumToAssetHub", - stages: withHydrationForNonUsdc([ - StageKey.Initialize, - StageKey.SquidRouter, - StageKey.Fee, - StageKey.NablaSwap, - StageKey.Discount, - StageKey.PendulumTransfer, - StageKey.Finalize - ]) -}); diff --git a/apps/api/src/api/services/quote/routes/strategies/onramp-monerium-to-evm.strategy.ts b/apps/api/src/api/services/quote/routes/strategies/onramp-monerium-to-evm.strategy.ts deleted file mode 100644 index 993d65829..000000000 --- a/apps/api/src/api/services/quote/routes/strategies/onramp-monerium-to-evm.strategy.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { StageKey } from "../../core/types"; -import { OnRampMoneriumToEvmFeeEngine } from "../../engines/fee/onramp-monerium-to-evm"; -import { OnRampFinalizeEngine } from "../../engines/finalize/onramp"; -import { OnRampInitializeMoneriumEngine } from "../../engines/initialize/onramp-monerium"; -import { OnRampSquidRouterEurToEvmEngine } from "../../engines/squidrouter/onramp-polygon-to-evm"; -import { defineRouteStrategy } from "../route-definition"; - -export const onrampMoneriumToEvmStrategy = defineRouteStrategy({ - engines: () => ({ - [StageKey.Initialize]: new OnRampInitializeMoneriumEngine(), - [StageKey.Fee]: new OnRampMoneriumToEvmFeeEngine(), - [StageKey.SquidRouter]: new OnRampSquidRouterEurToEvmEngine(), - [StageKey.Finalize]: new OnRampFinalizeEngine() - }), - name: "OnRampMoneriumToEvm", - stages: [StageKey.Initialize, StageKey.Fee, StageKey.SquidRouter, StageKey.Finalize] -}); diff --git a/apps/api/src/api/services/quote/routes/strategies/onramp-mykobo-to-evm.strategy.ts b/apps/api/src/api/services/quote/routes/strategies/onramp-mykobo-to-evm.strategy.ts new file mode 100644 index 000000000..232def9f7 --- /dev/null +++ b/apps/api/src/api/services/quote/routes/strategies/onramp-mykobo-to-evm.strategy.ts @@ -0,0 +1,22 @@ +import { EvmToken, Networks } from "@vortexfi/shared"; +import { StageKey } from "../../core/types"; +import { OnRampDiscountEngine } from "../../engines/discount/onramp"; +import { OnRampMykoboToEvmFeeEngine } from "../../engines/fee/onramp-mykobo-to-evm"; +import { OnRampFinalizeEngine } from "../../engines/finalize/onramp"; +import { OnRampInitializeMykoboEngine } from "../../engines/initialize/onramp-mykobo"; +import { OnRampSwapEngineMykoboEvm } from "../../engines/nabla-swap/onramp-mykobo-evm"; +import { OnRampSquidRouterToBaseEngine } from "../../engines/squidrouter/onramp-base-to-evm"; +import { defineRouteStrategy } from "../route-definition"; + +export const onrampMykoboToEvmStrategy = defineRouteStrategy({ + engines: () => ({ + [StageKey.Initialize]: new OnRampInitializeMykoboEngine(), + [StageKey.Fee]: new OnRampMykoboToEvmFeeEngine(Networks.Base, EvmToken.EURC), + [StageKey.NablaSwap]: new OnRampSwapEngineMykoboEvm(), + [StageKey.Discount]: new OnRampDiscountEngine(), + [StageKey.SquidRouter]: new OnRampSquidRouterToBaseEngine(), + [StageKey.Finalize]: new OnRampFinalizeEngine() + }), + name: "OnRampMykoboToEvm", + stages: [StageKey.Initialize, StageKey.Fee, StageKey.NablaSwap, StageKey.Discount, StageKey.SquidRouter, StageKey.Finalize] +}); diff --git a/apps/api/src/api/services/quote/utils.ts b/apps/api/src/api/services/quote/utils.ts new file mode 100644 index 000000000..7fa7acae0 --- /dev/null +++ b/apps/api/src/api/services/quote/utils.ts @@ -0,0 +1,18 @@ +import { EvmToken, FiatToken, Networks } from "@vortexfi/shared"; + +export function isEurToEurcBaseDirect(inputCurrency: string, outputCurrency: string, toNetwork: string): boolean { + return inputCurrency === FiatToken.EURC && outputCurrency === EvmToken.EURC && toNetwork === Networks.Base; +} + +export function isBrlToBrlaBaseDirect(inputCurrency: string, outputCurrency: string, toNetwork: string): boolean { + return inputCurrency === FiatToken.BRL && outputCurrency === EvmToken.BRLA && toNetwork === Networks.Base; +} + +// Fiat -> own-stablecoin passthrough on Base (EUR->EURC, BRL->BRLA): the anchor already minted the +// requested stablecoin, so the swap/bridge/subsidy steps are skipped and funds transfer directly. +export function isFiatToOwnStablecoinBaseDirect(inputCurrency: string, outputCurrency: string, toNetwork: string): boolean { + return ( + isEurToEurcBaseDirect(inputCurrency, outputCurrency, toNetwork) || + isBrlToBrlaBaseDirect(inputCurrency, outputCurrency, toNetwork) + ); +} diff --git a/apps/api/src/api/services/ramp/base.service.test.ts b/apps/api/src/api/services/ramp/base.service.test.ts new file mode 100644 index 000000000..384024c87 --- /dev/null +++ b/apps/api/src/api/services/ramp/base.service.test.ts @@ -0,0 +1,95 @@ +import {beforeEach, describe, expect, it, mock} from "bun:test"; +import {Op} from "sequelize"; +import sequelize from "../../../config/database"; +import QuoteTicket from "../../../models/quoteTicket.model"; +import {BaseRampService} from "./base.service"; + +const transaction = { id: "cleanup-test-transaction" }; +const expectedDeleteBatchSize = 5000; + +type QuoteCleanupWhere = { + expiresAt?: { + [Op.lt]?: Date; + }; + id?: { + [Op.in]?: string[]; + }; + status?: string; +}; + +type QuoteCleanupOptions = { + attributes?: string[]; + limit?: number; + order?: string[][]; + transaction?: unknown; + where: QuoteCleanupWhere; +}; + +const transactionMock = mock(async (callback: (tx: unknown) => Promise) => callback(transaction)); +const queryMock = mock(async () => [{ acquired: true }]); +const updateMock = mock(async (_values: unknown, _options: QuoteCleanupOptions) => [3]); +const findAllMock = mock(async (_options: QuoteCleanupOptions) => [{ id: "expired-quote-1" }, { id: "expired-quote-2" }]); +const destroyMock = mock(async (_options: QuoteCleanupOptions) => 2); + +sequelize.transaction = transactionMock as unknown as typeof sequelize.transaction; +sequelize.query = queryMock as unknown as typeof sequelize.query; +QuoteTicket.update = updateMock as unknown as typeof QuoteTicket.update; +QuoteTicket.findAll = findAllMock as unknown as typeof QuoteTicket.findAll; +QuoteTicket.destroy = destroyMock as unknown as typeof QuoteTicket.destroy; + +describe("BaseRampService.cleanupExpiredQuotes", () => { + let service: BaseRampService; + + beforeEach(() => { + service = new BaseRampService(); + transactionMock.mockClear(); + queryMock.mockClear(); + updateMock.mockClear(); + findAllMock.mockClear(); + destroyMock.mockClear(); + queryMock.mockImplementation(async () => [{ acquired: true }]); + updateMock.mockImplementation(async () => [3]); + findAllMock.mockImplementation(async () => [{ id: "expired-quote-1" }, { id: "expired-quote-2" }]); + destroyMock.mockImplementation(async () => 2); + }); + + it("does not update or delete quotes when another cleanup worker holds the advisory lock", async () => { + queryMock.mockImplementation(async () => [{ acquired: false }]); + + const handledCount = await service.cleanupExpiredQuotes(); + + expect(handledCount).toBe(0); + expect(queryMock).toHaveBeenCalledTimes(1); + expect(updateMock).not.toHaveBeenCalled(); + expect(findAllMock).not.toHaveBeenCalled(); + expect(destroyMock).not.toHaveBeenCalled(); + }); + + it("marks expired pending quotes and deletes old expired quotes in a bounded id batch", async () => { + const handledCount = await service.cleanupExpiredQuotes(); + + expect(handledCount).toBe(5); + expect(updateMock).toHaveBeenCalledTimes(1); + expect(findAllMock).toHaveBeenCalledTimes(1); + expect(destroyMock).toHaveBeenCalledTimes(1); + + const updateOptions = updateMock.mock.calls[0][1]; + expect(updateOptions.transaction).toBe(transaction); + expect(updateOptions.where.status).toBe("pending"); + expect(updateOptions.where.expiresAt![Op.lt]).toBeInstanceOf(Date); + + const findOptions = findAllMock.mock.calls[0][0]; + expect(findOptions.attributes).toEqual(["id"]); + expect(findOptions.limit).toBe(expectedDeleteBatchSize); + expect(findOptions.order).toEqual([["expiresAt", "ASC"]]); + expect(findOptions.transaction).toBe(transaction); + expect(findOptions.where.status).toBe("expired"); + expect(findOptions.where.expiresAt![Op.lt]).toBeInstanceOf(Date); + + const destroyOptions = destroyMock.mock.calls[0][0]; + expect(destroyOptions.transaction).toBe(transaction); + expect(destroyOptions.where.id![Op.in]).toEqual(["expired-quote-1", "expired-quote-2"]); + expect(destroyOptions.where.status).toBe("expired"); + expect(destroyOptions.where.expiresAt![Op.lt]).toBeInstanceOf(Date); + }); +}); diff --git a/apps/api/src/api/services/ramp/base.service.ts b/apps/api/src/api/services/ramp/base.service.ts index 86c6ce537..d5ab2e8a5 100644 --- a/apps/api/src/api/services/ramp/base.service.ts +++ b/apps/api/src/api/services/ramp/base.service.ts @@ -1,5 +1,5 @@ import { RampPhase } from "@vortexfi/shared"; -import { Op, Transaction } from "sequelize"; +import { Op, QueryTypes, Transaction } from "sequelize"; import { v4 as uuidv4 } from "uuid"; import sequelize from "../../../config/database"; import logger from "../../../config/logger"; @@ -7,17 +7,45 @@ import QuoteTicket from "../../../models/quoteTicket.model"; import RampState, { RampStateAttributes } from "../../../models/rampState.model"; import { StateMetadata } from "../phases/meta-state-types"; +const EXPIRED_QUOTE_DELETE_BATCH_SIZE = 5000; +const QUOTE_CLEANUP_ADVISORY_LOCK_NAMESPACE = 918521; +const QUOTE_CLEANUP_ADVISORY_LOCK_KEY = 1; + export class BaseRampService { /** * Clean up expired quotes by expiring them or deleting them from the database */ public async cleanupExpiredQuotes(): Promise { + return sequelize.transaction(async transaction => { + const [lock] = await sequelize.query<{ acquired: boolean }>( + "SELECT pg_try_advisory_xact_lock(:namespace, :key) AS acquired", + { + replacements: { + key: QUOTE_CLEANUP_ADVISORY_LOCK_KEY, + namespace: QUOTE_CLEANUP_ADVISORY_LOCK_NAMESPACE + }, + transaction, + type: QueryTypes.SELECT + } + ); + + if (!lock?.acquired) { + logger.info("Skipping expired quote cleanup because another worker holds the cleanup lock"); + return 0; + } + + return this.cleanupExpiredQuotesWithLock(transaction); + }); + } + + private async cleanupExpiredQuotesWithLock(transaction: Transaction): Promise { // Make quotes older than 10 minutes expire - let [count] = await QuoteTicket.update( + const [expiredPendingCount] = await QuoteTicket.update( { status: "expired" }, { + transaction, where: { expiresAt: { [Op.lt]: new Date() @@ -27,18 +55,39 @@ export class BaseRampService { } ); - // Delete quotes that have been expired for more than 60 days - const sixtyDaysAgo = new Date(Date.now() - 60 * 24 * 60 * 60 * 1000); - count += await QuoteTicket.destroy({ + const ninetyDaysAgo = new Date(Date.now() - 90 * 24 * 60 * 60 * 1000); + const expiredQuoteBatch = await QuoteTicket.findAll({ + attributes: ["id"], + limit: EXPIRED_QUOTE_DELETE_BATCH_SIZE, + order: [["expiresAt", "ASC"]], + transaction, where: { expiresAt: { - [Op.lt]: sixtyDaysAgo + [Op.lt]: ninetyDaysAgo }, - status: "pending" + status: "expired" + } + }); + + const expiredQuoteIds = expiredQuoteBatch.map(quote => quote.id); + if (expiredQuoteIds.length === 0) { + return expiredPendingCount; + } + + const deletedExpiredCount = await QuoteTicket.destroy({ + transaction, + where: { + expiresAt: { + [Op.lt]: ninetyDaysAgo + }, + id: { + [Op.in]: expiredQuoteIds + }, + status: "expired" } }); - return count; + return expiredPendingCount + deletedExpiredCount; } /** diff --git a/apps/api/src/api/services/ramp/ephemeral-freshness.test.ts b/apps/api/src/api/services/ramp/ephemeral-freshness.test.ts new file mode 100644 index 000000000..c630b3937 --- /dev/null +++ b/apps/api/src/api/services/ramp/ephemeral-freshness.test.ts @@ -0,0 +1,124 @@ +import {beforeEach, describe, expect, it, mock} from "bun:test"; +import {EphemeralAccountType} from "@vortexfi/shared"; +import {APIError} from "../../errors/api-error"; + +const SUBSTRATE_ADDR = "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty"; +const EVM_ADDR = "0x1111111111111111111111111111111111111111"; + +let substrateNonce = 0; +let substrateFree = "0"; +let checkedSubstrateNetworks: string[] = []; +let evmNonce = 0; +let evmGetClientShouldThrow = false; + +mock.module("@vortexfi/shared", () => { + const actual = require("@vortexfi/shared"); + return { + ...actual, + ApiManager: { + getInstance: () => ({ + getApi: async (network: string) => { + checkedSubstrateNetworks.push(network); + + return { + api: { + query: { + system: { + account: async (_address: string) => ({ + data: { free: { toString: () => substrateFree } }, + nonce: { toNumber: () => substrateNonce } + }) + } + } + } + }; + } + }) + }, + EvmClientManager: { + getInstance: () => ({ + getClient: (_network: string) => { + if (evmGetClientShouldThrow) throw new Error("RPC down"); + return { + getTransactionCount: async (_args: { address: string }) => evmNonce + }; + } + }) + } + }; +}); + +// Import AFTER mocks are registered so the module picks up the mocked deps. +const { validateEphemeralAccountsFresh } = await import("./ephemeral-freshness"); + +describe("validateEphemeralAccountsFresh", () => { + beforeEach(() => { + substrateNonce = 0; + substrateFree = "0"; + checkedSubstrateNetworks = []; + evmNonce = 0; + evmGetClientShouldThrow = false; + }); + + it("passes when all submitted ephemerals are fresh on every supported network", async () => { + await expect( + validateEphemeralAccountsFresh({ + [EphemeralAccountType.EVM]: EVM_ADDR, + [EphemeralAccountType.Substrate]: SUBSTRATE_ADDR + }) + ).resolves.toBeUndefined(); + }); + + it("does not check Hydration while Hydration-backed routes are disabled", async () => { + await validateEphemeralAccountsFresh({ [EphemeralAccountType.Substrate]: SUBSTRATE_ADDR }); + + expect(checkedSubstrateNetworks).toEqual(["pendulum", "assethub"]); + }); + + it("passes when no ephemerals are submitted", async () => { + await expect(validateEphemeralAccountsFresh({})).resolves.toBeUndefined(); + }); + + it("rejects non-fresh Substrate (non-zero nonce)", async () => { + substrateNonce = 1; + try { + await validateEphemeralAccountsFresh({ [EphemeralAccountType.Substrate]: SUBSTRATE_ADDR }); + throw new Error("expected rejection"); + } catch (err) { + expect(err).toBeInstanceOf(APIError); + expect((err as APIError).status).toBe(400); + expect((err as APIError).message).toContain("not fresh"); + } + }); + + it("rejects non-fresh Substrate (non-zero free balance)", async () => { + substrateFree = "1000"; + try { + await validateEphemeralAccountsFresh({ [EphemeralAccountType.Substrate]: SUBSTRATE_ADDR }); + throw new Error("expected rejection"); + } catch (err) { + expect((err as APIError).status).toBe(400); + } + }); + + it("rejects non-fresh EVM (non-zero nonce)", async () => { + evmNonce = 5; + try { + await validateEphemeralAccountsFresh({ [EphemeralAccountType.EVM]: EVM_ADDR }); + throw new Error("expected rejection"); + } catch (err) { + expect((err as APIError).status).toBe(400); + expect((err as APIError).message).toContain("not fresh"); + } + }); + + it("fails closed with SERVICE_UNAVAILABLE on RPC error", async () => { + evmGetClientShouldThrow = true; + try { + await validateEphemeralAccountsFresh({ [EphemeralAccountType.EVM]: EVM_ADDR }); + throw new Error("expected rejection"); + } catch (err) { + expect((err as APIError).status).toBe(503); + } + }); +}); diff --git a/apps/api/src/api/services/ramp/ephemeral-freshness.ts b/apps/api/src/api/services/ramp/ephemeral-freshness.ts new file mode 100644 index 000000000..e0aeae465 --- /dev/null +++ b/apps/api/src/api/services/ramp/ephemeral-freshness.ts @@ -0,0 +1,98 @@ +import { + ApiManager, + EphemeralAccountType, + EvmClientManager, + EvmNetworks, + Networks, + SubstrateApiNetwork +} from "@vortexfi/shared"; +import Big from "big.js"; +import httpStatus from "http-status"; +import { APIError } from "../../errors/api-error"; + +const SUPPORTED_SUBSTRATE_NETWORKS: SubstrateApiNetwork[] = ["pendulum", "assethub"]; + +const SUPPORTED_EVM_NETWORKS: EvmNetworks[] = [ + Networks.Arbitrum, + Networks.Avalanche, + Networks.Base, + Networks.BSC, + Networks.Ethereum, + Networks.Moonbeam, + Networks.Polygon, + Networks.PolygonAmoy, + Networks.BaseSepolia +]; + +// SECURITY: fail-closed. Any RPC error rejects the registration since we cannot prove freshness without on-chain data. +// Hydration is intentionally excluded while Hydration-backed routes are disabled; otherwise unrelated registrations +// would open the Hydration RPC even when their route never signs on Hydration. +export async function validateEphemeralAccountsFresh( + ephemerals: { + [key in EphemeralAccountType]?: string; + } +): Promise { + const checks: Promise[] = []; + + const substrateAddress = ephemerals[EphemeralAccountType.Substrate]; + if (substrateAddress) { + for (const network of SUPPORTED_SUBSTRATE_NETWORKS) { + checks.push(assertSubstrateAccountFresh(substrateAddress, network)); + } + } + + const evmAddress = ephemerals[EphemeralAccountType.EVM]; + if (evmAddress) { + for (const network of SUPPORTED_EVM_NETWORKS) { + checks.push(assertEvmAccountFresh(evmAddress, network)); + } + } + + await Promise.all(checks); +} + +async function assertSubstrateAccountFresh(address: string, network: SubstrateApiNetwork): Promise { + let nonce: number; + let free: string; + try { + const { api } = await ApiManager.getInstance().getApi(network); + const accountInfo = (await api.query.system.account(address)) as { + data: { free: { toString(): string } }; + nonce: { toNumber(): number }; + }; + nonce = accountInfo.nonce.toNumber(); + free = accountInfo.data.free.toString(); + } catch (error) { + throw new APIError({ + message: `Could not verify freshness of Substrate ephemeral ${address} on ${network}: ${(error as Error).message}`, + status: httpStatus.SERVICE_UNAVAILABLE + }); + } + + if (nonce !== 0 || !Big(free).eq(0)) { + throw new APIError({ + message: `Substrate ephemeral ${address} is not fresh on ${network} (nonce=${nonce}, free=${free}). A new, unused ephemeral account must be provided.`, + status: httpStatus.BAD_REQUEST + }); + } +} + +async function assertEvmAccountFresh(address: string, network: EvmNetworks): Promise { + let nonce: number; + try { + const client = EvmClientManager.getInstance().getClient(network); + nonce = await client.getTransactionCount({ address: address as `0x${string}` }); + } catch (error) { + throw new APIError({ + message: `Could not verify freshness of EVM ephemeral ${address} on ${network}: ${(error as Error).message}`, + status: httpStatus.SERVICE_UNAVAILABLE + }); + } + + if (nonce !== 0) { + throw new APIError({ + message: `EVM ephemeral ${address} is not fresh on ${network} (nonce=${nonce}). A new, unused ephemeral account must be provided.`, + status: httpStatus.BAD_REQUEST + }); + } +} diff --git a/apps/api/src/api/services/ramp/helpers.test.ts b/apps/api/src/api/services/ramp/helpers.test.ts new file mode 100644 index 000000000..823e5b195 --- /dev/null +++ b/apps/api/src/api/services/ramp/helpers.test.ts @@ -0,0 +1,96 @@ +import { describe, expect, it } from "bun:test"; +import { Networks, RampDirection } from "@vortexfi/shared"; +import QuoteTicket from "../../../models/quoteTicket.model"; +import RampState from "../../../models/rampState.model"; +import { getFinalTransactionHashForRampV2 } from "./helpers"; + +type RampStateTestOverrides = { + currentPhase?: string; + id?: string; + state?: Record; + type?: RampDirection; +}; + +function createRampState(overrides: RampStateTestOverrides): RampState { + return { + currentPhase: "complete", + id: "12345678-1234-1234-1234-123456789abc", + state: {}, + type: RampDirection.BUY, + ...overrides + } as unknown as RampState; +} + +function createQuote(network: Networks): QuoteTicket { + return { network } as unknown as QuoteTicket; +} + +describe("getFinalTransactionHashForRampV2", () => { + it("prefers destinationTransfer over the legacy squid router hash for EVM onramps", () => { + const result = getFinalTransactionHashForRampV2( + createRampState({ + state: { + destinationTransferTxHash: "0xdestination", + squidRouterSwapHash: "0xsquid" + } + }), + createQuote(Networks.Base) + ); + + expect(result).toEqual({ + transactionExplorerLink: "https://basescan.org/tx/0xdestination", + transactionHash: "0xdestination" + }); + }); + + it("uses the AssetHub XCM hash for AssetHub onramps", () => { + const result = getFinalTransactionHashForRampV2( + createRampState({ + state: { + destinationTransferTxHash: "0xdestination", + pendulumToAssethubXcmHash: "0xassethub" + } + }), + createQuote(Networks.AssetHub) + ); + + expect(result).toEqual({ + transactionExplorerLink: "https://pendulum.subscan.io/block/0xassethub", + transactionHash: "0xassethub" + }); + }); + + it("uses the corridor terminal transfer hash for offramps", () => { + const result = getFinalTransactionHashForRampV2( + createRampState({ + state: { + brlaPayoutTxHash: "0xbrla" + }, + type: RampDirection.SELL + }), + createQuote(Networks.Base) + ); + + expect(result).toEqual({ + transactionExplorerLink: "https://basescan.org/tx/0xbrla", + transactionHash: "0xbrla" + }); + }); + + it("uses Polygon explorer links for Alfredpay offramps", () => { + const result = getFinalTransactionHashForRampV2( + createRampState({ + state: { + alfredpayOfframpTransferTxHash: "0xalfredpay" + }, + type: RampDirection.SELL + }), + createQuote(Networks.Polygon) + ); + + expect(result).toEqual({ + transactionExplorerLink: "https://polygonscan.com/tx/0xalfredpay", + transactionHash: "0xalfredpay" + }); + }); +}); diff --git a/apps/api/src/api/services/ramp/helpers.ts b/apps/api/src/api/services/ramp/helpers.ts index 12a633a4e..595564a7d 100644 --- a/apps/api/src/api/services/ramp/helpers.ts +++ b/apps/api/src/api/services/ramp/helpers.ts @@ -1,4 +1,4 @@ -import { FiatToken, Networks } from "@vortexfi/shared"; +import { RampDirection } from "@vortexfi/shared"; import logger from "../../../config/logger"; import { config } from "../../../config/vars"; import QuoteTicket from "../../../models/quoteTicket.model"; @@ -8,23 +8,38 @@ import { fetchWithTimeout } from "../../helpers/fetchWithTimeout"; enum TransactionHashKey { HydrationToAssethubXcmHash = "hydrationToAssethubXcmHash", PendulumToAssethubXcmHash = "pendulumToAssethubXcmHash", - SquidRouterSwapHash = "squidRouterSwapHash" + SquidRouterSwapHash = "squidRouterSwapHash", + DestinationTransferTxHash = "destinationTransferTxHash", + BrlaPayoutTxHash = "brlaPayoutTxHash", + MykoboPayoutTxHash = "mykoboPayoutTxHash", + AlfredpayOfframpTransferTxHash = "alfredpayOfframpTransferTxHash" } -type ExplorerLinkBuilder = (hash: string, rampState: RampState, quote: QuoteTicket) => string; +type ExplorerLinkBuilder = (hash: string, rampState: RampState, quote: QuoteTicket) => string | undefined; -// Map chain names from AxelarScan to their respective explorer URLs +// Explorer base URLs used to build transaction links (includes AxelarScan chain slugs and EVM network identifiers) const CHAIN_EXPLORERS: Record = { arbitrum: "https://arbiscan.io/tx", avalanche: "https://snowtrace.io/tx", base: "https://basescan.org/tx", + "base-sepolia": "https://sepolia.basescan.org/tx", binance: "https://bscscan.com/tx", bsc: "https://bscscan.com/tx", ethereum: "https://etherscan.io/tx", moonbeam: "https://moonscan.io/tx", - polygon: "https://polygonscan.com/tx" + polygon: "https://polygonscan.com/tx", + polygonAmoy: "https://amoy.polygonscan.com/tx" }; +function buildEvmExplorerLink(hash: string, network: string | undefined): string | undefined { + if (!network) { + return undefined; + } + + const explorerBaseUrl = CHAIN_EXPLORERS[network]; + return explorerBaseUrl ? `${explorerBaseUrl}/${hash}` : undefined; +} + async function getAxelarScanExecutionLink(hash: string): Promise<{ explorerLink: string; executionHash: string }> { const url = "https://api.axelarscan.io/gmp/searchGMP"; const response = await fetchWithTimeout(url, { @@ -88,12 +103,15 @@ const EXPLORER_LINK_BUILDERS: Record = [TransactionHashKey.PendulumToAssethubXcmHash]: hash => `https://pendulum.subscan.io/block/${hash}`, - [TransactionHashKey.SquidRouterSwapHash]: (hash, rampState, quote) => { - const isMoneriumPolygonOnramp = - rampState.from === "sepa" && quote.inputCurrency === FiatToken.EURC && rampState.to === Networks.Polygon; + [TransactionHashKey.SquidRouterSwapHash]: hash => `https://axelarscan.io/gmp/${hash}`, - return isMoneriumPolygonOnramp ? `https://polygonscan.com/tx/${hash}` : `https://axelarscan.io/gmp/${hash}`; - } + [TransactionHashKey.DestinationTransferTxHash]: (hash, _rampState, quote) => buildEvmExplorerLink(hash, quote.network), + + [TransactionHashKey.BrlaPayoutTxHash]: hash => `${CHAIN_EXPLORERS.base}/${hash}`, + + [TransactionHashKey.MykoboPayoutTxHash]: hash => `${CHAIN_EXPLORERS.base}/${hash}`, + + [TransactionHashKey.AlfredpayOfframpTransferTxHash]: hash => `${CHAIN_EXPLORERS.polygon}/${hash}` }; const TRANSACTION_HASH_PRIORITY: readonly TransactionHashKey[] = [ @@ -102,6 +120,18 @@ const TRANSACTION_HASH_PRIORITY: readonly TransactionHashKey[] = [ TransactionHashKey.SquidRouterSwapHash ] as const; +const BUY_TRANSACTION_HASH_V2_PRIORITY: readonly TransactionHashKey[] = [ + TransactionHashKey.HydrationToAssethubXcmHash, + TransactionHashKey.PendulumToAssethubXcmHash, + TransactionHashKey.DestinationTransferTxHash +] as const; + +const SELL_TRANSACTION_HASH_V2_PRIORITY: readonly TransactionHashKey[] = [ + TransactionHashKey.BrlaPayoutTxHash, + TransactionHashKey.MykoboPayoutTxHash, + TransactionHashKey.AlfredpayOfframpTransferTxHash +] as const; + /// Generate a sandbox transaction hash for testing purposes. It's derived from the id of the ramp state to ensure uniqueness. /// The form is 0x + first 64 hex characters of the UUID (without dashes) + padded with zeros to reach 64 characters. function deriveSandboxTransactionHash(rampState: RampState): string { @@ -136,18 +166,7 @@ export async function getFinalTransactionHashForRamp( // For SquidRouter swaps, query the execution hash from AxelarScan if (hashKey === TransactionHashKey.SquidRouterSwapHash) { try { - const isMoneriumPolygonOnramp = - rampState.from === "sepa" && quote.inputCurrency === FiatToken.EURC && rampState.to === Networks.Polygon; - - if (isMoneriumPolygonOnramp) { - // For Monerium Polygon onramp, use the hash directly - return { - transactionExplorerLink: `https://polygonscan.com/tx/${hash}`, - transactionHash: hash - }; - } - - // For other cases, query AxelarScan for the execution hash and chain-specific explorer + // Query AxelarScan for the execution hash and chain-specific explorer const { explorerLink, executionHash } = await getAxelarScanExecutionLink(hash); return { @@ -174,3 +193,35 @@ export async function getFinalTransactionHashForRamp( return { transactionExplorerLink: undefined, transactionHash: undefined }; } + +export function getFinalTransactionHashForRampV2( + rampState: RampState, + quote: QuoteTicket +): { transactionExplorerLink: string | undefined; transactionHash: string | undefined } { + if (rampState.currentPhase !== "complete") { + return { transactionExplorerLink: undefined, transactionHash: undefined }; + } + + if (config.sandboxEnabled) { + const sandboxHash = deriveSandboxTransactionHash(rampState); + return { + transactionExplorerLink: `https://sandbox-explorer.example.com/tx/${sandboxHash}`, + transactionHash: sandboxHash + }; + } + + const priority = rampState.type === RampDirection.BUY ? BUY_TRANSACTION_HASH_V2_PRIORITY : SELL_TRANSACTION_HASH_V2_PRIORITY; + + for (const hashKey of priority) { + const hash = rampState.state[hashKey]; + + if (hash) { + return { + transactionExplorerLink: EXPLORER_LINK_BUILDERS[hashKey](hash, rampState, quote), + transactionHash: hash + }; + } + } + + return { transactionExplorerLink: undefined, transactionHash: undefined }; +} diff --git a/apps/api/src/api/services/ramp/monerium-permit.test.ts b/apps/api/src/api/services/ramp/monerium-permit.test.ts deleted file mode 100644 index e7d3ea2fd..000000000 --- a/apps/api/src/api/services/ramp/monerium-permit.test.ts +++ /dev/null @@ -1,200 +0,0 @@ -import { describe, expect, it } from "bun:test"; -import { ERC20_EURE_POLYGON_TOKEN_NAME, ERC20_EURE_POLYGON_V2, Networks, PermitSignature } from "@vortexfi/shared"; -import { Signature as EthersSignature, Wallet } from "ethers"; -import { - analyzeMoneriumPermitPreflight, - validateMoneriumOnrampPermit -} from "./monerium-permit"; - -const OWNER = new Wallet("0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"); -const SPENDER = "0x4e84e0b84054F078D4Adc785818663eF83c032E3"; -const VALUE_RAW = "1150000000000000000"; -const NONCE = "0"; -const DEADLINE = "1779978803"; - -async function signPermit(overrides: Partial = {}): Promise { - const context = { - chainId: 137, - deadline: DEADLINE, - nonce: NONCE, - owner: OWNER.address as `0x${string}`, - spender: SPENDER as `0x${string}`, - tokenAddress: ERC20_EURE_POLYGON_V2, - tokenName: ERC20_EURE_POLYGON_TOKEN_NAME, - tokenVersion: "1", - valueRaw: VALUE_RAW, - ...overrides - }; - const signature = EthersSignature.from( - await OWNER.signTypedData( - { - chainId: context.chainId, - name: context.tokenName, - verifyingContract: context.tokenAddress, - version: context.tokenVersion - }, - { - Permit: [ - { name: "owner", type: "address" }, - { name: "spender", type: "address" }, - { name: "value", type: "uint256" }, - { name: "nonce", type: "uint256" }, - { name: "deadline", type: "uint256" } - ] - }, - { - deadline: context.deadline, - nonce: context.nonce, - owner: context.owner, - spender: context.spender, - value: context.valueRaw - } - ) - ); - - return { - context, - deadline: Number(context.deadline), - r: signature.r as `0x${string}`, - s: signature.s as `0x${string}`, - v: signature.v - }; -} - -describe("validateMoneriumOnrampPermit", () => { - it("accepts a permit whose signed context matches the expected onramp transfer", async () => { - const permit = await signPermit(); - - expect(() => - validateMoneriumOnrampPermit(permit, { - expectedOwner: OWNER.address, - expectedSpender: SPENDER, - expectedTokenAddress: ERC20_EURE_POLYGON_V2, - expectedTokenName: ERC20_EURE_POLYGON_TOKEN_NAME, - expectedValueRaw: VALUE_RAW, - network: Networks.Polygon - }) - ).not.toThrow(); - }); - - it("rejects a permit signed for a different raw value before payment details are released", async () => { - const permit = await signPermit({ valueRaw: "1000000000000000000" }); - - expect(() => - validateMoneriumOnrampPermit(permit, { - expectedOwner: OWNER.address, - expectedSpender: SPENDER, - expectedTokenAddress: ERC20_EURE_POLYGON_V2, - expectedTokenName: ERC20_EURE_POLYGON_TOKEN_NAME, - expectedValueRaw: VALUE_RAW, - network: Networks.Polygon - }) - ).toThrow("valueRaw"); - }); - - it("rejects a permit whose signed context is missing entirely", () => { - const permit: PermitSignature = { - deadline: Number(DEADLINE), - r: `0x${"0".repeat(64)}`, - s: `0x${"0".repeat(64)}`, - v: 27 - }; - - expect(() => - validateMoneriumOnrampPermit(permit, { - expectedOwner: OWNER.address, - expectedSpender: SPENDER, - expectedTokenAddress: ERC20_EURE_POLYGON_V2, - expectedTokenName: ERC20_EURE_POLYGON_TOKEN_NAME, - expectedValueRaw: VALUE_RAW, - network: Networks.Polygon - }) - ).toThrow("missing signed context"); - }); - - it("rejects a permit signed with a different token version", async () => { - const permit = await signPermit({ tokenVersion: "2" }); - - expect(() => - validateMoneriumOnrampPermit(permit, { - expectedOwner: OWNER.address, - expectedSpender: SPENDER, - expectedTokenAddress: ERC20_EURE_POLYGON_V2, - expectedTokenName: ERC20_EURE_POLYGON_TOKEN_NAME, - expectedValueRaw: VALUE_RAW, - network: Networks.Polygon - }) - ).toThrow("tokenVersion"); - }); - - it("rejects an expired permit before payment details are released", async () => { - const permit = await signPermit({ deadline: "1700000000" }); - - expect(() => - validateMoneriumOnrampPermit( - permit, - { - expectedOwner: OWNER.address, - expectedSpender: SPENDER, - expectedTokenAddress: ERC20_EURE_POLYGON_V2, - expectedTokenName: ERC20_EURE_POLYGON_TOKEN_NAME, - expectedValueRaw: VALUE_RAW, - network: Networks.Polygon - }, - 1700000000 - ) - ).toThrow("has expired"); - }); -}); - -describe("analyzeMoneriumPermitPreflight", () => { - it("skips sending permit when allowance already covers the self-transfer amount", async () => { - const permit = await signPermit(); - - expect( - analyzeMoneriumPermitPreflight( - permit, - { - expectedOwner: OWNER.address, - expectedSpender: SPENDER, - expectedTokenAddress: ERC20_EURE_POLYGON_V2, - expectedTokenName: ERC20_EURE_POLYGON_TOKEN_NAME, - expectedValueRaw: VALUE_RAW, - network: Networks.Polygon - }, - { - allowanceRaw: 2n * BigInt(VALUE_RAW), - balanceRaw: 0n, - nonce: 5n, - tokenName: ERC20_EURE_POLYGON_TOKEN_NAME - }, - 1779970000 - ) - ).toEqual({ reason: "allowance-sufficient", shouldSendPermit: false }); - }); - - it("reports nonce drift before attempting a permit that would revert", async () => { - const permit = await signPermit(); - - expect(() => - analyzeMoneriumPermitPreflight( - permit, - { - expectedOwner: OWNER.address, - expectedSpender: SPENDER, - expectedTokenAddress: ERC20_EURE_POLYGON_V2, - expectedTokenName: ERC20_EURE_POLYGON_TOKEN_NAME, - expectedValueRaw: VALUE_RAW, - network: Networks.Polygon - }, - { - allowanceRaw: 0n, - balanceRaw: BigInt(VALUE_RAW), - nonce: 1n, - tokenName: ERC20_EURE_POLYGON_TOKEN_NAME - }, - 1779970000 - ) - ).toThrow("nonce"); - }); -}); diff --git a/apps/api/src/api/services/ramp/monerium-permit.ts b/apps/api/src/api/services/ramp/monerium-permit.ts deleted file mode 100644 index c3510478a..000000000 --- a/apps/api/src/api/services/ramp/monerium-permit.ts +++ /dev/null @@ -1,138 +0,0 @@ -import { getNetworkId, Networks, PermitSignature } from "@vortexfi/shared"; -import { Signature as EvmSignature, verifyTypedData } from "ethers"; -import httpStatus from "http-status"; -import { APIError } from "../../errors/api-error"; - -const PERMIT_TYPES = { - Permit: [ - { name: "owner", type: "address" }, - { name: "spender", type: "address" }, - { name: "value", type: "uint256" }, - { name: "nonce", type: "uint256" }, - { name: "deadline", type: "uint256" } - ] -}; - -export interface MoneriumPermitExpectation { - expectedOwner: string; - expectedSpender: string; - expectedValueRaw: string; - expectedTokenAddress: `0x${string}`; - expectedTokenName: string; - expectedTokenVersion?: string; - network: Networks; -} - -export interface MoneriumPermitDiagnostics { - allowanceRaw: bigint; - balanceRaw: bigint; - nonce: bigint; - tokenName: string; -} - -function throwBadPermit(message: string): never { - throw new APIError({ - message, - status: httpStatus.BAD_REQUEST - }); -} - -function assertEqual(label: string, actual: string | number | undefined, expected: string | number): void { - if (actual === undefined) { - throwBadPermit(`Monerium permit ${label} is missing from signed context (expected ${String(expected)})`); - } - if (String(actual).toLowerCase() !== String(expected).toLowerCase()) { - throwBadPermit(`Monerium permit ${label} ${String(actual)} does not match expected ${String(expected)}`); - } -} - -function getPermitContext(permit: PermitSignature) { - if (!permit.context) { - throwBadPermit("Monerium permit is missing signed context; please sign again with the latest client"); - } - return permit.context; -} - -function validateMoneriumPermitSignature(permit: PermitSignature, expectation: MoneriumPermitExpectation) { - const context = getPermitContext(permit); - const expectedChainId = getNetworkId(expectation.network); - - assertEqual("owner", context.owner, expectation.expectedOwner); - assertEqual("spender", context.spender, expectation.expectedSpender); - assertEqual("valueRaw", context.valueRaw, expectation.expectedValueRaw); - assertEqual("tokenAddress", context.tokenAddress, expectation.expectedTokenAddress); - assertEqual("tokenName", context.tokenName, expectation.expectedTokenName); - assertEqual("tokenVersion", context.tokenVersion, expectation.expectedTokenVersion ?? "1"); - assertEqual("chainId", context.chainId, expectedChainId); - assertEqual("deadline", context.deadline, permit.deadline); - - const recoveredSigner = verifyTypedData( - { - chainId: context.chainId, - name: context.tokenName, - verifyingContract: context.tokenAddress, - version: context.tokenVersion - }, - PERMIT_TYPES, - { - deadline: context.deadline, - nonce: context.nonce, - owner: context.owner, - spender: context.spender, - value: context.valueRaw - }, - EvmSignature.from({ r: permit.r, s: permit.s, v: permit.v }).serialized - ); - - if (recoveredSigner.toLowerCase() !== expectation.expectedOwner.toLowerCase()) { - throwBadPermit(`Monerium permit signature was produced by ${recoveredSigner}, expected ${expectation.expectedOwner}`); - } - - return context; -} - -function assertPermitDeadlineInFuture(deadline: string, nowSeconds: number): void { - if (BigInt(deadline) <= BigInt(nowSeconds)) { - throwBadPermit(`Monerium permit deadline ${deadline} has expired`); - } -} - -export function validateMoneriumOnrampPermit( - permit: PermitSignature, - expectation: MoneriumPermitExpectation, - nowSeconds = Math.floor(Date.now() / 1000) -): void { - const context = validateMoneriumPermitSignature(permit, expectation); - assertPermitDeadlineInFuture(context.deadline, nowSeconds); -} - -export function analyzeMoneriumPermitPreflight( - permit: PermitSignature, - expectation: MoneriumPermitExpectation, - diagnostics: MoneriumPermitDiagnostics, - nowSeconds = Math.floor(Date.now() / 1000) -): { reason: "allowance-sufficient" | "permit-required"; shouldSendPermit: boolean } { - const context = validateMoneriumPermitSignature(permit, expectation); - - const expectedValueRaw = BigInt(expectation.expectedValueRaw); - - if (diagnostics.allowanceRaw >= expectedValueRaw) { - return { reason: "allowance-sufficient", shouldSendPermit: false }; - } - - if (diagnostics.tokenName !== context.tokenName) { - throwBadPermit( - `Monerium permit tokenName ${context.tokenName} does not match on-chain token name ${diagnostics.tokenName}` - ); - } - - if (BigInt(context.nonce) !== diagnostics.nonce) { - throwBadPermit( - `Monerium permit nonce ${context.nonce} does not match current on-chain nonce ${diagnostics.nonce.toString()}` - ); - } - - assertPermitDeadlineInFuture(context.deadline, nowSeconds); - - return { reason: "permit-required", shouldSendPermit: true }; -} diff --git a/apps/api/src/api/services/ramp/monerium-self-transfer.test.ts b/apps/api/src/api/services/ramp/monerium-self-transfer.test.ts deleted file mode 100644 index 465e22d25..000000000 --- a/apps/api/src/api/services/ramp/monerium-self-transfer.test.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { describe, expect, it } from "bun:test"; -import { inspectMoneriumSelfTransferTransaction } from "./monerium-self-transfer"; - -const rawSelfTransferTx = - "0x02f8d381898085e64020937685e640209376830186a094e0aea583266584dafbb3f9c3211d5588c73fea8d80b86423b872dd000000000000000000000000976ff31a56daf5a0e09f411950311f5877ff00d50000000000000000000000007c4e657eeb8ba8bbf0882c817a7a9f2df55636ad0000000000000000000000000000000000000000000000000e27c49886e60000c001a029c840d52a6634e2ed642d50c306f08a379f8466a10c332e07f03bc85da1ae52a00ae865be836a16b25bbe9d647085930d4b0b1cedf3d3e84e127e14f7dddf660e"; - -const expectation = { - expectedAmountRaw: "1020000000000000000", - expectedOwner: "0x976fF31a56dAF5A0E09F411950311F5877ff00D5" as const, - expectedRecipient: "0x7c4E657EEb8bA8bBF0882C817A7A9f2Df55636AD" as const, - expectedSigner: "0x7c4E657EEb8bA8bBF0882C817A7A9f2Df55636AD" as const, - rampId: "ramp-1" -}; - -describe("inspectMoneriumSelfTransferTransaction", () => { - it("decodes and validates a signed Monerium self-transfer", async () => { - const inspection = await inspectMoneriumSelfTransferTransaction(rawSelfTransferTx, expectation); - - expect(inspection.amountRaw).toBe(1020000000000000000n); - expect(inspection.owner.toLowerCase()).toBe(expectation.expectedOwner.toLowerCase()); - expect(inspection.recipient.toLowerCase()).toBe(expectation.expectedRecipient.toLowerCase()); - expect(inspection.signer.toLowerCase()).toBe(expectation.expectedSigner.toLowerCase()); - expect(inspection.signedGas).toBe(100000n); - expect(inspection.signedNonce).toBe(0); - expect(inspection.tokenAddress.toLowerCase()).toBe("0xe0aea583266584dafbb3f9c3211d5588c73fea8d"); - }); - - it("rejects a signed transfer for the wrong amount", async () => { - await expect( - inspectMoneriumSelfTransferTransaction(rawSelfTransferTx, { - ...expectation, - expectedAmountRaw: "1020000000000000001" - }) - ).rejects.toThrow("Self-transfer amount 1020000000000000000 does not match expected 1020000000000000001"); - }); - - it("accepts a signed transfer when chainId matches the expected network", async () => { - const inspection = await inspectMoneriumSelfTransferTransaction(rawSelfTransferTx, { - ...expectation, - expectedChainId: 137 - }); - - expect(inspection.amountRaw).toBe(1020000000000000000n); - }); - - it("rejects a signed transfer when chainId does not match the expected network", async () => { - await expect( - inspectMoneriumSelfTransferTransaction(rawSelfTransferTx, { - ...expectation, - expectedChainId: 1 - }) - ).rejects.toThrow("Self-transfer chainId 137 does not match expected 1"); - }); -}); diff --git a/apps/api/src/api/services/ramp/monerium-self-transfer.ts b/apps/api/src/api/services/ramp/monerium-self-transfer.ts deleted file mode 100644 index 9a0652a8d..000000000 --- a/apps/api/src/api/services/ramp/monerium-self-transfer.ts +++ /dev/null @@ -1,121 +0,0 @@ -import { ERC20_EURE_POLYGON_V2 } from "@vortexfi/shared"; -import { decodeFunctionData, isAddress, parseTransaction, recoverTransactionAddress } from "viem"; - -export const moneriumTransferFromAbi = [ - { - inputs: [ - { name: "from", type: "address" }, - { name: "to", type: "address" }, - { name: "value", type: "uint256" } - ], - name: "transferFrom", - outputs: [{ name: "", type: "bool" }], - stateMutability: "nonpayable", - type: "function" - } -] as const; - -type RecoverableSerializedTransaction = Parameters[0]["serializedTransaction"]; - -interface MoneriumSelfTransferExpectation { - expectedAmountRaw: string; - expectedChainId?: number; - expectedOwner: `0x${string}`; - expectedRecipient: `0x${string}`; - expectedSigner: `0x${string}`; - expectedTokenAddress?: `0x${string}`; - rampId: string; -} - -export interface MoneriumSelfTransferInspection { - amountRaw: bigint; - owner: `0x${string}`; - recipient: `0x${string}`; - serializedTransaction: RecoverableSerializedTransaction; - signedGas: bigint; - signedNonce: number; - signer: `0x${string}`; - tokenAddress: `0x${string}`; -} - -function requireAddress(value: string | null | undefined, label: string, rampId: string): `0x${string}` { - if (!value || !isAddress(value)) { - throw new Error(`[${rampId}] ${label} ${value ?? ""} is not a valid EVM address`); - } - - return value as `0x${string}`; -} - -export async function inspectMoneriumSelfTransferTransaction( - txData: string, - expectation: MoneriumSelfTransferExpectation -): Promise { - const serializedTransaction = txData as RecoverableSerializedTransaction; - const parsedTx = parseTransaction(serializedTransaction); - const signer = requireAddress( - await recoverTransactionAddress({ serializedTransaction }), - "Self-transfer signer", - expectation.rampId - ); - const expectedTokenAddress = expectation.expectedTokenAddress ?? ERC20_EURE_POLYGON_V2; - const tokenAddress = requireAddress(parsedTx.to, "Self-transfer token", expectation.rampId); - const signedNonce = parsedTx.nonce; - - if (signedNonce === undefined) { - throw new Error(`[${expectation.rampId}] Self-transfer signed transaction is missing a nonce`); - } - - if (signer.toLowerCase() !== expectation.expectedSigner.toLowerCase()) { - throw new Error( - `[${expectation.rampId}] Self-transfer signer ${signer} does not match expected EVM ephemeral ${expectation.expectedSigner}` - ); - } - - if (tokenAddress.toLowerCase() !== expectedTokenAddress.toLowerCase()) { - throw new Error( - `[${expectation.rampId}] Self-transfer token ${tokenAddress} does not match expected ${expectedTokenAddress}` - ); - } - - if (expectation.expectedChainId !== undefined && parsedTx.chainId !== expectation.expectedChainId) { - throw new Error( - `[${expectation.rampId}] Self-transfer chainId ${parsedTx.chainId} does not match expected ${expectation.expectedChainId}` - ); - } - - const decodedTransfer = decodeFunctionData({ - abi: moneriumTransferFromAbi, - data: parsedTx.data ?? "0x" - }); - const [decodedOwner, decodedRecipient, amountRaw] = decodedTransfer.args; - const owner = requireAddress(decodedOwner, "Self-transfer owner", expectation.rampId); - const recipient = requireAddress(decodedRecipient, "Self-transfer recipient", expectation.rampId); - const expectedAmount = BigInt(expectation.expectedAmountRaw); - - if (owner.toLowerCase() !== expectation.expectedOwner.toLowerCase()) { - throw new Error( - `[${expectation.rampId}] Self-transfer owner ${owner} does not match expected ${expectation.expectedOwner}` - ); - } - if (recipient.toLowerCase() !== expectation.expectedRecipient.toLowerCase()) { - throw new Error( - `[${expectation.rampId}] Self-transfer recipient ${recipient} does not match expected ${expectation.expectedRecipient}` - ); - } - if (amountRaw !== expectedAmount) { - throw new Error( - `[${expectation.rampId}] Self-transfer amount ${amountRaw.toString()} does not match expected ${expectation.expectedAmountRaw}` - ); - } - - return { - amountRaw, - owner, - recipient, - serializedTransaction, - signedGas: parsedTx.gas ?? 0n, - signedNonce, - signer, - tokenAddress - }; -} diff --git a/apps/api/src/api/services/ramp/ramp-transaction-preparation.test.ts b/apps/api/src/api/services/ramp/ramp-transaction-preparation.test.ts index 12fec56aa..491d5cfe0 100644 --- a/apps/api/src/api/services/ramp/ramp-transaction-preparation.test.ts +++ b/apps/api/src/api/services/ramp/ramp-transaction-preparation.test.ts @@ -1,9 +1,6 @@ import { describe, expect, it } from "bun:test"; -import { FiatToken, RampDirection } from "@vortexfi/shared"; -import { - RampTransactionPreparationKind, - selectRampTransactionPreparationKind -} from "./ramp-transaction-preparation"; +import { FiatToken, Networks, RampDirection } from "@vortexfi/shared"; +import { RampTransactionPreparationKind, selectRampTransactionPreparationKind } from "./ramp-transaction-preparation"; describe("selectRampTransactionPreparationKind", () => { it("selects the BRL offramp preparer for sell quotes that output BRL", () => { @@ -16,7 +13,7 @@ describe("selectRampTransactionPreparationKind", () => { ).toBe(RampTransactionPreparationKind.OfframpBrl); }); - it("uses the Monerium offramp preparer only when the Monerium auth token is present", () => { + it("selects the non-BRL offramp preparer for EUR sell quotes (Mykobo offramp handled downstream)", () => { expect( selectRampTransactionPreparationKind({ inputCurrency: FiatToken.EURC, @@ -24,28 +21,28 @@ describe("selectRampTransactionPreparationKind", () => { rampType: RampDirection.SELL }) ).toBe(RampTransactionPreparationKind.OfframpNonBrl); + }); + it("routes EURC onramps to Mykobo on every supported destination", () => { expect( - selectRampTransactionPreparationKind( - { - inputCurrency: FiatToken.EURC, - outputCurrency: FiatToken.EURC, - rampType: RampDirection.SELL - }, - { moneriumAuthToken: "token" } - ) - ).toBe(RampTransactionPreparationKind.OfframpMonerium); - }); + selectRampTransactionPreparationKind({ + inputCurrency: FiatToken.EURC, + outputCurrency: FiatToken.EURC, + rampType: RampDirection.BUY, + to: Networks.Base + }) + ).toBe(RampTransactionPreparationKind.OnrampMykobo); - it("selects onramp preparers from the fiat input token", () => { expect( selectRampTransactionPreparationKind({ inputCurrency: FiatToken.EURC, outputCurrency: FiatToken.EURC, rampType: RampDirection.BUY }) - ).toBe(RampTransactionPreparationKind.OnrampMonerium); + ).toBe(RampTransactionPreparationKind.OnrampMykobo); + }); + it("selects non-EURC onramp preparers from the fiat input token", () => { expect( selectRampTransactionPreparationKind({ inputCurrency: FiatToken.USD, diff --git a/apps/api/src/api/services/ramp/ramp-transaction-preparation.ts b/apps/api/src/api/services/ramp/ramp-transaction-preparation.ts index 1af5cf67a..3c763efed 100644 --- a/apps/api/src/api/services/ramp/ramp-transaction-preparation.ts +++ b/apps/api/src/api/services/ramp/ramp-transaction-preparation.ts @@ -2,35 +2,33 @@ import { FiatToken, isAlfredpayToken, RampDirection, RegisterRampRequest } from export enum RampTransactionPreparationKind { OfframpBrl = "offramp-brl", - OfframpMonerium = "offramp-monerium", OfframpNonBrl = "offramp-non-brl", OnrampAlfredpay = "onramp-alfredpay", OnrampAvenia = "onramp-avenia", - OnrampMonerium = "onramp-monerium" + OnrampMykobo = "onramp-mykobo" } export interface RampTransactionPreparationQuote { inputCurrency: string; outputCurrency: string; rampType: RampDirection; + to?: string; } export function selectRampTransactionPreparationKind( quote: RampTransactionPreparationQuote, - additionalData?: RegisterRampRequest["additionalData"] + _additionalData?: RegisterRampRequest["additionalData"] ): RampTransactionPreparationKind { if (quote.rampType === RampDirection.SELL) { if (quote.outputCurrency === FiatToken.BRL) { return RampTransactionPreparationKind.OfframpBrl; } - return additionalData?.moneriumAuthToken - ? RampTransactionPreparationKind.OfframpMonerium - : RampTransactionPreparationKind.OfframpNonBrl; + return RampTransactionPreparationKind.OfframpNonBrl; } if (quote.inputCurrency === FiatToken.EURC) { - return RampTransactionPreparationKind.OnrampMonerium; + return RampTransactionPreparationKind.OnrampMykobo; } if (isAlfredpayToken(quote.inputCurrency as FiatToken)) { diff --git a/apps/api/src/api/services/ramp/ramp.service.get-ramp-status.test.ts b/apps/api/src/api/services/ramp/ramp.service.get-ramp-status.test.ts new file mode 100644 index 000000000..1d142a102 --- /dev/null +++ b/apps/api/src/api/services/ramp/ramp.service.get-ramp-status.test.ts @@ -0,0 +1,164 @@ +import { describe, expect, it, mock } from "bun:test"; +import { EPaymentMethod, FiatToken, Networks, RampDirection, RampPhase } from "@vortexfi/shared"; +import QuoteTicket from "../../../models/quoteTicket.model"; +import RampState from "../../../models/rampState.model"; +import { StateMetadata } from "../phases/meta-state-types"; +import { RampService } from "./ramp.service"; + +const createdAt = new Date("2026-06-10T12:31:56.420Z"); +const updatedAt = new Date("2026-06-10T12:32:25.548Z"); + +QuoteTicket.findByPk = mock(async () => ({ + countryCode: "BR", + inputAmount: "25003", + inputCurrency: FiatToken.BRL, + metadata: { + fees: { + displayFiat: { + anchor: "0.75", + currency: "BRL", + network: "0", + partnerMarkup: "0", + total: "0.75", + vortex: "0" + }, + usd: { + anchor: "0.15", + network: "0", + partnerMarkup: "0", + total: "0.15", + vortex: "0" + } + } + }, + network: Networks.Base, + outputAmount: "25002.25", + outputCurrency: "BRLA" +})) as unknown as typeof QuoteTicket.findByPk; + +class TestRampService extends RampService { + public constructor(private readonly rampState: RampState) { + super(); + } + + protected async getRampState(): Promise { + return this.rampState; + } +} + +function makeRampState(onHold: boolean, currentPhase: RampPhase = "brlaOnrampMint") { + return RampState.build({ + createdAt, + currentPhase, + errorLogs: [], + flowVariant: "monerium", + from: EPaymentMethod.PIX, + id: "ramp-1", + paymentMethod: EPaymentMethod.PIX, + phaseHistory: [{ phase: currentPhase, timestamp: createdAt }], + postCompleteState: { + cleanup: { + cleanupAt: null, + cleanupCompleted: false, + errors: null + } + }, + presignedTxs: null, + processingLock: { + locked: false, + lockedAt: null + }, + quoteId: "quote-1", + state: makeStateMetadata({ onHold }), + to: Networks.Base, + type: RampDirection.BUY, + unsignedTxs: [], + userId: null, + updatedAt + }); +} + +function makeStateMetadata(overrides: Partial): StateMetadata { + return { + assethubToPendulumHash: "", + aveniaTicketId: "ticket-1", + brlaEvmAddress: "", + depositQrCode: undefined, + destinationAddress: "0x2222222222222222222222222222222222222222", + distributeFeeHash: "", + evmEphemeralAddress: "", + finalUserAddress: "", + ibanPaymentData: { + bic: "", + iban: "", + receiverName: "" + }, + moonbeamEphemeralAccount: { + address: "", + secret: "" + }, + moonbeamXcmTransactionHash: "0x0000000000000000000000000000000000000000000000000000000000000000", + nabla: { + approveExtrinsicOptions: makeExtrinsicOptions(), + swapExtrinsicOptions: makeExtrinsicOptions() + }, + nablaSoftMinimumOutputRaw: "", + payOutTicketId: undefined, + pixDestination: "", + presignChecksPass: true, + receiverTaxId: "", + sessionId: "session-1", + squidRouterApproveHash: "", + squidRouterPayTxHash: "", + squidRouterQuoteId: "", + squidRouterReceiverHash: "", + squidRouterReceiverId: "", + squidRouterSwapHash: "", + substrateEphemeralAddress: "", + taxId: "", + unhandledPaymentAlertSent: false, + walletAddress: undefined, + ...overrides + }; +} + +function makeExtrinsicOptions() { + return { + callerAddress: "", + contractDeploymentAddress: "", + limits: { + gas: { + proofSize: 0, + refTime: 0 + } + }, + messageArguments: [], + messageName: "" + }; +} + +describe("RampService.getRampStatus", () => { + it("returns onHoldForComplianceCheck when ramp state is marked as on hold", async () => { + const service = new TestRampService(makeRampState(true)); + + const status = await service.getRampStatus("ramp-1"); + + expect(status?.currentPhase).toBe("onHoldForComplianceCheck"); + }); + + it("returns the persisted current phase when ramp state is not on hold", async () => { + const service = new TestRampService(makeRampState(false)); + + const status = await service.getRampStatus("ramp-1"); + + expect(status?.currentPhase).toBe("brlaOnrampMint"); + }); + + it("does not mask later phases if a stale on-hold flag remains", async () => { + const service = new TestRampService(makeRampState(true, "fundEphemeral")); + + const status = await service.getRampStatus("ramp-1"); + + expect(status?.currentPhase).toBe("fundEphemeral"); + }); +}); diff --git a/apps/api/src/api/services/ramp/ramp.service.ts b/apps/api/src/api/services/ramp/ramp.service.ts index 8b5f93986..6bfe6c654 100644 --- a/apps/api/src/api/services/ramp/ramp.service.ts +++ b/apps/api/src/api/services/ramp/ramp.service.ts @@ -10,12 +10,9 @@ import { AveniaPaymentMethod, BrlaApiService, BrlaCurrency, - CreateAlfredpayOfframpRequest, + CreateAlfredpayOfframpQuoteRequest, CreateAlfredpayOnrampRequest, EphemeralAccountType, - ERC20_EURE_POLYGON_TOKEN_NAME, - ERC20_EURE_POLYGON_V2, - EvmNetworks, FiatToken, GetRampHistoryResponse, GetRampStatusResponse, @@ -23,7 +20,9 @@ import { IbanPaymentData, isAlfredpayToken, Limit, - MoneriumErrors, + MykoboApiService, + MykoboCurrency, + MykoboTransactionType, Networks, normalizeTaxId, QuoteError, @@ -44,39 +43,39 @@ import { import Big from "big.js"; import httpStatus from "http-status"; import { Op, Transaction, WhereOptions } from "sequelize"; -import { StrKey } from "stellar-sdk"; import { isAddress } from "viem"; import logger from "../../../config/logger"; -import { SEQUENCE_TIME_WINDOW_IN_SECONDS } from "../../../constants/constants"; +import { config } from "../../../config/vars"; import Partner from "../../../models/partner.model"; import QuoteTicket from "../../../models/quoteTicket.model"; import RampState, { RampStateAttributes } from "../../../models/rampState.model"; import TaxId from "../../../models/taxId.model"; import { APIError } from "../../errors/api-error"; import { ActivePartner, handleQuoteConsumptionForDiscountState } from "../../services/quote/engines/discount/helpers"; -import { createEpcQrCodeData, getIbanForAddress } from "../monerium"; +import { syncMykoboCustomerKyc } from "../mykobo/mykobo-customer.service"; import { StateMetadata } from "../phases/meta-state-types"; import phaseProcessor from "../phases/phase-processor"; import { PriceFeedService } from "../priceFeed.service"; import { prepareOfframpTransactions } from "../transactions/offramp"; import { prepareOnrampTransactions } from "../transactions/onramp"; -import { AveniaOnrampTransactionParams, MoneriumOnrampTransactionParams } from "../transactions/onramp/common/types"; +import { AveniaOnrampTransactionParams } from "../transactions/onramp/common/types"; +import { prepareMykoboToEvmOnrampTransactions } from "../transactions/onramp/routes/mykobo-to-evm"; import { validatePresignedTxs } from "../transactions/validation"; import webhookDeliveryService from "../webhook/webhook-delivery.service"; import { BaseRampService } from "./base.service"; -import { getFinalTransactionHashForRamp } from "./helpers"; -import { validateMoneriumOnrampPermit } from "./monerium-permit"; +import { validateEphemeralAccountsFresh } from "./ephemeral-freshness"; +import { getFinalTransactionHashForRampV2 } from "./helpers"; import { RampTransactionPreparationKind, selectRampTransactionPreparationKind } from "./ramp-transaction-preparation"; -const RAMP_START_EXPIRATION_TIME_SECONDS = SEQUENCE_TIME_WINDOW_IN_SECONDS * 0.8; +const RAMP_START_EXPIRATION_TIME_SECONDS = 900; // 15 minutes // Classifies unsigned txs by signer: ephemeral-signed (backend pre-signs) vs user-wallet-signed. function partitionUnsignedTxs( unsignedTxs: UnsignedTx[], - ephemerals: { evm?: string; substrate?: string; stellar?: string } + ephemerals: { evm?: string; substrate?: string } ): { ephemeralTxs: UnsignedTx[]; userWalletTxs: UnsignedTx[] } { const ephemeralSigners = new Set( - [ephemerals.evm, ephemerals.substrate, ephemerals.stellar].filter((v): v is string => Boolean(v)).map(s => s.toLowerCase()) + [ephemerals.evm, ephemerals.substrate].filter((v): v is string => Boolean(v)).map(s => s.toLowerCase()) ); const ephemeralTxs: UnsignedTx[] = []; @@ -100,7 +99,6 @@ function filterUnsignedTxsForResponse(rampState: RampState, ephemeralPresignChec const { ephemeralTxs } = partitionUnsignedTxs(rampState.unsignedTxs, { evm: rampState.state.evmEphemeralAddress, - stellar: rampState.state.stellarEphemeralAccountId, substrate: rampState.state.substrateEphemeralAddress }); return ephemeralTxs; @@ -116,12 +114,6 @@ function validateAddressFormat(address: string, type: EphemeralAccountType): voi } switch (type) { - case EphemeralAccountType.Stellar: - if (!StrKey.isValidEd25519PublicKey(address)) { - throw new Error(`Invalid Stellar address format: "${address}". Expected a valid Ed25519 public key.`); - } - break; - case EphemeralAccountType.Substrate: try { decodeAddress(address); @@ -140,18 +132,12 @@ function validateAddressFormat(address: string, type: EphemeralAccountType): voi export function normalizeAndValidateSigningAccounts(accounts: AccountMeta[]) { const normalizedSigningAccounts: AccountMeta[] = []; - const allowedNetworks = new Set(Object.values(EphemeralAccountType).map(network => network.toLowerCase())); - const ephemerals: { [key in EphemeralAccountType]?: string } = {}; accounts.forEach(account => { - if (!allowedNetworks.has(account.type.toLowerCase())) { - throw new Error(`Invalid network: "${account.type}" provided.`); - } - const type = Object.values(EphemeralAccountType).find(type => type.toLowerCase() === account.type.toLowerCase()); if (!type) { - throw new Error(`Invalid ephemeral type: "${account.type}" provided.`); + return; } validateAddressFormat(account.address, type); @@ -168,6 +154,16 @@ export function normalizeAndValidateSigningAccounts(accounts: AccountMeta[]) { } export class RampService extends BaseRampService { + // Two backends share one database; each must only touch ramps/quotes for its own flow. + // We return 404 on mismatch so the wrong backend looks indistinguishable from "not found". + private static assertOwnedByThisFlow(entity: { flowVariant: string; id: string }, kind: "Ramp" | "Quote"): void { + if (entity.flowVariant !== config.flowVariant) { + throw new APIError({ + message: `${kind} not found`, + status: httpStatus.NOT_FOUND + }); + } + } /** * Register a new ramping process. This will create a new ramp state and create transactions that need to be signed * on the client side. @@ -185,6 +181,8 @@ export class RampService extends BaseRampService { }); } + RampService.assertOwnedByThisFlow(quote, "Quote"); + if (quote.status !== "pending") { throw new APIError({ message: `Quote is ${quote.status}`, @@ -203,11 +201,14 @@ export class RampService extends BaseRampService { const { normalizedSigningAccounts, ephemerals } = normalizeAndValidateSigningAccounts(signingAccounts); + await validateEphemeralAccountsFresh(ephemerals); + const { unsignedTxs, stateMeta, depositQrCode, ibanPaymentData, aveniaTicketId } = await this.prepareRampTransactions( quote, normalizedSigningAccounts, additionalData, signingAccounts, + transaction, request.userId // will be undefined if not logged in. registerRamp is optional. ); @@ -219,9 +220,10 @@ export class RampService extends BaseRampService { }); } + const pricingPartnerId = quote.pricingPartnerId ?? quote.partnerId; let partner: ActivePartner = null; - if (quote.partnerId) { - partner = await Partner.findByPk(quote.partnerId); + if (pricingPartnerId) { + partner = await Partner.findByPk(pricingPartnerId); } handleQuoteConsumptionForDiscountState(partner); @@ -230,6 +232,7 @@ export class RampService extends BaseRampService { const rampState = await this.createRampState( { currentPhase: "initial" as RampPhase, + flowVariant: quote.flowVariant, from: quote.from, paymentMethod: quote.paymentMethod, postCompleteState: { @@ -243,7 +246,6 @@ export class RampService extends BaseRampService { depositQrCode, evmEphemeralAddress: ephemerals.EVM, ibanPaymentData, - stellarEphemeralAccountId: ephemerals.Stellar, substrateEphemeralAddress: ephemerals.Substrate, ...request.additionalData, ...stateMeta @@ -297,6 +299,8 @@ export class RampService extends BaseRampService { }); } + RampService.assertOwnedByThisFlow(rampState, "Ramp"); + const quote = await QuoteTicket.findByPk(rampState.quoteId, { transaction }); if (!quote) { @@ -317,7 +321,6 @@ export class RampService extends BaseRampService { // Validate presigned transactions, if some were supplied const ephemerals: { [key in EphemeralAccountType]: string } = { EVM: rampState.state.evmEphemeralAddress, - Stellar: rampState.state.stellarEphemeralAccountId, Substrate: rampState.state.substrateEphemeralAddress }; if (presignedTxs && presignedTxs.length > 0) { @@ -413,6 +416,8 @@ export class RampService extends BaseRampService { }); } + RampService.assertOwnedByThisFlow(rampState, "Ramp"); + const quote = await QuoteTicket.findByPk(rampState.quoteId, { transaction }); if (!quote) { @@ -424,6 +429,18 @@ export class RampService extends BaseRampService { this.validateRampStateData(rampState, quote); + const rampStateCreationTime = new Date(rampState.createdAt); + const currentTime = new Date(); + const timeDifferenceSeconds = (currentTime.getTime() - rampStateCreationTime.getTime()) / 1000; + + if (timeDifferenceSeconds > RAMP_START_EXPIRATION_TIME_SECONDS) { + await this.cancelRamp(rampState.id); + throw new APIError({ + message: "Maximum time window to start process exceeded. Ramp invalidated.", + status: httpStatus.BAD_REQUEST + }); + } + // Check if presigned transactions are available (should be set by updateRamp) if (!rampState.presignedTxs || rampState.presignedTxs.length === 0) { throw new APIError({ @@ -435,24 +452,10 @@ export class RampService extends BaseRampService { // Validate presigned transactions const ephemerals: { [key in EphemeralAccountType]: string } = { EVM: rampState.state.evmEphemeralAddress, - Stellar: rampState.state.stellarEphemeralAccountId, Substrate: rampState.state.substrateEphemeralAddress }; await validatePresignedTxs(rampState.type, rampState.presignedTxs, ephemerals, rampState.unsignedTxs); - const rampStateCreationTime = new Date(rampState.createdAt); - const currentTime = new Date(); - const timeDifferenceSeconds = (currentTime.getTime() - rampStateCreationTime.getTime()) / 1000; - - // We leave 20% of the time window for to reach the stellar creation operation. - if (timeDifferenceSeconds > RAMP_START_EXPIRATION_TIME_SECONDS) { - this.cancelRamp(rampState.id); - throw new APIError({ - message: "Maximum time window to start process exceeded. Ramp invalidated.", - status: httpStatus.BAD_REQUEST - }); - } - logger.log("Triggering TRANSACTION_CREATED webhook for ramp state:", rampState.id); webhookDeliveryService .triggerTransactionCreated( @@ -508,6 +511,10 @@ export class RampService extends BaseRampService { return null; } + if (rampState.flowVariant !== config.flowVariant) { + return null; + } + // Fetch associated quote for fee data const quote = await QuoteTicket.findByPk(rampState.quoteId); @@ -531,26 +538,26 @@ export class RampService extends BaseRampService { const processingFeeFiat = new Big(fiatFees.anchor).plus(fiatFees.vortex).toFixed(); const processingFeeUsd = new Big(usdFees.anchor).plus(usdFees.vortex).toFixed(); + const isOnHoldForComplianceCheck = rampState.currentPhase === "brlaOnrampMint" && rampState.state.onHold; + // Never return 'failed' as current phase, instead return last known phase - const currentPhase = - rampState.currentPhase !== "failed" + const currentPhase: RampPhase = isOnHoldForComplianceCheck + ? "onHoldForComplianceCheck" + : rampState.currentPhase !== "failed" ? rampState.currentPhase : // Find second-last entry in phase history or show 'initial' if not available rampState.phaseHistory && rampState.phaseHistory.length > 1 ? rampState.phaseHistory[rampState.phaseHistory.length - 2].phase : "initial"; - // Get or compute final transaction hash and explorer link - let transactionHash = rampState.state.finalTransactionHash; - let transactionExplorerLink = rampState.state.finalTransactionExplorerLink; + // Get or compute the V2 final transaction hash and explorer link. The legacy field intentionally used the + // second-last network for older clients, so status/history responses ignore it here. + let transactionHash = rampState.state.finalTransactionHashV2; + let transactionExplorerLink = rampState.state.finalTransactionExplorerLinkV2; // If not stored yet and ramp is complete, compute and store them - if ( - rampState.type === RampDirection.BUY && - rampState.currentPhase === "complete" && - (!transactionHash || !transactionExplorerLink) - ) { - const result = await getFinalTransactionHashForRamp(rampState, quote); + if (rampState.currentPhase === "complete" && (!transactionHash || !transactionExplorerLink)) { + const result = getFinalTransactionHashForRampV2(rampState, quote); transactionHash = result.transactionHash; transactionExplorerLink = result.transactionExplorerLink; @@ -559,8 +566,8 @@ export class RampService extends BaseRampService { await rampState.update({ state: { ...rampState.state, - finalTransactionExplorerLink: transactionExplorerLink, - finalTransactionHash: transactionHash + finalTransactionExplorerLinkV2: transactionExplorerLink, + finalTransactionHashV2: transactionHash } }); } @@ -619,6 +626,10 @@ export class RampService extends BaseRampService { return null; } + if (rampState.flowVariant !== config.flowVariant) { + return null; + } + return rampState.errorLogs; } @@ -635,7 +646,8 @@ export class RampService extends BaseRampService { [Op.or]: [{ "state.walletAddress": walletAddress }, { "state.destinationAddress": walletAddress }], currentPhase: { [Op.ne]: "initial" - } + }, + flowVariant: config.flowVariant }; let where: WhereOptions; @@ -678,17 +690,14 @@ export class RampService extends BaseRampService { }); } - // Get or compute final transaction hash and explorer link (similar to getRampStatus) - let transactionHash = ramp.state.finalTransactionHash; - let transactionExplorerLink = ramp.state.finalTransactionExplorerLink; + // Get or compute the V2 final transaction hash and explorer link (similar to getRampStatus). + // Do not fall back to the legacy finalTransactionExplorerLink because that may point to Squid/Axelar. + let transactionHash = ramp.state.finalTransactionHashV2; + let transactionExplorerLink = ramp.state.finalTransactionExplorerLinkV2; // If not stored yet and ramp is complete, compute and store them - if ( - ramp.type === RampDirection.BUY && - ramp.currentPhase === "complete" && - (!transactionHash || !transactionExplorerLink) - ) { - const result = await getFinalTransactionHashForRamp(ramp, quote); + if (ramp.currentPhase === "complete" && (!transactionHash || !transactionExplorerLink)) { + const result = getFinalTransactionHashForRampV2(ramp, quote); transactionHash = result.transactionHash; transactionExplorerLink = result.transactionExplorerLink; @@ -697,8 +706,8 @@ export class RampService extends BaseRampService { await ramp.update({ state: { ...ramp.state, - finalTransactionExplorerLink: transactionExplorerLink, - finalTransactionHash: transactionHash + finalTransactionExplorerLinkV2: transactionExplorerLink, + finalTransactionHashV2: transactionHash } }); } @@ -750,6 +759,8 @@ export class RampService extends BaseRampService { }); } + RampService.assertOwnedByThisFlow(rampState, "Ramp"); + // Limit the number of error logs to 100 const updatedErrorLogs = [...(rampState.errorLogs || []), errorLog].slice(-100); await rampState.update({ @@ -1005,7 +1016,6 @@ export class RampService extends BaseRampService { quote, receiverTaxId: additionalData.receiverTaxId, signingAccounts: normalizedSigningAccounts, - stellarPaymentData: additionalData.paymentData, taxId: additionalData.taxId, userAddress: additionalData.walletAddress }); @@ -1017,13 +1027,22 @@ export class RampService extends BaseRampService { quote: QuoteTicket, normalizedSigningAccounts: AccountMeta[], additionalData: RegisterRampRequest["additionalData"], + transaction: Transaction, userId?: string ): Promise<{ unsignedTxs: UnsignedTx[]; stateMeta: Partial }> { + // We refresh the quote. It will be used in the transaction creation process, right after this. + if (isAlfredpayToken(quote.outputCurrency as FiatToken) && quote.metadata.alfredpayOfframp) { + const toCurrency = quote.outputCurrency as unknown as AlfredpayFiatCurrency; + await this.refreshAlfredpayOfframpQuoteIfMatching(quote, quote.metadata.alfredpayOfframp, toCurrency, transaction); + } + const { unsignedTxs, stateMeta } = await prepareOfframpTransactions({ + destinationAddress: additionalData?.destinationAddress, + email: additionalData?.email, fiatAccountId: additionalData?.fiatAccountId as string | undefined, + ipAddress: additionalData?.ipAddress, quote, signingAccounts: normalizedSigningAccounts, - stellarPaymentData: additionalData?.paymentData, userAddress: additionalData?.walletAddress, userId }); @@ -1092,87 +1111,71 @@ export class RampService extends BaseRampService { return { stateMeta: stateMeta as Partial, unsignedTxs }; } - private async prepareMoneriumOnrampTransactions( + private async prepareMykoboOnrampTransactions( quote: QuoteTicket, normalizedSigningAccounts: AccountMeta[], - additionalData: RegisterRampRequest["additionalData"] + additionalData: RegisterRampRequest["additionalData"], + userId?: string ): Promise<{ unsignedTxs: UnsignedTx[]; stateMeta: Partial; - depositQrCode: string; ibanPaymentData?: IbanPaymentData; }> { - if ( - !additionalData || - !additionalData.moneriumAuthToken || - !additionalData.destinationAddress || - !additionalData.moneriumWalletAddress - ) { + if (!additionalData?.destinationAddress || !additionalData?.email || !additionalData?.ipAddress) { throw new APIError({ - message: "Parameters moneriumAuthToken, destinationAddress and moneriumWalletAddress are required for Monerium onramp", + message: "Parameters destinationAddress, email and ipAddress are required for Mykobo EUR onramp", status: httpStatus.BAD_REQUEST }); } - try { - // Validate the user mint address - const ibanData = await getIbanForAddress( - additionalData.moneriumWalletAddress, - additionalData.moneriumAuthToken, - quote.to as EvmNetworks // Fixme: assethub network type issue. - ); - - const params: MoneriumOnrampTransactionParams = { - destinationAddress: additionalData.destinationAddress, - moneriumWalletAddress: additionalData.moneriumWalletAddress, - quote, - signingAccounts: normalizedSigningAccounts - }; - - const { unsignedTxs, stateMeta } = await prepareOnrampTransactions(params); - - const ibanPaymentData = { - bic: ibanData.bic, - iban: ibanData.iban, - receiverName: ibanData.name - }; - - const ibanCode = createEpcQrCodeData({ - amount: quote.inputAmount, - bic: ibanData.bic, - iban: ibanData.iban, - name: ibanData.name + const evmEphemeralEntry = normalizedSigningAccounts.find(account => account.type === "EVM"); + if (!evmEphemeralEntry) { + throw new APIError({ + message: "EVM ephemeral account is required for Mykobo EUR onramp", + status: httpStatus.BAD_REQUEST }); - return { depositQrCode: ibanCode, ibanPaymentData, stateMeta: stateMeta as Partial, unsignedTxs }; - } catch (error) { - if (error instanceof Error && error.message.includes(MoneriumErrors.USER_MINT_ADDRESS_NOT_FOUND)) { - throw new APIError({ - message: MoneriumErrors.USER_MINT_ADDRESS_NOT_FOUND, - status: httpStatus.BAD_REQUEST - }); - } - throw error; } - } - private async prepareMoneriumOfframpTransactions( - quote: QuoteTicket, - normalizedSigningAccounts: AccountMeta[], - additionalData: RegisterRampRequest["additionalData"] - ): Promise<{ unsignedTxs: UnsignedTx[]; stateMeta: Partial }> { - if (!additionalData || additionalData.walletAddress === undefined || !additionalData.moneriumAuthToken) { + const mykobo = MykoboApiService.getInstance(); + const intent = await mykobo.createTransactionIntent({ + currency: MykoboCurrency.EURC, + email_address: additionalData.email, + ip_address: additionalData.ipAddress, + transaction_type: MykoboTransactionType.DEPOSIT, + value: new Big(quote.inputAmount).toFixed(2, 0), + wallet_address: evmEphemeralEntry.address + }); + + const instructions = intent.instructions; + if (!instructions || !("iban" in instructions)) { throw new APIError({ - message: "Parameters walletAddress and moneriumAuthToken is required for Monerium onramp", - status: httpStatus.BAD_REQUEST + message: "Mykobo deposit intent did not return IBAN instructions", + status: httpStatus.BAD_GATEWAY }); } - const { unsignedTxs, stateMeta } = await prepareOfframpTransactions({ - moneriumAuthToken: additionalData.moneriumAuthToken, + + const { unsignedTxs, stateMeta } = await prepareMykoboToEvmOnrampTransactions({ + destinationAddress: additionalData.destinationAddress, + ipAddress: additionalData.ipAddress, + mykoboEmail: additionalData.email, + mykoboTransactionId: intent.transaction.id, + mykoboTransactionReference: intent.transaction.reference, quote, - signingAccounts: [], - userAddress: additionalData.walletAddress + signingAccounts: normalizedSigningAccounts }); - return { stateMeta: stateMeta as Partial, unsignedTxs }; + + const ibanPaymentData: IbanPaymentData = { + bic: "", + iban: instructions.iban, + receiverName: instructions.bank_account_name, + reference: intent.transaction.reference + }; + + if (userId) { + await syncMykoboCustomerKyc(userId, additionalData.email); + } + + return { ibanPaymentData, stateMeta: stateMeta as Partial, unsignedTxs }; } private async prepareRampTransactions( @@ -1180,6 +1183,7 @@ export class RampService extends BaseRampService { normalizedSigningAccounts: AccountMeta[], additionalData: RegisterRampRequest["additionalData"], signingAccounts: AccountMeta[], + transaction: Transaction, userId?: string ): Promise<{ unsignedTxs: UnsignedTx[]; @@ -1192,14 +1196,11 @@ export class RampService extends BaseRampService { case RampTransactionPreparationKind.OfframpBrl: return this.prepareOfframpBrlTransactions(quote, normalizedSigningAccounts, additionalData); - case RampTransactionPreparationKind.OfframpMonerium: - return this.prepareMoneriumOfframpTransactions(quote, normalizedSigningAccounts, additionalData); - case RampTransactionPreparationKind.OfframpNonBrl: - return this.prepareOfframpNonBrlTransactions(quote, normalizedSigningAccounts, additionalData, userId); + return this.prepareOfframpNonBrlTransactions(quote, normalizedSigningAccounts, additionalData, transaction, userId); - case RampTransactionPreparationKind.OnrampMonerium: - return this.prepareMoneriumOnrampTransactions(quote, normalizedSigningAccounts, additionalData); + case RampTransactionPreparationKind.OnrampMykobo: + return this.prepareMykoboOnrampTransactions(quote, normalizedSigningAccounts, additionalData, userId); case RampTransactionPreparationKind.OnrampAlfredpay: return this.prepareAlfredpayOnrampTransactions(quote, normalizedSigningAccounts, additionalData, userId); @@ -1212,7 +1213,6 @@ export class RampService extends BaseRampService { private async ephemeralPresignChecksPass(rampState: RampState): Promise { const ephemerals: { [key in EphemeralAccountType]: string } = { EVM: rampState.state.evmEphemeralAddress, - Stellar: rampState.state.stellarEphemeralAccountId, Substrate: rampState.state.substrateEphemeralAddress }; @@ -1229,7 +1229,6 @@ export class RampService extends BaseRampService { const ephemerals: { [key in EphemeralAccountType]: string } = { EVM: rampState.state.evmEphemeralAddress, - Stellar: rampState.state.stellarEphemeralAccountId, Substrate: rampState.state.substrateEphemeralAddress }; @@ -1260,42 +1259,15 @@ export class RampService extends BaseRampService { message: `Missing required additional data 'assethubToPendulumHash' for ${rampState.type} ramp. Cannot proceed.`, status: httpStatus.BAD_REQUEST }); - } else if (rampState.from !== Networks.AssetHub && !rampState.state.squidRouterSwapHash) { - throw new APIError({ - message: `Missing required additional data 'squidRouterSwapHash' for ${rampState.type} ramp. Cannot proceed.`, - status: httpStatus.BAD_REQUEST - }); - } - } - - if (rampState.type === RampDirection.BUY && quote.inputCurrency === FiatToken.EURC) { - if (!rampState.state.moneriumOnrampPermit) { - throw new APIError({ - message: "Missing moneriumOnrampPermit in state. Cannot proceed.", - status: httpStatus.BAD_REQUEST - }); - } - if (!quote.metadata.moneriumMint?.outputAmountRaw) { - throw new APIError({ - message: "Missing moneriumMint.outputAmountRaw in quote metadata. Cannot validate Monerium onramp permit.", - status: httpStatus.BAD_REQUEST - }); - } - if (!rampState.state.moneriumWalletAddress || !rampState.state.evmEphemeralAddress) { - throw new APIError({ - message: "Missing Monerium wallet or EVM ephemeral address in state. Cannot validate Monerium onramp permit.", - status: httpStatus.BAD_REQUEST - }); + } else if (rampState.from !== Networks.AssetHub) { + const requiresSquidSwapHash = rampState.unsignedTxs.some(tx => tx.phase === "squidRouterSwap"); + if (requiresSquidSwapHash && !rampState.state.squidRouterSwapHash) { + throw new APIError({ + message: `Missing required additional data 'squidRouterSwapHash' for ${rampState.type} ramp. Cannot proceed.`, + status: httpStatus.BAD_REQUEST + }); + } } - - validateMoneriumOnrampPermit(rampState.state.moneriumOnrampPermit, { - expectedOwner: rampState.state.moneriumWalletAddress, - expectedSpender: rampState.state.evmEphemeralAddress, - expectedTokenAddress: ERC20_EURE_POLYGON_V2, - expectedTokenName: ERC20_EURE_POLYGON_TOKEN_NAME, - expectedValueRaw: quote.metadata.moneriumMint.outputAmountRaw, - network: Networks.Polygon - }); } } @@ -1312,6 +1284,8 @@ export class RampService extends BaseRampService { throw new Error("Ramp not found."); } + RampService.assertOwnedByThisFlow(rampState, "Ramp"); + await this.updateRampState(id, { currentPhase: "timedOut" }); @@ -1337,6 +1311,8 @@ export class RampService extends BaseRampService { throw new Error(`RampState with id ${id} not found`); } + RampService.assertOwnedByThisFlow(rampState, "Ramp"); + const oldPhase = rampState.currentPhase; await super.logPhaseTransition(id, newPhase, metadata); @@ -1491,6 +1467,61 @@ export class RampService extends BaseRampService { } } + private async refreshAlfredpayOfframpQuoteIfMatching( + quote: QuoteTicket, + originalAlfredpayOfframp: NonNullable, + toCurrency: AlfredpayFiatCurrency, + transaction: Transaction + ): Promise { + const alfredpayService = AlfredpayApiService.getInstance(); + const originalQuoteId = originalAlfredpayOfframp.quoteId; + + const freshQuote = await alfredpayService.createOfframpQuote({ + chain: AlfredpayChain.MATIC, + fromAmount: originalAlfredpayOfframp.inputAmountDecimal.toString(), + fromCurrency: ALFREDPAY_ONCHAIN_CURRENCY, + metadata: { businessId: "vortex", customerId: quote.userId || "unknown" }, + paymentMethodType: AlfredpayPaymentMethodType.BANK, + toCurrency + } satisfies CreateAlfredpayOfframpQuoteRequest); + + const originalToAmount = new Big(originalAlfredpayOfframp.outputAmountDecimal as unknown as string); + const freshToAmount = new Big(freshQuote.toAmount); + + const originalFee = new Big(originalAlfredpayOfframp.fee as unknown as string); + const freshFee = AlfredpayApiService.sumFeesByCurrency(freshQuote.fees, toCurrency); + + if (!freshToAmount.eq(originalToAmount) || !freshFee.eq(originalFee)) { + throw new APIError({ + message: + `[refreshAlfredpayOfframpQuote] Quote ${quote.id}: refreshed Alfredpay offramp quote drifted. ` + + `toAmount original=${originalToAmount.toString()} fresh=${freshToAmount.toString()}, ` + + `fee original=${originalFee.toString()} fresh=${freshFee.toString()}. ` + + "Cannot proceed with offramp order.", + status: httpStatus.INTERNAL_SERVER_ERROR + }); + } + + await quote.update( + { + metadata: { + ...quote.metadata, + alfredpayOfframp: { + ...originalAlfredpayOfframp, + expirationDate: new Date(freshQuote.expiration), + quoteId: freshQuote.quoteId + } + } + }, + { transaction } + ); + + logger.info( + `[refreshAlfredpayOfframpQuote] Quote ${quote.id}: swapped Alfredpay offramp quote ${originalQuoteId} -> ${freshQuote.quoteId}.` + ); + return freshQuote.quoteId; + } + private async processAlfredpayOfframpStart( rampState: RampState, quote: QuoteTicket, @@ -1500,7 +1531,6 @@ export class RampService extends BaseRampService { return; } - const alfredpayService = AlfredpayApiService.getInstance(); const alfredpayQuoteId = quote.metadata.alfredpayOfframp?.quoteId; if (!alfredpayQuoteId) { diff --git a/apps/api/src/api/services/sep10/helpers.ts b/apps/api/src/api/services/sep10/helpers.ts deleted file mode 100644 index a64a71d07..000000000 --- a/apps/api/src/api/services/sep10/helpers.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { TOKEN_CONFIG } from "@vortexfi/shared"; -import { Operation, Transaction } from "stellar-sdk"; - -interface TokenConfig { - tomlFileUrl: string; - homeDomain: string; - clientDomainEnabled: boolean; - memoEnabled: boolean; -} - -export const getOutToken = (outToken: keyof typeof TOKEN_CONFIG): TokenConfig => TOKEN_CONFIG[outToken] as TokenConfig; - -export const validateTransaction = (transaction: Transaction, anchorSigningKey: string, memo: string | null) => { - if (transaction.source !== anchorSigningKey) { - throw new Error(`Invalid source account: ${transaction.source}`); - } - if (transaction.sequence !== "0") { - throw new Error(`Invalid sequence number: ${transaction.sequence}`); - } - if (transaction.memo.value !== memo) { - throw new Error("Memo does not match with specified user signature or address. Could not validate."); - } -}; - -export const validateFirstOperation = ( - operation: Operation, - clientPublicKey: string, - homeDomain: string, - memo: string | null, - memoEnabled: boolean, - masterPublicKey: string -) => { - if (operation.type !== "manageData") { - throw new Error("The first operation should be manageData"); - } - - if (operation.source !== clientPublicKey) { - throw new Error("First manageData operation must have the client account as the source"); - } - - if (memo !== null && memoEnabled) { - if (operation.source !== masterPublicKey) { - throw new Error("First manageData operation must have the master signing key as the source when memo is being used."); - } - } - - if (operation.name !== `${homeDomain} auth`) { - throw new Error(`First manageData operation should have key '${homeDomain} auth'`); - } - if (!operation.value || operation.value.length !== 64) { - throw new Error("First manageData operation should have a 64-byte random nonce as value"); - } -}; - -export const validateRemainingOperations = ( - operations: Operation[], - anchorSigningKey: string, - clientDomainPublicKey: string, - clientDomainEnabled: boolean -) => { - let hasWebAuthDomain = false; - let hasClientDomain = false; - - for (let i = 1; i < operations.length; i++) { - const op = operations[i]; - - if (op.type !== "manageData") { - throw new Error("All operations should be manage_data operations"); - } - - if (op.name === "web_auth_domain") { - hasWebAuthDomain = true; - if (op.source !== anchorSigningKey) { - throw new Error("web_auth_domain manage_data operation must have the server account as the source"); - } - } - - if (op.name === "client_domain") { - hasClientDomain = true; - if (op.source !== clientDomainPublicKey) { - throw new Error("client_domain manage_data operation must have the client domain account as the source"); - } - } - } - - if (!hasWebAuthDomain) { - throw new Error("Transaction must contain a web_auth_domain manageData operation"); - } - if (!hasClientDomain && clientDomainEnabled) { - throw new Error("Transaction must contain a client_domain manageData operation"); - } -}; diff --git a/apps/api/src/api/services/sep10/sep10.service.ts b/apps/api/src/api/services/sep10/sep10.service.ts deleted file mode 100644 index b51b0c17e..000000000 --- a/apps/api/src/api/services/sep10/sep10.service.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { FiatToken, TOKEN_CONFIG } from "@vortexfi/shared"; -import { Keypair, Networks, Transaction, TransactionBuilder } from "stellar-sdk"; -import { config, SEP10_MASTER_SECRET } from "../../../config/vars"; -import { fetchTomlValues } from "../../helpers/anchors"; -import { getOutToken, validateFirstOperation, validateRemainingOperations, validateTransaction } from "./helpers"; - -const NETWORK_PASSPHRASE = config.sandboxEnabled ? Networks.TESTNET : Networks.PUBLIC; - -interface TomlValues { - signingKey: string; -} - -interface Sep10Response { - clientSignature?: string; - clientPublic: string; - masterClientSignature?: string; - masterClientPublic: string; -} - -export const signSep10Challenge = async ( - challengeXDR: string, - fiatToken: FiatToken, - clientPublicKey: string, - memo: string | null -): Promise => { - if (!SEP10_MASTER_SECRET || !config.secrets.clientDomainSecret) { - throw new Error("Missing required secrets"); - } - const masterStellarKeypair = Keypair.fromSecret(SEP10_MASTER_SECRET); - const clientDomainStellarKeypair = Keypair.fromSecret(config.secrets.clientDomainSecret); - - // Map FiatToken enum values to TOKEN_CONFIG keys - const tokenMapping: Record = { - [FiatToken.EURC]: "EURC", - [FiatToken.ARS]: "ARS", - [FiatToken.BRL]: "BRL", - [FiatToken.USD]: "USDC", - [FiatToken.MXN]: "USDC", - [FiatToken.COP]: "USDC" - }; - - const outToken = tokenMapping[fiatToken]; - - const outTokenConfig = getOutToken(outToken); - const { signingKey: anchorSigningKey } = (await fetchTomlValues(outTokenConfig.tomlFileUrl)) as TomlValues; - const { homeDomain, clientDomainEnabled, memoEnabled } = outTokenConfig; - const transactionSigned = TransactionBuilder.fromXDR(challengeXDR, NETWORK_PASSPHRASE); - - if (!(transactionSigned instanceof Transaction)) { - throw new Error("Expected a Transaction, got a FeeBumpTransaction"); - } - - validateTransaction(transactionSigned, anchorSigningKey, memo); - - const { operations } = transactionSigned; - validateFirstOperation(operations[0], clientPublicKey, homeDomain, memo, memoEnabled, masterStellarKeypair.publicKey()); - - validateRemainingOperations(operations, anchorSigningKey, clientDomainStellarKeypair.publicKey(), clientDomainEnabled); - - const clientDomainSignature = clientDomainEnabled - ? transactionSigned.getKeypairSignature(clientDomainStellarKeypair) - : undefined; - - const masterClientSignature = - memo !== null && memoEnabled ? transactionSigned.getKeypairSignature(masterStellarKeypair) : undefined; - - return { - clientPublic: clientDomainStellarKeypair.publicKey(), - clientSignature: clientDomainSignature, - masterClientPublic: masterStellarKeypair.publicKey(), - masterClientSignature - }; -}; diff --git a/apps/api/src/api/services/stellar.service.ts b/apps/api/src/api/services/stellar.service.ts deleted file mode 100644 index 8ad2b4436..000000000 --- a/apps/api/src/api/services/stellar.service.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { getTokenConfigByAssetCode, HORIZON_URL, StellarTokenConfig, TOKEN_CONFIG } from "@vortexfi/shared"; -import { Asset, Horizon, Keypair, Networks, Operation, TransactionBuilder } from "stellar-sdk"; -import { config } from "../../config/vars"; -import { STELLAR_EPHEMERAL_STARTING_BALANCE_UNITS } from "../../constants/constants"; - -interface CreationTxResult { - signature: string; - sequence: string; -} - -// Constants -export const horizonServer = new Horizon.Server(HORIZON_URL); -const NETWORK_PASSPHRASE = config.sandboxEnabled ? Networks.TESTNET : Networks.PUBLIC; - -async function buildCreationStellarTx( - fundingSecret: string, - ephemeralAccountId: string, - maxTime: number, - assetCode: string, - baseFee: string -): Promise { - const tokenConfig = getTokenConfigByAssetCode(TOKEN_CONFIG, assetCode) as StellarTokenConfig; - if (!tokenConfig) { - throw new Error("Invalid asset id or configuration not found"); - } - - const fundingAccountKeypair = Keypair.fromSecret(fundingSecret); - const fundingAccountId = fundingAccountKeypair.publicKey(); - const fundingAccount = await horizonServer.loadAccount(fundingAccountId); - const fundingSequence = fundingAccount.sequence; - // add a setOption oeration in order to make this a 2-of-2 multisig account where the - // funding account is a cosigner - const createAccountTransaction = new TransactionBuilder(fundingAccount, { - fee: baseFee, - networkPassphrase: NETWORK_PASSPHRASE - }) - .addOperation( - Operation.createAccount({ - destination: ephemeralAccountId, - startingBalance: STELLAR_EPHEMERAL_STARTING_BALANCE_UNITS - }) - ) - .addOperation( - Operation.setOptions({ - highThreshold: 2, - lowThreshold: 2, - medThreshold: 2, - signer: { ed25519PublicKey: fundingAccountId, weight: 1 }, - source: ephemeralAccountId - }) - ) - .addOperation( - Operation.changeTrust({ - asset: new Asset(tokenConfig.assetCode, tokenConfig.assetIssuer), - source: ephemeralAccountId - }) - ) - .setTimebounds(0, maxTime) - .build(); - - return { - sequence: fundingSequence, - signature: createAccountTransaction.getKeypairSignature(fundingAccountKeypair) - }; -} - -export { buildCreationStellarTx }; diff --git a/apps/api/src/api/services/stellar/checkBalance.ts b/apps/api/src/api/services/stellar/checkBalance.ts deleted file mode 100644 index 70f975263..000000000 --- a/apps/api/src/api/services/stellar/checkBalance.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { HORIZON_URL } from "@vortexfi/shared"; -import Big from "big.js"; -import { Horizon } from "stellar-sdk"; - -import logger from "../../../config/logger"; - -export function checkBalancePeriodically( - stellarTargetAccountId: string, - stellarAssetCode: string, - amountDesiredUnitsBig: Big, - intervalMs: number, - timeoutMs: number -) { - return new Promise((resolve, reject) => { - const startTime = Date.now(); - const intervalId = setInterval(async () => { - try { - const someBalanceUnits = await getStellarBalanceUnits(stellarTargetAccountId, stellarAssetCode); - logger.info(`Balance check: ${someBalanceUnits.toString()} / ${amountDesiredUnitsBig.toString()}`); - - if (someBalanceUnits.gte(amountDesiredUnitsBig)) { - clearInterval(intervalId); - resolve(someBalanceUnits); - } else if (Date.now() - startTime > timeoutMs) { - clearInterval(intervalId); - reject(new Error(`Balance did not meet the limit within the specified time (${timeoutMs} ms)`)); - } - } catch (error) { - logger.error("Error checking balance:", error); - // Don't clear the interval here, allow it to continue checking - } - }, intervalMs); - - // Set a timeout to reject the promise if the total time exceeds timeoutMs - setTimeout(() => { - clearInterval(intervalId); - reject(new Error(`Balance did not meet the limit within the specified time (${timeoutMs} ms)`)); - }, timeoutMs); - }); -} - -const getStellarBalanceUnits = async (publicKey: string, assetCode: string): Promise => { - try { - const server = new Horizon.Server(HORIZON_URL); - const account = await server.loadAccount(publicKey); - let balanceUnits = "0"; - account.balances.forEach(balance => { - if (balance.asset_type === "credit_alphanum4" && balance.asset_code === assetCode) { - balanceUnits = balance.balance; - } - }); - - return new Big(balanceUnits); - } catch (error) { - logger.error(error); - throw new Error("Error Reading Stellar Balance"); - } -}; diff --git a/apps/api/src/api/services/stellar/getVaults.ts b/apps/api/src/api/services/stellar/getVaults.ts deleted file mode 100644 index 8b6bd866f..000000000 --- a/apps/api/src/api/services/stellar/getVaults.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { SpacewalkPrimitivesVaultId } from "@pendulum-chain/types/interfaces"; -import { ApiPromise } from "@polkadot/api"; -import { Option, Struct } from "@polkadot/types-codec"; -import Big from "big.js"; - -import logger from "../../../config/logger"; - -interface VaultRegistryVault extends Struct { - readonly id: SpacewalkPrimitivesVaultId; - readonly issuedTokens: number; // u128 - readonly toBeRedeemedTokens: number; // u128 -} - -function vaultHasEnoughRedeemable(vault: VaultRegistryVault, redeemableAmount: string): boolean { - const redeemableTokens = new Big(vault.issuedTokens).sub(new Big(vault.toBeRedeemedTokens)); - if (redeemableTokens.gt(new Big(redeemableAmount))) { - return true; - } - return false; -} - -export async function getVaultsForCurrency( - api: ApiPromise, - assetCodeHex: string, - assetIssuerHex: string, - redeemableAmountRaw: string -) { - const vaultEntries = await api.query.vaultRegistry.vaults.entries(); - const vaults = vaultEntries.map(([_, value]) => (value as Option).unwrap()); - - const vaultsForCurrency = vaults.filter( - vault => - // toString returns the hex string - // toHuman returns the hex string if the string has length < 4, otherwise the readable string - vault.id.currencies.wrapped.isStellar && - vault.id.currencies.wrapped.asStellar.isAlphaNum4 && - vault.id.currencies.wrapped.asStellar.asAlphaNum4.code.toString() === assetCodeHex && - vault.id.currencies.wrapped.asStellar.asAlphaNum4.issuer.toString() === assetIssuerHex && - vaultHasEnoughRedeemable(vault, redeemableAmountRaw) - ); - - if (vaultsForCurrency.length === 0) { - const errorMessage = `No vaults found for currency ${assetCodeHex} and amount ${redeemableAmountRaw}`; - logger.error(errorMessage); - throw new Error(errorMessage); - } - - return vaultsForCurrency; -} diff --git a/apps/api/src/api/services/stellar/loadAccount.ts b/apps/api/src/api/services/stellar/loadAccount.ts deleted file mode 100644 index 76901bc0f..000000000 --- a/apps/api/src/api/services/stellar/loadAccount.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { HORIZON_URL } from "@vortexfi/shared"; -import { Horizon } from "stellar-sdk"; -import logger from "../../../config/logger"; - -const horizonServer = new Horizon.Server(HORIZON_URL); - -export async function loadAccountWithRetry( - ephemeralAccountId: string, - retries = 3, - timeout = 15000 -): Promise { - let lastError: Error | null = null; - - const loadAccountWithTimeout = (accountId: string, timeout: number): Promise => - Promise.race([ - horizonServer.loadAccount(accountId), - new Promise((_, reject) => setTimeout(() => reject(new Error("Timeout")), timeout)) - ]); - - for (let i = 0; i < retries; i++) { - try { - return await loadAccountWithTimeout(ephemeralAccountId, timeout); - } catch (err: unknown) { - if (err instanceof Error && err.toString().includes("NotFoundError")) { - // The account does not exist - return null; - } - logger.info(`Attempt ${i + 1} to load account ${ephemeralAccountId} failed: ${err}`); - lastError = err as Error; - } - } - - throw new Error(`Failed to load account ${ephemeralAccountId} after ${retries} attempts: ${lastError?.toString()}`); -} diff --git a/apps/api/src/api/services/stellar/vaultService.ts b/apps/api/src/api/services/stellar/vaultService.ts deleted file mode 100644 index 577438e72..000000000 --- a/apps/api/src/api/services/stellar/vaultService.ts +++ /dev/null @@ -1,110 +0,0 @@ -import { SpacewalkPrimitivesVaultId } from "@pendulum-chain/types/interfaces"; -import { SubmittableExtrinsic } from "@polkadot/api/promise/types"; -import { DispatchError, EventRecord } from "@polkadot/types/interfaces"; -import { ISubmittableResult } from "@polkadot/types/types"; -import { API, getAddressForFormat, parseEventRedeemRequest, SpacewalkRedeemRequestEvent } from "@vortexfi/shared"; -import logger from "../../../config/logger"; -import { getVaultsForCurrency } from "./getVaults"; - -export async function createVaultService( - apiComponents: API, - assetCodeHex: string, - assetIssuerHex: string, - redeemAmountRaw: string -) { - const { api, ss58Format, decimals } = apiComponents; - // we expect the list to have at least one vault, otherwise getVaultsForCurrency would throw - const vaultsForCurrency = await getVaultsForCurrency(api, assetCodeHex, assetIssuerHex, redeemAmountRaw); - const targetVaultId = vaultsForCurrency[0].id; - return new VaultService(targetVaultId, { api, decimals, ss58Format }); -} - -export class VaultService { - vaultId: SpacewalkPrimitivesVaultId; - - apiComponents: API; - - constructor(vaultId: SpacewalkPrimitivesVaultId, apiComponents: API) { - this.vaultId = vaultId; - this.apiComponents = apiComponents; - } - - async createRequestRedeemExtrinsic(amountRaw: string, stellarPkBytesBuffer: Buffer) { - const stellarPkBytes = Uint8Array.from(stellarPkBytesBuffer); - return this.apiComponents.api.tx.redeem.requestRedeem(amountRaw, stellarPkBytes, this.vaultId); - } - - async submitRedeem(senderAddress: string, extrinsic: SubmittableExtrinsic): Promise { - return new Promise((resolve, reject) => { - extrinsic - .send((submissionResult: ISubmittableResult) => { - const { status, events, dispatchError } = submissionResult; - - if (status.isFinalized) { - logger.info(`Requested redeem for vault ${this.vaultId} with status ${status.type}`); - - // Try to find a 'system.ExtrinsicFailed' event - const systemExtrinsicFailedEvent = events.find( - record => record.event.section === "system" && record.event.method === "ExtrinsicFailed" - ); - - if (dispatchError) { - reject(this.handleDispatchError(dispatchError, systemExtrinsicFailedEvent, "Redeem Request")); - } - // find all redeem request events and filter the one that matches the requester - const redeemEvents = events.filter( - event => event.event.section.toLowerCase() === "redeem" && event.event.method.toLowerCase() === "requestredeem" - ); - - const event = redeemEvents - .map(event => parseEventRedeemRequest(event)) - .filter(event => event.redeemer === getAddressForFormat(senderAddress, this.apiComponents?.ss58Format)); - - if (event.length === 0) { - reject(new Error(`No redeem event found for account ${senderAddress}`)); - } - // we should only find one event corresponding to the issue request - if (event.length !== 1) { - reject(new Error("Inconsistent amount of redeem request events for account")); - } - resolve(event[0]); - } - }) - .catch(error => { - reject(new Error(`Failed to request redeem: ${error}`)); - }); - }); - } - - // We first check if dispatchError is of type "module", - // If not we either return ExtrinsicFailedError or Unknown dispatch error - handleDispatchError( - dispatchError: DispatchError, - systemExtrinsicFailedEvent: EventRecord | undefined, - extrinsicCalled: unknown - ) { - if (dispatchError?.isModule) { - const decoded = this.apiComponents?.api.registry.findMetaError(dispatchError.asModule); - const { name, section, method } = decoded; - - return new Error(`Dispatch error: ${section}.${method}:: ${name}`); - } - if (systemExtrinsicFailedEvent) { - const eventName = - systemExtrinsicFailedEvent?.event.data && systemExtrinsicFailedEvent?.event.data.length > 0 - ? systemExtrinsicFailedEvent?.event.data[0].toString() - : "Unknown"; - - const { - phase, - event: { method, section } - } = systemExtrinsicFailedEvent; - logger.error(`Extrinsic failed in phase ${phase.toString()} with ${section}.${method}:: ${eventName}`); - - return new Error(`Failed to dispatch ${extrinsicCalled}`); - } - - logger.error("Encountered some other error: ", dispatchError?.toString(), JSON.stringify(dispatchError)); - return new Error(`Unknown error during ${extrinsicCalled}`); - } -} diff --git a/apps/api/src/api/services/transactions/common/feeDistribution.ts b/apps/api/src/api/services/transactions/common/feeDistribution.ts index 730ae2be0..57439cf90 100644 --- a/apps/api/src/api/services/transactions/common/feeDistribution.ts +++ b/apps/api/src/api/services/transactions/common/feeDistribution.ts @@ -24,6 +24,10 @@ import { QuoteTicketAttributes } from "../../../../models/quoteTicket.model"; import { multiplyByPowerOfTen } from "../../pendulum/helpers"; import { getZenlinkIdForAsset } from "../../zenlink"; +function getQuotePricingPartnerId(quote: QuoteTicketAttributes): string | null { + return quote.pricingPartnerId ?? quote.partnerId ?? null; +} + /** * Creates a pre-signed fee distribution transaction for the distribute-fees-handler phase. * This is shared between onramp and offramp flows. @@ -71,10 +75,11 @@ export async function createSubstrateFeeDistributionTransaction(quote: QuoteTick } const vortexPayoutAddress = vortexPartner.payoutAddressSubstrate; + const pricingPartnerId = getQuotePricingPartnerId(quote); let partnerPayoutAddress = null; - if (quote.partnerId) { + if (pricingPartnerId) { const quotePartner = await Partner.findOne({ - where: { id: quote.partnerId, isActive: true, rampType: quote.rampType } + where: { id: pricingPartnerId, isActive: true, rampType: quote.rampType } }); if (quotePartner && quotePartner.payoutAddressSubstrate) { partnerPayoutAddress = quotePartner.payoutAddressSubstrate; @@ -249,10 +254,11 @@ export async function createEvmFeeDistributionTransaction(quote: QuoteTicketAttr const vortexPayoutAddress = vortexPartner.payoutAddressEvm ?? (config.defaults.vortexEvmPayoutAddress as string); // Look up partner EVM payout address for markup split + const pricingPartnerId = getQuotePricingPartnerId(quote); let partnerPayoutAddressEvm: string | null = null; - if (quote.partnerId) { + if (pricingPartnerId) { const quotePartner = await Partner.findOne({ - where: { id: quote.partnerId, isActive: true, rampType: quote.rampType } + where: { id: pricingPartnerId, isActive: true, rampType: quote.rampType } }); if (quotePartner?.payoutAddressEvm) { partnerPayoutAddressEvm = quotePartner.payoutAddressEvm; @@ -261,7 +267,7 @@ export async function createEvmFeeDistributionTransaction(quote: QuoteTicketAttr if (Big(partnerMarkupFeeUSD).gt(0) && partnerPayoutAddressEvm === null) { logger.warn( - `EVM FEE DISTRIBUTION: partner markup of ${partnerMarkupFeeUSD.toString()} USD will be DROPPED for quote ${quote.id} (partnerId=${quote.partnerId ?? "none"}, rampType=${quote.rampType}); 'payout_address_evm' is not set on the partner row.` + `EVM FEE DISTRIBUTION: partner markup of ${partnerMarkupFeeUSD.toString()} USD will be DROPPED for quote ${quote.id} (pricingPartnerId=${pricingPartnerId ?? "none"}, ownerPartnerId=${quote.partnerId ?? "none"}, rampType=${quote.rampType}); 'payout_address_evm' is not set on the partner row.` ); } diff --git a/apps/api/src/api/services/transactions/offramp/common/transactions.ts b/apps/api/src/api/services/transactions/offramp/common/transactions.ts index 01935ebc8..03328188d 100644 --- a/apps/api/src/api/services/transactions/offramp/common/transactions.ts +++ b/apps/api/src/api/services/transactions/offramp/common/transactions.ts @@ -11,21 +11,16 @@ import { EvmTransactionData, encodeSubmittableExtrinsic, Networks, - PaymentData, PendulumTokenDetails, - StellarTokenDetails, UnsignedTx } from "@vortexfi/shared"; import Big from "big.js"; -import { Keypair } from "stellar-sdk"; import { encodeFunctionData } from "viem"; import { config } from "../../../../../config/vars"; import erc20ABI from "../../../../../contracts/ERC20"; import { QuoteTicketAttributes } from "../../../../../models/quoteTicket.model"; import { StateMetadata } from "../../../phases/meta-state-types"; import { encodeEvmTransactionData } from "../../index"; -import { prepareSpacewalkRedeemTransaction } from "../../spacewalk/redeem"; -import { buildPaymentAndMergeTx } from "../../stellar/offrampTransaction"; /** * Creates transactions for EVM source networks using Squidrouter or mock transactions in sandbox @@ -251,161 +246,6 @@ export async function createBRLTransactions( }; } -/** - * Creates Stellar-specific transactions for Spacewalk redeem - * @param params Transaction parameters - * @param unsignedTxs Array to add transactions to - * @param pendulumCleanupTx Cleanup transaction template - * @param nextNonce Next available nonce - * @returns Updated nonce and state metadata - */ -export async function createSpacewalkTransactions( - params: { - outputAmountRaw: string; - stellarEphemeralEntry: AccountMeta; - outputTokenDetails: StellarTokenDetails; - account: AccountMeta; - stellarPaymentData: PaymentData; - }, - unsignedTxs: UnsignedTx[], - pendulumCleanupTx: Omit, - nextNonce: number -): Promise<{ nextNonce: number; stateMeta: Partial }> { - const { outputAmountRaw, stellarEphemeralEntry, outputTokenDetails, account, stellarPaymentData } = params; - - const stellarEphemeralAccountRaw = Keypair.fromPublicKey(stellarEphemeralEntry.address).rawPublicKey(); - const spacewalkRedeemTransaction = await prepareSpacewalkRedeemTransaction({ - executeSpacewalkNonce: nextNonce, - outputAmountRaw: outputAmountRaw, - outputTokenDetails, - stellarEphemeralAccountRaw - }); - - unsignedTxs.push({ - meta: {}, - network: Networks.Pendulum, - nonce: nextNonce, - phase: "spacewalkRedeem", - signer: account.address, - txData: encodeSubmittableExtrinsic(spacewalkRedeemTransaction) - }); - const executeSpacewalkNonce = nextNonce; - nextNonce++; - - // Add the cleanup transaction with the next nonce - unsignedTxs.push({ - ...pendulumCleanupTx, - nonce: nextNonce - }); - nextNonce++; - - return { - nextNonce, - stateMeta: { - executeSpacewalkNonce, - stellarEphemeralAccountId: stellarEphemeralEntry.address, - stellarTarget: { - stellarTargetAccountId: stellarPaymentData.anchorTargetAccount, - stellarTokenDetails: outputTokenDetails - } - } - }; -} - -/** - * Creates Stellar payment and merge transactions - * @param params Transaction parameters - * @param unsignedTxs Array to add transactions to - */ -export async function createStellarPaymentTransactions( - params: { - ephemeralAddress: string; - outputAmountUnits: Big; - outputTokenDetails: StellarTokenDetails; - stellarPaymentData: PaymentData; - }, - unsignedTxs: UnsignedTx[] -): Promise { - const { ephemeralAddress, outputAmountUnits, outputTokenDetails, stellarPaymentData } = params; - - const { paymentTransactions, mergeAccountTransactions, createAccountTransactions, expectedSequenceNumbers } = - await buildPaymentAndMergeTx({ - amountToAnchorUnits: outputAmountUnits.toFixed(), - ephemeralAccountId: ephemeralAddress, - paymentData: stellarPaymentData, - tokenConfigStellar: outputTokenDetails - }); - - const createAccountPrimaryTx: UnsignedTx = { - meta: { - expectedSequenceNumber: expectedSequenceNumbers[0] - }, - network: Networks.Stellar, - nonce: 0, - phase: "stellarCreateAccount", - signer: ephemeralAddress, - txData: createAccountTransactions[0].tx - }; - - const paymentTransactionPrimary: UnsignedTx = { - meta: { - expectedSequenceNumber: expectedSequenceNumbers[0] - }, - network: Networks.Stellar, - nonce: 1, - phase: "stellarPayment", - signer: ephemeralAddress, - txData: paymentTransactions[0].tx - }; - - const mergeAccountTransactionPrimary: UnsignedTx = { - meta: { - expectedSequenceNumber: expectedSequenceNumbers[0] - }, - network: Networks.Stellar, - nonce: 2, - phase: "stellarCleanup", - signer: ephemeralAddress, - txData: mergeAccountTransactions[0].tx - }; - - const createAccountMultiSignedTxs = createAccountTransactions.map((tx, index) => ({ - ...createAccountPrimaryTx, - meta: { - expectedSequenceNumber: expectedSequenceNumbers[index] - }, - nonce: createAccountPrimaryTx.nonce + index, - txData: tx.tx - })); - - const createAccountTx = addAdditionalTransactionsToMeta(createAccountPrimaryTx, createAccountMultiSignedTxs); - unsignedTxs.push(createAccountTx); - - const paymentTransactionMultiSignedTxs = paymentTransactions.map((tx, index) => ({ - ...paymentTransactionPrimary, - meta: { - expectedSequenceNumber: expectedSequenceNumbers[index] - }, - nonce: paymentTransactionPrimary.nonce + index, - txData: tx.tx - })); - - const paymentTransaction = addAdditionalTransactionsToMeta(paymentTransactionPrimary, paymentTransactionMultiSignedTxs); - unsignedTxs.push(paymentTransaction); - - const mergeAccountTransactionMultiSignedTxs = mergeAccountTransactions.map((tx, index) => ({ - ...mergeAccountTransactionPrimary, - meta: { - expectedSequenceNumber: expectedSequenceNumbers[index] - }, - nonce: mergeAccountTransactionPrimary.nonce + index, - txData: tx.tx - })); - - const mergeAccountTx = addAdditionalTransactionsToMeta(mergeAccountTransactionPrimary, mergeAccountTransactionMultiSignedTxs); - unsignedTxs.push(mergeAccountTx); -} - /** * Creates mock approve and swap transactions for sandbox mode * @param inputAmountRaw The raw input amount to approve diff --git a/apps/api/src/api/services/transactions/offramp/common/types.ts b/apps/api/src/api/services/transactions/offramp/common/types.ts index f1c1a9f57..6b51bfdbe 100644 --- a/apps/api/src/api/services/transactions/offramp/common/types.ts +++ b/apps/api/src/api/services/transactions/offramp/common/types.ts @@ -1,18 +1,19 @@ -import { AccountMeta, PaymentData, UnsignedTx } from "@vortexfi/shared"; +import { AccountMeta, UnsignedTx } from "@vortexfi/shared"; import { QuoteTicketAttributes } from "../../../../../models/quoteTicket.model"; export interface OfframpTransactionParams { quote: QuoteTicketAttributes; signingAccounts: AccountMeta[]; - stellarPaymentData?: PaymentData; userAddress?: string; pixDestination?: string; taxId?: string; receiverTaxId?: string; brlaEvmAddress?: string; - moneriumAuthToken?: string; userId?: string; fiatAccountId?: string; + email?: string; + destinationAddress?: string; + ipAddress?: string; } export interface OfframpTransactionsWithMeta { diff --git a/apps/api/src/api/services/transactions/offramp/common/validation.ts b/apps/api/src/api/services/transactions/offramp/common/validation.ts index c661a6f41..ebc9aeb8d 100644 --- a/apps/api/src/api/services/transactions/offramp/common/validation.ts +++ b/apps/api/src/api/services/transactions/offramp/common/validation.ts @@ -6,21 +6,23 @@ import { getOnChainTokenDetails, isFiatToken, isOnChainToken, - isStellarTokenDetails, - normalizeTaxId, - PaymentData, - StellarTokenDetails + normalizeTaxId } from "@vortexfi/shared"; -import Big from "big.js"; import { QuoteTicketAttributes } from "../../../../../models/quoteTicket.model"; /** * Validates offramp quote and returns required data * @param quote The quote ticket * @param signingAccounts The signing accounts + * @param options Set `requireSubstrateEphemeral: false` for EVM-only offramp routes (e.g. Mykobo on Base) * @returns Validation result with required data */ -export function validateOfframpQuote(quote: QuoteTicketAttributes, signingAccounts: AccountMeta[]) { +export function validateOfframpQuote( + quote: QuoteTicketAttributes, + signingAccounts: AccountMeta[], + options: { requireSubstrateEphemeral?: boolean } = {} +) { + const { requireSubstrateEphemeral = true } = options; const fromNetwork = getNetworkFromDestination(quote.from); if (!fromNetwork) { throw new Error(`Invalid network for destination ${quote.from}`); @@ -41,13 +43,8 @@ export function validateOfframpQuote(quote: QuoteTicketAttributes, signingAccoun const outputTokenDetails = getAnyFiatTokenDetails(quote.outputCurrency); - const stellarEphemeralEntry = signingAccounts.find(ephemeral => ephemeral.type === "Stellar"); - if (!stellarEphemeralEntry) { - throw new Error("Stellar ephemeral not found"); - } - const substrateEphemeralEntry = signingAccounts.find(ephemeral => ephemeral.type === "Substrate"); - if (!substrateEphemeralEntry) { + if (requireSubstrateEphemeral && !substrateEphemeralEntry) { throw new Error("Pendulum ephemeral not found"); } @@ -55,7 +52,6 @@ export function validateOfframpQuote(quote: QuoteTicketAttributes, signingAccoun fromNetwork, inputTokenDetails, outputTokenDetails, - stellarEphemeralEntry, substrateEphemeralEntry }; } @@ -109,49 +105,3 @@ export function validateBRLOfframpMetadata(quote: QuoteTicketAttributes): { offrampAmountBeforeAnchorFeesRaw: quote.metadata.pendulumToMoonbeamXcm.outputAmountRaw }; } - -/** - * Validates Stellar offramp requirements - * @param outputTokenDetails Output token details - * @param stellarPaymentData Stellar payment data - * @returns Validated Stellar token details and payment data - */ -export function validateStellarOfframp( - outputTokenDetails: FiatTokenDetails, - stellarPaymentData?: PaymentData -): { - stellarTokenDetails: StellarTokenDetails; - stellarPaymentData: PaymentData; -} { - if (!isStellarTokenDetails(outputTokenDetails)) { - throw new Error("Output currency must be Stellar token for offramp, got output token details type"); - } - - if (!stellarPaymentData?.anchorTargetAccount) { - throw new Error("Stellar payment data must be provided for offramp"); - } - - return { - stellarPaymentData, - stellarTokenDetails: outputTokenDetails as StellarTokenDetails - }; -} - -/** - * Validates Stellar offramp metadata - * @param quote The quote ticket - * @returns Validated Stellar metadata - */ -export function validateStellarOfframpMetadata(quote: QuoteTicketAttributes): { - offrampAmountBeforeAnchorFeesUnits: Big; - offrampAmountBeforeAnchorFeesRaw: string; -} { - if (!quote.metadata.pendulumToStellar?.outputAmountDecimal || !quote.metadata.pendulumToStellar?.outputAmountRaw) { - throw new Error("Quote metadata is missing pendulumToStellar information"); - } - - return { - offrampAmountBeforeAnchorFeesRaw: quote.metadata.pendulumToStellar.outputAmountRaw, - offrampAmountBeforeAnchorFeesUnits: new Big(quote.metadata.pendulumToStellar.outputAmountDecimal) - }; -} diff --git a/apps/api/src/api/services/transactions/offramp/index.ts b/apps/api/src/api/services/transactions/offramp/index.ts index e8af3125d..1e48a6878 100644 --- a/apps/api/src/api/services/transactions/offramp/index.ts +++ b/apps/api/src/api/services/transactions/offramp/index.ts @@ -8,11 +8,9 @@ import { } from "@vortexfi/shared"; import { OfframpTransactionParams, OfframpTransactionsWithMeta } from "./common/types"; import { prepareAssethubToBRLOfframpTransactions } from "./routes/assethub-to-brl"; -import { prepareAssethubToStellarOfframpTransactions } from "./routes/assethub-to-stellar"; import { prepareEvmToAlfredpayOfframpTransactions } from "./routes/evm-to-alfredpay"; import { prepareEvmToBRLOfframpBaseTransactions } from "./routes/evm-to-brl-base"; -import { prepareEvmToMoneriumEvmOfframpTransactions } from "./routes/evm-to-monerium-evm"; -import { prepareEvmToStellarOfframpTransactions } from "./routes/evm-to-stellar"; +import { prepareEvmToMykoboOfframpTransactions } from "./routes/evm-to-mykobo"; export async function prepareOfframpTransactions(params: OfframpTransactionParams): Promise { const { quote } = params; @@ -30,19 +28,17 @@ export async function prepareOfframpTransactions(params: OfframpTransactionParam } else { return prepareAssethubToBRLOfframpTransactions(params); } - } else if (quote.outputCurrency === FiatToken.EURC && params.moneriumAuthToken) { - // Monerium EVM offramp - return prepareEvmToMoneriumEvmOfframpTransactions(params); + } else if (quote.outputCurrency === FiatToken.EURC) { + // Mykobo EUR offramp on Base (EVM-only path) + const inputTokenDetails = getOnChainTokenDetails(fromNetwork, quote.inputCurrency as OnChainToken); + if (!inputTokenDetails || !isEvmTokenDetails(inputTokenDetails)) { + throw new Error("Mykobo EUR offramp requires an EVM source chain"); + } + return prepareEvmToMykoboOfframpTransactions(params); } else if (isAlfredpayToken(quote.outputCurrency as FiatToken)) { // Alfredpay offramp (USD, MXN, COP) return prepareEvmToAlfredpayOfframpTransactions(params); - } else { - // Stellar offramp - const inputTokenDetails = getOnChainTokenDetails(fromNetwork, quote.inputCurrency as OnChainToken); - if (inputTokenDetails && isEvmTokenDetails(inputTokenDetails)) { - return prepareEvmToStellarOfframpTransactions(params); - } else { - return prepareAssethubToStellarOfframpTransactions(params); - } } + + throw new Error(`Unsupported offramp output currency: ${quote.outputCurrency}`); } diff --git a/apps/api/src/api/services/transactions/offramp/routes/assethub-to-brl.ts b/apps/api/src/api/services/transactions/offramp/routes/assethub-to-brl.ts index f0141d94a..8cda2faf5 100644 --- a/apps/api/src/api/services/transactions/offramp/routes/assethub-to-brl.ts +++ b/apps/api/src/api/services/transactions/offramp/routes/assethub-to-brl.ts @@ -29,6 +29,9 @@ export async function prepareAssethubToBRLOfframpTransactions({ quote, signingAccounts ); + if (!substrateEphemeralEntry) { + throw new Error("Pendulum ephemeral not found"); + } const { brlaEvmAddress: validatedBrlaEvmAddress, diff --git a/apps/api/src/api/services/transactions/offramp/routes/assethub-to-stellar.ts b/apps/api/src/api/services/transactions/offramp/routes/assethub-to-stellar.ts deleted file mode 100644 index 357cac1e0..000000000 --- a/apps/api/src/api/services/transactions/offramp/routes/assethub-to-stellar.ts +++ /dev/null @@ -1,161 +0,0 @@ -import { - encodeSubmittableExtrinsic, - getPendulumDetails, - isStellarOutputTokenDetails, - Networks, - UnsignedTx -} from "@vortexfi/shared"; -import Big from "big.js"; -import { multiplyByPowerOfTen } from "../../../pendulum/helpers"; -import { StateMetadata } from "../../../phases/meta-state-types"; -import { addFeeDistributionTransaction } from "../../common/feeDistribution"; -import { preparePendulumCleanupTransaction } from "../../pendulum/cleanup"; -import { - createAssetHubSourceTransactions, - createNablaSwapTransactions, - createSpacewalkTransactions, - createStellarPaymentTransactions -} from "../common/transactions"; -import { OfframpTransactionParams, OfframpTransactionsWithMeta } from "../common/types"; -import { validateOfframpQuote, validateStellarOfframp, validateStellarOfframpMetadata } from "../common/validation"; - -/** - * Prepares all transactions for an AssetHub to Stellar offramp. - * This route handles: AssetHub → Pendulum (swap) → Spacewalk → Stellar - */ -export async function prepareAssethubToStellarOfframpTransactions({ - quote, - signingAccounts, - stellarPaymentData, - userAddress -}: OfframpTransactionParams): Promise { - const unsignedTxs: UnsignedTx[] = []; - let stateMeta: Partial = {}; - - // Validate inputs and extract required data - const { fromNetwork, inputTokenDetails, outputTokenDetails, stellarEphemeralEntry, substrateEphemeralEntry } = - validateOfframpQuote(quote, signingAccounts); - - const { stellarTokenDetails, stellarPaymentData: validatedStellarPaymentData } = validateStellarOfframp( - outputTokenDetails, - stellarPaymentData - ); - const { offrampAmountBeforeAnchorFeesUnits, offrampAmountBeforeAnchorFeesRaw } = validateStellarOfframpMetadata(quote); - - const inputAmountRaw = multiplyByPowerOfTen(new Big(quote.inputAmount), inputTokenDetails.decimals).toFixed(0, 0); - - if (validatedStellarPaymentData.amount) { - const stellarAmount = new Big(validatedStellarPaymentData.amount); - if (!stellarAmount.eq(offrampAmountBeforeAnchorFeesUnits)) { - throw new Error( - `Stellar amount ${stellarAmount.toString()} not equal to expected payment ${offrampAmountBeforeAnchorFeesUnits.toString()}` - ); - } - } - - // Initialize state metadata - stateMeta = { - stellarEphemeralAccountId: stellarEphemeralEntry.address, - substrateEphemeralAddress: substrateEphemeralEntry.address - }; - - if (!userAddress) { - throw new Error("User address must be provided for offramping."); - } - - // Create AssetHub source transactions - await createAssetHubSourceTransactions( - { - inputAmountRaw, - pendulumEphemeralAddress: substrateEphemeralEntry.address, - userAddress - }, - unsignedTxs, - fromNetwork - ); - - // Process Pendulum account - const substrateAccount = signingAccounts.find(account => account.type === "Substrate"); - if (!substrateAccount) { - throw new Error("Substrate account not found"); - } - - const inputTokenPendulumDetails = getPendulumDetails(quote.inputCurrency, fromNetwork); - const outputTokenPendulumDetails = getPendulumDetails(quote.outputCurrency); - - let pendulumNonce = 0; - - // Add fee distribution transaction - pendulumNonce = await addFeeDistributionTransaction(quote, substrateAccount, unsignedTxs, pendulumNonce); - - // Create Nabla swap transactions - const nablaResult = await createNablaSwapTransactions( - { - account: substrateAccount, - inputTokenPendulumDetails, - outputTokenPendulumDetails, - quote - }, - unsignedTxs, - pendulumNonce - ); - - pendulumNonce = nablaResult.nextNonce; - stateMeta = { - ...stateMeta, - ...nablaResult.stateMeta - }; - - // Prepare cleanup transaction - const pendulumCleanupTransaction = await preparePendulumCleanupTransaction( - inputTokenPendulumDetails.currencyId, - outputTokenPendulumDetails.currencyId - ); - - const pendulumCleanupTx: Omit = { - meta: {}, - network: Networks.Pendulum, - phase: "pendulumCleanup", - signer: substrateAccount.address, - txData: encodeSubmittableExtrinsic(pendulumCleanupTransaction) - }; - - // Create Spacewalk transactions - const stellarResult = await createSpacewalkTransactions( - { - account: substrateAccount, - outputAmountRaw: offrampAmountBeforeAnchorFeesRaw, - outputTokenDetails: stellarTokenDetails, - stellarEphemeralEntry, - stellarPaymentData: validatedStellarPaymentData - }, - unsignedTxs, - pendulumCleanupTx, - pendulumNonce - ); - - stateMeta = { - ...stateMeta, - ...stellarResult.stateMeta - }; - - if (!isStellarOutputTokenDetails(outputTokenDetails)) { - throw new Error(`Output currency must be Stellar token for offramp, got ${quote.outputCurrency}`); - } - - if (!stellarPaymentData) { - throw new Error("Stellar payment data must be provided for offramp"); - } - - await createStellarPaymentTransactions( - { - ephemeralAddress: stellarEphemeralEntry.address, - outputAmountUnits: offrampAmountBeforeAnchorFeesUnits, - outputTokenDetails: outputTokenDetails as any, - stellarPaymentData - }, - unsignedTxs - ); - - return { stateMeta, unsignedTxs }; -} diff --git a/apps/api/src/api/services/transactions/offramp/routes/evm-to-alfredpay.ts b/apps/api/src/api/services/transactions/offramp/routes/evm-to-alfredpay.ts index ab9d3e2ac..eec483684 100644 --- a/apps/api/src/api/services/transactions/offramp/routes/evm-to-alfredpay.ts +++ b/apps/api/src/api/services/transactions/offramp/routes/evm-to-alfredpay.ts @@ -37,6 +37,7 @@ import { } from "viem"; import { privateKeyToAccount } from "viem/accounts"; import { config } from "../../../../../config/vars"; +import erc20ABI from "../../../../../contracts/ERC20"; import AlfredPayCustomer from "../../../../../models/alfredPayCustomer.model"; import { getEvmFundingAccount } from "../../../phases/evm-funding"; import { StateMetadata } from "../../../phases/meta-state-types"; @@ -45,11 +46,14 @@ import { addOnrampDestinationChainTransactions } from "../../onramp/common/trans import { preparePolygonCleanupApproval } from "../../polygon/cleanup"; import { OfframpTransactionParams, OfframpTransactionsWithMeta } from "../common/types"; -// TokenRelayer deployments. Address may differ per chain +// TokenRelayer deployments. Address may differ per chain export const RELAYER_ADDRESSES: Partial> = { [Networks.Arbitrum]: "0xC9ECD03c89349B3EAe4613c7091c6c3029413785", [Networks.Base]: "0xDbece5cE27984FC64688bcC57f75b96a28e8c68c", - [Networks.Polygon]: "0xC9ECD03c89349B3EAe4613c7091c6c3029413785" + [Networks.Polygon]: "0xC9ECD03c89349B3EAe4613c7091c6c3029413785", + [Networks.Avalanche]: "0x11871C77Aa0170ae13864E4E82cFa471720e045e", + [Networks.Ethereum]: "0x522A51f9c5B1683F0F15910075487c4D162A8b83", + [Networks.BSC]: "0x2d657ac14088fED401b58FEd377988ed3F875220" }; export function getRelayerAddress(network: EvmNetworks): `0x${string}` { @@ -151,19 +155,6 @@ const erc20Abi = [ { inputs: [], name: "name", outputs: [{ name: "", type: "string" }], stateMutability: "view", type: "function" } ]; -const transferAbi = [ - { - inputs: [ - { name: "to", type: "address" }, - { name: "value", type: "uint256" } - ], - name: "transfer", - outputs: [{ name: "", type: "bool" }], - stateMutability: "nonpayable", - type: "function" - } -] as const; - /** * Prepares all transactions for an EVM to Alfredpay (USD) offramp. * This route handles: EVM → Polygon (USDC) → Alfredpay (Fiat) @@ -210,7 +201,8 @@ export async function prepareEvmToAlfredpayOfframpTransactions({ const fiatToCountry: Partial> = { [FiatToken.USD]: AlfredPayCountry.US, [FiatToken.MXN]: AlfredPayCountry.MX, - [FiatToken.COP]: AlfredPayCountry.CO + [FiatToken.COP]: AlfredPayCountry.CO, + [FiatToken.ARS]: AlfredPayCountry.AR }; const customerCountry = fiatToCountry[quote.outputCurrency as FiatToken]; if (!customerCountry) { @@ -346,9 +338,7 @@ export async function prepareEvmToAlfredpayOfframpTransactions({ const relayerAddress = RELAYER_ADDRESSES[fromNetwork]; if (!relayerAddress) { - throw new Error( - `Alfredpay offramp permit flow is not supported on ${fromNetwork}: no relayer deployment configured` - ); + throw new Error(`Alfredpay offramp permit flow is not supported on ${fromNetwork}: no relayer deployment configured`); } const permitTypedData: SignedTypedData = { @@ -430,7 +420,7 @@ export async function prepareEvmToAlfredpayOfframpTransactions({ // No permit available, but user already holds USDT on Polygon: user signs a single // transfer(ephemeral, amount) in their wallet. Funds land directly on the ephemeral. const transferData = encodeFunctionData({ - abi: transferAbi, + abi: erc20ABI, args: [evmEphemeralEntry.address as `0x${string}`, BigInt(inputAmountRaw)], functionName: "transfer" }); diff --git a/apps/api/src/api/services/transactions/offramp/routes/evm-to-brl-base.ts b/apps/api/src/api/services/transactions/offramp/routes/evm-to-brl-base.ts index aeab4cc0d..6bfa4e181 100644 --- a/apps/api/src/api/services/transactions/offramp/routes/evm-to-brl-base.ts +++ b/apps/api/src/api/services/transactions/offramp/routes/evm-to-brl-base.ts @@ -9,6 +9,8 @@ import { UnsignedTx } from "@vortexfi/shared"; import Big from "big.js"; +import { encodeFunctionData } from "viem"; +import erc20ABI from "../../../../../contracts/ERC20"; import { getEvmFundingAccount } from "../../../phases/evm-funding"; import { StateMetadata } from "../../../phases/meta-state-types"; import { encodeEvmTransactionData } from "../.."; @@ -69,8 +71,30 @@ export async function prepareEvmToBRLOfframpBaseTransactions({ throw new Error("Invalid BRLA configuration for Base in evmTokenConfig"); } - // Special case: if user is already on Base with USDC, skip squidrouter transactions - if (!(fromNetwork === Networks.Base && inputTokenDetails.erc20AddressSourceChain === baseUsdcAddress)) { + // Special case: if user already holds USDC on Base, skip squidrouter and have the user sign a + // direct ERC20 transfer to the ephemeral. Without this leg the ephemeral never receives USDC and + // downstream phases (distributeFees, nablaSwap) would revert from insufficient balance. + if (fromNetwork === Networks.Base && inputTokenDetails.erc20AddressSourceChain === baseUsdcAddress) { + const transferData = encodeFunctionData({ + abi: erc20ABI, + args: [evmEphemeralEntry.address as `0x${string}`, BigInt(inputAmountRaw)], + functionName: "transfer" + }); + + unsignedTxs.push({ + meta: {}, + network: fromNetwork, + nonce: 0, + phase: "squidRouterNoPermitTransfer", + signer: userAddress, + txData: { + data: transferData, + gas: "0", + to: inputTokenDetails.erc20AddressSourceChain, + value: "0" + } + }); + } else { // TODO Maybe, move to contract-base squid swap. // Otherwise use the same approach as previously const { approveData, swapData } = await createOfframpSquidrouterTransactionsToEvm({ @@ -102,8 +126,6 @@ export async function prepareEvmToBRLOfframpBaseTransactions({ }); } - // TODO isn't this missing the rest of the edge case handling? - let baseNonce = 0; const baseUSDCTokenAddress = evmTokenConfig[Networks.Base][EvmToken.USDC]?.erc20AddressSourceChain; diff --git a/apps/api/src/api/services/transactions/offramp/routes/evm-to-monerium-evm.ts b/apps/api/src/api/services/transactions/offramp/routes/evm-to-monerium-evm.ts deleted file mode 100644 index d73bcf885..000000000 --- a/apps/api/src/api/services/transactions/offramp/routes/evm-to-monerium-evm.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { - createOfframpSquidrouterTransactionsToEvm, - ERC20_EURE_POLYGON_V1, - EvmTransactionData, - getNetworkFromDestination, - getOnChainTokenDetails, - isEvmTokenDetails, - isFiatToken, - isOnChainToken, - Networks, - UnsignedTx -} from "@vortexfi/shared"; -import { getFirstMoneriumLinkedAddress } from "../../../monerium"; -import { StateMetadata } from "../../../phases/meta-state-types"; -import { encodeEvmTransactionData } from "../../index"; -import { OfframpTransactionParams, OfframpTransactionsWithMeta } from "../common/types"; - -/** - * Prepares all transactions for an EVM to Monerium EVM offramp. - * This route handles: EVM → Polygon (EURE) → Monerium EVM - */ -export async function prepareEvmToMoneriumEvmOfframpTransactions({ - quote, - signingAccounts, - userAddress, - moneriumAuthToken -}: OfframpTransactionParams): Promise { - const unsignedTxs: UnsignedTx[] = []; - const stateMeta: Partial = {}; - - const fromNetwork = getNetworkFromDestination(quote.from); - if (!fromNetwork) { - throw new Error(`Invalid network for destination ${quote.from}`); - } - - if (!isOnChainToken(quote.inputCurrency)) { - throw new Error(`Input currency must be on-chain token for offramp, got ${quote.inputCurrency}`); - } - - const inputTokenDetails = getOnChainTokenDetails(fromNetwork, quote.inputCurrency); - if (!inputTokenDetails) { - throw new Error(`Input token details not found for ${quote.inputCurrency} on network ${fromNetwork}`); - } - - if (!isFiatToken(quote.outputCurrency)) { - throw new Error(`Output currency must be fiat token for offramp, got ${quote.outputCurrency}`); - } - - if (!quote.metadata.moneriumMint?.outputAmountRaw) { - throw new Error("Monerium Offramp requires moneriumMint metadata with amountOutRaw."); - } - - const inputAmountRaw = quote.metadata.moneriumMint.outputAmountRaw; - - if (!userAddress) { - throw new Error("User address must be provided for offramping."); - } - - if (!isEvmTokenDetails(inputTokenDetails)) { - throw new Error("Offramp from Assethub not supported for Monerium"); - } - - if (!moneriumAuthToken) { - throw new Error("Monerium Offramp requires a valid authorization token"); - } - - const moneriumEvmAddress = await getFirstMoneriumLinkedAddress(moneriumAuthToken); - - if (!moneriumEvmAddress) { - throw new Error("No Address linked for Monerium."); - } - - const { approveData, swapData } = await createOfframpSquidrouterTransactionsToEvm({ - destinationAddress: moneriumEvmAddress, - fromAddress: userAddress, - fromNetwork, // By design, EUR.e offramp starts from Polygon. - fromToken: inputTokenDetails.erc20AddressSourceChain, - rawAmount: inputAmountRaw, // By design, EURe is the only supported offramp currency. - toNetwork: Networks.Polygon, - toToken: ERC20_EURE_POLYGON_V1 - }); - - unsignedTxs.push({ - meta: {}, - network: fromNetwork, - nonce: 0, - phase: "squidRouterApprove", - signer: userAddress, - txData: encodeEvmTransactionData(approveData) as EvmTransactionData - }); - - unsignedTxs.push({ - meta: {}, - network: fromNetwork, - nonce: 1, - phase: "squidRouterSwap", - signer: userAddress, - txData: encodeEvmTransactionData(swapData) as EvmTransactionData - }); - - return { stateMeta, unsignedTxs }; -} diff --git a/apps/api/src/api/services/transactions/offramp/routes/evm-to-mykobo.ts b/apps/api/src/api/services/transactions/offramp/routes/evm-to-mykobo.ts new file mode 100644 index 000000000..f47e2c3a8 --- /dev/null +++ b/apps/api/src/api/services/transactions/offramp/routes/evm-to-mykobo.ts @@ -0,0 +1,254 @@ +import { + createOfframpSquidrouterTransactionsToEvm, + EvmToken, + EvmTransactionData, + evmTokenConfig, + isEvmTokenDetails, + isWithdrawInstructions, + MykoboApiService, + MykoboCurrency, + MykoboTransactionType, + multiplyByPowerOfTen, + Networks, + UnsignedTx +} from "@vortexfi/shared"; +import Big from "big.js"; +import httpStatus from "http-status"; +import { encodeFunctionData } from "viem"; +import erc20ABI from "../../../../../contracts/ERC20"; +import { APIError } from "../../../../errors/api-error"; +import { syncMykoboCustomerKyc } from "../../../mykobo/mykobo-customer.service"; +import { getEvmFundingAccount } from "../../../phases/evm-funding"; +import { StateMetadata } from "../../../phases/meta-state-types"; +import { encodeEvmTransactionData } from "../.."; +import { prepareBaseCleanupApproval } from "../../base/cleanup"; +import { addEvmFeeDistributionTransaction } from "../../common/feeDistribution"; +import { addNablaSwapTransactionsOnBase, addOnrampDestinationChainTransactions } from "../../onramp/common/transactions"; +import { OfframpTransactionParams, OfframpTransactionsWithMeta } from "../common/types"; +import { validateOfframpQuote } from "../common/validation"; + +export async function prepareEvmToMykoboOfframpTransactions({ + quote, + signingAccounts, + userAddress, + email, + destinationAddress, + ipAddress, + userId +}: OfframpTransactionParams): Promise { + const unsignedTxs: UnsignedTx[] = []; + let stateMeta: Partial = {}; + + const { fromNetwork, inputTokenDetails } = validateOfframpQuote(quote, signingAccounts, { requireSubstrateEphemeral: false }); + + const evmEphemeralEntry = signingAccounts.find(account => account.type === "EVM"); + if (!evmEphemeralEntry) { + throw new Error("EVM ephemeral account not found for EVM to Mykobo offramp"); + } + + if (!email) { + throw new APIError({ + isPublic: true, + message: "email must be provided for Mykobo (EUR) offramp", + status: httpStatus.BAD_REQUEST + }); + } + + if (!ipAddress) { + throw new APIError({ + isPublic: true, + message: "ipAddress must be provided for Mykobo (EUR) offramp", + status: httpStatus.BAD_REQUEST + }); + } + + if (!destinationAddress) { + throw new APIError({ + isPublic: true, + message: "destinationAddress (user receiving wallet) must be provided for Mykobo offramp", + status: httpStatus.BAD_REQUEST + }); + } + + if (!userAddress) { + throw new Error("User address must be provided for offramping."); + } + + if (!isEvmTokenDetails(inputTokenDetails)) { + throw new Error("EVM to Mykobo route requires EVM input token"); + } + + const baseUsdcAddress = evmTokenConfig[Networks.Base][EvmToken.USDC]?.erc20AddressSourceChain; + if (!baseUsdcAddress) { + throw new Error("Invalid USDC configuration for Base in evmTokenConfig"); + } + + const baseEurcAddress = evmTokenConfig[Networks.Base][EvmToken.EURC]?.erc20AddressSourceChain; + if (!baseEurcAddress) { + throw new Error("Invalid EURC configuration for Base in evmTokenConfig"); + } + + const baseAxlUsdcAddress = evmTokenConfig[Networks.Base][EvmToken.AXLUSDC]?.erc20AddressSourceChain; + if (!baseAxlUsdcAddress) { + throw new Error("Invalid AXLUSDC configuration for Base in evmTokenConfig"); + } + + const inputAmountRaw = multiplyByPowerOfTen(new Big(quote.inputAmount), inputTokenDetails.decimals).toFixed(0, 0); + const inputTokenAddress = inputTokenDetails.erc20AddressSourceChain; + const isDirectBaseTransfer = + fromNetwork === Networks.Base && inputTokenAddress.toLowerCase() === baseUsdcAddress.toLowerCase(); + + // Resolve the Mykobo intent before building any user-signed transactions so that an API failure aborts early. + const mykoboIntentValue = quote.metadata.nablaSwapEvm?.outputAmountDecimal; + if (!mykoboIntentValue) { + throw new Error("Missing nablaSwapEvm.outputAmountDecimal in quote metadata for Mykobo intent value"); + } + + // Mykobo silently truncates the intent value to 2 decimals. We floor here so the on-chain + // EURC transfer below matches the amount Mykobo actually credits to the withdraw intent. + const mykoboFlooredValue = new Big(mykoboIntentValue).toFixed(2, 0); + const eurcDecimals = evmTokenConfig[Networks.Base][EvmToken.EURC]?.decimals; + if (eurcDecimals === undefined) { + throw new Error("Invalid EURC decimals configuration for Base in evmTokenConfig"); + } + const eurcTransferAmountRaw = multiplyByPowerOfTen(new Big(mykoboFlooredValue), eurcDecimals).toFixed(0, 0); + + const mykobo = MykoboApiService.getInstance(); + const intent = await mykobo.createTransactionIntent({ + currency: MykoboCurrency.EURC, + email_address: email, + ip_address: ipAddress, + transaction_type: MykoboTransactionType.WITHDRAW, + value: mykoboFlooredValue, + wallet_address: evmEphemeralEntry.address + }); + + if (!isWithdrawInstructions(intent.instructions)) { + throw new Error("Mykobo intent did not return withdraw instructions; cannot derive receivables address"); + } + const mykoboReceivablesAddress = intent.instructions.address; + const mykoboTransactionId = intent.transaction.id; + const mykoboTransactionReference = intent.transaction.reference; + + if (isDirectBaseTransfer) { + // User already holds USDC on Base — they sign a single ERC-20 transfer to the ephemeral. + // Mirrors the isDirectPolygonTransfer branch in evm-to-alfredpay.ts. + const transferData = encodeFunctionData({ + abi: erc20ABI, + args: [evmEphemeralEntry.address as `0x${string}`, BigInt(inputAmountRaw)], + functionName: "transfer" + }); + + unsignedTxs.push({ + meta: {}, + network: fromNetwork, + nonce: 0, + phase: "squidRouterNoPermitTransfer", + signer: userAddress, + txData: { + data: transferData, + gas: "0", + to: inputTokenAddress, + value: "0" + } + }); + } else { + const { approveData, swapData } = await createOfframpSquidrouterTransactionsToEvm({ + destinationAddress: evmEphemeralEntry.address, + fromAddress: userAddress, + fromNetwork, + fromToken: inputTokenAddress, + rawAmount: inputAmountRaw, + toNetwork: Networks.Base, + toToken: baseUsdcAddress + }); + + unsignedTxs.push({ + meta: {}, + network: fromNetwork, + nonce: 0, + phase: "squidRouterApprove", + signer: userAddress, + txData: encodeEvmTransactionData(approveData) as EvmTransactionData + }); + + unsignedTxs.push({ + meta: {}, + network: fromNetwork, + nonce: 1, + phase: "squidRouterSwap", + signer: userAddress, + txData: encodeEvmTransactionData(swapData) as EvmTransactionData + }); + } + + let baseNonce = await addEvmFeeDistributionTransaction(quote, evmEphemeralEntry, unsignedTxs, 0); + + const { nextNonce: nonceAfterNabla, stateMeta: nablaStateMeta } = await addNablaSwapTransactionsOnBase( + { + account: evmEphemeralEntry, + inputTokenAddress: baseUsdcAddress, + outputTokenAddress: baseEurcAddress, + quote + }, + unsignedTxs, + baseNonce + ); + stateMeta = nablaStateMeta; + baseNonce = nonceAfterNabla; + + const payoutTransfer = await addOnrampDestinationChainTransactions({ + amountRaw: eurcTransferAmountRaw, + destinationNetwork: Networks.Base, + isNativeToken: false, + toAddress: mykoboReceivablesAddress as `0x${string}`, + toToken: baseEurcAddress as `0x${string}` + }); + + unsignedTxs.push({ + meta: {}, + network: Networks.Base, + nonce: baseNonce, + phase: "mykoboPayoutOnBase", + signer: evmEphemeralEntry.address, + txData: encodeEvmTransactionData(payoutTransfer) as EvmTransactionData + }); + baseNonce++; + + const baseFundingAccount = getEvmFundingAccount(Networks.Base); + + const cleanupTokens = [ + { address: baseUsdcAddress, phase: "baseCleanupUsdc" as const }, + { address: baseEurcAddress, phase: "baseCleanupEurc" as const }, + { address: baseAxlUsdcAddress, phase: "baseCleanupAxlUsdc" as const } + ]; + + for (const { address, phase } of cleanupTokens) { + const approval = await prepareBaseCleanupApproval(address as `0x${string}`, baseFundingAccount.address, Networks.Base); + unsignedTxs.push({ + meta: {}, + network: Networks.Base, + nonce: baseNonce++, + phase, + signer: evmEphemeralEntry.address, + txData: encodeEvmTransactionData(approval) as EvmTransactionData + }); + } + + stateMeta = { + ...stateMeta, + destinationAddress, + evmEphemeralAddress: evmEphemeralEntry.address, + mykoboEmail: email, + mykoboReceivablesAddress, + mykoboTransactionId, + mykoboTransactionReference, + walletAddress: userAddress + }; + + if (userId) { + await syncMykoboCustomerKyc(userId, email); + } + + return { stateMeta, unsignedTxs }; +} diff --git a/apps/api/src/api/services/transactions/offramp/routes/evm-to-stellar.ts b/apps/api/src/api/services/transactions/offramp/routes/evm-to-stellar.ts deleted file mode 100644 index e2da5a424..000000000 --- a/apps/api/src/api/services/transactions/offramp/routes/evm-to-stellar.ts +++ /dev/null @@ -1,163 +0,0 @@ -import { encodeSubmittableExtrinsic, getPendulumDetails, isEvmTokenDetails, Networks, UnsignedTx } from "@vortexfi/shared"; -import Big from "big.js"; -import { multiplyByPowerOfTen } from "../../../pendulum/helpers"; -import { StateMetadata } from "../../../phases/meta-state-types"; -import { addFeeDistributionTransaction } from "../../common/feeDistribution"; -import { preparePendulumCleanupTransaction } from "../../pendulum/cleanup"; -import { - createEvmSourceTransactions, - createNablaSwapTransactions, - createSpacewalkTransactions, - createStellarPaymentTransactions -} from "../common/transactions"; -import { OfframpTransactionParams, OfframpTransactionsWithMeta } from "../common/types"; -import { validateOfframpQuote, validateStellarOfframp, validateStellarOfframpMetadata } from "../common/validation"; - -/** - * Prepares all transactions for an EVM to Stellar offramp. - * This route handles: EVM → Pendulum (swap) → Spacewalk → Stellar - */ -export async function prepareEvmToStellarOfframpTransactions({ - quote, - signingAccounts, - stellarPaymentData, - userAddress -}: OfframpTransactionParams): Promise { - const unsignedTxs: UnsignedTx[] = []; - let stateMeta: Partial = {}; - - // Validate inputs and extract required data - const { fromNetwork, inputTokenDetails, outputTokenDetails, stellarEphemeralEntry, substrateEphemeralEntry } = - validateOfframpQuote(quote, signingAccounts); - - const { stellarTokenDetails, stellarPaymentData: validatedStellarPaymentData } = validateStellarOfframp( - outputTokenDetails, - stellarPaymentData - ); - const { offrampAmountBeforeAnchorFeesUnits, offrampAmountBeforeAnchorFeesRaw } = validateStellarOfframpMetadata(quote); - - const inputAmountRaw = multiplyByPowerOfTen(new Big(quote.inputAmount), inputTokenDetails.decimals).toFixed(0, 0); - - if (validatedStellarPaymentData.amount) { - const stellarAmount = new Big(validatedStellarPaymentData.amount); - if (!stellarAmount.eq(offrampAmountBeforeAnchorFeesUnits)) { - throw new Error( - `Stellar amount ${stellarAmount.toString()} not equal to expected payment ${offrampAmountBeforeAnchorFeesUnits.toString()}` - ); - } - } - - // Initialize state metadata - stateMeta = { - stellarEphemeralAccountId: stellarEphemeralEntry.address, - substrateEphemeralAddress: substrateEphemeralEntry.address - }; - - if (!userAddress) { - throw new Error("User address must be provided for offramping."); - } - - if (!isEvmTokenDetails(inputTokenDetails)) { - throw new Error("EVM to Stellar route requires EVM input token"); - } - - // Create EVM source transactions - const evmSourceMetadata = await createEvmSourceTransactions( - { - fromNetwork, - fromToken: inputTokenDetails.erc20AddressSourceChain, - inputAmountRaw, - pendulumEphemeralAddress: substrateEphemeralEntry.address, - toToken: "0xA0b86a33E6441e88C5F2712C3E9b74F5F4e3E3D6", // AXL USDC on Moonbeam - userAddress - }, - unsignedTxs - ); - - stateMeta = { - ...stateMeta, - ...evmSourceMetadata - }; - - // Process Pendulum account - const substrateAccount = signingAccounts.find(account => account.type === "Substrate"); - if (!substrateAccount) { - throw new Error("Substrate account not found"); - } - - const inputTokenPendulumDetails = getPendulumDetails(quote.inputCurrency, fromNetwork); - const outputTokenPendulumDetails = getPendulumDetails(quote.outputCurrency); - - let pendulumNonce = 0; - - // Add fee distribution transaction - pendulumNonce = await addFeeDistributionTransaction(quote, substrateAccount, unsignedTxs, pendulumNonce); - - // Create Nabla swap transactions - const nablaResult = await createNablaSwapTransactions( - { - account: substrateAccount, - inputTokenPendulumDetails, - outputTokenPendulumDetails, - quote - }, - unsignedTxs, - pendulumNonce - ); - - pendulumNonce = nablaResult.nextNonce; - stateMeta = { - ...stateMeta, - ...nablaResult.stateMeta - }; - - // Prepare cleanup transaction - const pendulumCleanupTransaction = await preparePendulumCleanupTransaction( - inputTokenPendulumDetails.currencyId, - outputTokenPendulumDetails.currencyId - ); - - const pendulumCleanupTx: Omit = { - meta: {}, - network: Networks.Pendulum, - phase: "pendulumCleanup", - signer: substrateAccount.address, - txData: encodeSubmittableExtrinsic(pendulumCleanupTransaction) - }; - - // Create Spacewalk transactions - const stellarResult = await createSpacewalkTransactions( - { - account: substrateAccount, - outputAmountRaw: offrampAmountBeforeAnchorFeesRaw, - outputTokenDetails: stellarTokenDetails, - stellarEphemeralEntry, - stellarPaymentData: validatedStellarPaymentData - }, - unsignedTxs, - pendulumCleanupTx, - pendulumNonce - ); - - pendulumNonce = stellarResult.nextNonce; - stateMeta = { - ...stateMeta, - ...stellarResult.stateMeta - }; - - if (!stellarPaymentData) { - throw new Error("Stellar payment data must be provided for offramp"); - } - - await createStellarPaymentTransactions( - { - ephemeralAddress: stellarEphemeralEntry.address, - outputAmountUnits: offrampAmountBeforeAnchorFeesUnits, - outputTokenDetails: stellarTokenDetails, - stellarPaymentData - }, - unsignedTxs - ); - - return { stateMeta, unsignedTxs }; -} diff --git a/apps/api/src/api/services/transactions/onramp/common/monerium.test.ts b/apps/api/src/api/services/transactions/onramp/common/monerium.test.ts deleted file mode 100644 index ab20e2107..000000000 --- a/apps/api/src/api/services/transactions/onramp/common/monerium.test.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { describe, expect, it } from "bun:test"; -import { MONERIUM_SELF_TRANSFER_GAS_LIMIT } from "./monerium"; - -describe("MONERIUM_SELF_TRANSFER_GAS_LIMIT", () => { - it("keeps enough room for EURe v2 transferFrom compliance checks", () => { - expect(BigInt(MONERIUM_SELF_TRANSFER_GAS_LIMIT)).toBeGreaterThan(100000n); - }); -}); diff --git a/apps/api/src/api/services/transactions/onramp/common/monerium.ts b/apps/api/src/api/services/transactions/onramp/common/monerium.ts deleted file mode 100644 index e17b0a6ff..000000000 --- a/apps/api/src/api/services/transactions/onramp/common/monerium.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { ERC20_EURE_POLYGON_V2, EvmClientManager, EvmTransactionData, Networks } from "@vortexfi/shared"; -import { encodeFunctionData } from "viem"; -import { config } from "../../../../../config/vars"; -import erc20ABI from "../../../../../contracts/ERC20"; - -export const MONERIUM_SELF_TRANSFER_GAS_LIMIT = "300000"; - -export async function createOnrampEphemeralSelfTransfer( - amountRaw: string, - fromAddress: string, - toAddress: string -): Promise { - const evmClientManager = EvmClientManager.getInstance(); - const network = config.sandboxEnabled ? Networks.PolygonAmoy : Networks.Polygon; - const polygonClient = evmClientManager.getClient(network); - - const transferCallData = encodeFunctionData({ - abi: erc20ABI, - args: [fromAddress, toAddress, amountRaw], - functionName: "transferFrom" - }); - - const { maxFeePerGas } = await polygonClient.estimateFeesPerGas(); - - const txData: EvmTransactionData = { - data: transferCallData as `0x${string}`, - gas: MONERIUM_SELF_TRANSFER_GAS_LIMIT, - maxFeePerGas: String(maxFeePerGas), - maxPriorityFeePerGas: String(maxFeePerGas), - to: ERC20_EURE_POLYGON_V2, - value: "0" - }; - - return txData; -} diff --git a/apps/api/src/api/services/transactions/onramp/common/transactions.test.ts b/apps/api/src/api/services/transactions/onramp/common/transactions.test.ts new file mode 100644 index 000000000..762e8e729 --- /dev/null +++ b/apps/api/src/api/services/transactions/onramp/common/transactions.test.ts @@ -0,0 +1,136 @@ +import {beforeEach, describe, expect, it, mock} from "bun:test"; +import type {AccountMeta, UnsignedTx} from "@vortexfi/shared"; +import type {QuoteTicketAttributes} from "../../../../../models/quoteTicket.model"; + +const Networks = { + Base: "base", + Moonbeam: "moonbeam" +} as const; + +const nablaHardMinimumOutputRawCalls: string[] = []; + +const createNablaTransactionsForOnrampOnEVM = mock( + async ( + _inputAmountForNablaSwapRaw: string, + _account: AccountMeta, + _inputTokenAddress: `0x${string}`, + _outputTokenAddress: `0x${string}`, + nablaHardMinimumOutputRaw: string, + _deadlineMinutes: number, + _router: string + ) => { + nablaHardMinimumOutputRawCalls.push(nablaHardMinimumOutputRaw); + + return { + approve: { + data: "0xapprove", + gas: "100000", + to: "0xinput", + value: "0" + }, + swap: { + data: "0xswap", + gas: "200000", + to: "0xrouter", + value: "0" + } + }; + } +); + +mock.module("@vortexfi/shared", () => ({ + AMM_MINIMUM_OUTPUT_HARD_MARGIN: 0.02, + AMM_MINIMUM_OUTPUT_SOFT_MARGIN: 0.01, + createMoonbeamToPendulumXCM: mock(async () => "0xmoonbeam"), + createNablaTransactionsForOnramp: mock(async () => ({ approve: "0xapprove", swap: "0xswap" })), + createNablaTransactionsForOnrampOnEVM, + encodeSubmittableExtrinsic: (tx: unknown) => tx, + EvmClientManager: { + getInstance: () => ({ + getClient: () => ({ + estimateFeesPerGas: mock(async () => ({ maxFeePerGas: 1n, maxPriorityFeePerGas: 1n })) + }) + }) + }, + getNablaBasePool: () => ({ router: "0xrouter" }), + getNetworkId: () => 1, + Networks +})); + +mock.module("../../../../../config/vars", () => ({ + config: { + swap: { + deadlineMinutes: 20 + } + } +})); + +mock.module("../../moonbeam/cleanup", () => ({ + prepareMoonbeamCleanupTransaction: mock(async () => "0xcleanup") +})); + +mock.module("../../pendulum/cleanup", () => ({ + preparePendulumCleanupTransaction: mock(async () => "0xcleanup") +})); + +const {addNablaSwapTransactionsOnBase} = await import("./transactions"); + +function createQuote(ammOutputAmountRaw?: string): QuoteTicketAttributes { + return { + metadata: { + nablaSwapEvm: { + ammOutputAmountRaw, + inputAmountForSwapRaw: "100000000", + outputAmountRaw: "110000000" + } + } + } as unknown as QuoteTicketAttributes; +} + +describe("addNablaSwapTransactionsOnBase", () => { + const account = { + address: "0x1111111111111111111111111111111111111111", + type: "EVM" + } as unknown as AccountMeta; + + beforeEach(() => { + createNablaTransactionsForOnrampOnEVM.mockClear(); + nablaHardMinimumOutputRawCalls.length = 0; + }); + + it("uses AMM-only output for Nabla minimums when subsidy was merged into the quote", async () => { + const unsignedTxs: UnsignedTx[] = []; + + const result = await addNablaSwapTransactionsOnBase( + { + account, + inputTokenAddress: "0x2222222222222222222222222222222222222222", + outputTokenAddress: "0x3333333333333333333333333333333333333333", + quote: createQuote("100000000") + }, + unsignedTxs, + 7 + ); + + expect(nablaHardMinimumOutputRawCalls).toEqual(["98000000"]); + expect(result.stateMeta.nablaSoftMinimumOutputRaw).toBe("99000000"); + expect(unsignedTxs.map(tx => tx.phase)).toEqual(["nablaApprove", "nablaSwap"]); + expect(result.nextNonce).toBe(9); + }); + + it("falls back to outputAmountRaw for quotes without an AMM-only output snapshot", async () => { + const result = await addNablaSwapTransactionsOnBase( + { + account, + inputTokenAddress: "0x2222222222222222222222222222222222222222", + outputTokenAddress: "0x3333333333333333333333333333333333333333", + quote: createQuote() + }, + [], + 0 + ); + + expect(nablaHardMinimumOutputRawCalls).toEqual(["107800000"]); + expect(result.stateMeta.nablaSoftMinimumOutputRaw).toBe("108900000"); + }); +}); diff --git a/apps/api/src/api/services/transactions/onramp/common/transactions.ts b/apps/api/src/api/services/transactions/onramp/common/transactions.ts index 713c6182e..0cf243b35 100644 --- a/apps/api/src/api/services/transactions/onramp/common/transactions.ts +++ b/apps/api/src/api/services/transactions/onramp/common/transactions.ts @@ -9,6 +9,7 @@ import { EvmNetworks, EvmTransactionData, encodeSubmittableExtrinsic, + getNablaBasePool, getNetworkId, Networks, PendulumTokenDetails, @@ -260,10 +261,19 @@ export async function addNablaSwapTransactionsOnBase( // The input amount for the swap was already calculated in the quote. const inputAmountForNablaSwapRaw = quote.metadata.nablaSwapEvm.inputAmountForSwapRaw; + // For offramps, outputAmountRaw may include a partner subsidy (merged in + // OffRampMergeSubsidyEvmEngine). Use the AMM-only amount when available so + // the on-chain minimum reflects what the AMM can actually deliver. + const minOutputBaseRaw = quote.metadata.nablaSwapEvm.ammOutputAmountRaw ?? quote.metadata.nablaSwapEvm.outputAmountRaw; + // biome-ignore lint/correctness/noUnusedVariables: retained to keep the downstream interface stable while min-output uses the AMM-only amount const outputAmountRaw = Big(quote.metadata.nablaSwapEvm.outputAmountRaw); - const nablaSoftMinimumOutputRaw = outputAmountRaw.mul(1 - AMM_MINIMUM_OUTPUT_SOFT_MARGIN).toFixed(0, 0); - const nablaHardMinimumOutputRaw = outputAmountRaw.mul(1 - AMM_MINIMUM_OUTPUT_HARD_MARGIN).toFixed(0, 0); + const nablaSoftMinimumOutputRaw = Big(minOutputBaseRaw) + .mul(1 - AMM_MINIMUM_OUTPUT_SOFT_MARGIN) + .toFixed(0, 0); + const nablaHardMinimumOutputRaw = Big(minOutputBaseRaw) + .mul(1 - AMM_MINIMUM_OUTPUT_HARD_MARGIN) + .toFixed(0, 0); const { approve, swap } = await createNablaTransactionsForOnrampOnEVM( inputAmountForNablaSwapRaw, @@ -271,7 +281,8 @@ export async function addNablaSwapTransactionsOnBase( inputTokenAddress, outputTokenAddress, nablaHardMinimumOutputRaw, - config.swap.deadlineMinutes + config.swap.deadlineMinutes, + getNablaBasePool(inputTokenAddress, outputTokenAddress).router ); unsignedTxs.push({ diff --git a/apps/api/src/api/services/transactions/onramp/common/types.ts b/apps/api/src/api/services/transactions/onramp/common/types.ts index 7bb618d7e..005b325f2 100644 --- a/apps/api/src/api/services/transactions/onramp/common/types.ts +++ b/apps/api/src/api/services/transactions/onramp/common/types.ts @@ -11,7 +11,10 @@ export type AveniaOnrampTransactionParams = OnrampTransactionParams & { taxId: s export type AlfredpayOnrampTransactionParams = OnrampTransactionParams & { userId: string }; -export type MoneriumOnrampTransactionParams = OnrampTransactionParams & { moneriumWalletAddress: string }; +export type MykoboOnrampTransactionParams = OnrampTransactionParams & { + mykoboEmail: string; + ipAddress: string; +}; export interface OnrampTransactionsWithMeta { unsignedTxs: UnsignedTx[]; diff --git a/apps/api/src/api/services/transactions/onramp/common/validation.ts b/apps/api/src/api/services/transactions/onramp/common/validation.ts index 3cbc29381..2e1bb2a38 100644 --- a/apps/api/src/api/services/transactions/onramp/common/validation.ts +++ b/apps/api/src/api/services/transactions/onramp/common/validation.ts @@ -105,45 +105,42 @@ export function validateAveniaOnrampOnBase( return { evmEphemeralEntry, inputTokenDetails, outputTokenDetails, toNetwork }; } -export function validateMoneriumOnramp( +export function validateMykoboOnramp( quote: QuoteTicketAttributes, signingAccounts: AccountMeta[] ): { toNetwork: Networks; outputTokenDetails: OnChainTokenDetails; - substrateEphemeralEntry: AccountMeta; evmEphemeralEntry: AccountMeta; + inputTokenDetails: OnChainTokenDetails; } { const toNetwork = getNetworkFromDestination(quote.to); if (!toNetwork) { throw new Error(`Invalid network for destination ${quote.to}`); } + const evmEphemeralEntry = signingAccounts.find(ephemeral => ephemeral.type === "EVM"); + if (!evmEphemeralEntry) { + throw new Error("Base ephemeral not found"); + } + if (quote.inputCurrency !== FiatToken.EURC) { - throw new Error(`Input currency must be EURC for onramp, got ${quote.inputCurrency}`); + throw new Error(`Input currency must be EURC for Mykobo onramp, got ${quote.inputCurrency}`); + } + + const inputTokenDetails = getEvmTokenConfig().base[EvmToken.EURC]; + if (!inputTokenDetails) { + throw new Error("EURC token details not found for Base"); } if (!isOnChainToken(quote.outputCurrency)) { throw new Error(`Output currency cannot be fiat token ${quote.outputCurrency} for onramp.`); } const outputTokenDetails = getOnChainTokenDetails(toNetwork, quote.outputCurrency); - if (!outputTokenDetails) { - throw new Error(`Output token details not found for ${quote.outputCurrency} on network ${toNetwork}`); - } - if (!isOnChainTokenDetails(outputTokenDetails)) { + if (!outputTokenDetails || !isOnChainTokenDetails(outputTokenDetails)) { throw new Error(`Output token must be on-chain token for onramp, got ${quote.outputCurrency}`); } - const evmEphemeralEntry = signingAccounts.find(ephemeral => ephemeral.type === "EVM"); - if (!evmEphemeralEntry) { - throw new Error("Polygon ephemeral not found"); - } - - const substrateEphemeralEntry = signingAccounts.find(ephemeral => ephemeral.type === "Substrate"); - if (!substrateEphemeralEntry) { - throw new Error("Pendulum ephemeral not found"); - } - - return { evmEphemeralEntry, outputTokenDetails, substrateEphemeralEntry, toNetwork }; + return { evmEphemeralEntry, inputTokenDetails, outputTokenDetails, toNetwork }; } diff --git a/apps/api/src/api/services/transactions/onramp/index.ts b/apps/api/src/api/services/transactions/onramp/index.ts index ec8a490d4..8c66c4f0e 100644 --- a/apps/api/src/api/services/transactions/onramp/index.ts +++ b/apps/api/src/api/services/transactions/onramp/index.ts @@ -2,26 +2,18 @@ import { FiatToken, isAlfredpayToken, Networks } from "@vortexfi/shared"; import { AlfredpayOnrampTransactionParams, AveniaOnrampTransactionParams, - MoneriumOnrampTransactionParams, OnrampTransactionParams, OnrampTransactionsWithMeta } from "./common/types"; import { prepareAlfredpayToEvmOnrampTransactions } from "./routes/alfredpay-to-evm"; import { prepareAveniaToAssethubOnrampTransactions } from "./routes/avenia-to-assethub"; import { prepareAveniaToEvmOnrampTransactionsOnBase } from "./routes/avenia-to-evm-base"; -import { prepareMoneriumToAssethubOnrampTransactions } from "./routes/monerium-to-assethub"; -import { prepareMoneriumToEvmOnrampTransactions } from "./routes/monerium-to-evm"; export async function prepareOnrampTransactions( - params: - | AveniaOnrampTransactionParams - | MoneriumOnrampTransactionParams - | AlfredpayOnrampTransactionParams - | OnrampTransactionParams + params: AveniaOnrampTransactionParams | AlfredpayOnrampTransactionParams | OnrampTransactionParams ): Promise { const { quote } = params; - // Route based on input currency and destination network if (quote.inputCurrency === FiatToken.BRL) { if (!("taxId" in params)) { throw new Error("taxId is required for Avenia onramp"); @@ -35,15 +27,9 @@ export async function prepareOnrampTransactions( return prepareAveniaToEvmOnrampTransactionsOnBase(aveniaParams); } } else if (quote.inputCurrency === FiatToken.EURC) { - if (!("moneriumWalletAddress" in params)) { - throw new Error("moneriumWalletAddress is required for Monerium onramp"); - } - - if (quote.to === Networks.AssetHub) { - return prepareMoneriumToAssethubOnrampTransactions(params); - } else { - return prepareMoneriumToEvmOnrampTransactions(params); - } + throw new Error( + "EURC onramp must be prepared via prepareMykoboToEvmOnrampTransactions, not through prepareOnrampTransactions" + ); } else if (isAlfredpayToken(quote.inputCurrency as FiatToken)) { if (!("userId" in params)) { throw new Error("Alfredpay onramps requires logged in user"); diff --git a/apps/api/src/api/services/transactions/onramp/routes/alfredpay-to-evm.ts b/apps/api/src/api/services/transactions/onramp/routes/alfredpay-to-evm.ts index b86a476eb..7c45ef6d6 100644 --- a/apps/api/src/api/services/transactions/onramp/routes/alfredpay-to-evm.ts +++ b/apps/api/src/api/services/transactions/onramp/routes/alfredpay-to-evm.ts @@ -16,6 +16,7 @@ import { getOnChainTokenDetailsOrDefault, isEvmToken, isOnChainToken, + multiplyByPowerOfTen, Networks, UnsignedTx } from "@vortexfi/shared"; @@ -76,7 +77,8 @@ export async function prepareAlfredpayToEvmOnrampTransactions({ const fiatToCountry: Partial> = { [FiatToken.USD]: AlfredPayCountry.US, [FiatToken.MXN]: AlfredPayCountry.MX, - [FiatToken.COP]: AlfredPayCountry.CO + [FiatToken.COP]: AlfredPayCountry.CO, + [FiatToken.ARS]: AlfredPayCountry.AR }; const customerCountry = fiatToCountry[quote.inputCurrency as FiatToken]; if (!customerCountry) { @@ -108,7 +110,7 @@ export async function prepareAlfredpayToEvmOnrampTransactions({ // Special case: onramping the AlfredPay token directly on Polygon. Skip SquidRouter and transfer directly. if ((outputTokenDetails as EvmTokenDetails).erc20AddressSourceChain === ALFREDPAY_ERC20_TOKEN) { const finalTransferTxData = await addOnrampDestinationChainTransactions({ - amountRaw: quote.metadata.evmToEvm.outputAmountRaw, + amountRaw: multiplyByPowerOfTen(quote.outputAmount, outputTokenDetails.decimals).toFixed(0, 0), destinationNetwork: toNetwork as EvmNetworks, toAddress: destinationAddress, toToken: (outputTokenDetails as EvmTokenDetails).erc20AddressSourceChain @@ -167,6 +169,49 @@ export async function prepareAlfredpayToEvmOnrampTransactions({ txData: encodeEvmTransactionData(swapData) as EvmTransactionData }); + // Same-chain Polygon: destinationTransfer must be the next executable nonce after the swap. The cleanup + // approval runs post-complete, so it follows the transfer. Backup re-swap txs are omitted here (no handler + // executes them, and on a shared nonce sequence they would push destinationTransfer beyond the live nonce). + if (toNetwork === Networks.Polygon) { + const sameChainTransferTxData = await addOnrampDestinationChainTransactions({ + amountRaw: multiplyByPowerOfTen(quote.outputAmount, outputTokenDetails.decimals).toFixed(0, 0), + destinationNetwork: Networks.Polygon, + toAddress: destinationAddress, + toToken: (outputTokenDetails as EvmTokenDetails).erc20AddressSourceChain + }); + unsignedTxs.push({ + meta: {}, + network: Networks.Polygon, + nonce: polygonAccountNonce++, + phase: "destinationTransfer", + signer: evmEphemeralEntry.address, + txData: encodeEvmTransactionData(sameChainTransferTxData) as EvmTransactionData + }); + + const sameChainCleanupApproval = await preparePolygonCleanupApproval( + ERC20_USDC_POLYGON, + fundingAccount.address, + Networks.Polygon + ); + unsignedTxs.push({ + meta: {}, + network: Networks.Polygon, + nonce: polygonAccountNonce++, + phase: "polygonCleanup", + signer: evmEphemeralEntry.address, + txData: encodeEvmTransactionData(sameChainCleanupApproval) as EvmTransactionData + }); + + stateMeta = { + ...stateMeta, + squidRouterQuoteId, + squidRouterReceiverHash, + squidRouterReceiverId + }; + + return { stateMeta, unsignedTxs }; + } + const polygonCleanupApproval = await preparePolygonCleanupApproval( ERC20_USDC_POLYGON, fundingAccount.address, @@ -182,13 +227,14 @@ export async function prepareAlfredpayToEvmOnrampTransactions({ }); const finalTransferTxData = await addOnrampDestinationChainTransactions({ - amountRaw: quote.metadata.alfredpayMint.outputAmountRaw, + amountRaw: multiplyByPowerOfTen(quote.outputAmount, outputTokenDetails.decimals).toFixed(0, 0), destinationNetwork: toNetwork as EvmNetworks, toAddress: destinationAddress, toToken: (outputTokenDetails as EvmTokenDetails).erc20AddressSourceChain }); - let destinationNonce = toNetwork === Networks.Polygon ? polygonAccountNonce++ : 0; // If the destination is Polygon, we need to use the same nonce sequence. Otherwise, we start fresh on the new chain. + let destinationNonce = 0; + const destinationStartingNonce = destinationNonce; unsignedTxs.push({ meta: {}, @@ -211,7 +257,7 @@ export async function prepareAlfredpayToEvmOnrampTransactions({ fromAddress: evmEphemeralEntry.address, fromToken: bridgedTokenForFallback, network: toNetwork as EvmNetworks, - rawAmount: quote.metadata.alfredpayMint.outputAmountRaw, + rawAmount: multiplyByPowerOfTen(quote.outputAmount, outputTokenDetails.decimals).toFixed(0, 0), toToken: (outputTokenDetails as EvmTokenDetails).erc20AddressSourceChain }); @@ -244,8 +290,8 @@ export async function prepareAlfredpayToEvmOnrampTransactions({ tokenAddress: bridgedTokenForFallback }); - // We set this to 0 on purpose because we don't want to risk that the required nonce is never reached - const backupApproveNonce = 0; + // We set this to the destinationTransfer nonce on purpose because we don't want to risk that the required nonce is never reached + const backupApproveNonce = destinationStartingNonce; unsignedTxs.push({ meta: {}, network: toNetwork, diff --git a/apps/api/src/api/services/transactions/onramp/routes/avenia-to-evm-base.test.ts b/apps/api/src/api/services/transactions/onramp/routes/avenia-to-evm-base.test.ts new file mode 100644 index 000000000..337a89134 --- /dev/null +++ b/apps/api/src/api/services/transactions/onramp/routes/avenia-to-evm-base.test.ts @@ -0,0 +1,230 @@ +import {beforeEach, describe, expect, it, mock} from "bun:test"; +import Big from "big.js"; + +const EVM_EPHEMERAL_ADDRESS = "0x1111111111111111111111111111111111111111"; +const DESTINATION_ADDRESS = "0x2222222222222222222222222222222222222222"; +const FUNDING_ADDRESS = "0x3333333333333333333333333333333333333333"; +const BRLA_BASE = "0xfCB34c47f850f452C15EA1B84d51231C38A61783"; +const USDC_BASE = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"; +const USDT_BSC = "0x55d398326f99059fF775485246999027B3197955"; +const AXL_USDC_BSC = "0x4268B8F0B87b6Eae5d897996E6b845ddbD99Adf3"; + +const Networks = { + BSC: "bsc", + Base: "base", + Ethereum: "ethereum" +} as const; + +const EvmToken = { + AXLUSDC: "AXLUSDC", + USDC: "USDC", + USDT: "USDT" +} as const; + +const FiatToken = { + BRL: "BRL", + EURC: "EUR" +} as const; + +const destinationTransferCalls: Array<{ amountRaw: string; destinationNetwork: string }> = []; + +const addOnrampDestinationChainTransactions = mock(async (params: { amountRaw: string; destinationNetwork: string }) => { + destinationTransferCalls.push(params); + if (!/^\d+$/.test(params.amountRaw)) { + throw new Error(`expected integer raw amount, got ${params.amountRaw}`); + } + return { + data: "0xdestination", + gas: "100000", + maxFeePerGas: "1", + maxPriorityFeePerGas: "1", + to: DESTINATION_ADDRESS, + value: "0" + }; +}); + +mock.module("@vortexfi/shared", () => ({ + createOnrampSquidrouterTransactionsFromBaseToEvm: mock(async () => ({ + approveData: { data: "0xapprove", gas: "100000", to: USDC_BASE, value: "0" }, + squidRouterQuoteId: "quote", + squidRouterReceiverHash: "0xreceiverhash", + squidRouterReceiverId: "receiver", + swapData: { data: "0xswap", gas: "200000", to: USDC_BASE, value: "0" } + })), + createOnrampSquidrouterTransactionsOnDestinationChain: mock(async () => ({ + approveData: { data: "0xbackupapprove", gas: "100000", to: AXL_USDC_BSC, value: "0" }, + swapData: { data: "0xbackupswap", gas: "200000", to: AXL_USDC_BSC, value: "0" } + })), + EvmToken, + FiatToken, + evmTokenConfig: { + [Networks.Base]: { + [EvmToken.USDC]: { + assetSymbol: "USDC", + decimals: 6, + erc20AddressSourceChain: USDC_BASE, + isNative: false, + network: Networks.Base, + type: "evm" + } + }, + [Networks.BSC]: { + [EvmToken.AXLUSDC]: { + assetSymbol: "axlUSDC", + decimals: 6, + erc20AddressSourceChain: AXL_USDC_BSC, + isNative: false, + network: Networks.BSC, + type: "evm" + }, + [EvmToken.USDT]: { + assetSymbol: "USDT", + decimals: 18, + erc20AddressSourceChain: USDT_BSC, + isNative: false, + network: Networks.BSC, + type: "evm" + } + }, + [Networks.Ethereum]: { + [EvmToken.USDC]: { + assetSymbol: "USDC", + decimals: 6, + erc20AddressSourceChain: USDC_BASE, + isNative: false, + network: Networks.Ethereum, + type: "evm" + } + } + }, + getOnChainTokenDetailsOrDefault: mock(() => ({ + assetSymbol: "axlUSDC", + decimals: 6, + erc20AddressSourceChain: AXL_USDC_BSC, + isNative: false, + network: Networks.BSC, + type: "evm" + })), + isEvmTokenDetails: () => true, + isNativeEvmToken: (details: { isNative?: boolean }) => details.isNative === true, + multiplyByPowerOfTen: (value: Big.BigSource, power: number) => { + const result = new Big(value); + if (result.c[0] !== 0) result.e += power; + return result; + }, + Networks +})); + +mock.module("../common/validation", () => ({ + validateAveniaOnrampOnBase: mock(() => ({ + evmEphemeralEntry: { + address: EVM_EPHEMERAL_ADDRESS, + type: "EVM" + }, + inputTokenDetails: { + assetSymbol: "BRLA", + decimals: 18, + erc20AddressSourceChain: BRLA_BASE, + isNative: false, + network: Networks.Base, + type: "evm" + }, + outputTokenDetails: { + assetSymbol: "USDT", + decimals: 18, + erc20AddressSourceChain: USDT_BSC, + isNative: false, + network: Networks.BSC, + type: "evm" + }, + toNetwork: Networks.BSC + })) +})); + +mock.module("../common/transactions", () => ({ + addDestinationChainApprovalTransaction: mock(async () => ({ + data: "0xbackupapprove", + gas: "100000", + maxFeePerGas: "1", + maxPriorityFeePerGas: "1", + to: AXL_USDC_BSC, + value: "0" + })), + addNablaSwapTransactionsOnBase: mock(async (_params, _unsignedTxs, nextNonce: number) => ({ + nextNonce: nextNonce + 2, + stateMeta: { nablaSoftMinimumOutputRaw: "4818988497" } + })), + addOnrampDestinationChainTransactions +})); + +mock.module("../../common/feeDistribution", () => ({ + addEvmFeeDistributionTransaction: mock(async (_quote, _account, _unsignedTxs, nextNonce: number) => nextNonce) +})); + +mock.module("../../base/cleanup", () => ({ + prepareBaseCleanupApproval: mock(async () => ({ + data: "0xcleanup", + gas: "100000", + maxFeePerGas: "1", + maxPriorityFeePerGas: "1", + to: USDC_BASE, + value: "0" + })) +})); + +mock.module("../../index", () => ({ + encodeEvmTransactionData: (data: unknown) => data +})); + +mock.module("../../../phases/evm-funding", () => ({ + getEvmFundingAccount: () => ({ address: FUNDING_ADDRESS }) +})); + +mock.module("../../../../../config/logger", () => ({ + default: { + debug: mock(() => undefined) + } +})); + +const { prepareAveniaToEvmOnrampTransactionsOnBase } = await import("./avenia-to-evm-base"); + +describe("prepareAveniaToEvmOnrampTransactionsOnBase", () => { + beforeEach(() => { + destinationTransferCalls.length = 0; + addOnrampDestinationChainTransactions.mockClear(); + }); + + it("preserves 18-decimal BSC USDT precision for the final destination raw amount", async () => { + await prepareAveniaToEvmOnrampTransactionsOnBase({ + destinationAddress: DESTINATION_ADDRESS, + quote: { + inputCurrency: "BRL", + metadata: { + aveniaTransfer: { + outputAmountRaw: "25002249808000000000000" + }, + evmToEvm: { + inputAmountRaw: "4818926798" + }, + nablaSwapEvm: { + inputAmountForSwapRaw: "25002249808000000000000", + outputAmountRaw: "4818988497" + } + }, + network: Networks.BSC, + outputAmount: "4817.805726163073314321", + outputCurrency: EvmToken.USDT, + to: Networks.BSC + } as never, + signingAccounts: [{ address: EVM_EPHEMERAL_ADDRESS, type: "EVM" }] as never, + taxId: "12345678901" + }); + + expect(destinationTransferCalls).toContainEqual( + expect.objectContaining({ + amountRaw: "4817805726163073314321", + destinationNetwork: Networks.BSC + }) + ); + }); +}); diff --git a/apps/api/src/api/services/transactions/onramp/routes/avenia-to-evm-base.ts b/apps/api/src/api/services/transactions/onramp/routes/avenia-to-evm-base.ts index 5452e6de3..de0394e55 100644 --- a/apps/api/src/api/services/transactions/onramp/routes/avenia-to-evm-base.ts +++ b/apps/api/src/api/services/transactions/onramp/routes/avenia-to-evm-base.ts @@ -18,6 +18,7 @@ import { isAddress } from "viem"; import logger from "../../../../../config/logger"; import { getEvmFundingAccount } from "../../../phases/evm-funding"; import { StateMetadata } from "../../../phases/meta-state-types"; +import { isBrlToBrlaBaseDirect } from "../../../quote/utils"; import { prepareBaseCleanupApproval } from "../../base/cleanup"; import { addEvmFeeDistributionTransaction } from "../../common/feeDistribution"; import { encodeEvmTransactionData } from "../../index"; @@ -53,15 +54,45 @@ export async function prepareAveniaToEvmOnrampTransactionsOnBase({ signingAccounts ); logger.debug(`Starting prepareAveniaToEvmOnrampTransactionsOnBase with destinationAddress: ${destinationAddress}`); + const isDirectTransfer = isBrlToBrlaBaseDirect(quote.inputCurrency, quote.outputCurrency, quote.network); // Setup state metadata stateMeta = { destinationAddress, evmEphemeralAddress: evmEphemeralEntry.address, + isDirectTransfer, taxId }; let baseNonce = 0; + if (!isEvmTokenDetails(outputTokenDetails)) { + throw new Error(`Output token must be an EVM token for onramp to any EVM chain, got ${outputTokenDetails.assetSymbol}`); + } + + // BRL→BRLA on Base: Avenia already minted the requested BRLA, so no Nabla swap, fee-token + // conversion, or SquidRouter step is needed — transfer the minted BRLA straight to the user. + if (isDirectTransfer) { + const finalAmountRaw = multiplyByPowerOfTen(quote.outputAmount, outputTokenDetails.decimals).toFixed(0, 0); + const finalDestinationTransfer = await addOnrampDestinationChainTransactions({ + amountRaw: finalAmountRaw, + destinationNetwork: Networks.Base, + isNativeToken: isNativeEvmToken(outputTokenDetails), + toAddress: destinationAddress, + toToken: outputTokenDetails.erc20AddressSourceChain + }); + + unsignedTxs.push({ + meta: {}, + network: Networks.Base, + nonce: baseNonce, + phase: "destinationTransfer", + signer: evmEphemeralEntry.address, + txData: finalDestinationTransfer + }); + + return { stateMeta, unsignedTxs }; + } + if (!quote.metadata.aveniaTransfer?.outputAmountRaw) { throw new Error("Missing aveniaTransfer amountOutRaw in quote metadata"); } @@ -70,10 +101,6 @@ export async function prepareAveniaToEvmOnrampTransactionsOnBase({ throw new Error("Missing evmToEvm inputAmountRaw in quote metadata"); } - if (!isEvmTokenDetails(outputTokenDetails)) { - throw new Error(`Output token must be an EVM token for onramp to any EVM chain, got ${outputTokenDetails.assetSymbol}`); - } - // Output for BRLA onramp will always go through USDC. // TODO. Unless the actual BRLA token wants to be onramped. const nablaSwapOutputTokenAddress = evmTokenConfig[Networks.Base][EvmToken.USDC]?.erc20AddressSourceChain; @@ -95,12 +122,12 @@ export async function prepareAveniaToEvmOnrampTransactionsOnBase({ baseNonce = await addEvmFeeDistributionTransaction(quote, evmEphemeralEntry, unsignedTxs, baseNonce); - const finalAmountRaw = multiplyByPowerOfTen(quote.outputAmount, outputTokenDetails.decimals); + const finalAmountRaw = multiplyByPowerOfTen(quote.outputAmount, outputTokenDetails.decimals).toFixed(0, 0); // Special case, onramping USDC on Base. We need to skip the SquidRouter step and go directly to the destination transfer. if (toNetwork === Networks.Base && outputTokenDetails.erc20AddressSourceChain === nablaSwapOutputTokenAddress) { const finalDestinationTransfer = await addOnrampDestinationChainTransactions({ - amountRaw: finalAmountRaw.toString(), + amountRaw: finalAmountRaw, destinationNetwork: Networks.Base, isNativeToken: isNativeEvmToken(outputTokenDetails), toAddress: destinationAddress, @@ -174,6 +201,63 @@ export async function prepareAveniaToEvmOnrampTransactionsOnBase({ txData: encodeEvmTransactionData(swapData) as EvmTransactionData }); + // Same-chain Base: destinationTransfer must be the next executable nonce after the swap. Cleanups run + // post-complete, so they follow the transfer. Backup re-swap txs are omitted here (no handler executes + // them, and on a shared nonce sequence they would push destinationTransfer beyond the live nonce). + if (toNetwork === Networks.Base) { + const sameChainDestinationTransfer = await addOnrampDestinationChainTransactions({ + amountRaw: finalAmountRaw, + destinationNetwork: Networks.Base, + isNativeToken: isNativeEvmToken(outputTokenDetails), + toAddress: destinationAddress, + toToken: outputTokenDetails.erc20AddressSourceChain + }); + unsignedTxs.push({ + meta: {}, + network: Networks.Base, + nonce: baseNonce++, + phase: "destinationTransfer", + signer: evmEphemeralEntry.address, + txData: sameChainDestinationTransfer + }); + + const sameChainFundingAddress = getEvmFundingAccount(Networks.Base).address; + const sameChainBrlaAddress = (inputTokenDetails as EvmTokenDetails).erc20AddressSourceChain as `0x${string}`; + + const brlaCleanup = await prepareBaseCleanupApproval(sameChainBrlaAddress, sameChainFundingAddress, Networks.Base); + unsignedTxs.push({ + meta: {}, + network: Networks.Base, + nonce: baseNonce++, + phase: "baseCleanupBrla", + signer: evmEphemeralEntry.address, + txData: encodeEvmTransactionData(brlaCleanup) as EvmTransactionData + }); + + const usdcCleanup = await prepareBaseCleanupApproval( + nablaSwapOutputTokenAddress as `0x${string}`, + sameChainFundingAddress, + Networks.Base + ); + unsignedTxs.push({ + meta: {}, + network: Networks.Base, + nonce: baseNonce++, + phase: "baseCleanupUsdc", + signer: evmEphemeralEntry.address, + txData: encodeEvmTransactionData(usdcCleanup) as EvmTransactionData + }); + + stateMeta = { + ...stateMeta, + squidRouterQuoteId, + squidRouterReceiverHash, + squidRouterReceiverId + }; + + return { stateMeta, unsignedTxs }; + } + const baseFundingAccountAddress = getEvmFundingAccount(Networks.Base).address; const brlaTokenAddress = (inputTokenDetails as EvmTokenDetails).erc20AddressSourceChain as `0x${string}`; @@ -202,9 +286,10 @@ export async function prepareAveniaToEvmOnrampTransactionsOnBase({ }); let destinationNonce = 0; + const destinationStartingNonce = destinationNonce; const finalDestinationTransfer = await addOnrampDestinationChainTransactions({ - amountRaw: finalAmountRaw.toString(), + amountRaw: finalAmountRaw, destinationNetwork: toNetwork as EvmNetworks, isNativeToken: isNativeEvmToken(outputTokenDetails), toAddress: destinationAddress, @@ -222,10 +307,16 @@ export async function prepareAveniaToEvmOnrampTransactionsOnBase({ // Fallback swap depends on the EVM chain. For Ethereum, the bridged token is USDC. For the rest, it is axlUSDC. const destinationAxlUsdcDetails = getOnChainTokenDetailsOrDefault(toNetwork as Networks, EvmToken.AXLUSDC) as EvmTokenDetails; - const bridgedTokenForFallback = - toNetwork === Networks.Ethereum - ? evmTokenConfig.ethereum.USDC!.erc20AddressSourceChain - : destinationAxlUsdcDetails.erc20AddressSourceChain; + let bridgedTokenForFallback: `0x${string}`; + if (toNetwork === Networks.Ethereum) { + const ethereumUsdc = evmTokenConfig.ethereum.USDC; + if (!ethereumUsdc) { + throw new Error("USDC config missing for Ethereum"); + } + bridgedTokenForFallback = ethereumUsdc.erc20AddressSourceChain as `0x${string}`; + } else { + bridgedTokenForFallback = destinationAxlUsdcDetails.erc20AddressSourceChain as `0x${string}`; + } const inputAmountRawFinalBridge = quote.metadata.evmToEvm?.inputAmountRaw; if (!inputAmountRawFinalBridge) { @@ -277,8 +368,8 @@ export async function prepareAveniaToEvmOnrampTransactionsOnBase({ tokenAddress: bridgedTokenForFallback }); - // We set this to 0 on purpose because we don't want to risk that the required nonce is never reached - const backupApproveNonce = 0; + // We set this to the destinationTransfer nonce on purpose because we don't want to risk that the required nonce is never reached + const backupApproveNonce = destinationStartingNonce; unsignedTxs.push({ meta: {}, network: toNetwork, diff --git a/apps/api/src/api/services/transactions/onramp/routes/avenia-to-evm.ts b/apps/api/src/api/services/transactions/onramp/routes/avenia-to-evm.ts index 19f7f3dbd..a6791729d 100644 --- a/apps/api/src/api/services/transactions/onramp/routes/avenia-to-evm.ts +++ b/apps/api/src/api/services/transactions/onramp/routes/avenia-to-evm.ts @@ -182,10 +182,16 @@ export async function prepareAveniaToEvmOnrampTransactions({ moonbeamNonce++; // Fallback swap depends on the EVM chain. For Ethereum, the bridged token is USDC. For the rest, it is axlUSDC. - const bridgedTokenForFallback = - toNetwork === Networks.Ethereum - ? evmTokenConfig.ethereum.USDC!.erc20AddressSourceChain - : destinationAxlUsdcDetails.erc20AddressSourceChain; + let bridgedTokenForFallback: `0x${string}`; + if (toNetwork === Networks.Ethereum) { + const ethereumUsdc = evmTokenConfig.ethereum.USDC; + if (!ethereumUsdc) { + throw new Error("USDC config missing for Ethereum"); + } + bridgedTokenForFallback = ethereumUsdc.erc20AddressSourceChain as `0x${string}`; + } else { + bridgedTokenForFallback = destinationAxlUsdcDetails.erc20AddressSourceChain as `0x${string}`; + } const { approveData: destApproveData, swapData: destSwapData } = await createOnrampSquidrouterTransactionsOnDestinationChain({ destinationAddress: evmEphemeralEntry.address, @@ -198,10 +204,10 @@ export async function prepareAveniaToEvmOnrampTransactions({ let destinationNonce = 0; - const finalAmountRaw = multiplyByPowerOfTen(quote.outputAmount, outputTokenDetails.decimals); + const finalAmountRaw = multiplyByPowerOfTen(quote.outputAmount, outputTokenDetails.decimals).toFixed(0, 0); const finalDestinationTransfer = await addOnrampDestinationChainTransactions({ - amountRaw: finalAmountRaw.toString(), + amountRaw: finalAmountRaw, destinationNetwork: toNetwork as EvmNetworks, isNativeToken: isNativeEvmToken(outputTokenDetails), toAddress: destinationAddress, diff --git a/apps/api/src/api/services/transactions/onramp/routes/monerium-to-assethub.ts b/apps/api/src/api/services/transactions/onramp/routes/monerium-to-assethub.ts deleted file mode 100644 index a5b2daddd..000000000 --- a/apps/api/src/api/services/transactions/onramp/routes/monerium-to-assethub.ts +++ /dev/null @@ -1,289 +0,0 @@ -import { - AXL_USDC_MOONBEAM, - createOnrampSquidrouterTransactionsFromPolygonToMoonbeamWithPendulumPosthook, - createPendulumToAssethubTransfer, - createPendulumToHydrationTransfer, - ERC20_EURE_POLYGON_V1, - EvmTransactionData, - encodeSubmittableExtrinsic, - getNetworkId, - getPendulumDetails, - isAssetHubTokenDetails, - Networks, - PENDULUM_USDC_AXL, - UnsignedTx -} from "@vortexfi/shared"; -import Big from "big.js"; -import { config } from "../../../../../config/vars"; -import { getEvmFundingAccount } from "../../../phases/evm-funding"; -import { StateMetadata } from "../../../phases/meta-state-types"; -import { addFeeDistributionTransaction } from "../../common/feeDistribution"; -import { buildHydrationSwapTransaction, buildHydrationToAssetHubTransfer } from "../../hydration"; -import { prepareHydrationCleanupTransaction } from "../../hydration/cleanup"; -import { encodeEvmTransactionData } from "../../index"; -import { preparePolygonCleanupApproval } from "../../polygon/cleanup"; -import { createOnrampEphemeralSelfTransfer } from "../common/monerium"; -import { addMoonbeamTransactions, addNablaSwapTransactions, addPendulumCleanupTx } from "../common/transactions"; -import { MoneriumOnrampTransactionParams, OnrampTransactionsWithMeta } from "../common/types"; -import { validateMoneriumOnramp } from "../common/validation"; - -/** - * Prepares all transactions for a Monerium (EUR) onramp to AssetHub. - * This route handles: EUR → Polygon (EURe) → Moonbeam (axlUSDC) → Pendulum (swap) → AssetHub (final transfer) - */ -export async function prepareMoneriumToAssethubOnrampTransactions({ - quote, - signingAccounts, - destinationAddress, - moneriumWalletAddress -}: MoneriumOnrampTransactionParams): Promise { - let stateMeta: Partial = {}; - const unsignedTxs: UnsignedTx[] = []; - - // Validate inputs and extract required data - const { toNetwork, outputTokenDetails, evmEphemeralEntry, substrateEphemeralEntry } = validateMoneriumOnramp( - quote, - signingAccounts - ); - const toNetworkId = getNetworkId(toNetwork); - - // Setup state metadata - stateMeta = { - destinationAddress, - evmEphemeralAddress: evmEphemeralEntry.address, - moneriumWalletAddress, - substrateEphemeralAddress: substrateEphemeralEntry.address, - walletAddress: destinationAddress - }; - - if (!quote.metadata.moneriumMint?.outputAmountRaw) { - throw new Error("Missing moonbeamToEvm output amount in quote metadata"); - } - - const inputAmountPostAnchorFeeRaw = new Big(quote.metadata.moneriumMint.outputAmountRaw).toFixed(0, 0); - - let polygonAccountNonce = 0; - - const polygonSelfTransferTxData = await createOnrampEphemeralSelfTransfer( - inputAmountPostAnchorFeeRaw, - moneriumWalletAddress, - evmEphemeralEntry.address - ); - const moneriumMintNetwork = config.sandboxEnabled ? Networks.PolygonAmoy : Networks.Polygon; - - unsignedTxs.push({ - meta: {}, - network: moneriumMintNetwork, - nonce: polygonAccountNonce++, - phase: "moneriumOnrampSelfTransfer", - signer: evmEphemeralEntry.address, - txData: encodeEvmTransactionData(polygonSelfTransferTxData) as EvmTransactionData - }); - - const { approveData, swapData, squidRouterReceiverId, squidRouterReceiverHash, squidRouterQuoteId } = - await createOnrampSquidrouterTransactionsFromPolygonToMoonbeamWithPendulumPosthook({ - destinationAddress: substrateEphemeralEntry.address, - fromAddress: evmEphemeralEntry.address, - fromToken: ERC20_EURE_POLYGON_V1, - rawAmount: inputAmountPostAnchorFeeRaw, - toToken: AXL_USDC_MOONBEAM - }); - - unsignedTxs.push({ - meta: {}, - network: moneriumMintNetwork, - nonce: polygonAccountNonce++, - phase: "squidRouterApprove", - signer: evmEphemeralEntry.address, - txData: encodeEvmTransactionData(approveData) as EvmTransactionData - }); - - unsignedTxs.push({ - meta: {}, - network: moneriumMintNetwork, - nonce: polygonAccountNonce++, - phase: "squidRouterSwap", - signer: evmEphemeralEntry.address, - txData: encodeEvmTransactionData(swapData) as EvmTransactionData - }); - - const fundingAccount = getEvmFundingAccount(moneriumMintNetwork); - const polygonCleanupApproval = await preparePolygonCleanupApproval( - ERC20_EURE_POLYGON_V1, - fundingAccount.address, - moneriumMintNetwork - ); - unsignedTxs.push({ - meta: {}, - network: moneriumMintNetwork, - nonce: polygonAccountNonce++, - phase: "polygonCleanup", - signer: evmEphemeralEntry.address, - txData: encodeEvmTransactionData(polygonCleanupApproval) as EvmTransactionData - }); - - stateMeta = { - ...stateMeta, - squidRouterQuoteId, - squidRouterReceiverHash, - squidRouterReceiverId - }; - - if (!quote.metadata.evmToMoonbeam?.outputAmountRaw) { - throw new Error("Missing evmToMoonbeam in quote metadata"); - } - const receivedTokensOnMoonbeam = quote.metadata.evmToMoonbeam.outputAmountRaw; - - await addMoonbeamTransactions( - { - account: evmEphemeralEntry, - fromToken: AXL_USDC_MOONBEAM, - inputAmountRaw: receivedTokensOnMoonbeam, - pendulumEphemeralAddress: substrateEphemeralEntry.address, - toNetworkId - }, - unsignedTxs, - 0 // start nonce - ); - - // Pendulum: Nabla swap and transfer to AssetHub - const inputTokenPendulumDetails = PENDULUM_USDC_AXL; - const outputTokenPendulumDetails = getPendulumDetails(quote.outputCurrency, toNetwork); - - let pendulumNonce = 0; - - // Add Nabla swap transactions - const { nextNonce: nonceAfterNabla, stateMeta: nablaStateMeta } = await addNablaSwapTransactions( - { - account: substrateEphemeralEntry, - inputTokenPendulumDetails, - outputTokenPendulumDetails, - quote - }, - unsignedTxs, - pendulumNonce - ); - stateMeta = { ...stateMeta, ...nablaStateMeta }; - pendulumNonce = nonceAfterNabla; - - // Add fee distribution - pendulumNonce = await addFeeDistributionTransaction(quote, substrateEphemeralEntry, unsignedTxs, pendulumNonce); - - // Finalization: Transfer to AssetHub - const pendulumCleanupTx = await addPendulumCleanupTx({ - account: substrateEphemeralEntry, - inputTokenPendulumDetails, - outputTokenPendulumDetails - }); - - if (quote.outputCurrency === "USDC") { - if (!quote.metadata.pendulumToAssethubXcm?.inputAmountRaw) { - throw new Error("Missing input amount for Pendulum to Assethub transfer"); - } - const transferAmountRaw = quote.metadata.pendulumToAssethubXcm.inputAmountRaw; - - const pendulumToAssethubXcmTransaction = await createPendulumToAssethubTransfer( - destinationAddress, - outputTokenDetails.pendulumRepresentative.currencyId, - transferAmountRaw - ); - - unsignedTxs.push({ - meta: {}, - network: Networks.Pendulum, - nonce: pendulumNonce, - phase: "pendulumToAssethubXcm", - signer: substrateEphemeralEntry.address, - txData: encodeSubmittableExtrinsic(pendulumToAssethubXcmTransaction) - }); - pendulumNonce++; - } else { - if (!quote.metadata.pendulumToHydrationXcm?.inputAmountRaw) { - throw new Error("Missing input amount for Pendulum to Hydration transfer"); - } - const transferAmountRaw = quote.metadata.pendulumToHydrationXcm.inputAmountRaw; - - const pendulumToHydrationXcmTransaction = await createPendulumToHydrationTransfer( - substrateEphemeralEntry.address, - outputTokenDetails.pendulumRepresentative.currencyId, - transferAmountRaw - ); - - unsignedTxs.push({ - meta: {}, - network: Networks.Pendulum, - nonce: pendulumNonce, - phase: "pendulumToHydrationXcm", - signer: substrateEphemeralEntry.address, - txData: encodeSubmittableExtrinsic(pendulumToHydrationXcmTransaction) - }); - pendulumNonce++; - - if (!quote.metadata.hydrationSwap) { - throw new Error("Missing hydration swap details for Hydration finalization"); - } - - // Keep the hydration nonce at 0. It doesn't increase on the network for some reason - const hydrationNonce = 0; - const { inputAsset, outputAsset, inputAmountDecimal, minOutputAmountRaw } = quote.metadata.hydrationSwap; - const hydrationSwap = await buildHydrationSwapTransaction( - inputAsset, - outputAsset, - inputAmountDecimal, - substrateEphemeralEntry.address, - quote.metadata.hydrationSwap.slippagePercent - ); - - unsignedTxs.push({ - meta: {}, - network: Networks.Hydration, - nonce: hydrationNonce, - phase: "hydrationSwap", - signer: substrateEphemeralEntry.address, - txData: encodeSubmittableExtrinsic(hydrationSwap) - }); - - // Transfer from Hydration to AssetHub - if (!isAssetHubTokenDetails(outputTokenDetails)) { - throw new Error( - `Output token must be an AssetHub token for finalization to AssetHub, got ${outputTokenDetails.assetSymbol}` - ); - } - const hydrationAssetId = outputTokenDetails.hydrationId; - // biome-ignore lint/style/noNonNullAssertion: Checked by isAssetHubTokenDetails - const assethubAssetId = outputTokenDetails.isNative ? "native" : outputTokenDetails.foreignAssetId!; - - const hydrationToAssethubTransfer = await buildHydrationToAssetHubTransfer( - destinationAddress, - minOutputAmountRaw, - hydrationAssetId, - assethubAssetId - ); - - unsignedTxs.push({ - meta: {}, - network: Networks.Hydration, - nonce: hydrationNonce, - phase: "hydrationToAssethubXcm", - signer: substrateEphemeralEntry.address, - txData: encodeSubmittableExtrinsic(hydrationToAssethubTransfer) - }); - - const hydrationCleanupTx = await prepareHydrationCleanupTransaction(inputAsset, outputAsset); - unsignedTxs.push({ - meta: {}, - network: Networks.Hydration, - nonce: hydrationNonce, - phase: "hydrationCleanup", - signer: substrateEphemeralEntry.address, - txData: encodeSubmittableExtrinsic(hydrationCleanupTx) - }); - } - - unsignedTxs.push({ - ...pendulumCleanupTx, - nonce: pendulumNonce - }); - - return { stateMeta, unsignedTxs }; -} diff --git a/apps/api/src/api/services/transactions/onramp/routes/monerium-to-evm.ts b/apps/api/src/api/services/transactions/onramp/routes/monerium-to-evm.ts deleted file mode 100644 index c8b017120..000000000 --- a/apps/api/src/api/services/transactions/onramp/routes/monerium-to-evm.ts +++ /dev/null @@ -1,234 +0,0 @@ -import { - createOnrampSquidrouterTransactionsFromPolygonToEvm, - createOnrampSquidrouterTransactionsOnDestinationChain, - ERC20_EURE_POLYGON_V1, - EvmNetworks, - EvmToken, - EvmTokenDetails, - EvmTransactionData, - evmTokenConfig, - getOnChainTokenDetailsOrDefault, - isAssetHubTokenDetails, - isNativeEvmToken, - multiplyByPowerOfTen, - Networks, - UnsignedTx -} from "@vortexfi/shared"; -import Big from "big.js"; -import { isAddress } from "viem"; -import { config } from "../../../../../config/vars"; -import { getEvmFundingAccount } from "../../../phases/evm-funding"; -import { StateMetadata } from "../../../phases/meta-state-types"; -import { priceFeedService } from "../../../priceFeed.service"; -import { encodeEvmTransactionData } from "../../index"; -import { preparePolygonCleanupApproval } from "../../polygon/cleanup"; -import { createOnrampEphemeralSelfTransfer } from "../common/monerium"; -import { addDestinationChainApprovalTransaction, addOnrampDestinationChainTransactions } from "../common/transactions"; -import { MoneriumOnrampTransactionParams, OnrampTransactionsWithMeta } from "../common/types"; -import { validateMoneriumOnramp } from "../common/validation"; - -/** - * Prepares all transactions for a Monerium (EUR) onramp to EVM chain. - * This route handles: EUR → Polygon (EURE) → EVM (final transfer) - */ -export async function prepareMoneriumToEvmOnrampTransactions({ - quote, - signingAccounts, - destinationAddress, - moneriumWalletAddress -}: MoneriumOnrampTransactionParams): Promise { - let stateMeta: Partial = {}; - const unsignedTxs: UnsignedTx[] = []; - - // Validate that destinationAddress is a valid EVM address for EVM routes - if (!isAddress(destinationAddress)) { - throw new Error(`Invalid destination address for EVM route: ${destinationAddress}. Must be a valid EVM address.`); - } - - // Validate inputs and extract required data - const { toNetwork, outputTokenDetails, evmEphemeralEntry } = validateMoneriumOnramp(quote, signingAccounts); - - if (isAssetHubTokenDetails(outputTokenDetails)) { - throw new Error(`AssetHub token ${quote.outputCurrency} is not supported for onramp.`); - } - - if (!quote.metadata.moneriumMint?.outputAmountRaw) { - throw new Error("Missing moonbeamToEvm output amount in quote metadata"); - } - - if (!quote.metadata.evmToEvm?.inputAmountDecimal) { - throw new Error("Missing evmToEvm input amount in quote metadata"); - } - - const inputAmountPostAnchorFeeRaw = new Big(quote.metadata.moneriumMint.outputAmountRaw).toFixed(0, 0); - - // Setup state metadata - stateMeta = { - destinationAddress, - evmEphemeralAddress: evmEphemeralEntry.address, - moneriumWalletAddress, - walletAddress: destinationAddress - }; - - const moneriumMintNetwork = config.sandboxEnabled ? Networks.PolygonAmoy : Networks.Polygon; - const fundingAccount = getEvmFundingAccount(moneriumMintNetwork); - - let polygonAccountNonce = 0; - - const polygonSelfTransferTxData = await createOnrampEphemeralSelfTransfer( - inputAmountPostAnchorFeeRaw, - moneriumWalletAddress, - evmEphemeralEntry.address - ); - - unsignedTxs.push({ - meta: {}, - network: moneriumMintNetwork, - nonce: polygonAccountNonce++, - phase: "moneriumOnrampSelfTransfer", - signer: evmEphemeralEntry.address, - txData: encodeEvmTransactionData(polygonSelfTransferTxData) as EvmTransactionData - }); - - const { approveData, swapData, squidRouterQuoteId, squidRouterReceiverId, squidRouterReceiverHash } = - await createOnrampSquidrouterTransactionsFromPolygonToEvm({ - destinationAddress: evmEphemeralEntry.address, - fromAddress: evmEphemeralEntry.address, - fromToken: ERC20_EURE_POLYGON_V1, - rawAmount: inputAmountPostAnchorFeeRaw, - toNetwork, - toToken: outputTokenDetails.erc20AddressSourceChain - }); - - unsignedTxs.push({ - meta: {}, - network: moneriumMintNetwork, - nonce: polygonAccountNonce++, - phase: "squidRouterApprove", - signer: evmEphemeralEntry.address, - txData: encodeEvmTransactionData(approveData) as EvmTransactionData - }); - - unsignedTxs.push({ - meta: {}, - network: moneriumMintNetwork, - nonce: polygonAccountNonce++, - phase: "squidRouterSwap", - signer: evmEphemeralEntry.address, - txData: encodeEvmTransactionData(swapData) as EvmTransactionData - }); - - const polygonCleanupApproval = await preparePolygonCleanupApproval( - ERC20_EURE_POLYGON_V1, - fundingAccount.address, - moneriumMintNetwork - ); - - unsignedTxs.push({ - meta: {}, - network: moneriumMintNetwork, - nonce: polygonAccountNonce++, - phase: "polygonCleanup", - signer: evmEphemeralEntry.address, - txData: encodeEvmTransactionData(polygonCleanupApproval) as EvmTransactionData - }); - - let destinationNonce = toNetwork === Networks.Polygon ? polygonAccountNonce : 0; - - const finalAmountRaw = multiplyByPowerOfTen(quote.outputAmount, outputTokenDetails.decimals); - const finalDestinationTransfer = await addOnrampDestinationChainTransactions({ - amountRaw: finalAmountRaw.toString(), - destinationNetwork: toNetwork as EvmNetworks, - isNativeToken: isNativeEvmToken(outputTokenDetails), - toAddress: destinationAddress, - toToken: outputTokenDetails.erc20AddressSourceChain - }); - - unsignedTxs.push({ - meta: {}, - network: toNetwork, - nonce: destinationNonce, - phase: "destinationTransfer", - signer: evmEphemeralEntry.address, - txData: finalDestinationTransfer - }); - - // Fallback swap depends on the EVM chain. For Ethereum, the bridged token is USDC. For the rest, it is axlUSDC. - const destinationAxlUsdcDetails = getOnChainTokenDetailsOrDefault(toNetwork as Networks, EvmToken.AXLUSDC) as EvmTokenDetails; - - const bridgedTokenForFallback = - toNetwork === Networks.Ethereum - ? evmTokenConfig.ethereum.USDC!.erc20AddressSourceChain - : destinationAxlUsdcDetails.erc20AddressSourceChain; - - const intermediateUsdAmountForFallback = await priceFeedService.convertCurrency( - Big(quote.metadata.evmToEvm?.inputAmountDecimal).toFixed(2, 0), - quote.inputCurrency, - EvmToken.USDC - ); - const intermediateUsdAmountForFallbackRaw = multiplyByPowerOfTen( - intermediateUsdAmountForFallback, - destinationAxlUsdcDetails.decimals - ).toFixed(0, 0); - - const { approveData: destApproveData, swapData: destSwapData } = await createOnrampSquidrouterTransactionsOnDestinationChain({ - destinationAddress: evmEphemeralEntry.address, - fromAddress: evmEphemeralEntry.address, - fromToken: bridgedTokenForFallback, - network: toNetwork as EvmNetworks, - rawAmount: intermediateUsdAmountForFallbackRaw, - toToken: outputTokenDetails.erc20AddressSourceChain - }); - - destinationNonce++; - - unsignedTxs.push({ - meta: {}, - network: toNetwork, - nonce: destinationNonce, - phase: "backupSquidRouterApprove", - signer: evmEphemeralEntry.address, - txData: encodeEvmTransactionData(destApproveData) as EvmTransactionData - }); - destinationNonce++; - - unsignedTxs.push({ - meta: {}, - network: toNetwork, - nonce: destinationNonce, - phase: "backupSquidRouterSwap", - signer: evmEphemeralEntry.address, - txData: encodeEvmTransactionData(destSwapData) as EvmTransactionData - }); - destinationNonce++; - - const maxUint256 = 2n ** 256n - 1n; - - const backupApproveTransaction = await addDestinationChainApprovalTransaction({ - amountRaw: maxUint256.toString(), - destinationNetwork: toNetwork as EvmNetworks, - spenderAddress: fundingAccount.address, - tokenAddress: bridgedTokenForFallback - }); - - // We set this to 0 for non-polygon networks on purpose because we don't want to risk that the required nonce - // is never reached - const backupApproveNonce = toNetwork === Networks.Polygon ? polygonAccountNonce : 0; - unsignedTxs.push({ - meta: {}, - network: toNetwork, - nonce: backupApproveNonce, - phase: "backupApprove", - signer: evmEphemeralEntry.address, - txData: backupApproveTransaction - }); - - stateMeta = { - ...stateMeta, - squidRouterQuoteId, - squidRouterReceiverHash, - squidRouterReceiverId - }; - - return { stateMeta, unsignedTxs }; -} diff --git a/apps/api/src/api/services/transactions/onramp/routes/mykobo-to-evm.ts b/apps/api/src/api/services/transactions/onramp/routes/mykobo-to-evm.ts new file mode 100644 index 000000000..02a0a1454 --- /dev/null +++ b/apps/api/src/api/services/transactions/onramp/routes/mykobo-to-evm.ts @@ -0,0 +1,404 @@ +import { + createOnrampSquidrouterTransactionsFromBaseToEvm, + createOnrampSquidrouterTransactionsOnDestinationChain, + EvmNetworks, + EvmToken, + EvmTokenDetails, + EvmTransactionData, + evmTokenConfig, + getOnChainTokenDetailsOrDefault, + isEvmTokenDetails, + isNativeEvmToken, + multiplyByPowerOfTen, + Networks, + UnsignedTx +} from "@vortexfi/shared"; +import Big from "big.js"; +import { isAddress } from "viem"; +import logger from "../../../../../config/logger"; +import { getEvmFundingAccount } from "../../../phases/evm-funding"; +import { StateMetadata } from "../../../phases/meta-state-types"; +import { isEurToEurcBaseDirect } from "../../../quote/utils"; +import { prepareBaseCleanupApproval } from "../../base/cleanup"; +import { addEvmFeeDistributionTransaction } from "../../common/feeDistribution"; +import { encodeEvmTransactionData } from "../../index"; +import { + addDestinationChainApprovalTransaction, + addNablaSwapTransactionsOnBase, + addOnrampDestinationChainTransactions +} from "../common/transactions"; +import { MykoboOnrampTransactionParams, OnrampTransactionsWithMeta } from "../common/types"; +import { validateMykoboOnramp } from "../common/validation"; + +/** + * Prepares all transactions for a Mykobo (EUR) onramp to an EVM chain via Base. + * + * Flow: user SEPA deposit → EURC on Base ephemeral → Nabla swap EURC→USDC → SquidRouter to destination chain. + * + * Unlike Avenia/BRLA, no on-chain mint step is required: Mykobo settles the SEPA deposit + * directly on the Base ephemeral as EURC. The Mykobo deposit intent is expected to have been + * created by the caller; its identifiers are threaded into stateMeta. + */ +export async function prepareMykoboToEvmOnrampTransactions({ + quote, + signingAccounts, + destinationAddress, + mykoboEmail, + mykoboTransactionId, + mykoboTransactionReference +}: MykoboOnrampTransactionParams & { + mykoboTransactionId: string; + mykoboTransactionReference: string; +}): Promise { + let stateMeta: Partial = {}; + const unsignedTxs: UnsignedTx[] = []; + + if (!isAddress(destinationAddress)) { + throw new Error(`Invalid destination address for EVM route: ${destinationAddress}. Must be a valid EVM address.`); + } + + const { toNetwork, outputTokenDetails, evmEphemeralEntry, inputTokenDetails } = validateMykoboOnramp(quote, signingAccounts); + logger.debug(`Starting prepareMykoboToEvmOnrampTransactions with destinationAddress: ${destinationAddress}`); + + if (!isEvmTokenDetails(outputTokenDetails)) { + throw new Error(`Output token must be an EVM token for onramp to any EVM chain, got ${outputTokenDetails.assetSymbol}`); + } + + const isDirectTransfer = isEurToEurcBaseDirect(quote.inputCurrency, quote.outputCurrency, quote.network); + if (!isDirectTransfer && !quote.metadata.nablaSwapEvm?.outputAmountRaw) { + throw new Error("Missing nablaSwapEvm.outputAmountRaw in quote metadata for Mykobo onramp"); + } + + if (!isDirectTransfer && !quote.metadata.evmToEvm?.inputAmountRaw) { + throw new Error("Missing evmToEvm.inputAmountRaw in quote metadata for Mykobo onramp"); + } + const bridgeInputAmountRaw = quote.metadata.evmToEvm?.inputAmountRaw; + + stateMeta = { + destinationAddress, + evmEphemeralAddress: evmEphemeralEntry.address, + isDirectTransfer, + mykoboEmail, + mykoboTransactionId, + mykoboTransactionReference, + walletAddress: destinationAddress + }; + + let baseNonce = 0; + + if (isDirectTransfer) { + const finalAmountRaw = multiplyByPowerOfTen(quote.outputAmount, outputTokenDetails.decimals).toFixed(0, 0); + const finalDestinationTransfer = await addOnrampDestinationChainTransactions({ + amountRaw: finalAmountRaw, + destinationNetwork: Networks.Base, + isNativeToken: isNativeEvmToken(outputTokenDetails), + toAddress: destinationAddress, + toToken: outputTokenDetails.erc20AddressSourceChain + }); + + unsignedTxs.push({ + meta: {}, + network: Networks.Base, + nonce: baseNonce, + phase: "destinationTransfer", + signer: evmEphemeralEntry.address, + txData: finalDestinationTransfer + }); + + return { stateMeta, unsignedTxs }; + } + + const nablaSwapOutputTokenAddress = evmTokenConfig[Networks.Base][EvmToken.USDC]?.erc20AddressSourceChain; + if (!nablaSwapOutputTokenAddress) { + throw new Error("Invalid USDC configuration for Base in evmTokenConfig"); + } + const eurcInputTokenAddress = (inputTokenDetails as EvmTokenDetails).erc20AddressSourceChain; + + const { nextNonce: nonceAfterNabla, stateMeta: nablaStateMeta } = await addNablaSwapTransactionsOnBase( + { + account: evmEphemeralEntry, + inputTokenAddress: eurcInputTokenAddress, + outputTokenAddress: nablaSwapOutputTokenAddress, + quote + }, + unsignedTxs, + baseNonce + ); + stateMeta = { ...stateMeta, ...nablaStateMeta }; + baseNonce = nonceAfterNabla; + + baseNonce = await addEvmFeeDistributionTransaction(quote, evmEphemeralEntry, unsignedTxs, baseNonce); + + const finalAmountRaw = multiplyByPowerOfTen(quote.outputAmount, outputTokenDetails.decimals).toFixed(0, 0); + + // Special case: onramping USDC on Base. Skip SquidRouter and transfer directly to destination. + if (toNetwork === Networks.Base && outputTokenDetails.erc20AddressSourceChain === nablaSwapOutputTokenAddress) { + const finalDestinationTransfer = await addOnrampDestinationChainTransactions({ + amountRaw: finalAmountRaw, + destinationNetwork: Networks.Base, + isNativeToken: isNativeEvmToken(outputTokenDetails), + toAddress: destinationAddress, + toToken: outputTokenDetails.erc20AddressSourceChain + }); + + unsignedTxs.push({ + meta: {}, + network: Networks.Base, + nonce: baseNonce++, + phase: "destinationTransfer", + signer: evmEphemeralEntry.address, + txData: finalDestinationTransfer + }); + + const baseFundingAccountAddress = getEvmFundingAccount(Networks.Base).address; + + const eurcCleanupApproval = await prepareBaseCleanupApproval( + eurcInputTokenAddress as `0x${string}`, + baseFundingAccountAddress, + Networks.Base + ); + unsignedTxs.push({ + meta: {}, + network: Networks.Base, + nonce: baseNonce++, + phase: "baseCleanupEurc", + signer: evmEphemeralEntry.address, + txData: encodeEvmTransactionData(eurcCleanupApproval) as EvmTransactionData + }); + + const usdcCleanupApproval = await prepareBaseCleanupApproval( + nablaSwapOutputTokenAddress as `0x${string}`, + baseFundingAccountAddress, + Networks.Base + ); + unsignedTxs.push({ + meta: {}, + network: Networks.Base, + nonce: baseNonce++, + phase: "baseCleanupUsdc", + signer: evmEphemeralEntry.address, + txData: encodeEvmTransactionData(usdcCleanupApproval) as EvmTransactionData + }); + + return { stateMeta, unsignedTxs }; + } + + const { approveData, swapData, squidRouterQuoteId, squidRouterReceiverId, squidRouterReceiverHash } = + await createOnrampSquidrouterTransactionsFromBaseToEvm({ + destinationAddress: evmEphemeralEntry.address, + fromAddress: evmEphemeralEntry.address, + fromToken: nablaSwapOutputTokenAddress, + rawAmount: bridgeInputAmountRaw as string, + toNetwork, + toToken: (outputTokenDetails as EvmTokenDetails).erc20AddressSourceChain + }); + + unsignedTxs.push({ + meta: {}, + network: Networks.Base, + nonce: baseNonce++, + phase: "squidRouterApprove", + signer: evmEphemeralEntry.address, + txData: encodeEvmTransactionData(approveData) as EvmTransactionData + }); + + unsignedTxs.push({ + meta: {}, + network: Networks.Base, + nonce: baseNonce++, + phase: "squidRouterSwap", + signer: evmEphemeralEntry.address, + txData: encodeEvmTransactionData(swapData) as EvmTransactionData + }); + + // Same-chain Base: destinationTransfer must be the next executable nonce after the swap. Cleanups run + // post-complete, so they follow the transfer. Backup re-swap txs are omitted here (no handler executes + // them, and on a shared nonce sequence they would push destinationTransfer beyond the live nonce). + if (toNetwork === Networks.Base) { + const sameChainDestinationTransfer = await addOnrampDestinationChainTransactions({ + amountRaw: finalAmountRaw, + destinationNetwork: Networks.Base, + isNativeToken: isNativeEvmToken(outputTokenDetails), + toAddress: destinationAddress, + toToken: outputTokenDetails.erc20AddressSourceChain + }); + unsignedTxs.push({ + meta: {}, + network: Networks.Base, + nonce: baseNonce++, + phase: "destinationTransfer", + signer: evmEphemeralEntry.address, + txData: sameChainDestinationTransfer + }); + + const sameChainFundingAddress = getEvmFundingAccount(Networks.Base).address; + + const eurcCleanup = await prepareBaseCleanupApproval( + eurcInputTokenAddress as `0x${string}`, + sameChainFundingAddress, + Networks.Base + ); + unsignedTxs.push({ + meta: {}, + network: Networks.Base, + nonce: baseNonce++, + phase: "baseCleanupEurc", + signer: evmEphemeralEntry.address, + txData: encodeEvmTransactionData(eurcCleanup) as EvmTransactionData + }); + + const usdcCleanup = await prepareBaseCleanupApproval( + nablaSwapOutputTokenAddress as `0x${string}`, + sameChainFundingAddress, + Networks.Base + ); + unsignedTxs.push({ + meta: {}, + network: Networks.Base, + nonce: baseNonce++, + phase: "baseCleanupUsdc", + signer: evmEphemeralEntry.address, + txData: encodeEvmTransactionData(usdcCleanup) as EvmTransactionData + }); + + stateMeta = { + ...stateMeta, + squidRouterQuoteId, + squidRouterReceiverHash, + squidRouterReceiverId + }; + + return { stateMeta, unsignedTxs }; + } + + const baseFundingAccountAddress = getEvmFundingAccount(Networks.Base).address; + + const eurcCleanupApproval = await prepareBaseCleanupApproval( + eurcInputTokenAddress as `0x${string}`, + baseFundingAccountAddress, + Networks.Base + ); + unsignedTxs.push({ + meta: {}, + network: Networks.Base, + nonce: baseNonce++, + phase: "baseCleanupEurc", + signer: evmEphemeralEntry.address, + txData: encodeEvmTransactionData(eurcCleanupApproval) as EvmTransactionData + }); + + const usdcCleanupApproval = await prepareBaseCleanupApproval( + nablaSwapOutputTokenAddress as `0x${string}`, + baseFundingAccountAddress, + Networks.Base + ); + unsignedTxs.push({ + meta: {}, + network: Networks.Base, + nonce: baseNonce++, + phase: "baseCleanupUsdc", + signer: evmEphemeralEntry.address, + txData: encodeEvmTransactionData(usdcCleanupApproval) as EvmTransactionData + }); + + let destinationNonce = 0; + const destinationStartingNonce = destinationNonce; + + const finalDestinationTransfer = await addOnrampDestinationChainTransactions({ + amountRaw: finalAmountRaw, + destinationNetwork: toNetwork as EvmNetworks, + isNativeToken: isNativeEvmToken(outputTokenDetails), + toAddress: destinationAddress, + toToken: outputTokenDetails.erc20AddressSourceChain + }); + + unsignedTxs.push({ + meta: {}, + network: toNetwork, + nonce: destinationNonce, + phase: "destinationTransfer", + signer: evmEphemeralEntry.address, + txData: finalDestinationTransfer + }); + + // Fallback bridged token: USDC for Ethereum, axlUSDC for all other EVM chains. Mirrors avenia-to-evm-base. + const destinationAxlUsdcDetails = getOnChainTokenDetailsOrDefault(toNetwork as Networks, EvmToken.AXLUSDC) as EvmTokenDetails; + let bridgedTokenForFallback: `0x${string}`; + if (toNetwork === Networks.Ethereum) { + const ethereumUsdc = evmTokenConfig.ethereum.USDC; + if (!ethereumUsdc) { + throw new Error("USDC config missing for Ethereum"); + } + bridgedTokenForFallback = ethereumUsdc.erc20AddressSourceChain as `0x${string}`; + } else { + bridgedTokenForFallback = destinationAxlUsdcDetails.erc20AddressSourceChain as `0x${string}`; + } + + const inputAmountRawFinalBridge = bridgeInputAmountRaw as string; + + const { approveData: finalApproveData, swapData: finalSwapData } = + await createOnrampSquidrouterTransactionsOnDestinationChain({ + destinationAddress: evmEphemeralEntry.address, + fromAddress: evmEphemeralEntry.address, + fromToken: bridgedTokenForFallback, + network: toNetwork as EvmNetworks, + rawAmount: inputAmountRawFinalBridge, + toToken: outputTokenDetails.erc20AddressSourceChain + }); + + destinationNonce++; + + unsignedTxs.push({ + meta: {}, + network: toNetwork, + nonce: destinationNonce, + phase: "backupSquidRouterApprove", + signer: evmEphemeralEntry.address, + txData: encodeEvmTransactionData(finalApproveData) as EvmTransactionData + }); + destinationNonce++; + + unsignedTxs.push({ + meta: {}, + network: toNetwork, + nonce: destinationNonce, + phase: "backupSquidRouterSwap", + signer: evmEphemeralEntry.address, + txData: encodeEvmTransactionData(finalSwapData) as EvmTransactionData + }); + destinationNonce++; + + const fundingAccount = getEvmFundingAccount(Networks.Base); + + // Bound approval to bridged amount + 5% slippage cushion (matches avenia-to-evm-base). + const backupApproveAmountRaw = new Big(inputAmountRawFinalBridge).mul("1.05").toFixed(0, 0); + + const backupApproveTransaction = await addDestinationChainApprovalTransaction({ + amountRaw: backupApproveAmountRaw, + destinationNetwork: toNetwork as EvmNetworks, + spenderAddress: fundingAccount.address, + tokenAddress: bridgedTokenForFallback + }); + + // Nonce 0 on purpose: ensures the approval can land even if other destination-chain txs are missed. + // When source chain == destination chain, the ephemeral has already consumed nonces 0..N-1, so we + // reuse destinationTransfer's nonce (the first destination-chain nonce) for the same effect. + const backupApproveNonce = destinationStartingNonce; + unsignedTxs.push({ + meta: {}, + network: toNetwork, + nonce: backupApproveNonce, + phase: "backupApprove", + signer: evmEphemeralEntry.address, + txData: backupApproveTransaction + }); + + stateMeta = { + ...stateMeta, + squidRouterQuoteId, + squidRouterReceiverHash, + squidRouterReceiverId + }; + + return { stateMeta, unsignedTxs }; +} diff --git a/apps/api/src/api/services/transactions/spacewalk/redeem.ts b/apps/api/src/api/services/transactions/spacewalk/redeem.ts deleted file mode 100644 index edb8bac3a..000000000 --- a/apps/api/src/api/services/transactions/spacewalk/redeem.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { SubmittableExtrinsic } from "@polkadot/api/types"; -import { ISubmittableResult } from "@polkadot/types/types"; -import { ApiManager, StellarTokenDetails } from "@vortexfi/shared"; -import { createVaultService } from "../../stellar/vaultService"; - -interface SpacewalkRedeemParams { - outputAmountRaw: string; - stellarEphemeralAccountRaw: Buffer; - outputTokenDetails: StellarTokenDetails; - executeSpacewalkNonce: number; -} - -export async function prepareSpacewalkRedeemTransaction({ - outputAmountRaw, - stellarEphemeralAccountRaw, - outputTokenDetails -}: SpacewalkRedeemParams): Promise> { - const apiManager = ApiManager.getInstance(); - const networkName = "pendulum"; - const pendulumNode = await apiManager.getApi(networkName); - - try { - const vaultService = await createVaultService( - pendulumNode, - outputTokenDetails.stellarAsset.code.hex, - outputTokenDetails.stellarAsset.issuer.hex, - outputAmountRaw - ); - - const redeemExtrinsic = await vaultService.createRequestRedeemExtrinsic(outputAmountRaw, stellarEphemeralAccountRaw); - - return redeemExtrinsic; - } catch (_e) { - throw Error("Couldn't create redeem extrinsic"); - } -} diff --git a/apps/api/src/api/services/transactions/stellar/offrampTransaction.ts b/apps/api/src/api/services/transactions/stellar/offrampTransaction.ts deleted file mode 100644 index 9efd4eb35..000000000 --- a/apps/api/src/api/services/transactions/stellar/offrampTransaction.ts +++ /dev/null @@ -1,209 +0,0 @@ -import { - HORIZON_URL, - NUMBER_OF_PRESIGNED_TXS, - PaymentData, - STELLAR_EPHEMERAL_STARTING_BALANCE_UNITS, - StellarTokenDetails -} from "@vortexfi/shared"; -import Big from "big.js"; -import { Account, Asset, Horizon, Keypair, Memo, Networks, Operation, TransactionBuilder } from "stellar-sdk"; -import logger from "../../../../config/logger"; -import { config } from "../../../../config/vars"; -import { SEQUENCE_TIME_WINDOW_IN_SECONDS, SEQUENCE_TIME_WINDOWS, STELLAR_BASE_FEE } from "../../../../constants/constants"; - -// Define HorizonServer type -type HorizonServer = Horizon.Server; - -const FUNDING_PUBLIC_KEY = config.secrets.stellarFundingSecret - ? Keypair.fromSecret(config.secrets.stellarFundingSecret).publicKey() - : ""; -const NETWORK_PASSPHRASE = config.sandboxEnabled ? Networks.TESTNET : Networks.PUBLIC; - -const APPROXIMATE_STELLAR_LEDGER_CLOSE_TIME_SECONDS = 7; - -export const horizonServer = new Horizon.Server(HORIZON_URL); - -interface StellarBuildPaymentAndMergeTx { - ephemeralAccountId: string; - amountToAnchorUnits: string; - paymentData: PaymentData; - tokenConfigStellar: StellarTokenDetails; -} - -export async function buildPaymentAndMergeTx({ - ephemeralAccountId, - amountToAnchorUnits, - paymentData, - tokenConfigStellar -}: StellarBuildPaymentAndMergeTx): Promise<{ - expectedSequenceNumbers: string[]; - paymentTransactions: Array<{ sequence: string; tx: string }>; - mergeAccountTransactions: Array<{ sequence: string; tx: string }>; - createAccountTransactions: Array<{ sequence: string; tx: string }>; -}> { - const baseFee = STELLAR_BASE_FEE; - - if (!config.secrets.stellarFundingSecret) { - logger.error("Stellar funding secret not defined"); - throw new Error("Stellar funding secret not defined"); - } - - const fundingAccountKeypair = Keypair.fromSecret(config.secrets.stellarFundingSecret); - - const { memo, memoType, anchorTargetAccount } = paymentData; - const transactionMemo = - memoType === "text" ? Memo.text(memo) : memoType === "id" ? Memo.id(memo) : Memo.hash(Buffer.from(memo, "base64")); - - const fundingAccount = await horizonServer.loadAccount(fundingAccountKeypair.publicKey()); - - // Define timeframes for each presigned transaction - const timeWindows = [ - SEQUENCE_TIME_WINDOWS.FIRST_TX, - SEQUENCE_TIME_WINDOWS.SECOND_TX, - SEQUENCE_TIME_WINDOWS.THIRD_TX, - SEQUENCE_TIME_WINDOWS.FOURTH_TX, - SEQUENCE_TIME_WINDOWS.FIFTH_TX - ]; - - const sequenceNumbers: string[] = []; - for (let i = 0; i < NUMBER_OF_PRESIGNED_TXS; i++) { - const sequenceNumber = await getFutureShiftedLedgerSequence(horizonServer, 32, timeWindows[i]); - sequenceNumbers.push(sequenceNumber); - } - - const paymentTransactions: Array<{ sequence: string; tx: string }> = []; - const mergeAccountTransactions: Array<{ sequence: string; tx: string }> = []; - const createAccountTransactions: Array<{ sequence: string; tx: string }> = []; - - for (let i = 0; i < NUMBER_OF_PRESIGNED_TXS; i++) { - const currentFundingAccount = - i === 0 - ? fundingAccount - : new Account(fundingAccountKeypair.publicKey(), String(BigInt(fundingAccount.sequenceNumber()) + BigInt(i))); - - const currentCreateAccountTransaction = new TransactionBuilder(currentFundingAccount, { - fee: baseFee, - networkPassphrase: NETWORK_PASSPHRASE - }) - .addOperation( - Operation.createAccount({ - destination: ephemeralAccountId, - startingBalance: STELLAR_EPHEMERAL_STARTING_BALANCE_UNITS - }) - ) - .addOperation( - Operation.setOptions({ - highThreshold: 2, - lowThreshold: 2, - medThreshold: 2, - signer: { - ed25519PublicKey: fundingAccountKeypair.publicKey(), - weight: 1 - }, - source: ephemeralAccountId - }) - ) - .addOperation( - Operation.changeTrust({ - asset: new Asset(tokenConfigStellar.stellarAsset.code.string, tokenConfigStellar.stellarAsset.issuer.stellarEncoding), - source: ephemeralAccountId - }) - ) - .setTimebounds(0, 0) - .setMinAccountSequence(String(0)) - .build(); - - currentCreateAccountTransaction.sign(fundingAccountKeypair); - - createAccountTransactions.push({ - sequence: fundingAccount.sequenceNumber(), // TODO do we require this? - tx: currentCreateAccountTransaction.toEnvelope().toXDR().toString("base64") - }); - } - - for (let i = 0; i < NUMBER_OF_PRESIGNED_TXS; i++) { - const currentSequence = sequenceNumbers[i]; - const currentEphemeralAccount = new Account(ephemeralAccountId, currentSequence); - - const currentPaymentTransaction = new TransactionBuilder(currentEphemeralAccount, { - fee: STELLAR_BASE_FEE, - networkPassphrase: NETWORK_PASSPHRASE - }) - .addOperation( - Operation.payment({ - amount: amountToAnchorUnits, - asset: new Asset(tokenConfigStellar.stellarAsset.code.string, tokenConfigStellar.stellarAsset.issuer.stellarEncoding), - destination: anchorTargetAccount - }) - ) - .addMemo(transactionMemo) - .setTimebounds(0, 0) - .setMinAccountSequence(String(0)) - .build(); - - currentPaymentTransaction.sign(fundingAccountKeypair); - - const currentMergeAccountTransaction = new TransactionBuilder(currentEphemeralAccount, { - fee: STELLAR_BASE_FEE, - networkPassphrase: NETWORK_PASSPHRASE - }) - .addOperation( - Operation.changeTrust({ - asset: new Asset(tokenConfigStellar.stellarAsset.code.string, tokenConfigStellar.stellarAsset.issuer.stellarEncoding), - limit: "0" - }) - ) - .addOperation( - Operation.accountMerge({ - destination: FUNDING_PUBLIC_KEY - }) - ) - .setTimebounds(0, 0) - .setMinAccountSequence(String(1n)) - .build(); - - currentMergeAccountTransaction.sign(fundingAccountKeypair); - - paymentTransactions.push({ - sequence: currentSequence, - tx: currentPaymentTransaction.toEnvelope().toXDR().toString("base64") - }); - - mergeAccountTransactions.push({ - sequence: currentSequence, - tx: currentMergeAccountTransaction.toEnvelope().toXDR().toString("base64") - }); - } - - return { - createAccountTransactions, - expectedSequenceNumbers: sequenceNumbers, - mergeAccountTransactions, - paymentTransactions - }; -} - -async function getFutureShiftedLedgerSequence( - horizonServer: HorizonServer, - shiftAmount = 32, - timeWindowSeconds = SEQUENCE_TIME_WINDOW_IN_SECONDS -) { - try { - const latestLedger = await horizonServer.ledgers().order("desc").limit(1).call(); - - const currentLedgerSequence = latestLedger.records[0].sequence; - - const ledgersInTimeWindow = Math.ceil(timeWindowSeconds / APPROXIMATE_STELLAR_LEDGER_CLOSE_TIME_SECONDS); - - const futureLedgerSequence = currentLedgerSequence + ledgersInTimeWindow; - - const bigFutureLedger = new Big(futureLedgerSequence); - const bigShift = new Big(2).pow(shiftAmount); - const shiftedSequence = bigFutureLedger.times(bigShift).toFixed(); - - return shiftedSequence; - } catch (error) { - logger.error("Error fetching and calculating ledger sequence:", error); - throw error; - } -} diff --git a/apps/api/src/api/services/transactions/validation.test.ts b/apps/api/src/api/services/transactions/validation.test.ts index 1d2c6951c..b61a8d8ed 100644 --- a/apps/api/src/api/services/transactions/validation.test.ts +++ b/apps/api/src/api/services/transactions/validation.test.ts @@ -23,12 +23,6 @@ const MOCK_TX_DATA_SUBSTRATE_SIGNER_1 = "0x71038400ac1767af9bf4282c0f268b5ce1797 const MOCK_TX_DATA_SUBSTRATE_SIGNER_2 = "0x71038400b61dacc574163a9e8da2aca2b29090c610e61b21de9adbafb699156b6b6d9465019c7a2a23097caa54fcdd14432c731bd7c7c82a5648ee6d9a12378af3e241b435f2675ee515c50edfdf9098318c8a31abcc511d52a76133ad9e6b35cf5209bb8d000000003806005c1026460683b902672db0bbf65df0c021f5c9f844663e4dd1fcb13935ac6ba600072a494093029e820200001101095ea7b3e0a5f34199e165cbd3f9b0eba1f5e15d5018a7ffe8b76a3693ba5b317efb09d8e0ccb60000000000000000000000000000000000000000000000000000000000"; -// Stellar mock payloads — each phase has different operation-count requirements -const MOCK_TX_DATA_STELLAR_CREATE_ACCOUNT = "AAAAAgAAAADkOCw1GPsc4U0bNLBfqRtbB05ZcogqYJfDKZYB95sHRAAtxsADWqM3AAAArQAAAAIAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAABb98/OGp4OrOMF58ADgwMHgBEvumr4FGRDfL2ZggooKAAAAAABfXhAAAAAAQAAAABb98/OGp4OrOMF58ADgwMHgBEvumr4FGRDfL2ZggooKAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAIAAAABAAAAAgAAAAEAAAACAAAAAAAAAAEAAAAA5DgsNRj7HOFNGzSwX6kbWwdOWXKIKmCXwymWAfebB0QAAAABAAAAAQAAAABb98/OGp4OrOMF58ADgwMHgBEvumr4FGRDfL2ZggooKAAAAAYAAAABRVVSQwAAAADPT1om4gkLs63PAsep1z2/5mWcxpBGFHW4ZDf6SccRNn//////////AAAAAAAAAAL3mwdEAAAAQCsExvxklazpsIDVJtyQU8Ou969v8j1NeM/MDMATo0UlUifWtbb218kd+ql6i21PQbD7ibxm6M4Zp1zflDIRMwOCCigoAAAAQF1MLyxdcdQ9lMYiR8iHye4TIKoP9zOimi4AKCL87rgDeXbEazuVR0GS0ILjnsc3NLFySKtAWcUFX20XXp7v5Aw="; - -const MOCK_TX_DATA_STELLAR_PAYMENT = "AAAAAgAAAABb98/OGp4OrOMF58ADgwMHgBEvumr4FGRDfL2ZggooKAAPQkADjNQFAAAAAQAAAAIAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAA1NWUsxNzYxNDkyNzc2AAAAAAAAAQAAAAAAAAABAAAAAMwmH81TyAdqCkge7nLAJdasnz/JchoiBMyDM9Io97NEAAAAAUVVUkMAAAAAz09aJuIJC7OtzwLHqdc9v+ZlnMaQRhR1uGQ3+knHETYAAAAABh8T4AAAAAAAAAAC95sHRAAAAEB4aZkEhfZ98f+FbQSEj0wFNirD7fe2HiWLM9jIuvkoQ9ruzSxycCK+NMiIgppZnNSNnibw10BseXsG9kjK1u0KggooKAAAAED8tHWEfIKPzeuHVBnMy9x+ireQ6kepvWCLq/ZRyXWN8m+lcE0r60HwjD25xJovaY9hyVh9X50o/xm0dM6DlIsF"; - -const MOCK_TX_DATA_STELLAR_CLEANUP = "AAAAAgAAAABb98/OGp4OrOMF58ADgwMHgBEvumr4FGRDfL2ZggooKAAehIADjNQFAAAAAgAAAAIAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAABgAAAAFFVVJDAAAAAM9PWibiCQuzrc8Cx6nXPb/mZZzGkEYUdbhkN/pJxxE2AAAAAAAAAAAAAAAAAAAACAAAAADkOCw1GPsc4U0bNLBfqRtbB05ZcogqYJfDKZYB95sHRAAAAAAAAAAC95sHRAAAAEB8+udS9KiWj8JjxxPB3HSMC0EkRvggU2hOP9IoHF8+T7VzqZiPzzwuothCSKwaOgaVvG/SSPUIKJQkpVYhjqwJggooKAAAAECSKoTeRu3ttJ9G3Cj6a79Yv6ZQTguCIlGo2klJltKvQex7SQys69T93BeoG+XALB8I8MvSiQoEXE7unZYpmL0A="; async function makeSignedEvmTx(overrides: { nonce: number; @@ -142,13 +136,13 @@ function withBackups(tx: PresignedTx): PresignedTx { } const VALID_EXAMPLE_PRESIGNED_TX_EUR_ONRAMP: PresignedTx[] = await Promise.all([ - makeSignedEvmTxWithBackups({ nonce: 0, phase: "moneriumOnrampSelfTransfer", network: Networks.Polygon }), + makeSignedEvmTxWithBackups({ nonce: 0, phase: "nablaApprove", network: Networks.Polygon }), makeSignedEvmTxWithBackups({ nonce: 1, phase: "squidRouterApprove", network: Networks.Polygon }), makeSignedEvmTxWithBackups({ nonce: 2, phase: "squidRouterSwap", network: Networks.Polygon }), ]); const VALID_EXAMPLE_UNSIGNED_TX_EUR_ONRAMP: PresignedTx[] = [ - { meta: {}, network: Networks.Polygon, nonce: 0, phase: "moneriumOnrampSelfTransfer", signer: EVM_SIGNER, txData: { data: "0x12345678", gas: "21000", maxFeePerGas: "1000000000", maxPriorityFeePerGas: "1000000000", to: "0x000000000000000000000000000000000000dEaD", value: "0" } }, + { meta: {}, network: Networks.Polygon, nonce: 0, phase: "nablaApprove", signer: EVM_SIGNER, txData: { data: "0x12345678", gas: "21000", maxFeePerGas: "1000000000", maxPriorityFeePerGas: "1000000000", to: "0x000000000000000000000000000000000000dEaD", value: "0" } }, { meta: {}, network: Networks.Polygon, nonce: 1, phase: "squidRouterApprove", signer: EVM_SIGNER, txData: { data: "0x12345678", gas: "21000", maxFeePerGas: "1000000000", maxPriorityFeePerGas: "1000000000", to: "0x000000000000000000000000000000000000dEaD", value: "0" } }, { meta: {}, network: Networks.Polygon, nonce: 2, phase: "squidRouterSwap", signer: EVM_SIGNER, txData: { data: "0x12345678", gas: "21000", maxFeePerGas: "1000000000", maxPriorityFeePerGas: "1000000000", to: "0x000000000000000000000000000000000000dEaD", value: "0" } }, ]; @@ -212,74 +206,6 @@ const VALID_EXAMPLE_UNSIGNED_TX_BRL_ONRAMP: PresignedTx[] = [ { meta: {}, network: Networks.Moonbeam, nonce: 3, phase: "squidRouterSwap", signer: EVM_SIGNER_2, txData: { data: "0x12345678", gas: "21000", maxFeePerGas: "1000000000", maxPriorityFeePerGas: "1000000000", to: "0x000000000000000000000000000000000000dEaD", value: "0" } }, ]; -const VALID_EXAMPLE_PRESIGNED_TX_EUR_OFFRAMP: PresignedTx[] = [ - withBackups({ - meta: {}, - nonce: 0, - phase: "stellarCreateAccount", - signer: "GBN7PT6ODKPA5LHDAXT4AA4DAMDYAEJPXJVPQFDEIN6L3GMCBIUCQSAJ", - txData: MOCK_TX_DATA_STELLAR_CREATE_ACCOUNT, - network: Networks.Stellar - }), - withBackups({ - meta: {}, - nonce: 1, - phase: "stellarPayment", - signer: "GBN7PT6ODKPA5LHDAXT4AA4DAMDYAEJPXJVPQFDEIN6L3GMCBIUCQSAJ", - txData: MOCK_TX_DATA_STELLAR_PAYMENT, - network: Networks.Stellar - }), - withBackups({ - meta: {}, - nonce: 2, - phase: "stellarCleanup", - signer: "GBN7PT6ODKPA5LHDAXT4AA4DAMDYAEJPXJVPQFDEIN6L3GMCBIUCQSAJ", - txData: MOCK_TX_DATA_STELLAR_CLEANUP, - network: Networks.Stellar - }), - withBackups({ - meta: {}, - nonce: 0, - phase: "nablaApprove", - signer: "5GBVPRfgZYjDMqQSACxzfrPeKxnsKGyinwwGRFpcacaAzDov", - txData: MOCK_TX_DATA_SUBSTRATE_SIGNER_2, - network: Networks.Pendulum - }), - withBackups({ - meta: {}, - nonce: 1, - phase: "nablaSwap", - signer: "5GBVPRfgZYjDMqQSACxzfrPeKxnsKGyinwwGRFpcacaAzDov", - txData: MOCK_TX_DATA_SUBSTRATE_SIGNER_2, - network: Networks.Pendulum - }), - withBackups({ - meta: {}, - nonce: 2, - phase: "spacewalkRedeem", - signer: "5GBVPRfgZYjDMqQSACxzfrPeKxnsKGyinwwGRFpcacaAzDov", - txData: MOCK_TX_DATA_SUBSTRATE_SIGNER_2, - network: Networks.Pendulum, - }), - withBackups({ - meta: {}, - nonce: 3, - phase: "pendulumCleanup", - signer: "5GBVPRfgZYjDMqQSACxzfrPeKxnsKGyinwwGRFpcacaAzDov", - txData: MOCK_TX_DATA_SUBSTRATE_SIGNER_2, - network: Networks.Pendulum - }) -]; - -const VALID_EXAMPLE_UNSIGNED_TX_EUR_OFFRAMP: PresignedTx[] = [ - { meta: {}, network: Networks.Stellar, nonce: 0, phase: "stellarCreateAccount", signer: "GBN7PT6ODKPA5LHDAXT4AA4DAMDYAEJPXJVPQFDEIN6L3GMCBIUCQSAJ", txData: MOCK_TX_DATA_STELLAR_CREATE_ACCOUNT }, - { meta: {}, network: Networks.Stellar, nonce: 1, phase: "stellarPayment", signer: "GBN7PT6ODKPA5LHDAXT4AA4DAMDYAEJPXJVPQFDEIN6L3GMCBIUCQSAJ", txData: MOCK_TX_DATA_STELLAR_PAYMENT }, - { meta: {}, network: Networks.Stellar, nonce: 2, phase: "stellarCleanup", signer: "GBN7PT6ODKPA5LHDAXT4AA4DAMDYAEJPXJVPQFDEIN6L3GMCBIUCQSAJ", txData: MOCK_TX_DATA_STELLAR_CLEANUP }, - { meta: {}, network: Networks.Pendulum, nonce: 0, phase: "nablaApprove", signer: "5GBVPRfgZYjDMqQSACxzfrPeKxnsKGyinwwGRFpcacaAzDov", txData: MOCK_TX_DATA_SUBSTRATE_SIGNER_2 }, - { meta: {}, network: Networks.Pendulum, nonce: 1, phase: "nablaSwap", signer: "5GBVPRfgZYjDMqQSACxzfrPeKxnsKGyinwwGRFpcacaAzDov", txData: MOCK_TX_DATA_SUBSTRATE_SIGNER_2 }, - { meta: {}, network: Networks.Pendulum, nonce: 2, phase: "spacewalkRedeem", signer: "5GBVPRfgZYjDMqQSACxzfrPeKxnsKGyinwwGRFpcacaAzDov", txData: MOCK_TX_DATA_SUBSTRATE_SIGNER_2 }, - { meta: {}, network: Networks.Pendulum, nonce: 3, phase: "pendulumCleanup", signer: "5GBVPRfgZYjDMqQSACxzfrPeKxnsKGyinwwGRFpcacaAzDov", txData: MOCK_TX_DATA_SUBSTRATE_SIGNER_2 }, -]; describe("Presigned Transaction validation", () => { it("matches a signed EVM transaction to the unsigned server-built transaction", async () => { @@ -410,7 +336,6 @@ describe("Presigned Transaction validation", () => { await expect( validatePresignedTxs(RampDirection.SELL, [presignedTx], { EVM: "0x0000000000000000000000000000000000000004", - Stellar: "", Substrate: "" }, [unsignedTx]) ).resolves.toBeUndefined(); @@ -451,7 +376,6 @@ describe("Presigned Transaction validation", () => { ], { EVM: expectedEvmSigner, - Stellar: "", Substrate: "5FxM3dFCnXJXEbMozuVbhEUQuQK1gmquFpUJ577HebqBc7pz" }, [unsignedTx] @@ -461,11 +385,7 @@ describe("Presigned Transaction validation", () => { }); it("should pass validation for valid presigned EVM transactions", async () => { - const ephemerals: { [key in EphemeralAccountType]: string } = { - Substrate: "", - EVM: EVM_SIGNER, - Stellar: "" - }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; await expect(validatePresignedTxs(RampDirection.BUY, VALID_EXAMPLE_PRESIGNED_TX_EUR_ONRAMP, ephemerals, VALID_EXAMPLE_UNSIGNED_TX_EUR_ONRAMP)).resolves.toBeUndefined(); }); @@ -474,34 +394,16 @@ describe("Presigned Transaction validation", () => { const singleTx: PresignedTx[] = [VALID_EXAMPLE_PRESIGNED_TX_EUR_ONRAMP[0]]; const singleUnsigned: PresignedTx[] = [VALID_EXAMPLE_UNSIGNED_TX_EUR_ONRAMP[0]]; - const ephemerals: { [key in EphemeralAccountType]: string } = { - Substrate: "", - EVM: EVM_SIGNER, - Stellar: "" - }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; await expect(validatePresignedTxs(RampDirection.BUY, singleTx, ephemerals, singleUnsigned)).resolves.toBeUndefined(); }); - it("should pass validation for valid presigned mixed transactions", async () => { - const ephemerals: { [key in EphemeralAccountType]: string } = { - Substrate: "5GBVPRfgZYjDMqQSACxzfrPeKxnsKGyinwwGRFpcacaAzDov", - EVM: EVM_SIGNER_2, - Stellar: "GBN7PT6ODKPA5LHDAXT4AA4DAMDYAEJPXJVPQFDEIN6L3GMCBIUCQSAJ" - }; - - await expect(validatePresignedTxs(RampDirection.SELL, VALID_EXAMPLE_PRESIGNED_TX_EUR_OFFRAMP, ephemerals, VALID_EXAMPLE_UNSIGNED_TX_EUR_OFFRAMP)).resolves.toBeUndefined(); - }, 30000); - it("should throw for transaction with mismatch of expected signer for Substrate tx", async () => { const invalidTxs: PresignedTx[] = JSON.parse(JSON.stringify(VALID_EXAMPLE_PRESIGNED_TX_BRL_ONRAMP)); const invalidSigner = "5CoKLhtjijsxVneDXeV3QhcdD4byxDK7cSmNCuWEfQ8NjebM"; invalidTxs[0].signer = invalidSigner; - const ephemerals: { [key in EphemeralAccountType]: string } = { - Substrate: "5FxM3dFCnXJXEbMozuVbhEUQuQK1gmquFpUJ577HebqBc7pz", - EVM: EVM_SIGNER_2, - Stellar: "GBN7PT6ODKPA5LHDAXT4AA4DAMDYAEJPXJVPQFDEIN6L3GMCBIUCQSAJ" - }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "5FxM3dFCnXJXEbMozuVbhEUQuQK1gmquFpUJ577HebqBc7pz", EVM: EVM_SIGNER_2 }; await expect(validatePresignedTxs(RampDirection.BUY, invalidTxs, ephemerals, VALID_EXAMPLE_UNSIGNED_TX_BRL_ONRAMP)).rejects.toThrow( `Substrate transaction signer ${invalidSigner} does not match the expected signer 5FxM3dFCnXJXEbMozuVbhEUQuQK1gmquFpUJ577HebqBc7pz for phase nablaApprove` ); @@ -524,48 +426,22 @@ describe("Presigned Transaction validation", () => { txData: { data: "0x12345678", gas: "21000", maxFeePerGas: "1000000000", maxPriorityFeePerGas: "1000000000", to: "0x000000000000000000000000000000000000dEaD", value: "0" } }; - const ephemerals: { [key in EphemeralAccountType]: string } = { - Substrate: "", - EVM: EVM_SIGNER, - Stellar: "" - }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; await expect(validatePresignedTxs(RampDirection.BUY, [presignedTx], ephemerals, [unsignedTx])).rejects.toThrow( `EVM transaction signer ${wrongSigner} does not match the expected signer ${EVM_SIGNER}` ); }); - it("should throw for transaction with mismatch of expected signer for Stellar tx", async () => { - const invalidTxs: PresignedTx[] = JSON.parse(JSON.stringify(VALID_EXAMPLE_PRESIGNED_TX_EUR_OFFRAMP)); - const invalidSigner = "GCFX5YV7Y5LF2XK3S5Y4L5XW4D5Z6A7B8C9D0E1F2G3H4I5J6K7L8M9N0O1P2Q3R4S5T6U7V8W9X0Y1Z2"; - invalidTxs[0].signer = invalidSigner; - const ephemerals: { [key in EphemeralAccountType]: string } = { - Substrate: "5FxM3dFCnXJXEbMozuVbhEUQuQK1gmquFpUJ577HebqBc7pz", - EVM: EVM_SIGNER_2, - Stellar: "GBN7PT6ODKPA5LHDAXT4AA4DAMDYAEJPXJVPQFDEIN6L3GMCBIUCQSAJ" - }; - await expect(validatePresignedTxs(RampDirection.SELL, invalidTxs, ephemerals, VALID_EXAMPLE_UNSIGNED_TX_EUR_OFFRAMP)).rejects.toThrow( - `Stellar transaction signer ${invalidSigner} does not match the expected signer GBN7PT6ODKPA5LHDAXT4AA4DAMDYAEJPXJVPQFDEIN6L3GMCBIUCQSAJ for phase stellarCreateAccount.` - ); - }); - it("should throw error for invalid presigned transactions array", async () => { const invalidTxs: any = "invalid data"; - const ephemerals: { [key in EphemeralAccountType]: string } = { - Substrate: "5FxM3dFCnXJXEbMozuVbhEUQuQK1gmquFpUJ577HebqBc7pz", - EVM: EVM_SIGNER_2, - Stellar: "GBN7PT6ODKPA5LHDAXT4AA4DAMDYAEJPXJVPQFDEIN6L3GMCBIUCQSAJ" - }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "5FxM3dFCnXJXEbMozuVbhEUQuQK1gmquFpUJ577HebqBc7pz", EVM: EVM_SIGNER_2 }; await expect(validatePresignedTxs(RampDirection.BUY, invalidTxs, ephemerals, [])).rejects.toThrow("presignedTxs must be an array with 1-100 elements"); }); it("should throw error for too many transactions", async () => { const invalidTxs: PresignedTx[] = new Array(101).fill(VALID_EXAMPLE_PRESIGNED_TX_EUR_ONRAMP[0]); - const ephemerals: { [key in EphemeralAccountType]: string } = { - Substrate: "5FxM3dFCnXJXEbMozuVbhEUQuQK1gmquFpUJ577HebqBc7pz", - EVM: EVM_SIGNER_2, - Stellar: "GBN7PT6ODKPA5LHDAXT4AA4DAMDYAEJPXJVPQFDEIN6L3GMCBIUCQSAJ" - }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "5FxM3dFCnXJXEbMozuVbhEUQuQK1gmquFpUJ577HebqBc7pz", EVM: EVM_SIGNER_2 }; await expect(validatePresignedTxs(RampDirection.BUY, invalidTxs, ephemerals, [])).rejects.toThrow("presignedTxs must be an array with 1-100 elements"); }); @@ -573,11 +449,7 @@ describe("Presigned Transaction validation", () => { const invalidTxs: PresignedTx[] = JSON.parse(JSON.stringify(VALID_EXAMPLE_PRESIGNED_TX_EUR_ONRAMP)); invalidTxs[2].meta = {}; - const ephemerals: { [key in EphemeralAccountType]: string } = { - Substrate: "", - EVM: EVM_SIGNER, - Stellar: "" - }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; await expect(validatePresignedTxs(RampDirection.BUY, invalidTxs, ephemerals, VALID_EXAMPLE_UNSIGNED_TX_EUR_ONRAMP)).rejects.toThrow( "Transaction for phase squidRouterSwap must include at least 4 backup transactions in meta.additionalTxs" @@ -592,11 +464,7 @@ describe("Presigned Transaction validation", () => { } backupTx.nonce = 9; - const ephemerals: { [key in EphemeralAccountType]: string } = { - Substrate: "", - EVM: EVM_SIGNER, - Stellar: "" - }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; await expect(validatePresignedTxs(RampDirection.BUY, invalidTxs, ephemerals, VALID_EXAMPLE_UNSIGNED_TX_EUR_ONRAMP)).rejects.toThrow( "Transaction for phase squidRouterSwap has invalid backup nonce sequence. Expected 4, got 5" @@ -618,11 +486,7 @@ describe("Presigned Transaction validation", () => { txData: { data: "0x12345678", gas: "21000", maxFeePerGas: "1000000000", maxPriorityFeePerGas: "1000000000", to: "0x000000000000000000000000000000000000dEaD", value: "0" } }; - const ephemerals: { [key in EphemeralAccountType]: string } = { - Substrate: "", - EVM: EVM_SIGNER, - Stellar: "" - }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; await expect(validatePresignedTxs(RampDirection.BUY, [presignedTx], ephemerals, [unsignedTx])).resolves.toBeUndefined(); }); @@ -644,11 +508,7 @@ describe("Presigned Transaction validation", () => { txData: { data: "0x12345678", gas: "21000", maxFeePerGas: "1000000000", maxPriorityFeePerGas: "1000000000", to: "0x000000000000000000000000000000000000dEaD", value: "0" } }; - const ephemerals: { [key in EphemeralAccountType]: string } = { - Substrate: "", - EVM: wrongSigner, - Stellar: "" - }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: wrongSigner }; await expect(validatePresignedTxs(RampDirection.BUY, [presignedTx], ephemerals, [unsignedTx])).rejects.toThrow( "Recovered signer" @@ -671,11 +531,7 @@ describe("Presigned Transaction validation", () => { txData: { data: "0x12345678", gas: "21000", maxFeePerGas: "1000000000", maxPriorityFeePerGas: "1000000000", to: "0x000000000000000000000000000000000000dEaD", value: "0" } }; - const ephemerals: { [key in EphemeralAccountType]: string } = { - Substrate: "", - EVM: EVM_SIGNER, - Stellar: "" - }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; await expect(validatePresignedTxs(RampDirection.BUY, [presignedTxWithWrongNonce], ephemerals, [unsignedTx])).rejects.toThrow( "does not match expected nonce" @@ -697,11 +553,7 @@ describe("Presigned Transaction validation", () => { txData: { data: "0x12345678", gas: "21000", maxFeePerGas: "1000000000", maxPriorityFeePerGas: "1000000000", to: "0x000000000000000000000000000000000000dEaD", value: "0" } }; - const ephemerals: { [key in EphemeralAccountType]: string } = { - Substrate: "", - EVM: EVM_SIGNER, - Stellar: "" - }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; await expect(validatePresignedTxs(RampDirection.BUY, [presignedTxWithWrongNonce], ephemerals, [unsignedTx])).rejects.toThrow( "does not match expected nonce" @@ -725,11 +577,7 @@ describe("Presigned Transaction validation", () => { txData: { data: "0x12345678", gas: "21000", maxFeePerGas: "1000000000", maxPriorityFeePerGas: "1000000000", to: "0x000000000000000000000000000000000000dEaD", value: "0" } }; - const ephemerals: { [key in EphemeralAccountType]: string } = { - Substrate: "", - EVM: EVM_SIGNER, - Stellar: "" - }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; await expect(validatePresignedTxs(RampDirection.BUY, [presignedTx], ephemerals, [unsignedTx])).rejects.toThrow( "does not match expected network ID" @@ -771,11 +619,7 @@ describe("Presigned Transaction validation", () => { txData: signedRawTx }; - const ephemerals: { [key in EphemeralAccountType]: string } = { - Substrate: "", - EVM: EVM_SIGNER, - Stellar: "" - }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; await expect(validatePresignedTxs(RampDirection.BUY, [presignedTx], ephemerals, [unsignedTx])).rejects.toThrow( "Signed EVM transaction value" @@ -817,11 +661,7 @@ describe("Presigned Transaction validation", () => { txData: signedRawTx }; - const ephemerals: { [key in EphemeralAccountType]: string } = { - Substrate: "", - EVM: EVM_SIGNER, - Stellar: "" - }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; await expect(validatePresignedTxs(RampDirection.BUY, [presignedTx], ephemerals, [unsignedTx])).rejects.toThrow( "Signed EVM transaction data" @@ -859,7 +699,7 @@ describe("Presigned Transaction validation", () => { const presignedTx: PresignedTx = { ...unsignedTx, txData: signedRawTx }; await expect( - validatePresignedTxs(RampDirection.BUY, [presignedTx], { Substrate: "", EVM: EVM_SIGNER, Stellar: "" }, [unsignedTx]) + validatePresignedTxs(RampDirection.BUY, [presignedTx], { Substrate: "", EVM: EVM_SIGNER }, [unsignedTx]) ).rejects.toThrow("Signed EVM transaction 'to'"); }); @@ -893,7 +733,7 @@ describe("Presigned Transaction validation", () => { const presignedTx: PresignedTx = { ...unsignedTx, txData: signedRawTx }; await expect( - validatePresignedTxs(RampDirection.BUY, [presignedTx], { Substrate: "", EVM: EVM_SIGNER, Stellar: "" }, [unsignedTx]) + validatePresignedTxs(RampDirection.BUY, [presignedTx], { Substrate: "", EVM: EVM_SIGNER }, [unsignedTx]) ).rejects.toThrow("contract creation not allowed"); }); @@ -922,7 +762,7 @@ describe("Presigned Transaction validation", () => { }); await expect( - validatePresignedTxs(RampDirection.BUY, [presignedTx], { Substrate: "", EVM: EVM_SIGNER, Stellar: "" }, [unsignedTx]) + validatePresignedTxs(RampDirection.BUY, [presignedTx], { Substrate: "", EVM: EVM_SIGNER }, [unsignedTx]) ).rejects.toThrow("gas limit"); }); @@ -952,7 +792,7 @@ describe("Presigned Transaction validation", () => { }); await expect( - validatePresignedTxs(RampDirection.BUY, [presignedTx], { Substrate: "", EVM: EVM_SIGNER, Stellar: "" }, [unsignedTx]) + validatePresignedTxs(RampDirection.BUY, [presignedTx], { Substrate: "", EVM: EVM_SIGNER }, [unsignedTx]) ).rejects.toThrow("maxFeePerGas"); }); @@ -982,7 +822,7 @@ describe("Presigned Transaction validation", () => { }); await expect( - validatePresignedTxs(RampDirection.BUY, [presignedTx], { Substrate: "", EVM: EVM_SIGNER, Stellar: "" }, [unsignedTx]) + validatePresignedTxs(RampDirection.BUY, [presignedTx], { Substrate: "", EVM: EVM_SIGNER }, [unsignedTx]) ).rejects.toThrow("maxPriorityFeePerGas"); }); @@ -1011,7 +851,7 @@ describe("Presigned Transaction validation", () => { }); await expect( - validatePresignedTxs(RampDirection.BUY, [presignedTx], { Substrate: "", EVM: EVM_SIGNER, Stellar: "" }, [unsignedTx]) + validatePresignedTxs(RampDirection.BUY, [presignedTx], { Substrate: "", EVM: EVM_SIGNER }, [unsignedTx]) ).resolves.toBeUndefined(); }); @@ -1042,28 +882,19 @@ describe("Presigned Transaction validation", () => { }); await expect( - validatePresignedTxs(RampDirection.BUY, [presignedTx], { Substrate: "", EVM: EVM_SIGNER, Stellar: "" }, [unsignedTx]) + validatePresignedTxs(RampDirection.BUY, [presignedTx], { Substrate: "", EVM: EVM_SIGNER }, [unsignedTx]) ).resolves.toBeUndefined(); }); it("should throw error when transaction is missing required properties", async () => { const invalidTx: any = { network: Networks.Polygon, nonce: 0, signer: EVM_SIGNER, txData: "0x" }; // missing phase - const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER, Stellar: "" }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; await expect(validatePresignedTxs(RampDirection.BUY, [invalidTx], ephemerals, [])).rejects.toThrow("Each transaction must have txData, phase, network, nonce and signer properties"); }); - it("rejects presignedTx submitted for moneriumOnrampMint (user-wallet phase)", async () => { - const tx: PresignedTx = { meta: {}, network: Networks.Polygon, nonce: 0, phase: "moneriumOnrampMint", signer: EVM_SIGNER, txData: "invalid data" }; - const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER_2, Stellar: "" }; - const unsignedTx = { ...tx }; - await expect(validatePresignedTxs(RampDirection.BUY, [tx], ephemerals, [unsignedTx])).rejects.toThrow( - "Phase moneriumOnrampMint is broadcast by the user wallet" - ); - }); - it("rejects presignedTx submitted for squidRouterNoPermitTransfer (user-wallet phase)", async () => { const tx: PresignedTx = { meta: {}, network: Networks.Polygon, nonce: 0, phase: "squidRouterNoPermitTransfer", signer: EVM_SIGNER, txData: "invalid data" }; - const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER_2, Stellar: "" }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER_2 }; const unsignedTx = { ...tx }; await expect(validatePresignedTxs(RampDirection.BUY, [tx], ephemerals, [unsignedTx])).rejects.toThrow( "Phase squidRouterNoPermitTransfer is broadcast by the user wallet" @@ -1071,7 +902,7 @@ describe("Presigned Transaction validation", () => { }); it("rejects presignedTx for squidRouterNoPermitApprove and squidRouterNoPermitSwap (user-wallet phases)", async () => { - const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER_2, Stellar: "" }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER_2 }; const approveTx: PresignedTx = { meta: {}, network: Networks.Polygon, nonce: 0, phase: "squidRouterNoPermitApprove", signer: EVM_SIGNER, txData: "data" }; await expect(validatePresignedTxs(RampDirection.BUY, [approveTx], ephemerals, [approveTx])).rejects.toThrow( "Phase squidRouterNoPermitApprove is broadcast by the user wallet" @@ -1084,7 +915,7 @@ describe("Presigned Transaction validation", () => { it("rejects presignedTx submitted for squidRouterSwap when direction is SELL (user-wallet phase)", async () => { const tx: PresignedTx = { meta: {}, network: Networks.Polygon, nonce: 0, phase: "squidRouterSwap", signer: EVM_SIGNER, txData: "invalid data" }; - const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER_2, Stellar: "" }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER_2 }; const unsignedTx = { ...tx }; await expect(validatePresignedTxs(RampDirection.SELL, [tx], ephemerals, [unsignedTx])).rejects.toThrow( "Phase squidRouterSwap is broadcast by the user wallet" @@ -1093,7 +924,7 @@ describe("Presigned Transaction validation", () => { it("rejects presignedTx submitted for squidRouterApprove when direction is SELL (user-wallet phase)", async () => { const tx: PresignedTx = { meta: {}, network: Networks.Polygon, nonce: 0, phase: "squidRouterApprove", signer: EVM_SIGNER, txData: "invalid data" }; - const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER_2, Stellar: "" }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER_2 }; const unsignedTx = { ...tx }; await expect(validatePresignedTxs(RampDirection.SELL, [tx], ephemerals, [unsignedTx])).rejects.toThrow( "Phase squidRouterApprove is broadcast by the user wallet" @@ -1102,13 +933,13 @@ describe("Presigned Transaction validation", () => { it("still validates squidRouterSwap on BUY direction (signed by EVM ephemeral, not user wallet)", async () => { const tx = await makeSignedEvmTxWithBackups({ nonce: 0, phase: "squidRouterSwap", network: Networks.Polygon }); - const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER, Stellar: "" }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; const unsignedTx: PresignedTx = { meta: {}, network: Networks.Polygon, nonce: 0, phase: "squidRouterSwap", signer: EVM_SIGNER, txData: { data: "0x12345678", gas: "21000", maxFeePerGas: "1000000000", maxPriorityFeePerGas: "1000000000", to: "0x000000000000000000000000000000000000dEaD", value: "0" } }; await expect(validatePresignedTxs(RampDirection.BUY, [tx], ephemerals, [unsignedTx])).resolves.toBeUndefined(); }); it("should throw when an ephemeral transaction is missing from presignedTxs", async () => { - const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER, Stellar: "" }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; const unsignedTx: PresignedTx = { meta: {}, network: Networks.Polygon, nonce: 0, phase: "fundEphemeral", signer: EVM_SIGNER, txData: { data: "0x12345678", gas: "21000", maxFeePerGas: "1000000000", maxPriorityFeePerGas: "1000000000", to: "0x000000000000000000000000000000000000dEaD", value: "0" } }; const ephemeralTx: PresignedTx = await makeSignedEvmTxWithBackups({ nonce: 0, phase: "fundEphemeral", network: Networks.Polygon }); const unsignedExtra: PresignedTx = { meta: {}, network: Networks.Polygon, nonce: 1, phase: "nablaApprove", signer: EVM_SIGNER, txData: { data: "0x12345678", gas: "21000", maxFeePerGas: "1000000000", maxPriorityFeePerGas: "1000000000", to: "0x000000000000000000000000000000000000dEaD", value: "0" } }; @@ -1116,14 +947,14 @@ describe("Presigned Transaction validation", () => { }); it("should throw when there is an extra presigned transaction not in unsignedTxs", async () => { - const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER, Stellar: "" }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; const tx: PresignedTx = await makeSignedEvmTxWithBackups({ nonce: 0, phase: "fundEphemeral", network: Networks.Polygon }); await expect(validatePresignedTxs(RampDirection.BUY, [tx], ephemerals, [])).rejects.toThrow("Some presigned transactions do not match any unsigned transaction"); }); it("should throw for an unknown phase", async () => { const tx: PresignedTx = { meta: {}, network: Networks.Polygon, nonce: 0, phase: "unknownPhase" as any, signer: EVM_SIGNER, txData: "0x" }; - const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER, Stellar: "" }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; await expect(validatePresignedTxs(RampDirection.BUY, [tx], ephemerals, [tx])).rejects.toThrow('Unknown phase "unknownPhase" — cannot determine transaction type'); }); @@ -1136,7 +967,7 @@ describe("Presigned Transaction validation", () => { signature: [] as any // Array signature }; const presignedTx: PresignedTx = { meta: {}, network: Networks.Polygon, nonce: 0, phase: "squidRouterPermitExecute", signer: EVM_WALLET.address, txData: [typedData] }; - const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER_2, Stellar: "" }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER_2 }; await expect(validatePresignedTxs(RampDirection.SELL, [presignedTx], ephemerals, [presignedTx])).rejects.toThrow("must include exactly one signature"); }); @@ -1181,11 +1012,7 @@ describe("Presigned Transaction validation", () => { presignedTx.meta!.additionalTxs!.backup2.txData = maliciousBackup; - const ephemerals: { [key in EphemeralAccountType]: string } = { - Substrate: "", - EVM: EVM_SIGNER, - Stellar: "" - }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; await expect(validatePresignedTxs(RampDirection.BUY, [presignedTx], ephemerals, [unsignedTx])).rejects.toThrow( "Signed EVM transaction data does not match expected data" @@ -1223,55 +1050,15 @@ describe("Presigned Transaction validation", () => { data: "0x99999999" }); - const ephemerals: { [key in EphemeralAccountType]: string } = { - Substrate: "", - EVM: EVM_SIGNER, - Stellar: "" - }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; await expect(validatePresignedTxs(RampDirection.BUY, [presignedTx], ephemerals, [unsignedTx])).rejects.toThrow( "must include exactly 4 backup transactions" ); }); - it("rejects when a Substrate backup encodes a different call than the primary", async () => { - const invalidTxs: PresignedTx[] = JSON.parse(JSON.stringify(VALID_EXAMPLE_PRESIGNED_TX_EUR_OFFRAMP)); - const substrateTx = invalidTxs.find(tx => tx.phase === "nablaApprove" && tx.network === Networks.Pendulum)!; - substrateTx.meta!.additionalTxs!.backup2.txData = MOCK_TX_DATA_SUBSTRATE_SIGNER_1; - - const ephemerals: { [key in EphemeralAccountType]: string } = { - Substrate: "5GBVPRfgZYjDMqQSACxzfrPeKxnsKGyinwwGRFpcacaAzDov", - EVM: EVM_SIGNER_2, - Stellar: "GBN7PT6ODKPA5LHDAXT4AA4DAMDYAEJPXJVPQFDEIN6L3GMCBIUCQSAJ" - }; - - await expect(validatePresignedTxs(RampDirection.SELL, invalidTxs, ephemerals, VALID_EXAMPLE_UNSIGNED_TX_EUR_OFFRAMP)).rejects.toThrow( - /does not (match|encode)/ - ); - }, 30000); - - it("rejects when a Stellar backup has the wrong shape for its phase", async () => { - const invalidTxs: PresignedTx[] = JSON.parse(JSON.stringify(VALID_EXAMPLE_PRESIGNED_TX_EUR_OFFRAMP)); - const stellarPayment = invalidTxs.find(tx => tx.phase === "stellarPayment")!; - stellarPayment.meta!.additionalTxs!.backup2.txData = MOCK_TX_DATA_STELLAR_CREATE_ACCOUNT; - - const ephemerals: { [key in EphemeralAccountType]: string } = { - Substrate: "5GBVPRfgZYjDMqQSACxzfrPeKxnsKGyinwwGRFpcacaAzDov", - EVM: EVM_SIGNER_2, - Stellar: "GBN7PT6ODKPA5LHDAXT4AA4DAMDYAEJPXJVPQFDEIN6L3GMCBIUCQSAJ" - }; - - await expect(validatePresignedTxs(RampDirection.SELL, invalidTxs, ephemerals, VALID_EXAMPLE_UNSIGNED_TX_EUR_OFFRAMP)).rejects.toThrow( - /Stellar Payment transaction must have exactly 1 operation/ - ); - }, 30000); - it("accepts a subset of presigned txs when requireComplete is false (updateRamp partial submission)", async () => { - const ephemerals: { [key in EphemeralAccountType]: string } = { - Substrate: "", - EVM: EVM_SIGNER, - Stellar: "" - }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; const subset = VALID_EXAMPLE_PRESIGNED_TX_EUR_ONRAMP.slice(0, 1); await expect( validatePresignedTxs(RampDirection.BUY, subset, ephemerals, VALID_EXAMPLE_UNSIGNED_TX_EUR_ONRAMP, { requireComplete: false }) @@ -1279,11 +1066,7 @@ describe("Presigned Transaction validation", () => { }); it("still rejects subset submissions by default (requireComplete defaults to true)", async () => { - const ephemerals: { [key in EphemeralAccountType]: string } = { - Substrate: "", - EVM: EVM_SIGNER, - Stellar: "" - }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; const subset = VALID_EXAMPLE_PRESIGNED_TX_EUR_ONRAMP.slice(0, 1); await expect( validatePresignedTxs(RampDirection.BUY, subset, ephemerals, VALID_EXAMPLE_UNSIGNED_TX_EUR_ONRAMP) @@ -1291,11 +1074,7 @@ describe("Presigned Transaction validation", () => { }); it("still rejects extra/unknown txs when requireComplete is false", async () => { - const ephemerals: { [key in EphemeralAccountType]: string } = { - Substrate: "", - EVM: EVM_SIGNER, - Stellar: "" - }; + const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; const extra = await makeSignedEvmTxWithBackups({ nonce: 99, phase: "fundEphemeral", network: Networks.Polygon }); await expect( validatePresignedTxs(RampDirection.BUY, [extra], ephemerals, VALID_EXAMPLE_UNSIGNED_TX_EUR_ONRAMP, { requireComplete: false }) @@ -1322,7 +1101,7 @@ describe("Presigned Transaction validation", () => { }; await expect( - validatePresignedTxs(RampDirection.SELL, [presignedTx], { EVM: "0x0000000000000000000000000000000000000004", Stellar: "", Substrate: "" }, [unsignedTx]) + validatePresignedTxs(RampDirection.SELL, [presignedTx], { EVM: "0x0000000000000000000000000000000000000004", Substrate: "" }, [unsignedTx]) ).rejects.toThrow("does not match the server-issued unsigned typed data"); }); @@ -1346,7 +1125,7 @@ describe("Presigned Transaction validation", () => { }; await expect( - validatePresignedTxs(RampDirection.SELL, [presignedTx], { EVM: "0x0000000000000000000000000000000000000004", Stellar: "", Substrate: "" }, [unsignedTx]) + validatePresignedTxs(RampDirection.SELL, [presignedTx], { EVM: "0x0000000000000000000000000000000000000004", Substrate: "" }, [unsignedTx]) ).rejects.toThrow("does not match the server-issued unsigned typed data"); }); @@ -1372,7 +1151,7 @@ describe("Presigned Transaction validation", () => { }; await expect( - validatePresignedTxs(RampDirection.SELL, [presignedTx], { EVM: "0x0000000000000000000000000000000000000004", Stellar: "", Substrate: "" }, [unsignedTx]) + validatePresignedTxs(RampDirection.SELL, [presignedTx], { EVM: "0x0000000000000000000000000000000000000004", Substrate: "" }, [unsignedTx]) ).rejects.toThrow("does not match the server-issued unsigned typed data"); }); @@ -1395,7 +1174,7 @@ describe("Presigned Transaction validation", () => { }; await expect( - validatePresignedTxs(RampDirection.BUY, [presignedTx], { Substrate: "", EVM: EVM_SIGNER, Stellar: "" }, [unsignedTx]) + validatePresignedTxs(RampDirection.BUY, [presignedTx], { Substrate: "", EVM: EVM_SIGNER }, [unsignedTx]) ).rejects.toThrow("does not match expected network ID"); }); @@ -1406,7 +1185,7 @@ describe("Presigned Transaction validation", () => { }; const presignedAtWrongNonce = await makeSignedEvmTxWithBackups({ nonce: 7, phase: "fundEphemeral", network: Networks.Polygon }); await expect( - validatePresignedTxs(RampDirection.BUY, [presignedAtWrongNonce], { Substrate: "", EVM: EVM_SIGNER, Stellar: "" }, [fundEphemeralAt0]) + validatePresignedTxs(RampDirection.BUY, [presignedAtWrongNonce], { Substrate: "", EVM: EVM_SIGNER }, [fundEphemeralAt0]) ).rejects.toThrow("Some presigned transactions do not match any unsigned transaction"); }); }); diff --git a/apps/api/src/api/services/transactions/validation.ts b/apps/api/src/api/services/transactions/validation.ts index d432d97c8..338d00468 100644 --- a/apps/api/src/api/services/transactions/validation.ts +++ b/apps/api/src/api/services/transactions/validation.ts @@ -18,10 +18,9 @@ import { SubstrateApiNetwork, substrateAddressEqual } from "@vortexfi/shared"; -import { Signature as EvmSignature, verifyTypedData } from "ethers"; +import { Transaction as EthersTransaction, Signature as EvmSignature, verifyTypedData } from "ethers"; import httpStatus from "http-status"; -import { Networks as StellarNetworks, Transaction as StellarTransaction, TransactionBuilder } from "stellar-sdk"; -import { type Hex, keccak256, parseTransaction, recoverAddress, serializeTransaction, toBytes } from "viem"; +import { type Hex, parseTransaction } from "viem"; import logger from "../../../config/logger"; import { config } from "../../../config/vars"; import { APIError } from "../../errors/api-error"; @@ -85,26 +84,13 @@ async function verifySignedEvmTransaction( }); } - const unsignedTx = serializeTransaction({ - accessList: parsed.accessList, - chainId: parsed.chainId, - data: parsed.data, - gas: parsed.gas, - gasPrice: parsed.gasPrice, - maxFeePerGas: parsed.maxFeePerGas, - maxPriorityFeePerGas: parsed.maxPriorityFeePerGas, - nonce: parsed.nonce, - to: parsed.to, - type: parsed.type || "eip1559", - value: parsed.value ?? 0n - } as any); - - const hash = keccak256(toBytes(unsignedTx)); - - const yParity = parsed.yParity !== undefined ? Number(parsed.yParity) : parsed.v !== undefined ? Number(parsed.v) - 27 : 0; - const signature = (parsed.r + parsed.s.slice(2) + yParity.toString(16).padStart(2, "0")) as `0x${string}`; - - const recoveredSigner = await recoverAddress({ hash, signature }); + const recoveredSigner = EthersTransaction.from(signedTxHex).from; + if (!recoveredSigner) { + throw new APIError({ + message: "Signed EVM transaction must include a recoverable signer", + status: httpStatus.BAD_REQUEST + }); + } if (recoveredSigner.toLowerCase() !== expectedSigner.toLowerCase()) { throw new APIError({ @@ -137,7 +123,9 @@ async function verifySignedEvmTransaction( }); } - if (parsed.data?.toLowerCase() !== unsignedTxData.data.toLowerCase()) { + const normalizedActual = (parsed.data ?? "0x").toLowerCase(); + const normalizedExpected = (unsignedTxData.data || "0x").toLowerCase(); + if (normalizedActual !== normalizedExpected) { throw new APIError({ message: "Signed EVM transaction data does not match expected data", status: httpStatus.BAD_REQUEST @@ -215,21 +203,14 @@ function getTransactionTypeForPhase(phase: RampPhase | CleanupPhase, network: Ne case "pendulumToMoonbeamXcm": case "assethubToPendulum": case "hydrationSwap": - case "spacewalkRedeem": case "pendulumCleanup": case "moonbeamCleanup": case "hydrationCleanup": return EphemeralAccountType.Substrate; - case "stellarCreateAccount": - case "stellarPayment": - case "stellarCleanup": - return EphemeralAccountType.Stellar; case "squidRouterApprove": case "squidRouterSwap": case "squidRouterPermitExecute": case "squidRouterPay": - case "moneriumOnrampSelfTransfer": - case "moneriumOnrampMint": case "fundEphemeral": case "destinationTransfer": case "moonbeamToPendulum": @@ -237,6 +218,7 @@ function getTransactionTypeForPhase(phase: RampPhase | CleanupPhase, network: Ne case "alfredpayOfframpTransfer": case "brlaOnrampMint": case "brlaPayoutOnBase": + case "mykoboPayoutOnBase": case "finalSettlementSubsidy": case "backupSquidRouterApprove": case "backupSquidRouterSwap": @@ -245,6 +227,7 @@ function getTransactionTypeForPhase(phase: RampPhase | CleanupPhase, network: Ne case "polygonCleanupAxlUsdc": case "baseCleanupBrla": case "baseCleanupUsdc": + case "baseCleanupEurc": case "baseCleanupAxlUsdc": case "alfredOnrampMintFallback": case "alfredpayOfframpTransferFallback": @@ -319,8 +302,6 @@ async function validateBackupTransactions( } else if (txType === EphemeralAccountType.Substrate) { await validateSubstrateTransaction(backupTx, ephemerals.Substrate, ephemerals.EVM); await assertSubstrateBackupMatchesPrimary(tx, backup); - } else if (txType === EphemeralAccountType.Stellar) { - await validateStellarTransaction(backupTx, ephemerals.Stellar); } } } @@ -370,7 +351,6 @@ export async function validatePresignedTxs( // is then verified against the unsigned blueprint by user-tx-verifier at phase execution time. // Accepting a presignedTx here would create a fake authority surface that bypasses that check. const isUserWalletPhase = - tx.phase === "moneriumOnrampMint" || tx.phase === "squidRouterNoPermitTransfer" || tx.phase === "squidRouterNoPermitApprove" || tx.phase === "squidRouterNoPermitSwap" || @@ -405,7 +385,6 @@ export async function validatePresignedTxs( await validateEvmTransaction(tx, ephemerals.EVM, matchingUnsigned.txData); } if (txType === EphemeralAccountType.Substrate) await validateSubstrateTransaction(tx, ephemerals.Substrate, ephemerals.EVM); - if (txType === EphemeralAccountType.Stellar) await validateStellarTransaction(tx, ephemerals.Stellar); await validateBackupTransactions(tx, ephemerals, evmUnsignedTxData); } @@ -660,161 +639,3 @@ async function validateSubstrateTransaction(tx: PresignedTx, expectedSignerSubst } logger.debug(`Validated Substrate extrinsic for phase ${tx.phase}: ${method.section}.${method.method}`); } - -async function validateStellarTransaction(tx: PresignedTx, expectedSigner: string) { - const { txData, signer, phase } = tx; - - if (!expectedSigner) { - throw new APIError({ - message: "Expected signer for Stellar transaction is not provided", - status: httpStatus.BAD_REQUEST - }); - } - - if (signer.toLowerCase() !== expectedSigner.toLowerCase()) { - throw new APIError({ - message: `Stellar transaction signer ${signer} does not match the expected signer ${expectedSigner} for phase ${phase}.`, - status: httpStatus.BAD_REQUEST - }); - } - - let transaction: StellarTransaction; - try { - transaction = TransactionBuilder.fromXDR(txData as string, StellarNetworks.PUBLIC) as StellarTransaction; - } catch (error) { - throw new APIError({ - message: `Invalid Stellar transaction data: ${(error as Error).message}`, - status: httpStatus.BAD_REQUEST - }); - } - - logger.debug("Parsed Stellar transaction source:", transaction.source); - - if (phase === "stellarCreateAccount") { - if (transaction.operations.length !== 3) { - throw new APIError({ - message: `Stellar Create Account transaction must have exactly 3 operations, found ${transaction.operations.length}`, - status: httpStatus.BAD_REQUEST - }); - } - - const createAccountOp = transaction.operations[0]; - if (createAccountOp.type !== "createAccount") { - throw new APIError({ - message: `First operation in Stellar Create Account transaction must be 'createAccount', found '${createAccountOp.type}'`, - status: httpStatus.BAD_REQUEST - }); - } - if (createAccountOp.destination !== signer) { - throw new APIError({ - message: `Stellar Create Account operation destination ${createAccountOp.destination} does not match the signer ${signer}`, - status: httpStatus.BAD_REQUEST - }); - } - if (!createAccountOp.startingBalance || parseFloat(createAccountOp.startingBalance) <= 0) { - throw new APIError({ - message: "Stellar Create Account operation must have a positive startingBalance", - status: httpStatus.BAD_REQUEST - }); - } - - const setOptionsOp = transaction.operations[1]; - if (setOptionsOp.type !== "setOptions") { - throw new APIError({ - message: `Second operation in Stellar Create Account transaction must be 'setOptions', found '${setOptionsOp.type}'`, - status: httpStatus.BAD_REQUEST - }); - } - if (setOptionsOp.source !== signer) { - throw new APIError({ - message: `Stellar Set Options operation source ${setOptionsOp.source} does not match the signer ${signer}`, - status: httpStatus.BAD_REQUEST - }); - } - if (setOptionsOp.type === "setOptions" && !setOptionsOp.signer) { - throw new APIError({ - message: "Stellar SetOptions operation must include a signer (cosigner) key", - status: httpStatus.BAD_REQUEST - }); - } - - const changeTrustOp = transaction.operations[2]; - if (changeTrustOp.type !== "changeTrust") { - throw new APIError({ - message: `Second operation in Stellar Create Account transaction must be 'changeTrust', found '${changeTrustOp.type}'`, - status: httpStatus.BAD_REQUEST - }); - } - if (changeTrustOp.source !== signer) { - throw new APIError({ - message: `Stellar Change Trust operation source ${changeTrustOp.source} does not match the signer ${signer}`, - status: httpStatus.BAD_REQUEST - }); - } - if (changeTrustOp.type === "changeTrust" && !changeTrustOp.line) { - throw new APIError({ - message: "Stellar ChangeTrust operation must specify a trust line asset", - status: httpStatus.BAD_REQUEST - }); - } - } - - if (phase === "stellarPayment") { - if (transaction.operations.length !== 1) { - throw new APIError({ - message: `Stellar Payment transaction must have exactly 1 operation, found ${transaction.operations.length}`, - status: httpStatus.BAD_REQUEST - }); - } - - const paymentOp = transaction.operations[0]; - if (paymentOp.type !== "payment") { - throw new APIError({ - message: `Stellar Payment transaction must have a 'payment' operation, found '${paymentOp.type}'`, - status: httpStatus.BAD_REQUEST - }); - } - if (transaction.source !== signer) { - throw new APIError({ - message: `Stellar Payment transaction source ${transaction.source} does not match the signer ${signer}`, - status: httpStatus.BAD_REQUEST - }); - } - - if (paymentOp.type === "payment") { - if (!paymentOp.destination) { - throw new APIError({ - message: "Stellar Payment operation must have a destination address", - status: httpStatus.BAD_REQUEST - }); - } - if (!paymentOp.amount || parseFloat(paymentOp.amount) <= 0) { - throw new APIError({ - message: "Stellar Payment operation must have a positive amount", - status: httpStatus.BAD_REQUEST - }); - } - if (!paymentOp.asset) { - throw new APIError({ - message: "Stellar Payment operation must specify an asset", - status: httpStatus.BAD_REQUEST - }); - } - } - } - - if (phase === "stellarCleanup") { - if (transaction.source !== signer) { - throw new APIError({ - message: `Stellar Cleanup transaction source ${transaction.source} does not match the signer ${signer}`, - status: httpStatus.BAD_REQUEST - }); - } - if (transaction.operations.length === 0 || transaction.operations.length > 5) { - throw new APIError({ - message: `Stellar Cleanup transaction has unexpected operation count: ${transaction.operations.length} (expected 1-5)`, - status: httpStatus.BAD_REQUEST - }); - } - } -} diff --git a/apps/api/src/api/workers/api-client-events-retention.worker.ts b/apps/api/src/api/workers/api-client-events-retention.worker.ts new file mode 100644 index 000000000..1a4378cd7 --- /dev/null +++ b/apps/api/src/api/workers/api-client-events-retention.worker.ts @@ -0,0 +1,42 @@ +import { CronJob } from "cron"; +import logger from "../../config/logger"; +import { ApiClientEventsRetentionService } from "../services/api-client-events-retention.service"; + +class ApiClientEventsRetentionWorker { + private job: CronJob; + + private readonly retentionService: ApiClientEventsRetentionService; + + constructor(cronTime = "5 0 * * *") { + this.retentionService = new ApiClientEventsRetentionService(); + this.job = new CronJob(cronTime, this.cleanup.bind(this), null, false, "UTC", null, true); + } + + public start(): void { + logger.info("Starting API client events retention worker"); + this.job.start(); + } + + public stop(): void { + logger.info("Stopping API client events retention worker"); + this.job.stop(); + } + + private async cleanup(): Promise { + logger.info("Running API client events retention worker cycle"); + + try { + const deletedEventsCount = await this.retentionService.cleanupExpiredEvents(); + if (deletedEventsCount > 0) { + logger.info(`Deleted ${deletedEventsCount} expired API client events`); + } + + logger.info("API client events retention worker cycle completed"); + } catch (error) { + const errorDetails = error instanceof Error ? (error.stack ?? error.message) : String(error); + logger.error(`Error during API client events retention worker cycle: ${errorDetails}`); + } + } +} + +export default ApiClientEventsRetentionWorker; diff --git a/apps/api/src/api/workers/cleanup.worker.test.ts b/apps/api/src/api/workers/cleanup.worker.test.ts index 4796549d7..4e9b8a810 100644 --- a/apps/api/src/api/workers/cleanup.worker.test.ts +++ b/apps/api/src/api/workers/cleanup.worker.test.ts @@ -31,14 +31,8 @@ const mockPendulumHandler = { shouldProcess: mock((_state: RampState) => true) }; -const mockStellarHandler = { - getCleanupName: () => "stellarCleanup" as CleanupPhase, - process: mock(async (): Promise => [true, null]), - shouldProcess: mock((_state: RampState) => true) -}; - mock.module("../services/phases/post-process", () => ({ - postProcessHandlers: [mockPendulumHandler, mockStellarHandler] + postProcessHandlers: [mockPendulumHandler] })); const updateMock = mock((_values: Partial, _options: { where: { id: string } }) => { @@ -69,24 +63,19 @@ describe("CleanupWorker - processCleanup", () => { mockPendulumHandler.shouldProcess.mockClear(); mockPendulumHandler.process.mockClear(); - mockStellarHandler.shouldProcess.mockClear(); - mockStellarHandler.process.mockClear(); updateMock.mockClear(); }); it("should process all applicable handlers successfully", async () => { mockPendulumHandler.process.mockImplementation(async () => [true, null] as ProcessResult); - mockStellarHandler.process.mockImplementation(async () => [true, null] as ProcessResult); await cleanupWorker.testProcessCleanup(testState); - // Verify both handlers were checked + // Verify handler was checked expect(mockPendulumHandler.shouldProcess).toHaveBeenCalledTimes(1); - expect(mockStellarHandler.shouldProcess).toHaveBeenCalledTimes(1); - // Verify both handlers were processed + // Verify handler was processed expect(mockPendulumHandler.process).toHaveBeenCalledTimes(1); - expect(mockStellarHandler.process).toHaveBeenCalledTimes(1); // Verify state was updated correctly expect(updateMock).toHaveBeenCalledTimes(1); @@ -104,12 +93,10 @@ describe("CleanupWorker - processCleanup", () => { // Setup one handler to fail const testError = new Error("Test failure"); mockPendulumHandler.process.mockImplementation(async () => [false, testError] as ProcessResult); - mockStellarHandler.process.mockImplementation(async () => [true, null] as ProcessResult); await cleanupWorker.testProcessCleanup(testState); expect(mockPendulumHandler.process).toHaveBeenCalledTimes(1); - expect(mockStellarHandler.process).toHaveBeenCalledTimes(1); expect(updateMock).toHaveBeenCalledTimes(1); @@ -123,18 +110,14 @@ describe("CleanupWorker - processCleanup", () => { it("should only retry failed handlers on subsequent attempts", async () => { testState.postCompleteState.cleanup.errors = [{ error: "Previous failure", name: "pendulumCleanup" }]; - // Setup both handlers to succeed this time + // Setup handler to succeed this time mockPendulumHandler.process.mockImplementation(async () => [true, null] as ProcessResult); - mockStellarHandler.process.mockImplementation(async () => [true, null] as ProcessResult); await cleanupWorker.testProcessCleanup(testState); // The pendulum handler should be processed again (because it failed before) expect(mockPendulumHandler.process).toHaveBeenCalledTimes(1); - // The stellar handler should NOT be processed again (since it didn't fail before) - expect(mockStellarHandler.process).toHaveBeenCalledTimes(0); - // Verify errors are cleared when handler succeeds expect(updateMock).toHaveBeenCalledTimes(1); @@ -145,9 +128,8 @@ describe("CleanupWorker - processCleanup", () => { expect(values.postCompleteState?.cleanup.errors).toBe(null); }); - it("should properly track errors for multiple failed handlers", async () => { + it("should properly track errors for failed handler", async () => { mockPendulumHandler.process.mockImplementation(async () => [false, new Error("Pendulum failure")] as ProcessResult); - mockStellarHandler.process.mockImplementation(async () => [false, new Error("Stellar failure")] as ProcessResult); await cleanupWorker.testProcessCleanup(testState); @@ -158,8 +140,7 @@ describe("CleanupWorker - processCleanup", () => { expect(values.postCompleteState?.cleanup.cleanupCompleted).toBe(false); const errors = values.postCompleteState?.cleanup.errors; - expect(errors).toHaveLength(2); + expect(errors).toHaveLength(1); expect(errors?.some(e => e.name === "pendulumCleanup" && e.error === "Pendulum failure")).toBe(true); - expect(errors?.some(e => e.name === "stellarCleanup" && e.error === "Stellar failure")).toBe(true); }); }); diff --git a/apps/api/src/api/workers/cleanup.worker.ts b/apps/api/src/api/workers/cleanup.worker.ts index a747c169a..33360e6a5 100644 --- a/apps/api/src/api/workers/cleanup.worker.ts +++ b/apps/api/src/api/workers/cleanup.worker.ts @@ -2,6 +2,7 @@ import { CronJob } from "cron"; import { Op } from "sequelize"; import logger from "../../config/logger"; import { runWithRampContext } from "../../config/ramp-context"; +import { config } from "../../config/vars"; import RampState from "../../models/rampState.model"; import { postProcessHandlers } from "../services/phases/post-process"; import { BaseRampService } from "../services/ramp/base.service"; @@ -152,6 +153,7 @@ class CleanupWorker { order: [["updatedAt", "DESC"]], where: { currentPhase: { [Op.in]: ["complete", "failed", "timedOut"] }, + flowVariant: config.flowVariant, postCompleteState: { cleanup: { [Op.or]: [{ cleanupCompleted: false }, { cleanupCompleted: { [Op.is]: null } }] diff --git a/apps/api/src/api/workers/ramp-recovery.worker.ts b/apps/api/src/api/workers/ramp-recovery.worker.ts index 61b048d1e..f76ee28a1 100644 --- a/apps/api/src/api/workers/ramp-recovery.worker.ts +++ b/apps/api/src/api/workers/ramp-recovery.worker.ts @@ -2,11 +2,13 @@ import { RampErrorLog } from "@vortexfi/shared"; import { CronJob } from "cron"; import { Op } from "sequelize"; import logger from "../../config/logger"; +import { config } from "../../config/vars"; import RampState from "../../models/rampState.model"; import phaseProcessor from "../services/phases/phase-processor"; import rampService from "../services/ramp/ramp.service"; const TEN_MINUTES_IN_MS = 10 * 60 * 1000; +const DISABLED_HYDRATION_PHASES = ["pendulumToHydrationXcm", "hydrationSwap", "hydrationToAssethubXcm"]; /** * Worker to recover failed ramp states @@ -56,8 +58,9 @@ class RampRecoveryWorker { const staleStates = await RampState.findAll({ where: { currentPhase: { - [Op.notIn]: ["complete", "failed", "initial"] + [Op.notIn]: ["complete", "failed", "initial", ...DISABLED_HYDRATION_PHASES] }, + flowVariant: config.flowVariant, presignedTxs: { [Op.not]: null }, updatedAt: { [Op.lt]: new Date(Date.now() - TEN_MINUTES_IN_MS) // 10 minutes ago diff --git a/apps/api/src/api/workers/unhandled-payment.worker.ts b/apps/api/src/api/workers/unhandled-payment.worker.ts index d9e681f38..a76a8035b 100644 --- a/apps/api/src/api/workers/unhandled-payment.worker.ts +++ b/apps/api/src/api/workers/unhandled-payment.worker.ts @@ -2,6 +2,7 @@ import { BrlaApiService, generateReferenceLabel, normalizeTaxId } from "@vortexf import { CronJob } from "cron"; import { Op } from "sequelize"; import logger from "../../config/logger"; +import { config } from "../../config/vars"; import RampState from "../../models/rampState.model"; import TaxId from "../../models/taxId.model"; import { SlackNotifier } from "../services/slack.service"; @@ -79,6 +80,7 @@ class UnhandledPaymentWorker { [Op.gt]: threeDaysAgo }, currentPhase: "initial", + flowVariant: config.flowVariant, id: { [Op.notIn]: Array.from(this.processedStateIds) } @@ -105,6 +107,7 @@ class UnhandledPaymentWorker { [Op.gt]: threeDaysAgo }, currentPhase: "failed", + flowVariant: config.flowVariant, id: { [Op.notIn]: Array.from(this.processedStateIds) } diff --git a/apps/api/src/config/express.ts b/apps/api/src/config/express.ts index 7fbb6d031..89028bffe 100644 --- a/apps/api/src/config/express.ts +++ b/apps/api/src/config/express.ts @@ -9,6 +9,7 @@ import methodOverride from "method-override"; import morgan from "morgan"; import { converter, handler, notFound } from "../api/middlewares/error"; +import { requestContext } from "../api/observability/requestContext"; import routes from "../api/routes/v1"; import { config } from "./vars"; @@ -25,8 +26,9 @@ const app = express(); // enable CORS - Cross Origin Resource Sharing app.use( cors({ - allowedHeaders: ["Content-Type", "Authorization"], + allowedHeaders: ["Content-Type", "Authorization", "X-API-Key", "X-Request-ID", "X-Correlation-ID"], credentials: true, + exposedHeaders: ["X-Request-ID"], maxAge: 86400, // Cache preflight requests for 24 hours methods: "GET,HEAD,PUT,PATCH,POST,DELETE", // Explicitly list allowed headers origin: [ @@ -34,6 +36,7 @@ app.use( "https://metrics.vortexfinance.co", config.env !== "production" ? "https://staging--vortexfi.netlify.app" : null, config.env === "development" ? "http://localhost:5173" : null, + config.env === "development" ? "http://127.0.0.1:5173" : null, config.env === "development" ? "http://localhost:6006" : null ].filter(Boolean) as string[] }) @@ -55,6 +58,9 @@ app.use(limiter); // parse cookies app.use(cookieParser()); +// attach request IDs before request logging and route handling +app.use(requestContext); + // request logging. dev: console | production: file app.use(morgan(logs)); diff --git a/apps/api/src/config/vars.test.ts b/apps/api/src/config/vars.test.ts index 41ed0cc5f..0a3254e6d 100644 --- a/apps/api/src/config/vars.test.ts +++ b/apps/api/src/config/vars.test.ts @@ -5,6 +5,7 @@ const bunExecutable = Bun.argv[0]; const requiredProductionEnv = { ADMIN_SECRET: "test-admin-secret", + METRICS_DASHBOARD_SECRET: "test-metrics-dashboard-secret", SUPABASE_ANON_KEY: "test-anon-key", SUPABASE_SERVICE_KEY: "test-service-key", SUPABASE_URL: "https://example.supabase.co", @@ -67,4 +68,15 @@ describe("vars deployment environment validation", () => { expect(result.exitCode).toBe(1); expect(result.stderr).toContain("DEPLOYMENT_ENV=sandbox requires SANDBOX_ENABLED=true"); }); + + it("requires the metrics dashboard secret in production", async () => { + const result = await importVarsWithEnv({ + DEPLOYMENT_ENV: "production", + METRICS_DASHBOARD_SECRET: "", + NODE_ENV: "production" + }); + + expect(result.exitCode).toBe(1); + expect(result.stderr).toContain("METRICS_DASHBOARD_SECRET"); + }); }); diff --git a/apps/api/src/config/vars.ts b/apps/api/src/config/vars.ts index f39fa69ed..59c765252 100644 --- a/apps/api/src/config/vars.ts +++ b/apps/api/src/config/vars.ts @@ -24,8 +24,14 @@ interface SpreadsheetConfig { type DeploymentEnv = "development" | "production" | "sandbox" | "staging" | "test"; +// Identifies which onramp flow this backend instance serves. Two backends +// share one database; each ignores ramps/quotes belonging to the other flow. +// "monerium" is the legacy grace-period backend; "mykobo" is the new replacement. +export type FlowVariant = "monerium" | "mykobo"; + const nodeEnv = process.env.NODE_ENV || "production"; const deploymentEnvValues: DeploymentEnv[] = ["development", "production", "sandbox", "staging", "test"]; +const flowVariantValues: FlowVariant[] = ["monerium", "mykobo"]; function readDeploymentEnv(): DeploymentEnv { const rawDeploymentEnv = process.env.DEPLOYMENT_ENV || (nodeEnv === "production" ? "production" : nodeEnv); @@ -37,9 +43,36 @@ function readDeploymentEnv(): DeploymentEnv { return rawDeploymentEnv as DeploymentEnv; } +function readFlowVariant(): FlowVariant { + const rawFlowVariant = process.env.FLOW_VARIANT || "monerium"; + + if (!flowVariantValues.includes(rawFlowVariant as FlowVariant)) { + throw new Error(`FLOW_VARIANT must be one of: ${flowVariantValues.join(", ")} (got '${rawFlowVariant}')`); + } + + return rawFlowVariant as FlowVariant; +} + +function readFractionEnv(name: string, defaultValue: string): number { + const rawValue = process.env[name] ?? defaultValue; + const trimmedValue = rawValue.trim(); + + if (trimmedValue === "") { + throw new Error(`${name} must be a finite number between 0 and 1`); + } + + const value = Number(trimmedValue); + if (!Number.isFinite(value) || value < 0 || value > 1) { + throw new Error(`${name} must be a finite number between 0 and 1`); + } + + return value; +} + interface Config { env: string; deploymentEnv: DeploymentEnv; + flowVariant: FlowVariant; port: string | number; amplitudeWss: string; pendulumWss: string; @@ -48,6 +81,7 @@ interface Config { rateLimitNumberOfProxies: string | number; logs: string; adminSecret: string; + metricsDashboardSecret: string; supabase: { url: string; anonKey: string; @@ -77,6 +111,10 @@ interface Config { swap: { deadlineMinutes: number; }; + subsidy: { + evmPostSwapDiscountSubsidyQuoteFraction: number; + evmSwapSubsidyQuoteFraction: number; + }; quote: { discountStateTimeoutMinutes: number; deltaDBasisPoints: number; @@ -86,17 +124,12 @@ interface Config { secrets: { pendulumFundingSeed: string | undefined; - stellarFundingSecret: string | undefined; moonbeamExecutorPrivateKey: string | undefined; clientDomainSecret: string | undefined; webhookPrivateKey: string | undefined; }; integrations: { - monerium: { - clientId: string | undefined; - clientSecret: string | undefined; - }; alchemy: { apiKey: string | undefined; }; @@ -132,21 +165,19 @@ export const config: Config = { }, deploymentEnv: readDeploymentEnv(), env: nodeEnv, + flowVariant: readFlowVariant(), integrations: { alchemy: { apiKey: process.env.ALCHEMY_API_KEY }, - monerium: { - clientId: process.env.MONERIUM_CLIENT_ID_APP, - clientSecret: process.env.MONERIUM_CLIENT_SECRET - }, slack: { userId: process.env.SLACK_USER_ID, webhookToken: process.env.SLACK_WEB_HOOK_TOKEN } }, logs: nodeEnv === "production" ? "combined" : "dev", + metricsDashboardSecret: process.env.METRICS_DASHBOARD_SECRET || "", pendulumWss: process.env.PENDULUM_WSS || "wss://rpc-pendulum.prd.pendulumchain.tech", port: process.env.PORT || 3000, priceProviders: { @@ -185,7 +216,6 @@ export const config: Config = { clientDomainSecret: process.env.CLIENT_DOMAIN_SECRET, moonbeamExecutorPrivateKey: process.env.MOONBEAM_EXECUTOR_PRIVATE_KEY, pendulumFundingSeed: process.env.PENDULUM_FUNDING_SEED, - stellarFundingSecret: process.env.FUNDING_SECRET, webhookPrivateKey: process.env.WEBHOOK_PRIVATE_KEY }, spreadsheet: { @@ -199,6 +229,11 @@ export const config: Config = { storageSheetId: process.env.GOOGLE_SPREADSHEET_ID }, subscanApiKey: process.env.SUBSCAN_API_KEY, + + subsidy: { + evmPostSwapDiscountSubsidyQuoteFraction: readFractionEnv("MAX_EVM_POST_SWAP_DISCOUNT_SUBSIDY_QUOTE_FRACTION", "0.05"), + evmSwapSubsidyQuoteFraction: readFractionEnv("MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION", "0.05") + }, supabase: { anonKey: process.env.SUPABASE_ANON_KEY || "", serviceRoleKey: process.env.SUPABASE_SERVICE_KEY || "", @@ -210,8 +245,6 @@ export const config: Config = { vortexFeePenPercentage: parseFloat(process.env.VORTEX_FEE_PEN_PERCENTAGE || "0.0") }; -// Derived values — aliases kept for semantic clarity in consuming code -export const SEP10_MASTER_SECRET = config.secrets.stellarFundingSecret; export const EVM_FUNDING_PRIVATE_KEY = process.env.EVM_FUNDING_PRIVATE_KEY ?? config.secrets.moonbeamExecutorPrivateKey; if (config.sandboxEnabled && config.deploymentEnv !== "sandbox") { @@ -230,6 +263,8 @@ if (config.env === "production") { if (!config.supabase.serviceRoleKey) missing.push("SUPABASE_SERVICE_KEY"); if (!config.secrets.webhookPrivateKey) missing.push("WEBHOOK_PRIVATE_KEY"); if (!config.adminSecret) missing.push("ADMIN_SECRET"); + if (!config.metricsDashboardSecret) missing.push("METRICS_DASHBOARD_SECRET"); + if (!process.env.FLOW_VARIANT) missing.push("FLOW_VARIANT"); if (missing.length > 0) { throw new Error(`Missing required environment variables in production: ${missing.join(", ")}`); diff --git a/apps/api/src/constants/constants.ts b/apps/api/src/constants/constants.ts index 0d852b943..f53e8f380 100644 --- a/apps/api/src/constants/constants.ts +++ b/apps/api/src/constants/constants.ts @@ -6,7 +6,6 @@ const STELLAR_FUNDING_AMOUNT_UNITS = "10"; // 10 XLM. Minimum balance of fundin const MOONBEAM_FUNDING_AMOUNT_UNITS = "10"; // 10 GLMR. Minimum balance of funding account const SUBSIDY_MINIMUM_RATIO_FUND_UNITS = "5"; // 5 Subsidies considering maximum subsidy amount use on each (worst case scenario) const MOONBEAM_RECEIVER_CONTRACT_ADDRESS = "0x2AB52086e8edaB28193172209407FF9df1103CDc"; -const STELLAR_EPHEMERAL_STARTING_BALANCE_UNITS = "2.5"; // Amount to send to the new stellar ephemeral account created const PENDULUM_EPHEMERAL_STARTING_BALANCE_UNITS = "0.1"; // Amount to send to the new pendulum ephemeral account created const MOONBEAM_EPHEMERAL_STARTING_BALANCE_UNITS = "1"; // Amount to send to the new moonbeam ephemeral account created const POLYGON_EPHEMERAL_STARTING_BALANCE_UNITS = "1.5"; // Amount to send to the new polygon ephemeral account created @@ -16,15 +15,11 @@ const DEFAULT_POLLING_INTERVAL = 3000; const GLMR_FUNDING_AMOUNT_RAW = "50000000000000000"; const ASSETHUB_XCM_FEE_USDC_UNITS = 0.013124; const MAX_FINAL_SETTLEMENT_SUBSIDY_USD = "10"; // 10 USD -const MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION = "0.05"; // 5% of quote.outputAmount in USD const WEBHOOKS_CACHE_URL = "https://webhooks-cache.pendulumchain.tech"; // EXAMPLE URL const STELLAR_BASE_FEE = "1000000"; -// Expiration and timeout values -const SEQUENCE_TIME_WINDOW_IN_SECONDS = 600; // 10 minutes. Marks the MAXIMUM window between creating the stellar ephemeral transactions and it's creation on chain. - const DEFAULT_LOGIN_EXPIRATION_TIME_HOURS = 7 * 24; const FIRST_TX_TIME_WINDOW_IN_SECONDS = 5 * 60; // 5 minutes @@ -42,25 +37,22 @@ const SEQUENCE_TIME_WINDOWS = { }; export { - POLYGON_EPHEMERAL_STARTING_BALANCE_UNITS, ASSETHUB_XCM_FEE_USDC_UNITS, - SEQUENCE_TIME_WINDOW_IN_SECONDS, - SEQUENCE_TIME_WINDOWS, + BASE_EPHEMERAL_STARTING_BALANCE_UNITS, + DEFAULT_LOGIN_EXPIRATION_TIME_HOURS, + DEFAULT_POLLING_INTERVAL, GLMR_FUNDING_AMOUNT_RAW, - PENDULUM_GLMR_FUNDING_AMOUNT_UNITS, - PENDULUM_FUNDING_AMOUNT_UNITS, - STELLAR_FUNDING_AMOUNT_UNITS, + MAX_FINAL_SETTLEMENT_SUBSIDY_USD, + MOONBEAM_EPHEMERAL_STARTING_BALANCE_UNITS, MOONBEAM_FUNDING_AMOUNT_UNITS, MOONBEAM_RECEIVER_CONTRACT_ADDRESS, - SUBSIDY_MINIMUM_RATIO_FUND_UNITS, - STELLAR_EPHEMERAL_STARTING_BALANCE_UNITS, PENDULUM_EPHEMERAL_STARTING_BALANCE_UNITS, - MOONBEAM_EPHEMERAL_STARTING_BALANCE_UNITS, - DEFAULT_LOGIN_EXPIRATION_TIME_HOURS, - WEBHOOKS_CACHE_URL, - DEFAULT_POLLING_INTERVAL, + PENDULUM_FUNDING_AMOUNT_UNITS, + PENDULUM_GLMR_FUNDING_AMOUNT_UNITS, + POLYGON_EPHEMERAL_STARTING_BALANCE_UNITS, + SEQUENCE_TIME_WINDOWS, STELLAR_BASE_FEE, - MAX_FINAL_SETTLEMENT_SUBSIDY_USD, - MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION, - BASE_EPHEMERAL_STARTING_BALANCE_UNITS + STELLAR_FUNDING_AMOUNT_UNITS, + SUBSIDY_MINIMUM_RATIO_FUND_UNITS, + WEBHOOKS_CACHE_URL }; diff --git a/apps/api/src/database/migrations/028-add-flow-variant.ts b/apps/api/src/database/migrations/028-add-flow-variant.ts new file mode 100644 index 000000000..92459ac7e --- /dev/null +++ b/apps/api/src/database/migrations/028-add-flow-variant.ts @@ -0,0 +1,30 @@ +import { DataTypes, QueryInterface } from "sequelize"; + +const TABLES = ["quote_tickets", "ramp_states"] as const; + +export async function up(queryInterface: QueryInterface): Promise { + for (const table of TABLES) { + await queryInterface.addColumn(table, "flow_variant", { + allowNull: true, + type: DataTypes.STRING(16) + }); + + await queryInterface.sequelize.query(`UPDATE "${table}" SET "flow_variant" = 'monerium' WHERE "flow_variant" IS NULL`); + + await queryInterface.changeColumn(table, "flow_variant", { + allowNull: false, + type: DataTypes.STRING(16) + }); + + await queryInterface.addIndex(table, ["flow_variant"], { + name: `idx_${table}_flow_variant` + }); + } +} + +export async function down(queryInterface: QueryInterface): Promise { + for (const table of TABLES) { + await queryInterface.removeIndex(table, `idx_${table}_flow_variant`); + await queryInterface.removeColumn(table, "flow_variant"); + } +} diff --git a/apps/api/src/database/migrations/028-remove-stellar-anchors.ts b/apps/api/src/database/migrations/028-remove-stellar-anchors.ts new file mode 100644 index 000000000..fe601c9a8 --- /dev/null +++ b/apps/api/src/database/migrations/028-remove-stellar-anchors.ts @@ -0,0 +1,49 @@ +import { Op, QueryInterface } from "sequelize"; + +export async function up(queryInterface: QueryInterface): Promise { + await queryInterface.bulkDelete("anchors", { + identifier: { + [Op.in]: ["stellar_eurc", "stellar_ars"] + } + }); + + await queryInterface.sequelize.query("DELETE FROM subsidies WHERE token = 'XLM'"); +} + +export async function down(queryInterface: QueryInterface): Promise { + await queryInterface.bulkInsert("anchors", [ + { + created_at: new Date(), + currency: "EUR", + id: queryInterface.sequelize.literal("uuid_generate_v4()"), + identifier: "stellar_eurc", + is_active: true, + ramp_type: "off", + updated_at: new Date(), + value: 0.0025, + value_type: "relative" + }, + { + created_at: new Date(), + currency: "ARS", + id: queryInterface.sequelize.literal("uuid_generate_v4()"), + identifier: "stellar_ars", + is_active: true, + ramp_type: "off", + updated_at: new Date(), + value: 0.02, + value_type: "relative" + }, + { + created_at: new Date(), + currency: "ARS", + id: queryInterface.sequelize.literal("uuid_generate_v4()"), + identifier: "stellar_ars", + is_active: true, + ramp_type: "off", + updated_at: new Date(), + value: 10, + value_type: "absolute" + } + ]); +} diff --git a/apps/api/src/database/migrations/029-create-mykobo-customers-table.ts b/apps/api/src/database/migrations/029-create-mykobo-customers-table.ts new file mode 100644 index 000000000..415aa966d --- /dev/null +++ b/apps/api/src/database/migrations/029-create-mykobo-customers-table.ts @@ -0,0 +1,82 @@ +import { DataTypes, QueryInterface } from "sequelize"; + +export async function up(queryInterface: QueryInterface): Promise { + await queryInterface.createTable("mykobo_customers", { + created_at: { + allowNull: false, + defaultValue: DataTypes.NOW, + type: DataTypes.DATE + }, + email: { + allowNull: false, + type: DataTypes.STRING, + unique: true + }, + id: { + allowNull: false, + defaultValue: DataTypes.UUIDV4, + primaryKey: true, + type: DataTypes.UUID + }, + last_failure_reasons: { + allowNull: true, + defaultValue: [], + type: DataTypes.ARRAY(DataTypes.STRING) + }, + status: { + allowNull: false, + defaultValue: "CONSULTED", + type: DataTypes.ENUM("CONSULTED", "PENDING", "APPROVED", "REJECTED") + }, + status_external: { + allowNull: true, + type: DataTypes.STRING + }, + type: { + allowNull: false, + defaultValue: "INDIVIDUAL", + type: DataTypes.ENUM("INDIVIDUAL", "BUSINESS") + }, + updated_at: { + allowNull: false, + defaultValue: DataTypes.NOW, + type: DataTypes.DATE + }, + user_id: { + allowNull: false, + type: DataTypes.UUID, + unique: true + } + }); + + await queryInterface.addConstraint("mykobo_customers", { + fields: ["user_id"], + name: "fk_mykobo_customers_user_id", + onDelete: "CASCADE", + onUpdate: "CASCADE", + references: { + field: "id", + table: "profiles" + }, + type: "foreign key" + }); + + await queryInterface.addIndex("mykobo_customers", ["user_id"], { + name: "idx_mykobo_customers_user_id", + unique: true + }); + + await queryInterface.addIndex("mykobo_customers", ["email"], { + name: "idx_mykobo_customers_email", + unique: true + }); +} + +export async function down(queryInterface: QueryInterface): Promise { + await queryInterface.removeConstraint("mykobo_customers", "fk_mykobo_customers_user_id"); + + await queryInterface.dropTable("mykobo_customers"); + + await queryInterface.sequelize.query('DROP TYPE IF EXISTS "enum_mykobo_customers_status";').catch(() => {}); + await queryInterface.sequelize.query('DROP TYPE IF EXISTS "enum_mykobo_customers_type";').catch(() => {}); +} diff --git a/apps/api/src/database/migrations/030-add-expired-quote-cleanup-index.ts b/apps/api/src/database/migrations/030-add-expired-quote-cleanup-index.ts new file mode 100644 index 000000000..cef566235 --- /dev/null +++ b/apps/api/src/database/migrations/030-add-expired-quote-cleanup-index.ts @@ -0,0 +1,15 @@ +import { QueryInterface } from "sequelize"; + +export async function up(queryInterface: QueryInterface): Promise { + await queryInterface.sequelize.query(` + CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_quote_tickets_expired_expires_at + ON quote_tickets (expires_at) + WHERE status = 'expired'; + `); +} + +export async function down(queryInterface: QueryInterface): Promise { + await queryInterface.sequelize.query(` + DROP INDEX CONCURRENTLY IF EXISTS idx_quote_tickets_expired_expires_at; + `); +} diff --git a/apps/api/src/database/migrations/031-add-quote-created-at-index.ts b/apps/api/src/database/migrations/031-add-quote-created-at-index.ts new file mode 100644 index 000000000..7939d4848 --- /dev/null +++ b/apps/api/src/database/migrations/031-add-quote-created-at-index.ts @@ -0,0 +1,14 @@ +import { QueryInterface } from "sequelize"; + +export async function up(queryInterface: QueryInterface): Promise { + await queryInterface.sequelize.query(` + CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_quote_tickets_created_at + ON quote_tickets (created_at DESC); + `); +} + +export async function down(queryInterface: QueryInterface): Promise { + await queryInterface.sequelize.query(` + DROP INDEX CONCURRENTLY IF EXISTS idx_quote_tickets_created_at; + `); +} diff --git a/apps/api/src/database/migrations/032-create-api-client-events-table.ts b/apps/api/src/database/migrations/032-create-api-client-events-table.ts new file mode 100644 index 000000000..cd4514bb7 --- /dev/null +++ b/apps/api/src/database/migrations/032-create-api-client-events-table.ts @@ -0,0 +1,56 @@ +import { DataTypes, QueryInterface } from "sequelize"; + +export async function up(queryInterface: QueryInterface): Promise { + await queryInterface.createTable("api_client_events", { + api_key_prefix: { allowNull: true, type: DataTypes.STRING(16) }, + created_at: { allowNull: false, defaultValue: DataTypes.NOW, type: DataTypes.DATE }, + duration_ms: { allowNull: true, type: DataTypes.INTEGER }, + error_message: { allowNull: true, type: DataTypes.STRING(300) }, + error_type: { allowNull: true, type: DataTypes.STRING(64) }, + http_status: { allowNull: true, type: DataTypes.INTEGER }, + id: { defaultValue: DataTypes.UUIDV4, primaryKey: true, type: DataTypes.UUID }, + metadata: { allowNull: true, type: DataTypes.JSONB }, + network: { allowNull: true, type: DataTypes.STRING(32) }, + operation: { allowNull: false, type: DataTypes.STRING(64) }, + partner_id: { allowNull: true, type: DataTypes.UUID }, + partner_name: { allowNull: true, type: DataTypes.STRING(100) }, + payment_method: { allowNull: true, type: DataTypes.STRING(32) }, + quote_id: { allowNull: true, type: DataTypes.UUID }, + ramp_id: { allowNull: true, type: DataTypes.UUID }, + ramp_type: { allowNull: true, type: DataTypes.STRING(16) }, + request_id: { allowNull: true, type: DataTypes.STRING(128) }, + status: { allowNull: false, type: DataTypes.STRING(16) }, + updated_at: { allowNull: false, defaultValue: DataTypes.NOW, type: DataTypes.DATE }, + user_id: { allowNull: true, type: DataTypes.UUID } + }); + + await queryInterface.addIndex("api_client_events", { + fields: [{ name: "created_at", order: "DESC" }], + name: "idx_api_client_events_created_at" + }); + await queryInterface.addIndex("api_client_events", ["partner_id", "created_at"], { + name: "idx_api_client_events_partner_id_created_at" + }); + await queryInterface.addIndex("api_client_events", ["partner_name", "created_at"], { + name: "idx_api_client_events_partner_name_created_at" + }); + await queryInterface.addIndex("api_client_events", ["operation", "created_at"], { + name: "idx_api_client_events_operation_created_at" + }); + await queryInterface.addIndex("api_client_events", ["status", "created_at"], { + name: "idx_api_client_events_status_created_at" + }); + await queryInterface.addIndex("api_client_events", ["error_type", "created_at"], { + name: "idx_api_client_events_error_type_created_at" + }); + await queryInterface.addIndex("api_client_events", ["api_key_prefix", "created_at"], { + name: "idx_api_client_events_api_key_prefix_created_at" + }); + await queryInterface.addIndex("api_client_events", ["request_id"], { name: "idx_api_client_events_request_id" }); + await queryInterface.addIndex("api_client_events", ["quote_id"], { name: "idx_api_client_events_quote_id" }); + await queryInterface.addIndex("api_client_events", ["ramp_id"], { name: "idx_api_client_events_ramp_id" }); +} + +export async function down(queryInterface: QueryInterface): Promise { + await queryInterface.dropTable("api_client_events"); +} diff --git a/apps/api/src/database/migrations/033-profile-partner-assignments.ts b/apps/api/src/database/migrations/033-profile-partner-assignments.ts new file mode 100644 index 000000000..0d70ecd2b --- /dev/null +++ b/apps/api/src/database/migrations/033-profile-partner-assignments.ts @@ -0,0 +1,126 @@ +import { DataTypes, QueryInterface } from "sequelize"; + +export async function up(queryInterface: QueryInterface): Promise { + await queryInterface.createTable("profile_partner_assignments", { + buyPartnerId: { + allowNull: true, + field: "buy_partner_id", + onDelete: "SET NULL", + onUpdate: "CASCADE", + references: { + key: "id", + model: "partners" + }, + type: DataTypes.UUID + }, + createdAt: { + allowNull: false, + defaultValue: DataTypes.NOW, + field: "created_at", + type: DataTypes.DATE + }, + expiresAt: { + allowNull: true, + field: "expires_at", + type: DataTypes.DATE + }, + id: { + defaultValue: DataTypes.UUIDV4, + primaryKey: true, + type: DataTypes.UUID + }, + isActive: { + allowNull: false, + defaultValue: true, + field: "is_active", + type: DataTypes.BOOLEAN + }, + partnerName: { + allowNull: false, + field: "partner_name", + type: DataTypes.STRING(100) + }, + sellPartnerId: { + allowNull: true, + field: "sell_partner_id", + onDelete: "SET NULL", + onUpdate: "CASCADE", + references: { + key: "id", + model: "partners" + }, + type: DataTypes.UUID + }, + updatedAt: { + allowNull: false, + defaultValue: DataTypes.NOW, + field: "updated_at", + type: DataTypes.DATE + }, + userId: { + allowNull: false, + field: "user_id", + onDelete: "CASCADE", + onUpdate: "CASCADE", + references: { + key: "id", + model: "profiles" + }, + type: DataTypes.UUID + } + }); + + await queryInterface.addIndex("profile_partner_assignments", ["user_id"], { + name: "idx_profile_partner_assignments_user_id" + }); + + await queryInterface.addIndex("profile_partner_assignments", ["partner_name"], { + name: "idx_profile_partner_assignments_partner_name" + }); + + await queryInterface.addIndex("profile_partner_assignments", ["buy_partner_id"], { + name: "idx_profile_partner_assignments_buy_partner" + }); + + await queryInterface.addIndex("profile_partner_assignments", ["sell_partner_id"], { + name: "idx_profile_partner_assignments_sell_partner" + }); + + await queryInterface.addIndex("profile_partner_assignments", ["user_id", "is_active", "expires_at"], { + name: "idx_profile_partner_assignments_active_lookup" + }); + + await queryInterface.addIndex("profile_partner_assignments", ["user_id"], { + name: "uniq_profile_partner_assignments_active_user", + unique: true, + where: { is_active: true } + }); + + await queryInterface.addColumn("quote_tickets", "pricing_partner_id", { + allowNull: true, + onDelete: "SET NULL", + onUpdate: "CASCADE", + references: { + key: "id", + model: "partners" + }, + type: DataTypes.UUID + }); + + await queryInterface.addIndex("quote_tickets", ["pricing_partner_id"], { + name: "idx_quote_tickets_pricing_partner" + }); +} + +export async function down(queryInterface: QueryInterface): Promise { + await queryInterface.removeIndex("quote_tickets", "idx_quote_tickets_pricing_partner"); + await queryInterface.removeColumn("quote_tickets", "pricing_partner_id"); + + await queryInterface.removeIndex("profile_partner_assignments", "uniq_profile_partner_assignments_active_user"); + await queryInterface.removeIndex("profile_partner_assignments", "idx_profile_partner_assignments_active_lookup"); + await queryInterface.removeIndex("profile_partner_assignments", "idx_profile_partner_assignments_sell_partner"); + await queryInterface.removeIndex("profile_partner_assignments", "idx_profile_partner_assignments_buy_partner"); + await queryInterface.removeIndex("profile_partner_assignments", "idx_profile_partner_assignments_partner_name"); + await queryInterface.removeIndex("profile_partner_assignments", "idx_profile_partner_assignments_user_id"); + await queryInterface.dropTable("profile_partner_assignments"); +} diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts index 6e7dc180e..7936ef671 100755 --- a/apps/api/src/index.ts +++ b/apps/api/src/index.ts @@ -1,4 +1,4 @@ -import { ApiManager, EvmClientManager, initializeEvmTokens, setLogger } from "@vortexfi/shared"; +import { EvmClientManager, initializeEvmTokens, setLogger } from "@vortexfi/shared"; import dotenv from "dotenv"; import path from "path"; import cryptoService from "./config/crypto"; @@ -11,6 +11,7 @@ import { runMigrations } from "./database/migrator"; import "./models"; // Initialize models import { AlfredpayLimitsService } from "./api/services/alfredpay/alfredpay-limits.service"; import registerPhaseHandlers from "./api/services/phases/register-handlers"; +import ApiClientEventsRetentionWorker from "./api/workers/api-client-events-retention.worker"; import CleanupWorker from "./api/workers/cleanup.worker"; import RampRecoveryWorker from "./api/workers/ramp-recovery.worker"; import UnhandledPaymentWorker from "./api/workers/unhandled-payment.worker"; @@ -27,7 +28,6 @@ setLogger(logger); const validateRequiredEnvVars = () => { const requiredVars = { CLIENT_DOMAIN_SECRET: config.secrets.clientDomainSecret, - FUNDING_SECRET: config.secrets.stellarFundingSecret, MOONBEAM_EXECUTOR_PRIVATE_KEY: config.secrets.moonbeamExecutorPrivateKey, PENDULUM_FUNDING_SEED: config.secrets.pendulumFundingSeed }; @@ -58,14 +58,12 @@ const initializeApp = async () => { // Run database migrations await runMigrations(); - const apiManager = ApiManager.getInstance(); - await apiManager.populateAllApis(); - // Initialize EVM clients const _evmClientManager = EvmClientManager.getInstance(); // Start background workers new CleanupWorker().start(); + new ApiClientEventsRetentionWorker().start(); new RampRecoveryWorker().start(); new UnhandledPaymentWorker().start(); diff --git a/apps/api/src/models/apiClientEvent.model.ts b/apps/api/src/models/apiClientEvent.model.ts new file mode 100644 index 000000000..c989fb25d --- /dev/null +++ b/apps/api/src/models/apiClientEvent.model.ts @@ -0,0 +1,99 @@ +import { DataTypes, Model, Optional } from "sequelize"; +import { ApiClientErrorType, ApiClientEventStatus, ApiClientOperation } from "../api/observability/types"; +import sequelize from "../config/database"; + +export interface ApiClientEventAttributes { + id: string; + requestId: string | null; + operation: ApiClientOperation; + status: ApiClientEventStatus; + httpStatus: number | null; + errorType: ApiClientErrorType | null; + errorMessage: string | null; + partnerId: string | null; + partnerName: string | null; + apiKeyPrefix: string | null; + userId: string | null; + quoteId: string | null; + rampId: string | null; + rampType: string | null; + network: string | null; + paymentMethod: string | null; + durationMs: number | null; + metadata: Record | null; + createdAt: Date; + updatedAt: Date; +} + +export type ApiClientEventCreationAttributes = Optional; + +class ApiClientEvent + extends Model + implements ApiClientEventAttributes +{ + declare id: string; + declare requestId: string | null; + declare operation: ApiClientOperation; + declare status: ApiClientEventStatus; + declare httpStatus: number | null; + declare errorType: ApiClientErrorType | null; + declare errorMessage: string | null; + declare partnerId: string | null; + declare partnerName: string | null; + declare apiKeyPrefix: string | null; + declare userId: string | null; + declare quoteId: string | null; + declare rampId: string | null; + declare rampType: string | null; + declare network: string | null; + declare paymentMethod: string | null; + declare durationMs: number | null; + declare metadata: Record | null; + declare createdAt: Date; + declare updatedAt: Date; +} + +ApiClientEvent.init( + { + apiKeyPrefix: { allowNull: true, field: "api_key_prefix", type: DataTypes.STRING(16) }, + createdAt: { allowNull: false, defaultValue: DataTypes.NOW, field: "created_at", type: DataTypes.DATE }, + durationMs: { allowNull: true, field: "duration_ms", type: DataTypes.INTEGER }, + errorMessage: { allowNull: true, field: "error_message", type: DataTypes.STRING(300) }, + errorType: { allowNull: true, field: "error_type", type: DataTypes.STRING(64) }, + httpStatus: { allowNull: true, field: "http_status", type: DataTypes.INTEGER }, + id: { defaultValue: DataTypes.UUIDV4, primaryKey: true, type: DataTypes.UUID }, + metadata: { allowNull: true, type: DataTypes.JSONB }, + network: { allowNull: true, type: DataTypes.STRING(32) }, + operation: { allowNull: false, type: DataTypes.STRING(64) }, + partnerId: { allowNull: true, field: "partner_id", type: DataTypes.UUID }, + partnerName: { allowNull: true, field: "partner_name", type: DataTypes.STRING(100) }, + paymentMethod: { allowNull: true, field: "payment_method", type: DataTypes.STRING(32) }, + quoteId: { allowNull: true, field: "quote_id", type: DataTypes.UUID }, + rampId: { allowNull: true, field: "ramp_id", type: DataTypes.UUID }, + rampType: { allowNull: true, field: "ramp_type", type: DataTypes.STRING(16) }, + requestId: { allowNull: true, field: "request_id", type: DataTypes.STRING(128) }, + status: { allowNull: false, type: DataTypes.STRING(16) }, + updatedAt: { allowNull: false, defaultValue: DataTypes.NOW, field: "updated_at", type: DataTypes.DATE }, + userId: { allowNull: true, field: "user_id", type: DataTypes.UUID } + }, + { + indexes: [ + { fields: [{ name: "created_at", order: "DESC" }], name: "idx_api_client_events_created_at" }, + { fields: ["partner_id", "created_at"], name: "idx_api_client_events_partner_id_created_at" }, + { fields: ["partner_name", "created_at"], name: "idx_api_client_events_partner_name_created_at" }, + { fields: ["operation", "created_at"], name: "idx_api_client_events_operation_created_at" }, + { fields: ["status", "created_at"], name: "idx_api_client_events_status_created_at" }, + { fields: ["error_type", "created_at"], name: "idx_api_client_events_error_type_created_at" }, + { fields: ["api_key_prefix", "created_at"], name: "idx_api_client_events_api_key_prefix_created_at" }, + { fields: ["request_id"], name: "idx_api_client_events_request_id" }, + { fields: ["quote_id"], name: "idx_api_client_events_quote_id" }, + { fields: ["ramp_id"], name: "idx_api_client_events_ramp_id" } + ], + modelName: "ApiClientEvent", + sequelize, + tableName: "api_client_events", + timestamps: true + } +); + +export default ApiClientEvent; diff --git a/apps/api/src/models/index.ts b/apps/api/src/models/index.ts index 6cbc45d87..847719dc8 100644 --- a/apps/api/src/models/index.ts +++ b/apps/api/src/models/index.ts @@ -1,10 +1,13 @@ import sequelize from "../config/database"; import AlfredPayCustomer from "./alfredPayCustomer.model"; import Anchor from "./anchor.model"; +import ApiClientEvent from "./apiClientEvent.model"; import ApiKey from "./apiKey.model"; import KycLevel2 from "./kycLevel2.model"; import MaintenanceSchedule from "./maintenanceSchedule.model"; +import MykoboCustomer from "./mykoboCustomer.model"; import Partner from "./partner.model"; +import ProfilePartnerAssignment from "./profilePartnerAssignment.model"; import QuoteTicket from "./quoteTicket.model"; import RampState from "./rampState.model"; import Subsidy from "./subsidy.model"; @@ -17,6 +20,8 @@ RampState.belongsTo(QuoteTicket, { as: "quote", foreignKey: "quoteId" }); QuoteTicket.hasOne(RampState, { as: "rampState", foreignKey: "quoteId" }); QuoteTicket.belongsTo(Partner, { as: "partner", foreignKey: "partnerId" }); Partner.hasMany(QuoteTicket, { as: "quotes", foreignKey: "partnerId" }); +QuoteTicket.belongsTo(Partner, { as: "pricingPartner", foreignKey: "pricingPartnerId" }); +Partner.hasMany(QuoteTicket, { as: "pricedQuotes", foreignKey: "pricingPartnerId" }); RampState.hasMany(Subsidy, { as: "subsidies", foreignKey: "rampId" }); Subsidy.belongsTo(RampState, { as: "rampState", foreignKey: "rampId" }); @@ -36,14 +41,27 @@ TaxId.belongsTo(User, { as: "user", foreignKey: "userId" }); User.hasMany(AlfredPayCustomer, { as: "alfredPayCustomers", foreignKey: "userId" }); AlfredPayCustomer.belongsTo(User, { as: "user", foreignKey: "userId" }); +User.hasOne(MykoboCustomer, { as: "mykoboCustomer", foreignKey: "userId" }); +MykoboCustomer.belongsTo(User, { as: "user", foreignKey: "userId" }); + +User.hasMany(ProfilePartnerAssignment, { as: "partnerAssignments", foreignKey: "userId" }); +ProfilePartnerAssignment.belongsTo(User, { as: "user", foreignKey: "userId" }); +ProfilePartnerAssignment.belongsTo(Partner, { as: "buyPartner", foreignKey: "buyPartnerId" }); +ProfilePartnerAssignment.belongsTo(Partner, { as: "sellPartner", foreignKey: "sellPartnerId" }); +Partner.hasMany(ProfilePartnerAssignment, { as: "buyProfileAssignments", foreignKey: "buyPartnerId" }); +Partner.hasMany(ProfilePartnerAssignment, { as: "sellProfileAssignments", foreignKey: "sellPartnerId" }); + // Initialize models const models = { AlfredPayCustomer, Anchor, + ApiClientEvent, ApiKey, KycLevel2, MaintenanceSchedule, + MykoboCustomer, Partner, + ProfilePartnerAssignment, QuoteTicket, RampState, Subsidy, diff --git a/apps/api/src/models/mykoboCustomer.model.ts b/apps/api/src/models/mykoboCustomer.model.ts new file mode 100644 index 000000000..55aee45fc --- /dev/null +++ b/apps/api/src/models/mykoboCustomer.model.ts @@ -0,0 +1,117 @@ +import { MykoboCustomerStatus, MykoboCustomerType } from "@vortexfi/shared"; +import { DataTypes, Model, Optional } from "sequelize"; +import sequelize from "../config/database"; + +export interface MykoboCustomerAttributes { + id: string; + userId: string; + email: string; + status: MykoboCustomerStatus; + statusExternal: string | null; + lastFailureReasons: string[] | null; + type: MykoboCustomerType; + createdAt: Date; + updatedAt: Date; +} + +type MykoboCustomerCreationAttributes = Optional< + MykoboCustomerAttributes, + "id" | "createdAt" | "updatedAt" | "statusExternal" | "lastFailureReasons" | "status" | "type" +>; + +class MykoboCustomer + extends Model + implements MykoboCustomerAttributes +{ + declare id: string; + declare userId: string; + declare email: string; + declare status: MykoboCustomerStatus; + declare statusExternal: string | null; + declare lastFailureReasons: string[] | null; + declare type: MykoboCustomerType; + declare createdAt: Date; + declare updatedAt: Date; +} + +MykoboCustomer.init( + { + createdAt: { + allowNull: false, + defaultValue: DataTypes.NOW, + field: "created_at", + type: DataTypes.DATE + }, + email: { + allowNull: false, + type: DataTypes.STRING, + unique: true + }, + id: { + allowNull: false, + defaultValue: DataTypes.UUIDV4, + primaryKey: true, + type: DataTypes.UUID + }, + lastFailureReasons: { + allowNull: true, + defaultValue: [], + field: "last_failure_reasons", + type: DataTypes.ARRAY(DataTypes.STRING) + }, + status: { + allowNull: false, + defaultValue: MykoboCustomerStatus.CONSULTED, + type: DataTypes.ENUM(...Object.values(MykoboCustomerStatus)) + }, + statusExternal: { + allowNull: true, + comment: "Mykobo's raw kyc_status.review_status", + field: "status_external", + type: DataTypes.STRING + }, + type: { + allowNull: false, + defaultValue: MykoboCustomerType.INDIVIDUAL, + type: DataTypes.ENUM(...Object.values(MykoboCustomerType)) + }, + updatedAt: { + allowNull: false, + defaultValue: DataTypes.NOW, + field: "updated_at", + type: DataTypes.DATE + }, + userId: { + allowNull: false, + field: "user_id", + onDelete: "CASCADE", + onUpdate: "CASCADE", + references: { + key: "id", + model: "profiles" + }, + type: DataTypes.UUID, + unique: true + } + }, + { + indexes: [ + { + fields: ["user_id"], + name: "idx_mykobo_customers_user_id", + unique: true + }, + { + fields: ["email"], + name: "idx_mykobo_customers_email", + unique: true + } + ], + modelName: "MykoboCustomer", + sequelize, + tableName: "mykobo_customers", + timestamps: true + } +); + +export default MykoboCustomer; diff --git a/apps/api/src/models/profilePartnerAssignment.model.ts b/apps/api/src/models/profilePartnerAssignment.model.ts new file mode 100644 index 000000000..e8ae91799 --- /dev/null +++ b/apps/api/src/models/profilePartnerAssignment.model.ts @@ -0,0 +1,143 @@ +import { DataTypes, Model, Optional } from "sequelize"; +import sequelize from "../config/database"; + +export interface ProfilePartnerAssignmentAttributes { + id: string; + userId: string; + partnerName: string; + buyPartnerId: string | null; + sellPartnerId: string | null; + isActive: boolean; + expiresAt: Date | null; + createdAt: Date; + updatedAt: Date; +} + +type ProfilePartnerAssignmentCreationAttributes = Optional< + ProfilePartnerAssignmentAttributes, + "id" | "createdAt" | "updatedAt" | "isActive" | "expiresAt" +>; + +class ProfilePartnerAssignment + extends Model + implements ProfilePartnerAssignmentAttributes +{ + declare id: string; + + declare userId: string; + + declare partnerName: string; + + declare buyPartnerId: string | null; + + declare sellPartnerId: string | null; + + declare isActive: boolean; + + declare expiresAt: Date | null; + + declare createdAt: Date; + + declare updatedAt: Date; +} + +ProfilePartnerAssignment.init( + { + buyPartnerId: { + allowNull: true, + field: "buy_partner_id", + onDelete: "SET NULL", + onUpdate: "CASCADE", + references: { + key: "id", + model: "partners" + }, + type: DataTypes.UUID + }, + createdAt: { + allowNull: false, + defaultValue: DataTypes.NOW, + field: "created_at", + type: DataTypes.DATE + }, + expiresAt: { + allowNull: true, + field: "expires_at", + type: DataTypes.DATE + }, + id: { + defaultValue: DataTypes.UUIDV4, + primaryKey: true, + type: DataTypes.UUID + }, + isActive: { + allowNull: false, + defaultValue: true, + field: "is_active", + type: DataTypes.BOOLEAN + }, + partnerName: { + allowNull: false, + field: "partner_name", + type: DataTypes.STRING(100) + }, + sellPartnerId: { + allowNull: true, + field: "sell_partner_id", + onDelete: "SET NULL", + onUpdate: "CASCADE", + references: { + key: "id", + model: "partners" + }, + type: DataTypes.UUID + }, + updatedAt: { + allowNull: false, + defaultValue: DataTypes.NOW, + field: "updated_at", + type: DataTypes.DATE + }, + userId: { + allowNull: false, + field: "user_id", + onDelete: "CASCADE", + onUpdate: "CASCADE", + references: { + key: "id", + model: "profiles" + }, + type: DataTypes.UUID + } + }, + { + indexes: [ + { + fields: ["user_id"], + name: "idx_profile_partner_assignments_user_id" + }, + { + fields: ["partner_name"], + name: "idx_profile_partner_assignments_partner_name" + }, + { + fields: ["buy_partner_id"], + name: "idx_profile_partner_assignments_buy_partner" + }, + { + fields: ["sell_partner_id"], + name: "idx_profile_partner_assignments_sell_partner" + }, + { + fields: ["user_id", "is_active", "expires_at"], + name: "idx_profile_partner_assignments_active_lookup" + } + ], + modelName: "ProfilePartnerAssignment", + sequelize, + tableName: "profile_partner_assignments", + timestamps: true + } +); + +export default ProfilePartnerAssignment; diff --git a/apps/api/src/models/quoteTicket.model.ts b/apps/api/src/models/quoteTicket.model.ts index 4d3bbb9d8..a6a81a960 100644 --- a/apps/api/src/models/quoteTicket.model.ts +++ b/apps/api/src/models/quoteTicket.model.ts @@ -2,6 +2,7 @@ import { DestinationType, Networks, PaymentMethod, RampCurrency, RampDirection } import { DataTypes, Model, Optional } from "sequelize"; import { QuoteTicketMetadata } from "../api/services/quote/core/types"; import sequelize from "../config/database"; +import { FlowVariant } from "../config/vars"; // Define the attributes of the QuoteTicket model export interface QuoteTicketAttributes { @@ -15,6 +16,7 @@ export interface QuoteTicketAttributes { outputAmount: string; outputCurrency: RampCurrency; partnerId: string | null; + pricingPartnerId: string | null; apiKey: string | null; expiresAt: Date; status: "pending" | "consumed" | "expired"; @@ -22,6 +24,7 @@ export interface QuoteTicketAttributes { paymentMethod: PaymentMethod; countryCode: string | null; network: Networks; + flowVariant: FlowVariant; createdAt: Date; updatedAt: Date; } @@ -51,6 +54,8 @@ class QuoteTicket extends Model declare postCompleteState: PostCompleteState; + declare flowVariant: FlowVariant; + declare createdAt: Date; declare updatedAt: Date; @@ -118,6 +122,11 @@ RampState.init( field: "error_logs", type: DataTypes.JSONB }, + flowVariant: { + allowNull: false, + field: "flow_variant", + type: DataTypes.STRING(16) + }, from: { allowNull: false, type: DataTypes.STRING(20) @@ -229,6 +238,10 @@ RampState.init( fields: ["quoteId"], name: "uq_ramp_states_quote_id", unique: true + }, + { + fields: ["flow_variant"], + name: "idx_ramp_states_flow_variant" } ], modelName: "RampState", diff --git a/apps/frontend/package.json b/apps/frontend/package.json index 6b3930466..3711431ac 100644 --- a/apps/frontend/package.json +++ b/apps/frontend/package.json @@ -3,7 +3,6 @@ "@fontsource/roboto": "^5.0.8", "@heroicons/react": "^2.1.3", "@hookform/resolvers": "^4.1.3", - "@monerium/sdk": "^3.4.2", "@pendulum-chain/api": "catalog:", "@pendulum-chain/api-solang": "catalog:", "@polkadot/api": "catalog:", @@ -43,7 +42,6 @@ "@walletconnect/universal-provider": "^2.21.10", "@walletconnect/utils": "catalog:", "@xstate/react": "^6.0.0", - "big.js": "catalog:", "bn.js": "^5.2.1", "buffer": "^6.0.3", @@ -56,8 +54,8 @@ "lottie-react": "^2.4.1", "lucide-react": "^0.562.0", "motion": "^12.0.3", - "numora": "^3.0.2", - "numora-react": "3.0.3", + "numora": "^4.0.0", + "numora-react": "^4.0.0", "qrcode.react": "^4.2.0", "radix-ui": "^1.4.3", "react": "=19.2.0", @@ -68,6 +66,7 @@ "stellar-sdk": "catalog:", "tailwind-merge": "^3.4.0", "tailwindcss": "^4.0.3", + "torph": "^0.0.9", "viem": "catalog:", "wagmi": "catalog:", "web3": "^4.16.0", diff --git a/apps/frontend/src/components/Alfredpay/AlfredpayKycFlow.tsx b/apps/frontend/src/components/Alfredpay/AlfredpayKycFlow.tsx index 8cf853765..683b5a034 100644 --- a/apps/frontend/src/components/Alfredpay/AlfredpayKycFlow.tsx +++ b/apps/frontend/src/components/Alfredpay/AlfredpayKycFlow.tsx @@ -1,8 +1,9 @@ import { useCallback } from "react"; import { useAlfredpayKycActor, useAlfredpayKycSelector } from "../../contexts/rampState"; +import { DoneScreen } from "../DoneScreen"; +import { ArKycFormScreen } from "./ArKycFormScreen"; import { ColKycFormScreen } from "./ColKycFormScreen"; import { CustomerDefinitionScreen } from "./CustomerDefinitionScreen"; -import { DoneScreen } from "./DoneScreen"; import { FailureKycScreen } from "./FailureKycScreen"; import { FailureScreen } from "./FailureScreen"; import { FillingScreen } from "./FillingScreen"; @@ -30,7 +31,7 @@ export const AlfredpayKycFlow = () => { const retryProcess = useCallback(() => actor?.send({ type: "RETRY_PROCESS" }), [actor]); const cancelProcess = useCallback(() => actor?.send({ type: "CANCEL_PROCESS" }), [actor]); const submitForm = useCallback( - (data: import("../../machines/alfredpayKyc.machine").MxnKycFormData) => actor?.send({ data, type: "SUBMIT_FORM" }), + (data: import("../../machines/alfredpayKyc.machine").AlfredpayKycFormData) => actor?.send({ data, type: "SUBMIT_FORM" }), [actor] ); const submitFiles = useCallback( @@ -59,6 +60,7 @@ export const AlfredpayKycFlow = () => { const kycOrKyb = context.business ? "KYB" : "KYC"; const isMxn = context.country === "MX"; const isCo = context.country === "CO"; + const isAr = context.country === "AR"; if ( stateValue === "CheckingStatus" || @@ -86,8 +88,21 @@ export const AlfredpayKycFlow = () => { return ; } - if (stateValue === "UploadingDocuments" && (isMxn || isCo)) { - return ; + if (stateValue === "FillingKycForm" && isAr) { + return ; + } + + if (stateValue === "UploadingDocuments" && (isMxn || isCo || isAr)) { + const includeSelfie = isAr; + const i18nNamespace = isAr ? "components.arDocumentUpload" : undefined; + return ( + + ); } if (stateValue === "FillingKybForm") { diff --git a/apps/frontend/src/components/Alfredpay/ArKycFormScreen.tsx b/apps/frontend/src/components/Alfredpay/ArKycFormScreen.tsx new file mode 100644 index 000000000..bdda7d3d6 --- /dev/null +++ b/apps/frontend/src/components/Alfredpay/ArKycFormScreen.tsx @@ -0,0 +1,184 @@ +import { AlfredpayArgentinaDocumentType } from "@vortexfi/shared"; +import type { UseFormReturn } from "react-hook-form"; +import { useTranslation } from "react-i18next"; +import { z } from "zod"; +import type { AlfredpayKycFormData } from "../../machines/alfredpayKyc.machine"; +import { type KycFormConfig, KycFormScreen, kycInputClass } from "./KycFormScreen"; + +const schema = z + .object({ + address: z.string().min(1), + city: z.string().min(1), + countryCode: z.literal("AR"), + cuit: z.string().optional(), + dateOfBirth: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, "Use YYYY-MM-DD format"), + dni: z.string().min(1), + email: z.string().email(), + firstName: z.string().min(1), + lastName: z.string().min(1), + nationalities: z.array(z.string().regex(/^[A-Z]{2}$/)).optional(), + pep: z.boolean(), + phoneNumber: z.string().regex(/^\+54\d{7,}$/, "Use Argentina format (+54...)"), + state: z.string().min(1), + typeDocumentAr: z.nativeEnum(AlfredpayArgentinaDocumentType), + zipCode: z.string().min(1) + }) + .superRefine((data, ctx) => { + if (data.cuit && !/^\d{11}$/.test(data.cuit)) { + ctx.addIssue({ code: z.ZodIssueCode.custom, message: "CUIT must be exactly 11 digits", path: ["cuit"] }); + } + }); + +type ArKycFormValues = z.infer; +type ArForm = UseFormReturn; + +function DocumentTypeField({ form }: { form: ArForm }) { + const { t } = useTranslation(); + const error = form.formState.errors.typeDocumentAr; + return ( + + ); +} + +function DniField({ form }: { form: ArForm }) { + const { t } = useTranslation(); + const documentType = form.watch("typeDocumentAr"); + const error = form.formState.errors.dni; + return ( + + ); +} + +function PhoneNumberField({ form }: { form: ArForm }) { + const error = form.formState.errors.phoneNumber; + return ( +
+ + { + event.currentTarget.value = event.currentTarget.value.replace(/\D/g, ""); + }} + pattern="[0-9]*" + placeholder="5491112345678" + type="tel" + {...form.register("phoneNumber", { + setValueAs: (value: string) => { + if (!value) return value; + const digits = value.replace(/\D/g, ""); + return digits.startsWith("54") ? `+${digits}` : `+54${digits}`; + } + })} + /> +
+ ); +} + +const config: KycFormConfig = { + defaultValues: { + countryCode: "AR", + cuit: "", + nationalities: ["AR"], + pep: false, + typeDocumentAr: AlfredpayArgentinaDocumentType.DNI + }, + fields: [ + { + fields: [ + { autoComplete: "given-name", labelKey: "components.mxnKycForm.firstName", name: "firstName", type: "text" }, + { autoComplete: "family-name", labelKey: "components.mxnKycForm.lastName", name: "lastName", type: "text" } + ], + type: "group" + }, + { + inputType: "date", + labelKey: "components.mxnKycForm.dateOfBirth", + name: "dateOfBirth", + placeholder: "YYYY-MM-DD", + type: "text" + }, + { + autoComplete: "email", + inputMode: "email", + inputType: "email", + labelKey: "components.mxnKycForm.email", + name: "email", + type: "text" + }, + { + labelKey: "components.arKycForm.phoneNumber", + name: "phoneNumber", + render: form => , + type: "custom" + }, + { + labelKey: "components.arKycForm.documentType", + name: "typeDocumentAr", + render: form => , + type: "custom" + }, + { + labelKey: "components.arKycForm.dni", + name: "dni", + render: form => , + type: "custom" + }, + { + inputMode: "numeric", + labelKey: "components.arKycForm.cuit", + name: "cuit", + placeholderKey: "components.arKycForm.cuitPlaceholder", + type: "text" + }, + { + autoComplete: "street-address", + labelKey: "components.mxnKycForm.address", + name: "address", + type: "text" + }, + { + fields: [ + { autoComplete: "address-level2", labelKey: "components.mxnKycForm.city", name: "city", type: "text" }, + { autoComplete: "address-level1", labelKey: "components.mxnKycForm.state", name: "state", type: "text" } + ], + type: "group" + }, + { + autoComplete: "postal-code", + inputMode: "numeric", + labelKey: "components.mxnKycForm.zipCode", + name: "zipCode", + type: "text" + }, + { labelKey: "components.arKycForm.pepLabel", name: "pep", type: "checkbox" } + ], + i18nNamespace: "components.arKycForm", + idPrefix: "ar", + schema +}; + +interface ArKycFormScreenProps { + onSubmit: (data: AlfredpayKycFormData) => void; +} + +export function ArKycFormScreen({ onSubmit }: ArKycFormScreenProps) { + return void} />; +} diff --git a/apps/frontend/src/components/Alfredpay/ColKycFormScreen.tsx b/apps/frontend/src/components/Alfredpay/ColKycFormScreen.tsx index 1334c4de1..6bc95a092 100644 --- a/apps/frontend/src/components/Alfredpay/ColKycFormScreen.tsx +++ b/apps/frontend/src/components/Alfredpay/ColKycFormScreen.tsx @@ -1,10 +1,10 @@ -import { zodResolver } from "@hookform/resolvers/zod"; import { AlfredpayColombiaDocumentType } from "@vortexfi/shared"; -import { Controller, useForm } from "react-hook-form"; +import { Controller, type UseFormReturn } from "react-hook-form"; import { useTranslation } from "react-i18next"; import { z } from "zod"; -import { MenuButtons } from "../MenuButtons"; +import type { AlfredpayKycFormData } from "../../machines/alfredpayKyc.machine"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../ui/select"; +import { type KycFormConfig, KycFormScreen, kycInputClass } from "./KycFormScreen"; const schema = z .object({ @@ -26,203 +26,134 @@ const schema = z }); type ColKycFormValues = z.infer; +type ColForm = UseFormReturn; -interface ColKycFormScreenProps { - onSubmit: (data: ColKycFormValues) => void; +function DocumentTypeField({ form }: { form: ColForm }) { + const { t } = useTranslation(); + const error = form.formState.errors.typeDocumentCol; + return ( + ( + + )} + /> + ); } -export function ColKycFormScreen({ onSubmit }: ColKycFormScreenProps) { +function DniField({ form }: { form: ColForm }) { const { t } = useTranslation(); - - const { - control, - formState: { errors }, - handleSubmit, - register, - watch - } = useForm({ resolver: zodResolver(schema) }); - - const documentType = watch("typeDocumentCol"); - - const inputClass = (hasError: boolean) => - `input-vortex-primary input-ghost w-full rounded-lg border p-2 text-base ${hasError ? "border-error" : "border-neutral-300"}`; - + const documentType = form.watch("typeDocumentCol"); + const error = form.formState.errors.dni; return ( -
- -

{t("components.colKycForm.title")}

-

{t("components.colKycForm.subtitle")}

- -
-
-
- - - {errors.firstName && {errors.firstName.message}} -
- -
- - - {errors.lastName && {errors.lastName.message}} -
-
- -
- - - {errors.dateOfBirth && {errors.dateOfBirth.message}} -
- -
- - ( - - )} - /> - {errors.typeDocumentCol && {errors.typeDocumentCol.message}} -
- -
- - - {errors.dni && {errors.dni.message}} -
- -
- -
- + - (v ? `+${v.replace(/^\+/, "").replace(/\D/g, "")}` : v) - })} - /> -
- {errors.phoneNumber && {errors.phoneNumber.message}} -
- -
- - - {errors.address && {errors.address.message}} -
+ + ); +} -
-
- - - {errors.city && {errors.city.message}} -
+function PhoneNumberField({ form }: { form: ColForm }) { + const error = form.formState.errors.phoneNumber; + return ( +
+ + + (v ? `+${v.replace(/^\+/, "").replace(/\D/g, "")}` : v) + })} + /> +
+ ); +} -
- - - {errors.state && {errors.state.message}} -
-
+const config: KycFormConfig = { + fields: [ + { + fields: [ + { autoComplete: "given-name", labelKey: "components.mxnKycForm.firstName", name: "firstName", type: "text" }, + { autoComplete: "family-name", labelKey: "components.mxnKycForm.lastName", name: "lastName", type: "text" } + ], + type: "group" + }, + { + inputType: "date", + labelKey: "components.mxnKycForm.dateOfBirth", + name: "dateOfBirth", + placeholder: "YYYY-MM-DD", + type: "text" + }, + { + labelKey: "components.colKycForm.documentType", + name: "typeDocumentCol", + render: form => , + type: "custom" + }, + { + labelKey: "components.colKycForm.dni", + name: "dni", + render: form => , + type: "custom" + }, + { + labelKey: "components.colKycForm.phoneNumber", + name: "phoneNumber", + render: form => , + type: "custom" + }, + { + autoComplete: "street-address", + labelKey: "components.mxnKycForm.address", + name: "address", + type: "text" + }, + { + fields: [ + { autoComplete: "address-level2", labelKey: "components.mxnKycForm.city", name: "city", type: "text" }, + { autoComplete: "address-level1", labelKey: "components.mxnKycForm.state", name: "state", type: "text" } + ], + type: "group" + }, + { + autoComplete: "postal-code", + inputMode: "numeric", + labelKey: "components.mxnKycForm.zipCode", + name: "zipCode", + type: "text" + } + ], + i18nNamespace: "components.colKycForm", + idPrefix: "col", + schema +}; -
- - - {errors.zipCode && {errors.zipCode.message}} -
+interface ColKycFormScreenProps { + onSubmit: (data: AlfredpayKycFormData) => void; +} - - -
- ); +export function ColKycFormScreen({ onSubmit }: ColKycFormScreenProps) { + return void} />; } diff --git a/apps/frontend/src/components/Alfredpay/KycFormScreen.tsx b/apps/frontend/src/components/Alfredpay/KycFormScreen.tsx new file mode 100644 index 000000000..454c9994d --- /dev/null +++ b/apps/frontend/src/components/Alfredpay/KycFormScreen.tsx @@ -0,0 +1,165 @@ +import { zodResolver } from "@hookform/resolvers/zod"; +import { + type DefaultValues, + type FieldValues, + type Path, + type Resolver, + type SubmitHandler, + type UseFormReturn, + useForm +} from "react-hook-form"; +import { useTranslation } from "react-i18next"; +import type { ZodType } from "zod"; +import { MenuButtons } from "../MenuButtons"; + +/** + * Renders one country-specific Alfredpay KYC form. + * + * Each country (MX, CO, AR) shares the same outer layout — title/subtitle, a vertical + * stack of labelled inputs, and a submit button — but differs in: + * - its Zod schema (validation rules and accepted document types) + * - the exact list and order of fields + * - the namespace under which its i18n strings live + */ + +type KycFormFieldGroup = { + type: "group"; + fields: KycLeafField[]; +}; + +type KycLeafField = KycTextField | KycCheckboxField | KycCustomField; + +interface KycTextField { + type: "text"; + name: Path; + labelKey: string; + placeholderKey?: string; + placeholder?: string; + inputType?: "text" | "email" | "tel" | "date"; + inputMode?: "text" | "email" | "tel" | "numeric"; + autoComplete?: string; +} + +interface KycCheckboxField { + type: "checkbox"; + name: Path; + labelKey: string; +} + +interface KycCustomField { + type: "custom"; + name: Path; + labelKey: string; + render: (form: UseFormReturn) => React.ReactNode; +} + +type KycFormField = KycLeafField | KycFormFieldGroup; + +export interface KycFormConfig { + i18nNamespace: string; + idPrefix: string; + schema: ZodType; + defaultValues?: DefaultValues; + fields: KycFormField[]; +} + +interface KycFormScreenProps { + config: KycFormConfig; + onSubmit: (data: TValues) => void; +} + +const inputClass = (hasError: boolean) => + `input-vortex-primary input-ghost w-full rounded-lg border p-2 text-base ${hasError ? "border-error" : "border-neutral-300"}`; + +export function KycFormScreen({ config, onSubmit }: KycFormScreenProps) { + const { t } = useTranslation(); + + const form = useForm({ + defaultValues: config.defaultValues, + resolver: zodResolver(config.schema) as Resolver + }); + const { + formState: { errors }, + handleSubmit + } = form; + + const renderSingleField = (field: KycLeafField) => { + const id = `${config.idPrefix}-${field.name}`; + const errorMessage = (errors as Record)[field.name as string]?.message; + + if (field.type === "checkbox") { + return ( +
+
+ + +
+ {errorMessage && {errorMessage}} +
+ ); + } + + if (field.type === "custom") { + return ( +
+ + {field.render(form)} + {errorMessage && {errorMessage}} +
+ ); + } + + const placeholder = field.placeholderKey ? t(field.placeholderKey) : field.placeholder; + return ( +
+ + + {errorMessage && {errorMessage}} +
+ ); + }; + + return ( +
+ +

{t(`${config.i18nNamespace}.title`)}

+

{t(`${config.i18nNamespace}.subtitle`)}

+ +
)} + > + {config.fields.map((field, index) => { + if (field.type === "group") { + return ( +
+ {field.fields.map(renderSingleField)} +
+ ); + } + return renderSingleField(field); + })} + + +
+
+ ); +} + +export { inputClass as kycInputClass }; diff --git a/apps/frontend/src/components/Alfredpay/MxnDocumentUploadScreen.tsx b/apps/frontend/src/components/Alfredpay/MxnDocumentUploadScreen.tsx index a16646d10..3f109688b 100644 --- a/apps/frontend/src/components/Alfredpay/MxnDocumentUploadScreen.tsx +++ b/apps/frontend/src/components/Alfredpay/MxnDocumentUploadScreen.tsx @@ -7,10 +7,23 @@ const MAX_FILE_SIZE = 5 * 1024 * 1024; // 5 MB const ACCEPTED_TYPES = ["image/jpeg", "image/png", "application/pdf"]; interface MxnDocumentUploadScreenProps { + error?: string; + i18nNamespace?: string; + includeSelfie?: boolean; onSubmit: (files: MxnKycFiles) => void; } -function FileDropZone({ label, file, onChange }: { label: string; file: File | null; onChange: (file: File) => void }) { +function FileDropZone({ + i18nNamespace, + label, + file, + onChange +}: { + i18nNamespace: string; + label: string; + file: File | null; + onChange: (file: File) => void; +}) { const { t } = useTranslation(); const inputRef = useRef(null); const [error, setError] = useState(null); @@ -18,11 +31,11 @@ function FileDropZone({ label, file, onChange }: { label: string; file: File | n const handleFile = (f: File) => { setError(null); if (!ACCEPTED_TYPES.includes(f.type)) { - setError(t("components.mxnDocumentUpload.invalidType")); + setError(t(`${i18nNamespace}.invalidType`)); return; } if (f.size > MAX_FILE_SIZE) { - setError(t("components.mxnDocumentUpload.fileTooLarge")); + setError(t(`${i18nNamespace}.fileTooLarge`)); return; } onChange(f); @@ -41,7 +54,7 @@ function FileDropZone({ label, file, onChange }: { label: string; file: File | n {file ? ( {file.name} ) : ( - {t("components.mxnDocumentUpload.tapToSelect")} + {t(`${i18nNamespace}.tapToSelect`)} )} (null); const [back, setBack] = useState(null); + const [selfie, setSelfie] = useState(null); - const isValid = front !== null && back !== null; + const isValid = front !== null && back !== null && (!includeSelfie || selfie !== null); const handleSubmit = () => { if (!front || !back) return; - onSubmit({ back, front }); + if (includeSelfie && !selfie) return; + onSubmit({ back, front, selfie: selfie ?? undefined }); }; return (
-

{t("components.mxnDocumentUpload.title")}

-

{t("components.mxnDocumentUpload.subtitle")}

+

{t(`${i18nNamespace}.title`)}

+

{t(`${i18nNamespace}.subtitle`)}

- - + + + {includeSelfie && ( + + )} + +

{t(`${i18nNamespace}.fileHint`)}

-

{t("components.mxnDocumentUpload.fileHint")}

+ {error &&

{error}

}
diff --git a/apps/frontend/src/components/Alfredpay/MxnKycFormScreen.tsx b/apps/frontend/src/components/Alfredpay/MxnKycFormScreen.tsx index dbab1af23..b6b7a58a5 100644 --- a/apps/frontend/src/components/Alfredpay/MxnKycFormScreen.tsx +++ b/apps/frontend/src/components/Alfredpay/MxnKycFormScreen.tsx @@ -1,9 +1,6 @@ -import { zodResolver } from "@hookform/resolvers/zod"; -import { useForm } from "react-hook-form"; -import { useTranslation } from "react-i18next"; import { z } from "zod"; -import type { MxnKycFormData } from "../../machines/alfredpayKyc.machine"; -import { MenuButtons } from "../MenuButtons"; +import type { AlfredpayKycFormData } from "../../machines/alfredpayKyc.machine"; +import { type KycFormConfig, KycFormScreen } from "./KycFormScreen"; const schema = z.object({ address: z.string().min(1), @@ -17,165 +14,63 @@ const schema = z.object({ zipCode: z.string().min(1) }); +type MxnKycFormValues = z.infer; + +const config: KycFormConfig = { + fields: [ + { + fields: [ + { autoComplete: "given-name", labelKey: "components.mxnKycForm.firstName", name: "firstName", type: "text" }, + { autoComplete: "family-name", labelKey: "components.mxnKycForm.lastName", name: "lastName", type: "text" } + ], + type: "group" + }, + { + inputType: "date", + labelKey: "components.mxnKycForm.dateOfBirth", + name: "dateOfBirth", + placeholder: "YYYY-MM-DD", + type: "text" + }, + { + autoComplete: "email", + inputMode: "email", + inputType: "email", + labelKey: "components.mxnKycForm.email", + name: "email", + type: "text" + }, + { labelKey: "components.mxnKycForm.dni", name: "dni", placeholder: "CURP / INE number", type: "text" }, + { + autoComplete: "street-address", + labelKey: "components.mxnKycForm.address", + name: "address", + type: "text" + }, + { + fields: [ + { autoComplete: "address-level2", labelKey: "components.mxnKycForm.city", name: "city", type: "text" }, + { autoComplete: "address-level1", labelKey: "components.mxnKycForm.state", name: "state", type: "text" } + ], + type: "group" + }, + { + autoComplete: "postal-code", + inputMode: "numeric", + labelKey: "components.mxnKycForm.zipCode", + name: "zipCode", + type: "text" + } + ], + i18nNamespace: "components.mxnKycForm", + idPrefix: "mxn", + schema +}; + interface MxnKycFormScreenProps { - onSubmit: (data: MxnKycFormData) => void; + onSubmit: (data: AlfredpayKycFormData) => void; } export function MxnKycFormScreen({ onSubmit }: MxnKycFormScreenProps) { - const { t } = useTranslation(); - - const { - formState: { errors }, - handleSubmit, - register - } = useForm({ resolver: zodResolver(schema) }); - - const inputClass = (hasError: boolean) => - `input-vortex-primary input-ghost w-full rounded-lg border p-2 text-base ${hasError ? "border-error" : "border-neutral-300"}`; - - return ( -
- -

{t("components.mxnKycForm.title")}

-

{t("components.mxnKycForm.subtitle")}

- -
-
-
- - - {errors.firstName && {errors.firstName.message}} -
- -
- - - {errors.lastName && {errors.lastName.message}} -
-
- -
- - - {errors.dateOfBirth && {errors.dateOfBirth.message}} -
- -
- - - {errors.email && {errors.email.message}} -
- -
- - - {errors.dni && {errors.dni.message}} -
- -
- - - {errors.address && {errors.address.message}} -
- -
-
- - - {errors.city && {errors.city.message}} -
- -
- - - {errors.state && {errors.state.message}} -
-
- -
- - - {errors.zipCode && {errors.zipCode.message}} -
- - -
-
- ); + return void} />; } diff --git a/apps/frontend/src/components/AssetNumericInput/index.tsx b/apps/frontend/src/components/AssetNumericInput/index.tsx index deb863609..fe6d6edd6 100644 --- a/apps/frontend/src/components/AssetNumericInput/index.tsx +++ b/apps/frontend/src/components/AssetNumericInput/index.tsx @@ -1,6 +1,5 @@ import { EvmToken, Networks } from "@vortexfi/shared"; import type { ChangeEvent, FC } from "react"; -import type { UseFormRegisterReturn } from "react-hook-form"; import { cn } from "../../helpers/cn"; import { QuoteFormValues } from "../../hooks/quote/schema"; import { AssetButton } from "../buttons/AssetButton"; @@ -23,7 +22,7 @@ interface AssetNumericInputProps { tokenLoading?: boolean; logoURI?: string; fallbackLogoURI?: string; - registerInput: UseFormRegisterReturn; + name: keyof QuoteFormValues; id: string; network?: Networks; } @@ -32,7 +31,7 @@ export const AssetNumericInput: FC = ({ assetIcon, tokenSymbol, onClick, - registerInput, + name, loading, tokenLoading, ...rest @@ -62,7 +61,7 @@ export const AssetNumericInput: FC = ({ additionalStyle={cn("text-right text-lg", rest.readOnly && "text-xl", rest.disabled && "input-disabled opacity-50")} loading={loading} maxDecimals={getMaxDecimalsForToken(tokenSymbol)} - register={registerInput} + name={name} {...rest} /> )} diff --git a/apps/frontend/src/components/Avenia/AveniaKYBForm.tsx b/apps/frontend/src/components/Avenia/AveniaKYBForm.tsx index ed90ea3a4..80536773a 100644 --- a/apps/frontend/src/components/Avenia/AveniaKYBForm.tsx +++ b/apps/frontend/src/components/Avenia/AveniaKYBForm.tsx @@ -15,12 +15,17 @@ export const AveniaKYBForm = () => { initialData: { fullName: aveniaState?.context.kycFormData?.fullName, taxId: aveniaState?.context.taxId - } + }, + // No quote-supplied tax ID means the user types it on this form; KYB is business-only, so require a CNPJ. + requireCnpj: !aveniaState?.context.taxId }); if (!aveniaState) return null; if (!aveniaKycActor) return null; - if (!aveniaState.context.taxId) { + // Quoted flow pre-supplies the CNPJ from the quote; the KYB deep-link flow has no quote, so the CNPJ + // is entered here together with the company name. Render whenever either source applies. + const hasQuoteTaxId = !!aveniaState.context.taxId; + if (!hasQuoteTaxId && !aveniaState.context.kybLink) { return null; } @@ -37,8 +42,8 @@ export const AveniaKYBForm = () => { id: ExtendedAveniaFieldOptions.TAX_ID, index: 1, label: "CNPJ", - placeholder: "", - readOnly: true, + placeholder: "00.000.000/0000-00", + readOnly: hasQuoteTaxId, required: true, type: "text" } diff --git a/apps/frontend/src/components/ContactForm/ContactInfo.tsx b/apps/frontend/src/components/ContactForm/ContactInfo.tsx index 8edefa8f4..143267310 100644 --- a/apps/frontend/src/components/ContactForm/ContactInfo.tsx +++ b/apps/frontend/src/components/ContactForm/ContactInfo.tsx @@ -13,7 +13,7 @@ export function ContactInfo() { -
-

{t("sections.popularTokens.tokens.title")}

-

{t("sections.popularTokens.tokens.description")}

+
+

{t("sections.popularTokens.countries.title")}

+

{t("sections.popularTokens.countries.description")}

+ +
+

{t("sections.popularTokens.cryptocurrencies.title")}

+

+ + +

+

{t("sections.popularTokens.cryptocurrencies.description")}

+
); diff --git a/apps/frontend/src/services/anchor/sep10/challenge.ts b/apps/frontend/src/services/anchor/sep10/challenge.ts deleted file mode 100644 index bf09a6713..000000000 --- a/apps/frontend/src/services/anchor/sep10/challenge.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Memo, MemoType, Networks, Operation, Transaction } from "stellar-sdk"; -import { config } from "../../../config"; - -interface Sep10Challenge { - transaction: string; - network_passphrase: string; -} - -const EXPECTED_NETWORK_PASSPHRASE = config.isSandbox ? Networks.TESTNET : Networks.PUBLIC; - -async function validateChallenge( - transaction: Transaction, Operation[]>, - signingKey: string, - networkPassphrase: string -): Promise { - if (transaction.source !== signingKey) { - throw new Error(`sep10: Invalid source account: ${transaction.source}`); - } - if (transaction.sequence !== "0") { - throw new Error(`sep10: Invalid sequence number: ${transaction.sequence}`); - } - if (networkPassphrase !== EXPECTED_NETWORK_PASSPHRASE) { - throw new Error(`sep10: Invalid network passphrase: ${networkPassphrase}`); - } -} - -export async function fetchAndValidateChallenge( - webAuthEndpoint: string, - urlParams: URLSearchParams, - signingKey: string -): Promise, Operation[]>> { - const challenge = await fetch(`${webAuthEndpoint}?${urlParams.toString()}`); - if (challenge.status !== 200) { - throw new Error(`sep10: Failed to fetch SEP-10 challenge: ${challenge.statusText}`); - } - - const { transaction, network_passphrase } = (await challenge.json()) as Sep10Challenge; - const transactionSigned = new Transaction(transaction, EXPECTED_NETWORK_PASSPHRASE); - await validateChallenge(transactionSigned, signingKey, network_passphrase); - - return transactionSigned; -} diff --git a/apps/frontend/src/services/anchor/sep10/index.ts b/apps/frontend/src/services/anchor/sep10/index.ts deleted file mode 100644 index 0eb00871d..000000000 --- a/apps/frontend/src/services/anchor/sep10/index.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { FiatToken, getTokenDetailsSpacewalk } from "@vortexfi/shared"; -import { Keypair, Memo, MemoType, Operation, Transaction } from "stellar-sdk"; -import { TomlValues } from "../../../types/sep"; - -import { fetchAndValidateChallenge } from "./challenge"; -import { exists, fetchSep10Signatures, getUrlParams } from "./utils"; - -interface Sep10Response { - token: string; - sep10Account: string; -} - -interface Sep10JwtResponse { - token: string; -} - -async function submitSignedTransaction( - webAuthEndpoint: string, - transaction: Transaction, Operation[]> -): Promise { - const jwt = await fetch(webAuthEndpoint, { - body: JSON.stringify({ transaction: transaction.toXDR().toString() }), - headers: { "Content-Type": "application/json" }, - method: "POST" - }); - - if (jwt.status !== 200) { - throw new Error(`Failed to submit SEP-10 response: ${jwt.statusText}`); - } - - const { token } = (await jwt.json()) as Sep10JwtResponse; - return token; -} - -export async function sep10( - tomlValues: TomlValues, - stellarEphemeralSecret: string, - outputToken: FiatToken, - address: string -): Promise { - const { signingKey, webAuthEndpoint } = tomlValues; - - if (!exists(signingKey) || !exists(webAuthEndpoint)) { - throw new Error("sep10: Missing values in TOML file"); - } - - const ephemeralKeys = Keypair.fromSecret(stellarEphemeralSecret); - const accountId = ephemeralKeys.publicKey(); - const { usesMemo, supportsClientDomain } = getTokenDetailsSpacewalk(outputToken); - - const { urlParams, sep10Account } = await getUrlParams(accountId, usesMemo, supportsClientDomain, address); - const transactionSigned = await fetchAndValidateChallenge(webAuthEndpoint, urlParams, signingKey); - - const { masterClientSignature, clientSignature, clientPublic } = await fetchSep10Signatures({ - address: address, - challengeXDR: transactionSigned.toXDR(), - clientPublicKey: sep10Account, - outToken: outputToken, - usesMemo - }); - - if (supportsClientDomain) { - transactionSigned.addSignature(clientPublic, clientSignature); - } - - if (!usesMemo) { - transactionSigned.sign(ephemeralKeys); - } else { - transactionSigned.addSignature(sep10Account, masterClientSignature); - } - - const token = await submitSignedTransaction(webAuthEndpoint, transactionSigned); - return { sep10Account, token }; -} diff --git a/apps/frontend/src/services/anchor/sep10/utils.ts b/apps/frontend/src/services/anchor/sep10/utils.ts deleted file mode 100644 index 21b6b0c57..000000000 --- a/apps/frontend/src/services/anchor/sep10/utils.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { Keyring } from "@polkadot/api"; -import { EvmAddress } from "@vortexfi/shared"; -import { keccak256 } from "viem/utils"; -import { config } from "../../../config"; -import { SIGNING_SERVICE_URL } from "../../../constants/constants"; -import { fetchSep10Signatures as fetchSignatures, SignerServiceSep10Request } from "../../signingService"; - -// Returns the hash value for the address. -// If it's a polkadot address, it will return raw data of the address. -function getHashValueForAddress(address: string) { - if (address.startsWith("0x")) { - return address as EvmAddress; - } else { - const keyring = new Keyring({ type: "sr25519" }); - return keyring.decodeAddress(address); - } -} - -// A memo derivation. -async function deriveMemoFromAddress(address: string) { - const hashValue = getHashValueForAddress(address); - const hash = keccak256(hashValue); - return BigInt(hash).toString().slice(0, 15); -} - -export const exists = (value?: string | null): value is string => !!value && value?.length > 0; - -export async function fetchSep10Signatures(args: SignerServiceSep10Request) { - try { - return await fetchSignatures(args); - } catch (_error: unknown) { - throw new Error("Could not fetch sep 10 signatures from backend"); - } -} - -// Return the URLSearchParams and the account (master/omnibus or ephemeral) that was used for SEP-10 -export async function getUrlParams( - ephemeralAccount: string, - usesMemo: boolean, - supportsClientDomain: boolean, - address: string -): Promise<{ urlParams: URLSearchParams; sep10Account: string }> { - let sep10Account: string; - const params = new URLSearchParams(); - - if (usesMemo) { - const response = await fetch(`${SIGNING_SERVICE_URL}/v1/stellar/sep10`); - if (!response.ok) { - throw new Error("Failed to fetch client master SEP-10 public account."); - } - - const { masterSep10Public } = await response.json(); - if (!masterSep10Public) { - throw new Error("masterSep10Public not found in response."); - } - - sep10Account = masterSep10Public; - params.append("account", sep10Account); - params.append("memo", await deriveMemoFromAddress(address)); - } else { - sep10Account = ephemeralAccount; - params.append("account", sep10Account); - } - - if (supportsClientDomain) { - params.append("client_domain", config.applicationClientDomain); - } - - return { sep10Account, urlParams: params }; -} diff --git a/apps/frontend/src/services/anchor/sep24/first.ts b/apps/frontend/src/services/anchor/sep24/first.ts deleted file mode 100644 index b95b79c36..000000000 --- a/apps/frontend/src/services/anchor/sep24/first.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { FiatToken, getTokenDetailsSpacewalk } from "@vortexfi/shared"; -import { config } from "../../../config"; -import { IAnchorSessionParams, ISep24Intermediate } from "../../../types/sep"; - -export async function sep24First( - sessionParams: IAnchorSessionParams, - ANCLAP_sep10Account: string, - outputToken: FiatToken -): Promise { - if (config.test.mockSep24) { - return { id: "1234", url: "https://www.example.com" }; - } - - const { token, tomlValues, offrampAmount } = sessionParams; - const { sep24Url } = tomlValues; - const { usesMemo } = getTokenDetailsSpacewalk(outputToken); - const assetCode = sessionParams.tokenConfig.stellarAsset.code.string; - - const params = { - amount: offrampAmount, - asset_code: assetCode, - ...(usesMemo && { account: ANCLAP_sep10Account }) - }; - - const response = await fetch(`${sep24Url}/transactions/withdraw/interactive`, { - body: JSON.stringify(params), - headers: { - Authorization: `Bearer ${token}`, - "Content-Type": "application/json" - }, - method: "POST" - }); - - if (response.status !== 200) { - console.log(await response.json(), params.toString()); - throw new Error(`Failed to initiate SEP-24: ${response.statusText}`); - } - - const { type, url, id } = await response.json(); - if (type !== "interactive_customer_info_needed") { - throw new Error(`Unexpected SEP-24 type: ${type}`); - } - - return { id, url }; -} diff --git a/apps/frontend/src/services/anchor/sep24/second.ts b/apps/frontend/src/services/anchor/sep24/second.ts deleted file mode 100644 index 076cc7ec3..000000000 --- a/apps/frontend/src/services/anchor/sep24/second.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { config } from "../../../config"; -import { IAnchorSessionParams, ISep24Intermediate, SepResult } from "../../../types/sep"; - -interface Sep24TransactionStatus { - status: string; - amount_in: string; - withdraw_memo: string; - withdraw_memo_type: string; - withdraw_anchor_account: string; -} - -const POLLING_INTERVAL = 1000; - -async function fetchTransactionStatus(id: string, token: string, sep24Url: string): Promise { - const idParam = new URLSearchParams({ id }); - const statusResponse = await fetch(`${sep24Url}/transaction?${idParam.toString()}`, { - headers: { Authorization: `Bearer ${token}` } - }); - - if (statusResponse.status !== 200) { - throw new Error(`Failed to fetch SEP-24 status: ${statusResponse.statusText}`); - } - - const { transaction } = await statusResponse.json(); - return transaction; -} - -async function pollTransactionStatus(id: string, sessionParams: IAnchorSessionParams): Promise { - const { token, tomlValues } = sessionParams; - let status: Sep24TransactionStatus; - - if (!tomlValues.sep24Url) { - throw new Error("Missing SEP-24 URL in TOML values"); - } - - do { - console.log(`Polling SEP-24 transaction status for ID: ${id}`); - await new Promise(resolve => setTimeout(resolve, POLLING_INTERVAL)); - status = await fetchTransactionStatus(id, token, tomlValues.sep24Url); - } while (status.status !== "pending_user_transfer_start"); - - return status; -} - -export async function sep24Second(sep24Values: ISep24Intermediate, sessionParams: IAnchorSessionParams): Promise { - if (config.test.mockSep24) { - await new Promise(resolve => setTimeout(resolve, 10000)); - return { - amount: sessionParams.offrampAmount, - memo: "MYK1722323689", - memoType: "text", - offrampingAccount: "GBKGDLVV53YX36A32TGOGUJJPVFLL2FXBIALATAOYSQBNKLRDSNDEP3Y" - }; - } - - const status = await pollTransactionStatus(sep24Values.id, sessionParams); - - return { - amount: status.amount_in, - memo: status.withdraw_memo, - memoType: status.withdraw_memo_type, - offrampingAccount: status.withdraw_anchor_account - }; -} diff --git a/apps/frontend/src/services/api/api-client.ts b/apps/frontend/src/services/api/api-client.ts index 94c94de9b..66f9c66a1 100644 --- a/apps/frontend/src/services/api/api-client.ts +++ b/apps/frontend/src/services/api/api-client.ts @@ -51,7 +51,9 @@ async function apiFetch( if (!response.ok) { const errorData = (await response.json().catch(() => ({}))) as { error?: string; message?: string }; console.error("API Error:", errorData); - throw new ApiError(response.status, errorData, errorData.error ?? errorData.message ?? response.statusText); + const serverMessage = errorData.error ?? errorData.message ?? response.statusText; + // Prefix with method/status/path so Sentry groups by endpoint instead of one generic bucket. + throw new ApiError(response.status, errorData, `${method.toUpperCase()} ${path} (${response.status}): ${serverMessage}`); } if (response.status === 204) return undefined as T; diff --git a/apps/frontend/src/services/api/index.ts b/apps/frontend/src/services/api/index.ts index 69fd9c7a5..19779258f 100644 --- a/apps/frontend/src/services/api/index.ts +++ b/apps/frontend/src/services/api/index.ts @@ -10,6 +10,5 @@ export * from "./quote.service"; export * from "./ramp.service"; export * from "./rating.service"; export * from "./siwe.service"; -export * from "./stellar.service"; export * from "./storage.service"; export * from "./subsidize.service"; diff --git a/apps/frontend/src/services/api/monerium.service.ts b/apps/frontend/src/services/api/monerium.service.ts deleted file mode 100644 index fcd922c6c..000000000 --- a/apps/frontend/src/services/api/monerium.service.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { MONERIUM_MINT_NETWORK } from "../monerium/moneriumAuth"; -import { apiClient, isApiError } from "./api-client"; - -export interface MoneriumUserStatus { - isNewUser: boolean; -} - -export const MoneriumService = { - async checkUserStatus(address: string): Promise { - try { - console.log("Checking Monerium user status for address:", address); - await apiClient.get("/monerium/address-exists", { - params: { address, network: MONERIUM_MINT_NETWORK } - }); - return { isNewUser: false }; - } catch (error: unknown) { - if (isApiError(error)) { - if (error.status === 404) { - console.log("Monerium user not found"); - return { isNewUser: true }; - } - throw new Error(`Error checking Monerium user status: ${error.message}`); - } - throw new Error(`An unexpected error occurred: ${error}`); - } - }, - - async createRampMessage(amount: string, iban: string): Promise { - const date = new Date(Date.now() + 1000 * 60 * 10).toISOString(); - return `Send EUR ${amount} to ${iban} at ${date}`; - }, - - async validateAuthTokens(authCode: string, codeVerifier: string): Promise { - try { - const data = await apiClient.post<{ valid: boolean }>("/monerium/validate-auth", { authCode, codeVerifier }); - return data.valid; - } catch (error) { - console.error("Error validating Monerium auth tokens:", error); - return false; - } - } -}; diff --git a/apps/frontend/src/services/api/moonbeam.service.ts b/apps/frontend/src/services/api/moonbeam.service.ts index 8c8c2d53c..d9689874e 100644 --- a/apps/frontend/src/services/api/moonbeam.service.ts +++ b/apps/frontend/src/services/api/moonbeam.service.ts @@ -37,11 +37,9 @@ async function createApiComponents(socketUrl: string, autoReconnect = true): Pro class MoonbeamApiService { private static instance: MoonbeamApiService; - private apiComponents: Promise; + private apiComponents?: Promise; - private constructor() { - this.apiComponents = createApiComponents(MOONBEAM_WSS); - } + private constructor() {} public static getInstance(): MoonbeamApiService { if (!MoonbeamApiService.instance) { @@ -51,6 +49,10 @@ class MoonbeamApiService { } public getApi(): Promise { + if (!this.apiComponents) { + this.apiComponents = createApiComponents(MOONBEAM_WSS); + } + return this.apiComponents; } } diff --git a/apps/frontend/src/services/api/mykobo.service.ts b/apps/frontend/src/services/api/mykobo.service.ts new file mode 100644 index 000000000..990ac73d6 --- /dev/null +++ b/apps/frontend/src/services/api/mykobo.service.ts @@ -0,0 +1,72 @@ +import { apiClient, isApiError } from "./api-client"; + +export type MykoboKycReviewStatus = "pending" | "approved" | "rejected"; + +export interface MykoboKycStatus { + receivedAt: string | null; + reviewStatus: MykoboKycReviewStatus; +} + +export interface MykoboProfile { + firstName: string; + lastName: string; + emailAddress: string; + bankAccountNumber: string; + kycStatus: MykoboKycStatus; + createdAt: string; +} + +export interface MykoboProfilePayload { + firstName: string; + lastName: string; + emailAddress: string; + addressLine1: string; + city: string; + idCountryCode: string; + bankAccountNumber: string; + walletAddress: string; + sourceOfFunds: "EMPLOYMENT" | "SAVINGS" | "LOANS" | "INVESTMENT" | "INHERITANCE"; + taxCountry: string; + idType: "PASSPORT" | "ID_CARD" | "DRIVERS_LICENSE"; + front: File; + back?: File; + face: File; + utilityBill: File; +} + +export const MykoboService = { + async createProfile(payload: MykoboProfilePayload): Promise { + const form = new FormData(); + form.append("first_name", payload.firstName); + form.append("last_name", payload.lastName); + form.append("email_address", payload.emailAddress); + form.append("address_line_1", payload.addressLine1); + form.append("city", payload.city); + form.append("id_country_code", payload.idCountryCode); + form.append("bank_account_number", payload.bankAccountNumber); + form.append("wallet_address", payload.walletAddress); + form.append("source_of_funds", payload.sourceOfFunds); + form.append("tax_country", payload.taxCountry); + form.append("id_type", payload.idType); + form.append("front", payload.front); + if (payload.back) form.append("back", payload.back); + form.append("face", payload.face); + form.append("utility_bill", payload.utilityBill); + + const data = await apiClient.post<{ profile: MykoboProfile }>("/mykobo/profiles", form); + return data.profile; + }, + async getProfile(email: string): Promise { + try { + const data = await apiClient.get<{ profile: MykoboProfile }>("/mykobo/profiles", { + params: { email } + }); + return data.profile; + } catch (error: unknown) { + if (isApiError(error) && error.status === 404) { + return null; + } + throw error; + } + } +}; diff --git a/apps/frontend/src/services/api/pendulum.service.ts b/apps/frontend/src/services/api/pendulum.service.ts index 0872eadc9..886a7e1e2 100644 --- a/apps/frontend/src/services/api/pendulum.service.ts +++ b/apps/frontend/src/services/api/pendulum.service.ts @@ -37,11 +37,9 @@ async function createApiComponents(socketUrl: string, autoReconnect = true): Pro class PendulumApiService { private static instance: PendulumApiService; - private apiComponents: Promise; + private apiComponents?: Promise; - private constructor() { - this.apiComponents = createApiComponents(PENDULUM_WSS); - } + private constructor() {} public static getInstance(): PendulumApiService { if (!PendulumApiService.instance) { @@ -51,6 +49,10 @@ class PendulumApiService { } public getApi(): Promise { + if (!this.apiComponents) { + this.apiComponents = createApiComponents(PENDULUM_WSS); + } + return this.apiComponents; } } diff --git a/apps/frontend/src/services/api/ramp.service.ts b/apps/frontend/src/services/api/ramp.service.ts index 7d31672db..1fcb70ca7 100644 --- a/apps/frontend/src/services/api/ramp.service.ts +++ b/apps/frontend/src/services/api/ramp.service.ts @@ -119,7 +119,12 @@ export class RampService { onUpdate(status); } - if (status.currentPhase === "complete" || status.currentPhase === "failed") { + if ( + status.status === "COMPLETE" || + status.status === "FAILED" || + status.currentPhase === "complete" || + status.currentPhase === "failed" + ) { return status; } diff --git a/apps/frontend/src/services/api/stellar.service.ts b/apps/frontend/src/services/api/stellar.service.ts deleted file mode 100644 index 3ec15aa07..000000000 --- a/apps/frontend/src/services/api/stellar.service.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { - CreateStellarTransactionRequest, - CreateStellarTransactionResponse, - FiatToken, - GetSep10MasterPKResponse, - SignSep10ChallengeRequest, - SignSep10ChallengeResponse -} from "@vortexfi/shared"; -import { apiRequest } from "./api-client"; - -/** - * Service for interacting with Stellar API endpoints - */ -export class StellarService { - private static readonly BASE_PATH = "/stellar"; - - /** - * Create a Stellar transaction - * @param accountId The account ID - * @param maxTime The maximum time - * @param assetCode The asset code - * @param baseFee The base fee - * @returns The transaction signature, sequence, and public key - */ - static async createTransaction( - accountId: string, - maxTime: number, - assetCode: string, - baseFee: string - ): Promise { - const request: CreateStellarTransactionRequest = { - accountId, - assetCode, - baseFee, - maxTime - }; - return apiRequest("post", `${this.BASE_PATH}/create`, request); - } - - /** - * Sign a SEP-10 challenge - * @param challengeXDR The challenge XDR - * @param outToken The output token - * @param clientPublicKey The client public key - * @param derivedMemo Optional derived memo - * @returns The signed challenge - */ - static async signSep10Challenge( - challengeXDR: string, - outToken: FiatToken, - clientPublicKey: string, - derivedMemo?: string - ): Promise { - const request: SignSep10ChallengeRequest = { - challengeXDR, - clientPublicKey, - derivedMemo, - outToken - }; - return apiRequest("post", `${this.BASE_PATH}/sep10`, request); - } - - /** - * Get the SEP-10 master public key - * @returns The master public key - */ - static async getSep10MasterPK(): Promise { - return apiRequest("get", `${this.BASE_PATH}/sep10`); - } -} diff --git a/apps/frontend/src/services/api/storage.service.ts b/apps/frontend/src/services/api/storage.service.ts index 99f3aaabf..1894a704a 100644 --- a/apps/frontend/src/services/api/storage.service.ts +++ b/apps/frontend/src/services/api/storage.service.ts @@ -1,10 +1,8 @@ import { AssethubToBrlaStorageRequest, - AssethubToStellarStorageRequest, BrlaToAssethubStorageRequest, BrlaToEvmStorageRequest, EvmToBrlaStorageRequest, - EvmToStellarStorageRequest, OfframpHandlerType, OnrampHandlerType, StoreDataRequest, @@ -27,38 +25,6 @@ export class StorageService { return apiRequest("post", `${this.BASE_PATH}/create`, request); } - /** - * Store data for EVM to Stellar flow - * @param data The EVM to Stellar flow data - * @returns Success message - */ - static async storeEvmToStellarData( - data: Omit - ): Promise { - const request: EvmToStellarStorageRequest = { - ...data, - flowType: OfframpHandlerType.EVM_TO_STELLAR, - timestamp: new Date().toISOString() - }; - return this.storeData(request); - } - - /** - * Store data for Assethub to Stellar flow - * @param data The Assethub to Stellar flow data - * @returns Success message - */ - static async storeAssethubToStellarData( - data: Omit - ): Promise { - const request: AssethubToStellarStorageRequest = { - ...data, - flowType: OfframpHandlerType.ASSETHUB_TO_STELLAR, - timestamp: new Date().toISOString() - }; - return this.storeData(request); - } - /** * Store data for EVM to BRLA flow * @param data The EVM to BRLA flow data diff --git a/apps/frontend/src/services/monerium/moneriumAuth.ts b/apps/frontend/src/services/monerium/moneriumAuth.ts deleted file mode 100644 index 6c870a20a..000000000 --- a/apps/frontend/src/services/monerium/moneriumAuth.ts +++ /dev/null @@ -1,144 +0,0 @@ -import { siweMessage } from "@monerium/sdk"; -import CryptoJS from "crypto-js"; -import { config } from "../../config"; -import { MoneriumKycActorRef } from "../../machines/types"; - -export enum MoneriumAuthErrorType { - UserRejected = "USER_REJECTED", - UnknownError = "UNKNOWN_ERROR" -} -export class MoneriumAuthError extends Error { - type: MoneriumAuthErrorType; - constructor(message: string, type: MoneriumAuthErrorType) { - super(message); - this.type = type; - } -} - -export const MONERIUM_MINT_NETWORK = config.isSandbox ? "amoy" : "polygon"; -const MONERIUM_MINT_NETWORK_CHAIN_ID = config.isSandbox ? 80002 : 137; -const VORTEX_APP_CLIENT_ID = - import.meta.env.VITE_MONERIUM_CLIENT_ID || - (config.isSandbox ? "e7b56f39-b0ff-11f0-a4ad-fabb3106d2e3" : "eac7a71a-414d-11f0-bea7-ce527adad61b"); -// Use custom API URL if provided, otherwise use default sandbox/dev endpoints -const MONERIUM_API_URL = - import.meta.env.VITE_MONERIUM_API_URL || (config.isSandbox ? "https://api.monerium.dev" : "https://api.monerium.app"); -const LINK_MESSAGE = "I hereby declare that I am the address owner."; -const MONERIUM_APP_NAME = "Vortex"; - -export const initiateMoneriumAuth = async ( - address: string, - signMessage: (message: string) => Promise, - parent: MoneriumKycActorRef -): Promise<{ authUrl: string; codeVerifier: string }> => { - console.log("Initiating Monerium auth for address:", address); - // Generate PKCE code verifier and challenge - const codeVerifier = CryptoJS.lib.WordArray.random(64).toString(); - const codeChallenge = CryptoJS.enc.Base64url.stringify(CryptoJS.SHA256(codeVerifier)); - - try { - parent.send({ phase: "login", type: "SIGNING_UPDATE" }); - const signature = await signMessage(LINK_MESSAGE); - parent.send({ phase: "finished", type: "SIGNING_UPDATE" }); - - const redirectUri = window.location.origin + "/widget"; - - const params = new URLSearchParams({ - address: address, - chain: MONERIUM_MINT_NETWORK, - client_id: VORTEX_APP_CLIENT_ID, - code_challenge: codeChallenge, - code_challenge_method: "S256", - redirect_uri: redirectUri, - signature - }); - - const authUrl = `${MONERIUM_API_URL}/auth?${params.toString()}`; - return { authUrl, codeVerifier }; - } catch (error) { - if (error instanceof Error && error.message.includes("User rejected the request")) { - throw new MoneriumAuthError("User rejected the request.", MoneriumAuthErrorType.UserRejected); - } - console.log("Error during Monerium auth:", error); - throw error; - } -}; - -export const createMoneriumSiweMessage = (address: string) => { - const redirectUri = window.location.origin + "/widget"; - const domain = window.location.hostname; - - return siweMessage({ - address: address, - appName: MONERIUM_APP_NAME, - chainId: MONERIUM_MINT_NETWORK_CHAIN_ID, - domain: domain, - privacyPolicyUrl: "https://shorturl.at/QuMx8", - redirectUri, - termsOfServiceUrl: "https://shorturl.at/5tSgv" - }); -}; - -export const handleMoneriumSiweAuth = async ( - address: string, - signMessage: (message: string) => Promise, - parent: MoneriumKycActorRef -): Promise<{ authUrl: string; codeVerifier: string }> => { - console.log("Handling Monerium SIWE auth for address:", address); - - const codeVerifier = CryptoJS.lib.WordArray.random(64).toString(); - const codeChallenge = CryptoJS.enc.Base64url.stringify(CryptoJS.SHA256(codeVerifier)); - const redirectUri = window.location.origin + "/widget"; - - const message = createMoneriumSiweMessage(address); - - try { - parent.send({ phase: "login", type: "SIGNING_UPDATE" }); - const signature = await signMessage(message); - parent.send({ phase: "finished", type: "SIGNING_UPDATE" }); - const params = new URLSearchParams({ - authentication_method: "siwe", - client_id: VORTEX_APP_CLIENT_ID, - code_challenge: codeChallenge, - code_challenge_method: "S256", - message: message, - redirect_uri: redirectUri, - signature: signature - }); - - const authUrl = `${MONERIUM_API_URL}/auth?${params}`; - return { authUrl, codeVerifier }; - } catch (error) { - if (error instanceof Error && error.message.includes("User rejected the request")) { - throw new MoneriumAuthError("User rejected the request.", MoneriumAuthErrorType.UserRejected); - } - console.log("Error during Monerium SIWE auth:", error); - throw error; - } -}; - -export const exchangeMoneriumCode = async (code: string, codeVerifier: string): Promise<{ authToken: string }> => { - console.log("Exchanging Monerium code:", code, "with verifier:", codeVerifier); - const redirectUri = window.location.origin + "/widget"; - const response = await fetch(`${MONERIUM_API_URL}/auth/token`, { - body: new URLSearchParams({ - client_id: VORTEX_APP_CLIENT_ID, - code, - code_verifier: codeVerifier, - grant_type: "authorization_code", - redirect_uri: redirectUri // We MUST use the same redirect URI as in the initial request - }), - headers: { - "Content-Type": "application/x-www-form-urlencoded" - }, - method: "POST" - }); - - if (!response.ok) { - throw new Error("Failed to exchange code"); - } - - const responseData = await response.json(); - console.log("Monerium auth response:", responseData); - return { authToken: responseData.access_token }; -}; diff --git a/apps/frontend/src/services/signingService.tsx b/apps/frontend/src/services/signingService.tsx index d30a9e2c3..ceaa74a10 100644 --- a/apps/frontend/src/services/signingService.tsx +++ b/apps/frontend/src/services/signingService.tsx @@ -1,27 +1,8 @@ -import { useQuery } from "@tanstack/react-query"; -import { BrlaCreateSubaccountRequest, BrlaGetKycStatusResponse, FiatToken, KycLevel1Payload } from "@vortexfi/shared"; +import { BrlaCreateSubaccountRequest, BrlaGetKycStatusResponse, KycLevel1Payload } from "@vortexfi/shared"; import { SIGNING_SERVICE_URL } from "../constants/constants"; import { isApiError } from "./api/api-client"; import { BrlaService } from "./api/brla.service"; -interface AccountStatusResponse { - status: boolean; - public: string; -} - -interface SigningServiceStatus { - pendulum: AccountStatusResponse; - stellar: AccountStatusResponse; - moonbeam: AccountStatusResponse; -} - -interface SignerServiceSep10Response { - clientSignature: string; - clientPublic: string; - masterClientSignature: string; - masterClientPublic: string; -} - export enum KycStatus { PENDING = "PENDING", REJECTED = "REJECTED", @@ -46,123 +27,11 @@ export interface RegisterSubaccountPayload { fullName: string; cpf: string; cnpj?: string; - birthdate: number; // Denoted in milliseconds since epoch + birthdate: number; companyName?: string; - startDate?: number; // Denoted in milliseconds since epoch -} - -export interface SignerServiceSep10Request { - challengeXDR: string; - outToken: FiatToken; - clientPublicKey: string; - address: string; - usesMemo?: boolean; -} - -// Generic error for signing service -export class SigningServiceError extends Error { - constructor(message: string) { - super(message); - this.name = "SigningServiceError"; - } -} - -// Specific errors for each funding account -export class StellarFundingAccountError extends SigningServiceError { - constructor() { - super("Stellar account is inactive"); - this.name = "StellarFundingAccountError"; - } -} - -export class PendulumFundingAccountError extends SigningServiceError { - constructor() { - super("Pendulum account is inactive"); - this.name = "PendulumFundingAccountError"; - } -} - -export class MoonbeamFundingAccountError extends SigningServiceError { - constructor() { - super("Moonbeam account is inactive"); - this.name = "MoonbeamFundingAccountError"; - } + startDate?: number; } -export const fetchSigningServiceAccountId = async (): Promise => { - try { - const response = await fetch(`${SIGNING_SERVICE_URL}/v1/status`); - if (!response.ok) { - throw new SigningServiceError("Failed to fetch signing service status"); - } - - const serviceResponse: SigningServiceStatus = await response.json(); - - if (!serviceResponse.stellar?.status) { - throw new StellarFundingAccountError(); - } - if (!serviceResponse.pendulum?.status) { - throw new PendulumFundingAccountError(); - } - if (!serviceResponse.moonbeam?.status) { - throw new MoonbeamFundingAccountError(); - } - - return { - moonbeam: serviceResponse.moonbeam, - pendulum: serviceResponse.pendulum, - stellar: serviceResponse.stellar - }; - } catch (error) { - if (error instanceof SigningServiceError) { - throw error; - } - console.error("Signing service is down: ", error); - throw new SigningServiceError("Signing service is down"); - } -}; - -export const useSigningService = () => { - return useQuery({ - queryFn: fetchSigningServiceAccountId, - queryKey: ["signingService"], - retry: (failureCount, error) => { - if ( - error instanceof StellarFundingAccountError || - error instanceof PendulumFundingAccountError || - error instanceof MoonbeamFundingAccountError - ) { - return false; - } - return failureCount < 3; - } - }); -}; - -export const fetchSep10Signatures = async ({ - challengeXDR, - outToken, - clientPublicKey, - usesMemo, - address -}: SignerServiceSep10Request): Promise => { - const response = await fetch(`${SIGNING_SERVICE_URL}/v1/stellar/sep10`, { - body: JSON.stringify({ address, challengeXDR, clientPublicKey, outToken, usesMemo }), - credentials: "include", - headers: { "Content-Type": "application/json" }, - method: "POST" - }); - if (response.status !== 200) { - if (response.status === 401) { - throw new Error("Invalid signature"); - } - throw new Error(`Failed to fetch SEP10 challenge from server: ${response.statusText}`); - } - - const { clientSignature, clientPublic, masterClientSignature, masterClientPublic } = await response.json(); - return { clientPublic, clientSignature, masterClientPublic, masterClientSignature }; -}; - export const fetchKycStatus = async (taxId: string, quoteId: string, sessionId?: string) => { const statusResponse = await fetch( `${SIGNING_SERVICE_URL}/v1/brla/getKycStatus?taxId=${taxId}"eId=${quoteId}${sessionId ? `&sessionId=${sessionId}` : ""}` @@ -173,7 +42,6 @@ export const fetchKycStatus = async (taxId: string, quoteId: string, sessionId?: } const eventStatus: BrlaGetKycStatusResponse = await statusResponse.json(); - console.log(`Received event status: ${JSON.stringify(eventStatus)}`); return eventStatus; }; diff --git a/apps/frontend/src/services/stellar/index.ts b/apps/frontend/src/services/stellar/index.ts deleted file mode 100644 index 5f302db34..000000000 --- a/apps/frontend/src/services/stellar/index.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { TomlValues } from "../../types/sep"; - -export const fetchTomlValues = async (TOML_FILE_URL: string): Promise => { - const response = await fetch(TOML_FILE_URL); - if (response.status !== 200) { - throw new Error(`Failed to fetch TOML file: ${response.statusText}`); - } - - const tomlFileContent = (await response.text()).split("\n"); - const findValueInToml = (key: string): string | undefined => { - const keyValue = tomlFileContent.find(line => line.includes(key)); - return keyValue?.split("=")[1].trim().replaceAll('"', ""); - }; - - return { - kycServer: findValueInToml("KYC_SERVER"), - sep6Url: findValueInToml("TRANSFER_SERVER"), - sep24Url: findValueInToml("TRANSFER_SERVER_SEP0024"), - signingKey: findValueInToml("SIGNING_KEY"), - webAuthEndpoint: findValueInToml("WEB_AUTH_ENDPOINT") - }; -}; diff --git a/apps/frontend/src/services/transactions/userSigning.ts b/apps/frontend/src/services/transactions/userSigning.ts index e30d40e29..64e2f5e91 100644 --- a/apps/frontend/src/services/transactions/userSigning.ts +++ b/apps/frontend/src/services/transactions/userSigning.ts @@ -163,7 +163,7 @@ export async function signAndSubmitSubstrateTransaction(unsignedTx: UnsignedTx, // Try to find a 'system.ExtrinsicFailed' event if (dispatchError) { - reject("Substrate transaction execution failed"); + reject(new Error(`Substrate transaction execution failed: ${dispatchError.toString()}`)); } resolve(hash); @@ -173,7 +173,7 @@ export async function signAndSubmitSubstrateTransaction(unsignedTx: UnsignedTx, .catch(error => { // Most likely, the user cancelled the signing process. console.error("Error signing and submitting transaction", error); - reject("Error signing and sending transaction:" + error); + reject(error instanceof Error ? error : new Error(`Error signing and submitting transaction: ${String(error)}`)); }); }); } diff --git a/apps/frontend/src/stores/quote/useQuoteFormStore.ts b/apps/frontend/src/stores/quote/useQuoteFormStore.ts index 0f4e318de..824878d50 100644 --- a/apps/frontend/src/stores/quote/useQuoteFormStore.ts +++ b/apps/frontend/src/stores/quote/useQuoteFormStore.ts @@ -1,13 +1,4 @@ -import { - AssetHubToken, - EvmToken, - FiatToken, - getOnChainTokenDetails, - Networks, - OnChainToken, - OnChainTokenSymbol, - RampDirection -} from "@vortexfi/shared"; +import { EvmToken, FiatToken, getOnChainTokenDetails, Networks, OnChainTokenSymbol, RampDirection } from "@vortexfi/shared"; import { create } from "zustand"; import { persist } from "zustand/middleware"; import { getRampDirectionFromPath } from "../../helpers/path"; @@ -38,14 +29,7 @@ const defaultFiatToken = getLanguageFromPath() === Language.Portuguese_Brazil ? const defaultFiatAmount = getLanguageFromPath() === Language.Portuguese_Brazil ? DEFAULT_BRL_AMOUNT : defaultFiatTokenAmounts[defaultFiatToken]; -const storedNetwork = localStorage.getItem("SELECTED_NETWORK"); - -const defaultOnChainToken = - getRampDirectionFromPath() === RampDirection.BUY - ? storedNetwork === Networks.AssetHub - ? AssetHubToken.USDC - : EvmToken.USDT - : EvmToken.USDC; +const defaultOnChainToken = EvmToken.USDC; interface RampFormState { inputAmount: string; diff --git a/apps/frontend/src/stores/quote/useQuoteStore.ts b/apps/frontend/src/stores/quote/useQuoteStore.ts index 7238378e1..1ea1144ae 100644 --- a/apps/frontend/src/stores/quote/useQuoteStore.ts +++ b/apps/frontend/src/stores/quote/useQuoteStore.ts @@ -54,6 +54,7 @@ const friendlyErrorMessages: Record = { [QuoteError.MissingToField]: "pages.swap.error.missingToField", [QuoteError.MissingFromField]: "pages.swap.error.missingFromField", [QuoteError.InvalidRampType]: "pages.swap.error.invalidRampType", + [QuoteError.InvalidNetworks]: "pages.swap.error.invalidNetworks", [QuoteError.QuoteNotFound]: "pages.swap.error.quoteNotFound", [QuoteError.AssetHubNotSupportedForAlfredPay]: "pages.swap.error.assetHubNotSupportedForAlfredPay", @@ -62,8 +63,11 @@ const friendlyErrorMessages: Record = { [QuoteError.InputAmountForSwapMustBeGreaterThanZero]: "pages.swap.error.tryLargerAmount", [QuoteError.InputAmountTooLow]: "pages.swap.error.tryLargerAmount", [QuoteError.InputAmountTooLowToCoverCalculatedFees]: "pages.swap.error.tryLargerAmount", - [QuoteError.BelowLowerLimitSell]: QuoteError.BelowLowerLimitSell, // We leave this as-is, as the replacement string depends on the context - [QuoteError.BelowLowerLimitBuy]: QuoteError.BelowLowerLimitBuy, // We leave this as-is, as the replacement string depends on the context + // Limit errors pass through; useRampValidation rewrites them with the actual min/max. + [QuoteError.BelowLowerLimitSell]: QuoteError.BelowLowerLimitSell, + [QuoteError.BelowLowerLimitBuy]: QuoteError.BelowLowerLimitBuy, + [QuoteError.AboveUpperLimitSell]: QuoteError.AboveUpperLimitSell, + [QuoteError.AboveUpperLimitBuy]: QuoteError.AboveUpperLimitBuy, [QuoteError.LowLiquidity]: "pages.swap.error.lowLiquidity", // Calculation failures - suggest different amount [QuoteError.UnableToGetPendulumTokenDetails]: "pages.swap.error.tryDifferentAmount", @@ -145,7 +149,7 @@ export const useQuoteStore = create()( const { inputAmount, partnerId, apiKey } = params; if (!inputAmount || inputAmount.eq(0)) { - set({ error: "pages.swap.error.invalidInputAmount", loading: false, outputAmount: Big(0), quote: undefined }); + set({ error: null, loading: false, outputAmount: Big(0), quote: undefined }); return; } diff --git a/apps/frontend/src/stories/MoneriumAssethubFormStep.stories.tsx b/apps/frontend/src/stories/MoneriumAssethubFormStep.stories.tsx deleted file mode 100644 index cdeee2fe2..000000000 --- a/apps/frontend/src/stories/MoneriumAssethubFormStep.stories.tsx +++ /dev/null @@ -1,125 +0,0 @@ -import type { Meta, StoryObj } from "@storybook/react"; -import { FormProvider, useForm } from "react-hook-form"; -import { MoneriumAssethubFormStep } from "../components/widget-steps/MoneriumAssethubFormStep"; - -// Wrapper to provide form context -const FormWrapper = ({ children, defaultValues, errors }: { children: React.ReactNode; defaultValues?: any; errors?: any }) => { - const methods = useForm({ - defaultValues: defaultValues || { - walletAddress: "" - } - }); - - // Manually set errors if provided - if (errors) { - Object.keys(errors).forEach(key => { - methods.setError(key as any, { message: errors[key], type: "manual" }); - }); - } - - return ( - -
{children}
-
- ); -}; - -const meta: Meta = { - component: MoneriumAssethubFormStep, - decorators: [ - (Story, context) => { - const defaultValues = context.parameters.defaultValues; - const errors = context.parameters.errors; - - return ( - -
- -
-
- ); - } - ], - parameters: { - docs: { - description: { - component: - "The MoneriumAssethubFormStep component displays a wallet address input field for Monerium EUR onramps to AssetHub. Users enter their AssetHub wallet address where they want to receive assets." - } - }, - layout: "centered" - }, - tags: ["autodocs"], - title: "Components/Widget Steps/MoneriumAssethubFormStep" -}; - -export default meta; -type Story = StoryObj; - -export const Default: Story = { - parameters: { - docs: { - description: { - story: "Shows the form with an empty wallet address field." - } - } - } -}; - -export const WithWalletAddress: Story = { - parameters: { - defaultValues: { - walletAddress: "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" - }, - docs: { - description: { - story: "Shows the form with a pre-filled AssetHub (Polkadot) wallet address." - } - } - } -}; - -export const WithValidationError: Story = { - parameters: { - defaultValues: { - walletAddress: "" - }, - docs: { - description: { - story: "Shows the form with a validation error when the wallet address is required but not provided." - } - }, - errors: { - walletAddress: "Wallet address is required" - } - } -}; - -export const WithInvalidAddress: Story = { - parameters: { - defaultValues: { - walletAddress: "invalid_address_format" - }, - docs: { - description: { - story: "Shows the form with an invalid wallet address format error." - } - }, - errors: { - walletAddress: "Invalid Polkadot wallet address" - } - } -}; - -export const LongAddress: Story = { - parameters: { - defaultValues: { - walletAddress: "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQYVeryLongAddressExample" - }, - docs: { - description: { - story: "Shows how the component handles a very long wallet address." - } - } - } -}; diff --git a/apps/frontend/src/stories/MoneriumRedirectStep.stories.tsx b/apps/frontend/src/stories/MoneriumRedirectStep.stories.tsx deleted file mode 100644 index d817cfd1d..000000000 --- a/apps/frontend/src/stories/MoneriumRedirectStep.stories.tsx +++ /dev/null @@ -1,102 +0,0 @@ -import type { Meta, StoryObj } from "@storybook/react"; -import { MoneriumRedirectStep } from "../components/widget-steps/MoneriumRedirectStep"; -import { RampStateContext } from "../contexts/rampState"; - -// Helper to create a complete snapshot with Monerium KYC actor -const createSnapshot = () => ({ - children: { - moneriumKyc: { - getSnapshot: () => ({ - context: {}, - send: (event: any) => console.log("Monerium KYC event:", event), - value: "Redirect" - }), - send: (event: any) => console.log("Monerium KYC send:", event) - } - }, - context: { - apiKey: undefined, - authToken: undefined, - callbackUrl: undefined, - chainId: undefined, - connectedWalletAddress: undefined, - errorMessage: undefined, - executionInput: undefined, - externalSessionId: undefined, - getMessageSignature: undefined, - initializeFailedMessage: undefined, - isQuoteExpired: false, - isSep24Redo: false, - partnerId: undefined, - paymentData: undefined, - quote: undefined, - quoteId: undefined, - quoteLocked: undefined, - rampDirection: undefined, - rampPaymentConfirmed: false, - rampSigningPhase: undefined, - rampState: undefined, - substrateWalletAccount: undefined, - walletLocked: undefined - }, - error: undefined, - historyValue: undefined, - output: undefined, - status: "active" as const, - tags: new Set(), - value: "KYC" -}); - -const meta: Meta = { - component: MoneriumRedirectStep, - decorators: [ - Story => { - const snapshot = createSnapshot(); - - return ( - -
- -
-
- ); - } - ], - parameters: { - docs: { - description: { - component: - "The MoneriumRedirectStep component is shown when the user needs to be redirected to Monerium for KYC verification. It provides options to cancel or proceed to the partner site." - } - }, - layout: "centered" - }, - tags: ["autodocs"], - title: "Components/Widget Steps/MoneriumRedirectStep" -}; - -export default meta; -type Story = StoryObj; - -export const Default: Story = { - parameters: { - docs: { - description: { - story: "Shows the Monerium redirect step with Cancel and Go to Partner buttons." - } - } - } -}; - -export const Interactive: Story = { - parameters: { - docs: { - description: { - story: "Interactive version showing button click behavior (check console for events)." - } - } - }, - play: async () => { - console.log("MoneriumRedirectStep is interactive - click buttons to test"); - } -}; diff --git a/apps/frontend/src/translations/en.json b/apps/frontend/src/translations/en.json index 8656f2b7e..6f81f755b 100644 --- a/apps/frontend/src/translations/en.json +++ b/apps/frontend/src/translations/en.json @@ -12,9 +12,7 @@ "title": "Special offer until 27 May" }, "alfredpayKycFlow": { - "accountVerified": "Your account has been verified. You can now proceed.", "cancel": "Cancel", - "completed": "{{kycOrKyb}} Completed!", "completeInNewWindow": "Please complete the {{kycOrKyb}} process in the new window. Once you are done, click 'I have finished the verification'.", "completeProcess": "To continue, please complete the {{kycOrKyb}} process with our partner AlfredPay.", "continue": "Continue", @@ -33,6 +31,33 @@ "verifyingStatus": "Verifying {{kycOrKyb}} Status", "verifyingStatusDescription": "This may take a few moments. Please do not close this window." }, + "arDocumentUpload": { + "backLabel": "Back of DNI", + "fileHint": "Accepted formats: JPG, PNG, PDF — max 5 MB each", + "fileTooLarge": "File exceeds the 5 MB limit.", + "frontLabel": "Front of DNI", + "invalidType": "Only JPG, PNG, or PDF files are accepted.", + "selfieLabel": "Selfie", + "submit": "Submit Documents", + "subtitle": "Please upload a photo or scan of your DNI (front and back) and a selfie. Max 5 MB per file.", + "tapToSelect": "Tap to select file", + "title": "Upload ID Documents" + }, + "arKycForm": { + "continue": "Continue", + "cuit": "CUIT", + "cuitPlaceholder": "CUIT", + "dni": "DNI Number", + "dniPlaceholder": "DNI number", + "documentType": "Document Type", + "options": { + "dni": "DNI (Documento Nacional de Identidad)" + }, + "pepLabel": "I am a Politically Exposed Person (PEP)", + "phoneNumber": "Phone Number", + "subtitle": "Please provide your personal information to complete KYC.", + "title": "Identity Verification" + }, "authEmailStep": { "buttons": { "continue": "Continue", @@ -220,6 +245,7 @@ "required": "Street is required" }, "taxId": { + "cnpjFormat": "Invalid CNPJ format", "format": "Invalid Tax ID format", "required": "Tax ID is required" } @@ -232,6 +258,7 @@ } }, "colKycForm": { + "continue": "Continue", "dni": "Document Number", "dniPlaceholderCc": "10-digit CC number", "dniPlaceholderCe": "6–10 digit CE number", @@ -390,12 +417,14 @@ "descriptions": { "ACH": "1-2 business days", "ACH_COL": "Colombian bank transfer", + "COELSA": "Argentine bank transfer", "SPEI": "Instant interbank transfer via CLABE number", "WIRE": "Same day" }, "labels": { "ACH": "ACH Transfer", "ACH_COL": "ACH Colombia", + "COELSA": "COELSA", "SPEI": "SPEI", "WIRE": "Wire Transfer" }, @@ -455,7 +484,6 @@ "avenia": "Avenia", "careers": "Careers", "licences": "Licences", - "monerium": "Monerium EMI ehf.", "mykobo": "MyKobo sp. z.o.o.", "privacyPolicy": "Privacy Policy", "termsAndConditions": "Terms and Conditions", @@ -511,6 +539,12 @@ "subtitle": "Please upload a photo or scan of the representative's ID document.", "title": "Representative ID ({{current}} of {{total}})" }, + "kycDoneScreen": { + "accountVerified": "Your account has been verified. You can now proceed.", + "completed": "{{kycOrKyb}} Completed!", + "continue": "Continue", + "documentVerifiedAlt": "Document verified" + }, "kycLevel2Toggle": { "temporarilyDisabled": "Temporarily disabled" }, @@ -522,26 +556,13 @@ }, "button": "Maintenance Mode" }, - "moneriumFormStep": { - "description": { - "1": "Please enter the address where you want to receive the assets on AssetHub.", - "2": "Then, authenticate with our stablecoin partner Monerium by connecting your EVM wallet." - }, - "field": { - "label": "AssetHub Wallet Address" - } - }, - "moneriumRedirect": { - "cancel": "Cancel", - "description": "You have been redirected to our partner...", - "goToPartner": "Go to partner" - }, "mxnDocumentUpload": { "backLabel": "Back of Document", "fileHint": "Accepted formats: JPG, PNG, PDF — max 5 MB each", "fileTooLarge": "File exceeds the 5 MB limit.", "frontLabel": "Front of Document", "invalidType": "Only JPG, PNG, or PDF files are accepted.", + "selfieLabel": "Selfie", "submit": "Submit Documents", "subtitle": "Please upload a photo or scan of your ID document. Max 5 MB per file (JPG, PNG, PDF).", "tapToSelect": "Tap to select file", @@ -568,6 +589,51 @@ "title": "Identity Verification", "zipCode": "ZIP Code" }, + "mykoboKycFlow": { + "checkingProfile": "Checking your verification status...", + "failure": "Verification failed", + "form": { + "addressLine1": "Address line 1", + "backOfId": "Back of ID", + "bankAccountNumber": "IBAN", + "city": "City", + "documents": "Documents", + "emailAddress": "Email address", + "errors": { + "backRequired": "Back of ID is required for ID cards and driver's licenses.", + "requiredFields": "Please fill in all required fields.", + "requiredFiles": "Front of ID, selfie, and utility bill are required." + }, + "filePlaceholder": "PNG, JPG or PDF", + "firstName": "First name", + "frontOfId": "Front of ID", + "idCountryCode": "Country (ISO alpha-2)", + "idType": "ID type", + "idTypeOptions": { + "DRIVERS_LICENSE": "Driver's license", + "ID_CARD": "ID card", + "PASSPORT": "Passport" + }, + "lastName": "Last name", + "selfie": "Selfie", + "sourceOfFunds": "Source of funds", + "sourceOfFundsOptions": { + "EMPLOYMENT": "Employment", + "INHERITANCE": "Inheritance", + "INVESTMENT": "Investment", + "LOANS": "Loans", + "SAVINGS": "Savings" + }, + "submit": "Submit", + "taxCountry": "Tax country (ISO alpha-2)", + "title": "KYC verification", + "utilityBill": "Utility bill" + }, + "rejected": "Your verification was rejected.", + "startOver": "Start over", + "submitting": "Submitting your verification...", + "verifying": "Verifying your identity. This may take a few minutes..." + }, "navbar": { "api": "API", "bookDemo": "Book demo", @@ -608,7 +674,29 @@ "thankYou": "Thank you!", "title": "Your opinion matters!" }, + "regionSelectStep": { + "continue": "Continue", + "description": "Select the region you want to verify your business for.", + "label": "Region", + "placeholder": "Select a region", + "regions": { + "BR": "Brazil", + "CO": "Colombia", + "MX": "Mexico", + "US": "United States" + }, + "title": "Select Your Region" + }, "SummaryPage": { + "ARSOnrampDetails": { + "aliasLabel": "Alias", + "cvuLabel": "CBU/CVU", + "expiresAt": "Expires", + "instruction": "Transfer funds to the bank account below", + "qrCodeDescription": "Once done, please click on \"I have made the payment\"", + "reference": "Reference", + "title": "Pay via Bank Transfer" + }, "BRLOnrampDetails": { "copyCode": "or copy the PIX code below and paste it in your bank app", "pixCode": "Pix code", @@ -636,12 +724,14 @@ "hint": "Scan this QR code in your banking app to start the payment instantly.", "iban": "IBAN", "receiver": "Recipient", + "reference": "Reference", "title": "Do an instant bank transfer with the following details" }, "headerText": { "buy": "Payment Summary", "sell": "Payment Summary" }, + "iban": "IBAN", "MXNOnrampDetails": { "expiresAt": "Expires", "instruction": "Transfer funds via SPEI to the CLABE below", @@ -717,6 +807,7 @@ "required": "PIX key is required when transferring BRL" }, "taxId": { + "cnpjFormat": "Invalid CNPJ format", "format": "Invalid CPF or CNPJ format", "required": "CPF or CNPJ is required when transferring BRL" }, @@ -751,8 +842,7 @@ "hooks": { "useGetRampRegistrationErrorMessage": { "default": "Something went wrong", - "quoteNotFound": "The quote is expired. Please try again.", - "userMintAddressNotFound": "Account creation in progress... Please try again shortly." + "quoteNotFound": "The quote is expired. Please try again." }, "useSubmitOfframp": { "cnpjUserDoesntExist": "Please contact our support team at support@vortexfinance.co to get onboarded as a business user.", @@ -863,12 +953,13 @@ "submit": "Submit" }, "info": { - "integrationHelp": "Get integration help", - "onboardingHelp": "Get onboarding help", + "integrationHelp": "Integrate with your platform", + "onboardingHelp": "Get onboarding support", + "requestCommercials": "Request commercials", "requestDemo": "Request a demo", "supportLink": "Contact support", "technicalQuestions": "Technical issues or product questions?", - "title": "Contact sales" + "title": "Scale your stablecoin payouts" }, "success": "Thank you! We'll be in touch soon.", "title": "Tell us how to help", @@ -1072,15 +1163,6 @@ "label": "Website:" } }, - "monerium": { - "name": "Monerium EMI ehf. (EEA/Iceland)", - "privacyTos": { - "label": "Privacy/ToS:" - }, - "website": { - "label": "Website:" - } - }, "mykobo": { "name": "MYKOBO UAB (EU/Lithuania)", "privacy": { @@ -1181,9 +1263,9 @@ "hydrationSwap": "Swapping {{inputAssetSymbol}} to {{outputAssetSymbol}} on Hydration DEX", "hydrationToAssethubXcm": "Transferring {{assetSymbol}} from Hydration --> AssetHub", "initial": "Starting process", - "moneriumOnrampMint": "Waiting to receive payment", - "moneriumOnrampSelfTransfer": "Transferring EUR.e to the ephemeral account", "moonbeamToPendulum": "Transferring {{assetSymbol}} from Moonbeam --> Pendulum", + "mykoboOnrampDeposit": "Waiting to receive payment", + "onHoldForComplianceCheck": "Your payment is on hold for a compliance check. Vortex will continue automatically once Avenia clears it.", "pendulumToAssethubXcm": "Transferring {{assetSymbol}} from Pendulum --> AssetHub", "pendulumToHydrationXcm": "Transferring {{assetSymbol}} from Pendulum --> Hydration", "pendulumToMoonbeamXcm": "Transferring {{assetSymbol}} from Pendulum --> Moonbeam", @@ -1242,12 +1324,13 @@ "insufficientFunds": "Exceeds balance. Your balance is {{userInputTokenBalance}} {{assetSymbol}}", "insufficientLiquidity": "The amount is temporarily not available. Please, try with a smaller amount.", "invalidInputAmount": "Invalid input amount", + "invalidNetworks": "Invalid networks. Please provide a valid list of supported networks.", "invalidRampType": "Invalid ramp type", "lessThanMinimumWithdrawal": { "buy": "Minimum buy amount is {{minAmountUnits}} {{assetSymbol}}.", "sell": "Minimum sell amount is {{minAmountUnits}} {{assetSymbol}}." }, - "lowLiquidity": "Low liquidity for this route. Please try a smaller amount.", + "lowLiquidity": "This route is temporarily unavailable due to low liquidity. Please try a smaller amount or check back soon.", "MXN_tokenUnavailable": "Building your MXN rail - available soon!", "missingFields": "Missing required fields", "moreThanMaximumWithdrawal": { @@ -1392,13 +1475,17 @@ "title": "Buy & Sell <1>Stablecoins - directly with your Bank Account" }, "popularTokens": { + "countries": { + "description": "On and off-ramp in these popular fiat currencies", + "title": "Supported Countries" + }, + "cryptocurrencies": { + "description": "supported cryptocurrencies", + "title": "Supported Cryptocurrencies" + }, "networks": { "description": "Trade across multiple blockchain networks", "title": "Supported Networks" - }, - "tokens": { - "description": "Trade these popular crypto and fiat currencies", - "title": "Supported Tokens" } }, "popularTokensPartners": { diff --git a/apps/frontend/src/translations/pt.json b/apps/frontend/src/translations/pt.json index 1b28095d1..26f233b76 100644 --- a/apps/frontend/src/translations/pt.json +++ b/apps/frontend/src/translations/pt.json @@ -12,9 +12,7 @@ "title": "Oferta especial até 27 Maio" }, "alfredpayKycFlow": { - "accountVerified": "Sua conta foi verificada. Você pode prosseguir agora.", "cancel": "Cancelar", - "completed": "{{kycOrKyb}} Concluído!", "completeInNewWindow": "Por favor, complete o processo {{kycOrKyb}} na nova janela. Quando terminar, clique no botão abaixo.", "completeProcess": "Para continuar, complete o processo {{kycOrKyb}} com nosso parceiro AlfredPay.", "continue": "Continuar", @@ -33,6 +31,33 @@ "verifyingStatus": "Verificando Status {{kycOrKyb}}", "verifyingStatusDescription": "Isso pode levar alguns momentos. Por favor, não feche esta janela." }, + "arDocumentUpload": { + "backLabel": "Verso do DNI", + "fileHint": "Formatos aceitos: JPG, PNG, PDF — máx. 5 MB cada", + "fileTooLarge": "O arquivo excede o limite de 5 MB.", + "frontLabel": "Frente do DNI", + "invalidType": "Somente arquivos JPG, PNG ou PDF são aceitos.", + "selfieLabel": "Selfie", + "submit": "Enviar Documentos", + "subtitle": "Por favor, envie uma foto ou digitalização do seu DNI (frente e verso) e uma selfie. Máx. 5 MB por arquivo.", + "tapToSelect": "Toque para selecionar o arquivo", + "title": "Enviar Documentos de Identidade" + }, + "arKycForm": { + "continue": "Continuar", + "cuit": "CUIT", + "cuitPlaceholder": "CUIT", + "dni": "Número do DNI", + "dniPlaceholder": "Número do DNI", + "documentType": "Tipo de Documento", + "options": { + "dni": "DNI (Documento Nacional de Identidad)" + }, + "pepLabel": "Sou uma Pessoa Politicamente Exposta (PEP)", + "phoneNumber": "Número de Telefone", + "subtitle": "Por favor, forneça suas informações pessoais para concluir o KYC.", + "title": "Verificação de Identidade" + }, "authEmailStep": { "buttons": { "continue": "Continuar", @@ -223,6 +248,7 @@ "required": "Rua é obrigatória" }, "taxId": { + "cnpjFormat": "CNPJ inválido", "format": "Tax Id inválido", "required": "Tax Id é obrigatório" } @@ -235,6 +261,7 @@ } }, "colKycForm": { + "continue": "Continuar", "dni": "Número de Documento", "dniPlaceholderCc": "Número CC de 10 dígitos", "dniPlaceholderCe": "Número CE de 6 a 10 dígitos", @@ -393,12 +420,14 @@ "descriptions": { "ACH": "1 a 2 dias úteis", "ACH_COL": "Transferência bancária colombiana", + "COELSA": "Transferência bancária argentina", "SPEI": "Transferência interbancária instantânea via número CLABE", "WIRE": "No mesmo dia" }, "labels": { "ACH": "Transferência ACH", "ACH_COL": "ACH Colômbia", + "COELSA": "COELSA", "SPEI": "SPEI", "WIRE": "Transferência Internacional" }, @@ -458,7 +487,6 @@ "avenia": "Avenia", "careers": "Carreiras", "licences": "Licenças", - "monerium": "Monerium", "mykobo": "MyKobo", "privacyPolicy": "Política de Privacidade", "termsAndConditions": "Termos e Condições", @@ -515,6 +543,12 @@ "subtitle": "Por favor, envie uma foto ou digitalização do documento de identidade do representante.", "title": "Documento do Representante ({{current}} de {{total}})" }, + "kycDoneScreen": { + "accountVerified": "Sua conta foi verificada. Você pode prosseguir agora.", + "completed": "{{kycOrKyb}} Concluído!", + "continue": "Continuar", + "documentVerifiedAlt": "Documento verificado" + }, "kycLevel2Toggle": { "temporarilyDisabled": "Temporariamente desativado" }, @@ -526,26 +560,13 @@ }, "button": "Modo de Manutenção" }, - "moneriumFormStep": { - "description": { - "1": "Por favor, insira o endereço onde deseja receber os ativos no AssetHub.", - "2": "Em seguida, autentique-se com nosso parceiro de stablecoin Monerium conectando sua carteira EVM." - }, - "field": { - "label": "Endereço da Carteira AssetHub" - } - }, - "moneriumRedirect": { - "cancel": "Cancelar", - "description": "Você foi redirecionado para nosso parceiro...", - "goToPartner": "Ir para o parceiro" - }, "mxnDocumentUpload": { "backLabel": "Verso do Documento", "fileHint": "Formatos aceitos: JPG, PNG, PDF — máx. 5 MB cada", "fileTooLarge": "O arquivo excede o limite de 5 MB.", "frontLabel": "Frente do Documento", "invalidType": "Somente arquivos JPG, PNG ou PDF são aceitos.", + "selfieLabel": "Selfie", "submit": "Enviar Documentos", "subtitle": "Por favor, envie uma foto ou digitalização do seu documento. Máx. 5 MB por arquivo (JPG, PNG, PDF).", "tapToSelect": "Toque para selecionar o arquivo", @@ -572,6 +593,51 @@ "title": "Verificação de Identidade", "zipCode": "CEP" }, + "mykoboKycFlow": { + "checkingProfile": "Verificando o status da sua verificação...", + "failure": "Falha na verificação", + "form": { + "addressLine1": "Endereço linha 1", + "backOfId": "Verso do documento", + "bankAccountNumber": "IBAN", + "city": "Cidade", + "documents": "Documentos", + "emailAddress": "Endereço de e-mail", + "errors": { + "backRequired": "O verso do documento é obrigatório para carteiras de identidade e carteiras de motorista.", + "requiredFields": "Por favor, preencha todos os campos obrigatórios.", + "requiredFiles": "Frente do documento, selfie e comprovante de residência são obrigatórios." + }, + "filePlaceholder": "PNG, JPG ou PDF", + "firstName": "Nome", + "frontOfId": "Frente do documento", + "idCountryCode": "País (ISO alpha-2)", + "idType": "Tipo de documento", + "idTypeOptions": { + "DRIVERS_LICENSE": "Carteira de motorista", + "ID_CARD": "Carteira de identidade", + "PASSPORT": "Passaporte" + }, + "lastName": "Sobrenome", + "selfie": "Selfie", + "sourceOfFunds": "Origem dos fundos", + "sourceOfFundsOptions": { + "EMPLOYMENT": "Emprego", + "INHERITANCE": "Herança", + "INVESTMENT": "Investimento", + "LOANS": "Empréstimos", + "SAVINGS": "Poupança" + }, + "submit": "Enviar", + "taxCountry": "País de tributação (ISO alpha-2)", + "title": "Verificação KYC", + "utilityBill": "Comprovante de residência" + }, + "rejected": "Sua verificação foi rejeitada.", + "startOver": "Começar de novo", + "submitting": "Enviando sua verificação...", + "verifying": "Verificando sua identidade. Isso pode levar alguns minutos..." + }, "navbar": { "api": "API", "bookDemo": "Agendar demo", @@ -612,7 +678,29 @@ "thankYou": "Obrigado!", "title": "Sua opinião é importante!" }, + "regionSelectStep": { + "continue": "Continuar", + "description": "Selecione a região para a qual deseja verificar sua empresa.", + "label": "Região", + "placeholder": "Selecione uma região", + "regions": { + "BR": "Brasil", + "CO": "Colômbia", + "MX": "México", + "US": "Estados Unidos" + }, + "title": "Selecione sua região" + }, "SummaryPage": { + "ARSOnrampDetails": { + "aliasLabel": "Alias", + "cvuLabel": "CBU/CVU", + "expiresAt": "Expira", + "instruction": "Transfira os fundos para a conta bancária abaixo", + "qrCodeDescription": "Uma vez concluído, clique em \"Eu fiz o pagamento\"", + "reference": "Referência", + "title": "Pagar via Transferência Bancária" + }, "BRLOnrampDetails": { "copyCode": "Ou copie o código PIX abaixo, selecione PIX no app do seu banco e cole o código fornecido.", "pixCode": "Código PIX", @@ -640,12 +728,14 @@ "hint": "Escaneie este QR code no seu aplicativo bancário para iniciar o pagamento instantaneamente.", "iban": "IBAN", "receiver": "Nome do Beneficiário", + "reference": "Referência", "title": "Faça uma transferência bancária instantânea com os seguintes detalhes" }, "headerText": { "buy": "Resumo do pagamento", "sell": "Resumo do pagamento" }, + "iban": "IBAN", "MXNOnrampDetails": { "expiresAt": "Expira", "instruction": "Transfira os fundos via SPEI para o CLABE abaixo", @@ -721,6 +811,7 @@ "required": "Chave PIX é obrigatória para transferências em BRL" }, "taxId": { + "cnpjFormat": "CNPJ inválido", "format": "CPF o CNPJ inválido", "required": "CPF o CNPJ é obrigatório para transferências em BRL" }, @@ -755,8 +846,7 @@ "hooks": { "useGetRampRegistrationErrorMessage": { "default": "Algo deu errado", - "quoteNotFound": "A cotação expirou. Por favor, tente novamente.", - "userMintAddressNotFound": "Sua conta está sendo criada, por favor tente novamente em alguns minutos." + "quoteNotFound": "A cotação expirou. Por favor, tente novamente." }, "useSubmitOfframp": { "cnpjUserDoesntExist": "Entre em contato com nossa equipe de suporte em support@vortexfinance.co para começar como usuário empresarial.", @@ -867,12 +957,13 @@ "submit": "Enviar" }, "info": { - "integrationHelp": "Obter ajuda de integração", - "onboardingHelp": "Obter ajuda de onboarding", + "integrationHelp": "Integre com sua plataforma", + "onboardingHelp": "Receba suporte de onboarding", + "requestCommercials": "Solicitar condições comerciais", "requestDemo": "Solicitar uma demonstração", "supportLink": "Contatar suporte", "technicalQuestions": "Problemas técnicos ou dúvidas sobre o produto?", - "title": "Fale com vendas" + "title": "Escale seus pagamentos em stablecoins" }, "success": "Obrigado! Entraremos em contato em breve.", "title": "Conte-nos como podemos ajudar", @@ -1076,15 +1167,6 @@ "label": "Website:" } }, - "monerium": { - "name": "Monerium EMI ehf. (EEA/Islândia)", - "privacyTos": { - "label": "Privacidade/ToS:" - }, - "website": { - "label": "Website:" - } - }, "mykobo": { "name": "MYKOBO UAB (UE/Lituânia)", "privacy": { @@ -1186,9 +1268,9 @@ "hydrationSwap": "Trocando {{inputAssetSymbol}} por {{outputAssetSymbol}} no Hydration DEX", "hydrationToAssethubXcm": "Transferindo {{assetSymbol}} de Hydration --> AssetHub", "initial": "Iniciando processo", - "moneriumOnrampMint": "Aguardando pagamento", - "moneriumOnrampSelfTransfer": "Transferindo EUR.e para a conta efêmera", "moonbeamToPendulum": "Transferindo {{assetSymbol}} de Moonbeam --> Pendulum", + "mykoboOnrampDeposit": "Aguardando recebimento do pagamento", + "onHoldForComplianceCheck": "Seu pagamento está em espera para uma verificação de compliance. A Vortex continuará automaticamente quando a Avenia liberar.", "pendulumToAssethubXcm": "Transferindo {{assetSymbol}} de Pendulum --> AssetHub", "pendulumToHydrationXcm": "Transferindo {{assetSymbol}} de Pendulum --> Hydration", "pendulumToMoonbeamXcm": "Transferindo {{assetSymbol}} de Pendulum --> Moonbeam", @@ -1247,12 +1329,13 @@ "insufficientFunds": "Saldo insuficiente. Seu saldo é {{userInputTokenBalance}} {{assetSymbol}}", "insufficientLiquidity": "O valor está temporariamente indisponível. Por favor, tente com um valor menor.", "invalidInputAmount": "Valor de entrada inválido", + "invalidNetworks": "Redes inválidas. Por favor, forneça uma lista válida de redes suportadas.", "invalidRampType": "Tipo de rampa inválido", "lessThanMinimumWithdrawal": { "buy": "O valor mínimo de compra é {{minAmountUnits}} {{assetSymbol}}.", "sell": "O valor mínimo de venda é {{minAmountUnits}} {{assetSymbol}}." }, - "lowLiquidity": "Baixa liquidez para esta rota. Por favor, tente um valor menor.", + "lowLiquidity": "Esta rota está temporariamente indisponível devido à baixa liquidez. Tente um valor menor ou volte em breve.", "MXN_tokenUnavailable": "Construa seu trilho MXN - disponível em breve!", "missingFields": "Campos obrigatórios ausentes", "moreThanMaximumWithdrawal": { @@ -1397,13 +1480,17 @@ "title": "Compre e Venda <1>Stablecoins - diretamente com sua conta bancária" }, "popularTokens": { + "countries": { + "description": "Faça on e off-ramp nestas moedas fiduciárias populares", + "title": "Países Suportados" + }, + "cryptocurrencies": { + "description": "criptomoedas suportadas", + "title": "Criptomoedas Suportadas" + }, "networks": { "description": "Negocie em várias redes blockchain", "title": "Redes Suportadas" - }, - "tokens": { - "description": "Negocie estas stablecoins populares", - "title": "Tokens Suportados" } }, "popularTokensPartners": { diff --git a/apps/frontend/src/types/phases.ts b/apps/frontend/src/types/phases.ts index b186b597b..d7034c351 100644 --- a/apps/frontend/src/types/phases.ts +++ b/apps/frontend/src/types/phases.ts @@ -27,9 +27,7 @@ export interface RampExecutionInput { onChainToken: OnChainTokenSymbol; fiatToken: FiatToken; sourceOrDestinationAddress: string; // The source address for offramps, destination address for onramps - moneriumWalletAddress?: string; // Only needed for Monerium offramps to non-EVM chains (e.g. Monerium -> Assethub) ephemerals: { - stellarEphemeral: EphemeralAccount; substrateEphemeral: EphemeralAccount; evmEphemeral: EphemeralAccount; }; diff --git a/apps/frontend/src/types/searchParams.ts b/apps/frontend/src/types/searchParams.ts index 9f8a2cae7..79cc6843e 100644 --- a/apps/frontend/src/types/searchParams.ts +++ b/apps/frontend/src/types/searchParams.ts @@ -19,6 +19,11 @@ export const rampSearchSchema = z.object({ externalSessionId: z.string().optional(), fiat: z.string().optional(), inputAmount: stringOrNumberParam, + // KYB deep link, no quote. Presence enables it; a region-code value (e.g. `?kyb=BR`) prefills the selector. + // Union with boolean so a bare `?kyb` flag validates too. + kyb: z.union([z.string(), z.boolean()]).optional(), + // Like `kyb`, but the region is locked in and the selector is skipped (e.g. `?kybLocked=BR`). + kybLocked: z.union([z.string(), z.boolean()]).optional(), network: z.string().optional(), partnerId: z.string().optional(), paymentMethod: z.string().optional(), diff --git a/apps/frontend/src/types/sep.ts b/apps/frontend/src/types/sep.ts deleted file mode 100644 index 5855234f0..000000000 --- a/apps/frontend/src/types/sep.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { StellarTokenDetails } from "@vortexfi/shared"; - -export interface TomlValues { - signingKey?: string; - webAuthEndpoint?: string; - sep24Url?: string; - sep6Url?: string; - kycServer?: string; -} - -export interface ISep24Intermediate { - url: string; - id: string; -} - -export interface IAnchorSessionParams { - token: string; - tomlValues: TomlValues; - tokenConfig: StellarTokenDetails; - offrampAmount: string; -} - -export interface SepResult { - amount: string; - memo: string; - memoType: string; - offrampingAccount: string; -} diff --git a/apps/frontend/vite.config.ts b/apps/frontend/vite.config.ts index fe6b73253..19f54d97f 100644 --- a/apps/frontend/vite.config.ts +++ b/apps/frontend/vite.config.ts @@ -7,7 +7,9 @@ import { defineConfig } from "vite"; export default defineConfig({ build: { - sourcemap: true, + // "hidden" uploads source maps to Sentry without leaving sourceMappingURL + // comments in the shipped bundles. + sourcemap: "hidden", target: "esnext" }, define: { diff --git a/apps/rebalancer/.env.example b/apps/rebalancer/.env.example index dd128076d..4bfdbd012 100644 --- a/apps/rebalancer/.env.example +++ b/apps/rebalancer/.env.example @@ -1,14 +1,38 @@ ALCHEMY_API_KEY=your_api_key_here +# BIP-39 mnemonic (12/24 words) used to derive the executor EVM account for Base/Polygon/Moonbeam +EVM_ACCOUNT_SECRET="your mnemonic here" + +# Only required for legacy flow (--legacy flag) PENDULUM_ACCOUNT_SECRET="your_secret_here" -MOONBEAM_ACCOUNT_SECRET="your_secret_here" -POLYGON_ACCOUNT_SECRET="your_secret_here" BRLA_LOGIN_USERNAME=test@test.com BRLA_LOGIN_PASSWORD=your_password_here SLACK_WEB_HOOK_TOKEN=your_slack_webhook_token_here -REBALANCING_AMOUNT_USD_TO_BRL=100 +REBALANCING_USD_TO_BRL_AMOUNT=100 SUPABASE_URL=your_supabase_url_here SUPABASE_SERVICE_KEY=your_supabase_service_key_here + +# Maximum total USD bridged per day before the rebalancer stops (default 10,000) +REBALANCING_DAILY_BRIDGE_LIMIT_USD=10000 + +# Coverage ratio thresholds for triggering each route (default 0.01 each, falls back to REBALANCING_THRESHOLD if unset) +# REBALANCING_THRESHOLD=0.01 +# REBALANCING_THRESHOLD_BRLA_TO_USDC=0.01 +# REBALANCING_THRESHOLD_USDC_TO_BRLA=0.01 + +# Cost-aware rebalancing policy. Modes: auto, dry-run, off, always. +# Daily bridge limit is still enforced in every mode. The hard max cost cap is also enforced in always mode. +# REBALANCING_POLICY_MODE=auto +# REBALANCING_MODERATE_DEVIATION_BPS=200 +# REBALANCING_SEVERE_DEVIATION_BPS=500 +# REBALANCING_MAX_COST_BPS_MILD=25 +# REBALANCING_MAX_COST_BPS_MODERATE=75 +# REBALANCING_MAX_COST_BPS_SEVERE=250 +# REBALANCING_HARD_MAX_COST_BPS=1000 + +# Main Nabla instance on Base (BRL→USDC route). Leave empty to disable this route. +MAIN_NABLA_ROUTER=0x... +MAIN_NABLA_QUOTER=0x... diff --git a/apps/rebalancer/README.md b/apps/rebalancer/README.md index eb188f411..65f85f80e 100644 --- a/apps/rebalancer/README.md +++ b/apps/rebalancer/README.md @@ -13,9 +13,10 @@ Then, open the `.env` file and add your Alchemy API key. ``` ALCHEMY_API_KEY=your_alchemy_api_key +EVM_ACCOUNT_SECRET="your BIP-39 mnemonic (12/24 words)" + +# Only required for legacy flow (--legacy flag) PENDULUM_ACCOUNT_SECRET=xxx -MOONBEAM_ACCOUNT_SECRET=xxx -POLYGON_ACCOUNT_SECRET=xxx ``` ## Installation diff --git a/apps/rebalancer/src/index.ts b/apps/rebalancer/src/index.ts index fff8a238f..fc6967532 100644 --- a/apps/rebalancer/src/index.ts +++ b/apps/rebalancer/src/index.ts @@ -1,24 +1,51 @@ import { cryptoWaitReady } from "@polkadot/util-crypto"; +import { multiplyByPowerOfTen } from "@vortexfi/shared"; +import Big from "big.js"; import { rebalanceBrlaToUsdcAxl } from "./rebalance/brla-to-axlusdc"; import { checkInitialPendulumBalance } from "./rebalance/brla-to-axlusdc/steps.ts"; -import { getSwapPoolsWithCoverageRatio } from "./services/indexer"; -import { phaseOrder, RebalancePhase, StateManager } from "./services/stateManager.ts"; +import { rebalanceBrlaToUsdcBase } from "./rebalance/brla-to-usdc-base"; +import { quoteBrlaToUsdcBaseRebalance } from "./rebalance/brla-to-usdc-base/steps.ts"; +import { rebalanceUsdcBrlaUsdcBase } from "./rebalance/usdc-brla-usdc-base"; +import { + type DailyBridgeLimitDecision, + evaluateDailyBridgeLimit, + evaluateRebalancingCostPolicy, + isProjectedProfit, + type RebalancingCostPolicyDecision +} from "./rebalance/usdc-brla-usdc-base/guards.ts"; +import { checkInitialUsdcBalanceOnBase, compareRoutesUpfront } from "./rebalance/usdc-brla-usdc-base/steps.ts"; +import { getBaseNablaCoverageRatio, getSwapPoolsWithCoverageRatio } from "./services/indexer"; +import { + BrlaToAxlUsdcStateManager, + BrlaToUsdcBaseRebalancePhase, + BrlaToUsdcBaseStateManager, + RebalancePhase, + UsdcBaseRebalancePhase, + UsdcBaseStateManager, + type WinningRoute +} from "./services/stateManager.ts"; import { getConfig, getPendulumAccount } from "./utils/config.ts"; const args = process.argv.slice(2); const forceRestart = args.includes("--restart"); +const useLegacy = args.includes("--legacy"); const manualAmount = args.find(arg => !arg.startsWith("--")) || null; +const routeArg = args.find(arg => arg.startsWith("--route=")); +const forcedRoute = routeArg ? (routeArg.split("=")[1] as "squidrouter" | "avenia" | "nabla-main") : undefined; +if (forcedRoute && !["squidrouter", "avenia", "nabla-main"].includes(forcedRoute)) { + console.error("Invalid --route value. Must be 'squidrouter', 'avenia', or 'nabla-main'."); + process.exit(1); +} -async function checkForRebalancing() { +async function checkForRebalancingLegacy() { const config = getConfig(); const amountAxlUsdc = manualAmount || config.rebalancingUsdToBrlAmount; if (forceRestart) { - console.log("Force restart enabled. Starting rebalancing regardless of coverage ratios."); + console.log("Force restart enabled. Starting legacy rebalancing regardless of coverage ratios."); } else { const swapPoolsWithCoverage = await getSwapPoolsWithCoverageRatio(); - // For now, we can only handle automatic rebalancing for USDC.axl and BRLA const brlaPool = swapPoolsWithCoverage.find(pool => pool.pool.token.symbol === "BRLA"); if (!brlaPool) { console.log("No BRLA swap pool found."); @@ -38,11 +65,10 @@ async function checkForRebalancing() { } } - // Proceed with rebalancing await cryptoWaitReady(); const pendulumAccount = getPendulumAccount(); - const stateManager = new StateManager(); + const stateManager = new BrlaToAxlUsdcStateManager(); const state = await stateManager.getState(); const isResuming = !forceRestart && state && state.currentPhase !== RebalancePhase.Idle; @@ -58,7 +84,265 @@ async function checkForRebalancing() { await rebalanceBrlaToUsdcAxl(amountAxlUsdc, forceRestart); } -checkForRebalancing() +async function getTodayBridgedUsdRaw(): Promise { + const usdcStateManager = new UsdcBaseStateManager(); + const brlaStateManager = new BrlaToUsdcBaseStateManager(); + + const [usdcHistory, brlaHistory] = await Promise.all([usdcStateManager.getHistory(), brlaStateManager.getHistory()]); + + const todayStart = new Date(); + todayStart.setUTCHours(0, 0, 0, 0); + + return [...usdcHistory, ...brlaHistory] + .filter(e => new Date(e.startingTime) >= todayStart) + .reduce((sum, e) => sum.plus(Big(e.initialAmount)), Big(0)); +} + +function logDailyLimitDecision(decision: DailyBridgeLimitDecision, dailyLimitUsd: number) { + if (decision.reason === "under_limit") return; + + const projectedTotalUsd = Big(decision.projectedTotalRaw).div(1e6).toFixed(2); + if (decision.reason === "profitable_quote") { + console.log(`Daily bridge limit bypassed (profitable quote): projected $${projectedTotalUsd}, limit $${dailyLimitUsd}.`); + return; + } + + console.log(`Daily bridge limit reached: projected $${projectedTotalUsd}, limit $${dailyLimitUsd}. Skipping.`); +} + +function calculateCoverageDeviationBps(coverageRatio: number, triggerBound: number): number { + return Number( + Big(Math.abs(coverageRatio - triggerBound)) + .mul(10_000) + .toFixed(2) + ); +} + +function getQuoteForRoute( + route: Exclude, + quotes: { + squidRouterQuoteUsdc: string | null; + aveniaQuoteUsdc: string | null; + mainNablaQuoteUsdc: string | null; + } +): string | null { + if (route === "squidrouter") return quotes.squidRouterQuoteUsdc; + if (route === "avenia") return quotes.aveniaQuoteUsdc; + return quotes.mainNablaQuoteUsdc; +} + +function logCostPolicyDecision( + direction: string, + inputAmountRaw: string, + projectedOutputRaw: string, + decision: RebalancingCostPolicyDecision +) { + const inputUsdc = Big(inputAmountRaw).div(1e6).toFixed(6); + const projectedUsdc = Big(projectedOutputRaw).div(1e6).toFixed(6); + const projectedCostUsdc = Big(decision.projectedCostRaw).div(1e6).toFixed(6); + console.log( + [ + `Rebalancing cost policy (${direction}): ${decision.shouldExecute ? "execute" : "skip"}`, + `band=${decision.band}`, + `cost=${decision.costBps}bps`, + `allowed=${decision.allowedCostBps}bps`, + `input=${inputUsdc} USDC`, + `projectedOutput=${projectedUsdc} USDC`, + `projectedCost=${projectedCostUsdc} USDC`, + `reason=${decision.reason}` + ].join(" | ") + ); +} + +async function evaluateUsdcToBrlaPolicy( + amountUsdcRaw: string, + coverageDeviationBps: number +): Promise<{ + decision: RebalancingCostPolicyDecision; + profitable: boolean; + shouldExecute: boolean; + routeToRun?: Exclude; +}> { + const config = getConfig(); + if (config.rebalancingCostPolicy.mode === "off") { + const decision = evaluateRebalancingCostPolicy( + Big(amountUsdcRaw), + Big(amountUsdcRaw), + coverageDeviationBps, + config.rebalancingCostPolicy + ); + logCostPolicyDecision("USDC->BRLA->USDC", amountUsdcRaw, amountUsdcRaw, decision); + return { decision, profitable: false, shouldExecute: false }; + } + + const comparison = await compareRoutesUpfront(amountUsdcRaw); + const routeToRun = forcedRoute || comparison.winningRoute; + if (!routeToRun) throw new Error("Route comparison did not select a route."); + + const projectedOutputRaw = getQuoteForRoute(routeToRun, comparison); + if (!projectedOutputRaw) throw new Error(`Forced route ${routeToRun} did not return a quote.`); + + const decision = evaluateRebalancingCostPolicy( + Big(amountUsdcRaw), + Big(projectedOutputRaw), + coverageDeviationBps, + config.rebalancingCostPolicy + ); + logCostPolicyDecision(`USDC->BRLA->USDC via ${routeToRun}`, amountUsdcRaw, projectedOutputRaw, decision); + + return { + decision, + profitable: isProjectedProfit(Big(amountUsdcRaw), Big(projectedOutputRaw)), + routeToRun, + shouldExecute: decision.shouldExecute + }; +} + +async function evaluateBrlaToUsdcPolicy( + amountUsdcRaw: string, + coverageDeviationBps: number +): Promise<{ decision: RebalancingCostPolicyDecision; profitable: boolean; shouldExecute: boolean }> { + const config = getConfig(); + if (config.rebalancingCostPolicy.mode === "off") { + const decision = evaluateRebalancingCostPolicy( + Big(amountUsdcRaw), + Big(amountUsdcRaw), + coverageDeviationBps, + config.rebalancingCostPolicy + ); + logCostPolicyDecision("BRLA->USDC", amountUsdcRaw, amountUsdcRaw, decision); + return { decision, profitable: false, shouldExecute: false }; + } + + const quote = await quoteBrlaToUsdcBaseRebalance(amountUsdcRaw); + const decision = evaluateRebalancingCostPolicy( + Big(amountUsdcRaw), + Big(quote.projectedUsdcRaw), + coverageDeviationBps, + config.rebalancingCostPolicy + ); + logCostPolicyDecision("BRLA->USDC", amountUsdcRaw, quote.projectedUsdcRaw, decision); + + return { + decision, + profitable: isProjectedProfit(Big(amountUsdcRaw), Big(quote.projectedUsdcRaw)), + shouldExecute: decision.shouldExecute + }; +} + +async function runUsdcToBrla(bridgedToday: Big, dailyLimitRaw: Big, coverageDeviationBps: number) { + const config = getConfig(); + const amountUsdc = manualAmount || config.rebalancingUsdToBrlAmount; + const amountUsdcRaw = multiplyByPowerOfTen(new Big(amountUsdc), 6).toFixed(0, 0); + + const stateManager = new UsdcBaseStateManager(); + const state = await stateManager.getState(); + const isResuming = !forceRestart && state && state.currentPhase !== UsdcBaseRebalancePhase.Idle; + + if (!isResuming) { + const policyDecision = await evaluateUsdcToBrlaPolicy(amountUsdcRaw, coverageDeviationBps); + if (!policyDecision.shouldExecute) return; + + const dailyLimitDecision = evaluateDailyBridgeLimit( + bridgedToday, + Big(amountUsdcRaw), + dailyLimitRaw, + policyDecision.profitable + ); + logDailyLimitDecision(dailyLimitDecision, config.rebalancingDailyBridgeLimitUsd); + if (dailyLimitDecision.shouldSkip) return; + + await checkInitialUsdcBalanceOnBase(amountUsdcRaw); + await rebalanceUsdcBrlaUsdcBase(amountUsdcRaw, forceRestart, policyDecision.routeToRun, { + config: config.rebalancingCostPolicy, + decision: policyDecision.decision, + deviationBps: coverageDeviationBps + }); + return; + } + + await rebalanceUsdcBrlaUsdcBase(amountUsdcRaw, forceRestart, forcedRoute); +} + +async function runBrlaToUsdc(bridgedToday: Big, dailyLimitRaw: Big, coverageDeviationBps: number) { + const config = getConfig(); + const amountUsdc = manualAmount || config.rebalancingBrlToUsdAmount; + const amountUsdcRaw = multiplyByPowerOfTen(new Big(amountUsdc), 6).toFixed(0, 0); + + const stateManager = new BrlaToUsdcBaseStateManager(); + const state = await stateManager.getState(); + const isResuming = !forceRestart && state && state.currentPhase !== BrlaToUsdcBaseRebalancePhase.Idle; + + if (!isResuming) { + const policyDecision = await evaluateBrlaToUsdcPolicy(amountUsdcRaw, coverageDeviationBps); + if (!policyDecision.shouldExecute) return; + + const dailyLimitDecision = evaluateDailyBridgeLimit( + bridgedToday, + Big(amountUsdcRaw), + dailyLimitRaw, + policyDecision.profitable + ); + logDailyLimitDecision(dailyLimitDecision, config.rebalancingDailyBridgeLimitUsd); + if (dailyLimitDecision.shouldSkip) return; + + const rebalancerUsdcBalance = await checkInitialUsdcBalanceOnBase(amountUsdcRaw); + if (config.rebalancingBrlToUsdMinBalance && rebalancerUsdcBalance.lt(config.rebalancingBrlToUsdMinBalance)) { + throw new Error( + `Rebalancer USDC balance ${rebalancerUsdcBalance} is below the minimum required balance of ${config.rebalancingBrlToUsdMinBalance} to perform rebalancing.` + ); + } + await rebalanceBrlaToUsdcBase(amountUsdcRaw, forceRestart, { + config: config.rebalancingCostPolicy, + decision: policyDecision.decision, + deviationBps: coverageDeviationBps + }); + return; + } + + await rebalanceBrlaToUsdcBase(amountUsdcRaw, forceRestart); +} + +async function checkForRebalancing() { + const config = getConfig(); + const coverage = await getBaseNablaCoverageRatio(); + + if (!coverage) throw new Error("Failed to fetch Base Nabla coverage ratio."); + + const lowerBound = 1 - config.rebalancingThresholdBrlaToUsdc; + const upperBound = 1 + config.rebalancingThresholdUsdcToBrla; + + if (coverage.brlaCoverageRatio >= lowerBound && coverage.brlaCoverageRatio <= upperBound) { + console.log(`BRLA coverage ${coverage.brlaCoverageRatio} in range [${lowerBound}, ${upperBound}]. No rebalancing needed.`); + return; + } + + const bridgedToday = await getTodayBridgedUsdRaw(); + const dailyLimitRaw = multiplyByPowerOfTen(Big(config.rebalancingDailyBridgeLimitUsd), 6); + console.log( + `Bridged $${bridgedToday.div(1e6).toFixed(2)} today. Daily bridge limit is $${config.rebalancingDailyBridgeLimitUsd}.` + ); + + if (coverage.brlaCoverageRatio < lowerBound) { + const deviationBps = calculateCoverageDeviationBps(coverage.brlaCoverageRatio, lowerBound); + console.log( + `BRLA coverage ${coverage.brlaCoverageRatio} < ${lowerBound}. Evaluating BRLA->USDC (${deviationBps} bps deviation).` + ); + await runBrlaToUsdc(bridgedToday, dailyLimitRaw, deviationBps); + return; + } + + const deviationBps = calculateCoverageDeviationBps(coverage.brlaCoverageRatio, upperBound); + console.log( + `BRLA coverage ${coverage.brlaCoverageRatio} > ${upperBound}. Evaluating USDC->BRLA (${deviationBps} bps deviation).` + ); + await runUsdcToBrla(bridgedToday, dailyLimitRaw, deviationBps); +} + +const rebalanceFn = useLegacy ? checkForRebalancingLegacy : checkForRebalancing; +console.log(`Using ${useLegacy ? "legacy" : "new"} rebalancing flow.`); + +rebalanceFn() .then(() => { console.log("Rebalancing process completed successfully."); process.exit(0); diff --git a/apps/rebalancer/src/rebalance/brla-to-axlusdc/index.ts b/apps/rebalancer/src/rebalance/brla-to-axlusdc/index.ts index f43bcc961..cb63e5774 100644 --- a/apps/rebalancer/src/rebalance/brla-to-axlusdc/index.ts +++ b/apps/rebalancer/src/rebalance/brla-to-axlusdc/index.ts @@ -1,7 +1,7 @@ import { multiplyByPowerOfTen, SlackNotifier } from "@vortexfi/shared"; import Big from "big.js"; import { brlaMoonbeamTokenDetails, usdcTokenDetails } from "../../constants.ts"; -import { phaseOrder, RebalancePhase, StateManager } from "../../services/stateManager.ts"; +import { BrlaToAxlUsdcStateManager, phaseOrder, RebalancePhase } from "../../services/stateManager.ts"; import { getMoonbeamEvmClients, getPendulumAccount } from "../../utils/config.ts"; import { checkInitialPendulumBalance, @@ -20,7 +20,7 @@ import { export async function rebalanceBrlaToUsdcAxl(amountAxlUsdc: string, forceRestart = false) { console.log(`Starting rebalance from BRLA to USDC.axl with amount: ${amountAxlUsdc}`); - const stateManager = new StateManager(); + const stateManager = new BrlaToAxlUsdcStateManager(); let state = await stateManager.getState(); console.log("Fetched rebalance state from storage.", state); @@ -45,7 +45,7 @@ export async function rebalanceBrlaToUsdcAxl(amountAxlUsdc: string, forceRestart const moonbeamAccountAddress = moonbeamWalletClient.account.address; // Step 1: Check initial balance - if (currentOrder <= 1) { + if (currentOrder <= phaseOrder[RebalancePhase.CheckInitialPendulumBalance]) { if (!state.amountAxlUsdc) throw new Error("State corrupted: amountAxlUsdc missing for step 1"); state.initialBalance = await checkInitialPendulumBalance(pendulumAccount.address, state.amountAxlUsdc); @@ -55,7 +55,7 @@ export async function rebalanceBrlaToUsdcAxl(amountAxlUsdc: string, forceRestart } // Step 2: Swap USDC.axl to BRLA on Pendulum - if (currentOrder <= 2) { + if (currentOrder <= phaseOrder[RebalancePhase.SwapAxlusdcToBrla]) { if (!state.amountAxlUsdc) throw new Error("State corrupted: amountAxlUsdc missing for step 2"); state.brlaAmount = Big((await swapAxlusdcToBrla(state.amountAxlUsdc)).toFixed(2, 0)); @@ -66,7 +66,7 @@ export async function rebalanceBrlaToUsdcAxl(amountAxlUsdc: string, forceRestart } // Step 3: Send BRLA to Moonbeam via XCM - if (currentOrder <= 3) { + if (currentOrder <= phaseOrder[RebalancePhase.SendBrlaToMoonbeam]) { if (!state.brlaAmount) throw new Error("State corrupted: brlaAmount missing for step 3"); await sendBrlaToMoonbeam(state.brlaAmount, brlaMoonbeamTokenDetails.pendulumRepresentative); @@ -77,7 +77,7 @@ export async function rebalanceBrlaToUsdcAxl(amountAxlUsdc: string, forceRestart } // Step 4: Wait for BRLA to appear on the internal Avenia balance. - if (currentOrder <= 4) { + if (currentOrder <= phaseOrder[RebalancePhase.PollForSufficientBalance]) { if (!state.brlaAmount) throw new Error("State corrupted: brlaAmount missing for step 4"); await pollForSufficientBalance(state.brlaAmount); @@ -88,7 +88,7 @@ export async function rebalanceBrlaToUsdcAxl(amountAxlUsdc: string, forceRestart } // Step 5: Swap BRLA to USDC.e using Avenia, deposits swapped amount on polygon. - if (currentOrder <= 5) { + if (currentOrder <= phaseOrder[RebalancePhase.SwapBrlaToUsdcOnBrlaApiService]) { if (!state.brlaAmount) throw new Error("State corrupted: brlaAmount missing for step 5"); const quote = await swapBrlaToUsdcOnBrlaApiService(state.brlaAmount, moonbeamAccountAddress as `0x${string}`); @@ -99,7 +99,7 @@ export async function rebalanceBrlaToUsdcAxl(amountAxlUsdc: string, forceRestart } // Step 6: Swap and transfer USDC.e from Polygon to USDC.axl on Moonbeam using SquidRouter - if (currentOrder <= 6) { + if (currentOrder <= phaseOrder[RebalancePhase.TransferUsdcToMoonbeamWithSquidrouter]) { if (!state.brlaToUsdcAmountUsd) throw new Error("State corrupted: brlaToUsdcAmountUsd missing for step 6"); const usdcAmountRaw = state.usdcAmountRaw || multiplyByPowerOfTen(state.brlaToUsdcAmountUsd, usdcTokenDetails.decimals).toFixed(0, 0); @@ -113,7 +113,7 @@ export async function rebalanceBrlaToUsdcAxl(amountAxlUsdc: string, forceRestart } // Step 7: Trigger XCM from Moonbeam to send USDC.axl back to Pendulum - if (currentOrder <= 7) { + if (currentOrder <= phaseOrder[RebalancePhase.TriggerXcmFromMoonbeam]) { if (!state.squidRouterReceiverId) throw new Error("State corrupted: squidRouterReceiverId missing for step 7"); // Wait for 30 seconds to ensure the SquidRouter transaction is processed await new Promise(resolve => setTimeout(resolve, 30000)); @@ -125,7 +125,7 @@ export async function rebalanceBrlaToUsdcAxl(amountAxlUsdc: string, forceRestart } // Step 8: Wait for USDC.axl to arrive on Pendulum - if (currentOrder <= 8) { + if (currentOrder <= phaseOrder[RebalancePhase.WaitForAxlUsdcOnPendulum]) { if (!state.initialBalance) throw new Error("State corrupted: initialBalance missing for step 8"); await waitForAxlUsdcOnPendulum(pendulumAccount.address, state.initialBalance); @@ -155,7 +155,7 @@ export async function rebalanceBrlaToUsdcAxl(amountAxlUsdc: string, forceRestart `Rebalancing cost: absolute: ${rebalancingCost.toFixed(6)} | relative: ${Big(1).sub(finalBalance.div(state.initialBalance)).toFixed(4, 0)}` ); - const slackNotifier = new SlackNotifier(); + const slackNotifier = new SlackNotifier(process.env.SLACK_WEB_HOOK_TOKEN); await slackNotifier.sendMessage({ text: `Rebalance from BRLA to USDC.axl completed successfully! Initial balance: ${state.initialBalance.toFixed(4, 0)}, final balance: ${finalBalance.toFixed(4, 0)}\n` + diff --git a/apps/rebalancer/src/rebalance/brla-to-axlusdc/steps.ts b/apps/rebalancer/src/rebalance/brla-to-axlusdc/steps.ts index 64672bf1a..4aa84cab0 100644 --- a/apps/rebalancer/src/rebalance/brla-to-axlusdc/steps.ts +++ b/apps/rebalancer/src/rebalance/brla-to-axlusdc/steps.ts @@ -5,8 +5,6 @@ import { ApiManager, AveniaFeeType, AveniaPaymentMethod, - AveniaSwapTicket, - AveniaTicketStatus, BrlaApiService, BrlaCurrency, checkEvmBalancePeriodically, @@ -34,42 +32,11 @@ import { import Big from "big.js"; import { encodeFunctionData } from "viem"; import { polygon } from "viem/chains"; -import { brlaFiatTokenDetails, brlaMoonbeamTokenDetails, usdcTokenDetails } from "../../constants.ts"; +import { brlaMoonbeamTokenDetails, usdcTokenDetails } from "../../constants.ts"; +import { checkTicketStatusPaid } from "../../utils/brla.ts"; import { getConfig, getMoonbeamEvmClients, getPendulumAccount, getPolygonEvmClients } from "../../utils/config.ts"; import { waitForTransactionConfirmation } from "../../utils/transactions.ts"; -async function checkTicketStatusPaid(brlaApiService: BrlaApiService, ticketId: string): Promise { - const pollInterval = 5000; // 5 seconds - const timeout = 5 * 60 * 1000; // 5 minutes - const startTime = Date.now(); - let lastError: any; - - while (Date.now() - startTime < timeout) { - try { - const ticket = await brlaApiService.getAveniaSwapTicket(ticketId); - if (ticket && ticket.status) { - if (ticket.status === AveniaTicketStatus.PAID) { - return ticket; - } - if (ticket.status === AveniaTicketStatus.FAILED) { - throw new Error("Ticket status is FAILED"); - } - } - } catch (error) { - lastError = error; - console.warn(`Polling for ticket ${ticketId} status failed with error. Retrying...`, lastError); - } - await new Promise(resolve => setTimeout(resolve, pollInterval)); - } - - if (lastError) { - console.error("Polling for ticket status timed out with an error: ", lastError); - throw new Error(`Polling for ticket status timed out with an error: ${lastError.message}`); - } - - throw new Error("Polling for ticket status timed out."); -} - export async function checkInitialPendulumBalance(pendulumAddress: string, requiredAmount: string): Promise { const apiManager = ApiManager.getInstance(); const pendulumNode = await apiManager.getApi("pendulum"); @@ -280,7 +247,7 @@ export async function transferUsdcToMoonbeamWithSquidrouter(usdcAmountRaw: strin /// Swaps BRLA to USDC on BRLA API service and transfer them to the receiver address. export async function swapBrlaToUsdcOnBrlaApiService(brlaAmount: Big, receiverAddress: `0x${string}`) { const aveniaOnchainSwapParams: OnchainSwapQuoteParams = { - inputAmount: brlaAmount.toFixed(12, 0), + inputAmount: brlaAmount.toFixed(4, 0), inputCurrency: BrlaCurrency.BRLA, outputCurrency: BrlaCurrency.USDC }; diff --git a/apps/rebalancer/src/rebalance/brla-to-usdc-base/guards.ts b/apps/rebalancer/src/rebalance/brla-to-usdc-base/guards.ts new file mode 100644 index 000000000..d71de3cf3 --- /dev/null +++ b/apps/rebalancer/src/rebalance/brla-to-usdc-base/guards.ts @@ -0,0 +1,5 @@ +import Big from "big.js"; + +export function wouldExceedDailySwapLimit(swappedTodayRaw: Big, requestedAmountRaw: Big, dailyLimitRaw: Big): boolean { + return swappedTodayRaw.plus(requestedAmountRaw).gt(dailyLimitRaw); +} diff --git a/apps/rebalancer/src/rebalance/brla-to-usdc-base/index.ts b/apps/rebalancer/src/rebalance/brla-to-usdc-base/index.ts new file mode 100644 index 000000000..65873cbd9 --- /dev/null +++ b/apps/rebalancer/src/rebalance/brla-to-usdc-base/index.ts @@ -0,0 +1,108 @@ +import { multiplyByPowerOfTen, SlackNotifier } from "@vortexfi/shared"; +import Big from "big.js"; +import { + BrlaToUsdcBaseRebalancePhase, + BrlaToUsdcBaseStateManager, + brlaToUsdcBasePhaseOrder +} from "../../services/stateManager.ts"; +import { getBaseEvmClients, getConfig } from "../../utils/config.ts"; +import { NonceManager } from "../../utils/nonce.ts"; +import type { RebalancePolicySummary } from "../usdc-brla-usdc-base/notifications.ts"; +import { checkInitialUsdcBalanceOnBase } from "../usdc-brla-usdc-base/steps.ts"; +import { formatBrlaToUsdcBaseCompletionMessage } from "./notifications.ts"; +import { mainNablaSwapUsdcToBrlaOnBase, nablaSwapBrlaToUsdcOnBase, verifyFinalUsdcBalanceOnBase } from "./steps.ts"; + +export async function rebalanceBrlaToUsdcBase(usdcAmountRaw: string, forceRestart = false, policy?: RebalancePolicySummary) { + console.log(`Starting USDC→BRLA→USDC rebalance on Base with amount: ${usdcAmountRaw} (raw USDC)`); + + const stateManager = new BrlaToUsdcBaseStateManager(); + let state = await stateManager.getState(); + console.log("Fetched rebalance state from storage.", state); + + const isResuming = !forceRestart && state && state.currentPhase !== BrlaToUsdcBaseRebalancePhase.Idle; + if (isResuming) { + console.log(`Resuming rebalance from phase: ${state?.currentPhase}`); + } else { + state = await stateManager.startNewRebalance(usdcAmountRaw); + } + + if (!state) { + throw new Error("State is undefined after initialization."); + } + + const { publicClient: basePublicClient, walletClient: baseWalletClient } = getBaseEvmClients(); + const baseAddress = baseWalletClient.account.address; + const baseNonce = await NonceManager.create(basePublicClient, baseAddress as `0x${string}`); + + const currentOrder = brlaToUsdcBasePhaseOrder[state.currentPhase]; + console.log(`Current phase order: ${currentOrder}`); + + if (currentOrder <= brlaToUsdcBasePhaseOrder[BrlaToUsdcBaseRebalancePhase.CheckInitialUsdcBalance]) { + if (!state.usdcAmountRaw) throw new Error("State corrupted: usdcAmountRaw missing for step 1"); + + const initialBalance = await checkInitialUsdcBalanceOnBase(state.usdcAmountRaw); + state.initialUsdcBalance = initialBalance.toString(); + state.currentPhase = BrlaToUsdcBaseRebalancePhase.MainNablaSwapUsdcToBrla; + await stateManager.saveState(state); + } + + if (currentOrder <= brlaToUsdcBasePhaseOrder[BrlaToUsdcBaseRebalancePhase.MainNablaSwapUsdcToBrla]) { + if (!state.usdcAmountRaw) throw new Error("State corrupted: usdcAmountRaw missing for step 2"); + + await mainNablaSwapUsdcToBrlaOnBase(state.usdcAmountRaw, baseNonce, state, stateManager); + + state.currentPhase = BrlaToUsdcBaseRebalancePhase.NablaSwapBrlaToUsdc; + await stateManager.saveState(state); + } + + if (currentOrder <= brlaToUsdcBasePhaseOrder[BrlaToUsdcBaseRebalancePhase.NablaSwapBrlaToUsdc]) { + if (!state.mainNablaBrlaReceivedRaw) throw new Error("State corrupted: mainNablaBrlaReceivedRaw missing for step 3"); + + await nablaSwapBrlaToUsdcOnBase(state.mainNablaBrlaReceivedRaw, baseNonce, state, stateManager); + + state.currentPhase = BrlaToUsdcBaseRebalancePhase.VerifyFinalBalance; + await stateManager.saveState(state); + } + + if (currentOrder <= brlaToUsdcBasePhaseOrder[BrlaToUsdcBaseRebalancePhase.VerifyFinalBalance]) { + const finalBalance = await verifyFinalUsdcBalanceOnBase(); + state.finalUsdcBalance = finalBalance.toString(); + + state.currentPhase = BrlaToUsdcBaseRebalancePhase.Idle; + await stateManager.saveState(state); + } + + if (!state.usdcAmountRaw) throw new Error("State corrupted: usdcAmountRaw missing at completion"); + if (!state.usdcReceivedRaw) throw new Error("State corrupted: usdcReceivedRaw missing at completion"); + if (!state.mainNablaBrlaReceivedRaw) throw new Error("State corrupted: mainNablaBrlaReceivedRaw missing at completion"); + + const usdcIn = multiplyByPowerOfTen(Big(state.usdcAmountRaw), -6); + const brlaIntermediate = multiplyByPowerOfTen(Big(state.mainNablaBrlaReceivedRaw), -18); + const usdcOut = multiplyByPowerOfTen(Big(state.usdcReceivedRaw), -6); + const cost = usdcIn.minus(usdcOut); + const costRelative = usdcIn.gt(0) ? cost.div(usdcIn).toFixed(4, 0) : "N/A"; + + console.log( + `Rebalance completed! USDC in: ${usdcIn.toFixed(6)}, BRLA intermediate: ${brlaIntermediate.toFixed(6)}, USDC out: ${usdcOut.toFixed(6)}` + ); + console.log(`Cost: absolute: ${cost.toFixed(6)} USDC | relative: ${costRelative}`); + + await stateManager.addHistoryEntry({ + cost: cost.toFixed(6), + costRelative, + endingTime: new Date().toISOString(), + initialAmount: state.usdcAmountRaw, + startingTime: state.startingTime + }); + + const slackNotifier = new SlackNotifier(process.env.SLACK_WEB_HOOK_TOKEN); + await slackNotifier.sendMessage({ + text: formatBrlaToUsdcBaseCompletionMessage({ + brlaIntermediate, + cost, + policy: policy ?? { config: getConfig().rebalancingCostPolicy }, + usdcIn, + usdcOut + }) + }); +} diff --git a/apps/rebalancer/src/rebalance/brla-to-usdc-base/notifications.test.ts b/apps/rebalancer/src/rebalance/brla-to-usdc-base/notifications.test.ts new file mode 100644 index 000000000..3c9e19580 --- /dev/null +++ b/apps/rebalancer/src/rebalance/brla-to-usdc-base/notifications.test.ts @@ -0,0 +1,44 @@ +import {describe, expect, test} from "bun:test"; +import Big from "big.js"; +import {formatBrlaToUsdcBaseCompletionMessage} from "./notifications.ts"; + +const policyConfig = { + hardMaxCostBps: 1_000, + maxCostBpsMild: 25, + maxCostBpsModerate: 75, + maxCostBpsSevere: 250, + mode: "auto" as const, + moderateDeviationBps: 200, + severeDeviationBps: 500 +}; + +describe("BRLA to USDC Base Slack notifications", () => { + test("formats summary and policy bounds in Slack-friendly code tables", () => { + const message = formatBrlaToUsdcBaseCompletionMessage({ + brlaIntermediate: Big("994.5"), + cost: Big("8.5"), + policy: { + config: policyConfig, + decision: { + allowedCostBps: 250, + band: "severe", + costBps: 85, + dryRun: false, + projectedCostRaw: "8500000", + reason: "Projected cost 85 bps is within severe limit 250 bps.", + shouldExecute: true + }, + deviationBps: 520 + }, + usdcIn: Big("1000"), + usdcOut: Big("991.5") + }); + + expect(message).toContain("*Summary*"); + expect(message).toContain("Route USDC in BRLA mid USDC out Cost Cost bps"); + expect(message).toContain("Main+BRLA Nabla 1000.000000 994.500000 991.500000 8.500000 85.00"); + expect(message).not.toContain("0.85%"); + expect(message).toContain("*Policy*"); + expect(message).toContain("auto execute severe 520 85 250 1000"); + }); +}); diff --git a/apps/rebalancer/src/rebalance/brla-to-usdc-base/notifications.ts b/apps/rebalancer/src/rebalance/brla-to-usdc-base/notifications.ts new file mode 100644 index 000000000..3ce9e2958 --- /dev/null +++ b/apps/rebalancer/src/rebalance/brla-to-usdc-base/notifications.ts @@ -0,0 +1,38 @@ +import Big from "big.js"; +import { + formatCompactTable, + formatCostBps, + formatPolicySummary, + type RebalancePolicySummary +} from "../usdc-brla-usdc-base/notifications.ts"; + +interface BrlaToUsdcBaseCompletionMessageParams { + brlaIntermediate: Big; + cost: Big; + policy?: RebalancePolicySummary; + usdcIn: Big; + usdcOut: Big; +} + +export function formatBrlaToUsdcBaseCompletionMessage(params: BrlaToUsdcBaseCompletionMessageParams): string { + return [ + "✅ *Base rebalancer completed (Main Nabla → BRLA Nabla)*", + "USDC → BRLA (Main Nabla) → USDC (BRLA Nabla)", + "", + "*Summary*", + formatCompactTable( + ["Route", "USDC in", "BRLA mid", "USDC out", "Cost", "Cost bps"], + [ + [ + "Main+BRLA Nabla", + params.usdcIn.toFixed(6), + params.brlaIntermediate.toFixed(6), + params.usdcOut.toFixed(6), + params.cost.toFixed(6), + formatCostBps(params.cost, params.usdcIn) + ] + ] + ), + formatPolicySummary(params.policy) + ].join("\n"); +} diff --git a/apps/rebalancer/src/rebalance/brla-to-usdc-base/steps.ts b/apps/rebalancer/src/rebalance/brla-to-usdc-base/steps.ts new file mode 100644 index 000000000..01a21c597 --- /dev/null +++ b/apps/rebalancer/src/rebalance/brla-to-usdc-base/steps.ts @@ -0,0 +1,377 @@ +import { + createNablaTransactionsForOnrampOnEVM, + EphemeralAccountType, + ERC20_BRLA_BASE, + EvmClientManager, + multiplyByPowerOfTen, + NABLA_QUOTER_BASE_BRLA, + NABLA_ROUTER_BASE_BRLA, + Networks +} from "@vortexfi/shared"; +import Big from "big.js"; +import { erc20Abi } from "viem"; +import { base } from "viem/chains"; +import { BrlaToUsdcBaseRebalanceState, BrlaToUsdcBaseStateManager } from "../../services/stateManager.ts"; +import { getBaseEvmClients, getConfig } from "../../utils/config.ts"; +import { NonceManager } from "../../utils/nonce.ts"; +import { waitForTransactionConfirmation } from "../../utils/transactions.ts"; + +export const USDC_BASE: `0x${string}` = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"; + +const NABLA_SWAP_DEADLINE_MINUTES = 60 * 24 * 7; +const AMM_MINIMUM_OUTPUT_HARD_MARGIN = 0.05; + +const NABLA_QUOTE_ABI = [ + { + inputs: [ + { name: "_amountIn", type: "uint256" }, + { name: "_tokenPath", type: "address[]" }, + { name: "_routerPath", type: "address[]" } + ], + name: "quoteSwapExactTokensForTokens", + outputs: [{ name: "amountOut_", type: "uint256" }], + stateMutability: "view", + type: "function" + } +] as const; + +// BRLA→USDC swap uses the BRLA Nabla pool (not the main pool) +const BRLA_NABLA_ROUTER = NABLA_ROUTER_BASE_BRLA; +const BRLA_NABLA_QUOTER = NABLA_QUOTER_BASE_BRLA; + +export async function getUsdcBalanceOnBaseRaw(): Promise { + const { publicClient, walletClient } = getBaseEvmClients(); + const balance = await publicClient.readContract({ + abi: erc20Abi, + address: USDC_BASE, + args: [walletClient.account.address], + functionName: "balanceOf" + }); + return balance.toString(); +} + +export async function getBrlaBalanceOnBaseRaw(): Promise { + const { publicClient, walletClient } = getBaseEvmClients(); + const balance = await publicClient.readContract({ + abi: erc20Abi, + address: ERC20_BRLA_BASE, + args: [walletClient.account.address], + functionName: "balanceOf" + }); + return balance.toString(); +} + +export async function quoteMainNablaUsdcToBrlaOnBase(usdcAmountRaw: string): Promise { + const { router, quoter } = getMainNablaConfig(); + const evmClientManager = EvmClientManager.getInstance(); + + const expectedOutputRaw = await evmClientManager.readContractWithRetry(Networks.Base, { + abi: MAIN_NABLA_QUOTE_ABI, + address: quoter, + args: [BigInt(usdcAmountRaw), [USDC_BASE, ERC20_BRLA_BASE], [router]], + functionName: "quoteSwapExactTokensForTokens" + }); + + const expectedOutputDecimal = multiplyByPowerOfTen(Big(expectedOutputRaw.toString()), -18); + console.log(`Main Nabla preflight quote: ${expectedOutputDecimal.toFixed(6)} BRLA`); + return expectedOutputRaw.toString(); +} + +export async function quoteBrlaNablaToUsdcOnBase(brlaAmountRaw: string): Promise { + const evmClientManager = EvmClientManager.getInstance(); + + const expectedOutputRaw = await evmClientManager.readContractWithRetry(Networks.Base, { + abi: NABLA_QUOTE_ABI, + address: BRLA_NABLA_QUOTER, + args: [BigInt(brlaAmountRaw), [ERC20_BRLA_BASE, USDC_BASE], [BRLA_NABLA_ROUTER]], + functionName: "quoteSwapExactTokensForTokens" + }); + + const expectedOutputDecimal = multiplyByPowerOfTen(Big(expectedOutputRaw.toString()), -6); + console.log(`BRLA Nabla preflight quote: ${expectedOutputDecimal.toFixed(6)} USDC`); + return expectedOutputRaw.toString(); +} + +export async function quoteBrlaToUsdcBaseRebalance(usdcAmountRaw: string): Promise<{ + estimatedBrlaRaw: string; + projectedUsdcRaw: string; +}> { + const estimatedBrlaRaw = await quoteMainNablaUsdcToBrlaOnBase(usdcAmountRaw); + const projectedUsdcRaw = await quoteBrlaNablaToUsdcOnBase(estimatedBrlaRaw); + + return { estimatedBrlaRaw, projectedUsdcRaw }; +} + +export async function nablaSwapBrlaToUsdcOnBase( + brlaAmountRaw: string, + baseNonce: NonceManager, + state: BrlaToUsdcBaseRebalanceState, + stateManager: BrlaToUsdcBaseStateManager +): Promise { + const { walletClient, publicClient } = getBaseEvmClients(); + const executorAddress = walletClient.account.address; + + console.log(`Starting BRLA Nabla swap of ${brlaAmountRaw} BRLA (raw) to USDC on Base...`); + + if (state.nablaApproveHash && state.nablaSwapHash && state.usdcReceivedRaw) { + console.log("Resuming BRLA Nabla swap with previously recorded hashes."); + return state.usdcReceivedRaw; + } + + if (state.nablaSwapHash && !state.usdcBalanceBeforeNablaRaw) { + throw new Error("State corrupted: missing pre-Nabla USDC balance baseline for completed swap."); + } + + if (!state.usdcBalanceBeforeNablaRaw) { + state.usdcBalanceBeforeNablaRaw = await getUsdcBalanceOnBaseRaw(); + await stateManager.saveState(state); + } + const usdcBalanceBefore = BigInt(state.usdcBalanceBeforeNablaRaw); + + let approveHash = state.nablaApproveHash; + let swapHash = state.nablaSwapHash; + + if (!swapHash) { + const expectedOutputRaw = BigInt(await quoteBrlaNablaToUsdcOnBase(brlaAmountRaw)); + + const expectedOutputDecimal = multiplyByPowerOfTen(Big(expectedOutputRaw.toString()), -6); + console.log(`Expected USDC output: ${expectedOutputDecimal.toFixed(6)}`); + + const nablaHardMinimumOutputRaw = Big(expectedOutputRaw.toString()) + .mul(1 - AMM_MINIMUM_OUTPUT_HARD_MARGIN) + .toFixed(0, 0); + + const { approve, swap } = await createNablaTransactionsForOnrampOnEVM( + brlaAmountRaw, + { address: executorAddress, type: EphemeralAccountType.EVM }, + ERC20_BRLA_BASE, + USDC_BASE, + nablaHardMinimumOutputRaw, + NABLA_SWAP_DEADLINE_MINUTES, + BRLA_NABLA_ROUTER + ); + + if (!approveHash) { + console.log("Sending BRLA Nabla approve transaction on Base..."); + const { maxFeePerGas: approveFee, maxPriorityFeePerGas: approveTip } = await publicClient.estimateFeesPerGas(); + approveHash = await walletClient.sendTransaction({ + account: walletClient.account, + chain: base, + data: approve.data, + gas: BigInt(approve.gas), + maxFeePerGas: approveFee, + maxPriorityFeePerGas: approveTip, + nonce: baseNonce.next(), + to: approve.to, + value: BigInt(approve.value) + }); + state.nablaApproveHash = approveHash; + await stateManager.saveState(state); + console.log(`Approve tx sent: ${approveHash}`); + } else { + console.log(`Resuming BRLA Nabla approval with existing tx: ${approveHash}`); + } + + await waitForTransactionConfirmation(approveHash, publicClient); + console.log("BRLA Nabla approval confirmed."); + + console.log("Sending BRLA Nabla swap transaction on Base..."); + const { maxFeePerGas: swapFee, maxPriorityFeePerGas: swapTip } = await publicClient.estimateFeesPerGas(); + swapHash = await walletClient.sendTransaction({ + account: walletClient.account, + chain: base, + data: swap.data, + gas: BigInt(swap.gas), + maxFeePerGas: swapFee, + maxPriorityFeePerGas: swapTip, + nonce: baseNonce.next(), + to: swap.to, + value: BigInt(swap.value) + }); + state.nablaSwapHash = swapHash; + await stateManager.saveState(state); + console.log(`Swap tx sent: ${swapHash}`); + } else { + console.log(`Resuming BRLA Nabla swap with existing approve tx: ${approveHash}, swap tx: ${swapHash}`); + } + + if (!approveHash || !swapHash) { + throw new Error("State corrupted: BRLA Nabla transaction hash missing after swap step."); + } + + await waitForTransactionConfirmation(swapHash, publicClient); + console.log("BRLA Nabla swap confirmed."); + + await new Promise(resolve => setTimeout(resolve, 5_000)); + + const usdcBalanceAfterRaw = await getUsdcBalanceOnBaseRaw(); + const usdcBalanceAfter = BigInt(usdcBalanceAfterRaw); + const usdcReceivedRaw = (usdcBalanceAfter - usdcBalanceBefore).toString(); + + if (BigInt(usdcReceivedRaw) <= 0n) { + throw new Error(`No USDC delta detected after BRLA Nabla swap (pre: ${usdcBalanceBefore}, post: ${usdcBalanceAfter}).`); + } + + const usdcReceivedDecimal = multiplyByPowerOfTen(Big(usdcReceivedRaw), -6); + console.log(`Received ${usdcReceivedDecimal.toFixed(6)} USDC from BRLA Nabla swap.`); + + state.usdcReceivedRaw = usdcReceivedRaw; + await stateManager.saveState(state); + + return usdcReceivedRaw; +} + +export async function verifyFinalUsdcBalanceOnBase(): Promise { + const { walletClient } = getBaseEvmClients(); + const balanceRaw = await getUsdcBalanceOnBaseRaw(); + const balanceDecimal = multiplyByPowerOfTen(Big(balanceRaw), -6); + console.log(`Final USDC balance on Base (${walletClient.account.address}): ${balanceDecimal.toFixed(6)} USDC`); + return balanceDecimal; +} + +// ── Main Nabla: USDC → BRLA swap (closes the rebalancing loop) ────────────── + +const MAIN_NABLA_QUOTE_ABI = [ + { + inputs: [ + { name: "_amountIn", type: "uint256" }, + { name: "_tokenPath", type: "address[]" }, + { name: "_routerPath", type: "address[]" } + ], + name: "quoteSwapExactTokensForTokens", + outputs: [{ name: "amountOut_", type: "uint256" }], + stateMutability: "view", + type: "function" + } +] as const; + +function getMainNablaConfig() { + const config = getConfig(); + if (!config.mainNablaRouter || !config.mainNablaQuoter) { + throw new Error("Main Nabla route requires MAIN_NABLA_ROUTER and MAIN_NABLA_QUOTER env vars."); + } + return { + quoter: config.mainNablaQuoter, + router: config.mainNablaRouter + }; +} + +export async function mainNablaSwapUsdcToBrlaOnBase( + usdcAmountRaw: string, + baseNonce: NonceManager, + state: BrlaToUsdcBaseRebalanceState, + stateManager: BrlaToUsdcBaseStateManager +): Promise { + const { router } = getMainNablaConfig(); + const { walletClient, publicClient } = getBaseEvmClients(); + const executorAddress = walletClient.account.address; + + console.log(`Starting Main Nabla swap of ${usdcAmountRaw} USDC (raw) to BRLA on Base...`); + + if (state.mainNablaApproveHash && state.mainNablaSwapHash && state.mainNablaBrlaReceivedRaw) { + console.log("Resuming Main Nabla swap with previously recorded hashes."); + return state.mainNablaBrlaReceivedRaw; + } + + if (state.mainNablaSwapHash && !state.mainNablaBrlaBalanceBeforeRaw) { + throw new Error("State corrupted: missing pre-Main-Nabla BRLA balance baseline for completed swap."); + } + + if (!state.mainNablaBrlaBalanceBeforeRaw) { + state.mainNablaBrlaBalanceBeforeRaw = await getBrlaBalanceOnBaseRaw(); + await stateManager.saveState(state); + } + const brlaBalanceBefore = BigInt(state.mainNablaBrlaBalanceBeforeRaw); + + let approveHash = state.mainNablaApproveHash; + let swapHash = state.mainNablaSwapHash; + + if (!swapHash) { + const expectedOutputRaw = BigInt(await quoteMainNablaUsdcToBrlaOnBase(usdcAmountRaw)); + + const expectedOutputDecimal = multiplyByPowerOfTen(Big(expectedOutputRaw.toString()), -18); + console.log(`Expected BRLA output from Main Nabla: ${expectedOutputDecimal.toFixed(6)}`); + + const nablaHardMinimumOutputRaw = Big(expectedOutputRaw.toString()) + .mul(1 - AMM_MINIMUM_OUTPUT_HARD_MARGIN) + .toFixed(0, 0); + + const { approve, swap } = await createNablaTransactionsForOnrampOnEVM( + usdcAmountRaw, + { address: executorAddress, type: EphemeralAccountType.EVM }, + USDC_BASE, + ERC20_BRLA_BASE, + nablaHardMinimumOutputRaw, + NABLA_SWAP_DEADLINE_MINUTES, + router + ); + + if (!approveHash) { + console.log("Sending Main Nabla approve transaction on Base..."); + const { maxFeePerGas: approveFee, maxPriorityFeePerGas: approveTip } = await publicClient.estimateFeesPerGas(); + approveHash = await walletClient.sendTransaction({ + account: walletClient.account, + chain: base, + data: approve.data, + gas: BigInt(approve.gas), + maxFeePerGas: approveFee, + maxPriorityFeePerGas: approveTip, + nonce: baseNonce.next(), + to: approve.to, + value: BigInt(approve.value) + }); + state.mainNablaApproveHash = approveHash; + await stateManager.saveState(state); + console.log(`Main Nabla approve tx sent: ${approveHash}`); + } else { + console.log(`Resuming Main Nabla approval with existing tx: ${approveHash}`); + } + + await waitForTransactionConfirmation(approveHash, publicClient); + console.log("Main Nabla approval confirmed."); + + console.log("Sending Main Nabla swap transaction on Base..."); + const { maxFeePerGas: swapFee, maxPriorityFeePerGas: swapTip } = await publicClient.estimateFeesPerGas(); + swapHash = await walletClient.sendTransaction({ + account: walletClient.account, + chain: base, + data: swap.data, + gas: BigInt(swap.gas), + maxFeePerGas: swapFee, + maxPriorityFeePerGas: swapTip, + nonce: baseNonce.next(), + to: swap.to, + value: BigInt(swap.value) + }); + state.mainNablaSwapHash = swapHash; + await stateManager.saveState(state); + console.log(`Main Nabla swap tx sent: ${swapHash}`); + } else { + console.log(`Resuming Main Nabla swap with existing approve tx: ${approveHash}, swap tx: ${swapHash}`); + } + + if (!approveHash || !swapHash) { + throw new Error("State corrupted: Main Nabla transaction hash missing after swap step."); + } + + await waitForTransactionConfirmation(swapHash, publicClient); + console.log("Main Nabla swap confirmed."); + + await new Promise(resolve => setTimeout(resolve, 5_000)); + + const brlaBalanceAfterRaw = await getBrlaBalanceOnBaseRaw(); + const brlaBalanceAfter = BigInt(brlaBalanceAfterRaw); + const brlaReceivedRaw = (brlaBalanceAfter - brlaBalanceBefore).toString(); + + if (BigInt(brlaReceivedRaw) <= 0n) { + throw new Error(`No BRLA delta detected after Main Nabla swap (pre: ${brlaBalanceBefore}, post: ${brlaBalanceAfter}).`); + } + + const brlaReceivedDecimal = multiplyByPowerOfTen(Big(brlaReceivedRaw), -18); + console.log(`Received ${brlaReceivedDecimal.toFixed(6)} BRLA from Main Nabla swap.`); + + state.mainNablaBrlaReceivedRaw = brlaReceivedRaw; + await stateManager.saveState(state); + + return brlaReceivedRaw; +} diff --git a/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/guards.test.ts b/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/guards.test.ts new file mode 100644 index 000000000..d273f9b9e --- /dev/null +++ b/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/guards.test.ts @@ -0,0 +1,121 @@ +import {describe, expect, test} from "bun:test"; +import Big from "big.js"; +import { + calculateMinimumDelta, + calculateProjectedCostBps, + calculateTargetBalanceRaw, + evaluateDailyBridgeLimit, + evaluateRebalancingCostPolicy, + getRebalancingUrgencyBand, + isProjectedProfit, + type RebalancingCostPolicyConfig, + wouldExceedDailyBridgeLimit +} from "./guards.ts"; + +const policyConfig: RebalancingCostPolicyConfig = { + hardMaxCostBps: 1_000, + maxCostBpsMild: 25, + maxCostBpsModerate: 75, + maxCostBpsSevere: 250, + mode: "auto", + moderateDeviationBps: 200, + severeDeviationBps: 500 +}; + +describe("USDC Base rebalance guards", () => { + test("calculates arrival target from the starting balance plus expected delta", () => { + expect(calculateTargetBalanceRaw("500000000", "100000000", "1")).toBe("600000000"); + }); + + test("supports tolerated delta checks without treating the total balance as the received amount", () => { + expect(calculateMinimumDelta(Big("100"), "0.998").toString()).toBe("99.8"); + }); + + test("allows small Base USDC arrival shortfalls with the default tolerance", () => { + expect(calculateTargetBalanceRaw("13148408", "999225918", "0.998")).toBe("1010375874"); + }); + + test("daily bridge limit includes the amount about to be rebalanced", () => { + expect(wouldExceedDailyBridgeLimit(Big("9500000000"), Big("600000000"), Big("10000000000"))).toBe(true); + expect(wouldExceedDailyBridgeLimit(Big("9000000000"), Big("1000000000"), Big("10000000000"))).toBe(false); + }); + + test("detects profitable projected rebalances", () => { + expect(isProjectedProfit(Big("100000000"), Big("101000000"))).toBe(true); + expect(isProjectedProfit(Big("100000000"), Big("100000000"))).toBe(false); + expect(isProjectedProfit(Big("100000000"), Big("99000000"))).toBe(false); + }); + + test("evaluates daily bridge limit decisions", () => { + expect(evaluateDailyBridgeLimit(Big("9000000000"), Big("600000000"), Big("10000000000"), false)).toMatchObject({ + reason: "under_limit", + shouldSkip: false + }); + expect(evaluateDailyBridgeLimit(Big("9500000000"), Big("600000000"), Big("10000000000"), false)).toMatchObject({ + reason: "daily_limit_reached", + shouldSkip: true + }); + expect(evaluateDailyBridgeLimit(Big("9500000000"), Big("600000000"), Big("10000000000"), true)).toMatchObject({ + reason: "profitable_quote", + shouldSkip: false + }); + }); + + test("calculates projected rebalancing cost in basis points", () => { + expect(calculateProjectedCostBps(Big("100000000"), Big("99000000"))).toBe(100); + expect(calculateProjectedCostBps(Big("100000000"), Big("101000000"))).toBe(-100); + }); + + test("selects urgency bands from coverage deviation", () => { + expect(getRebalancingUrgencyBand(50, policyConfig)).toBe("mild"); + expect(getRebalancingUrgencyBand(200, policyConfig)).toBe("moderate"); + expect(getRebalancingUrgencyBand(500, policyConfig)).toBe("severe"); + }); + + test("skips mild rebalances when projected cost exceeds the mild limit", () => { + const decision = evaluateRebalancingCostPolicy(Big("100000000"), Big("99000000"), 50, policyConfig); + + expect(decision.shouldExecute).toBe(false); + expect(decision.band).toBe("mild"); + expect(decision.costBps).toBe(100); + }); + + test("allows severe rebalances at a higher configured cost", () => { + const decision = evaluateRebalancingCostPolicy(Big("100000000"), Big("99000000"), 600, policyConfig); + + expect(decision.shouldExecute).toBe(true); + expect(decision.band).toBe("severe"); + expect(decision.allowedCostBps).toBe(250); + }); + + test("dry-run evaluates but never executes", () => { + const decision = evaluateRebalancingCostPolicy(Big("100000000"), Big("99900000"), 50, { + ...policyConfig, + mode: "dry-run" + }); + + expect(decision.shouldExecute).toBe(false); + expect(decision.dryRun).toBe(true); + expect(decision.reason).toContain("Dry-run"); + }); + + test("off mode never executes", () => { + const decision = evaluateRebalancingCostPolicy(Big("100000000"), Big("100000000"), 600, { + ...policyConfig, + mode: "off" + }); + + expect(decision.shouldExecute).toBe(false); + expect(decision.reason).toBe("Rebalancing policy mode is off."); + }); + + test("hard max cost cap blocks even always mode", () => { + const decision = evaluateRebalancingCostPolicy(Big("100000000"), Big("80000000"), 600, { + ...policyConfig, + mode: "always" + }); + + expect(decision.shouldExecute).toBe(false); + expect(decision.reason).toContain("hard cap"); + }); +}); diff --git a/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/guards.ts b/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/guards.ts new file mode 100644 index 000000000..cb5d3f1a3 --- /dev/null +++ b/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/guards.ts @@ -0,0 +1,169 @@ +import Big from "big.js"; + +export const DEFAULT_ARRIVAL_TOLERANCE = "0.998"; + +export type RebalancingPolicyMode = "auto" | "always" | "dry-run" | "off"; +export type RebalancingUrgencyBand = "mild" | "moderate" | "severe"; + +export interface RebalancingCostPolicyConfig { + hardMaxCostBps: number; + maxCostBpsMild: number; + maxCostBpsModerate: number; + maxCostBpsSevere: number; + mode: RebalancingPolicyMode; + moderateDeviationBps: number; + severeDeviationBps: number; +} + +export interface RebalancingCostPolicyDecision { + allowedCostBps: number; + band: RebalancingUrgencyBand; + costBps: number; + dryRun: boolean; + projectedCostRaw: string; + reason: string; + shouldExecute: boolean; +} + +export interface DailyBridgeLimitDecision { + projectedTotalRaw: string; + reason: "under_limit" | "profitable_quote" | "daily_limit_reached"; + shouldSkip: boolean; +} + +export function calculateMinimumDelta(expectedDelta: Big, tolerance = DEFAULT_ARRIVAL_TOLERANCE): Big { + return expectedDelta.mul(tolerance); +} + +export function calculateTargetBalanceRaw(startingBalanceRaw: string, expectedDeltaRaw: string, tolerance = "1"): string { + return Big(startingBalanceRaw) + .plus(calculateMinimumDelta(Big(expectedDeltaRaw), tolerance)) + .toFixed(0, 0); +} + +export function wouldExceedDailyBridgeLimit(bridgedTodayRaw: Big, requestedAmountRaw: Big, dailyLimitRaw: Big): boolean { + return bridgedTodayRaw.plus(requestedAmountRaw).gt(dailyLimitRaw); +} + +export function isProjectedProfit(inputAmountRaw: Big, projectedOutputRaw: Big): boolean { + return projectedOutputRaw.gt(inputAmountRaw); +} + +export function evaluateDailyBridgeLimit( + bridgedTodayRaw: Big, + requestedAmountRaw: Big, + dailyLimitRaw: Big, + profitable: boolean +): DailyBridgeLimitDecision { + const projectedTotalRaw = bridgedTodayRaw.plus(requestedAmountRaw).toFixed(0, 0); + + if (!wouldExceedDailyBridgeLimit(bridgedTodayRaw, requestedAmountRaw, dailyLimitRaw)) { + return { projectedTotalRaw, reason: "under_limit", shouldSkip: false }; + } + + if (profitable) { + return { projectedTotalRaw, reason: "profitable_quote", shouldSkip: false }; + } + + return { projectedTotalRaw, reason: "daily_limit_reached", shouldSkip: true }; +} + +export function calculateProjectedCostBps(inputAmountRaw: Big, projectedOutputRaw: Big): number { + if (inputAmountRaw.lte(0)) throw new Error("inputAmountRaw must be greater than zero."); + return Number(inputAmountRaw.minus(projectedOutputRaw).div(inputAmountRaw).mul(10_000).toFixed(2)); +} + +export function getRebalancingUrgencyBand( + deviationBps: number, + config: Pick +): RebalancingUrgencyBand { + if (deviationBps >= config.severeDeviationBps) return "severe"; + if (deviationBps >= config.moderateDeviationBps) return "moderate"; + return "mild"; +} + +export function evaluateRebalancingCostPolicy( + inputAmountRaw: Big, + projectedOutputRaw: Big, + deviationBps: number, + config: RebalancingCostPolicyConfig +): RebalancingCostPolicyDecision { + const band = getRebalancingUrgencyBand(deviationBps, config); + const projectedCostRaw = inputAmountRaw.minus(projectedOutputRaw); + const costBps = calculateProjectedCostBps(inputAmountRaw, projectedOutputRaw); + const allowedCostBps = { + mild: config.maxCostBpsMild, + moderate: config.maxCostBpsModerate, + severe: config.maxCostBpsSevere + }[band]; + + if (config.mode === "off") { + return { + allowedCostBps, + band, + costBps, + dryRun: false, + projectedCostRaw: projectedCostRaw.toFixed(0, 0), + reason: "Rebalancing policy mode is off.", + shouldExecute: false + }; + } + + if (costBps > config.hardMaxCostBps) { + return { + allowedCostBps, + band, + costBps, + dryRun: config.mode === "dry-run", + projectedCostRaw: projectedCostRaw.toFixed(0, 0), + reason: `Projected cost ${costBps} bps exceeds hard cap ${config.hardMaxCostBps} bps.`, + shouldExecute: false + }; + } + + if (config.mode === "dry-run") { + return { + allowedCostBps, + band, + costBps, + dryRun: true, + projectedCostRaw: projectedCostRaw.toFixed(0, 0), + reason: `Dry-run: would ${costBps <= allowedCostBps ? "execute" : "skip"} ${band} rebalance at ${costBps} bps cost.`, + shouldExecute: false + }; + } + + if (config.mode === "always") { + return { + allowedCostBps, + band, + costBps, + dryRun: false, + projectedCostRaw: projectedCostRaw.toFixed(0, 0), + reason: `Always mode permits ${band} rebalance at ${costBps} bps cost.`, + shouldExecute: true + }; + } + + if (costBps > allowedCostBps) { + return { + allowedCostBps, + band, + costBps, + dryRun: false, + projectedCostRaw: projectedCostRaw.toFixed(0, 0), + reason: `Projected cost ${costBps} bps exceeds ${band} limit ${allowedCostBps} bps.`, + shouldExecute: false + }; + } + + return { + allowedCostBps, + band, + costBps, + dryRun: false, + projectedCostRaw: projectedCostRaw.toFixed(0, 0), + reason: `Projected cost ${costBps} bps is within ${band} limit ${allowedCostBps} bps.`, + shouldExecute: true + }; +} diff --git a/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/index.ts b/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/index.ts new file mode 100644 index 000000000..47660412a --- /dev/null +++ b/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/index.ts @@ -0,0 +1,338 @@ +import { BrlaApiService, multiplyByPowerOfTen, SlackNotifier } from "@vortexfi/shared"; +import Big from "big.js"; +import { UsdcBaseRebalancePhase, UsdcBaseStateManager, usdcBasePhaseOrder } from "../../services/stateManager.ts"; +import { checkTicketStatusPaid } from "../../utils/brla.ts"; +import { getBaseEvmClients, getConfig, getPolygonEvmClients } from "../../utils/config.ts"; +import { NonceManager } from "../../utils/nonce.ts"; +import { formatBaseRebalanceCompletionMessage, type RebalancePolicySummary } from "./notifications.ts"; +import { + aveniaCreateSwapToUsdcBaseTicket, + aveniaTransferBrlaToPolygon, + checkInitialUsdcBalanceOnBase, + compareRoutesUpfront, + getAveniaBrlaBalanceDecimal, + getBrlaBalanceOnPolygonRaw, + getUsdcBalanceOnBaseRaw, + mainNablaApproveAndSwap, + nablaApproveAndSwapOnBase, + squidRouterApproveAndSwap, + transferBrlaToAveniaOnBase, + verifyFinalUsdcBalanceOnBase, + waitBrlaOnPolygon, + waitForBrlaOnAvenia, + waitUsdcOnBase +} from "./steps.ts"; + +export async function rebalanceUsdcBrlaUsdcBase( + usdcAmountRaw: string, + forceRestart = false, + forcedRoute?: "squidrouter" | "avenia" | "nabla-main", + policy?: RebalancePolicySummary +) { + console.log(`Starting USDC->BRLA->USDC rebalance on Base with amount: ${usdcAmountRaw} (raw USDC)`); + + const stateManager = new UsdcBaseStateManager(); + let state = await stateManager.getState(); + console.log("Fetched rebalance state from storage.", state); + + const isResuming = !forceRestart && state && state.currentPhase !== UsdcBaseRebalancePhase.Idle; + if (isResuming) { + console.log(`Resuming rebalance from phase: ${state?.currentPhase}`); + } else { + state = await stateManager.startNewRebalance(usdcAmountRaw); + } + + if (!state) { + throw new Error("State is undefined after initialization."); + } + + const { publicClient: basePublicClient, walletClient: baseWalletClient } = getBaseEvmClients(); + const baseAddress = baseWalletClient.account.address as `0x${string}`; + const baseNonce = await NonceManager.create(basePublicClient, baseAddress); + + const currentOrder = usdcBasePhaseOrder[state.currentPhase]; + console.log(`Current phase order: ${currentOrder}`); + + // ── Step 1: Check initial USDC balance ────────────────────────────────────── + if (currentOrder <= usdcBasePhaseOrder[UsdcBaseRebalancePhase.CheckInitialUsdcBalance]) { + if (!state.usdcAmountRaw) throw new Error("State corrupted: usdcAmountRaw missing for step 1"); + + const initialBalance = await checkInitialUsdcBalanceOnBase(state.usdcAmountRaw); + state.initialUsdcBalance = initialBalance.toString(); + state.currentPhase = UsdcBaseRebalancePhase.CompareRates; + await stateManager.saveState(state); + } + + // ── Step 2: Compare all 3 routes upfront (before any swap) ────────────────── + if (currentOrder <= usdcBasePhaseOrder[UsdcBaseRebalancePhase.CompareRates]) { + if (!state.usdcAmountRaw) throw new Error("State corrupted: usdcAmountRaw missing for step 2"); + + if (forcedRoute) { + console.log(`Forced route: ${forcedRoute}. Skipping full comparison.`); + state.winningRoute = forcedRoute; + } else { + const comparison = await compareRoutesUpfront(state.usdcAmountRaw); + state.winningRoute = comparison.winningRoute; + state.squidRouterQuoteUsdc = comparison.squidRouterQuoteUsdc; + state.aveniaQuoteUsdc = comparison.aveniaQuoteUsdc; + state.mainNablaQuoteUsdc = comparison.mainNablaQuoteUsdc; + } + + console.log(`Route selected: ${state.winningRoute}`); + state.currentPhase = UsdcBaseRebalancePhase.NablaApprove; + await stateManager.saveState(state); + } + + // ── Step 3: Nabla swap USDC → BRLA on Base (common to all routes) ─────────── + if (currentOrder <= usdcBasePhaseOrder[UsdcBaseRebalancePhase.NablaApprove]) { + if (!state.usdcAmountRaw) throw new Error("State corrupted: usdcAmountRaw missing for step 3"); + + const result = await nablaApproveAndSwapOnBase(state.usdcAmountRaw, baseNonce, state, stateManager); + + state.brlaAmountRaw = result.brlaAmountRaw; + state.brlaAmountDecimal = result.brlaAmountDecimal.toString(); + + console.log(`Nabla swap completed. BRLA received: ${result.brlaAmountDecimal.toFixed(4)}`); + + if (state.winningRoute === "nabla-main") { + state.currentPhase = UsdcBaseRebalancePhase.MainNablaApproveAndSwap; + } else { + state.currentPhase = UsdcBaseRebalancePhase.TransferBrlaToAvenia; + } + await stateManager.saveState(state); + } + + // ── nabla-main route: swap BRL → USDC on main Nabla (terminal) ────────────── + if (state.winningRoute === "nabla-main") { + if (currentOrder <= usdcBasePhaseOrder[UsdcBaseRebalancePhase.MainNablaApproveAndSwap]) { + if (!state.brlaAmountRaw) throw new Error("State corrupted: brlaAmountRaw missing for nabla-main step"); + + await mainNablaApproveAndSwap(state.brlaAmountRaw, baseNonce, state, stateManager); + + console.log("Main Nabla swap completed. Proceeding to verify final balance."); + state.currentPhase = UsdcBaseRebalancePhase.VerifyFinalBalance; + await stateManager.saveState(state); + } + } + + // ── avenia/squid routes: transfer BRLA to Avenia, then diverge ────────────── + if (state.winningRoute === "avenia" || state.winningRoute === "squidrouter") { + if (currentOrder <= usdcBasePhaseOrder[UsdcBaseRebalancePhase.TransferBrlaToAvenia]) { + if (!state.brlaAmountRaw) throw new Error("State corrupted: brlaAmountRaw missing for step 4"); + + if (!state.aveniaBrlaBalanceBeforeTransfer) { + state.aveniaBrlaBalanceBeforeTransfer = await getAveniaBrlaBalanceDecimal(); + await stateManager.saveState(state); + } + + state.brlaTransferHash = await transferBrlaToAveniaOnBase(state.brlaAmountRaw, baseNonce, state, stateManager); + + console.log(`BRLA transferred to Avenia on Base. Tx: ${state.brlaTransferHash}`); + state.currentPhase = UsdcBaseRebalancePhase.WaitForBrlaOnAvenia; + await stateManager.saveState(state); + } + + if (currentOrder <= usdcBasePhaseOrder[UsdcBaseRebalancePhase.WaitForBrlaOnAvenia]) { + if (!state.brlaAmountDecimal) throw new Error("State corrupted: brlaAmountDecimal missing for step 5"); + if (!state.aveniaBrlaBalanceBeforeTransfer) { + throw new Error("State corrupted: aveniaBrlaBalanceBeforeTransfer missing for step 5"); + } + + const actualBrlaBalance = await waitForBrlaOnAvenia( + Big(state.brlaAmountDecimal), + Big(state.aveniaBrlaBalanceBeforeTransfer) + ); + + state.brlaAmountDecimal = actualBrlaBalance; + state.brlaAmountRaw = multiplyByPowerOfTen(Big(actualBrlaBalance), 18).toFixed(0, 0); + + console.log("BRLA confirmed on Avenia internal balance."); + + if (state.winningRoute === "squidrouter") { + state.currentPhase = UsdcBaseRebalancePhase.AveniaTransferToPolygon; + } else { + state.currentPhase = UsdcBaseRebalancePhase.AveniaSwapToUsdcBase; + } + await stateManager.saveState(state); + } + } + + // ── Avenia route: BRLA → USDC swap via Avenia on Base ─────────────────────── + if (state.winningRoute === "avenia") { + if (currentOrder <= usdcBasePhaseOrder[UsdcBaseRebalancePhase.AveniaSwapToUsdcBase]) { + if (!state.brlaAmountDecimal) throw new Error("State corrupted: brlaAmountDecimal missing for avenia step 1"); + + const brlaApiService = BrlaApiService.getInstance(); + + if (!state.aveniaTicketId) { + try { + if (!state.baseUsdcBalanceBeforeAveniaSwapRaw) { + state.baseUsdcBalanceBeforeAveniaSwapRaw = await getUsdcBalanceOnBaseRaw(); + await stateManager.saveState(state); + } + + const result = await aveniaCreateSwapToUsdcBaseTicket(Big(state.brlaAmountDecimal), baseAddress); + state.aveniaTicketId = result.ticketId; + state.aveniaQuoteUsdc = result.outputAmount; + await stateManager.saveState(state); + } catch (error) { + console.error("Avenia swap ticket creation failed. Falling back to SquidRouter route.", error); + state.winningRoute = "squidrouter"; + state.currentPhase = UsdcBaseRebalancePhase.AveniaTransferToPolygon; + await stateManager.saveState(state); + } + } + + if (state.winningRoute === "avenia" && state.aveniaTicketId) { + console.log(`Checking status for Avenia swap ticket ${state.aveniaTicketId}...`); + const paidTicket = await checkTicketStatusPaid(brlaApiService, state.aveniaTicketId); + // Avenia API returns outputAmount in decimal units. + state.aveniaQuoteUsdc = paidTicket.quote.outputAmount; + console.log(`Avenia swap completed. USDC output: ${state.aveniaQuoteUsdc}`); + + state.currentPhase = UsdcBaseRebalancePhase.WaitUsdcOnBaseFromAvenia; + await stateManager.saveState(state); + } + } + + if (!state.winningRoute) { + throw new Error(`State corrupted: winningRoute is null at phase ${state.currentPhase}. Cannot proceed.`); + } + + if (state.winningRoute === "avenia") { + if (currentOrder <= usdcBasePhaseOrder[UsdcBaseRebalancePhase.WaitUsdcOnBaseFromAvenia]) { + if (!state.aveniaQuoteUsdc) throw new Error("State corrupted: aveniaQuoteUsdc missing for avenia step 2"); + if (!state.baseUsdcBalanceBeforeAveniaSwapRaw) { + throw new Error("State corrupted: baseUsdcBalanceBeforeAveniaSwapRaw missing for avenia step 2"); + } + + const aveniaUsdcRaw = multiplyByPowerOfTen(Big(state.aveniaQuoteUsdc), 6).toFixed(0, 0); + state.aveniaQuoteUsdc = await waitUsdcOnBase(aveniaUsdcRaw, state.baseUsdcBalanceBeforeAveniaSwapRaw); + + console.log("USDC from Avenia confirmed on Base."); + state.currentPhase = UsdcBaseRebalancePhase.VerifyFinalBalance; + await stateManager.saveState(state); + } + } + } + + // ── SquidRouter route: transfer BRLA to Polygon, then swap ────────────────── + if (state.winningRoute === "squidrouter") { + const { publicClient: polygonPublicClient, walletClient: polygonWalletClient } = getPolygonEvmClients(); + const polygonNonce = await NonceManager.create(polygonPublicClient, polygonWalletClient.account.address as `0x${string}`); + + if (currentOrder <= usdcBasePhaseOrder[UsdcBaseRebalancePhase.AveniaTransferToPolygon]) { + if (!state.brlaAmountDecimal) throw new Error("State corrupted: brlaAmountDecimal missing for squid step 1"); + + if (!state.aveniaTicketId) { + if (!state.polygonBrlaBalanceBeforeTransferRaw) { + state.polygonBrlaBalanceBeforeTransferRaw = await getBrlaBalanceOnPolygonRaw(); + await stateManager.saveState(state); + } + + const ticketId = await aveniaTransferBrlaToPolygon(Big(state.brlaAmountDecimal)); + state.aveniaTicketId = ticketId; + await stateManager.saveState(state); + } + + const brlaApiService = BrlaApiService.getInstance(); + await checkTicketStatusPaid(brlaApiService, state.aveniaTicketId); + + console.log("BRLA transferred to Polygon via Avenia."); + state.currentPhase = UsdcBaseRebalancePhase.WaitBrlaOnPolygon; + await stateManager.saveState(state); + } + + if (currentOrder <= usdcBasePhaseOrder[UsdcBaseRebalancePhase.WaitBrlaOnPolygon]) { + if (!state.brlaAmountRaw) throw new Error("State corrupted: brlaAmountRaw missing for squid step 2"); + if (!state.polygonBrlaBalanceBeforeTransferRaw) { + throw new Error("State corrupted: polygonBrlaBalanceBeforeTransferRaw missing for squid step 2"); + } + + const arrivedBrlaRaw = await waitBrlaOnPolygon(state.brlaAmountRaw, state.polygonBrlaBalanceBeforeTransferRaw); + // Continue with whatever actually arrived (after Avenia fees). + state.brlaAmountRaw = arrivedBrlaRaw; + + console.log("BRLA confirmed on Polygon."); + state.currentPhase = UsdcBaseRebalancePhase.SquidRouterApproveAndSwap; + await stateManager.saveState(state); + } + + if (currentOrder <= usdcBasePhaseOrder[UsdcBaseRebalancePhase.SquidRouterApproveAndSwap]) { + if (!state.brlaAmountRaw) throw new Error("State corrupted: brlaAmountRaw missing for squid step 3"); + + if (!state.baseUsdcBalanceBeforeSquidSwapRaw) { + state.baseUsdcBalanceBeforeSquidSwapRaw = await getUsdcBalanceOnBaseRaw(); + await stateManager.saveState(state); + } + + const result = await squidRouterApproveAndSwap(state.brlaAmountRaw, baseAddress, polygonNonce, state, stateManager); + + state.squidRouterSwapHash = result.swapHash; + state.squidRouterQuoteUsdc = result.toAmountRaw; + console.log(`SquidRouter swap completed. Tx: ${result.swapHash}`); + state.currentPhase = UsdcBaseRebalancePhase.WaitUsdcOnBaseFromSquid; + await stateManager.saveState(state); + } + + if (currentOrder <= usdcBasePhaseOrder[UsdcBaseRebalancePhase.WaitUsdcOnBaseFromSquid]) { + if (!state.squidRouterQuoteUsdc) throw new Error("State corrupted: squidRouterQuoteUsdc missing for squid step 4"); + if (!state.baseUsdcBalanceBeforeSquidSwapRaw) { + throw new Error("State corrupted: baseUsdcBalanceBeforeSquidSwapRaw missing for squid step 4"); + } + + state.squidRouterQuoteUsdc = await waitUsdcOnBase(state.squidRouterQuoteUsdc, state.baseUsdcBalanceBeforeSquidSwapRaw); + + console.log("USDC from SquidRouter confirmed on Base."); + state.currentPhase = UsdcBaseRebalancePhase.VerifyFinalBalance; + await stateManager.saveState(state); + } + } + + // ── Final: verify balance and report ──────────────────────────────────────── + if (currentOrder <= usdcBasePhaseOrder[UsdcBaseRebalancePhase.VerifyFinalBalance]) { + const finalBalance = await verifyFinalUsdcBalanceOnBase(); + state.finalUsdcBalance = finalBalance.toString(); + + state.currentPhase = UsdcBaseRebalancePhase.Idle; + await stateManager.saveState(state); + } + + if (!state.initialUsdcBalance) throw new Error("State corrupted: initialUsdcBalance missing at completion"); + if (!state.usdcAmountRaw) throw new Error("State corrupted: usdcAmountRaw missing at completion"); + if (!state.brlaAmountDecimal) throw new Error("State corrupted: brlaAmountDecimal missing at completion"); + if (!state.finalUsdcBalance) throw new Error("State corrupted: finalUsdcBalance missing at completion"); + + const initialUsdcDecimal = Big(state.initialUsdcBalance); + const finalUsdcDecimal = Big(state.finalUsdcBalance); + const usdcRebalanced = Big(state.usdcAmountRaw).div(10 ** 6); + const cost = initialUsdcDecimal.minus(finalUsdcDecimal); + const costRelative = usdcRebalanced.gt(0) ? cost.div(usdcRebalanced).toFixed(4, 0) : "N/A"; + + console.log( + `Rebalance completed! Initial: ${initialUsdcDecimal.toFixed(6)} USDC, Final: ${finalUsdcDecimal.toFixed(6)} USDC` + ); + console.log(`Route taken: ${state.winningRoute}`); + console.log(`Cost: absolute: ${cost.toFixed(6)} USDC | relative: ${costRelative}`); + + await stateManager.addHistoryEntry({ + cost: cost.toFixed(6), + costRelative, + endingTime: new Date().toISOString(), + initialAmount: state.usdcAmountRaw, + startingTime: state.startingTime + }); + + const slackNotifier = new SlackNotifier(process.env.SLACK_WEB_HOOK_TOKEN); + await slackNotifier.sendMessage({ + text: formatBaseRebalanceCompletionMessage({ + brlaReceived: Big(state.brlaAmountDecimal), + cost, + finalUsdcBalance: finalUsdcDecimal, + initialUsdcBalance: initialUsdcDecimal, + policy: policy ?? { config: getConfig().rebalancingCostPolicy }, + requestedUsdc: usdcRebalanced, + route: state.winningRoute + }) + }); +} diff --git a/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/notifications.test.ts b/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/notifications.test.ts new file mode 100644 index 000000000..e91a3f830 --- /dev/null +++ b/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/notifications.test.ts @@ -0,0 +1,49 @@ +import {describe, expect, test} from "bun:test"; +import Big from "big.js"; +import {formatBaseRebalanceCompletionMessage} from "./notifications.ts"; + +const policyConfig = { + hardMaxCostBps: 1_000, + maxCostBpsMild: 25, + maxCostBpsModerate: 75, + maxCostBpsSevere: 250, + mode: "auto" as const, + moderateDeviationBps: 200, + severeDeviationBps: 500 +}; + +describe("Base rebalance Slack notifications", () => { + test("formats summary and policy bounds in Slack-friendly code tables", () => { + const message = formatBaseRebalanceCompletionMessage({ + brlaReceived: Big("994.5"), + cost: Big("12.34"), + finalUsdcBalance: Big("987.66"), + initialUsdcBalance: Big("1000"), + policy: { + config: policyConfig, + decision: { + allowedCostBps: 75, + band: "moderate", + costBps: 42, + dryRun: false, + projectedCostRaw: "4200000", + reason: "Projected cost 42 bps is within moderate limit 75 bps.", + shouldExecute: true + }, + deviationBps: 220 + }, + requestedUsdc: Big("1000"), + route: "squidrouter" + }); + + expect(message).toContain("*Summary*"); + expect(message).toContain("Route Req USDC BRLA out Start Final Cost Cost bps"); + expect(message).toContain("SquidRouter 1000.000000 994.500000 1000.000000 987.660000 12.340000 123.40"); + expect(message).not.toContain("Cost/requested amount"); + expect(message).not.toContain("1.23%"); + expect(message).toContain("*Policy*"); + expect(message).toContain("Mode Decision Band Dev bps Cost bps Cap bps Hard bps"); + expect(message).toContain("auto execute moderate 220 42 75 1000"); + expect(message).toContain("Bands bps: mod>=200 severe>=500 | caps bps: mild<=25 mod<=75 severe<=250"); + }); +}); diff --git a/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/notifications.ts b/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/notifications.ts new file mode 100644 index 000000000..79e9c9b63 --- /dev/null +++ b/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/notifications.ts @@ -0,0 +1,92 @@ +import Big from "big.js"; +import type { WinningRoute } from "../../services/stateManager.ts"; +import type { RebalancingCostPolicyConfig, RebalancingCostPolicyDecision } from "./guards.ts"; + +export interface RebalancePolicySummary { + config: RebalancingCostPolicyConfig; + decision?: RebalancingCostPolicyDecision; + deviationBps?: number; +} + +interface BaseRebalanceCompletionMessageParams { + brlaReceived: Big; + cost: Big; + finalUsdcBalance: Big; + initialUsdcBalance: Big; + policy?: RebalancePolicySummary; + requestedUsdc: Big; + route: WinningRoute; +} + +export function formatBaseRebalanceCompletionMessage(params: BaseRebalanceCompletionMessageParams): string { + return [ + "✅ *Base rebalancer completed*", + "USDC -> BRLA -> USDC on Base", + "", + "*Summary*", + formatCompactTable( + ["Route", "Req USDC", "BRLA out", "Start", "Final", "Cost", "Cost bps"], + [ + [ + formatRoute(params.route), + params.requestedUsdc.toFixed(6), + params.brlaReceived.toFixed(6), + params.initialUsdcBalance.toFixed(6), + params.finalUsdcBalance.toFixed(6), + params.cost.toFixed(6), + formatCostBps(params.cost, params.requestedUsdc) + ] + ] + ), + formatPolicySummary(params.policy) + ].join("\n"); +} + +export function formatPolicySummary(policy: RebalancePolicySummary | undefined): string { + if (!policy) return "```Policy decision unavailable (resumed or manual execution).```"; + + const decision = policy.decision; + const decisionRow = decision + ? [ + policy.config.mode, + decision.shouldExecute ? "execute" : "skip", + decision.band, + policy.deviationBps === undefined ? "N/A" : formatBps(policy.deviationBps), + formatBps(decision.costBps), + formatBps(decision.allowedCostBps), + formatBps(policy.config.hardMaxCostBps) + ] + : [policy.config.mode, "unavailable", "N/A", "N/A", "N/A", "N/A", formatBps(policy.config.hardMaxCostBps)]; + + return [ + "*Policy*", + formatCompactTable(["Mode", "Decision", "Band", "Dev bps", "Cost bps", "Cap bps", "Hard bps"], [decisionRow]), + `Bands bps: mod>=${formatBps(policy.config.moderateDeviationBps)} severe>=${formatBps(policy.config.severeDeviationBps)} | caps bps: mild<=${formatBps(policy.config.maxCostBpsMild)} mod<=${formatBps(policy.config.maxCostBpsModerate)} severe<=${formatBps(policy.config.maxCostBpsSevere)}` + ].join("\n"); +} + +export function formatCompactTable(headers: string[], rows: string[][]): string { + const widths = headers.map((header, index) => Math.max(header.length, ...rows.map(row => row[index]?.length ?? 0))); + const formatRow = (row: string[]) => + row + .map((cell, index) => cell.padEnd(widths[index] ?? cell.length)) + .join(" ") + .trimEnd(); + return ["```", formatRow(headers), ...rows.map(formatRow), "```"].join("\n"); +} + +export function formatCostBps(cost: Big, denominator: Big): string { + if (denominator.lte(0)) return "N/A"; + return cost.div(denominator).mul(10_000).toFixed(2); +} + +function formatBps(value: number): string { + return Number.isInteger(value) ? String(value) : value.toFixed(2); +} + +function formatRoute(route: WinningRoute): string { + if (route === "avenia") return "Avenia"; + if (route === "squidrouter") return "SquidRouter"; + if (route === "nabla-main") return "Main Nabla"; + return "Unknown"; +} diff --git a/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/steps.ts b/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/steps.ts new file mode 100644 index 000000000..81b2caedd --- /dev/null +++ b/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/steps.ts @@ -0,0 +1,926 @@ +import { + AveniaPaymentMethod, + BrlaApiService, + BrlaCurrency, + checkEvmBalancePeriodically, + createNablaTransactionsForOnrampOnEVM, + createTransactionDataFromRoute, + EphemeralAccountType, + ERC20_BRLA_BASE, + EvmClientManager, + getNablaBasePool, + getNetworkId, + getRoute, + getStatusAxelarScan, + multiplyByPowerOfTen, + Networks +} from "@vortexfi/shared"; +import Big from "big.js"; +import { encodeFunctionData, erc20Abi } from "viem"; +import { base, polygon } from "viem/chains"; +import { brlaMoonbeamTokenDetails } from "../../constants.ts"; +import { UsdcBaseRebalanceState, UsdcBaseStateManager, type WinningRoute } from "../../services/stateManager.ts"; +import { getBaseEvmClients, getConfig, getPolygonEvmClients } from "../../utils/config.ts"; +import { NonceManager } from "../../utils/nonce.ts"; +import { waitForTransactionConfirmation } from "../../utils/transactions.ts"; +import { calculateMinimumDelta, calculateTargetBalanceRaw, DEFAULT_ARRIVAL_TOLERANCE } from "./guards.ts"; + +export const USDC_BASE: `0x${string}` = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"; +export const BRLA_POLYGON: `0x${string}` = brlaMoonbeamTokenDetails.polygonErc20Address as `0x${string}`; +const NABLA_SWAP_DEADLINE_MINUTES = 60 * 24 * 7; +const AMM_MINIMUM_OUTPUT_HARD_MARGIN = 0.05; + +export async function getUsdcBalanceOnBaseRaw(): Promise { + const { publicClient, walletClient } = getBaseEvmClients(); + const balance = await publicClient.readContract({ + abi: erc20Abi, + address: USDC_BASE, + args: [walletClient.account.address], + functionName: "balanceOf" + }); + return balance.toString(); +} + +export async function getBrlaBalanceOnBaseRaw(): Promise { + const { publicClient, walletClient } = getBaseEvmClients(); + const balance = await publicClient.readContract({ + abi: erc20Abi, + address: ERC20_BRLA_BASE, + args: [walletClient.account.address], + functionName: "balanceOf" + }); + return balance.toString(); +} + +export async function getBrlaBalanceOnPolygonRaw(): Promise { + const { publicClient, walletClient } = getPolygonEvmClients(); + const balance = await publicClient.readContract({ + abi: erc20Abi, + address: BRLA_POLYGON, + args: [walletClient.account.address], + functionName: "balanceOf" + }); + return balance.toString(); +} + +export async function getAveniaBrlaBalanceDecimal(): Promise { + const brlaApiService = BrlaApiService.getInstance(); + const balanceResponse = await brlaApiService.getMainAccountBalance(); + return String(balanceResponse?.balances?.BRLA ?? "0"); +} + +export async function checkInitialUsdcBalanceOnBase(usdcAmountRaw: string): Promise { + const { publicClient, walletClient } = getBaseEvmClients(); + const address = walletClient.account.address; + + const balance = await publicClient.readContract({ + abi: erc20Abi, + address: USDC_BASE, + args: [address], + functionName: "balanceOf" + }); + + const balanceDecimal = multiplyByPowerOfTen(Big(balance.toString()), -6); + console.log(`Current USDC balance on Base (${address}): ${balanceDecimal.toFixed(6)} USDC`); + + const requiredAmount = multiplyByPowerOfTen(Big(usdcAmountRaw), -6); + if (balanceDecimal.lt(requiredAmount)) { + throw new Error(`Insufficient USDC on Base. Have: ${balanceDecimal.toFixed(6)}, need: ${requiredAmount.toFixed(6)}`); + } + + return balanceDecimal; +} + +export async function nablaApproveAndSwapOnBase( + usdcAmountRaw: string, + baseNonce: NonceManager, + state: UsdcBaseRebalanceState, + stateManager: UsdcBaseStateManager +): Promise<{ + brlaAmountRaw: string; + brlaAmountDecimal: Big; + approveHash: string; + swapHash: string; +}> { + console.log(`Starting Nabla swap of ${usdcAmountRaw} USDC (raw) to BRLA on Base...`); + + const { walletClient, publicClient } = getBaseEvmClients(); + const executorAddress = walletClient.account.address; + + const { router } = getNablaBasePool(USDC_BASE, ERC20_BRLA_BASE); + + if (state.nablaApproveHash && state.nablaSwapHash && state.brlaAmountRaw && state.brlaAmountDecimal) { + console.log(`Resuming Nabla swap with previously recorded BRLA output: ${state.brlaAmountDecimal}`); + return { + approveHash: state.nablaApproveHash, + brlaAmountDecimal: Big(state.brlaAmountDecimal), + brlaAmountRaw: state.brlaAmountRaw, + swapHash: state.nablaSwapHash + }; + } + + if (state.nablaSwapHash && !state.brlaBalanceBeforeNablaRaw) { + throw new Error("State corrupted: missing pre-Nabla BRLA balance baseline for completed swap."); + } + + if (!state.brlaBalanceBeforeNablaRaw) { + state.brlaBalanceBeforeNablaRaw = await getBrlaBalanceOnBaseRaw(); + await stateManager.saveState(state); + } + + const brlaBalanceBefore = BigInt(state.brlaBalanceBeforeNablaRaw); + + let approveHash = state.nablaApproveHash; + let swapHash = state.nablaSwapHash; + + if (!swapHash) { + const evmClientManager = EvmClientManager.getInstance(); + const quoteAbi = [ + { + inputs: [ + { name: "_amountIn", type: "uint256" }, + { name: "_tokenPath", type: "address[]" }, + { name: "_routerPath", type: "address[]" } + ], + name: "quoteSwapExactTokensForTokens", + outputs: [{ name: "amountOut_", type: "uint256" }], + stateMutability: "view", + type: "function" + } + ] as const; + + const { quoter } = getNablaBasePool(USDC_BASE, ERC20_BRLA_BASE); + const expectedOutputRaw = await evmClientManager.readContractWithRetry(Networks.Base, { + abi: quoteAbi, + address: quoter, + args: [BigInt(usdcAmountRaw), [USDC_BASE, ERC20_BRLA_BASE], [router]], + functionName: "quoteSwapExactTokensForTokens" + }); + + const expectedOutputDecimal = multiplyByPowerOfTen(Big(expectedOutputRaw.toString()), -18); + console.log(`Expected BRLA output: ${expectedOutputDecimal.toFixed(4)}`); + + const nablaHardMinimumOutputRaw = Big(expectedOutputRaw.toString()) + .mul(1 - AMM_MINIMUM_OUTPUT_HARD_MARGIN) + .toFixed(0, 0); + + const { approve, swap } = await createNablaTransactionsForOnrampOnEVM( + usdcAmountRaw, + { address: executorAddress, type: EphemeralAccountType.EVM }, + USDC_BASE, + ERC20_BRLA_BASE, + nablaHardMinimumOutputRaw, + NABLA_SWAP_DEADLINE_MINUTES, + router + ); + + if (!approveHash) { + console.log("Sending Nabla approve transaction on Base..."); + const { maxFeePerGas: approveFee, maxPriorityFeePerGas: approveTip } = await publicClient.estimateFeesPerGas(); + approveHash = await walletClient.sendTransaction({ + account: walletClient.account, + chain: base, + data: approve.data, + gas: BigInt(approve.gas), + maxFeePerGas: approveFee, + maxPriorityFeePerGas: approveTip, + nonce: baseNonce.next(), + to: approve.to, + value: BigInt(approve.value) + }); + state.nablaApproveHash = approveHash; + await stateManager.saveState(state); + console.log(`Approve tx sent: ${approveHash}`); + } else { + console.log(`Resuming Nabla approval with existing tx: ${approveHash}`); + } + + await waitForTransactionConfirmation(approveHash, publicClient); + console.log("Nabla approval confirmed."); + + console.log("Sending Nabla swap transaction on Base..."); + const { maxFeePerGas: swapFee, maxPriorityFeePerGas: swapTip } = await publicClient.estimateFeesPerGas(); + swapHash = await walletClient.sendTransaction({ + account: walletClient.account, + chain: base, + data: swap.data, + gas: BigInt(swap.gas), + maxFeePerGas: swapFee, + maxPriorityFeePerGas: swapTip, + nonce: baseNonce.next(), + to: swap.to, + value: BigInt(swap.value) + }); + state.nablaSwapHash = swapHash; + await stateManager.saveState(state); + console.log(`Swap tx sent: ${swapHash}`); + } else { + console.log(`Resuming Nabla swap with existing approve tx: ${approveHash}, swap tx: ${swapHash}`); + } + + if (!approveHash || !swapHash) { + throw new Error("State corrupted: Nabla transaction hash missing after swap step."); + } + + await waitForTransactionConfirmation(swapHash, publicClient); + console.log("Nabla swap confirmed."); + + // Delay to let the RPC sync the post-swap state before reading the balance + await new Promise(resolve => setTimeout(resolve, 5_000)); + + const brlaBalanceAfter = await publicClient.readContract({ + abi: erc20Abi, + address: ERC20_BRLA_BASE, + args: [executorAddress], + functionName: "balanceOf" + }); + + const brlaReceivedRaw = brlaBalanceAfter - brlaBalanceBefore; + if (brlaReceivedRaw < 0n) { + throw new Error( + `BRLA balance decreased after swap (pre: ${brlaBalanceBefore}, post: ${brlaBalanceAfter}). Possible external interference.` + ); + } + if (brlaReceivedRaw === 0n) { + throw new Error(`No BRLA balance delta detected after Nabla swap (pre: ${brlaBalanceBefore}, post: ${brlaBalanceAfter}).`); + } + const brlaAmountRaw = brlaReceivedRaw.toString(); + const brlaAmountDecimal = multiplyByPowerOfTen(Big(brlaAmountRaw), -18); + console.log(`Received ${brlaAmountDecimal.toFixed(4)} BRLA on Base (pre: ${brlaBalanceBefore}, post: ${brlaBalanceAfter})`); + + return { + approveHash, + brlaAmountDecimal, + brlaAmountRaw, + swapHash + }; +} + +export async function transferBrlaToAveniaOnBase( + brlaAmountRaw: string, + baseNonce: NonceManager, + state: UsdcBaseRebalanceState, + stateManager: UsdcBaseStateManager +): Promise { + const { brlaBusinessAccountAddress } = getConfig(); + const { walletClient, publicClient } = getBaseEvmClients(); + + if (state.brlaTransferHash) { + console.log(`Resuming BRLA transfer with existing tx: ${state.brlaTransferHash}. Verifying on-chain...`); + await waitForTransactionConfirmation(state.brlaTransferHash, publicClient); + return state.brlaTransferHash; + } + + console.log(`Transferring ${brlaAmountRaw} BRLA (raw) to Avenia account ${brlaBusinessAccountAddress} on Base...`); + + const data = encodeFunctionData({ + abi: erc20Abi, + args: [brlaBusinessAccountAddress as `0x${string}`, BigInt(brlaAmountRaw)], + functionName: "transfer" + }); + + const { maxFeePerGas, maxPriorityFeePerGas } = await publicClient.estimateFeesPerGas(); + + const txHash = await walletClient.sendTransaction({ + account: walletClient.account, + chain: base, + data, + gas: 100000n, + maxFeePerGas, + maxPriorityFeePerGas, + nonce: baseNonce.next(), + to: ERC20_BRLA_BASE, + value: 0n + }); + + state.brlaTransferHash = txHash; + await stateManager.saveState(state); + console.log(`BRLA transfer tx sent: ${txHash}`); + await waitForTransactionConfirmation(txHash, publicClient); + console.log("BRLA transfer to Avenia confirmed on Base."); + + return txHash; +} + +export async function waitForBrlaOnAvenia(brlaAmountDecimal: Big, startingBrlaBalanceDecimal: Big): Promise { + const pollInterval = 5000; + const timeout = 10 * 60 * 1000; + const startTime = Date.now(); + const brlaApiService = BrlaApiService.getInstance(); + // Use generous tolerance (95%) — continue with whatever actually arrives after fees. + const minimumReceived = calculateMinimumDelta(brlaAmountDecimal, "0.95"); + + console.log(`Waiting for ~${brlaAmountDecimal.toFixed(4)} BRLA delta to appear on Avenia main account balance...`); + + while (Date.now() - startTime < timeout) { + try { + const balanceResponse = await brlaApiService.getMainAccountBalance(); + if (balanceResponse && balanceResponse.balances && balanceResponse.balances.BRLA !== undefined) { + const balanceDecimal = Big(balanceResponse.balances.BRLA); + const receivedDelta = balanceDecimal.minus(startingBrlaBalanceDecimal); + if (receivedDelta.gte(minimumReceived)) { + console.log(`Sufficient BRLA delta found on Avenia: ${receivedDelta.toString()}`); + return receivedDelta.toString(); + } + console.log( + `Insufficient BRLA delta. Needed: ${minimumReceived.toFixed(12)}, received: ${receivedDelta.toFixed(12)}. Retrying...` + ); + } + } catch (error) { + console.log("Polling for Avenia balance failed with error. Retrying...", error); + } + await new Promise(resolve => setTimeout(resolve, pollInterval)); + } + + throw new Error(`Avenia BRLA balance check timed out after 10 minutes. Needed ~${brlaAmountDecimal.toFixed(4)} BRLA.`); +} + +export async function fetchSquidRouterQuote(brlaAmountDecimal: Big): Promise { + const { walletClient: baseWalletClient } = getBaseEvmClients(); + const baseAddress = baseWalletClient.account.address; + const { walletClient: polygonWalletClient } = getPolygonEvmClients(); + const polygonAddress = polygonWalletClient.account.address; + const brlaAmountRaw = multiplyByPowerOfTen(brlaAmountDecimal, 18).toFixed(0, 0); + + const routeResult = await getRoute( + { + bypassGuardrails: true, + enableExpress: true, + fromAddress: polygonAddress, + fromAmount: brlaAmountRaw, + fromChain: getNetworkId(Networks.Polygon).toString(), + fromToken: BRLA_POLYGON, + slippage: 4, + toAddress: baseAddress, + toChain: getNetworkId(Networks.Base).toString(), + toToken: USDC_BASE + }, + { useCache: true } + ); + + const quoteUsdc = routeResult.data.route.estimate.toAmount; + console.log(`SquidRouter quote: ${quoteUsdc} USDC (raw, 6 decimals)`); + return quoteUsdc; +} + +export async function fetchAveniaQuote(brlaAmountDecimal: Big): Promise { + const brlaApiService = BrlaApiService.getInstance(); + const aveniaQuote = await brlaApiService.createOnchainSwapQuote( + { + inputAmount: brlaAmountDecimal.toFixed(4, 0), + inputCurrency: BrlaCurrency.BRLA, + outputCurrency: BrlaCurrency.USDC, + outputPaymentMethod: AveniaPaymentMethod.BASE + }, + { useCache: true } + ); + + // Avenia API returns outputAmount in decimal units. Convert to raw USDC (6 decimals). + const outputUsdcRaw = multiplyByPowerOfTen(Big(aveniaQuote.outputAmount), 6).toFixed(0, 0); + console.log(`Avenia quote: ${outputUsdcRaw} USDC (raw, 6 decimals)`); + return outputUsdcRaw; +} + +export async function compareRates(brlaAmountDecimal: Big): Promise<{ + winningRoute: "squidrouter" | "avenia"; + squidRouterQuoteUsdc: string | null; + aveniaQuoteUsdc: string | null; +}> { + console.log("Comparing SquidRouter vs Avenia rates for BRLA -> USDC..."); + + let squidRouterQuoteUsdc: string | null = null; + let aveniaQuoteUsdc: string | null = null; + + try { + squidRouterQuoteUsdc = await fetchSquidRouterQuote(brlaAmountDecimal); + } catch (error) { + console.warn("SquidRouter quote failed:", error); + } + + try { + aveniaQuoteUsdc = await fetchAveniaQuote(brlaAmountDecimal); + } catch (error) { + console.warn("Avenia quote failed:", error); + } + + if (!squidRouterQuoteUsdc && !aveniaQuoteUsdc) { + throw new Error("Both SquidRouter and Avenia quotes failed. Cannot proceed."); + } + + if (!squidRouterQuoteUsdc) { + console.log("SquidRouter unavailable, using Avenia."); + return { aveniaQuoteUsdc, squidRouterQuoteUsdc, winningRoute: "avenia" }; + } + + if (!aveniaQuoteUsdc) { + console.log("Avenia unavailable, using SquidRouter."); + return { aveniaQuoteUsdc, squidRouterQuoteUsdc, winningRoute: "squidrouter" }; + } + + const squidUsdcDecimal = multiplyByPowerOfTen(Big(squidRouterQuoteUsdc), -6); + const aveniaUsdcDecimal = multiplyByPowerOfTen(Big(aveniaQuoteUsdc), -6); + + console.log(`SquidRouter: ${squidUsdcDecimal.toFixed(6)} USDC | Avenia: ${aveniaUsdcDecimal.toFixed(6)} USDC`); + + const winningRoute = squidUsdcDecimal.gt(aveniaUsdcDecimal) ? "squidrouter" : "avenia"; + console.log(`Winner: ${winningRoute}`); + + return { aveniaQuoteUsdc, squidRouterQuoteUsdc, winningRoute }; +} + +export async function aveniaTransferBrlaToPolygon(brlaAmountDecimal: Big): Promise { + console.log(`Requesting Avenia to transfer ${brlaAmountDecimal.toFixed(4)} BRLA from internal balance to Polygon...`); + + const brlaApiService = BrlaApiService.getInstance(); + + const quote = await brlaApiService.createOnchainSwapQuote({ + inputAmount: brlaAmountDecimal.toFixed(4, 0), + inputCurrency: BrlaCurrency.BRLA, + outputCurrency: BrlaCurrency.BRLA, + outputPaymentMethod: AveniaPaymentMethod.POLYGON + }); + + const { walletClient: polygonWalletClient } = getPolygonEvmClients(); + const polygonAddress = polygonWalletClient.account.address; + + const ticket = await brlaApiService.createOnchainSwapTicket({ + quoteToken: quote.quoteToken, + ticketBlockchainOutput: { + walletAddress: polygonAddress, + walletChain: AveniaPaymentMethod.POLYGON + } + }); + console.log(`Avenia transfer ticket created: ${ticket.id}`); + return ticket.id; +} + +export async function waitBrlaOnPolygon(brlaAmountRaw: string, startingBrlaBalanceRaw: string): Promise { + const { walletClient: polygonWalletClient } = getPolygonEvmClients(); + const polygonAddress = polygonWalletClient.account.address; + // Use a generous tolerance (95%) — we continue with whatever actually arrives. + const targetBalanceRaw = calculateTargetBalanceRaw(startingBrlaBalanceRaw, brlaAmountRaw, "0.95"); + + console.log(`Waiting for BRLA delta to arrive on Polygon (${polygonAddress})...`); + + const finalBalance = await checkEvmBalancePeriodically( + BRLA_POLYGON, + polygonAddress, + targetBalanceRaw, + 1_000, + 10 * 60 * 1_000, + Networks.Polygon + ); + + const arrivedRaw = finalBalance.minus(Big(startingBrlaBalanceRaw)).toFixed(0, 0); + console.log(`BRLA arrived on Polygon. Actual delta: ${arrivedRaw} raw`); + return arrivedRaw; +} + +export async function squidRouterApproveAndSwap( + brlaAmountRaw: string, + baseReceiverAddress: `0x${string}`, + polygonNonce: NonceManager, + state: UsdcBaseRebalanceState, + stateManager: UsdcBaseStateManager +): Promise<{ swapHash: string; toAmountUsd: string; toAmountRaw: string }> { + let swapHash = state.squidRouterSwapHash; + let toAmountUsd = "0"; + let toAmountRaw = state.squidRouterQuoteUsdc ?? "0"; + + if (!swapHash) { + console.log("Executing SquidRouter swap: Polygon BRLA -> Base USDC..."); + + const { walletClient: polygonWalletClient, publicClient: polygonPublicClient } = getPolygonEvmClients(); + const polygonAddress = polygonWalletClient.account.address; + + const routeResult = await getRoute({ + bypassGuardrails: true, + enableExpress: true, + fromAddress: polygonAddress, + fromAmount: brlaAmountRaw, + fromChain: getNetworkId(Networks.Polygon).toString(), + fromToken: BRLA_POLYGON, + slippage: 4, + toAddress: baseReceiverAddress, + toChain: getNetworkId(Networks.Base).toString(), + toToken: USDC_BASE + }); + + const route = routeResult.data.route; + toAmountUsd = route.estimate.toAmountUSD; + toAmountRaw = route.estimate.toAmount; + console.log(`SquidRouter route obtained. Expected output: ${toAmountRaw} USDC (raw)`); + + const { approveData, swapData } = await createTransactionDataFromRoute({ + inputTokenErc20Address: BRLA_POLYGON, + publicClient: polygonPublicClient, + rawAmount: brlaAmountRaw, + route + }); + + console.log("Sending SquidRouter approve transaction on Polygon..."); + const { maxFeePerGas: approveFee, maxPriorityFeePerGas: approveTip } = await polygonPublicClient.estimateFeesPerGas(); + const approveHash = await polygonWalletClient.sendTransaction({ + account: polygonWalletClient.account, + chain: polygon, + data: approveData.data, + gas: BigInt(approveData.gas), + maxFeePerGas: approveFee * 5n, + maxPriorityFeePerGas: approveTip * 5n, + nonce: polygonNonce.next(), + to: approveData.to, + value: BigInt(approveData.value) + }); + console.log(`Approve tx: ${approveHash}`); + await waitForTransactionConfirmation(approveHash, polygonPublicClient); + + console.log("Sending SquidRouter swap transaction on Polygon..."); + const { maxFeePerGas: swapFee, maxPriorityFeePerGas: swapTip } = await polygonPublicClient.estimateFeesPerGas(); + swapHash = await polygonWalletClient.sendTransaction({ + account: polygonWalletClient.account, + chain: polygon, + data: swapData.data, + gas: BigInt(swapData.gas), + maxFeePerGas: swapFee * 5n, + maxPriorityFeePerGas: swapTip * 5n, + nonce: polygonNonce.next(), + to: swapData.to, + value: BigInt(swapData.value) + }); + state.squidRouterSwapHash = swapHash; + await stateManager.saveState(state); + console.log(`Swap tx: ${swapHash}`); + await waitForTransactionConfirmation(swapHash, polygonPublicClient); + } else { + if (!state.squidRouterQuoteUsdc) { + throw new Error("State corrupted: squidRouterQuoteUsdc missing while resuming SquidRouter swap."); + } + console.log(`Resuming SquidRouter swap with existing swap tx: ${swapHash}`); + } + + console.log("Waiting for Axelar to execute the cross-chain swap..."); + let isExecuted = false; + const axelarTimeout = 30 * 60 * 1000; + const axelarStartTime = Date.now(); + + while (Date.now() - axelarStartTime < axelarTimeout) { + const axelarScanStatus = await getStatusAxelarScan(swapHash); + if (axelarScanStatus && (axelarScanStatus.status === "executed" || axelarScanStatus.status === "express_executed")) { + isExecuted = true; + console.log(`Axelar execution confirmed: ${axelarScanStatus.status}`); + break; + } + console.log("Waiting for Axelar execution..."); + await new Promise(resolve => setTimeout(resolve, 10000)); + } + + if (!isExecuted) { + throw new Error("Axelar execution timed out after 30 minutes"); + } + + return { swapHash, toAmountRaw, toAmountUsd }; +} + +export async function waitUsdcOnBase(expectedUsdcRaw: string, startingUsdcBalanceRaw: string): Promise { + const { walletClient } = getBaseEvmClients(); + const baseAddress = walletClient.account.address; + const targetBalanceRaw = calculateTargetBalanceRaw(startingUsdcBalanceRaw, expectedUsdcRaw, DEFAULT_ARRIVAL_TOLERANCE); + + console.log(`Waiting for USDC delta to arrive on Base (${baseAddress})...`); + + const finalBalanceRaw = await checkEvmBalancePeriodically( + USDC_BASE, + baseAddress, + targetBalanceRaw, + 1_000, + 30 * 60 * 1_000, + Networks.Base + ); + const receivedDeltaRaw = finalBalanceRaw.minus(Big(startingUsdcBalanceRaw)).toFixed(0, 0); + + console.log(`USDC arrived on Base. Actual delta: ${receivedDeltaRaw} raw`); + return receivedDeltaRaw; +} + +export async function aveniaCreateSwapToUsdcBaseTicket( + brlaAmountDecimal: Big, + baseReceiverAddress: `0x${string}` +): Promise<{ + ticketId: string; + outputAmount: string; +}> { + console.log(`Creating Avenia swap ticket: BRLA -> USDC on Base for ${brlaAmountDecimal.toFixed(4)} BRLA...`); + + const brlaApiService = BrlaApiService.getInstance(); + + const quote = await brlaApiService.createOnchainSwapQuote({ + inputAmount: brlaAmountDecimal.toFixed(4, 0), + inputCurrency: BrlaCurrency.BRLA, + outputCurrency: BrlaCurrency.USDC, + outputPaymentMethod: AveniaPaymentMethod.BASE + }); + + const ticket = await brlaApiService.createOnchainSwapTicket({ + quoteToken: quote.quoteToken, + ticketBlockchainOutput: { + walletAddress: baseReceiverAddress, + walletChain: AveniaPaymentMethod.BASE + } + }); + console.log(`Avenia swap ticket created: ${ticket.id}`); + + // Avenia API returns outputAmount in decimal units. + return { outputAmount: quote.outputAmount, ticketId: ticket.id }; +} + +export async function verifyFinalUsdcBalanceOnBase(): Promise { + const { publicClient, walletClient } = getBaseEvmClients(); + const address = walletClient.account.address; + + const balance = await publicClient.readContract({ + abi: erc20Abi, + address: USDC_BASE, + args: [address], + functionName: "balanceOf" + }); + + const balanceDecimal = multiplyByPowerOfTen(Big(balance.toString()), -6); + console.log(`Final USDC balance on Base (${address}): ${balanceDecimal.toFixed(6)} USDC`); + + return balanceDecimal; +} + +// ── Main Nabla route (BRL → USDC on a second Nabla instance on Base) ───────── + +const MAIN_NABLA_QUOTE_ABI = [ + { + inputs: [ + { name: "_amountIn", type: "uint256" }, + { name: "_tokenPath", type: "address[]" }, + { name: "_routerPath", type: "address[]" } + ], + name: "quoteSwapExactTokensForTokens", + outputs: [{ name: "amountOut_", type: "uint256" }], + stateMutability: "view", + type: "function" + } +] as const; + +function getMainNablaConfig() { + const config = getConfig(); + if (!config.mainNablaRouter || !config.mainNablaQuoter) { + throw new Error("Main Nabla route requires MAIN_NABLA_ROUTER and MAIN_NABLA_QUOTER env vars."); + } + return { + brlaToken: ERC20_BRLA_BASE, + quoter: config.mainNablaQuoter, + router: config.mainNablaRouter, + usdcToken: USDC_BASE + }; +} + +/** + * Fetches a quote from the main Nabla instance for BRL→USDC. + * Returns the expected USDC output in raw units (6 decimals assumed for USDC). + */ +export async function fetchMainNablaQuote(brlaAmountRaw: string): Promise { + const { router, quoter, brlaToken, usdcToken } = getMainNablaConfig(); + const evmClientManager = EvmClientManager.getInstance(); + + const expectedOutputRaw = await evmClientManager.readContractWithRetry(Networks.Base, { + abi: MAIN_NABLA_QUOTE_ABI, + address: quoter, + args: [BigInt(brlaAmountRaw), [brlaToken, usdcToken], [router]], + functionName: "quoteSwapExactTokensForTokens" + }); + + const expectedOutputDecimal = multiplyByPowerOfTen(Big(expectedOutputRaw.toString()), -6); + console.log(`Main Nabla quote: ${expectedOutputDecimal.toFixed(6)} USDC`); + return expectedOutputRaw.toString(); +} + +/** + * Quotes the first Nabla swap (USDC→BRLA) to estimate how much BRLA we'd get, + * then quotes all 3 return routes to compare them upfront. + */ +export async function compareRoutesUpfront(usdcAmountRaw: string): Promise<{ + winningRoute: WinningRoute; + estimatedBrlaRaw: string; + squidRouterQuoteUsdc: string | null; + aveniaQuoteUsdc: string | null; + mainNablaQuoteUsdc: string | null; +}> { + console.log("Quoting first Nabla (USDC→BRLA) to estimate BRLA output for route comparison..."); + + const evmClientManager = EvmClientManager.getInstance(); + const quoteAbi = [ + { + inputs: [ + { name: "_amountIn", type: "uint256" }, + { name: "_tokenPath", type: "address[]" }, + { name: "_routerPath", type: "address[]" } + ], + name: "quoteSwapExactTokensForTokens", + outputs: [{ name: "amountOut_", type: "uint256" }], + stateMutability: "view", + type: "function" + } + ] as const; + + const { router, quoter } = getNablaBasePool(USDC_BASE, ERC20_BRLA_BASE); + const estimatedBrlaRaw = await evmClientManager.readContractWithRetry(Networks.Base, { + abi: quoteAbi, + address: quoter, + args: [BigInt(usdcAmountRaw), [USDC_BASE, ERC20_BRLA_BASE], [router]], + functionName: "quoteSwapExactTokensForTokens" + }); + + const estimatedBrlaDecimal = multiplyByPowerOfTen(Big(estimatedBrlaRaw.toString()), -18); + console.log(`Estimated BRLA from first Nabla: ${estimatedBrlaDecimal.toFixed(6)}`); + + // Quote all 3 return routes in parallel + let squidRouterQuoteUsdc: string | null = null; + let aveniaQuoteUsdc: string | null = null; + let mainNablaQuoteUsdc: string | null = null; + + const config = getConfig(); + const mainNablaAvailable = !!(config.mainNablaRouter && config.mainNablaQuoter); + + const results = await Promise.allSettled([ + fetchSquidRouterQuote(estimatedBrlaDecimal), + fetchAveniaQuote(estimatedBrlaDecimal), + mainNablaAvailable ? fetchMainNablaQuote(estimatedBrlaRaw.toString()) : Promise.reject("not configured") + ]); + + if (results[0].status === "fulfilled") { + squidRouterQuoteUsdc = results[0].value; + } else { + console.warn("SquidRouter quote failed:", results[0].reason); + } + + if (results[1].status === "fulfilled") { + aveniaQuoteUsdc = results[1].value; + } else { + console.warn("Avenia quote failed:", results[1].reason); + } + + if (results[2].status === "fulfilled") { + mainNablaQuoteUsdc = results[2].value; + } else if (mainNablaAvailable) { + console.warn("Main Nabla quote failed:", results[2].reason); + } + + // Normalize all quotes to decimal USDC for comparison + const candidates: { route: WinningRoute; usdcDecimal: Big }[] = []; + + if (squidRouterQuoteUsdc) { + candidates.push({ route: "squidrouter", usdcDecimal: multiplyByPowerOfTen(Big(squidRouterQuoteUsdc), -6) }); + } + if (aveniaQuoteUsdc) { + candidates.push({ route: "avenia", usdcDecimal: multiplyByPowerOfTen(Big(aveniaQuoteUsdc), -6) }); + } + if (mainNablaQuoteUsdc) { + candidates.push({ route: "nabla-main", usdcDecimal: multiplyByPowerOfTen(Big(mainNablaQuoteUsdc), -6) }); + } + + if (candidates.length === 0) { + throw new Error("All route quotes failed. Cannot proceed."); + } + + candidates.sort((a, b) => (b.usdcDecimal.gt(a.usdcDecimal) ? 1 : -1)); + const winner = candidates[0] as (typeof candidates)[number]; + + console.log("Route comparison results:"); + for (const c of candidates) { + console.log(` ${c.route}: ${c.usdcDecimal.toFixed(6)} USDC ${c.route === winner.route ? "(WINNER)" : ""}`); + } + + return { + aveniaQuoteUsdc, + estimatedBrlaRaw: estimatedBrlaRaw.toString(), + mainNablaQuoteUsdc, + squidRouterQuoteUsdc, + winningRoute: winner.route + }; +} + +/** + * Approve and swap BRL→USDC on the main Nabla instance on Base. + * This is the terminal step for the nabla-main route. + */ +export async function mainNablaApproveAndSwap( + brlaAmountRaw: string, + baseNonce: NonceManager, + state: UsdcBaseRebalanceState, + stateManager: UsdcBaseStateManager +): Promise<{ approveHash: string; swapHash: string; usdcReceivedRaw: string }> { + const { router, brlaToken, usdcToken } = getMainNablaConfig(); + const { walletClient, publicClient } = getBaseEvmClients(); + const executorAddress = walletClient.account.address; + + console.log(`Starting Main Nabla swap of ${brlaAmountRaw} BRLA (raw) to USDC on Base...`); + + if (state.mainNablaApproveHash && state.mainNablaSwapHash) { + console.log("Resuming Main Nabla swap with previously recorded hashes."); + } + + if (!state.mainNablaUsdcBalanceBeforeRaw) { + state.mainNablaUsdcBalanceBeforeRaw = await getUsdcBalanceOnBaseRaw(); + await stateManager.saveState(state); + } + const usdcBalanceBefore = BigInt(state.mainNablaUsdcBalanceBeforeRaw); + + let approveHash = state.mainNablaApproveHash; + let swapHash = state.mainNablaSwapHash; + + if (!swapHash) { + const evmClientManager = EvmClientManager.getInstance(); + const { quoter } = getMainNablaConfig(); + const expectedOutputRaw = await evmClientManager.readContractWithRetry(Networks.Base, { + abi: MAIN_NABLA_QUOTE_ABI, + address: quoter, + args: [BigInt(brlaAmountRaw), [brlaToken, usdcToken], [router]], + functionName: "quoteSwapExactTokensForTokens" + }); + + const nablaHardMinimumOutputRaw = Big(expectedOutputRaw.toString()) + .mul(1 - AMM_MINIMUM_OUTPUT_HARD_MARGIN) + .toFixed(0, 0); + + const { approve, swap } = await createNablaTransactionsForOnrampOnEVM( + brlaAmountRaw, + { address: executorAddress, type: EphemeralAccountType.EVM }, + brlaToken, + usdcToken, + nablaHardMinimumOutputRaw, + NABLA_SWAP_DEADLINE_MINUTES, + router + ); + + if (!approveHash) { + console.log("Sending Main Nabla approve transaction on Base..."); + const { maxFeePerGas: approveFee, maxPriorityFeePerGas: approveTip } = await publicClient.estimateFeesPerGas(); + approveHash = await walletClient.sendTransaction({ + account: walletClient.account, + chain: base, + data: approve.data, + gas: BigInt(approve.gas), + maxFeePerGas: approveFee, + maxPriorityFeePerGas: approveTip, + nonce: baseNonce.next(), + to: approve.to, + value: BigInt(approve.value) + }); + state.mainNablaApproveHash = approveHash; + await stateManager.saveState(state); + console.log(`Main Nabla approve tx sent: ${approveHash}`); + } else { + console.log(`Resuming Main Nabla approval with existing tx: ${approveHash}`); + } + + await waitForTransactionConfirmation(approveHash, publicClient); + console.log("Main Nabla approval confirmed."); + + console.log("Sending Main Nabla swap transaction on Base..."); + const { maxFeePerGas: swapFee, maxPriorityFeePerGas: swapTip } = await publicClient.estimateFeesPerGas(); + swapHash = await walletClient.sendTransaction({ + account: walletClient.account, + chain: base, + data: swap.data, + gas: BigInt(swap.gas), + maxFeePerGas: swapFee, + maxPriorityFeePerGas: swapTip, + nonce: baseNonce.next(), + to: swap.to, + value: BigInt(swap.value) + }); + state.mainNablaSwapHash = swapHash; + await stateManager.saveState(state); + console.log(`Main Nabla swap tx sent: ${swapHash}`); + } else { + console.log(`Resuming Main Nabla swap with existing approve tx: ${approveHash}, swap tx: ${swapHash}`); + } + + if (!approveHash || !swapHash) { + throw new Error("State corrupted: Main Nabla transaction hash missing after swap step."); + } + + await waitForTransactionConfirmation(swapHash, publicClient); + console.log("Main Nabla swap confirmed."); + + // Delay to let the RPC sync post-swap state + await new Promise(resolve => setTimeout(resolve, 5_000)); + + const usdcBalanceAfter = await publicClient.readContract({ + abi: erc20Abi, + address: USDC_BASE, + args: [executorAddress], + functionName: "balanceOf" + }); + + const usdcReceivedRaw = (usdcBalanceAfter - usdcBalanceBefore).toString(); + const usdcReceivedDecimal = multiplyByPowerOfTen(Big(usdcReceivedRaw), -6); + console.log(`Received ${usdcReceivedDecimal.toFixed(6)} USDC from Main Nabla swap.`); + + return { approveHash, swapHash, usdcReceivedRaw }; +} diff --git a/apps/rebalancer/src/services/indexer/index.ts b/apps/rebalancer/src/services/indexer/index.ts index 1c9e05888..3ef41f780 100644 --- a/apps/rebalancer/src/services/indexer/index.ts +++ b/apps/rebalancer/src/services/indexer/index.ts @@ -1,6 +1,78 @@ +import { ERC20_BRLA_BASE, EvmClientManager, NABLA_ROUTER_BASE_BRLA, Networks } from "@vortexfi/shared"; +import Big from "big.js"; import { getConfig } from "../../utils/config.ts"; import { fetchLatestBlockFromIndexer, fetchNablaInstance } from "./graphql.ts"; +const SWAP_POOL_ABI = [ + { + inputs: [], + name: "reserve", + outputs: [{ type: "uint256" }], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalLiabilities", + outputs: [{ type: "uint256" }], + stateMutability: "view", + type: "function" + } +] as const; + +const ROUTER_ABI = [ + { + inputs: [{ name: "asset", type: "address" }], + name: "poolByAsset", + outputs: [{ type: "address" }], + stateMutability: "view", + type: "function" + } +] as const; + +export async function getBaseNablaCoverageRatio(): Promise< + { brlaCoverageRatio: number; usdcCoverageRatio: number } | undefined +> { + try { + const evmClientManager = EvmClientManager.getInstance(); + const baseClient = evmClientManager.getClient(Networks.Base); + + const brlaPoolAddress = (await baseClient.readContract({ + abi: ROUTER_ABI, + address: NABLA_ROUTER_BASE_BRLA, + args: [ERC20_BRLA_BASE], + functionName: "poolByAsset" + })) as `0x${string}`; + + if (brlaPoolAddress === "0x0000000000000000000000000000000000000000") { + console.error(`No BRLA pool found on Base Nabla router (${NABLA_ROUTER_BASE_BRLA}) for asset ${ERC20_BRLA_BASE}.`); + return undefined; + } + const [brlaReserve, brlaLiabilities] = await Promise.all([ + baseClient.readContract({ + abi: SWAP_POOL_ABI, + address: brlaPoolAddress, + functionName: "reserve" + }) as Promise, + baseClient.readContract({ + abi: SWAP_POOL_ABI, + address: brlaPoolAddress, + functionName: "totalLiabilities" + }) as Promise + ]); + + const brlaCoverageRatio = + brlaLiabilities > 0n ? new Big(brlaReserve.toString()).div(new Big(brlaLiabilities.toString())).toNumber() : 0; + + console.log(`Base Nabla BRLA pool coverage ratio: ${brlaCoverageRatio}`); + + return { brlaCoverageRatio, usdcCoverageRatio: 0 }; + } catch (error) { + console.error("Failed to fetch Base Nabla coverage ratio:", error); + return undefined; + } +} + /// This function retrieves all swap pools from the Nabla instance and checks their coverage ratios. /// If the coverage ratio of a pool is below the specified threshold, it adds that pool to the list of non-sufficient pools. /// @param coverageRatioThreshold - The threshold for the coverage ratio to consider it sufficient. Default is 0.5. diff --git a/apps/rebalancer/src/services/stateManager.ts b/apps/rebalancer/src/services/stateManager.ts index f4ce27db5..724cbf8ef 100644 --- a/apps/rebalancer/src/services/stateManager.ts +++ b/apps/rebalancer/src/services/stateManager.ts @@ -2,6 +2,60 @@ import { createClient } from "@supabase/supabase-js"; import Big from "big.js"; import { getConfig } from "../utils/config"; +export class StateManager { + private supabase; + private filename: string; + + constructor(filename: string) { + const config = getConfig(); + if (!config.supabaseUrl || !config.supabaseServiceKey) { + throw new Error("Missing SUPABASE_URL or SUPABASE_SERVICE_KEY environment variables"); + } + this.filename = filename; + this.supabase = createClient(config.supabaseUrl, config.supabaseServiceKey); + } + + async getState(): Promise { + const { data, error } = await this.supabase.storage.from("rebalancer_state").download(this.filename); + + if (error) { + const storageError = error as { statusCode?: number | string; message?: string }; + const statusCode = storageError.statusCode; + if (statusCode === 404 || statusCode === "404" || storageError.message?.includes("not found")) { + return undefined; + } + throw error; + } + + const stateText = await data.text(); + try { + return JSON.parse(stateText) as T; + } catch { + console.warn("Rebalancer state is not valid JSON, treating as missing."); + return undefined; + } + } + + async saveState(state: T): Promise { + if (state && typeof state === "object" && "updatedTime" in state) { + (state as { updatedTime: string }).updatedTime = new Date().toISOString(); + } + const stateString = JSON.stringify(state); + + const { error } = await this.supabase.storage.from("rebalancer_state").upload(this.filename, stateString, { + cacheControl: "3600", + contentType: "application/json", + upsert: true + }); + + if (error) { + throw error; + } + } +} + +// --- BRLA-to-axlUSDC (Pendulum) rebalance flow --- + export enum RebalancePhase { Idle = "idle", CheckInitialPendulumBalance = "checkInitialPendulumBalance", @@ -50,33 +104,16 @@ export interface RebalanceStateParsed { updatedTime: string; } -export class StateManager { - private supabase; +export class BrlaToAxlUsdcStateManager { + private inner: StateManager; constructor() { - const config = getConfig(); - this.supabase = createClient(config.supabaseUrl!, config.supabaseServiceKey!); - } - - private async getRawState(): Promise { - try { - const { data, error } = await this.supabase.storage.from("rebalancer_state").download("rebalancer_state.json"); - - if (error) throw error; - - const stateText = await data.text(); - return JSON.parse(stateText); - } catch (error: any) { - console.error("Error getting rebalance state:", error); - return undefined; - } + this.inner = new StateManager("rebalancer_state.json"); } async getState(): Promise { - const rawState = await this.getRawState(); - if (!rawState) { - return undefined; - } + const rawState = await this.inner.getState(); + if (!rawState) return undefined; return { ...rawState, @@ -91,24 +128,12 @@ export class StateManager { brlaAmount: state.brlaAmount ? state.brlaAmount.toString() : null, initialBalance: state.initialBalance ? state.initialBalance.toString() : null }; - rawState.updatedTime = new Date().toISOString(); - - const stateString = JSON.stringify(rawState); - - const { data, error } = await this.supabase.storage.from("rebalancer_state").upload("rebalancer_state.json", stateString, { - cacheControl: "3600", - contentType: "application/json", // overwrites the file if it exists - upsert: true - }); - - if (error) { - throw error; - } + await this.inner.saveState(rawState); } async startNewRebalance(amountAxlUsdc: string): Promise { const state: RebalanceStateParsed = { - amountAxlUsdc: amountAxlUsdc, + amountAxlUsdc, brlaAmount: null, brlaToUsdcAmountUsd: null, currentPhase: RebalancePhase.CheckInitialPendulumBalance, @@ -122,3 +147,302 @@ export class StateManager { return state; } } + +// --- USDC->BRLA->USDC (Base) rebalance flow --- + +export enum UsdcBaseRebalancePhase { + Idle = "idle", + CheckInitialUsdcBalance = "checkInitialUsdcBalance", + CompareRates = "compareRates", + NablaApprove = "nablaApprove", + // nabla-main route: swap BRL->USDC on main Nabla (ends here) + MainNablaApproveAndSwap = "mainNablaApproveAndSwap", + // avenia/squid routes continue below + TransferBrlaToAvenia = "transferBrlaToAvenia", + WaitForBrlaOnAvenia = "waitForBrlaOnAvenia", + AveniaTransferToPolygon = "aveniaTransferToPolygon", + WaitBrlaOnPolygon = "waitBrlaOnPolygon", + SquidRouterApproveAndSwap = "squidRouterApproveAndSwap", + WaitUsdcOnBaseFromSquid = "waitUsdcOnBaseFromSquid", + AveniaSwapToUsdcBase = "aveniaSwapToUsdcBase", + WaitUsdcOnBaseFromAvenia = "waitUsdcOnBaseFromAvenia", + VerifyFinalBalance = "verifyFinalBalance" +} + +export const usdcBasePhaseOrder: Record = { + [UsdcBaseRebalancePhase.Idle]: 0, + [UsdcBaseRebalancePhase.CheckInitialUsdcBalance]: 1, + [UsdcBaseRebalancePhase.CompareRates]: 2, + [UsdcBaseRebalancePhase.NablaApprove]: 3, + [UsdcBaseRebalancePhase.MainNablaApproveAndSwap]: 4, + [UsdcBaseRebalancePhase.TransferBrlaToAvenia]: 5, + [UsdcBaseRebalancePhase.WaitForBrlaOnAvenia]: 6, + [UsdcBaseRebalancePhase.AveniaTransferToPolygon]: 7, + [UsdcBaseRebalancePhase.WaitBrlaOnPolygon]: 8, + [UsdcBaseRebalancePhase.SquidRouterApproveAndSwap]: 9, + [UsdcBaseRebalancePhase.WaitUsdcOnBaseFromSquid]: 10, + [UsdcBaseRebalancePhase.AveniaSwapToUsdcBase]: 7, + [UsdcBaseRebalancePhase.WaitUsdcOnBaseFromAvenia]: 8, + [UsdcBaseRebalancePhase.VerifyFinalBalance]: 11 +}; + +export type WinningRoute = "squidrouter" | "avenia" | "nabla-main" | null; + +export interface UsdcBaseRebalanceState { + currentPhase: UsdcBaseRebalancePhase; + initialUsdcBalance: string | null; + usdcAmountRaw: string | null; + brlaAmountRaw: string | null; + brlaAmountDecimal: string | null; + brlaBalanceBeforeNablaRaw: string | null; + nablaApproveHash: string | null; + nablaSwapHash: string | null; + aveniaBrlaBalanceBeforeTransfer: string | null; + brlaTransferHash: string | null; + winningRoute: WinningRoute; + squidRouterQuoteUsdc: string | null; + aveniaQuoteUsdc: string | null; + mainNablaQuoteUsdc: string | null; + mainNablaApproveHash: string | null; + mainNablaSwapHash: string | null; + mainNablaUsdcBalanceBeforeRaw: string | null; + polygonBrlaBalanceBeforeTransferRaw: string | null; + squidRouterSwapHash: string | null; + baseUsdcBalanceBeforeAveniaSwapRaw: string | null; + baseUsdcBalanceBeforeSquidSwapRaw: string | null; + aveniaTicketId: string | null; + finalUsdcBalance: string | null; + startingTime: string; + updatedTime: string; +} + +export interface RebalanceHistoryEntry { + initialAmount: string; + startingTime: string; + endingTime: string; + cost: string; + costRelative: string; +} + +export interface UsdcBaseRebalanceContainer { + state: UsdcBaseRebalanceState; + history: RebalanceHistoryEntry[]; +} + +function createFreshState(): UsdcBaseRebalanceState { + return { + aveniaBrlaBalanceBeforeTransfer: null, + aveniaQuoteUsdc: null, + aveniaTicketId: null, + baseUsdcBalanceBeforeAveniaSwapRaw: null, + baseUsdcBalanceBeforeSquidSwapRaw: null, + brlaAmountDecimal: null, + brlaAmountRaw: null, + brlaBalanceBeforeNablaRaw: null, + brlaTransferHash: null, + currentPhase: UsdcBaseRebalancePhase.Idle, + finalUsdcBalance: null, + initialUsdcBalance: null, + mainNablaApproveHash: null, + mainNablaQuoteUsdc: null, + mainNablaSwapHash: null, + mainNablaUsdcBalanceBeforeRaw: null, + nablaApproveHash: null, + nablaSwapHash: null, + polygonBrlaBalanceBeforeTransferRaw: null, + squidRouterQuoteUsdc: null, + squidRouterSwapHash: null, + startingTime: new Date().toISOString(), + updatedTime: new Date().toISOString(), + usdcAmountRaw: null, + winningRoute: null + }; +} + +export class UsdcBaseStateManager { + private inner: StateManager; + + constructor() { + this.inner = new StateManager("rebalancer_state_usdc_base.json"); + } + + // Handles migration from old flat UsdcBaseRebalanceState to new UsdcBaseRebalanceContainer. + private async getContainer(): Promise { + const raw = await this.inner.getState(); + if (!raw) return undefined; + + if ("currentPhase" in raw && !("state" in raw)) { + return { history: [], state: raw as unknown as UsdcBaseRebalanceState }; + } + + return raw; + } + + async getState(): Promise { + const container = await this.getContainer(); + return container?.state; + } + + async getHistory(): Promise { + const container = await this.getContainer(); + return container?.history ?? []; + } + + async saveState(state: UsdcBaseRebalanceState): Promise { + const existing = await this.getContainer(); + const history = existing?.history ?? []; + state.updatedTime = new Date().toISOString(); + await this.inner.saveState({ history, state }); + } + + async addHistoryEntry(entry: RebalanceHistoryEntry): Promise { + const existing = await this.getContainer(); + if (!existing?.state) { + console.warn("No existing state found for addHistoryEntry. Writing entry to fresh history."); + await this.inner.saveState({ history: [entry], state: createFreshState() }); + return; + } + existing.history.push(entry); + existing.state.updatedTime = new Date().toISOString(); + await this.inner.saveState(existing); + } + + async startNewRebalance(usdcAmountRaw: string): Promise { + const existing = await this.getContainer(); + const history = existing?.history ?? []; + + const state: UsdcBaseRebalanceState = { + aveniaBrlaBalanceBeforeTransfer: null, + aveniaQuoteUsdc: null, + aveniaTicketId: null, + baseUsdcBalanceBeforeAveniaSwapRaw: null, + baseUsdcBalanceBeforeSquidSwapRaw: null, + brlaAmountDecimal: null, + brlaAmountRaw: null, + brlaBalanceBeforeNablaRaw: null, + brlaTransferHash: null, + currentPhase: UsdcBaseRebalancePhase.CheckInitialUsdcBalance, + finalUsdcBalance: null, + initialUsdcBalance: null, + mainNablaApproveHash: null, + mainNablaQuoteUsdc: null, + mainNablaSwapHash: null, + mainNablaUsdcBalanceBeforeRaw: null, + nablaApproveHash: null, + nablaSwapHash: null, + polygonBrlaBalanceBeforeTransferRaw: null, + squidRouterQuoteUsdc: null, + squidRouterSwapHash: null, + startingTime: new Date().toISOString(), + updatedTime: new Date().toISOString(), + usdcAmountRaw, + winningRoute: null + }; + await this.inner.saveState({ history, state }); + return state; + } +} + +// --- BRLA->USDC (Base) rebalance flow --- + +export enum BrlaToUsdcBaseRebalancePhase { + Idle = "idle", + CheckInitialUsdcBalance = "checkInitialUsdcBalance", + MainNablaSwapUsdcToBrla = "mainNablaSwapUsdcToBrla", + NablaSwapBrlaToUsdc = "nablaSwapBrlaToUsdc", + VerifyFinalBalance = "verifyFinalBalance" +} + +export const brlaToUsdcBasePhaseOrder: Record = { + [BrlaToUsdcBaseRebalancePhase.Idle]: 0, + [BrlaToUsdcBaseRebalancePhase.CheckInitialUsdcBalance]: 1, + [BrlaToUsdcBaseRebalancePhase.MainNablaSwapUsdcToBrla]: 2, + [BrlaToUsdcBaseRebalancePhase.NablaSwapBrlaToUsdc]: 3, + [BrlaToUsdcBaseRebalancePhase.VerifyFinalBalance]: 4 +}; + +export interface BrlaToUsdcBaseRebalanceState { + currentPhase: BrlaToUsdcBaseRebalancePhase; + usdcAmountRaw: string | null; + initialUsdcBalance: string | null; + usdcBalanceBeforeNablaRaw: string | null; + nablaApproveHash: string | null; + nablaSwapHash: string | null; + usdcReceivedRaw: string | null; + mainNablaBrlaBalanceBeforeRaw: string | null; + mainNablaApproveHash: string | null; + mainNablaSwapHash: string | null; + mainNablaBrlaReceivedRaw: string | null; + finalUsdcBalance: string | null; + startingTime: string; + updatedTime: string; +} + +export interface BrlaToUsdcBaseRebalanceContainer { + state: BrlaToUsdcBaseRebalanceState; + history: RebalanceHistoryEntry[]; +} + +export class BrlaToUsdcBaseStateManager { + private inner: StateManager; + + constructor() { + this.inner = new StateManager("rebalancer_state_brla_to_usdc_base.json"); + } + + private async getContainer(): Promise { + return this.inner.getState(); + } + + async getState(): Promise { + const container = await this.getContainer(); + return container?.state; + } + + async getHistory(): Promise { + const container = await this.getContainer(); + return container?.history ?? []; + } + + async saveState(state: BrlaToUsdcBaseRebalanceState): Promise { + const existing = await this.getContainer(); + const history = existing?.history ?? []; + state.updatedTime = new Date().toISOString(); + await this.inner.saveState({ history, state }); + } + + async addHistoryEntry(entry: RebalanceHistoryEntry): Promise { + const existing = await this.getContainer(); + if (!existing?.state) { + console.warn("No existing state found for addHistoryEntry. Skipping history entry."); + return; + } + existing.history.push(entry); + existing.state.updatedTime = new Date().toISOString(); + await this.inner.saveState(existing); + } + + async startNewRebalance(usdcAmountRaw: string): Promise { + const existing = await this.getContainer(); + const history = existing?.history ?? []; + + const state: BrlaToUsdcBaseRebalanceState = { + currentPhase: BrlaToUsdcBaseRebalancePhase.CheckInitialUsdcBalance, + finalUsdcBalance: null, + initialUsdcBalance: null, + mainNablaApproveHash: null, + mainNablaBrlaBalanceBeforeRaw: null, + mainNablaBrlaReceivedRaw: null, + mainNablaSwapHash: null, + nablaApproveHash: null, + nablaSwapHash: null, + startingTime: new Date().toISOString(), + updatedTime: new Date().toISOString(), + usdcAmountRaw, + usdcBalanceBeforeNablaRaw: null, + usdcReceivedRaw: null + }; + await this.inner.saveState({ history, state }); + return state; + } +} diff --git a/apps/rebalancer/src/utils/brla.test.ts b/apps/rebalancer/src/utils/brla.test.ts new file mode 100644 index 000000000..be686d015 --- /dev/null +++ b/apps/rebalancer/src/utils/brla.test.ts @@ -0,0 +1,20 @@ +import { describe, expect, test } from "bun:test"; +import { AveniaTicketStatus } from "@vortexfi/shared"; +import { checkTicketStatusPaid } from "./brla.ts"; + +describe("checkTicketStatusPaid", () => { + test("throws immediately for failed tickets", async () => { + const service = { + getAveniaSwapTicket: async () => ({ + status: AveniaTicketStatus.FAILED + }) + }; + + await expect( + Promise.race([ + checkTicketStatusPaid(service as never, "ticket-1"), + new Promise((_, reject) => setTimeout(() => reject(new Error("timed out waiting for terminal failure")), 25)) + ]) + ).rejects.toThrow("FAILED"); + }); +}); diff --git a/apps/rebalancer/src/utils/brla.ts b/apps/rebalancer/src/utils/brla.ts new file mode 100644 index 000000000..2d4b476a7 --- /dev/null +++ b/apps/rebalancer/src/utils/brla.ts @@ -0,0 +1,36 @@ +import { AveniaSwapTicket, AveniaTicketStatus, BrlaApiService } from "@vortexfi/shared"; + +type AveniaTicketReader = Pick; + +export async function checkTicketStatusPaid(brlaApiService: AveniaTicketReader, ticketId: string): Promise { + const pollInterval = 5000; + const timeout = 5 * 60 * 1000; + const startTime = Date.now(); + let lastError: Error | undefined; + + while (Date.now() - startTime < timeout) { + let ticket: AveniaSwapTicket; + try { + ticket = await brlaApiService.getAveniaSwapTicket(ticketId); + } catch (error) { + lastError = error instanceof Error ? error : new Error(String(error)); + console.warn(`Polling for ticket ${ticketId} status failed with error. Retrying...`, lastError); + await new Promise(resolve => setTimeout(resolve, pollInterval)); + continue; + } + + if (ticket?.status === AveniaTicketStatus.PAID) { + return ticket; + } + if (ticket?.status === AveniaTicketStatus.FAILED) { + throw new Error(`Ticket ${ticketId} status is FAILED`); + } + + await new Promise(resolve => setTimeout(resolve, pollInterval)); + } + + if (lastError) { + throw new Error(`Polling for ticket status timed out with an error: ${lastError.message}`); + } + throw new Error("Polling for ticket status timed out."); +} diff --git a/apps/rebalancer/src/utils/config.test.ts b/apps/rebalancer/src/utils/config.test.ts new file mode 100644 index 000000000..5aeb01cd4 --- /dev/null +++ b/apps/rebalancer/src/utils/config.test.ts @@ -0,0 +1,110 @@ +import { afterEach, beforeEach, describe, expect, test } from "bun:test"; +import { getRebalancingCostPolicyConfig, parseRebalancingDailyBridgeLimitUsd, parseRebalancingPolicyMode } from "./config.ts"; + +const policyEnvVars = [ + "REBALANCING_POLICY_MODE", + "REBALANCING_MODERATE_DEVIATION_BPS", + "REBALANCING_SEVERE_DEVIATION_BPS", + "REBALANCING_MAX_COST_BPS_MILD", + "REBALANCING_MAX_COST_BPS_MODERATE", + "REBALANCING_MAX_COST_BPS_SEVERE", + "REBALANCING_HARD_MAX_COST_BPS" +]; + +const originalPolicyEnv = new Map(policyEnvVars.map(name => [name, process.env[name]])); + +function restorePolicyEnv() { + for (const name of policyEnvVars) { + const originalValue = originalPolicyEnv.get(name); + if (originalValue === undefined) { + delete process.env[name]; + } else { + process.env[name] = originalValue; + } + } +} + +beforeEach(() => { + for (const name of policyEnvVars) { + delete process.env[name]; + } +}); + +afterEach(restorePolicyEnv); + +describe("parseRebalancingDailyBridgeLimitUsd", () => { + test("uses the default when the env value is missing", () => { + expect(parseRebalancingDailyBridgeLimitUsd(undefined)).toBe(10_000); + }); + + test("preserves zero as an explicit limit", () => { + expect(parseRebalancingDailyBridgeLimitUsd("0")).toBe(0); + }); + + test("accepts common thousands separators", () => { + expect(parseRebalancingDailyBridgeLimitUsd("100_000")).toBe(100_000); + expect(parseRebalancingDailyBridgeLimitUsd("100,000")).toBe(100_000); + }); + + test("rejects invalid numeric values", () => { + expect(() => parseRebalancingDailyBridgeLimitUsd("not-a-number")).toThrow( + "REBALANCING_DAILY_BRIDGE_LIMIT_USD must be a non-negative number." + ); + }); +}); + +describe("parseRebalancingPolicyMode", () => { + test("defaults to auto", () => { + expect(parseRebalancingPolicyMode(undefined)).toBe("auto"); + }); + + test("accepts supported modes", () => { + expect(parseRebalancingPolicyMode("always")).toBe("always"); + expect(parseRebalancingPolicyMode("dry-run")).toBe("dry-run"); + expect(parseRebalancingPolicyMode("off")).toBe("off"); + }); + + test("rejects unsupported modes", () => { + expect(() => parseRebalancingPolicyMode("sometimes")).toThrow("REBALANCING_POLICY_MODE must be one of"); + }); +}); + +describe("getRebalancingCostPolicyConfig", () => { + test("uses conservative defaults", () => { + const config = getRebalancingCostPolicyConfig(); + + expect(config).toEqual({ + hardMaxCostBps: 1_000, + maxCostBpsMild: 25, + maxCostBpsModerate: 75, + maxCostBpsSevere: 250, + mode: "auto", + moderateDeviationBps: 200, + severeDeviationBps: 500 + }); + }); + + test("rejects non-monotonic deviation thresholds", () => { + process.env.REBALANCING_MODERATE_DEVIATION_BPS = "600"; + process.env.REBALANCING_SEVERE_DEVIATION_BPS = "500"; + + expect(() => getRebalancingCostPolicyConfig()).toThrow( + "REBALANCING_MODERATE_DEVIATION_BPS must be less than or equal to REBALANCING_SEVERE_DEVIATION_BPS." + ); + + delete process.env.REBALANCING_MODERATE_DEVIATION_BPS; + delete process.env.REBALANCING_SEVERE_DEVIATION_BPS; + }); + + test("rejects non-monotonic cost thresholds", () => { + process.env.REBALANCING_MAX_COST_BPS_MILD = "100"; + process.env.REBALANCING_MAX_COST_BPS_MODERATE = "75"; + + expect(() => getRebalancingCostPolicyConfig()).toThrow( + "Rebalancing max cost bps values must be ordered: mild <= moderate <= severe." + ); + + delete process.env.REBALANCING_MAX_COST_BPS_MILD; + delete process.env.REBALANCING_MAX_COST_BPS_MODERATE; + }); +}); diff --git a/apps/rebalancer/src/utils/config.ts b/apps/rebalancer/src/utils/config.ts index 27b18c469..77d4bc5aa 100644 --- a/apps/rebalancer/src/utils/config.ts +++ b/apps/rebalancer/src/utils/config.ts @@ -1,11 +1,80 @@ import { Keyring } from "@polkadot/api"; import { BRLA_BASE_URL, EvmClientManager, Networks } from "@vortexfi/shared"; import { mnemonicToAccount } from "viem/accounts"; +import type { RebalancingCostPolicyConfig, RebalancingPolicyMode } from "../rebalance/usdc-brla-usdc-base/guards.ts"; + +const DEFAULT_REBALANCING_DAILY_BRIDGE_LIMIT_USD = 10_000; +const REBALANCING_POLICY_MODES: RebalancingPolicyMode[] = ["auto", "always", "dry-run", "off"]; + +function parseNonNegativeNumber(name: string, value: string | undefined, defaultValue: number): number { + const trimmedValue = value?.trim(); + if (!trimmedValue) return defaultValue; + + const parsedValue = Number(trimmedValue.replaceAll("_", "").replaceAll(",", "")); + if (!Number.isFinite(parsedValue) || parsedValue < 0) { + throw new Error(`${name} must be a non-negative number.`); + } + + return parsedValue; +} + +export function parseRebalancingDailyBridgeLimitUsd(value = process.env.REBALANCING_DAILY_BRIDGE_LIMIT_USD) { + return parseNonNegativeNumber("REBALANCING_DAILY_BRIDGE_LIMIT_USD", value, DEFAULT_REBALANCING_DAILY_BRIDGE_LIMIT_USD); +} + +export function parseRebalancingPolicyMode(value = process.env.REBALANCING_POLICY_MODE): RebalancingPolicyMode { + const mode = value?.trim() || "auto"; + if (!REBALANCING_POLICY_MODES.includes(mode as RebalancingPolicyMode)) { + throw new Error(`REBALANCING_POLICY_MODE must be one of: ${REBALANCING_POLICY_MODES.join(", ")}.`); + } + + return mode as RebalancingPolicyMode; +} + +export function getRebalancingCostPolicyConfig(): RebalancingCostPolicyConfig { + const config: RebalancingCostPolicyConfig = { + hardMaxCostBps: parseNonNegativeNumber("REBALANCING_HARD_MAX_COST_BPS", process.env.REBALANCING_HARD_MAX_COST_BPS, 1_000), + maxCostBpsMild: parseNonNegativeNumber("REBALANCING_MAX_COST_BPS_MILD", process.env.REBALANCING_MAX_COST_BPS_MILD, 25), + maxCostBpsModerate: parseNonNegativeNumber( + "REBALANCING_MAX_COST_BPS_MODERATE", + process.env.REBALANCING_MAX_COST_BPS_MODERATE, + 75 + ), + maxCostBpsSevere: parseNonNegativeNumber( + "REBALANCING_MAX_COST_BPS_SEVERE", + process.env.REBALANCING_MAX_COST_BPS_SEVERE, + 250 + ), + mode: parseRebalancingPolicyMode(), + moderateDeviationBps: parseNonNegativeNumber( + "REBALANCING_MODERATE_DEVIATION_BPS", + process.env.REBALANCING_MODERATE_DEVIATION_BPS, + 200 + ), + severeDeviationBps: parseNonNegativeNumber( + "REBALANCING_SEVERE_DEVIATION_BPS", + process.env.REBALANCING_SEVERE_DEVIATION_BPS, + 500 + ) + }; + + if (config.moderateDeviationBps > config.severeDeviationBps) { + throw new Error("REBALANCING_MODERATE_DEVIATION_BPS must be less than or equal to REBALANCING_SEVERE_DEVIATION_BPS."); + } + + if (config.maxCostBpsMild > config.maxCostBpsModerate || config.maxCostBpsModerate > config.maxCostBpsSevere) { + throw new Error("Rebalancing max cost bps values must be ordered: mild <= moderate <= severe."); + } + + if (config.maxCostBpsSevere > config.hardMaxCostBps) { + throw new Error("REBALANCING_MAX_COST_BPS_SEVERE must be less than or equal to REBALANCING_HARD_MAX_COST_BPS."); + } + + return config; +} export function getConfig() { - if (!process.env.PENDULUM_ACCOUNT_SECRET) throw new Error("Missing PENDULUM_ACCOUNT_SECRET environment variable"); - if (!process.env.MOONBEAM_ACCOUNT_SECRET) throw new Error("Missing MOONBEAM_ACCOUNT_SECRET environment variable"); - if (!process.env.POLYGON_ACCOUNT_SECRET) throw new Error("Missing POLYGON_ACCOUNT_SECRET environment variable"); + if (!process.env.EVM_ACCOUNT_SECRET) throw new Error("Missing EVM_ACCOUNT_SECRET environment variable"); return { alchemyApiKey: process.env.ALCHEMY_API_KEY, @@ -13,16 +82,32 @@ export function getConfig() { brlaBusinessAccountAddress: process.env.BRLA_BUSINESS_ACCOUNT_ADDRESS || "0xDF5Fb34B90e5FDF612372dA0c774A516bF5F08b2", + evmAccountSecret: process.env.EVM_ACCOUNT_SECRET, + indexerFreshnessThresholdMinutes: process.env.INDEXER_FRESHNESS_THRESHOLD_MINUTES ? Number(process.env.INDEXER_FRESHNESS_THRESHOLD_MINUTES) : 5, - moonbeamAccountSecret: process.env.MOONBEAM_ACCOUNT_SECRET, + // Main Nabla instance on Base + mainNablaQuoter: process.env.MAIN_NABLA_QUOTER as `0x${string}` | undefined, + mainNablaRouter: process.env.MAIN_NABLA_ROUTER as `0x${string}` | undefined, + pendulumAccountSecret: process.env.PENDULUM_ACCOUNT_SECRET, - polygonAccountSecret: process.env.POLYGON_ACCOUNT_SECRET, + /// The amount in BRLA to swap to USDC during each execution (BRLA→USDC reverse flow on Base). + /// NOTE: The rebalancer now starts with USDC; this amount is now interpreted as a USD amount. + rebalancingBrlToUsdAmount: process.env.REBALANCING_BRL_TO_USD_AMOUNT || "1", + /// The minimum balance in USDC that the rebalancer account on Base must have to allow the BRLA pool rebalancing. + rebalancingBrlToUsdMinBalance: process.env.REBALANCING_BRL_TO_USD_MIN_BALANCE || undefined, + rebalancingCostPolicy: getRebalancingCostPolicyConfig(), + rebalancingDailyBridgeLimitUsd: parseRebalancingDailyBridgeLimitUsd(), /// The threshold above and below the optimal coverage ratio at which the rebalancing will be triggered. - rebalancingThreshold: Number(process.env.REBALANCING_THRESHOLD) || 0.25, + rebalancingThreshold: Number(process.env.REBALANCING_THRESHOLD) || 0.01, + /// Route-specific thresholds (fall back to rebalancingThreshold if unset). + rebalancingThresholdBrlaToUsdc: + Number(process.env.REBALANCING_THRESHOLD_BRLA_TO_USDC) || Number(process.env.REBALANCING_THRESHOLD) || 0.01, + rebalancingThresholdUsdcToBrla: + Number(process.env.REBALANCING_THRESHOLD_USDC_TO_BRLA) || Number(process.env.REBALANCING_THRESHOLD) || 0.01, /// The amount in USD to rebalance from the USD pool to the BRL pool on Pendulum during each execution. rebalancingUsdToBrlAmount: process.env.REBALANCING_USD_TO_BRL_AMOUNT || "1", /// The minimum balance in USD that the rebalancer account on Pendulum must have to allow rebalancing to occur. @@ -34,6 +119,7 @@ export function getConfig() { export function getPendulumAccount() { const config = getConfig(); + if (!config.pendulumAccountSecret) throw new Error("Missing PENDULUM_ACCOUNT_SECRET environment variable"); const keyring = new Keyring({ type: "sr25519" }); return keyring.addFromUri(config.pendulumAccountSecret); @@ -42,21 +128,32 @@ export function getPendulumAccount() { export function getMoonbeamEvmClients() { const config = getConfig(); - const moonbeamExecutorAccount = mnemonicToAccount(config.moonbeamAccountSecret as `0x${string}`); + const evmExecutorAccount = mnemonicToAccount(config.evmAccountSecret); const evmClientManager = EvmClientManager.getInstance(); return { publicClient: evmClientManager.getClient(Networks.Moonbeam), - walletClient: evmClientManager.getWalletClient(Networks.Moonbeam, moonbeamExecutorAccount) + walletClient: evmClientManager.getWalletClient(Networks.Moonbeam, evmExecutorAccount) }; } export function getPolygonEvmClients() { const config = getConfig(); - const polygonExecutorAccount = mnemonicToAccount(config.polygonAccountSecret as `0x${string}`); + const evmExecutorAccount = mnemonicToAccount(config.evmAccountSecret); const evmClientManager = EvmClientManager.getInstance(); return { publicClient: evmClientManager.getClient(Networks.Polygon), - walletClient: evmClientManager.getWalletClient(Networks.Polygon, polygonExecutorAccount) + walletClient: evmClientManager.getWalletClient(Networks.Polygon, evmExecutorAccount) + }; +} + +export function getBaseEvmClients() { + const config = getConfig(); + + const evmExecutorAccount = mnemonicToAccount(config.evmAccountSecret); + const evmClientManager = EvmClientManager.getInstance(); + return { + publicClient: evmClientManager.getClient(Networks.Base), + walletClient: evmClientManager.getWalletClient(Networks.Base, evmExecutorAccount) }; } diff --git a/apps/rebalancer/src/utils/nonce.ts b/apps/rebalancer/src/utils/nonce.ts new file mode 100644 index 000000000..7dd19041f --- /dev/null +++ b/apps/rebalancer/src/utils/nonce.ts @@ -0,0 +1,18 @@ +import type { PublicClient } from "viem"; + +export class NonceManager { + private nonce: number; + + constructor(startingNonce: number) { + this.nonce = startingNonce; + } + + static async create(client: PublicClient, address: `0x${string}`): Promise { + const nonce = await client.getTransactionCount({ address }); + return new NonceManager(nonce); + } + + next(): number { + return this.nonce++; + } +} diff --git a/bun.lock b/bun.lock index 5117a5b2e..6eaa48629 100644 --- a/bun.lock +++ b/bun.lock @@ -7,7 +7,6 @@ "big.js": "^7.0.1", "husky": "^9.1.7", "lint-staged": "^16.1.0", - "numora-react": "^3.0.3", }, "devDependencies": { "@biomejs/biome": "2.0.0", @@ -29,7 +28,7 @@ "@polkadot/keyring": "catalog:", "@polkadot/util": "catalog:", "@polkadot/util-crypto": "catalog:", - "@scure/bip39": "^1.5.4", + "@scure/bip39": "catalog:", "@supabase/supabase-js": "catalog:", "@types/multer": "^2.1.0", "@vortexfi/shared": "workspace:*", @@ -106,7 +105,6 @@ "@fontsource/roboto": "^5.0.8", "@heroicons/react": "^2.1.3", "@hookform/resolvers": "^4.1.3", - "@monerium/sdk": "^3.4.2", "@pendulum-chain/api": "catalog:", "@pendulum-chain/api-solang": "catalog:", "@polkadot/api": "catalog:", @@ -158,8 +156,8 @@ "lottie-react": "^2.4.1", "lucide-react": "^0.562.0", "motion": "^12.0.3", - "numora": "^3.0.2", - "numora-react": "3.0.3", + "numora": "^4.0.0", + "numora-react": "^4.0.0", "qrcode.react": "^4.2.0", "radix-ui": "^1.4.3", "react": "=19.2.0", @@ -170,6 +168,7 @@ "stellar-sdk": "catalog:", "tailwind-merge": "^3.4.0", "tailwindcss": "^4.0.3", + "torph": "^0.0.9", "viem": "catalog:", "wagmi": "catalog:", "web3": "^4.16.0", @@ -332,6 +331,7 @@ "@polkadot/types-known": "^16.4.6", "@polkadot/util": "^13.5.6", "@polkadot/util-crypto": "^13.5.6", + "@wagmi/connectors": "6.2.0", "adm-zip": "0.5.2", "axios": "^1.15.0", "big.js": "^7.0.1", @@ -366,7 +366,7 @@ "@polkadot/types-known": "^16.4.6", "@polkadot/util": "^13.5.6", "@polkadot/util-crypto": "^13.5.6", - "@scure/bip39": "2.0.1", + "@scure/bip39": "^2.2.0", "@storybook/react": "^9.1.16", "@supabase/supabase-js": "^2.80.0", "@types/big.js": "^6.0.2", @@ -390,11 +390,13 @@ "winston": "3.18.3", }, "packages": { - "@adobe/css-tools": ["@adobe/css-tools@4.4.4", "", {}, "sha512-Elp+iwUx5rN5+Y8xLt5/GRoG20WGoDCQ/1Fb+1LiGtvwbDavuSk0jhD/eZdckHAuzcDzccnkv+rEjyWfRx18gg=="], + "@adobe/css-tools": ["@adobe/css-tools@4.5.0", "", {}, "sha512-6OzddxPio9UiWTCemp4N8cYLV2ZN1ncRnV1cVGtve7dhPOtRkleRyx32GQCYSwDYgaHU3USMm84tNsvKzRCa1Q=="], "@adraffy/ens-normalize": ["@adraffy/ens-normalize@1.10.1", "", {}, "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw=="], - "@ardatan/relay-compiler": ["@ardatan/relay-compiler@13.0.0", "", { "dependencies": { "@babel/runtime": "^7.26.10", "immutable": "^5.1.5", "invariant": "^2.2.4" }, "peerDependencies": { "graphql": "*" } }, "sha512-ite4+xng5McO8MflWCi0un0YmnorTujsDnfPfhzYzAgoJ+jkI1pZj6jtmTl8Jptyi1H+Pa0zlatJIsxDD++ETA=="], + "@ardatan/relay-compiler": ["@ardatan/relay-compiler@13.0.1", "", { "dependencies": { "@babel/runtime": "^7.29.2", "immutable": "^5.1.5", "invariant": "^2.2.4" }, "peerDependencies": { "graphql": "*" } }, "sha512-afG3YPwuSA0E5foouZusz5GlXKs74dObv4cuWyLyfKsYFj2r7oGRNB28v18HvwuLSQtQFCi+DpIe0TZkgQDYyg=="], + + "@aws-crypto/crc32": ["@aws-crypto/crc32@5.2.0", "", { "dependencies": { "@aws-crypto/util": "^5.2.0", "@aws-sdk/types": "^3.222.0", "tslib": "^2.6.2" } }, "sha512-nLbCWqQNgUiwwtFsen1AdzAtvuLRsQS8rYgMuxCrdKf9kOssamGLuPwyTY9wyYblNr9+1XM8v6zoDTPPSIeANg=="], "@aws-crypto/sha256-browser": ["@aws-crypto/sha256-browser@5.2.0", "", { "dependencies": { "@aws-crypto/sha256-js": "^5.2.0", "@aws-crypto/supports-web-crypto": "^5.2.0", "@aws-crypto/util": "^5.2.0", "@aws-sdk/types": "^3.222.0", "@aws-sdk/util-locate-window": "^3.0.0", "@smithy/util-utf8": "^2.0.0", "tslib": "^2.6.2" } }, "sha512-AXfN/lGotSQwu6HNcEsIASo7kWXZ5HYWvfOmSNKDsEqC4OashTp8alTmaz+F7TC2L083SFv5RdB+qU3Vs1kZqw=="], @@ -404,251 +406,239 @@ "@aws-crypto/util": ["@aws-crypto/util@5.2.0", "", { "dependencies": { "@aws-sdk/types": "^3.222.0", "@smithy/util-utf8": "^2.0.0", "tslib": "^2.6.2" } }, "sha512-4RkU9EsI6ZpBve5fseQlGNUWKMa1RLPQ1dnjnQoe07ldfIzcsGb5hC5W0Dm7u423KWzawlrpbjXBrXCEv9zazQ=="], - "@aws-sdk/client-cognito-identity": ["@aws-sdk/client-cognito-identity@3.1016.0", "", { "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "^3.973.24", "@aws-sdk/credential-provider-node": "^3.972.25", "@aws-sdk/middleware-host-header": "^3.972.8", "@aws-sdk/middleware-logger": "^3.972.8", "@aws-sdk/middleware-recursion-detection": "^3.972.8", "@aws-sdk/middleware-user-agent": "^3.972.25", "@aws-sdk/region-config-resolver": "^3.972.9", "@aws-sdk/types": "^3.973.6", "@aws-sdk/util-endpoints": "^3.996.5", "@aws-sdk/util-user-agent-browser": "^3.972.8", "@aws-sdk/util-user-agent-node": "^3.973.11", "@smithy/config-resolver": "^4.4.13", "@smithy/core": "^3.23.12", "@smithy/fetch-http-handler": "^5.3.15", "@smithy/hash-node": "^4.2.12", "@smithy/invalid-dependency": "^4.2.12", "@smithy/middleware-content-length": "^4.2.12", "@smithy/middleware-endpoint": "^4.4.27", "@smithy/middleware-retry": "^4.4.44", "@smithy/middleware-serde": "^4.2.15", "@smithy/middleware-stack": "^4.2.12", "@smithy/node-config-provider": "^4.3.12", "@smithy/node-http-handler": "^4.5.0", "@smithy/protocol-http": "^5.3.12", "@smithy/smithy-client": "^4.12.7", "@smithy/types": "^4.13.1", "@smithy/url-parser": "^4.2.12", "@smithy/util-base64": "^4.3.2", "@smithy/util-body-length-browser": "^4.2.2", "@smithy/util-body-length-node": "^4.2.3", "@smithy/util-defaults-mode-browser": "^4.3.43", "@smithy/util-defaults-mode-node": "^4.2.47", "@smithy/util-endpoints": "^3.3.3", "@smithy/util-middleware": "^4.2.12", "@smithy/util-retry": "^4.2.12", "@smithy/util-utf8": "^4.2.2", "tslib": "^2.6.2" } }, "sha512-o3FxswkAKze0XzCcSsCVgdnLYAlilX6L8770cLWjNYsRxKn7TjydpHF0RKN5DkILZ87A/faMv+Z2FAKJVW0VCA=="], - - "@aws-sdk/core": ["@aws-sdk/core@3.973.24", "", { "dependencies": { "@aws-sdk/types": "^3.973.6", "@aws-sdk/xml-builder": "^3.972.15", "@smithy/core": "^3.23.12", "@smithy/node-config-provider": "^4.3.12", "@smithy/property-provider": "^4.2.12", "@smithy/protocol-http": "^5.3.12", "@smithy/signature-v4": "^5.3.12", "@smithy/smithy-client": "^4.12.7", "@smithy/types": "^4.13.1", "@smithy/util-base64": "^4.3.2", "@smithy/util-middleware": "^4.2.12", "@smithy/util-utf8": "^4.2.2", "tslib": "^2.6.2" } }, "sha512-vvf82RYQu2GidWAuQq+uIzaPz9V0gSCXVqdVzRosgl5rXcspXOpSD3wFreGGW6AYymPr97Z69kjVnLePBxloDw=="], - - "@aws-sdk/credential-provider-cognito-identity": ["@aws-sdk/credential-provider-cognito-identity@3.972.17", "", { "dependencies": { "@aws-sdk/nested-clients": "^3.996.14", "@aws-sdk/types": "^3.973.6", "@smithy/property-provider": "^4.2.12", "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-rMiW9GkLFBeRNvYdTzIRNP2Gq8vE8lomuqkv0BM7taX80UrN5oAa1wA8dDSWidga15k+0eFLo4RDsBHmeR1TUA=="], - - "@aws-sdk/credential-provider-env": ["@aws-sdk/credential-provider-env@3.972.22", "", { "dependencies": { "@aws-sdk/core": "^3.973.24", "@aws-sdk/types": "^3.973.6", "@smithy/property-provider": "^4.2.12", "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-cXp0VTDWT76p3hyK5D51yIKEfpf6/zsUvMfaB8CkyqadJxMQ8SbEeVroregmDlZbtG31wkj9ei0WnftmieggLg=="], + "@aws-sdk/client-cognito-identity": ["@aws-sdk/client-cognito-identity@3.1055.0", "", { "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "^3.974.14", "@aws-sdk/credential-provider-node": "^3.972.45", "@aws-sdk/types": "^3.973.9", "@smithy/core": "^3.24.3", "@smithy/fetch-http-handler": "^5.4.3", "@smithy/node-http-handler": "^4.7.3", "@smithy/types": "^4.14.2", "tslib": "^2.6.2" } }, "sha512-xYmNlcyqiBjUo5gcoKt73weZkHHAxcDYcHLAEJkPxJQFxr0lBSAefQLQv7wCKRCKQe9rxuMRnve7U7XSoVWCcg=="], - "@aws-sdk/credential-provider-http": ["@aws-sdk/credential-provider-http@3.972.24", "", { "dependencies": { "@aws-sdk/core": "^3.973.24", "@aws-sdk/types": "^3.973.6", "@smithy/fetch-http-handler": "^5.3.15", "@smithy/node-http-handler": "^4.5.0", "@smithy/property-provider": "^4.2.12", "@smithy/protocol-http": "^5.3.12", "@smithy/smithy-client": "^4.12.7", "@smithy/types": "^4.13.1", "@smithy/util-stream": "^4.5.20", "tslib": "^2.6.2" } }, "sha512-h694K7+tRuepSRJr09wTvQfaEnjzsKZ5s7fbESrVds02GT/QzViJ94/HCNwM7bUfFxqpPXHxulZfL6Cou0dwPg=="], + "@aws-sdk/core": ["@aws-sdk/core@3.974.14", "", { "dependencies": { "@aws-sdk/types": "^3.973.9", "@aws-sdk/xml-builder": "^3.972.26", "@aws/lambda-invoke-store": "^0.2.2", "@smithy/core": "^3.24.3", "@smithy/signature-v4": "^5.4.2", "@smithy/types": "^4.14.2", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-ppamm04uoj3hhNO5IlQSs5D6rWX1fWkzcn6a4pZrojk8Y6ObY9wzLDdT/Eq3gv6O9hOebi9tYTNB8b8fQj9XJw=="], - "@aws-sdk/credential-provider-ini": ["@aws-sdk/credential-provider-ini@3.972.24", "", { "dependencies": { "@aws-sdk/core": "^3.973.24", "@aws-sdk/credential-provider-env": "^3.972.22", "@aws-sdk/credential-provider-http": "^3.972.24", "@aws-sdk/credential-provider-login": "^3.972.24", "@aws-sdk/credential-provider-process": "^3.972.22", "@aws-sdk/credential-provider-sso": "^3.972.24", "@aws-sdk/credential-provider-web-identity": "^3.972.24", "@aws-sdk/nested-clients": "^3.996.14", "@aws-sdk/types": "^3.973.6", "@smithy/credential-provider-imds": "^4.2.12", "@smithy/property-provider": "^4.2.12", "@smithy/shared-ini-file-loader": "^4.4.7", "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-O46fFmv0RDFWiWEA9/e6oW92BnsyAXuEgTTasxHligjn2RCr9L/DK773m/NoFaL3ZdNAUz8WxgxunleMnHAkeQ=="], + "@aws-sdk/credential-provider-cognito-identity": ["@aws-sdk/credential-provider-cognito-identity@3.972.37", "", { "dependencies": { "@aws-sdk/nested-clients": "^3.997.12", "@aws-sdk/types": "^3.973.9", "@smithy/core": "^3.24.3", "@smithy/types": "^4.14.2", "tslib": "^2.6.2" } }, "sha512-f8ZRPoATqSVS1LW19KwiWn2/BSTdylXPznAjDI2r7d3+RT880/yRT9uBQhPE+Ba986LiMRvg1AhmFYDwNLk/0A=="], - "@aws-sdk/credential-provider-login": ["@aws-sdk/credential-provider-login@3.972.24", "", { "dependencies": { "@aws-sdk/core": "^3.973.24", "@aws-sdk/nested-clients": "^3.996.14", "@aws-sdk/types": "^3.973.6", "@smithy/property-provider": "^4.2.12", "@smithy/protocol-http": "^5.3.12", "@smithy/shared-ini-file-loader": "^4.4.7", "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-sIk8oa6AzDoUhxsR11svZESqvzGuXesw62Rl2oW6wguZx8i9cdGCvkFg+h5K7iucUZP8wyWibUbJMc+J66cu5g=="], + "@aws-sdk/credential-provider-env": ["@aws-sdk/credential-provider-env@3.972.40", "", { "dependencies": { "@aws-sdk/core": "^3.974.14", "@aws-sdk/types": "^3.973.9", "@smithy/core": "^3.24.3", "@smithy/types": "^4.14.2", "tslib": "^2.6.2" } }, "sha512-jjT0p0Y7KZtcvExYiPCLJnqM9lkXDV1KBEg/13OE2DXv/9batzlyJHVKUEnRNJccY0O2Sul17E1su38CgdBhGQ=="], - "@aws-sdk/credential-provider-node": ["@aws-sdk/credential-provider-node@3.972.25", "", { "dependencies": { "@aws-sdk/credential-provider-env": "^3.972.22", "@aws-sdk/credential-provider-http": "^3.972.24", "@aws-sdk/credential-provider-ini": "^3.972.24", "@aws-sdk/credential-provider-process": "^3.972.22", "@aws-sdk/credential-provider-sso": "^3.972.24", "@aws-sdk/credential-provider-web-identity": "^3.972.24", "@aws-sdk/types": "^3.973.6", "@smithy/credential-provider-imds": "^4.2.12", "@smithy/property-provider": "^4.2.12", "@smithy/shared-ini-file-loader": "^4.4.7", "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-m7dR0Dsva2P+VUpL+VkC0WwiDby5pgmWXkRVDB5rlwv0jXJrQJf7YMtCoM8Wjk0H9jPeCYOxOXXcIgp/qp5Alg=="], + "@aws-sdk/credential-provider-http": ["@aws-sdk/credential-provider-http@3.972.42", "", { "dependencies": { "@aws-sdk/core": "^3.974.14", "@aws-sdk/types": "^3.973.9", "@smithy/core": "^3.24.3", "@smithy/fetch-http-handler": "^5.4.3", "@smithy/node-http-handler": "^4.7.3", "@smithy/types": "^4.14.2", "tslib": "^2.6.2" } }, "sha512-+3fsKtWybe5BjKEUA3/07oh7Ayfd82IED2+gyyaVfS/4PU78E3TaOQxSGOJ1t7Imefoidw/ne9QA7apX8wEnJg=="], - "@aws-sdk/credential-provider-process": ["@aws-sdk/credential-provider-process@3.972.22", "", { "dependencies": { "@aws-sdk/core": "^3.973.24", "@aws-sdk/types": "^3.973.6", "@smithy/property-provider": "^4.2.12", "@smithy/shared-ini-file-loader": "^4.4.7", "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-Os32s8/4gTZjBk5BtoS/cuTILaj+K72d0dVG7TCJX/fC4598cxwLDmf1AEHEpER5oL3K//yETjvFaz0V8oO5Xw=="], + "@aws-sdk/credential-provider-ini": ["@aws-sdk/credential-provider-ini@3.972.44", "", { "dependencies": { "@aws-sdk/core": "^3.974.14", "@aws-sdk/credential-provider-env": "^3.972.40", "@aws-sdk/credential-provider-http": "^3.972.42", "@aws-sdk/credential-provider-login": "^3.972.44", "@aws-sdk/credential-provider-process": "^3.972.40", "@aws-sdk/credential-provider-sso": "^3.972.44", "@aws-sdk/credential-provider-web-identity": "^3.972.44", "@aws-sdk/nested-clients": "^3.997.12", "@aws-sdk/types": "^3.973.9", "@smithy/core": "^3.24.3", "@smithy/credential-provider-imds": "^4.3.2", "@smithy/types": "^4.14.2", "tslib": "^2.6.2" } }, "sha512-gZFw5wBefCIPg9vpT+gV5FdhfNKhYTVDZa1IsZCcn3SRoYUOJ/E05vwIogkJoonqBL0ttBGi5vhthX7xceekRg=="], - "@aws-sdk/credential-provider-sso": ["@aws-sdk/credential-provider-sso@3.972.24", "", { "dependencies": { "@aws-sdk/core": "^3.973.24", "@aws-sdk/nested-clients": "^3.996.14", "@aws-sdk/token-providers": "3.1015.0", "@aws-sdk/types": "^3.973.6", "@smithy/property-provider": "^4.2.12", "@smithy/shared-ini-file-loader": "^4.4.7", "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-PaFv7snEfypU2yXkpvfyWgddEbDLtgVe51wdZlinhc2doubBjUzJZZpgwuF2Jenl1FBydMhNpMjD6SBUM3qdSA=="], + "@aws-sdk/credential-provider-login": ["@aws-sdk/credential-provider-login@3.972.44", "", { "dependencies": { "@aws-sdk/core": "^3.974.14", "@aws-sdk/nested-clients": "^3.997.12", "@aws-sdk/types": "^3.973.9", "@smithy/core": "^3.24.3", "@smithy/types": "^4.14.2", "tslib": "^2.6.2" } }, "sha512-QqEGHfQeZgUDqh7zpqHufrZ8T644ELEWvB+4gUdewLyRw4IRF+6CJqeQuRWqucZdQzoQeMh7fNAD9BWxFAdNig=="], - "@aws-sdk/credential-provider-web-identity": ["@aws-sdk/credential-provider-web-identity@3.972.24", "", { "dependencies": { "@aws-sdk/core": "^3.973.24", "@aws-sdk/nested-clients": "^3.996.14", "@aws-sdk/types": "^3.973.6", "@smithy/property-provider": "^4.2.12", "@smithy/shared-ini-file-loader": "^4.4.7", "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-J6H4R1nvr3uBTqD/EeIPAskrBtET4WFfNhpFySr2xW7bVZOXpQfPjrLSIx65jcNjBmLXzWq8QFLdVoGxiGG/SA=="], + "@aws-sdk/credential-provider-node": ["@aws-sdk/credential-provider-node@3.972.45", "", { "dependencies": { "@aws-sdk/credential-provider-env": "^3.972.40", "@aws-sdk/credential-provider-http": "^3.972.42", "@aws-sdk/credential-provider-ini": "^3.972.44", "@aws-sdk/credential-provider-process": "^3.972.40", "@aws-sdk/credential-provider-sso": "^3.972.44", "@aws-sdk/credential-provider-web-identity": "^3.972.44", "@aws-sdk/types": "^3.973.9", "@smithy/core": "^3.24.3", "@smithy/credential-provider-imds": "^4.3.2", "@smithy/types": "^4.14.2", "tslib": "^2.6.2" } }, "sha512-3YCv52ExXIRz3LAVNysevd+s7akSpg9dl39v9LJ7dOQH+s5rHi3jMZYQyxwMmglxQGMuzYRfQ0o1VSP2UOlIRw=="], - "@aws-sdk/credential-providers": ["@aws-sdk/credential-providers@3.1016.0", "", { "dependencies": { "@aws-sdk/client-cognito-identity": "3.1016.0", "@aws-sdk/core": "^3.973.24", "@aws-sdk/credential-provider-cognito-identity": "^3.972.17", "@aws-sdk/credential-provider-env": "^3.972.22", "@aws-sdk/credential-provider-http": "^3.972.24", "@aws-sdk/credential-provider-ini": "^3.972.24", "@aws-sdk/credential-provider-login": "^3.972.24", "@aws-sdk/credential-provider-node": "^3.972.25", "@aws-sdk/credential-provider-process": "^3.972.22", "@aws-sdk/credential-provider-sso": "^3.972.24", "@aws-sdk/credential-provider-web-identity": "^3.972.24", "@aws-sdk/nested-clients": "^3.996.14", "@aws-sdk/types": "^3.973.6", "@smithy/config-resolver": "^4.4.13", "@smithy/core": "^3.23.12", "@smithy/credential-provider-imds": "^4.2.12", "@smithy/node-config-provider": "^4.3.12", "@smithy/property-provider": "^4.2.12", "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-D2l7HBvI1V3I/pVugAF1AqkIKH4iwiDyG5wmXWezl8AO/3KjjpDTZhI6goMO09Q6BPnyLVC/PM3gLo78V+q8yA=="], + "@aws-sdk/credential-provider-process": ["@aws-sdk/credential-provider-process@3.972.40", "", { "dependencies": { "@aws-sdk/core": "^3.974.14", "@aws-sdk/types": "^3.973.9", "@smithy/core": "^3.24.3", "@smithy/types": "^4.14.2", "tslib": "^2.6.2" } }, "sha512-cXaozlgJCOwmE6D7x4npcPdyk7kiFZdrGjN3D6tXXtItJJMNGPafDfAJn4YQmciMooG/X+b0Y6RTqdVVMx26jg=="], - "@aws-sdk/middleware-host-header": ["@aws-sdk/middleware-host-header@3.972.8", "", { "dependencies": { "@aws-sdk/types": "^3.973.6", "@smithy/protocol-http": "^5.3.12", "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-wAr2REfKsqoKQ+OkNqvOShnBoh+nkPurDKW7uAeVSu6kUECnWlSJiPvnoqxGlfousEY/v9LfS9sNc46hjSYDIQ=="], + "@aws-sdk/credential-provider-sso": ["@aws-sdk/credential-provider-sso@3.972.44", "", { "dependencies": { "@aws-sdk/core": "^3.974.14", "@aws-sdk/nested-clients": "^3.997.12", "@aws-sdk/token-providers": "3.1054.0", "@aws-sdk/types": "^3.973.9", "@smithy/core": "^3.24.3", "@smithy/types": "^4.14.2", "tslib": "^2.6.2" } }, "sha512-YePoj5kQuPmE0MHnyftXCfsO8ZSBd2kDr50XEIUrdejSbGFlayYvUuCohdb8drhGhPm6b65o7H1eC26EZhwUvA=="], - "@aws-sdk/middleware-logger": ["@aws-sdk/middleware-logger@3.972.8", "", { "dependencies": { "@aws-sdk/types": "^3.973.6", "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-CWl5UCM57WUFaFi5kB7IBY1UmOeLvNZAZ2/OZ5l20ldiJ3TiIz1pC65gYj8X0BCPWkeR1E32mpsCk1L1I4n+lA=="], + "@aws-sdk/credential-provider-web-identity": ["@aws-sdk/credential-provider-web-identity@3.972.44", "", { "dependencies": { "@aws-sdk/core": "^3.974.14", "@aws-sdk/nested-clients": "^3.997.12", "@aws-sdk/types": "^3.973.9", "@smithy/core": "^3.24.3", "@smithy/types": "^4.14.2", "tslib": "^2.6.2" } }, "sha512-Ys/JJe++8Z2Y5meR1taMBaVcrGBA0/XsVTQR+qOKZbdNyg+8Jlv5rYZSwh8SqEHY00goSOZy7PHzZ2rLNQxDLg=="], - "@aws-sdk/middleware-recursion-detection": ["@aws-sdk/middleware-recursion-detection@3.972.8", "", { "dependencies": { "@aws-sdk/types": "^3.973.6", "@aws/lambda-invoke-store": "^0.2.2", "@smithy/protocol-http": "^5.3.12", "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-BnnvYs2ZEpdlmZ2PNlV2ZyQ8j8AEkMTjN79y/YA475ER1ByFYrkVR85qmhni8oeTaJcDqbx364wDpitDAA/wCA=="], + "@aws-sdk/credential-providers": ["@aws-sdk/credential-providers@3.1055.0", "", { "dependencies": { "@aws-sdk/client-cognito-identity": "3.1055.0", "@aws-sdk/core": "^3.974.14", "@aws-sdk/credential-provider-cognito-identity": "^3.972.37", "@aws-sdk/credential-provider-env": "^3.972.40", "@aws-sdk/credential-provider-http": "^3.972.42", "@aws-sdk/credential-provider-ini": "^3.972.44", "@aws-sdk/credential-provider-login": "^3.972.44", "@aws-sdk/credential-provider-node": "^3.972.45", "@aws-sdk/credential-provider-process": "^3.972.40", "@aws-sdk/credential-provider-sso": "^3.972.44", "@aws-sdk/credential-provider-web-identity": "^3.972.44", "@aws-sdk/nested-clients": "^3.997.12", "@aws-sdk/types": "^3.973.9", "@smithy/core": "^3.24.3", "@smithy/credential-provider-imds": "^4.3.2", "@smithy/types": "^4.14.2", "tslib": "^2.6.2" } }, "sha512-WWTJnV7eCKNi9PMJuKs2kMybOcJ1gi+xA8XLzbUTr0Dm1RKMnAxmtOpaU8FIve3tZ8LUssBCEscaNxudu3ZlMg=="], - "@aws-sdk/middleware-user-agent": ["@aws-sdk/middleware-user-agent@3.972.25", "", { "dependencies": { "@aws-sdk/core": "^3.973.24", "@aws-sdk/types": "^3.973.6", "@aws-sdk/util-endpoints": "^3.996.5", "@smithy/core": "^3.23.12", "@smithy/protocol-http": "^5.3.12", "@smithy/types": "^4.13.1", "@smithy/util-retry": "^4.2.12", "tslib": "^2.6.2" } }, "sha512-QxiMPofvOt8SwSynTOmuZfvvPM1S9QfkESBxB22NMHTRXCJhR5BygLl8IXfC4jELiisQgwsgUby21GtXfX3f/g=="], + "@aws-sdk/nested-clients": ["@aws-sdk/nested-clients@3.997.12", "", { "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "^3.974.14", "@aws-sdk/signature-v4-multi-region": "^3.996.29", "@aws-sdk/types": "^3.973.9", "@smithy/core": "^3.24.3", "@smithy/fetch-http-handler": "^5.4.3", "@smithy/node-http-handler": "^4.7.3", "@smithy/types": "^4.14.2", "tslib": "^2.6.2" } }, "sha512-Js2VYaCM269feB0cs0cGmlIhdOgT9aMqzdBx68lCy6kVCYfzr0T36ovUFDvfUmatkuBeyBJhCwaLBh7P8meH5Q=="], - "@aws-sdk/nested-clients": ["@aws-sdk/nested-clients@3.996.14", "", { "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "^3.973.24", "@aws-sdk/middleware-host-header": "^3.972.8", "@aws-sdk/middleware-logger": "^3.972.8", "@aws-sdk/middleware-recursion-detection": "^3.972.8", "@aws-sdk/middleware-user-agent": "^3.972.25", "@aws-sdk/region-config-resolver": "^3.972.9", "@aws-sdk/types": "^3.973.6", "@aws-sdk/util-endpoints": "^3.996.5", "@aws-sdk/util-user-agent-browser": "^3.972.8", "@aws-sdk/util-user-agent-node": "^3.973.11", "@smithy/config-resolver": "^4.4.13", "@smithy/core": "^3.23.12", "@smithy/fetch-http-handler": "^5.3.15", "@smithy/hash-node": "^4.2.12", "@smithy/invalid-dependency": "^4.2.12", "@smithy/middleware-content-length": "^4.2.12", "@smithy/middleware-endpoint": "^4.4.27", "@smithy/middleware-retry": "^4.4.44", "@smithy/middleware-serde": "^4.2.15", "@smithy/middleware-stack": "^4.2.12", "@smithy/node-config-provider": "^4.3.12", "@smithy/node-http-handler": "^4.5.0", "@smithy/protocol-http": "^5.3.12", "@smithy/smithy-client": "^4.12.7", "@smithy/types": "^4.13.1", "@smithy/url-parser": "^4.2.12", "@smithy/util-base64": "^4.3.2", "@smithy/util-body-length-browser": "^4.2.2", "@smithy/util-body-length-node": "^4.2.3", "@smithy/util-defaults-mode-browser": "^4.3.43", "@smithy/util-defaults-mode-node": "^4.2.47", "@smithy/util-endpoints": "^3.3.3", "@smithy/util-middleware": "^4.2.12", "@smithy/util-retry": "^4.2.12", "@smithy/util-utf8": "^4.2.2", "tslib": "^2.6.2" } }, "sha512-fSESKvh1VbfjtV3QMnRkCPZWkUbQof6T/DOpiLp33yP2wA+rbwwnZeG3XT3Ekljgw2I8X4XaQPnw+zSR8yxJ5Q=="], + "@aws-sdk/signature-v4-multi-region": ["@aws-sdk/signature-v4-multi-region@3.996.29", "", { "dependencies": { "@aws-sdk/types": "^3.973.9", "@smithy/signature-v4": "^5.4.2", "@smithy/types": "^4.14.2", "tslib": "^2.6.2" } }, "sha512-Few9FoQqOt/0KSvZYP+qdW0dfOhfQ9N+gl2UUDvCPW6mkPKHli9LMbKxWj+wZ5zKPaOoqxuR3Hhy3OTpndkfSw=="], - "@aws-sdk/region-config-resolver": ["@aws-sdk/region-config-resolver@3.972.9", "", { "dependencies": { "@aws-sdk/types": "^3.973.6", "@smithy/config-resolver": "^4.4.13", "@smithy/node-config-provider": "^4.3.12", "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-eQ+dFU05ZRC/lC2XpYlYSPlXtX3VT8sn5toxN2Fv7EXlMoA2p9V7vUBKqHunfD4TRLpxUq8Y8Ol/nCqiv327Ng=="], + "@aws-sdk/token-providers": ["@aws-sdk/token-providers@3.1054.0", "", { "dependencies": { "@aws-sdk/core": "^3.974.14", "@aws-sdk/nested-clients": "^3.997.12", "@aws-sdk/types": "^3.973.9", "@smithy/core": "^3.24.3", "@smithy/types": "^4.14.2", "tslib": "^2.6.2" } }, "sha512-hG9YKApmZOw+drJ9Nuoaf/OvC8e5W1+3eoLeN5p2uVCZRWsv27teIS0b4kiH6Sfv3WMmamqYJxmE2WMwyp/L/A=="], - "@aws-sdk/token-providers": ["@aws-sdk/token-providers@3.1015.0", "", { "dependencies": { "@aws-sdk/core": "^3.973.24", "@aws-sdk/nested-clients": "^3.996.14", "@aws-sdk/types": "^3.973.6", "@smithy/property-provider": "^4.2.12", "@smithy/shared-ini-file-loader": "^4.4.7", "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-3OSD4y110nisRhHzFOjoEeHU4GQL4KpzkX9PxzWaiZe0Yg2+thZKM0Pn9DjYwezH5JYfh/K++xK/SE0IHGrmCQ=="], - - "@aws-sdk/types": ["@aws-sdk/types@3.973.6", "", { "dependencies": { "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-Atfcy4E++beKtwJHiDln2Nby8W/mam64opFPTiHEqgsthqeydFS1pY+OUlN1ouNOmf8ArPU/6cDS65anOP3KQw=="], - - "@aws-sdk/util-endpoints": ["@aws-sdk/util-endpoints@3.996.5", "", { "dependencies": { "@aws-sdk/types": "^3.973.6", "@smithy/types": "^4.13.1", "@smithy/url-parser": "^4.2.12", "@smithy/util-endpoints": "^3.3.3", "tslib": "^2.6.2" } }, "sha512-Uh93L5sXFNbyR5sEPMzUU8tJ++Ku97EY4udmC01nB8Zu+xfBPwpIwJ6F7snqQeq8h2pf+8SGN5/NoytfKgYPIw=="], + "@aws-sdk/types": ["@aws-sdk/types@3.973.9", "", { "dependencies": { "@smithy/types": "^4.14.2", "tslib": "^2.6.2" } }, "sha512-kuBfgQVdcz5Bmapc4A13YbpVw/pXkesfhetcFYwbntqas8sF41OHyd4o28+/TG2ZQdHBsv90Lsu5y6oitvYCdg=="], "@aws-sdk/util-locate-window": ["@aws-sdk/util-locate-window@3.965.5", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-WhlJNNINQB+9qtLtZJcpQdgZw3SCDCpXdUJP7cToGwHbCWCnRckGlc6Bx/OhWwIYFNAn+FIydY8SZ0QmVu3xTQ=="], - "@aws-sdk/util-user-agent-browser": ["@aws-sdk/util-user-agent-browser@3.972.8", "", { "dependencies": { "@aws-sdk/types": "^3.973.6", "@smithy/types": "^4.13.1", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-B3KGXJviV2u6Cdw2SDY2aDhoJkVfY/Q/Trwk2CMSkikE1Oi6gRzxhvhIfiRpHfmIsAhV4EA54TVEX8K6CbHbkA=="], - - "@aws-sdk/util-user-agent-node": ["@aws-sdk/util-user-agent-node@3.973.11", "", { "dependencies": { "@aws-sdk/middleware-user-agent": "^3.972.25", "@aws-sdk/types": "^3.973.6", "@smithy/node-config-provider": "^4.3.12", "@smithy/types": "^4.13.1", "@smithy/util-config-provider": "^4.2.2", "tslib": "^2.6.2" }, "peerDependencies": { "aws-crt": ">=1.0.0" }, "optionalPeers": ["aws-crt"] }, "sha512-1qdXbXo2s5MMLpUvw00284LsbhtlQ4ul7Zzdn5n+7p4WVgCMLqhxImpHIrjSoc72E/fyc4Wq8dLtUld2Gsh+lA=="], - - "@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.15", "", { "dependencies": { "@smithy/types": "^4.13.1", "fast-xml-parser": "5.5.8", "tslib": "^2.6.2" } }, "sha512-PxMRlCFNiQnke9YR29vjFQwz4jq+6Q04rOVFeTDR2K7Qpv9h9FOWOxG+zJjageimYbWqE3bTuLjmryWHAWbvaA=="], + "@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.26", "", { "dependencies": { "@smithy/types": "^4.14.2", "fast-xml-parser": "5.7.3", "tslib": "^2.6.2" } }, "sha512-cDbrqvDS73whl6YAPSPq0U6whzG6UWI9PuWh0wrUuGoZexhWEqhdunbukV7iBoaWnFV1AODutM5hOD6rtn439g=="], "@aws/lambda-invoke-store": ["@aws/lambda-invoke-store@0.2.4", "", {}, "sha512-iY8yvjE0y651BixKNPgmv1WrQc+GZ142sb0z4gYnChDDY2YqI4P/jsSopBWrKfAt7LOJAkOXt7rC/hms+WclQQ=="], - "@babel/code-frame": ["@babel/code-frame@7.29.0", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.28.5", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw=="], + "@babel/code-frame": ["@babel/code-frame@7.29.7", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.29.7", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw=="], - "@babel/compat-data": ["@babel/compat-data@7.29.0", "", {}, "sha512-T1NCJqT/j9+cn8fvkt7jtwbLBfLC/1y1c7NtCeXFRgzGTsafi68MRv8yzkYSapBnFA6L3U2VSc02ciDzoAJhJg=="], + "@babel/compat-data": ["@babel/compat-data@7.29.7", "", {}, "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg=="], - "@babel/core": ["@babel/core@7.29.0", "", { "dependencies": { "@babel/code-frame": "^7.29.0", "@babel/generator": "^7.29.0", "@babel/helper-compilation-targets": "^7.28.6", "@babel/helper-module-transforms": "^7.28.6", "@babel/helpers": "^7.28.6", "@babel/parser": "^7.29.0", "@babel/template": "^7.28.6", "@babel/traverse": "^7.29.0", "@babel/types": "^7.29.0", "@jridgewell/remapping": "^2.3.5", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", "json5": "^2.2.3", "semver": "^6.3.1" } }, "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA=="], + "@babel/core": ["@babel/core@7.29.7", "", { "dependencies": { "@babel/code-frame": "^7.29.7", "@babel/generator": "^7.29.7", "@babel/helper-compilation-targets": "^7.29.7", "@babel/helper-module-transforms": "^7.29.7", "@babel/helpers": "^7.29.7", "@babel/parser": "^7.29.7", "@babel/template": "^7.29.7", "@babel/traverse": "^7.29.7", "@babel/types": "^7.29.7", "@jridgewell/remapping": "^2.3.5", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", "json5": "^2.2.3", "semver": "^6.3.1" } }, "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA=="], - "@babel/generator": ["@babel/generator@7.29.1", "", { "dependencies": { "@babel/parser": "^7.29.0", "@babel/types": "^7.29.0", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" } }, "sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw=="], + "@babel/generator": ["@babel/generator@7.29.7", "", { "dependencies": { "@babel/parser": "^7.29.7", "@babel/types": "^7.29.7", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" } }, "sha512-DkXD5OJQaAQIdZ1bt3UZdEnHAn9Imd3IVBdX03UFe+ony9Ojw5pzr9YVKGDY1jt+Gcn/FnGkNf8r+Vj5NOJWtQ=="], - "@babel/helper-annotate-as-pure": ["@babel/helper-annotate-as-pure@7.27.3", "", { "dependencies": { "@babel/types": "^7.27.3" } }, "sha512-fXSwMQqitTGeHLBC08Eq5yXz2m37E4pJX1qAU1+2cNedz/ifv/bVXft90VeSav5nFO61EcNgwr0aJxbyPaWBPg=="], + "@babel/helper-annotate-as-pure": ["@babel/helper-annotate-as-pure@7.29.7", "", { "dependencies": { "@babel/types": "^7.29.7" } }, "sha512-OoK6239jHPuSQOoS0kfTVKn0b/rVTk0seKq4Gd2UMLtmOVLjDC0ki3e+c90Trqv2gMfvJFqkiljrr568+qddiw=="], - "@babel/helper-compilation-targets": ["@babel/helper-compilation-targets@7.28.6", "", { "dependencies": { "@babel/compat-data": "^7.28.6", "@babel/helper-validator-option": "^7.27.1", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", "semver": "^6.3.1" } }, "sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA=="], + "@babel/helper-compilation-targets": ["@babel/helper-compilation-targets@7.29.7", "", { "dependencies": { "@babel/compat-data": "^7.29.7", "@babel/helper-validator-option": "^7.29.7", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", "semver": "^6.3.1" } }, "sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g=="], - "@babel/helper-create-class-features-plugin": ["@babel/helper-create-class-features-plugin@7.28.6", "", { "dependencies": { "@babel/helper-annotate-as-pure": "^7.27.3", "@babel/helper-member-expression-to-functions": "^7.28.5", "@babel/helper-optimise-call-expression": "^7.27.1", "@babel/helper-replace-supers": "^7.28.6", "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1", "@babel/traverse": "^7.28.6", "semver": "^6.3.1" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-dTOdvsjnG3xNT9Y0AUg1wAl38y+4Rl4sf9caSQZOXdNqVn+H+HbbJ4IyyHaIqNR6SW9oJpA/RuRjsjCw2IdIow=="], + "@babel/helper-create-class-features-plugin": ["@babel/helper-create-class-features-plugin@7.29.7", "", { "dependencies": { "@babel/helper-annotate-as-pure": "^7.29.7", "@babel/helper-member-expression-to-functions": "^7.29.7", "@babel/helper-optimise-call-expression": "^7.29.7", "@babel/helper-replace-supers": "^7.29.7", "@babel/helper-skip-transparent-expression-wrappers": "^7.29.7", "@babel/traverse": "^7.29.7", "semver": "^6.3.1" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-IY3ZD9Tmooqr3TUhc3DUWxiuo8xx1DWLhd5M7hQ+ZWJamqM2BbalrBJb2MisSLoYorOj75U03qULCxQTY9r3hg=="], - "@babel/helper-create-regexp-features-plugin": ["@babel/helper-create-regexp-features-plugin@7.28.5", "", { "dependencies": { "@babel/helper-annotate-as-pure": "^7.27.3", "regexpu-core": "^6.3.1", "semver": "^6.3.1" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-N1EhvLtHzOvj7QQOUCCS3NrPJP8c5W6ZXCHDn7Yialuy1iu4r5EmIYkXlKNqT99Ciw+W0mDqWoR6HWMZlFP3hw=="], + "@babel/helper-create-regexp-features-plugin": ["@babel/helper-create-regexp-features-plugin@7.29.7", "", { "dependencies": { "@babel/helper-annotate-as-pure": "^7.29.7", "regexpu-core": "^6.3.1", "semver": "^6.3.1" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-907Uymvqgg1dwUA+7IGwFAOSYzQOuzPXKNJ1yxzwPffzkYFg2q2eHi1fIOs6sXkG9NbIUMunnUlkYsfRFNvomg=="], "@babel/helper-define-polyfill-provider": ["@babel/helper-define-polyfill-provider@0.6.8", "", { "dependencies": { "@babel/helper-compilation-targets": "^7.28.6", "@babel/helper-plugin-utils": "^7.28.6", "debug": "^4.4.3", "lodash.debounce": "^4.0.8", "resolve": "^1.22.11" }, "peerDependencies": { "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" } }, "sha512-47UwBLPpQi1NoWzLuHNjRoHlYXMwIJoBf7MFou6viC/sIHWYygpvr0B6IAyh5sBdA2nr2LPIRww8lfaUVQINBA=="], - "@babel/helper-globals": ["@babel/helper-globals@7.28.0", "", {}, "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw=="], + "@babel/helper-globals": ["@babel/helper-globals@7.29.7", "", {}, "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA=="], + + "@babel/helper-member-expression-to-functions": ["@babel/helper-member-expression-to-functions@7.29.7", "", { "dependencies": { "@babel/traverse": "^7.29.7", "@babel/types": "^7.29.7" } }, "sha512-j+7JYmk1JYDtACIGj0QJqqWZjoUpMoEikQGADMaHgCMCSDqd2+P32rfcibUNrGOMWrlzK1WJBdxrB3JJQZwWtg=="], - "@babel/helper-member-expression-to-functions": ["@babel/helper-member-expression-to-functions@7.28.5", "", { "dependencies": { "@babel/traverse": "^7.28.5", "@babel/types": "^7.28.5" } }, "sha512-cwM7SBRZcPCLgl8a7cY0soT1SptSzAlMH39vwiRpOQkJlh53r5hdHwLSCZpQdVLT39sZt+CRpNwYG4Y2v77atg=="], + "@babel/helper-module-imports": ["@babel/helper-module-imports@7.29.7", "", { "dependencies": { "@babel/traverse": "^7.29.7", "@babel/types": "^7.29.7" } }, "sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g=="], - "@babel/helper-module-imports": ["@babel/helper-module-imports@7.28.6", "", { "dependencies": { "@babel/traverse": "^7.28.6", "@babel/types": "^7.28.6" } }, "sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw=="], + "@babel/helper-module-transforms": ["@babel/helper-module-transforms@7.29.7", "", { "dependencies": { "@babel/helper-module-imports": "^7.29.7", "@babel/helper-validator-identifier": "^7.29.7", "@babel/traverse": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg=="], - "@babel/helper-module-transforms": ["@babel/helper-module-transforms@7.28.6", "", { "dependencies": { "@babel/helper-module-imports": "^7.28.6", "@babel/helper-validator-identifier": "^7.28.5", "@babel/traverse": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA=="], + "@babel/helper-optimise-call-expression": ["@babel/helper-optimise-call-expression@7.29.7", "", { "dependencies": { "@babel/types": "^7.29.7" } }, "sha512-+kmGVjcT9RGYzoDwdwEqEvGgKe3BYq+O1iGzjFubaNgZHwYHP6lsF2Yghf4kEuv9BV7tYDZ913aBW9am6YKong=="], - "@babel/helper-optimise-call-expression": ["@babel/helper-optimise-call-expression@7.27.1", "", { "dependencies": { "@babel/types": "^7.27.1" } }, "sha512-URMGH08NzYFhubNSGJrpUEphGKQwMQYBySzat5cAByY1/YgIRkULnIy3tAMeszlL/so2HbeilYloUmSpd7GdVw=="], + "@babel/helper-plugin-utils": ["@babel/helper-plugin-utils@7.29.7", "", {}, "sha512-G7sHYigPY17oO5SYWnfD/0MTBwVR781S/JI643e/JhUYgVgWE/61SoW3NH9KWUKyKq5LVh3npif99Wkt6j86Jw=="], - "@babel/helper-plugin-utils": ["@babel/helper-plugin-utils@7.28.6", "", {}, "sha512-S9gzZ/bz83GRysI7gAD4wPT/AI3uCnY+9xn+Mx/KPs2JwHJIz1W8PZkg2cqyt3RNOBM8ejcXhV6y8Og7ly/Dug=="], + "@babel/helper-remap-async-to-generator": ["@babel/helper-remap-async-to-generator@7.29.7", "", { "dependencies": { "@babel/helper-annotate-as-pure": "^7.29.7", "@babel/helper-wrap-function": "^7.29.7", "@babel/traverse": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-16AMiW26DbXWBbr3B8wNozKM0ydMLB892vaOaJW/fPJdnT8vJk5sdkQcU/isqUxyCE0cEoa8wZOcbgDuC4b6Og=="], - "@babel/helper-remap-async-to-generator": ["@babel/helper-remap-async-to-generator@7.27.1", "", { "dependencies": { "@babel/helper-annotate-as-pure": "^7.27.1", "@babel/helper-wrap-function": "^7.27.1", "@babel/traverse": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-7fiA521aVw8lSPeI4ZOD3vRFkoqkJcS+z4hFo82bFSH/2tNd6eJ5qCVMS5OzDmZh/kaHQeBaeyxK6wljcPtveA=="], + "@babel/helper-replace-supers": ["@babel/helper-replace-supers@7.29.7", "", { "dependencies": { "@babel/helper-member-expression-to-functions": "^7.29.7", "@babel/helper-optimise-call-expression": "^7.29.7", "@babel/traverse": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-atfGXWSeCiF4DnKZIfmJfQRkSw9b9gNNXR1kqKjbhG4pGYCOnkp8OcTB8E3NXjBu8NpheSnOeNKz8KT7UNFTmQ=="], - "@babel/helper-replace-supers": ["@babel/helper-replace-supers@7.28.6", "", { "dependencies": { "@babel/helper-member-expression-to-functions": "^7.28.5", "@babel/helper-optimise-call-expression": "^7.27.1", "@babel/traverse": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-mq8e+laIk94/yFec3DxSjCRD2Z0TAjhVbEJY3UQrlwVo15Lmt7C2wAUbK4bjnTs4APkwsYLTahXRraQXhb1WCg=="], + "@babel/helper-skip-transparent-expression-wrappers": ["@babel/helper-skip-transparent-expression-wrappers@7.29.7", "", { "dependencies": { "@babel/traverse": "^7.29.7", "@babel/types": "^7.29.7" } }, "sha512-brcMGQaVzIeUb+6/bs1Av0f8YuNNjKY2JyvfRCsFuFsdKccEQ5Ges2y74D74NZ1Rz8lKJ9ksJkfqwQFJ/iNEyQ=="], - "@babel/helper-skip-transparent-expression-wrappers": ["@babel/helper-skip-transparent-expression-wrappers@7.27.1", "", { "dependencies": { "@babel/traverse": "^7.27.1", "@babel/types": "^7.27.1" } }, "sha512-Tub4ZKEXqbPjXgWLl2+3JpQAYBJ8+ikpQ2Ocj/q/r0LwE3UhENh7EUabyHjz2kCEsrRY83ew2DQdHluuiDQFzg=="], + "@babel/helper-string-parser": ["@babel/helper-string-parser@7.29.7", "", {}, "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw=="], - "@babel/helper-string-parser": ["@babel/helper-string-parser@7.27.1", "", {}, "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA=="], + "@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.29.7", "", {}, "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg=="], - "@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.28.5", "", {}, "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q=="], + "@babel/helper-validator-option": ["@babel/helper-validator-option@7.29.7", "", {}, "sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw=="], - "@babel/helper-validator-option": ["@babel/helper-validator-option@7.27.1", "", {}, "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg=="], + "@babel/helper-wrap-function": ["@babel/helper-wrap-function@7.29.7", "", { "dependencies": { "@babel/template": "^7.29.7", "@babel/traverse": "^7.29.7", "@babel/types": "^7.29.7" } }, "sha512-iES0Skag9ERIF68aXadpO6dbXa03mNWK3sEqJaMnLNs/eC3l0lkImdfoy6Y09/SfkpawdAB4RjQ7PVA7TcVGdw=="], - "@babel/helper-wrap-function": ["@babel/helper-wrap-function@7.28.6", "", { "dependencies": { "@babel/template": "^7.28.6", "@babel/traverse": "^7.28.6", "@babel/types": "^7.28.6" } }, "sha512-z+PwLziMNBeSQJonizz2AGnndLsP2DeGHIxDAn+wdHOGuo4Fo1x1HBPPXeE9TAOPHNNWQKCSlA2VZyYyyibDnQ=="], + "@babel/helpers": ["@babel/helpers@7.29.7", "", { "dependencies": { "@babel/template": "^7.29.7", "@babel/types": "^7.29.7" } }, "sha512-1k2lAGRMfHTcwuNYcCNUmaUffmQv8KWMfh2iJUUeRlwlwH4FdNG7mfPI10NPfLHJFThE4Tyr4mv7kTNZOiPuBg=="], - "@babel/helpers": ["@babel/helpers@7.29.2", "", { "dependencies": { "@babel/template": "^7.28.6", "@babel/types": "^7.29.0" } }, "sha512-HoGuUs4sCZNezVEKdVcwqmZN8GoHirLUcLaYVNBK2J0DadGtdcqgr3BCbvH8+XUo4NGjNl3VOtSjEKNzqfFgKw=="], + "@babel/parser": ["@babel/parser@7.29.7", "", { "dependencies": { "@babel/types": "^7.29.7" }, "bin": "./bin/babel-parser.js" }, "sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg=="], - "@babel/parser": ["@babel/parser@7.29.2", "", { "dependencies": { "@babel/types": "^7.29.0" }, "bin": "./bin/babel-parser.js" }, "sha512-4GgRzy/+fsBa72/RZVJmGKPmZu9Byn8o4MoLpmNe1m8ZfYnz5emHLQz3U4gLud6Zwl0RZIcgiLD7Uq7ySFuDLA=="], + "@babel/plugin-bugfix-firefox-class-in-computed-class-key": ["@babel/plugin-bugfix-firefox-class-in-computed-class-key@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7", "@babel/traverse": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-j8SrR0zLZrRsC09DlszEx8FpMiwukKffYXMK0d5LmOglO7vGG6sz/BR/20yHqWH+Lnn31JTt2PE3hIWNgM2J6w=="], - "@babel/plugin-bugfix-firefox-class-in-computed-class-key": ["@babel/plugin-bugfix-firefox-class-in-computed-class-key@7.28.5", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1", "@babel/traverse": "^7.28.5" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-87GDMS3tsmMSi/3bWOte1UblL+YUTFMV8SZPZ2eSEL17s74Cw/l63rR6NmGVKMYW2GYi85nE+/d6Hw5N0bEk2Q=="], + "@babel/plugin-bugfix-safari-class-field-initializer-scope": ["@babel/plugin-bugfix-safari-class-field-initializer-scope@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-r8j8escF+U2FUHo0KOhPUdMzUO+jp9fInva6+ACVAF3Y97Ev+5iNZwiqTghmzNeWwDkOPlYuTcfb1vDaoZKmAQ=="], - "@babel/plugin-bugfix-safari-class-field-initializer-scope": ["@babel/plugin-bugfix-safari-class-field-initializer-scope@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-qNeq3bCKnGgLkEXUuFry6dPlGfCdQNZbn7yUAPCInwAJHMU7THJfrBSozkcWq5sNM6RcF3S8XyQL2A52KNR9IA=="], + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": ["@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-GE1TFSiuFeGsCxmYXZl8HwoPrVlwe4rHPFE8weieGKZqnDORK+Ar3vgWMgW+AOxQ6/2TgLSKx9p6W7O4rC6qgQ=="], - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": ["@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-g4L7OYun04N1WyqMNjldFwlfPCLVkgB54A/YCXICZYBsvJJE3kByKv9c9+R/nAfmIfjl2rKYLNyMHboYbZaWaA=="], + "@babel/plugin-bugfix-safari-rest-destructuring-rhs-array": ["@babel/plugin-bugfix-safari-rest-destructuring-rhs-array@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7", "@babel/helper-skip-transparent-expression-wrappers": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-oBNVCvnO5tND+xSopWvV8WNGfpTfgP4Zr/YXXSj8zfmcPktp5Ku/aZlsIowgSD4fjmgHn6sGmB9APVsU5zOdhA=="], - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": ["@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1", "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1", "@babel/plugin-transform-optional-chaining": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.13.0" } }, "sha512-oO02gcONcD5O1iTLi/6frMJBIwWEHceWGSGqrpCmEL8nogiS6J9PBlE48CaK20/Jx1LuRml9aDftLgdjXT8+Cw=="], + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": ["@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7", "@babel/helper-skip-transparent-expression-wrappers": "^7.29.7", "@babel/plugin-transform-optional-chaining": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.13.0" } }, "sha512-QQt9qKHZ2sg/kivaLr7lnQr8HVrQDdBNSfCsTjiDxRuX/K5ORyKq+Bu8Xr0cDE3Dfkv0cw28Ve0EKyKMvulkOw=="], - "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": ["@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@7.28.6", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6", "@babel/traverse": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-a0aBScVTlNaiUe35UtfxAN7A/tehvvG4/ByO6+46VPKTRSlfnAFsgKy0FUh+qAkQrDTmhDkT+IBOKlOoMUxQ0g=="], + "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": ["@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7", "@babel/traverse": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-pn6QacGLgvCcwc+syUhKE/qSjV2D1IHDB84RNxWYSt1mW3K/SCtjinZ2p0cETJxAWBjPy3K/1lHwG5BjjPxNlw=="], "@babel/plugin-proposal-class-properties": ["@babel/plugin-proposal-class-properties@7.18.6", "", { "dependencies": { "@babel/helper-create-class-features-plugin": "^7.18.6", "@babel/helper-plugin-utils": "^7.18.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-cumfXOF0+nzZrrN8Rf0t7M+tF6sZc7vhQwYQck9q1/5w2OExlD+b4v4RpMJFaV1Z7WcDRgO6FqvxqxGlwo+RHQ=="], "@babel/plugin-proposal-private-property-in-object": ["@babel/plugin-proposal-private-property-in-object@7.21.0-placeholder-for-preset-env.2", "", { "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w=="], - "@babel/plugin-syntax-import-assertions": ["@babel/plugin-syntax-import-assertions@7.28.6", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-pSJUpFHdx9z5nqTSirOCMtYVP2wFgoWhP0p3g8ONK/4IHhLIBd0B9NYqAvIUAhq+OkhO4VM1tENCt0cjlsNShw=="], + "@babel/plugin-syntax-import-assertions": ["@babel/plugin-syntax-import-assertions@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-/An1OCBN93thpBAGyfsK2pcf0jvju1SAtKkL2Ny++B5Sy6sqgzXDQH1cZxWbF96Wuk+bn41MDA9bLd4VVAw6rw=="], - "@babel/plugin-syntax-import-attributes": ["@babel/plugin-syntax-import-attributes@7.28.6", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-jiLC0ma9XkQT3TKJ9uYvlakm66Pamywo+qwL+oL8HJOvc6TWdZXVfhqJr8CCzbSGUAbDOzlGHJC1U+vRfLQDvw=="], + "@babel/plugin-syntax-import-attributes": ["@babel/plugin-syntax-import-attributes@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-zGYcYfq/WmZ4V+kBIXQon9dSSc8ircGZqw9ZaNhhGj9nZkeBu1jHLBDQqYYi5WA9uawvA2sIMbry2nCFhf5Djg=="], - "@babel/plugin-syntax-jsx": ["@babel/plugin-syntax-jsx@7.28.6", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-wgEmr06G6sIpqr8YDwA2dSRTE3bJ+V0IfpzfSY3Lfgd7YWOaAdlykvJi13ZKBt8cZHfgH1IXN+CL656W3uUa4w=="], + "@babel/plugin-syntax-jsx": ["@babel/plugin-syntax-jsx@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-TSu8+mHCoEaaCDEZ0I3+6mvTBYR4PCxQwf2z9/r5Tbztv6NaLR3B9thGTTxX2WGuGHJqRiAbKPeGTJ5XWXVg6A=="], - "@babel/plugin-syntax-typescript": ["@babel/plugin-syntax-typescript@7.28.6", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-+nDNmQye7nlnuuHDboPbGm00Vqg3oO8niRRL27/4LYHUsHYh0zJ1xWOz0uRwNFmM1Avzk8wZbc6rdiYhomzv/A=="], + "@babel/plugin-syntax-typescript": ["@babel/plugin-syntax-typescript@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-ngr+82Sh0xMz25TPCZi+nC2iTzjfCdWS2ONXTp/PtSCHCgaCNBpdMqgvJ2ccdLlClVZ7sisIgB914j/JFe+RZA=="], "@babel/plugin-syntax-unicode-sets-regex": ["@babel/plugin-syntax-unicode-sets-regex@7.18.6", "", { "dependencies": { "@babel/helper-create-regexp-features-plugin": "^7.18.6", "@babel/helper-plugin-utils": "^7.18.6" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-727YkEAPwSIQTv5im8QHz3upqp92JTWhidIC81Tdx4VJYIte/VndKf1qKrfnnhPLiPghStWfvC/iFaMCQu7Nqg=="], - "@babel/plugin-transform-arrow-functions": ["@babel/plugin-transform-arrow-functions@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-8Z4TGic6xW70FKThA5HYEKKyBpOOsucTOD1DjU3fZxDg+K3zBJcXMFnt/4yQiZnf5+MiOMSXQ9PaEK/Ilh1DeA=="], + "@babel/plugin-transform-arrow-functions": ["@babel/plugin-transform-arrow-functions@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-N7zArUXWzAMzm+/N0uPBeVB3Fam5lMxtUwMmDK5f/IBBS7a7p1qeUoxd/6CckXoxUdgsntq1Dh8xNW06maZbDQ=="], - "@babel/plugin-transform-async-generator-functions": ["@babel/plugin-transform-async-generator-functions@7.29.0", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6", "@babel/helper-remap-async-to-generator": "^7.27.1", "@babel/traverse": "^7.29.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-va0VdWro4zlBr2JsXC+ofCPB2iG12wPtVGTWFx2WLDOM3nYQZZIGP82qku2eW/JR83sD+k2k+CsNtyEbUqhU6w=="], + "@babel/plugin-transform-async-generator-functions": ["@babel/plugin-transform-async-generator-functions@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7", "@babel/helper-remap-async-to-generator": "^7.29.7", "@babel/traverse": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-d98gXZkgswvkyohMBABkhm3GeXhYj8psWfwQ2C7gtfrKGTykQa/iOIi+JJhwMjPlZ6Vm2XN+DCf3Es1EoG4ZLA=="], - "@babel/plugin-transform-async-to-generator": ["@babel/plugin-transform-async-to-generator@7.28.6", "", { "dependencies": { "@babel/helper-module-imports": "^7.28.6", "@babel/helper-plugin-utils": "^7.28.6", "@babel/helper-remap-async-to-generator": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-ilTRcmbuXjsMmcZ3HASTe4caH5Tpo93PkTxF9oG2VZsSWsahydmcEHhix9Ik122RcTnZnUzPbmux4wh1swfv7g=="], + "@babel/plugin-transform-async-to-generator": ["@babel/plugin-transform-async-to-generator@7.29.7", "", { "dependencies": { "@babel/helper-module-imports": "^7.29.7", "@babel/helper-plugin-utils": "^7.29.7", "@babel/helper-remap-async-to-generator": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-pcUb2SS+RMo9TWVBwKGI5ShtoG7R+zBsFmCKDa6fe8c+hPr3XJlZgoE5j6i8W7gDjhyvy+85vmYexanvXh3d1w=="], - "@babel/plugin-transform-block-scoped-functions": ["@babel/plugin-transform-block-scoped-functions@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-cnqkuOtZLapWYZUYM5rVIdv1nXYuFVIltZ6ZJ7nIj585QsjKM5dhL2Fu/lICXZ1OyIAFc7Qy+bvDAtTXqGrlhg=="], + "@babel/plugin-transform-block-scoped-functions": ["@babel/plugin-transform-block-scoped-functions@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-cUSmjh72N+rN4PrkFlN1dJwNCwjVp5d38/CQrEsFggkD10UiFlBFgdH3tv5dNsLuHY+3S8db2xCHjhZcv5WgvA=="], - "@babel/plugin-transform-block-scoping": ["@babel/plugin-transform-block-scoping@7.28.6", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-tt/7wOtBmwHPNMPu7ax4pdPz6shjFrmHDghvNC+FG9Qvj7D6mJcoRQIF5dy4njmxR941l6rgtvfSB2zX3VlUIw=="], + "@babel/plugin-transform-block-scoping": ["@babel/plugin-transform-block-scoping@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-ONyr4+AZhKh8yKWInVxU9AXA9EbsyeLcL6V0dJy6M2/62vuvpGm29zzuymbTpdc451GEpDIdAyPLP3r+P61yKQ=="], - "@babel/plugin-transform-class-properties": ["@babel/plugin-transform-class-properties@7.28.6", "", { "dependencies": { "@babel/helper-create-class-features-plugin": "^7.28.6", "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-dY2wS3I2G7D697VHndN91TJr8/AAfXQNt5ynCTI/MpxMsSzHp+52uNivYT5wCPax3whc47DR8Ba7cmlQMg24bw=="], + "@babel/plugin-transform-class-properties": ["@babel/plugin-transform-class-properties@7.29.7", "", { "dependencies": { "@babel/helper-create-class-features-plugin": "^7.29.7", "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-GtcpjFvanPfzNQi3eTitsCqtRRmmqzpy/A+yhTR1HaZo1Ly3EA8ZXxlPyHdR8/IuRMYc3E4wdGBewB2QKQjAaA=="], - "@babel/plugin-transform-class-static-block": ["@babel/plugin-transform-class-static-block@7.28.6", "", { "dependencies": { "@babel/helper-create-class-features-plugin": "^7.28.6", "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.12.0" } }, "sha512-rfQ++ghVwTWTqQ7w8qyDxL1XGihjBss4CmTgGRCTAC9RIbhVpyp4fOeZtta0Lbf+dTNIVJer6ych2ibHwkZqsQ=="], + "@babel/plugin-transform-class-static-block": ["@babel/plugin-transform-class-static-block@7.29.7", "", { "dependencies": { "@babel/helper-create-class-features-plugin": "^7.29.7", "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.12.0" } }, "sha512-kibJgmEdX2iMwsHY2tSZNDgj8PwIlCQz7FK9KuGKO8zsuoUwSEhoNnNVp/emKWrbY4HeO6kkXfdMqRKKKXBm2A=="], - "@babel/plugin-transform-classes": ["@babel/plugin-transform-classes@7.28.6", "", { "dependencies": { "@babel/helper-annotate-as-pure": "^7.27.3", "@babel/helper-compilation-targets": "^7.28.6", "@babel/helper-globals": "^7.28.0", "@babel/helper-plugin-utils": "^7.28.6", "@babel/helper-replace-supers": "^7.28.6", "@babel/traverse": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-EF5KONAqC5zAqT783iMGuM2ZtmEBy+mJMOKl2BCvPZ2lVrwvXnB6o+OBWCS+CoeCCpVRF2sA2RBKUxvT8tQT5Q=="], + "@babel/plugin-transform-classes": ["@babel/plugin-transform-classes@7.29.7", "", { "dependencies": { "@babel/helper-annotate-as-pure": "^7.29.7", "@babel/helper-compilation-targets": "^7.29.7", "@babel/helper-globals": "^7.29.7", "@babel/helper-plugin-utils": "^7.29.7", "@babel/helper-replace-supers": "^7.29.7", "@babel/traverse": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-qV0OGGBVacduzQHE649JyCneOFI/maT+YKsO+K4Yi3xv2wTPNjM/W2o2gdzMwEAZz7fXNTHAe0NcSg30bIN69g=="], - "@babel/plugin-transform-computed-properties": ["@babel/plugin-transform-computed-properties@7.28.6", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6", "@babel/template": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-bcc3k0ijhHbc2lEfpFHgx7eYw9KNXqOerKWfzbxEHUGKnS3sz9C4CNL9OiFN1297bDNfUiSO7DaLzbvHQQQ1BQ=="], + "@babel/plugin-transform-computed-properties": ["@babel/plugin-transform-computed-properties@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7", "@babel/template": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-RK7/IyU5phpuCdBAuig5VkzG/EnbDaui5SQGdU9BFrHdV+mV4cUjLMQ9lJDjLNtWHsqtiefpGZUXQP2BiTYMsA=="], - "@babel/plugin-transform-destructuring": ["@babel/plugin-transform-destructuring@7.28.5", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1", "@babel/traverse": "^7.28.5" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-Kl9Bc6D0zTUcFUvkNuQh4eGXPKKNDOJQXVyyM4ZAQPMveniJdxi8XMJwLo+xSoW3MIq81bD33lcUe9kZpl0MCw=="], + "@babel/plugin-transform-destructuring": ["@babel/plugin-transform-destructuring@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7", "@babel/traverse": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-iPX8aD6H9zV5s7ZsqTdNocPN/MGQ5sSMnElKrktxjJRMnB2jN/1p2+R7GkfD6CAYoVFqy5A4XnSIUeGgJzIWpg=="], - "@babel/plugin-transform-dotall-regex": ["@babel/plugin-transform-dotall-regex@7.28.6", "", { "dependencies": { "@babel/helper-create-regexp-features-plugin": "^7.28.5", "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-SljjowuNKB7q5Oayv4FoPzeB74g3QgLt8IVJw9ADvWy3QnUb/01aw8I4AVv8wYnPvQz2GDDZ/g3GhcNyDBI4Bg=="], + "@babel/plugin-transform-dotall-regex": ["@babel/plugin-transform-dotall-regex@7.29.7", "", { "dependencies": { "@babel/helper-create-regexp-features-plugin": "^7.29.7", "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-3qc18hsD2RdZiyJNDNc7HQpv6xbncwh8FYtxNFFzclSyh/trPD9KkVR9BDECUjDLvb7yJVF15GfYUuC+LMkkiQ=="], - "@babel/plugin-transform-duplicate-keys": ["@babel/plugin-transform-duplicate-keys@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-MTyJk98sHvSs+cvZ4nOauwTTG1JeonDjSGvGGUNHreGQns+Mpt6WX/dVzWBHgg+dYZhkC4X+zTDfkTU+Vy9y7Q=="], + "@babel/plugin-transform-duplicate-keys": ["@babel/plugin-transform-duplicate-keys@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-6IvRRriEMqnBwD6chtxdLpMYCHWEzN+oL5cyQtjykya19UgzbmKhxmhZgKC/LHxS2nYr9Q/qYPZ5Lr6jOL9+yQ=="], - "@babel/plugin-transform-duplicate-named-capturing-groups-regex": ["@babel/plugin-transform-duplicate-named-capturing-groups-regex@7.29.0", "", { "dependencies": { "@babel/helper-create-regexp-features-plugin": "^7.28.5", "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-zBPcW2lFGxdiD8PUnPwJjag2J9otbcLQzvbiOzDxpYXyCuYX9agOwMPGn1prVH0a4qzhCKu24rlH4c1f7yA8rw=="], + "@babel/plugin-transform-duplicate-named-capturing-groups-regex": ["@babel/plugin-transform-duplicate-named-capturing-groups-regex@7.29.7", "", { "dependencies": { "@babel/helper-create-regexp-features-plugin": "^7.29.7", "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-2wiIyo2BjtgU7HufSeDnL9L2O7zr8jmhFKuSr65VpRkUiRKRNpb0mdlk56+XPPKoIrfHqzbMuglDvZun0RISsA=="], - "@babel/plugin-transform-dynamic-import": ["@babel/plugin-transform-dynamic-import@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-MHzkWQcEmjzzVW9j2q8LGjwGWpG2mjwaaB0BNQwst3FIjqsg8Ct/mIZlvSPJvfi9y2AC8mi/ktxbFVL9pZ1I4A=="], + "@babel/plugin-transform-dynamic-import": ["@babel/plugin-transform-dynamic-import@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-giOlEm/EFjfjr+te9NsdjkUo2v4f8rS/SXPumRVHAtbNcyNlvtREkU1dZzaIDclNpnaVhlCqRdFKhJBjBikzLg=="], - "@babel/plugin-transform-explicit-resource-management": ["@babel/plugin-transform-explicit-resource-management@7.28.6", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6", "@babel/plugin-transform-destructuring": "^7.28.5" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-Iao5Konzx2b6g7EPqTy40UZbcdXE126tTxVFr/nAIj+WItNxjKSYTEw3RC+A2/ZetmdJsgueL1KhaMCQHkLPIg=="], + "@babel/plugin-transform-explicit-resource-management": ["@babel/plugin-transform-explicit-resource-management@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7", "@babel/plugin-transform-destructuring": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-Rstj7coNz8sE+7Ju7ihpHLI564lsK5pUpNNlvptCIC/16E/S5hbl6n3kESPKdNRmqEWlpn5xpS5Q2dvXBsySLw=="], - "@babel/plugin-transform-exponentiation-operator": ["@babel/plugin-transform-exponentiation-operator@7.28.6", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-WitabqiGjV/vJ0aPOLSFfNY1u9U3R7W36B03r5I2KoNix+a3sOhJ3pKFB3R5It9/UiK78NiO0KE9P21cMhlPkw=="], + "@babel/plugin-transform-exponentiation-operator": ["@babel/plugin-transform-exponentiation-operator@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-zFpMOTLZBdW5LfObqcSbL6kefg4R4eLdmvS0wbN9M6D5Mym/sKm9toOoWyVOa+xDjvCnuWcHls2YonXwHvH3CQ=="], - "@babel/plugin-transform-export-namespace-from": ["@babel/plugin-transform-export-namespace-from@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-tQvHWSZ3/jH2xuq/vZDy0jNn+ZdXJeM8gHvX4lnJmsc3+50yPlWdZXIc5ay+umX+2/tJIqHqiEqcJvxlmIvRvQ=="], + "@babel/plugin-transform-export-namespace-from": ["@babel/plugin-transform-export-namespace-from@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-24B2nOy2TeJSMheqwPD4DDQOV/elLSIlKxjZt4i05H5AgdPdWR3n18HnNrcJ+j76WJd9gbwb9jPjNYUy6RautA=="], - "@babel/plugin-transform-for-of": ["@babel/plugin-transform-for-of@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1", "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-BfbWFFEJFQzLCQ5N8VocnCtA8J1CLkNTe2Ms2wocj75dd6VpiqS5Z5quTYcUoo4Yq+DN0rtikODccuv7RU81sw=="], + "@babel/plugin-transform-for-of": ["@babel/plugin-transform-for-of@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7", "@babel/helper-skip-transparent-expression-wrappers": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-zeSIHh0+E1Um1WJRXCFlHQYu2ieJNdivLLjlBEp+dIBu3S51n+SZZmIXjxnItw6pz56Cn+KvK68BIBVsxq2JiQ=="], - "@babel/plugin-transform-function-name": ["@babel/plugin-transform-function-name@7.27.1", "", { "dependencies": { "@babel/helper-compilation-targets": "^7.27.1", "@babel/helper-plugin-utils": "^7.27.1", "@babel/traverse": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-1bQeydJF9Nr1eBCMMbC+hdwmRlsv5XYOMu03YSWFwNs0HsAmtSxxF1fyuYPqemVldVyFmlCU7w8UE14LupUSZQ=="], + "@babel/plugin-transform-function-name": ["@babel/plugin-transform-function-name@7.29.7", "", { "dependencies": { "@babel/helper-compilation-targets": "^7.29.7", "@babel/helper-plugin-utils": "^7.29.7", "@babel/traverse": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-otRWaHXE6fbAGkePvaj/kvs3HsqXfPhlnzwSOlnFgbqCPMd975dW+4wZ00WFBt+/YlBGcJwNrARQTOJOb4ZrIg=="], - "@babel/plugin-transform-json-strings": ["@babel/plugin-transform-json-strings@7.28.6", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-Nr+hEN+0geQkzhbdgQVPoqr47lZbm+5fCUmO70722xJZd0Mvb59+33QLImGj6F+DkK3xgDi1YVysP8whD6FQAw=="], + "@babel/plugin-transform-json-strings": ["@babel/plugin-transform-json-strings@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-RRnE2+eon1rJAq8MnoF1b5kTpY1vU88twHcvcKMrsqP/jxIRqDVs9iJB5fqPuqyeFAW0wJo4MlUIPpQCq/aRsg=="], - "@babel/plugin-transform-literals": ["@babel/plugin-transform-literals@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-0HCFSepIpLTkLcsi86GG3mTUzxV5jpmbv97hTETW3yzrAij8aqlD36toB1D0daVFJM8NK6GvKO0gslVQmm+zZA=="], + "@babel/plugin-transform-literals": ["@babel/plugin-transform-literals@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-DZ/oLP21ZuWx1vKqnoNv6/tvEK48AQOBRai40CX9dTjGluvT/YZCyY3rryDtyUqCEoyNroy5KKPwX2iQCiRvyw=="], - "@babel/plugin-transform-logical-assignment-operators": ["@babel/plugin-transform-logical-assignment-operators@7.28.6", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-+anKKair6gpi8VsM/95kmomGNMD0eLz1NQ8+Pfw5sAwWH9fGYXT50E55ZpV0pHUHWf6IUTWPM+f/7AAff+wr9A=="], + "@babel/plugin-transform-logical-assignment-operators": ["@babel/plugin-transform-logical-assignment-operators@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-A0H91hh6W8MFRkp5TqJmMr39jzGD1A1E1Ysiv2O06Sfbhkapm+XyIzxWCEh5kqwOZ1/8QZ0dY3SeQ7XBqfJd5Q=="], - "@babel/plugin-transform-member-expression-literals": ["@babel/plugin-transform-member-expression-literals@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-hqoBX4dcZ1I33jCSWcXrP+1Ku7kdqXf1oeah7ooKOIiAdKQ+uqftgCFNOSzA5AMS2XIHEYeGFg4cKRCdpxzVOQ=="], + "@babel/plugin-transform-member-expression-literals": ["@babel/plugin-transform-member-expression-literals@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-hl1kwFZCCiDyfH25Xmco9jTrkPgnS9pmOzSG7W5I4SaGbLeqKv417hcU2RKmaxoPEgsoJh7ZPOrnPGq99bHoUg=="], - "@babel/plugin-transform-modules-amd": ["@babel/plugin-transform-modules-amd@7.27.1", "", { "dependencies": { "@babel/helper-module-transforms": "^7.27.1", "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-iCsytMg/N9/oFq6n+gFTvUYDZQOMK5kEdeYxmxt91fcJGycfxVP9CnrxoliM0oumFERba2i8ZtwRUCMhvP1LnA=="], + "@babel/plugin-transform-modules-amd": ["@babel/plugin-transform-modules-amd@7.29.7", "", { "dependencies": { "@babel/helper-module-transforms": "^7.29.7", "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-fxtQoH3m5ywUSIfaH0FGCzWu4McsYon5bD3K4XnskC7f+OyQMj7rsOMi4NvvmJ83WwBAg4UCe+ov4VZlqEvyew=="], - "@babel/plugin-transform-modules-commonjs": ["@babel/plugin-transform-modules-commonjs@7.28.6", "", { "dependencies": { "@babel/helper-module-transforms": "^7.28.6", "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-jppVbf8IV9iWWwWTQIxJMAJCWBuuKx71475wHwYytrRGQ2CWiDvYlADQno3tcYpS/T2UUWFQp3nVtYfK/YBQrA=="], + "@babel/plugin-transform-modules-commonjs": ["@babel/plugin-transform-modules-commonjs@7.29.7", "", { "dependencies": { "@babel/helper-module-transforms": "^7.29.7", "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-j0vCldybPC5b5dwCQOJ21uKtHzt7hxLygJTg9eF1ScfaikEDNfzn94XoW5Fi+seBR0nCyL23xaBFFkq7dTM8XQ=="], - "@babel/plugin-transform-modules-systemjs": ["@babel/plugin-transform-modules-systemjs@7.29.0", "", { "dependencies": { "@babel/helper-module-transforms": "^7.28.6", "@babel/helper-plugin-utils": "^7.28.6", "@babel/helper-validator-identifier": "^7.28.5", "@babel/traverse": "^7.29.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-PrujnVFbOdUpw4UHiVwKvKRLMMic8+eC0CuNlxjsyZUiBjhFdPsewdXCkveh2KqBA9/waD0W1b4hXSOBQJezpQ=="], + "@babel/plugin-transform-modules-systemjs": ["@babel/plugin-transform-modules-systemjs@7.29.7", "", { "dependencies": { "@babel/helper-module-transforms": "^7.29.7", "@babel/helper-plugin-utils": "^7.29.7", "@babel/helper-validator-identifier": "^7.29.7", "@babel/traverse": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-TM2ZcQLoG2/y4HODiStCo10DibYhWhGWAwVv+EQKmG/7GFl0N+AAmUiXOMKM+aiJ9XBJ9AHVZBvTzMnJ2sM3cQ=="], - "@babel/plugin-transform-modules-umd": ["@babel/plugin-transform-modules-umd@7.27.1", "", { "dependencies": { "@babel/helper-module-transforms": "^7.27.1", "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-iQBE/xC5BV1OxJbp6WG7jq9IWiD+xxlZhLrdwpPkTX3ydmXdvoCpyfJN7acaIBZaOqTfr76pgzqBJflNbeRK+w=="], + "@babel/plugin-transform-modules-umd": ["@babel/plugin-transform-modules-umd@7.29.7", "", { "dependencies": { "@babel/helper-module-transforms": "^7.29.7", "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-B4UkaTK3QpgCwJnrxKfMPKdo92CN7OKXAlpAAnM3UPu0Q0lCCk57ylA9AJbRy2v8dDKOPAAWcoR6CMyeoHwRCA=="], - "@babel/plugin-transform-named-capturing-groups-regex": ["@babel/plugin-transform-named-capturing-groups-regex@7.29.0", "", { "dependencies": { "@babel/helper-create-regexp-features-plugin": "^7.28.5", "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-1CZQA5KNAD6ZYQLPw7oi5ewtDNxH/2vuCh+6SmvgDfhumForvs8a1o9n0UrEoBD8HU4djO2yWngTQlXl1NDVEQ=="], + "@babel/plugin-transform-named-capturing-groups-regex": ["@babel/plugin-transform-named-capturing-groups-regex@7.29.7", "", { "dependencies": { "@babel/helper-create-regexp-features-plugin": "^7.29.7", "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-vuFoLwr4qnv2xbZ16SQd6uPcH5FNrLHhk/Jzo++0XJFcaDsr4gjJVg6j398oMHiC+83k/GiBzviwF5KBJkPUtQ=="], - "@babel/plugin-transform-new-target": ["@babel/plugin-transform-new-target@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-f6PiYeqXQ05lYq3TIfIDu/MtliKUbNwkGApPUvyo6+tc7uaR4cPjPe7DFPr15Uyycg2lZU6btZ575CuQoYh7MQ=="], + "@babel/plugin-transform-new-target": ["@babel/plugin-transform-new-target@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-fEo41GmsOUhOBlw8ioo6zvjX5Xc2Lqkzlyfqbpsk3eB6TReV18uhxZ0esfEokVbY2+PVJAQHNKxER6lGrzNd3A=="], - "@babel/plugin-transform-nullish-coalescing-operator": ["@babel/plugin-transform-nullish-coalescing-operator@7.28.6", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-3wKbRgmzYbw24mDJXT7N+ADXw8BC/imU9yo9c9X9NKaLF1fW+e5H1U5QjMUBe4Qo4Ox/o++IyUkl1sVCLgevKg=="], + "@babel/plugin-transform-nullish-coalescing-operator": ["@babel/plugin-transform-nullish-coalescing-operator@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-idmp1dFaekP9GbcMvG24Kvw2BfhFZjHnNJCkV4WuIY4PskJzwI3f1N5OdgYke38T7rftO6ERulFRn2cFeZwRkg=="], - "@babel/plugin-transform-numeric-separator": ["@babel/plugin-transform-numeric-separator@7.28.6", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-SJR8hPynj8outz+SlStQSwvziMN4+Bq99it4tMIf5/Caq+3iOc0JtKyse8puvyXkk3eFRIA5ID/XfunGgO5i6w=="], + "@babel/plugin-transform-numeric-separator": ["@babel/plugin-transform-numeric-separator@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-zR7fv/z14OjgHl4AgRtkDBvBMhIzCxqV/qN/2BCRC7LjFwvuzjYe7gDWxC4Wl/SNsLM6SE1IWvRPYMgSJaUvNw=="], - "@babel/plugin-transform-object-rest-spread": ["@babel/plugin-transform-object-rest-spread@7.28.6", "", { "dependencies": { "@babel/helper-compilation-targets": "^7.28.6", "@babel/helper-plugin-utils": "^7.28.6", "@babel/plugin-transform-destructuring": "^7.28.5", "@babel/plugin-transform-parameters": "^7.27.7", "@babel/traverse": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-5rh+JR4JBC4pGkXLAcYdLHZjXudVxWMXbB6u6+E9lRL5TrGVbHt1TjxGbZ8CkmYw9zjkB7jutzOROArsqtncEA=="], + "@babel/plugin-transform-object-rest-spread": ["@babel/plugin-transform-object-rest-spread@7.29.7", "", { "dependencies": { "@babel/helper-compilation-targets": "^7.29.7", "@babel/helper-plugin-utils": "^7.29.7", "@babel/plugin-transform-destructuring": "^7.29.7", "@babel/plugin-transform-parameters": "^7.29.7", "@babel/traverse": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-Ld98jn4c0smUywL57m7SgsHq3OpThOa6LqZJif3G6jYOovPleoFhVrBJ1WegRApSFB2wu4+RelAj9AC9G08Z4A=="], - "@babel/plugin-transform-object-super": ["@babel/plugin-transform-object-super@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1", "@babel/helper-replace-supers": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-SFy8S9plRPbIcxlJ8A6mT/CxFdJx/c04JEctz4jf8YZaVS2px34j7NXRrlGlHkN/M2gnpL37ZpGRGVFLd3l8Ng=="], + "@babel/plugin-transform-object-super": ["@babel/plugin-transform-object-super@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7", "@babel/helper-replace-supers": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-Ea/diGcw0twB5IlZPO5sgET6fJsLJqPABqTuFWIR+iMPGPZJkATEIWx0wa+aEQ5UY1CBQyP/gkAiLEqn1vBiQA=="], - "@babel/plugin-transform-optional-catch-binding": ["@babel/plugin-transform-optional-catch-binding@7.28.6", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-R8ja/Pyrv0OGAvAXQhSTmWyPJPml+0TMqXlO5w+AsMEiwb2fg3WkOvob7UxFSL3OIttFSGSRFKQsOhJ/X6HQdQ=="], + "@babel/plugin-transform-optional-catch-binding": ["@babel/plugin-transform-optional-catch-binding@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-sLsyndxK2VwX6yNUOakMb7Sh553ZTe/vVM1XJ+9Z5aW1ytsc8xOIwmyk05NNjN60vkc5/KqoTH6hB4V41LJhng=="], - "@babel/plugin-transform-optional-chaining": ["@babel/plugin-transform-optional-chaining@7.28.6", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6", "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-A4zobikRGJTsX9uqVFdafzGkqD30t26ck2LmOzAuLL8b2x6k3TIqRiT2xVvA9fNmFeTX484VpsdgmKNA0bS23w=="], + "@babel/plugin-transform-optional-chaining": ["@babel/plugin-transform-optional-chaining@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7", "@babel/helper-skip-transparent-expression-wrappers": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-6GM1dhvK3gNODkXcEcMCOLEDCLSoZ/sBbro2Ax8HURyasQ4NshagQixkRFdh5niI6E4gmA/jYI/4aT7rRos3ZQ=="], - "@babel/plugin-transform-parameters": ["@babel/plugin-transform-parameters@7.27.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-qBkYTYCb76RRxUM6CcZA5KRu8K4SM8ajzVeUgVdMVO9NN9uI/GaVmBg/WKJJGnNokV9SY8FxNOVWGXzqzUidBg=="], + "@babel/plugin-transform-parameters": ["@babel/plugin-transform-parameters@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-ZDOBqV/qLYJI0YElr8DcENEyARsFQeESqWXH6gZlghYXuPPjvweuDhP4VyEi4BlUBlLRFZVjxoZDMjxhLW766g=="], - "@babel/plugin-transform-private-methods": ["@babel/plugin-transform-private-methods@7.28.6", "", { "dependencies": { "@babel/helper-create-class-features-plugin": "^7.28.6", "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-piiuapX9CRv7+0st8lmuUlRSmX6mBcVeNQ1b4AYzJxfCMuBfB0vBXDiGSmm03pKJw1v6cZ8KSeM+oUnM6yAExg=="], + "@babel/plugin-transform-private-methods": ["@babel/plugin-transform-private-methods@7.29.7", "", { "dependencies": { "@babel/helper-create-class-features-plugin": "^7.29.7", "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-/6Rz4DK1ETDEM/bWHsPHcaEe7ZaT1EqSXjtSP/L0DijOYuaUhiRiOKcwpZ8P7zR4xXEHc2ITdiCgBm9Tpyv9ug=="], - "@babel/plugin-transform-private-property-in-object": ["@babel/plugin-transform-private-property-in-object@7.28.6", "", { "dependencies": { "@babel/helper-annotate-as-pure": "^7.27.3", "@babel/helper-create-class-features-plugin": "^7.28.6", "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-b97jvNSOb5+ehyQmBpmhOCiUC5oVK4PMnpRvO7+ymFBoqYjeDHIU9jnrNUuwHOiL9RpGDoKBpSViarV+BU+eVA=="], + "@babel/plugin-transform-private-property-in-object": ["@babel/plugin-transform-private-property-in-object@7.29.7", "", { "dependencies": { "@babel/helper-annotate-as-pure": "^7.29.7", "@babel/helper-create-class-features-plugin": "^7.29.7", "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-+BNo06dnrzdNNqCm1X6YUaVv0DKk8Q+JYcoZfOkLhYWNCXzlwTSRq8zGWayT1csjcpNXV9CQTBRRbmTLZac5cA=="], - "@babel/plugin-transform-property-literals": ["@babel/plugin-transform-property-literals@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-oThy3BCuCha8kDZ8ZkgOg2exvPYUlprMukKQXI1r1pJ47NCvxfkEy8vK+r/hT9nF0Aa4H1WUPZZjHTFtAhGfmQ=="], + "@babel/plugin-transform-property-literals": ["@babel/plugin-transform-property-literals@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-bOMRLQuI0A5ZqHq3OWJ89/rXpJ/NJrbVhXiP4zwPGMs6kpcVsuTUNjwoE30K0Qm3mf48a/TnRYYD6vPNqcg6jA=="], - "@babel/plugin-transform-react-jsx-self": ["@babel/plugin-transform-react-jsx-self@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-6UzkCs+ejGdZ5mFFC/OCUrv028ab2fp1znZmCZjAOBKiBK2jXD1O+BPSfX8X2qjJ75fZBMSnQn3Rq2mrBJK2mw=="], + "@babel/plugin-transform-react-jsx-self": ["@babel/plugin-transform-react-jsx-self@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-TL0hMc9xzy86VD31nUiwzd5otRAcyEPcsegCxolO0PvcXuH1v0kECe/UIznYFihpkvU5wg/jk4v0TTEFfm53fw=="], - "@babel/plugin-transform-react-jsx-source": ["@babel/plugin-transform-react-jsx-source@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-zbwoTsBruTeKB9hSq73ha66iFeJHuaFkUbwvqElnygoNbj/jHRsSeokowZFN3CZ64IvEqcmmkVe89OPXc7ldAw=="], + "@babel/plugin-transform-react-jsx-source": ["@babel/plugin-transform-react-jsx-source@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-06IyK09H3wi4cGbhDBwp5gUGo0IKtnYa8tyTiephirPCK6fbobVGiXMMI5zLQ4aKEYP3wZ3ArU44o+8KMrSG/Q=="], - "@babel/plugin-transform-regenerator": ["@babel/plugin-transform-regenerator@7.29.0", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-FijqlqMA7DmRdg/aINBSs04y8XNTYw/lr1gJ2WsmBnnaNw1iS43EPkJW+zK7z65auG3AWRFXWj+NcTQwYptUog=="], + "@babel/plugin-transform-regenerator": ["@babel/plugin-transform-regenerator@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-rNNFV0DBAJp988xW2DOntfDoYn1eR8GGF5AT5vYc+rjyfaQkM242c9tZUHHPe7KYaiJizXPWhQTzzdbXySyhBw=="], - "@babel/plugin-transform-regexp-modifiers": ["@babel/plugin-transform-regexp-modifiers@7.28.6", "", { "dependencies": { "@babel/helper-create-regexp-features-plugin": "^7.28.5", "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-QGWAepm9qxpaIs7UM9FvUSnCGlb8Ua1RhyM4/veAxLwt3gMat/LSGrZixyuj4I6+Kn9iwvqCyPTtbdxanYoWYg=="], + "@babel/plugin-transform-regexp-modifiers": ["@babel/plugin-transform-regexp-modifiers@7.29.7", "", { "dependencies": { "@babel/helper-create-regexp-features-plugin": "^7.29.7", "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-mB5Fs0VWrJ42ZCmc8114v60qetdaUVNkj9PmSZRmanCZM3S9hm0CFRLjRmYIsuXav14l2jvZ+4T8iiCGnhj3nQ=="], - "@babel/plugin-transform-reserved-words": ["@babel/plugin-transform-reserved-words@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-V2ABPHIJX4kC7HegLkYoDpfg9PVmuWy/i6vUM5eGK22bx4YVFD3M5F0QQnWQoDs6AGsUWTVOopBiMFQgHaSkVw=="], + "@babel/plugin-transform-reserved-words": ["@babel/plugin-transform-reserved-words@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-5+YhdpVgmfSmwZyLMftfaiffLRMHjzIRHFHHLdibcSyJm2pasMrKHrO3Ptrt2DRshjvpgjEJJ1zVW14WPq/6QA=="], - "@babel/plugin-transform-shorthand-properties": ["@babel/plugin-transform-shorthand-properties@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-N/wH1vcn4oYawbJ13Y/FxcQrWk63jhfNa7jef0ih7PHSIHX2LB7GWE1rkPrOnka9kwMxb6hMl19p7lidA+EHmQ=="], + "@babel/plugin-transform-shorthand-properties": ["@babel/plugin-transform-shorthand-properties@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-I+WYbGBAiCn7nA6xBrlgPH+MB7HWb4u8pv5S0Pv7OtwNvIFvCCb24YlttKEeUFVurfBCEaOTnuhlqsb7f0Z5Dg=="], - "@babel/plugin-transform-spread": ["@babel/plugin-transform-spread@7.28.6", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.28.6", "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-9U4QObUC0FtJl05AsUcodau/RWDytrU6uKgkxu09mLR9HLDAtUMoPuuskm5huQsoktmsYpI+bGmq+iapDcriKA=="], + "@babel/plugin-transform-spread": ["@babel/plugin-transform-spread@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7", "@babel/helper-skip-transparent-expression-wrappers": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-/u5K1QWada7tbYNqTjMh96718g9NTwh9tfPJMsSmVsQwGT447FskV+KcfeXkXq2GWki4EM/MuTdmBec+hOuVTQ=="], - "@babel/plugin-transform-sticky-regex": ["@babel/plugin-transform-sticky-regex@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-lhInBO5bi/Kowe2/aLdBAawijx+q1pQzicSgnkB6dUPc1+RC8QmJHKf2OjvU+NZWitguJHEaEmbV6VWEouT58g=="], + "@babel/plugin-transform-sticky-regex": ["@babel/plugin-transform-sticky-regex@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-BCHzNYJGe9l7EpwwDBN/ztlL2NYFFq8hp9ddjtUEM9f2O7S7kKV/lL6Fwo7IF7NSkYhPK2vO+86nIGltA90MsA=="], - "@babel/plugin-transform-template-literals": ["@babel/plugin-transform-template-literals@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-fBJKiV7F2DxZUkg5EtHKXQdbsbURW3DZKQUWphDum0uRP6eHGGa/He9mc0mypL680pb+e/lDIthRohlv8NCHkg=="], + "@babel/plugin-transform-template-literals": ["@babel/plugin-transform-template-literals@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-NCSEJ4sLFU2gqAub45HYh4fus2yQ36rr6ei6vpU7NdoJqCpxvEG8E6eJpscGyXP3VHD2Ny+fSXr04k1hoUrFqA=="], - "@babel/plugin-transform-typeof-symbol": ["@babel/plugin-transform-typeof-symbol@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-RiSILC+nRJM7FY5srIyc4/fGIwUhyDuuBSdWn4y6yT6gm652DpCHZjIipgn6B7MQ1ITOUnAKWixEUjQRIBIcLw=="], + "@babel/plugin-transform-typeof-symbol": ["@babel/plugin-transform-typeof-symbol@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-223mNGoTkBiTEWFoK+Q6Go3tueMRclO8vxxxxquNCYuNI4jWOofFKJRRDu6SDrB8Sgo1UEGW9T4GAQ8ZyRso1A=="], - "@babel/plugin-transform-typescript": ["@babel/plugin-transform-typescript@7.28.6", "", { "dependencies": { "@babel/helper-annotate-as-pure": "^7.27.3", "@babel/helper-create-class-features-plugin": "^7.28.6", "@babel/helper-plugin-utils": "^7.28.6", "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1", "@babel/plugin-syntax-typescript": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-0YWL2RFxOqEm9Efk5PvreamxPME8OyY0wM5wh5lHjF+VtVhdneCWGzZeSqzOfiobVqQaNCd2z0tQvnI9DaPWPw=="], + "@babel/plugin-transform-typescript": ["@babel/plugin-transform-typescript@7.29.7", "", { "dependencies": { "@babel/helper-annotate-as-pure": "^7.29.7", "@babel/helper-create-class-features-plugin": "^7.29.7", "@babel/helper-plugin-utils": "^7.29.7", "@babel/helper-skip-transparent-expression-wrappers": "^7.29.7", "@babel/plugin-syntax-typescript": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-jK52h8LaLc7JarhQV2ofeFMts4H7vnOXnqZNA6fYglBTZewRBE51KWt3BUltW1P+KoPsYkHoJeXePuz4zo2LMw=="], - "@babel/plugin-transform-unicode-escapes": ["@babel/plugin-transform-unicode-escapes@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-Ysg4v6AmF26k9vpfFuTZg8HRfVWzsh1kVfowA23y9j/Gu6dOuahdUVhkLqpObp3JIv27MLSii6noRnuKN8H0Mg=="], + "@babel/plugin-transform-unicode-escapes": ["@babel/plugin-transform-unicode-escapes@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-jCfXxSjf94lf4E0hKE0AByxF6F3/pVFqRdUUNkDJhsY0m1ZKjnN6ZYyMeHNpzflxb/0q5b7t3p+BE+SLF1WOtA=="], - "@babel/plugin-transform-unicode-property-regex": ["@babel/plugin-transform-unicode-property-regex@7.28.6", "", { "dependencies": { "@babel/helper-create-regexp-features-plugin": "^7.28.5", "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-4Wlbdl/sIZjzi/8St0evF0gEZrgOswVO6aOzqxh1kDZOl9WmLrHq2HtGhnOJZmHZYKP8WZ1MDLCt5DAWwRo57A=="], + "@babel/plugin-transform-unicode-property-regex": ["@babel/plugin-transform-unicode-property-regex@7.29.7", "", { "dependencies": { "@babel/helper-create-regexp-features-plugin": "^7.29.7", "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-OgZ+zoAJgZLUCunsTRQ5LAjOywDv5zzZ2/hQ5aMw1pGXyY2rtE8/chXYUmu3AlVHKpm10KEdG9aMwbI/K76ZGw=="], - "@babel/plugin-transform-unicode-regex": ["@babel/plugin-transform-unicode-regex@7.27.1", "", { "dependencies": { "@babel/helper-create-regexp-features-plugin": "^7.27.1", "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-xvINq24TRojDuyt6JGtHmkVkrfVV3FPT16uytxImLeBZqW3/H52yN+kM1MGuyPkIQxrzKwPHs5U/MP3qKyzkGw=="], + "@babel/plugin-transform-unicode-regex": ["@babel/plugin-transform-unicode-regex@7.29.7", "", { "dependencies": { "@babel/helper-create-regexp-features-plugin": "^7.29.7", "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-7D/x/23/d/3VqZ0QA+LGbZMlGwZjztBygSWWWsfTPoQ1oQ6Q1P6Mr3d0kk42XabyUVw+fha3LqdRsFqeKqvCyA=="], - "@babel/plugin-transform-unicode-sets-regex": ["@babel/plugin-transform-unicode-sets-regex@7.28.6", "", { "dependencies": { "@babel/helper-create-regexp-features-plugin": "^7.28.5", "@babel/helper-plugin-utils": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-/wHc/paTUmsDYN7SZkpWxogTOBNnlx7nBQYfy6JJlCT7G3mVhltk3e++N7zV0XfgGsrqBxd4rJQt9H16I21Y1Q=="], + "@babel/plugin-transform-unicode-sets-regex": ["@babel/plugin-transform-unicode-sets-regex@7.29.7", "", { "dependencies": { "@babel/helper-create-regexp-features-plugin": "^7.29.7", "@babel/helper-plugin-utils": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-BLOhLht9DOJwIxlmp91wHvkXv1lguuHS3/FwUO8HL1H0u8s4hR1gASVFyilu9iGtcTRYqjTZmlsFFeQletntEg=="], - "@babel/preset-env": ["@babel/preset-env@7.29.2", "", { "dependencies": { "@babel/compat-data": "^7.29.0", "@babel/helper-compilation-targets": "^7.28.6", "@babel/helper-plugin-utils": "^7.28.6", "@babel/helper-validator-option": "^7.27.1", "@babel/plugin-bugfix-firefox-class-in-computed-class-key": "^7.28.5", "@babel/plugin-bugfix-safari-class-field-initializer-scope": "^7.27.1", "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.27.1", "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.27.1", "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": "^7.28.6", "@babel/plugin-proposal-private-property-in-object": "7.21.0-placeholder-for-preset-env.2", "@babel/plugin-syntax-import-assertions": "^7.28.6", "@babel/plugin-syntax-import-attributes": "^7.28.6", "@babel/plugin-syntax-unicode-sets-regex": "^7.18.6", "@babel/plugin-transform-arrow-functions": "^7.27.1", "@babel/plugin-transform-async-generator-functions": "^7.29.0", "@babel/plugin-transform-async-to-generator": "^7.28.6", "@babel/plugin-transform-block-scoped-functions": "^7.27.1", "@babel/plugin-transform-block-scoping": "^7.28.6", "@babel/plugin-transform-class-properties": "^7.28.6", "@babel/plugin-transform-class-static-block": "^7.28.6", "@babel/plugin-transform-classes": "^7.28.6", "@babel/plugin-transform-computed-properties": "^7.28.6", "@babel/plugin-transform-destructuring": "^7.28.5", "@babel/plugin-transform-dotall-regex": "^7.28.6", "@babel/plugin-transform-duplicate-keys": "^7.27.1", "@babel/plugin-transform-duplicate-named-capturing-groups-regex": "^7.29.0", "@babel/plugin-transform-dynamic-import": "^7.27.1", "@babel/plugin-transform-explicit-resource-management": "^7.28.6", "@babel/plugin-transform-exponentiation-operator": "^7.28.6", "@babel/plugin-transform-export-namespace-from": "^7.27.1", "@babel/plugin-transform-for-of": "^7.27.1", "@babel/plugin-transform-function-name": "^7.27.1", "@babel/plugin-transform-json-strings": "^7.28.6", "@babel/plugin-transform-literals": "^7.27.1", "@babel/plugin-transform-logical-assignment-operators": "^7.28.6", "@babel/plugin-transform-member-expression-literals": "^7.27.1", "@babel/plugin-transform-modules-amd": "^7.27.1", "@babel/plugin-transform-modules-commonjs": "^7.28.6", "@babel/plugin-transform-modules-systemjs": "^7.29.0", "@babel/plugin-transform-modules-umd": "^7.27.1", "@babel/plugin-transform-named-capturing-groups-regex": "^7.29.0", "@babel/plugin-transform-new-target": "^7.27.1", "@babel/plugin-transform-nullish-coalescing-operator": "^7.28.6", "@babel/plugin-transform-numeric-separator": "^7.28.6", "@babel/plugin-transform-object-rest-spread": "^7.28.6", "@babel/plugin-transform-object-super": "^7.27.1", "@babel/plugin-transform-optional-catch-binding": "^7.28.6", "@babel/plugin-transform-optional-chaining": "^7.28.6", "@babel/plugin-transform-parameters": "^7.27.7", "@babel/plugin-transform-private-methods": "^7.28.6", "@babel/plugin-transform-private-property-in-object": "^7.28.6", "@babel/plugin-transform-property-literals": "^7.27.1", "@babel/plugin-transform-regenerator": "^7.29.0", "@babel/plugin-transform-regexp-modifiers": "^7.28.6", "@babel/plugin-transform-reserved-words": "^7.27.1", "@babel/plugin-transform-shorthand-properties": "^7.27.1", "@babel/plugin-transform-spread": "^7.28.6", "@babel/plugin-transform-sticky-regex": "^7.27.1", "@babel/plugin-transform-template-literals": "^7.27.1", "@babel/plugin-transform-typeof-symbol": "^7.27.1", "@babel/plugin-transform-unicode-escapes": "^7.27.1", "@babel/plugin-transform-unicode-property-regex": "^7.28.6", "@babel/plugin-transform-unicode-regex": "^7.27.1", "@babel/plugin-transform-unicode-sets-regex": "^7.28.6", "@babel/preset-modules": "0.1.6-no-external-plugins", "babel-plugin-polyfill-corejs2": "^0.4.15", "babel-plugin-polyfill-corejs3": "^0.14.0", "babel-plugin-polyfill-regenerator": "^0.6.6", "core-js-compat": "^3.48.0", "semver": "^6.3.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-DYD23veRYGvBFhcTY1iUvJnDNpuqNd/BzBwCvzOTKUnJjKg5kpUBh3/u9585Agdkgj+QuygG7jLfOPWMa2KVNw=="], + "@babel/preset-env": ["@babel/preset-env@7.29.7", "", { "dependencies": { "@babel/compat-data": "^7.29.7", "@babel/helper-compilation-targets": "^7.29.7", "@babel/helper-plugin-utils": "^7.29.7", "@babel/helper-validator-option": "^7.29.7", "@babel/plugin-bugfix-firefox-class-in-computed-class-key": "^7.29.7", "@babel/plugin-bugfix-safari-class-field-initializer-scope": "^7.29.7", "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.29.7", "@babel/plugin-bugfix-safari-rest-destructuring-rhs-array": "^7.29.7", "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.29.7", "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": "^7.29.7", "@babel/plugin-proposal-private-property-in-object": "7.21.0-placeholder-for-preset-env.2", "@babel/plugin-syntax-import-assertions": "^7.29.7", "@babel/plugin-syntax-import-attributes": "^7.29.7", "@babel/plugin-syntax-unicode-sets-regex": "^7.18.6", "@babel/plugin-transform-arrow-functions": "^7.29.7", "@babel/plugin-transform-async-generator-functions": "^7.29.7", "@babel/plugin-transform-async-to-generator": "^7.29.7", "@babel/plugin-transform-block-scoped-functions": "^7.29.7", "@babel/plugin-transform-block-scoping": "^7.29.7", "@babel/plugin-transform-class-properties": "^7.29.7", "@babel/plugin-transform-class-static-block": "^7.29.7", "@babel/plugin-transform-classes": "^7.29.7", "@babel/plugin-transform-computed-properties": "^7.29.7", "@babel/plugin-transform-destructuring": "^7.29.7", "@babel/plugin-transform-dotall-regex": "^7.29.7", "@babel/plugin-transform-duplicate-keys": "^7.29.7", "@babel/plugin-transform-duplicate-named-capturing-groups-regex": "^7.29.7", "@babel/plugin-transform-dynamic-import": "^7.29.7", "@babel/plugin-transform-explicit-resource-management": "^7.29.7", "@babel/plugin-transform-exponentiation-operator": "^7.29.7", "@babel/plugin-transform-export-namespace-from": "^7.29.7", "@babel/plugin-transform-for-of": "^7.29.7", "@babel/plugin-transform-function-name": "^7.29.7", "@babel/plugin-transform-json-strings": "^7.29.7", "@babel/plugin-transform-literals": "^7.29.7", "@babel/plugin-transform-logical-assignment-operators": "^7.29.7", "@babel/plugin-transform-member-expression-literals": "^7.29.7", "@babel/plugin-transform-modules-amd": "^7.29.7", "@babel/plugin-transform-modules-commonjs": "^7.29.7", "@babel/plugin-transform-modules-systemjs": "^7.29.7", "@babel/plugin-transform-modules-umd": "^7.29.7", "@babel/plugin-transform-named-capturing-groups-regex": "^7.29.7", "@babel/plugin-transform-new-target": "^7.29.7", "@babel/plugin-transform-nullish-coalescing-operator": "^7.29.7", "@babel/plugin-transform-numeric-separator": "^7.29.7", "@babel/plugin-transform-object-rest-spread": "^7.29.7", "@babel/plugin-transform-object-super": "^7.29.7", "@babel/plugin-transform-optional-catch-binding": "^7.29.7", "@babel/plugin-transform-optional-chaining": "^7.29.7", "@babel/plugin-transform-parameters": "^7.29.7", "@babel/plugin-transform-private-methods": "^7.29.7", "@babel/plugin-transform-private-property-in-object": "^7.29.7", "@babel/plugin-transform-property-literals": "^7.29.7", "@babel/plugin-transform-regenerator": "^7.29.7", "@babel/plugin-transform-regexp-modifiers": "^7.29.7", "@babel/plugin-transform-reserved-words": "^7.29.7", "@babel/plugin-transform-shorthand-properties": "^7.29.7", "@babel/plugin-transform-spread": "^7.29.7", "@babel/plugin-transform-sticky-regex": "^7.29.7", "@babel/plugin-transform-template-literals": "^7.29.7", "@babel/plugin-transform-typeof-symbol": "^7.29.7", "@babel/plugin-transform-unicode-escapes": "^7.29.7", "@babel/plugin-transform-unicode-property-regex": "^7.29.7", "@babel/plugin-transform-unicode-regex": "^7.29.7", "@babel/plugin-transform-unicode-sets-regex": "^7.29.7", "@babel/preset-modules": "0.1.6-no-external-plugins", "babel-plugin-polyfill-corejs2": "^0.4.15", "babel-plugin-polyfill-corejs3": "^0.14.0", "babel-plugin-polyfill-regenerator": "^0.6.6", "core-js-compat": "^3.48.0", "semver": "^6.3.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-GYzX36n1nsciIb0uyH0GHwxwtNwPQIcpxSeiVLDtG/B7jB5xXgchnmL1f/jCX5o+pwnaDBtO60ONSJhEBJfxYA=="], "@babel/preset-modules": ["@babel/preset-modules@0.1.6-no-external-plugins", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.0.0", "@babel/types": "^7.4.4", "esutils": "^2.0.2" }, "peerDependencies": { "@babel/core": "^7.0.0-0 || ^8.0.0-0 <8.0.0" } }, "sha512-HrcgcIESLm9aIR842yhJ5RWan/gebQUJ6E/E5+rf0y9o6oj7w0Br+sWuL6kEQ/o/AdfvR1Je9jG18/gnpwjEyA=="], - "@babel/preset-typescript": ["@babel/preset-typescript@7.28.5", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1", "@babel/helper-validator-option": "^7.27.1", "@babel/plugin-syntax-jsx": "^7.27.1", "@babel/plugin-transform-modules-commonjs": "^7.27.1", "@babel/plugin-transform-typescript": "^7.28.5" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-+bQy5WOI2V6LJZpPVxY+yp66XdZ2yifu0Mc1aP5CQKgjn4QM5IN2i5fAZ4xKop47pr8rpVhiAeu+nDQa12C8+g=="], + "@babel/preset-typescript": ["@babel/preset-typescript@7.29.7", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.29.7", "@babel/helper-validator-option": "^7.29.7", "@babel/plugin-syntax-jsx": "^7.29.7", "@babel/plugin-transform-modules-commonjs": "^7.29.7", "@babel/plugin-transform-typescript": "^7.29.7" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-/Foi8vKY2EVbed/1eZx0gJEEwHAIxogrySI7rULcRIvhZzbvoE/b5qG5Ghc0WKAFKOHA9SD1x7RsFlOYdutIiQ=="], - "@babel/runtime": ["@babel/runtime@7.29.2", "", {}, "sha512-JiDShH45zKHWyGe4ZNVRrCjBz8Nh9TMmZG1kh4QTK8hCBTWBi8Da+i7s1fJw7/lYpM4ccepSNfqzZ/QvABBi5g=="], + "@babel/runtime": ["@babel/runtime@7.29.7", "", {}, "sha512-Nq8OhGWiZIZGV6hLHoyAKLLcJihP/xFeBMGJoUrxTX2psI8dCifzLhZISFb+VWS3wFMRDmCGw5R+dOySCqPLhw=="], - "@babel/template": ["@babel/template@7.28.6", "", { "dependencies": { "@babel/code-frame": "^7.28.6", "@babel/parser": "^7.28.6", "@babel/types": "^7.28.6" } }, "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ=="], + "@babel/template": ["@babel/template@7.29.7", "", { "dependencies": { "@babel/code-frame": "^7.29.7", "@babel/parser": "^7.29.7", "@babel/types": "^7.29.7" } }, "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg=="], - "@babel/traverse": ["@babel/traverse@7.29.0", "", { "dependencies": { "@babel/code-frame": "^7.29.0", "@babel/generator": "^7.29.0", "@babel/helper-globals": "^7.28.0", "@babel/parser": "^7.29.0", "@babel/template": "^7.28.6", "@babel/types": "^7.29.0", "debug": "^4.3.1" } }, "sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA=="], + "@babel/traverse": ["@babel/traverse@7.29.7", "", { "dependencies": { "@babel/code-frame": "^7.29.7", "@babel/generator": "^7.29.7", "@babel/helper-globals": "^7.29.7", "@babel/parser": "^7.29.7", "@babel/template": "^7.29.7", "@babel/types": "^7.29.7", "debug": "^4.3.1" } }, "sha512-EhlfNQtZ+NK22w5BM61ciuiq1m58ed33Wr1Xan//ZRTy6hgjnwyCffRYwzsGXdASJSUJ1guZILsErh1eQcl+zw=="], - "@babel/types": ["@babel/types@7.29.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A=="], + "@babel/types": ["@babel/types@7.29.7", "", { "dependencies": { "@babel/helper-string-parser": "^7.29.7", "@babel/helper-validator-identifier": "^7.29.7" } }, "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA=="], "@base-org/account": ["@base-org/account@2.4.0", "", { "dependencies": { "@coinbase/cdp-sdk": "^1.0.0", "@noble/hashes": "1.4.0", "clsx": "1.2.1", "eventemitter3": "5.0.1", "idb-keyval": "6.2.1", "ox": "0.6.9", "preact": "10.24.2", "viem": "^2.31.7", "zustand": "5.0.3" } }, "sha512-A4Umpi8B9/pqR78D1Yoze4xHyQaujioVRqqO3d6xuDFw9VRtjg6tK3bPlwE0aW+nVH/ntllCpPa2PbI8Rnjcug=="], @@ -672,7 +662,7 @@ "@borewit/text-codec": ["@borewit/text-codec@0.2.2", "", {}, "sha512-DDaRehssg1aNrH4+2hnj1B7vnUGEjU6OIlyRdkMd0aUdIUvKXrJfXsy8LVtXAy7DRvYVluWbMspsRhz2lcW0mQ=="], - "@coinbase/cdp-sdk": ["@coinbase/cdp-sdk@1.45.0", "", { "dependencies": { "@solana-program/system": "^0.10.0", "@solana-program/token": "^0.9.0", "@solana/kit": "^5.1.0", "@solana/web3.js": "^1.98.1", "abitype": "1.0.6", "axios": "^1.12.2", "axios-retry": "^4.5.0", "jose": "^6.0.8", "md5": "^2.3.0", "uncrypto": "^0.1.3", "viem": "^2.21.26", "zod": "^3.24.4" } }, "sha512-4fgGOhyN9g/pTDE9NtsKUapwFsubrk9wafz8ltmBqSwWqLZWfWxXkVmzMYYFAf+qeGf/X9JqJtmvDVaHFlXWlw=="], + "@coinbase/cdp-sdk": ["@coinbase/cdp-sdk@1.50.0", "", { "dependencies": { "@solana-program/system": "^0.10.0", "@solana-program/token": "^0.9.0", "@solana/kit": "^5.5.1", "abitype": "1.0.6", "axios": "1.16.0", "axios-retry": "^4.5.0", "bs58": "^6.0.0", "jose": "^6.2.0", "md5": "^2.3.0", "uncrypto": "^0.1.3", "viem": "^2.47.0", "zod": "^3.25.76" } }, "sha512-lKK6aC2z8q8C3IA39unNuWc8lgM0hU9mSqkdd7Bncf5xvT28f8G6upexFtJweNwxkeAJwiLSgBkwOhqMK2/OGQ=="], "@coinbase/wallet-sdk": ["@coinbase/wallet-sdk@4.3.6", "", { "dependencies": { "@noble/hashes": "1.4.0", "clsx": "1.2.1", "eventemitter3": "5.0.1", "idb-keyval": "6.2.1", "ox": "0.6.9", "preact": "10.24.2", "viem": "^2.27.2", "zustand": "5.0.3" } }, "sha512-4q8BNG1ViL4mSAAvPAtpwlOs1gpC+67eQtgIwNvT3xyeyFFd+guwkc8bcX5rTmQhXpqnhzC4f0obACbP9CqMSA=="], @@ -682,13 +672,13 @@ "@dabh/diagnostics": ["@dabh/diagnostics@2.0.8", "", { "dependencies": { "@so-ric/colorspace": "^1.1.6", "enabled": "2.0.x", "kuler": "^2.0.0" } }, "sha512-R4MSXTVnuMzGD7bzHdW2ZhhdPC/igELENcq5IjEverBvq5hn1SXCWcsi6eSsdWP0/Ur+SItRRjAktmdoX/8R/Q=="], - "@ecies/ciphers": ["@ecies/ciphers@0.2.5", "", { "peerDependencies": { "@noble/ciphers": "^1.0.0" } }, "sha512-GalEZH4JgOMHYYcYmVqnFirFsjZHeoGMDt9IxEnM9F7GRUUyUksJ7Ou53L83WHJq3RWKD3AcBpo0iQh0oMpf8A=="], + "@ecies/ciphers": ["@ecies/ciphers@0.2.6", "", { "peerDependencies": { "@noble/ciphers": "^1.0.0" } }, "sha512-patgsRPKGkhhoBjETV4XxD0En4ui5fbX0hzayqI3M8tvNMGUoUvmyYAIWwlxBc1KX5cturfqByYdj5bYGRpN9g=="], - "@emnapi/core": ["@emnapi/core@1.9.1", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.0", "tslib": "^2.4.0" } }, "sha512-mukuNALVsoix/w1BJwFzwXBN/dHeejQtuVzcDsfOEsdpCumXb/E9j8w11h5S54tT1xhifGfbbSm/ICrObRb3KA=="], + "@emnapi/core": ["@emnapi/core@1.10.0", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.1", "tslib": "^2.4.0" } }, "sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw=="], - "@emnapi/runtime": ["@emnapi/runtime@1.9.1", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-VYi5+ZVLhpgK4hQ0TAjiQiZ6ol0oe4mBx7mVv7IflsiEp0OWoVsp/+f9Vc1hOhE0TtkORVrI1GvzyreqpgWtkA=="], + "@emnapi/runtime": ["@emnapi/runtime@1.10.0", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA=="], - "@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.2.0", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-N10dEJNSsUx41Z6pZsXU8FjPjpBEplgH24sfkmITrBED1/U2Esum9F3lfLrMjKHHjmi557zQn7kR9R+XWXu5Rg=="], + "@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.2.1", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w=="], "@envelop/core": ["@envelop/core@5.5.1", "", { "dependencies": { "@envelop/instrumentation": "^1.0.0", "@envelop/types": "^5.2.1", "@whatwg-node/promise-helpers": "^1.2.4", "tslib": "^2.5.0" } }, "sha512-3DQg8sFskDo386TkL5j12jyRAdip/8yzK3x7YGbZBgobZ4aKXrvDU0GppU0SnmrpQnNaiTUsxBs9LKkwQ/eyvw=="], @@ -878,17 +868,17 @@ "@graphql-hive/signal": ["@graphql-hive/signal@1.0.0", "", {}, "sha512-RiwLMc89lTjvyLEivZ/qxAC5nBHoS2CtsWFSOsN35sxG9zoo5Z+JsFHM8MlvmO9yt+MJNIyC5MLE1rsbOphlag=="], - "@graphql-tools/apollo-engine-loader": ["@graphql-tools/apollo-engine-loader@8.0.28", "", { "dependencies": { "@graphql-tools/utils": "^11.0.0", "@whatwg-node/fetch": "^0.10.13", "sync-fetch": "0.6.0", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-MzgDrUuoxp6dZeo54zLBL3cEJKJtM3N/2RqK0rbPxPq5X2z6TUA7EGg8vIFTUkt5xelAsUrm8/4ai41ZDdxOng=="], + "@graphql-tools/apollo-engine-loader": ["@graphql-tools/apollo-engine-loader@8.0.30", "", { "dependencies": { "@graphql-tools/utils": "^11.1.0", "@whatwg-node/fetch": "^0.10.13", "sync-fetch": "0.6.0", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-hUydKGGECrWloERMmfoMzHZi12X99AM9geCGF5XVsv4iMRl/Iyuet24th4kC9bZ8MlAdCwAwtUsCyv9uRfYwSA=="], "@graphql-tools/batch-execute": ["@graphql-tools/batch-execute@9.0.19", "", { "dependencies": { "@graphql-tools/utils": "^10.9.1", "@whatwg-node/promise-helpers": "^1.3.0", "dataloader": "^2.2.3", "tslib": "^2.8.1" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-VGamgY4PLzSx48IHPoblRw0oTaBa7S26RpZXt0Y4NN90ytoE0LutlpB2484RbkfcTjv9wa64QD474+YP1kEgGA=="], - "@graphql-tools/code-file-loader": ["@graphql-tools/code-file-loader@8.1.28", "", { "dependencies": { "@graphql-tools/graphql-tag-pluck": "8.3.27", "@graphql-tools/utils": "^11.0.0", "globby": "^11.0.3", "tslib": "^2.4.0", "unixify": "^1.0.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-BL3Ft/PFlXDE5nNuqA36hYci7Cx+8bDrPDc8X3VSpZy9iKFBY+oQ+IwqnEHCkt8OSp2n2V0gqTg4u3fcQP1Kwg=="], + "@graphql-tools/code-file-loader": ["@graphql-tools/code-file-loader@8.1.32", "", { "dependencies": { "@graphql-tools/graphql-tag-pluck": "8.3.31", "@graphql-tools/utils": "^11.1.0", "globby": "^11.0.3", "tslib": "^2.4.0", "unixify": "^1.0.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-gR5mNQjn0BugDL8a4A+ovS2KEvU52RNOGnbwiq9oWAEHiSv7iqJu77bpWARTzlE1ZFPK5MSQe9218+1t5PbXmQ=="], "@graphql-tools/delegate": ["@graphql-tools/delegate@10.2.23", "", { "dependencies": { "@graphql-tools/batch-execute": "^9.0.19", "@graphql-tools/executor": "^1.4.9", "@graphql-tools/schema": "^10.0.25", "@graphql-tools/utils": "^10.9.1", "@repeaterjs/repeater": "^3.0.6", "@whatwg-node/promise-helpers": "^1.3.0", "dataloader": "^2.2.3", "dset": "^3.1.2", "tslib": "^2.8.1" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-xrPtl7f1LxS+B6o+W7ueuQh67CwRkfl+UKJncaslnqYdkxKmNBB4wnzVcW8ZsRdwbsla/v43PtwAvSlzxCzq2w=="], "@graphql-tools/documents": ["@graphql-tools/documents@1.0.1", "", { "dependencies": { "lodash.sortby": "^4.7.0", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-aweoMH15wNJ8g7b2r4C4WRuJxZ0ca8HtNO54rkye/3duxTkW4fGBEutCx03jCIr5+a1l+4vFJNP859QnAVBVCA=="], - "@graphql-tools/executor": ["@graphql-tools/executor@1.5.1", "", { "dependencies": { "@graphql-tools/utils": "^11.0.0", "@graphql-typed-document-node/core": "^3.2.0", "@repeaterjs/repeater": "^3.0.4", "@whatwg-node/disposablestack": "^0.0.6", "@whatwg-node/promise-helpers": "^1.0.0", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-n94Qcu875Mji9GQ52n5UbgOTxlgvFJicBPYD+FRks9HKIQpdNPjkkrKZUYNG51XKa+bf03rxNflm4+wXhoHHrA=="], + "@graphql-tools/executor": ["@graphql-tools/executor@1.5.3", "", { "dependencies": { "@graphql-tools/utils": "^11.1.0", "@graphql-typed-document-node/core": "^3.2.0", "@repeaterjs/repeater": "^3.0.4", "@whatwg-node/disposablestack": "^0.0.6", "@whatwg-node/promise-helpers": "^1.0.0", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-mgBFC0bsrZPZLu9EnydpMnAuQ8Iiq0CEbUcsmvXsm2/iYektGHDN/+bmb7hicA6dWZtdPfklYJmr21WD0GnOfA=="], "@graphql-tools/executor-common": ["@graphql-tools/executor-common@0.0.4", "", { "dependencies": { "@envelop/core": "^5.2.3", "@graphql-tools/utils": "^10.8.1" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-SEH/OWR+sHbknqZyROCFHcRrbZeUAyjCsgpVWCRjqjqRbiJiXq6TxNIIOmpXgkrXWW/2Ev4Wms6YSGJXjdCs6Q=="], @@ -896,31 +886,31 @@ "@graphql-tools/executor-http": ["@graphql-tools/executor-http@1.3.3", "", { "dependencies": { "@graphql-hive/signal": "^1.0.0", "@graphql-tools/executor-common": "^0.0.4", "@graphql-tools/utils": "^10.8.1", "@repeaterjs/repeater": "^3.0.4", "@whatwg-node/disposablestack": "^0.0.6", "@whatwg-node/fetch": "^0.10.4", "@whatwg-node/promise-helpers": "^1.3.0", "meros": "^1.2.1", "tslib": "^2.8.1" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-LIy+l08/Ivl8f8sMiHW2ebyck59JzyzO/yF9SFS4NH6MJZUezA1xThUXCDIKhHiD56h/gPojbkpcFvM2CbNE7A=="], - "@graphql-tools/executor-legacy-ws": ["@graphql-tools/executor-legacy-ws@1.1.25", "", { "dependencies": { "@graphql-tools/utils": "^11.0.0", "@types/ws": "^8.0.0", "isomorphic-ws": "^5.0.0", "tslib": "^2.4.0", "ws": "^8.19.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-6uf4AEXO0QMxJ7AWKVPqEZXgYBJaiz5vf29X0boG8QtcqWy8mqkXKWLND2Swdx0SbEx0efoGFcjuKufUcB0ASQ=="], + "@graphql-tools/executor-legacy-ws": ["@graphql-tools/executor-legacy-ws@1.1.28", "", { "dependencies": { "@graphql-tools/utils": "^11.1.0", "@types/ws": "^8.0.0", "isomorphic-ws": "^5.0.0", "tslib": "^2.4.0", "ws": "^8.20.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-O4uj93GG9iUb3s32eyhUohvyfA8mLhN8FvGzEdK628hFQPhZN75yurtVFrR08DHex71mQ3wYCCFkErpwdJbDDQ=="], - "@graphql-tools/git-loader": ["@graphql-tools/git-loader@8.0.32", "", { "dependencies": { "@graphql-tools/graphql-tag-pluck": "8.3.27", "@graphql-tools/utils": "^11.0.0", "is-glob": "4.0.3", "micromatch": "^4.0.8", "tslib": "^2.4.0", "unixify": "^1.0.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-H5HTp2vevv0rRMEnCJBVmVF8md3LpJI1C1+d6OtzvmuONJ8mOX2mkf9rtoqwiztynVegaDUekvMFsc9k5iE2WA=="], + "@graphql-tools/git-loader": ["@graphql-tools/git-loader@8.0.36", "", { "dependencies": { "@graphql-tools/graphql-tag-pluck": "8.3.31", "@graphql-tools/utils": "^11.1.0", "is-glob": "4.0.3", "micromatch": "^4.0.8", "tslib": "^2.4.0", "unixify": "^1.0.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-PDDakesRu8FJYHJLf9/gkTweh8M19Bymz9i+vOlk9OTs9XmNcCqKM+1S610KX2AodvuBFz/xbesjTtTJIppLPg=="], "@graphql-tools/github-loader": ["@graphql-tools/github-loader@8.0.22", "", { "dependencies": { "@graphql-tools/executor-http": "^1.1.9", "@graphql-tools/graphql-tag-pluck": "^8.3.21", "@graphql-tools/utils": "^10.9.1", "@whatwg-node/fetch": "^0.10.0", "@whatwg-node/promise-helpers": "^1.0.0", "sync-fetch": "0.6.0-2", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-uQ4JNcNPsyMkTIgzeSbsoT9hogLjYrZooLUYd173l5eUGUi49EAcsGdiBCKaKfEjanv410FE8hjaHr7fjSRkJw=="], - "@graphql-tools/graphql-file-loader": ["@graphql-tools/graphql-file-loader@8.1.12", "", { "dependencies": { "@graphql-tools/import": "^7.1.12", "@graphql-tools/utils": "^11.0.0", "globby": "^11.0.3", "tslib": "^2.4.0", "unixify": "^1.0.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-Nma7gBgJoUbqXWTmdHjouo36tjzewA8MptVcHoH7widzkciaUVzBhriHzqICFB/dVxig//g9MX8s1XawZo7UAg=="], + "@graphql-tools/graphql-file-loader": ["@graphql-tools/graphql-file-loader@8.1.14", "", { "dependencies": { "@graphql-tools/import": "^7.1.14", "@graphql-tools/utils": "^11.1.0", "globby": "^11.0.3", "tslib": "^2.4.0", "unixify": "^1.0.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-CfAcsSEVkkHfEXLFzrd5rUYpcQEGWNV8lfc1Tb1p5m9HnYICzDDH08I5V33iMrEDza3GuujjjRBYqplBkqwIow=="], - "@graphql-tools/graphql-tag-pluck": ["@graphql-tools/graphql-tag-pluck@8.3.27", "", { "dependencies": { "@babel/core": "^7.26.10", "@babel/parser": "^7.26.10", "@babel/plugin-syntax-import-assertions": "^7.26.0", "@babel/traverse": "^7.26.10", "@babel/types": "^7.26.10", "@graphql-tools/utils": "^11.0.0", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-CJ0WVXhGYsfFngpRrAAcjRHyxSDHx4dEz2W15bkwvt9he/AWhuyXm07wuGcoLrl0q0iQp1BiRjU7D8SxWZo3JQ=="], + "@graphql-tools/graphql-tag-pluck": ["@graphql-tools/graphql-tag-pluck@8.3.31", "", { "dependencies": { "@babel/core": "^7.28.6", "@babel/parser": "^7.29.2", "@babel/plugin-syntax-import-assertions": "^7.26.0", "@babel/traverse": "^7.26.10", "@babel/types": "^7.26.10", "@graphql-tools/utils": "^11.1.0", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-ema2RRPZGj8TKruNElyDBHVCNFMxioGIVfLBuiA+GdfmRGt95b/i7Uksnj4EwItA6MCmhxokxZoa/fl6mJt3tw=="], - "@graphql-tools/import": ["@graphql-tools/import@7.1.12", "", { "dependencies": { "@graphql-tools/utils": "^11.0.0", "resolve-from": "5.0.0", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-QSsdPsdJ7yCgQ5XODyKYpC7NlB9R1Koi0R3418PT7GiRm+9O8gYXSs/23dumcOnpiLrnf4qR2aytBn1+JOAhnA=="], + "@graphql-tools/import": ["@graphql-tools/import@7.1.14", "", { "dependencies": { "@graphql-tools/utils": "^11.1.0", "resolve-from": "5.0.0", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-aqLcu04aEidszbXM6M0PWWL8bP17eX9sxXwjYWpglLvIRd4NFqb3C9QzBY8pleqXNMtWqXktlm9BQjevgSrirQ=="], - "@graphql-tools/json-file-loader": ["@graphql-tools/json-file-loader@8.0.26", "", { "dependencies": { "@graphql-tools/utils": "^11.0.0", "globby": "^11.0.3", "tslib": "^2.4.0", "unixify": "^1.0.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-kwy9IFi5QtXXTLBgWkvA1RqsZeJDn0CxsTbhNlziCzmga9fNo7qtZ18k9FYIq3EIoQQlok+b7W7yeyJATA2xhw=="], + "@graphql-tools/json-file-loader": ["@graphql-tools/json-file-loader@8.0.28", "", { "dependencies": { "@graphql-tools/utils": "^11.1.0", "globby": "^11.0.3", "tslib": "^2.4.0", "unixify": "^1.0.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-qgCsSkPArnjlNkcYpgGKiXxCTNkrAT9E+l1LhR+Por2jTlKBBeZ8stortkQ/PNDDjuL0WPrLQmHKhNPHabnB3A=="], - "@graphql-tools/load": ["@graphql-tools/load@8.1.8", "", { "dependencies": { "@graphql-tools/schema": "^10.0.31", "@graphql-tools/utils": "^11.0.0", "p-limit": "3.1.0", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-gxO662b64qZSToK3N6XUxWG5E6HOUjlg5jEnmGvD4bMtGJ0HwEe/BaVZbBQemCfLkxYjwRIBiVfOY9o0JyjZJg=="], + "@graphql-tools/load": ["@graphql-tools/load@8.1.10", "", { "dependencies": { "@graphql-tools/schema": "^10.0.33", "@graphql-tools/utils": "^11.1.0", "p-limit": "3.1.0", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-hjcvfEFtwtc8vGi46wtpmGWadNzfEhzbjqinyFIZuIZPlR4aYdWQtqWtY/RMM4Ew4t1USkMNm6xrqC2TH1vCSA=="], - "@graphql-tools/merge": ["@graphql-tools/merge@9.1.7", "", { "dependencies": { "@graphql-tools/utils": "^11.0.0", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-Y5E1vTbTabvcXbkakdFUt4zUIzB1fyaEnVmIWN0l0GMed2gdD01TpZWLUm4RNAxpturvolrb24oGLQrBbPLSoQ=="], + "@graphql-tools/merge": ["@graphql-tools/merge@9.1.9", "", { "dependencies": { "@graphql-tools/utils": "^11.1.0", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-iHUWNjRHeQRYdgIMIuChThOwoKzA9vrzYeslgfBo5eUYEyHGZCoDPjAavssoYXLwstYt1dZj2J22jSzc2DrN0Q=="], "@graphql-tools/optimize": ["@graphql-tools/optimize@2.0.0", "", { "dependencies": { "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-nhdT+CRGDZ+bk68ic+Jw1OZ99YCDIKYA5AlVAnBHJvMawSx9YQqQAIj4refNc1/LRieGiuWvhbG3jvPVYho0Dg=="], "@graphql-tools/prisma-loader": ["@graphql-tools/prisma-loader@8.0.17", "", { "dependencies": { "@graphql-tools/url-loader": "^8.0.15", "@graphql-tools/utils": "^10.5.6", "@types/js-yaml": "^4.0.0", "@whatwg-node/fetch": "^0.10.0", "chalk": "^4.1.0", "debug": "^4.3.1", "dotenv": "^16.0.0", "graphql-request": "^6.0.0", "http-proxy-agent": "^7.0.0", "https-proxy-agent": "^7.0.0", "jose": "^5.0.0", "js-yaml": "^4.0.0", "lodash": "^4.17.20", "scuid": "^1.1.0", "tslib": "^2.4.0", "yaml-ast-parser": "^0.0.43" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-fnuTLeQhqRbA156pAyzJYN0KxCjKYRU5bz1q/SKOwElSnAU4k7/G1kyVsWLh7fneY78LoMNH5n+KlFV8iQlnyg=="], - "@graphql-tools/relay-operation-optimizer": ["@graphql-tools/relay-operation-optimizer@7.1.1", "", { "dependencies": { "@ardatan/relay-compiler": "^13.0.0", "@graphql-tools/utils": "^11.0.0", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-va+ZieMlz6Fj18xUbwyQkZ34PsnzIdPT6Ccy1BNOQw1iclQwk52HejLMZeE/4fH+4cu80Q2HXi5+FjCKpmnJCg=="], + "@graphql-tools/relay-operation-optimizer": ["@graphql-tools/relay-operation-optimizer@7.1.4", "", { "dependencies": { "@ardatan/relay-compiler": "^13.0.1", "@graphql-tools/utils": "^11.1.0", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-cwOD/GEo/R//1uGCP0/urIxsMFoUgzkJVyMt9BDM2HhQhU6rSgH5l6lFukAFTJyPJVdyeOdYm2i0Jj5vYWbHTw=="], - "@graphql-tools/schema": ["@graphql-tools/schema@10.0.31", "", { "dependencies": { "@graphql-tools/merge": "^9.1.7", "@graphql-tools/utils": "^11.0.0", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-ZewRgWhXef6weZ0WiP7/MV47HXiuFbFpiDUVLQl6mgXsWSsGELKFxQsyUCBos60Qqy1JEFAIu3Ns6GGYjGkqkQ=="], + "@graphql-tools/schema": ["@graphql-tools/schema@10.0.33", "", { "dependencies": { "@graphql-tools/merge": "^9.1.9", "@graphql-tools/utils": "^11.1.0", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-O6P3RIftO0jafnSsFAqpjurUuUxJ43s/AdPVLQsBkI6y4Ic/tKm4C1Qm1KKQsCDTOxXPJClh/v3g7k7yLKCFBQ=="], "@graphql-tools/url-loader": ["@graphql-tools/url-loader@8.0.33", "", { "dependencies": { "@graphql-tools/executor-graphql-ws": "^2.0.1", "@graphql-tools/executor-http": "^1.1.9", "@graphql-tools/executor-legacy-ws": "^1.1.19", "@graphql-tools/utils": "^10.9.1", "@graphql-tools/wrap": "^10.0.16", "@types/ws": "^8.0.0", "@whatwg-node/fetch": "^0.10.0", "@whatwg-node/promise-helpers": "^1.0.0", "isomorphic-ws": "^5.0.0", "sync-fetch": "0.6.0-2", "tslib": "^2.4.0", "ws": "^8.17.1" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-Fu626qcNHcqAj8uYd7QRarcJn5XZ863kmxsg1sm0fyjyfBJnsvC7ddFt6Hayz5kxVKfsnjxiDfPMXanvsQVBKw=="], @@ -962,7 +952,7 @@ "@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.9", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" } }, "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ=="], - "@lit-labs/ssr-dom-shim": ["@lit-labs/ssr-dom-shim@1.5.1", "", {}, "sha512-Aou5UdlSpr5whQe8AA/bZG0jMj96CoJIWbGfZ91qieWu5AWUMKw8VR/pAkQkJYvBNhmCcWnZlyyk5oze8JIqYA=="], + "@lit-labs/ssr-dom-shim": ["@lit-labs/ssr-dom-shim@1.6.0", "", {}, "sha512-VHb0ALPMTlgKjM6yIxxoQNnpKyUKLD04VzeQdsiXkMqkvYlAHxq9glGLmgbb889/1GsohSOAjvQYoiBppXFqrQ=="], "@lit/react": ["@lit/react@1.0.8", "", { "peerDependencies": { "@types/react": "17 || 18 || 19" } }, "sha512-p2+YcF+JE67SRX3mMlJ1TKCSTsgyOVdAwd/nxp3NuV1+Cb6MWALbN6nT7Ld4tpmYofcE5kcaSY1YBB9erY+6fw=="], @@ -996,9 +986,7 @@ "@metamask/superstruct": ["@metamask/superstruct@3.2.1", "", {}, "sha512-fLgJnDOXFmuVlB38rUN5SmU7hAFQcCjrg3Vrxz67KTY7YHFnSNEKvX4avmEBdOI0yTCxZjwMCFEqsC8k2+Wd3g=="], - "@metamask/utils": ["@metamask/utils@11.10.0", "", { "dependencies": { "@ethereumjs/tx": "^4.2.0", "@metamask/superstruct": "^3.1.0", "@noble/hashes": "^1.3.1", "@scure/base": "^1.1.3", "@types/debug": "^4.1.7", "@types/lodash": "^4.17.20", "debug": "^4.3.4", "lodash": "^4.17.21", "pony-cause": "^2.1.10", "semver": "^7.5.4", "uuid": "^9.0.1" } }, "sha512-+bWmTOANx1MbBW6RFM8Se4ZoigFYGXiuIrkhjj4XnG5Aez8uWaTSZ76yn9srKKClv+PoEVoAuVtcUOogFEMUNA=="], - - "@monerium/sdk": ["@monerium/sdk@3.4.10", "", { "dependencies": { "crypto-js": "^4.2.0" } }, "sha512-WB9PS4D8DMiP2ufI2iTk5I5VbZFJFzJyEnltYl8crnn2SglJhW2i9PVu9hXUgrT5H5Q6MkaxU7eyuYLSRyCZXg=="], + "@metamask/utils": ["@metamask/utils@11.11.0", "", { "dependencies": { "@ethereumjs/tx": "^4.2.0", "@metamask/superstruct": "^3.1.0", "@noble/hashes": "^1.3.1", "@scure/base": "^1.1.3", "@types/debug": "^4.1.7", "@types/lodash": "^4.17.20", "debug": "^4.3.4", "lodash": "^4.17.21", "pony-cause": "^2.1.10", "semver": "^7.5.4", "uuid": "^9.0.1" } }, "sha512-0nF2CWjWQr/m0Y2t2lJnBTU1/CZPPTvKvcESLplyWe/tyeb8zFOi/FeneDmaFnML6LYRIGZU6f+xR0jKAIUZfw=="], "@mongodb-js/saslprep": ["@mongodb-js/saslprep@1.4.6", "", { "dependencies": { "sparse-bitfield": "^3.0.3" } }, "sha512-y+x3H1xBZd38n10NZF/rEBlvDOOMQ6LKUTHqr8R9VkJ+mmQOYtJFxIlkkK8fZrtOiL6VixbOBWMbZGBdal3Z1g=="], @@ -1056,7 +1044,7 @@ "@napi-rs/nice-win32-x64-msvc": ["@napi-rs/nice-win32-x64-msvc@1.1.1", "", { "os": "win32", "cpu": "x64" }, "sha512-vB+4G/jBQCAh0jelMTY3+kgFy00Hlx2f2/1zjMoH821IbplbWZOkLiTYXQkygNTzQJTq5cvwBDgn2ppHD+bglQ=="], - "@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.1.1", "", { "dependencies": { "@emnapi/core": "^1.7.1", "@emnapi/runtime": "^1.7.1", "@tybys/wasm-util": "^0.10.1" } }, "sha512-p64ah1M1ld8xjWv3qbvFwHiFVWrq1yFvV4f7w+mzaqiR4IlSgkqhcRdHwsGgomwzBH51sRY4NEowLxnaBjcW/A=="], + "@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.1.4", "", { "dependencies": { "@tybys/wasm-util": "^0.10.1" }, "peerDependencies": { "@emnapi/core": "^1.7.1", "@emnapi/runtime": "^1.7.1" } }, "sha512-3NQNNgA1YSlJb/kMH1ildASP9HW7/7kYnRI2szWJaofaS1hWmbGI4H+d3+22aGzXXN9IJ+n+GiFVcGipJP18ow=="], "@noble/ciphers": ["@noble/ciphers@1.3.0", "", {}, "sha512-2I0gnIVPtfnMw9ee9h1dJG7tp81+8Ob3OJb3Mv37rx5L40/b0i7djjCVvGOVqc9AEIQyvyu1i6ypKdFw8R8gQw=="], @@ -1066,6 +1054,8 @@ "@noble/secp256k1": ["@noble/secp256k1@1.7.1", "", {}, "sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw=="], + "@nodable/entities": ["@nodable/entities@2.1.0", "", {}, "sha512-nyT7T3nbMyBI/lvr6L5TyWbFJAI9FTgVRakNoBqCD+PmID8DzFrrNdLLtHMwMszOtqZa8PAOV24ZqDnQrhQINA=="], + "@nodelib/fs.scandir": ["@nodelib/fs.scandir@2.1.5", "", { "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" } }, "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g=="], "@nodelib/fs.stat": ["@nodelib/fs.stat@2.0.5", "", {}, "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A=="], @@ -1186,7 +1176,9 @@ "@paulmillr/qr": ["@paulmillr/qr@0.2.1", "", {}, "sha512-IHnV6A+zxU7XwmKFinmYjUcwlyK9+xkG3/s9KcQhI9BjQKycrJ1JRO+FbNYPwZiPKW3je/DR0k7w8/gLa5eaxQ=="], - "@peculiar/asn1-schema": ["@peculiar/asn1-schema@2.6.0", "", { "dependencies": { "asn1js": "^3.0.6", "pvtsutils": "^1.3.6", "tslib": "^2.8.1" } }, "sha512-xNLYLBFTBKkCzEZIw842BxytQQATQv+lDTCEMZ8C196iJcJJMBUZxrhSTxLaohMyKK8QlzRNTRkUmanucnDSqg=="], + "@peculiar/asn1-schema": ["@peculiar/asn1-schema@2.7.0", "", { "dependencies": { "@peculiar/utils": "^2.0.2", "asn1js": "^3.0.6", "tslib": "^2.8.1" } }, "sha512-W8ZfWzLmQnrcky+eh3tni4IozMdqBDiHWU0N+vve/UGjMaUs8c0L7A2oEdkBXS8rTpWDpK/aoI3DG/L/hxmxPg=="], + + "@peculiar/utils": ["@peculiar/utils@2.0.3", "", { "dependencies": { "tslib": "^2.8.1" } }, "sha512-+oL3HPFRIZ1St2K50lWCXiioIgSoxzz7R1J3uF6neO2yl1sgmpgY6XXJH4BdpoDkMWznQTeYF6oWNDZLCdQ4eQ=="], "@pendulum-chain/api": ["@pendulum-chain/api@1.1.1", "", { "dependencies": { "@babel/runtime": "^7.10.2", "@open-web3/orml-api-derive": "^1.1.4", "@pendulum-chain/api-derive": "1.1.1", "@pendulum-chain/types": "^1.1.1", "@polkadot/api": "^13.2.1" }, "peerDependencies": { "@polkadot/types": ">=9" } }, "sha512-YH9UVzUT345StJ2CATpehpIktbWKWNEfqUGRjoZOLdr98nP0wf/KLeqv12shuicZmdWbn4l9A1ZU8fcHePtDrw=="], @@ -1402,25 +1394,25 @@ "@radix-ui/rect": ["@radix-ui/rect@1.1.1", "", {}, "sha512-HPwpGIzkl28mWyZqG52jiqDJ12waP11Pa1lGoiyUkIEuMLBP0oeK/C89esbXrxsky5we7dfd8U58nm0SgAWpVw=="], - "@reown/appkit": ["@reown/appkit@1.8.19", "", { "dependencies": { "@reown/appkit-common": "1.8.19", "@reown/appkit-controllers": "1.8.19", "@reown/appkit-pay": "1.8.19", "@reown/appkit-polyfills": "1.8.19", "@reown/appkit-scaffold-ui": "1.8.19", "@reown/appkit-ui": "1.8.19", "@reown/appkit-utils": "1.8.19", "@reown/appkit-wallet": "1.8.19", "@walletconnect/universal-provider": "2.23.7", "bs58": "6.0.0", "semver": "7.7.2", "valtio": "2.1.7", "viem": ">=2.45.0" }, "optionalDependencies": { "@lit/react": "1.0.8" } }, "sha512-wB+xatkRbOy0AY1cZxxtcKzzPk3l3CTFulDbaISLVmZI6ZnQrOFuLnYc285zGsC6DB4d6bmwYUh89zcMLa4PvQ=="], + "@reown/appkit": ["@reown/appkit@1.8.20", "", { "dependencies": { "@reown/appkit-common": "1.8.20", "@reown/appkit-controllers": "1.8.20", "@reown/appkit-pay": "1.8.20", "@reown/appkit-polyfills": "1.8.20", "@reown/appkit-scaffold-ui": "1.8.20", "@reown/appkit-ui": "1.8.20", "@reown/appkit-utils": "1.8.20", "@reown/appkit-wallet": "1.8.20", "@walletconnect/universal-provider": "2.23.7", "bs58": "6.0.0", "semver": "7.7.2", "valtio": "2.1.7", "viem": ">=2.45.0" }, "optionalDependencies": { "@lit/react": "1.0.8" } }, "sha512-+OI1TWg3XcMRhZ5RGVF0+AjkUvTPpODP6HFIgmxsV8HCf6bfE+jaYYE+JJcaz05TYJJ2TCXSYDyRfRvjSUzMzg=="], - "@reown/appkit-adapter-wagmi": ["@reown/appkit-adapter-wagmi@1.8.19", "", { "dependencies": { "@reown/appkit": "1.8.19", "@reown/appkit-common": "1.8.19", "@reown/appkit-controllers": "1.8.19", "@reown/appkit-polyfills": "1.8.19", "@reown/appkit-scaffold-ui": "1.8.19", "@reown/appkit-utils": "1.8.19", "@reown/appkit-wallet": "1.8.19", "@walletconnect/universal-provider": "2.23.7", "valtio": "2.1.7" }, "optionalDependencies": { "@wagmi/connectors": ">=5.9.9" }, "peerDependencies": { "@wagmi/core": ">=2.21.2", "viem": ">=2.45.0", "wagmi": ">=2.19.5" } }, "sha512-KY2sbIXJDLlUVBAKdHBQ8KT8aQY67rWwW9aIz4XthRIt8WCjZQBEf4JGy/kd0LwRS78XSSpZcxDxEBarMPLpaA=="], + "@reown/appkit-adapter-wagmi": ["@reown/appkit-adapter-wagmi@1.8.20", "", { "dependencies": { "@reown/appkit": "1.8.20", "@reown/appkit-common": "1.8.20", "@reown/appkit-controllers": "1.8.20", "@reown/appkit-polyfills": "1.8.20", "@reown/appkit-scaffold-ui": "1.8.20", "@reown/appkit-utils": "1.8.20", "@reown/appkit-wallet": "1.8.20", "@walletconnect/universal-provider": "2.23.7", "valtio": "2.1.7" }, "optionalDependencies": { "@wagmi/connectors": ">=5.9.9" }, "peerDependencies": { "@wagmi/core": ">=2.21.2", "viem": ">=2.45.0", "wagmi": ">=2.19.5" } }, "sha512-HVCOyYrW5NYjj2BtdAaOabrC7q2GkdpsQ9KviwD+dvZhBu0rM0/SdD36WbLVTjezJLKS2/3/WfKbl5rdqvKpZw=="], - "@reown/appkit-common": ["@reown/appkit-common@1.8.19", "", { "dependencies": { "big.js": "6.2.2", "dayjs": "1.11.13", "viem": ">=2.45.0" } }, "sha512-z5wDrYjUGY7YbM4b14NHVo54WKZ5++PQtGkcsXhiOP39yAVijubBQD8BfHs/Pu2fSFqnqLIFoCVvIEfNWWccRw=="], + "@reown/appkit-common": ["@reown/appkit-common@1.8.20", "", { "dependencies": { "big.js": "6.2.2", "dayjs": "1.11.13", "viem": ">=2.45.0" } }, "sha512-x6Yc8FaZZaEnsRCu6crYD/s1MA+Ffk35rJNZpug8I26iAJgi+o3rar/0lwZ70dl/QA9ytnwFUFWzhXqkT3O7Og=="], - "@reown/appkit-controllers": ["@reown/appkit-controllers@1.8.19", "", { "dependencies": { "@reown/appkit-common": "1.8.19", "@reown/appkit-wallet": "1.8.19", "@walletconnect/universal-provider": "2.23.7", "valtio": "2.1.7", "viem": ">=2.45.0" } }, "sha512-JFNT8CfAVit9FJXh596Ye4U8A/oIapW+Y0KQqjB59DXyTCDZbxZDB32rULBQrSkZ6PufTEa239Dil4kABCQKtg=="], + "@reown/appkit-controllers": ["@reown/appkit-controllers@1.8.20", "", { "dependencies": { "@reown/appkit-common": "1.8.20", "@reown/appkit-wallet": "1.8.20", "@walletconnect/universal-provider": "2.23.7", "valtio": "2.1.7", "viem": ">=2.45.0" } }, "sha512-2Gdi/ScftfBK3MwfAJcf/bGRByHgHzaAK8rCzKrYYUqLjbRFR9I/uq7gd6D+w4Xm+NRCpdiKFJY/0zPSfq+gpw=="], - "@reown/appkit-pay": ["@reown/appkit-pay@1.8.19", "", { "dependencies": { "@reown/appkit-common": "1.8.19", "@reown/appkit-controllers": "1.8.19", "@reown/appkit-ui": "1.8.19", "@reown/appkit-utils": "1.8.19", "lit": "3.3.0", "valtio": "2.1.7" } }, "sha512-HO/tQT0TbTQO3eONxNNPJAOZAOzUiHvjM0Mty1rFFeRBH68auiqQxQi2YFNMs014gNkRN+cb84VYau7+MCC0fQ=="], + "@reown/appkit-pay": ["@reown/appkit-pay@1.8.20", "", { "dependencies": { "@reown/appkit-common": "1.8.20", "@reown/appkit-controllers": "1.8.20", "@reown/appkit-ui": "1.8.20", "@reown/appkit-utils": "1.8.20", "lit": "3.3.0", "valtio": "2.1.7" } }, "sha512-JEoTVetCWNFJnbkYGtwvdWa7ZW7xF0uOH+jmJvnAbYSXTR+Bd8HdQOMn/AoWulSu6qmjKjNpZQmNjkIUf5yiUw=="], - "@reown/appkit-polyfills": ["@reown/appkit-polyfills@1.8.19", "", { "dependencies": { "buffer": "6.0.3" } }, "sha512-PSoetRSuZg7f2YFPzdfs4BayQl51zcGqYr7frwOe6td0XEsspLrrVFn/zk5QFbFHZVsMdfRZ+TTunt84ozRdnQ=="], + "@reown/appkit-polyfills": ["@reown/appkit-polyfills@1.8.20", "", { "dependencies": { "buffer": "6.0.3" } }, "sha512-88qJedSBYkhCZxeyODcQhqKt45OkS28VbZGNsay6t7FexvPcoibYMtkHaP79ojE8OuhV7k3FlrssrjPES3OFCw=="], - "@reown/appkit-scaffold-ui": ["@reown/appkit-scaffold-ui@1.8.19", "", { "dependencies": { "@reown/appkit-common": "1.8.19", "@reown/appkit-controllers": "1.8.19", "@reown/appkit-pay": "1.8.19", "@reown/appkit-ui": "1.8.19", "@reown/appkit-utils": "1.8.19", "@reown/appkit-wallet": "1.8.19", "lit": "3.3.0" } }, "sha512-Ak767x0VzeDIXb0wbzkl19kx6udw7vkb1EU0SAweG3iKc9BunW87Rfcd48/YimzMZycJaYmlbtfmqQQDYs6Few=="], + "@reown/appkit-scaffold-ui": ["@reown/appkit-scaffold-ui@1.8.20", "", { "dependencies": { "@reown/appkit-common": "1.8.20", "@reown/appkit-controllers": "1.8.20", "@reown/appkit-pay": "1.8.20", "@reown/appkit-ui": "1.8.20", "@reown/appkit-utils": "1.8.20", "@reown/appkit-wallet": "1.8.20", "lit": "3.3.0" } }, "sha512-Vx0qib30UUbcKT8VeNcCcZkkhtaOT28TtClQ8nKC0EdOkLA08Lxt0j32XpEat2c4Fl6xzAIIOuZO7HRBTxMfzA=="], - "@reown/appkit-ui": ["@reown/appkit-ui@1.8.19", "", { "dependencies": { "@phosphor-icons/webcomponents": "2.1.5", "@reown/appkit-common": "1.8.19", "@reown/appkit-controllers": "1.8.19", "@reown/appkit-wallet": "1.8.19", "lit": "3.3.0", "qrcode": "1.5.3" } }, "sha512-fCAwW8yyyC3JcgKLBPvCtYuDGC4H8anO7u4LTaAXGEzdcU5H+IrCgNFSPNK7NuTSmgXm1TnoYxPxRFKNiNwFdA=="], + "@reown/appkit-ui": ["@reown/appkit-ui@1.8.20", "", { "dependencies": { "@phosphor-icons/webcomponents": "2.1.5", "@reown/appkit-common": "1.8.20", "@reown/appkit-controllers": "1.8.20", "@reown/appkit-wallet": "1.8.20", "lit": "3.3.0", "qrcode": "1.5.3" } }, "sha512-ObWhgu+4capnVhxtEG0VMRtGHwr6bso9VUcxDIfUDpjNAMi1HQBvXiBJ/R098Gvjmjz0QLwNe8YNVe50KaCTVw=="], - "@reown/appkit-utils": ["@reown/appkit-utils@1.8.19", "", { "dependencies": { "@reown/appkit-common": "1.8.19", "@reown/appkit-controllers": "1.8.19", "@reown/appkit-polyfills": "1.8.19", "@reown/appkit-wallet": "1.8.19", "@wallet-standard/wallet": "1.1.0", "@walletconnect/logger": "3.0.2", "@walletconnect/universal-provider": "2.23.7", "valtio": "2.1.7", "viem": ">=2.45.0" }, "optionalDependencies": { "@base-org/account": "2.4.0", "@safe-global/safe-apps-provider": "0.18.6", "@safe-global/safe-apps-sdk": "9.1.0" } }, "sha512-VQPgUMTFqoh4UD3EDZSw9wyMkyZsmIVmu8CdQ2FUxIuqYW4fLd0VIpkDeO64MMhSv8b0X8Vd6m4+eGcqSwlUAg=="], + "@reown/appkit-utils": ["@reown/appkit-utils@1.8.20", "", { "dependencies": { "@reown/appkit-common": "1.8.20", "@reown/appkit-controllers": "1.8.20", "@reown/appkit-polyfills": "1.8.20", "@reown/appkit-wallet": "1.8.20", "@wallet-standard/wallet": "1.1.0", "@walletconnect/logger": "3.0.2", "@walletconnect/universal-provider": "2.23.7", "valtio": "2.1.7", "viem": ">=2.45.0" }, "optionalDependencies": { "@base-org/account": "2.4.0", "@coinbase/wallet-sdk": "4.3.6", "@safe-global/safe-apps-provider": "0.18.6", "@safe-global/safe-apps-sdk": "9.1.0" } }, "sha512-ZVPUhZm/8TbR5MI1GzhazpUShrjVhZCC8Fyc7m+VXSPVZkPiW7K2AtTDAqhfYeStvBSJIvC6jbKwhlaWGR1TDQ=="], - "@reown/appkit-wallet": ["@reown/appkit-wallet@1.8.19", "", { "dependencies": { "@reown/appkit-common": "1.8.19", "@reown/appkit-polyfills": "1.8.19", "@walletconnect/logger": "3.0.2", "zod": "3.22.4" } }, "sha512-NVdIKceUhkXYtsG32925ctmVn0QJFNyDlr+mWheMLCEZ/IUPn+6aA53vTVaSUquhyeFxUXtrCOh3ln6v1tup5w=="], + "@reown/appkit-wallet": ["@reown/appkit-wallet@1.8.20", "", { "dependencies": { "@reown/appkit-common": "1.8.20", "@reown/appkit-polyfills": "1.8.20", "@walletconnect/logger": "3.0.2", "zod": "3.22.4" } }, "sha512-fEYnCQTQFSi8qtGfdQp7BHAVD8yiijPgjXhel0jFLKTX5leufGKjrERtnn2vABoUHQucwQzI+Q958Bnx/lHE2w=="], "@repeaterjs/repeater": ["@repeaterjs/repeater@3.0.6", "", {}, "sha512-Javneu5lsuhwNCryN+pXH93VPQ8g0dBX7wItHFgYiwQmzE1sVdg5tWHiOgHywzL2W21XQopa7IwIEnNbmeUJYA=="], @@ -1430,71 +1422,71 @@ "@rollup/pluginutils": ["@rollup/pluginutils@5.3.0", "", { "dependencies": { "@types/estree": "^1.0.0", "estree-walker": "^2.0.2", "picomatch": "^4.0.2" }, "peerDependencies": { "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" }, "optionalPeers": ["rollup"] }, "sha512-5EdhGZtnu3V88ces7s53hhfK5KSASnJZv8Lulpc04cWO3REESroJXg73DFsOmgbU2BhwV0E20bu2IDZb3VKW4Q=="], - "@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.60.0", "", { "os": "android", "cpu": "arm" }, "sha512-WOhNW9K8bR3kf4zLxbfg6Pxu2ybOUbB2AjMDHSQx86LIF4rH4Ft7vmMwNt0loO0eonglSNy4cpD3MKXXKQu0/A=="], + "@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.60.4", "", { "os": "android", "cpu": "arm" }, "sha512-F5QXMSiFebS9hKZj02XhWLLnRpJ3B3AROP0tWbFBSj+6kCbg5m9j5JoHKd4mmSVy5mS/IMQloYgYxCuJC0fxEQ=="], - "@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.60.0", "", { "os": "android", "cpu": "arm64" }, "sha512-u6JHLll5QKRvjciE78bQXDmqRqNs5M/3GVqZeMwvmjaNODJih/WIrJlFVEihvV0MiYFmd+ZyPr9wxOVbPAG2Iw=="], + "@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.60.4", "", { "os": "android", "cpu": "arm64" }, "sha512-GxxTKApUpzRhof7poWvCJHRF51C67u1R7D6DiluBE8wKU1u5GWE8t+v81JvJYtbawoBFX1hLv5Ei4eVjkWokaw=="], - "@rollup/rollup-darwin-arm64": ["@rollup/rollup-darwin-arm64@4.60.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-qEF7CsKKzSRc20Ciu2Zw1wRrBz4g56F7r/vRwY430UPp/nt1x21Q/fpJ9N5l47WWvJlkNCPJz3QRVw008fi7yA=="], + "@rollup/rollup-darwin-arm64": ["@rollup/rollup-darwin-arm64@4.60.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-tua0TaJxMOB1R0V0RS1jFZ/RpURFDJIOR2A6jWwQeawuFyS4gBW+rntLRaQd0EQ4bd6Vp44Z2rXW+YYDBsj6IA=="], - "@rollup/rollup-darwin-x64": ["@rollup/rollup-darwin-x64@4.60.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-WADYozJ4QCnXCH4wPB+3FuGmDPoFseVCUrANmA5LWwGmC6FL14BWC7pcq+FstOZv3baGX65tZ378uT6WG8ynTw=="], + "@rollup/rollup-darwin-x64": ["@rollup/rollup-darwin-x64@4.60.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-CSKq7MsP+5PFIcydhAiR1K0UhEI1A2jWXVKHPCBZ151yOutENwvnPocgVHkivu2kviURtCEB6zUQw0vs8RrhMg=="], - "@rollup/rollup-freebsd-arm64": ["@rollup/rollup-freebsd-arm64@4.60.0", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-6b8wGHJlDrGeSE3aH5mGNHBjA0TTkxdoNHik5EkvPHCt351XnigA4pS7Wsj/Eo9Y8RBU6f35cjN9SYmCFBtzxw=="], + "@rollup/rollup-freebsd-arm64": ["@rollup/rollup-freebsd-arm64@4.60.4", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-+O8OkVdyvXMtJEciu2wS/pzm1IxntEEQx3z5TAVy4l32G0etZn+RsA48ARRrFm6Ri8fvqPQfgrvNxSjKAbnd3g=="], - "@rollup/rollup-freebsd-x64": ["@rollup/rollup-freebsd-x64@4.60.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-h25Ga0t4jaylMB8M/JKAyrvvfxGRjnPQIR8lnCayyzEjEOx2EJIlIiMbhpWxDRKGKF8jbNH01NnN663dH638mA=="], + "@rollup/rollup-freebsd-x64": ["@rollup/rollup-freebsd-x64@4.60.4", "", { "os": "freebsd", "cpu": "x64" }, "sha512-Iw3oMskH3AfNuhU0MSN7vNbdi4me/NiYo2azqPz/Le16zHSa+3RRmliCMWWQmh4lcndccU40xcJuTYJZxNo/lw=="], - "@rollup/rollup-linux-arm-gnueabihf": ["@rollup/rollup-linux-arm-gnueabihf@4.60.0", "", { "os": "linux", "cpu": "arm" }, "sha512-RzeBwv0B3qtVBWtcuABtSuCzToo2IEAIQrcyB/b2zMvBWVbjo8bZDjACUpnaafaxhTw2W+imQbP2BD1usasK4g=="], + "@rollup/rollup-linux-arm-gnueabihf": ["@rollup/rollup-linux-arm-gnueabihf@4.60.4", "", { "os": "linux", "cpu": "arm" }, "sha512-EIPRXTVQpHyF8WOo219AD2yEltPehLTcTMz2fn6JsatLYSzQf00hj3rulF+yauOlF9/FtM2WpkT/hJh/KJFGhA=="], - "@rollup/rollup-linux-arm-musleabihf": ["@rollup/rollup-linux-arm-musleabihf@4.60.0", "", { "os": "linux", "cpu": "arm" }, "sha512-Sf7zusNI2CIU1HLzuu9Tc5YGAHEZs5Lu7N1ssJG4Tkw6e0MEsN7NdjUDDfGNHy2IU+ENyWT+L2obgWiguWibWQ=="], + "@rollup/rollup-linux-arm-musleabihf": ["@rollup/rollup-linux-arm-musleabihf@4.60.4", "", { "os": "linux", "cpu": "arm" }, "sha512-J3Yh9PzzF1Ovah2At+lHiGQdsYgArxBbXv/zHfSyaiFQEqvNv7DcW98pCrmdjCZBrqBiKrKKe2V+aaSGWuBe/w=="], - "@rollup/rollup-linux-arm64-gnu": ["@rollup/rollup-linux-arm64-gnu@4.60.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-DX2x7CMcrJzsE91q7/O02IJQ5/aLkVtYFryqCjduJhUfGKG6yJV8hxaw8pZa93lLEpPTP/ohdN4wFz7yp/ry9A=="], + "@rollup/rollup-linux-arm64-gnu": ["@rollup/rollup-linux-arm64-gnu@4.60.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-BFDEZMYfUvLn37ONE1yMBojPxnMlTFsdyNoqncT0qFq1mAfllL+ATMMJd8TeuVMiX84s1KbcxcZbXInmcO2mRg=="], - "@rollup/rollup-linux-arm64-musl": ["@rollup/rollup-linux-arm64-musl@4.60.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-09EL+yFVbJZlhcQfShpswwRZ0Rg+z/CsSELFCnPt3iK+iqwGsI4zht3secj5vLEs957QvFFXnzAT0FFPIxSrkQ=="], + "@rollup/rollup-linux-arm64-musl": ["@rollup/rollup-linux-arm64-musl@4.60.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-pc9EYOSlOgdQ2uPl1o9PF6/kLSgaUosia7gOuS8mB69IxJvlclko1MECXysjs5ryez1/5zjYqx3+xYU0TU6R1A=="], - "@rollup/rollup-linux-loong64-gnu": ["@rollup/rollup-linux-loong64-gnu@4.60.0", "", { "os": "linux", "cpu": "none" }, "sha512-i9IcCMPr3EXm8EQg5jnja0Zyc1iFxJjZWlb4wr7U2Wx/GrddOuEafxRdMPRYVaXjgbhvqalp6np07hN1w9kAKw=="], + "@rollup/rollup-linux-loong64-gnu": ["@rollup/rollup-linux-loong64-gnu@4.60.4", "", { "os": "linux", "cpu": "none" }, "sha512-NxnomyxYerDh5n4iLrNa+sH+Z+U4BMEE46V2PgQ/hoB909i8gV1M5wPojWg9fk1jWpO3IQnOs20K4wyZuFLEFQ=="], - "@rollup/rollup-linux-loong64-musl": ["@rollup/rollup-linux-loong64-musl@4.60.0", "", { "os": "linux", "cpu": "none" }, "sha512-DGzdJK9kyJ+B78MCkWeGnpXJ91tK/iKA6HwHxF4TAlPIY7GXEvMe8hBFRgdrR9Ly4qebR/7gfUs9y2IoaVEyog=="], + "@rollup/rollup-linux-loong64-musl": ["@rollup/rollup-linux-loong64-musl@4.60.4", "", { "os": "linux", "cpu": "none" }, "sha512-nbJnQ8a3z1mtmrwImCYhc6BGpThAyYVRQxw9uKSKG4wR6aAYno9sVjJ0zaZcW9BPJX1GbrDPf+SvdWjgTuDmnw=="], - "@rollup/rollup-linux-ppc64-gnu": ["@rollup/rollup-linux-ppc64-gnu@4.60.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-RwpnLsqC8qbS8z1H1AxBA1H6qknR4YpPR9w2XX0vo2Sz10miu57PkNcnHVaZkbqyw/kUWfKMI73jhmfi9BRMUQ=="], + "@rollup/rollup-linux-ppc64-gnu": ["@rollup/rollup-linux-ppc64-gnu@4.60.4", "", { "os": "linux", "cpu": "ppc64" }, "sha512-2EU6acNrQLd8tYvo/LXW535wupT3m6fo7HKo6lr7ktQoItxTyOL1ZCR/GfGCuXl2vR+zmfI6eRXkSemafv+iVg=="], - "@rollup/rollup-linux-ppc64-musl": ["@rollup/rollup-linux-ppc64-musl@4.60.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-Z8pPf54Ly3aqtdWC3G4rFigZgNvd+qJlOE52fmko3KST9SoGfAdSRCwyoyG05q1HrrAblLbk1/PSIV+80/pxLg=="], + "@rollup/rollup-linux-ppc64-musl": ["@rollup/rollup-linux-ppc64-musl@4.60.4", "", { "os": "linux", "cpu": "ppc64" }, "sha512-WeBtoMuaMxiiIrO2IYP3xs6GMWkJP2C0EoT8beTLkUPmzV1i/UcOSVw1d5r9KBODtHKilG5yFxsGRnBbK3wJ4A=="], - "@rollup/rollup-linux-riscv64-gnu": ["@rollup/rollup-linux-riscv64-gnu@4.60.0", "", { "os": "linux", "cpu": "none" }, "sha512-3a3qQustp3COCGvnP4SvrMHnPQ9d1vzCakQVRTliaz8cIp/wULGjiGpbcqrkv0WrHTEp8bQD/B3HBjzujVWLOA=="], + "@rollup/rollup-linux-riscv64-gnu": ["@rollup/rollup-linux-riscv64-gnu@4.60.4", "", { "os": "linux", "cpu": "none" }, "sha512-FJHFfqpKUI3A10WrWKiFbBZ7yVbGT4q4B5o1qKFFojqpaYoh9LrQgqWCmmcxQzVSXYtyB5bzkXrYzlHTs21MYA=="], - "@rollup/rollup-linux-riscv64-musl": ["@rollup/rollup-linux-riscv64-musl@4.60.0", "", { "os": "linux", "cpu": "none" }, "sha512-pjZDsVH/1VsghMJ2/kAaxt6dL0psT6ZexQVrijczOf+PeP2BUqTHYejk3l6TlPRydggINOeNRhvpLa0AYpCWSQ=="], + "@rollup/rollup-linux-riscv64-musl": ["@rollup/rollup-linux-riscv64-musl@4.60.4", "", { "os": "linux", "cpu": "none" }, "sha512-mcEl6CUT5IAUmQf1m9FYSmVqCJlpQ8r8eyftFUHG8i9OhY7BkBXSUdnLH5DOf0wCOjcP9v/QO93zpmF1SptCCw=="], - "@rollup/rollup-linux-s390x-gnu": ["@rollup/rollup-linux-s390x-gnu@4.60.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-3ObQs0BhvPgiUVZrN7gqCSvmFuMWvWvsjG5ayJ3Lraqv+2KhOsp+pUbigqbeWqueGIsnn+09HBw27rJ+gYK4VQ=="], + "@rollup/rollup-linux-s390x-gnu": ["@rollup/rollup-linux-s390x-gnu@4.60.4", "", { "os": "linux", "cpu": "s390x" }, "sha512-ynt3JxVd2w2buzoKDWIyiV1pJW93xlQic1THVLXilz429oijRpSHivZAgp65KBu+cMcgf1eVVjdnTLvPxgCuoQ=="], - "@rollup/rollup-linux-x64-gnu": ["@rollup/rollup-linux-x64-gnu@4.60.0", "", { "os": "linux", "cpu": "x64" }, "sha512-EtylprDtQPdS5rXvAayrNDYoJhIz1/vzN2fEubo3yLE7tfAw+948dO0g4M0vkTVFhKojnF+n6C8bDNe+gDRdTg=="], + "@rollup/rollup-linux-x64-gnu": ["@rollup/rollup-linux-x64-gnu@4.60.4", "", { "os": "linux", "cpu": "x64" }, "sha512-Boiz5+MsaROEWDf+GGEwF8VMHGhlUoQMtIPjOgA5fv4osupqTVnJteQNKJwUcnUog2G55jYXH7KZFFiJe0TEzQ=="], - "@rollup/rollup-linux-x64-musl": ["@rollup/rollup-linux-x64-musl@4.60.0", "", { "os": "linux", "cpu": "x64" }, "sha512-k09oiRCi/bHU9UVFqD17r3eJR9bn03TyKraCrlz5ULFJGdJGi7VOmm9jl44vOJvRJ6P7WuBi/s2A97LxxHGIdw=="], + "@rollup/rollup-linux-x64-musl": ["@rollup/rollup-linux-x64-musl@4.60.4", "", { "os": "linux", "cpu": "x64" }, "sha512-+qfSY27qIrFfI/Hom04KYFw3GKZSGU4lXus51wsb5EuySfFlWRwjkKWoE9emgRw/ukoT4Udsj4W/+xxG8VbPKg=="], - "@rollup/rollup-openbsd-x64": ["@rollup/rollup-openbsd-x64@4.60.0", "", { "os": "openbsd", "cpu": "x64" }, "sha512-1o/0/pIhozoSaDJoDcec+IVLbnRtQmHwPV730+AOD29lHEEo4F5BEUB24H0OBdhbBBDwIOSuf7vgg0Ywxdfiiw=="], + "@rollup/rollup-openbsd-x64": ["@rollup/rollup-openbsd-x64@4.60.4", "", { "os": "openbsd", "cpu": "x64" }, "sha512-VpTfOPHgVXEBeeR8hZ2O0F3aSso+JDWqTWmTmzcQKted54IAdUVbxE+j/MVxUsKa8L20HJhv3vUezVPoquqWjA=="], - "@rollup/rollup-openharmony-arm64": ["@rollup/rollup-openharmony-arm64@4.60.0", "", { "os": "none", "cpu": "arm64" }, "sha512-pESDkos/PDzYwtyzB5p/UoNU/8fJo68vcXM9ZW2V0kjYayj1KaaUfi1NmTUTUpMn4UhU4gTuK8gIaFO4UGuMbA=="], + "@rollup/rollup-openharmony-arm64": ["@rollup/rollup-openharmony-arm64@4.60.4", "", { "os": "none", "cpu": "arm64" }, "sha512-IPOsh5aRYuLv/nkU51X10Bf75Bsf6+gZdx1X+QP5QM6lIJFHHqbHLG0uJn/hWthzo13UAc2umiUorqZy3axoZg=="], - "@rollup/rollup-win32-arm64-msvc": ["@rollup/rollup-win32-arm64-msvc@4.60.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-hj1wFStD7B1YBeYmvY+lWXZ7ey73YGPcViMShYikqKT1GtstIKQAtfUI6yrzPjAy/O7pO0VLXGmUVWXQMaYgTQ=="], + "@rollup/rollup-win32-arm64-msvc": ["@rollup/rollup-win32-arm64-msvc@4.60.4", "", { "os": "win32", "cpu": "arm64" }, "sha512-4QzE9E81OohJ/HKzHhsqU+zcYYojVOXlFMs1DdyMT6qXl/niOH7AVElmmEdUNHHS/oRkc++d5k6Vy85zFs0DEw=="], - "@rollup/rollup-win32-ia32-msvc": ["@rollup/rollup-win32-ia32-msvc@4.60.0", "", { "os": "win32", "cpu": "ia32" }, "sha512-SyaIPFoxmUPlNDq5EHkTbiKzmSEmq/gOYFI/3HHJ8iS/v1mbugVa7dXUzcJGQfoytp9DJFLhHH4U3/eTy2Bq4w=="], + "@rollup/rollup-win32-ia32-msvc": ["@rollup/rollup-win32-ia32-msvc@4.60.4", "", { "os": "win32", "cpu": "ia32" }, "sha512-zTPgT1YuHHcd+Tmx7h8aml0FWFVelV5N54oHow9SLj+GfoDy/huQ+UV396N/C7KpMDMiPspRktzM1/0r1usYEA=="], - "@rollup/rollup-win32-x64-gnu": ["@rollup/rollup-win32-x64-gnu@4.60.0", "", { "os": "win32", "cpu": "x64" }, "sha512-RdcryEfzZr+lAr5kRm2ucN9aVlCCa2QNq4hXelZxb8GG0NJSazq44Z3PCCc8wISRuCVnGs0lQJVX5Vp6fKA+IA=="], + "@rollup/rollup-win32-x64-gnu": ["@rollup/rollup-win32-x64-gnu@4.60.4", "", { "os": "win32", "cpu": "x64" }, "sha512-DRS4G7mi9lJxqEDezIkKCaUIKCrLUUDCUaCsTPCi/rtqaC6D/jjwslMQyiDU50Ka0JKpeXeRBFBAXwArY52vBw=="], - "@rollup/rollup-win32-x64-msvc": ["@rollup/rollup-win32-x64-msvc@4.60.0", "", { "os": "win32", "cpu": "x64" }, "sha512-PrsWNQ8BuE00O3Xsx3ALh2Df8fAj9+cvvX9AIA6o4KpATR98c9mud4XtDWVvsEuyia5U4tVSTKygawyJkjm60w=="], + "@rollup/rollup-win32-x64-msvc": ["@rollup/rollup-win32-x64-msvc@4.60.4", "", { "os": "win32", "cpu": "x64" }, "sha512-QVTUovf40zgTqlFVrKA1uXMVvU2QWEFWfAH8Wdc48IxLvrJMQVMBRjuQyUpzZCDkakImib9eVazbWlC6ksWtJw=="], - "@rushstack/node-core-library": ["@rushstack/node-core-library@5.13.0", "", { "dependencies": { "ajv": "~8.13.0", "ajv-draft-04": "~1.0.0", "ajv-formats": "~3.0.1", "fs-extra": "~11.3.0", "import-lazy": "~4.0.0", "jju": "~1.4.0", "resolve": "~1.22.1", "semver": "~7.5.4" }, "peerDependencies": { "@types/node": "*" }, "optionalPeers": ["@types/node"] }, "sha512-IGVhy+JgUacAdCGXKUrRhwHMTzqhWwZUI+qEPcdzsb80heOw0QPbhhoVsoiMF7Klp8eYsp7hzpScMXmOa3Uhfg=="], + "@rushstack/node-core-library": ["@rushstack/node-core-library@4.0.2", "", { "dependencies": { "fs-extra": "~7.0.1", "import-lazy": "~4.0.0", "jju": "~1.4.0", "resolve": "~1.22.1", "semver": "~7.5.4", "z-schema": "~5.0.2" }, "peerDependencies": { "@types/node": "*" }, "optionalPeers": ["@types/node"] }, "sha512-hyES82QVpkfQMeBMteQUnrhASL/KHPhd7iJ8euduwNJG4mu2GSOKybf0rOEjOm1Wz7CwJEUm9y0yD7jg2C1bfg=="], - "@rushstack/terminal": ["@rushstack/terminal@0.15.2", "", { "dependencies": { "@rushstack/node-core-library": "5.13.0", "supports-color": "~8.1.1" }, "peerDependencies": { "@types/node": "*" }, "optionalPeers": ["@types/node"] }, "sha512-7Hmc0ysK5077R/IkLS9hYu0QuNafm+TbZbtYVzCMbeOdMjaRboLKrhryjwZSRJGJzu+TV1ON7qZHeqf58XfLpA=="], + "@rushstack/terminal": ["@rushstack/terminal@0.10.0", "", { "dependencies": { "@rushstack/node-core-library": "4.0.2", "supports-color": "~8.1.1" }, "peerDependencies": { "@types/node": "*" }, "optionalPeers": ["@types/node"] }, "sha512-UbELbXnUdc7EKwfH2sb8ChqNgapUOdqcCIdQP4NGxBpTZV2sQyeekuK3zmfQSa/MN+/7b4kBogl2wq0vpkpYGw=="], - "@rushstack/ts-command-line": ["@rushstack/ts-command-line@4.23.7", "", { "dependencies": { "@rushstack/terminal": "0.15.2", "@types/argparse": "1.0.38", "argparse": "~1.0.9", "string-argv": "~0.3.1" } }, "sha512-Gr9cB7DGe6uz5vq2wdr89WbVDKz0UeuFEn5H2CfWDe7JvjFFaiV15gi6mqDBTbHhHCWS7w8mF1h3BnIfUndqdA=="], + "@rushstack/ts-command-line": ["@rushstack/ts-command-line@4.19.1", "", { "dependencies": { "@rushstack/terminal": "0.10.0", "@types/argparse": "1.0.38", "argparse": "~1.0.9", "string-argv": "~0.3.1" } }, "sha512-J7H768dgcpG60d7skZ5uSSwyCZs/S2HrWP1Ds8d1qYAyaaeJmpmmLr9BVw97RjFzmQPOYnoXcKA4GkqDCkduQg=="], "@safe-global/api-kit": ["@safe-global/api-kit@2.5.11", "", { "dependencies": { "@safe-global/protocol-kit": "^5.2.4", "@safe-global/types-kit": "^1.0.4", "node-fetch": "^2.7.0", "viem": "^2.21.8" } }, "sha512-gNrbGI/vHbOplPrytTEe5+CmwOowkEjDoTqGxz6q/rQSEJ7d7z8YzVy8Zdia7ICld1nIymQmkBdXkLr2XrDwfQ=="], - "@safe-global/protocol-kit": ["@safe-global/protocol-kit@5.2.26", "", { "dependencies": { "@safe-global/safe-deployments": "^1.37.51", "@safe-global/safe-modules-deployments": "^2.2.25", "@safe-global/types-kit": "^1.0.5", "abitype": "^1.0.2", "semver": "^7.6.3", "viem": "^2.21.8" }, "optionalDependencies": { "@noble/curves": "^1.6.0", "@peculiar/asn1-schema": "^2.3.13" } }, "sha512-kNLkYbz2racd3xwHs8aS0F6hyr0AzuEypJTUngrx0MqAauH5S1uKhzF6sfpPtNwaoLacc/xpXJwAIfoQ/1m7Jw=="], + "@safe-global/protocol-kit": ["@safe-global/protocol-kit@5.2.27", "", { "dependencies": { "@safe-global/safe-deployments": "^1.37.55", "@safe-global/safe-modules-deployments": "^2.2.25", "@safe-global/types-kit": "^1.0.5", "abitype": "^1.0.2", "semver": "^7.6.3", "viem": "^2.21.8" }, "optionalDependencies": { "@noble/curves": "^1.6.0", "@peculiar/asn1-schema": "^2.3.13" } }, "sha512-J0o0qSJX2tGRQza41ffhT8JGldKDgmUan+v4xvigrcUuJZzHv6S2XzOtgzCsxLiJW8cpRMlhzXhZtiamlb863g=="], "@safe-global/safe-apps-provider": ["@safe-global/safe-apps-provider@0.18.6", "", { "dependencies": { "@safe-global/safe-apps-sdk": "^9.1.0", "events": "^3.3.0" } }, "sha512-4LhMmjPWlIO8TTDC2AwLk44XKXaK6hfBTWyljDm0HQ6TWlOEijVWNrt2s3OCVMSxlXAcEzYfqyu1daHZooTC2Q=="], "@safe-global/safe-apps-sdk": ["@safe-global/safe-apps-sdk@9.1.0", "", { "dependencies": { "@safe-global/safe-gateway-typescript-sdk": "^3.5.3", "viem": "^2.1.1" } }, "sha512-N5p/ulfnnA2Pi2M3YeWjULeWbjo7ei22JwU/IXnhoHzKq3pYCN6ynL9mJBOlvDVv892EgLPCWCOwQk/uBT2v0Q=="], - "@safe-global/safe-deployments": ["@safe-global/safe-deployments@1.37.53", "", { "dependencies": { "semver": "^7.6.2" } }, "sha512-3XihirwKqcCi6jsipCiW3lYXra9i4pC9nlhHTdUyi7Yx38nBYIkXeLZN2Nmf2UPcQBeHGnW1T3DgzY4VnuF/FQ=="], + "@safe-global/safe-deployments": ["@safe-global/safe-deployments@1.37.56", "", { "dependencies": { "semver": "^7.6.2" } }, "sha512-HF3ETre/KSP3nCOZ72XEbq5U56gOGgYLJ22LxOAnR8+YzMjzZ8cpnHpx5Z31Zt1xkUTGSCMi9XF950lJt6WbsQ=="], "@safe-global/safe-gateway-typescript-sdk": ["@safe-global/safe-gateway-typescript-sdk@3.23.1", "", {}, "sha512-6ORQfwtEJYpalCeVO21L4XXGSdbEMfyp2hEv6cP82afKXSwvse6d3sdelgaPWUxHIsFRkWvHDdzh8IyyKHZKxw=="], @@ -1506,19 +1498,19 @@ "@scure/bip32": ["@scure/bip32@1.7.0", "", { "dependencies": { "@noble/curves": "~1.9.0", "@noble/hashes": "~1.8.0", "@scure/base": "~1.2.5" } }, "sha512-E4FFX/N3f4B80AKWp5dP6ow+flD1LQZo/w8UnLGYZO674jS6YnYeepycOOksv+vLPSpgN35wgKgy+ybfTb2SMw=="], - "@scure/bip39": ["@scure/bip39@2.0.1", "", { "dependencies": { "@noble/hashes": "2.0.1", "@scure/base": "2.0.0" } }, "sha512-PsxdFj/d2AcJcZDX1FXN3dDgitDDTmwf78rKZq1a6c1P1Nan1X/Sxc7667zU3U+AN60g7SxxP0YCVw2H/hBycg=="], + "@scure/bip39": ["@scure/bip39@2.2.0", "", { "dependencies": { "@noble/hashes": "2.2.0", "@scure/base": "2.2.0" } }, "sha512-T/Bj/YvYMNkIPq6EENO6/rcs2e7qTNuyoUXf0KBFDmp0ZDu0H2X4Lq6yC3i0c8PcWkov5EbW+yQZZbdMmk154A=="], - "@sentry-internal/browser-utils": ["@sentry-internal/browser-utils@8.55.0", "", { "dependencies": { "@sentry/core": "8.55.0" } }, "sha512-ROgqtQfpH/82AQIpESPqPQe0UyWywKJsmVIqi3c5Fh+zkds5LUxnssTj3yNd1x+kxaPDVB023jAP+3ibNgeNDw=="], + "@sentry-internal/browser-utils": ["@sentry-internal/browser-utils@8.55.2", "", { "dependencies": { "@sentry/core": "8.55.2" } }, "sha512-GnKod+gL/Y+1FUM/RGV8q6le1CoyiGbT40MitEK7eVwWe+bfTRq1gN7ioupyHFMUg1RlQkDQ4/sENmio/uow5A=="], - "@sentry-internal/feedback": ["@sentry-internal/feedback@8.55.0", "", { "dependencies": { "@sentry/core": "8.55.0" } }, "sha512-cP3BD/Q6pquVQ+YL+rwCnorKuTXiS9KXW8HNKu4nmmBAyf7urjs+F6Hr1k9MXP5yQ8W3yK7jRWd09Yu6DHWOiw=="], + "@sentry-internal/feedback": ["@sentry-internal/feedback@8.55.2", "", { "dependencies": { "@sentry/core": "8.55.2" } }, "sha512-XQy//NWbL0mLLM5w8wNDWMNpXz39VUyW2397dUrH8++kR63WhUVAvTOtL0o0GMVadSAzl1b08oHP9zSUNFQwcg=="], - "@sentry-internal/replay": ["@sentry-internal/replay@8.55.0", "", { "dependencies": { "@sentry-internal/browser-utils": "8.55.0", "@sentry/core": "8.55.0" } }, "sha512-roCDEGkORwolxBn8xAKedybY+Jlefq3xYmgN2fr3BTnsXjSYOPC7D1/mYqINBat99nDtvgFvNfRcZPiwwZ1hSw=="], + "@sentry-internal/replay": ["@sentry-internal/replay@8.55.2", "", { "dependencies": { "@sentry-internal/browser-utils": "8.55.2", "@sentry/core": "8.55.2" } }, "sha512-+W43Z697EVe/OgpGW07B773sa8xO1UbpnW0Cr+E+3FMDb6ZbXlaBUoagPTUkkQPdwBe35SDh6r8y2M3EOPGbxg=="], - "@sentry-internal/replay-canvas": ["@sentry-internal/replay-canvas@8.55.0", "", { "dependencies": { "@sentry-internal/replay": "8.55.0", "@sentry/core": "8.55.0" } }, "sha512-nIkfgRWk1091zHdu4NbocQsxZF1rv1f7bbp3tTIlZYbrH62XVZosx5iHAuZG0Zc48AETLE7K4AX9VGjvQj8i9w=="], + "@sentry-internal/replay-canvas": ["@sentry-internal/replay-canvas@8.55.2", "", { "dependencies": { "@sentry-internal/replay": "8.55.2", "@sentry/core": "8.55.2" } }, "sha512-P/jGiuR7dRLG9IzD/463fLgiibyYceauav/9prRG0ZxJm1AtuO02OKball2Fs3bbzdzwHCTlcsUuL2ivDF4b5A=="], "@sentry/babel-plugin-component-annotate": ["@sentry/babel-plugin-component-annotate@2.23.1", "", {}, "sha512-l1z8AvI6k9I+2z49OgvP3SlzB1M0Lw24KtceiJibNaSyQwxsItoT9/XftZ/8BBtkosVmNOTQhL1eUsSkuSv1LA=="], - "@sentry/browser": ["@sentry/browser@8.55.0", "", { "dependencies": { "@sentry-internal/browser-utils": "8.55.0", "@sentry-internal/feedback": "8.55.0", "@sentry-internal/replay": "8.55.0", "@sentry-internal/replay-canvas": "8.55.0", "@sentry/core": "8.55.0" } }, "sha512-1A31mCEWCjaMxJt6qGUK+aDnLDcK6AwLAZnqpSchNysGni1pSn1RWSmk9TBF8qyTds5FH8B31H480uxMPUJ7Cw=="], + "@sentry/browser": ["@sentry/browser@8.55.2", "", { "dependencies": { "@sentry-internal/browser-utils": "8.55.2", "@sentry-internal/feedback": "8.55.2", "@sentry-internal/replay": "8.55.2", "@sentry-internal/replay-canvas": "8.55.2", "@sentry/core": "8.55.2" } }, "sha512-xHuPIEKhx9zw5quWvv4YgZprnwoVMCfxIhmOIf6KJ9iizyUHeUDcKpLS59xERroqwX4RpvK+l/27AZu4zfZlzQ=="], "@sentry/bundler-plugin-core": ["@sentry/bundler-plugin-core@2.23.1", "", { "dependencies": { "@babel/core": "^7.18.5", "@sentry/babel-plugin-component-annotate": "2.23.1", "@sentry/cli": "2.39.1", "dotenv": "^16.3.1", "find-up": "^5.0.0", "glob": "^9.3.2", "magic-string": "0.30.8", "unplugin": "1.0.1" } }, "sha512-JA6utNiwMKv6Jfj0Hmk0DI/XUizSHg7HhhkFETKhRlYEhZAdkyz1atDBg0ncKNgRBKyHeSYWcMFtUyo26VB76w=="], @@ -1538,7 +1530,7 @@ "@sentry/cli-win32-x64": ["@sentry/cli-win32-x64@2.39.1", "", { "os": "win32", "cpu": "x64" }, "sha512-xv0R2CMf/X1Fte3cMWie1NXuHmUyQPDBfCyIt6k6RPFPxAYUgcqgMPznYwVMwWEA1W43PaOkSn3d8ZylsDaETw=="], - "@sentry/core": ["@sentry/core@8.55.0", "", {}, "sha512-6g7jpbefjHYs821Z+EBJ8r4Z7LT5h80YSWRJaylGS4nW5W5Z2KXzpdnyFarv37O7QjauzVC2E+PABmpkw5/JGA=="], + "@sentry/core": ["@sentry/core@8.55.2", "", {}, "sha512-YlEBwybUcOQ/KjMHDmof1vwweVnBtBxYlQp7DE3fOdtW4pqqdHWTnTntQs4VgYfxzjJYgtkd9LHlGtg8qy+JVQ=="], "@sentry/hub": ["@sentry/hub@5.30.0", "", { "dependencies": { "@sentry/types": "5.30.0", "@sentry/utils": "5.30.0", "tslib": "^1.9.3" } }, "sha512-2tYrGnzb1gKz2EkMDQcfLrDTvmGcQPuWxLnJKXJvYTQDGLlEvi2tWz1VIHjunmOvJrB5aIQLhm+dcMRwFZDCqQ=="], @@ -1546,7 +1538,7 @@ "@sentry/node": ["@sentry/node@5.30.0", "", { "dependencies": { "@sentry/core": "5.30.0", "@sentry/hub": "5.30.0", "@sentry/tracing": "5.30.0", "@sentry/types": "5.30.0", "@sentry/utils": "5.30.0", "cookie": "^0.4.1", "https-proxy-agent": "^5.0.0", "lru_map": "^0.3.3", "tslib": "^1.9.3" } }, "sha512-Br5oyVBF0fZo6ZS9bxbJZG4ApAjRqAnqFFurMVJJdunNb80brh7a5Qva2kjhm+U6r9NJAB5OmDyPkA1Qnt+QVg=="], - "@sentry/react": ["@sentry/react@8.55.0", "", { "dependencies": { "@sentry/browser": "8.55.0", "@sentry/core": "8.55.0", "hoist-non-react-statics": "^3.3.2" }, "peerDependencies": { "react": "^16.14.0 || 17.x || 18.x || 19.x" } }, "sha512-/qNBvFLpvSa/Rmia0jpKfJdy16d4YZaAnH/TuKLAtm0BWlsPQzbXCU4h8C5Hsst0Do0zG613MEtEmWpWrVOqWA=="], + "@sentry/react": ["@sentry/react@8.55.2", "", { "dependencies": { "@sentry/browser": "8.55.2", "@sentry/core": "8.55.2", "hoist-non-react-statics": "^3.3.2" }, "peerDependencies": { "react": "^16.14.0 || 17.x || 18.x || 19.x" } }, "sha512-1TPfKZYkJal2Dyt2W0tf1roOZmu7sqr6/dTqjdsuu2WgGTilMEreK26YqB8ROOYdMjkVJpNCcIKXQHyMp2eCwA=="], "@sentry/tracing": ["@sentry/tracing@5.30.0", "", { "dependencies": { "@sentry/hub": "5.30.0", "@sentry/minimal": "5.30.0", "@sentry/types": "5.30.0", "@sentry/utils": "5.30.0", "tslib": "^1.9.3" } }, "sha512-dUFowCr0AIMwiLD7Fs314Mdzcug+gBVo/+NCMyDw8tFxJkwWAKl7Qa2OZxLQ0ZHjakcj1hNKfCQJ9rhyfOl4Aw=="], @@ -1564,85 +1556,23 @@ "@sindresorhus/is": ["@sindresorhus/is@5.6.0", "", {}, "sha512-TV7t8GKYaJWsn00tFDqBw8+Uqmr8A0fRU1tvTQhyZzGv0sJCGRQL3JGMI3ucuKo3XIZdUP+Lx7/gh2t3lewy7g=="], - "@smithy/abort-controller": ["@smithy/abort-controller@4.2.12", "", { "dependencies": { "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-xolrFw6b+2iYGl6EcOL7IJY71vvyZ0DJ3mcKtpykqPe2uscwtzDZJa1uVQXyP7w9Dd+kGwYnPbMsJrGISKiY/Q=="], - - "@smithy/config-resolver": ["@smithy/config-resolver@4.4.13", "", { "dependencies": { "@smithy/node-config-provider": "^4.3.12", "@smithy/types": "^4.13.1", "@smithy/util-config-provider": "^4.2.2", "@smithy/util-endpoints": "^3.3.3", "@smithy/util-middleware": "^4.2.12", "tslib": "^2.6.2" } }, "sha512-iIzMC5NmOUP6WL6o8iPBjFhUhBZ9pPjpUpQYWMUFQqKyXXzOftbfK8zcQCz/jFV1Psmf05BK5ypx4K2r4Tnwdg=="], - - "@smithy/core": ["@smithy/core@3.23.12", "", { "dependencies": { "@smithy/protocol-http": "^5.3.12", "@smithy/types": "^4.13.1", "@smithy/url-parser": "^4.2.12", "@smithy/util-base64": "^4.3.2", "@smithy/util-body-length-browser": "^4.2.2", "@smithy/util-middleware": "^4.2.12", "@smithy/util-stream": "^4.5.20", "@smithy/util-utf8": "^4.2.2", "@smithy/uuid": "^1.1.2", "tslib": "^2.6.2" } }, "sha512-o9VycsYNtgC+Dy3I0yrwCqv9CWicDnke0L7EVOrZtJpjb2t0EjaEofmMrYc0T1Kn3yk32zm6cspxF9u9Bj7e5w=="], - - "@smithy/credential-provider-imds": ["@smithy/credential-provider-imds@4.2.12", "", { "dependencies": { "@smithy/node-config-provider": "^4.3.12", "@smithy/property-provider": "^4.2.12", "@smithy/types": "^4.13.1", "@smithy/url-parser": "^4.2.12", "tslib": "^2.6.2" } }, "sha512-cr2lR792vNZcYMriSIj+Um3x9KWrjcu98kn234xA6reOAFMmbRpQMOv8KPgEmLLtx3eldU6c5wALKFqNOhugmg=="], - - "@smithy/fetch-http-handler": ["@smithy/fetch-http-handler@5.3.15", "", { "dependencies": { "@smithy/protocol-http": "^5.3.12", "@smithy/querystring-builder": "^4.2.12", "@smithy/types": "^4.13.1", "@smithy/util-base64": "^4.3.2", "tslib": "^2.6.2" } }, "sha512-T4jFU5N/yiIfrtrsb9uOQn7RdELdM/7HbyLNr6uO/mpkj1ctiVs7CihVr51w4LyQlXWDpXFn4BElf1WmQvZu/A=="], - - "@smithy/hash-node": ["@smithy/hash-node@4.2.12", "", { "dependencies": { "@smithy/types": "^4.13.1", "@smithy/util-buffer-from": "^4.2.2", "@smithy/util-utf8": "^4.2.2", "tslib": "^2.6.2" } }, "sha512-QhBYbGrbxTkZ43QoTPrK72DoYviDeg6YKDrHTMJbbC+A0sml3kSjzFtXP7BtbyJnXojLfTQldGdUR0RGD8dA3w=="], - - "@smithy/invalid-dependency": ["@smithy/invalid-dependency@4.2.12", "", { "dependencies": { "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-/4F1zb7Z8LOu1PalTdESFHR0RbPwHd3FcaG1sI3UEIriQTWakysgJr65lc1jj6QY5ye7aFsisajotH6UhWfm/g=="], - - "@smithy/is-array-buffer": ["@smithy/is-array-buffer@4.2.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-n6rQ4N8Jj4YTQO3YFrlgZuwKodf4zUFs7EJIWH86pSCWBaAtAGBFfCM7Wx6D2bBJ2xqFNxGBSrUWswT3M0VJow=="], - - "@smithy/middleware-content-length": ["@smithy/middleware-content-length@4.2.12", "", { "dependencies": { "@smithy/protocol-http": "^5.3.12", "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-YE58Yz+cvFInWI/wOTrB+DbvUVz/pLn5mC5MvOV4fdRUc6qGwygyngcucRQjAhiCEbmfLOXX0gntSIcgMvAjmA=="], - - "@smithy/middleware-endpoint": ["@smithy/middleware-endpoint@4.4.27", "", { "dependencies": { "@smithy/core": "^3.23.12", "@smithy/middleware-serde": "^4.2.15", "@smithy/node-config-provider": "^4.3.12", "@smithy/shared-ini-file-loader": "^4.4.7", "@smithy/types": "^4.13.1", "@smithy/url-parser": "^4.2.12", "@smithy/util-middleware": "^4.2.12", "tslib": "^2.6.2" } }, "sha512-T3TFfUgXQlpcg+UdzcAISdZpj4Z+XECZ/cefgA6wLBd6V4lRi0svN2hBouN/be9dXQ31X4sLWz3fAQDf+nt6BA=="], - - "@smithy/middleware-retry": ["@smithy/middleware-retry@4.4.44", "", { "dependencies": { "@smithy/node-config-provider": "^4.3.12", "@smithy/protocol-http": "^5.3.12", "@smithy/service-error-classification": "^4.2.12", "@smithy/smithy-client": "^4.12.7", "@smithy/types": "^4.13.1", "@smithy/util-middleware": "^4.2.12", "@smithy/util-retry": "^4.2.12", "@smithy/uuid": "^1.1.2", "tslib": "^2.6.2" } }, "sha512-Y1Rav7m5CFRPQyM4CI0koD/bXjyjJu3EQxZZhtLGD88WIrBrQ7kqXM96ncd6rYnojwOo/u9MXu57JrEvu/nLrA=="], - - "@smithy/middleware-serde": ["@smithy/middleware-serde@4.2.15", "", { "dependencies": { "@smithy/core": "^3.23.12", "@smithy/protocol-http": "^5.3.12", "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-ExYhcltZSli0pgAKOpQQe1DLFBLryeZ22605y/YS+mQpdNWekum9Ujb/jMKfJKgjtz1AZldtwA/wCYuKJgjjlg=="], - - "@smithy/middleware-stack": ["@smithy/middleware-stack@4.2.12", "", { "dependencies": { "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-kruC5gRHwsCOuyCd4ouQxYjgRAym2uDlCvQ5acuMtRrcdfg7mFBg6blaxcJ09STpt3ziEkis6bhg1uwrWU7txw=="], - - "@smithy/node-config-provider": ["@smithy/node-config-provider@4.3.12", "", { "dependencies": { "@smithy/property-provider": "^4.2.12", "@smithy/shared-ini-file-loader": "^4.4.7", "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-tr2oKX2xMcO+rBOjobSwVAkV05SIfUKz8iI53rzxEmgW3GOOPOv0UioSDk+J8OpRQnpnhsO3Af6IEBabQBVmiw=="], - - "@smithy/node-http-handler": ["@smithy/node-http-handler@4.5.0", "", { "dependencies": { "@smithy/abort-controller": "^4.2.12", "@smithy/protocol-http": "^5.3.12", "@smithy/querystring-builder": "^4.2.12", "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-Rnq9vQWiR1+/I6NZZMNzJHV6pZYyEHt2ZnuV3MG8z2NNenC4i/8Kzttz7CjZiHSmsN5frhXhg17z3Zqjjhmz1A=="], - - "@smithy/property-provider": ["@smithy/property-provider@4.2.12", "", { "dependencies": { "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-jqve46eYU1v7pZ5BM+fmkbq3DerkSluPr5EhvOcHxygxzD05ByDRppRwRPPpFrsFo5yDtCYLKu+kreHKVrvc7A=="], - - "@smithy/protocol-http": ["@smithy/protocol-http@5.3.12", "", { "dependencies": { "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-fit0GZK9I1xoRlR4jXmbLhoN0OdEpa96ul8M65XdmXnxXkuMxM0Y8HDT0Fh0Xb4I85MBvBClOzgSrV1X2s1Hxw=="], - - "@smithy/querystring-builder": ["@smithy/querystring-builder@4.2.12", "", { "dependencies": { "@smithy/types": "^4.13.1", "@smithy/util-uri-escape": "^4.2.2", "tslib": "^2.6.2" } }, "sha512-6wTZjGABQufekycfDGMEB84BgtdOE/rCVTov+EDXQ8NHKTUNIp/j27IliwP7tjIU9LR+sSzyGBOXjeEtVgzCHg=="], - - "@smithy/querystring-parser": ["@smithy/querystring-parser@4.2.12", "", { "dependencies": { "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-P2OdvrgiAKpkPNKlKUtWbNZKB1XjPxM086NeVhK+W+wI46pIKdWBe5QyXvhUm3MEcyS/rkLvY8rZzyUdmyDZBw=="], - - "@smithy/service-error-classification": ["@smithy/service-error-classification@4.2.12", "", { "dependencies": { "@smithy/types": "^4.13.1" } }, "sha512-LlP29oSQN0Tw0b6D0Xo6BIikBswuIiGYbRACy5ujw/JgWSzTdYj46U83ssf6Ux0GyNJVivs2uReU8pt7Eu9okQ=="], - - "@smithy/shared-ini-file-loader": ["@smithy/shared-ini-file-loader@4.4.7", "", { "dependencies": { "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-HrOKWsUb+otTeo1HxVWeEb99t5ER1XrBi/xka2Wv6NVmTbuCUC1dvlrksdvxFtODLBjsC+PHK+fuy2x/7Ynyiw=="], - - "@smithy/signature-v4": ["@smithy/signature-v4@5.3.12", "", { "dependencies": { "@smithy/is-array-buffer": "^4.2.2", "@smithy/protocol-http": "^5.3.12", "@smithy/types": "^4.13.1", "@smithy/util-hex-encoding": "^4.2.2", "@smithy/util-middleware": "^4.2.12", "@smithy/util-uri-escape": "^4.2.2", "@smithy/util-utf8": "^4.2.2", "tslib": "^2.6.2" } }, "sha512-B/FBwO3MVOL00DaRSXfXfa/TRXRheagt/q5A2NM13u7q+sHS59EOVGQNfG7DkmVtdQm5m3vOosoKAXSqn/OEgw=="], - - "@smithy/smithy-client": ["@smithy/smithy-client@4.12.7", "", { "dependencies": { "@smithy/core": "^3.23.12", "@smithy/middleware-endpoint": "^4.4.27", "@smithy/middleware-stack": "^4.2.12", "@smithy/protocol-http": "^5.3.12", "@smithy/types": "^4.13.1", "@smithy/util-stream": "^4.5.20", "tslib": "^2.6.2" } }, "sha512-q3gqnwml60G44FECaEEsdQMplYhDMZYCtYhMCzadCnRnnHIobZJjegmdoUo6ieLQlPUzvrMdIJUpx6DoPmzANQ=="], - - "@smithy/types": ["@smithy/types@4.13.1", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-787F3yzE2UiJIQ+wYW1CVg2odHjmaWLGksnKQHUrK/lYZSEcy1msuLVvxaR/sI2/aDe9U+TBuLsXnr3vod1g0g=="], - - "@smithy/url-parser": ["@smithy/url-parser@4.2.12", "", { "dependencies": { "@smithy/querystring-parser": "^4.2.12", "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-wOPKPEpso+doCZGIlr+e1lVI6+9VAKfL4kZWFgzVgGWY2hZxshNKod4l2LXS3PRC9otH/JRSjtEHqQ/7eLciRA=="], - - "@smithy/util-base64": ["@smithy/util-base64@4.3.2", "", { "dependencies": { "@smithy/util-buffer-from": "^4.2.2", "@smithy/util-utf8": "^4.2.2", "tslib": "^2.6.2" } }, "sha512-XRH6b0H/5A3SgblmMa5ErXQ2XKhfbQB+Fm/oyLZ2O2kCUrwgg55bU0RekmzAhuwOjA9qdN5VU2BprOvGGUkOOQ=="], - - "@smithy/util-body-length-browser": ["@smithy/util-body-length-browser@4.2.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-JKCrLNOup3OOgmzeaKQwi4ZCTWlYR5H4Gm1r2uTMVBXoemo1UEghk5vtMi1xSu2ymgKVGW631e2fp9/R610ZjQ=="], - - "@smithy/util-body-length-node": ["@smithy/util-body-length-node@4.2.3", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-ZkJGvqBzMHVHE7r/hcuCxlTY8pQr1kMtdsVPs7ex4mMU+EAbcXppfo5NmyxMYi2XU49eqaz56j2gsk4dHHPG/g=="], + "@smithy/core": ["@smithy/core@3.24.5", "", { "dependencies": { "@aws-crypto/crc32": "5.2.0", "@smithy/types": "^4.14.2", "tslib": "^2.6.2" } }, "sha512-Kt8phUg45M15EjhYAbZ+fFikYneijLu9Liugz8ZsYz2i8j0hzGv27LWKpEHYRfvj+LyCOSijpcR/2i8RouV+cA=="], - "@smithy/util-buffer-from": ["@smithy/util-buffer-from@4.2.2", "", { "dependencies": { "@smithy/is-array-buffer": "^4.2.2", "tslib": "^2.6.2" } }, "sha512-FDXD7cvUoFWwN6vtQfEta540Y/YBe5JneK3SoZg9bThSoOAC/eGeYEua6RkBgKjGa/sz6Y+DuBZj3+YEY21y4Q=="], + "@smithy/credential-provider-imds": ["@smithy/credential-provider-imds@4.3.5", "", { "dependencies": { "@smithy/core": "^3.24.5", "@smithy/types": "^4.14.2", "tslib": "^2.6.2" } }, "sha512-yiF8xHpdkaTfzLVqFzsP6WvNghEK+qZzLYWFD13L2SsFhbXwBGlxdocKF95qjr7s5lE5NRage+EJFK4mAsx88Q=="], - "@smithy/util-config-provider": ["@smithy/util-config-provider@4.2.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-dWU03V3XUprJwaUIFVv4iOnS1FC9HnMHDfUrlNDSh4315v0cWyaIErP8KiqGVbf5z+JupoVpNM7ZB3jFiTejvQ=="], + "@smithy/fetch-http-handler": ["@smithy/fetch-http-handler@5.4.5", "", { "dependencies": { "@smithy/core": "^3.24.5", "@smithy/types": "^4.14.2", "tslib": "^2.6.2" } }, "sha512-SK3VMeH0fibgdTg2QeB+O4p7Yy/2E5HBOHJeC58FshkDdeuX8lOgO7PfjYfLyPLP1ch55j91cQqKBzDS0mRjSQ=="], - "@smithy/util-defaults-mode-browser": ["@smithy/util-defaults-mode-browser@4.3.43", "", { "dependencies": { "@smithy/property-provider": "^4.2.12", "@smithy/smithy-client": "^4.12.7", "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-Qd/0wCKMaXxev/z00TvNzGCH2jlKKKxXP1aDxB6oKwSQthe3Og2dMhSayGCnsma1bK/kQX1+X7SMP99t6FgiiQ=="], + "@smithy/is-array-buffer": ["@smithy/is-array-buffer@2.2.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA=="], - "@smithy/util-defaults-mode-node": ["@smithy/util-defaults-mode-node@4.2.47", "", { "dependencies": { "@smithy/config-resolver": "^4.4.13", "@smithy/credential-provider-imds": "^4.2.12", "@smithy/node-config-provider": "^4.3.12", "@smithy/property-provider": "^4.2.12", "@smithy/smithy-client": "^4.12.7", "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-qSRbYp1EQ7th+sPFuVcVO05AE0QH635hycdEXlpzIahqHHf2Fyd/Zl+8v0XYMJ3cgDVPa0lkMefU7oNUjAP+DQ=="], + "@smithy/node-http-handler": ["@smithy/node-http-handler@4.7.5", "", { "dependencies": { "@smithy/core": "^3.24.5", "@smithy/types": "^4.14.2", "tslib": "^2.6.2" } }, "sha512-3dA9TQ+ybRSZ/m0wnbZhiBy4Dezjgq1Ib/ZZrYTpJDBgpoLLU/SDzZc/g0x0MNAdOJe1wPcM+x2PBRmoOur+Sw=="], - "@smithy/util-endpoints": ["@smithy/util-endpoints@3.3.3", "", { "dependencies": { "@smithy/node-config-provider": "^4.3.12", "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-VACQVe50j0HZPjpwWcjyT51KUQ4AnsvEaQ2lKHOSL4mNLD0G9BjEniQ+yCt1qqfKfiAHRAts26ud7hBjamrwig=="], + "@smithy/signature-v4": ["@smithy/signature-v4@5.4.5", "", { "dependencies": { "@smithy/core": "^3.24.5", "@smithy/types": "^4.14.2", "tslib": "^2.6.2" } }, "sha512-QBJKWGqIknH0dc9LWpfH1mkdokAx6iXYN3UcQ3eY6uIEyScuoQAhfl94ge7ozUy9WgFUdE8xsvwBjaYBbWmPNA=="], - "@smithy/util-hex-encoding": ["@smithy/util-hex-encoding@4.2.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-Qcz3W5vuHK4sLQdyT93k/rfrUwdJ8/HZ+nMUOyGdpeGA1Wxt65zYwi3oEl9kOM+RswvYq90fzkNDahPS8K0OIg=="], + "@smithy/types": ["@smithy/types@4.14.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-P+otAxbV4CqBybp7EkcJCrig63yE2E7PuNVOmilVMRcx/O+QDzGULTrKsq4DV13gSfak9ObPrWaHl/9bL5YcWw=="], - "@smithy/util-middleware": ["@smithy/util-middleware@4.2.12", "", { "dependencies": { "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-Er805uFUOvgc0l8nv0e0su0VFISoxhJ/AwOn3gL2NWNY2LUEldP5WtVcRYSQBcjg0y9NfG8JYrCJaYDpupBHJQ=="], + "@smithy/util-buffer-from": ["@smithy/util-buffer-from@2.2.0", "", { "dependencies": { "@smithy/is-array-buffer": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA=="], - "@smithy/util-retry": ["@smithy/util-retry@4.2.12", "", { "dependencies": { "@smithy/service-error-classification": "^4.2.12", "@smithy/types": "^4.13.1", "tslib": "^2.6.2" } }, "sha512-1zopLDUEOwumjcHdJ1mwBHddubYF8GMQvstVCLC54Y46rqoHwlIU+8ZzUeaBcD+WCJHyDGSeZ2ml9YSe9aqcoQ=="], - - "@smithy/util-stream": ["@smithy/util-stream@4.5.20", "", { "dependencies": { "@smithy/fetch-http-handler": "^5.3.15", "@smithy/node-http-handler": "^4.5.0", "@smithy/types": "^4.13.1", "@smithy/util-base64": "^4.3.2", "@smithy/util-buffer-from": "^4.2.2", "@smithy/util-hex-encoding": "^4.2.2", "@smithy/util-utf8": "^4.2.2", "tslib": "^2.6.2" } }, "sha512-4yXLm5n/B5SRBR2p8cZ90Sbv4zL4NKsgxdzCzp/83cXw2KxLEumt5p+GAVyRNZgQOSrzXn9ARpO0lUe8XSlSDw=="], - - "@smithy/util-uri-escape": ["@smithy/util-uri-escape@4.2.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-2kAStBlvq+lTXHyAZYfJRb/DfS3rsinLiwb+69SstC9Vb0s9vNWkRwpnj918Pfi85mzi42sOqdV72OLxWAISnw=="], - - "@smithy/util-utf8": ["@smithy/util-utf8@4.2.2", "", { "dependencies": { "@smithy/util-buffer-from": "^4.2.2", "tslib": "^2.6.2" } }, "sha512-75MeYpjdWRe8M5E3AW0O4Cx3UadweS+cwdXjwYGBW5h/gxxnbeZ877sLPX/ZJA9GVTlL/qG0dXP29JWFCD1Ayw=="], - - "@smithy/uuid": ["@smithy/uuid@1.1.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-O/IEdcCUKkubz60tFbGA7ceITTAJsty+lBjNoorP4Z6XRqaFb/OjQjZODophEcuq68nKm6/0r+6/lLQ+XVpk8g=="], + "@smithy/util-utf8": ["@smithy/util-utf8@2.3.0", "", { "dependencies": { "@smithy/util-buffer-from": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A=="], "@snowbridge/api": ["@snowbridge/api@0.2.17", "", { "dependencies": { "@polkadot/api": "16.4.8", "@polkadot/keyring": "13.5.6", "@polkadot/types": "16.4.8", "@polkadot/util": "13.5.6", "@polkadot/util-crypto": "13.5.6", "@snowbridge/base-types": "0.2.17", "@snowbridge/contract-types": "0.2.17", "ethers": "6.15.0" } }, "sha512-XMzz5bhX5/tOt70VeT63OFatEEn5UOqU5YJtBQFzblcPASP0nb0QAgpgecVTaDeX0zQkTO/J2QgfLVmbwAlgJA=="], @@ -1666,15 +1596,13 @@ "@solana/assertions": ["@solana/assertions@5.5.1", "", { "dependencies": { "@solana/errors": "5.5.1" }, "peerDependencies": { "typescript": "^5.0.0" }, "optionalPeers": ["typescript"] }, "sha512-YTCSWAlGwSlVPnWtWLm3ukz81wH4j2YaCveK+TjpvUU88hTy6fmUqxi0+hvAMAe4zKXpJyj3Az7BrLJRxbIm4Q=="], - "@solana/buffer-layout": ["@solana/buffer-layout@4.0.1", "", { "dependencies": { "buffer": "~6.0.3" } }, "sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA=="], - "@solana/codecs": ["@solana/codecs@5.5.1", "", { "dependencies": { "@solana/codecs-core": "5.5.1", "@solana/codecs-data-structures": "5.5.1", "@solana/codecs-numbers": "5.5.1", "@solana/codecs-strings": "5.5.1", "@solana/options": "5.5.1" }, "peerDependencies": { "typescript": "^5.0.0" }, "optionalPeers": ["typescript"] }, "sha512-Vea29nJub/bXjfzEV7ZZQ/PWr1pYLZo3z0qW0LQL37uKKVzVFRQlwetd7INk3YtTD3xm9WUYr7bCvYUk3uKy2g=="], "@solana/codecs-core": ["@solana/codecs-core@5.5.1", "", { "dependencies": { "@solana/errors": "5.5.1" }, "peerDependencies": { "typescript": "^5.0.0" }, "optionalPeers": ["typescript"] }, "sha512-TgBt//bbKBct0t6/MpA8ElaOA3sa8eYVvR7LGslCZ84WiAwwjCY0lW/lOYsFHJQzwREMdUyuEyy5YWBKtdh8Rw=="], "@solana/codecs-data-structures": ["@solana/codecs-data-structures@5.5.1", "", { "dependencies": { "@solana/codecs-core": "5.5.1", "@solana/codecs-numbers": "5.5.1", "@solana/errors": "5.5.1" }, "peerDependencies": { "typescript": "^5.0.0" }, "optionalPeers": ["typescript"] }, "sha512-97bJWGyUY9WvBz3mX1UV3YPWGDTez6btCfD0ip3UVEXJbItVuUiOkzcO5iFDUtQT5riKT6xC+Mzl+0nO76gd0w=="], - "@solana/codecs-numbers": ["@solana/codecs-numbers@2.3.0", "", { "dependencies": { "@solana/codecs-core": "2.3.0", "@solana/errors": "2.3.0" }, "peerDependencies": { "typescript": ">=5.3.3" } }, "sha512-jFvvwKJKffvG7Iz9dmN51OGB7JBcy2CJ6Xf3NqD/VP90xak66m/Lg48T01u5IQ/hc15mChVHiBm+HHuOFDUrQg=="], + "@solana/codecs-numbers": ["@solana/codecs-numbers@5.5.1", "", { "dependencies": { "@solana/codecs-core": "5.5.1", "@solana/errors": "5.5.1" }, "peerDependencies": { "typescript": "^5.0.0" }, "optionalPeers": ["typescript"] }, "sha512-rllMIZAHqmtvC0HO/dc/21wDuWaD0B8Ryv8o+YtsICQBuiL/0U4AGwH7Pi5GNFySYk0/crSuwfIqQFtmxNSPFw=="], "@solana/codecs-strings": ["@solana/codecs-strings@5.5.1", "", { "dependencies": { "@solana/codecs-core": "5.5.1", "@solana/codecs-numbers": "5.5.1", "@solana/errors": "5.5.1" }, "peerDependencies": { "fastestsmallesttextencoderdecoder": "^1.0.22", "typescript": "^5.0.0" }, "optionalPeers": ["fastestsmallesttextencoderdecoder", "typescript"] }, "sha512-7klX4AhfHYA+uKKC/nxRGP2MntbYQCR3N6+v7bk1W/rSxYuhNmt+FN8aoThSZtWIKwN6BEyR1167ka8Co1+E7A=="], @@ -1740,8 +1668,6 @@ "@solana/transactions": ["@solana/transactions@5.5.1", "", { "dependencies": { "@solana/addresses": "5.5.1", "@solana/codecs-core": "5.5.1", "@solana/codecs-data-structures": "5.5.1", "@solana/codecs-numbers": "5.5.1", "@solana/codecs-strings": "5.5.1", "@solana/errors": "5.5.1", "@solana/functional": "5.5.1", "@solana/instructions": "5.5.1", "@solana/keys": "5.5.1", "@solana/nominal-types": "5.5.1", "@solana/rpc-types": "5.5.1", "@solana/transaction-messages": "5.5.1" }, "peerDependencies": { "typescript": "^5.0.0" }, "optionalPeers": ["typescript"] }, "sha512-8hHtDxtqalZ157pnx6p8k10D7J/KY/biLzfgh9R09VNLLY3Fqi7kJvJCr7M2ik3oRll56pxhraAGCC9yIT6eOA=="], - "@solana/web3.js": ["@solana/web3.js@1.98.4", "", { "dependencies": { "@babel/runtime": "^7.25.0", "@noble/curves": "^1.4.2", "@noble/hashes": "^1.4.0", "@solana/buffer-layout": "^4.0.1", "@solana/codecs-numbers": "^2.1.0", "agentkeepalive": "^4.5.0", "bn.js": "^5.2.1", "borsh": "^0.7.0", "bs58": "^4.0.1", "buffer": "6.0.3", "fast-stable-stringify": "^1.0.0", "jayson": "^4.1.1", "node-fetch": "^2.7.0", "rpc-websockets": "^9.0.2", "superstruct": "^2.0.2" } }, "sha512-vv9lfnvjUsRiq//+j5pBdXig0IQdtzA0BRZ3bXEP4KaIyF1CcaydWqgyzQgfZMNIsWNWmG+AUHwPy4AHOD6gpw=="], - "@solidity-parser/parser": ["@solidity-parser/parser@0.20.2", "", {}, "sha512-rbu0bzwNvMcwAjH86hiEAcOeRI2EeK8zCkHDrFykh/Al8mvJeFmjy3UrE7GYQjNwOgbGUUtCn5/k8CB8zIu7QA=="], "@spruceid/siwe-parser": ["@spruceid/siwe-parser@2.1.2", "", { "dependencies": { "@noble/hashes": "^1.1.2", "apg-js": "^4.3.0", "uri-js": "^4.4.1", "valid-url": "^1.0.9" } }, "sha512-d/r3S1LwJyMaRAKQ0awmo9whfXeE88Qt00vRj91q5uv5ATtWIQEGJ67Yr5eSZw5zp1/fZCXZYuEckt8lSkereQ=="], @@ -1782,19 +1708,19 @@ "@substrate/ss58-registry": ["@substrate/ss58-registry@1.51.0", "", {}, "sha512-TWDurLiPxndFgKjVavCniytBIw+t4ViOi7TYp9h/D0NMmkEc9klFTo+827eyEJ0lELpqO207Ey7uGxUa+BS1jQ=="], - "@supabase/auth-js": ["@supabase/auth-js@2.100.0", "", { "dependencies": { "tslib": "2.8.1" } }, "sha512-pdT3ye3UVRN1Cg0wom6BmyY+XTtp5DiJaYnPi6j8ht5i8Lq8kfqxJMJz9GI9YDKk3w1nhGOPnh6Qz5qpyYm+1w=="], + "@supabase/auth-js": ["@supabase/auth-js@2.106.2", "", { "dependencies": { "tslib": "2.8.1" } }, "sha512-VcAjUErkHkhC5Jaf+g/G1qbkQrFh8edaCdHa7pxJmHUjkWKjT7UnYCtPA89XV0N0GIYRkEqJZw5V62CtOxTmBQ=="], - "@supabase/functions-js": ["@supabase/functions-js@2.100.0", "", { "dependencies": { "tslib": "2.8.1" } }, "sha512-keLg79RPwP+uiwHuxFPTFgDRxPV46LM4j/swjyR2GKJgWniTVSsgiBHfbIBDcrQwehLepy09b/9QSHUywtKRWQ=="], + "@supabase/functions-js": ["@supabase/functions-js@2.106.2", "", { "dependencies": { "tslib": "2.8.1" } }, "sha512-oRnr0QrL8H+zTO1YyQ1QjiHZU/957jvubbxSJTUm2XLAgzoGGV9Tahfyd+uvLsBLRVmXLtpU3oyCjdQIvkGMOA=="], - "@supabase/phoenix": ["@supabase/phoenix@0.4.0", "", {}, "sha512-RHSx8bHS02xwfHdAbX5Lpbo6PXbgyf7lTaXTlwtFDPwOIw64NnVRwFAXGojHhjtVYI+PEPNSWwkL90f4agN3bw=="], + "@supabase/phoenix": ["@supabase/phoenix@0.4.2", "", {}, "sha512-YSAGnmDAfuleFCVt3CeurQZAhxRfXWeZIIkwp7NhYzQ1UwW6ePSnzsFAiUm/mbCkfoCf70QQHKW/K6RKh52a4A=="], - "@supabase/postgrest-js": ["@supabase/postgrest-js@2.100.0", "", { "dependencies": { "tslib": "2.8.1" } }, "sha512-xYNvNbBJaXOGcrZ44wxwp5830uo1okMHGS8h8dm3u4f0xcZ39yzbryUsubTJW41MG2gbL/6U57cA4Pi6YMZ9pA=="], + "@supabase/postgrest-js": ["@supabase/postgrest-js@2.106.2", "", { "dependencies": { "tslib": "2.8.1" } }, "sha512-tDOzyPgp9pIRMR2x6C9+uDSJrnXSzxLtt3d7nC+Lrsy3jnJDHYfdQC/xcRyhJE/TOBJ0heSqRKR3UmejDjZxsw=="], - "@supabase/realtime-js": ["@supabase/realtime-js@2.100.0", "", { "dependencies": { "@supabase/phoenix": "^0.4.0", "@types/ws": "^8.18.1", "tslib": "2.8.1", "ws": "^8.18.2" } }, "sha512-2AZs00zzEF0HuCKY8grz5eCYlwEfVi5HONLZFoNR6aDfxQivl8zdQYNjyFoqN2MZiVhQHD7u6XV/xHwM8mCEHw=="], + "@supabase/realtime-js": ["@supabase/realtime-js@2.106.2", "", { "dependencies": { "@supabase/phoenix": "^0.4.2", "tslib": "2.8.1" } }, "sha512-LdRGT7DNhyZkPjubUv5bSdAZ0jSEX8wTHvx7htj7+K59TOZRvz4TuQK7tL2RWxyIZVeFMRluL04SzWS61rKnUA=="], - "@supabase/storage-js": ["@supabase/storage-js@2.100.0", "", { "dependencies": { "iceberg-js": "^0.8.1", "tslib": "2.8.1" } }, "sha512-d4EeuK6RNIgYNA2MU9kj8lQrLm5AzZ+WwpWjGkii6SADQNIGTC/uiaTRu02XJ5AmFALQfo8fLl9xuCkO6Xw+iQ=="], + "@supabase/storage-js": ["@supabase/storage-js@2.106.2", "", { "dependencies": { "iceberg-js": "^0.8.1", "tslib": "2.8.1" } }, "sha512-xgKCSYuev1YarV+iVqr+zlfgSyremnJtn8T0NCT8L4XmMv1CLtESc0Q6kNp8+mKWdX/8ND0nzm7OMKx08kwNAw=="], - "@supabase/supabase-js": ["@supabase/supabase-js@2.100.0", "", { "dependencies": { "@supabase/auth-js": "2.100.0", "@supabase/functions-js": "2.100.0", "@supabase/postgrest-js": "2.100.0", "@supabase/realtime-js": "2.100.0", "@supabase/storage-js": "2.100.0" } }, "sha512-r0tlcukejJXJ1m/2eG/Ya5eYs4W8AC7oZfShpG3+SIo/eIU9uIt76ZeYI1SoUwUmcmzlAbgch+HDZDR/toVQPQ=="], + "@supabase/supabase-js": ["@supabase/supabase-js@2.106.2", "", { "dependencies": { "@supabase/auth-js": "2.106.2", "@supabase/functions-js": "2.106.2", "@supabase/postgrest-js": "2.106.2", "@supabase/realtime-js": "2.106.2", "@supabase/storage-js": "2.106.2" } }, "sha512-2/RZ/1fmJx/MRSEDG2Xk8+J4JVk5clM9V0uSI6kUTrcS32KA89DtqI5RUOC9r6mzY3WBC9qexLjssIHjbLyVJA=="], "@swc-node/core": ["@swc-node/core@1.14.1", "", { "peerDependencies": { "@swc/core": ">= 1.13.3", "@swc/types": ">= 0.1" } }, "sha512-jrt5GUaZUU6cmMS+WTJEvGvaB6j1YNKPHPzC2PUi2BjaFbtxURHj6641Az6xN7b665hNniAIdvjxWcRml5yCnw=="], @@ -1804,69 +1730,67 @@ "@swc/cli": ["@swc/cli@0.5.2", "", { "dependencies": { "@swc/counter": "^0.1.3", "@xhmikosr/bin-wrapper": "^13.0.5", "commander": "^8.3.0", "fast-glob": "^3.2.5", "minimatch": "^9.0.3", "piscina": "^4.3.1", "semver": "^7.3.8", "slash": "3.0.0", "source-map": "^0.7.3" }, "peerDependencies": { "@swc/core": "^1.2.66", "chokidar": "^3.5.1" }, "optionalPeers": ["chokidar"], "bin": { "swc": "bin/swc.js", "swcx": "bin/swcx.js", "spack": "bin/spack.js" } }, "sha512-ul2qIqjM5bfe9zWLqFDmHZCf9HXXSZZAlZLe4czn+lH4PewO+OWZnQcYCscnJKlbx6MuWjzXVR7gkspjNEJwJA=="], - "@swc/core": ["@swc/core@1.15.21", "", { "dependencies": { "@swc/counter": "^0.1.3", "@swc/types": "^0.1.25" }, "optionalDependencies": { "@swc/core-darwin-arm64": "1.15.21", "@swc/core-darwin-x64": "1.15.21", "@swc/core-linux-arm-gnueabihf": "1.15.21", "@swc/core-linux-arm64-gnu": "1.15.21", "@swc/core-linux-arm64-musl": "1.15.21", "@swc/core-linux-ppc64-gnu": "1.15.21", "@swc/core-linux-s390x-gnu": "1.15.21", "@swc/core-linux-x64-gnu": "1.15.21", "@swc/core-linux-x64-musl": "1.15.21", "@swc/core-win32-arm64-msvc": "1.15.21", "@swc/core-win32-ia32-msvc": "1.15.21", "@swc/core-win32-x64-msvc": "1.15.21" }, "peerDependencies": { "@swc/helpers": ">=0.5.17" }, "optionalPeers": ["@swc/helpers"] }, "sha512-fkk7NJcBscrR3/F8jiqlMptRHP650NxqDnspBMrRe5d8xOoCy9MLL5kOBLFXjFLfMo3KQQHhk+/jUULOMlR1uQ=="], + "@swc/core": ["@swc/core@1.15.40", "", { "dependencies": { "@swc/counter": "^0.1.3", "@swc/types": "^0.1.26" }, "optionalDependencies": { "@swc/core-darwin-arm64": "1.15.40", "@swc/core-darwin-x64": "1.15.40", "@swc/core-linux-arm-gnueabihf": "1.15.40", "@swc/core-linux-arm64-gnu": "1.15.40", "@swc/core-linux-arm64-musl": "1.15.40", "@swc/core-linux-ppc64-gnu": "1.15.40", "@swc/core-linux-s390x-gnu": "1.15.40", "@swc/core-linux-x64-gnu": "1.15.40", "@swc/core-linux-x64-musl": "1.15.40", "@swc/core-win32-arm64-msvc": "1.15.40", "@swc/core-win32-ia32-msvc": "1.15.40", "@swc/core-win32-x64-msvc": "1.15.40" }, "peerDependencies": { "@swc/helpers": ">=0.5.17" }, "optionalPeers": ["@swc/helpers"] }, "sha512-2kwzJikRvgtNAG7MwVZY2vEzZjTxKIq5jXOihuSV/8U+Hej8Va22t65aKnJZs3P+NwojZvR8Mf8kyM7O+V8sQg=="], - "@swc/core-darwin-arm64": ["@swc/core-darwin-arm64@1.15.21", "", { "os": "darwin", "cpu": "arm64" }, "sha512-SA8SFg9dp0qKRH8goWsax6bptFE2EdmPf2YRAQW9WoHGf3XKM1bX0nd5UdwxmC5hXsBUZAYf7xSciCler6/oyA=="], + "@swc/core-darwin-arm64": ["@swc/core-darwin-arm64@1.15.40", "", { "os": "darwin", "cpu": "arm64" }, "sha512-PaYyclfmQ++77D8ityYvmmVzHv9aG8ROwt2GfG6/ccloy4Hgf80qtOnzb9VYvPsUT7Ty1uhuDRhv3XYpf62qhQ=="], - "@swc/core-darwin-x64": ["@swc/core-darwin-x64@1.15.21", "", { "os": "darwin", "cpu": "x64" }, "sha512-//fOVntgowz9+V90lVsNCtyyrtbHp3jWH6Rch7MXHXbcvbLmbCTmssl5DeedUWLLGiAAW1wksBdqdGYOTjaNLw=="], + "@swc/core-darwin-x64": ["@swc/core-darwin-x64@1.15.40", "", { "os": "darwin", "cpu": "x64" }, "sha512-HbbPzvfLBUXjIB1Ezks+//lNUjmLjfyd63XSwprJgrZaXYdm70kohXPJUWdqKZozolFxbPaO+xtBaiUp6BoueA=="], - "@swc/core-linux-arm-gnueabihf": ["@swc/core-linux-arm-gnueabihf@1.15.21", "", { "os": "linux", "cpu": "arm" }, "sha512-meNI4Sh6h9h8DvIfEc0l5URabYMSuNvyisLmG6vnoYAS43s8ON3NJR8sDHvdP7NJTrLe0q/x2XCn6yL/BeHcZg=="], + "@swc/core-linux-arm-gnueabihf": ["@swc/core-linux-arm-gnueabihf@1.15.40", "", { "os": "linux", "cpu": "arm" }, "sha512-SlRZsCjOCPR2LvFs0Ri/Xrx/5o5TCt8vl4gW6mX1hEZOG0a625RxzRHpHdAQNGykmAN/7IeaFAJG+QnNmxlHcA=="], - "@swc/core-linux-arm64-gnu": ["@swc/core-linux-arm64-gnu@1.15.21", "", { "os": "linux", "cpu": "arm64" }, "sha512-QrXlNQnHeXqU2EzLlnsPoWEh8/GtNJLvfMiPsDhk+ht6Xv8+vhvZ5YZ/BokNWSIZiWPKLAqR0M7T92YF5tmD3g=="], + "@swc/core-linux-arm64-gnu": ["@swc/core-linux-arm64-gnu@1.15.40", "", { "os": "linux", "cpu": "arm64" }, "sha512-Q8byxJt2fh8CR3EUX6snBpy47AoBVm+In/+Z3rjDHMjC38ZvR9/gtUUNCT0tfrn4EdVsO8/QPi59nxrxvqxvBQ=="], - "@swc/core-linux-arm64-musl": ["@swc/core-linux-arm64-musl@1.15.21", "", { "os": "linux", "cpu": "arm64" }, "sha512-8/yGCMO333ultDaMQivE5CjO6oXDPeeg1IV4sphojPkb0Pv0i6zvcRIkgp60xDB+UxLr6VgHgt+BBgqS959E9g=="], + "@swc/core-linux-arm64-musl": ["@swc/core-linux-arm64-musl@1.15.40", "", { "os": "linux", "cpu": "arm64" }, "sha512-4z0MgHU+7M0pZDqBN1El7mFXDI1SBwinfcUkAyA4v8QrhOIUOZltySt2aStQLZGrdXVXM4Y4ylfiTC04ED+MoQ=="], - "@swc/core-linux-ppc64-gnu": ["@swc/core-linux-ppc64-gnu@1.15.21", "", { "os": "linux", "cpu": "ppc64" }, "sha512-ucW0HzPx0s1dgRvcvuLSPSA/2Kk/VYTv9st8qe1Kc22Gu0Q0rH9+6TcBTmMuNIp0Xs4BPr1uBttmbO1wEGI49Q=="], + "@swc/core-linux-ppc64-gnu": ["@swc/core-linux-ppc64-gnu@1.15.40", "", { "os": "linux", "cpu": "ppc64" }, "sha512-fLI4iUgeSZu0eRWUXwe6YzPFx9gHbFiPkl8Rp3mJfP8OpNR3nTQCGPvHdDh9xniW7mVvgMY4ni7A4VzqI1KrpA=="], - "@swc/core-linux-s390x-gnu": ["@swc/core-linux-s390x-gnu@1.15.21", "", { "os": "linux", "cpu": "s390x" }, "sha512-ulTnOGc5I7YRObE/9NreAhQg94QkiR5qNhhcUZ1iFAYjzg/JGAi1ch+s/Ixe61pMIr8bfVrF0NOaB0f8wjaAfA=="], + "@swc/core-linux-s390x-gnu": ["@swc/core-linux-s390x-gnu@1.15.40", "", { "os": "linux", "cpu": "s390x" }, "sha512-YqeKMAb7d4nQSGMJQ454IlaCENpzcDqhvBE9+CPfdnYpnUXxd+BSrB6Xk0YjW8UyoEhUj4p6quATCxbsp6J3jg=="], - "@swc/core-linux-x64-gnu": ["@swc/core-linux-x64-gnu@1.15.21", "", { "os": "linux", "cpu": "x64" }, "sha512-D0RokxtM+cPvSqJIKR6uja4hbD+scI9ezo95mBhfSyLUs9wnPPl26sLp1ZPR/EXRdYm3F3S6RUtVi+8QXhT24Q=="], + "@swc/core-linux-x64-gnu": ["@swc/core-linux-x64-gnu@1.15.40", "", { "os": "linux", "cpu": "x64" }, "sha512-7HOuS1iGcme/j/TuL1TfmmLGiMQrjv/GmjyZeydl00FKPtpGXEldwqfI56xgd1YzrzoB2svWjxbGGyQ0TEASxg=="], - "@swc/core-linux-x64-musl": ["@swc/core-linux-x64-musl@1.15.21", "", { "os": "linux", "cpu": "x64" }, "sha512-nER8u7VeRfmU6fMDzl1NQAbbB/G7O2avmvCOwIul1uGkZ2/acbPH+DCL9h5+0yd/coNcxMBTL6NGepIew+7C2w=="], + "@swc/core-linux-x64-musl": ["@swc/core-linux-x64-musl@1.15.40", "", { "os": "linux", "cpu": "x64" }, "sha512-h4kZYHc7dpc9P9u4brRJaS8Pl7tPVHAeiLSzw7T5RfIJgAoSdaCMKzI/2Uay9gFhaw8uyCDl0L5q37r0EpAfIA=="], - "@swc/core-win32-arm64-msvc": ["@swc/core-win32-arm64-msvc@1.15.21", "", { "os": "win32", "cpu": "arm64" }, "sha512-+/AgNBnjYugUA8C0Do4YzymgvnGbztv7j8HKSQLvR/DQgZPoXQ2B3PqB2mTtGh/X5DhlJWiqnunN35JUgWcAeQ=="], + "@swc/core-win32-arm64-msvc": ["@swc/core-win32-arm64-msvc@1.15.40", "", { "os": "win32", "cpu": "arm64" }, "sha512-+mQgKZXSj6mV38Zh05QaxSjUDmGP/R2JWlXZTDLSPkDzHU6p3GxN9eeSf5dfyDVU86946fmCvSzyl/ucImx8+A=="], - "@swc/core-win32-ia32-msvc": ["@swc/core-win32-ia32-msvc@1.15.21", "", { "os": "win32", "cpu": "ia32" }, "sha512-IkSZj8PX/N4HcaFhMQtzmkV8YSnuNoJ0E6OvMwFiOfejPhiKXvl7CdDsn1f4/emYEIDO3fpgZW9DTaCRMDxaDA=="], + "@swc/core-win32-ia32-msvc": ["@swc/core-win32-ia32-msvc@1.15.40", "", { "os": "win32", "cpu": "ia32" }, "sha512-yvwdPLGd25mcj/mNatjNQ0lZujtQD6psH3v9PNmMb+fSzjbNG8KIDxjFWrcV+fsFVLOkyOmdJsFmX7NAFjVyPw=="], - "@swc/core-win32-x64-msvc": ["@swc/core-win32-x64-msvc@1.15.21", "", { "os": "win32", "cpu": "x64" }, "sha512-zUyWso7OOENB6e1N1hNuNn8vbvLsTdKQ5WKLgt/JcBNfJhKy/6jmBmqI3GXk/MyvQKd5SLvP7A0F36p7TeDqvw=="], + "@swc/core-win32-x64-msvc": ["@swc/core-win32-x64-msvc@1.15.40", "", { "os": "win32", "cpu": "x64" }, "sha512-OXtKsLU1bVtInzzDEAY2sYiF/rl4tvAnLLLpuMp3HzAOQZ5A+i69AKDhA1YLQTaMAqO3vzyYNVAYVRMPtSYD4w=="], "@swc/counter": ["@swc/counter@0.1.3", "", {}, "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ=="], - "@swc/helpers": ["@swc/helpers@0.5.19", "", { "dependencies": { "tslib": "^2.8.0" } }, "sha512-QamiFeIK3txNjgUTNppE6MiG3p7TdninpZu0E0PbqVh1a9FNLT2FRhisaa4NcaX52XVhA5l7Pk58Ft7Sqi/2sA=="], - "@swc/types": ["@swc/types@0.1.26", "", { "dependencies": { "@swc/counter": "^0.1.3" } }, "sha512-lyMwd7WGgG79RS7EERZV3T8wMdmPq3xwyg+1nmAM64kIhx5yl+juO2PYIHb7vTiPgPCj8LYjsNV2T5wiQHUEaw=="], "@szmarczak/http-timer": ["@szmarczak/http-timer@5.0.1", "", { "dependencies": { "defer-to-connect": "^2.0.1" } }, "sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw=="], - "@tailwindcss/node": ["@tailwindcss/node@4.2.2", "", { "dependencies": { "@jridgewell/remapping": "^2.3.5", "enhanced-resolve": "^5.19.0", "jiti": "^2.6.1", "lightningcss": "1.32.0", "magic-string": "^0.30.21", "source-map-js": "^1.2.1", "tailwindcss": "4.2.2" } }, "sha512-pXS+wJ2gZpVXqFaUEjojq7jzMpTGf8rU6ipJz5ovJV6PUGmlJ+jvIwGrzdHdQ80Sg+wmQxUFuoW1UAAwHNEdFA=="], + "@tailwindcss/node": ["@tailwindcss/node@4.3.0", "", { "dependencies": { "@jridgewell/remapping": "^2.3.5", "enhanced-resolve": "^5.21.0", "jiti": "^2.6.1", "lightningcss": "1.32.0", "magic-string": "^0.30.21", "source-map-js": "^1.2.1", "tailwindcss": "4.3.0" } }, "sha512-aFb4gUhFOgdh9AXo4IzBEOzBkkAxm9VigwDJnMIYv3lcfXCJVesNfbEaBl4BNgVRyid92AmdviqwBUBRKSeY3g=="], - "@tailwindcss/oxide": ["@tailwindcss/oxide@4.2.2", "", { "optionalDependencies": { "@tailwindcss/oxide-android-arm64": "4.2.2", "@tailwindcss/oxide-darwin-arm64": "4.2.2", "@tailwindcss/oxide-darwin-x64": "4.2.2", "@tailwindcss/oxide-freebsd-x64": "4.2.2", "@tailwindcss/oxide-linux-arm-gnueabihf": "4.2.2", "@tailwindcss/oxide-linux-arm64-gnu": "4.2.2", "@tailwindcss/oxide-linux-arm64-musl": "4.2.2", "@tailwindcss/oxide-linux-x64-gnu": "4.2.2", "@tailwindcss/oxide-linux-x64-musl": "4.2.2", "@tailwindcss/oxide-wasm32-wasi": "4.2.2", "@tailwindcss/oxide-win32-arm64-msvc": "4.2.2", "@tailwindcss/oxide-win32-x64-msvc": "4.2.2" } }, "sha512-qEUA07+E5kehxYp9BVMpq9E8vnJuBHfJEC0vPC5e7iL/hw7HR61aDKoVoKzrG+QKp56vhNZe4qwkRmMC0zDLvg=="], + "@tailwindcss/oxide": ["@tailwindcss/oxide@4.3.0", "", { "optionalDependencies": { "@tailwindcss/oxide-android-arm64": "4.3.0", "@tailwindcss/oxide-darwin-arm64": "4.3.0", "@tailwindcss/oxide-darwin-x64": "4.3.0", "@tailwindcss/oxide-freebsd-x64": "4.3.0", "@tailwindcss/oxide-linux-arm-gnueabihf": "4.3.0", "@tailwindcss/oxide-linux-arm64-gnu": "4.3.0", "@tailwindcss/oxide-linux-arm64-musl": "4.3.0", "@tailwindcss/oxide-linux-x64-gnu": "4.3.0", "@tailwindcss/oxide-linux-x64-musl": "4.3.0", "@tailwindcss/oxide-wasm32-wasi": "4.3.0", "@tailwindcss/oxide-win32-arm64-msvc": "4.3.0", "@tailwindcss/oxide-win32-x64-msvc": "4.3.0" } }, "sha512-F7HZGBeN9I0/AuuJS5PwcD8xayx5ri5GhjYUDBEVYUkexyA/giwbDNjRVrxSezE3T250OU2K/wp/ltWx3UOefg=="], - "@tailwindcss/oxide-android-arm64": ["@tailwindcss/oxide-android-arm64@4.2.2", "", { "os": "android", "cpu": "arm64" }, "sha512-dXGR1n+P3B6748jZO/SvHZq7qBOqqzQ+yFrXpoOWWALWndF9MoSKAT3Q0fYgAzYzGhxNYOoysRvYlpixRBBoDg=="], + "@tailwindcss/oxide-android-arm64": ["@tailwindcss/oxide-android-arm64@4.3.0", "", { "os": "android", "cpu": "arm64" }, "sha512-TJPiq67tKlLuObP6RkwvVGDoxCMBVtDgKkLfa/uyj7/FyxvQwHS+UOnVrXXgbEsfUaMgiVvC4KbJnRr26ho4Ng=="], - "@tailwindcss/oxide-darwin-arm64": ["@tailwindcss/oxide-darwin-arm64@4.2.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-iq9Qjr6knfMpZHj55/37ouZeykwbDqF21gPFtfnhCCKGDcPI/21FKC9XdMO/XyBM7qKORx6UIhGgg6jLl7BZlg=="], + "@tailwindcss/oxide-darwin-arm64": ["@tailwindcss/oxide-darwin-arm64@4.3.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-oMN/WZRb+SO37BmUElEgeEWuU8E/HXRkiODxJxLe1UTHVXLrdVSgfaJV7pSlhRGMSOiXLuxTIjfsF3wYvz8cgQ=="], - "@tailwindcss/oxide-darwin-x64": ["@tailwindcss/oxide-darwin-x64@4.2.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-BlR+2c3nzc8f2G639LpL89YY4bdcIdUmiOOkv2GQv4/4M0vJlpXEa0JXNHhCHU7VWOKWT/CjqHdTP8aUuDJkuw=="], + "@tailwindcss/oxide-darwin-x64": ["@tailwindcss/oxide-darwin-x64@4.3.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-N6CUmu4a6bKVADfw77p+iw6Yd9Q3OBhe0veaDX+QazfuVYlQsHfDgxBrsjQ/IW+zywL8mTrNd0SdJT/zgtvMdA=="], - "@tailwindcss/oxide-freebsd-x64": ["@tailwindcss/oxide-freebsd-x64@4.2.2", "", { "os": "freebsd", "cpu": "x64" }, "sha512-YUqUgrGMSu2CDO82hzlQ5qSb5xmx3RUrke/QgnoEx7KvmRJHQuZHZmZTLSuuHwFf0DJPybFMXMYf+WJdxHy/nQ=="], + "@tailwindcss/oxide-freebsd-x64": ["@tailwindcss/oxide-freebsd-x64@4.3.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-zDL5hBkQdH5C6MpqbK3gQAgP80tsMwSI26vjOzjJtNCMUo0lFgOItzHKBIupOZNQxt3ouPH7RPhvNhiTfCe5CQ=="], - "@tailwindcss/oxide-linux-arm-gnueabihf": ["@tailwindcss/oxide-linux-arm-gnueabihf@4.2.2", "", { "os": "linux", "cpu": "arm" }, "sha512-FPdhvsW6g06T9BWT0qTwiVZYE2WIFo2dY5aCSpjG/S/u1tby+wXoslXS0kl3/KXnULlLr1E3NPRRw0g7t2kgaQ=="], + "@tailwindcss/oxide-linux-arm-gnueabihf": ["@tailwindcss/oxide-linux-arm-gnueabihf@4.3.0", "", { "os": "linux", "cpu": "arm" }, "sha512-R06HdNi7A7OEoMsf6d4tjZ71RCWnZQPHj2mnotSFURjNLdBC+cIgXQ7l81CqeoiQftjf6OOblxXMInMgN2VzMA=="], - "@tailwindcss/oxide-linux-arm64-gnu": ["@tailwindcss/oxide-linux-arm64-gnu@4.2.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-4og1V+ftEPXGttOO7eCmW7VICmzzJWgMx+QXAJRAhjrSjumCwWqMfkDrNu1LXEQzNAwz28NCUpucgQPrR4S2yw=="], + "@tailwindcss/oxide-linux-arm64-gnu": ["@tailwindcss/oxide-linux-arm64-gnu@4.3.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-qTJHELX8jetjhRQHCLilkVLmybpzNQAtaI/gaoVoidn/ufbNDbAo8KlK2J+yPoc8wQxvDxCmh/5lr8nC1+lTbg=="], - "@tailwindcss/oxide-linux-arm64-musl": ["@tailwindcss/oxide-linux-arm64-musl@4.2.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-oCfG/mS+/+XRlwNjnsNLVwnMWYH7tn/kYPsNPh+JSOMlnt93mYNCKHYzylRhI51X+TbR+ufNhhKKzm6QkqX8ag=="], + "@tailwindcss/oxide-linux-arm64-musl": ["@tailwindcss/oxide-linux-arm64-musl@4.3.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-Z6sukiQsngnWO+l39X4pPbiWT81IC+PLKF+PHxIlyZbGNb9MODfYlXEVlFvej5BOZInWX01kVyzeLvHsXhfczQ=="], - "@tailwindcss/oxide-linux-x64-gnu": ["@tailwindcss/oxide-linux-x64-gnu@4.2.2", "", { "os": "linux", "cpu": "x64" }, "sha512-rTAGAkDgqbXHNp/xW0iugLVmX62wOp2PoE39BTCGKjv3Iocf6AFbRP/wZT/kuCxC9QBh9Pu8XPkv/zCZB2mcMg=="], + "@tailwindcss/oxide-linux-x64-gnu": ["@tailwindcss/oxide-linux-x64-gnu@4.3.0", "", { "os": "linux", "cpu": "x64" }, "sha512-DRNdQRpSGzRGfARVuVkxvM8Q12nh19l4BF/G7zGA1oe+9wcC6saFBHTISrpIcKzhiXtSrlSrluCfvMuledoCTQ=="], - "@tailwindcss/oxide-linux-x64-musl": ["@tailwindcss/oxide-linux-x64-musl@4.2.2", "", { "os": "linux", "cpu": "x64" }, "sha512-XW3t3qwbIwiSyRCggeO2zxe3KWaEbM0/kW9e8+0XpBgyKU4ATYzcVSMKteZJ1iukJ3HgHBjbg9P5YPRCVUxlnQ=="], + "@tailwindcss/oxide-linux-x64-musl": ["@tailwindcss/oxide-linux-x64-musl@4.3.0", "", { "os": "linux", "cpu": "x64" }, "sha512-Z0IADbDo8bh6I7h2IQMx601AdXBLfFpEdUotft86evd/8ZPflZe9COPO8Q1vw+pfLWIUo9zN/JGZvwuAJqduqg=="], - "@tailwindcss/oxide-wasm32-wasi": ["@tailwindcss/oxide-wasm32-wasi@4.2.2", "", { "dependencies": { "@emnapi/core": "^1.8.1", "@emnapi/runtime": "^1.8.1", "@emnapi/wasi-threads": "^1.1.0", "@napi-rs/wasm-runtime": "^1.1.1", "@tybys/wasm-util": "^0.10.1", "tslib": "^2.8.1" }, "cpu": "none" }, "sha512-eKSztKsmEsn1O5lJ4ZAfyn41NfG7vzCg496YiGtMDV86jz1q/irhms5O0VrY6ZwTUkFy/EKG3RfWgxSI3VbZ8Q=="], + "@tailwindcss/oxide-wasm32-wasi": ["@tailwindcss/oxide-wasm32-wasi@4.3.0", "", { "dependencies": { "@emnapi/core": "^1.10.0", "@emnapi/runtime": "^1.10.0", "@emnapi/wasi-threads": "^1.2.1", "@napi-rs/wasm-runtime": "^1.1.4", "@tybys/wasm-util": "^0.10.1", "tslib": "^2.8.1" }, "cpu": "none" }, "sha512-HNZGOUxEmElksYR7S6sC5jTeNGpobAsy9u7Gu0AskJ8/20FR9GqebUyB+HBcU/ax6BHuiuJi+Oda4B+YX6H1yA=="], - "@tailwindcss/oxide-win32-arm64-msvc": ["@tailwindcss/oxide-win32-arm64-msvc@4.2.2", "", { "os": "win32", "cpu": "arm64" }, "sha512-qPmaQM4iKu5mxpsrWZMOZRgZv1tOZpUm+zdhhQP0VhJfyGGO3aUKdbh3gDZc/dPLQwW4eSqWGrrcWNBZWUWaXQ=="], + "@tailwindcss/oxide-win32-arm64-msvc": ["@tailwindcss/oxide-win32-arm64-msvc@4.3.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-Pe+RPVTi1T+qymuuRpcdvwSVZjnll/f7n8gBxMMh3xLTctMDKqpdfGimbMyioqtLhUYZxdJ9wGNhV7MKHvgZsQ=="], - "@tailwindcss/oxide-win32-x64-msvc": ["@tailwindcss/oxide-win32-x64-msvc@4.2.2", "", { "os": "win32", "cpu": "x64" }, "sha512-1T/37VvI7WyH66b+vqHj/cLwnCxt7Qt3WFu5Q8hk65aOvlwAhs7rAp1VkulBJw/N4tMirXjVnylTR72uI0HGcA=="], + "@tailwindcss/oxide-win32-x64-msvc": ["@tailwindcss/oxide-win32-x64-msvc@4.3.0", "", { "os": "win32", "cpu": "x64" }, "sha512-Mvrf2kXW/yeW/OTezZlCGOirXRcUuLIBx/5Y12BaPM7wJoryG6dfS/NJL8aBPqtTEx/Vm4T4vKzFUcKDT+TKUA=="], - "@tailwindcss/vite": ["@tailwindcss/vite@4.2.2", "", { "dependencies": { "@tailwindcss/node": "4.2.2", "@tailwindcss/oxide": "4.2.2", "tailwindcss": "4.2.2" }, "peerDependencies": { "vite": "^5.2.0 || ^6 || ^7 || ^8" } }, "sha512-mEiF5HO1QqCLXoNEfXVA1Tzo+cYsrqV7w9Juj2wdUFyW07JRenqMG225MvPwr3ZD9N1bFQj46X7r33iHxLUW0w=="], + "@tailwindcss/vite": ["@tailwindcss/vite@4.3.0", "", { "dependencies": { "@tailwindcss/node": "4.3.0", "@tailwindcss/oxide": "4.3.0", "tailwindcss": "4.3.0" }, "peerDependencies": { "vite": "^5.2.0 || ^6 || ^7 || ^8" } }, "sha512-t6J3OrB5Fc0ExuhohouH0fWUGMYL6PTLhW+E7zIk/pdbnJARZDCwjBznFnkh5ynRnIRSI4YjtTH0t6USjJISrw=="], "@talismn/connect-components": ["@talismn/connect-components@1.1.9", "", { "dependencies": { "@talismn/connect-ui": "1.1.4", "@talismn/connect-wallets": "1.2.8" }, "peerDependencies": { "react": ">=18.2.0", "react-dom": ">=18.2.0" } }, "sha512-7rR9y9yH0ajm4fsLeHe+zDNES5+EOjWeGOkAlo9p+9IKpfgGBGrWThmGlKmOzGIXU0koeueirTLSZsBd8h6Tsw=="], @@ -1874,41 +1798,41 @@ "@talismn/connect-wallets": ["@talismn/connect-wallets@1.2.8", "", { "peerDependencies": { "@polkadot/api": ">=9.3.3", "@polkadot/extension-inject": ">=0.44.6" } }, "sha512-/aniEZxOUNOaOEctHDUb/1jNFgKNsmeQ3L+pm4KvfYqb+C3HjZeBxykHEIc+5xmdR0GgCm30N8QzYWv6voM/lQ=="], - "@tanstack/history": ["@tanstack/history@1.161.6", "", {}, "sha512-NaOGLRrddszbQj9upGat6HG/4TKvXLvu+osAIgfxPYA+eIvYKv8GKDJOrY2D3/U9MRnKfMWD7bU4jeD4xmqyIg=="], + "@tanstack/history": ["@tanstack/history@1.162.0", "", {}, "sha512-79pf/RkhteYZTRgcR4F9kbk84P2N8rugQJswxfIqovlbRiT3yI7eBE+5QorIrZaOKktsgzRlXh1l/du/xpl4iA=="], - "@tanstack/query-core": ["@tanstack/query-core@5.95.2", "", {}, "sha512-o4T8vZHZET4Bib3jZ/tCW9/7080urD4c+0/AUaYVpIqOsr7y0reBc1oX3ttNaSW5mYyvZHctiQ/UOP2PfdmFEQ=="], + "@tanstack/query-core": ["@tanstack/query-core@5.100.14", "", {}, "sha512-5X41dGpxgeaHISCRW2oYwcSycZeULZzAunaudXT9ov1KOTj9xwt0CH6hbwqP1/z74ZWF7rYFnDpyYH07XFcZew=="], - "@tanstack/query-devtools": ["@tanstack/query-devtools@5.95.2", "", {}, "sha512-QfaoqBn9uAZ+ICkA8brd1EHj+qBF6glCFgt94U8XP5BT6ppSsDBI8IJ00BU+cAGjQzp6wcKJL2EmRYvxy0TWIg=="], + "@tanstack/query-devtools": ["@tanstack/query-devtools@5.100.14", "", {}, "sha512-g96SmSSQecYTYcyuAMRXr895GplJv01UGt7qttQWPOUyZ5EGz5tbRc589bMc2m5BsPFD6O0PCEAHdbDYNP6UBw=="], - "@tanstack/react-query": ["@tanstack/react-query@5.95.2", "", { "dependencies": { "@tanstack/query-core": "5.95.2" }, "peerDependencies": { "react": "^18 || ^19" } }, "sha512-/wGkvLj/st5Ud1Q76KF1uFxScV7WeqN1slQx5280ycwAyYkIPGaRZAEgHxe3bjirSd5Zpwkj6zNcR4cqYni/ZA=="], + "@tanstack/react-query": ["@tanstack/react-query@5.100.14", "", { "dependencies": { "@tanstack/query-core": "5.100.14" }, "peerDependencies": { "react": "^18 || ^19" } }, "sha512-oOr6aRdSFEwWhzxEkD/9ZcItM3+LjBSkeVmadWKwUssAHTsqd/7bOjWrX4AbvEkoEhgAxzN0Xk6H/aYzXiYBAw=="], - "@tanstack/react-query-devtools": ["@tanstack/react-query-devtools@5.95.2", "", { "dependencies": { "@tanstack/query-devtools": "5.95.2" }, "peerDependencies": { "@tanstack/react-query": "^5.95.2", "react": "^18 || ^19" } }, "sha512-AFQFmbznVkbtfpx8VJ2DylW17wWagQel/qLstVLkYmNRo2CmJt3SNej5hvl6EnEeljJIdC3BTB+W7HZtpsH+3g=="], + "@tanstack/react-query-devtools": ["@tanstack/react-query-devtools@5.100.14", "", { "dependencies": { "@tanstack/query-devtools": "5.100.14" }, "peerDependencies": { "@tanstack/react-query": "^5.100.14", "react": "^18 || ^19" } }, "sha512-JkP5VDgKOw3t/QSA1OABRHEqx8BuNs5MfvZRooNqdvN57SzTuGq3fKR1a2IH5rqa5HDLUm+FOXUEnB9ueHiLzg=="], - "@tanstack/react-router": ["@tanstack/react-router@1.168.3", "", { "dependencies": { "@tanstack/history": "1.161.6", "@tanstack/react-store": "^0.9.2", "@tanstack/router-core": "1.168.3", "isbot": "^5.1.22" }, "peerDependencies": { "react": ">=18.0.0 || >=19.0.0", "react-dom": ">=18.0.0 || >=19.0.0" } }, "sha512-hMWXhckeaSvjepHT5x9tUYJVXMvT/kUjaVHOUDmCfyOBtjxJNYJKbEWClXoopGwWlHjRTAzhsndhnQQRbIiKmA=="], + "@tanstack/react-router": ["@tanstack/react-router@1.170.8", "", { "dependencies": { "@tanstack/history": "1.162.0", "@tanstack/react-store": "^0.9.3", "@tanstack/router-core": "1.171.6", "isbot": "^5.1.22" }, "peerDependencies": { "react": ">=18.0.0 || >=19.0.0", "react-dom": ">=18.0.0 || >=19.0.0" } }, "sha512-Qw2ju6jjnIsMpuW+VrnHZWHuugqs592PWsnI56sG28qNhg14CgRLahOcNajfuJR9P4MxKGP94WVzmFKSYUz/ig=="], - "@tanstack/react-router-devtools": ["@tanstack/react-router-devtools@1.166.11", "", { "dependencies": { "@tanstack/router-devtools-core": "1.167.1" }, "peerDependencies": { "@tanstack/react-router": "^1.168.2", "@tanstack/router-core": "^1.168.2", "react": ">=18.0.0 || >=19.0.0", "react-dom": ">=18.0.0 || >=19.0.0" }, "optionalPeers": ["@tanstack/router-core"] }, "sha512-WYR3q4Xui5yPT/5PXtQh8i03iUA7q8dONBjWpV3nsGdM8Cs1FxpfhLstW0wZO1dOvSyElscwTRCJ6nO5N8r3Lg=="], + "@tanstack/react-router-devtools": ["@tanstack/react-router-devtools@1.167.0", "", { "dependencies": { "@tanstack/router-devtools-core": "1.168.0" }, "peerDependencies": { "@tanstack/react-router": "^1.170.0", "@tanstack/router-core": "^1.170.0", "react": ">=18.0.0 || >=19.0.0", "react-dom": ">=18.0.0 || >=19.0.0" }, "optionalPeers": ["@tanstack/router-core"] }, "sha512-nGw095EG7IHx0h5NtlEmzf6vcCTaFNPWdTSuDKazajhN0ct/v/TkekJ9J6KYUCeV1a8/2ZmToc58M+0rrOyn7w=="], - "@tanstack/react-store": ["@tanstack/react-store@0.9.2", "", { "dependencies": { "@tanstack/store": "0.9.2", "use-sync-external-store": "^1.6.0" }, "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-Vt5usJE5sHG/cMechQfmwvwne6ktGCELe89Lmvoxe3LKRoFrhPa8OCKWs0NliG8HTJElEIj7PLtaBQIcux5pAQ=="], + "@tanstack/react-store": ["@tanstack/react-store@0.9.3", "", { "dependencies": { "@tanstack/store": "0.9.3", "use-sync-external-store": "^1.6.0" }, "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-y2iHd/N9OkoQbFJLUX1T9vbc2O9tjH0pQRgTcx1/Nz4IlwLvkgpuglXUx+mXt0g5ZDFrEeDnONPqkbfxXJKwRg=="], - "@tanstack/react-virtual": ["@tanstack/react-virtual@3.13.23", "", { "dependencies": { "@tanstack/virtual-core": "3.13.23" }, "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-XnMRnHQ23piOVj2bzJqHrRrLg4r+F86fuBcwteKfbIjJrtGxb4z7tIvPVAe4B+4UVwo9G4Giuz5fmapcrnZ0OQ=="], + "@tanstack/react-virtual": ["@tanstack/react-virtual@3.13.26", "", { "dependencies": { "@tanstack/virtual-core": "3.16.0" }, "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-DosdgjOxCLahkn0o+ilmZYwEjo1glfMGuRT/j3PQ18yr5XqA8N/BCaL9IJ3B5TRl+nnzyK2IOFgAILwzN3a9xQ=="], - "@tanstack/router-core": ["@tanstack/router-core@1.168.3", "", { "dependencies": { "@tanstack/history": "1.161.6", "cookie-es": "^2.0.0", "seroval": "^1.4.2", "seroval-plugins": "^1.4.2" }, "bin": { "intent": "bin/intent.js" } }, "sha512-qcjArls3v12UQQkEpU0+todc0/MCyrEZeXxhtgZZ0e5gxZDG25BUe/HlNcIjzyb7NZaw0TQAUBXbTClmFaHZiw=="], + "@tanstack/router-core": ["@tanstack/router-core@1.171.6", "", { "dependencies": { "@tanstack/history": "1.162.0", "cookie-es": "^3.0.0", "seroval": "^1.5.4", "seroval-plugins": "^1.5.4" } }, "sha512-Ol6DQ+j6rf/rPVELIzo8LHwOQV2KL+zry3b+39kL/GKrt7YId52WJRAFMzuseY4XceSW+PU7sG/Cc1QkwJr0hg=="], - "@tanstack/router-devtools-core": ["@tanstack/router-devtools-core@1.167.1", "", { "dependencies": { "clsx": "^2.1.1", "goober": "^2.1.16" }, "peerDependencies": { "@tanstack/router-core": "^1.168.2", "csstype": "^3.0.10" }, "optionalPeers": ["csstype"] }, "sha512-ECMM47J4KmifUvJguGituSiBpfN8SyCUEoxQks5RY09hpIBfR2eswCv2e6cJimjkKwBQXOVTPkTUk/yRvER+9w=="], + "@tanstack/router-devtools-core": ["@tanstack/router-devtools-core@1.168.0", "", { "dependencies": { "clsx": "^2.1.1", "goober": "^2.1.16" }, "peerDependencies": { "@tanstack/router-core": "^1.170.0", "csstype": "^3.0.10" }, "optionalPeers": ["csstype"] }, "sha512-wQoQhlBK7nlZgqzaqdYXKWNTpdHdsaREdaPhFZVH0/Ador+F+eM3/NF2i3f2LPeS0GgKraZUQXe1Q/1+KHyEYg=="], - "@tanstack/router-generator": ["@tanstack/router-generator@1.166.17", "", { "dependencies": { "@tanstack/router-core": "1.168.3", "@tanstack/router-utils": "1.161.6", "@tanstack/virtual-file-routes": "1.161.7", "prettier": "^3.5.0", "recast": "^0.23.11", "source-map": "^0.7.4", "tsx": "^4.19.2", "zod": "^3.24.2" } }, "sha512-sBs6lyvA+B51hpUWYLx0KdaAIO/m9Ml2bsAdfVYyvs5DZXiAZZEbVD0myndyIkWaPR5x+kzuBakkrgTxJ9/m9Q=="], + "@tanstack/router-generator": ["@tanstack/router-generator@1.167.10", "", { "dependencies": { "@babel/types": "^7.28.5", "@tanstack/router-core": "1.171.6", "@tanstack/router-utils": "1.162.1", "@tanstack/virtual-file-routes": "1.162.0", "jiti": "^2.7.0", "magic-string": "^0.30.21", "prettier": "^3.5.0", "zod": "^4.4.3" } }, "sha512-CjbjWRSo6djLU/C7ncb9IbKUcf4IwpdqhLGngkwKkXaVFXGxEAafA/uhvOCv/UEUVR7NI3tJqqQmxYXGcJPbjw=="], - "@tanstack/router-plugin": ["@tanstack/router-plugin@1.167.4", "", { "dependencies": { "@babel/core": "^7.28.5", "@babel/plugin-syntax-jsx": "^7.27.1", "@babel/plugin-syntax-typescript": "^7.27.1", "@babel/template": "^7.27.2", "@babel/traverse": "^7.28.5", "@babel/types": "^7.28.5", "@tanstack/router-core": "1.168.3", "@tanstack/router-generator": "1.166.17", "@tanstack/router-utils": "1.161.6", "@tanstack/virtual-file-routes": "1.161.7", "chokidar": "^3.6.0", "unplugin": "^2.1.2", "zod": "^3.24.2" }, "peerDependencies": { "@rsbuild/core": ">=1.0.2", "@tanstack/react-router": "^1.168.3", "vite": ">=5.0.0 || >=6.0.0 || >=7.0.0", "vite-plugin-solid": "^2.11.10", "webpack": ">=5.92.0" }, "optionalPeers": ["@rsbuild/core", "@tanstack/react-router", "vite", "vite-plugin-solid", "webpack"], "bin": { "intent": "bin/intent.js" } }, "sha512-VChByI+CHdHMW350E6winbgqdX4tzmZIHovys8vXidRZkxGAhlygj/zhbnepF/TGX88rubj+SXDwSHY25qEcpQ=="], + "@tanstack/router-plugin": ["@tanstack/router-plugin@1.168.11", "", { "dependencies": { "@babel/core": "^7.28.5", "@babel/plugin-syntax-jsx": "^7.27.1", "@babel/plugin-syntax-typescript": "^7.27.1", "@babel/template": "^7.27.2", "@babel/traverse": "^7.28.5", "@babel/types": "^7.28.5", "@tanstack/router-core": "1.171.6", "@tanstack/router-generator": "1.167.10", "@tanstack/router-utils": "1.162.1", "@tanstack/virtual-file-routes": "1.162.0", "chokidar": "^5.0.0", "unplugin": "^3.0.0", "zod": "^4.4.3" }, "peerDependencies": { "@rsbuild/core": ">=1.0.2 || ^2.0.0", "@tanstack/react-router": "^1.170.8", "vite": ">=5.0.0 || >=6.0.0 || >=7.0.0 || >=8.0.0", "vite-plugin-solid": "^2.11.10 || ^3.0.0-0", "webpack": ">=5.92.0" }, "optionalPeers": ["@rsbuild/core", "@tanstack/react-router", "vite", "vite-plugin-solid", "webpack"] }, "sha512-b2eom/8xCWL/OiWxKub8kYsr8p+kvmB/eXwYGqCWG8vilcJo+eQCSyp54nKt0AZ5k/ET1+eINc+4mwL3bVeAgg=="], - "@tanstack/router-utils": ["@tanstack/router-utils@1.161.6", "", { "dependencies": { "@babel/core": "^7.28.5", "@babel/generator": "^7.28.5", "@babel/parser": "^7.28.5", "@babel/types": "^7.28.5", "ansis": "^4.1.0", "babel-dead-code-elimination": "^1.0.12", "diff": "^8.0.2", "pathe": "^2.0.3", "tinyglobby": "^0.2.15" } }, "sha512-nRcYw+w2OEgK6VfjirYvGyPLOK+tZQz1jkYcmH5AjMamQ9PycnlxZF2aEZtPpNoUsaceX2bHptn6Ub5hGXqNvw=="], + "@tanstack/router-utils": ["@tanstack/router-utils@1.162.1", "", { "dependencies": { "@babel/core": "^7.28.5", "@babel/generator": "^7.28.5", "@babel/parser": "^7.28.5", "@babel/types": "^7.28.5", "ansis": "^4.1.0", "babel-dead-code-elimination": "^1.0.12", "diff": "^8.0.2", "pathe": "^2.0.3", "tinyglobby": "^0.2.15" } }, "sha512-62layyTGmclHDQS/eidwKRfN1hhCKwViG7iEBcVmL0MXgcAB3OOucWCEcDDGd9Cu11H6b4QQ5oOo47MWIqwz0A=="], - "@tanstack/store": ["@tanstack/store@0.9.2", "", {}, "sha512-K013lUJEFJK2ofFQ/hZKJUmCnpcV00ebLyOyFOWQvyQHUOZp/iYO84BM6aOGiV81JzwbX0APTVmW8YI7yiG5oA=="], + "@tanstack/store": ["@tanstack/store@0.9.3", "", {}, "sha512-8reSzl/qGWGGVKhBoxXPMWzATSbZLZFWhwBAFO9NAyp0TxzfBP0mIrGb8CP8KrQTmvzXlR/vFPPUrHTLBGyFyw=="], - "@tanstack/virtual-core": ["@tanstack/virtual-core@3.13.23", "", {}, "sha512-zSz2Z2HNyLjCplANTDyl3BcdQJc2k1+yyFoKhNRmCr7V7dY8o8q5m8uFTI1/Pg1kL+Hgrz6u3Xo6eFUB7l66cg=="], + "@tanstack/virtual-core": ["@tanstack/virtual-core@3.16.0", "", {}, "sha512-Er2N7q3WOiH6y2JLxsxNX+u2/sLqSsL0bxFgDjuiPiA7vKhZRm+IzcS17vRee3GNXr64UsesA5CAp9yTiIYw9A=="], - "@tanstack/virtual-file-routes": ["@tanstack/virtual-file-routes@1.161.7", "", { "bin": { "intent": "bin/intent.js" } }, "sha512-olW33+Cn+bsCsZKPwEGhlkqS6w3M2slFv11JIobdnCFKMLG97oAI2kWKdx5/zsywTL8flpnoIgaZZPlQTFYhdQ=="], + "@tanstack/virtual-file-routes": ["@tanstack/virtual-file-routes@1.162.0", "", {}, "sha512-uhOeFyxLcU41HzvrxsGpiWdcMbScY1EDgbZ5K7DVRMYInbLYWAC0EA/kx9wXAoSM8q82bUG2hRl8+EAjE6XAbA=="], - "@tanstack/zod-adapter": ["@tanstack/zod-adapter@1.166.9", "", { "peerDependencies": { "@tanstack/react-router": ">=1.43.2", "zod": "^3.23.8" } }, "sha512-HHllQ/CKGi8YBbftv6OmzojtHM6Rk4UszAFICAgUMbwiqtKqjlIZQ/7mv2IPNxBb8YlOQgzyQ4jz2UTEXIi6YA=="], + "@tanstack/zod-adapter": ["@tanstack/zod-adapter@1.167.0", "", { "peerDependencies": { "@tanstack/react-router": ">=1.43.2", "zod": "^3.23.8" } }, "sha512-5Wlm5teSu+pz3KKhfa1ESsiOJXbvV6ITr1vKOQKi9yEdtozp6VefEzxzafLLida97mnL2tmauva/njokQrG5CA=="], "@testing-library/dom": ["@testing-library/dom@10.4.1", "", { "dependencies": { "@babel/code-frame": "^7.10.4", "@babel/runtime": "^7.12.5", "@types/aria-query": "^5.0.1", "aria-query": "5.3.0", "dom-accessibility-api": "^0.5.9", "lz-string": "^1.5.0", "picocolors": "1.1.1", "pretty-format": "^27.0.2" } }, "sha512-o4PXJQidqJl82ckFaXUeoAW+XysPLauYI43Abki5hABd853iMhitooc6znOnczgbTYmEP6U6/y1ZyKAIsvMKGg=="], @@ -1916,33 +1840,33 @@ "@testing-library/user-event": ["@testing-library/user-event@14.6.1", "", { "peerDependencies": { "@testing-library/dom": ">=7.21.4" } }, "sha512-vq7fv0rnt+QTXgPxr5Hjc210p6YKq2kmdziLgnsZGgLJ9e6VAShx1pACLuRjd/AS/sr7phAR58OIIpf0LlmQNw=="], - "@thi.ng/api": ["@thi.ng/api@8.12.17", "", {}, "sha512-9iSUXzxKZxfMZsj+jVb0ivmBEnQaFzKAfKC0SQszdhhR8N4u/j0d7TqHvtslxAoLjZunq0dOu8KDueuQUzci4A=="], + "@thi.ng/api": ["@thi.ng/api@8.12.25", "", {}, "sha512-5Xixty2r+t6LNixnKpVBICz6R7SINaG2KnUG/CVJ2cuiQhih0RztldItEFYk4aRUFthRibhsG2Ie5ULS7qr9Kg=="], - "@thi.ng/arrays": ["@thi.ng/arrays@2.14.13", "", { "dependencies": { "@thi.ng/api": "^8.12.17", "@thi.ng/checks": "^3.8.7", "@thi.ng/compare": "^2.5.5", "@thi.ng/equiv": "^2.1.106", "@thi.ng/errors": "^2.6.6", "@thi.ng/random": "^4.1.42" } }, "sha512-53SU6AF02xgGQ6YOZKi1kPQW/niKSY8GPhijqVMXm3vISbFj5IGLjhdbTYv5j78UbkAp8eGynQYGyAnOIn3ILw=="], + "@thi.ng/arrays": ["@thi.ng/arrays@2.14.22", "", { "dependencies": { "@thi.ng/api": "^8.12.25", "@thi.ng/checks": "^3.9.5", "@thi.ng/compare": "^2.5.13", "@thi.ng/equiv": "^2.1.114", "@thi.ng/errors": "^2.6.14", "@thi.ng/random": "^4.1.51" } }, "sha512-Zdw4dTRPIIgcmOzrB1DZzvUMStcqn+bXmAbCM4npDFcUtIbGvMGiRzYHrqb0Z2E4jKntTDy2wviCuUo1U7Evfw=="], - "@thi.ng/cache": ["@thi.ng/cache@2.3.70", "", { "dependencies": { "@thi.ng/api": "^8.12.17", "@thi.ng/dcons": "^3.2.189" } }, "sha512-82tLyoD7QnAVbDUrdSkaXrUhwwv8b5b2Gyz7+wvY7uM/GigSQNAmbKPeSXPBEd+WtkbuQbscHF04FLpoMvzjDw=="], + "@thi.ng/cache": ["@thi.ng/cache@2.3.79", "", { "dependencies": { "@thi.ng/api": "^8.12.25", "@thi.ng/dcons": "^3.2.198" } }, "sha512-rUGh5YZAdWlfILzw7HOFcAstdEC3UWvYiqORTQR8z8bW/74vN/4LR079v4s/eO5K3KN6wJ6T9IwbzMlUEYTdQw=="], - "@thi.ng/checks": ["@thi.ng/checks@3.8.7", "", {}, "sha512-W5mGlyTMn0xcaTgVCVlMajXxEolkUg1sPz0tR5R0AstP4FCmPH0us5p8XsrnmzC58/raL0P4ocWwN8HMfsW//A=="], + "@thi.ng/checks": ["@thi.ng/checks@3.9.5", "", {}, "sha512-hxSqs6DtE/RDkzWSa3xqbYEwqAhicqKcWRZSvUmQ9I2NEDrR+qBUj6icjXMtS51k+Mp3FRiTQ0FDCI8FbOBBmw=="], - "@thi.ng/compare": ["@thi.ng/compare@2.5.5", "", { "dependencies": { "@thi.ng/api": "^8.12.17" } }, "sha512-rFX6AcYzfpVwAn347tmj6elbN0tm4V8mjQjPt+qkY7b6GSD48xd0RfU+DyJ7JmZyaCynC+BlkbORXdH53+j2gQ=="], + "@thi.ng/compare": ["@thi.ng/compare@2.5.13", "", { "dependencies": { "@thi.ng/api": "^8.12.25" } }, "sha512-tbz+rRgZz7EtYMj/RnseLZQPvbqjpCvewlixQMCPyfq+ORcWHdXDBe0dV67Mt74CofUQvsygOVTevT+bpkKPJg=="], - "@thi.ng/compose": ["@thi.ng/compose@3.0.54", "", { "dependencies": { "@thi.ng/api": "^8.12.17", "@thi.ng/errors": "^2.6.6" } }, "sha512-o7iCZ/0zg9ZWOVS1hQeQWKj+y6ab0WZm6DMK/nM90AD1aKbywZghVUWJEJHkvUF1gbZqh+r3rI6I1H++BT0+ug=="], + "@thi.ng/compose": ["@thi.ng/compose@3.0.62", "", { "dependencies": { "@thi.ng/api": "^8.12.25", "@thi.ng/errors": "^2.6.14" } }, "sha512-sGgT+vcLjtCDnXwf2VkGiN6racMpo1E+OQcyq1+Eos4OKbUFxf+Src7SHTq0vGjW9FKfmwWAghe6T8l1BwttKQ=="], - "@thi.ng/dcons": ["@thi.ng/dcons@3.2.189", "", { "dependencies": { "@thi.ng/api": "^8.12.17", "@thi.ng/checks": "^3.8.7", "@thi.ng/compare": "^2.5.5", "@thi.ng/equiv": "^2.1.106", "@thi.ng/errors": "^2.6.6", "@thi.ng/random": "^4.1.42", "@thi.ng/transducers": "^9.6.30" } }, "sha512-KZC8THR3JnKyh7wGVDqHuQlqxzXwoSZqNd3Ky0XsxIs7XRUfTFYXk/y9bPuom23u5q2oIhvrSReGwil3n+yqhw=="], + "@thi.ng/dcons": ["@thi.ng/dcons@3.2.198", "", { "dependencies": { "@thi.ng/api": "^8.12.25", "@thi.ng/checks": "^3.9.5", "@thi.ng/compare": "^2.5.13", "@thi.ng/equiv": "^2.1.114", "@thi.ng/errors": "^2.6.14", "@thi.ng/random": "^4.1.51", "@thi.ng/transducers": "^9.6.39" } }, "sha512-KlwGc3/vxURs9vwJp8+P9xYUISORhU80fDbKx/o4dVK3JnNrdMJ+EZCcQq3dhJannXJORBZ4chHR97MxbQhF6g=="], - "@thi.ng/equiv": ["@thi.ng/equiv@2.1.106", "", {}, "sha512-396/4pJuPckl24uivhIWEzCHMJ5Qx9Zgd2ZHHIxPlnf+8KB3Z+D8P5iO/P+xfPzJ0ai274qH1rAObToPPViPOw=="], + "@thi.ng/equiv": ["@thi.ng/equiv@2.1.114", "", {}, "sha512-kQuEqiT+m54MO9UCjdL9qrDD5OT8K+ANa0EziMpkyYRIiRe50XHoBzKCu8++YsCdEv4nX6oOD4c1b1fyu7x1hg=="], - "@thi.ng/errors": ["@thi.ng/errors@2.6.6", "", {}, "sha512-da0slIGmueCf4T0b+xT4TMVUQjHGFTJpul5TAVvPUl7Xn5Noe13Uq6Ag4D5ZCcDwwe2iJ8iHaTuYSJaFZ9f8Mg=="], + "@thi.ng/errors": ["@thi.ng/errors@2.6.14", "", {}, "sha512-dSqLPZh5wOe329Ks2pJqoDmtjSv2g4KpXEP5/IQ5J9qvrEyNrRBCuaKHUKYUltQ1OUHGd9L5hBqGJl65Hlnu+g=="], - "@thi.ng/math": ["@thi.ng/math@5.15.6", "", { "dependencies": { "@thi.ng/api": "^8.12.17" } }, "sha512-76WnIKfW7pLkUj9T0sfcRhc3yO0W9ofbx5oWUceM6UiA9aeLL6yQ8o1IchfrsJ970sJsRBZmQS8D0OzB0Ya8Bg=="], + "@thi.ng/math": ["@thi.ng/math@5.15.14", "", { "dependencies": { "@thi.ng/api": "^8.12.25" } }, "sha512-8kqMbdFzHxiw3x/nELEyLkZdkVzTj7PTsIcCiqaIGMoRj1tDXSOmj4eBpZcdX8Ch5IwZ6riHwP6lyengNCjr7g=="], - "@thi.ng/memoize": ["@thi.ng/memoize@4.0.41", "", { "dependencies": { "@thi.ng/api": "^8.12.17" } }, "sha512-8pB+s2JzBKsvPCn60ze6fBG9fivycDYSkUCSwlW+QoFMGuWmOHJ51vPRQ/6KTRQkKd6db+5RGQVn5EmEiGxV7w=="], + "@thi.ng/memoize": ["@thi.ng/memoize@4.0.49", "", { "dependencies": { "@thi.ng/api": "^8.12.25" } }, "sha512-SG9WTZ+b7/3VEcp+020awvn4QcOl4OjZljzuD1nVpqQ6NSa6hwR5B/RRcnrsIdCBiTgd9OcwBhWCXihxKrCsfQ=="], - "@thi.ng/random": ["@thi.ng/random@4.1.42", "", { "dependencies": { "@thi.ng/api": "^8.12.17", "@thi.ng/errors": "^2.6.6" } }, "sha512-QeQRNzafA7wZw5aKIjH6lVUxi9QWpWjYv0LsqVvQMHoikWvUaQ/BlI9tnT+JLPIrj8dR9Mn4hTrErNQ1XZgQlg=="], + "@thi.ng/random": ["@thi.ng/random@4.1.51", "", { "dependencies": { "@thi.ng/api": "^8.12.25", "@thi.ng/errors": "^2.6.14" } }, "sha512-3n1MUvGtTYv6Dyju9VfKN3jEJUul+EmMRPUvSZqeXWzCQtsG/2ulRtT4q+nyY/v9xF+LSR8AyQbHrayJQV/c4w=="], - "@thi.ng/timestamp": ["@thi.ng/timestamp@1.1.36", "", {}, "sha512-/OHXFHOC+Rv5h/pnDWk3eI4dGJIjfQpt30cCTzy9BUkNXkcb402KAD6cNqPaEZCmCPj5UqBTBbCHizbtv+Kuuw=="], + "@thi.ng/timestamp": ["@thi.ng/timestamp@1.1.44", "", {}, "sha512-OOEP2ibgOMQzLFGciU6HrFi0/9fENm3k9vjp6iVV8zyqy9sd477TU2puZN9iQhFTnIEaXkgoz/S//FfWc5rfKQ=="], - "@thi.ng/transducers": ["@thi.ng/transducers@9.6.30", "", { "dependencies": { "@thi.ng/api": "^8.12.17", "@thi.ng/arrays": "^2.14.13", "@thi.ng/checks": "^3.8.7", "@thi.ng/compare": "^2.5.5", "@thi.ng/compose": "^3.0.54", "@thi.ng/errors": "^2.6.6", "@thi.ng/math": "^5.15.6", "@thi.ng/random": "^4.1.42", "@thi.ng/timestamp": "^1.1.36" } }, "sha512-FCe6VWS91yxSmWU/eF6KQxYZzIj0v2ygTZwdlwHmnrk3HTdXD/ASWWqur7ogeWCXwBi6fO4ZpC8zr80Ipv5Y1Q=="], + "@thi.ng/transducers": ["@thi.ng/transducers@9.6.39", "", { "dependencies": { "@thi.ng/api": "^8.12.25", "@thi.ng/arrays": "^2.14.22", "@thi.ng/checks": "^3.9.5", "@thi.ng/compare": "^2.5.13", "@thi.ng/compose": "^3.0.62", "@thi.ng/errors": "^2.6.14", "@thi.ng/math": "^5.15.14", "@thi.ng/random": "^4.1.51", "@thi.ng/timestamp": "^1.1.44" } }, "sha512-NP7QNfs+MKLMaGWskyu1AH05mBSCpzo95HWqnwcxilRip05VEFFTiH3jMZg9Sln1fuyeFHqvqDzyAkyL75N5WA=="], "@tokenizer/inflate": ["@tokenizer/inflate@0.2.7", "", { "dependencies": { "debug": "^4.4.0", "fflate": "^0.8.2", "token-types": "^6.0.0" } }, "sha512-MADQgmZT1eKjp06jpI2yozxaU9uVs4GzzgSL+uEq7bVcJ9V1ZXQkeGNql1fsSI0gMy1vhvNTNbUqrx+pZfJVmg=="], @@ -1956,7 +1880,7 @@ "@tsconfig/node16": ["@tsconfig/node16@1.0.4", "", {}, "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA=="], - "@tybys/wasm-util": ["@tybys/wasm-util@0.10.1", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg=="], + "@tybys/wasm-util": ["@tybys/wasm-util@0.10.2", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-RoBvJ2X0wuKlWFIjrwffGw1IqZHKQqzIchKaadZZfnNpsAYp2mM0h36JtPCjNDAHGgYez/15uMBpfGwchhiMgg=="], "@typechain/ethers-v6": ["@typechain/ethers-v6@0.5.1", "", { "dependencies": { "lodash": "^4.17.15", "ts-essentials": "^7.0.1" }, "peerDependencies": { "ethers": "6.x", "typechain": "^8.3.2", "typescript": ">=4.7.0" } }, "sha512-F+GklO8jBWlsaVV+9oHaPh5NJdd6rAKN4tklGfInX1Q7h0xPgVLP39Jl3eCulPB5qexI71ZFHwbljx4ZXNfouA=="], @@ -1982,7 +1906,7 @@ "@types/body-parser": ["@types/body-parser@1.19.6", "", { "dependencies": { "@types/connect": "*", "@types/node": "*" } }, "sha512-HLFeCYgz89uk22N5Qg3dvGvsv46B8GLvKKo1zKG4NybA8U2DiEO3w9lqGg29t/tfLRJpJ6iQxnVw4OnB7MoM9g=="], - "@types/bun": ["@types/bun@1.3.11", "", { "dependencies": { "bun-types": "1.3.11" } }, "sha512-5vPne5QvtpjGpsGYXiFyycfpDF2ECyPcTSsFBMa0fraoxiQyMJ3SmuQIGhzPg2WJuWxVBoxWJ2kClYTcw/4fAg=="], + "@types/bun": ["@types/bun@1.3.14", "", { "dependencies": { "bun-types": "1.3.14" } }, "sha512-h1hFqFVcvAvD9j9K7ZW7vd82aSA+rTdznZa+5bwvCwqSB1jmmfLcbIWhOLx1/+boy/xmjgCs/OMUL8hRJSmnPw=="], "@types/chai": ["@types/chai@5.2.3", "", { "dependencies": { "@types/deep-eql": "*", "assertion-error": "^2.0.1" } }, "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA=="], @@ -2044,7 +1968,7 @@ "@types/multer": ["@types/multer@2.1.0", "", { "dependencies": { "@types/express": "*" } }, "sha512-zYZb0+nJhOHtPpGDb3vqPjwpdeGlGC157VpkqNQL+UU2qwoacoQ7MpsAmUptI/0Oa127X32JzWDqQVEXp2RcIA=="], - "@types/node": ["@types/node@22.19.15", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-F0R/h2+dsy5wJAUe3tAU6oqa2qbWY5TpNfL/RGmo1y38hiyO1w3x2jPtt76wmuaJI4DQnOBu21cNXQ2STIUUWg=="], + "@types/node": ["@types/node@22.19.19", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-dyh/xO2Fh5bYrfWaaqGrRQQGkNdmYw6AmaAUvYeUMNTWQtvb796ikLdmTchRmOlOiIJ1TDXfWgVx1QkUlQ6Hew=="], "@types/node-forge": ["@types/node-forge@1.3.14", "", { "dependencies": { "@types/node": "*" } }, "sha512-mhVF2BnD4BO+jtOp7z1CdzaK4mbuK0LLQYAvdOLqHTavxFNq4zA1EmYkpnFjP8HOUzedfQkRnp0E2ulSAYSzAw=="], @@ -2052,11 +1976,11 @@ "@types/prettier": ["@types/prettier@2.7.3", "", {}, "sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA=="], - "@types/qs": ["@types/qs@6.15.0", "", {}, "sha512-JawvT8iBVWpzTrz3EGw9BTQFg3BQNmwERdKE22vlTxawwtbyUSlMppvZYKLZzB5zgACXdXxbD3m1bXaMqP/9ow=="], + "@types/qs": ["@types/qs@6.15.1", "", {}, "sha512-GZHUBZR9hckSUhrxmp1nG6NwdpM9fCunJwyThLW1X3AyHgd9IlHb6VANpQQqDr2o/qQp6McZ3y/IA2rVzKzSbw=="], "@types/range-parser": ["@types/range-parser@1.2.7", "", {}, "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ=="], - "@types/react": ["@types/react@19.2.14", "", { "dependencies": { "csstype": "^3.2.2" } }, "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w=="], + "@types/react": ["@types/react@19.2.15", "", { "dependencies": { "csstype": "^3.2.2" } }, "sha512-eRwcGNHve+E8qtEQSSRl6urh+rFop4v8gm6O8rGv25CodbvFdLjA1vVQ1KkiFE0w0UPOnb8tDiFKL5lp0rtY5Q=="], "@types/react-dom": ["@types/react-dom@19.2.3", "", { "peerDependencies": { "@types/react": "^19.2.0" } }, "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ=="], @@ -2092,11 +2016,11 @@ "@typescript-eslint/parser": ["@typescript-eslint/parser@5.62.0", "", { "dependencies": { "@typescript-eslint/scope-manager": "5.62.0", "@typescript-eslint/types": "5.62.0", "@typescript-eslint/typescript-estree": "5.62.0", "debug": "^4.3.4" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, "sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA=="], - "@typescript-eslint/project-service": ["@typescript-eslint/project-service@8.57.2", "", { "dependencies": { "@typescript-eslint/tsconfig-utils": "^8.57.2", "@typescript-eslint/types": "^8.57.2", "debug": "^4.4.3" }, "peerDependencies": { "typescript": ">=4.8.4 <6.0.0" } }, "sha512-FuH0wipFywXRTHf+bTTjNyuNQQsQC3qh/dYzaM4I4W0jrCqjCVuUh99+xd9KamUfmCGPvbO8NDngo/vsnNVqgw=="], + "@typescript-eslint/project-service": ["@typescript-eslint/project-service@8.60.0", "", { "dependencies": { "@typescript-eslint/tsconfig-utils": "^8.60.0", "@typescript-eslint/types": "^8.60.0", "debug": "^4.4.3" }, "peerDependencies": { "typescript": ">=4.8.4 <6.1.0" } }, "sha512-aZu74NNKJeUWqCjDddzdiKaS82dgYgV/vmf+Ui3ZdZejmgfXR/q+pRumgobnQ2cCJTgGTWp4ypiwsuofFubavg=="], "@typescript-eslint/scope-manager": ["@typescript-eslint/scope-manager@5.62.0", "", { "dependencies": { "@typescript-eslint/types": "5.62.0", "@typescript-eslint/visitor-keys": "5.62.0" } }, "sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w=="], - "@typescript-eslint/tsconfig-utils": ["@typescript-eslint/tsconfig-utils@8.57.2", "", { "peerDependencies": { "typescript": ">=4.8.4 <6.0.0" } }, "sha512-3Lm5DSM+DCowsUOJC+YqHHnKEfFh5CoGkj5Z31NQSNF4l5wdOwqGn99wmwN/LImhfY3KJnmordBq/4+VDe2eKw=="], + "@typescript-eslint/tsconfig-utils": ["@typescript-eslint/tsconfig-utils@8.60.0", "", { "peerDependencies": { "typescript": ">=4.8.4 <6.1.0" } }, "sha512-BZPR3RGYlAXnly6ymAxfkVn5rCbZzQNou0rxv3GfWZ8cTQp+hhVd73khbGLAd8k1TlAPLISH337M+tAgAnaJDQ=="], "@typescript-eslint/type-utils": ["@typescript-eslint/type-utils@5.62.0", "", { "dependencies": { "@typescript-eslint/typescript-estree": "5.62.0", "@typescript-eslint/utils": "5.62.0", "debug": "^4.3.4", "tsutils": "^3.21.0" }, "peerDependencies": { "eslint": "*" } }, "sha512-xsSQreu+VnfbqQpW5vnCJdq1Z3Q0U31qiWmRhr98ONQmcp/yhiPJFPq8MXiJVLiksmOKSjIldZzkebzHuCGzew=="], @@ -2108,7 +2032,7 @@ "@typescript-eslint/visitor-keys": ["@typescript-eslint/visitor-keys@5.62.0", "", { "dependencies": { "@typescript-eslint/types": "5.62.0", "eslint-visitor-keys": "^3.3.0" } }, "sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw=="], - "@ungap/structured-clone": ["@ungap/structured-clone@1.3.0", "", {}, "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g=="], + "@ungap/structured-clone": ["@ungap/structured-clone@1.3.1", "", {}, "sha512-mUFwbeTqrVgDQxFveS+df2yfap6iuP20NAKAsBt5jDEoOTDew+zwLAOilHCeQJOVSvmgCX4ogqIrA0mnyr08yQ=="], "@vitejs/plugin-react": ["@vitejs/plugin-react@4.7.0", "", { "dependencies": { "@babel/core": "^7.28.0", "@babel/plugin-transform-react-jsx-self": "^7.27.1", "@babel/plugin-transform-react-jsx-source": "^7.27.1", "@rolldown/pluginutils": "1.0.0-beta.27", "@types/babel__core": "^7.20.5", "react-refresh": "^0.17.0" }, "peerDependencies": { "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" } }, "sha512-gUu9hwfWvvEDBBmgtAowQCojwZmJ5mcLn3aufeCsitijs3+f2NsrPtlAWIR6OPiqljl96GVCUbLe0HyqIpVaoA=="], @@ -2140,7 +2064,7 @@ "@wallet-standard/wallet": ["@wallet-standard/wallet@1.1.0", "", { "dependencies": { "@wallet-standard/base": "^1.1.0" } }, "sha512-Gt8TnSlDZpAl+RWOOAB/kuvC7RpcdWAlFbHNoi4gsXsfaWa1QCT6LBcfIYTPdOZC9OVZUDwqGuGAcqZejDmHjg=="], - "@walletconnect/core": ["@walletconnect/core@2.23.8", "", { "dependencies": { "@walletconnect/heartbeat": "1.2.2", "@walletconnect/jsonrpc-provider": "1.0.14", "@walletconnect/jsonrpc-types": "1.0.4", "@walletconnect/jsonrpc-utils": "1.0.8", "@walletconnect/jsonrpc-ws-connection": "1.0.16", "@walletconnect/keyvaluestorage": "1.1.1", "@walletconnect/logger": "3.0.2", "@walletconnect/relay-api": "1.0.11", "@walletconnect/relay-auth": "1.1.0", "@walletconnect/safe-json": "1.0.2", "@walletconnect/time": "1.0.2", "@walletconnect/types": "2.23.8", "@walletconnect/utils": "2.23.8", "@walletconnect/window-getters": "1.0.1", "es-toolkit": "1.44.0", "events": "3.3.0", "uint8arrays": "3.1.1" } }, "sha512-559+fA6Hh9CkEIOtrWKdDWoa3HL47glDF7D75LbqQzv4v325KXq24KEsjzDPBYr7pI49gQo7P2HpPnY1ax+8Aw=="], + "@walletconnect/core": ["@walletconnect/core@2.23.9", "", { "dependencies": { "@walletconnect/heartbeat": "1.2.2", "@walletconnect/jsonrpc-provider": "1.0.14", "@walletconnect/jsonrpc-types": "1.0.4", "@walletconnect/jsonrpc-utils": "1.0.8", "@walletconnect/jsonrpc-ws-connection": "1.0.16", "@walletconnect/keyvaluestorage": "1.1.1", "@walletconnect/logger": "3.0.2", "@walletconnect/relay-api": "1.0.11", "@walletconnect/relay-auth": "1.1.0", "@walletconnect/safe-json": "1.0.2", "@walletconnect/time": "1.0.2", "@walletconnect/types": "2.23.9", "@walletconnect/utils": "2.23.9", "@walletconnect/window-getters": "1.0.1", "es-toolkit": "1.44.0", "events": "3.3.0", "uint8arrays": "3.1.1" } }, "sha512-ws4WG8LeagUo2ERRo02HryXRcpwIRmCQ3pHLW5gWbVReLXXIpgk6ZAfID3fEGHevIwwnHSGww+nNhNpdXyiq0g=="], "@walletconnect/environment": ["@walletconnect/environment@1.0.1", "", { "dependencies": { "tslib": "1.14.1" } }, "sha512-T426LLZtHj8e8rYnKfzsw1aG6+M0BT1ZxayMdv/p8yM0MU+eJDISqNY3/bccxRr4LrF9csq02Rhqt08Ibl0VRg=="], @@ -2176,15 +2100,15 @@ "@walletconnect/safe-json": ["@walletconnect/safe-json@1.0.2", "", { "dependencies": { "tslib": "1.14.1" } }, "sha512-Ogb7I27kZ3LPC3ibn8ldyUr5544t3/STow9+lzz7Sfo808YD7SBWk7SAsdBFlYgP2zDRy2hS3sKRcuSRM0OTmA=="], - "@walletconnect/sign-client": ["@walletconnect/sign-client@2.23.8", "", { "dependencies": { "@walletconnect/core": "2.23.8", "@walletconnect/events": "1.0.1", "@walletconnect/heartbeat": "1.2.2", "@walletconnect/jsonrpc-utils": "1.0.8", "@walletconnect/logger": "3.0.2", "@walletconnect/time": "1.0.2", "@walletconnect/types": "2.23.8", "@walletconnect/utils": "2.23.8", "events": "3.3.0" } }, "sha512-7DtFDQZwOK4E9q+TKWL819d01dpNHA3jMcntSsQqSLNU34orbkDB/BJzW4nyWZ6H9DuGHRvibJA9wvfXjOCWBw=="], + "@walletconnect/sign-client": ["@walletconnect/sign-client@2.23.9", "", { "dependencies": { "@walletconnect/core": "2.23.9", "@walletconnect/events": "1.0.1", "@walletconnect/heartbeat": "1.2.2", "@walletconnect/jsonrpc-utils": "1.0.8", "@walletconnect/logger": "3.0.2", "@walletconnect/time": "1.0.2", "@walletconnect/types": "2.23.9", "@walletconnect/utils": "2.23.9", "events": "3.3.0" } }, "sha512-Xj+hw4E6mGRyhCdVOT/RMgnG+up/Y3v0ho5PlkVozvXWeVSqHNh9DmjLuU97a7OACoGd/oHBF6g3NVqD7MgCMQ=="], "@walletconnect/time": ["@walletconnect/time@1.0.2", "", { "dependencies": { "tslib": "1.14.1" } }, "sha512-uzdd9woDcJ1AaBZRhqy5rNC9laqWGErfc4dxA9a87mPdKOgWMD85mcFo9dIYIts/Jwocfwn07EC6EzclKubk/g=="], - "@walletconnect/types": ["@walletconnect/types@2.23.8", "", { "dependencies": { "@walletconnect/events": "1.0.1", "@walletconnect/heartbeat": "1.2.2", "@walletconnect/jsonrpc-types": "1.0.4", "@walletconnect/keyvaluestorage": "1.1.1", "@walletconnect/logger": "3.0.2", "events": "3.3.0" } }, "sha512-OI/0Z7/8r11EDU9bBPy5nixYgsk6SrTcOvWe9r7Nf2WvkMcPLgV7aS8rb6+nInRmDPfXuyTgzdAox0rtmfJMzg=="], + "@walletconnect/types": ["@walletconnect/types@2.23.9", "", { "dependencies": { "@walletconnect/events": "1.0.1", "@walletconnect/heartbeat": "1.2.2", "@walletconnect/jsonrpc-types": "1.0.4", "@walletconnect/keyvaluestorage": "1.1.1", "@walletconnect/logger": "3.0.2", "events": "3.3.0" } }, "sha512-IUl1PpD/Dig8IE2OZ9XtjbPohEyOZJ73xs92EDUzoIyzRtfm36g2D340pY3iu3AAdLv1yFiaZafB8Hf8RFze8A=="], - "@walletconnect/universal-provider": ["@walletconnect/universal-provider@2.23.8", "", { "dependencies": { "@walletconnect/events": "1.0.1", "@walletconnect/jsonrpc-http-connection": "1.0.8", "@walletconnect/jsonrpc-provider": "1.0.14", "@walletconnect/jsonrpc-types": "1.0.4", "@walletconnect/jsonrpc-utils": "1.0.8", "@walletconnect/keyvaluestorage": "1.1.1", "@walletconnect/logger": "3.0.2", "@walletconnect/sign-client": "2.23.8", "@walletconnect/types": "2.23.8", "@walletconnect/utils": "2.23.8", "es-toolkit": "1.44.0", "events": "3.3.0" } }, "sha512-TFn2TNhp5vlbV2HqPU/LfkEIYZEop4WDCTTZKw/RU4DbM1e1+etmvTr5JA+8dkZU7ee48mVUDodY0zQedP+KZA=="], + "@walletconnect/universal-provider": ["@walletconnect/universal-provider@2.23.9", "", { "dependencies": { "@walletconnect/events": "1.0.1", "@walletconnect/jsonrpc-http-connection": "1.0.8", "@walletconnect/jsonrpc-provider": "1.0.14", "@walletconnect/jsonrpc-types": "1.0.4", "@walletconnect/jsonrpc-utils": "1.0.8", "@walletconnect/keyvaluestorage": "1.1.1", "@walletconnect/logger": "3.0.2", "@walletconnect/sign-client": "2.23.9", "@walletconnect/types": "2.23.9", "@walletconnect/utils": "2.23.9", "es-toolkit": "1.44.0", "events": "3.3.0" } }, "sha512-dNk6X1USUcIX1nx3H61V3pO15E/2ejyeBsKLBOo8YXrnYCrKGG/KB1LIqJXHpQlXT+9bJE9cOnn61ETdCXgkPw=="], - "@walletconnect/utils": ["@walletconnect/utils@2.23.8", "", { "dependencies": { "@msgpack/msgpack": "3.1.3", "@noble/ciphers": "1.3.0", "@noble/curves": "1.9.7", "@noble/hashes": "1.8.0", "@scure/base": "1.2.6", "@walletconnect/jsonrpc-utils": "1.0.8", "@walletconnect/keyvaluestorage": "1.1.1", "@walletconnect/logger": "3.0.2", "@walletconnect/relay-api": "1.0.11", "@walletconnect/relay-auth": "1.1.0", "@walletconnect/safe-json": "1.0.2", "@walletconnect/time": "1.0.2", "@walletconnect/types": "2.23.8", "@walletconnect/window-getters": "1.0.1", "@walletconnect/window-metadata": "1.0.1", "blakejs": "1.2.1", "detect-browser": "5.3.0", "ox": "0.9.3", "uint8arrays": "3.1.1" } }, "sha512-vJrRrZFZANWmnEEnWnfVSnpQ+jdjqBb5fqSgp0VGeRX3pNr2KAHJ0TwNnEN+fbhR76JxuFrpcY7HJUT7DHDJ7w=="], + "@walletconnect/utils": ["@walletconnect/utils@2.23.9", "", { "dependencies": { "@msgpack/msgpack": "3.1.3", "@noble/ciphers": "1.3.0", "@noble/curves": "1.9.7", "@noble/hashes": "1.8.0", "@scure/base": "1.2.6", "@walletconnect/jsonrpc-utils": "1.0.8", "@walletconnect/keyvaluestorage": "1.1.1", "@walletconnect/logger": "3.0.2", "@walletconnect/relay-api": "1.0.11", "@walletconnect/relay-auth": "1.1.0", "@walletconnect/safe-json": "1.0.2", "@walletconnect/time": "1.0.2", "@walletconnect/types": "2.23.9", "@walletconnect/window-getters": "1.0.1", "@walletconnect/window-metadata": "1.0.1", "blakejs": "1.2.1", "detect-browser": "5.3.0", "ox": "0.9.3", "uint8arrays": "3.1.1" } }, "sha512-C5TltCs8UPypNiteYnKSv8+ZDK2EjVDyXCxN6kA9bkA+j6KGsNIV7l9MUA8WBAvE5Gi5EcBdhD3R9Hpo/1HHqQ=="], "@walletconnect/window-getters": ["@walletconnect/window-getters@1.0.1", "", { "dependencies": { "tslib": "1.14.1" } }, "sha512-vHp+HqzGxORPAN8gY03qnbTMnhqIwjeRJNOMOAzePRg4xVEEE2WvYsI9G2NMjOknA8hnuYbU3/hwLcKbjhc8+Q=="], @@ -2238,15 +2162,9 @@ "agent-base": ["agent-base@6.0.2", "", { "dependencies": { "debug": "4" } }, "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ=="], - "agentkeepalive": ["agentkeepalive@4.6.0", "", { "dependencies": { "humanize-ms": "^1.2.1" } }, "sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ=="], - "aggregate-error": ["aggregate-error@3.1.0", "", { "dependencies": { "clean-stack": "^2.0.0", "indent-string": "^4.0.0" } }, "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA=="], - "ajv": ["ajv@8.18.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A=="], - - "ajv-draft-04": ["ajv-draft-04@1.0.0", "", { "peerDependencies": { "ajv": "^8.5.0" }, "optionalPeers": ["ajv"] }, "sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw=="], - - "ajv-formats": ["ajv-formats@3.0.1", "", { "dependencies": { "ajv": "^8.0.0" } }, "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ=="], + "ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="], "amdefine": ["amdefine@1.0.1", "", {}, "sha512-S2Hw0TtNkMJhIabBwIojKL9YHO5T0n5eNqWJ7Lrlel/zDbftQpxpapi8tZs3X1HWa+u+QeydGmzzNU0m09+Rcg=="], @@ -2260,7 +2178,7 @@ "ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], - "ansis": ["ansis@4.2.0", "", {}, "sha512-HqZ5rWlFjGiV0tDm3UxxgNRqsOTniqoKZu0pIAfh7TZQMGuZK+hH0drySty0si0QXj1ieop4+SkSfPZBPPkHig=="], + "ansis": ["ansis@4.3.0", "", {}, "sha512-44mvgtPvohuU/70DdY5Oz2AIrLJ9k6/5x4KmoSvPwO+5Moijo0+N9D0fKbbYZQWP1hNm5CpOf+E01jhxG/r8xg=="], "antlr4ts": ["antlr4ts@0.5.0-alpha.4", "", {}, "sha512-WPQDt1B74OfPv/IMS2ekXAKkTZIHl88uMetg6q3OTqgFxZ/dxDXI0EWLyZid/1Pe6hTftyg5N7gel5wNAGxXyQ=="], @@ -2310,7 +2228,7 @@ "asn1.js": ["asn1.js@4.10.1", "", { "dependencies": { "bn.js": "^4.0.0", "inherits": "^2.0.1", "minimalistic-assert": "^1.0.0" } }, "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw=="], - "asn1js": ["asn1js@3.0.7", "", { "dependencies": { "pvtsutils": "^1.3.6", "pvutils": "^1.1.3", "tslib": "^2.8.1" } }, "sha512-uLvq6KJu04qoQM6gvBfKFjlh6Gl0vOKQuR5cJMDHQkmwfMOQeN3F3SHCv9SNYSL+CRoHvOGFfllDlVz03GQjvQ=="], + "asn1js": ["asn1js@3.0.10", "", { "dependencies": { "pvtsutils": "^1.3.6", "pvutils": "^1.1.5", "tslib": "^2.8.1" } }, "sha512-S2s3aOytiKdFRdulw2qPE51MzjzVOisppcVv7jVFR+Kw0kxwvFrDcYA0h7Ndqbmj0HkMIXYWaoj7fli8kgx1eg=="], "assert": ["assert@2.1.0", "", { "dependencies": { "call-bind": "^1.0.2", "is-nan": "^1.3.2", "object-is": "^1.1.5", "object.assign": "^4.1.4", "util": "^0.12.5" } }, "sha512-eLHpSK/Y4nhMJ07gDaAzoX/XAKS8PSaojml3M0DM4JpV1LAi5JOJ/p6H/XWrl8L+DzVEvVCW1z3vWAaB9oTsQw=="], @@ -2336,11 +2254,11 @@ "available-typed-arrays": ["available-typed-arrays@1.0.7", "", { "dependencies": { "possible-typed-array-names": "^1.0.0" } }, "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ=="], - "axios": ["axios@1.15.0", "", { "dependencies": { "follow-redirects": "^1.15.11", "form-data": "^4.0.5", "proxy-from-env": "^2.1.0" } }, "sha512-wWyJDlAatxk30ZJer+GeCWS209sA42X+N5jU2jy6oHTp7ufw8uzUTVFBX9+wTfAlhiJXGS0Bq7X6efruWjuK9Q=="], + "axios": ["axios@1.16.1", "", { "dependencies": { "follow-redirects": "^1.16.0", "form-data": "^4.0.5", "https-proxy-agent": "^5.0.1", "proxy-from-env": "^2.1.0" } }, "sha512-caYkukvroVPO8KrzuJEb50Hm07KwfBZPEC3VeFHTsqWHvKTsy54hjJz9BS/cdaypROE2rH6xvm9mHX4fgWkr3A=="], "axios-retry": ["axios-retry@4.5.0", "", { "dependencies": { "is-retry-allowed": "^2.2.0" }, "peerDependencies": { "axios": "0.x || 1.x" } }, "sha512-aR99oXhpEDGo0UuAlYcn2iGRds30k366Zfa05XWScR9QaQD4JYiP3/1Qt1u7YlefUOK+cn0CcwoL1oefavQUlQ=="], - "b4a": ["b4a@1.8.0", "", { "peerDependencies": { "react-native-b4a": "*" }, "optionalPeers": ["react-native-b4a"] }, "sha512-qRuSmNSkGQaHwNbM7J78Wwy+ghLEYF1zNrSeMxj4Kgw6y33O3mXcQ6Ie9fRvfU/YnxWkOchPXbaLb73TkIsfdg=="], + "b4a": ["b4a@1.8.1", "", { "peerDependencies": { "react-native-b4a": "*" }, "optionalPeers": ["react-native-b4a"] }, "sha512-aiqre1Nr0B/6DgE2N5vwTc+2/oQZ4Wh1t4NznYY4E00y8LCt6NqdRv81so00oo27D8MVKTpUa/MwUUtBLXCoDw=="], "babel-dead-code-elimination": ["babel-dead-code-elimination@1.0.12", "", { "dependencies": { "@babel/core": "^7.23.7", "@babel/parser": "^7.23.6", "@babel/traverse": "^7.23.7", "@babel/types": "^7.23.6" } }, "sha512-GERT7L2TiYcYDtYk1IpD+ASAYXjKbLTDPhBtYj7X1NuRMDTMtAx9kyBenub1Ev41lo91OHCKdmP+egTDmfQ7Ig=="], @@ -2362,21 +2280,21 @@ "bare-addon-resolve": ["bare-addon-resolve@1.10.0", "", { "dependencies": { "bare-module-resolve": "^1.10.0", "bare-semver": "^1.0.0" }, "peerDependencies": { "bare-url": "*" }, "optionalPeers": ["bare-url"] }, "sha512-sSd0jieRJlDaODOzj0oe0RjFVC1QI0ZIjGIdPkbrTXsdVVtENg14c+lHHAhHwmWCZ2nQlMhy8jA3Y5LYPc/isA=="], - "bare-events": ["bare-events@2.8.2", "", { "peerDependencies": { "bare-abort-controller": "*" }, "optionalPeers": ["bare-abort-controller"] }, "sha512-riJjyv1/mHLIPX4RwiK+oW9/4c3TEUeORHKefKAKnZ5kyslbN+HXowtbaVEqt4IMUB7OXlfixcs6gsFeo/jhiQ=="], + "bare-events": ["bare-events@2.8.3", "", { "peerDependencies": { "bare-abort-controller": "*" }, "optionalPeers": ["bare-abort-controller"] }, "sha512-HdUm8EMQBLaJvGUdidNNbqpA1kYkwNcb+MYxkxCLAPJGQzlv9J0C24h8V65Z4c5GLd/JEALDvpFCQgpLJqc0zw=="], - "bare-fs": ["bare-fs@4.5.6", "", { "dependencies": { "bare-events": "^2.5.4", "bare-path": "^3.0.0", "bare-stream": "^2.6.4", "bare-url": "^2.2.2", "fast-fifo": "^1.3.2" }, "peerDependencies": { "bare-buffer": "*" }, "optionalPeers": ["bare-buffer"] }, "sha512-1QovqDrR80Pmt5HPAsMsXTCFcDYr+NSUKW6nd6WO5v0JBmnItc/irNRzm2KOQ5oZ69P37y+AMujNyNtG+1Rggw=="], + "bare-fs": ["bare-fs@4.7.1", "", { "dependencies": { "bare-events": "^2.5.4", "bare-path": "^3.0.0", "bare-stream": "^2.6.4", "bare-url": "^2.2.2", "fast-fifo": "^1.3.2" }, "peerDependencies": { "bare-buffer": "*" }, "optionalPeers": ["bare-buffer"] }, "sha512-WDRsyVN52eAx/lBamKD6uyw8H4228h/x0sGGGegOamM2cd7Pag88GfMQalobXI+HaEUxpCkbKQUDOQqt9wawRw=="], - "bare-module-resolve": ["bare-module-resolve@1.12.1", "", { "dependencies": { "bare-semver": "^1.0.0" }, "peerDependencies": { "bare-url": "*" }, "optionalPeers": ["bare-url"] }, "sha512-hbmAPyFpEq8FoZMd5sFO3u6MC5feluWoGE8YKlA8fCrl6mNtx68Wjg4DTiDJcqRJaovTvOYKfYngoBUnbaT7eg=="], + "bare-module-resolve": ["bare-module-resolve@1.12.2", "", { "dependencies": { "bare-semver": "^1.0.0" }, "peerDependencies": { "bare-url": "*" }, "optionalPeers": ["bare-url"] }, "sha512-j+hiD5k99qec4KjJvYsI67q5AOBifmy9JG3oeMVxTmvrhn2sIdp8StrUvZu4YNgwTpO+NhniQG16N1ETDe1k5w=="], - "bare-os": ["bare-os@3.8.0", "", {}, "sha512-Dc9/SlwfxkXIGYhvMQNUtKaXCaGkZYGcd1vuNUUADVqzu4/vQfvnMkYYOUnt2VwQ2AqKr/8qAVFRtwETljgeFg=="], + "bare-os": ["bare-os@3.9.1", "", {}, "sha512-6M5XjcnsygQNPMCMPXSK379xrJFiZ/AEMNBmFEmQW8d/789VQATvriyi5r0HYTL9TkQ26rn3kgdTG3aisbrXkQ=="], "bare-path": ["bare-path@3.0.0", "", { "dependencies": { "bare-os": "^3.0.1" } }, "sha512-tyfW2cQcB5NN8Saijrhqn0Zh7AnFNsnczRcuWODH0eYAXBsJ5gVxAUuNr7tsHSC6IZ77cA0SitzT+s47kot8Mw=="], - "bare-semver": ["bare-semver@1.0.2", "", {}, "sha512-ESVaN2nzWhcI5tf3Zzcq9aqCZ676VWzqw07eEZ0qxAcEOAFYBa0pWq8sK34OQeHLY3JsfKXZS9mDyzyxGjeLzA=="], + "bare-semver": ["bare-semver@1.0.3", "", {}, "sha512-HS/A30bi2+PiRJfU6R4+Kp+6KeLSCSByjYM2iiobOKzLAvtu1CT+S8xWfiU7wz0erknjkUoC+yXy108tzIuP5Q=="], - "bare-stream": ["bare-stream@2.10.0", "", { "dependencies": { "streamx": "^2.25.0", "teex": "^1.0.1" }, "peerDependencies": { "bare-buffer": "*", "bare-events": "*" }, "optionalPeers": ["bare-buffer", "bare-events"] }, "sha512-DOPZF/DDcDruKDA43cOw6e9Quq5daua7ygcAwJE/pKJsRWhgSSemi7qVNGE5kyDIxIeN1533G/zfbvWX7Wcb9w=="], + "bare-stream": ["bare-stream@2.13.1", "", { "dependencies": { "streamx": "^2.25.0", "teex": "^1.0.1" }, "peerDependencies": { "bare-abort-controller": "*", "bare-buffer": "*", "bare-events": "*" }, "optionalPeers": ["bare-abort-controller", "bare-buffer", "bare-events"] }, "sha512-Vp0cnjYyrEC4whYTymQ+YZi6pBpfiICZO3cfRG8sy67ZNWe951urv1x4eW1BKNngw3U+3fPYb5JQvHbCtxH7Ow=="], - "bare-url": ["bare-url@2.4.0", "", { "dependencies": { "bare-path": "^3.0.0" } }, "sha512-NSTU5WN+fy/L0DDenfE8SXQna4voXuW0FHM7wH8i3/q9khUSchfPbPezO4zSFMnDGIf9YE+mt/RWhZgNRKRIXA=="], + "bare-url": ["bare-url@2.4.3", "", { "dependencies": { "bare-path": "^3.0.0" } }, "sha512-Kccpc7ACfXaxfeInfqKcZtW4pT5YBn1mesc4sCsun6sRwtbJ4h+sNOaksUpYEJUKfN65YWC6Bw2OJEFiKxq8nQ=="], "base-x": ["base-x@5.0.1", "", {}, "sha512-M7uio8Zt++eg3jPj+rHMfCC+IuygQHHCOU+IYsVtik6FWjuYpVt/+MRKcgsAMHh8mMFAwnB+Bs+mTrFiXjMzKg=="], @@ -2384,7 +2302,7 @@ "base64-js": ["base64-js@1.5.1", "", {}, "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="], - "baseline-browser-mapping": ["baseline-browser-mapping@2.10.10", "", { "bin": { "baseline-browser-mapping": "dist/cli.cjs" } }, "sha512-sUoJ3IMxx4AyRqO4MLeHlnGDkyXRoUG0/AI9fjK+vS72ekpV0yWVY7O0BVjmBcRtkNcsAO2QDZ4tdKKGoI6YaQ=="], + "baseline-browser-mapping": ["baseline-browser-mapping@2.10.32", "", { "bin": { "baseline-browser-mapping": "dist/cli.cjs" } }, "sha512-wbPvpyjJPC0zdfdKXxqEL3Ea+bOMD/87X4lftiJkkaBiuG6ALQy1SLmEd7BSmVCuwCQsBrCamgBoLyfFDD1EPg=="], "basic-auth": ["basic-auth@2.0.1", "", { "dependencies": { "safe-buffer": "5.1.2" } }, "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg=="], @@ -2412,15 +2330,13 @@ "bn.js": ["bn.js@5.2.3", "", {}, "sha512-EAcmnPkxpntVL+DS7bO1zhcZNvCkxqtkd0ZY53h06GNQ3DEkkGZ/gKgmDv6DdZQGj9BgfSPKtJJ7Dp1GPP8f7w=="], - "body-parser": ["body-parser@1.20.4", "", { "dependencies": { "bytes": "~3.1.2", "content-type": "~1.0.5", "debug": "2.6.9", "depd": "2.0.0", "destroy": "~1.2.0", "http-errors": "~2.0.1", "iconv-lite": "~0.4.24", "on-finished": "~2.4.1", "qs": "~6.14.0", "raw-body": "~2.5.3", "type-is": "~1.6.18", "unpipe": "~1.0.0" } }, "sha512-ZTgYYLMOXY9qKU/57FAo8F+HA2dGX7bqGc71txDRC1rS4frdFI5R7NhluHxH6M0YItAP0sHB4uqAOcYKxO6uGA=="], - - "borsh": ["borsh@0.7.0", "", { "dependencies": { "bn.js": "^5.2.0", "bs58": "^4.0.0", "text-encoding-utf-8": "^1.0.2" } }, "sha512-CLCsZGIBCFnPtkNnieW/a8wmreDmfUtjU2m9yHrzPXIlNbqVs0AQrSatSG6vdNYUqdc83tkQi2eHfF98ubzQLA=="], + "body-parser": ["body-parser@1.20.5", "", { "dependencies": { "bytes": "~3.1.2", "content-type": "~1.0.5", "debug": "2.6.9", "depd": "2.0.0", "destroy": "~1.2.0", "http-errors": "~2.0.1", "iconv-lite": "~0.4.24", "on-finished": "~2.4.1", "qs": "~6.15.1", "raw-body": "~2.5.3", "type-is": "~1.6.18", "unpipe": "~1.0.0" } }, "sha512-3grm+/2tUOvu2cjJkvsIxrv/wVpfXQW4PsQHYm7yk4vfpu7Ekl6nEsYBoJUL6qDwZUx8wUhQ8tR2qz+ad9c9OA=="], "bowser": ["bowser@2.14.1", "", {}, "sha512-tzPjzCxygAKWFOJP011oxFHs57HzIhOEracIgAePE4pqB3LikALKnSzUyU4MGs9/iCEUuHlAJTjTc5M+u7YEGg=="], "boxen": ["boxen@5.1.2", "", { "dependencies": { "ansi-align": "^3.0.0", "camelcase": "^6.2.0", "chalk": "^4.1.0", "cli-boxes": "^2.2.1", "string-width": "^4.2.2", "type-fest": "^0.20.2", "widest-line": "^3.1.0", "wrap-ansi": "^7.0.0" } }, "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ=="], - "brace-expansion": ["brace-expansion@2.0.2", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ=="], + "brace-expansion": ["brace-expansion@2.1.1", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-WR1cURNjuvBLMZBMbqM0UoE+WAfdUcEV1ccD8PVBVOI+Z3ND4+SZbN8RsfT2bMuG1qwz5RFvPukSZm5fF2D5eA=="], "braces": ["braces@3.0.3", "", { "dependencies": { "fill-range": "^7.1.1" } }, "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA=="], @@ -2438,11 +2354,11 @@ "browserify-rsa": ["browserify-rsa@4.1.1", "", { "dependencies": { "bn.js": "^5.2.1", "randombytes": "^2.1.0", "safe-buffer": "^5.2.1" } }, "sha512-YBjSAiTqM04ZVei6sXighu679a3SqWORA3qZTEqZImnlkDIFtKc6pNutpjyZ8RJTjQtuYfeetkxM11GwoYXMIQ=="], - "browserify-sign": ["browserify-sign@4.2.5", "", { "dependencies": { "bn.js": "^5.2.2", "browserify-rsa": "^4.1.1", "create-hash": "^1.2.0", "create-hmac": "^1.1.7", "elliptic": "^6.6.1", "inherits": "^2.0.4", "parse-asn1": "^5.1.9", "readable-stream": "^2.3.8", "safe-buffer": "^5.2.1" } }, "sha512-C2AUdAJg6rlM2W5QMp2Q4KGQMVBwR1lIimTsUnutJ8bMpW5B52pGpR2gEnNBNwijumDo5FojQ0L9JrXA8m4YEw=="], + "browserify-sign": ["browserify-sign@4.2.6", "", { "dependencies": { "bn.js": "^5.2.3", "browserify-rsa": "^4.1.1", "create-hash": "^1.2.0", "create-hmac": "^1.1.7", "elliptic": "^6.6.1", "inherits": "^2.0.4", "parse-asn1": "^5.1.9", "readable-stream": "^2.3.8", "safe-buffer": "^5.2.1" } }, "sha512-sd+Q65fjlWCYWtZKXiKfrUc8d+4jtp/8f0W2NkwzLtoW4bI6UDnWusLWIurHnmurW0XShIRxpwiOX4EoPtXUAg=="], "browserify-zlib": ["browserify-zlib@0.2.0", "", { "dependencies": { "pako": "~1.0.5" } }, "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA=="], - "browserslist": ["browserslist@4.28.1", "", { "dependencies": { "baseline-browser-mapping": "^2.9.0", "caniuse-lite": "^1.0.30001759", "electron-to-chromium": "^1.5.263", "node-releases": "^2.0.27", "update-browserslist-db": "^1.2.0" }, "bin": { "browserslist": "cli.js" } }, "sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA=="], + "browserslist": ["browserslist@4.28.2", "", { "dependencies": { "baseline-browser-mapping": "^2.10.12", "caniuse-lite": "^1.0.30001782", "electron-to-chromium": "^1.5.328", "node-releases": "^2.0.36", "update-browserslist-db": "^1.2.3" }, "bin": { "browserslist": "cli.js" } }, "sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg=="], "bs58": ["bs58@6.0.0", "", { "dependencies": { "base-x": "^5.0.0" } }, "sha512-PD0wEnEYg6ijszw/u8s+iI3H17cTymlrwkKhDhPZq+Sokl3AU4htyBFTjAeNAlCCmg0f53g6ih3jATyCKftTfw=="], @@ -2464,7 +2380,7 @@ "builtin-status-codes": ["builtin-status-codes@3.0.0", "", {}, "sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ=="], - "bun-types": ["bun-types@1.3.11", "", { "dependencies": { "@types/node": "*" } }, "sha512-1KGPpoxQWl9f6wcZh57LvrPIInQMn2TQ7jsgxqpRzg+l0QPOFvJVH7HmvHo/AiPgwXy+/Thf6Ov3EdVn1vOabg=="], + "bun-types": ["bun-types@1.3.14", "", { "dependencies": { "@types/node": "*" } }, "sha512-4N0ig0fEomHt5R0KCFWjovxow98rIoRwKolrYdCcknNwMekCXRnWEUvgu5soYV8QXtVsrUD8B95MBOZGPvr6KQ=="], "bundle-require": ["bundle-require@5.1.0", "", { "dependencies": { "load-tsconfig": "^0.2.3" }, "peerDependencies": { "esbuild": ">=0.18" } }, "sha512-3WrrOuZiyaaZPWiEt4G3+IffISVC9HYlWueJEBWED4ZH4aIAC2PnkdnuRrR94M+w6yGWn4AglWtJtBI8YqvgoA=="], @@ -2478,7 +2394,7 @@ "cacheable-request": ["cacheable-request@10.2.14", "", { "dependencies": { "@types/http-cache-semantics": "^4.0.2", "get-stream": "^6.0.1", "http-cache-semantics": "^4.1.1", "keyv": "^4.5.3", "mimic-response": "^4.0.0", "normalize-url": "^8.0.0", "responselike": "^3.0.0" } }, "sha512-zkDT5WAF4hSSoUgyfg5tFIxz8XQK+25W/TLVojJTMKBaxevLBBtLxgqguAuVQB8PVW79FVjHcU+GJ9tVbDZ9mQ=="], - "call-bind": ["call-bind@1.0.8", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.0", "es-define-property": "^1.0.0", "get-intrinsic": "^1.2.4", "set-function-length": "^1.2.2" } }, "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww=="], + "call-bind": ["call-bind@1.0.9", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "es-define-property": "^1.0.1", "get-intrinsic": "^1.3.0", "set-function-length": "^1.2.2" } }, "sha512-a/hy+pNsFUTR+Iz8TCJvXudKVLAnz/DyeSUo10I5yvFDQJBFU2s9uqQpoSrJlroHUKoKqzg+epxyP9lqFdzfBQ=="], "call-bind-apply-helpers": ["call-bind-apply-helpers@1.0.2", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2" } }, "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ=="], @@ -2490,7 +2406,7 @@ "camelcase": ["camelcase@6.3.0", "", {}, "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA=="], - "caniuse-lite": ["caniuse-lite@1.0.30001781", "", {}, "sha512-RdwNCyMsNBftLjW6w01z8bKEvT6e/5tpPVEgtn22TiLGlstHOVecsX2KHFkD5e/vRnIE4EGzpuIODb3mtswtkw=="], + "caniuse-lite": ["caniuse-lite@1.0.30001793", "", {}, "sha512-iwSsYWaCOoh26cV8NwNRViHlrfUvYsHDfRVcbtmw0Kg6PJIZZXwMkj1442FYLBGkeUf1juAsU3DTfxW579mrPA=="], "capital-case": ["capital-case@1.0.4", "", { "dependencies": { "no-case": "^3.0.4", "tslib": "^2.0.3", "upper-case-first": "^2.0.2" } }, "sha512-ds37W8CytHgwnhGGTi88pcPyR15qoNkOpYwmMMfnWqqWgESapLqvDx6huFjQ5vqWSn2Z06173XNA7LtMOeUh1A=="], @@ -2598,7 +2514,7 @@ "constants-browserify": ["constants-browserify@1.0.0", "", {}, "sha512-xFxOwqIzR/e1k1gLiWEophSCMqXcwVHIH7akf7b/vxcUeGunlj3hvZaaqxwHsTgn+IndtkQJgSztIDWeumWJDQ=="], - "content-disposition": ["content-disposition@1.0.1", "", {}, "sha512-oIXISMynqSqm241k6kcQ5UwttDILMK4BiurCfGEREw6+X9jkkpEe5T9FZaApyLGGOnFuyMWZpdolTXMtvEJ08Q=="], + "content-disposition": ["content-disposition@1.1.0", "", {}, "sha512-5jRCH9Z/+DRP7rkvY83B+yGIGX96OYdJmzngqnw2SBSxqCFPd0w2km3s5iawpGX8krnwSGmF0FW5Nhr0Hfai3g=="], "content-type": ["content-type@1.0.5", "", {}, "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA=="], @@ -2606,7 +2522,7 @@ "cookie": ["cookie@0.7.2", "", {}, "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w=="], - "cookie-es": ["cookie-es@2.0.0", "", {}, "sha512-RAj4E421UYRgqokKUmotqAwuplYw15qtdXfY+hGzgCJ/MBjCVZcSoHK/kH9kocfjRjcDME7IiDWR/1WX1TM2Pg=="], + "cookie-es": ["cookie-es@3.1.1", "", {}, "sha512-UaXxwISYJPTr9hwQxMFYZ7kNhSXboMXP+Z3TRX6f1/NyaGPfuNUZOWP1pUEb75B2HjfklIYLVRfWiFZJyC6Npg=="], "cookie-parser": ["cookie-parser@1.4.7", "", { "dependencies": { "cookie": "0.7.2", "cookie-signature": "1.0.6" } }, "sha512-nGUvgXnotP3BsjiLX2ypbQnWoGUPIIfHQNZkkC668ntrzGWEZVW70HDEB1qnNGMicPje6EttlIgzo51YSwNQGw=="], @@ -2652,7 +2568,7 @@ "d": ["d@1.0.2", "", { "dependencies": { "es5-ext": "^0.10.64", "type": "^2.7.2" } }, "sha512-MOqHvMWF9/9MX6nza0KgvFH4HpMU0EF5uUDXqX/BtxtU8NfB0QzRtJ8Oe/6SuS4kbhyzVJwjd97EA4PKrzJ8bw=="], - "daisyui": ["daisyui@5.5.19", "", {}, "sha512-pbFAkl1VCEh/MPCeclKL61I/MqRIFFhNU7yiXoDDRapXN4/qNCoMxeCCswyxEEhqL5eiTTfwHvucFtOE71C9sA=="], + "daisyui": ["daisyui@5.5.20", "", {}, "sha512-HemJcjl0Gk9rQ8BcgofN6p+EURrqftQG9wK1Hkxs98i49xe68+QxpNvry+PyxwkIUgrbMpNmZ5ZWjmtffAjfhQ=="], "data-uri-to-buffer": ["data-uri-to-buffer@4.0.1", "", {}, "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A=="], @@ -2696,9 +2612,7 @@ "define-properties": ["define-properties@1.2.1", "", { "dependencies": { "define-data-property": "^1.0.1", "has-property-descriptors": "^1.0.0", "object-keys": "^1.1.1" } }, "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg=="], - "defu": ["defu@6.1.4", "", {}, "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg=="], - - "delay": ["delay@5.0.0", "", {}, "sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw=="], + "defu": ["defu@6.1.7", "", {}, "sha512-7z22QmUWiQ/2d0KkdYmANbRUVABpZ9SNYyH5vx6PZ+nE5bcC0l7uFvEfHlyld/HcGBFTL536ClDt3DEcSlEJAQ=="], "delayed-stream": ["delayed-stream@1.0.0", "", {}, "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="], @@ -2764,7 +2678,7 @@ "ee-first": ["ee-first@1.1.1", "", {}, "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="], - "electron-to-chromium": ["electron-to-chromium@1.5.322", "", {}, "sha512-vFU34OcrvMcH66T+dYC3G4nURmgfDVewMIu6Q2urXpumAPSMmzvcn04KVVV8Opikq8Vs5nUbO/8laNhNRqSzYw=="], + "electron-to-chromium": ["electron-to-chromium@1.5.362", "", {}, "sha512-PUY2DrLvkjkUuWqq+KPL2iWshrJsZOcIojzRQ7eXFacc9dWga7MGMJAa15VbiejSZB1PAXaRLAiKgruHP8LB1w=="], "elliptic": ["elliptic@6.6.1", "", { "dependencies": { "bn.js": "^4.11.9", "brorand": "^1.1.0", "hash.js": "^1.0.0", "hmac-drbg": "^1.0.1", "inherits": "^2.0.4", "minimalistic-assert": "^1.0.1", "minimalistic-crypto-utils": "^1.0.1" } }, "sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g=="], @@ -2780,11 +2694,11 @@ "end-of-stream": ["end-of-stream@1.4.5", "", { "dependencies": { "once": "^1.4.0" } }, "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg=="], - "engine.io-client": ["engine.io-client@6.6.4", "", { "dependencies": { "@socket.io/component-emitter": "~3.1.0", "debug": "~4.4.1", "engine.io-parser": "~5.2.1", "ws": "~8.18.3", "xmlhttprequest-ssl": "~2.1.1" } }, "sha512-+kjUJnZGwzewFDw951CDWcwj35vMNf2fcj7xQWOctq1F2i1jkDdVvdFG9kM/BEChymCH36KgjnW0NsL58JYRxw=="], + "engine.io-client": ["engine.io-client@6.6.5", "", { "dependencies": { "@socket.io/component-emitter": "~3.1.0", "debug": "~4.4.1", "engine.io-parser": "~5.2.1", "ws": "~8.20.1", "xmlhttprequest-ssl": "~2.1.1" } }, "sha512-QCwxUDULPlXv8F6tqMMKx5dNkTe6OaBYRMPYeXKBlyOoKvAmE0ac6pW7fFhSscJ/5SI7666/U/B+MElbsrJlIg=="], "engine.io-parser": ["engine.io-parser@5.2.3", "", {}, "sha512-HqD3yTBfnBxIrbnM1DoD6Pcq8NECnh8d4As1Qgh0z5Gg3jRRIqijury0CL3ghu/edArpUYiYqQiDUQBIs4np3Q=="], - "enhanced-resolve": ["enhanced-resolve@5.20.1", "", { "dependencies": { "graceful-fs": "^4.2.4", "tapable": "^2.3.0" } }, "sha512-Qohcme7V1inbAfvjItgw0EaxVX5q2rdVEZHRBrEQdRZTssLDGsL8Lwrznl8oQ/6kuTJONLaDcGjkNP247XEhcA=="], + "enhanced-resolve": ["enhanced-resolve@5.22.0", "", { "dependencies": { "graceful-fs": "^4.2.4", "tapable": "^2.3.3" } }, "sha512-xYcDWrpELkFzz9SpZ3PlI6Eu6eD93Yf0WLDRxikGhWJ3MAir2SNZTIVCVZqZ/NUyx8AdMc2gT9C0gPiw18kG+A=="], "enquirer": ["enquirer@2.4.1", "", { "dependencies": { "ansi-colors": "^4.1.1", "strip-ansi": "^6.0.1" } }, "sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ=="], @@ -2794,17 +2708,17 @@ "error-ex": ["error-ex@1.3.4", "", { "dependencies": { "is-arrayish": "^0.2.1" } }, "sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ=="], - "es-abstract": ["es-abstract@1.24.1", "", { "dependencies": { "array-buffer-byte-length": "^1.0.2", "arraybuffer.prototype.slice": "^1.0.4", "available-typed-arrays": "^1.0.7", "call-bind": "^1.0.8", "call-bound": "^1.0.4", "data-view-buffer": "^1.0.2", "data-view-byte-length": "^1.0.2", "data-view-byte-offset": "^1.0.1", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.1.1", "es-set-tostringtag": "^2.1.0", "es-to-primitive": "^1.3.0", "function.prototype.name": "^1.1.8", "get-intrinsic": "^1.3.0", "get-proto": "^1.0.1", "get-symbol-description": "^1.1.0", "globalthis": "^1.0.4", "gopd": "^1.2.0", "has-property-descriptors": "^1.0.2", "has-proto": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", "internal-slot": "^1.1.0", "is-array-buffer": "^3.0.5", "is-callable": "^1.2.7", "is-data-view": "^1.0.2", "is-negative-zero": "^2.0.3", "is-regex": "^1.2.1", "is-set": "^2.0.3", "is-shared-array-buffer": "^1.0.4", "is-string": "^1.1.1", "is-typed-array": "^1.1.15", "is-weakref": "^1.1.1", "math-intrinsics": "^1.1.0", "object-inspect": "^1.13.4", "object-keys": "^1.1.1", "object.assign": "^4.1.7", "own-keys": "^1.0.1", "regexp.prototype.flags": "^1.5.4", "safe-array-concat": "^1.1.3", "safe-push-apply": "^1.0.0", "safe-regex-test": "^1.1.0", "set-proto": "^1.0.0", "stop-iteration-iterator": "^1.1.0", "string.prototype.trim": "^1.2.10", "string.prototype.trimend": "^1.0.9", "string.prototype.trimstart": "^1.0.8", "typed-array-buffer": "^1.0.3", "typed-array-byte-length": "^1.0.3", "typed-array-byte-offset": "^1.0.4", "typed-array-length": "^1.0.7", "unbox-primitive": "^1.1.0", "which-typed-array": "^1.1.19" } }, "sha512-zHXBLhP+QehSSbsS9Pt23Gg964240DPd6QCf8WpkqEXxQ7fhdZzYsocOr5u7apWonsS5EjZDmTF+/slGMyasvw=="], + "es-abstract": ["es-abstract@1.24.2", "", { "dependencies": { "array-buffer-byte-length": "^1.0.2", "arraybuffer.prototype.slice": "^1.0.4", "available-typed-arrays": "^1.0.7", "call-bind": "^1.0.8", "call-bound": "^1.0.4", "data-view-buffer": "^1.0.2", "data-view-byte-length": "^1.0.2", "data-view-byte-offset": "^1.0.1", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.1.1", "es-set-tostringtag": "^2.1.0", "es-to-primitive": "^1.3.0", "function.prototype.name": "^1.1.8", "get-intrinsic": "^1.3.0", "get-proto": "^1.0.1", "get-symbol-description": "^1.1.0", "globalthis": "^1.0.4", "gopd": "^1.2.0", "has-property-descriptors": "^1.0.2", "has-proto": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", "internal-slot": "^1.1.0", "is-array-buffer": "^3.0.5", "is-callable": "^1.2.7", "is-data-view": "^1.0.2", "is-negative-zero": "^2.0.3", "is-regex": "^1.2.1", "is-set": "^2.0.3", "is-shared-array-buffer": "^1.0.4", "is-string": "^1.1.1", "is-typed-array": "^1.1.15", "is-weakref": "^1.1.1", "math-intrinsics": "^1.1.0", "object-inspect": "^1.13.4", "object-keys": "^1.1.1", "object.assign": "^4.1.7", "own-keys": "^1.0.1", "regexp.prototype.flags": "^1.5.4", "safe-array-concat": "^1.1.3", "safe-push-apply": "^1.0.0", "safe-regex-test": "^1.1.0", "set-proto": "^1.0.0", "stop-iteration-iterator": "^1.1.0", "string.prototype.trim": "^1.2.10", "string.prototype.trimend": "^1.0.9", "string.prototype.trimstart": "^1.0.8", "typed-array-buffer": "^1.0.3", "typed-array-byte-length": "^1.0.3", "typed-array-byte-offset": "^1.0.4", "typed-array-length": "^1.0.7", "unbox-primitive": "^1.1.0", "which-typed-array": "^1.1.19" } }, "sha512-2FpH9Q5i2RRwyEP1AylXe6nYLR5OhaJTZwmlcP0dL/+JCbgg7yyEo/sEK6HeGZRf3dFpWwThaRHVApXSkW3xeg=="], "es-define-property": ["es-define-property@1.0.1", "", {}, "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g=="], "es-errors": ["es-errors@1.3.0", "", {}, "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw=="], - "es-iterator-helpers": ["es-iterator-helpers@1.3.1", "", { "dependencies": { "call-bind": "^1.0.8", "call-bound": "^1.0.4", "define-properties": "^1.2.1", "es-abstract": "^1.24.1", "es-errors": "^1.3.0", "es-set-tostringtag": "^2.1.0", "function-bind": "^1.1.2", "get-intrinsic": "^1.3.0", "globalthis": "^1.0.4", "gopd": "^1.2.0", "has-property-descriptors": "^1.0.2", "has-proto": "^1.2.0", "has-symbols": "^1.1.0", "internal-slot": "^1.1.0", "iterator.prototype": "^1.1.5", "math-intrinsics": "^1.1.0", "safe-array-concat": "^1.1.3" } }, "sha512-zWwRvqWiuBPr0muUG/78cW3aHROFCNIQ3zpmYDpwdbnt2m+xlNyRWpHBpa2lJjSBit7BQ+RXA1iwbSmu5yJ/EQ=="], + "es-iterator-helpers": ["es-iterator-helpers@1.3.2", "", { "dependencies": { "call-bind": "^1.0.9", "call-bound": "^1.0.4", "define-properties": "^1.2.1", "es-abstract": "^1.24.2", "es-errors": "^1.3.0", "es-set-tostringtag": "^2.1.0", "function-bind": "^1.1.2", "get-intrinsic": "^1.3.0", "globalthis": "^1.0.4", "gopd": "^1.2.0", "has-property-descriptors": "^1.0.2", "has-proto": "^1.2.0", "has-symbols": "^1.1.0", "internal-slot": "^1.1.0", "iterator.prototype": "^1.1.5", "math-intrinsics": "^1.1.0" } }, "sha512-HVLACW1TppGYjJ8H6/jqH/pqOtKRw6wMlrB23xfExmFWxFquAIWCmwoLsOyN96K4a5KbmOf5At9ZUO3GZbetAw=="], "es-module-lexer": ["es-module-lexer@1.7.0", "", {}, "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA=="], - "es-object-atoms": ["es-object-atoms@1.1.1", "", { "dependencies": { "es-errors": "^1.3.0" } }, "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA=="], + "es-object-atoms": ["es-object-atoms@1.1.2", "", { "dependencies": { "es-errors": "^1.3.0" } }, "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw=="], "es-set-tostringtag": ["es-set-tostringtag@2.1.0", "", { "dependencies": { "es-errors": "^1.3.0", "get-intrinsic": "^1.2.6", "has-tostringtag": "^1.0.2", "hasown": "^2.0.2" } }, "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA=="], @@ -2818,10 +2732,6 @@ "es6-iterator": ["es6-iterator@2.0.3", "", { "dependencies": { "d": "1", "es5-ext": "^0.10.35", "es6-symbol": "^3.1.1" } }, "sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g=="], - "es6-promise": ["es6-promise@4.2.8", "", {}, "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w=="], - - "es6-promisify": ["es6-promisify@5.0.0", "", { "dependencies": { "es6-promise": "^4.0.3" } }, "sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ=="], - "es6-symbol": ["es6-symbol@3.1.4", "", { "dependencies": { "d": "^1.0.2", "ext": "^1.7.0" } }, "sha512-U9bFFjX8tFiATgtkJ1zg25+KviIXpgRvRHS8sau3GfhVzThRQrOeksPeT0BWW2MNZs1OEWJ1DPXOQMn0KKRkvg=="], "es6-weak-map": ["es6-weak-map@2.0.3", "", { "dependencies": { "d": "1", "es5-ext": "^0.10.46", "es6-iterator": "^2.0.3", "es6-symbol": "^3.1.1" } }, "sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA=="], @@ -2892,7 +2802,7 @@ "eventemitter2": ["eventemitter2@6.4.9", "", {}, "sha512-JEPTiaOt9f04oa6NOkc4aH+nVp5I3wEjpHbIPqfgCdD5v5bUzy7xQqwcVO2aDQgOWhI28da57HksMrzK9HlRxg=="], - "eventemitter3": ["eventemitter3@5.0.1", "", {}, "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA=="], + "eventemitter3": ["eventemitter3@5.0.4", "", {}, "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw=="], "events": ["events@3.3.0", "", {}, "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q=="], @@ -2922,8 +2832,6 @@ "extension-port-stream": ["extension-port-stream@3.0.0", "", { "dependencies": { "readable-stream": "^3.6.2 || ^4.4.2", "webextension-polyfill": ">=0.10.0 <1.0" } }, "sha512-an2S5quJMiy5bnZKEf6AkfH/7r8CzHvhchU40gxN+OM6HPhe7Z9T1FUychcf2M9PpPOO0Hf7BAEfJkw2TDIBDw=="], - "eyes": ["eyes@0.1.8", "", {}, "sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ=="], - "fast-deep-equal": ["fast-deep-equal@3.1.3", "", {}, "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="], "fast-fifo": ["fast-fifo@1.3.2", "", {}, "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ=="], @@ -2938,13 +2846,11 @@ "fast-safe-stringify": ["fast-safe-stringify@2.1.1", "", {}, "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA=="], - "fast-stable-stringify": ["fast-stable-stringify@1.0.0", "", {}, "sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag=="], + "fast-uri": ["fast-uri@3.1.2", "", {}, "sha512-rVjf7ArG3LTk+FS6Yw81V1DLuZl1bRbNrev6Tmd/9RaroeeRRJhAt7jg/6YFxbvAQXUCavSoZhPPj6oOx+5KjQ=="], - "fast-uri": ["fast-uri@3.1.0", "", {}, "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA=="], + "fast-xml-builder": ["fast-xml-builder@1.2.0", "", { "dependencies": { "path-expression-matcher": "^1.5.0", "xml-naming": "^0.1.0" } }, "sha512-00aAWieqff+ZJhsXA4g1g7M8k+7AYoMUUHF+/zFb5U6Uv/P0Vl4QZo84/IcufzYalLuEj9928bXN9PbbFzMF0Q=="], - "fast-xml-builder": ["fast-xml-builder@1.1.4", "", { "dependencies": { "path-expression-matcher": "^1.1.3" } }, "sha512-f2jhpN4Eccy0/Uz9csxh3Nu6q4ErKxf0XIsasomfOihuSUa3/xw6w8dnOtCDgEItQFJG8KyXPzQXzcODDrrbOg=="], - - "fast-xml-parser": ["fast-xml-parser@5.5.8", "", { "dependencies": { "fast-xml-builder": "^1.1.4", "path-expression-matcher": "^1.2.0", "strnum": "^2.2.0" }, "bin": { "fxparser": "src/cli/cli.js" } }, "sha512-Z7Fh2nVQSb2d+poDViM063ix2ZGt9jmY1nWhPfHBOK2Hgnb/OW3P4Et3P/81SEej0J7QbWtJqxO05h8QYfK7LQ=="], + "fast-xml-parser": ["fast-xml-parser@5.7.3", "", { "dependencies": { "@nodable/entities": "^2.1.0", "fast-xml-builder": "^1.1.7", "path-expression-matcher": "^1.5.0", "strnum": "^2.2.3" }, "bin": { "fxparser": "src/cli/cli.js" } }, "sha512-C0AaNuC+mscy6vrAQKAc/rMq+zAPHodfHGZu4sGVehvAQt/JLG1O5zEcYcXSY5zSqr4YVgxsB+pHXTq0i7eDlg=="], "fastq": ["fastq@1.20.1", "", { "dependencies": { "reusify": "^1.0.4" } }, "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw=="], @@ -2956,7 +2862,7 @@ "fetch-blob": ["fetch-blob@3.2.0", "", { "dependencies": { "node-domexception": "^1.0.0", "web-streams-polyfill": "^3.0.3" } }, "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ=="], - "fflate": ["fflate@0.8.2", "", {}, "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A=="], + "fflate": ["fflate@0.8.3", "", {}, "sha512-tbZNuJrLwGUp3zshBtdy4W+ORxZuIh8a5ilyIEQDC5rY1f3U20JMry0Ll3WBzU58EZKsEuJFXhb5gwv8CsPvgA=="], "figures": ["figures@3.2.0", "", { "dependencies": { "escape-string-regexp": "^1.0.5" } }, "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg=="], @@ -2990,7 +2896,7 @@ "fn.name": ["fn.name@1.1.0", "", {}, "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw=="], - "follow-redirects": ["follow-redirects@1.15.11", "", {}, "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ=="], + "follow-redirects": ["follow-redirects@1.16.0", "", {}, "sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw=="], "for-each": ["for-each@0.3.5", "", { "dependencies": { "is-callable": "^1.2.7" } }, "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg=="], @@ -3006,7 +2912,7 @@ "fp-ts": ["fp-ts@1.19.3", "", {}, "sha512-H5KQDspykdHuztLTg+ajGN0Z2qUjcEf3Ybxc6hLt0k7/zPkn29XnKnxlBPyW2XIddWrGaJBzBl4VLYOtk39yZg=="], - "framer-motion": ["framer-motion@12.38.0", "", { "dependencies": { "motion-dom": "^12.38.0", "motion-utils": "^12.36.0", "tslib": "^2.4.0" }, "peerDependencies": { "@emotion/is-prop-valid": "*", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" }, "optionalPeers": ["@emotion/is-prop-valid", "react", "react-dom"] }, "sha512-rFYkY/pigbcswl1XQSb7q424kSTQ8q6eAC+YUsSKooHQYuLdzdHjrt6uxUC+PRAO++q5IS7+TamgIw1AphxR+g=="], + "framer-motion": ["framer-motion@12.40.0", "", { "dependencies": { "motion-dom": "^12.40.0", "motion-utils": "^12.39.0", "tslib": "^2.4.0" }, "peerDependencies": { "@emotion/is-prop-valid": "*", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" }, "optionalPeers": ["@emotion/is-prop-valid", "react", "react-dom"] }, "sha512-uaBd3qC1v3KQqBEjwTUd183K6PbS+j0yR9w9VmEOLWA/tnUcSn8Xa3uck7t4dgpDoUss8xQTcj8W2L07lrnLFg=="], "fresh": ["fresh@2.0.0", "", {}, "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A=="], @@ -3036,7 +2942,7 @@ "get-caller-file": ["get-caller-file@2.0.5", "", {}, "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="], - "get-east-asian-width": ["get-east-asian-width@1.5.0", "", {}, "sha512-CQ+bEO+Tva/qlmw24dCejulK5pMzVnUOFOijVogd3KQs07HnRIgp8TGipvCCRT06xeYEbpbgwaCxglFyiuIcmA=="], + "get-east-asian-width": ["get-east-asian-width@1.6.0", "", {}, "sha512-QRbvDIbx6YklUe6RxeTeleMR0yv3cYH6PsPZHcnVn7xv7zO1BHN8r0XETu8n6Ye3Q+ahtSarc3WgtNWmehIBfA=="], "get-func-name": ["get-func-name@2.0.2", "", {}, "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ=="], @@ -3052,8 +2958,6 @@ "get-symbol-description": ["get-symbol-description@1.1.0", "", { "dependencies": { "call-bound": "^1.0.3", "es-errors": "^1.3.0", "get-intrinsic": "^1.2.6" } }, "sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg=="], - "get-tsconfig": ["get-tsconfig@4.13.7", "", { "dependencies": { "resolve-pkg-maps": "^1.0.0" } }, "sha512-7tN6rFgBlMgpBML5j8typ92BKFi2sFQvIdpAqLA2beia5avZDrMs0FLZiM5etShWq5irVyGcGMEA1jcDaK7A/Q=="], - "ghost-testrpc": ["ghost-testrpc@0.0.2", "", { "dependencies": { "chalk": "^2.4.2", "node-emoji": "^1.10.0" }, "bin": { "testrpc-sc": "./index.js" } }, "sha512-i08dAEgJ2g8z5buJIrCTduwPIhih3DP+hOCTyyryikfV8T0bNvHnGXO67i0DD1H4GBDETTclPy9njZbfluQYrQ=="], "glob": ["glob@7.1.7", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.0.4", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ=="], @@ -3070,7 +2974,7 @@ "globby": ["globby@10.0.2", "", { "dependencies": { "@types/glob": "^7.1.1", "array-union": "^2.1.0", "dir-glob": "^3.0.1", "fast-glob": "^3.0.3", "glob": "^7.1.3", "ignore": "^5.1.1", "merge2": "^1.2.3", "slash": "^3.0.0" } }, "sha512-7dUi7RvCoT/xast/o/dLN53oqND4yk0nsHkhRgn9w65C4PofCLOoJ39iSOg+qVDdWQPIEj+eszMHQ+aLVwwQSg=="], - "goober": ["goober@2.1.18", "", { "peerDependencies": { "csstype": "^3.0.10" } }, "sha512-2vFqsaDVIT9Gz7N6kAL++pLpp41l3PfDuusHcjnGLfR6+huZkl6ziX+zgVC3ZxpqWhzH6pyDdGrCeDhMIvwaxw=="], + "goober": ["goober@2.1.19", "", { "peerDependencies": { "csstype": "^3.0.10" } }, "sha512-U7veizMqxyKlM58+Z5j2ngJBH/r9siDmxpvNxSw0PylF6WQvrASJEZrxh1hidRBJc2jqoBVSyOban5u8m+6Rxg=="], "google-auth-library": ["google-auth-library@9.15.1", "", { "dependencies": { "base64-js": "^1.3.0", "ecdsa-sig-formatter": "^1.0.11", "gaxios": "^6.1.1", "gcp-metadata": "^6.1.0", "gtoken": "^7.0.0", "jws": "^4.0.0" } }, "sha512-Jb6Z0+nvECVz+2lzSMt9u98UsoakXxA2HGHMCxh+so3n90XgYWkq5dur19JAJV7ONiJY22yBTyJB1TSkvPq9Ng=="], @@ -3094,11 +2998,11 @@ "graphql-tag": ["graphql-tag@2.12.6", "", { "dependencies": { "tslib": "^2.1.0" }, "peerDependencies": { "graphql": "^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0" } }, "sha512-FdSNcu2QQcWnM2VNvSCCDCVS5PpPqpzgFT8+GXzqJuoDd0CBncxCY278u4mhRO7tMgo2JjgJA5aZ+nWSQ/Z+xg=="], - "graphql-ws": ["graphql-ws@6.0.7", "", { "peerDependencies": { "@fastify/websocket": "^10 || ^11", "crossws": "~0.3", "graphql": "^15.10.1 || ^16", "ws": "^8" }, "optionalPeers": ["@fastify/websocket", "crossws", "ws"] }, "sha512-yoLRW+KRlDmnnROdAu7sX77VNLC0bsFoZyGQJLy1cF+X/SkLg/fWkRGrEEYQK8o2cafJ2wmEaMqMEZB3U3DYDg=="], + "graphql-ws": ["graphql-ws@6.0.8", "", { "peerDependencies": { "@fastify/websocket": "^10 || ^11", "crossws": "~0.3", "graphql": "^15.10.1 || ^16", "ws": "^8" }, "optionalPeers": ["@fastify/websocket", "crossws", "ws"] }, "sha512-m3EOaNsUBXwAnkBWbzPfe0Nq8pXUfxsWnolC54sru3FzHvhTZL0Ouf/BoQsaGAXqM+YPerXOJ47BUnmgmoupCw=="], "gtoken": ["gtoken@7.1.0", "", { "dependencies": { "gaxios": "^6.0.0", "jws": "^4.0.0" } }, "sha512-pCcEwRi+TKpMlxAQObHDQ56KawURgyAf6jtIY046fJ5tIv3zDe/LEIubckAO8fj6JnAxLdmWkUfNyulQ2iKdEw=="], - "h3": ["h3@1.15.10", "", { "dependencies": { "cookie-es": "^1.2.2", "crossws": "^0.3.5", "defu": "^6.1.4", "destr": "^2.0.5", "iron-webcrypto": "^1.2.1", "node-mock-http": "^1.0.4", "radix3": "^1.1.2", "ufo": "^1.6.3", "uncrypto": "^0.1.3" } }, "sha512-YzJeWSkDZxAhvmp8dexjRK5hxziRO7I9m0N53WhvYL5NiWfkUkzssVzY9jvGu0HBoLFW6+duYmNSn6MaZBCCtg=="], + "h3": ["h3@1.15.11", "", { "dependencies": { "cookie-es": "^1.2.3", "crossws": "^0.3.5", "defu": "^6.1.6", "destr": "^2.0.5", "iron-webcrypto": "^1.2.1", "node-mock-http": "^1.0.4", "radix3": "^1.1.2", "ufo": "^1.6.3", "uncrypto": "^0.1.3" } }, "sha512-L3THSe2MPeBwgIZVSH5zLdBBU90TOxarvhK9d04IDY2AmVS8j2Jz2LIWtwsGOU3lu2I5jCN7FNvVfY2+XyF+mg=="], "handlebars": ["handlebars@4.7.9", "", { "dependencies": { "minimist": "^1.2.5", "neo-async": "^2.6.2", "source-map": "^0.6.1", "wordwrap": "^1.0.0" }, "optionalDependencies": { "uglify-js": "^3.1.4" }, "bin": { "handlebars": "bin/handlebars" } }, "sha512-4E71E0rpOaQuJR2A3xDZ+GM1HyWYv1clR58tC8emQNeQe3RH7MAzSbat+V0wG78LQBo6m6bzSG/L4pBuCsgnUQ=="], @@ -3124,7 +3028,7 @@ "hash.js": ["hash.js@1.1.7", "", { "dependencies": { "inherits": "^2.0.3", "minimalistic-assert": "^1.0.1" } }, "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA=="], - "hasown": ["hasown@2.0.2", "", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ=="], + "hasown": ["hasown@2.0.3", "", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-ej4AhfhfL2Q2zpMmLo7U1Uv9+PyhIZpgQLGT1F9miIGmiCJIoCgSmczFdrc97mWT4kVY72KA+WnnhJ5pghSvSg=="], "he": ["he@1.2.0", "", { "bin": { "he": "bin/he" } }, "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw=="], @@ -3140,7 +3044,7 @@ "hoist-non-react-statics": ["hoist-non-react-statics@3.3.2", "", { "dependencies": { "react-is": "^16.7.0" } }, "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw=="], - "hono": ["hono@4.12.9", "", {}, "sha512-wy3T8Zm2bsEvxKZM5w21VdHDDcwVS1yUFFY6i8UobSsKfFceT7TOwhbhfKsDyx7tYQlmRM5FLpIuYvNFyjctiA=="], + "hono": ["hono@4.12.23", "", {}, "sha512-eIaZ9qDgu7XV0pxOCrg7/WhnQ6Ivm22UcxhXx/A3dcbqbbYgBEkc6e/J/s7j2tS96zoB0S9VBdLwQNCWwUo4LA=="], "html-parse-stringify": ["html-parse-stringify@3.0.1", "", { "dependencies": { "void-elements": "3.1.0" } }, "sha512-KknJ50kTInJ7qIScF3jeaFRpMpE8/lfiTdzf/twXyPBLAGrLRTmkz3AdTnKeh40X8k9L2fdYwEp/42WGXIRGcg=="], @@ -3164,8 +3068,6 @@ "human-signals": ["human-signals@2.1.0", "", {}, "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw=="], - "humanize-ms": ["humanize-ms@1.2.1", "", { "dependencies": { "ms": "^2.0.0" } }, "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ=="], - "husky": ["husky@9.1.7", "", { "bin": { "husky": "bin.js" } }, "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA=="], "i18next": ["i18next@24.2.3", "", { "dependencies": { "@babel/runtime": "^7.26.10" }, "peerDependencies": { "typescript": "^5" }, "optionalPeers": ["typescript"] }, "sha512-lfbf80OzkocvX7nmZtu7nSTNbrTYR52sLWxPtlXX1zAhVw8WEnFk4puUkCR4B1dNQwbSpEHHHemcZu//7EcB7A=="], @@ -3174,7 +3076,7 @@ "iconv-lite": ["iconv-lite@0.4.24", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3" } }, "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA=="], - "idb-keyval": ["idb-keyval@6.2.2", "", {}, "sha512-yjD9nARJ/jb1g+CvD0tlhUHOrJ9Sy0P8T9MF3YaLlHnSRpwPfpTX0XIvpmw3gAJUmEu3FiICLBDPXVwyEvrleg=="], + "idb-keyval": ["idb-keyval@6.2.4", "", {}, "sha512-D/NzHWUmYJGXi++z67aMSrnisb9A3621CyRK5G89JyTlN13C8xf0g04DLxUKMufPem3e3L2JAXR6Z00OWy183Q=="], "ieee754": ["ieee754@1.2.1", "", {}, "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="], @@ -3218,7 +3120,7 @@ "io-ts": ["io-ts@1.10.4", "", { "dependencies": { "fp-ts": "^1.0.0" } }, "sha512-b23PteSnYXSONJ6JQXRAlvJhuw8KOtkqa87W4wDtvMrud/DTJd5X+NpOOI+O/zZwVq6v0VLAaJ+1EDViKEuN9g=="], - "ip-address": ["ip-address@10.1.0", "", {}, "sha512-XXADHxXmvT9+CRxhXg56LJovE+bmWnEWB78LB83VZTprKTmaC5QfruXocxzTZ2Kl0DNwKuBdlIhjL8LeY8Sf8Q=="], + "ip-address": ["ip-address@10.2.0", "", {}, "sha512-/+S6j4E9AHvW9SWMSEY9Xfy66O5PWvVEJ08O0y5JGyEKQpojb0K0GKpz/v5HJ/G0vi3D2sjGK78119oXZeE0qA=="], "ipaddr.js": ["ipaddr.js@1.9.1", "", {}, "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g=="], @@ -3244,7 +3146,7 @@ "is-callable": ["is-callable@1.2.7", "", {}, "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA=="], - "is-core-module": ["is-core-module@2.16.1", "", { "dependencies": { "hasown": "^2.0.2" } }, "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w=="], + "is-core-module": ["is-core-module@2.16.2", "", { "dependencies": { "hasown": "^2.0.3" } }, "sha512-evOr8xfXKxE6qSR0hSXL2r3sd7ALj8+7jQEUvPYcm5sgZFdJ+AYzT6yNmJenvIYQBgIGwfwz08sL8zoL7yq2BA=="], "is-data-view": ["is-data-view@1.0.2", "", { "dependencies": { "call-bound": "^1.0.2", "get-intrinsic": "^1.2.6", "is-typed-array": "^1.1.13" } }, "sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw=="], @@ -3320,7 +3222,7 @@ "isarray": ["isarray@2.0.5", "", {}, "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw=="], - "isbot": ["isbot@5.1.36", "", {}, "sha512-C/ZtXyJqDPZ7G7JPr06ApWyYoHjYexQbS6hPYD4WYCzpv2Qes6Z+CCEfTX4Owzf+1EJ933PoI2p+B9v7wpGZBQ=="], + "isbot": ["isbot@5.1.40", "", {}, "sha512-yNeeynhhtIVRBk12tBV4eHNxwB42HzR4Q3Ea7vCOiJhImGaAIdIMrbJtacQlBizGLjUPw+akkFI5Dn9T70XoVQ=="], "isexe": ["isexe@2.0.0", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="], @@ -3334,8 +3236,6 @@ "jackspeak": ["jackspeak@3.4.3", "", { "dependencies": { "@isaacs/cliui": "^8.0.2" }, "optionalDependencies": { "@pkgjs/parseargs": "^0.11.0" } }, "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw=="], - "jayson": ["jayson@4.3.0", "", { "dependencies": { "@types/connect": "^3.4.33", "@types/node": "^12.12.54", "@types/ws": "^7.4.4", "commander": "^2.20.3", "delay": "^5.0.0", "es6-promisify": "^5.0.0", "eyes": "^0.1.8", "isomorphic-ws": "^4.0.1", "json-stringify-safe": "^5.0.1", "stream-json": "^1.9.1", "uuid": "^8.3.2", "ws": "^7.5.10" }, "bin": { "jayson": "bin/jayson.js" } }, "sha512-AauzHcUcqs8OBnCHOkJY280VaTiCm57AbuO7lqzcw7JapGj50BisE3xhksye4zlTSR1+1tAz67wLTl8tEH1obQ=="], - "jiti": ["jiti@1.21.7", "", { "bin": { "jiti": "bin/jiti.js" } }, "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A=="], "jju": ["jju@1.4.0", "", {}, "sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA=="], @@ -3348,7 +3248,7 @@ "js-beautify": ["js-beautify@1.15.4", "", { "dependencies": { "config-chain": "^1.1.13", "editorconfig": "^1.0.4", "glob": "^10.4.2", "js-cookie": "^3.0.5", "nopt": "^7.2.1" }, "bin": { "css-beautify": "js/bin/css-beautify.js", "html-beautify": "js/bin/html-beautify.js", "js-beautify": "js/bin/js-beautify.js" } }, "sha512-9/KXeZUKKJwqCXUdBxFJ3vPh467OCckSBmYDwSK/EtV090K+iMJ7zx2S3HLVDIWFQdqMIsZWbnaGiba18aWhaA=="], - "js-cookie": ["js-cookie@3.0.5", "", {}, "sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw=="], + "js-cookie": ["js-cookie@3.0.7", "", {}, "sha512-z/wZZgDrkNV1eA0ULjM/F9/50Ya8fbzgKneSpoPsXSGd0KnpdtHfOZWK+GcwLk+EZbS4F9RBhU+K2RgzuDaItw=="], "js-sha3": ["js-sha3@0.8.0", "", {}, "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q=="], @@ -3380,7 +3280,7 @@ "json5": ["json5@2.2.3", "", { "bin": { "json5": "lib/cli.js" } }, "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg=="], - "jsonfile": ["jsonfile@6.2.0", "", { "dependencies": { "universalify": "^2.0.0" }, "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg=="], + "jsonfile": ["jsonfile@6.2.1", "", { "dependencies": { "universalify": "^2.0.0" }, "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q=="], "jsonschema": ["jsonschema@1.5.0", "", {}, "sha512-K+A9hhqbn0f3pJX17Q/7H6yQfD/5OXgdrR5UE12gMXCiN9D5Xq2o5mddV2QEcX/bjla99ASsAAQUyMCCRWAEhw=="], @@ -3440,7 +3340,7 @@ "lit-element": ["lit-element@4.2.2", "", { "dependencies": { "@lit-labs/ssr-dom-shim": "^1.5.0", "@lit/reactive-element": "^2.1.0", "lit-html": "^3.3.0" } }, "sha512-aFKhNToWxoyhkNDmWZwEva2SlQia+jfG0fjIWV//YeTaWrVnOxD89dPKfigCUspXFmjzOEUQpOkejH5Ly6sG0w=="], - "lit-html": ["lit-html@3.3.2", "", { "dependencies": { "@types/trusted-types": "^2.0.2" } }, "sha512-Qy9hU88zcmaxBXcc10ZpdK7cOLXvXpRoBxERdtqV9QOrfpMZZ6pSYP91LhpPtap3sFMUiL7Tw2RImbe0Al2/kw=="], + "lit-html": ["lit-html@3.3.3", "", { "dependencies": { "@types/trusted-types": "^2.0.2" } }, "sha512-el8M6jK2o3RXBnrSHX3ZKrsN8zEV63pSExTO1wYJz7QndGYZ8353e2a5PPX+qHe2aGayfnchQmkAojaWAREOIA=="], "load-tsconfig": ["load-tsconfig@0.2.5", "", {}, "sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg=="], @@ -3454,6 +3354,8 @@ "lodash.debounce": ["lodash.debounce@4.0.8", "", {}, "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow=="], + "lodash.get": ["lodash.get@4.4.2", "", {}, "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ=="], + "lodash.isequal": ["lodash.isequal@4.5.0", "", {}, "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ=="], "lodash.merge": ["lodash.merge@4.6.2", "", {}, "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ=="], @@ -3590,11 +3492,11 @@ "morgan": ["morgan@1.10.1", "", { "dependencies": { "basic-auth": "~2.0.1", "debug": "2.6.9", "depd": "~2.0.0", "on-finished": "~2.3.0", "on-headers": "~1.1.0" } }, "sha512-223dMRJtI/l25dJKWpgij2cMtywuG/WiUKXdvwfbhGKBhy1puASqXwFzmWZ7+K73vUPoR7SS2Qz2cI/g9MKw0A=="], - "motion": ["motion@12.38.0", "", { "dependencies": { "framer-motion": "^12.38.0", "tslib": "^2.4.0" }, "peerDependencies": { "@emotion/is-prop-valid": "*", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" }, "optionalPeers": ["@emotion/is-prop-valid", "react", "react-dom"] }, "sha512-uYfXzeHlgThchzwz5Te47dlv5JOUC7OB4rjJ/7XTUgtBZD8CchMN8qEJ4ZVsUmTyYA44zjV0fBwsiktRuFnn+w=="], + "motion": ["motion@12.40.0", "", { "dependencies": { "framer-motion": "^12.40.0", "tslib": "^2.4.0" }, "peerDependencies": { "@emotion/is-prop-valid": "*", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" }, "optionalPeers": ["@emotion/is-prop-valid", "react", "react-dom"] }, "sha512-yjrHUrBFW6kQvjJwRsoiPSAhC5tRwRqNGJWmiJ4CrGnbKp0V88AdzkhBmDoqIsIPfarOe0Uddd37Xq43/gIocA=="], - "motion-dom": ["motion-dom@12.38.0", "", { "dependencies": { "motion-utils": "^12.36.0" } }, "sha512-pdkHLD8QYRp8VfiNLb8xIBJis1byQ9gPT3Jnh2jqfFtAsWUA3dEepDlsWe/xMpO8McV+VdpKVcp+E+TGJEtOoA=="], + "motion-dom": ["motion-dom@12.40.0", "", { "dependencies": { "motion-utils": "^12.39.0" } }, "sha512-HxU3ZaBwNPVQUBQf1xxgq+7JrPNZvjLVxgbpEZL7RrWJnsxOf0/OM+yrHG9ogLQ31Do/r57Oz2gQWPK+6q62mg=="], - "motion-utils": ["motion-utils@12.36.0", "", {}, "sha512-eHWisygbiwVvf6PZ1vhaHCLamvkSbPIeAYxWUuL3a2PD/TROgE7FvfHWTIH4vMl798QLfMw15nRqIaRDXTlYRg=="], + "motion-utils": ["motion-utils@12.39.0", "", {}, "sha512-8nadJAJjTtqRkmRF36FoJTrywK9nnFmnPwnSMyxaOCU7GDjN9RTMJIxx9De8ErM+vpPhMccr/6fo5WciyQLnMQ=="], "ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="], @@ -3606,7 +3508,7 @@ "mz": ["mz@2.7.0", "", { "dependencies": { "any-promise": "^1.0.0", "object-assign": "^4.0.1", "thenify-all": "^1.0.0" } }, "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q=="], - "nanoid": ["nanoid@3.3.11", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w=="], + "nanoid": ["nanoid@3.3.12", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ=="], "natural-compare": ["natural-compare@1.4.0", "", {}, "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw=="], @@ -3644,7 +3546,7 @@ "node-mock-http": ["node-mock-http@1.0.4", "", {}, "sha512-8DY+kFsDkNXy1sJglUfuODx1/opAGJGyrTuFqEoN90oRc2Vk0ZbD4K2qmKXBBEhZQzdKHIVfEJpDU8Ak2NJEvQ=="], - "node-releases": ["node-releases@2.0.36", "", {}, "sha512-TdC8FSgHz8Mwtw9g5L4gR/Sh9XhSP/0DEkQxfEFXOpiul5IiHgHan2VhYYb6agDSfp4KuvltmGApc8HMgUrIkA=="], + "node-releases": ["node-releases@2.0.46", "", {}, "sha512-GYVXHE2KnrzAfsAjl4uP++evGFCrAU1jta4ubEjIG7YWt/64Gqv66a30yKwWczVjA6j3bM4nBwH7Pk1JmDHaxQ=="], "node-stdlib-browser": ["node-stdlib-browser@1.3.1", "", { "dependencies": { "assert": "^2.0.0", "browser-resolve": "^2.0.0", "browserify-zlib": "^0.2.0", "buffer": "^5.7.1", "console-browserify": "^1.1.0", "constants-browserify": "^1.0.0", "create-require": "^1.1.1", "crypto-browserify": "^3.12.1", "domain-browser": "4.22.0", "events": "^3.0.0", "https-browserify": "^1.0.0", "isomorphic-timers-promises": "^1.0.1", "os-browserify": "^0.3.0", "path-browserify": "^1.0.1", "pkg-dir": "^5.0.0", "process": "^0.11.10", "punycode": "^1.4.1", "querystring-es3": "^0.2.1", "readable-stream": "^3.6.0", "stream-browserify": "^3.0.0", "stream-http": "^3.2.0", "string_decoder": "^1.0.0", "timers-browserify": "^2.0.4", "tty-browserify": "0.0.1", "url": "^0.11.4", "util": "^0.12.4", "vm-browserify": "^1.0.1" } }, "sha512-X75ZN8DCLftGM5iKwoYLA3rjnrAEs97MkzvSd4q2746Tgpg8b8XWiBGiBG4ZpgcAqBgtgPHTiAc8ZMCvZuikDw=="], @@ -3664,9 +3566,9 @@ "number-to-bn": ["number-to-bn@1.7.0", "", { "dependencies": { "bn.js": "4.11.6", "strip-hex-prefix": "1.0.0" } }, "sha512-wsJ9gfSz1/s4ZsJN01lyonwuxA1tml6X1yBDnfpMglypcBRFZZkus26EdPSlqS5GJfYddVZa22p3VNb3z5m5Ig=="], - "numora": ["numora@3.4.0", "", {}, "sha512-V3D41Kqol8i8Mf8mC20O9EszPzlpvhRnLObhPA6YZtIrDoqx7VmEAq+QUMR0QM/gAUQjshBTaifgb0fPMsdXng=="], + "numora": ["numora@4.0.0", "", {}, "sha512-NNmzFi5ZhRtkhpJr/3vTF81ge7pCcQFfe5YQSQbqyPCuoqJxqbRpCaa3QnG8GmqX2U6BgJ2i7cBvJcmy9yit3A=="], - "numora-react": ["numora-react@3.4.0", "", { "peerDependencies": { "numora": ">=3.4.0", "react": ">=16.8.0", "react-dom": ">=16.8.0" }, "optionalPeers": ["react-dom"] }, "sha512-+k6xy10F0N6TGgg34biJ3oXt82HUjQWI4x38x2KyxmmDXFEiY6l9zPsjsCPi/q40C0bjeDYVDrjdWdEKg9fXUw=="], + "numora-react": ["numora-react@4.0.0", "", { "peerDependencies": { "numora": ">=4.0.0", "react": ">=17.0.0", "react-dom": ">=17.0.0" }, "optionalPeers": ["react-dom"] }, "sha512-lAN32AIfEfCOofgfpvCib157Psv+2egG48pmDzJnFtnVxnleu8C5AwIWyyyPXzxsY8f4ZyC3X1BKwHnlfXSv8w=="], "obj-multiplex": ["obj-multiplex@1.0.0", "", { "dependencies": { "end-of-stream": "^1.4.0", "once": "^1.4.0", "readable-stream": "^2.3.3" } }, "sha512-0GNJAOsHoBHeNTvl5Vt6IWnpUEcc3uSRxzBri7EDyIcMgYvnY2JL2qdeV5zTMjWQX5OHcD5amcW2HFfDh0gjIA=="], @@ -3718,7 +3620,7 @@ "own-keys": ["own-keys@1.0.1", "", { "dependencies": { "get-intrinsic": "^1.2.6", "object-keys": "^1.1.1", "safe-push-apply": "^1.0.0" } }, "sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg=="], - "ox": ["ox@0.14.7", "", { "dependencies": { "@adraffy/ens-normalize": "^1.11.0", "@noble/ciphers": "^1.3.0", "@noble/curves": "1.9.1", "@noble/hashes": "^1.8.0", "@scure/bip32": "^1.7.0", "@scure/bip39": "^1.6.0", "abitype": "^1.2.3", "eventemitter3": "5.0.1" }, "peerDependencies": { "typescript": ">=5.4.0" }, "optionalPeers": ["typescript"] }, "sha512-zSQ/cfBdolj7U4++NAvH7sI+VG0T3pEohITCgcQj8KlawvTDY4vGVhDT64Atsm0d6adWfIYHDpu88iUBMMp+AQ=="], + "ox": ["ox@0.14.25", "", { "dependencies": { "@adraffy/ens-normalize": "^1.11.0", "@noble/ciphers": "^1.3.0", "@noble/curves": "1.9.1", "@noble/hashes": "^1.8.0", "@scure/bip32": "^1.7.0", "@scure/bip39": "^1.6.0", "abitype": "^1.2.3", "eventemitter3": "5.0.1" }, "peerDependencies": { "typescript": ">=5.4.0" }, "optionalPeers": ["typescript"] }, "sha512-8DoibKtxE8yw63Y2jjMhlbjaURev6WCx4QR4MWLusl2/qIaeTzMJMBIYIDl1KOF45+8H1Ur6eLTdPlUoO8PlRw=="], "oxc-resolver": ["oxc-resolver@11.19.1", "", { "optionalDependencies": { "@oxc-resolver/binding-android-arm-eabi": "11.19.1", "@oxc-resolver/binding-android-arm64": "11.19.1", "@oxc-resolver/binding-darwin-arm64": "11.19.1", "@oxc-resolver/binding-darwin-x64": "11.19.1", "@oxc-resolver/binding-freebsd-x64": "11.19.1", "@oxc-resolver/binding-linux-arm-gnueabihf": "11.19.1", "@oxc-resolver/binding-linux-arm-musleabihf": "11.19.1", "@oxc-resolver/binding-linux-arm64-gnu": "11.19.1", "@oxc-resolver/binding-linux-arm64-musl": "11.19.1", "@oxc-resolver/binding-linux-ppc64-gnu": "11.19.1", "@oxc-resolver/binding-linux-riscv64-gnu": "11.19.1", "@oxc-resolver/binding-linux-riscv64-musl": "11.19.1", "@oxc-resolver/binding-linux-s390x-gnu": "11.19.1", "@oxc-resolver/binding-linux-x64-gnu": "11.19.1", "@oxc-resolver/binding-linux-x64-musl": "11.19.1", "@oxc-resolver/binding-openharmony-arm64": "11.19.1", "@oxc-resolver/binding-wasm32-wasi": "11.19.1", "@oxc-resolver/binding-win32-arm64-msvc": "11.19.1", "@oxc-resolver/binding-win32-ia32-msvc": "11.19.1", "@oxc-resolver/binding-win32-x64-msvc": "11.19.1" } }, "sha512-qE/CIg/spwrTBFt5aKmwe3ifeDdLfA2NESN30E42X/lII5ClF8V7Wt6WIJhcGZjp0/Q+nQ+9vgxGk//xZNX2hg=="], @@ -3730,7 +3632,7 @@ "p-map": ["p-map@4.0.0", "", { "dependencies": { "aggregate-error": "^3.0.0" } }, "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ=="], - "p-queue": ["p-queue@9.1.0", "", { "dependencies": { "eventemitter3": "^5.0.1", "p-timeout": "^7.0.0" } }, "sha512-O/ZPaXuQV29uSLbxWBGGZO1mCQXV2BLIwUr59JUU9SoH76mnYvtms7aafH/isNSNGwuEfP6W/4xD0/TJXxrizw=="], + "p-queue": ["p-queue@9.3.0", "", { "dependencies": { "eventemitter3": "^5.0.4", "p-timeout": "^7.0.0" } }, "sha512-7NED7xhQ74Ngp4JP/2e0VZHp7vSWfJfqeiR92jPgxsz6m0Se4P03YoTKa9dDXyZ3r6P616gUXttrB6nnHYKang=="], "p-timeout": ["p-timeout@7.0.1", "", {}, "sha512-AxTM2wDGORHGEkPCt8yqxOTMgpfbEHqF51f/5fJCmwFC3C/zNcGT63SymH2ttOAaiIws2zVg4+izQCjrakcwHg=="], @@ -3762,7 +3664,7 @@ "path-exists": ["path-exists@4.0.0", "", {}, "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w=="], - "path-expression-matcher": ["path-expression-matcher@1.2.0", "", {}, "sha512-DwmPWeFn+tq7TiyJ2CxezCAirXjFxvaiD03npak3cRjlP9+OjTmSy1EpIrEbh+l6JgUundniloMLDQ/6VTdhLQ=="], + "path-expression-matcher": ["path-expression-matcher@1.5.0", "", {}, "sha512-cbrerZV+6rvdQrrD+iGMcZFEiiSrbv9Tfdkvnusy6y0x0GKBXREFg/Y65GhIfm0tnLntThhzCnfKwp1WRjeCyQ=="], "path-is-absolute": ["path-is-absolute@1.0.1", "", {}, "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg=="], @@ -3784,23 +3686,23 @@ "pathval": ["pathval@2.0.1", "", {}, "sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ=="], - "pbkdf2": ["pbkdf2@3.1.5", "", { "dependencies": { "create-hash": "^1.2.0", "create-hmac": "^1.1.7", "ripemd160": "^2.0.3", "safe-buffer": "^5.2.1", "sha.js": "^2.4.12", "to-buffer": "^1.2.1" } }, "sha512-Q3CG/cYvCO1ye4QKkuH7EXxs3VC/rI1/trd+qX2+PolbaKG0H+bgcZzrTt96mMyRtejk+JMCiLUn3y29W8qmFQ=="], + "pbkdf2": ["pbkdf2@3.1.6", "", { "dependencies": { "create-hash": "^1.2.0", "create-hmac": "^1.1.7", "ripemd160": "^2.0.3", "safe-buffer": "^5.2.1", "sha.js": "^2.4.12", "to-buffer": "^1.2.2" } }, "sha512-BT6eelPB1EyGHo8pC0o9Bl6k6SYVhKO1jEbd3lcTrtr7XHdjP8BW1YpfCV3G9Kwkxgattk+S5q2/RvuttCsS1g=="], "pend": ["pend@1.2.0", "", {}, "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg=="], - "pg": ["pg@8.20.0", "", { "dependencies": { "pg-connection-string": "^2.12.0", "pg-pool": "^3.13.0", "pg-protocol": "^1.13.0", "pg-types": "2.2.0", "pgpass": "1.0.5" }, "optionalDependencies": { "pg-cloudflare": "^1.3.0" }, "peerDependencies": { "pg-native": ">=3.0.1" }, "optionalPeers": ["pg-native"] }, "sha512-ldhMxz2r8fl/6QkXnBD3CR9/xg694oT6DZQ2s6c/RI28OjtSOpxnPrUCGOBJ46RCUxcWdx3p6kw/xnDHjKvaRA=="], + "pg": ["pg@8.21.0", "", { "dependencies": { "pg-connection-string": "^2.13.0", "pg-pool": "^3.14.0", "pg-protocol": "^1.14.0", "pg-types": "2.2.0", "pgpass": "1.0.5" }, "optionalDependencies": { "pg-cloudflare": "^1.4.0" }, "peerDependencies": { "pg-native": ">=3.0.1" }, "optionalPeers": ["pg-native"] }, "sha512-AUP1EYJuHraQGsVoCQVIcM7TEJVGtDzxWtGFZd8rds9d+CCXlU5Js1rYgfLNvxy9iJrpHjGrRjoi/3BT9fRyiA=="], - "pg-cloudflare": ["pg-cloudflare@1.3.0", "", {}, "sha512-6lswVVSztmHiRtD6I8hw4qP/nDm1EJbKMRhf3HCYaqud7frGysPv7FYJ5noZQdhQtN2xJnimfMtvQq21pdbzyQ=="], + "pg-cloudflare": ["pg-cloudflare@1.4.0", "", {}, "sha512-Vo7z/6rrQYxpNRylp4Tlob2elzbh+N/MOQbxFVWCxS7oEx6jF53GTJFxK2WWpKuBRkmiin4Mt+xofFDjx09R0A=="], - "pg-connection-string": ["pg-connection-string@2.12.0", "", {}, "sha512-U7qg+bpswf3Cs5xLzRqbXbQl85ng0mfSV/J0nnA31MCLgvEaAo7CIhmeyrmJpOr7o+zm0rXK+hNnT5l9RHkCkQ=="], + "pg-connection-string": ["pg-connection-string@2.13.0", "", {}, "sha512-EMnU9E2fSULdsbErBbMaXJvFeD9B4+nPcM3f+4lsiCR0BHLPrLVjv3DbyM2hgQQviKJaTWIRRTjKjWlHg3p2ig=="], "pg-hstore": ["pg-hstore@2.3.4", "", { "dependencies": { "underscore": "^1.13.1" } }, "sha512-N3SGs/Rf+xA1M2/n0JBiXFDVMzdekwLZLAO0g7mpDY9ouX+fDI7jS6kTq3JujmYbtNSJ53TJ0q4G98KVZSM4EA=="], "pg-int8": ["pg-int8@1.0.1", "", {}, "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw=="], - "pg-pool": ["pg-pool@3.13.0", "", { "peerDependencies": { "pg": ">=8.0" } }, "sha512-gB+R+Xud1gLFuRD/QgOIgGOBE2KCQPaPwkzBBGC9oG69pHTkhQeIuejVIk3/cnDyX39av2AxomQiyPT13WKHQA=="], + "pg-pool": ["pg-pool@3.14.0", "", { "peerDependencies": { "pg": ">=8.0" } }, "sha512-gKtPkFdQPU3DksooVLi9LsjZxrsBUZIpa+7aVx+LV5pNh0KzP4Zleud2po+ConrxbuXGBJ6Hfer6hdgpIBpBaw=="], - "pg-protocol": ["pg-protocol@1.13.0", "", {}, "sha512-zzdvXfS6v89r6v7OcFCHfHlyG/wvry1ALxZo4LqgUoy7W9xhBDMaqOuMiF3qEV45VqsN6rdlcehHrfDtlCPc8w=="], + "pg-protocol": ["pg-protocol@1.14.0", "", {}, "sha512-n5taZ1kO3s9ngDTVxsEznOqCyToTgz0FLuPq0B33COy5pPpuWJpY3/2oRBVETuOgzdqRXfWpM9HIhp2LBBT1BA=="], "pg-types": ["pg-types@2.2.0", "", { "dependencies": { "pg-int8": "1.0.1", "postgres-array": "~2.0.0", "postgres-bytea": "~1.0.0", "postgres-date": "~1.0.4", "postgres-interval": "^1.1.0" } }, "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA=="], @@ -3834,7 +3736,7 @@ "possible-typed-array-names": ["possible-typed-array-names@1.1.0", "", {}, "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg=="], - "postcss": ["postcss@8.5.8", "", { "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg=="], + "postcss": ["postcss@8.5.15", "", { "dependencies": { "nanoid": "^3.3.12", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A=="], "postcss-load-config": ["postcss-load-config@6.0.1", "", { "dependencies": { "lilconfig": "^3.1.1" }, "peerDependencies": { "jiti": ">=1.21.0", "postcss": ">=8.0.9", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["jiti", "postcss", "tsx", "yaml"] }, "sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g=="], @@ -3894,7 +3796,7 @@ "qrcode.react": ["qrcode.react@4.2.0", "", { "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-QpgqWi8rD9DsS9EP3z7BT+5lY5SFhsqGjpgW5DY/i3mK4M9DTBNz3ErMi8BWYEfI3L0d8GIbGmcdFAS1uIRGjA=="], - "qs": ["qs@6.14.2", "", { "dependencies": { "side-channel": "^1.1.0" } }, "sha512-V/yCWTTF7VJ9hIh18Ugr2zhJMP01MY7c5kh4J870L7imm6/DIzBsNLTXzMwUA3yZ5b/KBqLx8Kp3uRvd7xSe3Q=="], + "qs": ["qs@6.15.2", "", { "dependencies": { "side-channel": "^1.1.0" } }, "sha512-Rzq0KEyX/w/tEybncDgdkZrJgVUsUMk3xjh3t5bv3S1HTAtg+uOYt72+ZfwiQwKdysThkTBdL/rTi6HDmX9Ddw=="], "query-string": ["query-string@7.1.3", "", { "dependencies": { "decode-uri-component": "^0.2.2", "filter-obj": "^1.1.0", "split-on-first": "^1.0.0", "strict-uri-encode": "^2.0.0" } }, "sha512-hh2WYhq4fi8+b+/2Kg9CEge4fDPvHS534aOOvOZeQ3+Vf2mCFsaFBYj0i+iXcAq6I9Vzp5fjMFBlONvayDC1qg=="], @@ -3926,7 +3828,7 @@ "react-dom": ["react-dom@19.2.0", "", { "dependencies": { "scheduler": "^0.27.0" }, "peerDependencies": { "react": "^19.2.0" } }, "sha512-UlbRu4cAiGaIewkPyiRGJk0imDN2T3JjieT6spoL2UeSf5od4n5LB/mQ4ejmxhCFT1tYe8IvaFulzynWovsEFQ=="], - "react-hook-form": ["react-hook-form@7.72.0", "", { "peerDependencies": { "react": "^16.8.0 || ^17 || ^18 || ^19" } }, "sha512-V4v6jubaf6JAurEaVnT9aUPKFbNtDgohj5CIgVGyPHvT9wRx5OZHVjz31GsxnPNI278XMu+ruFz+wGOscHaLKw=="], + "react-hook-form": ["react-hook-form@7.76.1", "", { "peerDependencies": { "react": "^16.8.0 || ^17 || ^18 || ^19" } }, "sha512-rYM7tPiWlu3nZchkR/ex7piyzui2vFPyaLnXnI/RnblB/L4qfMmyses8llJVtF1NpE9WBBsJlGtcSZzPCXW1qQ=="], "react-i18next": ["react-i18next@15.7.4", "", { "dependencies": { "@babel/runtime": "^7.27.6", "html-parse-stringify": "^3.0.1" }, "peerDependencies": { "i18next": ">= 23.4.0", "react": ">= 16.8.0", "typescript": "^5" }, "optionalPeers": ["typescript"] }, "sha512-nyU8iKNrI5uDJch0z9+Y5XEr34b0wkyYj3Rp+tfbahxtlswxSCjcUL9H0nqXo9IR3/t5Y5PKIA3fx3MfUyR9Xw=="], @@ -3940,7 +3842,7 @@ "react-style-singleton": ["react-style-singleton@2.2.3", "", { "dependencies": { "get-nonce": "^1.0.0", "tslib": "^2.0.0" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-b6jSvxvVnyptAiLjbkWLE/lOnR4lfTtDAl+eUC7RZy+QQWc6wRzIV2CE6xBuMmDxc2qIihtDCZD5NPOFl7fRBQ=="], - "react-toastify": ["react-toastify@11.0.5", "", { "dependencies": { "clsx": "^2.1.1" }, "peerDependencies": { "react": "^18 || ^19", "react-dom": "^18 || ^19" } }, "sha512-EpqHBGvnSTtHYhCPLxML05NLY2ZX0JURbAdNYa6BUkk+amz4wbKBQvoKQAB0ardvSarUBuY4Q4s1sluAzZwkmA=="], + "react-toastify": ["react-toastify@11.1.0", "", { "dependencies": { "clsx": "^2.1.1" }, "peerDependencies": { "react": "^18 || ^19", "react-dom": "^18 || ^19" } }, "sha512-e9h23x3phN0wbFeB6yovmWp7lobzV4CaCH0LO8nVP6H7Y+3GbcLpIzMm9dJhcp1RXbpyfvjgpfXqO80QAmn7sg=="], "readable-stream": ["readable-stream@3.6.2", "", { "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="], @@ -3970,7 +3872,7 @@ "regjsgen": ["regjsgen@0.8.0", "", {}, "sha512-RvwtGe3d7LvWiDQXeQw8p5asZUmfU1G/l6WbUXeHta7Y2PEIvBTwH6E2EfmYUK8pxcxEdEmaomqyp0vZZ7C+3Q=="], - "regjsparser": ["regjsparser@0.13.0", "", { "dependencies": { "jsesc": "~3.1.0" }, "bin": { "regjsparser": "bin/parser" } }, "sha512-NZQZdC5wOE/H3UT28fVGL+ikOZcEzfMGk/c3iN9UGxzWHMa1op7274oyiUVrAG4B2EuFhus8SvkaYnhvW92p9Q=="], + "regjsparser": ["regjsparser@0.13.1", "", { "dependencies": { "jsesc": "~3.1.0" }, "bin": { "regjsparser": "bin/parser" } }, "sha512-dLsljMd9sqwRkby8zhO1gSg3PnJIBFid8f4CQj/sXx+7cKx+E7u0PKhZ+U4wmhx7EfmtvnA318oVaIkAB1lRJw=="], "remedial": ["remedial@1.0.8", "", {}, "sha512-/62tYiOe6DzS5BqVsNpH/nkGlX45C/Sp6V+NtiN6JQNS1Viay7cWkazmRkrQrdFj2eshDe96SIQNIoMxqhzBOg=="], @@ -3996,8 +3898,6 @@ "resolve-from": ["resolve-from@5.0.0", "", {}, "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw=="], - "resolve-pkg-maps": ["resolve-pkg-maps@1.0.0", "", {}, "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw=="], - "responselike": ["responselike@3.0.0", "", { "dependencies": { "lowercase-keys": "^3.0.0" } }, "sha512-40yHxbNcl2+rzXvZuVkrYohathsSJlMTXKryG5y8uciHv1+xDLHQpgjG64JUO9nrEq2jGLH6IZ8BcZyw3wrweg=="], "restore-cursor": ["restore-cursor@3.1.0", "", { "dependencies": { "onetime": "^5.1.0", "signal-exit": "^3.0.2" } }, "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA=="], @@ -4014,19 +3914,17 @@ "rlp": ["rlp@2.2.7", "", { "dependencies": { "bn.js": "^5.2.0" }, "bin": { "rlp": "bin/rlp" } }, "sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ=="], - "rollup": ["rollup@4.60.0", "", { "dependencies": { "@types/estree": "1.0.8" }, "optionalDependencies": { "@rollup/rollup-android-arm-eabi": "4.60.0", "@rollup/rollup-android-arm64": "4.60.0", "@rollup/rollup-darwin-arm64": "4.60.0", "@rollup/rollup-darwin-x64": "4.60.0", "@rollup/rollup-freebsd-arm64": "4.60.0", "@rollup/rollup-freebsd-x64": "4.60.0", "@rollup/rollup-linux-arm-gnueabihf": "4.60.0", "@rollup/rollup-linux-arm-musleabihf": "4.60.0", "@rollup/rollup-linux-arm64-gnu": "4.60.0", "@rollup/rollup-linux-arm64-musl": "4.60.0", "@rollup/rollup-linux-loong64-gnu": "4.60.0", "@rollup/rollup-linux-loong64-musl": "4.60.0", "@rollup/rollup-linux-ppc64-gnu": "4.60.0", "@rollup/rollup-linux-ppc64-musl": "4.60.0", "@rollup/rollup-linux-riscv64-gnu": "4.60.0", "@rollup/rollup-linux-riscv64-musl": "4.60.0", "@rollup/rollup-linux-s390x-gnu": "4.60.0", "@rollup/rollup-linux-x64-gnu": "4.60.0", "@rollup/rollup-linux-x64-musl": "4.60.0", "@rollup/rollup-openbsd-x64": "4.60.0", "@rollup/rollup-openharmony-arm64": "4.60.0", "@rollup/rollup-win32-arm64-msvc": "4.60.0", "@rollup/rollup-win32-ia32-msvc": "4.60.0", "@rollup/rollup-win32-x64-gnu": "4.60.0", "@rollup/rollup-win32-x64-msvc": "4.60.0", "fsevents": "~2.3.2" }, "bin": { "rollup": "dist/bin/rollup" } }, "sha512-yqjxruMGBQJ2gG4HtjZtAfXArHomazDHoFwFFmZZl0r7Pdo7qCIXKqKHZc8yeoMgzJJ+pO6pEEHa+V7uzWlrAQ=="], + "rollup": ["rollup@4.60.4", "", { "dependencies": { "@types/estree": "1.0.8" }, "optionalDependencies": { "@rollup/rollup-android-arm-eabi": "4.60.4", "@rollup/rollup-android-arm64": "4.60.4", "@rollup/rollup-darwin-arm64": "4.60.4", "@rollup/rollup-darwin-x64": "4.60.4", "@rollup/rollup-freebsd-arm64": "4.60.4", "@rollup/rollup-freebsd-x64": "4.60.4", "@rollup/rollup-linux-arm-gnueabihf": "4.60.4", "@rollup/rollup-linux-arm-musleabihf": "4.60.4", "@rollup/rollup-linux-arm64-gnu": "4.60.4", "@rollup/rollup-linux-arm64-musl": "4.60.4", "@rollup/rollup-linux-loong64-gnu": "4.60.4", "@rollup/rollup-linux-loong64-musl": "4.60.4", "@rollup/rollup-linux-ppc64-gnu": "4.60.4", "@rollup/rollup-linux-ppc64-musl": "4.60.4", "@rollup/rollup-linux-riscv64-gnu": "4.60.4", "@rollup/rollup-linux-riscv64-musl": "4.60.4", "@rollup/rollup-linux-s390x-gnu": "4.60.4", "@rollup/rollup-linux-x64-gnu": "4.60.4", "@rollup/rollup-linux-x64-musl": "4.60.4", "@rollup/rollup-openbsd-x64": "4.60.4", "@rollup/rollup-openharmony-arm64": "4.60.4", "@rollup/rollup-win32-arm64-msvc": "4.60.4", "@rollup/rollup-win32-ia32-msvc": "4.60.4", "@rollup/rollup-win32-x64-gnu": "4.60.4", "@rollup/rollup-win32-x64-msvc": "4.60.4", "fsevents": "~2.3.2" }, "bin": { "rollup": "dist/bin/rollup" } }, "sha512-WHeFSbZYsPu3+bLoNRUuAO+wavNlocOPf3wSHTP7hcFKVnJeWsYlCDbr3mTS14FCizf9ccIxXA8sGL8zKeQN3g=="], "router": ["router@2.2.0", "", { "dependencies": { "debug": "^4.4.0", "depd": "^2.0.0", "is-promise": "^4.0.0", "parseurl": "^1.3.3", "path-to-regexp": "^8.0.0" } }, "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ=="], - "rpc-websockets": ["rpc-websockets@9.3.6", "", { "dependencies": { "@swc/helpers": "^0.5.11", "@types/uuid": "^10.0.0", "@types/ws": "^8.2.2", "buffer": "^6.0.3", "eventemitter3": "^5.0.1", "uuid": "^11.0.0", "ws": "^8.5.0" }, "optionalDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": "^6.0.0" } }, "sha512-RzuOQDGd+EtR/cBYQAH/0jjaBzhyvXXGROhxigGJPf+q3XKyvtelZCucylzxiq5MaGlfBx1075djTsxFsFDgrA=="], - "run-async": ["run-async@2.4.1", "", {}, "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ=="], "run-parallel": ["run-parallel@1.2.0", "", { "dependencies": { "queue-microtask": "^1.2.2" } }, "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA=="], "rxjs": ["rxjs@7.8.2", "", { "dependencies": { "tslib": "^2.1.0" } }, "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA=="], - "safe-array-concat": ["safe-array-concat@1.1.3", "", { "dependencies": { "call-bind": "^1.0.8", "call-bound": "^1.0.2", "get-intrinsic": "^1.2.6", "has-symbols": "^1.1.0", "isarray": "^2.0.5" } }, "sha512-AURm5f0jYEOydBj7VQlVvDrjeFgthDdEF5H1dP+6mNpoXOMo1quQqJ4wvJDyRZ9+pO3kGWoOdmV08cSv2aJV6Q=="], + "safe-array-concat": ["safe-array-concat@1.1.4", "", { "dependencies": { "call-bind": "^1.0.9", "call-bound": "^1.0.4", "get-intrinsic": "^1.3.0", "has-symbols": "^1.1.0", "isarray": "^2.0.5" } }, "sha512-wtZlHyOje6OZTGqAoaDKxFkgRtkF9CnHAVnCHKfuj200wAgL+bSJhdsCD2l0Qx/2ekEXjPWcyKkfGb5CPboslg=="], "safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], @@ -4070,9 +3968,9 @@ "serialize-javascript": ["serialize-javascript@6.0.2", "", { "dependencies": { "randombytes": "^2.1.0" } }, "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g=="], - "seroval": ["seroval@1.5.1", "", {}, "sha512-OwrZRZAfhHww0WEnKHDY8OM0U/Qs8OTfIDWhUD4BLpNJUfXK4cGmjiagGze086m+mhI+V2nD0gfbHEnJjb9STA=="], + "seroval": ["seroval@1.5.4", "", {}, "sha512-46uFvgrXTVxZcUorgSSRZ4y+ieqLLQRMlG4bnCZKW3qI6BZm7Rg4ntMW4p1mILEEBZWrFlcpp0AyIIlM6jD9iw=="], - "seroval-plugins": ["seroval-plugins@1.5.1", "", { "peerDependencies": { "seroval": "^1.0" } }, "sha512-4FbuZ/TMl02sqv0RTFexu0SP6V+ywaIe5bAWCCEik0fk17BhALgwvUDVF7e3Uvf9pxmwCEJsRPmlkUE6HdzLAw=="], + "seroval-plugins": ["seroval-plugins@1.5.4", "", { "peerDependencies": { "seroval": "^1.0" } }, "sha512-S0xQPhUTefAhNvNWFg0c1J8qJArHt5KdtJ/cFAofo06KD1MVSeFWyl4iiu+ApDIuw0WhjpOfCdgConOfAnLgkw=="], "serve-static": ["serve-static@2.2.1", "", { "dependencies": { "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "parseurl": "^1.3.3", "send": "^1.2.0" } }, "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw=="], @@ -4102,7 +4000,7 @@ "side-channel": ["side-channel@1.1.0", "", { "dependencies": { "es-errors": "^1.3.0", "object-inspect": "^1.13.3", "side-channel-list": "^1.0.0", "side-channel-map": "^1.0.1", "side-channel-weakmap": "^1.0.2" } }, "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw=="], - "side-channel-list": ["side-channel-list@1.0.0", "", { "dependencies": { "es-errors": "^1.3.0", "object-inspect": "^1.13.3" } }, "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA=="], + "side-channel-list": ["side-channel-list@1.0.1", "", { "dependencies": { "es-errors": "^1.3.0", "object-inspect": "^1.13.4" } }, "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w=="], "side-channel-map": ["side-channel-map@1.0.1", "", { "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", "get-intrinsic": "^1.2.5", "object-inspect": "^1.13.3" } }, "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA=="], @@ -4134,7 +4032,7 @@ "socket.io-parser": ["socket.io-parser@4.2.6", "", { "dependencies": { "@socket.io/component-emitter": "~3.1.0", "debug": "~4.4.1" } }, "sha512-asJqbVBDsBCJx0pTqw3WfesSY0iRX+2xzWEWzrpcH7L6fLzrhyF8WPI8UaeM4YCuDfpwA/cgsdugMsmtz8EJeg=="], - "socks": ["socks@2.8.7", "", { "dependencies": { "ip-address": "^10.0.1", "smart-buffer": "^4.2.0" } }, "sha512-HLpt+uLy/pxB+bum/9DzAgiKS8CX1EvbWxI4zlmgGCExImLdiad2iCwXT5Z4c9c3Eq8rP2318mPW2c+QbtjK8A=="], + "socks": ["socks@2.8.9", "", { "dependencies": { "ip-address": "^10.1.1", "smart-buffer": "^4.2.0" } }, "sha512-LJhUYUvItdQ0LkJTmPeaEObWXAqFyfmP85x0tch/ez9cahmhlBBLbIqDFnvBnUJGagb0JbIQrkBs1wJ+yRYpEw=="], "sodium-native": ["sodium-native@4.3.3", "", { "dependencies": { "require-addon": "^1.1.0" } }, "sha512-OnxSlN3uyY8D0EsLHpmm2HOFmKddQVvEMmsakCrXUzSd8kjjbzL413t4ZNF3n0UxSwNgwTyUvkmZHTfuCeiYSw=="], @@ -4182,17 +4080,13 @@ "stream-browserify": ["stream-browserify@3.0.0", "", { "dependencies": { "inherits": "~2.0.4", "readable-stream": "^3.5.0" } }, "sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA=="], - "stream-chain": ["stream-chain@2.2.5", "", {}, "sha512-1TJmBx6aSWqZ4tx7aTpBDXK0/e2hhcNSTV8+CbFJtDjbb+I1mZ8lHit0Grw9GRT+6JbIrrDd8esncgBi8aBXGA=="], - "stream-http": ["stream-http@3.2.0", "", { "dependencies": { "builtin-status-codes": "^3.0.0", "inherits": "^2.0.4", "readable-stream": "^3.6.0", "xtend": "^4.0.2" } }, "sha512-Oq1bLqisTyK3TSCXpPbT4sdeYNdmyZJv1LxpEm2vu1ZhK89kSE5YXwZc3cWk0MagGaKriBh9mCFbVGtO+vY29A=="], - "stream-json": ["stream-json@1.9.1", "", { "dependencies": { "stream-chain": "^2.2.5" } }, "sha512-uWkjJ+2Nt/LO9Z/JyKZbMusL8Dkh97uUBTv3AJQ74y07lVahLY4eEFsPsE97pxYBwr8nnjMAIch5eqI0gPShyw=="], - "stream-shift": ["stream-shift@1.0.3", "", {}, "sha512-76ORR0DO1o1hlKwTbi/DM3EXWGf3ZJYO8cXX5RJwnul2DEg2oyoZyjLNoQM8WsvZiFKCRfC1O0J7iCvie3RZmQ=="], "streamsearch": ["streamsearch@1.1.0", "", {}, "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg=="], - "streamx": ["streamx@2.25.0", "", { "dependencies": { "events-universal": "^1.0.0", "fast-fifo": "^1.3.2", "text-decoder": "^1.1.0" } }, "sha512-0nQuG6jf1w+wddNEEXCF4nTg3LtufWINB5eFEN+5TNZW7KWJp6x87+JFL43vaAUPyCfH1wID+mNVyW6OHtFamg=="], + "streamx": ["streamx@2.26.0", "", { "dependencies": { "events-universal": "^1.0.0", "fast-fifo": "^1.3.2", "text-decoder": "^1.1.0" } }, "sha512-VvNG1K72Po/xwJzxZFnZ++Tbrv4lwSptsbkFuzXCJAYZvCK5nnxsvXU6ajqkv7chyiI1Y0YXq2Jh8Iy8Y7NF/A=="], "strict-uri-encode": ["strict-uri-encode@2.0.0", "", {}, "sha512-QwiXZgpRcKkhTj2Scnn++4PKtWsH0kpzZ62L2R6c/LUVYv7hVnZqcg2+sMuT6R7Jusu1vviK/MFsu6kNJfWlEQ=="], @@ -4236,13 +4130,13 @@ "strip-literal": ["strip-literal@3.1.0", "", { "dependencies": { "js-tokens": "^9.0.1" } }, "sha512-8r3mkIM/2+PpjHoOtiAW8Rg3jJLHaV7xPwG+YRGrv6FP0wwk/toTpATxWYOW0BKdWwl82VT2tFYi5DlROa0Mxg=="], - "strnum": ["strnum@2.2.2", "", {}, "sha512-DnR90I+jtXNSTXWdwrEy9FakW7UX+qUZg28gj5fk2vxxl7uS/3bpI4fjFYVmdK9etptYBPNkpahuQnEwhwECqA=="], + "strnum": ["strnum@2.3.0", "", {}, "sha512-ums3KNd42PGyx5xaoVTO1mjU1bH3NpY4vsrVlnv9PNGqQj8wd7rJ6nEypLrJ7z5vxK5RP0yMLo6J/Gsm62DI5Q=="], "strtok3": ["strtok3@10.3.5", "", { "dependencies": { "@tokenizer/token": "^0.3.0" } }, "sha512-ki4hZQfh5rX0QDLLkOCj+h+CVNkqmp/CMf8v8kZpkNVK6jGQooMytqzLZYUVYIZcFZ6yDB70EfD8POcFXiF5oA=="], "sucrase": ["sucrase@3.35.1", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.2", "commander": "^4.0.0", "lines-and-columns": "^1.1.6", "mz": "^2.7.0", "pirates": "^4.0.1", "tinyglobby": "^0.2.11", "ts-interface-checker": "^0.1.9" }, "bin": { "sucrase": "bin/sucrase", "sucrase-node": "bin/sucrase-node" } }, "sha512-DhuTmvZWux4H1UOnWMB3sk0sbaCVOoQZjv8u1rDoTV0HTdGem9hkAZtl4JZy8P2z4Bg0nT+YMeOFyVr4zcG5Tw=="], - "superstruct": ["superstruct@2.0.2", "", {}, "sha512-uV+TFRZdXsqXTL2pRvujROjdZQ4RAlBUS5BTh9IGm+jTqQntYThciG/qu57Gs69yjnVUSqdxF9YLmSnpupBW9A=="], + "superstruct": ["superstruct@1.0.4", "", {}, "sha512-7JpaAoX2NGyoFlI9NBh66BQXGONc+uE+MRS5i2iOBKuS4e+ccgMDjATgZldkah+33DakBxDHiss9kvUcGAO8UQ=="], "supports-color": ["supports-color@8.1.1", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q=="], @@ -4260,22 +4154,20 @@ "table-layout": ["table-layout@1.0.2", "", { "dependencies": { "array-back": "^4.0.1", "deep-extend": "~0.6.0", "typical": "^5.2.0", "wordwrapjs": "^4.0.0" } }, "sha512-qd/R7n5rQTRFi+Zf2sk5XVVd9UQl6ZkduPFC3S7WEGJAmetDTjY3qPN50eSKzwuzEyQKy5TN2TiZdkIjos2L6A=="], - "tailwind-merge": ["tailwind-merge@3.5.0", "", {}, "sha512-I8K9wewnVDkL1NTGoqWmVEIlUcB9gFriAEkXkfCjX5ib8ezGxtR3xD7iZIxrfArjEsH7F1CHD4RFUtxefdqV/A=="], + "tailwind-merge": ["tailwind-merge@3.6.0", "", {}, "sha512-uxL7qAVQriqRQPAyK3pj66VqskWqoZ37PW94jwOTwNfq/z9oyu1V+eqrZqtR2+fCiXdYOZe/Modt8GtvqNzu+w=="], - "tailwindcss": ["tailwindcss@4.2.2", "", {}, "sha512-KWBIxs1Xb6NoLdMVqhbhgwZf2PGBpPEiwOqgI4pFIYbNTfBXiKYyWoTsXgBQ9WFg/OlhnvHaY+AEpW7wSmFo2Q=="], + "tailwindcss": ["tailwindcss@4.3.0", "", {}, "sha512-y6nxMGB1nMW9R6k96e5gdIFzcfL/gTJRNaqGes1YvkLnPVXzWgbqFF2yLC0T8G774n24cx3Pe8XrKoniCOAH+Q=="], - "tapable": ["tapable@2.3.2", "", {}, "sha512-1MOpMXuhGzGL5TTCZFItxCc0AARf1EZFQkGqMm7ERKj8+Hgr5oLvJOVFcC+lRmR8hCe2S3jC4T5D7Vg/d7/fhA=="], + "tapable": ["tapable@2.3.3", "", {}, "sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A=="], "tar": ["tar@7.5.11", "", { "dependencies": { "@isaacs/fs-minipass": "^4.0.0", "chownr": "^3.0.0", "minipass": "^7.1.2", "minizlib": "^3.1.0", "yallist": "^5.0.0" } }, "sha512-ChjMH33/KetonMTAtpYdgUFr0tbz69Fp2v7zWxQfYZX4g5ZN2nOBXm1R2xyA+lMIKrLKIoKAwFj93jE/avX9cQ=="], - "tar-stream": ["tar-stream@3.1.8", "", { "dependencies": { "b4a": "^1.6.4", "bare-fs": "^4.5.5", "fast-fifo": "^1.2.0", "streamx": "^2.15.0" } }, "sha512-U6QpVRyCGHva435KoNWy9PRoi2IFYCgtEhq9nmrPPpbRacPs9IH4aJ3gbrFC8dPcXvdSZ4XXfXT5Fshbp2MtlQ=="], + "tar-stream": ["tar-stream@3.2.0", "", { "dependencies": { "b4a": "^1.6.4", "bare-fs": "^4.5.5", "fast-fifo": "^1.2.0", "streamx": "^2.15.0" } }, "sha512-ojzvCvVaNp6aOTFmG7jaRD0meowIAuPc3cMMhSgKiVWws1GyHbGd/xvnyuRKcKlMpt3qvxx6r0hreCNITP9hIg=="], "teex": ["teex@1.0.1", "", { "dependencies": { "streamx": "^2.12.5" } }, "sha512-eYE6iEI62Ni1H8oIa7KlDU6uQBtqr4Eajni3wX7rpfXD8ysFx8z0+dri+KWEPWpBsxXfxu58x/0jvTVT1ekOSg=="], "text-decoder": ["text-decoder@1.2.7", "", { "dependencies": { "b4a": "^1.6.4" } }, "sha512-vlLytXkeP4xvEq2otHeJfSQIRyWxo/oZGEbXrtEEF9Hnmrdly59sUbzZ/QgyWuLYHctCHxFF4tRQZNQ9k60ExQ=="], - "text-encoding-utf-8": ["text-encoding-utf-8@1.0.2", "", {}, "sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg=="], - "text-hex": ["text-hex@1.0.0", "", {}, "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg=="], "text-table": ["text-table@0.2.0", "", {}, "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw=="], @@ -4302,9 +4194,9 @@ "tinybench": ["tinybench@2.9.0", "", {}, "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg=="], - "tinyexec": ["tinyexec@1.0.4", "", {}, "sha512-u9r3uZC0bdpGOXtlxUIdwf9pkmvhqJdrVCH9fapQtgy/OeTTMZ1nqH7agtvEfmGui6e1XxjcdrlxvxJvc3sMqw=="], + "tinyexec": ["tinyexec@1.2.2", "", {}, "sha512-M/Q0B2cp4K7kynaT/vnED1j8TlLY+Pp7C6Wl2bl/7u/F0mUVwdyOpwomQb8JpYLitHUssAJRmLZdMCGsrx7i+g=="], - "tinyglobby": ["tinyglobby@0.2.15", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.3" } }, "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ=="], + "tinyglobby": ["tinyglobby@0.2.16", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.4" } }, "sha512-pn99VhoACYR8nFHhxqix+uvsbXineAasWm5ojXoN8xEwK5Kd3/TrhNn1wByuD52UxWRLy8pu+kRMniEi6Eq9Zg=="], "tinypool": ["tinypool@1.1.1", "", {}, "sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg=="], @@ -4328,6 +4220,8 @@ "toposort-class": ["toposort-class@1.0.1", "", {}, "sha512-OsLcGGbYF3rMjPUf8oKktyvCiUxSbqMMS39m33MAjLTC1DVIH6x3WSt63/M77ihI09+Sdfk1AXvfhCEeUmC7mg=="], + "torph": ["torph@0.0.9", "", { "peerDependencies": { "react": ">=18", "react-dom": ">=18", "svelte": ">=5", "vue": ">=3" }, "optionalPeers": ["react", "react-dom", "svelte", "vue"] }, "sha512-WrFMtJwqXCfIXbLNuTOwHWff0XVm/Ewctb+71bFis3HykPvCXl1CHXapU0r67pQhAI323fsA1L2pGPeqxXeRRA=="], + "touch": ["touch@3.1.1", "", { "bin": { "nodetouch": "bin/nodetouch.js" } }, "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA=="], "tr46": ["tr46@0.0.3", "", {}, "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="], @@ -4360,8 +4254,6 @@ "tsutils": ["tsutils@3.21.0", "", { "dependencies": { "tslib": "^1.8.1" }, "peerDependencies": { "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" } }, "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA=="], - "tsx": ["tsx@4.21.0", "", { "dependencies": { "esbuild": "~0.27.0", "get-tsconfig": "^4.7.5" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "bin": { "tsx": "dist/cli.mjs" } }, "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw=="], - "tty-browserify": ["tty-browserify@0.0.1", "", {}, "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw=="], "tw-animate-css": ["tw-animate-css@1.4.0", "", {}, "sha512-7bziOlRqH0hJx80h/3mbicLW7o8qLsH5+RaLR2t+OHM3D0JlWGODQKQ4cxbK7WlvmUxpcj6Kgu6EKqjrGFe3QQ=="], @@ -4394,7 +4286,7 @@ "typical": ["typical@4.0.0", "", {}, "sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw=="], - "ufo": ["ufo@1.6.3", "", {}, "sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q=="], + "ufo": ["ufo@1.6.4", "", {}, "sha512-JFNbkD1Svwe0KvGi8GOeLcP4kAWQ609twvCdcHxq1oSL8svv39ZuSvajcD8B+5D0eL4+s1Is2D/O6KN3qcTeRA=="], "uglify-js": ["uglify-js@3.19.3", "", { "bin": { "uglifyjs": "bin/uglifyjs" } }, "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ=="], @@ -4402,7 +4294,7 @@ "uint8arrays": ["uint8arrays@3.1.1", "", { "dependencies": { "multiformats": "^9.4.2" } }, "sha512-+QJa8QRnbdXVpHYjLoTpJIdCTiw9Ir62nocClWuXIq2JIh4Uta0cQsTSpFL678p2CN8B+XSApwcU+pQEqVpKWg=="], - "umzug": ["umzug@3.8.2", "", { "dependencies": { "@rushstack/ts-command-line": "^4.12.2", "emittery": "^0.13.0", "fast-glob": "^3.3.2", "pony-cause": "^2.1.4", "type-fest": "^4.0.0" } }, "sha512-BEWEF8OJjTYVC56GjELeHl/1XjFejrD7aHzn+HldRJTx+pL1siBrKHZC8n4K/xL3bEzVA9o++qD1tK2CpZu4KA=="], + "umzug": ["umzug@3.8.3", "", { "dependencies": { "@rushstack/ts-command-line": "4.19.1", "emittery": "^0.13.0", "pony-cause": "^2.1.4", "tinyglobby": "^0.2.16", "type-fest": "^4.0.0" } }, "sha512-U9SRJI6LJvV0XwrqGMVPBkE26WHJklHZjtscJ2sEjUp7f+h4NH/25YGjPBernWLroVJvMnTkCAGC0bT0dd63qA=="], "unbox-primitive": ["unbox-primitive@1.1.0", "", { "dependencies": { "call-bound": "^1.0.3", "has-bigints": "^1.0.2", "has-symbols": "^1.1.0", "which-boxed-primitive": "^1.1.1" } }, "sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw=="], @@ -4436,9 +4328,9 @@ "unpipe": ["unpipe@1.0.0", "", {}, "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ=="], - "unplugin": ["unplugin@2.3.11", "", { "dependencies": { "@jridgewell/remapping": "^2.3.5", "acorn": "^8.15.0", "picomatch": "^4.0.3", "webpack-virtual-modules": "^0.6.2" } }, "sha512-5uKD0nqiYVzlmCRs01Fhs2BdkEgBS3SAVP6ndrBsuK42iC2+JHyxM05Rm9G8+5mkmRtzMZGY8Ct5+mliZxU/Ww=="], + "unplugin": ["unplugin@3.0.0", "", { "dependencies": { "@jridgewell/remapping": "^2.3.5", "picomatch": "^4.0.3", "webpack-virtual-modules": "^0.6.2" } }, "sha512-0Mqk3AT2TZCXWKdcoaufeXNukv2mTrEZExeXlHIOZXdqYoHHr4n51pymnwV8x2BOVxwXbK2HLlI7usrqMpycdg=="], - "unstorage": ["unstorage@1.17.4", "", { "dependencies": { "anymatch": "^3.1.3", "chokidar": "^5.0.0", "destr": "^2.0.5", "h3": "^1.15.5", "lru-cache": "^11.2.0", "node-fetch-native": "^1.6.7", "ofetch": "^1.5.1", "ufo": "^1.6.3" }, "peerDependencies": { "@azure/app-configuration": "^1.8.0", "@azure/cosmos": "^4.2.0", "@azure/data-tables": "^13.3.0", "@azure/identity": "^4.6.0", "@azure/keyvault-secrets": "^4.9.0", "@azure/storage-blob": "^12.26.0", "@capacitor/preferences": "^6 || ^7 || ^8", "@deno/kv": ">=0.9.0", "@netlify/blobs": "^6.5.0 || ^7.0.0 || ^8.1.0 || ^9.0.0 || ^10.0.0", "@planetscale/database": "^1.19.0", "@upstash/redis": "^1.34.3", "@vercel/blob": ">=0.27.1", "@vercel/functions": "^2.2.12 || ^3.0.0", "@vercel/kv": "^1 || ^2 || ^3", "aws4fetch": "^1.0.20", "db0": ">=0.2.1", "idb-keyval": "^6.2.1", "ioredis": "^5.4.2", "uploadthing": "^7.4.4" }, "optionalPeers": ["@azure/app-configuration", "@azure/cosmos", "@azure/data-tables", "@azure/identity", "@azure/keyvault-secrets", "@azure/storage-blob", "@capacitor/preferences", "@deno/kv", "@netlify/blobs", "@planetscale/database", "@upstash/redis", "@vercel/blob", "@vercel/functions", "@vercel/kv", "aws4fetch", "db0", "idb-keyval", "ioredis", "uploadthing"] }, "sha512-fHK0yNg38tBiJKp/Vgsq4j0JEsCmgqH58HAn707S7zGkArbZsVr/CwINoi+nh3h98BRCwKvx1K3Xg9u3VV83sw=="], + "unstorage": ["unstorage@1.17.5", "", { "dependencies": { "anymatch": "^3.1.3", "chokidar": "^5.0.0", "destr": "^2.0.5", "h3": "^1.15.10", "lru-cache": "^11.2.7", "node-fetch-native": "^1.6.7", "ofetch": "^1.5.1", "ufo": "^1.6.3" }, "peerDependencies": { "@azure/app-configuration": "^1.8.0", "@azure/cosmos": "^4.2.0", "@azure/data-tables": "^13.3.0", "@azure/identity": "^4.6.0", "@azure/keyvault-secrets": "^4.9.0", "@azure/storage-blob": "^12.26.0", "@capacitor/preferences": "^6 || ^7 || ^8", "@deno/kv": ">=0.9.0", "@netlify/blobs": "^6.5.0 || ^7.0.0 || ^8.1.0 || ^9.0.0 || ^10.0.0", "@planetscale/database": "^1.19.0", "@upstash/redis": "^1.34.3", "@vercel/blob": ">=0.27.1", "@vercel/functions": "^2.2.12 || ^3.0.0", "@vercel/kv": "^1 || ^2 || ^3", "aws4fetch": "^1.0.20", "db0": ">=0.2.1", "idb-keyval": "^6.2.1", "ioredis": "^5.4.2", "uploadthing": "^7.4.4" }, "optionalPeers": ["@azure/app-configuration", "@azure/cosmos", "@azure/data-tables", "@azure/identity", "@azure/keyvault-secrets", "@azure/storage-blob", "@capacitor/preferences", "@deno/kv", "@netlify/blobs", "@planetscale/database", "@upstash/redis", "@vercel/blob", "@vercel/functions", "@vercel/kv", "aws4fetch", "db0", "idb-keyval", "ioredis", "uploadthing"] }, "sha512-0i3iqvRfx29hkNntHyQvJTpf5W9dQ9ZadSoRU8+xVlhVtT7jAX57fazYO9EHvcRCfBCyi5YRya7XCDOsbTgkPg=="], "update-browserslist-db": ["update-browserslist-db@1.2.3", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w=="], @@ -4470,21 +4362,21 @@ "util-deprecate": ["util-deprecate@1.0.2", "", {}, "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="], - "uuid": ["uuid@11.1.0", "", { "bin": { "uuid": "dist/esm/bin/uuid" } }, "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A=="], + "uuid": ["uuid@11.1.1", "", { "bin": { "uuid": "dist/esm/bin/uuid" } }, "sha512-vIYxrBCC/N/K+Js3qSN88go7kIfNPssr/hHCesKCQNAjmgvYS2oqr69kIufEG+O4+PfezOH4EbIeHCfFov8ZgQ=="], "v8-compile-cache-lib": ["v8-compile-cache-lib@3.0.1", "", {}, "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg=="], "valid-url": ["valid-url@1.0.9", "", {}, "sha512-QQDsV8OnSf5Uc30CKSwG9lnhMPe6exHtTXLRYX8uMwKENy640pU+2BgBL0LRbDh/eYRahNCS7aewCx0wf3NYVA=="], - "validator": ["validator@13.15.26", "", {}, "sha512-spH26xU080ydGggxRyR1Yhcbgx+j3y5jbNXk/8L+iRvdIEQ4uTRH2Sgf2dokud6Q4oAtsbNvJ1Ft+9xmm6IZcA=="], + "validator": ["validator@13.15.35", "", {}, "sha512-TQ5pAGhd5whStmqWvYF4OjQROlmv9SMFVt37qoCBdqRffuuklWYQlCNnEs2ZaIBD1kZRNnikiZOS1eqgkar0iw=="], "valtio": ["valtio@2.1.7", "", { "dependencies": { "proxy-compare": "^3.0.1" }, "peerDependencies": { "@types/react": ">=18.0.0", "react": ">=18.0.0" }, "optionalPeers": ["@types/react", "react"] }, "sha512-DwJhCDpujuQuKdJ2H84VbTjEJJteaSmqsuUltsfbfdbotVfNeTE4K/qc/Wi57I9x8/2ed4JNdjEna7O6PfavRg=="], "vary": ["vary@1.1.2", "", {}, "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg=="], - "viem": ["viem@2.47.6", "", { "dependencies": { "@noble/curves": "1.9.1", "@noble/hashes": "1.8.0", "@scure/bip32": "1.7.0", "@scure/bip39": "1.6.0", "abitype": "1.2.3", "isows": "1.0.7", "ox": "0.14.7", "ws": "8.18.3" }, "peerDependencies": { "typescript": ">=5.0.4" }, "optionalPeers": ["typescript"] }, "sha512-zExmbI99NGvMdYa7fmqSTLgkwh48dmhgEqFrUgkpL4kfG4XkVefZ8dZqIKVUhZo6Uhf0FrrEXOsHm9LUyIvI2Q=="], + "viem": ["viem@2.51.2", "", { "dependencies": { "@noble/curves": "1.9.1", "@noble/hashes": "1.8.0", "@scure/bip32": "1.7.0", "@scure/bip39": "1.6.0", "abitype": "1.2.3", "isows": "1.0.7", "ox": "0.14.25", "ws": "8.20.1" }, "peerDependencies": { "typescript": ">=5.0.4" }, "optionalPeers": ["typescript"] }, "sha512-2x4YAtr3PUPIW++Ov96clnWtRsyqMfpFfooQRIxCpAMsTgxioJTdIQ0ywbjhlHDCUJEGM6M8q8ILOeaPRViH9w=="], - "vite": ["vite@6.4.1", "", { "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.4.4", "picomatch": "^4.0.2", "postcss": "^8.5.3", "rollup": "^4.34.9", "tinyglobby": "^0.2.13" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", "jiti": ">=1.21.0", "less": "*", "lightningcss": "^1.21.0", "sass": "*", "sass-embedded": "*", "stylus": "*", "sugarss": "*", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g=="], + "vite": ["vite@6.4.2", "", { "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.4.4", "picomatch": "^4.0.2", "postcss": "^8.5.3", "rollup": "^4.34.9", "tinyglobby": "^0.2.13" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", "jiti": ">=1.21.0", "less": "*", "lightningcss": "^1.21.0", "sass": "*", "sass-embedded": "*", "stylus": "*", "sugarss": "*", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-2N/55r4JDJ4gdrCvGgINMy+HH3iRpNIz8K6SFwVsA+JbQScLiC+clmAxBgwiSPgcG9U15QmvqCGWzMbqda5zGQ=="], "vite-node": ["vite-node@3.2.4", "", { "dependencies": { "cac": "^6.7.14", "debug": "^4.4.1", "es-module-lexer": "^1.7.0", "pathe": "^2.0.3", "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0" }, "bin": { "vite-node": "vite-node.mjs" } }, "sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg=="], @@ -4550,7 +4442,7 @@ "webidl-conversions": ["webidl-conversions@3.0.1", "", {}, "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="], - "webpack-sources": ["webpack-sources@3.3.4", "", {}, "sha512-7tP1PdV4vF+lYPnkMR0jMY5/la2ub5Fc/8VQrrU+lXkiM6C4TjVfGw7iKfyhnTQOsD+6Q/iKw0eFciziRgD58Q=="], + "webpack-sources": ["webpack-sources@3.5.0", "", {}, "sha512-HPuy+uuoTCaaoEoI1LQ3JN9+vrPBvEesnnX1jADHy728cHSMlq4wUc4afYqahq2B1mhQVZxCXOkNTnXltr+2vQ=="], "webpack-virtual-modules": ["webpack-virtual-modules@0.6.2", "", {}, "sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ=="], @@ -4568,7 +4460,7 @@ "which-module": ["which-module@2.0.1", "", {}, "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ=="], - "which-typed-array": ["which-typed-array@1.1.20", "", { "dependencies": { "available-typed-arrays": "^1.0.7", "call-bind": "^1.0.8", "call-bound": "^1.0.4", "for-each": "^0.3.5", "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-tostringtag": "^1.0.2" } }, "sha512-LYfpUkmqwl0h9A2HL09Mms427Q1RZWuOHsukfVcKRq9q95iQxdw0ix1JQrqbcDR9PH1QDwf5Qo8OZb5lksZ8Xg=="], + "which-typed-array": ["which-typed-array@1.1.21", "", { "dependencies": { "available-typed-arrays": "^1.0.7", "call-bind": "^1.0.9", "call-bound": "^1.0.4", "for-each": "^0.3.5", "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-tostringtag": "^1.0.2" } }, "sha512-zbRA8cVm6io/d5W8uIe2hblzN76/Wm3v/yiythQvr+dpBWeqhPSWIDNj4zOyHi4zKbMK6DN34Xsr9jPHJERAEw=="], "why-is-node-running": ["why-is-node-running@2.3.0", "", { "dependencies": { "siginfo": "^2.0.0", "stackback": "0.0.2" }, "bin": { "why-is-node-running": "cli.js" } }, "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w=="], @@ -4596,11 +4488,13 @@ "wrappy": ["wrappy@1.0.2", "", {}, "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="], - "ws": ["ws@7.5.10", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": "^5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ=="], + "ws": ["ws@7.5.11", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": "^5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-zS54Oen9bITtp7kp2XM3AydrCIq1D+HwJOuH+c+e4LfpL/lotP5osijd+UoMnxwAam1GN8R4KtLAyIrIcBNpiA=="], + + "xml-naming": ["xml-naming@0.1.0", "", {}, "sha512-k8KO9hrMyNk6tUWqUfkTEZbezRRpONVOzUTnc97VnCvyj6Tf9lyUR9EDAIeiVLv56jsMcoXEwjW8Kv5yPY52lw=="], "xmlhttprequest-ssl": ["xmlhttprequest-ssl@2.1.2", "", {}, "sha512-TEU+nJVUUnA4CYJFLvK5X9AOeH4KvDvhIfm0vV1GaQRtchnG0hgK5p8hw/xjv8cunWYCsiPCSDzObPyhEwq3KQ=="], - "xstate": ["xstate@5.29.0", "", {}, "sha512-p0hiOPhhBgXn29t18zDScaN95+y1MAu1Pz5Z2IduCuOUh+d3RqJO7fmexbuQ6rlwFNgYFeXvFsFeiuiAiH3mhg=="], + "xstate": ["xstate@5.31.1", "", {}, "sha512-3P7t7GQ61BvLu+8Cj6Zq7rcS34vecL9pvfN2ucUWmIFIUG+rAREviOs4Xy4OO3BuJHSz6RLU8eqDXxSbVotjDQ=="], "xtend": ["xtend@4.0.2", "", {}, "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="], @@ -4608,7 +4502,7 @@ "yallist": ["yallist@5.0.0", "", {}, "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw=="], - "yaml": ["yaml@2.8.3", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-AvbaCLOO2Otw/lW5bmh9d/WEdcDFdQp2Z2ZUH3pX9U2ihyUY0nvLv7J6TrWowklRGPYbB/IuIMfYgxaCPg5Bpg=="], + "yaml": ["yaml@2.9.0", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA=="], "yaml-ast-parser": ["yaml-ast-parser@0.0.43", "", {}, "sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A=="], @@ -4618,30 +4512,30 @@ "yargs-unparser": ["yargs-unparser@2.0.0", "", { "dependencies": { "camelcase": "^6.0.0", "decamelize": "^4.0.0", "flat": "^5.0.2", "is-plain-obj": "^2.1.0" } }, "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA=="], - "yauzl": ["yauzl@3.2.1", "", { "dependencies": { "buffer-crc32": "~0.2.3", "pend": "~1.2.0" } }, "sha512-k1isifdbpNSFEHFJ1ZY4YDewv0IH9FR61lDetaRMD3j2ae3bIXGV+7c+LHCqtQGofSd8PIyV4X6+dHMAnSr60A=="], + "yauzl": ["yauzl@3.3.1", "", { "dependencies": { "buffer-crc32": "~0.2.3", "pend": "~1.2.0" } }, "sha512-RNPCUkiE/ZgO4w8i9U5yDQVHaFDdnzaFANElRvpJteCspvmv2VqrRb9lvS6odVD+jqI/zDsxAHJVsafpcheVQQ=="], "yn": ["yn@3.1.1", "", {}, "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q=="], "yocto-queue": ["yocto-queue@1.2.2", "", {}, "sha512-4LCcse/U2MHZ63HAJVE+v71o7yOdIe4cZ70Wpf8D/IyjDKYQLV5GD46B+hSTjJsvV5PztjvHoU580EftxjDZFQ=="], - "zod": ["zod@4.3.6", "", {}, "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg=="], + "z-schema": ["z-schema@5.0.6", "", { "dependencies": { "lodash.get": "^4.4.2", "lodash.isequal": "^4.5.0", "validator": "^13.7.0" }, "optionalDependencies": { "commander": "^10.0.0" }, "bin": { "z-schema": "bin/z-schema" } }, "sha512-+XR1GhnWklYdfr8YaZv/iu+vY+ux7V5DS5zH1DQf6bO5ufrt/5cgNhVO5qyhsjFXvsqQb/f08DWE9b6uPscyAg=="], - "zustand": ["zustand@5.0.12", "", { "peerDependencies": { "@types/react": ">=18.0.0", "immer": ">=9.0.6", "react": ">=18.0.0", "use-sync-external-store": ">=1.2.0" }, "optionalPeers": ["@types/react", "immer", "react", "use-sync-external-store"] }, "sha512-i77ae3aZq4dhMlRhJVCYgMLKuSiZAaUPAct2AksxQ+gOtimhGMdXljRT21P5BNpeT4kXlLIckvkPM029OljD7g=="], - - "@ardatan/relay-compiler/immutable": ["immutable@5.1.5", "", {}, "sha512-t7xcm2siw+hlUM68I+UEOK+z84RzmN59as9DZ7P1l0994DKUWV7UXBMQZVxaoMSRQ+PBZbHCOoBt7a2wxOMt+A=="], + "zod": ["zod@4.4.3", "", {}, "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ=="], - "@aws-crypto/sha256-browser/@smithy/util-utf8": ["@smithy/util-utf8@2.3.0", "", { "dependencies": { "@smithy/util-buffer-from": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A=="], + "zustand": ["zustand@5.0.13", "", { "peerDependencies": { "@types/react": ">=18.0.0", "immer": ">=9.0.6", "react": ">=18.0.0", "use-sync-external-store": ">=1.2.0" }, "optionalPeers": ["@types/react", "immer", "react", "use-sync-external-store"] }, "sha512-efI2tVaVQPqtOh114loML/Z80Y4NP3yc+Ff0fYiZJPauNeWZeIp/bRFD7I9bfmCOYBh/PHxlglQ9+wvlwnPikQ=="], - "@aws-crypto/util/@smithy/util-utf8": ["@smithy/util-utf8@2.3.0", "", { "dependencies": { "@smithy/util-buffer-from": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A=="], + "@ardatan/relay-compiler/immutable": ["immutable@5.1.5", "", {}, "sha512-t7xcm2siw+hlUM68I+UEOK+z84RzmN59as9DZ7P1l0994DKUWV7UXBMQZVxaoMSRQ+PBZbHCOoBt7a2wxOMt+A=="], "@babel/generator/@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.31", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="], - "@babel/helper-define-polyfill-provider/resolve": ["resolve@1.22.11", "", { "dependencies": { "is-core-module": "^2.16.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ=="], + "@babel/helper-define-polyfill-provider/resolve": ["resolve@1.22.12", "", { "dependencies": { "es-errors": "^1.3.0", "is-core-module": "^2.16.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA=="], "@base-org/account/@noble/hashes": ["@noble/hashes@1.4.0", "", {}, "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg=="], "@base-org/account/clsx": ["clsx@1.2.1", "", {}, "sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg=="], + "@base-org/account/eventemitter3": ["eventemitter3@5.0.1", "", {}, "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA=="], + "@base-org/account/idb-keyval": ["idb-keyval@6.2.1", "", {}, "sha512-8Sb3veuYCyrZL+VBt9LJfZjLUPWVvqn8tG28VqYNFCo43KHcKuq+b4EiXGeuaLAQWL2YmyDgMp2aSpH9JHsEQg=="], "@base-org/account/ox": ["ox@0.6.9", "", { "dependencies": { "@adraffy/ens-normalize": "^1.10.1", "@noble/curves": "^1.6.0", "@noble/hashes": "^1.5.0", "@scure/bip32": "^1.5.0", "@scure/bip39": "^1.4.0", "abitype": "^1.0.6", "eventemitter3": "5.0.1" }, "peerDependencies": { "typescript": ">=5.4.0" }, "optionalPeers": ["typescript"] }, "sha512-wi5ShvzE4eOcTwQVsIPdFr+8ycyX+5le/96iAJutaZAvCes1J0+RvpEPg5QDPDiaR0XQQAvZVl7AwqQcINuUug=="], @@ -4650,7 +4544,7 @@ "@coinbase/cdp-sdk/abitype": ["abitype@1.0.6", "", { "peerDependencies": { "typescript": ">=5.0.4", "zod": "^3 >=3.22.0" }, "optionalPeers": ["typescript", "zod"] }, "sha512-MMSqYh4+C/aVqI2RQaWqbvI4Kxo5cQV40WQ4QFtDnNzCkqChm8MuENhElmynZlO0qUy/ObkEUaXtKqYnx1Kp3A=="], - "@coinbase/cdp-sdk/jose": ["jose@6.2.2", "", {}, "sha512-d7kPDd34KO/YnzaDOlikGpOurfF0ByC2sEV4cANCtdqLlTfBlw2p14O/5d/zv40gJPbIQxfES3nSx1/oYNyuZQ=="], + "@coinbase/cdp-sdk/jose": ["jose@6.2.3", "", {}, "sha512-YYVDInQKFJfR/xa3ojUTl8c2KoTwiL1R5Wg9YCydwH0x0B9grbzlg5HC7mMjCtUJjbQ/YnGEZIhI5tCgfTb4Hw=="], "@coinbase/cdp-sdk/zod": ["zod@3.25.76", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="], @@ -4658,13 +4552,15 @@ "@coinbase/wallet-sdk/clsx": ["clsx@1.2.1", "", {}, "sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg=="], + "@coinbase/wallet-sdk/eventemitter3": ["eventemitter3@5.0.1", "", {}, "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA=="], + "@coinbase/wallet-sdk/idb-keyval": ["idb-keyval@6.2.1", "", {}, "sha512-8Sb3veuYCyrZL+VBt9LJfZjLUPWVvqn8tG28VqYNFCo43KHcKuq+b4EiXGeuaLAQWL2YmyDgMp2aSpH9JHsEQg=="], "@coinbase/wallet-sdk/ox": ["ox@0.6.9", "", { "dependencies": { "@adraffy/ens-normalize": "^1.10.1", "@noble/curves": "^1.6.0", "@noble/hashes": "^1.5.0", "@scure/bip32": "^1.5.0", "@scure/bip39": "^1.4.0", "abitype": "^1.0.6", "eventemitter3": "5.0.1" }, "peerDependencies": { "typescript": ">=5.4.0" }, "optionalPeers": ["typescript"] }, "sha512-wi5ShvzE4eOcTwQVsIPdFr+8ycyX+5le/96iAJutaZAvCes1J0+RvpEPg5QDPDiaR0XQQAvZVl7AwqQcINuUug=="], "@coinbase/wallet-sdk/zustand": ["zustand@5.0.3", "", { "peerDependencies": { "@types/react": ">=18.0.0", "immer": ">=9.0.6", "react": ">=18.0.0", "use-sync-external-store": ">=1.2.0" }, "optionalPeers": ["@types/react", "immer", "react", "use-sync-external-store"] }, "sha512-14fwWQtU3pH4dE0dOpdMiWjddcH+QzKIgk1cl8epwSE7yag43k/AD/m4L6+K7DytAOr9gGBe3/EXj9g7cdostg=="], - "@eslint/eslintrc/ajv": ["ajv@6.14.0", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-IWrosm/yrn43eiKqkfkHis7QioDleaXQHdDVPKg0FSwwd/DuvyX79TZnFOnYpB7dcsFAMmtFztZuXPDvSePkFw=="], + "@eslint/eslintrc/ajv": ["ajv@6.15.0", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw=="], "@eslint/eslintrc/minimatch": ["minimatch@3.1.5", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w=="], @@ -4696,10 +4592,14 @@ "@ethersproject/wallet/@ethersproject/address": ["@ethersproject/address@5.8.0", "", { "dependencies": { "@ethersproject/bignumber": "^5.8.0", "@ethersproject/bytes": "^5.8.0", "@ethersproject/keccak256": "^5.8.0", "@ethersproject/logger": "^5.8.0", "@ethersproject/rlp": "^5.8.0" } }, "sha512-GhH/abcC46LJwshoN+uBNoKVFPxUuZm6dA257z0vZkKmU1+t8xTn8oK7B9qrj8W2rFRMch4gbJl6PmVxjxBEBA=="], + "@gemini-wallet/core/eventemitter3": ["eventemitter3@5.0.1", "", {}, "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA=="], + "@graphql-codegen/add/tslib": ["tslib@2.6.3", "", {}, "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ=="], "@graphql-codegen/cli/listr2": ["listr2@4.0.5", "", { "dependencies": { "cli-truncate": "^2.1.0", "colorette": "^2.0.16", "log-update": "^4.0.0", "p-map": "^4.0.0", "rfdc": "^1.3.0", "rxjs": "^7.5.5", "through": "^2.3.8", "wrap-ansi": "^7.0.0" }, "peerDependencies": { "enquirer": ">= 2.3.0 < 3" }, "optionalPeers": ["enquirer"] }, "sha512-juGHV1doQdpNT3GSTs9IUN43QJb7KHdF9uqg7Vufs/tG9VTzpFphqF4pm/ICdAABGQxsyNn9CiYA3StkI6jpwA=="], + "@graphql-codegen/cli/shell-quote": ["shell-quote@1.8.4", "", {}, "sha512-VsC6n6vz1ihYYyZZwX7YZSF5l5x36ca17OC+a69h94YqB7X6XLwf+5MOgynYir2SLFUbl8gIYvBo8K8RoNQ6bQ=="], + "@graphql-codegen/client-preset/tslib": ["tslib@2.6.3", "", {}, "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ=="], "@graphql-codegen/core/tslib": ["tslib@2.6.3", "", {}, "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ=="], @@ -4718,57 +4618,53 @@ "@graphql-codegen/visitor-plugin-common/tslib": ["tslib@2.6.3", "", {}, "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ=="], - "@graphql-tools/apollo-engine-loader/@graphql-tools/utils": ["@graphql-tools/utils@11.0.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-bM1HeZdXA2C3LSIeLOnH/bcqSgbQgKEDrjxODjqi3y58xai2TkNrtYcQSoWzGbt9VMN1dORGjR7Vem8SPnUFQA=="], + "@graphql-tools/apollo-engine-loader/@graphql-tools/utils": ["@graphql-tools/utils@11.1.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-PtFVG4r8Z2LEBSaPYQMusBiB3o6kjLVJyjCLbnWem/SpSuM21v6LTmgpkXfYU1qpBV2UGsFyuEnSJInl8fR1Ag=="], - "@graphql-tools/code-file-loader/@graphql-tools/utils": ["@graphql-tools/utils@11.0.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-bM1HeZdXA2C3LSIeLOnH/bcqSgbQgKEDrjxODjqi3y58xai2TkNrtYcQSoWzGbt9VMN1dORGjR7Vem8SPnUFQA=="], + "@graphql-tools/code-file-loader/@graphql-tools/utils": ["@graphql-tools/utils@11.1.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-PtFVG4r8Z2LEBSaPYQMusBiB3o6kjLVJyjCLbnWem/SpSuM21v6LTmgpkXfYU1qpBV2UGsFyuEnSJInl8fR1Ag=="], "@graphql-tools/code-file-loader/globby": ["globby@11.1.0", "", { "dependencies": { "array-union": "^2.1.0", "dir-glob": "^3.0.1", "fast-glob": "^3.2.9", "ignore": "^5.2.0", "merge2": "^1.4.1", "slash": "^3.0.0" } }, "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g=="], - "@graphql-tools/executor/@graphql-tools/utils": ["@graphql-tools/utils@11.0.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-bM1HeZdXA2C3LSIeLOnH/bcqSgbQgKEDrjxODjqi3y58xai2TkNrtYcQSoWzGbt9VMN1dORGjR7Vem8SPnUFQA=="], + "@graphql-tools/executor/@graphql-tools/utils": ["@graphql-tools/utils@11.1.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-PtFVG4r8Z2LEBSaPYQMusBiB3o6kjLVJyjCLbnWem/SpSuM21v6LTmgpkXfYU1qpBV2UGsFyuEnSJInl8fR1Ag=="], "@graphql-tools/executor-graphql-ws/@graphql-tools/executor-common": ["@graphql-tools/executor-common@0.0.6", "", { "dependencies": { "@envelop/core": "^5.3.0", "@graphql-tools/utils": "^10.9.1" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-JAH/R1zf77CSkpYATIJw+eOJwsbWocdDjY+avY7G+P5HCXxwQjAjWVkJI1QJBQYjPQDVxwf1fmTZlIN3VOadow=="], - "@graphql-tools/executor-graphql-ws/ws": ["ws@8.20.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-sAt8BhgNbzCtgGbt2OxmpuryO63ZoDk/sqaB/znQm94T4fCEsy/yV+7CdC1kJhOU9lboAEU7R3kquuycDoibVA=="], + "@graphql-tools/executor-graphql-ws/ws": ["ws@8.20.1", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-It4dO0K5v//JtTXuPkfEOaI3uUN87iYPnqo/ZzqCoG3g8uhA66QUMs/SrM0YK7/NAu+r4LMh/9dq2A7k+rHs+w=="], - "@graphql-tools/executor-legacy-ws/@graphql-tools/utils": ["@graphql-tools/utils@11.0.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-bM1HeZdXA2C3LSIeLOnH/bcqSgbQgKEDrjxODjqi3y58xai2TkNrtYcQSoWzGbt9VMN1dORGjR7Vem8SPnUFQA=="], + "@graphql-tools/executor-legacy-ws/@graphql-tools/utils": ["@graphql-tools/utils@11.1.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-PtFVG4r8Z2LEBSaPYQMusBiB3o6kjLVJyjCLbnWem/SpSuM21v6LTmgpkXfYU1qpBV2UGsFyuEnSJInl8fR1Ag=="], - "@graphql-tools/executor-legacy-ws/@types/ws": ["@types/ws@8.18.1", "", { "dependencies": { "@types/node": "*" } }, "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg=="], + "@graphql-tools/executor-legacy-ws/ws": ["ws@8.20.1", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-It4dO0K5v//JtTXuPkfEOaI3uUN87iYPnqo/ZzqCoG3g8uhA66QUMs/SrM0YK7/NAu+r4LMh/9dq2A7k+rHs+w=="], - "@graphql-tools/executor-legacy-ws/ws": ["ws@8.20.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-sAt8BhgNbzCtgGbt2OxmpuryO63ZoDk/sqaB/znQm94T4fCEsy/yV+7CdC1kJhOU9lboAEU7R3kquuycDoibVA=="], - - "@graphql-tools/git-loader/@graphql-tools/utils": ["@graphql-tools/utils@11.0.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-bM1HeZdXA2C3LSIeLOnH/bcqSgbQgKEDrjxODjqi3y58xai2TkNrtYcQSoWzGbt9VMN1dORGjR7Vem8SPnUFQA=="], + "@graphql-tools/git-loader/@graphql-tools/utils": ["@graphql-tools/utils@11.1.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-PtFVG4r8Z2LEBSaPYQMusBiB3o6kjLVJyjCLbnWem/SpSuM21v6LTmgpkXfYU1qpBV2UGsFyuEnSJInl8fR1Ag=="], "@graphql-tools/github-loader/sync-fetch": ["sync-fetch@0.6.0-2", "", { "dependencies": { "node-fetch": "^3.3.2", "timeout-signal": "^2.0.0", "whatwg-mimetype": "^4.0.0" } }, "sha512-c7AfkZ9udatCuAy9RSfiGPpeOKKUAUK5e1cXadLOGUjasdxqYqAK0jTNkM/FSEyJ3a5Ra27j/tw/PS0qLmaF/A=="], - "@graphql-tools/graphql-file-loader/@graphql-tools/utils": ["@graphql-tools/utils@11.0.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-bM1HeZdXA2C3LSIeLOnH/bcqSgbQgKEDrjxODjqi3y58xai2TkNrtYcQSoWzGbt9VMN1dORGjR7Vem8SPnUFQA=="], + "@graphql-tools/graphql-file-loader/@graphql-tools/utils": ["@graphql-tools/utils@11.1.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-PtFVG4r8Z2LEBSaPYQMusBiB3o6kjLVJyjCLbnWem/SpSuM21v6LTmgpkXfYU1qpBV2UGsFyuEnSJInl8fR1Ag=="], "@graphql-tools/graphql-file-loader/globby": ["globby@11.1.0", "", { "dependencies": { "array-union": "^2.1.0", "dir-glob": "^3.0.1", "fast-glob": "^3.2.9", "ignore": "^5.2.0", "merge2": "^1.4.1", "slash": "^3.0.0" } }, "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g=="], - "@graphql-tools/graphql-tag-pluck/@graphql-tools/utils": ["@graphql-tools/utils@11.0.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-bM1HeZdXA2C3LSIeLOnH/bcqSgbQgKEDrjxODjqi3y58xai2TkNrtYcQSoWzGbt9VMN1dORGjR7Vem8SPnUFQA=="], + "@graphql-tools/graphql-tag-pluck/@graphql-tools/utils": ["@graphql-tools/utils@11.1.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-PtFVG4r8Z2LEBSaPYQMusBiB3o6kjLVJyjCLbnWem/SpSuM21v6LTmgpkXfYU1qpBV2UGsFyuEnSJInl8fR1Ag=="], - "@graphql-tools/import/@graphql-tools/utils": ["@graphql-tools/utils@11.0.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-bM1HeZdXA2C3LSIeLOnH/bcqSgbQgKEDrjxODjqi3y58xai2TkNrtYcQSoWzGbt9VMN1dORGjR7Vem8SPnUFQA=="], + "@graphql-tools/import/@graphql-tools/utils": ["@graphql-tools/utils@11.1.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-PtFVG4r8Z2LEBSaPYQMusBiB3o6kjLVJyjCLbnWem/SpSuM21v6LTmgpkXfYU1qpBV2UGsFyuEnSJInl8fR1Ag=="], - "@graphql-tools/json-file-loader/@graphql-tools/utils": ["@graphql-tools/utils@11.0.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-bM1HeZdXA2C3LSIeLOnH/bcqSgbQgKEDrjxODjqi3y58xai2TkNrtYcQSoWzGbt9VMN1dORGjR7Vem8SPnUFQA=="], + "@graphql-tools/json-file-loader/@graphql-tools/utils": ["@graphql-tools/utils@11.1.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-PtFVG4r8Z2LEBSaPYQMusBiB3o6kjLVJyjCLbnWem/SpSuM21v6LTmgpkXfYU1qpBV2UGsFyuEnSJInl8fR1Ag=="], "@graphql-tools/json-file-loader/globby": ["globby@11.1.0", "", { "dependencies": { "array-union": "^2.1.0", "dir-glob": "^3.0.1", "fast-glob": "^3.2.9", "ignore": "^5.2.0", "merge2": "^1.4.1", "slash": "^3.0.0" } }, "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g=="], - "@graphql-tools/load/@graphql-tools/utils": ["@graphql-tools/utils@11.0.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-bM1HeZdXA2C3LSIeLOnH/bcqSgbQgKEDrjxODjqi3y58xai2TkNrtYcQSoWzGbt9VMN1dORGjR7Vem8SPnUFQA=="], + "@graphql-tools/load/@graphql-tools/utils": ["@graphql-tools/utils@11.1.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-PtFVG4r8Z2LEBSaPYQMusBiB3o6kjLVJyjCLbnWem/SpSuM21v6LTmgpkXfYU1qpBV2UGsFyuEnSJInl8fR1Ag=="], "@graphql-tools/load/p-limit": ["p-limit@3.1.0", "", { "dependencies": { "yocto-queue": "^0.1.0" } }, "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ=="], - "@graphql-tools/merge/@graphql-tools/utils": ["@graphql-tools/utils@11.0.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-bM1HeZdXA2C3LSIeLOnH/bcqSgbQgKEDrjxODjqi3y58xai2TkNrtYcQSoWzGbt9VMN1dORGjR7Vem8SPnUFQA=="], + "@graphql-tools/merge/@graphql-tools/utils": ["@graphql-tools/utils@11.1.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-PtFVG4r8Z2LEBSaPYQMusBiB3o6kjLVJyjCLbnWem/SpSuM21v6LTmgpkXfYU1qpBV2UGsFyuEnSJInl8fR1Ag=="], "@graphql-tools/prisma-loader/https-proxy-agent": ["https-proxy-agent@7.0.6", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "4" } }, "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw=="], - "@graphql-tools/relay-operation-optimizer/@graphql-tools/utils": ["@graphql-tools/utils@11.0.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-bM1HeZdXA2C3LSIeLOnH/bcqSgbQgKEDrjxODjqi3y58xai2TkNrtYcQSoWzGbt9VMN1dORGjR7Vem8SPnUFQA=="], - - "@graphql-tools/schema/@graphql-tools/utils": ["@graphql-tools/utils@11.0.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-bM1HeZdXA2C3LSIeLOnH/bcqSgbQgKEDrjxODjqi3y58xai2TkNrtYcQSoWzGbt9VMN1dORGjR7Vem8SPnUFQA=="], + "@graphql-tools/relay-operation-optimizer/@graphql-tools/utils": ["@graphql-tools/utils@11.1.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-PtFVG4r8Z2LEBSaPYQMusBiB3o6kjLVJyjCLbnWem/SpSuM21v6LTmgpkXfYU1qpBV2UGsFyuEnSJInl8fR1Ag=="], - "@graphql-tools/url-loader/@types/ws": ["@types/ws@8.18.1", "", { "dependencies": { "@types/node": "*" } }, "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg=="], + "@graphql-tools/schema/@graphql-tools/utils": ["@graphql-tools/utils@11.1.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-PtFVG4r8Z2LEBSaPYQMusBiB3o6kjLVJyjCLbnWem/SpSuM21v6LTmgpkXfYU1qpBV2UGsFyuEnSJInl8fR1Ag=="], "@graphql-tools/url-loader/sync-fetch": ["sync-fetch@0.6.0-2", "", { "dependencies": { "node-fetch": "^3.3.2", "timeout-signal": "^2.0.0", "whatwg-mimetype": "^4.0.0" } }, "sha512-c7AfkZ9udatCuAy9RSfiGPpeOKKUAUK5e1cXadLOGUjasdxqYqAK0jTNkM/FSEyJ3a5Ra27j/tw/PS0qLmaF/A=="], - "@graphql-tools/url-loader/ws": ["ws@8.18.3", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg=="], + "@graphql-tools/url-loader/ws": ["ws@8.20.1", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-It4dO0K5v//JtTXuPkfEOaI3uUN87iYPnqo/ZzqCoG3g8uhA66QUMs/SrM0YK7/NAu+r4LMh/9dq2A7k+rHs+w=="], "@humanwhocodes/config-array/minimatch": ["minimatch@3.1.5", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w=="], @@ -4786,7 +4682,7 @@ "@jridgewell/remapping/@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.31", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="], - "@mapbox/node-pre-gyp/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], + "@mapbox/node-pre-gyp/semver": ["semver@7.8.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg=="], "@metamask/eth-json-rpc-provider/@metamask/json-rpc-engine": ["@metamask/json-rpc-engine@7.3.3", "", { "dependencies": { "@metamask/rpc-errors": "^6.2.1", "@metamask/safe-event-emitter": "^3.0.0", "@metamask/utils": "^8.3.0" } }, "sha512-dwZPq8wx9yV3IX2caLi9q9xZBw2XeIoYqdyihDDDpuHVCEiqadJLwqM3zy+uwf6F1QYQ65A8aOMQg1Uw7LMLNg=="], @@ -4814,7 +4710,7 @@ "@metamask/sdk-communication-layer/uuid": ["uuid@8.3.2", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="], - "@metamask/utils/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], + "@metamask/utils/semver": ["semver@7.8.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg=="], "@metamask/utils/uuid": ["uuid@9.0.1", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="], @@ -4830,8 +4726,6 @@ "@polkadot/util/@polkadot/x-bigint": ["@polkadot/x-bigint@13.5.9", "", { "dependencies": { "@polkadot/x-global": "13.5.9", "tslib": "^2.8.0" } }, "sha512-JVW6vw3e8fkcRyN9eoc6JIl63MRxNQCP/tuLdHWZts1tcAYao0hpWUzteqJY93AgvmQ91KPsC1Kf3iuuZCi74g=="], - "@polkadot/util-crypto/@noble/curves": ["@noble/curves@1.9.7", "", { "dependencies": { "@noble/hashes": "1.8.0" } }, "sha512-gbKGcRUYIjA3/zCCNaWDciTMFI0dCkvou3TL8Zmy5Nc7sJ47a0jtOeZoTaMxkuqRo9cRhjOdZJXegxYE5FN/xw=="], - "@polkadot/util-crypto/@polkadot/x-bigint": ["@polkadot/x-bigint@13.5.9", "", { "dependencies": { "@polkadot/x-global": "13.5.9", "tslib": "^2.8.0" } }, "sha512-JVW6vw3e8fkcRyN9eoc6JIl63MRxNQCP/tuLdHWZts1tcAYao0hpWUzteqJY93AgvmQ91KPsC1Kf3iuuZCi74g=="], "@polkadot/x-bigint/@polkadot/x-global": ["@polkadot/x-global@14.0.3", "", { "dependencies": { "tslib": "^2.8.0" } }, "sha512-MzMEynJ7HMTy/plLmdyP8rv14RS/6s29HZodUG9aCOscBnEiEDxVEax/ztRJqxhhQuHeYdx0LYDwVbdQDTkqNw=="], @@ -4842,7 +4736,7 @@ "@polkadot/x-ws/@polkadot/x-global": ["@polkadot/x-global@14.0.3", "", { "dependencies": { "tslib": "^2.8.0" } }, "sha512-MzMEynJ7HMTy/plLmdyP8rv14RS/6s29HZodUG9aCOscBnEiEDxVEax/ztRJqxhhQuHeYdx0LYDwVbdQDTkqNw=="], - "@polkadot/x-ws/ws": ["ws@8.20.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-sAt8BhgNbzCtgGbt2OxmpuryO63ZoDk/sqaB/znQm94T4fCEsy/yV+7CdC1kJhOU9lboAEU7R3kquuycDoibVA=="], + "@polkadot/x-ws/ws": ["ws@8.20.1", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-It4dO0K5v//JtTXuPkfEOaI3uUN87iYPnqo/ZzqCoG3g8uhA66QUMs/SrM0YK7/NAu+r4LMh/9dq2A7k+rHs+w=="], "@reown/appkit/@walletconnect/universal-provider": ["@walletconnect/universal-provider@2.23.7", "", { "dependencies": { "@walletconnect/events": "1.0.1", "@walletconnect/jsonrpc-http-connection": "1.0.8", "@walletconnect/jsonrpc-provider": "1.0.14", "@walletconnect/jsonrpc-types": "1.0.4", "@walletconnect/jsonrpc-utils": "1.0.8", "@walletconnect/keyvaluestorage": "1.1.1", "@walletconnect/logger": "3.0.2", "@walletconnect/sign-client": "2.23.7", "@walletconnect/types": "2.23.7", "@walletconnect/utils": "2.23.7", "es-toolkit": "1.44.0", "events": "3.3.0" } }, "sha512-6UicU/Mhr/1bh7MNoajypz7BhigORbHpP1LFTf8FYLQGDqzmqHMqmMH2GDAImtaY2sFTi2jBvc22tLl8VMze/A=="], @@ -4856,23 +4750,23 @@ "@reown/appkit-wallet/zod": ["zod@3.22.4", "", {}, "sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg=="], - "@rushstack/node-core-library/ajv": ["ajv@8.13.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2", "uri-js": "^4.4.1" } }, "sha512-PRA911Blj99jR5RMeTunVbNXMF6Lp4vZXnk5GQjcnUWUTsrXtekg/pnmFFI2u/I36Y/2bITGS30GZCXei6uNkA=="], + "@rushstack/node-core-library/fs-extra": ["fs-extra@7.0.1", "", { "dependencies": { "graceful-fs": "^4.1.2", "jsonfile": "^4.0.0", "universalify": "^0.1.0" } }, "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw=="], - "@rushstack/node-core-library/fs-extra": ["fs-extra@11.3.4", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-CTXd6rk/M3/ULNQj8FBqBWHYBVYybQ3VPBw0xGKFe3tuH7ytT6ACnvzpIQ3UZtB8yvUKC2cXn1a+x+5EVQLovA=="], - - "@rushstack/node-core-library/resolve": ["resolve@1.22.11", "", { "dependencies": { "is-core-module": "^2.16.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ=="], + "@rushstack/node-core-library/resolve": ["resolve@1.22.12", "", { "dependencies": { "es-errors": "^1.3.0", "is-core-module": "^2.16.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA=="], "@rushstack/node-core-library/semver": ["semver@7.5.4", "", { "dependencies": { "lru-cache": "^6.0.0" }, "bin": { "semver": "bin/semver.js" } }, "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA=="], "@safe-global/protocol-kit/@noble/curves": ["@noble/curves@1.9.7", "", { "dependencies": { "@noble/hashes": "1.8.0" } }, "sha512-gbKGcRUYIjA3/zCCNaWDciTMFI0dCkvou3TL8Zmy5Nc7sJ47a0jtOeZoTaMxkuqRo9cRhjOdZJXegxYE5FN/xw=="], - "@safe-global/protocol-kit/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], + "@safe-global/protocol-kit/semver": ["semver@7.8.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg=="], + + "@safe-global/safe-deployments/semver": ["semver@7.8.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg=="], - "@safe-global/safe-deployments/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], + "@scure/bip32/@noble/curves": ["@noble/curves@1.9.7", "", { "dependencies": { "@noble/hashes": "1.8.0" } }, "sha512-gbKGcRUYIjA3/zCCNaWDciTMFI0dCkvou3TL8Zmy5Nc7sJ47a0jtOeZoTaMxkuqRo9cRhjOdZJXegxYE5FN/xw=="], - "@scure/bip39/@noble/hashes": ["@noble/hashes@2.0.1", "", {}, "sha512-XlOlEbQcE9fmuXxrVTXCTlG2nlRXa9Rj3rr5Ue/+tX+nmkgbX720YHh0VR3hBF9xDvwnb8D2shVGOwNx+ulArw=="], + "@scure/bip39/@noble/hashes": ["@noble/hashes@2.2.0", "", {}, "sha512-IYqDGiTXab6FniAgnSdZwgWbomxpy9FtYvLKs7wCUs2a8RkITG+DFGO1DM9cr+E3/RgADRpFjrKVaJ1z6sjtEg=="], - "@scure/bip39/@scure/base": ["@scure/base@2.0.0", "", {}, "sha512-3E1kpuZginKkek01ovG8krQ0Z44E3DHPjc5S2rjJw9lZn3KSQOs8S7wqikF/AH7iRanHypj85uGyxk0XAyC37w=="], + "@scure/bip39/@scure/base": ["@scure/base@2.2.0", "", {}, "sha512-b8XEupJibegiXV+tDUseI8oLQc8ei3d/4Jkb2RpbHh3MfE054ov3uIz2dhFkB3FI8iwYkEh0gGCApkrYggkPNg=="], "@sentry/bundler-plugin-core/glob": ["glob@9.3.5", "", { "dependencies": { "fs.realpath": "^1.0.0", "minimatch": "^8.0.2", "minipass": "^4.2.4", "path-scurry": "^1.6.1" } }, "sha512-e1LleDykUz2Iu+MTYdkSsuWX8lvAjAcs0Xef0lNIu0S2wOAzuTxCJtcd9S3cijlwYF18EsU3rzb8jPVobxDh9Q=="], @@ -4902,73 +4796,43 @@ "@snowbridge/contract-types/ethers": ["ethers@6.15.0", "", { "dependencies": { "@adraffy/ens-normalize": "1.10.1", "@noble/curves": "1.2.0", "@noble/hashes": "1.3.2", "@types/node": "22.7.5", "aes-js": "4.0.0-beta.5", "tslib": "2.7.0", "ws": "8.17.1" } }, "sha512-Kf/3ZW54L4UT0pZtsY/rf+EkBU7Qi5nnhonjUb8yTXcxH3cdcWrV2cRyk0Xk/4jK6OoHhxxZHriyhje20If2hQ=="], - "@solana/codecs/@solana/codecs-numbers": ["@solana/codecs-numbers@5.5.1", "", { "dependencies": { "@solana/codecs-core": "5.5.1", "@solana/errors": "5.5.1" }, "peerDependencies": { "typescript": "^5.0.0" }, "optionalPeers": ["typescript"] }, "sha512-rllMIZAHqmtvC0HO/dc/21wDuWaD0B8Ryv8o+YtsICQBuiL/0U4AGwH7Pi5GNFySYk0/crSuwfIqQFtmxNSPFw=="], - - "@solana/codecs-data-structures/@solana/codecs-numbers": ["@solana/codecs-numbers@5.5.1", "", { "dependencies": { "@solana/codecs-core": "5.5.1", "@solana/errors": "5.5.1" }, "peerDependencies": { "typescript": "^5.0.0" }, "optionalPeers": ["typescript"] }, "sha512-rllMIZAHqmtvC0HO/dc/21wDuWaD0B8Ryv8o+YtsICQBuiL/0U4AGwH7Pi5GNFySYk0/crSuwfIqQFtmxNSPFw=="], - - "@solana/codecs-numbers/@solana/codecs-core": ["@solana/codecs-core@2.3.0", "", { "dependencies": { "@solana/errors": "2.3.0" }, "peerDependencies": { "typescript": ">=5.3.3" } }, "sha512-oG+VZzN6YhBHIoSKgS5ESM9VIGzhWjEHEGNPSibiDTxFhsFWxNaz8LbMDPjBUE69r9wmdGLkrQ+wVPbnJcZPvw=="], - - "@solana/codecs-numbers/@solana/errors": ["@solana/errors@2.3.0", "", { "dependencies": { "chalk": "^5.4.1", "commander": "^14.0.0" }, "peerDependencies": { "typescript": ">=5.3.3" }, "bin": { "errors": "bin/cli.mjs" } }, "sha512-66RI9MAbwYV0UtP7kGcTBVLxJgUxoZGm8Fbc0ah+lGiAw17Gugco6+9GrJCV83VyF2mDWyYnYM9qdI3yjgpnaQ=="], - - "@solana/codecs-strings/@solana/codecs-numbers": ["@solana/codecs-numbers@5.5.1", "", { "dependencies": { "@solana/codecs-core": "5.5.1", "@solana/errors": "5.5.1" }, "peerDependencies": { "typescript": "^5.0.0" }, "optionalPeers": ["typescript"] }, "sha512-rllMIZAHqmtvC0HO/dc/21wDuWaD0B8Ryv8o+YtsICQBuiL/0U4AGwH7Pi5GNFySYk0/crSuwfIqQFtmxNSPFw=="], - "@solana/errors/chalk": ["chalk@5.6.2", "", {}, "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA=="], "@solana/errors/commander": ["commander@14.0.2", "", {}, "sha512-TywoWNNRbhoD0BXs1P3ZEScW8W5iKrnbithIl0YH+uCmBd0QpPOA8yc82DS3BIE5Ma6FnBVUsJ7wVUDz4dvOWQ=="], - "@solana/offchain-messages/@solana/codecs-numbers": ["@solana/codecs-numbers@5.5.1", "", { "dependencies": { "@solana/codecs-core": "5.5.1", "@solana/errors": "5.5.1" }, "peerDependencies": { "typescript": "^5.0.0" }, "optionalPeers": ["typescript"] }, "sha512-rllMIZAHqmtvC0HO/dc/21wDuWaD0B8Ryv8o+YtsICQBuiL/0U4AGwH7Pi5GNFySYk0/crSuwfIqQFtmxNSPFw=="], - - "@solana/options/@solana/codecs-numbers": ["@solana/codecs-numbers@5.5.1", "", { "dependencies": { "@solana/codecs-core": "5.5.1", "@solana/errors": "5.5.1" }, "peerDependencies": { "typescript": "^5.0.0" }, "optionalPeers": ["typescript"] }, "sha512-rllMIZAHqmtvC0HO/dc/21wDuWaD0B8Ryv8o+YtsICQBuiL/0U4AGwH7Pi5GNFySYk0/crSuwfIqQFtmxNSPFw=="], - - "@solana/rpc-subscriptions-channel-websocket/ws": ["ws@8.20.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-sAt8BhgNbzCtgGbt2OxmpuryO63ZoDk/sqaB/znQm94T4fCEsy/yV+7CdC1kJhOU9lboAEU7R3kquuycDoibVA=="], - - "@solana/rpc-transport-http/undici-types": ["undici-types@7.24.5", "", {}, "sha512-kNh333UBSbgK35OIW7FwJTr9tTfVIG51Fm1tSVT7m8foPHfDVjsb7OIee/q/rs3bB2aV/3qOPgG5mHNWl1odiA=="], - - "@solana/rpc-types/@solana/codecs-numbers": ["@solana/codecs-numbers@5.5.1", "", { "dependencies": { "@solana/codecs-core": "5.5.1", "@solana/errors": "5.5.1" }, "peerDependencies": { "typescript": "^5.0.0" }, "optionalPeers": ["typescript"] }, "sha512-rllMIZAHqmtvC0HO/dc/21wDuWaD0B8Ryv8o+YtsICQBuiL/0U4AGwH7Pi5GNFySYk0/crSuwfIqQFtmxNSPFw=="], - - "@solana/transaction-messages/@solana/codecs-numbers": ["@solana/codecs-numbers@5.5.1", "", { "dependencies": { "@solana/codecs-core": "5.5.1", "@solana/errors": "5.5.1" }, "peerDependencies": { "typescript": "^5.0.0" }, "optionalPeers": ["typescript"] }, "sha512-rllMIZAHqmtvC0HO/dc/21wDuWaD0B8Ryv8o+YtsICQBuiL/0U4AGwH7Pi5GNFySYk0/crSuwfIqQFtmxNSPFw=="], + "@solana/rpc-subscriptions-channel-websocket/ws": ["ws@8.20.1", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-It4dO0K5v//JtTXuPkfEOaI3uUN87iYPnqo/ZzqCoG3g8uhA66QUMs/SrM0YK7/NAu+r4LMh/9dq2A7k+rHs+w=="], - "@solana/transactions/@solana/codecs-numbers": ["@solana/codecs-numbers@5.5.1", "", { "dependencies": { "@solana/codecs-core": "5.5.1", "@solana/errors": "5.5.1" }, "peerDependencies": { "typescript": "^5.0.0" }, "optionalPeers": ["typescript"] }, "sha512-rllMIZAHqmtvC0HO/dc/21wDuWaD0B8Ryv8o+YtsICQBuiL/0U4AGwH7Pi5GNFySYk0/crSuwfIqQFtmxNSPFw=="], - - "@solana/web3.js/@noble/curves": ["@noble/curves@1.9.7", "", { "dependencies": { "@noble/hashes": "1.8.0" } }, "sha512-gbKGcRUYIjA3/zCCNaWDciTMFI0dCkvou3TL8Zmy5Nc7sJ47a0jtOeZoTaMxkuqRo9cRhjOdZJXegxYE5FN/xw=="], - - "@solana/web3.js/bs58": ["bs58@4.0.1", "", { "dependencies": { "base-x": "^3.0.2" } }, "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw=="], + "@solana/rpc-transport-http/undici-types": ["undici-types@7.26.0", "", {}, "sha512-OY7qWYg4TsPpqg/kL2FfNnGA8cmAhPpLt45XQ2jd8p9UobYQ7Q09LeiCq5QwZhlKNLBj0iTUlBNhs4M2AVFmxA=="], "@storybook/csf-plugin/unplugin": ["unplugin@1.16.1", "", { "dependencies": { "acorn": "^8.14.0", "webpack-virtual-modules": "^0.6.2" } }, "sha512-4/u/j4FrCKdi17jaxuJA0jClGxB1AvU2hw/IuayPc4ay1XGaJs/rbb4v5WKwAjNifjmXK9PIFyuPiaK8azyR9w=="], "@storybook/react-vite/find-up": ["find-up@7.0.0", "", { "dependencies": { "locate-path": "^7.2.0", "path-exists": "^5.0.0", "unicorn-magic": "^0.1.0" } }, "sha512-YyZM99iHrqLKjmt4LJDj58KI+fYyufRLBSYcqycxf//KpBk9FoewoGX0450m9nB44qrZnovzC2oeP5hUibxc/g=="], - "@storybook/react-vite/resolve": ["resolve@1.22.11", "", { "dependencies": { "is-core-module": "^2.16.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ=="], - - "@supabase/realtime-js/@types/ws": ["@types/ws@8.18.1", "", { "dependencies": { "@types/node": "*" } }, "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg=="], - - "@supabase/realtime-js/ws": ["ws@8.18.3", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg=="], + "@storybook/react-vite/resolve": ["resolve@1.22.12", "", { "dependencies": { "es-errors": "^1.3.0", "is-core-module": "^2.16.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA=="], "@swc/cli/commander": ["commander@8.3.0", "", {}, "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww=="], - "@swc/cli/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], + "@swc/cli/semver": ["semver@7.8.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg=="], - "@tailwindcss/node/jiti": ["jiti@2.6.1", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ=="], + "@tailwindcss/node/jiti": ["jiti@2.7.0", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ=="], - "@tailwindcss/oxide-wasm32-wasi/@emnapi/core": ["@emnapi/core@1.9.1", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.0", "tslib": "^2.4.0" }, "bundled": true }, "sha512-mukuNALVsoix/w1BJwFzwXBN/dHeejQtuVzcDsfOEsdpCumXb/E9j8w11h5S54tT1xhifGfbbSm/ICrObRb3KA=="], + "@tailwindcss/oxide-wasm32-wasi/@emnapi/core": ["@emnapi/core@1.10.0", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.1", "tslib": "^2.4.0" }, "bundled": true }, "sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw=="], - "@tailwindcss/oxide-wasm32-wasi/@emnapi/runtime": ["@emnapi/runtime@1.9.1", "", { "dependencies": { "tslib": "^2.4.0" }, "bundled": true }, "sha512-VYi5+ZVLhpgK4hQ0TAjiQiZ6ol0oe4mBx7mVv7IflsiEp0OWoVsp/+f9Vc1hOhE0TtkORVrI1GvzyreqpgWtkA=="], + "@tailwindcss/oxide-wasm32-wasi/@emnapi/runtime": ["@emnapi/runtime@1.10.0", "", { "dependencies": { "tslib": "^2.4.0" }, "bundled": true }, "sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA=="], - "@tailwindcss/oxide-wasm32-wasi/@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.2.0", "", { "dependencies": { "tslib": "^2.4.0" }, "bundled": true }, "sha512-N10dEJNSsUx41Z6pZsXU8FjPjpBEplgH24sfkmITrBED1/U2Esum9F3lfLrMjKHHjmi557zQn7kR9R+XWXu5Rg=="], + "@tailwindcss/oxide-wasm32-wasi/@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.2.1", "", { "dependencies": { "tslib": "^2.4.0" }, "bundled": true }, "sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w=="], - "@tailwindcss/oxide-wasm32-wasi/@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.1.1", "", { "dependencies": { "@emnapi/core": "^1.7.1", "@emnapi/runtime": "^1.7.1", "@tybys/wasm-util": "^0.10.1" }, "bundled": true }, "sha512-p64ah1M1ld8xjWv3qbvFwHiFVWrq1yFvV4f7w+mzaqiR4IlSgkqhcRdHwsGgomwzBH51sRY4NEowLxnaBjcW/A=="], + "@tailwindcss/oxide-wasm32-wasi/@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.1.4", "", { "dependencies": { "@tybys/wasm-util": "^0.10.1" }, "peerDependencies": { "@emnapi/core": "^1.7.1", "@emnapi/runtime": "^1.7.1" }, "bundled": true }, "sha512-3NQNNgA1YSlJb/kMH1ildASP9HW7/7kYnRI2szWJaofaS1hWmbGI4H+d3+22aGzXXN9IJ+n+GiFVcGipJP18ow=="], - "@tailwindcss/oxide-wasm32-wasi/@tybys/wasm-util": ["@tybys/wasm-util@0.10.1", "", { "dependencies": { "tslib": "^2.4.0" }, "bundled": true }, "sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg=="], + "@tailwindcss/oxide-wasm32-wasi/@tybys/wasm-util": ["@tybys/wasm-util@0.10.2", "", { "dependencies": { "tslib": "^2.4.0" }, "bundled": true }, "sha512-RoBvJ2X0wuKlWFIjrwffGw1IqZHKQqzIchKaadZZfnNpsAYp2mM0h36JtPCjNDAHGgYez/15uMBpfGwchhiMgg=="], "@tailwindcss/oxide-wasm32-wasi/tslib": ["tslib@2.8.1", "", { "bundled": true }, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - "@tanstack/router-generator/prettier": ["prettier@3.8.1", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg=="], - - "@tanstack/router-generator/zod": ["zod@3.25.76", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="], + "@tanstack/router-generator/jiti": ["jiti@2.7.0", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ=="], - "@tanstack/router-plugin/chokidar": ["chokidar@3.6.0", "", { "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", "glob-parent": "~5.1.2", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", "readdirp": "~3.6.0" }, "optionalDependencies": { "fsevents": "~2.3.2" } }, "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw=="], + "@tanstack/router-generator/prettier": ["prettier@3.8.3", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-7igPTM53cGHMW8xWuVTydi2KO233VFiTNyF5hLJqpilHfmn8C8gPf+PS7dUT64YcXFbiMGZxS9pCSxL/Dxm/Jw=="], - "@tanstack/router-plugin/zod": ["zod@3.25.76", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="], + "@tanstack/router-plugin/chokidar": ["chokidar@5.0.0", "", { "dependencies": { "readdirp": "^5.0.0" } }, "sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw=="], "@tanstack/router-utils/diff": ["diff@8.0.4", "", {}, "sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw=="], @@ -4980,22 +4844,24 @@ "@typechain/hardhat/fs-extra": ["fs-extra@9.1.0", "", { "dependencies": { "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ=="], - "@types/minimatch/minimatch": ["minimatch@10.2.4", "", { "dependencies": { "brace-expansion": "^5.0.2" } }, "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg=="], + "@types/minimatch/minimatch": ["minimatch@10.2.5", "", { "dependencies": { "brace-expansion": "^5.0.5" } }, "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg=="], - "@typescript-eslint/eslint-plugin/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], + "@typescript-eslint/eslint-plugin/semver": ["semver@7.8.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg=="], - "@typescript-eslint/project-service/@typescript-eslint/types": ["@typescript-eslint/types@8.57.2", "", {}, "sha512-/iZM6FnM4tnx9csuTxspMW4BOSegshwX5oBDznJ7S4WggL7Vczz5d2W11ecc4vRrQMQHXRSxzrCsyG5EsPPTbA=="], + "@typescript-eslint/project-service/@typescript-eslint/types": ["@typescript-eslint/types@8.60.0", "", {}, "sha512-AsE7x2XaAK+CVbeih0Fvbn+r1qHxtpLDJ3XUuFcIinT318T90yHMJC+Zgv+jUuDjQQd06HKwxnDu6sz1IcTilA=="], "@typescript-eslint/typescript-estree/globby": ["globby@11.1.0", "", { "dependencies": { "array-union": "^2.1.0", "dir-glob": "^3.0.1", "fast-glob": "^3.2.9", "ignore": "^5.2.0", "merge2": "^1.4.1", "slash": "^3.0.0" } }, "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g=="], - "@typescript-eslint/typescript-estree/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], + "@typescript-eslint/typescript-estree/semver": ["semver@7.8.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg=="], "@typescript-eslint/utils/eslint-scope": ["eslint-scope@5.1.1", "", { "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^4.1.1" } }, "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw=="], - "@typescript-eslint/utils/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], + "@typescript-eslint/utils/semver": ["semver@7.8.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg=="], "@vitest/mocker/estree-walker": ["estree-walker@3.0.3", "", { "dependencies": { "@types/estree": "^1.0.0" } }, "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g=="], + "@wagmi/core/eventemitter3": ["eventemitter3@5.0.1", "", {}, "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA=="], + "@wagmi/core/zustand": ["zustand@5.0.0", "", { "peerDependencies": { "@types/react": ">=18.0.0", "immer": ">=9.0.6", "react": ">=18.0.0", "use-sync-external-store": ">=1.2.0" }, "optionalPeers": ["@types/react", "immer", "react", "use-sync-external-store"] }, "sha512-LE+VcmbartOPM+auOjCCLQOsQ05zUTp8RkgwRzefUk+2jISdMMFnxvyTjA4YNWr5ZGXYbVsEMZosttuxUBkojQ=="], "@walletconnect/environment/tslib": ["tslib@1.14.1", "", {}, "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="], @@ -5052,19 +4918,17 @@ "basic-auth/safe-buffer": ["safe-buffer@5.1.2", "", {}, "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="], - "bin-version-check/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], + "bin-version-check/semver": ["semver@7.8.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg=="], "bl/buffer": ["buffer@5.7.1", "", { "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" } }, "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ=="], "body-parser/debug": ["debug@2.6.9", "", { "dependencies": { "ms": "2.0.0" } }, "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA=="], - "borsh/bs58": ["bs58@4.0.1", "", { "dependencies": { "base-x": "^3.0.2" } }, "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw=="], - "boxen/type-fest": ["type-fest@0.20.2", "", {}, "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ=="], "boxen/wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], - "browser-resolve/resolve": ["resolve@1.22.11", "", { "dependencies": { "is-core-module": "^2.16.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ=="], + "browser-resolve/resolve": ["resolve@1.22.12", "", { "dependencies": { "es-errors": "^1.3.0", "is-core-module": "^2.16.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA=="], "browserify-sign/readable-stream": ["readable-stream@2.3.8", "", { "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", "isarray": "~1.0.0", "process-nextick-args": "~2.0.0", "safe-buffer": "~5.1.1", "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" } }, "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA=="], @@ -5074,8 +4938,6 @@ "cbw-sdk/clsx": ["clsx@1.2.1", "", {}, "sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg=="], - "cbw-sdk/preact": ["preact@10.29.0", "", {}, "sha512-wSAGyk2bYR1c7t3SZ3jHcM6xy0lcBcDel6lODcs9ME6Th++Dx2KU+6D3HD8wMMKGA8Wpw7OMd3/4RGzYRpzwRg=="], - "chai/deep-eql": ["deep-eql@5.0.2", "", {}, "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q=="], "chai-as-promised/check-error": ["check-error@1.0.3", "", { "dependencies": { "get-func-name": "^2.0.2" } }, "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg=="], @@ -5084,7 +4946,7 @@ "cli-table3/string-width": ["string-width@2.1.1", "", { "dependencies": { "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^4.0.0" } }, "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw=="], - "cli-truncate/string-width": ["string-width@8.2.0", "", { "dependencies": { "get-east-asian-width": "^1.5.0", "strip-ansi": "^7.1.2" } }, "sha512-6hJPQ8N0V0P3SNmP6h2J99RLuzrWz2gvT7VnK5tKvrNqJoyS9W4/Fb8mo31UiPvy00z7DQXkP2hnKBVav76thw=="], + "cli-truncate/string-width": ["string-width@8.2.1", "", { "dependencies": { "get-east-asian-width": "^1.5.0", "strip-ansi": "^7.1.2" } }, "sha512-IIaP0g3iy9Cyy18w3M9YcaDudujEAVHKt3a3QJg1+sr/oX96TbaGUubG0hJyCjCBThFH+tFpcIyoUHUn1ogaLA=="], "cliui/wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], @@ -5110,11 +4972,11 @@ "editorconfig/commander": ["commander@10.0.1", "", {}, "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug=="], - "editorconfig/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], + "editorconfig/semver": ["semver@7.8.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg=="], "elliptic/bn.js": ["bn.js@4.12.3", "", {}, "sha512-fGTi3gxV/23FTYdAoUtLYp6qySe2KE3teyZitipKNRuVYcBkoP/bB3guXN/XVKUe9mxCHXnc9C4ocyz8OmgN0g=="], - "engine.io-client/ws": ["ws@8.18.3", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg=="], + "engine.io-client/ws": ["ws@8.20.1", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-It4dO0K5v//JtTXuPkfEOaI3uUN87iYPnqo/ZzqCoG3g8uhA66QUMs/SrM0YK7/NAu+r4LMh/9dq2A7k+rHs+w=="], "escodegen/esprima": ["esprima@2.7.3", "", { "bin": { "esparse": "./bin/esparse.js", "esvalidate": "./bin/esvalidate.js" } }, "sha512-OarPfz0lFCiW4/AV2Oy1Rp9qu0iusTKqykwTspGCZtPxmF81JR4MmIebvF1F9+UOKth2ZubLQ4XGGaU+hSn99A=="], @@ -5124,7 +4986,7 @@ "escodegen/source-map": ["source-map@0.2.0", "", { "dependencies": { "amdefine": ">=0.0.4" } }, "sha512-CBdZ2oa/BHhS4xj5DlhjWNHcan57/5YuvfdLf17iVmIpd9KRm+DFLmC6nBNj+6Ua7Kt3TmOjDpQT1aTYOQtoUA=="], - "eslint/ajv": ["ajv@6.14.0", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-IWrosm/yrn43eiKqkfkHis7QioDleaXQHdDVPKg0FSwwd/DuvyX79TZnFOnYpB7dcsFAMmtFztZuXPDvSePkFw=="], + "eslint/ajv": ["ajv@6.15.0", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw=="], "eslint/minimatch": ["minimatch@3.1.5", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w=="], @@ -5132,9 +4994,9 @@ "eslint-plugin-react/minimatch": ["minimatch@3.1.5", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w=="], - "eslint-plugin-react/resolve": ["resolve@2.0.0-next.6", "", { "dependencies": { "es-errors": "^1.3.0", "is-core-module": "^2.16.1", "node-exports-info": "^1.6.0", "object-keys": "^1.1.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-3JmVl5hMGtJ3kMmB3zi3DL25KfkCEyy3Tw7Gmw7z5w8M9WlwoPFnIvwChzu1+cF3iaK3sp18hhPz8ANeimdJfA=="], + "eslint-plugin-react/resolve": ["resolve@2.0.0-next.7", "", { "dependencies": { "es-errors": "^1.3.0", "is-core-module": "^2.16.2", "node-exports-info": "^1.6.0", "object-keys": "^1.1.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-tqt+NBWwyaMgw3zDsnygx4CByWjQEJHOPMdslYhppaQSJUtL/D4JO9CcBBlhPoI8lz9oJIDXkwXfhF4aWqP8xQ=="], - "eslint-plugin-storybook/@typescript-eslint/utils": ["@typescript-eslint/utils@8.57.2", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.9.1", "@typescript-eslint/scope-manager": "8.57.2", "@typescript-eslint/types": "8.57.2", "@typescript-eslint/typescript-estree": "8.57.2" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-krRIbvPK1ju1WBKIefiX+bngPs+odIQUtR7kymzPfo1POVw3jlF+nLkmexdSSd4UCbDcQn+wMBATOOmpBbqgKg=="], + "eslint-plugin-storybook/@typescript-eslint/utils": ["@typescript-eslint/utils@8.60.0", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.9.1", "@typescript-eslint/scope-manager": "8.60.0", "@typescript-eslint/types": "8.60.0", "@typescript-eslint/typescript-estree": "8.60.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.1.0" } }, "sha512-HtXuPfrHTyBDkameWpl+vJb1Uevu2tznAyahM1Oc4AENidCLTPiZDWIo4GfcxNdC/RcfGcadzzkqbRG87dUrQA=="], "eth-block-tracker/@metamask/utils": ["@metamask/utils@5.0.2", "", { "dependencies": { "@ethereumjs/tx": "^4.1.2", "@types/debug": "^4.1.7", "debug": "^4.3.4", "semver": "^7.3.8", "superstruct": "^1.0.3" } }, "sha512-yfmE79bRQtnMzarnKfX7AEJBwFTxvTyw3nBQlu/5rmGXrjAeAMltoGxO62TFurxrQAFMNa/fEjIHNvungZp0+g=="], @@ -5170,7 +5032,7 @@ "express/cookie-signature": ["cookie-signature@1.2.2", "", {}, "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg=="], - "express/type-is": ["type-is@2.0.1", "", { "dependencies": { "content-type": "^1.0.5", "media-typer": "^1.1.0", "mime-types": "^3.0.0" } }, "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw=="], + "express/type-is": ["type-is@2.1.0", "", { "dependencies": { "content-type": "^2.0.0", "media-typer": "^1.1.0", "mime-types": "^3.0.0" } }, "sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA=="], "fast-glob/glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="], @@ -5194,15 +5056,15 @@ "globby/glob": ["glob@7.2.3", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q=="], - "graphql-config/@graphql-tools/url-loader": ["@graphql-tools/url-loader@9.0.6", "", { "dependencies": { "@graphql-tools/executor-graphql-ws": "^3.1.2", "@graphql-tools/executor-http": "^3.0.6", "@graphql-tools/executor-legacy-ws": "^1.1.25", "@graphql-tools/utils": "^11.0.0", "@graphql-tools/wrap": "^11.1.1", "@types/ws": "^8.0.0", "@whatwg-node/fetch": "^0.10.13", "@whatwg-node/promise-helpers": "^1.0.0", "isomorphic-ws": "^5.0.0", "sync-fetch": "0.6.0", "tslib": "^2.4.0", "ws": "^8.19.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-QdJI3f7ANDMYfYazRgJzzybznjOrQAOuDXweC9xmKgPZoTqNxEAsatiy69zcpTf6092taJLyrqRH6R7xUTzf4A=="], + "graphql-config/@graphql-tools/url-loader": ["@graphql-tools/url-loader@9.1.2", "", { "dependencies": { "@graphql-tools/executor-graphql-ws": "^3.1.4", "@graphql-tools/executor-http": "^3.2.1", "@graphql-tools/executor-legacy-ws": "^1.1.28", "@graphql-tools/utils": "^11.1.0", "@graphql-tools/wrap": "^11.1.1", "@types/ws": "^8.0.0", "@whatwg-node/fetch": "^0.10.13", "@whatwg-node/promise-helpers": "^1.0.0", "isomorphic-ws": "^5.0.0", "sync-fetch": "0.6.0", "tslib": "^2.4.0", "ws": "^8.20.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-pVSiPrfWQKb3jq23Pl7EjbB2uv3tgZLnWo/axkmg4itAEZ5s/vV/jKa8P1HZzUnSVUTR+8tcEZVeNsUbzFCbkg=="], - "graphql-config/@graphql-tools/utils": ["@graphql-tools/utils@11.0.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-bM1HeZdXA2C3LSIeLOnH/bcqSgbQgKEDrjxODjqi3y58xai2TkNrtYcQSoWzGbt9VMN1dORGjR7Vem8SPnUFQA=="], + "graphql-config/@graphql-tools/utils": ["@graphql-tools/utils@11.1.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-PtFVG4r8Z2LEBSaPYQMusBiB3o6kjLVJyjCLbnWem/SpSuM21v6LTmgpkXfYU1qpBV2UGsFyuEnSJInl8fR1Ag=="], - "graphql-config/jiti": ["jiti@2.6.1", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ=="], + "graphql-config/jiti": ["jiti@2.7.0", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ=="], - "graphql-config/minimatch": ["minimatch@10.2.4", "", { "dependencies": { "brace-expansion": "^5.0.2" } }, "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg=="], + "graphql-config/minimatch": ["minimatch@10.2.5", "", { "dependencies": { "brace-expansion": "^5.0.5" } }, "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg=="], - "h3/cookie-es": ["cookie-es@1.2.2", "", {}, "sha512-+W7VmiVINB+ywl1HGXJXmrqkOhpKrIiVZV6tQuV54ZyQC7MMuBt81Vc336GMLoHBq5hV/F9eXgt5Mnx0Rha5Fg=="], + "h3/cookie-es": ["cookie-es@1.2.3", "", {}, "sha512-lXVyvUvrNXblMqzIRrxHb57UUVmqsSWlxqt3XIjCkUP0wDAf6uicO6KMbEgYrMNtEvWgWHwe42CKxPu9MYAnWw=="], "handlebars/source-map": ["source-map@0.6.1", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="], @@ -5220,16 +5082,6 @@ "inquirer/wrap-ansi": ["wrap-ansi@6.2.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA=="], - "jayson/@types/node": ["@types/node@12.20.55", "", {}, "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ=="], - - "jayson/@types/ws": ["@types/ws@7.4.7", "", { "dependencies": { "@types/node": "*" } }, "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww=="], - - "jayson/commander": ["commander@2.20.3", "", {}, "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="], - - "jayson/isomorphic-ws": ["isomorphic-ws@4.0.1", "", { "peerDependencies": { "ws": "*" } }, "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w=="], - - "jayson/uuid": ["uuid@8.3.2", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="], - "js-beautify/glob": ["glob@10.5.0", "", { "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", "minimatch": "^9.0.4", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^1.11.1" }, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg=="], "js-beautify/nopt": ["nopt@7.2.1", "", { "dependencies": { "abbrev": "^2.0.0" }, "bin": { "nopt": "bin/nopt.js" } }, "sha512-taM24ViiimT/XntxbPyJQzCG+p4EKOpgD3mxFwW38mGjVUrfERQOeY4EDHjdnptttfHuHQXFx+lTP08Q+mLa/w=="], @@ -5306,6 +5158,8 @@ "ox/@scure/bip39": ["@scure/bip39@1.6.0", "", { "dependencies": { "@noble/hashes": "~1.8.0", "@scure/base": "~1.2.5" } }, "sha512-+lF0BbLiJNwVlev4eKelw1WWLaiKXw7sSl8T6FvBlWkdX+94aGJ4o8XjUdlyhTCjd8c+B3KT3JfS8P0bLRNU6A=="], + "ox/eventemitter3": ["eventemitter3@5.0.1", "", {}, "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA=="], + "p-locate/p-limit": ["p-limit@3.1.0", "", { "dependencies": { "yocto-queue": "^0.1.0" } }, "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ=="], "path-scurry/lru-cache": ["lru-cache@10.4.3", "", {}, "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="], @@ -5320,11 +5174,11 @@ "qrcode/yargs": ["yargs@15.4.1", "", { "dependencies": { "cliui": "^6.0.0", "decamelize": "^1.2.0", "find-up": "^4.1.0", "get-caller-file": "^2.0.1", "require-directory": "^2.1.1", "require-main-filename": "^2.0.0", "set-blocking": "^2.0.0", "string-width": "^4.2.0", "which-module": "^2.0.0", "y18n": "^4.0.0", "yargs-parser": "^18.1.2" } }, "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A=="], - "react-docgen/resolve": ["resolve@1.22.11", "", { "dependencies": { "is-core-module": "^2.16.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ=="], + "react-docgen/resolve": ["resolve@1.22.12", "", { "dependencies": { "es-errors": "^1.3.0", "is-core-module": "^2.16.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA=="], "recast/source-map": ["source-map@0.6.1", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="], - "rechoir/resolve": ["resolve@1.22.11", "", { "dependencies": { "is-core-module": "^2.16.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ=="], + "rechoir/resolve": ["resolve@1.22.12", "", { "dependencies": { "es-errors": "^1.3.0", "is-core-module": "^2.16.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA=="], "recursive-readdir/minimatch": ["minimatch@3.1.5", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w=="], @@ -5336,12 +5190,6 @@ "ripemd160/hash-base": ["hash-base@3.1.2", "", { "dependencies": { "inherits": "^2.0.4", "readable-stream": "^2.3.8", "safe-buffer": "^5.2.1", "to-buffer": "^1.2.1" } }, "sha512-Bb33KbowVTIj5s7Ked1OsqHUeCpz//tPwR+E2zJgJKo9Z5XolZ9b6bdUgjmYlwnWhoOQKoTd1TYToZGn5mAYOg=="], - "rpc-websockets/@types/ws": ["@types/ws@8.18.1", "", { "dependencies": { "@types/node": "*" } }, "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg=="], - - "rpc-websockets/utf-8-validate": ["utf-8-validate@6.0.6", "", { "dependencies": { "node-gyp-build": "^4.3.0" } }, "sha512-q3l3P9UtEEiAHcsgsqTgf9PPjctrDWoIXW3NpOHFdRDbLvu4DLIcxHangJ4RLrWkBcKjmcs/6NkerI8T/rE4LA=="], - - "rpc-websockets/ws": ["ws@8.20.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-sAt8BhgNbzCtgGbt2OxmpuryO63ZoDk/sqaB/znQm94T4fCEsy/yV+7CdC1kJhOU9lboAEU7R3kquuycDoibVA=="], - "sc-istanbul/async": ["async@1.5.2", "", {}, "sha512-nSVgobk4rv61R9PUSDtYt7mPVB2olxNR5RWJcAsH676/ef11bUZwvu7+RGYrYauVdDPcO519v68wRhXQtxsV9w=="], "sc-istanbul/esprima": ["esprima@2.7.3", "", { "bin": { "esparse": "./bin/esparse.js", "esvalidate": "./bin/esvalidate.js" } }, "sha512-OarPfz0lFCiW4/AV2Oy1Rp9qu0iusTKqykwTspGCZtPxmF81JR4MmIebvF1F9+UOKth2ZubLQ4XGGaU+hSn99A=="], @@ -5362,15 +5210,15 @@ "seek-bzip/commander": ["commander@6.2.1", "", {}, "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA=="], - "semver-truncate/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], + "semver-truncate/semver": ["semver@7.8.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg=="], - "sequelize/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], + "sequelize/semver": ["semver@7.8.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg=="], "sequelize/uuid": ["uuid@8.3.2", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="], "sequelize-cli/fs-extra": ["fs-extra@9.1.0", "", { "dependencies": { "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ=="], - "sequelize-cli/resolve": ["resolve@1.22.11", "", { "dependencies": { "is-core-module": "^2.16.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ=="], + "sequelize-cli/resolve": ["resolve@1.22.12", "", { "dependencies": { "es-errors": "^1.3.0", "is-core-module": "^2.16.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA=="], "sequelize-cli/umzug": ["umzug@2.3.0", "", { "dependencies": { "bluebird": "^3.7.2" } }, "sha512-Z274K+e8goZK8QJxmbRPhl89HPO1K+ORFtm6rySPhFKfKc5GHhqdzD0SGhSWHkzoXasqJuItdhorSvY7/Cgflw=="], @@ -5384,7 +5232,7 @@ "slice-ansi/is-fullwidth-code-point": ["is-fullwidth-code-point@5.1.0", "", { "dependencies": { "get-east-asian-width": "^1.3.1" } }, "sha512-5XHYaSyiqADb4RnZ1Bdad6cPp8Toise4TzEjcOYDHZkTCbKgiUl7WTUCpNWHuxmDt91wnsZBc9xinNzopv3JMQ=="], - "smoldot/ws": ["ws@8.18.3", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg=="], + "smoldot/ws": ["ws@8.20.1", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-It4dO0K5v//JtTXuPkfEOaI3uUN87iYPnqo/ZzqCoG3g8uhA66QUMs/SrM0YK7/NAu+r4LMh/9dq2A7k+rHs+w=="], "solc/commander": ["commander@8.3.0", "", {}, "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww=="], @@ -5394,7 +5242,7 @@ "solidity-coverage/fs-extra": ["fs-extra@8.1.0", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^4.0.0", "universalify": "^0.1.0" } }, "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g=="], - "solidity-coverage/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], + "solidity-coverage/semver": ["semver@7.8.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg=="], "solidity-coverage/web3-utils": ["web3-utils@1.10.4", "", { "dependencies": { "@ethereumjs/util": "^8.1.0", "bn.js": "^5.2.1", "ethereum-bloom-filters": "^1.0.6", "ethereum-cryptography": "^2.1.2", "ethjs-unit": "0.1.6", "number-to-bn": "1.7.0", "randombytes": "^2.1.0", "utf8": "3.0.0" } }, "sha512-tsu8FiKJLk2PzhDl9fXbGUWTkkVXYhtTA+SmEFkKft+9BgwLxfCRpU96sWv7ICC8zixBNd3JURVoiR3dUXgP8A=="], @@ -5404,9 +5252,9 @@ "stacktrace-parser/type-fest": ["type-fest@0.7.1", "", {}, "sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg=="], - "storybook/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], + "storybook/semver": ["semver@7.8.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg=="], - "storybook/ws": ["ws@8.18.3", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg=="], + "storybook/ws": ["ws@8.20.1", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-It4dO0K5v//JtTXuPkfEOaI3uUN87iYPnqo/ZzqCoG3g8uhA66QUMs/SrM0YK7/NAu+r4LMh/9dq2A7k+rHs+w=="], "strip-dirs/is-plain-obj": ["is-plain-obj@1.1.0", "", {}, "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg=="], @@ -5428,14 +5276,12 @@ "then-request/form-data": ["form-data@2.5.5", "", { "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", "es-set-tostringtag": "^2.1.0", "hasown": "^2.0.2", "mime-types": "^2.1.35", "safe-buffer": "^5.2.1" } }, "sha512-jqdObeR2rxZZbPSGL+3VckHMYtu+f9//KXBsVny6JSX/pa38Fy+bGjuG8eW/H6USNQWhLi8Num++cU2yOCNz4A=="], - "tsup/esbuild": ["esbuild@0.27.4", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.27.4", "@esbuild/android-arm": "0.27.4", "@esbuild/android-arm64": "0.27.4", "@esbuild/android-x64": "0.27.4", "@esbuild/darwin-arm64": "0.27.4", "@esbuild/darwin-x64": "0.27.4", "@esbuild/freebsd-arm64": "0.27.4", "@esbuild/freebsd-x64": "0.27.4", "@esbuild/linux-arm": "0.27.4", "@esbuild/linux-arm64": "0.27.4", "@esbuild/linux-ia32": "0.27.4", "@esbuild/linux-loong64": "0.27.4", "@esbuild/linux-mips64el": "0.27.4", "@esbuild/linux-ppc64": "0.27.4", "@esbuild/linux-riscv64": "0.27.4", "@esbuild/linux-s390x": "0.27.4", "@esbuild/linux-x64": "0.27.4", "@esbuild/netbsd-arm64": "0.27.4", "@esbuild/netbsd-x64": "0.27.4", "@esbuild/openbsd-arm64": "0.27.4", "@esbuild/openbsd-x64": "0.27.4", "@esbuild/openharmony-arm64": "0.27.4", "@esbuild/sunos-x64": "0.27.4", "@esbuild/win32-arm64": "0.27.4", "@esbuild/win32-ia32": "0.27.4", "@esbuild/win32-x64": "0.27.4" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-Rq4vbHnYkK5fws5NF7MYTU68FPRE1ajX7heQ/8QXXWqNgqqJ/GkmmyxIzUnf2Sr/bakf8l54716CcMGHYhMrrQ=="], + "tsup/esbuild": ["esbuild@0.27.7", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.27.7", "@esbuild/android-arm": "0.27.7", "@esbuild/android-arm64": "0.27.7", "@esbuild/android-x64": "0.27.7", "@esbuild/darwin-arm64": "0.27.7", "@esbuild/darwin-x64": "0.27.7", "@esbuild/freebsd-arm64": "0.27.7", "@esbuild/freebsd-x64": "0.27.7", "@esbuild/linux-arm": "0.27.7", "@esbuild/linux-arm64": "0.27.7", "@esbuild/linux-ia32": "0.27.7", "@esbuild/linux-loong64": "0.27.7", "@esbuild/linux-mips64el": "0.27.7", "@esbuild/linux-ppc64": "0.27.7", "@esbuild/linux-riscv64": "0.27.7", "@esbuild/linux-s390x": "0.27.7", "@esbuild/linux-x64": "0.27.7", "@esbuild/netbsd-arm64": "0.27.7", "@esbuild/netbsd-x64": "0.27.7", "@esbuild/openbsd-arm64": "0.27.7", "@esbuild/openbsd-x64": "0.27.7", "@esbuild/openharmony-arm64": "0.27.7", "@esbuild/sunos-x64": "0.27.7", "@esbuild/win32-arm64": "0.27.7", "@esbuild/win32-ia32": "0.27.7", "@esbuild/win32-x64": "0.27.7" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-IxpibTjyVnmrIQo5aqNpCgoACA/dTKLTlhMHihVHhdkxKyPO1uBBthumT0rdHmcsk9uMonIWS0m4FljWzILh3w=="], "tsup/tinyexec": ["tinyexec@0.3.2", "", {}, "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA=="], "tsutils/tslib": ["tslib@1.14.1", "", {}, "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="], - "tsx/esbuild": ["esbuild@0.27.4", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.27.4", "@esbuild/android-arm": "0.27.4", "@esbuild/android-arm64": "0.27.4", "@esbuild/android-x64": "0.27.4", "@esbuild/darwin-arm64": "0.27.4", "@esbuild/darwin-x64": "0.27.4", "@esbuild/freebsd-arm64": "0.27.4", "@esbuild/freebsd-x64": "0.27.4", "@esbuild/linux-arm": "0.27.4", "@esbuild/linux-arm64": "0.27.4", "@esbuild/linux-ia32": "0.27.4", "@esbuild/linux-loong64": "0.27.4", "@esbuild/linux-mips64el": "0.27.4", "@esbuild/linux-ppc64": "0.27.4", "@esbuild/linux-riscv64": "0.27.4", "@esbuild/linux-s390x": "0.27.4", "@esbuild/linux-x64": "0.27.4", "@esbuild/netbsd-arm64": "0.27.4", "@esbuild/netbsd-x64": "0.27.4", "@esbuild/openbsd-arm64": "0.27.4", "@esbuild/openbsd-x64": "0.27.4", "@esbuild/openharmony-arm64": "0.27.4", "@esbuild/sunos-x64": "0.27.4", "@esbuild/win32-arm64": "0.27.4", "@esbuild/win32-ia32": "0.27.4", "@esbuild/win32-x64": "0.27.4" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-Rq4vbHnYkK5fws5NF7MYTU68FPRE1ajX7heQ/8QXXWqNgqqJ/GkmmyxIzUnf2Sr/bakf8l54716CcMGHYhMrrQ=="], - "type-is/mime-types": ["mime-types@2.1.35", "", { "dependencies": { "mime-db": "1.52.0" } }, "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw=="], "typechain/fs-extra": ["fs-extra@7.0.1", "", { "dependencies": { "graceful-fs": "^4.1.2", "jsonfile": "^4.0.0", "universalify": "^0.1.0" } }, "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw=="], @@ -5446,20 +5292,16 @@ "unstorage/chokidar": ["chokidar@5.0.0", "", { "dependencies": { "readdirp": "^5.0.0" } }, "sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw=="], - "unstorage/lru-cache": ["lru-cache@11.2.7", "", {}, "sha512-aY/R+aEsRelme17KGQa/1ZSIpLpNYYrhcrepKTZgE+W3WM16YMCaPwOHLHsmopZHELU0Ojin1lPVxKR0MihncA=="], + "unstorage/lru-cache": ["lru-cache@11.5.1", "", {}, "sha512-RPimw/7aMdv2oqRrxKwvZXcPfwBrn/JZ2xYcY9Hus/6LaS3VOAKVWKWgNLCFSiOm1ESXinjsDlidVU7JlnCN2A=="], "url/punycode": ["punycode@1.4.1", "", {}, "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ=="], "viem/@scure/bip39": ["@scure/bip39@1.6.0", "", { "dependencies": { "@noble/hashes": "~1.8.0", "@scure/base": "~1.2.5" } }, "sha512-+lF0BbLiJNwVlev4eKelw1WWLaiKXw7sSl8T6FvBlWkdX+94aGJ4o8XjUdlyhTCjd8c+B3KT3JfS8P0bLRNU6A=="], - "viem/ws": ["ws@8.18.3", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg=="], + "viem/ws": ["ws@8.20.1", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-It4dO0K5v//JtTXuPkfEOaI3uUN87iYPnqo/ZzqCoG3g8uhA66QUMs/SrM0YK7/NAu+r4LMh/9dq2A7k+rHs+w=="], "vitest/tinyexec": ["tinyexec@0.3.2", "", {}, "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA=="], - "vortex-backend/@scure/bip39": ["@scure/bip39@1.6.0", "", { "dependencies": { "@noble/hashes": "~1.8.0", "@scure/base": "~1.2.5" } }, "sha512-+lF0BbLiJNwVlev4eKelw1WWLaiKXw7sSl8T6FvBlWkdX+94aGJ4o8XjUdlyhTCjd8c+B3KT3JfS8P0bLRNU6A=="], - - "vortex-frontend/numora-react": ["numora-react@3.0.3", "", {}, "sha512-42wqglFsDZNsYUwy09yBS5Kd1U0ZmBiKFpJDmdzAPnXZd4MmZfRA7NyTMO7uTrpQYCTkc5URJ/l56K1f5ISJWg=="], - "wagmi/use-sync-external-store": ["use-sync-external-store@1.4.0", "", { "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-9WXSPC5fMv61vaupRkCKCxsPxBocVnwakBEkMIHHpkTTg6icbJtg6jzgtLDm4bl3cSHAca52rYWih0k4K3PfHw=="], "wcwidth/defaults": ["defaults@1.0.4", "", { "dependencies": { "clone": "^1.0.2" } }, "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A=="], @@ -5470,9 +5312,11 @@ "web3-eth-accounts/ethereum-cryptography": ["ethereum-cryptography@2.2.1", "", { "dependencies": { "@noble/curves": "1.4.2", "@noble/hashes": "1.4.0", "@scure/bip32": "1.4.0", "@scure/bip39": "1.3.0" } }, "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg=="], + "web3-eth-ens/@adraffy/ens-normalize": ["@adraffy/ens-normalize@1.11.1", "", {}, "sha512-nhCBV3quEgesuf7c7KYfperqSS14T8bYuvJ8PcLJp6znkZpFc0AuW4qBtr8eKVyPPe/8RSr7sglCWPU5eaxwKQ=="], + "web3-providers-http/cross-fetch": ["cross-fetch@4.1.0", "", { "dependencies": { "node-fetch": "^2.7.0" } }, "sha512-uKm5PU+MHTootlWEY+mZ4vvXoCn4fLQxT9dSc1sXVMSFkINTJVN8cAQROpwcKm8bJ/c7rgZVIBWzH5T78sNZZw=="], - "web3-providers-ws/ws": ["ws@8.18.3", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg=="], + "web3-providers-ws/ws": ["ws@8.20.1", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-It4dO0K5v//JtTXuPkfEOaI3uUN87iYPnqo/ZzqCoG3g8uhA66QUMs/SrM0YK7/NAu+r4LMh/9dq2A7k+rHs+w=="], "web3-utils/ethereum-cryptography": ["ethereum-cryptography@2.2.1", "", { "dependencies": { "@noble/curves": "1.4.2", "@noble/hashes": "1.4.0", "@scure/bip32": "1.4.0", "@scure/bip39": "1.3.0" } }, "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg=="], @@ -5488,9 +5332,7 @@ "wrap-ansi/strip-ansi": ["strip-ansi@7.2.0", "", { "dependencies": { "ansi-regex": "^6.2.2" } }, "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w=="], - "@aws-crypto/sha256-browser/@smithy/util-utf8/@smithy/util-buffer-from": ["@smithy/util-buffer-from@2.2.0", "", { "dependencies": { "@smithy/is-array-buffer": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA=="], - - "@aws-crypto/util/@smithy/util-utf8/@smithy/util-buffer-from": ["@smithy/util-buffer-from@2.2.0", "", { "dependencies": { "@smithy/is-array-buffer": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA=="], + "z-schema/commander": ["commander@10.0.1", "", {}, "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug=="], "@base-org/account/ox/@adraffy/ens-normalize": ["@adraffy/ens-normalize@1.11.1", "", {}, "sha512-nhCBV3quEgesuf7c7KYfperqSS14T8bYuvJ8PcLJp6znkZpFc0AuW4qBtr8eKVyPPe/8RSr7sglCWPU5eaxwKQ=="], @@ -5510,7 +5352,7 @@ "@eslint/eslintrc/ajv/json-schema-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="], - "@eslint/eslintrc/minimatch/brace-expansion": ["brace-expansion@1.1.12", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg=="], + "@eslint/eslintrc/minimatch/brace-expansion": ["brace-expansion@1.1.15", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg=="], "@ethereumjs/common/@ethereumjs/util/@ethereumjs/rlp": ["@ethereumjs/rlp@4.0.1", "", { "bin": { "rlp": "bin/rlp" } }, "sha512-tqsQiBQDQdmPWE1xkkBq4rlSW5QZpLOUJ5RJh2/9fug+q9tnUhuZoVLk7s0scUIKTOzEtR72DFBXI4WiZcMpvw=="], @@ -5546,7 +5388,7 @@ "@graphql-tools/url-loader/sync-fetch/node-fetch": ["node-fetch@3.3.2", "", { "dependencies": { "data-uri-to-buffer": "^4.0.0", "fetch-blob": "^3.1.4", "formdata-polyfill": "^4.0.10" } }, "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA=="], - "@humanwhocodes/config-array/minimatch/brace-expansion": ["brace-expansion@1.1.12", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg=="], + "@humanwhocodes/config-array/minimatch/brace-expansion": ["brace-expansion@1.1.15", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg=="], "@isaacs/cliui/string-width/emoji-regex": ["emoji-regex@9.2.2", "", {}, "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="], @@ -5558,23 +5400,21 @@ "@metamask/eth-json-rpc-provider/@metamask/json-rpc-engine/@metamask/utils": ["@metamask/utils@8.5.0", "", { "dependencies": { "@ethereumjs/tx": "^4.2.0", "@metamask/superstruct": "^3.0.0", "@noble/hashes": "^1.3.1", "@scure/base": "^1.1.3", "@types/debug": "^4.1.7", "debug": "^4.3.4", "pony-cause": "^2.1.10", "semver": "^7.5.4", "uuid": "^9.0.1" } }, "sha512-I6bkduevXb72TIM9q2LRO63JSsF9EXduh3sBr9oybNX2hNNpr/j1tEjXrsG0Uabm4MJ1xkGAQEMwifvKZIkyxQ=="], - "@metamask/eth-json-rpc-provider/@metamask/utils/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], - - "@metamask/eth-json-rpc-provider/@metamask/utils/superstruct": ["superstruct@1.0.4", "", {}, "sha512-7JpaAoX2NGyoFlI9NBh66BQXGONc+uE+MRS5i2iOBKuS4e+ccgMDjATgZldkah+33DakBxDHiss9kvUcGAO8UQ=="], + "@metamask/eth-json-rpc-provider/@metamask/utils/semver": ["semver@7.8.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg=="], "@metamask/json-rpc-engine/@metamask/rpc-errors/@metamask/utils": ["@metamask/utils@9.3.0", "", { "dependencies": { "@ethereumjs/tx": "^4.2.0", "@metamask/superstruct": "^3.1.0", "@noble/hashes": "^1.3.1", "@scure/base": "^1.1.3", "@types/debug": "^4.1.7", "debug": "^4.3.4", "pony-cause": "^2.1.10", "semver": "^7.5.4", "uuid": "^9.0.1" } }, "sha512-w8CVbdkDrVXFJbfBSlDfafDR6BAkpDmv1bC1UJVCoVny5tW2RKAdn9i68Xf7asYT4TnUhl/hN4zfUiKQq9II4g=="], - "@metamask/json-rpc-engine/@metamask/utils/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], + "@metamask/json-rpc-engine/@metamask/utils/semver": ["semver@7.8.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg=="], "@metamask/json-rpc-engine/@metamask/utils/uuid": ["uuid@9.0.1", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="], - "@metamask/json-rpc-middleware-stream/@metamask/utils/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], + "@metamask/json-rpc-middleware-stream/@metamask/utils/semver": ["semver@7.8.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg=="], "@metamask/json-rpc-middleware-stream/@metamask/utils/uuid": ["uuid@9.0.1", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="], "@metamask/providers/@metamask/rpc-errors/@metamask/utils": ["@metamask/utils@9.3.0", "", { "dependencies": { "@ethereumjs/tx": "^4.2.0", "@metamask/superstruct": "^3.1.0", "@noble/hashes": "^1.3.1", "@scure/base": "^1.1.3", "@types/debug": "^4.1.7", "debug": "^4.3.4", "pony-cause": "^2.1.10", "semver": "^7.5.4", "uuid": "^9.0.1" } }, "sha512-w8CVbdkDrVXFJbfBSlDfafDR6BAkpDmv1bC1UJVCoVny5tW2RKAdn9i68Xf7asYT4TnUhl/hN4zfUiKQq9II4g=="], - "@metamask/providers/@metamask/utils/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], + "@metamask/providers/@metamask/utils/semver": ["semver@7.8.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg=="], "@metamask/providers/@metamask/utils/uuid": ["uuid@9.0.1", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="], @@ -5606,6 +5446,10 @@ "@reown/appkit/@walletconnect/universal-provider/@walletconnect/utils": ["@walletconnect/utils@2.23.7", "", { "dependencies": { "@msgpack/msgpack": "3.1.3", "@noble/ciphers": "1.3.0", "@noble/curves": "1.9.7", "@noble/hashes": "1.8.0", "@scure/base": "1.2.6", "@walletconnect/jsonrpc-utils": "1.0.8", "@walletconnect/keyvaluestorage": "1.1.1", "@walletconnect/logger": "3.0.2", "@walletconnect/relay-api": "1.0.11", "@walletconnect/relay-auth": "1.1.0", "@walletconnect/safe-json": "1.0.2", "@walletconnect/time": "1.0.2", "@walletconnect/types": "2.23.7", "@walletconnect/window-getters": "1.0.1", "@walletconnect/window-metadata": "1.0.1", "blakejs": "1.2.1", "detect-browser": "5.3.0", "ox": "0.9.3", "uint8arrays": "3.1.1" } }, "sha512-3p38gNrkVcIiQixVrlsWSa66Gjs5PqHOug2TxDgYUVBW5NcKjwQA08GkC6CKBQUfr5iaCtbfy6uZJW1LKSIvWQ=="], + "@rushstack/node-core-library/fs-extra/jsonfile": ["jsonfile@4.0.0", "", { "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg=="], + + "@rushstack/node-core-library/fs-extra/universalify": ["universalify@0.1.2", "", {}, "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg=="], + "@rushstack/node-core-library/semver/lru-cache": ["lru-cache@6.0.0", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA=="], "@sentry/bundler-plugin-core/glob/minimatch": ["minimatch@8.0.7", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-V+1uQNdzybxa14e/p00HZnQNNcTjnRJjDxg2V8wtkjFctq4M7hXFws4oekyTP0Jebeq7QYtpFyOeBAjc88zvYg=="], @@ -5640,19 +5484,13 @@ "@snowbridge/contract-types/ethers/ws": ["ws@8.17.1", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ=="], - "@solana/codecs-numbers/@solana/errors/chalk": ["chalk@5.6.2", "", {}, "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA=="], - - "@solana/web3.js/bs58/base-x": ["base-x@3.0.11", "", { "dependencies": { "safe-buffer": "^5.0.1" } }, "sha512-xz7wQ8xDhdyP7tQxwdteLYeFfS68tSMNCZ/Y37WJ4bhGfKPpqEIlmIyueQHqOyoPhE6xNUqjzRr8ra0eF9VRvA=="], - "@storybook/react-vite/find-up/locate-path": ["locate-path@7.2.0", "", { "dependencies": { "p-locate": "^6.0.0" } }, "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA=="], "@storybook/react-vite/find-up/path-exists": ["path-exists@5.0.0", "", {}, "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ=="], - "@tanstack/router-plugin/chokidar/glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="], - - "@tanstack/router-plugin/chokidar/readdirp": ["readdirp@3.6.0", "", { "dependencies": { "picomatch": "^2.2.1" } }, "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA=="], + "@tanstack/router-plugin/chokidar/readdirp": ["readdirp@5.0.0", "", {}, "sha512-9u/XQ1pvrQtYyMpZe7DXKv2p5CNvyVwzUB6uhLAnQwHMSgKMBR62lc7AHljaeteeHXn11XTAaLLUVZYVZyuRBQ=="], - "@types/minimatch/minimatch/brace-expansion": ["brace-expansion@5.0.5", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-VZznLgtwhn+Mact9tfiwx64fA9erHH/MCXEUfB/0bX/6Fz6ny5EGTXYltMocqg4xFAQZtnO3DHWWXi8RiuN7cQ=="], + "@types/minimatch/minimatch/brace-expansion": ["brace-expansion@5.0.6", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g=="], "@typescript-eslint/utils/eslint-scope/estraverse": ["estraverse@4.3.0", "", {}, "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw=="], @@ -5712,9 +5550,9 @@ "@walletconnect/utils/ox/@scure/bip39": ["@scure/bip39@1.6.0", "", { "dependencies": { "@noble/hashes": "~1.8.0", "@scure/base": "~1.2.5" } }, "sha512-+lF0BbLiJNwVlev4eKelw1WWLaiKXw7sSl8T6FvBlWkdX+94aGJ4o8XjUdlyhTCjd8c+B3KT3JfS8P0bLRNU6A=="], - "body-parser/debug/ms": ["ms@2.0.0", "", {}, "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="], + "@walletconnect/utils/ox/eventemitter3": ["eventemitter3@5.0.1", "", {}, "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA=="], - "borsh/bs58/base-x": ["base-x@3.0.11", "", { "dependencies": { "safe-buffer": "^5.0.1" } }, "sha512-xz7wQ8xDhdyP7tQxwdteLYeFfS68tSMNCZ/Y37WJ4bhGfKPpqEIlmIyueQHqOyoPhE6xNUqjzRr8ra0eF9VRvA=="], + "body-parser/debug/ms": ["ms@2.0.0", "", {}, "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="], "browserify-sign/readable-stream/isarray": ["isarray@1.0.0", "", {}, "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="], @@ -5746,21 +5584,19 @@ "escodegen/optionator/type-check": ["type-check@0.3.2", "", { "dependencies": { "prelude-ls": "~1.1.2" } }, "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg=="], - "eslint-plugin-react/minimatch/brace-expansion": ["brace-expansion@1.1.12", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg=="], + "eslint-plugin-react/minimatch/brace-expansion": ["brace-expansion@1.1.15", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg=="], - "eslint-plugin-storybook/@typescript-eslint/utils/@typescript-eslint/scope-manager": ["@typescript-eslint/scope-manager@8.57.2", "", { "dependencies": { "@typescript-eslint/types": "8.57.2", "@typescript-eslint/visitor-keys": "8.57.2" } }, "sha512-snZKH+W4WbWkrBqj4gUNRIGb/jipDW3qMqVJ4C9rzdFc+wLwruxk+2a5D+uoFcKPAqyqEnSb4l2ULuZf95eSkw=="], + "eslint-plugin-storybook/@typescript-eslint/utils/@typescript-eslint/scope-manager": ["@typescript-eslint/scope-manager@8.60.0", "", { "dependencies": { "@typescript-eslint/types": "8.60.0", "@typescript-eslint/visitor-keys": "8.60.0" } }, "sha512-pFzqhllJMs+jghLQWzV00ds39xLzuyqPSev5pd8f4Ir0rtKR3ZLUB4/4dhjOFighWb9larvtfJvqL+4yKDI3Xw=="], - "eslint-plugin-storybook/@typescript-eslint/utils/@typescript-eslint/types": ["@typescript-eslint/types@8.57.2", "", {}, "sha512-/iZM6FnM4tnx9csuTxspMW4BOSegshwX5oBDznJ7S4WggL7Vczz5d2W11ecc4vRrQMQHXRSxzrCsyG5EsPPTbA=="], + "eslint-plugin-storybook/@typescript-eslint/utils/@typescript-eslint/types": ["@typescript-eslint/types@8.60.0", "", {}, "sha512-AsE7x2XaAK+CVbeih0Fvbn+r1qHxtpLDJ3XUuFcIinT318T90yHMJC+Zgv+jUuDjQQd06HKwxnDu6sz1IcTilA=="], - "eslint-plugin-storybook/@typescript-eslint/utils/@typescript-eslint/typescript-estree": ["@typescript-eslint/typescript-estree@8.57.2", "", { "dependencies": { "@typescript-eslint/project-service": "8.57.2", "@typescript-eslint/tsconfig-utils": "8.57.2", "@typescript-eslint/types": "8.57.2", "@typescript-eslint/visitor-keys": "8.57.2", "debug": "^4.4.3", "minimatch": "^10.2.2", "semver": "^7.7.3", "tinyglobby": "^0.2.15", "ts-api-utils": "^2.4.0" }, "peerDependencies": { "typescript": ">=4.8.4 <6.0.0" } }, "sha512-2MKM+I6g8tJxfSmFKOnHv2t8Sk3T6rF20A1Puk0svLK+uVapDZB/4pfAeB7nE83uAZrU6OxW+HmOd5wHVdXwXA=="], + "eslint-plugin-storybook/@typescript-eslint/utils/@typescript-eslint/typescript-estree": ["@typescript-eslint/typescript-estree@8.60.0", "", { "dependencies": { "@typescript-eslint/project-service": "8.60.0", "@typescript-eslint/tsconfig-utils": "8.60.0", "@typescript-eslint/types": "8.60.0", "@typescript-eslint/visitor-keys": "8.60.0", "debug": "^4.4.3", "minimatch": "^10.2.2", "semver": "^7.7.3", "tinyglobby": "^0.2.15", "ts-api-utils": "^2.5.0" }, "peerDependencies": { "typescript": ">=4.8.4 <6.1.0" } }, "sha512-3AcZNBGMClm6CXDyo8kYvVGT/sx29sS0oBsIb9oZI2gunA4Vm2M3YHzRLPvsUBBsl+yB5FPtltq7gGH0iTlp9g=="], "eslint/ajv/json-schema-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="], - "eslint/minimatch/brace-expansion": ["brace-expansion@1.1.12", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg=="], + "eslint/minimatch/brace-expansion": ["brace-expansion@1.1.15", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg=="], - "eth-block-tracker/@metamask/utils/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], - - "eth-block-tracker/@metamask/utils/superstruct": ["superstruct@1.0.4", "", {}, "sha512-7JpaAoX2NGyoFlI9NBh66BQXGONc+uE+MRS5i2iOBKuS4e+ccgMDjATgZldkah+33DakBxDHiss9kvUcGAO8UQ=="], + "eth-block-tracker/@metamask/utils/semver": ["semver@7.8.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg=="], "eth-gas-reporter/ethers/@ethersproject/address": ["@ethersproject/address@5.8.0", "", { "dependencies": { "@ethersproject/bignumber": "^5.8.0", "@ethersproject/bytes": "^5.8.0", "@ethersproject/keccak256": "^5.8.0", "@ethersproject/logger": "^5.8.0", "@ethersproject/rlp": "^5.8.0" } }, "sha512-GhH/abcC46LJwshoN+uBNoKVFPxUuZm6dA257z0vZkKmU1+t8xTn8oK7B9qrj8W2rFRMch4gbJl6PmVxjxBEBA=="], @@ -5774,6 +5610,8 @@ "express/body-parser/raw-body": ["raw-body@3.0.2", "", { "dependencies": { "bytes": "~3.1.2", "http-errors": "~2.0.1", "iconv-lite": "~0.7.0", "unpipe": "~1.0.0" } }, "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA=="], + "express/type-is/content-type": ["content-type@2.0.0", "", {}, "sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ=="], + "express/type-is/media-typer": ["media-typer@1.1.0", "", {}, "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw=="], "form-data/mime-types/mime-db": ["mime-db@1.52.0", "", {}, "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="], @@ -5786,21 +5624,19 @@ "ghost-testrpc/chalk/supports-color": ["supports-color@5.5.0", "", { "dependencies": { "has-flag": "^3.0.0" } }, "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow=="], - "glob/minimatch/brace-expansion": ["brace-expansion@1.1.12", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg=="], + "glob/minimatch/brace-expansion": ["brace-expansion@1.1.15", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg=="], "globby/glob/minimatch": ["minimatch@3.1.5", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w=="], "graphql-config/@graphql-tools/url-loader/@graphql-tools/executor-graphql-ws": ["@graphql-tools/executor-graphql-ws@3.1.5", "", { "dependencies": { "@graphql-tools/executor-common": "^1.0.6", "@graphql-tools/utils": "^11.0.0", "@whatwg-node/disposablestack": "^0.0.6", "graphql-ws": "^6.0.6", "isows": "^1.0.7", "tslib": "^2.8.1", "ws": "^8.18.3" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-WXRsfwu9AkrORD9nShrd61OwwxeQ5+eXYcABRR3XPONFIS8pWQfDJGGqxql9/227o/s0DV5SIfkBURb5Knzv+A=="], - "graphql-config/@graphql-tools/url-loader/@graphql-tools/executor-http": ["@graphql-tools/executor-http@3.1.1", "", { "dependencies": { "@graphql-hive/signal": "^2.0.0", "@graphql-tools/executor-common": "^1.0.6", "@graphql-tools/utils": "^11.0.0", "@repeaterjs/repeater": "^3.0.4", "@whatwg-node/disposablestack": "^0.0.6", "@whatwg-node/fetch": "^0.10.13", "@whatwg-node/promise-helpers": "^1.3.2", "meros": "^1.3.2", "tslib": "^2.8.1" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-Le57fMdN7nGBp8XddkpGreCzcPGCZ+uHs1kPw/xMKPJMsn/vZUHbWJ0FY0cb0jfE3OVhbMIjjSe/OHlG3Mm3zw=="], - - "graphql-config/@graphql-tools/url-loader/@graphql-tools/wrap": ["@graphql-tools/wrap@11.1.12", "", { "dependencies": { "@graphql-tools/delegate": "^12.0.12", "@graphql-tools/schema": "^10.0.29", "@graphql-tools/utils": "^11.0.0", "@whatwg-node/promise-helpers": "^1.3.2", "tslib": "^2.8.1" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-PJ0tuiGbEOOZAJk2/pTKyzMEbwBncPBfO7Z84tCPzM/CAR4ZlAXbXjaXOw4fdi0ReUDyOG06Z8DGgEQjr68dKw=="], + "graphql-config/@graphql-tools/url-loader/@graphql-tools/executor-http": ["@graphql-tools/executor-http@3.3.0", "", { "dependencies": { "@graphql-hive/signal": "^2.0.0", "@graphql-tools/executor-common": "^1.0.6", "@graphql-tools/utils": "^11.0.0", "@repeaterjs/repeater": "^3.0.4", "@whatwg-node/disposablestack": "^0.0.6", "@whatwg-node/fetch": "^0.10.13", "@whatwg-node/promise-helpers": "^1.3.2", "meros": "^1.3.2", "tslib": "^2.8.1" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-IkKXIjSg9U8MNsQUBVJAXE4+LSxaQ0cs7p5JTALLGDABY1o17vPDRwWALsX81AXD5dY27ihi/+OhGMueW/Fopg=="], - "graphql-config/@graphql-tools/url-loader/@types/ws": ["@types/ws@8.18.1", "", { "dependencies": { "@types/node": "*" } }, "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg=="], + "graphql-config/@graphql-tools/url-loader/@graphql-tools/wrap": ["@graphql-tools/wrap@11.1.15", "", { "dependencies": { "@graphql-tools/delegate": "^12.0.16", "@graphql-tools/schema": "^10.0.29", "@graphql-tools/utils": "^11.0.0", "@whatwg-node/promise-helpers": "^1.3.2", "tslib": "^2.8.1" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-GCMx6l0MPwHVaBMHf29oG8eIrsJ8PBXq9y5DNX9/r9oCpCBfqxfWzcejx4CpO4chA3+yylGOKcAyEbOUgxfI1Q=="], - "graphql-config/@graphql-tools/url-loader/ws": ["ws@8.20.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-sAt8BhgNbzCtgGbt2OxmpuryO63ZoDk/sqaB/znQm94T4fCEsy/yV+7CdC1kJhOU9lboAEU7R3kquuycDoibVA=="], + "graphql-config/@graphql-tools/url-loader/ws": ["ws@8.20.1", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-It4dO0K5v//JtTXuPkfEOaI3uUN87iYPnqo/ZzqCoG3g8uhA66QUMs/SrM0YK7/NAu+r4LMh/9dq2A7k+rHs+w=="], - "graphql-config/minimatch/brace-expansion": ["brace-expansion@5.0.5", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-VZznLgtwhn+Mact9tfiwx64fA9erHH/MCXEUfB/0bX/6Fz6ny5EGTXYltMocqg4xFAQZtnO3DHWWXi8RiuN7cQ=="], + "graphql-config/minimatch/brace-expansion": ["brace-expansion@5.0.6", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g=="], "hardhat/fs-extra/jsonfile": ["jsonfile@4.0.0", "", { "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg=="], @@ -5808,8 +5644,6 @@ "http-basic/concat-stream/readable-stream": ["readable-stream@2.3.8", "", { "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", "isarray": "~1.0.0", "process-nextick-args": "~2.0.0", "safe-buffer": "~5.1.1", "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" } }, "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA=="], - "jayson/@types/ws/@types/node": ["@types/node@22.19.15", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-F0R/h2+dsy5wJAUe3tAU6oqa2qbWY5TpNfL/RGmo1y38hiyO1w3x2jPtt76wmuaJI4DQnOBu21cNXQ2STIUUWg=="], - "js-beautify/nopt/abbrev": ["abbrev@2.0.0", "", {}, "sha512-6/mh1E2u2YgEsCHdY0Yx5oW+61gZU+1vXaoiHHrpKeuRNNgFvS+/jrwHiQhB5apAf5oB7UB7E19ol2R2LKH8hQ=="], "log-update/cli-cursor/restore-cursor": ["restore-cursor@5.1.0", "", { "dependencies": { "onetime": "^7.0.0", "signal-exit": "^4.1.0" } }, "sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA=="], @@ -5838,7 +5672,7 @@ "nodemon/chokidar/readdirp": ["readdirp@3.6.0", "", { "dependencies": { "picomatch": "^2.2.1" } }, "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA=="], - "nodemon/minimatch/brace-expansion": ["brace-expansion@1.1.12", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg=="], + "nodemon/minimatch/brace-expansion": ["brace-expansion@1.1.15", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg=="], "nodemon/supports-color/has-flag": ["has-flag@3.0.0", "", {}, "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw=="], @@ -5854,6 +5688,8 @@ "porto/ox/@scure/bip39": ["@scure/bip39@1.6.0", "", { "dependencies": { "@noble/hashes": "~1.8.0", "@scure/base": "~1.2.5" } }, "sha512-+lF0BbLiJNwVlev4eKelw1WWLaiKXw7sSl8T6FvBlWkdX+94aGJ4o8XjUdlyhTCjd8c+B3KT3JfS8P0bLRNU6A=="], + "porto/ox/eventemitter3": ["eventemitter3@5.0.1", "", {}, "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA=="], + "qrcode/yargs/cliui": ["cliui@6.0.0", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", "wrap-ansi": "^6.2.0" } }, "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ=="], "qrcode/yargs/decamelize": ["decamelize@1.2.0", "", {}, "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA=="], @@ -5864,7 +5700,7 @@ "qrcode/yargs/yargs-parser": ["yargs-parser@18.1.3", "", { "dependencies": { "camelcase": "^5.0.0", "decamelize": "^1.2.0" } }, "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ=="], - "recursive-readdir/minimatch/brace-expansion": ["brace-expansion@1.1.12", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg=="], + "recursive-readdir/minimatch/brace-expansion": ["brace-expansion@1.1.15", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg=="], "rimraf/glob/minimatch": ["minimatch@3.1.5", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w=="], @@ -5902,109 +5738,57 @@ "then-request/form-data/mime-types": ["mime-types@2.1.35", "", { "dependencies": { "mime-db": "1.52.0" } }, "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw=="], - "tsup/esbuild/@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.27.4", "", { "os": "aix", "cpu": "ppc64" }, "sha512-cQPwL2mp2nSmHHJlCyoXgHGhbEPMrEEU5xhkcy3Hs/O7nGZqEpZ2sUtLaL9MORLtDfRvVl2/3PAuEkYZH0Ty8Q=="], - - "tsup/esbuild/@esbuild/android-arm": ["@esbuild/android-arm@0.27.4", "", { "os": "android", "cpu": "arm" }, "sha512-X9bUgvxiC8CHAGKYufLIHGXPJWnr0OCdR0anD2e21vdvgCI8lIfqFbnoeOz7lBjdrAGUhqLZLcQo6MLhTO2DKQ=="], - - "tsup/esbuild/@esbuild/android-arm64": ["@esbuild/android-arm64@0.27.4", "", { "os": "android", "cpu": "arm64" }, "sha512-gdLscB7v75wRfu7QSm/zg6Rx29VLdy9eTr2t44sfTW7CxwAtQghZ4ZnqHk3/ogz7xao0QAgrkradbBzcqFPasw=="], - - "tsup/esbuild/@esbuild/android-x64": ["@esbuild/android-x64@0.27.4", "", { "os": "android", "cpu": "x64" }, "sha512-PzPFnBNVF292sfpfhiyiXCGSn9HZg5BcAz+ivBuSsl6Rk4ga1oEXAamhOXRFyMcjwr2DVtm40G65N3GLeH1Lvw=="], - - "tsup/esbuild/@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.27.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-b7xaGIwdJlht8ZFCvMkpDN6uiSmnxxK56N2GDTMYPr2/gzvfdQN8rTfBsvVKmIVY/X7EM+/hJKEIbbHs9oA4tQ=="], - - "tsup/esbuild/@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.27.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-sR+OiKLwd15nmCdqpXMnuJ9W2kpy0KigzqScqHI3Hqwr7IXxBp3Yva+yJwoqh7rE8V77tdoheRYataNKL4QrPw=="], - - "tsup/esbuild/@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.27.4", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-jnfpKe+p79tCnm4GVav68A7tUFeKQwQyLgESwEAUzyxk/TJr4QdGog9sqWNcUbr/bZt/O/HXouspuQDd9JxFSw=="], - - "tsup/esbuild/@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.27.4", "", { "os": "freebsd", "cpu": "x64" }, "sha512-2kb4ceA/CpfUrIcTUl1wrP/9ad9Atrp5J94Lq69w7UwOMolPIGrfLSvAKJp0RTvkPPyn6CIWrNy13kyLikZRZQ=="], - - "tsup/esbuild/@esbuild/linux-arm": ["@esbuild/linux-arm@0.27.4", "", { "os": "linux", "cpu": "arm" }, "sha512-aBYgcIxX/wd5n2ys0yESGeYMGF+pv6g0DhZr3G1ZG4jMfruU9Tl1i2Z+Wnj9/KjGz1lTLCcorqE2viePZqj4Eg=="], - - "tsup/esbuild/@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.27.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-7nQOttdzVGth1iz57kxg9uCz57dxQLHWxopL6mYuYthohPKEK0vU0C3O21CcBK6KDlkYVcnDXY099HcCDXd9dA=="], - - "tsup/esbuild/@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.27.4", "", { "os": "linux", "cpu": "ia32" }, "sha512-oPtixtAIzgvzYcKBQM/qZ3R+9TEUd1aNJQu0HhGyqtx6oS7qTpvjheIWBbes4+qu1bNlo2V4cbkISr8q6gRBFA=="], - - "tsup/esbuild/@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.27.4", "", { "os": "linux", "cpu": "none" }, "sha512-8mL/vh8qeCoRcFH2nM8wm5uJP+ZcVYGGayMavi8GmRJjuI3g1v6Z7Ni0JJKAJW+m0EtUuARb6Lmp4hMjzCBWzA=="], - - "tsup/esbuild/@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.27.4", "", { "os": "linux", "cpu": "none" }, "sha512-1RdrWFFiiLIW7LQq9Q2NES+HiD4NyT8Itj9AUeCl0IVCA459WnPhREKgwrpaIfTOe+/2rdntisegiPWn/r/aAw=="], - - "tsup/esbuild/@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.27.4", "", { "os": "linux", "cpu": "ppc64" }, "sha512-tLCwNG47l3sd9lpfyx9LAGEGItCUeRCWeAx6x2Jmbav65nAwoPXfewtAdtbtit/pJFLUWOhpv0FpS6GQAmPrHA=="], - - "tsup/esbuild/@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.27.4", "", { "os": "linux", "cpu": "none" }, "sha512-BnASypppbUWyqjd1KIpU4AUBiIhVr6YlHx/cnPgqEkNoVOhHg+YiSVxM1RLfiy4t9cAulbRGTNCKOcqHrEQLIw=="], - - "tsup/esbuild/@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.27.4", "", { "os": "linux", "cpu": "s390x" }, "sha512-+eUqgb/Z7vxVLezG8bVB9SfBie89gMueS+I0xYh2tJdw3vqA/0ImZJ2ROeWwVJN59ihBeZ7Tu92dF/5dy5FttA=="], + "tsup/esbuild/@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.27.7", "", { "os": "aix", "cpu": "ppc64" }, "sha512-EKX3Qwmhz1eMdEJokhALr0YiD0lhQNwDqkPYyPhiSwKrh7/4KRjQc04sZ8db+5DVVnZ1LmbNDI1uAMPEUBnQPg=="], - "tsup/esbuild/@esbuild/linux-x64": ["@esbuild/linux-x64@0.27.4", "", { "os": "linux", "cpu": "x64" }, "sha512-S5qOXrKV8BQEzJPVxAwnryi2+Iq5pB40gTEIT69BQONqR7JH1EPIcQ/Uiv9mCnn05jff9umq/5nqzxlqTOg9NA=="], + "tsup/esbuild/@esbuild/android-arm": ["@esbuild/android-arm@0.27.7", "", { "os": "android", "cpu": "arm" }, "sha512-jbPXvB4Yj2yBV7HUfE2KHe4GJX51QplCN1pGbYjvsyCZbQmies29EoJbkEc+vYuU5o45AfQn37vZlyXy4YJ8RQ=="], - "tsup/esbuild/@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.27.4", "", { "os": "none", "cpu": "arm64" }, "sha512-xHT8X4sb0GS8qTqiwzHqpY00C95DPAq7nAwX35Ie/s+LO9830hrMd3oX0ZMKLvy7vsonee73x0lmcdOVXFzd6Q=="], + "tsup/esbuild/@esbuild/android-arm64": ["@esbuild/android-arm64@0.27.7", "", { "os": "android", "cpu": "arm64" }, "sha512-62dPZHpIXzvChfvfLJow3q5dDtiNMkwiRzPylSCfriLvZeq0a1bWChrGx/BbUbPwOrsWKMn8idSllklzBy+dgQ=="], - "tsup/esbuild/@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.27.4", "", { "os": "none", "cpu": "x64" }, "sha512-RugOvOdXfdyi5Tyv40kgQnI0byv66BFgAqjdgtAKqHoZTbTF2QqfQrFwa7cHEORJf6X2ht+l9ABLMP0dnKYsgg=="], + "tsup/esbuild/@esbuild/android-x64": ["@esbuild/android-x64@0.27.7", "", { "os": "android", "cpu": "x64" }, "sha512-x5VpMODneVDb70PYV2VQOmIUUiBtY3D3mPBG8NxVk5CogneYhkR7MmM3yR/uMdITLrC1ml/NV1rj4bMJuy9MCg=="], - "tsup/esbuild/@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.27.4", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-2MyL3IAaTX+1/qP0O1SwskwcwCoOI4kV2IBX1xYnDDqthmq5ArrW94qSIKCAuRraMgPOmG0RDTA74mzYNQA9ow=="], + "tsup/esbuild/@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.27.7", "", { "os": "darwin", "cpu": "arm64" }, "sha512-5lckdqeuBPlKUwvoCXIgI2D9/ABmPq3Rdp7IfL70393YgaASt7tbju3Ac+ePVi3KDH6N2RqePfHnXkaDtY9fkw=="], - "tsup/esbuild/@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.27.4", "", { "os": "openbsd", "cpu": "x64" }, "sha512-u8fg/jQ5aQDfsnIV6+KwLOf1CmJnfu1ShpwqdwC0uA7ZPwFws55Ngc12vBdeUdnuWoQYx/SOQLGDcdlfXhYmXQ=="], + "tsup/esbuild/@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.27.7", "", { "os": "darwin", "cpu": "x64" }, "sha512-rYnXrKcXuT7Z+WL5K980jVFdvVKhCHhUwid+dDYQpH+qu+TefcomiMAJpIiC2EM3Rjtq0sO3StMV/+3w3MyyqQ=="], - "tsup/esbuild/@esbuild/openharmony-arm64": ["@esbuild/openharmony-arm64@0.27.4", "", { "os": "none", "cpu": "arm64" }, "sha512-JkTZrl6VbyO8lDQO3yv26nNr2RM2yZzNrNHEsj9bm6dOwwu9OYN28CjzZkH57bh4w0I2F7IodpQvUAEd1mbWXg=="], + "tsup/esbuild/@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.27.7", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-B48PqeCsEgOtzME2GbNM2roU29AMTuOIN91dsMO30t+Ydis3z/3Ngoj5hhnsOSSwNzS+6JppqWsuhTp6E82l2w=="], - "tsup/esbuild/@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.27.4", "", { "os": "sunos", "cpu": "x64" }, "sha512-/gOzgaewZJfeJTlsWhvUEmUG4tWEY2Spp5M20INYRg2ZKl9QPO3QEEgPeRtLjEWSW8FilRNacPOg8R1uaYkA6g=="], + "tsup/esbuild/@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.27.7", "", { "os": "freebsd", "cpu": "x64" }, "sha512-jOBDK5XEjA4m5IJK3bpAQF9/Lelu/Z9ZcdhTRLf4cajlB+8VEhFFRjWgfy3M1O4rO2GQ/b2dLwCUGpiF/eATNQ=="], - "tsup/esbuild/@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.27.4", "", { "os": "win32", "cpu": "arm64" }, "sha512-Z9SExBg2y32smoDQdf1HRwHRt6vAHLXcxD2uGgO/v2jK7Y718Ix4ndsbNMU/+1Qiem9OiOdaqitioZwxivhXYg=="], + "tsup/esbuild/@esbuild/linux-arm": ["@esbuild/linux-arm@0.27.7", "", { "os": "linux", "cpu": "arm" }, "sha512-RkT/YXYBTSULo3+af8Ib0ykH8u2MBh57o7q/DAs3lTJlyVQkgQvlrPTnjIzzRPQyavxtPtfg0EopvDyIt0j1rA=="], - "tsup/esbuild/@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.27.4", "", { "os": "win32", "cpu": "ia32" }, "sha512-DAyGLS0Jz5G5iixEbMHi5KdiApqHBWMGzTtMiJ72ZOLhbu/bzxgAe8Ue8CTS3n3HbIUHQz/L51yMdGMeoxXNJw=="], + "tsup/esbuild/@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.27.7", "", { "os": "linux", "cpu": "arm64" }, "sha512-RZPHBoxXuNnPQO9rvjh5jdkRmVizktkT7TCDkDmQ0W2SwHInKCAV95GRuvdSvA7w4VMwfCjUiPwDi0ZO6Nfe9A=="], - "tsup/esbuild/@esbuild/win32-x64": ["@esbuild/win32-x64@0.27.4", "", { "os": "win32", "cpu": "x64" }, "sha512-+knoa0BDoeXgkNvvV1vvbZX4+hizelrkwmGJBdT17t8FNPwG2lKemmuMZlmaNQ3ws3DKKCxpb4zRZEIp3UxFCg=="], + "tsup/esbuild/@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.27.7", "", { "os": "linux", "cpu": "ia32" }, "sha512-GA48aKNkyQDbd3KtkplYWT102C5sn/EZTY4XROkxONgruHPU72l+gW+FfF8tf2cFjeHaRbWpOYa/uRBz/Xq1Pg=="], - "tsx/esbuild/@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.27.4", "", { "os": "aix", "cpu": "ppc64" }, "sha512-cQPwL2mp2nSmHHJlCyoXgHGhbEPMrEEU5xhkcy3Hs/O7nGZqEpZ2sUtLaL9MORLtDfRvVl2/3PAuEkYZH0Ty8Q=="], + "tsup/esbuild/@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.27.7", "", { "os": "linux", "cpu": "none" }, "sha512-a4POruNM2oWsD4WKvBSEKGIiWQF8fZOAsycHOt6JBpZ+JN2n2JH9WAv56SOyu9X5IqAjqSIPTaJkqN8F7XOQ5Q=="], - "tsx/esbuild/@esbuild/android-arm": ["@esbuild/android-arm@0.27.4", "", { "os": "android", "cpu": "arm" }, "sha512-X9bUgvxiC8CHAGKYufLIHGXPJWnr0OCdR0anD2e21vdvgCI8lIfqFbnoeOz7lBjdrAGUhqLZLcQo6MLhTO2DKQ=="], + "tsup/esbuild/@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.27.7", "", { "os": "linux", "cpu": "none" }, "sha512-KabT5I6StirGfIz0FMgl1I+R1H73Gp0ofL9A3nG3i/cYFJzKHhouBV5VWK1CSgKvVaG4q1RNpCTR2LuTVB3fIw=="], - "tsx/esbuild/@esbuild/android-arm64": ["@esbuild/android-arm64@0.27.4", "", { "os": "android", "cpu": "arm64" }, "sha512-gdLscB7v75wRfu7QSm/zg6Rx29VLdy9eTr2t44sfTW7CxwAtQghZ4ZnqHk3/ogz7xao0QAgrkradbBzcqFPasw=="], + "tsup/esbuild/@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.27.7", "", { "os": "linux", "cpu": "ppc64" }, "sha512-gRsL4x6wsGHGRqhtI+ifpN/vpOFTQtnbsupUF5R5YTAg+y/lKelYR1hXbnBdzDjGbMYjVJLJTd2OFmMewAgwlQ=="], - "tsx/esbuild/@esbuild/android-x64": ["@esbuild/android-x64@0.27.4", "", { "os": "android", "cpu": "x64" }, "sha512-PzPFnBNVF292sfpfhiyiXCGSn9HZg5BcAz+ivBuSsl6Rk4ga1oEXAamhOXRFyMcjwr2DVtm40G65N3GLeH1Lvw=="], + "tsup/esbuild/@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.27.7", "", { "os": "linux", "cpu": "none" }, "sha512-hL25LbxO1QOngGzu2U5xeXtxXcW+/GvMN3ejANqXkxZ/opySAZMrc+9LY/WyjAan41unrR3YrmtTsUpwT66InQ=="], - "tsx/esbuild/@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.27.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-b7xaGIwdJlht8ZFCvMkpDN6uiSmnxxK56N2GDTMYPr2/gzvfdQN8rTfBsvVKmIVY/X7EM+/hJKEIbbHs9oA4tQ=="], + "tsup/esbuild/@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.27.7", "", { "os": "linux", "cpu": "s390x" }, "sha512-2k8go8Ycu1Kb46vEelhu1vqEP+UeRVj2zY1pSuPdgvbd5ykAw82Lrro28vXUrRmzEsUV0NzCf54yARIK8r0fdw=="], - "tsx/esbuild/@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.27.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-sR+OiKLwd15nmCdqpXMnuJ9W2kpy0KigzqScqHI3Hqwr7IXxBp3Yva+yJwoqh7rE8V77tdoheRYataNKL4QrPw=="], + "tsup/esbuild/@esbuild/linux-x64": ["@esbuild/linux-x64@0.27.7", "", { "os": "linux", "cpu": "x64" }, "sha512-hzznmADPt+OmsYzw1EE33ccA+HPdIqiCRq7cQeL1Jlq2gb1+OyWBkMCrYGBJ+sxVzve2ZJEVeePbLM2iEIZSxA=="], - "tsx/esbuild/@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.27.4", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-jnfpKe+p79tCnm4GVav68A7tUFeKQwQyLgESwEAUzyxk/TJr4QdGog9sqWNcUbr/bZt/O/HXouspuQDd9JxFSw=="], + "tsup/esbuild/@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.27.7", "", { "os": "none", "cpu": "arm64" }, "sha512-b6pqtrQdigZBwZxAn1UpazEisvwaIDvdbMbmrly7cDTMFnw/+3lVxxCTGOrkPVnsYIosJJXAsILG9XcQS+Yu6w=="], - "tsx/esbuild/@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.27.4", "", { "os": "freebsd", "cpu": "x64" }, "sha512-2kb4ceA/CpfUrIcTUl1wrP/9ad9Atrp5J94Lq69w7UwOMolPIGrfLSvAKJp0RTvkPPyn6CIWrNy13kyLikZRZQ=="], + "tsup/esbuild/@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.27.7", "", { "os": "none", "cpu": "x64" }, "sha512-OfatkLojr6U+WN5EDYuoQhtM+1xco+/6FSzJJnuWiUw5eVcicbyK3dq5EeV/QHT1uy6GoDhGbFpprUiHUYggrw=="], - "tsx/esbuild/@esbuild/linux-arm": ["@esbuild/linux-arm@0.27.4", "", { "os": "linux", "cpu": "arm" }, "sha512-aBYgcIxX/wd5n2ys0yESGeYMGF+pv6g0DhZr3G1ZG4jMfruU9Tl1i2Z+Wnj9/KjGz1lTLCcorqE2viePZqj4Eg=="], + "tsup/esbuild/@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.27.7", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-AFuojMQTxAz75Fo8idVcqoQWEHIXFRbOc1TrVcFSgCZtQfSdc1RXgB3tjOn/krRHENUB4j00bfGjyl2mJrU37A=="], - "tsx/esbuild/@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.27.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-7nQOttdzVGth1iz57kxg9uCz57dxQLHWxopL6mYuYthohPKEK0vU0C3O21CcBK6KDlkYVcnDXY099HcCDXd9dA=="], + "tsup/esbuild/@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.27.7", "", { "os": "openbsd", "cpu": "x64" }, "sha512-+A1NJmfM8WNDv5CLVQYJ5PshuRm/4cI6WMZRg1by1GwPIQPCTs1GLEUHwiiQGT5zDdyLiRM/l1G0Pv54gvtKIg=="], - "tsx/esbuild/@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.27.4", "", { "os": "linux", "cpu": "ia32" }, "sha512-oPtixtAIzgvzYcKBQM/qZ3R+9TEUd1aNJQu0HhGyqtx6oS7qTpvjheIWBbes4+qu1bNlo2V4cbkISr8q6gRBFA=="], + "tsup/esbuild/@esbuild/openharmony-arm64": ["@esbuild/openharmony-arm64@0.27.7", "", { "os": "none", "cpu": "arm64" }, "sha512-+KrvYb/C8zA9CU/g0sR6w2RBw7IGc5J2BPnc3dYc5VJxHCSF1yNMxTV5LQ7GuKteQXZtspjFbiuW5/dOj7H4Yw=="], - "tsx/esbuild/@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.27.4", "", { "os": "linux", "cpu": "none" }, "sha512-8mL/vh8qeCoRcFH2nM8wm5uJP+ZcVYGGayMavi8GmRJjuI3g1v6Z7Ni0JJKAJW+m0EtUuARb6Lmp4hMjzCBWzA=="], + "tsup/esbuild/@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.27.7", "", { "os": "sunos", "cpu": "x64" }, "sha512-ikktIhFBzQNt/QDyOL580ti9+5mL/YZeUPKU2ivGtGjdTYoqz6jObj6nOMfhASpS4GU4Q/Clh1QtxWAvcYKamA=="], - "tsx/esbuild/@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.27.4", "", { "os": "linux", "cpu": "none" }, "sha512-1RdrWFFiiLIW7LQq9Q2NES+HiD4NyT8Itj9AUeCl0IVCA459WnPhREKgwrpaIfTOe+/2rdntisegiPWn/r/aAw=="], + "tsup/esbuild/@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.27.7", "", { "os": "win32", "cpu": "arm64" }, "sha512-7yRhbHvPqSpRUV7Q20VuDwbjW5kIMwTHpptuUzV+AA46kiPze5Z7qgt6CLCK3pWFrHeNfDd1VKgyP4O+ng17CA=="], - "tsx/esbuild/@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.27.4", "", { "os": "linux", "cpu": "ppc64" }, "sha512-tLCwNG47l3sd9lpfyx9LAGEGItCUeRCWeAx6x2Jmbav65nAwoPXfewtAdtbtit/pJFLUWOhpv0FpS6GQAmPrHA=="], + "tsup/esbuild/@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.27.7", "", { "os": "win32", "cpu": "ia32" }, "sha512-SmwKXe6VHIyZYbBLJrhOoCJRB/Z1tckzmgTLfFYOfpMAx63BJEaL9ExI8x7v0oAO3Zh6D/Oi1gVxEYr5oUCFhw=="], - "tsx/esbuild/@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.27.4", "", { "os": "linux", "cpu": "none" }, "sha512-BnASypppbUWyqjd1KIpU4AUBiIhVr6YlHx/cnPgqEkNoVOhHg+YiSVxM1RLfiy4t9cAulbRGTNCKOcqHrEQLIw=="], - - "tsx/esbuild/@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.27.4", "", { "os": "linux", "cpu": "s390x" }, "sha512-+eUqgb/Z7vxVLezG8bVB9SfBie89gMueS+I0xYh2tJdw3vqA/0ImZJ2ROeWwVJN59ihBeZ7Tu92dF/5dy5FttA=="], - - "tsx/esbuild/@esbuild/linux-x64": ["@esbuild/linux-x64@0.27.4", "", { "os": "linux", "cpu": "x64" }, "sha512-S5qOXrKV8BQEzJPVxAwnryi2+Iq5pB40gTEIT69BQONqR7JH1EPIcQ/Uiv9mCnn05jff9umq/5nqzxlqTOg9NA=="], - - "tsx/esbuild/@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.27.4", "", { "os": "none", "cpu": "arm64" }, "sha512-xHT8X4sb0GS8qTqiwzHqpY00C95DPAq7nAwX35Ie/s+LO9830hrMd3oX0ZMKLvy7vsonee73x0lmcdOVXFzd6Q=="], - - "tsx/esbuild/@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.27.4", "", { "os": "none", "cpu": "x64" }, "sha512-RugOvOdXfdyi5Tyv40kgQnI0byv66BFgAqjdgtAKqHoZTbTF2QqfQrFwa7cHEORJf6X2ht+l9ABLMP0dnKYsgg=="], - - "tsx/esbuild/@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.27.4", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-2MyL3IAaTX+1/qP0O1SwskwcwCoOI4kV2IBX1xYnDDqthmq5ArrW94qSIKCAuRraMgPOmG0RDTA74mzYNQA9ow=="], - - "tsx/esbuild/@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.27.4", "", { "os": "openbsd", "cpu": "x64" }, "sha512-u8fg/jQ5aQDfsnIV6+KwLOf1CmJnfu1ShpwqdwC0uA7ZPwFws55Ngc12vBdeUdnuWoQYx/SOQLGDcdlfXhYmXQ=="], - - "tsx/esbuild/@esbuild/openharmony-arm64": ["@esbuild/openharmony-arm64@0.27.4", "", { "os": "none", "cpu": "arm64" }, "sha512-JkTZrl6VbyO8lDQO3yv26nNr2RM2yZzNrNHEsj9bm6dOwwu9OYN28CjzZkH57bh4w0I2F7IodpQvUAEd1mbWXg=="], - - "tsx/esbuild/@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.27.4", "", { "os": "sunos", "cpu": "x64" }, "sha512-/gOzgaewZJfeJTlsWhvUEmUG4tWEY2Spp5M20INYRg2ZKl9QPO3QEEgPeRtLjEWSW8FilRNacPOg8R1uaYkA6g=="], - - "tsx/esbuild/@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.27.4", "", { "os": "win32", "cpu": "arm64" }, "sha512-Z9SExBg2y32smoDQdf1HRwHRt6vAHLXcxD2uGgO/v2jK7Y718Ix4ndsbNMU/+1Qiem9OiOdaqitioZwxivhXYg=="], - - "tsx/esbuild/@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.27.4", "", { "os": "win32", "cpu": "ia32" }, "sha512-DAyGLS0Jz5G5iixEbMHi5KdiApqHBWMGzTtMiJ72ZOLhbu/bzxgAe8Ue8CTS3n3HbIUHQz/L51yMdGMeoxXNJw=="], - - "tsx/esbuild/@esbuild/win32-x64": ["@esbuild/win32-x64@0.27.4", "", { "os": "win32", "cpu": "x64" }, "sha512-+knoa0BDoeXgkNvvV1vvbZX4+hizelrkwmGJBdT17t8FNPwG2lKemmuMZlmaNQ3ws3DKKCxpb4zRZEIp3UxFCg=="], + "tsup/esbuild/@esbuild/win32-x64": ["@esbuild/win32-x64@0.27.7", "", { "os": "win32", "cpu": "x64" }, "sha512-56hiAJPhwQ1R4i+21FVF7V8kSD5zZTdHcVuRFMW0hn753vVfQN8xlx4uOPT4xoGH0Z/oVATuR82AiqSTDIpaHg=="], "type-is/mime-types/mime-db": ["mime-db@1.52.0", "", {}, "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="], @@ -6016,8 +5800,6 @@ "wcwidth/defaults/clone": ["clone@1.0.4", "", {}, "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg=="], - "web3-eth-abi/abitype/zod": ["zod@3.25.76", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="], - "web3-eth-accounts/ethereum-cryptography/@noble/curves": ["@noble/curves@1.4.2", "", { "dependencies": { "@noble/hashes": "1.4.0" } }, "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw=="], "web3-eth-accounts/ethereum-cryptography/@noble/hashes": ["@noble/hashes@1.4.0", "", {}, "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg=="], @@ -6046,10 +5828,6 @@ "wrap-ansi/strip-ansi/ansi-regex": ["ansi-regex@6.2.2", "", {}, "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg=="], - "@aws-crypto/sha256-browser/@smithy/util-utf8/@smithy/util-buffer-from/@smithy/is-array-buffer": ["@smithy/is-array-buffer@2.2.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA=="], - - "@aws-crypto/util/@smithy/util-utf8/@smithy/util-buffer-from/@smithy/is-array-buffer": ["@smithy/is-array-buffer@2.2.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA=="], - "@ethereumjs/common/@ethereumjs/util/ethereum-cryptography/@noble/curves": ["@noble/curves@1.4.2", "", { "dependencies": { "@noble/hashes": "1.4.0" } }, "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw=="], "@ethereumjs/common/@ethereumjs/util/ethereum-cryptography/@noble/hashes": ["@noble/hashes@1.4.0", "", {}, "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg=="], @@ -6074,15 +5852,15 @@ "@metamask/eth-json-rpc-provider/@metamask/json-rpc-engine/@metamask/rpc-errors/@metamask/utils": ["@metamask/utils@9.3.0", "", { "dependencies": { "@ethereumjs/tx": "^4.2.0", "@metamask/superstruct": "^3.1.0", "@noble/hashes": "^1.3.1", "@scure/base": "^1.1.3", "@types/debug": "^4.1.7", "debug": "^4.3.4", "pony-cause": "^2.1.10", "semver": "^7.5.4", "uuid": "^9.0.1" } }, "sha512-w8CVbdkDrVXFJbfBSlDfafDR6BAkpDmv1bC1UJVCoVny5tW2RKAdn9i68Xf7asYT4TnUhl/hN4zfUiKQq9II4g=="], - "@metamask/eth-json-rpc-provider/@metamask/json-rpc-engine/@metamask/utils/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], + "@metamask/eth-json-rpc-provider/@metamask/json-rpc-engine/@metamask/utils/semver": ["semver@7.8.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg=="], "@metamask/eth-json-rpc-provider/@metamask/json-rpc-engine/@metamask/utils/uuid": ["uuid@9.0.1", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="], - "@metamask/json-rpc-engine/@metamask/rpc-errors/@metamask/utils/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], + "@metamask/json-rpc-engine/@metamask/rpc-errors/@metamask/utils/semver": ["semver@7.8.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg=="], "@metamask/json-rpc-engine/@metamask/rpc-errors/@metamask/utils/uuid": ["uuid@9.0.1", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="], - "@metamask/providers/@metamask/rpc-errors/@metamask/utils/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], + "@metamask/providers/@metamask/rpc-errors/@metamask/utils/semver": ["semver@7.8.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg=="], "@metamask/providers/@metamask/rpc-errors/@metamask/utils/uuid": ["uuid@9.0.1", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="], @@ -6126,8 +5904,6 @@ "@storybook/react-vite/find-up/locate-path/p-locate": ["p-locate@6.0.0", "", { "dependencies": { "p-limit": "^4.0.0" } }, "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw=="], - "@tanstack/router-plugin/chokidar/readdirp/picomatch": ["picomatch@2.3.2", "", {}, "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA=="], - "@types/minimatch/minimatch/brace-expansion/balanced-match": ["balanced-match@4.0.4", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="], "@walletconnect/ethereum-provider/@reown/appkit/@reown/appkit-utils/@walletconnect/logger": ["@walletconnect/logger@2.1.2", "", { "dependencies": { "@walletconnect/safe-json": "^1.0.2", "pino": "7.11.0" } }, "sha512-aAb28I3S6pYXZHQm5ESB+V6rDqIYfsnHaQyzFbwUUBFY4H0OXx/YtTl8lvhUNhMMfb9UxbwEBS253TlXUYJWSw=="], @@ -6168,19 +5944,19 @@ "command-line-usage/chalk/supports-color/has-flag": ["has-flag@3.0.0", "", {}, "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw=="], - "eslint-plugin-storybook/@typescript-eslint/utils/@typescript-eslint/scope-manager/@typescript-eslint/visitor-keys": ["@typescript-eslint/visitor-keys@8.57.2", "", { "dependencies": { "@typescript-eslint/types": "8.57.2", "eslint-visitor-keys": "^5.0.0" } }, "sha512-zhahknjobV2FiD6Ee9iLbS7OV9zi10rG26odsQdfBO/hjSzUQbkIYgda+iNKK1zNiW2ey+Lf8MU5btN17V3dUw=="], + "eslint-plugin-storybook/@typescript-eslint/utils/@typescript-eslint/scope-manager/@typescript-eslint/visitor-keys": ["@typescript-eslint/visitor-keys@8.60.0", "", { "dependencies": { "@typescript-eslint/types": "8.60.0", "eslint-visitor-keys": "^5.0.0" } }, "sha512-9WI52t8ZGLVGrPMBet25yAftqY/n95+zmoUUtJBBQTKDSKUu7OsPTroT2op7U9JatkoRccL0YkWDNMFfC4Sjxg=="], - "eslint-plugin-storybook/@typescript-eslint/utils/@typescript-eslint/typescript-estree/@typescript-eslint/visitor-keys": ["@typescript-eslint/visitor-keys@8.57.2", "", { "dependencies": { "@typescript-eslint/types": "8.57.2", "eslint-visitor-keys": "^5.0.0" } }, "sha512-zhahknjobV2FiD6Ee9iLbS7OV9zi10rG26odsQdfBO/hjSzUQbkIYgda+iNKK1zNiW2ey+Lf8MU5btN17V3dUw=="], + "eslint-plugin-storybook/@typescript-eslint/utils/@typescript-eslint/typescript-estree/@typescript-eslint/visitor-keys": ["@typescript-eslint/visitor-keys@8.60.0", "", { "dependencies": { "@typescript-eslint/types": "8.60.0", "eslint-visitor-keys": "^5.0.0" } }, "sha512-9WI52t8ZGLVGrPMBet25yAftqY/n95+zmoUUtJBBQTKDSKUu7OsPTroT2op7U9JatkoRccL0YkWDNMFfC4Sjxg=="], - "eslint-plugin-storybook/@typescript-eslint/utils/@typescript-eslint/typescript-estree/minimatch": ["minimatch@10.2.4", "", { "dependencies": { "brace-expansion": "^5.0.2" } }, "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg=="], + "eslint-plugin-storybook/@typescript-eslint/utils/@typescript-eslint/typescript-estree/minimatch": ["minimatch@10.2.5", "", { "dependencies": { "brace-expansion": "^5.0.5" } }, "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg=="], - "eslint-plugin-storybook/@typescript-eslint/utils/@typescript-eslint/typescript-estree/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], + "eslint-plugin-storybook/@typescript-eslint/utils/@typescript-eslint/typescript-estree/semver": ["semver@7.8.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg=="], "ghost-testrpc/chalk/ansi-styles/color-convert": ["color-convert@1.9.3", "", { "dependencies": { "color-name": "1.1.3" } }, "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg=="], "ghost-testrpc/chalk/supports-color/has-flag": ["has-flag@3.0.0", "", {}, "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw=="], - "globby/glob/minimatch/brace-expansion": ["brace-expansion@1.1.12", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg=="], + "globby/glob/minimatch/brace-expansion": ["brace-expansion@1.1.15", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg=="], "graphql-config/@graphql-tools/url-loader/@graphql-tools/executor-graphql-ws/@graphql-tools/executor-common": ["@graphql-tools/executor-common@1.0.6", "", { "dependencies": { "@envelop/core": "^5.4.0", "@graphql-tools/utils": "^11.0.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-23/K5C+LSlHDI0mj2SwCJ33RcELCcyDUgABm1Z8St7u/4Z5+95i925H/NAjUyggRjiaY8vYtNiMOPE49aPX1sg=="], @@ -6188,7 +5964,7 @@ "graphql-config/@graphql-tools/url-loader/@graphql-tools/executor-http/@graphql-tools/executor-common": ["@graphql-tools/executor-common@1.0.6", "", { "dependencies": { "@envelop/core": "^5.4.0", "@graphql-tools/utils": "^11.0.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-23/K5C+LSlHDI0mj2SwCJ33RcELCcyDUgABm1Z8St7u/4Z5+95i925H/NAjUyggRjiaY8vYtNiMOPE49aPX1sg=="], - "graphql-config/@graphql-tools/url-loader/@graphql-tools/wrap/@graphql-tools/delegate": ["@graphql-tools/delegate@12.0.12", "", { "dependencies": { "@graphql-tools/batch-execute": "^10.0.7", "@graphql-tools/executor": "^1.4.13", "@graphql-tools/schema": "^10.0.29", "@graphql-tools/utils": "^11.0.0", "@repeaterjs/repeater": "^3.0.6", "@whatwg-node/promise-helpers": "^1.3.2", "dataloader": "^2.2.3", "tslib": "^2.8.1" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-/vgLWhIwm+Mgo5VUOJQj6EOpaxXRQmA7mk8j6/8vBbPi56LoYA/UPRygcpEnm9EuXTspFKCTBil+xqThU3EmqQ=="], + "graphql-config/@graphql-tools/url-loader/@graphql-tools/wrap/@graphql-tools/delegate": ["@graphql-tools/delegate@12.0.16", "", { "dependencies": { "@graphql-tools/batch-execute": "^10.0.8", "@graphql-tools/executor": "^1.4.13", "@graphql-tools/schema": "^10.0.29", "@graphql-tools/utils": "^11.0.0", "@repeaterjs/repeater": "^3.0.6", "@whatwg-node/promise-helpers": "^1.3.2", "dataloader": "^2.2.3", "tslib": "^2.8.1" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-WEJaFwWG82a0VzhfE4sRsaOPjxgCVfn4fOe3ho+r3uIbPYpc7qHpFdu1PLg6meikq6fuW9NJ1J88fEgnWuXDVg=="], "graphql-config/minimatch/brace-expansion/balanced-match": ["balanced-match@4.0.4", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="], @@ -6214,7 +5990,7 @@ "qrcode/yargs/yargs-parser/camelcase": ["camelcase@5.3.1", "", {}, "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="], - "rimraf/glob/minimatch/brace-expansion": ["brace-expansion@1.1.12", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg=="], + "rimraf/glob/minimatch/brace-expansion": ["brace-expansion@1.1.15", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg=="], "ripemd160/hash-base/readable-stream/isarray": ["isarray@1.0.0", "", {}, "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="], @@ -6222,11 +5998,11 @@ "ripemd160/hash-base/readable-stream/string_decoder": ["string_decoder@1.1.1", "", { "dependencies": { "safe-buffer": "~5.1.0" } }, "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg=="], - "sc-istanbul/glob/minimatch/brace-expansion": ["brace-expansion@1.1.12", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg=="], + "sc-istanbul/glob/minimatch/brace-expansion": ["brace-expansion@1.1.15", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg=="], "sequelize-cli/yargs/cliui/wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], - "shelljs/glob/minimatch/brace-expansion": ["brace-expansion@1.1.12", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg=="], + "shelljs/glob/minimatch/brace-expansion": ["brace-expansion@1.1.15", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg=="], "solidity-coverage/chalk/ansi-styles/color-convert": ["color-convert@1.9.3", "", { "dependencies": { "color-name": "1.1.3" } }, "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg=="], @@ -6266,7 +6042,7 @@ "@ethereumjs/common/@ethereumjs/util/ethereum-cryptography/@scure/bip39/@scure/base": ["@scure/base@1.1.9", "", {}, "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg=="], - "@metamask/eth-json-rpc-provider/@metamask/json-rpc-engine/@metamask/rpc-errors/@metamask/utils/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], + "@metamask/eth-json-rpc-provider/@metamask/json-rpc-engine/@metamask/rpc-errors/@metamask/utils/semver": ["semver@7.8.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg=="], "@metamask/eth-json-rpc-provider/@metamask/json-rpc-engine/@metamask/rpc-errors/@metamask/utils/uuid": ["uuid@9.0.1", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="], @@ -6276,24 +6052,32 @@ "@reown/appkit-adapter-wagmi/@walletconnect/universal-provider/@walletconnect/utils/ox/@scure/bip39": ["@scure/bip39@1.6.0", "", { "dependencies": { "@noble/hashes": "~1.8.0", "@scure/base": "~1.2.5" } }, "sha512-+lF0BbLiJNwVlev4eKelw1WWLaiKXw7sSl8T6FvBlWkdX+94aGJ4o8XjUdlyhTCjd8c+B3KT3JfS8P0bLRNU6A=="], + "@reown/appkit-adapter-wagmi/@walletconnect/universal-provider/@walletconnect/utils/ox/eventemitter3": ["eventemitter3@5.0.1", "", {}, "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA=="], + "@reown/appkit-controllers/@walletconnect/universal-provider/@walletconnect/utils/ox/@adraffy/ens-normalize": ["@adraffy/ens-normalize@1.11.1", "", {}, "sha512-nhCBV3quEgesuf7c7KYfperqSS14T8bYuvJ8PcLJp6znkZpFc0AuW4qBtr8eKVyPPe/8RSr7sglCWPU5eaxwKQ=="], "@reown/appkit-controllers/@walletconnect/universal-provider/@walletconnect/utils/ox/@noble/curves": ["@noble/curves@1.9.1", "", { "dependencies": { "@noble/hashes": "1.8.0" } }, "sha512-k11yZxZg+t+gWvBbIswW0yoJlu8cHOC7dhunwOzoWH/mXGBiYyR4YY6hAEK/3EUs4UpB8la1RfdRpeGsFHkWsA=="], "@reown/appkit-controllers/@walletconnect/universal-provider/@walletconnect/utils/ox/@scure/bip39": ["@scure/bip39@1.6.0", "", { "dependencies": { "@noble/hashes": "~1.8.0", "@scure/base": "~1.2.5" } }, "sha512-+lF0BbLiJNwVlev4eKelw1WWLaiKXw7sSl8T6FvBlWkdX+94aGJ4o8XjUdlyhTCjd8c+B3KT3JfS8P0bLRNU6A=="], + "@reown/appkit-controllers/@walletconnect/universal-provider/@walletconnect/utils/ox/eventemitter3": ["eventemitter3@5.0.1", "", {}, "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA=="], + "@reown/appkit-utils/@walletconnect/universal-provider/@walletconnect/utils/ox/@adraffy/ens-normalize": ["@adraffy/ens-normalize@1.11.1", "", {}, "sha512-nhCBV3quEgesuf7c7KYfperqSS14T8bYuvJ8PcLJp6znkZpFc0AuW4qBtr8eKVyPPe/8RSr7sglCWPU5eaxwKQ=="], "@reown/appkit-utils/@walletconnect/universal-provider/@walletconnect/utils/ox/@noble/curves": ["@noble/curves@1.9.1", "", { "dependencies": { "@noble/hashes": "1.8.0" } }, "sha512-k11yZxZg+t+gWvBbIswW0yoJlu8cHOC7dhunwOzoWH/mXGBiYyR4YY6hAEK/3EUs4UpB8la1RfdRpeGsFHkWsA=="], "@reown/appkit-utils/@walletconnect/universal-provider/@walletconnect/utils/ox/@scure/bip39": ["@scure/bip39@1.6.0", "", { "dependencies": { "@noble/hashes": "~1.8.0", "@scure/base": "~1.2.5" } }, "sha512-+lF0BbLiJNwVlev4eKelw1WWLaiKXw7sSl8T6FvBlWkdX+94aGJ4o8XjUdlyhTCjd8c+B3KT3JfS8P0bLRNU6A=="], + "@reown/appkit-utils/@walletconnect/universal-provider/@walletconnect/utils/ox/eventemitter3": ["eventemitter3@5.0.1", "", {}, "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA=="], + "@reown/appkit/@walletconnect/universal-provider/@walletconnect/utils/ox/@adraffy/ens-normalize": ["@adraffy/ens-normalize@1.11.1", "", {}, "sha512-nhCBV3quEgesuf7c7KYfperqSS14T8bYuvJ8PcLJp6znkZpFc0AuW4qBtr8eKVyPPe/8RSr7sglCWPU5eaxwKQ=="], "@reown/appkit/@walletconnect/universal-provider/@walletconnect/utils/ox/@noble/curves": ["@noble/curves@1.9.1", "", { "dependencies": { "@noble/hashes": "1.8.0" } }, "sha512-k11yZxZg+t+gWvBbIswW0yoJlu8cHOC7dhunwOzoWH/mXGBiYyR4YY6hAEK/3EUs4UpB8la1RfdRpeGsFHkWsA=="], "@reown/appkit/@walletconnect/universal-provider/@walletconnect/utils/ox/@scure/bip39": ["@scure/bip39@1.6.0", "", { "dependencies": { "@noble/hashes": "~1.8.0", "@scure/base": "~1.2.5" } }, "sha512-+lF0BbLiJNwVlev4eKelw1WWLaiKXw7sSl8T6FvBlWkdX+94aGJ4o8XjUdlyhTCjd8c+B3KT3JfS8P0bLRNU6A=="], + "@reown/appkit/@walletconnect/universal-provider/@walletconnect/utils/ox/eventemitter3": ["eventemitter3@5.0.1", "", {}, "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA=="], + "@sentry/bundler-plugin-core/unplugin/chokidar/readdirp/picomatch": ["picomatch@2.3.2", "", {}, "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA=="], "@sentry/vite-plugin/unplugin/chokidar/readdirp/picomatch": ["picomatch@2.3.2", "", {}, "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA=="], @@ -6366,11 +6150,11 @@ "eslint-plugin-storybook/@typescript-eslint/utils/@typescript-eslint/typescript-estree/@typescript-eslint/visitor-keys/eslint-visitor-keys": ["eslint-visitor-keys@5.0.1", "", {}, "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA=="], - "eslint-plugin-storybook/@typescript-eslint/utils/@typescript-eslint/typescript-estree/minimatch/brace-expansion": ["brace-expansion@5.0.5", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-VZznLgtwhn+Mact9tfiwx64fA9erHH/MCXEUfB/0bX/6Fz6ny5EGTXYltMocqg4xFAQZtnO3DHWWXi8RiuN7cQ=="], + "eslint-plugin-storybook/@typescript-eslint/utils/@typescript-eslint/typescript-estree/minimatch/brace-expansion": ["brace-expansion@5.0.6", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g=="], "ghost-testrpc/chalk/ansi-styles/color-convert/color-name": ["color-name@1.1.3", "", {}, "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw=="], - "graphql-config/@graphql-tools/url-loader/@graphql-tools/wrap/@graphql-tools/delegate/@graphql-tools/batch-execute": ["@graphql-tools/batch-execute@10.0.7", "", { "dependencies": { "@graphql-tools/utils": "^11.0.0", "@whatwg-node/promise-helpers": "^1.3.2", "dataloader": "^2.2.3", "tslib": "^2.8.1" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-vKo9XUiy2sc5tzMupXoxZbu5afVY/9yJ0+yLrM5Dhh38yHYULf3z9VC1eAwW0kj8pWpOo8d8CV3jpleGwv83PA=="], + "graphql-config/@graphql-tools/url-loader/@graphql-tools/wrap/@graphql-tools/delegate/@graphql-tools/batch-execute": ["@graphql-tools/batch-execute@10.0.8", "", { "dependencies": { "@graphql-tools/utils": "^11.0.0", "@whatwg-node/promise-helpers": "^1.3.2", "dataloader": "^2.2.3", "tslib": "^2.8.1" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-Kobt37qrVTFhX4HUK5/vPgMXFw/5f97AzmAlfmDBSRh/GnoAmLKCb48FrEI3gdeIwZB2fEhVHJyDqsojldnLQA=="], "qrcode/yargs/find-up/locate-path/p-locate": ["p-locate@4.1.0", "", { "dependencies": { "p-limit": "^2.2.0" } }, "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A=="], diff --git a/contracts/relayer/.env.example b/contracts/relayer/.env.example index 841b95081..0160c6969 100644 --- a/contracts/relayer/.env.example +++ b/contracts/relayer/.env.example @@ -1,5 +1,2 @@ -# Polygon Amoy Testnet RPC -AMOY_RPC_URL=https://rpc-amoy.polygon.technology - -# Private key for deployment (DO NOT COMMIT THIS FILE!) +ALCHEMY_API_KEY=your-alchemy PRIVATE_KEY=0x0000000000000000000000000000000000000000000000000000000000000000 diff --git a/contracts/relayer/hardhat.config.ts b/contracts/relayer/hardhat.config.ts index e7dcc85af..a975b166f 100644 --- a/contracts/relayer/hardhat.config.ts +++ b/contracts/relayer/hardhat.config.ts @@ -1,31 +1,52 @@ import { HardhatUserConfig } from "hardhat/config"; import "@nomicfoundation/hardhat-toolbox"; -import "dotenv/config"; +import dotenv from "dotenv"; +import path from "path"; + +dotenv.config({ path: path.resolve(__dirname, ".env") }); + +const RAW_PRIVATE_KEY = process.env.PRIVATE_KEY; +const PRIVATE_KEY = RAW_PRIVATE_KEY ? (RAW_PRIVATE_KEY.startsWith("0x") ? RAW_PRIVATE_KEY : `0x${RAW_PRIVATE_KEY}`) : undefined; const config: HardhatUserConfig = { networks: { amoy: { - accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : [], + accounts: PRIVATE_KEY ? [PRIVATE_KEY] : [], chainId: 80002, url: process.env.AMOY_RPC_URL || "https://rpc-amoy.polygon.technology" }, arbitrum: { - accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : [], + accounts: PRIVATE_KEY ? [PRIVATE_KEY] : [], chainId: 42161, - url: process.env.ARBITRUM_RPC_URL || "https://arb1.arbitrum.io/rpc" + url: process.env.ARBITRUM_RPC_URL || `https://arb-mainnet.g.alchemy.com/v2/${process.env.ALCHEMY_API_KEY || "demo"}` + }, + avalanche: { + accounts: PRIVATE_KEY ? [PRIVATE_KEY] : [], + chainId: 43114, + url: process.env.AVALANCHE_RPC_URL || `https://avax-mainnet.g.alchemy.com/v2/${process.env.ALCHEMY_API_KEY || "demo"}` }, base: { - accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : [], + accounts: PRIVATE_KEY ? [PRIVATE_KEY] : [], chainId: 8453, - url: process.env.BASE_RPC_URL || "https://mainnet.base.org" + url: process.env.BASE_RPC_URL || `https://base-mainnet.g.alchemy.com/v2/${process.env.ALCHEMY_API_KEY || "demo"}` + }, + bsc: { + accounts: PRIVATE_KEY ? [PRIVATE_KEY] : [], + chainId: 56, + url: process.env.BSC_RPC_URL || `https://bnb-mainnet.g.alchemy.com/v2/${process.env.ALCHEMY_API_KEY || "demo"}` + }, + ethereum: { + accounts: PRIVATE_KEY ? [PRIVATE_KEY] : [], + chainId: 1, + url: process.env.ETHEREUM_RPC_URL || `https://eth-mainnet.g.alchemy.com/v2/${process.env.ALCHEMY_API_KEY || "demo"}` }, hardhat: { chainId: 80002 }, polygon: { - accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : [], + accounts: PRIVATE_KEY ? [PRIVATE_KEY] : [], chainId: 137, - url: process.env.POLYGON_RPC_URL || "https://polygon.drpc.org" + url: process.env.POLYGON_RPC_URL || `https://polygon-mainnet.g.alchemy.com/v2/${process.env.ALCHEMY_API_KEY || "demo"}` } }, solidity: { diff --git a/contracts/relayer/ignition/deployments/chain-1/artifacts/TokenRelayer#TokenRelayer.dbg.json b/contracts/relayer/ignition/deployments/chain-1/artifacts/TokenRelayer#TokenRelayer.dbg.json new file mode 100644 index 000000000..14933beb6 --- /dev/null +++ b/contracts/relayer/ignition/deployments/chain-1/artifacts/TokenRelayer#TokenRelayer.dbg.json @@ -0,0 +1,4 @@ +{ + "_format": "hh-sol-dbg-1", + "buildInfo": "../build-info/1f88a3ad5921d6bc8b511a85d672df5a.json" +} diff --git a/contracts/relayer/ignition/deployments/chain-1/artifacts/TokenRelayer#TokenRelayer.json b/contracts/relayer/ignition/deployments/chain-1/artifacts/TokenRelayer#TokenRelayer.json new file mode 100644 index 000000000..007aaf524 --- /dev/null +++ b/contracts/relayer/ignition/deployments/chain-1/artifacts/TokenRelayer#TokenRelayer.json @@ -0,0 +1,454 @@ +{ + "_format": "hh-sol-artifact-1", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_destinationContract", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "ECDSAInvalidSignature", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "length", + "type": "uint256" + } + ], + "name": "ECDSAInvalidSignatureLength", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "ECDSAInvalidSignatureS", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidShortString", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnableInvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "OwnableUnauthorizedAccount", + "type": "error" + }, + { + "inputs": [], + "name": "ReentrancyGuardReentrantCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "SafeERC20FailedOperation", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "str", + "type": "string" + } + ], + "name": "StringTooLong", + "type": "error" + }, + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "ETHWithdrawn", + "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": true, + "internalType": "address", + "name": "signer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RelayerExecuted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "TokenWithdrawn", + "type": "event" + }, + { + "inputs": [], + "name": "destinationContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "permitV", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "permitR", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "permitS", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "payloadData", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "payloadValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "payloadNonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "payloadDeadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "payloadV", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "payloadR", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "payloadS", + "type": "bytes32" + } + ], + "internalType": "struct TokenRelayer.ExecuteParams", + "name": "params", + "type": "tuple" + } + ], + "name": "execute", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "signer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + } + ], + "name": "isExecutionCompleted", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "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": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "usedPayloadNonces", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdrawETH", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdrawToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "bytecode": "0x610180604052348015610010575f5ffd5b50604051611a4d380380611a4d83398101604081905261002f91610294565b604080518082018252600c81526b2a37b5b2b72932b630bcb2b960a11b602080830191909152825180840190935260018352603160f81b9083015290338061009157604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b61009a816101d6565b5060017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00556100ca826001610225565b610120526100d9816002610225565b61014052815160208084019190912060e052815190820120610100524660a05261016560e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b60805250503060c0526001600160a01b0381166101c45760405162461bcd60e51b815260206004820152601360248201527f496e76616c69642064657374696e6174696f6e000000000000000000000000006044820152606401610088565b6001600160a01b03166101605261046b565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f6020835110156102405761023983610257565b9050610251565b8161024b8482610359565b5060ff90505b92915050565b5f5f829050601f81511115610281578260405163305a27a960e01b81526004016100889190610413565b805161028c82610448565b179392505050565b5f602082840312156102a4575f5ffd5b81516001600160a01b03811681146102ba575f5ffd5b9392505050565b634e487b7160e01b5f52604160045260245ffd5b600181811c908216806102e957607f821691505b60208210810361030757634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111561035457805f5260205f20601f840160051c810160208510156103325750805b601f840160051c820191505b81811015610351575f815560010161033e565b50505b505050565b81516001600160401b03811115610372576103726102c1565b6103868161038084546102d5565b8461030d565b6020601f8211600181146103b8575f83156103a15750848201515b5f19600385901b1c1916600184901b178455610351565b5f84815260208120601f198516915b828110156103e757878501518255602094850194600190920191016103c7565b508482101561040457868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b80516020808301519190811015610307575f1960209190910360031b1b16919050565b60805160a05160c05160e0516101005161012051610140516101605161156c6104e15f395f818160d701528181610525015281816105f4015281816109500152610bf801525f610d2d01525f610cfb01525f6111bc01525f61119401525f6110ef01525f61111901525f611143015261156c5ff3fe608060405260043610610092575f3560e01c80639e281a98116100575780639e281a9814610159578063d850124e14610178578063dcb79457146101c1578063f14210a6146101e0578063f2fde38b146101ff575f5ffd5b80632af83bfe1461009d578063715018a6146100b257806375bd6863146100c657806384b0196e146101165780638da5cb5b1461013d575f5ffd5b3661009957005b5f5ffd5b6100b06100ab3660046112dd565b61021e565b005b3480156100bd575f5ffd5b506100b06106ae565b3480156100d1575f5ffd5b506100f97f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b348015610121575f5ffd5b5061012a6106c1565b60405161010d979695949392919061134a565b348015610148575f5ffd5b505f546001600160a01b03166100f9565b348015610164575f5ffd5b506100b06101733660046113fb565b610703565b348015610183575f5ffd5b506101b16101923660046113fb565b600360209081525f928352604080842090915290825290205460ff1681565b604051901515815260200161010d565b3480156101cc575f5ffd5b506101b16101db3660046113fb565b61078b565b3480156101eb575f5ffd5b506100b06101fa366004611423565b6107b8565b34801561020a575f5ffd5b506100b061021936600461143a565b6108a7565b6102266108e1565b5f610237604083016020840161143a565b90506101208201356001600160a01b03821661028a5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21037bbb732b960991b60448201526064015b60405180910390fd5b5f610298602085018561143a565b6001600160a01b0316036102de5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2103a37b5b2b760991b6044820152606401610281565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff161561033e5760405162461bcd60e51b815260206004820152600a602482015269139bdb98d9481d5cd95960b21b6044820152606401610281565b8261014001354211156103855760405162461bcd60e51b815260206004820152600f60248201526e14185e5b1bd85908195e1c1a5c9959608a1b6044820152606401610281565b5f6103ee83610397602087018761143a565b60408701356103a960e0890189611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250505050610100890135876101408b013561090f565b90506001600160a01b038316610421826104106101808801610160890161149d565b876101800135886101a001356109db565b6001600160a01b0316146104655760405162461bcd60e51b815260206004820152600b60248201526a496e76616c69642073696760a81b6044820152606401610281565b83610100013534146104b95760405162461bcd60e51b815260206004820152601c60248201527f496e636f7272656374204554482076616c75652070726f7669646564000000006044820152606401610281565b6001600160a01b0383165f9081526003602090815260408083208584528252909120805460ff19166001179055610520906104f69086018661143a565b846040870135606088013561051160a08a0160808b0161149d565b8960a001358a60c00135610a07565b6105667f00000000000000000000000000000000000000000000000000000000000000006040860135610556602088018861143a565b6001600160a01b03169190610b75565b5f6105b261057760e0870187611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250349250610bf4915050565b9050806105ef5760405162461bcd60e51b815260206004820152600b60248201526a10d85b1b0819985a5b195960aa1b6044820152606401610281565b6106217f00000000000000000000000000000000000000000000000000000000000000005f610556602089018961143a565b61062e602086018661143a565b6001600160a01b0316846001600160a01b03167f78129a649632642d8e9f346c85d9efb70d32d50a36774c4585491a9228bbd350876040013560405161067691815260200190565b60405180910390a3505050506106ab60017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b50565b6106b6610c79565b6106bf5f610ca5565b565b5f6060805f5f5f60606106d2610cf4565b6106da610d26565b604080515f80825260208201909252600f60f81b9b939a50919850469750309650945092509050565b61070b610c79565b61073061071f5f546001600160a01b031690565b6001600160a01b0384169083610d53565b5f546001600160a01b03166001600160a01b0316826001600160a01b03167fa0524ee0fd8662d6c046d199da2a6d3dc49445182cec055873a5bb9c2843c8e08360405161077f91815260200190565b60405180910390a35050565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff165b92915050565b6107c0610c79565b5f80546040516001600160a01b039091169083908381818185875af1925050503d805f811461080a576040519150601f19603f3d011682016040523d82523d5f602084013e61080f565b606091505b50509050806108565760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610281565b5f546001600160a01b03166001600160a01b03167f6148672a948a12b8e0bf92a9338349b9ac890fad62a234abaf0a4da99f62cfcc8360405161089b91815260200190565b60405180910390a25050565b6108af610c79565b6001600160a01b0381166108d857604051631e4fbdf760e01b81525f6004820152602401610281565b6106ab81610ca5565b6108e9610d60565b60027f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b8351602080860191909120604080517ff0543e2024fd0ae16ccb842686c2733758ec65acfd69fb599c05b286f8db8844938101939093526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691840191909152808a1660608401528816608083015260a0820187905260c082015260e08101849052610100810183905261012081018290525f906109cf906101400160405160208183030381529060405280519060200120610da2565b98975050505050505050565b5f5f5f5f6109eb88888888610dce565b9250925092506109fb8282610e96565b50909695505050505050565b60405163d505accf60e01b81526001600160a01b038781166004830152306024830152604482018790526064820186905260ff8516608483015260a4820184905260c4820183905288169063d505accf9060e4015f604051808303815f87803b158015610a72575f5ffd5b505af1925050508015610a83575060015b610b5757604051636eb1769f60e11b81526001600160a01b03878116600483015230602483015286919089169063dd62ed3e90604401602060405180830381865afa158015610ad4573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610af891906114bd565b1015610b575760405162461bcd60e51b815260206004820152602860248201527f5065726d6974206661696c656420616e6420696e73756666696369656e7420616044820152676c6c6f77616e636560c01b6064820152608401610281565b610b6c6001600160a01b038816873088610f52565b50505050505050565b610b818383835f610f8e565b610bef57610b9283835f6001610f8e565b610bba57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b610bc78383836001610f8e565b610bef57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b505050565b5f5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168385604051610c2f91906114d4565b5f6040518083038185875af1925050503d805f8114610c69576040519150601f19603f3d011682016040523d82523d5f602084013e610c6e565b606091505b509095945050505050565b5f546001600160a01b031633146106bf5760405163118cdaa760e01b8152336004820152602401610281565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006001610ff0565b905090565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006002610ff0565b610bc78383836001611099565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00546002036106bf57604051633ee5aeb560e01b815260040160405180910390fd5b5f6107b2610dae6110e3565b8360405161190160f01b8152600281019290925260228201526042902090565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115610e0757505f91506003905082610e8c565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015610e58573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b038116610e8357505f925060019150829050610e8c565b92505f91508190505b9450945094915050565b5f826003811115610ea957610ea96114ea565b03610eb2575050565b6001826003811115610ec657610ec66114ea565b03610ee45760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115610ef857610ef86114ea565b03610f195760405163fce698f760e01b815260048101829052602401610281565b6003826003811115610f2d57610f2d6114ea565b03610f4e576040516335e2f38360e21b815260048101829052602401610281565b5050565b610f6084848484600161120c565b610f8857604051635274afe760e01b81526001600160a01b0385166004820152602401610281565b50505050565b60405163095ea7b360e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f873b113d1516831692505b60405250949350505050565b606060ff831461100a5761100383611279565b90506107b2565b818054611016906114fe565b80601f0160208091040260200160405190810160405280929190818152602001828054611042906114fe565b801561108d5780601f106110645761010080835404028352916020019161108d565b820191905f5260205f20905b81548152906001019060200180831161107057829003601f168201915b505050505090506107b2565b60405163a9059cbb60e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561113b57507f000000000000000000000000000000000000000000000000000000000000000046145b1561116557507f000000000000000000000000000000000000000000000000000000000000000090565b610d21604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b6040516323b872dd60e01b5f8181526001600160a01b038781166004528616602452604485905291602083606481808c5af1925060015f5114831661126857838315161561125c573d5f823e3d81fd5b5f883b113d1516831692505b604052505f60605295945050505050565b60605f611285836112b6565b6040805160208082528183019092529192505f91906020820181803683375050509182525060208101929092525090565b5f60ff8216601f8111156107b257604051632cd44ac360e21b815260040160405180910390fd5b5f602082840312156112ed575f5ffd5b813567ffffffffffffffff811115611303575f5ffd5b82016101c08185031215611315575f5ffd5b9392505050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b60ff60f81b8816815260e060208201525f61136860e083018961131c565b828103604084015261137a818961131c565b606084018890526001600160a01b038716608085015260a0840186905283810360c0850152845180825260208087019350909101905f5b818110156113cf5783518352602093840193909201916001016113b1565b50909b9a5050505050505050505050565b80356001600160a01b03811681146113f6575f5ffd5b919050565b5f5f6040838503121561140c575f5ffd5b611415836113e0565b946020939093013593505050565b5f60208284031215611433575f5ffd5b5035919050565b5f6020828403121561144a575f5ffd5b611315826113e0565b5f5f8335601e19843603018112611468575f5ffd5b83018035915067ffffffffffffffff821115611482575f5ffd5b602001915036819003821315611496575f5ffd5b9250929050565b5f602082840312156114ad575f5ffd5b813560ff81168114611315575f5ffd5b5f602082840312156114cd575f5ffd5b5051919050565b5f82518060208501845e5f920191825250919050565b634e487b7160e01b5f52602160045260245ffd5b600181811c9082168061151257607f821691505b60208210810361153057634e487b7160e01b5f52602260045260245ffd5b5091905056fea26469706673582212209c34db2f6f83af136a5340cce7fe8ef554ea8eb633656fbf9bff3bd731aec40f64736f6c634300081c0033", + "contractName": "TokenRelayer", + "deployedBytecode": "0x608060405260043610610092575f3560e01c80639e281a98116100575780639e281a9814610159578063d850124e14610178578063dcb79457146101c1578063f14210a6146101e0578063f2fde38b146101ff575f5ffd5b80632af83bfe1461009d578063715018a6146100b257806375bd6863146100c657806384b0196e146101165780638da5cb5b1461013d575f5ffd5b3661009957005b5f5ffd5b6100b06100ab3660046112dd565b61021e565b005b3480156100bd575f5ffd5b506100b06106ae565b3480156100d1575f5ffd5b506100f97f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b348015610121575f5ffd5b5061012a6106c1565b60405161010d979695949392919061134a565b348015610148575f5ffd5b505f546001600160a01b03166100f9565b348015610164575f5ffd5b506100b06101733660046113fb565b610703565b348015610183575f5ffd5b506101b16101923660046113fb565b600360209081525f928352604080842090915290825290205460ff1681565b604051901515815260200161010d565b3480156101cc575f5ffd5b506101b16101db3660046113fb565b61078b565b3480156101eb575f5ffd5b506100b06101fa366004611423565b6107b8565b34801561020a575f5ffd5b506100b061021936600461143a565b6108a7565b6102266108e1565b5f610237604083016020840161143a565b90506101208201356001600160a01b03821661028a5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21037bbb732b960991b60448201526064015b60405180910390fd5b5f610298602085018561143a565b6001600160a01b0316036102de5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2103a37b5b2b760991b6044820152606401610281565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff161561033e5760405162461bcd60e51b815260206004820152600a602482015269139bdb98d9481d5cd95960b21b6044820152606401610281565b8261014001354211156103855760405162461bcd60e51b815260206004820152600f60248201526e14185e5b1bd85908195e1c1a5c9959608a1b6044820152606401610281565b5f6103ee83610397602087018761143a565b60408701356103a960e0890189611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250505050610100890135876101408b013561090f565b90506001600160a01b038316610421826104106101808801610160890161149d565b876101800135886101a001356109db565b6001600160a01b0316146104655760405162461bcd60e51b815260206004820152600b60248201526a496e76616c69642073696760a81b6044820152606401610281565b83610100013534146104b95760405162461bcd60e51b815260206004820152601c60248201527f496e636f7272656374204554482076616c75652070726f7669646564000000006044820152606401610281565b6001600160a01b0383165f9081526003602090815260408083208584528252909120805460ff19166001179055610520906104f69086018661143a565b846040870135606088013561051160a08a0160808b0161149d565b8960a001358a60c00135610a07565b6105667f00000000000000000000000000000000000000000000000000000000000000006040860135610556602088018861143a565b6001600160a01b03169190610b75565b5f6105b261057760e0870187611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250349250610bf4915050565b9050806105ef5760405162461bcd60e51b815260206004820152600b60248201526a10d85b1b0819985a5b195960aa1b6044820152606401610281565b6106217f00000000000000000000000000000000000000000000000000000000000000005f610556602089018961143a565b61062e602086018661143a565b6001600160a01b0316846001600160a01b03167f78129a649632642d8e9f346c85d9efb70d32d50a36774c4585491a9228bbd350876040013560405161067691815260200190565b60405180910390a3505050506106ab60017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b50565b6106b6610c79565b6106bf5f610ca5565b565b5f6060805f5f5f60606106d2610cf4565b6106da610d26565b604080515f80825260208201909252600f60f81b9b939a50919850469750309650945092509050565b61070b610c79565b61073061071f5f546001600160a01b031690565b6001600160a01b0384169083610d53565b5f546001600160a01b03166001600160a01b0316826001600160a01b03167fa0524ee0fd8662d6c046d199da2a6d3dc49445182cec055873a5bb9c2843c8e08360405161077f91815260200190565b60405180910390a35050565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff165b92915050565b6107c0610c79565b5f80546040516001600160a01b039091169083908381818185875af1925050503d805f811461080a576040519150601f19603f3d011682016040523d82523d5f602084013e61080f565b606091505b50509050806108565760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610281565b5f546001600160a01b03166001600160a01b03167f6148672a948a12b8e0bf92a9338349b9ac890fad62a234abaf0a4da99f62cfcc8360405161089b91815260200190565b60405180910390a25050565b6108af610c79565b6001600160a01b0381166108d857604051631e4fbdf760e01b81525f6004820152602401610281565b6106ab81610ca5565b6108e9610d60565b60027f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b8351602080860191909120604080517ff0543e2024fd0ae16ccb842686c2733758ec65acfd69fb599c05b286f8db8844938101939093526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691840191909152808a1660608401528816608083015260a0820187905260c082015260e08101849052610100810183905261012081018290525f906109cf906101400160405160208183030381529060405280519060200120610da2565b98975050505050505050565b5f5f5f5f6109eb88888888610dce565b9250925092506109fb8282610e96565b50909695505050505050565b60405163d505accf60e01b81526001600160a01b038781166004830152306024830152604482018790526064820186905260ff8516608483015260a4820184905260c4820183905288169063d505accf9060e4015f604051808303815f87803b158015610a72575f5ffd5b505af1925050508015610a83575060015b610b5757604051636eb1769f60e11b81526001600160a01b03878116600483015230602483015286919089169063dd62ed3e90604401602060405180830381865afa158015610ad4573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610af891906114bd565b1015610b575760405162461bcd60e51b815260206004820152602860248201527f5065726d6974206661696c656420616e6420696e73756666696369656e7420616044820152676c6c6f77616e636560c01b6064820152608401610281565b610b6c6001600160a01b038816873088610f52565b50505050505050565b610b818383835f610f8e565b610bef57610b9283835f6001610f8e565b610bba57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b610bc78383836001610f8e565b610bef57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b505050565b5f5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168385604051610c2f91906114d4565b5f6040518083038185875af1925050503d805f8114610c69576040519150601f19603f3d011682016040523d82523d5f602084013e610c6e565b606091505b509095945050505050565b5f546001600160a01b031633146106bf5760405163118cdaa760e01b8152336004820152602401610281565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006001610ff0565b905090565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006002610ff0565b610bc78383836001611099565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00546002036106bf57604051633ee5aeb560e01b815260040160405180910390fd5b5f6107b2610dae6110e3565b8360405161190160f01b8152600281019290925260228201526042902090565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115610e0757505f91506003905082610e8c565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015610e58573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b038116610e8357505f925060019150829050610e8c565b92505f91508190505b9450945094915050565b5f826003811115610ea957610ea96114ea565b03610eb2575050565b6001826003811115610ec657610ec66114ea565b03610ee45760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115610ef857610ef86114ea565b03610f195760405163fce698f760e01b815260048101829052602401610281565b6003826003811115610f2d57610f2d6114ea565b03610f4e576040516335e2f38360e21b815260048101829052602401610281565b5050565b610f6084848484600161120c565b610f8857604051635274afe760e01b81526001600160a01b0385166004820152602401610281565b50505050565b60405163095ea7b360e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f873b113d1516831692505b60405250949350505050565b606060ff831461100a5761100383611279565b90506107b2565b818054611016906114fe565b80601f0160208091040260200160405190810160405280929190818152602001828054611042906114fe565b801561108d5780601f106110645761010080835404028352916020019161108d565b820191905f5260205f20905b81548152906001019060200180831161107057829003601f168201915b505050505090506107b2565b60405163a9059cbb60e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561113b57507f000000000000000000000000000000000000000000000000000000000000000046145b1561116557507f000000000000000000000000000000000000000000000000000000000000000090565b610d21604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b6040516323b872dd60e01b5f8181526001600160a01b038781166004528616602452604485905291602083606481808c5af1925060015f5114831661126857838315161561125c573d5f823e3d81fd5b5f883b113d1516831692505b604052505f60605295945050505050565b60605f611285836112b6565b6040805160208082528183019092529192505f91906020820181803683375050509182525060208101929092525090565b5f60ff8216601f8111156107b257604051632cd44ac360e21b815260040160405180910390fd5b5f602082840312156112ed575f5ffd5b813567ffffffffffffffff811115611303575f5ffd5b82016101c08185031215611315575f5ffd5b9392505050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b60ff60f81b8816815260e060208201525f61136860e083018961131c565b828103604084015261137a818961131c565b606084018890526001600160a01b038716608085015260a0840186905283810360c0850152845180825260208087019350909101905f5b818110156113cf5783518352602093840193909201916001016113b1565b50909b9a5050505050505050505050565b80356001600160a01b03811681146113f6575f5ffd5b919050565b5f5f6040838503121561140c575f5ffd5b611415836113e0565b946020939093013593505050565b5f60208284031215611433575f5ffd5b5035919050565b5f6020828403121561144a575f5ffd5b611315826113e0565b5f5f8335601e19843603018112611468575f5ffd5b83018035915067ffffffffffffffff821115611482575f5ffd5b602001915036819003821315611496575f5ffd5b9250929050565b5f602082840312156114ad575f5ffd5b813560ff81168114611315575f5ffd5b5f602082840312156114cd575f5ffd5b5051919050565b5f82518060208501845e5f920191825250919050565b634e487b7160e01b5f52602160045260245ffd5b600181811c9082168061151257607f821691505b60208210810361153057634e487b7160e01b5f52602260045260245ffd5b5091905056fea26469706673582212209c34db2f6f83af136a5340cce7fe8ef554ea8eb633656fbf9bff3bd731aec40f64736f6c634300081c0033", + "deployedLinkReferences": {}, + "linkReferences": {}, + "sourceName": "contracts/TokenRelayer.sol" +} diff --git a/contracts/relayer/ignition/deployments/chain-1/build-info/1f88a3ad5921d6bc8b511a85d672df5a.json b/contracts/relayer/ignition/deployments/chain-1/build-info/1f88a3ad5921d6bc8b511a85d672df5a.json new file mode 100644 index 000000000..8b7c007e9 --- /dev/null +++ b/contracts/relayer/ignition/deployments/chain-1/build-info/1f88a3ad5921d6bc8b511a85d672df5a.json @@ -0,0 +1,137942 @@ +{ + "id": "1f88a3ad5921d6bc8b511a85d672df5a", + "_format": "hh-sol-build-info-1", + "solcVersion": "0.8.28", + "solcLongVersion": "0.8.28+commit.7893614a", + "input": { + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)\n\npragma solidity ^0.8.20;\n\nimport {Context} from \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * The initial owner is set to the address provided by the deployer. This can\n * later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n /**\n * @dev The caller account is not authorized to perform an operation.\n */\n error OwnableUnauthorizedAccount(address account);\n\n /**\n * @dev The owner is not a valid owner account. (eg. `address(0)`)\n */\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\n */\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n _transferOwnership(initialOwner);\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC1363.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1363.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC20} from \"./IERC20.sol\";\nimport {IERC165} from \"./IERC165.sol\";\n\n/**\n * @title IERC1363\n * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].\n *\n * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract\n * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.\n */\ninterface IERC1363 is IERC20, IERC165 {\n /*\n * Note: the ERC-165 identifier for this interface is 0xb0202a11.\n * 0xb0202a11 ===\n * bytes4(keccak256('transferAndCall(address,uint256)')) ^\n * bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^\n * bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^\n * bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^\n * bytes4(keccak256('approveAndCall(address,uint256)')) ^\n * bytes4(keccak256('approveAndCall(address,uint256,bytes)'))\n */\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n * @param to The address which you want to transfer to.\n * @param value The amount of tokens to be transferred.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function transferAndCall(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n * @param to The address which you want to transfer to.\n * @param value The amount of tokens to be transferred.\n * @param data Additional data with no specified format, sent in call to `to`.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n * @param from The address which you want to send tokens from.\n * @param to The address which you want to transfer to.\n * @param value The amount of tokens to be transferred.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function transferFromAndCall(address from, address to, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n * @param from The address which you want to send tokens from.\n * @param to The address which you want to transfer to.\n * @param value The amount of tokens to be transferred.\n * @param data Additional data with no specified format, sent in call to `to`.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n * @param spender The address which will spend the funds.\n * @param value The amount of tokens to be spent.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function approveAndCall(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n * @param spender The address which will spend the funds.\n * @param value The amount of tokens to be spent.\n * @param data Additional data with no specified format, sent in call to `spender`.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC165.sol)\n\npragma solidity >=0.4.16;\n\nimport {IERC165} from \"../utils/introspection/IERC165.sol\";\n" + }, + "@openzeppelin/contracts/interfaces/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol)\n\npragma solidity >=0.4.16;\n\nimport {IERC20} from \"../token/ERC20/IERC20.sol\";\n" + }, + "@openzeppelin/contracts/interfaces/IERC5267.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC5267.sol)\n\npragma solidity >=0.4.16;\n\ninterface IERC5267 {\n /**\n * @dev MAY be emitted to signal that the domain could have changed.\n */\n event EIP712DomainChanged();\n\n /**\n * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\n * signature.\n */\n function eip712Domain()\n external\n view\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n );\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity >=0.4.16;\n\n/**\n * @dev Interface of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also applies here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n *\n * CAUTION: See Security Considerations above.\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)\n\npragma solidity >=0.4.16;\n\n/**\n * @dev Interface of the ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\nimport {IERC1363} from \"../../../interfaces/IERC1363.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n if (!_safeTransfer(token, to, value, true)) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n if (!_safeTransferFrom(token, from, to, value, true)) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.\n */\n function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {\n return _safeTransfer(token, to, value, false);\n }\n\n /**\n * @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.\n */\n function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {\n return _safeTransferFrom(token, from, to, value, false);\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n *\n * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the \"client\"\n * smart contract uses ERC-7674 to set temporary allowances, then the \"client\" smart contract should avoid using\n * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract\n * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.\n */\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n forceApprove(token, spender, oldAllowance + value);\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no\n * value, non-reverting calls are assumed to be successful.\n *\n * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the \"client\"\n * smart contract uses ERC-7674 to set temporary allowances, then the \"client\" smart contract should avoid using\n * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract\n * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.\n */\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance < requestedDecrease) {\n revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);\n }\n forceApprove(token, spender, currentAllowance - requestedDecrease);\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n *\n * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function\n * only sets the \"standard\" allowance. Any temporary allowance will remain active, in addition to the value being\n * set here.\n */\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n if (!_safeApprove(token, spender, value, false)) {\n if (!_safeApprove(token, spender, 0, true)) revert SafeERC20FailedOperation(address(token));\n if (!_safeApprove(token, spender, value, true)) revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no\n * code. This can be used to implement an {ERC721}-like safe transfer that relies on {ERC1363} checks when\n * targeting contracts.\n *\n * Reverts if the returned value is other than `true`.\n */\n function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {\n if (to.code.length == 0) {\n safeTransfer(token, to, value);\n } else if (!token.transferAndCall(to, value, data)) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target\n * has no code. This can be used to implement an {ERC721}-like safe transfer that relies on {ERC1363} checks when\n * targeting contracts.\n *\n * Reverts if the returned value is other than `true`.\n */\n function transferFromAndCallRelaxed(\n IERC1363 token,\n address from,\n address to,\n uint256 value,\n bytes memory data\n ) internal {\n if (to.code.length == 0) {\n safeTransferFrom(token, from, to, value);\n } else if (!token.transferFromAndCall(from, to, value, data)) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no\n * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\n * targeting contracts.\n *\n * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.\n * Oppositely, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}\n * once without retrying, and relies on the returned value to be true.\n *\n * Reverts if the returned value is other than `true`.\n */\n function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {\n if (to.code.length == 0) {\n forceApprove(token, to, value);\n } else if (!token.approveAndCall(to, value, data)) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity `token.transfer(to, value)` call, relaxing the requirement on the return value: the\n * return value is optional (but if data is returned, it must not be false).\n *\n * @param token The token targeted by the call.\n * @param to The recipient of the tokens\n * @param value The amount of token to transfer\n * @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.\n */\n function _safeTransfer(IERC20 token, address to, uint256 value, bool bubble) private returns (bool success) {\n bytes4 selector = IERC20.transfer.selector;\n\n assembly (\"memory-safe\") {\n let fmp := mload(0x40)\n mstore(0x00, selector)\n mstore(0x04, and(to, shr(96, not(0))))\n mstore(0x24, value)\n success := call(gas(), token, 0, 0x00, 0x44, 0x00, 0x20)\n // if call success and return is true, all is good.\n // otherwise (not success or return is not true), we need to perform further checks\n if iszero(and(success, eq(mload(0x00), 1))) {\n // if the call was a failure and bubble is enabled, bubble the error\n if and(iszero(success), bubble) {\n returndatacopy(fmp, 0x00, returndatasize())\n revert(fmp, returndatasize())\n }\n // if the return value is not true, then the call is only successful if:\n // - the token address has code\n // - the returndata is empty\n success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))\n }\n mstore(0x40, fmp)\n }\n }\n\n /**\n * @dev Imitates a Solidity `token.transferFrom(from, to, value)` call, relaxing the requirement on the return\n * value: the return value is optional (but if data is returned, it must not be false).\n *\n * @param token The token targeted by the call.\n * @param from The sender of the tokens\n * @param to The recipient of the tokens\n * @param value The amount of token to transfer\n * @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.\n */\n function _safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value,\n bool bubble\n ) private returns (bool success) {\n bytes4 selector = IERC20.transferFrom.selector;\n\n assembly (\"memory-safe\") {\n let fmp := mload(0x40)\n mstore(0x00, selector)\n mstore(0x04, and(from, shr(96, not(0))))\n mstore(0x24, and(to, shr(96, not(0))))\n mstore(0x44, value)\n success := call(gas(), token, 0, 0x00, 0x64, 0x00, 0x20)\n // if call success and return is true, all is good.\n // otherwise (not success or return is not true), we need to perform further checks\n if iszero(and(success, eq(mload(0x00), 1))) {\n // if the call was a failure and bubble is enabled, bubble the error\n if and(iszero(success), bubble) {\n returndatacopy(fmp, 0x00, returndatasize())\n revert(fmp, returndatasize())\n }\n // if the return value is not true, then the call is only successful if:\n // - the token address has code\n // - the returndata is empty\n success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))\n }\n mstore(0x40, fmp)\n mstore(0x60, 0)\n }\n }\n\n /**\n * @dev Imitates a Solidity `token.approve(spender, value)` call, relaxing the requirement on the return value:\n * the return value is optional (but if data is returned, it must not be false).\n *\n * @param token The token targeted by the call.\n * @param spender The spender of the tokens\n * @param value The amount of token to transfer\n * @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.\n */\n function _safeApprove(IERC20 token, address spender, uint256 value, bool bubble) private returns (bool success) {\n bytes4 selector = IERC20.approve.selector;\n\n assembly (\"memory-safe\") {\n let fmp := mload(0x40)\n mstore(0x00, selector)\n mstore(0x04, and(spender, shr(96, not(0))))\n mstore(0x24, value)\n success := call(gas(), token, 0, 0x00, 0x44, 0x00, 0x20)\n // if call success and return is true, all is good.\n // otherwise (not success or return is not true), we need to perform further checks\n if iszero(and(success, eq(mload(0x00), 1))) {\n // if the call was a failure and bubble is enabled, bubble the error\n if and(iszero(success), bubble) {\n returndatacopy(fmp, 0x00, returndatasize())\n revert(fmp, returndatasize())\n }\n // if the return value is not true, then the call is only successful if:\n // - the token address has code\n // - the returndata is empty\n success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))\n }\n mstore(0x40, fmp)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Bytes.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.6.0) (utils/Bytes.sol)\n\npragma solidity ^0.8.24;\n\nimport {Math} from \"./math/Math.sol\";\n\n/**\n * @dev Bytes operations.\n */\nlibrary Bytes {\n /**\n * @dev Forward search for `s` in `buffer`\n * * If `s` is present in the buffer, returns the index of the first instance\n * * If `s` is not present in the buffer, returns type(uint256).max\n *\n * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf[Javascript's `Array.indexOf`]\n */\n function indexOf(bytes memory buffer, bytes1 s) internal pure returns (uint256) {\n return indexOf(buffer, s, 0);\n }\n\n /**\n * @dev Forward search for `s` in `buffer` starting at position `pos`\n * * If `s` is present in the buffer (at or after `pos`), returns the index of the next instance\n * * If `s` is not present in the buffer (at or after `pos`), returns type(uint256).max\n *\n * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf[Javascript's `Array.indexOf`]\n */\n function indexOf(bytes memory buffer, bytes1 s, uint256 pos) internal pure returns (uint256) {\n uint256 length = buffer.length;\n for (uint256 i = pos; i < length; ++i) {\n if (bytes1(_unsafeReadBytesOffset(buffer, i)) == s) {\n return i;\n }\n }\n return type(uint256).max;\n }\n\n /**\n * @dev Backward search for `s` in `buffer`\n * * If `s` is present in the buffer, returns the index of the last instance\n * * If `s` is not present in the buffer, returns type(uint256).max\n *\n * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf[Javascript's `Array.lastIndexOf`]\n */\n function lastIndexOf(bytes memory buffer, bytes1 s) internal pure returns (uint256) {\n return lastIndexOf(buffer, s, type(uint256).max);\n }\n\n /**\n * @dev Backward search for `s` in `buffer` starting at position `pos`\n * * If `s` is present in the buffer (at or before `pos`), returns the index of the previous instance\n * * If `s` is not present in the buffer (at or before `pos`), returns type(uint256).max\n *\n * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf[Javascript's `Array.lastIndexOf`]\n */\n function lastIndexOf(bytes memory buffer, bytes1 s, uint256 pos) internal pure returns (uint256) {\n unchecked {\n uint256 length = buffer.length;\n for (uint256 i = Math.min(Math.saturatingAdd(pos, 1), length); i > 0; --i) {\n if (bytes1(_unsafeReadBytesOffset(buffer, i - 1)) == s) {\n return i - 1;\n }\n }\n return type(uint256).max;\n }\n }\n\n /**\n * @dev Copies the content of `buffer`, from `start` (included) to the end of `buffer` into a new bytes object in\n * memory.\n *\n * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`]\n */\n function slice(bytes memory buffer, uint256 start) internal pure returns (bytes memory) {\n return slice(buffer, start, buffer.length);\n }\n\n /**\n * @dev Copies the content of `buffer`, from `start` (included) to `end` (excluded) into a new bytes object in\n * memory. The `end` argument is truncated to the length of the `buffer`.\n *\n * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`]\n */\n function slice(bytes memory buffer, uint256 start, uint256 end) internal pure returns (bytes memory) {\n // sanitize\n end = Math.min(end, buffer.length);\n start = Math.min(start, end);\n\n // allocate and copy\n bytes memory result = new bytes(end - start);\n assembly (\"memory-safe\") {\n mcopy(add(result, 0x20), add(add(buffer, 0x20), start), sub(end, start))\n }\n\n return result;\n }\n\n /**\n * @dev Moves the content of `buffer`, from `start` (included) to the end of `buffer` to the start of that buffer,\n * and shrinks the buffer length accordingly, effectively overriding the content of buffer with buffer[start:].\n *\n * NOTE: This function modifies the provided buffer in place. If you need to preserve the original buffer, use {slice} instead\n */\n function splice(bytes memory buffer, uint256 start) internal pure returns (bytes memory) {\n return splice(buffer, start, buffer.length);\n }\n\n /**\n * @dev Moves the content of `buffer`, from `start` (included) to `end` (excluded) to the start of that buffer,\n * and shrinks the buffer length accordingly, effectively overriding the content of buffer with buffer[start:end].\n * The `end` argument is truncated to the length of the `buffer`.\n *\n * NOTE: This function modifies the provided buffer in place. If you need to preserve the original buffer, use {slice} instead\n */\n function splice(bytes memory buffer, uint256 start, uint256 end) internal pure returns (bytes memory) {\n // sanitize\n end = Math.min(end, buffer.length);\n start = Math.min(start, end);\n\n // move and resize\n assembly (\"memory-safe\") {\n mcopy(add(buffer, 0x20), add(add(buffer, 0x20), start), sub(end, start))\n mstore(buffer, sub(end, start))\n }\n\n return buffer;\n }\n\n /**\n * @dev Replaces bytes in `buffer` starting at `pos` with all bytes from `replacement`.\n *\n * Parameters are clamped to valid ranges (i.e. `pos` is clamped to `[0, buffer.length]`).\n * If `pos >= buffer.length`, no replacement occurs and the buffer is returned unchanged.\n *\n * NOTE: This function modifies the provided buffer in place.\n */\n function replace(bytes memory buffer, uint256 pos, bytes memory replacement) internal pure returns (bytes memory) {\n return replace(buffer, pos, replacement, 0, replacement.length);\n }\n\n /**\n * @dev Replaces bytes in `buffer` starting at `pos` with bytes from `replacement` starting at `offset`.\n * Copies at most `length` bytes from `replacement` to `buffer`.\n *\n * Parameters are clamped to valid ranges (i.e. `pos` is clamped to `[0, buffer.length]`, `offset` is\n * clamped to `[0, replacement.length]`, and `length` is clamped to `min(length, replacement.length - offset,\n * buffer.length - pos))`. If `pos >= buffer.length` or `offset >= replacement.length`, no replacement occurs\n * and the buffer is returned unchanged.\n *\n * NOTE: This function modifies the provided buffer in place.\n */\n function replace(\n bytes memory buffer,\n uint256 pos,\n bytes memory replacement,\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory) {\n // sanitize\n pos = Math.min(pos, buffer.length);\n offset = Math.min(offset, replacement.length);\n length = Math.min(length, Math.min(replacement.length - offset, buffer.length - pos));\n\n // replace\n assembly (\"memory-safe\") {\n mcopy(add(add(buffer, 0x20), pos), add(add(replacement, 0x20), offset), length)\n }\n\n return buffer;\n }\n\n /**\n * @dev Concatenate an array of bytes into a single bytes object.\n *\n * For fixed bytes types, we recommend using the solidity built-in `bytes.concat` or (equivalent)\n * `abi.encodePacked`.\n *\n * NOTE: this could be done in assembly with a single loop that expands starting at the FMP, but that would be\n * significantly less readable. It might be worth benchmarking the savings of the full-assembly approach.\n */\n function concat(bytes[] memory buffers) internal pure returns (bytes memory) {\n uint256 length = 0;\n for (uint256 i = 0; i < buffers.length; ++i) {\n length += buffers[i].length;\n }\n\n bytes memory result = new bytes(length);\n\n uint256 offset = 0x20;\n for (uint256 i = 0; i < buffers.length; ++i) {\n bytes memory input = buffers[i];\n assembly (\"memory-safe\") {\n mcopy(add(result, offset), add(input, 0x20), mload(input))\n }\n unchecked {\n offset += input.length;\n }\n }\n\n return result;\n }\n\n /**\n * @dev Split each byte in `input` into two nibbles (4 bits each)\n *\n * Example: hex\"01234567\" → hex\"0001020304050607\"\n */\n function toNibbles(bytes memory input) internal pure returns (bytes memory output) {\n assembly (\"memory-safe\") {\n let length := mload(input)\n output := mload(0x40)\n mstore(0x40, add(add(output, 0x20), mul(length, 2)))\n mstore(output, mul(length, 2))\n for {\n let i := 0\n } lt(i, length) {\n i := add(i, 0x10)\n } {\n let chunk := shr(128, mload(add(add(input, 0x20), i)))\n chunk := and(\n 0x0000000000000000ffffffffffffffff0000000000000000ffffffffffffffff,\n or(shl(64, chunk), chunk)\n )\n chunk := and(\n 0x00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff,\n or(shl(32, chunk), chunk)\n )\n chunk := and(\n 0x0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff,\n or(shl(16, chunk), chunk)\n )\n chunk := and(\n 0x00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff,\n or(shl(8, chunk), chunk)\n )\n chunk := and(\n 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f,\n or(shl(4, chunk), chunk)\n )\n mstore(add(add(output, 0x20), mul(i, 2)), chunk)\n }\n }\n }\n\n /**\n * @dev Returns true if the two byte buffers are equal.\n */\n function equal(bytes memory a, bytes memory b) internal pure returns (bool) {\n return a.length == b.length && keccak256(a) == keccak256(b);\n }\n\n /**\n * @dev Reverses the byte order of a bytes32 value, converting between little-endian and big-endian.\n * Inspired by https://graphics.stanford.edu/~seander/bithacks.html#ReverseParallel[Reverse Parallel]\n */\n function reverseBytes32(bytes32 value) internal pure returns (bytes32) {\n value = // swap bytes\n ((value >> 8) & 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF) |\n ((value & 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF) << 8);\n value = // swap 2-byte long pairs\n ((value >> 16) & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) |\n ((value & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) << 16);\n value = // swap 4-byte long pairs\n ((value >> 32) & 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) |\n ((value & 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) << 32);\n value = // swap 8-byte long pairs\n ((value >> 64) & 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) |\n ((value & 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) << 64);\n return (value >> 128) | (value << 128); // swap 16-byte long pairs\n }\n\n /// @dev Same as {reverseBytes32} but optimized for 128-bit values.\n function reverseBytes16(bytes16 value) internal pure returns (bytes16) {\n value = // swap bytes\n ((value & 0xFF00FF00FF00FF00FF00FF00FF00FF00) >> 8) |\n ((value & 0x00FF00FF00FF00FF00FF00FF00FF00FF) << 8);\n value = // swap 2-byte long pairs\n ((value & 0xFFFF0000FFFF0000FFFF0000FFFF0000) >> 16) |\n ((value & 0x0000FFFF0000FFFF0000FFFF0000FFFF) << 16);\n value = // swap 4-byte long pairs\n ((value & 0xFFFFFFFF00000000FFFFFFFF00000000) >> 32) |\n ((value & 0x00000000FFFFFFFF00000000FFFFFFFF) << 32);\n return (value >> 64) | (value << 64); // swap 8-byte long pairs\n }\n\n /// @dev Same as {reverseBytes32} but optimized for 64-bit values.\n function reverseBytes8(bytes8 value) internal pure returns (bytes8) {\n value = ((value & 0xFF00FF00FF00FF00) >> 8) | ((value & 0x00FF00FF00FF00FF) << 8); // swap bytes\n value = ((value & 0xFFFF0000FFFF0000) >> 16) | ((value & 0x0000FFFF0000FFFF) << 16); // swap 2-byte long pairs\n return (value >> 32) | (value << 32); // swap 4-byte long pairs\n }\n\n /// @dev Same as {reverseBytes32} but optimized for 32-bit values.\n function reverseBytes4(bytes4 value) internal pure returns (bytes4) {\n value = ((value & 0xFF00FF00) >> 8) | ((value & 0x00FF00FF) << 8); // swap bytes\n return (value >> 16) | (value << 16); // swap 2-byte long pairs\n }\n\n /// @dev Same as {reverseBytes32} but optimized for 16-bit values.\n function reverseBytes2(bytes2 value) internal pure returns (bytes2) {\n return (value >> 8) | (value << 8);\n }\n\n /**\n * @dev Counts the number of leading zero bits a bytes array. Returns `8 * buffer.length`\n * if the buffer is all zeros.\n */\n function clz(bytes memory buffer) internal pure returns (uint256) {\n for (uint256 i = 0; i < buffer.length; i += 0x20) {\n bytes32 chunk = _unsafeReadBytesOffset(buffer, i);\n if (chunk != bytes32(0)) {\n return Math.min(8 * i + Math.clz(uint256(chunk)), 8 * buffer.length);\n }\n }\n return 8 * buffer.length;\n }\n\n /**\n * @dev Reads a bytes32 from a bytes array without bounds checking.\n *\n * NOTE: making this function internal would mean it could be used with memory unsafe offset, and marking the\n * assembly block as such would prevent some optimizations.\n */\n function _unsafeReadBytesOffset(bytes memory buffer, uint256 offset) private pure returns (bytes32 value) {\n // This is not memory safe in the general case, but all calls to this private function are within bounds.\n assembly (\"memory-safe\") {\n value := mload(add(add(buffer, 0x20), offset))\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.6.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS\n }\n\n /**\n * @dev The signature is invalid.\n */\n error ECDSAInvalidSignature();\n\n /**\n * @dev The signature has an invalid length.\n */\n error ECDSAInvalidSignatureLength(uint256 length);\n\n /**\n * @dev The signature has an S value that is in the upper half order.\n */\n error ECDSAInvalidSignatureS(bytes32 s);\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not\n * return address(0) without also returning an error description. Errors are documented using an enum (error type)\n * and a bytes32 providing additional information about the error.\n *\n * If no error is returned, then the address can be used for verification purposes.\n *\n * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * NOTE: This function only supports 65-byte signatures. ERC-2098 short signatures are rejected. This restriction\n * is DEPRECATED and will be removed in v6.0. Developers SHOULD NOT use signatures as unique identifiers; use hash\n * invalidation or nonces for replay protection.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n *\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n */\n function tryRecover(\n bytes32 hash,\n bytes memory signature\n ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly (\"memory-safe\") {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));\n }\n }\n\n /**\n * @dev Variant of {tryRecover} that takes a signature in calldata\n */\n function tryRecoverCalldata(\n bytes32 hash,\n bytes calldata signature\n ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, calldata slices would work here, but are\n // significantly more expensive (length check) than using calldataload in assembly.\n assembly (\"memory-safe\") {\n r := calldataload(signature.offset)\n s := calldataload(add(signature.offset, 0x20))\n v := byte(0, calldataload(add(signature.offset, 0x40)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * NOTE: This function only supports 65-byte signatures. ERC-2098 short signatures are rejected. This restriction\n * is DEPRECATED and will be removed in v6.0. Developers SHOULD NOT use signatures as unique identifiers; use hash\n * invalidation or nonces for replay protection.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);\n _throwError(error, errorArg);\n return recovered;\n }\n\n /**\n * @dev Variant of {recover} that takes a signature in calldata\n */\n function recoverCalldata(bytes32 hash, bytes calldata signature) internal pure returns (address) {\n (address recovered, RecoverError error, bytes32 errorArg) = tryRecoverCalldata(hash, signature);\n _throwError(error, errorArg);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[ERC-2098 short signatures]\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {\n unchecked {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n // We do not check for an overflow here since the shift operation results in 0 or 1.\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r` and `vs` short-signature fields separately.\n */\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\n (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);\n _throwError(error, errorArg);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS, s);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature, bytes32(0));\n }\n\n return (signer, RecoverError.NoError, bytes32(0));\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);\n _throwError(error, errorArg);\n return recovered;\n }\n\n /**\n * @dev Parse a signature into its `v`, `r` and `s` components. Supports 65-byte and 64-byte (ERC-2098)\n * formats. Returns (0,0,0) for invalid signatures.\n *\n * For 64-byte signatures, `v` is automatically normalized to 27 or 28.\n * For 65-byte signatures, `v` is returned as-is and MUST already be 27 or 28 for use with ecrecover.\n *\n * Consider validating the result before use, or use {tryRecover}/{recover} which perform full validation.\n */\n function parse(bytes memory signature) internal pure returns (uint8 v, bytes32 r, bytes32 s) {\n assembly (\"memory-safe\") {\n // Check the signature length\n switch mload(signature)\n // - case 65: r,s,v signature (standard)\n case 65 {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098)\n case 64 {\n let vs := mload(add(signature, 0x40))\n r := mload(add(signature, 0x20))\n s := and(vs, shr(1, not(0)))\n v := add(shr(255, vs), 27)\n }\n default {\n r := 0\n s := 0\n v := 0\n }\n }\n }\n\n /**\n * @dev Variant of {parse} that takes a signature in calldata\n */\n function parseCalldata(bytes calldata signature) internal pure returns (uint8 v, bytes32 r, bytes32 s) {\n assembly (\"memory-safe\") {\n // Check the signature length\n switch signature.length\n // - case 65: r,s,v signature (standard)\n case 65 {\n r := calldataload(signature.offset)\n s := calldataload(add(signature.offset, 0x20))\n v := byte(0, calldataload(add(signature.offset, 0x40)))\n }\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098)\n case 64 {\n let vs := calldataload(add(signature.offset, 0x20))\n r := calldataload(signature.offset)\n s := and(vs, shr(1, not(0)))\n v := add(shr(255, vs), 27)\n }\n default {\n r := 0\n s := 0\n v := 0\n }\n }\n }\n\n /**\n * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.\n */\n function _throwError(RecoverError error, bytes32 errorArg) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert ECDSAInvalidSignature();\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert ECDSAInvalidSignatureLength(uint256(errorArg));\n } else if (error == RecoverError.InvalidSignatureS) {\n revert ECDSAInvalidSignatureS(errorArg);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/EIP712.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.24;\n\nimport {MessageHashUtils} from \"./MessageHashUtils.sol\";\nimport {ShortStrings, ShortString} from \"../ShortStrings.sol\";\nimport {IERC5267} from \"../../interfaces/IERC5267.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP-712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose\n * encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract\n * does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to\n * produce the hash of their typed data using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP-712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\n * separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the\n * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\n *\n * @custom:oz-upgrades-unsafe-allow state-variable-immutable\n */\nabstract contract EIP712 is IERC5267 {\n using ShortStrings for *;\n\n bytes32 private constant TYPE_HASH =\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\n // invalidate the cached domain separator if the chain id changes.\n bytes32 private immutable _cachedDomainSeparator;\n uint256 private immutable _cachedChainId;\n address private immutable _cachedThis;\n\n bytes32 private immutable _hashedName;\n bytes32 private immutable _hashedVersion;\n\n ShortString private immutable _name;\n ShortString private immutable _version;\n // slither-disable-next-line constable-states\n string private _nameFallback;\n // slither-disable-next-line constable-states\n string private _versionFallback;\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP-712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n constructor(string memory name, string memory version) {\n _name = name.toShortStringWithFallback(_nameFallback);\n _version = version.toShortStringWithFallback(_versionFallback);\n _hashedName = keccak256(bytes(name));\n _hashedVersion = keccak256(bytes(version));\n\n _cachedChainId = block.chainid;\n _cachedDomainSeparator = _buildDomainSeparator();\n _cachedThis = address(this);\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n if (address(this) == _cachedThis && block.chainid == _cachedChainId) {\n return _cachedDomainSeparator;\n } else {\n return _buildDomainSeparator();\n }\n }\n\n function _buildDomainSeparator() private view returns (bytes32) {\n return keccak256(abi.encode(TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n\n /// @inheritdoc IERC5267\n function eip712Domain()\n public\n view\n virtual\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n )\n {\n return (\n hex\"0f\", // 01111\n _EIP712Name(),\n _EIP712Version(),\n block.chainid,\n address(this),\n bytes32(0),\n new uint256[](0)\n );\n }\n\n /**\n * @dev The name parameter for the EIP712 domain.\n *\n * NOTE: By default this function reads _name which is an immutable value.\n * It only reads from storage if necessary (in case the value is too large to fit in a ShortString).\n */\n // solhint-disable-next-line func-name-mixedcase\n function _EIP712Name() internal view returns (string memory) {\n return _name.toStringWithFallback(_nameFallback);\n }\n\n /**\n * @dev The version parameter for the EIP712 domain.\n *\n * NOTE: By default this function reads _version which is an immutable value.\n * It only reads from storage if necessary (in case the value is too large to fit in a ShortString).\n */\n // solhint-disable-next-line func-name-mixedcase\n function _EIP712Version() internal view returns (string memory) {\n return _version.toStringWithFallback(_versionFallback);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.6.0) (utils/cryptography/MessageHashUtils.sol)\n\npragma solidity ^0.8.24;\n\nimport {Strings} from \"../Strings.sol\";\n\n/**\n * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.\n *\n * The library provides methods for generating a hash of a message that conforms to the\n * https://eips.ethereum.org/EIPS/eip-191[ERC-191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]\n * specifications.\n */\nlibrary MessageHashUtils {\n error ERC5267ExtensionsNotSupported();\n\n /**\n * @dev Returns the keccak256 digest of an ERC-191 signed data with version\n * `0x45` (`personal_sign` messages).\n *\n * The digest is calculated by prefixing a bytes32 `messageHash` with\n * `\"\\x19Ethereum Signed Message:\\n32\"` and hashing the result. It corresponds with the\n * hash signed when using the https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sign[`eth_sign`] JSON-RPC method.\n *\n * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with\n * keccak256, although any bytes32 value can be safely used because the final digest will\n * be re-hashed.\n *\n * See {ECDSA-recover}.\n */\n function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) {\n assembly (\"memory-safe\") {\n mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\") // 32 is the bytes-length of messageHash\n mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix\n digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20)\n }\n }\n\n /**\n * @dev Returns the keccak256 digest of an ERC-191 signed data with version\n * `0x45` (`personal_sign` messages).\n *\n * The digest is calculated by prefixing an arbitrary `message` with\n * `\"\\x19Ethereum Signed Message:\\n\" + len(message)` and hashing the result. It corresponds with the\n * hash signed when using the https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sign[`eth_sign`] JSON-RPC method.\n *\n * See {ECDSA-recover}.\n */\n function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) {\n return\n keccak256(bytes.concat(\"\\x19Ethereum Signed Message:\\n\", bytes(Strings.toString(message.length)), message));\n }\n\n /**\n * @dev Returns the keccak256 digest of an ERC-191 signed data with version\n * `0x00` (data with intended validator).\n *\n * The digest is calculated by prefixing an arbitrary `data` with `\"\\x19\\x00\"` and the intended\n * `validator` address. Then hashing the result.\n *\n * See {ECDSA-recover}.\n */\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(hex\"19_00\", validator, data));\n }\n\n /**\n * @dev Variant of {toDataWithIntendedValidatorHash-address-bytes} optimized for cases where `data` is a bytes32.\n */\n function toDataWithIntendedValidatorHash(\n address validator,\n bytes32 messageHash\n ) internal pure returns (bytes32 digest) {\n assembly (\"memory-safe\") {\n mstore(0x00, hex\"19_00\")\n mstore(0x02, shl(96, validator))\n mstore(0x16, messageHash)\n digest := keccak256(0x00, 0x36)\n }\n }\n\n /**\n * @dev Returns the keccak256 digest of an EIP-712 typed data (ERC-191 version `0x01`).\n *\n * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with\n * `\\x19\\x01` and hashing the result. It corresponds to the hash signed by the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.\n *\n * See {ECDSA-recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) {\n assembly (\"memory-safe\") {\n let ptr := mload(0x40)\n mstore(ptr, hex\"19_01\")\n mstore(add(ptr, 0x02), domainSeparator)\n mstore(add(ptr, 0x22), structHash)\n digest := keccak256(ptr, 0x42)\n }\n }\n\n /**\n * @dev Returns the EIP-712 domain separator constructed from an `eip712Domain`. See {IERC5267-eip712Domain}\n *\n * This function dynamically constructs the domain separator based on which fields are present in the\n * `fields` parameter. It contains flags that indicate which domain fields are present:\n *\n * * Bit 0 (0x01): name\n * * Bit 1 (0x02): version\n * * Bit 2 (0x04): chainId\n * * Bit 3 (0x08): verifyingContract\n * * Bit 4 (0x10): salt\n *\n * Arguments that correspond to fields which are not present in `fields` are ignored. For example, if `fields` is\n * `0x0f` (`0b01111`), then the `salt` parameter is ignored.\n */\n function toDomainSeparator(\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt\n ) internal pure returns (bytes32 hash) {\n return\n toDomainSeparator(\n fields,\n keccak256(bytes(name)),\n keccak256(bytes(version)),\n chainId,\n verifyingContract,\n salt\n );\n }\n\n /// @dev Variant of {toDomainSeparator-bytes1-string-string-uint256-address-bytes32} that uses hashed name and version.\n function toDomainSeparator(\n bytes1 fields,\n bytes32 nameHash,\n bytes32 versionHash,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt\n ) internal pure returns (bytes32 hash) {\n bytes32 domainTypeHash = toDomainTypeHash(fields);\n\n assembly (\"memory-safe\") {\n // align fields to the right for easy processing\n fields := shr(248, fields)\n\n // FMP used as scratch space\n let fmp := mload(0x40)\n mstore(fmp, domainTypeHash)\n\n let ptr := add(fmp, 0x20)\n if and(fields, 0x01) {\n mstore(ptr, nameHash)\n ptr := add(ptr, 0x20)\n }\n if and(fields, 0x02) {\n mstore(ptr, versionHash)\n ptr := add(ptr, 0x20)\n }\n if and(fields, 0x04) {\n mstore(ptr, chainId)\n ptr := add(ptr, 0x20)\n }\n if and(fields, 0x08) {\n mstore(ptr, verifyingContract)\n ptr := add(ptr, 0x20)\n }\n if and(fields, 0x10) {\n mstore(ptr, salt)\n ptr := add(ptr, 0x20)\n }\n\n hash := keccak256(fmp, sub(ptr, fmp))\n }\n }\n\n /// @dev Builds an EIP-712 domain type hash depending on the `fields` provided, following https://eips.ethereum.org/EIPS/eip-5267[ERC-5267]\n function toDomainTypeHash(bytes1 fields) internal pure returns (bytes32 hash) {\n if (fields & 0x20 == 0x20) revert ERC5267ExtensionsNotSupported();\n\n assembly (\"memory-safe\") {\n // align fields to the right for easy processing\n fields := shr(248, fields)\n\n // FMP used as scratch space\n let fmp := mload(0x40)\n mstore(fmp, \"EIP712Domain(\")\n\n let ptr := add(fmp, 0x0d)\n // name field\n if and(fields, 0x01) {\n mstore(ptr, \"string name,\")\n ptr := add(ptr, 0x0c)\n }\n // version field\n if and(fields, 0x02) {\n mstore(ptr, \"string version,\")\n ptr := add(ptr, 0x0f)\n }\n // chainId field\n if and(fields, 0x04) {\n mstore(ptr, \"uint256 chainId,\")\n ptr := add(ptr, 0x10)\n }\n // verifyingContract field\n if and(fields, 0x08) {\n mstore(ptr, \"address verifyingContract,\")\n ptr := add(ptr, 0x1a)\n }\n // salt field\n if and(fields, 0x10) {\n mstore(ptr, \"bytes32 salt,\")\n ptr := add(ptr, 0x0d)\n }\n // if any field is enabled, remove the trailing comma\n ptr := sub(ptr, iszero(iszero(and(fields, 0x1f))))\n // add the closing brace\n mstore8(ptr, 0x29) // add closing brace\n ptr := add(ptr, 1)\n\n hash := keccak256(fmp, sub(ptr, fmp))\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)\n\npragma solidity >=0.4.16;\n\n/**\n * @dev Interface of the ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.6.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.20;\n\nimport {Panic} from \"../Panic.sol\";\nimport {SafeCast} from \"./SafeCast.sol\";\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Floor, // Toward negative infinity\n Ceil, // Toward positive infinity\n Trunc, // Toward zero\n Expand // Away from zero\n }\n\n /**\n * @dev Return the 512-bit addition of two uint256.\n *\n * The result is stored in two 256 variables such that sum = high * 2²⁵⁶ + low.\n */\n function add512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {\n assembly (\"memory-safe\") {\n low := add(a, b)\n high := lt(low, a)\n }\n }\n\n /**\n * @dev Return the 512-bit multiplication of two uint256.\n *\n * The result is stored in two 256 variables such that product = high * 2²⁵⁶ + low.\n */\n function mul512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {\n // 512-bit multiply [high low] = x * y. Compute the product mod 2²⁵⁶ and mod 2²⁵⁶ - 1, then use\n // the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = high * 2²⁵⁶ + low.\n assembly (\"memory-safe\") {\n let mm := mulmod(a, b, not(0))\n low := mul(a, b)\n high := sub(sub(mm, low), lt(mm, low))\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, with a success flag (no overflow).\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n unchecked {\n uint256 c = a + b;\n success = c >= a;\n result = c * SafeCast.toUint(success);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with a success flag (no overflow).\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n unchecked {\n uint256 c = a - b;\n success = c <= a;\n result = c * SafeCast.toUint(success);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with a success flag (no overflow).\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n unchecked {\n uint256 c = a * b;\n assembly (\"memory-safe\") {\n // Only true when the multiplication doesn't overflow\n // (c / a == b) || (a == 0)\n success := or(eq(div(c, a), b), iszero(a))\n }\n // equivalent to: success ? c : 0\n result = c * SafeCast.toUint(success);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a success flag (no division by zero).\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n unchecked {\n success = b > 0;\n assembly (\"memory-safe\") {\n // The `DIV` opcode returns zero when the denominator is 0.\n result := div(a, b)\n }\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a success flag (no division by zero).\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n unchecked {\n success = b > 0;\n assembly (\"memory-safe\") {\n // The `MOD` opcode returns zero when the denominator is 0.\n result := mod(a, b)\n }\n }\n }\n\n /**\n * @dev Unsigned saturating addition, bounds to `2²⁵⁶ - 1` instead of overflowing.\n */\n function saturatingAdd(uint256 a, uint256 b) internal pure returns (uint256) {\n (bool success, uint256 result) = tryAdd(a, b);\n return ternary(success, result, type(uint256).max);\n }\n\n /**\n * @dev Unsigned saturating subtraction, bounds to zero instead of overflowing.\n */\n function saturatingSub(uint256 a, uint256 b) internal pure returns (uint256) {\n (, uint256 result) = trySub(a, b);\n return result;\n }\n\n /**\n * @dev Unsigned saturating multiplication, bounds to `2²⁵⁶ - 1` instead of overflowing.\n */\n function saturatingMul(uint256 a, uint256 b) internal pure returns (uint256) {\n (bool success, uint256 result) = tryMul(a, b);\n return ternary(success, result, type(uint256).max);\n }\n\n /**\n * @dev Branchless ternary evaluation for `condition ? a : b`. Gas costs are constant.\n *\n * IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.\n * However, the compiler may optimize Solidity ternary operations (i.e. `condition ? a : b`) to only compute\n * one branch when needed, making this function more expensive.\n */\n function ternary(bool condition, uint256 a, uint256 b) internal pure returns (uint256) {\n unchecked {\n // branchless ternary works because:\n // b ^ (a ^ b) == a\n // b ^ 0 == b\n return b ^ ((a ^ b) * SafeCast.toUint(condition));\n }\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return ternary(a > b, a, b);\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return ternary(a < b, a, b);\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n unchecked {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds towards infinity instead\n * of rounding towards zero.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n if (b == 0) {\n // Guarantee the same behavior as in a regular Solidity division.\n Panic.panic(Panic.DIVISION_BY_ZERO);\n }\n\n // The following calculation ensures accurate ceiling division without overflow.\n // Since a is non-zero, (a - 1) / b will not overflow.\n // The largest possible result occurs when (a - 1) / b is type(uint256).max,\n // but the largest value we can obtain is type(uint256).max - 1, which happens\n // when a = type(uint256).max and b = 1.\n unchecked {\n return SafeCast.toUint(a > 0) * ((a - 1) / b + 1);\n }\n }\n\n /**\n * @dev Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or\n * denominator == 0.\n *\n * Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by\n * Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n (uint256 high, uint256 low) = mul512(x, y);\n\n // Handle non-overflow cases, 256 by 256 division.\n if (high == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return low / denominator;\n }\n\n // Make sure the result is less than 2²⁵⁶. Also prevents denominator == 0.\n if (denominator <= high) {\n Panic.panic(ternary(denominator == 0, Panic.DIVISION_BY_ZERO, Panic.UNDER_OVERFLOW));\n }\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [high low].\n uint256 remainder;\n assembly (\"memory-safe\") {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n high := sub(high, gt(remainder, low))\n low := sub(low, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator.\n // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.\n\n uint256 twos = denominator & (0 - denominator);\n assembly (\"memory-safe\") {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [high low] by twos.\n low := div(low, twos)\n\n // Flip twos such that it is 2²⁵⁶ / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from high into low.\n low |= high * twos;\n\n // Invert denominator mod 2²⁵⁶. Now that denominator is an odd number, it has an inverse modulo 2²⁵⁶ such\n // that denominator * inv ≡ 1 mod 2²⁵⁶. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv ≡ 1 mod 2⁴.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also\n // works in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2⁸\n inverse *= 2 - denominator * inverse; // inverse mod 2¹⁶\n inverse *= 2 - denominator * inverse; // inverse mod 2³²\n inverse *= 2 - denominator * inverse; // inverse mod 2⁶⁴\n inverse *= 2 - denominator * inverse; // inverse mod 2¹²⁸\n inverse *= 2 - denominator * inverse; // inverse mod 2²⁵⁶\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2²⁵⁶. Since the preconditions guarantee that the outcome is\n // less than 2²⁵⁶, this is the final result. We don't need to compute the high bits of the result and high\n // is no longer required.\n result = low * inverse;\n return result;\n }\n }\n\n /**\n * @dev Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n return mulDiv(x, y, denominator) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0);\n }\n\n /**\n * @dev Calculates floor(x * y >> n) with full precision. Throws if result overflows a uint256.\n */\n function mulShr(uint256 x, uint256 y, uint8 n) internal pure returns (uint256 result) {\n unchecked {\n (uint256 high, uint256 low) = mul512(x, y);\n if (high >= 1 << n) {\n Panic.panic(Panic.UNDER_OVERFLOW);\n }\n return (high << (256 - n)) | (low >> n);\n }\n }\n\n /**\n * @dev Calculates x * y >> n with full precision, following the selected rounding direction.\n */\n function mulShr(uint256 x, uint256 y, uint8 n, Rounding rounding) internal pure returns (uint256) {\n return mulShr(x, y, n) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, 1 << n) > 0);\n }\n\n /**\n * @dev Calculate the modular multiplicative inverse of a number in Z/nZ.\n *\n * If n is a prime, then Z/nZ is a field. In that case all elements are inversible, except 0.\n * If n is not a prime, then Z/nZ is not a field, and some elements might not be inversible.\n *\n * If the input value is not inversible, 0 is returned.\n *\n * NOTE: If you know for sure that n is (big) a prime, it may be cheaper to use Fermat's little theorem and get the\n * inverse using `Math.modExp(a, n - 2, n)`. See {invModPrime}.\n */\n function invMod(uint256 a, uint256 n) internal pure returns (uint256) {\n unchecked {\n if (n == 0) return 0;\n\n // The inverse modulo is calculated using the Extended Euclidean Algorithm (iterative version)\n // Used to compute integers x and y such that: ax + ny = gcd(a, n).\n // When the gcd is 1, then the inverse of a modulo n exists and it's x.\n // ax + ny = 1\n // ax = 1 + (-y)n\n // ax ≡ 1 (mod n) # x is the inverse of a modulo n\n\n // If the remainder is 0 the gcd is n right away.\n uint256 remainder = a % n;\n uint256 gcd = n;\n\n // Therefore the initial coefficients are:\n // ax + ny = gcd(a, n) = n\n // 0a + 1n = n\n int256 x = 0;\n int256 y = 1;\n\n while (remainder != 0) {\n uint256 quotient = gcd / remainder;\n\n (gcd, remainder) = (\n // The old remainder is the next gcd to try.\n remainder,\n // Compute the next remainder.\n // Can't overflow given that (a % gcd) * (gcd // (a % gcd)) <= gcd\n // where gcd is at most n (capped to type(uint256).max)\n gcd - remainder * quotient\n );\n\n (x, y) = (\n // Increment the coefficient of a.\n y,\n // Decrement the coefficient of n.\n // Can overflow, but the result is casted to uint256 so that the\n // next value of y is \"wrapped around\" to a value between 0 and n - 1.\n x - y * int256(quotient)\n );\n }\n\n if (gcd != 1) return 0; // No inverse exists.\n return ternary(x < 0, n - uint256(-x), uint256(x)); // Wrap the result if it's negative.\n }\n }\n\n /**\n * @dev Variant of {invMod}. More efficient, but only works if `p` is known to be a prime greater than `2`.\n *\n * From https://en.wikipedia.org/wiki/Fermat%27s_little_theorem[Fermat's little theorem], we know that if p is\n * prime, then `a**(p-1) ≡ 1 mod p`. As a consequence, we have `a * a**(p-2) ≡ 1 mod p`, which means that\n * `a**(p-2)` is the modular multiplicative inverse of a in Fp.\n *\n * NOTE: this function does NOT check that `p` is a prime greater than `2`.\n */\n function invModPrime(uint256 a, uint256 p) internal view returns (uint256) {\n unchecked {\n return Math.modExp(a, p - 2, p);\n }\n }\n\n /**\n * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m)\n *\n * Requirements:\n * - modulus can't be zero\n * - underlying staticcall to precompile must succeed\n *\n * IMPORTANT: The result is only valid if the underlying call succeeds. When using this function, make\n * sure the chain you're using it on supports the precompiled contract for modular exponentiation\n * at address 0x05 as specified in https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise,\n * the underlying function will succeed given the lack of a revert, but the result may be incorrectly\n * interpreted as 0.\n */\n function modExp(uint256 b, uint256 e, uint256 m) internal view returns (uint256) {\n (bool success, uint256 result) = tryModExp(b, e, m);\n if (!success) {\n Panic.panic(Panic.DIVISION_BY_ZERO);\n }\n return result;\n }\n\n /**\n * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m).\n * It includes a success flag indicating if the operation succeeded. Operation will be marked as failed if trying\n * to operate modulo 0 or if the underlying precompile reverted.\n *\n * IMPORTANT: The result is only valid if the success flag is true. When using this function, make sure the chain\n * you're using it on supports the precompiled contract for modular exponentiation at address 0x05 as specified in\n * https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, the underlying function will succeed given the lack\n * of a revert, but the result may be incorrectly interpreted as 0.\n */\n function tryModExp(uint256 b, uint256 e, uint256 m) internal view returns (bool success, uint256 result) {\n if (m == 0) return (false, 0);\n assembly (\"memory-safe\") {\n let ptr := mload(0x40)\n // | Offset | Content | Content (Hex) |\n // |-----------|------------|--------------------------------------------------------------------|\n // | 0x00:0x1f | size of b | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n // | 0x20:0x3f | size of e | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n // | 0x40:0x5f | size of m | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n // | 0x60:0x7f | value of b | 0x<.............................................................b> |\n // | 0x80:0x9f | value of e | 0x<.............................................................e> |\n // | 0xa0:0xbf | value of m | 0x<.............................................................m> |\n mstore(ptr, 0x20)\n mstore(add(ptr, 0x20), 0x20)\n mstore(add(ptr, 0x40), 0x20)\n mstore(add(ptr, 0x60), b)\n mstore(add(ptr, 0x80), e)\n mstore(add(ptr, 0xa0), m)\n\n // Given the result < m, it's guaranteed to fit in 32 bytes,\n // so we can use the memory scratch space located at offset 0.\n success := staticcall(gas(), 0x05, ptr, 0xc0, 0x00, 0x20)\n result := mload(0x00)\n }\n }\n\n /**\n * @dev Variant of {modExp} that supports inputs of arbitrary length.\n */\n function modExp(bytes memory b, bytes memory e, bytes memory m) internal view returns (bytes memory) {\n (bool success, bytes memory result) = tryModExp(b, e, m);\n if (!success) {\n Panic.panic(Panic.DIVISION_BY_ZERO);\n }\n return result;\n }\n\n /**\n * @dev Variant of {tryModExp} that supports inputs of arbitrary length.\n */\n function tryModExp(\n bytes memory b,\n bytes memory e,\n bytes memory m\n ) internal view returns (bool success, bytes memory result) {\n if (_zeroBytes(m)) return (false, new bytes(0));\n\n uint256 mLen = m.length;\n\n // Encode call args in result and move the free memory pointer\n result = abi.encodePacked(b.length, e.length, mLen, b, e, m);\n\n assembly (\"memory-safe\") {\n let dataPtr := add(result, 0x20)\n // Write result on top of args to avoid allocating extra memory.\n success := staticcall(gas(), 0x05, dataPtr, mload(result), dataPtr, mLen)\n // Overwrite the length.\n // result.length > returndatasize() is guaranteed because returndatasize() == m.length\n mstore(result, mLen)\n // Set the memory pointer after the returned data.\n mstore(0x40, add(dataPtr, mLen))\n }\n }\n\n /**\n * @dev Returns whether the provided byte array is zero.\n */\n function _zeroBytes(bytes memory buffer) private pure returns (bool) {\n uint256 chunk;\n for (uint256 i = 0; i < buffer.length; i += 0x20) {\n // See _unsafeReadBytesOffset from utils/Bytes.sol\n assembly (\"memory-safe\") {\n chunk := mload(add(add(buffer, 0x20), i))\n }\n if (chunk >> (8 * saturatingSub(i + 0x20, buffer.length)) != 0) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded\n * towards zero.\n *\n * This method is based on Newton's method for computing square roots; the algorithm is restricted to only\n * using integer operations.\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n unchecked {\n // Take care of easy edge cases when a == 0 or a == 1\n if (a <= 1) {\n return a;\n }\n\n // In this function, we use Newton's method to get a root of `f(x) := x² - a`. It involves building a\n // sequence x_n that converges toward sqrt(a). For each iteration x_n, we also define the error between\n // the current value as `ε_n = | x_n - sqrt(a) |`.\n //\n // For our first estimation, we consider `e` the smallest power of 2 which is bigger than the square root\n // of the target. (i.e. `2**(e-1) ≤ sqrt(a) < 2**e`). We know that `e ≤ 128` because `(2¹²⁸)² = 2²⁵⁶` is\n // bigger than any uint256.\n //\n // By noticing that\n // `2**(e-1) ≤ sqrt(a) < 2**e → (2**(e-1))² ≤ a < (2**e)² → 2**(2*e-2) ≤ a < 2**(2*e)`\n // we can deduce that `e - 1` is `log2(a) / 2`. We can thus compute `x_n = 2**(e-1)` using a method similar\n // to the msb function.\n uint256 aa = a;\n uint256 xn = 1;\n\n if (aa >= (1 << 128)) {\n aa >>= 128;\n xn <<= 64;\n }\n if (aa >= (1 << 64)) {\n aa >>= 64;\n xn <<= 32;\n }\n if (aa >= (1 << 32)) {\n aa >>= 32;\n xn <<= 16;\n }\n if (aa >= (1 << 16)) {\n aa >>= 16;\n xn <<= 8;\n }\n if (aa >= (1 << 8)) {\n aa >>= 8;\n xn <<= 4;\n }\n if (aa >= (1 << 4)) {\n aa >>= 4;\n xn <<= 2;\n }\n if (aa >= (1 << 2)) {\n xn <<= 1;\n }\n\n // We now have x_n such that `x_n = 2**(e-1) ≤ sqrt(a) < 2**e = 2 * x_n`. This implies ε_n ≤ 2**(e-1).\n //\n // We can refine our estimation by noticing that the middle of that interval minimizes the error.\n // If we move x_n to equal 2**(e-1) + 2**(e-2), then we reduce the error to ε_n ≤ 2**(e-2).\n // This is going to be our x_0 (and ε_0)\n xn = (3 * xn) >> 1; // ε_0 := | x_0 - sqrt(a) | ≤ 2**(e-2)\n\n // From here, Newton's method give us:\n // x_{n+1} = (x_n + a / x_n) / 2\n //\n // One should note that:\n // x_{n+1}² - a = ((x_n + a / x_n) / 2)² - a\n // = ((x_n² + a) / (2 * x_n))² - a\n // = (x_n⁴ + 2 * a * x_n² + a²) / (4 * x_n²) - a\n // = (x_n⁴ + 2 * a * x_n² + a² - 4 * a * x_n²) / (4 * x_n²)\n // = (x_n⁴ - 2 * a * x_n² + a²) / (4 * x_n²)\n // = (x_n² - a)² / (2 * x_n)²\n // = ((x_n² - a) / (2 * x_n))²\n // ≥ 0\n // Which proves that for all n ≥ 1, sqrt(a) ≤ x_n\n //\n // This gives us the proof of quadratic convergence of the sequence:\n // ε_{n+1} = | x_{n+1} - sqrt(a) |\n // = | (x_n + a / x_n) / 2 - sqrt(a) |\n // = | (x_n² + a - 2*x_n*sqrt(a)) / (2 * x_n) |\n // = | (x_n - sqrt(a))² / (2 * x_n) |\n // = | ε_n² / (2 * x_n) |\n // = ε_n² / | (2 * x_n) |\n //\n // For the first iteration, we have a special case where x_0 is known:\n // ε_1 = ε_0² / | (2 * x_0) |\n // ≤ (2**(e-2))² / (2 * (2**(e-1) + 2**(e-2)))\n // ≤ 2**(2*e-4) / (3 * 2**(e-1))\n // ≤ 2**(e-3) / 3\n // ≤ 2**(e-3-log2(3))\n // ≤ 2**(e-4.5)\n //\n // For the following iterations, we use the fact that, 2**(e-1) ≤ sqrt(a) ≤ x_n:\n // ε_{n+1} = ε_n² / | (2 * x_n) |\n // ≤ (2**(e-k))² / (2 * 2**(e-1))\n // ≤ 2**(2*e-2*k) / 2**e\n // ≤ 2**(e-2*k)\n xn = (xn + a / xn) >> 1; // ε_1 := | x_1 - sqrt(a) | ≤ 2**(e-4.5) -- special case, see above\n xn = (xn + a / xn) >> 1; // ε_2 := | x_2 - sqrt(a) | ≤ 2**(e-9) -- general case with k = 4.5\n xn = (xn + a / xn) >> 1; // ε_3 := | x_3 - sqrt(a) | ≤ 2**(e-18) -- general case with k = 9\n xn = (xn + a / xn) >> 1; // ε_4 := | x_4 - sqrt(a) | ≤ 2**(e-36) -- general case with k = 18\n xn = (xn + a / xn) >> 1; // ε_5 := | x_5 - sqrt(a) | ≤ 2**(e-72) -- general case with k = 36\n xn = (xn + a / xn) >> 1; // ε_6 := | x_6 - sqrt(a) | ≤ 2**(e-144) -- general case with k = 72\n\n // Because e ≤ 128 (as discussed during the first estimation phase), we know have reached a precision\n // ε_6 ≤ 2**(e-144) < 1. Given we're operating on integers, then we can ensure that xn is now either\n // sqrt(a) or sqrt(a) + 1.\n return xn - SafeCast.toUint(xn > a / xn);\n }\n }\n\n /**\n * @dev Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + SafeCast.toUint(unsignedRoundsUp(rounding) && result * result < a);\n }\n }\n\n /**\n * @dev Return the log in base 2 of a positive value rounded towards zero.\n * Returns 0 if given 0.\n */\n function log2(uint256 x) internal pure returns (uint256 r) {\n // If value has upper 128 bits set, log2 result is at least 128\n r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;\n // If upper 64 bits of 128-bit half set, add 64 to result\n r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;\n // If upper 32 bits of 64-bit half set, add 32 to result\n r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;\n // If upper 16 bits of 32-bit half set, add 16 to result\n r |= SafeCast.toUint((x >> r) > 0xffff) << 4;\n // If upper 8 bits of 16-bit half set, add 8 to result\n r |= SafeCast.toUint((x >> r) > 0xff) << 3;\n // If upper 4 bits of 8-bit half set, add 4 to result\n r |= SafeCast.toUint((x >> r) > 0xf) << 2;\n\n // Shifts value right by the current result and use it as an index into this lookup table:\n //\n // | x (4 bits) | index | table[index] = MSB position |\n // |------------|---------|-----------------------------|\n // | 0000 | 0 | table[0] = 0 |\n // | 0001 | 1 | table[1] = 0 |\n // | 0010 | 2 | table[2] = 1 |\n // | 0011 | 3 | table[3] = 1 |\n // | 0100 | 4 | table[4] = 2 |\n // | 0101 | 5 | table[5] = 2 |\n // | 0110 | 6 | table[6] = 2 |\n // | 0111 | 7 | table[7] = 2 |\n // | 1000 | 8 | table[8] = 3 |\n // | 1001 | 9 | table[9] = 3 |\n // | 1010 | 10 | table[10] = 3 |\n // | 1011 | 11 | table[11] = 3 |\n // | 1100 | 12 | table[12] = 3 |\n // | 1101 | 13 | table[13] = 3 |\n // | 1110 | 14 | table[14] = 3 |\n // | 1111 | 15 | table[15] = 3 |\n //\n // The lookup table is represented as a 32-byte value with the MSB positions for 0-15 in the first 16 bytes (most significant half).\n assembly (\"memory-safe\") {\n r := or(r, byte(shr(r, x), 0x0000010102020202030303030303030300000000000000000000000000000000))\n }\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << result < value);\n }\n }\n\n /**\n * @dev Return the log in base 10 of a positive value rounded towards zero.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 10 ** result < value);\n }\n }\n\n /**\n * @dev Return the log in base 256 of a positive value rounded towards zero.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 x) internal pure returns (uint256 r) {\n // If value has upper 128 bits set, log2 result is at least 128\n r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;\n // If upper 64 bits of 128-bit half set, add 64 to result\n r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;\n // If upper 32 bits of 64-bit half set, add 32 to result\n r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;\n // If upper 16 bits of 32-bit half set, add 16 to result\n r |= SafeCast.toUint((x >> r) > 0xffff) << 4;\n // Add 1 if upper 8 bits of 16-bit half set, and divide accumulated result by 8\n return (r >> 3) | SafeCast.toUint((x >> r) > 0xff);\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << (result << 3) < value);\n }\n }\n\n /**\n * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.\n */\n function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {\n return uint8(rounding) % 2 == 1;\n }\n\n /**\n * @dev Counts the number of leading zero bits in a uint256.\n */\n function clz(uint256 x) internal pure returns (uint256) {\n return ternary(x == 0, 256, 255 - log2(x));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeCast.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.6.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeCast {\n /**\n * @dev Value doesn't fit in a uint of `bits` size.\n */\n error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);\n\n /**\n * @dev An int value doesn't fit in a uint of `bits` size.\n */\n error SafeCastOverflowedIntToUint(int256 value);\n\n /**\n * @dev Value doesn't fit in an int of `bits` size.\n */\n error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);\n\n /**\n * @dev A uint value doesn't fit in an int of `bits` size.\n */\n error SafeCastOverflowedUintToInt(uint256 value);\n\n /**\n * @dev Returns the downcasted uint248 from uint256, reverting on\n * overflow (when the input is greater than largest uint248).\n *\n * Counterpart to Solidity's `uint248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n */\n function toUint248(uint256 value) internal pure returns (uint248) {\n if (value > type(uint248).max) {\n revert SafeCastOverflowedUintDowncast(248, value);\n }\n return uint248(value);\n }\n\n /**\n * @dev Returns the downcasted uint240 from uint256, reverting on\n * overflow (when the input is greater than largest uint240).\n *\n * Counterpart to Solidity's `uint240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n */\n function toUint240(uint256 value) internal pure returns (uint240) {\n if (value > type(uint240).max) {\n revert SafeCastOverflowedUintDowncast(240, value);\n }\n return uint240(value);\n }\n\n /**\n * @dev Returns the downcasted uint232 from uint256, reverting on\n * overflow (when the input is greater than largest uint232).\n *\n * Counterpart to Solidity's `uint232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n */\n function toUint232(uint256 value) internal pure returns (uint232) {\n if (value > type(uint232).max) {\n revert SafeCastOverflowedUintDowncast(232, value);\n }\n return uint232(value);\n }\n\n /**\n * @dev Returns the downcasted uint224 from uint256, reverting on\n * overflow (when the input is greater than largest uint224).\n *\n * Counterpart to Solidity's `uint224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n */\n function toUint224(uint256 value) internal pure returns (uint224) {\n if (value > type(uint224).max) {\n revert SafeCastOverflowedUintDowncast(224, value);\n }\n return uint224(value);\n }\n\n /**\n * @dev Returns the downcasted uint216 from uint256, reverting on\n * overflow (when the input is greater than largest uint216).\n *\n * Counterpart to Solidity's `uint216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n */\n function toUint216(uint256 value) internal pure returns (uint216) {\n if (value > type(uint216).max) {\n revert SafeCastOverflowedUintDowncast(216, value);\n }\n return uint216(value);\n }\n\n /**\n * @dev Returns the downcasted uint208 from uint256, reverting on\n * overflow (when the input is greater than largest uint208).\n *\n * Counterpart to Solidity's `uint208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n */\n function toUint208(uint256 value) internal pure returns (uint208) {\n if (value > type(uint208).max) {\n revert SafeCastOverflowedUintDowncast(208, value);\n }\n return uint208(value);\n }\n\n /**\n * @dev Returns the downcasted uint200 from uint256, reverting on\n * overflow (when the input is greater than largest uint200).\n *\n * Counterpart to Solidity's `uint200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n */\n function toUint200(uint256 value) internal pure returns (uint200) {\n if (value > type(uint200).max) {\n revert SafeCastOverflowedUintDowncast(200, value);\n }\n return uint200(value);\n }\n\n /**\n * @dev Returns the downcasted uint192 from uint256, reverting on\n * overflow (when the input is greater than largest uint192).\n *\n * Counterpart to Solidity's `uint192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n */\n function toUint192(uint256 value) internal pure returns (uint192) {\n if (value > type(uint192).max) {\n revert SafeCastOverflowedUintDowncast(192, value);\n }\n return uint192(value);\n }\n\n /**\n * @dev Returns the downcasted uint184 from uint256, reverting on\n * overflow (when the input is greater than largest uint184).\n *\n * Counterpart to Solidity's `uint184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n */\n function toUint184(uint256 value) internal pure returns (uint184) {\n if (value > type(uint184).max) {\n revert SafeCastOverflowedUintDowncast(184, value);\n }\n return uint184(value);\n }\n\n /**\n * @dev Returns the downcasted uint176 from uint256, reverting on\n * overflow (when the input is greater than largest uint176).\n *\n * Counterpart to Solidity's `uint176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n */\n function toUint176(uint256 value) internal pure returns (uint176) {\n if (value > type(uint176).max) {\n revert SafeCastOverflowedUintDowncast(176, value);\n }\n return uint176(value);\n }\n\n /**\n * @dev Returns the downcasted uint168 from uint256, reverting on\n * overflow (when the input is greater than largest uint168).\n *\n * Counterpart to Solidity's `uint168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n */\n function toUint168(uint256 value) internal pure returns (uint168) {\n if (value > type(uint168).max) {\n revert SafeCastOverflowedUintDowncast(168, value);\n }\n return uint168(value);\n }\n\n /**\n * @dev Returns the downcasted uint160 from uint256, reverting on\n * overflow (when the input is greater than largest uint160).\n *\n * Counterpart to Solidity's `uint160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n */\n function toUint160(uint256 value) internal pure returns (uint160) {\n if (value > type(uint160).max) {\n revert SafeCastOverflowedUintDowncast(160, value);\n }\n return uint160(value);\n }\n\n /**\n * @dev Returns the downcasted uint152 from uint256, reverting on\n * overflow (when the input is greater than largest uint152).\n *\n * Counterpart to Solidity's `uint152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n */\n function toUint152(uint256 value) internal pure returns (uint152) {\n if (value > type(uint152).max) {\n revert SafeCastOverflowedUintDowncast(152, value);\n }\n return uint152(value);\n }\n\n /**\n * @dev Returns the downcasted uint144 from uint256, reverting on\n * overflow (when the input is greater than largest uint144).\n *\n * Counterpart to Solidity's `uint144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n */\n function toUint144(uint256 value) internal pure returns (uint144) {\n if (value > type(uint144).max) {\n revert SafeCastOverflowedUintDowncast(144, value);\n }\n return uint144(value);\n }\n\n /**\n * @dev Returns the downcasted uint136 from uint256, reverting on\n * overflow (when the input is greater than largest uint136).\n *\n * Counterpart to Solidity's `uint136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n */\n function toUint136(uint256 value) internal pure returns (uint136) {\n if (value > type(uint136).max) {\n revert SafeCastOverflowedUintDowncast(136, value);\n }\n return uint136(value);\n }\n\n /**\n * @dev Returns the downcasted uint128 from uint256, reverting on\n * overflow (when the input is greater than largest uint128).\n *\n * Counterpart to Solidity's `uint128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n */\n function toUint128(uint256 value) internal pure returns (uint128) {\n if (value > type(uint128).max) {\n revert SafeCastOverflowedUintDowncast(128, value);\n }\n return uint128(value);\n }\n\n /**\n * @dev Returns the downcasted uint120 from uint256, reverting on\n * overflow (when the input is greater than largest uint120).\n *\n * Counterpart to Solidity's `uint120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n */\n function toUint120(uint256 value) internal pure returns (uint120) {\n if (value > type(uint120).max) {\n revert SafeCastOverflowedUintDowncast(120, value);\n }\n return uint120(value);\n }\n\n /**\n * @dev Returns the downcasted uint112 from uint256, reverting on\n * overflow (when the input is greater than largest uint112).\n *\n * Counterpart to Solidity's `uint112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n */\n function toUint112(uint256 value) internal pure returns (uint112) {\n if (value > type(uint112).max) {\n revert SafeCastOverflowedUintDowncast(112, value);\n }\n return uint112(value);\n }\n\n /**\n * @dev Returns the downcasted uint104 from uint256, reverting on\n * overflow (when the input is greater than largest uint104).\n *\n * Counterpart to Solidity's `uint104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n */\n function toUint104(uint256 value) internal pure returns (uint104) {\n if (value > type(uint104).max) {\n revert SafeCastOverflowedUintDowncast(104, value);\n }\n return uint104(value);\n }\n\n /**\n * @dev Returns the downcasted uint96 from uint256, reverting on\n * overflow (when the input is greater than largest uint96).\n *\n * Counterpart to Solidity's `uint96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n */\n function toUint96(uint256 value) internal pure returns (uint96) {\n if (value > type(uint96).max) {\n revert SafeCastOverflowedUintDowncast(96, value);\n }\n return uint96(value);\n }\n\n /**\n * @dev Returns the downcasted uint88 from uint256, reverting on\n * overflow (when the input is greater than largest uint88).\n *\n * Counterpart to Solidity's `uint88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n */\n function toUint88(uint256 value) internal pure returns (uint88) {\n if (value > type(uint88).max) {\n revert SafeCastOverflowedUintDowncast(88, value);\n }\n return uint88(value);\n }\n\n /**\n * @dev Returns the downcasted uint80 from uint256, reverting on\n * overflow (when the input is greater than largest uint80).\n *\n * Counterpart to Solidity's `uint80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n */\n function toUint80(uint256 value) internal pure returns (uint80) {\n if (value > type(uint80).max) {\n revert SafeCastOverflowedUintDowncast(80, value);\n }\n return uint80(value);\n }\n\n /**\n * @dev Returns the downcasted uint72 from uint256, reverting on\n * overflow (when the input is greater than largest uint72).\n *\n * Counterpart to Solidity's `uint72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n */\n function toUint72(uint256 value) internal pure returns (uint72) {\n if (value > type(uint72).max) {\n revert SafeCastOverflowedUintDowncast(72, value);\n }\n return uint72(value);\n }\n\n /**\n * @dev Returns the downcasted uint64 from uint256, reverting on\n * overflow (when the input is greater than largest uint64).\n *\n * Counterpart to Solidity's `uint64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n */\n function toUint64(uint256 value) internal pure returns (uint64) {\n if (value > type(uint64).max) {\n revert SafeCastOverflowedUintDowncast(64, value);\n }\n return uint64(value);\n }\n\n /**\n * @dev Returns the downcasted uint56 from uint256, reverting on\n * overflow (when the input is greater than largest uint56).\n *\n * Counterpart to Solidity's `uint56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n */\n function toUint56(uint256 value) internal pure returns (uint56) {\n if (value > type(uint56).max) {\n revert SafeCastOverflowedUintDowncast(56, value);\n }\n return uint56(value);\n }\n\n /**\n * @dev Returns the downcasted uint48 from uint256, reverting on\n * overflow (when the input is greater than largest uint48).\n *\n * Counterpart to Solidity's `uint48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n */\n function toUint48(uint256 value) internal pure returns (uint48) {\n if (value > type(uint48).max) {\n revert SafeCastOverflowedUintDowncast(48, value);\n }\n return uint48(value);\n }\n\n /**\n * @dev Returns the downcasted uint40 from uint256, reverting on\n * overflow (when the input is greater than largest uint40).\n *\n * Counterpart to Solidity's `uint40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n */\n function toUint40(uint256 value) internal pure returns (uint40) {\n if (value > type(uint40).max) {\n revert SafeCastOverflowedUintDowncast(40, value);\n }\n return uint40(value);\n }\n\n /**\n * @dev Returns the downcasted uint32 from uint256, reverting on\n * overflow (when the input is greater than largest uint32).\n *\n * Counterpart to Solidity's `uint32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n */\n function toUint32(uint256 value) internal pure returns (uint32) {\n if (value > type(uint32).max) {\n revert SafeCastOverflowedUintDowncast(32, value);\n }\n return uint32(value);\n }\n\n /**\n * @dev Returns the downcasted uint24 from uint256, reverting on\n * overflow (when the input is greater than largest uint24).\n *\n * Counterpart to Solidity's `uint24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n */\n function toUint24(uint256 value) internal pure returns (uint24) {\n if (value > type(uint24).max) {\n revert SafeCastOverflowedUintDowncast(24, value);\n }\n return uint24(value);\n }\n\n /**\n * @dev Returns the downcasted uint16 from uint256, reverting on\n * overflow (when the input is greater than largest uint16).\n *\n * Counterpart to Solidity's `uint16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n */\n function toUint16(uint256 value) internal pure returns (uint16) {\n if (value > type(uint16).max) {\n revert SafeCastOverflowedUintDowncast(16, value);\n }\n return uint16(value);\n }\n\n /**\n * @dev Returns the downcasted uint8 from uint256, reverting on\n * overflow (when the input is greater than largest uint8).\n *\n * Counterpart to Solidity's `uint8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n */\n function toUint8(uint256 value) internal pure returns (uint8) {\n if (value > type(uint8).max) {\n revert SafeCastOverflowedUintDowncast(8, value);\n }\n return uint8(value);\n }\n\n /**\n * @dev Converts a signed int256 into an unsigned uint256.\n *\n * Requirements:\n *\n * - input must be greater than or equal to 0.\n */\n function toUint256(int256 value) internal pure returns (uint256) {\n if (value < 0) {\n revert SafeCastOverflowedIntToUint(value);\n }\n return uint256(value);\n }\n\n /**\n * @dev Returns the downcasted int248 from int256, reverting on\n * overflow (when the input is less than smallest int248 or\n * greater than largest int248).\n *\n * Counterpart to Solidity's `int248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n */\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\n downcasted = int248(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(248, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int240 from int256, reverting on\n * overflow (when the input is less than smallest int240 or\n * greater than largest int240).\n *\n * Counterpart to Solidity's `int240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n */\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\n downcasted = int240(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(240, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int232 from int256, reverting on\n * overflow (when the input is less than smallest int232 or\n * greater than largest int232).\n *\n * Counterpart to Solidity's `int232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n */\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\n downcasted = int232(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(232, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int224 from int256, reverting on\n * overflow (when the input is less than smallest int224 or\n * greater than largest int224).\n *\n * Counterpart to Solidity's `int224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n */\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\n downcasted = int224(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(224, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int216 from int256, reverting on\n * overflow (when the input is less than smallest int216 or\n * greater than largest int216).\n *\n * Counterpart to Solidity's `int216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n */\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\n downcasted = int216(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(216, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int208 from int256, reverting on\n * overflow (when the input is less than smallest int208 or\n * greater than largest int208).\n *\n * Counterpart to Solidity's `int208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n */\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\n downcasted = int208(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(208, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int200 from int256, reverting on\n * overflow (when the input is less than smallest int200 or\n * greater than largest int200).\n *\n * Counterpart to Solidity's `int200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n */\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\n downcasted = int200(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(200, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int192 from int256, reverting on\n * overflow (when the input is less than smallest int192 or\n * greater than largest int192).\n *\n * Counterpart to Solidity's `int192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n */\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\n downcasted = int192(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(192, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int184 from int256, reverting on\n * overflow (when the input is less than smallest int184 or\n * greater than largest int184).\n *\n * Counterpart to Solidity's `int184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n */\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\n downcasted = int184(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(184, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int176 from int256, reverting on\n * overflow (when the input is less than smallest int176 or\n * greater than largest int176).\n *\n * Counterpart to Solidity's `int176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n */\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\n downcasted = int176(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(176, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int168 from int256, reverting on\n * overflow (when the input is less than smallest int168 or\n * greater than largest int168).\n *\n * Counterpart to Solidity's `int168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n */\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\n downcasted = int168(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(168, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int160 from int256, reverting on\n * overflow (when the input is less than smallest int160 or\n * greater than largest int160).\n *\n * Counterpart to Solidity's `int160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n */\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\n downcasted = int160(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(160, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int152 from int256, reverting on\n * overflow (when the input is less than smallest int152 or\n * greater than largest int152).\n *\n * Counterpart to Solidity's `int152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n */\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\n downcasted = int152(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(152, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int144 from int256, reverting on\n * overflow (when the input is less than smallest int144 or\n * greater than largest int144).\n *\n * Counterpart to Solidity's `int144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n */\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\n downcasted = int144(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(144, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int136 from int256, reverting on\n * overflow (when the input is less than smallest int136 or\n * greater than largest int136).\n *\n * Counterpart to Solidity's `int136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n */\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\n downcasted = int136(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(136, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int128 from int256, reverting on\n * overflow (when the input is less than smallest int128 or\n * greater than largest int128).\n *\n * Counterpart to Solidity's `int128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n */\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\n downcasted = int128(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(128, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int120 from int256, reverting on\n * overflow (when the input is less than smallest int120 or\n * greater than largest int120).\n *\n * Counterpart to Solidity's `int120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n */\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\n downcasted = int120(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(120, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int112 from int256, reverting on\n * overflow (when the input is less than smallest int112 or\n * greater than largest int112).\n *\n * Counterpart to Solidity's `int112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n */\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\n downcasted = int112(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(112, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int104 from int256, reverting on\n * overflow (when the input is less than smallest int104 or\n * greater than largest int104).\n *\n * Counterpart to Solidity's `int104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n */\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\n downcasted = int104(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(104, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int96 from int256, reverting on\n * overflow (when the input is less than smallest int96 or\n * greater than largest int96).\n *\n * Counterpart to Solidity's `int96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n */\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\n downcasted = int96(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(96, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int88 from int256, reverting on\n * overflow (when the input is less than smallest int88 or\n * greater than largest int88).\n *\n * Counterpart to Solidity's `int88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n */\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\n downcasted = int88(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(88, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int80 from int256, reverting on\n * overflow (when the input is less than smallest int80 or\n * greater than largest int80).\n *\n * Counterpart to Solidity's `int80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n */\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\n downcasted = int80(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(80, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int72 from int256, reverting on\n * overflow (when the input is less than smallest int72 or\n * greater than largest int72).\n *\n * Counterpart to Solidity's `int72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n */\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\n downcasted = int72(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(72, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int64 from int256, reverting on\n * overflow (when the input is less than smallest int64 or\n * greater than largest int64).\n *\n * Counterpart to Solidity's `int64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n */\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\n downcasted = int64(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(64, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int56 from int256, reverting on\n * overflow (when the input is less than smallest int56 or\n * greater than largest int56).\n *\n * Counterpart to Solidity's `int56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n */\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\n downcasted = int56(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(56, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int48 from int256, reverting on\n * overflow (when the input is less than smallest int48 or\n * greater than largest int48).\n *\n * Counterpart to Solidity's `int48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n */\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\n downcasted = int48(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(48, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int40 from int256, reverting on\n * overflow (when the input is less than smallest int40 or\n * greater than largest int40).\n *\n * Counterpart to Solidity's `int40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n */\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\n downcasted = int40(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(40, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int32 from int256, reverting on\n * overflow (when the input is less than smallest int32 or\n * greater than largest int32).\n *\n * Counterpart to Solidity's `int32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n */\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\n downcasted = int32(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(32, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int24 from int256, reverting on\n * overflow (when the input is less than smallest int24 or\n * greater than largest int24).\n *\n * Counterpart to Solidity's `int24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n */\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\n downcasted = int24(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(24, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int16 from int256, reverting on\n * overflow (when the input is less than smallest int16 or\n * greater than largest int16).\n *\n * Counterpart to Solidity's `int16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n */\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\n downcasted = int16(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(16, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int8 from int256, reverting on\n * overflow (when the input is less than smallest int8 or\n * greater than largest int8).\n *\n * Counterpart to Solidity's `int8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n */\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\n downcasted = int8(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(8, value);\n }\n }\n\n /**\n * @dev Converts an unsigned uint256 into a signed int256.\n *\n * Requirements:\n *\n * - input must be less than or equal to maxInt256.\n */\n function toInt256(uint256 value) internal pure returns (int256) {\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n if (value > uint256(type(int256).max)) {\n revert SafeCastOverflowedUintToInt(value);\n }\n return int256(value);\n }\n\n /**\n * @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump.\n */\n function toUint(bool b) internal pure returns (uint256 u) {\n assembly (\"memory-safe\") {\n u := iszero(iszero(b))\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.20;\n\nimport {SafeCast} from \"./SafeCast.sol\";\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant.\n *\n * IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.\n * However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute\n * one branch when needed, making this function more expensive.\n */\n function ternary(bool condition, int256 a, int256 b) internal pure returns (int256) {\n unchecked {\n // branchless ternary works because:\n // b ^ (a ^ b) == a\n // b ^ 0 == b\n return b ^ ((a ^ b) * int256(SafeCast.toUint(condition)));\n }\n }\n\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return ternary(a > b, a, b);\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return ternary(a < b, a, b);\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // Formula from the \"Bit Twiddling Hacks\" by Sean Eron Anderson.\n // Since `n` is a signed integer, the generated bytecode will use the SAR opcode to perform the right shift,\n // taking advantage of the most significant (or \"sign\" bit) in two's complement representation.\n // This opcode adds new most significant bits set to the value of the previous most significant bit. As a result,\n // the mask will either be `bytes32(0)` (if n is positive) or `~bytes32(0)` (if n is negative).\n int256 mask = n >> 255;\n\n // A `bytes32(0)` mask leaves the input unchanged, while a `~bytes32(0)` mask complements it.\n return uint256((n + mask) ^ mask);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Panic.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/Panic.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Helper library for emitting standardized panic codes.\n *\n * ```solidity\n * contract Example {\n * using Panic for uint256;\n *\n * // Use any of the declared internal constants\n * function foo() { Panic.GENERIC.panic(); }\n *\n * // Alternatively\n * function foo() { Panic.panic(Panic.GENERIC); }\n * }\n * ```\n *\n * Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil].\n *\n * _Available since v5.1._\n */\n// slither-disable-next-line unused-state\nlibrary Panic {\n /// @dev generic / unspecified error\n uint256 internal constant GENERIC = 0x00;\n /// @dev used by the assert() builtin\n uint256 internal constant ASSERT = 0x01;\n /// @dev arithmetic underflow or overflow\n uint256 internal constant UNDER_OVERFLOW = 0x11;\n /// @dev division or modulo by zero\n uint256 internal constant DIVISION_BY_ZERO = 0x12;\n /// @dev enum conversion error\n uint256 internal constant ENUM_CONVERSION_ERROR = 0x21;\n /// @dev invalid encoding in storage\n uint256 internal constant STORAGE_ENCODING_ERROR = 0x22;\n /// @dev empty array pop\n uint256 internal constant EMPTY_ARRAY_POP = 0x31;\n /// @dev array out of bounds access\n uint256 internal constant ARRAY_OUT_OF_BOUNDS = 0x32;\n /// @dev resource error (too large allocation or too large array)\n uint256 internal constant RESOURCE_ERROR = 0x41;\n /// @dev calling invalid internal function\n uint256 internal constant INVALID_INTERNAL_FUNCTION = 0x51;\n\n /// @dev Reverts with a panic code. Recommended to use with\n /// the internal constants with predefined codes.\n function panic(uint256 code) internal pure {\n assembly (\"memory-safe\") {\n mstore(0x00, 0x4e487b71)\n mstore(0x20, code)\n revert(0x1c, 0x24)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (utils/ReentrancyGuard.sol)\n\npragma solidity ^0.8.20;\n\nimport {StorageSlot} from \"./StorageSlot.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,\n * consider using {ReentrancyGuardTransient} instead.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n *\n * IMPORTANT: Deprecated. This storage-based reentrancy guard will be removed and replaced\n * by the {ReentrancyGuardTransient} variant in v6.0.\n *\n * @custom:stateless\n */\nabstract contract ReentrancyGuard {\n using StorageSlot for bytes32;\n\n // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.ReentrancyGuard\")) - 1)) & ~bytes32(uint256(0xff))\n bytes32 private constant REENTRANCY_GUARD_STORAGE =\n 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;\n\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant NOT_ENTERED = 1;\n uint256 private constant ENTERED = 2;\n\n /**\n * @dev Unauthorized reentrant call.\n */\n error ReentrancyGuardReentrantCall();\n\n constructor() {\n _reentrancyGuardStorageSlot().getUint256Slot().value = NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n /**\n * @dev A `view` only version of {nonReentrant}. Use to block view functions\n * from being called, preventing reading from inconsistent contract state.\n *\n * CAUTION: This is a \"view\" modifier and does not change the reentrancy\n * status. Use it only on view functions. For payable or non-payable functions,\n * use the standard {nonReentrant} modifier instead.\n */\n modifier nonReentrantView() {\n _nonReentrantBeforeView();\n _;\n }\n\n function _nonReentrantBeforeView() private view {\n if (_reentrancyGuardEntered()) {\n revert ReentrancyGuardReentrantCall();\n }\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be NOT_ENTERED\n _nonReentrantBeforeView();\n\n // Any calls to nonReentrant after this point will fail\n _reentrancyGuardStorageSlot().getUint256Slot().value = ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _reentrancyGuardStorageSlot().getUint256Slot().value = NOT_ENTERED;\n }\n\n /**\n * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n * `nonReentrant` function in the call stack.\n */\n function _reentrancyGuardEntered() internal view returns (bool) {\n return _reentrancyGuardStorageSlot().getUint256Slot().value == ENTERED;\n }\n\n function _reentrancyGuardStorageSlot() internal pure virtual returns (bytes32) {\n return REENTRANCY_GUARD_STORAGE;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/ShortStrings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (utils/ShortStrings.sol)\n\npragma solidity ^0.8.20;\n\nimport {StorageSlot} from \"./StorageSlot.sol\";\n\n// | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |\n// | length | 0x BB |\ntype ShortString is bytes32;\n\n/**\n * @dev This library provides functions to convert short memory strings\n * into a `ShortString` type that can be used as an immutable variable.\n *\n * Strings of arbitrary length can be optimized using this library if\n * they are short enough (up to 31 bytes) by packing them with their\n * length (1 byte) in a single EVM word (32 bytes). Additionally, a\n * fallback mechanism can be used for every other case.\n *\n * Usage example:\n *\n * ```solidity\n * contract Named {\n * using ShortStrings for *;\n *\n * ShortString private immutable _name;\n * string private _nameFallback;\n *\n * constructor(string memory contractName) {\n * _name = contractName.toShortStringWithFallback(_nameFallback);\n * }\n *\n * function name() external view returns (string memory) {\n * return _name.toStringWithFallback(_nameFallback);\n * }\n * }\n * ```\n */\nlibrary ShortStrings {\n // Used as an identifier for strings longer than 31 bytes.\n bytes32 private constant FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;\n\n error StringTooLong(string str);\n error InvalidShortString();\n\n /**\n * @dev Encode a string of at most 31 chars into a `ShortString`.\n *\n * This will trigger a `StringTooLong` error is the input string is too long.\n */\n function toShortString(string memory str) internal pure returns (ShortString) {\n bytes memory bstr = bytes(str);\n if (bstr.length > 0x1f) {\n revert StringTooLong(str);\n }\n return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));\n }\n\n /**\n * @dev Decode a `ShortString` back to a \"normal\" string.\n */\n function toString(ShortString sstr) internal pure returns (string memory) {\n uint256 len = byteLength(sstr);\n // using `new string(len)` would work locally but is not memory safe.\n string memory str = new string(0x20);\n assembly (\"memory-safe\") {\n mstore(str, len)\n mstore(add(str, 0x20), sstr)\n }\n return str;\n }\n\n /**\n * @dev Return the length of a `ShortString`.\n */\n function byteLength(ShortString sstr) internal pure returns (uint256) {\n uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;\n if (result > 0x1f) {\n revert InvalidShortString();\n }\n return result;\n }\n\n /**\n * @dev Encode a string into a `ShortString`, or write it to storage if it is too long.\n */\n function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {\n if (bytes(value).length < 0x20) {\n return toShortString(value);\n } else {\n StorageSlot.getStringSlot(store).value = value;\n return ShortString.wrap(FALLBACK_SENTINEL);\n }\n }\n\n /**\n * @dev Decode a string that was encoded to `ShortString` or written to storage using {toShortStringWithFallback}.\n */\n function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {\n if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {\n return toString(value);\n } else {\n return store;\n }\n }\n\n /**\n * @dev Return the length of a string that was encoded to `ShortString` or written to storage using\n * {toShortStringWithFallback}.\n *\n * WARNING: This will return the \"byte length\" of the string. This may not reflect the actual length in terms of\n * actual characters as the UTF-8 encoding of a single character can span over multiple bytes.\n */\n function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {\n if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {\n return byteLength(value);\n } else {\n return bytes(store).length;\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC-1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n * // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(newImplementation.code.length > 0);\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * TIP: Consider using this library along with {SlotDerivation}.\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct Int256Slot {\n int256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns a `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns a `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns a `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns a `Int256Slot` with member `value` located at `slot`.\n */\n function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns a `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns a `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := store.slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.6.0) (utils/Strings.sol)\n\npragma solidity ^0.8.24;\n\nimport {Math} from \"./math/Math.sol\";\nimport {SafeCast} from \"./math/SafeCast.sol\";\nimport {SignedMath} from \"./math/SignedMath.sol\";\nimport {Bytes} from \"./Bytes.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n using SafeCast for *;\n\n bytes16 private constant HEX_DIGITS = \"0123456789abcdef\";\n uint8 private constant ADDRESS_LENGTH = 20;\n uint256 private constant SPECIAL_CHARS_LOOKUP =\n 0xffffffff | // first 32 bits corresponding to the control characters (U+0000 to U+001F)\n (1 << 0x22) | // double quote\n (1 << 0x5c); // backslash\n\n /**\n * @dev The `value` string doesn't fit in the specified `length`.\n */\n error StringsInsufficientHexLength(uint256 value, uint256 length);\n\n /**\n * @dev The string being parsed contains characters that are not in scope of the given base.\n */\n error StringsInvalidChar();\n\n /**\n * @dev The string being parsed is not a properly formatted address.\n */\n error StringsInvalidAddressFormat();\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n assembly (\"memory-safe\") {\n ptr := add(add(buffer, 0x20), length)\n }\n while (true) {\n ptr--;\n assembly (\"memory-safe\") {\n mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toStringSigned(int256 value) internal pure returns (string memory) {\n return string.concat(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value)));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n uint256 localValue = value;\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = HEX_DIGITS[localValue & 0xf];\n localValue >>= 4;\n }\n if (localValue != 0) {\n revert StringsInsufficientHexLength(value, length);\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal\n * representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its checksummed ASCII `string` hexadecimal\n * representation, according to EIP-55.\n */\n function toChecksumHexString(address addr) internal pure returns (string memory) {\n bytes memory buffer = bytes(toHexString(addr));\n\n // hash the hex part of buffer (skip length + 2 bytes, length 40)\n uint256 hashValue;\n assembly (\"memory-safe\") {\n hashValue := shr(96, keccak256(add(buffer, 0x22), 40))\n }\n\n for (uint256 i = 41; i > 1; --i) {\n // possible values for buffer[i] are 48 (0) to 57 (9) and 97 (a) to 102 (f)\n if (hashValue & 0xf > 7 && uint8(buffer[i]) > 96) {\n // case shift by xoring with 0x20\n buffer[i] ^= 0x20;\n }\n hashValue >>= 4;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `bytes` buffer to its ASCII `string` hexadecimal representation.\n */\n function toHexString(bytes memory input) internal pure returns (string memory) {\n unchecked {\n bytes memory buffer = new bytes(2 * input.length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 0; i < input.length; ++i) {\n uint8 v = uint8(input[i]);\n buffer[2 * i + 2] = HEX_DIGITS[v >> 4];\n buffer[2 * i + 3] = HEX_DIGITS[v & 0xf];\n }\n return string(buffer);\n }\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return Bytes.equal(bytes(a), bytes(b));\n }\n\n /**\n * @dev Parse a decimal string and returns the value as a `uint256`.\n *\n * Requirements:\n * - The string must be formatted as `[0-9]*`\n * - The result must fit into an `uint256` type\n */\n function parseUint(string memory input) internal pure returns (uint256) {\n return parseUint(input, 0, bytes(input).length);\n }\n\n /**\n * @dev Variant of {parseUint-string} that parses a substring of `input` located between position `begin` (included) and\n * `end` (excluded).\n *\n * Requirements:\n * - The substring must be formatted as `[0-9]*`\n * - The result must fit into an `uint256` type\n */\n function parseUint(string memory input, uint256 begin, uint256 end) internal pure returns (uint256) {\n (bool success, uint256 value) = tryParseUint(input, begin, end);\n if (!success) revert StringsInvalidChar();\n return value;\n }\n\n /**\n * @dev Variant of {parseUint-string} that returns false if the parsing fails because of an invalid character.\n *\n * NOTE: This function will revert if the result does not fit in a `uint256`.\n */\n function tryParseUint(string memory input) internal pure returns (bool success, uint256 value) {\n return _tryParseUintUncheckedBounds(input, 0, bytes(input).length);\n }\n\n /**\n * @dev Variant of {parseUint-string-uint256-uint256} that returns false if the parsing fails because of an invalid\n * character.\n *\n * NOTE: This function will revert if the result does not fit in a `uint256`.\n */\n function tryParseUint(\n string memory input,\n uint256 begin,\n uint256 end\n ) internal pure returns (bool success, uint256 value) {\n if (end > bytes(input).length || begin > end) return (false, 0);\n return _tryParseUintUncheckedBounds(input, begin, end);\n }\n\n /**\n * @dev Implementation of {tryParseUint-string-uint256-uint256} that does not check bounds. Caller should make sure that\n * `begin <= end <= input.length`. Other inputs would result in undefined behavior.\n */\n function _tryParseUintUncheckedBounds(\n string memory input,\n uint256 begin,\n uint256 end\n ) private pure returns (bool success, uint256 value) {\n bytes memory buffer = bytes(input);\n\n uint256 result = 0;\n for (uint256 i = begin; i < end; ++i) {\n uint8 chr = _tryParseChr(bytes1(_unsafeReadBytesOffset(buffer, i)));\n if (chr > 9) return (false, 0);\n result *= 10;\n result += chr;\n }\n return (true, result);\n }\n\n /**\n * @dev Parse a decimal string and returns the value as a `int256`.\n *\n * Requirements:\n * - The string must be formatted as `[-+]?[0-9]*`\n * - The result must fit in an `int256` type.\n */\n function parseInt(string memory input) internal pure returns (int256) {\n return parseInt(input, 0, bytes(input).length);\n }\n\n /**\n * @dev Variant of {parseInt-string} that parses a substring of `input` located between position `begin` (included) and\n * `end` (excluded).\n *\n * Requirements:\n * - The substring must be formatted as `[-+]?[0-9]*`\n * - The result must fit in an `int256` type.\n */\n function parseInt(string memory input, uint256 begin, uint256 end) internal pure returns (int256) {\n (bool success, int256 value) = tryParseInt(input, begin, end);\n if (!success) revert StringsInvalidChar();\n return value;\n }\n\n /**\n * @dev Variant of {parseInt-string} that returns false if the parsing fails because of an invalid character or if\n * the result does not fit in a `int256`.\n *\n * NOTE: This function will revert if the absolute value of the result does not fit in a `uint256`.\n */\n function tryParseInt(string memory input) internal pure returns (bool success, int256 value) {\n return _tryParseIntUncheckedBounds(input, 0, bytes(input).length);\n }\n\n uint256 private constant ABS_MIN_INT256 = 2 ** 255;\n\n /**\n * @dev Variant of {parseInt-string-uint256-uint256} that returns false if the parsing fails because of an invalid\n * character or if the result does not fit in a `int256`.\n *\n * NOTE: This function will revert if the absolute value of the result does not fit in a `uint256`.\n */\n function tryParseInt(\n string memory input,\n uint256 begin,\n uint256 end\n ) internal pure returns (bool success, int256 value) {\n if (end > bytes(input).length || begin > end) return (false, 0);\n return _tryParseIntUncheckedBounds(input, begin, end);\n }\n\n /**\n * @dev Implementation of {tryParseInt-string-uint256-uint256} that does not check bounds. Caller should make sure that\n * `begin <= end <= input.length`. Other inputs would result in undefined behavior.\n */\n function _tryParseIntUncheckedBounds(\n string memory input,\n uint256 begin,\n uint256 end\n ) private pure returns (bool success, int256 value) {\n bytes memory buffer = bytes(input);\n\n // Check presence of a negative sign.\n bytes1 sign = begin == end ? bytes1(0) : bytes1(_unsafeReadBytesOffset(buffer, begin)); // don't do out-of-bound (possibly unsafe) read if sub-string is empty\n bool positiveSign = sign == bytes1(\"+\");\n bool negativeSign = sign == bytes1(\"-\");\n uint256 offset = (positiveSign || negativeSign).toUint();\n\n (bool absSuccess, uint256 absValue) = tryParseUint(input, begin + offset, end);\n\n if (absSuccess && absValue < ABS_MIN_INT256) {\n return (true, negativeSign ? -int256(absValue) : int256(absValue));\n } else if (absSuccess && negativeSign && absValue == ABS_MIN_INT256) {\n return (true, type(int256).min);\n } else return (false, 0);\n }\n\n /**\n * @dev Parse a hexadecimal string (with or without \"0x\" prefix), and returns the value as a `uint256`.\n *\n * Requirements:\n * - The string must be formatted as `(0x)?[0-9a-fA-F]*`\n * - The result must fit in an `uint256` type.\n */\n function parseHexUint(string memory input) internal pure returns (uint256) {\n return parseHexUint(input, 0, bytes(input).length);\n }\n\n /**\n * @dev Variant of {parseHexUint-string} that parses a substring of `input` located between position `begin` (included) and\n * `end` (excluded).\n *\n * Requirements:\n * - The substring must be formatted as `(0x)?[0-9a-fA-F]*`\n * - The result must fit in an `uint256` type.\n */\n function parseHexUint(string memory input, uint256 begin, uint256 end) internal pure returns (uint256) {\n (bool success, uint256 value) = tryParseHexUint(input, begin, end);\n if (!success) revert StringsInvalidChar();\n return value;\n }\n\n /**\n * @dev Variant of {parseHexUint-string} that returns false if the parsing fails because of an invalid character.\n *\n * NOTE: This function will revert if the result does not fit in a `uint256`.\n */\n function tryParseHexUint(string memory input) internal pure returns (bool success, uint256 value) {\n return _tryParseHexUintUncheckedBounds(input, 0, bytes(input).length);\n }\n\n /**\n * @dev Variant of {parseHexUint-string-uint256-uint256} that returns false if the parsing fails because of an\n * invalid character.\n *\n * NOTE: This function will revert if the result does not fit in a `uint256`.\n */\n function tryParseHexUint(\n string memory input,\n uint256 begin,\n uint256 end\n ) internal pure returns (bool success, uint256 value) {\n if (end > bytes(input).length || begin > end) return (false, 0);\n return _tryParseHexUintUncheckedBounds(input, begin, end);\n }\n\n /**\n * @dev Implementation of {tryParseHexUint-string-uint256-uint256} that does not check bounds. Caller should make sure that\n * `begin <= end <= input.length`. Other inputs would result in undefined behavior.\n */\n function _tryParseHexUintUncheckedBounds(\n string memory input,\n uint256 begin,\n uint256 end\n ) private pure returns (bool success, uint256 value) {\n bytes memory buffer = bytes(input);\n\n // skip 0x prefix if present\n bool hasPrefix = (end > begin + 1) && bytes2(_unsafeReadBytesOffset(buffer, begin)) == bytes2(\"0x\"); // don't do out-of-bound (possibly unsafe) read if sub-string is empty\n uint256 offset = hasPrefix.toUint() * 2;\n\n uint256 result = 0;\n for (uint256 i = begin + offset; i < end; ++i) {\n uint8 chr = _tryParseChr(bytes1(_unsafeReadBytesOffset(buffer, i)));\n if (chr > 15) return (false, 0);\n result *= 16;\n unchecked {\n // Multiplying by 16 is equivalent to a shift of 4 bits (with additional overflow check).\n // This guarantees that adding a value < 16 will not cause an overflow, hence the unchecked.\n result += chr;\n }\n }\n return (true, result);\n }\n\n /**\n * @dev Parse a hexadecimal string (with or without \"0x\" prefix), and returns the value as an `address`.\n *\n * Requirements:\n * - The string must be formatted as `(0x)?[0-9a-fA-F]{40}`\n */\n function parseAddress(string memory input) internal pure returns (address) {\n return parseAddress(input, 0, bytes(input).length);\n }\n\n /**\n * @dev Variant of {parseAddress-string} that parses a substring of `input` located between position `begin` (included) and\n * `end` (excluded).\n *\n * Requirements:\n * - The substring must be formatted as `(0x)?[0-9a-fA-F]{40}`\n */\n function parseAddress(string memory input, uint256 begin, uint256 end) internal pure returns (address) {\n (bool success, address value) = tryParseAddress(input, begin, end);\n if (!success) revert StringsInvalidAddressFormat();\n return value;\n }\n\n /**\n * @dev Variant of {parseAddress-string} that returns false if the parsing fails because the input is not a properly\n * formatted address. See {parseAddress-string} requirements.\n */\n function tryParseAddress(string memory input) internal pure returns (bool success, address value) {\n return tryParseAddress(input, 0, bytes(input).length);\n }\n\n /**\n * @dev Variant of {parseAddress-string-uint256-uint256} that returns false if the parsing fails because input is not a properly\n * formatted address. See {parseAddress-string-uint256-uint256} requirements.\n */\n function tryParseAddress(\n string memory input,\n uint256 begin,\n uint256 end\n ) internal pure returns (bool success, address value) {\n if (end > bytes(input).length || begin > end) return (false, address(0));\n\n bool hasPrefix = (end > begin + 1) && bytes2(_unsafeReadBytesOffset(bytes(input), begin)) == bytes2(\"0x\"); // don't do out-of-bound (possibly unsafe) read if sub-string is empty\n uint256 expectedLength = 40 + hasPrefix.toUint() * 2;\n\n // check that input is the correct length\n if (end - begin == expectedLength) {\n // length guarantees that this does not overflow, and value is at most type(uint160).max\n (bool s, uint256 v) = _tryParseHexUintUncheckedBounds(input, begin, end);\n return (s, address(uint160(v)));\n } else {\n return (false, address(0));\n }\n }\n\n function _tryParseChr(bytes1 chr) private pure returns (uint8) {\n uint8 value = uint8(chr);\n\n // Try to parse `chr`:\n // - Case 1: [0-9]\n // - Case 2: [a-f]\n // - Case 3: [A-F]\n // - otherwise not supported\n unchecked {\n if (value > 47 && value < 58) value -= 48;\n else if (value > 96 && value < 103) value -= 87;\n else if (value > 64 && value < 71) value -= 55;\n else return type(uint8).max;\n }\n\n return value;\n }\n\n /**\n * @dev Escape special characters in JSON strings. This can be useful to prevent JSON injection in NFT metadata.\n *\n * WARNING: This function should only be used in double quoted JSON strings. Single quotes are not escaped.\n *\n * NOTE: This function escapes backslashes (including those in \\uXXXX sequences) and the characters in ranges\n * defined in section 2.5 of RFC-4627 (U+0000 to U+001F, U+0022 and U+005C). All control characters in U+0000\n * to U+001F are escaped (\\b, \\t, \\n, \\f, \\r use short form; others use \\u00XX). ECMAScript's `JSON.parse` does\n * recover escaped unicode characters that are not in this range, but other tooling may provide different results.\n */\n function escapeJSON(string memory input) internal pure returns (string memory) {\n bytes memory buffer = bytes(input);\n\n // Put output at the FMP. Memory will be reserved later when we figure out the actual length of the escaped\n // string. All write are done using _unsafeWriteBytesOffset, which avoid the (expensive) length checks for\n // each character written.\n bytes memory output;\n assembly (\"memory-safe\") {\n output := mload(0x40)\n }\n uint256 outputLength = 0;\n\n for (uint256 i = 0; i < buffer.length; ++i) {\n uint8 char = uint8(bytes1(_unsafeReadBytesOffset(buffer, i)));\n if (((SPECIAL_CHARS_LOOKUP & (1 << char)) != 0)) {\n _unsafeWriteBytesOffset(output, outputLength++, \"\\\\\");\n if (char == 0x08) _unsafeWriteBytesOffset(output, outputLength++, \"b\");\n else if (char == 0x09) _unsafeWriteBytesOffset(output, outputLength++, \"t\");\n else if (char == 0x0a) _unsafeWriteBytesOffset(output, outputLength++, \"n\");\n else if (char == 0x0c) _unsafeWriteBytesOffset(output, outputLength++, \"f\");\n else if (char == 0x0d) _unsafeWriteBytesOffset(output, outputLength++, \"r\");\n else if (char == 0x5c) _unsafeWriteBytesOffset(output, outputLength++, \"\\\\\");\n else if (char == 0x22) {\n // solhint-disable-next-line quotes\n _unsafeWriteBytesOffset(output, outputLength++, '\"');\n } else {\n // U+0000 to U+001F without short form: output \\u00XX\n _unsafeWriteBytesOffset(output, outputLength++, \"u\");\n _unsafeWriteBytesOffset(output, outputLength++, \"0\");\n _unsafeWriteBytesOffset(output, outputLength++, \"0\");\n _unsafeWriteBytesOffset(output, outputLength++, HEX_DIGITS[char >> 4]);\n _unsafeWriteBytesOffset(output, outputLength++, HEX_DIGITS[char & 0x0f]);\n }\n } else {\n _unsafeWriteBytesOffset(output, outputLength++, bytes1(char));\n }\n }\n // write the actual length and reserve memory\n assembly (\"memory-safe\") {\n mstore(output, outputLength)\n mstore(0x40, add(output, add(outputLength, 0x20)))\n }\n\n return string(output);\n }\n\n /**\n * @dev Reads a bytes32 from a bytes array without bounds checking.\n *\n * NOTE: making this function internal would mean it could be used with memory unsafe offset, and marking the\n * assembly block as such would prevent some optimizations.\n */\n function _unsafeReadBytesOffset(bytes memory buffer, uint256 offset) private pure returns (bytes32 value) {\n // This is not memory safe in the general case, but all calls to this private function are within bounds.\n assembly (\"memory-safe\") {\n value := mload(add(add(buffer, 0x20), offset))\n }\n }\n\n /**\n * @dev Write a bytes1 to a bytes array without bounds checking.\n *\n * NOTE: making this function internal would mean it could be used with memory unsafe offset, and marking the\n * assembly block as such would prevent some optimizations.\n */\n function _unsafeWriteBytesOffset(bytes memory buffer, uint256 offset, bytes1 value) private pure {\n // This is not memory safe in the general case, but all calls to this private function are within bounds.\n assembly (\"memory-safe\") {\n mstore8(add(add(buffer, 0x20), offset), shr(248, value))\n }\n }\n}\n" + }, + "contracts/TokenRelayer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.28;\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC20Permit} from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\";\nimport {ECDSA} from \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport {EIP712} from \"@openzeppelin/contracts/utils/cryptography/EIP712.sol\";\n\n/**\n * @title TokenRelayer\n * @notice A relayer contract that accepts ERC20 permit signatures and executes\n * arbitrary calls to a destination contract, both authorized via signature.\n * \n * Flow:\n * 1. User signs a permit allowing the relayer to spend their tokens\n * 2. User signs a payload (e.g., transfer from relayer to another user)\n * 3. Relayer:\n * a. Executes permit to approve the tokens\n * b. Transfers tokens from user to relayer (via transferFrom)\n * c. Forwards the payload call (transfer from relayer to another user)\n */\ncontract TokenRelayer is Ownable, ReentrancyGuard, EIP712 {\n using SafeERC20 for IERC20;\n\n // Using OZ EIP712 for domain separator management\n bytes32 private constant _TYPE_HASH_PAYLOAD = keccak256(\n \"Payload(address destination,address owner,address token,uint256 value,bytes data,uint256 ethValue,uint256 nonce,uint256 deadline)\"\n );\n\n address public immutable destinationContract;\n\n mapping(address => mapping(uint256 => bool)) public usedPayloadNonces;\n // Removed redundant executedCalls mapping — usedPayloadNonces is sufficient\n\n struct ExecuteParams {\n address token;\n address owner;\n uint256 value;\n uint256 deadline;\n uint8 permitV;\n bytes32 permitR;\n bytes32 permitS;\n bytes payloadData;\n uint256 payloadValue;\n uint256 payloadNonce;\n uint256 payloadDeadline;\n uint8 payloadV;\n bytes32 payloadR;\n bytes32 payloadS;\n }\n\n event RelayerExecuted(\n address indexed signer,\n address indexed token,\n uint256 amount\n );\n\n // Events for withdrawal operations\n event TokenWithdrawn(address indexed token, uint256 amount, address indexed to);\n event ETHWithdrawn(uint256 amount, address indexed to);\n\n // Ownable constructor sets deployer as owner; EIP712 constructor\n constructor(address _destinationContract)\n Ownable(msg.sender)\n EIP712(\"TokenRelayer\", \"1\")\n {\n require(_destinationContract != address(0), \"Invalid destination\");\n destinationContract = _destinationContract;\n }\n\n // Allow contract to receive ETH (e.g., refunds from destination)\n receive() external payable {}\n\n // nonReentrant modifier prevents reentrancy via _forwardCall\n // Removed redundant bool return — function reverts on failure\n function execute(ExecuteParams calldata params) external payable nonReentrant {\n address owner = params.owner;\n uint256 nonce = params.payloadNonce;\n\n // --- Checks ---\n require(owner != address(0), \"Invalid owner\");\n require(params.token != address(0), \"Invalid token\");\n require(!usedPayloadNonces[owner][nonce], \"Nonce used\");\n require(block.timestamp <= params.payloadDeadline, \"Payload expired\");\n\n // Verify payload signature and validate signed destination\n bytes32 digest = _computeDigest(\n owner,\n params.token,\n params.value,\n params.payloadData,\n params.payloadValue,\n nonce,\n params.payloadDeadline\n );\n // Using ECDSA.recover() which enforces low-s and rejects address(0)\n require(ECDSA.recover(digest, params.payloadV, params.payloadR, params.payloadS) == owner, \"Invalid sig\");\n\n require(msg.value == params.payloadValue, \"Incorrect ETH value provided\");\n\n // --- Effects (before interactions per CEI pattern) ---\n // State changes before any external calls\n usedPayloadNonces[owner][nonce] = true;\n\n // --- Interactions ---\n // permit wrapped in try-catch for front-run resilience\n _executePermitAndTransfer(\n params.token,\n owner,\n params.value,\n params.deadline,\n params.permitV,\n params.permitR,\n params.permitS\n );\n\n // Approve exact amount, forward call, then revoke\n IERC20(params.token).forceApprove(destinationContract, params.value);\n\n bool callSuccess = _forwardCall(params.payloadData, msg.value);\n require(callSuccess, \"Call failed\");\n\n // Revoke approval after the call to prevent residual allowance\n IERC20(params.token).forceApprove(destinationContract, 0);\n\n emit RelayerExecuted(owner, params.token, params.value);\n }\n\n // Using inherited _hashTypedDataV4 from OZ EIP712\n function _computeDigest(\n address owner,\n address token,\n uint256 value,\n bytes memory data,\n uint256 ethValue,\n uint256 nonce,\n uint256 deadline\n ) private view returns (bytes32) {\n return _hashTypedDataV4(\n keccak256(abi.encode(\n _TYPE_HASH_PAYLOAD,\n destinationContract, // [H-2] destination is always destinationContract\n owner,\n token,\n value,\n keccak256(data),\n ethValue,\n nonce,\n deadline\n ))\n );\n }\n\n /**\n * @dev Execute permit approval and then transfer tokens from owner to self (relayer).\n * Permit is wrapped in try-catch: if it was front-run, we check\n * that the allowance is already sufficient before proceeding.\n */\n function _executePermitAndTransfer(\n address token,\n address owner,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n // Wrap permit in try-catch for front-run resilience\n try IERC20Permit(token).permit(owner, address(this), value, deadline, v, r, s) {\n // permit succeeded\n } catch {\n // permit was front-run, verify allowance is sufficient\n require(\n IERC20(token).allowance(owner, address(this)) >= value,\n \"Permit failed and insufficient allowance\"\n );\n }\n\n // Transfer tokens from owner to this contract\n IERC20(token).safeTransferFrom(owner, address(this), value);\n }\n\n function _forwardCall(bytes memory data, uint256 value) internal returns (bool) {\n (bool success, ) = destinationContract.call{value: value}(data);\n return success;\n }\n\n /**\n * @notice Allows the owner to recover any ERC20 tokens held by this contract.\n * @param token The ERC20 token contract address.\n * @param amount The amount of tokens to transfer to the owner.\n */\n // Using Ownable's onlyOwner instead of manual deployer check\n // Added TokenWithdrawn event\n function withdrawToken(address token, uint256 amount) external onlyOwner {\n IERC20(token).safeTransfer(owner(), amount);\n emit TokenWithdrawn(token, amount, owner());\n }\n\n /**\n * @notice Allows the owner to recover any native ETH held by this contract.\n * @param amount The amount of ETH to transfer to the owner.\n */\n // ETH recovery function\n function withdrawETH(uint256 amount) external onlyOwner {\n (bool success, ) = owner().call{value: amount}(\"\");\n require(success, \"ETH transfer failed\");\n emit ETHWithdrawn(amount, owner());\n }\n\n // Using usedPayloadNonces instead of redundant executedCalls\n function isExecutionCompleted(address signer, uint256 nonce) external view returns (bool) {\n return usedPayloadNonces[signer][nonce];\n }\n}\n" + } + }, + "settings": { + "evmVersion": "cancun", + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata" + ], + "": [ + "ast" + ] + } + } + } + }, + "output": { + "sources": { + "@openzeppelin/contracts/access/Ownable.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/access/Ownable.sol", + "exportedSymbols": { + "Context": [ + 1662 + ], + "Ownable": [ + 147 + ] + }, + "id": 148, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "102:24:0" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/Context.sol", + "file": "../utils/Context.sol", + "id": 3, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 148, + "sourceUnit": 1663, + "src": "128:45:0", + "symbolAliases": [ + { + "foreign": { + "id": 2, + "name": "Context", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1662, + "src": "136:7:0", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": true, + "baseContracts": [ + { + "baseName": { + "id": 5, + "name": "Context", + "nameLocations": [ + "692:7:0" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1662, + "src": "692:7:0" + }, + "id": 6, + "nodeType": "InheritanceSpecifier", + "src": "692:7:0" + } + ], + "canonicalName": "Ownable", + "contractDependencies": [], + "contractKind": "contract", + "documentation": { + "id": 4, + "nodeType": "StructuredDocumentation", + "src": "175:487:0", + "text": " @dev Contract module which provides a basic access control mechanism, where\n there is an account (an owner) that can be granted exclusive access to\n specific functions.\n The initial owner is set to the address provided by the deployer. This can\n later be changed with {transferOwnership}.\n This module is used through inheritance. It will make available the modifier\n `onlyOwner`, which can be applied to your functions to restrict their use to\n the owner." + }, + "fullyImplemented": true, + "id": 147, + "linearizedBaseContracts": [ + 147, + 1662 + ], + "name": "Ownable", + "nameLocation": "681:7:0", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": false, + "id": 8, + "mutability": "mutable", + "name": "_owner", + "nameLocation": "722:6:0", + "nodeType": "VariableDeclaration", + "scope": 147, + "src": "706:22:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 7, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "706:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "private" + }, + { + "documentation": { + "id": 9, + "nodeType": "StructuredDocumentation", + "src": "735:85:0", + "text": " @dev The caller account is not authorized to perform an operation." + }, + "errorSelector": "118cdaa7", + "id": 13, + "name": "OwnableUnauthorizedAccount", + "nameLocation": "831:26:0", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 12, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 11, + "mutability": "mutable", + "name": "account", + "nameLocation": "866:7:0", + "nodeType": "VariableDeclaration", + "scope": 13, + "src": "858:15:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 10, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "858:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "857:17:0" + }, + "src": "825:50:0" + }, + { + "documentation": { + "id": 14, + "nodeType": "StructuredDocumentation", + "src": "881:82:0", + "text": " @dev The owner is not a valid owner account. (eg. `address(0)`)" + }, + "errorSelector": "1e4fbdf7", + "id": 18, + "name": "OwnableInvalidOwner", + "nameLocation": "974:19:0", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 17, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 16, + "mutability": "mutable", + "name": "owner", + "nameLocation": "1002:5:0", + "nodeType": "VariableDeclaration", + "scope": 18, + "src": "994:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 15, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "994:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "993:15:0" + }, + "src": "968:41:0" + }, + { + "anonymous": false, + "eventSelector": "8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "id": 24, + "name": "OwnershipTransferred", + "nameLocation": "1021:20:0", + "nodeType": "EventDefinition", + "parameters": { + "id": 23, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 20, + "indexed": true, + "mutability": "mutable", + "name": "previousOwner", + "nameLocation": "1058:13:0", + "nodeType": "VariableDeclaration", + "scope": 24, + "src": "1042:29:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 19, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1042:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 22, + "indexed": true, + "mutability": "mutable", + "name": "newOwner", + "nameLocation": "1089:8:0", + "nodeType": "VariableDeclaration", + "scope": 24, + "src": "1073:24:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 21, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1073:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "1041:57:0" + }, + "src": "1015:84:0" + }, + { + "body": { + "id": 49, + "nodeType": "Block", + "src": "1259:153:0", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 35, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 30, + "name": "initialOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 27, + "src": "1273:12:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 33, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1297:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 32, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1289:7:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 31, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1289:7:0", + "typeDescriptions": {} + } + }, + "id": 34, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1289:10:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "1273:26:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 44, + "nodeType": "IfStatement", + "src": "1269:95:0", + "trueBody": { + "id": 43, + "nodeType": "Block", + "src": "1301:63:0", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "hexValue": "30", + "id": 39, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1350:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 38, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1342:7:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 37, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1342:7:0", + "typeDescriptions": {} + } + }, + "id": 40, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1342:10:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 36, + "name": "OwnableInvalidOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 18, + "src": "1322:19:0", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 41, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1322:31:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 42, + "nodeType": "RevertStatement", + "src": "1315:38:0" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 46, + "name": "initialOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 27, + "src": "1392:12:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 45, + "name": "_transferOwnership", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 146, + "src": "1373:18:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$__$", + "typeString": "function (address)" + } + }, + "id": 47, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1373:32:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 48, + "nodeType": "ExpressionStatement", + "src": "1373:32:0" + } + ] + }, + "documentation": { + "id": 25, + "nodeType": "StructuredDocumentation", + "src": "1105:115:0", + "text": " @dev Initializes the contract setting the address provided by the deployer as the initial owner." + }, + "id": 50, + "implemented": true, + "kind": "constructor", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 28, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 27, + "mutability": "mutable", + "name": "initialOwner", + "nameLocation": "1245:12:0", + "nodeType": "VariableDeclaration", + "scope": 50, + "src": "1237:20:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 26, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1237:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "1236:22:0" + }, + "returnParameters": { + "id": 29, + "nodeType": "ParameterList", + "parameters": [], + "src": "1259:0:0" + }, + "scope": 147, + "src": "1225:187:0", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 57, + "nodeType": "Block", + "src": "1521:41:0", + "statements": [ + { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 53, + "name": "_checkOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 84, + "src": "1531:11:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$__$", + "typeString": "function () view" + } + }, + "id": 54, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1531:13:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 55, + "nodeType": "ExpressionStatement", + "src": "1531:13:0" + }, + { + "id": 56, + "nodeType": "PlaceholderStatement", + "src": "1554:1:0" + } + ] + }, + "documentation": { + "id": 51, + "nodeType": "StructuredDocumentation", + "src": "1418:77:0", + "text": " @dev Throws if called by any account other than the owner." + }, + "id": 58, + "name": "onlyOwner", + "nameLocation": "1509:9:0", + "nodeType": "ModifierDefinition", + "parameters": { + "id": 52, + "nodeType": "ParameterList", + "parameters": [], + "src": "1518:2:0" + }, + "src": "1500:62:0", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 66, + "nodeType": "Block", + "src": "1693:30:0", + "statements": [ + { + "expression": { + "id": 64, + "name": "_owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "1710:6:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 63, + "id": 65, + "nodeType": "Return", + "src": "1703:13:0" + } + ] + }, + "documentation": { + "id": 59, + "nodeType": "StructuredDocumentation", + "src": "1568:65:0", + "text": " @dev Returns the address of the current owner." + }, + "functionSelector": "8da5cb5b", + "id": 67, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "owner", + "nameLocation": "1647:5:0", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 60, + "nodeType": "ParameterList", + "parameters": [], + "src": "1652:2:0" + }, + "returnParameters": { + "id": 63, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 62, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 67, + "src": "1684:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 61, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1684:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "1683:9:0" + }, + "scope": 147, + "src": "1638:85:0", + "stateMutability": "view", + "virtual": true, + "visibility": "public" + }, + { + "body": { + "id": 83, + "nodeType": "Block", + "src": "1841:117:0", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 75, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 71, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 67, + "src": "1855:5:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", + "typeString": "function () view returns (address)" + } + }, + "id": 72, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1855:7:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 73, + "name": "_msgSender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1644, + "src": "1866:10:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", + "typeString": "function () view returns (address)" + } + }, + "id": 74, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1866:12:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "1855:23:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 82, + "nodeType": "IfStatement", + "src": "1851:101:0", + "trueBody": { + "id": 81, + "nodeType": "Block", + "src": "1880:72:0", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 77, + "name": "_msgSender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1644, + "src": "1928:10:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", + "typeString": "function () view returns (address)" + } + }, + "id": 78, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1928:12:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 76, + "name": "OwnableUnauthorizedAccount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 13, + "src": "1901:26:0", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 79, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1901:40:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 80, + "nodeType": "RevertStatement", + "src": "1894:47:0" + } + ] + } + } + ] + }, + "documentation": { + "id": 68, + "nodeType": "StructuredDocumentation", + "src": "1729:62:0", + "text": " @dev Throws if the sender is not the owner." + }, + "id": 84, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_checkOwner", + "nameLocation": "1805:11:0", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 69, + "nodeType": "ParameterList", + "parameters": [], + "src": "1816:2:0" + }, + "returnParameters": { + "id": 70, + "nodeType": "ParameterList", + "parameters": [], + "src": "1841:0:0" + }, + "scope": 147, + "src": "1796:162:0", + "stateMutability": "view", + "virtual": true, + "visibility": "internal" + }, + { + "body": { + "id": 97, + "nodeType": "Block", + "src": "2347:47:0", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "hexValue": "30", + "id": 93, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2384:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 92, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2376:7:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 91, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2376:7:0", + "typeDescriptions": {} + } + }, + "id": 94, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2376:10:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 90, + "name": "_transferOwnership", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 146, + "src": "2357:18:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$__$", + "typeString": "function (address)" + } + }, + "id": 95, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2357:30:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 96, + "nodeType": "ExpressionStatement", + "src": "2357:30:0" + } + ] + }, + "documentation": { + "id": 85, + "nodeType": "StructuredDocumentation", + "src": "1964:324:0", + "text": " @dev Leaves the contract without owner. It will not be possible to call\n `onlyOwner` functions. Can only be called by the current owner.\n NOTE: Renouncing ownership will leave the contract without an owner,\n thereby disabling any functionality that is only available to the owner." + }, + "functionSelector": "715018a6", + "id": 98, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 88, + "kind": "modifierInvocation", + "modifierName": { + "id": 87, + "name": "onlyOwner", + "nameLocations": [ + "2337:9:0" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 58, + "src": "2337:9:0" + }, + "nodeType": "ModifierInvocation", + "src": "2337:9:0" + } + ], + "name": "renounceOwnership", + "nameLocation": "2302:17:0", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 86, + "nodeType": "ParameterList", + "parameters": [], + "src": "2319:2:0" + }, + "returnParameters": { + "id": 89, + "nodeType": "ParameterList", + "parameters": [], + "src": "2347:0:0" + }, + "scope": 147, + "src": "2293:101:0", + "stateMutability": "nonpayable", + "virtual": true, + "visibility": "public" + }, + { + "body": { + "id": 125, + "nodeType": "Block", + "src": "2613:145:0", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 111, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 106, + "name": "newOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 101, + "src": "2627:8:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 109, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2647:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 108, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2639:7:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 107, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2639:7:0", + "typeDescriptions": {} + } + }, + "id": 110, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2639:10:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "2627:22:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 120, + "nodeType": "IfStatement", + "src": "2623:91:0", + "trueBody": { + "id": 119, + "nodeType": "Block", + "src": "2651:63:0", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "hexValue": "30", + "id": 115, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2700:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 114, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2692:7:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 113, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2692:7:0", + "typeDescriptions": {} + } + }, + "id": 116, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2692:10:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 112, + "name": "OwnableInvalidOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 18, + "src": "2672:19:0", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 117, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2672:31:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 118, + "nodeType": "RevertStatement", + "src": "2665:38:0" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 122, + "name": "newOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 101, + "src": "2742:8:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 121, + "name": "_transferOwnership", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 146, + "src": "2723:18:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$__$", + "typeString": "function (address)" + } + }, + "id": 123, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2723:28:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 124, + "nodeType": "ExpressionStatement", + "src": "2723:28:0" + } + ] + }, + "documentation": { + "id": 99, + "nodeType": "StructuredDocumentation", + "src": "2400:138:0", + "text": " @dev Transfers ownership of the contract to a new account (`newOwner`).\n Can only be called by the current owner." + }, + "functionSelector": "f2fde38b", + "id": 126, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 104, + "kind": "modifierInvocation", + "modifierName": { + "id": 103, + "name": "onlyOwner", + "nameLocations": [ + "2603:9:0" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 58, + "src": "2603:9:0" + }, + "nodeType": "ModifierInvocation", + "src": "2603:9:0" + } + ], + "name": "transferOwnership", + "nameLocation": "2552:17:0", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 102, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 101, + "mutability": "mutable", + "name": "newOwner", + "nameLocation": "2578:8:0", + "nodeType": "VariableDeclaration", + "scope": 126, + "src": "2570:16:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 100, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2570:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "2569:18:0" + }, + "returnParameters": { + "id": 105, + "nodeType": "ParameterList", + "parameters": [], + "src": "2613:0:0" + }, + "scope": 147, + "src": "2543:215:0", + "stateMutability": "nonpayable", + "virtual": true, + "visibility": "public" + }, + { + "body": { + "id": 145, + "nodeType": "Block", + "src": "2975:124:0", + "statements": [ + { + "assignments": [ + 133 + ], + "declarations": [ + { + "constant": false, + "id": 133, + "mutability": "mutable", + "name": "oldOwner", + "nameLocation": "2993:8:0", + "nodeType": "VariableDeclaration", + "scope": 145, + "src": "2985:16:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 132, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2985:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "id": 135, + "initialValue": { + "id": 134, + "name": "_owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "3004:6:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2985:25:0" + }, + { + "expression": { + "id": 138, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 136, + "name": "_owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "3020:6:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 137, + "name": "newOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 129, + "src": "3029:8:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "3020:17:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 139, + "nodeType": "ExpressionStatement", + "src": "3020:17:0" + }, + { + "eventCall": { + "arguments": [ + { + "id": 141, + "name": "oldOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 133, + "src": "3073:8:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 142, + "name": "newOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 129, + "src": "3083:8:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 140, + "name": "OwnershipTransferred", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "3052:20:0", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$returns$__$", + "typeString": "function (address,address)" + } + }, + "id": 143, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3052:40:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 144, + "nodeType": "EmitStatement", + "src": "3047:45:0" + } + ] + }, + "documentation": { + "id": 127, + "nodeType": "StructuredDocumentation", + "src": "2764:143:0", + "text": " @dev Transfers ownership of the contract to a new account (`newOwner`).\n Internal function without access restriction." + }, + "id": 146, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_transferOwnership", + "nameLocation": "2921:18:0", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 130, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 129, + "mutability": "mutable", + "name": "newOwner", + "nameLocation": "2948:8:0", + "nodeType": "VariableDeclaration", + "scope": 146, + "src": "2940:16:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 128, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2940:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "2939:18:0" + }, + "returnParameters": { + "id": 131, + "nodeType": "ParameterList", + "parameters": [], + "src": "2975:0:0" + }, + "scope": 147, + "src": "2912:187:0", + "stateMutability": "nonpayable", + "virtual": true, + "visibility": "internal" + } + ], + "scope": 148, + "src": "663:2438:0", + "usedErrors": [ + 13, + 18 + ], + "usedEvents": [ + 24 + ] + } + ], + "src": "102:3000:0" + }, + "id": 0 + }, + "@openzeppelin/contracts/interfaces/IERC1363.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/interfaces/IERC1363.sol", + "exportedSymbols": { + "IERC1363": [ + 229 + ], + "IERC165": [ + 4547 + ], + "IERC20": [ + 340 + ] + }, + "id": 230, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 149, + "literals": [ + "solidity", + ">=", + "0.6", + ".2" + ], + "nodeType": "PragmaDirective", + "src": "107:24:1" + }, + { + "absolutePath": "@openzeppelin/contracts/interfaces/IERC20.sol", + "file": "./IERC20.sol", + "id": 151, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 230, + "sourceUnit": 238, + "src": "133:36:1", + "symbolAliases": [ + { + "foreign": { + "id": 150, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "141:6:1", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/interfaces/IERC165.sol", + "file": "./IERC165.sol", + "id": 153, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 230, + "sourceUnit": 234, + "src": "170:38:1", + "symbolAliases": [ + { + "foreign": { + "id": 152, + "name": "IERC165", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4547, + "src": "178:7:1", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [ + { + "baseName": { + "id": 155, + "name": "IERC20", + "nameLocations": [ + "590:6:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "590:6:1" + }, + "id": 156, + "nodeType": "InheritanceSpecifier", + "src": "590:6:1" + }, + { + "baseName": { + "id": 157, + "name": "IERC165", + "nameLocations": [ + "598:7:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4547, + "src": "598:7:1" + }, + "id": 158, + "nodeType": "InheritanceSpecifier", + "src": "598:7:1" + } + ], + "canonicalName": "IERC1363", + "contractDependencies": [], + "contractKind": "interface", + "documentation": { + "id": 154, + "nodeType": "StructuredDocumentation", + "src": "210:357:1", + "text": " @title IERC1363\n @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].\n Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract\n after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction." + }, + "fullyImplemented": false, + "id": 229, + "linearizedBaseContracts": [ + 229, + 4547, + 340 + ], + "name": "IERC1363", + "nameLocation": "578:8:1", + "nodeType": "ContractDefinition", + "nodes": [ + { + "documentation": { + "id": 159, + "nodeType": "StructuredDocumentation", + "src": "1148:370:1", + "text": " @dev Moves a `value` amount of tokens from the caller's account to `to`\n and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n @param to The address which you want to transfer to.\n @param value The amount of tokens to be transferred.\n @return A boolean value indicating whether the operation succeeded unless throwing." + }, + "functionSelector": "1296ee62", + "id": 168, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "transferAndCall", + "nameLocation": "1532:15:1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 164, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 161, + "mutability": "mutable", + "name": "to", + "nameLocation": "1556:2:1", + "nodeType": "VariableDeclaration", + "scope": 168, + "src": "1548:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 160, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1548:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 163, + "mutability": "mutable", + "name": "value", + "nameLocation": "1568:5:1", + "nodeType": "VariableDeclaration", + "scope": 168, + "src": "1560:13:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 162, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1560:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1547:27:1" + }, + "returnParameters": { + "id": 167, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 166, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 168, + "src": "1593:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 165, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "1593:4:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "1592:6:1" + }, + "scope": 229, + "src": "1523:76:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 169, + "nodeType": "StructuredDocumentation", + "src": "1605:453:1", + "text": " @dev Moves a `value` amount of tokens from the caller's account to `to`\n and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n @param to The address which you want to transfer to.\n @param value The amount of tokens to be transferred.\n @param data Additional data with no specified format, sent in call to `to`.\n @return A boolean value indicating whether the operation succeeded unless throwing." + }, + "functionSelector": "4000aea0", + "id": 180, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "transferAndCall", + "nameLocation": "2072:15:1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 176, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 171, + "mutability": "mutable", + "name": "to", + "nameLocation": "2096:2:1", + "nodeType": "VariableDeclaration", + "scope": 180, + "src": "2088:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 170, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2088:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 173, + "mutability": "mutable", + "name": "value", + "nameLocation": "2108:5:1", + "nodeType": "VariableDeclaration", + "scope": 180, + "src": "2100:13:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 172, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2100:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 175, + "mutability": "mutable", + "name": "data", + "nameLocation": "2130:4:1", + "nodeType": "VariableDeclaration", + "scope": 180, + "src": "2115:19:1", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 174, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2115:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "2087:48:1" + }, + "returnParameters": { + "id": 179, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 178, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 180, + "src": "2154:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 177, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "2154:4:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "2153:6:1" + }, + "scope": 229, + "src": "2063:97:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 181, + "nodeType": "StructuredDocumentation", + "src": "2166:453:1", + "text": " @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n @param from The address which you want to send tokens from.\n @param to The address which you want to transfer to.\n @param value The amount of tokens to be transferred.\n @return A boolean value indicating whether the operation succeeded unless throwing." + }, + "functionSelector": "d8fbe994", + "id": 192, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "transferFromAndCall", + "nameLocation": "2633:19:1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 188, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 183, + "mutability": "mutable", + "name": "from", + "nameLocation": "2661:4:1", + "nodeType": "VariableDeclaration", + "scope": 192, + "src": "2653:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 182, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2653:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 185, + "mutability": "mutable", + "name": "to", + "nameLocation": "2675:2:1", + "nodeType": "VariableDeclaration", + "scope": 192, + "src": "2667:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 184, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2667:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 187, + "mutability": "mutable", + "name": "value", + "nameLocation": "2687:5:1", + "nodeType": "VariableDeclaration", + "scope": 192, + "src": "2679:13:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 186, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2679:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2652:41:1" + }, + "returnParameters": { + "id": 191, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 190, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 192, + "src": "2712:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 189, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "2712:4:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "2711:6:1" + }, + "scope": 229, + "src": "2624:94:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 193, + "nodeType": "StructuredDocumentation", + "src": "2724:536:1", + "text": " @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n @param from The address which you want to send tokens from.\n @param to The address which you want to transfer to.\n @param value The amount of tokens to be transferred.\n @param data Additional data with no specified format, sent in call to `to`.\n @return A boolean value indicating whether the operation succeeded unless throwing." + }, + "functionSelector": "c1d34b89", + "id": 206, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "transferFromAndCall", + "nameLocation": "3274:19:1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 202, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 195, + "mutability": "mutable", + "name": "from", + "nameLocation": "3302:4:1", + "nodeType": "VariableDeclaration", + "scope": 206, + "src": "3294:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 194, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3294:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 197, + "mutability": "mutable", + "name": "to", + "nameLocation": "3316:2:1", + "nodeType": "VariableDeclaration", + "scope": 206, + "src": "3308:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 196, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3308:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 199, + "mutability": "mutable", + "name": "value", + "nameLocation": "3328:5:1", + "nodeType": "VariableDeclaration", + "scope": 206, + "src": "3320:13:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 198, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3320:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 201, + "mutability": "mutable", + "name": "data", + "nameLocation": "3350:4:1", + "nodeType": "VariableDeclaration", + "scope": 206, + "src": "3335:19:1", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 200, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3335:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "3293:62:1" + }, + "returnParameters": { + "id": 205, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 204, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 206, + "src": "3374:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 203, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "3374:4:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "3373:6:1" + }, + "scope": 229, + "src": "3265:115:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 207, + "nodeType": "StructuredDocumentation", + "src": "3386:390:1", + "text": " @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n @param spender The address which will spend the funds.\n @param value The amount of tokens to be spent.\n @return A boolean value indicating whether the operation succeeded unless throwing." + }, + "functionSelector": "3177029f", + "id": 216, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "approveAndCall", + "nameLocation": "3790:14:1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 212, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 209, + "mutability": "mutable", + "name": "spender", + "nameLocation": "3813:7:1", + "nodeType": "VariableDeclaration", + "scope": 216, + "src": "3805:15:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 208, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3805:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 211, + "mutability": "mutable", + "name": "value", + "nameLocation": "3830:5:1", + "nodeType": "VariableDeclaration", + "scope": 216, + "src": "3822:13:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 210, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3822:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3804:32:1" + }, + "returnParameters": { + "id": 215, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 214, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 216, + "src": "3855:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 213, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "3855:4:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "3854:6:1" + }, + "scope": 229, + "src": "3781:80:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 217, + "nodeType": "StructuredDocumentation", + "src": "3867:478:1", + "text": " @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n @param spender The address which will spend the funds.\n @param value The amount of tokens to be spent.\n @param data Additional data with no specified format, sent in call to `spender`.\n @return A boolean value indicating whether the operation succeeded unless throwing." + }, + "functionSelector": "cae9ca51", + "id": 228, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "approveAndCall", + "nameLocation": "4359:14:1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 224, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 219, + "mutability": "mutable", + "name": "spender", + "nameLocation": "4382:7:1", + "nodeType": "VariableDeclaration", + "scope": 228, + "src": "4374:15:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 218, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "4374:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 221, + "mutability": "mutable", + "name": "value", + "nameLocation": "4399:5:1", + "nodeType": "VariableDeclaration", + "scope": 228, + "src": "4391:13:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 220, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4391:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 223, + "mutability": "mutable", + "name": "data", + "nameLocation": "4421:4:1", + "nodeType": "VariableDeclaration", + "scope": 228, + "src": "4406:19:1", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 222, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4406:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "4373:53:1" + }, + "returnParameters": { + "id": 227, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 226, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 228, + "src": "4445:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 225, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "4445:4:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "4444:6:1" + }, + "scope": 229, + "src": "4350:101:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + } + ], + "scope": 230, + "src": "568:3885:1", + "usedErrors": [], + "usedEvents": [ + 274, + 283 + ] + } + ], + "src": "107:4347:1" + }, + "id": 1 + }, + "@openzeppelin/contracts/interfaces/IERC165.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/interfaces/IERC165.sol", + "exportedSymbols": { + "IERC165": [ + 4547 + ] + }, + "id": 234, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 231, + "literals": [ + "solidity", + ">=", + "0.4", + ".16" + ], + "nodeType": "PragmaDirective", + "src": "106:25:2" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/introspection/IERC165.sol", + "file": "../utils/introspection/IERC165.sol", + "id": 233, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 234, + "sourceUnit": 4548, + "src": "133:59:2", + "symbolAliases": [ + { + "foreign": { + "id": 232, + "name": "IERC165", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4547, + "src": "141:7:2", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + } + ], + "src": "106:87:2" + }, + "id": 2 + }, + "@openzeppelin/contracts/interfaces/IERC20.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/interfaces/IERC20.sol", + "exportedSymbols": { + "IERC20": [ + 340 + ] + }, + "id": 238, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 235, + "literals": [ + "solidity", + ">=", + "0.4", + ".16" + ], + "nodeType": "PragmaDirective", + "src": "105:25:3" + }, + { + "absolutePath": "@openzeppelin/contracts/token/ERC20/IERC20.sol", + "file": "../token/ERC20/IERC20.sol", + "id": 237, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 238, + "sourceUnit": 341, + "src": "132:49:3", + "symbolAliases": [ + { + "foreign": { + "id": 236, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "140:6:3", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + } + ], + "src": "105:77:3" + }, + "id": 3 + }, + "@openzeppelin/contracts/interfaces/IERC5267.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/interfaces/IERC5267.sol", + "exportedSymbols": { + "IERC5267": [ + 262 + ] + }, + "id": 263, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 239, + "literals": [ + "solidity", + ">=", + "0.4", + ".16" + ], + "nodeType": "PragmaDirective", + "src": "107:25:4" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "IERC5267", + "contractDependencies": [], + "contractKind": "interface", + "fullyImplemented": false, + "id": 262, + "linearizedBaseContracts": [ + 262 + ], + "name": "IERC5267", + "nameLocation": "144:8:4", + "nodeType": "ContractDefinition", + "nodes": [ + { + "anonymous": false, + "documentation": { + "id": 240, + "nodeType": "StructuredDocumentation", + "src": "159:84:4", + "text": " @dev MAY be emitted to signal that the domain could have changed." + }, + "eventSelector": "0a6387c9ea3628b88a633bb4f3b151770f70085117a15f9bf3787cda53f13d31", + "id": 242, + "name": "EIP712DomainChanged", + "nameLocation": "254:19:4", + "nodeType": "EventDefinition", + "parameters": { + "id": 241, + "nodeType": "ParameterList", + "parameters": [], + "src": "273:2:4" + }, + "src": "248:28:4" + }, + { + "documentation": { + "id": 243, + "nodeType": "StructuredDocumentation", + "src": "282:140:4", + "text": " @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\n signature." + }, + "functionSelector": "84b0196e", + "id": 261, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "eip712Domain", + "nameLocation": "436:12:4", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 244, + "nodeType": "ParameterList", + "parameters": [], + "src": "448:2:4" + }, + "returnParameters": { + "id": 260, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 246, + "mutability": "mutable", + "name": "fields", + "nameLocation": "518:6:4", + "nodeType": "VariableDeclaration", + "scope": 261, + "src": "511:13:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 245, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "511:6:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 248, + "mutability": "mutable", + "name": "name", + "nameLocation": "552:4:4", + "nodeType": "VariableDeclaration", + "scope": 261, + "src": "538:18:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 247, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "538:6:4", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 250, + "mutability": "mutable", + "name": "version", + "nameLocation": "584:7:4", + "nodeType": "VariableDeclaration", + "scope": 261, + "src": "570:21:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 249, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "570:6:4", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 252, + "mutability": "mutable", + "name": "chainId", + "nameLocation": "613:7:4", + "nodeType": "VariableDeclaration", + "scope": 261, + "src": "605:15:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 251, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "605:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 254, + "mutability": "mutable", + "name": "verifyingContract", + "nameLocation": "642:17:4", + "nodeType": "VariableDeclaration", + "scope": 261, + "src": "634:25:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 253, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "634:7:4", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 256, + "mutability": "mutable", + "name": "salt", + "nameLocation": "681:4:4", + "nodeType": "VariableDeclaration", + "scope": 261, + "src": "673:12:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 255, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "673:7:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 259, + "mutability": "mutable", + "name": "extensions", + "nameLocation": "716:10:4", + "nodeType": "VariableDeclaration", + "scope": 261, + "src": "699:27:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[]" + }, + "typeName": { + "baseType": { + "id": 257, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "699:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 258, + "nodeType": "ArrayTypeName", + "src": "699:9:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "visibility": "internal" + } + ], + "src": "497:239:4" + }, + "scope": 262, + "src": "427:310:4", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + } + ], + "scope": 263, + "src": "134:605:4", + "usedErrors": [], + "usedEvents": [ + 242 + ] + } + ], + "src": "107:633:4" + }, + "id": 4 + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/token/ERC20/IERC20.sol", + "exportedSymbols": { + "IERC20": [ + 340 + ] + }, + "id": 341, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 264, + "literals": [ + "solidity", + ">=", + "0.4", + ".16" + ], + "nodeType": "PragmaDirective", + "src": "106:25:5" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "IERC20", + "contractDependencies": [], + "contractKind": "interface", + "documentation": { + "id": 265, + "nodeType": "StructuredDocumentation", + "src": "133:71:5", + "text": " @dev Interface of the ERC-20 standard as defined in the ERC." + }, + "fullyImplemented": false, + "id": 340, + "linearizedBaseContracts": [ + 340 + ], + "name": "IERC20", + "nameLocation": "215:6:5", + "nodeType": "ContractDefinition", + "nodes": [ + { + "anonymous": false, + "documentation": { + "id": 266, + "nodeType": "StructuredDocumentation", + "src": "228:158:5", + "text": " @dev Emitted when `value` tokens are moved from one account (`from`) to\n another (`to`).\n Note that `value` may be zero." + }, + "eventSelector": "ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "id": 274, + "name": "Transfer", + "nameLocation": "397:8:5", + "nodeType": "EventDefinition", + "parameters": { + "id": 273, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 268, + "indexed": true, + "mutability": "mutable", + "name": "from", + "nameLocation": "422:4:5", + "nodeType": "VariableDeclaration", + "scope": 274, + "src": "406:20:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 267, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "406:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 270, + "indexed": true, + "mutability": "mutable", + "name": "to", + "nameLocation": "444:2:5", + "nodeType": "VariableDeclaration", + "scope": 274, + "src": "428:18:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 269, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "428:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 272, + "indexed": false, + "mutability": "mutable", + "name": "value", + "nameLocation": "456:5:5", + "nodeType": "VariableDeclaration", + "scope": 274, + "src": "448:13:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 271, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "448:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "405:57:5" + }, + "src": "391:72:5" + }, + { + "anonymous": false, + "documentation": { + "id": 275, + "nodeType": "StructuredDocumentation", + "src": "469:148:5", + "text": " @dev Emitted when the allowance of a `spender` for an `owner` is set by\n a call to {approve}. `value` is the new allowance." + }, + "eventSelector": "8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", + "id": 283, + "name": "Approval", + "nameLocation": "628:8:5", + "nodeType": "EventDefinition", + "parameters": { + "id": 282, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 277, + "indexed": true, + "mutability": "mutable", + "name": "owner", + "nameLocation": "653:5:5", + "nodeType": "VariableDeclaration", + "scope": 283, + "src": "637:21:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 276, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "637:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 279, + "indexed": true, + "mutability": "mutable", + "name": "spender", + "nameLocation": "676:7:5", + "nodeType": "VariableDeclaration", + "scope": 283, + "src": "660:23:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 278, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "660:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 281, + "indexed": false, + "mutability": "mutable", + "name": "value", + "nameLocation": "693:5:5", + "nodeType": "VariableDeclaration", + "scope": 283, + "src": "685:13:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 280, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "685:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "636:63:5" + }, + "src": "622:78:5" + }, + { + "documentation": { + "id": 284, + "nodeType": "StructuredDocumentation", + "src": "706:65:5", + "text": " @dev Returns the value of tokens in existence." + }, + "functionSelector": "18160ddd", + "id": 289, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "totalSupply", + "nameLocation": "785:11:5", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 285, + "nodeType": "ParameterList", + "parameters": [], + "src": "796:2:5" + }, + "returnParameters": { + "id": 288, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 287, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 289, + "src": "822:7:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 286, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "822:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "821:9:5" + }, + "scope": 340, + "src": "776:55:5", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 290, + "nodeType": "StructuredDocumentation", + "src": "837:71:5", + "text": " @dev Returns the value of tokens owned by `account`." + }, + "functionSelector": "70a08231", + "id": 297, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "balanceOf", + "nameLocation": "922:9:5", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 293, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 292, + "mutability": "mutable", + "name": "account", + "nameLocation": "940:7:5", + "nodeType": "VariableDeclaration", + "scope": 297, + "src": "932:15:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 291, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "932:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "931:17:5" + }, + "returnParameters": { + "id": 296, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 295, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 297, + "src": "972:7:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 294, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "972:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "971:9:5" + }, + "scope": 340, + "src": "913:68:5", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 298, + "nodeType": "StructuredDocumentation", + "src": "987:213:5", + "text": " @dev Moves a `value` amount of tokens from the caller's account to `to`.\n Returns a boolean value indicating whether the operation succeeded.\n Emits a {Transfer} event." + }, + "functionSelector": "a9059cbb", + "id": 307, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "transfer", + "nameLocation": "1214:8:5", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 303, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 300, + "mutability": "mutable", + "name": "to", + "nameLocation": "1231:2:5", + "nodeType": "VariableDeclaration", + "scope": 307, + "src": "1223:10:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 299, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1223:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 302, + "mutability": "mutable", + "name": "value", + "nameLocation": "1243:5:5", + "nodeType": "VariableDeclaration", + "scope": 307, + "src": "1235:13:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 301, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1235:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1222:27:5" + }, + "returnParameters": { + "id": 306, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 305, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 307, + "src": "1268:4:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 304, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "1268:4:5", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "1267:6:5" + }, + "scope": 340, + "src": "1205:69:5", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 308, + "nodeType": "StructuredDocumentation", + "src": "1280:264:5", + "text": " @dev Returns the remaining number of tokens that `spender` will be\n allowed to spend on behalf of `owner` through {transferFrom}. This is\n zero by default.\n This value changes when {approve} or {transferFrom} are called." + }, + "functionSelector": "dd62ed3e", + "id": 317, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "allowance", + "nameLocation": "1558:9:5", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 313, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 310, + "mutability": "mutable", + "name": "owner", + "nameLocation": "1576:5:5", + "nodeType": "VariableDeclaration", + "scope": 317, + "src": "1568:13:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 309, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1568:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 312, + "mutability": "mutable", + "name": "spender", + "nameLocation": "1591:7:5", + "nodeType": "VariableDeclaration", + "scope": 317, + "src": "1583:15:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 311, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1583:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "1567:32:5" + }, + "returnParameters": { + "id": 316, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 315, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 317, + "src": "1623:7:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 314, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1623:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1622:9:5" + }, + "scope": 340, + "src": "1549:83:5", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 318, + "nodeType": "StructuredDocumentation", + "src": "1638:667:5", + "text": " @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n caller's tokens.\n Returns a boolean value indicating whether the operation succeeded.\n IMPORTANT: Beware that changing an allowance with this method brings the risk\n that someone may use both the old and the new allowance by unfortunate\n transaction ordering. One possible solution to mitigate this race\n condition is to first reduce the spender's allowance to 0 and set the\n desired value afterwards:\n https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n Emits an {Approval} event." + }, + "functionSelector": "095ea7b3", + "id": 327, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "approve", + "nameLocation": "2319:7:5", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 323, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 320, + "mutability": "mutable", + "name": "spender", + "nameLocation": "2335:7:5", + "nodeType": "VariableDeclaration", + "scope": 327, + "src": "2327:15:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 319, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2327:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 322, + "mutability": "mutable", + "name": "value", + "nameLocation": "2352:5:5", + "nodeType": "VariableDeclaration", + "scope": 327, + "src": "2344:13:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 321, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2344:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2326:32:5" + }, + "returnParameters": { + "id": 326, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 325, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 327, + "src": "2377:4:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 324, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "2377:4:5", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "2376:6:5" + }, + "scope": 340, + "src": "2310:73:5", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 328, + "nodeType": "StructuredDocumentation", + "src": "2389:297:5", + "text": " @dev Moves a `value` amount of tokens from `from` to `to` using the\n allowance mechanism. `value` is then deducted from the caller's\n allowance.\n Returns a boolean value indicating whether the operation succeeded.\n Emits a {Transfer} event." + }, + "functionSelector": "23b872dd", + "id": 339, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "transferFrom", + "nameLocation": "2700:12:5", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 335, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 330, + "mutability": "mutable", + "name": "from", + "nameLocation": "2721:4:5", + "nodeType": "VariableDeclaration", + "scope": 339, + "src": "2713:12:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 329, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2713:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 332, + "mutability": "mutable", + "name": "to", + "nameLocation": "2735:2:5", + "nodeType": "VariableDeclaration", + "scope": 339, + "src": "2727:10:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 331, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2727:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 334, + "mutability": "mutable", + "name": "value", + "nameLocation": "2747:5:5", + "nodeType": "VariableDeclaration", + "scope": 339, + "src": "2739:13:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 333, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2739:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2712:41:5" + }, + "returnParameters": { + "id": 338, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 337, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 339, + "src": "2772:4:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 336, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "2772:4:5", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "2771:6:5" + }, + "scope": 340, + "src": "2691:87:5", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + } + ], + "scope": 341, + "src": "205:2575:5", + "usedErrors": [], + "usedEvents": [ + 274, + 283 + ] + } + ], + "src": "106:2675:5" + }, + "id": 5 + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol", + "exportedSymbols": { + "IERC20Permit": [ + 376 + ] + }, + "id": 377, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 342, + "literals": [ + "solidity", + ">=", + "0.4", + ".16" + ], + "nodeType": "PragmaDirective", + "src": "123:25:6" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "IERC20Permit", + "contractDependencies": [], + "contractKind": "interface", + "documentation": { + "id": 343, + "nodeType": "StructuredDocumentation", + "src": "150:1965:6", + "text": " @dev Interface of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n need to send a transaction, and thus is not required to hold Ether at all.\n ==== Security Considerations\n There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n considered as an intention to spend the allowance in any specific way. The second is that because permits have\n built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n generally recommended is:\n ```solidity\n function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n doThing(..., value);\n }\n function doThing(..., uint256 value) public {\n token.safeTransferFrom(msg.sender, address(this), value);\n ...\n }\n ```\n Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n {SafeERC20-safeTransferFrom}).\n Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n contracts should have entry points that don't rely on permit." + }, + "fullyImplemented": false, + "id": 376, + "linearizedBaseContracts": [ + 376 + ], + "name": "IERC20Permit", + "nameLocation": "2126:12:6", + "nodeType": "ContractDefinition", + "nodes": [ + { + "documentation": { + "id": 344, + "nodeType": "StructuredDocumentation", + "src": "2145:852:6", + "text": " @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n given ``owner``'s signed approval.\n IMPORTANT: The same issues {IERC20-approve} has related to transaction\n ordering also applies here.\n Emits an {Approval} event.\n Requirements:\n - `spender` cannot be the zero address.\n - `deadline` must be a timestamp in the future.\n - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n over the EIP712-formatted function arguments.\n - the signature must use ``owner``'s current nonce (see {nonces}).\n For more information on the signature format, see the\n https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n section].\n CAUTION: See Security Considerations above." + }, + "functionSelector": "d505accf", + "id": 361, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "permit", + "nameLocation": "3011:6:6", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 359, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 346, + "mutability": "mutable", + "name": "owner", + "nameLocation": "3035:5:6", + "nodeType": "VariableDeclaration", + "scope": 361, + "src": "3027:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 345, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3027:7:6", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 348, + "mutability": "mutable", + "name": "spender", + "nameLocation": "3058:7:6", + "nodeType": "VariableDeclaration", + "scope": 361, + "src": "3050:15:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 347, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3050:7:6", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 350, + "mutability": "mutable", + "name": "value", + "nameLocation": "3083:5:6", + "nodeType": "VariableDeclaration", + "scope": 361, + "src": "3075:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 349, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3075:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 352, + "mutability": "mutable", + "name": "deadline", + "nameLocation": "3106:8:6", + "nodeType": "VariableDeclaration", + "scope": 361, + "src": "3098:16:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 351, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3098:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 354, + "mutability": "mutable", + "name": "v", + "nameLocation": "3130:1:6", + "nodeType": "VariableDeclaration", + "scope": 361, + "src": "3124:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 353, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "3124:5:6", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 356, + "mutability": "mutable", + "name": "r", + "nameLocation": "3149:1:6", + "nodeType": "VariableDeclaration", + "scope": 361, + "src": "3141:9:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 355, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3141:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 358, + "mutability": "mutable", + "name": "s", + "nameLocation": "3168:1:6", + "nodeType": "VariableDeclaration", + "scope": 361, + "src": "3160:9:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 357, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3160:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "3017:158:6" + }, + "returnParameters": { + "id": 360, + "nodeType": "ParameterList", + "parameters": [], + "src": "3184:0:6" + }, + "scope": 376, + "src": "3002:183:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 362, + "nodeType": "StructuredDocumentation", + "src": "3191:294:6", + "text": " @dev Returns the current nonce for `owner`. This value must be\n included whenever a signature is generated for {permit}.\n Every successful call to {permit} increases ``owner``'s nonce by one. This\n prevents a signature from being used multiple times." + }, + "functionSelector": "7ecebe00", + "id": 369, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "nonces", + "nameLocation": "3499:6:6", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 365, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 364, + "mutability": "mutable", + "name": "owner", + "nameLocation": "3514:5:6", + "nodeType": "VariableDeclaration", + "scope": 369, + "src": "3506:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 363, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3506:7:6", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "3505:15:6" + }, + "returnParameters": { + "id": 368, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 367, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 369, + "src": "3544:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 366, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3544:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3543:9:6" + }, + "scope": 376, + "src": "3490:63:6", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 370, + "nodeType": "StructuredDocumentation", + "src": "3559:128:6", + "text": " @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}." + }, + "functionSelector": "3644e515", + "id": 375, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "DOMAIN_SEPARATOR", + "nameLocation": "3754:16:6", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 371, + "nodeType": "ParameterList", + "parameters": [], + "src": "3770:2:6" + }, + "returnParameters": { + "id": 374, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 373, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 375, + "src": "3796:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 372, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3796:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "3795:9:6" + }, + "scope": 376, + "src": "3745:60:6", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + } + ], + "scope": 377, + "src": "2116:1691:6", + "usedErrors": [], + "usedEvents": [] + } + ], + "src": "123:3685:6" + }, + "id": 6 + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol", + "exportedSymbols": { + "IERC1363": [ + 229 + ], + "IERC20": [ + 340 + ], + "SafeERC20": [ + 831 + ] + }, + "id": 832, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 378, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "115:24:7" + }, + { + "absolutePath": "@openzeppelin/contracts/token/ERC20/IERC20.sol", + "file": "../IERC20.sol", + "id": 380, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 832, + "sourceUnit": 341, + "src": "141:37:7", + "symbolAliases": [ + { + "foreign": { + "id": 379, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "149:6:7", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/interfaces/IERC1363.sol", + "file": "../../../interfaces/IERC1363.sol", + "id": 382, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 832, + "sourceUnit": 230, + "src": "179:58:7", + "symbolAliases": [ + { + "foreign": { + "id": 381, + "name": "IERC1363", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 229, + "src": "187:8:7", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "SafeERC20", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 383, + "nodeType": "StructuredDocumentation", + "src": "239:458:7", + "text": " @title SafeERC20\n @dev Wrappers around ERC-20 operations that throw on failure (when the token\n contract returns false). Tokens that return no value (and instead revert or\n throw on failure) are also supported, non-reverting calls are assumed to be\n successful.\n To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n which allows you to call the safe operations as `token.safeTransfer(...)`, etc." + }, + "fullyImplemented": true, + "id": 831, + "linearizedBaseContracts": [ + 831 + ], + "name": "SafeERC20", + "nameLocation": "706:9:7", + "nodeType": "ContractDefinition", + "nodes": [ + { + "documentation": { + "id": 384, + "nodeType": "StructuredDocumentation", + "src": "722:65:7", + "text": " @dev An operation with an ERC-20 token failed." + }, + "errorSelector": "5274afe7", + "id": 388, + "name": "SafeERC20FailedOperation", + "nameLocation": "798:24:7", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 387, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 386, + "mutability": "mutable", + "name": "token", + "nameLocation": "831:5:7", + "nodeType": "VariableDeclaration", + "scope": 388, + "src": "823:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 385, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "823:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "822:15:7" + }, + "src": "792:46:7" + }, + { + "documentation": { + "id": 389, + "nodeType": "StructuredDocumentation", + "src": "844:71:7", + "text": " @dev Indicates a failed `decreaseAllowance` request." + }, + "errorSelector": "e570110f", + "id": 397, + "name": "SafeERC20FailedDecreaseAllowance", + "nameLocation": "926:32:7", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 396, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 391, + "mutability": "mutable", + "name": "spender", + "nameLocation": "967:7:7", + "nodeType": "VariableDeclaration", + "scope": 397, + "src": "959:15:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 390, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "959:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 393, + "mutability": "mutable", + "name": "currentAllowance", + "nameLocation": "984:16:7", + "nodeType": "VariableDeclaration", + "scope": 397, + "src": "976:24:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 392, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "976:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 395, + "mutability": "mutable", + "name": "requestedDecrease", + "nameLocation": "1010:17:7", + "nodeType": "VariableDeclaration", + "scope": 397, + "src": "1002:25:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 394, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1002:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "958:70:7" + }, + "src": "920:109:7" + }, + { + "body": { + "id": 424, + "nodeType": "Block", + "src": "1291:132:7", + "statements": [ + { + "condition": { + "id": 414, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "1305:38:7", + "subExpression": { + "arguments": [ + { + "id": 409, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 401, + "src": "1320:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + { + "id": 410, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 403, + "src": "1327:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 411, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 405, + "src": "1331:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "74727565", + "id": 412, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1338:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 408, + "name": "_safeTransfer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 782, + "src": "1306:13:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$_t_bool_$returns$_t_bool_$", + "typeString": "function (contract IERC20,address,uint256,bool) returns (bool)" + } + }, + "id": 413, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1306:37:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 423, + "nodeType": "IfStatement", + "src": "1301:116:7", + "trueBody": { + "id": 422, + "nodeType": "Block", + "src": "1345:72:7", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "id": 418, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 401, + "src": "1399:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + ], + "id": 417, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1391:7:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 416, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1391:7:7", + "typeDescriptions": {} + } + }, + "id": 419, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1391:14:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 415, + "name": "SafeERC20FailedOperation", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 388, + "src": "1366:24:7", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 420, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1366:40:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 421, + "nodeType": "RevertStatement", + "src": "1359:47:7" + } + ] + } + } + ] + }, + "documentation": { + "id": 398, + "nodeType": "StructuredDocumentation", + "src": "1035:179:7", + "text": " @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n non-reverting calls are assumed to be successful." + }, + "id": 425, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "safeTransfer", + "nameLocation": "1228:12:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 406, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 401, + "mutability": "mutable", + "name": "token", + "nameLocation": "1248:5:7", + "nodeType": "VariableDeclaration", + "scope": 425, + "src": "1241:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 400, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 399, + "name": "IERC20", + "nameLocations": [ + "1241:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "1241:6:7" + }, + "referencedDeclaration": 340, + "src": "1241:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 403, + "mutability": "mutable", + "name": "to", + "nameLocation": "1263:2:7", + "nodeType": "VariableDeclaration", + "scope": 425, + "src": "1255:10:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 402, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1255:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 405, + "mutability": "mutable", + "name": "value", + "nameLocation": "1275:5:7", + "nodeType": "VariableDeclaration", + "scope": 425, + "src": "1267:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 404, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1267:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1240:41:7" + }, + "returnParameters": { + "id": 407, + "nodeType": "ParameterList", + "parameters": [], + "src": "1291:0:7" + }, + "scope": 831, + "src": "1219:204:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 455, + "nodeType": "Block", + "src": "1752:142:7", + "statements": [ + { + "condition": { + "id": 445, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "1766:48:7", + "subExpression": { + "arguments": [ + { + "id": 439, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 429, + "src": "1785:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + { + "id": 440, + "name": "from", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 431, + "src": "1792:4:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 441, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 433, + "src": "1798:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 442, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 435, + "src": "1802:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "74727565", + "id": 443, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1809:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 438, + "name": "_safeTransferFrom", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 807, + "src": "1767:17:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_address_$_t_uint256_$_t_bool_$returns$_t_bool_$", + "typeString": "function (contract IERC20,address,address,uint256,bool) returns (bool)" + } + }, + "id": 444, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1767:47:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 454, + "nodeType": "IfStatement", + "src": "1762:126:7", + "trueBody": { + "id": 453, + "nodeType": "Block", + "src": "1816:72:7", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "id": 449, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 429, + "src": "1870:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + ], + "id": 448, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1862:7:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 447, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1862:7:7", + "typeDescriptions": {} + } + }, + "id": 450, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1862:14:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 446, + "name": "SafeERC20FailedOperation", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 388, + "src": "1837:24:7", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 451, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1837:40:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 452, + "nodeType": "RevertStatement", + "src": "1830:47:7" + } + ] + } + } + ] + }, + "documentation": { + "id": 426, + "nodeType": "StructuredDocumentation", + "src": "1429:228:7", + "text": " @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n calling contract. If `token` returns no value, non-reverting calls are assumed to be successful." + }, + "id": 456, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "safeTransferFrom", + "nameLocation": "1671:16:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 436, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 429, + "mutability": "mutable", + "name": "token", + "nameLocation": "1695:5:7", + "nodeType": "VariableDeclaration", + "scope": 456, + "src": "1688:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 428, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 427, + "name": "IERC20", + "nameLocations": [ + "1688:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "1688:6:7" + }, + "referencedDeclaration": 340, + "src": "1688:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 431, + "mutability": "mutable", + "name": "from", + "nameLocation": "1710:4:7", + "nodeType": "VariableDeclaration", + "scope": 456, + "src": "1702:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 430, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1702:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 433, + "mutability": "mutable", + "name": "to", + "nameLocation": "1724:2:7", + "nodeType": "VariableDeclaration", + "scope": 456, + "src": "1716:10:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 432, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1716:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 435, + "mutability": "mutable", + "name": "value", + "nameLocation": "1736:5:7", + "nodeType": "VariableDeclaration", + "scope": 456, + "src": "1728:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 434, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1728:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1687:55:7" + }, + "returnParameters": { + "id": 437, + "nodeType": "ParameterList", + "parameters": [], + "src": "1752:0:7" + }, + "scope": 831, + "src": "1662:232:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 476, + "nodeType": "Block", + "src": "2121:62:7", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 470, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 460, + "src": "2152:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + { + "id": 471, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 462, + "src": "2159:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 472, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 464, + "src": "2163:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "66616c7365", + "id": 473, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2170:5:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 469, + "name": "_safeTransfer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 782, + "src": "2138:13:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$_t_bool_$returns$_t_bool_$", + "typeString": "function (contract IERC20,address,uint256,bool) returns (bool)" + } + }, + "id": 474, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2138:38:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 468, + "id": 475, + "nodeType": "Return", + "src": "2131:45:7" + } + ] + }, + "documentation": { + "id": 457, + "nodeType": "StructuredDocumentation", + "src": "1900:126:7", + "text": " @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful." + }, + "id": 477, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "trySafeTransfer", + "nameLocation": "2040:15:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 465, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 460, + "mutability": "mutable", + "name": "token", + "nameLocation": "2063:5:7", + "nodeType": "VariableDeclaration", + "scope": 477, + "src": "2056:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 459, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 458, + "name": "IERC20", + "nameLocations": [ + "2056:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "2056:6:7" + }, + "referencedDeclaration": 340, + "src": "2056:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 462, + "mutability": "mutable", + "name": "to", + "nameLocation": "2078:2:7", + "nodeType": "VariableDeclaration", + "scope": 477, + "src": "2070:10:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 461, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2070:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 464, + "mutability": "mutable", + "name": "value", + "nameLocation": "2090:5:7", + "nodeType": "VariableDeclaration", + "scope": 477, + "src": "2082:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 463, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2082:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2055:41:7" + }, + "returnParameters": { + "id": 468, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 467, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 477, + "src": "2115:4:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 466, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "2115:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "2114:6:7" + }, + "scope": 831, + "src": "2031:152:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 500, + "nodeType": "Block", + "src": "2432:72:7", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 493, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 481, + "src": "2467:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + { + "id": 494, + "name": "from", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 483, + "src": "2474:4:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 495, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 485, + "src": "2480:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 496, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 487, + "src": "2484:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "66616c7365", + "id": 497, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2491:5:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 492, + "name": "_safeTransferFrom", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 807, + "src": "2449:17:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_address_$_t_uint256_$_t_bool_$returns$_t_bool_$", + "typeString": "function (contract IERC20,address,address,uint256,bool) returns (bool)" + } + }, + "id": 498, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2449:48:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 491, + "id": 499, + "nodeType": "Return", + "src": "2442:55:7" + } + ] + }, + "documentation": { + "id": 478, + "nodeType": "StructuredDocumentation", + "src": "2189:130:7", + "text": " @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful." + }, + "id": 501, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "trySafeTransferFrom", + "nameLocation": "2333:19:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 488, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 481, + "mutability": "mutable", + "name": "token", + "nameLocation": "2360:5:7", + "nodeType": "VariableDeclaration", + "scope": 501, + "src": "2353:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 480, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 479, + "name": "IERC20", + "nameLocations": [ + "2353:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "2353:6:7" + }, + "referencedDeclaration": 340, + "src": "2353:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 483, + "mutability": "mutable", + "name": "from", + "nameLocation": "2375:4:7", + "nodeType": "VariableDeclaration", + "scope": 501, + "src": "2367:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 482, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2367:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 485, + "mutability": "mutable", + "name": "to", + "nameLocation": "2389:2:7", + "nodeType": "VariableDeclaration", + "scope": 501, + "src": "2381:10:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 484, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2381:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 487, + "mutability": "mutable", + "name": "value", + "nameLocation": "2401:5:7", + "nodeType": "VariableDeclaration", + "scope": 501, + "src": "2393:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 486, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2393:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2352:55:7" + }, + "returnParameters": { + "id": 491, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 490, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 501, + "src": "2426:4:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 489, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "2426:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "2425:6:7" + }, + "scope": 831, + "src": "2324:180:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 531, + "nodeType": "Block", + "src": "3246:139:7", + "statements": [ + { + "assignments": [ + 513 + ], + "declarations": [ + { + "constant": false, + "id": 513, + "mutability": "mutable", + "name": "oldAllowance", + "nameLocation": "3264:12:7", + "nodeType": "VariableDeclaration", + "scope": 531, + "src": "3256:20:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 512, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3256:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 522, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "id": 518, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "3303:4:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_SafeERC20_$831", + "typeString": "library SafeERC20" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_SafeERC20_$831", + "typeString": "library SafeERC20" + } + ], + "id": 517, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3295:7:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 516, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3295:7:7", + "typeDescriptions": {} + } + }, + "id": 519, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3295:13:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 520, + "name": "spender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 507, + "src": "3310:7:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "expression": { + "id": 514, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 505, + "src": "3279:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "id": 515, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3285:9:7", + "memberName": "allowance", + "nodeType": "MemberAccess", + "referencedDeclaration": 317, + "src": "3279:15:7", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_address_$_t_address_$returns$_t_uint256_$", + "typeString": "function (address,address) view external returns (uint256)" + } + }, + "id": 521, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3279:39:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3256:62:7" + }, + { + "expression": { + "arguments": [ + { + "id": 524, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 505, + "src": "3341:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + { + "id": 525, + "name": "spender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 507, + "src": "3348:7:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 528, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 526, + "name": "oldAllowance", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 513, + "src": "3357:12:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "id": 527, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 509, + "src": "3372:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3357:20:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 523, + "name": "forceApprove", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 626, + "src": "3328:12:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$returns$__$", + "typeString": "function (contract IERC20,address,uint256)" + } + }, + "id": 529, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3328:50:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 530, + "nodeType": "ExpressionStatement", + "src": "3328:50:7" + } + ] + }, + "documentation": { + "id": 502, + "nodeType": "StructuredDocumentation", + "src": "2510:645:7", + "text": " @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n non-reverting calls are assumed to be successful.\n IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the \"client\"\n smart contract uses ERC-7674 to set temporary allowances, then the \"client\" smart contract should avoid using\n this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract\n that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior." + }, + "id": 532, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "safeIncreaseAllowance", + "nameLocation": "3169:21:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 510, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 505, + "mutability": "mutable", + "name": "token", + "nameLocation": "3198:5:7", + "nodeType": "VariableDeclaration", + "scope": 532, + "src": "3191:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 504, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 503, + "name": "IERC20", + "nameLocations": [ + "3191:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "3191:6:7" + }, + "referencedDeclaration": 340, + "src": "3191:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 507, + "mutability": "mutable", + "name": "spender", + "nameLocation": "3213:7:7", + "nodeType": "VariableDeclaration", + "scope": 532, + "src": "3205:15:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 506, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3205:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 509, + "mutability": "mutable", + "name": "value", + "nameLocation": "3230:5:7", + "nodeType": "VariableDeclaration", + "scope": 532, + "src": "3222:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 508, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3222:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3190:46:7" + }, + "returnParameters": { + "id": 511, + "nodeType": "ParameterList", + "parameters": [], + "src": "3246:0:7" + }, + "scope": 831, + "src": "3160:225:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 574, + "nodeType": "Block", + "src": "4151:370:7", + "statements": [ + { + "id": 573, + "nodeType": "UncheckedBlock", + "src": "4161:354:7", + "statements": [ + { + "assignments": [ + 544 + ], + "declarations": [ + { + "constant": false, + "id": 544, + "mutability": "mutable", + "name": "currentAllowance", + "nameLocation": "4193:16:7", + "nodeType": "VariableDeclaration", + "scope": 573, + "src": "4185:24:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 543, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4185:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 553, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "id": 549, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "4236:4:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_SafeERC20_$831", + "typeString": "library SafeERC20" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_SafeERC20_$831", + "typeString": "library SafeERC20" + } + ], + "id": 548, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4228:7:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 547, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "4228:7:7", + "typeDescriptions": {} + } + }, + "id": 550, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4228:13:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 551, + "name": "spender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 538, + "src": "4243:7:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "expression": { + "id": 545, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 536, + "src": "4212:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "id": 546, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4218:9:7", + "memberName": "allowance", + "nodeType": "MemberAccess", + "referencedDeclaration": 317, + "src": "4212:15:7", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_address_$_t_address_$returns$_t_uint256_$", + "typeString": "function (address,address) view external returns (uint256)" + } + }, + "id": 552, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4212:39:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4185:66:7" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 556, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 554, + "name": "currentAllowance", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 544, + "src": "4269:16:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 555, + "name": "requestedDecrease", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 540, + "src": "4288:17:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4269:36:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 564, + "nodeType": "IfStatement", + "src": "4265:160:7", + "trueBody": { + "id": 563, + "nodeType": "Block", + "src": "4307:118:7", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "id": 558, + "name": "spender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 538, + "src": "4365:7:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 559, + "name": "currentAllowance", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 544, + "src": "4374:16:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 560, + "name": "requestedDecrease", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 540, + "src": "4392:17:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 557, + "name": "SafeERC20FailedDecreaseAllowance", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 397, + "src": "4332:32:7", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$_t_uint256_$_t_uint256_$returns$_t_error_$", + "typeString": "function (address,uint256,uint256) pure returns (error)" + } + }, + "id": 561, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4332:78:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 562, + "nodeType": "RevertStatement", + "src": "4325:85:7" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 566, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 536, + "src": "4451:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + { + "id": 567, + "name": "spender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 538, + "src": "4458:7:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 570, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 568, + "name": "currentAllowance", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 544, + "src": "4467:16:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "id": 569, + "name": "requestedDecrease", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 540, + "src": "4486:17:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4467:36:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 565, + "name": "forceApprove", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 626, + "src": "4438:12:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$returns$__$", + "typeString": "function (contract IERC20,address,uint256)" + } + }, + "id": 571, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4438:66:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 572, + "nodeType": "ExpressionStatement", + "src": "4438:66:7" + } + ] + } + ] + }, + "documentation": { + "id": 533, + "nodeType": "StructuredDocumentation", + "src": "3391:657:7", + "text": " @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no\n value, non-reverting calls are assumed to be successful.\n IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the \"client\"\n smart contract uses ERC-7674 to set temporary allowances, then the \"client\" smart contract should avoid using\n this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract\n that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior." + }, + "id": 575, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "safeDecreaseAllowance", + "nameLocation": "4062:21:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 541, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 536, + "mutability": "mutable", + "name": "token", + "nameLocation": "4091:5:7", + "nodeType": "VariableDeclaration", + "scope": 575, + "src": "4084:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 535, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 534, + "name": "IERC20", + "nameLocations": [ + "4084:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "4084:6:7" + }, + "referencedDeclaration": 340, + "src": "4084:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 538, + "mutability": "mutable", + "name": "spender", + "nameLocation": "4106:7:7", + "nodeType": "VariableDeclaration", + "scope": 575, + "src": "4098:15:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 537, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "4098:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 540, + "mutability": "mutable", + "name": "requestedDecrease", + "nameLocation": "4123:17:7", + "nodeType": "VariableDeclaration", + "scope": 575, + "src": "4115:25:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 539, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4115:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4083:58:7" + }, + "returnParameters": { + "id": 542, + "nodeType": "ParameterList", + "parameters": [], + "src": "4151:0:7" + }, + "scope": 831, + "src": "4053:468:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 625, + "nodeType": "Block", + "src": "5175:290:7", + "statements": [ + { + "condition": { + "id": 592, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "5189:43:7", + "subExpression": { + "arguments": [ + { + "id": 587, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 579, + "src": "5203:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + { + "id": 588, + "name": "spender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 581, + "src": "5210:7:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 589, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 583, + "src": "5219:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "66616c7365", + "id": 590, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5226:5:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 586, + "name": "_safeApprove", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 830, + "src": "5190:12:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$_t_bool_$returns$_t_bool_$", + "typeString": "function (contract IERC20,address,uint256,bool) returns (bool)" + } + }, + "id": 591, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5190:42:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 624, + "nodeType": "IfStatement", + "src": "5185:274:7", + "trueBody": { + "id": 623, + "nodeType": "Block", + "src": "5234:225:7", + "statements": [ + { + "condition": { + "id": 599, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "5252:38:7", + "subExpression": { + "arguments": [ + { + "id": 594, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 579, + "src": "5266:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + { + "id": 595, + "name": "spender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 581, + "src": "5273:7:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "hexValue": "30", + "id": 596, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5282:1:7", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "hexValue": "74727565", + "id": 597, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5285:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 593, + "name": "_safeApprove", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 830, + "src": "5253:12:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$_t_bool_$returns$_t_bool_$", + "typeString": "function (contract IERC20,address,uint256,bool) returns (bool)" + } + }, + "id": 598, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5253:37:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 607, + "nodeType": "IfStatement", + "src": "5248:91:7", + "trueBody": { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "id": 603, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 579, + "src": "5332:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + ], + "id": 602, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5324:7:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 601, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5324:7:7", + "typeDescriptions": {} + } + }, + "id": 604, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5324:14:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 600, + "name": "SafeERC20FailedOperation", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 388, + "src": "5299:24:7", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 605, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5299:40:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 606, + "nodeType": "RevertStatement", + "src": "5292:47:7" + } + }, + { + "condition": { + "id": 614, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "5357:42:7", + "subExpression": { + "arguments": [ + { + "id": 609, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 579, + "src": "5371:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + { + "id": 610, + "name": "spender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 581, + "src": "5378:7:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 611, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 583, + "src": "5387:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "74727565", + "id": 612, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5394:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 608, + "name": "_safeApprove", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 830, + "src": "5358:12:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$_t_bool_$returns$_t_bool_$", + "typeString": "function (contract IERC20,address,uint256,bool) returns (bool)" + } + }, + "id": 613, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5358:41:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 622, + "nodeType": "IfStatement", + "src": "5353:95:7", + "trueBody": { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "id": 618, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 579, + "src": "5441:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + ], + "id": 617, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5433:7:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 616, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5433:7:7", + "typeDescriptions": {} + } + }, + "id": 619, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5433:14:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 615, + "name": "SafeERC20FailedOperation", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 388, + "src": "5408:24:7", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 620, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5408:40:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 621, + "nodeType": "RevertStatement", + "src": "5401:47:7" + } + } + ] + } + } + ] + }, + "documentation": { + "id": 576, + "nodeType": "StructuredDocumentation", + "src": "4527:566:7", + "text": " @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n to be set to zero before setting it to a non-zero value, such as USDT.\n NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function\n only sets the \"standard\" allowance. Any temporary allowance will remain active, in addition to the value being\n set here." + }, + "id": 626, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "forceApprove", + "nameLocation": "5107:12:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 584, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 579, + "mutability": "mutable", + "name": "token", + "nameLocation": "5127:5:7", + "nodeType": "VariableDeclaration", + "scope": 626, + "src": "5120:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 578, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 577, + "name": "IERC20", + "nameLocations": [ + "5120:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "5120:6:7" + }, + "referencedDeclaration": 340, + "src": "5120:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 581, + "mutability": "mutable", + "name": "spender", + "nameLocation": "5142:7:7", + "nodeType": "VariableDeclaration", + "scope": 626, + "src": "5134:15:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 580, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5134:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 583, + "mutability": "mutable", + "name": "value", + "nameLocation": "5159:5:7", + "nodeType": "VariableDeclaration", + "scope": 626, + "src": "5151:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 582, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5151:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5119:46:7" + }, + "returnParameters": { + "id": 585, + "nodeType": "ParameterList", + "parameters": [], + "src": "5175:0:7" + }, + "scope": 831, + "src": "5098:367:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 668, + "nodeType": "Block", + "src": "5914:219:7", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 643, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "expression": { + "id": 639, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 632, + "src": "5928:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 640, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5931:4:7", + "memberName": "code", + "nodeType": "MemberAccess", + "src": "5928:7:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 641, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5936:6:7", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "5928:14:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 642, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5946:1:7", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "5928:19:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "id": 657, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "6014:39:7", + "subExpression": { + "arguments": [ + { + "id": 653, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 632, + "src": "6037:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 654, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 634, + "src": "6041:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 655, + "name": "data", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 636, + "src": "6048:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "id": 651, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 630, + "src": "6015:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + }, + "id": 652, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6021:15:7", + "memberName": "transferAndCall", + "nodeType": "MemberAccess", + "referencedDeclaration": 180, + "src": "6015:21:7", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_uint256_$_t_bytes_memory_ptr_$returns$_t_bool_$", + "typeString": "function (address,uint256,bytes memory) external returns (bool)" + } + }, + "id": 656, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6015:38:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 666, + "nodeType": "IfStatement", + "src": "6010:117:7", + "trueBody": { + "id": 665, + "nodeType": "Block", + "src": "6055:72:7", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "id": 661, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 630, + "src": "6109:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + ], + "id": 660, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6101:7:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 659, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6101:7:7", + "typeDescriptions": {} + } + }, + "id": 662, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6101:14:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 658, + "name": "SafeERC20FailedOperation", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 388, + "src": "6076:24:7", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 663, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6076:40:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 664, + "nodeType": "RevertStatement", + "src": "6069:47:7" + } + ] + } + }, + "id": 667, + "nodeType": "IfStatement", + "src": "5924:203:7", + "trueBody": { + "id": 650, + "nodeType": "Block", + "src": "5949:55:7", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 645, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 630, + "src": "5976:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + }, + { + "id": 646, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 632, + "src": "5983:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 647, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 634, + "src": "5987:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 644, + "name": "safeTransfer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 425, + "src": "5963:12:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$returns$__$", + "typeString": "function (contract IERC20,address,uint256)" + } + }, + "id": 648, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5963:30:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 649, + "nodeType": "ExpressionStatement", + "src": "5963:30:7" + } + ] + } + } + ] + }, + "documentation": { + "id": 627, + "nodeType": "StructuredDocumentation", + "src": "5471:335:7", + "text": " @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no\n code. This can be used to implement an {ERC721}-like safe transfer that relies on {ERC1363} checks when\n targeting contracts.\n Reverts if the returned value is other than `true`." + }, + "id": 669, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "transferAndCallRelaxed", + "nameLocation": "5820:22:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 637, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 630, + "mutability": "mutable", + "name": "token", + "nameLocation": "5852:5:7", + "nodeType": "VariableDeclaration", + "scope": 669, + "src": "5843:14:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + }, + "typeName": { + "id": 629, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 628, + "name": "IERC1363", + "nameLocations": [ + "5843:8:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 229, + "src": "5843:8:7" + }, + "referencedDeclaration": 229, + "src": "5843:8:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 632, + "mutability": "mutable", + "name": "to", + "nameLocation": "5867:2:7", + "nodeType": "VariableDeclaration", + "scope": 669, + "src": "5859:10:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 631, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5859:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 634, + "mutability": "mutable", + "name": "value", + "nameLocation": "5879:5:7", + "nodeType": "VariableDeclaration", + "scope": 669, + "src": "5871:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 633, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5871:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 636, + "mutability": "mutable", + "name": "data", + "nameLocation": "5899:4:7", + "nodeType": "VariableDeclaration", + "scope": 669, + "src": "5886:17:7", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 635, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5886:5:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "5842:62:7" + }, + "returnParameters": { + "id": 638, + "nodeType": "ParameterList", + "parameters": [], + "src": "5914:0:7" + }, + "scope": 831, + "src": "5811:322:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 715, + "nodeType": "Block", + "src": "6654:239:7", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 688, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "expression": { + "id": 684, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 677, + "src": "6668:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 685, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6671:4:7", + "memberName": "code", + "nodeType": "MemberAccess", + "src": "6668:7:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 686, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6676:6:7", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "6668:14:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 687, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6686:1:7", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "6668:19:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "id": 704, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "6764:49:7", + "subExpression": { + "arguments": [ + { + "id": 699, + "name": "from", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 675, + "src": "6791:4:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 700, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 677, + "src": "6797:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 701, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 679, + "src": "6801:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 702, + "name": "data", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 681, + "src": "6808:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "id": 697, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 673, + "src": "6765:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + }, + "id": 698, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6771:19:7", + "memberName": "transferFromAndCall", + "nodeType": "MemberAccess", + "referencedDeclaration": 206, + "src": "6765:25:7", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_address_$_t_uint256_$_t_bytes_memory_ptr_$returns$_t_bool_$", + "typeString": "function (address,address,uint256,bytes memory) external returns (bool)" + } + }, + "id": 703, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6765:48:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 713, + "nodeType": "IfStatement", + "src": "6760:127:7", + "trueBody": { + "id": 712, + "nodeType": "Block", + "src": "6815:72:7", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "id": 708, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 673, + "src": "6869:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + ], + "id": 707, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6861:7:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 706, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6861:7:7", + "typeDescriptions": {} + } + }, + "id": 709, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6861:14:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 705, + "name": "SafeERC20FailedOperation", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 388, + "src": "6836:24:7", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 710, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6836:40:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 711, + "nodeType": "RevertStatement", + "src": "6829:47:7" + } + ] + } + }, + "id": 714, + "nodeType": "IfStatement", + "src": "6664:223:7", + "trueBody": { + "id": 696, + "nodeType": "Block", + "src": "6689:65:7", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 690, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 673, + "src": "6720:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + }, + { + "id": 691, + "name": "from", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 675, + "src": "6727:4:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 692, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 677, + "src": "6733:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 693, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 679, + "src": "6737:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 689, + "name": "safeTransferFrom", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 456, + "src": "6703:16:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_address_$_t_uint256_$returns$__$", + "typeString": "function (contract IERC20,address,address,uint256)" + } + }, + "id": 694, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6703:40:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 695, + "nodeType": "ExpressionStatement", + "src": "6703:40:7" + } + ] + } + } + ] + }, + "documentation": { + "id": 670, + "nodeType": "StructuredDocumentation", + "src": "6139:343:7", + "text": " @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target\n has no code. This can be used to implement an {ERC721}-like safe transfer that relies on {ERC1363} checks when\n targeting contracts.\n Reverts if the returned value is other than `true`." + }, + "id": 716, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "transferFromAndCallRelaxed", + "nameLocation": "6496:26:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 682, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 673, + "mutability": "mutable", + "name": "token", + "nameLocation": "6541:5:7", + "nodeType": "VariableDeclaration", + "scope": 716, + "src": "6532:14:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + }, + "typeName": { + "id": 672, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 671, + "name": "IERC1363", + "nameLocations": [ + "6532:8:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 229, + "src": "6532:8:7" + }, + "referencedDeclaration": 229, + "src": "6532:8:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 675, + "mutability": "mutable", + "name": "from", + "nameLocation": "6564:4:7", + "nodeType": "VariableDeclaration", + "scope": 716, + "src": "6556:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 674, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6556:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 677, + "mutability": "mutable", + "name": "to", + "nameLocation": "6586:2:7", + "nodeType": "VariableDeclaration", + "scope": 716, + "src": "6578:10:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 676, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6578:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 679, + "mutability": "mutable", + "name": "value", + "nameLocation": "6606:5:7", + "nodeType": "VariableDeclaration", + "scope": 716, + "src": "6598:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 678, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6598:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 681, + "mutability": "mutable", + "name": "data", + "nameLocation": "6634:4:7", + "nodeType": "VariableDeclaration", + "scope": 716, + "src": "6621:17:7", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 680, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "6621:5:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "6522:122:7" + }, + "returnParameters": { + "id": 683, + "nodeType": "ParameterList", + "parameters": [], + "src": "6654:0:7" + }, + "scope": 831, + "src": "6487:406:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 758, + "nodeType": "Block", + "src": "7661:218:7", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 733, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "expression": { + "id": 729, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 722, + "src": "7675:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 730, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7678:4:7", + "memberName": "code", + "nodeType": "MemberAccess", + "src": "7675:7:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 731, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7683:6:7", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "7675:14:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 732, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7693:1:7", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "7675:19:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "id": 747, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "7761:38:7", + "subExpression": { + "arguments": [ + { + "id": 743, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 722, + "src": "7783:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 744, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 724, + "src": "7787:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 745, + "name": "data", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 726, + "src": "7794:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "id": 741, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 720, + "src": "7762:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + }, + "id": 742, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7768:14:7", + "memberName": "approveAndCall", + "nodeType": "MemberAccess", + "referencedDeclaration": 228, + "src": "7762:20:7", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_uint256_$_t_bytes_memory_ptr_$returns$_t_bool_$", + "typeString": "function (address,uint256,bytes memory) external returns (bool)" + } + }, + "id": 746, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7762:37:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 756, + "nodeType": "IfStatement", + "src": "7757:116:7", + "trueBody": { + "id": 755, + "nodeType": "Block", + "src": "7801:72:7", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "id": 751, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 720, + "src": "7855:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + ], + "id": 750, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "7847:7:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 749, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "7847:7:7", + "typeDescriptions": {} + } + }, + "id": 752, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7847:14:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 748, + "name": "SafeERC20FailedOperation", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 388, + "src": "7822:24:7", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 753, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7822:40:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 754, + "nodeType": "RevertStatement", + "src": "7815:47:7" + } + ] + } + }, + "id": 757, + "nodeType": "IfStatement", + "src": "7671:202:7", + "trueBody": { + "id": 740, + "nodeType": "Block", + "src": "7696:55:7", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 735, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 720, + "src": "7723:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + }, + { + "id": 736, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 722, + "src": "7730:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 737, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 724, + "src": "7734:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 734, + "name": "forceApprove", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 626, + "src": "7710:12:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$returns$__$", + "typeString": "function (contract IERC20,address,uint256)" + } + }, + "id": 738, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7710:30:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 739, + "nodeType": "ExpressionStatement", + "src": "7710:30:7" + } + ] + } + } + ] + }, + "documentation": { + "id": 717, + "nodeType": "StructuredDocumentation", + "src": "6899:655:7", + "text": " @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no\n code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\n targeting contracts.\n NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.\n Oppositely, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}\n once without retrying, and relies on the returned value to be true.\n Reverts if the returned value is other than `true`." + }, + "id": 759, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "approveAndCallRelaxed", + "nameLocation": "7568:21:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 727, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 720, + "mutability": "mutable", + "name": "token", + "nameLocation": "7599:5:7", + "nodeType": "VariableDeclaration", + "scope": 759, + "src": "7590:14:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + }, + "typeName": { + "id": 719, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 718, + "name": "IERC1363", + "nameLocations": [ + "7590:8:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 229, + "src": "7590:8:7" + }, + "referencedDeclaration": 229, + "src": "7590:8:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 722, + "mutability": "mutable", + "name": "to", + "nameLocation": "7614:2:7", + "nodeType": "VariableDeclaration", + "scope": 759, + "src": "7606:10:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 721, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "7606:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 724, + "mutability": "mutable", + "name": "value", + "nameLocation": "7626:5:7", + "nodeType": "VariableDeclaration", + "scope": 759, + "src": "7618:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 723, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7618:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 726, + "mutability": "mutable", + "name": "data", + "nameLocation": "7646:4:7", + "nodeType": "VariableDeclaration", + "scope": 759, + "src": "7633:17:7", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 725, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "7633:5:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "7589:62:7" + }, + "returnParameters": { + "id": 728, + "nodeType": "ParameterList", + "parameters": [], + "src": "7661:0:7" + }, + "scope": 831, + "src": "7559:320:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 781, + "nodeType": "Block", + "src": "8481:1136:7", + "statements": [ + { + "assignments": [ + 775 + ], + "declarations": [ + { + "constant": false, + "id": 775, + "mutability": "mutable", + "name": "selector", + "nameLocation": "8498:8:7", + "nodeType": "VariableDeclaration", + "scope": 781, + "src": "8491:15:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "typeName": { + "id": 774, + "name": "bytes4", + "nodeType": "ElementaryTypeName", + "src": "8491:6:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "visibility": "internal" + } + ], + "id": 779, + "initialValue": { + "expression": { + "expression": { + "id": 776, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "8509:6:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$340_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 777, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "8516:8:7", + "memberName": "transfer", + "nodeType": "MemberAccess", + "referencedDeclaration": 307, + "src": "8509:15:7", + "typeDescriptions": { + "typeIdentifier": "t_function_declaration_nonpayable$_t_address_$_t_uint256_$returns$_t_bool_$", + "typeString": "function IERC20.transfer(address,uint256) returns (bool)" + } + }, + "id": 778, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "8525:8:7", + "memberName": "selector", + "nodeType": "MemberAccess", + "src": "8509:24:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8491:42:7" + }, + { + "AST": { + "nativeSrc": "8569:1042:7", + "nodeType": "YulBlock", + "src": "8569:1042:7", + "statements": [ + { + "nativeSrc": "8583:22:7", + "nodeType": "YulVariableDeclaration", + "src": "8583:22:7", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "8600:4:7", + "nodeType": "YulLiteral", + "src": "8600:4:7", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "8594:5:7", + "nodeType": "YulIdentifier", + "src": "8594:5:7" + }, + "nativeSrc": "8594:11:7", + "nodeType": "YulFunctionCall", + "src": "8594:11:7" + }, + "variables": [ + { + "name": "fmp", + "nativeSrc": "8587:3:7", + "nodeType": "YulTypedName", + "src": "8587:3:7", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "8625:4:7", + "nodeType": "YulLiteral", + "src": "8625:4:7", + "type": "", + "value": "0x00" + }, + { + "name": "selector", + "nativeSrc": "8631:8:7", + "nodeType": "YulIdentifier", + "src": "8631:8:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8618:6:7", + "nodeType": "YulIdentifier", + "src": "8618:6:7" + }, + "nativeSrc": "8618:22:7", + "nodeType": "YulFunctionCall", + "src": "8618:22:7" + }, + "nativeSrc": "8618:22:7", + "nodeType": "YulExpressionStatement", + "src": "8618:22:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "8660:4:7", + "nodeType": "YulLiteral", + "src": "8660:4:7", + "type": "", + "value": "0x04" + }, + { + "arguments": [ + { + "name": "to", + "nativeSrc": "8670:2:7", + "nodeType": "YulIdentifier", + "src": "8670:2:7" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "8678:2:7", + "nodeType": "YulLiteral", + "src": "8678:2:7", + "type": "", + "value": "96" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "8686:1:7", + "nodeType": "YulLiteral", + "src": "8686:1:7", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "8682:3:7", + "nodeType": "YulIdentifier", + "src": "8682:3:7" + }, + "nativeSrc": "8682:6:7", + "nodeType": "YulFunctionCall", + "src": "8682:6:7" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "8674:3:7", + "nodeType": "YulIdentifier", + "src": "8674:3:7" + }, + "nativeSrc": "8674:15:7", + "nodeType": "YulFunctionCall", + "src": "8674:15:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "8666:3:7", + "nodeType": "YulIdentifier", + "src": "8666:3:7" + }, + "nativeSrc": "8666:24:7", + "nodeType": "YulFunctionCall", + "src": "8666:24:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8653:6:7", + "nodeType": "YulIdentifier", + "src": "8653:6:7" + }, + "nativeSrc": "8653:38:7", + "nodeType": "YulFunctionCall", + "src": "8653:38:7" + }, + "nativeSrc": "8653:38:7", + "nodeType": "YulExpressionStatement", + "src": "8653:38:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "8711:4:7", + "nodeType": "YulLiteral", + "src": "8711:4:7", + "type": "", + "value": "0x24" + }, + { + "name": "value", + "nativeSrc": "8717:5:7", + "nodeType": "YulIdentifier", + "src": "8717:5:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8704:6:7", + "nodeType": "YulIdentifier", + "src": "8704:6:7" + }, + "nativeSrc": "8704:19:7", + "nodeType": "YulFunctionCall", + "src": "8704:19:7" + }, + "nativeSrc": "8704:19:7", + "nodeType": "YulExpressionStatement", + "src": "8704:19:7" + }, + { + "nativeSrc": "8736:56:7", + "nodeType": "YulAssignment", + "src": "8736:56:7", + "value": { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "gas", + "nativeSrc": "8752:3:7", + "nodeType": "YulIdentifier", + "src": "8752:3:7" + }, + "nativeSrc": "8752:5:7", + "nodeType": "YulFunctionCall", + "src": "8752:5:7" + }, + { + "name": "token", + "nativeSrc": "8759:5:7", + "nodeType": "YulIdentifier", + "src": "8759:5:7" + }, + { + "kind": "number", + "nativeSrc": "8766:1:7", + "nodeType": "YulLiteral", + "src": "8766:1:7", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "8769:4:7", + "nodeType": "YulLiteral", + "src": "8769:4:7", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "8775:4:7", + "nodeType": "YulLiteral", + "src": "8775:4:7", + "type": "", + "value": "0x44" + }, + { + "kind": "number", + "nativeSrc": "8781:4:7", + "nodeType": "YulLiteral", + "src": "8781:4:7", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "8787:4:7", + "nodeType": "YulLiteral", + "src": "8787:4:7", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "call", + "nativeSrc": "8747:4:7", + "nodeType": "YulIdentifier", + "src": "8747:4:7" + }, + "nativeSrc": "8747:45:7", + "nodeType": "YulFunctionCall", + "src": "8747:45:7" + }, + "variableNames": [ + { + "name": "success", + "nativeSrc": "8736:7:7", + "nodeType": "YulIdentifier", + "src": "8736:7:7" + } + ] + }, + { + "body": { + "nativeSrc": "9009:562:7", + "nodeType": "YulBlock", + "src": "9009:562:7", + "statements": [ + { + "body": { + "nativeSrc": "9144:133:7", + "nodeType": "YulBlock", + "src": "9144:133:7", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "9181:3:7", + "nodeType": "YulIdentifier", + "src": "9181:3:7" + }, + { + "kind": "number", + "nativeSrc": "9186:4:7", + "nodeType": "YulLiteral", + "src": "9186:4:7", + "type": "", + "value": "0x00" + }, + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nativeSrc": "9192:14:7", + "nodeType": "YulIdentifier", + "src": "9192:14:7" + }, + "nativeSrc": "9192:16:7", + "nodeType": "YulFunctionCall", + "src": "9192:16:7" + } + ], + "functionName": { + "name": "returndatacopy", + "nativeSrc": "9166:14:7", + "nodeType": "YulIdentifier", + "src": "9166:14:7" + }, + "nativeSrc": "9166:43:7", + "nodeType": "YulFunctionCall", + "src": "9166:43:7" + }, + "nativeSrc": "9166:43:7", + "nodeType": "YulExpressionStatement", + "src": "9166:43:7" + }, + { + "expression": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "9237:3:7", + "nodeType": "YulIdentifier", + "src": "9237:3:7" + }, + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nativeSrc": "9242:14:7", + "nodeType": "YulIdentifier", + "src": "9242:14:7" + }, + "nativeSrc": "9242:16:7", + "nodeType": "YulFunctionCall", + "src": "9242:16:7" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "9230:6:7", + "nodeType": "YulIdentifier", + "src": "9230:6:7" + }, + "nativeSrc": "9230:29:7", + "nodeType": "YulFunctionCall", + "src": "9230:29:7" + }, + "nativeSrc": "9230:29:7", + "nodeType": "YulExpressionStatement", + "src": "9230:29:7" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "success", + "nativeSrc": "9126:7:7", + "nodeType": "YulIdentifier", + "src": "9126:7:7" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "9119:6:7", + "nodeType": "YulIdentifier", + "src": "9119:6:7" + }, + "nativeSrc": "9119:15:7", + "nodeType": "YulFunctionCall", + "src": "9119:15:7" + }, + { + "name": "bubble", + "nativeSrc": "9136:6:7", + "nodeType": "YulIdentifier", + "src": "9136:6:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "9115:3:7", + "nodeType": "YulIdentifier", + "src": "9115:3:7" + }, + "nativeSrc": "9115:28:7", + "nodeType": "YulFunctionCall", + "src": "9115:28:7" + }, + "nativeSrc": "9112:165:7", + "nodeType": "YulIf", + "src": "9112:165:7" + }, + { + "nativeSrc": "9476:81:7", + "nodeType": "YulAssignment", + "src": "9476:81:7", + "value": { + "arguments": [ + { + "name": "success", + "nativeSrc": "9491:7:7", + "nodeType": "YulIdentifier", + "src": "9491:7:7" + }, + { + "arguments": [ + { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nativeSrc": "9511:14:7", + "nodeType": "YulIdentifier", + "src": "9511:14:7" + }, + "nativeSrc": "9511:16:7", + "nodeType": "YulFunctionCall", + "src": "9511:16:7" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "9504:6:7", + "nodeType": "YulIdentifier", + "src": "9504:6:7" + }, + "nativeSrc": "9504:24:7", + "nodeType": "YulFunctionCall", + "src": "9504:24:7" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "token", + "nativeSrc": "9545:5:7", + "nodeType": "YulIdentifier", + "src": "9545:5:7" + } + ], + "functionName": { + "name": "extcodesize", + "nativeSrc": "9533:11:7", + "nodeType": "YulIdentifier", + "src": "9533:11:7" + }, + "nativeSrc": "9533:18:7", + "nodeType": "YulFunctionCall", + "src": "9533:18:7" + }, + { + "kind": "number", + "nativeSrc": "9553:1:7", + "nodeType": "YulLiteral", + "src": "9553:1:7", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "gt", + "nativeSrc": "9530:2:7", + "nodeType": "YulIdentifier", + "src": "9530:2:7" + }, + "nativeSrc": "9530:25:7", + "nodeType": "YulFunctionCall", + "src": "9530:25:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "9500:3:7", + "nodeType": "YulIdentifier", + "src": "9500:3:7" + }, + "nativeSrc": "9500:56:7", + "nodeType": "YulFunctionCall", + "src": "9500:56:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "9487:3:7", + "nodeType": "YulIdentifier", + "src": "9487:3:7" + }, + "nativeSrc": "9487:70:7", + "nodeType": "YulFunctionCall", + "src": "9487:70:7" + }, + "variableNames": [ + { + "name": "success", + "nativeSrc": "9476:7:7", + "nodeType": "YulIdentifier", + "src": "9476:7:7" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "success", + "nativeSrc": "8979:7:7", + "nodeType": "YulIdentifier", + "src": "8979:7:7" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "8997:4:7", + "nodeType": "YulLiteral", + "src": "8997:4:7", + "type": "", + "value": "0x00" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "8991:5:7", + "nodeType": "YulIdentifier", + "src": "8991:5:7" + }, + "nativeSrc": "8991:11:7", + "nodeType": "YulFunctionCall", + "src": "8991:11:7" + }, + { + "kind": "number", + "nativeSrc": "9004:1:7", + "nodeType": "YulLiteral", + "src": "9004:1:7", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "eq", + "nativeSrc": "8988:2:7", + "nodeType": "YulIdentifier", + "src": "8988:2:7" + }, + "nativeSrc": "8988:18:7", + "nodeType": "YulFunctionCall", + "src": "8988:18:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "8975:3:7", + "nodeType": "YulIdentifier", + "src": "8975:3:7" + }, + "nativeSrc": "8975:32:7", + "nodeType": "YulFunctionCall", + "src": "8975:32:7" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "8968:6:7", + "nodeType": "YulIdentifier", + "src": "8968:6:7" + }, + "nativeSrc": "8968:40:7", + "nodeType": "YulFunctionCall", + "src": "8968:40:7" + }, + "nativeSrc": "8965:606:7", + "nodeType": "YulIf", + "src": "8965:606:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9591:4:7", + "nodeType": "YulLiteral", + "src": "9591:4:7", + "type": "", + "value": "0x40" + }, + { + "name": "fmp", + "nativeSrc": "9597:3:7", + "nodeType": "YulIdentifier", + "src": "9597:3:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "9584:6:7", + "nodeType": "YulIdentifier", + "src": "9584:6:7" + }, + "nativeSrc": "9584:17:7", + "nodeType": "YulFunctionCall", + "src": "9584:17:7" + }, + "nativeSrc": "9584:17:7", + "nodeType": "YulExpressionStatement", + "src": "9584:17:7" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 769, + "isOffset": false, + "isSlot": false, + "src": "9136:6:7", + "valueSize": 1 + }, + { + "declaration": 775, + "isOffset": false, + "isSlot": false, + "src": "8631:8:7", + "valueSize": 1 + }, + { + "declaration": 772, + "isOffset": false, + "isSlot": false, + "src": "8736:7:7", + "valueSize": 1 + }, + { + "declaration": 772, + "isOffset": false, + "isSlot": false, + "src": "8979:7:7", + "valueSize": 1 + }, + { + "declaration": 772, + "isOffset": false, + "isSlot": false, + "src": "9126:7:7", + "valueSize": 1 + }, + { + "declaration": 772, + "isOffset": false, + "isSlot": false, + "src": "9476:7:7", + "valueSize": 1 + }, + { + "declaration": 772, + "isOffset": false, + "isSlot": false, + "src": "9491:7:7", + "valueSize": 1 + }, + { + "declaration": 765, + "isOffset": false, + "isSlot": false, + "src": "8670:2:7", + "valueSize": 1 + }, + { + "declaration": 763, + "isOffset": false, + "isSlot": false, + "src": "8759:5:7", + "valueSize": 1 + }, + { + "declaration": 763, + "isOffset": false, + "isSlot": false, + "src": "9545:5:7", + "valueSize": 1 + }, + { + "declaration": 767, + "isOffset": false, + "isSlot": false, + "src": "8717:5:7", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 780, + "nodeType": "InlineAssembly", + "src": "8544:1067:7" + } + ] + }, + "documentation": { + "id": 760, + "nodeType": "StructuredDocumentation", + "src": "7885:483:7", + "text": " @dev Imitates a Solidity `token.transfer(to, value)` call, relaxing the requirement on the return value: the\n return value is optional (but if data is returned, it must not be false).\n @param token The token targeted by the call.\n @param to The recipient of the tokens\n @param value The amount of token to transfer\n @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean." + }, + "id": 782, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_safeTransfer", + "nameLocation": "8382:13:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 770, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 763, + "mutability": "mutable", + "name": "token", + "nameLocation": "8403:5:7", + "nodeType": "VariableDeclaration", + "scope": 782, + "src": "8396:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 762, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 761, + "name": "IERC20", + "nameLocations": [ + "8396:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "8396:6:7" + }, + "referencedDeclaration": 340, + "src": "8396:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 765, + "mutability": "mutable", + "name": "to", + "nameLocation": "8418:2:7", + "nodeType": "VariableDeclaration", + "scope": 782, + "src": "8410:10:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 764, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "8410:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 767, + "mutability": "mutable", + "name": "value", + "nameLocation": "8430:5:7", + "nodeType": "VariableDeclaration", + "scope": 782, + "src": "8422:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 766, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8422:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 769, + "mutability": "mutable", + "name": "bubble", + "nameLocation": "8442:6:7", + "nodeType": "VariableDeclaration", + "scope": 782, + "src": "8437:11:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 768, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "8437:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "8395:54:7" + }, + "returnParameters": { + "id": 773, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 772, + "mutability": "mutable", + "name": "success", + "nameLocation": "8472:7:7", + "nodeType": "VariableDeclaration", + "scope": 782, + "src": "8467:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 771, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "8467:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "8466:14:7" + }, + "scope": 831, + "src": "8373:1244:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 806, + "nodeType": "Block", + "src": "10337:1221:7", + "statements": [ + { + "assignments": [ + 800 + ], + "declarations": [ + { + "constant": false, + "id": 800, + "mutability": "mutable", + "name": "selector", + "nameLocation": "10354:8:7", + "nodeType": "VariableDeclaration", + "scope": 806, + "src": "10347:15:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "typeName": { + "id": 799, + "name": "bytes4", + "nodeType": "ElementaryTypeName", + "src": "10347:6:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "visibility": "internal" + } + ], + "id": 804, + "initialValue": { + "expression": { + "expression": { + "id": 801, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "10365:6:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$340_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 802, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "10372:12:7", + "memberName": "transferFrom", + "nodeType": "MemberAccess", + "referencedDeclaration": 339, + "src": "10365:19:7", + "typeDescriptions": { + "typeIdentifier": "t_function_declaration_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$_t_bool_$", + "typeString": "function IERC20.transferFrom(address,address,uint256) returns (bool)" + } + }, + "id": 803, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "10385:8:7", + "memberName": "selector", + "nodeType": "MemberAccess", + "src": "10365:28:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "10347:46:7" + }, + { + "AST": { + "nativeSrc": "10429:1123:7", + "nodeType": "YulBlock", + "src": "10429:1123:7", + "statements": [ + { + "nativeSrc": "10443:22:7", + "nodeType": "YulVariableDeclaration", + "src": "10443:22:7", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10460:4:7", + "nodeType": "YulLiteral", + "src": "10460:4:7", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "10454:5:7", + "nodeType": "YulIdentifier", + "src": "10454:5:7" + }, + "nativeSrc": "10454:11:7", + "nodeType": "YulFunctionCall", + "src": "10454:11:7" + }, + "variables": [ + { + "name": "fmp", + "nativeSrc": "10447:3:7", + "nodeType": "YulTypedName", + "src": "10447:3:7", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10485:4:7", + "nodeType": "YulLiteral", + "src": "10485:4:7", + "type": "", + "value": "0x00" + }, + { + "name": "selector", + "nativeSrc": "10491:8:7", + "nodeType": "YulIdentifier", + "src": "10491:8:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10478:6:7", + "nodeType": "YulIdentifier", + "src": "10478:6:7" + }, + "nativeSrc": "10478:22:7", + "nodeType": "YulFunctionCall", + "src": "10478:22:7" + }, + "nativeSrc": "10478:22:7", + "nodeType": "YulExpressionStatement", + "src": "10478:22:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10520:4:7", + "nodeType": "YulLiteral", + "src": "10520:4:7", + "type": "", + "value": "0x04" + }, + { + "arguments": [ + { + "name": "from", + "nativeSrc": "10530:4:7", + "nodeType": "YulIdentifier", + "src": "10530:4:7" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10540:2:7", + "nodeType": "YulLiteral", + "src": "10540:2:7", + "type": "", + "value": "96" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10548:1:7", + "nodeType": "YulLiteral", + "src": "10548:1:7", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "10544:3:7", + "nodeType": "YulIdentifier", + "src": "10544:3:7" + }, + "nativeSrc": "10544:6:7", + "nodeType": "YulFunctionCall", + "src": "10544:6:7" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "10536:3:7", + "nodeType": "YulIdentifier", + "src": "10536:3:7" + }, + "nativeSrc": "10536:15:7", + "nodeType": "YulFunctionCall", + "src": "10536:15:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "10526:3:7", + "nodeType": "YulIdentifier", + "src": "10526:3:7" + }, + "nativeSrc": "10526:26:7", + "nodeType": "YulFunctionCall", + "src": "10526:26:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10513:6:7", + "nodeType": "YulIdentifier", + "src": "10513:6:7" + }, + "nativeSrc": "10513:40:7", + "nodeType": "YulFunctionCall", + "src": "10513:40:7" + }, + "nativeSrc": "10513:40:7", + "nodeType": "YulExpressionStatement", + "src": "10513:40:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10573:4:7", + "nodeType": "YulLiteral", + "src": "10573:4:7", + "type": "", + "value": "0x24" + }, + { + "arguments": [ + { + "name": "to", + "nativeSrc": "10583:2:7", + "nodeType": "YulIdentifier", + "src": "10583:2:7" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10591:2:7", + "nodeType": "YulLiteral", + "src": "10591:2:7", + "type": "", + "value": "96" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10599:1:7", + "nodeType": "YulLiteral", + "src": "10599:1:7", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "10595:3:7", + "nodeType": "YulIdentifier", + "src": "10595:3:7" + }, + "nativeSrc": "10595:6:7", + "nodeType": "YulFunctionCall", + "src": "10595:6:7" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "10587:3:7", + "nodeType": "YulIdentifier", + "src": "10587:3:7" + }, + "nativeSrc": "10587:15:7", + "nodeType": "YulFunctionCall", + "src": "10587:15:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "10579:3:7", + "nodeType": "YulIdentifier", + "src": "10579:3:7" + }, + "nativeSrc": "10579:24:7", + "nodeType": "YulFunctionCall", + "src": "10579:24:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10566:6:7", + "nodeType": "YulIdentifier", + "src": "10566:6:7" + }, + "nativeSrc": "10566:38:7", + "nodeType": "YulFunctionCall", + "src": "10566:38:7" + }, + "nativeSrc": "10566:38:7", + "nodeType": "YulExpressionStatement", + "src": "10566:38:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10624:4:7", + "nodeType": "YulLiteral", + "src": "10624:4:7", + "type": "", + "value": "0x44" + }, + { + "name": "value", + "nativeSrc": "10630:5:7", + "nodeType": "YulIdentifier", + "src": "10630:5:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10617:6:7", + "nodeType": "YulIdentifier", + "src": "10617:6:7" + }, + "nativeSrc": "10617:19:7", + "nodeType": "YulFunctionCall", + "src": "10617:19:7" + }, + "nativeSrc": "10617:19:7", + "nodeType": "YulExpressionStatement", + "src": "10617:19:7" + }, + { + "nativeSrc": "10649:56:7", + "nodeType": "YulAssignment", + "src": "10649:56:7", + "value": { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "gas", + "nativeSrc": "10665:3:7", + "nodeType": "YulIdentifier", + "src": "10665:3:7" + }, + "nativeSrc": "10665:5:7", + "nodeType": "YulFunctionCall", + "src": "10665:5:7" + }, + { + "name": "token", + "nativeSrc": "10672:5:7", + "nodeType": "YulIdentifier", + "src": "10672:5:7" + }, + { + "kind": "number", + "nativeSrc": "10679:1:7", + "nodeType": "YulLiteral", + "src": "10679:1:7", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "10682:4:7", + "nodeType": "YulLiteral", + "src": "10682:4:7", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "10688:4:7", + "nodeType": "YulLiteral", + "src": "10688:4:7", + "type": "", + "value": "0x64" + }, + { + "kind": "number", + "nativeSrc": "10694:4:7", + "nodeType": "YulLiteral", + "src": "10694:4:7", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "10700:4:7", + "nodeType": "YulLiteral", + "src": "10700:4:7", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "call", + "nativeSrc": "10660:4:7", + "nodeType": "YulIdentifier", + "src": "10660:4:7" + }, + "nativeSrc": "10660:45:7", + "nodeType": "YulFunctionCall", + "src": "10660:45:7" + }, + "variableNames": [ + { + "name": "success", + "nativeSrc": "10649:7:7", + "nodeType": "YulIdentifier", + "src": "10649:7:7" + } + ] + }, + { + "body": { + "nativeSrc": "10922:562:7", + "nodeType": "YulBlock", + "src": "10922:562:7", + "statements": [ + { + "body": { + "nativeSrc": "11057:133:7", + "nodeType": "YulBlock", + "src": "11057:133:7", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "11094:3:7", + "nodeType": "YulIdentifier", + "src": "11094:3:7" + }, + { + "kind": "number", + "nativeSrc": "11099:4:7", + "nodeType": "YulLiteral", + "src": "11099:4:7", + "type": "", + "value": "0x00" + }, + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nativeSrc": "11105:14:7", + "nodeType": "YulIdentifier", + "src": "11105:14:7" + }, + "nativeSrc": "11105:16:7", + "nodeType": "YulFunctionCall", + "src": "11105:16:7" + } + ], + "functionName": { + "name": "returndatacopy", + "nativeSrc": "11079:14:7", + "nodeType": "YulIdentifier", + "src": "11079:14:7" + }, + "nativeSrc": "11079:43:7", + "nodeType": "YulFunctionCall", + "src": "11079:43:7" + }, + "nativeSrc": "11079:43:7", + "nodeType": "YulExpressionStatement", + "src": "11079:43:7" + }, + { + "expression": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "11150:3:7", + "nodeType": "YulIdentifier", + "src": "11150:3:7" + }, + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nativeSrc": "11155:14:7", + "nodeType": "YulIdentifier", + "src": "11155:14:7" + }, + "nativeSrc": "11155:16:7", + "nodeType": "YulFunctionCall", + "src": "11155:16:7" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "11143:6:7", + "nodeType": "YulIdentifier", + "src": "11143:6:7" + }, + "nativeSrc": "11143:29:7", + "nodeType": "YulFunctionCall", + "src": "11143:29:7" + }, + "nativeSrc": "11143:29:7", + "nodeType": "YulExpressionStatement", + "src": "11143:29:7" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "success", + "nativeSrc": "11039:7:7", + "nodeType": "YulIdentifier", + "src": "11039:7:7" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "11032:6:7", + "nodeType": "YulIdentifier", + "src": "11032:6:7" + }, + "nativeSrc": "11032:15:7", + "nodeType": "YulFunctionCall", + "src": "11032:15:7" + }, + { + "name": "bubble", + "nativeSrc": "11049:6:7", + "nodeType": "YulIdentifier", + "src": "11049:6:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "11028:3:7", + "nodeType": "YulIdentifier", + "src": "11028:3:7" + }, + "nativeSrc": "11028:28:7", + "nodeType": "YulFunctionCall", + "src": "11028:28:7" + }, + "nativeSrc": "11025:165:7", + "nodeType": "YulIf", + "src": "11025:165:7" + }, + { + "nativeSrc": "11389:81:7", + "nodeType": "YulAssignment", + "src": "11389:81:7", + "value": { + "arguments": [ + { + "name": "success", + "nativeSrc": "11404:7:7", + "nodeType": "YulIdentifier", + "src": "11404:7:7" + }, + { + "arguments": [ + { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nativeSrc": "11424:14:7", + "nodeType": "YulIdentifier", + "src": "11424:14:7" + }, + "nativeSrc": "11424:16:7", + "nodeType": "YulFunctionCall", + "src": "11424:16:7" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "11417:6:7", + "nodeType": "YulIdentifier", + "src": "11417:6:7" + }, + "nativeSrc": "11417:24:7", + "nodeType": "YulFunctionCall", + "src": "11417:24:7" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "token", + "nativeSrc": "11458:5:7", + "nodeType": "YulIdentifier", + "src": "11458:5:7" + } + ], + "functionName": { + "name": "extcodesize", + "nativeSrc": "11446:11:7", + "nodeType": "YulIdentifier", + "src": "11446:11:7" + }, + "nativeSrc": "11446:18:7", + "nodeType": "YulFunctionCall", + "src": "11446:18:7" + }, + { + "kind": "number", + "nativeSrc": "11466:1:7", + "nodeType": "YulLiteral", + "src": "11466:1:7", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "gt", + "nativeSrc": "11443:2:7", + "nodeType": "YulIdentifier", + "src": "11443:2:7" + }, + "nativeSrc": "11443:25:7", + "nodeType": "YulFunctionCall", + "src": "11443:25:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "11413:3:7", + "nodeType": "YulIdentifier", + "src": "11413:3:7" + }, + "nativeSrc": "11413:56:7", + "nodeType": "YulFunctionCall", + "src": "11413:56:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "11400:3:7", + "nodeType": "YulIdentifier", + "src": "11400:3:7" + }, + "nativeSrc": "11400:70:7", + "nodeType": "YulFunctionCall", + "src": "11400:70:7" + }, + "variableNames": [ + { + "name": "success", + "nativeSrc": "11389:7:7", + "nodeType": "YulIdentifier", + "src": "11389:7:7" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "success", + "nativeSrc": "10892:7:7", + "nodeType": "YulIdentifier", + "src": "10892:7:7" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10910:4:7", + "nodeType": "YulLiteral", + "src": "10910:4:7", + "type": "", + "value": "0x00" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "10904:5:7", + "nodeType": "YulIdentifier", + "src": "10904:5:7" + }, + "nativeSrc": "10904:11:7", + "nodeType": "YulFunctionCall", + "src": "10904:11:7" + }, + { + "kind": "number", + "nativeSrc": "10917:1:7", + "nodeType": "YulLiteral", + "src": "10917:1:7", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "eq", + "nativeSrc": "10901:2:7", + "nodeType": "YulIdentifier", + "src": "10901:2:7" + }, + "nativeSrc": "10901:18:7", + "nodeType": "YulFunctionCall", + "src": "10901:18:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "10888:3:7", + "nodeType": "YulIdentifier", + "src": "10888:3:7" + }, + "nativeSrc": "10888:32:7", + "nodeType": "YulFunctionCall", + "src": "10888:32:7" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "10881:6:7", + "nodeType": "YulIdentifier", + "src": "10881:6:7" + }, + "nativeSrc": "10881:40:7", + "nodeType": "YulFunctionCall", + "src": "10881:40:7" + }, + "nativeSrc": "10878:606:7", + "nodeType": "YulIf", + "src": "10878:606:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11504:4:7", + "nodeType": "YulLiteral", + "src": "11504:4:7", + "type": "", + "value": "0x40" + }, + { + "name": "fmp", + "nativeSrc": "11510:3:7", + "nodeType": "YulIdentifier", + "src": "11510:3:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "11497:6:7", + "nodeType": "YulIdentifier", + "src": "11497:6:7" + }, + "nativeSrc": "11497:17:7", + "nodeType": "YulFunctionCall", + "src": "11497:17:7" + }, + "nativeSrc": "11497:17:7", + "nodeType": "YulExpressionStatement", + "src": "11497:17:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11534:4:7", + "nodeType": "YulLiteral", + "src": "11534:4:7", + "type": "", + "value": "0x60" + }, + { + "kind": "number", + "nativeSrc": "11540:1:7", + "nodeType": "YulLiteral", + "src": "11540:1:7", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "11527:6:7", + "nodeType": "YulIdentifier", + "src": "11527:6:7" + }, + "nativeSrc": "11527:15:7", + "nodeType": "YulFunctionCall", + "src": "11527:15:7" + }, + "nativeSrc": "11527:15:7", + "nodeType": "YulExpressionStatement", + "src": "11527:15:7" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 794, + "isOffset": false, + "isSlot": false, + "src": "11049:6:7", + "valueSize": 1 + }, + { + "declaration": 788, + "isOffset": false, + "isSlot": false, + "src": "10530:4:7", + "valueSize": 1 + }, + { + "declaration": 800, + "isOffset": false, + "isSlot": false, + "src": "10491:8:7", + "valueSize": 1 + }, + { + "declaration": 797, + "isOffset": false, + "isSlot": false, + "src": "10649:7:7", + "valueSize": 1 + }, + { + "declaration": 797, + "isOffset": false, + "isSlot": false, + "src": "10892:7:7", + "valueSize": 1 + }, + { + "declaration": 797, + "isOffset": false, + "isSlot": false, + "src": "11039:7:7", + "valueSize": 1 + }, + { + "declaration": 797, + "isOffset": false, + "isSlot": false, + "src": "11389:7:7", + "valueSize": 1 + }, + { + "declaration": 797, + "isOffset": false, + "isSlot": false, + "src": "11404:7:7", + "valueSize": 1 + }, + { + "declaration": 790, + "isOffset": false, + "isSlot": false, + "src": "10583:2:7", + "valueSize": 1 + }, + { + "declaration": 786, + "isOffset": false, + "isSlot": false, + "src": "10672:5:7", + "valueSize": 1 + }, + { + "declaration": 786, + "isOffset": false, + "isSlot": false, + "src": "11458:5:7", + "valueSize": 1 + }, + { + "declaration": 792, + "isOffset": false, + "isSlot": false, + "src": "10630:5:7", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 805, + "nodeType": "InlineAssembly", + "src": "10404:1148:7" + } + ] + }, + "documentation": { + "id": 783, + "nodeType": "StructuredDocumentation", + "src": "9623:537:7", + "text": " @dev Imitates a Solidity `token.transferFrom(from, to, value)` call, relaxing the requirement on the return\n value: the return value is optional (but if data is returned, it must not be false).\n @param token The token targeted by the call.\n @param from The sender of the tokens\n @param to The recipient of the tokens\n @param value The amount of token to transfer\n @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean." + }, + "id": 807, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_safeTransferFrom", + "nameLocation": "10174:17:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 795, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 786, + "mutability": "mutable", + "name": "token", + "nameLocation": "10208:5:7", + "nodeType": "VariableDeclaration", + "scope": 807, + "src": "10201:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 785, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 784, + "name": "IERC20", + "nameLocations": [ + "10201:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "10201:6:7" + }, + "referencedDeclaration": 340, + "src": "10201:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 788, + "mutability": "mutable", + "name": "from", + "nameLocation": "10231:4:7", + "nodeType": "VariableDeclaration", + "scope": 807, + "src": "10223:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 787, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "10223:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 790, + "mutability": "mutable", + "name": "to", + "nameLocation": "10253:2:7", + "nodeType": "VariableDeclaration", + "scope": 807, + "src": "10245:10:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 789, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "10245:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 792, + "mutability": "mutable", + "name": "value", + "nameLocation": "10273:5:7", + "nodeType": "VariableDeclaration", + "scope": 807, + "src": "10265:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 791, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10265:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 794, + "mutability": "mutable", + "name": "bubble", + "nameLocation": "10293:6:7", + "nodeType": "VariableDeclaration", + "scope": 807, + "src": "10288:11:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 793, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "10288:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "10191:114:7" + }, + "returnParameters": { + "id": 798, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 797, + "mutability": "mutable", + "name": "success", + "nameLocation": "10328:7:7", + "nodeType": "VariableDeclaration", + "scope": 807, + "src": "10323:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 796, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "10323:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "10322:14:7" + }, + "scope": 831, + "src": "10165:1393:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 829, + "nodeType": "Block", + "src": "12171:1140:7", + "statements": [ + { + "assignments": [ + 823 + ], + "declarations": [ + { + "constant": false, + "id": 823, + "mutability": "mutable", + "name": "selector", + "nameLocation": "12188:8:7", + "nodeType": "VariableDeclaration", + "scope": 829, + "src": "12181:15:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "typeName": { + "id": 822, + "name": "bytes4", + "nodeType": "ElementaryTypeName", + "src": "12181:6:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "visibility": "internal" + } + ], + "id": 827, + "initialValue": { + "expression": { + "expression": { + "id": 824, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "12199:6:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$340_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 825, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "12206:7:7", + "memberName": "approve", + "nodeType": "MemberAccess", + "referencedDeclaration": 327, + "src": "12199:14:7", + "typeDescriptions": { + "typeIdentifier": "t_function_declaration_nonpayable$_t_address_$_t_uint256_$returns$_t_bool_$", + "typeString": "function IERC20.approve(address,uint256) returns (bool)" + } + }, + "id": 826, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "12214:8:7", + "memberName": "selector", + "nodeType": "MemberAccess", + "src": "12199:23:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "12181:41:7" + }, + { + "AST": { + "nativeSrc": "12258:1047:7", + "nodeType": "YulBlock", + "src": "12258:1047:7", + "statements": [ + { + "nativeSrc": "12272:22:7", + "nodeType": "YulVariableDeclaration", + "src": "12272:22:7", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "12289:4:7", + "nodeType": "YulLiteral", + "src": "12289:4:7", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "12283:5:7", + "nodeType": "YulIdentifier", + "src": "12283:5:7" + }, + "nativeSrc": "12283:11:7", + "nodeType": "YulFunctionCall", + "src": "12283:11:7" + }, + "variables": [ + { + "name": "fmp", + "nativeSrc": "12276:3:7", + "nodeType": "YulTypedName", + "src": "12276:3:7", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "12314:4:7", + "nodeType": "YulLiteral", + "src": "12314:4:7", + "type": "", + "value": "0x00" + }, + { + "name": "selector", + "nativeSrc": "12320:8:7", + "nodeType": "YulIdentifier", + "src": "12320:8:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "12307:6:7", + "nodeType": "YulIdentifier", + "src": "12307:6:7" + }, + "nativeSrc": "12307:22:7", + "nodeType": "YulFunctionCall", + "src": "12307:22:7" + }, + "nativeSrc": "12307:22:7", + "nodeType": "YulExpressionStatement", + "src": "12307:22:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "12349:4:7", + "nodeType": "YulLiteral", + "src": "12349:4:7", + "type": "", + "value": "0x04" + }, + { + "arguments": [ + { + "name": "spender", + "nativeSrc": "12359:7:7", + "nodeType": "YulIdentifier", + "src": "12359:7:7" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "12372:2:7", + "nodeType": "YulLiteral", + "src": "12372:2:7", + "type": "", + "value": "96" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "12380:1:7", + "nodeType": "YulLiteral", + "src": "12380:1:7", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "12376:3:7", + "nodeType": "YulIdentifier", + "src": "12376:3:7" + }, + "nativeSrc": "12376:6:7", + "nodeType": "YulFunctionCall", + "src": "12376:6:7" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "12368:3:7", + "nodeType": "YulIdentifier", + "src": "12368:3:7" + }, + "nativeSrc": "12368:15:7", + "nodeType": "YulFunctionCall", + "src": "12368:15:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "12355:3:7", + "nodeType": "YulIdentifier", + "src": "12355:3:7" + }, + "nativeSrc": "12355:29:7", + "nodeType": "YulFunctionCall", + "src": "12355:29:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "12342:6:7", + "nodeType": "YulIdentifier", + "src": "12342:6:7" + }, + "nativeSrc": "12342:43:7", + "nodeType": "YulFunctionCall", + "src": "12342:43:7" + }, + "nativeSrc": "12342:43:7", + "nodeType": "YulExpressionStatement", + "src": "12342:43:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "12405:4:7", + "nodeType": "YulLiteral", + "src": "12405:4:7", + "type": "", + "value": "0x24" + }, + { + "name": "value", + "nativeSrc": "12411:5:7", + "nodeType": "YulIdentifier", + "src": "12411:5:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "12398:6:7", + "nodeType": "YulIdentifier", + "src": "12398:6:7" + }, + "nativeSrc": "12398:19:7", + "nodeType": "YulFunctionCall", + "src": "12398:19:7" + }, + "nativeSrc": "12398:19:7", + "nodeType": "YulExpressionStatement", + "src": "12398:19:7" + }, + { + "nativeSrc": "12430:56:7", + "nodeType": "YulAssignment", + "src": "12430:56:7", + "value": { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "gas", + "nativeSrc": "12446:3:7", + "nodeType": "YulIdentifier", + "src": "12446:3:7" + }, + "nativeSrc": "12446:5:7", + "nodeType": "YulFunctionCall", + "src": "12446:5:7" + }, + { + "name": "token", + "nativeSrc": "12453:5:7", + "nodeType": "YulIdentifier", + "src": "12453:5:7" + }, + { + "kind": "number", + "nativeSrc": "12460:1:7", + "nodeType": "YulLiteral", + "src": "12460:1:7", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "12463:4:7", + "nodeType": "YulLiteral", + "src": "12463:4:7", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "12469:4:7", + "nodeType": "YulLiteral", + "src": "12469:4:7", + "type": "", + "value": "0x44" + }, + { + "kind": "number", + "nativeSrc": "12475:4:7", + "nodeType": "YulLiteral", + "src": "12475:4:7", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "12481:4:7", + "nodeType": "YulLiteral", + "src": "12481:4:7", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "call", + "nativeSrc": "12441:4:7", + "nodeType": "YulIdentifier", + "src": "12441:4:7" + }, + "nativeSrc": "12441:45:7", + "nodeType": "YulFunctionCall", + "src": "12441:45:7" + }, + "variableNames": [ + { + "name": "success", + "nativeSrc": "12430:7:7", + "nodeType": "YulIdentifier", + "src": "12430:7:7" + } + ] + }, + { + "body": { + "nativeSrc": "12703:562:7", + "nodeType": "YulBlock", + "src": "12703:562:7", + "statements": [ + { + "body": { + "nativeSrc": "12838:133:7", + "nodeType": "YulBlock", + "src": "12838:133:7", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "12875:3:7", + "nodeType": "YulIdentifier", + "src": "12875:3:7" + }, + { + "kind": "number", + "nativeSrc": "12880:4:7", + "nodeType": "YulLiteral", + "src": "12880:4:7", + "type": "", + "value": "0x00" + }, + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nativeSrc": "12886:14:7", + "nodeType": "YulIdentifier", + "src": "12886:14:7" + }, + "nativeSrc": "12886:16:7", + "nodeType": "YulFunctionCall", + "src": "12886:16:7" + } + ], + "functionName": { + "name": "returndatacopy", + "nativeSrc": "12860:14:7", + "nodeType": "YulIdentifier", + "src": "12860:14:7" + }, + "nativeSrc": "12860:43:7", + "nodeType": "YulFunctionCall", + "src": "12860:43:7" + }, + "nativeSrc": "12860:43:7", + "nodeType": "YulExpressionStatement", + "src": "12860:43:7" + }, + { + "expression": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "12931:3:7", + "nodeType": "YulIdentifier", + "src": "12931:3:7" + }, + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nativeSrc": "12936:14:7", + "nodeType": "YulIdentifier", + "src": "12936:14:7" + }, + "nativeSrc": "12936:16:7", + "nodeType": "YulFunctionCall", + "src": "12936:16:7" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "12924:6:7", + "nodeType": "YulIdentifier", + "src": "12924:6:7" + }, + "nativeSrc": "12924:29:7", + "nodeType": "YulFunctionCall", + "src": "12924:29:7" + }, + "nativeSrc": "12924:29:7", + "nodeType": "YulExpressionStatement", + "src": "12924:29:7" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "success", + "nativeSrc": "12820:7:7", + "nodeType": "YulIdentifier", + "src": "12820:7:7" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "12813:6:7", + "nodeType": "YulIdentifier", + "src": "12813:6:7" + }, + "nativeSrc": "12813:15:7", + "nodeType": "YulFunctionCall", + "src": "12813:15:7" + }, + { + "name": "bubble", + "nativeSrc": "12830:6:7", + "nodeType": "YulIdentifier", + "src": "12830:6:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "12809:3:7", + "nodeType": "YulIdentifier", + "src": "12809:3:7" + }, + "nativeSrc": "12809:28:7", + "nodeType": "YulFunctionCall", + "src": "12809:28:7" + }, + "nativeSrc": "12806:165:7", + "nodeType": "YulIf", + "src": "12806:165:7" + }, + { + "nativeSrc": "13170:81:7", + "nodeType": "YulAssignment", + "src": "13170:81:7", + "value": { + "arguments": [ + { + "name": "success", + "nativeSrc": "13185:7:7", + "nodeType": "YulIdentifier", + "src": "13185:7:7" + }, + { + "arguments": [ + { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nativeSrc": "13205:14:7", + "nodeType": "YulIdentifier", + "src": "13205:14:7" + }, + "nativeSrc": "13205:16:7", + "nodeType": "YulFunctionCall", + "src": "13205:16:7" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "13198:6:7", + "nodeType": "YulIdentifier", + "src": "13198:6:7" + }, + "nativeSrc": "13198:24:7", + "nodeType": "YulFunctionCall", + "src": "13198:24:7" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "token", + "nativeSrc": "13239:5:7", + "nodeType": "YulIdentifier", + "src": "13239:5:7" + } + ], + "functionName": { + "name": "extcodesize", + "nativeSrc": "13227:11:7", + "nodeType": "YulIdentifier", + "src": "13227:11:7" + }, + "nativeSrc": "13227:18:7", + "nodeType": "YulFunctionCall", + "src": "13227:18:7" + }, + { + "kind": "number", + "nativeSrc": "13247:1:7", + "nodeType": "YulLiteral", + "src": "13247:1:7", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "gt", + "nativeSrc": "13224:2:7", + "nodeType": "YulIdentifier", + "src": "13224:2:7" + }, + "nativeSrc": "13224:25:7", + "nodeType": "YulFunctionCall", + "src": "13224:25:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "13194:3:7", + "nodeType": "YulIdentifier", + "src": "13194:3:7" + }, + "nativeSrc": "13194:56:7", + "nodeType": "YulFunctionCall", + "src": "13194:56:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "13181:3:7", + "nodeType": "YulIdentifier", + "src": "13181:3:7" + }, + "nativeSrc": "13181:70:7", + "nodeType": "YulFunctionCall", + "src": "13181:70:7" + }, + "variableNames": [ + { + "name": "success", + "nativeSrc": "13170:7:7", + "nodeType": "YulIdentifier", + "src": "13170:7:7" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "success", + "nativeSrc": "12673:7:7", + "nodeType": "YulIdentifier", + "src": "12673:7:7" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "12691:4:7", + "nodeType": "YulLiteral", + "src": "12691:4:7", + "type": "", + "value": "0x00" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "12685:5:7", + "nodeType": "YulIdentifier", + "src": "12685:5:7" + }, + "nativeSrc": "12685:11:7", + "nodeType": "YulFunctionCall", + "src": "12685:11:7" + }, + { + "kind": "number", + "nativeSrc": "12698:1:7", + "nodeType": "YulLiteral", + "src": "12698:1:7", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "eq", + "nativeSrc": "12682:2:7", + "nodeType": "YulIdentifier", + "src": "12682:2:7" + }, + "nativeSrc": "12682:18:7", + "nodeType": "YulFunctionCall", + "src": "12682:18:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "12669:3:7", + "nodeType": "YulIdentifier", + "src": "12669:3:7" + }, + "nativeSrc": "12669:32:7", + "nodeType": "YulFunctionCall", + "src": "12669:32:7" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "12662:6:7", + "nodeType": "YulIdentifier", + "src": "12662:6:7" + }, + "nativeSrc": "12662:40:7", + "nodeType": "YulFunctionCall", + "src": "12662:40:7" + }, + "nativeSrc": "12659:606:7", + "nodeType": "YulIf", + "src": "12659:606:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "13285:4:7", + "nodeType": "YulLiteral", + "src": "13285:4:7", + "type": "", + "value": "0x40" + }, + { + "name": "fmp", + "nativeSrc": "13291:3:7", + "nodeType": "YulIdentifier", + "src": "13291:3:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "13278:6:7", + "nodeType": "YulIdentifier", + "src": "13278:6:7" + }, + "nativeSrc": "13278:17:7", + "nodeType": "YulFunctionCall", + "src": "13278:17:7" + }, + "nativeSrc": "13278:17:7", + "nodeType": "YulExpressionStatement", + "src": "13278:17:7" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 817, + "isOffset": false, + "isSlot": false, + "src": "12830:6:7", + "valueSize": 1 + }, + { + "declaration": 823, + "isOffset": false, + "isSlot": false, + "src": "12320:8:7", + "valueSize": 1 + }, + { + "declaration": 813, + "isOffset": false, + "isSlot": false, + "src": "12359:7:7", + "valueSize": 1 + }, + { + "declaration": 820, + "isOffset": false, + "isSlot": false, + "src": "12430:7:7", + "valueSize": 1 + }, + { + "declaration": 820, + "isOffset": false, + "isSlot": false, + "src": "12673:7:7", + "valueSize": 1 + }, + { + "declaration": 820, + "isOffset": false, + "isSlot": false, + "src": "12820:7:7", + "valueSize": 1 + }, + { + "declaration": 820, + "isOffset": false, + "isSlot": false, + "src": "13170:7:7", + "valueSize": 1 + }, + { + "declaration": 820, + "isOffset": false, + "isSlot": false, + "src": "13185:7:7", + "valueSize": 1 + }, + { + "declaration": 811, + "isOffset": false, + "isSlot": false, + "src": "12453:5:7", + "valueSize": 1 + }, + { + "declaration": 811, + "isOffset": false, + "isSlot": false, + "src": "13239:5:7", + "valueSize": 1 + }, + { + "declaration": 815, + "isOffset": false, + "isSlot": false, + "src": "12411:5:7", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 828, + "nodeType": "InlineAssembly", + "src": "12233:1072:7" + } + ] + }, + "documentation": { + "id": 808, + "nodeType": "StructuredDocumentation", + "src": "11564:490:7", + "text": " @dev Imitates a Solidity `token.approve(spender, value)` call, relaxing the requirement on the return value:\n the return value is optional (but if data is returned, it must not be false).\n @param token The token targeted by the call.\n @param spender The spender of the tokens\n @param value The amount of token to transfer\n @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean." + }, + "id": 830, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_safeApprove", + "nameLocation": "12068:12:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 818, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 811, + "mutability": "mutable", + "name": "token", + "nameLocation": "12088:5:7", + "nodeType": "VariableDeclaration", + "scope": 830, + "src": "12081:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 810, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 809, + "name": "IERC20", + "nameLocations": [ + "12081:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "12081:6:7" + }, + "referencedDeclaration": 340, + "src": "12081:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 813, + "mutability": "mutable", + "name": "spender", + "nameLocation": "12103:7:7", + "nodeType": "VariableDeclaration", + "scope": 830, + "src": "12095:15:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 812, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "12095:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 815, + "mutability": "mutable", + "name": "value", + "nameLocation": "12120:5:7", + "nodeType": "VariableDeclaration", + "scope": 830, + "src": "12112:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 814, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12112:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 817, + "mutability": "mutable", + "name": "bubble", + "nameLocation": "12132:6:7", + "nodeType": "VariableDeclaration", + "scope": 830, + "src": "12127:11:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 816, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "12127:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "12080:59:7" + }, + "returnParameters": { + "id": 821, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 820, + "mutability": "mutable", + "name": "success", + "nameLocation": "12162:7:7", + "nodeType": "VariableDeclaration", + "scope": 830, + "src": "12157:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 819, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "12157:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "12156:14:7" + }, + "scope": 831, + "src": "12059:1252:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "private" + } + ], + "scope": 832, + "src": "698:12615:7", + "usedErrors": [ + 388, + 397 + ], + "usedEvents": [] + } + ], + "src": "115:13199:7" + }, + "id": 7 + }, + "@openzeppelin/contracts/utils/Bytes.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/Bytes.sol", + "exportedSymbols": { + "Bytes": [ + 1632 + ], + "Math": [ + 6204 + ] + }, + "id": 1633, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 833, + "literals": [ + "solidity", + "^", + "0.8", + ".24" + ], + "nodeType": "PragmaDirective", + "src": "99:24:8" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/math/Math.sol", + "file": "./math/Math.sol", + "id": 835, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 1633, + "sourceUnit": 6205, + "src": "125:37:8", + "symbolAliases": [ + { + "foreign": { + "id": 834, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "133:4:8", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "Bytes", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 836, + "nodeType": "StructuredDocumentation", + "src": "164:33:8", + "text": " @dev Bytes operations." + }, + "fullyImplemented": true, + "id": 1632, + "linearizedBaseContracts": [ + 1632 + ], + "name": "Bytes", + "nameLocation": "206:5:8", + "nodeType": "ContractDefinition", + "nodes": [ + { + "body": { + "id": 852, + "nodeType": "Block", + "src": "687:45:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 847, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 839, + "src": "712:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 848, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 841, + "src": "720:1:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + { + "hexValue": "30", + "id": 849, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "723:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 846, + "name": "indexOf", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 853, + 902 + ], + "referencedDeclaration": 902, + "src": "704:7:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_bytes1_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bytes memory,bytes1,uint256) pure returns (uint256)" + } + }, + "id": 850, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "704:21:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 845, + "id": 851, + "nodeType": "Return", + "src": "697:28:8" + } + ] + }, + "documentation": { + "id": 837, + "nodeType": "StructuredDocumentation", + "src": "218:384:8", + "text": " @dev Forward search for `s` in `buffer`\n * If `s` is present in the buffer, returns the index of the first instance\n * If `s` is not present in the buffer, returns type(uint256).max\n NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf[Javascript's `Array.indexOf`]" + }, + "id": 853, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "indexOf", + "nameLocation": "616:7:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 842, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 839, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "637:6:8", + "nodeType": "VariableDeclaration", + "scope": 853, + "src": "624:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 838, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "624:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 841, + "mutability": "mutable", + "name": "s", + "nameLocation": "652:1:8", + "nodeType": "VariableDeclaration", + "scope": 853, + "src": "645:8:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 840, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "645:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + } + ], + "src": "623:31:8" + }, + "returnParameters": { + "id": 845, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 844, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 853, + "src": "678:7:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 843, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "678:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "677:9:8" + }, + "scope": 1632, + "src": "607:125:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 901, + "nodeType": "Block", + "src": "1286:246:8", + "statements": [ + { + "assignments": [ + 866 + ], + "declarations": [ + { + "constant": false, + "id": 866, + "mutability": "mutable", + "name": "length", + "nameLocation": "1304:6:8", + "nodeType": "VariableDeclaration", + "scope": 901, + "src": "1296:14:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 865, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1296:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 869, + "initialValue": { + "expression": { + "id": 867, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 856, + "src": "1313:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 868, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "1320:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "1313:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1296:30:8" + }, + { + "body": { + "id": 893, + "nodeType": "Block", + "src": "1375:117:8", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "id": 888, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "arguments": [ + { + "id": 883, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 856, + "src": "1423:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 884, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 871, + "src": "1431:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 882, + "name": "_unsafeReadBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1631, + "src": "1400:22:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (bytes memory,uint256) pure returns (bytes32)" + } + }, + "id": 885, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1400:33:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 881, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1393:6:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 880, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "1393:6:8", + "typeDescriptions": {} + } + }, + "id": 886, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1393:41:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 887, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 858, + "src": "1438:1:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "src": "1393:46:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 892, + "nodeType": "IfStatement", + "src": "1389:93:8", + "trueBody": { + "id": 891, + "nodeType": "Block", + "src": "1441:41:8", + "statements": [ + { + "expression": { + "id": 889, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 871, + "src": "1466:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 864, + "id": 890, + "nodeType": "Return", + "src": "1459:8:8" + } + ] + } + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 876, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 874, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 871, + "src": "1358:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 875, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 866, + "src": "1362:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1358:10:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 894, + "initializationExpression": { + "assignments": [ + 871 + ], + "declarations": [ + { + "constant": false, + "id": 871, + "mutability": "mutable", + "name": "i", + "nameLocation": "1349:1:8", + "nodeType": "VariableDeclaration", + "scope": 894, + "src": "1341:9:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 870, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1341:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 873, + "initialValue": { + "id": 872, + "name": "pos", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 860, + "src": "1353:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1341:15:8" + }, + "isSimpleCounterLoop": true, + "loopExpression": { + "expression": { + "id": 878, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": true, + "src": "1370:3:8", + "subExpression": { + "id": 877, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 871, + "src": "1372:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 879, + "nodeType": "ExpressionStatement", + "src": "1370:3:8" + }, + "nodeType": "ForStatement", + "src": "1336:156:8" + }, + { + "expression": { + "expression": { + "arguments": [ + { + "id": 897, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1513:7:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 896, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1513:7:8", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + } + ], + "id": 895, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "1508:4:8", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 898, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1508:13:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint256", + "typeString": "type(uint256)" + } + }, + "id": 899, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "1522:3:8", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "1508:17:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 864, + "id": 900, + "nodeType": "Return", + "src": "1501:24:8" + } + ] + }, + "documentation": { + "id": 854, + "nodeType": "StructuredDocumentation", + "src": "738:450:8", + "text": " @dev Forward search for `s` in `buffer` starting at position `pos`\n * If `s` is present in the buffer (at or after `pos`), returns the index of the next instance\n * If `s` is not present in the buffer (at or after `pos`), returns type(uint256).max\n NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf[Javascript's `Array.indexOf`]" + }, + "id": 902, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "indexOf", + "nameLocation": "1202:7:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 861, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 856, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "1223:6:8", + "nodeType": "VariableDeclaration", + "scope": 902, + "src": "1210:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 855, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1210:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 858, + "mutability": "mutable", + "name": "s", + "nameLocation": "1238:1:8", + "nodeType": "VariableDeclaration", + "scope": 902, + "src": "1231:8:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 857, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "1231:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 860, + "mutability": "mutable", + "name": "pos", + "nameLocation": "1249:3:8", + "nodeType": "VariableDeclaration", + "scope": 902, + "src": "1241:11:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 859, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1241:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1209:44:8" + }, + "returnParameters": { + "id": 864, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 863, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 902, + "src": "1277:7:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 862, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1277:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1276:9:8" + }, + "scope": 1632, + "src": "1193:339:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 922, + "nodeType": "Block", + "src": "2019:65:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 913, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 905, + "src": "2048:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 914, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 907, + "src": "2056:1:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + { + "expression": { + "arguments": [ + { + "id": 917, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2064:7:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 916, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2064:7:8", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + } + ], + "id": 915, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "2059:4:8", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 918, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2059:13:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint256", + "typeString": "type(uint256)" + } + }, + "id": 919, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "2073:3:8", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "2059:17:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 912, + "name": "lastIndexOf", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 923, + 985 + ], + "referencedDeclaration": 985, + "src": "2036:11:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_bytes1_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bytes memory,bytes1,uint256) pure returns (uint256)" + } + }, + "id": 920, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2036:41:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 911, + "id": 921, + "nodeType": "Return", + "src": "2029:48:8" + } + ] + }, + "documentation": { + "id": 903, + "nodeType": "StructuredDocumentation", + "src": "1538:392:8", + "text": " @dev Backward search for `s` in `buffer`\n * If `s` is present in the buffer, returns the index of the last instance\n * If `s` is not present in the buffer, returns type(uint256).max\n NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf[Javascript's `Array.lastIndexOf`]" + }, + "id": 923, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "lastIndexOf", + "nameLocation": "1944:11:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 908, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 905, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "1969:6:8", + "nodeType": "VariableDeclaration", + "scope": 923, + "src": "1956:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 904, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1956:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 907, + "mutability": "mutable", + "name": "s", + "nameLocation": "1984:1:8", + "nodeType": "VariableDeclaration", + "scope": 923, + "src": "1977:8:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 906, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "1977:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + } + ], + "src": "1955:31:8" + }, + "returnParameters": { + "id": 911, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 910, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 923, + "src": "2010:7:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 909, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2010:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2009:9:8" + }, + "scope": 1632, + "src": "1935:149:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 984, + "nodeType": "Block", + "src": "2657:348:8", + "statements": [ + { + "id": 983, + "nodeType": "UncheckedBlock", + "src": "2667:332:8", + "statements": [ + { + "assignments": [ + 936 + ], + "declarations": [ + { + "constant": false, + "id": 936, + "mutability": "mutable", + "name": "length", + "nameLocation": "2699:6:8", + "nodeType": "VariableDeclaration", + "scope": 983, + "src": "2691:14:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 935, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2691:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 939, + "initialValue": { + "expression": { + "id": 937, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 926, + "src": "2708:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 938, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2715:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "2708:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2691:30:8" + }, + { + "body": { + "id": 975, + "nodeType": "Block", + "src": "2810:141:8", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "id": 968, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "arguments": [ + { + "id": 961, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 926, + "src": "2862:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 964, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 962, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 941, + "src": "2870:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "hexValue": "31", + "id": 963, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2874:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "2870:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 960, + "name": "_unsafeReadBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1631, + "src": "2839:22:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (bytes memory,uint256) pure returns (bytes32)" + } + }, + "id": 965, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2839:37:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 959, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2832:6:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 958, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "2832:6:8", + "typeDescriptions": {} + } + }, + "id": 966, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2832:45:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 967, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 928, + "src": "2881:1:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "src": "2832:50:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 974, + "nodeType": "IfStatement", + "src": "2828:109:8", + "trueBody": { + "id": 973, + "nodeType": "Block", + "src": "2884:53:8", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 971, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 969, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 941, + "src": "2913:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "hexValue": "31", + "id": 970, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2917:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "2913:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 934, + "id": 972, + "nodeType": "Return", + "src": "2906:12:8" + } + ] + } + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 954, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 952, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 941, + "src": "2798:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 953, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2802:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "2798:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 976, + "initializationExpression": { + "assignments": [ + 941 + ], + "declarations": [ + { + "constant": false, + "id": 941, + "mutability": "mutable", + "name": "i", + "nameLocation": "2748:1:8", + "nodeType": "VariableDeclaration", + "scope": 976, + "src": "2740:9:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 940, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2740:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 951, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "id": 946, + "name": "pos", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 930, + "src": "2780:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "31", + "id": 947, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2785:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + } + ], + "expression": { + "id": 944, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "2761:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 945, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2766:13:8", + "memberName": "saturatingAdd", + "nodeType": "MemberAccess", + "referencedDeclaration": 4759, + "src": "2761:18:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 948, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2761:26:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 949, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 936, + "src": "2789:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 942, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "2752:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 943, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2757:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "2752:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 950, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2752:44:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2740:56:8" + }, + "isSimpleCounterLoop": false, + "loopExpression": { + "expression": { + "id": 956, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "--", + "prefix": true, + "src": "2805:3:8", + "subExpression": { + "id": 955, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 941, + "src": "2807:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 957, + "nodeType": "ExpressionStatement", + "src": "2805:3:8" + }, + "nodeType": "ForStatement", + "src": "2735:216:8" + }, + { + "expression": { + "expression": { + "arguments": [ + { + "id": 979, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2976:7:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 978, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2976:7:8", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + } + ], + "id": 977, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "2971:4:8", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 980, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2971:13:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint256", + "typeString": "type(uint256)" + } + }, + "id": 981, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "2985:3:8", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "2971:17:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 934, + "id": 982, + "nodeType": "Return", + "src": "2964:24:8" + } + ] + } + ] + }, + "documentation": { + "id": 924, + "nodeType": "StructuredDocumentation", + "src": "2090:465:8", + "text": " @dev Backward search for `s` in `buffer` starting at position `pos`\n * If `s` is present in the buffer (at or before `pos`), returns the index of the previous instance\n * If `s` is not present in the buffer (at or before `pos`), returns type(uint256).max\n NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf[Javascript's `Array.lastIndexOf`]" + }, + "id": 985, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "lastIndexOf", + "nameLocation": "2569:11:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 931, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 926, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "2594:6:8", + "nodeType": "VariableDeclaration", + "scope": 985, + "src": "2581:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 925, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2581:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 928, + "mutability": "mutable", + "name": "s", + "nameLocation": "2609:1:8", + "nodeType": "VariableDeclaration", + "scope": 985, + "src": "2602:8:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 927, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "2602:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 930, + "mutability": "mutable", + "name": "pos", + "nameLocation": "2620:3:8", + "nodeType": "VariableDeclaration", + "scope": 985, + "src": "2612:11:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 929, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2612:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2580:44:8" + }, + "returnParameters": { + "id": 934, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 933, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 985, + "src": "2648:7:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 932, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2648:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2647:9:8" + }, + "scope": 1632, + "src": "2560:445:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1002, + "nodeType": "Block", + "src": "3416:59:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 996, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 988, + "src": "3439:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 997, + "name": "start", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 990, + "src": "3447:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 998, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 988, + "src": "3454:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 999, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3461:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "3454:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 995, + "name": "slice", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 1003, + 1045 + ], + "referencedDeclaration": 1045, + "src": "3433:5:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (bytes memory,uint256,uint256) pure returns (bytes memory)" + } + }, + "id": 1000, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3433:35:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "functionReturnParameters": 994, + "id": 1001, + "nodeType": "Return", + "src": "3426:42:8" + } + ] + }, + "documentation": { + "id": 986, + "nodeType": "StructuredDocumentation", + "src": "3011:312:8", + "text": " @dev Copies the content of `buffer`, from `start` (included) to the end of `buffer` into a new bytes object in\n memory.\n NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`]" + }, + "id": 1003, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "slice", + "nameLocation": "3337:5:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 991, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 988, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "3356:6:8", + "nodeType": "VariableDeclaration", + "scope": 1003, + "src": "3343:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 987, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3343:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 990, + "mutability": "mutable", + "name": "start", + "nameLocation": "3372:5:8", + "nodeType": "VariableDeclaration", + "scope": 1003, + "src": "3364:13:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 989, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3364:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3342:36:8" + }, + "returnParameters": { + "id": 994, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 993, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1003, + "src": "3402:12:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 992, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3402:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "3401:14:8" + }, + "scope": 1632, + "src": "3328:147:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1044, + "nodeType": "Block", + "src": "3959:347:8", + "statements": [ + { + "expression": { + "id": 1022, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1015, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1010, + "src": "3989:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 1018, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1010, + "src": "4004:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 1019, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1006, + "src": "4009:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1020, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4016:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "4009:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1016, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "3995:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1017, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4000:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "3995:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1021, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3995:28:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3989:34:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1023, + "nodeType": "ExpressionStatement", + "src": "3989:34:8" + }, + { + "expression": { + "id": 1030, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1024, + "name": "start", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1008, + "src": "4033:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 1027, + "name": "start", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1008, + "src": "4050:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 1028, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1010, + "src": "4057:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1025, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "4041:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1026, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4046:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "4041:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1029, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4041:20:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4033:28:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1031, + "nodeType": "ExpressionStatement", + "src": "4033:28:8" + }, + { + "assignments": [ + 1033 + ], + "declarations": [ + { + "constant": false, + "id": 1033, + "mutability": "mutable", + "name": "result", + "nameLocation": "4114:6:8", + "nodeType": "VariableDeclaration", + "scope": 1044, + "src": "4101:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1032, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4101:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 1040, + "initialValue": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1038, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1036, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1010, + "src": "4133:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "id": 1037, + "name": "start", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1008, + "src": "4139:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4133:11:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1035, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "4123:9:8", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (uint256) pure returns (bytes memory)" + }, + "typeName": { + "id": 1034, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4127:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + } + }, + "id": 1039, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4123:22:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4101:44:8" + }, + { + "AST": { + "nativeSrc": "4180:96:8", + "nodeType": "YulBlock", + "src": "4180:96:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "result", + "nativeSrc": "4204:6:8", + "nodeType": "YulIdentifier", + "src": "4204:6:8" + }, + { + "kind": "number", + "nativeSrc": "4212:4:8", + "nodeType": "YulLiteral", + "src": "4212:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4200:3:8", + "nodeType": "YulIdentifier", + "src": "4200:3:8" + }, + "nativeSrc": "4200:17:8", + "nodeType": "YulFunctionCall", + "src": "4200:17:8" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "4227:6:8", + "nodeType": "YulIdentifier", + "src": "4227:6:8" + }, + { + "kind": "number", + "nativeSrc": "4235:4:8", + "nodeType": "YulLiteral", + "src": "4235:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4223:3:8", + "nodeType": "YulIdentifier", + "src": "4223:3:8" + }, + "nativeSrc": "4223:17:8", + "nodeType": "YulFunctionCall", + "src": "4223:17:8" + }, + { + "name": "start", + "nativeSrc": "4242:5:8", + "nodeType": "YulIdentifier", + "src": "4242:5:8" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4219:3:8", + "nodeType": "YulIdentifier", + "src": "4219:3:8" + }, + "nativeSrc": "4219:29:8", + "nodeType": "YulFunctionCall", + "src": "4219:29:8" + }, + { + "arguments": [ + { + "name": "end", + "nativeSrc": "4254:3:8", + "nodeType": "YulIdentifier", + "src": "4254:3:8" + }, + { + "name": "start", + "nativeSrc": "4259:5:8", + "nodeType": "YulIdentifier", + "src": "4259:5:8" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "4250:3:8", + "nodeType": "YulIdentifier", + "src": "4250:3:8" + }, + "nativeSrc": "4250:15:8", + "nodeType": "YulFunctionCall", + "src": "4250:15:8" + } + ], + "functionName": { + "name": "mcopy", + "nativeSrc": "4194:5:8", + "nodeType": "YulIdentifier", + "src": "4194:5:8" + }, + "nativeSrc": "4194:72:8", + "nodeType": "YulFunctionCall", + "src": "4194:72:8" + }, + "nativeSrc": "4194:72:8", + "nodeType": "YulExpressionStatement", + "src": "4194:72:8" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 1006, + "isOffset": false, + "isSlot": false, + "src": "4227:6:8", + "valueSize": 1 + }, + { + "declaration": 1010, + "isOffset": false, + "isSlot": false, + "src": "4254:3:8", + "valueSize": 1 + }, + { + "declaration": 1033, + "isOffset": false, + "isSlot": false, + "src": "4204:6:8", + "valueSize": 1 + }, + { + "declaration": 1008, + "isOffset": false, + "isSlot": false, + "src": "4242:5:8", + "valueSize": 1 + }, + { + "declaration": 1008, + "isOffset": false, + "isSlot": false, + "src": "4259:5:8", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 1041, + "nodeType": "InlineAssembly", + "src": "4155:121:8" + }, + { + "expression": { + "id": 1042, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1033, + "src": "4293:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "functionReturnParameters": 1014, + "id": 1043, + "nodeType": "Return", + "src": "4286:13:8" + } + ] + }, + "documentation": { + "id": 1004, + "nodeType": "StructuredDocumentation", + "src": "3481:372:8", + "text": " @dev Copies the content of `buffer`, from `start` (included) to `end` (excluded) into a new bytes object in\n memory. The `end` argument is truncated to the length of the `buffer`.\n NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`]" + }, + "id": 1045, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "slice", + "nameLocation": "3867:5:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1011, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1006, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "3886:6:8", + "nodeType": "VariableDeclaration", + "scope": 1045, + "src": "3873:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1005, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3873:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1008, + "mutability": "mutable", + "name": "start", + "nameLocation": "3902:5:8", + "nodeType": "VariableDeclaration", + "scope": 1045, + "src": "3894:13:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1007, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3894:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1010, + "mutability": "mutable", + "name": "end", + "nameLocation": "3917:3:8", + "nodeType": "VariableDeclaration", + "scope": 1045, + "src": "3909:11:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1009, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3909:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3872:49:8" + }, + "returnParameters": { + "id": 1014, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1013, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1045, + "src": "3945:12:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1012, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3945:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "3944:14:8" + }, + "scope": 1632, + "src": "3858:448:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1062, + "nodeType": "Block", + "src": "4790:60:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 1056, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1048, + "src": "4814:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 1057, + "name": "start", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1050, + "src": "4822:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 1058, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1048, + "src": "4829:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1059, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4836:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "4829:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1055, + "name": "splice", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 1063, + 1096 + ], + "referencedDeclaration": 1096, + "src": "4807:6:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (bytes memory,uint256,uint256) pure returns (bytes memory)" + } + }, + "id": 1060, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4807:36:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "functionReturnParameters": 1054, + "id": 1061, + "nodeType": "Return", + "src": "4800:43:8" + } + ] + }, + "documentation": { + "id": 1046, + "nodeType": "StructuredDocumentation", + "src": "4312:384:8", + "text": " @dev Moves the content of `buffer`, from `start` (included) to the end of `buffer` to the start of that buffer,\n and shrinks the buffer length accordingly, effectively overriding the content of buffer with buffer[start:].\n NOTE: This function modifies the provided buffer in place. If you need to preserve the original buffer, use {slice} instead" + }, + "id": 1063, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "splice", + "nameLocation": "4710:6:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1051, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1048, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "4730:6:8", + "nodeType": "VariableDeclaration", + "scope": 1063, + "src": "4717:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1047, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4717:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1050, + "mutability": "mutable", + "name": "start", + "nameLocation": "4746:5:8", + "nodeType": "VariableDeclaration", + "scope": 1063, + "src": "4738:13:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1049, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4738:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4716:36:8" + }, + "returnParameters": { + "id": 1054, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1053, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1063, + "src": "4776:12:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1052, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4776:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "4775:14:8" + }, + "scope": 1632, + "src": "4701:149:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1095, + "nodeType": "Block", + "src": "5417:335:8", + "statements": [ + { + "expression": { + "id": 1082, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1075, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1070, + "src": "5447:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 1078, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1070, + "src": "5462:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 1079, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1066, + "src": "5467:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1080, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5474:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "5467:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1076, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "5453:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1077, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5458:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "5453:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1081, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5453:28:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5447:34:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1083, + "nodeType": "ExpressionStatement", + "src": "5447:34:8" + }, + { + "expression": { + "id": 1090, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1084, + "name": "start", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1068, + "src": "5491:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 1087, + "name": "start", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1068, + "src": "5508:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 1088, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1070, + "src": "5515:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1085, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "5499:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1086, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5504:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "5499:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1089, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5499:20:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5491:28:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1091, + "nodeType": "ExpressionStatement", + "src": "5491:28:8" + }, + { + "AST": { + "nativeSrc": "5582:140:8", + "nodeType": "YulBlock", + "src": "5582:140:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "5606:6:8", + "nodeType": "YulIdentifier", + "src": "5606:6:8" + }, + { + "kind": "number", + "nativeSrc": "5614:4:8", + "nodeType": "YulLiteral", + "src": "5614:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "5602:3:8", + "nodeType": "YulIdentifier", + "src": "5602:3:8" + }, + "nativeSrc": "5602:17:8", + "nodeType": "YulFunctionCall", + "src": "5602:17:8" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "5629:6:8", + "nodeType": "YulIdentifier", + "src": "5629:6:8" + }, + { + "kind": "number", + "nativeSrc": "5637:4:8", + "nodeType": "YulLiteral", + "src": "5637:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "5625:3:8", + "nodeType": "YulIdentifier", + "src": "5625:3:8" + }, + "nativeSrc": "5625:17:8", + "nodeType": "YulFunctionCall", + "src": "5625:17:8" + }, + { + "name": "start", + "nativeSrc": "5644:5:8", + "nodeType": "YulIdentifier", + "src": "5644:5:8" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "5621:3:8", + "nodeType": "YulIdentifier", + "src": "5621:3:8" + }, + "nativeSrc": "5621:29:8", + "nodeType": "YulFunctionCall", + "src": "5621:29:8" + }, + { + "arguments": [ + { + "name": "end", + "nativeSrc": "5656:3:8", + "nodeType": "YulIdentifier", + "src": "5656:3:8" + }, + { + "name": "start", + "nativeSrc": "5661:5:8", + "nodeType": "YulIdentifier", + "src": "5661:5:8" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "5652:3:8", + "nodeType": "YulIdentifier", + "src": "5652:3:8" + }, + "nativeSrc": "5652:15:8", + "nodeType": "YulFunctionCall", + "src": "5652:15:8" + } + ], + "functionName": { + "name": "mcopy", + "nativeSrc": "5596:5:8", + "nodeType": "YulIdentifier", + "src": "5596:5:8" + }, + "nativeSrc": "5596:72:8", + "nodeType": "YulFunctionCall", + "src": "5596:72:8" + }, + "nativeSrc": "5596:72:8", + "nodeType": "YulExpressionStatement", + "src": "5596:72:8" + }, + { + "expression": { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "5688:6:8", + "nodeType": "YulIdentifier", + "src": "5688:6:8" + }, + { + "arguments": [ + { + "name": "end", + "nativeSrc": "5700:3:8", + "nodeType": "YulIdentifier", + "src": "5700:3:8" + }, + { + "name": "start", + "nativeSrc": "5705:5:8", + "nodeType": "YulIdentifier", + "src": "5705:5:8" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "5696:3:8", + "nodeType": "YulIdentifier", + "src": "5696:3:8" + }, + "nativeSrc": "5696:15:8", + "nodeType": "YulFunctionCall", + "src": "5696:15:8" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "5681:6:8", + "nodeType": "YulIdentifier", + "src": "5681:6:8" + }, + "nativeSrc": "5681:31:8", + "nodeType": "YulFunctionCall", + "src": "5681:31:8" + }, + "nativeSrc": "5681:31:8", + "nodeType": "YulExpressionStatement", + "src": "5681:31:8" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 1066, + "isOffset": false, + "isSlot": false, + "src": "5606:6:8", + "valueSize": 1 + }, + { + "declaration": 1066, + "isOffset": false, + "isSlot": false, + "src": "5629:6:8", + "valueSize": 1 + }, + { + "declaration": 1066, + "isOffset": false, + "isSlot": false, + "src": "5688:6:8", + "valueSize": 1 + }, + { + "declaration": 1070, + "isOffset": false, + "isSlot": false, + "src": "5656:3:8", + "valueSize": 1 + }, + { + "declaration": 1070, + "isOffset": false, + "isSlot": false, + "src": "5700:3:8", + "valueSize": 1 + }, + { + "declaration": 1068, + "isOffset": false, + "isSlot": false, + "src": "5644:5:8", + "valueSize": 1 + }, + { + "declaration": 1068, + "isOffset": false, + "isSlot": false, + "src": "5661:5:8", + "valueSize": 1 + }, + { + "declaration": 1068, + "isOffset": false, + "isSlot": false, + "src": "5705:5:8", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 1092, + "nodeType": "InlineAssembly", + "src": "5557:165:8" + }, + { + "expression": { + "id": 1093, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1066, + "src": "5739:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "functionReturnParameters": 1074, + "id": 1094, + "nodeType": "Return", + "src": "5732:13:8" + } + ] + }, + "documentation": { + "id": 1064, + "nodeType": "StructuredDocumentation", + "src": "4856:454:8", + "text": " @dev Moves the content of `buffer`, from `start` (included) to `end` (excluded) to the start of that buffer,\n and shrinks the buffer length accordingly, effectively overriding the content of buffer with buffer[start:end].\n The `end` argument is truncated to the length of the `buffer`.\n NOTE: This function modifies the provided buffer in place. If you need to preserve the original buffer, use {slice} instead" + }, + "id": 1096, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "splice", + "nameLocation": "5324:6:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1071, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1066, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "5344:6:8", + "nodeType": "VariableDeclaration", + "scope": 1096, + "src": "5331:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1065, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5331:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1068, + "mutability": "mutable", + "name": "start", + "nameLocation": "5360:5:8", + "nodeType": "VariableDeclaration", + "scope": 1096, + "src": "5352:13:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1067, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5352:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1070, + "mutability": "mutable", + "name": "end", + "nameLocation": "5375:3:8", + "nodeType": "VariableDeclaration", + "scope": 1096, + "src": "5367:11:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1069, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5367:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5330:49:8" + }, + "returnParameters": { + "id": 1074, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1073, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1096, + "src": "5403:12:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1072, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5403:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "5402:14:8" + }, + "scope": 1632, + "src": "5315:437:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1117, + "nodeType": "Block", + "src": "6249:80:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 1109, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1099, + "src": "6274:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 1110, + "name": "pos", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1101, + "src": "6282:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 1111, + "name": "replacement", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1103, + "src": "6287:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "hexValue": "30", + "id": 1112, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6300:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "expression": { + "id": 1113, + "name": "replacement", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1103, + "src": "6303:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1114, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6315:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "6303:18:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1108, + "name": "replace", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 1118, + 1174 + ], + "referencedDeclaration": 1174, + "src": "6266:7:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (bytes memory,uint256,bytes memory,uint256,uint256) pure returns (bytes memory)" + } + }, + "id": 1115, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6266:56:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "functionReturnParameters": 1107, + "id": 1116, + "nodeType": "Return", + "src": "6259:63:8" + } + ] + }, + "documentation": { + "id": 1097, + "nodeType": "StructuredDocumentation", + "src": "5758:372:8", + "text": " @dev Replaces bytes in `buffer` starting at `pos` with all bytes from `replacement`.\n Parameters are clamped to valid ranges (i.e. `pos` is clamped to `[0, buffer.length]`).\n If `pos >= buffer.length`, no replacement occurs and the buffer is returned unchanged.\n NOTE: This function modifies the provided buffer in place." + }, + "id": 1118, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "replace", + "nameLocation": "6144:7:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1104, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1099, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "6165:6:8", + "nodeType": "VariableDeclaration", + "scope": 1118, + "src": "6152:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1098, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "6152:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1101, + "mutability": "mutable", + "name": "pos", + "nameLocation": "6181:3:8", + "nodeType": "VariableDeclaration", + "scope": 1118, + "src": "6173:11:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1100, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6173:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1103, + "mutability": "mutable", + "name": "replacement", + "nameLocation": "6199:11:8", + "nodeType": "VariableDeclaration", + "scope": 1118, + "src": "6186:24:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1102, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "6186:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "6151:60:8" + }, + "returnParameters": { + "id": 1107, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1106, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1118, + "src": "6235:12:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1105, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "6235:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "6234:14:8" + }, + "scope": 1632, + "src": "6135:194:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1173, + "nodeType": "Block", + "src": "7180:402:8", + "statements": [ + { + "expression": { + "id": 1141, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1134, + "name": "pos", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1123, + "src": "7210:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 1137, + "name": "pos", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1123, + "src": "7225:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 1138, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1121, + "src": "7230:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1139, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7237:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "7230:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1135, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "7216:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1136, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7221:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "7216:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1140, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7216:28:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7210:34:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1142, + "nodeType": "ExpressionStatement", + "src": "7210:34:8" + }, + { + "expression": { + "id": 1150, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1143, + "name": "offset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1127, + "src": "7254:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 1146, + "name": "offset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1127, + "src": "7272:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 1147, + "name": "replacement", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1125, + "src": "7280:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1148, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7292:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "7280:18:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1144, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "7263:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1145, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7268:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "7263:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1149, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7263:36:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7254:45:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1151, + "nodeType": "ExpressionStatement", + "src": "7254:45:8" + }, + { + "expression": { + "id": 1168, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1152, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1129, + "src": "7309:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 1155, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1129, + "src": "7327:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1161, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 1158, + "name": "replacement", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1125, + "src": "7344:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1159, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7356:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "7344:18:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "id": 1160, + "name": "offset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1127, + "src": "7365:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7344:27:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1165, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 1162, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1121, + "src": "7373:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1163, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7380:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "7373:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "id": 1164, + "name": "pos", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1123, + "src": "7389:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7373:19:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1156, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "7335:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1157, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7340:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "7335:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1166, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7335:58:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1153, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "7318:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1154, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7323:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "7318:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1167, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7318:76:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7309:85:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1169, + "nodeType": "ExpressionStatement", + "src": "7309:85:8" + }, + { + "AST": { + "nativeSrc": "7449:103:8", + "nodeType": "YulBlock", + "src": "7449:103:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "7477:6:8", + "nodeType": "YulIdentifier", + "src": "7477:6:8" + }, + { + "kind": "number", + "nativeSrc": "7485:4:8", + "nodeType": "YulLiteral", + "src": "7485:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7473:3:8", + "nodeType": "YulIdentifier", + "src": "7473:3:8" + }, + "nativeSrc": "7473:17:8", + "nodeType": "YulFunctionCall", + "src": "7473:17:8" + }, + { + "name": "pos", + "nativeSrc": "7492:3:8", + "nodeType": "YulIdentifier", + "src": "7492:3:8" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7469:3:8", + "nodeType": "YulIdentifier", + "src": "7469:3:8" + }, + "nativeSrc": "7469:27:8", + "nodeType": "YulFunctionCall", + "src": "7469:27:8" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "replacement", + "nativeSrc": "7506:11:8", + "nodeType": "YulIdentifier", + "src": "7506:11:8" + }, + { + "kind": "number", + "nativeSrc": "7519:4:8", + "nodeType": "YulLiteral", + "src": "7519:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7502:3:8", + "nodeType": "YulIdentifier", + "src": "7502:3:8" + }, + "nativeSrc": "7502:22:8", + "nodeType": "YulFunctionCall", + "src": "7502:22:8" + }, + { + "name": "offset", + "nativeSrc": "7526:6:8", + "nodeType": "YulIdentifier", + "src": "7526:6:8" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7498:3:8", + "nodeType": "YulIdentifier", + "src": "7498:3:8" + }, + "nativeSrc": "7498:35:8", + "nodeType": "YulFunctionCall", + "src": "7498:35:8" + }, + { + "name": "length", + "nativeSrc": "7535:6:8", + "nodeType": "YulIdentifier", + "src": "7535:6:8" + } + ], + "functionName": { + "name": "mcopy", + "nativeSrc": "7463:5:8", + "nodeType": "YulIdentifier", + "src": "7463:5:8" + }, + "nativeSrc": "7463:79:8", + "nodeType": "YulFunctionCall", + "src": "7463:79:8" + }, + "nativeSrc": "7463:79:8", + "nodeType": "YulExpressionStatement", + "src": "7463:79:8" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 1121, + "isOffset": false, + "isSlot": false, + "src": "7477:6:8", + "valueSize": 1 + }, + { + "declaration": 1129, + "isOffset": false, + "isSlot": false, + "src": "7535:6:8", + "valueSize": 1 + }, + { + "declaration": 1127, + "isOffset": false, + "isSlot": false, + "src": "7526:6:8", + "valueSize": 1 + }, + { + "declaration": 1123, + "isOffset": false, + "isSlot": false, + "src": "7492:3:8", + "valueSize": 1 + }, + { + "declaration": 1125, + "isOffset": false, + "isSlot": false, + "src": "7506:11:8", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 1170, + "nodeType": "InlineAssembly", + "src": "7424:128:8" + }, + { + "expression": { + "id": 1171, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1121, + "src": "7569:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "functionReturnParameters": 1133, + "id": 1172, + "nodeType": "Return", + "src": "7562:13:8" + } + ] + }, + "documentation": { + "id": 1119, + "nodeType": "StructuredDocumentation", + "src": "6335:648:8", + "text": " @dev Replaces bytes in `buffer` starting at `pos` with bytes from `replacement` starting at `offset`.\n Copies at most `length` bytes from `replacement` to `buffer`.\n Parameters are clamped to valid ranges (i.e. `pos` is clamped to `[0, buffer.length]`, `offset` is\n clamped to `[0, replacement.length]`, and `length` is clamped to `min(length, replacement.length - offset,\n buffer.length - pos))`. If `pos >= buffer.length` or `offset >= replacement.length`, no replacement occurs\n and the buffer is returned unchanged.\n NOTE: This function modifies the provided buffer in place." + }, + "id": 1174, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "replace", + "nameLocation": "6997:7:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1130, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1121, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "7027:6:8", + "nodeType": "VariableDeclaration", + "scope": 1174, + "src": "7014:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1120, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "7014:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1123, + "mutability": "mutable", + "name": "pos", + "nameLocation": "7051:3:8", + "nodeType": "VariableDeclaration", + "scope": 1174, + "src": "7043:11:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1122, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7043:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1125, + "mutability": "mutable", + "name": "replacement", + "nameLocation": "7077:11:8", + "nodeType": "VariableDeclaration", + "scope": 1174, + "src": "7064:24:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1124, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "7064:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1127, + "mutability": "mutable", + "name": "offset", + "nameLocation": "7106:6:8", + "nodeType": "VariableDeclaration", + "scope": 1174, + "src": "7098:14:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1126, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7098:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1129, + "mutability": "mutable", + "name": "length", + "nameLocation": "7130:6:8", + "nodeType": "VariableDeclaration", + "scope": 1174, + "src": "7122:14:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1128, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7122:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7004:138:8" + }, + "returnParameters": { + "id": 1133, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1132, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1174, + "src": "7166:12:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1131, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "7166:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "7165:14:8" + }, + "scope": 1632, + "src": "6988:594:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1246, + "nodeType": "Block", + "src": "8119:563:8", + "statements": [ + { + "assignments": [ + 1184 + ], + "declarations": [ + { + "constant": false, + "id": 1184, + "mutability": "mutable", + "name": "length", + "nameLocation": "8137:6:8", + "nodeType": "VariableDeclaration", + "scope": 1246, + "src": "8129:14:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1183, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8129:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 1186, + "initialValue": { + "hexValue": "30", + "id": 1185, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8146:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "8129:18:8" + }, + { + "body": { + "id": 1205, + "nodeType": "Block", + "src": "8202:52:8", + "statements": [ + { + "expression": { + "id": 1203, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1198, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1184, + "src": "8216:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "expression": { + "baseExpression": { + "id": 1199, + "name": "buffers", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1178, + "src": "8226:7:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_memory_ptr_$dyn_memory_ptr", + "typeString": "bytes memory[] memory" + } + }, + "id": 1201, + "indexExpression": { + "id": 1200, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1188, + "src": "8234:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8226:10:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1202, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "8237:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "8226:17:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8216:27:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1204, + "nodeType": "ExpressionStatement", + "src": "8216:27:8" + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1194, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1191, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1188, + "src": "8177:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "expression": { + "id": 1192, + "name": "buffers", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1178, + "src": "8181:7:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_memory_ptr_$dyn_memory_ptr", + "typeString": "bytes memory[] memory" + } + }, + "id": 1193, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "8189:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "8181:14:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8177:18:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 1206, + "initializationExpression": { + "assignments": [ + 1188 + ], + "declarations": [ + { + "constant": false, + "id": 1188, + "mutability": "mutable", + "name": "i", + "nameLocation": "8170:1:8", + "nodeType": "VariableDeclaration", + "scope": 1206, + "src": "8162:9:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1187, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8162:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 1190, + "initialValue": { + "hexValue": "30", + "id": 1189, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8174:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "8162:13:8" + }, + "isSimpleCounterLoop": true, + "loopExpression": { + "expression": { + "id": 1196, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": true, + "src": "8197:3:8", + "subExpression": { + "id": 1195, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1188, + "src": "8199:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1197, + "nodeType": "ExpressionStatement", + "src": "8197:3:8" + }, + "nodeType": "ForStatement", + "src": "8157:97:8" + }, + { + "assignments": [ + 1208 + ], + "declarations": [ + { + "constant": false, + "id": 1208, + "mutability": "mutable", + "name": "result", + "nameLocation": "8277:6:8", + "nodeType": "VariableDeclaration", + "scope": 1246, + "src": "8264:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1207, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "8264:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 1213, + "initialValue": { + "arguments": [ + { + "id": 1211, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1184, + "src": "8296:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1210, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "8286:9:8", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (uint256) pure returns (bytes memory)" + }, + "typeName": { + "id": 1209, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "8290:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + } + }, + "id": 1212, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8286:17:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8264:39:8" + }, + { + "assignments": [ + 1215 + ], + "declarations": [ + { + "constant": false, + "id": 1215, + "mutability": "mutable", + "name": "offset", + "nameLocation": "8322:6:8", + "nodeType": "VariableDeclaration", + "scope": 1246, + "src": "8314:14:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1214, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8314:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 1217, + "initialValue": { + "hexValue": "30783230", + "id": 1216, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8331:4:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "0x20" + }, + "nodeType": "VariableDeclarationStatement", + "src": "8314:21:8" + }, + { + "body": { + "id": 1242, + "nodeType": "Block", + "src": "8390:262:8", + "statements": [ + { + "assignments": [ + 1230 + ], + "declarations": [ + { + "constant": false, + "id": 1230, + "mutability": "mutable", + "name": "input", + "nameLocation": "8417:5:8", + "nodeType": "VariableDeclaration", + "scope": 1242, + "src": "8404:18:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1229, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "8404:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 1234, + "initialValue": { + "baseExpression": { + "id": 1231, + "name": "buffers", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1178, + "src": "8425:7:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_memory_ptr_$dyn_memory_ptr", + "typeString": "bytes memory[] memory" + } + }, + "id": 1233, + "indexExpression": { + "id": 1232, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1219, + "src": "8433:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8425:10:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8404:31:8" + }, + { + "AST": { + "nativeSrc": "8474:90:8", + "nodeType": "YulBlock", + "src": "8474:90:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "result", + "nativeSrc": "8502:6:8", + "nodeType": "YulIdentifier", + "src": "8502:6:8" + }, + { + "name": "offset", + "nativeSrc": "8510:6:8", + "nodeType": "YulIdentifier", + "src": "8510:6:8" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8498:3:8", + "nodeType": "YulIdentifier", + "src": "8498:3:8" + }, + "nativeSrc": "8498:19:8", + "nodeType": "YulFunctionCall", + "src": "8498:19:8" + }, + { + "arguments": [ + { + "name": "input", + "nativeSrc": "8523:5:8", + "nodeType": "YulIdentifier", + "src": "8523:5:8" + }, + { + "kind": "number", + "nativeSrc": "8530:4:8", + "nodeType": "YulLiteral", + "src": "8530:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8519:3:8", + "nodeType": "YulIdentifier", + "src": "8519:3:8" + }, + "nativeSrc": "8519:16:8", + "nodeType": "YulFunctionCall", + "src": "8519:16:8" + }, + { + "arguments": [ + { + "name": "input", + "nativeSrc": "8543:5:8", + "nodeType": "YulIdentifier", + "src": "8543:5:8" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "8537:5:8", + "nodeType": "YulIdentifier", + "src": "8537:5:8" + }, + "nativeSrc": "8537:12:8", + "nodeType": "YulFunctionCall", + "src": "8537:12:8" + } + ], + "functionName": { + "name": "mcopy", + "nativeSrc": "8492:5:8", + "nodeType": "YulIdentifier", + "src": "8492:5:8" + }, + "nativeSrc": "8492:58:8", + "nodeType": "YulFunctionCall", + "src": "8492:58:8" + }, + "nativeSrc": "8492:58:8", + "nodeType": "YulExpressionStatement", + "src": "8492:58:8" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 1230, + "isOffset": false, + "isSlot": false, + "src": "8523:5:8", + "valueSize": 1 + }, + { + "declaration": 1230, + "isOffset": false, + "isSlot": false, + "src": "8543:5:8", + "valueSize": 1 + }, + { + "declaration": 1215, + "isOffset": false, + "isSlot": false, + "src": "8510:6:8", + "valueSize": 1 + }, + { + "declaration": 1208, + "isOffset": false, + "isSlot": false, + "src": "8502:6:8", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 1235, + "nodeType": "InlineAssembly", + "src": "8449:115:8" + }, + { + "id": 1241, + "nodeType": "UncheckedBlock", + "src": "8577:65:8", + "statements": [ + { + "expression": { + "id": 1239, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1236, + "name": "offset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1215, + "src": "8605:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "expression": { + "id": 1237, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1230, + "src": "8615:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1238, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "8621:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "8615:12:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8605:22:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1240, + "nodeType": "ExpressionStatement", + "src": "8605:22:8" + } + ] + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1225, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1222, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1219, + "src": "8365:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "expression": { + "id": 1223, + "name": "buffers", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1178, + "src": "8369:7:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_memory_ptr_$dyn_memory_ptr", + "typeString": "bytes memory[] memory" + } + }, + "id": 1224, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "8377:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "8369:14:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8365:18:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 1243, + "initializationExpression": { + "assignments": [ + 1219 + ], + "declarations": [ + { + "constant": false, + "id": 1219, + "mutability": "mutable", + "name": "i", + "nameLocation": "8358:1:8", + "nodeType": "VariableDeclaration", + "scope": 1243, + "src": "8350:9:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1218, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8350:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 1221, + "initialValue": { + "hexValue": "30", + "id": 1220, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8362:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "8350:13:8" + }, + "isSimpleCounterLoop": true, + "loopExpression": { + "expression": { + "id": 1227, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": true, + "src": "8385:3:8", + "subExpression": { + "id": 1226, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1219, + "src": "8387:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1228, + "nodeType": "ExpressionStatement", + "src": "8385:3:8" + }, + "nodeType": "ForStatement", + "src": "8345:307:8" + }, + { + "expression": { + "id": 1244, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1208, + "src": "8669:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "functionReturnParameters": 1182, + "id": 1245, + "nodeType": "Return", + "src": "8662:13:8" + } + ] + }, + "documentation": { + "id": 1175, + "nodeType": "StructuredDocumentation", + "src": "7588:449:8", + "text": " @dev Concatenate an array of bytes into a single bytes object.\n For fixed bytes types, we recommend using the solidity built-in `bytes.concat` or (equivalent)\n `abi.encodePacked`.\n NOTE: this could be done in assembly with a single loop that expands starting at the FMP, but that would be\n significantly less readable. It might be worth benchmarking the savings of the full-assembly approach." + }, + "id": 1247, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "concat", + "nameLocation": "8051:6:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1179, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1178, + "mutability": "mutable", + "name": "buffers", + "nameLocation": "8073:7:8", + "nodeType": "VariableDeclaration", + "scope": 1247, + "src": "8058:22:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_memory_ptr_$dyn_memory_ptr", + "typeString": "bytes[]" + }, + "typeName": { + "baseType": { + "id": 1176, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "8058:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "id": 1177, + "nodeType": "ArrayTypeName", + "src": "8058:7:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_storage_$dyn_storage_ptr", + "typeString": "bytes[]" + } + }, + "visibility": "internal" + } + ], + "src": "8057:24:8" + }, + "returnParameters": { + "id": 1182, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1181, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1247, + "src": "8105:12:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1180, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "8105:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "8104:14:8" + }, + "scope": 1632, + "src": "8042:640:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1256, + "nodeType": "Block", + "src": "8920:1416:8", + "statements": [ + { + "AST": { + "nativeSrc": "8955:1375:8", + "nodeType": "YulBlock", + "src": "8955:1375:8", + "statements": [ + { + "nativeSrc": "8969:26:8", + "nodeType": "YulVariableDeclaration", + "src": "8969:26:8", + "value": { + "arguments": [ + { + "name": "input", + "nativeSrc": "8989:5:8", + "nodeType": "YulIdentifier", + "src": "8989:5:8" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "8983:5:8", + "nodeType": "YulIdentifier", + "src": "8983:5:8" + }, + "nativeSrc": "8983:12:8", + "nodeType": "YulFunctionCall", + "src": "8983:12:8" + }, + "variables": [ + { + "name": "length", + "nativeSrc": "8973:6:8", + "nodeType": "YulTypedName", + "src": "8973:6:8", + "type": "" + } + ] + }, + { + "nativeSrc": "9008:21:8", + "nodeType": "YulAssignment", + "src": "9008:21:8", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9024:4:8", + "nodeType": "YulLiteral", + "src": "9024:4:8", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "9018:5:8", + "nodeType": "YulIdentifier", + "src": "9018:5:8" + }, + "nativeSrc": "9018:11:8", + "nodeType": "YulFunctionCall", + "src": "9018:11:8" + }, + "variableNames": [ + { + "name": "output", + "nativeSrc": "9008:6:8", + "nodeType": "YulIdentifier", + "src": "9008:6:8" + } + ] + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9049:4:8", + "nodeType": "YulLiteral", + "src": "9049:4:8", + "type": "", + "value": "0x40" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "output", + "nativeSrc": "9063:6:8", + "nodeType": "YulIdentifier", + "src": "9063:6:8" + }, + { + "kind": "number", + "nativeSrc": "9071:4:8", + "nodeType": "YulLiteral", + "src": "9071:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9059:3:8", + "nodeType": "YulIdentifier", + "src": "9059:3:8" + }, + "nativeSrc": "9059:17:8", + "nodeType": "YulFunctionCall", + "src": "9059:17:8" + }, + { + "arguments": [ + { + "name": "length", + "nativeSrc": "9082:6:8", + "nodeType": "YulIdentifier", + "src": "9082:6:8" + }, + { + "kind": "number", + "nativeSrc": "9090:1:8", + "nodeType": "YulLiteral", + "src": "9090:1:8", + "type": "", + "value": "2" + } + ], + "functionName": { + "name": "mul", + "nativeSrc": "9078:3:8", + "nodeType": "YulIdentifier", + "src": "9078:3:8" + }, + "nativeSrc": "9078:14:8", + "nodeType": "YulFunctionCall", + "src": "9078:14:8" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9055:3:8", + "nodeType": "YulIdentifier", + "src": "9055:3:8" + }, + "nativeSrc": "9055:38:8", + "nodeType": "YulFunctionCall", + "src": "9055:38:8" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "9042:6:8", + "nodeType": "YulIdentifier", + "src": "9042:6:8" + }, + "nativeSrc": "9042:52:8", + "nodeType": "YulFunctionCall", + "src": "9042:52:8" + }, + "nativeSrc": "9042:52:8", + "nodeType": "YulExpressionStatement", + "src": "9042:52:8" + }, + { + "expression": { + "arguments": [ + { + "name": "output", + "nativeSrc": "9114:6:8", + "nodeType": "YulIdentifier", + "src": "9114:6:8" + }, + { + "arguments": [ + { + "name": "length", + "nativeSrc": "9126:6:8", + "nodeType": "YulIdentifier", + "src": "9126:6:8" + }, + { + "kind": "number", + "nativeSrc": "9134:1:8", + "nodeType": "YulLiteral", + "src": "9134:1:8", + "type": "", + "value": "2" + } + ], + "functionName": { + "name": "mul", + "nativeSrc": "9122:3:8", + "nodeType": "YulIdentifier", + "src": "9122:3:8" + }, + "nativeSrc": "9122:14:8", + "nodeType": "YulFunctionCall", + "src": "9122:14:8" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "9107:6:8", + "nodeType": "YulIdentifier", + "src": "9107:6:8" + }, + "nativeSrc": "9107:30:8", + "nodeType": "YulFunctionCall", + "src": "9107:30:8" + }, + "nativeSrc": "9107:30:8", + "nodeType": "YulExpressionStatement", + "src": "9107:30:8" + }, + { + "body": { + "nativeSrc": "9261:1059:8", + "nodeType": "YulBlock", + "src": "9261:1059:8", + "statements": [ + { + "nativeSrc": "9279:54:8", + "nodeType": "YulVariableDeclaration", + "src": "9279:54:8", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9296:3:8", + "nodeType": "YulLiteral", + "src": "9296:3:8", + "type": "", + "value": "128" + }, + { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "input", + "nativeSrc": "9315:5:8", + "nodeType": "YulIdentifier", + "src": "9315:5:8" + }, + { + "kind": "number", + "nativeSrc": "9322:4:8", + "nodeType": "YulLiteral", + "src": "9322:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9311:3:8", + "nodeType": "YulIdentifier", + "src": "9311:3:8" + }, + "nativeSrc": "9311:16:8", + "nodeType": "YulFunctionCall", + "src": "9311:16:8" + }, + { + "name": "i", + "nativeSrc": "9329:1:8", + "nodeType": "YulIdentifier", + "src": "9329:1:8" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9307:3:8", + "nodeType": "YulIdentifier", + "src": "9307:3:8" + }, + "nativeSrc": "9307:24:8", + "nodeType": "YulFunctionCall", + "src": "9307:24:8" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "9301:5:8", + "nodeType": "YulIdentifier", + "src": "9301:5:8" + }, + "nativeSrc": "9301:31:8", + "nodeType": "YulFunctionCall", + "src": "9301:31:8" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "9292:3:8", + "nodeType": "YulIdentifier", + "src": "9292:3:8" + }, + "nativeSrc": "9292:41:8", + "nodeType": "YulFunctionCall", + "src": "9292:41:8" + }, + "variables": [ + { + "name": "chunk", + "nativeSrc": "9283:5:8", + "nodeType": "YulTypedName", + "src": "9283:5:8", + "type": "" + } + ] + }, + { + "nativeSrc": "9350:165:8", + "nodeType": "YulAssignment", + "src": "9350:165:8", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9384:66:8", + "nodeType": "YulLiteral", + "src": "9384:66:8", + "type": "", + "value": "0x0000000000000000ffffffffffffffff0000000000000000ffffffffffffffff" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9479:2:8", + "nodeType": "YulLiteral", + "src": "9479:2:8", + "type": "", + "value": "64" + }, + { + "name": "chunk", + "nativeSrc": "9483:5:8", + "nodeType": "YulIdentifier", + "src": "9483:5:8" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "9475:3:8", + "nodeType": "YulIdentifier", + "src": "9475:3:8" + }, + "nativeSrc": "9475:14:8", + "nodeType": "YulFunctionCall", + "src": "9475:14:8" + }, + { + "name": "chunk", + "nativeSrc": "9491:5:8", + "nodeType": "YulIdentifier", + "src": "9491:5:8" + } + ], + "functionName": { + "name": "or", + "nativeSrc": "9472:2:8", + "nodeType": "YulIdentifier", + "src": "9472:2:8" + }, + "nativeSrc": "9472:25:8", + "nodeType": "YulFunctionCall", + "src": "9472:25:8" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "9359:3:8", + "nodeType": "YulIdentifier", + "src": "9359:3:8" + }, + "nativeSrc": "9359:156:8", + "nodeType": "YulFunctionCall", + "src": "9359:156:8" + }, + "variableNames": [ + { + "name": "chunk", + "nativeSrc": "9350:5:8", + "nodeType": "YulIdentifier", + "src": "9350:5:8" + } + ] + }, + { + "nativeSrc": "9532:165:8", + "nodeType": "YulAssignment", + "src": "9532:165:8", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9566:66:8", + "nodeType": "YulLiteral", + "src": "9566:66:8", + "type": "", + "value": "0x00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9661:2:8", + "nodeType": "YulLiteral", + "src": "9661:2:8", + "type": "", + "value": "32" + }, + { + "name": "chunk", + "nativeSrc": "9665:5:8", + "nodeType": "YulIdentifier", + "src": "9665:5:8" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "9657:3:8", + "nodeType": "YulIdentifier", + "src": "9657:3:8" + }, + "nativeSrc": "9657:14:8", + "nodeType": "YulFunctionCall", + "src": "9657:14:8" + }, + { + "name": "chunk", + "nativeSrc": "9673:5:8", + "nodeType": "YulIdentifier", + "src": "9673:5:8" + } + ], + "functionName": { + "name": "or", + "nativeSrc": "9654:2:8", + "nodeType": "YulIdentifier", + "src": "9654:2:8" + }, + "nativeSrc": "9654:25:8", + "nodeType": "YulFunctionCall", + "src": "9654:25:8" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "9541:3:8", + "nodeType": "YulIdentifier", + "src": "9541:3:8" + }, + "nativeSrc": "9541:156:8", + "nodeType": "YulFunctionCall", + "src": "9541:156:8" + }, + "variableNames": [ + { + "name": "chunk", + "nativeSrc": "9532:5:8", + "nodeType": "YulIdentifier", + "src": "9532:5:8" + } + ] + }, + { + "nativeSrc": "9714:165:8", + "nodeType": "YulAssignment", + "src": "9714:165:8", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9748:66:8", + "nodeType": "YulLiteral", + "src": "9748:66:8", + "type": "", + "value": "0x0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9843:2:8", + "nodeType": "YulLiteral", + "src": "9843:2:8", + "type": "", + "value": "16" + }, + { + "name": "chunk", + "nativeSrc": "9847:5:8", + "nodeType": "YulIdentifier", + "src": "9847:5:8" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "9839:3:8", + "nodeType": "YulIdentifier", + "src": "9839:3:8" + }, + "nativeSrc": "9839:14:8", + "nodeType": "YulFunctionCall", + "src": "9839:14:8" + }, + { + "name": "chunk", + "nativeSrc": "9855:5:8", + "nodeType": "YulIdentifier", + "src": "9855:5:8" + } + ], + "functionName": { + "name": "or", + "nativeSrc": "9836:2:8", + "nodeType": "YulIdentifier", + "src": "9836:2:8" + }, + "nativeSrc": "9836:25:8", + "nodeType": "YulFunctionCall", + "src": "9836:25:8" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "9723:3:8", + "nodeType": "YulIdentifier", + "src": "9723:3:8" + }, + "nativeSrc": "9723:156:8", + "nodeType": "YulFunctionCall", + "src": "9723:156:8" + }, + "variableNames": [ + { + "name": "chunk", + "nativeSrc": "9714:5:8", + "nodeType": "YulIdentifier", + "src": "9714:5:8" + } + ] + }, + { + "nativeSrc": "9896:164:8", + "nodeType": "YulAssignment", + "src": "9896:164:8", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9930:66:8", + "nodeType": "YulLiteral", + "src": "9930:66:8", + "type": "", + "value": "0x00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10025:1:8", + "nodeType": "YulLiteral", + "src": "10025:1:8", + "type": "", + "value": "8" + }, + { + "name": "chunk", + "nativeSrc": "10028:5:8", + "nodeType": "YulIdentifier", + "src": "10028:5:8" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "10021:3:8", + "nodeType": "YulIdentifier", + "src": "10021:3:8" + }, + "nativeSrc": "10021:13:8", + "nodeType": "YulFunctionCall", + "src": "10021:13:8" + }, + { + "name": "chunk", + "nativeSrc": "10036:5:8", + "nodeType": "YulIdentifier", + "src": "10036:5:8" + } + ], + "functionName": { + "name": "or", + "nativeSrc": "10018:2:8", + "nodeType": "YulIdentifier", + "src": "10018:2:8" + }, + "nativeSrc": "10018:24:8", + "nodeType": "YulFunctionCall", + "src": "10018:24:8" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "9905:3:8", + "nodeType": "YulIdentifier", + "src": "9905:3:8" + }, + "nativeSrc": "9905:155:8", + "nodeType": "YulFunctionCall", + "src": "9905:155:8" + }, + "variableNames": [ + { + "name": "chunk", + "nativeSrc": "9896:5:8", + "nodeType": "YulIdentifier", + "src": "9896:5:8" + } + ] + }, + { + "nativeSrc": "10077:164:8", + "nodeType": "YulAssignment", + "src": "10077:164:8", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10111:66:8", + "nodeType": "YulLiteral", + "src": "10111:66:8", + "type": "", + "value": "0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10206:1:8", + "nodeType": "YulLiteral", + "src": "10206:1:8", + "type": "", + "value": "4" + }, + { + "name": "chunk", + "nativeSrc": "10209:5:8", + "nodeType": "YulIdentifier", + "src": "10209:5:8" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "10202:3:8", + "nodeType": "YulIdentifier", + "src": "10202:3:8" + }, + "nativeSrc": "10202:13:8", + "nodeType": "YulFunctionCall", + "src": "10202:13:8" + }, + { + "name": "chunk", + "nativeSrc": "10217:5:8", + "nodeType": "YulIdentifier", + "src": "10217:5:8" + } + ], + "functionName": { + "name": "or", + "nativeSrc": "10199:2:8", + "nodeType": "YulIdentifier", + "src": "10199:2:8" + }, + "nativeSrc": "10199:24:8", + "nodeType": "YulFunctionCall", + "src": "10199:24:8" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "10086:3:8", + "nodeType": "YulIdentifier", + "src": "10086:3:8" + }, + "nativeSrc": "10086:155:8", + "nodeType": "YulFunctionCall", + "src": "10086:155:8" + }, + "variableNames": [ + { + "name": "chunk", + "nativeSrc": "10077:5:8", + "nodeType": "YulIdentifier", + "src": "10077:5:8" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "output", + "nativeSrc": "10273:6:8", + "nodeType": "YulIdentifier", + "src": "10273:6:8" + }, + { + "kind": "number", + "nativeSrc": "10281:4:8", + "nodeType": "YulLiteral", + "src": "10281:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10269:3:8", + "nodeType": "YulIdentifier", + "src": "10269:3:8" + }, + "nativeSrc": "10269:17:8", + "nodeType": "YulFunctionCall", + "src": "10269:17:8" + }, + { + "arguments": [ + { + "name": "i", + "nativeSrc": "10292:1:8", + "nodeType": "YulIdentifier", + "src": "10292:1:8" + }, + { + "kind": "number", + "nativeSrc": "10295:1:8", + "nodeType": "YulLiteral", + "src": "10295:1:8", + "type": "", + "value": "2" + } + ], + "functionName": { + "name": "mul", + "nativeSrc": "10288:3:8", + "nodeType": "YulIdentifier", + "src": "10288:3:8" + }, + "nativeSrc": "10288:9:8", + "nodeType": "YulFunctionCall", + "src": "10288:9:8" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10265:3:8", + "nodeType": "YulIdentifier", + "src": "10265:3:8" + }, + "nativeSrc": "10265:33:8", + "nodeType": "YulFunctionCall", + "src": "10265:33:8" + }, + { + "name": "chunk", + "nativeSrc": "10300:5:8", + "nodeType": "YulIdentifier", + "src": "10300:5:8" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10258:6:8", + "nodeType": "YulIdentifier", + "src": "10258:6:8" + }, + "nativeSrc": "10258:48:8", + "nodeType": "YulFunctionCall", + "src": "10258:48:8" + }, + "nativeSrc": "10258:48:8", + "nodeType": "YulExpressionStatement", + "src": "10258:48:8" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "i", + "nativeSrc": "9200:1:8", + "nodeType": "YulIdentifier", + "src": "9200:1:8" + }, + { + "name": "length", + "nativeSrc": "9203:6:8", + "nodeType": "YulIdentifier", + "src": "9203:6:8" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "9197:2:8", + "nodeType": "YulIdentifier", + "src": "9197:2:8" + }, + "nativeSrc": "9197:13:8", + "nodeType": "YulFunctionCall", + "src": "9197:13:8" + }, + "nativeSrc": "9150:1170:8", + "nodeType": "YulForLoop", + "post": { + "nativeSrc": "9211:49:8", + "nodeType": "YulBlock", + "src": "9211:49:8", + "statements": [ + { + "nativeSrc": "9229:17:8", + "nodeType": "YulAssignment", + "src": "9229:17:8", + "value": { + "arguments": [ + { + "name": "i", + "nativeSrc": "9238:1:8", + "nodeType": "YulIdentifier", + "src": "9238:1:8" + }, + { + "kind": "number", + "nativeSrc": "9241:4:8", + "nodeType": "YulLiteral", + "src": "9241:4:8", + "type": "", + "value": "0x10" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9234:3:8", + "nodeType": "YulIdentifier", + "src": "9234:3:8" + }, + "nativeSrc": "9234:12:8", + "nodeType": "YulFunctionCall", + "src": "9234:12:8" + }, + "variableNames": [ + { + "name": "i", + "nativeSrc": "9229:1:8", + "nodeType": "YulIdentifier", + "src": "9229:1:8" + } + ] + } + ] + }, + "pre": { + "nativeSrc": "9154:42:8", + "nodeType": "YulBlock", + "src": "9154:42:8", + "statements": [ + { + "nativeSrc": "9172:10:8", + "nodeType": "YulVariableDeclaration", + "src": "9172:10:8", + "value": { + "kind": "number", + "nativeSrc": "9181:1:8", + "nodeType": "YulLiteral", + "src": "9181:1:8", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "i", + "nativeSrc": "9176:1:8", + "nodeType": "YulTypedName", + "src": "9176:1:8", + "type": "" + } + ] + } + ] + }, + "src": "9150:1170:8" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 1250, + "isOffset": false, + "isSlot": false, + "src": "8989:5:8", + "valueSize": 1 + }, + { + "declaration": 1250, + "isOffset": false, + "isSlot": false, + "src": "9315:5:8", + "valueSize": 1 + }, + { + "declaration": 1253, + "isOffset": false, + "isSlot": false, + "src": "10273:6:8", + "valueSize": 1 + }, + { + "declaration": 1253, + "isOffset": false, + "isSlot": false, + "src": "9008:6:8", + "valueSize": 1 + }, + { + "declaration": 1253, + "isOffset": false, + "isSlot": false, + "src": "9063:6:8", + "valueSize": 1 + }, + { + "declaration": 1253, + "isOffset": false, + "isSlot": false, + "src": "9114:6:8", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 1255, + "nodeType": "InlineAssembly", + "src": "8930:1400:8" + } + ] + }, + "documentation": { + "id": 1248, + "nodeType": "StructuredDocumentation", + "src": "8688:144:8", + "text": " @dev Split each byte in `input` into two nibbles (4 bits each)\n Example: hex\"01234567\" → hex\"0001020304050607\"" + }, + "id": 1257, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toNibbles", + "nameLocation": "8846:9:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1251, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1250, + "mutability": "mutable", + "name": "input", + "nameLocation": "8869:5:8", + "nodeType": "VariableDeclaration", + "scope": 1257, + "src": "8856:18:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1249, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "8856:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "8855:20:8" + }, + "returnParameters": { + "id": 1254, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1253, + "mutability": "mutable", + "name": "output", + "nameLocation": "8912:6:8", + "nodeType": "VariableDeclaration", + "scope": 1257, + "src": "8899:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1252, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "8899:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "8898:21:8" + }, + "scope": 1632, + "src": "8837:1499:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1281, + "nodeType": "Block", + "src": "10494:76:8", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 1279, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1271, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 1267, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1260, + "src": "10511:1:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1268, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "10513:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "10511:8:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "expression": { + "id": 1269, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1262, + "src": "10523:1:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1270, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "10525:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "10523:8:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10511:20:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1278, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 1273, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1260, + "src": "10545:1:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 1272, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "10535:9:8", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 1274, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10535:12:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "arguments": [ + { + "id": 1276, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1262, + "src": "10561:1:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 1275, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "10551:9:8", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 1277, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10551:12:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "10535:28:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "10511:52:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 1266, + "id": 1280, + "nodeType": "Return", + "src": "10504:59:8" + } + ] + }, + "documentation": { + "id": 1258, + "nodeType": "StructuredDocumentation", + "src": "10342:71:8", + "text": " @dev Returns true if the two byte buffers are equal." + }, + "id": 1282, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "equal", + "nameLocation": "10427:5:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1263, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1260, + "mutability": "mutable", + "name": "a", + "nameLocation": "10446:1:8", + "nodeType": "VariableDeclaration", + "scope": 1282, + "src": "10433:14:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1259, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "10433:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1262, + "mutability": "mutable", + "name": "b", + "nameLocation": "10462:1:8", + "nodeType": "VariableDeclaration", + "scope": 1282, + "src": "10449:14:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1261, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "10449:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "10432:32:8" + }, + "returnParameters": { + "id": 1266, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1265, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1282, + "src": "10488:4:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 1264, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "10488:4:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "10487:6:8" + }, + "scope": 1632, + "src": "10418:152:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1372, + "nodeType": "Block", + "src": "10874:1024:8", + "statements": [ + { + "expression": { + "id": 1306, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1290, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "10884:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1305, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1296, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1293, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1291, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "10920:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "38", + "id": 1292, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10929:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "10920:10:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1294, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "10919:12:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830304646303046463030464630304646303046463030464630304646303046463030464630304646303046463030464630304646303046463030464630304646", + "id": 1295, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10934:66:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_450552876409790643671482431940419874915447411150352389258589821042463539455_by_1", + "typeString": "int_const 4505...(67 digits omitted)...9455" + }, + "value": "0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF" + }, + "src": "10919:81:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1297, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "10918:83:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1303, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1300, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1298, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11018:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830304646303046463030464630304646303046463030464630304646303046463030464630304646303046463030464630304646303046463030464630304646", + "id": 1299, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11026:66:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_450552876409790643671482431940419874915447411150352389258589821042463539455_by_1", + "typeString": "int_const 4505...(67 digits omitted)...9455" + }, + "value": "0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF" + }, + "src": "11018:74:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1301, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11017:76:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "38", + "id": 1302, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11097:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "11017:81:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1304, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11016:83:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "10918:181:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "10884:215:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 1307, + "nodeType": "ExpressionStatement", + "src": "10884:215:8" + }, + { + "expression": { + "id": 1324, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1308, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11109:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1323, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1314, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1311, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1309, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11157:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "3136", + "id": 1310, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11166:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "11157:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1312, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11156:13:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830303030464646463030303046464646303030304646464630303030464646463030303046464646303030304646464630303030464646463030303046464646", + "id": 1313, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11172:66:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_1766820105243087041267848467410591083712559083657179364930612997358944255_by_1", + "typeString": "int_const 1766...(65 digits omitted)...4255" + }, + "value": "0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF" + }, + "src": "11156:82:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1315, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11155:84:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1321, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1318, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1316, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11256:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830303030464646463030303046464646303030304646464630303030464646463030303046464646303030304646464630303030464646463030303046464646", + "id": 1317, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11264:66:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_1766820105243087041267848467410591083712559083657179364930612997358944255_by_1", + "typeString": "int_const 1766...(65 digits omitted)...4255" + }, + "value": "0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF" + }, + "src": "11256:74:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1319, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11255:76:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3136", + "id": 1320, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11335:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "11255:82:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1322, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11254:84:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "11155:183:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "11109:229:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 1325, + "nodeType": "ExpressionStatement", + "src": "11109:229:8" + }, + { + "expression": { + "id": 1342, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1326, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11348:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1341, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1332, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1329, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1327, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11396:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "3332", + "id": 1328, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11405:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "11396:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1330, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11395:13:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830303030303030304646464646464646303030303030303046464646464646463030303030303030464646464646464630303030303030304646464646464646", + "id": 1331, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11411:66:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_26959946660873538060741835960174461801791452538186943042387869433855_by_1", + "typeString": "int_const 2695...(60 digits omitted)...3855" + }, + "value": "0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF" + }, + "src": "11395:82:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1333, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11394:84:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1339, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1336, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1334, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11495:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830303030303030304646464646464646303030303030303046464646464646463030303030303030464646464646464630303030303030304646464646464646", + "id": 1335, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11503:66:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_26959946660873538060741835960174461801791452538186943042387869433855_by_1", + "typeString": "int_const 2695...(60 digits omitted)...3855" + }, + "value": "0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF" + }, + "src": "11495:74:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1337, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11494:76:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3332", + "id": 1338, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11574:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "11494:82:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1340, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11493:84:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "11394:183:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "11348:229:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 1343, + "nodeType": "ExpressionStatement", + "src": "11348:229:8" + }, + { + "expression": { + "id": 1360, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1344, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11587:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1359, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1350, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1347, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1345, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11635:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "3634", + "id": 1346, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11644:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "11635:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1348, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11634:13:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830303030303030303030303030303030464646464646464646464646464646463030303030303030303030303030303046464646464646464646464646464646", + "id": 1349, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11650:66:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_6277101735386680763495507056286727952657427581105975853055_by_1", + "typeString": "int_const 6277...(50 digits omitted)...3055" + }, + "value": "0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF" + }, + "src": "11634:82:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1351, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11633:84:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1357, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1354, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1352, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11734:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830303030303030303030303030303030464646464646464646464646464646463030303030303030303030303030303046464646464646464646464646464646", + "id": 1353, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11742:66:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_6277101735386680763495507056286727952657427581105975853055_by_1", + "typeString": "int_const 6277...(50 digits omitted)...3055" + }, + "value": "0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF" + }, + "src": "11734:74:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1355, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11733:76:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3634", + "id": 1356, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11813:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "11733:82:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1358, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11732:84:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "11633:183:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "11587:229:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 1361, + "nodeType": "ExpressionStatement", + "src": "11587:229:8" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1370, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1364, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1362, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11834:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "313238", + "id": 1363, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11843:3:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_128_by_1", + "typeString": "int_const 128" + }, + "value": "128" + }, + "src": "11834:12:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1365, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11833:14:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1368, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1366, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11851:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "313238", + "id": 1367, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11860:3:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_128_by_1", + "typeString": "int_const 128" + }, + "value": "128" + }, + "src": "11851:12:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1369, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11850:14:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "11833:31:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 1289, + "id": 1371, + "nodeType": "Return", + "src": "11826:38:8" + } + ] + }, + "documentation": { + "id": 1283, + "nodeType": "StructuredDocumentation", + "src": "10576:222:8", + "text": " @dev Reverses the byte order of a bytes32 value, converting between little-endian and big-endian.\n Inspired by https://graphics.stanford.edu/~seander/bithacks.html#ReverseParallel[Reverse Parallel]" + }, + "id": 1373, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "reverseBytes32", + "nameLocation": "10812:14:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1286, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1285, + "mutability": "mutable", + "name": "value", + "nameLocation": "10835:5:8", + "nodeType": "VariableDeclaration", + "scope": 1373, + "src": "10827:13:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 1284, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "10827:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "10826:15:8" + }, + "returnParameters": { + "id": 1289, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1288, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1373, + "src": "10865:7:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 1287, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "10865:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "10864:9:8" + }, + "scope": 1632, + "src": "10803:1095:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1445, + "nodeType": "Block", + "src": "12047:590:8", + "statements": [ + { + "expression": { + "id": 1397, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1381, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12057:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1396, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1387, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1384, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1382, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12093:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30784646303046463030464630304646303046463030464630304646303046463030", + "id": 1383, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12101:34:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_338958311018522360492699998064329424640_by_1", + "typeString": "int_const 3389...(31 digits omitted)...4640" + }, + "value": "0xFF00FF00FF00FF00FF00FF00FF00FF00" + }, + "src": "12093:42:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1385, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12092:44:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "38", + "id": 1386, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12140:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "12092:49:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1388, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12091:51:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1394, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1391, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1389, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12159:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30783030464630304646303046463030464630304646303046463030464630304646", + "id": 1390, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12167:34:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_1324055902416102970674609367438786815_by_1", + "typeString": "int_const 1324...(29 digits omitted)...6815" + }, + "value": "0x00FF00FF00FF00FF00FF00FF00FF00FF" + }, + "src": "12159:42:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1392, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12158:44:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "38", + "id": 1393, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12206:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "12158:49:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1395, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12157:51:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "src": "12091:117:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "src": "12057:151:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "id": 1398, + "nodeType": "ExpressionStatement", + "src": "12057:151:8" + }, + { + "expression": { + "id": 1415, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1399, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12218:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1414, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1405, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1402, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1400, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12266:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30784646464630303030464646463030303046464646303030304646464630303030", + "id": 1401, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12274:34:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_340277174703306882242637262502835978240_by_1", + "typeString": "int_const 3402...(31 digits omitted)...8240" + }, + "value": "0xFFFF0000FFFF0000FFFF0000FFFF0000" + }, + "src": "12266:42:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1403, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12265:44:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "3136", + "id": 1404, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12313:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "12265:50:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1406, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12264:52:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1412, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1409, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1407, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12333:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30783030303046464646303030304646464630303030464646463030303046464646", + "id": 1408, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12341:34:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_5192217631581220737344928932233215_by_1", + "typeString": "int_const 5192...(26 digits omitted)...3215" + }, + "value": "0x0000FFFF0000FFFF0000FFFF0000FFFF" + }, + "src": "12333:42:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1410, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12332:44:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3136", + "id": 1411, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12380:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "12332:50:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1413, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12331:52:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "src": "12264:119:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "src": "12218:165:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "id": 1416, + "nodeType": "ExpressionStatement", + "src": "12218:165:8" + }, + { + "expression": { + "id": 1433, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1417, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12393:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1432, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1423, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1420, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1418, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12441:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30784646464646464646303030303030303046464646464646463030303030303030", + "id": 1419, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12449:34:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_340282366841710300967557013907638845440_by_1", + "typeString": "int_const 3402...(31 digits omitted)...5440" + }, + "value": "0xFFFFFFFF00000000FFFFFFFF00000000" + }, + "src": "12441:42:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1421, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12440:44:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "3332", + "id": 1422, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12488:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "12440:50:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1424, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12439:52:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1430, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1427, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1425, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12508:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30783030303030303030464646464646464630303030303030304646464646464646", + "id": 1426, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12516:34:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_79228162495817593524129366015_by_1", + "typeString": "int_const 79228162495817593524129366015" + }, + "value": "0x00000000FFFFFFFF00000000FFFFFFFF" + }, + "src": "12508:42:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1428, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12507:44:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3332", + "id": 1429, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12555:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "12507:50:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1431, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12506:52:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "src": "12439:119:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "src": "12393:165:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "id": 1434, + "nodeType": "ExpressionStatement", + "src": "12393:165:8" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1443, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1437, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1435, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12576:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "3634", + "id": 1436, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12585:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "12576:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1438, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12575:13:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1441, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1439, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12592:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3634", + "id": 1440, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12601:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "12592:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1442, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12591:13:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "src": "12575:29:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "functionReturnParameters": 1380, + "id": 1444, + "nodeType": "Return", + "src": "12568:36:8" + } + ] + }, + "documentation": { + "id": 1374, + "nodeType": "StructuredDocumentation", + "src": "11904:67:8", + "text": "@dev Same as {reverseBytes32} but optimized for 128-bit values." + }, + "id": 1446, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "reverseBytes16", + "nameLocation": "11985:14:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1377, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1376, + "mutability": "mutable", + "name": "value", + "nameLocation": "12008:5:8", + "nodeType": "VariableDeclaration", + "scope": 1446, + "src": "12000:13:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "typeName": { + "id": 1375, + "name": "bytes16", + "nodeType": "ElementaryTypeName", + "src": "12000:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "visibility": "internal" + } + ], + "src": "11999:15:8" + }, + "returnParameters": { + "id": 1380, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1379, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1446, + "src": "12038:7:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "typeName": { + "id": 1378, + "name": "bytes16", + "nodeType": "ElementaryTypeName", + "src": "12038:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "visibility": "internal" + } + ], + "src": "12037:9:8" + }, + "scope": 1632, + "src": "11976:661:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1500, + "nodeType": "Block", + "src": "12782:303:8", + "statements": [ + { + "expression": { + "id": 1470, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1454, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1449, + "src": "12792:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1469, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1460, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1457, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1455, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1449, + "src": "12802:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307846463030464630304646303046463030", + "id": 1456, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12810:18:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_18374966859414961920_by_1", + "typeString": "int_const 18374966859414961920" + }, + "value": "0xFF00FF00FF00FF00" + }, + "src": "12802:26:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1458, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12801:28:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "38", + "id": 1459, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12833:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "12801:33:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1461, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12800:35:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1467, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1464, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1462, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1449, + "src": "12840:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830304646303046463030464630304646", + "id": 1463, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12848:18:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_71777214294589695_by_1", + "typeString": "int_const 71777214294589695" + }, + "value": "0x00FF00FF00FF00FF" + }, + "src": "12840:26:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1465, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12839:28:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "38", + "id": 1466, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12871:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "12839:33:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1468, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12838:35:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "src": "12800:73:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "src": "12792:81:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "id": 1471, + "nodeType": "ExpressionStatement", + "src": "12792:81:8" + }, + { + "expression": { + "id": 1488, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1472, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1449, + "src": "12897:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1487, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1478, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1475, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1473, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1449, + "src": "12907:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307846464646303030304646464630303030", + "id": 1474, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12915:18:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_18446462603027742720_by_1", + "typeString": "int_const 18446462603027742720" + }, + "value": "0xFFFF0000FFFF0000" + }, + "src": "12907:26:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1476, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12906:28:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "3136", + "id": 1477, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12938:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "12906:34:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1479, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12905:36:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1485, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1482, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1480, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1449, + "src": "12946:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830303030464646463030303046464646", + "id": 1481, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12954:18:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_281470681808895_by_1", + "typeString": "int_const 281470681808895" + }, + "value": "0x0000FFFF0000FFFF" + }, + "src": "12946:26:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1483, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12945:28:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3136", + "id": 1484, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12977:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "12945:34:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1486, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12944:36:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "src": "12905:75:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "src": "12897:83:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "id": 1489, + "nodeType": "ExpressionStatement", + "src": "12897:83:8" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1498, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1492, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1490, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1449, + "src": "13024:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "3332", + "id": 1491, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13033:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "13024:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1493, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13023:13:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1496, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1494, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1449, + "src": "13040:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3332", + "id": 1495, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13049:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "13040:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1497, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13039:13:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "src": "13023:29:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "functionReturnParameters": 1453, + "id": 1499, + "nodeType": "Return", + "src": "13016:36:8" + } + ] + }, + "documentation": { + "id": 1447, + "nodeType": "StructuredDocumentation", + "src": "12643:66:8", + "text": "@dev Same as {reverseBytes32} but optimized for 64-bit values." + }, + "id": 1501, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "reverseBytes8", + "nameLocation": "12723:13:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1450, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1449, + "mutability": "mutable", + "name": "value", + "nameLocation": "12744:5:8", + "nodeType": "VariableDeclaration", + "scope": 1501, + "src": "12737:12:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "typeName": { + "id": 1448, + "name": "bytes8", + "nodeType": "ElementaryTypeName", + "src": "12737:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "visibility": "internal" + } + ], + "src": "12736:14:8" + }, + "returnParameters": { + "id": 1453, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1452, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1501, + "src": "12774:6:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "typeName": { + "id": 1451, + "name": "bytes8", + "nodeType": "ElementaryTypeName", + "src": "12774:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "visibility": "internal" + } + ], + "src": "12773:8:8" + }, + "scope": 1632, + "src": "12714:371:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1537, + "nodeType": "Block", + "src": "13230:168:8", + "statements": [ + { + "expression": { + "id": 1525, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1509, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1504, + "src": "13240:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "id": 1524, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "id": 1515, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "id": 1512, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1510, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1504, + "src": "13250:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30784646303046463030", + "id": 1511, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13258:10:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_4278255360_by_1", + "typeString": "int_const 4278255360" + }, + "value": "0xFF00FF00" + }, + "src": "13250:18:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + } + ], + "id": 1513, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13249:20:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "38", + "id": 1514, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13273:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "13249:25:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + } + ], + "id": 1516, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13248:27:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "id": 1522, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "id": 1519, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1517, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1504, + "src": "13280:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30783030464630304646", + "id": 1518, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13288:10:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_16711935_by_1", + "typeString": "int_const 16711935" + }, + "value": "0x00FF00FF" + }, + "src": "13280:18:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + } + ], + "id": 1520, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13279:20:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "38", + "id": 1521, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13303:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "13279:25:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + } + ], + "id": 1523, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13278:27:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "src": "13248:57:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "src": "13240:65:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "id": 1526, + "nodeType": "ExpressionStatement", + "src": "13240:65:8" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "id": 1535, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "id": 1529, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1527, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1504, + "src": "13337:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "3136", + "id": 1528, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13346:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "13337:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + } + ], + "id": 1530, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13336:13:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "id": 1533, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1531, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1504, + "src": "13353:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3136", + "id": 1532, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13362:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "13353:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + } + ], + "id": 1534, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13352:13:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "src": "13336:29:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "functionReturnParameters": 1508, + "id": 1536, + "nodeType": "Return", + "src": "13329:36:8" + } + ] + }, + "documentation": { + "id": 1502, + "nodeType": "StructuredDocumentation", + "src": "13091:66:8", + "text": "@dev Same as {reverseBytes32} but optimized for 32-bit values." + }, + "id": 1538, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "reverseBytes4", + "nameLocation": "13171:13:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1505, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1504, + "mutability": "mutable", + "name": "value", + "nameLocation": "13192:5:8", + "nodeType": "VariableDeclaration", + "scope": 1538, + "src": "13185:12:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "typeName": { + "id": 1503, + "name": "bytes4", + "nodeType": "ElementaryTypeName", + "src": "13185:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "visibility": "internal" + } + ], + "src": "13184:14:8" + }, + "returnParameters": { + "id": 1508, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1507, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1538, + "src": "13222:6:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "typeName": { + "id": 1506, + "name": "bytes4", + "nodeType": "ElementaryTypeName", + "src": "13222:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "visibility": "internal" + } + ], + "src": "13221:8:8" + }, + "scope": 1632, + "src": "13162:236:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1556, + "nodeType": "Block", + "src": "13543:51:8", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + }, + "id": 1554, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + }, + "id": 1548, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1546, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1541, + "src": "13561:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "38", + "id": 1547, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13570:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "13561:10:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + } + ], + "id": 1549, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13560:12:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + }, + "id": 1552, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1550, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1541, + "src": "13576:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "38", + "id": 1551, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13585:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "13576:10:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + } + ], + "id": 1553, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13575:12:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "src": "13560:27:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "functionReturnParameters": 1545, + "id": 1555, + "nodeType": "Return", + "src": "13553:34:8" + } + ] + }, + "documentation": { + "id": 1539, + "nodeType": "StructuredDocumentation", + "src": "13404:66:8", + "text": "@dev Same as {reverseBytes32} but optimized for 16-bit values." + }, + "id": 1557, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "reverseBytes2", + "nameLocation": "13484:13:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1542, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1541, + "mutability": "mutable", + "name": "value", + "nameLocation": "13505:5:8", + "nodeType": "VariableDeclaration", + "scope": 1557, + "src": "13498:12:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + }, + "typeName": { + "id": 1540, + "name": "bytes2", + "nodeType": "ElementaryTypeName", + "src": "13498:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "visibility": "internal" + } + ], + "src": "13497:14:8" + }, + "returnParameters": { + "id": 1545, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1544, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1557, + "src": "13535:6:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + }, + "typeName": { + "id": 1543, + "name": "bytes2", + "nodeType": "ElementaryTypeName", + "src": "13535:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "visibility": "internal" + } + ], + "src": "13534:8:8" + }, + "scope": 1632, + "src": "13475:119:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1618, + "nodeType": "Block", + "src": "13811:313:8", + "statements": [ + { + "body": { + "id": 1611, + "nodeType": "Block", + "src": "13871:213:8", + "statements": [ + { + "assignments": [ + 1578 + ], + "declarations": [ + { + "constant": false, + "id": 1578, + "mutability": "mutable", + "name": "chunk", + "nameLocation": "13893:5:8", + "nodeType": "VariableDeclaration", + "scope": 1611, + "src": "13885:13:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 1577, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "13885:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 1583, + "initialValue": { + "arguments": [ + { + "id": 1580, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1560, + "src": "13924:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 1581, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1566, + "src": "13932:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1579, + "name": "_unsafeReadBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1631, + "src": "13901:22:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (bytes memory,uint256) pure returns (bytes32)" + } + }, + "id": 1582, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13901:33:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "13885:49:8" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1589, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1584, + "name": "chunk", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1578, + "src": "13952:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 1587, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13969:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 1586, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "13961:7:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes32_$", + "typeString": "type(bytes32)" + }, + "typeName": { + "id": 1585, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "13961:7:8", + "typeDescriptions": {} + } + }, + "id": 1588, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13961:10:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "13952:19:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 1610, + "nodeType": "IfStatement", + "src": "13948:126:8", + "trueBody": { + "id": 1609, + "nodeType": "Block", + "src": "13973:101:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1602, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1594, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "38", + "id": 1592, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14007:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 1593, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1566, + "src": "14011:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "14007:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "arguments": [ + { + "arguments": [ + { + "id": 1599, + "name": "chunk", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1578, + "src": "14032:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 1598, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "14024:7:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 1597, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "14024:7:8", + "typeDescriptions": {} + } + }, + "id": 1600, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14024:14:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1595, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "14015:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1596, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "14020:3:8", + "memberName": "clz", + "nodeType": "MemberAccess", + "referencedDeclaration": 6203, + "src": "14015:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256) pure returns (uint256)" + } + }, + "id": 1601, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14015:24:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "14007:32:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1606, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "38", + "id": 1603, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14041:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "expression": { + "id": 1604, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1560, + "src": "14045:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1605, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "14052:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "14045:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "14041:17:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1590, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "13998:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1591, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "14003:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "13998:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1607, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13998:61:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 1564, + "id": 1608, + "nodeType": "Return", + "src": "13991:68:8" + } + ] + } + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1572, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1569, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1566, + "src": "13841:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "expression": { + "id": 1570, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1560, + "src": "13845:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1571, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "13852:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "13845:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "13841:17:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 1612, + "initializationExpression": { + "assignments": [ + 1566 + ], + "declarations": [ + { + "constant": false, + "id": 1566, + "mutability": "mutable", + "name": "i", + "nameLocation": "13834:1:8", + "nodeType": "VariableDeclaration", + "scope": 1612, + "src": "13826:9:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1565, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13826:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 1568, + "initialValue": { + "hexValue": "30", + "id": 1567, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13838:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "13826:13:8" + }, + "isSimpleCounterLoop": false, + "loopExpression": { + "expression": { + "id": 1575, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1573, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1566, + "src": "13860:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "hexValue": "30783230", + "id": 1574, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13865:4:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "0x20" + }, + "src": "13860:9:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1576, + "nodeType": "ExpressionStatement", + "src": "13860:9:8" + }, + "nodeType": "ForStatement", + "src": "13821:263:8" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1616, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "38", + "id": 1613, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14100:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "expression": { + "id": 1614, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1560, + "src": "14104:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1615, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "14111:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "14104:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "14100:17:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 1564, + "id": 1617, + "nodeType": "Return", + "src": "14093:24:8" + } + ] + }, + "documentation": { + "id": 1558, + "nodeType": "StructuredDocumentation", + "src": "13600:140:8", + "text": " @dev Counts the number of leading zero bits a bytes array. Returns `8 * buffer.length`\n if the buffer is all zeros." + }, + "id": 1619, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "clz", + "nameLocation": "13754:3:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1561, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1560, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "13771:6:8", + "nodeType": "VariableDeclaration", + "scope": 1619, + "src": "13758:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1559, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "13758:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "13757:21:8" + }, + "returnParameters": { + "id": 1564, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1563, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1619, + "src": "13802:7:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1562, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13802:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "13801:9:8" + }, + "scope": 1632, + "src": "13745:379:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1630, + "nodeType": "Block", + "src": "14509:225:8", + "statements": [ + { + "AST": { + "nativeSrc": "14658:70:8", + "nodeType": "YulBlock", + "src": "14658:70:8", + "statements": [ + { + "nativeSrc": "14672:46:8", + "nodeType": "YulAssignment", + "src": "14672:46:8", + "value": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "14695:6:8", + "nodeType": "YulIdentifier", + "src": "14695:6:8" + }, + { + "kind": "number", + "nativeSrc": "14703:4:8", + "nodeType": "YulLiteral", + "src": "14703:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "14691:3:8", + "nodeType": "YulIdentifier", + "src": "14691:3:8" + }, + "nativeSrc": "14691:17:8", + "nodeType": "YulFunctionCall", + "src": "14691:17:8" + }, + { + "name": "offset", + "nativeSrc": "14710:6:8", + "nodeType": "YulIdentifier", + "src": "14710:6:8" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "14687:3:8", + "nodeType": "YulIdentifier", + "src": "14687:3:8" + }, + "nativeSrc": "14687:30:8", + "nodeType": "YulFunctionCall", + "src": "14687:30:8" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "14681:5:8", + "nodeType": "YulIdentifier", + "src": "14681:5:8" + }, + "nativeSrc": "14681:37:8", + "nodeType": "YulFunctionCall", + "src": "14681:37:8" + }, + "variableNames": [ + { + "name": "value", + "nativeSrc": "14672:5:8", + "nodeType": "YulIdentifier", + "src": "14672:5:8" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 1622, + "isOffset": false, + "isSlot": false, + "src": "14695:6:8", + "valueSize": 1 + }, + { + "declaration": 1624, + "isOffset": false, + "isSlot": false, + "src": "14710:6:8", + "valueSize": 1 + }, + { + "declaration": 1627, + "isOffset": false, + "isSlot": false, + "src": "14672:5:8", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 1629, + "nodeType": "InlineAssembly", + "src": "14633:95:8" + } + ] + }, + "documentation": { + "id": 1620, + "nodeType": "StructuredDocumentation", + "src": "14130:268:8", + "text": " @dev Reads a bytes32 from a bytes array without bounds checking.\n NOTE: making this function internal would mean it could be used with memory unsafe offset, and marking the\n assembly block as such would prevent some optimizations." + }, + "id": 1631, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_unsafeReadBytesOffset", + "nameLocation": "14412:22:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1625, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1622, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "14448:6:8", + "nodeType": "VariableDeclaration", + "scope": 1631, + "src": "14435:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1621, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "14435:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1624, + "mutability": "mutable", + "name": "offset", + "nameLocation": "14464:6:8", + "nodeType": "VariableDeclaration", + "scope": 1631, + "src": "14456:14:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1623, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "14456:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "14434:37:8" + }, + "returnParameters": { + "id": 1628, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1627, + "mutability": "mutable", + "name": "value", + "nameLocation": "14502:5:8", + "nodeType": "VariableDeclaration", + "scope": 1631, + "src": "14494:13:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 1626, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "14494:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "14493:15:8" + }, + "scope": 1632, + "src": "14403:331:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "private" + } + ], + "scope": 1633, + "src": "198:14538:8", + "usedErrors": [], + "usedEvents": [] + } + ], + "src": "99:14638:8" + }, + "id": 8 + }, + "@openzeppelin/contracts/utils/Context.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/Context.sol", + "exportedSymbols": { + "Context": [ + 1662 + ] + }, + "id": 1663, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1634, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "101:24:9" + }, + { + "abstract": true, + "baseContracts": [], + "canonicalName": "Context", + "contractDependencies": [], + "contractKind": "contract", + "documentation": { + "id": 1635, + "nodeType": "StructuredDocumentation", + "src": "127:496:9", + "text": " @dev Provides information about the current execution context, including the\n sender of the transaction and its data. While these are generally available\n via msg.sender and msg.data, they should not be accessed in such a direct\n manner, since when dealing with meta-transactions the account sending and\n paying for execution may not be the actual sender (as far as an application\n is concerned).\n This contract is only required for intermediate, library-like contracts." + }, + "fullyImplemented": true, + "id": 1662, + "linearizedBaseContracts": [ + 1662 + ], + "name": "Context", + "nameLocation": "642:7:9", + "nodeType": "ContractDefinition", + "nodes": [ + { + "body": { + "id": 1643, + "nodeType": "Block", + "src": "718:34:9", + "statements": [ + { + "expression": { + "expression": { + "id": 1640, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -15, + "src": "735:3:9", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 1641, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "739:6:9", + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "735:10:9", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 1639, + "id": 1642, + "nodeType": "Return", + "src": "728:17:9" + } + ] + }, + "id": 1644, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_msgSender", + "nameLocation": "665:10:9", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1636, + "nodeType": "ParameterList", + "parameters": [], + "src": "675:2:9" + }, + "returnParameters": { + "id": 1639, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1638, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1644, + "src": "709:7:9", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 1637, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "709:7:9", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "708:9:9" + }, + "scope": 1662, + "src": "656:96:9", + "stateMutability": "view", + "virtual": true, + "visibility": "internal" + }, + { + "body": { + "id": 1652, + "nodeType": "Block", + "src": "825:32:9", + "statements": [ + { + "expression": { + "expression": { + "id": 1649, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -15, + "src": "842:3:9", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 1650, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "846:4:9", + "memberName": "data", + "nodeType": "MemberAccess", + "src": "842:8:9", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + } + }, + "functionReturnParameters": 1648, + "id": 1651, + "nodeType": "Return", + "src": "835:15:9" + } + ] + }, + "id": 1653, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_msgData", + "nameLocation": "767:8:9", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1645, + "nodeType": "ParameterList", + "parameters": [], + "src": "775:2:9" + }, + "returnParameters": { + "id": 1648, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1647, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1653, + "src": "809:14:9", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1646, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "809:5:9", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "808:16:9" + }, + "scope": 1662, + "src": "758:99:9", + "stateMutability": "view", + "virtual": true, + "visibility": "internal" + }, + { + "body": { + "id": 1660, + "nodeType": "Block", + "src": "935:25:9", + "statements": [ + { + "expression": { + "hexValue": "30", + "id": 1658, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "952:1:9", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "functionReturnParameters": 1657, + "id": 1659, + "nodeType": "Return", + "src": "945:8:9" + } + ] + }, + "id": 1661, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_contextSuffixLength", + "nameLocation": "872:20:9", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1654, + "nodeType": "ParameterList", + "parameters": [], + "src": "892:2:9" + }, + "returnParameters": { + "id": 1657, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1656, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1661, + "src": "926:7:9", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1655, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "926:7:9", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "925:9:9" + }, + "scope": 1662, + "src": "863:97:9", + "stateMutability": "view", + "virtual": true, + "visibility": "internal" + } + ], + "scope": 1663, + "src": "624:338:9", + "usedErrors": [], + "usedEvents": [] + } + ], + "src": "101:862:9" + }, + "id": 9 + }, + "@openzeppelin/contracts/utils/Panic.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/Panic.sol", + "exportedSymbols": { + "Panic": [ + 1714 + ] + }, + "id": 1715, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1664, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "99:24:10" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "Panic", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 1665, + "nodeType": "StructuredDocumentation", + "src": "125:489:10", + "text": " @dev Helper library for emitting standardized panic codes.\n ```solidity\n contract Example {\n using Panic for uint256;\n // Use any of the declared internal constants\n function foo() { Panic.GENERIC.panic(); }\n // Alternatively\n function foo() { Panic.panic(Panic.GENERIC); }\n }\n ```\n Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil].\n _Available since v5.1._" + }, + "fullyImplemented": true, + "id": 1714, + "linearizedBaseContracts": [ + 1714 + ], + "name": "Panic", + "nameLocation": "665:5:10", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": true, + "documentation": { + "id": 1666, + "nodeType": "StructuredDocumentation", + "src": "677:36:10", + "text": "@dev generic / unspecified error" + }, + "id": 1669, + "mutability": "constant", + "name": "GENERIC", + "nameLocation": "744:7:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "718:40:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1667, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "718:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783030", + "id": 1668, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "754:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0x00" + }, + "visibility": "internal" + }, + { + "constant": true, + "documentation": { + "id": 1670, + "nodeType": "StructuredDocumentation", + "src": "764:37:10", + "text": "@dev used by the assert() builtin" + }, + "id": 1673, + "mutability": "constant", + "name": "ASSERT", + "nameLocation": "832:6:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "806:39:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1671, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "806:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783031", + "id": 1672, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "841:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "0x01" + }, + "visibility": "internal" + }, + { + "constant": true, + "documentation": { + "id": 1674, + "nodeType": "StructuredDocumentation", + "src": "851:41:10", + "text": "@dev arithmetic underflow or overflow" + }, + "id": 1677, + "mutability": "constant", + "name": "UNDER_OVERFLOW", + "nameLocation": "923:14:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "897:47:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1675, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "897:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783131", + "id": 1676, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "940:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_17_by_1", + "typeString": "int_const 17" + }, + "value": "0x11" + }, + "visibility": "internal" + }, + { + "constant": true, + "documentation": { + "id": 1678, + "nodeType": "StructuredDocumentation", + "src": "950:35:10", + "text": "@dev division or modulo by zero" + }, + "id": 1681, + "mutability": "constant", + "name": "DIVISION_BY_ZERO", + "nameLocation": "1016:16:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "990:49:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1679, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "990:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783132", + "id": 1680, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1035:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_18_by_1", + "typeString": "int_const 18" + }, + "value": "0x12" + }, + "visibility": "internal" + }, + { + "constant": true, + "documentation": { + "id": 1682, + "nodeType": "StructuredDocumentation", + "src": "1045:30:10", + "text": "@dev enum conversion error" + }, + "id": 1685, + "mutability": "constant", + "name": "ENUM_CONVERSION_ERROR", + "nameLocation": "1106:21:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "1080:54:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1683, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1080:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783231", + "id": 1684, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1130:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_33_by_1", + "typeString": "int_const 33" + }, + "value": "0x21" + }, + "visibility": "internal" + }, + { + "constant": true, + "documentation": { + "id": 1686, + "nodeType": "StructuredDocumentation", + "src": "1140:36:10", + "text": "@dev invalid encoding in storage" + }, + "id": 1689, + "mutability": "constant", + "name": "STORAGE_ENCODING_ERROR", + "nameLocation": "1207:22:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "1181:55:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1687, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1181:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783232", + "id": 1688, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1232:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_34_by_1", + "typeString": "int_const 34" + }, + "value": "0x22" + }, + "visibility": "internal" + }, + { + "constant": true, + "documentation": { + "id": 1690, + "nodeType": "StructuredDocumentation", + "src": "1242:24:10", + "text": "@dev empty array pop" + }, + "id": 1693, + "mutability": "constant", + "name": "EMPTY_ARRAY_POP", + "nameLocation": "1297:15:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "1271:48:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1691, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1271:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783331", + "id": 1692, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1315:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_49_by_1", + "typeString": "int_const 49" + }, + "value": "0x31" + }, + "visibility": "internal" + }, + { + "constant": true, + "documentation": { + "id": 1694, + "nodeType": "StructuredDocumentation", + "src": "1325:35:10", + "text": "@dev array out of bounds access" + }, + "id": 1697, + "mutability": "constant", + "name": "ARRAY_OUT_OF_BOUNDS", + "nameLocation": "1391:19:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "1365:52:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1695, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1365:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783332", + "id": 1696, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1413:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_50_by_1", + "typeString": "int_const 50" + }, + "value": "0x32" + }, + "visibility": "internal" + }, + { + "constant": true, + "documentation": { + "id": 1698, + "nodeType": "StructuredDocumentation", + "src": "1423:65:10", + "text": "@dev resource error (too large allocation or too large array)" + }, + "id": 1701, + "mutability": "constant", + "name": "RESOURCE_ERROR", + "nameLocation": "1519:14:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "1493:47:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1699, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1493:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783431", + "id": 1700, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1536:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_65_by_1", + "typeString": "int_const 65" + }, + "value": "0x41" + }, + "visibility": "internal" + }, + { + "constant": true, + "documentation": { + "id": 1702, + "nodeType": "StructuredDocumentation", + "src": "1546:42:10", + "text": "@dev calling invalid internal function" + }, + "id": 1705, + "mutability": "constant", + "name": "INVALID_INTERNAL_FUNCTION", + "nameLocation": "1619:25:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "1593:58:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1703, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1593:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783531", + "id": 1704, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1647:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_81_by_1", + "typeString": "int_const 81" + }, + "value": "0x51" + }, + "visibility": "internal" + }, + { + "body": { + "id": 1712, + "nodeType": "Block", + "src": "1819:151:10", + "statements": [ + { + "AST": { + "nativeSrc": "1854:110:10", + "nodeType": "YulBlock", + "src": "1854:110:10", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1875:4:10", + "nodeType": "YulLiteral", + "src": "1875:4:10", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "1881:10:10", + "nodeType": "YulLiteral", + "src": "1881:10:10", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1868:6:10", + "nodeType": "YulIdentifier", + "src": "1868:6:10" + }, + "nativeSrc": "1868:24:10", + "nodeType": "YulFunctionCall", + "src": "1868:24:10" + }, + "nativeSrc": "1868:24:10", + "nodeType": "YulExpressionStatement", + "src": "1868:24:10" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1912:4:10", + "nodeType": "YulLiteral", + "src": "1912:4:10", + "type": "", + "value": "0x20" + }, + { + "name": "code", + "nativeSrc": "1918:4:10", + "nodeType": "YulIdentifier", + "src": "1918:4:10" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1905:6:10", + "nodeType": "YulIdentifier", + "src": "1905:6:10" + }, + "nativeSrc": "1905:18:10", + "nodeType": "YulFunctionCall", + "src": "1905:18:10" + }, + "nativeSrc": "1905:18:10", + "nodeType": "YulExpressionStatement", + "src": "1905:18:10" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1943:4:10", + "nodeType": "YulLiteral", + "src": "1943:4:10", + "type": "", + "value": "0x1c" + }, + { + "kind": "number", + "nativeSrc": "1949:4:10", + "nodeType": "YulLiteral", + "src": "1949:4:10", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "1936:6:10", + "nodeType": "YulIdentifier", + "src": "1936:6:10" + }, + "nativeSrc": "1936:18:10", + "nodeType": "YulFunctionCall", + "src": "1936:18:10" + }, + "nativeSrc": "1936:18:10", + "nodeType": "YulExpressionStatement", + "src": "1936:18:10" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 1708, + "isOffset": false, + "isSlot": false, + "src": "1918:4:10", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 1711, + "nodeType": "InlineAssembly", + "src": "1829:135:10" + } + ] + }, + "documentation": { + "id": 1706, + "nodeType": "StructuredDocumentation", + "src": "1658:113:10", + "text": "@dev Reverts with a panic code. Recommended to use with\n the internal constants with predefined codes." + }, + "id": 1713, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "panic", + "nameLocation": "1785:5:10", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1709, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1708, + "mutability": "mutable", + "name": "code", + "nameLocation": "1799:4:10", + "nodeType": "VariableDeclaration", + "scope": 1713, + "src": "1791:12:10", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1707, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1791:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1790:14:10" + }, + "returnParameters": { + "id": 1710, + "nodeType": "ParameterList", + "parameters": [], + "src": "1819:0:10" + }, + "scope": 1714, + "src": "1776:194:10", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + } + ], + "scope": 1715, + "src": "657:1315:10", + "usedErrors": [], + "usedEvents": [] + } + ], + "src": "99:1874:10" + }, + "id": 10 + }, + "@openzeppelin/contracts/utils/ReentrancyGuard.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/ReentrancyGuard.sol", + "exportedSymbols": { + "ReentrancyGuard": [ + 1827 + ], + "StorageSlot": [ + 2168 + ] + }, + "id": 1828, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1716, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "109:24:11" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/StorageSlot.sol", + "file": "./StorageSlot.sol", + "id": 1718, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 1828, + "sourceUnit": 2169, + "src": "135:46:11", + "symbolAliases": [ + { + "foreign": { + "id": 1717, + "name": "StorageSlot", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2168, + "src": "143:11:11", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": true, + "baseContracts": [], + "canonicalName": "ReentrancyGuard", + "contractDependencies": [], + "contractKind": "contract", + "documentation": { + "id": 1719, + "nodeType": "StructuredDocumentation", + "src": "183:1066:11", + "text": " @dev Contract module that helps prevent reentrant calls to a function.\n Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n available, which can be applied to functions to make sure there are no nested\n (reentrant) calls to them.\n Note that because there is a single `nonReentrant` guard, functions marked as\n `nonReentrant` may not call one another. This can be worked around by making\n those functions `private`, and then adding `external` `nonReentrant` entry\n points to them.\n TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,\n consider using {ReentrancyGuardTransient} instead.\n TIP: If you would like to learn more about reentrancy and alternative ways\n to protect against it, check out our blog post\n https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n IMPORTANT: Deprecated. This storage-based reentrancy guard will be removed and replaced\n by the {ReentrancyGuardTransient} variant in v6.0.\n @custom:stateless" + }, + "fullyImplemented": true, + "id": 1827, + "linearizedBaseContracts": [ + 1827 + ], + "name": "ReentrancyGuard", + "nameLocation": "1268:15:11", + "nodeType": "ContractDefinition", + "nodes": [ + { + "global": false, + "id": 1722, + "libraryName": { + "id": 1720, + "name": "StorageSlot", + "nameLocations": [ + "1296:11:11" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2168, + "src": "1296:11:11" + }, + "nodeType": "UsingForDirective", + "src": "1290:30:11", + "typeName": { + "id": 1721, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1312:7:11", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + }, + { + "constant": true, + "id": 1725, + "mutability": "constant", + "name": "REENTRANCY_GUARD_STORAGE", + "nameLocation": "1470:24:11", + "nodeType": "VariableDeclaration", + "scope": 1827, + "src": "1445:126:11", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 1723, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1445:7:11", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": { + "hexValue": "307839623737396231373432326430646639323232333031386233326234643166613436653037313732336436383137653234383664303033626563633535663030", + "id": 1724, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1505:66:11", + "typeDescriptions": { + "typeIdentifier": "t_rational_70319816728846589445362000750570655803700195216363692647688146666176345628416_by_1", + "typeString": "int_const 7031...(69 digits omitted)...8416" + }, + "value": "0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00" + }, + "visibility": "private" + }, + { + "constant": true, + "id": 1728, + "mutability": "constant", + "name": "NOT_ENTERED", + "nameLocation": "2351:11:11", + "nodeType": "VariableDeclaration", + "scope": 1827, + "src": "2326:40:11", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1726, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2326:7:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "31", + "id": 1727, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2365:1:11", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "visibility": "private" + }, + { + "constant": true, + "id": 1731, + "mutability": "constant", + "name": "ENTERED", + "nameLocation": "2397:7:11", + "nodeType": "VariableDeclaration", + "scope": 1827, + "src": "2372:36:11", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1729, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2372:7:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "32", + "id": 1730, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2407:1:11", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "visibility": "private" + }, + { + "documentation": { + "id": 1732, + "nodeType": "StructuredDocumentation", + "src": "2415:52:11", + "text": " @dev Unauthorized reentrant call." + }, + "errorSelector": "3ee5aeb5", + "id": 1734, + "name": "ReentrancyGuardReentrantCall", + "nameLocation": "2478:28:11", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 1733, + "nodeType": "ParameterList", + "parameters": [], + "src": "2506:2:11" + }, + "src": "2472:37:11" + }, + { + "body": { + "id": 1745, + "nodeType": "Block", + "src": "2529:83:11", + "statements": [ + { + "expression": { + "id": 1743, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1737, + "name": "_reentrancyGuardStorageSlot", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1826, + "src": "2539:27:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$__$returns$_t_bytes32_$", + "typeString": "function () pure returns (bytes32)" + } + }, + "id": 1738, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2539:29:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 1739, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2569:14:11", + "memberName": "getUint256Slot", + "nodeType": "MemberAccess", + "referencedDeclaration": 2112, + "src": "2539:44:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$_t_struct$_Uint256Slot_$2059_storage_ptr_$attached_to$_t_bytes32_$", + "typeString": "function (bytes32) pure returns (struct StorageSlot.Uint256Slot storage pointer)" + } + }, + "id": 1740, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2539:46:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_struct$_Uint256Slot_$2059_storage_ptr", + "typeString": "struct StorageSlot.Uint256Slot storage pointer" + } + }, + "id": 1741, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberLocation": "2586:5:11", + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": 2058, + "src": "2539:52:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 1742, + "name": "NOT_ENTERED", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1728, + "src": "2594:11:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2539:66:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1744, + "nodeType": "ExpressionStatement", + "src": "2539:66:11" + } + ] + }, + "id": 1746, + "implemented": true, + "kind": "constructor", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1735, + "nodeType": "ParameterList", + "parameters": [], + "src": "2526:2:11" + }, + "returnParameters": { + "id": 1736, + "nodeType": "ParameterList", + "parameters": [], + "src": "2529:0:11" + }, + "scope": 1827, + "src": "2515:97:11", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1756, + "nodeType": "Block", + "src": "3013:79:11", + "statements": [ + { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1749, + "name": "_nonReentrantBefore", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1791, + "src": "3023:19:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$__$returns$__$", + "typeString": "function ()" + } + }, + "id": 1750, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3023:21:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1751, + "nodeType": "ExpressionStatement", + "src": "3023:21:11" + }, + { + "id": 1752, + "nodeType": "PlaceholderStatement", + "src": "3054:1:11" + }, + { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1753, + "name": "_nonReentrantAfter", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1803, + "src": "3065:18:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$__$returns$__$", + "typeString": "function ()" + } + }, + "id": 1754, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3065:20:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1755, + "nodeType": "ExpressionStatement", + "src": "3065:20:11" + } + ] + }, + "documentation": { + "id": 1747, + "nodeType": "StructuredDocumentation", + "src": "2618:366:11", + "text": " @dev Prevents a contract from calling itself, directly or indirectly.\n Calling a `nonReentrant` function from another `nonReentrant`\n function is not supported. It is possible to prevent this from happening\n by making the `nonReentrant` function external, and making it call a\n `private` function that does the actual work." + }, + "id": 1757, + "name": "nonReentrant", + "nameLocation": "2998:12:11", + "nodeType": "ModifierDefinition", + "parameters": { + "id": 1748, + "nodeType": "ParameterList", + "parameters": [], + "src": "3010:2:11" + }, + "src": "2989:103:11", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1764, + "nodeType": "Block", + "src": "3527:53:11", + "statements": [ + { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1760, + "name": "_nonReentrantBeforeView", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1776, + "src": "3537:23:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$__$", + "typeString": "function () view" + } + }, + "id": 1761, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3537:25:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1762, + "nodeType": "ExpressionStatement", + "src": "3537:25:11" + }, + { + "id": 1763, + "nodeType": "PlaceholderStatement", + "src": "3572:1:11" + } + ] + }, + "documentation": { + "id": 1758, + "nodeType": "StructuredDocumentation", + "src": "3098:396:11", + "text": " @dev A `view` only version of {nonReentrant}. Use to block view functions\n from being called, preventing reading from inconsistent contract state.\n CAUTION: This is a \"view\" modifier and does not change the reentrancy\n status. Use it only on view functions. For payable or non-payable functions,\n use the standard {nonReentrant} modifier instead." + }, + "id": 1765, + "name": "nonReentrantView", + "nameLocation": "3508:16:11", + "nodeType": "ModifierDefinition", + "parameters": { + "id": 1759, + "nodeType": "ParameterList", + "parameters": [], + "src": "3524:2:11" + }, + "src": "3499:81:11", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1775, + "nodeType": "Block", + "src": "3634:109:11", + "statements": [ + { + "condition": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1768, + "name": "_reentrancyGuardEntered", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1818, + "src": "3648:23:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_bool_$", + "typeString": "function () view returns (bool)" + } + }, + "id": 1769, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3648:25:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 1774, + "nodeType": "IfStatement", + "src": "3644:93:11", + "trueBody": { + "id": 1773, + "nodeType": "Block", + "src": "3675:62:11", + "statements": [ + { + "errorCall": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1770, + "name": "ReentrancyGuardReentrantCall", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1734, + "src": "3696:28:11", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$__$returns$_t_error_$", + "typeString": "function () pure returns (error)" + } + }, + "id": 1771, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3696:30:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 1772, + "nodeType": "RevertStatement", + "src": "3689:37:11" + } + ] + } + } + ] + }, + "id": 1776, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_nonReentrantBeforeView", + "nameLocation": "3595:23:11", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1766, + "nodeType": "ParameterList", + "parameters": [], + "src": "3618:2:11" + }, + "returnParameters": { + "id": 1767, + "nodeType": "ParameterList", + "parameters": [], + "src": "3634:0:11" + }, + "scope": 1827, + "src": "3586:157:11", + "stateMutability": "view", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 1790, + "nodeType": "Block", + "src": "3788:253:11", + "statements": [ + { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1779, + "name": "_nonReentrantBeforeView", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1776, + "src": "3872:23:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$__$", + "typeString": "function () view" + } + }, + "id": 1780, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3872:25:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1781, + "nodeType": "ExpressionStatement", + "src": "3872:25:11" + }, + { + "expression": { + "id": 1788, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1782, + "name": "_reentrancyGuardStorageSlot", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1826, + "src": "3972:27:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$__$returns$_t_bytes32_$", + "typeString": "function () pure returns (bytes32)" + } + }, + "id": 1783, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3972:29:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 1784, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4002:14:11", + "memberName": "getUint256Slot", + "nodeType": "MemberAccess", + "referencedDeclaration": 2112, + "src": "3972:44:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$_t_struct$_Uint256Slot_$2059_storage_ptr_$attached_to$_t_bytes32_$", + "typeString": "function (bytes32) pure returns (struct StorageSlot.Uint256Slot storage pointer)" + } + }, + "id": 1785, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3972:46:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_struct$_Uint256Slot_$2059_storage_ptr", + "typeString": "struct StorageSlot.Uint256Slot storage pointer" + } + }, + "id": 1786, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberLocation": "4019:5:11", + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": 2058, + "src": "3972:52:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 1787, + "name": "ENTERED", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1731, + "src": "4027:7:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3972:62:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1789, + "nodeType": "ExpressionStatement", + "src": "3972:62:11" + } + ] + }, + "id": 1791, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_nonReentrantBefore", + "nameLocation": "3758:19:11", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1777, + "nodeType": "ParameterList", + "parameters": [], + "src": "3777:2:11" + }, + "returnParameters": { + "id": 1778, + "nodeType": "ParameterList", + "parameters": [], + "src": "3788:0:11" + }, + "scope": 1827, + "src": "3749:292:11", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 1802, + "nodeType": "Block", + "src": "4085:215:11", + "statements": [ + { + "expression": { + "id": 1800, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1794, + "name": "_reentrancyGuardStorageSlot", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1826, + "src": "4227:27:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$__$returns$_t_bytes32_$", + "typeString": "function () pure returns (bytes32)" + } + }, + "id": 1795, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4227:29:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 1796, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4257:14:11", + "memberName": "getUint256Slot", + "nodeType": "MemberAccess", + "referencedDeclaration": 2112, + "src": "4227:44:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$_t_struct$_Uint256Slot_$2059_storage_ptr_$attached_to$_t_bytes32_$", + "typeString": "function (bytes32) pure returns (struct StorageSlot.Uint256Slot storage pointer)" + } + }, + "id": 1797, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4227:46:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_struct$_Uint256Slot_$2059_storage_ptr", + "typeString": "struct StorageSlot.Uint256Slot storage pointer" + } + }, + "id": 1798, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberLocation": "4274:5:11", + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": 2058, + "src": "4227:52:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 1799, + "name": "NOT_ENTERED", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1728, + "src": "4282:11:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4227:66:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1801, + "nodeType": "ExpressionStatement", + "src": "4227:66:11" + } + ] + }, + "id": 1803, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_nonReentrantAfter", + "nameLocation": "4056:18:11", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1792, + "nodeType": "ParameterList", + "parameters": [], + "src": "4074:2:11" + }, + "returnParameters": { + "id": 1793, + "nodeType": "ParameterList", + "parameters": [], + "src": "4085:0:11" + }, + "scope": 1827, + "src": "4047:253:11", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 1817, + "nodeType": "Block", + "src": "4543:87:11", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1815, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1809, + "name": "_reentrancyGuardStorageSlot", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1826, + "src": "4560:27:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$__$returns$_t_bytes32_$", + "typeString": "function () pure returns (bytes32)" + } + }, + "id": 1810, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4560:29:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 1811, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4590:14:11", + "memberName": "getUint256Slot", + "nodeType": "MemberAccess", + "referencedDeclaration": 2112, + "src": "4560:44:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$_t_struct$_Uint256Slot_$2059_storage_ptr_$attached_to$_t_bytes32_$", + "typeString": "function (bytes32) pure returns (struct StorageSlot.Uint256Slot storage pointer)" + } + }, + "id": 1812, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4560:46:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_struct$_Uint256Slot_$2059_storage_ptr", + "typeString": "struct StorageSlot.Uint256Slot storage pointer" + } + }, + "id": 1813, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4607:5:11", + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": 2058, + "src": "4560:52:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 1814, + "name": "ENTERED", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1731, + "src": "4616:7:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4560:63:11", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 1808, + "id": 1816, + "nodeType": "Return", + "src": "4553:70:11" + } + ] + }, + "documentation": { + "id": 1804, + "nodeType": "StructuredDocumentation", + "src": "4306:168:11", + "text": " @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n `nonReentrant` function in the call stack." + }, + "id": 1818, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_reentrancyGuardEntered", + "nameLocation": "4488:23:11", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1805, + "nodeType": "ParameterList", + "parameters": [], + "src": "4511:2:11" + }, + "returnParameters": { + "id": 1808, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1807, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1818, + "src": "4537:4:11", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 1806, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "4537:4:11", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "4536:6:11" + }, + "scope": 1827, + "src": "4479:151:11", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1825, + "nodeType": "Block", + "src": "4715:48:11", + "statements": [ + { + "expression": { + "id": 1823, + "name": "REENTRANCY_GUARD_STORAGE", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1725, + "src": "4732:24:11", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 1822, + "id": 1824, + "nodeType": "Return", + "src": "4725:31:11" + } + ] + }, + "id": 1826, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_reentrancyGuardStorageSlot", + "nameLocation": "4645:27:11", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1819, + "nodeType": "ParameterList", + "parameters": [], + "src": "4672:2:11" + }, + "returnParameters": { + "id": 1822, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1821, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1826, + "src": "4706:7:11", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 1820, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "4706:7:11", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "4705:9:11" + }, + "scope": 1827, + "src": "4636:127:11", + "stateMutability": "pure", + "virtual": true, + "visibility": "internal" + } + ], + "scope": 1828, + "src": "1250:3515:11", + "usedErrors": [ + 1734 + ], + "usedEvents": [] + } + ], + "src": "109:4657:11" + }, + "id": 11 + }, + "@openzeppelin/contracts/utils/ShortStrings.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/ShortStrings.sol", + "exportedSymbols": { + "ShortString": [ + 1833 + ], + "ShortStrings": [ + 2044 + ], + "StorageSlot": [ + 2168 + ] + }, + "id": 2045, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1829, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "106:24:12" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/StorageSlot.sol", + "file": "./StorageSlot.sol", + "id": 1831, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 2045, + "sourceUnit": 2169, + "src": "132:46:12", + "symbolAliases": [ + { + "foreign": { + "id": 1830, + "name": "StorageSlot", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2168, + "src": "140:11:12", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "canonicalName": "ShortString", + "id": 1833, + "name": "ShortString", + "nameLocation": "353:11:12", + "nodeType": "UserDefinedValueTypeDefinition", + "src": "348:28:12", + "underlyingType": { + "id": 1832, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "368:7:12", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "ShortStrings", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 1834, + "nodeType": "StructuredDocumentation", + "src": "378:876:12", + "text": " @dev This library provides functions to convert short memory strings\n into a `ShortString` type that can be used as an immutable variable.\n Strings of arbitrary length can be optimized using this library if\n they are short enough (up to 31 bytes) by packing them with their\n length (1 byte) in a single EVM word (32 bytes). Additionally, a\n fallback mechanism can be used for every other case.\n Usage example:\n ```solidity\n contract Named {\n using ShortStrings for *;\n ShortString private immutable _name;\n string private _nameFallback;\n constructor(string memory contractName) {\n _name = contractName.toShortStringWithFallback(_nameFallback);\n }\n function name() external view returns (string memory) {\n return _name.toStringWithFallback(_nameFallback);\n }\n }\n ```" + }, + "fullyImplemented": true, + "id": 2044, + "linearizedBaseContracts": [ + 2044 + ], + "name": "ShortStrings", + "nameLocation": "1263:12:12", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": true, + "id": 1837, + "mutability": "constant", + "name": "FALLBACK_SENTINEL", + "nameLocation": "1370:17:12", + "nodeType": "VariableDeclaration", + "scope": 2044, + "src": "1345:111:12", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 1835, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1345:7:12", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": { + "hexValue": "307830303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030304646", + "id": 1836, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1390:66:12", + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "0x00000000000000000000000000000000000000000000000000000000000000FF" + }, + "visibility": "private" + }, + { + "errorSelector": "305a27a9", + "id": 1841, + "name": "StringTooLong", + "nameLocation": "1469:13:12", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 1840, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1839, + "mutability": "mutable", + "name": "str", + "nameLocation": "1490:3:12", + "nodeType": "VariableDeclaration", + "scope": 1841, + "src": "1483:10:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 1838, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1483:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "1482:12:12" + }, + "src": "1463:32:12" + }, + { + "errorSelector": "b3512b0c", + "id": 1843, + "name": "InvalidShortString", + "nameLocation": "1506:18:12", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 1842, + "nodeType": "ParameterList", + "parameters": [], + "src": "1524:2:12" + }, + "src": "1500:27:12" + }, + { + "body": { + "id": 1886, + "nodeType": "Block", + "src": "1786:210:12", + "statements": [ + { + "assignments": [ + 1853 + ], + "declarations": [ + { + "constant": false, + "id": 1853, + "mutability": "mutable", + "name": "bstr", + "nameLocation": "1809:4:12", + "nodeType": "VariableDeclaration", + "scope": 1886, + "src": "1796:17:12", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1852, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1796:5:12", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 1858, + "initialValue": { + "arguments": [ + { + "id": 1856, + "name": "str", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1846, + "src": "1822:3:12", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 1855, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1816:5:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 1854, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1816:5:12", + "typeDescriptions": {} + } + }, + "id": 1857, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1816:10:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1796:30:12" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1862, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 1859, + "name": "bstr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1853, + "src": "1840:4:12", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1860, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "1845:6:12", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "1840:11:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30783166", + "id": 1861, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1854:4:12", + "typeDescriptions": { + "typeIdentifier": "t_rational_31_by_1", + "typeString": "int_const 31" + }, + "value": "0x1f" + }, + "src": "1840:18:12", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 1868, + "nodeType": "IfStatement", + "src": "1836:74:12", + "trueBody": { + "id": 1867, + "nodeType": "Block", + "src": "1860:50:12", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "id": 1864, + "name": "str", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1846, + "src": "1895:3:12", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 1863, + "name": "StringTooLong", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1841, + "src": "1881:13:12", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_string_memory_ptr_$returns$_t_error_$", + "typeString": "function (string memory) pure returns (error)" + } + }, + "id": 1865, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1881:18:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 1866, + "nodeType": "RevertStatement", + "src": "1874:25:12" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1882, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "arguments": [ + { + "id": 1877, + "name": "bstr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1853, + "src": "1967:4:12", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 1876, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1959:7:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes32_$", + "typeString": "type(bytes32)" + }, + "typeName": { + "id": 1875, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1959:7:12", + "typeDescriptions": {} + } + }, + "id": 1878, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1959:13:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 1874, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1951:7:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 1873, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1951:7:12", + "typeDescriptions": {} + } + }, + "id": 1879, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1951:22:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "expression": { + "id": 1880, + "name": "bstr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1853, + "src": "1976:4:12", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1881, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "1981:6:12", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "1976:11:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1951:36:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1872, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1943:7:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes32_$", + "typeString": "type(bytes32)" + }, + "typeName": { + "id": 1871, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1943:7:12", + "typeDescriptions": {} + } + }, + "id": 1883, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1943:45:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "id": 1869, + "name": "ShortString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1833, + "src": "1926:11:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "type(ShortString)" + } + }, + "id": 1870, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "1938:4:12", + "memberName": "wrap", + "nodeType": "MemberAccess", + "src": "1926:16:12", + "typeDescriptions": { + "typeIdentifier": "t_function_wrap_pure$_t_bytes32_$returns$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "function (bytes32) pure returns (ShortString)" + } + }, + "id": 1884, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1926:63:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "functionReturnParameters": 1851, + "id": 1885, + "nodeType": "Return", + "src": "1919:70:12" + } + ] + }, + "documentation": { + "id": 1844, + "nodeType": "StructuredDocumentation", + "src": "1533:170:12", + "text": " @dev Encode a string of at most 31 chars into a `ShortString`.\n This will trigger a `StringTooLong` error is the input string is too long." + }, + "id": 1887, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toShortString", + "nameLocation": "1717:13:12", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1847, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1846, + "mutability": "mutable", + "name": "str", + "nameLocation": "1745:3:12", + "nodeType": "VariableDeclaration", + "scope": 1887, + "src": "1731:17:12", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 1845, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1731:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "1730:19:12" + }, + "returnParameters": { + "id": 1851, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1850, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1887, + "src": "1773:11:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + }, + "typeName": { + "id": 1849, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 1848, + "name": "ShortString", + "nameLocations": [ + "1773:11:12" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1833, + "src": "1773:11:12" + }, + "referencedDeclaration": 1833, + "src": "1773:11:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "visibility": "internal" + } + ], + "src": "1772:13:12" + }, + "scope": 2044, + "src": "1708:288:12", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1912, + "nodeType": "Block", + "src": "2154:306:12", + "statements": [ + { + "assignments": [ + 1897 + ], + "declarations": [ + { + "constant": false, + "id": 1897, + "mutability": "mutable", + "name": "len", + "nameLocation": "2172:3:12", + "nodeType": "VariableDeclaration", + "scope": 1912, + "src": "2164:11:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1896, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2164:7:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 1901, + "initialValue": { + "arguments": [ + { + "id": 1899, + "name": "sstr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1891, + "src": "2189:4:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + ], + "id": 1898, + "name": "byteLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1945, + "src": "2178:10:12", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_userDefinedValueType$_ShortString_$1833_$returns$_t_uint256_$", + "typeString": "function (ShortString) pure returns (uint256)" + } + }, + "id": 1900, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2178:16:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2164:30:12" + }, + { + "assignments": [ + 1903 + ], + "declarations": [ + { + "constant": false, + "id": 1903, + "mutability": "mutable", + "name": "str", + "nameLocation": "2296:3:12", + "nodeType": "VariableDeclaration", + "scope": 1912, + "src": "2282:17:12", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 1902, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2282:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "id": 1908, + "initialValue": { + "arguments": [ + { + "hexValue": "30783230", + "id": 1906, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2313:4:12", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "0x20" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + } + ], + "id": 1905, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "2302:10:12", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_string_memory_ptr_$", + "typeString": "function (uint256) pure returns (string memory)" + }, + "typeName": { + "id": 1904, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2306:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + } + }, + "id": 1907, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2302:16:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2282:36:12" + }, + { + "AST": { + "nativeSrc": "2353:81:12", + "nodeType": "YulBlock", + "src": "2353:81:12", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "str", + "nativeSrc": "2374:3:12", + "nodeType": "YulIdentifier", + "src": "2374:3:12" + }, + { + "name": "len", + "nativeSrc": "2379:3:12", + "nodeType": "YulIdentifier", + "src": "2379:3:12" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "2367:6:12", + "nodeType": "YulIdentifier", + "src": "2367:6:12" + }, + "nativeSrc": "2367:16:12", + "nodeType": "YulFunctionCall", + "src": "2367:16:12" + }, + "nativeSrc": "2367:16:12", + "nodeType": "YulExpressionStatement", + "src": "2367:16:12" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "str", + "nativeSrc": "2407:3:12", + "nodeType": "YulIdentifier", + "src": "2407:3:12" + }, + { + "kind": "number", + "nativeSrc": "2412:4:12", + "nodeType": "YulLiteral", + "src": "2412:4:12", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2403:3:12", + "nodeType": "YulIdentifier", + "src": "2403:3:12" + }, + "nativeSrc": "2403:14:12", + "nodeType": "YulFunctionCall", + "src": "2403:14:12" + }, + { + "name": "sstr", + "nativeSrc": "2419:4:12", + "nodeType": "YulIdentifier", + "src": "2419:4:12" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "2396:6:12", + "nodeType": "YulIdentifier", + "src": "2396:6:12" + }, + "nativeSrc": "2396:28:12", + "nodeType": "YulFunctionCall", + "src": "2396:28:12" + }, + "nativeSrc": "2396:28:12", + "nodeType": "YulExpressionStatement", + "src": "2396:28:12" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 1897, + "isOffset": false, + "isSlot": false, + "src": "2379:3:12", + "valueSize": 1 + }, + { + "declaration": 1891, + "isOffset": false, + "isSlot": false, + "src": "2419:4:12", + "valueSize": 1 + }, + { + "declaration": 1903, + "isOffset": false, + "isSlot": false, + "src": "2374:3:12", + "valueSize": 1 + }, + { + "declaration": 1903, + "isOffset": false, + "isSlot": false, + "src": "2407:3:12", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 1909, + "nodeType": "InlineAssembly", + "src": "2328:106:12" + }, + { + "expression": { + "id": 1910, + "name": "str", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1903, + "src": "2450:3:12", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 1895, + "id": 1911, + "nodeType": "Return", + "src": "2443:10:12" + } + ] + }, + "documentation": { + "id": 1888, + "nodeType": "StructuredDocumentation", + "src": "2002:73:12", + "text": " @dev Decode a `ShortString` back to a \"normal\" string." + }, + "id": 1913, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toString", + "nameLocation": "2089:8:12", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1892, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1891, + "mutability": "mutable", + "name": "sstr", + "nameLocation": "2110:4:12", + "nodeType": "VariableDeclaration", + "scope": 1913, + "src": "2098:16:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + }, + "typeName": { + "id": 1890, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 1889, + "name": "ShortString", + "nameLocations": [ + "2098:11:12" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1833, + "src": "2098:11:12" + }, + "referencedDeclaration": 1833, + "src": "2098:11:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "visibility": "internal" + } + ], + "src": "2097:18:12" + }, + "returnParameters": { + "id": 1895, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1894, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1913, + "src": "2139:13:12", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 1893, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2139:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "2138:15:12" + }, + "scope": 2044, + "src": "2080:380:12", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1944, + "nodeType": "Block", + "src": "2602:177:12", + "statements": [ + { + "assignments": [ + 1923 + ], + "declarations": [ + { + "constant": false, + "id": 1923, + "mutability": "mutable", + "name": "result", + "nameLocation": "2620:6:12", + "nodeType": "VariableDeclaration", + "scope": 1944, + "src": "2612:14:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1922, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2612:7:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 1933, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1932, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "arguments": [ + { + "id": 1928, + "name": "sstr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1917, + "src": "2656:4:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + ], + "expression": { + "id": 1926, + "name": "ShortString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1833, + "src": "2637:11:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "type(ShortString)" + } + }, + "id": 1927, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "2649:6:12", + "memberName": "unwrap", + "nodeType": "MemberAccess", + "src": "2637:18:12", + "typeDescriptions": { + "typeIdentifier": "t_function_unwrap_pure$_t_userDefinedValueType$_ShortString_$1833_$returns$_t_bytes32_$", + "typeString": "function (ShortString) pure returns (bytes32)" + } + }, + "id": 1929, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2637:24:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 1925, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2629:7:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 1924, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2629:7:12", + "typeDescriptions": {} + } + }, + "id": 1930, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2629:33:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30784646", + "id": 1931, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2665:4:12", + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "0xFF" + }, + "src": "2629:40:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2612:57:12" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1936, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1934, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1923, + "src": "2683:6:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30783166", + "id": 1935, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2692:4:12", + "typeDescriptions": { + "typeIdentifier": "t_rational_31_by_1", + "typeString": "int_const 31" + }, + "value": "0x1f" + }, + "src": "2683:13:12", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 1941, + "nodeType": "IfStatement", + "src": "2679:71:12", + "trueBody": { + "id": 1940, + "nodeType": "Block", + "src": "2698:52:12", + "statements": [ + { + "errorCall": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1937, + "name": "InvalidShortString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1843, + "src": "2719:18:12", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$__$returns$_t_error_$", + "typeString": "function () pure returns (error)" + } + }, + "id": 1938, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2719:20:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 1939, + "nodeType": "RevertStatement", + "src": "2712:27:12" + } + ] + } + }, + { + "expression": { + "id": 1942, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1923, + "src": "2766:6:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 1921, + "id": 1943, + "nodeType": "Return", + "src": "2759:13:12" + } + ] + }, + "documentation": { + "id": 1914, + "nodeType": "StructuredDocumentation", + "src": "2466:61:12", + "text": " @dev Return the length of a `ShortString`." + }, + "id": 1945, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "byteLength", + "nameLocation": "2541:10:12", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1918, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1917, + "mutability": "mutable", + "name": "sstr", + "nameLocation": "2564:4:12", + "nodeType": "VariableDeclaration", + "scope": 1945, + "src": "2552:16:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + }, + "typeName": { + "id": 1916, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 1915, + "name": "ShortString", + "nameLocations": [ + "2552:11:12" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1833, + "src": "2552:11:12" + }, + "referencedDeclaration": 1833, + "src": "2552:11:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "visibility": "internal" + } + ], + "src": "2551:18:12" + }, + "returnParameters": { + "id": 1921, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1920, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1945, + "src": "2593:7:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1919, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2593:7:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2592:9:12" + }, + "scope": 2044, + "src": "2532:247:12", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1984, + "nodeType": "Block", + "src": "3002:233:12", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1962, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "arguments": [ + { + "id": 1958, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1948, + "src": "3022:5:12", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 1957, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3016:5:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 1956, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3016:5:12", + "typeDescriptions": {} + } + }, + "id": 1959, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3016:12:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1960, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3029:6:12", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "3016:19:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "hexValue": "30783230", + "id": 1961, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3038:4:12", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "0x20" + }, + "src": "3016:26:12", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 1982, + "nodeType": "Block", + "src": "3102:127:12", + "statements": [ + { + "expression": { + "id": 1975, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "expression": { + "arguments": [ + { + "id": 1971, + "name": "store", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1950, + "src": "3142:5:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string storage pointer" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string storage pointer" + } + ], + "expression": { + "id": 1968, + "name": "StorageSlot", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2168, + "src": "3116:11:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_StorageSlot_$2168_$", + "typeString": "type(library StorageSlot)" + } + }, + "id": 1970, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3128:13:12", + "memberName": "getStringSlot", + "nodeType": "MemberAccess", + "referencedDeclaration": 2145, + "src": "3116:25:12", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_storage_ptr_$returns$_t_struct$_StringSlot_$2065_storage_ptr_$", + "typeString": "function (string storage pointer) pure returns (struct StorageSlot.StringSlot storage pointer)" + } + }, + "id": 1972, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3116:32:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_struct$_StringSlot_$2065_storage_ptr", + "typeString": "struct StorageSlot.StringSlot storage pointer" + } + }, + "id": 1973, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberLocation": "3149:5:12", + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": 2064, + "src": "3116:38:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 1974, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1948, + "src": "3157:5:12", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "src": "3116:46:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "id": 1976, + "nodeType": "ExpressionStatement", + "src": "3116:46:12" + }, + { + "expression": { + "arguments": [ + { + "id": 1979, + "name": "FALLBACK_SENTINEL", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1837, + "src": "3200:17:12", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "id": 1977, + "name": "ShortString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1833, + "src": "3183:11:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "type(ShortString)" + } + }, + "id": 1978, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "3195:4:12", + "memberName": "wrap", + "nodeType": "MemberAccess", + "src": "3183:16:12", + "typeDescriptions": { + "typeIdentifier": "t_function_wrap_pure$_t_bytes32_$returns$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "function (bytes32) pure returns (ShortString)" + } + }, + "id": 1980, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3183:35:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "functionReturnParameters": 1955, + "id": 1981, + "nodeType": "Return", + "src": "3176:42:12" + } + ] + }, + "id": 1983, + "nodeType": "IfStatement", + "src": "3012:217:12", + "trueBody": { + "id": 1967, + "nodeType": "Block", + "src": "3044:52:12", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 1964, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1948, + "src": "3079:5:12", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 1963, + "name": "toShortString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1887, + "src": "3065:13:12", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$returns$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "function (string memory) pure returns (ShortString)" + } + }, + "id": 1965, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3065:20:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "functionReturnParameters": 1955, + "id": 1966, + "nodeType": "Return", + "src": "3058:27:12" + } + ] + } + } + ] + }, + "documentation": { + "id": 1946, + "nodeType": "StructuredDocumentation", + "src": "2785:103:12", + "text": " @dev Encode a string into a `ShortString`, or write it to storage if it is too long." + }, + "id": 1985, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toShortStringWithFallback", + "nameLocation": "2902:25:12", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1951, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1948, + "mutability": "mutable", + "name": "value", + "nameLocation": "2942:5:12", + "nodeType": "VariableDeclaration", + "scope": 1985, + "src": "2928:19:12", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 1947, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2928:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1950, + "mutability": "mutable", + "name": "store", + "nameLocation": "2964:5:12", + "nodeType": "VariableDeclaration", + "scope": 1985, + "src": "2949:20:12", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + }, + "typeName": { + "id": 1949, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2949:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "2927:43:12" + }, + "returnParameters": { + "id": 1955, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1954, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1985, + "src": "2989:11:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + }, + "typeName": { + "id": 1953, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 1952, + "name": "ShortString", + "nameLocations": [ + "2989:11:12" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1833, + "src": "2989:11:12" + }, + "referencedDeclaration": 1833, + "src": "2989:11:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "visibility": "internal" + } + ], + "src": "2988:13:12" + }, + "scope": 2044, + "src": "2893:342:12", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2011, + "nodeType": "Block", + "src": "3485:158:12", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 2001, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 1998, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1989, + "src": "3518:5:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + ], + "expression": { + "id": 1996, + "name": "ShortString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1833, + "src": "3499:11:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "type(ShortString)" + } + }, + "id": 1997, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "3511:6:12", + "memberName": "unwrap", + "nodeType": "MemberAccess", + "src": "3499:18:12", + "typeDescriptions": { + "typeIdentifier": "t_function_unwrap_pure$_t_userDefinedValueType$_ShortString_$1833_$returns$_t_bytes32_$", + "typeString": "function (ShortString) pure returns (bytes32)" + } + }, + "id": 1999, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3499:25:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 2000, + "name": "FALLBACK_SENTINEL", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1837, + "src": "3528:17:12", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "3499:46:12", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 2009, + "nodeType": "Block", + "src": "3600:37:12", + "statements": [ + { + "expression": { + "id": 2007, + "name": "store", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1991, + "src": "3621:5:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string storage pointer" + } + }, + "functionReturnParameters": 1995, + "id": 2008, + "nodeType": "Return", + "src": "3614:12:12" + } + ] + }, + "id": 2010, + "nodeType": "IfStatement", + "src": "3495:142:12", + "trueBody": { + "id": 2006, + "nodeType": "Block", + "src": "3547:47:12", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2003, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1989, + "src": "3577:5:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + ], + "id": 2002, + "name": "toString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1913, + "src": "3568:8:12", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_userDefinedValueType$_ShortString_$1833_$returns$_t_string_memory_ptr_$", + "typeString": "function (ShortString) pure returns (string memory)" + } + }, + "id": 2004, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3568:15:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 1995, + "id": 2005, + "nodeType": "Return", + "src": "3561:22:12" + } + ] + } + } + ] + }, + "documentation": { + "id": 1986, + "nodeType": "StructuredDocumentation", + "src": "3241:130:12", + "text": " @dev Decode a string that was encoded to `ShortString` or written to storage using {toShortStringWithFallback}." + }, + "id": 2012, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toStringWithFallback", + "nameLocation": "3385:20:12", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1992, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1989, + "mutability": "mutable", + "name": "value", + "nameLocation": "3418:5:12", + "nodeType": "VariableDeclaration", + "scope": 2012, + "src": "3406:17:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + }, + "typeName": { + "id": 1988, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 1987, + "name": "ShortString", + "nameLocations": [ + "3406:11:12" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1833, + "src": "3406:11:12" + }, + "referencedDeclaration": 1833, + "src": "3406:11:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1991, + "mutability": "mutable", + "name": "store", + "nameLocation": "3440:5:12", + "nodeType": "VariableDeclaration", + "scope": 2012, + "src": "3425:20:12", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + }, + "typeName": { + "id": 1990, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "3425:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "3405:41:12" + }, + "returnParameters": { + "id": 1995, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1994, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2012, + "src": "3470:13:12", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 1993, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "3470:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "3469:15:12" + }, + "scope": 2044, + "src": "3376:267:12", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2042, + "nodeType": "Block", + "src": "4133:174:12", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 2028, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 2025, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2016, + "src": "4166:5:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + ], + "expression": { + "id": 2023, + "name": "ShortString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1833, + "src": "4147:11:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "type(ShortString)" + } + }, + "id": 2024, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "4159:6:12", + "memberName": "unwrap", + "nodeType": "MemberAccess", + "src": "4147:18:12", + "typeDescriptions": { + "typeIdentifier": "t_function_unwrap_pure$_t_userDefinedValueType$_ShortString_$1833_$returns$_t_bytes32_$", + "typeString": "function (ShortString) pure returns (bytes32)" + } + }, + "id": 2026, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4147:25:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 2027, + "name": "FALLBACK_SENTINEL", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1837, + "src": "4176:17:12", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "4147:46:12", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 2040, + "nodeType": "Block", + "src": "4250:51:12", + "statements": [ + { + "expression": { + "expression": { + "arguments": [ + { + "id": 2036, + "name": "store", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2018, + "src": "4277:5:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string storage pointer" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string storage pointer" + } + ], + "id": 2035, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4271:5:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2034, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4271:5:12", + "typeDescriptions": {} + } + }, + "id": 2037, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4271:12:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes storage pointer" + } + }, + "id": 2038, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4284:6:12", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "4271:19:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 2022, + "id": 2039, + "nodeType": "Return", + "src": "4264:26:12" + } + ] + }, + "id": 2041, + "nodeType": "IfStatement", + "src": "4143:158:12", + "trueBody": { + "id": 2033, + "nodeType": "Block", + "src": "4195:49:12", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2030, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2016, + "src": "4227:5:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + ], + "id": 2029, + "name": "byteLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1945, + "src": "4216:10:12", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_userDefinedValueType$_ShortString_$1833_$returns$_t_uint256_$", + "typeString": "function (ShortString) pure returns (uint256)" + } + }, + "id": 2031, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4216:17:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 2022, + "id": 2032, + "nodeType": "Return", + "src": "4209:24:12" + } + ] + } + } + ] + }, + "documentation": { + "id": 2013, + "nodeType": "StructuredDocumentation", + "src": "3649:374:12", + "text": " @dev Return the length of a string that was encoded to `ShortString` or written to storage using\n {toShortStringWithFallback}.\n WARNING: This will return the \"byte length\" of the string. This may not reflect the actual length in terms of\n actual characters as the UTF-8 encoding of a single character can span over multiple bytes." + }, + "id": 2043, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "byteLengthWithFallback", + "nameLocation": "4037:22:12", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2019, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2016, + "mutability": "mutable", + "name": "value", + "nameLocation": "4072:5:12", + "nodeType": "VariableDeclaration", + "scope": 2043, + "src": "4060:17:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + }, + "typeName": { + "id": 2015, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2014, + "name": "ShortString", + "nameLocations": [ + "4060:11:12" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1833, + "src": "4060:11:12" + }, + "referencedDeclaration": 1833, + "src": "4060:11:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2018, + "mutability": "mutable", + "name": "store", + "nameLocation": "4094:5:12", + "nodeType": "VariableDeclaration", + "scope": 2043, + "src": "4079:20:12", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2017, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "4079:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "4059:41:12" + }, + "returnParameters": { + "id": 2022, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2021, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2043, + "src": "4124:7:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2020, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4124:7:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4123:9:12" + }, + "scope": 2044, + "src": "4028:279:12", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + } + ], + "scope": 2045, + "src": "1255:3054:12", + "usedErrors": [ + 1841, + 1843 + ], + "usedEvents": [] + } + ], + "src": "106:4204:12" + }, + "id": 12 + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/StorageSlot.sol", + "exportedSymbols": { + "StorageSlot": [ + 2168 + ] + }, + "id": 2169, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 2046, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "193:24:13" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "StorageSlot", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 2047, + "nodeType": "StructuredDocumentation", + "src": "219:1187:13", + "text": " @dev Library for reading and writing primitive types to specific storage slots.\n Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n This library helps with reading and writing to such slots without the need for inline assembly.\n The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n Example usage to set ERC-1967 implementation slot:\n ```solidity\n contract ERC1967 {\n // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n function _setImplementation(address newImplementation) internal {\n require(newImplementation.code.length > 0);\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n }\n ```\n TIP: Consider using this library along with {SlotDerivation}." + }, + "fullyImplemented": true, + "id": 2168, + "linearizedBaseContracts": [ + 2168 + ], + "name": "StorageSlot", + "nameLocation": "1415:11:13", + "nodeType": "ContractDefinition", + "nodes": [ + { + "canonicalName": "StorageSlot.AddressSlot", + "id": 2050, + "members": [ + { + "constant": false, + "id": 2049, + "mutability": "mutable", + "name": "value", + "nameLocation": "1470:5:13", + "nodeType": "VariableDeclaration", + "scope": 2050, + "src": "1462:13:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 2048, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1462:7:13", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "name": "AddressSlot", + "nameLocation": "1440:11:13", + "nodeType": "StructDefinition", + "scope": 2168, + "src": "1433:49:13", + "visibility": "public" + }, + { + "canonicalName": "StorageSlot.BooleanSlot", + "id": 2053, + "members": [ + { + "constant": false, + "id": 2052, + "mutability": "mutable", + "name": "value", + "nameLocation": "1522:5:13", + "nodeType": "VariableDeclaration", + "scope": 2053, + "src": "1517:10:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2051, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "1517:4:13", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "name": "BooleanSlot", + "nameLocation": "1495:11:13", + "nodeType": "StructDefinition", + "scope": 2168, + "src": "1488:46:13", + "visibility": "public" + }, + { + "canonicalName": "StorageSlot.Bytes32Slot", + "id": 2056, + "members": [ + { + "constant": false, + "id": 2055, + "mutability": "mutable", + "name": "value", + "nameLocation": "1577:5:13", + "nodeType": "VariableDeclaration", + "scope": 2056, + "src": "1569:13:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2054, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1569:7:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "name": "Bytes32Slot", + "nameLocation": "1547:11:13", + "nodeType": "StructDefinition", + "scope": 2168, + "src": "1540:49:13", + "visibility": "public" + }, + { + "canonicalName": "StorageSlot.Uint256Slot", + "id": 2059, + "members": [ + { + "constant": false, + "id": 2058, + "mutability": "mutable", + "name": "value", + "nameLocation": "1632:5:13", + "nodeType": "VariableDeclaration", + "scope": 2059, + "src": "1624:13:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2057, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1624:7:13", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "name": "Uint256Slot", + "nameLocation": "1602:11:13", + "nodeType": "StructDefinition", + "scope": 2168, + "src": "1595:49:13", + "visibility": "public" + }, + { + "canonicalName": "StorageSlot.Int256Slot", + "id": 2062, + "members": [ + { + "constant": false, + "id": 2061, + "mutability": "mutable", + "name": "value", + "nameLocation": "1685:5:13", + "nodeType": "VariableDeclaration", + "scope": 2062, + "src": "1678:12:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 2060, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1678:6:13", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "name": "Int256Slot", + "nameLocation": "1657:10:13", + "nodeType": "StructDefinition", + "scope": 2168, + "src": "1650:47:13", + "visibility": "public" + }, + { + "canonicalName": "StorageSlot.StringSlot", + "id": 2065, + "members": [ + { + "constant": false, + "id": 2064, + "mutability": "mutable", + "name": "value", + "nameLocation": "1738:5:13", + "nodeType": "VariableDeclaration", + "scope": 2065, + "src": "1731:12:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2063, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1731:6:13", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "name": "StringSlot", + "nameLocation": "1710:10:13", + "nodeType": "StructDefinition", + "scope": 2168, + "src": "1703:47:13", + "visibility": "public" + }, + { + "canonicalName": "StorageSlot.BytesSlot", + "id": 2068, + "members": [ + { + "constant": false, + "id": 2067, + "mutability": "mutable", + "name": "value", + "nameLocation": "1789:5:13", + "nodeType": "VariableDeclaration", + "scope": 2068, + "src": "1783:11:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2066, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1783:5:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "name": "BytesSlot", + "nameLocation": "1763:9:13", + "nodeType": "StructDefinition", + "scope": 2168, + "src": "1756:45:13", + "visibility": "public" + }, + { + "body": { + "id": 2078, + "nodeType": "Block", + "src": "1983:79:13", + "statements": [ + { + "AST": { + "nativeSrc": "2018:38:13", + "nodeType": "YulBlock", + "src": "2018:38:13", + "statements": [ + { + "nativeSrc": "2032:14:13", + "nodeType": "YulAssignment", + "src": "2032:14:13", + "value": { + "name": "slot", + "nativeSrc": "2042:4:13", + "nodeType": "YulIdentifier", + "src": "2042:4:13" + }, + "variableNames": [ + { + "name": "r.slot", + "nativeSrc": "2032:6:13", + "nodeType": "YulIdentifier", + "src": "2032:6:13" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2075, + "isOffset": false, + "isSlot": true, + "src": "2032:6:13", + "suffix": "slot", + "valueSize": 1 + }, + { + "declaration": 2071, + "isOffset": false, + "isSlot": false, + "src": "2042:4:13", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2077, + "nodeType": "InlineAssembly", + "src": "1993:63:13" + } + ] + }, + "documentation": { + "id": 2069, + "nodeType": "StructuredDocumentation", + "src": "1807:87:13", + "text": " @dev Returns an `AddressSlot` with member `value` located at `slot`." + }, + "id": 2079, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getAddressSlot", + "nameLocation": "1908:14:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2072, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2071, + "mutability": "mutable", + "name": "slot", + "nameLocation": "1931:4:13", + "nodeType": "VariableDeclaration", + "scope": 2079, + "src": "1923:12:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2070, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1923:7:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "1922:14:13" + }, + "returnParameters": { + "id": 2076, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2075, + "mutability": "mutable", + "name": "r", + "nameLocation": "1980:1:13", + "nodeType": "VariableDeclaration", + "scope": 2079, + "src": "1960:21:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_AddressSlot_$2050_storage_ptr", + "typeString": "struct StorageSlot.AddressSlot" + }, + "typeName": { + "id": 2074, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2073, + "name": "AddressSlot", + "nameLocations": [ + "1960:11:13" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2050, + "src": "1960:11:13" + }, + "referencedDeclaration": 2050, + "src": "1960:11:13", + "typeDescriptions": { + "typeIdentifier": "t_struct$_AddressSlot_$2050_storage_ptr", + "typeString": "struct StorageSlot.AddressSlot" + } + }, + "visibility": "internal" + } + ], + "src": "1959:23:13" + }, + "scope": 2168, + "src": "1899:163:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2089, + "nodeType": "Block", + "src": "2243:79:13", + "statements": [ + { + "AST": { + "nativeSrc": "2278:38:13", + "nodeType": "YulBlock", + "src": "2278:38:13", + "statements": [ + { + "nativeSrc": "2292:14:13", + "nodeType": "YulAssignment", + "src": "2292:14:13", + "value": { + "name": "slot", + "nativeSrc": "2302:4:13", + "nodeType": "YulIdentifier", + "src": "2302:4:13" + }, + "variableNames": [ + { + "name": "r.slot", + "nativeSrc": "2292:6:13", + "nodeType": "YulIdentifier", + "src": "2292:6:13" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2086, + "isOffset": false, + "isSlot": true, + "src": "2292:6:13", + "suffix": "slot", + "valueSize": 1 + }, + { + "declaration": 2082, + "isOffset": false, + "isSlot": false, + "src": "2302:4:13", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2088, + "nodeType": "InlineAssembly", + "src": "2253:63:13" + } + ] + }, + "documentation": { + "id": 2080, + "nodeType": "StructuredDocumentation", + "src": "2068:86:13", + "text": " @dev Returns a `BooleanSlot` with member `value` located at `slot`." + }, + "id": 2090, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getBooleanSlot", + "nameLocation": "2168:14:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2083, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2082, + "mutability": "mutable", + "name": "slot", + "nameLocation": "2191:4:13", + "nodeType": "VariableDeclaration", + "scope": 2090, + "src": "2183:12:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2081, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2183:7:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "2182:14:13" + }, + "returnParameters": { + "id": 2087, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2086, + "mutability": "mutable", + "name": "r", + "nameLocation": "2240:1:13", + "nodeType": "VariableDeclaration", + "scope": 2090, + "src": "2220:21:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_BooleanSlot_$2053_storage_ptr", + "typeString": "struct StorageSlot.BooleanSlot" + }, + "typeName": { + "id": 2085, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2084, + "name": "BooleanSlot", + "nameLocations": [ + "2220:11:13" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2053, + "src": "2220:11:13" + }, + "referencedDeclaration": 2053, + "src": "2220:11:13", + "typeDescriptions": { + "typeIdentifier": "t_struct$_BooleanSlot_$2053_storage_ptr", + "typeString": "struct StorageSlot.BooleanSlot" + } + }, + "visibility": "internal" + } + ], + "src": "2219:23:13" + }, + "scope": 2168, + "src": "2159:163:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2100, + "nodeType": "Block", + "src": "2503:79:13", + "statements": [ + { + "AST": { + "nativeSrc": "2538:38:13", + "nodeType": "YulBlock", + "src": "2538:38:13", + "statements": [ + { + "nativeSrc": "2552:14:13", + "nodeType": "YulAssignment", + "src": "2552:14:13", + "value": { + "name": "slot", + "nativeSrc": "2562:4:13", + "nodeType": "YulIdentifier", + "src": "2562:4:13" + }, + "variableNames": [ + { + "name": "r.slot", + "nativeSrc": "2552:6:13", + "nodeType": "YulIdentifier", + "src": "2552:6:13" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2097, + "isOffset": false, + "isSlot": true, + "src": "2552:6:13", + "suffix": "slot", + "valueSize": 1 + }, + { + "declaration": 2093, + "isOffset": false, + "isSlot": false, + "src": "2562:4:13", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2099, + "nodeType": "InlineAssembly", + "src": "2513:63:13" + } + ] + }, + "documentation": { + "id": 2091, + "nodeType": "StructuredDocumentation", + "src": "2328:86:13", + "text": " @dev Returns a `Bytes32Slot` with member `value` located at `slot`." + }, + "id": 2101, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getBytes32Slot", + "nameLocation": "2428:14:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2094, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2093, + "mutability": "mutable", + "name": "slot", + "nameLocation": "2451:4:13", + "nodeType": "VariableDeclaration", + "scope": 2101, + "src": "2443:12:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2092, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2443:7:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "2442:14:13" + }, + "returnParameters": { + "id": 2098, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2097, + "mutability": "mutable", + "name": "r", + "nameLocation": "2500:1:13", + "nodeType": "VariableDeclaration", + "scope": 2101, + "src": "2480:21:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Bytes32Slot_$2056_storage_ptr", + "typeString": "struct StorageSlot.Bytes32Slot" + }, + "typeName": { + "id": 2096, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2095, + "name": "Bytes32Slot", + "nameLocations": [ + "2480:11:13" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2056, + "src": "2480:11:13" + }, + "referencedDeclaration": 2056, + "src": "2480:11:13", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Bytes32Slot_$2056_storage_ptr", + "typeString": "struct StorageSlot.Bytes32Slot" + } + }, + "visibility": "internal" + } + ], + "src": "2479:23:13" + }, + "scope": 2168, + "src": "2419:163:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2111, + "nodeType": "Block", + "src": "2763:79:13", + "statements": [ + { + "AST": { + "nativeSrc": "2798:38:13", + "nodeType": "YulBlock", + "src": "2798:38:13", + "statements": [ + { + "nativeSrc": "2812:14:13", + "nodeType": "YulAssignment", + "src": "2812:14:13", + "value": { + "name": "slot", + "nativeSrc": "2822:4:13", + "nodeType": "YulIdentifier", + "src": "2822:4:13" + }, + "variableNames": [ + { + "name": "r.slot", + "nativeSrc": "2812:6:13", + "nodeType": "YulIdentifier", + "src": "2812:6:13" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2108, + "isOffset": false, + "isSlot": true, + "src": "2812:6:13", + "suffix": "slot", + "valueSize": 1 + }, + { + "declaration": 2104, + "isOffset": false, + "isSlot": false, + "src": "2822:4:13", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2110, + "nodeType": "InlineAssembly", + "src": "2773:63:13" + } + ] + }, + "documentation": { + "id": 2102, + "nodeType": "StructuredDocumentation", + "src": "2588:86:13", + "text": " @dev Returns a `Uint256Slot` with member `value` located at `slot`." + }, + "id": 2112, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getUint256Slot", + "nameLocation": "2688:14:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2105, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2104, + "mutability": "mutable", + "name": "slot", + "nameLocation": "2711:4:13", + "nodeType": "VariableDeclaration", + "scope": 2112, + "src": "2703:12:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2103, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2703:7:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "2702:14:13" + }, + "returnParameters": { + "id": 2109, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2108, + "mutability": "mutable", + "name": "r", + "nameLocation": "2760:1:13", + "nodeType": "VariableDeclaration", + "scope": 2112, + "src": "2740:21:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Uint256Slot_$2059_storage_ptr", + "typeString": "struct StorageSlot.Uint256Slot" + }, + "typeName": { + "id": 2107, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2106, + "name": "Uint256Slot", + "nameLocations": [ + "2740:11:13" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2059, + "src": "2740:11:13" + }, + "referencedDeclaration": 2059, + "src": "2740:11:13", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Uint256Slot_$2059_storage_ptr", + "typeString": "struct StorageSlot.Uint256Slot" + } + }, + "visibility": "internal" + } + ], + "src": "2739:23:13" + }, + "scope": 2168, + "src": "2679:163:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2122, + "nodeType": "Block", + "src": "3020:79:13", + "statements": [ + { + "AST": { + "nativeSrc": "3055:38:13", + "nodeType": "YulBlock", + "src": "3055:38:13", + "statements": [ + { + "nativeSrc": "3069:14:13", + "nodeType": "YulAssignment", + "src": "3069:14:13", + "value": { + "name": "slot", + "nativeSrc": "3079:4:13", + "nodeType": "YulIdentifier", + "src": "3079:4:13" + }, + "variableNames": [ + { + "name": "r.slot", + "nativeSrc": "3069:6:13", + "nodeType": "YulIdentifier", + "src": "3069:6:13" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2119, + "isOffset": false, + "isSlot": true, + "src": "3069:6:13", + "suffix": "slot", + "valueSize": 1 + }, + { + "declaration": 2115, + "isOffset": false, + "isSlot": false, + "src": "3079:4:13", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2121, + "nodeType": "InlineAssembly", + "src": "3030:63:13" + } + ] + }, + "documentation": { + "id": 2113, + "nodeType": "StructuredDocumentation", + "src": "2848:85:13", + "text": " @dev Returns a `Int256Slot` with member `value` located at `slot`." + }, + "id": 2123, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getInt256Slot", + "nameLocation": "2947:13:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2116, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2115, + "mutability": "mutable", + "name": "slot", + "nameLocation": "2969:4:13", + "nodeType": "VariableDeclaration", + "scope": 2123, + "src": "2961:12:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2114, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2961:7:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "2960:14:13" + }, + "returnParameters": { + "id": 2120, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2119, + "mutability": "mutable", + "name": "r", + "nameLocation": "3017:1:13", + "nodeType": "VariableDeclaration", + "scope": 2123, + "src": "2998:20:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Int256Slot_$2062_storage_ptr", + "typeString": "struct StorageSlot.Int256Slot" + }, + "typeName": { + "id": 2118, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2117, + "name": "Int256Slot", + "nameLocations": [ + "2998:10:13" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2062, + "src": "2998:10:13" + }, + "referencedDeclaration": 2062, + "src": "2998:10:13", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Int256Slot_$2062_storage_ptr", + "typeString": "struct StorageSlot.Int256Slot" + } + }, + "visibility": "internal" + } + ], + "src": "2997:22:13" + }, + "scope": 2168, + "src": "2938:161:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2133, + "nodeType": "Block", + "src": "3277:79:13", + "statements": [ + { + "AST": { + "nativeSrc": "3312:38:13", + "nodeType": "YulBlock", + "src": "3312:38:13", + "statements": [ + { + "nativeSrc": "3326:14:13", + "nodeType": "YulAssignment", + "src": "3326:14:13", + "value": { + "name": "slot", + "nativeSrc": "3336:4:13", + "nodeType": "YulIdentifier", + "src": "3336:4:13" + }, + "variableNames": [ + { + "name": "r.slot", + "nativeSrc": "3326:6:13", + "nodeType": "YulIdentifier", + "src": "3326:6:13" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2130, + "isOffset": false, + "isSlot": true, + "src": "3326:6:13", + "suffix": "slot", + "valueSize": 1 + }, + { + "declaration": 2126, + "isOffset": false, + "isSlot": false, + "src": "3336:4:13", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2132, + "nodeType": "InlineAssembly", + "src": "3287:63:13" + } + ] + }, + "documentation": { + "id": 2124, + "nodeType": "StructuredDocumentation", + "src": "3105:85:13", + "text": " @dev Returns a `StringSlot` with member `value` located at `slot`." + }, + "id": 2134, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getStringSlot", + "nameLocation": "3204:13:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2127, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2126, + "mutability": "mutable", + "name": "slot", + "nameLocation": "3226:4:13", + "nodeType": "VariableDeclaration", + "scope": 2134, + "src": "3218:12:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2125, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3218:7:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "3217:14:13" + }, + "returnParameters": { + "id": 2131, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2130, + "mutability": "mutable", + "name": "r", + "nameLocation": "3274:1:13", + "nodeType": "VariableDeclaration", + "scope": 2134, + "src": "3255:20:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_StringSlot_$2065_storage_ptr", + "typeString": "struct StorageSlot.StringSlot" + }, + "typeName": { + "id": 2129, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2128, + "name": "StringSlot", + "nameLocations": [ + "3255:10:13" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2065, + "src": "3255:10:13" + }, + "referencedDeclaration": 2065, + "src": "3255:10:13", + "typeDescriptions": { + "typeIdentifier": "t_struct$_StringSlot_$2065_storage_ptr", + "typeString": "struct StorageSlot.StringSlot" + } + }, + "visibility": "internal" + } + ], + "src": "3254:22:13" + }, + "scope": 2168, + "src": "3195:161:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2144, + "nodeType": "Block", + "src": "3558:85:13", + "statements": [ + { + "AST": { + "nativeSrc": "3593:44:13", + "nodeType": "YulBlock", + "src": "3593:44:13", + "statements": [ + { + "nativeSrc": "3607:20:13", + "nodeType": "YulAssignment", + "src": "3607:20:13", + "value": { + "name": "store.slot", + "nativeSrc": "3617:10:13", + "nodeType": "YulIdentifier", + "src": "3617:10:13" + }, + "variableNames": [ + { + "name": "r.slot", + "nativeSrc": "3607:6:13", + "nodeType": "YulIdentifier", + "src": "3607:6:13" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2141, + "isOffset": false, + "isSlot": true, + "src": "3607:6:13", + "suffix": "slot", + "valueSize": 1 + }, + { + "declaration": 2137, + "isOffset": false, + "isSlot": true, + "src": "3617:10:13", + "suffix": "slot", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2143, + "nodeType": "InlineAssembly", + "src": "3568:69:13" + } + ] + }, + "documentation": { + "id": 2135, + "nodeType": "StructuredDocumentation", + "src": "3362:101:13", + "text": " @dev Returns an `StringSlot` representation of the string storage pointer `store`." + }, + "id": 2145, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getStringSlot", + "nameLocation": "3477:13:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2138, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2137, + "mutability": "mutable", + "name": "store", + "nameLocation": "3506:5:13", + "nodeType": "VariableDeclaration", + "scope": 2145, + "src": "3491:20:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2136, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "3491:6:13", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "3490:22:13" + }, + "returnParameters": { + "id": 2142, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2141, + "mutability": "mutable", + "name": "r", + "nameLocation": "3555:1:13", + "nodeType": "VariableDeclaration", + "scope": 2145, + "src": "3536:20:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_StringSlot_$2065_storage_ptr", + "typeString": "struct StorageSlot.StringSlot" + }, + "typeName": { + "id": 2140, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2139, + "name": "StringSlot", + "nameLocations": [ + "3536:10:13" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2065, + "src": "3536:10:13" + }, + "referencedDeclaration": 2065, + "src": "3536:10:13", + "typeDescriptions": { + "typeIdentifier": "t_struct$_StringSlot_$2065_storage_ptr", + "typeString": "struct StorageSlot.StringSlot" + } + }, + "visibility": "internal" + } + ], + "src": "3535:22:13" + }, + "scope": 2168, + "src": "3468:175:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2155, + "nodeType": "Block", + "src": "3818:79:13", + "statements": [ + { + "AST": { + "nativeSrc": "3853:38:13", + "nodeType": "YulBlock", + "src": "3853:38:13", + "statements": [ + { + "nativeSrc": "3867:14:13", + "nodeType": "YulAssignment", + "src": "3867:14:13", + "value": { + "name": "slot", + "nativeSrc": "3877:4:13", + "nodeType": "YulIdentifier", + "src": "3877:4:13" + }, + "variableNames": [ + { + "name": "r.slot", + "nativeSrc": "3867:6:13", + "nodeType": "YulIdentifier", + "src": "3867:6:13" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2152, + "isOffset": false, + "isSlot": true, + "src": "3867:6:13", + "suffix": "slot", + "valueSize": 1 + }, + { + "declaration": 2148, + "isOffset": false, + "isSlot": false, + "src": "3877:4:13", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2154, + "nodeType": "InlineAssembly", + "src": "3828:63:13" + } + ] + }, + "documentation": { + "id": 2146, + "nodeType": "StructuredDocumentation", + "src": "3649:84:13", + "text": " @dev Returns a `BytesSlot` with member `value` located at `slot`." + }, + "id": 2156, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getBytesSlot", + "nameLocation": "3747:12:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2149, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2148, + "mutability": "mutable", + "name": "slot", + "nameLocation": "3768:4:13", + "nodeType": "VariableDeclaration", + "scope": 2156, + "src": "3760:12:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2147, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3760:7:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "3759:14:13" + }, + "returnParameters": { + "id": 2153, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2152, + "mutability": "mutable", + "name": "r", + "nameLocation": "3815:1:13", + "nodeType": "VariableDeclaration", + "scope": 2156, + "src": "3797:19:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_BytesSlot_$2068_storage_ptr", + "typeString": "struct StorageSlot.BytesSlot" + }, + "typeName": { + "id": 2151, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2150, + "name": "BytesSlot", + "nameLocations": [ + "3797:9:13" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2068, + "src": "3797:9:13" + }, + "referencedDeclaration": 2068, + "src": "3797:9:13", + "typeDescriptions": { + "typeIdentifier": "t_struct$_BytesSlot_$2068_storage_ptr", + "typeString": "struct StorageSlot.BytesSlot" + } + }, + "visibility": "internal" + } + ], + "src": "3796:21:13" + }, + "scope": 2168, + "src": "3738:159:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2166, + "nodeType": "Block", + "src": "4094:85:13", + "statements": [ + { + "AST": { + "nativeSrc": "4129:44:13", + "nodeType": "YulBlock", + "src": "4129:44:13", + "statements": [ + { + "nativeSrc": "4143:20:13", + "nodeType": "YulAssignment", + "src": "4143:20:13", + "value": { + "name": "store.slot", + "nativeSrc": "4153:10:13", + "nodeType": "YulIdentifier", + "src": "4153:10:13" + }, + "variableNames": [ + { + "name": "r.slot", + "nativeSrc": "4143:6:13", + "nodeType": "YulIdentifier", + "src": "4143:6:13" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2163, + "isOffset": false, + "isSlot": true, + "src": "4143:6:13", + "suffix": "slot", + "valueSize": 1 + }, + { + "declaration": 2159, + "isOffset": false, + "isSlot": true, + "src": "4153:10:13", + "suffix": "slot", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2165, + "nodeType": "InlineAssembly", + "src": "4104:69:13" + } + ] + }, + "documentation": { + "id": 2157, + "nodeType": "StructuredDocumentation", + "src": "3903:99:13", + "text": " @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`." + }, + "id": 2167, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getBytesSlot", + "nameLocation": "4016:12:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2160, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2159, + "mutability": "mutable", + "name": "store", + "nameLocation": "4043:5:13", + "nodeType": "VariableDeclaration", + "scope": 2167, + "src": "4029:19:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2158, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4029:5:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "4028:21:13" + }, + "returnParameters": { + "id": 2164, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2163, + "mutability": "mutable", + "name": "r", + "nameLocation": "4091:1:13", + "nodeType": "VariableDeclaration", + "scope": 2167, + "src": "4073:19:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_BytesSlot_$2068_storage_ptr", + "typeString": "struct StorageSlot.BytesSlot" + }, + "typeName": { + "id": 2162, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2161, + "name": "BytesSlot", + "nameLocations": [ + "4073:9:13" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2068, + "src": "4073:9:13" + }, + "referencedDeclaration": 2068, + "src": "4073:9:13", + "typeDescriptions": { + "typeIdentifier": "t_struct$_BytesSlot_$2068_storage_ptr", + "typeString": "struct StorageSlot.BytesSlot" + } + }, + "visibility": "internal" + } + ], + "src": "4072:21:13" + }, + "scope": 2168, + "src": "4007:172:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + } + ], + "scope": 2169, + "src": "1407:2774:13", + "usedErrors": [], + "usedEvents": [] + } + ], + "src": "193:3989:13" + }, + "id": 13 + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/Strings.sol", + "exportedSymbols": { + "Bytes": [ + 1632 + ], + "Math": [ + 6204 + ], + "SafeCast": [ + 7969 + ], + "SignedMath": [ + 8113 + ], + "Strings": [ + 3678 + ] + }, + "id": 3679, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 2170, + "literals": [ + "solidity", + "^", + "0.8", + ".24" + ], + "nodeType": "PragmaDirective", + "src": "101:24:14" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/math/Math.sol", + "file": "./math/Math.sol", + "id": 2172, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3679, + "sourceUnit": 6205, + "src": "127:37:14", + "symbolAliases": [ + { + "foreign": { + "id": 2171, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "135:4:14", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/math/SafeCast.sol", + "file": "./math/SafeCast.sol", + "id": 2174, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3679, + "sourceUnit": 7970, + "src": "165:45:14", + "symbolAliases": [ + { + "foreign": { + "id": 2173, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "173:8:14", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/math/SignedMath.sol", + "file": "./math/SignedMath.sol", + "id": 2176, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3679, + "sourceUnit": 8114, + "src": "211:49:14", + "symbolAliases": [ + { + "foreign": { + "id": 2175, + "name": "SignedMath", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8113, + "src": "219:10:14", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/Bytes.sol", + "file": "./Bytes.sol", + "id": 2178, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3679, + "sourceUnit": 1633, + "src": "261:34:14", + "symbolAliases": [ + { + "foreign": { + "id": 2177, + "name": "Bytes", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1632, + "src": "269:5:14", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "Strings", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 2179, + "nodeType": "StructuredDocumentation", + "src": "297:34:14", + "text": " @dev String operations." + }, + "fullyImplemented": true, + "id": 3678, + "linearizedBaseContracts": [ + 3678 + ], + "name": "Strings", + "nameLocation": "340:7:14", + "nodeType": "ContractDefinition", + "nodes": [ + { + "global": false, + "id": 2181, + "libraryName": { + "id": 2180, + "name": "SafeCast", + "nameLocations": [ + "360:8:14" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 7969, + "src": "360:8:14" + }, + "nodeType": "UsingForDirective", + "src": "354:21:14" + }, + { + "constant": true, + "id": 2184, + "mutability": "constant", + "name": "HEX_DIGITS", + "nameLocation": "406:10:14", + "nodeType": "VariableDeclaration", + "scope": 3678, + "src": "381:56:14", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "typeName": { + "id": 2182, + "name": "bytes16", + "nodeType": "ElementaryTypeName", + "src": "381:7:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "value": { + "hexValue": "30313233343536373839616263646566", + "id": 2183, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "419:18:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_cb29997ed99ead0db59ce4d12b7d3723198c827273e5796737c926d78019c39f", + "typeString": "literal_string \"0123456789abcdef\"" + }, + "value": "0123456789abcdef" + }, + "visibility": "private" + }, + { + "constant": true, + "id": 2187, + "mutability": "constant", + "name": "ADDRESS_LENGTH", + "nameLocation": "466:14:14", + "nodeType": "VariableDeclaration", + "scope": 3678, + "src": "443:42:14", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 2185, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "443:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "value": { + "hexValue": "3230", + "id": 2186, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "483:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_20_by_1", + "typeString": "int_const 20" + }, + "value": "20" + }, + "visibility": "private" + }, + { + "constant": true, + "id": 2200, + "mutability": "constant", + "name": "SPECIAL_CHARS_LOOKUP", + "nameLocation": "516:20:14", + "nodeType": "VariableDeclaration", + "scope": 3678, + "src": "491:210:14", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2188, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "491:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "commonType": { + "typeIdentifier": "t_rational_4951760157141521121071333375_by_1", + "typeString": "int_const 4951760157141521121071333375" + }, + "id": 2199, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_rational_21474836479_by_1", + "typeString": "int_const 21474836479" + }, + "id": 2194, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "30786666666666666666", + "id": 2189, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "547:10:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_4294967295_by_1", + "typeString": "int_const 4294967295" + }, + "value": "0xffffffff" + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_rational_17179869184_by_1", + "typeString": "int_const 17179869184" + }, + "id": 2192, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 2190, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "649:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "30783232", + "id": 2191, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "654:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_34_by_1", + "typeString": "int_const 34" + }, + "value": "0x22" + }, + "src": "649:9:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_17179869184_by_1", + "typeString": "int_const 17179869184" + } + } + ], + "id": 2193, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "648:11:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_17179869184_by_1", + "typeString": "int_const 17179869184" + } + }, + "src": "547:112:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_21474836479_by_1", + "typeString": "int_const 21474836479" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_rational_4951760157141521099596496896_by_1", + "typeString": "int_const 4951760157141521099596496896" + }, + "id": 2197, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 2195, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "691:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "30783563", + "id": 2196, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "696:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_92_by_1", + "typeString": "int_const 92" + }, + "value": "0x5c" + }, + "src": "691:9:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_4951760157141521099596496896_by_1", + "typeString": "int_const 4951760157141521099596496896" + } + } + ], + "id": 2198, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "690:11:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_4951760157141521099596496896_by_1", + "typeString": "int_const 4951760157141521099596496896" + } + }, + "src": "547:154:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_4951760157141521121071333375_by_1", + "typeString": "int_const 4951760157141521121071333375" + } + }, + "visibility": "private" + }, + { + "documentation": { + "id": 2201, + "nodeType": "StructuredDocumentation", + "src": "721:81:14", + "text": " @dev The `value` string doesn't fit in the specified `length`." + }, + "errorSelector": "e22e27eb", + "id": 2207, + "name": "StringsInsufficientHexLength", + "nameLocation": "813:28:14", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 2206, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2203, + "mutability": "mutable", + "name": "value", + "nameLocation": "850:5:14", + "nodeType": "VariableDeclaration", + "scope": 2207, + "src": "842:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2202, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "842:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2205, + "mutability": "mutable", + "name": "length", + "nameLocation": "865:6:14", + "nodeType": "VariableDeclaration", + "scope": 2207, + "src": "857:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2204, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "857:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "841:31:14" + }, + "src": "807:66:14" + }, + { + "documentation": { + "id": 2208, + "nodeType": "StructuredDocumentation", + "src": "879:108:14", + "text": " @dev The string being parsed contains characters that are not in scope of the given base." + }, + "errorSelector": "94e2737e", + "id": 2210, + "name": "StringsInvalidChar", + "nameLocation": "998:18:14", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 2209, + "nodeType": "ParameterList", + "parameters": [], + "src": "1016:2:14" + }, + "src": "992:27:14" + }, + { + "documentation": { + "id": 2211, + "nodeType": "StructuredDocumentation", + "src": "1025:84:14", + "text": " @dev The string being parsed is not a properly formatted address." + }, + "errorSelector": "1d15ae44", + "id": 2213, + "name": "StringsInvalidAddressFormat", + "nameLocation": "1120:27:14", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 2212, + "nodeType": "ParameterList", + "parameters": [], + "src": "1147:2:14" + }, + "src": "1114:36:14" + }, + { + "body": { + "id": 2260, + "nodeType": "Block", + "src": "1322:563:14", + "statements": [ + { + "id": 2259, + "nodeType": "UncheckedBlock", + "src": "1332:547:14", + "statements": [ + { + "assignments": [ + 2222 + ], + "declarations": [ + { + "constant": false, + "id": 2222, + "mutability": "mutable", + "name": "length", + "nameLocation": "1364:6:14", + "nodeType": "VariableDeclaration", + "scope": 2259, + "src": "1356:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2221, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1356:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2229, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2228, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 2225, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2216, + "src": "1384:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 2223, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "1373:4:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 2224, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "1378:5:14", + "memberName": "log10", + "nodeType": "MemberAccess", + "referencedDeclaration": 6015, + "src": "1373:10:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256) pure returns (uint256)" + } + }, + "id": 2226, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1373:17:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "31", + "id": 2227, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1393:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "1373:21:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1356:38:14" + }, + { + "assignments": [ + 2231 + ], + "declarations": [ + { + "constant": false, + "id": 2231, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "1422:6:14", + "nodeType": "VariableDeclaration", + "scope": 2259, + "src": "1408:20:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2230, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1408:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "id": 2236, + "initialValue": { + "arguments": [ + { + "id": 2234, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2222, + "src": "1442:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2233, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "1431:10:14", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_string_memory_ptr_$", + "typeString": "function (uint256) pure returns (string memory)" + }, + "typeName": { + "id": 2232, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1435:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + } + }, + "id": 2235, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1431:18:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1408:41:14" + }, + { + "assignments": [ + 2238 + ], + "declarations": [ + { + "constant": false, + "id": 2238, + "mutability": "mutable", + "name": "ptr", + "nameLocation": "1471:3:14", + "nodeType": "VariableDeclaration", + "scope": 2259, + "src": "1463:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2237, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1463:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2239, + "nodeType": "VariableDeclarationStatement", + "src": "1463:11:14" + }, + { + "AST": { + "nativeSrc": "1513:69:14", + "nodeType": "YulBlock", + "src": "1513:69:14", + "statements": [ + { + "nativeSrc": "1531:37:14", + "nodeType": "YulAssignment", + "src": "1531:37:14", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "1546:6:14", + "nodeType": "YulIdentifier", + "src": "1546:6:14" + }, + { + "kind": "number", + "nativeSrc": "1554:4:14", + "nodeType": "YulLiteral", + "src": "1554:4:14", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1542:3:14", + "nodeType": "YulIdentifier", + "src": "1542:3:14" + }, + "nativeSrc": "1542:17:14", + "nodeType": "YulFunctionCall", + "src": "1542:17:14" + }, + { + "name": "length", + "nativeSrc": "1561:6:14", + "nodeType": "YulIdentifier", + "src": "1561:6:14" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1538:3:14", + "nodeType": "YulIdentifier", + "src": "1538:3:14" + }, + "nativeSrc": "1538:30:14", + "nodeType": "YulFunctionCall", + "src": "1538:30:14" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "1531:3:14", + "nodeType": "YulIdentifier", + "src": "1531:3:14" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2231, + "isOffset": false, + "isSlot": false, + "src": "1546:6:14", + "valueSize": 1 + }, + { + "declaration": 2222, + "isOffset": false, + "isSlot": false, + "src": "1561:6:14", + "valueSize": 1 + }, + { + "declaration": 2238, + "isOffset": false, + "isSlot": false, + "src": "1531:3:14", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2240, + "nodeType": "InlineAssembly", + "src": "1488:94:14" + }, + { + "body": { + "id": 2255, + "nodeType": "Block", + "src": "1608:234:14", + "statements": [ + { + "expression": { + "id": 2243, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "--", + "prefix": false, + "src": "1626:5:14", + "subExpression": { + "id": 2242, + "name": "ptr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2238, + "src": "1626:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2244, + "nodeType": "ExpressionStatement", + "src": "1626:5:14" + }, + { + "AST": { + "nativeSrc": "1674:86:14", + "nodeType": "YulBlock", + "src": "1674:86:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "1704:3:14", + "nodeType": "YulIdentifier", + "src": "1704:3:14" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nativeSrc": "1718:5:14", + "nodeType": "YulIdentifier", + "src": "1718:5:14" + }, + { + "kind": "number", + "nativeSrc": "1725:2:14", + "nodeType": "YulLiteral", + "src": "1725:2:14", + "type": "", + "value": "10" + } + ], + "functionName": { + "name": "mod", + "nativeSrc": "1714:3:14", + "nodeType": "YulIdentifier", + "src": "1714:3:14" + }, + "nativeSrc": "1714:14:14", + "nodeType": "YulFunctionCall", + "src": "1714:14:14" + }, + { + "name": "HEX_DIGITS", + "nativeSrc": "1730:10:14", + "nodeType": "YulIdentifier", + "src": "1730:10:14" + } + ], + "functionName": { + "name": "byte", + "nativeSrc": "1709:4:14", + "nodeType": "YulIdentifier", + "src": "1709:4:14" + }, + "nativeSrc": "1709:32:14", + "nodeType": "YulFunctionCall", + "src": "1709:32:14" + } + ], + "functionName": { + "name": "mstore8", + "nativeSrc": "1696:7:14", + "nodeType": "YulIdentifier", + "src": "1696:7:14" + }, + "nativeSrc": "1696:46:14", + "nodeType": "YulFunctionCall", + "src": "1696:46:14" + }, + "nativeSrc": "1696:46:14", + "nodeType": "YulExpressionStatement", + "src": "1696:46:14" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2184, + "isOffset": false, + "isSlot": false, + "src": "1730:10:14", + "valueSize": 1 + }, + { + "declaration": 2238, + "isOffset": false, + "isSlot": false, + "src": "1704:3:14", + "valueSize": 1 + }, + { + "declaration": 2216, + "isOffset": false, + "isSlot": false, + "src": "1718:5:14", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2245, + "nodeType": "InlineAssembly", + "src": "1649:111:14" + }, + { + "expression": { + "id": 2248, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 2246, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2216, + "src": "1777:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "/=", + "rightHandSide": { + "hexValue": "3130", + "id": 2247, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1786:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "src": "1777:11:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2249, + "nodeType": "ExpressionStatement", + "src": "1777:11:14" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2252, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2250, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2216, + "src": "1810:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 2251, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1819:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "1810:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2254, + "nodeType": "IfStatement", + "src": "1806:21:14", + "trueBody": { + "id": 2253, + "nodeType": "Break", + "src": "1822:5:14" + } + } + ] + }, + "condition": { + "hexValue": "74727565", + "id": 2241, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1602:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "id": 2256, + "nodeType": "WhileStatement", + "src": "1595:247:14" + }, + { + "expression": { + "id": 2257, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2231, + "src": "1862:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 2220, + "id": 2258, + "nodeType": "Return", + "src": "1855:13:14" + } + ] + } + ] + }, + "documentation": { + "id": 2214, + "nodeType": "StructuredDocumentation", + "src": "1156:90:14", + "text": " @dev Converts a `uint256` to its ASCII `string` decimal representation." + }, + "id": 2261, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toString", + "nameLocation": "1260:8:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2217, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2216, + "mutability": "mutable", + "name": "value", + "nameLocation": "1277:5:14", + "nodeType": "VariableDeclaration", + "scope": 2261, + "src": "1269:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2215, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1269:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1268:15:14" + }, + "returnParameters": { + "id": 2220, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2219, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2261, + "src": "1307:13:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2218, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1307:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "1306:15:14" + }, + "scope": 3678, + "src": "1251:634:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2286, + "nodeType": "Block", + "src": "2061:92:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 2274, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2272, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2264, + "src": "2092:5:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "hexValue": "30", + "id": 2273, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2100:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "2092:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseExpression": { + "hexValue": "", + "id": 2276, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2110:2:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "typeString": "literal_string \"\"" + }, + "value": "" + }, + "id": 2277, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "Conditional", + "src": "2092:20:14", + "trueExpression": { + "hexValue": "2d", + "id": 2275, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2104:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_d3b8281179950f98149eefdb158d0e1acb56f56e8e343aa9fefafa7e36959561", + "typeString": "literal_string \"-\"" + }, + "value": "-" + }, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "arguments": [ + { + "arguments": [ + { + "id": 2281, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2264, + "src": "2138:5:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "expression": { + "id": 2279, + "name": "SignedMath", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8113, + "src": "2123:10:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SignedMath_$8113_$", + "typeString": "type(library SignedMath)" + } + }, + "id": 2280, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2134:3:14", + "memberName": "abs", + "nodeType": "MemberAccess", + "referencedDeclaration": 8112, + "src": "2123:14:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_int256_$returns$_t_uint256_$", + "typeString": "function (int256) pure returns (uint256)" + } + }, + "id": 2282, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2123:21:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2278, + "name": "toString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2261, + "src": "2114:8:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_string_memory_ptr_$", + "typeString": "function (uint256) pure returns (string memory)" + } + }, + "id": 2283, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2114:31:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "expression": { + "id": 2270, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2078:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_string_storage_ptr_$", + "typeString": "type(string storage pointer)" + }, + "typeName": { + "id": 2269, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2078:6:14", + "typeDescriptions": {} + } + }, + "id": 2271, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2085:6:14", + "memberName": "concat", + "nodeType": "MemberAccess", + "src": "2078:13:14", + "typeDescriptions": { + "typeIdentifier": "t_function_stringconcat_pure$__$returns$_t_string_memory_ptr_$", + "typeString": "function () pure returns (string memory)" + } + }, + "id": 2284, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2078:68:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 2268, + "id": 2285, + "nodeType": "Return", + "src": "2071:75:14" + } + ] + }, + "documentation": { + "id": 2262, + "nodeType": "StructuredDocumentation", + "src": "1891:89:14", + "text": " @dev Converts a `int256` to its ASCII `string` decimal representation." + }, + "id": 2287, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toStringSigned", + "nameLocation": "1994:14:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2265, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2264, + "mutability": "mutable", + "name": "value", + "nameLocation": "2016:5:14", + "nodeType": "VariableDeclaration", + "scope": 2287, + "src": "2009:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 2263, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "2009:6:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "2008:14:14" + }, + "returnParameters": { + "id": 2268, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2267, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2287, + "src": "2046:13:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2266, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2046:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "2045:15:14" + }, + "scope": 3678, + "src": "1985:168:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2306, + "nodeType": "Block", + "src": "2332:100:14", + "statements": [ + { + "id": 2305, + "nodeType": "UncheckedBlock", + "src": "2342:84:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2296, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2290, + "src": "2385:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2302, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 2299, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2290, + "src": "2404:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 2297, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "2392:4:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 2298, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2397:6:14", + "memberName": "log256", + "nodeType": "MemberAccess", + "referencedDeclaration": 6126, + "src": "2392:11:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256) pure returns (uint256)" + } + }, + "id": 2300, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2392:18:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "31", + "id": 2301, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2413:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "2392:22:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2295, + "name": "toHexString", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2307, + 2390, + 2410, + 2564 + ], + "referencedDeclaration": 2390, + "src": "2373:11:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_string_memory_ptr_$", + "typeString": "function (uint256,uint256) pure returns (string memory)" + } + }, + "id": 2303, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2373:42:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 2294, + "id": 2304, + "nodeType": "Return", + "src": "2366:49:14" + } + ] + } + ] + }, + "documentation": { + "id": 2288, + "nodeType": "StructuredDocumentation", + "src": "2159:94:14", + "text": " @dev Converts a `uint256` to its ASCII `string` hexadecimal representation." + }, + "id": 2307, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toHexString", + "nameLocation": "2267:11:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2291, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2290, + "mutability": "mutable", + "name": "value", + "nameLocation": "2287:5:14", + "nodeType": "VariableDeclaration", + "scope": 2307, + "src": "2279:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2289, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2279:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2278:15:14" + }, + "returnParameters": { + "id": 2294, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2293, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2307, + "src": "2317:13:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2292, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2317:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "2316:15:14" + }, + "scope": 3678, + "src": "2258:174:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2389, + "nodeType": "Block", + "src": "2645:435:14", + "statements": [ + { + "assignments": [ + 2318 + ], + "declarations": [ + { + "constant": false, + "id": 2318, + "mutability": "mutable", + "name": "localValue", + "nameLocation": "2663:10:14", + "nodeType": "VariableDeclaration", + "scope": 2389, + "src": "2655:18:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2317, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2655:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2320, + "initialValue": { + "id": 2319, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2310, + "src": "2676:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2655:26:14" + }, + { + "assignments": [ + 2322 + ], + "declarations": [ + { + "constant": false, + "id": 2322, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "2704:6:14", + "nodeType": "VariableDeclaration", + "scope": 2389, + "src": "2691:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2321, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2691:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 2331, + "initialValue": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2329, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2327, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 2325, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2723:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 2326, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2312, + "src": "2727:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2723:10:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "32", + "id": 2328, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2736:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "2723:14:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2324, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "2713:9:14", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (uint256) pure returns (bytes memory)" + }, + "typeName": { + "id": 2323, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2717:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + } + }, + "id": 2330, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2713:25:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2691:47:14" + }, + { + "expression": { + "id": 2336, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 2332, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2322, + "src": "2748:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2334, + "indexExpression": { + "hexValue": "30", + "id": 2333, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2755:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2748:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "hexValue": "30", + "id": 2335, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2760:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", + "typeString": "literal_string \"0\"" + }, + "value": "0" + }, + "src": "2748:15:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 2337, + "nodeType": "ExpressionStatement", + "src": "2748:15:14" + }, + { + "expression": { + "id": 2342, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 2338, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2322, + "src": "2773:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2340, + "indexExpression": { + "hexValue": "31", + "id": 2339, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2780:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2773:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "hexValue": "78", + "id": 2341, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2785:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_7521d1cadbcfa91eec65aa16715b94ffc1c9654ba57ea2ef1a2127bca1127a83", + "typeString": "literal_string \"x\"" + }, + "value": "x" + }, + "src": "2773:15:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 2343, + "nodeType": "ExpressionStatement", + "src": "2773:15:14" + }, + { + "body": { + "id": 2372, + "nodeType": "Block", + "src": "2843:95:14", + "statements": [ + { + "expression": { + "id": 2366, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 2358, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2322, + "src": "2857:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2360, + "indexExpression": { + "id": 2359, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2345, + "src": "2864:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2857:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "baseExpression": { + "id": 2361, + "name": "HEX_DIGITS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2184, + "src": "2869:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "id": 2365, + "indexExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2364, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2362, + "name": "localValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2318, + "src": "2880:10:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307866", + "id": 2363, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2893:3:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_15_by_1", + "typeString": "int_const 15" + }, + "value": "0xf" + }, + "src": "2880:16:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2869:28:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "src": "2857:40:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 2367, + "nodeType": "ExpressionStatement", + "src": "2857:40:14" + }, + { + "expression": { + "id": 2370, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 2368, + "name": "localValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2318, + "src": "2911:10:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": ">>=", + "rightHandSide": { + "hexValue": "34", + "id": 2369, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2926:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "2911:16:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2371, + "nodeType": "ExpressionStatement", + "src": "2911:16:14" + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2354, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2352, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2345, + "src": "2831:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "31", + "id": 2353, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2835:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "2831:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2373, + "initializationExpression": { + "assignments": [ + 2345 + ], + "declarations": [ + { + "constant": false, + "id": 2345, + "mutability": "mutable", + "name": "i", + "nameLocation": "2811:1:14", + "nodeType": "VariableDeclaration", + "scope": 2373, + "src": "2803:9:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2344, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2803:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2351, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2350, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2348, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 2346, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2815:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 2347, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2312, + "src": "2819:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2815:10:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "31", + "id": 2349, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2828:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "2815:14:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2803:26:14" + }, + "isSimpleCounterLoop": false, + "loopExpression": { + "expression": { + "id": 2356, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "--", + "prefix": true, + "src": "2838:3:14", + "subExpression": { + "id": 2355, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2345, + "src": "2840:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2357, + "nodeType": "ExpressionStatement", + "src": "2838:3:14" + }, + "nodeType": "ForStatement", + "src": "2798:140:14" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2376, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2374, + "name": "localValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2318, + "src": "2951:10:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "hexValue": "30", + "id": 2375, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2965:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "2951:15:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2383, + "nodeType": "IfStatement", + "src": "2947:96:14", + "trueBody": { + "id": 2382, + "nodeType": "Block", + "src": "2968:75:14", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "id": 2378, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2310, + "src": "3018:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2379, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2312, + "src": "3025:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2377, + "name": "StringsInsufficientHexLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2207, + "src": "2989:28:14", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint256_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint256,uint256) pure returns (error)" + } + }, + "id": 2380, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2989:43:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 2381, + "nodeType": "RevertStatement", + "src": "2982:50:14" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 2386, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2322, + "src": "3066:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 2385, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3059:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_string_storage_ptr_$", + "typeString": "type(string storage pointer)" + }, + "typeName": { + "id": 2384, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "3059:6:14", + "typeDescriptions": {} + } + }, + "id": 2387, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3059:14:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 2316, + "id": 2388, + "nodeType": "Return", + "src": "3052:21:14" + } + ] + }, + "documentation": { + "id": 2308, + "nodeType": "StructuredDocumentation", + "src": "2438:112:14", + "text": " @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length." + }, + "id": 2390, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toHexString", + "nameLocation": "2564:11:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2313, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2310, + "mutability": "mutable", + "name": "value", + "nameLocation": "2584:5:14", + "nodeType": "VariableDeclaration", + "scope": 2390, + "src": "2576:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2309, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2576:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2312, + "mutability": "mutable", + "name": "length", + "nameLocation": "2599:6:14", + "nodeType": "VariableDeclaration", + "scope": 2390, + "src": "2591:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2311, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2591:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2575:31:14" + }, + "returnParameters": { + "id": 2316, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2315, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2390, + "src": "2630:13:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2314, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2630:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "2629:15:14" + }, + "scope": 3678, + "src": "2555:525:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2409, + "nodeType": "Block", + "src": "3312:75:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "id": 2403, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2393, + "src": "3357:4:14", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 2402, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3349:7:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint160_$", + "typeString": "type(uint160)" + }, + "typeName": { + "id": 2401, + "name": "uint160", + "nodeType": "ElementaryTypeName", + "src": "3349:7:14", + "typeDescriptions": {} + } + }, + "id": 2404, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3349:13:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint160", + "typeString": "uint160" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint160", + "typeString": "uint160" + } + ], + "id": 2400, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3341:7:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 2399, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3341:7:14", + "typeDescriptions": {} + } + }, + "id": 2405, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3341:22:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2406, + "name": "ADDRESS_LENGTH", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2187, + "src": "3365:14:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + ], + "id": 2398, + "name": "toHexString", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2307, + 2390, + 2410, + 2564 + ], + "referencedDeclaration": 2390, + "src": "3329:11:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_string_memory_ptr_$", + "typeString": "function (uint256,uint256) pure returns (string memory)" + } + }, + "id": 2407, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3329:51:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 2397, + "id": 2408, + "nodeType": "Return", + "src": "3322:58:14" + } + ] + }, + "documentation": { + "id": 2391, + "nodeType": "StructuredDocumentation", + "src": "3086:148:14", + "text": " @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal\n representation." + }, + "id": 2410, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toHexString", + "nameLocation": "3248:11:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2394, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2393, + "mutability": "mutable", + "name": "addr", + "nameLocation": "3268:4:14", + "nodeType": "VariableDeclaration", + "scope": 2410, + "src": "3260:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 2392, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3260:7:14", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "3259:14:14" + }, + "returnParameters": { + "id": 2397, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2396, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2410, + "src": "3297:13:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2395, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "3297:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "3296:15:14" + }, + "scope": 3678, + "src": "3239:148:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2474, + "nodeType": "Block", + "src": "3644:642:14", + "statements": [ + { + "assignments": [ + 2419 + ], + "declarations": [ + { + "constant": false, + "id": 2419, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "3667:6:14", + "nodeType": "VariableDeclaration", + "scope": 2474, + "src": "3654:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2418, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3654:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 2426, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "id": 2423, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2413, + "src": "3694:4:14", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 2422, + "name": "toHexString", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2307, + 2390, + 2410, + 2564 + ], + "referencedDeclaration": 2410, + "src": "3682:11:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_address_$returns$_t_string_memory_ptr_$", + "typeString": "function (address) pure returns (string memory)" + } + }, + "id": 2424, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3682:17:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2421, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3676:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2420, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3676:5:14", + "typeDescriptions": {} + } + }, + "id": 2425, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3676:24:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3654:46:14" + }, + { + "assignments": [ + 2428 + ], + "declarations": [ + { + "constant": false, + "id": 2428, + "mutability": "mutable", + "name": "hashValue", + "nameLocation": "3793:9:14", + "nodeType": "VariableDeclaration", + "scope": 2474, + "src": "3785:17:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2427, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3785:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2429, + "nodeType": "VariableDeclarationStatement", + "src": "3785:17:14" + }, + { + "AST": { + "nativeSrc": "3837:78:14", + "nodeType": "YulBlock", + "src": "3837:78:14", + "statements": [ + { + "nativeSrc": "3851:54:14", + "nodeType": "YulAssignment", + "src": "3851:54:14", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3868:2:14", + "nodeType": "YulLiteral", + "src": "3868:2:14", + "type": "", + "value": "96" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "3886:6:14", + "nodeType": "YulIdentifier", + "src": "3886:6:14" + }, + { + "kind": "number", + "nativeSrc": "3894:4:14", + "nodeType": "YulLiteral", + "src": "3894:4:14", + "type": "", + "value": "0x22" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3882:3:14", + "nodeType": "YulIdentifier", + "src": "3882:3:14" + }, + "nativeSrc": "3882:17:14", + "nodeType": "YulFunctionCall", + "src": "3882:17:14" + }, + { + "kind": "number", + "nativeSrc": "3901:2:14", + "nodeType": "YulLiteral", + "src": "3901:2:14", + "type": "", + "value": "40" + } + ], + "functionName": { + "name": "keccak256", + "nativeSrc": "3872:9:14", + "nodeType": "YulIdentifier", + "src": "3872:9:14" + }, + "nativeSrc": "3872:32:14", + "nodeType": "YulFunctionCall", + "src": "3872:32:14" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "3864:3:14", + "nodeType": "YulIdentifier", + "src": "3864:3:14" + }, + "nativeSrc": "3864:41:14", + "nodeType": "YulFunctionCall", + "src": "3864:41:14" + }, + "variableNames": [ + { + "name": "hashValue", + "nativeSrc": "3851:9:14", + "nodeType": "YulIdentifier", + "src": "3851:9:14" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2419, + "isOffset": false, + "isSlot": false, + "src": "3886:6:14", + "valueSize": 1 + }, + { + "declaration": 2428, + "isOffset": false, + "isSlot": false, + "src": "3851:9:14", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2430, + "nodeType": "InlineAssembly", + "src": "3812:103:14" + }, + { + "body": { + "id": 2467, + "nodeType": "Block", + "src": "3958:291:14", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 2454, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2445, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2443, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2441, + "name": "hashValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2428, + "src": "4064:9:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307866", + "id": 2442, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4076:3:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_15_by_1", + "typeString": "int_const 15" + }, + "value": "0xf" + }, + "src": "4064:15:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "37", + "id": 2444, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4082:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_7_by_1", + "typeString": "int_const 7" + }, + "value": "7" + }, + "src": "4064:19:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 2453, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "baseExpression": { + "id": 2448, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2419, + "src": "4093:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2450, + "indexExpression": { + "id": 2449, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2432, + "src": "4100:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4093:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 2447, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4087:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": { + "id": 2446, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "4087:5:14", + "typeDescriptions": {} + } + }, + "id": 2451, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4087:16:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "3936", + "id": 2452, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4106:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_96_by_1", + "typeString": "int_const 96" + }, + "value": "96" + }, + "src": "4087:21:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "4064:44:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2462, + "nodeType": "IfStatement", + "src": "4060:150:14", + "trueBody": { + "id": 2461, + "nodeType": "Block", + "src": "4110:100:14", + "statements": [ + { + "expression": { + "id": 2459, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 2455, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2419, + "src": "4178:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2457, + "indexExpression": { + "id": 2456, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2432, + "src": "4185:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "4178:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "Assignment", + "operator": "^=", + "rightHandSide": { + "hexValue": "30783230", + "id": 2458, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4191:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "0x20" + }, + "src": "4178:17:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 2460, + "nodeType": "ExpressionStatement", + "src": "4178:17:14" + } + ] + } + }, + { + "expression": { + "id": 2465, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 2463, + "name": "hashValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2428, + "src": "4223:9:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": ">>=", + "rightHandSide": { + "hexValue": "34", + "id": 2464, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4237:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "4223:15:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2466, + "nodeType": "ExpressionStatement", + "src": "4223:15:14" + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2437, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2435, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2432, + "src": "3946:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "31", + "id": 2436, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3950:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "3946:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2468, + "initializationExpression": { + "assignments": [ + 2432 + ], + "declarations": [ + { + "constant": false, + "id": 2432, + "mutability": "mutable", + "name": "i", + "nameLocation": "3938:1:14", + "nodeType": "VariableDeclaration", + "scope": 2468, + "src": "3930:9:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2431, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3930:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2434, + "initialValue": { + "hexValue": "3431", + "id": 2433, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3942:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_41_by_1", + "typeString": "int_const 41" + }, + "value": "41" + }, + "nodeType": "VariableDeclarationStatement", + "src": "3930:14:14" + }, + "isSimpleCounterLoop": false, + "loopExpression": { + "expression": { + "id": 2439, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "--", + "prefix": true, + "src": "3953:3:14", + "subExpression": { + "id": 2438, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2432, + "src": "3955:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2440, + "nodeType": "ExpressionStatement", + "src": "3953:3:14" + }, + "nodeType": "ForStatement", + "src": "3925:324:14" + }, + { + "expression": { + "arguments": [ + { + "id": 2471, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2419, + "src": "4272:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 2470, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4265:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_string_storage_ptr_$", + "typeString": "type(string storage pointer)" + }, + "typeName": { + "id": 2469, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "4265:6:14", + "typeDescriptions": {} + } + }, + "id": 2472, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4265:14:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 2417, + "id": 2473, + "nodeType": "Return", + "src": "4258:21:14" + } + ] + }, + "documentation": { + "id": 2411, + "nodeType": "StructuredDocumentation", + "src": "3393:165:14", + "text": " @dev Converts an `address` with fixed length of 20 bytes to its checksummed ASCII `string` hexadecimal\n representation, according to EIP-55." + }, + "id": 2475, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toChecksumHexString", + "nameLocation": "3572:19:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2414, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2413, + "mutability": "mutable", + "name": "addr", + "nameLocation": "3600:4:14", + "nodeType": "VariableDeclaration", + "scope": 2475, + "src": "3592:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 2412, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3592:7:14", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "3591:14:14" + }, + "returnParameters": { + "id": 2417, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2416, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2475, + "src": "3629:13:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2415, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "3629:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "3628:15:14" + }, + "scope": 3678, + "src": "3563:723:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2563, + "nodeType": "Block", + "src": "4475:424:14", + "statements": [ + { + "id": 2562, + "nodeType": "UncheckedBlock", + "src": "4485:408:14", + "statements": [ + { + "assignments": [ + 2484 + ], + "declarations": [ + { + "constant": false, + "id": 2484, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "4522:6:14", + "nodeType": "VariableDeclaration", + "scope": 2562, + "src": "4509:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2483, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4509:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 2494, + "initialValue": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2492, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2490, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 2487, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4541:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "expression": { + "id": 2488, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2478, + "src": "4545:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2489, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4551:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "4545:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4541:16:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "32", + "id": 2491, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4560:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "4541:20:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2486, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "4531:9:14", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (uint256) pure returns (bytes memory)" + }, + "typeName": { + "id": 2485, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4535:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + } + }, + "id": 2493, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4531:31:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4509:53:14" + }, + { + "expression": { + "id": 2499, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 2495, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2484, + "src": "4576:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2497, + "indexExpression": { + "hexValue": "30", + "id": 2496, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4583:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "4576:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "hexValue": "30", + "id": 2498, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4588:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", + "typeString": "literal_string \"0\"" + }, + "value": "0" + }, + "src": "4576:15:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 2500, + "nodeType": "ExpressionStatement", + "src": "4576:15:14" + }, + { + "expression": { + "id": 2505, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 2501, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2484, + "src": "4605:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2503, + "indexExpression": { + "hexValue": "31", + "id": 2502, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4612:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "4605:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "hexValue": "78", + "id": 2504, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4617:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_7521d1cadbcfa91eec65aa16715b94ffc1c9654ba57ea2ef1a2127bca1127a83", + "typeString": "literal_string \"x\"" + }, + "value": "x" + }, + "src": "4605:15:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 2506, + "nodeType": "ExpressionStatement", + "src": "4605:15:14" + }, + { + "body": { + "id": 2555, + "nodeType": "Block", + "src": "4677:171:14", + "statements": [ + { + "assignments": [ + 2519 + ], + "declarations": [ + { + "constant": false, + "id": 2519, + "mutability": "mutable", + "name": "v", + "nameLocation": "4701:1:14", + "nodeType": "VariableDeclaration", + "scope": 2555, + "src": "4695:7:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 2518, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "4695:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "id": 2526, + "initialValue": { + "arguments": [ + { + "baseExpression": { + "id": 2522, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2478, + "src": "4711:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2524, + "indexExpression": { + "id": 2523, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2508, + "src": "4717:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4711:8:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 2521, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4705:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": { + "id": 2520, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "4705:5:14", + "typeDescriptions": {} + } + }, + "id": 2525, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4705:15:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4695:25:14" + }, + { + "expression": { + "id": 2539, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 2527, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2484, + "src": "4738:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2533, + "indexExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2532, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2530, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 2528, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4745:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 2529, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2508, + "src": "4749:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4745:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "32", + "id": 2531, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4753:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "4745:9:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "4738:17:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "baseExpression": { + "id": 2534, + "name": "HEX_DIGITS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2184, + "src": "4758:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "id": 2538, + "indexExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 2537, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2535, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2519, + "src": "4769:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "34", + "id": 2536, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4774:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "4769:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4758:18:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "src": "4738:38:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 2540, + "nodeType": "ExpressionStatement", + "src": "4738:38:14" + }, + { + "expression": { + "id": 2553, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 2541, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2484, + "src": "4794:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2547, + "indexExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2546, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2544, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 2542, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4801:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 2543, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2508, + "src": "4805:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4801:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "33", + "id": 2545, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4809:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "src": "4801:9:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "4794:17:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "baseExpression": { + "id": 2548, + "name": "HEX_DIGITS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2184, + "src": "4814:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "id": 2552, + "indexExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 2551, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2549, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2519, + "src": "4825:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307866", + "id": 2550, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4829:3:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_15_by_1", + "typeString": "int_const 15" + }, + "value": "0xf" + }, + "src": "4825:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4814:19:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "src": "4794:39:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 2554, + "nodeType": "ExpressionStatement", + "src": "4794:39:14" + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2514, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2511, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2508, + "src": "4654:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "expression": { + "id": 2512, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2478, + "src": "4658:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2513, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4664:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "4658:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4654:16:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2556, + "initializationExpression": { + "assignments": [ + 2508 + ], + "declarations": [ + { + "constant": false, + "id": 2508, + "mutability": "mutable", + "name": "i", + "nameLocation": "4647:1:14", + "nodeType": "VariableDeclaration", + "scope": 2556, + "src": "4639:9:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2507, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4639:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2510, + "initialValue": { + "hexValue": "30", + "id": 2509, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4651:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "4639:13:14" + }, + "isSimpleCounterLoop": true, + "loopExpression": { + "expression": { + "id": 2516, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": true, + "src": "4672:3:14", + "subExpression": { + "id": 2515, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2508, + "src": "4674:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2517, + "nodeType": "ExpressionStatement", + "src": "4672:3:14" + }, + "nodeType": "ForStatement", + "src": "4634:214:14" + }, + { + "expression": { + "arguments": [ + { + "id": 2559, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2484, + "src": "4875:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 2558, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4868:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_string_storage_ptr_$", + "typeString": "type(string storage pointer)" + }, + "typeName": { + "id": 2557, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "4868:6:14", + "typeDescriptions": {} + } + }, + "id": 2560, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4868:14:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 2482, + "id": 2561, + "nodeType": "Return", + "src": "4861:21:14" + } + ] + } + ] + }, + "documentation": { + "id": 2476, + "nodeType": "StructuredDocumentation", + "src": "4292:99:14", + "text": " @dev Converts a `bytes` buffer to its ASCII `string` hexadecimal representation." + }, + "id": 2564, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toHexString", + "nameLocation": "4405:11:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2479, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2478, + "mutability": "mutable", + "name": "input", + "nameLocation": "4430:5:14", + "nodeType": "VariableDeclaration", + "scope": 2564, + "src": "4417:18:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2477, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4417:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "4416:20:14" + }, + "returnParameters": { + "id": 2482, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2481, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2564, + "src": "4460:13:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2480, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "4460:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "4459:15:14" + }, + "scope": 3678, + "src": "4396:503:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2586, + "nodeType": "Block", + "src": "5054:55:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "id": 2578, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2567, + "src": "5089:1:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2577, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5083:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2576, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5083:5:14", + "typeDescriptions": {} + } + }, + "id": 2579, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5083:8:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "arguments": [ + { + "id": 2582, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2569, + "src": "5099:1:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2581, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5093:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2580, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5093:5:14", + "typeDescriptions": {} + } + }, + "id": 2583, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5093:8:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "id": 2574, + "name": "Bytes", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1632, + "src": "5071:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Bytes_$1632_$", + "typeString": "type(library Bytes)" + } + }, + "id": 2575, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5077:5:14", + "memberName": "equal", + "nodeType": "MemberAccess", + "referencedDeclaration": 1282, + "src": "5071:11:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_bytes_memory_ptr_$returns$_t_bool_$", + "typeString": "function (bytes memory,bytes memory) pure returns (bool)" + } + }, + "id": 2584, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5071:31:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 2573, + "id": 2585, + "nodeType": "Return", + "src": "5064:38:14" + } + ] + }, + "documentation": { + "id": 2565, + "nodeType": "StructuredDocumentation", + "src": "4905:66:14", + "text": " @dev Returns true if the two strings are equal." + }, + "id": 2587, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "equal", + "nameLocation": "4985:5:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2570, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2567, + "mutability": "mutable", + "name": "a", + "nameLocation": "5005:1:14", + "nodeType": "VariableDeclaration", + "scope": 2587, + "src": "4991:15:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2566, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "4991:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2569, + "mutability": "mutable", + "name": "b", + "nameLocation": "5022:1:14", + "nodeType": "VariableDeclaration", + "scope": 2587, + "src": "5008:15:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2568, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "5008:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "4990:34:14" + }, + "returnParameters": { + "id": 2573, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2572, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2587, + "src": "5048:4:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2571, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "5048:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "5047:6:14" + }, + "scope": 3678, + "src": "4976:133:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2605, + "nodeType": "Block", + "src": "5406:64:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2596, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2590, + "src": "5433:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "hexValue": "30", + "id": 2597, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5440:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "expression": { + "arguments": [ + { + "id": 2600, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2590, + "src": "5449:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2599, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5443:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2598, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5443:5:14", + "typeDescriptions": {} + } + }, + "id": 2601, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5443:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2602, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5456:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "5443:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2595, + "name": "parseUint", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2606, + 2637 + ], + "referencedDeclaration": 2637, + "src": "5423:9:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (uint256)" + } + }, + "id": 2603, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5423:40:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 2594, + "id": 2604, + "nodeType": "Return", + "src": "5416:47:14" + } + ] + }, + "documentation": { + "id": 2588, + "nodeType": "StructuredDocumentation", + "src": "5115:214:14", + "text": " @dev Parse a decimal string and returns the value as a `uint256`.\n Requirements:\n - The string must be formatted as `[0-9]*`\n - The result must fit into an `uint256` type" + }, + "id": 2606, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parseUint", + "nameLocation": "5343:9:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2591, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2590, + "mutability": "mutable", + "name": "input", + "nameLocation": "5367:5:14", + "nodeType": "VariableDeclaration", + "scope": 2606, + "src": "5353:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2589, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "5353:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "5352:21:14" + }, + "returnParameters": { + "id": 2594, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2593, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2606, + "src": "5397:7:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2592, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5397:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5396:9:14" + }, + "scope": 3678, + "src": "5334:136:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2636, + "nodeType": "Block", + "src": "5875:153:14", + "statements": [ + { + "assignments": [ + 2619, + 2621 + ], + "declarations": [ + { + "constant": false, + "id": 2619, + "mutability": "mutable", + "name": "success", + "nameLocation": "5891:7:14", + "nodeType": "VariableDeclaration", + "scope": 2636, + "src": "5886:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2618, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "5886:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2621, + "mutability": "mutable", + "name": "value", + "nameLocation": "5908:5:14", + "nodeType": "VariableDeclaration", + "scope": 2636, + "src": "5900:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2620, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5900:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2627, + "initialValue": { + "arguments": [ + { + "id": 2623, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2609, + "src": "5930:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "id": 2624, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2611, + "src": "5937:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2625, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2613, + "src": "5944:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2622, + "name": "tryParseUint", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2658, + 2695 + ], + "referencedDeclaration": 2695, + "src": "5917:12:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 2626, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5917:31:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "5885:63:14" + }, + { + "condition": { + "id": 2629, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "5962:8:14", + "subExpression": { + "id": 2628, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2619, + "src": "5963:7:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2633, + "nodeType": "IfStatement", + "src": "5958:41:14", + "trueBody": { + "errorCall": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 2630, + "name": "StringsInvalidChar", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2210, + "src": "5979:18:14", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$__$returns$_t_error_$", + "typeString": "function () pure returns (error)" + } + }, + "id": 2631, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5979:20:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 2632, + "nodeType": "RevertStatement", + "src": "5972:27:14" + } + }, + { + "expression": { + "id": 2634, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2621, + "src": "6016:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 2617, + "id": 2635, + "nodeType": "Return", + "src": "6009:12:14" + } + ] + }, + "documentation": { + "id": 2607, + "nodeType": "StructuredDocumentation", + "src": "5476:294:14", + "text": " @dev Variant of {parseUint-string} that parses a substring of `input` located between position `begin` (included) and\n `end` (excluded).\n Requirements:\n - The substring must be formatted as `[0-9]*`\n - The result must fit into an `uint256` type" + }, + "id": 2637, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parseUint", + "nameLocation": "5784:9:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2614, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2609, + "mutability": "mutable", + "name": "input", + "nameLocation": "5808:5:14", + "nodeType": "VariableDeclaration", + "scope": 2637, + "src": "5794:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2608, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "5794:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2611, + "mutability": "mutable", + "name": "begin", + "nameLocation": "5823:5:14", + "nodeType": "VariableDeclaration", + "scope": 2637, + "src": "5815:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2610, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5815:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2613, + "mutability": "mutable", + "name": "end", + "nameLocation": "5838:3:14", + "nodeType": "VariableDeclaration", + "scope": 2637, + "src": "5830:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2612, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5830:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5793:49:14" + }, + "returnParameters": { + "id": 2617, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2616, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2637, + "src": "5866:7:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2615, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5866:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5865:9:14" + }, + "scope": 3678, + "src": "5775:253:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2657, + "nodeType": "Block", + "src": "6349:83:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2648, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2640, + "src": "6395:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "hexValue": "30", + "id": 2649, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6402:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "expression": { + "arguments": [ + { + "id": 2652, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2640, + "src": "6411:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2651, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6405:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2650, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "6405:5:14", + "typeDescriptions": {} + } + }, + "id": 2653, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6405:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2654, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6418:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "6405:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2647, + "name": "_tryParseUintUncheckedBounds", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2765, + "src": "6366:28:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 2655, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6366:59:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "functionReturnParameters": 2646, + "id": 2656, + "nodeType": "Return", + "src": "6359:66:14" + } + ] + }, + "documentation": { + "id": 2638, + "nodeType": "StructuredDocumentation", + "src": "6034:215:14", + "text": " @dev Variant of {parseUint-string} that returns false if the parsing fails because of an invalid character.\n NOTE: This function will revert if the result does not fit in a `uint256`." + }, + "id": 2658, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryParseUint", + "nameLocation": "6263:12:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2641, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2640, + "mutability": "mutable", + "name": "input", + "nameLocation": "6290:5:14", + "nodeType": "VariableDeclaration", + "scope": 2658, + "src": "6276:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2639, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "6276:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "6275:21:14" + }, + "returnParameters": { + "id": 2646, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2643, + "mutability": "mutable", + "name": "success", + "nameLocation": "6325:7:14", + "nodeType": "VariableDeclaration", + "scope": 2658, + "src": "6320:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2642, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "6320:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2645, + "mutability": "mutable", + "name": "value", + "nameLocation": "6342:5:14", + "nodeType": "VariableDeclaration", + "scope": 2658, + "src": "6334:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2644, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6334:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "6319:29:14" + }, + "scope": 3678, + "src": "6254:178:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2694, + "nodeType": "Block", + "src": "6834:144:14", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 2682, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2678, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2672, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2665, + "src": "6848:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 2675, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2661, + "src": "6860:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2674, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6854:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2673, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "6854:5:14", + "typeDescriptions": {} + } + }, + "id": 2676, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6854:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2677, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6867:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "6854:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6848:25:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2681, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2679, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2663, + "src": "6877:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "id": 2680, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2665, + "src": "6885:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6877:11:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "6848:40:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2687, + "nodeType": "IfStatement", + "src": "6844:63:14", + "trueBody": { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 2683, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6898:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "hexValue": "30", + "id": 2684, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6905:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "id": 2685, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "6897:10:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$", + "typeString": "tuple(bool,int_const 0)" + } + }, + "functionReturnParameters": 2671, + "id": 2686, + "nodeType": "Return", + "src": "6890:17:14" + } + }, + { + "expression": { + "arguments": [ + { + "id": 2689, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2661, + "src": "6953:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "id": 2690, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2663, + "src": "6960:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2691, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2665, + "src": "6967:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2688, + "name": "_tryParseUintUncheckedBounds", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2765, + "src": "6924:28:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 2692, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6924:47:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "functionReturnParameters": 2671, + "id": 2693, + "nodeType": "Return", + "src": "6917:54:14" + } + ] + }, + "documentation": { + "id": 2659, + "nodeType": "StructuredDocumentation", + "src": "6438:238:14", + "text": " @dev Variant of {parseUint-string-uint256-uint256} that returns false if the parsing fails because of an invalid\n character.\n NOTE: This function will revert if the result does not fit in a `uint256`." + }, + "id": 2695, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryParseUint", + "nameLocation": "6690:12:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2666, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2661, + "mutability": "mutable", + "name": "input", + "nameLocation": "6726:5:14", + "nodeType": "VariableDeclaration", + "scope": 2695, + "src": "6712:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2660, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "6712:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2663, + "mutability": "mutable", + "name": "begin", + "nameLocation": "6749:5:14", + "nodeType": "VariableDeclaration", + "scope": 2695, + "src": "6741:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2662, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6741:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2665, + "mutability": "mutable", + "name": "end", + "nameLocation": "6772:3:14", + "nodeType": "VariableDeclaration", + "scope": 2695, + "src": "6764:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2664, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6764:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "6702:79:14" + }, + "returnParameters": { + "id": 2671, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2668, + "mutability": "mutable", + "name": "success", + "nameLocation": "6810:7:14", + "nodeType": "VariableDeclaration", + "scope": 2695, + "src": "6805:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2667, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "6805:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2670, + "mutability": "mutable", + "name": "value", + "nameLocation": "6827:5:14", + "nodeType": "VariableDeclaration", + "scope": 2695, + "src": "6819:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2669, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6819:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "6804:29:14" + }, + "scope": 3678, + "src": "6681:297:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2764, + "nodeType": "Block", + "src": "7381:347:14", + "statements": [ + { + "assignments": [ + 2710 + ], + "declarations": [ + { + "constant": false, + "id": 2710, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "7404:6:14", + "nodeType": "VariableDeclaration", + "scope": 2764, + "src": "7391:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2709, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "7391:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 2715, + "initialValue": { + "arguments": [ + { + "id": 2713, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2698, + "src": "7419:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2712, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "7413:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2711, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "7413:5:14", + "typeDescriptions": {} + } + }, + "id": 2714, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7413:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "7391:34:14" + }, + { + "assignments": [ + 2717 + ], + "declarations": [ + { + "constant": false, + "id": 2717, + "mutability": "mutable", + "name": "result", + "nameLocation": "7444:6:14", + "nodeType": "VariableDeclaration", + "scope": 2764, + "src": "7436:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2716, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7436:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2719, + "initialValue": { + "hexValue": "30", + "id": 2718, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7453:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "7436:18:14" + }, + { + "body": { + "id": 2758, + "nodeType": "Block", + "src": "7502:189:14", + "statements": [ + { + "assignments": [ + 2731 + ], + "declarations": [ + { + "constant": false, + "id": 2731, + "mutability": "mutable", + "name": "chr", + "nameLocation": "7522:3:14", + "nodeType": "VariableDeclaration", + "scope": 2758, + "src": "7516:9:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 2730, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "7516:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "id": 2741, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "id": 2736, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2710, + "src": "7571:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 2737, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2721, + "src": "7579:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2735, + "name": "_unsafeReadBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3665, + "src": "7548:22:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (bytes memory,uint256) pure returns (bytes32)" + } + }, + "id": 2738, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7548:33:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 2734, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "7541:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 2733, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "7541:6:14", + "typeDescriptions": {} + } + }, + "id": 2739, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7541:41:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 2732, + "name": "_tryParseChr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3445, + "src": "7528:12:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes1_$returns$_t_uint8_$", + "typeString": "function (bytes1) pure returns (uint8)" + } + }, + "id": 2740, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7528:55:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "7516:67:14" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 2744, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2742, + "name": "chr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2731, + "src": "7601:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "39", + "id": 2743, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7607:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_9_by_1", + "typeString": "int_const 9" + }, + "value": "9" + }, + "src": "7601:7:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2749, + "nodeType": "IfStatement", + "src": "7597:30:14", + "trueBody": { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 2745, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7618:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "hexValue": "30", + "id": 2746, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7625:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "id": 2747, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "7617:10:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$", + "typeString": "tuple(bool,int_const 0)" + } + }, + "functionReturnParameters": 2708, + "id": 2748, + "nodeType": "Return", + "src": "7610:17:14" + } + }, + { + "expression": { + "id": 2752, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 2750, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2717, + "src": "7641:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "*=", + "rightHandSide": { + "hexValue": "3130", + "id": 2751, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7651:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "src": "7641:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2753, + "nodeType": "ExpressionStatement", + "src": "7641:12:14" + }, + { + "expression": { + "id": 2756, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 2754, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2717, + "src": "7667:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "id": 2755, + "name": "chr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2731, + "src": "7677:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "src": "7667:13:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2757, + "nodeType": "ExpressionStatement", + "src": "7667:13:14" + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2726, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2724, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2721, + "src": "7488:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 2725, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2702, + "src": "7492:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7488:7:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2759, + "initializationExpression": { + "assignments": [ + 2721 + ], + "declarations": [ + { + "constant": false, + "id": 2721, + "mutability": "mutable", + "name": "i", + "nameLocation": "7477:1:14", + "nodeType": "VariableDeclaration", + "scope": 2759, + "src": "7469:9:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2720, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7469:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2723, + "initialValue": { + "id": 2722, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2700, + "src": "7481:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "7469:17:14" + }, + "isSimpleCounterLoop": true, + "loopExpression": { + "expression": { + "id": 2728, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": true, + "src": "7497:3:14", + "subExpression": { + "id": 2727, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2721, + "src": "7499:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2729, + "nodeType": "ExpressionStatement", + "src": "7497:3:14" + }, + "nodeType": "ForStatement", + "src": "7464:227:14" + }, + { + "expression": { + "components": [ + { + "hexValue": "74727565", + "id": 2760, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7708:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + { + "id": 2761, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2717, + "src": "7714:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 2762, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "7707:14:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "functionReturnParameters": 2708, + "id": 2763, + "nodeType": "Return", + "src": "7700:21:14" + } + ] + }, + "documentation": { + "id": 2696, + "nodeType": "StructuredDocumentation", + "src": "6984:224:14", + "text": " @dev Implementation of {tryParseUint-string-uint256-uint256} that does not check bounds. Caller should make sure that\n `begin <= end <= input.length`. Other inputs would result in undefined behavior." + }, + "id": 2765, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_tryParseUintUncheckedBounds", + "nameLocation": "7222:28:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2703, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2698, + "mutability": "mutable", + "name": "input", + "nameLocation": "7274:5:14", + "nodeType": "VariableDeclaration", + "scope": 2765, + "src": "7260:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2697, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "7260:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2700, + "mutability": "mutable", + "name": "begin", + "nameLocation": "7297:5:14", + "nodeType": "VariableDeclaration", + "scope": 2765, + "src": "7289:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2699, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7289:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2702, + "mutability": "mutable", + "name": "end", + "nameLocation": "7320:3:14", + "nodeType": "VariableDeclaration", + "scope": 2765, + "src": "7312:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2701, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7312:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7250:79:14" + }, + "returnParameters": { + "id": 2708, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2705, + "mutability": "mutable", + "name": "success", + "nameLocation": "7357:7:14", + "nodeType": "VariableDeclaration", + "scope": 2765, + "src": "7352:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2704, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "7352:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2707, + "mutability": "mutable", + "name": "value", + "nameLocation": "7374:5:14", + "nodeType": "VariableDeclaration", + "scope": 2765, + "src": "7366:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2706, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7366:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7351:29:14" + }, + "scope": 3678, + "src": "7213:515:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 2783, + "nodeType": "Block", + "src": "8025:63:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2774, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2768, + "src": "8051:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "hexValue": "30", + "id": 2775, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8058:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "expression": { + "arguments": [ + { + "id": 2778, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2768, + "src": "8067:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2777, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8061:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2776, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "8061:5:14", + "typeDescriptions": {} + } + }, + "id": 2779, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8061:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2780, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "8074:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "8061:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2773, + "name": "parseInt", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2784, + 2815 + ], + "referencedDeclaration": 2815, + "src": "8042:8:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_int256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (int256)" + } + }, + "id": 2781, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8042:39:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "functionReturnParameters": 2772, + "id": 2782, + "nodeType": "Return", + "src": "8035:46:14" + } + ] + }, + "documentation": { + "id": 2766, + "nodeType": "StructuredDocumentation", + "src": "7734:216:14", + "text": " @dev Parse a decimal string and returns the value as a `int256`.\n Requirements:\n - The string must be formatted as `[-+]?[0-9]*`\n - The result must fit in an `int256` type." + }, + "id": 2784, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parseInt", + "nameLocation": "7964:8:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2769, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2768, + "mutability": "mutable", + "name": "input", + "nameLocation": "7987:5:14", + "nodeType": "VariableDeclaration", + "scope": 2784, + "src": "7973:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2767, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "7973:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "7972:21:14" + }, + "returnParameters": { + "id": 2772, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2771, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2784, + "src": "8017:6:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 2770, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "8017:6:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "8016:8:14" + }, + "scope": 3678, + "src": "7955:133:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2814, + "nodeType": "Block", + "src": "8493:151:14", + "statements": [ + { + "assignments": [ + 2797, + 2799 + ], + "declarations": [ + { + "constant": false, + "id": 2797, + "mutability": "mutable", + "name": "success", + "nameLocation": "8509:7:14", + "nodeType": "VariableDeclaration", + "scope": 2814, + "src": "8504:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2796, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "8504:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2799, + "mutability": "mutable", + "name": "value", + "nameLocation": "8525:5:14", + "nodeType": "VariableDeclaration", + "scope": 2814, + "src": "8518:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 2798, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "8518:6:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "id": 2805, + "initialValue": { + "arguments": [ + { + "id": 2801, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2787, + "src": "8546:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "id": 2802, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2789, + "src": "8553:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2803, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2791, + "src": "8560:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2800, + "name": "tryParseInt", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2836, + 2878 + ], + "referencedDeclaration": 2878, + "src": "8534:11:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_int256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,int256)" + } + }, + "id": 2804, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8534:30:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_int256_$", + "typeString": "tuple(bool,int256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8503:61:14" + }, + { + "condition": { + "id": 2807, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "8578:8:14", + "subExpression": { + "id": 2806, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2797, + "src": "8579:7:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2811, + "nodeType": "IfStatement", + "src": "8574:41:14", + "trueBody": { + "errorCall": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 2808, + "name": "StringsInvalidChar", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2210, + "src": "8595:18:14", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$__$returns$_t_error_$", + "typeString": "function () pure returns (error)" + } + }, + "id": 2809, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8595:20:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 2810, + "nodeType": "RevertStatement", + "src": "8588:27:14" + } + }, + { + "expression": { + "id": 2812, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2799, + "src": "8632:5:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "functionReturnParameters": 2795, + "id": 2813, + "nodeType": "Return", + "src": "8625:12:14" + } + ] + }, + "documentation": { + "id": 2785, + "nodeType": "StructuredDocumentation", + "src": "8094:296:14", + "text": " @dev Variant of {parseInt-string} that parses a substring of `input` located between position `begin` (included) and\n `end` (excluded).\n Requirements:\n - The substring must be formatted as `[-+]?[0-9]*`\n - The result must fit in an `int256` type." + }, + "id": 2815, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parseInt", + "nameLocation": "8404:8:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2792, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2787, + "mutability": "mutable", + "name": "input", + "nameLocation": "8427:5:14", + "nodeType": "VariableDeclaration", + "scope": 2815, + "src": "8413:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2786, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "8413:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2789, + "mutability": "mutable", + "name": "begin", + "nameLocation": "8442:5:14", + "nodeType": "VariableDeclaration", + "scope": 2815, + "src": "8434:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2788, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8434:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2791, + "mutability": "mutable", + "name": "end", + "nameLocation": "8457:3:14", + "nodeType": "VariableDeclaration", + "scope": 2815, + "src": "8449:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2790, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8449:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "8412:49:14" + }, + "returnParameters": { + "id": 2795, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2794, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2815, + "src": "8485:6:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 2793, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "8485:6:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "8484:8:14" + }, + "scope": 3678, + "src": "8395:249:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2835, + "nodeType": "Block", + "src": "9035:82:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2826, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2818, + "src": "9080:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "hexValue": "30", + "id": 2827, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9087:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "expression": { + "arguments": [ + { + "id": 2830, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2818, + "src": "9096:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2829, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "9090:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2828, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "9090:5:14", + "typeDescriptions": {} + } + }, + "id": 2831, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9090:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2832, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "9103:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "9090:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2825, + "name": "_tryParseIntUncheckedBounds", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2999, + "src": "9052:27:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_int256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,int256)" + } + }, + "id": 2833, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9052:58:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_int256_$", + "typeString": "tuple(bool,int256)" + } + }, + "functionReturnParameters": 2824, + "id": 2834, + "nodeType": "Return", + "src": "9045:65:14" + } + ] + }, + "documentation": { + "id": 2816, + "nodeType": "StructuredDocumentation", + "src": "8650:287:14", + "text": " @dev Variant of {parseInt-string} that returns false if the parsing fails because of an invalid character or if\n the result does not fit in a `int256`.\n NOTE: This function will revert if the absolute value of the result does not fit in a `uint256`." + }, + "id": 2836, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryParseInt", + "nameLocation": "8951:11:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2819, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2818, + "mutability": "mutable", + "name": "input", + "nameLocation": "8977:5:14", + "nodeType": "VariableDeclaration", + "scope": 2836, + "src": "8963:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2817, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "8963:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "8962:21:14" + }, + "returnParameters": { + "id": 2824, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2821, + "mutability": "mutable", + "name": "success", + "nameLocation": "9012:7:14", + "nodeType": "VariableDeclaration", + "scope": 2836, + "src": "9007:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2820, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "9007:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2823, + "mutability": "mutable", + "name": "value", + "nameLocation": "9028:5:14", + "nodeType": "VariableDeclaration", + "scope": 2836, + "src": "9021:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 2822, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "9021:6:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "9006:28:14" + }, + "scope": 3678, + "src": "8942:175:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "constant": true, + "id": 2841, + "mutability": "constant", + "name": "ABS_MIN_INT256", + "nameLocation": "9148:14:14", + "nodeType": "VariableDeclaration", + "scope": 3678, + "src": "9123:50:14", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2837, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "9123:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "commonType": { + "typeIdentifier": "t_rational_57896044618658097711785492504343953926634992332820282019728792003956564819968_by_1", + "typeString": "int_const 5789...(69 digits omitted)...9968" + }, + "id": 2840, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 2838, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9165:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "323535", + "id": 2839, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9170:3:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "255" + }, + "src": "9165:8:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_57896044618658097711785492504343953926634992332820282019728792003956564819968_by_1", + "typeString": "int_const 5789...(69 digits omitted)...9968" + } + }, + "visibility": "private" + }, + { + "body": { + "id": 2877, + "nodeType": "Block", + "src": "9639:143:14", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 2865, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2861, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2855, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2848, + "src": "9653:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 2858, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2844, + "src": "9665:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2857, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "9659:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2856, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "9659:5:14", + "typeDescriptions": {} + } + }, + "id": 2859, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9659:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2860, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "9672:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "9659:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "9653:25:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2864, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2862, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2846, + "src": "9682:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "id": 2863, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2848, + "src": "9690:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "9682:11:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "9653:40:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2870, + "nodeType": "IfStatement", + "src": "9649:63:14", + "trueBody": { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 2866, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9703:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "hexValue": "30", + "id": 2867, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9710:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "id": 2868, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "9702:10:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$", + "typeString": "tuple(bool,int_const 0)" + } + }, + "functionReturnParameters": 2854, + "id": 2869, + "nodeType": "Return", + "src": "9695:17:14" + } + }, + { + "expression": { + "arguments": [ + { + "id": 2872, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2844, + "src": "9757:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "id": 2873, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2846, + "src": "9764:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2874, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2848, + "src": "9771:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2871, + "name": "_tryParseIntUncheckedBounds", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2999, + "src": "9729:27:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_int256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,int256)" + } + }, + "id": 2875, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9729:46:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_int256_$", + "typeString": "tuple(bool,int256)" + } + }, + "functionReturnParameters": 2854, + "id": 2876, + "nodeType": "Return", + "src": "9722:53:14" + } + ] + }, + "documentation": { + "id": 2842, + "nodeType": "StructuredDocumentation", + "src": "9180:303:14", + "text": " @dev Variant of {parseInt-string-uint256-uint256} that returns false if the parsing fails because of an invalid\n character or if the result does not fit in a `int256`.\n NOTE: This function will revert if the absolute value of the result does not fit in a `uint256`." + }, + "id": 2878, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryParseInt", + "nameLocation": "9497:11:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2849, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2844, + "mutability": "mutable", + "name": "input", + "nameLocation": "9532:5:14", + "nodeType": "VariableDeclaration", + "scope": 2878, + "src": "9518:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2843, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "9518:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2846, + "mutability": "mutable", + "name": "begin", + "nameLocation": "9555:5:14", + "nodeType": "VariableDeclaration", + "scope": 2878, + "src": "9547:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2845, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "9547:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2848, + "mutability": "mutable", + "name": "end", + "nameLocation": "9578:3:14", + "nodeType": "VariableDeclaration", + "scope": 2878, + "src": "9570:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2847, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "9570:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "9508:79:14" + }, + "returnParameters": { + "id": 2854, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2851, + "mutability": "mutable", + "name": "success", + "nameLocation": "9616:7:14", + "nodeType": "VariableDeclaration", + "scope": 2878, + "src": "9611:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2850, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "9611:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2853, + "mutability": "mutable", + "name": "value", + "nameLocation": "9632:5:14", + "nodeType": "VariableDeclaration", + "scope": 2878, + "src": "9625:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 2852, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "9625:6:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "9610:28:14" + }, + "scope": 3678, + "src": "9488:294:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2998, + "nodeType": "Block", + "src": "10182:812:14", + "statements": [ + { + "assignments": [ + 2893 + ], + "declarations": [ + { + "constant": false, + "id": 2893, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "10205:6:14", + "nodeType": "VariableDeclaration", + "scope": 2998, + "src": "10192:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2892, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "10192:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 2898, + "initialValue": { + "arguments": [ + { + "id": 2896, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2881, + "src": "10220:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2895, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10214:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2894, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "10214:5:14", + "typeDescriptions": {} + } + }, + "id": 2897, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10214:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "10192:34:14" + }, + { + "assignments": [ + 2900 + ], + "declarations": [ + { + "constant": false, + "id": 2900, + "mutability": "mutable", + "name": "sign", + "nameLocation": "10290:4:14", + "nodeType": "VariableDeclaration", + "scope": 2998, + "src": "10283:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 2899, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "10283:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + } + ], + "id": 2916, + "initialValue": { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2903, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2901, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2883, + "src": "10297:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 2902, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2885, + "src": "10306:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10297:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseExpression": { + "arguments": [ + { + "arguments": [ + { + "id": 2911, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2893, + "src": "10354:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 2912, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2883, + "src": "10362:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2910, + "name": "_unsafeReadBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3665, + "src": "10331:22:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (bytes memory,uint256) pure returns (bytes32)" + } + }, + "id": 2913, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10331:37:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 2909, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10324:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 2908, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "10324:6:14", + "typeDescriptions": {} + } + }, + "id": 2914, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10324:45:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 2915, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "Conditional", + "src": "10297:72:14", + "trueExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 2906, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10319:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 2905, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10312:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 2904, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "10312:6:14", + "typeDescriptions": {} + } + }, + "id": 2907, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10312:9:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "10283:86:14" + }, + { + "assignments": [ + 2918 + ], + "declarations": [ + { + "constant": false, + "id": 2918, + "mutability": "mutable", + "name": "positiveSign", + "nameLocation": "10455:12:14", + "nodeType": "VariableDeclaration", + "scope": 2998, + "src": "10450:17:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2917, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "10450:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "id": 2925, + "initialValue": { + "commonType": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "id": 2924, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2919, + "name": "sign", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2900, + "src": "10470:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "arguments": [ + { + "hexValue": "2b", + "id": 2922, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10485:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_728b8dbbe730d9acd55e30e768e6a28a04bea0c61b88108287c2c87d79c98bb8", + "typeString": "literal_string \"+\"" + }, + "value": "+" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_728b8dbbe730d9acd55e30e768e6a28a04bea0c61b88108287c2c87d79c98bb8", + "typeString": "literal_string \"+\"" + } + ], + "id": 2921, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10478:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 2920, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "10478:6:14", + "typeDescriptions": {} + } + }, + "id": 2923, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10478:11:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "src": "10470:19:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "10450:39:14" + }, + { + "assignments": [ + 2927 + ], + "declarations": [ + { + "constant": false, + "id": 2927, + "mutability": "mutable", + "name": "negativeSign", + "nameLocation": "10504:12:14", + "nodeType": "VariableDeclaration", + "scope": 2998, + "src": "10499:17:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2926, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "10499:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "id": 2934, + "initialValue": { + "commonType": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "id": 2933, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2928, + "name": "sign", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2900, + "src": "10519:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "arguments": [ + { + "hexValue": "2d", + "id": 2931, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10534:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_d3b8281179950f98149eefdb158d0e1acb56f56e8e343aa9fefafa7e36959561", + "typeString": "literal_string \"-\"" + }, + "value": "-" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_d3b8281179950f98149eefdb158d0e1acb56f56e8e343aa9fefafa7e36959561", + "typeString": "literal_string \"-\"" + } + ], + "id": 2930, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10527:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 2929, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "10527:6:14", + "typeDescriptions": {} + } + }, + "id": 2932, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10527:11:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "src": "10519:19:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "10499:39:14" + }, + { + "assignments": [ + 2936 + ], + "declarations": [ + { + "constant": false, + "id": 2936, + "mutability": "mutable", + "name": "offset", + "nameLocation": "10556:6:14", + "nodeType": "VariableDeclaration", + "scope": 2998, + "src": "10548:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2935, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10548:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2943, + "initialValue": { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 2939, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2937, + "name": "positiveSign", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2918, + "src": "10566:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "id": 2938, + "name": "negativeSign", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2927, + "src": "10582:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "10566:28:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "id": 2940, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "10565:30:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2941, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "10596:6:14", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "10565:37:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$attached_to$_t_bool_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 2942, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10565:39:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "10548:56:14" + }, + { + "assignments": [ + 2945, + 2947 + ], + "declarations": [ + { + "constant": false, + "id": 2945, + "mutability": "mutable", + "name": "absSuccess", + "nameLocation": "10621:10:14", + "nodeType": "VariableDeclaration", + "scope": 2998, + "src": "10616:15:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2944, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "10616:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2947, + "mutability": "mutable", + "name": "absValue", + "nameLocation": "10641:8:14", + "nodeType": "VariableDeclaration", + "scope": 2998, + "src": "10633:16:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2946, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10633:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2955, + "initialValue": { + "arguments": [ + { + "id": 2949, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2881, + "src": "10666:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2952, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2950, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2883, + "src": "10673:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "id": 2951, + "name": "offset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2936, + "src": "10681:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10673:14:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2953, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2885, + "src": "10689:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2948, + "name": "tryParseUint", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2658, + 2695 + ], + "referencedDeclaration": 2695, + "src": "10653:12:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 2954, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10653:40:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "10615:78:14" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 2960, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2956, + "name": "absSuccess", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2945, + "src": "10708:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2959, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2957, + "name": "absValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2947, + "src": "10722:8:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 2958, + "name": "ABS_MIN_INT256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2841, + "src": "10733:14:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10722:25:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "10708:39:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 2982, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 2978, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2976, + "name": "absSuccess", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2945, + "src": "10850:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "id": 2977, + "name": "negativeSign", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2927, + "src": "10864:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "10850:26:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2981, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2979, + "name": "absValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2947, + "src": "10880:8:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 2980, + "name": "ABS_MIN_INT256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2841, + "src": "10892:14:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10880:26:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "10850:56:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 2992, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10978:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "hexValue": "30", + "id": 2993, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10985:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "id": 2994, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "10977:10:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$", + "typeString": "tuple(bool,int_const 0)" + } + }, + "functionReturnParameters": 2891, + "id": 2995, + "nodeType": "Return", + "src": "10970:17:14" + }, + "id": 2996, + "nodeType": "IfStatement", + "src": "10846:141:14", + "trueBody": { + "id": 2991, + "nodeType": "Block", + "src": "10908:56:14", + "statements": [ + { + "expression": { + "components": [ + { + "hexValue": "74727565", + "id": 2983, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10930:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + { + "expression": { + "arguments": [ + { + "id": 2986, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10941:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + }, + "typeName": { + "id": 2985, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "10941:6:14", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + } + ], + "id": 2984, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "10936:4:14", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 2987, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10936:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_int256", + "typeString": "type(int256)" + } + }, + "id": 2988, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "10949:3:14", + "memberName": "min", + "nodeType": "MemberAccess", + "src": "10936:16:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 2989, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "10929:24:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_int256_$", + "typeString": "tuple(bool,int256)" + } + }, + "functionReturnParameters": 2891, + "id": 2990, + "nodeType": "Return", + "src": "10922:31:14" + } + ] + } + }, + "id": 2997, + "nodeType": "IfStatement", + "src": "10704:283:14", + "trueBody": { + "id": 2975, + "nodeType": "Block", + "src": "10749:91:14", + "statements": [ + { + "expression": { + "components": [ + { + "hexValue": "74727565", + "id": 2961, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10771:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + { + "condition": { + "id": 2962, + "name": "negativeSign", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2927, + "src": "10777:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseExpression": { + "arguments": [ + { + "id": 2970, + "name": "absValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2947, + "src": "10819:8:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2969, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10812:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + }, + "typeName": { + "id": 2968, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "10812:6:14", + "typeDescriptions": {} + } + }, + "id": 2971, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10812:16:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "id": 2972, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "Conditional", + "src": "10777:51:14", + "trueExpression": { + "id": 2967, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "-", + "prefix": true, + "src": "10792:17:14", + "subExpression": { + "arguments": [ + { + "id": 2965, + "name": "absValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2947, + "src": "10800:8:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2964, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10793:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + }, + "typeName": { + "id": 2963, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "10793:6:14", + "typeDescriptions": {} + } + }, + "id": 2966, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10793:16:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 2973, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "10770:59:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_int256_$", + "typeString": "tuple(bool,int256)" + } + }, + "functionReturnParameters": 2891, + "id": 2974, + "nodeType": "Return", + "src": "10763:66:14" + } + ] + } + } + ] + }, + "documentation": { + "id": 2879, + "nodeType": "StructuredDocumentation", + "src": "9788:223:14", + "text": " @dev Implementation of {tryParseInt-string-uint256-uint256} that does not check bounds. Caller should make sure that\n `begin <= end <= input.length`. Other inputs would result in undefined behavior." + }, + "id": 2999, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_tryParseIntUncheckedBounds", + "nameLocation": "10025:27:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2886, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2881, + "mutability": "mutable", + "name": "input", + "nameLocation": "10076:5:14", + "nodeType": "VariableDeclaration", + "scope": 2999, + "src": "10062:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2880, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "10062:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2883, + "mutability": "mutable", + "name": "begin", + "nameLocation": "10099:5:14", + "nodeType": "VariableDeclaration", + "scope": 2999, + "src": "10091:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2882, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10091:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2885, + "mutability": "mutable", + "name": "end", + "nameLocation": "10122:3:14", + "nodeType": "VariableDeclaration", + "scope": 2999, + "src": "10114:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2884, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10114:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "10052:79:14" + }, + "returnParameters": { + "id": 2891, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2888, + "mutability": "mutable", + "name": "success", + "nameLocation": "10159:7:14", + "nodeType": "VariableDeclaration", + "scope": 2999, + "src": "10154:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2887, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "10154:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2890, + "mutability": "mutable", + "name": "value", + "nameLocation": "10175:5:14", + "nodeType": "VariableDeclaration", + "scope": 2999, + "src": "10168:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 2889, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "10168:6:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "10153:28:14" + }, + "scope": 3678, + "src": "10016:978:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 3017, + "nodeType": "Block", + "src": "11339:67:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3008, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3002, + "src": "11369:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "hexValue": "30", + "id": 3009, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11376:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "expression": { + "arguments": [ + { + "id": 3012, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3002, + "src": "11385:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 3011, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "11379:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 3010, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "11379:5:14", + "typeDescriptions": {} + } + }, + "id": 3013, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11379:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 3014, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "11392:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "11379:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3007, + "name": "parseHexUint", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3018, + 3049 + ], + "referencedDeclaration": 3049, + "src": "11356:12:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (uint256)" + } + }, + "id": 3015, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11356:43:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 3006, + "id": 3016, + "nodeType": "Return", + "src": "11349:50:14" + } + ] + }, + "documentation": { + "id": 3000, + "nodeType": "StructuredDocumentation", + "src": "11000:259:14", + "text": " @dev Parse a hexadecimal string (with or without \"0x\" prefix), and returns the value as a `uint256`.\n Requirements:\n - The string must be formatted as `(0x)?[0-9a-fA-F]*`\n - The result must fit in an `uint256` type." + }, + "id": 3018, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parseHexUint", + "nameLocation": "11273:12:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3003, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3002, + "mutability": "mutable", + "name": "input", + "nameLocation": "11300:5:14", + "nodeType": "VariableDeclaration", + "scope": 3018, + "src": "11286:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3001, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "11286:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "11285:21:14" + }, + "returnParameters": { + "id": 3006, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3005, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3018, + "src": "11330:7:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3004, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11330:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "11329:9:14" + }, + "scope": 3678, + "src": "11264:142:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3048, + "nodeType": "Block", + "src": "11827:156:14", + "statements": [ + { + "assignments": [ + 3031, + 3033 + ], + "declarations": [ + { + "constant": false, + "id": 3031, + "mutability": "mutable", + "name": "success", + "nameLocation": "11843:7:14", + "nodeType": "VariableDeclaration", + "scope": 3048, + "src": "11838:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3030, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "11838:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3033, + "mutability": "mutable", + "name": "value", + "nameLocation": "11860:5:14", + "nodeType": "VariableDeclaration", + "scope": 3048, + "src": "11852:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3032, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11852:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3039, + "initialValue": { + "arguments": [ + { + "id": 3035, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3021, + "src": "11885:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "id": 3036, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3023, + "src": "11892:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 3037, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3025, + "src": "11899:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3034, + "name": "tryParseHexUint", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3070, + 3107 + ], + "referencedDeclaration": 3107, + "src": "11869:15:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 3038, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11869:34:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "11837:66:14" + }, + { + "condition": { + "id": 3041, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "11917:8:14", + "subExpression": { + "id": 3040, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3031, + "src": "11918:7:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3045, + "nodeType": "IfStatement", + "src": "11913:41:14", + "trueBody": { + "errorCall": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 3042, + "name": "StringsInvalidChar", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2210, + "src": "11934:18:14", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$__$returns$_t_error_$", + "typeString": "function () pure returns (error)" + } + }, + "id": 3043, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11934:20:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 3044, + "nodeType": "RevertStatement", + "src": "11927:27:14" + } + }, + { + "expression": { + "id": 3046, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3033, + "src": "11971:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 3029, + "id": 3047, + "nodeType": "Return", + "src": "11964:12:14" + } + ] + }, + "documentation": { + "id": 3019, + "nodeType": "StructuredDocumentation", + "src": "11412:307:14", + "text": " @dev Variant of {parseHexUint-string} that parses a substring of `input` located between position `begin` (included) and\n `end` (excluded).\n Requirements:\n - The substring must be formatted as `(0x)?[0-9a-fA-F]*`\n - The result must fit in an `uint256` type." + }, + "id": 3049, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parseHexUint", + "nameLocation": "11733:12:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3026, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3021, + "mutability": "mutable", + "name": "input", + "nameLocation": "11760:5:14", + "nodeType": "VariableDeclaration", + "scope": 3049, + "src": "11746:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3020, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "11746:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3023, + "mutability": "mutable", + "name": "begin", + "nameLocation": "11775:5:14", + "nodeType": "VariableDeclaration", + "scope": 3049, + "src": "11767:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3022, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11767:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3025, + "mutability": "mutable", + "name": "end", + "nameLocation": "11790:3:14", + "nodeType": "VariableDeclaration", + "scope": 3049, + "src": "11782:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3024, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11782:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "11745:49:14" + }, + "returnParameters": { + "id": 3029, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3028, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3049, + "src": "11818:7:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3027, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11818:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "11817:9:14" + }, + "scope": 3678, + "src": "11724:259:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3069, + "nodeType": "Block", + "src": "12310:86:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3060, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3052, + "src": "12359:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "hexValue": "30", + "id": 3061, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12366:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "expression": { + "arguments": [ + { + "id": 3064, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3052, + "src": "12375:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 3063, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "12369:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 3062, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "12369:5:14", + "typeDescriptions": {} + } + }, + "id": 3065, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12369:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 3066, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "12382:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "12369:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3059, + "name": "_tryParseHexUintUncheckedBounds", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3210, + "src": "12327:31:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 3067, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12327:62:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "functionReturnParameters": 3058, + "id": 3068, + "nodeType": "Return", + "src": "12320:69:14" + } + ] + }, + "documentation": { + "id": 3050, + "nodeType": "StructuredDocumentation", + "src": "11989:218:14", + "text": " @dev Variant of {parseHexUint-string} that returns false if the parsing fails because of an invalid character.\n NOTE: This function will revert if the result does not fit in a `uint256`." + }, + "id": 3070, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryParseHexUint", + "nameLocation": "12221:15:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3053, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3052, + "mutability": "mutable", + "name": "input", + "nameLocation": "12251:5:14", + "nodeType": "VariableDeclaration", + "scope": 3070, + "src": "12237:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3051, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "12237:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "12236:21:14" + }, + "returnParameters": { + "id": 3058, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3055, + "mutability": "mutable", + "name": "success", + "nameLocation": "12286:7:14", + "nodeType": "VariableDeclaration", + "scope": 3070, + "src": "12281:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3054, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "12281:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3057, + "mutability": "mutable", + "name": "value", + "nameLocation": "12303:5:14", + "nodeType": "VariableDeclaration", + "scope": 3070, + "src": "12295:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3056, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12295:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "12280:29:14" + }, + "scope": 3678, + "src": "12212:184:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3106, + "nodeType": "Block", + "src": "12804:147:14", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 3094, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3090, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3084, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3077, + "src": "12818:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 3087, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3073, + "src": "12830:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 3086, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "12824:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 3085, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "12824:5:14", + "typeDescriptions": {} + } + }, + "id": 3088, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12824:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 3089, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "12837:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "12824:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "12818:25:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3093, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3091, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3075, + "src": "12847:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "id": 3092, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3077, + "src": "12855:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "12847:11:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "12818:40:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3099, + "nodeType": "IfStatement", + "src": "12814:63:14", + "trueBody": { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 3095, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12868:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "hexValue": "30", + "id": 3096, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12875:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "id": 3097, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12867:10:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$", + "typeString": "tuple(bool,int_const 0)" + } + }, + "functionReturnParameters": 3083, + "id": 3098, + "nodeType": "Return", + "src": "12860:17:14" + } + }, + { + "expression": { + "arguments": [ + { + "id": 3101, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3073, + "src": "12926:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "id": 3102, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3075, + "src": "12933:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 3103, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3077, + "src": "12940:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3100, + "name": "_tryParseHexUintUncheckedBounds", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3210, + "src": "12894:31:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 3104, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12894:50:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "functionReturnParameters": 3083, + "id": 3105, + "nodeType": "Return", + "src": "12887:57:14" + } + ] + }, + "documentation": { + "id": 3071, + "nodeType": "StructuredDocumentation", + "src": "12402:241:14", + "text": " @dev Variant of {parseHexUint-string-uint256-uint256} that returns false if the parsing fails because of an\n invalid character.\n NOTE: This function will revert if the result does not fit in a `uint256`." + }, + "id": 3107, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryParseHexUint", + "nameLocation": "12657:15:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3078, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3073, + "mutability": "mutable", + "name": "input", + "nameLocation": "12696:5:14", + "nodeType": "VariableDeclaration", + "scope": 3107, + "src": "12682:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3072, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "12682:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3075, + "mutability": "mutable", + "name": "begin", + "nameLocation": "12719:5:14", + "nodeType": "VariableDeclaration", + "scope": 3107, + "src": "12711:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3074, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12711:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3077, + "mutability": "mutable", + "name": "end", + "nameLocation": "12742:3:14", + "nodeType": "VariableDeclaration", + "scope": 3107, + "src": "12734:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3076, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12734:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "12672:79:14" + }, + "returnParameters": { + "id": 3083, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3080, + "mutability": "mutable", + "name": "success", + "nameLocation": "12780:7:14", + "nodeType": "VariableDeclaration", + "scope": 3107, + "src": "12775:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3079, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "12775:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3082, + "mutability": "mutable", + "name": "value", + "nameLocation": "12797:5:14", + "nodeType": "VariableDeclaration", + "scope": 3107, + "src": "12789:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3081, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12789:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "12774:29:14" + }, + "scope": 3678, + "src": "12648:303:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3209, + "nodeType": "Block", + "src": "13360:881:14", + "statements": [ + { + "assignments": [ + 3122 + ], + "declarations": [ + { + "constant": false, + "id": 3122, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "13383:6:14", + "nodeType": "VariableDeclaration", + "scope": 3209, + "src": "13370:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 3121, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "13370:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 3127, + "initialValue": { + "arguments": [ + { + "id": 3125, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3110, + "src": "13398:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 3124, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "13392:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 3123, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "13392:5:14", + "typeDescriptions": {} + } + }, + "id": 3126, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13392:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "13370:34:14" + }, + { + "assignments": [ + 3129 + ], + "declarations": [ + { + "constant": false, + "id": 3129, + "mutability": "mutable", + "name": "hasPrefix", + "nameLocation": "13457:9:14", + "nodeType": "VariableDeclaration", + "scope": 3209, + "src": "13452:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3128, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "13452:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "id": 3149, + "initialValue": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 3148, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3134, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3130, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3114, + "src": "13470:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3133, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3131, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3112, + "src": "13476:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "31", + "id": 3132, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13484:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "13476:9:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "13470:15:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "id": 3135, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13469:17:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + }, + "id": 3147, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "arguments": [ + { + "id": 3139, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3122, + "src": "13520:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3140, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3112, + "src": "13528:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3138, + "name": "_unsafeReadBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3665, + "src": "13497:22:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (bytes memory,uint256) pure returns (bytes32)" + } + }, + "id": 3141, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13497:37:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3137, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "13490:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes2_$", + "typeString": "type(bytes2)" + }, + "typeName": { + "id": 3136, + "name": "bytes2", + "nodeType": "ElementaryTypeName", + "src": "13490:6:14", + "typeDescriptions": {} + } + }, + "id": 3142, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13490:45:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "arguments": [ + { + "hexValue": "3078", + "id": 3145, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13546:4:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_39bef1777deb3dfb14f64b9f81ced092c501fee72f90e93d03bb95ee89df9837", + "typeString": "literal_string \"0x\"" + }, + "value": "0x" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_39bef1777deb3dfb14f64b9f81ced092c501fee72f90e93d03bb95ee89df9837", + "typeString": "literal_string \"0x\"" + } + ], + "id": 3144, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "13539:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes2_$", + "typeString": "type(bytes2)" + }, + "typeName": { + "id": 3143, + "name": "bytes2", + "nodeType": "ElementaryTypeName", + "src": "13539:6:14", + "typeDescriptions": {} + } + }, + "id": 3146, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13539:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "src": "13490:61:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "13469:82:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "13452:99:14" + }, + { + "assignments": [ + 3151 + ], + "declarations": [ + { + "constant": false, + "id": 3151, + "mutability": "mutable", + "name": "offset", + "nameLocation": "13640:6:14", + "nodeType": "VariableDeclaration", + "scope": 3209, + "src": "13632:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3150, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13632:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3157, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3156, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "id": 3152, + "name": "hasPrefix", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3129, + "src": "13649:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3153, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "13659:6:14", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "13649:16:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$attached_to$_t_bool_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 3154, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13649:18:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "hexValue": "32", + "id": 3155, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13670:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "13649:22:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "13632:39:14" + }, + { + "assignments": [ + 3159 + ], + "declarations": [ + { + "constant": false, + "id": 3159, + "mutability": "mutable", + "name": "result", + "nameLocation": "13690:6:14", + "nodeType": "VariableDeclaration", + "scope": 3209, + "src": "13682:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3158, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13682:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3161, + "initialValue": { + "hexValue": "30", + "id": 3160, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13699:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "13682:18:14" + }, + { + "body": { + "id": 3203, + "nodeType": "Block", + "src": "13757:447:14", + "statements": [ + { + "assignments": [ + 3175 + ], + "declarations": [ + { + "constant": false, + "id": 3175, + "mutability": "mutable", + "name": "chr", + "nameLocation": "13777:3:14", + "nodeType": "VariableDeclaration", + "scope": 3203, + "src": "13771:9:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 3174, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "13771:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "id": 3185, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "id": 3180, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3122, + "src": "13826:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3181, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3163, + "src": "13834:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3179, + "name": "_unsafeReadBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3665, + "src": "13803:22:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (bytes memory,uint256) pure returns (bytes32)" + } + }, + "id": 3182, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13803:33:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3178, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "13796:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 3177, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "13796:6:14", + "typeDescriptions": {} + } + }, + "id": 3183, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13796:41:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 3176, + "name": "_tryParseChr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3445, + "src": "13783:12:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes1_$returns$_t_uint8_$", + "typeString": "function (bytes1) pure returns (uint8)" + } + }, + "id": 3184, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13783:55:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "13771:67:14" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3188, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3186, + "name": "chr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3175, + "src": "13856:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "3135", + "id": 3187, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13862:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_15_by_1", + "typeString": "int_const 15" + }, + "value": "15" + }, + "src": "13856:8:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3193, + "nodeType": "IfStatement", + "src": "13852:31:14", + "trueBody": { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 3189, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13874:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "hexValue": "30", + "id": 3190, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13881:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "id": 3191, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13873:10:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$", + "typeString": "tuple(bool,int_const 0)" + } + }, + "functionReturnParameters": 3120, + "id": 3192, + "nodeType": "Return", + "src": "13866:17:14" + } + }, + { + "expression": { + "id": 3196, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 3194, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3159, + "src": "13897:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "*=", + "rightHandSide": { + "hexValue": "3136", + "id": 3195, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13907:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "13897:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 3197, + "nodeType": "ExpressionStatement", + "src": "13897:12:14" + }, + { + "id": 3202, + "nodeType": "UncheckedBlock", + "src": "13923:271:14", + "statements": [ + { + "expression": { + "id": 3200, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 3198, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3159, + "src": "14166:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "id": 3199, + "name": "chr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3175, + "src": "14176:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "src": "14166:13:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 3201, + "nodeType": "ExpressionStatement", + "src": "14166:13:14" + } + ] + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3170, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3168, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3163, + "src": "13743:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 3169, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3114, + "src": "13747:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "13743:7:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3204, + "initializationExpression": { + "assignments": [ + 3163 + ], + "declarations": [ + { + "constant": false, + "id": 3163, + "mutability": "mutable", + "name": "i", + "nameLocation": "13723:1:14", + "nodeType": "VariableDeclaration", + "scope": 3204, + "src": "13715:9:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3162, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13715:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3167, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3166, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3164, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3112, + "src": "13727:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "id": 3165, + "name": "offset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3151, + "src": "13735:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "13727:14:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "13715:26:14" + }, + "isSimpleCounterLoop": true, + "loopExpression": { + "expression": { + "id": 3172, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": true, + "src": "13752:3:14", + "subExpression": { + "id": 3171, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3163, + "src": "13754:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 3173, + "nodeType": "ExpressionStatement", + "src": "13752:3:14" + }, + "nodeType": "ForStatement", + "src": "13710:494:14" + }, + { + "expression": { + "components": [ + { + "hexValue": "74727565", + "id": 3205, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14221:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + { + "id": 3206, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3159, + "src": "14227:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 3207, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "14220:14:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "functionReturnParameters": 3120, + "id": 3208, + "nodeType": "Return", + "src": "14213:21:14" + } + ] + }, + "documentation": { + "id": 3108, + "nodeType": "StructuredDocumentation", + "src": "12957:227:14", + "text": " @dev Implementation of {tryParseHexUint-string-uint256-uint256} that does not check bounds. Caller should make sure that\n `begin <= end <= input.length`. Other inputs would result in undefined behavior." + }, + "id": 3210, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_tryParseHexUintUncheckedBounds", + "nameLocation": "13198:31:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3115, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3110, + "mutability": "mutable", + "name": "input", + "nameLocation": "13253:5:14", + "nodeType": "VariableDeclaration", + "scope": 3210, + "src": "13239:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3109, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "13239:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3112, + "mutability": "mutable", + "name": "begin", + "nameLocation": "13276:5:14", + "nodeType": "VariableDeclaration", + "scope": 3210, + "src": "13268:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3111, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13268:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3114, + "mutability": "mutable", + "name": "end", + "nameLocation": "13299:3:14", + "nodeType": "VariableDeclaration", + "scope": 3210, + "src": "13291:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3113, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13291:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "13229:79:14" + }, + "returnParameters": { + "id": 3120, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3117, + "mutability": "mutable", + "name": "success", + "nameLocation": "13336:7:14", + "nodeType": "VariableDeclaration", + "scope": 3210, + "src": "13331:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3116, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "13331:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3119, + "mutability": "mutable", + "name": "value", + "nameLocation": "13353:5:14", + "nodeType": "VariableDeclaration", + "scope": 3210, + "src": "13345:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3118, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13345:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "13330:29:14" + }, + "scope": 3678, + "src": "13189:1052:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 3228, + "nodeType": "Block", + "src": "14539:67:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3219, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3213, + "src": "14569:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "hexValue": "30", + "id": 3220, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14576:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "expression": { + "arguments": [ + { + "id": 3223, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3213, + "src": "14585:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 3222, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "14579:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 3221, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "14579:5:14", + "typeDescriptions": {} + } + }, + "id": 3224, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14579:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 3225, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "14592:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "14579:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3218, + "name": "parseAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3229, + 3260 + ], + "referencedDeclaration": 3260, + "src": "14556:12:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_address_$", + "typeString": "function (string memory,uint256,uint256) pure returns (address)" + } + }, + "id": 3226, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14556:43:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 3217, + "id": 3227, + "nodeType": "Return", + "src": "14549:50:14" + } + ] + }, + "documentation": { + "id": 3211, + "nodeType": "StructuredDocumentation", + "src": "14247:212:14", + "text": " @dev Parse a hexadecimal string (with or without \"0x\" prefix), and returns the value as an `address`.\n Requirements:\n - The string must be formatted as `(0x)?[0-9a-fA-F]{40}`" + }, + "id": 3229, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parseAddress", + "nameLocation": "14473:12:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3214, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3213, + "mutability": "mutable", + "name": "input", + "nameLocation": "14500:5:14", + "nodeType": "VariableDeclaration", + "scope": 3229, + "src": "14486:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3212, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "14486:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "14485:21:14" + }, + "returnParameters": { + "id": 3217, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3216, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3229, + "src": "14530:7:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3215, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "14530:7:14", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "14529:9:14" + }, + "scope": 3678, + "src": "14464:142:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3259, + "nodeType": "Block", + "src": "14979:165:14", + "statements": [ + { + "assignments": [ + 3242, + 3244 + ], + "declarations": [ + { + "constant": false, + "id": 3242, + "mutability": "mutable", + "name": "success", + "nameLocation": "14995:7:14", + "nodeType": "VariableDeclaration", + "scope": 3259, + "src": "14990:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3241, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "14990:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3244, + "mutability": "mutable", + "name": "value", + "nameLocation": "15012:5:14", + "nodeType": "VariableDeclaration", + "scope": 3259, + "src": "15004:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3243, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "15004:7:14", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "id": 3250, + "initialValue": { + "arguments": [ + { + "id": 3246, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3232, + "src": "15037:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "id": 3247, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3234, + "src": "15044:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 3248, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3236, + "src": "15051:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3245, + "name": "tryParseAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3281, + 3385 + ], + "referencedDeclaration": 3385, + "src": "15021:15:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_address_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,address)" + } + }, + "id": 3249, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15021:34:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_address_$", + "typeString": "tuple(bool,address)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "14989:66:14" + }, + { + "condition": { + "id": 3252, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "15069:8:14", + "subExpression": { + "id": 3251, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3242, + "src": "15070:7:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3256, + "nodeType": "IfStatement", + "src": "15065:50:14", + "trueBody": { + "errorCall": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 3253, + "name": "StringsInvalidAddressFormat", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2213, + "src": "15086:27:14", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$__$returns$_t_error_$", + "typeString": "function () pure returns (error)" + } + }, + "id": 3254, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15086:29:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 3255, + "nodeType": "RevertStatement", + "src": "15079:36:14" + } + }, + { + "expression": { + "id": 3257, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3244, + "src": "15132:5:14", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 3240, + "id": 3258, + "nodeType": "Return", + "src": "15125:12:14" + } + ] + }, + "documentation": { + "id": 3230, + "nodeType": "StructuredDocumentation", + "src": "14612:259:14", + "text": " @dev Variant of {parseAddress-string} that parses a substring of `input` located between position `begin` (included) and\n `end` (excluded).\n Requirements:\n - The substring must be formatted as `(0x)?[0-9a-fA-F]{40}`" + }, + "id": 3260, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parseAddress", + "nameLocation": "14885:12:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3237, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3232, + "mutability": "mutable", + "name": "input", + "nameLocation": "14912:5:14", + "nodeType": "VariableDeclaration", + "scope": 3260, + "src": "14898:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3231, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "14898:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3234, + "mutability": "mutable", + "name": "begin", + "nameLocation": "14927:5:14", + "nodeType": "VariableDeclaration", + "scope": 3260, + "src": "14919:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3233, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "14919:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3236, + "mutability": "mutable", + "name": "end", + "nameLocation": "14942:3:14", + "nodeType": "VariableDeclaration", + "scope": 3260, + "src": "14934:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3235, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "14934:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "14897:49:14" + }, + "returnParameters": { + "id": 3240, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3239, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3260, + "src": "14970:7:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3238, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "14970:7:14", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "14969:9:14" + }, + "scope": 3678, + "src": "14876:268:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3280, + "nodeType": "Block", + "src": "15451:70:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3271, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3263, + "src": "15484:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "hexValue": "30", + "id": 3272, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "15491:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "expression": { + "arguments": [ + { + "id": 3275, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3263, + "src": "15500:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 3274, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "15494:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 3273, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "15494:5:14", + "typeDescriptions": {} + } + }, + "id": 3276, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15494:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 3277, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "15507:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "15494:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3270, + "name": "tryParseAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3281, + 3385 + ], + "referencedDeclaration": 3385, + "src": "15468:15:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_address_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,address)" + } + }, + "id": 3278, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15468:46:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_address_$", + "typeString": "tuple(bool,address)" + } + }, + "functionReturnParameters": 3269, + "id": 3279, + "nodeType": "Return", + "src": "15461:53:14" + } + ] + }, + "documentation": { + "id": 3261, + "nodeType": "StructuredDocumentation", + "src": "15150:198:14", + "text": " @dev Variant of {parseAddress-string} that returns false if the parsing fails because the input is not a properly\n formatted address. See {parseAddress-string} requirements." + }, + "id": 3281, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryParseAddress", + "nameLocation": "15362:15:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3264, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3263, + "mutability": "mutable", + "name": "input", + "nameLocation": "15392:5:14", + "nodeType": "VariableDeclaration", + "scope": 3281, + "src": "15378:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3262, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "15378:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "15377:21:14" + }, + "returnParameters": { + "id": 3269, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3266, + "mutability": "mutable", + "name": "success", + "nameLocation": "15427:7:14", + "nodeType": "VariableDeclaration", + "scope": 3281, + "src": "15422:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3265, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "15422:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3268, + "mutability": "mutable", + "name": "value", + "nameLocation": "15444:5:14", + "nodeType": "VariableDeclaration", + "scope": 3281, + "src": "15436:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3267, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "15436:7:14", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "15421:29:14" + }, + "scope": 3678, + "src": "15353:168:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3384, + "nodeType": "Block", + "src": "15914:733:14", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 3305, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3301, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3295, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3288, + "src": "15928:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 3298, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3284, + "src": "15940:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 3297, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "15934:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 3296, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "15934:5:14", + "typeDescriptions": {} + } + }, + "id": 3299, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15934:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 3300, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "15947:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "15934:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "15928:25:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3304, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3302, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3286, + "src": "15957:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "id": 3303, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3288, + "src": "15965:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "15957:11:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "15928:40:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3313, + "nodeType": "IfStatement", + "src": "15924:72:14", + "trueBody": { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 3306, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "15978:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "arguments": [ + { + "hexValue": "30", + "id": 3309, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "15993:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 3308, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "15985:7:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3307, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "15985:7:14", + "typeDescriptions": {} + } + }, + "id": 3310, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15985:10:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "id": 3311, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "15977:19:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_address_$", + "typeString": "tuple(bool,address)" + } + }, + "functionReturnParameters": 3294, + "id": 3312, + "nodeType": "Return", + "src": "15970:26:14" + } + }, + { + "assignments": [ + 3315 + ], + "declarations": [ + { + "constant": false, + "id": 3315, + "mutability": "mutable", + "name": "hasPrefix", + "nameLocation": "16012:9:14", + "nodeType": "VariableDeclaration", + "scope": 3384, + "src": "16007:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3314, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "16007:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "id": 3338, + "initialValue": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 3337, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3320, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3316, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3288, + "src": "16025:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3319, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3317, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3286, + "src": "16031:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "31", + "id": 3318, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16039:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "16031:9:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "16025:15:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "id": 3321, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "16024:17:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + }, + "id": 3336, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "id": 3327, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3284, + "src": "16081:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 3326, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16075:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 3325, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "16075:5:14", + "typeDescriptions": {} + } + }, + "id": 3328, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16075:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3329, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3286, + "src": "16089:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3324, + "name": "_unsafeReadBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3665, + "src": "16052:22:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (bytes memory,uint256) pure returns (bytes32)" + } + }, + "id": 3330, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16052:43:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3323, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16045:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes2_$", + "typeString": "type(bytes2)" + }, + "typeName": { + "id": 3322, + "name": "bytes2", + "nodeType": "ElementaryTypeName", + "src": "16045:6:14", + "typeDescriptions": {} + } + }, + "id": 3331, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16045:51:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "arguments": [ + { + "hexValue": "3078", + "id": 3334, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16107:4:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_39bef1777deb3dfb14f64b9f81ced092c501fee72f90e93d03bb95ee89df9837", + "typeString": "literal_string \"0x\"" + }, + "value": "0x" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_39bef1777deb3dfb14f64b9f81ced092c501fee72f90e93d03bb95ee89df9837", + "typeString": "literal_string \"0x\"" + } + ], + "id": 3333, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16100:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes2_$", + "typeString": "type(bytes2)" + }, + "typeName": { + "id": 3332, + "name": "bytes2", + "nodeType": "ElementaryTypeName", + "src": "16100:6:14", + "typeDescriptions": {} + } + }, + "id": 3335, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16100:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "src": "16045:67:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "16024:88:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "16007:105:14" + }, + { + "assignments": [ + 3340 + ], + "declarations": [ + { + "constant": false, + "id": 3340, + "mutability": "mutable", + "name": "expectedLength", + "nameLocation": "16201:14:14", + "nodeType": "VariableDeclaration", + "scope": 3384, + "src": "16193:22:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3339, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "16193:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3348, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3347, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3430", + "id": 3341, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16218:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_40_by_1", + "typeString": "int_const 40" + }, + "value": "40" + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3346, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "id": 3342, + "name": "hasPrefix", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3315, + "src": "16223:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3343, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "16233:6:14", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "16223:16:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$attached_to$_t_bool_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 3344, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16223:18:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "hexValue": "32", + "id": 3345, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16244:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "16223:22:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "16218:27:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "16193:52:14" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3353, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3351, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3349, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3288, + "src": "16310:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "id": 3350, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3286, + "src": "16316:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "16310:11:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 3352, + "name": "expectedLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3340, + "src": "16325:14:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "16310:29:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 3382, + "nodeType": "Block", + "src": "16590:51:14", + "statements": [ + { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 3375, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16612:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "arguments": [ + { + "hexValue": "30", + "id": 3378, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16627:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 3377, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16619:7:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3376, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "16619:7:14", + "typeDescriptions": {} + } + }, + "id": 3379, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16619:10:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "id": 3380, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "16611:19:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_address_$", + "typeString": "tuple(bool,address)" + } + }, + "functionReturnParameters": 3294, + "id": 3381, + "nodeType": "Return", + "src": "16604:26:14" + } + ] + }, + "id": 3383, + "nodeType": "IfStatement", + "src": "16306:335:14", + "trueBody": { + "id": 3374, + "nodeType": "Block", + "src": "16341:243:14", + "statements": [ + { + "assignments": [ + 3355, + 3357 + ], + "declarations": [ + { + "constant": false, + "id": 3355, + "mutability": "mutable", + "name": "s", + "nameLocation": "16462:1:14", + "nodeType": "VariableDeclaration", + "scope": 3374, + "src": "16457:6:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3354, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "16457:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3357, + "mutability": "mutable", + "name": "v", + "nameLocation": "16473:1:14", + "nodeType": "VariableDeclaration", + "scope": 3374, + "src": "16465:9:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3356, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "16465:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3363, + "initialValue": { + "arguments": [ + { + "id": 3359, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3284, + "src": "16510:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "id": 3360, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3286, + "src": "16517:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 3361, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3288, + "src": "16524:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3358, + "name": "_tryParseHexUintUncheckedBounds", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3210, + "src": "16478:31:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 3362, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16478:50:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "16456:72:14" + }, + { + "expression": { + "components": [ + { + "id": 3364, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3355, + "src": "16550:1:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "arguments": [ + { + "arguments": [ + { + "id": 3369, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3357, + "src": "16569:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3368, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16561:7:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint160_$", + "typeString": "type(uint160)" + }, + "typeName": { + "id": 3367, + "name": "uint160", + "nodeType": "ElementaryTypeName", + "src": "16561:7:14", + "typeDescriptions": {} + } + }, + "id": 3370, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16561:10:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint160", + "typeString": "uint160" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint160", + "typeString": "uint160" + } + ], + "id": 3366, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16553:7:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3365, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "16553:7:14", + "typeDescriptions": {} + } + }, + "id": 3371, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16553:19:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "id": 3372, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "16549:24:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_address_$", + "typeString": "tuple(bool,address)" + } + }, + "functionReturnParameters": 3294, + "id": 3373, + "nodeType": "Return", + "src": "16542:31:14" + } + ] + } + } + ] + }, + "documentation": { + "id": 3282, + "nodeType": "StructuredDocumentation", + "src": "15527:226:14", + "text": " @dev Variant of {parseAddress-string-uint256-uint256} that returns false if the parsing fails because input is not a properly\n formatted address. See {parseAddress-string-uint256-uint256} requirements." + }, + "id": 3385, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryParseAddress", + "nameLocation": "15767:15:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3289, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3284, + "mutability": "mutable", + "name": "input", + "nameLocation": "15806:5:14", + "nodeType": "VariableDeclaration", + "scope": 3385, + "src": "15792:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3283, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "15792:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3286, + "mutability": "mutable", + "name": "begin", + "nameLocation": "15829:5:14", + "nodeType": "VariableDeclaration", + "scope": 3385, + "src": "15821:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3285, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "15821:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3288, + "mutability": "mutable", + "name": "end", + "nameLocation": "15852:3:14", + "nodeType": "VariableDeclaration", + "scope": 3385, + "src": "15844:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3287, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "15844:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "15782:79:14" + }, + "returnParameters": { + "id": 3294, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3291, + "mutability": "mutable", + "name": "success", + "nameLocation": "15890:7:14", + "nodeType": "VariableDeclaration", + "scope": 3385, + "src": "15885:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3290, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "15885:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3293, + "mutability": "mutable", + "name": "value", + "nameLocation": "15907:5:14", + "nodeType": "VariableDeclaration", + "scope": 3385, + "src": "15899:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3292, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "15899:7:14", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "15884:29:14" + }, + "scope": 3678, + "src": "15758:889:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3444, + "nodeType": "Block", + "src": "16716:461:14", + "statements": [ + { + "assignments": [ + 3393 + ], + "declarations": [ + { + "constant": false, + "id": 3393, + "mutability": "mutable", + "name": "value", + "nameLocation": "16732:5:14", + "nodeType": "VariableDeclaration", + "scope": 3444, + "src": "16726:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 3392, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "16726:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "id": 3398, + "initialValue": { + "arguments": [ + { + "id": 3396, + "name": "chr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3387, + "src": "16746:3:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 3395, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16740:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": { + "id": 3394, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "16740:5:14", + "typeDescriptions": {} + } + }, + "id": 3397, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16740:10:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "16726:24:14" + }, + { + "id": 3441, + "nodeType": "UncheckedBlock", + "src": "16910:238:14", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 3405, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3401, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3399, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "16938:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "3437", + "id": 3400, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16946:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_47_by_1", + "typeString": "int_const 47" + }, + "value": "47" + }, + "src": "16938:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3404, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3402, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "16952:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "hexValue": "3538", + "id": 3403, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16960:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_58_by_1", + "typeString": "int_const 58" + }, + "value": "58" + }, + "src": "16952:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "16938:24:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 3416, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3412, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3410, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "16998:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "3936", + "id": 3411, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17006:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_96_by_1", + "typeString": "int_const 96" + }, + "value": "96" + }, + "src": "16998:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3415, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3413, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "17012:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "hexValue": "313033", + "id": 3414, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17020:3:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_103_by_1", + "typeString": "int_const 103" + }, + "value": "103" + }, + "src": "17012:11:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "16998:25:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 3427, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3423, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3421, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "17059:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "3634", + "id": 3422, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17067:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "17059:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3426, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3424, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "17073:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "hexValue": "3731", + "id": 3425, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17081:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_71_by_1", + "typeString": "int_const 71" + }, + "value": "71" + }, + "src": "17073:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "17059:24:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "expression": { + "expression": { + "arguments": [ + { + "id": 3434, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "17127:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": { + "id": 3433, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "17127:5:14", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + } + ], + "id": 3432, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "17122:4:14", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 3435, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "17122:11:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint8", + "typeString": "type(uint8)" + } + }, + "id": 3436, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "17134:3:14", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "17122:15:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "functionReturnParameters": 3391, + "id": 3437, + "nodeType": "Return", + "src": "17115:22:14" + }, + "id": 3438, + "nodeType": "IfStatement", + "src": "17055:82:14", + "trueBody": { + "expression": { + "id": 3430, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 3428, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "17085:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "Assignment", + "operator": "-=", + "rightHandSide": { + "hexValue": "3535", + "id": 3429, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17094:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_55_by_1", + "typeString": "int_const 55" + }, + "value": "55" + }, + "src": "17085:11:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "id": 3431, + "nodeType": "ExpressionStatement", + "src": "17085:11:14" + } + }, + "id": 3439, + "nodeType": "IfStatement", + "src": "16994:143:14", + "trueBody": { + "expression": { + "id": 3419, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 3417, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "17025:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "Assignment", + "operator": "-=", + "rightHandSide": { + "hexValue": "3837", + "id": 3418, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17034:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_87_by_1", + "typeString": "int_const 87" + }, + "value": "87" + }, + "src": "17025:11:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "id": 3420, + "nodeType": "ExpressionStatement", + "src": "17025:11:14" + } + }, + "id": 3440, + "nodeType": "IfStatement", + "src": "16934:203:14", + "trueBody": { + "expression": { + "id": 3408, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 3406, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "16964:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "Assignment", + "operator": "-=", + "rightHandSide": { + "hexValue": "3438", + "id": 3407, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16973:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_48_by_1", + "typeString": "int_const 48" + }, + "value": "48" + }, + "src": "16964:11:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "id": 3409, + "nodeType": "ExpressionStatement", + "src": "16964:11:14" + } + } + ] + }, + { + "expression": { + "id": 3442, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "17165:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "functionReturnParameters": 3391, + "id": 3443, + "nodeType": "Return", + "src": "17158:12:14" + } + ] + }, + "id": 3445, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_tryParseChr", + "nameLocation": "16662:12:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3388, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3387, + "mutability": "mutable", + "name": "chr", + "nameLocation": "16682:3:14", + "nodeType": "VariableDeclaration", + "scope": 3445, + "src": "16675:10:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 3386, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "16675:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + } + ], + "src": "16674:12:14" + }, + "returnParameters": { + "id": 3391, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3390, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3445, + "src": "16709:5:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 3389, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "16709:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "src": "16708:7:14" + }, + "scope": 3678, + "src": "16653:524:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 3652, + "nodeType": "Block", + "src": "17984:2333:14", + "statements": [ + { + "assignments": [ + 3454 + ], + "declarations": [ + { + "constant": false, + "id": 3454, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "18007:6:14", + "nodeType": "VariableDeclaration", + "scope": 3652, + "src": "17994:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 3453, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "17994:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 3459, + "initialValue": { + "arguments": [ + { + "id": 3457, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3448, + "src": "18022:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 3456, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "18016:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 3455, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "18016:5:14", + "typeDescriptions": {} + } + }, + "id": 3458, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18016:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "17994:34:14" + }, + { + "assignments": [ + 3461 + ], + "declarations": [ + { + "constant": false, + "id": 3461, + "mutability": "mutable", + "name": "output", + "nameLocation": "18318:6:14", + "nodeType": "VariableDeclaration", + "scope": 3652, + "src": "18305:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 3460, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "18305:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 3462, + "nodeType": "VariableDeclarationStatement", + "src": "18305:19:14" + }, + { + "AST": { + "nativeSrc": "18359:45:14", + "nodeType": "YulBlock", + "src": "18359:45:14", + "statements": [ + { + "nativeSrc": "18373:21:14", + "nodeType": "YulAssignment", + "src": "18373:21:14", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "18389:4:14", + "nodeType": "YulLiteral", + "src": "18389:4:14", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "18383:5:14", + "nodeType": "YulIdentifier", + "src": "18383:5:14" + }, + "nativeSrc": "18383:11:14", + "nodeType": "YulFunctionCall", + "src": "18383:11:14" + }, + "variableNames": [ + { + "name": "output", + "nativeSrc": "18373:6:14", + "nodeType": "YulIdentifier", + "src": "18373:6:14" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 3461, + "isOffset": false, + "isSlot": false, + "src": "18373:6:14", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 3463, + "nodeType": "InlineAssembly", + "src": "18334:70:14" + }, + { + "assignments": [ + 3465 + ], + "declarations": [ + { + "constant": false, + "id": 3465, + "mutability": "mutable", + "name": "outputLength", + "nameLocation": "18421:12:14", + "nodeType": "VariableDeclaration", + "scope": 3652, + "src": "18413:20:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3464, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "18413:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3467, + "initialValue": { + "hexValue": "30", + "id": 3466, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18436:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "18413:24:14" + }, + { + "body": { + "id": 3644, + "nodeType": "Block", + "src": "18492:1584:14", + "statements": [ + { + "assignments": [ + 3480 + ], + "declarations": [ + { + "constant": false, + "id": 3480, + "mutability": "mutable", + "name": "char", + "nameLocation": "18512:4:14", + "nodeType": "VariableDeclaration", + "scope": 3644, + "src": "18506:10:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 3479, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "18506:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "id": 3491, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "id": 3486, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3454, + "src": "18555:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3487, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3469, + "src": "18563:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3485, + "name": "_unsafeReadBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3665, + "src": "18532:22:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (bytes memory,uint256) pure returns (bytes32)" + } + }, + "id": 3488, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18532:33:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3484, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "18525:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 3483, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "18525:6:14", + "typeDescriptions": {} + } + }, + "id": 3489, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18525:41:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 3482, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "18519:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": { + "id": 3481, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "18519:5:14", + "typeDescriptions": {} + } + }, + "id": 3490, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18519:48:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "18506:61:14" + }, + { + "condition": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3500, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3497, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3492, + "name": "SPECIAL_CHARS_LOOKUP", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2200, + "src": "18587:20:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3495, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 3493, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18611:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "id": 3494, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "18616:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "src": "18611:9:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 3496, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "18610:11:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "18587:34:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 3498, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "18586:36:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "hexValue": "30", + "id": 3499, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18626:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "18586:41:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "id": 3501, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "18585:43:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 3642, + "nodeType": "Block", + "src": "19972:94:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3633, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "20014:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3635, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "20022:14:14", + "subExpression": { + "id": 3634, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "20022:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [ + { + "id": 3638, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "20045:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + ], + "id": 3637, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "20038:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 3636, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "20038:6:14", + "typeDescriptions": {} + } + }, + "id": 3639, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "20038:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 3632, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19990:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3640, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19990:61:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3641, + "nodeType": "ExpressionStatement", + "src": "19990:61:14" + } + ] + }, + "id": 3643, + "nodeType": "IfStatement", + "src": "18581:1485:14", + "trueBody": { + "id": 3631, + "nodeType": "Block", + "src": "18630:1336:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3503, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "18672:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3505, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "18680:14:14", + "subExpression": { + "id": 3504, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "18680:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "5c", + "id": 3506, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18696:4:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_731553fa98541ade8b78284229adfe09a819380dee9244baac20dd1e0aa24095", + "typeString": "literal_string \"\\\"" + }, + "value": "\\" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_731553fa98541ade8b78284229adfe09a819380dee9244baac20dd1e0aa24095", + "typeString": "literal_string \"\\\"" + } + ], + "id": 3502, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "18648:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3507, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18648:53:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3508, + "nodeType": "ExpressionStatement", + "src": "18648:53:14" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3511, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3509, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "18723:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30783038", + "id": 3510, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18731:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "0x08" + }, + "src": "18723:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3521, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3519, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "18816:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30783039", + "id": 3520, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18824:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_9_by_1", + "typeString": "int_const 9" + }, + "value": "0x09" + }, + "src": "18816:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3531, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3529, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "18909:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30783061", + "id": 3530, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18917:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "0x0a" + }, + "src": "18909:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3541, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3539, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "19002:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30783063", + "id": 3540, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19010:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_12_by_1", + "typeString": "int_const 12" + }, + "value": "0x0c" + }, + "src": "19002:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3551, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3549, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "19095:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30783064", + "id": 3550, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19103:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_13_by_1", + "typeString": "int_const 13" + }, + "value": "0x0d" + }, + "src": "19095:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3561, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3559, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "19188:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30783563", + "id": 3560, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19196:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_92_by_1", + "typeString": "int_const 92" + }, + "value": "0x5c" + }, + "src": "19188:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3571, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3569, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "19282:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30783232", + "id": 3570, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19290:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_34_by_1", + "typeString": "int_const 34" + }, + "value": "0x22" + }, + "src": "19282:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 3623, + "nodeType": "Block", + "src": "19451:501:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3581, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "19571:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3583, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "19579:14:14", + "subExpression": { + "id": 3582, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "19579:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "75", + "id": 3584, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19595:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_32cefdcd8e794145c9af8dd1f4b1fbd92d6e547ae855553080fc8bd19c4883a0", + "typeString": "literal_string \"u\"" + }, + "value": "u" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_32cefdcd8e794145c9af8dd1f4b1fbd92d6e547ae855553080fc8bd19c4883a0", + "typeString": "literal_string \"u\"" + } + ], + "id": 3580, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19547:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3585, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19547:52:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3586, + "nodeType": "ExpressionStatement", + "src": "19547:52:14" + }, + { + "expression": { + "arguments": [ + { + "id": 3588, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "19645:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3590, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "19653:14:14", + "subExpression": { + "id": 3589, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "19653:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "30", + "id": 3591, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19669:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", + "typeString": "literal_string \"0\"" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", + "typeString": "literal_string \"0\"" + } + ], + "id": 3587, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19621:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3592, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19621:52:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3593, + "nodeType": "ExpressionStatement", + "src": "19621:52:14" + }, + { + "expression": { + "arguments": [ + { + "id": 3595, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "19719:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3597, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "19727:14:14", + "subExpression": { + "id": 3596, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "19727:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "30", + "id": 3598, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19743:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", + "typeString": "literal_string \"0\"" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", + "typeString": "literal_string \"0\"" + } + ], + "id": 3594, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19695:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3599, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19695:52:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3600, + "nodeType": "ExpressionStatement", + "src": "19695:52:14" + }, + { + "expression": { + "arguments": [ + { + "id": 3602, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "19793:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3604, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "19801:14:14", + "subExpression": { + "id": 3603, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "19801:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "baseExpression": { + "id": 3605, + "name": "HEX_DIGITS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2184, + "src": "19817:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "id": 3609, + "indexExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3608, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3606, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "19828:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "34", + "id": 3607, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19836:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "19828:9:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "19817:21:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 3601, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19769:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3610, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19769:70:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3611, + "nodeType": "ExpressionStatement", + "src": "19769:70:14" + }, + { + "expression": { + "arguments": [ + { + "id": 3613, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "19885:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3615, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "19893:14:14", + "subExpression": { + "id": 3614, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "19893:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "baseExpression": { + "id": 3616, + "name": "HEX_DIGITS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2184, + "src": "19909:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "id": 3620, + "indexExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3619, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3617, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "19920:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30783066", + "id": 3618, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19927:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_15_by_1", + "typeString": "int_const 15" + }, + "value": "0x0f" + }, + "src": "19920:11:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "19909:23:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 3612, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19861:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3621, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19861:72:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3622, + "nodeType": "ExpressionStatement", + "src": "19861:72:14" + } + ] + }, + "id": 3624, + "nodeType": "IfStatement", + "src": "19278:674:14", + "trueBody": { + "id": 3579, + "nodeType": "Block", + "src": "19296:149:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3573, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "19398:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3575, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "19406:14:14", + "subExpression": { + "id": 3574, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "19406:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "22", + "id": 3576, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19422:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_6e9f33448a4153023cdaf3eb759f1afdc24aba433a3e18b683f8c04a6eaa69f0", + "typeString": "literal_string \"\"\"" + }, + "value": "\"" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_6e9f33448a4153023cdaf3eb759f1afdc24aba433a3e18b683f8c04a6eaa69f0", + "typeString": "literal_string \"\"\"" + } + ], + "id": 3572, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19374:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3577, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19374:52:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3578, + "nodeType": "ExpressionStatement", + "src": "19374:52:14" + } + ] + } + }, + "id": 3625, + "nodeType": "IfStatement", + "src": "19184:768:14", + "trueBody": { + "expression": { + "arguments": [ + { + "id": 3563, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "19226:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3565, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "19234:14:14", + "subExpression": { + "id": 3564, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "19234:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "5c", + "id": 3566, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19250:4:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_731553fa98541ade8b78284229adfe09a819380dee9244baac20dd1e0aa24095", + "typeString": "literal_string \"\\\"" + }, + "value": "\\" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_731553fa98541ade8b78284229adfe09a819380dee9244baac20dd1e0aa24095", + "typeString": "literal_string \"\\\"" + } + ], + "id": 3562, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19202:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3567, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19202:53:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3568, + "nodeType": "ExpressionStatement", + "src": "19202:53:14" + } + }, + "id": 3626, + "nodeType": "IfStatement", + "src": "19091:861:14", + "trueBody": { + "expression": { + "arguments": [ + { + "id": 3553, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "19133:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3555, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "19141:14:14", + "subExpression": { + "id": 3554, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "19141:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "72", + "id": 3556, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19157:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_414f72a4d550cad29f17d9d99a4af64b3776ec5538cd440cef0f03fef2e9e010", + "typeString": "literal_string \"r\"" + }, + "value": "r" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_414f72a4d550cad29f17d9d99a4af64b3776ec5538cd440cef0f03fef2e9e010", + "typeString": "literal_string \"r\"" + } + ], + "id": 3552, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19109:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3557, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19109:52:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3558, + "nodeType": "ExpressionStatement", + "src": "19109:52:14" + } + }, + "id": 3627, + "nodeType": "IfStatement", + "src": "18998:954:14", + "trueBody": { + "expression": { + "arguments": [ + { + "id": 3543, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "19040:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3545, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "19048:14:14", + "subExpression": { + "id": 3544, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "19048:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "66", + "id": 3546, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19064:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_d1e8aeb79500496ef3dc2e57ba746a8315d048b7a664a2bf948db4fa91960483", + "typeString": "literal_string \"f\"" + }, + "value": "f" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_d1e8aeb79500496ef3dc2e57ba746a8315d048b7a664a2bf948db4fa91960483", + "typeString": "literal_string \"f\"" + } + ], + "id": 3542, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19016:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3547, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19016:52:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3548, + "nodeType": "ExpressionStatement", + "src": "19016:52:14" + } + }, + "id": 3628, + "nodeType": "IfStatement", + "src": "18905:1047:14", + "trueBody": { + "expression": { + "arguments": [ + { + "id": 3533, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "18947:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3535, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "18955:14:14", + "subExpression": { + "id": 3534, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "18955:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "6e", + "id": 3536, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18971:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_4b4ecedb4964a40fe416b16c7bd8b46092040ec42ef0aa69e59f09872f105cf3", + "typeString": "literal_string \"n\"" + }, + "value": "n" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_4b4ecedb4964a40fe416b16c7bd8b46092040ec42ef0aa69e59f09872f105cf3", + "typeString": "literal_string \"n\"" + } + ], + "id": 3532, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "18923:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3537, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18923:52:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3538, + "nodeType": "ExpressionStatement", + "src": "18923:52:14" + } + }, + "id": 3629, + "nodeType": "IfStatement", + "src": "18812:1140:14", + "trueBody": { + "expression": { + "arguments": [ + { + "id": 3523, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "18854:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3525, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "18862:14:14", + "subExpression": { + "id": 3524, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "18862:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "74", + "id": 3526, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18878:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_cac1bb71f0a97c8ac94ca9546b43178a9ad254c7b757ac07433aa6df35cd8089", + "typeString": "literal_string \"t\"" + }, + "value": "t" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_cac1bb71f0a97c8ac94ca9546b43178a9ad254c7b757ac07433aa6df35cd8089", + "typeString": "literal_string \"t\"" + } + ], + "id": 3522, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "18830:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3527, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18830:52:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3528, + "nodeType": "ExpressionStatement", + "src": "18830:52:14" + } + }, + "id": 3630, + "nodeType": "IfStatement", + "src": "18719:1233:14", + "trueBody": { + "expression": { + "arguments": [ + { + "id": 3513, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "18761:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3515, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "18769:14:14", + "subExpression": { + "id": 3514, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "18769:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "62", + "id": 3516, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18785:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_b5553de315e0edf504d9150af82dafa5c4667fa618ed0a6f19c69b41166c5510", + "typeString": "literal_string \"b\"" + }, + "value": "b" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_b5553de315e0edf504d9150af82dafa5c4667fa618ed0a6f19c69b41166c5510", + "typeString": "literal_string \"b\"" + } + ], + "id": 3512, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "18737:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3517, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18737:52:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3518, + "nodeType": "ExpressionStatement", + "src": "18737:52:14" + } + } + ] + } + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3475, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3472, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3469, + "src": "18468:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "expression": { + "id": 3473, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3454, + "src": "18472:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 3474, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "18479:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "18472:13:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "18468:17:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3645, + "initializationExpression": { + "assignments": [ + 3469 + ], + "declarations": [ + { + "constant": false, + "id": 3469, + "mutability": "mutable", + "name": "i", + "nameLocation": "18461:1:14", + "nodeType": "VariableDeclaration", + "scope": 3645, + "src": "18453:9:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3468, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "18453:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3471, + "initialValue": { + "hexValue": "30", + "id": 3470, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18465:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "18453:13:14" + }, + "isSimpleCounterLoop": true, + "loopExpression": { + "expression": { + "id": 3477, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": true, + "src": "18487:3:14", + "subExpression": { + "id": 3476, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3469, + "src": "18489:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 3478, + "nodeType": "ExpressionStatement", + "src": "18487:3:14" + }, + "nodeType": "ForStatement", + "src": "18448:1628:14" + }, + { + "AST": { + "nativeSrc": "20164:115:14", + "nodeType": "YulBlock", + "src": "20164:115:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "output", + "nativeSrc": "20185:6:14", + "nodeType": "YulIdentifier", + "src": "20185:6:14" + }, + { + "name": "outputLength", + "nativeSrc": "20193:12:14", + "nodeType": "YulIdentifier", + "src": "20193:12:14" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "20178:6:14", + "nodeType": "YulIdentifier", + "src": "20178:6:14" + }, + "nativeSrc": "20178:28:14", + "nodeType": "YulFunctionCall", + "src": "20178:28:14" + }, + "nativeSrc": "20178:28:14", + "nodeType": "YulExpressionStatement", + "src": "20178:28:14" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "20226:4:14", + "nodeType": "YulLiteral", + "src": "20226:4:14", + "type": "", + "value": "0x40" + }, + { + "arguments": [ + { + "name": "output", + "nativeSrc": "20236:6:14", + "nodeType": "YulIdentifier", + "src": "20236:6:14" + }, + { + "arguments": [ + { + "name": "outputLength", + "nativeSrc": "20248:12:14", + "nodeType": "YulIdentifier", + "src": "20248:12:14" + }, + { + "kind": "number", + "nativeSrc": "20262:4:14", + "nodeType": "YulLiteral", + "src": "20262:4:14", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "20244:3:14", + "nodeType": "YulIdentifier", + "src": "20244:3:14" + }, + "nativeSrc": "20244:23:14", + "nodeType": "YulFunctionCall", + "src": "20244:23:14" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "20232:3:14", + "nodeType": "YulIdentifier", + "src": "20232:3:14" + }, + "nativeSrc": "20232:36:14", + "nodeType": "YulFunctionCall", + "src": "20232:36:14" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "20219:6:14", + "nodeType": "YulIdentifier", + "src": "20219:6:14" + }, + "nativeSrc": "20219:50:14", + "nodeType": "YulFunctionCall", + "src": "20219:50:14" + }, + "nativeSrc": "20219:50:14", + "nodeType": "YulExpressionStatement", + "src": "20219:50:14" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 3461, + "isOffset": false, + "isSlot": false, + "src": "20185:6:14", + "valueSize": 1 + }, + { + "declaration": 3461, + "isOffset": false, + "isSlot": false, + "src": "20236:6:14", + "valueSize": 1 + }, + { + "declaration": 3465, + "isOffset": false, + "isSlot": false, + "src": "20193:12:14", + "valueSize": 1 + }, + { + "declaration": 3465, + "isOffset": false, + "isSlot": false, + "src": "20248:12:14", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 3646, + "nodeType": "InlineAssembly", + "src": "20139:140:14" + }, + { + "expression": { + "arguments": [ + { + "id": 3649, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "20303:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 3648, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "20296:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_string_storage_ptr_$", + "typeString": "type(string storage pointer)" + }, + "typeName": { + "id": 3647, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "20296:6:14", + "typeDescriptions": {} + } + }, + "id": 3650, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "20296:14:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 3452, + "id": 3651, + "nodeType": "Return", + "src": "20289:21:14" + } + ] + }, + "documentation": { + "id": 3446, + "nodeType": "StructuredDocumentation", + "src": "17183:717:14", + "text": " @dev Escape special characters in JSON strings. This can be useful to prevent JSON injection in NFT metadata.\n WARNING: This function should only be used in double quoted JSON strings. Single quotes are not escaped.\n NOTE: This function escapes backslashes (including those in \\uXXXX sequences) and the characters in ranges\n defined in section 2.5 of RFC-4627 (U+0000 to U+001F, U+0022 and U+005C). All control characters in U+0000\n to U+001F are escaped (\\b, \\t, \\n, \\f, \\r use short form; others use \\u00XX). ECMAScript's `JSON.parse` does\n recover escaped unicode characters that are not in this range, but other tooling may provide different results." + }, + "id": 3653, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "escapeJSON", + "nameLocation": "17914:10:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3449, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3448, + "mutability": "mutable", + "name": "input", + "nameLocation": "17939:5:14", + "nodeType": "VariableDeclaration", + "scope": 3653, + "src": "17925:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3447, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "17925:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "17924:21:14" + }, + "returnParameters": { + "id": 3452, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3451, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3653, + "src": "17969:13:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3450, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "17969:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "17968:15:14" + }, + "scope": 3678, + "src": "17905:2412:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3664, + "nodeType": "Block", + "src": "20702:225:14", + "statements": [ + { + "AST": { + "nativeSrc": "20851:70:14", + "nodeType": "YulBlock", + "src": "20851:70:14", + "statements": [ + { + "nativeSrc": "20865:46:14", + "nodeType": "YulAssignment", + "src": "20865:46:14", + "value": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "20888:6:14", + "nodeType": "YulIdentifier", + "src": "20888:6:14" + }, + { + "kind": "number", + "nativeSrc": "20896:4:14", + "nodeType": "YulLiteral", + "src": "20896:4:14", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "20884:3:14", + "nodeType": "YulIdentifier", + "src": "20884:3:14" + }, + "nativeSrc": "20884:17:14", + "nodeType": "YulFunctionCall", + "src": "20884:17:14" + }, + { + "name": "offset", + "nativeSrc": "20903:6:14", + "nodeType": "YulIdentifier", + "src": "20903:6:14" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "20880:3:14", + "nodeType": "YulIdentifier", + "src": "20880:3:14" + }, + "nativeSrc": "20880:30:14", + "nodeType": "YulFunctionCall", + "src": "20880:30:14" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "20874:5:14", + "nodeType": "YulIdentifier", + "src": "20874:5:14" + }, + "nativeSrc": "20874:37:14", + "nodeType": "YulFunctionCall", + "src": "20874:37:14" + }, + "variableNames": [ + { + "name": "value", + "nativeSrc": "20865:5:14", + "nodeType": "YulIdentifier", + "src": "20865:5:14" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 3656, + "isOffset": false, + "isSlot": false, + "src": "20888:6:14", + "valueSize": 1 + }, + { + "declaration": 3658, + "isOffset": false, + "isSlot": false, + "src": "20903:6:14", + "valueSize": 1 + }, + { + "declaration": 3661, + "isOffset": false, + "isSlot": false, + "src": "20865:5:14", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 3663, + "nodeType": "InlineAssembly", + "src": "20826:95:14" + } + ] + }, + "documentation": { + "id": 3654, + "nodeType": "StructuredDocumentation", + "src": "20323:268:14", + "text": " @dev Reads a bytes32 from a bytes array without bounds checking.\n NOTE: making this function internal would mean it could be used with memory unsafe offset, and marking the\n assembly block as such would prevent some optimizations." + }, + "id": 3665, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_unsafeReadBytesOffset", + "nameLocation": "20605:22:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3659, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3656, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "20641:6:14", + "nodeType": "VariableDeclaration", + "scope": 3665, + "src": "20628:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 3655, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "20628:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3658, + "mutability": "mutable", + "name": "offset", + "nameLocation": "20657:6:14", + "nodeType": "VariableDeclaration", + "scope": 3665, + "src": "20649:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3657, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "20649:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "20627:37:14" + }, + "returnParameters": { + "id": 3662, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3661, + "mutability": "mutable", + "name": "value", + "nameLocation": "20695:5:14", + "nodeType": "VariableDeclaration", + "scope": 3665, + "src": "20687:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3660, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "20687:7:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "20686:15:14" + }, + "scope": 3678, + "src": "20596:331:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 3676, + "nodeType": "Block", + "src": "21300:235:14", + "statements": [ + { + "AST": { + "nativeSrc": "21449:80:14", + "nodeType": "YulBlock", + "src": "21449:80:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "21479:6:14", + "nodeType": "YulIdentifier", + "src": "21479:6:14" + }, + { + "kind": "number", + "nativeSrc": "21487:4:14", + "nodeType": "YulLiteral", + "src": "21487:4:14", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "21475:3:14", + "nodeType": "YulIdentifier", + "src": "21475:3:14" + }, + "nativeSrc": "21475:17:14", + "nodeType": "YulFunctionCall", + "src": "21475:17:14" + }, + { + "name": "offset", + "nativeSrc": "21494:6:14", + "nodeType": "YulIdentifier", + "src": "21494:6:14" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "21471:3:14", + "nodeType": "YulIdentifier", + "src": "21471:3:14" + }, + "nativeSrc": "21471:30:14", + "nodeType": "YulFunctionCall", + "src": "21471:30:14" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "21507:3:14", + "nodeType": "YulLiteral", + "src": "21507:3:14", + "type": "", + "value": "248" + }, + { + "name": "value", + "nativeSrc": "21512:5:14", + "nodeType": "YulIdentifier", + "src": "21512:5:14" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "21503:3:14", + "nodeType": "YulIdentifier", + "src": "21503:3:14" + }, + "nativeSrc": "21503:15:14", + "nodeType": "YulFunctionCall", + "src": "21503:15:14" + } + ], + "functionName": { + "name": "mstore8", + "nativeSrc": "21463:7:14", + "nodeType": "YulIdentifier", + "src": "21463:7:14" + }, + "nativeSrc": "21463:56:14", + "nodeType": "YulFunctionCall", + "src": "21463:56:14" + }, + "nativeSrc": "21463:56:14", + "nodeType": "YulExpressionStatement", + "src": "21463:56:14" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 3668, + "isOffset": false, + "isSlot": false, + "src": "21479:6:14", + "valueSize": 1 + }, + { + "declaration": 3670, + "isOffset": false, + "isSlot": false, + "src": "21494:6:14", + "valueSize": 1 + }, + { + "declaration": 3672, + "isOffset": false, + "isSlot": false, + "src": "21512:5:14", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 3675, + "nodeType": "InlineAssembly", + "src": "21424:105:14" + } + ] + }, + "documentation": { + "id": 3666, + "nodeType": "StructuredDocumentation", + "src": "20933:265:14", + "text": " @dev Write a bytes1 to a bytes array without bounds checking.\n NOTE: making this function internal would mean it could be used with memory unsafe offset, and marking the\n assembly block as such would prevent some optimizations." + }, + "id": 3677, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_unsafeWriteBytesOffset", + "nameLocation": "21212:23:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3673, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3668, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "21249:6:14", + "nodeType": "VariableDeclaration", + "scope": 3677, + "src": "21236:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 3667, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "21236:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3670, + "mutability": "mutable", + "name": "offset", + "nameLocation": "21265:6:14", + "nodeType": "VariableDeclaration", + "scope": 3677, + "src": "21257:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3669, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "21257:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3672, + "mutability": "mutable", + "name": "value", + "nameLocation": "21280:5:14", + "nodeType": "VariableDeclaration", + "scope": 3677, + "src": "21273:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 3671, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "21273:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + } + ], + "src": "21235:51:14" + }, + "returnParameters": { + "id": 3674, + "nodeType": "ParameterList", + "parameters": [], + "src": "21300:0:14" + }, + "scope": 3678, + "src": "21203:332:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "private" + } + ], + "scope": 3679, + "src": "332:21205:14", + "usedErrors": [ + 2207, + 2210, + 2213 + ], + "usedEvents": [] + } + ], + "src": "101:21437:14" + }, + "id": 14 + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/cryptography/ECDSA.sol", + "exportedSymbols": { + "ECDSA": [ + 4137 + ] + }, + "id": 4138, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 3680, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "112:24:15" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "ECDSA", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 3681, + "nodeType": "StructuredDocumentation", + "src": "138:205:15", + "text": " @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n These functions can be used to verify that a message was signed by the holder\n of the private keys of a given address." + }, + "fullyImplemented": true, + "id": 4137, + "linearizedBaseContracts": [ + 4137 + ], + "name": "ECDSA", + "nameLocation": "352:5:15", + "nodeType": "ContractDefinition", + "nodes": [ + { + "canonicalName": "ECDSA.RecoverError", + "id": 3686, + "members": [ + { + "id": 3682, + "name": "NoError", + "nameLocation": "392:7:15", + "nodeType": "EnumValue", + "src": "392:7:15" + }, + { + "id": 3683, + "name": "InvalidSignature", + "nameLocation": "409:16:15", + "nodeType": "EnumValue", + "src": "409:16:15" + }, + { + "id": 3684, + "name": "InvalidSignatureLength", + "nameLocation": "435:22:15", + "nodeType": "EnumValue", + "src": "435:22:15" + }, + { + "id": 3685, + "name": "InvalidSignatureS", + "nameLocation": "467:17:15", + "nodeType": "EnumValue", + "src": "467:17:15" + } + ], + "name": "RecoverError", + "nameLocation": "369:12:15", + "nodeType": "EnumDefinition", + "src": "364:126:15" + }, + { + "documentation": { + "id": 3687, + "nodeType": "StructuredDocumentation", + "src": "496:49:15", + "text": " @dev The signature is invalid." + }, + "errorSelector": "f645eedf", + "id": 3689, + "name": "ECDSAInvalidSignature", + "nameLocation": "556:21:15", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 3688, + "nodeType": "ParameterList", + "parameters": [], + "src": "577:2:15" + }, + "src": "550:30:15" + }, + { + "documentation": { + "id": 3690, + "nodeType": "StructuredDocumentation", + "src": "586:60:15", + "text": " @dev The signature has an invalid length." + }, + "errorSelector": "fce698f7", + "id": 3694, + "name": "ECDSAInvalidSignatureLength", + "nameLocation": "657:27:15", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 3693, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3692, + "mutability": "mutable", + "name": "length", + "nameLocation": "693:6:15", + "nodeType": "VariableDeclaration", + "scope": 3694, + "src": "685:14:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3691, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "685:7:15", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "684:16:15" + }, + "src": "651:50:15" + }, + { + "documentation": { + "id": 3695, + "nodeType": "StructuredDocumentation", + "src": "707:85:15", + "text": " @dev The signature has an S value that is in the upper half order." + }, + "errorSelector": "d78bce0c", + "id": 3699, + "name": "ECDSAInvalidSignatureS", + "nameLocation": "803:22:15", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 3698, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3697, + "mutability": "mutable", + "name": "s", + "nameLocation": "834:1:15", + "nodeType": "VariableDeclaration", + "scope": 3699, + "src": "826:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3696, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "826:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "825:11:15" + }, + "src": "797:40:15" + }, + { + "body": { + "id": 3751, + "nodeType": "Block", + "src": "2575:622:15", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3717, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 3714, + "name": "signature", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3704, + "src": "2589:9:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 3715, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2599:6:15", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "2589:16:15", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "3635", + "id": 3716, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2609:2:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_65_by_1", + "typeString": "int_const 65" + }, + "value": "65" + }, + "src": "2589:22:15", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 3749, + "nodeType": "Block", + "src": "3083:108:15", + "statements": [ + { + "expression": { + "components": [ + { + "arguments": [ + { + "hexValue": "30", + "id": 3738, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3113:1:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 3737, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3105:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3736, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3105:7:15", + "typeDescriptions": {} + } + }, + "id": 3739, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3105:10:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 3740, + "name": "RecoverError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3686, + "src": "3117:12:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_RecoverError_$3686_$", + "typeString": "type(enum ECDSA.RecoverError)" + } + }, + "id": 3741, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "3130:22:15", + "memberName": "InvalidSignatureLength", + "nodeType": "MemberAccess", + "referencedDeclaration": 3684, + "src": "3117:35:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + { + "arguments": [ + { + "expression": { + "id": 3744, + "name": "signature", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3704, + "src": "3162:9:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 3745, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3172:6:15", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "3162:16:15", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3743, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3154:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes32_$", + "typeString": "type(bytes32)" + }, + "typeName": { + "id": 3742, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3154:7:15", + "typeDescriptions": {} + } + }, + "id": 3746, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3154:25:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 3747, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "3104:76:15", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "functionReturnParameters": 3713, + "id": 3748, + "nodeType": "Return", + "src": "3097:83:15" + } + ] + }, + "id": 3750, + "nodeType": "IfStatement", + "src": "2585:606:15", + "trueBody": { + "id": 3735, + "nodeType": "Block", + "src": "2613:464:15", + "statements": [ + { + "assignments": [ + 3719 + ], + "declarations": [ + { + "constant": false, + "id": 3719, + "mutability": "mutable", + "name": "r", + "nameLocation": "2635:1:15", + "nodeType": "VariableDeclaration", + "scope": 3735, + "src": "2627:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3718, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2627:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 3720, + "nodeType": "VariableDeclarationStatement", + "src": "2627:9:15" + }, + { + "assignments": [ + 3722 + ], + "declarations": [ + { + "constant": false, + "id": 3722, + "mutability": "mutable", + "name": "s", + "nameLocation": "2658:1:15", + "nodeType": "VariableDeclaration", + "scope": 3735, + "src": "2650:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3721, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2650:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 3723, + "nodeType": "VariableDeclarationStatement", + "src": "2650:9:15" + }, + { + "assignments": [ + 3725 + ], + "declarations": [ + { + "constant": false, + "id": 3725, + "mutability": "mutable", + "name": "v", + "nameLocation": "2679:1:15", + "nodeType": "VariableDeclaration", + "scope": 3735, + "src": "2673:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 3724, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "2673:5:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "id": 3726, + "nodeType": "VariableDeclarationStatement", + "src": "2673:7:15" + }, + { + "AST": { + "nativeSrc": "2850:171:15", + "nodeType": "YulBlock", + "src": "2850:171:15", + "statements": [ + { + "nativeSrc": "2868:32:15", + "nodeType": "YulAssignment", + "src": "2868:32:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "signature", + "nativeSrc": "2883:9:15", + "nodeType": "YulIdentifier", + "src": "2883:9:15" + }, + { + "kind": "number", + "nativeSrc": "2894:4:15", + "nodeType": "YulLiteral", + "src": "2894:4:15", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2879:3:15", + "nodeType": "YulIdentifier", + "src": "2879:3:15" + }, + "nativeSrc": "2879:20:15", + "nodeType": "YulFunctionCall", + "src": "2879:20:15" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "2873:5:15", + "nodeType": "YulIdentifier", + "src": "2873:5:15" + }, + "nativeSrc": "2873:27:15", + "nodeType": "YulFunctionCall", + "src": "2873:27:15" + }, + "variableNames": [ + { + "name": "r", + "nativeSrc": "2868:1:15", + "nodeType": "YulIdentifier", + "src": "2868:1:15" + } + ] + }, + { + "nativeSrc": "2917:32:15", + "nodeType": "YulAssignment", + "src": "2917:32:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "signature", + "nativeSrc": "2932:9:15", + "nodeType": "YulIdentifier", + "src": "2932:9:15" + }, + { + "kind": "number", + "nativeSrc": "2943:4:15", + "nodeType": "YulLiteral", + "src": "2943:4:15", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2928:3:15", + "nodeType": "YulIdentifier", + "src": "2928:3:15" + }, + "nativeSrc": "2928:20:15", + "nodeType": "YulFunctionCall", + "src": "2928:20:15" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "2922:5:15", + "nodeType": "YulIdentifier", + "src": "2922:5:15" + }, + "nativeSrc": "2922:27:15", + "nodeType": "YulFunctionCall", + "src": "2922:27:15" + }, + "variableNames": [ + { + "name": "s", + "nativeSrc": "2917:1:15", + "nodeType": "YulIdentifier", + "src": "2917:1:15" + } + ] + }, + { + "nativeSrc": "2966:41:15", + "nodeType": "YulAssignment", + "src": "2966:41:15", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2976:1:15", + "nodeType": "YulLiteral", + "src": "2976:1:15", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "signature", + "nativeSrc": "2989:9:15", + "nodeType": "YulIdentifier", + "src": "2989:9:15" + }, + { + "kind": "number", + "nativeSrc": "3000:4:15", + "nodeType": "YulLiteral", + "src": "3000:4:15", + "type": "", + "value": "0x60" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2985:3:15", + "nodeType": "YulIdentifier", + "src": "2985:3:15" + }, + "nativeSrc": "2985:20:15", + "nodeType": "YulFunctionCall", + "src": "2985:20:15" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "2979:5:15", + "nodeType": "YulIdentifier", + "src": "2979:5:15" + }, + "nativeSrc": "2979:27:15", + "nodeType": "YulFunctionCall", + "src": "2979:27:15" + } + ], + "functionName": { + "name": "byte", + "nativeSrc": "2971:4:15", + "nodeType": "YulIdentifier", + "src": "2971:4:15" + }, + "nativeSrc": "2971:36:15", + "nodeType": "YulFunctionCall", + "src": "2971:36:15" + }, + "variableNames": [ + { + "name": "v", + "nativeSrc": "2966:1:15", + "nodeType": "YulIdentifier", + "src": "2966:1:15" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 3719, + "isOffset": false, + "isSlot": false, + "src": "2868:1:15", + "valueSize": 1 + }, + { + "declaration": 3722, + "isOffset": false, + "isSlot": false, + "src": "2917:1:15", + "valueSize": 1 + }, + { + "declaration": 3704, + "isOffset": false, + "isSlot": false, + "src": "2883:9:15", + "valueSize": 1 + }, + { + "declaration": 3704, + "isOffset": false, + "isSlot": false, + "src": "2932:9:15", + "valueSize": 1 + }, + { + "declaration": 3704, + "isOffset": false, + "isSlot": false, + "src": "2989:9:15", + "valueSize": 1 + }, + { + "declaration": 3725, + "isOffset": false, + "isSlot": false, + "src": "2966:1:15", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 3727, + "nodeType": "InlineAssembly", + "src": "2825:196:15" + }, + { + "expression": { + "arguments": [ + { + "id": 3729, + "name": "hash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3702, + "src": "3052:4:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3730, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3725, + "src": "3058:1:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + { + "id": 3731, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3719, + "src": "3061:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3732, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3722, + "src": "3064:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3728, + "name": "tryRecover", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3752, + 3915, + 4023 + ], + "referencedDeclaration": 4023, + "src": "3041:10:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_uint8_$_t_bytes32_$_t_bytes32_$returns$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "function (bytes32,uint8,bytes32,bytes32) pure returns (address,enum ECDSA.RecoverError,bytes32)" + } + }, + "id": 3733, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3041:25:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "functionReturnParameters": 3713, + "id": 3734, + "nodeType": "Return", + "src": "3034:32:15" + } + ] + } + } + ] + }, + "documentation": { + "id": 3700, + "nodeType": "StructuredDocumentation", + "src": "843:1571:15", + "text": " @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not\n return address(0) without also returning an error description. Errors are documented using an enum (error type)\n and a bytes32 providing additional information about the error.\n If no error is returned, then the address can be used for verification purposes.\n The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:\n this function rejects them by requiring the `s` value to be in the lower\n half order, and the `v` value to be either 27 or 28.\n NOTE: This function only supports 65-byte signatures. ERC-2098 short signatures are rejected. This restriction\n is DEPRECATED and will be removed in v6.0. Developers SHOULD NOT use signatures as unique identifiers; use hash\n invalidation or nonces for replay protection.\n IMPORTANT: `hash` _must_ be the result of a hash operation for the\n verification to be secure: it is possible to craft signatures that\n recover to arbitrary addresses for non-hashed data. A safe way to ensure\n this is by receiving a hash of the original message (which may otherwise\n be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.\n Documentation for signature generation:\n - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]" + }, + "id": 3752, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryRecover", + "nameLocation": "2428:10:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3705, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3702, + "mutability": "mutable", + "name": "hash", + "nameLocation": "2456:4:15", + "nodeType": "VariableDeclaration", + "scope": 3752, + "src": "2448:12:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3701, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2448:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3704, + "mutability": "mutable", + "name": "signature", + "nameLocation": "2483:9:15", + "nodeType": "VariableDeclaration", + "scope": 3752, + "src": "2470:22:15", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 3703, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2470:5:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "2438:60:15" + }, + "returnParameters": { + "id": 3713, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3707, + "mutability": "mutable", + "name": "recovered", + "nameLocation": "2530:9:15", + "nodeType": "VariableDeclaration", + "scope": 3752, + "src": "2522:17:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3706, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2522:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3710, + "mutability": "mutable", + "name": "err", + "nameLocation": "2554:3:15", + "nodeType": "VariableDeclaration", + "scope": 3752, + "src": "2541:16:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "typeName": { + "id": 3709, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 3708, + "name": "RecoverError", + "nameLocations": [ + "2541:12:15" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3686, + "src": "2541:12:15" + }, + "referencedDeclaration": 3686, + "src": "2541:12:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3712, + "mutability": "mutable", + "name": "errArg", + "nameLocation": "2567:6:15", + "nodeType": "VariableDeclaration", + "scope": 3752, + "src": "2559:14:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3711, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2559:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "2521:53:15" + }, + "scope": 4137, + "src": "2419:778:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3804, + "nodeType": "Block", + "src": "3456:716:15", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3770, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 3767, + "name": "signature", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3757, + "src": "3470:9:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + } + }, + "id": 3768, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3480:6:15", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "3470:16:15", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "3635", + "id": 3769, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3490:2:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_65_by_1", + "typeString": "int_const 65" + }, + "value": "65" + }, + "src": "3470:22:15", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 3802, + "nodeType": "Block", + "src": "4058:108:15", + "statements": [ + { + "expression": { + "components": [ + { + "arguments": [ + { + "hexValue": "30", + "id": 3791, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4088:1:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 3790, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4080:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3789, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "4080:7:15", + "typeDescriptions": {} + } + }, + "id": 3792, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4080:10:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 3793, + "name": "RecoverError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3686, + "src": "4092:12:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_RecoverError_$3686_$", + "typeString": "type(enum ECDSA.RecoverError)" + } + }, + "id": 3794, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "4105:22:15", + "memberName": "InvalidSignatureLength", + "nodeType": "MemberAccess", + "referencedDeclaration": 3684, + "src": "4092:35:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + { + "arguments": [ + { + "expression": { + "id": 3797, + "name": "signature", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3757, + "src": "4137:9:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + } + }, + "id": 3798, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4147:6:15", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "4137:16:15", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3796, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4129:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes32_$", + "typeString": "type(bytes32)" + }, + "typeName": { + "id": 3795, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "4129:7:15", + "typeDescriptions": {} + } + }, + "id": 3799, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4129:25:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 3800, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "4079:76:15", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "functionReturnParameters": 3766, + "id": 3801, + "nodeType": "Return", + "src": "4072:83:15" + } + ] + }, + "id": 3803, + "nodeType": "IfStatement", + "src": "3466:700:15", + "trueBody": { + "id": 3788, + "nodeType": "Block", + "src": "3494:558:15", + "statements": [ + { + "assignments": [ + 3772 + ], + "declarations": [ + { + "constant": false, + "id": 3772, + "mutability": "mutable", + "name": "r", + "nameLocation": "3516:1:15", + "nodeType": "VariableDeclaration", + "scope": 3788, + "src": "3508:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3771, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3508:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 3773, + "nodeType": "VariableDeclarationStatement", + "src": "3508:9:15" + }, + { + "assignments": [ + 3775 + ], + "declarations": [ + { + "constant": false, + "id": 3775, + "mutability": "mutable", + "name": "s", + "nameLocation": "3539:1:15", + "nodeType": "VariableDeclaration", + "scope": 3788, + "src": "3531:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3774, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3531:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 3776, + "nodeType": "VariableDeclarationStatement", + "src": "3531:9:15" + }, + { + "assignments": [ + 3778 + ], + "declarations": [ + { + "constant": false, + "id": 3778, + "mutability": "mutable", + "name": "v", + "nameLocation": "3560:1:15", + "nodeType": "VariableDeclaration", + "scope": 3788, + "src": "3554:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 3777, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "3554:5:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "id": 3779, + "nodeType": "VariableDeclarationStatement", + "src": "3554:7:15" + }, + { + "AST": { + "nativeSrc": "3794:202:15", + "nodeType": "YulBlock", + "src": "3794:202:15", + "statements": [ + { + "nativeSrc": "3812:35:15", + "nodeType": "YulAssignment", + "src": "3812:35:15", + "value": { + "arguments": [ + { + "name": "signature.offset", + "nativeSrc": "3830:16:15", + "nodeType": "YulIdentifier", + "src": "3830:16:15" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "3817:12:15", + "nodeType": "YulIdentifier", + "src": "3817:12:15" + }, + "nativeSrc": "3817:30:15", + "nodeType": "YulFunctionCall", + "src": "3817:30:15" + }, + "variableNames": [ + { + "name": "r", + "nativeSrc": "3812:1:15", + "nodeType": "YulIdentifier", + "src": "3812:1:15" + } + ] + }, + { + "nativeSrc": "3864:46:15", + "nodeType": "YulAssignment", + "src": "3864:46:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "signature.offset", + "nativeSrc": "3886:16:15", + "nodeType": "YulIdentifier", + "src": "3886:16:15" + }, + { + "kind": "number", + "nativeSrc": "3904:4:15", + "nodeType": "YulLiteral", + "src": "3904:4:15", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3882:3:15", + "nodeType": "YulIdentifier", + "src": "3882:3:15" + }, + "nativeSrc": "3882:27:15", + "nodeType": "YulFunctionCall", + "src": "3882:27:15" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "3869:12:15", + "nodeType": "YulIdentifier", + "src": "3869:12:15" + }, + "nativeSrc": "3869:41:15", + "nodeType": "YulFunctionCall", + "src": "3869:41:15" + }, + "variableNames": [ + { + "name": "s", + "nativeSrc": "3864:1:15", + "nodeType": "YulIdentifier", + "src": "3864:1:15" + } + ] + }, + { + "nativeSrc": "3927:55:15", + "nodeType": "YulAssignment", + "src": "3927:55:15", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3937:1:15", + "nodeType": "YulLiteral", + "src": "3937:1:15", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "signature.offset", + "nativeSrc": "3957:16:15", + "nodeType": "YulIdentifier", + "src": "3957:16:15" + }, + { + "kind": "number", + "nativeSrc": "3975:4:15", + "nodeType": "YulLiteral", + "src": "3975:4:15", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3953:3:15", + "nodeType": "YulIdentifier", + "src": "3953:3:15" + }, + "nativeSrc": "3953:27:15", + "nodeType": "YulFunctionCall", + "src": "3953:27:15" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "3940:12:15", + "nodeType": "YulIdentifier", + "src": "3940:12:15" + }, + "nativeSrc": "3940:41:15", + "nodeType": "YulFunctionCall", + "src": "3940:41:15" + } + ], + "functionName": { + "name": "byte", + "nativeSrc": "3932:4:15", + "nodeType": "YulIdentifier", + "src": "3932:4:15" + }, + "nativeSrc": "3932:50:15", + "nodeType": "YulFunctionCall", + "src": "3932:50:15" + }, + "variableNames": [ + { + "name": "v", + "nativeSrc": "3927:1:15", + "nodeType": "YulIdentifier", + "src": "3927:1:15" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 3772, + "isOffset": false, + "isSlot": false, + "src": "3812:1:15", + "valueSize": 1 + }, + { + "declaration": 3775, + "isOffset": false, + "isSlot": false, + "src": "3864:1:15", + "valueSize": 1 + }, + { + "declaration": 3757, + "isOffset": true, + "isSlot": false, + "src": "3830:16:15", + "suffix": "offset", + "valueSize": 1 + }, + { + "declaration": 3757, + "isOffset": true, + "isSlot": false, + "src": "3886:16:15", + "suffix": "offset", + "valueSize": 1 + }, + { + "declaration": 3757, + "isOffset": true, + "isSlot": false, + "src": "3957:16:15", + "suffix": "offset", + "valueSize": 1 + }, + { + "declaration": 3778, + "isOffset": false, + "isSlot": false, + "src": "3927:1:15", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 3780, + "nodeType": "InlineAssembly", + "src": "3769:227:15" + }, + { + "expression": { + "arguments": [ + { + "id": 3782, + "name": "hash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3755, + "src": "4027:4:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3783, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3778, + "src": "4033:1:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + { + "id": 3784, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3772, + "src": "4036:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3785, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3775, + "src": "4039:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3781, + "name": "tryRecover", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3752, + 3915, + 4023 + ], + "referencedDeclaration": 4023, + "src": "4016:10:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_uint8_$_t_bytes32_$_t_bytes32_$returns$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "function (bytes32,uint8,bytes32,bytes32) pure returns (address,enum ECDSA.RecoverError,bytes32)" + } + }, + "id": 3786, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4016:25:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "functionReturnParameters": 3766, + "id": 3787, + "nodeType": "Return", + "src": "4009:32:15" + } + ] + } + } + ] + }, + "documentation": { + "id": 3753, + "nodeType": "StructuredDocumentation", + "src": "3203:82:15", + "text": " @dev Variant of {tryRecover} that takes a signature in calldata" + }, + "id": 3805, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryRecoverCalldata", + "nameLocation": "3299:18:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3758, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3755, + "mutability": "mutable", + "name": "hash", + "nameLocation": "3335:4:15", + "nodeType": "VariableDeclaration", + "scope": 3805, + "src": "3327:12:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3754, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3327:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3757, + "mutability": "mutable", + "name": "signature", + "nameLocation": "3364:9:15", + "nodeType": "VariableDeclaration", + "scope": 3805, + "src": "3349:24:15", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 3756, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3349:5:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "3317:62:15" + }, + "returnParameters": { + "id": 3766, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3760, + "mutability": "mutable", + "name": "recovered", + "nameLocation": "3411:9:15", + "nodeType": "VariableDeclaration", + "scope": 3805, + "src": "3403:17:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3759, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3403:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3763, + "mutability": "mutable", + "name": "err", + "nameLocation": "3435:3:15", + "nodeType": "VariableDeclaration", + "scope": 3805, + "src": "3422:16:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "typeName": { + "id": 3762, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 3761, + "name": "RecoverError", + "nameLocations": [ + "3422:12:15" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3686, + "src": "3422:12:15" + }, + "referencedDeclaration": 3686, + "src": "3422:12:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3765, + "mutability": "mutable", + "name": "errArg", + "nameLocation": "3448:6:15", + "nodeType": "VariableDeclaration", + "scope": 3805, + "src": "3440:14:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3764, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3440:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "3402:53:15" + }, + "scope": 4137, + "src": "3290:882:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3834, + "nodeType": "Block", + "src": "5363:168:15", + "statements": [ + { + "assignments": [ + 3816, + 3819, + 3821 + ], + "declarations": [ + { + "constant": false, + "id": 3816, + "mutability": "mutable", + "name": "recovered", + "nameLocation": "5382:9:15", + "nodeType": "VariableDeclaration", + "scope": 3834, + "src": "5374:17:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3815, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5374:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3819, + "mutability": "mutable", + "name": "error", + "nameLocation": "5406:5:15", + "nodeType": "VariableDeclaration", + "scope": 3834, + "src": "5393:18:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "typeName": { + "id": 3818, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 3817, + "name": "RecoverError", + "nameLocations": [ + "5393:12:15" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3686, + "src": "5393:12:15" + }, + "referencedDeclaration": 3686, + "src": "5393:12:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3821, + "mutability": "mutable", + "name": "errorArg", + "nameLocation": "5421:8:15", + "nodeType": "VariableDeclaration", + "scope": 3834, + "src": "5413:16:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3820, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5413:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 3826, + "initialValue": { + "arguments": [ + { + "id": 3823, + "name": "hash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3808, + "src": "5444:4:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3824, + "name": "signature", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3810, + "src": "5450:9:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 3822, + "name": "tryRecover", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3752, + 3915, + 4023 + ], + "referencedDeclaration": 3752, + "src": "5433:10:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_bytes_memory_ptr_$returns$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "function (bytes32,bytes memory) pure returns (address,enum ECDSA.RecoverError,bytes32)" + } + }, + "id": 3825, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5433:27:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "5373:87:15" + }, + { + "expression": { + "arguments": [ + { + "id": 3828, + "name": "error", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3819, + "src": "5482:5:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + { + "id": 3829, + "name": "errorArg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3821, + "src": "5489:8:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3827, + "name": "_throwError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4136, + "src": "5470:11:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_RecoverError_$3686_$_t_bytes32_$returns$__$", + "typeString": "function (enum ECDSA.RecoverError,bytes32) pure" + } + }, + "id": 3830, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5470:28:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3831, + "nodeType": "ExpressionStatement", + "src": "5470:28:15" + }, + { + "expression": { + "id": 3832, + "name": "recovered", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3816, + "src": "5515:9:15", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 3814, + "id": 3833, + "nodeType": "Return", + "src": "5508:16:15" + } + ] + }, + "documentation": { + "id": 3806, + "nodeType": "StructuredDocumentation", + "src": "4178:1093:15", + "text": " @dev Returns the address that signed a hashed message (`hash`) with\n `signature`. This address can then be used for verification purposes.\n The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:\n this function rejects them by requiring the `s` value to be in the lower\n half order, and the `v` value to be either 27 or 28.\n NOTE: This function only supports 65-byte signatures. ERC-2098 short signatures are rejected. This restriction\n is DEPRECATED and will be removed in v6.0. Developers SHOULD NOT use signatures as unique identifiers; use hash\n invalidation or nonces for replay protection.\n IMPORTANT: `hash` _must_ be the result of a hash operation for the\n verification to be secure: it is possible to craft signatures that\n recover to arbitrary addresses for non-hashed data. A safe way to ensure\n this is by receiving a hash of the original message (which may otherwise\n be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it." + }, + "id": 3835, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "recover", + "nameLocation": "5285:7:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3811, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3808, + "mutability": "mutable", + "name": "hash", + "nameLocation": "5301:4:15", + "nodeType": "VariableDeclaration", + "scope": 3835, + "src": "5293:12:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3807, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5293:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3810, + "mutability": "mutable", + "name": "signature", + "nameLocation": "5320:9:15", + "nodeType": "VariableDeclaration", + "scope": 3835, + "src": "5307:22:15", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 3809, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5307:5:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "5292:38:15" + }, + "returnParameters": { + "id": 3814, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3813, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3835, + "src": "5354:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3812, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5354:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "5353:9:15" + }, + "scope": 4137, + "src": "5276:255:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3864, + "nodeType": "Block", + "src": "5718:176:15", + "statements": [ + { + "assignments": [ + 3846, + 3849, + 3851 + ], + "declarations": [ + { + "constant": false, + "id": 3846, + "mutability": "mutable", + "name": "recovered", + "nameLocation": "5737:9:15", + "nodeType": "VariableDeclaration", + "scope": 3864, + "src": "5729:17:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3845, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5729:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3849, + "mutability": "mutable", + "name": "error", + "nameLocation": "5761:5:15", + "nodeType": "VariableDeclaration", + "scope": 3864, + "src": "5748:18:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "typeName": { + "id": 3848, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 3847, + "name": "RecoverError", + "nameLocations": [ + "5748:12:15" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3686, + "src": "5748:12:15" + }, + "referencedDeclaration": 3686, + "src": "5748:12:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3851, + "mutability": "mutable", + "name": "errorArg", + "nameLocation": "5776:8:15", + "nodeType": "VariableDeclaration", + "scope": 3864, + "src": "5768:16:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3850, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5768:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 3856, + "initialValue": { + "arguments": [ + { + "id": 3853, + "name": "hash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3838, + "src": "5807:4:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3854, + "name": "signature", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3840, + "src": "5813:9:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + } + ], + "id": 3852, + "name": "tryRecoverCalldata", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3805, + "src": "5788:18:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_bytes_calldata_ptr_$returns$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "function (bytes32,bytes calldata) pure returns (address,enum ECDSA.RecoverError,bytes32)" + } + }, + "id": 3855, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5788:35:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "5728:95:15" + }, + { + "expression": { + "arguments": [ + { + "id": 3858, + "name": "error", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3849, + "src": "5845:5:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + { + "id": 3859, + "name": "errorArg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3851, + "src": "5852:8:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3857, + "name": "_throwError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4136, + "src": "5833:11:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_RecoverError_$3686_$_t_bytes32_$returns$__$", + "typeString": "function (enum ECDSA.RecoverError,bytes32) pure" + } + }, + "id": 3860, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5833:28:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3861, + "nodeType": "ExpressionStatement", + "src": "5833:28:15" + }, + { + "expression": { + "id": 3862, + "name": "recovered", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3846, + "src": "5878:9:15", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 3844, + "id": 3863, + "nodeType": "Return", + "src": "5871:16:15" + } + ] + }, + "documentation": { + "id": 3836, + "nodeType": "StructuredDocumentation", + "src": "5537:79:15", + "text": " @dev Variant of {recover} that takes a signature in calldata" + }, + "id": 3865, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "recoverCalldata", + "nameLocation": "5630:15:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3841, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3838, + "mutability": "mutable", + "name": "hash", + "nameLocation": "5654:4:15", + "nodeType": "VariableDeclaration", + "scope": 3865, + "src": "5646:12:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3837, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5646:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3840, + "mutability": "mutable", + "name": "signature", + "nameLocation": "5675:9:15", + "nodeType": "VariableDeclaration", + "scope": 3865, + "src": "5660:24:15", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 3839, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5660:5:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "5645:40:15" + }, + "returnParameters": { + "id": 3844, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3843, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3865, + "src": "5709:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3842, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5709:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "5708:9:15" + }, + "scope": 4137, + "src": "5621:273:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3914, + "nodeType": "Block", + "src": "6273:342:15", + "statements": [ + { + "id": 3913, + "nodeType": "UncheckedBlock", + "src": "6283:326:15", + "statements": [ + { + "assignments": [ + 3883 + ], + "declarations": [ + { + "constant": false, + "id": 3883, + "mutability": "mutable", + "name": "s", + "nameLocation": "6315:1:15", + "nodeType": "VariableDeclaration", + "scope": 3913, + "src": "6307:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3882, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6307:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 3890, + "initialValue": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 3889, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3884, + "name": "vs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3872, + "src": "6319:2:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "arguments": [ + { + "hexValue": "307837666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666", + "id": 3887, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6332:66:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_57896044618658097711785492504343953926634992332820282019728792003956564819967_by_1", + "typeString": "int_const 5789...(69 digits omitted)...9967" + }, + "value": "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_57896044618658097711785492504343953926634992332820282019728792003956564819967_by_1", + "typeString": "int_const 5789...(69 digits omitted)...9967" + } + ], + "id": 3886, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6324:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes32_$", + "typeString": "type(bytes32)" + }, + "typeName": { + "id": 3885, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6324:7:15", + "typeDescriptions": {} + } + }, + "id": 3888, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6324:75:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "6319:80:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "6307:92:15" + }, + { + "assignments": [ + 3892 + ], + "declarations": [ + { + "constant": false, + "id": 3892, + "mutability": "mutable", + "name": "v", + "nameLocation": "6516:1:15", + "nodeType": "VariableDeclaration", + "scope": 3913, + "src": "6510:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 3891, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "6510:5:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "id": 3905, + "initialValue": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3903, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3900, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 3897, + "name": "vs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3872, + "src": "6535:2:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3896, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6527:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 3895, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6527:7:15", + "typeDescriptions": {} + } + }, + "id": 3898, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6527:11:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "323535", + "id": 3899, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6542:3:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "255" + }, + "src": "6527:18:15", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 3901, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "6526:20:15", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "3237", + "id": 3902, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6549:2:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_27_by_1", + "typeString": "int_const 27" + }, + "value": "27" + }, + "src": "6526:25:15", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3894, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6520:5:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": { + "id": 3893, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "6520:5:15", + "typeDescriptions": {} + } + }, + "id": 3904, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6520:32:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "6510:42:15" + }, + { + "expression": { + "arguments": [ + { + "id": 3907, + "name": "hash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3868, + "src": "6584:4:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3908, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3892, + "src": "6590:1:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + { + "id": 3909, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3870, + "src": "6593:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3910, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3883, + "src": "6596:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3906, + "name": "tryRecover", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3752, + 3915, + 4023 + ], + "referencedDeclaration": 4023, + "src": "6573:10:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_uint8_$_t_bytes32_$_t_bytes32_$returns$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "function (bytes32,uint8,bytes32,bytes32) pure returns (address,enum ECDSA.RecoverError,bytes32)" + } + }, + "id": 3911, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6573:25:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "functionReturnParameters": 3881, + "id": 3912, + "nodeType": "Return", + "src": "6566:32:15" + } + ] + } + ] + }, + "documentation": { + "id": 3866, + "nodeType": "StructuredDocumentation", + "src": "5900:205:15", + "text": " @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n See https://eips.ethereum.org/EIPS/eip-2098[ERC-2098 short signatures]" + }, + "id": 3915, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryRecover", + "nameLocation": "6119:10:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3873, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3868, + "mutability": "mutable", + "name": "hash", + "nameLocation": "6147:4:15", + "nodeType": "VariableDeclaration", + "scope": 3915, + "src": "6139:12:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3867, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6139:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3870, + "mutability": "mutable", + "name": "r", + "nameLocation": "6169:1:15", + "nodeType": "VariableDeclaration", + "scope": 3915, + "src": "6161:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3869, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6161:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3872, + "mutability": "mutable", + "name": "vs", + "nameLocation": "6188:2:15", + "nodeType": "VariableDeclaration", + "scope": 3915, + "src": "6180:10:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3871, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6180:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "6129:67:15" + }, + "returnParameters": { + "id": 3881, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3875, + "mutability": "mutable", + "name": "recovered", + "nameLocation": "6228:9:15", + "nodeType": "VariableDeclaration", + "scope": 3915, + "src": "6220:17:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3874, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6220:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3878, + "mutability": "mutable", + "name": "err", + "nameLocation": "6252:3:15", + "nodeType": "VariableDeclaration", + "scope": 3915, + "src": "6239:16:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "typeName": { + "id": 3877, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 3876, + "name": "RecoverError", + "nameLocations": [ + "6239:12:15" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3686, + "src": "6239:12:15" + }, + "referencedDeclaration": 3686, + "src": "6239:12:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3880, + "mutability": "mutable", + "name": "errArg", + "nameLocation": "6265:6:15", + "nodeType": "VariableDeclaration", + "scope": 3915, + "src": "6257:14:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3879, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6257:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "6219:53:15" + }, + "scope": 4137, + "src": "6110:505:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3947, + "nodeType": "Block", + "src": "6829:164:15", + "statements": [ + { + "assignments": [ + 3928, + 3931, + 3933 + ], + "declarations": [ + { + "constant": false, + "id": 3928, + "mutability": "mutable", + "name": "recovered", + "nameLocation": "6848:9:15", + "nodeType": "VariableDeclaration", + "scope": 3947, + "src": "6840:17:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3927, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6840:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3931, + "mutability": "mutable", + "name": "error", + "nameLocation": "6872:5:15", + "nodeType": "VariableDeclaration", + "scope": 3947, + "src": "6859:18:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "typeName": { + "id": 3930, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 3929, + "name": "RecoverError", + "nameLocations": [ + "6859:12:15" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3686, + "src": "6859:12:15" + }, + "referencedDeclaration": 3686, + "src": "6859:12:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3933, + "mutability": "mutable", + "name": "errorArg", + "nameLocation": "6887:8:15", + "nodeType": "VariableDeclaration", + "scope": 3947, + "src": "6879:16:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3932, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6879:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 3939, + "initialValue": { + "arguments": [ + { + "id": 3935, + "name": "hash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3918, + "src": "6910:4:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3936, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3920, + "src": "6916:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3937, + "name": "vs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3922, + "src": "6919:2:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3934, + "name": "tryRecover", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3752, + 3915, + 4023 + ], + "referencedDeclaration": 3915, + "src": "6899:10:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_bytes32_$_t_bytes32_$returns$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "function (bytes32,bytes32,bytes32) pure returns (address,enum ECDSA.RecoverError,bytes32)" + } + }, + "id": 3938, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6899:23:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "6839:83:15" + }, + { + "expression": { + "arguments": [ + { + "id": 3941, + "name": "error", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3931, + "src": "6944:5:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + { + "id": 3942, + "name": "errorArg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3933, + "src": "6951:8:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3940, + "name": "_throwError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4136, + "src": "6932:11:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_RecoverError_$3686_$_t_bytes32_$returns$__$", + "typeString": "function (enum ECDSA.RecoverError,bytes32) pure" + } + }, + "id": 3943, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6932:28:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3944, + "nodeType": "ExpressionStatement", + "src": "6932:28:15" + }, + { + "expression": { + "id": 3945, + "name": "recovered", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3928, + "src": "6977:9:15", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 3926, + "id": 3946, + "nodeType": "Return", + "src": "6970:16:15" + } + ] + }, + "documentation": { + "id": 3916, + "nodeType": "StructuredDocumentation", + "src": "6621:117:15", + "text": " @dev Overload of {ECDSA-recover} that receives the `r` and `vs` short-signature fields separately." + }, + "id": 3948, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "recover", + "nameLocation": "6752:7:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3923, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3918, + "mutability": "mutable", + "name": "hash", + "nameLocation": "6768:4:15", + "nodeType": "VariableDeclaration", + "scope": 3948, + "src": "6760:12:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3917, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6760:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3920, + "mutability": "mutable", + "name": "r", + "nameLocation": "6782:1:15", + "nodeType": "VariableDeclaration", + "scope": 3948, + "src": "6774:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3919, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6774:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3922, + "mutability": "mutable", + "name": "vs", + "nameLocation": "6793:2:15", + "nodeType": "VariableDeclaration", + "scope": 3948, + "src": "6785:10:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3921, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6785:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "6759:37:15" + }, + "returnParameters": { + "id": 3926, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3925, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3948, + "src": "6820:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3924, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6820:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "6819:9:15" + }, + "scope": 4137, + "src": "6743:250:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4022, + "nodeType": "Block", + "src": "7308:1372:15", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3972, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 3969, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3957, + "src": "8204:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3968, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8196:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 3967, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8196:7:15", + "typeDescriptions": {} + } + }, + "id": 3970, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8196:10:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "307837464646464646464646464646464646464646464646464646464646464646463544353736453733353741343530314444464539324634363638314232304130", + "id": 3971, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8209:66:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_57896044618658097711785492504343953926418782139537452191302581570759080747168_by_1", + "typeString": "int_const 5789...(69 digits omitted)...7168" + }, + "value": "0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0" + }, + "src": "8196:79:15", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3983, + "nodeType": "IfStatement", + "src": "8192:164:15", + "trueBody": { + "id": 3982, + "nodeType": "Block", + "src": "8277:79:15", + "statements": [ + { + "expression": { + "components": [ + { + "arguments": [ + { + "hexValue": "30", + "id": 3975, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8307:1:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 3974, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8299:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3973, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "8299:7:15", + "typeDescriptions": {} + } + }, + "id": 3976, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8299:10:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 3977, + "name": "RecoverError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3686, + "src": "8311:12:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_RecoverError_$3686_$", + "typeString": "type(enum ECDSA.RecoverError)" + } + }, + "id": 3978, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "8324:17:15", + "memberName": "InvalidSignatureS", + "nodeType": "MemberAccess", + "referencedDeclaration": 3685, + "src": "8311:30:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + { + "id": 3979, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3957, + "src": "8343:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 3980, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "8298:47:15", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "functionReturnParameters": 3966, + "id": 3981, + "nodeType": "Return", + "src": "8291:54:15" + } + ] + } + }, + { + "assignments": [ + 3985 + ], + "declarations": [ + { + "constant": false, + "id": 3985, + "mutability": "mutable", + "name": "signer", + "nameLocation": "8458:6:15", + "nodeType": "VariableDeclaration", + "scope": 4022, + "src": "8450:14:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3984, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "8450:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "id": 3992, + "initialValue": { + "arguments": [ + { + "id": 3987, + "name": "hash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3951, + "src": "8477:4:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3988, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3953, + "src": "8483:1:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + { + "id": 3989, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3955, + "src": "8486:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3990, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3957, + "src": "8489:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3986, + "name": "ecrecover", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -6, + "src": "8467:9:15", + "typeDescriptions": { + "typeIdentifier": "t_function_ecrecover_pure$_t_bytes32_$_t_uint8_$_t_bytes32_$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32,uint8,bytes32,bytes32) pure returns (address)" + } + }, + "id": 3991, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8467:24:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8450:41:15" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 3998, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3993, + "name": "signer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3985, + "src": "8505:6:15", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 3996, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8523:1:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 3995, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8515:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3994, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "8515:7:15", + "typeDescriptions": {} + } + }, + "id": 3997, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8515:10:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "8505:20:15", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4012, + "nodeType": "IfStatement", + "src": "8501:113:15", + "trueBody": { + "id": 4011, + "nodeType": "Block", + "src": "8527:87:15", + "statements": [ + { + "expression": { + "components": [ + { + "arguments": [ + { + "hexValue": "30", + "id": 4001, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8557:1:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 4000, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8549:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3999, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "8549:7:15", + "typeDescriptions": {} + } + }, + "id": 4002, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8549:10:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 4003, + "name": "RecoverError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3686, + "src": "8561:12:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_RecoverError_$3686_$", + "typeString": "type(enum ECDSA.RecoverError)" + } + }, + "id": 4004, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "8574:16:15", + "memberName": "InvalidSignature", + "nodeType": "MemberAccess", + "referencedDeclaration": 3683, + "src": "8561:29:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + { + "arguments": [ + { + "hexValue": "30", + "id": 4007, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8600:1:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 4006, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8592:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes32_$", + "typeString": "type(bytes32)" + }, + "typeName": { + "id": 4005, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "8592:7:15", + "typeDescriptions": {} + } + }, + "id": 4008, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8592:10:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 4009, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "8548:55:15", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "functionReturnParameters": 3966, + "id": 4010, + "nodeType": "Return", + "src": "8541:62:15" + } + ] + } + }, + { + "expression": { + "components": [ + { + "id": 4013, + "name": "signer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3985, + "src": "8632:6:15", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 4014, + "name": "RecoverError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3686, + "src": "8640:12:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_RecoverError_$3686_$", + "typeString": "type(enum ECDSA.RecoverError)" + } + }, + "id": 4015, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "8653:7:15", + "memberName": "NoError", + "nodeType": "MemberAccess", + "referencedDeclaration": 3682, + "src": "8640:20:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + { + "arguments": [ + { + "hexValue": "30", + "id": 4018, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8670:1:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 4017, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8662:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes32_$", + "typeString": "type(bytes32)" + }, + "typeName": { + "id": 4016, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "8662:7:15", + "typeDescriptions": {} + } + }, + "id": 4019, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8662:10:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 4020, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "8631:42:15", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "functionReturnParameters": 3966, + "id": 4021, + "nodeType": "Return", + "src": "8624:49:15" + } + ] + }, + "documentation": { + "id": 3949, + "nodeType": "StructuredDocumentation", + "src": "6999:125:15", + "text": " @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n `r` and `s` signature fields separately." + }, + "id": 4023, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryRecover", + "nameLocation": "7138:10:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3958, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3951, + "mutability": "mutable", + "name": "hash", + "nameLocation": "7166:4:15", + "nodeType": "VariableDeclaration", + "scope": 4023, + "src": "7158:12:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3950, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "7158:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3953, + "mutability": "mutable", + "name": "v", + "nameLocation": "7186:1:15", + "nodeType": "VariableDeclaration", + "scope": 4023, + "src": "7180:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 3952, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "7180:5:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3955, + "mutability": "mutable", + "name": "r", + "nameLocation": "7205:1:15", + "nodeType": "VariableDeclaration", + "scope": 4023, + "src": "7197:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3954, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "7197:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3957, + "mutability": "mutable", + "name": "s", + "nameLocation": "7224:1:15", + "nodeType": "VariableDeclaration", + "scope": 4023, + "src": "7216:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3956, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "7216:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "7148:83:15" + }, + "returnParameters": { + "id": 3966, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3960, + "mutability": "mutable", + "name": "recovered", + "nameLocation": "7263:9:15", + "nodeType": "VariableDeclaration", + "scope": 4023, + "src": "7255:17:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3959, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "7255:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3963, + "mutability": "mutable", + "name": "err", + "nameLocation": "7287:3:15", + "nodeType": "VariableDeclaration", + "scope": 4023, + "src": "7274:16:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "typeName": { + "id": 3962, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 3961, + "name": "RecoverError", + "nameLocations": [ + "7274:12:15" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3686, + "src": "7274:12:15" + }, + "referencedDeclaration": 3686, + "src": "7274:12:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3965, + "mutability": "mutable", + "name": "errArg", + "nameLocation": "7300:6:15", + "nodeType": "VariableDeclaration", + "scope": 4023, + "src": "7292:14:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3964, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "7292:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "7254:53:15" + }, + "scope": 4137, + "src": "7129:1551:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4058, + "nodeType": "Block", + "src": "8907:166:15", + "statements": [ + { + "assignments": [ + 4038, + 4041, + 4043 + ], + "declarations": [ + { + "constant": false, + "id": 4038, + "mutability": "mutable", + "name": "recovered", + "nameLocation": "8926:9:15", + "nodeType": "VariableDeclaration", + "scope": 4058, + "src": "8918:17:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 4037, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "8918:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4041, + "mutability": "mutable", + "name": "error", + "nameLocation": "8950:5:15", + "nodeType": "VariableDeclaration", + "scope": 4058, + "src": "8937:18:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "typeName": { + "id": 4040, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 4039, + "name": "RecoverError", + "nameLocations": [ + "8937:12:15" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3686, + "src": "8937:12:15" + }, + "referencedDeclaration": 3686, + "src": "8937:12:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4043, + "mutability": "mutable", + "name": "errorArg", + "nameLocation": "8965:8:15", + "nodeType": "VariableDeclaration", + "scope": 4058, + "src": "8957:16:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4042, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "8957:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 4050, + "initialValue": { + "arguments": [ + { + "id": 4045, + "name": "hash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4026, + "src": "8988:4:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 4046, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4028, + "src": "8994:1:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + { + "id": 4047, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4030, + "src": "8997:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 4048, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4032, + "src": "9000:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 4044, + "name": "tryRecover", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3752, + 3915, + 4023 + ], + "referencedDeclaration": 4023, + "src": "8977:10:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_uint8_$_t_bytes32_$_t_bytes32_$returns$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "function (bytes32,uint8,bytes32,bytes32) pure returns (address,enum ECDSA.RecoverError,bytes32)" + } + }, + "id": 4049, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8977:25:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8917:85:15" + }, + { + "expression": { + "arguments": [ + { + "id": 4052, + "name": "error", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4041, + "src": "9024:5:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + { + "id": 4053, + "name": "errorArg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4043, + "src": "9031:8:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 4051, + "name": "_throwError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4136, + "src": "9012:11:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_RecoverError_$3686_$_t_bytes32_$returns$__$", + "typeString": "function (enum ECDSA.RecoverError,bytes32) pure" + } + }, + "id": 4054, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9012:28:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 4055, + "nodeType": "ExpressionStatement", + "src": "9012:28:15" + }, + { + "expression": { + "id": 4056, + "name": "recovered", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4038, + "src": "9057:9:15", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 4036, + "id": 4057, + "nodeType": "Return", + "src": "9050:16:15" + } + ] + }, + "documentation": { + "id": 4024, + "nodeType": "StructuredDocumentation", + "src": "8686:122:15", + "text": " @dev Overload of {ECDSA-recover} that receives the `v`,\n `r` and `s` signature fields separately." + }, + "id": 4059, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "recover", + "nameLocation": "8822:7:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4033, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4026, + "mutability": "mutable", + "name": "hash", + "nameLocation": "8838:4:15", + "nodeType": "VariableDeclaration", + "scope": 4059, + "src": "8830:12:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4025, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "8830:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4028, + "mutability": "mutable", + "name": "v", + "nameLocation": "8850:1:15", + "nodeType": "VariableDeclaration", + "scope": 4059, + "src": "8844:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 4027, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "8844:5:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4030, + "mutability": "mutable", + "name": "r", + "nameLocation": "8861:1:15", + "nodeType": "VariableDeclaration", + "scope": 4059, + "src": "8853:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4029, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "8853:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4032, + "mutability": "mutable", + "name": "s", + "nameLocation": "8872:1:15", + "nodeType": "VariableDeclaration", + "scope": 4059, + "src": "8864:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4031, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "8864:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "8829:45:15" + }, + "returnParameters": { + "id": 4036, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4035, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4059, + "src": "8898:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 4034, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "8898:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "8897:9:15" + }, + "scope": 4137, + "src": "8813:260:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4072, + "nodeType": "Block", + "src": "9659:793:15", + "statements": [ + { + "AST": { + "nativeSrc": "9694:752:15", + "nodeType": "YulBlock", + "src": "9694:752:15", + "statements": [ + { + "cases": [ + { + "body": { + "nativeSrc": "9847:171:15", + "nodeType": "YulBlock", + "src": "9847:171:15", + "statements": [ + { + "nativeSrc": "9865:32:15", + "nodeType": "YulAssignment", + "src": "9865:32:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "signature", + "nativeSrc": "9880:9:15", + "nodeType": "YulIdentifier", + "src": "9880:9:15" + }, + { + "kind": "number", + "nativeSrc": "9891:4:15", + "nodeType": "YulLiteral", + "src": "9891:4:15", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9876:3:15", + "nodeType": "YulIdentifier", + "src": "9876:3:15" + }, + "nativeSrc": "9876:20:15", + "nodeType": "YulFunctionCall", + "src": "9876:20:15" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "9870:5:15", + "nodeType": "YulIdentifier", + "src": "9870:5:15" + }, + "nativeSrc": "9870:27:15", + "nodeType": "YulFunctionCall", + "src": "9870:27:15" + }, + "variableNames": [ + { + "name": "r", + "nativeSrc": "9865:1:15", + "nodeType": "YulIdentifier", + "src": "9865:1:15" + } + ] + }, + { + "nativeSrc": "9914:32:15", + "nodeType": "YulAssignment", + "src": "9914:32:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "signature", + "nativeSrc": "9929:9:15", + "nodeType": "YulIdentifier", + "src": "9929:9:15" + }, + { + "kind": "number", + "nativeSrc": "9940:4:15", + "nodeType": "YulLiteral", + "src": "9940:4:15", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9925:3:15", + "nodeType": "YulIdentifier", + "src": "9925:3:15" + }, + "nativeSrc": "9925:20:15", + "nodeType": "YulFunctionCall", + "src": "9925:20:15" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "9919:5:15", + "nodeType": "YulIdentifier", + "src": "9919:5:15" + }, + "nativeSrc": "9919:27:15", + "nodeType": "YulFunctionCall", + "src": "9919:27:15" + }, + "variableNames": [ + { + "name": "s", + "nativeSrc": "9914:1:15", + "nodeType": "YulIdentifier", + "src": "9914:1:15" + } + ] + }, + { + "nativeSrc": "9963:41:15", + "nodeType": "YulAssignment", + "src": "9963:41:15", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9973:1:15", + "nodeType": "YulLiteral", + "src": "9973:1:15", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "signature", + "nativeSrc": "9986:9:15", + "nodeType": "YulIdentifier", + "src": "9986:9:15" + }, + { + "kind": "number", + "nativeSrc": "9997:4:15", + "nodeType": "YulLiteral", + "src": "9997:4:15", + "type": "", + "value": "0x60" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9982:3:15", + "nodeType": "YulIdentifier", + "src": "9982:3:15" + }, + "nativeSrc": "9982:20:15", + "nodeType": "YulFunctionCall", + "src": "9982:20:15" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "9976:5:15", + "nodeType": "YulIdentifier", + "src": "9976:5:15" + }, + "nativeSrc": "9976:27:15", + "nodeType": "YulFunctionCall", + "src": "9976:27:15" + } + ], + "functionName": { + "name": "byte", + "nativeSrc": "9968:4:15", + "nodeType": "YulIdentifier", + "src": "9968:4:15" + }, + "nativeSrc": "9968:36:15", + "nodeType": "YulFunctionCall", + "src": "9968:36:15" + }, + "variableNames": [ + { + "name": "v", + "nativeSrc": "9963:1:15", + "nodeType": "YulIdentifier", + "src": "9963:1:15" + } + ] + } + ] + }, + "nativeSrc": "9839:179:15", + "nodeType": "YulCase", + "src": "9839:179:15", + "value": { + "kind": "number", + "nativeSrc": "9844:2:15", + "nodeType": "YulLiteral", + "src": "9844:2:15", + "type": "", + "value": "65" + } + }, + { + "body": { + "nativeSrc": "10125:206:15", + "nodeType": "YulBlock", + "src": "10125:206:15", + "statements": [ + { + "nativeSrc": "10143:37:15", + "nodeType": "YulVariableDeclaration", + "src": "10143:37:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "signature", + "nativeSrc": "10163:9:15", + "nodeType": "YulIdentifier", + "src": "10163:9:15" + }, + { + "kind": "number", + "nativeSrc": "10174:4:15", + "nodeType": "YulLiteral", + "src": "10174:4:15", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10159:3:15", + "nodeType": "YulIdentifier", + "src": "10159:3:15" + }, + "nativeSrc": "10159:20:15", + "nodeType": "YulFunctionCall", + "src": "10159:20:15" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "10153:5:15", + "nodeType": "YulIdentifier", + "src": "10153:5:15" + }, + "nativeSrc": "10153:27:15", + "nodeType": "YulFunctionCall", + "src": "10153:27:15" + }, + "variables": [ + { + "name": "vs", + "nativeSrc": "10147:2:15", + "nodeType": "YulTypedName", + "src": "10147:2:15", + "type": "" + } + ] + }, + { + "nativeSrc": "10197:32:15", + "nodeType": "YulAssignment", + "src": "10197:32:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "signature", + "nativeSrc": "10212:9:15", + "nodeType": "YulIdentifier", + "src": "10212:9:15" + }, + { + "kind": "number", + "nativeSrc": "10223:4:15", + "nodeType": "YulLiteral", + "src": "10223:4:15", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10208:3:15", + "nodeType": "YulIdentifier", + "src": "10208:3:15" + }, + "nativeSrc": "10208:20:15", + "nodeType": "YulFunctionCall", + "src": "10208:20:15" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "10202:5:15", + "nodeType": "YulIdentifier", + "src": "10202:5:15" + }, + "nativeSrc": "10202:27:15", + "nodeType": "YulFunctionCall", + "src": "10202:27:15" + }, + "variableNames": [ + { + "name": "r", + "nativeSrc": "10197:1:15", + "nodeType": "YulIdentifier", + "src": "10197:1:15" + } + ] + }, + { + "nativeSrc": "10246:28:15", + "nodeType": "YulAssignment", + "src": "10246:28:15", + "value": { + "arguments": [ + { + "name": "vs", + "nativeSrc": "10255:2:15", + "nodeType": "YulIdentifier", + "src": "10255:2:15" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10263:1:15", + "nodeType": "YulLiteral", + "src": "10263:1:15", + "type": "", + "value": "1" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10270:1:15", + "nodeType": "YulLiteral", + "src": "10270:1:15", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "10266:3:15", + "nodeType": "YulIdentifier", + "src": "10266:3:15" + }, + "nativeSrc": "10266:6:15", + "nodeType": "YulFunctionCall", + "src": "10266:6:15" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "10259:3:15", + "nodeType": "YulIdentifier", + "src": "10259:3:15" + }, + "nativeSrc": "10259:14:15", + "nodeType": "YulFunctionCall", + "src": "10259:14:15" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "10251:3:15", + "nodeType": "YulIdentifier", + "src": "10251:3:15" + }, + "nativeSrc": "10251:23:15", + "nodeType": "YulFunctionCall", + "src": "10251:23:15" + }, + "variableNames": [ + { + "name": "s", + "nativeSrc": "10246:1:15", + "nodeType": "YulIdentifier", + "src": "10246:1:15" + } + ] + }, + { + "nativeSrc": "10291:26:15", + "nodeType": "YulAssignment", + "src": "10291:26:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10304:3:15", + "nodeType": "YulLiteral", + "src": "10304:3:15", + "type": "", + "value": "255" + }, + { + "name": "vs", + "nativeSrc": "10309:2:15", + "nodeType": "YulIdentifier", + "src": "10309:2:15" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "10300:3:15", + "nodeType": "YulIdentifier", + "src": "10300:3:15" + }, + "nativeSrc": "10300:12:15", + "nodeType": "YulFunctionCall", + "src": "10300:12:15" + }, + { + "kind": "number", + "nativeSrc": "10314:2:15", + "nodeType": "YulLiteral", + "src": "10314:2:15", + "type": "", + "value": "27" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10296:3:15", + "nodeType": "YulIdentifier", + "src": "10296:3:15" + }, + "nativeSrc": "10296:21:15", + "nodeType": "YulFunctionCall", + "src": "10296:21:15" + }, + "variableNames": [ + { + "name": "v", + "nativeSrc": "10291:1:15", + "nodeType": "YulIdentifier", + "src": "10291:1:15" + } + ] + } + ] + }, + "nativeSrc": "10117:214:15", + "nodeType": "YulCase", + "src": "10117:214:15", + "value": { + "kind": "number", + "nativeSrc": "10122:2:15", + "nodeType": "YulLiteral", + "src": "10122:2:15", + "type": "", + "value": "64" + } + }, + { + "body": { + "nativeSrc": "10352:84:15", + "nodeType": "YulBlock", + "src": "10352:84:15", + "statements": [ + { + "nativeSrc": "10370:6:15", + "nodeType": "YulAssignment", + "src": "10370:6:15", + "value": { + "kind": "number", + "nativeSrc": "10375:1:15", + "nodeType": "YulLiteral", + "src": "10375:1:15", + "type": "", + "value": "0" + }, + "variableNames": [ + { + "name": "r", + "nativeSrc": "10370:1:15", + "nodeType": "YulIdentifier", + "src": "10370:1:15" + } + ] + }, + { + "nativeSrc": "10393:6:15", + "nodeType": "YulAssignment", + "src": "10393:6:15", + "value": { + "kind": "number", + "nativeSrc": "10398:1:15", + "nodeType": "YulLiteral", + "src": "10398:1:15", + "type": "", + "value": "0" + }, + "variableNames": [ + { + "name": "s", + "nativeSrc": "10393:1:15", + "nodeType": "YulIdentifier", + "src": "10393:1:15" + } + ] + }, + { + "nativeSrc": "10416:6:15", + "nodeType": "YulAssignment", + "src": "10416:6:15", + "value": { + "kind": "number", + "nativeSrc": "10421:1:15", + "nodeType": "YulLiteral", + "src": "10421:1:15", + "type": "", + "value": "0" + }, + "variableNames": [ + { + "name": "v", + "nativeSrc": "10416:1:15", + "nodeType": "YulIdentifier", + "src": "10416:1:15" + } + ] + } + ] + }, + "nativeSrc": "10344:92:15", + "nodeType": "YulCase", + "src": "10344:92:15", + "value": "default" + } + ], + "expression": { + "arguments": [ + { + "name": "signature", + "nativeSrc": "9763:9:15", + "nodeType": "YulIdentifier", + "src": "9763:9:15" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "9757:5:15", + "nodeType": "YulIdentifier", + "src": "9757:5:15" + }, + "nativeSrc": "9757:16:15", + "nodeType": "YulFunctionCall", + "src": "9757:16:15" + }, + "nativeSrc": "9750:686:15", + "nodeType": "YulSwitch", + "src": "9750:686:15" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4067, + "isOffset": false, + "isSlot": false, + "src": "10197:1:15", + "valueSize": 1 + }, + { + "declaration": 4067, + "isOffset": false, + "isSlot": false, + "src": "10370:1:15", + "valueSize": 1 + }, + { + "declaration": 4067, + "isOffset": false, + "isSlot": false, + "src": "9865:1:15", + "valueSize": 1 + }, + { + "declaration": 4069, + "isOffset": false, + "isSlot": false, + "src": "10246:1:15", + "valueSize": 1 + }, + { + "declaration": 4069, + "isOffset": false, + "isSlot": false, + "src": "10393:1:15", + "valueSize": 1 + }, + { + "declaration": 4069, + "isOffset": false, + "isSlot": false, + "src": "9914:1:15", + "valueSize": 1 + }, + { + "declaration": 4062, + "isOffset": false, + "isSlot": false, + "src": "10163:9:15", + "valueSize": 1 + }, + { + "declaration": 4062, + "isOffset": false, + "isSlot": false, + "src": "10212:9:15", + "valueSize": 1 + }, + { + "declaration": 4062, + "isOffset": false, + "isSlot": false, + "src": "9763:9:15", + "valueSize": 1 + }, + { + "declaration": 4062, + "isOffset": false, + "isSlot": false, + "src": "9880:9:15", + "valueSize": 1 + }, + { + "declaration": 4062, + "isOffset": false, + "isSlot": false, + "src": "9929:9:15", + "valueSize": 1 + }, + { + "declaration": 4062, + "isOffset": false, + "isSlot": false, + "src": "9986:9:15", + "valueSize": 1 + }, + { + "declaration": 4065, + "isOffset": false, + "isSlot": false, + "src": "10291:1:15", + "valueSize": 1 + }, + { + "declaration": 4065, + "isOffset": false, + "isSlot": false, + "src": "10416:1:15", + "valueSize": 1 + }, + { + "declaration": 4065, + "isOffset": false, + "isSlot": false, + "src": "9963:1:15", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4071, + "nodeType": "InlineAssembly", + "src": "9669:777:15" + } + ] + }, + "documentation": { + "id": 4060, + "nodeType": "StructuredDocumentation", + "src": "9079:482:15", + "text": " @dev Parse a signature into its `v`, `r` and `s` components. Supports 65-byte and 64-byte (ERC-2098)\n formats. Returns (0,0,0) for invalid signatures.\n For 64-byte signatures, `v` is automatically normalized to 27 or 28.\n For 65-byte signatures, `v` is returned as-is and MUST already be 27 or 28 for use with ecrecover.\n Consider validating the result before use, or use {tryRecover}/{recover} which perform full validation." + }, + "id": 4073, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parse", + "nameLocation": "9575:5:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4063, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4062, + "mutability": "mutable", + "name": "signature", + "nameLocation": "9594:9:15", + "nodeType": "VariableDeclaration", + "scope": 4073, + "src": "9581:22:15", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 4061, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "9581:5:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "9580:24:15" + }, + "returnParameters": { + "id": 4070, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4065, + "mutability": "mutable", + "name": "v", + "nameLocation": "9634:1:15", + "nodeType": "VariableDeclaration", + "scope": 4073, + "src": "9628:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 4064, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "9628:5:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4067, + "mutability": "mutable", + "name": "r", + "nameLocation": "9645:1:15", + "nodeType": "VariableDeclaration", + "scope": 4073, + "src": "9637:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4066, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "9637:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4069, + "mutability": "mutable", + "name": "s", + "nameLocation": "9656:1:15", + "nodeType": "VariableDeclaration", + "scope": 4073, + "src": "9648:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4068, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "9648:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "9627:31:15" + }, + "scope": 4137, + "src": "9566:886:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4086, + "nodeType": "Block", + "src": "10643:841:15", + "statements": [ + { + "AST": { + "nativeSrc": "10678:800:15", + "nodeType": "YulBlock", + "src": "10678:800:15", + "statements": [ + { + "cases": [ + { + "body": { + "nativeSrc": "10831:202:15", + "nodeType": "YulBlock", + "src": "10831:202:15", + "statements": [ + { + "nativeSrc": "10849:35:15", + "nodeType": "YulAssignment", + "src": "10849:35:15", + "value": { + "arguments": [ + { + "name": "signature.offset", + "nativeSrc": "10867:16:15", + "nodeType": "YulIdentifier", + "src": "10867:16:15" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "10854:12:15", + "nodeType": "YulIdentifier", + "src": "10854:12:15" + }, + "nativeSrc": "10854:30:15", + "nodeType": "YulFunctionCall", + "src": "10854:30:15" + }, + "variableNames": [ + { + "name": "r", + "nativeSrc": "10849:1:15", + "nodeType": "YulIdentifier", + "src": "10849:1:15" + } + ] + }, + { + "nativeSrc": "10901:46:15", + "nodeType": "YulAssignment", + "src": "10901:46:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "signature.offset", + "nativeSrc": "10923:16:15", + "nodeType": "YulIdentifier", + "src": "10923:16:15" + }, + { + "kind": "number", + "nativeSrc": "10941:4:15", + "nodeType": "YulLiteral", + "src": "10941:4:15", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10919:3:15", + "nodeType": "YulIdentifier", + "src": "10919:3:15" + }, + "nativeSrc": "10919:27:15", + "nodeType": "YulFunctionCall", + "src": "10919:27:15" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "10906:12:15", + "nodeType": "YulIdentifier", + "src": "10906:12:15" + }, + "nativeSrc": "10906:41:15", + "nodeType": "YulFunctionCall", + "src": "10906:41:15" + }, + "variableNames": [ + { + "name": "s", + "nativeSrc": "10901:1:15", + "nodeType": "YulIdentifier", + "src": "10901:1:15" + } + ] + }, + { + "nativeSrc": "10964:55:15", + "nodeType": "YulAssignment", + "src": "10964:55:15", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10974:1:15", + "nodeType": "YulLiteral", + "src": "10974:1:15", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "signature.offset", + "nativeSrc": "10994:16:15", + "nodeType": "YulIdentifier", + "src": "10994:16:15" + }, + { + "kind": "number", + "nativeSrc": "11012:4:15", + "nodeType": "YulLiteral", + "src": "11012:4:15", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10990:3:15", + "nodeType": "YulIdentifier", + "src": "10990:3:15" + }, + "nativeSrc": "10990:27:15", + "nodeType": "YulFunctionCall", + "src": "10990:27:15" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "10977:12:15", + "nodeType": "YulIdentifier", + "src": "10977:12:15" + }, + "nativeSrc": "10977:41:15", + "nodeType": "YulFunctionCall", + "src": "10977:41:15" + } + ], + "functionName": { + "name": "byte", + "nativeSrc": "10969:4:15", + "nodeType": "YulIdentifier", + "src": "10969:4:15" + }, + "nativeSrc": "10969:50:15", + "nodeType": "YulFunctionCall", + "src": "10969:50:15" + }, + "variableNames": [ + { + "name": "v", + "nativeSrc": "10964:1:15", + "nodeType": "YulIdentifier", + "src": "10964:1:15" + } + ] + } + ] + }, + "nativeSrc": "10823:210:15", + "nodeType": "YulCase", + "src": "10823:210:15", + "value": { + "kind": "number", + "nativeSrc": "10828:2:15", + "nodeType": "YulLiteral", + "src": "10828:2:15", + "type": "", + "value": "65" + } + }, + { + "body": { + "nativeSrc": "11140:223:15", + "nodeType": "YulBlock", + "src": "11140:223:15", + "statements": [ + { + "nativeSrc": "11158:51:15", + "nodeType": "YulVariableDeclaration", + "src": "11158:51:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "signature.offset", + "nativeSrc": "11185:16:15", + "nodeType": "YulIdentifier", + "src": "11185:16:15" + }, + { + "kind": "number", + "nativeSrc": "11203:4:15", + "nodeType": "YulLiteral", + "src": "11203:4:15", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "11181:3:15", + "nodeType": "YulIdentifier", + "src": "11181:3:15" + }, + "nativeSrc": "11181:27:15", + "nodeType": "YulFunctionCall", + "src": "11181:27:15" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "11168:12:15", + "nodeType": "YulIdentifier", + "src": "11168:12:15" + }, + "nativeSrc": "11168:41:15", + "nodeType": "YulFunctionCall", + "src": "11168:41:15" + }, + "variables": [ + { + "name": "vs", + "nativeSrc": "11162:2:15", + "nodeType": "YulTypedName", + "src": "11162:2:15", + "type": "" + } + ] + }, + { + "nativeSrc": "11226:35:15", + "nodeType": "YulAssignment", + "src": "11226:35:15", + "value": { + "arguments": [ + { + "name": "signature.offset", + "nativeSrc": "11244:16:15", + "nodeType": "YulIdentifier", + "src": "11244:16:15" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "11231:12:15", + "nodeType": "YulIdentifier", + "src": "11231:12:15" + }, + "nativeSrc": "11231:30:15", + "nodeType": "YulFunctionCall", + "src": "11231:30:15" + }, + "variableNames": [ + { + "name": "r", + "nativeSrc": "11226:1:15", + "nodeType": "YulIdentifier", + "src": "11226:1:15" + } + ] + }, + { + "nativeSrc": "11278:28:15", + "nodeType": "YulAssignment", + "src": "11278:28:15", + "value": { + "arguments": [ + { + "name": "vs", + "nativeSrc": "11287:2:15", + "nodeType": "YulIdentifier", + "src": "11287:2:15" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11295:1:15", + "nodeType": "YulLiteral", + "src": "11295:1:15", + "type": "", + "value": "1" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11302:1:15", + "nodeType": "YulLiteral", + "src": "11302:1:15", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "11298:3:15", + "nodeType": "YulIdentifier", + "src": "11298:3:15" + }, + "nativeSrc": "11298:6:15", + "nodeType": "YulFunctionCall", + "src": "11298:6:15" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "11291:3:15", + "nodeType": "YulIdentifier", + "src": "11291:3:15" + }, + "nativeSrc": "11291:14:15", + "nodeType": "YulFunctionCall", + "src": "11291:14:15" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "11283:3:15", + "nodeType": "YulIdentifier", + "src": "11283:3:15" + }, + "nativeSrc": "11283:23:15", + "nodeType": "YulFunctionCall", + "src": "11283:23:15" + }, + "variableNames": [ + { + "name": "s", + "nativeSrc": "11278:1:15", + "nodeType": "YulIdentifier", + "src": "11278:1:15" + } + ] + }, + { + "nativeSrc": "11323:26:15", + "nodeType": "YulAssignment", + "src": "11323:26:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11336:3:15", + "nodeType": "YulLiteral", + "src": "11336:3:15", + "type": "", + "value": "255" + }, + { + "name": "vs", + "nativeSrc": "11341:2:15", + "nodeType": "YulIdentifier", + "src": "11341:2:15" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "11332:3:15", + "nodeType": "YulIdentifier", + "src": "11332:3:15" + }, + "nativeSrc": "11332:12:15", + "nodeType": "YulFunctionCall", + "src": "11332:12:15" + }, + { + "kind": "number", + "nativeSrc": "11346:2:15", + "nodeType": "YulLiteral", + "src": "11346:2:15", + "type": "", + "value": "27" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "11328:3:15", + "nodeType": "YulIdentifier", + "src": "11328:3:15" + }, + "nativeSrc": "11328:21:15", + "nodeType": "YulFunctionCall", + "src": "11328:21:15" + }, + "variableNames": [ + { + "name": "v", + "nativeSrc": "11323:1:15", + "nodeType": "YulIdentifier", + "src": "11323:1:15" + } + ] + } + ] + }, + "nativeSrc": "11132:231:15", + "nodeType": "YulCase", + "src": "11132:231:15", + "value": { + "kind": "number", + "nativeSrc": "11137:2:15", + "nodeType": "YulLiteral", + "src": "11137:2:15", + "type": "", + "value": "64" + } + }, + { + "body": { + "nativeSrc": "11384:84:15", + "nodeType": "YulBlock", + "src": "11384:84:15", + "statements": [ + { + "nativeSrc": "11402:6:15", + "nodeType": "YulAssignment", + "src": "11402:6:15", + "value": { + "kind": "number", + "nativeSrc": "11407:1:15", + "nodeType": "YulLiteral", + "src": "11407:1:15", + "type": "", + "value": "0" + }, + "variableNames": [ + { + "name": "r", + "nativeSrc": "11402:1:15", + "nodeType": "YulIdentifier", + "src": "11402:1:15" + } + ] + }, + { + "nativeSrc": "11425:6:15", + "nodeType": "YulAssignment", + "src": "11425:6:15", + "value": { + "kind": "number", + "nativeSrc": "11430:1:15", + "nodeType": "YulLiteral", + "src": "11430:1:15", + "type": "", + "value": "0" + }, + "variableNames": [ + { + "name": "s", + "nativeSrc": "11425:1:15", + "nodeType": "YulIdentifier", + "src": "11425:1:15" + } + ] + }, + { + "nativeSrc": "11448:6:15", + "nodeType": "YulAssignment", + "src": "11448:6:15", + "value": { + "kind": "number", + "nativeSrc": "11453:1:15", + "nodeType": "YulLiteral", + "src": "11453:1:15", + "type": "", + "value": "0" + }, + "variableNames": [ + { + "name": "v", + "nativeSrc": "11448:1:15", + "nodeType": "YulIdentifier", + "src": "11448:1:15" + } + ] + } + ] + }, + "nativeSrc": "11376:92:15", + "nodeType": "YulCase", + "src": "11376:92:15", + "value": "default" + } + ], + "expression": { + "name": "signature.length", + "nativeSrc": "10741:16:15", + "nodeType": "YulIdentifier", + "src": "10741:16:15" + }, + "nativeSrc": "10734:734:15", + "nodeType": "YulSwitch", + "src": "10734:734:15" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4081, + "isOffset": false, + "isSlot": false, + "src": "10849:1:15", + "valueSize": 1 + }, + { + "declaration": 4081, + "isOffset": false, + "isSlot": false, + "src": "11226:1:15", + "valueSize": 1 + }, + { + "declaration": 4081, + "isOffset": false, + "isSlot": false, + "src": "11402:1:15", + "valueSize": 1 + }, + { + "declaration": 4083, + "isOffset": false, + "isSlot": false, + "src": "10901:1:15", + "valueSize": 1 + }, + { + "declaration": 4083, + "isOffset": false, + "isSlot": false, + "src": "11278:1:15", + "valueSize": 1 + }, + { + "declaration": 4083, + "isOffset": false, + "isSlot": false, + "src": "11425:1:15", + "valueSize": 1 + }, + { + "declaration": 4076, + "isOffset": false, + "isSlot": false, + "src": "10741:16:15", + "suffix": "length", + "valueSize": 1 + }, + { + "declaration": 4076, + "isOffset": true, + "isSlot": false, + "src": "10867:16:15", + "suffix": "offset", + "valueSize": 1 + }, + { + "declaration": 4076, + "isOffset": true, + "isSlot": false, + "src": "10923:16:15", + "suffix": "offset", + "valueSize": 1 + }, + { + "declaration": 4076, + "isOffset": true, + "isSlot": false, + "src": "10994:16:15", + "suffix": "offset", + "valueSize": 1 + }, + { + "declaration": 4076, + "isOffset": true, + "isSlot": false, + "src": "11185:16:15", + "suffix": "offset", + "valueSize": 1 + }, + { + "declaration": 4076, + "isOffset": true, + "isSlot": false, + "src": "11244:16:15", + "suffix": "offset", + "valueSize": 1 + }, + { + "declaration": 4079, + "isOffset": false, + "isSlot": false, + "src": "10964:1:15", + "valueSize": 1 + }, + { + "declaration": 4079, + "isOffset": false, + "isSlot": false, + "src": "11323:1:15", + "valueSize": 1 + }, + { + "declaration": 4079, + "isOffset": false, + "isSlot": false, + "src": "11448:1:15", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4085, + "nodeType": "InlineAssembly", + "src": "10653:825:15" + } + ] + }, + "documentation": { + "id": 4074, + "nodeType": "StructuredDocumentation", + "src": "10458:77:15", + "text": " @dev Variant of {parse} that takes a signature in calldata" + }, + "id": 4087, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parseCalldata", + "nameLocation": "10549:13:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4077, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4076, + "mutability": "mutable", + "name": "signature", + "nameLocation": "10578:9:15", + "nodeType": "VariableDeclaration", + "scope": 4087, + "src": "10563:24:15", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 4075, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "10563:5:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "10562:26:15" + }, + "returnParameters": { + "id": 4084, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4079, + "mutability": "mutable", + "name": "v", + "nameLocation": "10618:1:15", + "nodeType": "VariableDeclaration", + "scope": 4087, + "src": "10612:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 4078, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "10612:5:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4081, + "mutability": "mutable", + "name": "r", + "nameLocation": "10629:1:15", + "nodeType": "VariableDeclaration", + "scope": 4087, + "src": "10621:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4080, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "10621:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4083, + "mutability": "mutable", + "name": "s", + "nameLocation": "10640:1:15", + "nodeType": "VariableDeclaration", + "scope": 4087, + "src": "10632:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4082, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "10632:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "10611:31:15" + }, + "scope": 4137, + "src": "10540:944:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4135, + "nodeType": "Block", + "src": "11689:460:15", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "id": 4099, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4096, + "name": "error", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4091, + "src": "11703:5:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "expression": { + "id": 4097, + "name": "RecoverError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3686, + "src": "11712:12:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_RecoverError_$3686_$", + "typeString": "type(enum ECDSA.RecoverError)" + } + }, + "id": 4098, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "11725:7:15", + "memberName": "NoError", + "nodeType": "MemberAccess", + "referencedDeclaration": 3682, + "src": "11712:20:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "src": "11703:29:15", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "id": 4105, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4102, + "name": "error", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4091, + "src": "11799:5:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "expression": { + "id": 4103, + "name": "RecoverError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3686, + "src": "11808:12:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_RecoverError_$3686_$", + "typeString": "type(enum ECDSA.RecoverError)" + } + }, + "id": 4104, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "11821:16:15", + "memberName": "InvalidSignature", + "nodeType": "MemberAccess", + "referencedDeclaration": 3683, + "src": "11808:29:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "src": "11799:38:15", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "id": 4113, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4110, + "name": "error", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4091, + "src": "11904:5:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "expression": { + "id": 4111, + "name": "RecoverError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3686, + "src": "11913:12:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_RecoverError_$3686_$", + "typeString": "type(enum ECDSA.RecoverError)" + } + }, + "id": 4112, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "11926:22:15", + "memberName": "InvalidSignatureLength", + "nodeType": "MemberAccess", + "referencedDeclaration": 3684, + "src": "11913:35:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "src": "11904:44:15", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "id": 4125, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4122, + "name": "error", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4091, + "src": "12038:5:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "expression": { + "id": 4123, + "name": "RecoverError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3686, + "src": "12047:12:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_RecoverError_$3686_$", + "typeString": "type(enum ECDSA.RecoverError)" + } + }, + "id": 4124, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "12060:17:15", + "memberName": "InvalidSignatureS", + "nodeType": "MemberAccess", + "referencedDeclaration": 3685, + "src": "12047:30:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "src": "12038:39:15", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4131, + "nodeType": "IfStatement", + "src": "12034:109:15", + "trueBody": { + "id": 4130, + "nodeType": "Block", + "src": "12079:64:15", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "id": 4127, + "name": "errorArg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4093, + "src": "12123:8:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 4126, + "name": "ECDSAInvalidSignatureS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3699, + "src": "12100:22:15", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_bytes32_$returns$_t_error_$", + "typeString": "function (bytes32) pure returns (error)" + } + }, + "id": 4128, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12100:32:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 4129, + "nodeType": "RevertStatement", + "src": "12093:39:15" + } + ] + } + }, + "id": 4132, + "nodeType": "IfStatement", + "src": "11900:243:15", + "trueBody": { + "id": 4121, + "nodeType": "Block", + "src": "11950:78:15", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "id": 4117, + "name": "errorArg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4093, + "src": "12007:8:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 4116, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "11999:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 4115, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11999:7:15", + "typeDescriptions": {} + } + }, + "id": 4118, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11999:17:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4114, + "name": "ECDSAInvalidSignatureLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3694, + "src": "11971:27:15", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint256) pure returns (error)" + } + }, + "id": 4119, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11971:46:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 4120, + "nodeType": "RevertStatement", + "src": "11964:53:15" + } + ] + } + }, + "id": 4133, + "nodeType": "IfStatement", + "src": "11795:348:15", + "trueBody": { + "id": 4109, + "nodeType": "Block", + "src": "11839:55:15", + "statements": [ + { + "errorCall": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 4106, + "name": "ECDSAInvalidSignature", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3689, + "src": "11860:21:15", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$__$returns$_t_error_$", + "typeString": "function () pure returns (error)" + } + }, + "id": 4107, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11860:23:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 4108, + "nodeType": "RevertStatement", + "src": "11853:30:15" + } + ] + } + }, + "id": 4134, + "nodeType": "IfStatement", + "src": "11699:444:15", + "trueBody": { + "id": 4101, + "nodeType": "Block", + "src": "11734:55:15", + "statements": [ + { + "functionReturnParameters": 4095, + "id": 4100, + "nodeType": "Return", + "src": "11748:7:15" + } + ] + } + } + ] + }, + "documentation": { + "id": 4088, + "nodeType": "StructuredDocumentation", + "src": "11490:122:15", + "text": " @dev Optionally reverts with the corresponding custom error according to the `error` argument provided." + }, + "id": 4136, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_throwError", + "nameLocation": "11626:11:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4094, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4091, + "mutability": "mutable", + "name": "error", + "nameLocation": "11651:5:15", + "nodeType": "VariableDeclaration", + "scope": 4136, + "src": "11638:18:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "typeName": { + "id": 4090, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 4089, + "name": "RecoverError", + "nameLocations": [ + "11638:12:15" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3686, + "src": "11638:12:15" + }, + "referencedDeclaration": 3686, + "src": "11638:12:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4093, + "mutability": "mutable", + "name": "errorArg", + "nameLocation": "11666:8:15", + "nodeType": "VariableDeclaration", + "scope": 4136, + "src": "11658:16:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4092, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "11658:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "11637:38:15" + }, + "returnParameters": { + "id": 4095, + "nodeType": "ParameterList", + "parameters": [], + "src": "11689:0:15" + }, + "scope": 4137, + "src": "11617:532:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "private" + } + ], + "scope": 4138, + "src": "344:11807:15", + "usedErrors": [ + 3689, + 3694, + 3699 + ], + "usedEvents": [] + } + ], + "src": "112:12040:15" + }, + "id": 15 + }, + "@openzeppelin/contracts/utils/cryptography/EIP712.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/cryptography/EIP712.sol", + "exportedSymbols": { + "EIP712": [ + 4364 + ], + "IERC5267": [ + 262 + ], + "MessageHashUtils": [ + 4535 + ], + "ShortString": [ + 1833 + ], + "ShortStrings": [ + 2044 + ] + }, + "id": 4365, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 4139, + "literals": [ + "solidity", + "^", + "0.8", + ".24" + ], + "nodeType": "PragmaDirective", + "src": "113:24:16" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol", + "file": "./MessageHashUtils.sol", + "id": 4141, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 4365, + "sourceUnit": 4536, + "src": "139:56:16", + "symbolAliases": [ + { + "foreign": { + "id": 4140, + "name": "MessageHashUtils", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4535, + "src": "147:16:16", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/ShortStrings.sol", + "file": "../ShortStrings.sol", + "id": 4144, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 4365, + "sourceUnit": 2045, + "src": "196:62:16", + "symbolAliases": [ + { + "foreign": { + "id": 4142, + "name": "ShortStrings", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2044, + "src": "204:12:16", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + }, + { + "foreign": { + "id": 4143, + "name": "ShortString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1833, + "src": "218:11:16", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/interfaces/IERC5267.sol", + "file": "../../interfaces/IERC5267.sol", + "id": 4146, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 4365, + "sourceUnit": 263, + "src": "259:55:16", + "symbolAliases": [ + { + "foreign": { + "id": 4145, + "name": "IERC5267", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 262, + "src": "267:8:16", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": true, + "baseContracts": [ + { + "baseName": { + "id": 4148, + "name": "IERC5267", + "nameLocations": [ + "1988:8:16" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 262, + "src": "1988:8:16" + }, + "id": 4149, + "nodeType": "InheritanceSpecifier", + "src": "1988:8:16" + } + ], + "canonicalName": "EIP712", + "contractDependencies": [], + "contractKind": "contract", + "documentation": { + "id": 4147, + "nodeType": "StructuredDocumentation", + "src": "316:1643:16", + "text": " @dev https://eips.ethereum.org/EIPS/eip-712[EIP-712] is a standard for hashing and signing of typed structured data.\n The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose\n encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract\n does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to\n produce the hash of their typed data using a combination of `abi.encode` and `keccak256`.\n This contract implements the EIP-712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n ({_hashTypedDataV4}).\n The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n the chain id to protect against replay attacks on an eventual fork of the chain.\n NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\n separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the\n separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\n @custom:oz-upgrades-unsafe-allow state-variable-immutable" + }, + "fullyImplemented": true, + "id": 4364, + "linearizedBaseContracts": [ + 4364, + 262 + ], + "name": "EIP712", + "nameLocation": "1978:6:16", + "nodeType": "ContractDefinition", + "nodes": [ + { + "global": false, + "id": 4151, + "libraryName": { + "id": 4150, + "name": "ShortStrings", + "nameLocations": [ + "2009:12:16" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2044, + "src": "2009:12:16" + }, + "nodeType": "UsingForDirective", + "src": "2003:25:16" + }, + { + "constant": true, + "id": 4156, + "mutability": "constant", + "name": "TYPE_HASH", + "nameLocation": "2059:9:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2034:140:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4152, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2034:7:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": { + "arguments": [ + { + "hexValue": "454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429", + "id": 4154, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2089:84:16", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f", + "typeString": "literal_string \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"" + }, + "value": "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f", + "typeString": "literal_string \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"" + } + ], + "id": 4153, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "2079:9:16", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 4155, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2079:95:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "private" + }, + { + "constant": false, + "id": 4158, + "mutability": "immutable", + "name": "_cachedDomainSeparator", + "nameLocation": "2399:22:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2373:48:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4157, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2373:7:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "private" + }, + { + "constant": false, + "id": 4160, + "mutability": "immutable", + "name": "_cachedChainId", + "nameLocation": "2453:14:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2427:40:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4159, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2427:7:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "private" + }, + { + "constant": false, + "id": 4162, + "mutability": "immutable", + "name": "_cachedThis", + "nameLocation": "2499:11:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2473:37:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 4161, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2473:7:16", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "private" + }, + { + "constant": false, + "id": 4164, + "mutability": "immutable", + "name": "_hashedName", + "nameLocation": "2543:11:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2517:37:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4163, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2517:7:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "private" + }, + { + "constant": false, + "id": 4166, + "mutability": "immutable", + "name": "_hashedVersion", + "nameLocation": "2586:14:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2560:40:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4165, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2560:7:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "private" + }, + { + "constant": false, + "id": 4169, + "mutability": "immutable", + "name": "_name", + "nameLocation": "2637:5:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2607:35:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + }, + "typeName": { + "id": 4168, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 4167, + "name": "ShortString", + "nameLocations": [ + "2607:11:16" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1833, + "src": "2607:11:16" + }, + "referencedDeclaration": 1833, + "src": "2607:11:16", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "visibility": "private" + }, + { + "constant": false, + "id": 4172, + "mutability": "immutable", + "name": "_version", + "nameLocation": "2678:8:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2648:38:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + }, + "typeName": { + "id": 4171, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 4170, + "name": "ShortString", + "nameLocations": [ + "2648:11:16" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1833, + "src": "2648:11:16" + }, + "referencedDeclaration": 1833, + "src": "2648:11:16", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "visibility": "private" + }, + { + "constant": false, + "id": 4174, + "mutability": "mutable", + "name": "_nameFallback", + "nameLocation": "2757:13:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2742:28:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string" + }, + "typeName": { + "id": 4173, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2742:6:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "private" + }, + { + "constant": false, + "id": 4176, + "mutability": "mutable", + "name": "_versionFallback", + "nameLocation": "2841:16:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2826:31:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string" + }, + "typeName": { + "id": 4175, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2826:6:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "private" + }, + { + "body": { + "id": 4233, + "nodeType": "Block", + "src": "3483:376:16", + "statements": [ + { + "expression": { + "id": 4189, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4184, + "name": "_name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4169, + "src": "3493:5:16", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 4187, + "name": "_nameFallback", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4174, + "src": "3532:13:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + ], + "expression": { + "id": 4185, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4179, + "src": "3501:4:16", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "id": 4186, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3506:25:16", + "memberName": "toShortStringWithFallback", + "nodeType": "MemberAccess", + "referencedDeclaration": 1985, + "src": "3501:30:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_string_memory_ptr_$_t_string_storage_ptr_$returns$_t_userDefinedValueType$_ShortString_$1833_$attached_to$_t_string_memory_ptr_$", + "typeString": "function (string memory,string storage pointer) returns (ShortString)" + } + }, + "id": 4188, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3501:45:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "src": "3493:53:16", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "id": 4190, + "nodeType": "ExpressionStatement", + "src": "3493:53:16" + }, + { + "expression": { + "id": 4196, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4191, + "name": "_version", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4172, + "src": "3556:8:16", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 4194, + "name": "_versionFallback", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4176, + "src": "3601:16:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + ], + "expression": { + "id": 4192, + "name": "version", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4181, + "src": "3567:7:16", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "id": 4193, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3575:25:16", + "memberName": "toShortStringWithFallback", + "nodeType": "MemberAccess", + "referencedDeclaration": 1985, + "src": "3567:33:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_string_memory_ptr_$_t_string_storage_ptr_$returns$_t_userDefinedValueType$_ShortString_$1833_$attached_to$_t_string_memory_ptr_$", + "typeString": "function (string memory,string storage pointer) returns (ShortString)" + } + }, + "id": 4195, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3567:51:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "src": "3556:62:16", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "id": 4197, + "nodeType": "ExpressionStatement", + "src": "3556:62:16" + }, + { + "expression": { + "id": 4205, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4198, + "name": "_hashedName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4164, + "src": "3628:11:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "arguments": [ + { + "id": 4202, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4179, + "src": "3658:4:16", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 4201, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3652:5:16", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 4200, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3652:5:16", + "typeDescriptions": {} + } + }, + "id": 4203, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3652:11:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 4199, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "3642:9:16", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 4204, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3642:22:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "3628:36:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 4206, + "nodeType": "ExpressionStatement", + "src": "3628:36:16" + }, + { + "expression": { + "id": 4214, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4207, + "name": "_hashedVersion", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4166, + "src": "3674:14:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "arguments": [ + { + "id": 4211, + "name": "version", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4181, + "src": "3707:7:16", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 4210, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3701:5:16", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 4209, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3701:5:16", + "typeDescriptions": {} + } + }, + "id": 4212, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3701:14:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 4208, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "3691:9:16", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 4213, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3691:25:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "3674:42:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 4215, + "nodeType": "ExpressionStatement", + "src": "3674:42:16" + }, + { + "expression": { + "id": 4219, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4216, + "name": "_cachedChainId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4160, + "src": "3727:14:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "expression": { + "id": 4217, + "name": "block", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -4, + "src": "3744:5:16", + "typeDescriptions": { + "typeIdentifier": "t_magic_block", + "typeString": "block" + } + }, + "id": 4218, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3750:7:16", + "memberName": "chainid", + "nodeType": "MemberAccess", + "src": "3744:13:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3727:30:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 4220, + "nodeType": "ExpressionStatement", + "src": "3727:30:16" + }, + { + "expression": { + "id": 4224, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4221, + "name": "_cachedDomainSeparator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4158, + "src": "3767:22:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 4222, + "name": "_buildDomainSeparator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4281, + "src": "3792:21:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_bytes32_$", + "typeString": "function () view returns (bytes32)" + } + }, + "id": 4223, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3792:23:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "3767:48:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 4225, + "nodeType": "ExpressionStatement", + "src": "3767:48:16" + }, + { + "expression": { + "id": 4231, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4226, + "name": "_cachedThis", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4162, + "src": "3825:11:16", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 4229, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "3847:4:16", + "typeDescriptions": { + "typeIdentifier": "t_contract$_EIP712_$4364", + "typeString": "contract EIP712" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_EIP712_$4364", + "typeString": "contract EIP712" + } + ], + "id": 4228, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3839:7:16", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 4227, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3839:7:16", + "typeDescriptions": {} + } + }, + "id": 4230, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3839:13:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "3825:27:16", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 4232, + "nodeType": "ExpressionStatement", + "src": "3825:27:16" + } + ] + }, + "documentation": { + "id": 4177, + "nodeType": "StructuredDocumentation", + "src": "2864:559:16", + "text": " @dev Initializes the domain separator and parameter caches.\n The meaning of `name` and `version` is specified in\n https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP-712]:\n - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n - `version`: the current major version of the signing domain.\n NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n contract upgrade]." + }, + "id": 4234, + "implemented": true, + "kind": "constructor", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4182, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4179, + "mutability": "mutable", + "name": "name", + "nameLocation": "3454:4:16", + "nodeType": "VariableDeclaration", + "scope": 4234, + "src": "3440:18:16", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 4178, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "3440:6:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4181, + "mutability": "mutable", + "name": "version", + "nameLocation": "3474:7:16", + "nodeType": "VariableDeclaration", + "scope": 4234, + "src": "3460:21:16", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 4180, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "3460:6:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "3439:43:16" + }, + "returnParameters": { + "id": 4183, + "nodeType": "ParameterList", + "parameters": [], + "src": "3483:0:16" + }, + "scope": 4364, + "src": "3428:431:16", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4259, + "nodeType": "Block", + "src": "4007:200:16", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 4250, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 4245, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 4242, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "4029:4:16", + "typeDescriptions": { + "typeIdentifier": "t_contract$_EIP712_$4364", + "typeString": "contract EIP712" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_EIP712_$4364", + "typeString": "contract EIP712" + } + ], + "id": 4241, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4021:7:16", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 4240, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "4021:7:16", + "typeDescriptions": {} + } + }, + "id": 4243, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4021:13:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 4244, + "name": "_cachedThis", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4162, + "src": "4038:11:16", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "4021:28:16", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4249, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 4246, + "name": "block", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -4, + "src": "4053:5:16", + "typeDescriptions": { + "typeIdentifier": "t_magic_block", + "typeString": "block" + } + }, + "id": 4247, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4059:7:16", + "memberName": "chainid", + "nodeType": "MemberAccess", + "src": "4053:13:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 4248, + "name": "_cachedChainId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4160, + "src": "4070:14:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4053:31:16", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "4021:63:16", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 4257, + "nodeType": "Block", + "src": "4146:55:16", + "statements": [ + { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 4254, + "name": "_buildDomainSeparator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4281, + "src": "4167:21:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_bytes32_$", + "typeString": "function () view returns (bytes32)" + } + }, + "id": 4255, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4167:23:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 4239, + "id": 4256, + "nodeType": "Return", + "src": "4160:30:16" + } + ] + }, + "id": 4258, + "nodeType": "IfStatement", + "src": "4017:184:16", + "trueBody": { + "id": 4253, + "nodeType": "Block", + "src": "4086:54:16", + "statements": [ + { + "expression": { + "id": 4251, + "name": "_cachedDomainSeparator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4158, + "src": "4107:22:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 4239, + "id": 4252, + "nodeType": "Return", + "src": "4100:29:16" + } + ] + } + } + ] + }, + "documentation": { + "id": 4235, + "nodeType": "StructuredDocumentation", + "src": "3865:75:16", + "text": " @dev Returns the domain separator for the current chain." + }, + "id": 4260, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_domainSeparatorV4", + "nameLocation": "3954:18:16", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4236, + "nodeType": "ParameterList", + "parameters": [], + "src": "3972:2:16" + }, + "returnParameters": { + "id": 4239, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4238, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4260, + "src": "3998:7:16", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4237, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3998:7:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "3997:9:16" + }, + "scope": 4364, + "src": "3945:262:16", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4280, + "nodeType": "Block", + "src": "4277:115:16", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "id": 4268, + "name": "TYPE_HASH", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4156, + "src": "4315:9:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 4269, + "name": "_hashedName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4164, + "src": "4326:11:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 4270, + "name": "_hashedVersion", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4166, + "src": "4339:14:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 4271, + "name": "block", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -4, + "src": "4355:5:16", + "typeDescriptions": { + "typeIdentifier": "t_magic_block", + "typeString": "block" + } + }, + "id": 4272, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4361:7:16", + "memberName": "chainid", + "nodeType": "MemberAccess", + "src": "4355:13:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [ + { + "id": 4275, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "4378:4:16", + "typeDescriptions": { + "typeIdentifier": "t_contract$_EIP712_$4364", + "typeString": "contract EIP712" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_EIP712_$4364", + "typeString": "contract EIP712" + } + ], + "id": 4274, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4370:7:16", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 4273, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "4370:7:16", + "typeDescriptions": {} + } + }, + "id": 4276, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4370:13:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "expression": { + "id": 4266, + "name": "abi", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -1, + "src": "4304:3:16", + "typeDescriptions": { + "typeIdentifier": "t_magic_abi", + "typeString": "abi" + } + }, + "id": 4267, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "4308:6:16", + "memberName": "encode", + "nodeType": "MemberAccess", + "src": "4304:10:16", + "typeDescriptions": { + "typeIdentifier": "t_function_abiencode_pure$__$returns$_t_bytes_memory_ptr_$", + "typeString": "function () pure returns (bytes memory)" + } + }, + "id": 4277, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4304:80:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 4265, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "4294:9:16", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 4278, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4294:91:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 4264, + "id": 4279, + "nodeType": "Return", + "src": "4287:98:16" + } + ] + }, + "id": 4281, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_buildDomainSeparator", + "nameLocation": "4222:21:16", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4261, + "nodeType": "ParameterList", + "parameters": [], + "src": "4243:2:16" + }, + "returnParameters": { + "id": 4264, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4263, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4281, + "src": "4268:7:16", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4262, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "4268:7:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "4267:9:16" + }, + "scope": 4364, + "src": "4213:179:16", + "stateMutability": "view", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 4296, + "nodeType": "Block", + "src": "5103:90:16", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 4291, + "name": "_domainSeparatorV4", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4260, + "src": "5153:18:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_bytes32_$", + "typeString": "function () view returns (bytes32)" + } + }, + "id": 4292, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5153:20:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 4293, + "name": "structHash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4284, + "src": "5175:10:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "id": 4289, + "name": "MessageHashUtils", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4535, + "src": "5120:16:16", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_MessageHashUtils_$4535_$", + "typeString": "type(library MessageHashUtils)" + } + }, + "id": 4290, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5137:15:16", + "memberName": "toTypedDataHash", + "nodeType": "MemberAccess", + "referencedDeclaration": 4451, + "src": "5120:32:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_bytes32_$returns$_t_bytes32_$", + "typeString": "function (bytes32,bytes32) pure returns (bytes32)" + } + }, + "id": 4294, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5120:66:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 4288, + "id": 4295, + "nodeType": "Return", + "src": "5113:73:16" + } + ] + }, + "documentation": { + "id": 4282, + "nodeType": "StructuredDocumentation", + "src": "4398:614:16", + "text": " @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n function returns the hash of the fully encoded EIP712 message for this domain.\n This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n ```solidity\n bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n keccak256(\"Mail(address to,string contents)\"),\n mailTo,\n keccak256(bytes(mailContents))\n )));\n address signer = ECDSA.recover(digest, signature);\n ```" + }, + "id": 4297, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_hashTypedDataV4", + "nameLocation": "5026:16:16", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4285, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4284, + "mutability": "mutable", + "name": "structHash", + "nameLocation": "5051:10:16", + "nodeType": "VariableDeclaration", + "scope": 4297, + "src": "5043:18:16", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4283, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5043:7:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "5042:20:16" + }, + "returnParameters": { + "id": 4288, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4287, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4297, + "src": "5094:7:16", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4286, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5094:7:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "5093:9:16" + }, + "scope": 4364, + "src": "5017:176:16", + "stateMutability": "view", + "virtual": true, + "visibility": "internal" + }, + { + "baseFunctions": [ + 261 + ], + "body": { + "id": 4338, + "nodeType": "Block", + "src": "5556:229:16", + "statements": [ + { + "expression": { + "components": [ + { + "hexValue": "0f", + "id": 4316, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "hexString", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5587:7:16", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_3d725c5ee53025f027da36bea8d3af3b6a3e9d2d1542d47c162631de48e66c1c", + "typeString": "literal_string hex\"0f\"" + }, + "value": "\u000f" + }, + { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 4317, + "name": "_EIP712Name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4351, + "src": "5617:11:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_string_memory_ptr_$", + "typeString": "function () view returns (string memory)" + } + }, + "id": 4318, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5617:13:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 4319, + "name": "_EIP712Version", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4363, + "src": "5644:14:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_string_memory_ptr_$", + "typeString": "function () view returns (string memory)" + } + }, + "id": 4320, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5644:16:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "expression": { + "id": 4321, + "name": "block", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -4, + "src": "5674:5:16", + "typeDescriptions": { + "typeIdentifier": "t_magic_block", + "typeString": "block" + } + }, + "id": 4322, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5680:7:16", + "memberName": "chainid", + "nodeType": "MemberAccess", + "src": "5674:13:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [ + { + "id": 4325, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "5709:4:16", + "typeDescriptions": { + "typeIdentifier": "t_contract$_EIP712_$4364", + "typeString": "contract EIP712" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_EIP712_$4364", + "typeString": "contract EIP712" + } + ], + "id": 4324, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5701:7:16", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 4323, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5701:7:16", + "typeDescriptions": {} + } + }, + "id": 4326, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5701:13:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "arguments": [ + { + "hexValue": "30", + "id": 4329, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5736:1:16", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 4328, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5728:7:16", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes32_$", + "typeString": "type(bytes32)" + }, + "typeName": { + "id": 4327, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5728:7:16", + "typeDescriptions": {} + } + }, + "id": 4330, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5728:10:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "arguments": [ + { + "hexValue": "30", + "id": 4334, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5766:1:16", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 4333, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "5752:13:16", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_ptr_$", + "typeString": "function (uint256) pure returns (uint256[] memory)" + }, + "typeName": { + "baseType": { + "id": 4331, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5756:7:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 4332, + "nodeType": "ArrayTypeName", + "src": "5756:9:16", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + } + }, + "id": 4335, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5752:16:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + } + ], + "id": 4336, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "5573:205:16", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_stringliteral_3d725c5ee53025f027da36bea8d3af3b6a3e9d2d1542d47c162631de48e66c1c_$_t_string_memory_ptr_$_t_string_memory_ptr_$_t_uint256_$_t_address_$_t_bytes32_$_t_array$_t_uint256_$dyn_memory_ptr_$", + "typeString": "tuple(literal_string hex\"0f\",string memory,string memory,uint256,address,bytes32,uint256[] memory)" + } + }, + "functionReturnParameters": 4315, + "id": 4337, + "nodeType": "Return", + "src": "5566:212:16" + } + ] + }, + "documentation": { + "id": 4298, + "nodeType": "StructuredDocumentation", + "src": "5199:24:16", + "text": "@inheritdoc IERC5267" + }, + "functionSelector": "84b0196e", + "id": 4339, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "eip712Domain", + "nameLocation": "5237:12:16", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4299, + "nodeType": "ParameterList", + "parameters": [], + "src": "5249:2:16" + }, + "returnParameters": { + "id": 4315, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4301, + "mutability": "mutable", + "name": "fields", + "nameLocation": "5333:6:16", + "nodeType": "VariableDeclaration", + "scope": 4339, + "src": "5326:13:16", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 4300, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "5326:6:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4303, + "mutability": "mutable", + "name": "name", + "nameLocation": "5367:4:16", + "nodeType": "VariableDeclaration", + "scope": 4339, + "src": "5353:18:16", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 4302, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "5353:6:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4305, + "mutability": "mutable", + "name": "version", + "nameLocation": "5399:7:16", + "nodeType": "VariableDeclaration", + "scope": 4339, + "src": "5385:21:16", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 4304, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "5385:6:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4307, + "mutability": "mutable", + "name": "chainId", + "nameLocation": "5428:7:16", + "nodeType": "VariableDeclaration", + "scope": 4339, + "src": "5420:15:16", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4306, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5420:7:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4309, + "mutability": "mutable", + "name": "verifyingContract", + "nameLocation": "5457:17:16", + "nodeType": "VariableDeclaration", + "scope": 4339, + "src": "5449:25:16", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 4308, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5449:7:16", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4311, + "mutability": "mutable", + "name": "salt", + "nameLocation": "5496:4:16", + "nodeType": "VariableDeclaration", + "scope": 4339, + "src": "5488:12:16", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4310, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5488:7:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4314, + "mutability": "mutable", + "name": "extensions", + "nameLocation": "5531:10:16", + "nodeType": "VariableDeclaration", + "scope": 4339, + "src": "5514:27:16", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[]" + }, + "typeName": { + "baseType": { + "id": 4312, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5514:7:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 4313, + "nodeType": "ArrayTypeName", + "src": "5514:9:16", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "visibility": "internal" + } + ], + "src": "5312:239:16" + }, + "scope": 4364, + "src": "5228:557:16", + "stateMutability": "view", + "virtual": true, + "visibility": "public" + }, + { + "body": { + "id": 4350, + "nodeType": "Block", + "src": "6166:65:16", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 4347, + "name": "_nameFallback", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4174, + "src": "6210:13:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + ], + "expression": { + "id": 4345, + "name": "_name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4169, + "src": "6183:5:16", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "id": 4346, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6189:20:16", + "memberName": "toStringWithFallback", + "nodeType": "MemberAccess", + "referencedDeclaration": 2012, + "src": "6183:26:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_userDefinedValueType$_ShortString_$1833_$_t_string_storage_ptr_$returns$_t_string_memory_ptr_$attached_to$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "function (ShortString,string storage pointer) pure returns (string memory)" + } + }, + "id": 4348, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6183:41:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 4344, + "id": 4349, + "nodeType": "Return", + "src": "6176:48:16" + } + ] + }, + "documentation": { + "id": 4340, + "nodeType": "StructuredDocumentation", + "src": "5791:256:16", + "text": " @dev The name parameter for the EIP712 domain.\n NOTE: By default this function reads _name which is an immutable value.\n It only reads from storage if necessary (in case the value is too large to fit in a ShortString)." + }, + "id": 4351, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_EIP712Name", + "nameLocation": "6114:11:16", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4341, + "nodeType": "ParameterList", + "parameters": [], + "src": "6125:2:16" + }, + "returnParameters": { + "id": 4344, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4343, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4351, + "src": "6151:13:16", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 4342, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "6151:6:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "6150:15:16" + }, + "scope": 4364, + "src": "6105:126:16", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4362, + "nodeType": "Block", + "src": "6621:71:16", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 4359, + "name": "_versionFallback", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4176, + "src": "6668:16:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + ], + "expression": { + "id": 4357, + "name": "_version", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4172, + "src": "6638:8:16", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "id": 4358, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6647:20:16", + "memberName": "toStringWithFallback", + "nodeType": "MemberAccess", + "referencedDeclaration": 2012, + "src": "6638:29:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_userDefinedValueType$_ShortString_$1833_$_t_string_storage_ptr_$returns$_t_string_memory_ptr_$attached_to$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "function (ShortString,string storage pointer) pure returns (string memory)" + } + }, + "id": 4360, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6638:47:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 4356, + "id": 4361, + "nodeType": "Return", + "src": "6631:54:16" + } + ] + }, + "documentation": { + "id": 4352, + "nodeType": "StructuredDocumentation", + "src": "6237:262:16", + "text": " @dev The version parameter for the EIP712 domain.\n NOTE: By default this function reads _version which is an immutable value.\n It only reads from storage if necessary (in case the value is too large to fit in a ShortString)." + }, + "id": 4363, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_EIP712Version", + "nameLocation": "6566:14:16", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4353, + "nodeType": "ParameterList", + "parameters": [], + "src": "6580:2:16" + }, + "returnParameters": { + "id": 4356, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4355, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4363, + "src": "6606:13:16", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 4354, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "6606:6:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "6605:15:16" + }, + "scope": 4364, + "src": "6557:135:16", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + } + ], + "scope": 4365, + "src": "1960:4734:16", + "usedErrors": [ + 1841, + 1843 + ], + "usedEvents": [ + 242 + ] + } + ], + "src": "113:6582:16" + }, + "id": 16 + }, + "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol", + "exportedSymbols": { + "MessageHashUtils": [ + 4535 + ], + "Strings": [ + 3678 + ] + }, + "id": 4536, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 4366, + "literals": [ + "solidity", + "^", + "0.8", + ".24" + ], + "nodeType": "PragmaDirective", + "src": "123:24:17" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/Strings.sol", + "file": "../Strings.sol", + "id": 4368, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 4536, + "sourceUnit": 3679, + "src": "149:39:17", + "symbolAliases": [ + { + "foreign": { + "id": 4367, + "name": "Strings", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3678, + "src": "157:7:17", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "MessageHashUtils", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 4369, + "nodeType": "StructuredDocumentation", + "src": "190:330:17", + "text": " @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.\n The library provides methods for generating a hash of a message that conforms to the\n https://eips.ethereum.org/EIPS/eip-191[ERC-191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]\n specifications." + }, + "fullyImplemented": true, + "id": 4535, + "linearizedBaseContracts": [ + 4535 + ], + "name": "MessageHashUtils", + "nameLocation": "529:16:17", + "nodeType": "ContractDefinition", + "nodes": [ + { + "errorSelector": "db00f904", + "id": 4371, + "name": "ERC5267ExtensionsNotSupported", + "nameLocation": "558:29:17", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 4370, + "nodeType": "ParameterList", + "parameters": [], + "src": "587:2:17" + }, + "src": "552:38:17" + }, + { + "body": { + "id": 4380, + "nodeType": "Block", + "src": "1383:341:17", + "statements": [ + { + "AST": { + "nativeSrc": "1418:300:17", + "nodeType": "YulBlock", + "src": "1418:300:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1439:4:17", + "nodeType": "YulLiteral", + "src": "1439:4:17", + "type": "", + "value": "0x00" + }, + { + "hexValue": "19457468657265756d205369676e6564204d6573736167653a0a3332", + "kind": "string", + "nativeSrc": "1445:34:17", + "nodeType": "YulLiteral", + "src": "1445:34:17", + "type": "", + "value": "\u0019Ethereum Signed Message:\n32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1432:6:17", + "nodeType": "YulIdentifier", + "src": "1432:6:17" + }, + "nativeSrc": "1432:48:17", + "nodeType": "YulFunctionCall", + "src": "1432:48:17" + }, + "nativeSrc": "1432:48:17", + "nodeType": "YulExpressionStatement", + "src": "1432:48:17" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1541:4:17", + "nodeType": "YulLiteral", + "src": "1541:4:17", + "type": "", + "value": "0x1c" + }, + { + "name": "messageHash", + "nativeSrc": "1547:11:17", + "nodeType": "YulIdentifier", + "src": "1547:11:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1534:6:17", + "nodeType": "YulIdentifier", + "src": "1534:6:17" + }, + "nativeSrc": "1534:25:17", + "nodeType": "YulFunctionCall", + "src": "1534:25:17" + }, + "nativeSrc": "1534:25:17", + "nodeType": "YulExpressionStatement", + "src": "1534:25:17" + }, + { + "nativeSrc": "1613:31:17", + "nodeType": "YulAssignment", + "src": "1613:31:17", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1633:4:17", + "nodeType": "YulLiteral", + "src": "1633:4:17", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "1639:4:17", + "nodeType": "YulLiteral", + "src": "1639:4:17", + "type": "", + "value": "0x3c" + } + ], + "functionName": { + "name": "keccak256", + "nativeSrc": "1623:9:17", + "nodeType": "YulIdentifier", + "src": "1623:9:17" + }, + "nativeSrc": "1623:21:17", + "nodeType": "YulFunctionCall", + "src": "1623:21:17" + }, + "variableNames": [ + { + "name": "digest", + "nativeSrc": "1613:6:17", + "nodeType": "YulIdentifier", + "src": "1613:6:17" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4377, + "isOffset": false, + "isSlot": false, + "src": "1613:6:17", + "valueSize": 1 + }, + { + "declaration": 4374, + "isOffset": false, + "isSlot": false, + "src": "1547:11:17", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4379, + "nodeType": "InlineAssembly", + "src": "1393:325:17" + } + ] + }, + "documentation": { + "id": 4372, + "nodeType": "StructuredDocumentation", + "src": "596:690:17", + "text": " @dev Returns the keccak256 digest of an ERC-191 signed data with version\n `0x45` (`personal_sign` messages).\n The digest is calculated by prefixing a bytes32 `messageHash` with\n `\"\\x19Ethereum Signed Message:\\n32\"` and hashing the result. It corresponds with the\n hash signed when using the https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sign[`eth_sign`] JSON-RPC method.\n NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with\n keccak256, although any bytes32 value can be safely used because the final digest will\n be re-hashed.\n See {ECDSA-recover}." + }, + "id": 4381, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toEthSignedMessageHash", + "nameLocation": "1300:22:17", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4375, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4374, + "mutability": "mutable", + "name": "messageHash", + "nameLocation": "1331:11:17", + "nodeType": "VariableDeclaration", + "scope": 4381, + "src": "1323:19:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4373, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1323:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "1322:21:17" + }, + "returnParameters": { + "id": 4378, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4377, + "mutability": "mutable", + "name": "digest", + "nameLocation": "1375:6:17", + "nodeType": "VariableDeclaration", + "scope": 4381, + "src": "1367:14:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4376, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1367:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "1366:16:17" + }, + "scope": 4535, + "src": "1291:433:17", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4406, + "nodeType": "Block", + "src": "2301:143:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "hexValue": "19457468657265756d205369676e6564204d6573736167653a0a", + "id": 4393, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2353:32:17", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_9af2d9c228f6cfddaa6d1e5b94e0bce4ab16bd9a472a2b7fbfd74ebff4c720b4", + "typeString": "literal_string hex\"19457468657265756d205369676e6564204d6573736167653a0a\"" + }, + "value": "\u0019Ethereum Signed Message:\n" + }, + { + "arguments": [ + { + "arguments": [ + { + "expression": { + "id": 4398, + "name": "message", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4384, + "src": "2410:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 4399, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2418:6:17", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "2410:14:17", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 4396, + "name": "Strings", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3678, + "src": "2393:7:17", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Strings_$3678_$", + "typeString": "type(library Strings)" + } + }, + "id": 4397, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2401:8:17", + "memberName": "toString", + "nodeType": "MemberAccess", + "referencedDeclaration": 2261, + "src": "2393:16:17", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_string_memory_ptr_$", + "typeString": "function (uint256) pure returns (string memory)" + } + }, + "id": 4400, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2393:32:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 4395, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2387:5:17", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 4394, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2387:5:17", + "typeDescriptions": {} + } + }, + "id": 4401, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2387:39:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 4402, + "name": "message", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4384, + "src": "2428:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_9af2d9c228f6cfddaa6d1e5b94e0bce4ab16bd9a472a2b7fbfd74ebff4c720b4", + "typeString": "literal_string hex\"19457468657265756d205369676e6564204d6573736167653a0a\"" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "id": 4391, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2340:5:17", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 4390, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2340:5:17", + "typeDescriptions": {} + } + }, + "id": 4392, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2346:6:17", + "memberName": "concat", + "nodeType": "MemberAccess", + "src": "2340:12:17", + "typeDescriptions": { + "typeIdentifier": "t_function_bytesconcat_pure$__$returns$_t_bytes_memory_ptr_$", + "typeString": "function () pure returns (bytes memory)" + } + }, + "id": 4403, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2340:96:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 4389, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "2330:9:17", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 4404, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2330:107:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 4388, + "id": 4405, + "nodeType": "Return", + "src": "2311:126:17" + } + ] + }, + "documentation": { + "id": 4382, + "nodeType": "StructuredDocumentation", + "src": "1730:480:17", + "text": " @dev Returns the keccak256 digest of an ERC-191 signed data with version\n `0x45` (`personal_sign` messages).\n The digest is calculated by prefixing an arbitrary `message` with\n `\"\\x19Ethereum Signed Message:\\n\" + len(message)` and hashing the result. It corresponds with the\n hash signed when using the https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sign[`eth_sign`] JSON-RPC method.\n See {ECDSA-recover}." + }, + "id": 4407, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toEthSignedMessageHash", + "nameLocation": "2224:22:17", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4385, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4384, + "mutability": "mutable", + "name": "message", + "nameLocation": "2260:7:17", + "nodeType": "VariableDeclaration", + "scope": 4407, + "src": "2247:20:17", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 4383, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2247:5:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "2246:22:17" + }, + "returnParameters": { + "id": 4388, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4387, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4407, + "src": "2292:7:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4386, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2292:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "2291:9:17" + }, + "scope": 4535, + "src": "2215:229:17", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4426, + "nodeType": "Block", + "src": "2898:80:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "hexValue": "1900", + "id": 4420, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "hexString", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2942:10:17", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_73fd5d154550a4a103564cb191928cd38898034de1b952dc21b290898b4b697a", + "typeString": "literal_string hex\"1900\"" + }, + "value": "\u0019\u0000" + }, + { + "id": 4421, + "name": "validator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4410, + "src": "2954:9:17", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 4422, + "name": "data", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4412, + "src": "2965:4:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_73fd5d154550a4a103564cb191928cd38898034de1b952dc21b290898b4b697a", + "typeString": "literal_string hex\"1900\"" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "id": 4418, + "name": "abi", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -1, + "src": "2925:3:17", + "typeDescriptions": { + "typeIdentifier": "t_magic_abi", + "typeString": "abi" + } + }, + "id": 4419, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "2929:12:17", + "memberName": "encodePacked", + "nodeType": "MemberAccess", + "src": "2925:16:17", + "typeDescriptions": { + "typeIdentifier": "t_function_abiencodepacked_pure$__$returns$_t_bytes_memory_ptr_$", + "typeString": "function () pure returns (bytes memory)" + } + }, + "id": 4423, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2925:45:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 4417, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "2915:9:17", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 4424, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2915:56:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 4416, + "id": 4425, + "nodeType": "Return", + "src": "2908:63:17" + } + ] + }, + "documentation": { + "id": 4408, + "nodeType": "StructuredDocumentation", + "src": "2450:332:17", + "text": " @dev Returns the keccak256 digest of an ERC-191 signed data with version\n `0x00` (data with intended validator).\n The digest is calculated by prefixing an arbitrary `data` with `\"\\x19\\x00\"` and the intended\n `validator` address. Then hashing the result.\n See {ECDSA-recover}." + }, + "id": 4427, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toDataWithIntendedValidatorHash", + "nameLocation": "2796:31:17", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4413, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4410, + "mutability": "mutable", + "name": "validator", + "nameLocation": "2836:9:17", + "nodeType": "VariableDeclaration", + "scope": 4427, + "src": "2828:17:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 4409, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2828:7:17", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4412, + "mutability": "mutable", + "name": "data", + "nameLocation": "2860:4:17", + "nodeType": "VariableDeclaration", + "scope": 4427, + "src": "2847:17:17", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 4411, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2847:5:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "2827:38:17" + }, + "returnParameters": { + "id": 4416, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4415, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4427, + "src": "2889:7:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4414, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2889:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "2888:9:17" + }, + "scope": 4535, + "src": "2787:191:17", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4438, + "nodeType": "Block", + "src": "3260:216:17", + "statements": [ + { + "AST": { + "nativeSrc": "3295:175:17", + "nodeType": "YulBlock", + "src": "3295:175:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3316:4:17", + "nodeType": "YulLiteral", + "src": "3316:4:17", + "type": "", + "value": "0x00" + }, + { + "hexValue": "1900", + "kind": "string", + "nativeSrc": "3322:10:17", + "nodeType": "YulLiteral", + "src": "3322:10:17", + "type": "", + "value": "\u0019\u0000" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3309:6:17", + "nodeType": "YulIdentifier", + "src": "3309:6:17" + }, + "nativeSrc": "3309:24:17", + "nodeType": "YulFunctionCall", + "src": "3309:24:17" + }, + "nativeSrc": "3309:24:17", + "nodeType": "YulExpressionStatement", + "src": "3309:24:17" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3353:4:17", + "nodeType": "YulLiteral", + "src": "3353:4:17", + "type": "", + "value": "0x02" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3363:2:17", + "nodeType": "YulLiteral", + "src": "3363:2:17", + "type": "", + "value": "96" + }, + { + "name": "validator", + "nativeSrc": "3367:9:17", + "nodeType": "YulIdentifier", + "src": "3367:9:17" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "3359:3:17", + "nodeType": "YulIdentifier", + "src": "3359:3:17" + }, + "nativeSrc": "3359:18:17", + "nodeType": "YulFunctionCall", + "src": "3359:18:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3346:6:17", + "nodeType": "YulIdentifier", + "src": "3346:6:17" + }, + "nativeSrc": "3346:32:17", + "nodeType": "YulFunctionCall", + "src": "3346:32:17" + }, + "nativeSrc": "3346:32:17", + "nodeType": "YulExpressionStatement", + "src": "3346:32:17" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3398:4:17", + "nodeType": "YulLiteral", + "src": "3398:4:17", + "type": "", + "value": "0x16" + }, + { + "name": "messageHash", + "nativeSrc": "3404:11:17", + "nodeType": "YulIdentifier", + "src": "3404:11:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3391:6:17", + "nodeType": "YulIdentifier", + "src": "3391:6:17" + }, + "nativeSrc": "3391:25:17", + "nodeType": "YulFunctionCall", + "src": "3391:25:17" + }, + "nativeSrc": "3391:25:17", + "nodeType": "YulExpressionStatement", + "src": "3391:25:17" + }, + { + "nativeSrc": "3429:31:17", + "nodeType": "YulAssignment", + "src": "3429:31:17", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3449:4:17", + "nodeType": "YulLiteral", + "src": "3449:4:17", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "3455:4:17", + "nodeType": "YulLiteral", + "src": "3455:4:17", + "type": "", + "value": "0x36" + } + ], + "functionName": { + "name": "keccak256", + "nativeSrc": "3439:9:17", + "nodeType": "YulIdentifier", + "src": "3439:9:17" + }, + "nativeSrc": "3439:21:17", + "nodeType": "YulFunctionCall", + "src": "3439:21:17" + }, + "variableNames": [ + { + "name": "digest", + "nativeSrc": "3429:6:17", + "nodeType": "YulIdentifier", + "src": "3429:6:17" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4435, + "isOffset": false, + "isSlot": false, + "src": "3429:6:17", + "valueSize": 1 + }, + { + "declaration": 4432, + "isOffset": false, + "isSlot": false, + "src": "3404:11:17", + "valueSize": 1 + }, + { + "declaration": 4430, + "isOffset": false, + "isSlot": false, + "src": "3367:9:17", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4437, + "nodeType": "InlineAssembly", + "src": "3270:200:17" + } + ] + }, + "documentation": { + "id": 4428, + "nodeType": "StructuredDocumentation", + "src": "2984:129:17", + "text": " @dev Variant of {toDataWithIntendedValidatorHash-address-bytes} optimized for cases where `data` is a bytes32." + }, + "id": 4439, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toDataWithIntendedValidatorHash", + "nameLocation": "3127:31:17", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4433, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4430, + "mutability": "mutable", + "name": "validator", + "nameLocation": "3176:9:17", + "nodeType": "VariableDeclaration", + "scope": 4439, + "src": "3168:17:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 4429, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3168:7:17", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4432, + "mutability": "mutable", + "name": "messageHash", + "nameLocation": "3203:11:17", + "nodeType": "VariableDeclaration", + "scope": 4439, + "src": "3195:19:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4431, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3195:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "3158:62:17" + }, + "returnParameters": { + "id": 4436, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4435, + "mutability": "mutable", + "name": "digest", + "nameLocation": "3252:6:17", + "nodeType": "VariableDeclaration", + "scope": 4439, + "src": "3244:14:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4434, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3244:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "3243:16:17" + }, + "scope": 4535, + "src": "3118:358:17", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4450, + "nodeType": "Block", + "src": "4027:265:17", + "statements": [ + { + "AST": { + "nativeSrc": "4062:224:17", + "nodeType": "YulBlock", + "src": "4062:224:17", + "statements": [ + { + "nativeSrc": "4076:22:17", + "nodeType": "YulVariableDeclaration", + "src": "4076:22:17", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "4093:4:17", + "nodeType": "YulLiteral", + "src": "4093:4:17", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "4087:5:17", + "nodeType": "YulIdentifier", + "src": "4087:5:17" + }, + "nativeSrc": "4087:11:17", + "nodeType": "YulFunctionCall", + "src": "4087:11:17" + }, + "variables": [ + { + "name": "ptr", + "nativeSrc": "4080:3:17", + "nodeType": "YulTypedName", + "src": "4080:3:17", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "4118:3:17", + "nodeType": "YulIdentifier", + "src": "4118:3:17" + }, + { + "hexValue": "1901", + "kind": "string", + "nativeSrc": "4123:10:17", + "nodeType": "YulLiteral", + "src": "4123:10:17", + "type": "", + "value": "\u0019\u0001" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4111:6:17", + "nodeType": "YulIdentifier", + "src": "4111:6:17" + }, + "nativeSrc": "4111:23:17", + "nodeType": "YulFunctionCall", + "src": "4111:23:17" + }, + "nativeSrc": "4111:23:17", + "nodeType": "YulExpressionStatement", + "src": "4111:23:17" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "4158:3:17", + "nodeType": "YulIdentifier", + "src": "4158:3:17" + }, + { + "kind": "number", + "nativeSrc": "4163:4:17", + "nodeType": "YulLiteral", + "src": "4163:4:17", + "type": "", + "value": "0x02" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4154:3:17", + "nodeType": "YulIdentifier", + "src": "4154:3:17" + }, + "nativeSrc": "4154:14:17", + "nodeType": "YulFunctionCall", + "src": "4154:14:17" + }, + { + "name": "domainSeparator", + "nativeSrc": "4170:15:17", + "nodeType": "YulIdentifier", + "src": "4170:15:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4147:6:17", + "nodeType": "YulIdentifier", + "src": "4147:6:17" + }, + "nativeSrc": "4147:39:17", + "nodeType": "YulFunctionCall", + "src": "4147:39:17" + }, + "nativeSrc": "4147:39:17", + "nodeType": "YulExpressionStatement", + "src": "4147:39:17" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "4210:3:17", + "nodeType": "YulIdentifier", + "src": "4210:3:17" + }, + { + "kind": "number", + "nativeSrc": "4215:4:17", + "nodeType": "YulLiteral", + "src": "4215:4:17", + "type": "", + "value": "0x22" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4206:3:17", + "nodeType": "YulIdentifier", + "src": "4206:3:17" + }, + "nativeSrc": "4206:14:17", + "nodeType": "YulFunctionCall", + "src": "4206:14:17" + }, + { + "name": "structHash", + "nativeSrc": "4222:10:17", + "nodeType": "YulIdentifier", + "src": "4222:10:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4199:6:17", + "nodeType": "YulIdentifier", + "src": "4199:6:17" + }, + "nativeSrc": "4199:34:17", + "nodeType": "YulFunctionCall", + "src": "4199:34:17" + }, + "nativeSrc": "4199:34:17", + "nodeType": "YulExpressionStatement", + "src": "4199:34:17" + }, + { + "nativeSrc": "4246:30:17", + "nodeType": "YulAssignment", + "src": "4246:30:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "4266:3:17", + "nodeType": "YulIdentifier", + "src": "4266:3:17" + }, + { + "kind": "number", + "nativeSrc": "4271:4:17", + "nodeType": "YulLiteral", + "src": "4271:4:17", + "type": "", + "value": "0x42" + } + ], + "functionName": { + "name": "keccak256", + "nativeSrc": "4256:9:17", + "nodeType": "YulIdentifier", + "src": "4256:9:17" + }, + "nativeSrc": "4256:20:17", + "nodeType": "YulFunctionCall", + "src": "4256:20:17" + }, + "variableNames": [ + { + "name": "digest", + "nativeSrc": "4246:6:17", + "nodeType": "YulIdentifier", + "src": "4246:6:17" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4447, + "isOffset": false, + "isSlot": false, + "src": "4246:6:17", + "valueSize": 1 + }, + { + "declaration": 4442, + "isOffset": false, + "isSlot": false, + "src": "4170:15:17", + "valueSize": 1 + }, + { + "declaration": 4444, + "isOffset": false, + "isSlot": false, + "src": "4222:10:17", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4449, + "nodeType": "InlineAssembly", + "src": "4037:249:17" + } + ] + }, + "documentation": { + "id": 4440, + "nodeType": "StructuredDocumentation", + "src": "3482:431:17", + "text": " @dev Returns the keccak256 digest of an EIP-712 typed data (ERC-191 version `0x01`).\n The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with\n `\\x19\\x01` and hashing the result. It corresponds to the hash signed by the\n https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.\n See {ECDSA-recover}." + }, + "id": 4451, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toTypedDataHash", + "nameLocation": "3927:15:17", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4445, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4442, + "mutability": "mutable", + "name": "domainSeparator", + "nameLocation": "3951:15:17", + "nodeType": "VariableDeclaration", + "scope": 4451, + "src": "3943:23:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4441, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3943:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4444, + "mutability": "mutable", + "name": "structHash", + "nameLocation": "3976:10:17", + "nodeType": "VariableDeclaration", + "scope": 4451, + "src": "3968:18:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4443, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3968:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "3942:45:17" + }, + "returnParameters": { + "id": 4448, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4447, + "mutability": "mutable", + "name": "digest", + "nameLocation": "4019:6:17", + "nodeType": "VariableDeclaration", + "scope": 4451, + "src": "4011:14:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4446, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "4011:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "4010:16:17" + }, + "scope": 4535, + "src": "3918:374:17", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4488, + "nodeType": "Block", + "src": "5222:256:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 4470, + "name": "fields", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4454, + "src": "5286:6:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + { + "arguments": [ + { + "arguments": [ + { + "id": 4474, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4456, + "src": "5326:4:17", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 4473, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5320:5:17", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 4472, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5320:5:17", + "typeDescriptions": {} + } + }, + "id": 4475, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5320:11:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 4471, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "5310:9:17", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 4476, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5310:22:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "arguments": [ + { + "arguments": [ + { + "id": 4480, + "name": "version", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4458, + "src": "5366:7:17", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 4479, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5360:5:17", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 4478, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5360:5:17", + "typeDescriptions": {} + } + }, + "id": 4481, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5360:14:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 4477, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "5350:9:17", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 4482, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5350:25:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 4483, + "name": "chainId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4460, + "src": "5393:7:17", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 4484, + "name": "verifyingContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4462, + "src": "5418:17:17", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 4485, + "name": "salt", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4464, + "src": "5453:4:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 4469, + "name": "toDomainSeparator", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4489, + 4515 + ], + "referencedDeclaration": 4515, + "src": "5251:17:17", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes1_$_t_bytes32_$_t_bytes32_$_t_uint256_$_t_address_$_t_bytes32_$returns$_t_bytes32_$", + "typeString": "function (bytes1,bytes32,bytes32,uint256,address,bytes32) pure returns (bytes32)" + } + }, + "id": 4486, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5251:220:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 4468, + "id": 4487, + "nodeType": "Return", + "src": "5232:239:17" + } + ] + }, + "documentation": { + "id": 4452, + "nodeType": "StructuredDocumentation", + "src": "4298:685:17", + "text": " @dev Returns the EIP-712 domain separator constructed from an `eip712Domain`. See {IERC5267-eip712Domain}\n This function dynamically constructs the domain separator based on which fields are present in the\n `fields` parameter. It contains flags that indicate which domain fields are present:\n * Bit 0 (0x01): name\n * Bit 1 (0x02): version\n * Bit 2 (0x04): chainId\n * Bit 3 (0x08): verifyingContract\n * Bit 4 (0x10): salt\n Arguments that correspond to fields which are not present in `fields` are ignored. For example, if `fields` is\n `0x0f` (`0b01111`), then the `salt` parameter is ignored." + }, + "id": 4489, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toDomainSeparator", + "nameLocation": "4997:17:17", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4465, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4454, + "mutability": "mutable", + "name": "fields", + "nameLocation": "5031:6:17", + "nodeType": "VariableDeclaration", + "scope": 4489, + "src": "5024:13:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 4453, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "5024:6:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4456, + "mutability": "mutable", + "name": "name", + "nameLocation": "5061:4:17", + "nodeType": "VariableDeclaration", + "scope": 4489, + "src": "5047:18:17", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 4455, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "5047:6:17", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4458, + "mutability": "mutable", + "name": "version", + "nameLocation": "5089:7:17", + "nodeType": "VariableDeclaration", + "scope": 4489, + "src": "5075:21:17", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 4457, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "5075:6:17", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4460, + "mutability": "mutable", + "name": "chainId", + "nameLocation": "5114:7:17", + "nodeType": "VariableDeclaration", + "scope": 4489, + "src": "5106:15:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4459, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5106:7:17", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4462, + "mutability": "mutable", + "name": "verifyingContract", + "nameLocation": "5139:17:17", + "nodeType": "VariableDeclaration", + "scope": 4489, + "src": "5131:25:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 4461, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5131:7:17", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4464, + "mutability": "mutable", + "name": "salt", + "nameLocation": "5174:4:17", + "nodeType": "VariableDeclaration", + "scope": 4489, + "src": "5166:12:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4463, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5166:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "5014:170:17" + }, + "returnParameters": { + "id": 4468, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4467, + "mutability": "mutable", + "name": "hash", + "nameLocation": "5216:4:17", + "nodeType": "VariableDeclaration", + "scope": 4489, + "src": "5208:12:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4466, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5208:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "5207:14:17" + }, + "scope": 4535, + "src": "4988:490:17", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4514, + "nodeType": "Block", + "src": "5838:1051:17", + "statements": [ + { + "assignments": [ + 4508 + ], + "declarations": [ + { + "constant": false, + "id": 4508, + "mutability": "mutable", + "name": "domainTypeHash", + "nameLocation": "5856:14:17", + "nodeType": "VariableDeclaration", + "scope": 4514, + "src": "5848:22:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4507, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5848:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 4512, + "initialValue": { + "arguments": [ + { + "id": 4510, + "name": "fields", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4492, + "src": "5890:6:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 4509, + "name": "toDomainTypeHash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4534, + "src": "5873:16:17", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes1_$returns$_t_bytes32_$", + "typeString": "function (bytes1) pure returns (bytes32)" + } + }, + "id": 4511, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5873:24:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "5848:49:17" + }, + { + "AST": { + "nativeSrc": "5933:950:17", + "nodeType": "YulBlock", + "src": "5933:950:17", + "statements": [ + { + "nativeSrc": "6008:26:17", + "nodeType": "YulAssignment", + "src": "6008:26:17", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "6022:3:17", + "nodeType": "YulLiteral", + "src": "6022:3:17", + "type": "", + "value": "248" + }, + { + "name": "fields", + "nativeSrc": "6027:6:17", + "nodeType": "YulIdentifier", + "src": "6027:6:17" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "6018:3:17", + "nodeType": "YulIdentifier", + "src": "6018:3:17" + }, + "nativeSrc": "6018:16:17", + "nodeType": "YulFunctionCall", + "src": "6018:16:17" + }, + "variableNames": [ + { + "name": "fields", + "nativeSrc": "6008:6:17", + "nodeType": "YulIdentifier", + "src": "6008:6:17" + } + ] + }, + { + "nativeSrc": "6089:22:17", + "nodeType": "YulVariableDeclaration", + "src": "6089:22:17", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "6106:4:17", + "nodeType": "YulLiteral", + "src": "6106:4:17", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "6100:5:17", + "nodeType": "YulIdentifier", + "src": "6100:5:17" + }, + "nativeSrc": "6100:11:17", + "nodeType": "YulFunctionCall", + "src": "6100:11:17" + }, + "variables": [ + { + "name": "fmp", + "nativeSrc": "6093:3:17", + "nodeType": "YulTypedName", + "src": "6093:3:17", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "6131:3:17", + "nodeType": "YulIdentifier", + "src": "6131:3:17" + }, + { + "name": "domainTypeHash", + "nativeSrc": "6136:14:17", + "nodeType": "YulIdentifier", + "src": "6136:14:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6124:6:17", + "nodeType": "YulIdentifier", + "src": "6124:6:17" + }, + "nativeSrc": "6124:27:17", + "nodeType": "YulFunctionCall", + "src": "6124:27:17" + }, + "nativeSrc": "6124:27:17", + "nodeType": "YulExpressionStatement", + "src": "6124:27:17" + }, + { + "nativeSrc": "6165:25:17", + "nodeType": "YulVariableDeclaration", + "src": "6165:25:17", + "value": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "6180:3:17", + "nodeType": "YulIdentifier", + "src": "6180:3:17" + }, + { + "kind": "number", + "nativeSrc": "6185:4:17", + "nodeType": "YulLiteral", + "src": "6185:4:17", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6176:3:17", + "nodeType": "YulIdentifier", + "src": "6176:3:17" + }, + "nativeSrc": "6176:14:17", + "nodeType": "YulFunctionCall", + "src": "6176:14:17" + }, + "variables": [ + { + "name": "ptr", + "nativeSrc": "6169:3:17", + "nodeType": "YulTypedName", + "src": "6169:3:17", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "6224:91:17", + "nodeType": "YulBlock", + "src": "6224:91:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6249:3:17", + "nodeType": "YulIdentifier", + "src": "6249:3:17" + }, + { + "name": "nameHash", + "nativeSrc": "6254:8:17", + "nodeType": "YulIdentifier", + "src": "6254:8:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6242:6:17", + "nodeType": "YulIdentifier", + "src": "6242:6:17" + }, + "nativeSrc": "6242:21:17", + "nodeType": "YulFunctionCall", + "src": "6242:21:17" + }, + "nativeSrc": "6242:21:17", + "nodeType": "YulExpressionStatement", + "src": "6242:21:17" + }, + { + "nativeSrc": "6280:21:17", + "nodeType": "YulAssignment", + "src": "6280:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6291:3:17", + "nodeType": "YulIdentifier", + "src": "6291:3:17" + }, + { + "kind": "number", + "nativeSrc": "6296:4:17", + "nodeType": "YulLiteral", + "src": "6296:4:17", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6287:3:17", + "nodeType": "YulIdentifier", + "src": "6287:3:17" + }, + "nativeSrc": "6287:14:17", + "nodeType": "YulFunctionCall", + "src": "6287:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "6280:3:17", + "nodeType": "YulIdentifier", + "src": "6280:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "6210:6:17", + "nodeType": "YulIdentifier", + "src": "6210:6:17" + }, + { + "kind": "number", + "nativeSrc": "6218:4:17", + "nodeType": "YulLiteral", + "src": "6218:4:17", + "type": "", + "value": "0x01" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "6206:3:17", + "nodeType": "YulIdentifier", + "src": "6206:3:17" + }, + "nativeSrc": "6206:17:17", + "nodeType": "YulFunctionCall", + "src": "6206:17:17" + }, + "nativeSrc": "6203:112:17", + "nodeType": "YulIf", + "src": "6203:112:17" + }, + { + "body": { + "nativeSrc": "6349:94:17", + "nodeType": "YulBlock", + "src": "6349:94:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6374:3:17", + "nodeType": "YulIdentifier", + "src": "6374:3:17" + }, + { + "name": "versionHash", + "nativeSrc": "6379:11:17", + "nodeType": "YulIdentifier", + "src": "6379:11:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6367:6:17", + "nodeType": "YulIdentifier", + "src": "6367:6:17" + }, + "nativeSrc": "6367:24:17", + "nodeType": "YulFunctionCall", + "src": "6367:24:17" + }, + "nativeSrc": "6367:24:17", + "nodeType": "YulExpressionStatement", + "src": "6367:24:17" + }, + { + "nativeSrc": "6408:21:17", + "nodeType": "YulAssignment", + "src": "6408:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6419:3:17", + "nodeType": "YulIdentifier", + "src": "6419:3:17" + }, + { + "kind": "number", + "nativeSrc": "6424:4:17", + "nodeType": "YulLiteral", + "src": "6424:4:17", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6415:3:17", + "nodeType": "YulIdentifier", + "src": "6415:3:17" + }, + "nativeSrc": "6415:14:17", + "nodeType": "YulFunctionCall", + "src": "6415:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "6408:3:17", + "nodeType": "YulIdentifier", + "src": "6408:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "6335:6:17", + "nodeType": "YulIdentifier", + "src": "6335:6:17" + }, + { + "kind": "number", + "nativeSrc": "6343:4:17", + "nodeType": "YulLiteral", + "src": "6343:4:17", + "type": "", + "value": "0x02" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "6331:3:17", + "nodeType": "YulIdentifier", + "src": "6331:3:17" + }, + "nativeSrc": "6331:17:17", + "nodeType": "YulFunctionCall", + "src": "6331:17:17" + }, + "nativeSrc": "6328:115:17", + "nodeType": "YulIf", + "src": "6328:115:17" + }, + { + "body": { + "nativeSrc": "6477:90:17", + "nodeType": "YulBlock", + "src": "6477:90:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6502:3:17", + "nodeType": "YulIdentifier", + "src": "6502:3:17" + }, + { + "name": "chainId", + "nativeSrc": "6507:7:17", + "nodeType": "YulIdentifier", + "src": "6507:7:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6495:6:17", + "nodeType": "YulIdentifier", + "src": "6495:6:17" + }, + "nativeSrc": "6495:20:17", + "nodeType": "YulFunctionCall", + "src": "6495:20:17" + }, + "nativeSrc": "6495:20:17", + "nodeType": "YulExpressionStatement", + "src": "6495:20:17" + }, + { + "nativeSrc": "6532:21:17", + "nodeType": "YulAssignment", + "src": "6532:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6543:3:17", + "nodeType": "YulIdentifier", + "src": "6543:3:17" + }, + { + "kind": "number", + "nativeSrc": "6548:4:17", + "nodeType": "YulLiteral", + "src": "6548:4:17", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6539:3:17", + "nodeType": "YulIdentifier", + "src": "6539:3:17" + }, + "nativeSrc": "6539:14:17", + "nodeType": "YulFunctionCall", + "src": "6539:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "6532:3:17", + "nodeType": "YulIdentifier", + "src": "6532:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "6463:6:17", + "nodeType": "YulIdentifier", + "src": "6463:6:17" + }, + { + "kind": "number", + "nativeSrc": "6471:4:17", + "nodeType": "YulLiteral", + "src": "6471:4:17", + "type": "", + "value": "0x04" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "6459:3:17", + "nodeType": "YulIdentifier", + "src": "6459:3:17" + }, + "nativeSrc": "6459:17:17", + "nodeType": "YulFunctionCall", + "src": "6459:17:17" + }, + "nativeSrc": "6456:111:17", + "nodeType": "YulIf", + "src": "6456:111:17" + }, + { + "body": { + "nativeSrc": "6601:100:17", + "nodeType": "YulBlock", + "src": "6601:100:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6626:3:17", + "nodeType": "YulIdentifier", + "src": "6626:3:17" + }, + { + "name": "verifyingContract", + "nativeSrc": "6631:17:17", + "nodeType": "YulIdentifier", + "src": "6631:17:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6619:6:17", + "nodeType": "YulIdentifier", + "src": "6619:6:17" + }, + "nativeSrc": "6619:30:17", + "nodeType": "YulFunctionCall", + "src": "6619:30:17" + }, + "nativeSrc": "6619:30:17", + "nodeType": "YulExpressionStatement", + "src": "6619:30:17" + }, + { + "nativeSrc": "6666:21:17", + "nodeType": "YulAssignment", + "src": "6666:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6677:3:17", + "nodeType": "YulIdentifier", + "src": "6677:3:17" + }, + { + "kind": "number", + "nativeSrc": "6682:4:17", + "nodeType": "YulLiteral", + "src": "6682:4:17", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6673:3:17", + "nodeType": "YulIdentifier", + "src": "6673:3:17" + }, + "nativeSrc": "6673:14:17", + "nodeType": "YulFunctionCall", + "src": "6673:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "6666:3:17", + "nodeType": "YulIdentifier", + "src": "6666:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "6587:6:17", + "nodeType": "YulIdentifier", + "src": "6587:6:17" + }, + { + "kind": "number", + "nativeSrc": "6595:4:17", + "nodeType": "YulLiteral", + "src": "6595:4:17", + "type": "", + "value": "0x08" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "6583:3:17", + "nodeType": "YulIdentifier", + "src": "6583:3:17" + }, + "nativeSrc": "6583:17:17", + "nodeType": "YulFunctionCall", + "src": "6583:17:17" + }, + "nativeSrc": "6580:121:17", + "nodeType": "YulIf", + "src": "6580:121:17" + }, + { + "body": { + "nativeSrc": "6735:87:17", + "nodeType": "YulBlock", + "src": "6735:87:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6760:3:17", + "nodeType": "YulIdentifier", + "src": "6760:3:17" + }, + { + "name": "salt", + "nativeSrc": "6765:4:17", + "nodeType": "YulIdentifier", + "src": "6765:4:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6753:6:17", + "nodeType": "YulIdentifier", + "src": "6753:6:17" + }, + "nativeSrc": "6753:17:17", + "nodeType": "YulFunctionCall", + "src": "6753:17:17" + }, + "nativeSrc": "6753:17:17", + "nodeType": "YulExpressionStatement", + "src": "6753:17:17" + }, + { + "nativeSrc": "6787:21:17", + "nodeType": "YulAssignment", + "src": "6787:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6798:3:17", + "nodeType": "YulIdentifier", + "src": "6798:3:17" + }, + { + "kind": "number", + "nativeSrc": "6803:4:17", + "nodeType": "YulLiteral", + "src": "6803:4:17", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6794:3:17", + "nodeType": "YulIdentifier", + "src": "6794:3:17" + }, + "nativeSrc": "6794:14:17", + "nodeType": "YulFunctionCall", + "src": "6794:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "6787:3:17", + "nodeType": "YulIdentifier", + "src": "6787:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "6721:6:17", + "nodeType": "YulIdentifier", + "src": "6721:6:17" + }, + { + "kind": "number", + "nativeSrc": "6729:4:17", + "nodeType": "YulLiteral", + "src": "6729:4:17", + "type": "", + "value": "0x10" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "6717:3:17", + "nodeType": "YulIdentifier", + "src": "6717:3:17" + }, + "nativeSrc": "6717:17:17", + "nodeType": "YulFunctionCall", + "src": "6717:17:17" + }, + "nativeSrc": "6714:108:17", + "nodeType": "YulIf", + "src": "6714:108:17" + }, + { + "nativeSrc": "6836:37:17", + "nodeType": "YulAssignment", + "src": "6836:37:17", + "value": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "6854:3:17", + "nodeType": "YulIdentifier", + "src": "6854:3:17" + }, + { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6863:3:17", + "nodeType": "YulIdentifier", + "src": "6863:3:17" + }, + { + "name": "fmp", + "nativeSrc": "6868:3:17", + "nodeType": "YulIdentifier", + "src": "6868:3:17" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "6859:3:17", + "nodeType": "YulIdentifier", + "src": "6859:3:17" + }, + "nativeSrc": "6859:13:17", + "nodeType": "YulFunctionCall", + "src": "6859:13:17" + } + ], + "functionName": { + "name": "keccak256", + "nativeSrc": "6844:9:17", + "nodeType": "YulIdentifier", + "src": "6844:9:17" + }, + "nativeSrc": "6844:29:17", + "nodeType": "YulFunctionCall", + "src": "6844:29:17" + }, + "variableNames": [ + { + "name": "hash", + "nativeSrc": "6836:4:17", + "nodeType": "YulIdentifier", + "src": "6836:4:17" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4498, + "isOffset": false, + "isSlot": false, + "src": "6507:7:17", + "valueSize": 1 + }, + { + "declaration": 4508, + "isOffset": false, + "isSlot": false, + "src": "6136:14:17", + "valueSize": 1 + }, + { + "declaration": 4492, + "isOffset": false, + "isSlot": false, + "src": "6008:6:17", + "valueSize": 1 + }, + { + "declaration": 4492, + "isOffset": false, + "isSlot": false, + "src": "6027:6:17", + "valueSize": 1 + }, + { + "declaration": 4492, + "isOffset": false, + "isSlot": false, + "src": "6210:6:17", + "valueSize": 1 + }, + { + "declaration": 4492, + "isOffset": false, + "isSlot": false, + "src": "6335:6:17", + "valueSize": 1 + }, + { + "declaration": 4492, + "isOffset": false, + "isSlot": false, + "src": "6463:6:17", + "valueSize": 1 + }, + { + "declaration": 4492, + "isOffset": false, + "isSlot": false, + "src": "6587:6:17", + "valueSize": 1 + }, + { + "declaration": 4492, + "isOffset": false, + "isSlot": false, + "src": "6721:6:17", + "valueSize": 1 + }, + { + "declaration": 4505, + "isOffset": false, + "isSlot": false, + "src": "6836:4:17", + "valueSize": 1 + }, + { + "declaration": 4494, + "isOffset": false, + "isSlot": false, + "src": "6254:8:17", + "valueSize": 1 + }, + { + "declaration": 4502, + "isOffset": false, + "isSlot": false, + "src": "6765:4:17", + "valueSize": 1 + }, + { + "declaration": 4500, + "isOffset": false, + "isSlot": false, + "src": "6631:17:17", + "valueSize": 1 + }, + { + "declaration": 4496, + "isOffset": false, + "isSlot": false, + "src": "6379:11:17", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4513, + "nodeType": "InlineAssembly", + "src": "5908:975:17" + } + ] + }, + "documentation": { + "id": 4490, + "nodeType": "StructuredDocumentation", + "src": "5484:119:17", + "text": "@dev Variant of {toDomainSeparator-bytes1-string-string-uint256-address-bytes32} that uses hashed name and version." + }, + "id": 4515, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toDomainSeparator", + "nameLocation": "5617:17:17", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4503, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4492, + "mutability": "mutable", + "name": "fields", + "nameLocation": "5651:6:17", + "nodeType": "VariableDeclaration", + "scope": 4515, + "src": "5644:13:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 4491, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "5644:6:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4494, + "mutability": "mutable", + "name": "nameHash", + "nameLocation": "5675:8:17", + "nodeType": "VariableDeclaration", + "scope": 4515, + "src": "5667:16:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4493, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5667:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4496, + "mutability": "mutable", + "name": "versionHash", + "nameLocation": "5701:11:17", + "nodeType": "VariableDeclaration", + "scope": 4515, + "src": "5693:19:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4495, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5693:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4498, + "mutability": "mutable", + "name": "chainId", + "nameLocation": "5730:7:17", + "nodeType": "VariableDeclaration", + "scope": 4515, + "src": "5722:15:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4497, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5722:7:17", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4500, + "mutability": "mutable", + "name": "verifyingContract", + "nameLocation": "5755:17:17", + "nodeType": "VariableDeclaration", + "scope": 4515, + "src": "5747:25:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 4499, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5747:7:17", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4502, + "mutability": "mutable", + "name": "salt", + "nameLocation": "5790:4:17", + "nodeType": "VariableDeclaration", + "scope": 4515, + "src": "5782:12:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4501, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5782:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "5634:166:17" + }, + "returnParameters": { + "id": 4506, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4505, + "mutability": "mutable", + "name": "hash", + "nameLocation": "5832:4:17", + "nodeType": "VariableDeclaration", + "scope": 4515, + "src": "5824:12:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4504, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5824:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "5823:14:17" + }, + "scope": 4535, + "src": "5608:1281:17", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4533, + "nodeType": "Block", + "src": "7117:1511:17", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "id": 4527, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "id": 4525, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4523, + "name": "fields", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4518, + "src": "7131:6:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30783230", + "id": 4524, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7140:4:17", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "0x20" + }, + "src": "7131:13:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30783230", + "id": 4526, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7148:4:17", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "0x20" + }, + "src": "7131:21:17", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4531, + "nodeType": "IfStatement", + "src": "7127:65:17", + "trueBody": { + "errorCall": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 4528, + "name": "ERC5267ExtensionsNotSupported", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4371, + "src": "7161:29:17", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$__$returns$_t_error_$", + "typeString": "function () pure returns (error)" + } + }, + "id": 4529, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7161:31:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 4530, + "nodeType": "RevertStatement", + "src": "7154:38:17" + } + }, + { + "AST": { + "nativeSrc": "7228:1394:17", + "nodeType": "YulBlock", + "src": "7228:1394:17", + "statements": [ + { + "nativeSrc": "7303:26:17", + "nodeType": "YulAssignment", + "src": "7303:26:17", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "7317:3:17", + "nodeType": "YulLiteral", + "src": "7317:3:17", + "type": "", + "value": "248" + }, + { + "name": "fields", + "nativeSrc": "7322:6:17", + "nodeType": "YulIdentifier", + "src": "7322:6:17" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "7313:3:17", + "nodeType": "YulIdentifier", + "src": "7313:3:17" + }, + "nativeSrc": "7313:16:17", + "nodeType": "YulFunctionCall", + "src": "7313:16:17" + }, + "variableNames": [ + { + "name": "fields", + "nativeSrc": "7303:6:17", + "nodeType": "YulIdentifier", + "src": "7303:6:17" + } + ] + }, + { + "nativeSrc": "7384:22:17", + "nodeType": "YulVariableDeclaration", + "src": "7384:22:17", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "7401:4:17", + "nodeType": "YulLiteral", + "src": "7401:4:17", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "7395:5:17", + "nodeType": "YulIdentifier", + "src": "7395:5:17" + }, + "nativeSrc": "7395:11:17", + "nodeType": "YulFunctionCall", + "src": "7395:11:17" + }, + "variables": [ + { + "name": "fmp", + "nativeSrc": "7388:3:17", + "nodeType": "YulTypedName", + "src": "7388:3:17", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "7426:3:17", + "nodeType": "YulIdentifier", + "src": "7426:3:17" + }, + { + "hexValue": "454950373132446f6d61696e28", + "kind": "string", + "nativeSrc": "7431:15:17", + "nodeType": "YulLiteral", + "src": "7431:15:17", + "type": "", + "value": "EIP712Domain(" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7419:6:17", + "nodeType": "YulIdentifier", + "src": "7419:6:17" + }, + "nativeSrc": "7419:28:17", + "nodeType": "YulFunctionCall", + "src": "7419:28:17" + }, + "nativeSrc": "7419:28:17", + "nodeType": "YulExpressionStatement", + "src": "7419:28:17" + }, + { + "nativeSrc": "7461:25:17", + "nodeType": "YulVariableDeclaration", + "src": "7461:25:17", + "value": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "7476:3:17", + "nodeType": "YulIdentifier", + "src": "7476:3:17" + }, + { + "kind": "number", + "nativeSrc": "7481:4:17", + "nodeType": "YulLiteral", + "src": "7481:4:17", + "type": "", + "value": "0x0d" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7472:3:17", + "nodeType": "YulIdentifier", + "src": "7472:3:17" + }, + "nativeSrc": "7472:14:17", + "nodeType": "YulFunctionCall", + "src": "7472:14:17" + }, + "variables": [ + { + "name": "ptr", + "nativeSrc": "7465:3:17", + "nodeType": "YulTypedName", + "src": "7465:3:17", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "7546:97:17", + "nodeType": "YulBlock", + "src": "7546:97:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "7571:3:17", + "nodeType": "YulIdentifier", + "src": "7571:3:17" + }, + { + "hexValue": "737472696e67206e616d652c", + "kind": "string", + "nativeSrc": "7576:14:17", + "nodeType": "YulLiteral", + "src": "7576:14:17", + "type": "", + "value": "string name," + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7564:6:17", + "nodeType": "YulIdentifier", + "src": "7564:6:17" + }, + "nativeSrc": "7564:27:17", + "nodeType": "YulFunctionCall", + "src": "7564:27:17" + }, + "nativeSrc": "7564:27:17", + "nodeType": "YulExpressionStatement", + "src": "7564:27:17" + }, + { + "nativeSrc": "7608:21:17", + "nodeType": "YulAssignment", + "src": "7608:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "7619:3:17", + "nodeType": "YulIdentifier", + "src": "7619:3:17" + }, + { + "kind": "number", + "nativeSrc": "7624:4:17", + "nodeType": "YulLiteral", + "src": "7624:4:17", + "type": "", + "value": "0x0c" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7615:3:17", + "nodeType": "YulIdentifier", + "src": "7615:3:17" + }, + "nativeSrc": "7615:14:17", + "nodeType": "YulFunctionCall", + "src": "7615:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "7608:3:17", + "nodeType": "YulIdentifier", + "src": "7608:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "7532:6:17", + "nodeType": "YulIdentifier", + "src": "7532:6:17" + }, + { + "kind": "number", + "nativeSrc": "7540:4:17", + "nodeType": "YulLiteral", + "src": "7540:4:17", + "type": "", + "value": "0x01" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "7528:3:17", + "nodeType": "YulIdentifier", + "src": "7528:3:17" + }, + "nativeSrc": "7528:17:17", + "nodeType": "YulFunctionCall", + "src": "7528:17:17" + }, + "nativeSrc": "7525:118:17", + "nodeType": "YulIf", + "src": "7525:118:17" + }, + { + "body": { + "nativeSrc": "7706:100:17", + "nodeType": "YulBlock", + "src": "7706:100:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "7731:3:17", + "nodeType": "YulIdentifier", + "src": "7731:3:17" + }, + { + "hexValue": "737472696e672076657273696f6e2c", + "kind": "string", + "nativeSrc": "7736:17:17", + "nodeType": "YulLiteral", + "src": "7736:17:17", + "type": "", + "value": "string version," + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7724:6:17", + "nodeType": "YulIdentifier", + "src": "7724:6:17" + }, + "nativeSrc": "7724:30:17", + "nodeType": "YulFunctionCall", + "src": "7724:30:17" + }, + "nativeSrc": "7724:30:17", + "nodeType": "YulExpressionStatement", + "src": "7724:30:17" + }, + { + "nativeSrc": "7771:21:17", + "nodeType": "YulAssignment", + "src": "7771:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "7782:3:17", + "nodeType": "YulIdentifier", + "src": "7782:3:17" + }, + { + "kind": "number", + "nativeSrc": "7787:4:17", + "nodeType": "YulLiteral", + "src": "7787:4:17", + "type": "", + "value": "0x0f" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7778:3:17", + "nodeType": "YulIdentifier", + "src": "7778:3:17" + }, + "nativeSrc": "7778:14:17", + "nodeType": "YulFunctionCall", + "src": "7778:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "7771:3:17", + "nodeType": "YulIdentifier", + "src": "7771:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "7692:6:17", + "nodeType": "YulIdentifier", + "src": "7692:6:17" + }, + { + "kind": "number", + "nativeSrc": "7700:4:17", + "nodeType": "YulLiteral", + "src": "7700:4:17", + "type": "", + "value": "0x02" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "7688:3:17", + "nodeType": "YulIdentifier", + "src": "7688:3:17" + }, + "nativeSrc": "7688:17:17", + "nodeType": "YulFunctionCall", + "src": "7688:17:17" + }, + "nativeSrc": "7685:121:17", + "nodeType": "YulIf", + "src": "7685:121:17" + }, + { + "body": { + "nativeSrc": "7869:101:17", + "nodeType": "YulBlock", + "src": "7869:101:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "7894:3:17", + "nodeType": "YulIdentifier", + "src": "7894:3:17" + }, + { + "hexValue": "75696e7432353620636861696e49642c", + "kind": "string", + "nativeSrc": "7899:18:17", + "nodeType": "YulLiteral", + "src": "7899:18:17", + "type": "", + "value": "uint256 chainId," + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7887:6:17", + "nodeType": "YulIdentifier", + "src": "7887:6:17" + }, + "nativeSrc": "7887:31:17", + "nodeType": "YulFunctionCall", + "src": "7887:31:17" + }, + "nativeSrc": "7887:31:17", + "nodeType": "YulExpressionStatement", + "src": "7887:31:17" + }, + { + "nativeSrc": "7935:21:17", + "nodeType": "YulAssignment", + "src": "7935:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "7946:3:17", + "nodeType": "YulIdentifier", + "src": "7946:3:17" + }, + { + "kind": "number", + "nativeSrc": "7951:4:17", + "nodeType": "YulLiteral", + "src": "7951:4:17", + "type": "", + "value": "0x10" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7942:3:17", + "nodeType": "YulIdentifier", + "src": "7942:3:17" + }, + "nativeSrc": "7942:14:17", + "nodeType": "YulFunctionCall", + "src": "7942:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "7935:3:17", + "nodeType": "YulIdentifier", + "src": "7935:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "7855:6:17", + "nodeType": "YulIdentifier", + "src": "7855:6:17" + }, + { + "kind": "number", + "nativeSrc": "7863:4:17", + "nodeType": "YulLiteral", + "src": "7863:4:17", + "type": "", + "value": "0x04" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "7851:3:17", + "nodeType": "YulIdentifier", + "src": "7851:3:17" + }, + "nativeSrc": "7851:17:17", + "nodeType": "YulFunctionCall", + "src": "7851:17:17" + }, + "nativeSrc": "7848:122:17", + "nodeType": "YulIf", + "src": "7848:122:17" + }, + { + "body": { + "nativeSrc": "8043:111:17", + "nodeType": "YulBlock", + "src": "8043:111:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "8068:3:17", + "nodeType": "YulIdentifier", + "src": "8068:3:17" + }, + { + "hexValue": "6164647265737320766572696679696e67436f6e74726163742c", + "kind": "string", + "nativeSrc": "8073:28:17", + "nodeType": "YulLiteral", + "src": "8073:28:17", + "type": "", + "value": "address verifyingContract," + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8061:6:17", + "nodeType": "YulIdentifier", + "src": "8061:6:17" + }, + "nativeSrc": "8061:41:17", + "nodeType": "YulFunctionCall", + "src": "8061:41:17" + }, + "nativeSrc": "8061:41:17", + "nodeType": "YulExpressionStatement", + "src": "8061:41:17" + }, + { + "nativeSrc": "8119:21:17", + "nodeType": "YulAssignment", + "src": "8119:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "8130:3:17", + "nodeType": "YulIdentifier", + "src": "8130:3:17" + }, + { + "kind": "number", + "nativeSrc": "8135:4:17", + "nodeType": "YulLiteral", + "src": "8135:4:17", + "type": "", + "value": "0x1a" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8126:3:17", + "nodeType": "YulIdentifier", + "src": "8126:3:17" + }, + "nativeSrc": "8126:14:17", + "nodeType": "YulFunctionCall", + "src": "8126:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "8119:3:17", + "nodeType": "YulIdentifier", + "src": "8119:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "8029:6:17", + "nodeType": "YulIdentifier", + "src": "8029:6:17" + }, + { + "kind": "number", + "nativeSrc": "8037:4:17", + "nodeType": "YulLiteral", + "src": "8037:4:17", + "type": "", + "value": "0x08" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "8025:3:17", + "nodeType": "YulIdentifier", + "src": "8025:3:17" + }, + "nativeSrc": "8025:17:17", + "nodeType": "YulFunctionCall", + "src": "8025:17:17" + }, + "nativeSrc": "8022:132:17", + "nodeType": "YulIf", + "src": "8022:132:17" + }, + { + "body": { + "nativeSrc": "8214:98:17", + "nodeType": "YulBlock", + "src": "8214:98:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "8239:3:17", + "nodeType": "YulIdentifier", + "src": "8239:3:17" + }, + { + "hexValue": "627974657333322073616c742c", + "kind": "string", + "nativeSrc": "8244:15:17", + "nodeType": "YulLiteral", + "src": "8244:15:17", + "type": "", + "value": "bytes32 salt," + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8232:6:17", + "nodeType": "YulIdentifier", + "src": "8232:6:17" + }, + "nativeSrc": "8232:28:17", + "nodeType": "YulFunctionCall", + "src": "8232:28:17" + }, + "nativeSrc": "8232:28:17", + "nodeType": "YulExpressionStatement", + "src": "8232:28:17" + }, + { + "nativeSrc": "8277:21:17", + "nodeType": "YulAssignment", + "src": "8277:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "8288:3:17", + "nodeType": "YulIdentifier", + "src": "8288:3:17" + }, + { + "kind": "number", + "nativeSrc": "8293:4:17", + "nodeType": "YulLiteral", + "src": "8293:4:17", + "type": "", + "value": "0x0d" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8284:3:17", + "nodeType": "YulIdentifier", + "src": "8284:3:17" + }, + "nativeSrc": "8284:14:17", + "nodeType": "YulFunctionCall", + "src": "8284:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "8277:3:17", + "nodeType": "YulIdentifier", + "src": "8277:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "8200:6:17", + "nodeType": "YulIdentifier", + "src": "8200:6:17" + }, + { + "kind": "number", + "nativeSrc": "8208:4:17", + "nodeType": "YulLiteral", + "src": "8208:4:17", + "type": "", + "value": "0x10" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "8196:3:17", + "nodeType": "YulIdentifier", + "src": "8196:3:17" + }, + "nativeSrc": "8196:17:17", + "nodeType": "YulFunctionCall", + "src": "8196:17:17" + }, + "nativeSrc": "8193:119:17", + "nodeType": "YulIf", + "src": "8193:119:17" + }, + { + "nativeSrc": "8391:50:17", + "nodeType": "YulAssignment", + "src": "8391:50:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "8402:3:17", + "nodeType": "YulIdentifier", + "src": "8402:3:17" + }, + { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "fields", + "nativeSrc": "8425:6:17", + "nodeType": "YulIdentifier", + "src": "8425:6:17" + }, + { + "kind": "number", + "nativeSrc": "8433:4:17", + "nodeType": "YulLiteral", + "src": "8433:4:17", + "type": "", + "value": "0x1f" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "8421:3:17", + "nodeType": "YulIdentifier", + "src": "8421:3:17" + }, + "nativeSrc": "8421:17:17", + "nodeType": "YulFunctionCall", + "src": "8421:17:17" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "8414:6:17", + "nodeType": "YulIdentifier", + "src": "8414:6:17" + }, + "nativeSrc": "8414:25:17", + "nodeType": "YulFunctionCall", + "src": "8414:25:17" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "8407:6:17", + "nodeType": "YulIdentifier", + "src": "8407:6:17" + }, + "nativeSrc": "8407:33:17", + "nodeType": "YulFunctionCall", + "src": "8407:33:17" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "8398:3:17", + "nodeType": "YulIdentifier", + "src": "8398:3:17" + }, + "nativeSrc": "8398:43:17", + "nodeType": "YulFunctionCall", + "src": "8398:43:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "8391:3:17", + "nodeType": "YulIdentifier", + "src": "8391:3:17" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "8499:3:17", + "nodeType": "YulIdentifier", + "src": "8499:3:17" + }, + { + "kind": "number", + "nativeSrc": "8504:4:17", + "nodeType": "YulLiteral", + "src": "8504:4:17", + "type": "", + "value": "0x29" + } + ], + "functionName": { + "name": "mstore8", + "nativeSrc": "8491:7:17", + "nodeType": "YulIdentifier", + "src": "8491:7:17" + }, + "nativeSrc": "8491:18:17", + "nodeType": "YulFunctionCall", + "src": "8491:18:17" + }, + "nativeSrc": "8491:18:17", + "nodeType": "YulExpressionStatement", + "src": "8491:18:17" + }, + { + "nativeSrc": "8543:18:17", + "nodeType": "YulAssignment", + "src": "8543:18:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "8554:3:17", + "nodeType": "YulIdentifier", + "src": "8554:3:17" + }, + { + "kind": "number", + "nativeSrc": "8559:1:17", + "nodeType": "YulLiteral", + "src": "8559:1:17", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8550:3:17", + "nodeType": "YulIdentifier", + "src": "8550:3:17" + }, + "nativeSrc": "8550:11:17", + "nodeType": "YulFunctionCall", + "src": "8550:11:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "8543:3:17", + "nodeType": "YulIdentifier", + "src": "8543:3:17" + } + ] + }, + { + "nativeSrc": "8575:37:17", + "nodeType": "YulAssignment", + "src": "8575:37:17", + "value": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "8593:3:17", + "nodeType": "YulIdentifier", + "src": "8593:3:17" + }, + { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "8602:3:17", + "nodeType": "YulIdentifier", + "src": "8602:3:17" + }, + { + "name": "fmp", + "nativeSrc": "8607:3:17", + "nodeType": "YulIdentifier", + "src": "8607:3:17" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "8598:3:17", + "nodeType": "YulIdentifier", + "src": "8598:3:17" + }, + "nativeSrc": "8598:13:17", + "nodeType": "YulFunctionCall", + "src": "8598:13:17" + } + ], + "functionName": { + "name": "keccak256", + "nativeSrc": "8583:9:17", + "nodeType": "YulIdentifier", + "src": "8583:9:17" + }, + "nativeSrc": "8583:29:17", + "nodeType": "YulFunctionCall", + "src": "8583:29:17" + }, + "variableNames": [ + { + "name": "hash", + "nativeSrc": "8575:4:17", + "nodeType": "YulIdentifier", + "src": "8575:4:17" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4518, + "isOffset": false, + "isSlot": false, + "src": "7303:6:17", + "valueSize": 1 + }, + { + "declaration": 4518, + "isOffset": false, + "isSlot": false, + "src": "7322:6:17", + "valueSize": 1 + }, + { + "declaration": 4518, + "isOffset": false, + "isSlot": false, + "src": "7532:6:17", + "valueSize": 1 + }, + { + "declaration": 4518, + "isOffset": false, + "isSlot": false, + "src": "7692:6:17", + "valueSize": 1 + }, + { + "declaration": 4518, + "isOffset": false, + "isSlot": false, + "src": "7855:6:17", + "valueSize": 1 + }, + { + "declaration": 4518, + "isOffset": false, + "isSlot": false, + "src": "8029:6:17", + "valueSize": 1 + }, + { + "declaration": 4518, + "isOffset": false, + "isSlot": false, + "src": "8200:6:17", + "valueSize": 1 + }, + { + "declaration": 4518, + "isOffset": false, + "isSlot": false, + "src": "8425:6:17", + "valueSize": 1 + }, + { + "declaration": 4521, + "isOffset": false, + "isSlot": false, + "src": "8575:4:17", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4532, + "nodeType": "InlineAssembly", + "src": "7203:1419:17" + } + ] + }, + "documentation": { + "id": 4516, + "nodeType": "StructuredDocumentation", + "src": "6895:139:17", + "text": "@dev Builds an EIP-712 domain type hash depending on the `fields` provided, following https://eips.ethereum.org/EIPS/eip-5267[ERC-5267]" + }, + "id": 4534, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toDomainTypeHash", + "nameLocation": "7048:16:17", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4519, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4518, + "mutability": "mutable", + "name": "fields", + "nameLocation": "7072:6:17", + "nodeType": "VariableDeclaration", + "scope": 4534, + "src": "7065:13:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 4517, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "7065:6:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + } + ], + "src": "7064:15:17" + }, + "returnParameters": { + "id": 4522, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4521, + "mutability": "mutable", + "name": "hash", + "nameLocation": "7111:4:17", + "nodeType": "VariableDeclaration", + "scope": 4534, + "src": "7103:12:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4520, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "7103:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "7102:14:17" + }, + "scope": 4535, + "src": "7039:1589:17", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + } + ], + "scope": 4536, + "src": "521:8109:17", + "usedErrors": [ + 4371 + ], + "usedEvents": [] + } + ], + "src": "123:8508:17" + }, + "id": 17 + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/introspection/IERC165.sol", + "exportedSymbols": { + "IERC165": [ + 4547 + ] + }, + "id": 4548, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 4537, + "literals": [ + "solidity", + ">=", + "0.4", + ".16" + ], + "nodeType": "PragmaDirective", + "src": "115:25:18" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "IERC165", + "contractDependencies": [], + "contractKind": "interface", + "documentation": { + "id": 4538, + "nodeType": "StructuredDocumentation", + "src": "142:280:18", + "text": " @dev Interface of the ERC-165 standard, as defined in the\n https://eips.ethereum.org/EIPS/eip-165[ERC].\n Implementers can declare support of contract interfaces, which can then be\n queried by others ({ERC165Checker}).\n For an implementation, see {ERC165}." + }, + "fullyImplemented": false, + "id": 4547, + "linearizedBaseContracts": [ + 4547 + ], + "name": "IERC165", + "nameLocation": "433:7:18", + "nodeType": "ContractDefinition", + "nodes": [ + { + "documentation": { + "id": 4539, + "nodeType": "StructuredDocumentation", + "src": "447:340:18", + "text": " @dev Returns true if this contract implements the interface defined by\n `interfaceId`. See the corresponding\n https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n to learn more about how these ids are created.\n This function call must use less than 30 000 gas." + }, + "functionSelector": "01ffc9a7", + "id": 4546, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "supportsInterface", + "nameLocation": "801:17:18", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4542, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4541, + "mutability": "mutable", + "name": "interfaceId", + "nameLocation": "826:11:18", + "nodeType": "VariableDeclaration", + "scope": 4546, + "src": "819:18:18", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "typeName": { + "id": 4540, + "name": "bytes4", + "nodeType": "ElementaryTypeName", + "src": "819:6:18", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "visibility": "internal" + } + ], + "src": "818:20:18" + }, + "returnParameters": { + "id": 4545, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4544, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4546, + "src": "862:4:18", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 4543, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "862:4:18", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "861:6:18" + }, + "scope": 4547, + "src": "792:76:18", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + } + ], + "scope": 4548, + "src": "423:447:18", + "usedErrors": [], + "usedEvents": [] + } + ], + "src": "115:756:18" + }, + "id": 18 + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/math/Math.sol", + "exportedSymbols": { + "Math": [ + 6204 + ], + "Panic": [ + 1714 + ], + "SafeCast": [ + 7969 + ] + }, + "id": 6205, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 4549, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "103:24:19" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/Panic.sol", + "file": "../Panic.sol", + "id": 4551, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 6205, + "sourceUnit": 1715, + "src": "129:35:19", + "symbolAliases": [ + { + "foreign": { + "id": 4550, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "137:5:19", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/math/SafeCast.sol", + "file": "./SafeCast.sol", + "id": 4553, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 6205, + "sourceUnit": 7970, + "src": "165:40:19", + "symbolAliases": [ + { + "foreign": { + "id": 4552, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "173:8:19", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "Math", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 4554, + "nodeType": "StructuredDocumentation", + "src": "207:73:19", + "text": " @dev Standard math utilities missing in the Solidity language." + }, + "fullyImplemented": true, + "id": 6204, + "linearizedBaseContracts": [ + 6204 + ], + "name": "Math", + "nameLocation": "289:4:19", + "nodeType": "ContractDefinition", + "nodes": [ + { + "canonicalName": "Math.Rounding", + "id": 4559, + "members": [ + { + "id": 4555, + "name": "Floor", + "nameLocation": "324:5:19", + "nodeType": "EnumValue", + "src": "324:5:19" + }, + { + "id": 4556, + "name": "Ceil", + "nameLocation": "367:4:19", + "nodeType": "EnumValue", + "src": "367:4:19" + }, + { + "id": 4557, + "name": "Trunc", + "nameLocation": "409:5:19", + "nodeType": "EnumValue", + "src": "409:5:19" + }, + { + "id": 4558, + "name": "Expand", + "nameLocation": "439:6:19", + "nodeType": "EnumValue", + "src": "439:6:19" + } + ], + "name": "Rounding", + "nameLocation": "305:8:19", + "nodeType": "EnumDefinition", + "src": "300:169:19" + }, + { + "body": { + "id": 4572, + "nodeType": "Block", + "src": "731:112:19", + "statements": [ + { + "AST": { + "nativeSrc": "766:71:19", + "nodeType": "YulBlock", + "src": "766:71:19", + "statements": [ + { + "nativeSrc": "780:16:19", + "nodeType": "YulAssignment", + "src": "780:16:19", + "value": { + "arguments": [ + { + "name": "a", + "nativeSrc": "791:1:19", + "nodeType": "YulIdentifier", + "src": "791:1:19" + }, + { + "name": "b", + "nativeSrc": "794:1:19", + "nodeType": "YulIdentifier", + "src": "794:1:19" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "787:3:19", + "nodeType": "YulIdentifier", + "src": "787:3:19" + }, + "nativeSrc": "787:9:19", + "nodeType": "YulFunctionCall", + "src": "787:9:19" + }, + "variableNames": [ + { + "name": "low", + "nativeSrc": "780:3:19", + "nodeType": "YulIdentifier", + "src": "780:3:19" + } + ] + }, + { + "nativeSrc": "809:18:19", + "nodeType": "YulAssignment", + "src": "809:18:19", + "value": { + "arguments": [ + { + "name": "low", + "nativeSrc": "820:3:19", + "nodeType": "YulIdentifier", + "src": "820:3:19" + }, + { + "name": "a", + "nativeSrc": "825:1:19", + "nodeType": "YulIdentifier", + "src": "825:1:19" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "817:2:19", + "nodeType": "YulIdentifier", + "src": "817:2:19" + }, + "nativeSrc": "817:10:19", + "nodeType": "YulFunctionCall", + "src": "817:10:19" + }, + "variableNames": [ + { + "name": "high", + "nativeSrc": "809:4:19", + "nodeType": "YulIdentifier", + "src": "809:4:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4562, + "isOffset": false, + "isSlot": false, + "src": "791:1:19", + "valueSize": 1 + }, + { + "declaration": 4562, + "isOffset": false, + "isSlot": false, + "src": "825:1:19", + "valueSize": 1 + }, + { + "declaration": 4564, + "isOffset": false, + "isSlot": false, + "src": "794:1:19", + "valueSize": 1 + }, + { + "declaration": 4567, + "isOffset": false, + "isSlot": false, + "src": "809:4:19", + "valueSize": 1 + }, + { + "declaration": 4569, + "isOffset": false, + "isSlot": false, + "src": "780:3:19", + "valueSize": 1 + }, + { + "declaration": 4569, + "isOffset": false, + "isSlot": false, + "src": "820:3:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4571, + "nodeType": "InlineAssembly", + "src": "741:96:19" + } + ] + }, + "documentation": { + "id": 4560, + "nodeType": "StructuredDocumentation", + "src": "475:163:19", + "text": " @dev Return the 512-bit addition of two uint256.\n The result is stored in two 256 variables such that sum = high * 2²⁵⁶ + low." + }, + "id": 4573, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "add512", + "nameLocation": "652:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4565, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4562, + "mutability": "mutable", + "name": "a", + "nameLocation": "667:1:19", + "nodeType": "VariableDeclaration", + "scope": 4573, + "src": "659:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4561, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "659:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4564, + "mutability": "mutable", + "name": "b", + "nameLocation": "678:1:19", + "nodeType": "VariableDeclaration", + "scope": 4573, + "src": "670:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4563, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "670:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "658:22:19" + }, + "returnParameters": { + "id": 4570, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4567, + "mutability": "mutable", + "name": "high", + "nameLocation": "712:4:19", + "nodeType": "VariableDeclaration", + "scope": 4573, + "src": "704:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4566, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "704:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4569, + "mutability": "mutable", + "name": "low", + "nameLocation": "726:3:19", + "nodeType": "VariableDeclaration", + "scope": 4573, + "src": "718:11:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4568, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "718:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "703:27:19" + }, + "scope": 6204, + "src": "643:200:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4586, + "nodeType": "Block", + "src": "1115:462:19", + "statements": [ + { + "AST": { + "nativeSrc": "1437:134:19", + "nodeType": "YulBlock", + "src": "1437:134:19", + "statements": [ + { + "nativeSrc": "1451:30:19", + "nodeType": "YulVariableDeclaration", + "src": "1451:30:19", + "value": { + "arguments": [ + { + "name": "a", + "nativeSrc": "1468:1:19", + "nodeType": "YulIdentifier", + "src": "1468:1:19" + }, + { + "name": "b", + "nativeSrc": "1471:1:19", + "nodeType": "YulIdentifier", + "src": "1471:1:19" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1478:1:19", + "nodeType": "YulLiteral", + "src": "1478:1:19", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "1474:3:19", + "nodeType": "YulIdentifier", + "src": "1474:3:19" + }, + "nativeSrc": "1474:6:19", + "nodeType": "YulFunctionCall", + "src": "1474:6:19" + } + ], + "functionName": { + "name": "mulmod", + "nativeSrc": "1461:6:19", + "nodeType": "YulIdentifier", + "src": "1461:6:19" + }, + "nativeSrc": "1461:20:19", + "nodeType": "YulFunctionCall", + "src": "1461:20:19" + }, + "variables": [ + { + "name": "mm", + "nativeSrc": "1455:2:19", + "nodeType": "YulTypedName", + "src": "1455:2:19", + "type": "" + } + ] + }, + { + "nativeSrc": "1494:16:19", + "nodeType": "YulAssignment", + "src": "1494:16:19", + "value": { + "arguments": [ + { + "name": "a", + "nativeSrc": "1505:1:19", + "nodeType": "YulIdentifier", + "src": "1505:1:19" + }, + { + "name": "b", + "nativeSrc": "1508:1:19", + "nodeType": "YulIdentifier", + "src": "1508:1:19" + } + ], + "functionName": { + "name": "mul", + "nativeSrc": "1501:3:19", + "nodeType": "YulIdentifier", + "src": "1501:3:19" + }, + "nativeSrc": "1501:9:19", + "nodeType": "YulFunctionCall", + "src": "1501:9:19" + }, + "variableNames": [ + { + "name": "low", + "nativeSrc": "1494:3:19", + "nodeType": "YulIdentifier", + "src": "1494:3:19" + } + ] + }, + { + "nativeSrc": "1523:38:19", + "nodeType": "YulAssignment", + "src": "1523:38:19", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "mm", + "nativeSrc": "1539:2:19", + "nodeType": "YulIdentifier", + "src": "1539:2:19" + }, + { + "name": "low", + "nativeSrc": "1543:3:19", + "nodeType": "YulIdentifier", + "src": "1543:3:19" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "1535:3:19", + "nodeType": "YulIdentifier", + "src": "1535:3:19" + }, + "nativeSrc": "1535:12:19", + "nodeType": "YulFunctionCall", + "src": "1535:12:19" + }, + { + "arguments": [ + { + "name": "mm", + "nativeSrc": "1552:2:19", + "nodeType": "YulIdentifier", + "src": "1552:2:19" + }, + { + "name": "low", + "nativeSrc": "1556:3:19", + "nodeType": "YulIdentifier", + "src": "1556:3:19" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "1549:2:19", + "nodeType": "YulIdentifier", + "src": "1549:2:19" + }, + "nativeSrc": "1549:11:19", + "nodeType": "YulFunctionCall", + "src": "1549:11:19" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "1531:3:19", + "nodeType": "YulIdentifier", + "src": "1531:3:19" + }, + "nativeSrc": "1531:30:19", + "nodeType": "YulFunctionCall", + "src": "1531:30:19" + }, + "variableNames": [ + { + "name": "high", + "nativeSrc": "1523:4:19", + "nodeType": "YulIdentifier", + "src": "1523:4:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4576, + "isOffset": false, + "isSlot": false, + "src": "1468:1:19", + "valueSize": 1 + }, + { + "declaration": 4576, + "isOffset": false, + "isSlot": false, + "src": "1505:1:19", + "valueSize": 1 + }, + { + "declaration": 4578, + "isOffset": false, + "isSlot": false, + "src": "1471:1:19", + "valueSize": 1 + }, + { + "declaration": 4578, + "isOffset": false, + "isSlot": false, + "src": "1508:1:19", + "valueSize": 1 + }, + { + "declaration": 4581, + "isOffset": false, + "isSlot": false, + "src": "1523:4:19", + "valueSize": 1 + }, + { + "declaration": 4583, + "isOffset": false, + "isSlot": false, + "src": "1494:3:19", + "valueSize": 1 + }, + { + "declaration": 4583, + "isOffset": false, + "isSlot": false, + "src": "1543:3:19", + "valueSize": 1 + }, + { + "declaration": 4583, + "isOffset": false, + "isSlot": false, + "src": "1556:3:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4585, + "nodeType": "InlineAssembly", + "src": "1412:159:19" + } + ] + }, + "documentation": { + "id": 4574, + "nodeType": "StructuredDocumentation", + "src": "849:173:19", + "text": " @dev Return the 512-bit multiplication of two uint256.\n The result is stored in two 256 variables such that product = high * 2²⁵⁶ + low." + }, + "id": 4587, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "mul512", + "nameLocation": "1036:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4579, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4576, + "mutability": "mutable", + "name": "a", + "nameLocation": "1051:1:19", + "nodeType": "VariableDeclaration", + "scope": 4587, + "src": "1043:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4575, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1043:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4578, + "mutability": "mutable", + "name": "b", + "nameLocation": "1062:1:19", + "nodeType": "VariableDeclaration", + "scope": 4587, + "src": "1054:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4577, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1054:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1042:22:19" + }, + "returnParameters": { + "id": 4584, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4581, + "mutability": "mutable", + "name": "high", + "nameLocation": "1096:4:19", + "nodeType": "VariableDeclaration", + "scope": 4587, + "src": "1088:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4580, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1088:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4583, + "mutability": "mutable", + "name": "low", + "nameLocation": "1110:3:19", + "nodeType": "VariableDeclaration", + "scope": 4587, + "src": "1102:11:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4582, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1102:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1087:27:19" + }, + "scope": 6204, + "src": "1027:550:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4621, + "nodeType": "Block", + "src": "1784:149:19", + "statements": [ + { + "id": 4620, + "nodeType": "UncheckedBlock", + "src": "1794:133:19", + "statements": [ + { + "assignments": [ + 4600 + ], + "declarations": [ + { + "constant": false, + "id": 4600, + "mutability": "mutable", + "name": "c", + "nameLocation": "1826:1:19", + "nodeType": "VariableDeclaration", + "scope": 4620, + "src": "1818:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4599, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1818:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 4604, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4603, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4601, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4590, + "src": "1830:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "id": 4602, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4592, + "src": "1834:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1830:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1818:17:19" + }, + { + "expression": { + "id": 4609, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4605, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4595, + "src": "1849:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4608, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4606, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4600, + "src": "1859:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "id": 4607, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4590, + "src": "1864:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1859:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "1849:16:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4610, + "nodeType": "ExpressionStatement", + "src": "1849:16:19" + }, + { + "expression": { + "id": 4618, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4611, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4597, + "src": "1879:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4617, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4612, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4600, + "src": "1888:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "arguments": [ + { + "id": 4615, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4595, + "src": "1908:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 4613, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "1892:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 4614, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "1901:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "1892:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 4616, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1892:24:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1888:28:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1879:37:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 4619, + "nodeType": "ExpressionStatement", + "src": "1879:37:19" + } + ] + } + ] + }, + "documentation": { + "id": 4588, + "nodeType": "StructuredDocumentation", + "src": "1583:105:19", + "text": " @dev Returns the addition of two unsigned integers, with a success flag (no overflow)." + }, + "id": 4622, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryAdd", + "nameLocation": "1702:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4593, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4590, + "mutability": "mutable", + "name": "a", + "nameLocation": "1717:1:19", + "nodeType": "VariableDeclaration", + "scope": 4622, + "src": "1709:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4589, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1709:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4592, + "mutability": "mutable", + "name": "b", + "nameLocation": "1728:1:19", + "nodeType": "VariableDeclaration", + "scope": 4622, + "src": "1720:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4591, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1720:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1708:22:19" + }, + "returnParameters": { + "id": 4598, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4595, + "mutability": "mutable", + "name": "success", + "nameLocation": "1759:7:19", + "nodeType": "VariableDeclaration", + "scope": 4622, + "src": "1754:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 4594, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "1754:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4597, + "mutability": "mutable", + "name": "result", + "nameLocation": "1776:6:19", + "nodeType": "VariableDeclaration", + "scope": 4622, + "src": "1768:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4596, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1768:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1753:30:19" + }, + "scope": 6204, + "src": "1693:240:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4656, + "nodeType": "Block", + "src": "2143:149:19", + "statements": [ + { + "id": 4655, + "nodeType": "UncheckedBlock", + "src": "2153:133:19", + "statements": [ + { + "assignments": [ + 4635 + ], + "declarations": [ + { + "constant": false, + "id": 4635, + "mutability": "mutable", + "name": "c", + "nameLocation": "2185:1:19", + "nodeType": "VariableDeclaration", + "scope": 4655, + "src": "2177:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4634, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2177:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 4639, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4638, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4636, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4625, + "src": "2189:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "id": 4637, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4627, + "src": "2193:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2189:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2177:17:19" + }, + { + "expression": { + "id": 4644, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4640, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4630, + "src": "2208:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4643, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4641, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4635, + "src": "2218:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<=", + "rightExpression": { + "id": 4642, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4625, + "src": "2223:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2218:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "2208:16:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4645, + "nodeType": "ExpressionStatement", + "src": "2208:16:19" + }, + { + "expression": { + "id": 4653, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4646, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4632, + "src": "2238:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4652, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4647, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4635, + "src": "2247:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "arguments": [ + { + "id": 4650, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4630, + "src": "2267:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 4648, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "2251:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 4649, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2260:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "2251:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 4651, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2251:24:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2247:28:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2238:37:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 4654, + "nodeType": "ExpressionStatement", + "src": "2238:37:19" + } + ] + } + ] + }, + "documentation": { + "id": 4623, + "nodeType": "StructuredDocumentation", + "src": "1939:108:19", + "text": " @dev Returns the subtraction of two unsigned integers, with a success flag (no overflow)." + }, + "id": 4657, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "trySub", + "nameLocation": "2061:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4628, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4625, + "mutability": "mutable", + "name": "a", + "nameLocation": "2076:1:19", + "nodeType": "VariableDeclaration", + "scope": 4657, + "src": "2068:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4624, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2068:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4627, + "mutability": "mutable", + "name": "b", + "nameLocation": "2087:1:19", + "nodeType": "VariableDeclaration", + "scope": 4657, + "src": "2079:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4626, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2079:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2067:22:19" + }, + "returnParameters": { + "id": 4633, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4630, + "mutability": "mutable", + "name": "success", + "nameLocation": "2118:7:19", + "nodeType": "VariableDeclaration", + "scope": 4657, + "src": "2113:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 4629, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "2113:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4632, + "mutability": "mutable", + "name": "result", + "nameLocation": "2135:6:19", + "nodeType": "VariableDeclaration", + "scope": 4657, + "src": "2127:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4631, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2127:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2112:30:19" + }, + "scope": 6204, + "src": "2052:240:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4686, + "nodeType": "Block", + "src": "2505:391:19", + "statements": [ + { + "id": 4685, + "nodeType": "UncheckedBlock", + "src": "2515:375:19", + "statements": [ + { + "assignments": [ + 4670 + ], + "declarations": [ + { + "constant": false, + "id": 4670, + "mutability": "mutable", + "name": "c", + "nameLocation": "2547:1:19", + "nodeType": "VariableDeclaration", + "scope": 4685, + "src": "2539:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4669, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2539:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 4674, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4673, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4671, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4660, + "src": "2551:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 4672, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4662, + "src": "2555:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2551:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2539:17:19" + }, + { + "AST": { + "nativeSrc": "2595:188:19", + "nodeType": "YulBlock", + "src": "2595:188:19", + "statements": [ + { + "nativeSrc": "2727:42:19", + "nodeType": "YulAssignment", + "src": "2727:42:19", + "value": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "c", + "nativeSrc": "2748:1:19", + "nodeType": "YulIdentifier", + "src": "2748:1:19" + }, + { + "name": "a", + "nativeSrc": "2751:1:19", + "nodeType": "YulIdentifier", + "src": "2751:1:19" + } + ], + "functionName": { + "name": "div", + "nativeSrc": "2744:3:19", + "nodeType": "YulIdentifier", + "src": "2744:3:19" + }, + "nativeSrc": "2744:9:19", + "nodeType": "YulFunctionCall", + "src": "2744:9:19" + }, + { + "name": "b", + "nativeSrc": "2755:1:19", + "nodeType": "YulIdentifier", + "src": "2755:1:19" + } + ], + "functionName": { + "name": "eq", + "nativeSrc": "2741:2:19", + "nodeType": "YulIdentifier", + "src": "2741:2:19" + }, + "nativeSrc": "2741:16:19", + "nodeType": "YulFunctionCall", + "src": "2741:16:19" + }, + { + "arguments": [ + { + "name": "a", + "nativeSrc": "2766:1:19", + "nodeType": "YulIdentifier", + "src": "2766:1:19" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "2759:6:19", + "nodeType": "YulIdentifier", + "src": "2759:6:19" + }, + "nativeSrc": "2759:9:19", + "nodeType": "YulFunctionCall", + "src": "2759:9:19" + } + ], + "functionName": { + "name": "or", + "nativeSrc": "2738:2:19", + "nodeType": "YulIdentifier", + "src": "2738:2:19" + }, + "nativeSrc": "2738:31:19", + "nodeType": "YulFunctionCall", + "src": "2738:31:19" + }, + "variableNames": [ + { + "name": "success", + "nativeSrc": "2727:7:19", + "nodeType": "YulIdentifier", + "src": "2727:7:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4660, + "isOffset": false, + "isSlot": false, + "src": "2751:1:19", + "valueSize": 1 + }, + { + "declaration": 4660, + "isOffset": false, + "isSlot": false, + "src": "2766:1:19", + "valueSize": 1 + }, + { + "declaration": 4662, + "isOffset": false, + "isSlot": false, + "src": "2755:1:19", + "valueSize": 1 + }, + { + "declaration": 4670, + "isOffset": false, + "isSlot": false, + "src": "2748:1:19", + "valueSize": 1 + }, + { + "declaration": 4665, + "isOffset": false, + "isSlot": false, + "src": "2727:7:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4675, + "nodeType": "InlineAssembly", + "src": "2570:213:19" + }, + { + "expression": { + "id": 4683, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4676, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4667, + "src": "2842:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4682, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4677, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4670, + "src": "2851:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "arguments": [ + { + "id": 4680, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4665, + "src": "2871:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 4678, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "2855:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 4679, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2864:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "2855:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 4681, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2855:24:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2851:28:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2842:37:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 4684, + "nodeType": "ExpressionStatement", + "src": "2842:37:19" + } + ] + } + ] + }, + "documentation": { + "id": 4658, + "nodeType": "StructuredDocumentation", + "src": "2298:111:19", + "text": " @dev Returns the multiplication of two unsigned integers, with a success flag (no overflow)." + }, + "id": 4687, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryMul", + "nameLocation": "2423:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4663, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4660, + "mutability": "mutable", + "name": "a", + "nameLocation": "2438:1:19", + "nodeType": "VariableDeclaration", + "scope": 4687, + "src": "2430:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4659, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2430:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4662, + "mutability": "mutable", + "name": "b", + "nameLocation": "2449:1:19", + "nodeType": "VariableDeclaration", + "scope": 4687, + "src": "2441:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4661, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2441:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2429:22:19" + }, + "returnParameters": { + "id": 4668, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4665, + "mutability": "mutable", + "name": "success", + "nameLocation": "2480:7:19", + "nodeType": "VariableDeclaration", + "scope": 4687, + "src": "2475:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 4664, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "2475:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4667, + "mutability": "mutable", + "name": "result", + "nameLocation": "2497:6:19", + "nodeType": "VariableDeclaration", + "scope": 4687, + "src": "2489:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4666, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2489:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2474:30:19" + }, + "scope": 6204, + "src": "2414:482:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4707, + "nodeType": "Block", + "src": "3111:231:19", + "statements": [ + { + "id": 4706, + "nodeType": "UncheckedBlock", + "src": "3121:215:19", + "statements": [ + { + "expression": { + "id": 4703, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4699, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4695, + "src": "3145:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4702, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4700, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4692, + "src": "3155:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 4701, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3159:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "3155:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "3145:15:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4704, + "nodeType": "ExpressionStatement", + "src": "3145:15:19" + }, + { + "AST": { + "nativeSrc": "3199:127:19", + "nodeType": "YulBlock", + "src": "3199:127:19", + "statements": [ + { + "nativeSrc": "3293:19:19", + "nodeType": "YulAssignment", + "src": "3293:19:19", + "value": { + "arguments": [ + { + "name": "a", + "nativeSrc": "3307:1:19", + "nodeType": "YulIdentifier", + "src": "3307:1:19" + }, + { + "name": "b", + "nativeSrc": "3310:1:19", + "nodeType": "YulIdentifier", + "src": "3310:1:19" + } + ], + "functionName": { + "name": "div", + "nativeSrc": "3303:3:19", + "nodeType": "YulIdentifier", + "src": "3303:3:19" + }, + "nativeSrc": "3303:9:19", + "nodeType": "YulFunctionCall", + "src": "3303:9:19" + }, + "variableNames": [ + { + "name": "result", + "nativeSrc": "3293:6:19", + "nodeType": "YulIdentifier", + "src": "3293:6:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4690, + "isOffset": false, + "isSlot": false, + "src": "3307:1:19", + "valueSize": 1 + }, + { + "declaration": 4692, + "isOffset": false, + "isSlot": false, + "src": "3310:1:19", + "valueSize": 1 + }, + { + "declaration": 4697, + "isOffset": false, + "isSlot": false, + "src": "3293:6:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4705, + "nodeType": "InlineAssembly", + "src": "3174:152:19" + } + ] + } + ] + }, + "documentation": { + "id": 4688, + "nodeType": "StructuredDocumentation", + "src": "2902:113:19", + "text": " @dev Returns the division of two unsigned integers, with a success flag (no division by zero)." + }, + "id": 4708, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryDiv", + "nameLocation": "3029:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4693, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4690, + "mutability": "mutable", + "name": "a", + "nameLocation": "3044:1:19", + "nodeType": "VariableDeclaration", + "scope": 4708, + "src": "3036:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4689, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3036:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4692, + "mutability": "mutable", + "name": "b", + "nameLocation": "3055:1:19", + "nodeType": "VariableDeclaration", + "scope": 4708, + "src": "3047:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4691, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3047:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3035:22:19" + }, + "returnParameters": { + "id": 4698, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4695, + "mutability": "mutable", + "name": "success", + "nameLocation": "3086:7:19", + "nodeType": "VariableDeclaration", + "scope": 4708, + "src": "3081:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 4694, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "3081:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4697, + "mutability": "mutable", + "name": "result", + "nameLocation": "3103:6:19", + "nodeType": "VariableDeclaration", + "scope": 4708, + "src": "3095:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4696, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3095:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3080:30:19" + }, + "scope": 6204, + "src": "3020:322:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4728, + "nodeType": "Block", + "src": "3567:231:19", + "statements": [ + { + "id": 4727, + "nodeType": "UncheckedBlock", + "src": "3577:215:19", + "statements": [ + { + "expression": { + "id": 4724, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4720, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4716, + "src": "3601:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4723, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4721, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4713, + "src": "3611:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 4722, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3615:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "3611:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "3601:15:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4725, + "nodeType": "ExpressionStatement", + "src": "3601:15:19" + }, + { + "AST": { + "nativeSrc": "3655:127:19", + "nodeType": "YulBlock", + "src": "3655:127:19", + "statements": [ + { + "nativeSrc": "3749:19:19", + "nodeType": "YulAssignment", + "src": "3749:19:19", + "value": { + "arguments": [ + { + "name": "a", + "nativeSrc": "3763:1:19", + "nodeType": "YulIdentifier", + "src": "3763:1:19" + }, + { + "name": "b", + "nativeSrc": "3766:1:19", + "nodeType": "YulIdentifier", + "src": "3766:1:19" + } + ], + "functionName": { + "name": "mod", + "nativeSrc": "3759:3:19", + "nodeType": "YulIdentifier", + "src": "3759:3:19" + }, + "nativeSrc": "3759:9:19", + "nodeType": "YulFunctionCall", + "src": "3759:9:19" + }, + "variableNames": [ + { + "name": "result", + "nativeSrc": "3749:6:19", + "nodeType": "YulIdentifier", + "src": "3749:6:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4711, + "isOffset": false, + "isSlot": false, + "src": "3763:1:19", + "valueSize": 1 + }, + { + "declaration": 4713, + "isOffset": false, + "isSlot": false, + "src": "3766:1:19", + "valueSize": 1 + }, + { + "declaration": 4718, + "isOffset": false, + "isSlot": false, + "src": "3749:6:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4726, + "nodeType": "InlineAssembly", + "src": "3630:152:19" + } + ] + } + ] + }, + "documentation": { + "id": 4709, + "nodeType": "StructuredDocumentation", + "src": "3348:123:19", + "text": " @dev Returns the remainder of dividing two unsigned integers, with a success flag (no division by zero)." + }, + "id": 4729, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryMod", + "nameLocation": "3485:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4714, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4711, + "mutability": "mutable", + "name": "a", + "nameLocation": "3500:1:19", + "nodeType": "VariableDeclaration", + "scope": 4729, + "src": "3492:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4710, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3492:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4713, + "mutability": "mutable", + "name": "b", + "nameLocation": "3511:1:19", + "nodeType": "VariableDeclaration", + "scope": 4729, + "src": "3503:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4712, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3503:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3491:22:19" + }, + "returnParameters": { + "id": 4719, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4716, + "mutability": "mutable", + "name": "success", + "nameLocation": "3542:7:19", + "nodeType": "VariableDeclaration", + "scope": 4729, + "src": "3537:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 4715, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "3537:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4718, + "mutability": "mutable", + "name": "result", + "nameLocation": "3559:6:19", + "nodeType": "VariableDeclaration", + "scope": 4729, + "src": "3551:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4717, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3551:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3536:30:19" + }, + "scope": 6204, + "src": "3476:322:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4758, + "nodeType": "Block", + "src": "3989:122:19", + "statements": [ + { + "assignments": [ + 4740, + 4742 + ], + "declarations": [ + { + "constant": false, + "id": 4740, + "mutability": "mutable", + "name": "success", + "nameLocation": "4005:7:19", + "nodeType": "VariableDeclaration", + "scope": 4758, + "src": "4000:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 4739, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "4000:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4742, + "mutability": "mutable", + "name": "result", + "nameLocation": "4022:6:19", + "nodeType": "VariableDeclaration", + "scope": 4758, + "src": "4014:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4741, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4014:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 4747, + "initialValue": { + "arguments": [ + { + "id": 4744, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4732, + "src": "4039:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 4745, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4734, + "src": "4042:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4743, + "name": "tryAdd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4622, + "src": "4032:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 4746, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4032:12:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3999:45:19" + }, + { + "expression": { + "arguments": [ + { + "id": 4749, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4740, + "src": "4069:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "id": 4750, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4742, + "src": "4078:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "arguments": [ + { + "id": 4753, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4091:7:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 4752, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4091:7:19", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + } + ], + "id": 4751, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "4086:4:19", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 4754, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4086:13:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint256", + "typeString": "type(uint256)" + } + }, + "id": 4755, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "4100:3:19", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "4086:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4748, + "name": "ternary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4836, + "src": "4061:7:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bool,uint256,uint256) pure returns (uint256)" + } + }, + "id": 4756, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4061:43:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4738, + "id": 4757, + "nodeType": "Return", + "src": "4054:50:19" + } + ] + }, + "documentation": { + "id": 4730, + "nodeType": "StructuredDocumentation", + "src": "3804:103:19", + "text": " @dev Unsigned saturating addition, bounds to `2²⁵⁶ - 1` instead of overflowing." + }, + "id": 4759, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "saturatingAdd", + "nameLocation": "3921:13:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4735, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4732, + "mutability": "mutable", + "name": "a", + "nameLocation": "3943:1:19", + "nodeType": "VariableDeclaration", + "scope": 4759, + "src": "3935:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4731, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3935:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4734, + "mutability": "mutable", + "name": "b", + "nameLocation": "3954:1:19", + "nodeType": "VariableDeclaration", + "scope": 4759, + "src": "3946:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4733, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3946:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3934:22:19" + }, + "returnParameters": { + "id": 4738, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4737, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4759, + "src": "3980:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4736, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3980:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3979:9:19" + }, + "scope": 6204, + "src": "3912:199:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4778, + "nodeType": "Block", + "src": "4294:73:19", + "statements": [ + { + "assignments": [ + null, + 4770 + ], + "declarations": [ + null, + { + "constant": false, + "id": 4770, + "mutability": "mutable", + "name": "result", + "nameLocation": "4315:6:19", + "nodeType": "VariableDeclaration", + "scope": 4778, + "src": "4307:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4769, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4307:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 4775, + "initialValue": { + "arguments": [ + { + "id": 4772, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4762, + "src": "4332:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 4773, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4764, + "src": "4335:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4771, + "name": "trySub", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4657, + "src": "4325:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 4774, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4325:12:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4304:33:19" + }, + { + "expression": { + "id": 4776, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4770, + "src": "4354:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4768, + "id": 4777, + "nodeType": "Return", + "src": "4347:13:19" + } + ] + }, + "documentation": { + "id": 4760, + "nodeType": "StructuredDocumentation", + "src": "4117:95:19", + "text": " @dev Unsigned saturating subtraction, bounds to zero instead of overflowing." + }, + "id": 4779, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "saturatingSub", + "nameLocation": "4226:13:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4765, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4762, + "mutability": "mutable", + "name": "a", + "nameLocation": "4248:1:19", + "nodeType": "VariableDeclaration", + "scope": 4779, + "src": "4240:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4761, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4240:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4764, + "mutability": "mutable", + "name": "b", + "nameLocation": "4259:1:19", + "nodeType": "VariableDeclaration", + "scope": 4779, + "src": "4251:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4763, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4251:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4239:22:19" + }, + "returnParameters": { + "id": 4768, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4767, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4779, + "src": "4285:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4766, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4285:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4284:9:19" + }, + "scope": 6204, + "src": "4217:150:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4808, + "nodeType": "Block", + "src": "4564:122:19", + "statements": [ + { + "assignments": [ + 4790, + 4792 + ], + "declarations": [ + { + "constant": false, + "id": 4790, + "mutability": "mutable", + "name": "success", + "nameLocation": "4580:7:19", + "nodeType": "VariableDeclaration", + "scope": 4808, + "src": "4575:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 4789, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "4575:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4792, + "mutability": "mutable", + "name": "result", + "nameLocation": "4597:6:19", + "nodeType": "VariableDeclaration", + "scope": 4808, + "src": "4589:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4791, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4589:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 4797, + "initialValue": { + "arguments": [ + { + "id": 4794, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4782, + "src": "4614:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 4795, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4784, + "src": "4617:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4793, + "name": "tryMul", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4687, + "src": "4607:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 4796, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4607:12:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4574:45:19" + }, + { + "expression": { + "arguments": [ + { + "id": 4799, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4790, + "src": "4644:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "id": 4800, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4792, + "src": "4653:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "arguments": [ + { + "id": 4803, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4666:7:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 4802, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4666:7:19", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + } + ], + "id": 4801, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "4661:4:19", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 4804, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4661:13:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint256", + "typeString": "type(uint256)" + } + }, + "id": 4805, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "4675:3:19", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "4661:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4798, + "name": "ternary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4836, + "src": "4636:7:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bool,uint256,uint256) pure returns (uint256)" + } + }, + "id": 4806, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4636:43:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4788, + "id": 4807, + "nodeType": "Return", + "src": "4629:50:19" + } + ] + }, + "documentation": { + "id": 4780, + "nodeType": "StructuredDocumentation", + "src": "4373:109:19", + "text": " @dev Unsigned saturating multiplication, bounds to `2²⁵⁶ - 1` instead of overflowing." + }, + "id": 4809, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "saturatingMul", + "nameLocation": "4496:13:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4785, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4782, + "mutability": "mutable", + "name": "a", + "nameLocation": "4518:1:19", + "nodeType": "VariableDeclaration", + "scope": 4809, + "src": "4510:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4781, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4510:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4784, + "mutability": "mutable", + "name": "b", + "nameLocation": "4529:1:19", + "nodeType": "VariableDeclaration", + "scope": 4809, + "src": "4521:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4783, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4521:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4509:22:19" + }, + "returnParameters": { + "id": 4788, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4787, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4809, + "src": "4555:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4786, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4555:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4554:9:19" + }, + "scope": 6204, + "src": "4487:199:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4835, + "nodeType": "Block", + "src": "5174:207:19", + "statements": [ + { + "id": 4834, + "nodeType": "UncheckedBlock", + "src": "5184:191:19", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4832, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4821, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4816, + "src": "5322:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "^", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4830, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4824, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4822, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4814, + "src": "5328:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "^", + "rightExpression": { + "id": 4823, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4816, + "src": "5332:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5328:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 4825, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "5327:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "arguments": [ + { + "id": 4828, + "name": "condition", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4812, + "src": "5353:9:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 4826, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "5337:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 4827, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5346:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "5337:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 4829, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5337:26:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5327:36:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 4831, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "5326:38:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5322:42:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4820, + "id": 4833, + "nodeType": "Return", + "src": "5315:49:19" + } + ] + } + ] + }, + "documentation": { + "id": 4810, + "nodeType": "StructuredDocumentation", + "src": "4692:390:19", + "text": " @dev Branchless ternary evaluation for `condition ? a : b`. Gas costs are constant.\n IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.\n However, the compiler may optimize Solidity ternary operations (i.e. `condition ? a : b`) to only compute\n one branch when needed, making this function more expensive." + }, + "id": 4836, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ternary", + "nameLocation": "5096:7:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4817, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4812, + "mutability": "mutable", + "name": "condition", + "nameLocation": "5109:9:19", + "nodeType": "VariableDeclaration", + "scope": 4836, + "src": "5104:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 4811, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "5104:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4814, + "mutability": "mutable", + "name": "a", + "nameLocation": "5128:1:19", + "nodeType": "VariableDeclaration", + "scope": 4836, + "src": "5120:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4813, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5120:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4816, + "mutability": "mutable", + "name": "b", + "nameLocation": "5139:1:19", + "nodeType": "VariableDeclaration", + "scope": 4836, + "src": "5131:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4815, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5131:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5103:38:19" + }, + "returnParameters": { + "id": 4820, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4819, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4836, + "src": "5165:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4818, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5165:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5164:9:19" + }, + "scope": 6204, + "src": "5087:294:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4854, + "nodeType": "Block", + "src": "5518:44:19", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4849, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4847, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4839, + "src": "5543:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "id": 4848, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4841, + "src": "5547:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5543:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "id": 4850, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4839, + "src": "5550:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 4851, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4841, + "src": "5553:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4846, + "name": "ternary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4836, + "src": "5535:7:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bool,uint256,uint256) pure returns (uint256)" + } + }, + "id": 4852, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5535:20:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4845, + "id": 4853, + "nodeType": "Return", + "src": "5528:27:19" + } + ] + }, + "documentation": { + "id": 4837, + "nodeType": "StructuredDocumentation", + "src": "5387:59:19", + "text": " @dev Returns the largest of two numbers." + }, + "id": 4855, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "max", + "nameLocation": "5460:3:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4842, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4839, + "mutability": "mutable", + "name": "a", + "nameLocation": "5472:1:19", + "nodeType": "VariableDeclaration", + "scope": 4855, + "src": "5464:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4838, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5464:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4841, + "mutability": "mutable", + "name": "b", + "nameLocation": "5483:1:19", + "nodeType": "VariableDeclaration", + "scope": 4855, + "src": "5475:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4840, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5475:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5463:22:19" + }, + "returnParameters": { + "id": 4845, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4844, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4855, + "src": "5509:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4843, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5509:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5508:9:19" + }, + "scope": 6204, + "src": "5451:111:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4873, + "nodeType": "Block", + "src": "5700:44:19", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4868, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4866, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4858, + "src": "5725:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 4867, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4860, + "src": "5729:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5725:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "id": 4869, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4858, + "src": "5732:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 4870, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4860, + "src": "5735:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4865, + "name": "ternary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4836, + "src": "5717:7:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bool,uint256,uint256) pure returns (uint256)" + } + }, + "id": 4871, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5717:20:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4864, + "id": 4872, + "nodeType": "Return", + "src": "5710:27:19" + } + ] + }, + "documentation": { + "id": 4856, + "nodeType": "StructuredDocumentation", + "src": "5568:60:19", + "text": " @dev Returns the smallest of two numbers." + }, + "id": 4874, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "min", + "nameLocation": "5642:3:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4861, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4858, + "mutability": "mutable", + "name": "a", + "nameLocation": "5654:1:19", + "nodeType": "VariableDeclaration", + "scope": 4874, + "src": "5646:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4857, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5646:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4860, + "mutability": "mutable", + "name": "b", + "nameLocation": "5665:1:19", + "nodeType": "VariableDeclaration", + "scope": 4874, + "src": "5657:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4859, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5657:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5645:22:19" + }, + "returnParameters": { + "id": 4864, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4863, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4874, + "src": "5691:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4862, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5691:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5690:9:19" + }, + "scope": 6204, + "src": "5633:111:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4897, + "nodeType": "Block", + "src": "5928:120:19", + "statements": [ + { + "id": 4896, + "nodeType": "UncheckedBlock", + "src": "5938:104:19", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4894, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4886, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4884, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4877, + "src": "6011:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "id": 4885, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4879, + "src": "6015:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6011:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 4887, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "6010:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4893, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4890, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4888, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4877, + "src": "6021:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "^", + "rightExpression": { + "id": 4889, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4879, + "src": "6025:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6021:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 4891, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "6020:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "hexValue": "32", + "id": 4892, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6030:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "6020:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6010:21:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4883, + "id": 4895, + "nodeType": "Return", + "src": "6003:28:19" + } + ] + } + ] + }, + "documentation": { + "id": 4875, + "nodeType": "StructuredDocumentation", + "src": "5750:102:19", + "text": " @dev Returns the average of two numbers. The result is rounded towards\n zero." + }, + "id": 4898, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "average", + "nameLocation": "5866:7:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4880, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4877, + "mutability": "mutable", + "name": "a", + "nameLocation": "5882:1:19", + "nodeType": "VariableDeclaration", + "scope": 4898, + "src": "5874:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4876, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5874:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4879, + "mutability": "mutable", + "name": "b", + "nameLocation": "5893:1:19", + "nodeType": "VariableDeclaration", + "scope": 4898, + "src": "5885:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4878, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5885:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5873:22:19" + }, + "returnParameters": { + "id": 4883, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4882, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4898, + "src": "5919:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4881, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5919:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5918:9:19" + }, + "scope": 6204, + "src": "5857:191:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4938, + "nodeType": "Block", + "src": "6340:633:19", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4910, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4908, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4903, + "src": "6354:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 4909, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6359:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "6354:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4919, + "nodeType": "IfStatement", + "src": "6350:150:19", + "trueBody": { + "id": 4918, + "nodeType": "Block", + "src": "6362:138:19", + "statements": [ + { + "expression": { + "arguments": [ + { + "expression": { + "id": 4914, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "6466:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 4915, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "6472:16:19", + "memberName": "DIVISION_BY_ZERO", + "nodeType": "MemberAccess", + "referencedDeclaration": 1681, + "src": "6466:22:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 4911, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "6454:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 4913, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6460:5:19", + "memberName": "panic", + "nodeType": "MemberAccess", + "referencedDeclaration": 1713, + "src": "6454:11:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$__$", + "typeString": "function (uint256) pure" + } + }, + "id": 4916, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6454:35:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 4917, + "nodeType": "ExpressionStatement", + "src": "6454:35:19" + } + ] + } + }, + { + "id": 4937, + "nodeType": "UncheckedBlock", + "src": "6883:84:19", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4935, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4924, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4922, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4901, + "src": "6930:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 4923, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6934:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "6930:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 4920, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "6914:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 4921, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6923:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "6914:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 4925, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6914:22:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4933, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4931, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4928, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4926, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4901, + "src": "6941:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "hexValue": "31", + "id": 4927, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6945:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "6941:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 4929, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "6940:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 4930, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4903, + "src": "6950:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6940:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "31", + "id": 4932, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6954:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "6940:15:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 4934, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "6939:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6914:42:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4907, + "id": 4936, + "nodeType": "Return", + "src": "6907:49:19" + } + ] + } + ] + }, + "documentation": { + "id": 4899, + "nodeType": "StructuredDocumentation", + "src": "6054:210:19", + "text": " @dev Returns the ceiling of the division of two numbers.\n This differs from standard division with `/` in that it rounds towards infinity instead\n of rounding towards zero." + }, + "id": 4939, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ceilDiv", + "nameLocation": "6278:7:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4904, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4901, + "mutability": "mutable", + "name": "a", + "nameLocation": "6294:1:19", + "nodeType": "VariableDeclaration", + "scope": 4939, + "src": "6286:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4900, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6286:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4903, + "mutability": "mutable", + "name": "b", + "nameLocation": "6305:1:19", + "nodeType": "VariableDeclaration", + "scope": 4939, + "src": "6297:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4902, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6297:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "6285:22:19" + }, + "returnParameters": { + "id": 4907, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4906, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4939, + "src": "6331:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4905, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6331:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "6330:9:19" + }, + "scope": 6204, + "src": "6269:704:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5074, + "nodeType": "Block", + "src": "7394:3585:19", + "statements": [ + { + "id": 5073, + "nodeType": "UncheckedBlock", + "src": "7404:3569:19", + "statements": [ + { + "assignments": [ + 4952, + 4954 + ], + "declarations": [ + { + "constant": false, + "id": 4952, + "mutability": "mutable", + "name": "high", + "nameLocation": "7437:4:19", + "nodeType": "VariableDeclaration", + "scope": 5073, + "src": "7429:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4951, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7429:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4954, + "mutability": "mutable", + "name": "low", + "nameLocation": "7451:3:19", + "nodeType": "VariableDeclaration", + "scope": 5073, + "src": "7443:11:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4953, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7443:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 4959, + "initialValue": { + "arguments": [ + { + "id": 4956, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4942, + "src": "7465:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 4957, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4944, + "src": "7468:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4955, + "name": "mul512", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4587, + "src": "7458:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256,uint256)" + } + }, + "id": 4958, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7458:12:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "7428:42:19" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4962, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4960, + "name": "high", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4952, + "src": "7552:4:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 4961, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7560:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "7552:9:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4968, + "nodeType": "IfStatement", + "src": "7548:365:19", + "trueBody": { + "id": 4967, + "nodeType": "Block", + "src": "7563:350:19", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4965, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4963, + "name": "low", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4954, + "src": "7881:3:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 4964, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "7887:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7881:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4950, + "id": 4966, + "nodeType": "Return", + "src": "7874:24:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4971, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4969, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "8023:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<=", + "rightExpression": { + "id": 4970, + "name": "high", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4952, + "src": "8038:4:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8023:19:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4987, + "nodeType": "IfStatement", + "src": "8019:142:19", + "trueBody": { + "id": 4986, + "nodeType": "Block", + "src": "8044:117:19", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4978, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4976, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "8082:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 4977, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8097:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "8082:16:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "expression": { + "id": 4979, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "8100:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 4980, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "8106:16:19", + "memberName": "DIVISION_BY_ZERO", + "nodeType": "MemberAccess", + "referencedDeclaration": 1681, + "src": "8100:22:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 4981, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "8124:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 4982, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "8130:14:19", + "memberName": "UNDER_OVERFLOW", + "nodeType": "MemberAccess", + "referencedDeclaration": 1677, + "src": "8124:20:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4975, + "name": "ternary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4836, + "src": "8074:7:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bool,uint256,uint256) pure returns (uint256)" + } + }, + "id": 4983, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8074:71:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 4972, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "8062:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 4974, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "8068:5:19", + "memberName": "panic", + "nodeType": "MemberAccess", + "referencedDeclaration": 1713, + "src": "8062:11:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$__$", + "typeString": "function (uint256) pure" + } + }, + "id": 4984, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8062:84:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 4985, + "nodeType": "ExpressionStatement", + "src": "8062:84:19" + } + ] + } + }, + { + "assignments": [ + 4989 + ], + "declarations": [ + { + "constant": false, + "id": 4989, + "mutability": "mutable", + "name": "remainder", + "nameLocation": "8421:9:19", + "nodeType": "VariableDeclaration", + "scope": 5073, + "src": "8413:17:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4988, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8413:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 4990, + "nodeType": "VariableDeclarationStatement", + "src": "8413:17:19" + }, + { + "AST": { + "nativeSrc": "8469:283:19", + "nodeType": "YulBlock", + "src": "8469:283:19", + "statements": [ + { + "nativeSrc": "8538:38:19", + "nodeType": "YulAssignment", + "src": "8538:38:19", + "value": { + "arguments": [ + { + "name": "x", + "nativeSrc": "8558:1:19", + "nodeType": "YulIdentifier", + "src": "8558:1:19" + }, + { + "name": "y", + "nativeSrc": "8561:1:19", + "nodeType": "YulIdentifier", + "src": "8561:1:19" + }, + { + "name": "denominator", + "nativeSrc": "8564:11:19", + "nodeType": "YulIdentifier", + "src": "8564:11:19" + } + ], + "functionName": { + "name": "mulmod", + "nativeSrc": "8551:6:19", + "nodeType": "YulIdentifier", + "src": "8551:6:19" + }, + "nativeSrc": "8551:25:19", + "nodeType": "YulFunctionCall", + "src": "8551:25:19" + }, + "variableNames": [ + { + "name": "remainder", + "nativeSrc": "8538:9:19", + "nodeType": "YulIdentifier", + "src": "8538:9:19" + } + ] + }, + { + "nativeSrc": "8658:37:19", + "nodeType": "YulAssignment", + "src": "8658:37:19", + "value": { + "arguments": [ + { + "name": "high", + "nativeSrc": "8670:4:19", + "nodeType": "YulIdentifier", + "src": "8670:4:19" + }, + { + "arguments": [ + { + "name": "remainder", + "nativeSrc": "8679:9:19", + "nodeType": "YulIdentifier", + "src": "8679:9:19" + }, + { + "name": "low", + "nativeSrc": "8690:3:19", + "nodeType": "YulIdentifier", + "src": "8690:3:19" + } + ], + "functionName": { + "name": "gt", + "nativeSrc": "8676:2:19", + "nodeType": "YulIdentifier", + "src": "8676:2:19" + }, + "nativeSrc": "8676:18:19", + "nodeType": "YulFunctionCall", + "src": "8676:18:19" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "8666:3:19", + "nodeType": "YulIdentifier", + "src": "8666:3:19" + }, + "nativeSrc": "8666:29:19", + "nodeType": "YulFunctionCall", + "src": "8666:29:19" + }, + "variableNames": [ + { + "name": "high", + "nativeSrc": "8658:4:19", + "nodeType": "YulIdentifier", + "src": "8658:4:19" + } + ] + }, + { + "nativeSrc": "8712:26:19", + "nodeType": "YulAssignment", + "src": "8712:26:19", + "value": { + "arguments": [ + { + "name": "low", + "nativeSrc": "8723:3:19", + "nodeType": "YulIdentifier", + "src": "8723:3:19" + }, + { + "name": "remainder", + "nativeSrc": "8728:9:19", + "nodeType": "YulIdentifier", + "src": "8728:9:19" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "8719:3:19", + "nodeType": "YulIdentifier", + "src": "8719:3:19" + }, + "nativeSrc": "8719:19:19", + "nodeType": "YulFunctionCall", + "src": "8719:19:19" + }, + "variableNames": [ + { + "name": "low", + "nativeSrc": "8712:3:19", + "nodeType": "YulIdentifier", + "src": "8712:3:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4946, + "isOffset": false, + "isSlot": false, + "src": "8564:11:19", + "valueSize": 1 + }, + { + "declaration": 4952, + "isOffset": false, + "isSlot": false, + "src": "8658:4:19", + "valueSize": 1 + }, + { + "declaration": 4952, + "isOffset": false, + "isSlot": false, + "src": "8670:4:19", + "valueSize": 1 + }, + { + "declaration": 4954, + "isOffset": false, + "isSlot": false, + "src": "8690:3:19", + "valueSize": 1 + }, + { + "declaration": 4954, + "isOffset": false, + "isSlot": false, + "src": "8712:3:19", + "valueSize": 1 + }, + { + "declaration": 4954, + "isOffset": false, + "isSlot": false, + "src": "8723:3:19", + "valueSize": 1 + }, + { + "declaration": 4989, + "isOffset": false, + "isSlot": false, + "src": "8538:9:19", + "valueSize": 1 + }, + { + "declaration": 4989, + "isOffset": false, + "isSlot": false, + "src": "8679:9:19", + "valueSize": 1 + }, + { + "declaration": 4989, + "isOffset": false, + "isSlot": false, + "src": "8728:9:19", + "valueSize": 1 + }, + { + "declaration": 4942, + "isOffset": false, + "isSlot": false, + "src": "8558:1:19", + "valueSize": 1 + }, + { + "declaration": 4944, + "isOffset": false, + "isSlot": false, + "src": "8561:1:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4991, + "nodeType": "InlineAssembly", + "src": "8444:308:19" + }, + { + "assignments": [ + 4993 + ], + "declarations": [ + { + "constant": false, + "id": 4993, + "mutability": "mutable", + "name": "twos", + "nameLocation": "8964:4:19", + "nodeType": "VariableDeclaration", + "scope": 5073, + "src": "8956:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4992, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8956:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5000, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4999, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4994, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "8971:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4997, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "30", + "id": 4995, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8986:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "id": 4996, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "8990:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8986:15:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 4998, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "8985:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8971:31:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8956:46:19" + }, + { + "AST": { + "nativeSrc": "9041:359:19", + "nodeType": "YulBlock", + "src": "9041:359:19", + "statements": [ + { + "nativeSrc": "9106:37:19", + "nodeType": "YulAssignment", + "src": "9106:37:19", + "value": { + "arguments": [ + { + "name": "denominator", + "nativeSrc": "9125:11:19", + "nodeType": "YulIdentifier", + "src": "9125:11:19" + }, + { + "name": "twos", + "nativeSrc": "9138:4:19", + "nodeType": "YulIdentifier", + "src": "9138:4:19" + } + ], + "functionName": { + "name": "div", + "nativeSrc": "9121:3:19", + "nodeType": "YulIdentifier", + "src": "9121:3:19" + }, + "nativeSrc": "9121:22:19", + "nodeType": "YulFunctionCall", + "src": "9121:22:19" + }, + "variableNames": [ + { + "name": "denominator", + "nativeSrc": "9106:11:19", + "nodeType": "YulIdentifier", + "src": "9106:11:19" + } + ] + }, + { + "nativeSrc": "9207:21:19", + "nodeType": "YulAssignment", + "src": "9207:21:19", + "value": { + "arguments": [ + { + "name": "low", + "nativeSrc": "9218:3:19", + "nodeType": "YulIdentifier", + "src": "9218:3:19" + }, + { + "name": "twos", + "nativeSrc": "9223:4:19", + "nodeType": "YulIdentifier", + "src": "9223:4:19" + } + ], + "functionName": { + "name": "div", + "nativeSrc": "9214:3:19", + "nodeType": "YulIdentifier", + "src": "9214:3:19" + }, + "nativeSrc": "9214:14:19", + "nodeType": "YulFunctionCall", + "src": "9214:14:19" + }, + "variableNames": [ + { + "name": "low", + "nativeSrc": "9207:3:19", + "nodeType": "YulIdentifier", + "src": "9207:3:19" + } + ] + }, + { + "nativeSrc": "9347:39:19", + "nodeType": "YulAssignment", + "src": "9347:39:19", + "value": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9367:1:19", + "nodeType": "YulLiteral", + "src": "9367:1:19", + "type": "", + "value": "0" + }, + { + "name": "twos", + "nativeSrc": "9370:4:19", + "nodeType": "YulIdentifier", + "src": "9370:4:19" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "9363:3:19", + "nodeType": "YulIdentifier", + "src": "9363:3:19" + }, + "nativeSrc": "9363:12:19", + "nodeType": "YulFunctionCall", + "src": "9363:12:19" + }, + { + "name": "twos", + "nativeSrc": "9377:4:19", + "nodeType": "YulIdentifier", + "src": "9377:4:19" + } + ], + "functionName": { + "name": "div", + "nativeSrc": "9359:3:19", + "nodeType": "YulIdentifier", + "src": "9359:3:19" + }, + "nativeSrc": "9359:23:19", + "nodeType": "YulFunctionCall", + "src": "9359:23:19" + }, + { + "kind": "number", + "nativeSrc": "9384:1:19", + "nodeType": "YulLiteral", + "src": "9384:1:19", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9355:3:19", + "nodeType": "YulIdentifier", + "src": "9355:3:19" + }, + "nativeSrc": "9355:31:19", + "nodeType": "YulFunctionCall", + "src": "9355:31:19" + }, + "variableNames": [ + { + "name": "twos", + "nativeSrc": "9347:4:19", + "nodeType": "YulIdentifier", + "src": "9347:4:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4946, + "isOffset": false, + "isSlot": false, + "src": "9106:11:19", + "valueSize": 1 + }, + { + "declaration": 4946, + "isOffset": false, + "isSlot": false, + "src": "9125:11:19", + "valueSize": 1 + }, + { + "declaration": 4954, + "isOffset": false, + "isSlot": false, + "src": "9207:3:19", + "valueSize": 1 + }, + { + "declaration": 4954, + "isOffset": false, + "isSlot": false, + "src": "9218:3:19", + "valueSize": 1 + }, + { + "declaration": 4993, + "isOffset": false, + "isSlot": false, + "src": "9138:4:19", + "valueSize": 1 + }, + { + "declaration": 4993, + "isOffset": false, + "isSlot": false, + "src": "9223:4:19", + "valueSize": 1 + }, + { + "declaration": 4993, + "isOffset": false, + "isSlot": false, + "src": "9347:4:19", + "valueSize": 1 + }, + { + "declaration": 4993, + "isOffset": false, + "isSlot": false, + "src": "9370:4:19", + "valueSize": 1 + }, + { + "declaration": 4993, + "isOffset": false, + "isSlot": false, + "src": "9377:4:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 5001, + "nodeType": "InlineAssembly", + "src": "9016:384:19" + }, + { + "expression": { + "id": 5006, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5002, + "name": "low", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4954, + "src": "9463:3:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "|=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5005, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5003, + "name": "high", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4952, + "src": "9470:4:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5004, + "name": "twos", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4993, + "src": "9477:4:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "9470:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "9463:18:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5007, + "nodeType": "ExpressionStatement", + "src": "9463:18:19" + }, + { + "assignments": [ + 5009 + ], + "declarations": [ + { + "constant": false, + "id": 5009, + "mutability": "mutable", + "name": "inverse", + "nameLocation": "9824:7:19", + "nodeType": "VariableDeclaration", + "scope": 5073, + "src": "9816:15:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5008, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "9816:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5016, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5015, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5012, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "33", + "id": 5010, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9835:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5011, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "9839:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "9835:15:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5013, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "9834:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "^", + "rightExpression": { + "hexValue": "32", + "id": 5014, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9854:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "9834:21:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "9816:39:19" + }, + { + "expression": { + "id": 5023, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5017, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10072:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "*=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5022, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 5018, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10083:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5021, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5019, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "10087:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5020, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10101:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10087:21:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10083:25:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10072:36:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5024, + "nodeType": "ExpressionStatement", + "src": "10072:36:19" + }, + { + "expression": { + "id": 5031, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5025, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10142:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "*=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5030, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 5026, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10153:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5029, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5027, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "10157:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5028, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10171:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10157:21:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10153:25:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10142:36:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5032, + "nodeType": "ExpressionStatement", + "src": "10142:36:19" + }, + { + "expression": { + "id": 5039, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5033, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10214:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "*=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5038, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 5034, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10225:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5037, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5035, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "10229:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5036, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10243:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10229:21:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10225:25:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10214:36:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5040, + "nodeType": "ExpressionStatement", + "src": "10214:36:19" + }, + { + "expression": { + "id": 5047, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5041, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10285:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "*=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5046, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 5042, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10296:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5045, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5043, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "10300:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5044, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10314:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10300:21:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10296:25:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10285:36:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5048, + "nodeType": "ExpressionStatement", + "src": "10285:36:19" + }, + { + "expression": { + "id": 5055, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5049, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10358:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "*=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5054, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 5050, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10369:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5053, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5051, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "10373:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5052, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10387:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10373:21:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10369:25:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10358:36:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5056, + "nodeType": "ExpressionStatement", + "src": "10358:36:19" + }, + { + "expression": { + "id": 5063, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5057, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10432:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "*=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5062, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 5058, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10443:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5061, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5059, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "10447:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5060, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10461:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10447:21:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10443:25:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10432:36:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5064, + "nodeType": "ExpressionStatement", + "src": "10432:36:19" + }, + { + "expression": { + "id": 5069, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5065, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4949, + "src": "10913:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5068, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5066, + "name": "low", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4954, + "src": "10922:3:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5067, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10928:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10922:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10913:22:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5070, + "nodeType": "ExpressionStatement", + "src": "10913:22:19" + }, + { + "expression": { + "id": 5071, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4949, + "src": "10956:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4950, + "id": 5072, + "nodeType": "Return", + "src": "10949:13:19" + } + ] + } + ] + }, + "documentation": { + "id": 4940, + "nodeType": "StructuredDocumentation", + "src": "6979:312:19", + "text": " @dev Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or\n denominator == 0.\n Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by\n Uniswap Labs also under MIT license." + }, + "id": 5075, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "mulDiv", + "nameLocation": "7305:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4947, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4942, + "mutability": "mutable", + "name": "x", + "nameLocation": "7320:1:19", + "nodeType": "VariableDeclaration", + "scope": 5075, + "src": "7312:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4941, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7312:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4944, + "mutability": "mutable", + "name": "y", + "nameLocation": "7331:1:19", + "nodeType": "VariableDeclaration", + "scope": 5075, + "src": "7323:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4943, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7323:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4946, + "mutability": "mutable", + "name": "denominator", + "nameLocation": "7342:11:19", + "nodeType": "VariableDeclaration", + "scope": 5075, + "src": "7334:19:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4945, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7334:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7311:43:19" + }, + "returnParameters": { + "id": 4950, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4949, + "mutability": "mutable", + "name": "result", + "nameLocation": "7386:6:19", + "nodeType": "VariableDeclaration", + "scope": 5075, + "src": "7378:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4948, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7378:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7377:16:19" + }, + "scope": 6204, + "src": "7296:3683:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5111, + "nodeType": "Block", + "src": "11218:128:19", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5109, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 5091, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5078, + "src": "11242:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5092, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5080, + "src": "11245:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5093, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5082, + "src": "11248:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5090, + "name": "mulDiv", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 5075, + 5112 + ], + "referencedDeclaration": 5075, + "src": "11235:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 5094, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11235:25:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 5107, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 5098, + "name": "rounding", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5085, + "src": "11296:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + ], + "id": 5097, + "name": "unsignedRoundsUp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6182, + "src": "11279:16:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_Rounding_$4559_$returns$_t_bool_$", + "typeString": "function (enum Math.Rounding) pure returns (bool)" + } + }, + "id": 5099, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11279:26:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5106, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 5101, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5078, + "src": "11316:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5102, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5080, + "src": "11319:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5103, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5082, + "src": "11322:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5100, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -16, + "src": "11309:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 5104, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11309:25:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 5105, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11337:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "11309:29:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "11279:59:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5095, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "11263:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5096, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "11272:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "11263:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5108, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11263:76:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "11235:104:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5089, + "id": 5110, + "nodeType": "Return", + "src": "11228:111:19" + } + ] + }, + "documentation": { + "id": 5076, + "nodeType": "StructuredDocumentation", + "src": "10985:118:19", + "text": " @dev Calculates x * y / denominator with full precision, following the selected rounding direction." + }, + "id": 5112, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "mulDiv", + "nameLocation": "11117:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5086, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5078, + "mutability": "mutable", + "name": "x", + "nameLocation": "11132:1:19", + "nodeType": "VariableDeclaration", + "scope": 5112, + "src": "11124:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5077, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11124:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5080, + "mutability": "mutable", + "name": "y", + "nameLocation": "11143:1:19", + "nodeType": "VariableDeclaration", + "scope": 5112, + "src": "11135:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5079, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11135:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5082, + "mutability": "mutable", + "name": "denominator", + "nameLocation": "11154:11:19", + "nodeType": "VariableDeclaration", + "scope": 5112, + "src": "11146:19:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5081, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11146:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5085, + "mutability": "mutable", + "name": "rounding", + "nameLocation": "11176:8:19", + "nodeType": "VariableDeclaration", + "scope": 5112, + "src": "11167:17:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + }, + "typeName": { + "id": 5084, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 5083, + "name": "Rounding", + "nameLocations": [ + "11167:8:19" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4559, + "src": "11167:8:19" + }, + "referencedDeclaration": 4559, + "src": "11167:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + }, + "visibility": "internal" + } + ], + "src": "11123:62:19" + }, + "returnParameters": { + "id": 5089, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5088, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5112, + "src": "11209:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5087, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11209:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "11208:9:19" + }, + "scope": 6204, + "src": "11108:238:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5161, + "nodeType": "Block", + "src": "11554:245:19", + "statements": [ + { + "id": 5160, + "nodeType": "UncheckedBlock", + "src": "11564:229:19", + "statements": [ + { + "assignments": [ + 5125, + 5127 + ], + "declarations": [ + { + "constant": false, + "id": 5125, + "mutability": "mutable", + "name": "high", + "nameLocation": "11597:4:19", + "nodeType": "VariableDeclaration", + "scope": 5160, + "src": "11589:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5124, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11589:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5127, + "mutability": "mutable", + "name": "low", + "nameLocation": "11611:3:19", + "nodeType": "VariableDeclaration", + "scope": 5160, + "src": "11603:11:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5126, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11603:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5132, + "initialValue": { + "arguments": [ + { + "id": 5129, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5115, + "src": "11625:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5130, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5117, + "src": "11628:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5128, + "name": "mul512", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4587, + "src": "11618:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256,uint256)" + } + }, + "id": 5131, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11618:12:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "11588:42:19" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5137, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5133, + "name": "high", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5125, + "src": "11648:4:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5136, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5134, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11656:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "id": 5135, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5119, + "src": "11661:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "src": "11656:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "11648:14:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5146, + "nodeType": "IfStatement", + "src": "11644:86:19", + "trueBody": { + "id": 5145, + "nodeType": "Block", + "src": "11664:66:19", + "statements": [ + { + "expression": { + "arguments": [ + { + "expression": { + "id": 5141, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "11694:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 5142, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "11700:14:19", + "memberName": "UNDER_OVERFLOW", + "nodeType": "MemberAccess", + "referencedDeclaration": 1677, + "src": "11694:20:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 5138, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "11682:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 5140, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "11688:5:19", + "memberName": "panic", + "nodeType": "MemberAccess", + "referencedDeclaration": 1713, + "src": "11682:11:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$__$", + "typeString": "function (uint256) pure" + } + }, + "id": 5143, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11682:33:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 5144, + "nodeType": "ExpressionStatement", + "src": "11682:33:19" + } + ] + } + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5158, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5152, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5147, + "name": "high", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5125, + "src": "11751:4:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint16", + "typeString": "uint16" + }, + "id": 5150, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "323536", + "id": 5148, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11760:3:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_256_by_1", + "typeString": "int_const 256" + }, + "value": "256" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "id": 5149, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5119, + "src": "11766:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "src": "11760:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint16", + "typeString": "uint16" + } + } + ], + "id": 5151, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11759:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint16", + "typeString": "uint16" + } + }, + "src": "11751:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5153, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11750:19:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5156, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5154, + "name": "low", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5127, + "src": "11773:3:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 5155, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5119, + "src": "11780:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "src": "11773:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5157, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11772:10:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "11750:32:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5123, + "id": 5159, + "nodeType": "Return", + "src": "11743:39:19" + } + ] + } + ] + }, + "documentation": { + "id": 5113, + "nodeType": "StructuredDocumentation", + "src": "11352:111:19", + "text": " @dev Calculates floor(x * y >> n) with full precision. Throws if result overflows a uint256." + }, + "id": 5162, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "mulShr", + "nameLocation": "11477:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5120, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5115, + "mutability": "mutable", + "name": "x", + "nameLocation": "11492:1:19", + "nodeType": "VariableDeclaration", + "scope": 5162, + "src": "11484:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5114, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11484:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5117, + "mutability": "mutable", + "name": "y", + "nameLocation": "11503:1:19", + "nodeType": "VariableDeclaration", + "scope": 5162, + "src": "11495:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5116, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11495:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5119, + "mutability": "mutable", + "name": "n", + "nameLocation": "11512:1:19", + "nodeType": "VariableDeclaration", + "scope": 5162, + "src": "11506:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 5118, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "11506:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "src": "11483:31:19" + }, + "returnParameters": { + "id": 5123, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5122, + "mutability": "mutable", + "name": "result", + "nameLocation": "11546:6:19", + "nodeType": "VariableDeclaration", + "scope": 5162, + "src": "11538:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5121, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11538:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "11537:16:19" + }, + "scope": 6204, + "src": "11468:331:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5200, + "nodeType": "Block", + "src": "12017:113:19", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5198, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 5178, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5165, + "src": "12041:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5179, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5167, + "src": "12044:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5180, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5169, + "src": "12047:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + ], + "id": 5177, + "name": "mulShr", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 5162, + 5201 + ], + "referencedDeclaration": 5162, + "src": "12034:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint8_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint8) pure returns (uint256)" + } + }, + "id": 5181, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12034:15:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 5196, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 5185, + "name": "rounding", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5172, + "src": "12085:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + ], + "id": 5184, + "name": "unsignedRoundsUp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6182, + "src": "12068:16:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_Rounding_$4559_$returns$_t_bool_$", + "typeString": "function (enum Math.Rounding) pure returns (bool)" + } + }, + "id": 5186, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12068:26:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5195, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 5188, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5165, + "src": "12105:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5189, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5167, + "src": "12108:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5192, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5190, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12111:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "id": 5191, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5169, + "src": "12116:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "src": "12111:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5187, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -16, + "src": "12098:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 5193, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12098:20:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 5194, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12121:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "12098:24:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "12068:54:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5182, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "12052:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5183, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "12061:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "12052:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5197, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12052:71:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "12034:89:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5176, + "id": 5199, + "nodeType": "Return", + "src": "12027:96:19" + } + ] + }, + "documentation": { + "id": 5163, + "nodeType": "StructuredDocumentation", + "src": "11805:109:19", + "text": " @dev Calculates x * y >> n with full precision, following the selected rounding direction." + }, + "id": 5201, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "mulShr", + "nameLocation": "11928:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5173, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5165, + "mutability": "mutable", + "name": "x", + "nameLocation": "11943:1:19", + "nodeType": "VariableDeclaration", + "scope": 5201, + "src": "11935:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5164, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11935:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5167, + "mutability": "mutable", + "name": "y", + "nameLocation": "11954:1:19", + "nodeType": "VariableDeclaration", + "scope": 5201, + "src": "11946:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5166, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11946:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5169, + "mutability": "mutable", + "name": "n", + "nameLocation": "11963:1:19", + "nodeType": "VariableDeclaration", + "scope": 5201, + "src": "11957:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 5168, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "11957:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5172, + "mutability": "mutable", + "name": "rounding", + "nameLocation": "11975:8:19", + "nodeType": "VariableDeclaration", + "scope": 5201, + "src": "11966:17:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + }, + "typeName": { + "id": 5171, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 5170, + "name": "Rounding", + "nameLocations": [ + "11966:8:19" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4559, + "src": "11966:8:19" + }, + "referencedDeclaration": 4559, + "src": "11966:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + }, + "visibility": "internal" + } + ], + "src": "11934:50:19" + }, + "returnParameters": { + "id": 5176, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5175, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5201, + "src": "12008:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5174, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12008:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "12007:9:19" + }, + "scope": 6204, + "src": "11919:211:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5297, + "nodeType": "Block", + "src": "12764:1849:19", + "statements": [ + { + "id": 5296, + "nodeType": "UncheckedBlock", + "src": "12774:1833:19", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5213, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5211, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5206, + "src": "12802:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 5212, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12807:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "12802:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5216, + "nodeType": "IfStatement", + "src": "12798:20:19", + "trueBody": { + "expression": { + "hexValue": "30", + "id": 5214, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12817:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "functionReturnParameters": 5210, + "id": 5215, + "nodeType": "Return", + "src": "12810:8:19" + } + }, + { + "assignments": [ + 5218 + ], + "declarations": [ + { + "constant": false, + "id": 5218, + "mutability": "mutable", + "name": "remainder", + "nameLocation": "13297:9:19", + "nodeType": "VariableDeclaration", + "scope": 5296, + "src": "13289:17:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5217, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13289:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5222, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5221, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5219, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5204, + "src": "13309:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { + "id": 5220, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5206, + "src": "13313:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "13309:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "13289:25:19" + }, + { + "assignments": [ + 5224 + ], + "declarations": [ + { + "constant": false, + "id": 5224, + "mutability": "mutable", + "name": "gcd", + "nameLocation": "13336:3:19", + "nodeType": "VariableDeclaration", + "scope": 5296, + "src": "13328:11:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5223, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13328:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5226, + "initialValue": { + "id": 5225, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5206, + "src": "13342:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "13328:15:19" + }, + { + "assignments": [ + 5228 + ], + "declarations": [ + { + "constant": false, + "id": 5228, + "mutability": "mutable", + "name": "x", + "nameLocation": "13486:1:19", + "nodeType": "VariableDeclaration", + "scope": 5296, + "src": "13479:8:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 5227, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "13479:6:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "id": 5230, + "initialValue": { + "hexValue": "30", + "id": 5229, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13490:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "13479:12:19" + }, + { + "assignments": [ + 5232 + ], + "declarations": [ + { + "constant": false, + "id": 5232, + "mutability": "mutable", + "name": "y", + "nameLocation": "13512:1:19", + "nodeType": "VariableDeclaration", + "scope": 5296, + "src": "13505:8:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 5231, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "13505:6:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "id": 5234, + "initialValue": { + "hexValue": "31", + "id": 5233, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13516:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "VariableDeclarationStatement", + "src": "13505:12:19" + }, + { + "body": { + "id": 5271, + "nodeType": "Block", + "src": "13555:882:19", + "statements": [ + { + "assignments": [ + 5239 + ], + "declarations": [ + { + "constant": false, + "id": 5239, + "mutability": "mutable", + "name": "quotient", + "nameLocation": "13581:8:19", + "nodeType": "VariableDeclaration", + "scope": 5271, + "src": "13573:16:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5238, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13573:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5243, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5242, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5240, + "name": "gcd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5224, + "src": "13592:3:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 5241, + "name": "remainder", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5218, + "src": "13598:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "13592:15:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "13573:34:19" + }, + { + "expression": { + "id": 5254, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "components": [ + { + "id": 5244, + "name": "gcd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5224, + "src": "13627:3:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5245, + "name": "remainder", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5218, + "src": "13632:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5246, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "13626:16:19", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "components": [ + { + "id": 5247, + "name": "remainder", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5218, + "src": "13732:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5252, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5248, + "name": "gcd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5224, + "src": "13977:3:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5251, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5249, + "name": "remainder", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5218, + "src": "13983:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5250, + "name": "quotient", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5239, + "src": "13995:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "13983:20:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "13977:26:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5253, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13645:376:19", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "13626:395:19", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 5255, + "nodeType": "ExpressionStatement", + "src": "13626:395:19" + }, + { + "expression": { + "id": 5269, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "components": [ + { + "id": 5256, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5228, + "src": "14041:1:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + { + "id": 5257, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5232, + "src": "14044:1:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 5258, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "14040:6:19", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_int256_$_t_int256_$", + "typeString": "tuple(int256,int256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "components": [ + { + "id": 5259, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5232, + "src": "14126:1:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 5267, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5260, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5228, + "src": "14380:1:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 5266, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5261, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5232, + "src": "14384:1:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "arguments": [ + { + "id": 5264, + "name": "quotient", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5239, + "src": "14395:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5263, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "14388:6:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + }, + "typeName": { + "id": 5262, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "14388:6:19", + "typeDescriptions": {} + } + }, + "id": 5265, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14388:16:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "14384:20:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "14380:24:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 5268, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "14049:373:19", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_int256_$_t_int256_$", + "typeString": "tuple(int256,int256)" + } + }, + "src": "14040:382:19", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 5270, + "nodeType": "ExpressionStatement", + "src": "14040:382:19" + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5237, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5235, + "name": "remainder", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5218, + "src": "13539:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "hexValue": "30", + "id": 5236, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13552:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "13539:14:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5272, + "nodeType": "WhileStatement", + "src": "13532:905:19" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5275, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5273, + "name": "gcd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5224, + "src": "14455:3:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "hexValue": "31", + "id": 5274, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14462:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "14455:8:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5278, + "nodeType": "IfStatement", + "src": "14451:22:19", + "trueBody": { + "expression": { + "hexValue": "30", + "id": 5276, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14472:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "functionReturnParameters": 5210, + "id": 5277, + "nodeType": "Return", + "src": "14465:8:19" + } + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 5282, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5280, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5228, + "src": "14524:1:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "hexValue": "30", + "id": 5281, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14528:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "14524:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5289, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5283, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5206, + "src": "14531:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "arguments": [ + { + "id": 5287, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "-", + "prefix": true, + "src": "14543:2:19", + "subExpression": { + "id": 5286, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5228, + "src": "14544:1:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 5285, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "14535:7:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 5284, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "14535:7:19", + "typeDescriptions": {} + } + }, + "id": 5288, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14535:11:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "14531:15:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [ + { + "id": 5292, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5228, + "src": "14556:1:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 5291, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "14548:7:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 5290, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "14548:7:19", + "typeDescriptions": {} + } + }, + "id": 5293, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14548:10:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5279, + "name": "ternary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4836, + "src": "14516:7:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bool,uint256,uint256) pure returns (uint256)" + } + }, + "id": 5294, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14516:43:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5210, + "id": 5295, + "nodeType": "Return", + "src": "14509:50:19" + } + ] + } + ] + }, + "documentation": { + "id": 5202, + "nodeType": "StructuredDocumentation", + "src": "12136:553:19", + "text": " @dev Calculate the modular multiplicative inverse of a number in Z/nZ.\n If n is a prime, then Z/nZ is a field. In that case all elements are inversible, except 0.\n If n is not a prime, then Z/nZ is not a field, and some elements might not be inversible.\n If the input value is not inversible, 0 is returned.\n NOTE: If you know for sure that n is (big) a prime, it may be cheaper to use Fermat's little theorem and get the\n inverse using `Math.modExp(a, n - 2, n)`. See {invModPrime}." + }, + "id": 5298, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "invMod", + "nameLocation": "12703:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5207, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5204, + "mutability": "mutable", + "name": "a", + "nameLocation": "12718:1:19", + "nodeType": "VariableDeclaration", + "scope": 5298, + "src": "12710:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5203, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12710:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5206, + "mutability": "mutable", + "name": "n", + "nameLocation": "12729:1:19", + "nodeType": "VariableDeclaration", + "scope": 5298, + "src": "12721:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5205, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12721:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "12709:22:19" + }, + "returnParameters": { + "id": 5210, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5209, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5298, + "src": "12755:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5208, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12755:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "12754:9:19" + }, + "scope": 6204, + "src": "12694:1919:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5318, + "nodeType": "Block", + "src": "15213:82:19", + "statements": [ + { + "id": 5317, + "nodeType": "UncheckedBlock", + "src": "15223:66:19", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 5310, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5301, + "src": "15266:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5313, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5311, + "name": "p", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5303, + "src": "15269:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "hexValue": "32", + "id": 5312, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "15273:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "15269:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5314, + "name": "p", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5303, + "src": "15276:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 5308, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "15254:4:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 5309, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "15259:6:19", + "memberName": "modExp", + "nodeType": "MemberAccess", + "referencedDeclaration": 5355, + "src": "15254:11:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) view returns (uint256)" + } + }, + "id": 5315, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15254:24:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5307, + "id": 5316, + "nodeType": "Return", + "src": "15247:31:19" + } + ] + } + ] + }, + "documentation": { + "id": 5299, + "nodeType": "StructuredDocumentation", + "src": "14619:514:19", + "text": " @dev Variant of {invMod}. More efficient, but only works if `p` is known to be a prime greater than `2`.\n From https://en.wikipedia.org/wiki/Fermat%27s_little_theorem[Fermat's little theorem], we know that if p is\n prime, then `a**(p-1) ≡ 1 mod p`. As a consequence, we have `a * a**(p-2) ≡ 1 mod p`, which means that\n `a**(p-2)` is the modular multiplicative inverse of a in Fp.\n NOTE: this function does NOT check that `p` is a prime greater than `2`." + }, + "id": 5319, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "invModPrime", + "nameLocation": "15147:11:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5304, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5301, + "mutability": "mutable", + "name": "a", + "nameLocation": "15167:1:19", + "nodeType": "VariableDeclaration", + "scope": 5319, + "src": "15159:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5300, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "15159:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5303, + "mutability": "mutable", + "name": "p", + "nameLocation": "15178:1:19", + "nodeType": "VariableDeclaration", + "scope": 5319, + "src": "15170:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5302, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "15170:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "15158:22:19" + }, + "returnParameters": { + "id": 5307, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5306, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5319, + "src": "15204:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5305, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "15204:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "15203:9:19" + }, + "scope": 6204, + "src": "15138:157:19", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5354, + "nodeType": "Block", + "src": "16065:174:19", + "statements": [ + { + "assignments": [ + 5332, + 5334 + ], + "declarations": [ + { + "constant": false, + "id": 5332, + "mutability": "mutable", + "name": "success", + "nameLocation": "16081:7:19", + "nodeType": "VariableDeclaration", + "scope": 5354, + "src": "16076:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 5331, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "16076:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5334, + "mutability": "mutable", + "name": "result", + "nameLocation": "16098:6:19", + "nodeType": "VariableDeclaration", + "scope": 5354, + "src": "16090:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5333, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "16090:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5340, + "initialValue": { + "arguments": [ + { + "id": 5336, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5322, + "src": "16118:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5337, + "name": "e", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5324, + "src": "16121:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5338, + "name": "m", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5326, + "src": "16124:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5335, + "name": "tryModExp", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 5379, + 5461 + ], + "referencedDeclaration": 5379, + "src": "16108:9:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) view returns (bool,uint256)" + } + }, + "id": 5339, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16108:18:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "16075:51:19" + }, + { + "condition": { + "id": 5342, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "16140:8:19", + "subExpression": { + "id": 5341, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5332, + "src": "16141:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5351, + "nodeType": "IfStatement", + "src": "16136:74:19", + "trueBody": { + "id": 5350, + "nodeType": "Block", + "src": "16150:60:19", + "statements": [ + { + "expression": { + "arguments": [ + { + "expression": { + "id": 5346, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "16176:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 5347, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "16182:16:19", + "memberName": "DIVISION_BY_ZERO", + "nodeType": "MemberAccess", + "referencedDeclaration": 1681, + "src": "16176:22:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 5343, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "16164:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 5345, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "16170:5:19", + "memberName": "panic", + "nodeType": "MemberAccess", + "referencedDeclaration": 1713, + "src": "16164:11:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$__$", + "typeString": "function (uint256) pure" + } + }, + "id": 5348, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16164:35:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 5349, + "nodeType": "ExpressionStatement", + "src": "16164:35:19" + } + ] + } + }, + { + "expression": { + "id": 5352, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5334, + "src": "16226:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5330, + "id": 5353, + "nodeType": "Return", + "src": "16219:13:19" + } + ] + }, + "documentation": { + "id": 5320, + "nodeType": "StructuredDocumentation", + "src": "15301:678:19", + "text": " @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m)\n Requirements:\n - modulus can't be zero\n - underlying staticcall to precompile must succeed\n IMPORTANT: The result is only valid if the underlying call succeeds. When using this function, make\n sure the chain you're using it on supports the precompiled contract for modular exponentiation\n at address 0x05 as specified in https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise,\n the underlying function will succeed given the lack of a revert, but the result may be incorrectly\n interpreted as 0." + }, + "id": 5355, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "modExp", + "nameLocation": "15993:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5327, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5322, + "mutability": "mutable", + "name": "b", + "nameLocation": "16008:1:19", + "nodeType": "VariableDeclaration", + "scope": 5355, + "src": "16000:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5321, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "16000:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5324, + "mutability": "mutable", + "name": "e", + "nameLocation": "16019:1:19", + "nodeType": "VariableDeclaration", + "scope": 5355, + "src": "16011:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5323, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "16011:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5326, + "mutability": "mutable", + "name": "m", + "nameLocation": "16030:1:19", + "nodeType": "VariableDeclaration", + "scope": 5355, + "src": "16022:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5325, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "16022:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "15999:33:19" + }, + "returnParameters": { + "id": 5330, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5329, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5355, + "src": "16056:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5328, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "16056:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "16055:9:19" + }, + "scope": 6204, + "src": "15984:255:19", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5378, + "nodeType": "Block", + "src": "17093:1493:19", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5371, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5369, + "name": "m", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5362, + "src": "17107:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 5370, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17112:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "17107:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5376, + "nodeType": "IfStatement", + "src": "17103:29:19", + "trueBody": { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 5372, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17123:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "hexValue": "30", + "id": 5373, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17130:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "id": 5374, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "17122:10:19", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$", + "typeString": "tuple(bool,int_const 0)" + } + }, + "functionReturnParameters": 5368, + "id": 5375, + "nodeType": "Return", + "src": "17115:17:19" + } + }, + { + "AST": { + "nativeSrc": "17167:1413:19", + "nodeType": "YulBlock", + "src": "17167:1413:19", + "statements": [ + { + "nativeSrc": "17181:22:19", + "nodeType": "YulVariableDeclaration", + "src": "17181:22:19", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "17198:4:19", + "nodeType": "YulLiteral", + "src": "17198:4:19", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "17192:5:19", + "nodeType": "YulIdentifier", + "src": "17192:5:19" + }, + "nativeSrc": "17192:11:19", + "nodeType": "YulFunctionCall", + "src": "17192:11:19" + }, + "variables": [ + { + "name": "ptr", + "nativeSrc": "17185:3:19", + "nodeType": "YulTypedName", + "src": "17185:3:19", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "18111:3:19", + "nodeType": "YulIdentifier", + "src": "18111:3:19" + }, + { + "kind": "number", + "nativeSrc": "18116:4:19", + "nodeType": "YulLiteral", + "src": "18116:4:19", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "18104:6:19", + "nodeType": "YulIdentifier", + "src": "18104:6:19" + }, + "nativeSrc": "18104:17:19", + "nodeType": "YulFunctionCall", + "src": "18104:17:19" + }, + "nativeSrc": "18104:17:19", + "nodeType": "YulExpressionStatement", + "src": "18104:17:19" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "18145:3:19", + "nodeType": "YulIdentifier", + "src": "18145:3:19" + }, + { + "kind": "number", + "nativeSrc": "18150:4:19", + "nodeType": "YulLiteral", + "src": "18150:4:19", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "18141:3:19", + "nodeType": "YulIdentifier", + "src": "18141:3:19" + }, + "nativeSrc": "18141:14:19", + "nodeType": "YulFunctionCall", + "src": "18141:14:19" + }, + { + "kind": "number", + "nativeSrc": "18157:4:19", + "nodeType": "YulLiteral", + "src": "18157:4:19", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "18134:6:19", + "nodeType": "YulIdentifier", + "src": "18134:6:19" + }, + "nativeSrc": "18134:28:19", + "nodeType": "YulFunctionCall", + "src": "18134:28:19" + }, + "nativeSrc": "18134:28:19", + "nodeType": "YulExpressionStatement", + "src": "18134:28:19" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "18186:3:19", + "nodeType": "YulIdentifier", + "src": "18186:3:19" + }, + { + "kind": "number", + "nativeSrc": "18191:4:19", + "nodeType": "YulLiteral", + "src": "18191:4:19", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "18182:3:19", + "nodeType": "YulIdentifier", + "src": "18182:3:19" + }, + "nativeSrc": "18182:14:19", + "nodeType": "YulFunctionCall", + "src": "18182:14:19" + }, + { + "kind": "number", + "nativeSrc": "18198:4:19", + "nodeType": "YulLiteral", + "src": "18198:4:19", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "18175:6:19", + "nodeType": "YulIdentifier", + "src": "18175:6:19" + }, + "nativeSrc": "18175:28:19", + "nodeType": "YulFunctionCall", + "src": "18175:28:19" + }, + "nativeSrc": "18175:28:19", + "nodeType": "YulExpressionStatement", + "src": "18175:28:19" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "18227:3:19", + "nodeType": "YulIdentifier", + "src": "18227:3:19" + }, + { + "kind": "number", + "nativeSrc": "18232:4:19", + "nodeType": "YulLiteral", + "src": "18232:4:19", + "type": "", + "value": "0x60" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "18223:3:19", + "nodeType": "YulIdentifier", + "src": "18223:3:19" + }, + "nativeSrc": "18223:14:19", + "nodeType": "YulFunctionCall", + "src": "18223:14:19" + }, + { + "name": "b", + "nativeSrc": "18239:1:19", + "nodeType": "YulIdentifier", + "src": "18239:1:19" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "18216:6:19", + "nodeType": "YulIdentifier", + "src": "18216:6:19" + }, + "nativeSrc": "18216:25:19", + "nodeType": "YulFunctionCall", + "src": "18216:25:19" + }, + "nativeSrc": "18216:25:19", + "nodeType": "YulExpressionStatement", + "src": "18216:25:19" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "18265:3:19", + "nodeType": "YulIdentifier", + "src": "18265:3:19" + }, + { + "kind": "number", + "nativeSrc": "18270:4:19", + "nodeType": "YulLiteral", + "src": "18270:4:19", + "type": "", + "value": "0x80" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "18261:3:19", + "nodeType": "YulIdentifier", + "src": "18261:3:19" + }, + "nativeSrc": "18261:14:19", + "nodeType": "YulFunctionCall", + "src": "18261:14:19" + }, + { + "name": "e", + "nativeSrc": "18277:1:19", + "nodeType": "YulIdentifier", + "src": "18277:1:19" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "18254:6:19", + "nodeType": "YulIdentifier", + "src": "18254:6:19" + }, + "nativeSrc": "18254:25:19", + "nodeType": "YulFunctionCall", + "src": "18254:25:19" + }, + "nativeSrc": "18254:25:19", + "nodeType": "YulExpressionStatement", + "src": "18254:25:19" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "18303:3:19", + "nodeType": "YulIdentifier", + "src": "18303:3:19" + }, + { + "kind": "number", + "nativeSrc": "18308:4:19", + "nodeType": "YulLiteral", + "src": "18308:4:19", + "type": "", + "value": "0xa0" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "18299:3:19", + "nodeType": "YulIdentifier", + "src": "18299:3:19" + }, + "nativeSrc": "18299:14:19", + "nodeType": "YulFunctionCall", + "src": "18299:14:19" + }, + { + "name": "m", + "nativeSrc": "18315:1:19", + "nodeType": "YulIdentifier", + "src": "18315:1:19" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "18292:6:19", + "nodeType": "YulIdentifier", + "src": "18292:6:19" + }, + "nativeSrc": "18292:25:19", + "nodeType": "YulFunctionCall", + "src": "18292:25:19" + }, + "nativeSrc": "18292:25:19", + "nodeType": "YulExpressionStatement", + "src": "18292:25:19" + }, + { + "nativeSrc": "18479:57:19", + "nodeType": "YulAssignment", + "src": "18479:57:19", + "value": { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "gas", + "nativeSrc": "18501:3:19", + "nodeType": "YulIdentifier", + "src": "18501:3:19" + }, + "nativeSrc": "18501:5:19", + "nodeType": "YulFunctionCall", + "src": "18501:5:19" + }, + { + "kind": "number", + "nativeSrc": "18508:4:19", + "nodeType": "YulLiteral", + "src": "18508:4:19", + "type": "", + "value": "0x05" + }, + { + "name": "ptr", + "nativeSrc": "18514:3:19", + "nodeType": "YulIdentifier", + "src": "18514:3:19" + }, + { + "kind": "number", + "nativeSrc": "18519:4:19", + "nodeType": "YulLiteral", + "src": "18519:4:19", + "type": "", + "value": "0xc0" + }, + { + "kind": "number", + "nativeSrc": "18525:4:19", + "nodeType": "YulLiteral", + "src": "18525:4:19", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "18531:4:19", + "nodeType": "YulLiteral", + "src": "18531:4:19", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "staticcall", + "nativeSrc": "18490:10:19", + "nodeType": "YulIdentifier", + "src": "18490:10:19" + }, + "nativeSrc": "18490:46:19", + "nodeType": "YulFunctionCall", + "src": "18490:46:19" + }, + "variableNames": [ + { + "name": "success", + "nativeSrc": "18479:7:19", + "nodeType": "YulIdentifier", + "src": "18479:7:19" + } + ] + }, + { + "nativeSrc": "18549:21:19", + "nodeType": "YulAssignment", + "src": "18549:21:19", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "18565:4:19", + "nodeType": "YulLiteral", + "src": "18565:4:19", + "type": "", + "value": "0x00" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "18559:5:19", + "nodeType": "YulIdentifier", + "src": "18559:5:19" + }, + "nativeSrc": "18559:11:19", + "nodeType": "YulFunctionCall", + "src": "18559:11:19" + }, + "variableNames": [ + { + "name": "result", + "nativeSrc": "18549:6:19", + "nodeType": "YulIdentifier", + "src": "18549:6:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 5358, + "isOffset": false, + "isSlot": false, + "src": "18239:1:19", + "valueSize": 1 + }, + { + "declaration": 5360, + "isOffset": false, + "isSlot": false, + "src": "18277:1:19", + "valueSize": 1 + }, + { + "declaration": 5362, + "isOffset": false, + "isSlot": false, + "src": "18315:1:19", + "valueSize": 1 + }, + { + "declaration": 5367, + "isOffset": false, + "isSlot": false, + "src": "18549:6:19", + "valueSize": 1 + }, + { + "declaration": 5365, + "isOffset": false, + "isSlot": false, + "src": "18479:7:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 5377, + "nodeType": "InlineAssembly", + "src": "17142:1438:19" + } + ] + }, + "documentation": { + "id": 5356, + "nodeType": "StructuredDocumentation", + "src": "16245:738:19", + "text": " @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m).\n It includes a success flag indicating if the operation succeeded. Operation will be marked as failed if trying\n to operate modulo 0 or if the underlying precompile reverted.\n IMPORTANT: The result is only valid if the success flag is true. When using this function, make sure the chain\n you're using it on supports the precompiled contract for modular exponentiation at address 0x05 as specified in\n https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, the underlying function will succeed given the lack\n of a revert, but the result may be incorrectly interpreted as 0." + }, + "id": 5379, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryModExp", + "nameLocation": "16997:9:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5363, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5358, + "mutability": "mutable", + "name": "b", + "nameLocation": "17015:1:19", + "nodeType": "VariableDeclaration", + "scope": 5379, + "src": "17007:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5357, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "17007:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5360, + "mutability": "mutable", + "name": "e", + "nameLocation": "17026:1:19", + "nodeType": "VariableDeclaration", + "scope": 5379, + "src": "17018:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5359, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "17018:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5362, + "mutability": "mutable", + "name": "m", + "nameLocation": "17037:1:19", + "nodeType": "VariableDeclaration", + "scope": 5379, + "src": "17029:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5361, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "17029:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "17006:33:19" + }, + "returnParameters": { + "id": 5368, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5365, + "mutability": "mutable", + "name": "success", + "nameLocation": "17068:7:19", + "nodeType": "VariableDeclaration", + "scope": 5379, + "src": "17063:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 5364, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "17063:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5367, + "mutability": "mutable", + "name": "result", + "nameLocation": "17085:6:19", + "nodeType": "VariableDeclaration", + "scope": 5379, + "src": "17077:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5366, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "17077:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "17062:30:19" + }, + "scope": 6204, + "src": "16988:1598:19", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5414, + "nodeType": "Block", + "src": "18783:179:19", + "statements": [ + { + "assignments": [ + 5392, + 5394 + ], + "declarations": [ + { + "constant": false, + "id": 5392, + "mutability": "mutable", + "name": "success", + "nameLocation": "18799:7:19", + "nodeType": "VariableDeclaration", + "scope": 5414, + "src": "18794:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 5391, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "18794:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5394, + "mutability": "mutable", + "name": "result", + "nameLocation": "18821:6:19", + "nodeType": "VariableDeclaration", + "scope": 5414, + "src": "18808:19:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5393, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "18808:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 5400, + "initialValue": { + "arguments": [ + { + "id": 5396, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5382, + "src": "18841:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 5397, + "name": "e", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5384, + "src": "18844:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 5398, + "name": "m", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5386, + "src": "18847:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 5395, + "name": "tryModExp", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 5379, + 5461 + ], + "referencedDeclaration": 5461, + "src": "18831:9:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes_memory_ptr_$_t_bytes_memory_ptr_$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$", + "typeString": "function (bytes memory,bytes memory,bytes memory) view returns (bool,bytes memory)" + } + }, + "id": 5399, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18831:18:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$", + "typeString": "tuple(bool,bytes memory)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "18793:56:19" + }, + { + "condition": { + "id": 5402, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "18863:8:19", + "subExpression": { + "id": 5401, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5392, + "src": "18864:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5411, + "nodeType": "IfStatement", + "src": "18859:74:19", + "trueBody": { + "id": 5410, + "nodeType": "Block", + "src": "18873:60:19", + "statements": [ + { + "expression": { + "arguments": [ + { + "expression": { + "id": 5406, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "18899:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 5407, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "18905:16:19", + "memberName": "DIVISION_BY_ZERO", + "nodeType": "MemberAccess", + "referencedDeclaration": 1681, + "src": "18899:22:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 5403, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "18887:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 5405, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "18893:5:19", + "memberName": "panic", + "nodeType": "MemberAccess", + "referencedDeclaration": 1713, + "src": "18887:11:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$__$", + "typeString": "function (uint256) pure" + } + }, + "id": 5408, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18887:35:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 5409, + "nodeType": "ExpressionStatement", + "src": "18887:35:19" + } + ] + } + }, + { + "expression": { + "id": 5412, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5394, + "src": "18949:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "functionReturnParameters": 5390, + "id": 5413, + "nodeType": "Return", + "src": "18942:13:19" + } + ] + }, + "documentation": { + "id": 5380, + "nodeType": "StructuredDocumentation", + "src": "18592:85:19", + "text": " @dev Variant of {modExp} that supports inputs of arbitrary length." + }, + "id": 5415, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "modExp", + "nameLocation": "18691:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5387, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5382, + "mutability": "mutable", + "name": "b", + "nameLocation": "18711:1:19", + "nodeType": "VariableDeclaration", + "scope": 5415, + "src": "18698:14:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5381, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "18698:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5384, + "mutability": "mutable", + "name": "e", + "nameLocation": "18727:1:19", + "nodeType": "VariableDeclaration", + "scope": 5415, + "src": "18714:14:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5383, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "18714:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5386, + "mutability": "mutable", + "name": "m", + "nameLocation": "18743:1:19", + "nodeType": "VariableDeclaration", + "scope": 5415, + "src": "18730:14:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5385, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "18730:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "18697:48:19" + }, + "returnParameters": { + "id": 5390, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5389, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5415, + "src": "18769:12:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5388, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "18769:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "18768:14:19" + }, + "scope": 6204, + "src": "18682:280:19", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5460, + "nodeType": "Block", + "src": "19216:771:19", + "statements": [ + { + "condition": { + "arguments": [ + { + "id": 5430, + "name": "m", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5422, + "src": "19241:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 5429, + "name": "_zeroBytes", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5508, + "src": "19230:10:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$returns$_t_bool_$", + "typeString": "function (bytes memory) pure returns (bool)" + } + }, + "id": 5431, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19230:13:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5439, + "nodeType": "IfStatement", + "src": "19226:47:19", + "trueBody": { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 5432, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19253:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "arguments": [ + { + "hexValue": "30", + "id": 5435, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19270:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 5434, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "19260:9:19", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (uint256) pure returns (bytes memory)" + }, + "typeName": { + "id": 5433, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "19264:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + } + }, + "id": 5436, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19260:12:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "id": 5437, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "19252:21:19", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$", + "typeString": "tuple(bool,bytes memory)" + } + }, + "functionReturnParameters": 5428, + "id": 5438, + "nodeType": "Return", + "src": "19245:28:19" + } + }, + { + "assignments": [ + 5441 + ], + "declarations": [ + { + "constant": false, + "id": 5441, + "mutability": "mutable", + "name": "mLen", + "nameLocation": "19292:4:19", + "nodeType": "VariableDeclaration", + "scope": 5460, + "src": "19284:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5440, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "19284:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5444, + "initialValue": { + "expression": { + "id": 5442, + "name": "m", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5422, + "src": "19299:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 5443, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "19301:6:19", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "19299:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "19284:23:19" + }, + { + "expression": { + "id": 5457, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5445, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5427, + "src": "19389:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "expression": { + "id": 5448, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5418, + "src": "19415:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 5449, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "19417:6:19", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "19415:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 5450, + "name": "e", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5420, + "src": "19425:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 5451, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "19427:6:19", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "19425:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5452, + "name": "mLen", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5441, + "src": "19435:4:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5453, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5418, + "src": "19441:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 5454, + "name": "e", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5420, + "src": "19444:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 5455, + "name": "m", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5422, + "src": "19447:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "id": 5446, + "name": "abi", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -1, + "src": "19398:3:19", + "typeDescriptions": { + "typeIdentifier": "t_magic_abi", + "typeString": "abi" + } + }, + "id": 5447, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "19402:12:19", + "memberName": "encodePacked", + "nodeType": "MemberAccess", + "src": "19398:16:19", + "typeDescriptions": { + "typeIdentifier": "t_function_abiencodepacked_pure$__$returns$_t_bytes_memory_ptr_$", + "typeString": "function () pure returns (bytes memory)" + } + }, + "id": 5456, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19398:51:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "src": "19389:60:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 5458, + "nodeType": "ExpressionStatement", + "src": "19389:60:19" + }, + { + "AST": { + "nativeSrc": "19485:496:19", + "nodeType": "YulBlock", + "src": "19485:496:19", + "statements": [ + { + "nativeSrc": "19499:32:19", + "nodeType": "YulVariableDeclaration", + "src": "19499:32:19", + "value": { + "arguments": [ + { + "name": "result", + "nativeSrc": "19518:6:19", + "nodeType": "YulIdentifier", + "src": "19518:6:19" + }, + { + "kind": "number", + "nativeSrc": "19526:4:19", + "nodeType": "YulLiteral", + "src": "19526:4:19", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "19514:3:19", + "nodeType": "YulIdentifier", + "src": "19514:3:19" + }, + "nativeSrc": "19514:17:19", + "nodeType": "YulFunctionCall", + "src": "19514:17:19" + }, + "variables": [ + { + "name": "dataPtr", + "nativeSrc": "19503:7:19", + "nodeType": "YulTypedName", + "src": "19503:7:19", + "type": "" + } + ] + }, + { + "nativeSrc": "19621:73:19", + "nodeType": "YulAssignment", + "src": "19621:73:19", + "value": { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "gas", + "nativeSrc": "19643:3:19", + "nodeType": "YulIdentifier", + "src": "19643:3:19" + }, + "nativeSrc": "19643:5:19", + "nodeType": "YulFunctionCall", + "src": "19643:5:19" + }, + { + "kind": "number", + "nativeSrc": "19650:4:19", + "nodeType": "YulLiteral", + "src": "19650:4:19", + "type": "", + "value": "0x05" + }, + { + "name": "dataPtr", + "nativeSrc": "19656:7:19", + "nodeType": "YulIdentifier", + "src": "19656:7:19" + }, + { + "arguments": [ + { + "name": "result", + "nativeSrc": "19671:6:19", + "nodeType": "YulIdentifier", + "src": "19671:6:19" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "19665:5:19", + "nodeType": "YulIdentifier", + "src": "19665:5:19" + }, + "nativeSrc": "19665:13:19", + "nodeType": "YulFunctionCall", + "src": "19665:13:19" + }, + { + "name": "dataPtr", + "nativeSrc": "19680:7:19", + "nodeType": "YulIdentifier", + "src": "19680:7:19" + }, + { + "name": "mLen", + "nativeSrc": "19689:4:19", + "nodeType": "YulIdentifier", + "src": "19689:4:19" + } + ], + "functionName": { + "name": "staticcall", + "nativeSrc": "19632:10:19", + "nodeType": "YulIdentifier", + "src": "19632:10:19" + }, + "nativeSrc": "19632:62:19", + "nodeType": "YulFunctionCall", + "src": "19632:62:19" + }, + "variableNames": [ + { + "name": "success", + "nativeSrc": "19621:7:19", + "nodeType": "YulIdentifier", + "src": "19621:7:19" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "result", + "nativeSrc": "19850:6:19", + "nodeType": "YulIdentifier", + "src": "19850:6:19" + }, + { + "name": "mLen", + "nativeSrc": "19858:4:19", + "nodeType": "YulIdentifier", + "src": "19858:4:19" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "19843:6:19", + "nodeType": "YulIdentifier", + "src": "19843:6:19" + }, + "nativeSrc": "19843:20:19", + "nodeType": "YulFunctionCall", + "src": "19843:20:19" + }, + "nativeSrc": "19843:20:19", + "nodeType": "YulExpressionStatement", + "src": "19843:20:19" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "19946:4:19", + "nodeType": "YulLiteral", + "src": "19946:4:19", + "type": "", + "value": "0x40" + }, + { + "arguments": [ + { + "name": "dataPtr", + "nativeSrc": "19956:7:19", + "nodeType": "YulIdentifier", + "src": "19956:7:19" + }, + { + "name": "mLen", + "nativeSrc": "19965:4:19", + "nodeType": "YulIdentifier", + "src": "19965:4:19" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "19952:3:19", + "nodeType": "YulIdentifier", + "src": "19952:3:19" + }, + "nativeSrc": "19952:18:19", + "nodeType": "YulFunctionCall", + "src": "19952:18:19" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "19939:6:19", + "nodeType": "YulIdentifier", + "src": "19939:6:19" + }, + "nativeSrc": "19939:32:19", + "nodeType": "YulFunctionCall", + "src": "19939:32:19" + }, + "nativeSrc": "19939:32:19", + "nodeType": "YulExpressionStatement", + "src": "19939:32:19" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 5441, + "isOffset": false, + "isSlot": false, + "src": "19689:4:19", + "valueSize": 1 + }, + { + "declaration": 5441, + "isOffset": false, + "isSlot": false, + "src": "19858:4:19", + "valueSize": 1 + }, + { + "declaration": 5441, + "isOffset": false, + "isSlot": false, + "src": "19965:4:19", + "valueSize": 1 + }, + { + "declaration": 5427, + "isOffset": false, + "isSlot": false, + "src": "19518:6:19", + "valueSize": 1 + }, + { + "declaration": 5427, + "isOffset": false, + "isSlot": false, + "src": "19671:6:19", + "valueSize": 1 + }, + { + "declaration": 5427, + "isOffset": false, + "isSlot": false, + "src": "19850:6:19", + "valueSize": 1 + }, + { + "declaration": 5425, + "isOffset": false, + "isSlot": false, + "src": "19621:7:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 5459, + "nodeType": "InlineAssembly", + "src": "19460:521:19" + } + ] + }, + "documentation": { + "id": 5416, + "nodeType": "StructuredDocumentation", + "src": "18968:88:19", + "text": " @dev Variant of {tryModExp} that supports inputs of arbitrary length." + }, + "id": 5461, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryModExp", + "nameLocation": "19070:9:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5423, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5418, + "mutability": "mutable", + "name": "b", + "nameLocation": "19102:1:19", + "nodeType": "VariableDeclaration", + "scope": 5461, + "src": "19089:14:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5417, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "19089:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5420, + "mutability": "mutable", + "name": "e", + "nameLocation": "19126:1:19", + "nodeType": "VariableDeclaration", + "scope": 5461, + "src": "19113:14:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5419, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "19113:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5422, + "mutability": "mutable", + "name": "m", + "nameLocation": "19150:1:19", + "nodeType": "VariableDeclaration", + "scope": 5461, + "src": "19137:14:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5421, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "19137:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "19079:78:19" + }, + "returnParameters": { + "id": 5428, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5425, + "mutability": "mutable", + "name": "success", + "nameLocation": "19186:7:19", + "nodeType": "VariableDeclaration", + "scope": 5461, + "src": "19181:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 5424, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "19181:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5427, + "mutability": "mutable", + "name": "result", + "nameLocation": "19208:6:19", + "nodeType": "VariableDeclaration", + "scope": 5461, + "src": "19195:19:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5426, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "19195:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "19180:35:19" + }, + "scope": 6204, + "src": "19061:926:19", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5507, + "nodeType": "Block", + "src": "20139:417:19", + "statements": [ + { + "assignments": [ + 5470 + ], + "declarations": [ + { + "constant": false, + "id": 5470, + "mutability": "mutable", + "name": "chunk", + "nameLocation": "20157:5:19", + "nodeType": "VariableDeclaration", + "scope": 5507, + "src": "20149:13:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5469, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "20149:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5471, + "nodeType": "VariableDeclarationStatement", + "src": "20149:13:19" + }, + { + "body": { + "id": 5503, + "nodeType": "Block", + "src": "20222:307:19", + "statements": [ + { + "AST": { + "nativeSrc": "20324:73:19", + "nodeType": "YulBlock", + "src": "20324:73:19", + "statements": [ + { + "nativeSrc": "20342:41:19", + "nodeType": "YulAssignment", + "src": "20342:41:19", + "value": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "20365:6:19", + "nodeType": "YulIdentifier", + "src": "20365:6:19" + }, + { + "kind": "number", + "nativeSrc": "20373:4:19", + "nodeType": "YulLiteral", + "src": "20373:4:19", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "20361:3:19", + "nodeType": "YulIdentifier", + "src": "20361:3:19" + }, + "nativeSrc": "20361:17:19", + "nodeType": "YulFunctionCall", + "src": "20361:17:19" + }, + { + "name": "i", + "nativeSrc": "20380:1:19", + "nodeType": "YulIdentifier", + "src": "20380:1:19" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "20357:3:19", + "nodeType": "YulIdentifier", + "src": "20357:3:19" + }, + "nativeSrc": "20357:25:19", + "nodeType": "YulFunctionCall", + "src": "20357:25:19" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "20351:5:19", + "nodeType": "YulIdentifier", + "src": "20351:5:19" + }, + "nativeSrc": "20351:32:19", + "nodeType": "YulFunctionCall", + "src": "20351:32:19" + }, + "variableNames": [ + { + "name": "chunk", + "nativeSrc": "20342:5:19", + "nodeType": "YulIdentifier", + "src": "20342:5:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 5464, + "isOffset": false, + "isSlot": false, + "src": "20365:6:19", + "valueSize": 1 + }, + { + "declaration": 5470, + "isOffset": false, + "isSlot": false, + "src": "20342:5:19", + "valueSize": 1 + }, + { + "declaration": 5473, + "isOffset": false, + "isSlot": false, + "src": "20380:1:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 5484, + "nodeType": "InlineAssembly", + "src": "20299:98:19" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5498, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5496, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5485, + "name": "chunk", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5470, + "src": "20414:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5494, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "38", + "id": 5486, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "20424:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5490, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5488, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5473, + "src": "20442:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "30783230", + "id": 5489, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "20446:4:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "0x20" + }, + "src": "20442:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 5491, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5464, + "src": "20452:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 5492, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "20459:6:19", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "20452:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5487, + "name": "saturatingSub", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4779, + "src": "20428:13:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 5493, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "20428:38:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "20424:42:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5495, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "20423:44:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "20414:53:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "hexValue": "30", + "id": 5497, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "20471:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "20414:58:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5502, + "nodeType": "IfStatement", + "src": "20410:109:19", + "trueBody": { + "id": 5501, + "nodeType": "Block", + "src": "20474:45:19", + "statements": [ + { + "expression": { + "hexValue": "66616c7365", + "id": 5499, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "20499:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + "functionReturnParameters": 5468, + "id": 5500, + "nodeType": "Return", + "src": "20492:12:19" + } + ] + } + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5479, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5476, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5473, + "src": "20192:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "expression": { + "id": 5477, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5464, + "src": "20196:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 5478, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "20203:6:19", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "20196:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "20192:17:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5504, + "initializationExpression": { + "assignments": [ + 5473 + ], + "declarations": [ + { + "constant": false, + "id": 5473, + "mutability": "mutable", + "name": "i", + "nameLocation": "20185:1:19", + "nodeType": "VariableDeclaration", + "scope": 5504, + "src": "20177:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5472, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "20177:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5475, + "initialValue": { + "hexValue": "30", + "id": 5474, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "20189:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "20177:13:19" + }, + "isSimpleCounterLoop": false, + "loopExpression": { + "expression": { + "id": 5482, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5480, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5473, + "src": "20211:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "hexValue": "30783230", + "id": 5481, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "20216:4:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "0x20" + }, + "src": "20211:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5483, + "nodeType": "ExpressionStatement", + "src": "20211:9:19" + }, + "nodeType": "ForStatement", + "src": "20172:357:19" + }, + { + "expression": { + "hexValue": "74727565", + "id": 5505, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "20545:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "functionReturnParameters": 5468, + "id": 5506, + "nodeType": "Return", + "src": "20538:11:19" + } + ] + }, + "documentation": { + "id": 5462, + "nodeType": "StructuredDocumentation", + "src": "19993:72:19", + "text": " @dev Returns whether the provided byte array is zero." + }, + "id": 5508, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_zeroBytes", + "nameLocation": "20079:10:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5465, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5464, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "20103:6:19", + "nodeType": "VariableDeclaration", + "scope": 5508, + "src": "20090:19:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5463, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "20090:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "20089:21:19" + }, + "returnParameters": { + "id": 5468, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5467, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5508, + "src": "20133:4:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 5466, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "20133:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "20132:6:19" + }, + "scope": 6204, + "src": "20070:486:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 5726, + "nodeType": "Block", + "src": "20916:5124:19", + "statements": [ + { + "id": 5725, + "nodeType": "UncheckedBlock", + "src": "20926:5108:19", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5518, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5516, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "21020:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<=", + "rightExpression": { + "hexValue": "31", + "id": 5517, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "21025:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "21020:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5522, + "nodeType": "IfStatement", + "src": "21016:53:19", + "trueBody": { + "id": 5521, + "nodeType": "Block", + "src": "21028:41:19", + "statements": [ + { + "expression": { + "id": 5519, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "21053:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5515, + "id": 5520, + "nodeType": "Return", + "src": "21046:8:19" + } + ] + } + }, + { + "assignments": [ + 5524 + ], + "declarations": [ + { + "constant": false, + "id": 5524, + "mutability": "mutable", + "name": "aa", + "nameLocation": "22004:2:19", + "nodeType": "VariableDeclaration", + "scope": 5725, + "src": "21996:10:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5523, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "21996:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5526, + "initialValue": { + "id": 5525, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "22009:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "21996:14:19" + }, + { + "assignments": [ + 5528 + ], + "declarations": [ + { + "constant": false, + "id": 5528, + "mutability": "mutable", + "name": "xn", + "nameLocation": "22032:2:19", + "nodeType": "VariableDeclaration", + "scope": 5725, + "src": "22024:10:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5527, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "22024:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5530, + "initialValue": { + "hexValue": "31", + "id": 5529, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22037:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "VariableDeclarationStatement", + "src": "22024:14:19" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5536, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5531, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22057:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_rational_340282366920938463463374607431768211456_by_1", + "typeString": "int_const 3402...(31 digits omitted)...1456" + }, + "id": 5534, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5532, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22064:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "313238", + "id": 5533, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22069:3:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_128_by_1", + "typeString": "int_const 128" + }, + "value": "128" + }, + "src": "22064:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_340282366920938463463374607431768211456_by_1", + "typeString": "int_const 3402...(31 digits omitted)...1456" + } + } + ], + "id": 5535, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "22063:10:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_340282366920938463463374607431768211456_by_1", + "typeString": "int_const 3402...(31 digits omitted)...1456" + } + }, + "src": "22057:16:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5546, + "nodeType": "IfStatement", + "src": "22053:92:19", + "trueBody": { + "id": 5545, + "nodeType": "Block", + "src": "22075:70:19", + "statements": [ + { + "expression": { + "id": 5539, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5537, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22093:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": ">>=", + "rightHandSide": { + "hexValue": "313238", + "id": 5538, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22100:3:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_128_by_1", + "typeString": "int_const 128" + }, + "value": "128" + }, + "src": "22093:10:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5540, + "nodeType": "ExpressionStatement", + "src": "22093:10:19" + }, + { + "expression": { + "id": 5543, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5541, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "22121:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "<<=", + "rightHandSide": { + "hexValue": "3634", + "id": 5542, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22128:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "22121:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5544, + "nodeType": "ExpressionStatement", + "src": "22121:9:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5552, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5547, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22162:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_rational_18446744073709551616_by_1", + "typeString": "int_const 18446744073709551616" + }, + "id": 5550, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5548, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22169:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3634", + "id": 5549, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22174:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "22169:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_18446744073709551616_by_1", + "typeString": "int_const 18446744073709551616" + } + } + ], + "id": 5551, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "22168:9:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_18446744073709551616_by_1", + "typeString": "int_const 18446744073709551616" + } + }, + "src": "22162:15:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5562, + "nodeType": "IfStatement", + "src": "22158:90:19", + "trueBody": { + "id": 5561, + "nodeType": "Block", + "src": "22179:69:19", + "statements": [ + { + "expression": { + "id": 5555, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5553, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22197:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": ">>=", + "rightHandSide": { + "hexValue": "3634", + "id": 5554, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22204:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "22197:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5556, + "nodeType": "ExpressionStatement", + "src": "22197:9:19" + }, + { + "expression": { + "id": 5559, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5557, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "22224:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "<<=", + "rightHandSide": { + "hexValue": "3332", + "id": 5558, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22231:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "22224:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5560, + "nodeType": "ExpressionStatement", + "src": "22224:9:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5568, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5563, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22265:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_rational_4294967296_by_1", + "typeString": "int_const 4294967296" + }, + "id": 5566, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5564, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22272:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3332", + "id": 5565, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22277:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "22272:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4294967296_by_1", + "typeString": "int_const 4294967296" + } + } + ], + "id": 5567, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "22271:9:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4294967296_by_1", + "typeString": "int_const 4294967296" + } + }, + "src": "22265:15:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5578, + "nodeType": "IfStatement", + "src": "22261:90:19", + "trueBody": { + "id": 5577, + "nodeType": "Block", + "src": "22282:69:19", + "statements": [ + { + "expression": { + "id": 5571, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5569, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22300:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": ">>=", + "rightHandSide": { + "hexValue": "3332", + "id": 5570, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22307:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "22300:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5572, + "nodeType": "ExpressionStatement", + "src": "22300:9:19" + }, + { + "expression": { + "id": 5575, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5573, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "22327:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "<<=", + "rightHandSide": { + "hexValue": "3136", + "id": 5574, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22334:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "22327:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5576, + "nodeType": "ExpressionStatement", + "src": "22327:9:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5584, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5579, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22368:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_rational_65536_by_1", + "typeString": "int_const 65536" + }, + "id": 5582, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5580, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22375:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3136", + "id": 5581, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22380:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "22375:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_65536_by_1", + "typeString": "int_const 65536" + } + } + ], + "id": 5583, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "22374:9:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_65536_by_1", + "typeString": "int_const 65536" + } + }, + "src": "22368:15:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5594, + "nodeType": "IfStatement", + "src": "22364:89:19", + "trueBody": { + "id": 5593, + "nodeType": "Block", + "src": "22385:68:19", + "statements": [ + { + "expression": { + "id": 5587, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5585, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22403:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": ">>=", + "rightHandSide": { + "hexValue": "3136", + "id": 5586, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22410:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "22403:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5588, + "nodeType": "ExpressionStatement", + "src": "22403:9:19" + }, + { + "expression": { + "id": 5591, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5589, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "22430:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "<<=", + "rightHandSide": { + "hexValue": "38", + "id": 5590, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22437:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "22430:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5592, + "nodeType": "ExpressionStatement", + "src": "22430:8:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5600, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5595, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22470:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_rational_256_by_1", + "typeString": "int_const 256" + }, + "id": 5598, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5596, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22477:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "38", + "id": 5597, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22482:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "22477:6:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_256_by_1", + "typeString": "int_const 256" + } + } + ], + "id": 5599, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "22476:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_256_by_1", + "typeString": "int_const 256" + } + }, + "src": "22470:14:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5610, + "nodeType": "IfStatement", + "src": "22466:87:19", + "trueBody": { + "id": 5609, + "nodeType": "Block", + "src": "22486:67:19", + "statements": [ + { + "expression": { + "id": 5603, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5601, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22504:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": ">>=", + "rightHandSide": { + "hexValue": "38", + "id": 5602, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22511:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "22504:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5604, + "nodeType": "ExpressionStatement", + "src": "22504:8:19" + }, + { + "expression": { + "id": 5607, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5605, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "22530:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "<<=", + "rightHandSide": { + "hexValue": "34", + "id": 5606, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22537:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "22530:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5608, + "nodeType": "ExpressionStatement", + "src": "22530:8:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5616, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5611, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22570:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "id": 5614, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5612, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22577:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "34", + "id": 5613, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22582:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "22577:6:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + } + } + ], + "id": 5615, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "22576:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + } + }, + "src": "22570:14:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5626, + "nodeType": "IfStatement", + "src": "22566:87:19", + "trueBody": { + "id": 5625, + "nodeType": "Block", + "src": "22586:67:19", + "statements": [ + { + "expression": { + "id": 5619, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5617, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22604:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": ">>=", + "rightHandSide": { + "hexValue": "34", + "id": 5618, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22611:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "22604:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5620, + "nodeType": "ExpressionStatement", + "src": "22604:8:19" + }, + { + "expression": { + "id": 5623, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5621, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "22630:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "<<=", + "rightHandSide": { + "hexValue": "32", + "id": 5622, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22637:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "22630:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5624, + "nodeType": "ExpressionStatement", + "src": "22630:8:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5632, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5627, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22670:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "id": 5630, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5628, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22677:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "32", + "id": 5629, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22682:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "22677:6:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + } + } + ], + "id": 5631, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "22676:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + } + }, + "src": "22670:14:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5638, + "nodeType": "IfStatement", + "src": "22666:61:19", + "trueBody": { + "id": 5637, + "nodeType": "Block", + "src": "22686:41:19", + "statements": [ + { + "expression": { + "id": 5635, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5633, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "22704:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "<<=", + "rightHandSide": { + "hexValue": "31", + "id": 5634, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22711:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "22704:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5636, + "nodeType": "ExpressionStatement", + "src": "22704:8:19" + } + ] + } + }, + { + "expression": { + "id": 5646, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5639, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "23147:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5645, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5642, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "33", + "id": 5640, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "23153:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5641, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "23157:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "23153:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5643, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "23152:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "31", + "id": 5644, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "23164:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "23152:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "23147:18:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5647, + "nodeType": "ExpressionStatement", + "src": "23147:18:19" + }, + { + "expression": { + "id": 5657, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5648, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25052:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5656, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5653, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5649, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25058:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5652, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5650, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "25063:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 5651, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25067:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25063:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25058:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5654, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "25057:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "31", + "id": 5655, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "25074:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "25057:18:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25052:23:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5658, + "nodeType": "ExpressionStatement", + "src": "25052:23:19" + }, + { + "expression": { + "id": 5668, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5659, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25161:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5667, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5664, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5660, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25167:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5663, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5661, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "25172:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 5662, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25176:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25172:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25167:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5665, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "25166:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "31", + "id": 5666, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "25183:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "25166:18:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25161:23:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5669, + "nodeType": "ExpressionStatement", + "src": "25161:23:19" + }, + { + "expression": { + "id": 5679, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5670, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25272:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5678, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5675, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5671, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25278:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5674, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5672, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "25283:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 5673, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25287:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25283:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25278:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5676, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "25277:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "31", + "id": 5677, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "25294:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "25277:18:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25272:23:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5680, + "nodeType": "ExpressionStatement", + "src": "25272:23:19" + }, + { + "expression": { + "id": 5690, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5681, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25381:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5689, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5686, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5682, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25387:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5685, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5683, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "25392:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 5684, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25396:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25392:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25387:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5687, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "25386:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "31", + "id": 5688, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "25403:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "25386:18:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25381:23:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5691, + "nodeType": "ExpressionStatement", + "src": "25381:23:19" + }, + { + "expression": { + "id": 5701, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5692, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25491:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5700, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5697, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5693, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25497:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5696, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5694, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "25502:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 5695, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25506:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25502:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25497:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5698, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "25496:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "31", + "id": 5699, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "25513:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "25496:18:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25491:23:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5702, + "nodeType": "ExpressionStatement", + "src": "25491:23:19" + }, + { + "expression": { + "id": 5712, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5703, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25601:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5711, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5708, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5704, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25607:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5707, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5705, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "25612:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 5706, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25616:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25612:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25607:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5709, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "25606:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "31", + "id": 5710, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "25623:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "25606:18:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25601:23:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5713, + "nodeType": "ExpressionStatement", + "src": "25601:23:19" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5723, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5714, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25990:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5721, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5717, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "26011:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5720, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5718, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "26016:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 5719, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "26020:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26016:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26011:11:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5715, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "25995:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5716, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "26004:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "25995:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5722, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "25995:28:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25990:33:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5515, + "id": 5724, + "nodeType": "Return", + "src": "25983:40:19" + } + ] + } + ] + }, + "documentation": { + "id": 5509, + "nodeType": "StructuredDocumentation", + "src": "20562:292:19", + "text": " @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded\n towards zero.\n This method is based on Newton's method for computing square roots; the algorithm is restricted to only\n using integer operations." + }, + "id": 5727, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "sqrt", + "nameLocation": "20868:4:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5512, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5511, + "mutability": "mutable", + "name": "a", + "nameLocation": "20881:1:19", + "nodeType": "VariableDeclaration", + "scope": 5727, + "src": "20873:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5510, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "20873:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "20872:11:19" + }, + "returnParameters": { + "id": 5515, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5514, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5727, + "src": "20907:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5513, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "20907:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "20906:9:19" + }, + "scope": 6204, + "src": "20859:5181:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5760, + "nodeType": "Block", + "src": "26213:171:19", + "statements": [ + { + "id": 5759, + "nodeType": "UncheckedBlock", + "src": "26223:155:19", + "statements": [ + { + "assignments": [ + 5739 + ], + "declarations": [ + { + "constant": false, + "id": 5739, + "mutability": "mutable", + "name": "result", + "nameLocation": "26255:6:19", + "nodeType": "VariableDeclaration", + "scope": 5759, + "src": "26247:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5738, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "26247:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5743, + "initialValue": { + "arguments": [ + { + "id": 5741, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5730, + "src": "26269:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5740, + "name": "sqrt", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 5727, + 5761 + ], + "referencedDeclaration": 5727, + "src": "26264:4:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256) pure returns (uint256)" + } + }, + "id": 5742, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "26264:7:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "26247:24:19" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5757, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5744, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5739, + "src": "26292:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 5755, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 5748, + "name": "rounding", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5733, + "src": "26334:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + ], + "id": 5747, + "name": "unsignedRoundsUp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6182, + "src": "26317:16:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_Rounding_$4559_$returns$_t_bool_$", + "typeString": "function (enum Math.Rounding) pure returns (bool)" + } + }, + "id": 5749, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "26317:26:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5754, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5752, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5750, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5739, + "src": "26347:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5751, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5739, + "src": "26356:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26347:15:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 5753, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5730, + "src": "26365:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26347:19:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "26317:49:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5745, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "26301:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5746, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "26310:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "26301:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5756, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "26301:66:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26292:75:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5737, + "id": 5758, + "nodeType": "Return", + "src": "26285:82:19" + } + ] + } + ] + }, + "documentation": { + "id": 5728, + "nodeType": "StructuredDocumentation", + "src": "26046:86:19", + "text": " @dev Calculates sqrt(a), following the selected rounding direction." + }, + "id": 5761, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "sqrt", + "nameLocation": "26146:4:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5734, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5730, + "mutability": "mutable", + "name": "a", + "nameLocation": "26159:1:19", + "nodeType": "VariableDeclaration", + "scope": 5761, + "src": "26151:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5729, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "26151:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5733, + "mutability": "mutable", + "name": "rounding", + "nameLocation": "26171:8:19", + "nodeType": "VariableDeclaration", + "scope": 5761, + "src": "26162:17:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + }, + "typeName": { + "id": 5732, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 5731, + "name": "Rounding", + "nameLocations": [ + "26162:8:19" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4559, + "src": "26162:8:19" + }, + "referencedDeclaration": 4559, + "src": "26162:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + }, + "visibility": "internal" + } + ], + "src": "26150:30:19" + }, + "returnParameters": { + "id": 5737, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5736, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5761, + "src": "26204:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5735, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "26204:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "26203:9:19" + }, + "scope": 6204, + "src": "26137:247:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5851, + "nodeType": "Block", + "src": "26573:2359:19", + "statements": [ + { + "expression": { + "id": 5778, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5769, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "26655:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5777, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5774, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5772, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5764, + "src": "26675:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30786666666666666666666666666666666666666666666666666666666666666666", + "id": 5773, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "26679:34:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_340282366920938463463374607431768211455_by_1", + "typeString": "int_const 3402...(31 digits omitted)...1455" + }, + "value": "0xffffffffffffffffffffffffffffffff" + }, + "src": "26675:38:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5770, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "26659:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5771, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "26668:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "26659:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5775, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "26659:55:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "37", + "id": 5776, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "26718:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_7_by_1", + "typeString": "int_const 7" + }, + "value": "7" + }, + "src": "26659:60:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26655:64:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5779, + "nodeType": "ExpressionStatement", + "src": "26655:64:19" + }, + { + "expression": { + "id": 5792, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5780, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "26795:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "|=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5791, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5788, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5785, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5783, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5764, + "src": "26817:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 5784, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "26822:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26817:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5786, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "26816:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "307866666666666666666666666666666666", + "id": 5787, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "26827:18:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_18446744073709551615_by_1", + "typeString": "int_const 18446744073709551615" + }, + "value": "0xffffffffffffffff" + }, + "src": "26816:29:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5781, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "26800:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5782, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "26809:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "26800:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5789, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "26800:46:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "36", + "id": 5790, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "26850:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_6_by_1", + "typeString": "int_const 6" + }, + "value": "6" + }, + "src": "26800:51:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26795:56:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5793, + "nodeType": "ExpressionStatement", + "src": "26795:56:19" + }, + { + "expression": { + "id": 5806, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5794, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "26926:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "|=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5805, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5802, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5799, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5797, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5764, + "src": "26948:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 5798, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "26953:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26948:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5800, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "26947:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30786666666666666666", + "id": 5801, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "26958:10:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4294967295_by_1", + "typeString": "int_const 4294967295" + }, + "value": "0xffffffff" + }, + "src": "26947:21:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5795, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "26931:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5796, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "26940:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "26931:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5803, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "26931:38:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "35", + "id": 5804, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "26973:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_5_by_1", + "typeString": "int_const 5" + }, + "value": "5" + }, + "src": "26931:43:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26926:48:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5807, + "nodeType": "ExpressionStatement", + "src": "26926:48:19" + }, + { + "expression": { + "id": 5820, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5808, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "27049:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "|=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5819, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5816, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5813, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5811, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5764, + "src": "27071:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 5812, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "27076:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "27071:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5814, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "27070:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "307866666666", + "id": 5815, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "27081:6:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_65535_by_1", + "typeString": "int_const 65535" + }, + "value": "0xffff" + }, + "src": "27070:17:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5809, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "27054:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5810, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "27063:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "27054:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5817, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "27054:34:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "34", + "id": 5818, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "27092:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "27054:39:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "27049:44:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5821, + "nodeType": "ExpressionStatement", + "src": "27049:44:19" + }, + { + "expression": { + "id": 5834, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5822, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "27166:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "|=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5833, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5830, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5827, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5825, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5764, + "src": "27188:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 5826, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "27193:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "27188:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5828, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "27187:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30786666", + "id": 5829, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "27198:4:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "0xff" + }, + "src": "27187:15:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5823, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "27171:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5824, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "27180:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "27171:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5831, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "27171:32:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "33", + "id": 5832, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "27207:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "src": "27171:37:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "27166:42:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5835, + "nodeType": "ExpressionStatement", + "src": "27166:42:19" + }, + { + "expression": { + "id": 5848, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5836, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "27280:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "|=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5847, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5844, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5841, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5839, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5764, + "src": "27302:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 5840, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "27307:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "27302:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5842, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "27301:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "307866", + "id": 5843, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "27312:3:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_15_by_1", + "typeString": "int_const 15" + }, + "value": "0xf" + }, + "src": "27301:14:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5837, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "27285:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5838, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "27294:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "27285:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5845, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "27285:31:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "32", + "id": 5846, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "27320:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "27285:36:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "27280:41:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5849, + "nodeType": "ExpressionStatement", + "src": "27280:41:19" + }, + { + "AST": { + "nativeSrc": "28807:119:19", + "nodeType": "YulBlock", + "src": "28807:119:19", + "statements": [ + { + "nativeSrc": "28821:95:19", + "nodeType": "YulAssignment", + "src": "28821:95:19", + "value": { + "arguments": [ + { + "name": "r", + "nativeSrc": "28829:1:19", + "nodeType": "YulIdentifier", + "src": "28829:1:19" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "r", + "nativeSrc": "28841:1:19", + "nodeType": "YulIdentifier", + "src": "28841:1:19" + }, + { + "name": "x", + "nativeSrc": "28844:1:19", + "nodeType": "YulIdentifier", + "src": "28844:1:19" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "28837:3:19", + "nodeType": "YulIdentifier", + "src": "28837:3:19" + }, + "nativeSrc": "28837:9:19", + "nodeType": "YulFunctionCall", + "src": "28837:9:19" + }, + { + "kind": "number", + "nativeSrc": "28848:66:19", + "nodeType": "YulLiteral", + "src": "28848:66:19", + "type": "", + "value": "0x0000010102020202030303030303030300000000000000000000000000000000" + } + ], + "functionName": { + "name": "byte", + "nativeSrc": "28832:4:19", + "nodeType": "YulIdentifier", + "src": "28832:4:19" + }, + "nativeSrc": "28832:83:19", + "nodeType": "YulFunctionCall", + "src": "28832:83:19" + } + ], + "functionName": { + "name": "or", + "nativeSrc": "28826:2:19", + "nodeType": "YulIdentifier", + "src": "28826:2:19" + }, + "nativeSrc": "28826:90:19", + "nodeType": "YulFunctionCall", + "src": "28826:90:19" + }, + "variableNames": [ + { + "name": "r", + "nativeSrc": "28821:1:19", + "nodeType": "YulIdentifier", + "src": "28821:1:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 5767, + "isOffset": false, + "isSlot": false, + "src": "28821:1:19", + "valueSize": 1 + }, + { + "declaration": 5767, + "isOffset": false, + "isSlot": false, + "src": "28829:1:19", + "valueSize": 1 + }, + { + "declaration": 5767, + "isOffset": false, + "isSlot": false, + "src": "28841:1:19", + "valueSize": 1 + }, + { + "declaration": 5764, + "isOffset": false, + "isSlot": false, + "src": "28844:1:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 5850, + "nodeType": "InlineAssembly", + "src": "28782:144:19" + } + ] + }, + "documentation": { + "id": 5762, + "nodeType": "StructuredDocumentation", + "src": "26390:119:19", + "text": " @dev Return the log in base 2 of a positive value rounded towards zero.\n Returns 0 if given 0." + }, + "id": 5852, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "log2", + "nameLocation": "26523:4:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5765, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5764, + "mutability": "mutable", + "name": "x", + "nameLocation": "26536:1:19", + "nodeType": "VariableDeclaration", + "scope": 5852, + "src": "26528:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5763, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "26528:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "26527:11:19" + }, + "returnParameters": { + "id": 5768, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5767, + "mutability": "mutable", + "name": "r", + "nameLocation": "26570:1:19", + "nodeType": "VariableDeclaration", + "scope": 5852, + "src": "26562:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5766, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "26562:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "26561:11:19" + }, + "scope": 6204, + "src": "26514:2418:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5885, + "nodeType": "Block", + "src": "29165:175:19", + "statements": [ + { + "id": 5884, + "nodeType": "UncheckedBlock", + "src": "29175:159:19", + "statements": [ + { + "assignments": [ + 5864 + ], + "declarations": [ + { + "constant": false, + "id": 5864, + "mutability": "mutable", + "name": "result", + "nameLocation": "29207:6:19", + "nodeType": "VariableDeclaration", + "scope": 5884, + "src": "29199:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5863, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "29199:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5868, + "initialValue": { + "arguments": [ + { + "id": 5866, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5855, + "src": "29221:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5865, + "name": "log2", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 5852, + 5886 + ], + "referencedDeclaration": 5852, + "src": "29216:4:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256) pure returns (uint256)" + } + }, + "id": 5867, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "29216:11:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "29199:28:19" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5882, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5869, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5864, + "src": "29248:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 5880, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 5873, + "name": "rounding", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5858, + "src": "29290:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + ], + "id": 5872, + "name": "unsignedRoundsUp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6182, + "src": "29273:16:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_Rounding_$4559_$returns$_t_bool_$", + "typeString": "function (enum Math.Rounding) pure returns (bool)" + } + }, + "id": 5874, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "29273:26:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5879, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5877, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5875, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29303:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "id": 5876, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5864, + "src": "29308:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "29303:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 5878, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5855, + "src": "29317:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "29303:19:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "29273:49:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5870, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "29257:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5871, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "29266:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "29257:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5881, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "29257:66:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "29248:75:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5862, + "id": 5883, + "nodeType": "Return", + "src": "29241:82:19" + } + ] + } + ] + }, + "documentation": { + "id": 5853, + "nodeType": "StructuredDocumentation", + "src": "28938:142:19", + "text": " @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n Returns 0 if given 0." + }, + "id": 5886, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "log2", + "nameLocation": "29094:4:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5859, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5855, + "mutability": "mutable", + "name": "value", + "nameLocation": "29107:5:19", + "nodeType": "VariableDeclaration", + "scope": 5886, + "src": "29099:13:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5854, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "29099:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5858, + "mutability": "mutable", + "name": "rounding", + "nameLocation": "29123:8:19", + "nodeType": "VariableDeclaration", + "scope": 5886, + "src": "29114:17:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + }, + "typeName": { + "id": 5857, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 5856, + "name": "Rounding", + "nameLocations": [ + "29114:8:19" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4559, + "src": "29114:8:19" + }, + "referencedDeclaration": 4559, + "src": "29114:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + }, + "visibility": "internal" + } + ], + "src": "29098:34:19" + }, + "returnParameters": { + "id": 5862, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5861, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5886, + "src": "29156:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5860, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "29156:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "29155:9:19" + }, + "scope": 6204, + "src": "29085:255:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6014, + "nodeType": "Block", + "src": "29533:854:19", + "statements": [ + { + "assignments": [ + 5895 + ], + "declarations": [ + { + "constant": false, + "id": 5895, + "mutability": "mutable", + "name": "result", + "nameLocation": "29551:6:19", + "nodeType": "VariableDeclaration", + "scope": 6014, + "src": "29543:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5894, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "29543:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5897, + "initialValue": { + "hexValue": "30", + "id": 5896, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29560:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "29543:18:19" + }, + { + "id": 6011, + "nodeType": "UncheckedBlock", + "src": "29571:787:19", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5902, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5898, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "29599:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_rational_10000000000000000000000000000000000000000000000000000000000000000_by_1", + "typeString": "int_const 1000...(57 digits omitted)...0000" + }, + "id": 5901, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5899, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29608:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "3634", + "id": 5900, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29614:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "29608:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10000000000000000000000000000000000000000000000000000000000000000_by_1", + "typeString": "int_const 1000...(57 digits omitted)...0000" + } + }, + "src": "29599:17:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5914, + "nodeType": "IfStatement", + "src": "29595:103:19", + "trueBody": { + "id": 5913, + "nodeType": "Block", + "src": "29618:80:19", + "statements": [ + { + "expression": { + "id": 5907, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5903, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "29636:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "/=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_rational_10000000000000000000000000000000000000000000000000000000000000000_by_1", + "typeString": "int_const 1000...(57 digits omitted)...0000" + }, + "id": 5906, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5904, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29645:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "3634", + "id": 5905, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29651:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "29645:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10000000000000000000000000000000000000000000000000000000000000000_by_1", + "typeString": "int_const 1000...(57 digits omitted)...0000" + } + }, + "src": "29636:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5908, + "nodeType": "ExpressionStatement", + "src": "29636:17:19" + }, + { + "expression": { + "id": 5911, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5909, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5895, + "src": "29671:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "hexValue": "3634", + "id": 5910, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29681:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "29671:12:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5912, + "nodeType": "ExpressionStatement", + "src": "29671:12:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5919, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5915, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "29715:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_rational_100000000000000000000000000000000_by_1", + "typeString": "int_const 1000...(25 digits omitted)...0000" + }, + "id": 5918, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5916, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29724:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "3332", + "id": 5917, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29730:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "29724:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_100000000000000000000000000000000_by_1", + "typeString": "int_const 1000...(25 digits omitted)...0000" + } + }, + "src": "29715:17:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5931, + "nodeType": "IfStatement", + "src": "29711:103:19", + "trueBody": { + "id": 5930, + "nodeType": "Block", + "src": "29734:80:19", + "statements": [ + { + "expression": { + "id": 5924, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5920, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "29752:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "/=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_rational_100000000000000000000000000000000_by_1", + "typeString": "int_const 1000...(25 digits omitted)...0000" + }, + "id": 5923, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5921, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29761:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "3332", + "id": 5922, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29767:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "29761:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_100000000000000000000000000000000_by_1", + "typeString": "int_const 1000...(25 digits omitted)...0000" + } + }, + "src": "29752:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5925, + "nodeType": "ExpressionStatement", + "src": "29752:17:19" + }, + { + "expression": { + "id": 5928, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5926, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5895, + "src": "29787:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "hexValue": "3332", + "id": 5927, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29797:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "29787:12:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5929, + "nodeType": "ExpressionStatement", + "src": "29787:12:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5936, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5932, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "29831:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_rational_10000000000000000_by_1", + "typeString": "int_const 10000000000000000" + }, + "id": 5935, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5933, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29840:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "3136", + "id": 5934, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29846:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "29840:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10000000000000000_by_1", + "typeString": "int_const 10000000000000000" + } + }, + "src": "29831:17:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5948, + "nodeType": "IfStatement", + "src": "29827:103:19", + "trueBody": { + "id": 5947, + "nodeType": "Block", + "src": "29850:80:19", + "statements": [ + { + "expression": { + "id": 5941, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5937, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "29868:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "/=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_rational_10000000000000000_by_1", + "typeString": "int_const 10000000000000000" + }, + "id": 5940, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5938, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29877:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "3136", + "id": 5939, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29883:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "29877:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10000000000000000_by_1", + "typeString": "int_const 10000000000000000" + } + }, + "src": "29868:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5942, + "nodeType": "ExpressionStatement", + "src": "29868:17:19" + }, + { + "expression": { + "id": 5945, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5943, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5895, + "src": "29903:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "hexValue": "3136", + "id": 5944, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29913:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "29903:12:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5946, + "nodeType": "ExpressionStatement", + "src": "29903:12:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5953, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5949, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "29947:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_rational_100000000_by_1", + "typeString": "int_const 100000000" + }, + "id": 5952, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5950, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29956:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "38", + "id": 5951, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29962:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "29956:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_100000000_by_1", + "typeString": "int_const 100000000" + } + }, + "src": "29947:16:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5965, + "nodeType": "IfStatement", + "src": "29943:100:19", + "trueBody": { + "id": 5964, + "nodeType": "Block", + "src": "29965:78:19", + "statements": [ + { + "expression": { + "id": 5958, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5954, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "29983:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "/=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_rational_100000000_by_1", + "typeString": "int_const 100000000" + }, + "id": 5957, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5955, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29992:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "38", + "id": 5956, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29998:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "29992:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_100000000_by_1", + "typeString": "int_const 100000000" + } + }, + "src": "29983:16:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5959, + "nodeType": "ExpressionStatement", + "src": "29983:16:19" + }, + { + "expression": { + "id": 5962, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5960, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5895, + "src": "30017:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "hexValue": "38", + "id": 5961, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30027:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "30017:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5963, + "nodeType": "ExpressionStatement", + "src": "30017:11:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5970, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5966, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "30060:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_rational_10000_by_1", + "typeString": "int_const 10000" + }, + "id": 5969, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5967, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30069:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "34", + "id": 5968, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30075:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "30069:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10000_by_1", + "typeString": "int_const 10000" + } + }, + "src": "30060:16:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5982, + "nodeType": "IfStatement", + "src": "30056:100:19", + "trueBody": { + "id": 5981, + "nodeType": "Block", + "src": "30078:78:19", + "statements": [ + { + "expression": { + "id": 5975, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5971, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "30096:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "/=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_rational_10000_by_1", + "typeString": "int_const 10000" + }, + "id": 5974, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5972, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30105:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "34", + "id": 5973, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30111:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "30105:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10000_by_1", + "typeString": "int_const 10000" + } + }, + "src": "30096:16:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5976, + "nodeType": "ExpressionStatement", + "src": "30096:16:19" + }, + { + "expression": { + "id": 5979, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5977, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5895, + "src": "30130:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "hexValue": "34", + "id": 5978, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30140:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "30130:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5980, + "nodeType": "ExpressionStatement", + "src": "30130:11:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5987, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5983, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "30173:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_rational_100_by_1", + "typeString": "int_const 100" + }, + "id": 5986, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5984, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30182:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "32", + "id": 5985, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30188:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "30182:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_100_by_1", + "typeString": "int_const 100" + } + }, + "src": "30173:16:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5999, + "nodeType": "IfStatement", + "src": "30169:100:19", + "trueBody": { + "id": 5998, + "nodeType": "Block", + "src": "30191:78:19", + "statements": [ + { + "expression": { + "id": 5992, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5988, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "30209:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "/=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_rational_100_by_1", + "typeString": "int_const 100" + }, + "id": 5991, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5989, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30218:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "32", + "id": 5990, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30224:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "30218:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_100_by_1", + "typeString": "int_const 100" + } + }, + "src": "30209:16:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5993, + "nodeType": "ExpressionStatement", + "src": "30209:16:19" + }, + { + "expression": { + "id": 5996, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5994, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5895, + "src": "30243:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "hexValue": "32", + "id": 5995, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30253:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "30243:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5997, + "nodeType": "ExpressionStatement", + "src": "30243:11:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6004, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6000, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "30286:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "id": 6003, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 6001, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30295:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "31", + "id": 6002, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30301:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "30295:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + } + }, + "src": "30286:16:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6010, + "nodeType": "IfStatement", + "src": "30282:66:19", + "trueBody": { + "id": 6009, + "nodeType": "Block", + "src": "30304:44:19", + "statements": [ + { + "expression": { + "id": 6007, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 6005, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5895, + "src": "30322:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "hexValue": "31", + "id": 6006, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30332:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "30322:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 6008, + "nodeType": "ExpressionStatement", + "src": "30322:11:19" + } + ] + } + } + ] + }, + { + "expression": { + "id": 6012, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5895, + "src": "30374:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5893, + "id": 6013, + "nodeType": "Return", + "src": "30367:13:19" + } + ] + }, + "documentation": { + "id": 5887, + "nodeType": "StructuredDocumentation", + "src": "29346:120:19", + "text": " @dev Return the log in base 10 of a positive value rounded towards zero.\n Returns 0 if given 0." + }, + "id": 6015, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "log10", + "nameLocation": "29480:5:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5890, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5889, + "mutability": "mutable", + "name": "value", + "nameLocation": "29494:5:19", + "nodeType": "VariableDeclaration", + "scope": 6015, + "src": "29486:13:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5888, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "29486:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "29485:15:19" + }, + "returnParameters": { + "id": 5893, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5892, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6015, + "src": "29524:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5891, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "29524:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "29523:9:19" + }, + "scope": 6204, + "src": "29471:916:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6048, + "nodeType": "Block", + "src": "30622:177:19", + "statements": [ + { + "id": 6047, + "nodeType": "UncheckedBlock", + "src": "30632:161:19", + "statements": [ + { + "assignments": [ + 6027 + ], + "declarations": [ + { + "constant": false, + "id": 6027, + "mutability": "mutable", + "name": "result", + "nameLocation": "30664:6:19", + "nodeType": "VariableDeclaration", + "scope": 6047, + "src": "30656:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6026, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "30656:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 6031, + "initialValue": { + "arguments": [ + { + "id": 6029, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6018, + "src": "30679:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6028, + "name": "log10", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 6015, + 6049 + ], + "referencedDeclaration": 6015, + "src": "30673:5:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256) pure returns (uint256)" + } + }, + "id": 6030, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "30673:12:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "30656:29:19" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6045, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6032, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6027, + "src": "30706:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 6043, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 6036, + "name": "rounding", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6021, + "src": "30748:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + ], + "id": 6035, + "name": "unsignedRoundsUp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6182, + "src": "30731:16:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_Rounding_$4559_$returns$_t_bool_$", + "typeString": "function (enum Math.Rounding) pure returns (bool)" + } + }, + "id": 6037, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "30731:26:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6042, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6040, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 6038, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30761:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "id": 6039, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6027, + "src": "30767:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "30761:12:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 6041, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6018, + "src": "30776:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "30761:20:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "30731:50:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 6033, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "30715:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 6034, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "30724:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "30715:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 6044, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "30715:67:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "30706:76:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 6025, + "id": 6046, + "nodeType": "Return", + "src": "30699:83:19" + } + ] + } + ] + }, + "documentation": { + "id": 6016, + "nodeType": "StructuredDocumentation", + "src": "30393:143:19", + "text": " @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n Returns 0 if given 0." + }, + "id": 6049, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "log10", + "nameLocation": "30550:5:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6022, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6018, + "mutability": "mutable", + "name": "value", + "nameLocation": "30564:5:19", + "nodeType": "VariableDeclaration", + "scope": 6049, + "src": "30556:13:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6017, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "30556:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 6021, + "mutability": "mutable", + "name": "rounding", + "nameLocation": "30580:8:19", + "nodeType": "VariableDeclaration", + "scope": 6049, + "src": "30571:17:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + }, + "typeName": { + "id": 6020, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 6019, + "name": "Rounding", + "nameLocations": [ + "30571:8:19" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4559, + "src": "30571:8:19" + }, + "referencedDeclaration": 4559, + "src": "30571:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + }, + "visibility": "internal" + } + ], + "src": "30555:34:19" + }, + "returnParameters": { + "id": 6025, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6024, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6049, + "src": "30613:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6023, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "30613:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "30612:9:19" + }, + "scope": 6204, + "src": "30541:258:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6125, + "nodeType": "Block", + "src": "31117:675:19", + "statements": [ + { + "expression": { + "id": 6066, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 6057, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6055, + "src": "31199:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6065, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6062, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6060, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6052, + "src": "31219:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30786666666666666666666666666666666666666666666666666666666666666666", + "id": 6061, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31223:34:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_340282366920938463463374607431768211455_by_1", + "typeString": "int_const 3402...(31 digits omitted)...1455" + }, + "value": "0xffffffffffffffffffffffffffffffff" + }, + "src": "31219:38:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 6058, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "31203:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 6059, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "31212:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "31203:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 6063, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "31203:55:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "37", + "id": 6064, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31262:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_7_by_1", + "typeString": "int_const 7" + }, + "value": "7" + }, + "src": "31203:60:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "31199:64:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 6067, + "nodeType": "ExpressionStatement", + "src": "31199:64:19" + }, + { + "expression": { + "id": 6080, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 6068, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6055, + "src": "31339:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "|=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6079, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6076, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6073, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6071, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6052, + "src": "31361:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 6072, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6055, + "src": "31366:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "31361:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 6074, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "31360:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "307866666666666666666666666666666666", + "id": 6075, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31371:18:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_18446744073709551615_by_1", + "typeString": "int_const 18446744073709551615" + }, + "value": "0xffffffffffffffff" + }, + "src": "31360:29:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 6069, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "31344:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 6070, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "31353:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "31344:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 6077, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "31344:46:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "36", + "id": 6078, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31394:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_6_by_1", + "typeString": "int_const 6" + }, + "value": "6" + }, + "src": "31344:51:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "31339:56:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 6081, + "nodeType": "ExpressionStatement", + "src": "31339:56:19" + }, + { + "expression": { + "id": 6094, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 6082, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6055, + "src": "31470:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "|=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6093, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6090, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6087, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6085, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6052, + "src": "31492:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 6086, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6055, + "src": "31497:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "31492:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 6088, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "31491:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30786666666666666666", + "id": 6089, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31502:10:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4294967295_by_1", + "typeString": "int_const 4294967295" + }, + "value": "0xffffffff" + }, + "src": "31491:21:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 6083, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "31475:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 6084, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "31484:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "31475:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 6091, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "31475:38:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "35", + "id": 6092, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31517:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_5_by_1", + "typeString": "int_const 5" + }, + "value": "5" + }, + "src": "31475:43:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "31470:48:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 6095, + "nodeType": "ExpressionStatement", + "src": "31470:48:19" + }, + { + "expression": { + "id": 6108, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 6096, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6055, + "src": "31593:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "|=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6107, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6104, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6101, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6099, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6052, + "src": "31615:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 6100, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6055, + "src": "31620:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "31615:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 6102, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "31614:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "307866666666", + "id": 6103, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31625:6:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_65535_by_1", + "typeString": "int_const 65535" + }, + "value": "0xffff" + }, + "src": "31614:17:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 6097, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "31598:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 6098, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "31607:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "31598:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 6105, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "31598:34:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "34", + "id": 6106, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31636:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "31598:39:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "31593:44:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 6109, + "nodeType": "ExpressionStatement", + "src": "31593:44:19" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6123, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6112, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6110, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6055, + "src": "31743:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "33", + "id": 6111, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31748:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "src": "31743:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 6113, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "31742:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6121, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6118, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6116, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6052, + "src": "31770:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 6117, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6055, + "src": "31775:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "31770:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 6119, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "31769:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30786666", + "id": 6120, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31780:4:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "0xff" + }, + "src": "31769:15:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 6114, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "31753:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 6115, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "31762:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "31753:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 6122, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "31753:32:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "31742:43:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 6056, + "id": 6124, + "nodeType": "Return", + "src": "31735:50:19" + } + ] + }, + "documentation": { + "id": 6050, + "nodeType": "StructuredDocumentation", + "src": "30805:246:19", + "text": " @dev Return the log in base 256 of a positive value rounded towards zero.\n Returns 0 if given 0.\n Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string." + }, + "id": 6126, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "log256", + "nameLocation": "31065:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6053, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6052, + "mutability": "mutable", + "name": "x", + "nameLocation": "31080:1:19", + "nodeType": "VariableDeclaration", + "scope": 6126, + "src": "31072:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6051, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "31072:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "31071:11:19" + }, + "returnParameters": { + "id": 6056, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6055, + "mutability": "mutable", + "name": "r", + "nameLocation": "31114:1:19", + "nodeType": "VariableDeclaration", + "scope": 6126, + "src": "31106:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6054, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "31106:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "31105:11:19" + }, + "scope": 6204, + "src": "31056:736:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6162, + "nodeType": "Block", + "src": "32029:184:19", + "statements": [ + { + "id": 6161, + "nodeType": "UncheckedBlock", + "src": "32039:168:19", + "statements": [ + { + "assignments": [ + 6138 + ], + "declarations": [ + { + "constant": false, + "id": 6138, + "mutability": "mutable", + "name": "result", + "nameLocation": "32071:6:19", + "nodeType": "VariableDeclaration", + "scope": 6161, + "src": "32063:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6137, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "32063:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 6142, + "initialValue": { + "arguments": [ + { + "id": 6140, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6129, + "src": "32087:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6139, + "name": "log256", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 6126, + 6163 + ], + "referencedDeclaration": 6126, + "src": "32080:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256) pure returns (uint256)" + } + }, + "id": 6141, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "32080:13:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "32063:30:19" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6159, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6143, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6138, + "src": "32114:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 6157, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 6147, + "name": "rounding", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6132, + "src": "32156:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + ], + "id": 6146, + "name": "unsignedRoundsUp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6182, + "src": "32139:16:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_Rounding_$4559_$returns$_t_bool_$", + "typeString": "function (enum Math.Rounding) pure returns (bool)" + } + }, + "id": 6148, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "32139:26:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6156, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6154, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 6149, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "32169:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6152, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6150, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6138, + "src": "32175:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "33", + "id": 6151, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "32185:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "src": "32175:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 6153, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "32174:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "32169:18:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 6155, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6129, + "src": "32190:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "32169:26:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "32139:56:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 6144, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "32123:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 6145, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "32132:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "32123:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 6158, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "32123:73:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "32114:82:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 6136, + "id": 6160, + "nodeType": "Return", + "src": "32107:89:19" + } + ] + } + ] + }, + "documentation": { + "id": 6127, + "nodeType": "StructuredDocumentation", + "src": "31798:144:19", + "text": " @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n Returns 0 if given 0." + }, + "id": 6163, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "log256", + "nameLocation": "31956:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6133, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6129, + "mutability": "mutable", + "name": "value", + "nameLocation": "31971:5:19", + "nodeType": "VariableDeclaration", + "scope": 6163, + "src": "31963:13:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6128, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "31963:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 6132, + "mutability": "mutable", + "name": "rounding", + "nameLocation": "31987:8:19", + "nodeType": "VariableDeclaration", + "scope": 6163, + "src": "31978:17:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + }, + "typeName": { + "id": 6131, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 6130, + "name": "Rounding", + "nameLocations": [ + "31978:8:19" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4559, + "src": "31978:8:19" + }, + "referencedDeclaration": 4559, + "src": "31978:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + }, + "visibility": "internal" + } + ], + "src": "31962:34:19" + }, + "returnParameters": { + "id": 6136, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6135, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6163, + "src": "32020:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6134, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "32020:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "32019:9:19" + }, + "scope": 6204, + "src": "31947:266:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6181, + "nodeType": "Block", + "src": "32411:48:19", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 6179, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 6177, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 6174, + "name": "rounding", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6167, + "src": "32434:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + ], + "id": 6173, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "32428:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": { + "id": 6172, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "32428:5:19", + "typeDescriptions": {} + } + }, + "id": 6175, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "32428:15:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { + "hexValue": "32", + "id": 6176, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "32446:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "32428:19:19", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "31", + "id": 6178, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "32451:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "32428:24:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 6171, + "id": 6180, + "nodeType": "Return", + "src": "32421:31:19" + } + ] + }, + "documentation": { + "id": 6164, + "nodeType": "StructuredDocumentation", + "src": "32219:113:19", + "text": " @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers." + }, + "id": 6182, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "unsignedRoundsUp", + "nameLocation": "32346:16:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6168, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6167, + "mutability": "mutable", + "name": "rounding", + "nameLocation": "32372:8:19", + "nodeType": "VariableDeclaration", + "scope": 6182, + "src": "32363:17:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + }, + "typeName": { + "id": 6166, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 6165, + "name": "Rounding", + "nameLocations": [ + "32363:8:19" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4559, + "src": "32363:8:19" + }, + "referencedDeclaration": 4559, + "src": "32363:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + }, + "visibility": "internal" + } + ], + "src": "32362:19:19" + }, + "returnParameters": { + "id": 6171, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6170, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6182, + "src": "32405:4:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 6169, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "32405:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "32404:6:19" + }, + "scope": 6204, + "src": "32337:122:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6202, + "nodeType": "Block", + "src": "32602:59:19", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6193, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6191, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6185, + "src": "32627:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 6192, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "32632:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "32627:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "323536", + "id": 6194, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "32635:3:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_256_by_1", + "typeString": "int_const 256" + }, + "value": "256" + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6199, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "323535", + "id": 6195, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "32640:3:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "255" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "arguments": [ + { + "id": 6197, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6185, + "src": "32651:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6196, + "name": "log2", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 5852, + 5886 + ], + "referencedDeclaration": 5852, + "src": "32646:4:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256) pure returns (uint256)" + } + }, + "id": 6198, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "32646:7:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "32640:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_rational_256_by_1", + "typeString": "int_const 256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6190, + "name": "ternary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4836, + "src": "32619:7:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bool,uint256,uint256) pure returns (uint256)" + } + }, + "id": 6200, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "32619:35:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 6189, + "id": 6201, + "nodeType": "Return", + "src": "32612:42:19" + } + ] + }, + "documentation": { + "id": 6183, + "nodeType": "StructuredDocumentation", + "src": "32465:76:19", + "text": " @dev Counts the number of leading zero bits in a uint256." + }, + "id": 6203, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "clz", + "nameLocation": "32555:3:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6186, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6185, + "mutability": "mutable", + "name": "x", + "nameLocation": "32567:1:19", + "nodeType": "VariableDeclaration", + "scope": 6203, + "src": "32559:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6184, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "32559:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "32558:11:19" + }, + "returnParameters": { + "id": 6189, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6188, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6203, + "src": "32593:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6187, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "32593:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "32592:9:19" + }, + "scope": 6204, + "src": "32546:115:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + } + ], + "scope": 6205, + "src": "281:32382:19", + "usedErrors": [], + "usedEvents": [] + } + ], + "src": "103:32561:19" + }, + "id": 19 + }, + "@openzeppelin/contracts/utils/math/SafeCast.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/math/SafeCast.sol", + "exportedSymbols": { + "SafeCast": [ + 7969 + ] + }, + "id": 7970, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 6206, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "192:24:20" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "SafeCast", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 6207, + "nodeType": "StructuredDocumentation", + "src": "218:550:20", + "text": " @dev Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow\n checks.\n Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n easily result in undesired exploitation or bugs, since developers usually\n assume that overflows raise errors. `SafeCast` restores this intuition by\n reverting the transaction when such an operation overflows.\n Using this library instead of the unchecked operations eliminates an entire\n class of bugs, so it's recommended to use it always." + }, + "fullyImplemented": true, + "id": 7969, + "linearizedBaseContracts": [ + 7969 + ], + "name": "SafeCast", + "nameLocation": "777:8:20", + "nodeType": "ContractDefinition", + "nodes": [ + { + "documentation": { + "id": 6208, + "nodeType": "StructuredDocumentation", + "src": "792:67:20", + "text": " @dev Value doesn't fit in a uint of `bits` size." + }, + "errorSelector": "6dfcc650", + "id": 6214, + "name": "SafeCastOverflowedUintDowncast", + "nameLocation": "870:30:20", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 6213, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6210, + "mutability": "mutable", + "name": "bits", + "nameLocation": "907:4:20", + "nodeType": "VariableDeclaration", + "scope": 6214, + "src": "901:10:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 6209, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "901:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 6212, + "mutability": "mutable", + "name": "value", + "nameLocation": "921:5:20", + "nodeType": "VariableDeclaration", + "scope": 6214, + "src": "913:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6211, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "913:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "900:27:20" + }, + "src": "864:64:20" + }, + { + "documentation": { + "id": 6215, + "nodeType": "StructuredDocumentation", + "src": "934:74:20", + "text": " @dev An int value doesn't fit in a uint of `bits` size." + }, + "errorSelector": "a8ce4432", + "id": 6219, + "name": "SafeCastOverflowedIntToUint", + "nameLocation": "1019:27:20", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 6218, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6217, + "mutability": "mutable", + "name": "value", + "nameLocation": "1054:5:20", + "nodeType": "VariableDeclaration", + "scope": 6219, + "src": "1047:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 6216, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1047:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "1046:14:20" + }, + "src": "1013:48:20" + }, + { + "documentation": { + "id": 6220, + "nodeType": "StructuredDocumentation", + "src": "1067:67:20", + "text": " @dev Value doesn't fit in an int of `bits` size." + }, + "errorSelector": "327269a7", + "id": 6226, + "name": "SafeCastOverflowedIntDowncast", + "nameLocation": "1145:29:20", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 6225, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6222, + "mutability": "mutable", + "name": "bits", + "nameLocation": "1181:4:20", + "nodeType": "VariableDeclaration", + "scope": 6226, + "src": "1175:10:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 6221, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "1175:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 6224, + "mutability": "mutable", + "name": "value", + "nameLocation": "1194:5:20", + "nodeType": "VariableDeclaration", + "scope": 6226, + "src": "1187:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 6223, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1187:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "1174:26:20" + }, + "src": "1139:62:20" + }, + { + "documentation": { + "id": 6227, + "nodeType": "StructuredDocumentation", + "src": "1207:74:20", + "text": " @dev A uint value doesn't fit in an int of `bits` size." + }, + "errorSelector": "24775e06", + "id": 6231, + "name": "SafeCastOverflowedUintToInt", + "nameLocation": "1292:27:20", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 6230, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6229, + "mutability": "mutable", + "name": "value", + "nameLocation": "1328:5:20", + "nodeType": "VariableDeclaration", + "scope": 6231, + "src": "1320:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6228, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1320:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1319:15:20" + }, + "src": "1286:49:20" + }, + { + "body": { + "id": 6258, + "nodeType": "Block", + "src": "1692:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6245, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6239, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6234, + "src": "1706:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6242, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1719:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint248_$", + "typeString": "type(uint248)" + }, + "typeName": { + "id": 6241, + "name": "uint248", + "nodeType": "ElementaryTypeName", + "src": "1719:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint248_$", + "typeString": "type(uint248)" + } + ], + "id": 6240, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "1714:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6243, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1714:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint248", + "typeString": "type(uint248)" + } + }, + "id": 6244, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "1728:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "1714:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint248", + "typeString": "uint248" + } + }, + "src": "1706:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6252, + "nodeType": "IfStatement", + "src": "1702:105:20", + "trueBody": { + "id": 6251, + "nodeType": "Block", + "src": "1733:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323438", + "id": 6247, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1785:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_248_by_1", + "typeString": "int_const 248" + }, + "value": "248" + }, + { + "id": 6248, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6234, + "src": "1790:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_248_by_1", + "typeString": "int_const 248" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6246, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "1754:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6249, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1754:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6250, + "nodeType": "RevertStatement", + "src": "1747:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6255, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6234, + "src": "1831:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6254, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1823:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint248_$", + "typeString": "type(uint248)" + }, + "typeName": { + "id": 6253, + "name": "uint248", + "nodeType": "ElementaryTypeName", + "src": "1823:7:20", + "typeDescriptions": {} + } + }, + "id": 6256, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1823:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint248", + "typeString": "uint248" + } + }, + "functionReturnParameters": 6238, + "id": 6257, + "nodeType": "Return", + "src": "1816:21:20" + } + ] + }, + "documentation": { + "id": 6232, + "nodeType": "StructuredDocumentation", + "src": "1341:280:20", + "text": " @dev Returns the downcasted uint248 from uint256, reverting on\n overflow (when the input is greater than largest uint248).\n Counterpart to Solidity's `uint248` operator.\n Requirements:\n - input must fit into 248 bits" + }, + "id": 6259, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint248", + "nameLocation": "1635:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6235, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6234, + "mutability": "mutable", + "name": "value", + "nameLocation": "1653:5:20", + "nodeType": "VariableDeclaration", + "scope": 6259, + "src": "1645:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6233, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1645:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1644:15:20" + }, + "returnParameters": { + "id": 6238, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6237, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6259, + "src": "1683:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint248", + "typeString": "uint248" + }, + "typeName": { + "id": 6236, + "name": "uint248", + "nodeType": "ElementaryTypeName", + "src": "1683:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint248", + "typeString": "uint248" + } + }, + "visibility": "internal" + } + ], + "src": "1682:9:20" + }, + "scope": 7969, + "src": "1626:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6286, + "nodeType": "Block", + "src": "2201:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6273, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6267, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6262, + "src": "2215:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6270, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2228:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint240_$", + "typeString": "type(uint240)" + }, + "typeName": { + "id": 6269, + "name": "uint240", + "nodeType": "ElementaryTypeName", + "src": "2228:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint240_$", + "typeString": "type(uint240)" + } + ], + "id": 6268, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "2223:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6271, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2223:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint240", + "typeString": "type(uint240)" + } + }, + "id": 6272, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "2237:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "2223:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint240", + "typeString": "uint240" + } + }, + "src": "2215:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6280, + "nodeType": "IfStatement", + "src": "2211:105:20", + "trueBody": { + "id": 6279, + "nodeType": "Block", + "src": "2242:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323430", + "id": 6275, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2294:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_240_by_1", + "typeString": "int_const 240" + }, + "value": "240" + }, + { + "id": 6276, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6262, + "src": "2299:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_240_by_1", + "typeString": "int_const 240" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6274, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "2263:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6277, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2263:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6278, + "nodeType": "RevertStatement", + "src": "2256:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6283, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6262, + "src": "2340:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6282, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2332:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint240_$", + "typeString": "type(uint240)" + }, + "typeName": { + "id": 6281, + "name": "uint240", + "nodeType": "ElementaryTypeName", + "src": "2332:7:20", + "typeDescriptions": {} + } + }, + "id": 6284, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2332:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint240", + "typeString": "uint240" + } + }, + "functionReturnParameters": 6266, + "id": 6285, + "nodeType": "Return", + "src": "2325:21:20" + } + ] + }, + "documentation": { + "id": 6260, + "nodeType": "StructuredDocumentation", + "src": "1850:280:20", + "text": " @dev Returns the downcasted uint240 from uint256, reverting on\n overflow (when the input is greater than largest uint240).\n Counterpart to Solidity's `uint240` operator.\n Requirements:\n - input must fit into 240 bits" + }, + "id": 6287, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint240", + "nameLocation": "2144:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6263, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6262, + "mutability": "mutable", + "name": "value", + "nameLocation": "2162:5:20", + "nodeType": "VariableDeclaration", + "scope": 6287, + "src": "2154:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6261, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2154:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2153:15:20" + }, + "returnParameters": { + "id": 6266, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6265, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6287, + "src": "2192:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint240", + "typeString": "uint240" + }, + "typeName": { + "id": 6264, + "name": "uint240", + "nodeType": "ElementaryTypeName", + "src": "2192:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint240", + "typeString": "uint240" + } + }, + "visibility": "internal" + } + ], + "src": "2191:9:20" + }, + "scope": 7969, + "src": "2135:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6314, + "nodeType": "Block", + "src": "2710:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6301, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6295, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6290, + "src": "2724:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6298, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2737:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint232_$", + "typeString": "type(uint232)" + }, + "typeName": { + "id": 6297, + "name": "uint232", + "nodeType": "ElementaryTypeName", + "src": "2737:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint232_$", + "typeString": "type(uint232)" + } + ], + "id": 6296, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "2732:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6299, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2732:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint232", + "typeString": "type(uint232)" + } + }, + "id": 6300, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "2746:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "2732:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint232", + "typeString": "uint232" + } + }, + "src": "2724:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6308, + "nodeType": "IfStatement", + "src": "2720:105:20", + "trueBody": { + "id": 6307, + "nodeType": "Block", + "src": "2751:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323332", + "id": 6303, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2803:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_232_by_1", + "typeString": "int_const 232" + }, + "value": "232" + }, + { + "id": 6304, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6290, + "src": "2808:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_232_by_1", + "typeString": "int_const 232" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6302, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "2772:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6305, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2772:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6306, + "nodeType": "RevertStatement", + "src": "2765:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6311, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6290, + "src": "2849:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6310, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2841:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint232_$", + "typeString": "type(uint232)" + }, + "typeName": { + "id": 6309, + "name": "uint232", + "nodeType": "ElementaryTypeName", + "src": "2841:7:20", + "typeDescriptions": {} + } + }, + "id": 6312, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2841:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint232", + "typeString": "uint232" + } + }, + "functionReturnParameters": 6294, + "id": 6313, + "nodeType": "Return", + "src": "2834:21:20" + } + ] + }, + "documentation": { + "id": 6288, + "nodeType": "StructuredDocumentation", + "src": "2359:280:20", + "text": " @dev Returns the downcasted uint232 from uint256, reverting on\n overflow (when the input is greater than largest uint232).\n Counterpart to Solidity's `uint232` operator.\n Requirements:\n - input must fit into 232 bits" + }, + "id": 6315, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint232", + "nameLocation": "2653:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6291, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6290, + "mutability": "mutable", + "name": "value", + "nameLocation": "2671:5:20", + "nodeType": "VariableDeclaration", + "scope": 6315, + "src": "2663:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6289, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2663:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2662:15:20" + }, + "returnParameters": { + "id": 6294, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6293, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6315, + "src": "2701:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint232", + "typeString": "uint232" + }, + "typeName": { + "id": 6292, + "name": "uint232", + "nodeType": "ElementaryTypeName", + "src": "2701:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint232", + "typeString": "uint232" + } + }, + "visibility": "internal" + } + ], + "src": "2700:9:20" + }, + "scope": 7969, + "src": "2644:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6342, + "nodeType": "Block", + "src": "3219:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6329, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6323, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6318, + "src": "3233:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6326, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3246:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint224_$", + "typeString": "type(uint224)" + }, + "typeName": { + "id": 6325, + "name": "uint224", + "nodeType": "ElementaryTypeName", + "src": "3246:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint224_$", + "typeString": "type(uint224)" + } + ], + "id": 6324, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "3241:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6327, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3241:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint224", + "typeString": "type(uint224)" + } + }, + "id": 6328, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "3255:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "3241:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint224", + "typeString": "uint224" + } + }, + "src": "3233:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6336, + "nodeType": "IfStatement", + "src": "3229:105:20", + "trueBody": { + "id": 6335, + "nodeType": "Block", + "src": "3260:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323234", + "id": 6331, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3312:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_224_by_1", + "typeString": "int_const 224" + }, + "value": "224" + }, + { + "id": 6332, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6318, + "src": "3317:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_224_by_1", + "typeString": "int_const 224" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6330, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "3281:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6333, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3281:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6334, + "nodeType": "RevertStatement", + "src": "3274:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6339, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6318, + "src": "3358:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6338, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3350:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint224_$", + "typeString": "type(uint224)" + }, + "typeName": { + "id": 6337, + "name": "uint224", + "nodeType": "ElementaryTypeName", + "src": "3350:7:20", + "typeDescriptions": {} + } + }, + "id": 6340, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3350:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint224", + "typeString": "uint224" + } + }, + "functionReturnParameters": 6322, + "id": 6341, + "nodeType": "Return", + "src": "3343:21:20" + } + ] + }, + "documentation": { + "id": 6316, + "nodeType": "StructuredDocumentation", + "src": "2868:280:20", + "text": " @dev Returns the downcasted uint224 from uint256, reverting on\n overflow (when the input is greater than largest uint224).\n Counterpart to Solidity's `uint224` operator.\n Requirements:\n - input must fit into 224 bits" + }, + "id": 6343, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint224", + "nameLocation": "3162:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6319, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6318, + "mutability": "mutable", + "name": "value", + "nameLocation": "3180:5:20", + "nodeType": "VariableDeclaration", + "scope": 6343, + "src": "3172:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6317, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3172:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3171:15:20" + }, + "returnParameters": { + "id": 6322, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6321, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6343, + "src": "3210:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint224", + "typeString": "uint224" + }, + "typeName": { + "id": 6320, + "name": "uint224", + "nodeType": "ElementaryTypeName", + "src": "3210:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint224", + "typeString": "uint224" + } + }, + "visibility": "internal" + } + ], + "src": "3209:9:20" + }, + "scope": 7969, + "src": "3153:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6370, + "nodeType": "Block", + "src": "3728:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6357, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6351, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6346, + "src": "3742:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6354, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3755:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint216_$", + "typeString": "type(uint216)" + }, + "typeName": { + "id": 6353, + "name": "uint216", + "nodeType": "ElementaryTypeName", + "src": "3755:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint216_$", + "typeString": "type(uint216)" + } + ], + "id": 6352, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "3750:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6355, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3750:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint216", + "typeString": "type(uint216)" + } + }, + "id": 6356, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "3764:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "3750:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint216", + "typeString": "uint216" + } + }, + "src": "3742:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6364, + "nodeType": "IfStatement", + "src": "3738:105:20", + "trueBody": { + "id": 6363, + "nodeType": "Block", + "src": "3769:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323136", + "id": 6359, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3821:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_216_by_1", + "typeString": "int_const 216" + }, + "value": "216" + }, + { + "id": 6360, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6346, + "src": "3826:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_216_by_1", + "typeString": "int_const 216" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6358, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "3790:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6361, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3790:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6362, + "nodeType": "RevertStatement", + "src": "3783:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6367, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6346, + "src": "3867:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6366, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3859:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint216_$", + "typeString": "type(uint216)" + }, + "typeName": { + "id": 6365, + "name": "uint216", + "nodeType": "ElementaryTypeName", + "src": "3859:7:20", + "typeDescriptions": {} + } + }, + "id": 6368, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3859:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint216", + "typeString": "uint216" + } + }, + "functionReturnParameters": 6350, + "id": 6369, + "nodeType": "Return", + "src": "3852:21:20" + } + ] + }, + "documentation": { + "id": 6344, + "nodeType": "StructuredDocumentation", + "src": "3377:280:20", + "text": " @dev Returns the downcasted uint216 from uint256, reverting on\n overflow (when the input is greater than largest uint216).\n Counterpart to Solidity's `uint216` operator.\n Requirements:\n - input must fit into 216 bits" + }, + "id": 6371, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint216", + "nameLocation": "3671:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6347, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6346, + "mutability": "mutable", + "name": "value", + "nameLocation": "3689:5:20", + "nodeType": "VariableDeclaration", + "scope": 6371, + "src": "3681:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6345, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3681:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3680:15:20" + }, + "returnParameters": { + "id": 6350, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6349, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6371, + "src": "3719:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint216", + "typeString": "uint216" + }, + "typeName": { + "id": 6348, + "name": "uint216", + "nodeType": "ElementaryTypeName", + "src": "3719:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint216", + "typeString": "uint216" + } + }, + "visibility": "internal" + } + ], + "src": "3718:9:20" + }, + "scope": 7969, + "src": "3662:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6398, + "nodeType": "Block", + "src": "4237:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6385, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6379, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6374, + "src": "4251:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6382, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4264:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint208_$", + "typeString": "type(uint208)" + }, + "typeName": { + "id": 6381, + "name": "uint208", + "nodeType": "ElementaryTypeName", + "src": "4264:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint208_$", + "typeString": "type(uint208)" + } + ], + "id": 6380, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "4259:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6383, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4259:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint208", + "typeString": "type(uint208)" + } + }, + "id": 6384, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "4273:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "4259:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint208", + "typeString": "uint208" + } + }, + "src": "4251:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6392, + "nodeType": "IfStatement", + "src": "4247:105:20", + "trueBody": { + "id": 6391, + "nodeType": "Block", + "src": "4278:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323038", + "id": 6387, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4330:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_208_by_1", + "typeString": "int_const 208" + }, + "value": "208" + }, + { + "id": 6388, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6374, + "src": "4335:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_208_by_1", + "typeString": "int_const 208" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6386, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "4299:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6389, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4299:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6390, + "nodeType": "RevertStatement", + "src": "4292:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6395, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6374, + "src": "4376:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6394, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4368:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint208_$", + "typeString": "type(uint208)" + }, + "typeName": { + "id": 6393, + "name": "uint208", + "nodeType": "ElementaryTypeName", + "src": "4368:7:20", + "typeDescriptions": {} + } + }, + "id": 6396, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4368:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint208", + "typeString": "uint208" + } + }, + "functionReturnParameters": 6378, + "id": 6397, + "nodeType": "Return", + "src": "4361:21:20" + } + ] + }, + "documentation": { + "id": 6372, + "nodeType": "StructuredDocumentation", + "src": "3886:280:20", + "text": " @dev Returns the downcasted uint208 from uint256, reverting on\n overflow (when the input is greater than largest uint208).\n Counterpart to Solidity's `uint208` operator.\n Requirements:\n - input must fit into 208 bits" + }, + "id": 6399, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint208", + "nameLocation": "4180:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6375, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6374, + "mutability": "mutable", + "name": "value", + "nameLocation": "4198:5:20", + "nodeType": "VariableDeclaration", + "scope": 6399, + "src": "4190:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6373, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4190:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4189:15:20" + }, + "returnParameters": { + "id": 6378, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6377, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6399, + "src": "4228:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint208", + "typeString": "uint208" + }, + "typeName": { + "id": 6376, + "name": "uint208", + "nodeType": "ElementaryTypeName", + "src": "4228:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint208", + "typeString": "uint208" + } + }, + "visibility": "internal" + } + ], + "src": "4227:9:20" + }, + "scope": 7969, + "src": "4171:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6426, + "nodeType": "Block", + "src": "4746:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6413, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6407, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6402, + "src": "4760:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6410, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4773:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint200_$", + "typeString": "type(uint200)" + }, + "typeName": { + "id": 6409, + "name": "uint200", + "nodeType": "ElementaryTypeName", + "src": "4773:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint200_$", + "typeString": "type(uint200)" + } + ], + "id": 6408, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "4768:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6411, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4768:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint200", + "typeString": "type(uint200)" + } + }, + "id": 6412, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "4782:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "4768:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint200", + "typeString": "uint200" + } + }, + "src": "4760:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6420, + "nodeType": "IfStatement", + "src": "4756:105:20", + "trueBody": { + "id": 6419, + "nodeType": "Block", + "src": "4787:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323030", + "id": 6415, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4839:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_200_by_1", + "typeString": "int_const 200" + }, + "value": "200" + }, + { + "id": 6416, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6402, + "src": "4844:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_200_by_1", + "typeString": "int_const 200" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6414, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "4808:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6417, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4808:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6418, + "nodeType": "RevertStatement", + "src": "4801:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6423, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6402, + "src": "4885:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6422, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4877:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint200_$", + "typeString": "type(uint200)" + }, + "typeName": { + "id": 6421, + "name": "uint200", + "nodeType": "ElementaryTypeName", + "src": "4877:7:20", + "typeDescriptions": {} + } + }, + "id": 6424, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4877:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint200", + "typeString": "uint200" + } + }, + "functionReturnParameters": 6406, + "id": 6425, + "nodeType": "Return", + "src": "4870:21:20" + } + ] + }, + "documentation": { + "id": 6400, + "nodeType": "StructuredDocumentation", + "src": "4395:280:20", + "text": " @dev Returns the downcasted uint200 from uint256, reverting on\n overflow (when the input is greater than largest uint200).\n Counterpart to Solidity's `uint200` operator.\n Requirements:\n - input must fit into 200 bits" + }, + "id": 6427, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint200", + "nameLocation": "4689:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6403, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6402, + "mutability": "mutable", + "name": "value", + "nameLocation": "4707:5:20", + "nodeType": "VariableDeclaration", + "scope": 6427, + "src": "4699:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6401, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4699:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4698:15:20" + }, + "returnParameters": { + "id": 6406, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6405, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6427, + "src": "4737:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint200", + "typeString": "uint200" + }, + "typeName": { + "id": 6404, + "name": "uint200", + "nodeType": "ElementaryTypeName", + "src": "4737:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint200", + "typeString": "uint200" + } + }, + "visibility": "internal" + } + ], + "src": "4736:9:20" + }, + "scope": 7969, + "src": "4680:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6454, + "nodeType": "Block", + "src": "5255:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6441, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6435, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6430, + "src": "5269:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6438, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5282:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint192_$", + "typeString": "type(uint192)" + }, + "typeName": { + "id": 6437, + "name": "uint192", + "nodeType": "ElementaryTypeName", + "src": "5282:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint192_$", + "typeString": "type(uint192)" + } + ], + "id": 6436, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "5277:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6439, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5277:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint192", + "typeString": "type(uint192)" + } + }, + "id": 6440, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "5291:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "5277:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint192", + "typeString": "uint192" + } + }, + "src": "5269:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6448, + "nodeType": "IfStatement", + "src": "5265:105:20", + "trueBody": { + "id": 6447, + "nodeType": "Block", + "src": "5296:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313932", + "id": 6443, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5348:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_192_by_1", + "typeString": "int_const 192" + }, + "value": "192" + }, + { + "id": 6444, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6430, + "src": "5353:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_192_by_1", + "typeString": "int_const 192" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6442, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "5317:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6445, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5317:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6446, + "nodeType": "RevertStatement", + "src": "5310:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6451, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6430, + "src": "5394:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6450, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5386:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint192_$", + "typeString": "type(uint192)" + }, + "typeName": { + "id": 6449, + "name": "uint192", + "nodeType": "ElementaryTypeName", + "src": "5386:7:20", + "typeDescriptions": {} + } + }, + "id": 6452, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5386:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint192", + "typeString": "uint192" + } + }, + "functionReturnParameters": 6434, + "id": 6453, + "nodeType": "Return", + "src": "5379:21:20" + } + ] + }, + "documentation": { + "id": 6428, + "nodeType": "StructuredDocumentation", + "src": "4904:280:20", + "text": " @dev Returns the downcasted uint192 from uint256, reverting on\n overflow (when the input is greater than largest uint192).\n Counterpart to Solidity's `uint192` operator.\n Requirements:\n - input must fit into 192 bits" + }, + "id": 6455, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint192", + "nameLocation": "5198:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6431, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6430, + "mutability": "mutable", + "name": "value", + "nameLocation": "5216:5:20", + "nodeType": "VariableDeclaration", + "scope": 6455, + "src": "5208:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6429, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5208:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5207:15:20" + }, + "returnParameters": { + "id": 6434, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6433, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6455, + "src": "5246:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint192", + "typeString": "uint192" + }, + "typeName": { + "id": 6432, + "name": "uint192", + "nodeType": "ElementaryTypeName", + "src": "5246:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint192", + "typeString": "uint192" + } + }, + "visibility": "internal" + } + ], + "src": "5245:9:20" + }, + "scope": 7969, + "src": "5189:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6482, + "nodeType": "Block", + "src": "5764:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6469, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6463, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6458, + "src": "5778:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6466, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5791:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint184_$", + "typeString": "type(uint184)" + }, + "typeName": { + "id": 6465, + "name": "uint184", + "nodeType": "ElementaryTypeName", + "src": "5791:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint184_$", + "typeString": "type(uint184)" + } + ], + "id": 6464, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "5786:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6467, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5786:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint184", + "typeString": "type(uint184)" + } + }, + "id": 6468, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "5800:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "5786:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint184", + "typeString": "uint184" + } + }, + "src": "5778:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6476, + "nodeType": "IfStatement", + "src": "5774:105:20", + "trueBody": { + "id": 6475, + "nodeType": "Block", + "src": "5805:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313834", + "id": 6471, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5857:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_184_by_1", + "typeString": "int_const 184" + }, + "value": "184" + }, + { + "id": 6472, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6458, + "src": "5862:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_184_by_1", + "typeString": "int_const 184" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6470, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "5826:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6473, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5826:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6474, + "nodeType": "RevertStatement", + "src": "5819:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6479, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6458, + "src": "5903:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6478, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5895:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint184_$", + "typeString": "type(uint184)" + }, + "typeName": { + "id": 6477, + "name": "uint184", + "nodeType": "ElementaryTypeName", + "src": "5895:7:20", + "typeDescriptions": {} + } + }, + "id": 6480, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5895:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint184", + "typeString": "uint184" + } + }, + "functionReturnParameters": 6462, + "id": 6481, + "nodeType": "Return", + "src": "5888:21:20" + } + ] + }, + "documentation": { + "id": 6456, + "nodeType": "StructuredDocumentation", + "src": "5413:280:20", + "text": " @dev Returns the downcasted uint184 from uint256, reverting on\n overflow (when the input is greater than largest uint184).\n Counterpart to Solidity's `uint184` operator.\n Requirements:\n - input must fit into 184 bits" + }, + "id": 6483, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint184", + "nameLocation": "5707:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6459, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6458, + "mutability": "mutable", + "name": "value", + "nameLocation": "5725:5:20", + "nodeType": "VariableDeclaration", + "scope": 6483, + "src": "5717:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6457, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5717:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5716:15:20" + }, + "returnParameters": { + "id": 6462, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6461, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6483, + "src": "5755:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint184", + "typeString": "uint184" + }, + "typeName": { + "id": 6460, + "name": "uint184", + "nodeType": "ElementaryTypeName", + "src": "5755:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint184", + "typeString": "uint184" + } + }, + "visibility": "internal" + } + ], + "src": "5754:9:20" + }, + "scope": 7969, + "src": "5698:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6510, + "nodeType": "Block", + "src": "6273:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6497, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6491, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6486, + "src": "6287:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6494, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6300:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint176_$", + "typeString": "type(uint176)" + }, + "typeName": { + "id": 6493, + "name": "uint176", + "nodeType": "ElementaryTypeName", + "src": "6300:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint176_$", + "typeString": "type(uint176)" + } + ], + "id": 6492, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "6295:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6495, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6295:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint176", + "typeString": "type(uint176)" + } + }, + "id": 6496, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "6309:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "6295:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint176", + "typeString": "uint176" + } + }, + "src": "6287:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6504, + "nodeType": "IfStatement", + "src": "6283:105:20", + "trueBody": { + "id": 6503, + "nodeType": "Block", + "src": "6314:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313736", + "id": 6499, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6366:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_176_by_1", + "typeString": "int_const 176" + }, + "value": "176" + }, + { + "id": 6500, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6486, + "src": "6371:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_176_by_1", + "typeString": "int_const 176" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6498, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "6335:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6501, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6335:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6502, + "nodeType": "RevertStatement", + "src": "6328:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6507, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6486, + "src": "6412:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6506, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6404:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint176_$", + "typeString": "type(uint176)" + }, + "typeName": { + "id": 6505, + "name": "uint176", + "nodeType": "ElementaryTypeName", + "src": "6404:7:20", + "typeDescriptions": {} + } + }, + "id": 6508, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6404:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint176", + "typeString": "uint176" + } + }, + "functionReturnParameters": 6490, + "id": 6509, + "nodeType": "Return", + "src": "6397:21:20" + } + ] + }, + "documentation": { + "id": 6484, + "nodeType": "StructuredDocumentation", + "src": "5922:280:20", + "text": " @dev Returns the downcasted uint176 from uint256, reverting on\n overflow (when the input is greater than largest uint176).\n Counterpart to Solidity's `uint176` operator.\n Requirements:\n - input must fit into 176 bits" + }, + "id": 6511, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint176", + "nameLocation": "6216:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6487, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6486, + "mutability": "mutable", + "name": "value", + "nameLocation": "6234:5:20", + "nodeType": "VariableDeclaration", + "scope": 6511, + "src": "6226:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6485, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6226:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "6225:15:20" + }, + "returnParameters": { + "id": 6490, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6489, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6511, + "src": "6264:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint176", + "typeString": "uint176" + }, + "typeName": { + "id": 6488, + "name": "uint176", + "nodeType": "ElementaryTypeName", + "src": "6264:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint176", + "typeString": "uint176" + } + }, + "visibility": "internal" + } + ], + "src": "6263:9:20" + }, + "scope": 7969, + "src": "6207:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6538, + "nodeType": "Block", + "src": "6782:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6525, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6519, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6514, + "src": "6796:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6522, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6809:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint168_$", + "typeString": "type(uint168)" + }, + "typeName": { + "id": 6521, + "name": "uint168", + "nodeType": "ElementaryTypeName", + "src": "6809:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint168_$", + "typeString": "type(uint168)" + } + ], + "id": 6520, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "6804:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6523, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6804:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint168", + "typeString": "type(uint168)" + } + }, + "id": 6524, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "6818:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "6804:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint168", + "typeString": "uint168" + } + }, + "src": "6796:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6532, + "nodeType": "IfStatement", + "src": "6792:105:20", + "trueBody": { + "id": 6531, + "nodeType": "Block", + "src": "6823:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313638", + "id": 6527, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6875:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_168_by_1", + "typeString": "int_const 168" + }, + "value": "168" + }, + { + "id": 6528, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6514, + "src": "6880:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_168_by_1", + "typeString": "int_const 168" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6526, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "6844:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6529, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6844:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6530, + "nodeType": "RevertStatement", + "src": "6837:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6535, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6514, + "src": "6921:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6534, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6913:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint168_$", + "typeString": "type(uint168)" + }, + "typeName": { + "id": 6533, + "name": "uint168", + "nodeType": "ElementaryTypeName", + "src": "6913:7:20", + "typeDescriptions": {} + } + }, + "id": 6536, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6913:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint168", + "typeString": "uint168" + } + }, + "functionReturnParameters": 6518, + "id": 6537, + "nodeType": "Return", + "src": "6906:21:20" + } + ] + }, + "documentation": { + "id": 6512, + "nodeType": "StructuredDocumentation", + "src": "6431:280:20", + "text": " @dev Returns the downcasted uint168 from uint256, reverting on\n overflow (when the input is greater than largest uint168).\n Counterpart to Solidity's `uint168` operator.\n Requirements:\n - input must fit into 168 bits" + }, + "id": 6539, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint168", + "nameLocation": "6725:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6515, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6514, + "mutability": "mutable", + "name": "value", + "nameLocation": "6743:5:20", + "nodeType": "VariableDeclaration", + "scope": 6539, + "src": "6735:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6513, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6735:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "6734:15:20" + }, + "returnParameters": { + "id": 6518, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6517, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6539, + "src": "6773:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint168", + "typeString": "uint168" + }, + "typeName": { + "id": 6516, + "name": "uint168", + "nodeType": "ElementaryTypeName", + "src": "6773:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint168", + "typeString": "uint168" + } + }, + "visibility": "internal" + } + ], + "src": "6772:9:20" + }, + "scope": 7969, + "src": "6716:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6566, + "nodeType": "Block", + "src": "7291:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6553, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6547, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6542, + "src": "7305:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6550, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "7318:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint160_$", + "typeString": "type(uint160)" + }, + "typeName": { + "id": 6549, + "name": "uint160", + "nodeType": "ElementaryTypeName", + "src": "7318:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint160_$", + "typeString": "type(uint160)" + } + ], + "id": 6548, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "7313:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6551, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7313:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint160", + "typeString": "type(uint160)" + } + }, + "id": 6552, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "7327:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "7313:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint160", + "typeString": "uint160" + } + }, + "src": "7305:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6560, + "nodeType": "IfStatement", + "src": "7301:105:20", + "trueBody": { + "id": 6559, + "nodeType": "Block", + "src": "7332:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313630", + "id": 6555, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7384:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_160_by_1", + "typeString": "int_const 160" + }, + "value": "160" + }, + { + "id": 6556, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6542, + "src": "7389:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_160_by_1", + "typeString": "int_const 160" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6554, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "7353:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6557, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7353:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6558, + "nodeType": "RevertStatement", + "src": "7346:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6563, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6542, + "src": "7430:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6562, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "7422:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint160_$", + "typeString": "type(uint160)" + }, + "typeName": { + "id": 6561, + "name": "uint160", + "nodeType": "ElementaryTypeName", + "src": "7422:7:20", + "typeDescriptions": {} + } + }, + "id": 6564, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7422:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint160", + "typeString": "uint160" + } + }, + "functionReturnParameters": 6546, + "id": 6565, + "nodeType": "Return", + "src": "7415:21:20" + } + ] + }, + "documentation": { + "id": 6540, + "nodeType": "StructuredDocumentation", + "src": "6940:280:20", + "text": " @dev Returns the downcasted uint160 from uint256, reverting on\n overflow (when the input is greater than largest uint160).\n Counterpart to Solidity's `uint160` operator.\n Requirements:\n - input must fit into 160 bits" + }, + "id": 6567, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint160", + "nameLocation": "7234:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6543, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6542, + "mutability": "mutable", + "name": "value", + "nameLocation": "7252:5:20", + "nodeType": "VariableDeclaration", + "scope": 6567, + "src": "7244:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6541, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7244:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7243:15:20" + }, + "returnParameters": { + "id": 6546, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6545, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6567, + "src": "7282:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint160", + "typeString": "uint160" + }, + "typeName": { + "id": 6544, + "name": "uint160", + "nodeType": "ElementaryTypeName", + "src": "7282:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint160", + "typeString": "uint160" + } + }, + "visibility": "internal" + } + ], + "src": "7281:9:20" + }, + "scope": 7969, + "src": "7225:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6594, + "nodeType": "Block", + "src": "7800:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6581, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6575, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6570, + "src": "7814:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6578, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "7827:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint152_$", + "typeString": "type(uint152)" + }, + "typeName": { + "id": 6577, + "name": "uint152", + "nodeType": "ElementaryTypeName", + "src": "7827:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint152_$", + "typeString": "type(uint152)" + } + ], + "id": 6576, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "7822:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6579, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7822:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint152", + "typeString": "type(uint152)" + } + }, + "id": 6580, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "7836:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "7822:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint152", + "typeString": "uint152" + } + }, + "src": "7814:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6588, + "nodeType": "IfStatement", + "src": "7810:105:20", + "trueBody": { + "id": 6587, + "nodeType": "Block", + "src": "7841:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313532", + "id": 6583, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7893:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_152_by_1", + "typeString": "int_const 152" + }, + "value": "152" + }, + { + "id": 6584, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6570, + "src": "7898:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_152_by_1", + "typeString": "int_const 152" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6582, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "7862:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6585, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7862:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6586, + "nodeType": "RevertStatement", + "src": "7855:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6591, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6570, + "src": "7939:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6590, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "7931:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint152_$", + "typeString": "type(uint152)" + }, + "typeName": { + "id": 6589, + "name": "uint152", + "nodeType": "ElementaryTypeName", + "src": "7931:7:20", + "typeDescriptions": {} + } + }, + "id": 6592, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7931:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint152", + "typeString": "uint152" + } + }, + "functionReturnParameters": 6574, + "id": 6593, + "nodeType": "Return", + "src": "7924:21:20" + } + ] + }, + "documentation": { + "id": 6568, + "nodeType": "StructuredDocumentation", + "src": "7449:280:20", + "text": " @dev Returns the downcasted uint152 from uint256, reverting on\n overflow (when the input is greater than largest uint152).\n Counterpart to Solidity's `uint152` operator.\n Requirements:\n - input must fit into 152 bits" + }, + "id": 6595, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint152", + "nameLocation": "7743:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6571, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6570, + "mutability": "mutable", + "name": "value", + "nameLocation": "7761:5:20", + "nodeType": "VariableDeclaration", + "scope": 6595, + "src": "7753:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6569, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7753:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7752:15:20" + }, + "returnParameters": { + "id": 6574, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6573, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6595, + "src": "7791:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint152", + "typeString": "uint152" + }, + "typeName": { + "id": 6572, + "name": "uint152", + "nodeType": "ElementaryTypeName", + "src": "7791:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint152", + "typeString": "uint152" + } + }, + "visibility": "internal" + } + ], + "src": "7790:9:20" + }, + "scope": 7969, + "src": "7734:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6622, + "nodeType": "Block", + "src": "8309:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6609, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6603, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6598, + "src": "8323:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6606, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8336:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint144_$", + "typeString": "type(uint144)" + }, + "typeName": { + "id": 6605, + "name": "uint144", + "nodeType": "ElementaryTypeName", + "src": "8336:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint144_$", + "typeString": "type(uint144)" + } + ], + "id": 6604, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "8331:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6607, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8331:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint144", + "typeString": "type(uint144)" + } + }, + "id": 6608, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "8345:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "8331:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint144", + "typeString": "uint144" + } + }, + "src": "8323:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6616, + "nodeType": "IfStatement", + "src": "8319:105:20", + "trueBody": { + "id": 6615, + "nodeType": "Block", + "src": "8350:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313434", + "id": 6611, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8402:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_144_by_1", + "typeString": "int_const 144" + }, + "value": "144" + }, + { + "id": 6612, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6598, + "src": "8407:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_144_by_1", + "typeString": "int_const 144" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6610, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "8371:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6613, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8371:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6614, + "nodeType": "RevertStatement", + "src": "8364:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6619, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6598, + "src": "8448:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6618, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8440:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint144_$", + "typeString": "type(uint144)" + }, + "typeName": { + "id": 6617, + "name": "uint144", + "nodeType": "ElementaryTypeName", + "src": "8440:7:20", + "typeDescriptions": {} + } + }, + "id": 6620, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8440:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint144", + "typeString": "uint144" + } + }, + "functionReturnParameters": 6602, + "id": 6621, + "nodeType": "Return", + "src": "8433:21:20" + } + ] + }, + "documentation": { + "id": 6596, + "nodeType": "StructuredDocumentation", + "src": "7958:280:20", + "text": " @dev Returns the downcasted uint144 from uint256, reverting on\n overflow (when the input is greater than largest uint144).\n Counterpart to Solidity's `uint144` operator.\n Requirements:\n - input must fit into 144 bits" + }, + "id": 6623, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint144", + "nameLocation": "8252:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6599, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6598, + "mutability": "mutable", + "name": "value", + "nameLocation": "8270:5:20", + "nodeType": "VariableDeclaration", + "scope": 6623, + "src": "8262:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6597, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8262:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "8261:15:20" + }, + "returnParameters": { + "id": 6602, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6601, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6623, + "src": "8300:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint144", + "typeString": "uint144" + }, + "typeName": { + "id": 6600, + "name": "uint144", + "nodeType": "ElementaryTypeName", + "src": "8300:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint144", + "typeString": "uint144" + } + }, + "visibility": "internal" + } + ], + "src": "8299:9:20" + }, + "scope": 7969, + "src": "8243:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6650, + "nodeType": "Block", + "src": "8818:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6637, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6631, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6626, + "src": "8832:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6634, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8845:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint136_$", + "typeString": "type(uint136)" + }, + "typeName": { + "id": 6633, + "name": "uint136", + "nodeType": "ElementaryTypeName", + "src": "8845:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint136_$", + "typeString": "type(uint136)" + } + ], + "id": 6632, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "8840:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6635, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8840:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint136", + "typeString": "type(uint136)" + } + }, + "id": 6636, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "8854:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "8840:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint136", + "typeString": "uint136" + } + }, + "src": "8832:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6644, + "nodeType": "IfStatement", + "src": "8828:105:20", + "trueBody": { + "id": 6643, + "nodeType": "Block", + "src": "8859:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313336", + "id": 6639, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8911:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_136_by_1", + "typeString": "int_const 136" + }, + "value": "136" + }, + { + "id": 6640, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6626, + "src": "8916:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_136_by_1", + "typeString": "int_const 136" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6638, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "8880:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6641, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8880:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6642, + "nodeType": "RevertStatement", + "src": "8873:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6647, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6626, + "src": "8957:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6646, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8949:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint136_$", + "typeString": "type(uint136)" + }, + "typeName": { + "id": 6645, + "name": "uint136", + "nodeType": "ElementaryTypeName", + "src": "8949:7:20", + "typeDescriptions": {} + } + }, + "id": 6648, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8949:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint136", + "typeString": "uint136" + } + }, + "functionReturnParameters": 6630, + "id": 6649, + "nodeType": "Return", + "src": "8942:21:20" + } + ] + }, + "documentation": { + "id": 6624, + "nodeType": "StructuredDocumentation", + "src": "8467:280:20", + "text": " @dev Returns the downcasted uint136 from uint256, reverting on\n overflow (when the input is greater than largest uint136).\n Counterpart to Solidity's `uint136` operator.\n Requirements:\n - input must fit into 136 bits" + }, + "id": 6651, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint136", + "nameLocation": "8761:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6627, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6626, + "mutability": "mutable", + "name": "value", + "nameLocation": "8779:5:20", + "nodeType": "VariableDeclaration", + "scope": 6651, + "src": "8771:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6625, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8771:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "8770:15:20" + }, + "returnParameters": { + "id": 6630, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6629, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6651, + "src": "8809:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint136", + "typeString": "uint136" + }, + "typeName": { + "id": 6628, + "name": "uint136", + "nodeType": "ElementaryTypeName", + "src": "8809:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint136", + "typeString": "uint136" + } + }, + "visibility": "internal" + } + ], + "src": "8808:9:20" + }, + "scope": 7969, + "src": "8752:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6678, + "nodeType": "Block", + "src": "9327:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6665, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6659, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6654, + "src": "9341:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6662, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "9354:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint128_$", + "typeString": "type(uint128)" + }, + "typeName": { + "id": 6661, + "name": "uint128", + "nodeType": "ElementaryTypeName", + "src": "9354:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint128_$", + "typeString": "type(uint128)" + } + ], + "id": 6660, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "9349:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6663, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9349:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint128", + "typeString": "type(uint128)" + } + }, + "id": 6664, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "9363:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "9349:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint128", + "typeString": "uint128" + } + }, + "src": "9341:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6672, + "nodeType": "IfStatement", + "src": "9337:105:20", + "trueBody": { + "id": 6671, + "nodeType": "Block", + "src": "9368:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313238", + "id": 6667, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9420:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_128_by_1", + "typeString": "int_const 128" + }, + "value": "128" + }, + { + "id": 6668, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6654, + "src": "9425:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_128_by_1", + "typeString": "int_const 128" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6666, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "9389:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6669, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9389:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6670, + "nodeType": "RevertStatement", + "src": "9382:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6675, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6654, + "src": "9466:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6674, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "9458:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint128_$", + "typeString": "type(uint128)" + }, + "typeName": { + "id": 6673, + "name": "uint128", + "nodeType": "ElementaryTypeName", + "src": "9458:7:20", + "typeDescriptions": {} + } + }, + "id": 6676, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9458:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint128", + "typeString": "uint128" + } + }, + "functionReturnParameters": 6658, + "id": 6677, + "nodeType": "Return", + "src": "9451:21:20" + } + ] + }, + "documentation": { + "id": 6652, + "nodeType": "StructuredDocumentation", + "src": "8976:280:20", + "text": " @dev Returns the downcasted uint128 from uint256, reverting on\n overflow (when the input is greater than largest uint128).\n Counterpart to Solidity's `uint128` operator.\n Requirements:\n - input must fit into 128 bits" + }, + "id": 6679, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint128", + "nameLocation": "9270:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6655, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6654, + "mutability": "mutable", + "name": "value", + "nameLocation": "9288:5:20", + "nodeType": "VariableDeclaration", + "scope": 6679, + "src": "9280:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6653, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "9280:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "9279:15:20" + }, + "returnParameters": { + "id": 6658, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6657, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6679, + "src": "9318:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint128", + "typeString": "uint128" + }, + "typeName": { + "id": 6656, + "name": "uint128", + "nodeType": "ElementaryTypeName", + "src": "9318:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint128", + "typeString": "uint128" + } + }, + "visibility": "internal" + } + ], + "src": "9317:9:20" + }, + "scope": 7969, + "src": "9261:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6706, + "nodeType": "Block", + "src": "9836:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6693, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6687, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6682, + "src": "9850:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6690, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "9863:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint120_$", + "typeString": "type(uint120)" + }, + "typeName": { + "id": 6689, + "name": "uint120", + "nodeType": "ElementaryTypeName", + "src": "9863:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint120_$", + "typeString": "type(uint120)" + } + ], + "id": 6688, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "9858:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6691, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9858:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint120", + "typeString": "type(uint120)" + } + }, + "id": 6692, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "9872:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "9858:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint120", + "typeString": "uint120" + } + }, + "src": "9850:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6700, + "nodeType": "IfStatement", + "src": "9846:105:20", + "trueBody": { + "id": 6699, + "nodeType": "Block", + "src": "9877:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313230", + "id": 6695, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9929:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_120_by_1", + "typeString": "int_const 120" + }, + "value": "120" + }, + { + "id": 6696, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6682, + "src": "9934:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_120_by_1", + "typeString": "int_const 120" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6694, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "9898:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6697, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9898:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6698, + "nodeType": "RevertStatement", + "src": "9891:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6703, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6682, + "src": "9975:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6702, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "9967:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint120_$", + "typeString": "type(uint120)" + }, + "typeName": { + "id": 6701, + "name": "uint120", + "nodeType": "ElementaryTypeName", + "src": "9967:7:20", + "typeDescriptions": {} + } + }, + "id": 6704, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9967:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint120", + "typeString": "uint120" + } + }, + "functionReturnParameters": 6686, + "id": 6705, + "nodeType": "Return", + "src": "9960:21:20" + } + ] + }, + "documentation": { + "id": 6680, + "nodeType": "StructuredDocumentation", + "src": "9485:280:20", + "text": " @dev Returns the downcasted uint120 from uint256, reverting on\n overflow (when the input is greater than largest uint120).\n Counterpart to Solidity's `uint120` operator.\n Requirements:\n - input must fit into 120 bits" + }, + "id": 6707, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint120", + "nameLocation": "9779:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6683, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6682, + "mutability": "mutable", + "name": "value", + "nameLocation": "9797:5:20", + "nodeType": "VariableDeclaration", + "scope": 6707, + "src": "9789:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6681, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "9789:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "9788:15:20" + }, + "returnParameters": { + "id": 6686, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6685, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6707, + "src": "9827:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint120", + "typeString": "uint120" + }, + "typeName": { + "id": 6684, + "name": "uint120", + "nodeType": "ElementaryTypeName", + "src": "9827:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint120", + "typeString": "uint120" + } + }, + "visibility": "internal" + } + ], + "src": "9826:9:20" + }, + "scope": 7969, + "src": "9770:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6734, + "nodeType": "Block", + "src": "10345:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6721, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6715, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6710, + "src": "10359:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6718, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10372:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint112_$", + "typeString": "type(uint112)" + }, + "typeName": { + "id": 6717, + "name": "uint112", + "nodeType": "ElementaryTypeName", + "src": "10372:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint112_$", + "typeString": "type(uint112)" + } + ], + "id": 6716, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "10367:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6719, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10367:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint112", + "typeString": "type(uint112)" + } + }, + "id": 6720, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "10381:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "10367:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint112", + "typeString": "uint112" + } + }, + "src": "10359:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6728, + "nodeType": "IfStatement", + "src": "10355:105:20", + "trueBody": { + "id": 6727, + "nodeType": "Block", + "src": "10386:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313132", + "id": 6723, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10438:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_112_by_1", + "typeString": "int_const 112" + }, + "value": "112" + }, + { + "id": 6724, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6710, + "src": "10443:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_112_by_1", + "typeString": "int_const 112" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6722, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "10407:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6725, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10407:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6726, + "nodeType": "RevertStatement", + "src": "10400:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6731, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6710, + "src": "10484:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6730, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10476:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint112_$", + "typeString": "type(uint112)" + }, + "typeName": { + "id": 6729, + "name": "uint112", + "nodeType": "ElementaryTypeName", + "src": "10476:7:20", + "typeDescriptions": {} + } + }, + "id": 6732, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10476:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint112", + "typeString": "uint112" + } + }, + "functionReturnParameters": 6714, + "id": 6733, + "nodeType": "Return", + "src": "10469:21:20" + } + ] + }, + "documentation": { + "id": 6708, + "nodeType": "StructuredDocumentation", + "src": "9994:280:20", + "text": " @dev Returns the downcasted uint112 from uint256, reverting on\n overflow (when the input is greater than largest uint112).\n Counterpart to Solidity's `uint112` operator.\n Requirements:\n - input must fit into 112 bits" + }, + "id": 6735, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint112", + "nameLocation": "10288:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6711, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6710, + "mutability": "mutable", + "name": "value", + "nameLocation": "10306:5:20", + "nodeType": "VariableDeclaration", + "scope": 6735, + "src": "10298:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6709, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10298:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "10297:15:20" + }, + "returnParameters": { + "id": 6714, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6713, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6735, + "src": "10336:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint112", + "typeString": "uint112" + }, + "typeName": { + "id": 6712, + "name": "uint112", + "nodeType": "ElementaryTypeName", + "src": "10336:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint112", + "typeString": "uint112" + } + }, + "visibility": "internal" + } + ], + "src": "10335:9:20" + }, + "scope": 7969, + "src": "10279:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6762, + "nodeType": "Block", + "src": "10854:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6749, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6743, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6738, + "src": "10868:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6746, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10881:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint104_$", + "typeString": "type(uint104)" + }, + "typeName": { + "id": 6745, + "name": "uint104", + "nodeType": "ElementaryTypeName", + "src": "10881:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint104_$", + "typeString": "type(uint104)" + } + ], + "id": 6744, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "10876:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6747, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10876:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint104", + "typeString": "type(uint104)" + } + }, + "id": 6748, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "10890:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "10876:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint104", + "typeString": "uint104" + } + }, + "src": "10868:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6756, + "nodeType": "IfStatement", + "src": "10864:105:20", + "trueBody": { + "id": 6755, + "nodeType": "Block", + "src": "10895:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313034", + "id": 6751, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10947:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_104_by_1", + "typeString": "int_const 104" + }, + "value": "104" + }, + { + "id": 6752, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6738, + "src": "10952:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_104_by_1", + "typeString": "int_const 104" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6750, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "10916:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6753, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10916:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6754, + "nodeType": "RevertStatement", + "src": "10909:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6759, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6738, + "src": "10993:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6758, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10985:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint104_$", + "typeString": "type(uint104)" + }, + "typeName": { + "id": 6757, + "name": "uint104", + "nodeType": "ElementaryTypeName", + "src": "10985:7:20", + "typeDescriptions": {} + } + }, + "id": 6760, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10985:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint104", + "typeString": "uint104" + } + }, + "functionReturnParameters": 6742, + "id": 6761, + "nodeType": "Return", + "src": "10978:21:20" + } + ] + }, + "documentation": { + "id": 6736, + "nodeType": "StructuredDocumentation", + "src": "10503:280:20", + "text": " @dev Returns the downcasted uint104 from uint256, reverting on\n overflow (when the input is greater than largest uint104).\n Counterpart to Solidity's `uint104` operator.\n Requirements:\n - input must fit into 104 bits" + }, + "id": 6763, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint104", + "nameLocation": "10797:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6739, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6738, + "mutability": "mutable", + "name": "value", + "nameLocation": "10815:5:20", + "nodeType": "VariableDeclaration", + "scope": 6763, + "src": "10807:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6737, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10807:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "10806:15:20" + }, + "returnParameters": { + "id": 6742, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6741, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6763, + "src": "10845:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint104", + "typeString": "uint104" + }, + "typeName": { + "id": 6740, + "name": "uint104", + "nodeType": "ElementaryTypeName", + "src": "10845:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint104", + "typeString": "uint104" + } + }, + "visibility": "internal" + } + ], + "src": "10844:9:20" + }, + "scope": 7969, + "src": "10788:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6790, + "nodeType": "Block", + "src": "11357:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6777, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6771, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6766, + "src": "11371:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6774, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "11384:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint96_$", + "typeString": "type(uint96)" + }, + "typeName": { + "id": 6773, + "name": "uint96", + "nodeType": "ElementaryTypeName", + "src": "11384:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint96_$", + "typeString": "type(uint96)" + } + ], + "id": 6772, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "11379:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6775, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11379:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint96", + "typeString": "type(uint96)" + } + }, + "id": 6776, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "11392:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "11379:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint96", + "typeString": "uint96" + } + }, + "src": "11371:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6784, + "nodeType": "IfStatement", + "src": "11367:103:20", + "trueBody": { + "id": 6783, + "nodeType": "Block", + "src": "11397:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3936", + "id": 6779, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11449:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_96_by_1", + "typeString": "int_const 96" + }, + "value": "96" + }, + { + "id": 6780, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6766, + "src": "11453:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_96_by_1", + "typeString": "int_const 96" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6778, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "11418:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6781, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11418:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6782, + "nodeType": "RevertStatement", + "src": "11411:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6787, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6766, + "src": "11493:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6786, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "11486:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint96_$", + "typeString": "type(uint96)" + }, + "typeName": { + "id": 6785, + "name": "uint96", + "nodeType": "ElementaryTypeName", + "src": "11486:6:20", + "typeDescriptions": {} + } + }, + "id": 6788, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11486:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint96", + "typeString": "uint96" + } + }, + "functionReturnParameters": 6770, + "id": 6789, + "nodeType": "Return", + "src": "11479:20:20" + } + ] + }, + "documentation": { + "id": 6764, + "nodeType": "StructuredDocumentation", + "src": "11012:276:20", + "text": " @dev Returns the downcasted uint96 from uint256, reverting on\n overflow (when the input is greater than largest uint96).\n Counterpart to Solidity's `uint96` operator.\n Requirements:\n - input must fit into 96 bits" + }, + "id": 6791, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint96", + "nameLocation": "11302:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6767, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6766, + "mutability": "mutable", + "name": "value", + "nameLocation": "11319:5:20", + "nodeType": "VariableDeclaration", + "scope": 6791, + "src": "11311:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6765, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11311:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "11310:15:20" + }, + "returnParameters": { + "id": 6770, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6769, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6791, + "src": "11349:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint96", + "typeString": "uint96" + }, + "typeName": { + "id": 6768, + "name": "uint96", + "nodeType": "ElementaryTypeName", + "src": "11349:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint96", + "typeString": "uint96" + } + }, + "visibility": "internal" + } + ], + "src": "11348:8:20" + }, + "scope": 7969, + "src": "11293:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6818, + "nodeType": "Block", + "src": "11857:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6805, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6799, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6794, + "src": "11871:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6802, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "11884:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint88_$", + "typeString": "type(uint88)" + }, + "typeName": { + "id": 6801, + "name": "uint88", + "nodeType": "ElementaryTypeName", + "src": "11884:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint88_$", + "typeString": "type(uint88)" + } + ], + "id": 6800, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "11879:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6803, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11879:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint88", + "typeString": "type(uint88)" + } + }, + "id": 6804, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "11892:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "11879:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint88", + "typeString": "uint88" + } + }, + "src": "11871:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6812, + "nodeType": "IfStatement", + "src": "11867:103:20", + "trueBody": { + "id": 6811, + "nodeType": "Block", + "src": "11897:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3838", + "id": 6807, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11949:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_88_by_1", + "typeString": "int_const 88" + }, + "value": "88" + }, + { + "id": 6808, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6794, + "src": "11953:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_88_by_1", + "typeString": "int_const 88" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6806, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "11918:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6809, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11918:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6810, + "nodeType": "RevertStatement", + "src": "11911:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6815, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6794, + "src": "11993:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6814, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "11986:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint88_$", + "typeString": "type(uint88)" + }, + "typeName": { + "id": 6813, + "name": "uint88", + "nodeType": "ElementaryTypeName", + "src": "11986:6:20", + "typeDescriptions": {} + } + }, + "id": 6816, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11986:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint88", + "typeString": "uint88" + } + }, + "functionReturnParameters": 6798, + "id": 6817, + "nodeType": "Return", + "src": "11979:20:20" + } + ] + }, + "documentation": { + "id": 6792, + "nodeType": "StructuredDocumentation", + "src": "11512:276:20", + "text": " @dev Returns the downcasted uint88 from uint256, reverting on\n overflow (when the input is greater than largest uint88).\n Counterpart to Solidity's `uint88` operator.\n Requirements:\n - input must fit into 88 bits" + }, + "id": 6819, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint88", + "nameLocation": "11802:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6795, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6794, + "mutability": "mutable", + "name": "value", + "nameLocation": "11819:5:20", + "nodeType": "VariableDeclaration", + "scope": 6819, + "src": "11811:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6793, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11811:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "11810:15:20" + }, + "returnParameters": { + "id": 6798, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6797, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6819, + "src": "11849:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint88", + "typeString": "uint88" + }, + "typeName": { + "id": 6796, + "name": "uint88", + "nodeType": "ElementaryTypeName", + "src": "11849:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint88", + "typeString": "uint88" + } + }, + "visibility": "internal" + } + ], + "src": "11848:8:20" + }, + "scope": 7969, + "src": "11793:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6846, + "nodeType": "Block", + "src": "12357:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6833, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6827, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6822, + "src": "12371:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6830, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "12384:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint80_$", + "typeString": "type(uint80)" + }, + "typeName": { + "id": 6829, + "name": "uint80", + "nodeType": "ElementaryTypeName", + "src": "12384:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint80_$", + "typeString": "type(uint80)" + } + ], + "id": 6828, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "12379:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6831, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12379:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint80", + "typeString": "type(uint80)" + } + }, + "id": 6832, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "12392:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "12379:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint80", + "typeString": "uint80" + } + }, + "src": "12371:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6840, + "nodeType": "IfStatement", + "src": "12367:103:20", + "trueBody": { + "id": 6839, + "nodeType": "Block", + "src": "12397:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3830", + "id": 6835, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12449:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_80_by_1", + "typeString": "int_const 80" + }, + "value": "80" + }, + { + "id": 6836, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6822, + "src": "12453:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_80_by_1", + "typeString": "int_const 80" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6834, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "12418:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6837, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12418:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6838, + "nodeType": "RevertStatement", + "src": "12411:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6843, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6822, + "src": "12493:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6842, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "12486:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint80_$", + "typeString": "type(uint80)" + }, + "typeName": { + "id": 6841, + "name": "uint80", + "nodeType": "ElementaryTypeName", + "src": "12486:6:20", + "typeDescriptions": {} + } + }, + "id": 6844, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12486:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint80", + "typeString": "uint80" + } + }, + "functionReturnParameters": 6826, + "id": 6845, + "nodeType": "Return", + "src": "12479:20:20" + } + ] + }, + "documentation": { + "id": 6820, + "nodeType": "StructuredDocumentation", + "src": "12012:276:20", + "text": " @dev Returns the downcasted uint80 from uint256, reverting on\n overflow (when the input is greater than largest uint80).\n Counterpart to Solidity's `uint80` operator.\n Requirements:\n - input must fit into 80 bits" + }, + "id": 6847, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint80", + "nameLocation": "12302:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6823, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6822, + "mutability": "mutable", + "name": "value", + "nameLocation": "12319:5:20", + "nodeType": "VariableDeclaration", + "scope": 6847, + "src": "12311:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6821, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12311:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "12310:15:20" + }, + "returnParameters": { + "id": 6826, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6825, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6847, + "src": "12349:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint80", + "typeString": "uint80" + }, + "typeName": { + "id": 6824, + "name": "uint80", + "nodeType": "ElementaryTypeName", + "src": "12349:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint80", + "typeString": "uint80" + } + }, + "visibility": "internal" + } + ], + "src": "12348:8:20" + }, + "scope": 7969, + "src": "12293:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6874, + "nodeType": "Block", + "src": "12857:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6861, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6855, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6850, + "src": "12871:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6858, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "12884:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint72_$", + "typeString": "type(uint72)" + }, + "typeName": { + "id": 6857, + "name": "uint72", + "nodeType": "ElementaryTypeName", + "src": "12884:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint72_$", + "typeString": "type(uint72)" + } + ], + "id": 6856, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "12879:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6859, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12879:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint72", + "typeString": "type(uint72)" + } + }, + "id": 6860, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "12892:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "12879:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint72", + "typeString": "uint72" + } + }, + "src": "12871:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6868, + "nodeType": "IfStatement", + "src": "12867:103:20", + "trueBody": { + "id": 6867, + "nodeType": "Block", + "src": "12897:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3732", + "id": 6863, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12949:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_72_by_1", + "typeString": "int_const 72" + }, + "value": "72" + }, + { + "id": 6864, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6850, + "src": "12953:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_72_by_1", + "typeString": "int_const 72" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6862, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "12918:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6865, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12918:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6866, + "nodeType": "RevertStatement", + "src": "12911:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6871, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6850, + "src": "12993:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6870, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "12986:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint72_$", + "typeString": "type(uint72)" + }, + "typeName": { + "id": 6869, + "name": "uint72", + "nodeType": "ElementaryTypeName", + "src": "12986:6:20", + "typeDescriptions": {} + } + }, + "id": 6872, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12986:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint72", + "typeString": "uint72" + } + }, + "functionReturnParameters": 6854, + "id": 6873, + "nodeType": "Return", + "src": "12979:20:20" + } + ] + }, + "documentation": { + "id": 6848, + "nodeType": "StructuredDocumentation", + "src": "12512:276:20", + "text": " @dev Returns the downcasted uint72 from uint256, reverting on\n overflow (when the input is greater than largest uint72).\n Counterpart to Solidity's `uint72` operator.\n Requirements:\n - input must fit into 72 bits" + }, + "id": 6875, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint72", + "nameLocation": "12802:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6851, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6850, + "mutability": "mutable", + "name": "value", + "nameLocation": "12819:5:20", + "nodeType": "VariableDeclaration", + "scope": 6875, + "src": "12811:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6849, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12811:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "12810:15:20" + }, + "returnParameters": { + "id": 6854, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6853, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6875, + "src": "12849:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint72", + "typeString": "uint72" + }, + "typeName": { + "id": 6852, + "name": "uint72", + "nodeType": "ElementaryTypeName", + "src": "12849:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint72", + "typeString": "uint72" + } + }, + "visibility": "internal" + } + ], + "src": "12848:8:20" + }, + "scope": 7969, + "src": "12793:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6902, + "nodeType": "Block", + "src": "13357:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6889, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6883, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6878, + "src": "13371:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6886, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "13384:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint64_$", + "typeString": "type(uint64)" + }, + "typeName": { + "id": 6885, + "name": "uint64", + "nodeType": "ElementaryTypeName", + "src": "13384:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint64_$", + "typeString": "type(uint64)" + } + ], + "id": 6884, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "13379:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6887, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13379:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint64", + "typeString": "type(uint64)" + } + }, + "id": 6888, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "13392:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "13379:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint64", + "typeString": "uint64" + } + }, + "src": "13371:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6896, + "nodeType": "IfStatement", + "src": "13367:103:20", + "trueBody": { + "id": 6895, + "nodeType": "Block", + "src": "13397:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3634", + "id": 6891, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13449:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + { + "id": 6892, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6878, + "src": "13453:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6890, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "13418:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6893, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13418:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6894, + "nodeType": "RevertStatement", + "src": "13411:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6899, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6878, + "src": "13493:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6898, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "13486:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint64_$", + "typeString": "type(uint64)" + }, + "typeName": { + "id": 6897, + "name": "uint64", + "nodeType": "ElementaryTypeName", + "src": "13486:6:20", + "typeDescriptions": {} + } + }, + "id": 6900, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13486:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint64", + "typeString": "uint64" + } + }, + "functionReturnParameters": 6882, + "id": 6901, + "nodeType": "Return", + "src": "13479:20:20" + } + ] + }, + "documentation": { + "id": 6876, + "nodeType": "StructuredDocumentation", + "src": "13012:276:20", + "text": " @dev Returns the downcasted uint64 from uint256, reverting on\n overflow (when the input is greater than largest uint64).\n Counterpart to Solidity's `uint64` operator.\n Requirements:\n - input must fit into 64 bits" + }, + "id": 6903, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint64", + "nameLocation": "13302:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6879, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6878, + "mutability": "mutable", + "name": "value", + "nameLocation": "13319:5:20", + "nodeType": "VariableDeclaration", + "scope": 6903, + "src": "13311:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6877, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13311:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "13310:15:20" + }, + "returnParameters": { + "id": 6882, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6881, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6903, + "src": "13349:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint64", + "typeString": "uint64" + }, + "typeName": { + "id": 6880, + "name": "uint64", + "nodeType": "ElementaryTypeName", + "src": "13349:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint64", + "typeString": "uint64" + } + }, + "visibility": "internal" + } + ], + "src": "13348:8:20" + }, + "scope": 7969, + "src": "13293:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6930, + "nodeType": "Block", + "src": "13857:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6917, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6911, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6906, + "src": "13871:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6914, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "13884:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint56_$", + "typeString": "type(uint56)" + }, + "typeName": { + "id": 6913, + "name": "uint56", + "nodeType": "ElementaryTypeName", + "src": "13884:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint56_$", + "typeString": "type(uint56)" + } + ], + "id": 6912, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "13879:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6915, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13879:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint56", + "typeString": "type(uint56)" + } + }, + "id": 6916, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "13892:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "13879:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint56", + "typeString": "uint56" + } + }, + "src": "13871:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6924, + "nodeType": "IfStatement", + "src": "13867:103:20", + "trueBody": { + "id": 6923, + "nodeType": "Block", + "src": "13897:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3536", + "id": 6919, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13949:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_56_by_1", + "typeString": "int_const 56" + }, + "value": "56" + }, + { + "id": 6920, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6906, + "src": "13953:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_56_by_1", + "typeString": "int_const 56" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6918, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "13918:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6921, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13918:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6922, + "nodeType": "RevertStatement", + "src": "13911:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6927, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6906, + "src": "13993:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6926, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "13986:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint56_$", + "typeString": "type(uint56)" + }, + "typeName": { + "id": 6925, + "name": "uint56", + "nodeType": "ElementaryTypeName", + "src": "13986:6:20", + "typeDescriptions": {} + } + }, + "id": 6928, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13986:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint56", + "typeString": "uint56" + } + }, + "functionReturnParameters": 6910, + "id": 6929, + "nodeType": "Return", + "src": "13979:20:20" + } + ] + }, + "documentation": { + "id": 6904, + "nodeType": "StructuredDocumentation", + "src": "13512:276:20", + "text": " @dev Returns the downcasted uint56 from uint256, reverting on\n overflow (when the input is greater than largest uint56).\n Counterpart to Solidity's `uint56` operator.\n Requirements:\n - input must fit into 56 bits" + }, + "id": 6931, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint56", + "nameLocation": "13802:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6907, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6906, + "mutability": "mutable", + "name": "value", + "nameLocation": "13819:5:20", + "nodeType": "VariableDeclaration", + "scope": 6931, + "src": "13811:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6905, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13811:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "13810:15:20" + }, + "returnParameters": { + "id": 6910, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6909, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6931, + "src": "13849:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint56", + "typeString": "uint56" + }, + "typeName": { + "id": 6908, + "name": "uint56", + "nodeType": "ElementaryTypeName", + "src": "13849:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint56", + "typeString": "uint56" + } + }, + "visibility": "internal" + } + ], + "src": "13848:8:20" + }, + "scope": 7969, + "src": "13793:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6958, + "nodeType": "Block", + "src": "14357:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6945, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6939, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6934, + "src": "14371:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6942, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "14384:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint48_$", + "typeString": "type(uint48)" + }, + "typeName": { + "id": 6941, + "name": "uint48", + "nodeType": "ElementaryTypeName", + "src": "14384:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint48_$", + "typeString": "type(uint48)" + } + ], + "id": 6940, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "14379:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6943, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14379:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint48", + "typeString": "type(uint48)" + } + }, + "id": 6944, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "14392:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "14379:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint48", + "typeString": "uint48" + } + }, + "src": "14371:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6952, + "nodeType": "IfStatement", + "src": "14367:103:20", + "trueBody": { + "id": 6951, + "nodeType": "Block", + "src": "14397:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3438", + "id": 6947, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14449:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_48_by_1", + "typeString": "int_const 48" + }, + "value": "48" + }, + { + "id": 6948, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6934, + "src": "14453:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_48_by_1", + "typeString": "int_const 48" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6946, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "14418:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6949, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14418:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6950, + "nodeType": "RevertStatement", + "src": "14411:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6955, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6934, + "src": "14493:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6954, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "14486:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint48_$", + "typeString": "type(uint48)" + }, + "typeName": { + "id": 6953, + "name": "uint48", + "nodeType": "ElementaryTypeName", + "src": "14486:6:20", + "typeDescriptions": {} + } + }, + "id": 6956, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14486:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint48", + "typeString": "uint48" + } + }, + "functionReturnParameters": 6938, + "id": 6957, + "nodeType": "Return", + "src": "14479:20:20" + } + ] + }, + "documentation": { + "id": 6932, + "nodeType": "StructuredDocumentation", + "src": "14012:276:20", + "text": " @dev Returns the downcasted uint48 from uint256, reverting on\n overflow (when the input is greater than largest uint48).\n Counterpart to Solidity's `uint48` operator.\n Requirements:\n - input must fit into 48 bits" + }, + "id": 6959, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint48", + "nameLocation": "14302:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6935, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6934, + "mutability": "mutable", + "name": "value", + "nameLocation": "14319:5:20", + "nodeType": "VariableDeclaration", + "scope": 6959, + "src": "14311:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6933, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "14311:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "14310:15:20" + }, + "returnParameters": { + "id": 6938, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6937, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6959, + "src": "14349:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint48", + "typeString": "uint48" + }, + "typeName": { + "id": 6936, + "name": "uint48", + "nodeType": "ElementaryTypeName", + "src": "14349:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint48", + "typeString": "uint48" + } + }, + "visibility": "internal" + } + ], + "src": "14348:8:20" + }, + "scope": 7969, + "src": "14293:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6986, + "nodeType": "Block", + "src": "14857:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6973, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6967, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6962, + "src": "14871:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6970, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "14884:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint40_$", + "typeString": "type(uint40)" + }, + "typeName": { + "id": 6969, + "name": "uint40", + "nodeType": "ElementaryTypeName", + "src": "14884:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint40_$", + "typeString": "type(uint40)" + } + ], + "id": 6968, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "14879:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6971, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14879:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint40", + "typeString": "type(uint40)" + } + }, + "id": 6972, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "14892:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "14879:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint40", + "typeString": "uint40" + } + }, + "src": "14871:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6980, + "nodeType": "IfStatement", + "src": "14867:103:20", + "trueBody": { + "id": 6979, + "nodeType": "Block", + "src": "14897:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3430", + "id": 6975, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14949:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_40_by_1", + "typeString": "int_const 40" + }, + "value": "40" + }, + { + "id": 6976, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6962, + "src": "14953:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_40_by_1", + "typeString": "int_const 40" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6974, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "14918:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6977, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14918:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6978, + "nodeType": "RevertStatement", + "src": "14911:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6983, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6962, + "src": "14993:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6982, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "14986:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint40_$", + "typeString": "type(uint40)" + }, + "typeName": { + "id": 6981, + "name": "uint40", + "nodeType": "ElementaryTypeName", + "src": "14986:6:20", + "typeDescriptions": {} + } + }, + "id": 6984, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14986:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint40", + "typeString": "uint40" + } + }, + "functionReturnParameters": 6966, + "id": 6985, + "nodeType": "Return", + "src": "14979:20:20" + } + ] + }, + "documentation": { + "id": 6960, + "nodeType": "StructuredDocumentation", + "src": "14512:276:20", + "text": " @dev Returns the downcasted uint40 from uint256, reverting on\n overflow (when the input is greater than largest uint40).\n Counterpart to Solidity's `uint40` operator.\n Requirements:\n - input must fit into 40 bits" + }, + "id": 6987, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint40", + "nameLocation": "14802:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6963, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6962, + "mutability": "mutable", + "name": "value", + "nameLocation": "14819:5:20", + "nodeType": "VariableDeclaration", + "scope": 6987, + "src": "14811:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6961, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "14811:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "14810:15:20" + }, + "returnParameters": { + "id": 6966, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6965, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6987, + "src": "14849:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint40", + "typeString": "uint40" + }, + "typeName": { + "id": 6964, + "name": "uint40", + "nodeType": "ElementaryTypeName", + "src": "14849:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint40", + "typeString": "uint40" + } + }, + "visibility": "internal" + } + ], + "src": "14848:8:20" + }, + "scope": 7969, + "src": "14793:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7014, + "nodeType": "Block", + "src": "15357:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 7001, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6995, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6990, + "src": "15371:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6998, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "15384:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint32_$", + "typeString": "type(uint32)" + }, + "typeName": { + "id": 6997, + "name": "uint32", + "nodeType": "ElementaryTypeName", + "src": "15384:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint32_$", + "typeString": "type(uint32)" + } + ], + "id": 6996, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "15379:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6999, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15379:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint32", + "typeString": "type(uint32)" + } + }, + "id": 7000, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "15392:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "15379:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint32", + "typeString": "uint32" + } + }, + "src": "15371:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7008, + "nodeType": "IfStatement", + "src": "15367:103:20", + "trueBody": { + "id": 7007, + "nodeType": "Block", + "src": "15397:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3332", + "id": 7003, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "15449:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + { + "id": 7004, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6990, + "src": "15453:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7002, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "15418:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 7005, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15418:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7006, + "nodeType": "RevertStatement", + "src": "15411:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 7011, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6990, + "src": "15493:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7010, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "15486:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint32_$", + "typeString": "type(uint32)" + }, + "typeName": { + "id": 7009, + "name": "uint32", + "nodeType": "ElementaryTypeName", + "src": "15486:6:20", + "typeDescriptions": {} + } + }, + "id": 7012, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15486:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint32", + "typeString": "uint32" + } + }, + "functionReturnParameters": 6994, + "id": 7013, + "nodeType": "Return", + "src": "15479:20:20" + } + ] + }, + "documentation": { + "id": 6988, + "nodeType": "StructuredDocumentation", + "src": "15012:276:20", + "text": " @dev Returns the downcasted uint32 from uint256, reverting on\n overflow (when the input is greater than largest uint32).\n Counterpart to Solidity's `uint32` operator.\n Requirements:\n - input must fit into 32 bits" + }, + "id": 7015, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint32", + "nameLocation": "15302:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6991, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6990, + "mutability": "mutable", + "name": "value", + "nameLocation": "15319:5:20", + "nodeType": "VariableDeclaration", + "scope": 7015, + "src": "15311:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6989, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "15311:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "15310:15:20" + }, + "returnParameters": { + "id": 6994, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6993, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 7015, + "src": "15349:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint32", + "typeString": "uint32" + }, + "typeName": { + "id": 6992, + "name": "uint32", + "nodeType": "ElementaryTypeName", + "src": "15349:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint32", + "typeString": "uint32" + } + }, + "visibility": "internal" + } + ], + "src": "15348:8:20" + }, + "scope": 7969, + "src": "15293:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7042, + "nodeType": "Block", + "src": "15857:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 7029, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7023, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7018, + "src": "15871:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 7026, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "15884:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint24_$", + "typeString": "type(uint24)" + }, + "typeName": { + "id": 7025, + "name": "uint24", + "nodeType": "ElementaryTypeName", + "src": "15884:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint24_$", + "typeString": "type(uint24)" + } + ], + "id": 7024, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "15879:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 7027, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15879:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint24", + "typeString": "type(uint24)" + } + }, + "id": 7028, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "15892:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "15879:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint24", + "typeString": "uint24" + } + }, + "src": "15871:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7036, + "nodeType": "IfStatement", + "src": "15867:103:20", + "trueBody": { + "id": 7035, + "nodeType": "Block", + "src": "15897:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3234", + "id": 7031, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "15949:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_24_by_1", + "typeString": "int_const 24" + }, + "value": "24" + }, + { + "id": 7032, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7018, + "src": "15953:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_24_by_1", + "typeString": "int_const 24" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7030, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "15918:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 7033, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15918:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7034, + "nodeType": "RevertStatement", + "src": "15911:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 7039, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7018, + "src": "15993:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7038, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "15986:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint24_$", + "typeString": "type(uint24)" + }, + "typeName": { + "id": 7037, + "name": "uint24", + "nodeType": "ElementaryTypeName", + "src": "15986:6:20", + "typeDescriptions": {} + } + }, + "id": 7040, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15986:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint24", + "typeString": "uint24" + } + }, + "functionReturnParameters": 7022, + "id": 7041, + "nodeType": "Return", + "src": "15979:20:20" + } + ] + }, + "documentation": { + "id": 7016, + "nodeType": "StructuredDocumentation", + "src": "15512:276:20", + "text": " @dev Returns the downcasted uint24 from uint256, reverting on\n overflow (when the input is greater than largest uint24).\n Counterpart to Solidity's `uint24` operator.\n Requirements:\n - input must fit into 24 bits" + }, + "id": 7043, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint24", + "nameLocation": "15802:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7019, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7018, + "mutability": "mutable", + "name": "value", + "nameLocation": "15819:5:20", + "nodeType": "VariableDeclaration", + "scope": 7043, + "src": "15811:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 7017, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "15811:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "15810:15:20" + }, + "returnParameters": { + "id": 7022, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7021, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 7043, + "src": "15849:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint24", + "typeString": "uint24" + }, + "typeName": { + "id": 7020, + "name": "uint24", + "nodeType": "ElementaryTypeName", + "src": "15849:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint24", + "typeString": "uint24" + } + }, + "visibility": "internal" + } + ], + "src": "15848:8:20" + }, + "scope": 7969, + "src": "15793:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7070, + "nodeType": "Block", + "src": "16357:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 7057, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7051, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7046, + "src": "16371:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 7054, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16384:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint16_$", + "typeString": "type(uint16)" + }, + "typeName": { + "id": 7053, + "name": "uint16", + "nodeType": "ElementaryTypeName", + "src": "16384:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint16_$", + "typeString": "type(uint16)" + } + ], + "id": 7052, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "16379:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 7055, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16379:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint16", + "typeString": "type(uint16)" + } + }, + "id": 7056, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "16392:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "16379:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint16", + "typeString": "uint16" + } + }, + "src": "16371:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7064, + "nodeType": "IfStatement", + "src": "16367:103:20", + "trueBody": { + "id": 7063, + "nodeType": "Block", + "src": "16397:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3136", + "id": 7059, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16449:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + { + "id": 7060, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7046, + "src": "16453:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7058, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "16418:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 7061, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16418:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7062, + "nodeType": "RevertStatement", + "src": "16411:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 7067, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7046, + "src": "16493:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7066, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16486:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint16_$", + "typeString": "type(uint16)" + }, + "typeName": { + "id": 7065, + "name": "uint16", + "nodeType": "ElementaryTypeName", + "src": "16486:6:20", + "typeDescriptions": {} + } + }, + "id": 7068, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16486:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint16", + "typeString": "uint16" + } + }, + "functionReturnParameters": 7050, + "id": 7069, + "nodeType": "Return", + "src": "16479:20:20" + } + ] + }, + "documentation": { + "id": 7044, + "nodeType": "StructuredDocumentation", + "src": "16012:276:20", + "text": " @dev Returns the downcasted uint16 from uint256, reverting on\n overflow (when the input is greater than largest uint16).\n Counterpart to Solidity's `uint16` operator.\n Requirements:\n - input must fit into 16 bits" + }, + "id": 7071, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint16", + "nameLocation": "16302:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7047, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7046, + "mutability": "mutable", + "name": "value", + "nameLocation": "16319:5:20", + "nodeType": "VariableDeclaration", + "scope": 7071, + "src": "16311:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 7045, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "16311:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "16310:15:20" + }, + "returnParameters": { + "id": 7050, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7049, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 7071, + "src": "16349:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint16", + "typeString": "uint16" + }, + "typeName": { + "id": 7048, + "name": "uint16", + "nodeType": "ElementaryTypeName", + "src": "16349:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint16", + "typeString": "uint16" + } + }, + "visibility": "internal" + } + ], + "src": "16348:8:20" + }, + "scope": 7969, + "src": "16293:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7098, + "nodeType": "Block", + "src": "16851:146:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 7085, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7079, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7074, + "src": "16865:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 7082, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16878:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": { + "id": 7081, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "16878:5:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + } + ], + "id": 7080, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "16873:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 7083, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16873:11:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint8", + "typeString": "type(uint8)" + } + }, + "id": 7084, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "16885:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "16873:15:20", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "src": "16865:23:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7092, + "nodeType": "IfStatement", + "src": "16861:101:20", + "trueBody": { + "id": 7091, + "nodeType": "Block", + "src": "16890:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "38", + "id": 7087, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16942:1:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + { + "id": 7088, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7074, + "src": "16945:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7086, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "16911:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 7089, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16911:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7090, + "nodeType": "RevertStatement", + "src": "16904:47:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 7095, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7074, + "src": "16984:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7094, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16978:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": { + "id": 7093, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "16978:5:20", + "typeDescriptions": {} + } + }, + "id": 7096, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16978:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "functionReturnParameters": 7078, + "id": 7097, + "nodeType": "Return", + "src": "16971:19:20" + } + ] + }, + "documentation": { + "id": 7072, + "nodeType": "StructuredDocumentation", + "src": "16512:272:20", + "text": " @dev Returns the downcasted uint8 from uint256, reverting on\n overflow (when the input is greater than largest uint8).\n Counterpart to Solidity's `uint8` operator.\n Requirements:\n - input must fit into 8 bits" + }, + "id": 7099, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint8", + "nameLocation": "16798:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7075, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7074, + "mutability": "mutable", + "name": "value", + "nameLocation": "16814:5:20", + "nodeType": "VariableDeclaration", + "scope": 7099, + "src": "16806:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 7073, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "16806:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "16805:15:20" + }, + "returnParameters": { + "id": 7078, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7077, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 7099, + "src": "16844:5:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 7076, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "16844:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "src": "16843:7:20" + }, + "scope": 7969, + "src": "16789:208:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7121, + "nodeType": "Block", + "src": "17233:128:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7109, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7107, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7102, + "src": "17247:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "hexValue": "30", + "id": 7108, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17255:1:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "17247:9:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7115, + "nodeType": "IfStatement", + "src": "17243:81:20", + "trueBody": { + "id": 7114, + "nodeType": "Block", + "src": "17258:66:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "id": 7111, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7102, + "src": "17307:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7110, + "name": "SafeCastOverflowedIntToUint", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6219, + "src": "17279:27:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_int256_$returns$_t_error_$", + "typeString": "function (int256) pure returns (error)" + } + }, + "id": 7112, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "17279:34:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7113, + "nodeType": "RevertStatement", + "src": "17272:41:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 7118, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7102, + "src": "17348:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7117, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "17340:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 7116, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "17340:7:20", + "typeDescriptions": {} + } + }, + "id": 7119, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "17340:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 7106, + "id": 7120, + "nodeType": "Return", + "src": "17333:21:20" + } + ] + }, + "documentation": { + "id": 7100, + "nodeType": "StructuredDocumentation", + "src": "17003:160:20", + "text": " @dev Converts a signed int256 into an unsigned uint256.\n Requirements:\n - input must be greater than or equal to 0." + }, + "id": 7122, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint256", + "nameLocation": "17177:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7103, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7102, + "mutability": "mutable", + "name": "value", + "nameLocation": "17194:5:20", + "nodeType": "VariableDeclaration", + "scope": 7122, + "src": "17187:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7101, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "17187:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "17186:14:20" + }, + "returnParameters": { + "id": 7106, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7105, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 7122, + "src": "17224:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 7104, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "17224:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "17223:9:20" + }, + "scope": 7969, + "src": "17168:193:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7147, + "nodeType": "Block", + "src": "17758:150:20", + "statements": [ + { + "expression": { + "id": 7135, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7130, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7128, + "src": "17768:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int248", + "typeString": "int248" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7133, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7125, + "src": "17788:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7132, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "17781:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int248_$", + "typeString": "type(int248)" + }, + "typeName": { + "id": 7131, + "name": "int248", + "nodeType": "ElementaryTypeName", + "src": "17781:6:20", + "typeDescriptions": {} + } + }, + "id": 7134, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "17781:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int248", + "typeString": "int248" + } + }, + "src": "17768:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int248", + "typeString": "int248" + } + }, + "id": 7136, + "nodeType": "ExpressionStatement", + "src": "17768:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7139, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7137, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7128, + "src": "17808:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int248", + "typeString": "int248" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7138, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7125, + "src": "17822:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "17808:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7146, + "nodeType": "IfStatement", + "src": "17804:98:20", + "trueBody": { + "id": 7145, + "nodeType": "Block", + "src": "17829:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323438", + "id": 7141, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17880:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_248_by_1", + "typeString": "int_const 248" + }, + "value": "248" + }, + { + "id": 7142, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7125, + "src": "17885:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_248_by_1", + "typeString": "int_const 248" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7140, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "17850:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7143, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "17850:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7144, + "nodeType": "RevertStatement", + "src": "17843:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7123, + "nodeType": "StructuredDocumentation", + "src": "17367:312:20", + "text": " @dev Returns the downcasted int248 from int256, reverting on\n overflow (when the input is less than smallest int248 or\n greater than largest int248).\n Counterpart to Solidity's `int248` operator.\n Requirements:\n - input must fit into 248 bits" + }, + "id": 7148, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt248", + "nameLocation": "17693:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7126, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7125, + "mutability": "mutable", + "name": "value", + "nameLocation": "17709:5:20", + "nodeType": "VariableDeclaration", + "scope": 7148, + "src": "17702:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7124, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "17702:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "17701:14:20" + }, + "returnParameters": { + "id": 7129, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7128, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "17746:10:20", + "nodeType": "VariableDeclaration", + "scope": 7148, + "src": "17739:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int248", + "typeString": "int248" + }, + "typeName": { + "id": 7127, + "name": "int248", + "nodeType": "ElementaryTypeName", + "src": "17739:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int248", + "typeString": "int248" + } + }, + "visibility": "internal" + } + ], + "src": "17738:19:20" + }, + "scope": 7969, + "src": "17684:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7173, + "nodeType": "Block", + "src": "18305:150:20", + "statements": [ + { + "expression": { + "id": 7161, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7156, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7154, + "src": "18315:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int240", + "typeString": "int240" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7159, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7151, + "src": "18335:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7158, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "18328:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int240_$", + "typeString": "type(int240)" + }, + "typeName": { + "id": 7157, + "name": "int240", + "nodeType": "ElementaryTypeName", + "src": "18328:6:20", + "typeDescriptions": {} + } + }, + "id": 7160, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18328:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int240", + "typeString": "int240" + } + }, + "src": "18315:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int240", + "typeString": "int240" + } + }, + "id": 7162, + "nodeType": "ExpressionStatement", + "src": "18315:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7165, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7163, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7154, + "src": "18355:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int240", + "typeString": "int240" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7164, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7151, + "src": "18369:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "18355:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7172, + "nodeType": "IfStatement", + "src": "18351:98:20", + "trueBody": { + "id": 7171, + "nodeType": "Block", + "src": "18376:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323430", + "id": 7167, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18427:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_240_by_1", + "typeString": "int_const 240" + }, + "value": "240" + }, + { + "id": 7168, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7151, + "src": "18432:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_240_by_1", + "typeString": "int_const 240" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7166, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "18397:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7169, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18397:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7170, + "nodeType": "RevertStatement", + "src": "18390:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7149, + "nodeType": "StructuredDocumentation", + "src": "17914:312:20", + "text": " @dev Returns the downcasted int240 from int256, reverting on\n overflow (when the input is less than smallest int240 or\n greater than largest int240).\n Counterpart to Solidity's `int240` operator.\n Requirements:\n - input must fit into 240 bits" + }, + "id": 7174, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt240", + "nameLocation": "18240:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7152, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7151, + "mutability": "mutable", + "name": "value", + "nameLocation": "18256:5:20", + "nodeType": "VariableDeclaration", + "scope": 7174, + "src": "18249:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7150, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "18249:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "18248:14:20" + }, + "returnParameters": { + "id": 7155, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7154, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "18293:10:20", + "nodeType": "VariableDeclaration", + "scope": 7174, + "src": "18286:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int240", + "typeString": "int240" + }, + "typeName": { + "id": 7153, + "name": "int240", + "nodeType": "ElementaryTypeName", + "src": "18286:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int240", + "typeString": "int240" + } + }, + "visibility": "internal" + } + ], + "src": "18285:19:20" + }, + "scope": 7969, + "src": "18231:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7199, + "nodeType": "Block", + "src": "18852:150:20", + "statements": [ + { + "expression": { + "id": 7187, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7182, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7180, + "src": "18862:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int232", + "typeString": "int232" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7185, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7177, + "src": "18882:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7184, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "18875:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int232_$", + "typeString": "type(int232)" + }, + "typeName": { + "id": 7183, + "name": "int232", + "nodeType": "ElementaryTypeName", + "src": "18875:6:20", + "typeDescriptions": {} + } + }, + "id": 7186, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18875:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int232", + "typeString": "int232" + } + }, + "src": "18862:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int232", + "typeString": "int232" + } + }, + "id": 7188, + "nodeType": "ExpressionStatement", + "src": "18862:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7191, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7189, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7180, + "src": "18902:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int232", + "typeString": "int232" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7190, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7177, + "src": "18916:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "18902:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7198, + "nodeType": "IfStatement", + "src": "18898:98:20", + "trueBody": { + "id": 7197, + "nodeType": "Block", + "src": "18923:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323332", + "id": 7193, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18974:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_232_by_1", + "typeString": "int_const 232" + }, + "value": "232" + }, + { + "id": 7194, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7177, + "src": "18979:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_232_by_1", + "typeString": "int_const 232" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7192, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "18944:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7195, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18944:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7196, + "nodeType": "RevertStatement", + "src": "18937:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7175, + "nodeType": "StructuredDocumentation", + "src": "18461:312:20", + "text": " @dev Returns the downcasted int232 from int256, reverting on\n overflow (when the input is less than smallest int232 or\n greater than largest int232).\n Counterpart to Solidity's `int232` operator.\n Requirements:\n - input must fit into 232 bits" + }, + "id": 7200, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt232", + "nameLocation": "18787:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7178, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7177, + "mutability": "mutable", + "name": "value", + "nameLocation": "18803:5:20", + "nodeType": "VariableDeclaration", + "scope": 7200, + "src": "18796:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7176, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "18796:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "18795:14:20" + }, + "returnParameters": { + "id": 7181, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7180, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "18840:10:20", + "nodeType": "VariableDeclaration", + "scope": 7200, + "src": "18833:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int232", + "typeString": "int232" + }, + "typeName": { + "id": 7179, + "name": "int232", + "nodeType": "ElementaryTypeName", + "src": "18833:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int232", + "typeString": "int232" + } + }, + "visibility": "internal" + } + ], + "src": "18832:19:20" + }, + "scope": 7969, + "src": "18778:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7225, + "nodeType": "Block", + "src": "19399:150:20", + "statements": [ + { + "expression": { + "id": 7213, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7208, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7206, + "src": "19409:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int224", + "typeString": "int224" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7211, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7203, + "src": "19429:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7210, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "19422:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int224_$", + "typeString": "type(int224)" + }, + "typeName": { + "id": 7209, + "name": "int224", + "nodeType": "ElementaryTypeName", + "src": "19422:6:20", + "typeDescriptions": {} + } + }, + "id": 7212, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19422:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int224", + "typeString": "int224" + } + }, + "src": "19409:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int224", + "typeString": "int224" + } + }, + "id": 7214, + "nodeType": "ExpressionStatement", + "src": "19409:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7217, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7215, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7206, + "src": "19449:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int224", + "typeString": "int224" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7216, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7203, + "src": "19463:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "19449:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7224, + "nodeType": "IfStatement", + "src": "19445:98:20", + "trueBody": { + "id": 7223, + "nodeType": "Block", + "src": "19470:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323234", + "id": 7219, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19521:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_224_by_1", + "typeString": "int_const 224" + }, + "value": "224" + }, + { + "id": 7220, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7203, + "src": "19526:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_224_by_1", + "typeString": "int_const 224" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7218, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "19491:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7221, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19491:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7222, + "nodeType": "RevertStatement", + "src": "19484:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7201, + "nodeType": "StructuredDocumentation", + "src": "19008:312:20", + "text": " @dev Returns the downcasted int224 from int256, reverting on\n overflow (when the input is less than smallest int224 or\n greater than largest int224).\n Counterpart to Solidity's `int224` operator.\n Requirements:\n - input must fit into 224 bits" + }, + "id": 7226, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt224", + "nameLocation": "19334:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7204, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7203, + "mutability": "mutable", + "name": "value", + "nameLocation": "19350:5:20", + "nodeType": "VariableDeclaration", + "scope": 7226, + "src": "19343:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7202, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "19343:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "19342:14:20" + }, + "returnParameters": { + "id": 7207, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7206, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "19387:10:20", + "nodeType": "VariableDeclaration", + "scope": 7226, + "src": "19380:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int224", + "typeString": "int224" + }, + "typeName": { + "id": 7205, + "name": "int224", + "nodeType": "ElementaryTypeName", + "src": "19380:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int224", + "typeString": "int224" + } + }, + "visibility": "internal" + } + ], + "src": "19379:19:20" + }, + "scope": 7969, + "src": "19325:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7251, + "nodeType": "Block", + "src": "19946:150:20", + "statements": [ + { + "expression": { + "id": 7239, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7234, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7232, + "src": "19956:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int216", + "typeString": "int216" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7237, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7229, + "src": "19976:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7236, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "19969:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int216_$", + "typeString": "type(int216)" + }, + "typeName": { + "id": 7235, + "name": "int216", + "nodeType": "ElementaryTypeName", + "src": "19969:6:20", + "typeDescriptions": {} + } + }, + "id": 7238, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19969:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int216", + "typeString": "int216" + } + }, + "src": "19956:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int216", + "typeString": "int216" + } + }, + "id": 7240, + "nodeType": "ExpressionStatement", + "src": "19956:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7243, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7241, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7232, + "src": "19996:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int216", + "typeString": "int216" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7242, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7229, + "src": "20010:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "19996:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7250, + "nodeType": "IfStatement", + "src": "19992:98:20", + "trueBody": { + "id": 7249, + "nodeType": "Block", + "src": "20017:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323136", + "id": 7245, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "20068:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_216_by_1", + "typeString": "int_const 216" + }, + "value": "216" + }, + { + "id": 7246, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7229, + "src": "20073:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_216_by_1", + "typeString": "int_const 216" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7244, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "20038:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7247, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "20038:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7248, + "nodeType": "RevertStatement", + "src": "20031:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7227, + "nodeType": "StructuredDocumentation", + "src": "19555:312:20", + "text": " @dev Returns the downcasted int216 from int256, reverting on\n overflow (when the input is less than smallest int216 or\n greater than largest int216).\n Counterpart to Solidity's `int216` operator.\n Requirements:\n - input must fit into 216 bits" + }, + "id": 7252, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt216", + "nameLocation": "19881:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7230, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7229, + "mutability": "mutable", + "name": "value", + "nameLocation": "19897:5:20", + "nodeType": "VariableDeclaration", + "scope": 7252, + "src": "19890:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7228, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "19890:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "19889:14:20" + }, + "returnParameters": { + "id": 7233, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7232, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "19934:10:20", + "nodeType": "VariableDeclaration", + "scope": 7252, + "src": "19927:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int216", + "typeString": "int216" + }, + "typeName": { + "id": 7231, + "name": "int216", + "nodeType": "ElementaryTypeName", + "src": "19927:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int216", + "typeString": "int216" + } + }, + "visibility": "internal" + } + ], + "src": "19926:19:20" + }, + "scope": 7969, + "src": "19872:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7277, + "nodeType": "Block", + "src": "20493:150:20", + "statements": [ + { + "expression": { + "id": 7265, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7260, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7258, + "src": "20503:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int208", + "typeString": "int208" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7263, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7255, + "src": "20523:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7262, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "20516:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int208_$", + "typeString": "type(int208)" + }, + "typeName": { + "id": 7261, + "name": "int208", + "nodeType": "ElementaryTypeName", + "src": "20516:6:20", + "typeDescriptions": {} + } + }, + "id": 7264, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "20516:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int208", + "typeString": "int208" + } + }, + "src": "20503:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int208", + "typeString": "int208" + } + }, + "id": 7266, + "nodeType": "ExpressionStatement", + "src": "20503:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7269, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7267, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7258, + "src": "20543:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int208", + "typeString": "int208" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7268, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7255, + "src": "20557:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "20543:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7276, + "nodeType": "IfStatement", + "src": "20539:98:20", + "trueBody": { + "id": 7275, + "nodeType": "Block", + "src": "20564:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323038", + "id": 7271, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "20615:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_208_by_1", + "typeString": "int_const 208" + }, + "value": "208" + }, + { + "id": 7272, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7255, + "src": "20620:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_208_by_1", + "typeString": "int_const 208" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7270, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "20585:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7273, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "20585:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7274, + "nodeType": "RevertStatement", + "src": "20578:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7253, + "nodeType": "StructuredDocumentation", + "src": "20102:312:20", + "text": " @dev Returns the downcasted int208 from int256, reverting on\n overflow (when the input is less than smallest int208 or\n greater than largest int208).\n Counterpart to Solidity's `int208` operator.\n Requirements:\n - input must fit into 208 bits" + }, + "id": 7278, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt208", + "nameLocation": "20428:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7256, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7255, + "mutability": "mutable", + "name": "value", + "nameLocation": "20444:5:20", + "nodeType": "VariableDeclaration", + "scope": 7278, + "src": "20437:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7254, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "20437:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "20436:14:20" + }, + "returnParameters": { + "id": 7259, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7258, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "20481:10:20", + "nodeType": "VariableDeclaration", + "scope": 7278, + "src": "20474:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int208", + "typeString": "int208" + }, + "typeName": { + "id": 7257, + "name": "int208", + "nodeType": "ElementaryTypeName", + "src": "20474:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int208", + "typeString": "int208" + } + }, + "visibility": "internal" + } + ], + "src": "20473:19:20" + }, + "scope": 7969, + "src": "20419:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7303, + "nodeType": "Block", + "src": "21040:150:20", + "statements": [ + { + "expression": { + "id": 7291, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7286, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7284, + "src": "21050:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int200", + "typeString": "int200" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7289, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7281, + "src": "21070:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7288, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "21063:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int200_$", + "typeString": "type(int200)" + }, + "typeName": { + "id": 7287, + "name": "int200", + "nodeType": "ElementaryTypeName", + "src": "21063:6:20", + "typeDescriptions": {} + } + }, + "id": 7290, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "21063:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int200", + "typeString": "int200" + } + }, + "src": "21050:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int200", + "typeString": "int200" + } + }, + "id": 7292, + "nodeType": "ExpressionStatement", + "src": "21050:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7295, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7293, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7284, + "src": "21090:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int200", + "typeString": "int200" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7294, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7281, + "src": "21104:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "21090:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7302, + "nodeType": "IfStatement", + "src": "21086:98:20", + "trueBody": { + "id": 7301, + "nodeType": "Block", + "src": "21111:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323030", + "id": 7297, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "21162:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_200_by_1", + "typeString": "int_const 200" + }, + "value": "200" + }, + { + "id": 7298, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7281, + "src": "21167:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_200_by_1", + "typeString": "int_const 200" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7296, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "21132:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7299, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "21132:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7300, + "nodeType": "RevertStatement", + "src": "21125:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7279, + "nodeType": "StructuredDocumentation", + "src": "20649:312:20", + "text": " @dev Returns the downcasted int200 from int256, reverting on\n overflow (when the input is less than smallest int200 or\n greater than largest int200).\n Counterpart to Solidity's `int200` operator.\n Requirements:\n - input must fit into 200 bits" + }, + "id": 7304, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt200", + "nameLocation": "20975:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7282, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7281, + "mutability": "mutable", + "name": "value", + "nameLocation": "20991:5:20", + "nodeType": "VariableDeclaration", + "scope": 7304, + "src": "20984:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7280, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "20984:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "20983:14:20" + }, + "returnParameters": { + "id": 7285, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7284, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "21028:10:20", + "nodeType": "VariableDeclaration", + "scope": 7304, + "src": "21021:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int200", + "typeString": "int200" + }, + "typeName": { + "id": 7283, + "name": "int200", + "nodeType": "ElementaryTypeName", + "src": "21021:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int200", + "typeString": "int200" + } + }, + "visibility": "internal" + } + ], + "src": "21020:19:20" + }, + "scope": 7969, + "src": "20966:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7329, + "nodeType": "Block", + "src": "21587:150:20", + "statements": [ + { + "expression": { + "id": 7317, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7312, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7310, + "src": "21597:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int192", + "typeString": "int192" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7315, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7307, + "src": "21617:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7314, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "21610:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int192_$", + "typeString": "type(int192)" + }, + "typeName": { + "id": 7313, + "name": "int192", + "nodeType": "ElementaryTypeName", + "src": "21610:6:20", + "typeDescriptions": {} + } + }, + "id": 7316, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "21610:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int192", + "typeString": "int192" + } + }, + "src": "21597:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int192", + "typeString": "int192" + } + }, + "id": 7318, + "nodeType": "ExpressionStatement", + "src": "21597:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7321, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7319, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7310, + "src": "21637:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int192", + "typeString": "int192" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7320, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7307, + "src": "21651:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "21637:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7328, + "nodeType": "IfStatement", + "src": "21633:98:20", + "trueBody": { + "id": 7327, + "nodeType": "Block", + "src": "21658:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313932", + "id": 7323, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "21709:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_192_by_1", + "typeString": "int_const 192" + }, + "value": "192" + }, + { + "id": 7324, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7307, + "src": "21714:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_192_by_1", + "typeString": "int_const 192" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7322, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "21679:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7325, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "21679:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7326, + "nodeType": "RevertStatement", + "src": "21672:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7305, + "nodeType": "StructuredDocumentation", + "src": "21196:312:20", + "text": " @dev Returns the downcasted int192 from int256, reverting on\n overflow (when the input is less than smallest int192 or\n greater than largest int192).\n Counterpart to Solidity's `int192` operator.\n Requirements:\n - input must fit into 192 bits" + }, + "id": 7330, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt192", + "nameLocation": "21522:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7308, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7307, + "mutability": "mutable", + "name": "value", + "nameLocation": "21538:5:20", + "nodeType": "VariableDeclaration", + "scope": 7330, + "src": "21531:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7306, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "21531:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "21530:14:20" + }, + "returnParameters": { + "id": 7311, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7310, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "21575:10:20", + "nodeType": "VariableDeclaration", + "scope": 7330, + "src": "21568:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int192", + "typeString": "int192" + }, + "typeName": { + "id": 7309, + "name": "int192", + "nodeType": "ElementaryTypeName", + "src": "21568:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int192", + "typeString": "int192" + } + }, + "visibility": "internal" + } + ], + "src": "21567:19:20" + }, + "scope": 7969, + "src": "21513:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7355, + "nodeType": "Block", + "src": "22134:150:20", + "statements": [ + { + "expression": { + "id": 7343, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7338, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7336, + "src": "22144:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int184", + "typeString": "int184" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7341, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7333, + "src": "22164:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7340, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "22157:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int184_$", + "typeString": "type(int184)" + }, + "typeName": { + "id": 7339, + "name": "int184", + "nodeType": "ElementaryTypeName", + "src": "22157:6:20", + "typeDescriptions": {} + } + }, + "id": 7342, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "22157:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int184", + "typeString": "int184" + } + }, + "src": "22144:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int184", + "typeString": "int184" + } + }, + "id": 7344, + "nodeType": "ExpressionStatement", + "src": "22144:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7347, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7345, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7336, + "src": "22184:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int184", + "typeString": "int184" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7346, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7333, + "src": "22198:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "22184:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7354, + "nodeType": "IfStatement", + "src": "22180:98:20", + "trueBody": { + "id": 7353, + "nodeType": "Block", + "src": "22205:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313834", + "id": 7349, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22256:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_184_by_1", + "typeString": "int_const 184" + }, + "value": "184" + }, + { + "id": 7350, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7333, + "src": "22261:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_184_by_1", + "typeString": "int_const 184" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7348, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "22226:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7351, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "22226:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7352, + "nodeType": "RevertStatement", + "src": "22219:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7331, + "nodeType": "StructuredDocumentation", + "src": "21743:312:20", + "text": " @dev Returns the downcasted int184 from int256, reverting on\n overflow (when the input is less than smallest int184 or\n greater than largest int184).\n Counterpart to Solidity's `int184` operator.\n Requirements:\n - input must fit into 184 bits" + }, + "id": 7356, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt184", + "nameLocation": "22069:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7334, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7333, + "mutability": "mutable", + "name": "value", + "nameLocation": "22085:5:20", + "nodeType": "VariableDeclaration", + "scope": 7356, + "src": "22078:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7332, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "22078:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "22077:14:20" + }, + "returnParameters": { + "id": 7337, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7336, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "22122:10:20", + "nodeType": "VariableDeclaration", + "scope": 7356, + "src": "22115:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int184", + "typeString": "int184" + }, + "typeName": { + "id": 7335, + "name": "int184", + "nodeType": "ElementaryTypeName", + "src": "22115:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int184", + "typeString": "int184" + } + }, + "visibility": "internal" + } + ], + "src": "22114:19:20" + }, + "scope": 7969, + "src": "22060:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7381, + "nodeType": "Block", + "src": "22681:150:20", + "statements": [ + { + "expression": { + "id": 7369, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7364, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7362, + "src": "22691:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int176", + "typeString": "int176" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7367, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7359, + "src": "22711:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7366, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "22704:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int176_$", + "typeString": "type(int176)" + }, + "typeName": { + "id": 7365, + "name": "int176", + "nodeType": "ElementaryTypeName", + "src": "22704:6:20", + "typeDescriptions": {} + } + }, + "id": 7368, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "22704:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int176", + "typeString": "int176" + } + }, + "src": "22691:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int176", + "typeString": "int176" + } + }, + "id": 7370, + "nodeType": "ExpressionStatement", + "src": "22691:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7373, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7371, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7362, + "src": "22731:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int176", + "typeString": "int176" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7372, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7359, + "src": "22745:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "22731:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7380, + "nodeType": "IfStatement", + "src": "22727:98:20", + "trueBody": { + "id": 7379, + "nodeType": "Block", + "src": "22752:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313736", + "id": 7375, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22803:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_176_by_1", + "typeString": "int_const 176" + }, + "value": "176" + }, + { + "id": 7376, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7359, + "src": "22808:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_176_by_1", + "typeString": "int_const 176" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7374, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "22773:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7377, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "22773:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7378, + "nodeType": "RevertStatement", + "src": "22766:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7357, + "nodeType": "StructuredDocumentation", + "src": "22290:312:20", + "text": " @dev Returns the downcasted int176 from int256, reverting on\n overflow (when the input is less than smallest int176 or\n greater than largest int176).\n Counterpart to Solidity's `int176` operator.\n Requirements:\n - input must fit into 176 bits" + }, + "id": 7382, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt176", + "nameLocation": "22616:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7360, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7359, + "mutability": "mutable", + "name": "value", + "nameLocation": "22632:5:20", + "nodeType": "VariableDeclaration", + "scope": 7382, + "src": "22625:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7358, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "22625:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "22624:14:20" + }, + "returnParameters": { + "id": 7363, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7362, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "22669:10:20", + "nodeType": "VariableDeclaration", + "scope": 7382, + "src": "22662:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int176", + "typeString": "int176" + }, + "typeName": { + "id": 7361, + "name": "int176", + "nodeType": "ElementaryTypeName", + "src": "22662:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int176", + "typeString": "int176" + } + }, + "visibility": "internal" + } + ], + "src": "22661:19:20" + }, + "scope": 7969, + "src": "22607:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7407, + "nodeType": "Block", + "src": "23228:150:20", + "statements": [ + { + "expression": { + "id": 7395, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7390, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7388, + "src": "23238:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int168", + "typeString": "int168" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7393, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7385, + "src": "23258:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7392, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "23251:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int168_$", + "typeString": "type(int168)" + }, + "typeName": { + "id": 7391, + "name": "int168", + "nodeType": "ElementaryTypeName", + "src": "23251:6:20", + "typeDescriptions": {} + } + }, + "id": 7394, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "23251:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int168", + "typeString": "int168" + } + }, + "src": "23238:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int168", + "typeString": "int168" + } + }, + "id": 7396, + "nodeType": "ExpressionStatement", + "src": "23238:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7399, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7397, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7388, + "src": "23278:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int168", + "typeString": "int168" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7398, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7385, + "src": "23292:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "23278:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7406, + "nodeType": "IfStatement", + "src": "23274:98:20", + "trueBody": { + "id": 7405, + "nodeType": "Block", + "src": "23299:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313638", + "id": 7401, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "23350:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_168_by_1", + "typeString": "int_const 168" + }, + "value": "168" + }, + { + "id": 7402, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7385, + "src": "23355:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_168_by_1", + "typeString": "int_const 168" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7400, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "23320:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7403, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "23320:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7404, + "nodeType": "RevertStatement", + "src": "23313:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7383, + "nodeType": "StructuredDocumentation", + "src": "22837:312:20", + "text": " @dev Returns the downcasted int168 from int256, reverting on\n overflow (when the input is less than smallest int168 or\n greater than largest int168).\n Counterpart to Solidity's `int168` operator.\n Requirements:\n - input must fit into 168 bits" + }, + "id": 7408, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt168", + "nameLocation": "23163:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7386, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7385, + "mutability": "mutable", + "name": "value", + "nameLocation": "23179:5:20", + "nodeType": "VariableDeclaration", + "scope": 7408, + "src": "23172:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7384, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "23172:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "23171:14:20" + }, + "returnParameters": { + "id": 7389, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7388, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "23216:10:20", + "nodeType": "VariableDeclaration", + "scope": 7408, + "src": "23209:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int168", + "typeString": "int168" + }, + "typeName": { + "id": 7387, + "name": "int168", + "nodeType": "ElementaryTypeName", + "src": "23209:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int168", + "typeString": "int168" + } + }, + "visibility": "internal" + } + ], + "src": "23208:19:20" + }, + "scope": 7969, + "src": "23154:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7433, + "nodeType": "Block", + "src": "23775:150:20", + "statements": [ + { + "expression": { + "id": 7421, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7416, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7414, + "src": "23785:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int160", + "typeString": "int160" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7419, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7411, + "src": "23805:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7418, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "23798:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int160_$", + "typeString": "type(int160)" + }, + "typeName": { + "id": 7417, + "name": "int160", + "nodeType": "ElementaryTypeName", + "src": "23798:6:20", + "typeDescriptions": {} + } + }, + "id": 7420, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "23798:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int160", + "typeString": "int160" + } + }, + "src": "23785:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int160", + "typeString": "int160" + } + }, + "id": 7422, + "nodeType": "ExpressionStatement", + "src": "23785:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7425, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7423, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7414, + "src": "23825:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int160", + "typeString": "int160" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7424, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7411, + "src": "23839:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "23825:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7432, + "nodeType": "IfStatement", + "src": "23821:98:20", + "trueBody": { + "id": 7431, + "nodeType": "Block", + "src": "23846:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313630", + "id": 7427, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "23897:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_160_by_1", + "typeString": "int_const 160" + }, + "value": "160" + }, + { + "id": 7428, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7411, + "src": "23902:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_160_by_1", + "typeString": "int_const 160" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7426, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "23867:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7429, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "23867:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7430, + "nodeType": "RevertStatement", + "src": "23860:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7409, + "nodeType": "StructuredDocumentation", + "src": "23384:312:20", + "text": " @dev Returns the downcasted int160 from int256, reverting on\n overflow (when the input is less than smallest int160 or\n greater than largest int160).\n Counterpart to Solidity's `int160` operator.\n Requirements:\n - input must fit into 160 bits" + }, + "id": 7434, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt160", + "nameLocation": "23710:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7412, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7411, + "mutability": "mutable", + "name": "value", + "nameLocation": "23726:5:20", + "nodeType": "VariableDeclaration", + "scope": 7434, + "src": "23719:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7410, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "23719:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "23718:14:20" + }, + "returnParameters": { + "id": 7415, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7414, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "23763:10:20", + "nodeType": "VariableDeclaration", + "scope": 7434, + "src": "23756:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int160", + "typeString": "int160" + }, + "typeName": { + "id": 7413, + "name": "int160", + "nodeType": "ElementaryTypeName", + "src": "23756:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int160", + "typeString": "int160" + } + }, + "visibility": "internal" + } + ], + "src": "23755:19:20" + }, + "scope": 7969, + "src": "23701:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7459, + "nodeType": "Block", + "src": "24322:150:20", + "statements": [ + { + "expression": { + "id": 7447, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7442, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7440, + "src": "24332:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int152", + "typeString": "int152" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7445, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7437, + "src": "24352:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7444, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "24345:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int152_$", + "typeString": "type(int152)" + }, + "typeName": { + "id": 7443, + "name": "int152", + "nodeType": "ElementaryTypeName", + "src": "24345:6:20", + "typeDescriptions": {} + } + }, + "id": 7446, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "24345:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int152", + "typeString": "int152" + } + }, + "src": "24332:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int152", + "typeString": "int152" + } + }, + "id": 7448, + "nodeType": "ExpressionStatement", + "src": "24332:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7451, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7449, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7440, + "src": "24372:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int152", + "typeString": "int152" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7450, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7437, + "src": "24386:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "24372:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7458, + "nodeType": "IfStatement", + "src": "24368:98:20", + "trueBody": { + "id": 7457, + "nodeType": "Block", + "src": "24393:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313532", + "id": 7453, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "24444:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_152_by_1", + "typeString": "int_const 152" + }, + "value": "152" + }, + { + "id": 7454, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7437, + "src": "24449:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_152_by_1", + "typeString": "int_const 152" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7452, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "24414:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7455, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "24414:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7456, + "nodeType": "RevertStatement", + "src": "24407:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7435, + "nodeType": "StructuredDocumentation", + "src": "23931:312:20", + "text": " @dev Returns the downcasted int152 from int256, reverting on\n overflow (when the input is less than smallest int152 or\n greater than largest int152).\n Counterpart to Solidity's `int152` operator.\n Requirements:\n - input must fit into 152 bits" + }, + "id": 7460, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt152", + "nameLocation": "24257:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7438, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7437, + "mutability": "mutable", + "name": "value", + "nameLocation": "24273:5:20", + "nodeType": "VariableDeclaration", + "scope": 7460, + "src": "24266:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7436, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "24266:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "24265:14:20" + }, + "returnParameters": { + "id": 7441, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7440, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "24310:10:20", + "nodeType": "VariableDeclaration", + "scope": 7460, + "src": "24303:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int152", + "typeString": "int152" + }, + "typeName": { + "id": 7439, + "name": "int152", + "nodeType": "ElementaryTypeName", + "src": "24303:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int152", + "typeString": "int152" + } + }, + "visibility": "internal" + } + ], + "src": "24302:19:20" + }, + "scope": 7969, + "src": "24248:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7485, + "nodeType": "Block", + "src": "24869:150:20", + "statements": [ + { + "expression": { + "id": 7473, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7468, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7466, + "src": "24879:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int144", + "typeString": "int144" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7471, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7463, + "src": "24899:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7470, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "24892:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int144_$", + "typeString": "type(int144)" + }, + "typeName": { + "id": 7469, + "name": "int144", + "nodeType": "ElementaryTypeName", + "src": "24892:6:20", + "typeDescriptions": {} + } + }, + "id": 7472, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "24892:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int144", + "typeString": "int144" + } + }, + "src": "24879:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int144", + "typeString": "int144" + } + }, + "id": 7474, + "nodeType": "ExpressionStatement", + "src": "24879:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7477, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7475, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7466, + "src": "24919:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int144", + "typeString": "int144" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7476, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7463, + "src": "24933:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "24919:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7484, + "nodeType": "IfStatement", + "src": "24915:98:20", + "trueBody": { + "id": 7483, + "nodeType": "Block", + "src": "24940:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313434", + "id": 7479, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "24991:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_144_by_1", + "typeString": "int_const 144" + }, + "value": "144" + }, + { + "id": 7480, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7463, + "src": "24996:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_144_by_1", + "typeString": "int_const 144" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7478, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "24961:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7481, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "24961:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7482, + "nodeType": "RevertStatement", + "src": "24954:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7461, + "nodeType": "StructuredDocumentation", + "src": "24478:312:20", + "text": " @dev Returns the downcasted int144 from int256, reverting on\n overflow (when the input is less than smallest int144 or\n greater than largest int144).\n Counterpart to Solidity's `int144` operator.\n Requirements:\n - input must fit into 144 bits" + }, + "id": 7486, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt144", + "nameLocation": "24804:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7464, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7463, + "mutability": "mutable", + "name": "value", + "nameLocation": "24820:5:20", + "nodeType": "VariableDeclaration", + "scope": 7486, + "src": "24813:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7462, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "24813:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "24812:14:20" + }, + "returnParameters": { + "id": 7467, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7466, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "24857:10:20", + "nodeType": "VariableDeclaration", + "scope": 7486, + "src": "24850:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int144", + "typeString": "int144" + }, + "typeName": { + "id": 7465, + "name": "int144", + "nodeType": "ElementaryTypeName", + "src": "24850:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int144", + "typeString": "int144" + } + }, + "visibility": "internal" + } + ], + "src": "24849:19:20" + }, + "scope": 7969, + "src": "24795:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7511, + "nodeType": "Block", + "src": "25416:150:20", + "statements": [ + { + "expression": { + "id": 7499, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7494, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7492, + "src": "25426:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int136", + "typeString": "int136" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7497, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7489, + "src": "25446:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7496, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "25439:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int136_$", + "typeString": "type(int136)" + }, + "typeName": { + "id": 7495, + "name": "int136", + "nodeType": "ElementaryTypeName", + "src": "25439:6:20", + "typeDescriptions": {} + } + }, + "id": 7498, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "25439:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int136", + "typeString": "int136" + } + }, + "src": "25426:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int136", + "typeString": "int136" + } + }, + "id": 7500, + "nodeType": "ExpressionStatement", + "src": "25426:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7503, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7501, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7492, + "src": "25466:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int136", + "typeString": "int136" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7502, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7489, + "src": "25480:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "25466:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7510, + "nodeType": "IfStatement", + "src": "25462:98:20", + "trueBody": { + "id": 7509, + "nodeType": "Block", + "src": "25487:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313336", + "id": 7505, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "25538:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_136_by_1", + "typeString": "int_const 136" + }, + "value": "136" + }, + { + "id": 7506, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7489, + "src": "25543:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_136_by_1", + "typeString": "int_const 136" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7504, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "25508:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7507, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "25508:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7508, + "nodeType": "RevertStatement", + "src": "25501:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7487, + "nodeType": "StructuredDocumentation", + "src": "25025:312:20", + "text": " @dev Returns the downcasted int136 from int256, reverting on\n overflow (when the input is less than smallest int136 or\n greater than largest int136).\n Counterpart to Solidity's `int136` operator.\n Requirements:\n - input must fit into 136 bits" + }, + "id": 7512, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt136", + "nameLocation": "25351:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7490, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7489, + "mutability": "mutable", + "name": "value", + "nameLocation": "25367:5:20", + "nodeType": "VariableDeclaration", + "scope": 7512, + "src": "25360:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7488, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "25360:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "25359:14:20" + }, + "returnParameters": { + "id": 7493, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7492, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "25404:10:20", + "nodeType": "VariableDeclaration", + "scope": 7512, + "src": "25397:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int136", + "typeString": "int136" + }, + "typeName": { + "id": 7491, + "name": "int136", + "nodeType": "ElementaryTypeName", + "src": "25397:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int136", + "typeString": "int136" + } + }, + "visibility": "internal" + } + ], + "src": "25396:19:20" + }, + "scope": 7969, + "src": "25342:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7537, + "nodeType": "Block", + "src": "25963:150:20", + "statements": [ + { + "expression": { + "id": 7525, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7520, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7518, + "src": "25973:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int128", + "typeString": "int128" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7523, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7515, + "src": "25993:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7522, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "25986:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int128_$", + "typeString": "type(int128)" + }, + "typeName": { + "id": 7521, + "name": "int128", + "nodeType": "ElementaryTypeName", + "src": "25986:6:20", + "typeDescriptions": {} + } + }, + "id": 7524, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "25986:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int128", + "typeString": "int128" + } + }, + "src": "25973:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int128", + "typeString": "int128" + } + }, + "id": 7526, + "nodeType": "ExpressionStatement", + "src": "25973:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7529, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7527, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7518, + "src": "26013:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int128", + "typeString": "int128" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7528, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7515, + "src": "26027:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "26013:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7536, + "nodeType": "IfStatement", + "src": "26009:98:20", + "trueBody": { + "id": 7535, + "nodeType": "Block", + "src": "26034:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313238", + "id": 7531, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "26085:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_128_by_1", + "typeString": "int_const 128" + }, + "value": "128" + }, + { + "id": 7532, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7515, + "src": "26090:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_128_by_1", + "typeString": "int_const 128" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7530, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "26055:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7533, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "26055:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7534, + "nodeType": "RevertStatement", + "src": "26048:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7513, + "nodeType": "StructuredDocumentation", + "src": "25572:312:20", + "text": " @dev Returns the downcasted int128 from int256, reverting on\n overflow (when the input is less than smallest int128 or\n greater than largest int128).\n Counterpart to Solidity's `int128` operator.\n Requirements:\n - input must fit into 128 bits" + }, + "id": 7538, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt128", + "nameLocation": "25898:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7516, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7515, + "mutability": "mutable", + "name": "value", + "nameLocation": "25914:5:20", + "nodeType": "VariableDeclaration", + "scope": 7538, + "src": "25907:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7514, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "25907:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "25906:14:20" + }, + "returnParameters": { + "id": 7519, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7518, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "25951:10:20", + "nodeType": "VariableDeclaration", + "scope": 7538, + "src": "25944:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int128", + "typeString": "int128" + }, + "typeName": { + "id": 7517, + "name": "int128", + "nodeType": "ElementaryTypeName", + "src": "25944:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int128", + "typeString": "int128" + } + }, + "visibility": "internal" + } + ], + "src": "25943:19:20" + }, + "scope": 7969, + "src": "25889:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7563, + "nodeType": "Block", + "src": "26510:150:20", + "statements": [ + { + "expression": { + "id": 7551, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7546, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7544, + "src": "26520:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int120", + "typeString": "int120" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7549, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7541, + "src": "26540:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7548, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "26533:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int120_$", + "typeString": "type(int120)" + }, + "typeName": { + "id": 7547, + "name": "int120", + "nodeType": "ElementaryTypeName", + "src": "26533:6:20", + "typeDescriptions": {} + } + }, + "id": 7550, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "26533:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int120", + "typeString": "int120" + } + }, + "src": "26520:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int120", + "typeString": "int120" + } + }, + "id": 7552, + "nodeType": "ExpressionStatement", + "src": "26520:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7555, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7553, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7544, + "src": "26560:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int120", + "typeString": "int120" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7554, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7541, + "src": "26574:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "26560:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7562, + "nodeType": "IfStatement", + "src": "26556:98:20", + "trueBody": { + "id": 7561, + "nodeType": "Block", + "src": "26581:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313230", + "id": 7557, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "26632:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_120_by_1", + "typeString": "int_const 120" + }, + "value": "120" + }, + { + "id": 7558, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7541, + "src": "26637:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_120_by_1", + "typeString": "int_const 120" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7556, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "26602:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7559, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "26602:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7560, + "nodeType": "RevertStatement", + "src": "26595:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7539, + "nodeType": "StructuredDocumentation", + "src": "26119:312:20", + "text": " @dev Returns the downcasted int120 from int256, reverting on\n overflow (when the input is less than smallest int120 or\n greater than largest int120).\n Counterpart to Solidity's `int120` operator.\n Requirements:\n - input must fit into 120 bits" + }, + "id": 7564, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt120", + "nameLocation": "26445:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7542, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7541, + "mutability": "mutable", + "name": "value", + "nameLocation": "26461:5:20", + "nodeType": "VariableDeclaration", + "scope": 7564, + "src": "26454:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7540, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "26454:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "26453:14:20" + }, + "returnParameters": { + "id": 7545, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7544, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "26498:10:20", + "nodeType": "VariableDeclaration", + "scope": 7564, + "src": "26491:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int120", + "typeString": "int120" + }, + "typeName": { + "id": 7543, + "name": "int120", + "nodeType": "ElementaryTypeName", + "src": "26491:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int120", + "typeString": "int120" + } + }, + "visibility": "internal" + } + ], + "src": "26490:19:20" + }, + "scope": 7969, + "src": "26436:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7589, + "nodeType": "Block", + "src": "27057:150:20", + "statements": [ + { + "expression": { + "id": 7577, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7572, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7570, + "src": "27067:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int112", + "typeString": "int112" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7575, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7567, + "src": "27087:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7574, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "27080:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int112_$", + "typeString": "type(int112)" + }, + "typeName": { + "id": 7573, + "name": "int112", + "nodeType": "ElementaryTypeName", + "src": "27080:6:20", + "typeDescriptions": {} + } + }, + "id": 7576, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "27080:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int112", + "typeString": "int112" + } + }, + "src": "27067:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int112", + "typeString": "int112" + } + }, + "id": 7578, + "nodeType": "ExpressionStatement", + "src": "27067:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7581, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7579, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7570, + "src": "27107:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int112", + "typeString": "int112" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7580, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7567, + "src": "27121:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "27107:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7588, + "nodeType": "IfStatement", + "src": "27103:98:20", + "trueBody": { + "id": 7587, + "nodeType": "Block", + "src": "27128:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313132", + "id": 7583, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "27179:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_112_by_1", + "typeString": "int_const 112" + }, + "value": "112" + }, + { + "id": 7584, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7567, + "src": "27184:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_112_by_1", + "typeString": "int_const 112" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7582, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "27149:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7585, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "27149:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7586, + "nodeType": "RevertStatement", + "src": "27142:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7565, + "nodeType": "StructuredDocumentation", + "src": "26666:312:20", + "text": " @dev Returns the downcasted int112 from int256, reverting on\n overflow (when the input is less than smallest int112 or\n greater than largest int112).\n Counterpart to Solidity's `int112` operator.\n Requirements:\n - input must fit into 112 bits" + }, + "id": 7590, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt112", + "nameLocation": "26992:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7568, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7567, + "mutability": "mutable", + "name": "value", + "nameLocation": "27008:5:20", + "nodeType": "VariableDeclaration", + "scope": 7590, + "src": "27001:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7566, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "27001:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "27000:14:20" + }, + "returnParameters": { + "id": 7571, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7570, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "27045:10:20", + "nodeType": "VariableDeclaration", + "scope": 7590, + "src": "27038:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int112", + "typeString": "int112" + }, + "typeName": { + "id": 7569, + "name": "int112", + "nodeType": "ElementaryTypeName", + "src": "27038:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int112", + "typeString": "int112" + } + }, + "visibility": "internal" + } + ], + "src": "27037:19:20" + }, + "scope": 7969, + "src": "26983:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7615, + "nodeType": "Block", + "src": "27604:150:20", + "statements": [ + { + "expression": { + "id": 7603, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7598, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7596, + "src": "27614:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int104", + "typeString": "int104" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7601, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7593, + "src": "27634:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7600, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "27627:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int104_$", + "typeString": "type(int104)" + }, + "typeName": { + "id": 7599, + "name": "int104", + "nodeType": "ElementaryTypeName", + "src": "27627:6:20", + "typeDescriptions": {} + } + }, + "id": 7602, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "27627:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int104", + "typeString": "int104" + } + }, + "src": "27614:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int104", + "typeString": "int104" + } + }, + "id": 7604, + "nodeType": "ExpressionStatement", + "src": "27614:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7607, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7605, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7596, + "src": "27654:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int104", + "typeString": "int104" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7606, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7593, + "src": "27668:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "27654:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7614, + "nodeType": "IfStatement", + "src": "27650:98:20", + "trueBody": { + "id": 7613, + "nodeType": "Block", + "src": "27675:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313034", + "id": 7609, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "27726:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_104_by_1", + "typeString": "int_const 104" + }, + "value": "104" + }, + { + "id": 7610, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7593, + "src": "27731:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_104_by_1", + "typeString": "int_const 104" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7608, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "27696:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7611, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "27696:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7612, + "nodeType": "RevertStatement", + "src": "27689:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7591, + "nodeType": "StructuredDocumentation", + "src": "27213:312:20", + "text": " @dev Returns the downcasted int104 from int256, reverting on\n overflow (when the input is less than smallest int104 or\n greater than largest int104).\n Counterpart to Solidity's `int104` operator.\n Requirements:\n - input must fit into 104 bits" + }, + "id": 7616, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt104", + "nameLocation": "27539:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7594, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7593, + "mutability": "mutable", + "name": "value", + "nameLocation": "27555:5:20", + "nodeType": "VariableDeclaration", + "scope": 7616, + "src": "27548:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7592, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "27548:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "27547:14:20" + }, + "returnParameters": { + "id": 7597, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7596, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "27592:10:20", + "nodeType": "VariableDeclaration", + "scope": 7616, + "src": "27585:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int104", + "typeString": "int104" + }, + "typeName": { + "id": 7595, + "name": "int104", + "nodeType": "ElementaryTypeName", + "src": "27585:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int104", + "typeString": "int104" + } + }, + "visibility": "internal" + } + ], + "src": "27584:19:20" + }, + "scope": 7969, + "src": "27530:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7641, + "nodeType": "Block", + "src": "28144:148:20", + "statements": [ + { + "expression": { + "id": 7629, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7624, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7622, + "src": "28154:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int96", + "typeString": "int96" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7627, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7619, + "src": "28173:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7626, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "28167:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int96_$", + "typeString": "type(int96)" + }, + "typeName": { + "id": 7625, + "name": "int96", + "nodeType": "ElementaryTypeName", + "src": "28167:5:20", + "typeDescriptions": {} + } + }, + "id": 7628, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "28167:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int96", + "typeString": "int96" + } + }, + "src": "28154:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int96", + "typeString": "int96" + } + }, + "id": 7630, + "nodeType": "ExpressionStatement", + "src": "28154:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7633, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7631, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7622, + "src": "28193:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int96", + "typeString": "int96" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7632, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7619, + "src": "28207:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "28193:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7640, + "nodeType": "IfStatement", + "src": "28189:97:20", + "trueBody": { + "id": 7639, + "nodeType": "Block", + "src": "28214:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3936", + "id": 7635, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "28265:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_96_by_1", + "typeString": "int_const 96" + }, + "value": "96" + }, + { + "id": 7636, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7619, + "src": "28269:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_96_by_1", + "typeString": "int_const 96" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7634, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "28235:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7637, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "28235:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7638, + "nodeType": "RevertStatement", + "src": "28228:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7617, + "nodeType": "StructuredDocumentation", + "src": "27760:307:20", + "text": " @dev Returns the downcasted int96 from int256, reverting on\n overflow (when the input is less than smallest int96 or\n greater than largest int96).\n Counterpart to Solidity's `int96` operator.\n Requirements:\n - input must fit into 96 bits" + }, + "id": 7642, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt96", + "nameLocation": "28081:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7620, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7619, + "mutability": "mutable", + "name": "value", + "nameLocation": "28096:5:20", + "nodeType": "VariableDeclaration", + "scope": 7642, + "src": "28089:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7618, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "28089:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "28088:14:20" + }, + "returnParameters": { + "id": 7623, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7622, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "28132:10:20", + "nodeType": "VariableDeclaration", + "scope": 7642, + "src": "28126:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int96", + "typeString": "int96" + }, + "typeName": { + "id": 7621, + "name": "int96", + "nodeType": "ElementaryTypeName", + "src": "28126:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int96", + "typeString": "int96" + } + }, + "visibility": "internal" + } + ], + "src": "28125:18:20" + }, + "scope": 7969, + "src": "28072:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7667, + "nodeType": "Block", + "src": "28682:148:20", + "statements": [ + { + "expression": { + "id": 7655, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7650, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7648, + "src": "28692:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int88", + "typeString": "int88" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7653, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7645, + "src": "28711:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7652, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "28705:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int88_$", + "typeString": "type(int88)" + }, + "typeName": { + "id": 7651, + "name": "int88", + "nodeType": "ElementaryTypeName", + "src": "28705:5:20", + "typeDescriptions": {} + } + }, + "id": 7654, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "28705:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int88", + "typeString": "int88" + } + }, + "src": "28692:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int88", + "typeString": "int88" + } + }, + "id": 7656, + "nodeType": "ExpressionStatement", + "src": "28692:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7659, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7657, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7648, + "src": "28731:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int88", + "typeString": "int88" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7658, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7645, + "src": "28745:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "28731:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7666, + "nodeType": "IfStatement", + "src": "28727:97:20", + "trueBody": { + "id": 7665, + "nodeType": "Block", + "src": "28752:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3838", + "id": 7661, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "28803:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_88_by_1", + "typeString": "int_const 88" + }, + "value": "88" + }, + { + "id": 7662, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7645, + "src": "28807:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_88_by_1", + "typeString": "int_const 88" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7660, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "28773:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7663, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "28773:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7664, + "nodeType": "RevertStatement", + "src": "28766:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7643, + "nodeType": "StructuredDocumentation", + "src": "28298:307:20", + "text": " @dev Returns the downcasted int88 from int256, reverting on\n overflow (when the input is less than smallest int88 or\n greater than largest int88).\n Counterpart to Solidity's `int88` operator.\n Requirements:\n - input must fit into 88 bits" + }, + "id": 7668, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt88", + "nameLocation": "28619:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7646, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7645, + "mutability": "mutable", + "name": "value", + "nameLocation": "28634:5:20", + "nodeType": "VariableDeclaration", + "scope": 7668, + "src": "28627:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7644, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "28627:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "28626:14:20" + }, + "returnParameters": { + "id": 7649, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7648, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "28670:10:20", + "nodeType": "VariableDeclaration", + "scope": 7668, + "src": "28664:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int88", + "typeString": "int88" + }, + "typeName": { + "id": 7647, + "name": "int88", + "nodeType": "ElementaryTypeName", + "src": "28664:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int88", + "typeString": "int88" + } + }, + "visibility": "internal" + } + ], + "src": "28663:18:20" + }, + "scope": 7969, + "src": "28610:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7693, + "nodeType": "Block", + "src": "29220:148:20", + "statements": [ + { + "expression": { + "id": 7681, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7676, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7674, + "src": "29230:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int80", + "typeString": "int80" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7679, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7671, + "src": "29249:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7678, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "29243:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int80_$", + "typeString": "type(int80)" + }, + "typeName": { + "id": 7677, + "name": "int80", + "nodeType": "ElementaryTypeName", + "src": "29243:5:20", + "typeDescriptions": {} + } + }, + "id": 7680, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "29243:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int80", + "typeString": "int80" + } + }, + "src": "29230:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int80", + "typeString": "int80" + } + }, + "id": 7682, + "nodeType": "ExpressionStatement", + "src": "29230:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7685, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7683, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7674, + "src": "29269:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int80", + "typeString": "int80" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7684, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7671, + "src": "29283:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "29269:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7692, + "nodeType": "IfStatement", + "src": "29265:97:20", + "trueBody": { + "id": 7691, + "nodeType": "Block", + "src": "29290:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3830", + "id": 7687, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29341:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_80_by_1", + "typeString": "int_const 80" + }, + "value": "80" + }, + { + "id": 7688, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7671, + "src": "29345:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_80_by_1", + "typeString": "int_const 80" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7686, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "29311:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7689, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "29311:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7690, + "nodeType": "RevertStatement", + "src": "29304:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7669, + "nodeType": "StructuredDocumentation", + "src": "28836:307:20", + "text": " @dev Returns the downcasted int80 from int256, reverting on\n overflow (when the input is less than smallest int80 or\n greater than largest int80).\n Counterpart to Solidity's `int80` operator.\n Requirements:\n - input must fit into 80 bits" + }, + "id": 7694, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt80", + "nameLocation": "29157:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7672, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7671, + "mutability": "mutable", + "name": "value", + "nameLocation": "29172:5:20", + "nodeType": "VariableDeclaration", + "scope": 7694, + "src": "29165:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7670, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "29165:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "29164:14:20" + }, + "returnParameters": { + "id": 7675, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7674, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "29208:10:20", + "nodeType": "VariableDeclaration", + "scope": 7694, + "src": "29202:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int80", + "typeString": "int80" + }, + "typeName": { + "id": 7673, + "name": "int80", + "nodeType": "ElementaryTypeName", + "src": "29202:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int80", + "typeString": "int80" + } + }, + "visibility": "internal" + } + ], + "src": "29201:18:20" + }, + "scope": 7969, + "src": "29148:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7719, + "nodeType": "Block", + "src": "29758:148:20", + "statements": [ + { + "expression": { + "id": 7707, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7702, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7700, + "src": "29768:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int72", + "typeString": "int72" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7705, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7697, + "src": "29787:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7704, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "29781:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int72_$", + "typeString": "type(int72)" + }, + "typeName": { + "id": 7703, + "name": "int72", + "nodeType": "ElementaryTypeName", + "src": "29781:5:20", + "typeDescriptions": {} + } + }, + "id": 7706, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "29781:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int72", + "typeString": "int72" + } + }, + "src": "29768:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int72", + "typeString": "int72" + } + }, + "id": 7708, + "nodeType": "ExpressionStatement", + "src": "29768:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7711, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7709, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7700, + "src": "29807:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int72", + "typeString": "int72" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7710, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7697, + "src": "29821:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "29807:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7718, + "nodeType": "IfStatement", + "src": "29803:97:20", + "trueBody": { + "id": 7717, + "nodeType": "Block", + "src": "29828:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3732", + "id": 7713, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29879:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_72_by_1", + "typeString": "int_const 72" + }, + "value": "72" + }, + { + "id": 7714, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7697, + "src": "29883:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_72_by_1", + "typeString": "int_const 72" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7712, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "29849:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7715, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "29849:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7716, + "nodeType": "RevertStatement", + "src": "29842:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7695, + "nodeType": "StructuredDocumentation", + "src": "29374:307:20", + "text": " @dev Returns the downcasted int72 from int256, reverting on\n overflow (when the input is less than smallest int72 or\n greater than largest int72).\n Counterpart to Solidity's `int72` operator.\n Requirements:\n - input must fit into 72 bits" + }, + "id": 7720, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt72", + "nameLocation": "29695:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7698, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7697, + "mutability": "mutable", + "name": "value", + "nameLocation": "29710:5:20", + "nodeType": "VariableDeclaration", + "scope": 7720, + "src": "29703:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7696, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "29703:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "29702:14:20" + }, + "returnParameters": { + "id": 7701, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7700, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "29746:10:20", + "nodeType": "VariableDeclaration", + "scope": 7720, + "src": "29740:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int72", + "typeString": "int72" + }, + "typeName": { + "id": 7699, + "name": "int72", + "nodeType": "ElementaryTypeName", + "src": "29740:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int72", + "typeString": "int72" + } + }, + "visibility": "internal" + } + ], + "src": "29739:18:20" + }, + "scope": 7969, + "src": "29686:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7745, + "nodeType": "Block", + "src": "30296:148:20", + "statements": [ + { + "expression": { + "id": 7733, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7728, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7726, + "src": "30306:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int64", + "typeString": "int64" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7731, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7723, + "src": "30325:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7730, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "30319:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int64_$", + "typeString": "type(int64)" + }, + "typeName": { + "id": 7729, + "name": "int64", + "nodeType": "ElementaryTypeName", + "src": "30319:5:20", + "typeDescriptions": {} + } + }, + "id": 7732, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "30319:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int64", + "typeString": "int64" + } + }, + "src": "30306:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int64", + "typeString": "int64" + } + }, + "id": 7734, + "nodeType": "ExpressionStatement", + "src": "30306:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7737, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7735, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7726, + "src": "30345:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int64", + "typeString": "int64" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7736, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7723, + "src": "30359:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "30345:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7744, + "nodeType": "IfStatement", + "src": "30341:97:20", + "trueBody": { + "id": 7743, + "nodeType": "Block", + "src": "30366:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3634", + "id": 7739, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30417:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + { + "id": 7740, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7723, + "src": "30421:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7738, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "30387:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7741, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "30387:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7742, + "nodeType": "RevertStatement", + "src": "30380:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7721, + "nodeType": "StructuredDocumentation", + "src": "29912:307:20", + "text": " @dev Returns the downcasted int64 from int256, reverting on\n overflow (when the input is less than smallest int64 or\n greater than largest int64).\n Counterpart to Solidity's `int64` operator.\n Requirements:\n - input must fit into 64 bits" + }, + "id": 7746, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt64", + "nameLocation": "30233:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7724, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7723, + "mutability": "mutable", + "name": "value", + "nameLocation": "30248:5:20", + "nodeType": "VariableDeclaration", + "scope": 7746, + "src": "30241:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7722, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "30241:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "30240:14:20" + }, + "returnParameters": { + "id": 7727, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7726, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "30284:10:20", + "nodeType": "VariableDeclaration", + "scope": 7746, + "src": "30278:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int64", + "typeString": "int64" + }, + "typeName": { + "id": 7725, + "name": "int64", + "nodeType": "ElementaryTypeName", + "src": "30278:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int64", + "typeString": "int64" + } + }, + "visibility": "internal" + } + ], + "src": "30277:18:20" + }, + "scope": 7969, + "src": "30224:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7771, + "nodeType": "Block", + "src": "30834:148:20", + "statements": [ + { + "expression": { + "id": 7759, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7754, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7752, + "src": "30844:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int56", + "typeString": "int56" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7757, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7749, + "src": "30863:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7756, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "30857:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int56_$", + "typeString": "type(int56)" + }, + "typeName": { + "id": 7755, + "name": "int56", + "nodeType": "ElementaryTypeName", + "src": "30857:5:20", + "typeDescriptions": {} + } + }, + "id": 7758, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "30857:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int56", + "typeString": "int56" + } + }, + "src": "30844:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int56", + "typeString": "int56" + } + }, + "id": 7760, + "nodeType": "ExpressionStatement", + "src": "30844:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7763, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7761, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7752, + "src": "30883:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int56", + "typeString": "int56" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7762, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7749, + "src": "30897:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "30883:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7770, + "nodeType": "IfStatement", + "src": "30879:97:20", + "trueBody": { + "id": 7769, + "nodeType": "Block", + "src": "30904:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3536", + "id": 7765, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30955:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_56_by_1", + "typeString": "int_const 56" + }, + "value": "56" + }, + { + "id": 7766, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7749, + "src": "30959:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_56_by_1", + "typeString": "int_const 56" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7764, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "30925:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7767, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "30925:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7768, + "nodeType": "RevertStatement", + "src": "30918:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7747, + "nodeType": "StructuredDocumentation", + "src": "30450:307:20", + "text": " @dev Returns the downcasted int56 from int256, reverting on\n overflow (when the input is less than smallest int56 or\n greater than largest int56).\n Counterpart to Solidity's `int56` operator.\n Requirements:\n - input must fit into 56 bits" + }, + "id": 7772, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt56", + "nameLocation": "30771:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7750, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7749, + "mutability": "mutable", + "name": "value", + "nameLocation": "30786:5:20", + "nodeType": "VariableDeclaration", + "scope": 7772, + "src": "30779:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7748, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "30779:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "30778:14:20" + }, + "returnParameters": { + "id": 7753, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7752, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "30822:10:20", + "nodeType": "VariableDeclaration", + "scope": 7772, + "src": "30816:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int56", + "typeString": "int56" + }, + "typeName": { + "id": 7751, + "name": "int56", + "nodeType": "ElementaryTypeName", + "src": "30816:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int56", + "typeString": "int56" + } + }, + "visibility": "internal" + } + ], + "src": "30815:18:20" + }, + "scope": 7969, + "src": "30762:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7797, + "nodeType": "Block", + "src": "31372:148:20", + "statements": [ + { + "expression": { + "id": 7785, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7780, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7778, + "src": "31382:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int48", + "typeString": "int48" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7783, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7775, + "src": "31401:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7782, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "31395:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int48_$", + "typeString": "type(int48)" + }, + "typeName": { + "id": 7781, + "name": "int48", + "nodeType": "ElementaryTypeName", + "src": "31395:5:20", + "typeDescriptions": {} + } + }, + "id": 7784, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "31395:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int48", + "typeString": "int48" + } + }, + "src": "31382:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int48", + "typeString": "int48" + } + }, + "id": 7786, + "nodeType": "ExpressionStatement", + "src": "31382:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7789, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7787, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7778, + "src": "31421:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int48", + "typeString": "int48" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7788, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7775, + "src": "31435:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "31421:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7796, + "nodeType": "IfStatement", + "src": "31417:97:20", + "trueBody": { + "id": 7795, + "nodeType": "Block", + "src": "31442:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3438", + "id": 7791, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31493:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_48_by_1", + "typeString": "int_const 48" + }, + "value": "48" + }, + { + "id": 7792, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7775, + "src": "31497:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_48_by_1", + "typeString": "int_const 48" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7790, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "31463:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7793, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "31463:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7794, + "nodeType": "RevertStatement", + "src": "31456:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7773, + "nodeType": "StructuredDocumentation", + "src": "30988:307:20", + "text": " @dev Returns the downcasted int48 from int256, reverting on\n overflow (when the input is less than smallest int48 or\n greater than largest int48).\n Counterpart to Solidity's `int48` operator.\n Requirements:\n - input must fit into 48 bits" + }, + "id": 7798, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt48", + "nameLocation": "31309:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7776, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7775, + "mutability": "mutable", + "name": "value", + "nameLocation": "31324:5:20", + "nodeType": "VariableDeclaration", + "scope": 7798, + "src": "31317:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7774, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "31317:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "31316:14:20" + }, + "returnParameters": { + "id": 7779, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7778, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "31360:10:20", + "nodeType": "VariableDeclaration", + "scope": 7798, + "src": "31354:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int48", + "typeString": "int48" + }, + "typeName": { + "id": 7777, + "name": "int48", + "nodeType": "ElementaryTypeName", + "src": "31354:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int48", + "typeString": "int48" + } + }, + "visibility": "internal" + } + ], + "src": "31353:18:20" + }, + "scope": 7969, + "src": "31300:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7823, + "nodeType": "Block", + "src": "31910:148:20", + "statements": [ + { + "expression": { + "id": 7811, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7806, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7804, + "src": "31920:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int40", + "typeString": "int40" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7809, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7801, + "src": "31939:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7808, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "31933:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int40_$", + "typeString": "type(int40)" + }, + "typeName": { + "id": 7807, + "name": "int40", + "nodeType": "ElementaryTypeName", + "src": "31933:5:20", + "typeDescriptions": {} + } + }, + "id": 7810, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "31933:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int40", + "typeString": "int40" + } + }, + "src": "31920:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int40", + "typeString": "int40" + } + }, + "id": 7812, + "nodeType": "ExpressionStatement", + "src": "31920:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7815, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7813, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7804, + "src": "31959:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int40", + "typeString": "int40" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7814, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7801, + "src": "31973:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "31959:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7822, + "nodeType": "IfStatement", + "src": "31955:97:20", + "trueBody": { + "id": 7821, + "nodeType": "Block", + "src": "31980:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3430", + "id": 7817, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "32031:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_40_by_1", + "typeString": "int_const 40" + }, + "value": "40" + }, + { + "id": 7818, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7801, + "src": "32035:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_40_by_1", + "typeString": "int_const 40" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7816, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "32001:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7819, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "32001:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7820, + "nodeType": "RevertStatement", + "src": "31994:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7799, + "nodeType": "StructuredDocumentation", + "src": "31526:307:20", + "text": " @dev Returns the downcasted int40 from int256, reverting on\n overflow (when the input is less than smallest int40 or\n greater than largest int40).\n Counterpart to Solidity's `int40` operator.\n Requirements:\n - input must fit into 40 bits" + }, + "id": 7824, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt40", + "nameLocation": "31847:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7802, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7801, + "mutability": "mutable", + "name": "value", + "nameLocation": "31862:5:20", + "nodeType": "VariableDeclaration", + "scope": 7824, + "src": "31855:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7800, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "31855:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "31854:14:20" + }, + "returnParameters": { + "id": 7805, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7804, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "31898:10:20", + "nodeType": "VariableDeclaration", + "scope": 7824, + "src": "31892:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int40", + "typeString": "int40" + }, + "typeName": { + "id": 7803, + "name": "int40", + "nodeType": "ElementaryTypeName", + "src": "31892:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int40", + "typeString": "int40" + } + }, + "visibility": "internal" + } + ], + "src": "31891:18:20" + }, + "scope": 7969, + "src": "31838:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7849, + "nodeType": "Block", + "src": "32448:148:20", + "statements": [ + { + "expression": { + "id": 7837, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7832, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7830, + "src": "32458:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int32", + "typeString": "int32" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7835, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7827, + "src": "32477:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7834, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "32471:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int32_$", + "typeString": "type(int32)" + }, + "typeName": { + "id": 7833, + "name": "int32", + "nodeType": "ElementaryTypeName", + "src": "32471:5:20", + "typeDescriptions": {} + } + }, + "id": 7836, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "32471:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int32", + "typeString": "int32" + } + }, + "src": "32458:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int32", + "typeString": "int32" + } + }, + "id": 7838, + "nodeType": "ExpressionStatement", + "src": "32458:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7841, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7839, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7830, + "src": "32497:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int32", + "typeString": "int32" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7840, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7827, + "src": "32511:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "32497:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7848, + "nodeType": "IfStatement", + "src": "32493:97:20", + "trueBody": { + "id": 7847, + "nodeType": "Block", + "src": "32518:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3332", + "id": 7843, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "32569:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + { + "id": 7844, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7827, + "src": "32573:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7842, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "32539:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7845, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "32539:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7846, + "nodeType": "RevertStatement", + "src": "32532:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7825, + "nodeType": "StructuredDocumentation", + "src": "32064:307:20", + "text": " @dev Returns the downcasted int32 from int256, reverting on\n overflow (when the input is less than smallest int32 or\n greater than largest int32).\n Counterpart to Solidity's `int32` operator.\n Requirements:\n - input must fit into 32 bits" + }, + "id": 7850, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt32", + "nameLocation": "32385:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7828, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7827, + "mutability": "mutable", + "name": "value", + "nameLocation": "32400:5:20", + "nodeType": "VariableDeclaration", + "scope": 7850, + "src": "32393:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7826, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "32393:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "32392:14:20" + }, + "returnParameters": { + "id": 7831, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7830, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "32436:10:20", + "nodeType": "VariableDeclaration", + "scope": 7850, + "src": "32430:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int32", + "typeString": "int32" + }, + "typeName": { + "id": 7829, + "name": "int32", + "nodeType": "ElementaryTypeName", + "src": "32430:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int32", + "typeString": "int32" + } + }, + "visibility": "internal" + } + ], + "src": "32429:18:20" + }, + "scope": 7969, + "src": "32376:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7875, + "nodeType": "Block", + "src": "32986:148:20", + "statements": [ + { + "expression": { + "id": 7863, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7858, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7856, + "src": "32996:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int24", + "typeString": "int24" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7861, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7853, + "src": "33015:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7860, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "33009:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int24_$", + "typeString": "type(int24)" + }, + "typeName": { + "id": 7859, + "name": "int24", + "nodeType": "ElementaryTypeName", + "src": "33009:5:20", + "typeDescriptions": {} + } + }, + "id": 7862, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "33009:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int24", + "typeString": "int24" + } + }, + "src": "32996:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int24", + "typeString": "int24" + } + }, + "id": 7864, + "nodeType": "ExpressionStatement", + "src": "32996:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7867, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7865, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7856, + "src": "33035:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int24", + "typeString": "int24" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7866, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7853, + "src": "33049:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "33035:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7874, + "nodeType": "IfStatement", + "src": "33031:97:20", + "trueBody": { + "id": 7873, + "nodeType": "Block", + "src": "33056:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3234", + "id": 7869, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "33107:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_24_by_1", + "typeString": "int_const 24" + }, + "value": "24" + }, + { + "id": 7870, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7853, + "src": "33111:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_24_by_1", + "typeString": "int_const 24" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7868, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "33077:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7871, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "33077:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7872, + "nodeType": "RevertStatement", + "src": "33070:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7851, + "nodeType": "StructuredDocumentation", + "src": "32602:307:20", + "text": " @dev Returns the downcasted int24 from int256, reverting on\n overflow (when the input is less than smallest int24 or\n greater than largest int24).\n Counterpart to Solidity's `int24` operator.\n Requirements:\n - input must fit into 24 bits" + }, + "id": 7876, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt24", + "nameLocation": "32923:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7854, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7853, + "mutability": "mutable", + "name": "value", + "nameLocation": "32938:5:20", + "nodeType": "VariableDeclaration", + "scope": 7876, + "src": "32931:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7852, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "32931:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "32930:14:20" + }, + "returnParameters": { + "id": 7857, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7856, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "32974:10:20", + "nodeType": "VariableDeclaration", + "scope": 7876, + "src": "32968:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int24", + "typeString": "int24" + }, + "typeName": { + "id": 7855, + "name": "int24", + "nodeType": "ElementaryTypeName", + "src": "32968:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int24", + "typeString": "int24" + } + }, + "visibility": "internal" + } + ], + "src": "32967:18:20" + }, + "scope": 7969, + "src": "32914:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7901, + "nodeType": "Block", + "src": "33524:148:20", + "statements": [ + { + "expression": { + "id": 7889, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7884, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7882, + "src": "33534:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int16", + "typeString": "int16" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7887, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7879, + "src": "33553:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7886, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "33547:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int16_$", + "typeString": "type(int16)" + }, + "typeName": { + "id": 7885, + "name": "int16", + "nodeType": "ElementaryTypeName", + "src": "33547:5:20", + "typeDescriptions": {} + } + }, + "id": 7888, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "33547:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int16", + "typeString": "int16" + } + }, + "src": "33534:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int16", + "typeString": "int16" + } + }, + "id": 7890, + "nodeType": "ExpressionStatement", + "src": "33534:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7893, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7891, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7882, + "src": "33573:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int16", + "typeString": "int16" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7892, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7879, + "src": "33587:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "33573:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7900, + "nodeType": "IfStatement", + "src": "33569:97:20", + "trueBody": { + "id": 7899, + "nodeType": "Block", + "src": "33594:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3136", + "id": 7895, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "33645:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + { + "id": 7896, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7879, + "src": "33649:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7894, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "33615:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7897, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "33615:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7898, + "nodeType": "RevertStatement", + "src": "33608:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7877, + "nodeType": "StructuredDocumentation", + "src": "33140:307:20", + "text": " @dev Returns the downcasted int16 from int256, reverting on\n overflow (when the input is less than smallest int16 or\n greater than largest int16).\n Counterpart to Solidity's `int16` operator.\n Requirements:\n - input must fit into 16 bits" + }, + "id": 7902, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt16", + "nameLocation": "33461:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7880, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7879, + "mutability": "mutable", + "name": "value", + "nameLocation": "33476:5:20", + "nodeType": "VariableDeclaration", + "scope": 7902, + "src": "33469:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7878, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "33469:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "33468:14:20" + }, + "returnParameters": { + "id": 7883, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7882, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "33512:10:20", + "nodeType": "VariableDeclaration", + "scope": 7902, + "src": "33506:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int16", + "typeString": "int16" + }, + "typeName": { + "id": 7881, + "name": "int16", + "nodeType": "ElementaryTypeName", + "src": "33506:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int16", + "typeString": "int16" + } + }, + "visibility": "internal" + } + ], + "src": "33505:18:20" + }, + "scope": 7969, + "src": "33452:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7927, + "nodeType": "Block", + "src": "34055:146:20", + "statements": [ + { + "expression": { + "id": 7915, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7910, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7908, + "src": "34065:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int8", + "typeString": "int8" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7913, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7905, + "src": "34083:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7912, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "34078:4:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int8_$", + "typeString": "type(int8)" + }, + "typeName": { + "id": 7911, + "name": "int8", + "nodeType": "ElementaryTypeName", + "src": "34078:4:20", + "typeDescriptions": {} + } + }, + "id": 7914, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "34078:11:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int8", + "typeString": "int8" + } + }, + "src": "34065:24:20", + "typeDescriptions": { + "typeIdentifier": "t_int8", + "typeString": "int8" + } + }, + "id": 7916, + "nodeType": "ExpressionStatement", + "src": "34065:24:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7919, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7917, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7908, + "src": "34103:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int8", + "typeString": "int8" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7918, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7905, + "src": "34117:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "34103:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7926, + "nodeType": "IfStatement", + "src": "34099:96:20", + "trueBody": { + "id": 7925, + "nodeType": "Block", + "src": "34124:71:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "38", + "id": 7921, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "34175:1:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + { + "id": 7922, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7905, + "src": "34178:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7920, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "34145:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7923, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "34145:39:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7924, + "nodeType": "RevertStatement", + "src": "34138:46:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7903, + "nodeType": "StructuredDocumentation", + "src": "33678:302:20", + "text": " @dev Returns the downcasted int8 from int256, reverting on\n overflow (when the input is less than smallest int8 or\n greater than largest int8).\n Counterpart to Solidity's `int8` operator.\n Requirements:\n - input must fit into 8 bits" + }, + "id": 7928, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt8", + "nameLocation": "33994:6:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7906, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7905, + "mutability": "mutable", + "name": "value", + "nameLocation": "34008:5:20", + "nodeType": "VariableDeclaration", + "scope": 7928, + "src": "34001:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7904, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "34001:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "34000:14:20" + }, + "returnParameters": { + "id": 7909, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7908, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "34043:10:20", + "nodeType": "VariableDeclaration", + "scope": 7928, + "src": "34038:15:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int8", + "typeString": "int8" + }, + "typeName": { + "id": 7907, + "name": "int8", + "nodeType": "ElementaryTypeName", + "src": "34038:4:20", + "typeDescriptions": { + "typeIdentifier": "t_int8", + "typeString": "int8" + } + }, + "visibility": "internal" + } + ], + "src": "34037:17:20" + }, + "scope": 7969, + "src": "33985:216:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7957, + "nodeType": "Block", + "src": "34441:250:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 7945, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7936, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7931, + "src": "34554:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "arguments": [ + { + "expression": { + "arguments": [ + { + "id": 7941, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "34575:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + }, + "typeName": { + "id": 7940, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "34575:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + } + ], + "id": 7939, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "34570:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 7942, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "34570:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_int256", + "typeString": "type(int256)" + } + }, + "id": 7943, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "34583:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "34570:16:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7938, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "34562:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 7937, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "34562:7:20", + "typeDescriptions": {} + } + }, + "id": 7944, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "34562:25:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "34554:33:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7951, + "nodeType": "IfStatement", + "src": "34550:105:20", + "trueBody": { + "id": 7950, + "nodeType": "Block", + "src": "34589:66:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "id": 7947, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7931, + "src": "34638:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7946, + "name": "SafeCastOverflowedUintToInt", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6231, + "src": "34610:27:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint256) pure returns (error)" + } + }, + "id": 7948, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "34610:34:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7949, + "nodeType": "RevertStatement", + "src": "34603:41:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 7954, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7931, + "src": "34678:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7953, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "34671:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + }, + "typeName": { + "id": 7952, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "34671:6:20", + "typeDescriptions": {} + } + }, + "id": 7955, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "34671:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "functionReturnParameters": 7935, + "id": 7956, + "nodeType": "Return", + "src": "34664:20:20" + } + ] + }, + "documentation": { + "id": 7929, + "nodeType": "StructuredDocumentation", + "src": "34207:165:20", + "text": " @dev Converts an unsigned uint256 into a signed int256.\n Requirements:\n - input must be less than or equal to maxInt256." + }, + "id": 7958, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt256", + "nameLocation": "34386:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7932, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7931, + "mutability": "mutable", + "name": "value", + "nameLocation": "34403:5:20", + "nodeType": "VariableDeclaration", + "scope": 7958, + "src": "34395:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 7930, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "34395:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "34394:15:20" + }, + "returnParameters": { + "id": 7935, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7934, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 7958, + "src": "34433:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7933, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "34433:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "34432:8:20" + }, + "scope": 7969, + "src": "34377:314:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7967, + "nodeType": "Block", + "src": "34850:87:20", + "statements": [ + { + "AST": { + "nativeSrc": "34885:46:20", + "nodeType": "YulBlock", + "src": "34885:46:20", + "statements": [ + { + "nativeSrc": "34899:22:20", + "nodeType": "YulAssignment", + "src": "34899:22:20", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "b", + "nativeSrc": "34918:1:20", + "nodeType": "YulIdentifier", + "src": "34918:1:20" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "34911:6:20", + "nodeType": "YulIdentifier", + "src": "34911:6:20" + }, + "nativeSrc": "34911:9:20", + "nodeType": "YulFunctionCall", + "src": "34911:9:20" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "34904:6:20", + "nodeType": "YulIdentifier", + "src": "34904:6:20" + }, + "nativeSrc": "34904:17:20", + "nodeType": "YulFunctionCall", + "src": "34904:17:20" + }, + "variableNames": [ + { + "name": "u", + "nativeSrc": "34899:1:20", + "nodeType": "YulIdentifier", + "src": "34899:1:20" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 7961, + "isOffset": false, + "isSlot": false, + "src": "34918:1:20", + "valueSize": 1 + }, + { + "declaration": 7964, + "isOffset": false, + "isSlot": false, + "src": "34899:1:20", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 7966, + "nodeType": "InlineAssembly", + "src": "34860:71:20" + } + ] + }, + "documentation": { + "id": 7959, + "nodeType": "StructuredDocumentation", + "src": "34697:90:20", + "text": " @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump." + }, + "id": 7968, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint", + "nameLocation": "34801:6:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7962, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7961, + "mutability": "mutable", + "name": "b", + "nameLocation": "34813:1:20", + "nodeType": "VariableDeclaration", + "scope": 7968, + "src": "34808:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 7960, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "34808:4:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "34807:8:20" + }, + "returnParameters": { + "id": 7965, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7964, + "mutability": "mutable", + "name": "u", + "nameLocation": "34847:1:20", + "nodeType": "VariableDeclaration", + "scope": 7968, + "src": "34839:9:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 7963, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "34839:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "34838:11:20" + }, + "scope": 7969, + "src": "34792:145:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + } + ], + "scope": 7970, + "src": "769:34170:20", + "usedErrors": [ + 6214, + 6219, + 6226, + 6231 + ], + "usedEvents": [] + } + ], + "src": "192:34748:20" + }, + "id": 20 + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/math/SignedMath.sol", + "exportedSymbols": { + "SafeCast": [ + 7969 + ], + "SignedMath": [ + 8113 + ] + }, + "id": 8114, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 7971, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "109:24:21" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/math/SafeCast.sol", + "file": "./SafeCast.sol", + "id": 7973, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 8114, + "sourceUnit": 7970, + "src": "135:40:21", + "symbolAliases": [ + { + "foreign": { + "id": 7972, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "143:8:21", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "SignedMath", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 7974, + "nodeType": "StructuredDocumentation", + "src": "177:80:21", + "text": " @dev Standard signed math utilities missing in the Solidity language." + }, + "fullyImplemented": true, + "id": 8113, + "linearizedBaseContracts": [ + 8113 + ], + "name": "SignedMath", + "nameLocation": "266:10:21", + "nodeType": "ContractDefinition", + "nodes": [ + { + "body": { + "id": 8003, + "nodeType": "Block", + "src": "746:215:21", + "statements": [ + { + "id": 8002, + "nodeType": "UncheckedBlock", + "src": "756:199:21", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8000, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7986, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7981, + "src": "894:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "^", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7998, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7989, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7987, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7979, + "src": "900:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "^", + "rightExpression": { + "id": 7988, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7981, + "src": "904:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "900:5:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 7990, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "899:7:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "arguments": [ + { + "arguments": [ + { + "id": 7995, + "name": "condition", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7977, + "src": "932:9:21", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 7993, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "916:8:21", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 7994, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "925:6:21", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "916:15:21", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 7996, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "916:26:21", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7992, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "909:6:21", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + }, + "typeName": { + "id": 7991, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "909:6:21", + "typeDescriptions": {} + } + }, + "id": 7997, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "909:34:21", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "899:44:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 7999, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "898:46:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "894:50:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "functionReturnParameters": 7985, + "id": 8001, + "nodeType": "Return", + "src": "887:57:21" + } + ] + } + ] + }, + "documentation": { + "id": 7975, + "nodeType": "StructuredDocumentation", + "src": "283:374:21", + "text": " @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant.\n IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.\n However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute\n one branch when needed, making this function more expensive." + }, + "id": 8004, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ternary", + "nameLocation": "671:7:21", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7982, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7977, + "mutability": "mutable", + "name": "condition", + "nameLocation": "684:9:21", + "nodeType": "VariableDeclaration", + "scope": 8004, + "src": "679:14:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 7976, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "679:4:21", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 7979, + "mutability": "mutable", + "name": "a", + "nameLocation": "702:1:21", + "nodeType": "VariableDeclaration", + "scope": 8004, + "src": "695:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7978, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "695:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 7981, + "mutability": "mutable", + "name": "b", + "nameLocation": "712:1:21", + "nodeType": "VariableDeclaration", + "scope": 8004, + "src": "705:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7980, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "705:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "678:36:21" + }, + "returnParameters": { + "id": 7985, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7984, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 8004, + "src": "738:6:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7983, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "738:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "737:8:21" + }, + "scope": 8113, + "src": "662:299:21", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 8022, + "nodeType": "Block", + "src": "1102:44:21", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8017, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8015, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8007, + "src": "1127:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "id": 8016, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8009, + "src": "1131:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "1127:5:21", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "id": 8018, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8007, + "src": "1134:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + { + "id": 8019, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8009, + "src": "1137:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 8014, + "name": "ternary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8004, + "src": "1119:7:21", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$_t_int256_$_t_int256_$returns$_t_int256_$", + "typeString": "function (bool,int256,int256) pure returns (int256)" + } + }, + "id": 8020, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1119:20:21", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "functionReturnParameters": 8013, + "id": 8021, + "nodeType": "Return", + "src": "1112:27:21" + } + ] + }, + "documentation": { + "id": 8005, + "nodeType": "StructuredDocumentation", + "src": "967:66:21", + "text": " @dev Returns the largest of two signed numbers." + }, + "id": 8023, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "max", + "nameLocation": "1047:3:21", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8010, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8007, + "mutability": "mutable", + "name": "a", + "nameLocation": "1058:1:21", + "nodeType": "VariableDeclaration", + "scope": 8023, + "src": "1051:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8006, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1051:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8009, + "mutability": "mutable", + "name": "b", + "nameLocation": "1068:1:21", + "nodeType": "VariableDeclaration", + "scope": 8023, + "src": "1061:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8008, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1061:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "1050:20:21" + }, + "returnParameters": { + "id": 8013, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8012, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 8023, + "src": "1094:6:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8011, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1094:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "1093:8:21" + }, + "scope": 8113, + "src": "1038:108:21", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 8041, + "nodeType": "Block", + "src": "1288:44:21", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8036, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8034, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8026, + "src": "1313:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 8035, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8028, + "src": "1317:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "1313:5:21", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "id": 8037, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8026, + "src": "1320:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + { + "id": 8038, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8028, + "src": "1323:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 8033, + "name": "ternary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8004, + "src": "1305:7:21", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$_t_int256_$_t_int256_$returns$_t_int256_$", + "typeString": "function (bool,int256,int256) pure returns (int256)" + } + }, + "id": 8039, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1305:20:21", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "functionReturnParameters": 8032, + "id": 8040, + "nodeType": "Return", + "src": "1298:27:21" + } + ] + }, + "documentation": { + "id": 8024, + "nodeType": "StructuredDocumentation", + "src": "1152:67:21", + "text": " @dev Returns the smallest of two signed numbers." + }, + "id": 8042, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "min", + "nameLocation": "1233:3:21", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8029, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8026, + "mutability": "mutable", + "name": "a", + "nameLocation": "1244:1:21", + "nodeType": "VariableDeclaration", + "scope": 8042, + "src": "1237:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8025, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1237:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8028, + "mutability": "mutable", + "name": "b", + "nameLocation": "1254:1:21", + "nodeType": "VariableDeclaration", + "scope": 8042, + "src": "1247:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8027, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1247:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "1236:20:21" + }, + "returnParameters": { + "id": 8032, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8031, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 8042, + "src": "1280:6:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8030, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1280:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "1279:8:21" + }, + "scope": 8113, + "src": "1224:108:21", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 8085, + "nodeType": "Block", + "src": "1537:162:21", + "statements": [ + { + "assignments": [ + 8053 + ], + "declarations": [ + { + "constant": false, + "id": 8053, + "mutability": "mutable", + "name": "x", + "nameLocation": "1606:1:21", + "nodeType": "VariableDeclaration", + "scope": 8085, + "src": "1599:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8052, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1599:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "id": 8066, + "initialValue": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8065, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8056, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8054, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8045, + "src": "1611:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "id": 8055, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8047, + "src": "1615:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "1611:5:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 8057, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1610:7:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8063, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8060, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8058, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8045, + "src": "1622:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "^", + "rightExpression": { + "id": 8059, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8047, + "src": "1626:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "1622:5:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 8061, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1621:7:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "31", + "id": 8062, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1632:1:21", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "1621:12:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 8064, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1620:14:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "1610:24:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1599:35:21" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8083, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8067, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8053, + "src": "1651:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8081, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 8075, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 8072, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8053, + "src": "1671:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 8071, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1663:7:21", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 8070, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1663:7:21", + "typeDescriptions": {} + } + }, + "id": 8073, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1663:10:21", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "323535", + "id": 8074, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1677:3:21", + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "255" + }, + "src": "1663:17:21", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 8069, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1656:6:21", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + }, + "typeName": { + "id": 8068, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1656:6:21", + "typeDescriptions": {} + } + }, + "id": 8076, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1656:25:21", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8079, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8077, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8045, + "src": "1685:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "^", + "rightExpression": { + "id": 8078, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8047, + "src": "1689:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "1685:5:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 8080, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1684:7:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "1656:35:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 8082, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1655:37:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "1651:41:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "functionReturnParameters": 8051, + "id": 8084, + "nodeType": "Return", + "src": "1644:48:21" + } + ] + }, + "documentation": { + "id": 8043, + "nodeType": "StructuredDocumentation", + "src": "1338:126:21", + "text": " @dev Returns the average of two signed numbers without overflow.\n The result is rounded towards zero." + }, + "id": 8086, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "average", + "nameLocation": "1478:7:21", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8048, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8045, + "mutability": "mutable", + "name": "a", + "nameLocation": "1493:1:21", + "nodeType": "VariableDeclaration", + "scope": 8086, + "src": "1486:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8044, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1486:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8047, + "mutability": "mutable", + "name": "b", + "nameLocation": "1503:1:21", + "nodeType": "VariableDeclaration", + "scope": 8086, + "src": "1496:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8046, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1496:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "1485:20:21" + }, + "returnParameters": { + "id": 8051, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8050, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 8086, + "src": "1529:6:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8049, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1529:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "1528:8:21" + }, + "scope": 8113, + "src": "1469:230:21", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 8111, + "nodeType": "Block", + "src": "1843:767:21", + "statements": [ + { + "id": 8110, + "nodeType": "UncheckedBlock", + "src": "1853:751:21", + "statements": [ + { + "assignments": [ + 8095 + ], + "declarations": [ + { + "constant": false, + "id": 8095, + "mutability": "mutable", + "name": "mask", + "nameLocation": "2424:4:21", + "nodeType": "VariableDeclaration", + "scope": 8110, + "src": "2417:11:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8094, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "2417:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "id": 8099, + "initialValue": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8098, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8096, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8089, + "src": "2431:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "323535", + "id": 8097, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2436:3:21", + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "255" + }, + "src": "2431:8:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2417:22:21" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8107, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8104, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8102, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8089, + "src": "2576:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "id": 8103, + "name": "mask", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8095, + "src": "2580:4:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "2576:8:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 8105, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "2575:10:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "^", + "rightExpression": { + "id": 8106, + "name": "mask", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8095, + "src": "2588:4:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "2575:17:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 8101, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2567:7:21", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 8100, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2567:7:21", + "typeDescriptions": {} + } + }, + "id": 8108, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2567:26:21", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 8093, + "id": 8109, + "nodeType": "Return", + "src": "2560:33:21" + } + ] + } + ] + }, + "documentation": { + "id": 8087, + "nodeType": "StructuredDocumentation", + "src": "1705:78:21", + "text": " @dev Returns the absolute unsigned value of a signed value." + }, + "id": 8112, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "abs", + "nameLocation": "1797:3:21", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8090, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8089, + "mutability": "mutable", + "name": "n", + "nameLocation": "1808:1:21", + "nodeType": "VariableDeclaration", + "scope": 8112, + "src": "1801:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8088, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1801:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "1800:10:21" + }, + "returnParameters": { + "id": 8093, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8092, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 8112, + "src": "1834:7:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8091, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1834:7:21", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1833:9:21" + }, + "scope": 8113, + "src": "1788:822:21", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + } + ], + "scope": 8114, + "src": "258:2354:21", + "usedErrors": [], + "usedEvents": [] + } + ], + "src": "109:2504:21" + }, + "id": 21 + }, + "contracts/TokenRelayer.sol": { + "ast": { + "absolutePath": "contracts/TokenRelayer.sol", + "exportedSymbols": { + "ECDSA": [ + 4137 + ], + "EIP712": [ + 4364 + ], + "IERC20": [ + 340 + ], + "IERC20Permit": [ + 376 + ], + "Ownable": [ + 147 + ], + "ReentrancyGuard": [ + 1827 + ], + "SafeERC20": [ + 831 + ], + "TokenRelayer": [ + 8603 + ] + }, + "id": 8604, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 8115, + "literals": [ + "solidity", + "^", + "0.8", + ".28" + ], + "nodeType": "PragmaDirective", + "src": "32:24:22" + }, + { + "absolutePath": "@openzeppelin/contracts/access/Ownable.sol", + "file": "@openzeppelin/contracts/access/Ownable.sol", + "id": 8117, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 8604, + "sourceUnit": 148, + "src": "58:67:22", + "symbolAliases": [ + { + "foreign": { + "id": 8116, + "name": "Ownable", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 147, + "src": "66:7:22", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/token/ERC20/IERC20.sol", + "file": "@openzeppelin/contracts/token/ERC20/IERC20.sol", + "id": 8119, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 8604, + "sourceUnit": 341, + "src": "126:70:22", + "symbolAliases": [ + { + "foreign": { + "id": 8118, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "134:6:22", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol", + "file": "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol", + "id": 8121, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 8604, + "sourceUnit": 377, + "src": "197:93:22", + "symbolAliases": [ + { + "foreign": { + "id": 8120, + "name": "IERC20Permit", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 376, + "src": "205:12:22", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol", + "file": "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol", + "id": 8123, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 8604, + "sourceUnit": 832, + "src": "291:82:22", + "symbolAliases": [ + { + "foreign": { + "id": 8122, + "name": "SafeERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "299:9:22", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/ReentrancyGuard.sol", + "file": "@openzeppelin/contracts/utils/ReentrancyGuard.sol", + "id": 8125, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 8604, + "sourceUnit": 1828, + "src": "374:82:22", + "symbolAliases": [ + { + "foreign": { + "id": 8124, + "name": "ReentrancyGuard", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1827, + "src": "382:15:22", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/cryptography/ECDSA.sol", + "file": "@openzeppelin/contracts/utils/cryptography/ECDSA.sol", + "id": 8127, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 8604, + "sourceUnit": 4138, + "src": "457:75:22", + "symbolAliases": [ + { + "foreign": { + "id": 8126, + "name": "ECDSA", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4137, + "src": "465:5:22", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/cryptography/EIP712.sol", + "file": "@openzeppelin/contracts/utils/cryptography/EIP712.sol", + "id": 8129, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 8604, + "sourceUnit": 4365, + "src": "533:77:22", + "symbolAliases": [ + { + "foreign": { + "id": 8128, + "name": "EIP712", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4364, + "src": "541:6:22", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [ + { + "baseName": { + "id": 8131, + "name": "Ownable", + "nameLocations": [ + "1183:7:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 147, + "src": "1183:7:22" + }, + "id": 8132, + "nodeType": "InheritanceSpecifier", + "src": "1183:7:22" + }, + { + "baseName": { + "id": 8133, + "name": "ReentrancyGuard", + "nameLocations": [ + "1192:15:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1827, + "src": "1192:15:22" + }, + "id": 8134, + "nodeType": "InheritanceSpecifier", + "src": "1192:15:22" + }, + { + "baseName": { + "id": 8135, + "name": "EIP712", + "nameLocations": [ + "1209:6:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4364, + "src": "1209:6:22" + }, + "id": 8136, + "nodeType": "InheritanceSpecifier", + "src": "1209:6:22" + } + ], + "canonicalName": "TokenRelayer", + "contractDependencies": [], + "contractKind": "contract", + "documentation": { + "id": 8130, + "nodeType": "StructuredDocumentation", + "src": "612:545:22", + "text": " @title TokenRelayer\n @notice A relayer contract that accepts ERC20 permit signatures and executes\n arbitrary calls to a destination contract, both authorized via signature.\n \n Flow:\n 1. User signs a permit allowing the relayer to spend their tokens\n 2. User signs a payload (e.g., transfer from relayer to another user)\n 3. Relayer:\n a. Executes permit to approve the tokens\n b. Transfers tokens from user to relayer (via transferFrom)\n c. Forwards the payload call (transfer from relayer to another user)" + }, + "fullyImplemented": true, + "id": 8603, + "linearizedBaseContracts": [ + 8603, + 4364, + 262, + 1827, + 147, + 1662 + ], + "name": "TokenRelayer", + "nameLocation": "1167:12:22", + "nodeType": "ContractDefinition", + "nodes": [ + { + "global": false, + "id": 8140, + "libraryName": { + "id": 8137, + "name": "SafeERC20", + "nameLocations": [ + "1228:9:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 831, + "src": "1228:9:22" + }, + "nodeType": "UsingForDirective", + "src": "1222:27:22", + "typeName": { + "id": 8139, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 8138, + "name": "IERC20", + "nameLocations": [ + "1242:6:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "1242:6:22" + }, + "referencedDeclaration": 340, + "src": "1242:6:22", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + } + }, + { + "constant": true, + "id": 8145, + "mutability": "constant", + "name": "_TYPE_HASH_PAYLOAD", + "nameLocation": "1335:18:22", + "nodeType": "VariableDeclaration", + "scope": 8603, + "src": "1310:202:22", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8141, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1310:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": { + "arguments": [ + { + "hexValue": "5061796c6f616428616464726573732064657374696e6174696f6e2c61646472657373206f776e65722c6164647265737320746f6b656e2c75696e743235362076616c75652c627974657320646174612c75696e743235362065746856616c75652c75696e74323536206e6f6e63652c75696e7432353620646561646c696e6529", + "id": 8143, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1375:131:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_f0543e2024fd0ae16ccb842686c2733758ec65acfd69fb599c05b286f8db8844", + "typeString": "literal_string \"Payload(address destination,address owner,address token,uint256 value,bytes data,uint256 ethValue,uint256 nonce,uint256 deadline)\"" + }, + "value": "Payload(address destination,address owner,address token,uint256 value,bytes data,uint256 ethValue,uint256 nonce,uint256 deadline)" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_f0543e2024fd0ae16ccb842686c2733758ec65acfd69fb599c05b286f8db8844", + "typeString": "literal_string \"Payload(address destination,address owner,address token,uint256 value,bytes data,uint256 ethValue,uint256 nonce,uint256 deadline)\"" + } + ], + "id": 8142, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "1356:9:22", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 8144, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1356:156:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "private" + }, + { + "constant": false, + "functionSelector": "75bd6863", + "id": 8147, + "mutability": "immutable", + "name": "destinationContract", + "nameLocation": "1544:19:22", + "nodeType": "VariableDeclaration", + "scope": 8603, + "src": "1519:44:22", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8146, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1519:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "public" + }, + { + "constant": false, + "functionSelector": "d850124e", + "id": 8153, + "mutability": "mutable", + "name": "usedPayloadNonces", + "nameLocation": "1622:17:22", + "nodeType": "VariableDeclaration", + "scope": 8603, + "src": "1570:69:22", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_uint256_$_t_bool_$_$", + "typeString": "mapping(address => mapping(uint256 => bool))" + }, + "typeName": { + "id": 8152, + "keyName": "", + "keyNameLocation": "-1:-1:-1", + "keyType": { + "id": 8148, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1578:7:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Mapping", + "src": "1570:44:22", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_uint256_$_t_bool_$_$", + "typeString": "mapping(address => mapping(uint256 => bool))" + }, + "valueName": "", + "valueNameLocation": "-1:-1:-1", + "valueType": { + "id": 8151, + "keyName": "", + "keyNameLocation": "-1:-1:-1", + "keyType": { + "id": 8149, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1597:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Mapping", + "src": "1589:24:22", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_bool_$", + "typeString": "mapping(uint256 => bool)" + }, + "valueName": "", + "valueNameLocation": "-1:-1:-1", + "valueType": { + "id": 8150, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "1608:4:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + } + }, + "visibility": "public" + }, + { + "canonicalName": "TokenRelayer.ExecuteParams", + "id": 8182, + "members": [ + { + "constant": false, + "id": 8155, + "mutability": "mutable", + "name": "token", + "nameLocation": "1768:5:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1760:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8154, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1760:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8157, + "mutability": "mutable", + "name": "owner", + "nameLocation": "1791:5:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1783:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8156, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1783:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8159, + "mutability": "mutable", + "name": "value", + "nameLocation": "1814:5:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1806:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8158, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1806:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8161, + "mutability": "mutable", + "name": "deadline", + "nameLocation": "1837:8:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1829:16:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8160, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1829:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8163, + "mutability": "mutable", + "name": "permitV", + "nameLocation": "1861:7:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1855:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 8162, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "1855:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8165, + "mutability": "mutable", + "name": "permitR", + "nameLocation": "1886:7:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1878:15:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8164, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1878:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8167, + "mutability": "mutable", + "name": "permitS", + "nameLocation": "1911:7:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1903:15:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8166, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1903:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8169, + "mutability": "mutable", + "name": "payloadData", + "nameLocation": "1934:11:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1928:17:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 8168, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1928:5:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8171, + "mutability": "mutable", + "name": "payloadValue", + "nameLocation": "1963:12:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1955:20:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8170, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1955:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8173, + "mutability": "mutable", + "name": "payloadNonce", + "nameLocation": "1993:12:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1985:20:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8172, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1985:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8175, + "mutability": "mutable", + "name": "payloadDeadline", + "nameLocation": "2023:15:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "2015:23:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8174, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2015:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8177, + "mutability": "mutable", + "name": "payloadV", + "nameLocation": "2054:8:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "2048:14:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 8176, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "2048:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8179, + "mutability": "mutable", + "name": "payloadR", + "nameLocation": "2080:8:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "2072:16:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8178, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2072:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8181, + "mutability": "mutable", + "name": "payloadS", + "nameLocation": "2106:8:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "2098:16:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8180, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2098:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "name": "ExecuteParams", + "nameLocation": "1736:13:22", + "nodeType": "StructDefinition", + "scope": 8603, + "src": "1729:392:22", + "visibility": "public" + }, + { + "anonymous": false, + "eventSelector": "78129a649632642d8e9f346c85d9efb70d32d50a36774c4585491a9228bbd350", + "id": 8190, + "name": "RelayerExecuted", + "nameLocation": "2133:15:22", + "nodeType": "EventDefinition", + "parameters": { + "id": 8189, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8184, + "indexed": true, + "mutability": "mutable", + "name": "signer", + "nameLocation": "2174:6:22", + "nodeType": "VariableDeclaration", + "scope": 8190, + "src": "2158:22:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8183, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2158:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8186, + "indexed": true, + "mutability": "mutable", + "name": "token", + "nameLocation": "2206:5:22", + "nodeType": "VariableDeclaration", + "scope": 8190, + "src": "2190:21:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8185, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2190:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8188, + "indexed": false, + "mutability": "mutable", + "name": "amount", + "nameLocation": "2229:6:22", + "nodeType": "VariableDeclaration", + "scope": 8190, + "src": "2221:14:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8187, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2221:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2148:93:22" + }, + "src": "2127:115:22" + }, + { + "anonymous": false, + "eventSelector": "a0524ee0fd8662d6c046d199da2a6d3dc49445182cec055873a5bb9c2843c8e0", + "id": 8198, + "name": "TokenWithdrawn", + "nameLocation": "2294:14:22", + "nodeType": "EventDefinition", + "parameters": { + "id": 8197, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8192, + "indexed": true, + "mutability": "mutable", + "name": "token", + "nameLocation": "2325:5:22", + "nodeType": "VariableDeclaration", + "scope": 8198, + "src": "2309:21:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8191, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2309:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8194, + "indexed": false, + "mutability": "mutable", + "name": "amount", + "nameLocation": "2340:6:22", + "nodeType": "VariableDeclaration", + "scope": 8198, + "src": "2332:14:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8193, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2332:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8196, + "indexed": true, + "mutability": "mutable", + "name": "to", + "nameLocation": "2364:2:22", + "nodeType": "VariableDeclaration", + "scope": 8198, + "src": "2348:18:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8195, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2348:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "2308:59:22" + }, + "src": "2288:80:22" + }, + { + "anonymous": false, + "eventSelector": "6148672a948a12b8e0bf92a9338349b9ac890fad62a234abaf0a4da99f62cfcc", + "id": 8204, + "name": "ETHWithdrawn", + "nameLocation": "2379:12:22", + "nodeType": "EventDefinition", + "parameters": { + "id": 8203, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8200, + "indexed": false, + "mutability": "mutable", + "name": "amount", + "nameLocation": "2400:6:22", + "nodeType": "VariableDeclaration", + "scope": 8204, + "src": "2392:14:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8199, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2392:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8202, + "indexed": true, + "mutability": "mutable", + "name": "to", + "nameLocation": "2424:2:22", + "nodeType": "VariableDeclaration", + "scope": 8204, + "src": "2408:18:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8201, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2408:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "2391:36:22" + }, + "src": "2373:55:22" + }, + { + "body": { + "id": 8231, + "nodeType": "Block", + "src": "2614:135:22", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 8223, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8218, + "name": "_destinationContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8206, + "src": "2632:20:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 8221, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2664:1:22", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 8220, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2656:7:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 8219, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2656:7:22", + "typeDescriptions": {} + } + }, + "id": 8222, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2656:10:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "2632:34:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "496e76616c69642064657374696e6174696f6e", + "id": 8224, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2668:21:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_480a3d2cf1e4838d740f40eac57f23eb6facc0baaf1a65a7b61df6a5a00ed368", + "typeString": "literal_string \"Invalid destination\"" + }, + "value": "Invalid destination" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_480a3d2cf1e4838d740f40eac57f23eb6facc0baaf1a65a7b61df6a5a00ed368", + "typeString": "literal_string \"Invalid destination\"" + } + ], + "id": 8217, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "2624:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8225, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2624:66:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8226, + "nodeType": "ExpressionStatement", + "src": "2624:66:22" + }, + { + "expression": { + "id": 8229, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 8227, + "name": "destinationContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8147, + "src": "2700:19:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 8228, + "name": "_destinationContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8206, + "src": "2722:20:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "2700:42:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 8230, + "nodeType": "ExpressionStatement", + "src": "2700:42:22" + } + ] + }, + "id": 8232, + "implemented": true, + "kind": "constructor", + "modifiers": [ + { + "arguments": [ + { + "expression": { + "id": 8209, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -15, + "src": "2562:3:22", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 8210, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2566:6:22", + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "2562:10:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "id": 8211, + "kind": "baseConstructorSpecifier", + "modifierName": { + "id": 8208, + "name": "Ownable", + "nameLocations": [ + "2554:7:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 147, + "src": "2554:7:22" + }, + "nodeType": "ModifierInvocation", + "src": "2554:19:22" + }, + { + "arguments": [ + { + "hexValue": "546f6b656e52656c61796572", + "id": 8213, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2589:14:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_142b4a499251a4eacaab3f10318ce24bd0fa67fa5375e1dfcd0a44e62c5b47a4", + "typeString": "literal_string \"TokenRelayer\"" + }, + "value": "TokenRelayer" + }, + { + "hexValue": "31", + "id": 8214, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2605:3:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_c89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6", + "typeString": "literal_string \"1\"" + }, + "value": "1" + } + ], + "id": 8215, + "kind": "baseConstructorSpecifier", + "modifierName": { + "id": 8212, + "name": "EIP712", + "nameLocations": [ + "2582:6:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4364, + "src": "2582:6:22" + }, + "nodeType": "ModifierInvocation", + "src": "2582:27:22" + } + ], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8207, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8206, + "mutability": "mutable", + "name": "_destinationContract", + "nameLocation": "2524:20:22", + "nodeType": "VariableDeclaration", + "scope": 8232, + "src": "2516:28:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8205, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2516:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "2515:30:22" + }, + "returnParameters": { + "id": 8216, + "nodeType": "ParameterList", + "parameters": [], + "src": "2614:0:22" + }, + "scope": 8603, + "src": "2504:245:22", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 8235, + "nodeType": "Block", + "src": "2852:2:22", + "statements": [] + }, + "id": 8236, + "implemented": true, + "kind": "receive", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8233, + "nodeType": "ParameterList", + "parameters": [], + "src": "2832:2:22" + }, + "returnParameters": { + "id": 8234, + "nodeType": "ParameterList", + "parameters": [], + "src": "2852:0:22" + }, + "scope": 8603, + "src": "2825:29:22", + "stateMutability": "payable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 8401, + "nodeType": "Block", + "src": "3073:1918:22", + "statements": [ + { + "assignments": [ + 8245 + ], + "declarations": [ + { + "constant": false, + "id": 8245, + "mutability": "mutable", + "name": "owner", + "nameLocation": "3091:5:22", + "nodeType": "VariableDeclaration", + "scope": 8401, + "src": "3083:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8244, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3083:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "id": 8248, + "initialValue": { + "expression": { + "id": 8246, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3099:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8247, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3106:5:22", + "memberName": "owner", + "nodeType": "MemberAccess", + "referencedDeclaration": 8157, + "src": "3099:12:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3083:28:22" + }, + { + "assignments": [ + 8250 + ], + "declarations": [ + { + "constant": false, + "id": 8250, + "mutability": "mutable", + "name": "nonce", + "nameLocation": "3129:5:22", + "nodeType": "VariableDeclaration", + "scope": 8401, + "src": "3121:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8249, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3121:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 8253, + "initialValue": { + "expression": { + "id": 8251, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3137:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8252, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3144:12:22", + "memberName": "payloadNonce", + "nodeType": "MemberAccess", + "referencedDeclaration": 8173, + "src": "3137:19:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3121:35:22" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 8260, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8255, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8245, + "src": "3201:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 8258, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3218:1:22", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 8257, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3210:7:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 8256, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3210:7:22", + "typeDescriptions": {} + } + }, + "id": 8259, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3210:10:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "3201:19:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "496e76616c6964206f776e6572", + "id": 8261, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3222:15:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_110461b12e459dc76e692e7a47f9621cf45c7d48020c3c7b2066107cdf1f52ae", + "typeString": "literal_string \"Invalid owner\"" + }, + "value": "Invalid owner" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_110461b12e459dc76e692e7a47f9621cf45c7d48020c3c7b2066107cdf1f52ae", + "typeString": "literal_string \"Invalid owner\"" + } + ], + "id": 8254, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "3193:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8262, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3193:45:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8263, + "nodeType": "ExpressionStatement", + "src": "3193:45:22" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 8271, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 8265, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3256:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8266, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3263:5:22", + "memberName": "token", + "nodeType": "MemberAccess", + "referencedDeclaration": 8155, + "src": "3256:12:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 8269, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3280:1:22", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 8268, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3272:7:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 8267, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3272:7:22", + "typeDescriptions": {} + } + }, + "id": 8270, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3272:10:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "3256:26:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "496e76616c696420746f6b656e", + "id": 8272, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3284:15:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_5e70ebd1d4072d337a7fabaa7bda70fa2633d6e3f89d5cb725a16b10d07e54c6", + "typeString": "literal_string \"Invalid token\"" + }, + "value": "Invalid token" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_5e70ebd1d4072d337a7fabaa7bda70fa2633d6e3f89d5cb725a16b10d07e54c6", + "typeString": "literal_string \"Invalid token\"" + } + ], + "id": 8264, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "3248:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8273, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3248:52:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8274, + "nodeType": "ExpressionStatement", + "src": "3248:52:22" + }, + { + "expression": { + "arguments": [ + { + "id": 8281, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "3318:32:22", + "subExpression": { + "baseExpression": { + "baseExpression": { + "id": 8276, + "name": "usedPayloadNonces", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8153, + "src": "3319:17:22", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_uint256_$_t_bool_$_$", + "typeString": "mapping(address => mapping(uint256 => bool))" + } + }, + "id": 8278, + "indexExpression": { + "id": 8277, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8245, + "src": "3337:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "3319:24:22", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_bool_$", + "typeString": "mapping(uint256 => bool)" + } + }, + "id": 8280, + "indexExpression": { + "id": 8279, + "name": "nonce", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8250, + "src": "3344:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "3319:31:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "4e6f6e63652075736564", + "id": 8282, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3352:12:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_15d72127d094a30af360ead73641c61eda3d745ce4d04d12675a5e9a899f8b21", + "typeString": "literal_string \"Nonce used\"" + }, + "value": "Nonce used" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_15d72127d094a30af360ead73641c61eda3d745ce4d04d12675a5e9a899f8b21", + "typeString": "literal_string \"Nonce used\"" + } + ], + "id": 8275, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "3310:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8283, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3310:55:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8284, + "nodeType": "ExpressionStatement", + "src": "3310:55:22" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 8290, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 8286, + "name": "block", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -4, + "src": "3383:5:22", + "typeDescriptions": { + "typeIdentifier": "t_magic_block", + "typeString": "block" + } + }, + "id": 8287, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3389:9:22", + "memberName": "timestamp", + "nodeType": "MemberAccess", + "src": "3383:15:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<=", + "rightExpression": { + "expression": { + "id": 8288, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3402:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8289, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3409:15:22", + "memberName": "payloadDeadline", + "nodeType": "MemberAccess", + "referencedDeclaration": 8175, + "src": "3402:22:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3383:41:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "5061796c6f61642065787069726564", + "id": 8291, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3426:17:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_27859e47e6c2167c8e8d38addfca16b9afb9d8e9750b6a1e67c29196d4d99fae", + "typeString": "literal_string \"Payload expired\"" + }, + "value": "Payload expired" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_27859e47e6c2167c8e8d38addfca16b9afb9d8e9750b6a1e67c29196d4d99fae", + "typeString": "literal_string \"Payload expired\"" + } + ], + "id": 8285, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "3375:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8292, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3375:69:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8293, + "nodeType": "ExpressionStatement", + "src": "3375:69:22" + }, + { + "assignments": [ + 8295 + ], + "declarations": [ + { + "constant": false, + "id": 8295, + "mutability": "mutable", + "name": "digest", + "nameLocation": "3531:6:22", + "nodeType": "VariableDeclaration", + "scope": 8401, + "src": "3523:14:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8294, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3523:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 8310, + "initialValue": { + "arguments": [ + { + "id": 8297, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8245, + "src": "3568:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 8298, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3587:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8299, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3594:5:22", + "memberName": "token", + "nodeType": "MemberAccess", + "referencedDeclaration": 8155, + "src": "3587:12:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 8300, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3613:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8301, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3620:5:22", + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": 8159, + "src": "3613:12:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 8302, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3639:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8303, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3646:11:22", + "memberName": "payloadData", + "nodeType": "MemberAccess", + "referencedDeclaration": 8169, + "src": "3639:18:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + } + }, + { + "expression": { + "id": 8304, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3671:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8305, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3678:12:22", + "memberName": "payloadValue", + "nodeType": "MemberAccess", + "referencedDeclaration": 8171, + "src": "3671:19:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 8306, + "name": "nonce", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8250, + "src": "3704:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 8307, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3723:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8308, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3730:15:22", + "memberName": "payloadDeadline", + "nodeType": "MemberAccess", + "referencedDeclaration": 8175, + "src": "3723:22:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 8296, + "name": "_computeDigest", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8441, + "src": "3540:14:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_address_$_t_address_$_t_uint256_$_t_bytes_memory_ptr_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (address,address,uint256,bytes memory,uint256,uint256,uint256) view returns (bytes32)" + } + }, + "id": 8309, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3540:215:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3523:232:22" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 8323, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 8314, + "name": "digest", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8295, + "src": "3864:6:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 8315, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3872:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8316, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3879:8:22", + "memberName": "payloadV", + "nodeType": "MemberAccess", + "referencedDeclaration": 8177, + "src": "3872:15:22", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + { + "expression": { + "id": 8317, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3889:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8318, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3896:8:22", + "memberName": "payloadR", + "nodeType": "MemberAccess", + "referencedDeclaration": 8179, + "src": "3889:15:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 8319, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3906:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8320, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3913:8:22", + "memberName": "payloadS", + "nodeType": "MemberAccess", + "referencedDeclaration": 8181, + "src": "3906:15:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "id": 8312, + "name": "ECDSA", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4137, + "src": "3850:5:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_ECDSA_$4137_$", + "typeString": "type(library ECDSA)" + } + }, + "id": 8313, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3856:7:22", + "memberName": "recover", + "nodeType": "MemberAccess", + "referencedDeclaration": 4059, + "src": "3850:13:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_uint8_$_t_bytes32_$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32,uint8,bytes32,bytes32) pure returns (address)" + } + }, + "id": 8321, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3850:72:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 8322, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8245, + "src": "3926:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "3850:81:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "496e76616c696420736967", + "id": 8324, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3933:13:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_31734eed34fab74fa1579246aaad104a344891a284044483c0c5a792a9f83a72", + "typeString": "literal_string \"Invalid sig\"" + }, + "value": "Invalid sig" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_31734eed34fab74fa1579246aaad104a344891a284044483c0c5a792a9f83a72", + "typeString": "literal_string \"Invalid sig\"" + } + ], + "id": 8311, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "3842:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8325, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3842:105:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8326, + "nodeType": "ExpressionStatement", + "src": "3842:105:22" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 8332, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 8328, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -15, + "src": "3966:3:22", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 8329, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3970:5:22", + "memberName": "value", + "nodeType": "MemberAccess", + "src": "3966:9:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "expression": { + "id": 8330, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3979:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8331, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3986:12:22", + "memberName": "payloadValue", + "nodeType": "MemberAccess", + "referencedDeclaration": 8171, + "src": "3979:19:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3966:32:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "496e636f7272656374204554482076616c75652070726f7669646564", + "id": 8333, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4000:30:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_a793dc5bde52ab2d5349f1208a34905b1d68ab9298f549a2e514542cba0a8c76", + "typeString": "literal_string \"Incorrect ETH value provided\"" + }, + "value": "Incorrect ETH value provided" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_a793dc5bde52ab2d5349f1208a34905b1d68ab9298f549a2e514542cba0a8c76", + "typeString": "literal_string \"Incorrect ETH value provided\"" + } + ], + "id": 8327, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "3958:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8334, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3958:73:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8335, + "nodeType": "ExpressionStatement", + "src": "3958:73:22" + }, + { + "expression": { + "id": 8342, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "baseExpression": { + "id": 8336, + "name": "usedPayloadNonces", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8153, + "src": "4158:17:22", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_uint256_$_t_bool_$_$", + "typeString": "mapping(address => mapping(uint256 => bool))" + } + }, + "id": 8339, + "indexExpression": { + "id": 8337, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8245, + "src": "4176:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4158:24:22", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_bool_$", + "typeString": "mapping(uint256 => bool)" + } + }, + "id": 8340, + "indexExpression": { + "id": 8338, + "name": "nonce", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8250, + "src": "4183:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "4158:31:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "hexValue": "74727565", + "id": 8341, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4192:4:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "src": "4158:38:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 8343, + "nodeType": "ExpressionStatement", + "src": "4158:38:22" + }, + { + "expression": { + "arguments": [ + { + "expression": { + "id": 8345, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4342:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8346, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4349:5:22", + "memberName": "token", + "nodeType": "MemberAccess", + "referencedDeclaration": 8155, + "src": "4342:12:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 8347, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8245, + "src": "4368:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 8348, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4387:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8349, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4394:5:22", + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": 8159, + "src": "4387:12:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 8350, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4413:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8351, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4420:8:22", + "memberName": "deadline", + "nodeType": "MemberAccess", + "referencedDeclaration": 8161, + "src": "4413:15:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 8352, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4442:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8353, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4449:7:22", + "memberName": "permitV", + "nodeType": "MemberAccess", + "referencedDeclaration": 8163, + "src": "4442:14:22", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + { + "expression": { + "id": 8354, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4470:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8355, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4477:7:22", + "memberName": "permitR", + "nodeType": "MemberAccess", + "referencedDeclaration": 8165, + "src": "4470:14:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 8356, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4498:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8357, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4505:7:22", + "memberName": "permitS", + "nodeType": "MemberAccess", + "referencedDeclaration": 8167, + "src": "4498:14:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 8344, + "name": "_executePermitAndTransfer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8508, + "src": "4303:25:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_address_$_t_uint256_$_t_uint256_$_t_uint8_$_t_bytes32_$_t_bytes32_$returns$__$", + "typeString": "function (address,address,uint256,uint256,uint8,bytes32,bytes32)" + } + }, + "id": 8358, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4303:219:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8359, + "nodeType": "ExpressionStatement", + "src": "4303:219:22" + }, + { + "expression": { + "arguments": [ + { + "id": 8365, + "name": "destinationContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8147, + "src": "4626:19:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 8366, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4647:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8367, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4654:5:22", + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": 8159, + "src": "4647:12:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [ + { + "expression": { + "id": 8361, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4599:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8362, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4606:5:22", + "memberName": "token", + "nodeType": "MemberAccess", + "referencedDeclaration": 8155, + "src": "4599:12:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 8360, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "4592:6:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$340_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 8363, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4592:20:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "id": 8364, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4613:12:22", + "memberName": "forceApprove", + "nodeType": "MemberAccess", + "referencedDeclaration": 626, + "src": "4592:33:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$returns$__$attached_to$_t_contract$_IERC20_$340_$", + "typeString": "function (contract IERC20,address,uint256)" + } + }, + "id": 8368, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4592:68:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8369, + "nodeType": "ExpressionStatement", + "src": "4592:68:22" + }, + { + "assignments": [ + 8371 + ], + "declarations": [ + { + "constant": false, + "id": 8371, + "mutability": "mutable", + "name": "callSuccess", + "nameLocation": "4676:11:22", + "nodeType": "VariableDeclaration", + "scope": 8401, + "src": "4671:16:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 8370, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "4671:4:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "id": 8378, + "initialValue": { + "arguments": [ + { + "expression": { + "id": 8373, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4703:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8374, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4710:11:22", + "memberName": "payloadData", + "nodeType": "MemberAccess", + "referencedDeclaration": 8169, + "src": "4703:18:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + } + }, + { + "expression": { + "id": 8375, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -15, + "src": "4723:3:22", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 8376, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4727:5:22", + "memberName": "value", + "nodeType": "MemberAccess", + "src": "4723:9:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 8372, + "name": "_forwardCall", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8529, + "src": "4690:12:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bool_$", + "typeString": "function (bytes memory,uint256) returns (bool)" + } + }, + "id": 8377, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4690:43:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4671:62:22" + }, + { + "expression": { + "arguments": [ + { + "id": 8380, + "name": "callSuccess", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8371, + "src": "4751:11:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "43616c6c206661696c6564", + "id": 8381, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4764:13:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_066ad49a0ed9e5d6a9f3c20fca13a038f0a5d629f0aaf09d634ae2a7c232ac2b", + "typeString": "literal_string \"Call failed\"" + }, + "value": "Call failed" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_066ad49a0ed9e5d6a9f3c20fca13a038f0a5d629f0aaf09d634ae2a7c232ac2b", + "typeString": "literal_string \"Call failed\"" + } + ], + "id": 8379, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "4743:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8382, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4743:35:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8383, + "nodeType": "ExpressionStatement", + "src": "4743:35:22" + }, + { + "expression": { + "arguments": [ + { + "id": 8389, + "name": "destinationContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8147, + "src": "4895:19:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "hexValue": "30", + "id": 8390, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4916:1:22", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "expression": { + "arguments": [ + { + "expression": { + "id": 8385, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4868:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8386, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4875:5:22", + "memberName": "token", + "nodeType": "MemberAccess", + "referencedDeclaration": 8155, + "src": "4868:12:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 8384, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "4861:6:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$340_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 8387, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4861:20:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "id": 8388, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4882:12:22", + "memberName": "forceApprove", + "nodeType": "MemberAccess", + "referencedDeclaration": 626, + "src": "4861:33:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$returns$__$attached_to$_t_contract$_IERC20_$340_$", + "typeString": "function (contract IERC20,address,uint256)" + } + }, + "id": 8391, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4861:57:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8392, + "nodeType": "ExpressionStatement", + "src": "4861:57:22" + }, + { + "eventCall": { + "arguments": [ + { + "id": 8394, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8245, + "src": "4950:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 8395, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4957:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8396, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4964:5:22", + "memberName": "token", + "nodeType": "MemberAccess", + "referencedDeclaration": 8155, + "src": "4957:12:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 8397, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4971:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8398, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4978:5:22", + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": 8159, + "src": "4971:12:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 8393, + "name": "RelayerExecuted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8190, + "src": "4934:15:22", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$__$", + "typeString": "function (address,address,uint256)" + } + }, + "id": 8399, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4934:50:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8400, + "nodeType": "EmitStatement", + "src": "4929:55:22" + } + ] + }, + "functionSelector": "2af83bfe", + "id": 8402, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 8242, + "kind": "modifierInvocation", + "modifierName": { + "id": 8241, + "name": "nonReentrant", + "nameLocations": [ + "3060:12:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1757, + "src": "3060:12:22" + }, + "nodeType": "ModifierInvocation", + "src": "3060:12:22" + } + ], + "name": "execute", + "nameLocation": "3004:7:22", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8240, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8239, + "mutability": "mutable", + "name": "params", + "nameLocation": "3035:6:22", + "nodeType": "VariableDeclaration", + "scope": 8402, + "src": "3012:29:22", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams" + }, + "typeName": { + "id": 8238, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 8237, + "name": "ExecuteParams", + "nameLocations": [ + "3012:13:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 8182, + "src": "3012:13:22" + }, + "referencedDeclaration": 8182, + "src": "3012:13:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_storage_ptr", + "typeString": "struct TokenRelayer.ExecuteParams" + } + }, + "visibility": "internal" + } + ], + "src": "3011:31:22" + }, + "returnParameters": { + "id": 8243, + "nodeType": "ParameterList", + "parameters": [], + "src": "3073:0:22" + }, + "scope": 8603, + "src": "2995:1996:22", + "stateMutability": "payable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 8440, + "nodeType": "Block", + "src": "5285:400:22", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "id": 8425, + "name": "_TYPE_HASH_PAYLOAD", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8145, + "src": "5370:18:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 8426, + "name": "destinationContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8147, + "src": "5406:19:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 8427, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8404, + "src": "5494:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 8428, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8406, + "src": "5517:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 8429, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8408, + "src": "5540:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [ + { + "id": 8431, + "name": "data", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8410, + "src": "5573:4:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 8430, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "5563:9:22", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 8432, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5563:15:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 8433, + "name": "ethValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8412, + "src": "5596:8:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 8434, + "name": "nonce", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8414, + "src": "5622:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 8435, + "name": "deadline", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8416, + "src": "5645:8:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 8423, + "name": "abi", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -1, + "src": "5342:3:22", + "typeDescriptions": { + "typeIdentifier": "t_magic_abi", + "typeString": "abi" + } + }, + "id": 8424, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "5346:6:22", + "memberName": "encode", + "nodeType": "MemberAccess", + "src": "5342:10:22", + "typeDescriptions": { + "typeIdentifier": "t_function_abiencode_pure$__$returns$_t_bytes_memory_ptr_$", + "typeString": "function () pure returns (bytes memory)" + } + }, + "id": 8436, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5342:325:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 8422, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "5332:9:22", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 8437, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5332:336:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 8421, + "name": "_hashTypedDataV4", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4297, + "src": "5302:16:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_bytes32_$", + "typeString": "function (bytes32) view returns (bytes32)" + } + }, + "id": 8438, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5302:376:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 8420, + "id": 8439, + "nodeType": "Return", + "src": "5295:383:22" + } + ] + }, + "id": 8441, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_computeDigest", + "nameLocation": "5062:14:22", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8417, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8404, + "mutability": "mutable", + "name": "owner", + "nameLocation": "5094:5:22", + "nodeType": "VariableDeclaration", + "scope": 8441, + "src": "5086:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8403, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5086:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8406, + "mutability": "mutable", + "name": "token", + "nameLocation": "5117:5:22", + "nodeType": "VariableDeclaration", + "scope": 8441, + "src": "5109:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8405, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5109:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8408, + "mutability": "mutable", + "name": "value", + "nameLocation": "5140:5:22", + "nodeType": "VariableDeclaration", + "scope": 8441, + "src": "5132:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8407, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5132:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8410, + "mutability": "mutable", + "name": "data", + "nameLocation": "5168:4:22", + "nodeType": "VariableDeclaration", + "scope": 8441, + "src": "5155:17:22", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 8409, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5155:5:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8412, + "mutability": "mutable", + "name": "ethValue", + "nameLocation": "5190:8:22", + "nodeType": "VariableDeclaration", + "scope": 8441, + "src": "5182:16:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8411, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5182:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8414, + "mutability": "mutable", + "name": "nonce", + "nameLocation": "5216:5:22", + "nodeType": "VariableDeclaration", + "scope": 8441, + "src": "5208:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8413, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5208:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8416, + "mutability": "mutable", + "name": "deadline", + "nameLocation": "5239:8:22", + "nodeType": "VariableDeclaration", + "scope": 8441, + "src": "5231:16:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8415, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5231:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5076:177:22" + }, + "returnParameters": { + "id": 8420, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8419, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 8441, + "src": "5276:7:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8418, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5276:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "5275:9:22" + }, + "scope": 8603, + "src": "5053:632:22", + "stateMutability": "view", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 8507, + "nodeType": "Block", + "src": "6141:577:22", + "statements": [ + { + "clauses": [ + { + "block": { + "id": 8474, + "nodeType": "Block", + "src": "6291:43:22", + "statements": [] + }, + "errorName": "", + "id": 8475, + "nodeType": "TryCatchClause", + "src": "6291:43:22" + }, + { + "block": { + "id": 8492, + "nodeType": "Block", + "src": "6341:246:22", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 8488, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 8481, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8446, + "src": "6472:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "arguments": [ + { + "id": 8484, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "6487:4:22", + "typeDescriptions": { + "typeIdentifier": "t_contract$_TokenRelayer_$8603", + "typeString": "contract TokenRelayer" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_TokenRelayer_$8603", + "typeString": "contract TokenRelayer" + } + ], + "id": 8483, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6479:7:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 8482, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6479:7:22", + "typeDescriptions": {} + } + }, + "id": 8485, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6479:13:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "expression": { + "arguments": [ + { + "id": 8478, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8444, + "src": "6455:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 8477, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "6448:6:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$340_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 8479, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6448:13:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "id": 8480, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6462:9:22", + "memberName": "allowance", + "nodeType": "MemberAccess", + "referencedDeclaration": 317, + "src": "6448:23:22", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_address_$_t_address_$returns$_t_uint256_$", + "typeString": "function (address,address) view external returns (uint256)" + } + }, + "id": 8486, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6448:45:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "id": 8487, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8448, + "src": "6497:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6448:54:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "5065726d6974206661696c656420616e6420696e73756666696369656e7420616c6c6f77616e6365", + "id": 8489, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6520:42:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_0acc7f0c8df1a6717d2b423ae4591ac135687015764ac37dd4cf0150a9322b15", + "typeString": "literal_string \"Permit failed and insufficient allowance\"" + }, + "value": "Permit failed and insufficient allowance" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_0acc7f0c8df1a6717d2b423ae4591ac135687015764ac37dd4cf0150a9322b15", + "typeString": "literal_string \"Permit failed and insufficient allowance\"" + } + ], + "id": 8476, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "6423:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8490, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6423:153:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8491, + "nodeType": "ExpressionStatement", + "src": "6423:153:22" + } + ] + }, + "errorName": "", + "id": 8493, + "nodeType": "TryCatchClause", + "src": "6335:252:22" + } + ], + "externalCall": { + "arguments": [ + { + "id": 8463, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8446, + "src": "6243:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "arguments": [ + { + "id": 8466, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "6258:4:22", + "typeDescriptions": { + "typeIdentifier": "t_contract$_TokenRelayer_$8603", + "typeString": "contract TokenRelayer" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_TokenRelayer_$8603", + "typeString": "contract TokenRelayer" + } + ], + "id": 8465, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6250:7:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 8464, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6250:7:22", + "typeDescriptions": {} + } + }, + "id": 8467, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6250:13:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 8468, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8448, + "src": "6265:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 8469, + "name": "deadline", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8450, + "src": "6272:8:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 8470, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8452, + "src": "6282:1:22", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + { + "id": 8471, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8454, + "src": "6285:1:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 8472, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8456, + "src": "6288:1:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "arguments": [ + { + "id": 8460, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8444, + "src": "6229:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 8459, + "name": "IERC20Permit", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 376, + "src": "6216:12:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20Permit_$376_$", + "typeString": "type(contract IERC20Permit)" + } + }, + "id": 8461, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6216:19:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20Permit_$376", + "typeString": "contract IERC20Permit" + } + }, + "id": 8462, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6236:6:22", + "memberName": "permit", + "nodeType": "MemberAccess", + "referencedDeclaration": 361, + "src": "6216:26:22", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_address_$_t_uint256_$_t_uint256_$_t_uint8_$_t_bytes32_$_t_bytes32_$returns$__$", + "typeString": "function (address,address,uint256,uint256,uint8,bytes32,bytes32) external" + } + }, + "id": 8473, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6216:74:22", + "tryCall": true, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8494, + "nodeType": "TryStatement", + "src": "6212:375:22" + }, + { + "expression": { + "arguments": [ + { + "id": 8499, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8446, + "src": "6683:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "arguments": [ + { + "id": 8502, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "6698:4:22", + "typeDescriptions": { + "typeIdentifier": "t_contract$_TokenRelayer_$8603", + "typeString": "contract TokenRelayer" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_TokenRelayer_$8603", + "typeString": "contract TokenRelayer" + } + ], + "id": 8501, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6690:7:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 8500, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6690:7:22", + "typeDescriptions": {} + } + }, + "id": 8503, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6690:13:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 8504, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8448, + "src": "6705:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [ + { + "id": 8496, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8444, + "src": "6659:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 8495, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "6652:6:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$340_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 8497, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6652:13:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "id": 8498, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6666:16:22", + "memberName": "safeTransferFrom", + "nodeType": "MemberAccess", + "referencedDeclaration": 456, + "src": "6652:30:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_address_$_t_uint256_$returns$__$attached_to$_t_contract$_IERC20_$340_$", + "typeString": "function (contract IERC20,address,address,uint256)" + } + }, + "id": 8505, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6652:59:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8506, + "nodeType": "ExpressionStatement", + "src": "6652:59:22" + } + ] + }, + "documentation": { + "id": 8442, + "nodeType": "StructuredDocumentation", + "src": "5691:245:22", + "text": " @dev Execute permit approval and then transfer tokens from owner to self (relayer).\n Permit is wrapped in try-catch: if it was front-run, we check\n that the allowance is already sufficient before proceeding." + }, + "id": 8508, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_executePermitAndTransfer", + "nameLocation": "5950:25:22", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8457, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8444, + "mutability": "mutable", + "name": "token", + "nameLocation": "5993:5:22", + "nodeType": "VariableDeclaration", + "scope": 8508, + "src": "5985:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8443, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5985:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8446, + "mutability": "mutable", + "name": "owner", + "nameLocation": "6016:5:22", + "nodeType": "VariableDeclaration", + "scope": 8508, + "src": "6008:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8445, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6008:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8448, + "mutability": "mutable", + "name": "value", + "nameLocation": "6039:5:22", + "nodeType": "VariableDeclaration", + "scope": 8508, + "src": "6031:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8447, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6031:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8450, + "mutability": "mutable", + "name": "deadline", + "nameLocation": "6062:8:22", + "nodeType": "VariableDeclaration", + "scope": 8508, + "src": "6054:16:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8449, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6054:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8452, + "mutability": "mutable", + "name": "v", + "nameLocation": "6086:1:22", + "nodeType": "VariableDeclaration", + "scope": 8508, + "src": "6080:7:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 8451, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "6080:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8454, + "mutability": "mutable", + "name": "r", + "nameLocation": "6105:1:22", + "nodeType": "VariableDeclaration", + "scope": 8508, + "src": "6097:9:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8453, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6097:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8456, + "mutability": "mutable", + "name": "s", + "nameLocation": "6124:1:22", + "nodeType": "VariableDeclaration", + "scope": 8508, + "src": "6116:9:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8455, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6116:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "5975:156:22" + }, + "returnParameters": { + "id": 8458, + "nodeType": "ParameterList", + "parameters": [], + "src": "6141:0:22" + }, + "scope": 8603, + "src": "5941:777:22", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 8528, + "nodeType": "Block", + "src": "6804:104:22", + "statements": [ + { + "assignments": [ + 8518, + null + ], + "declarations": [ + { + "constant": false, + "id": 8518, + "mutability": "mutable", + "name": "success", + "nameLocation": "6820:7:22", + "nodeType": "VariableDeclaration", + "scope": 8528, + "src": "6815:12:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 8517, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "6815:4:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + null + ], + "id": 8525, + "initialValue": { + "arguments": [ + { + "id": 8523, + "name": "data", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8510, + "src": "6872:4:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "id": 8519, + "name": "destinationContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8147, + "src": "6833:19:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 8520, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6853:4:22", + "memberName": "call", + "nodeType": "MemberAccess", + "src": "6833:24:22", + "typeDescriptions": { + "typeIdentifier": "t_function_barecall_payable$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$", + "typeString": "function (bytes memory) payable returns (bool,bytes memory)" + } + }, + "id": 8522, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "names": [ + "value" + ], + "nodeType": "FunctionCallOptions", + "options": [ + { + "id": 8521, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8512, + "src": "6865:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "src": "6833:38:22", + "typeDescriptions": { + "typeIdentifier": "t_function_barecall_payable$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$value", + "typeString": "function (bytes memory) payable returns (bool,bytes memory)" + } + }, + "id": 8524, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6833:44:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$", + "typeString": "tuple(bool,bytes memory)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "6814:63:22" + }, + { + "expression": { + "id": 8526, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8518, + "src": "6894:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 8516, + "id": 8527, + "nodeType": "Return", + "src": "6887:14:22" + } + ] + }, + "id": 8529, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_forwardCall", + "nameLocation": "6733:12:22", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8513, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8510, + "mutability": "mutable", + "name": "data", + "nameLocation": "6759:4:22", + "nodeType": "VariableDeclaration", + "scope": 8529, + "src": "6746:17:22", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 8509, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "6746:5:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8512, + "mutability": "mutable", + "name": "value", + "nameLocation": "6773:5:22", + "nodeType": "VariableDeclaration", + "scope": 8529, + "src": "6765:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8511, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6765:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "6745:34:22" + }, + "returnParameters": { + "id": 8516, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8515, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 8529, + "src": "6798:4:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 8514, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "6798:4:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "6797:6:22" + }, + "scope": 8603, + "src": "6724:184:22", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 8555, + "nodeType": "Block", + "src": "7309:113:22", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 8543, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 67, + "src": "7346:5:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", + "typeString": "function () view returns (address)" + } + }, + "id": 8544, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7346:7:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 8545, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8534, + "src": "7355:6:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [ + { + "id": 8540, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8532, + "src": "7326:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 8539, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "7319:6:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$340_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 8541, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7319:13:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "id": 8542, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7333:12:22", + "memberName": "safeTransfer", + "nodeType": "MemberAccess", + "referencedDeclaration": 425, + "src": "7319:26:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$returns$__$attached_to$_t_contract$_IERC20_$340_$", + "typeString": "function (contract IERC20,address,uint256)" + } + }, + "id": 8546, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7319:43:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8547, + "nodeType": "ExpressionStatement", + "src": "7319:43:22" + }, + { + "eventCall": { + "arguments": [ + { + "id": 8549, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8532, + "src": "7392:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 8550, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8534, + "src": "7399:6:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 8551, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 67, + "src": "7407:5:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", + "typeString": "function () view returns (address)" + } + }, + "id": 8552, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7407:7:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 8548, + "name": "TokenWithdrawn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8198, + "src": "7377:14:22", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_uint256_$_t_address_$returns$__$", + "typeString": "function (address,uint256,address)" + } + }, + "id": 8553, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7377:38:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8554, + "nodeType": "EmitStatement", + "src": "7372:43:22" + } + ] + }, + "documentation": { + "id": 8530, + "nodeType": "StructuredDocumentation", + "src": "6914:217:22", + "text": " @notice Allows the owner to recover any ERC20 tokens held by this contract.\n @param token The ERC20 token contract address.\n @param amount The amount of tokens to transfer to the owner." + }, + "functionSelector": "9e281a98", + "id": 8556, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 8537, + "kind": "modifierInvocation", + "modifierName": { + "id": 8536, + "name": "onlyOwner", + "nameLocations": [ + "7299:9:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 58, + "src": "7299:9:22" + }, + "nodeType": "ModifierInvocation", + "src": "7299:9:22" + } + ], + "name": "withdrawToken", + "nameLocation": "7245:13:22", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8535, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8532, + "mutability": "mutable", + "name": "token", + "nameLocation": "7267:5:22", + "nodeType": "VariableDeclaration", + "scope": 8556, + "src": "7259:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8531, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "7259:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8534, + "mutability": "mutable", + "name": "amount", + "nameLocation": "7282:6:22", + "nodeType": "VariableDeclaration", + "scope": 8556, + "src": "7274:14:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8533, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7274:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7258:31:22" + }, + "returnParameters": { + "id": 8538, + "nodeType": "ParameterList", + "parameters": [], + "src": "7309:0:22" + }, + "scope": 8603, + "src": "7236:186:22", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 8585, + "nodeType": "Block", + "src": "7675:160:22", + "statements": [ + { + "assignments": [ + 8565, + null + ], + "declarations": [ + { + "constant": false, + "id": 8565, + "mutability": "mutable", + "name": "success", + "nameLocation": "7691:7:22", + "nodeType": "VariableDeclaration", + "scope": 8585, + "src": "7686:12:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 8564, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "7686:4:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + null + ], + "id": 8573, + "initialValue": { + "arguments": [ + { + "hexValue": "", + "id": 8571, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7732:2:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "typeString": "literal_string \"\"" + }, + "value": "" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "typeString": "literal_string \"\"" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "typeString": "literal_string \"\"" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 8566, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 67, + "src": "7704:5:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", + "typeString": "function () view returns (address)" + } + }, + "id": 8567, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7704:7:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 8568, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7712:4:22", + "memberName": "call", + "nodeType": "MemberAccess", + "src": "7704:12:22", + "typeDescriptions": { + "typeIdentifier": "t_function_barecall_payable$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$", + "typeString": "function (bytes memory) payable returns (bool,bytes memory)" + } + }, + "id": 8570, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "names": [ + "value" + ], + "nodeType": "FunctionCallOptions", + "options": [ + { + "id": 8569, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8559, + "src": "7724:6:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "src": "7704:27:22", + "typeDescriptions": { + "typeIdentifier": "t_function_barecall_payable$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$value", + "typeString": "function (bytes memory) payable returns (bool,bytes memory)" + } + }, + "id": 8572, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7704:31:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$", + "typeString": "tuple(bool,bytes memory)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "7685:50:22" + }, + { + "expression": { + "arguments": [ + { + "id": 8575, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8565, + "src": "7753:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "455448207472616e73666572206661696c6564", + "id": 8576, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7762:21:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_c7c2be2f1b63a3793f6e2d447ce95ba2239687186a7fd6b5268a969dcdb42dcd", + "typeString": "literal_string \"ETH transfer failed\"" + }, + "value": "ETH transfer failed" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_c7c2be2f1b63a3793f6e2d447ce95ba2239687186a7fd6b5268a969dcdb42dcd", + "typeString": "literal_string \"ETH transfer failed\"" + } + ], + "id": 8574, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "7745:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8577, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7745:39:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8578, + "nodeType": "ExpressionStatement", + "src": "7745:39:22" + }, + { + "eventCall": { + "arguments": [ + { + "id": 8580, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8559, + "src": "7812:6:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 8581, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 67, + "src": "7820:5:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", + "typeString": "function () view returns (address)" + } + }, + "id": 8582, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7820:7:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 8579, + "name": "ETHWithdrawn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8204, + "src": "7799:12:22", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_uint256_$_t_address_$returns$__$", + "typeString": "function (uint256,address)" + } + }, + "id": 8583, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7799:29:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8584, + "nodeType": "EmitStatement", + "src": "7794:34:22" + } + ] + }, + "documentation": { + "id": 8557, + "nodeType": "StructuredDocumentation", + "src": "7428:157:22", + "text": " @notice Allows the owner to recover any native ETH held by this contract.\n @param amount The amount of ETH to transfer to the owner." + }, + "functionSelector": "f14210a6", + "id": 8586, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 8562, + "kind": "modifierInvocation", + "modifierName": { + "id": 8561, + "name": "onlyOwner", + "nameLocations": [ + "7665:9:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 58, + "src": "7665:9:22" + }, + "nodeType": "ModifierInvocation", + "src": "7665:9:22" + } + ], + "name": "withdrawETH", + "nameLocation": "7628:11:22", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8560, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8559, + "mutability": "mutable", + "name": "amount", + "nameLocation": "7648:6:22", + "nodeType": "VariableDeclaration", + "scope": 8586, + "src": "7640:14:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8558, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7640:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7639:16:22" + }, + "returnParameters": { + "id": 8563, + "nodeType": "ParameterList", + "parameters": [], + "src": "7675:0:22" + }, + "scope": 8603, + "src": "7619:216:22", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 8601, + "nodeType": "Block", + "src": "7997:56:22", + "statements": [ + { + "expression": { + "baseExpression": { + "baseExpression": { + "id": 8595, + "name": "usedPayloadNonces", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8153, + "src": "8014:17:22", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_uint256_$_t_bool_$_$", + "typeString": "mapping(address => mapping(uint256 => bool))" + } + }, + "id": 8597, + "indexExpression": { + "id": 8596, + "name": "signer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8588, + "src": "8032:6:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8014:25:22", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_bool_$", + "typeString": "mapping(uint256 => bool)" + } + }, + "id": 8599, + "indexExpression": { + "id": 8598, + "name": "nonce", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8590, + "src": "8040:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8014:32:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 8594, + "id": 8600, + "nodeType": "Return", + "src": "8007:39:22" + } + ] + }, + "functionSelector": "dcb79457", + "id": 8602, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "isExecutionCompleted", + "nameLocation": "7916:20:22", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8591, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8588, + "mutability": "mutable", + "name": "signer", + "nameLocation": "7945:6:22", + "nodeType": "VariableDeclaration", + "scope": 8602, + "src": "7937:14:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8587, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "7937:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8590, + "mutability": "mutable", + "name": "nonce", + "nameLocation": "7961:5:22", + "nodeType": "VariableDeclaration", + "scope": 8602, + "src": "7953:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8589, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7953:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7936:31:22" + }, + "returnParameters": { + "id": 8594, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8593, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 8602, + "src": "7991:4:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 8592, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "7991:4:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "7990:6:22" + }, + "scope": 8603, + "src": "7907:146:22", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + } + ], + "scope": 8604, + "src": "1158:6897:22", + "usedErrors": [ + 13, + 18, + 388, + 1734, + 1841, + 1843, + 3689, + 3694, + 3699 + ], + "usedEvents": [ + 24, + 242, + 8190, + 8198, + 8204 + ] + } + ], + "src": "32:8024:22" + }, + "id": 22 + } + }, + "contracts": { + "@openzeppelin/contracts/access/Ownable.sol": { + "Ownable": { + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnableInvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "OwnableUnauthorizedAccount", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "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" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "methodIdentifiers": { + "owner()": "8da5cb5b", + "renounceOwnership()": "715018a6", + "transferOwnership(address)": "f2fde38b" + } + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"OwnableInvalidOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"OwnableUnauthorizedAccount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"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\"}],\"devdoc\":{\"details\":\"Contract module which provides a basic access control mechanism, where there is an account (an owner) that can be granted exclusive access to specific functions. The initial owner is set to the address provided by the deployer. This can later be changed with {transferOwnership}. This module is used through inheritance. It will make available the modifier `onlyOwner`, which can be applied to your functions to restrict their use to the owner.\",\"errors\":{\"OwnableInvalidOwner(address)\":[{\"details\":\"The owner is not a valid owner account. (eg. `address(0)`)\"}],\"OwnableUnauthorizedAccount(address)\":[{\"details\":\"The caller account is not authorized to perform an operation.\"}]},\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the contract setting the address provided by the deployer as the initial owner.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"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\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/access/Ownable.sol\":\"Ownable\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"keccak256\":\"0xff6d0bb2e285473e5311d9d3caacb525ae3538a80758c10649a4d61029b017bb\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8ed324d3920bb545059d66ab97d43e43ee85fd3bd52e03e401f020afb0b120f6\",\"dweb:/ipfs/QmfEckWLmZkDDcoWrkEvMWhms66xwTLff9DDhegYpvHo1a\"]},\"@openzeppelin/contracts/utils/Context.sol\":{\"keccak256\":\"0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6a708e8a5bdb1011c2c381c9a5cfd8a9a956d7d0a9dc1bd8bcdaf52f76ef2f12\",\"dweb:/ipfs/Qmax9WHBnVsZP46ZxEMNRQpLQnrdE4dK8LehML1Py8FowF\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/interfaces/IERC1363.sol": { + "IERC1363": { + "abi": [ + { + "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": 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": "value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "approveAndCall", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "approveAndCall", + "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": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "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": "value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "transferAndCall", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "transferAndCall", + "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": "value", + "type": "uint256" + } + ], + "name": "transferFrom", + "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": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "transferFromAndCall", + "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": "value", + "type": "uint256" + } + ], + "name": "transferFromAndCall", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "methodIdentifiers": { + "allowance(address,address)": "dd62ed3e", + "approve(address,uint256)": "095ea7b3", + "approveAndCall(address,uint256)": "3177029f", + "approveAndCall(address,uint256,bytes)": "cae9ca51", + "balanceOf(address)": "70a08231", + "supportsInterface(bytes4)": "01ffc9a7", + "totalSupply()": "18160ddd", + "transfer(address,uint256)": "a9059cbb", + "transferAndCall(address,uint256)": "1296ee62", + "transferAndCall(address,uint256,bytes)": "4000aea0", + "transferFrom(address,address,uint256)": "23b872dd", + "transferFromAndCall(address,address,uint256)": "d8fbe994", + "transferFromAndCall(address,address,uint256,bytes)": "c1d34b89" + } + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"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\":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\":\"value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"approveAndCall\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"approveAndCall\",\"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\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"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\":\"value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"transferAndCall\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"transferAndCall\",\"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\":\"value\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"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\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"transferFromAndCall\",\"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\":\"value\",\"type\":\"uint256\"}],\"name\":\"transferFromAndCall\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363]. Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.\",\"events\":{\"Approval(address,address,uint256)\":{\"details\":\"Emitted when the allowance of a `spender` for an `owner` is set by a call to {approve}. `value` is the new allowance.\"},\"Transfer(address,address,uint256)\":{\"details\":\"Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero.\"}},\"kind\":\"dev\",\"methods\":{\"allowance(address,address)\":{\"details\":\"Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called.\"},\"approve(address,uint256)\":{\"details\":\"Sets a `value` amount of tokens as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {Approval} event.\"},\"approveAndCall(address,uint256)\":{\"details\":\"Sets a `value` amount of tokens as the allowance of `spender` over the caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\",\"params\":{\"spender\":\"The address which will spend the funds.\",\"value\":\"The amount of tokens to be spent.\"},\"returns\":{\"_0\":\"A boolean value indicating whether the operation succeeded unless throwing.\"}},\"approveAndCall(address,uint256,bytes)\":{\"details\":\"Sets a `value` amount of tokens as the allowance of `spender` over the caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\",\"params\":{\"data\":\"Additional data with no specified format, sent in call to `spender`.\",\"spender\":\"The address which will spend the funds.\",\"value\":\"The amount of tokens to be spent.\"},\"returns\":{\"_0\":\"A boolean value indicating whether the operation succeeded unless throwing.\"}},\"balanceOf(address)\":{\"details\":\"Returns the value of tokens owned by `account`.\"},\"supportsInterface(bytes4)\":{\"details\":\"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section] to learn more about how these ids are created. This function call must use less than 30 000 gas.\"},\"totalSupply()\":{\"details\":\"Returns the value of tokens in existence.\"},\"transfer(address,uint256)\":{\"details\":\"Moves a `value` amount of tokens from the caller's account to `to`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.\"},\"transferAndCall(address,uint256)\":{\"details\":\"Moves a `value` amount of tokens from the caller's account to `to` and then calls {IERC1363Receiver-onTransferReceived} on `to`.\",\"params\":{\"to\":\"The address which you want to transfer to.\",\"value\":\"The amount of tokens to be transferred.\"},\"returns\":{\"_0\":\"A boolean value indicating whether the operation succeeded unless throwing.\"}},\"transferAndCall(address,uint256,bytes)\":{\"details\":\"Moves a `value` amount of tokens from the caller's account to `to` and then calls {IERC1363Receiver-onTransferReceived} on `to`.\",\"params\":{\"data\":\"Additional data with no specified format, sent in call to `to`.\",\"to\":\"The address which you want to transfer to.\",\"value\":\"The amount of tokens to be transferred.\"},\"returns\":{\"_0\":\"A boolean value indicating whether the operation succeeded unless throwing.\"}},\"transferFrom(address,address,uint256)\":{\"details\":\"Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism. `value` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.\"},\"transferFromAndCall(address,address,uint256)\":{\"details\":\"Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism and then calls {IERC1363Receiver-onTransferReceived} on `to`.\",\"params\":{\"from\":\"The address which you want to send tokens from.\",\"to\":\"The address which you want to transfer to.\",\"value\":\"The amount of tokens to be transferred.\"},\"returns\":{\"_0\":\"A boolean value indicating whether the operation succeeded unless throwing.\"}},\"transferFromAndCall(address,address,uint256,bytes)\":{\"details\":\"Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism and then calls {IERC1363Receiver-onTransferReceived} on `to`.\",\"params\":{\"data\":\"Additional data with no specified format, sent in call to `to`.\",\"from\":\"The address which you want to send tokens from.\",\"to\":\"The address which you want to transfer to.\",\"value\":\"The amount of tokens to be transferred.\"},\"returns\":{\"_0\":\"A boolean value indicating whether the operation succeeded unless throwing.\"}}},\"title\":\"IERC1363\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/interfaces/IERC1363.sol\":\"IERC1363\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/IERC1363.sol\":{\"keccak256\":\"0xd5ea07362ab630a6a3dee4285a74cf2377044ca2e4be472755ad64d7c5d4b69d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://da5e832b40fc5c3145d3781e2e5fa60ac2052c9d08af7e300dc8ab80c4343100\",\"dweb:/ipfs/QmTzf7N5ZUdh5raqtzbM11yexiUoLC9z3Ws632MCuycq1d\"]},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"keccak256\":\"0x0afcb7e740d1537b252cb2676f600465ce6938398569f09ba1b9ca240dde2dfc\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1c299900ac4ec268d4570ecef0d697a3013cd11a6eb74e295ee3fbc945056037\",\"dweb:/ipfs/Qmab9owJoxcA7vJT5XNayCMaUR1qxqj1NDzzisduwaJMcZ\"]},\"@openzeppelin/contracts/interfaces/IERC20.sol\":{\"keccak256\":\"0x1a6221315ce0307746c2c4827c125d821ee796c74a676787762f4778671d4f44\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1bb2332a7ee26dd0b0de9b7fe266749f54820c99ab6a3bcb6f7e6b751d47ee2d\",\"dweb:/ipfs/QmcRWpaBeCYkhy68PR3B4AgD7asuQk7PwkWxrvJbZcikLF\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x74ed01eb66b923d0d0cfe3be84604ac04b76482a55f9dd655e1ef4d367f95bc2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5282825a626cfe924e504274b864a652b0023591fa66f06a067b25b51ba9b303\",\"dweb:/ipfs/QmeCfPykghhMc81VJTrHTC7sF6CRvaA1FXVq2pJhwYp1dV\"]},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x8891738ffe910f0cf2da09566928589bf5d63f4524dd734fd9cedbac3274dd5c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://971f954442df5c2ef5b5ebf1eb245d7105d9fbacc7386ee5c796df1d45b21617\",\"dweb:/ipfs/QmadRjHbkicwqwwh61raUEapaVEtaLMcYbQZWs9gUkgj3u\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/interfaces/IERC5267.sol": { + "IERC5267": { + "abi": [ + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "methodIdentifiers": { + "eip712Domain()": "84b0196e" + } + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[],\"name\":\"EIP712DomainChanged\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"eip712Domain\",\"outputs\":[{\"internalType\":\"bytes1\",\"name\":\"fields\",\"type\":\"bytes1\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"verifyingContract\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"extensions\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"EIP712DomainChanged()\":{\"details\":\"MAY be emitted to signal that the domain could have changed.\"}},\"kind\":\"dev\",\"methods\":{\"eip712Domain()\":{\"details\":\"returns the fields and values that describe the domain separator used by this contract for EIP-712 signature.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/interfaces/IERC5267.sol\":\"IERC5267\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/IERC5267.sol\":{\"keccak256\":\"0xfb223a85dd0b2175cfbbaa325a744e2cd74ecd17c3df2b77b0722f991d2725ee\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://84bf1dea0589ec49c8d15d559cc6d86ee493048a89b2d4adb60fbe705a3d89ae\",\"dweb:/ipfs/Qmd56n556d529wk2pRMhYhm5nhMDhviwereodDikjs68w1\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "IERC20": { + "abi": [ + { + "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": 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": "value", + "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": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "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": "value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "methodIdentifiers": { + "allowance(address,address)": "dd62ed3e", + "approve(address,uint256)": "095ea7b3", + "balanceOf(address)": "70a08231", + "totalSupply()": "18160ddd", + "transfer(address,uint256)": "a9059cbb", + "transferFrom(address,address,uint256)": "23b872dd" + } + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"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\":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\":\"value\",\"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\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"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\":\"value\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Interface of the ERC-20 standard as defined in the ERC.\",\"events\":{\"Approval(address,address,uint256)\":{\"details\":\"Emitted when the allowance of a `spender` for an `owner` is set by a call to {approve}. `value` is the new allowance.\"},\"Transfer(address,address,uint256)\":{\"details\":\"Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero.\"}},\"kind\":\"dev\",\"methods\":{\"allowance(address,address)\":{\"details\":\"Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called.\"},\"approve(address,uint256)\":{\"details\":\"Sets a `value` amount of tokens as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {Approval} event.\"},\"balanceOf(address)\":{\"details\":\"Returns the value of tokens owned by `account`.\"},\"totalSupply()\":{\"details\":\"Returns the value of tokens in existence.\"},\"transfer(address,uint256)\":{\"details\":\"Moves a `value` amount of tokens from the caller's account to `to`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism. `value` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":\"IERC20\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x74ed01eb66b923d0d0cfe3be84604ac04b76482a55f9dd655e1ef4d367f95bc2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5282825a626cfe924e504274b864a652b0023591fa66f06a067b25b51ba9b303\",\"dweb:/ipfs/QmeCfPykghhMc81VJTrHTC7sF6CRvaA1FXVq2pJhwYp1dV\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": { + "IERC20Permit": { + "abi": [ + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "methodIdentifiers": { + "DOMAIN_SEPARATOR()": "3644e515", + "nonces(address)": "7ecebe00", + "permit(address,address,uint256,uint256,uint8,bytes32,bytes32)": "d505accf" + } + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"DOMAIN_SEPARATOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"nonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"permit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Interface of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in https://eips.ethereum.org/EIPS/eip-2612[ERC-2612]. Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't need to send a transaction, and thus is not required to hold Ether at all. ==== Security Considerations There are two important considerations concerning the use of `permit`. The first is that a valid permit signature expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be considered as an intention to spend the allowance in any specific way. The second is that because permits have built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be generally recommended is: ```solidity function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} doThing(..., value); } function doThing(..., uint256 value) public { token.safeTransferFrom(msg.sender, address(this), value); ... } ``` Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also {SafeERC20-safeTransferFrom}). Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so contracts should have entry points that don't rely on permit.\",\"kind\":\"dev\",\"methods\":{\"DOMAIN_SEPARATOR()\":{\"details\":\"Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\"},\"nonces(address)\":{\"details\":\"Returns the current nonce for `owner`. This value must be included whenever a signature is generated for {permit}. Every successful call to {permit} increases ``owner``'s nonce by one. This prevents a signature from being used multiple times.\"},\"permit(address,address,uint256,uint256,uint8,bytes32,bytes32)\":{\"details\":\"Sets `value` as the allowance of `spender` over ``owner``'s tokens, given ``owner``'s signed approval. IMPORTANT: The same issues {IERC20-approve} has related to transaction ordering also applies here. Emits an {Approval} event. Requirements: - `spender` cannot be the zero address. - `deadline` must be a timestamp in the future. - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` over the EIP712-formatted function arguments. - the signature must use ``owner``'s current nonce (see {nonces}). For more information on the signature format, see the https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP section]. CAUTION: See Security Considerations above.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\":\"IERC20Permit\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\":{\"keccak256\":\"0x53befc41288eaa87edcd3a7be7e8475a32e44c6a29f9bf52fae789781301d9ff\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a1d7fab53c4ceaf42391b83d9b36d7e9cc524a8da125cffdcd32c56560f9d1c9\",\"dweb:/ipfs/QmaRZdVhQdqNXofeimibkBG65q9GVcXVZEGpycwwX3znC6\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "SafeERC20": { + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "currentAllowance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestedDecrease", + "type": "uint256" + } + ], + "name": "SafeERC20FailedDecreaseAllowance", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "SafeERC20FailedOperation", + "type": "error" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212205c28a953d80cbde5965c90d7d69e4200c2946ffa7d85a8c75c36f5291a6d6e6464736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 TLOAD 0x28 0xA9 MSTORE8 0xD8 0xC 0xBD 0xE5 SWAP7 TLOAD SWAP1 0xD7 0xD6 SWAP15 TIMESTAMP STOP 0xC2 SWAP5 PUSH16 0xFA7D85A8C75C36F5291A6D6E6464736F PUSH13 0x634300081C0033000000000000 ", + "sourceMap": "698:12615:7:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;698:12615:7;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212205c28a953d80cbde5965c90d7d69e4200c2946ffa7d85a8c75c36f5291a6d6e6464736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 TLOAD 0x28 0xA9 MSTORE8 0xD8 0xC 0xBD 0xE5 SWAP7 TLOAD SWAP1 0xD7 0xD6 SWAP15 TIMESTAMP STOP 0xC2 SWAP5 PUSH16 0xFA7D85A8C75C36F5291A6D6E6464736F PUSH13 0x634300081C0033000000000000 ", + "sourceMap": "698:12615:7:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"currentAllowance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestedDecrease\",\"type\":\"uint256\"}],\"name\":\"SafeERC20FailedDecreaseAllowance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"SafeERC20FailedOperation\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"Wrappers around ERC-20 operations that throw on failure (when the token contract returns false). Tokens that return no value (and instead revert or throw on failure) are also supported, non-reverting calls are assumed to be successful. To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\",\"errors\":{\"SafeERC20FailedDecreaseAllowance(address,uint256,uint256)\":[{\"details\":\"Indicates a failed `decreaseAllowance` request.\"}],\"SafeERC20FailedOperation(address)\":[{\"details\":\"An operation with an ERC-20 token failed.\"}]},\"kind\":\"dev\",\"methods\":{},\"title\":\"SafeERC20\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":\"SafeERC20\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/IERC1363.sol\":{\"keccak256\":\"0xd5ea07362ab630a6a3dee4285a74cf2377044ca2e4be472755ad64d7c5d4b69d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://da5e832b40fc5c3145d3781e2e5fa60ac2052c9d08af7e300dc8ab80c4343100\",\"dweb:/ipfs/QmTzf7N5ZUdh5raqtzbM11yexiUoLC9z3Ws632MCuycq1d\"]},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"keccak256\":\"0x0afcb7e740d1537b252cb2676f600465ce6938398569f09ba1b9ca240dde2dfc\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1c299900ac4ec268d4570ecef0d697a3013cd11a6eb74e295ee3fbc945056037\",\"dweb:/ipfs/Qmab9owJoxcA7vJT5XNayCMaUR1qxqj1NDzzisduwaJMcZ\"]},\"@openzeppelin/contracts/interfaces/IERC20.sol\":{\"keccak256\":\"0x1a6221315ce0307746c2c4827c125d821ee796c74a676787762f4778671d4f44\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1bb2332a7ee26dd0b0de9b7fe266749f54820c99ab6a3bcb6f7e6b751d47ee2d\",\"dweb:/ipfs/QmcRWpaBeCYkhy68PR3B4AgD7asuQk7PwkWxrvJbZcikLF\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x74ed01eb66b923d0d0cfe3be84604ac04b76482a55f9dd655e1ef4d367f95bc2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5282825a626cfe924e504274b864a652b0023591fa66f06a067b25b51ba9b303\",\"dweb:/ipfs/QmeCfPykghhMc81VJTrHTC7sF6CRvaA1FXVq2pJhwYp1dV\"]},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"keccak256\":\"0x304d732678032a9781ae85c8f204c8fba3d3a5e31c02616964e75cfdc5049098\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://299ced486011781dc98f638059678323c03079fefae1482abaa2135b22fa92d0\",\"dweb:/ipfs/QmbZNbcPTBxNvwChavN2kkZZs7xHhYL7mv51KrxMhsMs3j\"]},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x8891738ffe910f0cf2da09566928589bf5d63f4524dd734fd9cedbac3274dd5c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://971f954442df5c2ef5b5ebf1eb245d7105d9fbacc7386ee5c796df1d45b21617\",\"dweb:/ipfs/QmadRjHbkicwqwwh61raUEapaVEtaLMcYbQZWs9gUkgj3u\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/Bytes.sol": { + "Bytes": { + "abi": [], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea2646970667358221220072fadf3f16461513580a2d3f78bb66cb36505b035a64cbbe629d90098ae436d64736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 SMOD 0x2F 0xAD RETURN CALL PUSH5 0x61513580A2 0xD3 0xF7 DUP12 0xB6 PUSH13 0xB36505B035A64CBBE629D90098 0xAE NUMBER PUSH14 0x64736F6C634300081C0033000000 ", + "sourceMap": "198:14538:8:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;198:14538:8;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea2646970667358221220072fadf3f16461513580a2d3f78bb66cb36505b035a64cbbe629d90098ae436d64736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 SMOD 0x2F 0xAD RETURN CALL PUSH5 0x61513580A2 0xD3 0xF7 DUP12 0xB6 PUSH13 0xB36505B035A64CBBE629D90098 0xAE NUMBER PUSH14 0x64736F6C634300081C0033000000 ", + "sourceMap": "198:14538:8:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Bytes operations.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/Bytes.sol\":\"Bytes\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Bytes.sol\":{\"keccak256\":\"0xf80e4b96b6849936ea0fabd76cf81b13d7276295fddb1e1c07afb3ddf650b0ac\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6430007255ac11c6e9c4331a418f3af52ff66fbbae959f645301d025b20aeb08\",\"dweb:/ipfs/QmQE5fjmBBRw9ndnzJuC2uskYss1gbaR7JdazoCf1FGoBj\"]},\"@openzeppelin/contracts/utils/Panic.sol\":{\"keccak256\":\"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c6a5ff4f9fd8649b7ee20800b7fa387d3465bd77cf20c2d1068cd5c98e1ed57a\",\"dweb:/ipfs/QmVSaVJf9FXFhdYEYeCEfjMVHrxDh5qL4CGkxdMWpQCrqG\"]},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"keccak256\":\"0x59973a93b1f983f94e10529f46ca46544a9fec2b5f56fb1390bbe9e0dc79f857\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c55ef8f0b9719790c2ae6f81d80a59ffb89f2f0abe6bc065585bd79edce058c5\",\"dweb:/ipfs/QmNNmCbX9NjPXKqHJN8R1WC2rNeZSQrPZLd6FF6AKLyH5Y\"]},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"keccak256\":\"0xc8cae21c9ae4a46e5162ff9bf5b351d6fa6a6eba72d515f3bc1bdfeda7fdf083\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce830ebcf28e31643caba318996db3763c36d52cd0f23798ba83c135355d45e9\",\"dweb:/ipfs/QmdGPcvptHN7UBCbUYBbRX3hiRVRFLRwno8b4uga6uFNif\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/Context.sol": { + "Context": { + "abi": [], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Provides information about the current execution context, including the sender of the transaction and its data. While these are generally available via msg.sender and msg.data, they should not be accessed in such a direct manner, since when dealing with meta-transactions the account sending and paying for execution may not be the actual sender (as far as an application is concerned). This contract is only required for intermediate, library-like contracts.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/Context.sol\":\"Context\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Context.sol\":{\"keccak256\":\"0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6a708e8a5bdb1011c2c381c9a5cfd8a9a956d7d0a9dc1bd8bcdaf52f76ef2f12\",\"dweb:/ipfs/Qmax9WHBnVsZP46ZxEMNRQpLQnrdE4dK8LehML1Py8FowF\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/Panic.sol": { + "Panic": { + "abi": [], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea2646970667358221220cca8e34ba4a10a3072e457ee409c3e14973552ffad66786674cea596605f229764736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xCC 0xA8 0xE3 0x4B LOG4 LOG1 EXP ADDRESS PUSH19 0xE457EE409C3E14973552FFAD66786674CEA596 PUSH1 0x5F 0x22 SWAP8 PUSH5 0x736F6C6343 STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "657:1315:10:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;657:1315:10;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea2646970667358221220cca8e34ba4a10a3072e457ee409c3e14973552ffad66786674cea596605f229764736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xCC 0xA8 0xE3 0x4B LOG4 LOG1 EXP ADDRESS PUSH19 0xE457EE409C3E14973552FFAD66786674CEA596 PUSH1 0x5F 0x22 SWAP8 PUSH5 0x736F6C6343 STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "657:1315:10:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Helper library for emitting standardized panic codes. ```solidity contract Example { using Panic for uint256; // Use any of the declared internal constants function foo() { Panic.GENERIC.panic(); } // Alternatively function foo() { Panic.panic(Panic.GENERIC); } } ``` Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil]. _Available since v5.1._\",\"kind\":\"dev\",\"methods\":{},\"stateVariables\":{\"ARRAY_OUT_OF_BOUNDS\":{\"details\":\"array out of bounds access\"},\"ASSERT\":{\"details\":\"used by the assert() builtin\"},\"DIVISION_BY_ZERO\":{\"details\":\"division or modulo by zero\"},\"EMPTY_ARRAY_POP\":{\"details\":\"empty array pop\"},\"ENUM_CONVERSION_ERROR\":{\"details\":\"enum conversion error\"},\"GENERIC\":{\"details\":\"generic / unspecified error\"},\"INVALID_INTERNAL_FUNCTION\":{\"details\":\"calling invalid internal function\"},\"RESOURCE_ERROR\":{\"details\":\"resource error (too large allocation or too large array)\"},\"STORAGE_ENCODING_ERROR\":{\"details\":\"invalid encoding in storage\"},\"UNDER_OVERFLOW\":{\"details\":\"arithmetic underflow or overflow\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/Panic.sol\":\"Panic\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Panic.sol\":{\"keccak256\":\"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c6a5ff4f9fd8649b7ee20800b7fa387d3465bd77cf20c2d1068cd5c98e1ed57a\",\"dweb:/ipfs/QmVSaVJf9FXFhdYEYeCEfjMVHrxDh5qL4CGkxdMWpQCrqG\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/ReentrancyGuard.sol": { + "ReentrancyGuard": { + "abi": [ + { + "inputs": [], + "name": "ReentrancyGuardReentrantCall", + "type": "error" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"ReentrancyGuardReentrantCall\",\"type\":\"error\"}],\"devdoc\":{\"custom:stateless\":\"\",\"details\":\"Contract module that helps prevent reentrant calls to a function. Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier available, which can be applied to functions to make sure there are no nested (reentrant) calls to them. Note that because there is a single `nonReentrant` guard, functions marked as `nonReentrant` may not call one another. This can be worked around by making those functions `private`, and then adding `external` `nonReentrant` entry points to them. TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at, consider using {ReentrancyGuardTransient} instead. TIP: If you would like to learn more about reentrancy and alternative ways to protect against it, check out our blog post https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. IMPORTANT: Deprecated. This storage-based reentrancy guard will be removed and replaced by the {ReentrancyGuardTransient} variant in v6.0.\",\"errors\":{\"ReentrancyGuardReentrantCall()\":[{\"details\":\"Unauthorized reentrant call.\"}]},\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/ReentrancyGuard.sol\":\"ReentrancyGuard\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/ReentrancyGuard.sol\":{\"keccak256\":\"0xa516cbf1c7d15d3517c2d668601ce016c54395bf5171918a14e2686977465f53\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1e1d079e8edfb58efd23a311e315a4807b01b5d1cf153f8fa2d0608b9dec3e99\",\"dweb:/ipfs/QmTBExeX2SDTkn5xbk5ssbYSx7VqRp9H4Ux1CY4uQM4b9N\"]},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"keccak256\":\"0xcf74f855663ce2ae00ed8352666b7935f6cddea2932fdf2c3ecd30a9b1cd0e97\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9f660b1f351b757dfe01438e59888f31f33ded3afcf5cb5b0d9bf9aa6f320a8b\",\"dweb:/ipfs/QmarDJ5hZEgBtCmmrVzEZWjub9769eD686jmzb2XpSU1cM\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/ShortStrings.sol": { + "ShortStrings": { + "abi": [ + { + "inputs": [], + "name": "InvalidShortString", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "str", + "type": "string" + } + ], + "name": "StringTooLong", + "type": "error" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212205331629f8f9bf0cbfbabc3d9173056cd00dba4e3cc0330036bc4382e2359a42464736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 MSTORE8 BALANCE PUSH3 0x9F8F9B CREATE 0xCB 0xFB 0xAB 0xC3 0xD9 OR ADDRESS JUMP 0xCD STOP 0xDB LOG4 0xE3 0xCC SUB ADDRESS SUB PUSH12 0xC4382E2359A42464736F6C63 NUMBER STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "1255:3054:12:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;1255:3054:12;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212205331629f8f9bf0cbfbabc3d9173056cd00dba4e3cc0330036bc4382e2359a42464736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 MSTORE8 BALANCE PUSH3 0x9F8F9B CREATE 0xCB 0xFB 0xAB 0xC3 0xD9 OR ADDRESS JUMP 0xCD STOP 0xDB LOG4 0xE3 0xCC SUB ADDRESS SUB PUSH12 0xC4382E2359A42464736F6C63 NUMBER STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "1255:3054:12:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"InvalidShortString\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"str\",\"type\":\"string\"}],\"name\":\"StringTooLong\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"This library provides functions to convert short memory strings into a `ShortString` type that can be used as an immutable variable. Strings of arbitrary length can be optimized using this library if they are short enough (up to 31 bytes) by packing them with their length (1 byte) in a single EVM word (32 bytes). Additionally, a fallback mechanism can be used for every other case. Usage example: ```solidity contract Named { using ShortStrings for *; ShortString private immutable _name; string private _nameFallback; constructor(string memory contractName) { _name = contractName.toShortStringWithFallback(_nameFallback); } function name() external view returns (string memory) { return _name.toStringWithFallback(_nameFallback); } } ```\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/ShortStrings.sol\":\"ShortStrings\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/ShortStrings.sol\":{\"keccak256\":\"0x0768b3bdb701fe4994b3be932ca8635551dfebe04c645f77500322741bebf57c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a2059f9ca8d3c11c49ca49fc9c5fb070f18cc85d12a7688e45322ed0e2a1cb99\",\"dweb:/ipfs/QmS2gwX51RAvSw4tYbjHccY2CKbh2uvDzqHLAFXdsddgia\"]},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"keccak256\":\"0xcf74f855663ce2ae00ed8352666b7935f6cddea2932fdf2c3ecd30a9b1cd0e97\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9f660b1f351b757dfe01438e59888f31f33ded3afcf5cb5b0d9bf9aa6f320a8b\",\"dweb:/ipfs/QmarDJ5hZEgBtCmmrVzEZWjub9769eD686jmzb2XpSU1cM\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "StorageSlot": { + "abi": [], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212202e11909616c8a357ae57cd11f3e744f7b7de3a3174b44a2b6467fa9904f2585764736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0x2E GT SWAP1 SWAP7 AND 0xC8 LOG3 JUMPI 0xAE JUMPI 0xCD GT RETURN 0xE7 PREVRANDAO 0xF7 0xB7 0xDE GASPRICE BALANCE PUSH21 0xB44A2B6467FA9904F2585764736F6C634300081C00 CALLER ", + "sourceMap": "1407:2774:13:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;1407:2774:13;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212202e11909616c8a357ae57cd11f3e744f7b7de3a3174b44a2b6467fa9904f2585764736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0x2E GT SWAP1 SWAP7 AND 0xC8 LOG3 JUMPI 0xAE JUMPI 0xCD GT RETURN 0xE7 PREVRANDAO 0xF7 0xB7 0xDE GASPRICE BALANCE PUSH21 0xB44A2B6467FA9904F2585764736F6C634300081C00 CALLER ", + "sourceMap": "1407:2774:13:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Library for reading and writing primitive types to specific storage slots. Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. This library helps with reading and writing to such slots without the need for inline assembly. The functions in this library return Slot structs that contain a `value` member that can be used to read or write. Example usage to set ERC-1967 implementation slot: ```solidity contract ERC1967 { // Define the slot. Alternatively, use the SlotDerivation library to derive the slot. bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; function _getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; } function _setImplementation(address newImplementation) internal { require(newImplementation.code.length > 0); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } } ``` TIP: Consider using this library along with {SlotDerivation}.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/StorageSlot.sol\":\"StorageSlot\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"keccak256\":\"0xcf74f855663ce2ae00ed8352666b7935f6cddea2932fdf2c3ecd30a9b1cd0e97\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9f660b1f351b757dfe01438e59888f31f33ded3afcf5cb5b0d9bf9aa6f320a8b\",\"dweb:/ipfs/QmarDJ5hZEgBtCmmrVzEZWjub9769eD686jmzb2XpSU1cM\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "Strings": { + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "length", + "type": "uint256" + } + ], + "name": "StringsInsufficientHexLength", + "type": "error" + }, + { + "inputs": [], + "name": "StringsInvalidAddressFormat", + "type": "error" + }, + { + "inputs": [], + "name": "StringsInvalidChar", + "type": "error" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea2646970667358221220172eadb738f4060c9567e763c4ffa1f0bf958b6bde49f20427622bab52603b4264736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 OR 0x2E 0xAD 0xB7 CODESIZE DELEGATECALL MOD 0xC SWAP6 PUSH8 0xE763C4FFA1F0BF95 DUP12 PUSH12 0xDE49F20427622BAB52603B42 PUSH5 0x736F6C6343 STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "332:21205:14:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;332:21205:14;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea2646970667358221220172eadb738f4060c9567e763c4ffa1f0bf958b6bde49f20427622bab52603b4264736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 OR 0x2E 0xAD 0xB7 CODESIZE DELEGATECALL MOD 0xC SWAP6 PUSH8 0xE763C4FFA1F0BF95 DUP12 PUSH12 0xDE49F20427622BAB52603B42 PUSH5 0x736F6C6343 STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "332:21205:14:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"length\",\"type\":\"uint256\"}],\"name\":\"StringsInsufficientHexLength\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StringsInvalidAddressFormat\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StringsInvalidChar\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"String operations.\",\"errors\":{\"StringsInsufficientHexLength(uint256,uint256)\":[{\"details\":\"The `value` string doesn't fit in the specified `length`.\"}],\"StringsInvalidAddressFormat()\":[{\"details\":\"The string being parsed is not a properly formatted address.\"}],\"StringsInvalidChar()\":[{\"details\":\"The string being parsed contains characters that are not in scope of the given base.\"}]},\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/Strings.sol\":\"Strings\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Bytes.sol\":{\"keccak256\":\"0xf80e4b96b6849936ea0fabd76cf81b13d7276295fddb1e1c07afb3ddf650b0ac\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6430007255ac11c6e9c4331a418f3af52ff66fbbae959f645301d025b20aeb08\",\"dweb:/ipfs/QmQE5fjmBBRw9ndnzJuC2uskYss1gbaR7JdazoCf1FGoBj\"]},\"@openzeppelin/contracts/utils/Panic.sol\":{\"keccak256\":\"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c6a5ff4f9fd8649b7ee20800b7fa387d3465bd77cf20c2d1068cd5c98e1ed57a\",\"dweb:/ipfs/QmVSaVJf9FXFhdYEYeCEfjMVHrxDh5qL4CGkxdMWpQCrqG\"]},\"@openzeppelin/contracts/utils/Strings.sol\":{\"keccak256\":\"0x1fdc2de9585ab0f1c417f02a873a2b6343cd64bb7ffec6b00ffa11a4a158d9e8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1ab223a3d969c6cd7610049431dd42740960c477e45878f5d8b54411f7a32bdc\",\"dweb:/ipfs/QmWumhjvhpKcwx3vDPQninsNVTc3BGvqaihkQakFkQYpaS\"]},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"keccak256\":\"0x59973a93b1f983f94e10529f46ca46544a9fec2b5f56fb1390bbe9e0dc79f857\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c55ef8f0b9719790c2ae6f81d80a59ffb89f2f0abe6bc065585bd79edce058c5\",\"dweb:/ipfs/QmNNmCbX9NjPXKqHJN8R1WC2rNeZSQrPZLd6FF6AKLyH5Y\"]},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"keccak256\":\"0xc8cae21c9ae4a46e5162ff9bf5b351d6fa6a6eba72d515f3bc1bdfeda7fdf083\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce830ebcf28e31643caba318996db3763c36d52cd0f23798ba83c135355d45e9\",\"dweb:/ipfs/QmdGPcvptHN7UBCbUYBbRX3hiRVRFLRwno8b4uga6uFNif\"]},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"keccak256\":\"0xb1970fac7b64e6c09611e6691791e848d5e3fe410fa5899e7df2e0afd77a99e3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://db5fbb3dddd8b7047465b62575d96231ba8a2774d37fb4737fbf23340fabbb03\",\"dweb:/ipfs/QmVUSvooZKEdEdap619tcJjTLcAuH6QBdZqAzWwnAXZAWJ\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "ECDSA": { + "abi": [ + { + "inputs": [], + "name": "ECDSAInvalidSignature", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "length", + "type": "uint256" + } + ], + "name": "ECDSAInvalidSignatureLength", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "ECDSAInvalidSignatureS", + "type": "error" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea2646970667358221220861fc53c54256420d26202ed953c1a6a70251bfd2cbefbfb0e98c93d2669cfb464736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 DUP7 0x1F 0xC5 EXTCODECOPY SLOAD 0x25 PUSH5 0x20D26202ED SWAP6 EXTCODECOPY BYTE PUSH11 0x70251BFD2CBEFBFB0E98C9 RETURNDATASIZE 0x26 PUSH10 0xCFB464736F6C63430008 SHR STOP CALLER ", + "sourceMap": "344:11807:15:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;344:11807:15;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea2646970667358221220861fc53c54256420d26202ed953c1a6a70251bfd2cbefbfb0e98c93d2669cfb464736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 DUP7 0x1F 0xC5 EXTCODECOPY SLOAD 0x25 PUSH5 0x20D26202ED SWAP6 EXTCODECOPY BYTE PUSH11 0x70251BFD2CBEFBFB0E98C9 RETURNDATASIZE 0x26 PUSH10 0xCFB464736F6C63430008 SHR STOP CALLER ", + "sourceMap": "344:11807:15:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"ECDSAInvalidSignature\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"length\",\"type\":\"uint256\"}],\"name\":\"ECDSAInvalidSignatureLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"ECDSAInvalidSignatureS\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"Elliptic Curve Digital Signature Algorithm (ECDSA) operations. These functions can be used to verify that a message was signed by the holder of the private keys of a given address.\",\"errors\":{\"ECDSAInvalidSignature()\":[{\"details\":\"The signature is invalid.\"}],\"ECDSAInvalidSignatureLength(uint256)\":[{\"details\":\"The signature has an invalid length.\"}],\"ECDSAInvalidSignatureS(bytes32)\":[{\"details\":\"The signature has an S value that is in the upper half order.\"}]},\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":\"ECDSA\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"keccak256\":\"0xbeb5cad8aaabe0d35d2ec1a8414d91e81e5a8ca679add4cf57e2f33476861f40\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ebb272a5ee2da4e8bd5551334e0ce8dce4e9c56a04570d6bf046d260fab3116a\",\"dweb:/ipfs/QmNw6RyM769qcqFocDq6HJMG2WiEnQbvizpRaUXsACHho2\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/cryptography/EIP712.sol": { + "EIP712": { + "abi": [ + { + "inputs": [], + "name": "InvalidShortString", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "str", + "type": "string" + } + ], + "name": "StringTooLong", + "type": "error" + }, + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "methodIdentifiers": { + "eip712Domain()": "84b0196e" + } + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"InvalidShortString\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"str\",\"type\":\"string\"}],\"name\":\"StringTooLong\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"EIP712DomainChanged\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"eip712Domain\",\"outputs\":[{\"internalType\":\"bytes1\",\"name\":\"fields\",\"type\":\"bytes1\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"verifyingContract\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"extensions\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"custom:oz-upgrades-unsafe-allow\":\"state-variable-immutable\",\"details\":\"https://eips.ethereum.org/EIPS/eip-712[EIP-712] is a standard for hashing and signing of typed structured data. The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to produce the hash of their typed data using a combination of `abi.encode` and `keccak256`. This contract implements the EIP-712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA ({_hashTypedDataV4}). The implementation of the domain separator was designed to be as efficient as possible while still properly updating the chain id to protect against replay attacks on an eventual fork of the chain. NOTE: This contract implements the version of the encoding known as \\\"v4\\\", as implemented by the JSON RPC method https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\",\"events\":{\"EIP712DomainChanged()\":{\"details\":\"MAY be emitted to signal that the domain could have changed.\"}},\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the domain separator and parameter caches. The meaning of `name` and `version` is specified in https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP-712]: - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. - `version`: the current major version of the signing domain. NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart contract upgrade].\"},\"eip712Domain()\":{\"details\":\"returns the fields and values that describe the domain separator used by this contract for EIP-712 signature.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/cryptography/EIP712.sol\":\"EIP712\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/IERC5267.sol\":{\"keccak256\":\"0xfb223a85dd0b2175cfbbaa325a744e2cd74ecd17c3df2b77b0722f991d2725ee\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://84bf1dea0589ec49c8d15d559cc6d86ee493048a89b2d4adb60fbe705a3d89ae\",\"dweb:/ipfs/Qmd56n556d529wk2pRMhYhm5nhMDhviwereodDikjs68w1\"]},\"@openzeppelin/contracts/utils/Bytes.sol\":{\"keccak256\":\"0xf80e4b96b6849936ea0fabd76cf81b13d7276295fddb1e1c07afb3ddf650b0ac\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6430007255ac11c6e9c4331a418f3af52ff66fbbae959f645301d025b20aeb08\",\"dweb:/ipfs/QmQE5fjmBBRw9ndnzJuC2uskYss1gbaR7JdazoCf1FGoBj\"]},\"@openzeppelin/contracts/utils/Panic.sol\":{\"keccak256\":\"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c6a5ff4f9fd8649b7ee20800b7fa387d3465bd77cf20c2d1068cd5c98e1ed57a\",\"dweb:/ipfs/QmVSaVJf9FXFhdYEYeCEfjMVHrxDh5qL4CGkxdMWpQCrqG\"]},\"@openzeppelin/contracts/utils/ShortStrings.sol\":{\"keccak256\":\"0x0768b3bdb701fe4994b3be932ca8635551dfebe04c645f77500322741bebf57c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a2059f9ca8d3c11c49ca49fc9c5fb070f18cc85d12a7688e45322ed0e2a1cb99\",\"dweb:/ipfs/QmS2gwX51RAvSw4tYbjHccY2CKbh2uvDzqHLAFXdsddgia\"]},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"keccak256\":\"0xcf74f855663ce2ae00ed8352666b7935f6cddea2932fdf2c3ecd30a9b1cd0e97\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9f660b1f351b757dfe01438e59888f31f33ded3afcf5cb5b0d9bf9aa6f320a8b\",\"dweb:/ipfs/QmarDJ5hZEgBtCmmrVzEZWjub9769eD686jmzb2XpSU1cM\"]},\"@openzeppelin/contracts/utils/Strings.sol\":{\"keccak256\":\"0x1fdc2de9585ab0f1c417f02a873a2b6343cd64bb7ffec6b00ffa11a4a158d9e8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1ab223a3d969c6cd7610049431dd42740960c477e45878f5d8b54411f7a32bdc\",\"dweb:/ipfs/QmWumhjvhpKcwx3vDPQninsNVTc3BGvqaihkQakFkQYpaS\"]},\"@openzeppelin/contracts/utils/cryptography/EIP712.sol\":{\"keccak256\":\"0x8440117ea216b97a7bad690a67449fd372c840d073c8375822667e14702782b4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ebb6645995b8290d0b9121825e2533e4e28977b2c6befee76e15e58f0feb61d4\",\"dweb:/ipfs/QmVR72j6kL5R2txuihieDev1FeTi4KWJS1Z6ABbwL3Qtph\"]},\"@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol\":{\"keccak256\":\"0x6d8579873b9650426bfbd2a754092d1725049ca05e4e3c8c2c82dd9f3453129d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1fa3127a8968d55096d37124a9e212013af112affa5e30b84a1d22263c31576c\",\"dweb:/ipfs/QmetxaVcn5Q6nkpF9yXzaxPQ7d3rgrhV13sTH9BgiuzGJL\"]},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"keccak256\":\"0x59973a93b1f983f94e10529f46ca46544a9fec2b5f56fb1390bbe9e0dc79f857\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c55ef8f0b9719790c2ae6f81d80a59ffb89f2f0abe6bc065585bd79edce058c5\",\"dweb:/ipfs/QmNNmCbX9NjPXKqHJN8R1WC2rNeZSQrPZLd6FF6AKLyH5Y\"]},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"keccak256\":\"0xc8cae21c9ae4a46e5162ff9bf5b351d6fa6a6eba72d515f3bc1bdfeda7fdf083\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce830ebcf28e31643caba318996db3763c36d52cd0f23798ba83c135355d45e9\",\"dweb:/ipfs/QmdGPcvptHN7UBCbUYBbRX3hiRVRFLRwno8b4uga6uFNif\"]},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"keccak256\":\"0xb1970fac7b64e6c09611e6691791e848d5e3fe410fa5899e7df2e0afd77a99e3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://db5fbb3dddd8b7047465b62575d96231ba8a2774d37fb4737fbf23340fabbb03\",\"dweb:/ipfs/QmVUSvooZKEdEdap619tcJjTLcAuH6QBdZqAzWwnAXZAWJ\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol": { + "MessageHashUtils": { + "abi": [ + { + "inputs": [], + "name": "ERC5267ExtensionsNotSupported", + "type": "error" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212206131ed8ee4dbbce47bcc4c6f88c9616eec0a3b2c76e6ecedd23ff36dd351a5da64736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 PUSH2 0x31ED DUP15 0xE4 0xDB 0xBC 0xE4 PUSH28 0xCC4C6F88C9616EEC0A3B2C76E6ECEDD23FF36DD351A5DA64736F6C63 NUMBER STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "521:8109:17:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;521:8109:17;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212206131ed8ee4dbbce47bcc4c6f88c9616eec0a3b2c76e6ecedd23ff36dd351a5da64736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 PUSH2 0x31ED DUP15 0xE4 0xDB 0xBC 0xE4 PUSH28 0xCC4C6F88C9616EEC0A3B2C76E6ECEDD23FF36DD351A5DA64736F6C63 NUMBER STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "521:8109:17:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"ERC5267ExtensionsNotSupported\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing. The library provides methods for generating a hash of a message that conforms to the https://eips.ethereum.org/EIPS/eip-191[ERC-191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712] specifications.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol\":\"MessageHashUtils\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Bytes.sol\":{\"keccak256\":\"0xf80e4b96b6849936ea0fabd76cf81b13d7276295fddb1e1c07afb3ddf650b0ac\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6430007255ac11c6e9c4331a418f3af52ff66fbbae959f645301d025b20aeb08\",\"dweb:/ipfs/QmQE5fjmBBRw9ndnzJuC2uskYss1gbaR7JdazoCf1FGoBj\"]},\"@openzeppelin/contracts/utils/Panic.sol\":{\"keccak256\":\"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c6a5ff4f9fd8649b7ee20800b7fa387d3465bd77cf20c2d1068cd5c98e1ed57a\",\"dweb:/ipfs/QmVSaVJf9FXFhdYEYeCEfjMVHrxDh5qL4CGkxdMWpQCrqG\"]},\"@openzeppelin/contracts/utils/Strings.sol\":{\"keccak256\":\"0x1fdc2de9585ab0f1c417f02a873a2b6343cd64bb7ffec6b00ffa11a4a158d9e8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1ab223a3d969c6cd7610049431dd42740960c477e45878f5d8b54411f7a32bdc\",\"dweb:/ipfs/QmWumhjvhpKcwx3vDPQninsNVTc3BGvqaihkQakFkQYpaS\"]},\"@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol\":{\"keccak256\":\"0x6d8579873b9650426bfbd2a754092d1725049ca05e4e3c8c2c82dd9f3453129d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1fa3127a8968d55096d37124a9e212013af112affa5e30b84a1d22263c31576c\",\"dweb:/ipfs/QmetxaVcn5Q6nkpF9yXzaxPQ7d3rgrhV13sTH9BgiuzGJL\"]},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"keccak256\":\"0x59973a93b1f983f94e10529f46ca46544a9fec2b5f56fb1390bbe9e0dc79f857\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c55ef8f0b9719790c2ae6f81d80a59ffb89f2f0abe6bc065585bd79edce058c5\",\"dweb:/ipfs/QmNNmCbX9NjPXKqHJN8R1WC2rNeZSQrPZLd6FF6AKLyH5Y\"]},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"keccak256\":\"0xc8cae21c9ae4a46e5162ff9bf5b351d6fa6a6eba72d515f3bc1bdfeda7fdf083\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce830ebcf28e31643caba318996db3763c36d52cd0f23798ba83c135355d45e9\",\"dweb:/ipfs/QmdGPcvptHN7UBCbUYBbRX3hiRVRFLRwno8b4uga6uFNif\"]},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"keccak256\":\"0xb1970fac7b64e6c09611e6691791e848d5e3fe410fa5899e7df2e0afd77a99e3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://db5fbb3dddd8b7047465b62575d96231ba8a2774d37fb4737fbf23340fabbb03\",\"dweb:/ipfs/QmVUSvooZKEdEdap619tcJjTLcAuH6QBdZqAzWwnAXZAWJ\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "IERC165": { + "abi": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "methodIdentifiers": { + "supportsInterface(bytes4)": "01ffc9a7" + } + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Interface of the ERC-165 standard, as defined in the https://eips.ethereum.org/EIPS/eip-165[ERC]. Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}.\",\"kind\":\"dev\",\"methods\":{\"supportsInterface(bytes4)\":{\"details\":\"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section] to learn more about how these ids are created. This function call must use less than 30 000 gas.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":\"IERC165\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x8891738ffe910f0cf2da09566928589bf5d63f4524dd734fd9cedbac3274dd5c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://971f954442df5c2ef5b5ebf1eb245d7105d9fbacc7386ee5c796df1d45b21617\",\"dweb:/ipfs/QmadRjHbkicwqwwh61raUEapaVEtaLMcYbQZWs9gUkgj3u\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "Math": { + "abi": [], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea264697066735822122091005e0c663891cd7c55899184f368372b30b74607e9cbbb4e1eb5ac7371189564736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 SWAP2 STOP MCOPY 0xC PUSH7 0x3891CD7C558991 DUP5 RETURN PUSH9 0x372B30B74607E9CBBB 0x4E 0x1E 0xB5 0xAC PUSH20 0x71189564736F6C634300081C0033000000000000 ", + "sourceMap": "281:32382:19:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;281:32382:19;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea264697066735822122091005e0c663891cd7c55899184f368372b30b74607e9cbbb4e1eb5ac7371189564736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 SWAP2 STOP MCOPY 0xC PUSH7 0x3891CD7C558991 DUP5 RETURN PUSH9 0x372B30B74607E9CBBB 0x4E 0x1E 0xB5 0xAC PUSH20 0x71189564736F6C634300081C0033000000000000 ", + "sourceMap": "281:32382:19:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Standard math utilities missing in the Solidity language.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/math/Math.sol\":\"Math\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Panic.sol\":{\"keccak256\":\"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c6a5ff4f9fd8649b7ee20800b7fa387d3465bd77cf20c2d1068cd5c98e1ed57a\",\"dweb:/ipfs/QmVSaVJf9FXFhdYEYeCEfjMVHrxDh5qL4CGkxdMWpQCrqG\"]},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"keccak256\":\"0x59973a93b1f983f94e10529f46ca46544a9fec2b5f56fb1390bbe9e0dc79f857\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c55ef8f0b9719790c2ae6f81d80a59ffb89f2f0abe6bc065585bd79edce058c5\",\"dweb:/ipfs/QmNNmCbX9NjPXKqHJN8R1WC2rNeZSQrPZLd6FF6AKLyH5Y\"]},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"keccak256\":\"0xc8cae21c9ae4a46e5162ff9bf5b351d6fa6a6eba72d515f3bc1bdfeda7fdf083\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce830ebcf28e31643caba318996db3763c36d52cd0f23798ba83c135355d45e9\",\"dweb:/ipfs/QmdGPcvptHN7UBCbUYBbRX3hiRVRFLRwno8b4uga6uFNif\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/math/SafeCast.sol": { + "SafeCast": { + "abi": [ + { + "inputs": [ + { + "internalType": "uint8", + "name": "bits", + "type": "uint8" + }, + { + "internalType": "int256", + "name": "value", + "type": "int256" + } + ], + "name": "SafeCastOverflowedIntDowncast", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "int256", + "name": "value", + "type": "int256" + } + ], + "name": "SafeCastOverflowedIntToUint", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "bits", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "SafeCastOverflowedUintDowncast", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "SafeCastOverflowedUintToInt", + "type": "error" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212206e23643c396df695b2797f650857ef0eb0576e47d97a4599ed83883f99aad72664736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 PUSH15 0x23643C396DF695B2797F650857EF0E 0xB0 JUMPI PUSH15 0x47D97A4599ED83883F99AAD7266473 PUSH16 0x6C634300081C00330000000000000000 ", + "sourceMap": "769:34170:20:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;769:34170:20;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212206e23643c396df695b2797f650857ef0eb0576e47d97a4599ed83883f99aad72664736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 PUSH15 0x23643C396DF695B2797F650857EF0E 0xB0 JUMPI PUSH15 0x47D97A4599ED83883F99AAD7266473 PUSH16 0x6C634300081C00330000000000000000 ", + "sourceMap": "769:34170:20:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"bits\",\"type\":\"uint8\"},{\"internalType\":\"int256\",\"name\":\"value\",\"type\":\"int256\"}],\"name\":\"SafeCastOverflowedIntDowncast\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"int256\",\"name\":\"value\",\"type\":\"int256\"}],\"name\":\"SafeCastOverflowedIntToUint\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"bits\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"SafeCastOverflowedUintDowncast\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"SafeCastOverflowedUintToInt\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow checks. Downcasting from uint256/int256 in Solidity does not revert on overflow. This can easily result in undesired exploitation or bugs, since developers usually assume that overflows raise errors. `SafeCast` restores this intuition by reverting the transaction when such an operation overflows. Using this library instead of the unchecked operations eliminates an entire class of bugs, so it's recommended to use it always.\",\"errors\":{\"SafeCastOverflowedIntDowncast(uint8,int256)\":[{\"details\":\"Value doesn't fit in an int of `bits` size.\"}],\"SafeCastOverflowedIntToUint(int256)\":[{\"details\":\"An int value doesn't fit in a uint of `bits` size.\"}],\"SafeCastOverflowedUintDowncast(uint8,uint256)\":[{\"details\":\"Value doesn't fit in a uint of `bits` size.\"}],\"SafeCastOverflowedUintToInt(uint256)\":[{\"details\":\"A uint value doesn't fit in an int of `bits` size.\"}]},\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/math/SafeCast.sol\":\"SafeCast\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"keccak256\":\"0xc8cae21c9ae4a46e5162ff9bf5b351d6fa6a6eba72d515f3bc1bdfeda7fdf083\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce830ebcf28e31643caba318996db3763c36d52cd0f23798ba83c135355d45e9\",\"dweb:/ipfs/QmdGPcvptHN7UBCbUYBbRX3hiRVRFLRwno8b4uga6uFNif\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "SignedMath": { + "abi": [], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212202c4428eb6666cae863602bfb74d48242f67136c2baeeed29a59362a5e64d7e8564736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0x2C PREVRANDAO 0x28 0xEB PUSH7 0x66CAE863602BFB PUSH21 0xD48242F67136C2BAEEED29A59362A5E64D7E856473 PUSH16 0x6C634300081C00330000000000000000 ", + "sourceMap": "258:2354:21:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;258:2354:21;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212202c4428eb6666cae863602bfb74d48242f67136c2baeeed29a59362a5e64d7e8564736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0x2C PREVRANDAO 0x28 0xEB PUSH7 0x66CAE863602BFB PUSH21 0xD48242F67136C2BAEEED29A59362A5E64D7E856473 PUSH16 0x6C634300081C00330000000000000000 ", + "sourceMap": "258:2354:21:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Standard signed math utilities missing in the Solidity language.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/math/SignedMath.sol\":\"SignedMath\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"keccak256\":\"0xc8cae21c9ae4a46e5162ff9bf5b351d6fa6a6eba72d515f3bc1bdfeda7fdf083\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce830ebcf28e31643caba318996db3763c36d52cd0f23798ba83c135355d45e9\",\"dweb:/ipfs/QmdGPcvptHN7UBCbUYBbRX3hiRVRFLRwno8b4uga6uFNif\"]},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"keccak256\":\"0xb1970fac7b64e6c09611e6691791e848d5e3fe410fa5899e7df2e0afd77a99e3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://db5fbb3dddd8b7047465b62575d96231ba8a2774d37fb4737fbf23340fabbb03\",\"dweb:/ipfs/QmVUSvooZKEdEdap619tcJjTLcAuH6QBdZqAzWwnAXZAWJ\"]}},\"version\":1}" + } + }, + "contracts/TokenRelayer.sol": { + "TokenRelayer": { + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_destinationContract", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "ECDSAInvalidSignature", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "length", + "type": "uint256" + } + ], + "name": "ECDSAInvalidSignatureLength", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "ECDSAInvalidSignatureS", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidShortString", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnableInvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "OwnableUnauthorizedAccount", + "type": "error" + }, + { + "inputs": [], + "name": "ReentrancyGuardReentrantCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "SafeERC20FailedOperation", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "str", + "type": "string" + } + ], + "name": "StringTooLong", + "type": "error" + }, + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "ETHWithdrawn", + "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": true, + "internalType": "address", + "name": "signer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RelayerExecuted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "TokenWithdrawn", + "type": "event" + }, + { + "inputs": [], + "name": "destinationContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "permitV", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "permitR", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "permitS", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "payloadData", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "payloadValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "payloadNonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "payloadDeadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "payloadV", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "payloadR", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "payloadS", + "type": "bytes32" + } + ], + "internalType": "struct TokenRelayer.ExecuteParams", + "name": "params", + "type": "tuple" + } + ], + "name": "execute", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "signer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + } + ], + "name": "isExecutionCompleted", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "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": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "usedPayloadNonces", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdrawETH", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdrawToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "evm": { + "bytecode": { + "functionDebugData": { + "@_1746": { + "entryPoint": null, + "id": 1746, + "parameterSlots": 0, + "returnSlots": 0 + }, + "@_4234": { + "entryPoint": null, + "id": 4234, + "parameterSlots": 2, + "returnSlots": 0 + }, + "@_50": { + "entryPoint": null, + "id": 50, + "parameterSlots": 1, + "returnSlots": 0 + }, + "@_8232": { + "entryPoint": null, + "id": 8232, + "parameterSlots": 1, + "returnSlots": 0 + }, + "@_buildDomainSeparator_4281": { + "entryPoint": null, + "id": 4281, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@_reentrancyGuardStorageSlot_1826": { + "entryPoint": null, + "id": 1826, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@_transferOwnership_146": { + "entryPoint": 470, + "id": 146, + "parameterSlots": 1, + "returnSlots": 0 + }, + "@getStringSlot_2145": { + "entryPoint": null, + "id": 2145, + "parameterSlots": 1, + "returnSlots": 1 + }, + "@getUint256Slot_2112": { + "entryPoint": null, + "id": 2112, + "parameterSlots": 1, + "returnSlots": 1 + }, + "@toShortStringWithFallback_1985": { + "entryPoint": 549, + "id": 1985, + "parameterSlots": 2, + "returnSlots": 1 + }, + "@toShortString_1887": { + "entryPoint": 599, + "id": 1887, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_decode_tuple_t_address_fromMemory": { + "entryPoint": 660, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_tuple_t_address__to_t_address__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_tuple_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__to_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 6, + "returnSlots": 1 + }, + "abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": 1043, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_480a3d2cf1e4838d740f40eac57f23eb6facc0baaf1a65a7b61df6a5a00ed368__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "array_dataslot_string_storage": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "clean_up_bytearray_end_slots_string_storage": { + "entryPoint": 781, + "id": null, + "parameterSlots": 3, + "returnSlots": 0 + }, + "convert_bytes_to_fixedbytes_from_t_bytes_memory_ptr_to_t_bytes32": { + "entryPoint": 1096, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "copy_byte_array_to_storage_from_t_string_memory_ptr_to_t_string_storage": { + "entryPoint": 857, + "id": null, + "parameterSlots": 2, + "returnSlots": 0 + }, + "extract_byte_array_length": { + "entryPoint": 725, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "extract_used_part_and_set_length_of_short_byte_array": { + "entryPoint": null, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "panic_error_0x41": { + "entryPoint": 705, + "id": null, + "parameterSlots": 0, + "returnSlots": 0 + } + }, + "generatedSources": [ + { + "ast": { + "nativeSrc": "0:4722:23", + "nodeType": "YulBlock", + "src": "0:4722:23", + "statements": [ + { + "nativeSrc": "6:3:23", + "nodeType": "YulBlock", + "src": "6:3:23", + "statements": [] + }, + { + "body": { + "nativeSrc": "95:209:23", + "nodeType": "YulBlock", + "src": "95:209:23", + "statements": [ + { + "body": { + "nativeSrc": "141:16:23", + "nodeType": "YulBlock", + "src": "141:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "150:1:23", + "nodeType": "YulLiteral", + "src": "150:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "153:1:23", + "nodeType": "YulLiteral", + "src": "153:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "143:6:23", + "nodeType": "YulIdentifier", + "src": "143:6:23" + }, + "nativeSrc": "143:12:23", + "nodeType": "YulFunctionCall", + "src": "143:12:23" + }, + "nativeSrc": "143:12:23", + "nodeType": "YulExpressionStatement", + "src": "143:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nativeSrc": "116:7:23", + "nodeType": "YulIdentifier", + "src": "116:7:23" + }, + { + "name": "headStart", + "nativeSrc": "125:9:23", + "nodeType": "YulIdentifier", + "src": "125:9:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "112:3:23", + "nodeType": "YulIdentifier", + "src": "112:3:23" + }, + "nativeSrc": "112:23:23", + "nodeType": "YulFunctionCall", + "src": "112:23:23" + }, + { + "kind": "number", + "nativeSrc": "137:2:23", + "nodeType": "YulLiteral", + "src": "137:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nativeSrc": "108:3:23", + "nodeType": "YulIdentifier", + "src": "108:3:23" + }, + "nativeSrc": "108:32:23", + "nodeType": "YulFunctionCall", + "src": "108:32:23" + }, + "nativeSrc": "105:52:23", + "nodeType": "YulIf", + "src": "105:52:23" + }, + { + "nativeSrc": "166:29:23", + "nodeType": "YulVariableDeclaration", + "src": "166:29:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "185:9:23", + "nodeType": "YulIdentifier", + "src": "185:9:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "179:5:23", + "nodeType": "YulIdentifier", + "src": "179:5:23" + }, + "nativeSrc": "179:16:23", + "nodeType": "YulFunctionCall", + "src": "179:16:23" + }, + "variables": [ + { + "name": "value", + "nativeSrc": "170:5:23", + "nodeType": "YulTypedName", + "src": "170:5:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "258:16:23", + "nodeType": "YulBlock", + "src": "258:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "267:1:23", + "nodeType": "YulLiteral", + "src": "267:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "270:1:23", + "nodeType": "YulLiteral", + "src": "270:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "260:6:23", + "nodeType": "YulIdentifier", + "src": "260:6:23" + }, + "nativeSrc": "260:12:23", + "nodeType": "YulFunctionCall", + "src": "260:12:23" + }, + "nativeSrc": "260:12:23", + "nodeType": "YulExpressionStatement", + "src": "260:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nativeSrc": "217:5:23", + "nodeType": "YulIdentifier", + "src": "217:5:23" + }, + { + "arguments": [ + { + "name": "value", + "nativeSrc": "228:5:23", + "nodeType": "YulIdentifier", + "src": "228:5:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "243:3:23", + "nodeType": "YulLiteral", + "src": "243:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "248:1:23", + "nodeType": "YulLiteral", + "src": "248:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "239:3:23", + "nodeType": "YulIdentifier", + "src": "239:3:23" + }, + "nativeSrc": "239:11:23", + "nodeType": "YulFunctionCall", + "src": "239:11:23" + }, + { + "kind": "number", + "nativeSrc": "252:1:23", + "nodeType": "YulLiteral", + "src": "252:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "235:3:23", + "nodeType": "YulIdentifier", + "src": "235:3:23" + }, + "nativeSrc": "235:19:23", + "nodeType": "YulFunctionCall", + "src": "235:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "224:3:23", + "nodeType": "YulIdentifier", + "src": "224:3:23" + }, + "nativeSrc": "224:31:23", + "nodeType": "YulFunctionCall", + "src": "224:31:23" + } + ], + "functionName": { + "name": "eq", + "nativeSrc": "214:2:23", + "nodeType": "YulIdentifier", + "src": "214:2:23" + }, + "nativeSrc": "214:42:23", + "nodeType": "YulFunctionCall", + "src": "214:42:23" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "207:6:23", + "nodeType": "YulIdentifier", + "src": "207:6:23" + }, + "nativeSrc": "207:50:23", + "nodeType": "YulFunctionCall", + "src": "207:50:23" + }, + "nativeSrc": "204:70:23", + "nodeType": "YulIf", + "src": "204:70:23" + }, + { + "nativeSrc": "283:15:23", + "nodeType": "YulAssignment", + "src": "283:15:23", + "value": { + "name": "value", + "nativeSrc": "293:5:23", + "nodeType": "YulIdentifier", + "src": "293:5:23" + }, + "variableNames": [ + { + "name": "value0", + "nativeSrc": "283:6:23", + "nodeType": "YulIdentifier", + "src": "283:6:23" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_address_fromMemory", + "nativeSrc": "14:290:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "61:9:23", + "nodeType": "YulTypedName", + "src": "61:9:23", + "type": "" + }, + { + "name": "dataEnd", + "nativeSrc": "72:7:23", + "nodeType": "YulTypedName", + "src": "72:7:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nativeSrc": "84:6:23", + "nodeType": "YulTypedName", + "src": "84:6:23", + "type": "" + } + ], + "src": "14:290:23" + }, + { + "body": { + "nativeSrc": "410:102:23", + "nodeType": "YulBlock", + "src": "410:102:23", + "statements": [ + { + "nativeSrc": "420:26:23", + "nodeType": "YulAssignment", + "src": "420:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "432:9:23", + "nodeType": "YulIdentifier", + "src": "432:9:23" + }, + { + "kind": "number", + "nativeSrc": "443:2:23", + "nodeType": "YulLiteral", + "src": "443:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "428:3:23", + "nodeType": "YulIdentifier", + "src": "428:3:23" + }, + "nativeSrc": "428:18:23", + "nodeType": "YulFunctionCall", + "src": "428:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "420:4:23", + "nodeType": "YulIdentifier", + "src": "420:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "462:9:23", + "nodeType": "YulIdentifier", + "src": "462:9:23" + }, + { + "arguments": [ + { + "name": "value0", + "nativeSrc": "477:6:23", + "nodeType": "YulIdentifier", + "src": "477:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "493:3:23", + "nodeType": "YulLiteral", + "src": "493:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "498:1:23", + "nodeType": "YulLiteral", + "src": "498:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "489:3:23", + "nodeType": "YulIdentifier", + "src": "489:3:23" + }, + "nativeSrc": "489:11:23", + "nodeType": "YulFunctionCall", + "src": "489:11:23" + }, + { + "kind": "number", + "nativeSrc": "502:1:23", + "nodeType": "YulLiteral", + "src": "502:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "485:3:23", + "nodeType": "YulIdentifier", + "src": "485:3:23" + }, + "nativeSrc": "485:19:23", + "nodeType": "YulFunctionCall", + "src": "485:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "473:3:23", + "nodeType": "YulIdentifier", + "src": "473:3:23" + }, + "nativeSrc": "473:32:23", + "nodeType": "YulFunctionCall", + "src": "473:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "455:6:23", + "nodeType": "YulIdentifier", + "src": "455:6:23" + }, + "nativeSrc": "455:51:23", + "nodeType": "YulFunctionCall", + "src": "455:51:23" + }, + "nativeSrc": "455:51:23", + "nodeType": "YulExpressionStatement", + "src": "455:51:23" + } + ] + }, + "name": "abi_encode_tuple_t_address__to_t_address__fromStack_reversed", + "nativeSrc": "309:203:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "379:9:23", + "nodeType": "YulTypedName", + "src": "379:9:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "390:6:23", + "nodeType": "YulTypedName", + "src": "390:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "401:4:23", + "nodeType": "YulTypedName", + "src": "401:4:23", + "type": "" + } + ], + "src": "309:203:23" + }, + { + "body": { + "nativeSrc": "691:169:23", + "nodeType": "YulBlock", + "src": "691:169:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "708:9:23", + "nodeType": "YulIdentifier", + "src": "708:9:23" + }, + { + "kind": "number", + "nativeSrc": "719:2:23", + "nodeType": "YulLiteral", + "src": "719:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "701:6:23", + "nodeType": "YulIdentifier", + "src": "701:6:23" + }, + "nativeSrc": "701:21:23", + "nodeType": "YulFunctionCall", + "src": "701:21:23" + }, + "nativeSrc": "701:21:23", + "nodeType": "YulExpressionStatement", + "src": "701:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "742:9:23", + "nodeType": "YulIdentifier", + "src": "742:9:23" + }, + { + "kind": "number", + "nativeSrc": "753:2:23", + "nodeType": "YulLiteral", + "src": "753:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "738:3:23", + "nodeType": "YulIdentifier", + "src": "738:3:23" + }, + "nativeSrc": "738:18:23", + "nodeType": "YulFunctionCall", + "src": "738:18:23" + }, + { + "kind": "number", + "nativeSrc": "758:2:23", + "nodeType": "YulLiteral", + "src": "758:2:23", + "type": "", + "value": "19" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "731:6:23", + "nodeType": "YulIdentifier", + "src": "731:6:23" + }, + "nativeSrc": "731:30:23", + "nodeType": "YulFunctionCall", + "src": "731:30:23" + }, + "nativeSrc": "731:30:23", + "nodeType": "YulExpressionStatement", + "src": "731:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "781:9:23", + "nodeType": "YulIdentifier", + "src": "781:9:23" + }, + { + "kind": "number", + "nativeSrc": "792:2:23", + "nodeType": "YulLiteral", + "src": "792:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "777:3:23", + "nodeType": "YulIdentifier", + "src": "777:3:23" + }, + "nativeSrc": "777:18:23", + "nodeType": "YulFunctionCall", + "src": "777:18:23" + }, + { + "hexValue": "496e76616c69642064657374696e6174696f6e", + "kind": "string", + "nativeSrc": "797:21:23", + "nodeType": "YulLiteral", + "src": "797:21:23", + "type": "", + "value": "Invalid destination" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "770:6:23", + "nodeType": "YulIdentifier", + "src": "770:6:23" + }, + "nativeSrc": "770:49:23", + "nodeType": "YulFunctionCall", + "src": "770:49:23" + }, + "nativeSrc": "770:49:23", + "nodeType": "YulExpressionStatement", + "src": "770:49:23" + }, + { + "nativeSrc": "828:26:23", + "nodeType": "YulAssignment", + "src": "828:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "840:9:23", + "nodeType": "YulIdentifier", + "src": "840:9:23" + }, + { + "kind": "number", + "nativeSrc": "851:2:23", + "nodeType": "YulLiteral", + "src": "851:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "836:3:23", + "nodeType": "YulIdentifier", + "src": "836:3:23" + }, + "nativeSrc": "836:18:23", + "nodeType": "YulFunctionCall", + "src": "836:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "828:4:23", + "nodeType": "YulIdentifier", + "src": "828:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_480a3d2cf1e4838d740f40eac57f23eb6facc0baaf1a65a7b61df6a5a00ed368__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "517:343:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "668:9:23", + "nodeType": "YulTypedName", + "src": "668:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "682:4:23", + "nodeType": "YulTypedName", + "src": "682:4:23", + "type": "" + } + ], + "src": "517:343:23" + }, + { + "body": { + "nativeSrc": "897:95:23", + "nodeType": "YulBlock", + "src": "897:95:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "914:1:23", + "nodeType": "YulLiteral", + "src": "914:1:23", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "921:3:23", + "nodeType": "YulLiteral", + "src": "921:3:23", + "type": "", + "value": "224" + }, + { + "kind": "number", + "nativeSrc": "926:10:23", + "nodeType": "YulLiteral", + "src": "926:10:23", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "917:3:23", + "nodeType": "YulIdentifier", + "src": "917:3:23" + }, + "nativeSrc": "917:20:23", + "nodeType": "YulFunctionCall", + "src": "917:20:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "907:6:23", + "nodeType": "YulIdentifier", + "src": "907:6:23" + }, + "nativeSrc": "907:31:23", + "nodeType": "YulFunctionCall", + "src": "907:31:23" + }, + "nativeSrc": "907:31:23", + "nodeType": "YulExpressionStatement", + "src": "907:31:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "954:1:23", + "nodeType": "YulLiteral", + "src": "954:1:23", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nativeSrc": "957:4:23", + "nodeType": "YulLiteral", + "src": "957:4:23", + "type": "", + "value": "0x41" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "947:6:23", + "nodeType": "YulIdentifier", + "src": "947:6:23" + }, + "nativeSrc": "947:15:23", + "nodeType": "YulFunctionCall", + "src": "947:15:23" + }, + "nativeSrc": "947:15:23", + "nodeType": "YulExpressionStatement", + "src": "947:15:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "978:1:23", + "nodeType": "YulLiteral", + "src": "978:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "981:4:23", + "nodeType": "YulLiteral", + "src": "981:4:23", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "971:6:23", + "nodeType": "YulIdentifier", + "src": "971:6:23" + }, + "nativeSrc": "971:15:23", + "nodeType": "YulFunctionCall", + "src": "971:15:23" + }, + "nativeSrc": "971:15:23", + "nodeType": "YulExpressionStatement", + "src": "971:15:23" + } + ] + }, + "name": "panic_error_0x41", + "nativeSrc": "865:127:23", + "nodeType": "YulFunctionDefinition", + "src": "865:127:23" + }, + { + "body": { + "nativeSrc": "1052:325:23", + "nodeType": "YulBlock", + "src": "1052:325:23", + "statements": [ + { + "nativeSrc": "1062:22:23", + "nodeType": "YulAssignment", + "src": "1062:22:23", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1076:1:23", + "nodeType": "YulLiteral", + "src": "1076:1:23", + "type": "", + "value": "1" + }, + { + "name": "data", + "nativeSrc": "1079:4:23", + "nodeType": "YulIdentifier", + "src": "1079:4:23" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "1072:3:23", + "nodeType": "YulIdentifier", + "src": "1072:3:23" + }, + "nativeSrc": "1072:12:23", + "nodeType": "YulFunctionCall", + "src": "1072:12:23" + }, + "variableNames": [ + { + "name": "length", + "nativeSrc": "1062:6:23", + "nodeType": "YulIdentifier", + "src": "1062:6:23" + } + ] + }, + { + "nativeSrc": "1093:38:23", + "nodeType": "YulVariableDeclaration", + "src": "1093:38:23", + "value": { + "arguments": [ + { + "name": "data", + "nativeSrc": "1123:4:23", + "nodeType": "YulIdentifier", + "src": "1123:4:23" + }, + { + "kind": "number", + "nativeSrc": "1129:1:23", + "nodeType": "YulLiteral", + "src": "1129:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "1119:3:23", + "nodeType": "YulIdentifier", + "src": "1119:3:23" + }, + "nativeSrc": "1119:12:23", + "nodeType": "YulFunctionCall", + "src": "1119:12:23" + }, + "variables": [ + { + "name": "outOfPlaceEncoding", + "nativeSrc": "1097:18:23", + "nodeType": "YulTypedName", + "src": "1097:18:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "1170:31:23", + "nodeType": "YulBlock", + "src": "1170:31:23", + "statements": [ + { + "nativeSrc": "1172:27:23", + "nodeType": "YulAssignment", + "src": "1172:27:23", + "value": { + "arguments": [ + { + "name": "length", + "nativeSrc": "1186:6:23", + "nodeType": "YulIdentifier", + "src": "1186:6:23" + }, + { + "kind": "number", + "nativeSrc": "1194:4:23", + "nodeType": "YulLiteral", + "src": "1194:4:23", + "type": "", + "value": "0x7f" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "1182:3:23", + "nodeType": "YulIdentifier", + "src": "1182:3:23" + }, + "nativeSrc": "1182:17:23", + "nodeType": "YulFunctionCall", + "src": "1182:17:23" + }, + "variableNames": [ + { + "name": "length", + "nativeSrc": "1172:6:23", + "nodeType": "YulIdentifier", + "src": "1172:6:23" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nativeSrc": "1150:18:23", + "nodeType": "YulIdentifier", + "src": "1150:18:23" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "1143:6:23", + "nodeType": "YulIdentifier", + "src": "1143:6:23" + }, + "nativeSrc": "1143:26:23", + "nodeType": "YulFunctionCall", + "src": "1143:26:23" + }, + "nativeSrc": "1140:61:23", + "nodeType": "YulIf", + "src": "1140:61:23" + }, + { + "body": { + "nativeSrc": "1260:111:23", + "nodeType": "YulBlock", + "src": "1260:111:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1281:1:23", + "nodeType": "YulLiteral", + "src": "1281:1:23", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1288:3:23", + "nodeType": "YulLiteral", + "src": "1288:3:23", + "type": "", + "value": "224" + }, + { + "kind": "number", + "nativeSrc": "1293:10:23", + "nodeType": "YulLiteral", + "src": "1293:10:23", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "1284:3:23", + "nodeType": "YulIdentifier", + "src": "1284:3:23" + }, + "nativeSrc": "1284:20:23", + "nodeType": "YulFunctionCall", + "src": "1284:20:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1274:6:23", + "nodeType": "YulIdentifier", + "src": "1274:6:23" + }, + "nativeSrc": "1274:31:23", + "nodeType": "YulFunctionCall", + "src": "1274:31:23" + }, + "nativeSrc": "1274:31:23", + "nodeType": "YulExpressionStatement", + "src": "1274:31:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1325:1:23", + "nodeType": "YulLiteral", + "src": "1325:1:23", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nativeSrc": "1328:4:23", + "nodeType": "YulLiteral", + "src": "1328:4:23", + "type": "", + "value": "0x22" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1318:6:23", + "nodeType": "YulIdentifier", + "src": "1318:6:23" + }, + "nativeSrc": "1318:15:23", + "nodeType": "YulFunctionCall", + "src": "1318:15:23" + }, + "nativeSrc": "1318:15:23", + "nodeType": "YulExpressionStatement", + "src": "1318:15:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1353:1:23", + "nodeType": "YulLiteral", + "src": "1353:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "1356:4:23", + "nodeType": "YulLiteral", + "src": "1356:4:23", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "1346:6:23", + "nodeType": "YulIdentifier", + "src": "1346:6:23" + }, + "nativeSrc": "1346:15:23", + "nodeType": "YulFunctionCall", + "src": "1346:15:23" + }, + "nativeSrc": "1346:15:23", + "nodeType": "YulExpressionStatement", + "src": "1346:15:23" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nativeSrc": "1216:18:23", + "nodeType": "YulIdentifier", + "src": "1216:18:23" + }, + { + "arguments": [ + { + "name": "length", + "nativeSrc": "1239:6:23", + "nodeType": "YulIdentifier", + "src": "1239:6:23" + }, + { + "kind": "number", + "nativeSrc": "1247:2:23", + "nodeType": "YulLiteral", + "src": "1247:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "1236:2:23", + "nodeType": "YulIdentifier", + "src": "1236:2:23" + }, + "nativeSrc": "1236:14:23", + "nodeType": "YulFunctionCall", + "src": "1236:14:23" + } + ], + "functionName": { + "name": "eq", + "nativeSrc": "1213:2:23", + "nodeType": "YulIdentifier", + "src": "1213:2:23" + }, + "nativeSrc": "1213:38:23", + "nodeType": "YulFunctionCall", + "src": "1213:38:23" + }, + "nativeSrc": "1210:161:23", + "nodeType": "YulIf", + "src": "1210:161:23" + } + ] + }, + "name": "extract_byte_array_length", + "nativeSrc": "997:380:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "data", + "nativeSrc": "1032:4:23", + "nodeType": "YulTypedName", + "src": "1032:4:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "length", + "nativeSrc": "1041:6:23", + "nodeType": "YulTypedName", + "src": "1041:6:23", + "type": "" + } + ], + "src": "997:380:23" + }, + { + "body": { + "nativeSrc": "1438:65:23", + "nodeType": "YulBlock", + "src": "1438:65:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1455:1:23", + "nodeType": "YulLiteral", + "src": "1455:1:23", + "type": "", + "value": "0" + }, + { + "name": "ptr", + "nativeSrc": "1458:3:23", + "nodeType": "YulIdentifier", + "src": "1458:3:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1448:6:23", + "nodeType": "YulIdentifier", + "src": "1448:6:23" + }, + "nativeSrc": "1448:14:23", + "nodeType": "YulFunctionCall", + "src": "1448:14:23" + }, + "nativeSrc": "1448:14:23", + "nodeType": "YulExpressionStatement", + "src": "1448:14:23" + }, + { + "nativeSrc": "1471:26:23", + "nodeType": "YulAssignment", + "src": "1471:26:23", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1489:1:23", + "nodeType": "YulLiteral", + "src": "1489:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "1492:4:23", + "nodeType": "YulLiteral", + "src": "1492:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "keccak256", + "nativeSrc": "1479:9:23", + "nodeType": "YulIdentifier", + "src": "1479:9:23" + }, + "nativeSrc": "1479:18:23", + "nodeType": "YulFunctionCall", + "src": "1479:18:23" + }, + "variableNames": [ + { + "name": "data", + "nativeSrc": "1471:4:23", + "nodeType": "YulIdentifier", + "src": "1471:4:23" + } + ] + } + ] + }, + "name": "array_dataslot_string_storage", + "nativeSrc": "1382:121:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "ptr", + "nativeSrc": "1421:3:23", + "nodeType": "YulTypedName", + "src": "1421:3:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "data", + "nativeSrc": "1429:4:23", + "nodeType": "YulTypedName", + "src": "1429:4:23", + "type": "" + } + ], + "src": "1382:121:23" + }, + { + "body": { + "nativeSrc": "1589:437:23", + "nodeType": "YulBlock", + "src": "1589:437:23", + "statements": [ + { + "body": { + "nativeSrc": "1622:398:23", + "nodeType": "YulBlock", + "src": "1622:398:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1643:1:23", + "nodeType": "YulLiteral", + "src": "1643:1:23", + "type": "", + "value": "0" + }, + { + "name": "array", + "nativeSrc": "1646:5:23", + "nodeType": "YulIdentifier", + "src": "1646:5:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1636:6:23", + "nodeType": "YulIdentifier", + "src": "1636:6:23" + }, + "nativeSrc": "1636:16:23", + "nodeType": "YulFunctionCall", + "src": "1636:16:23" + }, + "nativeSrc": "1636:16:23", + "nodeType": "YulExpressionStatement", + "src": "1636:16:23" + }, + { + "nativeSrc": "1665:30:23", + "nodeType": "YulVariableDeclaration", + "src": "1665:30:23", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1687:1:23", + "nodeType": "YulLiteral", + "src": "1687:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "1690:4:23", + "nodeType": "YulLiteral", + "src": "1690:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "keccak256", + "nativeSrc": "1677:9:23", + "nodeType": "YulIdentifier", + "src": "1677:9:23" + }, + "nativeSrc": "1677:18:23", + "nodeType": "YulFunctionCall", + "src": "1677:18:23" + }, + "variables": [ + { + "name": "data", + "nativeSrc": "1669:4:23", + "nodeType": "YulTypedName", + "src": "1669:4:23", + "type": "" + } + ] + }, + { + "nativeSrc": "1708:57:23", + "nodeType": "YulVariableDeclaration", + "src": "1708:57:23", + "value": { + "arguments": [ + { + "name": "data", + "nativeSrc": "1731:4:23", + "nodeType": "YulIdentifier", + "src": "1731:4:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1741:1:23", + "nodeType": "YulLiteral", + "src": "1741:1:23", + "type": "", + "value": "5" + }, + { + "arguments": [ + { + "name": "startIndex", + "nativeSrc": "1748:10:23", + "nodeType": "YulIdentifier", + "src": "1748:10:23" + }, + { + "kind": "number", + "nativeSrc": "1760:2:23", + "nodeType": "YulLiteral", + "src": "1760:2:23", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1744:3:23", + "nodeType": "YulIdentifier", + "src": "1744:3:23" + }, + "nativeSrc": "1744:19:23", + "nodeType": "YulFunctionCall", + "src": "1744:19:23" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "1737:3:23", + "nodeType": "YulIdentifier", + "src": "1737:3:23" + }, + "nativeSrc": "1737:27:23", + "nodeType": "YulFunctionCall", + "src": "1737:27:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1727:3:23", + "nodeType": "YulIdentifier", + "src": "1727:3:23" + }, + "nativeSrc": "1727:38:23", + "nodeType": "YulFunctionCall", + "src": "1727:38:23" + }, + "variables": [ + { + "name": "deleteStart", + "nativeSrc": "1712:11:23", + "nodeType": "YulTypedName", + "src": "1712:11:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "1802:23:23", + "nodeType": "YulBlock", + "src": "1802:23:23", + "statements": [ + { + "nativeSrc": "1804:19:23", + "nodeType": "YulAssignment", + "src": "1804:19:23", + "value": { + "name": "data", + "nativeSrc": "1819:4:23", + "nodeType": "YulIdentifier", + "src": "1819:4:23" + }, + "variableNames": [ + { + "name": "deleteStart", + "nativeSrc": "1804:11:23", + "nodeType": "YulIdentifier", + "src": "1804:11:23" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "startIndex", + "nativeSrc": "1784:10:23", + "nodeType": "YulIdentifier", + "src": "1784:10:23" + }, + { + "kind": "number", + "nativeSrc": "1796:4:23", + "nodeType": "YulLiteral", + "src": "1796:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "1781:2:23", + "nodeType": "YulIdentifier", + "src": "1781:2:23" + }, + "nativeSrc": "1781:20:23", + "nodeType": "YulFunctionCall", + "src": "1781:20:23" + }, + "nativeSrc": "1778:47:23", + "nodeType": "YulIf", + "src": "1778:47:23" + }, + { + "nativeSrc": "1838:41:23", + "nodeType": "YulVariableDeclaration", + "src": "1838:41:23", + "value": { + "arguments": [ + { + "name": "data", + "nativeSrc": "1852:4:23", + "nodeType": "YulIdentifier", + "src": "1852:4:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1862:1:23", + "nodeType": "YulLiteral", + "src": "1862:1:23", + "type": "", + "value": "5" + }, + { + "arguments": [ + { + "name": "len", + "nativeSrc": "1869:3:23", + "nodeType": "YulIdentifier", + "src": "1869:3:23" + }, + { + "kind": "number", + "nativeSrc": "1874:2:23", + "nodeType": "YulLiteral", + "src": "1874:2:23", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1865:3:23", + "nodeType": "YulIdentifier", + "src": "1865:3:23" + }, + "nativeSrc": "1865:12:23", + "nodeType": "YulFunctionCall", + "src": "1865:12:23" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "1858:3:23", + "nodeType": "YulIdentifier", + "src": "1858:3:23" + }, + "nativeSrc": "1858:20:23", + "nodeType": "YulFunctionCall", + "src": "1858:20:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1848:3:23", + "nodeType": "YulIdentifier", + "src": "1848:3:23" + }, + "nativeSrc": "1848:31:23", + "nodeType": "YulFunctionCall", + "src": "1848:31:23" + }, + "variables": [ + { + "name": "_1", + "nativeSrc": "1842:2:23", + "nodeType": "YulTypedName", + "src": "1842:2:23", + "type": "" + } + ] + }, + { + "nativeSrc": "1892:24:23", + "nodeType": "YulVariableDeclaration", + "src": "1892:24:23", + "value": { + "name": "deleteStart", + "nativeSrc": "1905:11:23", + "nodeType": "YulIdentifier", + "src": "1905:11:23" + }, + "variables": [ + { + "name": "start", + "nativeSrc": "1896:5:23", + "nodeType": "YulTypedName", + "src": "1896:5:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "1990:20:23", + "nodeType": "YulBlock", + "src": "1990:20:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "start", + "nativeSrc": "1999:5:23", + "nodeType": "YulIdentifier", + "src": "1999:5:23" + }, + { + "kind": "number", + "nativeSrc": "2006:1:23", + "nodeType": "YulLiteral", + "src": "2006:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "sstore", + "nativeSrc": "1992:6:23", + "nodeType": "YulIdentifier", + "src": "1992:6:23" + }, + "nativeSrc": "1992:16:23", + "nodeType": "YulFunctionCall", + "src": "1992:16:23" + }, + "nativeSrc": "1992:16:23", + "nodeType": "YulExpressionStatement", + "src": "1992:16:23" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "start", + "nativeSrc": "1940:5:23", + "nodeType": "YulIdentifier", + "src": "1940:5:23" + }, + { + "name": "_1", + "nativeSrc": "1947:2:23", + "nodeType": "YulIdentifier", + "src": "1947:2:23" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "1937:2:23", + "nodeType": "YulIdentifier", + "src": "1937:2:23" + }, + "nativeSrc": "1937:13:23", + "nodeType": "YulFunctionCall", + "src": "1937:13:23" + }, + "nativeSrc": "1929:81:23", + "nodeType": "YulForLoop", + "post": { + "nativeSrc": "1951:26:23", + "nodeType": "YulBlock", + "src": "1951:26:23", + "statements": [ + { + "nativeSrc": "1953:22:23", + "nodeType": "YulAssignment", + "src": "1953:22:23", + "value": { + "arguments": [ + { + "name": "start", + "nativeSrc": "1966:5:23", + "nodeType": "YulIdentifier", + "src": "1966:5:23" + }, + { + "kind": "number", + "nativeSrc": "1973:1:23", + "nodeType": "YulLiteral", + "src": "1973:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1962:3:23", + "nodeType": "YulIdentifier", + "src": "1962:3:23" + }, + "nativeSrc": "1962:13:23", + "nodeType": "YulFunctionCall", + "src": "1962:13:23" + }, + "variableNames": [ + { + "name": "start", + "nativeSrc": "1953:5:23", + "nodeType": "YulIdentifier", + "src": "1953:5:23" + } + ] + } + ] + }, + "pre": { + "nativeSrc": "1933:3:23", + "nodeType": "YulBlock", + "src": "1933:3:23", + "statements": [] + }, + "src": "1929:81:23" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "len", + "nativeSrc": "1605:3:23", + "nodeType": "YulIdentifier", + "src": "1605:3:23" + }, + { + "kind": "number", + "nativeSrc": "1610:2:23", + "nodeType": "YulLiteral", + "src": "1610:2:23", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "gt", + "nativeSrc": "1602:2:23", + "nodeType": "YulIdentifier", + "src": "1602:2:23" + }, + "nativeSrc": "1602:11:23", + "nodeType": "YulFunctionCall", + "src": "1602:11:23" + }, + "nativeSrc": "1599:421:23", + "nodeType": "YulIf", + "src": "1599:421:23" + } + ] + }, + "name": "clean_up_bytearray_end_slots_string_storage", + "nativeSrc": "1508:518:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "array", + "nativeSrc": "1561:5:23", + "nodeType": "YulTypedName", + "src": "1561:5:23", + "type": "" + }, + { + "name": "len", + "nativeSrc": "1568:3:23", + "nodeType": "YulTypedName", + "src": "1568:3:23", + "type": "" + }, + { + "name": "startIndex", + "nativeSrc": "1573:10:23", + "nodeType": "YulTypedName", + "src": "1573:10:23", + "type": "" + } + ], + "src": "1508:518:23" + }, + { + "body": { + "nativeSrc": "2116:81:23", + "nodeType": "YulBlock", + "src": "2116:81:23", + "statements": [ + { + "nativeSrc": "2126:65:23", + "nodeType": "YulAssignment", + "src": "2126:65:23", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "data", + "nativeSrc": "2141:4:23", + "nodeType": "YulIdentifier", + "src": "2141:4:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2159:1:23", + "nodeType": "YulLiteral", + "src": "2159:1:23", + "type": "", + "value": "3" + }, + { + "name": "len", + "nativeSrc": "2162:3:23", + "nodeType": "YulIdentifier", + "src": "2162:3:23" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "2155:3:23", + "nodeType": "YulIdentifier", + "src": "2155:3:23" + }, + "nativeSrc": "2155:11:23", + "nodeType": "YulFunctionCall", + "src": "2155:11:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2172:1:23", + "nodeType": "YulLiteral", + "src": "2172:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "2168:3:23", + "nodeType": "YulIdentifier", + "src": "2168:3:23" + }, + "nativeSrc": "2168:6:23", + "nodeType": "YulFunctionCall", + "src": "2168:6:23" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "2151:3:23", + "nodeType": "YulIdentifier", + "src": "2151:3:23" + }, + "nativeSrc": "2151:24:23", + "nodeType": "YulFunctionCall", + "src": "2151:24:23" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "2147:3:23", + "nodeType": "YulIdentifier", + "src": "2147:3:23" + }, + "nativeSrc": "2147:29:23", + "nodeType": "YulFunctionCall", + "src": "2147:29:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "2137:3:23", + "nodeType": "YulIdentifier", + "src": "2137:3:23" + }, + "nativeSrc": "2137:40:23", + "nodeType": "YulFunctionCall", + "src": "2137:40:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2183:1:23", + "nodeType": "YulLiteral", + "src": "2183:1:23", + "type": "", + "value": "1" + }, + { + "name": "len", + "nativeSrc": "2186:3:23", + "nodeType": "YulIdentifier", + "src": "2186:3:23" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "2179:3:23", + "nodeType": "YulIdentifier", + "src": "2179:3:23" + }, + "nativeSrc": "2179:11:23", + "nodeType": "YulFunctionCall", + "src": "2179:11:23" + } + ], + "functionName": { + "name": "or", + "nativeSrc": "2134:2:23", + "nodeType": "YulIdentifier", + "src": "2134:2:23" + }, + "nativeSrc": "2134:57:23", + "nodeType": "YulFunctionCall", + "src": "2134:57:23" + }, + "variableNames": [ + { + "name": "used", + "nativeSrc": "2126:4:23", + "nodeType": "YulIdentifier", + "src": "2126:4:23" + } + ] + } + ] + }, + "name": "extract_used_part_and_set_length_of_short_byte_array", + "nativeSrc": "2031:166:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "data", + "nativeSrc": "2093:4:23", + "nodeType": "YulTypedName", + "src": "2093:4:23", + "type": "" + }, + { + "name": "len", + "nativeSrc": "2099:3:23", + "nodeType": "YulTypedName", + "src": "2099:3:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "used", + "nativeSrc": "2107:4:23", + "nodeType": "YulTypedName", + "src": "2107:4:23", + "type": "" + } + ], + "src": "2031:166:23" + }, + { + "body": { + "nativeSrc": "2298:1203:23", + "nodeType": "YulBlock", + "src": "2298:1203:23", + "statements": [ + { + "nativeSrc": "2308:24:23", + "nodeType": "YulVariableDeclaration", + "src": "2308:24:23", + "value": { + "arguments": [ + { + "name": "src", + "nativeSrc": "2328:3:23", + "nodeType": "YulIdentifier", + "src": "2328:3:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "2322:5:23", + "nodeType": "YulIdentifier", + "src": "2322:5:23" + }, + "nativeSrc": "2322:10:23", + "nodeType": "YulFunctionCall", + "src": "2322:10:23" + }, + "variables": [ + { + "name": "newLen", + "nativeSrc": "2312:6:23", + "nodeType": "YulTypedName", + "src": "2312:6:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "2375:22:23", + "nodeType": "YulBlock", + "src": "2375:22:23", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x41", + "nativeSrc": "2377:16:23", + "nodeType": "YulIdentifier", + "src": "2377:16:23" + }, + "nativeSrc": "2377:18:23", + "nodeType": "YulFunctionCall", + "src": "2377:18:23" + }, + "nativeSrc": "2377:18:23", + "nodeType": "YulExpressionStatement", + "src": "2377:18:23" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "newLen", + "nativeSrc": "2347:6:23", + "nodeType": "YulIdentifier", + "src": "2347:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2363:2:23", + "nodeType": "YulLiteral", + "src": "2363:2:23", + "type": "", + "value": "64" + }, + { + "kind": "number", + "nativeSrc": "2367:1:23", + "nodeType": "YulLiteral", + "src": "2367:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "2359:3:23", + "nodeType": "YulIdentifier", + "src": "2359:3:23" + }, + "nativeSrc": "2359:10:23", + "nodeType": "YulFunctionCall", + "src": "2359:10:23" + }, + { + "kind": "number", + "nativeSrc": "2371:1:23", + "nodeType": "YulLiteral", + "src": "2371:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "2355:3:23", + "nodeType": "YulIdentifier", + "src": "2355:3:23" + }, + "nativeSrc": "2355:18:23", + "nodeType": "YulFunctionCall", + "src": "2355:18:23" + } + ], + "functionName": { + "name": "gt", + "nativeSrc": "2344:2:23", + "nodeType": "YulIdentifier", + "src": "2344:2:23" + }, + "nativeSrc": "2344:30:23", + "nodeType": "YulFunctionCall", + "src": "2344:30:23" + }, + "nativeSrc": "2341:56:23", + "nodeType": "YulIf", + "src": "2341:56:23" + }, + { + "expression": { + "arguments": [ + { + "name": "slot", + "nativeSrc": "2450:4:23", + "nodeType": "YulIdentifier", + "src": "2450:4:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "slot", + "nativeSrc": "2488:4:23", + "nodeType": "YulIdentifier", + "src": "2488:4:23" + } + ], + "functionName": { + "name": "sload", + "nativeSrc": "2482:5:23", + "nodeType": "YulIdentifier", + "src": "2482:5:23" + }, + "nativeSrc": "2482:11:23", + "nodeType": "YulFunctionCall", + "src": "2482:11:23" + } + ], + "functionName": { + "name": "extract_byte_array_length", + "nativeSrc": "2456:25:23", + "nodeType": "YulIdentifier", + "src": "2456:25:23" + }, + "nativeSrc": "2456:38:23", + "nodeType": "YulFunctionCall", + "src": "2456:38:23" + }, + { + "name": "newLen", + "nativeSrc": "2496:6:23", + "nodeType": "YulIdentifier", + "src": "2496:6:23" + } + ], + "functionName": { + "name": "clean_up_bytearray_end_slots_string_storage", + "nativeSrc": "2406:43:23", + "nodeType": "YulIdentifier", + "src": "2406:43:23" + }, + "nativeSrc": "2406:97:23", + "nodeType": "YulFunctionCall", + "src": "2406:97:23" + }, + "nativeSrc": "2406:97:23", + "nodeType": "YulExpressionStatement", + "src": "2406:97:23" + }, + { + "nativeSrc": "2512:18:23", + "nodeType": "YulVariableDeclaration", + "src": "2512:18:23", + "value": { + "kind": "number", + "nativeSrc": "2529:1:23", + "nodeType": "YulLiteral", + "src": "2529:1:23", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "srcOffset", + "nativeSrc": "2516:9:23", + "nodeType": "YulTypedName", + "src": "2516:9:23", + "type": "" + } + ] + }, + { + "nativeSrc": "2539:17:23", + "nodeType": "YulAssignment", + "src": "2539:17:23", + "value": { + "kind": "number", + "nativeSrc": "2552:4:23", + "nodeType": "YulLiteral", + "src": "2552:4:23", + "type": "", + "value": "0x20" + }, + "variableNames": [ + { + "name": "srcOffset", + "nativeSrc": "2539:9:23", + "nodeType": "YulIdentifier", + "src": "2539:9:23" + } + ] + }, + { + "cases": [ + { + "body": { + "nativeSrc": "2602:642:23", + "nodeType": "YulBlock", + "src": "2602:642:23", + "statements": [ + { + "nativeSrc": "2616:35:23", + "nodeType": "YulVariableDeclaration", + "src": "2616:35:23", + "value": { + "arguments": [ + { + "name": "newLen", + "nativeSrc": "2635:6:23", + "nodeType": "YulIdentifier", + "src": "2635:6:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2647:2:23", + "nodeType": "YulLiteral", + "src": "2647:2:23", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "2643:3:23", + "nodeType": "YulIdentifier", + "src": "2643:3:23" + }, + "nativeSrc": "2643:7:23", + "nodeType": "YulFunctionCall", + "src": "2643:7:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "2631:3:23", + "nodeType": "YulIdentifier", + "src": "2631:3:23" + }, + "nativeSrc": "2631:20:23", + "nodeType": "YulFunctionCall", + "src": "2631:20:23" + }, + "variables": [ + { + "name": "loopEnd", + "nativeSrc": "2620:7:23", + "nodeType": "YulTypedName", + "src": "2620:7:23", + "type": "" + } + ] + }, + { + "nativeSrc": "2664:49:23", + "nodeType": "YulVariableDeclaration", + "src": "2664:49:23", + "value": { + "arguments": [ + { + "name": "slot", + "nativeSrc": "2708:4:23", + "nodeType": "YulIdentifier", + "src": "2708:4:23" + } + ], + "functionName": { + "name": "array_dataslot_string_storage", + "nativeSrc": "2678:29:23", + "nodeType": "YulIdentifier", + "src": "2678:29:23" + }, + "nativeSrc": "2678:35:23", + "nodeType": "YulFunctionCall", + "src": "2678:35:23" + }, + "variables": [ + { + "name": "dstPtr", + "nativeSrc": "2668:6:23", + "nodeType": "YulTypedName", + "src": "2668:6:23", + "type": "" + } + ] + }, + { + "nativeSrc": "2726:10:23", + "nodeType": "YulVariableDeclaration", + "src": "2726:10:23", + "value": { + "kind": "number", + "nativeSrc": "2735:1:23", + "nodeType": "YulLiteral", + "src": "2735:1:23", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "i", + "nativeSrc": "2730:1:23", + "nodeType": "YulTypedName", + "src": "2730:1:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "2806:165:23", + "nodeType": "YulBlock", + "src": "2806:165:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "dstPtr", + "nativeSrc": "2831:6:23", + "nodeType": "YulIdentifier", + "src": "2831:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "src", + "nativeSrc": "2849:3:23", + "nodeType": "YulIdentifier", + "src": "2849:3:23" + }, + { + "name": "srcOffset", + "nativeSrc": "2854:9:23", + "nodeType": "YulIdentifier", + "src": "2854:9:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2845:3:23", + "nodeType": "YulIdentifier", + "src": "2845:3:23" + }, + "nativeSrc": "2845:19:23", + "nodeType": "YulFunctionCall", + "src": "2845:19:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "2839:5:23", + "nodeType": "YulIdentifier", + "src": "2839:5:23" + }, + "nativeSrc": "2839:26:23", + "nodeType": "YulFunctionCall", + "src": "2839:26:23" + } + ], + "functionName": { + "name": "sstore", + "nativeSrc": "2824:6:23", + "nodeType": "YulIdentifier", + "src": "2824:6:23" + }, + "nativeSrc": "2824:42:23", + "nodeType": "YulFunctionCall", + "src": "2824:42:23" + }, + "nativeSrc": "2824:42:23", + "nodeType": "YulExpressionStatement", + "src": "2824:42:23" + }, + { + "nativeSrc": "2883:24:23", + "nodeType": "YulAssignment", + "src": "2883:24:23", + "value": { + "arguments": [ + { + "name": "dstPtr", + "nativeSrc": "2897:6:23", + "nodeType": "YulIdentifier", + "src": "2897:6:23" + }, + { + "kind": "number", + "nativeSrc": "2905:1:23", + "nodeType": "YulLiteral", + "src": "2905:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2893:3:23", + "nodeType": "YulIdentifier", + "src": "2893:3:23" + }, + "nativeSrc": "2893:14:23", + "nodeType": "YulFunctionCall", + "src": "2893:14:23" + }, + "variableNames": [ + { + "name": "dstPtr", + "nativeSrc": "2883:6:23", + "nodeType": "YulIdentifier", + "src": "2883:6:23" + } + ] + }, + { + "nativeSrc": "2924:33:23", + "nodeType": "YulAssignment", + "src": "2924:33:23", + "value": { + "arguments": [ + { + "name": "srcOffset", + "nativeSrc": "2941:9:23", + "nodeType": "YulIdentifier", + "src": "2941:9:23" + }, + { + "kind": "number", + "nativeSrc": "2952:4:23", + "nodeType": "YulLiteral", + "src": "2952:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2937:3:23", + "nodeType": "YulIdentifier", + "src": "2937:3:23" + }, + "nativeSrc": "2937:20:23", + "nodeType": "YulFunctionCall", + "src": "2937:20:23" + }, + "variableNames": [ + { + "name": "srcOffset", + "nativeSrc": "2924:9:23", + "nodeType": "YulIdentifier", + "src": "2924:9:23" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "i", + "nativeSrc": "2760:1:23", + "nodeType": "YulIdentifier", + "src": "2760:1:23" + }, + { + "name": "loopEnd", + "nativeSrc": "2763:7:23", + "nodeType": "YulIdentifier", + "src": "2763:7:23" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "2757:2:23", + "nodeType": "YulIdentifier", + "src": "2757:2:23" + }, + "nativeSrc": "2757:14:23", + "nodeType": "YulFunctionCall", + "src": "2757:14:23" + }, + "nativeSrc": "2749:222:23", + "nodeType": "YulForLoop", + "post": { + "nativeSrc": "2772:21:23", + "nodeType": "YulBlock", + "src": "2772:21:23", + "statements": [ + { + "nativeSrc": "2774:17:23", + "nodeType": "YulAssignment", + "src": "2774:17:23", + "value": { + "arguments": [ + { + "name": "i", + "nativeSrc": "2783:1:23", + "nodeType": "YulIdentifier", + "src": "2783:1:23" + }, + { + "kind": "number", + "nativeSrc": "2786:4:23", + "nodeType": "YulLiteral", + "src": "2786:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2779:3:23", + "nodeType": "YulIdentifier", + "src": "2779:3:23" + }, + "nativeSrc": "2779:12:23", + "nodeType": "YulFunctionCall", + "src": "2779:12:23" + }, + "variableNames": [ + { + "name": "i", + "nativeSrc": "2774:1:23", + "nodeType": "YulIdentifier", + "src": "2774:1:23" + } + ] + } + ] + }, + "pre": { + "nativeSrc": "2753:3:23", + "nodeType": "YulBlock", + "src": "2753:3:23", + "statements": [] + }, + "src": "2749:222:23" + }, + { + "body": { + "nativeSrc": "3019:166:23", + "nodeType": "YulBlock", + "src": "3019:166:23", + "statements": [ + { + "nativeSrc": "3037:43:23", + "nodeType": "YulVariableDeclaration", + "src": "3037:43:23", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "src", + "nativeSrc": "3064:3:23", + "nodeType": "YulIdentifier", + "src": "3064:3:23" + }, + { + "name": "srcOffset", + "nativeSrc": "3069:9:23", + "nodeType": "YulIdentifier", + "src": "3069:9:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3060:3:23", + "nodeType": "YulIdentifier", + "src": "3060:3:23" + }, + "nativeSrc": "3060:19:23", + "nodeType": "YulFunctionCall", + "src": "3060:19:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "3054:5:23", + "nodeType": "YulIdentifier", + "src": "3054:5:23" + }, + "nativeSrc": "3054:26:23", + "nodeType": "YulFunctionCall", + "src": "3054:26:23" + }, + "variables": [ + { + "name": "lastValue", + "nativeSrc": "3041:9:23", + "nodeType": "YulTypedName", + "src": "3041:9:23", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "dstPtr", + "nativeSrc": "3104:6:23", + "nodeType": "YulIdentifier", + "src": "3104:6:23" + }, + { + "arguments": [ + { + "name": "lastValue", + "nativeSrc": "3116:9:23", + "nodeType": "YulIdentifier", + "src": "3116:9:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3143:1:23", + "nodeType": "YulLiteral", + "src": "3143:1:23", + "type": "", + "value": "3" + }, + { + "name": "newLen", + "nativeSrc": "3146:6:23", + "nodeType": "YulIdentifier", + "src": "3146:6:23" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "3139:3:23", + "nodeType": "YulIdentifier", + "src": "3139:3:23" + }, + "nativeSrc": "3139:14:23", + "nodeType": "YulFunctionCall", + "src": "3139:14:23" + }, + { + "kind": "number", + "nativeSrc": "3155:3:23", + "nodeType": "YulLiteral", + "src": "3155:3:23", + "type": "", + "value": "248" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "3135:3:23", + "nodeType": "YulIdentifier", + "src": "3135:3:23" + }, + "nativeSrc": "3135:24:23", + "nodeType": "YulFunctionCall", + "src": "3135:24:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3165:1:23", + "nodeType": "YulLiteral", + "src": "3165:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "3161:3:23", + "nodeType": "YulIdentifier", + "src": "3161:3:23" + }, + "nativeSrc": "3161:6:23", + "nodeType": "YulFunctionCall", + "src": "3161:6:23" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "3131:3:23", + "nodeType": "YulIdentifier", + "src": "3131:3:23" + }, + "nativeSrc": "3131:37:23", + "nodeType": "YulFunctionCall", + "src": "3131:37:23" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "3127:3:23", + "nodeType": "YulIdentifier", + "src": "3127:3:23" + }, + "nativeSrc": "3127:42:23", + "nodeType": "YulFunctionCall", + "src": "3127:42:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "3112:3:23", + "nodeType": "YulIdentifier", + "src": "3112:3:23" + }, + "nativeSrc": "3112:58:23", + "nodeType": "YulFunctionCall", + "src": "3112:58:23" + } + ], + "functionName": { + "name": "sstore", + "nativeSrc": "3097:6:23", + "nodeType": "YulIdentifier", + "src": "3097:6:23" + }, + "nativeSrc": "3097:74:23", + "nodeType": "YulFunctionCall", + "src": "3097:74:23" + }, + "nativeSrc": "3097:74:23", + "nodeType": "YulExpressionStatement", + "src": "3097:74:23" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "loopEnd", + "nativeSrc": "2990:7:23", + "nodeType": "YulIdentifier", + "src": "2990:7:23" + }, + { + "name": "newLen", + "nativeSrc": "2999:6:23", + "nodeType": "YulIdentifier", + "src": "2999:6:23" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "2987:2:23", + "nodeType": "YulIdentifier", + "src": "2987:2:23" + }, + "nativeSrc": "2987:19:23", + "nodeType": "YulFunctionCall", + "src": "2987:19:23" + }, + "nativeSrc": "2984:201:23", + "nodeType": "YulIf", + "src": "2984:201:23" + }, + { + "expression": { + "arguments": [ + { + "name": "slot", + "nativeSrc": "3205:4:23", + "nodeType": "YulIdentifier", + "src": "3205:4:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3219:1:23", + "nodeType": "YulLiteral", + "src": "3219:1:23", + "type": "", + "value": "1" + }, + { + "name": "newLen", + "nativeSrc": "3222:6:23", + "nodeType": "YulIdentifier", + "src": "3222:6:23" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "3215:3:23", + "nodeType": "YulIdentifier", + "src": "3215:3:23" + }, + "nativeSrc": "3215:14:23", + "nodeType": "YulFunctionCall", + "src": "3215:14:23" + }, + { + "kind": "number", + "nativeSrc": "3231:1:23", + "nodeType": "YulLiteral", + "src": "3231:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3211:3:23", + "nodeType": "YulIdentifier", + "src": "3211:3:23" + }, + "nativeSrc": "3211:22:23", + "nodeType": "YulFunctionCall", + "src": "3211:22:23" + } + ], + "functionName": { + "name": "sstore", + "nativeSrc": "3198:6:23", + "nodeType": "YulIdentifier", + "src": "3198:6:23" + }, + "nativeSrc": "3198:36:23", + "nodeType": "YulFunctionCall", + "src": "3198:36:23" + }, + "nativeSrc": "3198:36:23", + "nodeType": "YulExpressionStatement", + "src": "3198:36:23" + } + ] + }, + "nativeSrc": "2595:649:23", + "nodeType": "YulCase", + "src": "2595:649:23", + "value": { + "kind": "number", + "nativeSrc": "2600:1:23", + "nodeType": "YulLiteral", + "src": "2600:1:23", + "type": "", + "value": "1" + } + }, + { + "body": { + "nativeSrc": "3261:234:23", + "nodeType": "YulBlock", + "src": "3261:234:23", + "statements": [ + { + "nativeSrc": "3275:14:23", + "nodeType": "YulVariableDeclaration", + "src": "3275:14:23", + "value": { + "kind": "number", + "nativeSrc": "3288:1:23", + "nodeType": "YulLiteral", + "src": "3288:1:23", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "value", + "nativeSrc": "3279:5:23", + "nodeType": "YulTypedName", + "src": "3279:5:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "3324:67:23", + "nodeType": "YulBlock", + "src": "3324:67:23", + "statements": [ + { + "nativeSrc": "3342:35:23", + "nodeType": "YulAssignment", + "src": "3342:35:23", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "src", + "nativeSrc": "3361:3:23", + "nodeType": "YulIdentifier", + "src": "3361:3:23" + }, + { + "name": "srcOffset", + "nativeSrc": "3366:9:23", + "nodeType": "YulIdentifier", + "src": "3366:9:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3357:3:23", + "nodeType": "YulIdentifier", + "src": "3357:3:23" + }, + "nativeSrc": "3357:19:23", + "nodeType": "YulFunctionCall", + "src": "3357:19:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "3351:5:23", + "nodeType": "YulIdentifier", + "src": "3351:5:23" + }, + "nativeSrc": "3351:26:23", + "nodeType": "YulFunctionCall", + "src": "3351:26:23" + }, + "variableNames": [ + { + "name": "value", + "nativeSrc": "3342:5:23", + "nodeType": "YulIdentifier", + "src": "3342:5:23" + } + ] + } + ] + }, + "condition": { + "name": "newLen", + "nativeSrc": "3305:6:23", + "nodeType": "YulIdentifier", + "src": "3305:6:23" + }, + "nativeSrc": "3302:89:23", + "nodeType": "YulIf", + "src": "3302:89:23" + }, + { + "expression": { + "arguments": [ + { + "name": "slot", + "nativeSrc": "3411:4:23", + "nodeType": "YulIdentifier", + "src": "3411:4:23" + }, + { + "arguments": [ + { + "name": "value", + "nativeSrc": "3470:5:23", + "nodeType": "YulIdentifier", + "src": "3470:5:23" + }, + { + "name": "newLen", + "nativeSrc": "3477:6:23", + "nodeType": "YulIdentifier", + "src": "3477:6:23" + } + ], + "functionName": { + "name": "extract_used_part_and_set_length_of_short_byte_array", + "nativeSrc": "3417:52:23", + "nodeType": "YulIdentifier", + "src": "3417:52:23" + }, + "nativeSrc": "3417:67:23", + "nodeType": "YulFunctionCall", + "src": "3417:67:23" + } + ], + "functionName": { + "name": "sstore", + "nativeSrc": "3404:6:23", + "nodeType": "YulIdentifier", + "src": "3404:6:23" + }, + "nativeSrc": "3404:81:23", + "nodeType": "YulFunctionCall", + "src": "3404:81:23" + }, + "nativeSrc": "3404:81:23", + "nodeType": "YulExpressionStatement", + "src": "3404:81:23" + } + ] + }, + "nativeSrc": "3253:242:23", + "nodeType": "YulCase", + "src": "3253:242:23", + "value": "default" + } + ], + "expression": { + "arguments": [ + { + "name": "newLen", + "nativeSrc": "2575:6:23", + "nodeType": "YulIdentifier", + "src": "2575:6:23" + }, + { + "kind": "number", + "nativeSrc": "2583:2:23", + "nodeType": "YulLiteral", + "src": "2583:2:23", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "gt", + "nativeSrc": "2572:2:23", + "nodeType": "YulIdentifier", + "src": "2572:2:23" + }, + "nativeSrc": "2572:14:23", + "nodeType": "YulFunctionCall", + "src": "2572:14:23" + }, + "nativeSrc": "2565:930:23", + "nodeType": "YulSwitch", + "src": "2565:930:23" + } + ] + }, + "name": "copy_byte_array_to_storage_from_t_string_memory_ptr_to_t_string_storage", + "nativeSrc": "2202:1299:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "slot", + "nativeSrc": "2283:4:23", + "nodeType": "YulTypedName", + "src": "2283:4:23", + "type": "" + }, + { + "name": "src", + "nativeSrc": "2289:3:23", + "nodeType": "YulTypedName", + "src": "2289:3:23", + "type": "" + } + ], + "src": "2202:1299:23" + }, + { + "body": { + "nativeSrc": "3719:276:23", + "nodeType": "YulBlock", + "src": "3719:276:23", + "statements": [ + { + "nativeSrc": "3729:27:23", + "nodeType": "YulAssignment", + "src": "3729:27:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3741:9:23", + "nodeType": "YulIdentifier", + "src": "3741:9:23" + }, + { + "kind": "number", + "nativeSrc": "3752:3:23", + "nodeType": "YulLiteral", + "src": "3752:3:23", + "type": "", + "value": "160" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3737:3:23", + "nodeType": "YulIdentifier", + "src": "3737:3:23" + }, + "nativeSrc": "3737:19:23", + "nodeType": "YulFunctionCall", + "src": "3737:19:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "3729:4:23", + "nodeType": "YulIdentifier", + "src": "3729:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3772:9:23", + "nodeType": "YulIdentifier", + "src": "3772:9:23" + }, + { + "name": "value0", + "nativeSrc": "3783:6:23", + "nodeType": "YulIdentifier", + "src": "3783:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3765:6:23", + "nodeType": "YulIdentifier", + "src": "3765:6:23" + }, + "nativeSrc": "3765:25:23", + "nodeType": "YulFunctionCall", + "src": "3765:25:23" + }, + "nativeSrc": "3765:25:23", + "nodeType": "YulExpressionStatement", + "src": "3765:25:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3810:9:23", + "nodeType": "YulIdentifier", + "src": "3810:9:23" + }, + { + "kind": "number", + "nativeSrc": "3821:2:23", + "nodeType": "YulLiteral", + "src": "3821:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3806:3:23", + "nodeType": "YulIdentifier", + "src": "3806:3:23" + }, + "nativeSrc": "3806:18:23", + "nodeType": "YulFunctionCall", + "src": "3806:18:23" + }, + { + "name": "value1", + "nativeSrc": "3826:6:23", + "nodeType": "YulIdentifier", + "src": "3826:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3799:6:23", + "nodeType": "YulIdentifier", + "src": "3799:6:23" + }, + "nativeSrc": "3799:34:23", + "nodeType": "YulFunctionCall", + "src": "3799:34:23" + }, + "nativeSrc": "3799:34:23", + "nodeType": "YulExpressionStatement", + "src": "3799:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3853:9:23", + "nodeType": "YulIdentifier", + "src": "3853:9:23" + }, + { + "kind": "number", + "nativeSrc": "3864:2:23", + "nodeType": "YulLiteral", + "src": "3864:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3849:3:23", + "nodeType": "YulIdentifier", + "src": "3849:3:23" + }, + "nativeSrc": "3849:18:23", + "nodeType": "YulFunctionCall", + "src": "3849:18:23" + }, + { + "name": "value2", + "nativeSrc": "3869:6:23", + "nodeType": "YulIdentifier", + "src": "3869:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3842:6:23", + "nodeType": "YulIdentifier", + "src": "3842:6:23" + }, + "nativeSrc": "3842:34:23", + "nodeType": "YulFunctionCall", + "src": "3842:34:23" + }, + "nativeSrc": "3842:34:23", + "nodeType": "YulExpressionStatement", + "src": "3842:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3896:9:23", + "nodeType": "YulIdentifier", + "src": "3896:9:23" + }, + { + "kind": "number", + "nativeSrc": "3907:2:23", + "nodeType": "YulLiteral", + "src": "3907:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3892:3:23", + "nodeType": "YulIdentifier", + "src": "3892:3:23" + }, + "nativeSrc": "3892:18:23", + "nodeType": "YulFunctionCall", + "src": "3892:18:23" + }, + { + "name": "value3", + "nativeSrc": "3912:6:23", + "nodeType": "YulIdentifier", + "src": "3912:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3885:6:23", + "nodeType": "YulIdentifier", + "src": "3885:6:23" + }, + "nativeSrc": "3885:34:23", + "nodeType": "YulFunctionCall", + "src": "3885:34:23" + }, + "nativeSrc": "3885:34:23", + "nodeType": "YulExpressionStatement", + "src": "3885:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3939:9:23", + "nodeType": "YulIdentifier", + "src": "3939:9:23" + }, + { + "kind": "number", + "nativeSrc": "3950:3:23", + "nodeType": "YulLiteral", + "src": "3950:3:23", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3935:3:23", + "nodeType": "YulIdentifier", + "src": "3935:3:23" + }, + "nativeSrc": "3935:19:23", + "nodeType": "YulFunctionCall", + "src": "3935:19:23" + }, + { + "arguments": [ + { + "name": "value4", + "nativeSrc": "3960:6:23", + "nodeType": "YulIdentifier", + "src": "3960:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3976:3:23", + "nodeType": "YulLiteral", + "src": "3976:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "3981:1:23", + "nodeType": "YulLiteral", + "src": "3981:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "3972:3:23", + "nodeType": "YulIdentifier", + "src": "3972:3:23" + }, + "nativeSrc": "3972:11:23", + "nodeType": "YulFunctionCall", + "src": "3972:11:23" + }, + { + "kind": "number", + "nativeSrc": "3985:1:23", + "nodeType": "YulLiteral", + "src": "3985:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "3968:3:23", + "nodeType": "YulIdentifier", + "src": "3968:3:23" + }, + "nativeSrc": "3968:19:23", + "nodeType": "YulFunctionCall", + "src": "3968:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "3956:3:23", + "nodeType": "YulIdentifier", + "src": "3956:3:23" + }, + "nativeSrc": "3956:32:23", + "nodeType": "YulFunctionCall", + "src": "3956:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3928:6:23", + "nodeType": "YulIdentifier", + "src": "3928:6:23" + }, + "nativeSrc": "3928:61:23", + "nodeType": "YulFunctionCall", + "src": "3928:61:23" + }, + "nativeSrc": "3928:61:23", + "nodeType": "YulExpressionStatement", + "src": "3928:61:23" + } + ] + }, + "name": "abi_encode_tuple_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__to_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__fromStack_reversed", + "nativeSrc": "3506:489:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "3656:9:23", + "nodeType": "YulTypedName", + "src": "3656:9:23", + "type": "" + }, + { + "name": "value4", + "nativeSrc": "3667:6:23", + "nodeType": "YulTypedName", + "src": "3667:6:23", + "type": "" + }, + { + "name": "value3", + "nativeSrc": "3675:6:23", + "nodeType": "YulTypedName", + "src": "3675:6:23", + "type": "" + }, + { + "name": "value2", + "nativeSrc": "3683:6:23", + "nodeType": "YulTypedName", + "src": "3683:6:23", + "type": "" + }, + { + "name": "value1", + "nativeSrc": "3691:6:23", + "nodeType": "YulTypedName", + "src": "3691:6:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "3699:6:23", + "nodeType": "YulTypedName", + "src": "3699:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "3710:4:23", + "nodeType": "YulTypedName", + "src": "3710:4:23", + "type": "" + } + ], + "src": "3506:489:23" + }, + { + "body": { + "nativeSrc": "4121:297:23", + "nodeType": "YulBlock", + "src": "4121:297:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4138:9:23", + "nodeType": "YulIdentifier", + "src": "4138:9:23" + }, + { + "kind": "number", + "nativeSrc": "4149:2:23", + "nodeType": "YulLiteral", + "src": "4149:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4131:6:23", + "nodeType": "YulIdentifier", + "src": "4131:6:23" + }, + "nativeSrc": "4131:21:23", + "nodeType": "YulFunctionCall", + "src": "4131:21:23" + }, + "nativeSrc": "4131:21:23", + "nodeType": "YulExpressionStatement", + "src": "4131:21:23" + }, + { + "nativeSrc": "4161:27:23", + "nodeType": "YulVariableDeclaration", + "src": "4161:27:23", + "value": { + "arguments": [ + { + "name": "value0", + "nativeSrc": "4181:6:23", + "nodeType": "YulIdentifier", + "src": "4181:6:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "4175:5:23", + "nodeType": "YulIdentifier", + "src": "4175:5:23" + }, + "nativeSrc": "4175:13:23", + "nodeType": "YulFunctionCall", + "src": "4175:13:23" + }, + "variables": [ + { + "name": "length", + "nativeSrc": "4165:6:23", + "nodeType": "YulTypedName", + "src": "4165:6:23", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4208:9:23", + "nodeType": "YulIdentifier", + "src": "4208:9:23" + }, + { + "kind": "number", + "nativeSrc": "4219:2:23", + "nodeType": "YulLiteral", + "src": "4219:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4204:3:23", + "nodeType": "YulIdentifier", + "src": "4204:3:23" + }, + "nativeSrc": "4204:18:23", + "nodeType": "YulFunctionCall", + "src": "4204:18:23" + }, + { + "name": "length", + "nativeSrc": "4224:6:23", + "nodeType": "YulIdentifier", + "src": "4224:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4197:6:23", + "nodeType": "YulIdentifier", + "src": "4197:6:23" + }, + "nativeSrc": "4197:34:23", + "nodeType": "YulFunctionCall", + "src": "4197:34:23" + }, + "nativeSrc": "4197:34:23", + "nodeType": "YulExpressionStatement", + "src": "4197:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4250:9:23", + "nodeType": "YulIdentifier", + "src": "4250:9:23" + }, + { + "kind": "number", + "nativeSrc": "4261:2:23", + "nodeType": "YulLiteral", + "src": "4261:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4246:3:23", + "nodeType": "YulIdentifier", + "src": "4246:3:23" + }, + "nativeSrc": "4246:18:23", + "nodeType": "YulFunctionCall", + "src": "4246:18:23" + }, + { + "arguments": [ + { + "name": "value0", + "nativeSrc": "4270:6:23", + "nodeType": "YulIdentifier", + "src": "4270:6:23" + }, + { + "kind": "number", + "nativeSrc": "4278:2:23", + "nodeType": "YulLiteral", + "src": "4278:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4266:3:23", + "nodeType": "YulIdentifier", + "src": "4266:3:23" + }, + "nativeSrc": "4266:15:23", + "nodeType": "YulFunctionCall", + "src": "4266:15:23" + }, + { + "name": "length", + "nativeSrc": "4283:6:23", + "nodeType": "YulIdentifier", + "src": "4283:6:23" + } + ], + "functionName": { + "name": "mcopy", + "nativeSrc": "4240:5:23", + "nodeType": "YulIdentifier", + "src": "4240:5:23" + }, + "nativeSrc": "4240:50:23", + "nodeType": "YulFunctionCall", + "src": "4240:50:23" + }, + "nativeSrc": "4240:50:23", + "nodeType": "YulExpressionStatement", + "src": "4240:50:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4314:9:23", + "nodeType": "YulIdentifier", + "src": "4314:9:23" + }, + { + "name": "length", + "nativeSrc": "4325:6:23", + "nodeType": "YulIdentifier", + "src": "4325:6:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4310:3:23", + "nodeType": "YulIdentifier", + "src": "4310:3:23" + }, + "nativeSrc": "4310:22:23", + "nodeType": "YulFunctionCall", + "src": "4310:22:23" + }, + { + "kind": "number", + "nativeSrc": "4334:2:23", + "nodeType": "YulLiteral", + "src": "4334:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4306:3:23", + "nodeType": "YulIdentifier", + "src": "4306:3:23" + }, + "nativeSrc": "4306:31:23", + "nodeType": "YulFunctionCall", + "src": "4306:31:23" + }, + { + "kind": "number", + "nativeSrc": "4339:1:23", + "nodeType": "YulLiteral", + "src": "4339:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4299:6:23", + "nodeType": "YulIdentifier", + "src": "4299:6:23" + }, + "nativeSrc": "4299:42:23", + "nodeType": "YulFunctionCall", + "src": "4299:42:23" + }, + "nativeSrc": "4299:42:23", + "nodeType": "YulExpressionStatement", + "src": "4299:42:23" + }, + { + "nativeSrc": "4350:62:23", + "nodeType": "YulAssignment", + "src": "4350:62:23", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4366:9:23", + "nodeType": "YulIdentifier", + "src": "4366:9:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "length", + "nativeSrc": "4385:6:23", + "nodeType": "YulIdentifier", + "src": "4385:6:23" + }, + { + "kind": "number", + "nativeSrc": "4393:2:23", + "nodeType": "YulLiteral", + "src": "4393:2:23", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4381:3:23", + "nodeType": "YulIdentifier", + "src": "4381:3:23" + }, + "nativeSrc": "4381:15:23", + "nodeType": "YulFunctionCall", + "src": "4381:15:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "4402:2:23", + "nodeType": "YulLiteral", + "src": "4402:2:23", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "4398:3:23", + "nodeType": "YulIdentifier", + "src": "4398:3:23" + }, + "nativeSrc": "4398:7:23", + "nodeType": "YulFunctionCall", + "src": "4398:7:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "4377:3:23", + "nodeType": "YulIdentifier", + "src": "4377:3:23" + }, + "nativeSrc": "4377:29:23", + "nodeType": "YulFunctionCall", + "src": "4377:29:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4362:3:23", + "nodeType": "YulIdentifier", + "src": "4362:3:23" + }, + "nativeSrc": "4362:45:23", + "nodeType": "YulFunctionCall", + "src": "4362:45:23" + }, + { + "kind": "number", + "nativeSrc": "4409:2:23", + "nodeType": "YulLiteral", + "src": "4409:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4358:3:23", + "nodeType": "YulIdentifier", + "src": "4358:3:23" + }, + "nativeSrc": "4358:54:23", + "nodeType": "YulFunctionCall", + "src": "4358:54:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "4350:4:23", + "nodeType": "YulIdentifier", + "src": "4350:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "4000:418:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "4090:9:23", + "nodeType": "YulTypedName", + "src": "4090:9:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "4101:6:23", + "nodeType": "YulTypedName", + "src": "4101:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "4112:4:23", + "nodeType": "YulTypedName", + "src": "4112:4:23", + "type": "" + } + ], + "src": "4000:418:23" + }, + { + "body": { + "nativeSrc": "4517:203:23", + "nodeType": "YulBlock", + "src": "4517:203:23", + "statements": [ + { + "nativeSrc": "4527:26:23", + "nodeType": "YulVariableDeclaration", + "src": "4527:26:23", + "value": { + "arguments": [ + { + "name": "array", + "nativeSrc": "4547:5:23", + "nodeType": "YulIdentifier", + "src": "4547:5:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "4541:5:23", + "nodeType": "YulIdentifier", + "src": "4541:5:23" + }, + "nativeSrc": "4541:12:23", + "nodeType": "YulFunctionCall", + "src": "4541:12:23" + }, + "variables": [ + { + "name": "length", + "nativeSrc": "4531:6:23", + "nodeType": "YulTypedName", + "src": "4531:6:23", + "type": "" + } + ] + }, + { + "nativeSrc": "4562:32:23", + "nodeType": "YulAssignment", + "src": "4562:32:23", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "array", + "nativeSrc": "4581:5:23", + "nodeType": "YulIdentifier", + "src": "4581:5:23" + }, + { + "kind": "number", + "nativeSrc": "4588:4:23", + "nodeType": "YulLiteral", + "src": "4588:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4577:3:23", + "nodeType": "YulIdentifier", + "src": "4577:3:23" + }, + "nativeSrc": "4577:16:23", + "nodeType": "YulFunctionCall", + "src": "4577:16:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "4571:5:23", + "nodeType": "YulIdentifier", + "src": "4571:5:23" + }, + "nativeSrc": "4571:23:23", + "nodeType": "YulFunctionCall", + "src": "4571:23:23" + }, + "variableNames": [ + { + "name": "value", + "nativeSrc": "4562:5:23", + "nodeType": "YulIdentifier", + "src": "4562:5:23" + } + ] + }, + { + "body": { + "nativeSrc": "4631:83:23", + "nodeType": "YulBlock", + "src": "4631:83:23", + "statements": [ + { + "nativeSrc": "4645:59:23", + "nodeType": "YulAssignment", + "src": "4645:59:23", + "value": { + "arguments": [ + { + "name": "value", + "nativeSrc": "4658:5:23", + "nodeType": "YulIdentifier", + "src": "4658:5:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "4673:1:23", + "nodeType": "YulLiteral", + "src": "4673:1:23", + "type": "", + "value": "3" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "4680:4:23", + "nodeType": "YulLiteral", + "src": "4680:4:23", + "type": "", + "value": "0x20" + }, + { + "name": "length", + "nativeSrc": "4686:6:23", + "nodeType": "YulIdentifier", + "src": "4686:6:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "4676:3:23", + "nodeType": "YulIdentifier", + "src": "4676:3:23" + }, + "nativeSrc": "4676:17:23", + "nodeType": "YulFunctionCall", + "src": "4676:17:23" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "4669:3:23", + "nodeType": "YulIdentifier", + "src": "4669:3:23" + }, + "nativeSrc": "4669:25:23", + "nodeType": "YulFunctionCall", + "src": "4669:25:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "4700:1:23", + "nodeType": "YulLiteral", + "src": "4700:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "4696:3:23", + "nodeType": "YulIdentifier", + "src": "4696:3:23" + }, + "nativeSrc": "4696:6:23", + "nodeType": "YulFunctionCall", + "src": "4696:6:23" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "4665:3:23", + "nodeType": "YulIdentifier", + "src": "4665:3:23" + }, + "nativeSrc": "4665:38:23", + "nodeType": "YulFunctionCall", + "src": "4665:38:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "4654:3:23", + "nodeType": "YulIdentifier", + "src": "4654:3:23" + }, + "nativeSrc": "4654:50:23", + "nodeType": "YulFunctionCall", + "src": "4654:50:23" + }, + "variableNames": [ + { + "name": "value", + "nativeSrc": "4645:5:23", + "nodeType": "YulIdentifier", + "src": "4645:5:23" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "length", + "nativeSrc": "4609:6:23", + "nodeType": "YulIdentifier", + "src": "4609:6:23" + }, + { + "kind": "number", + "nativeSrc": "4617:4:23", + "nodeType": "YulLiteral", + "src": "4617:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "4606:2:23", + "nodeType": "YulIdentifier", + "src": "4606:2:23" + }, + "nativeSrc": "4606:16:23", + "nodeType": "YulFunctionCall", + "src": "4606:16:23" + }, + "nativeSrc": "4603:111:23", + "nodeType": "YulIf", + "src": "4603:111:23" + } + ] + }, + "name": "convert_bytes_to_fixedbytes_from_t_bytes_memory_ptr_to_t_bytes32", + "nativeSrc": "4423:297:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "array", + "nativeSrc": "4497:5:23", + "nodeType": "YulTypedName", + "src": "4497:5:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value", + "nativeSrc": "4507:5:23", + "nodeType": "YulTypedName", + "src": "4507:5:23", + "type": "" + } + ], + "src": "4423:297:23" + } + ] + }, + "contents": "{\n { }\n function abi_decode_tuple_t_address_fromMemory(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n let value := mload(headStart)\n if iszero(eq(value, and(value, sub(shl(160, 1), 1)))) { revert(0, 0) }\n value0 := value\n }\n function abi_encode_tuple_t_address__to_t_address__fromStack_reversed(headStart, value0) -> tail\n {\n tail := add(headStart, 32)\n mstore(headStart, and(value0, sub(shl(160, 1), 1)))\n }\n function abi_encode_tuple_t_stringliteral_480a3d2cf1e4838d740f40eac57f23eb6facc0baaf1a65a7b61df6a5a00ed368__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 19)\n mstore(add(headStart, 64), \"Invalid destination\")\n tail := add(headStart, 96)\n }\n function panic_error_0x41()\n {\n mstore(0, shl(224, 0x4e487b71))\n mstore(4, 0x41)\n revert(0, 0x24)\n }\n function extract_byte_array_length(data) -> length\n {\n length := shr(1, data)\n let outOfPlaceEncoding := and(data, 1)\n if iszero(outOfPlaceEncoding) { length := and(length, 0x7f) }\n if eq(outOfPlaceEncoding, lt(length, 32))\n {\n mstore(0, shl(224, 0x4e487b71))\n mstore(4, 0x22)\n revert(0, 0x24)\n }\n }\n function array_dataslot_string_storage(ptr) -> data\n {\n mstore(0, ptr)\n data := keccak256(0, 0x20)\n }\n function clean_up_bytearray_end_slots_string_storage(array, len, startIndex)\n {\n if gt(len, 31)\n {\n mstore(0, array)\n let data := keccak256(0, 0x20)\n let deleteStart := add(data, shr(5, add(startIndex, 31)))\n if lt(startIndex, 0x20) { deleteStart := data }\n let _1 := add(data, shr(5, add(len, 31)))\n let start := deleteStart\n for { } lt(start, _1) { start := add(start, 1) }\n { sstore(start, 0) }\n }\n }\n function extract_used_part_and_set_length_of_short_byte_array(data, len) -> used\n {\n used := or(and(data, not(shr(shl(3, len), not(0)))), shl(1, len))\n }\n function copy_byte_array_to_storage_from_t_string_memory_ptr_to_t_string_storage(slot, src)\n {\n let newLen := mload(src)\n if gt(newLen, sub(shl(64, 1), 1)) { panic_error_0x41() }\n clean_up_bytearray_end_slots_string_storage(slot, extract_byte_array_length(sload(slot)), newLen)\n let srcOffset := 0\n srcOffset := 0x20\n switch gt(newLen, 31)\n case 1 {\n let loopEnd := and(newLen, not(31))\n let dstPtr := array_dataslot_string_storage(slot)\n let i := 0\n for { } lt(i, loopEnd) { i := add(i, 0x20) }\n {\n sstore(dstPtr, mload(add(src, srcOffset)))\n dstPtr := add(dstPtr, 1)\n srcOffset := add(srcOffset, 0x20)\n }\n if lt(loopEnd, newLen)\n {\n let lastValue := mload(add(src, srcOffset))\n sstore(dstPtr, and(lastValue, not(shr(and(shl(3, newLen), 248), not(0)))))\n }\n sstore(slot, add(shl(1, newLen), 1))\n }\n default {\n let value := 0\n if newLen\n {\n value := mload(add(src, srcOffset))\n }\n sstore(slot, extract_used_part_and_set_length_of_short_byte_array(value, newLen))\n }\n }\n function abi_encode_tuple_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__to_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__fromStack_reversed(headStart, value4, value3, value2, value1, value0) -> tail\n {\n tail := add(headStart, 160)\n mstore(headStart, value0)\n mstore(add(headStart, 32), value1)\n mstore(add(headStart, 64), value2)\n mstore(add(headStart, 96), value3)\n mstore(add(headStart, 128), and(value4, sub(shl(160, 1), 1)))\n }\n function abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed(headStart, value0) -> tail\n {\n mstore(headStart, 32)\n let length := mload(value0)\n mstore(add(headStart, 32), length)\n mcopy(add(headStart, 64), add(value0, 32), length)\n mstore(add(add(headStart, length), 64), 0)\n tail := add(add(headStart, and(add(length, 31), not(31))), 64)\n }\n function convert_bytes_to_fixedbytes_from_t_bytes_memory_ptr_to_t_bytes32(array) -> value\n {\n let length := mload(array)\n value := mload(add(array, 0x20))\n if lt(length, 0x20)\n {\n value := and(value, shl(shl(3, sub(0x20, length)), not(0)))\n }\n }\n}", + "id": 23, + "language": "Yul", + "name": "#utility.yul" + } + ], + "linkReferences": {}, + "object": "610180604052348015610010575f5ffd5b50604051611a4d380380611a4d83398101604081905261002f91610294565b604080518082018252600c81526b2a37b5b2b72932b630bcb2b960a11b602080830191909152825180840190935260018352603160f81b9083015290338061009157604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b61009a816101d6565b5060017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00556100ca826001610225565b610120526100d9816002610225565b61014052815160208084019190912060e052815190820120610100524660a05261016560e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b60805250503060c0526001600160a01b0381166101c45760405162461bcd60e51b815260206004820152601360248201527f496e76616c69642064657374696e6174696f6e000000000000000000000000006044820152606401610088565b6001600160a01b03166101605261046b565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f6020835110156102405761023983610257565b9050610251565b8161024b8482610359565b5060ff90505b92915050565b5f5f829050601f81511115610281578260405163305a27a960e01b81526004016100889190610413565b805161028c82610448565b179392505050565b5f602082840312156102a4575f5ffd5b81516001600160a01b03811681146102ba575f5ffd5b9392505050565b634e487b7160e01b5f52604160045260245ffd5b600181811c908216806102e957607f821691505b60208210810361030757634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111561035457805f5260205f20601f840160051c810160208510156103325750805b601f840160051c820191505b81811015610351575f815560010161033e565b50505b505050565b81516001600160401b03811115610372576103726102c1565b6103868161038084546102d5565b8461030d565b6020601f8211600181146103b8575f83156103a15750848201515b5f19600385901b1c1916600184901b178455610351565b5f84815260208120601f198516915b828110156103e757878501518255602094850194600190920191016103c7565b508482101561040457868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b80516020808301519190811015610307575f1960209190910360031b1b16919050565b60805160a05160c05160e0516101005161012051610140516101605161156c6104e15f395f818160d701528181610525015281816105f4015281816109500152610bf801525f610d2d01525f610cfb01525f6111bc01525f61119401525f6110ef01525f61111901525f611143015261156c5ff3fe608060405260043610610092575f3560e01c80639e281a98116100575780639e281a9814610159578063d850124e14610178578063dcb79457146101c1578063f14210a6146101e0578063f2fde38b146101ff575f5ffd5b80632af83bfe1461009d578063715018a6146100b257806375bd6863146100c657806384b0196e146101165780638da5cb5b1461013d575f5ffd5b3661009957005b5f5ffd5b6100b06100ab3660046112dd565b61021e565b005b3480156100bd575f5ffd5b506100b06106ae565b3480156100d1575f5ffd5b506100f97f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b348015610121575f5ffd5b5061012a6106c1565b60405161010d979695949392919061134a565b348015610148575f5ffd5b505f546001600160a01b03166100f9565b348015610164575f5ffd5b506100b06101733660046113fb565b610703565b348015610183575f5ffd5b506101b16101923660046113fb565b600360209081525f928352604080842090915290825290205460ff1681565b604051901515815260200161010d565b3480156101cc575f5ffd5b506101b16101db3660046113fb565b61078b565b3480156101eb575f5ffd5b506100b06101fa366004611423565b6107b8565b34801561020a575f5ffd5b506100b061021936600461143a565b6108a7565b6102266108e1565b5f610237604083016020840161143a565b90506101208201356001600160a01b03821661028a5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21037bbb732b960991b60448201526064015b60405180910390fd5b5f610298602085018561143a565b6001600160a01b0316036102de5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2103a37b5b2b760991b6044820152606401610281565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff161561033e5760405162461bcd60e51b815260206004820152600a602482015269139bdb98d9481d5cd95960b21b6044820152606401610281565b8261014001354211156103855760405162461bcd60e51b815260206004820152600f60248201526e14185e5b1bd85908195e1c1a5c9959608a1b6044820152606401610281565b5f6103ee83610397602087018761143a565b60408701356103a960e0890189611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250505050610100890135876101408b013561090f565b90506001600160a01b038316610421826104106101808801610160890161149d565b876101800135886101a001356109db565b6001600160a01b0316146104655760405162461bcd60e51b815260206004820152600b60248201526a496e76616c69642073696760a81b6044820152606401610281565b83610100013534146104b95760405162461bcd60e51b815260206004820152601c60248201527f496e636f7272656374204554482076616c75652070726f7669646564000000006044820152606401610281565b6001600160a01b0383165f9081526003602090815260408083208584528252909120805460ff19166001179055610520906104f69086018661143a565b846040870135606088013561051160a08a0160808b0161149d565b8960a001358a60c00135610a07565b6105667f00000000000000000000000000000000000000000000000000000000000000006040860135610556602088018861143a565b6001600160a01b03169190610b75565b5f6105b261057760e0870187611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250349250610bf4915050565b9050806105ef5760405162461bcd60e51b815260206004820152600b60248201526a10d85b1b0819985a5b195960aa1b6044820152606401610281565b6106217f00000000000000000000000000000000000000000000000000000000000000005f610556602089018961143a565b61062e602086018661143a565b6001600160a01b0316846001600160a01b03167f78129a649632642d8e9f346c85d9efb70d32d50a36774c4585491a9228bbd350876040013560405161067691815260200190565b60405180910390a3505050506106ab60017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b50565b6106b6610c79565b6106bf5f610ca5565b565b5f6060805f5f5f60606106d2610cf4565b6106da610d26565b604080515f80825260208201909252600f60f81b9b939a50919850469750309650945092509050565b61070b610c79565b61073061071f5f546001600160a01b031690565b6001600160a01b0384169083610d53565b5f546001600160a01b03166001600160a01b0316826001600160a01b03167fa0524ee0fd8662d6c046d199da2a6d3dc49445182cec055873a5bb9c2843c8e08360405161077f91815260200190565b60405180910390a35050565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff165b92915050565b6107c0610c79565b5f80546040516001600160a01b039091169083908381818185875af1925050503d805f811461080a576040519150601f19603f3d011682016040523d82523d5f602084013e61080f565b606091505b50509050806108565760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610281565b5f546001600160a01b03166001600160a01b03167f6148672a948a12b8e0bf92a9338349b9ac890fad62a234abaf0a4da99f62cfcc8360405161089b91815260200190565b60405180910390a25050565b6108af610c79565b6001600160a01b0381166108d857604051631e4fbdf760e01b81525f6004820152602401610281565b6106ab81610ca5565b6108e9610d60565b60027f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b8351602080860191909120604080517ff0543e2024fd0ae16ccb842686c2733758ec65acfd69fb599c05b286f8db8844938101939093526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691840191909152808a1660608401528816608083015260a0820187905260c082015260e08101849052610100810183905261012081018290525f906109cf906101400160405160208183030381529060405280519060200120610da2565b98975050505050505050565b5f5f5f5f6109eb88888888610dce565b9250925092506109fb8282610e96565b50909695505050505050565b60405163d505accf60e01b81526001600160a01b038781166004830152306024830152604482018790526064820186905260ff8516608483015260a4820184905260c4820183905288169063d505accf9060e4015f604051808303815f87803b158015610a72575f5ffd5b505af1925050508015610a83575060015b610b5757604051636eb1769f60e11b81526001600160a01b03878116600483015230602483015286919089169063dd62ed3e90604401602060405180830381865afa158015610ad4573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610af891906114bd565b1015610b575760405162461bcd60e51b815260206004820152602860248201527f5065726d6974206661696c656420616e6420696e73756666696369656e7420616044820152676c6c6f77616e636560c01b6064820152608401610281565b610b6c6001600160a01b038816873088610f52565b50505050505050565b610b818383835f610f8e565b610bef57610b9283835f6001610f8e565b610bba57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b610bc78383836001610f8e565b610bef57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b505050565b5f5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168385604051610c2f91906114d4565b5f6040518083038185875af1925050503d805f8114610c69576040519150601f19603f3d011682016040523d82523d5f602084013e610c6e565b606091505b509095945050505050565b5f546001600160a01b031633146106bf5760405163118cdaa760e01b8152336004820152602401610281565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006001610ff0565b905090565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006002610ff0565b610bc78383836001611099565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00546002036106bf57604051633ee5aeb560e01b815260040160405180910390fd5b5f6107b2610dae6110e3565b8360405161190160f01b8152600281019290925260228201526042902090565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115610e0757505f91506003905082610e8c565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015610e58573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b038116610e8357505f925060019150829050610e8c565b92505f91508190505b9450945094915050565b5f826003811115610ea957610ea96114ea565b03610eb2575050565b6001826003811115610ec657610ec66114ea565b03610ee45760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115610ef857610ef86114ea565b03610f195760405163fce698f760e01b815260048101829052602401610281565b6003826003811115610f2d57610f2d6114ea565b03610f4e576040516335e2f38360e21b815260048101829052602401610281565b5050565b610f6084848484600161120c565b610f8857604051635274afe760e01b81526001600160a01b0385166004820152602401610281565b50505050565b60405163095ea7b360e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f873b113d1516831692505b60405250949350505050565b606060ff831461100a5761100383611279565b90506107b2565b818054611016906114fe565b80601f0160208091040260200160405190810160405280929190818152602001828054611042906114fe565b801561108d5780601f106110645761010080835404028352916020019161108d565b820191905f5260205f20905b81548152906001019060200180831161107057829003601f168201915b505050505090506107b2565b60405163a9059cbb60e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561113b57507f000000000000000000000000000000000000000000000000000000000000000046145b1561116557507f000000000000000000000000000000000000000000000000000000000000000090565b610d21604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b6040516323b872dd60e01b5f8181526001600160a01b038781166004528616602452604485905291602083606481808c5af1925060015f5114831661126857838315161561125c573d5f823e3d81fd5b5f883b113d1516831692505b604052505f60605295945050505050565b60605f611285836112b6565b6040805160208082528183019092529192505f91906020820181803683375050509182525060208101929092525090565b5f60ff8216601f8111156107b257604051632cd44ac360e21b815260040160405180910390fd5b5f602082840312156112ed575f5ffd5b813567ffffffffffffffff811115611303575f5ffd5b82016101c08185031215611315575f5ffd5b9392505050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b60ff60f81b8816815260e060208201525f61136860e083018961131c565b828103604084015261137a818961131c565b606084018890526001600160a01b038716608085015260a0840186905283810360c0850152845180825260208087019350909101905f5b818110156113cf5783518352602093840193909201916001016113b1565b50909b9a5050505050505050505050565b80356001600160a01b03811681146113f6575f5ffd5b919050565b5f5f6040838503121561140c575f5ffd5b611415836113e0565b946020939093013593505050565b5f60208284031215611433575f5ffd5b5035919050565b5f6020828403121561144a575f5ffd5b611315826113e0565b5f5f8335601e19843603018112611468575f5ffd5b83018035915067ffffffffffffffff821115611482575f5ffd5b602001915036819003821315611496575f5ffd5b9250929050565b5f602082840312156114ad575f5ffd5b813560ff81168114611315575f5ffd5b5f602082840312156114cd575f5ffd5b5051919050565b5f82518060208501845e5f920191825250919050565b634e487b7160e01b5f52602160045260245ffd5b600181811c9082168061151257607f821691505b60208210810361153057634e487b7160e01b5f52602260045260245ffd5b5091905056fea26469706673582212209c34db2f6f83af136a5340cce7fe8ef554ea8eb633656fbf9bff3bd731aec40f64736f6c634300081c0033", + "opcodes": "PUSH2 0x180 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH2 0x1A4D CODESIZE SUB DUP1 PUSH2 0x1A4D DUP4 CODECOPY DUP2 ADD PUSH1 0x40 DUP2 SWAP1 MSTORE PUSH2 0x2F SWAP2 PUSH2 0x294 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD DUP3 MSTORE PUSH1 0xC DUP2 MSTORE PUSH12 0x2A37B5B2B72932B630BCB2B9 PUSH1 0xA1 SHL PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP3 MLOAD DUP1 DUP5 ADD SWAP1 SWAP4 MSTORE PUSH1 0x1 DUP4 MSTORE PUSH1 0x31 PUSH1 0xF8 SHL SWAP1 DUP4 ADD MSTORE SWAP1 CALLER DUP1 PUSH2 0x91 JUMPI PUSH1 0x40 MLOAD PUSH4 0x1E4FBDF7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH0 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0x9A DUP2 PUSH2 0x1D6 JUMP JUMPDEST POP PUSH1 0x1 PUSH32 0x9B779B17422D0DF92223018B32B4D1FA46E071723D6817E2486D003BECC55F00 SSTORE PUSH2 0xCA DUP3 PUSH1 0x1 PUSH2 0x225 JUMP JUMPDEST PUSH2 0x120 MSTORE PUSH2 0xD9 DUP2 PUSH1 0x2 PUSH2 0x225 JUMP JUMPDEST PUSH2 0x140 MSTORE DUP2 MLOAD PUSH1 0x20 DUP1 DUP5 ADD SWAP2 SWAP1 SWAP2 KECCAK256 PUSH1 0xE0 MSTORE DUP2 MLOAD SWAP1 DUP3 ADD KECCAK256 PUSH2 0x100 MSTORE CHAINID PUSH1 0xA0 MSTORE PUSH2 0x165 PUSH1 0xE0 MLOAD PUSH2 0x100 MLOAD PUSH1 0x40 DUP1 MLOAD PUSH32 0x8B73C3C69BB8FE3D512ECC4CF759CC79239F7B179B0FFACAA9A75D522B39400F PUSH1 0x20 DUP3 ADD MSTORE SWAP1 DUP2 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x60 DUP3 ADD MSTORE CHAINID PUSH1 0x80 DUP3 ADD MSTORE ADDRESS PUSH1 0xA0 DUP3 ADD MSTORE PUSH0 SWAP1 PUSH1 0xC0 ADD PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 DUP4 SUB SUB DUP2 MSTORE SWAP1 PUSH1 0x40 MSTORE DUP1 MLOAD SWAP1 PUSH1 0x20 ADD KECCAK256 SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x80 MSTORE POP POP ADDRESS PUSH1 0xC0 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND PUSH2 0x1C4 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x496E76616C69642064657374696E6174696F6E00000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x88 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH2 0x160 MSTORE PUSH2 0x46B JUMP JUMPDEST PUSH0 DUP1 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP4 DUP2 AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB NOT DUP4 AND DUP2 OR DUP5 SSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP3 AND SWAP3 DUP4 SWAP2 PUSH32 0x8BE0079C531659141344CD1FD0A4F28419497F9722A3DAAFE3B4186F6B6457E0 SWAP2 SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP4 MLOAD LT ISZERO PUSH2 0x240 JUMPI PUSH2 0x239 DUP4 PUSH2 0x257 JUMP JUMPDEST SWAP1 POP PUSH2 0x251 JUMP JUMPDEST DUP2 PUSH2 0x24B DUP5 DUP3 PUSH2 0x359 JUMP JUMPDEST POP PUSH1 0xFF SWAP1 POP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH0 PUSH0 DUP3 SWAP1 POP PUSH1 0x1F DUP2 MLOAD GT ISZERO PUSH2 0x281 JUMPI DUP3 PUSH1 0x40 MLOAD PUSH4 0x305A27A9 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x88 SWAP2 SWAP1 PUSH2 0x413 JUMP JUMPDEST DUP1 MLOAD PUSH2 0x28C DUP3 PUSH2 0x448 JUMP JUMPDEST OR SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x2A4 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP2 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND DUP2 EQ PUSH2 0x2BA JUMPI PUSH0 PUSH0 REVERT JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x41 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST PUSH1 0x1 DUP2 DUP2 SHR SWAP1 DUP3 AND DUP1 PUSH2 0x2E9 JUMPI PUSH1 0x7F DUP3 AND SWAP2 POP JUMPDEST PUSH1 0x20 DUP3 LT DUP2 SUB PUSH2 0x307 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x22 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x1F DUP3 GT ISZERO PUSH2 0x354 JUMPI DUP1 PUSH0 MSTORE PUSH1 0x20 PUSH0 KECCAK256 PUSH1 0x1F DUP5 ADD PUSH1 0x5 SHR DUP2 ADD PUSH1 0x20 DUP6 LT ISZERO PUSH2 0x332 JUMPI POP DUP1 JUMPDEST PUSH1 0x1F DUP5 ADD PUSH1 0x5 SHR DUP3 ADD SWAP2 POP JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x351 JUMPI PUSH0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0x33E JUMP JUMPDEST POP POP JUMPDEST POP POP POP JUMP JUMPDEST DUP2 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x372 JUMPI PUSH2 0x372 PUSH2 0x2C1 JUMP JUMPDEST PUSH2 0x386 DUP2 PUSH2 0x380 DUP5 SLOAD PUSH2 0x2D5 JUMP JUMPDEST DUP5 PUSH2 0x30D JUMP JUMPDEST PUSH1 0x20 PUSH1 0x1F DUP3 GT PUSH1 0x1 DUP2 EQ PUSH2 0x3B8 JUMPI PUSH0 DUP4 ISZERO PUSH2 0x3A1 JUMPI POP DUP5 DUP3 ADD MLOAD JUMPDEST PUSH0 NOT PUSH1 0x3 DUP6 SWAP1 SHL SHR NOT AND PUSH1 0x1 DUP5 SWAP1 SHL OR DUP5 SSTORE PUSH2 0x351 JUMP JUMPDEST PUSH0 DUP5 DUP2 MSTORE PUSH1 0x20 DUP2 KECCAK256 PUSH1 0x1F NOT DUP6 AND SWAP2 JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0x3E7 JUMPI DUP8 DUP6 ADD MLOAD DUP3 SSTORE PUSH1 0x20 SWAP5 DUP6 ADD SWAP5 PUSH1 0x1 SWAP1 SWAP3 ADD SWAP2 ADD PUSH2 0x3C7 JUMP JUMPDEST POP DUP5 DUP3 LT ISZERO PUSH2 0x404 JUMPI DUP7 DUP5 ADD MLOAD PUSH0 NOT PUSH1 0x3 DUP8 SWAP1 SHL PUSH1 0xF8 AND SHR NOT AND DUP2 SSTORE JUMPDEST POP POP POP POP PUSH1 0x1 SWAP1 DUP2 SHL ADD SWAP1 SSTORE POP JUMP JUMPDEST PUSH1 0x20 DUP2 MSTORE PUSH0 DUP3 MLOAD DUP1 PUSH1 0x20 DUP5 ADD MSTORE DUP1 PUSH1 0x20 DUP6 ADD PUSH1 0x40 DUP6 ADD MCOPY PUSH0 PUSH1 0x40 DUP3 DUP6 ADD ADD MSTORE PUSH1 0x40 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND DUP5 ADD ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST DUP1 MLOAD PUSH1 0x20 DUP1 DUP4 ADD MLOAD SWAP2 SWAP1 DUP2 LT ISZERO PUSH2 0x307 JUMPI PUSH0 NOT PUSH1 0x20 SWAP2 SWAP1 SWAP2 SUB PUSH1 0x3 SHL SHL AND SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x80 MLOAD PUSH1 0xA0 MLOAD PUSH1 0xC0 MLOAD PUSH1 0xE0 MLOAD PUSH2 0x100 MLOAD PUSH2 0x120 MLOAD PUSH2 0x140 MLOAD PUSH2 0x160 MLOAD PUSH2 0x156C PUSH2 0x4E1 PUSH0 CODECOPY PUSH0 DUP2 DUP2 PUSH1 0xD7 ADD MSTORE DUP2 DUP2 PUSH2 0x525 ADD MSTORE DUP2 DUP2 PUSH2 0x5F4 ADD MSTORE DUP2 DUP2 PUSH2 0x950 ADD MSTORE PUSH2 0xBF8 ADD MSTORE PUSH0 PUSH2 0xD2D ADD MSTORE PUSH0 PUSH2 0xCFB ADD MSTORE PUSH0 PUSH2 0x11BC ADD MSTORE PUSH0 PUSH2 0x1194 ADD MSTORE PUSH0 PUSH2 0x10EF ADD MSTORE PUSH0 PUSH2 0x1119 ADD MSTORE PUSH0 PUSH2 0x1143 ADD MSTORE PUSH2 0x156C PUSH0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x92 JUMPI PUSH0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x9E281A98 GT PUSH2 0x57 JUMPI DUP1 PUSH4 0x9E281A98 EQ PUSH2 0x159 JUMPI DUP1 PUSH4 0xD850124E EQ PUSH2 0x178 JUMPI DUP1 PUSH4 0xDCB79457 EQ PUSH2 0x1C1 JUMPI DUP1 PUSH4 0xF14210A6 EQ PUSH2 0x1E0 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x1FF JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP1 PUSH4 0x2AF83BFE EQ PUSH2 0x9D JUMPI DUP1 PUSH4 0x715018A6 EQ PUSH2 0xB2 JUMPI DUP1 PUSH4 0x75BD6863 EQ PUSH2 0xC6 JUMPI DUP1 PUSH4 0x84B0196E EQ PUSH2 0x116 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x13D JUMPI PUSH0 PUSH0 REVERT JUMPDEST CALLDATASIZE PUSH2 0x99 JUMPI STOP JUMPDEST PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0xB0 PUSH2 0xAB CALLDATASIZE PUSH1 0x4 PUSH2 0x12DD JUMP JUMPDEST PUSH2 0x21E JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xBD JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xB0 PUSH2 0x6AE JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xD1 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xF9 PUSH32 0x0 DUP2 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP2 AND DUP2 MSTORE PUSH1 0x20 ADD JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x121 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x12A PUSH2 0x6C1 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x10D SWAP8 SWAP7 SWAP6 SWAP5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x134A JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x148 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH2 0xF9 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x164 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xB0 PUSH2 0x173 CALLDATASIZE PUSH1 0x4 PUSH2 0x13FB JUMP JUMPDEST PUSH2 0x703 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x183 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x1B1 PUSH2 0x192 CALLDATASIZE PUSH1 0x4 PUSH2 0x13FB JUMP JUMPDEST PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x40 MLOAD SWAP1 ISZERO ISZERO DUP2 MSTORE PUSH1 0x20 ADD PUSH2 0x10D JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1CC JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x1B1 PUSH2 0x1DB CALLDATASIZE PUSH1 0x4 PUSH2 0x13FB JUMP JUMPDEST PUSH2 0x78B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1EB JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xB0 PUSH2 0x1FA CALLDATASIZE PUSH1 0x4 PUSH2 0x1423 JUMP JUMPDEST PUSH2 0x7B8 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x20A JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xB0 PUSH2 0x219 CALLDATASIZE PUSH1 0x4 PUSH2 0x143A JUMP JUMPDEST PUSH2 0x8A7 JUMP JUMPDEST PUSH2 0x226 PUSH2 0x8E1 JUMP JUMPDEST PUSH0 PUSH2 0x237 PUSH1 0x40 DUP4 ADD PUSH1 0x20 DUP5 ADD PUSH2 0x143A JUMP JUMPDEST SWAP1 POP PUSH2 0x120 DUP3 ADD CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP3 AND PUSH2 0x28A JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xD PUSH1 0x24 DUP3 ADD MSTORE PUSH13 0x24B73B30B634B21037BBB732B9 PUSH1 0x99 SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH0 PUSH2 0x298 PUSH1 0x20 DUP6 ADD DUP6 PUSH2 0x143A JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND SUB PUSH2 0x2DE JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xD PUSH1 0x24 DUP3 ADD MSTORE PUSH13 0x24B73B30B634B2103A37B5B2B7 PUSH1 0x99 SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP3 AND PUSH0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP5 DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x33E JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xA PUSH1 0x24 DUP3 ADD MSTORE PUSH10 0x139BDB98D9481D5CD959 PUSH1 0xB2 SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST DUP3 PUSH2 0x140 ADD CALLDATALOAD TIMESTAMP GT ISZERO PUSH2 0x385 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xF PUSH1 0x24 DUP3 ADD MSTORE PUSH15 0x14185E5B1BD85908195E1C1A5C9959 PUSH1 0x8A SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH0 PUSH2 0x3EE DUP4 PUSH2 0x397 PUSH1 0x20 DUP8 ADD DUP8 PUSH2 0x143A JUMP JUMPDEST PUSH1 0x40 DUP8 ADD CALLDATALOAD PUSH2 0x3A9 PUSH1 0xE0 DUP10 ADD DUP10 PUSH2 0x1453 JUMP JUMPDEST DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY PUSH0 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP POP POP POP PUSH2 0x100 DUP10 ADD CALLDATALOAD DUP8 PUSH2 0x140 DUP12 ADD CALLDATALOAD PUSH2 0x90F JUMP JUMPDEST SWAP1 POP PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP4 AND PUSH2 0x421 DUP3 PUSH2 0x410 PUSH2 0x180 DUP9 ADD PUSH2 0x160 DUP10 ADD PUSH2 0x149D JUMP JUMPDEST DUP8 PUSH2 0x180 ADD CALLDATALOAD DUP9 PUSH2 0x1A0 ADD CALLDATALOAD PUSH2 0x9DB JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND EQ PUSH2 0x465 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xB PUSH1 0x24 DUP3 ADD MSTORE PUSH11 0x496E76616C696420736967 PUSH1 0xA8 SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST DUP4 PUSH2 0x100 ADD CALLDATALOAD CALLVALUE EQ PUSH2 0x4B9 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1C PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x496E636F7272656374204554482076616C75652070726F766964656400000000 PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP4 AND PUSH0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP6 DUP5 MSTORE DUP3 MSTORE SWAP1 SWAP2 KECCAK256 DUP1 SLOAD PUSH1 0xFF NOT AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0x520 SWAP1 PUSH2 0x4F6 SWAP1 DUP7 ADD DUP7 PUSH2 0x143A JUMP JUMPDEST DUP5 PUSH1 0x40 DUP8 ADD CALLDATALOAD PUSH1 0x60 DUP9 ADD CALLDATALOAD PUSH2 0x511 PUSH1 0xA0 DUP11 ADD PUSH1 0x80 DUP12 ADD PUSH2 0x149D JUMP JUMPDEST DUP10 PUSH1 0xA0 ADD CALLDATALOAD DUP11 PUSH1 0xC0 ADD CALLDATALOAD PUSH2 0xA07 JUMP JUMPDEST PUSH2 0x566 PUSH32 0x0 PUSH1 0x40 DUP7 ADD CALLDATALOAD PUSH2 0x556 PUSH1 0x20 DUP9 ADD DUP9 PUSH2 0x143A JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND SWAP2 SWAP1 PUSH2 0xB75 JUMP JUMPDEST PUSH0 PUSH2 0x5B2 PUSH2 0x577 PUSH1 0xE0 DUP8 ADD DUP8 PUSH2 0x1453 JUMP JUMPDEST DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY PUSH0 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP CALLVALUE SWAP3 POP PUSH2 0xBF4 SWAP2 POP POP JUMP JUMPDEST SWAP1 POP DUP1 PUSH2 0x5EF JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xB PUSH1 0x24 DUP3 ADD MSTORE PUSH11 0x10D85B1B0819985A5B1959 PUSH1 0xAA SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH2 0x621 PUSH32 0x0 PUSH0 PUSH2 0x556 PUSH1 0x20 DUP10 ADD DUP10 PUSH2 0x143A JUMP JUMPDEST PUSH2 0x62E PUSH1 0x20 DUP7 ADD DUP7 PUSH2 0x143A JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP5 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH32 0x78129A649632642D8E9F346C85D9EFB70D32D50A36774C4585491A9228BBD350 DUP8 PUSH1 0x40 ADD CALLDATALOAD PUSH1 0x40 MLOAD PUSH2 0x676 SWAP2 DUP2 MSTORE PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP POP POP PUSH2 0x6AB PUSH1 0x1 PUSH32 0x9B779B17422D0DF92223018B32B4D1FA46E071723D6817E2486D003BECC55F00 SSTORE JUMP JUMPDEST POP JUMP JUMPDEST PUSH2 0x6B6 PUSH2 0xC79 JUMP JUMPDEST PUSH2 0x6BF PUSH0 PUSH2 0xCA5 JUMP JUMPDEST JUMP JUMPDEST PUSH0 PUSH1 0x60 DUP1 PUSH0 PUSH0 PUSH0 PUSH1 0x60 PUSH2 0x6D2 PUSH2 0xCF4 JUMP JUMPDEST PUSH2 0x6DA PUSH2 0xD26 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH0 DUP1 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 SWAP3 MSTORE PUSH1 0xF PUSH1 0xF8 SHL SWAP12 SWAP4 SWAP11 POP SWAP2 SWAP9 POP CHAINID SWAP8 POP ADDRESS SWAP7 POP SWAP5 POP SWAP3 POP SWAP1 POP JUMP JUMPDEST PUSH2 0x70B PUSH2 0xC79 JUMP JUMPDEST PUSH2 0x730 PUSH2 0x71F PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND SWAP1 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP5 AND SWAP1 DUP4 PUSH2 0xD53 JUMP JUMPDEST PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP3 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH32 0xA0524EE0FD8662D6C046D199DA2A6D3DC49445182CEC055873A5BB9C2843C8E0 DUP4 PUSH1 0x40 MLOAD PUSH2 0x77F SWAP2 DUP2 MSTORE PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP3 AND PUSH0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP5 DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x7C0 PUSH2 0xC79 JUMP JUMPDEST PUSH0 DUP1 SLOAD PUSH1 0x40 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP2 AND SWAP1 DUP4 SWAP1 DUP4 DUP2 DUP2 DUP2 DUP6 DUP8 GAS CALL SWAP3 POP POP POP RETURNDATASIZE DUP1 PUSH0 DUP2 EQ PUSH2 0x80A JUMPI PUSH1 0x40 MLOAD SWAP2 POP PUSH1 0x1F NOT PUSH1 0x3F RETURNDATASIZE ADD AND DUP3 ADD PUSH1 0x40 MSTORE RETURNDATASIZE DUP3 MSTORE RETURNDATASIZE PUSH0 PUSH1 0x20 DUP5 ADD RETURNDATACOPY PUSH2 0x80F JUMP JUMPDEST PUSH1 0x60 SWAP2 POP JUMPDEST POP POP SWAP1 POP DUP1 PUSH2 0x856 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH19 0x115512081D1C985B9CD9995C8819985A5B1959 PUSH1 0x6A SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH32 0x6148672A948A12B8E0BF92A9338349B9AC890FAD62A234ABAF0A4DA99F62CFCC DUP4 PUSH1 0x40 MLOAD PUSH2 0x89B SWAP2 DUP2 MSTORE PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 POP POP JUMP JUMPDEST PUSH2 0x8AF PUSH2 0xC79 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND PUSH2 0x8D8 JUMPI PUSH1 0x40 MLOAD PUSH4 0x1E4FBDF7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH0 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST PUSH2 0x6AB DUP2 PUSH2 0xCA5 JUMP JUMPDEST PUSH2 0x8E9 PUSH2 0xD60 JUMP JUMPDEST PUSH1 0x2 PUSH32 0x9B779B17422D0DF92223018B32B4D1FA46E071723D6817E2486D003BECC55F00 SSTORE JUMP JUMPDEST DUP4 MLOAD PUSH1 0x20 DUP1 DUP7 ADD SWAP2 SWAP1 SWAP2 KECCAK256 PUSH1 0x40 DUP1 MLOAD PUSH32 0xF0543E2024FD0AE16CCB842686C2733758EC65ACFD69FB599C05B286F8DB8844 SWAP4 DUP2 ADD SWAP4 SWAP1 SWAP4 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB PUSH32 0x0 DUP2 AND SWAP2 DUP5 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP1 DUP11 AND PUSH1 0x60 DUP5 ADD MSTORE DUP9 AND PUSH1 0x80 DUP4 ADD MSTORE PUSH1 0xA0 DUP3 ADD DUP8 SWAP1 MSTORE PUSH1 0xC0 DUP3 ADD MSTORE PUSH1 0xE0 DUP2 ADD DUP5 SWAP1 MSTORE PUSH2 0x100 DUP2 ADD DUP4 SWAP1 MSTORE PUSH2 0x120 DUP2 ADD DUP3 SWAP1 MSTORE PUSH0 SWAP1 PUSH2 0x9CF SWAP1 PUSH2 0x140 ADD PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 DUP4 SUB SUB DUP2 MSTORE SWAP1 PUSH1 0x40 MSTORE DUP1 MLOAD SWAP1 PUSH1 0x20 ADD KECCAK256 PUSH2 0xDA2 JUMP JUMPDEST SWAP9 SWAP8 POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH0 PUSH0 PUSH0 PUSH0 PUSH2 0x9EB DUP9 DUP9 DUP9 DUP9 PUSH2 0xDCE JUMP JUMPDEST SWAP3 POP SWAP3 POP SWAP3 POP PUSH2 0x9FB DUP3 DUP3 PUSH2 0xE96 JUMP JUMPDEST POP SWAP1 SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH4 0xD505ACCF PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP8 DUP2 AND PUSH1 0x4 DUP4 ADD MSTORE ADDRESS PUSH1 0x24 DUP4 ADD MSTORE PUSH1 0x44 DUP3 ADD DUP8 SWAP1 MSTORE PUSH1 0x64 DUP3 ADD DUP7 SWAP1 MSTORE PUSH1 0xFF DUP6 AND PUSH1 0x84 DUP4 ADD MSTORE PUSH1 0xA4 DUP3 ADD DUP5 SWAP1 MSTORE PUSH1 0xC4 DUP3 ADD DUP4 SWAP1 MSTORE DUP9 AND SWAP1 PUSH4 0xD505ACCF SWAP1 PUSH1 0xE4 ADD PUSH0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0xA72 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP GAS CALL SWAP3 POP POP POP DUP1 ISZERO PUSH2 0xA83 JUMPI POP PUSH1 0x1 JUMPDEST PUSH2 0xB57 JUMPI PUSH1 0x40 MLOAD PUSH4 0x6EB1769F PUSH1 0xE1 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP8 DUP2 AND PUSH1 0x4 DUP4 ADD MSTORE ADDRESS PUSH1 0x24 DUP4 ADD MSTORE DUP7 SWAP2 SWAP1 DUP10 AND SWAP1 PUSH4 0xDD62ED3E SWAP1 PUSH1 0x44 ADD PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP7 GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0xAD4 JUMPI RETURNDATASIZE PUSH0 PUSH0 RETURNDATACOPY RETURNDATASIZE PUSH0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0xAF8 SWAP2 SWAP1 PUSH2 0x14BD JUMP JUMPDEST LT ISZERO PUSH2 0xB57 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x28 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5065726D6974206661696C656420616E6420696E73756666696369656E742061 PUSH1 0x44 DUP3 ADD MSTORE PUSH8 0x6C6C6F77616E6365 PUSH1 0xC0 SHL PUSH1 0x64 DUP3 ADD MSTORE PUSH1 0x84 ADD PUSH2 0x281 JUMP JUMPDEST PUSH2 0xB6C PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP9 AND DUP8 ADDRESS DUP9 PUSH2 0xF52 JUMP JUMPDEST POP POP POP POP POP POP POP JUMP JUMPDEST PUSH2 0xB81 DUP4 DUP4 DUP4 PUSH0 PUSH2 0xF8E JUMP JUMPDEST PUSH2 0xBEF JUMPI PUSH2 0xB92 DUP4 DUP4 PUSH0 PUSH1 0x1 PUSH2 0xF8E JUMP JUMPDEST PUSH2 0xBBA JUMPI PUSH1 0x40 MLOAD PUSH4 0x5274AFE7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP5 AND PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST PUSH2 0xBC7 DUP4 DUP4 DUP4 PUSH1 0x1 PUSH2 0xF8E JUMP JUMPDEST PUSH2 0xBEF JUMPI PUSH1 0x40 MLOAD PUSH4 0x5274AFE7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP5 AND PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST POP POP POP JUMP JUMPDEST PUSH0 PUSH0 PUSH32 0x0 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP4 DUP6 PUSH1 0x40 MLOAD PUSH2 0xC2F SWAP2 SWAP1 PUSH2 0x14D4 JUMP JUMPDEST PUSH0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 DUP8 GAS CALL SWAP3 POP POP POP RETURNDATASIZE DUP1 PUSH0 DUP2 EQ PUSH2 0xC69 JUMPI PUSH1 0x40 MLOAD SWAP2 POP PUSH1 0x1F NOT PUSH1 0x3F RETURNDATASIZE ADD AND DUP3 ADD PUSH1 0x40 MSTORE RETURNDATASIZE DUP3 MSTORE RETURNDATASIZE PUSH0 PUSH1 0x20 DUP5 ADD RETURNDATACOPY PUSH2 0xC6E JUMP JUMPDEST PUSH1 0x60 SWAP2 POP JUMPDEST POP SWAP1 SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND CALLER EQ PUSH2 0x6BF JUMPI PUSH1 0x40 MLOAD PUSH4 0x118CDAA7 PUSH1 0xE0 SHL DUP2 MSTORE CALLER PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST PUSH0 DUP1 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP4 DUP2 AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB NOT DUP4 AND DUP2 OR DUP5 SSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP3 AND SWAP3 DUP4 SWAP2 PUSH32 0x8BE0079C531659141344CD1FD0A4F28419497F9722A3DAAFE3B4186F6B6457E0 SWAP2 SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x60 PUSH2 0xD21 PUSH32 0x0 PUSH1 0x1 PUSH2 0xFF0 JUMP JUMPDEST SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x60 PUSH2 0xD21 PUSH32 0x0 PUSH1 0x2 PUSH2 0xFF0 JUMP JUMPDEST PUSH2 0xBC7 DUP4 DUP4 DUP4 PUSH1 0x1 PUSH2 0x1099 JUMP JUMPDEST PUSH32 0x9B779B17422D0DF92223018B32B4D1FA46E071723D6817E2486D003BECC55F00 SLOAD PUSH1 0x2 SUB PUSH2 0x6BF JUMPI PUSH1 0x40 MLOAD PUSH4 0x3EE5AEB5 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH0 PUSH2 0x7B2 PUSH2 0xDAE PUSH2 0x10E3 JUMP JUMPDEST DUP4 PUSH1 0x40 MLOAD PUSH2 0x1901 PUSH1 0xF0 SHL DUP2 MSTORE PUSH1 0x2 DUP2 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x22 DUP3 ADD MSTORE PUSH1 0x42 SWAP1 KECCAK256 SWAP1 JUMP JUMPDEST PUSH0 DUP1 DUP1 PUSH32 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0 DUP5 GT ISZERO PUSH2 0xE07 JUMPI POP PUSH0 SWAP2 POP PUSH1 0x3 SWAP1 POP DUP3 PUSH2 0xE8C JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH0 DUP1 DUP3 MSTORE PUSH1 0x20 DUP3 ADD DUP1 DUP5 MSTORE DUP11 SWAP1 MSTORE PUSH1 0xFF DUP10 AND SWAP3 DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x60 DUP2 ADD DUP8 SWAP1 MSTORE PUSH1 0x80 DUP2 ADD DUP7 SWAP1 MSTORE PUSH1 0x1 SWAP1 PUSH1 0xA0 ADD PUSH1 0x20 PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 SUB SWAP1 DUP1 DUP5 SUB SWAP1 DUP6 GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0xE58 JUMPI RETURNDATASIZE PUSH0 PUSH0 RETURNDATACOPY RETURNDATASIZE PUSH0 REVERT JUMPDEST POP POP PUSH1 0x40 MLOAD PUSH1 0x1F NOT ADD MLOAD SWAP2 POP POP PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND PUSH2 0xE83 JUMPI POP PUSH0 SWAP3 POP PUSH1 0x1 SWAP2 POP DUP3 SWAP1 POP PUSH2 0xE8C JUMP JUMPDEST SWAP3 POP PUSH0 SWAP2 POP DUP2 SWAP1 POP JUMPDEST SWAP5 POP SWAP5 POP SWAP5 SWAP2 POP POP JUMP JUMPDEST PUSH0 DUP3 PUSH1 0x3 DUP2 GT ISZERO PUSH2 0xEA9 JUMPI PUSH2 0xEA9 PUSH2 0x14EA JUMP JUMPDEST SUB PUSH2 0xEB2 JUMPI POP POP JUMP JUMPDEST PUSH1 0x1 DUP3 PUSH1 0x3 DUP2 GT ISZERO PUSH2 0xEC6 JUMPI PUSH2 0xEC6 PUSH2 0x14EA JUMP JUMPDEST SUB PUSH2 0xEE4 JUMPI PUSH1 0x40 MLOAD PUSH4 0xF645EEDF PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x2 DUP3 PUSH1 0x3 DUP2 GT ISZERO PUSH2 0xEF8 JUMPI PUSH2 0xEF8 PUSH2 0x14EA JUMP JUMPDEST SUB PUSH2 0xF19 JUMPI PUSH1 0x40 MLOAD PUSH4 0xFCE698F7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 DUP2 ADD DUP3 SWAP1 MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST PUSH1 0x3 DUP3 PUSH1 0x3 DUP2 GT ISZERO PUSH2 0xF2D JUMPI PUSH2 0xF2D PUSH2 0x14EA JUMP JUMPDEST SUB PUSH2 0xF4E JUMPI PUSH1 0x40 MLOAD PUSH4 0x35E2F383 PUSH1 0xE2 SHL DUP2 MSTORE PUSH1 0x4 DUP2 ADD DUP3 SWAP1 MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST POP POP JUMP JUMPDEST PUSH2 0xF60 DUP5 DUP5 DUP5 DUP5 PUSH1 0x1 PUSH2 0x120C JUMP JUMPDEST PUSH2 0xF88 JUMPI PUSH1 0x40 MLOAD PUSH4 0x5274AFE7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP6 AND PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH4 0x95EA7B3 PUSH1 0xE0 SHL PUSH0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP7 AND PUSH1 0x4 MSTORE PUSH1 0x24 DUP6 SWAP1 MSTORE SWAP2 PUSH1 0x20 DUP4 PUSH1 0x44 DUP2 DUP1 DUP12 GAS CALL SWAP3 POP PUSH1 0x1 PUSH0 MLOAD EQ DUP4 AND PUSH2 0xFE4 JUMPI DUP4 DUP4 ISZERO AND ISZERO PUSH2 0xFD8 JUMPI RETURNDATASIZE PUSH0 DUP3 RETURNDATACOPY RETURNDATASIZE DUP2 REVERT JUMPDEST PUSH0 DUP8 EXTCODESIZE GT RETURNDATASIZE ISZERO AND DUP4 AND SWAP3 POP JUMPDEST PUSH1 0x40 MSTORE POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x60 PUSH1 0xFF DUP4 EQ PUSH2 0x100A JUMPI PUSH2 0x1003 DUP4 PUSH2 0x1279 JUMP JUMPDEST SWAP1 POP PUSH2 0x7B2 JUMP JUMPDEST DUP2 DUP1 SLOAD PUSH2 0x1016 SWAP1 PUSH2 0x14FE JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0x1042 SWAP1 PUSH2 0x14FE JUMP JUMPDEST DUP1 ISZERO PUSH2 0x108D JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x1064 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x108D JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH0 MSTORE PUSH1 0x20 PUSH0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x1070 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP PUSH2 0x7B2 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH4 0xA9059CBB PUSH1 0xE0 SHL PUSH0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP7 AND PUSH1 0x4 MSTORE PUSH1 0x24 DUP6 SWAP1 MSTORE SWAP2 PUSH1 0x20 DUP4 PUSH1 0x44 DUP2 DUP1 DUP12 GAS CALL SWAP3 POP PUSH1 0x1 PUSH0 MLOAD EQ DUP4 AND PUSH2 0xFE4 JUMPI DUP4 DUP4 ISZERO AND ISZERO PUSH2 0xFD8 JUMPI RETURNDATASIZE PUSH0 DUP3 RETURNDATACOPY RETURNDATASIZE DUP2 REVERT JUMPDEST PUSH0 ADDRESS PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB PUSH32 0x0 AND EQ DUP1 ISZERO PUSH2 0x113B JUMPI POP PUSH32 0x0 CHAINID EQ JUMPDEST ISZERO PUSH2 0x1165 JUMPI POP PUSH32 0x0 SWAP1 JUMP JUMPDEST PUSH2 0xD21 PUSH1 0x40 DUP1 MLOAD PUSH32 0x8B73C3C69BB8FE3D512ECC4CF759CC79239F7B179B0FFACAA9A75D522B39400F PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x0 SWAP2 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH32 0x0 PUSH1 0x60 DUP3 ADD MSTORE CHAINID PUSH1 0x80 DUP3 ADD MSTORE ADDRESS PUSH1 0xA0 DUP3 ADD MSTORE PUSH0 SWAP1 PUSH1 0xC0 ADD PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 DUP4 SUB SUB DUP2 MSTORE SWAP1 PUSH1 0x40 MSTORE DUP1 MLOAD SWAP1 PUSH1 0x20 ADD KECCAK256 SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH4 0x23B872DD PUSH1 0xE0 SHL PUSH0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP8 DUP2 AND PUSH1 0x4 MSTORE DUP7 AND PUSH1 0x24 MSTORE PUSH1 0x44 DUP6 SWAP1 MSTORE SWAP2 PUSH1 0x20 DUP4 PUSH1 0x64 DUP2 DUP1 DUP13 GAS CALL SWAP3 POP PUSH1 0x1 PUSH0 MLOAD EQ DUP4 AND PUSH2 0x1268 JUMPI DUP4 DUP4 ISZERO AND ISZERO PUSH2 0x125C JUMPI RETURNDATASIZE PUSH0 DUP3 RETURNDATACOPY RETURNDATASIZE DUP2 REVERT JUMPDEST PUSH0 DUP9 EXTCODESIZE GT RETURNDATASIZE ISZERO AND DUP4 AND SWAP3 POP JUMPDEST PUSH1 0x40 MSTORE POP PUSH0 PUSH1 0x60 MSTORE SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x60 PUSH0 PUSH2 0x1285 DUP4 PUSH2 0x12B6 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 DUP4 ADD SWAP1 SWAP3 MSTORE SWAP2 SWAP3 POP PUSH0 SWAP2 SWAP1 PUSH1 0x20 DUP3 ADD DUP2 DUP1 CALLDATASIZE DUP4 CALLDATACOPY POP POP POP SWAP2 DUP3 MSTORE POP PUSH1 0x20 DUP2 ADD SWAP3 SWAP1 SWAP3 MSTORE POP SWAP1 JUMP JUMPDEST PUSH0 PUSH1 0xFF DUP3 AND PUSH1 0x1F DUP2 GT ISZERO PUSH2 0x7B2 JUMPI PUSH1 0x40 MLOAD PUSH4 0x2CD44AC3 PUSH1 0xE2 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x12ED JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1303 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP3 ADD PUSH2 0x1C0 DUP2 DUP6 SUB SLT ISZERO PUSH2 0x1315 JUMPI PUSH0 PUSH0 REVERT JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH0 DUP2 MLOAD DUP1 DUP5 MSTORE DUP1 PUSH1 0x20 DUP5 ADD PUSH1 0x20 DUP7 ADD MCOPY PUSH0 PUSH1 0x20 DUP3 DUP7 ADD ADD MSTORE PUSH1 0x20 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND DUP6 ADD ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0xFF PUSH1 0xF8 SHL DUP9 AND DUP2 MSTORE PUSH1 0xE0 PUSH1 0x20 DUP3 ADD MSTORE PUSH0 PUSH2 0x1368 PUSH1 0xE0 DUP4 ADD DUP10 PUSH2 0x131C JUMP JUMPDEST DUP3 DUP2 SUB PUSH1 0x40 DUP5 ADD MSTORE PUSH2 0x137A DUP2 DUP10 PUSH2 0x131C JUMP JUMPDEST PUSH1 0x60 DUP5 ADD DUP9 SWAP1 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP8 AND PUSH1 0x80 DUP6 ADD MSTORE PUSH1 0xA0 DUP5 ADD DUP7 SWAP1 MSTORE DUP4 DUP2 SUB PUSH1 0xC0 DUP6 ADD MSTORE DUP5 MLOAD DUP1 DUP3 MSTORE PUSH1 0x20 DUP1 DUP8 ADD SWAP4 POP SWAP1 SWAP2 ADD SWAP1 PUSH0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x13CF JUMPI DUP4 MLOAD DUP4 MSTORE PUSH1 0x20 SWAP4 DUP5 ADD SWAP4 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x1 ADD PUSH2 0x13B1 JUMP JUMPDEST POP SWAP1 SWAP12 SWAP11 POP POP POP POP POP POP POP POP POP POP POP JUMP JUMPDEST DUP1 CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND DUP2 EQ PUSH2 0x13F6 JUMPI PUSH0 PUSH0 REVERT JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH0 PUSH0 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x140C JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x1415 DUP4 PUSH2 0x13E0 JUMP JUMPDEST SWAP5 PUSH1 0x20 SWAP4 SWAP1 SWAP4 ADD CALLDATALOAD SWAP4 POP POP POP JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x1433 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP CALLDATALOAD SWAP2 SWAP1 POP JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x144A JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x1315 DUP3 PUSH2 0x13E0 JUMP JUMPDEST PUSH0 PUSH0 DUP4 CALLDATALOAD PUSH1 0x1E NOT DUP5 CALLDATASIZE SUB ADD DUP2 SLT PUSH2 0x1468 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP4 ADD DUP1 CALLDATALOAD SWAP2 POP PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x1482 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH1 0x20 ADD SWAP2 POP CALLDATASIZE DUP2 SWAP1 SUB DUP3 SGT ISZERO PUSH2 0x1496 JUMPI PUSH0 PUSH0 REVERT JUMPDEST SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x14AD JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH1 0xFF DUP2 AND DUP2 EQ PUSH2 0x1315 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x14CD JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP MLOAD SWAP2 SWAP1 POP JUMP JUMPDEST PUSH0 DUP3 MLOAD DUP1 PUSH1 0x20 DUP6 ADD DUP5 MCOPY PUSH0 SWAP3 ADD SWAP2 DUP3 MSTORE POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x21 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST PUSH1 0x1 DUP2 DUP2 SHR SWAP1 DUP3 AND DUP1 PUSH2 0x1512 JUMPI PUSH1 0x7F DUP3 AND SWAP2 POP JUMPDEST PUSH1 0x20 DUP3 LT DUP2 SUB PUSH2 0x1530 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x22 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST POP SWAP2 SWAP1 POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 SWAP13 CALLVALUE 0xDB 0x2F PUSH16 0x83AF136A5340CCE7FE8EF554EA8EB633 PUSH6 0x6FBF9BFF3BD7 BALANCE 0xAE 0xC4 0xF PUSH5 0x736F6C6343 STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "1158:6897:22:-:0;;;2504:245;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;3428:431:16;;;;;;;;;;;-1:-1:-1;;;3428:431:16;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;3428:431:16;;;;;2562:10:22;;1269:95:0;;1322:31;;-1:-1:-1;;;1322:31:0;;1350:1;1322:31;;;455:51:23;428:18;;1322:31:0;;;;;;;;1269:95;1373:32;1392:12;1373:18;:32::i;:::-;-1:-1:-1;2365:1:11;1505:66;2539;3501:45:16;:4;3532:13;3501:30;:45::i;:::-;3493:53;;3567:51;:7;3601:16;3567:33;:51::i;:::-;3556:62;;3642:22;;;;;;;;;;3628:36;;3691:25;;;;;;3674:42;;3744:13;3727:30;;3792:23;4326:11;;4339:14;;4304:80;;;2079:95;4304:80;;;3765:25:23;3806:18;;;3799:34;;;;3849:18;;;3842:34;4355:13:16;3892:18:23;;;3885:34;4378:4:16;3935:19:23;;;3928:61;4268:7:16;;3737:19:23;;4304:80:16;;;;;;;;;;;;4294:91;;;;;;4287:98;;4213:179;;3792:23;3767:48;;-1:-1:-1;;3847:4:16;3825:27;;-1:-1:-1;;;;;2632:34:22;::::2;2624:66;;;::::0;-1:-1:-1;;;2624:66:22;;719:2:23;2624:66:22::2;::::0;::::2;701:21:23::0;758:2;738:18;;;731:30;797:21;777:18;;;770:49;836:18;;2624:66:22::2;517:343:23::0;2624:66:22::2;-1:-1:-1::0;;;;;2700:42:22::2;;::::0;1158:6897;;2912:187:0;2985:16;3004:6;;-1:-1:-1;;;;;3020:17:0;;;-1:-1:-1;;;;;;3020:17:0;;;;;;3052:40;;3004:6;;;;;;;3052:40;;2985:16;3052:40;2975:124;2912:187;:::o;2893:342:12:-;2989:11;3038:4;3022:5;3016:19;:26;3012:217;;;3065:20;3079:5;3065:13;:20::i;:::-;3058:27;;;;3012:217;3142:5;3116:46;3157:5;3142;3116:46;:::i;:::-;-1:-1:-1;1390:66:12;;-1:-1:-1;3012:217:12;2893:342;;;;:::o;1708:288::-;1773:11;1796:17;1822:3;1796:30;;1854:4;1840;:11;:18;1836:74;;;1895:3;1881:18;;-1:-1:-1;;;1881:18:12;;;;;;;;:::i;1836:74::-;1976:11;;1959:13;1976:4;1959:13;:::i;:::-;1951:36;;1708:288;-1:-1:-1;;;1708:288:12:o;14:290:23:-;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:23;;214:42;;204:70;;270:1;267;260:12;204:70;293:5;14:290;-1:-1:-1;;;14:290:23:o;865:127::-;926:10;921:3;917:20;914:1;907:31;957:4;954:1;947:15;981:4;978:1;971:15;997:380;1076:1;1072:12;;;;1119;;;1140:61;;1194:4;1186:6;1182:17;1172:27;;1140:61;1247:2;1239:6;1236:14;1216:18;1213:38;1210:161;;1293:10;1288:3;1284:20;1281:1;1274:31;1328:4;1325:1;1318:15;1356:4;1353:1;1346:15;1210:161;;997:380;;;:::o;1508:518::-;1610:2;1605:3;1602:11;1599:421;;;1646:5;1643:1;1636:16;1690:4;1687:1;1677:18;1760:2;1748:10;1744:19;1741:1;1737:27;1731:4;1727:38;1796:4;1784:10;1781:20;1778:47;;;-1:-1:-1;1819:4:23;1778:47;1874:2;1869:3;1865:12;1862:1;1858:20;1852:4;1848:31;1838:41;;1929:81;1947:2;1940:5;1937:13;1929:81;;;2006:1;1992:16;;1973:1;1962:13;1929:81;;;1933:3;;1599:421;1508:518;;;:::o;2202:1299::-;2322:10;;-1:-1:-1;;;;;2344:30:23;;2341:56;;;2377:18;;:::i;:::-;2406:97;2496:6;2456:38;2488:4;2482:11;2456:38;:::i;:::-;2450:4;2406:97;:::i;:::-;2552:4;2583:2;2572:14;;2600:1;2595:649;;;;3288:1;3305:6;3302:89;;;-1:-1:-1;3357:19:23;;;3351:26;3302:89;-1:-1:-1;;2159:1:23;2155:11;;;2151:24;2147:29;2137:40;2183:1;2179:11;;;2134:57;3404:81;;2565:930;;2595:649;1455:1;1448:14;;;1492:4;1479:18;;-1:-1:-1;;2631:20:23;;;2749:222;2763:7;2760:1;2757:14;2749:222;;;2845:19;;;2839:26;2824:42;;2952:4;2937:20;;;;2905:1;2893:14;;;;2779:12;2749:222;;;2753:3;2999:6;2990:7;2987:19;2984:201;;;3060:19;;;3054:26;-1:-1:-1;;3143:1:23;3139:14;;;3155:3;3135:24;3131:37;3127:42;3112:58;3097:74;;2984:201;-1:-1:-1;;;;3231:1:23;3215:14;;;3211:22;3198:36;;-1:-1:-1;2202:1299:23:o;4000:418::-;4149:2;4138:9;4131:21;4112:4;4181:6;4175:13;4224:6;4219:2;4208:9;4204:18;4197:34;4283:6;4278:2;4270:6;4266:15;4261:2;4250:9;4246:18;4240:50;4339:1;4334:2;4325:6;4314:9;4310:22;4306:31;4299:42;4409:2;4402;4398:7;4393:2;4385:6;4381:15;4377:29;4366:9;4362:45;4358:54;4350:62;;;4000:418;;;;:::o;4423:297::-;4541:12;;4588:4;4577:16;;;4571:23;;4541:12;4606:16;;4603:111;;;-1:-1:-1;;4680:4:23;4676:17;;;;4673:1;4669:25;4665:38;4654:50;;4423:297;-1:-1:-1;4423:297:23:o;:::-;1158:6897:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": { + "@_8236": { + "entryPoint": null, + "id": 8236, + "parameterSlots": 0, + "returnSlots": 0 + }, + "@_EIP712Name_4351": { + "entryPoint": 3316, + "id": 4351, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@_EIP712Version_4363": { + "entryPoint": 3366, + "id": 4363, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@_buildDomainSeparator_4281": { + "entryPoint": null, + "id": 4281, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@_checkOwner_84": { + "entryPoint": 3193, + "id": 84, + "parameterSlots": 0, + "returnSlots": 0 + }, + "@_computeDigest_8441": { + "entryPoint": 2319, + "id": 8441, + "parameterSlots": 7, + "returnSlots": 1 + }, + "@_domainSeparatorV4_4260": { + "entryPoint": 4323, + "id": 4260, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@_executePermitAndTransfer_8508": { + "entryPoint": 2567, + "id": 8508, + "parameterSlots": 7, + "returnSlots": 0 + }, + "@_forwardCall_8529": { + "entryPoint": 3060, + "id": 8529, + "parameterSlots": 2, + "returnSlots": 1 + }, + "@_hashTypedDataV4_4297": { + "entryPoint": 3490, + "id": 4297, + "parameterSlots": 1, + "returnSlots": 1 + }, + "@_msgSender_1644": { + "entryPoint": null, + "id": 1644, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@_nonReentrantAfter_1803": { + "entryPoint": null, + "id": 1803, + "parameterSlots": 0, + "returnSlots": 0 + }, + "@_nonReentrantBeforeView_1776": { + "entryPoint": 3424, + "id": 1776, + "parameterSlots": 0, + "returnSlots": 0 + }, + "@_nonReentrantBefore_1791": { + "entryPoint": 2273, + "id": 1791, + "parameterSlots": 0, + "returnSlots": 0 + }, + "@_reentrancyGuardEntered_1818": { + "entryPoint": null, + "id": 1818, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@_reentrancyGuardStorageSlot_1826": { + "entryPoint": null, + "id": 1826, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@_safeApprove_830": { + "entryPoint": 3982, + "id": 830, + "parameterSlots": 4, + "returnSlots": 1 + }, + "@_safeTransferFrom_807": { + "entryPoint": 4620, + "id": 807, + "parameterSlots": 5, + "returnSlots": 1 + }, + "@_safeTransfer_782": { + "entryPoint": 4249, + "id": 782, + "parameterSlots": 4, + "returnSlots": 1 + }, + "@_throwError_4136": { + "entryPoint": 3734, + "id": 4136, + "parameterSlots": 2, + "returnSlots": 0 + }, + "@_transferOwnership_146": { + "entryPoint": 3237, + "id": 146, + "parameterSlots": 1, + "returnSlots": 0 + }, + "@byteLength_1945": { + "entryPoint": 4790, + "id": 1945, + "parameterSlots": 1, + "returnSlots": 1 + }, + "@destinationContract_8147": { + "entryPoint": null, + "id": 8147, + "parameterSlots": 0, + "returnSlots": 0 + }, + "@eip712Domain_4339": { + "entryPoint": 1729, + "id": 4339, + "parameterSlots": 0, + "returnSlots": 7 + }, + "@execute_8402": { + "entryPoint": 542, + "id": 8402, + "parameterSlots": 1, + "returnSlots": 0 + }, + "@forceApprove_626": { + "entryPoint": 2933, + "id": 626, + "parameterSlots": 3, + "returnSlots": 0 + }, + "@getUint256Slot_2112": { + "entryPoint": null, + "id": 2112, + "parameterSlots": 1, + "returnSlots": 1 + }, + "@isExecutionCompleted_8602": { + "entryPoint": 1931, + "id": 8602, + "parameterSlots": 2, + "returnSlots": 1 + }, + "@owner_67": { + "entryPoint": null, + "id": 67, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@recover_4059": { + "entryPoint": 2523, + "id": 4059, + "parameterSlots": 4, + "returnSlots": 1 + }, + "@renounceOwnership_98": { + "entryPoint": 1710, + "id": 98, + "parameterSlots": 0, + "returnSlots": 0 + }, + "@safeTransferFrom_456": { + "entryPoint": 3922, + "id": 456, + "parameterSlots": 4, + "returnSlots": 0 + }, + "@safeTransfer_425": { + "entryPoint": 3411, + "id": 425, + "parameterSlots": 3, + "returnSlots": 0 + }, + "@toStringWithFallback_2012": { + "entryPoint": 4080, + "id": 2012, + "parameterSlots": 2, + "returnSlots": 1 + }, + "@toString_1913": { + "entryPoint": 4729, + "id": 1913, + "parameterSlots": 1, + "returnSlots": 1 + }, + "@toTypedDataHash_4451": { + "entryPoint": null, + "id": 4451, + "parameterSlots": 2, + "returnSlots": 1 + }, + "@transferOwnership_126": { + "entryPoint": 2215, + "id": 126, + "parameterSlots": 1, + "returnSlots": 0 + }, + "@tryRecover_4023": { + "entryPoint": 3534, + "id": 4023, + "parameterSlots": 4, + "returnSlots": 3 + }, + "@usedPayloadNonces_8153": { + "entryPoint": null, + "id": 8153, + "parameterSlots": 0, + "returnSlots": 0 + }, + "@withdrawETH_8586": { + "entryPoint": 1976, + "id": 8586, + "parameterSlots": 1, + "returnSlots": 0 + }, + "@withdrawToken_8556": { + "entryPoint": 1795, + "id": 8556, + "parameterSlots": 2, + "returnSlots": 0 + }, + "abi_decode_address": { + "entryPoint": 5088, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_decode_tuple_t_address": { + "entryPoint": 5178, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_decode_tuple_t_addresst_uint256": { + "entryPoint": 5115, + "id": null, + "parameterSlots": 2, + "returnSlots": 2 + }, + "abi_decode_tuple_t_struct$_ExecuteParams_$8182_calldata_ptr": { + "entryPoint": 4829, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_decode_tuple_t_uint256": { + "entryPoint": 5155, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_decode_tuple_t_uint256_fromMemory": { + "entryPoint": 5309, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_decode_tuple_t_uint8": { + "entryPoint": 5277, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_string": { + "entryPoint": 4892, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_tuple_packed_t_bytes_memory_ptr__to_t_bytes_memory_ptr__nonPadded_inplace_fromStack_reversed": { + "entryPoint": 5332, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_tuple_packed_t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470__to_t_bytes_memory_ptr__nonPadded_inplace_fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_address__to_t_address__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_tuple_t_address_t_address__to_t_address_t_address__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 3, + "returnSlots": 1 + }, + "abi_encode_tuple_t_address_t_address_t_uint256_t_uint256_t_uint8_t_bytes32_t_bytes32__to_t_address_t_address_t_uint256_t_uint256_t_uint8_t_bytes32_t_bytes32__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 8, + "returnSlots": 1 + }, + "abi_encode_tuple_t_bool__to_t_bool__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_tuple_t_bytes1_t_string_memory_ptr_t_string_memory_ptr_t_uint256_t_address_t_bytes32_t_array$_t_uint256_$dyn_memory_ptr__to_t_bytes1_t_string_memory_ptr_t_string_memory_ptr_t_uint256_t_address_t_bytes32_t_array$_t_uint256_$dyn_memory_ptr__fromStack_reversed": { + "entryPoint": 4938, + "id": null, + "parameterSlots": 8, + "returnSlots": 1 + }, + "abi_encode_tuple_t_bytes32__to_t_bytes32__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_tuple_t_bytes32_t_address_t_address_t_address_t_uint256_t_bytes32_t_uint256_t_uint256_t_uint256__to_t_bytes32_t_address_t_address_t_address_t_uint256_t_bytes32_t_uint256_t_uint256_t_uint256__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 10, + "returnSlots": 1 + }, + "abi_encode_tuple_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__to_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 6, + "returnSlots": 1 + }, + "abi_encode_tuple_t_bytes32_t_uint8_t_bytes32_t_bytes32__to_t_bytes32_t_uint8_t_bytes32_t_bytes32__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 5, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_066ad49a0ed9e5d6a9f3c20fca13a038f0a5d629f0aaf09d634ae2a7c232ac2b__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_0acc7f0c8df1a6717d2b423ae4591ac135687015764ac37dd4cf0150a9322b15__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_110461b12e459dc76e692e7a47f9621cf45c7d48020c3c7b2066107cdf1f52ae__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_15d72127d094a30af360ead73641c61eda3d745ce4d04d12675a5e9a899f8b21__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_27859e47e6c2167c8e8d38addfca16b9afb9d8e9750b6a1e67c29196d4d99fae__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_31734eed34fab74fa1579246aaad104a344891a284044483c0c5a792a9f83a72__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_5e70ebd1d4072d337a7fabaa7bda70fa2633d6e3f89d5cb725a16b10d07e54c6__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_a793dc5bde52ab2d5349f1208a34905b1d68ab9298f549a2e514542cba0a8c76__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_c7c2be2f1b63a3793f6e2d447ce95ba2239687186a7fd6b5268a969dcdb42dcd__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "access_calldata_tail_t_bytes_calldata_ptr": { + "entryPoint": 5203, + "id": null, + "parameterSlots": 2, + "returnSlots": 2 + }, + "extract_byte_array_length": { + "entryPoint": 5374, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "panic_error_0x21": { + "entryPoint": 5354, + "id": null, + "parameterSlots": 0, + "returnSlots": 0 + }, + "panic_error_0x41": { + "entryPoint": null, + "id": null, + "parameterSlots": 0, + "returnSlots": 0 + } + }, + "generatedSources": [ + { + "ast": { + "nativeSrc": "0:11637:23", + "nodeType": "YulBlock", + "src": "0:11637:23", + "statements": [ + { + "nativeSrc": "6:3:23", + "nodeType": "YulBlock", + "src": "6:3:23", + "statements": [] + }, + { + "body": { + "nativeSrc": "117:290:23", + "nodeType": "YulBlock", + "src": "117:290:23", + "statements": [ + { + "body": { + "nativeSrc": "163:16:23", + "nodeType": "YulBlock", + "src": "163:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "172:1:23", + "nodeType": "YulLiteral", + "src": "172:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "175:1:23", + "nodeType": "YulLiteral", + "src": "175:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "165:6:23", + "nodeType": "YulIdentifier", + "src": "165:6:23" + }, + "nativeSrc": "165:12:23", + "nodeType": "YulFunctionCall", + "src": "165:12:23" + }, + "nativeSrc": "165:12:23", + "nodeType": "YulExpressionStatement", + "src": "165:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nativeSrc": "138:7:23", + "nodeType": "YulIdentifier", + "src": "138:7:23" + }, + { + "name": "headStart", + "nativeSrc": "147:9:23", + "nodeType": "YulIdentifier", + "src": "147:9:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "134:3:23", + "nodeType": "YulIdentifier", + "src": "134:3:23" + }, + "nativeSrc": "134:23:23", + "nodeType": "YulFunctionCall", + "src": "134:23:23" + }, + { + "kind": "number", + "nativeSrc": "159:2:23", + "nodeType": "YulLiteral", + "src": "159:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nativeSrc": "130:3:23", + "nodeType": "YulIdentifier", + "src": "130:3:23" + }, + "nativeSrc": "130:32:23", + "nodeType": "YulFunctionCall", + "src": "130:32:23" + }, + "nativeSrc": "127:52:23", + "nodeType": "YulIf", + "src": "127:52:23" + }, + { + "nativeSrc": "188:37:23", + "nodeType": "YulVariableDeclaration", + "src": "188:37:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "215:9:23", + "nodeType": "YulIdentifier", + "src": "215:9:23" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "202:12:23", + "nodeType": "YulIdentifier", + "src": "202:12:23" + }, + "nativeSrc": "202:23:23", + "nodeType": "YulFunctionCall", + "src": "202:23:23" + }, + "variables": [ + { + "name": "offset", + "nativeSrc": "192:6:23", + "nodeType": "YulTypedName", + "src": "192:6:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "268:16:23", + "nodeType": "YulBlock", + "src": "268:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "277:1:23", + "nodeType": "YulLiteral", + "src": "277:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "280:1:23", + "nodeType": "YulLiteral", + "src": "280:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "270:6:23", + "nodeType": "YulIdentifier", + "src": "270:6:23" + }, + "nativeSrc": "270:12:23", + "nodeType": "YulFunctionCall", + "src": "270:12:23" + }, + "nativeSrc": "270:12:23", + "nodeType": "YulExpressionStatement", + "src": "270:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "offset", + "nativeSrc": "240:6:23", + "nodeType": "YulIdentifier", + "src": "240:6:23" + }, + { + "kind": "number", + "nativeSrc": "248:18:23", + "nodeType": "YulLiteral", + "src": "248:18:23", + "type": "", + "value": "0xffffffffffffffff" + } + ], + "functionName": { + "name": "gt", + "nativeSrc": "237:2:23", + "nodeType": "YulIdentifier", + "src": "237:2:23" + }, + "nativeSrc": "237:30:23", + "nodeType": "YulFunctionCall", + "src": "237:30:23" + }, + "nativeSrc": "234:50:23", + "nodeType": "YulIf", + "src": "234:50:23" + }, + { + "nativeSrc": "293:32:23", + "nodeType": "YulVariableDeclaration", + "src": "293:32:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "307:9:23", + "nodeType": "YulIdentifier", + "src": "307:9:23" + }, + { + "name": "offset", + "nativeSrc": "318:6:23", + "nodeType": "YulIdentifier", + "src": "318:6:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "303:3:23", + "nodeType": "YulIdentifier", + "src": "303:3:23" + }, + "nativeSrc": "303:22:23", + "nodeType": "YulFunctionCall", + "src": "303:22:23" + }, + "variables": [ + { + "name": "_1", + "nativeSrc": "297:2:23", + "nodeType": "YulTypedName", + "src": "297:2:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "364:16:23", + "nodeType": "YulBlock", + "src": "364:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "373:1:23", + "nodeType": "YulLiteral", + "src": "373:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "376:1:23", + "nodeType": "YulLiteral", + "src": "376:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "366:6:23", + "nodeType": "YulIdentifier", + "src": "366:6:23" + }, + "nativeSrc": "366:12:23", + "nodeType": "YulFunctionCall", + "src": "366:12:23" + }, + "nativeSrc": "366:12:23", + "nodeType": "YulExpressionStatement", + "src": "366:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nativeSrc": "345:7:23", + "nodeType": "YulIdentifier", + "src": "345:7:23" + }, + { + "name": "_1", + "nativeSrc": "354:2:23", + "nodeType": "YulIdentifier", + "src": "354:2:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "341:3:23", + "nodeType": "YulIdentifier", + "src": "341:3:23" + }, + "nativeSrc": "341:16:23", + "nodeType": "YulFunctionCall", + "src": "341:16:23" + }, + { + "kind": "number", + "nativeSrc": "359:3:23", + "nodeType": "YulLiteral", + "src": "359:3:23", + "type": "", + "value": "448" + } + ], + "functionName": { + "name": "slt", + "nativeSrc": "337:3:23", + "nodeType": "YulIdentifier", + "src": "337:3:23" + }, + "nativeSrc": "337:26:23", + "nodeType": "YulFunctionCall", + "src": "337:26:23" + }, + "nativeSrc": "334:46:23", + "nodeType": "YulIf", + "src": "334:46:23" + }, + { + "nativeSrc": "389:12:23", + "nodeType": "YulAssignment", + "src": "389:12:23", + "value": { + "name": "_1", + "nativeSrc": "399:2:23", + "nodeType": "YulIdentifier", + "src": "399:2:23" + }, + "variableNames": [ + { + "name": "value0", + "nativeSrc": "389:6:23", + "nodeType": "YulIdentifier", + "src": "389:6:23" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_struct$_ExecuteParams_$8182_calldata_ptr", + "nativeSrc": "14:393:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "83:9:23", + "nodeType": "YulTypedName", + "src": "83:9:23", + "type": "" + }, + { + "name": "dataEnd", + "nativeSrc": "94:7:23", + "nodeType": "YulTypedName", + "src": "94:7:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nativeSrc": "106:6:23", + "nodeType": "YulTypedName", + "src": "106:6:23", + "type": "" + } + ], + "src": "14:393:23" + }, + { + "body": { + "nativeSrc": "513:102:23", + "nodeType": "YulBlock", + "src": "513:102:23", + "statements": [ + { + "nativeSrc": "523:26:23", + "nodeType": "YulAssignment", + "src": "523:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "535:9:23", + "nodeType": "YulIdentifier", + "src": "535:9:23" + }, + { + "kind": "number", + "nativeSrc": "546:2:23", + "nodeType": "YulLiteral", + "src": "546:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "531:3:23", + "nodeType": "YulIdentifier", + "src": "531:3:23" + }, + "nativeSrc": "531:18:23", + "nodeType": "YulFunctionCall", + "src": "531:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "523:4:23", + "nodeType": "YulIdentifier", + "src": "523:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "565:9:23", + "nodeType": "YulIdentifier", + "src": "565:9:23" + }, + { + "arguments": [ + { + "name": "value0", + "nativeSrc": "580:6:23", + "nodeType": "YulIdentifier", + "src": "580:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "596:3:23", + "nodeType": "YulLiteral", + "src": "596:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "601:1:23", + "nodeType": "YulLiteral", + "src": "601:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "592:3:23", + "nodeType": "YulIdentifier", + "src": "592:3:23" + }, + "nativeSrc": "592:11:23", + "nodeType": "YulFunctionCall", + "src": "592:11:23" + }, + { + "kind": "number", + "nativeSrc": "605:1:23", + "nodeType": "YulLiteral", + "src": "605:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "588:3:23", + "nodeType": "YulIdentifier", + "src": "588:3:23" + }, + "nativeSrc": "588:19:23", + "nodeType": "YulFunctionCall", + "src": "588:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "576:3:23", + "nodeType": "YulIdentifier", + "src": "576:3:23" + }, + "nativeSrc": "576:32:23", + "nodeType": "YulFunctionCall", + "src": "576:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "558:6:23", + "nodeType": "YulIdentifier", + "src": "558:6:23" + }, + "nativeSrc": "558:51:23", + "nodeType": "YulFunctionCall", + "src": "558:51:23" + }, + "nativeSrc": "558:51:23", + "nodeType": "YulExpressionStatement", + "src": "558:51:23" + } + ] + }, + "name": "abi_encode_tuple_t_address__to_t_address__fromStack_reversed", + "nativeSrc": "412:203:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "482:9:23", + "nodeType": "YulTypedName", + "src": "482:9:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "493:6:23", + "nodeType": "YulTypedName", + "src": "493:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "504:4:23", + "nodeType": "YulTypedName", + "src": "504:4:23", + "type": "" + } + ], + "src": "412:203:23" + }, + { + "body": { + "nativeSrc": "670:239:23", + "nodeType": "YulBlock", + "src": "670:239:23", + "statements": [ + { + "nativeSrc": "680:26:23", + "nodeType": "YulVariableDeclaration", + "src": "680:26:23", + "value": { + "arguments": [ + { + "name": "value", + "nativeSrc": "700:5:23", + "nodeType": "YulIdentifier", + "src": "700:5:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "694:5:23", + "nodeType": "YulIdentifier", + "src": "694:5:23" + }, + "nativeSrc": "694:12:23", + "nodeType": "YulFunctionCall", + "src": "694:12:23" + }, + "variables": [ + { + "name": "length", + "nativeSrc": "684:6:23", + "nodeType": "YulTypedName", + "src": "684:6:23", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "pos", + "nativeSrc": "722:3:23", + "nodeType": "YulIdentifier", + "src": "722:3:23" + }, + { + "name": "length", + "nativeSrc": "727:6:23", + "nodeType": "YulIdentifier", + "src": "727:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "715:6:23", + "nodeType": "YulIdentifier", + "src": "715:6:23" + }, + "nativeSrc": "715:19:23", + "nodeType": "YulFunctionCall", + "src": "715:19:23" + }, + "nativeSrc": "715:19:23", + "nodeType": "YulExpressionStatement", + "src": "715:19:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "pos", + "nativeSrc": "753:3:23", + "nodeType": "YulIdentifier", + "src": "753:3:23" + }, + { + "kind": "number", + "nativeSrc": "758:4:23", + "nodeType": "YulLiteral", + "src": "758:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "749:3:23", + "nodeType": "YulIdentifier", + "src": "749:3:23" + }, + "nativeSrc": "749:14:23", + "nodeType": "YulFunctionCall", + "src": "749:14:23" + }, + { + "arguments": [ + { + "name": "value", + "nativeSrc": "769:5:23", + "nodeType": "YulIdentifier", + "src": "769:5:23" + }, + { + "kind": "number", + "nativeSrc": "776:4:23", + "nodeType": "YulLiteral", + "src": "776:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "765:3:23", + "nodeType": "YulIdentifier", + "src": "765:3:23" + }, + "nativeSrc": "765:16:23", + "nodeType": "YulFunctionCall", + "src": "765:16:23" + }, + { + "name": "length", + "nativeSrc": "783:6:23", + "nodeType": "YulIdentifier", + "src": "783:6:23" + } + ], + "functionName": { + "name": "mcopy", + "nativeSrc": "743:5:23", + "nodeType": "YulIdentifier", + "src": "743:5:23" + }, + "nativeSrc": "743:47:23", + "nodeType": "YulFunctionCall", + "src": "743:47:23" + }, + "nativeSrc": "743:47:23", + "nodeType": "YulExpressionStatement", + "src": "743:47:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "pos", + "nativeSrc": "814:3:23", + "nodeType": "YulIdentifier", + "src": "814:3:23" + }, + { + "name": "length", + "nativeSrc": "819:6:23", + "nodeType": "YulIdentifier", + "src": "819:6:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "810:3:23", + "nodeType": "YulIdentifier", + "src": "810:3:23" + }, + "nativeSrc": "810:16:23", + "nodeType": "YulFunctionCall", + "src": "810:16:23" + }, + { + "kind": "number", + "nativeSrc": "828:4:23", + "nodeType": "YulLiteral", + "src": "828:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "806:3:23", + "nodeType": "YulIdentifier", + "src": "806:3:23" + }, + "nativeSrc": "806:27:23", + "nodeType": "YulFunctionCall", + "src": "806:27:23" + }, + { + "kind": "number", + "nativeSrc": "835:1:23", + "nodeType": "YulLiteral", + "src": "835:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "799:6:23", + "nodeType": "YulIdentifier", + "src": "799:6:23" + }, + "nativeSrc": "799:38:23", + "nodeType": "YulFunctionCall", + "src": "799:38:23" + }, + "nativeSrc": "799:38:23", + "nodeType": "YulExpressionStatement", + "src": "799:38:23" + }, + { + "nativeSrc": "846:57:23", + "nodeType": "YulAssignment", + "src": "846:57:23", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "pos", + "nativeSrc": "861:3:23", + "nodeType": "YulIdentifier", + "src": "861:3:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "length", + "nativeSrc": "874:6:23", + "nodeType": "YulIdentifier", + "src": "874:6:23" + }, + { + "kind": "number", + "nativeSrc": "882:2:23", + "nodeType": "YulLiteral", + "src": "882:2:23", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "870:3:23", + "nodeType": "YulIdentifier", + "src": "870:3:23" + }, + "nativeSrc": "870:15:23", + "nodeType": "YulFunctionCall", + "src": "870:15:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "891:2:23", + "nodeType": "YulLiteral", + "src": "891:2:23", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "887:3:23", + "nodeType": "YulIdentifier", + "src": "887:3:23" + }, + "nativeSrc": "887:7:23", + "nodeType": "YulFunctionCall", + "src": "887:7:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "866:3:23", + "nodeType": "YulIdentifier", + "src": "866:3:23" + }, + "nativeSrc": "866:29:23", + "nodeType": "YulFunctionCall", + "src": "866:29:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "857:3:23", + "nodeType": "YulIdentifier", + "src": "857:3:23" + }, + "nativeSrc": "857:39:23", + "nodeType": "YulFunctionCall", + "src": "857:39:23" + }, + { + "kind": "number", + "nativeSrc": "898:4:23", + "nodeType": "YulLiteral", + "src": "898:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "853:3:23", + "nodeType": "YulIdentifier", + "src": "853:3:23" + }, + "nativeSrc": "853:50:23", + "nodeType": "YulFunctionCall", + "src": "853:50:23" + }, + "variableNames": [ + { + "name": "end", + "nativeSrc": "846:3:23", + "nodeType": "YulIdentifier", + "src": "846:3:23" + } + ] + } + ] + }, + "name": "abi_encode_string", + "nativeSrc": "620:289:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nativeSrc": "647:5:23", + "nodeType": "YulTypedName", + "src": "647:5:23", + "type": "" + }, + { + "name": "pos", + "nativeSrc": "654:3:23", + "nodeType": "YulTypedName", + "src": "654:3:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nativeSrc": "662:3:23", + "nodeType": "YulTypedName", + "src": "662:3:23", + "type": "" + } + ], + "src": "620:289:23" + }, + { + "body": { + "nativeSrc": "1271:881:23", + "nodeType": "YulBlock", + "src": "1271:881:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "1288:9:23", + "nodeType": "YulIdentifier", + "src": "1288:9:23" + }, + { + "arguments": [ + { + "name": "value0", + "nativeSrc": "1303:6:23", + "nodeType": "YulIdentifier", + "src": "1303:6:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1315:3:23", + "nodeType": "YulLiteral", + "src": "1315:3:23", + "type": "", + "value": "248" + }, + { + "kind": "number", + "nativeSrc": "1320:3:23", + "nodeType": "YulLiteral", + "src": "1320:3:23", + "type": "", + "value": "255" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "1311:3:23", + "nodeType": "YulIdentifier", + "src": "1311:3:23" + }, + "nativeSrc": "1311:13:23", + "nodeType": "YulFunctionCall", + "src": "1311:13:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "1299:3:23", + "nodeType": "YulIdentifier", + "src": "1299:3:23" + }, + "nativeSrc": "1299:26:23", + "nodeType": "YulFunctionCall", + "src": "1299:26:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1281:6:23", + "nodeType": "YulIdentifier", + "src": "1281:6:23" + }, + "nativeSrc": "1281:45:23", + "nodeType": "YulFunctionCall", + "src": "1281:45:23" + }, + "nativeSrc": "1281:45:23", + "nodeType": "YulExpressionStatement", + "src": "1281:45:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "1346:9:23", + "nodeType": "YulIdentifier", + "src": "1346:9:23" + }, + { + "kind": "number", + "nativeSrc": "1357:2:23", + "nodeType": "YulLiteral", + "src": "1357:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1342:3:23", + "nodeType": "YulIdentifier", + "src": "1342:3:23" + }, + "nativeSrc": "1342:18:23", + "nodeType": "YulFunctionCall", + "src": "1342:18:23" + }, + { + "kind": "number", + "nativeSrc": "1362:3:23", + "nodeType": "YulLiteral", + "src": "1362:3:23", + "type": "", + "value": "224" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1335:6:23", + "nodeType": "YulIdentifier", + "src": "1335:6:23" + }, + "nativeSrc": "1335:31:23", + "nodeType": "YulFunctionCall", + "src": "1335:31:23" + }, + "nativeSrc": "1335:31:23", + "nodeType": "YulExpressionStatement", + "src": "1335:31:23" + }, + { + "nativeSrc": "1375:60:23", + "nodeType": "YulVariableDeclaration", + "src": "1375:60:23", + "value": { + "arguments": [ + { + "name": "value1", + "nativeSrc": "1407:6:23", + "nodeType": "YulIdentifier", + "src": "1407:6:23" + }, + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "1419:9:23", + "nodeType": "YulIdentifier", + "src": "1419:9:23" + }, + { + "kind": "number", + "nativeSrc": "1430:3:23", + "nodeType": "YulLiteral", + "src": "1430:3:23", + "type": "", + "value": "224" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1415:3:23", + "nodeType": "YulIdentifier", + "src": "1415:3:23" + }, + "nativeSrc": "1415:19:23", + "nodeType": "YulFunctionCall", + "src": "1415:19:23" + } + ], + "functionName": { + "name": "abi_encode_string", + "nativeSrc": "1389:17:23", + "nodeType": "YulIdentifier", + "src": "1389:17:23" + }, + "nativeSrc": "1389:46:23", + "nodeType": "YulFunctionCall", + "src": "1389:46:23" + }, + "variables": [ + { + "name": "tail_1", + "nativeSrc": "1379:6:23", + "nodeType": "YulTypedName", + "src": "1379:6:23", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "1455:9:23", + "nodeType": "YulIdentifier", + "src": "1455:9:23" + }, + { + "kind": "number", + "nativeSrc": "1466:2:23", + "nodeType": "YulLiteral", + "src": "1466:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1451:3:23", + "nodeType": "YulIdentifier", + "src": "1451:3:23" + }, + "nativeSrc": "1451:18:23", + "nodeType": "YulFunctionCall", + "src": "1451:18:23" + }, + { + "arguments": [ + { + "name": "tail_1", + "nativeSrc": "1475:6:23", + "nodeType": "YulIdentifier", + "src": "1475:6:23" + }, + { + "name": "headStart", + "nativeSrc": "1483:9:23", + "nodeType": "YulIdentifier", + "src": "1483:9:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "1471:3:23", + "nodeType": "YulIdentifier", + "src": "1471:3:23" + }, + "nativeSrc": "1471:22:23", + "nodeType": "YulFunctionCall", + "src": "1471:22:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1444:6:23", + "nodeType": "YulIdentifier", + "src": "1444:6:23" + }, + "nativeSrc": "1444:50:23", + "nodeType": "YulFunctionCall", + "src": "1444:50:23" + }, + "nativeSrc": "1444:50:23", + "nodeType": "YulExpressionStatement", + "src": "1444:50:23" + }, + { + "nativeSrc": "1503:47:23", + "nodeType": "YulVariableDeclaration", + "src": "1503:47:23", + "value": { + "arguments": [ + { + "name": "value2", + "nativeSrc": "1535:6:23", + "nodeType": "YulIdentifier", + "src": "1535:6:23" + }, + { + "name": "tail_1", + "nativeSrc": "1543:6:23", + "nodeType": "YulIdentifier", + "src": "1543:6:23" + } + ], + "functionName": { + "name": "abi_encode_string", + "nativeSrc": "1517:17:23", + "nodeType": "YulIdentifier", + "src": "1517:17:23" + }, + "nativeSrc": "1517:33:23", + "nodeType": "YulFunctionCall", + "src": "1517:33:23" + }, + "variables": [ + { + "name": "tail_2", + "nativeSrc": "1507:6:23", + "nodeType": "YulTypedName", + "src": "1507:6:23", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "1570:9:23", + "nodeType": "YulIdentifier", + "src": "1570:9:23" + }, + { + "kind": "number", + "nativeSrc": "1581:2:23", + "nodeType": "YulLiteral", + "src": "1581:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1566:3:23", + "nodeType": "YulIdentifier", + "src": "1566:3:23" + }, + "nativeSrc": "1566:18:23", + "nodeType": "YulFunctionCall", + "src": "1566:18:23" + }, + { + "name": "value3", + "nativeSrc": "1586:6:23", + "nodeType": "YulIdentifier", + "src": "1586:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1559:6:23", + "nodeType": "YulIdentifier", + "src": "1559:6:23" + }, + "nativeSrc": "1559:34:23", + "nodeType": "YulFunctionCall", + "src": "1559:34:23" + }, + "nativeSrc": "1559:34:23", + "nodeType": "YulExpressionStatement", + "src": "1559:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "1613:9:23", + "nodeType": "YulIdentifier", + "src": "1613:9:23" + }, + { + "kind": "number", + "nativeSrc": "1624:3:23", + "nodeType": "YulLiteral", + "src": "1624:3:23", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1609:3:23", + "nodeType": "YulIdentifier", + "src": "1609:3:23" + }, + "nativeSrc": "1609:19:23", + "nodeType": "YulFunctionCall", + "src": "1609:19:23" + }, + { + "arguments": [ + { + "name": "value4", + "nativeSrc": "1634:6:23", + "nodeType": "YulIdentifier", + "src": "1634:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1650:3:23", + "nodeType": "YulLiteral", + "src": "1650:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "1655:1:23", + "nodeType": "YulLiteral", + "src": "1655:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "1646:3:23", + "nodeType": "YulIdentifier", + "src": "1646:3:23" + }, + "nativeSrc": "1646:11:23", + "nodeType": "YulFunctionCall", + "src": "1646:11:23" + }, + { + "kind": "number", + "nativeSrc": "1659:1:23", + "nodeType": "YulLiteral", + "src": "1659:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "1642:3:23", + "nodeType": "YulIdentifier", + "src": "1642:3:23" + }, + "nativeSrc": "1642:19:23", + "nodeType": "YulFunctionCall", + "src": "1642:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "1630:3:23", + "nodeType": "YulIdentifier", + "src": "1630:3:23" + }, + "nativeSrc": "1630:32:23", + "nodeType": "YulFunctionCall", + "src": "1630:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1602:6:23", + "nodeType": "YulIdentifier", + "src": "1602:6:23" + }, + "nativeSrc": "1602:61:23", + "nodeType": "YulFunctionCall", + "src": "1602:61:23" + }, + "nativeSrc": "1602:61:23", + "nodeType": "YulExpressionStatement", + "src": "1602:61:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "1683:9:23", + "nodeType": "YulIdentifier", + "src": "1683:9:23" + }, + { + "kind": "number", + "nativeSrc": "1694:3:23", + "nodeType": "YulLiteral", + "src": "1694:3:23", + "type": "", + "value": "160" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1679:3:23", + "nodeType": "YulIdentifier", + "src": "1679:3:23" + }, + "nativeSrc": "1679:19:23", + "nodeType": "YulFunctionCall", + "src": "1679:19:23" + }, + { + "name": "value5", + "nativeSrc": "1700:6:23", + "nodeType": "YulIdentifier", + "src": "1700:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1672:6:23", + "nodeType": "YulIdentifier", + "src": "1672:6:23" + }, + "nativeSrc": "1672:35:23", + "nodeType": "YulFunctionCall", + "src": "1672:35:23" + }, + "nativeSrc": "1672:35:23", + "nodeType": "YulExpressionStatement", + "src": "1672:35:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "1727:9:23", + "nodeType": "YulIdentifier", + "src": "1727:9:23" + }, + { + "kind": "number", + "nativeSrc": "1738:3:23", + "nodeType": "YulLiteral", + "src": "1738:3:23", + "type": "", + "value": "192" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1723:3:23", + "nodeType": "YulIdentifier", + "src": "1723:3:23" + }, + "nativeSrc": "1723:19:23", + "nodeType": "YulFunctionCall", + "src": "1723:19:23" + }, + { + "arguments": [ + { + "name": "tail_2", + "nativeSrc": "1748:6:23", + "nodeType": "YulIdentifier", + "src": "1748:6:23" + }, + { + "name": "headStart", + "nativeSrc": "1756:9:23", + "nodeType": "YulIdentifier", + "src": "1756:9:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "1744:3:23", + "nodeType": "YulIdentifier", + "src": "1744:3:23" + }, + "nativeSrc": "1744:22:23", + "nodeType": "YulFunctionCall", + "src": "1744:22:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1716:6:23", + "nodeType": "YulIdentifier", + "src": "1716:6:23" + }, + "nativeSrc": "1716:51:23", + "nodeType": "YulFunctionCall", + "src": "1716:51:23" + }, + "nativeSrc": "1716:51:23", + "nodeType": "YulExpressionStatement", + "src": "1716:51:23" + }, + { + "nativeSrc": "1776:17:23", + "nodeType": "YulVariableDeclaration", + "src": "1776:17:23", + "value": { + "name": "tail_2", + "nativeSrc": "1787:6:23", + "nodeType": "YulIdentifier", + "src": "1787:6:23" + }, + "variables": [ + { + "name": "pos", + "nativeSrc": "1780:3:23", + "nodeType": "YulTypedName", + "src": "1780:3:23", + "type": "" + } + ] + }, + { + "nativeSrc": "1802:27:23", + "nodeType": "YulVariableDeclaration", + "src": "1802:27:23", + "value": { + "arguments": [ + { + "name": "value6", + "nativeSrc": "1822:6:23", + "nodeType": "YulIdentifier", + "src": "1822:6:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "1816:5:23", + "nodeType": "YulIdentifier", + "src": "1816:5:23" + }, + "nativeSrc": "1816:13:23", + "nodeType": "YulFunctionCall", + "src": "1816:13:23" + }, + "variables": [ + { + "name": "length", + "nativeSrc": "1806:6:23", + "nodeType": "YulTypedName", + "src": "1806:6:23", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "tail_2", + "nativeSrc": "1845:6:23", + "nodeType": "YulIdentifier", + "src": "1845:6:23" + }, + { + "name": "length", + "nativeSrc": "1853:6:23", + "nodeType": "YulIdentifier", + "src": "1853:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1838:6:23", + "nodeType": "YulIdentifier", + "src": "1838:6:23" + }, + "nativeSrc": "1838:22:23", + "nodeType": "YulFunctionCall", + "src": "1838:22:23" + }, + "nativeSrc": "1838:22:23", + "nodeType": "YulExpressionStatement", + "src": "1838:22:23" + }, + { + "nativeSrc": "1869:22:23", + "nodeType": "YulAssignment", + "src": "1869:22:23", + "value": { + "arguments": [ + { + "name": "tail_2", + "nativeSrc": "1880:6:23", + "nodeType": "YulIdentifier", + "src": "1880:6:23" + }, + { + "kind": "number", + "nativeSrc": "1888:2:23", + "nodeType": "YulLiteral", + "src": "1888:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1876:3:23", + "nodeType": "YulIdentifier", + "src": "1876:3:23" + }, + "nativeSrc": "1876:15:23", + "nodeType": "YulFunctionCall", + "src": "1876:15:23" + }, + "variableNames": [ + { + "name": "pos", + "nativeSrc": "1869:3:23", + "nodeType": "YulIdentifier", + "src": "1869:3:23" + } + ] + }, + { + "nativeSrc": "1900:29:23", + "nodeType": "YulVariableDeclaration", + "src": "1900:29:23", + "value": { + "arguments": [ + { + "name": "value6", + "nativeSrc": "1918:6:23", + "nodeType": "YulIdentifier", + "src": "1918:6:23" + }, + { + "kind": "number", + "nativeSrc": "1926:2:23", + "nodeType": "YulLiteral", + "src": "1926:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1914:3:23", + "nodeType": "YulIdentifier", + "src": "1914:3:23" + }, + "nativeSrc": "1914:15:23", + "nodeType": "YulFunctionCall", + "src": "1914:15:23" + }, + "variables": [ + { + "name": "srcPtr", + "nativeSrc": "1904:6:23", + "nodeType": "YulTypedName", + "src": "1904:6:23", + "type": "" + } + ] + }, + { + "nativeSrc": "1938:10:23", + "nodeType": "YulVariableDeclaration", + "src": "1938:10:23", + "value": { + "kind": "number", + "nativeSrc": "1947:1:23", + "nodeType": "YulLiteral", + "src": "1947:1:23", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "i", + "nativeSrc": "1942:1:23", + "nodeType": "YulTypedName", + "src": "1942:1:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "2006:120:23", + "nodeType": "YulBlock", + "src": "2006:120:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "pos", + "nativeSrc": "2027:3:23", + "nodeType": "YulIdentifier", + "src": "2027:3:23" + }, + { + "arguments": [ + { + "name": "srcPtr", + "nativeSrc": "2038:6:23", + "nodeType": "YulIdentifier", + "src": "2038:6:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "2032:5:23", + "nodeType": "YulIdentifier", + "src": "2032:5:23" + }, + "nativeSrc": "2032:13:23", + "nodeType": "YulFunctionCall", + "src": "2032:13:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "2020:6:23", + "nodeType": "YulIdentifier", + "src": "2020:6:23" + }, + "nativeSrc": "2020:26:23", + "nodeType": "YulFunctionCall", + "src": "2020:26:23" + }, + "nativeSrc": "2020:26:23", + "nodeType": "YulExpressionStatement", + "src": "2020:26:23" + }, + { + "nativeSrc": "2059:19:23", + "nodeType": "YulAssignment", + "src": "2059:19:23", + "value": { + "arguments": [ + { + "name": "pos", + "nativeSrc": "2070:3:23", + "nodeType": "YulIdentifier", + "src": "2070:3:23" + }, + { + "kind": "number", + "nativeSrc": "2075:2:23", + "nodeType": "YulLiteral", + "src": "2075:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2066:3:23", + "nodeType": "YulIdentifier", + "src": "2066:3:23" + }, + "nativeSrc": "2066:12:23", + "nodeType": "YulFunctionCall", + "src": "2066:12:23" + }, + "variableNames": [ + { + "name": "pos", + "nativeSrc": "2059:3:23", + "nodeType": "YulIdentifier", + "src": "2059:3:23" + } + ] + }, + { + "nativeSrc": "2091:25:23", + "nodeType": "YulAssignment", + "src": "2091:25:23", + "value": { + "arguments": [ + { + "name": "srcPtr", + "nativeSrc": "2105:6:23", + "nodeType": "YulIdentifier", + "src": "2105:6:23" + }, + { + "kind": "number", + "nativeSrc": "2113:2:23", + "nodeType": "YulLiteral", + "src": "2113:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2101:3:23", + "nodeType": "YulIdentifier", + "src": "2101:3:23" + }, + "nativeSrc": "2101:15:23", + "nodeType": "YulFunctionCall", + "src": "2101:15:23" + }, + "variableNames": [ + { + "name": "srcPtr", + "nativeSrc": "2091:6:23", + "nodeType": "YulIdentifier", + "src": "2091:6:23" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "i", + "nativeSrc": "1968:1:23", + "nodeType": "YulIdentifier", + "src": "1968:1:23" + }, + { + "name": "length", + "nativeSrc": "1971:6:23", + "nodeType": "YulIdentifier", + "src": "1971:6:23" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "1965:2:23", + "nodeType": "YulIdentifier", + "src": "1965:2:23" + }, + "nativeSrc": "1965:13:23", + "nodeType": "YulFunctionCall", + "src": "1965:13:23" + }, + "nativeSrc": "1957:169:23", + "nodeType": "YulForLoop", + "post": { + "nativeSrc": "1979:18:23", + "nodeType": "YulBlock", + "src": "1979:18:23", + "statements": [ + { + "nativeSrc": "1981:14:23", + "nodeType": "YulAssignment", + "src": "1981:14:23", + "value": { + "arguments": [ + { + "name": "i", + "nativeSrc": "1990:1:23", + "nodeType": "YulIdentifier", + "src": "1990:1:23" + }, + { + "kind": "number", + "nativeSrc": "1993:1:23", + "nodeType": "YulLiteral", + "src": "1993:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1986:3:23", + "nodeType": "YulIdentifier", + "src": "1986:3:23" + }, + "nativeSrc": "1986:9:23", + "nodeType": "YulFunctionCall", + "src": "1986:9:23" + }, + "variableNames": [ + { + "name": "i", + "nativeSrc": "1981:1:23", + "nodeType": "YulIdentifier", + "src": "1981:1:23" + } + ] + } + ] + }, + "pre": { + "nativeSrc": "1961:3:23", + "nodeType": "YulBlock", + "src": "1961:3:23", + "statements": [] + }, + "src": "1957:169:23" + }, + { + "nativeSrc": "2135:11:23", + "nodeType": "YulAssignment", + "src": "2135:11:23", + "value": { + "name": "pos", + "nativeSrc": "2143:3:23", + "nodeType": "YulIdentifier", + "src": "2143:3:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "2135:4:23", + "nodeType": "YulIdentifier", + "src": "2135:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_bytes1_t_string_memory_ptr_t_string_memory_ptr_t_uint256_t_address_t_bytes32_t_array$_t_uint256_$dyn_memory_ptr__to_t_bytes1_t_string_memory_ptr_t_string_memory_ptr_t_uint256_t_address_t_bytes32_t_array$_t_uint256_$dyn_memory_ptr__fromStack_reversed", + "nativeSrc": "914:1238:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "1192:9:23", + "nodeType": "YulTypedName", + "src": "1192:9:23", + "type": "" + }, + { + "name": "value6", + "nativeSrc": "1203:6:23", + "nodeType": "YulTypedName", + "src": "1203:6:23", + "type": "" + }, + { + "name": "value5", + "nativeSrc": "1211:6:23", + "nodeType": "YulTypedName", + "src": "1211:6:23", + "type": "" + }, + { + "name": "value4", + "nativeSrc": "1219:6:23", + "nodeType": "YulTypedName", + "src": "1219:6:23", + "type": "" + }, + { + "name": "value3", + "nativeSrc": "1227:6:23", + "nodeType": "YulTypedName", + "src": "1227:6:23", + "type": "" + }, + { + "name": "value2", + "nativeSrc": "1235:6:23", + "nodeType": "YulTypedName", + "src": "1235:6:23", + "type": "" + }, + { + "name": "value1", + "nativeSrc": "1243:6:23", + "nodeType": "YulTypedName", + "src": "1243:6:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "1251:6:23", + "nodeType": "YulTypedName", + "src": "1251:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "1262:4:23", + "nodeType": "YulTypedName", + "src": "1262:4:23", + "type": "" + } + ], + "src": "914:1238:23" + }, + { + "body": { + "nativeSrc": "2206:124:23", + "nodeType": "YulBlock", + "src": "2206:124:23", + "statements": [ + { + "nativeSrc": "2216:29:23", + "nodeType": "YulAssignment", + "src": "2216:29:23", + "value": { + "arguments": [ + { + "name": "offset", + "nativeSrc": "2238:6:23", + "nodeType": "YulIdentifier", + "src": "2238:6:23" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "2225:12:23", + "nodeType": "YulIdentifier", + "src": "2225:12:23" + }, + "nativeSrc": "2225:20:23", + "nodeType": "YulFunctionCall", + "src": "2225:20:23" + }, + "variableNames": [ + { + "name": "value", + "nativeSrc": "2216:5:23", + "nodeType": "YulIdentifier", + "src": "2216:5:23" + } + ] + }, + { + "body": { + "nativeSrc": "2308:16:23", + "nodeType": "YulBlock", + "src": "2308:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2317:1:23", + "nodeType": "YulLiteral", + "src": "2317:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "2320:1:23", + "nodeType": "YulLiteral", + "src": "2320:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "2310:6:23", + "nodeType": "YulIdentifier", + "src": "2310:6:23" + }, + "nativeSrc": "2310:12:23", + "nodeType": "YulFunctionCall", + "src": "2310:12:23" + }, + "nativeSrc": "2310:12:23", + "nodeType": "YulExpressionStatement", + "src": "2310:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nativeSrc": "2267:5:23", + "nodeType": "YulIdentifier", + "src": "2267:5:23" + }, + { + "arguments": [ + { + "name": "value", + "nativeSrc": "2278:5:23", + "nodeType": "YulIdentifier", + "src": "2278:5:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2293:3:23", + "nodeType": "YulLiteral", + "src": "2293:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "2298:1:23", + "nodeType": "YulLiteral", + "src": "2298:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "2289:3:23", + "nodeType": "YulIdentifier", + "src": "2289:3:23" + }, + "nativeSrc": "2289:11:23", + "nodeType": "YulFunctionCall", + "src": "2289:11:23" + }, + { + "kind": "number", + "nativeSrc": "2302:1:23", + "nodeType": "YulLiteral", + "src": "2302:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "2285:3:23", + "nodeType": "YulIdentifier", + "src": "2285:3:23" + }, + "nativeSrc": "2285:19:23", + "nodeType": "YulFunctionCall", + "src": "2285:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "2274:3:23", + "nodeType": "YulIdentifier", + "src": "2274:3:23" + }, + "nativeSrc": "2274:31:23", + "nodeType": "YulFunctionCall", + "src": "2274:31:23" + } + ], + "functionName": { + "name": "eq", + "nativeSrc": "2264:2:23", + "nodeType": "YulIdentifier", + "src": "2264:2:23" + }, + "nativeSrc": "2264:42:23", + "nodeType": "YulFunctionCall", + "src": "2264:42:23" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "2257:6:23", + "nodeType": "YulIdentifier", + "src": "2257:6:23" + }, + "nativeSrc": "2257:50:23", + "nodeType": "YulFunctionCall", + "src": "2257:50:23" + }, + "nativeSrc": "2254:70:23", + "nodeType": "YulIf", + "src": "2254:70:23" + } + ] + }, + "name": "abi_decode_address", + "nativeSrc": "2157:173:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "offset", + "nativeSrc": "2185:6:23", + "nodeType": "YulTypedName", + "src": "2185:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value", + "nativeSrc": "2196:5:23", + "nodeType": "YulTypedName", + "src": "2196:5:23", + "type": "" + } + ], + "src": "2157:173:23" + }, + { + "body": { + "nativeSrc": "2422:213:23", + "nodeType": "YulBlock", + "src": "2422:213:23", + "statements": [ + { + "body": { + "nativeSrc": "2468:16:23", + "nodeType": "YulBlock", + "src": "2468:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2477:1:23", + "nodeType": "YulLiteral", + "src": "2477:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "2480:1:23", + "nodeType": "YulLiteral", + "src": "2480:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "2470:6:23", + "nodeType": "YulIdentifier", + "src": "2470:6:23" + }, + "nativeSrc": "2470:12:23", + "nodeType": "YulFunctionCall", + "src": "2470:12:23" + }, + "nativeSrc": "2470:12:23", + "nodeType": "YulExpressionStatement", + "src": "2470:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nativeSrc": "2443:7:23", + "nodeType": "YulIdentifier", + "src": "2443:7:23" + }, + { + "name": "headStart", + "nativeSrc": "2452:9:23", + "nodeType": "YulIdentifier", + "src": "2452:9:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "2439:3:23", + "nodeType": "YulIdentifier", + "src": "2439:3:23" + }, + "nativeSrc": "2439:23:23", + "nodeType": "YulFunctionCall", + "src": "2439:23:23" + }, + { + "kind": "number", + "nativeSrc": "2464:2:23", + "nodeType": "YulLiteral", + "src": "2464:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "slt", + "nativeSrc": "2435:3:23", + "nodeType": "YulIdentifier", + "src": "2435:3:23" + }, + "nativeSrc": "2435:32:23", + "nodeType": "YulFunctionCall", + "src": "2435:32:23" + }, + "nativeSrc": "2432:52:23", + "nodeType": "YulIf", + "src": "2432:52:23" + }, + { + "nativeSrc": "2493:39:23", + "nodeType": "YulAssignment", + "src": "2493:39:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "2522:9:23", + "nodeType": "YulIdentifier", + "src": "2522:9:23" + } + ], + "functionName": { + "name": "abi_decode_address", + "nativeSrc": "2503:18:23", + "nodeType": "YulIdentifier", + "src": "2503:18:23" + }, + "nativeSrc": "2503:29:23", + "nodeType": "YulFunctionCall", + "src": "2503:29:23" + }, + "variableNames": [ + { + "name": "value0", + "nativeSrc": "2493:6:23", + "nodeType": "YulIdentifier", + "src": "2493:6:23" + } + ] + }, + { + "nativeSrc": "2541:14:23", + "nodeType": "YulVariableDeclaration", + "src": "2541:14:23", + "value": { + "kind": "number", + "nativeSrc": "2554:1:23", + "nodeType": "YulLiteral", + "src": "2554:1:23", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "value", + "nativeSrc": "2545:5:23", + "nodeType": "YulTypedName", + "src": "2545:5:23", + "type": "" + } + ] + }, + { + "nativeSrc": "2564:41:23", + "nodeType": "YulAssignment", + "src": "2564:41:23", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "2590:9:23", + "nodeType": "YulIdentifier", + "src": "2590:9:23" + }, + { + "kind": "number", + "nativeSrc": "2601:2:23", + "nodeType": "YulLiteral", + "src": "2601:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2586:3:23", + "nodeType": "YulIdentifier", + "src": "2586:3:23" + }, + "nativeSrc": "2586:18:23", + "nodeType": "YulFunctionCall", + "src": "2586:18:23" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "2573:12:23", + "nodeType": "YulIdentifier", + "src": "2573:12:23" + }, + "nativeSrc": "2573:32:23", + "nodeType": "YulFunctionCall", + "src": "2573:32:23" + }, + "variableNames": [ + { + "name": "value", + "nativeSrc": "2564:5:23", + "nodeType": "YulIdentifier", + "src": "2564:5:23" + } + ] + }, + { + "nativeSrc": "2614:15:23", + "nodeType": "YulAssignment", + "src": "2614:15:23", + "value": { + "name": "value", + "nativeSrc": "2624:5:23", + "nodeType": "YulIdentifier", + "src": "2624:5:23" + }, + "variableNames": [ + { + "name": "value1", + "nativeSrc": "2614:6:23", + "nodeType": "YulIdentifier", + "src": "2614:6:23" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_addresst_uint256", + "nativeSrc": "2335:300:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "2380:9:23", + "nodeType": "YulTypedName", + "src": "2380:9:23", + "type": "" + }, + { + "name": "dataEnd", + "nativeSrc": "2391:7:23", + "nodeType": "YulTypedName", + "src": "2391:7:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nativeSrc": "2403:6:23", + "nodeType": "YulTypedName", + "src": "2403:6:23", + "type": "" + }, + { + "name": "value1", + "nativeSrc": "2411:6:23", + "nodeType": "YulTypedName", + "src": "2411:6:23", + "type": "" + } + ], + "src": "2335:300:23" + }, + { + "body": { + "nativeSrc": "2735:92:23", + "nodeType": "YulBlock", + "src": "2735:92:23", + "statements": [ + { + "nativeSrc": "2745:26:23", + "nodeType": "YulAssignment", + "src": "2745:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "2757:9:23", + "nodeType": "YulIdentifier", + "src": "2757:9:23" + }, + { + "kind": "number", + "nativeSrc": "2768:2:23", + "nodeType": "YulLiteral", + "src": "2768:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2753:3:23", + "nodeType": "YulIdentifier", + "src": "2753:3:23" + }, + "nativeSrc": "2753:18:23", + "nodeType": "YulFunctionCall", + "src": "2753:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "2745:4:23", + "nodeType": "YulIdentifier", + "src": "2745:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "2787:9:23", + "nodeType": "YulIdentifier", + "src": "2787:9:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "value0", + "nativeSrc": "2812:6:23", + "nodeType": "YulIdentifier", + "src": "2812:6:23" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "2805:6:23", + "nodeType": "YulIdentifier", + "src": "2805:6:23" + }, + "nativeSrc": "2805:14:23", + "nodeType": "YulFunctionCall", + "src": "2805:14:23" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "2798:6:23", + "nodeType": "YulIdentifier", + "src": "2798:6:23" + }, + "nativeSrc": "2798:22:23", + "nodeType": "YulFunctionCall", + "src": "2798:22:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "2780:6:23", + "nodeType": "YulIdentifier", + "src": "2780:6:23" + }, + "nativeSrc": "2780:41:23", + "nodeType": "YulFunctionCall", + "src": "2780:41:23" + }, + "nativeSrc": "2780:41:23", + "nodeType": "YulExpressionStatement", + "src": "2780:41:23" + } + ] + }, + "name": "abi_encode_tuple_t_bool__to_t_bool__fromStack_reversed", + "nativeSrc": "2640:187:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "2704:9:23", + "nodeType": "YulTypedName", + "src": "2704:9:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "2715:6:23", + "nodeType": "YulTypedName", + "src": "2715:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "2726:4:23", + "nodeType": "YulTypedName", + "src": "2726:4:23", + "type": "" + } + ], + "src": "2640:187:23" + }, + { + "body": { + "nativeSrc": "2902:156:23", + "nodeType": "YulBlock", + "src": "2902:156:23", + "statements": [ + { + "body": { + "nativeSrc": "2948:16:23", + "nodeType": "YulBlock", + "src": "2948:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2957:1:23", + "nodeType": "YulLiteral", + "src": "2957:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "2960:1:23", + "nodeType": "YulLiteral", + "src": "2960:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "2950:6:23", + "nodeType": "YulIdentifier", + "src": "2950:6:23" + }, + "nativeSrc": "2950:12:23", + "nodeType": "YulFunctionCall", + "src": "2950:12:23" + }, + "nativeSrc": "2950:12:23", + "nodeType": "YulExpressionStatement", + "src": "2950:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nativeSrc": "2923:7:23", + "nodeType": "YulIdentifier", + "src": "2923:7:23" + }, + { + "name": "headStart", + "nativeSrc": "2932:9:23", + "nodeType": "YulIdentifier", + "src": "2932:9:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "2919:3:23", + "nodeType": "YulIdentifier", + "src": "2919:3:23" + }, + "nativeSrc": "2919:23:23", + "nodeType": "YulFunctionCall", + "src": "2919:23:23" + }, + { + "kind": "number", + "nativeSrc": "2944:2:23", + "nodeType": "YulLiteral", + "src": "2944:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nativeSrc": "2915:3:23", + "nodeType": "YulIdentifier", + "src": "2915:3:23" + }, + "nativeSrc": "2915:32:23", + "nodeType": "YulFunctionCall", + "src": "2915:32:23" + }, + "nativeSrc": "2912:52:23", + "nodeType": "YulIf", + "src": "2912:52:23" + }, + { + "nativeSrc": "2973:14:23", + "nodeType": "YulVariableDeclaration", + "src": "2973:14:23", + "value": { + "kind": "number", + "nativeSrc": "2986:1:23", + "nodeType": "YulLiteral", + "src": "2986:1:23", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "value", + "nativeSrc": "2977:5:23", + "nodeType": "YulTypedName", + "src": "2977:5:23", + "type": "" + } + ] + }, + { + "nativeSrc": "2996:32:23", + "nodeType": "YulAssignment", + "src": "2996:32:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3018:9:23", + "nodeType": "YulIdentifier", + "src": "3018:9:23" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "3005:12:23", + "nodeType": "YulIdentifier", + "src": "3005:12:23" + }, + "nativeSrc": "3005:23:23", + "nodeType": "YulFunctionCall", + "src": "3005:23:23" + }, + "variableNames": [ + { + "name": "value", + "nativeSrc": "2996:5:23", + "nodeType": "YulIdentifier", + "src": "2996:5:23" + } + ] + }, + { + "nativeSrc": "3037:15:23", + "nodeType": "YulAssignment", + "src": "3037:15:23", + "value": { + "name": "value", + "nativeSrc": "3047:5:23", + "nodeType": "YulIdentifier", + "src": "3047:5:23" + }, + "variableNames": [ + { + "name": "value0", + "nativeSrc": "3037:6:23", + "nodeType": "YulIdentifier", + "src": "3037:6:23" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_uint256", + "nativeSrc": "2832:226:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "2868:9:23", + "nodeType": "YulTypedName", + "src": "2868:9:23", + "type": "" + }, + { + "name": "dataEnd", + "nativeSrc": "2879:7:23", + "nodeType": "YulTypedName", + "src": "2879:7:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nativeSrc": "2891:6:23", + "nodeType": "YulTypedName", + "src": "2891:6:23", + "type": "" + } + ], + "src": "2832:226:23" + }, + { + "body": { + "nativeSrc": "3133:116:23", + "nodeType": "YulBlock", + "src": "3133:116:23", + "statements": [ + { + "body": { + "nativeSrc": "3179:16:23", + "nodeType": "YulBlock", + "src": "3179:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3188:1:23", + "nodeType": "YulLiteral", + "src": "3188:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "3191:1:23", + "nodeType": "YulLiteral", + "src": "3191:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "3181:6:23", + "nodeType": "YulIdentifier", + "src": "3181:6:23" + }, + "nativeSrc": "3181:12:23", + "nodeType": "YulFunctionCall", + "src": "3181:12:23" + }, + "nativeSrc": "3181:12:23", + "nodeType": "YulExpressionStatement", + "src": "3181:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nativeSrc": "3154:7:23", + "nodeType": "YulIdentifier", + "src": "3154:7:23" + }, + { + "name": "headStart", + "nativeSrc": "3163:9:23", + "nodeType": "YulIdentifier", + "src": "3163:9:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "3150:3:23", + "nodeType": "YulIdentifier", + "src": "3150:3:23" + }, + "nativeSrc": "3150:23:23", + "nodeType": "YulFunctionCall", + "src": "3150:23:23" + }, + { + "kind": "number", + "nativeSrc": "3175:2:23", + "nodeType": "YulLiteral", + "src": "3175:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nativeSrc": "3146:3:23", + "nodeType": "YulIdentifier", + "src": "3146:3:23" + }, + "nativeSrc": "3146:32:23", + "nodeType": "YulFunctionCall", + "src": "3146:32:23" + }, + "nativeSrc": "3143:52:23", + "nodeType": "YulIf", + "src": "3143:52:23" + }, + { + "nativeSrc": "3204:39:23", + "nodeType": "YulAssignment", + "src": "3204:39:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3233:9:23", + "nodeType": "YulIdentifier", + "src": "3233:9:23" + } + ], + "functionName": { + "name": "abi_decode_address", + "nativeSrc": "3214:18:23", + "nodeType": "YulIdentifier", + "src": "3214:18:23" + }, + "nativeSrc": "3214:29:23", + "nodeType": "YulFunctionCall", + "src": "3214:29:23" + }, + "variableNames": [ + { + "name": "value0", + "nativeSrc": "3204:6:23", + "nodeType": "YulIdentifier", + "src": "3204:6:23" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_address", + "nativeSrc": "3063:186:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "3099:9:23", + "nodeType": "YulTypedName", + "src": "3099:9:23", + "type": "" + }, + { + "name": "dataEnd", + "nativeSrc": "3110:7:23", + "nodeType": "YulTypedName", + "src": "3110:7:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nativeSrc": "3122:6:23", + "nodeType": "YulTypedName", + "src": "3122:6:23", + "type": "" + } + ], + "src": "3063:186:23" + }, + { + "body": { + "nativeSrc": "3428:163:23", + "nodeType": "YulBlock", + "src": "3428:163:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3445:9:23", + "nodeType": "YulIdentifier", + "src": "3445:9:23" + }, + { + "kind": "number", + "nativeSrc": "3456:2:23", + "nodeType": "YulLiteral", + "src": "3456:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3438:6:23", + "nodeType": "YulIdentifier", + "src": "3438:6:23" + }, + "nativeSrc": "3438:21:23", + "nodeType": "YulFunctionCall", + "src": "3438:21:23" + }, + "nativeSrc": "3438:21:23", + "nodeType": "YulExpressionStatement", + "src": "3438:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3479:9:23", + "nodeType": "YulIdentifier", + "src": "3479:9:23" + }, + { + "kind": "number", + "nativeSrc": "3490:2:23", + "nodeType": "YulLiteral", + "src": "3490:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3475:3:23", + "nodeType": "YulIdentifier", + "src": "3475:3:23" + }, + "nativeSrc": "3475:18:23", + "nodeType": "YulFunctionCall", + "src": "3475:18:23" + }, + { + "kind": "number", + "nativeSrc": "3495:2:23", + "nodeType": "YulLiteral", + "src": "3495:2:23", + "type": "", + "value": "13" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3468:6:23", + "nodeType": "YulIdentifier", + "src": "3468:6:23" + }, + "nativeSrc": "3468:30:23", + "nodeType": "YulFunctionCall", + "src": "3468:30:23" + }, + "nativeSrc": "3468:30:23", + "nodeType": "YulExpressionStatement", + "src": "3468:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3518:9:23", + "nodeType": "YulIdentifier", + "src": "3518:9:23" + }, + { + "kind": "number", + "nativeSrc": "3529:2:23", + "nodeType": "YulLiteral", + "src": "3529:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3514:3:23", + "nodeType": "YulIdentifier", + "src": "3514:3:23" + }, + "nativeSrc": "3514:18:23", + "nodeType": "YulFunctionCall", + "src": "3514:18:23" + }, + { + "hexValue": "496e76616c6964206f776e6572", + "kind": "string", + "nativeSrc": "3534:15:23", + "nodeType": "YulLiteral", + "src": "3534:15:23", + "type": "", + "value": "Invalid owner" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3507:6:23", + "nodeType": "YulIdentifier", + "src": "3507:6:23" + }, + "nativeSrc": "3507:43:23", + "nodeType": "YulFunctionCall", + "src": "3507:43:23" + }, + "nativeSrc": "3507:43:23", + "nodeType": "YulExpressionStatement", + "src": "3507:43:23" + }, + { + "nativeSrc": "3559:26:23", + "nodeType": "YulAssignment", + "src": "3559:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3571:9:23", + "nodeType": "YulIdentifier", + "src": "3571:9:23" + }, + { + "kind": "number", + "nativeSrc": "3582:2:23", + "nodeType": "YulLiteral", + "src": "3582:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3567:3:23", + "nodeType": "YulIdentifier", + "src": "3567:3:23" + }, + "nativeSrc": "3567:18:23", + "nodeType": "YulFunctionCall", + "src": "3567:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "3559:4:23", + "nodeType": "YulIdentifier", + "src": "3559:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_110461b12e459dc76e692e7a47f9621cf45c7d48020c3c7b2066107cdf1f52ae__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "3254:337:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "3405:9:23", + "nodeType": "YulTypedName", + "src": "3405:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "3419:4:23", + "nodeType": "YulTypedName", + "src": "3419:4:23", + "type": "" + } + ], + "src": "3254:337:23" + }, + { + "body": { + "nativeSrc": "3770:163:23", + "nodeType": "YulBlock", + "src": "3770:163:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3787:9:23", + "nodeType": "YulIdentifier", + "src": "3787:9:23" + }, + { + "kind": "number", + "nativeSrc": "3798:2:23", + "nodeType": "YulLiteral", + "src": "3798:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3780:6:23", + "nodeType": "YulIdentifier", + "src": "3780:6:23" + }, + "nativeSrc": "3780:21:23", + "nodeType": "YulFunctionCall", + "src": "3780:21:23" + }, + "nativeSrc": "3780:21:23", + "nodeType": "YulExpressionStatement", + "src": "3780:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3821:9:23", + "nodeType": "YulIdentifier", + "src": "3821:9:23" + }, + { + "kind": "number", + "nativeSrc": "3832:2:23", + "nodeType": "YulLiteral", + "src": "3832:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3817:3:23", + "nodeType": "YulIdentifier", + "src": "3817:3:23" + }, + "nativeSrc": "3817:18:23", + "nodeType": "YulFunctionCall", + "src": "3817:18:23" + }, + { + "kind": "number", + "nativeSrc": "3837:2:23", + "nodeType": "YulLiteral", + "src": "3837:2:23", + "type": "", + "value": "13" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3810:6:23", + "nodeType": "YulIdentifier", + "src": "3810:6:23" + }, + "nativeSrc": "3810:30:23", + "nodeType": "YulFunctionCall", + "src": "3810:30:23" + }, + "nativeSrc": "3810:30:23", + "nodeType": "YulExpressionStatement", + "src": "3810:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3860:9:23", + "nodeType": "YulIdentifier", + "src": "3860:9:23" + }, + { + "kind": "number", + "nativeSrc": "3871:2:23", + "nodeType": "YulLiteral", + "src": "3871:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3856:3:23", + "nodeType": "YulIdentifier", + "src": "3856:3:23" + }, + "nativeSrc": "3856:18:23", + "nodeType": "YulFunctionCall", + "src": "3856:18:23" + }, + { + "hexValue": "496e76616c696420746f6b656e", + "kind": "string", + "nativeSrc": "3876:15:23", + "nodeType": "YulLiteral", + "src": "3876:15:23", + "type": "", + "value": "Invalid token" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3849:6:23", + "nodeType": "YulIdentifier", + "src": "3849:6:23" + }, + "nativeSrc": "3849:43:23", + "nodeType": "YulFunctionCall", + "src": "3849:43:23" + }, + "nativeSrc": "3849:43:23", + "nodeType": "YulExpressionStatement", + "src": "3849:43:23" + }, + { + "nativeSrc": "3901:26:23", + "nodeType": "YulAssignment", + "src": "3901:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3913:9:23", + "nodeType": "YulIdentifier", + "src": "3913:9:23" + }, + { + "kind": "number", + "nativeSrc": "3924:2:23", + "nodeType": "YulLiteral", + "src": "3924:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3909:3:23", + "nodeType": "YulIdentifier", + "src": "3909:3:23" + }, + "nativeSrc": "3909:18:23", + "nodeType": "YulFunctionCall", + "src": "3909:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "3901:4:23", + "nodeType": "YulIdentifier", + "src": "3901:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_5e70ebd1d4072d337a7fabaa7bda70fa2633d6e3f89d5cb725a16b10d07e54c6__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "3596:337:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "3747:9:23", + "nodeType": "YulTypedName", + "src": "3747:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "3761:4:23", + "nodeType": "YulTypedName", + "src": "3761:4:23", + "type": "" + } + ], + "src": "3596:337:23" + }, + { + "body": { + "nativeSrc": "4112:160:23", + "nodeType": "YulBlock", + "src": "4112:160:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4129:9:23", + "nodeType": "YulIdentifier", + "src": "4129:9:23" + }, + { + "kind": "number", + "nativeSrc": "4140:2:23", + "nodeType": "YulLiteral", + "src": "4140:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4122:6:23", + "nodeType": "YulIdentifier", + "src": "4122:6:23" + }, + "nativeSrc": "4122:21:23", + "nodeType": "YulFunctionCall", + "src": "4122:21:23" + }, + "nativeSrc": "4122:21:23", + "nodeType": "YulExpressionStatement", + "src": "4122:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4163:9:23", + "nodeType": "YulIdentifier", + "src": "4163:9:23" + }, + { + "kind": "number", + "nativeSrc": "4174:2:23", + "nodeType": "YulLiteral", + "src": "4174:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4159:3:23", + "nodeType": "YulIdentifier", + "src": "4159:3:23" + }, + "nativeSrc": "4159:18:23", + "nodeType": "YulFunctionCall", + "src": "4159:18:23" + }, + { + "kind": "number", + "nativeSrc": "4179:2:23", + "nodeType": "YulLiteral", + "src": "4179:2:23", + "type": "", + "value": "10" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4152:6:23", + "nodeType": "YulIdentifier", + "src": "4152:6:23" + }, + "nativeSrc": "4152:30:23", + "nodeType": "YulFunctionCall", + "src": "4152:30:23" + }, + "nativeSrc": "4152:30:23", + "nodeType": "YulExpressionStatement", + "src": "4152:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4202:9:23", + "nodeType": "YulIdentifier", + "src": "4202:9:23" + }, + { + "kind": "number", + "nativeSrc": "4213:2:23", + "nodeType": "YulLiteral", + "src": "4213:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4198:3:23", + "nodeType": "YulIdentifier", + "src": "4198:3:23" + }, + "nativeSrc": "4198:18:23", + "nodeType": "YulFunctionCall", + "src": "4198:18:23" + }, + { + "hexValue": "4e6f6e63652075736564", + "kind": "string", + "nativeSrc": "4218:12:23", + "nodeType": "YulLiteral", + "src": "4218:12:23", + "type": "", + "value": "Nonce used" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4191:6:23", + "nodeType": "YulIdentifier", + "src": "4191:6:23" + }, + "nativeSrc": "4191:40:23", + "nodeType": "YulFunctionCall", + "src": "4191:40:23" + }, + "nativeSrc": "4191:40:23", + "nodeType": "YulExpressionStatement", + "src": "4191:40:23" + }, + { + "nativeSrc": "4240:26:23", + "nodeType": "YulAssignment", + "src": "4240:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4252:9:23", + "nodeType": "YulIdentifier", + "src": "4252:9:23" + }, + { + "kind": "number", + "nativeSrc": "4263:2:23", + "nodeType": "YulLiteral", + "src": "4263:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4248:3:23", + "nodeType": "YulIdentifier", + "src": "4248:3:23" + }, + "nativeSrc": "4248:18:23", + "nodeType": "YulFunctionCall", + "src": "4248:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "4240:4:23", + "nodeType": "YulIdentifier", + "src": "4240:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_15d72127d094a30af360ead73641c61eda3d745ce4d04d12675a5e9a899f8b21__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "3938:334:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "4089:9:23", + "nodeType": "YulTypedName", + "src": "4089:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "4103:4:23", + "nodeType": "YulTypedName", + "src": "4103:4:23", + "type": "" + } + ], + "src": "3938:334:23" + }, + { + "body": { + "nativeSrc": "4451:165:23", + "nodeType": "YulBlock", + "src": "4451:165:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4468:9:23", + "nodeType": "YulIdentifier", + "src": "4468:9:23" + }, + { + "kind": "number", + "nativeSrc": "4479:2:23", + "nodeType": "YulLiteral", + "src": "4479:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4461:6:23", + "nodeType": "YulIdentifier", + "src": "4461:6:23" + }, + "nativeSrc": "4461:21:23", + "nodeType": "YulFunctionCall", + "src": "4461:21:23" + }, + "nativeSrc": "4461:21:23", + "nodeType": "YulExpressionStatement", + "src": "4461:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4502:9:23", + "nodeType": "YulIdentifier", + "src": "4502:9:23" + }, + { + "kind": "number", + "nativeSrc": "4513:2:23", + "nodeType": "YulLiteral", + "src": "4513:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4498:3:23", + "nodeType": "YulIdentifier", + "src": "4498:3:23" + }, + "nativeSrc": "4498:18:23", + "nodeType": "YulFunctionCall", + "src": "4498:18:23" + }, + { + "kind": "number", + "nativeSrc": "4518:2:23", + "nodeType": "YulLiteral", + "src": "4518:2:23", + "type": "", + "value": "15" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4491:6:23", + "nodeType": "YulIdentifier", + "src": "4491:6:23" + }, + "nativeSrc": "4491:30:23", + "nodeType": "YulFunctionCall", + "src": "4491:30:23" + }, + "nativeSrc": "4491:30:23", + "nodeType": "YulExpressionStatement", + "src": "4491:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4541:9:23", + "nodeType": "YulIdentifier", + "src": "4541:9:23" + }, + { + "kind": "number", + "nativeSrc": "4552:2:23", + "nodeType": "YulLiteral", + "src": "4552:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4537:3:23", + "nodeType": "YulIdentifier", + "src": "4537:3:23" + }, + "nativeSrc": "4537:18:23", + "nodeType": "YulFunctionCall", + "src": "4537:18:23" + }, + { + "hexValue": "5061796c6f61642065787069726564", + "kind": "string", + "nativeSrc": "4557:17:23", + "nodeType": "YulLiteral", + "src": "4557:17:23", + "type": "", + "value": "Payload expired" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4530:6:23", + "nodeType": "YulIdentifier", + "src": "4530:6:23" + }, + "nativeSrc": "4530:45:23", + "nodeType": "YulFunctionCall", + "src": "4530:45:23" + }, + "nativeSrc": "4530:45:23", + "nodeType": "YulExpressionStatement", + "src": "4530:45:23" + }, + { + "nativeSrc": "4584:26:23", + "nodeType": "YulAssignment", + "src": "4584:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4596:9:23", + "nodeType": "YulIdentifier", + "src": "4596:9:23" + }, + { + "kind": "number", + "nativeSrc": "4607:2:23", + "nodeType": "YulLiteral", + "src": "4607:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4592:3:23", + "nodeType": "YulIdentifier", + "src": "4592:3:23" + }, + "nativeSrc": "4592:18:23", + "nodeType": "YulFunctionCall", + "src": "4592:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "4584:4:23", + "nodeType": "YulIdentifier", + "src": "4584:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_27859e47e6c2167c8e8d38addfca16b9afb9d8e9750b6a1e67c29196d4d99fae__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "4277:339:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "4428:9:23", + "nodeType": "YulTypedName", + "src": "4428:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "4442:4:23", + "nodeType": "YulTypedName", + "src": "4442:4:23", + "type": "" + } + ], + "src": "4277:339:23" + }, + { + "body": { + "nativeSrc": "4715:427:23", + "nodeType": "YulBlock", + "src": "4715:427:23", + "statements": [ + { + "nativeSrc": "4725:51:23", + "nodeType": "YulVariableDeclaration", + "src": "4725:51:23", + "value": { + "arguments": [ + { + "name": "ptr_to_tail", + "nativeSrc": "4764:11:23", + "nodeType": "YulIdentifier", + "src": "4764:11:23" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "4751:12:23", + "nodeType": "YulIdentifier", + "src": "4751:12:23" + }, + "nativeSrc": "4751:25:23", + "nodeType": "YulFunctionCall", + "src": "4751:25:23" + }, + "variables": [ + { + "name": "rel_offset_of_tail", + "nativeSrc": "4729:18:23", + "nodeType": "YulTypedName", + "src": "4729:18:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "4865:16:23", + "nodeType": "YulBlock", + "src": "4865:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "4874:1:23", + "nodeType": "YulLiteral", + "src": "4874:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "4877:1:23", + "nodeType": "YulLiteral", + "src": "4877:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "4867:6:23", + "nodeType": "YulIdentifier", + "src": "4867:6:23" + }, + "nativeSrc": "4867:12:23", + "nodeType": "YulFunctionCall", + "src": "4867:12:23" + }, + "nativeSrc": "4867:12:23", + "nodeType": "YulExpressionStatement", + "src": "4867:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "rel_offset_of_tail", + "nativeSrc": "4799:18:23", + "nodeType": "YulIdentifier", + "src": "4799:18:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "calldatasize", + "nativeSrc": "4827:12:23", + "nodeType": "YulIdentifier", + "src": "4827:12:23" + }, + "nativeSrc": "4827:14:23", + "nodeType": "YulFunctionCall", + "src": "4827:14:23" + }, + { + "name": "base_ref", + "nativeSrc": "4843:8:23", + "nodeType": "YulIdentifier", + "src": "4843:8:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "4823:3:23", + "nodeType": "YulIdentifier", + "src": "4823:3:23" + }, + "nativeSrc": "4823:29:23", + "nodeType": "YulFunctionCall", + "src": "4823:29:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "4858:2:23", + "nodeType": "YulLiteral", + "src": "4858:2:23", + "type": "", + "value": "30" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "4854:3:23", + "nodeType": "YulIdentifier", + "src": "4854:3:23" + }, + "nativeSrc": "4854:7:23", + "nodeType": "YulFunctionCall", + "src": "4854:7:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4819:3:23", + "nodeType": "YulIdentifier", + "src": "4819:3:23" + }, + "nativeSrc": "4819:43:23", + "nodeType": "YulFunctionCall", + "src": "4819:43:23" + } + ], + "functionName": { + "name": "slt", + "nativeSrc": "4795:3:23", + "nodeType": "YulIdentifier", + "src": "4795:3:23" + }, + "nativeSrc": "4795:68:23", + "nodeType": "YulFunctionCall", + "src": "4795:68:23" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "4788:6:23", + "nodeType": "YulIdentifier", + "src": "4788:6:23" + }, + "nativeSrc": "4788:76:23", + "nodeType": "YulFunctionCall", + "src": "4788:76:23" + }, + "nativeSrc": "4785:96:23", + "nodeType": "YulIf", + "src": "4785:96:23" + }, + { + "nativeSrc": "4890:47:23", + "nodeType": "YulVariableDeclaration", + "src": "4890:47:23", + "value": { + "arguments": [ + { + "name": "base_ref", + "nativeSrc": "4908:8:23", + "nodeType": "YulIdentifier", + "src": "4908:8:23" + }, + { + "name": "rel_offset_of_tail", + "nativeSrc": "4918:18:23", + "nodeType": "YulIdentifier", + "src": "4918:18:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4904:3:23", + "nodeType": "YulIdentifier", + "src": "4904:3:23" + }, + "nativeSrc": "4904:33:23", + "nodeType": "YulFunctionCall", + "src": "4904:33:23" + }, + "variables": [ + { + "name": "addr_1", + "nativeSrc": "4894:6:23", + "nodeType": "YulTypedName", + "src": "4894:6:23", + "type": "" + } + ] + }, + { + "nativeSrc": "4946:30:23", + "nodeType": "YulAssignment", + "src": "4946:30:23", + "value": { + "arguments": [ + { + "name": "addr_1", + "nativeSrc": "4969:6:23", + "nodeType": "YulIdentifier", + "src": "4969:6:23" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "4956:12:23", + "nodeType": "YulIdentifier", + "src": "4956:12:23" + }, + "nativeSrc": "4956:20:23", + "nodeType": "YulFunctionCall", + "src": "4956:20:23" + }, + "variableNames": [ + { + "name": "length", + "nativeSrc": "4946:6:23", + "nodeType": "YulIdentifier", + "src": "4946:6:23" + } + ] + }, + { + "body": { + "nativeSrc": "5019:16:23", + "nodeType": "YulBlock", + "src": "5019:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "5028:1:23", + "nodeType": "YulLiteral", + "src": "5028:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "5031:1:23", + "nodeType": "YulLiteral", + "src": "5031:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "5021:6:23", + "nodeType": "YulIdentifier", + "src": "5021:6:23" + }, + "nativeSrc": "5021:12:23", + "nodeType": "YulFunctionCall", + "src": "5021:12:23" + }, + "nativeSrc": "5021:12:23", + "nodeType": "YulExpressionStatement", + "src": "5021:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "length", + "nativeSrc": "4991:6:23", + "nodeType": "YulIdentifier", + "src": "4991:6:23" + }, + { + "kind": "number", + "nativeSrc": "4999:18:23", + "nodeType": "YulLiteral", + "src": "4999:18:23", + "type": "", + "value": "0xffffffffffffffff" + } + ], + "functionName": { + "name": "gt", + "nativeSrc": "4988:2:23", + "nodeType": "YulIdentifier", + "src": "4988:2:23" + }, + "nativeSrc": "4988:30:23", + "nodeType": "YulFunctionCall", + "src": "4988:30:23" + }, + "nativeSrc": "4985:50:23", + "nodeType": "YulIf", + "src": "4985:50:23" + }, + { + "nativeSrc": "5044:25:23", + "nodeType": "YulAssignment", + "src": "5044:25:23", + "value": { + "arguments": [ + { + "name": "addr_1", + "nativeSrc": "5056:6:23", + "nodeType": "YulIdentifier", + "src": "5056:6:23" + }, + { + "kind": "number", + "nativeSrc": "5064:4:23", + "nodeType": "YulLiteral", + "src": "5064:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "5052:3:23", + "nodeType": "YulIdentifier", + "src": "5052:3:23" + }, + "nativeSrc": "5052:17:23", + "nodeType": "YulFunctionCall", + "src": "5052:17:23" + }, + "variableNames": [ + { + "name": "addr", + "nativeSrc": "5044:4:23", + "nodeType": "YulIdentifier", + "src": "5044:4:23" + } + ] + }, + { + "body": { + "nativeSrc": "5120:16:23", + "nodeType": "YulBlock", + "src": "5120:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "5129:1:23", + "nodeType": "YulLiteral", + "src": "5129:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "5132:1:23", + "nodeType": "YulLiteral", + "src": "5132:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "5122:6:23", + "nodeType": "YulIdentifier", + "src": "5122:6:23" + }, + "nativeSrc": "5122:12:23", + "nodeType": "YulFunctionCall", + "src": "5122:12:23" + }, + "nativeSrc": "5122:12:23", + "nodeType": "YulExpressionStatement", + "src": "5122:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "addr", + "nativeSrc": "5085:4:23", + "nodeType": "YulIdentifier", + "src": "5085:4:23" + }, + { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "calldatasize", + "nativeSrc": "5095:12:23", + "nodeType": "YulIdentifier", + "src": "5095:12:23" + }, + "nativeSrc": "5095:14:23", + "nodeType": "YulFunctionCall", + "src": "5095:14:23" + }, + { + "name": "length", + "nativeSrc": "5111:6:23", + "nodeType": "YulIdentifier", + "src": "5111:6:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "5091:3:23", + "nodeType": "YulIdentifier", + "src": "5091:3:23" + }, + "nativeSrc": "5091:27:23", + "nodeType": "YulFunctionCall", + "src": "5091:27:23" + } + ], + "functionName": { + "name": "sgt", + "nativeSrc": "5081:3:23", + "nodeType": "YulIdentifier", + "src": "5081:3:23" + }, + "nativeSrc": "5081:38:23", + "nodeType": "YulFunctionCall", + "src": "5081:38:23" + }, + "nativeSrc": "5078:58:23", + "nodeType": "YulIf", + "src": "5078:58:23" + } + ] + }, + "name": "access_calldata_tail_t_bytes_calldata_ptr", + "nativeSrc": "4621:521:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "base_ref", + "nativeSrc": "4672:8:23", + "nodeType": "YulTypedName", + "src": "4672:8:23", + "type": "" + }, + { + "name": "ptr_to_tail", + "nativeSrc": "4682:11:23", + "nodeType": "YulTypedName", + "src": "4682:11:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "addr", + "nativeSrc": "4698:4:23", + "nodeType": "YulTypedName", + "src": "4698:4:23", + "type": "" + }, + { + "name": "length", + "nativeSrc": "4704:6:23", + "nodeType": "YulTypedName", + "src": "4704:6:23", + "type": "" + } + ], + "src": "4621:521:23" + }, + { + "body": { + "nativeSrc": "5215:201:23", + "nodeType": "YulBlock", + "src": "5215:201:23", + "statements": [ + { + "body": { + "nativeSrc": "5261:16:23", + "nodeType": "YulBlock", + "src": "5261:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "5270:1:23", + "nodeType": "YulLiteral", + "src": "5270:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "5273:1:23", + "nodeType": "YulLiteral", + "src": "5273:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "5263:6:23", + "nodeType": "YulIdentifier", + "src": "5263:6:23" + }, + "nativeSrc": "5263:12:23", + "nodeType": "YulFunctionCall", + "src": "5263:12:23" + }, + "nativeSrc": "5263:12:23", + "nodeType": "YulExpressionStatement", + "src": "5263:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nativeSrc": "5236:7:23", + "nodeType": "YulIdentifier", + "src": "5236:7:23" + }, + { + "name": "headStart", + "nativeSrc": "5245:9:23", + "nodeType": "YulIdentifier", + "src": "5245:9:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "5232:3:23", + "nodeType": "YulIdentifier", + "src": "5232:3:23" + }, + "nativeSrc": "5232:23:23", + "nodeType": "YulFunctionCall", + "src": "5232:23:23" + }, + { + "kind": "number", + "nativeSrc": "5257:2:23", + "nodeType": "YulLiteral", + "src": "5257:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nativeSrc": "5228:3:23", + "nodeType": "YulIdentifier", + "src": "5228:3:23" + }, + "nativeSrc": "5228:32:23", + "nodeType": "YulFunctionCall", + "src": "5228:32:23" + }, + "nativeSrc": "5225:52:23", + "nodeType": "YulIf", + "src": "5225:52:23" + }, + { + "nativeSrc": "5286:36:23", + "nodeType": "YulVariableDeclaration", + "src": "5286:36:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "5312:9:23", + "nodeType": "YulIdentifier", + "src": "5312:9:23" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "5299:12:23", + "nodeType": "YulIdentifier", + "src": "5299:12:23" + }, + "nativeSrc": "5299:23:23", + "nodeType": "YulFunctionCall", + "src": "5299:23:23" + }, + "variables": [ + { + "name": "value", + "nativeSrc": "5290:5:23", + "nodeType": "YulTypedName", + "src": "5290:5:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "5370:16:23", + "nodeType": "YulBlock", + "src": "5370:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "5379:1:23", + "nodeType": "YulLiteral", + "src": "5379:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "5382:1:23", + "nodeType": "YulLiteral", + "src": "5382:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "5372:6:23", + "nodeType": "YulIdentifier", + "src": "5372:6:23" + }, + "nativeSrc": "5372:12:23", + "nodeType": "YulFunctionCall", + "src": "5372:12:23" + }, + "nativeSrc": "5372:12:23", + "nodeType": "YulExpressionStatement", + "src": "5372:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nativeSrc": "5344:5:23", + "nodeType": "YulIdentifier", + "src": "5344:5:23" + }, + { + "arguments": [ + { + "name": "value", + "nativeSrc": "5355:5:23", + "nodeType": "YulIdentifier", + "src": "5355:5:23" + }, + { + "kind": "number", + "nativeSrc": "5362:4:23", + "nodeType": "YulLiteral", + "src": "5362:4:23", + "type": "", + "value": "0xff" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "5351:3:23", + "nodeType": "YulIdentifier", + "src": "5351:3:23" + }, + "nativeSrc": "5351:16:23", + "nodeType": "YulFunctionCall", + "src": "5351:16:23" + } + ], + "functionName": { + "name": "eq", + "nativeSrc": "5341:2:23", + "nodeType": "YulIdentifier", + "src": "5341:2:23" + }, + "nativeSrc": "5341:27:23", + "nodeType": "YulFunctionCall", + "src": "5341:27:23" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "5334:6:23", + "nodeType": "YulIdentifier", + "src": "5334:6:23" + }, + "nativeSrc": "5334:35:23", + "nodeType": "YulFunctionCall", + "src": "5334:35:23" + }, + "nativeSrc": "5331:55:23", + "nodeType": "YulIf", + "src": "5331:55:23" + }, + { + "nativeSrc": "5395:15:23", + "nodeType": "YulAssignment", + "src": "5395:15:23", + "value": { + "name": "value", + "nativeSrc": "5405:5:23", + "nodeType": "YulIdentifier", + "src": "5405:5:23" + }, + "variableNames": [ + { + "name": "value0", + "nativeSrc": "5395:6:23", + "nodeType": "YulIdentifier", + "src": "5395:6:23" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_uint8", + "nativeSrc": "5147:269:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "5181:9:23", + "nodeType": "YulTypedName", + "src": "5181:9:23", + "type": "" + }, + { + "name": "dataEnd", + "nativeSrc": "5192:7:23", + "nodeType": "YulTypedName", + "src": "5192:7:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nativeSrc": "5204:6:23", + "nodeType": "YulTypedName", + "src": "5204:6:23", + "type": "" + } + ], + "src": "5147:269:23" + }, + { + "body": { + "nativeSrc": "5595:161:23", + "nodeType": "YulBlock", + "src": "5595:161:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "5612:9:23", + "nodeType": "YulIdentifier", + "src": "5612:9:23" + }, + { + "kind": "number", + "nativeSrc": "5623:2:23", + "nodeType": "YulLiteral", + "src": "5623:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "5605:6:23", + "nodeType": "YulIdentifier", + "src": "5605:6:23" + }, + "nativeSrc": "5605:21:23", + "nodeType": "YulFunctionCall", + "src": "5605:21:23" + }, + "nativeSrc": "5605:21:23", + "nodeType": "YulExpressionStatement", + "src": "5605:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "5646:9:23", + "nodeType": "YulIdentifier", + "src": "5646:9:23" + }, + { + "kind": "number", + "nativeSrc": "5657:2:23", + "nodeType": "YulLiteral", + "src": "5657:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "5642:3:23", + "nodeType": "YulIdentifier", + "src": "5642:3:23" + }, + "nativeSrc": "5642:18:23", + "nodeType": "YulFunctionCall", + "src": "5642:18:23" + }, + { + "kind": "number", + "nativeSrc": "5662:2:23", + "nodeType": "YulLiteral", + "src": "5662:2:23", + "type": "", + "value": "11" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "5635:6:23", + "nodeType": "YulIdentifier", + "src": "5635:6:23" + }, + "nativeSrc": "5635:30:23", + "nodeType": "YulFunctionCall", + "src": "5635:30:23" + }, + "nativeSrc": "5635:30:23", + "nodeType": "YulExpressionStatement", + "src": "5635:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "5685:9:23", + "nodeType": "YulIdentifier", + "src": "5685:9:23" + }, + { + "kind": "number", + "nativeSrc": "5696:2:23", + "nodeType": "YulLiteral", + "src": "5696:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "5681:3:23", + "nodeType": "YulIdentifier", + "src": "5681:3:23" + }, + "nativeSrc": "5681:18:23", + "nodeType": "YulFunctionCall", + "src": "5681:18:23" + }, + { + "hexValue": "496e76616c696420736967", + "kind": "string", + "nativeSrc": "5701:13:23", + "nodeType": "YulLiteral", + "src": "5701:13:23", + "type": "", + "value": "Invalid sig" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "5674:6:23", + "nodeType": "YulIdentifier", + "src": "5674:6:23" + }, + "nativeSrc": "5674:41:23", + "nodeType": "YulFunctionCall", + "src": "5674:41:23" + }, + "nativeSrc": "5674:41:23", + "nodeType": "YulExpressionStatement", + "src": "5674:41:23" + }, + { + "nativeSrc": "5724:26:23", + "nodeType": "YulAssignment", + "src": "5724:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "5736:9:23", + "nodeType": "YulIdentifier", + "src": "5736:9:23" + }, + { + "kind": "number", + "nativeSrc": "5747:2:23", + "nodeType": "YulLiteral", + "src": "5747:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "5732:3:23", + "nodeType": "YulIdentifier", + "src": "5732:3:23" + }, + "nativeSrc": "5732:18:23", + "nodeType": "YulFunctionCall", + "src": "5732:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "5724:4:23", + "nodeType": "YulIdentifier", + "src": "5724:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_31734eed34fab74fa1579246aaad104a344891a284044483c0c5a792a9f83a72__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "5421:335:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "5572:9:23", + "nodeType": "YulTypedName", + "src": "5572:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "5586:4:23", + "nodeType": "YulTypedName", + "src": "5586:4:23", + "type": "" + } + ], + "src": "5421:335:23" + }, + { + "body": { + "nativeSrc": "5935:178:23", + "nodeType": "YulBlock", + "src": "5935:178:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "5952:9:23", + "nodeType": "YulIdentifier", + "src": "5952:9:23" + }, + { + "kind": "number", + "nativeSrc": "5963:2:23", + "nodeType": "YulLiteral", + "src": "5963:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "5945:6:23", + "nodeType": "YulIdentifier", + "src": "5945:6:23" + }, + "nativeSrc": "5945:21:23", + "nodeType": "YulFunctionCall", + "src": "5945:21:23" + }, + "nativeSrc": "5945:21:23", + "nodeType": "YulExpressionStatement", + "src": "5945:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "5986:9:23", + "nodeType": "YulIdentifier", + "src": "5986:9:23" + }, + { + "kind": "number", + "nativeSrc": "5997:2:23", + "nodeType": "YulLiteral", + "src": "5997:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "5982:3:23", + "nodeType": "YulIdentifier", + "src": "5982:3:23" + }, + "nativeSrc": "5982:18:23", + "nodeType": "YulFunctionCall", + "src": "5982:18:23" + }, + { + "kind": "number", + "nativeSrc": "6002:2:23", + "nodeType": "YulLiteral", + "src": "6002:2:23", + "type": "", + "value": "28" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "5975:6:23", + "nodeType": "YulIdentifier", + "src": "5975:6:23" + }, + "nativeSrc": "5975:30:23", + "nodeType": "YulFunctionCall", + "src": "5975:30:23" + }, + "nativeSrc": "5975:30:23", + "nodeType": "YulExpressionStatement", + "src": "5975:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "6025:9:23", + "nodeType": "YulIdentifier", + "src": "6025:9:23" + }, + { + "kind": "number", + "nativeSrc": "6036:2:23", + "nodeType": "YulLiteral", + "src": "6036:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6021:3:23", + "nodeType": "YulIdentifier", + "src": "6021:3:23" + }, + "nativeSrc": "6021:18:23", + "nodeType": "YulFunctionCall", + "src": "6021:18:23" + }, + { + "hexValue": "496e636f7272656374204554482076616c75652070726f7669646564", + "kind": "string", + "nativeSrc": "6041:30:23", + "nodeType": "YulLiteral", + "src": "6041:30:23", + "type": "", + "value": "Incorrect ETH value provided" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6014:6:23", + "nodeType": "YulIdentifier", + "src": "6014:6:23" + }, + "nativeSrc": "6014:58:23", + "nodeType": "YulFunctionCall", + "src": "6014:58:23" + }, + "nativeSrc": "6014:58:23", + "nodeType": "YulExpressionStatement", + "src": "6014:58:23" + }, + { + "nativeSrc": "6081:26:23", + "nodeType": "YulAssignment", + "src": "6081:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "6093:9:23", + "nodeType": "YulIdentifier", + "src": "6093:9:23" + }, + { + "kind": "number", + "nativeSrc": "6104:2:23", + "nodeType": "YulLiteral", + "src": "6104:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6089:3:23", + "nodeType": "YulIdentifier", + "src": "6089:3:23" + }, + "nativeSrc": "6089:18:23", + "nodeType": "YulFunctionCall", + "src": "6089:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "6081:4:23", + "nodeType": "YulIdentifier", + "src": "6081:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_a793dc5bde52ab2d5349f1208a34905b1d68ab9298f549a2e514542cba0a8c76__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "5761:352:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "5912:9:23", + "nodeType": "YulTypedName", + "src": "5912:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "5926:4:23", + "nodeType": "YulTypedName", + "src": "5926:4:23", + "type": "" + } + ], + "src": "5761:352:23" + }, + { + "body": { + "nativeSrc": "6292:161:23", + "nodeType": "YulBlock", + "src": "6292:161:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "6309:9:23", + "nodeType": "YulIdentifier", + "src": "6309:9:23" + }, + { + "kind": "number", + "nativeSrc": "6320:2:23", + "nodeType": "YulLiteral", + "src": "6320:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6302:6:23", + "nodeType": "YulIdentifier", + "src": "6302:6:23" + }, + "nativeSrc": "6302:21:23", + "nodeType": "YulFunctionCall", + "src": "6302:21:23" + }, + "nativeSrc": "6302:21:23", + "nodeType": "YulExpressionStatement", + "src": "6302:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "6343:9:23", + "nodeType": "YulIdentifier", + "src": "6343:9:23" + }, + { + "kind": "number", + "nativeSrc": "6354:2:23", + "nodeType": "YulLiteral", + "src": "6354:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6339:3:23", + "nodeType": "YulIdentifier", + "src": "6339:3:23" + }, + "nativeSrc": "6339:18:23", + "nodeType": "YulFunctionCall", + "src": "6339:18:23" + }, + { + "kind": "number", + "nativeSrc": "6359:2:23", + "nodeType": "YulLiteral", + "src": "6359:2:23", + "type": "", + "value": "11" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6332:6:23", + "nodeType": "YulIdentifier", + "src": "6332:6:23" + }, + "nativeSrc": "6332:30:23", + "nodeType": "YulFunctionCall", + "src": "6332:30:23" + }, + "nativeSrc": "6332:30:23", + "nodeType": "YulExpressionStatement", + "src": "6332:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "6382:9:23", + "nodeType": "YulIdentifier", + "src": "6382:9:23" + }, + { + "kind": "number", + "nativeSrc": "6393:2:23", + "nodeType": "YulLiteral", + "src": "6393:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6378:3:23", + "nodeType": "YulIdentifier", + "src": "6378:3:23" + }, + "nativeSrc": "6378:18:23", + "nodeType": "YulFunctionCall", + "src": "6378:18:23" + }, + { + "hexValue": "43616c6c206661696c6564", + "kind": "string", + "nativeSrc": "6398:13:23", + "nodeType": "YulLiteral", + "src": "6398:13:23", + "type": "", + "value": "Call failed" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6371:6:23", + "nodeType": "YulIdentifier", + "src": "6371:6:23" + }, + "nativeSrc": "6371:41:23", + "nodeType": "YulFunctionCall", + "src": "6371:41:23" + }, + "nativeSrc": "6371:41:23", + "nodeType": "YulExpressionStatement", + "src": "6371:41:23" + }, + { + "nativeSrc": "6421:26:23", + "nodeType": "YulAssignment", + "src": "6421:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "6433:9:23", + "nodeType": "YulIdentifier", + "src": "6433:9:23" + }, + { + "kind": "number", + "nativeSrc": "6444:2:23", + "nodeType": "YulLiteral", + "src": "6444:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6429:3:23", + "nodeType": "YulIdentifier", + "src": "6429:3:23" + }, + "nativeSrc": "6429:18:23", + "nodeType": "YulFunctionCall", + "src": "6429:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "6421:4:23", + "nodeType": "YulIdentifier", + "src": "6421:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_066ad49a0ed9e5d6a9f3c20fca13a038f0a5d629f0aaf09d634ae2a7c232ac2b__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "6118:335:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "6269:9:23", + "nodeType": "YulTypedName", + "src": "6269:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "6283:4:23", + "nodeType": "YulTypedName", + "src": "6283:4:23", + "type": "" + } + ], + "src": "6118:335:23" + }, + { + "body": { + "nativeSrc": "6559:76:23", + "nodeType": "YulBlock", + "src": "6559:76:23", + "statements": [ + { + "nativeSrc": "6569:26:23", + "nodeType": "YulAssignment", + "src": "6569:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "6581:9:23", + "nodeType": "YulIdentifier", + "src": "6581:9:23" + }, + { + "kind": "number", + "nativeSrc": "6592:2:23", + "nodeType": "YulLiteral", + "src": "6592:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6577:3:23", + "nodeType": "YulIdentifier", + "src": "6577:3:23" + }, + "nativeSrc": "6577:18:23", + "nodeType": "YulFunctionCall", + "src": "6577:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "6569:4:23", + "nodeType": "YulIdentifier", + "src": "6569:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "6611:9:23", + "nodeType": "YulIdentifier", + "src": "6611:9:23" + }, + { + "name": "value0", + "nativeSrc": "6622:6:23", + "nodeType": "YulIdentifier", + "src": "6622:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6604:6:23", + "nodeType": "YulIdentifier", + "src": "6604:6:23" + }, + "nativeSrc": "6604:25:23", + "nodeType": "YulFunctionCall", + "src": "6604:25:23" + }, + "nativeSrc": "6604:25:23", + "nodeType": "YulExpressionStatement", + "src": "6604:25:23" + } + ] + }, + "name": "abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed", + "nativeSrc": "6458:177:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "6528:9:23", + "nodeType": "YulTypedName", + "src": "6528:9:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "6539:6:23", + "nodeType": "YulTypedName", + "src": "6539:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "6550:4:23", + "nodeType": "YulTypedName", + "src": "6550:4:23", + "type": "" + } + ], + "src": "6458:177:23" + }, + { + "body": { + "nativeSrc": "6672:95:23", + "nodeType": "YulBlock", + "src": "6672:95:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "6689:1:23", + "nodeType": "YulLiteral", + "src": "6689:1:23", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "6696:3:23", + "nodeType": "YulLiteral", + "src": "6696:3:23", + "type": "", + "value": "224" + }, + { + "kind": "number", + "nativeSrc": "6701:10:23", + "nodeType": "YulLiteral", + "src": "6701:10:23", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "6692:3:23", + "nodeType": "YulIdentifier", + "src": "6692:3:23" + }, + "nativeSrc": "6692:20:23", + "nodeType": "YulFunctionCall", + "src": "6692:20:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6682:6:23", + "nodeType": "YulIdentifier", + "src": "6682:6:23" + }, + "nativeSrc": "6682:31:23", + "nodeType": "YulFunctionCall", + "src": "6682:31:23" + }, + "nativeSrc": "6682:31:23", + "nodeType": "YulExpressionStatement", + "src": "6682:31:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "6729:1:23", + "nodeType": "YulLiteral", + "src": "6729:1:23", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nativeSrc": "6732:4:23", + "nodeType": "YulLiteral", + "src": "6732:4:23", + "type": "", + "value": "0x41" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6722:6:23", + "nodeType": "YulIdentifier", + "src": "6722:6:23" + }, + "nativeSrc": "6722:15:23", + "nodeType": "YulFunctionCall", + "src": "6722:15:23" + }, + "nativeSrc": "6722:15:23", + "nodeType": "YulExpressionStatement", + "src": "6722:15:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "6753:1:23", + "nodeType": "YulLiteral", + "src": "6753:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "6756:4:23", + "nodeType": "YulLiteral", + "src": "6756:4:23", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "6746:6:23", + "nodeType": "YulIdentifier", + "src": "6746:6:23" + }, + "nativeSrc": "6746:15:23", + "nodeType": "YulFunctionCall", + "src": "6746:15:23" + }, + "nativeSrc": "6746:15:23", + "nodeType": "YulExpressionStatement", + "src": "6746:15:23" + } + ] + }, + "name": "panic_error_0x41", + "nativeSrc": "6640:127:23", + "nodeType": "YulFunctionDefinition", + "src": "6640:127:23" + }, + { + "body": { + "nativeSrc": "6963:14:23", + "nodeType": "YulBlock", + "src": "6963:14:23", + "statements": [ + { + "nativeSrc": "6965:10:23", + "nodeType": "YulAssignment", + "src": "6965:10:23", + "value": { + "name": "pos", + "nativeSrc": "6972:3:23", + "nodeType": "YulIdentifier", + "src": "6972:3:23" + }, + "variableNames": [ + { + "name": "end", + "nativeSrc": "6965:3:23", + "nodeType": "YulIdentifier", + "src": "6965:3:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_packed_t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470__to_t_bytes_memory_ptr__nonPadded_inplace_fromStack_reversed", + "nativeSrc": "6772:205:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "pos", + "nativeSrc": "6947:3:23", + "nodeType": "YulTypedName", + "src": "6947:3:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nativeSrc": "6955:3:23", + "nodeType": "YulTypedName", + "src": "6955:3:23", + "type": "" + } + ], + "src": "6772:205:23" + }, + { + "body": { + "nativeSrc": "7156:169:23", + "nodeType": "YulBlock", + "src": "7156:169:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7173:9:23", + "nodeType": "YulIdentifier", + "src": "7173:9:23" + }, + { + "kind": "number", + "nativeSrc": "7184:2:23", + "nodeType": "YulLiteral", + "src": "7184:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7166:6:23", + "nodeType": "YulIdentifier", + "src": "7166:6:23" + }, + "nativeSrc": "7166:21:23", + "nodeType": "YulFunctionCall", + "src": "7166:21:23" + }, + "nativeSrc": "7166:21:23", + "nodeType": "YulExpressionStatement", + "src": "7166:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7207:9:23", + "nodeType": "YulIdentifier", + "src": "7207:9:23" + }, + { + "kind": "number", + "nativeSrc": "7218:2:23", + "nodeType": "YulLiteral", + "src": "7218:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7203:3:23", + "nodeType": "YulIdentifier", + "src": "7203:3:23" + }, + "nativeSrc": "7203:18:23", + "nodeType": "YulFunctionCall", + "src": "7203:18:23" + }, + { + "kind": "number", + "nativeSrc": "7223:2:23", + "nodeType": "YulLiteral", + "src": "7223:2:23", + "type": "", + "value": "19" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7196:6:23", + "nodeType": "YulIdentifier", + "src": "7196:6:23" + }, + "nativeSrc": "7196:30:23", + "nodeType": "YulFunctionCall", + "src": "7196:30:23" + }, + "nativeSrc": "7196:30:23", + "nodeType": "YulExpressionStatement", + "src": "7196:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7246:9:23", + "nodeType": "YulIdentifier", + "src": "7246:9:23" + }, + { + "kind": "number", + "nativeSrc": "7257:2:23", + "nodeType": "YulLiteral", + "src": "7257:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7242:3:23", + "nodeType": "YulIdentifier", + "src": "7242:3:23" + }, + "nativeSrc": "7242:18:23", + "nodeType": "YulFunctionCall", + "src": "7242:18:23" + }, + { + "hexValue": "455448207472616e73666572206661696c6564", + "kind": "string", + "nativeSrc": "7262:21:23", + "nodeType": "YulLiteral", + "src": "7262:21:23", + "type": "", + "value": "ETH transfer failed" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7235:6:23", + "nodeType": "YulIdentifier", + "src": "7235:6:23" + }, + "nativeSrc": "7235:49:23", + "nodeType": "YulFunctionCall", + "src": "7235:49:23" + }, + "nativeSrc": "7235:49:23", + "nodeType": "YulExpressionStatement", + "src": "7235:49:23" + }, + { + "nativeSrc": "7293:26:23", + "nodeType": "YulAssignment", + "src": "7293:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7305:9:23", + "nodeType": "YulIdentifier", + "src": "7305:9:23" + }, + { + "kind": "number", + "nativeSrc": "7316:2:23", + "nodeType": "YulLiteral", + "src": "7316:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7301:3:23", + "nodeType": "YulIdentifier", + "src": "7301:3:23" + }, + "nativeSrc": "7301:18:23", + "nodeType": "YulFunctionCall", + "src": "7301:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "7293:4:23", + "nodeType": "YulIdentifier", + "src": "7293:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_c7c2be2f1b63a3793f6e2d447ce95ba2239687186a7fd6b5268a969dcdb42dcd__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "6982:343:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "7133:9:23", + "nodeType": "YulTypedName", + "src": "7133:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "7147:4:23", + "nodeType": "YulTypedName", + "src": "7147:4:23", + "type": "" + } + ], + "src": "6982:343:23" + }, + { + "body": { + "nativeSrc": "7655:504:23", + "nodeType": "YulBlock", + "src": "7655:504:23", + "statements": [ + { + "nativeSrc": "7665:27:23", + "nodeType": "YulAssignment", + "src": "7665:27:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7677:9:23", + "nodeType": "YulIdentifier", + "src": "7677:9:23" + }, + { + "kind": "number", + "nativeSrc": "7688:3:23", + "nodeType": "YulLiteral", + "src": "7688:3:23", + "type": "", + "value": "288" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7673:3:23", + "nodeType": "YulIdentifier", + "src": "7673:3:23" + }, + "nativeSrc": "7673:19:23", + "nodeType": "YulFunctionCall", + "src": "7673:19:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "7665:4:23", + "nodeType": "YulIdentifier", + "src": "7665:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7708:9:23", + "nodeType": "YulIdentifier", + "src": "7708:9:23" + }, + { + "name": "value0", + "nativeSrc": "7719:6:23", + "nodeType": "YulIdentifier", + "src": "7719:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7701:6:23", + "nodeType": "YulIdentifier", + "src": "7701:6:23" + }, + "nativeSrc": "7701:25:23", + "nodeType": "YulFunctionCall", + "src": "7701:25:23" + }, + "nativeSrc": "7701:25:23", + "nodeType": "YulExpressionStatement", + "src": "7701:25:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7746:9:23", + "nodeType": "YulIdentifier", + "src": "7746:9:23" + }, + { + "kind": "number", + "nativeSrc": "7757:2:23", + "nodeType": "YulLiteral", + "src": "7757:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7742:3:23", + "nodeType": "YulIdentifier", + "src": "7742:3:23" + }, + "nativeSrc": "7742:18:23", + "nodeType": "YulFunctionCall", + "src": "7742:18:23" + }, + { + "arguments": [ + { + "name": "value1", + "nativeSrc": "7766:6:23", + "nodeType": "YulIdentifier", + "src": "7766:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "7782:3:23", + "nodeType": "YulLiteral", + "src": "7782:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "7787:1:23", + "nodeType": "YulLiteral", + "src": "7787:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "7778:3:23", + "nodeType": "YulIdentifier", + "src": "7778:3:23" + }, + "nativeSrc": "7778:11:23", + "nodeType": "YulFunctionCall", + "src": "7778:11:23" + }, + { + "kind": "number", + "nativeSrc": "7791:1:23", + "nodeType": "YulLiteral", + "src": "7791:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "7774:3:23", + "nodeType": "YulIdentifier", + "src": "7774:3:23" + }, + "nativeSrc": "7774:19:23", + "nodeType": "YulFunctionCall", + "src": "7774:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "7762:3:23", + "nodeType": "YulIdentifier", + "src": "7762:3:23" + }, + "nativeSrc": "7762:32:23", + "nodeType": "YulFunctionCall", + "src": "7762:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7735:6:23", + "nodeType": "YulIdentifier", + "src": "7735:6:23" + }, + "nativeSrc": "7735:60:23", + "nodeType": "YulFunctionCall", + "src": "7735:60:23" + }, + "nativeSrc": "7735:60:23", + "nodeType": "YulExpressionStatement", + "src": "7735:60:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7815:9:23", + "nodeType": "YulIdentifier", + "src": "7815:9:23" + }, + { + "kind": "number", + "nativeSrc": "7826:2:23", + "nodeType": "YulLiteral", + "src": "7826:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7811:3:23", + "nodeType": "YulIdentifier", + "src": "7811:3:23" + }, + "nativeSrc": "7811:18:23", + "nodeType": "YulFunctionCall", + "src": "7811:18:23" + }, + { + "arguments": [ + { + "name": "value2", + "nativeSrc": "7835:6:23", + "nodeType": "YulIdentifier", + "src": "7835:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "7851:3:23", + "nodeType": "YulLiteral", + "src": "7851:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "7856:1:23", + "nodeType": "YulLiteral", + "src": "7856:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "7847:3:23", + "nodeType": "YulIdentifier", + "src": "7847:3:23" + }, + "nativeSrc": "7847:11:23", + "nodeType": "YulFunctionCall", + "src": "7847:11:23" + }, + { + "kind": "number", + "nativeSrc": "7860:1:23", + "nodeType": "YulLiteral", + "src": "7860:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "7843:3:23", + "nodeType": "YulIdentifier", + "src": "7843:3:23" + }, + "nativeSrc": "7843:19:23", + "nodeType": "YulFunctionCall", + "src": "7843:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "7831:3:23", + "nodeType": "YulIdentifier", + "src": "7831:3:23" + }, + "nativeSrc": "7831:32:23", + "nodeType": "YulFunctionCall", + "src": "7831:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7804:6:23", + "nodeType": "YulIdentifier", + "src": "7804:6:23" + }, + "nativeSrc": "7804:60:23", + "nodeType": "YulFunctionCall", + "src": "7804:60:23" + }, + "nativeSrc": "7804:60:23", + "nodeType": "YulExpressionStatement", + "src": "7804:60:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7884:9:23", + "nodeType": "YulIdentifier", + "src": "7884:9:23" + }, + { + "kind": "number", + "nativeSrc": "7895:2:23", + "nodeType": "YulLiteral", + "src": "7895:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7880:3:23", + "nodeType": "YulIdentifier", + "src": "7880:3:23" + }, + "nativeSrc": "7880:18:23", + "nodeType": "YulFunctionCall", + "src": "7880:18:23" + }, + { + "arguments": [ + { + "name": "value3", + "nativeSrc": "7904:6:23", + "nodeType": "YulIdentifier", + "src": "7904:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "7920:3:23", + "nodeType": "YulLiteral", + "src": "7920:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "7925:1:23", + "nodeType": "YulLiteral", + "src": "7925:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "7916:3:23", + "nodeType": "YulIdentifier", + "src": "7916:3:23" + }, + "nativeSrc": "7916:11:23", + "nodeType": "YulFunctionCall", + "src": "7916:11:23" + }, + { + "kind": "number", + "nativeSrc": "7929:1:23", + "nodeType": "YulLiteral", + "src": "7929:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "7912:3:23", + "nodeType": "YulIdentifier", + "src": "7912:3:23" + }, + "nativeSrc": "7912:19:23", + "nodeType": "YulFunctionCall", + "src": "7912:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "7900:3:23", + "nodeType": "YulIdentifier", + "src": "7900:3:23" + }, + "nativeSrc": "7900:32:23", + "nodeType": "YulFunctionCall", + "src": "7900:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7873:6:23", + "nodeType": "YulIdentifier", + "src": "7873:6:23" + }, + "nativeSrc": "7873:60:23", + "nodeType": "YulFunctionCall", + "src": "7873:60:23" + }, + "nativeSrc": "7873:60:23", + "nodeType": "YulExpressionStatement", + "src": "7873:60:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7953:9:23", + "nodeType": "YulIdentifier", + "src": "7953:9:23" + }, + { + "kind": "number", + "nativeSrc": "7964:3:23", + "nodeType": "YulLiteral", + "src": "7964:3:23", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7949:3:23", + "nodeType": "YulIdentifier", + "src": "7949:3:23" + }, + "nativeSrc": "7949:19:23", + "nodeType": "YulFunctionCall", + "src": "7949:19:23" + }, + { + "name": "value4", + "nativeSrc": "7970:6:23", + "nodeType": "YulIdentifier", + "src": "7970:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7942:6:23", + "nodeType": "YulIdentifier", + "src": "7942:6:23" + }, + "nativeSrc": "7942:35:23", + "nodeType": "YulFunctionCall", + "src": "7942:35:23" + }, + "nativeSrc": "7942:35:23", + "nodeType": "YulExpressionStatement", + "src": "7942:35:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7997:9:23", + "nodeType": "YulIdentifier", + "src": "7997:9:23" + }, + { + "kind": "number", + "nativeSrc": "8008:3:23", + "nodeType": "YulLiteral", + "src": "8008:3:23", + "type": "", + "value": "160" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7993:3:23", + "nodeType": "YulIdentifier", + "src": "7993:3:23" + }, + "nativeSrc": "7993:19:23", + "nodeType": "YulFunctionCall", + "src": "7993:19:23" + }, + { + "name": "value5", + "nativeSrc": "8014:6:23", + "nodeType": "YulIdentifier", + "src": "8014:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7986:6:23", + "nodeType": "YulIdentifier", + "src": "7986:6:23" + }, + "nativeSrc": "7986:35:23", + "nodeType": "YulFunctionCall", + "src": "7986:35:23" + }, + "nativeSrc": "7986:35:23", + "nodeType": "YulExpressionStatement", + "src": "7986:35:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8041:9:23", + "nodeType": "YulIdentifier", + "src": "8041:9:23" + }, + { + "kind": "number", + "nativeSrc": "8052:3:23", + "nodeType": "YulLiteral", + "src": "8052:3:23", + "type": "", + "value": "192" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8037:3:23", + "nodeType": "YulIdentifier", + "src": "8037:3:23" + }, + "nativeSrc": "8037:19:23", + "nodeType": "YulFunctionCall", + "src": "8037:19:23" + }, + { + "name": "value6", + "nativeSrc": "8058:6:23", + "nodeType": "YulIdentifier", + "src": "8058:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8030:6:23", + "nodeType": "YulIdentifier", + "src": "8030:6:23" + }, + "nativeSrc": "8030:35:23", + "nodeType": "YulFunctionCall", + "src": "8030:35:23" + }, + "nativeSrc": "8030:35:23", + "nodeType": "YulExpressionStatement", + "src": "8030:35:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8085:9:23", + "nodeType": "YulIdentifier", + "src": "8085:9:23" + }, + { + "kind": "number", + "nativeSrc": "8096:3:23", + "nodeType": "YulLiteral", + "src": "8096:3:23", + "type": "", + "value": "224" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8081:3:23", + "nodeType": "YulIdentifier", + "src": "8081:3:23" + }, + "nativeSrc": "8081:19:23", + "nodeType": "YulFunctionCall", + "src": "8081:19:23" + }, + { + "name": "value7", + "nativeSrc": "8102:6:23", + "nodeType": "YulIdentifier", + "src": "8102:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8074:6:23", + "nodeType": "YulIdentifier", + "src": "8074:6:23" + }, + "nativeSrc": "8074:35:23", + "nodeType": "YulFunctionCall", + "src": "8074:35:23" + }, + "nativeSrc": "8074:35:23", + "nodeType": "YulExpressionStatement", + "src": "8074:35:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8129:9:23", + "nodeType": "YulIdentifier", + "src": "8129:9:23" + }, + { + "kind": "number", + "nativeSrc": "8140:3:23", + "nodeType": "YulLiteral", + "src": "8140:3:23", + "type": "", + "value": "256" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8125:3:23", + "nodeType": "YulIdentifier", + "src": "8125:3:23" + }, + "nativeSrc": "8125:19:23", + "nodeType": "YulFunctionCall", + "src": "8125:19:23" + }, + { + "name": "value8", + "nativeSrc": "8146:6:23", + "nodeType": "YulIdentifier", + "src": "8146:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8118:6:23", + "nodeType": "YulIdentifier", + "src": "8118:6:23" + }, + "nativeSrc": "8118:35:23", + "nodeType": "YulFunctionCall", + "src": "8118:35:23" + }, + "nativeSrc": "8118:35:23", + "nodeType": "YulExpressionStatement", + "src": "8118:35:23" + } + ] + }, + "name": "abi_encode_tuple_t_bytes32_t_address_t_address_t_address_t_uint256_t_bytes32_t_uint256_t_uint256_t_uint256__to_t_bytes32_t_address_t_address_t_address_t_uint256_t_bytes32_t_uint256_t_uint256_t_uint256__fromStack_reversed", + "nativeSrc": "7330:829:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "7560:9:23", + "nodeType": "YulTypedName", + "src": "7560:9:23", + "type": "" + }, + { + "name": "value8", + "nativeSrc": "7571:6:23", + "nodeType": "YulTypedName", + "src": "7571:6:23", + "type": "" + }, + { + "name": "value7", + "nativeSrc": "7579:6:23", + "nodeType": "YulTypedName", + "src": "7579:6:23", + "type": "" + }, + { + "name": "value6", + "nativeSrc": "7587:6:23", + "nodeType": "YulTypedName", + "src": "7587:6:23", + "type": "" + }, + { + "name": "value5", + "nativeSrc": "7595:6:23", + "nodeType": "YulTypedName", + "src": "7595:6:23", + "type": "" + }, + { + "name": "value4", + "nativeSrc": "7603:6:23", + "nodeType": "YulTypedName", + "src": "7603:6:23", + "type": "" + }, + { + "name": "value3", + "nativeSrc": "7611:6:23", + "nodeType": "YulTypedName", + "src": "7611:6:23", + "type": "" + }, + { + "name": "value2", + "nativeSrc": "7619:6:23", + "nodeType": "YulTypedName", + "src": "7619:6:23", + "type": "" + }, + { + "name": "value1", + "nativeSrc": "7627:6:23", + "nodeType": "YulTypedName", + "src": "7627:6:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "7635:6:23", + "nodeType": "YulTypedName", + "src": "7635:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "7646:4:23", + "nodeType": "YulTypedName", + "src": "7646:4:23", + "type": "" + } + ], + "src": "7330:829:23" + }, + { + "body": { + "nativeSrc": "8429:401:23", + "nodeType": "YulBlock", + "src": "8429:401:23", + "statements": [ + { + "nativeSrc": "8439:27:23", + "nodeType": "YulAssignment", + "src": "8439:27:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8451:9:23", + "nodeType": "YulIdentifier", + "src": "8451:9:23" + }, + { + "kind": "number", + "nativeSrc": "8462:3:23", + "nodeType": "YulLiteral", + "src": "8462:3:23", + "type": "", + "value": "224" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8447:3:23", + "nodeType": "YulIdentifier", + "src": "8447:3:23" + }, + "nativeSrc": "8447:19:23", + "nodeType": "YulFunctionCall", + "src": "8447:19:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "8439:4:23", + "nodeType": "YulIdentifier", + "src": "8439:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8482:9:23", + "nodeType": "YulIdentifier", + "src": "8482:9:23" + }, + { + "arguments": [ + { + "name": "value0", + "nativeSrc": "8497:6:23", + "nodeType": "YulIdentifier", + "src": "8497:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "8513:3:23", + "nodeType": "YulLiteral", + "src": "8513:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "8518:1:23", + "nodeType": "YulLiteral", + "src": "8518:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "8509:3:23", + "nodeType": "YulIdentifier", + "src": "8509:3:23" + }, + "nativeSrc": "8509:11:23", + "nodeType": "YulFunctionCall", + "src": "8509:11:23" + }, + { + "kind": "number", + "nativeSrc": "8522:1:23", + "nodeType": "YulLiteral", + "src": "8522:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "8505:3:23", + "nodeType": "YulIdentifier", + "src": "8505:3:23" + }, + "nativeSrc": "8505:19:23", + "nodeType": "YulFunctionCall", + "src": "8505:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "8493:3:23", + "nodeType": "YulIdentifier", + "src": "8493:3:23" + }, + "nativeSrc": "8493:32:23", + "nodeType": "YulFunctionCall", + "src": "8493:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8475:6:23", + "nodeType": "YulIdentifier", + "src": "8475:6:23" + }, + "nativeSrc": "8475:51:23", + "nodeType": "YulFunctionCall", + "src": "8475:51:23" + }, + "nativeSrc": "8475:51:23", + "nodeType": "YulExpressionStatement", + "src": "8475:51:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8546:9:23", + "nodeType": "YulIdentifier", + "src": "8546:9:23" + }, + { + "kind": "number", + "nativeSrc": "8557:2:23", + "nodeType": "YulLiteral", + "src": "8557:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8542:3:23", + "nodeType": "YulIdentifier", + "src": "8542:3:23" + }, + "nativeSrc": "8542:18:23", + "nodeType": "YulFunctionCall", + "src": "8542:18:23" + }, + { + "arguments": [ + { + "name": "value1", + "nativeSrc": "8566:6:23", + "nodeType": "YulIdentifier", + "src": "8566:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "8582:3:23", + "nodeType": "YulLiteral", + "src": "8582:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "8587:1:23", + "nodeType": "YulLiteral", + "src": "8587:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "8578:3:23", + "nodeType": "YulIdentifier", + "src": "8578:3:23" + }, + "nativeSrc": "8578:11:23", + "nodeType": "YulFunctionCall", + "src": "8578:11:23" + }, + { + "kind": "number", + "nativeSrc": "8591:1:23", + "nodeType": "YulLiteral", + "src": "8591:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "8574:3:23", + "nodeType": "YulIdentifier", + "src": "8574:3:23" + }, + "nativeSrc": "8574:19:23", + "nodeType": "YulFunctionCall", + "src": "8574:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "8562:3:23", + "nodeType": "YulIdentifier", + "src": "8562:3:23" + }, + "nativeSrc": "8562:32:23", + "nodeType": "YulFunctionCall", + "src": "8562:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8535:6:23", + "nodeType": "YulIdentifier", + "src": "8535:6:23" + }, + "nativeSrc": "8535:60:23", + "nodeType": "YulFunctionCall", + "src": "8535:60:23" + }, + "nativeSrc": "8535:60:23", + "nodeType": "YulExpressionStatement", + "src": "8535:60:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8615:9:23", + "nodeType": "YulIdentifier", + "src": "8615:9:23" + }, + { + "kind": "number", + "nativeSrc": "8626:2:23", + "nodeType": "YulLiteral", + "src": "8626:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8611:3:23", + "nodeType": "YulIdentifier", + "src": "8611:3:23" + }, + "nativeSrc": "8611:18:23", + "nodeType": "YulFunctionCall", + "src": "8611:18:23" + }, + { + "name": "value2", + "nativeSrc": "8631:6:23", + "nodeType": "YulIdentifier", + "src": "8631:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8604:6:23", + "nodeType": "YulIdentifier", + "src": "8604:6:23" + }, + "nativeSrc": "8604:34:23", + "nodeType": "YulFunctionCall", + "src": "8604:34:23" + }, + "nativeSrc": "8604:34:23", + "nodeType": "YulExpressionStatement", + "src": "8604:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8658:9:23", + "nodeType": "YulIdentifier", + "src": "8658:9:23" + }, + { + "kind": "number", + "nativeSrc": "8669:2:23", + "nodeType": "YulLiteral", + "src": "8669:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8654:3:23", + "nodeType": "YulIdentifier", + "src": "8654:3:23" + }, + "nativeSrc": "8654:18:23", + "nodeType": "YulFunctionCall", + "src": "8654:18:23" + }, + { + "name": "value3", + "nativeSrc": "8674:6:23", + "nodeType": "YulIdentifier", + "src": "8674:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8647:6:23", + "nodeType": "YulIdentifier", + "src": "8647:6:23" + }, + "nativeSrc": "8647:34:23", + "nodeType": "YulFunctionCall", + "src": "8647:34:23" + }, + "nativeSrc": "8647:34:23", + "nodeType": "YulExpressionStatement", + "src": "8647:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8701:9:23", + "nodeType": "YulIdentifier", + "src": "8701:9:23" + }, + { + "kind": "number", + "nativeSrc": "8712:3:23", + "nodeType": "YulLiteral", + "src": "8712:3:23", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8697:3:23", + "nodeType": "YulIdentifier", + "src": "8697:3:23" + }, + "nativeSrc": "8697:19:23", + "nodeType": "YulFunctionCall", + "src": "8697:19:23" + }, + { + "arguments": [ + { + "name": "value4", + "nativeSrc": "8722:6:23", + "nodeType": "YulIdentifier", + "src": "8722:6:23" + }, + { + "kind": "number", + "nativeSrc": "8730:4:23", + "nodeType": "YulLiteral", + "src": "8730:4:23", + "type": "", + "value": "0xff" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "8718:3:23", + "nodeType": "YulIdentifier", + "src": "8718:3:23" + }, + "nativeSrc": "8718:17:23", + "nodeType": "YulFunctionCall", + "src": "8718:17:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8690:6:23", + "nodeType": "YulIdentifier", + "src": "8690:6:23" + }, + "nativeSrc": "8690:46:23", + "nodeType": "YulFunctionCall", + "src": "8690:46:23" + }, + "nativeSrc": "8690:46:23", + "nodeType": "YulExpressionStatement", + "src": "8690:46:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8756:9:23", + "nodeType": "YulIdentifier", + "src": "8756:9:23" + }, + { + "kind": "number", + "nativeSrc": "8767:3:23", + "nodeType": "YulLiteral", + "src": "8767:3:23", + "type": "", + "value": "160" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8752:3:23", + "nodeType": "YulIdentifier", + "src": "8752:3:23" + }, + "nativeSrc": "8752:19:23", + "nodeType": "YulFunctionCall", + "src": "8752:19:23" + }, + { + "name": "value5", + "nativeSrc": "8773:6:23", + "nodeType": "YulIdentifier", + "src": "8773:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8745:6:23", + "nodeType": "YulIdentifier", + "src": "8745:6:23" + }, + "nativeSrc": "8745:35:23", + "nodeType": "YulFunctionCall", + "src": "8745:35:23" + }, + "nativeSrc": "8745:35:23", + "nodeType": "YulExpressionStatement", + "src": "8745:35:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8800:9:23", + "nodeType": "YulIdentifier", + "src": "8800:9:23" + }, + { + "kind": "number", + "nativeSrc": "8811:3:23", + "nodeType": "YulLiteral", + "src": "8811:3:23", + "type": "", + "value": "192" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8796:3:23", + "nodeType": "YulIdentifier", + "src": "8796:3:23" + }, + "nativeSrc": "8796:19:23", + "nodeType": "YulFunctionCall", + "src": "8796:19:23" + }, + { + "name": "value6", + "nativeSrc": "8817:6:23", + "nodeType": "YulIdentifier", + "src": "8817:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8789:6:23", + "nodeType": "YulIdentifier", + "src": "8789:6:23" + }, + "nativeSrc": "8789:35:23", + "nodeType": "YulFunctionCall", + "src": "8789:35:23" + }, + "nativeSrc": "8789:35:23", + "nodeType": "YulExpressionStatement", + "src": "8789:35:23" + } + ] + }, + "name": "abi_encode_tuple_t_address_t_address_t_uint256_t_uint256_t_uint8_t_bytes32_t_bytes32__to_t_address_t_address_t_uint256_t_uint256_t_uint8_t_bytes32_t_bytes32__fromStack_reversed", + "nativeSrc": "8164:666:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "8350:9:23", + "nodeType": "YulTypedName", + "src": "8350:9:23", + "type": "" + }, + { + "name": "value6", + "nativeSrc": "8361:6:23", + "nodeType": "YulTypedName", + "src": "8361:6:23", + "type": "" + }, + { + "name": "value5", + "nativeSrc": "8369:6:23", + "nodeType": "YulTypedName", + "src": "8369:6:23", + "type": "" + }, + { + "name": "value4", + "nativeSrc": "8377:6:23", + "nodeType": "YulTypedName", + "src": "8377:6:23", + "type": "" + }, + { + "name": "value3", + "nativeSrc": "8385:6:23", + "nodeType": "YulTypedName", + "src": "8385:6:23", + "type": "" + }, + { + "name": "value2", + "nativeSrc": "8393:6:23", + "nodeType": "YulTypedName", + "src": "8393:6:23", + "type": "" + }, + { + "name": "value1", + "nativeSrc": "8401:6:23", + "nodeType": "YulTypedName", + "src": "8401:6:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "8409:6:23", + "nodeType": "YulTypedName", + "src": "8409:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "8420:4:23", + "nodeType": "YulTypedName", + "src": "8420:4:23", + "type": "" + } + ], + "src": "8164:666:23" + }, + { + "body": { + "nativeSrc": "8964:171:23", + "nodeType": "YulBlock", + "src": "8964:171:23", + "statements": [ + { + "nativeSrc": "8974:26:23", + "nodeType": "YulAssignment", + "src": "8974:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8986:9:23", + "nodeType": "YulIdentifier", + "src": "8986:9:23" + }, + { + "kind": "number", + "nativeSrc": "8997:2:23", + "nodeType": "YulLiteral", + "src": "8997:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8982:3:23", + "nodeType": "YulIdentifier", + "src": "8982:3:23" + }, + "nativeSrc": "8982:18:23", + "nodeType": "YulFunctionCall", + "src": "8982:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "8974:4:23", + "nodeType": "YulIdentifier", + "src": "8974:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "9016:9:23", + "nodeType": "YulIdentifier", + "src": "9016:9:23" + }, + { + "arguments": [ + { + "name": "value0", + "nativeSrc": "9031:6:23", + "nodeType": "YulIdentifier", + "src": "9031:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9047:3:23", + "nodeType": "YulLiteral", + "src": "9047:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "9052:1:23", + "nodeType": "YulLiteral", + "src": "9052:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "9043:3:23", + "nodeType": "YulIdentifier", + "src": "9043:3:23" + }, + "nativeSrc": "9043:11:23", + "nodeType": "YulFunctionCall", + "src": "9043:11:23" + }, + { + "kind": "number", + "nativeSrc": "9056:1:23", + "nodeType": "YulLiteral", + "src": "9056:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "9039:3:23", + "nodeType": "YulIdentifier", + "src": "9039:3:23" + }, + "nativeSrc": "9039:19:23", + "nodeType": "YulFunctionCall", + "src": "9039:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "9027:3:23", + "nodeType": "YulIdentifier", + "src": "9027:3:23" + }, + "nativeSrc": "9027:32:23", + "nodeType": "YulFunctionCall", + "src": "9027:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "9009:6:23", + "nodeType": "YulIdentifier", + "src": "9009:6:23" + }, + "nativeSrc": "9009:51:23", + "nodeType": "YulFunctionCall", + "src": "9009:51:23" + }, + "nativeSrc": "9009:51:23", + "nodeType": "YulExpressionStatement", + "src": "9009:51:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "9080:9:23", + "nodeType": "YulIdentifier", + "src": "9080:9:23" + }, + { + "kind": "number", + "nativeSrc": "9091:2:23", + "nodeType": "YulLiteral", + "src": "9091:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9076:3:23", + "nodeType": "YulIdentifier", + "src": "9076:3:23" + }, + "nativeSrc": "9076:18:23", + "nodeType": "YulFunctionCall", + "src": "9076:18:23" + }, + { + "arguments": [ + { + "name": "value1", + "nativeSrc": "9100:6:23", + "nodeType": "YulIdentifier", + "src": "9100:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9116:3:23", + "nodeType": "YulLiteral", + "src": "9116:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "9121:1:23", + "nodeType": "YulLiteral", + "src": "9121:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "9112:3:23", + "nodeType": "YulIdentifier", + "src": "9112:3:23" + }, + "nativeSrc": "9112:11:23", + "nodeType": "YulFunctionCall", + "src": "9112:11:23" + }, + { + "kind": "number", + "nativeSrc": "9125:1:23", + "nodeType": "YulLiteral", + "src": "9125:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "9108:3:23", + "nodeType": "YulIdentifier", + "src": "9108:3:23" + }, + "nativeSrc": "9108:19:23", + "nodeType": "YulFunctionCall", + "src": "9108:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "9096:3:23", + "nodeType": "YulIdentifier", + "src": "9096:3:23" + }, + "nativeSrc": "9096:32:23", + "nodeType": "YulFunctionCall", + "src": "9096:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "9069:6:23", + "nodeType": "YulIdentifier", + "src": "9069:6:23" + }, + "nativeSrc": "9069:60:23", + "nodeType": "YulFunctionCall", + "src": "9069:60:23" + }, + "nativeSrc": "9069:60:23", + "nodeType": "YulExpressionStatement", + "src": "9069:60:23" + } + ] + }, + "name": "abi_encode_tuple_t_address_t_address__to_t_address_t_address__fromStack_reversed", + "nativeSrc": "8835:300:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "8925:9:23", + "nodeType": "YulTypedName", + "src": "8925:9:23", + "type": "" + }, + { + "name": "value1", + "nativeSrc": "8936:6:23", + "nodeType": "YulTypedName", + "src": "8936:6:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "8944:6:23", + "nodeType": "YulTypedName", + "src": "8944:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "8955:4:23", + "nodeType": "YulTypedName", + "src": "8955:4:23", + "type": "" + } + ], + "src": "8835:300:23" + }, + { + "body": { + "nativeSrc": "9221:103:23", + "nodeType": "YulBlock", + "src": "9221:103:23", + "statements": [ + { + "body": { + "nativeSrc": "9267:16:23", + "nodeType": "YulBlock", + "src": "9267:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9276:1:23", + "nodeType": "YulLiteral", + "src": "9276:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "9279:1:23", + "nodeType": "YulLiteral", + "src": "9279:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "9269:6:23", + "nodeType": "YulIdentifier", + "src": "9269:6:23" + }, + "nativeSrc": "9269:12:23", + "nodeType": "YulFunctionCall", + "src": "9269:12:23" + }, + "nativeSrc": "9269:12:23", + "nodeType": "YulExpressionStatement", + "src": "9269:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nativeSrc": "9242:7:23", + "nodeType": "YulIdentifier", + "src": "9242:7:23" + }, + { + "name": "headStart", + "nativeSrc": "9251:9:23", + "nodeType": "YulIdentifier", + "src": "9251:9:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "9238:3:23", + "nodeType": "YulIdentifier", + "src": "9238:3:23" + }, + "nativeSrc": "9238:23:23", + "nodeType": "YulFunctionCall", + "src": "9238:23:23" + }, + { + "kind": "number", + "nativeSrc": "9263:2:23", + "nodeType": "YulLiteral", + "src": "9263:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nativeSrc": "9234:3:23", + "nodeType": "YulIdentifier", + "src": "9234:3:23" + }, + "nativeSrc": "9234:32:23", + "nodeType": "YulFunctionCall", + "src": "9234:32:23" + }, + "nativeSrc": "9231:52:23", + "nodeType": "YulIf", + "src": "9231:52:23" + }, + { + "nativeSrc": "9292:26:23", + "nodeType": "YulAssignment", + "src": "9292:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "9308:9:23", + "nodeType": "YulIdentifier", + "src": "9308:9:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "9302:5:23", + "nodeType": "YulIdentifier", + "src": "9302:5:23" + }, + "nativeSrc": "9302:16:23", + "nodeType": "YulFunctionCall", + "src": "9302:16:23" + }, + "variableNames": [ + { + "name": "value0", + "nativeSrc": "9292:6:23", + "nodeType": "YulIdentifier", + "src": "9292:6:23" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_uint256_fromMemory", + "nativeSrc": "9140:184:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "9187:9:23", + "nodeType": "YulTypedName", + "src": "9187:9:23", + "type": "" + }, + { + "name": "dataEnd", + "nativeSrc": "9198:7:23", + "nodeType": "YulTypedName", + "src": "9198:7:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nativeSrc": "9210:6:23", + "nodeType": "YulTypedName", + "src": "9210:6:23", + "type": "" + } + ], + "src": "9140:184:23" + }, + { + "body": { + "nativeSrc": "9503:230:23", + "nodeType": "YulBlock", + "src": "9503:230:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "9520:9:23", + "nodeType": "YulIdentifier", + "src": "9520:9:23" + }, + { + "kind": "number", + "nativeSrc": "9531:2:23", + "nodeType": "YulLiteral", + "src": "9531:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "9513:6:23", + "nodeType": "YulIdentifier", + "src": "9513:6:23" + }, + "nativeSrc": "9513:21:23", + "nodeType": "YulFunctionCall", + "src": "9513:21:23" + }, + "nativeSrc": "9513:21:23", + "nodeType": "YulExpressionStatement", + "src": "9513:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "9554:9:23", + "nodeType": "YulIdentifier", + "src": "9554:9:23" + }, + { + "kind": "number", + "nativeSrc": "9565:2:23", + "nodeType": "YulLiteral", + "src": "9565:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9550:3:23", + "nodeType": "YulIdentifier", + "src": "9550:3:23" + }, + "nativeSrc": "9550:18:23", + "nodeType": "YulFunctionCall", + "src": "9550:18:23" + }, + { + "kind": "number", + "nativeSrc": "9570:2:23", + "nodeType": "YulLiteral", + "src": "9570:2:23", + "type": "", + "value": "40" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "9543:6:23", + "nodeType": "YulIdentifier", + "src": "9543:6:23" + }, + "nativeSrc": "9543:30:23", + "nodeType": "YulFunctionCall", + "src": "9543:30:23" + }, + "nativeSrc": "9543:30:23", + "nodeType": "YulExpressionStatement", + "src": "9543:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "9593:9:23", + "nodeType": "YulIdentifier", + "src": "9593:9:23" + }, + { + "kind": "number", + "nativeSrc": "9604:2:23", + "nodeType": "YulLiteral", + "src": "9604:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9589:3:23", + "nodeType": "YulIdentifier", + "src": "9589:3:23" + }, + "nativeSrc": "9589:18:23", + "nodeType": "YulFunctionCall", + "src": "9589:18:23" + }, + { + "hexValue": "5065726d6974206661696c656420616e6420696e73756666696369656e742061", + "kind": "string", + "nativeSrc": "9609:34:23", + "nodeType": "YulLiteral", + "src": "9609:34:23", + "type": "", + "value": "Permit failed and insufficient a" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "9582:6:23", + "nodeType": "YulIdentifier", + "src": "9582:6:23" + }, + "nativeSrc": "9582:62:23", + "nodeType": "YulFunctionCall", + "src": "9582:62:23" + }, + "nativeSrc": "9582:62:23", + "nodeType": "YulExpressionStatement", + "src": "9582:62:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "9664:9:23", + "nodeType": "YulIdentifier", + "src": "9664:9:23" + }, + { + "kind": "number", + "nativeSrc": "9675:2:23", + "nodeType": "YulLiteral", + "src": "9675:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9660:3:23", + "nodeType": "YulIdentifier", + "src": "9660:3:23" + }, + "nativeSrc": "9660:18:23", + "nodeType": "YulFunctionCall", + "src": "9660:18:23" + }, + { + "hexValue": "6c6c6f77616e6365", + "kind": "string", + "nativeSrc": "9680:10:23", + "nodeType": "YulLiteral", + "src": "9680:10:23", + "type": "", + "value": "llowance" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "9653:6:23", + "nodeType": "YulIdentifier", + "src": "9653:6:23" + }, + "nativeSrc": "9653:38:23", + "nodeType": "YulFunctionCall", + "src": "9653:38:23" + }, + "nativeSrc": "9653:38:23", + "nodeType": "YulExpressionStatement", + "src": "9653:38:23" + }, + { + "nativeSrc": "9700:27:23", + "nodeType": "YulAssignment", + "src": "9700:27:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "9712:9:23", + "nodeType": "YulIdentifier", + "src": "9712:9:23" + }, + { + "kind": "number", + "nativeSrc": "9723:3:23", + "nodeType": "YulLiteral", + "src": "9723:3:23", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9708:3:23", + "nodeType": "YulIdentifier", + "src": "9708:3:23" + }, + "nativeSrc": "9708:19:23", + "nodeType": "YulFunctionCall", + "src": "9708:19:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "9700:4:23", + "nodeType": "YulIdentifier", + "src": "9700:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_0acc7f0c8df1a6717d2b423ae4591ac135687015764ac37dd4cf0150a9322b15__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "9329:404:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "9480:9:23", + "nodeType": "YulTypedName", + "src": "9480:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "9494:4:23", + "nodeType": "YulTypedName", + "src": "9494:4:23", + "type": "" + } + ], + "src": "9329:404:23" + }, + { + "body": { + "nativeSrc": "9875:164:23", + "nodeType": "YulBlock", + "src": "9875:164:23", + "statements": [ + { + "nativeSrc": "9885:27:23", + "nodeType": "YulVariableDeclaration", + "src": "9885:27:23", + "value": { + "arguments": [ + { + "name": "value0", + "nativeSrc": "9905:6:23", + "nodeType": "YulIdentifier", + "src": "9905:6:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "9899:5:23", + "nodeType": "YulIdentifier", + "src": "9899:5:23" + }, + "nativeSrc": "9899:13:23", + "nodeType": "YulFunctionCall", + "src": "9899:13:23" + }, + "variables": [ + { + "name": "length", + "nativeSrc": "9889:6:23", + "nodeType": "YulTypedName", + "src": "9889:6:23", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "pos", + "nativeSrc": "9927:3:23", + "nodeType": "YulIdentifier", + "src": "9927:3:23" + }, + { + "arguments": [ + { + "name": "value0", + "nativeSrc": "9936:6:23", + "nodeType": "YulIdentifier", + "src": "9936:6:23" + }, + { + "kind": "number", + "nativeSrc": "9944:4:23", + "nodeType": "YulLiteral", + "src": "9944:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9932:3:23", + "nodeType": "YulIdentifier", + "src": "9932:3:23" + }, + "nativeSrc": "9932:17:23", + "nodeType": "YulFunctionCall", + "src": "9932:17:23" + }, + { + "name": "length", + "nativeSrc": "9951:6:23", + "nodeType": "YulIdentifier", + "src": "9951:6:23" + } + ], + "functionName": { + "name": "mcopy", + "nativeSrc": "9921:5:23", + "nodeType": "YulIdentifier", + "src": "9921:5:23" + }, + "nativeSrc": "9921:37:23", + "nodeType": "YulFunctionCall", + "src": "9921:37:23" + }, + "nativeSrc": "9921:37:23", + "nodeType": "YulExpressionStatement", + "src": "9921:37:23" + }, + { + "nativeSrc": "9967:26:23", + "nodeType": "YulVariableDeclaration", + "src": "9967:26:23", + "value": { + "arguments": [ + { + "name": "pos", + "nativeSrc": "9981:3:23", + "nodeType": "YulIdentifier", + "src": "9981:3:23" + }, + { + "name": "length", + "nativeSrc": "9986:6:23", + "nodeType": "YulIdentifier", + "src": "9986:6:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9977:3:23", + "nodeType": "YulIdentifier", + "src": "9977:3:23" + }, + "nativeSrc": "9977:16:23", + "nodeType": "YulFunctionCall", + "src": "9977:16:23" + }, + "variables": [ + { + "name": "_1", + "nativeSrc": "9971:2:23", + "nodeType": "YulTypedName", + "src": "9971:2:23", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "_1", + "nativeSrc": "10009:2:23", + "nodeType": "YulIdentifier", + "src": "10009:2:23" + }, + { + "kind": "number", + "nativeSrc": "10013:1:23", + "nodeType": "YulLiteral", + "src": "10013:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10002:6:23", + "nodeType": "YulIdentifier", + "src": "10002:6:23" + }, + "nativeSrc": "10002:13:23", + "nodeType": "YulFunctionCall", + "src": "10002:13:23" + }, + "nativeSrc": "10002:13:23", + "nodeType": "YulExpressionStatement", + "src": "10002:13:23" + }, + { + "nativeSrc": "10024:9:23", + "nodeType": "YulAssignment", + "src": "10024:9:23", + "value": { + "name": "_1", + "nativeSrc": "10031:2:23", + "nodeType": "YulIdentifier", + "src": "10031:2:23" + }, + "variableNames": [ + { + "name": "end", + "nativeSrc": "10024:3:23", + "nodeType": "YulIdentifier", + "src": "10024:3:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_packed_t_bytes_memory_ptr__to_t_bytes_memory_ptr__nonPadded_inplace_fromStack_reversed", + "nativeSrc": "9738:301:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "pos", + "nativeSrc": "9851:3:23", + "nodeType": "YulTypedName", + "src": "9851:3:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "9856:6:23", + "nodeType": "YulTypedName", + "src": "9856:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nativeSrc": "9867:3:23", + "nodeType": "YulTypedName", + "src": "9867:3:23", + "type": "" + } + ], + "src": "9738:301:23" + }, + { + "body": { + "nativeSrc": "10225:217:23", + "nodeType": "YulBlock", + "src": "10225:217:23", + "statements": [ + { + "nativeSrc": "10235:27:23", + "nodeType": "YulAssignment", + "src": "10235:27:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "10247:9:23", + "nodeType": "YulIdentifier", + "src": "10247:9:23" + }, + { + "kind": "number", + "nativeSrc": "10258:3:23", + "nodeType": "YulLiteral", + "src": "10258:3:23", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10243:3:23", + "nodeType": "YulIdentifier", + "src": "10243:3:23" + }, + "nativeSrc": "10243:19:23", + "nodeType": "YulFunctionCall", + "src": "10243:19:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "10235:4:23", + "nodeType": "YulIdentifier", + "src": "10235:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "10278:9:23", + "nodeType": "YulIdentifier", + "src": "10278:9:23" + }, + { + "name": "value0", + "nativeSrc": "10289:6:23", + "nodeType": "YulIdentifier", + "src": "10289:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10271:6:23", + "nodeType": "YulIdentifier", + "src": "10271:6:23" + }, + "nativeSrc": "10271:25:23", + "nodeType": "YulFunctionCall", + "src": "10271:25:23" + }, + "nativeSrc": "10271:25:23", + "nodeType": "YulExpressionStatement", + "src": "10271:25:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "10316:9:23", + "nodeType": "YulIdentifier", + "src": "10316:9:23" + }, + { + "kind": "number", + "nativeSrc": "10327:2:23", + "nodeType": "YulLiteral", + "src": "10327:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10312:3:23", + "nodeType": "YulIdentifier", + "src": "10312:3:23" + }, + "nativeSrc": "10312:18:23", + "nodeType": "YulFunctionCall", + "src": "10312:18:23" + }, + { + "arguments": [ + { + "name": "value1", + "nativeSrc": "10336:6:23", + "nodeType": "YulIdentifier", + "src": "10336:6:23" + }, + { + "kind": "number", + "nativeSrc": "10344:4:23", + "nodeType": "YulLiteral", + "src": "10344:4:23", + "type": "", + "value": "0xff" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "10332:3:23", + "nodeType": "YulIdentifier", + "src": "10332:3:23" + }, + "nativeSrc": "10332:17:23", + "nodeType": "YulFunctionCall", + "src": "10332:17:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10305:6:23", + "nodeType": "YulIdentifier", + "src": "10305:6:23" + }, + "nativeSrc": "10305:45:23", + "nodeType": "YulFunctionCall", + "src": "10305:45:23" + }, + "nativeSrc": "10305:45:23", + "nodeType": "YulExpressionStatement", + "src": "10305:45:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "10370:9:23", + "nodeType": "YulIdentifier", + "src": "10370:9:23" + }, + { + "kind": "number", + "nativeSrc": "10381:2:23", + "nodeType": "YulLiteral", + "src": "10381:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10366:3:23", + "nodeType": "YulIdentifier", + "src": "10366:3:23" + }, + "nativeSrc": "10366:18:23", + "nodeType": "YulFunctionCall", + "src": "10366:18:23" + }, + { + "name": "value2", + "nativeSrc": "10386:6:23", + "nodeType": "YulIdentifier", + "src": "10386:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10359:6:23", + "nodeType": "YulIdentifier", + "src": "10359:6:23" + }, + "nativeSrc": "10359:34:23", + "nodeType": "YulFunctionCall", + "src": "10359:34:23" + }, + "nativeSrc": "10359:34:23", + "nodeType": "YulExpressionStatement", + "src": "10359:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "10413:9:23", + "nodeType": "YulIdentifier", + "src": "10413:9:23" + }, + { + "kind": "number", + "nativeSrc": "10424:2:23", + "nodeType": "YulLiteral", + "src": "10424:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10409:3:23", + "nodeType": "YulIdentifier", + "src": "10409:3:23" + }, + "nativeSrc": "10409:18:23", + "nodeType": "YulFunctionCall", + "src": "10409:18:23" + }, + { + "name": "value3", + "nativeSrc": "10429:6:23", + "nodeType": "YulIdentifier", + "src": "10429:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10402:6:23", + "nodeType": "YulIdentifier", + "src": "10402:6:23" + }, + "nativeSrc": "10402:34:23", + "nodeType": "YulFunctionCall", + "src": "10402:34:23" + }, + "nativeSrc": "10402:34:23", + "nodeType": "YulExpressionStatement", + "src": "10402:34:23" + } + ] + }, + "name": "abi_encode_tuple_t_bytes32_t_uint8_t_bytes32_t_bytes32__to_t_bytes32_t_uint8_t_bytes32_t_bytes32__fromStack_reversed", + "nativeSrc": "10044:398:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "10170:9:23", + "nodeType": "YulTypedName", + "src": "10170:9:23", + "type": "" + }, + { + "name": "value3", + "nativeSrc": "10181:6:23", + "nodeType": "YulTypedName", + "src": "10181:6:23", + "type": "" + }, + { + "name": "value2", + "nativeSrc": "10189:6:23", + "nodeType": "YulTypedName", + "src": "10189:6:23", + "type": "" + }, + { + "name": "value1", + "nativeSrc": "10197:6:23", + "nodeType": "YulTypedName", + "src": "10197:6:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "10205:6:23", + "nodeType": "YulTypedName", + "src": "10205:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "10216:4:23", + "nodeType": "YulTypedName", + "src": "10216:4:23", + "type": "" + } + ], + "src": "10044:398:23" + }, + { + "body": { + "nativeSrc": "10479:95:23", + "nodeType": "YulBlock", + "src": "10479:95:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10496:1:23", + "nodeType": "YulLiteral", + "src": "10496:1:23", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10503:3:23", + "nodeType": "YulLiteral", + "src": "10503:3:23", + "type": "", + "value": "224" + }, + { + "kind": "number", + "nativeSrc": "10508:10:23", + "nodeType": "YulLiteral", + "src": "10508:10:23", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "10499:3:23", + "nodeType": "YulIdentifier", + "src": "10499:3:23" + }, + "nativeSrc": "10499:20:23", + "nodeType": "YulFunctionCall", + "src": "10499:20:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10489:6:23", + "nodeType": "YulIdentifier", + "src": "10489:6:23" + }, + "nativeSrc": "10489:31:23", + "nodeType": "YulFunctionCall", + "src": "10489:31:23" + }, + "nativeSrc": "10489:31:23", + "nodeType": "YulExpressionStatement", + "src": "10489:31:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10536:1:23", + "nodeType": "YulLiteral", + "src": "10536:1:23", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nativeSrc": "10539:4:23", + "nodeType": "YulLiteral", + "src": "10539:4:23", + "type": "", + "value": "0x21" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10529:6:23", + "nodeType": "YulIdentifier", + "src": "10529:6:23" + }, + "nativeSrc": "10529:15:23", + "nodeType": "YulFunctionCall", + "src": "10529:15:23" + }, + "nativeSrc": "10529:15:23", + "nodeType": "YulExpressionStatement", + "src": "10529:15:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10560:1:23", + "nodeType": "YulLiteral", + "src": "10560:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "10563:4:23", + "nodeType": "YulLiteral", + "src": "10563:4:23", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "10553:6:23", + "nodeType": "YulIdentifier", + "src": "10553:6:23" + }, + "nativeSrc": "10553:15:23", + "nodeType": "YulFunctionCall", + "src": "10553:15:23" + }, + "nativeSrc": "10553:15:23", + "nodeType": "YulExpressionStatement", + "src": "10553:15:23" + } + ] + }, + "name": "panic_error_0x21", + "nativeSrc": "10447:127:23", + "nodeType": "YulFunctionDefinition", + "src": "10447:127:23" + }, + { + "body": { + "nativeSrc": "10680:76:23", + "nodeType": "YulBlock", + "src": "10680:76:23", + "statements": [ + { + "nativeSrc": "10690:26:23", + "nodeType": "YulAssignment", + "src": "10690:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "10702:9:23", + "nodeType": "YulIdentifier", + "src": "10702:9:23" + }, + { + "kind": "number", + "nativeSrc": "10713:2:23", + "nodeType": "YulLiteral", + "src": "10713:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10698:3:23", + "nodeType": "YulIdentifier", + "src": "10698:3:23" + }, + "nativeSrc": "10698:18:23", + "nodeType": "YulFunctionCall", + "src": "10698:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "10690:4:23", + "nodeType": "YulIdentifier", + "src": "10690:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "10732:9:23", + "nodeType": "YulIdentifier", + "src": "10732:9:23" + }, + { + "name": "value0", + "nativeSrc": "10743:6:23", + "nodeType": "YulIdentifier", + "src": "10743:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10725:6:23", + "nodeType": "YulIdentifier", + "src": "10725:6:23" + }, + "nativeSrc": "10725:25:23", + "nodeType": "YulFunctionCall", + "src": "10725:25:23" + }, + "nativeSrc": "10725:25:23", + "nodeType": "YulExpressionStatement", + "src": "10725:25:23" + } + ] + }, + "name": "abi_encode_tuple_t_bytes32__to_t_bytes32__fromStack_reversed", + "nativeSrc": "10579:177:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "10649:9:23", + "nodeType": "YulTypedName", + "src": "10649:9:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "10660:6:23", + "nodeType": "YulTypedName", + "src": "10660:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "10671:4:23", + "nodeType": "YulTypedName", + "src": "10671:4:23", + "type": "" + } + ], + "src": "10579:177:23" + }, + { + "body": { + "nativeSrc": "10816:325:23", + "nodeType": "YulBlock", + "src": "10816:325:23", + "statements": [ + { + "nativeSrc": "10826:22:23", + "nodeType": "YulAssignment", + "src": "10826:22:23", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10840:1:23", + "nodeType": "YulLiteral", + "src": "10840:1:23", + "type": "", + "value": "1" + }, + { + "name": "data", + "nativeSrc": "10843:4:23", + "nodeType": "YulIdentifier", + "src": "10843:4:23" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "10836:3:23", + "nodeType": "YulIdentifier", + "src": "10836:3:23" + }, + "nativeSrc": "10836:12:23", + "nodeType": "YulFunctionCall", + "src": "10836:12:23" + }, + "variableNames": [ + { + "name": "length", + "nativeSrc": "10826:6:23", + "nodeType": "YulIdentifier", + "src": "10826:6:23" + } + ] + }, + { + "nativeSrc": "10857:38:23", + "nodeType": "YulVariableDeclaration", + "src": "10857:38:23", + "value": { + "arguments": [ + { + "name": "data", + "nativeSrc": "10887:4:23", + "nodeType": "YulIdentifier", + "src": "10887:4:23" + }, + { + "kind": "number", + "nativeSrc": "10893:1:23", + "nodeType": "YulLiteral", + "src": "10893:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "10883:3:23", + "nodeType": "YulIdentifier", + "src": "10883:3:23" + }, + "nativeSrc": "10883:12:23", + "nodeType": "YulFunctionCall", + "src": "10883:12:23" + }, + "variables": [ + { + "name": "outOfPlaceEncoding", + "nativeSrc": "10861:18:23", + "nodeType": "YulTypedName", + "src": "10861:18:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "10934:31:23", + "nodeType": "YulBlock", + "src": "10934:31:23", + "statements": [ + { + "nativeSrc": "10936:27:23", + "nodeType": "YulAssignment", + "src": "10936:27:23", + "value": { + "arguments": [ + { + "name": "length", + "nativeSrc": "10950:6:23", + "nodeType": "YulIdentifier", + "src": "10950:6:23" + }, + { + "kind": "number", + "nativeSrc": "10958:4:23", + "nodeType": "YulLiteral", + "src": "10958:4:23", + "type": "", + "value": "0x7f" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "10946:3:23", + "nodeType": "YulIdentifier", + "src": "10946:3:23" + }, + "nativeSrc": "10946:17:23", + "nodeType": "YulFunctionCall", + "src": "10946:17:23" + }, + "variableNames": [ + { + "name": "length", + "nativeSrc": "10936:6:23", + "nodeType": "YulIdentifier", + "src": "10936:6:23" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nativeSrc": "10914:18:23", + "nodeType": "YulIdentifier", + "src": "10914:18:23" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "10907:6:23", + "nodeType": "YulIdentifier", + "src": "10907:6:23" + }, + "nativeSrc": "10907:26:23", + "nodeType": "YulFunctionCall", + "src": "10907:26:23" + }, + "nativeSrc": "10904:61:23", + "nodeType": "YulIf", + "src": "10904:61:23" + }, + { + "body": { + "nativeSrc": "11024:111:23", + "nodeType": "YulBlock", + "src": "11024:111:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11045:1:23", + "nodeType": "YulLiteral", + "src": "11045:1:23", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11052:3:23", + "nodeType": "YulLiteral", + "src": "11052:3:23", + "type": "", + "value": "224" + }, + { + "kind": "number", + "nativeSrc": "11057:10:23", + "nodeType": "YulLiteral", + "src": "11057:10:23", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "11048:3:23", + "nodeType": "YulIdentifier", + "src": "11048:3:23" + }, + "nativeSrc": "11048:20:23", + "nodeType": "YulFunctionCall", + "src": "11048:20:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "11038:6:23", + "nodeType": "YulIdentifier", + "src": "11038:6:23" + }, + "nativeSrc": "11038:31:23", + "nodeType": "YulFunctionCall", + "src": "11038:31:23" + }, + "nativeSrc": "11038:31:23", + "nodeType": "YulExpressionStatement", + "src": "11038:31:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11089:1:23", + "nodeType": "YulLiteral", + "src": "11089:1:23", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nativeSrc": "11092:4:23", + "nodeType": "YulLiteral", + "src": "11092:4:23", + "type": "", + "value": "0x22" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "11082:6:23", + "nodeType": "YulIdentifier", + "src": "11082:6:23" + }, + "nativeSrc": "11082:15:23", + "nodeType": "YulFunctionCall", + "src": "11082:15:23" + }, + "nativeSrc": "11082:15:23", + "nodeType": "YulExpressionStatement", + "src": "11082:15:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11117:1:23", + "nodeType": "YulLiteral", + "src": "11117:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "11120:4:23", + "nodeType": "YulLiteral", + "src": "11120:4:23", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "11110:6:23", + "nodeType": "YulIdentifier", + "src": "11110:6:23" + }, + "nativeSrc": "11110:15:23", + "nodeType": "YulFunctionCall", + "src": "11110:15:23" + }, + "nativeSrc": "11110:15:23", + "nodeType": "YulExpressionStatement", + "src": "11110:15:23" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nativeSrc": "10980:18:23", + "nodeType": "YulIdentifier", + "src": "10980:18:23" + }, + { + "arguments": [ + { + "name": "length", + "nativeSrc": "11003:6:23", + "nodeType": "YulIdentifier", + "src": "11003:6:23" + }, + { + "kind": "number", + "nativeSrc": "11011:2:23", + "nodeType": "YulLiteral", + "src": "11011:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "11000:2:23", + "nodeType": "YulIdentifier", + "src": "11000:2:23" + }, + "nativeSrc": "11000:14:23", + "nodeType": "YulFunctionCall", + "src": "11000:14:23" + } + ], + "functionName": { + "name": "eq", + "nativeSrc": "10977:2:23", + "nodeType": "YulIdentifier", + "src": "10977:2:23" + }, + "nativeSrc": "10977:38:23", + "nodeType": "YulFunctionCall", + "src": "10977:38:23" + }, + "nativeSrc": "10974:161:23", + "nodeType": "YulIf", + "src": "10974:161:23" + } + ] + }, + "name": "extract_byte_array_length", + "nativeSrc": "10761:380:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "data", + "nativeSrc": "10796:4:23", + "nodeType": "YulTypedName", + "src": "10796:4:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "length", + "nativeSrc": "10805:6:23", + "nodeType": "YulTypedName", + "src": "10805:6:23", + "type": "" + } + ], + "src": "10761:380:23" + }, + { + "body": { + "nativeSrc": "11359:276:23", + "nodeType": "YulBlock", + "src": "11359:276:23", + "statements": [ + { + "nativeSrc": "11369:27:23", + "nodeType": "YulAssignment", + "src": "11369:27:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "11381:9:23", + "nodeType": "YulIdentifier", + "src": "11381:9:23" + }, + { + "kind": "number", + "nativeSrc": "11392:3:23", + "nodeType": "YulLiteral", + "src": "11392:3:23", + "type": "", + "value": "160" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "11377:3:23", + "nodeType": "YulIdentifier", + "src": "11377:3:23" + }, + "nativeSrc": "11377:19:23", + "nodeType": "YulFunctionCall", + "src": "11377:19:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "11369:4:23", + "nodeType": "YulIdentifier", + "src": "11369:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "11412:9:23", + "nodeType": "YulIdentifier", + "src": "11412:9:23" + }, + { + "name": "value0", + "nativeSrc": "11423:6:23", + "nodeType": "YulIdentifier", + "src": "11423:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "11405:6:23", + "nodeType": "YulIdentifier", + "src": "11405:6:23" + }, + "nativeSrc": "11405:25:23", + "nodeType": "YulFunctionCall", + "src": "11405:25:23" + }, + "nativeSrc": "11405:25:23", + "nodeType": "YulExpressionStatement", + "src": "11405:25:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "11450:9:23", + "nodeType": "YulIdentifier", + "src": "11450:9:23" + }, + { + "kind": "number", + "nativeSrc": "11461:2:23", + "nodeType": "YulLiteral", + "src": "11461:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "11446:3:23", + "nodeType": "YulIdentifier", + "src": "11446:3:23" + }, + "nativeSrc": "11446:18:23", + "nodeType": "YulFunctionCall", + "src": "11446:18:23" + }, + { + "name": "value1", + "nativeSrc": "11466:6:23", + "nodeType": "YulIdentifier", + "src": "11466:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "11439:6:23", + "nodeType": "YulIdentifier", + "src": "11439:6:23" + }, + "nativeSrc": "11439:34:23", + "nodeType": "YulFunctionCall", + "src": "11439:34:23" + }, + "nativeSrc": "11439:34:23", + "nodeType": "YulExpressionStatement", + "src": "11439:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "11493:9:23", + "nodeType": "YulIdentifier", + "src": "11493:9:23" + }, + { + "kind": "number", + "nativeSrc": "11504:2:23", + "nodeType": "YulLiteral", + "src": "11504:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "11489:3:23", + "nodeType": "YulIdentifier", + "src": "11489:3:23" + }, + "nativeSrc": "11489:18:23", + "nodeType": "YulFunctionCall", + "src": "11489:18:23" + }, + { + "name": "value2", + "nativeSrc": "11509:6:23", + "nodeType": "YulIdentifier", + "src": "11509:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "11482:6:23", + "nodeType": "YulIdentifier", + "src": "11482:6:23" + }, + "nativeSrc": "11482:34:23", + "nodeType": "YulFunctionCall", + "src": "11482:34:23" + }, + "nativeSrc": "11482:34:23", + "nodeType": "YulExpressionStatement", + "src": "11482:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "11536:9:23", + "nodeType": "YulIdentifier", + "src": "11536:9:23" + }, + { + "kind": "number", + "nativeSrc": "11547:2:23", + "nodeType": "YulLiteral", + "src": "11547:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "11532:3:23", + "nodeType": "YulIdentifier", + "src": "11532:3:23" + }, + "nativeSrc": "11532:18:23", + "nodeType": "YulFunctionCall", + "src": "11532:18:23" + }, + { + "name": "value3", + "nativeSrc": "11552:6:23", + "nodeType": "YulIdentifier", + "src": "11552:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "11525:6:23", + "nodeType": "YulIdentifier", + "src": "11525:6:23" + }, + "nativeSrc": "11525:34:23", + "nodeType": "YulFunctionCall", + "src": "11525:34:23" + }, + "nativeSrc": "11525:34:23", + "nodeType": "YulExpressionStatement", + "src": "11525:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "11579:9:23", + "nodeType": "YulIdentifier", + "src": "11579:9:23" + }, + { + "kind": "number", + "nativeSrc": "11590:3:23", + "nodeType": "YulLiteral", + "src": "11590:3:23", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "11575:3:23", + "nodeType": "YulIdentifier", + "src": "11575:3:23" + }, + "nativeSrc": "11575:19:23", + "nodeType": "YulFunctionCall", + "src": "11575:19:23" + }, + { + "arguments": [ + { + "name": "value4", + "nativeSrc": "11600:6:23", + "nodeType": "YulIdentifier", + "src": "11600:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11616:3:23", + "nodeType": "YulLiteral", + "src": "11616:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "11621:1:23", + "nodeType": "YulLiteral", + "src": "11621:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "11612:3:23", + "nodeType": "YulIdentifier", + "src": "11612:3:23" + }, + "nativeSrc": "11612:11:23", + "nodeType": "YulFunctionCall", + "src": "11612:11:23" + }, + { + "kind": "number", + "nativeSrc": "11625:1:23", + "nodeType": "YulLiteral", + "src": "11625:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "11608:3:23", + "nodeType": "YulIdentifier", + "src": "11608:3:23" + }, + "nativeSrc": "11608:19:23", + "nodeType": "YulFunctionCall", + "src": "11608:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "11596:3:23", + "nodeType": "YulIdentifier", + "src": "11596:3:23" + }, + "nativeSrc": "11596:32:23", + "nodeType": "YulFunctionCall", + "src": "11596:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "11568:6:23", + "nodeType": "YulIdentifier", + "src": "11568:6:23" + }, + "nativeSrc": "11568:61:23", + "nodeType": "YulFunctionCall", + "src": "11568:61:23" + }, + "nativeSrc": "11568:61:23", + "nodeType": "YulExpressionStatement", + "src": "11568:61:23" + } + ] + }, + "name": "abi_encode_tuple_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__to_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__fromStack_reversed", + "nativeSrc": "11146:489:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "11296:9:23", + "nodeType": "YulTypedName", + "src": "11296:9:23", + "type": "" + }, + { + "name": "value4", + "nativeSrc": "11307:6:23", + "nodeType": "YulTypedName", + "src": "11307:6:23", + "type": "" + }, + { + "name": "value3", + "nativeSrc": "11315:6:23", + "nodeType": "YulTypedName", + "src": "11315:6:23", + "type": "" + }, + { + "name": "value2", + "nativeSrc": "11323:6:23", + "nodeType": "YulTypedName", + "src": "11323:6:23", + "type": "" + }, + { + "name": "value1", + "nativeSrc": "11331:6:23", + "nodeType": "YulTypedName", + "src": "11331:6:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "11339:6:23", + "nodeType": "YulTypedName", + "src": "11339:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "11350:4:23", + "nodeType": "YulTypedName", + "src": "11350:4:23", + "type": "" + } + ], + "src": "11146:489:23" + } + ] + }, + "contents": "{\n { }\n function abi_decode_tuple_t_struct$_ExecuteParams_$8182_calldata_ptr(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n let offset := calldataload(headStart)\n if gt(offset, 0xffffffffffffffff) { revert(0, 0) }\n let _1 := add(headStart, offset)\n if slt(sub(dataEnd, _1), 448) { revert(0, 0) }\n value0 := _1\n }\n function abi_encode_tuple_t_address__to_t_address__fromStack_reversed(headStart, value0) -> tail\n {\n tail := add(headStart, 32)\n mstore(headStart, and(value0, sub(shl(160, 1), 1)))\n }\n function abi_encode_string(value, pos) -> end\n {\n let length := mload(value)\n mstore(pos, length)\n mcopy(add(pos, 0x20), add(value, 0x20), length)\n mstore(add(add(pos, length), 0x20), 0)\n end := add(add(pos, and(add(length, 31), not(31))), 0x20)\n }\n function abi_encode_tuple_t_bytes1_t_string_memory_ptr_t_string_memory_ptr_t_uint256_t_address_t_bytes32_t_array$_t_uint256_$dyn_memory_ptr__to_t_bytes1_t_string_memory_ptr_t_string_memory_ptr_t_uint256_t_address_t_bytes32_t_array$_t_uint256_$dyn_memory_ptr__fromStack_reversed(headStart, value6, value5, value4, value3, value2, value1, value0) -> tail\n {\n mstore(headStart, and(value0, shl(248, 255)))\n mstore(add(headStart, 32), 224)\n let tail_1 := abi_encode_string(value1, add(headStart, 224))\n mstore(add(headStart, 64), sub(tail_1, headStart))\n let tail_2 := abi_encode_string(value2, tail_1)\n mstore(add(headStart, 96), value3)\n mstore(add(headStart, 128), and(value4, sub(shl(160, 1), 1)))\n mstore(add(headStart, 160), value5)\n mstore(add(headStart, 192), sub(tail_2, headStart))\n let pos := tail_2\n let length := mload(value6)\n mstore(tail_2, length)\n pos := add(tail_2, 32)\n let srcPtr := add(value6, 32)\n let i := 0\n for { } lt(i, length) { i := add(i, 1) }\n {\n mstore(pos, mload(srcPtr))\n pos := add(pos, 32)\n srcPtr := add(srcPtr, 32)\n }\n tail := pos\n }\n function abi_decode_address(offset) -> value\n {\n value := calldataload(offset)\n if iszero(eq(value, and(value, sub(shl(160, 1), 1)))) { revert(0, 0) }\n }\n function abi_decode_tuple_t_addresst_uint256(headStart, dataEnd) -> value0, value1\n {\n if slt(sub(dataEnd, headStart), 64) { revert(0, 0) }\n value0 := abi_decode_address(headStart)\n let value := 0\n value := calldataload(add(headStart, 32))\n value1 := value\n }\n function abi_encode_tuple_t_bool__to_t_bool__fromStack_reversed(headStart, value0) -> tail\n {\n tail := add(headStart, 32)\n mstore(headStart, iszero(iszero(value0)))\n }\n function abi_decode_tuple_t_uint256(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n let value := 0\n value := calldataload(headStart)\n value0 := value\n }\n function abi_decode_tuple_t_address(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n value0 := abi_decode_address(headStart)\n }\n function abi_encode_tuple_t_stringliteral_110461b12e459dc76e692e7a47f9621cf45c7d48020c3c7b2066107cdf1f52ae__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 13)\n mstore(add(headStart, 64), \"Invalid owner\")\n tail := add(headStart, 96)\n }\n function abi_encode_tuple_t_stringliteral_5e70ebd1d4072d337a7fabaa7bda70fa2633d6e3f89d5cb725a16b10d07e54c6__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 13)\n mstore(add(headStart, 64), \"Invalid token\")\n tail := add(headStart, 96)\n }\n function abi_encode_tuple_t_stringliteral_15d72127d094a30af360ead73641c61eda3d745ce4d04d12675a5e9a899f8b21__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 10)\n mstore(add(headStart, 64), \"Nonce used\")\n tail := add(headStart, 96)\n }\n function abi_encode_tuple_t_stringliteral_27859e47e6c2167c8e8d38addfca16b9afb9d8e9750b6a1e67c29196d4d99fae__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 15)\n mstore(add(headStart, 64), \"Payload expired\")\n tail := add(headStart, 96)\n }\n function access_calldata_tail_t_bytes_calldata_ptr(base_ref, ptr_to_tail) -> addr, length\n {\n let rel_offset_of_tail := calldataload(ptr_to_tail)\n if iszero(slt(rel_offset_of_tail, add(sub(calldatasize(), base_ref), not(30)))) { revert(0, 0) }\n let addr_1 := add(base_ref, rel_offset_of_tail)\n length := calldataload(addr_1)\n if gt(length, 0xffffffffffffffff) { revert(0, 0) }\n addr := add(addr_1, 0x20)\n if sgt(addr, sub(calldatasize(), length)) { revert(0, 0) }\n }\n function abi_decode_tuple_t_uint8(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n let value := calldataload(headStart)\n if iszero(eq(value, and(value, 0xff))) { revert(0, 0) }\n value0 := value\n }\n function abi_encode_tuple_t_stringliteral_31734eed34fab74fa1579246aaad104a344891a284044483c0c5a792a9f83a72__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 11)\n mstore(add(headStart, 64), \"Invalid sig\")\n tail := add(headStart, 96)\n }\n function abi_encode_tuple_t_stringliteral_a793dc5bde52ab2d5349f1208a34905b1d68ab9298f549a2e514542cba0a8c76__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 28)\n mstore(add(headStart, 64), \"Incorrect ETH value provided\")\n tail := add(headStart, 96)\n }\n function abi_encode_tuple_t_stringliteral_066ad49a0ed9e5d6a9f3c20fca13a038f0a5d629f0aaf09d634ae2a7c232ac2b__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 11)\n mstore(add(headStart, 64), \"Call failed\")\n tail := add(headStart, 96)\n }\n function abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed(headStart, value0) -> tail\n {\n tail := add(headStart, 32)\n mstore(headStart, value0)\n }\n function panic_error_0x41()\n {\n mstore(0, shl(224, 0x4e487b71))\n mstore(4, 0x41)\n revert(0, 0x24)\n }\n function abi_encode_tuple_packed_t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470__to_t_bytes_memory_ptr__nonPadded_inplace_fromStack_reversed(pos) -> end\n { end := pos }\n function abi_encode_tuple_t_stringliteral_c7c2be2f1b63a3793f6e2d447ce95ba2239687186a7fd6b5268a969dcdb42dcd__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 19)\n mstore(add(headStart, 64), \"ETH transfer failed\")\n tail := add(headStart, 96)\n }\n function abi_encode_tuple_t_bytes32_t_address_t_address_t_address_t_uint256_t_bytes32_t_uint256_t_uint256_t_uint256__to_t_bytes32_t_address_t_address_t_address_t_uint256_t_bytes32_t_uint256_t_uint256_t_uint256__fromStack_reversed(headStart, value8, value7, value6, value5, value4, value3, value2, value1, value0) -> tail\n {\n tail := add(headStart, 288)\n mstore(headStart, value0)\n mstore(add(headStart, 32), and(value1, sub(shl(160, 1), 1)))\n mstore(add(headStart, 64), and(value2, sub(shl(160, 1), 1)))\n mstore(add(headStart, 96), and(value3, sub(shl(160, 1), 1)))\n mstore(add(headStart, 128), value4)\n mstore(add(headStart, 160), value5)\n mstore(add(headStart, 192), value6)\n mstore(add(headStart, 224), value7)\n mstore(add(headStart, 256), value8)\n }\n function abi_encode_tuple_t_address_t_address_t_uint256_t_uint256_t_uint8_t_bytes32_t_bytes32__to_t_address_t_address_t_uint256_t_uint256_t_uint8_t_bytes32_t_bytes32__fromStack_reversed(headStart, value6, value5, value4, value3, value2, value1, value0) -> tail\n {\n tail := add(headStart, 224)\n mstore(headStart, and(value0, sub(shl(160, 1), 1)))\n mstore(add(headStart, 32), and(value1, sub(shl(160, 1), 1)))\n mstore(add(headStart, 64), value2)\n mstore(add(headStart, 96), value3)\n mstore(add(headStart, 128), and(value4, 0xff))\n mstore(add(headStart, 160), value5)\n mstore(add(headStart, 192), value6)\n }\n function abi_encode_tuple_t_address_t_address__to_t_address_t_address__fromStack_reversed(headStart, value1, value0) -> tail\n {\n tail := add(headStart, 64)\n mstore(headStart, and(value0, sub(shl(160, 1), 1)))\n mstore(add(headStart, 32), and(value1, sub(shl(160, 1), 1)))\n }\n function abi_decode_tuple_t_uint256_fromMemory(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n value0 := mload(headStart)\n }\n function abi_encode_tuple_t_stringliteral_0acc7f0c8df1a6717d2b423ae4591ac135687015764ac37dd4cf0150a9322b15__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 40)\n mstore(add(headStart, 64), \"Permit failed and insufficient a\")\n mstore(add(headStart, 96), \"llowance\")\n tail := add(headStart, 128)\n }\n function abi_encode_tuple_packed_t_bytes_memory_ptr__to_t_bytes_memory_ptr__nonPadded_inplace_fromStack_reversed(pos, value0) -> end\n {\n let length := mload(value0)\n mcopy(pos, add(value0, 0x20), length)\n let _1 := add(pos, length)\n mstore(_1, 0)\n end := _1\n }\n function abi_encode_tuple_t_bytes32_t_uint8_t_bytes32_t_bytes32__to_t_bytes32_t_uint8_t_bytes32_t_bytes32__fromStack_reversed(headStart, value3, value2, value1, value0) -> tail\n {\n tail := add(headStart, 128)\n mstore(headStart, value0)\n mstore(add(headStart, 32), and(value1, 0xff))\n mstore(add(headStart, 64), value2)\n mstore(add(headStart, 96), value3)\n }\n function panic_error_0x21()\n {\n mstore(0, shl(224, 0x4e487b71))\n mstore(4, 0x21)\n revert(0, 0x24)\n }\n function abi_encode_tuple_t_bytes32__to_t_bytes32__fromStack_reversed(headStart, value0) -> tail\n {\n tail := add(headStart, 32)\n mstore(headStart, value0)\n }\n function extract_byte_array_length(data) -> length\n {\n length := shr(1, data)\n let outOfPlaceEncoding := and(data, 1)\n if iszero(outOfPlaceEncoding) { length := and(length, 0x7f) }\n if eq(outOfPlaceEncoding, lt(length, 32))\n {\n mstore(0, shl(224, 0x4e487b71))\n mstore(4, 0x22)\n revert(0, 0x24)\n }\n }\n function abi_encode_tuple_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__to_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__fromStack_reversed(headStart, value4, value3, value2, value1, value0) -> tail\n {\n tail := add(headStart, 160)\n mstore(headStart, value0)\n mstore(add(headStart, 32), value1)\n mstore(add(headStart, 64), value2)\n mstore(add(headStart, 96), value3)\n mstore(add(headStart, 128), and(value4, sub(shl(160, 1), 1)))\n }\n}", + "id": 23, + "language": "Yul", + "name": "#utility.yul" + } + ], + "immutableReferences": { + "4158": [ + { + "length": 32, + "start": 4419 + } + ], + "4160": [ + { + "length": 32, + "start": 4377 + } + ], + "4162": [ + { + "length": 32, + "start": 4335 + } + ], + "4164": [ + { + "length": 32, + "start": 4500 + } + ], + "4166": [ + { + "length": 32, + "start": 4540 + } + ], + "4169": [ + { + "length": 32, + "start": 3323 + } + ], + "4172": [ + { + "length": 32, + "start": 3373 + } + ], + "8147": [ + { + "length": 32, + "start": 215 + }, + { + "length": 32, + "start": 1317 + }, + { + "length": 32, + "start": 1524 + }, + { + "length": 32, + "start": 2384 + }, + { + "length": 32, + "start": 3064 + } + ] + }, + "linkReferences": {}, + "object": "608060405260043610610092575f3560e01c80639e281a98116100575780639e281a9814610159578063d850124e14610178578063dcb79457146101c1578063f14210a6146101e0578063f2fde38b146101ff575f5ffd5b80632af83bfe1461009d578063715018a6146100b257806375bd6863146100c657806384b0196e146101165780638da5cb5b1461013d575f5ffd5b3661009957005b5f5ffd5b6100b06100ab3660046112dd565b61021e565b005b3480156100bd575f5ffd5b506100b06106ae565b3480156100d1575f5ffd5b506100f97f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b348015610121575f5ffd5b5061012a6106c1565b60405161010d979695949392919061134a565b348015610148575f5ffd5b505f546001600160a01b03166100f9565b348015610164575f5ffd5b506100b06101733660046113fb565b610703565b348015610183575f5ffd5b506101b16101923660046113fb565b600360209081525f928352604080842090915290825290205460ff1681565b604051901515815260200161010d565b3480156101cc575f5ffd5b506101b16101db3660046113fb565b61078b565b3480156101eb575f5ffd5b506100b06101fa366004611423565b6107b8565b34801561020a575f5ffd5b506100b061021936600461143a565b6108a7565b6102266108e1565b5f610237604083016020840161143a565b90506101208201356001600160a01b03821661028a5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21037bbb732b960991b60448201526064015b60405180910390fd5b5f610298602085018561143a565b6001600160a01b0316036102de5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2103a37b5b2b760991b6044820152606401610281565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff161561033e5760405162461bcd60e51b815260206004820152600a602482015269139bdb98d9481d5cd95960b21b6044820152606401610281565b8261014001354211156103855760405162461bcd60e51b815260206004820152600f60248201526e14185e5b1bd85908195e1c1a5c9959608a1b6044820152606401610281565b5f6103ee83610397602087018761143a565b60408701356103a960e0890189611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250505050610100890135876101408b013561090f565b90506001600160a01b038316610421826104106101808801610160890161149d565b876101800135886101a001356109db565b6001600160a01b0316146104655760405162461bcd60e51b815260206004820152600b60248201526a496e76616c69642073696760a81b6044820152606401610281565b83610100013534146104b95760405162461bcd60e51b815260206004820152601c60248201527f496e636f7272656374204554482076616c75652070726f7669646564000000006044820152606401610281565b6001600160a01b0383165f9081526003602090815260408083208584528252909120805460ff19166001179055610520906104f69086018661143a565b846040870135606088013561051160a08a0160808b0161149d565b8960a001358a60c00135610a07565b6105667f00000000000000000000000000000000000000000000000000000000000000006040860135610556602088018861143a565b6001600160a01b03169190610b75565b5f6105b261057760e0870187611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250349250610bf4915050565b9050806105ef5760405162461bcd60e51b815260206004820152600b60248201526a10d85b1b0819985a5b195960aa1b6044820152606401610281565b6106217f00000000000000000000000000000000000000000000000000000000000000005f610556602089018961143a565b61062e602086018661143a565b6001600160a01b0316846001600160a01b03167f78129a649632642d8e9f346c85d9efb70d32d50a36774c4585491a9228bbd350876040013560405161067691815260200190565b60405180910390a3505050506106ab60017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b50565b6106b6610c79565b6106bf5f610ca5565b565b5f6060805f5f5f60606106d2610cf4565b6106da610d26565b604080515f80825260208201909252600f60f81b9b939a50919850469750309650945092509050565b61070b610c79565b61073061071f5f546001600160a01b031690565b6001600160a01b0384169083610d53565b5f546001600160a01b03166001600160a01b0316826001600160a01b03167fa0524ee0fd8662d6c046d199da2a6d3dc49445182cec055873a5bb9c2843c8e08360405161077f91815260200190565b60405180910390a35050565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff165b92915050565b6107c0610c79565b5f80546040516001600160a01b039091169083908381818185875af1925050503d805f811461080a576040519150601f19603f3d011682016040523d82523d5f602084013e61080f565b606091505b50509050806108565760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610281565b5f546001600160a01b03166001600160a01b03167f6148672a948a12b8e0bf92a9338349b9ac890fad62a234abaf0a4da99f62cfcc8360405161089b91815260200190565b60405180910390a25050565b6108af610c79565b6001600160a01b0381166108d857604051631e4fbdf760e01b81525f6004820152602401610281565b6106ab81610ca5565b6108e9610d60565b60027f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b8351602080860191909120604080517ff0543e2024fd0ae16ccb842686c2733758ec65acfd69fb599c05b286f8db8844938101939093526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691840191909152808a1660608401528816608083015260a0820187905260c082015260e08101849052610100810183905261012081018290525f906109cf906101400160405160208183030381529060405280519060200120610da2565b98975050505050505050565b5f5f5f5f6109eb88888888610dce565b9250925092506109fb8282610e96565b50909695505050505050565b60405163d505accf60e01b81526001600160a01b038781166004830152306024830152604482018790526064820186905260ff8516608483015260a4820184905260c4820183905288169063d505accf9060e4015f604051808303815f87803b158015610a72575f5ffd5b505af1925050508015610a83575060015b610b5757604051636eb1769f60e11b81526001600160a01b03878116600483015230602483015286919089169063dd62ed3e90604401602060405180830381865afa158015610ad4573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610af891906114bd565b1015610b575760405162461bcd60e51b815260206004820152602860248201527f5065726d6974206661696c656420616e6420696e73756666696369656e7420616044820152676c6c6f77616e636560c01b6064820152608401610281565b610b6c6001600160a01b038816873088610f52565b50505050505050565b610b818383835f610f8e565b610bef57610b9283835f6001610f8e565b610bba57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b610bc78383836001610f8e565b610bef57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b505050565b5f5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168385604051610c2f91906114d4565b5f6040518083038185875af1925050503d805f8114610c69576040519150601f19603f3d011682016040523d82523d5f602084013e610c6e565b606091505b509095945050505050565b5f546001600160a01b031633146106bf5760405163118cdaa760e01b8152336004820152602401610281565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006001610ff0565b905090565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006002610ff0565b610bc78383836001611099565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00546002036106bf57604051633ee5aeb560e01b815260040160405180910390fd5b5f6107b2610dae6110e3565b8360405161190160f01b8152600281019290925260228201526042902090565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115610e0757505f91506003905082610e8c565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015610e58573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b038116610e8357505f925060019150829050610e8c565b92505f91508190505b9450945094915050565b5f826003811115610ea957610ea96114ea565b03610eb2575050565b6001826003811115610ec657610ec66114ea565b03610ee45760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115610ef857610ef86114ea565b03610f195760405163fce698f760e01b815260048101829052602401610281565b6003826003811115610f2d57610f2d6114ea565b03610f4e576040516335e2f38360e21b815260048101829052602401610281565b5050565b610f6084848484600161120c565b610f8857604051635274afe760e01b81526001600160a01b0385166004820152602401610281565b50505050565b60405163095ea7b360e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f873b113d1516831692505b60405250949350505050565b606060ff831461100a5761100383611279565b90506107b2565b818054611016906114fe565b80601f0160208091040260200160405190810160405280929190818152602001828054611042906114fe565b801561108d5780601f106110645761010080835404028352916020019161108d565b820191905f5260205f20905b81548152906001019060200180831161107057829003601f168201915b505050505090506107b2565b60405163a9059cbb60e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561113b57507f000000000000000000000000000000000000000000000000000000000000000046145b1561116557507f000000000000000000000000000000000000000000000000000000000000000090565b610d21604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b6040516323b872dd60e01b5f8181526001600160a01b038781166004528616602452604485905291602083606481808c5af1925060015f5114831661126857838315161561125c573d5f823e3d81fd5b5f883b113d1516831692505b604052505f60605295945050505050565b60605f611285836112b6565b6040805160208082528183019092529192505f91906020820181803683375050509182525060208101929092525090565b5f60ff8216601f8111156107b257604051632cd44ac360e21b815260040160405180910390fd5b5f602082840312156112ed575f5ffd5b813567ffffffffffffffff811115611303575f5ffd5b82016101c08185031215611315575f5ffd5b9392505050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b60ff60f81b8816815260e060208201525f61136860e083018961131c565b828103604084015261137a818961131c565b606084018890526001600160a01b038716608085015260a0840186905283810360c0850152845180825260208087019350909101905f5b818110156113cf5783518352602093840193909201916001016113b1565b50909b9a5050505050505050505050565b80356001600160a01b03811681146113f6575f5ffd5b919050565b5f5f6040838503121561140c575f5ffd5b611415836113e0565b946020939093013593505050565b5f60208284031215611433575f5ffd5b5035919050565b5f6020828403121561144a575f5ffd5b611315826113e0565b5f5f8335601e19843603018112611468575f5ffd5b83018035915067ffffffffffffffff821115611482575f5ffd5b602001915036819003821315611496575f5ffd5b9250929050565b5f602082840312156114ad575f5ffd5b813560ff81168114611315575f5ffd5b5f602082840312156114cd575f5ffd5b5051919050565b5f82518060208501845e5f920191825250919050565b634e487b7160e01b5f52602160045260245ffd5b600181811c9082168061151257607f821691505b60208210810361153057634e487b7160e01b5f52602260045260245ffd5b5091905056fea26469706673582212209c34db2f6f83af136a5340cce7fe8ef554ea8eb633656fbf9bff3bd731aec40f64736f6c634300081c0033", + "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x92 JUMPI PUSH0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x9E281A98 GT PUSH2 0x57 JUMPI DUP1 PUSH4 0x9E281A98 EQ PUSH2 0x159 JUMPI DUP1 PUSH4 0xD850124E EQ PUSH2 0x178 JUMPI DUP1 PUSH4 0xDCB79457 EQ PUSH2 0x1C1 JUMPI DUP1 PUSH4 0xF14210A6 EQ PUSH2 0x1E0 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x1FF JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP1 PUSH4 0x2AF83BFE EQ PUSH2 0x9D JUMPI DUP1 PUSH4 0x715018A6 EQ PUSH2 0xB2 JUMPI DUP1 PUSH4 0x75BD6863 EQ PUSH2 0xC6 JUMPI DUP1 PUSH4 0x84B0196E EQ PUSH2 0x116 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x13D JUMPI PUSH0 PUSH0 REVERT JUMPDEST CALLDATASIZE PUSH2 0x99 JUMPI STOP JUMPDEST PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0xB0 PUSH2 0xAB CALLDATASIZE PUSH1 0x4 PUSH2 0x12DD JUMP JUMPDEST PUSH2 0x21E JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xBD JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xB0 PUSH2 0x6AE JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xD1 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xF9 PUSH32 0x0 DUP2 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP2 AND DUP2 MSTORE PUSH1 0x20 ADD JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x121 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x12A PUSH2 0x6C1 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x10D SWAP8 SWAP7 SWAP6 SWAP5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x134A JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x148 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH2 0xF9 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x164 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xB0 PUSH2 0x173 CALLDATASIZE PUSH1 0x4 PUSH2 0x13FB JUMP JUMPDEST PUSH2 0x703 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x183 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x1B1 PUSH2 0x192 CALLDATASIZE PUSH1 0x4 PUSH2 0x13FB JUMP JUMPDEST PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x40 MLOAD SWAP1 ISZERO ISZERO DUP2 MSTORE PUSH1 0x20 ADD PUSH2 0x10D JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1CC JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x1B1 PUSH2 0x1DB CALLDATASIZE PUSH1 0x4 PUSH2 0x13FB JUMP JUMPDEST PUSH2 0x78B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1EB JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xB0 PUSH2 0x1FA CALLDATASIZE PUSH1 0x4 PUSH2 0x1423 JUMP JUMPDEST PUSH2 0x7B8 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x20A JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xB0 PUSH2 0x219 CALLDATASIZE PUSH1 0x4 PUSH2 0x143A JUMP JUMPDEST PUSH2 0x8A7 JUMP JUMPDEST PUSH2 0x226 PUSH2 0x8E1 JUMP JUMPDEST PUSH0 PUSH2 0x237 PUSH1 0x40 DUP4 ADD PUSH1 0x20 DUP5 ADD PUSH2 0x143A JUMP JUMPDEST SWAP1 POP PUSH2 0x120 DUP3 ADD CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP3 AND PUSH2 0x28A JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xD PUSH1 0x24 DUP3 ADD MSTORE PUSH13 0x24B73B30B634B21037BBB732B9 PUSH1 0x99 SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH0 PUSH2 0x298 PUSH1 0x20 DUP6 ADD DUP6 PUSH2 0x143A JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND SUB PUSH2 0x2DE JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xD PUSH1 0x24 DUP3 ADD MSTORE PUSH13 0x24B73B30B634B2103A37B5B2B7 PUSH1 0x99 SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP3 AND PUSH0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP5 DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x33E JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xA PUSH1 0x24 DUP3 ADD MSTORE PUSH10 0x139BDB98D9481D5CD959 PUSH1 0xB2 SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST DUP3 PUSH2 0x140 ADD CALLDATALOAD TIMESTAMP GT ISZERO PUSH2 0x385 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xF PUSH1 0x24 DUP3 ADD MSTORE PUSH15 0x14185E5B1BD85908195E1C1A5C9959 PUSH1 0x8A SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH0 PUSH2 0x3EE DUP4 PUSH2 0x397 PUSH1 0x20 DUP8 ADD DUP8 PUSH2 0x143A JUMP JUMPDEST PUSH1 0x40 DUP8 ADD CALLDATALOAD PUSH2 0x3A9 PUSH1 0xE0 DUP10 ADD DUP10 PUSH2 0x1453 JUMP JUMPDEST DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY PUSH0 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP POP POP POP PUSH2 0x100 DUP10 ADD CALLDATALOAD DUP8 PUSH2 0x140 DUP12 ADD CALLDATALOAD PUSH2 0x90F JUMP JUMPDEST SWAP1 POP PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP4 AND PUSH2 0x421 DUP3 PUSH2 0x410 PUSH2 0x180 DUP9 ADD PUSH2 0x160 DUP10 ADD PUSH2 0x149D JUMP JUMPDEST DUP8 PUSH2 0x180 ADD CALLDATALOAD DUP9 PUSH2 0x1A0 ADD CALLDATALOAD PUSH2 0x9DB JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND EQ PUSH2 0x465 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xB PUSH1 0x24 DUP3 ADD MSTORE PUSH11 0x496E76616C696420736967 PUSH1 0xA8 SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST DUP4 PUSH2 0x100 ADD CALLDATALOAD CALLVALUE EQ PUSH2 0x4B9 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1C PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x496E636F7272656374204554482076616C75652070726F766964656400000000 PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP4 AND PUSH0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP6 DUP5 MSTORE DUP3 MSTORE SWAP1 SWAP2 KECCAK256 DUP1 SLOAD PUSH1 0xFF NOT AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0x520 SWAP1 PUSH2 0x4F6 SWAP1 DUP7 ADD DUP7 PUSH2 0x143A JUMP JUMPDEST DUP5 PUSH1 0x40 DUP8 ADD CALLDATALOAD PUSH1 0x60 DUP9 ADD CALLDATALOAD PUSH2 0x511 PUSH1 0xA0 DUP11 ADD PUSH1 0x80 DUP12 ADD PUSH2 0x149D JUMP JUMPDEST DUP10 PUSH1 0xA0 ADD CALLDATALOAD DUP11 PUSH1 0xC0 ADD CALLDATALOAD PUSH2 0xA07 JUMP JUMPDEST PUSH2 0x566 PUSH32 0x0 PUSH1 0x40 DUP7 ADD CALLDATALOAD PUSH2 0x556 PUSH1 0x20 DUP9 ADD DUP9 PUSH2 0x143A JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND SWAP2 SWAP1 PUSH2 0xB75 JUMP JUMPDEST PUSH0 PUSH2 0x5B2 PUSH2 0x577 PUSH1 0xE0 DUP8 ADD DUP8 PUSH2 0x1453 JUMP JUMPDEST DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY PUSH0 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP CALLVALUE SWAP3 POP PUSH2 0xBF4 SWAP2 POP POP JUMP JUMPDEST SWAP1 POP DUP1 PUSH2 0x5EF JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xB PUSH1 0x24 DUP3 ADD MSTORE PUSH11 0x10D85B1B0819985A5B1959 PUSH1 0xAA SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH2 0x621 PUSH32 0x0 PUSH0 PUSH2 0x556 PUSH1 0x20 DUP10 ADD DUP10 PUSH2 0x143A JUMP JUMPDEST PUSH2 0x62E PUSH1 0x20 DUP7 ADD DUP7 PUSH2 0x143A JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP5 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH32 0x78129A649632642D8E9F346C85D9EFB70D32D50A36774C4585491A9228BBD350 DUP8 PUSH1 0x40 ADD CALLDATALOAD PUSH1 0x40 MLOAD PUSH2 0x676 SWAP2 DUP2 MSTORE PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP POP POP PUSH2 0x6AB PUSH1 0x1 PUSH32 0x9B779B17422D0DF92223018B32B4D1FA46E071723D6817E2486D003BECC55F00 SSTORE JUMP JUMPDEST POP JUMP JUMPDEST PUSH2 0x6B6 PUSH2 0xC79 JUMP JUMPDEST PUSH2 0x6BF PUSH0 PUSH2 0xCA5 JUMP JUMPDEST JUMP JUMPDEST PUSH0 PUSH1 0x60 DUP1 PUSH0 PUSH0 PUSH0 PUSH1 0x60 PUSH2 0x6D2 PUSH2 0xCF4 JUMP JUMPDEST PUSH2 0x6DA PUSH2 0xD26 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH0 DUP1 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 SWAP3 MSTORE PUSH1 0xF PUSH1 0xF8 SHL SWAP12 SWAP4 SWAP11 POP SWAP2 SWAP9 POP CHAINID SWAP8 POP ADDRESS SWAP7 POP SWAP5 POP SWAP3 POP SWAP1 POP JUMP JUMPDEST PUSH2 0x70B PUSH2 0xC79 JUMP JUMPDEST PUSH2 0x730 PUSH2 0x71F PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND SWAP1 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP5 AND SWAP1 DUP4 PUSH2 0xD53 JUMP JUMPDEST PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP3 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH32 0xA0524EE0FD8662D6C046D199DA2A6D3DC49445182CEC055873A5BB9C2843C8E0 DUP4 PUSH1 0x40 MLOAD PUSH2 0x77F SWAP2 DUP2 MSTORE PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP3 AND PUSH0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP5 DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x7C0 PUSH2 0xC79 JUMP JUMPDEST PUSH0 DUP1 SLOAD PUSH1 0x40 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP2 AND SWAP1 DUP4 SWAP1 DUP4 DUP2 DUP2 DUP2 DUP6 DUP8 GAS CALL SWAP3 POP POP POP RETURNDATASIZE DUP1 PUSH0 DUP2 EQ PUSH2 0x80A JUMPI PUSH1 0x40 MLOAD SWAP2 POP PUSH1 0x1F NOT PUSH1 0x3F RETURNDATASIZE ADD AND DUP3 ADD PUSH1 0x40 MSTORE RETURNDATASIZE DUP3 MSTORE RETURNDATASIZE PUSH0 PUSH1 0x20 DUP5 ADD RETURNDATACOPY PUSH2 0x80F JUMP JUMPDEST PUSH1 0x60 SWAP2 POP JUMPDEST POP POP SWAP1 POP DUP1 PUSH2 0x856 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH19 0x115512081D1C985B9CD9995C8819985A5B1959 PUSH1 0x6A SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH32 0x6148672A948A12B8E0BF92A9338349B9AC890FAD62A234ABAF0A4DA99F62CFCC DUP4 PUSH1 0x40 MLOAD PUSH2 0x89B SWAP2 DUP2 MSTORE PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 POP POP JUMP JUMPDEST PUSH2 0x8AF PUSH2 0xC79 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND PUSH2 0x8D8 JUMPI PUSH1 0x40 MLOAD PUSH4 0x1E4FBDF7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH0 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST PUSH2 0x6AB DUP2 PUSH2 0xCA5 JUMP JUMPDEST PUSH2 0x8E9 PUSH2 0xD60 JUMP JUMPDEST PUSH1 0x2 PUSH32 0x9B779B17422D0DF92223018B32B4D1FA46E071723D6817E2486D003BECC55F00 SSTORE JUMP JUMPDEST DUP4 MLOAD PUSH1 0x20 DUP1 DUP7 ADD SWAP2 SWAP1 SWAP2 KECCAK256 PUSH1 0x40 DUP1 MLOAD PUSH32 0xF0543E2024FD0AE16CCB842686C2733758EC65ACFD69FB599C05B286F8DB8844 SWAP4 DUP2 ADD SWAP4 SWAP1 SWAP4 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB PUSH32 0x0 DUP2 AND SWAP2 DUP5 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP1 DUP11 AND PUSH1 0x60 DUP5 ADD MSTORE DUP9 AND PUSH1 0x80 DUP4 ADD MSTORE PUSH1 0xA0 DUP3 ADD DUP8 SWAP1 MSTORE PUSH1 0xC0 DUP3 ADD MSTORE PUSH1 0xE0 DUP2 ADD DUP5 SWAP1 MSTORE PUSH2 0x100 DUP2 ADD DUP4 SWAP1 MSTORE PUSH2 0x120 DUP2 ADD DUP3 SWAP1 MSTORE PUSH0 SWAP1 PUSH2 0x9CF SWAP1 PUSH2 0x140 ADD PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 DUP4 SUB SUB DUP2 MSTORE SWAP1 PUSH1 0x40 MSTORE DUP1 MLOAD SWAP1 PUSH1 0x20 ADD KECCAK256 PUSH2 0xDA2 JUMP JUMPDEST SWAP9 SWAP8 POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH0 PUSH0 PUSH0 PUSH0 PUSH2 0x9EB DUP9 DUP9 DUP9 DUP9 PUSH2 0xDCE JUMP JUMPDEST SWAP3 POP SWAP3 POP SWAP3 POP PUSH2 0x9FB DUP3 DUP3 PUSH2 0xE96 JUMP JUMPDEST POP SWAP1 SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH4 0xD505ACCF PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP8 DUP2 AND PUSH1 0x4 DUP4 ADD MSTORE ADDRESS PUSH1 0x24 DUP4 ADD MSTORE PUSH1 0x44 DUP3 ADD DUP8 SWAP1 MSTORE PUSH1 0x64 DUP3 ADD DUP7 SWAP1 MSTORE PUSH1 0xFF DUP6 AND PUSH1 0x84 DUP4 ADD MSTORE PUSH1 0xA4 DUP3 ADD DUP5 SWAP1 MSTORE PUSH1 0xC4 DUP3 ADD DUP4 SWAP1 MSTORE DUP9 AND SWAP1 PUSH4 0xD505ACCF SWAP1 PUSH1 0xE4 ADD PUSH0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0xA72 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP GAS CALL SWAP3 POP POP POP DUP1 ISZERO PUSH2 0xA83 JUMPI POP PUSH1 0x1 JUMPDEST PUSH2 0xB57 JUMPI PUSH1 0x40 MLOAD PUSH4 0x6EB1769F PUSH1 0xE1 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP8 DUP2 AND PUSH1 0x4 DUP4 ADD MSTORE ADDRESS PUSH1 0x24 DUP4 ADD MSTORE DUP7 SWAP2 SWAP1 DUP10 AND SWAP1 PUSH4 0xDD62ED3E SWAP1 PUSH1 0x44 ADD PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP7 GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0xAD4 JUMPI RETURNDATASIZE PUSH0 PUSH0 RETURNDATACOPY RETURNDATASIZE PUSH0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0xAF8 SWAP2 SWAP1 PUSH2 0x14BD JUMP JUMPDEST LT ISZERO PUSH2 0xB57 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x28 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5065726D6974206661696C656420616E6420696E73756666696369656E742061 PUSH1 0x44 DUP3 ADD MSTORE PUSH8 0x6C6C6F77616E6365 PUSH1 0xC0 SHL PUSH1 0x64 DUP3 ADD MSTORE PUSH1 0x84 ADD PUSH2 0x281 JUMP JUMPDEST PUSH2 0xB6C PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP9 AND DUP8 ADDRESS DUP9 PUSH2 0xF52 JUMP JUMPDEST POP POP POP POP POP POP POP JUMP JUMPDEST PUSH2 0xB81 DUP4 DUP4 DUP4 PUSH0 PUSH2 0xF8E JUMP JUMPDEST PUSH2 0xBEF JUMPI PUSH2 0xB92 DUP4 DUP4 PUSH0 PUSH1 0x1 PUSH2 0xF8E JUMP JUMPDEST PUSH2 0xBBA JUMPI PUSH1 0x40 MLOAD PUSH4 0x5274AFE7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP5 AND PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST PUSH2 0xBC7 DUP4 DUP4 DUP4 PUSH1 0x1 PUSH2 0xF8E JUMP JUMPDEST PUSH2 0xBEF JUMPI PUSH1 0x40 MLOAD PUSH4 0x5274AFE7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP5 AND PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST POP POP POP JUMP JUMPDEST PUSH0 PUSH0 PUSH32 0x0 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP4 DUP6 PUSH1 0x40 MLOAD PUSH2 0xC2F SWAP2 SWAP1 PUSH2 0x14D4 JUMP JUMPDEST PUSH0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 DUP8 GAS CALL SWAP3 POP POP POP RETURNDATASIZE DUP1 PUSH0 DUP2 EQ PUSH2 0xC69 JUMPI PUSH1 0x40 MLOAD SWAP2 POP PUSH1 0x1F NOT PUSH1 0x3F RETURNDATASIZE ADD AND DUP3 ADD PUSH1 0x40 MSTORE RETURNDATASIZE DUP3 MSTORE RETURNDATASIZE PUSH0 PUSH1 0x20 DUP5 ADD RETURNDATACOPY PUSH2 0xC6E JUMP JUMPDEST PUSH1 0x60 SWAP2 POP JUMPDEST POP SWAP1 SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND CALLER EQ PUSH2 0x6BF JUMPI PUSH1 0x40 MLOAD PUSH4 0x118CDAA7 PUSH1 0xE0 SHL DUP2 MSTORE CALLER PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST PUSH0 DUP1 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP4 DUP2 AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB NOT DUP4 AND DUP2 OR DUP5 SSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP3 AND SWAP3 DUP4 SWAP2 PUSH32 0x8BE0079C531659141344CD1FD0A4F28419497F9722A3DAAFE3B4186F6B6457E0 SWAP2 SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x60 PUSH2 0xD21 PUSH32 0x0 PUSH1 0x1 PUSH2 0xFF0 JUMP JUMPDEST SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x60 PUSH2 0xD21 PUSH32 0x0 PUSH1 0x2 PUSH2 0xFF0 JUMP JUMPDEST PUSH2 0xBC7 DUP4 DUP4 DUP4 PUSH1 0x1 PUSH2 0x1099 JUMP JUMPDEST PUSH32 0x9B779B17422D0DF92223018B32B4D1FA46E071723D6817E2486D003BECC55F00 SLOAD PUSH1 0x2 SUB PUSH2 0x6BF JUMPI PUSH1 0x40 MLOAD PUSH4 0x3EE5AEB5 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH0 PUSH2 0x7B2 PUSH2 0xDAE PUSH2 0x10E3 JUMP JUMPDEST DUP4 PUSH1 0x40 MLOAD PUSH2 0x1901 PUSH1 0xF0 SHL DUP2 MSTORE PUSH1 0x2 DUP2 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x22 DUP3 ADD MSTORE PUSH1 0x42 SWAP1 KECCAK256 SWAP1 JUMP JUMPDEST PUSH0 DUP1 DUP1 PUSH32 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0 DUP5 GT ISZERO PUSH2 0xE07 JUMPI POP PUSH0 SWAP2 POP PUSH1 0x3 SWAP1 POP DUP3 PUSH2 0xE8C JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH0 DUP1 DUP3 MSTORE PUSH1 0x20 DUP3 ADD DUP1 DUP5 MSTORE DUP11 SWAP1 MSTORE PUSH1 0xFF DUP10 AND SWAP3 DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x60 DUP2 ADD DUP8 SWAP1 MSTORE PUSH1 0x80 DUP2 ADD DUP7 SWAP1 MSTORE PUSH1 0x1 SWAP1 PUSH1 0xA0 ADD PUSH1 0x20 PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 SUB SWAP1 DUP1 DUP5 SUB SWAP1 DUP6 GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0xE58 JUMPI RETURNDATASIZE PUSH0 PUSH0 RETURNDATACOPY RETURNDATASIZE PUSH0 REVERT JUMPDEST POP POP PUSH1 0x40 MLOAD PUSH1 0x1F NOT ADD MLOAD SWAP2 POP POP PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND PUSH2 0xE83 JUMPI POP PUSH0 SWAP3 POP PUSH1 0x1 SWAP2 POP DUP3 SWAP1 POP PUSH2 0xE8C JUMP JUMPDEST SWAP3 POP PUSH0 SWAP2 POP DUP2 SWAP1 POP JUMPDEST SWAP5 POP SWAP5 POP SWAP5 SWAP2 POP POP JUMP JUMPDEST PUSH0 DUP3 PUSH1 0x3 DUP2 GT ISZERO PUSH2 0xEA9 JUMPI PUSH2 0xEA9 PUSH2 0x14EA JUMP JUMPDEST SUB PUSH2 0xEB2 JUMPI POP POP JUMP JUMPDEST PUSH1 0x1 DUP3 PUSH1 0x3 DUP2 GT ISZERO PUSH2 0xEC6 JUMPI PUSH2 0xEC6 PUSH2 0x14EA JUMP JUMPDEST SUB PUSH2 0xEE4 JUMPI PUSH1 0x40 MLOAD PUSH4 0xF645EEDF PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x2 DUP3 PUSH1 0x3 DUP2 GT ISZERO PUSH2 0xEF8 JUMPI PUSH2 0xEF8 PUSH2 0x14EA JUMP JUMPDEST SUB PUSH2 0xF19 JUMPI PUSH1 0x40 MLOAD PUSH4 0xFCE698F7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 DUP2 ADD DUP3 SWAP1 MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST PUSH1 0x3 DUP3 PUSH1 0x3 DUP2 GT ISZERO PUSH2 0xF2D JUMPI PUSH2 0xF2D PUSH2 0x14EA JUMP JUMPDEST SUB PUSH2 0xF4E JUMPI PUSH1 0x40 MLOAD PUSH4 0x35E2F383 PUSH1 0xE2 SHL DUP2 MSTORE PUSH1 0x4 DUP2 ADD DUP3 SWAP1 MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST POP POP JUMP JUMPDEST PUSH2 0xF60 DUP5 DUP5 DUP5 DUP5 PUSH1 0x1 PUSH2 0x120C JUMP JUMPDEST PUSH2 0xF88 JUMPI PUSH1 0x40 MLOAD PUSH4 0x5274AFE7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP6 AND PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH4 0x95EA7B3 PUSH1 0xE0 SHL PUSH0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP7 AND PUSH1 0x4 MSTORE PUSH1 0x24 DUP6 SWAP1 MSTORE SWAP2 PUSH1 0x20 DUP4 PUSH1 0x44 DUP2 DUP1 DUP12 GAS CALL SWAP3 POP PUSH1 0x1 PUSH0 MLOAD EQ DUP4 AND PUSH2 0xFE4 JUMPI DUP4 DUP4 ISZERO AND ISZERO PUSH2 0xFD8 JUMPI RETURNDATASIZE PUSH0 DUP3 RETURNDATACOPY RETURNDATASIZE DUP2 REVERT JUMPDEST PUSH0 DUP8 EXTCODESIZE GT RETURNDATASIZE ISZERO AND DUP4 AND SWAP3 POP JUMPDEST PUSH1 0x40 MSTORE POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x60 PUSH1 0xFF DUP4 EQ PUSH2 0x100A JUMPI PUSH2 0x1003 DUP4 PUSH2 0x1279 JUMP JUMPDEST SWAP1 POP PUSH2 0x7B2 JUMP JUMPDEST DUP2 DUP1 SLOAD PUSH2 0x1016 SWAP1 PUSH2 0x14FE JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0x1042 SWAP1 PUSH2 0x14FE JUMP JUMPDEST DUP1 ISZERO PUSH2 0x108D JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x1064 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x108D JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH0 MSTORE PUSH1 0x20 PUSH0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x1070 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP PUSH2 0x7B2 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH4 0xA9059CBB PUSH1 0xE0 SHL PUSH0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP7 AND PUSH1 0x4 MSTORE PUSH1 0x24 DUP6 SWAP1 MSTORE SWAP2 PUSH1 0x20 DUP4 PUSH1 0x44 DUP2 DUP1 DUP12 GAS CALL SWAP3 POP PUSH1 0x1 PUSH0 MLOAD EQ DUP4 AND PUSH2 0xFE4 JUMPI DUP4 DUP4 ISZERO AND ISZERO PUSH2 0xFD8 JUMPI RETURNDATASIZE PUSH0 DUP3 RETURNDATACOPY RETURNDATASIZE DUP2 REVERT JUMPDEST PUSH0 ADDRESS PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB PUSH32 0x0 AND EQ DUP1 ISZERO PUSH2 0x113B JUMPI POP PUSH32 0x0 CHAINID EQ JUMPDEST ISZERO PUSH2 0x1165 JUMPI POP PUSH32 0x0 SWAP1 JUMP JUMPDEST PUSH2 0xD21 PUSH1 0x40 DUP1 MLOAD PUSH32 0x8B73C3C69BB8FE3D512ECC4CF759CC79239F7B179B0FFACAA9A75D522B39400F PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x0 SWAP2 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH32 0x0 PUSH1 0x60 DUP3 ADD MSTORE CHAINID PUSH1 0x80 DUP3 ADD MSTORE ADDRESS PUSH1 0xA0 DUP3 ADD MSTORE PUSH0 SWAP1 PUSH1 0xC0 ADD PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 DUP4 SUB SUB DUP2 MSTORE SWAP1 PUSH1 0x40 MSTORE DUP1 MLOAD SWAP1 PUSH1 0x20 ADD KECCAK256 SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH4 0x23B872DD PUSH1 0xE0 SHL PUSH0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP8 DUP2 AND PUSH1 0x4 MSTORE DUP7 AND PUSH1 0x24 MSTORE PUSH1 0x44 DUP6 SWAP1 MSTORE SWAP2 PUSH1 0x20 DUP4 PUSH1 0x64 DUP2 DUP1 DUP13 GAS CALL SWAP3 POP PUSH1 0x1 PUSH0 MLOAD EQ DUP4 AND PUSH2 0x1268 JUMPI DUP4 DUP4 ISZERO AND ISZERO PUSH2 0x125C JUMPI RETURNDATASIZE PUSH0 DUP3 RETURNDATACOPY RETURNDATASIZE DUP2 REVERT JUMPDEST PUSH0 DUP9 EXTCODESIZE GT RETURNDATASIZE ISZERO AND DUP4 AND SWAP3 POP JUMPDEST PUSH1 0x40 MSTORE POP PUSH0 PUSH1 0x60 MSTORE SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x60 PUSH0 PUSH2 0x1285 DUP4 PUSH2 0x12B6 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 DUP4 ADD SWAP1 SWAP3 MSTORE SWAP2 SWAP3 POP PUSH0 SWAP2 SWAP1 PUSH1 0x20 DUP3 ADD DUP2 DUP1 CALLDATASIZE DUP4 CALLDATACOPY POP POP POP SWAP2 DUP3 MSTORE POP PUSH1 0x20 DUP2 ADD SWAP3 SWAP1 SWAP3 MSTORE POP SWAP1 JUMP JUMPDEST PUSH0 PUSH1 0xFF DUP3 AND PUSH1 0x1F DUP2 GT ISZERO PUSH2 0x7B2 JUMPI PUSH1 0x40 MLOAD PUSH4 0x2CD44AC3 PUSH1 0xE2 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x12ED JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1303 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP3 ADD PUSH2 0x1C0 DUP2 DUP6 SUB SLT ISZERO PUSH2 0x1315 JUMPI PUSH0 PUSH0 REVERT JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH0 DUP2 MLOAD DUP1 DUP5 MSTORE DUP1 PUSH1 0x20 DUP5 ADD PUSH1 0x20 DUP7 ADD MCOPY PUSH0 PUSH1 0x20 DUP3 DUP7 ADD ADD MSTORE PUSH1 0x20 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND DUP6 ADD ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0xFF PUSH1 0xF8 SHL DUP9 AND DUP2 MSTORE PUSH1 0xE0 PUSH1 0x20 DUP3 ADD MSTORE PUSH0 PUSH2 0x1368 PUSH1 0xE0 DUP4 ADD DUP10 PUSH2 0x131C JUMP JUMPDEST DUP3 DUP2 SUB PUSH1 0x40 DUP5 ADD MSTORE PUSH2 0x137A DUP2 DUP10 PUSH2 0x131C JUMP JUMPDEST PUSH1 0x60 DUP5 ADD DUP9 SWAP1 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP8 AND PUSH1 0x80 DUP6 ADD MSTORE PUSH1 0xA0 DUP5 ADD DUP7 SWAP1 MSTORE DUP4 DUP2 SUB PUSH1 0xC0 DUP6 ADD MSTORE DUP5 MLOAD DUP1 DUP3 MSTORE PUSH1 0x20 DUP1 DUP8 ADD SWAP4 POP SWAP1 SWAP2 ADD SWAP1 PUSH0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x13CF JUMPI DUP4 MLOAD DUP4 MSTORE PUSH1 0x20 SWAP4 DUP5 ADD SWAP4 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x1 ADD PUSH2 0x13B1 JUMP JUMPDEST POP SWAP1 SWAP12 SWAP11 POP POP POP POP POP POP POP POP POP POP POP JUMP JUMPDEST DUP1 CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND DUP2 EQ PUSH2 0x13F6 JUMPI PUSH0 PUSH0 REVERT JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH0 PUSH0 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x140C JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x1415 DUP4 PUSH2 0x13E0 JUMP JUMPDEST SWAP5 PUSH1 0x20 SWAP4 SWAP1 SWAP4 ADD CALLDATALOAD SWAP4 POP POP POP JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x1433 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP CALLDATALOAD SWAP2 SWAP1 POP JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x144A JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x1315 DUP3 PUSH2 0x13E0 JUMP JUMPDEST PUSH0 PUSH0 DUP4 CALLDATALOAD PUSH1 0x1E NOT DUP5 CALLDATASIZE SUB ADD DUP2 SLT PUSH2 0x1468 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP4 ADD DUP1 CALLDATALOAD SWAP2 POP PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x1482 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH1 0x20 ADD SWAP2 POP CALLDATASIZE DUP2 SWAP1 SUB DUP3 SGT ISZERO PUSH2 0x1496 JUMPI PUSH0 PUSH0 REVERT JUMPDEST SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x14AD JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH1 0xFF DUP2 AND DUP2 EQ PUSH2 0x1315 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x14CD JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP MLOAD SWAP2 SWAP1 POP JUMP JUMPDEST PUSH0 DUP3 MLOAD DUP1 PUSH1 0x20 DUP6 ADD DUP5 MCOPY PUSH0 SWAP3 ADD SWAP2 DUP3 MSTORE POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x21 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST PUSH1 0x1 DUP2 DUP2 SHR SWAP1 DUP3 AND DUP1 PUSH2 0x1512 JUMPI PUSH1 0x7F DUP3 AND SWAP2 POP JUMPDEST PUSH1 0x20 DUP3 LT DUP2 SUB PUSH2 0x1530 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x22 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST POP SWAP2 SWAP1 POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 SWAP13 CALLVALUE 0xDB 0x2F PUSH16 0x83AF136A5340CCE7FE8EF554EA8EB633 PUSH6 0x6FBF9BFF3BD7 BALANCE 0xAE 0xC4 0xF PUSH5 0x736F6C6343 STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "1158:6897:22:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2995:1996;;;;;;:::i;:::-;;:::i;:::-;;2293:101:0;;;;;;;;;;;;;:::i;1519:44:22:-;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;576:32:23;;;558:51;;546:2;531:18;1519:44:22;;;;;;;;5228:557:16;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;:::i;1638:85:0:-;;;;;;;;;;-1:-1:-1;1684:7:0;1710:6;-1:-1:-1;;;;;1710:6:0;1638:85;;7236:186:22;;;;;;;;;;-1:-1:-1;7236:186:22;;;;;:::i;:::-;;:::i;1570:69::-;;;;;;;;;;-1:-1:-1;1570:69:22;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2805:14:23;;2798:22;2780:41;;2768:2;2753:18;1570:69:22;2640:187:23;7907:146:22;;;;;;;;;;-1:-1:-1;7907:146:22;;;;;:::i;:::-;;:::i;7619:216::-;;;;;;;;;;-1:-1:-1;7619:216:22;;;;;:::i;:::-;;:::i;2543:215:0:-;;;;;;;;;;-1:-1:-1;2543:215:0;;;;;:::i;:::-;;:::i;2995:1996:22:-;3023:21:11;:19;:21::i;:::-;3083:13:22::1;3099:12;::::0;;;::::1;::::0;::::1;;:::i;:::-;3083:28:::0;-1:-1:-1;3137:19:22::1;::::0;::::1;;-1:-1:-1::0;;;;;3201:19:22;::::1;3193:45;;;::::0;-1:-1:-1;;;3193:45:22;;3456:2:23;3193:45:22::1;::::0;::::1;3438:21:23::0;3495:2;3475:18;;;3468:30;-1:-1:-1;;;3514:18:23;;;3507:43;3567:18;;3193:45:22::1;;;;;;;;;3280:1;3256:12;;::::0;::::1;:6:::0;:12:::1;:::i;:::-;-1:-1:-1::0;;;;;3256:26:22::1;::::0;3248:52:::1;;;::::0;-1:-1:-1;;;3248:52:22;;3798:2:23;3248:52:22::1;::::0;::::1;3780:21:23::0;3837:2;3817:18;;;3810:30;-1:-1:-1;;;3856:18:23;;;3849:43;3909:18;;3248:52:22::1;3596:337:23::0;3248:52:22::1;-1:-1:-1::0;;;;;3319:24:22;::::1;;::::0;;;:17:::1;:24;::::0;;;;;;;:31;;;;;;;;;::::1;;3318:32;3310:55;;;::::0;-1:-1:-1;;;3310:55:22;;4140:2:23;3310:55:22::1;::::0;::::1;4122:21:23::0;4179:2;4159:18;;;4152:30;-1:-1:-1;;;4198:18:23;;;4191:40;4248:18;;3310:55:22::1;3938:334:23::0;3310:55:22::1;3402:6;:22;;;3383:15;:41;;3375:69;;;::::0;-1:-1:-1;;;3375:69:22;;4479:2:23;3375:69:22::1;::::0;::::1;4461:21:23::0;4518:2;4498:18;;;4491:30;-1:-1:-1;;;4537:18:23;;;4530:45;4592:18;;3375:69:22::1;4277:339:23::0;3375:69:22::1;3523:14;3540:215;3568:5:::0;3587:12:::1;;::::0;::::1;:6:::0;:12:::1;:::i;:::-;3613;::::0;::::1;;3639:18;;::::0;::::1;3613:6:::0;3639:18:::1;:::i;:::-;3540:215;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;::::0;;;;-1:-1:-1;;;;3671:19:22::1;::::0;::::1;;3704:5:::0;3723:22:::1;::::0;::::1;;3540:14;:215::i;:::-;3523:232:::0;-1:-1:-1;;;;;;3850:81:22;::::1;:72;3523:232:::0;3872:15:::1;::::0;;;::::1;::::0;::::1;;:::i;:::-;3889:6;:15;;;3906:6;:15;;;3850:13;:72::i;:::-;-1:-1:-1::0;;;;;3850:81:22::1;;3842:105;;;::::0;-1:-1:-1;;;3842:105:22;;5623:2:23;3842:105:22::1;::::0;::::1;5605:21:23::0;5662:2;5642:18;;;5635:30;-1:-1:-1;;;5681:18:23;;;5674:41;5732:18;;3842:105:22::1;5421:335:23::0;3842:105:22::1;3979:6;:19;;;3966:9;:32;3958:73;;;::::0;-1:-1:-1;;;3958:73:22;;5963:2:23;3958:73:22::1;::::0;::::1;5945:21:23::0;6002:2;5982:18;;;5975:30;6041;6021:18;;;6014:58;6089:18;;3958:73:22::1;5761:352:23::0;3958:73:22::1;-1:-1:-1::0;;;;;4158:24:22;::::1;;::::0;;;:17:::1;:24;::::0;;;;;;;:31;;;;;;;;:38;;-1:-1:-1;;4158:38:22::1;4192:4;4158:38;::::0;;4303:219:::1;::::0;4342:12:::1;::::0;;::::1;:6:::0;:12:::1;:::i;:::-;4368:5:::0;4387:12:::1;::::0;::::1;;4413:15;::::0;::::1;;4442:14;::::0;;;::::1;::::0;::::1;;:::i;:::-;4470:6;:14;;;4498:6;:14;;;4303:25;:219::i;:::-;4592:68;4626:19;4647:12;::::0;::::1;;4599;;::::0;::::1;4647:6:::0;4599:12:::1;:::i;:::-;-1:-1:-1::0;;;;;4592:33:22::1;::::0;:68;:33:::1;:68::i;:::-;4671:16;4690:43;4703:18;;::::0;::::1;:6:::0;:18:::1;:::i;:::-;4690:43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;::::0;;;;-1:-1:-1;4723:9:22::1;::::0;-1:-1:-1;4690:12:22::1;::::0;-1:-1:-1;;4690:43:22:i:1;:::-;4671:62;;4751:11;4743:35;;;::::0;-1:-1:-1;;;4743:35:22;;6320:2:23;4743:35:22::1;::::0;::::1;6302:21:23::0;6359:2;6339:18;;;6332:30;-1:-1:-1;;;6378:18:23;;;6371:41;6429:18;;4743:35:22::1;6118:335:23::0;4743:35:22::1;4861:57;4895:19;4916:1;4868:12;;::::0;::::1;:6:::0;:12:::1;:::i;4861:57::-;4957:12;;::::0;::::1;:6:::0;:12:::1;:::i;:::-;-1:-1:-1::0;;;;;4934:50:22::1;4950:5;-1:-1:-1::0;;;;;4934:50:22::1;;4971:6;:12;;;4934:50;;;;6604:25:23::0;;6592:2;6577:18;;6458:177;4934:50:22::1;;;;;;;;3073:1918;;;;3065:20:11::0;2365:1;1505:66;3972:62;3749:292;3065:20;2995:1996:22;:::o;2293:101:0:-;1531:13;:11;:13::i;:::-;2357:30:::1;2384:1;2357:18;:30::i;:::-;2293:101::o:0;5228:557:16:-;5326:13;5353:18;5385:21;5420:15;5449:25;5488:12;5514:27;5617:13;:11;:13::i;:::-;5644:16;:14;:16::i;:::-;5752;;;5736:1;5752:16;;;;;;;;;-1:-1:-1;;;5566:212:16;;;-1:-1:-1;5566:212:16;;-1:-1:-1;5674:13:16;;-1:-1:-1;5709:4:16;;-1:-1:-1;5736:1:16;-1:-1:-1;5752:16:16;-1:-1:-1;5566:212:16;-1:-1:-1;5228:557:16:o;7236:186:22:-;1531:13:0;:11;:13::i;:::-;7319:43:22::1;7346:7;1684::0::0;1710:6;-1:-1:-1;;;;;1710:6:0;;1638:85;7346:7:22::1;-1:-1:-1::0;;;;;7319:26:22;::::1;::::0;7355:6;7319:26:::1;:43::i;:::-;1684:7:0::0;1710:6;-1:-1:-1;;;;;1710:6:0;-1:-1:-1;;;;;7377:38:22::1;7392:5;-1:-1:-1::0;;;;;7377:38:22::1;;7399:6;7377:38;;;;6604:25:23::0;;6592:2;6577:18;;6458:177;7377:38:22::1;;;;;;;;7236:186:::0;;:::o;7907:146::-;-1:-1:-1;;;;;8014:25:22;;7991:4;8014:25;;;:17;:25;;;;;;;;:32;;;;;;;;;;;7907:146;;;;;:::o;7619:216::-;1531:13:0;:11;:13::i;:::-;7686:12:22::1;1710:6:0::0;;7704:31:22::1;::::0;-1:-1:-1;;;;;1710:6:0;;;;7724::22;;7686:12;7704:31;7686:12;7704:31;7724:6;1710::0;7704:31:22::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7685:50;;;7753:7;7745:39;;;::::0;-1:-1:-1;;;7745:39:22;;7184:2:23;7745:39:22::1;::::0;::::1;7166:21:23::0;7223:2;7203:18;;;7196:30;-1:-1:-1;;;7242:18:23;;;7235:49;7301:18;;7745:39:22::1;6982:343:23::0;7745:39:22::1;1684:7:0::0;1710:6;-1:-1:-1;;;;;1710:6:0;-1:-1:-1;;;;;7799:29:22::1;;7812:6;7799:29;;;;6604:25:23::0;;6592:2;6577:18;;6458:177;7799:29:22::1;;;;;;;;7675:160;7619:216:::0;:::o;2543:215:0:-;1531:13;:11;:13::i;:::-;-1:-1:-1;;;;;2627:22:0;::::1;2623:91;;2672:31;::::0;-1:-1:-1;;;2672:31:0;;2700:1:::1;2672:31;::::0;::::1;558:51:23::0;531:18;;2672:31:0::1;412:203:23::0;2623:91:0::1;2723:28;2742:8;2723:18;:28::i;3749:292:11:-:0;3872:25;:23;:25::i;:::-;2407:1;1505:66;3972:62;3749:292::o;5053:632:22:-;5563:15;;;;;;;;;;5342:325;;;1356:156;5342:325;;;7701:25:23;;;;-1:-1:-1;;;;;5406:19:22;7762:32:23;;7742:18;;;7735:60;;;;7831:32;;;7811:18;;;7804:60;7900:32;;7880:18;;;7873:60;7949:19;;;7942:35;;;7993:19;;;7986:35;8037:19;;;8030:35;;;8081:19;;;8074:35;;;8125:19;;;8118:35;;;5276:7:22;;5302:376;;7673:19:23;;5342:325:22;;;;;;;;;;;;5332:336;;;;;;5302:16;:376::i;:::-;5295:383;5053:632;-1:-1:-1;;;;;;;;5053:632:22:o;8813:260:15:-;8898:7;8918:17;8937:18;8957:16;8977:25;8988:4;8994:1;8997;9000;8977:10;:25::i;:::-;8917:85;;;;;;9012:28;9024:5;9031:8;9012:11;:28::i;:::-;-1:-1:-1;9057:9:15;;8813:260;-1:-1:-1;;;;;;8813:260:15:o;5941:777:22:-;6216:74;;-1:-1:-1;;;6216:74:22;;-1:-1:-1;;;;;8493:32:23;;;6216:74:22;;;8475:51:23;6258:4:22;8542:18:23;;;8535:60;8611:18;;;8604:34;;;8654:18;;;8647:34;;;8730:4;8718:17;;8697:19;;;8690:46;8752:19;;;8745:35;;;8796:19;;;8789:35;;;6216:26:22;;;;;8447:19:23;;6216:74:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6212:375;;6448:45;;-1:-1:-1;;;6448:45:22;;-1:-1:-1;;;;;9027:32:23;;;6448:45:22;;;9009:51:23;6487:4:22;9076:18:23;;;9069:60;6497:5:22;;6448:23;;;;;;8982:18:23;;6448:45:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:54;;6423:153;;;;-1:-1:-1;;;6423:153:22;;9531:2:23;6423:153:22;;;9513:21:23;9570:2;9550:18;;;9543:30;9609:34;9589:18;;;9582:62;-1:-1:-1;;;9660:18:23;;;9653:38;9708:19;;6423:153:22;9329:404:23;6423:153:22;6652:59;-1:-1:-1;;;;;6652:30:22;;6683:5;6698:4;6705:5;6652:30;:59::i;:::-;5941:777;;;;;;;:::o;5098:367:7:-;5190:42;5203:5;5210:7;5219:5;5226;5190:12;:42::i;:::-;5185:274;;5253:37;5266:5;5273:7;5282:1;5285:4;5253:12;:37::i;:::-;5248:91;;5299:40;;-1:-1:-1;;;5299:40:7;;-1:-1:-1;;;;;576:32:23;;5299:40:7;;;558:51:23;531:18;;5299:40:7;412:203:23;5248:91:7;5358:41;5371:5;5378:7;5387:5;5394:4;5358:12;:41::i;:::-;5353:95;;5408:40;;-1:-1:-1;;;5408:40:7;;-1:-1:-1;;;;;576:32:23;;5408:40:7;;;558:51:23;531:18;;5408:40:7;412:203:23;5353:95:7;5098:367;;;:::o;6724:184:22:-;6798:4;6815:12;6833:19;-1:-1:-1;;;;;6833:24:22;6865:5;6872:4;6833:44;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;6814:63:22;;6724:184;-1:-1:-1;;;;;6724:184:22:o;1796:162:0:-;1684:7;1710:6;-1:-1:-1;;;;;1710:6:0;735:10:9;1855:23:0;1851:101;;1901:40;;-1:-1:-1;;;1901:40:0;;735:10:9;1901:40:0;;;558:51:23;531:18;;1901:40:0;412:203:23;2912:187:0;2985:16;3004:6;;-1:-1:-1;;;;;3020:17:0;;;-1:-1:-1;;;;;;3020:17:0;;;;;;3052:40;;3004:6;;;;;;;3052:40;;2985:16;3052:40;2975:124;2912:187;:::o;6105:126:16:-;6151:13;6183:41;:5;6210:13;6183:26;:41::i;:::-;6176:48;;6105:126;:::o;6557:135::-;6606:13;6638:47;:8;6668:16;6638:29;:47::i;1219:204:7:-;1306:37;1320:5;1327:2;1331:5;1338:4;1306:13;:37::i;3586:157:11:-;1505:66;4560:52;2407:1;4560:63;3644:93;;3696:30;;-1:-1:-1;;;3696:30:11;;;;;;;;;;;5017:176:16;5094:7;5120:66;5153:20;:18;:20::i;:::-;5175:10;4093:4:17;4087:11;-1:-1:-1;;;4111:23:17;;4163:4;4154:14;;4147:39;;;;4215:4;4206:14;;4199:34;4271:4;4256:20;;;3918:374;7129:1551:15;7255:17;;;8209:66;8196:79;;8192:164;;;-1:-1:-1;8307:1:15;;-1:-1:-1;8311:30:15;;-1:-1:-1;8343:1:15;8291:54;;8192:164;8467:24;;;8450:14;8467:24;;;;;;;;;10271:25:23;;;10344:4;10332:17;;10312:18;;;10305:45;;;;10366:18;;;10359:34;;;10409:18;;;10402:34;;;8467:24:15;;10243:19:23;;8467:24:15;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;8467:24:15;;-1:-1:-1;;8467:24:15;;;-1:-1:-1;;;;;;;8505:20:15;;8501:113;;-1:-1:-1;8557:1:15;;-1:-1:-1;8561:29:15;;-1:-1:-1;8557:1:15;;-1:-1:-1;8541:62:15;;8501:113;8632:6;-1:-1:-1;8640:20:15;;-1:-1:-1;8640:20:15;;-1:-1:-1;7129:1551:15;;;;;;;;;:::o;11617:532::-;11712:20;11703:5;:29;;;;;;;;:::i;:::-;;11699:444;;11617:532;;:::o;11699:444::-;11808:29;11799:5;:38;;;;;;;;:::i;:::-;;11795:348;;11860:23;;-1:-1:-1;;;11860:23:15;;;;;;;;;;;11795:348;11913:35;11904:5;:44;;;;;;;;:::i;:::-;;11900:243;;11971:46;;-1:-1:-1;;;11971:46:15;;;;;6604:25:23;;;6577:18;;11971:46:15;6458:177:23;11900:243:15;12047:30;12038:5;:39;;;;;;;;:::i;:::-;;12034:109;;12100:32;;-1:-1:-1;;;12100:32:15;;;;;6604:25:23;;;6577:18;;12100:32:15;6458:177:23;12034:109:15;11617:532;;:::o;1662:232:7:-;1767:47;1785:5;1792:4;1798:2;1802:5;1809:4;1767:17;:47::i;:::-;1762:126;;1837:40;;-1:-1:-1;;;1837:40:7;;-1:-1:-1;;;;;576:32:23;;1837:40:7;;;558:51:23;531:18;;1837:40:7;412:203:23;1762:126:7;1662:232;;;;:::o;12059:1252::-;12289:4;12283:11;-1:-1:-1;;;12157:12:7;12307:22;;;-1:-1:-1;;;;;12355:29:7;;12349:4;12342:43;12405:4;12398:19;;;12157:12;12481:4;12157:12;12469:4;12157:12;;12453:5;12446;12441:45;12430:56;;12698:1;12691:4;12685:11;12682:18;12673:7;12669:32;12659:606;;12830:6;12820:7;12813:15;12809:28;12806:165;;;12886:16;12880:4;12875:3;12860:43;12936:16;12931:3;12924:29;12806:165;13247:1;13239:5;13227:18;13224:25;13205:16;13198:24;13194:56;13185:7;13181:70;13170:81;;12659:606;13285:4;13278:17;-1:-1:-1;12059:1252:7;;-1:-1:-1;;;;12059:1252:7:o;3376:267:12:-;3470:13;1390:66;3499:46;;3495:142;;3568:15;3577:5;3568:8;:15::i;:::-;3561:22;;;;3495:142;3621:5;3614:12;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8373:1244:7;8600:4;8594:11;-1:-1:-1;;;8467:12:7;8618:22;;;-1:-1:-1;;;;;8666:24:7;;8660:4;8653:38;8711:4;8704:19;;;8467:12;8787:4;8467:12;8775:4;8467:12;;8759:5;8752;8747:45;8736:56;;9004:1;8997:4;8991:11;8988:18;8979:7;8975:32;8965:606;;9136:6;9126:7;9119:15;9115:28;9112:165;;;9192:16;9186:4;9181:3;9166:43;9242:16;9237:3;9230:29;3945:262:16;3998:7;4029:4;-1:-1:-1;;;;;4038:11:16;4021:28;;:63;;;;;4070:14;4053:13;:31;4021:63;4017:184;;;-1:-1:-1;4107:22:16;;3945:262::o;4017:184::-;4167:23;4304:80;;;2079:95;4304:80;;;11405:25:23;4326:11:16;11446:18:23;;;11439:34;;;;4339:14:16;11489:18:23;;;11482:34;4355:13:16;11532:18:23;;;11525:34;4378:4:16;11575:19:23;;;11568:61;4268:7:16;;11377:19:23;;4304:80:16;;;;;;;;;;;;4294:91;;;;;;4287:98;;4213:179;;10165:1393:7;10460:4;10454:11;-1:-1:-1;;;10323:12:7;10478:22;;;-1:-1:-1;;;;;10526:26:7;;;10520:4;10513:40;10579:24;;10573:4;10566:38;10624:4;10617:19;;;10323:12;10700:4;10323:12;10688:4;10323:12;;10672:5;10665;10660:45;10649:56;;10917:1;10910:4;10904:11;10901:18;10892:7;10888:32;10878:606;;11049:6;11039:7;11032:15;11028:28;11025:165;;;11105:16;11099:4;11094:3;11079:43;11155:16;11150:3;11143:29;11025:165;11466:1;11458:5;11446:18;11443:25;11424:16;11417:24;11413:56;11404:7;11400:70;11389:81;;10878:606;11504:4;11497:17;-1:-1:-1;11540:1:7;11534:4;11527:15;10165:1393;;-1:-1:-1;;;;;10165:1393:7:o;2080:380:12:-;2139:13;2164:11;2178:16;2189:4;2178:10;:16::i;:::-;2302;;;2313:4;2302:16;;;;;;;;;2164:30;;-1:-1:-1;2282:17:12;;2302:16;;;;;;;;;-1:-1:-1;;;2367:16:12;;;-1:-1:-1;2412:4:12;2403:14;;2396:28;;;;-1:-1:-1;2367:16:12;2080:380::o;2532:247::-;2593:7;2665:4;2629:40;;2692:4;2683:13;;2679:71;;;2719:20;;-1:-1:-1;;;2719:20:12;;;;;;;;;;;14:393:23;106:6;159:2;147:9;138:7;134:23;130:32;127:52;;;175:1;172;165:12;127:52;215:9;202:23;248:18;240:6;237:30;234:50;;;280:1;277;270:12;234:50;303:22;;359:3;341:16;;;337:26;334:46;;;376:1;373;366:12;334:46;399:2;14:393;-1:-1:-1;;;14:393:23:o;620:289::-;662:3;700:5;694:12;727:6;722:3;715:19;783:6;776:4;769:5;765:16;758:4;753:3;749:14;743:47;835:1;828:4;819:6;814:3;810:16;806:27;799:38;898:4;891:2;887:7;882:2;874:6;870:15;866:29;861:3;857:39;853:50;846:57;;;620:289;;;;:::o;914:1238::-;1320:3;1315;1311:13;1303:6;1299:26;1288:9;1281:45;1362:3;1357:2;1346:9;1342:18;1335:31;1262:4;1389:46;1430:3;1419:9;1415:19;1407:6;1389:46;:::i;:::-;1483:9;1475:6;1471:22;1466:2;1455:9;1451:18;1444:50;1517:33;1543:6;1535;1517:33;:::i;:::-;1581:2;1566:18;;1559:34;;;-1:-1:-1;;;;;1630:32:23;;1624:3;1609:19;;1602:61;1650:3;1679:19;;1672:35;;;1744:22;;;1738:3;1723:19;;1716:51;1816:13;;1838:22;;;1888:2;1914:15;;;;-1:-1:-1;1876:15:23;;;;-1:-1:-1;1957:169:23;1971:6;1968:1;1965:13;1957:169;;;2032:13;;2020:26;;2075:2;2101:15;;;;2066:12;;;;1993:1;1986:9;1957:169;;;-1:-1:-1;2143:3:23;;914:1238;-1:-1:-1;;;;;;;;;;;914:1238:23:o;2157:173::-;2225:20;;-1:-1:-1;;;;;2274:31:23;;2264:42;;2254:70;;2320:1;2317;2310:12;2254:70;2157:173;;;:::o;2335:300::-;2403:6;2411;2464:2;2452:9;2443:7;2439:23;2435:32;2432:52;;;2480:1;2477;2470:12;2432:52;2503:29;2522:9;2503:29;:::i;:::-;2493:39;2601:2;2586:18;;;;2573:32;;-1:-1:-1;;;2335:300:23:o;2832:226::-;2891:6;2944:2;2932:9;2923:7;2919:23;2915:32;2912:52;;;2960:1;2957;2950:12;2912:52;-1:-1:-1;3005:23:23;;2832:226;-1:-1:-1;2832:226:23:o;3063:186::-;3122:6;3175:2;3163:9;3154:7;3150:23;3146:32;3143:52;;;3191:1;3188;3181:12;3143:52;3214:29;3233:9;3214:29;:::i;4621:521::-;4698:4;4704:6;4764:11;4751:25;4858:2;4854:7;4843:8;4827:14;4823:29;4819:43;4799:18;4795:68;4785:96;;4877:1;4874;4867:12;4785:96;4904:33;;4956:20;;;-1:-1:-1;4999:18:23;4988:30;;4985:50;;;5031:1;5028;5021:12;4985:50;5064:4;5052:17;;-1:-1:-1;5095:14:23;5091:27;;;5081:38;;5078:58;;;5132:1;5129;5122:12;5078:58;4621:521;;;;;:::o;5147:269::-;5204:6;5257:2;5245:9;5236:7;5232:23;5228:32;5225:52;;;5273:1;5270;5263:12;5225:52;5312:9;5299:23;5362:4;5355:5;5351:16;5344:5;5341:27;5331:55;;5382:1;5379;5372:12;9140:184;9210:6;9263:2;9251:9;9242:7;9238:23;9234:32;9231:52;;;9279:1;9276;9269:12;9231:52;-1:-1:-1;9302:16:23;;9140:184;-1:-1:-1;9140:184:23:o;9738:301::-;9867:3;9905:6;9899:13;9951:6;9944:4;9936:6;9932:17;9927:3;9921:37;10013:1;9977:16;;10002:13;;;-1:-1:-1;9977:16:23;9738:301;-1:-1:-1;9738:301:23:o;10447:127::-;10508:10;10503:3;10499:20;10496:1;10489:31;10539:4;10536:1;10529:15;10563:4;10560:1;10553:15;10761:380;10840:1;10836:12;;;;10883;;;10904:61;;10958:4;10950:6;10946:17;10936:27;;10904:61;11011:2;11003:6;11000:14;10980:18;10977:38;10974:161;;11057:10;11052:3;11048:20;11045:1;11038:31;11092:4;11089:1;11082:15;11120:4;11117:1;11110:15;10974:161;;10761:380;;;:::o" + }, + "methodIdentifiers": { + "destinationContract()": "75bd6863", + "eip712Domain()": "84b0196e", + "execute((address,address,uint256,uint256,uint8,bytes32,bytes32,bytes,uint256,uint256,uint256,uint8,bytes32,bytes32))": "2af83bfe", + "isExecutionCompleted(address,uint256)": "dcb79457", + "owner()": "8da5cb5b", + "renounceOwnership()": "715018a6", + "transferOwnership(address)": "f2fde38b", + "usedPayloadNonces(address,uint256)": "d850124e", + "withdrawETH(uint256)": "f14210a6", + "withdrawToken(address,uint256)": "9e281a98" + } + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_destinationContract\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ECDSAInvalidSignature\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"length\",\"type\":\"uint256\"}],\"name\":\"ECDSAInvalidSignatureLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"ECDSAInvalidSignatureS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidShortString\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"OwnableInvalidOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"OwnableUnauthorizedAccount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ReentrancyGuardReentrantCall\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"SafeERC20FailedOperation\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"str\",\"type\":\"string\"}],\"name\":\"StringTooLong\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"EIP712DomainChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"ETHWithdrawn\",\"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\":true,\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RelayerExecuted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"TokenWithdrawn\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"destinationContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"eip712Domain\",\"outputs\":[{\"internalType\":\"bytes1\",\"name\":\"fields\",\"type\":\"bytes1\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"verifyingContract\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"extensions\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"permitV\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"permitR\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"permitS\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"payloadData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"payloadValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"payloadNonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"payloadDeadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"payloadV\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"payloadR\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"payloadS\",\"type\":\"bytes32\"}],\"internalType\":\"struct TokenRelayer.ExecuteParams\",\"name\":\"params\",\"type\":\"tuple\"}],\"name\":\"execute\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"name\":\"isExecutionCompleted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"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\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"usedPayloadNonces\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdrawETH\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdrawToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"errors\":{\"ECDSAInvalidSignature()\":[{\"details\":\"The signature is invalid.\"}],\"ECDSAInvalidSignatureLength(uint256)\":[{\"details\":\"The signature has an invalid length.\"}],\"ECDSAInvalidSignatureS(bytes32)\":[{\"details\":\"The signature has an S value that is in the upper half order.\"}],\"OwnableInvalidOwner(address)\":[{\"details\":\"The owner is not a valid owner account. (eg. `address(0)`)\"}],\"OwnableUnauthorizedAccount(address)\":[{\"details\":\"The caller account is not authorized to perform an operation.\"}],\"ReentrancyGuardReentrantCall()\":[{\"details\":\"Unauthorized reentrant call.\"}],\"SafeERC20FailedOperation(address)\":[{\"details\":\"An operation with an ERC-20 token failed.\"}]},\"events\":{\"EIP712DomainChanged()\":{\"details\":\"MAY be emitted to signal that the domain could have changed.\"}},\"kind\":\"dev\",\"methods\":{\"eip712Domain()\":{\"details\":\"returns the fields and values that describe the domain separator used by this contract for EIP-712 signature.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"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.\"},\"withdrawETH(uint256)\":{\"params\":{\"amount\":\"The amount of ETH to transfer to the owner.\"}},\"withdrawToken(address,uint256)\":{\"params\":{\"amount\":\"The amount of tokens to transfer to the owner.\",\"token\":\"The ERC20 token contract address.\"}}},\"title\":\"TokenRelayer\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"withdrawETH(uint256)\":{\"notice\":\"Allows the owner to recover any native ETH held by this contract.\"},\"withdrawToken(address,uint256)\":{\"notice\":\"Allows the owner to recover any ERC20 tokens held by this contract.\"}},\"notice\":\"A relayer contract that accepts ERC20 permit signatures and executes arbitrary calls to a destination contract, both authorized via signature. Flow: 1. User signs a permit allowing the relayer to spend their tokens 2. User signs a payload (e.g., transfer from relayer to another user) 3. Relayer: a. Executes permit to approve the tokens b. Transfers tokens from user to relayer (via transferFrom) c. Forwards the payload call (transfer from relayer to another user)\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/TokenRelayer.sol\":\"TokenRelayer\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"keccak256\":\"0xff6d0bb2e285473e5311d9d3caacb525ae3538a80758c10649a4d61029b017bb\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8ed324d3920bb545059d66ab97d43e43ee85fd3bd52e03e401f020afb0b120f6\",\"dweb:/ipfs/QmfEckWLmZkDDcoWrkEvMWhms66xwTLff9DDhegYpvHo1a\"]},\"@openzeppelin/contracts/interfaces/IERC1363.sol\":{\"keccak256\":\"0xd5ea07362ab630a6a3dee4285a74cf2377044ca2e4be472755ad64d7c5d4b69d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://da5e832b40fc5c3145d3781e2e5fa60ac2052c9d08af7e300dc8ab80c4343100\",\"dweb:/ipfs/QmTzf7N5ZUdh5raqtzbM11yexiUoLC9z3Ws632MCuycq1d\"]},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"keccak256\":\"0x0afcb7e740d1537b252cb2676f600465ce6938398569f09ba1b9ca240dde2dfc\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1c299900ac4ec268d4570ecef0d697a3013cd11a6eb74e295ee3fbc945056037\",\"dweb:/ipfs/Qmab9owJoxcA7vJT5XNayCMaUR1qxqj1NDzzisduwaJMcZ\"]},\"@openzeppelin/contracts/interfaces/IERC20.sol\":{\"keccak256\":\"0x1a6221315ce0307746c2c4827c125d821ee796c74a676787762f4778671d4f44\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1bb2332a7ee26dd0b0de9b7fe266749f54820c99ab6a3bcb6f7e6b751d47ee2d\",\"dweb:/ipfs/QmcRWpaBeCYkhy68PR3B4AgD7asuQk7PwkWxrvJbZcikLF\"]},\"@openzeppelin/contracts/interfaces/IERC5267.sol\":{\"keccak256\":\"0xfb223a85dd0b2175cfbbaa325a744e2cd74ecd17c3df2b77b0722f991d2725ee\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://84bf1dea0589ec49c8d15d559cc6d86ee493048a89b2d4adb60fbe705a3d89ae\",\"dweb:/ipfs/Qmd56n556d529wk2pRMhYhm5nhMDhviwereodDikjs68w1\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x74ed01eb66b923d0d0cfe3be84604ac04b76482a55f9dd655e1ef4d367f95bc2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5282825a626cfe924e504274b864a652b0023591fa66f06a067b25b51ba9b303\",\"dweb:/ipfs/QmeCfPykghhMc81VJTrHTC7sF6CRvaA1FXVq2pJhwYp1dV\"]},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\":{\"keccak256\":\"0x53befc41288eaa87edcd3a7be7e8475a32e44c6a29f9bf52fae789781301d9ff\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a1d7fab53c4ceaf42391b83d9b36d7e9cc524a8da125cffdcd32c56560f9d1c9\",\"dweb:/ipfs/QmaRZdVhQdqNXofeimibkBG65q9GVcXVZEGpycwwX3znC6\"]},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"keccak256\":\"0x304d732678032a9781ae85c8f204c8fba3d3a5e31c02616964e75cfdc5049098\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://299ced486011781dc98f638059678323c03079fefae1482abaa2135b22fa92d0\",\"dweb:/ipfs/QmbZNbcPTBxNvwChavN2kkZZs7xHhYL7mv51KrxMhsMs3j\"]},\"@openzeppelin/contracts/utils/Bytes.sol\":{\"keccak256\":\"0xf80e4b96b6849936ea0fabd76cf81b13d7276295fddb1e1c07afb3ddf650b0ac\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6430007255ac11c6e9c4331a418f3af52ff66fbbae959f645301d025b20aeb08\",\"dweb:/ipfs/QmQE5fjmBBRw9ndnzJuC2uskYss1gbaR7JdazoCf1FGoBj\"]},\"@openzeppelin/contracts/utils/Context.sol\":{\"keccak256\":\"0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6a708e8a5bdb1011c2c381c9a5cfd8a9a956d7d0a9dc1bd8bcdaf52f76ef2f12\",\"dweb:/ipfs/Qmax9WHBnVsZP46ZxEMNRQpLQnrdE4dK8LehML1Py8FowF\"]},\"@openzeppelin/contracts/utils/Panic.sol\":{\"keccak256\":\"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c6a5ff4f9fd8649b7ee20800b7fa387d3465bd77cf20c2d1068cd5c98e1ed57a\",\"dweb:/ipfs/QmVSaVJf9FXFhdYEYeCEfjMVHrxDh5qL4CGkxdMWpQCrqG\"]},\"@openzeppelin/contracts/utils/ReentrancyGuard.sol\":{\"keccak256\":\"0xa516cbf1c7d15d3517c2d668601ce016c54395bf5171918a14e2686977465f53\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1e1d079e8edfb58efd23a311e315a4807b01b5d1cf153f8fa2d0608b9dec3e99\",\"dweb:/ipfs/QmTBExeX2SDTkn5xbk5ssbYSx7VqRp9H4Ux1CY4uQM4b9N\"]},\"@openzeppelin/contracts/utils/ShortStrings.sol\":{\"keccak256\":\"0x0768b3bdb701fe4994b3be932ca8635551dfebe04c645f77500322741bebf57c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a2059f9ca8d3c11c49ca49fc9c5fb070f18cc85d12a7688e45322ed0e2a1cb99\",\"dweb:/ipfs/QmS2gwX51RAvSw4tYbjHccY2CKbh2uvDzqHLAFXdsddgia\"]},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"keccak256\":\"0xcf74f855663ce2ae00ed8352666b7935f6cddea2932fdf2c3ecd30a9b1cd0e97\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9f660b1f351b757dfe01438e59888f31f33ded3afcf5cb5b0d9bf9aa6f320a8b\",\"dweb:/ipfs/QmarDJ5hZEgBtCmmrVzEZWjub9769eD686jmzb2XpSU1cM\"]},\"@openzeppelin/contracts/utils/Strings.sol\":{\"keccak256\":\"0x1fdc2de9585ab0f1c417f02a873a2b6343cd64bb7ffec6b00ffa11a4a158d9e8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1ab223a3d969c6cd7610049431dd42740960c477e45878f5d8b54411f7a32bdc\",\"dweb:/ipfs/QmWumhjvhpKcwx3vDPQninsNVTc3BGvqaihkQakFkQYpaS\"]},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"keccak256\":\"0xbeb5cad8aaabe0d35d2ec1a8414d91e81e5a8ca679add4cf57e2f33476861f40\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ebb272a5ee2da4e8bd5551334e0ce8dce4e9c56a04570d6bf046d260fab3116a\",\"dweb:/ipfs/QmNw6RyM769qcqFocDq6HJMG2WiEnQbvizpRaUXsACHho2\"]},\"@openzeppelin/contracts/utils/cryptography/EIP712.sol\":{\"keccak256\":\"0x8440117ea216b97a7bad690a67449fd372c840d073c8375822667e14702782b4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ebb6645995b8290d0b9121825e2533e4e28977b2c6befee76e15e58f0feb61d4\",\"dweb:/ipfs/QmVR72j6kL5R2txuihieDev1FeTi4KWJS1Z6ABbwL3Qtph\"]},\"@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol\":{\"keccak256\":\"0x6d8579873b9650426bfbd2a754092d1725049ca05e4e3c8c2c82dd9f3453129d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1fa3127a8968d55096d37124a9e212013af112affa5e30b84a1d22263c31576c\",\"dweb:/ipfs/QmetxaVcn5Q6nkpF9yXzaxPQ7d3rgrhV13sTH9BgiuzGJL\"]},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x8891738ffe910f0cf2da09566928589bf5d63f4524dd734fd9cedbac3274dd5c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://971f954442df5c2ef5b5ebf1eb245d7105d9fbacc7386ee5c796df1d45b21617\",\"dweb:/ipfs/QmadRjHbkicwqwwh61raUEapaVEtaLMcYbQZWs9gUkgj3u\"]},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"keccak256\":\"0x59973a93b1f983f94e10529f46ca46544a9fec2b5f56fb1390bbe9e0dc79f857\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c55ef8f0b9719790c2ae6f81d80a59ffb89f2f0abe6bc065585bd79edce058c5\",\"dweb:/ipfs/QmNNmCbX9NjPXKqHJN8R1WC2rNeZSQrPZLd6FF6AKLyH5Y\"]},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"keccak256\":\"0xc8cae21c9ae4a46e5162ff9bf5b351d6fa6a6eba72d515f3bc1bdfeda7fdf083\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce830ebcf28e31643caba318996db3763c36d52cd0f23798ba83c135355d45e9\",\"dweb:/ipfs/QmdGPcvptHN7UBCbUYBbRX3hiRVRFLRwno8b4uga6uFNif\"]},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"keccak256\":\"0xb1970fac7b64e6c09611e6691791e848d5e3fe410fa5899e7df2e0afd77a99e3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://db5fbb3dddd8b7047465b62575d96231ba8a2774d37fb4737fbf23340fabbb03\",\"dweb:/ipfs/QmVUSvooZKEdEdap619tcJjTLcAuH6QBdZqAzWwnAXZAWJ\"]},\"contracts/TokenRelayer.sol\":{\"keccak256\":\"0xa26c2b15e35622e16d260cc4de183ff686e24494dd64b25ef444068239a8eee4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f7e63a4f9e7b5f70ee521378c3009982c70603b25526a6dcc516a4761dfb3d2d\",\"dweb:/ipfs/QmSNc84AJ2RXBPx9rHrJkyPwAbgcqBdQUQ76cJV9qYWMTF\"]}},\"version\":1}" + } + } + } + } +} \ No newline at end of file diff --git a/contracts/relayer/ignition/deployments/chain-1/deployed_addresses.json b/contracts/relayer/ignition/deployments/chain-1/deployed_addresses.json new file mode 100644 index 000000000..3ea6c05b7 --- /dev/null +++ b/contracts/relayer/ignition/deployments/chain-1/deployed_addresses.json @@ -0,0 +1,3 @@ +{ + "TokenRelayer#TokenRelayer": "0x522A51f9c5B1683F0F15910075487c4D162A8b83" +} diff --git a/contracts/relayer/ignition/deployments/chain-1/journal.jsonl b/contracts/relayer/ignition/deployments/chain-1/journal.jsonl new file mode 100644 index 000000000..ea4006a08 --- /dev/null +++ b/contracts/relayer/ignition/deployments/chain-1/journal.jsonl @@ -0,0 +1,8 @@ + +{"chainId":1,"type":"DEPLOYMENT_INITIALIZE"} +{"artifactId":"TokenRelayer#TokenRelayer","constructorArgs":["0xce16F69375520ab01377ce7B88f5BA8C48F8D666"],"contractName":"TokenRelayer","dependencies":[],"from":"0xec733ccc573cbb46211876149e1830c58c6133e2","futureId":"TokenRelayer#TokenRelayer","futureType":"NAMED_ARTIFACT_CONTRACT_DEPLOYMENT","libraries":{},"strategy":"basic","strategyConfig":{},"type":"DEPLOYMENT_EXECUTION_STATE_INITIALIZE","value":{"_kind":"bigint","value":"0"}} +{"futureId":"TokenRelayer#TokenRelayer","networkInteraction":{"data":"0x610180604052348015610010575f5ffd5b50604051611a4d380380611a4d83398101604081905261002f91610294565b604080518082018252600c81526b2a37b5b2b72932b630bcb2b960a11b602080830191909152825180840190935260018352603160f81b9083015290338061009157604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b61009a816101d6565b5060017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00556100ca826001610225565b610120526100d9816002610225565b61014052815160208084019190912060e052815190820120610100524660a05261016560e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b60805250503060c0526001600160a01b0381166101c45760405162461bcd60e51b815260206004820152601360248201527f496e76616c69642064657374696e6174696f6e000000000000000000000000006044820152606401610088565b6001600160a01b03166101605261046b565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f6020835110156102405761023983610257565b9050610251565b8161024b8482610359565b5060ff90505b92915050565b5f5f829050601f81511115610281578260405163305a27a960e01b81526004016100889190610413565b805161028c82610448565b179392505050565b5f602082840312156102a4575f5ffd5b81516001600160a01b03811681146102ba575f5ffd5b9392505050565b634e487b7160e01b5f52604160045260245ffd5b600181811c908216806102e957607f821691505b60208210810361030757634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111561035457805f5260205f20601f840160051c810160208510156103325750805b601f840160051c820191505b81811015610351575f815560010161033e565b50505b505050565b81516001600160401b03811115610372576103726102c1565b6103868161038084546102d5565b8461030d565b6020601f8211600181146103b8575f83156103a15750848201515b5f19600385901b1c1916600184901b178455610351565b5f84815260208120601f198516915b828110156103e757878501518255602094850194600190920191016103c7565b508482101561040457868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b80516020808301519190811015610307575f1960209190910360031b1b16919050565b60805160a05160c05160e0516101005161012051610140516101605161156c6104e15f395f818160d701528181610525015281816105f4015281816109500152610bf801525f610d2d01525f610cfb01525f6111bc01525f61119401525f6110ef01525f61111901525f611143015261156c5ff3fe608060405260043610610092575f3560e01c80639e281a98116100575780639e281a9814610159578063d850124e14610178578063dcb79457146101c1578063f14210a6146101e0578063f2fde38b146101ff575f5ffd5b80632af83bfe1461009d578063715018a6146100b257806375bd6863146100c657806384b0196e146101165780638da5cb5b1461013d575f5ffd5b3661009957005b5f5ffd5b6100b06100ab3660046112dd565b61021e565b005b3480156100bd575f5ffd5b506100b06106ae565b3480156100d1575f5ffd5b506100f97f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b348015610121575f5ffd5b5061012a6106c1565b60405161010d979695949392919061134a565b348015610148575f5ffd5b505f546001600160a01b03166100f9565b348015610164575f5ffd5b506100b06101733660046113fb565b610703565b348015610183575f5ffd5b506101b16101923660046113fb565b600360209081525f928352604080842090915290825290205460ff1681565b604051901515815260200161010d565b3480156101cc575f5ffd5b506101b16101db3660046113fb565b61078b565b3480156101eb575f5ffd5b506100b06101fa366004611423565b6107b8565b34801561020a575f5ffd5b506100b061021936600461143a565b6108a7565b6102266108e1565b5f610237604083016020840161143a565b90506101208201356001600160a01b03821661028a5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21037bbb732b960991b60448201526064015b60405180910390fd5b5f610298602085018561143a565b6001600160a01b0316036102de5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2103a37b5b2b760991b6044820152606401610281565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff161561033e5760405162461bcd60e51b815260206004820152600a602482015269139bdb98d9481d5cd95960b21b6044820152606401610281565b8261014001354211156103855760405162461bcd60e51b815260206004820152600f60248201526e14185e5b1bd85908195e1c1a5c9959608a1b6044820152606401610281565b5f6103ee83610397602087018761143a565b60408701356103a960e0890189611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250505050610100890135876101408b013561090f565b90506001600160a01b038316610421826104106101808801610160890161149d565b876101800135886101a001356109db565b6001600160a01b0316146104655760405162461bcd60e51b815260206004820152600b60248201526a496e76616c69642073696760a81b6044820152606401610281565b83610100013534146104b95760405162461bcd60e51b815260206004820152601c60248201527f496e636f7272656374204554482076616c75652070726f7669646564000000006044820152606401610281565b6001600160a01b0383165f9081526003602090815260408083208584528252909120805460ff19166001179055610520906104f69086018661143a565b846040870135606088013561051160a08a0160808b0161149d565b8960a001358a60c00135610a07565b6105667f00000000000000000000000000000000000000000000000000000000000000006040860135610556602088018861143a565b6001600160a01b03169190610b75565b5f6105b261057760e0870187611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250349250610bf4915050565b9050806105ef5760405162461bcd60e51b815260206004820152600b60248201526a10d85b1b0819985a5b195960aa1b6044820152606401610281565b6106217f00000000000000000000000000000000000000000000000000000000000000005f610556602089018961143a565b61062e602086018661143a565b6001600160a01b0316846001600160a01b03167f78129a649632642d8e9f346c85d9efb70d32d50a36774c4585491a9228bbd350876040013560405161067691815260200190565b60405180910390a3505050506106ab60017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b50565b6106b6610c79565b6106bf5f610ca5565b565b5f6060805f5f5f60606106d2610cf4565b6106da610d26565b604080515f80825260208201909252600f60f81b9b939a50919850469750309650945092509050565b61070b610c79565b61073061071f5f546001600160a01b031690565b6001600160a01b0384169083610d53565b5f546001600160a01b03166001600160a01b0316826001600160a01b03167fa0524ee0fd8662d6c046d199da2a6d3dc49445182cec055873a5bb9c2843c8e08360405161077f91815260200190565b60405180910390a35050565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff165b92915050565b6107c0610c79565b5f80546040516001600160a01b039091169083908381818185875af1925050503d805f811461080a576040519150601f19603f3d011682016040523d82523d5f602084013e61080f565b606091505b50509050806108565760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610281565b5f546001600160a01b03166001600160a01b03167f6148672a948a12b8e0bf92a9338349b9ac890fad62a234abaf0a4da99f62cfcc8360405161089b91815260200190565b60405180910390a25050565b6108af610c79565b6001600160a01b0381166108d857604051631e4fbdf760e01b81525f6004820152602401610281565b6106ab81610ca5565b6108e9610d60565b60027f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b8351602080860191909120604080517ff0543e2024fd0ae16ccb842686c2733758ec65acfd69fb599c05b286f8db8844938101939093526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691840191909152808a1660608401528816608083015260a0820187905260c082015260e08101849052610100810183905261012081018290525f906109cf906101400160405160208183030381529060405280519060200120610da2565b98975050505050505050565b5f5f5f5f6109eb88888888610dce565b9250925092506109fb8282610e96565b50909695505050505050565b60405163d505accf60e01b81526001600160a01b038781166004830152306024830152604482018790526064820186905260ff8516608483015260a4820184905260c4820183905288169063d505accf9060e4015f604051808303815f87803b158015610a72575f5ffd5b505af1925050508015610a83575060015b610b5757604051636eb1769f60e11b81526001600160a01b03878116600483015230602483015286919089169063dd62ed3e90604401602060405180830381865afa158015610ad4573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610af891906114bd565b1015610b575760405162461bcd60e51b815260206004820152602860248201527f5065726d6974206661696c656420616e6420696e73756666696369656e7420616044820152676c6c6f77616e636560c01b6064820152608401610281565b610b6c6001600160a01b038816873088610f52565b50505050505050565b610b818383835f610f8e565b610bef57610b9283835f6001610f8e565b610bba57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b610bc78383836001610f8e565b610bef57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b505050565b5f5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168385604051610c2f91906114d4565b5f6040518083038185875af1925050503d805f8114610c69576040519150601f19603f3d011682016040523d82523d5f602084013e610c6e565b606091505b509095945050505050565b5f546001600160a01b031633146106bf5760405163118cdaa760e01b8152336004820152602401610281565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006001610ff0565b905090565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006002610ff0565b610bc78383836001611099565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00546002036106bf57604051633ee5aeb560e01b815260040160405180910390fd5b5f6107b2610dae6110e3565b8360405161190160f01b8152600281019290925260228201526042902090565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115610e0757505f91506003905082610e8c565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015610e58573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b038116610e8357505f925060019150829050610e8c565b92505f91508190505b9450945094915050565b5f826003811115610ea957610ea96114ea565b03610eb2575050565b6001826003811115610ec657610ec66114ea565b03610ee45760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115610ef857610ef86114ea565b03610f195760405163fce698f760e01b815260048101829052602401610281565b6003826003811115610f2d57610f2d6114ea565b03610f4e576040516335e2f38360e21b815260048101829052602401610281565b5050565b610f6084848484600161120c565b610f8857604051635274afe760e01b81526001600160a01b0385166004820152602401610281565b50505050565b60405163095ea7b360e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f873b113d1516831692505b60405250949350505050565b606060ff831461100a5761100383611279565b90506107b2565b818054611016906114fe565b80601f0160208091040260200160405190810160405280929190818152602001828054611042906114fe565b801561108d5780601f106110645761010080835404028352916020019161108d565b820191905f5260205f20905b81548152906001019060200180831161107057829003601f168201915b505050505090506107b2565b60405163a9059cbb60e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561113b57507f000000000000000000000000000000000000000000000000000000000000000046145b1561116557507f000000000000000000000000000000000000000000000000000000000000000090565b610d21604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b6040516323b872dd60e01b5f8181526001600160a01b038781166004528616602452604485905291602083606481808c5af1925060015f5114831661126857838315161561125c573d5f823e3d81fd5b5f883b113d1516831692505b604052505f60605295945050505050565b60605f611285836112b6565b6040805160208082528183019092529192505f91906020820181803683375050509182525060208101929092525090565b5f60ff8216601f8111156107b257604051632cd44ac360e21b815260040160405180910390fd5b5f602082840312156112ed575f5ffd5b813567ffffffffffffffff811115611303575f5ffd5b82016101c08185031215611315575f5ffd5b9392505050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b60ff60f81b8816815260e060208201525f61136860e083018961131c565b828103604084015261137a818961131c565b606084018890526001600160a01b038716608085015260a0840186905283810360c0850152845180825260208087019350909101905f5b818110156113cf5783518352602093840193909201916001016113b1565b50909b9a5050505050505050505050565b80356001600160a01b03811681146113f6575f5ffd5b919050565b5f5f6040838503121561140c575f5ffd5b611415836113e0565b946020939093013593505050565b5f60208284031215611433575f5ffd5b5035919050565b5f6020828403121561144a575f5ffd5b611315826113e0565b5f5f8335601e19843603018112611468575f5ffd5b83018035915067ffffffffffffffff821115611482575f5ffd5b602001915036819003821315611496575f5ffd5b9250929050565b5f602082840312156114ad575f5ffd5b813560ff81168114611315575f5ffd5b5f602082840312156114cd575f5ffd5b5051919050565b5f82518060208501845e5f920191825250919050565b634e487b7160e01b5f52602160045260245ffd5b600181811c9082168061151257607f821691505b60208210810361153057634e487b7160e01b5f52602260045260245ffd5b5091905056fea26469706673582212209c34db2f6f83af136a5340cce7fe8ef554ea8eb633656fbf9bff3bd731aec40f64736f6c634300081c0033000000000000000000000000ce16f69375520ab01377ce7b88f5ba8c48f8d666","id":1,"type":"ONCHAIN_INTERACTION","value":{"_kind":"bigint","value":"0"}},"type":"NETWORK_INTERACTION_REQUEST"} +{"futureId":"TokenRelayer#TokenRelayer","networkInteractionId":1,"nonce":0,"type":"TRANSACTION_PREPARE_SEND"} +{"futureId":"TokenRelayer#TokenRelayer","networkInteractionId":1,"nonce":0,"transaction":{"fees":{"maxFeePerGas":{"_kind":"bigint","value":"440789494"},"maxPriorityFeePerGas":{"_kind":"bigint","value":"4800"}},"hash":"0xa4686b46fb27905f60bf0f45f13cea900e08b6bb18593ad30c60e811e65ac83c"},"type":"TRANSACTION_SEND"} +{"futureId":"TokenRelayer#TokenRelayer","hash":"0xa4686b46fb27905f60bf0f45f13cea900e08b6bb18593ad30c60e811e65ac83c","networkInteractionId":1,"receipt":{"blockHash":"0xe566141be4dd38b180bf5de6dd6f63d44be5bba0daa6bb466b5b5504b5e7a634","blockNumber":25196326,"contractAddress":"0x522A51f9c5B1683F0F15910075487c4D162A8b83","logs":[{"address":"0x522A51f9c5B1683F0F15910075487c4D162A8b83","data":"0x","logIndex":523,"topics":["0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000ec733ccc573cbb46211876149e1830c58c6133e2"]}],"status":"SUCCESS"},"type":"TRANSACTION_CONFIRM"} +{"futureId":"TokenRelayer#TokenRelayer","result":{"address":"0x522A51f9c5B1683F0F15910075487c4D162A8b83","type":"SUCCESS"},"type":"DEPLOYMENT_EXECUTION_STATE_COMPLETE"} \ No newline at end of file diff --git a/contracts/relayer/ignition/deployments/chain-43114/artifacts/TokenRelayer#TokenRelayer.dbg.json b/contracts/relayer/ignition/deployments/chain-43114/artifacts/TokenRelayer#TokenRelayer.dbg.json new file mode 100644 index 000000000..14933beb6 --- /dev/null +++ b/contracts/relayer/ignition/deployments/chain-43114/artifacts/TokenRelayer#TokenRelayer.dbg.json @@ -0,0 +1,4 @@ +{ + "_format": "hh-sol-dbg-1", + "buildInfo": "../build-info/1f88a3ad5921d6bc8b511a85d672df5a.json" +} diff --git a/contracts/relayer/ignition/deployments/chain-43114/artifacts/TokenRelayer#TokenRelayer.json b/contracts/relayer/ignition/deployments/chain-43114/artifacts/TokenRelayer#TokenRelayer.json new file mode 100644 index 000000000..007aaf524 --- /dev/null +++ b/contracts/relayer/ignition/deployments/chain-43114/artifacts/TokenRelayer#TokenRelayer.json @@ -0,0 +1,454 @@ +{ + "_format": "hh-sol-artifact-1", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_destinationContract", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "ECDSAInvalidSignature", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "length", + "type": "uint256" + } + ], + "name": "ECDSAInvalidSignatureLength", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "ECDSAInvalidSignatureS", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidShortString", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnableInvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "OwnableUnauthorizedAccount", + "type": "error" + }, + { + "inputs": [], + "name": "ReentrancyGuardReentrantCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "SafeERC20FailedOperation", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "str", + "type": "string" + } + ], + "name": "StringTooLong", + "type": "error" + }, + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "ETHWithdrawn", + "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": true, + "internalType": "address", + "name": "signer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RelayerExecuted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "TokenWithdrawn", + "type": "event" + }, + { + "inputs": [], + "name": "destinationContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "permitV", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "permitR", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "permitS", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "payloadData", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "payloadValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "payloadNonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "payloadDeadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "payloadV", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "payloadR", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "payloadS", + "type": "bytes32" + } + ], + "internalType": "struct TokenRelayer.ExecuteParams", + "name": "params", + "type": "tuple" + } + ], + "name": "execute", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "signer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + } + ], + "name": "isExecutionCompleted", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "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": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "usedPayloadNonces", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdrawETH", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdrawToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "bytecode": "0x610180604052348015610010575f5ffd5b50604051611a4d380380611a4d83398101604081905261002f91610294565b604080518082018252600c81526b2a37b5b2b72932b630bcb2b960a11b602080830191909152825180840190935260018352603160f81b9083015290338061009157604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b61009a816101d6565b5060017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00556100ca826001610225565b610120526100d9816002610225565b61014052815160208084019190912060e052815190820120610100524660a05261016560e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b60805250503060c0526001600160a01b0381166101c45760405162461bcd60e51b815260206004820152601360248201527f496e76616c69642064657374696e6174696f6e000000000000000000000000006044820152606401610088565b6001600160a01b03166101605261046b565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f6020835110156102405761023983610257565b9050610251565b8161024b8482610359565b5060ff90505b92915050565b5f5f829050601f81511115610281578260405163305a27a960e01b81526004016100889190610413565b805161028c82610448565b179392505050565b5f602082840312156102a4575f5ffd5b81516001600160a01b03811681146102ba575f5ffd5b9392505050565b634e487b7160e01b5f52604160045260245ffd5b600181811c908216806102e957607f821691505b60208210810361030757634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111561035457805f5260205f20601f840160051c810160208510156103325750805b601f840160051c820191505b81811015610351575f815560010161033e565b50505b505050565b81516001600160401b03811115610372576103726102c1565b6103868161038084546102d5565b8461030d565b6020601f8211600181146103b8575f83156103a15750848201515b5f19600385901b1c1916600184901b178455610351565b5f84815260208120601f198516915b828110156103e757878501518255602094850194600190920191016103c7565b508482101561040457868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b80516020808301519190811015610307575f1960209190910360031b1b16919050565b60805160a05160c05160e0516101005161012051610140516101605161156c6104e15f395f818160d701528181610525015281816105f4015281816109500152610bf801525f610d2d01525f610cfb01525f6111bc01525f61119401525f6110ef01525f61111901525f611143015261156c5ff3fe608060405260043610610092575f3560e01c80639e281a98116100575780639e281a9814610159578063d850124e14610178578063dcb79457146101c1578063f14210a6146101e0578063f2fde38b146101ff575f5ffd5b80632af83bfe1461009d578063715018a6146100b257806375bd6863146100c657806384b0196e146101165780638da5cb5b1461013d575f5ffd5b3661009957005b5f5ffd5b6100b06100ab3660046112dd565b61021e565b005b3480156100bd575f5ffd5b506100b06106ae565b3480156100d1575f5ffd5b506100f97f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b348015610121575f5ffd5b5061012a6106c1565b60405161010d979695949392919061134a565b348015610148575f5ffd5b505f546001600160a01b03166100f9565b348015610164575f5ffd5b506100b06101733660046113fb565b610703565b348015610183575f5ffd5b506101b16101923660046113fb565b600360209081525f928352604080842090915290825290205460ff1681565b604051901515815260200161010d565b3480156101cc575f5ffd5b506101b16101db3660046113fb565b61078b565b3480156101eb575f5ffd5b506100b06101fa366004611423565b6107b8565b34801561020a575f5ffd5b506100b061021936600461143a565b6108a7565b6102266108e1565b5f610237604083016020840161143a565b90506101208201356001600160a01b03821661028a5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21037bbb732b960991b60448201526064015b60405180910390fd5b5f610298602085018561143a565b6001600160a01b0316036102de5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2103a37b5b2b760991b6044820152606401610281565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff161561033e5760405162461bcd60e51b815260206004820152600a602482015269139bdb98d9481d5cd95960b21b6044820152606401610281565b8261014001354211156103855760405162461bcd60e51b815260206004820152600f60248201526e14185e5b1bd85908195e1c1a5c9959608a1b6044820152606401610281565b5f6103ee83610397602087018761143a565b60408701356103a960e0890189611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250505050610100890135876101408b013561090f565b90506001600160a01b038316610421826104106101808801610160890161149d565b876101800135886101a001356109db565b6001600160a01b0316146104655760405162461bcd60e51b815260206004820152600b60248201526a496e76616c69642073696760a81b6044820152606401610281565b83610100013534146104b95760405162461bcd60e51b815260206004820152601c60248201527f496e636f7272656374204554482076616c75652070726f7669646564000000006044820152606401610281565b6001600160a01b0383165f9081526003602090815260408083208584528252909120805460ff19166001179055610520906104f69086018661143a565b846040870135606088013561051160a08a0160808b0161149d565b8960a001358a60c00135610a07565b6105667f00000000000000000000000000000000000000000000000000000000000000006040860135610556602088018861143a565b6001600160a01b03169190610b75565b5f6105b261057760e0870187611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250349250610bf4915050565b9050806105ef5760405162461bcd60e51b815260206004820152600b60248201526a10d85b1b0819985a5b195960aa1b6044820152606401610281565b6106217f00000000000000000000000000000000000000000000000000000000000000005f610556602089018961143a565b61062e602086018661143a565b6001600160a01b0316846001600160a01b03167f78129a649632642d8e9f346c85d9efb70d32d50a36774c4585491a9228bbd350876040013560405161067691815260200190565b60405180910390a3505050506106ab60017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b50565b6106b6610c79565b6106bf5f610ca5565b565b5f6060805f5f5f60606106d2610cf4565b6106da610d26565b604080515f80825260208201909252600f60f81b9b939a50919850469750309650945092509050565b61070b610c79565b61073061071f5f546001600160a01b031690565b6001600160a01b0384169083610d53565b5f546001600160a01b03166001600160a01b0316826001600160a01b03167fa0524ee0fd8662d6c046d199da2a6d3dc49445182cec055873a5bb9c2843c8e08360405161077f91815260200190565b60405180910390a35050565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff165b92915050565b6107c0610c79565b5f80546040516001600160a01b039091169083908381818185875af1925050503d805f811461080a576040519150601f19603f3d011682016040523d82523d5f602084013e61080f565b606091505b50509050806108565760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610281565b5f546001600160a01b03166001600160a01b03167f6148672a948a12b8e0bf92a9338349b9ac890fad62a234abaf0a4da99f62cfcc8360405161089b91815260200190565b60405180910390a25050565b6108af610c79565b6001600160a01b0381166108d857604051631e4fbdf760e01b81525f6004820152602401610281565b6106ab81610ca5565b6108e9610d60565b60027f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b8351602080860191909120604080517ff0543e2024fd0ae16ccb842686c2733758ec65acfd69fb599c05b286f8db8844938101939093526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691840191909152808a1660608401528816608083015260a0820187905260c082015260e08101849052610100810183905261012081018290525f906109cf906101400160405160208183030381529060405280519060200120610da2565b98975050505050505050565b5f5f5f5f6109eb88888888610dce565b9250925092506109fb8282610e96565b50909695505050505050565b60405163d505accf60e01b81526001600160a01b038781166004830152306024830152604482018790526064820186905260ff8516608483015260a4820184905260c4820183905288169063d505accf9060e4015f604051808303815f87803b158015610a72575f5ffd5b505af1925050508015610a83575060015b610b5757604051636eb1769f60e11b81526001600160a01b03878116600483015230602483015286919089169063dd62ed3e90604401602060405180830381865afa158015610ad4573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610af891906114bd565b1015610b575760405162461bcd60e51b815260206004820152602860248201527f5065726d6974206661696c656420616e6420696e73756666696369656e7420616044820152676c6c6f77616e636560c01b6064820152608401610281565b610b6c6001600160a01b038816873088610f52565b50505050505050565b610b818383835f610f8e565b610bef57610b9283835f6001610f8e565b610bba57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b610bc78383836001610f8e565b610bef57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b505050565b5f5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168385604051610c2f91906114d4565b5f6040518083038185875af1925050503d805f8114610c69576040519150601f19603f3d011682016040523d82523d5f602084013e610c6e565b606091505b509095945050505050565b5f546001600160a01b031633146106bf5760405163118cdaa760e01b8152336004820152602401610281565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006001610ff0565b905090565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006002610ff0565b610bc78383836001611099565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00546002036106bf57604051633ee5aeb560e01b815260040160405180910390fd5b5f6107b2610dae6110e3565b8360405161190160f01b8152600281019290925260228201526042902090565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115610e0757505f91506003905082610e8c565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015610e58573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b038116610e8357505f925060019150829050610e8c565b92505f91508190505b9450945094915050565b5f826003811115610ea957610ea96114ea565b03610eb2575050565b6001826003811115610ec657610ec66114ea565b03610ee45760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115610ef857610ef86114ea565b03610f195760405163fce698f760e01b815260048101829052602401610281565b6003826003811115610f2d57610f2d6114ea565b03610f4e576040516335e2f38360e21b815260048101829052602401610281565b5050565b610f6084848484600161120c565b610f8857604051635274afe760e01b81526001600160a01b0385166004820152602401610281565b50505050565b60405163095ea7b360e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f873b113d1516831692505b60405250949350505050565b606060ff831461100a5761100383611279565b90506107b2565b818054611016906114fe565b80601f0160208091040260200160405190810160405280929190818152602001828054611042906114fe565b801561108d5780601f106110645761010080835404028352916020019161108d565b820191905f5260205f20905b81548152906001019060200180831161107057829003601f168201915b505050505090506107b2565b60405163a9059cbb60e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561113b57507f000000000000000000000000000000000000000000000000000000000000000046145b1561116557507f000000000000000000000000000000000000000000000000000000000000000090565b610d21604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b6040516323b872dd60e01b5f8181526001600160a01b038781166004528616602452604485905291602083606481808c5af1925060015f5114831661126857838315161561125c573d5f823e3d81fd5b5f883b113d1516831692505b604052505f60605295945050505050565b60605f611285836112b6565b6040805160208082528183019092529192505f91906020820181803683375050509182525060208101929092525090565b5f60ff8216601f8111156107b257604051632cd44ac360e21b815260040160405180910390fd5b5f602082840312156112ed575f5ffd5b813567ffffffffffffffff811115611303575f5ffd5b82016101c08185031215611315575f5ffd5b9392505050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b60ff60f81b8816815260e060208201525f61136860e083018961131c565b828103604084015261137a818961131c565b606084018890526001600160a01b038716608085015260a0840186905283810360c0850152845180825260208087019350909101905f5b818110156113cf5783518352602093840193909201916001016113b1565b50909b9a5050505050505050505050565b80356001600160a01b03811681146113f6575f5ffd5b919050565b5f5f6040838503121561140c575f5ffd5b611415836113e0565b946020939093013593505050565b5f60208284031215611433575f5ffd5b5035919050565b5f6020828403121561144a575f5ffd5b611315826113e0565b5f5f8335601e19843603018112611468575f5ffd5b83018035915067ffffffffffffffff821115611482575f5ffd5b602001915036819003821315611496575f5ffd5b9250929050565b5f602082840312156114ad575f5ffd5b813560ff81168114611315575f5ffd5b5f602082840312156114cd575f5ffd5b5051919050565b5f82518060208501845e5f920191825250919050565b634e487b7160e01b5f52602160045260245ffd5b600181811c9082168061151257607f821691505b60208210810361153057634e487b7160e01b5f52602260045260245ffd5b5091905056fea26469706673582212209c34db2f6f83af136a5340cce7fe8ef554ea8eb633656fbf9bff3bd731aec40f64736f6c634300081c0033", + "contractName": "TokenRelayer", + "deployedBytecode": "0x608060405260043610610092575f3560e01c80639e281a98116100575780639e281a9814610159578063d850124e14610178578063dcb79457146101c1578063f14210a6146101e0578063f2fde38b146101ff575f5ffd5b80632af83bfe1461009d578063715018a6146100b257806375bd6863146100c657806384b0196e146101165780638da5cb5b1461013d575f5ffd5b3661009957005b5f5ffd5b6100b06100ab3660046112dd565b61021e565b005b3480156100bd575f5ffd5b506100b06106ae565b3480156100d1575f5ffd5b506100f97f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b348015610121575f5ffd5b5061012a6106c1565b60405161010d979695949392919061134a565b348015610148575f5ffd5b505f546001600160a01b03166100f9565b348015610164575f5ffd5b506100b06101733660046113fb565b610703565b348015610183575f5ffd5b506101b16101923660046113fb565b600360209081525f928352604080842090915290825290205460ff1681565b604051901515815260200161010d565b3480156101cc575f5ffd5b506101b16101db3660046113fb565b61078b565b3480156101eb575f5ffd5b506100b06101fa366004611423565b6107b8565b34801561020a575f5ffd5b506100b061021936600461143a565b6108a7565b6102266108e1565b5f610237604083016020840161143a565b90506101208201356001600160a01b03821661028a5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21037bbb732b960991b60448201526064015b60405180910390fd5b5f610298602085018561143a565b6001600160a01b0316036102de5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2103a37b5b2b760991b6044820152606401610281565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff161561033e5760405162461bcd60e51b815260206004820152600a602482015269139bdb98d9481d5cd95960b21b6044820152606401610281565b8261014001354211156103855760405162461bcd60e51b815260206004820152600f60248201526e14185e5b1bd85908195e1c1a5c9959608a1b6044820152606401610281565b5f6103ee83610397602087018761143a565b60408701356103a960e0890189611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250505050610100890135876101408b013561090f565b90506001600160a01b038316610421826104106101808801610160890161149d565b876101800135886101a001356109db565b6001600160a01b0316146104655760405162461bcd60e51b815260206004820152600b60248201526a496e76616c69642073696760a81b6044820152606401610281565b83610100013534146104b95760405162461bcd60e51b815260206004820152601c60248201527f496e636f7272656374204554482076616c75652070726f7669646564000000006044820152606401610281565b6001600160a01b0383165f9081526003602090815260408083208584528252909120805460ff19166001179055610520906104f69086018661143a565b846040870135606088013561051160a08a0160808b0161149d565b8960a001358a60c00135610a07565b6105667f00000000000000000000000000000000000000000000000000000000000000006040860135610556602088018861143a565b6001600160a01b03169190610b75565b5f6105b261057760e0870187611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250349250610bf4915050565b9050806105ef5760405162461bcd60e51b815260206004820152600b60248201526a10d85b1b0819985a5b195960aa1b6044820152606401610281565b6106217f00000000000000000000000000000000000000000000000000000000000000005f610556602089018961143a565b61062e602086018661143a565b6001600160a01b0316846001600160a01b03167f78129a649632642d8e9f346c85d9efb70d32d50a36774c4585491a9228bbd350876040013560405161067691815260200190565b60405180910390a3505050506106ab60017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b50565b6106b6610c79565b6106bf5f610ca5565b565b5f6060805f5f5f60606106d2610cf4565b6106da610d26565b604080515f80825260208201909252600f60f81b9b939a50919850469750309650945092509050565b61070b610c79565b61073061071f5f546001600160a01b031690565b6001600160a01b0384169083610d53565b5f546001600160a01b03166001600160a01b0316826001600160a01b03167fa0524ee0fd8662d6c046d199da2a6d3dc49445182cec055873a5bb9c2843c8e08360405161077f91815260200190565b60405180910390a35050565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff165b92915050565b6107c0610c79565b5f80546040516001600160a01b039091169083908381818185875af1925050503d805f811461080a576040519150601f19603f3d011682016040523d82523d5f602084013e61080f565b606091505b50509050806108565760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610281565b5f546001600160a01b03166001600160a01b03167f6148672a948a12b8e0bf92a9338349b9ac890fad62a234abaf0a4da99f62cfcc8360405161089b91815260200190565b60405180910390a25050565b6108af610c79565b6001600160a01b0381166108d857604051631e4fbdf760e01b81525f6004820152602401610281565b6106ab81610ca5565b6108e9610d60565b60027f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b8351602080860191909120604080517ff0543e2024fd0ae16ccb842686c2733758ec65acfd69fb599c05b286f8db8844938101939093526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691840191909152808a1660608401528816608083015260a0820187905260c082015260e08101849052610100810183905261012081018290525f906109cf906101400160405160208183030381529060405280519060200120610da2565b98975050505050505050565b5f5f5f5f6109eb88888888610dce565b9250925092506109fb8282610e96565b50909695505050505050565b60405163d505accf60e01b81526001600160a01b038781166004830152306024830152604482018790526064820186905260ff8516608483015260a4820184905260c4820183905288169063d505accf9060e4015f604051808303815f87803b158015610a72575f5ffd5b505af1925050508015610a83575060015b610b5757604051636eb1769f60e11b81526001600160a01b03878116600483015230602483015286919089169063dd62ed3e90604401602060405180830381865afa158015610ad4573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610af891906114bd565b1015610b575760405162461bcd60e51b815260206004820152602860248201527f5065726d6974206661696c656420616e6420696e73756666696369656e7420616044820152676c6c6f77616e636560c01b6064820152608401610281565b610b6c6001600160a01b038816873088610f52565b50505050505050565b610b818383835f610f8e565b610bef57610b9283835f6001610f8e565b610bba57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b610bc78383836001610f8e565b610bef57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b505050565b5f5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168385604051610c2f91906114d4565b5f6040518083038185875af1925050503d805f8114610c69576040519150601f19603f3d011682016040523d82523d5f602084013e610c6e565b606091505b509095945050505050565b5f546001600160a01b031633146106bf5760405163118cdaa760e01b8152336004820152602401610281565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006001610ff0565b905090565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006002610ff0565b610bc78383836001611099565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00546002036106bf57604051633ee5aeb560e01b815260040160405180910390fd5b5f6107b2610dae6110e3565b8360405161190160f01b8152600281019290925260228201526042902090565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115610e0757505f91506003905082610e8c565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015610e58573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b038116610e8357505f925060019150829050610e8c565b92505f91508190505b9450945094915050565b5f826003811115610ea957610ea96114ea565b03610eb2575050565b6001826003811115610ec657610ec66114ea565b03610ee45760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115610ef857610ef86114ea565b03610f195760405163fce698f760e01b815260048101829052602401610281565b6003826003811115610f2d57610f2d6114ea565b03610f4e576040516335e2f38360e21b815260048101829052602401610281565b5050565b610f6084848484600161120c565b610f8857604051635274afe760e01b81526001600160a01b0385166004820152602401610281565b50505050565b60405163095ea7b360e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f873b113d1516831692505b60405250949350505050565b606060ff831461100a5761100383611279565b90506107b2565b818054611016906114fe565b80601f0160208091040260200160405190810160405280929190818152602001828054611042906114fe565b801561108d5780601f106110645761010080835404028352916020019161108d565b820191905f5260205f20905b81548152906001019060200180831161107057829003601f168201915b505050505090506107b2565b60405163a9059cbb60e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561113b57507f000000000000000000000000000000000000000000000000000000000000000046145b1561116557507f000000000000000000000000000000000000000000000000000000000000000090565b610d21604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b6040516323b872dd60e01b5f8181526001600160a01b038781166004528616602452604485905291602083606481808c5af1925060015f5114831661126857838315161561125c573d5f823e3d81fd5b5f883b113d1516831692505b604052505f60605295945050505050565b60605f611285836112b6565b6040805160208082528183019092529192505f91906020820181803683375050509182525060208101929092525090565b5f60ff8216601f8111156107b257604051632cd44ac360e21b815260040160405180910390fd5b5f602082840312156112ed575f5ffd5b813567ffffffffffffffff811115611303575f5ffd5b82016101c08185031215611315575f5ffd5b9392505050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b60ff60f81b8816815260e060208201525f61136860e083018961131c565b828103604084015261137a818961131c565b606084018890526001600160a01b038716608085015260a0840186905283810360c0850152845180825260208087019350909101905f5b818110156113cf5783518352602093840193909201916001016113b1565b50909b9a5050505050505050505050565b80356001600160a01b03811681146113f6575f5ffd5b919050565b5f5f6040838503121561140c575f5ffd5b611415836113e0565b946020939093013593505050565b5f60208284031215611433575f5ffd5b5035919050565b5f6020828403121561144a575f5ffd5b611315826113e0565b5f5f8335601e19843603018112611468575f5ffd5b83018035915067ffffffffffffffff821115611482575f5ffd5b602001915036819003821315611496575f5ffd5b9250929050565b5f602082840312156114ad575f5ffd5b813560ff81168114611315575f5ffd5b5f602082840312156114cd575f5ffd5b5051919050565b5f82518060208501845e5f920191825250919050565b634e487b7160e01b5f52602160045260245ffd5b600181811c9082168061151257607f821691505b60208210810361153057634e487b7160e01b5f52602260045260245ffd5b5091905056fea26469706673582212209c34db2f6f83af136a5340cce7fe8ef554ea8eb633656fbf9bff3bd731aec40f64736f6c634300081c0033", + "deployedLinkReferences": {}, + "linkReferences": {}, + "sourceName": "contracts/TokenRelayer.sol" +} diff --git a/contracts/relayer/ignition/deployments/chain-43114/build-info/1f88a3ad5921d6bc8b511a85d672df5a.json b/contracts/relayer/ignition/deployments/chain-43114/build-info/1f88a3ad5921d6bc8b511a85d672df5a.json new file mode 100644 index 000000000..8b7c007e9 --- /dev/null +++ b/contracts/relayer/ignition/deployments/chain-43114/build-info/1f88a3ad5921d6bc8b511a85d672df5a.json @@ -0,0 +1,137942 @@ +{ + "id": "1f88a3ad5921d6bc8b511a85d672df5a", + "_format": "hh-sol-build-info-1", + "solcVersion": "0.8.28", + "solcLongVersion": "0.8.28+commit.7893614a", + "input": { + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)\n\npragma solidity ^0.8.20;\n\nimport {Context} from \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * The initial owner is set to the address provided by the deployer. This can\n * later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n /**\n * @dev The caller account is not authorized to perform an operation.\n */\n error OwnableUnauthorizedAccount(address account);\n\n /**\n * @dev The owner is not a valid owner account. (eg. `address(0)`)\n */\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\n */\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n _transferOwnership(initialOwner);\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC1363.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1363.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC20} from \"./IERC20.sol\";\nimport {IERC165} from \"./IERC165.sol\";\n\n/**\n * @title IERC1363\n * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].\n *\n * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract\n * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.\n */\ninterface IERC1363 is IERC20, IERC165 {\n /*\n * Note: the ERC-165 identifier for this interface is 0xb0202a11.\n * 0xb0202a11 ===\n * bytes4(keccak256('transferAndCall(address,uint256)')) ^\n * bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^\n * bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^\n * bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^\n * bytes4(keccak256('approveAndCall(address,uint256)')) ^\n * bytes4(keccak256('approveAndCall(address,uint256,bytes)'))\n */\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n * @param to The address which you want to transfer to.\n * @param value The amount of tokens to be transferred.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function transferAndCall(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n * @param to The address which you want to transfer to.\n * @param value The amount of tokens to be transferred.\n * @param data Additional data with no specified format, sent in call to `to`.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n * @param from The address which you want to send tokens from.\n * @param to The address which you want to transfer to.\n * @param value The amount of tokens to be transferred.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function transferFromAndCall(address from, address to, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n * @param from The address which you want to send tokens from.\n * @param to The address which you want to transfer to.\n * @param value The amount of tokens to be transferred.\n * @param data Additional data with no specified format, sent in call to `to`.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n * @param spender The address which will spend the funds.\n * @param value The amount of tokens to be spent.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function approveAndCall(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n * @param spender The address which will spend the funds.\n * @param value The amount of tokens to be spent.\n * @param data Additional data with no specified format, sent in call to `spender`.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC165.sol)\n\npragma solidity >=0.4.16;\n\nimport {IERC165} from \"../utils/introspection/IERC165.sol\";\n" + }, + "@openzeppelin/contracts/interfaces/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol)\n\npragma solidity >=0.4.16;\n\nimport {IERC20} from \"../token/ERC20/IERC20.sol\";\n" + }, + "@openzeppelin/contracts/interfaces/IERC5267.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC5267.sol)\n\npragma solidity >=0.4.16;\n\ninterface IERC5267 {\n /**\n * @dev MAY be emitted to signal that the domain could have changed.\n */\n event EIP712DomainChanged();\n\n /**\n * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\n * signature.\n */\n function eip712Domain()\n external\n view\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n );\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity >=0.4.16;\n\n/**\n * @dev Interface of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also applies here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n *\n * CAUTION: See Security Considerations above.\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)\n\npragma solidity >=0.4.16;\n\n/**\n * @dev Interface of the ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\nimport {IERC1363} from \"../../../interfaces/IERC1363.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n if (!_safeTransfer(token, to, value, true)) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n if (!_safeTransferFrom(token, from, to, value, true)) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.\n */\n function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {\n return _safeTransfer(token, to, value, false);\n }\n\n /**\n * @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.\n */\n function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {\n return _safeTransferFrom(token, from, to, value, false);\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n *\n * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the \"client\"\n * smart contract uses ERC-7674 to set temporary allowances, then the \"client\" smart contract should avoid using\n * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract\n * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.\n */\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n forceApprove(token, spender, oldAllowance + value);\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no\n * value, non-reverting calls are assumed to be successful.\n *\n * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the \"client\"\n * smart contract uses ERC-7674 to set temporary allowances, then the \"client\" smart contract should avoid using\n * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract\n * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.\n */\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance < requestedDecrease) {\n revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);\n }\n forceApprove(token, spender, currentAllowance - requestedDecrease);\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n *\n * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function\n * only sets the \"standard\" allowance. Any temporary allowance will remain active, in addition to the value being\n * set here.\n */\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n if (!_safeApprove(token, spender, value, false)) {\n if (!_safeApprove(token, spender, 0, true)) revert SafeERC20FailedOperation(address(token));\n if (!_safeApprove(token, spender, value, true)) revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no\n * code. This can be used to implement an {ERC721}-like safe transfer that relies on {ERC1363} checks when\n * targeting contracts.\n *\n * Reverts if the returned value is other than `true`.\n */\n function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {\n if (to.code.length == 0) {\n safeTransfer(token, to, value);\n } else if (!token.transferAndCall(to, value, data)) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target\n * has no code. This can be used to implement an {ERC721}-like safe transfer that relies on {ERC1363} checks when\n * targeting contracts.\n *\n * Reverts if the returned value is other than `true`.\n */\n function transferFromAndCallRelaxed(\n IERC1363 token,\n address from,\n address to,\n uint256 value,\n bytes memory data\n ) internal {\n if (to.code.length == 0) {\n safeTransferFrom(token, from, to, value);\n } else if (!token.transferFromAndCall(from, to, value, data)) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no\n * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\n * targeting contracts.\n *\n * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.\n * Oppositely, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}\n * once without retrying, and relies on the returned value to be true.\n *\n * Reverts if the returned value is other than `true`.\n */\n function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {\n if (to.code.length == 0) {\n forceApprove(token, to, value);\n } else if (!token.approveAndCall(to, value, data)) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity `token.transfer(to, value)` call, relaxing the requirement on the return value: the\n * return value is optional (but if data is returned, it must not be false).\n *\n * @param token The token targeted by the call.\n * @param to The recipient of the tokens\n * @param value The amount of token to transfer\n * @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.\n */\n function _safeTransfer(IERC20 token, address to, uint256 value, bool bubble) private returns (bool success) {\n bytes4 selector = IERC20.transfer.selector;\n\n assembly (\"memory-safe\") {\n let fmp := mload(0x40)\n mstore(0x00, selector)\n mstore(0x04, and(to, shr(96, not(0))))\n mstore(0x24, value)\n success := call(gas(), token, 0, 0x00, 0x44, 0x00, 0x20)\n // if call success and return is true, all is good.\n // otherwise (not success or return is not true), we need to perform further checks\n if iszero(and(success, eq(mload(0x00), 1))) {\n // if the call was a failure and bubble is enabled, bubble the error\n if and(iszero(success), bubble) {\n returndatacopy(fmp, 0x00, returndatasize())\n revert(fmp, returndatasize())\n }\n // if the return value is not true, then the call is only successful if:\n // - the token address has code\n // - the returndata is empty\n success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))\n }\n mstore(0x40, fmp)\n }\n }\n\n /**\n * @dev Imitates a Solidity `token.transferFrom(from, to, value)` call, relaxing the requirement on the return\n * value: the return value is optional (but if data is returned, it must not be false).\n *\n * @param token The token targeted by the call.\n * @param from The sender of the tokens\n * @param to The recipient of the tokens\n * @param value The amount of token to transfer\n * @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.\n */\n function _safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value,\n bool bubble\n ) private returns (bool success) {\n bytes4 selector = IERC20.transferFrom.selector;\n\n assembly (\"memory-safe\") {\n let fmp := mload(0x40)\n mstore(0x00, selector)\n mstore(0x04, and(from, shr(96, not(0))))\n mstore(0x24, and(to, shr(96, not(0))))\n mstore(0x44, value)\n success := call(gas(), token, 0, 0x00, 0x64, 0x00, 0x20)\n // if call success and return is true, all is good.\n // otherwise (not success or return is not true), we need to perform further checks\n if iszero(and(success, eq(mload(0x00), 1))) {\n // if the call was a failure and bubble is enabled, bubble the error\n if and(iszero(success), bubble) {\n returndatacopy(fmp, 0x00, returndatasize())\n revert(fmp, returndatasize())\n }\n // if the return value is not true, then the call is only successful if:\n // - the token address has code\n // - the returndata is empty\n success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))\n }\n mstore(0x40, fmp)\n mstore(0x60, 0)\n }\n }\n\n /**\n * @dev Imitates a Solidity `token.approve(spender, value)` call, relaxing the requirement on the return value:\n * the return value is optional (but if data is returned, it must not be false).\n *\n * @param token The token targeted by the call.\n * @param spender The spender of the tokens\n * @param value The amount of token to transfer\n * @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.\n */\n function _safeApprove(IERC20 token, address spender, uint256 value, bool bubble) private returns (bool success) {\n bytes4 selector = IERC20.approve.selector;\n\n assembly (\"memory-safe\") {\n let fmp := mload(0x40)\n mstore(0x00, selector)\n mstore(0x04, and(spender, shr(96, not(0))))\n mstore(0x24, value)\n success := call(gas(), token, 0, 0x00, 0x44, 0x00, 0x20)\n // if call success and return is true, all is good.\n // otherwise (not success or return is not true), we need to perform further checks\n if iszero(and(success, eq(mload(0x00), 1))) {\n // if the call was a failure and bubble is enabled, bubble the error\n if and(iszero(success), bubble) {\n returndatacopy(fmp, 0x00, returndatasize())\n revert(fmp, returndatasize())\n }\n // if the return value is not true, then the call is only successful if:\n // - the token address has code\n // - the returndata is empty\n success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))\n }\n mstore(0x40, fmp)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Bytes.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.6.0) (utils/Bytes.sol)\n\npragma solidity ^0.8.24;\n\nimport {Math} from \"./math/Math.sol\";\n\n/**\n * @dev Bytes operations.\n */\nlibrary Bytes {\n /**\n * @dev Forward search for `s` in `buffer`\n * * If `s` is present in the buffer, returns the index of the first instance\n * * If `s` is not present in the buffer, returns type(uint256).max\n *\n * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf[Javascript's `Array.indexOf`]\n */\n function indexOf(bytes memory buffer, bytes1 s) internal pure returns (uint256) {\n return indexOf(buffer, s, 0);\n }\n\n /**\n * @dev Forward search for `s` in `buffer` starting at position `pos`\n * * If `s` is present in the buffer (at or after `pos`), returns the index of the next instance\n * * If `s` is not present in the buffer (at or after `pos`), returns type(uint256).max\n *\n * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf[Javascript's `Array.indexOf`]\n */\n function indexOf(bytes memory buffer, bytes1 s, uint256 pos) internal pure returns (uint256) {\n uint256 length = buffer.length;\n for (uint256 i = pos; i < length; ++i) {\n if (bytes1(_unsafeReadBytesOffset(buffer, i)) == s) {\n return i;\n }\n }\n return type(uint256).max;\n }\n\n /**\n * @dev Backward search for `s` in `buffer`\n * * If `s` is present in the buffer, returns the index of the last instance\n * * If `s` is not present in the buffer, returns type(uint256).max\n *\n * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf[Javascript's `Array.lastIndexOf`]\n */\n function lastIndexOf(bytes memory buffer, bytes1 s) internal pure returns (uint256) {\n return lastIndexOf(buffer, s, type(uint256).max);\n }\n\n /**\n * @dev Backward search for `s` in `buffer` starting at position `pos`\n * * If `s` is present in the buffer (at or before `pos`), returns the index of the previous instance\n * * If `s` is not present in the buffer (at or before `pos`), returns type(uint256).max\n *\n * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf[Javascript's `Array.lastIndexOf`]\n */\n function lastIndexOf(bytes memory buffer, bytes1 s, uint256 pos) internal pure returns (uint256) {\n unchecked {\n uint256 length = buffer.length;\n for (uint256 i = Math.min(Math.saturatingAdd(pos, 1), length); i > 0; --i) {\n if (bytes1(_unsafeReadBytesOffset(buffer, i - 1)) == s) {\n return i - 1;\n }\n }\n return type(uint256).max;\n }\n }\n\n /**\n * @dev Copies the content of `buffer`, from `start` (included) to the end of `buffer` into a new bytes object in\n * memory.\n *\n * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`]\n */\n function slice(bytes memory buffer, uint256 start) internal pure returns (bytes memory) {\n return slice(buffer, start, buffer.length);\n }\n\n /**\n * @dev Copies the content of `buffer`, from `start` (included) to `end` (excluded) into a new bytes object in\n * memory. The `end` argument is truncated to the length of the `buffer`.\n *\n * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`]\n */\n function slice(bytes memory buffer, uint256 start, uint256 end) internal pure returns (bytes memory) {\n // sanitize\n end = Math.min(end, buffer.length);\n start = Math.min(start, end);\n\n // allocate and copy\n bytes memory result = new bytes(end - start);\n assembly (\"memory-safe\") {\n mcopy(add(result, 0x20), add(add(buffer, 0x20), start), sub(end, start))\n }\n\n return result;\n }\n\n /**\n * @dev Moves the content of `buffer`, from `start` (included) to the end of `buffer` to the start of that buffer,\n * and shrinks the buffer length accordingly, effectively overriding the content of buffer with buffer[start:].\n *\n * NOTE: This function modifies the provided buffer in place. If you need to preserve the original buffer, use {slice} instead\n */\n function splice(bytes memory buffer, uint256 start) internal pure returns (bytes memory) {\n return splice(buffer, start, buffer.length);\n }\n\n /**\n * @dev Moves the content of `buffer`, from `start` (included) to `end` (excluded) to the start of that buffer,\n * and shrinks the buffer length accordingly, effectively overriding the content of buffer with buffer[start:end].\n * The `end` argument is truncated to the length of the `buffer`.\n *\n * NOTE: This function modifies the provided buffer in place. If you need to preserve the original buffer, use {slice} instead\n */\n function splice(bytes memory buffer, uint256 start, uint256 end) internal pure returns (bytes memory) {\n // sanitize\n end = Math.min(end, buffer.length);\n start = Math.min(start, end);\n\n // move and resize\n assembly (\"memory-safe\") {\n mcopy(add(buffer, 0x20), add(add(buffer, 0x20), start), sub(end, start))\n mstore(buffer, sub(end, start))\n }\n\n return buffer;\n }\n\n /**\n * @dev Replaces bytes in `buffer` starting at `pos` with all bytes from `replacement`.\n *\n * Parameters are clamped to valid ranges (i.e. `pos` is clamped to `[0, buffer.length]`).\n * If `pos >= buffer.length`, no replacement occurs and the buffer is returned unchanged.\n *\n * NOTE: This function modifies the provided buffer in place.\n */\n function replace(bytes memory buffer, uint256 pos, bytes memory replacement) internal pure returns (bytes memory) {\n return replace(buffer, pos, replacement, 0, replacement.length);\n }\n\n /**\n * @dev Replaces bytes in `buffer` starting at `pos` with bytes from `replacement` starting at `offset`.\n * Copies at most `length` bytes from `replacement` to `buffer`.\n *\n * Parameters are clamped to valid ranges (i.e. `pos` is clamped to `[0, buffer.length]`, `offset` is\n * clamped to `[0, replacement.length]`, and `length` is clamped to `min(length, replacement.length - offset,\n * buffer.length - pos))`. If `pos >= buffer.length` or `offset >= replacement.length`, no replacement occurs\n * and the buffer is returned unchanged.\n *\n * NOTE: This function modifies the provided buffer in place.\n */\n function replace(\n bytes memory buffer,\n uint256 pos,\n bytes memory replacement,\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory) {\n // sanitize\n pos = Math.min(pos, buffer.length);\n offset = Math.min(offset, replacement.length);\n length = Math.min(length, Math.min(replacement.length - offset, buffer.length - pos));\n\n // replace\n assembly (\"memory-safe\") {\n mcopy(add(add(buffer, 0x20), pos), add(add(replacement, 0x20), offset), length)\n }\n\n return buffer;\n }\n\n /**\n * @dev Concatenate an array of bytes into a single bytes object.\n *\n * For fixed bytes types, we recommend using the solidity built-in `bytes.concat` or (equivalent)\n * `abi.encodePacked`.\n *\n * NOTE: this could be done in assembly with a single loop that expands starting at the FMP, but that would be\n * significantly less readable. It might be worth benchmarking the savings of the full-assembly approach.\n */\n function concat(bytes[] memory buffers) internal pure returns (bytes memory) {\n uint256 length = 0;\n for (uint256 i = 0; i < buffers.length; ++i) {\n length += buffers[i].length;\n }\n\n bytes memory result = new bytes(length);\n\n uint256 offset = 0x20;\n for (uint256 i = 0; i < buffers.length; ++i) {\n bytes memory input = buffers[i];\n assembly (\"memory-safe\") {\n mcopy(add(result, offset), add(input, 0x20), mload(input))\n }\n unchecked {\n offset += input.length;\n }\n }\n\n return result;\n }\n\n /**\n * @dev Split each byte in `input` into two nibbles (4 bits each)\n *\n * Example: hex\"01234567\" → hex\"0001020304050607\"\n */\n function toNibbles(bytes memory input) internal pure returns (bytes memory output) {\n assembly (\"memory-safe\") {\n let length := mload(input)\n output := mload(0x40)\n mstore(0x40, add(add(output, 0x20), mul(length, 2)))\n mstore(output, mul(length, 2))\n for {\n let i := 0\n } lt(i, length) {\n i := add(i, 0x10)\n } {\n let chunk := shr(128, mload(add(add(input, 0x20), i)))\n chunk := and(\n 0x0000000000000000ffffffffffffffff0000000000000000ffffffffffffffff,\n or(shl(64, chunk), chunk)\n )\n chunk := and(\n 0x00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff,\n or(shl(32, chunk), chunk)\n )\n chunk := and(\n 0x0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff,\n or(shl(16, chunk), chunk)\n )\n chunk := and(\n 0x00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff,\n or(shl(8, chunk), chunk)\n )\n chunk := and(\n 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f,\n or(shl(4, chunk), chunk)\n )\n mstore(add(add(output, 0x20), mul(i, 2)), chunk)\n }\n }\n }\n\n /**\n * @dev Returns true if the two byte buffers are equal.\n */\n function equal(bytes memory a, bytes memory b) internal pure returns (bool) {\n return a.length == b.length && keccak256(a) == keccak256(b);\n }\n\n /**\n * @dev Reverses the byte order of a bytes32 value, converting between little-endian and big-endian.\n * Inspired by https://graphics.stanford.edu/~seander/bithacks.html#ReverseParallel[Reverse Parallel]\n */\n function reverseBytes32(bytes32 value) internal pure returns (bytes32) {\n value = // swap bytes\n ((value >> 8) & 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF) |\n ((value & 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF) << 8);\n value = // swap 2-byte long pairs\n ((value >> 16) & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) |\n ((value & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) << 16);\n value = // swap 4-byte long pairs\n ((value >> 32) & 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) |\n ((value & 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) << 32);\n value = // swap 8-byte long pairs\n ((value >> 64) & 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) |\n ((value & 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) << 64);\n return (value >> 128) | (value << 128); // swap 16-byte long pairs\n }\n\n /// @dev Same as {reverseBytes32} but optimized for 128-bit values.\n function reverseBytes16(bytes16 value) internal pure returns (bytes16) {\n value = // swap bytes\n ((value & 0xFF00FF00FF00FF00FF00FF00FF00FF00) >> 8) |\n ((value & 0x00FF00FF00FF00FF00FF00FF00FF00FF) << 8);\n value = // swap 2-byte long pairs\n ((value & 0xFFFF0000FFFF0000FFFF0000FFFF0000) >> 16) |\n ((value & 0x0000FFFF0000FFFF0000FFFF0000FFFF) << 16);\n value = // swap 4-byte long pairs\n ((value & 0xFFFFFFFF00000000FFFFFFFF00000000) >> 32) |\n ((value & 0x00000000FFFFFFFF00000000FFFFFFFF) << 32);\n return (value >> 64) | (value << 64); // swap 8-byte long pairs\n }\n\n /// @dev Same as {reverseBytes32} but optimized for 64-bit values.\n function reverseBytes8(bytes8 value) internal pure returns (bytes8) {\n value = ((value & 0xFF00FF00FF00FF00) >> 8) | ((value & 0x00FF00FF00FF00FF) << 8); // swap bytes\n value = ((value & 0xFFFF0000FFFF0000) >> 16) | ((value & 0x0000FFFF0000FFFF) << 16); // swap 2-byte long pairs\n return (value >> 32) | (value << 32); // swap 4-byte long pairs\n }\n\n /// @dev Same as {reverseBytes32} but optimized for 32-bit values.\n function reverseBytes4(bytes4 value) internal pure returns (bytes4) {\n value = ((value & 0xFF00FF00) >> 8) | ((value & 0x00FF00FF) << 8); // swap bytes\n return (value >> 16) | (value << 16); // swap 2-byte long pairs\n }\n\n /// @dev Same as {reverseBytes32} but optimized for 16-bit values.\n function reverseBytes2(bytes2 value) internal pure returns (bytes2) {\n return (value >> 8) | (value << 8);\n }\n\n /**\n * @dev Counts the number of leading zero bits a bytes array. Returns `8 * buffer.length`\n * if the buffer is all zeros.\n */\n function clz(bytes memory buffer) internal pure returns (uint256) {\n for (uint256 i = 0; i < buffer.length; i += 0x20) {\n bytes32 chunk = _unsafeReadBytesOffset(buffer, i);\n if (chunk != bytes32(0)) {\n return Math.min(8 * i + Math.clz(uint256(chunk)), 8 * buffer.length);\n }\n }\n return 8 * buffer.length;\n }\n\n /**\n * @dev Reads a bytes32 from a bytes array without bounds checking.\n *\n * NOTE: making this function internal would mean it could be used with memory unsafe offset, and marking the\n * assembly block as such would prevent some optimizations.\n */\n function _unsafeReadBytesOffset(bytes memory buffer, uint256 offset) private pure returns (bytes32 value) {\n // This is not memory safe in the general case, but all calls to this private function are within bounds.\n assembly (\"memory-safe\") {\n value := mload(add(add(buffer, 0x20), offset))\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.6.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS\n }\n\n /**\n * @dev The signature is invalid.\n */\n error ECDSAInvalidSignature();\n\n /**\n * @dev The signature has an invalid length.\n */\n error ECDSAInvalidSignatureLength(uint256 length);\n\n /**\n * @dev The signature has an S value that is in the upper half order.\n */\n error ECDSAInvalidSignatureS(bytes32 s);\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not\n * return address(0) without also returning an error description. Errors are documented using an enum (error type)\n * and a bytes32 providing additional information about the error.\n *\n * If no error is returned, then the address can be used for verification purposes.\n *\n * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * NOTE: This function only supports 65-byte signatures. ERC-2098 short signatures are rejected. This restriction\n * is DEPRECATED and will be removed in v6.0. Developers SHOULD NOT use signatures as unique identifiers; use hash\n * invalidation or nonces for replay protection.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n *\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n */\n function tryRecover(\n bytes32 hash,\n bytes memory signature\n ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly (\"memory-safe\") {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));\n }\n }\n\n /**\n * @dev Variant of {tryRecover} that takes a signature in calldata\n */\n function tryRecoverCalldata(\n bytes32 hash,\n bytes calldata signature\n ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, calldata slices would work here, but are\n // significantly more expensive (length check) than using calldataload in assembly.\n assembly (\"memory-safe\") {\n r := calldataload(signature.offset)\n s := calldataload(add(signature.offset, 0x20))\n v := byte(0, calldataload(add(signature.offset, 0x40)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * NOTE: This function only supports 65-byte signatures. ERC-2098 short signatures are rejected. This restriction\n * is DEPRECATED and will be removed in v6.0. Developers SHOULD NOT use signatures as unique identifiers; use hash\n * invalidation or nonces for replay protection.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);\n _throwError(error, errorArg);\n return recovered;\n }\n\n /**\n * @dev Variant of {recover} that takes a signature in calldata\n */\n function recoverCalldata(bytes32 hash, bytes calldata signature) internal pure returns (address) {\n (address recovered, RecoverError error, bytes32 errorArg) = tryRecoverCalldata(hash, signature);\n _throwError(error, errorArg);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[ERC-2098 short signatures]\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {\n unchecked {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n // We do not check for an overflow here since the shift operation results in 0 or 1.\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r` and `vs` short-signature fields separately.\n */\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\n (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);\n _throwError(error, errorArg);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS, s);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature, bytes32(0));\n }\n\n return (signer, RecoverError.NoError, bytes32(0));\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);\n _throwError(error, errorArg);\n return recovered;\n }\n\n /**\n * @dev Parse a signature into its `v`, `r` and `s` components. Supports 65-byte and 64-byte (ERC-2098)\n * formats. Returns (0,0,0) for invalid signatures.\n *\n * For 64-byte signatures, `v` is automatically normalized to 27 or 28.\n * For 65-byte signatures, `v` is returned as-is and MUST already be 27 or 28 for use with ecrecover.\n *\n * Consider validating the result before use, or use {tryRecover}/{recover} which perform full validation.\n */\n function parse(bytes memory signature) internal pure returns (uint8 v, bytes32 r, bytes32 s) {\n assembly (\"memory-safe\") {\n // Check the signature length\n switch mload(signature)\n // - case 65: r,s,v signature (standard)\n case 65 {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098)\n case 64 {\n let vs := mload(add(signature, 0x40))\n r := mload(add(signature, 0x20))\n s := and(vs, shr(1, not(0)))\n v := add(shr(255, vs), 27)\n }\n default {\n r := 0\n s := 0\n v := 0\n }\n }\n }\n\n /**\n * @dev Variant of {parse} that takes a signature in calldata\n */\n function parseCalldata(bytes calldata signature) internal pure returns (uint8 v, bytes32 r, bytes32 s) {\n assembly (\"memory-safe\") {\n // Check the signature length\n switch signature.length\n // - case 65: r,s,v signature (standard)\n case 65 {\n r := calldataload(signature.offset)\n s := calldataload(add(signature.offset, 0x20))\n v := byte(0, calldataload(add(signature.offset, 0x40)))\n }\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098)\n case 64 {\n let vs := calldataload(add(signature.offset, 0x20))\n r := calldataload(signature.offset)\n s := and(vs, shr(1, not(0)))\n v := add(shr(255, vs), 27)\n }\n default {\n r := 0\n s := 0\n v := 0\n }\n }\n }\n\n /**\n * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.\n */\n function _throwError(RecoverError error, bytes32 errorArg) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert ECDSAInvalidSignature();\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert ECDSAInvalidSignatureLength(uint256(errorArg));\n } else if (error == RecoverError.InvalidSignatureS) {\n revert ECDSAInvalidSignatureS(errorArg);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/EIP712.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.24;\n\nimport {MessageHashUtils} from \"./MessageHashUtils.sol\";\nimport {ShortStrings, ShortString} from \"../ShortStrings.sol\";\nimport {IERC5267} from \"../../interfaces/IERC5267.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP-712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose\n * encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract\n * does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to\n * produce the hash of their typed data using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP-712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\n * separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the\n * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\n *\n * @custom:oz-upgrades-unsafe-allow state-variable-immutable\n */\nabstract contract EIP712 is IERC5267 {\n using ShortStrings for *;\n\n bytes32 private constant TYPE_HASH =\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\n // invalidate the cached domain separator if the chain id changes.\n bytes32 private immutable _cachedDomainSeparator;\n uint256 private immutable _cachedChainId;\n address private immutable _cachedThis;\n\n bytes32 private immutable _hashedName;\n bytes32 private immutable _hashedVersion;\n\n ShortString private immutable _name;\n ShortString private immutable _version;\n // slither-disable-next-line constable-states\n string private _nameFallback;\n // slither-disable-next-line constable-states\n string private _versionFallback;\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP-712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n constructor(string memory name, string memory version) {\n _name = name.toShortStringWithFallback(_nameFallback);\n _version = version.toShortStringWithFallback(_versionFallback);\n _hashedName = keccak256(bytes(name));\n _hashedVersion = keccak256(bytes(version));\n\n _cachedChainId = block.chainid;\n _cachedDomainSeparator = _buildDomainSeparator();\n _cachedThis = address(this);\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n if (address(this) == _cachedThis && block.chainid == _cachedChainId) {\n return _cachedDomainSeparator;\n } else {\n return _buildDomainSeparator();\n }\n }\n\n function _buildDomainSeparator() private view returns (bytes32) {\n return keccak256(abi.encode(TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n\n /// @inheritdoc IERC5267\n function eip712Domain()\n public\n view\n virtual\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n )\n {\n return (\n hex\"0f\", // 01111\n _EIP712Name(),\n _EIP712Version(),\n block.chainid,\n address(this),\n bytes32(0),\n new uint256[](0)\n );\n }\n\n /**\n * @dev The name parameter for the EIP712 domain.\n *\n * NOTE: By default this function reads _name which is an immutable value.\n * It only reads from storage if necessary (in case the value is too large to fit in a ShortString).\n */\n // solhint-disable-next-line func-name-mixedcase\n function _EIP712Name() internal view returns (string memory) {\n return _name.toStringWithFallback(_nameFallback);\n }\n\n /**\n * @dev The version parameter for the EIP712 domain.\n *\n * NOTE: By default this function reads _version which is an immutable value.\n * It only reads from storage if necessary (in case the value is too large to fit in a ShortString).\n */\n // solhint-disable-next-line func-name-mixedcase\n function _EIP712Version() internal view returns (string memory) {\n return _version.toStringWithFallback(_versionFallback);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.6.0) (utils/cryptography/MessageHashUtils.sol)\n\npragma solidity ^0.8.24;\n\nimport {Strings} from \"../Strings.sol\";\n\n/**\n * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.\n *\n * The library provides methods for generating a hash of a message that conforms to the\n * https://eips.ethereum.org/EIPS/eip-191[ERC-191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]\n * specifications.\n */\nlibrary MessageHashUtils {\n error ERC5267ExtensionsNotSupported();\n\n /**\n * @dev Returns the keccak256 digest of an ERC-191 signed data with version\n * `0x45` (`personal_sign` messages).\n *\n * The digest is calculated by prefixing a bytes32 `messageHash` with\n * `\"\\x19Ethereum Signed Message:\\n32\"` and hashing the result. It corresponds with the\n * hash signed when using the https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sign[`eth_sign`] JSON-RPC method.\n *\n * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with\n * keccak256, although any bytes32 value can be safely used because the final digest will\n * be re-hashed.\n *\n * See {ECDSA-recover}.\n */\n function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) {\n assembly (\"memory-safe\") {\n mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\") // 32 is the bytes-length of messageHash\n mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix\n digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20)\n }\n }\n\n /**\n * @dev Returns the keccak256 digest of an ERC-191 signed data with version\n * `0x45` (`personal_sign` messages).\n *\n * The digest is calculated by prefixing an arbitrary `message` with\n * `\"\\x19Ethereum Signed Message:\\n\" + len(message)` and hashing the result. It corresponds with the\n * hash signed when using the https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sign[`eth_sign`] JSON-RPC method.\n *\n * See {ECDSA-recover}.\n */\n function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) {\n return\n keccak256(bytes.concat(\"\\x19Ethereum Signed Message:\\n\", bytes(Strings.toString(message.length)), message));\n }\n\n /**\n * @dev Returns the keccak256 digest of an ERC-191 signed data with version\n * `0x00` (data with intended validator).\n *\n * The digest is calculated by prefixing an arbitrary `data` with `\"\\x19\\x00\"` and the intended\n * `validator` address. Then hashing the result.\n *\n * See {ECDSA-recover}.\n */\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(hex\"19_00\", validator, data));\n }\n\n /**\n * @dev Variant of {toDataWithIntendedValidatorHash-address-bytes} optimized for cases where `data` is a bytes32.\n */\n function toDataWithIntendedValidatorHash(\n address validator,\n bytes32 messageHash\n ) internal pure returns (bytes32 digest) {\n assembly (\"memory-safe\") {\n mstore(0x00, hex\"19_00\")\n mstore(0x02, shl(96, validator))\n mstore(0x16, messageHash)\n digest := keccak256(0x00, 0x36)\n }\n }\n\n /**\n * @dev Returns the keccak256 digest of an EIP-712 typed data (ERC-191 version `0x01`).\n *\n * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with\n * `\\x19\\x01` and hashing the result. It corresponds to the hash signed by the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.\n *\n * See {ECDSA-recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) {\n assembly (\"memory-safe\") {\n let ptr := mload(0x40)\n mstore(ptr, hex\"19_01\")\n mstore(add(ptr, 0x02), domainSeparator)\n mstore(add(ptr, 0x22), structHash)\n digest := keccak256(ptr, 0x42)\n }\n }\n\n /**\n * @dev Returns the EIP-712 domain separator constructed from an `eip712Domain`. See {IERC5267-eip712Domain}\n *\n * This function dynamically constructs the domain separator based on which fields are present in the\n * `fields` parameter. It contains flags that indicate which domain fields are present:\n *\n * * Bit 0 (0x01): name\n * * Bit 1 (0x02): version\n * * Bit 2 (0x04): chainId\n * * Bit 3 (0x08): verifyingContract\n * * Bit 4 (0x10): salt\n *\n * Arguments that correspond to fields which are not present in `fields` are ignored. For example, if `fields` is\n * `0x0f` (`0b01111`), then the `salt` parameter is ignored.\n */\n function toDomainSeparator(\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt\n ) internal pure returns (bytes32 hash) {\n return\n toDomainSeparator(\n fields,\n keccak256(bytes(name)),\n keccak256(bytes(version)),\n chainId,\n verifyingContract,\n salt\n );\n }\n\n /// @dev Variant of {toDomainSeparator-bytes1-string-string-uint256-address-bytes32} that uses hashed name and version.\n function toDomainSeparator(\n bytes1 fields,\n bytes32 nameHash,\n bytes32 versionHash,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt\n ) internal pure returns (bytes32 hash) {\n bytes32 domainTypeHash = toDomainTypeHash(fields);\n\n assembly (\"memory-safe\") {\n // align fields to the right for easy processing\n fields := shr(248, fields)\n\n // FMP used as scratch space\n let fmp := mload(0x40)\n mstore(fmp, domainTypeHash)\n\n let ptr := add(fmp, 0x20)\n if and(fields, 0x01) {\n mstore(ptr, nameHash)\n ptr := add(ptr, 0x20)\n }\n if and(fields, 0x02) {\n mstore(ptr, versionHash)\n ptr := add(ptr, 0x20)\n }\n if and(fields, 0x04) {\n mstore(ptr, chainId)\n ptr := add(ptr, 0x20)\n }\n if and(fields, 0x08) {\n mstore(ptr, verifyingContract)\n ptr := add(ptr, 0x20)\n }\n if and(fields, 0x10) {\n mstore(ptr, salt)\n ptr := add(ptr, 0x20)\n }\n\n hash := keccak256(fmp, sub(ptr, fmp))\n }\n }\n\n /// @dev Builds an EIP-712 domain type hash depending on the `fields` provided, following https://eips.ethereum.org/EIPS/eip-5267[ERC-5267]\n function toDomainTypeHash(bytes1 fields) internal pure returns (bytes32 hash) {\n if (fields & 0x20 == 0x20) revert ERC5267ExtensionsNotSupported();\n\n assembly (\"memory-safe\") {\n // align fields to the right for easy processing\n fields := shr(248, fields)\n\n // FMP used as scratch space\n let fmp := mload(0x40)\n mstore(fmp, \"EIP712Domain(\")\n\n let ptr := add(fmp, 0x0d)\n // name field\n if and(fields, 0x01) {\n mstore(ptr, \"string name,\")\n ptr := add(ptr, 0x0c)\n }\n // version field\n if and(fields, 0x02) {\n mstore(ptr, \"string version,\")\n ptr := add(ptr, 0x0f)\n }\n // chainId field\n if and(fields, 0x04) {\n mstore(ptr, \"uint256 chainId,\")\n ptr := add(ptr, 0x10)\n }\n // verifyingContract field\n if and(fields, 0x08) {\n mstore(ptr, \"address verifyingContract,\")\n ptr := add(ptr, 0x1a)\n }\n // salt field\n if and(fields, 0x10) {\n mstore(ptr, \"bytes32 salt,\")\n ptr := add(ptr, 0x0d)\n }\n // if any field is enabled, remove the trailing comma\n ptr := sub(ptr, iszero(iszero(and(fields, 0x1f))))\n // add the closing brace\n mstore8(ptr, 0x29) // add closing brace\n ptr := add(ptr, 1)\n\n hash := keccak256(fmp, sub(ptr, fmp))\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)\n\npragma solidity >=0.4.16;\n\n/**\n * @dev Interface of the ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.6.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.20;\n\nimport {Panic} from \"../Panic.sol\";\nimport {SafeCast} from \"./SafeCast.sol\";\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Floor, // Toward negative infinity\n Ceil, // Toward positive infinity\n Trunc, // Toward zero\n Expand // Away from zero\n }\n\n /**\n * @dev Return the 512-bit addition of two uint256.\n *\n * The result is stored in two 256 variables such that sum = high * 2²⁵⁶ + low.\n */\n function add512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {\n assembly (\"memory-safe\") {\n low := add(a, b)\n high := lt(low, a)\n }\n }\n\n /**\n * @dev Return the 512-bit multiplication of two uint256.\n *\n * The result is stored in two 256 variables such that product = high * 2²⁵⁶ + low.\n */\n function mul512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {\n // 512-bit multiply [high low] = x * y. Compute the product mod 2²⁵⁶ and mod 2²⁵⁶ - 1, then use\n // the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = high * 2²⁵⁶ + low.\n assembly (\"memory-safe\") {\n let mm := mulmod(a, b, not(0))\n low := mul(a, b)\n high := sub(sub(mm, low), lt(mm, low))\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, with a success flag (no overflow).\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n unchecked {\n uint256 c = a + b;\n success = c >= a;\n result = c * SafeCast.toUint(success);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with a success flag (no overflow).\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n unchecked {\n uint256 c = a - b;\n success = c <= a;\n result = c * SafeCast.toUint(success);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with a success flag (no overflow).\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n unchecked {\n uint256 c = a * b;\n assembly (\"memory-safe\") {\n // Only true when the multiplication doesn't overflow\n // (c / a == b) || (a == 0)\n success := or(eq(div(c, a), b), iszero(a))\n }\n // equivalent to: success ? c : 0\n result = c * SafeCast.toUint(success);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a success flag (no division by zero).\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n unchecked {\n success = b > 0;\n assembly (\"memory-safe\") {\n // The `DIV` opcode returns zero when the denominator is 0.\n result := div(a, b)\n }\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a success flag (no division by zero).\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n unchecked {\n success = b > 0;\n assembly (\"memory-safe\") {\n // The `MOD` opcode returns zero when the denominator is 0.\n result := mod(a, b)\n }\n }\n }\n\n /**\n * @dev Unsigned saturating addition, bounds to `2²⁵⁶ - 1` instead of overflowing.\n */\n function saturatingAdd(uint256 a, uint256 b) internal pure returns (uint256) {\n (bool success, uint256 result) = tryAdd(a, b);\n return ternary(success, result, type(uint256).max);\n }\n\n /**\n * @dev Unsigned saturating subtraction, bounds to zero instead of overflowing.\n */\n function saturatingSub(uint256 a, uint256 b) internal pure returns (uint256) {\n (, uint256 result) = trySub(a, b);\n return result;\n }\n\n /**\n * @dev Unsigned saturating multiplication, bounds to `2²⁵⁶ - 1` instead of overflowing.\n */\n function saturatingMul(uint256 a, uint256 b) internal pure returns (uint256) {\n (bool success, uint256 result) = tryMul(a, b);\n return ternary(success, result, type(uint256).max);\n }\n\n /**\n * @dev Branchless ternary evaluation for `condition ? a : b`. Gas costs are constant.\n *\n * IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.\n * However, the compiler may optimize Solidity ternary operations (i.e. `condition ? a : b`) to only compute\n * one branch when needed, making this function more expensive.\n */\n function ternary(bool condition, uint256 a, uint256 b) internal pure returns (uint256) {\n unchecked {\n // branchless ternary works because:\n // b ^ (a ^ b) == a\n // b ^ 0 == b\n return b ^ ((a ^ b) * SafeCast.toUint(condition));\n }\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return ternary(a > b, a, b);\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return ternary(a < b, a, b);\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n unchecked {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds towards infinity instead\n * of rounding towards zero.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n if (b == 0) {\n // Guarantee the same behavior as in a regular Solidity division.\n Panic.panic(Panic.DIVISION_BY_ZERO);\n }\n\n // The following calculation ensures accurate ceiling division without overflow.\n // Since a is non-zero, (a - 1) / b will not overflow.\n // The largest possible result occurs when (a - 1) / b is type(uint256).max,\n // but the largest value we can obtain is type(uint256).max - 1, which happens\n // when a = type(uint256).max and b = 1.\n unchecked {\n return SafeCast.toUint(a > 0) * ((a - 1) / b + 1);\n }\n }\n\n /**\n * @dev Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or\n * denominator == 0.\n *\n * Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by\n * Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n (uint256 high, uint256 low) = mul512(x, y);\n\n // Handle non-overflow cases, 256 by 256 division.\n if (high == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return low / denominator;\n }\n\n // Make sure the result is less than 2²⁵⁶. Also prevents denominator == 0.\n if (denominator <= high) {\n Panic.panic(ternary(denominator == 0, Panic.DIVISION_BY_ZERO, Panic.UNDER_OVERFLOW));\n }\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [high low].\n uint256 remainder;\n assembly (\"memory-safe\") {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n high := sub(high, gt(remainder, low))\n low := sub(low, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator.\n // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.\n\n uint256 twos = denominator & (0 - denominator);\n assembly (\"memory-safe\") {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [high low] by twos.\n low := div(low, twos)\n\n // Flip twos such that it is 2²⁵⁶ / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from high into low.\n low |= high * twos;\n\n // Invert denominator mod 2²⁵⁶. Now that denominator is an odd number, it has an inverse modulo 2²⁵⁶ such\n // that denominator * inv ≡ 1 mod 2²⁵⁶. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv ≡ 1 mod 2⁴.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also\n // works in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2⁸\n inverse *= 2 - denominator * inverse; // inverse mod 2¹⁶\n inverse *= 2 - denominator * inverse; // inverse mod 2³²\n inverse *= 2 - denominator * inverse; // inverse mod 2⁶⁴\n inverse *= 2 - denominator * inverse; // inverse mod 2¹²⁸\n inverse *= 2 - denominator * inverse; // inverse mod 2²⁵⁶\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2²⁵⁶. Since the preconditions guarantee that the outcome is\n // less than 2²⁵⁶, this is the final result. We don't need to compute the high bits of the result and high\n // is no longer required.\n result = low * inverse;\n return result;\n }\n }\n\n /**\n * @dev Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n return mulDiv(x, y, denominator) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0);\n }\n\n /**\n * @dev Calculates floor(x * y >> n) with full precision. Throws if result overflows a uint256.\n */\n function mulShr(uint256 x, uint256 y, uint8 n) internal pure returns (uint256 result) {\n unchecked {\n (uint256 high, uint256 low) = mul512(x, y);\n if (high >= 1 << n) {\n Panic.panic(Panic.UNDER_OVERFLOW);\n }\n return (high << (256 - n)) | (low >> n);\n }\n }\n\n /**\n * @dev Calculates x * y >> n with full precision, following the selected rounding direction.\n */\n function mulShr(uint256 x, uint256 y, uint8 n, Rounding rounding) internal pure returns (uint256) {\n return mulShr(x, y, n) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, 1 << n) > 0);\n }\n\n /**\n * @dev Calculate the modular multiplicative inverse of a number in Z/nZ.\n *\n * If n is a prime, then Z/nZ is a field. In that case all elements are inversible, except 0.\n * If n is not a prime, then Z/nZ is not a field, and some elements might not be inversible.\n *\n * If the input value is not inversible, 0 is returned.\n *\n * NOTE: If you know for sure that n is (big) a prime, it may be cheaper to use Fermat's little theorem and get the\n * inverse using `Math.modExp(a, n - 2, n)`. See {invModPrime}.\n */\n function invMod(uint256 a, uint256 n) internal pure returns (uint256) {\n unchecked {\n if (n == 0) return 0;\n\n // The inverse modulo is calculated using the Extended Euclidean Algorithm (iterative version)\n // Used to compute integers x and y such that: ax + ny = gcd(a, n).\n // When the gcd is 1, then the inverse of a modulo n exists and it's x.\n // ax + ny = 1\n // ax = 1 + (-y)n\n // ax ≡ 1 (mod n) # x is the inverse of a modulo n\n\n // If the remainder is 0 the gcd is n right away.\n uint256 remainder = a % n;\n uint256 gcd = n;\n\n // Therefore the initial coefficients are:\n // ax + ny = gcd(a, n) = n\n // 0a + 1n = n\n int256 x = 0;\n int256 y = 1;\n\n while (remainder != 0) {\n uint256 quotient = gcd / remainder;\n\n (gcd, remainder) = (\n // The old remainder is the next gcd to try.\n remainder,\n // Compute the next remainder.\n // Can't overflow given that (a % gcd) * (gcd // (a % gcd)) <= gcd\n // where gcd is at most n (capped to type(uint256).max)\n gcd - remainder * quotient\n );\n\n (x, y) = (\n // Increment the coefficient of a.\n y,\n // Decrement the coefficient of n.\n // Can overflow, but the result is casted to uint256 so that the\n // next value of y is \"wrapped around\" to a value between 0 and n - 1.\n x - y * int256(quotient)\n );\n }\n\n if (gcd != 1) return 0; // No inverse exists.\n return ternary(x < 0, n - uint256(-x), uint256(x)); // Wrap the result if it's negative.\n }\n }\n\n /**\n * @dev Variant of {invMod}. More efficient, but only works if `p` is known to be a prime greater than `2`.\n *\n * From https://en.wikipedia.org/wiki/Fermat%27s_little_theorem[Fermat's little theorem], we know that if p is\n * prime, then `a**(p-1) ≡ 1 mod p`. As a consequence, we have `a * a**(p-2) ≡ 1 mod p`, which means that\n * `a**(p-2)` is the modular multiplicative inverse of a in Fp.\n *\n * NOTE: this function does NOT check that `p` is a prime greater than `2`.\n */\n function invModPrime(uint256 a, uint256 p) internal view returns (uint256) {\n unchecked {\n return Math.modExp(a, p - 2, p);\n }\n }\n\n /**\n * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m)\n *\n * Requirements:\n * - modulus can't be zero\n * - underlying staticcall to precompile must succeed\n *\n * IMPORTANT: The result is only valid if the underlying call succeeds. When using this function, make\n * sure the chain you're using it on supports the precompiled contract for modular exponentiation\n * at address 0x05 as specified in https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise,\n * the underlying function will succeed given the lack of a revert, but the result may be incorrectly\n * interpreted as 0.\n */\n function modExp(uint256 b, uint256 e, uint256 m) internal view returns (uint256) {\n (bool success, uint256 result) = tryModExp(b, e, m);\n if (!success) {\n Panic.panic(Panic.DIVISION_BY_ZERO);\n }\n return result;\n }\n\n /**\n * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m).\n * It includes a success flag indicating if the operation succeeded. Operation will be marked as failed if trying\n * to operate modulo 0 or if the underlying precompile reverted.\n *\n * IMPORTANT: The result is only valid if the success flag is true. When using this function, make sure the chain\n * you're using it on supports the precompiled contract for modular exponentiation at address 0x05 as specified in\n * https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, the underlying function will succeed given the lack\n * of a revert, but the result may be incorrectly interpreted as 0.\n */\n function tryModExp(uint256 b, uint256 e, uint256 m) internal view returns (bool success, uint256 result) {\n if (m == 0) return (false, 0);\n assembly (\"memory-safe\") {\n let ptr := mload(0x40)\n // | Offset | Content | Content (Hex) |\n // |-----------|------------|--------------------------------------------------------------------|\n // | 0x00:0x1f | size of b | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n // | 0x20:0x3f | size of e | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n // | 0x40:0x5f | size of m | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n // | 0x60:0x7f | value of b | 0x<.............................................................b> |\n // | 0x80:0x9f | value of e | 0x<.............................................................e> |\n // | 0xa0:0xbf | value of m | 0x<.............................................................m> |\n mstore(ptr, 0x20)\n mstore(add(ptr, 0x20), 0x20)\n mstore(add(ptr, 0x40), 0x20)\n mstore(add(ptr, 0x60), b)\n mstore(add(ptr, 0x80), e)\n mstore(add(ptr, 0xa0), m)\n\n // Given the result < m, it's guaranteed to fit in 32 bytes,\n // so we can use the memory scratch space located at offset 0.\n success := staticcall(gas(), 0x05, ptr, 0xc0, 0x00, 0x20)\n result := mload(0x00)\n }\n }\n\n /**\n * @dev Variant of {modExp} that supports inputs of arbitrary length.\n */\n function modExp(bytes memory b, bytes memory e, bytes memory m) internal view returns (bytes memory) {\n (bool success, bytes memory result) = tryModExp(b, e, m);\n if (!success) {\n Panic.panic(Panic.DIVISION_BY_ZERO);\n }\n return result;\n }\n\n /**\n * @dev Variant of {tryModExp} that supports inputs of arbitrary length.\n */\n function tryModExp(\n bytes memory b,\n bytes memory e,\n bytes memory m\n ) internal view returns (bool success, bytes memory result) {\n if (_zeroBytes(m)) return (false, new bytes(0));\n\n uint256 mLen = m.length;\n\n // Encode call args in result and move the free memory pointer\n result = abi.encodePacked(b.length, e.length, mLen, b, e, m);\n\n assembly (\"memory-safe\") {\n let dataPtr := add(result, 0x20)\n // Write result on top of args to avoid allocating extra memory.\n success := staticcall(gas(), 0x05, dataPtr, mload(result), dataPtr, mLen)\n // Overwrite the length.\n // result.length > returndatasize() is guaranteed because returndatasize() == m.length\n mstore(result, mLen)\n // Set the memory pointer after the returned data.\n mstore(0x40, add(dataPtr, mLen))\n }\n }\n\n /**\n * @dev Returns whether the provided byte array is zero.\n */\n function _zeroBytes(bytes memory buffer) private pure returns (bool) {\n uint256 chunk;\n for (uint256 i = 0; i < buffer.length; i += 0x20) {\n // See _unsafeReadBytesOffset from utils/Bytes.sol\n assembly (\"memory-safe\") {\n chunk := mload(add(add(buffer, 0x20), i))\n }\n if (chunk >> (8 * saturatingSub(i + 0x20, buffer.length)) != 0) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded\n * towards zero.\n *\n * This method is based on Newton's method for computing square roots; the algorithm is restricted to only\n * using integer operations.\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n unchecked {\n // Take care of easy edge cases when a == 0 or a == 1\n if (a <= 1) {\n return a;\n }\n\n // In this function, we use Newton's method to get a root of `f(x) := x² - a`. It involves building a\n // sequence x_n that converges toward sqrt(a). For each iteration x_n, we also define the error between\n // the current value as `ε_n = | x_n - sqrt(a) |`.\n //\n // For our first estimation, we consider `e` the smallest power of 2 which is bigger than the square root\n // of the target. (i.e. `2**(e-1) ≤ sqrt(a) < 2**e`). We know that `e ≤ 128` because `(2¹²⁸)² = 2²⁵⁶` is\n // bigger than any uint256.\n //\n // By noticing that\n // `2**(e-1) ≤ sqrt(a) < 2**e → (2**(e-1))² ≤ a < (2**e)² → 2**(2*e-2) ≤ a < 2**(2*e)`\n // we can deduce that `e - 1` is `log2(a) / 2`. We can thus compute `x_n = 2**(e-1)` using a method similar\n // to the msb function.\n uint256 aa = a;\n uint256 xn = 1;\n\n if (aa >= (1 << 128)) {\n aa >>= 128;\n xn <<= 64;\n }\n if (aa >= (1 << 64)) {\n aa >>= 64;\n xn <<= 32;\n }\n if (aa >= (1 << 32)) {\n aa >>= 32;\n xn <<= 16;\n }\n if (aa >= (1 << 16)) {\n aa >>= 16;\n xn <<= 8;\n }\n if (aa >= (1 << 8)) {\n aa >>= 8;\n xn <<= 4;\n }\n if (aa >= (1 << 4)) {\n aa >>= 4;\n xn <<= 2;\n }\n if (aa >= (1 << 2)) {\n xn <<= 1;\n }\n\n // We now have x_n such that `x_n = 2**(e-1) ≤ sqrt(a) < 2**e = 2 * x_n`. This implies ε_n ≤ 2**(e-1).\n //\n // We can refine our estimation by noticing that the middle of that interval minimizes the error.\n // If we move x_n to equal 2**(e-1) + 2**(e-2), then we reduce the error to ε_n ≤ 2**(e-2).\n // This is going to be our x_0 (and ε_0)\n xn = (3 * xn) >> 1; // ε_0 := | x_0 - sqrt(a) | ≤ 2**(e-2)\n\n // From here, Newton's method give us:\n // x_{n+1} = (x_n + a / x_n) / 2\n //\n // One should note that:\n // x_{n+1}² - a = ((x_n + a / x_n) / 2)² - a\n // = ((x_n² + a) / (2 * x_n))² - a\n // = (x_n⁴ + 2 * a * x_n² + a²) / (4 * x_n²) - a\n // = (x_n⁴ + 2 * a * x_n² + a² - 4 * a * x_n²) / (4 * x_n²)\n // = (x_n⁴ - 2 * a * x_n² + a²) / (4 * x_n²)\n // = (x_n² - a)² / (2 * x_n)²\n // = ((x_n² - a) / (2 * x_n))²\n // ≥ 0\n // Which proves that for all n ≥ 1, sqrt(a) ≤ x_n\n //\n // This gives us the proof of quadratic convergence of the sequence:\n // ε_{n+1} = | x_{n+1} - sqrt(a) |\n // = | (x_n + a / x_n) / 2 - sqrt(a) |\n // = | (x_n² + a - 2*x_n*sqrt(a)) / (2 * x_n) |\n // = | (x_n - sqrt(a))² / (2 * x_n) |\n // = | ε_n² / (2 * x_n) |\n // = ε_n² / | (2 * x_n) |\n //\n // For the first iteration, we have a special case where x_0 is known:\n // ε_1 = ε_0² / | (2 * x_0) |\n // ≤ (2**(e-2))² / (2 * (2**(e-1) + 2**(e-2)))\n // ≤ 2**(2*e-4) / (3 * 2**(e-1))\n // ≤ 2**(e-3) / 3\n // ≤ 2**(e-3-log2(3))\n // ≤ 2**(e-4.5)\n //\n // For the following iterations, we use the fact that, 2**(e-1) ≤ sqrt(a) ≤ x_n:\n // ε_{n+1} = ε_n² / | (2 * x_n) |\n // ≤ (2**(e-k))² / (2 * 2**(e-1))\n // ≤ 2**(2*e-2*k) / 2**e\n // ≤ 2**(e-2*k)\n xn = (xn + a / xn) >> 1; // ε_1 := | x_1 - sqrt(a) | ≤ 2**(e-4.5) -- special case, see above\n xn = (xn + a / xn) >> 1; // ε_2 := | x_2 - sqrt(a) | ≤ 2**(e-9) -- general case with k = 4.5\n xn = (xn + a / xn) >> 1; // ε_3 := | x_3 - sqrt(a) | ≤ 2**(e-18) -- general case with k = 9\n xn = (xn + a / xn) >> 1; // ε_4 := | x_4 - sqrt(a) | ≤ 2**(e-36) -- general case with k = 18\n xn = (xn + a / xn) >> 1; // ε_5 := | x_5 - sqrt(a) | ≤ 2**(e-72) -- general case with k = 36\n xn = (xn + a / xn) >> 1; // ε_6 := | x_6 - sqrt(a) | ≤ 2**(e-144) -- general case with k = 72\n\n // Because e ≤ 128 (as discussed during the first estimation phase), we know have reached a precision\n // ε_6 ≤ 2**(e-144) < 1. Given we're operating on integers, then we can ensure that xn is now either\n // sqrt(a) or sqrt(a) + 1.\n return xn - SafeCast.toUint(xn > a / xn);\n }\n }\n\n /**\n * @dev Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + SafeCast.toUint(unsignedRoundsUp(rounding) && result * result < a);\n }\n }\n\n /**\n * @dev Return the log in base 2 of a positive value rounded towards zero.\n * Returns 0 if given 0.\n */\n function log2(uint256 x) internal pure returns (uint256 r) {\n // If value has upper 128 bits set, log2 result is at least 128\n r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;\n // If upper 64 bits of 128-bit half set, add 64 to result\n r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;\n // If upper 32 bits of 64-bit half set, add 32 to result\n r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;\n // If upper 16 bits of 32-bit half set, add 16 to result\n r |= SafeCast.toUint((x >> r) > 0xffff) << 4;\n // If upper 8 bits of 16-bit half set, add 8 to result\n r |= SafeCast.toUint((x >> r) > 0xff) << 3;\n // If upper 4 bits of 8-bit half set, add 4 to result\n r |= SafeCast.toUint((x >> r) > 0xf) << 2;\n\n // Shifts value right by the current result and use it as an index into this lookup table:\n //\n // | x (4 bits) | index | table[index] = MSB position |\n // |------------|---------|-----------------------------|\n // | 0000 | 0 | table[0] = 0 |\n // | 0001 | 1 | table[1] = 0 |\n // | 0010 | 2 | table[2] = 1 |\n // | 0011 | 3 | table[3] = 1 |\n // | 0100 | 4 | table[4] = 2 |\n // | 0101 | 5 | table[5] = 2 |\n // | 0110 | 6 | table[6] = 2 |\n // | 0111 | 7 | table[7] = 2 |\n // | 1000 | 8 | table[8] = 3 |\n // | 1001 | 9 | table[9] = 3 |\n // | 1010 | 10 | table[10] = 3 |\n // | 1011 | 11 | table[11] = 3 |\n // | 1100 | 12 | table[12] = 3 |\n // | 1101 | 13 | table[13] = 3 |\n // | 1110 | 14 | table[14] = 3 |\n // | 1111 | 15 | table[15] = 3 |\n //\n // The lookup table is represented as a 32-byte value with the MSB positions for 0-15 in the first 16 bytes (most significant half).\n assembly (\"memory-safe\") {\n r := or(r, byte(shr(r, x), 0x0000010102020202030303030303030300000000000000000000000000000000))\n }\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << result < value);\n }\n }\n\n /**\n * @dev Return the log in base 10 of a positive value rounded towards zero.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 10 ** result < value);\n }\n }\n\n /**\n * @dev Return the log in base 256 of a positive value rounded towards zero.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 x) internal pure returns (uint256 r) {\n // If value has upper 128 bits set, log2 result is at least 128\n r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;\n // If upper 64 bits of 128-bit half set, add 64 to result\n r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;\n // If upper 32 bits of 64-bit half set, add 32 to result\n r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;\n // If upper 16 bits of 32-bit half set, add 16 to result\n r |= SafeCast.toUint((x >> r) > 0xffff) << 4;\n // Add 1 if upper 8 bits of 16-bit half set, and divide accumulated result by 8\n return (r >> 3) | SafeCast.toUint((x >> r) > 0xff);\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << (result << 3) < value);\n }\n }\n\n /**\n * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.\n */\n function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {\n return uint8(rounding) % 2 == 1;\n }\n\n /**\n * @dev Counts the number of leading zero bits in a uint256.\n */\n function clz(uint256 x) internal pure returns (uint256) {\n return ternary(x == 0, 256, 255 - log2(x));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeCast.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.6.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeCast {\n /**\n * @dev Value doesn't fit in a uint of `bits` size.\n */\n error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);\n\n /**\n * @dev An int value doesn't fit in a uint of `bits` size.\n */\n error SafeCastOverflowedIntToUint(int256 value);\n\n /**\n * @dev Value doesn't fit in an int of `bits` size.\n */\n error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);\n\n /**\n * @dev A uint value doesn't fit in an int of `bits` size.\n */\n error SafeCastOverflowedUintToInt(uint256 value);\n\n /**\n * @dev Returns the downcasted uint248 from uint256, reverting on\n * overflow (when the input is greater than largest uint248).\n *\n * Counterpart to Solidity's `uint248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n */\n function toUint248(uint256 value) internal pure returns (uint248) {\n if (value > type(uint248).max) {\n revert SafeCastOverflowedUintDowncast(248, value);\n }\n return uint248(value);\n }\n\n /**\n * @dev Returns the downcasted uint240 from uint256, reverting on\n * overflow (when the input is greater than largest uint240).\n *\n * Counterpart to Solidity's `uint240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n */\n function toUint240(uint256 value) internal pure returns (uint240) {\n if (value > type(uint240).max) {\n revert SafeCastOverflowedUintDowncast(240, value);\n }\n return uint240(value);\n }\n\n /**\n * @dev Returns the downcasted uint232 from uint256, reverting on\n * overflow (when the input is greater than largest uint232).\n *\n * Counterpart to Solidity's `uint232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n */\n function toUint232(uint256 value) internal pure returns (uint232) {\n if (value > type(uint232).max) {\n revert SafeCastOverflowedUintDowncast(232, value);\n }\n return uint232(value);\n }\n\n /**\n * @dev Returns the downcasted uint224 from uint256, reverting on\n * overflow (when the input is greater than largest uint224).\n *\n * Counterpart to Solidity's `uint224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n */\n function toUint224(uint256 value) internal pure returns (uint224) {\n if (value > type(uint224).max) {\n revert SafeCastOverflowedUintDowncast(224, value);\n }\n return uint224(value);\n }\n\n /**\n * @dev Returns the downcasted uint216 from uint256, reverting on\n * overflow (when the input is greater than largest uint216).\n *\n * Counterpart to Solidity's `uint216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n */\n function toUint216(uint256 value) internal pure returns (uint216) {\n if (value > type(uint216).max) {\n revert SafeCastOverflowedUintDowncast(216, value);\n }\n return uint216(value);\n }\n\n /**\n * @dev Returns the downcasted uint208 from uint256, reverting on\n * overflow (when the input is greater than largest uint208).\n *\n * Counterpart to Solidity's `uint208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n */\n function toUint208(uint256 value) internal pure returns (uint208) {\n if (value > type(uint208).max) {\n revert SafeCastOverflowedUintDowncast(208, value);\n }\n return uint208(value);\n }\n\n /**\n * @dev Returns the downcasted uint200 from uint256, reverting on\n * overflow (when the input is greater than largest uint200).\n *\n * Counterpart to Solidity's `uint200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n */\n function toUint200(uint256 value) internal pure returns (uint200) {\n if (value > type(uint200).max) {\n revert SafeCastOverflowedUintDowncast(200, value);\n }\n return uint200(value);\n }\n\n /**\n * @dev Returns the downcasted uint192 from uint256, reverting on\n * overflow (when the input is greater than largest uint192).\n *\n * Counterpart to Solidity's `uint192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n */\n function toUint192(uint256 value) internal pure returns (uint192) {\n if (value > type(uint192).max) {\n revert SafeCastOverflowedUintDowncast(192, value);\n }\n return uint192(value);\n }\n\n /**\n * @dev Returns the downcasted uint184 from uint256, reverting on\n * overflow (when the input is greater than largest uint184).\n *\n * Counterpart to Solidity's `uint184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n */\n function toUint184(uint256 value) internal pure returns (uint184) {\n if (value > type(uint184).max) {\n revert SafeCastOverflowedUintDowncast(184, value);\n }\n return uint184(value);\n }\n\n /**\n * @dev Returns the downcasted uint176 from uint256, reverting on\n * overflow (when the input is greater than largest uint176).\n *\n * Counterpart to Solidity's `uint176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n */\n function toUint176(uint256 value) internal pure returns (uint176) {\n if (value > type(uint176).max) {\n revert SafeCastOverflowedUintDowncast(176, value);\n }\n return uint176(value);\n }\n\n /**\n * @dev Returns the downcasted uint168 from uint256, reverting on\n * overflow (when the input is greater than largest uint168).\n *\n * Counterpart to Solidity's `uint168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n */\n function toUint168(uint256 value) internal pure returns (uint168) {\n if (value > type(uint168).max) {\n revert SafeCastOverflowedUintDowncast(168, value);\n }\n return uint168(value);\n }\n\n /**\n * @dev Returns the downcasted uint160 from uint256, reverting on\n * overflow (when the input is greater than largest uint160).\n *\n * Counterpart to Solidity's `uint160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n */\n function toUint160(uint256 value) internal pure returns (uint160) {\n if (value > type(uint160).max) {\n revert SafeCastOverflowedUintDowncast(160, value);\n }\n return uint160(value);\n }\n\n /**\n * @dev Returns the downcasted uint152 from uint256, reverting on\n * overflow (when the input is greater than largest uint152).\n *\n * Counterpart to Solidity's `uint152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n */\n function toUint152(uint256 value) internal pure returns (uint152) {\n if (value > type(uint152).max) {\n revert SafeCastOverflowedUintDowncast(152, value);\n }\n return uint152(value);\n }\n\n /**\n * @dev Returns the downcasted uint144 from uint256, reverting on\n * overflow (when the input is greater than largest uint144).\n *\n * Counterpart to Solidity's `uint144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n */\n function toUint144(uint256 value) internal pure returns (uint144) {\n if (value > type(uint144).max) {\n revert SafeCastOverflowedUintDowncast(144, value);\n }\n return uint144(value);\n }\n\n /**\n * @dev Returns the downcasted uint136 from uint256, reverting on\n * overflow (when the input is greater than largest uint136).\n *\n * Counterpart to Solidity's `uint136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n */\n function toUint136(uint256 value) internal pure returns (uint136) {\n if (value > type(uint136).max) {\n revert SafeCastOverflowedUintDowncast(136, value);\n }\n return uint136(value);\n }\n\n /**\n * @dev Returns the downcasted uint128 from uint256, reverting on\n * overflow (when the input is greater than largest uint128).\n *\n * Counterpart to Solidity's `uint128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n */\n function toUint128(uint256 value) internal pure returns (uint128) {\n if (value > type(uint128).max) {\n revert SafeCastOverflowedUintDowncast(128, value);\n }\n return uint128(value);\n }\n\n /**\n * @dev Returns the downcasted uint120 from uint256, reverting on\n * overflow (when the input is greater than largest uint120).\n *\n * Counterpart to Solidity's `uint120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n */\n function toUint120(uint256 value) internal pure returns (uint120) {\n if (value > type(uint120).max) {\n revert SafeCastOverflowedUintDowncast(120, value);\n }\n return uint120(value);\n }\n\n /**\n * @dev Returns the downcasted uint112 from uint256, reverting on\n * overflow (when the input is greater than largest uint112).\n *\n * Counterpart to Solidity's `uint112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n */\n function toUint112(uint256 value) internal pure returns (uint112) {\n if (value > type(uint112).max) {\n revert SafeCastOverflowedUintDowncast(112, value);\n }\n return uint112(value);\n }\n\n /**\n * @dev Returns the downcasted uint104 from uint256, reverting on\n * overflow (when the input is greater than largest uint104).\n *\n * Counterpart to Solidity's `uint104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n */\n function toUint104(uint256 value) internal pure returns (uint104) {\n if (value > type(uint104).max) {\n revert SafeCastOverflowedUintDowncast(104, value);\n }\n return uint104(value);\n }\n\n /**\n * @dev Returns the downcasted uint96 from uint256, reverting on\n * overflow (when the input is greater than largest uint96).\n *\n * Counterpart to Solidity's `uint96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n */\n function toUint96(uint256 value) internal pure returns (uint96) {\n if (value > type(uint96).max) {\n revert SafeCastOverflowedUintDowncast(96, value);\n }\n return uint96(value);\n }\n\n /**\n * @dev Returns the downcasted uint88 from uint256, reverting on\n * overflow (when the input is greater than largest uint88).\n *\n * Counterpart to Solidity's `uint88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n */\n function toUint88(uint256 value) internal pure returns (uint88) {\n if (value > type(uint88).max) {\n revert SafeCastOverflowedUintDowncast(88, value);\n }\n return uint88(value);\n }\n\n /**\n * @dev Returns the downcasted uint80 from uint256, reverting on\n * overflow (when the input is greater than largest uint80).\n *\n * Counterpart to Solidity's `uint80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n */\n function toUint80(uint256 value) internal pure returns (uint80) {\n if (value > type(uint80).max) {\n revert SafeCastOverflowedUintDowncast(80, value);\n }\n return uint80(value);\n }\n\n /**\n * @dev Returns the downcasted uint72 from uint256, reverting on\n * overflow (when the input is greater than largest uint72).\n *\n * Counterpart to Solidity's `uint72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n */\n function toUint72(uint256 value) internal pure returns (uint72) {\n if (value > type(uint72).max) {\n revert SafeCastOverflowedUintDowncast(72, value);\n }\n return uint72(value);\n }\n\n /**\n * @dev Returns the downcasted uint64 from uint256, reverting on\n * overflow (when the input is greater than largest uint64).\n *\n * Counterpart to Solidity's `uint64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n */\n function toUint64(uint256 value) internal pure returns (uint64) {\n if (value > type(uint64).max) {\n revert SafeCastOverflowedUintDowncast(64, value);\n }\n return uint64(value);\n }\n\n /**\n * @dev Returns the downcasted uint56 from uint256, reverting on\n * overflow (when the input is greater than largest uint56).\n *\n * Counterpart to Solidity's `uint56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n */\n function toUint56(uint256 value) internal pure returns (uint56) {\n if (value > type(uint56).max) {\n revert SafeCastOverflowedUintDowncast(56, value);\n }\n return uint56(value);\n }\n\n /**\n * @dev Returns the downcasted uint48 from uint256, reverting on\n * overflow (when the input is greater than largest uint48).\n *\n * Counterpart to Solidity's `uint48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n */\n function toUint48(uint256 value) internal pure returns (uint48) {\n if (value > type(uint48).max) {\n revert SafeCastOverflowedUintDowncast(48, value);\n }\n return uint48(value);\n }\n\n /**\n * @dev Returns the downcasted uint40 from uint256, reverting on\n * overflow (when the input is greater than largest uint40).\n *\n * Counterpart to Solidity's `uint40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n */\n function toUint40(uint256 value) internal pure returns (uint40) {\n if (value > type(uint40).max) {\n revert SafeCastOverflowedUintDowncast(40, value);\n }\n return uint40(value);\n }\n\n /**\n * @dev Returns the downcasted uint32 from uint256, reverting on\n * overflow (when the input is greater than largest uint32).\n *\n * Counterpart to Solidity's `uint32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n */\n function toUint32(uint256 value) internal pure returns (uint32) {\n if (value > type(uint32).max) {\n revert SafeCastOverflowedUintDowncast(32, value);\n }\n return uint32(value);\n }\n\n /**\n * @dev Returns the downcasted uint24 from uint256, reverting on\n * overflow (when the input is greater than largest uint24).\n *\n * Counterpart to Solidity's `uint24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n */\n function toUint24(uint256 value) internal pure returns (uint24) {\n if (value > type(uint24).max) {\n revert SafeCastOverflowedUintDowncast(24, value);\n }\n return uint24(value);\n }\n\n /**\n * @dev Returns the downcasted uint16 from uint256, reverting on\n * overflow (when the input is greater than largest uint16).\n *\n * Counterpart to Solidity's `uint16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n */\n function toUint16(uint256 value) internal pure returns (uint16) {\n if (value > type(uint16).max) {\n revert SafeCastOverflowedUintDowncast(16, value);\n }\n return uint16(value);\n }\n\n /**\n * @dev Returns the downcasted uint8 from uint256, reverting on\n * overflow (when the input is greater than largest uint8).\n *\n * Counterpart to Solidity's `uint8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n */\n function toUint8(uint256 value) internal pure returns (uint8) {\n if (value > type(uint8).max) {\n revert SafeCastOverflowedUintDowncast(8, value);\n }\n return uint8(value);\n }\n\n /**\n * @dev Converts a signed int256 into an unsigned uint256.\n *\n * Requirements:\n *\n * - input must be greater than or equal to 0.\n */\n function toUint256(int256 value) internal pure returns (uint256) {\n if (value < 0) {\n revert SafeCastOverflowedIntToUint(value);\n }\n return uint256(value);\n }\n\n /**\n * @dev Returns the downcasted int248 from int256, reverting on\n * overflow (when the input is less than smallest int248 or\n * greater than largest int248).\n *\n * Counterpart to Solidity's `int248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n */\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\n downcasted = int248(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(248, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int240 from int256, reverting on\n * overflow (when the input is less than smallest int240 or\n * greater than largest int240).\n *\n * Counterpart to Solidity's `int240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n */\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\n downcasted = int240(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(240, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int232 from int256, reverting on\n * overflow (when the input is less than smallest int232 or\n * greater than largest int232).\n *\n * Counterpart to Solidity's `int232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n */\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\n downcasted = int232(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(232, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int224 from int256, reverting on\n * overflow (when the input is less than smallest int224 or\n * greater than largest int224).\n *\n * Counterpart to Solidity's `int224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n */\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\n downcasted = int224(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(224, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int216 from int256, reverting on\n * overflow (when the input is less than smallest int216 or\n * greater than largest int216).\n *\n * Counterpart to Solidity's `int216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n */\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\n downcasted = int216(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(216, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int208 from int256, reverting on\n * overflow (when the input is less than smallest int208 or\n * greater than largest int208).\n *\n * Counterpart to Solidity's `int208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n */\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\n downcasted = int208(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(208, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int200 from int256, reverting on\n * overflow (when the input is less than smallest int200 or\n * greater than largest int200).\n *\n * Counterpart to Solidity's `int200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n */\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\n downcasted = int200(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(200, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int192 from int256, reverting on\n * overflow (when the input is less than smallest int192 or\n * greater than largest int192).\n *\n * Counterpart to Solidity's `int192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n */\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\n downcasted = int192(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(192, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int184 from int256, reverting on\n * overflow (when the input is less than smallest int184 or\n * greater than largest int184).\n *\n * Counterpart to Solidity's `int184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n */\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\n downcasted = int184(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(184, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int176 from int256, reverting on\n * overflow (when the input is less than smallest int176 or\n * greater than largest int176).\n *\n * Counterpart to Solidity's `int176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n */\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\n downcasted = int176(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(176, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int168 from int256, reverting on\n * overflow (when the input is less than smallest int168 or\n * greater than largest int168).\n *\n * Counterpart to Solidity's `int168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n */\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\n downcasted = int168(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(168, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int160 from int256, reverting on\n * overflow (when the input is less than smallest int160 or\n * greater than largest int160).\n *\n * Counterpart to Solidity's `int160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n */\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\n downcasted = int160(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(160, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int152 from int256, reverting on\n * overflow (when the input is less than smallest int152 or\n * greater than largest int152).\n *\n * Counterpart to Solidity's `int152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n */\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\n downcasted = int152(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(152, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int144 from int256, reverting on\n * overflow (when the input is less than smallest int144 or\n * greater than largest int144).\n *\n * Counterpart to Solidity's `int144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n */\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\n downcasted = int144(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(144, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int136 from int256, reverting on\n * overflow (when the input is less than smallest int136 or\n * greater than largest int136).\n *\n * Counterpart to Solidity's `int136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n */\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\n downcasted = int136(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(136, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int128 from int256, reverting on\n * overflow (when the input is less than smallest int128 or\n * greater than largest int128).\n *\n * Counterpart to Solidity's `int128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n */\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\n downcasted = int128(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(128, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int120 from int256, reverting on\n * overflow (when the input is less than smallest int120 or\n * greater than largest int120).\n *\n * Counterpart to Solidity's `int120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n */\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\n downcasted = int120(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(120, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int112 from int256, reverting on\n * overflow (when the input is less than smallest int112 or\n * greater than largest int112).\n *\n * Counterpart to Solidity's `int112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n */\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\n downcasted = int112(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(112, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int104 from int256, reverting on\n * overflow (when the input is less than smallest int104 or\n * greater than largest int104).\n *\n * Counterpart to Solidity's `int104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n */\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\n downcasted = int104(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(104, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int96 from int256, reverting on\n * overflow (when the input is less than smallest int96 or\n * greater than largest int96).\n *\n * Counterpart to Solidity's `int96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n */\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\n downcasted = int96(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(96, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int88 from int256, reverting on\n * overflow (when the input is less than smallest int88 or\n * greater than largest int88).\n *\n * Counterpart to Solidity's `int88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n */\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\n downcasted = int88(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(88, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int80 from int256, reverting on\n * overflow (when the input is less than smallest int80 or\n * greater than largest int80).\n *\n * Counterpart to Solidity's `int80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n */\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\n downcasted = int80(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(80, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int72 from int256, reverting on\n * overflow (when the input is less than smallest int72 or\n * greater than largest int72).\n *\n * Counterpart to Solidity's `int72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n */\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\n downcasted = int72(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(72, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int64 from int256, reverting on\n * overflow (when the input is less than smallest int64 or\n * greater than largest int64).\n *\n * Counterpart to Solidity's `int64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n */\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\n downcasted = int64(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(64, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int56 from int256, reverting on\n * overflow (when the input is less than smallest int56 or\n * greater than largest int56).\n *\n * Counterpart to Solidity's `int56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n */\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\n downcasted = int56(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(56, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int48 from int256, reverting on\n * overflow (when the input is less than smallest int48 or\n * greater than largest int48).\n *\n * Counterpart to Solidity's `int48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n */\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\n downcasted = int48(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(48, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int40 from int256, reverting on\n * overflow (when the input is less than smallest int40 or\n * greater than largest int40).\n *\n * Counterpart to Solidity's `int40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n */\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\n downcasted = int40(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(40, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int32 from int256, reverting on\n * overflow (when the input is less than smallest int32 or\n * greater than largest int32).\n *\n * Counterpart to Solidity's `int32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n */\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\n downcasted = int32(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(32, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int24 from int256, reverting on\n * overflow (when the input is less than smallest int24 or\n * greater than largest int24).\n *\n * Counterpart to Solidity's `int24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n */\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\n downcasted = int24(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(24, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int16 from int256, reverting on\n * overflow (when the input is less than smallest int16 or\n * greater than largest int16).\n *\n * Counterpart to Solidity's `int16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n */\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\n downcasted = int16(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(16, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int8 from int256, reverting on\n * overflow (when the input is less than smallest int8 or\n * greater than largest int8).\n *\n * Counterpart to Solidity's `int8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n */\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\n downcasted = int8(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(8, value);\n }\n }\n\n /**\n * @dev Converts an unsigned uint256 into a signed int256.\n *\n * Requirements:\n *\n * - input must be less than or equal to maxInt256.\n */\n function toInt256(uint256 value) internal pure returns (int256) {\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n if (value > uint256(type(int256).max)) {\n revert SafeCastOverflowedUintToInt(value);\n }\n return int256(value);\n }\n\n /**\n * @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump.\n */\n function toUint(bool b) internal pure returns (uint256 u) {\n assembly (\"memory-safe\") {\n u := iszero(iszero(b))\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.20;\n\nimport {SafeCast} from \"./SafeCast.sol\";\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant.\n *\n * IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.\n * However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute\n * one branch when needed, making this function more expensive.\n */\n function ternary(bool condition, int256 a, int256 b) internal pure returns (int256) {\n unchecked {\n // branchless ternary works because:\n // b ^ (a ^ b) == a\n // b ^ 0 == b\n return b ^ ((a ^ b) * int256(SafeCast.toUint(condition)));\n }\n }\n\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return ternary(a > b, a, b);\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return ternary(a < b, a, b);\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // Formula from the \"Bit Twiddling Hacks\" by Sean Eron Anderson.\n // Since `n` is a signed integer, the generated bytecode will use the SAR opcode to perform the right shift,\n // taking advantage of the most significant (or \"sign\" bit) in two's complement representation.\n // This opcode adds new most significant bits set to the value of the previous most significant bit. As a result,\n // the mask will either be `bytes32(0)` (if n is positive) or `~bytes32(0)` (if n is negative).\n int256 mask = n >> 255;\n\n // A `bytes32(0)` mask leaves the input unchanged, while a `~bytes32(0)` mask complements it.\n return uint256((n + mask) ^ mask);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Panic.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/Panic.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Helper library for emitting standardized panic codes.\n *\n * ```solidity\n * contract Example {\n * using Panic for uint256;\n *\n * // Use any of the declared internal constants\n * function foo() { Panic.GENERIC.panic(); }\n *\n * // Alternatively\n * function foo() { Panic.panic(Panic.GENERIC); }\n * }\n * ```\n *\n * Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil].\n *\n * _Available since v5.1._\n */\n// slither-disable-next-line unused-state\nlibrary Panic {\n /// @dev generic / unspecified error\n uint256 internal constant GENERIC = 0x00;\n /// @dev used by the assert() builtin\n uint256 internal constant ASSERT = 0x01;\n /// @dev arithmetic underflow or overflow\n uint256 internal constant UNDER_OVERFLOW = 0x11;\n /// @dev division or modulo by zero\n uint256 internal constant DIVISION_BY_ZERO = 0x12;\n /// @dev enum conversion error\n uint256 internal constant ENUM_CONVERSION_ERROR = 0x21;\n /// @dev invalid encoding in storage\n uint256 internal constant STORAGE_ENCODING_ERROR = 0x22;\n /// @dev empty array pop\n uint256 internal constant EMPTY_ARRAY_POP = 0x31;\n /// @dev array out of bounds access\n uint256 internal constant ARRAY_OUT_OF_BOUNDS = 0x32;\n /// @dev resource error (too large allocation or too large array)\n uint256 internal constant RESOURCE_ERROR = 0x41;\n /// @dev calling invalid internal function\n uint256 internal constant INVALID_INTERNAL_FUNCTION = 0x51;\n\n /// @dev Reverts with a panic code. Recommended to use with\n /// the internal constants with predefined codes.\n function panic(uint256 code) internal pure {\n assembly (\"memory-safe\") {\n mstore(0x00, 0x4e487b71)\n mstore(0x20, code)\n revert(0x1c, 0x24)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (utils/ReentrancyGuard.sol)\n\npragma solidity ^0.8.20;\n\nimport {StorageSlot} from \"./StorageSlot.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,\n * consider using {ReentrancyGuardTransient} instead.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n *\n * IMPORTANT: Deprecated. This storage-based reentrancy guard will be removed and replaced\n * by the {ReentrancyGuardTransient} variant in v6.0.\n *\n * @custom:stateless\n */\nabstract contract ReentrancyGuard {\n using StorageSlot for bytes32;\n\n // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.ReentrancyGuard\")) - 1)) & ~bytes32(uint256(0xff))\n bytes32 private constant REENTRANCY_GUARD_STORAGE =\n 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;\n\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant NOT_ENTERED = 1;\n uint256 private constant ENTERED = 2;\n\n /**\n * @dev Unauthorized reentrant call.\n */\n error ReentrancyGuardReentrantCall();\n\n constructor() {\n _reentrancyGuardStorageSlot().getUint256Slot().value = NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n /**\n * @dev A `view` only version of {nonReentrant}. Use to block view functions\n * from being called, preventing reading from inconsistent contract state.\n *\n * CAUTION: This is a \"view\" modifier and does not change the reentrancy\n * status. Use it only on view functions. For payable or non-payable functions,\n * use the standard {nonReentrant} modifier instead.\n */\n modifier nonReentrantView() {\n _nonReentrantBeforeView();\n _;\n }\n\n function _nonReentrantBeforeView() private view {\n if (_reentrancyGuardEntered()) {\n revert ReentrancyGuardReentrantCall();\n }\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be NOT_ENTERED\n _nonReentrantBeforeView();\n\n // Any calls to nonReentrant after this point will fail\n _reentrancyGuardStorageSlot().getUint256Slot().value = ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _reentrancyGuardStorageSlot().getUint256Slot().value = NOT_ENTERED;\n }\n\n /**\n * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n * `nonReentrant` function in the call stack.\n */\n function _reentrancyGuardEntered() internal view returns (bool) {\n return _reentrancyGuardStorageSlot().getUint256Slot().value == ENTERED;\n }\n\n function _reentrancyGuardStorageSlot() internal pure virtual returns (bytes32) {\n return REENTRANCY_GUARD_STORAGE;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/ShortStrings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (utils/ShortStrings.sol)\n\npragma solidity ^0.8.20;\n\nimport {StorageSlot} from \"./StorageSlot.sol\";\n\n// | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |\n// | length | 0x BB |\ntype ShortString is bytes32;\n\n/**\n * @dev This library provides functions to convert short memory strings\n * into a `ShortString` type that can be used as an immutable variable.\n *\n * Strings of arbitrary length can be optimized using this library if\n * they are short enough (up to 31 bytes) by packing them with their\n * length (1 byte) in a single EVM word (32 bytes). Additionally, a\n * fallback mechanism can be used for every other case.\n *\n * Usage example:\n *\n * ```solidity\n * contract Named {\n * using ShortStrings for *;\n *\n * ShortString private immutable _name;\n * string private _nameFallback;\n *\n * constructor(string memory contractName) {\n * _name = contractName.toShortStringWithFallback(_nameFallback);\n * }\n *\n * function name() external view returns (string memory) {\n * return _name.toStringWithFallback(_nameFallback);\n * }\n * }\n * ```\n */\nlibrary ShortStrings {\n // Used as an identifier for strings longer than 31 bytes.\n bytes32 private constant FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;\n\n error StringTooLong(string str);\n error InvalidShortString();\n\n /**\n * @dev Encode a string of at most 31 chars into a `ShortString`.\n *\n * This will trigger a `StringTooLong` error is the input string is too long.\n */\n function toShortString(string memory str) internal pure returns (ShortString) {\n bytes memory bstr = bytes(str);\n if (bstr.length > 0x1f) {\n revert StringTooLong(str);\n }\n return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));\n }\n\n /**\n * @dev Decode a `ShortString` back to a \"normal\" string.\n */\n function toString(ShortString sstr) internal pure returns (string memory) {\n uint256 len = byteLength(sstr);\n // using `new string(len)` would work locally but is not memory safe.\n string memory str = new string(0x20);\n assembly (\"memory-safe\") {\n mstore(str, len)\n mstore(add(str, 0x20), sstr)\n }\n return str;\n }\n\n /**\n * @dev Return the length of a `ShortString`.\n */\n function byteLength(ShortString sstr) internal pure returns (uint256) {\n uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;\n if (result > 0x1f) {\n revert InvalidShortString();\n }\n return result;\n }\n\n /**\n * @dev Encode a string into a `ShortString`, or write it to storage if it is too long.\n */\n function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {\n if (bytes(value).length < 0x20) {\n return toShortString(value);\n } else {\n StorageSlot.getStringSlot(store).value = value;\n return ShortString.wrap(FALLBACK_SENTINEL);\n }\n }\n\n /**\n * @dev Decode a string that was encoded to `ShortString` or written to storage using {toShortStringWithFallback}.\n */\n function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {\n if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {\n return toString(value);\n } else {\n return store;\n }\n }\n\n /**\n * @dev Return the length of a string that was encoded to `ShortString` or written to storage using\n * {toShortStringWithFallback}.\n *\n * WARNING: This will return the \"byte length\" of the string. This may not reflect the actual length in terms of\n * actual characters as the UTF-8 encoding of a single character can span over multiple bytes.\n */\n function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {\n if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {\n return byteLength(value);\n } else {\n return bytes(store).length;\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC-1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n * // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(newImplementation.code.length > 0);\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * TIP: Consider using this library along with {SlotDerivation}.\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct Int256Slot {\n int256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns a `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns a `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns a `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns a `Int256Slot` with member `value` located at `slot`.\n */\n function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns a `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns a `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := store.slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.6.0) (utils/Strings.sol)\n\npragma solidity ^0.8.24;\n\nimport {Math} from \"./math/Math.sol\";\nimport {SafeCast} from \"./math/SafeCast.sol\";\nimport {SignedMath} from \"./math/SignedMath.sol\";\nimport {Bytes} from \"./Bytes.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n using SafeCast for *;\n\n bytes16 private constant HEX_DIGITS = \"0123456789abcdef\";\n uint8 private constant ADDRESS_LENGTH = 20;\n uint256 private constant SPECIAL_CHARS_LOOKUP =\n 0xffffffff | // first 32 bits corresponding to the control characters (U+0000 to U+001F)\n (1 << 0x22) | // double quote\n (1 << 0x5c); // backslash\n\n /**\n * @dev The `value` string doesn't fit in the specified `length`.\n */\n error StringsInsufficientHexLength(uint256 value, uint256 length);\n\n /**\n * @dev The string being parsed contains characters that are not in scope of the given base.\n */\n error StringsInvalidChar();\n\n /**\n * @dev The string being parsed is not a properly formatted address.\n */\n error StringsInvalidAddressFormat();\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n assembly (\"memory-safe\") {\n ptr := add(add(buffer, 0x20), length)\n }\n while (true) {\n ptr--;\n assembly (\"memory-safe\") {\n mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toStringSigned(int256 value) internal pure returns (string memory) {\n return string.concat(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value)));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n uint256 localValue = value;\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = HEX_DIGITS[localValue & 0xf];\n localValue >>= 4;\n }\n if (localValue != 0) {\n revert StringsInsufficientHexLength(value, length);\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal\n * representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its checksummed ASCII `string` hexadecimal\n * representation, according to EIP-55.\n */\n function toChecksumHexString(address addr) internal pure returns (string memory) {\n bytes memory buffer = bytes(toHexString(addr));\n\n // hash the hex part of buffer (skip length + 2 bytes, length 40)\n uint256 hashValue;\n assembly (\"memory-safe\") {\n hashValue := shr(96, keccak256(add(buffer, 0x22), 40))\n }\n\n for (uint256 i = 41; i > 1; --i) {\n // possible values for buffer[i] are 48 (0) to 57 (9) and 97 (a) to 102 (f)\n if (hashValue & 0xf > 7 && uint8(buffer[i]) > 96) {\n // case shift by xoring with 0x20\n buffer[i] ^= 0x20;\n }\n hashValue >>= 4;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `bytes` buffer to its ASCII `string` hexadecimal representation.\n */\n function toHexString(bytes memory input) internal pure returns (string memory) {\n unchecked {\n bytes memory buffer = new bytes(2 * input.length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 0; i < input.length; ++i) {\n uint8 v = uint8(input[i]);\n buffer[2 * i + 2] = HEX_DIGITS[v >> 4];\n buffer[2 * i + 3] = HEX_DIGITS[v & 0xf];\n }\n return string(buffer);\n }\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return Bytes.equal(bytes(a), bytes(b));\n }\n\n /**\n * @dev Parse a decimal string and returns the value as a `uint256`.\n *\n * Requirements:\n * - The string must be formatted as `[0-9]*`\n * - The result must fit into an `uint256` type\n */\n function parseUint(string memory input) internal pure returns (uint256) {\n return parseUint(input, 0, bytes(input).length);\n }\n\n /**\n * @dev Variant of {parseUint-string} that parses a substring of `input` located between position `begin` (included) and\n * `end` (excluded).\n *\n * Requirements:\n * - The substring must be formatted as `[0-9]*`\n * - The result must fit into an `uint256` type\n */\n function parseUint(string memory input, uint256 begin, uint256 end) internal pure returns (uint256) {\n (bool success, uint256 value) = tryParseUint(input, begin, end);\n if (!success) revert StringsInvalidChar();\n return value;\n }\n\n /**\n * @dev Variant of {parseUint-string} that returns false if the parsing fails because of an invalid character.\n *\n * NOTE: This function will revert if the result does not fit in a `uint256`.\n */\n function tryParseUint(string memory input) internal pure returns (bool success, uint256 value) {\n return _tryParseUintUncheckedBounds(input, 0, bytes(input).length);\n }\n\n /**\n * @dev Variant of {parseUint-string-uint256-uint256} that returns false if the parsing fails because of an invalid\n * character.\n *\n * NOTE: This function will revert if the result does not fit in a `uint256`.\n */\n function tryParseUint(\n string memory input,\n uint256 begin,\n uint256 end\n ) internal pure returns (bool success, uint256 value) {\n if (end > bytes(input).length || begin > end) return (false, 0);\n return _tryParseUintUncheckedBounds(input, begin, end);\n }\n\n /**\n * @dev Implementation of {tryParseUint-string-uint256-uint256} that does not check bounds. Caller should make sure that\n * `begin <= end <= input.length`. Other inputs would result in undefined behavior.\n */\n function _tryParseUintUncheckedBounds(\n string memory input,\n uint256 begin,\n uint256 end\n ) private pure returns (bool success, uint256 value) {\n bytes memory buffer = bytes(input);\n\n uint256 result = 0;\n for (uint256 i = begin; i < end; ++i) {\n uint8 chr = _tryParseChr(bytes1(_unsafeReadBytesOffset(buffer, i)));\n if (chr > 9) return (false, 0);\n result *= 10;\n result += chr;\n }\n return (true, result);\n }\n\n /**\n * @dev Parse a decimal string and returns the value as a `int256`.\n *\n * Requirements:\n * - The string must be formatted as `[-+]?[0-9]*`\n * - The result must fit in an `int256` type.\n */\n function parseInt(string memory input) internal pure returns (int256) {\n return parseInt(input, 0, bytes(input).length);\n }\n\n /**\n * @dev Variant of {parseInt-string} that parses a substring of `input` located between position `begin` (included) and\n * `end` (excluded).\n *\n * Requirements:\n * - The substring must be formatted as `[-+]?[0-9]*`\n * - The result must fit in an `int256` type.\n */\n function parseInt(string memory input, uint256 begin, uint256 end) internal pure returns (int256) {\n (bool success, int256 value) = tryParseInt(input, begin, end);\n if (!success) revert StringsInvalidChar();\n return value;\n }\n\n /**\n * @dev Variant of {parseInt-string} that returns false if the parsing fails because of an invalid character or if\n * the result does not fit in a `int256`.\n *\n * NOTE: This function will revert if the absolute value of the result does not fit in a `uint256`.\n */\n function tryParseInt(string memory input) internal pure returns (bool success, int256 value) {\n return _tryParseIntUncheckedBounds(input, 0, bytes(input).length);\n }\n\n uint256 private constant ABS_MIN_INT256 = 2 ** 255;\n\n /**\n * @dev Variant of {parseInt-string-uint256-uint256} that returns false if the parsing fails because of an invalid\n * character or if the result does not fit in a `int256`.\n *\n * NOTE: This function will revert if the absolute value of the result does not fit in a `uint256`.\n */\n function tryParseInt(\n string memory input,\n uint256 begin,\n uint256 end\n ) internal pure returns (bool success, int256 value) {\n if (end > bytes(input).length || begin > end) return (false, 0);\n return _tryParseIntUncheckedBounds(input, begin, end);\n }\n\n /**\n * @dev Implementation of {tryParseInt-string-uint256-uint256} that does not check bounds. Caller should make sure that\n * `begin <= end <= input.length`. Other inputs would result in undefined behavior.\n */\n function _tryParseIntUncheckedBounds(\n string memory input,\n uint256 begin,\n uint256 end\n ) private pure returns (bool success, int256 value) {\n bytes memory buffer = bytes(input);\n\n // Check presence of a negative sign.\n bytes1 sign = begin == end ? bytes1(0) : bytes1(_unsafeReadBytesOffset(buffer, begin)); // don't do out-of-bound (possibly unsafe) read if sub-string is empty\n bool positiveSign = sign == bytes1(\"+\");\n bool negativeSign = sign == bytes1(\"-\");\n uint256 offset = (positiveSign || negativeSign).toUint();\n\n (bool absSuccess, uint256 absValue) = tryParseUint(input, begin + offset, end);\n\n if (absSuccess && absValue < ABS_MIN_INT256) {\n return (true, negativeSign ? -int256(absValue) : int256(absValue));\n } else if (absSuccess && negativeSign && absValue == ABS_MIN_INT256) {\n return (true, type(int256).min);\n } else return (false, 0);\n }\n\n /**\n * @dev Parse a hexadecimal string (with or without \"0x\" prefix), and returns the value as a `uint256`.\n *\n * Requirements:\n * - The string must be formatted as `(0x)?[0-9a-fA-F]*`\n * - The result must fit in an `uint256` type.\n */\n function parseHexUint(string memory input) internal pure returns (uint256) {\n return parseHexUint(input, 0, bytes(input).length);\n }\n\n /**\n * @dev Variant of {parseHexUint-string} that parses a substring of `input` located between position `begin` (included) and\n * `end` (excluded).\n *\n * Requirements:\n * - The substring must be formatted as `(0x)?[0-9a-fA-F]*`\n * - The result must fit in an `uint256` type.\n */\n function parseHexUint(string memory input, uint256 begin, uint256 end) internal pure returns (uint256) {\n (bool success, uint256 value) = tryParseHexUint(input, begin, end);\n if (!success) revert StringsInvalidChar();\n return value;\n }\n\n /**\n * @dev Variant of {parseHexUint-string} that returns false if the parsing fails because of an invalid character.\n *\n * NOTE: This function will revert if the result does not fit in a `uint256`.\n */\n function tryParseHexUint(string memory input) internal pure returns (bool success, uint256 value) {\n return _tryParseHexUintUncheckedBounds(input, 0, bytes(input).length);\n }\n\n /**\n * @dev Variant of {parseHexUint-string-uint256-uint256} that returns false if the parsing fails because of an\n * invalid character.\n *\n * NOTE: This function will revert if the result does not fit in a `uint256`.\n */\n function tryParseHexUint(\n string memory input,\n uint256 begin,\n uint256 end\n ) internal pure returns (bool success, uint256 value) {\n if (end > bytes(input).length || begin > end) return (false, 0);\n return _tryParseHexUintUncheckedBounds(input, begin, end);\n }\n\n /**\n * @dev Implementation of {tryParseHexUint-string-uint256-uint256} that does not check bounds. Caller should make sure that\n * `begin <= end <= input.length`. Other inputs would result in undefined behavior.\n */\n function _tryParseHexUintUncheckedBounds(\n string memory input,\n uint256 begin,\n uint256 end\n ) private pure returns (bool success, uint256 value) {\n bytes memory buffer = bytes(input);\n\n // skip 0x prefix if present\n bool hasPrefix = (end > begin + 1) && bytes2(_unsafeReadBytesOffset(buffer, begin)) == bytes2(\"0x\"); // don't do out-of-bound (possibly unsafe) read if sub-string is empty\n uint256 offset = hasPrefix.toUint() * 2;\n\n uint256 result = 0;\n for (uint256 i = begin + offset; i < end; ++i) {\n uint8 chr = _tryParseChr(bytes1(_unsafeReadBytesOffset(buffer, i)));\n if (chr > 15) return (false, 0);\n result *= 16;\n unchecked {\n // Multiplying by 16 is equivalent to a shift of 4 bits (with additional overflow check).\n // This guarantees that adding a value < 16 will not cause an overflow, hence the unchecked.\n result += chr;\n }\n }\n return (true, result);\n }\n\n /**\n * @dev Parse a hexadecimal string (with or without \"0x\" prefix), and returns the value as an `address`.\n *\n * Requirements:\n * - The string must be formatted as `(0x)?[0-9a-fA-F]{40}`\n */\n function parseAddress(string memory input) internal pure returns (address) {\n return parseAddress(input, 0, bytes(input).length);\n }\n\n /**\n * @dev Variant of {parseAddress-string} that parses a substring of `input` located between position `begin` (included) and\n * `end` (excluded).\n *\n * Requirements:\n * - The substring must be formatted as `(0x)?[0-9a-fA-F]{40}`\n */\n function parseAddress(string memory input, uint256 begin, uint256 end) internal pure returns (address) {\n (bool success, address value) = tryParseAddress(input, begin, end);\n if (!success) revert StringsInvalidAddressFormat();\n return value;\n }\n\n /**\n * @dev Variant of {parseAddress-string} that returns false if the parsing fails because the input is not a properly\n * formatted address. See {parseAddress-string} requirements.\n */\n function tryParseAddress(string memory input) internal pure returns (bool success, address value) {\n return tryParseAddress(input, 0, bytes(input).length);\n }\n\n /**\n * @dev Variant of {parseAddress-string-uint256-uint256} that returns false if the parsing fails because input is not a properly\n * formatted address. See {parseAddress-string-uint256-uint256} requirements.\n */\n function tryParseAddress(\n string memory input,\n uint256 begin,\n uint256 end\n ) internal pure returns (bool success, address value) {\n if (end > bytes(input).length || begin > end) return (false, address(0));\n\n bool hasPrefix = (end > begin + 1) && bytes2(_unsafeReadBytesOffset(bytes(input), begin)) == bytes2(\"0x\"); // don't do out-of-bound (possibly unsafe) read if sub-string is empty\n uint256 expectedLength = 40 + hasPrefix.toUint() * 2;\n\n // check that input is the correct length\n if (end - begin == expectedLength) {\n // length guarantees that this does not overflow, and value is at most type(uint160).max\n (bool s, uint256 v) = _tryParseHexUintUncheckedBounds(input, begin, end);\n return (s, address(uint160(v)));\n } else {\n return (false, address(0));\n }\n }\n\n function _tryParseChr(bytes1 chr) private pure returns (uint8) {\n uint8 value = uint8(chr);\n\n // Try to parse `chr`:\n // - Case 1: [0-9]\n // - Case 2: [a-f]\n // - Case 3: [A-F]\n // - otherwise not supported\n unchecked {\n if (value > 47 && value < 58) value -= 48;\n else if (value > 96 && value < 103) value -= 87;\n else if (value > 64 && value < 71) value -= 55;\n else return type(uint8).max;\n }\n\n return value;\n }\n\n /**\n * @dev Escape special characters in JSON strings. This can be useful to prevent JSON injection in NFT metadata.\n *\n * WARNING: This function should only be used in double quoted JSON strings. Single quotes are not escaped.\n *\n * NOTE: This function escapes backslashes (including those in \\uXXXX sequences) and the characters in ranges\n * defined in section 2.5 of RFC-4627 (U+0000 to U+001F, U+0022 and U+005C). All control characters in U+0000\n * to U+001F are escaped (\\b, \\t, \\n, \\f, \\r use short form; others use \\u00XX). ECMAScript's `JSON.parse` does\n * recover escaped unicode characters that are not in this range, but other tooling may provide different results.\n */\n function escapeJSON(string memory input) internal pure returns (string memory) {\n bytes memory buffer = bytes(input);\n\n // Put output at the FMP. Memory will be reserved later when we figure out the actual length of the escaped\n // string. All write are done using _unsafeWriteBytesOffset, which avoid the (expensive) length checks for\n // each character written.\n bytes memory output;\n assembly (\"memory-safe\") {\n output := mload(0x40)\n }\n uint256 outputLength = 0;\n\n for (uint256 i = 0; i < buffer.length; ++i) {\n uint8 char = uint8(bytes1(_unsafeReadBytesOffset(buffer, i)));\n if (((SPECIAL_CHARS_LOOKUP & (1 << char)) != 0)) {\n _unsafeWriteBytesOffset(output, outputLength++, \"\\\\\");\n if (char == 0x08) _unsafeWriteBytesOffset(output, outputLength++, \"b\");\n else if (char == 0x09) _unsafeWriteBytesOffset(output, outputLength++, \"t\");\n else if (char == 0x0a) _unsafeWriteBytesOffset(output, outputLength++, \"n\");\n else if (char == 0x0c) _unsafeWriteBytesOffset(output, outputLength++, \"f\");\n else if (char == 0x0d) _unsafeWriteBytesOffset(output, outputLength++, \"r\");\n else if (char == 0x5c) _unsafeWriteBytesOffset(output, outputLength++, \"\\\\\");\n else if (char == 0x22) {\n // solhint-disable-next-line quotes\n _unsafeWriteBytesOffset(output, outputLength++, '\"');\n } else {\n // U+0000 to U+001F without short form: output \\u00XX\n _unsafeWriteBytesOffset(output, outputLength++, \"u\");\n _unsafeWriteBytesOffset(output, outputLength++, \"0\");\n _unsafeWriteBytesOffset(output, outputLength++, \"0\");\n _unsafeWriteBytesOffset(output, outputLength++, HEX_DIGITS[char >> 4]);\n _unsafeWriteBytesOffset(output, outputLength++, HEX_DIGITS[char & 0x0f]);\n }\n } else {\n _unsafeWriteBytesOffset(output, outputLength++, bytes1(char));\n }\n }\n // write the actual length and reserve memory\n assembly (\"memory-safe\") {\n mstore(output, outputLength)\n mstore(0x40, add(output, add(outputLength, 0x20)))\n }\n\n return string(output);\n }\n\n /**\n * @dev Reads a bytes32 from a bytes array without bounds checking.\n *\n * NOTE: making this function internal would mean it could be used with memory unsafe offset, and marking the\n * assembly block as such would prevent some optimizations.\n */\n function _unsafeReadBytesOffset(bytes memory buffer, uint256 offset) private pure returns (bytes32 value) {\n // This is not memory safe in the general case, but all calls to this private function are within bounds.\n assembly (\"memory-safe\") {\n value := mload(add(add(buffer, 0x20), offset))\n }\n }\n\n /**\n * @dev Write a bytes1 to a bytes array without bounds checking.\n *\n * NOTE: making this function internal would mean it could be used with memory unsafe offset, and marking the\n * assembly block as such would prevent some optimizations.\n */\n function _unsafeWriteBytesOffset(bytes memory buffer, uint256 offset, bytes1 value) private pure {\n // This is not memory safe in the general case, but all calls to this private function are within bounds.\n assembly (\"memory-safe\") {\n mstore8(add(add(buffer, 0x20), offset), shr(248, value))\n }\n }\n}\n" + }, + "contracts/TokenRelayer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.28;\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC20Permit} from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\";\nimport {ECDSA} from \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport {EIP712} from \"@openzeppelin/contracts/utils/cryptography/EIP712.sol\";\n\n/**\n * @title TokenRelayer\n * @notice A relayer contract that accepts ERC20 permit signatures and executes\n * arbitrary calls to a destination contract, both authorized via signature.\n * \n * Flow:\n * 1. User signs a permit allowing the relayer to spend their tokens\n * 2. User signs a payload (e.g., transfer from relayer to another user)\n * 3. Relayer:\n * a. Executes permit to approve the tokens\n * b. Transfers tokens from user to relayer (via transferFrom)\n * c. Forwards the payload call (transfer from relayer to another user)\n */\ncontract TokenRelayer is Ownable, ReentrancyGuard, EIP712 {\n using SafeERC20 for IERC20;\n\n // Using OZ EIP712 for domain separator management\n bytes32 private constant _TYPE_HASH_PAYLOAD = keccak256(\n \"Payload(address destination,address owner,address token,uint256 value,bytes data,uint256 ethValue,uint256 nonce,uint256 deadline)\"\n );\n\n address public immutable destinationContract;\n\n mapping(address => mapping(uint256 => bool)) public usedPayloadNonces;\n // Removed redundant executedCalls mapping — usedPayloadNonces is sufficient\n\n struct ExecuteParams {\n address token;\n address owner;\n uint256 value;\n uint256 deadline;\n uint8 permitV;\n bytes32 permitR;\n bytes32 permitS;\n bytes payloadData;\n uint256 payloadValue;\n uint256 payloadNonce;\n uint256 payloadDeadline;\n uint8 payloadV;\n bytes32 payloadR;\n bytes32 payloadS;\n }\n\n event RelayerExecuted(\n address indexed signer,\n address indexed token,\n uint256 amount\n );\n\n // Events for withdrawal operations\n event TokenWithdrawn(address indexed token, uint256 amount, address indexed to);\n event ETHWithdrawn(uint256 amount, address indexed to);\n\n // Ownable constructor sets deployer as owner; EIP712 constructor\n constructor(address _destinationContract)\n Ownable(msg.sender)\n EIP712(\"TokenRelayer\", \"1\")\n {\n require(_destinationContract != address(0), \"Invalid destination\");\n destinationContract = _destinationContract;\n }\n\n // Allow contract to receive ETH (e.g., refunds from destination)\n receive() external payable {}\n\n // nonReentrant modifier prevents reentrancy via _forwardCall\n // Removed redundant bool return — function reverts on failure\n function execute(ExecuteParams calldata params) external payable nonReentrant {\n address owner = params.owner;\n uint256 nonce = params.payloadNonce;\n\n // --- Checks ---\n require(owner != address(0), \"Invalid owner\");\n require(params.token != address(0), \"Invalid token\");\n require(!usedPayloadNonces[owner][nonce], \"Nonce used\");\n require(block.timestamp <= params.payloadDeadline, \"Payload expired\");\n\n // Verify payload signature and validate signed destination\n bytes32 digest = _computeDigest(\n owner,\n params.token,\n params.value,\n params.payloadData,\n params.payloadValue,\n nonce,\n params.payloadDeadline\n );\n // Using ECDSA.recover() which enforces low-s and rejects address(0)\n require(ECDSA.recover(digest, params.payloadV, params.payloadR, params.payloadS) == owner, \"Invalid sig\");\n\n require(msg.value == params.payloadValue, \"Incorrect ETH value provided\");\n\n // --- Effects (before interactions per CEI pattern) ---\n // State changes before any external calls\n usedPayloadNonces[owner][nonce] = true;\n\n // --- Interactions ---\n // permit wrapped in try-catch for front-run resilience\n _executePermitAndTransfer(\n params.token,\n owner,\n params.value,\n params.deadline,\n params.permitV,\n params.permitR,\n params.permitS\n );\n\n // Approve exact amount, forward call, then revoke\n IERC20(params.token).forceApprove(destinationContract, params.value);\n\n bool callSuccess = _forwardCall(params.payloadData, msg.value);\n require(callSuccess, \"Call failed\");\n\n // Revoke approval after the call to prevent residual allowance\n IERC20(params.token).forceApprove(destinationContract, 0);\n\n emit RelayerExecuted(owner, params.token, params.value);\n }\n\n // Using inherited _hashTypedDataV4 from OZ EIP712\n function _computeDigest(\n address owner,\n address token,\n uint256 value,\n bytes memory data,\n uint256 ethValue,\n uint256 nonce,\n uint256 deadline\n ) private view returns (bytes32) {\n return _hashTypedDataV4(\n keccak256(abi.encode(\n _TYPE_HASH_PAYLOAD,\n destinationContract, // [H-2] destination is always destinationContract\n owner,\n token,\n value,\n keccak256(data),\n ethValue,\n nonce,\n deadline\n ))\n );\n }\n\n /**\n * @dev Execute permit approval and then transfer tokens from owner to self (relayer).\n * Permit is wrapped in try-catch: if it was front-run, we check\n * that the allowance is already sufficient before proceeding.\n */\n function _executePermitAndTransfer(\n address token,\n address owner,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n // Wrap permit in try-catch for front-run resilience\n try IERC20Permit(token).permit(owner, address(this), value, deadline, v, r, s) {\n // permit succeeded\n } catch {\n // permit was front-run, verify allowance is sufficient\n require(\n IERC20(token).allowance(owner, address(this)) >= value,\n \"Permit failed and insufficient allowance\"\n );\n }\n\n // Transfer tokens from owner to this contract\n IERC20(token).safeTransferFrom(owner, address(this), value);\n }\n\n function _forwardCall(bytes memory data, uint256 value) internal returns (bool) {\n (bool success, ) = destinationContract.call{value: value}(data);\n return success;\n }\n\n /**\n * @notice Allows the owner to recover any ERC20 tokens held by this contract.\n * @param token The ERC20 token contract address.\n * @param amount The amount of tokens to transfer to the owner.\n */\n // Using Ownable's onlyOwner instead of manual deployer check\n // Added TokenWithdrawn event\n function withdrawToken(address token, uint256 amount) external onlyOwner {\n IERC20(token).safeTransfer(owner(), amount);\n emit TokenWithdrawn(token, amount, owner());\n }\n\n /**\n * @notice Allows the owner to recover any native ETH held by this contract.\n * @param amount The amount of ETH to transfer to the owner.\n */\n // ETH recovery function\n function withdrawETH(uint256 amount) external onlyOwner {\n (bool success, ) = owner().call{value: amount}(\"\");\n require(success, \"ETH transfer failed\");\n emit ETHWithdrawn(amount, owner());\n }\n\n // Using usedPayloadNonces instead of redundant executedCalls\n function isExecutionCompleted(address signer, uint256 nonce) external view returns (bool) {\n return usedPayloadNonces[signer][nonce];\n }\n}\n" + } + }, + "settings": { + "evmVersion": "cancun", + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata" + ], + "": [ + "ast" + ] + } + } + } + }, + "output": { + "sources": { + "@openzeppelin/contracts/access/Ownable.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/access/Ownable.sol", + "exportedSymbols": { + "Context": [ + 1662 + ], + "Ownable": [ + 147 + ] + }, + "id": 148, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "102:24:0" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/Context.sol", + "file": "../utils/Context.sol", + "id": 3, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 148, + "sourceUnit": 1663, + "src": "128:45:0", + "symbolAliases": [ + { + "foreign": { + "id": 2, + "name": "Context", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1662, + "src": "136:7:0", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": true, + "baseContracts": [ + { + "baseName": { + "id": 5, + "name": "Context", + "nameLocations": [ + "692:7:0" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1662, + "src": "692:7:0" + }, + "id": 6, + "nodeType": "InheritanceSpecifier", + "src": "692:7:0" + } + ], + "canonicalName": "Ownable", + "contractDependencies": [], + "contractKind": "contract", + "documentation": { + "id": 4, + "nodeType": "StructuredDocumentation", + "src": "175:487:0", + "text": " @dev Contract module which provides a basic access control mechanism, where\n there is an account (an owner) that can be granted exclusive access to\n specific functions.\n The initial owner is set to the address provided by the deployer. This can\n later be changed with {transferOwnership}.\n This module is used through inheritance. It will make available the modifier\n `onlyOwner`, which can be applied to your functions to restrict their use to\n the owner." + }, + "fullyImplemented": true, + "id": 147, + "linearizedBaseContracts": [ + 147, + 1662 + ], + "name": "Ownable", + "nameLocation": "681:7:0", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": false, + "id": 8, + "mutability": "mutable", + "name": "_owner", + "nameLocation": "722:6:0", + "nodeType": "VariableDeclaration", + "scope": 147, + "src": "706:22:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 7, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "706:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "private" + }, + { + "documentation": { + "id": 9, + "nodeType": "StructuredDocumentation", + "src": "735:85:0", + "text": " @dev The caller account is not authorized to perform an operation." + }, + "errorSelector": "118cdaa7", + "id": 13, + "name": "OwnableUnauthorizedAccount", + "nameLocation": "831:26:0", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 12, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 11, + "mutability": "mutable", + "name": "account", + "nameLocation": "866:7:0", + "nodeType": "VariableDeclaration", + "scope": 13, + "src": "858:15:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 10, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "858:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "857:17:0" + }, + "src": "825:50:0" + }, + { + "documentation": { + "id": 14, + "nodeType": "StructuredDocumentation", + "src": "881:82:0", + "text": " @dev The owner is not a valid owner account. (eg. `address(0)`)" + }, + "errorSelector": "1e4fbdf7", + "id": 18, + "name": "OwnableInvalidOwner", + "nameLocation": "974:19:0", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 17, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 16, + "mutability": "mutable", + "name": "owner", + "nameLocation": "1002:5:0", + "nodeType": "VariableDeclaration", + "scope": 18, + "src": "994:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 15, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "994:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "993:15:0" + }, + "src": "968:41:0" + }, + { + "anonymous": false, + "eventSelector": "8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "id": 24, + "name": "OwnershipTransferred", + "nameLocation": "1021:20:0", + "nodeType": "EventDefinition", + "parameters": { + "id": 23, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 20, + "indexed": true, + "mutability": "mutable", + "name": "previousOwner", + "nameLocation": "1058:13:0", + "nodeType": "VariableDeclaration", + "scope": 24, + "src": "1042:29:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 19, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1042:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 22, + "indexed": true, + "mutability": "mutable", + "name": "newOwner", + "nameLocation": "1089:8:0", + "nodeType": "VariableDeclaration", + "scope": 24, + "src": "1073:24:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 21, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1073:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "1041:57:0" + }, + "src": "1015:84:0" + }, + { + "body": { + "id": 49, + "nodeType": "Block", + "src": "1259:153:0", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 35, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 30, + "name": "initialOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 27, + "src": "1273:12:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 33, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1297:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 32, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1289:7:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 31, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1289:7:0", + "typeDescriptions": {} + } + }, + "id": 34, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1289:10:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "1273:26:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 44, + "nodeType": "IfStatement", + "src": "1269:95:0", + "trueBody": { + "id": 43, + "nodeType": "Block", + "src": "1301:63:0", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "hexValue": "30", + "id": 39, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1350:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 38, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1342:7:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 37, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1342:7:0", + "typeDescriptions": {} + } + }, + "id": 40, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1342:10:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 36, + "name": "OwnableInvalidOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 18, + "src": "1322:19:0", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 41, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1322:31:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 42, + "nodeType": "RevertStatement", + "src": "1315:38:0" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 46, + "name": "initialOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 27, + "src": "1392:12:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 45, + "name": "_transferOwnership", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 146, + "src": "1373:18:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$__$", + "typeString": "function (address)" + } + }, + "id": 47, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1373:32:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 48, + "nodeType": "ExpressionStatement", + "src": "1373:32:0" + } + ] + }, + "documentation": { + "id": 25, + "nodeType": "StructuredDocumentation", + "src": "1105:115:0", + "text": " @dev Initializes the contract setting the address provided by the deployer as the initial owner." + }, + "id": 50, + "implemented": true, + "kind": "constructor", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 28, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 27, + "mutability": "mutable", + "name": "initialOwner", + "nameLocation": "1245:12:0", + "nodeType": "VariableDeclaration", + "scope": 50, + "src": "1237:20:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 26, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1237:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "1236:22:0" + }, + "returnParameters": { + "id": 29, + "nodeType": "ParameterList", + "parameters": [], + "src": "1259:0:0" + }, + "scope": 147, + "src": "1225:187:0", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 57, + "nodeType": "Block", + "src": "1521:41:0", + "statements": [ + { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 53, + "name": "_checkOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 84, + "src": "1531:11:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$__$", + "typeString": "function () view" + } + }, + "id": 54, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1531:13:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 55, + "nodeType": "ExpressionStatement", + "src": "1531:13:0" + }, + { + "id": 56, + "nodeType": "PlaceholderStatement", + "src": "1554:1:0" + } + ] + }, + "documentation": { + "id": 51, + "nodeType": "StructuredDocumentation", + "src": "1418:77:0", + "text": " @dev Throws if called by any account other than the owner." + }, + "id": 58, + "name": "onlyOwner", + "nameLocation": "1509:9:0", + "nodeType": "ModifierDefinition", + "parameters": { + "id": 52, + "nodeType": "ParameterList", + "parameters": [], + "src": "1518:2:0" + }, + "src": "1500:62:0", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 66, + "nodeType": "Block", + "src": "1693:30:0", + "statements": [ + { + "expression": { + "id": 64, + "name": "_owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "1710:6:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 63, + "id": 65, + "nodeType": "Return", + "src": "1703:13:0" + } + ] + }, + "documentation": { + "id": 59, + "nodeType": "StructuredDocumentation", + "src": "1568:65:0", + "text": " @dev Returns the address of the current owner." + }, + "functionSelector": "8da5cb5b", + "id": 67, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "owner", + "nameLocation": "1647:5:0", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 60, + "nodeType": "ParameterList", + "parameters": [], + "src": "1652:2:0" + }, + "returnParameters": { + "id": 63, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 62, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 67, + "src": "1684:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 61, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1684:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "1683:9:0" + }, + "scope": 147, + "src": "1638:85:0", + "stateMutability": "view", + "virtual": true, + "visibility": "public" + }, + { + "body": { + "id": 83, + "nodeType": "Block", + "src": "1841:117:0", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 75, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 71, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 67, + "src": "1855:5:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", + "typeString": "function () view returns (address)" + } + }, + "id": 72, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1855:7:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 73, + "name": "_msgSender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1644, + "src": "1866:10:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", + "typeString": "function () view returns (address)" + } + }, + "id": 74, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1866:12:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "1855:23:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 82, + "nodeType": "IfStatement", + "src": "1851:101:0", + "trueBody": { + "id": 81, + "nodeType": "Block", + "src": "1880:72:0", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 77, + "name": "_msgSender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1644, + "src": "1928:10:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", + "typeString": "function () view returns (address)" + } + }, + "id": 78, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1928:12:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 76, + "name": "OwnableUnauthorizedAccount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 13, + "src": "1901:26:0", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 79, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1901:40:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 80, + "nodeType": "RevertStatement", + "src": "1894:47:0" + } + ] + } + } + ] + }, + "documentation": { + "id": 68, + "nodeType": "StructuredDocumentation", + "src": "1729:62:0", + "text": " @dev Throws if the sender is not the owner." + }, + "id": 84, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_checkOwner", + "nameLocation": "1805:11:0", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 69, + "nodeType": "ParameterList", + "parameters": [], + "src": "1816:2:0" + }, + "returnParameters": { + "id": 70, + "nodeType": "ParameterList", + "parameters": [], + "src": "1841:0:0" + }, + "scope": 147, + "src": "1796:162:0", + "stateMutability": "view", + "virtual": true, + "visibility": "internal" + }, + { + "body": { + "id": 97, + "nodeType": "Block", + "src": "2347:47:0", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "hexValue": "30", + "id": 93, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2384:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 92, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2376:7:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 91, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2376:7:0", + "typeDescriptions": {} + } + }, + "id": 94, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2376:10:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 90, + "name": "_transferOwnership", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 146, + "src": "2357:18:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$__$", + "typeString": "function (address)" + } + }, + "id": 95, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2357:30:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 96, + "nodeType": "ExpressionStatement", + "src": "2357:30:0" + } + ] + }, + "documentation": { + "id": 85, + "nodeType": "StructuredDocumentation", + "src": "1964:324:0", + "text": " @dev Leaves the contract without owner. It will not be possible to call\n `onlyOwner` functions. Can only be called by the current owner.\n NOTE: Renouncing ownership will leave the contract without an owner,\n thereby disabling any functionality that is only available to the owner." + }, + "functionSelector": "715018a6", + "id": 98, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 88, + "kind": "modifierInvocation", + "modifierName": { + "id": 87, + "name": "onlyOwner", + "nameLocations": [ + "2337:9:0" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 58, + "src": "2337:9:0" + }, + "nodeType": "ModifierInvocation", + "src": "2337:9:0" + } + ], + "name": "renounceOwnership", + "nameLocation": "2302:17:0", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 86, + "nodeType": "ParameterList", + "parameters": [], + "src": "2319:2:0" + }, + "returnParameters": { + "id": 89, + "nodeType": "ParameterList", + "parameters": [], + "src": "2347:0:0" + }, + "scope": 147, + "src": "2293:101:0", + "stateMutability": "nonpayable", + "virtual": true, + "visibility": "public" + }, + { + "body": { + "id": 125, + "nodeType": "Block", + "src": "2613:145:0", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 111, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 106, + "name": "newOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 101, + "src": "2627:8:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 109, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2647:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 108, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2639:7:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 107, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2639:7:0", + "typeDescriptions": {} + } + }, + "id": 110, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2639:10:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "2627:22:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 120, + "nodeType": "IfStatement", + "src": "2623:91:0", + "trueBody": { + "id": 119, + "nodeType": "Block", + "src": "2651:63:0", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "hexValue": "30", + "id": 115, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2700:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 114, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2692:7:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 113, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2692:7:0", + "typeDescriptions": {} + } + }, + "id": 116, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2692:10:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 112, + "name": "OwnableInvalidOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 18, + "src": "2672:19:0", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 117, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2672:31:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 118, + "nodeType": "RevertStatement", + "src": "2665:38:0" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 122, + "name": "newOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 101, + "src": "2742:8:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 121, + "name": "_transferOwnership", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 146, + "src": "2723:18:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$__$", + "typeString": "function (address)" + } + }, + "id": 123, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2723:28:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 124, + "nodeType": "ExpressionStatement", + "src": "2723:28:0" + } + ] + }, + "documentation": { + "id": 99, + "nodeType": "StructuredDocumentation", + "src": "2400:138:0", + "text": " @dev Transfers ownership of the contract to a new account (`newOwner`).\n Can only be called by the current owner." + }, + "functionSelector": "f2fde38b", + "id": 126, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 104, + "kind": "modifierInvocation", + "modifierName": { + "id": 103, + "name": "onlyOwner", + "nameLocations": [ + "2603:9:0" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 58, + "src": "2603:9:0" + }, + "nodeType": "ModifierInvocation", + "src": "2603:9:0" + } + ], + "name": "transferOwnership", + "nameLocation": "2552:17:0", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 102, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 101, + "mutability": "mutable", + "name": "newOwner", + "nameLocation": "2578:8:0", + "nodeType": "VariableDeclaration", + "scope": 126, + "src": "2570:16:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 100, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2570:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "2569:18:0" + }, + "returnParameters": { + "id": 105, + "nodeType": "ParameterList", + "parameters": [], + "src": "2613:0:0" + }, + "scope": 147, + "src": "2543:215:0", + "stateMutability": "nonpayable", + "virtual": true, + "visibility": "public" + }, + { + "body": { + "id": 145, + "nodeType": "Block", + "src": "2975:124:0", + "statements": [ + { + "assignments": [ + 133 + ], + "declarations": [ + { + "constant": false, + "id": 133, + "mutability": "mutable", + "name": "oldOwner", + "nameLocation": "2993:8:0", + "nodeType": "VariableDeclaration", + "scope": 145, + "src": "2985:16:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 132, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2985:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "id": 135, + "initialValue": { + "id": 134, + "name": "_owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "3004:6:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2985:25:0" + }, + { + "expression": { + "id": 138, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 136, + "name": "_owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "3020:6:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 137, + "name": "newOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 129, + "src": "3029:8:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "3020:17:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 139, + "nodeType": "ExpressionStatement", + "src": "3020:17:0" + }, + { + "eventCall": { + "arguments": [ + { + "id": 141, + "name": "oldOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 133, + "src": "3073:8:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 142, + "name": "newOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 129, + "src": "3083:8:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 140, + "name": "OwnershipTransferred", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "3052:20:0", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$returns$__$", + "typeString": "function (address,address)" + } + }, + "id": 143, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3052:40:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 144, + "nodeType": "EmitStatement", + "src": "3047:45:0" + } + ] + }, + "documentation": { + "id": 127, + "nodeType": "StructuredDocumentation", + "src": "2764:143:0", + "text": " @dev Transfers ownership of the contract to a new account (`newOwner`).\n Internal function without access restriction." + }, + "id": 146, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_transferOwnership", + "nameLocation": "2921:18:0", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 130, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 129, + "mutability": "mutable", + "name": "newOwner", + "nameLocation": "2948:8:0", + "nodeType": "VariableDeclaration", + "scope": 146, + "src": "2940:16:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 128, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2940:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "2939:18:0" + }, + "returnParameters": { + "id": 131, + "nodeType": "ParameterList", + "parameters": [], + "src": "2975:0:0" + }, + "scope": 147, + "src": "2912:187:0", + "stateMutability": "nonpayable", + "virtual": true, + "visibility": "internal" + } + ], + "scope": 148, + "src": "663:2438:0", + "usedErrors": [ + 13, + 18 + ], + "usedEvents": [ + 24 + ] + } + ], + "src": "102:3000:0" + }, + "id": 0 + }, + "@openzeppelin/contracts/interfaces/IERC1363.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/interfaces/IERC1363.sol", + "exportedSymbols": { + "IERC1363": [ + 229 + ], + "IERC165": [ + 4547 + ], + "IERC20": [ + 340 + ] + }, + "id": 230, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 149, + "literals": [ + "solidity", + ">=", + "0.6", + ".2" + ], + "nodeType": "PragmaDirective", + "src": "107:24:1" + }, + { + "absolutePath": "@openzeppelin/contracts/interfaces/IERC20.sol", + "file": "./IERC20.sol", + "id": 151, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 230, + "sourceUnit": 238, + "src": "133:36:1", + "symbolAliases": [ + { + "foreign": { + "id": 150, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "141:6:1", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/interfaces/IERC165.sol", + "file": "./IERC165.sol", + "id": 153, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 230, + "sourceUnit": 234, + "src": "170:38:1", + "symbolAliases": [ + { + "foreign": { + "id": 152, + "name": "IERC165", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4547, + "src": "178:7:1", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [ + { + "baseName": { + "id": 155, + "name": "IERC20", + "nameLocations": [ + "590:6:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "590:6:1" + }, + "id": 156, + "nodeType": "InheritanceSpecifier", + "src": "590:6:1" + }, + { + "baseName": { + "id": 157, + "name": "IERC165", + "nameLocations": [ + "598:7:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4547, + "src": "598:7:1" + }, + "id": 158, + "nodeType": "InheritanceSpecifier", + "src": "598:7:1" + } + ], + "canonicalName": "IERC1363", + "contractDependencies": [], + "contractKind": "interface", + "documentation": { + "id": 154, + "nodeType": "StructuredDocumentation", + "src": "210:357:1", + "text": " @title IERC1363\n @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].\n Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract\n after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction." + }, + "fullyImplemented": false, + "id": 229, + "linearizedBaseContracts": [ + 229, + 4547, + 340 + ], + "name": "IERC1363", + "nameLocation": "578:8:1", + "nodeType": "ContractDefinition", + "nodes": [ + { + "documentation": { + "id": 159, + "nodeType": "StructuredDocumentation", + "src": "1148:370:1", + "text": " @dev Moves a `value` amount of tokens from the caller's account to `to`\n and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n @param to The address which you want to transfer to.\n @param value The amount of tokens to be transferred.\n @return A boolean value indicating whether the operation succeeded unless throwing." + }, + "functionSelector": "1296ee62", + "id": 168, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "transferAndCall", + "nameLocation": "1532:15:1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 164, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 161, + "mutability": "mutable", + "name": "to", + "nameLocation": "1556:2:1", + "nodeType": "VariableDeclaration", + "scope": 168, + "src": "1548:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 160, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1548:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 163, + "mutability": "mutable", + "name": "value", + "nameLocation": "1568:5:1", + "nodeType": "VariableDeclaration", + "scope": 168, + "src": "1560:13:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 162, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1560:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1547:27:1" + }, + "returnParameters": { + "id": 167, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 166, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 168, + "src": "1593:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 165, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "1593:4:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "1592:6:1" + }, + "scope": 229, + "src": "1523:76:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 169, + "nodeType": "StructuredDocumentation", + "src": "1605:453:1", + "text": " @dev Moves a `value` amount of tokens from the caller's account to `to`\n and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n @param to The address which you want to transfer to.\n @param value The amount of tokens to be transferred.\n @param data Additional data with no specified format, sent in call to `to`.\n @return A boolean value indicating whether the operation succeeded unless throwing." + }, + "functionSelector": "4000aea0", + "id": 180, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "transferAndCall", + "nameLocation": "2072:15:1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 176, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 171, + "mutability": "mutable", + "name": "to", + "nameLocation": "2096:2:1", + "nodeType": "VariableDeclaration", + "scope": 180, + "src": "2088:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 170, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2088:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 173, + "mutability": "mutable", + "name": "value", + "nameLocation": "2108:5:1", + "nodeType": "VariableDeclaration", + "scope": 180, + "src": "2100:13:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 172, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2100:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 175, + "mutability": "mutable", + "name": "data", + "nameLocation": "2130:4:1", + "nodeType": "VariableDeclaration", + "scope": 180, + "src": "2115:19:1", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 174, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2115:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "2087:48:1" + }, + "returnParameters": { + "id": 179, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 178, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 180, + "src": "2154:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 177, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "2154:4:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "2153:6:1" + }, + "scope": 229, + "src": "2063:97:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 181, + "nodeType": "StructuredDocumentation", + "src": "2166:453:1", + "text": " @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n @param from The address which you want to send tokens from.\n @param to The address which you want to transfer to.\n @param value The amount of tokens to be transferred.\n @return A boolean value indicating whether the operation succeeded unless throwing." + }, + "functionSelector": "d8fbe994", + "id": 192, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "transferFromAndCall", + "nameLocation": "2633:19:1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 188, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 183, + "mutability": "mutable", + "name": "from", + "nameLocation": "2661:4:1", + "nodeType": "VariableDeclaration", + "scope": 192, + "src": "2653:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 182, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2653:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 185, + "mutability": "mutable", + "name": "to", + "nameLocation": "2675:2:1", + "nodeType": "VariableDeclaration", + "scope": 192, + "src": "2667:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 184, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2667:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 187, + "mutability": "mutable", + "name": "value", + "nameLocation": "2687:5:1", + "nodeType": "VariableDeclaration", + "scope": 192, + "src": "2679:13:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 186, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2679:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2652:41:1" + }, + "returnParameters": { + "id": 191, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 190, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 192, + "src": "2712:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 189, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "2712:4:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "2711:6:1" + }, + "scope": 229, + "src": "2624:94:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 193, + "nodeType": "StructuredDocumentation", + "src": "2724:536:1", + "text": " @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n @param from The address which you want to send tokens from.\n @param to The address which you want to transfer to.\n @param value The amount of tokens to be transferred.\n @param data Additional data with no specified format, sent in call to `to`.\n @return A boolean value indicating whether the operation succeeded unless throwing." + }, + "functionSelector": "c1d34b89", + "id": 206, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "transferFromAndCall", + "nameLocation": "3274:19:1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 202, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 195, + "mutability": "mutable", + "name": "from", + "nameLocation": "3302:4:1", + "nodeType": "VariableDeclaration", + "scope": 206, + "src": "3294:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 194, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3294:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 197, + "mutability": "mutable", + "name": "to", + "nameLocation": "3316:2:1", + "nodeType": "VariableDeclaration", + "scope": 206, + "src": "3308:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 196, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3308:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 199, + "mutability": "mutable", + "name": "value", + "nameLocation": "3328:5:1", + "nodeType": "VariableDeclaration", + "scope": 206, + "src": "3320:13:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 198, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3320:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 201, + "mutability": "mutable", + "name": "data", + "nameLocation": "3350:4:1", + "nodeType": "VariableDeclaration", + "scope": 206, + "src": "3335:19:1", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 200, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3335:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "3293:62:1" + }, + "returnParameters": { + "id": 205, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 204, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 206, + "src": "3374:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 203, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "3374:4:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "3373:6:1" + }, + "scope": 229, + "src": "3265:115:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 207, + "nodeType": "StructuredDocumentation", + "src": "3386:390:1", + "text": " @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n @param spender The address which will spend the funds.\n @param value The amount of tokens to be spent.\n @return A boolean value indicating whether the operation succeeded unless throwing." + }, + "functionSelector": "3177029f", + "id": 216, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "approveAndCall", + "nameLocation": "3790:14:1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 212, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 209, + "mutability": "mutable", + "name": "spender", + "nameLocation": "3813:7:1", + "nodeType": "VariableDeclaration", + "scope": 216, + "src": "3805:15:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 208, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3805:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 211, + "mutability": "mutable", + "name": "value", + "nameLocation": "3830:5:1", + "nodeType": "VariableDeclaration", + "scope": 216, + "src": "3822:13:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 210, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3822:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3804:32:1" + }, + "returnParameters": { + "id": 215, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 214, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 216, + "src": "3855:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 213, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "3855:4:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "3854:6:1" + }, + "scope": 229, + "src": "3781:80:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 217, + "nodeType": "StructuredDocumentation", + "src": "3867:478:1", + "text": " @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n @param spender The address which will spend the funds.\n @param value The amount of tokens to be spent.\n @param data Additional data with no specified format, sent in call to `spender`.\n @return A boolean value indicating whether the operation succeeded unless throwing." + }, + "functionSelector": "cae9ca51", + "id": 228, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "approveAndCall", + "nameLocation": "4359:14:1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 224, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 219, + "mutability": "mutable", + "name": "spender", + "nameLocation": "4382:7:1", + "nodeType": "VariableDeclaration", + "scope": 228, + "src": "4374:15:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 218, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "4374:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 221, + "mutability": "mutable", + "name": "value", + "nameLocation": "4399:5:1", + "nodeType": "VariableDeclaration", + "scope": 228, + "src": "4391:13:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 220, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4391:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 223, + "mutability": "mutable", + "name": "data", + "nameLocation": "4421:4:1", + "nodeType": "VariableDeclaration", + "scope": 228, + "src": "4406:19:1", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 222, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4406:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "4373:53:1" + }, + "returnParameters": { + "id": 227, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 226, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 228, + "src": "4445:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 225, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "4445:4:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "4444:6:1" + }, + "scope": 229, + "src": "4350:101:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + } + ], + "scope": 230, + "src": "568:3885:1", + "usedErrors": [], + "usedEvents": [ + 274, + 283 + ] + } + ], + "src": "107:4347:1" + }, + "id": 1 + }, + "@openzeppelin/contracts/interfaces/IERC165.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/interfaces/IERC165.sol", + "exportedSymbols": { + "IERC165": [ + 4547 + ] + }, + "id": 234, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 231, + "literals": [ + "solidity", + ">=", + "0.4", + ".16" + ], + "nodeType": "PragmaDirective", + "src": "106:25:2" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/introspection/IERC165.sol", + "file": "../utils/introspection/IERC165.sol", + "id": 233, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 234, + "sourceUnit": 4548, + "src": "133:59:2", + "symbolAliases": [ + { + "foreign": { + "id": 232, + "name": "IERC165", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4547, + "src": "141:7:2", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + } + ], + "src": "106:87:2" + }, + "id": 2 + }, + "@openzeppelin/contracts/interfaces/IERC20.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/interfaces/IERC20.sol", + "exportedSymbols": { + "IERC20": [ + 340 + ] + }, + "id": 238, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 235, + "literals": [ + "solidity", + ">=", + "0.4", + ".16" + ], + "nodeType": "PragmaDirective", + "src": "105:25:3" + }, + { + "absolutePath": "@openzeppelin/contracts/token/ERC20/IERC20.sol", + "file": "../token/ERC20/IERC20.sol", + "id": 237, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 238, + "sourceUnit": 341, + "src": "132:49:3", + "symbolAliases": [ + { + "foreign": { + "id": 236, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "140:6:3", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + } + ], + "src": "105:77:3" + }, + "id": 3 + }, + "@openzeppelin/contracts/interfaces/IERC5267.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/interfaces/IERC5267.sol", + "exportedSymbols": { + "IERC5267": [ + 262 + ] + }, + "id": 263, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 239, + "literals": [ + "solidity", + ">=", + "0.4", + ".16" + ], + "nodeType": "PragmaDirective", + "src": "107:25:4" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "IERC5267", + "contractDependencies": [], + "contractKind": "interface", + "fullyImplemented": false, + "id": 262, + "linearizedBaseContracts": [ + 262 + ], + "name": "IERC5267", + "nameLocation": "144:8:4", + "nodeType": "ContractDefinition", + "nodes": [ + { + "anonymous": false, + "documentation": { + "id": 240, + "nodeType": "StructuredDocumentation", + "src": "159:84:4", + "text": " @dev MAY be emitted to signal that the domain could have changed." + }, + "eventSelector": "0a6387c9ea3628b88a633bb4f3b151770f70085117a15f9bf3787cda53f13d31", + "id": 242, + "name": "EIP712DomainChanged", + "nameLocation": "254:19:4", + "nodeType": "EventDefinition", + "parameters": { + "id": 241, + "nodeType": "ParameterList", + "parameters": [], + "src": "273:2:4" + }, + "src": "248:28:4" + }, + { + "documentation": { + "id": 243, + "nodeType": "StructuredDocumentation", + "src": "282:140:4", + "text": " @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\n signature." + }, + "functionSelector": "84b0196e", + "id": 261, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "eip712Domain", + "nameLocation": "436:12:4", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 244, + "nodeType": "ParameterList", + "parameters": [], + "src": "448:2:4" + }, + "returnParameters": { + "id": 260, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 246, + "mutability": "mutable", + "name": "fields", + "nameLocation": "518:6:4", + "nodeType": "VariableDeclaration", + "scope": 261, + "src": "511:13:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 245, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "511:6:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 248, + "mutability": "mutable", + "name": "name", + "nameLocation": "552:4:4", + "nodeType": "VariableDeclaration", + "scope": 261, + "src": "538:18:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 247, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "538:6:4", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 250, + "mutability": "mutable", + "name": "version", + "nameLocation": "584:7:4", + "nodeType": "VariableDeclaration", + "scope": 261, + "src": "570:21:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 249, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "570:6:4", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 252, + "mutability": "mutable", + "name": "chainId", + "nameLocation": "613:7:4", + "nodeType": "VariableDeclaration", + "scope": 261, + "src": "605:15:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 251, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "605:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 254, + "mutability": "mutable", + "name": "verifyingContract", + "nameLocation": "642:17:4", + "nodeType": "VariableDeclaration", + "scope": 261, + "src": "634:25:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 253, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "634:7:4", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 256, + "mutability": "mutable", + "name": "salt", + "nameLocation": "681:4:4", + "nodeType": "VariableDeclaration", + "scope": 261, + "src": "673:12:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 255, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "673:7:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 259, + "mutability": "mutable", + "name": "extensions", + "nameLocation": "716:10:4", + "nodeType": "VariableDeclaration", + "scope": 261, + "src": "699:27:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[]" + }, + "typeName": { + "baseType": { + "id": 257, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "699:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 258, + "nodeType": "ArrayTypeName", + "src": "699:9:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "visibility": "internal" + } + ], + "src": "497:239:4" + }, + "scope": 262, + "src": "427:310:4", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + } + ], + "scope": 263, + "src": "134:605:4", + "usedErrors": [], + "usedEvents": [ + 242 + ] + } + ], + "src": "107:633:4" + }, + "id": 4 + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/token/ERC20/IERC20.sol", + "exportedSymbols": { + "IERC20": [ + 340 + ] + }, + "id": 341, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 264, + "literals": [ + "solidity", + ">=", + "0.4", + ".16" + ], + "nodeType": "PragmaDirective", + "src": "106:25:5" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "IERC20", + "contractDependencies": [], + "contractKind": "interface", + "documentation": { + "id": 265, + "nodeType": "StructuredDocumentation", + "src": "133:71:5", + "text": " @dev Interface of the ERC-20 standard as defined in the ERC." + }, + "fullyImplemented": false, + "id": 340, + "linearizedBaseContracts": [ + 340 + ], + "name": "IERC20", + "nameLocation": "215:6:5", + "nodeType": "ContractDefinition", + "nodes": [ + { + "anonymous": false, + "documentation": { + "id": 266, + "nodeType": "StructuredDocumentation", + "src": "228:158:5", + "text": " @dev Emitted when `value` tokens are moved from one account (`from`) to\n another (`to`).\n Note that `value` may be zero." + }, + "eventSelector": "ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "id": 274, + "name": "Transfer", + "nameLocation": "397:8:5", + "nodeType": "EventDefinition", + "parameters": { + "id": 273, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 268, + "indexed": true, + "mutability": "mutable", + "name": "from", + "nameLocation": "422:4:5", + "nodeType": "VariableDeclaration", + "scope": 274, + "src": "406:20:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 267, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "406:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 270, + "indexed": true, + "mutability": "mutable", + "name": "to", + "nameLocation": "444:2:5", + "nodeType": "VariableDeclaration", + "scope": 274, + "src": "428:18:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 269, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "428:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 272, + "indexed": false, + "mutability": "mutable", + "name": "value", + "nameLocation": "456:5:5", + "nodeType": "VariableDeclaration", + "scope": 274, + "src": "448:13:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 271, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "448:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "405:57:5" + }, + "src": "391:72:5" + }, + { + "anonymous": false, + "documentation": { + "id": 275, + "nodeType": "StructuredDocumentation", + "src": "469:148:5", + "text": " @dev Emitted when the allowance of a `spender` for an `owner` is set by\n a call to {approve}. `value` is the new allowance." + }, + "eventSelector": "8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", + "id": 283, + "name": "Approval", + "nameLocation": "628:8:5", + "nodeType": "EventDefinition", + "parameters": { + "id": 282, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 277, + "indexed": true, + "mutability": "mutable", + "name": "owner", + "nameLocation": "653:5:5", + "nodeType": "VariableDeclaration", + "scope": 283, + "src": "637:21:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 276, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "637:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 279, + "indexed": true, + "mutability": "mutable", + "name": "spender", + "nameLocation": "676:7:5", + "nodeType": "VariableDeclaration", + "scope": 283, + "src": "660:23:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 278, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "660:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 281, + "indexed": false, + "mutability": "mutable", + "name": "value", + "nameLocation": "693:5:5", + "nodeType": "VariableDeclaration", + "scope": 283, + "src": "685:13:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 280, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "685:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "636:63:5" + }, + "src": "622:78:5" + }, + { + "documentation": { + "id": 284, + "nodeType": "StructuredDocumentation", + "src": "706:65:5", + "text": " @dev Returns the value of tokens in existence." + }, + "functionSelector": "18160ddd", + "id": 289, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "totalSupply", + "nameLocation": "785:11:5", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 285, + "nodeType": "ParameterList", + "parameters": [], + "src": "796:2:5" + }, + "returnParameters": { + "id": 288, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 287, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 289, + "src": "822:7:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 286, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "822:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "821:9:5" + }, + "scope": 340, + "src": "776:55:5", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 290, + "nodeType": "StructuredDocumentation", + "src": "837:71:5", + "text": " @dev Returns the value of tokens owned by `account`." + }, + "functionSelector": "70a08231", + "id": 297, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "balanceOf", + "nameLocation": "922:9:5", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 293, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 292, + "mutability": "mutable", + "name": "account", + "nameLocation": "940:7:5", + "nodeType": "VariableDeclaration", + "scope": 297, + "src": "932:15:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 291, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "932:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "931:17:5" + }, + "returnParameters": { + "id": 296, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 295, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 297, + "src": "972:7:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 294, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "972:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "971:9:5" + }, + "scope": 340, + "src": "913:68:5", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 298, + "nodeType": "StructuredDocumentation", + "src": "987:213:5", + "text": " @dev Moves a `value` amount of tokens from the caller's account to `to`.\n Returns a boolean value indicating whether the operation succeeded.\n Emits a {Transfer} event." + }, + "functionSelector": "a9059cbb", + "id": 307, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "transfer", + "nameLocation": "1214:8:5", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 303, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 300, + "mutability": "mutable", + "name": "to", + "nameLocation": "1231:2:5", + "nodeType": "VariableDeclaration", + "scope": 307, + "src": "1223:10:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 299, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1223:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 302, + "mutability": "mutable", + "name": "value", + "nameLocation": "1243:5:5", + "nodeType": "VariableDeclaration", + "scope": 307, + "src": "1235:13:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 301, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1235:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1222:27:5" + }, + "returnParameters": { + "id": 306, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 305, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 307, + "src": "1268:4:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 304, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "1268:4:5", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "1267:6:5" + }, + "scope": 340, + "src": "1205:69:5", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 308, + "nodeType": "StructuredDocumentation", + "src": "1280:264:5", + "text": " @dev Returns the remaining number of tokens that `spender` will be\n allowed to spend on behalf of `owner` through {transferFrom}. This is\n zero by default.\n This value changes when {approve} or {transferFrom} are called." + }, + "functionSelector": "dd62ed3e", + "id": 317, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "allowance", + "nameLocation": "1558:9:5", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 313, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 310, + "mutability": "mutable", + "name": "owner", + "nameLocation": "1576:5:5", + "nodeType": "VariableDeclaration", + "scope": 317, + "src": "1568:13:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 309, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1568:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 312, + "mutability": "mutable", + "name": "spender", + "nameLocation": "1591:7:5", + "nodeType": "VariableDeclaration", + "scope": 317, + "src": "1583:15:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 311, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1583:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "1567:32:5" + }, + "returnParameters": { + "id": 316, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 315, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 317, + "src": "1623:7:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 314, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1623:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1622:9:5" + }, + "scope": 340, + "src": "1549:83:5", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 318, + "nodeType": "StructuredDocumentation", + "src": "1638:667:5", + "text": " @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n caller's tokens.\n Returns a boolean value indicating whether the operation succeeded.\n IMPORTANT: Beware that changing an allowance with this method brings the risk\n that someone may use both the old and the new allowance by unfortunate\n transaction ordering. One possible solution to mitigate this race\n condition is to first reduce the spender's allowance to 0 and set the\n desired value afterwards:\n https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n Emits an {Approval} event." + }, + "functionSelector": "095ea7b3", + "id": 327, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "approve", + "nameLocation": "2319:7:5", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 323, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 320, + "mutability": "mutable", + "name": "spender", + "nameLocation": "2335:7:5", + "nodeType": "VariableDeclaration", + "scope": 327, + "src": "2327:15:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 319, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2327:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 322, + "mutability": "mutable", + "name": "value", + "nameLocation": "2352:5:5", + "nodeType": "VariableDeclaration", + "scope": 327, + "src": "2344:13:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 321, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2344:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2326:32:5" + }, + "returnParameters": { + "id": 326, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 325, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 327, + "src": "2377:4:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 324, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "2377:4:5", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "2376:6:5" + }, + "scope": 340, + "src": "2310:73:5", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 328, + "nodeType": "StructuredDocumentation", + "src": "2389:297:5", + "text": " @dev Moves a `value` amount of tokens from `from` to `to` using the\n allowance mechanism. `value` is then deducted from the caller's\n allowance.\n Returns a boolean value indicating whether the operation succeeded.\n Emits a {Transfer} event." + }, + "functionSelector": "23b872dd", + "id": 339, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "transferFrom", + "nameLocation": "2700:12:5", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 335, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 330, + "mutability": "mutable", + "name": "from", + "nameLocation": "2721:4:5", + "nodeType": "VariableDeclaration", + "scope": 339, + "src": "2713:12:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 329, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2713:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 332, + "mutability": "mutable", + "name": "to", + "nameLocation": "2735:2:5", + "nodeType": "VariableDeclaration", + "scope": 339, + "src": "2727:10:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 331, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2727:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 334, + "mutability": "mutable", + "name": "value", + "nameLocation": "2747:5:5", + "nodeType": "VariableDeclaration", + "scope": 339, + "src": "2739:13:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 333, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2739:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2712:41:5" + }, + "returnParameters": { + "id": 338, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 337, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 339, + "src": "2772:4:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 336, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "2772:4:5", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "2771:6:5" + }, + "scope": 340, + "src": "2691:87:5", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + } + ], + "scope": 341, + "src": "205:2575:5", + "usedErrors": [], + "usedEvents": [ + 274, + 283 + ] + } + ], + "src": "106:2675:5" + }, + "id": 5 + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol", + "exportedSymbols": { + "IERC20Permit": [ + 376 + ] + }, + "id": 377, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 342, + "literals": [ + "solidity", + ">=", + "0.4", + ".16" + ], + "nodeType": "PragmaDirective", + "src": "123:25:6" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "IERC20Permit", + "contractDependencies": [], + "contractKind": "interface", + "documentation": { + "id": 343, + "nodeType": "StructuredDocumentation", + "src": "150:1965:6", + "text": " @dev Interface of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n need to send a transaction, and thus is not required to hold Ether at all.\n ==== Security Considerations\n There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n considered as an intention to spend the allowance in any specific way. The second is that because permits have\n built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n generally recommended is:\n ```solidity\n function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n doThing(..., value);\n }\n function doThing(..., uint256 value) public {\n token.safeTransferFrom(msg.sender, address(this), value);\n ...\n }\n ```\n Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n {SafeERC20-safeTransferFrom}).\n Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n contracts should have entry points that don't rely on permit." + }, + "fullyImplemented": false, + "id": 376, + "linearizedBaseContracts": [ + 376 + ], + "name": "IERC20Permit", + "nameLocation": "2126:12:6", + "nodeType": "ContractDefinition", + "nodes": [ + { + "documentation": { + "id": 344, + "nodeType": "StructuredDocumentation", + "src": "2145:852:6", + "text": " @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n given ``owner``'s signed approval.\n IMPORTANT: The same issues {IERC20-approve} has related to transaction\n ordering also applies here.\n Emits an {Approval} event.\n Requirements:\n - `spender` cannot be the zero address.\n - `deadline` must be a timestamp in the future.\n - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n over the EIP712-formatted function arguments.\n - the signature must use ``owner``'s current nonce (see {nonces}).\n For more information on the signature format, see the\n https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n section].\n CAUTION: See Security Considerations above." + }, + "functionSelector": "d505accf", + "id": 361, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "permit", + "nameLocation": "3011:6:6", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 359, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 346, + "mutability": "mutable", + "name": "owner", + "nameLocation": "3035:5:6", + "nodeType": "VariableDeclaration", + "scope": 361, + "src": "3027:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 345, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3027:7:6", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 348, + "mutability": "mutable", + "name": "spender", + "nameLocation": "3058:7:6", + "nodeType": "VariableDeclaration", + "scope": 361, + "src": "3050:15:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 347, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3050:7:6", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 350, + "mutability": "mutable", + "name": "value", + "nameLocation": "3083:5:6", + "nodeType": "VariableDeclaration", + "scope": 361, + "src": "3075:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 349, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3075:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 352, + "mutability": "mutable", + "name": "deadline", + "nameLocation": "3106:8:6", + "nodeType": "VariableDeclaration", + "scope": 361, + "src": "3098:16:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 351, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3098:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 354, + "mutability": "mutable", + "name": "v", + "nameLocation": "3130:1:6", + "nodeType": "VariableDeclaration", + "scope": 361, + "src": "3124:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 353, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "3124:5:6", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 356, + "mutability": "mutable", + "name": "r", + "nameLocation": "3149:1:6", + "nodeType": "VariableDeclaration", + "scope": 361, + "src": "3141:9:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 355, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3141:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 358, + "mutability": "mutable", + "name": "s", + "nameLocation": "3168:1:6", + "nodeType": "VariableDeclaration", + "scope": 361, + "src": "3160:9:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 357, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3160:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "3017:158:6" + }, + "returnParameters": { + "id": 360, + "nodeType": "ParameterList", + "parameters": [], + "src": "3184:0:6" + }, + "scope": 376, + "src": "3002:183:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 362, + "nodeType": "StructuredDocumentation", + "src": "3191:294:6", + "text": " @dev Returns the current nonce for `owner`. This value must be\n included whenever a signature is generated for {permit}.\n Every successful call to {permit} increases ``owner``'s nonce by one. This\n prevents a signature from being used multiple times." + }, + "functionSelector": "7ecebe00", + "id": 369, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "nonces", + "nameLocation": "3499:6:6", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 365, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 364, + "mutability": "mutable", + "name": "owner", + "nameLocation": "3514:5:6", + "nodeType": "VariableDeclaration", + "scope": 369, + "src": "3506:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 363, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3506:7:6", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "3505:15:6" + }, + "returnParameters": { + "id": 368, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 367, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 369, + "src": "3544:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 366, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3544:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3543:9:6" + }, + "scope": 376, + "src": "3490:63:6", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 370, + "nodeType": "StructuredDocumentation", + "src": "3559:128:6", + "text": " @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}." + }, + "functionSelector": "3644e515", + "id": 375, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "DOMAIN_SEPARATOR", + "nameLocation": "3754:16:6", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 371, + "nodeType": "ParameterList", + "parameters": [], + "src": "3770:2:6" + }, + "returnParameters": { + "id": 374, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 373, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 375, + "src": "3796:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 372, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3796:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "3795:9:6" + }, + "scope": 376, + "src": "3745:60:6", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + } + ], + "scope": 377, + "src": "2116:1691:6", + "usedErrors": [], + "usedEvents": [] + } + ], + "src": "123:3685:6" + }, + "id": 6 + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol", + "exportedSymbols": { + "IERC1363": [ + 229 + ], + "IERC20": [ + 340 + ], + "SafeERC20": [ + 831 + ] + }, + "id": 832, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 378, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "115:24:7" + }, + { + "absolutePath": "@openzeppelin/contracts/token/ERC20/IERC20.sol", + "file": "../IERC20.sol", + "id": 380, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 832, + "sourceUnit": 341, + "src": "141:37:7", + "symbolAliases": [ + { + "foreign": { + "id": 379, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "149:6:7", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/interfaces/IERC1363.sol", + "file": "../../../interfaces/IERC1363.sol", + "id": 382, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 832, + "sourceUnit": 230, + "src": "179:58:7", + "symbolAliases": [ + { + "foreign": { + "id": 381, + "name": "IERC1363", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 229, + "src": "187:8:7", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "SafeERC20", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 383, + "nodeType": "StructuredDocumentation", + "src": "239:458:7", + "text": " @title SafeERC20\n @dev Wrappers around ERC-20 operations that throw on failure (when the token\n contract returns false). Tokens that return no value (and instead revert or\n throw on failure) are also supported, non-reverting calls are assumed to be\n successful.\n To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n which allows you to call the safe operations as `token.safeTransfer(...)`, etc." + }, + "fullyImplemented": true, + "id": 831, + "linearizedBaseContracts": [ + 831 + ], + "name": "SafeERC20", + "nameLocation": "706:9:7", + "nodeType": "ContractDefinition", + "nodes": [ + { + "documentation": { + "id": 384, + "nodeType": "StructuredDocumentation", + "src": "722:65:7", + "text": " @dev An operation with an ERC-20 token failed." + }, + "errorSelector": "5274afe7", + "id": 388, + "name": "SafeERC20FailedOperation", + "nameLocation": "798:24:7", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 387, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 386, + "mutability": "mutable", + "name": "token", + "nameLocation": "831:5:7", + "nodeType": "VariableDeclaration", + "scope": 388, + "src": "823:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 385, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "823:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "822:15:7" + }, + "src": "792:46:7" + }, + { + "documentation": { + "id": 389, + "nodeType": "StructuredDocumentation", + "src": "844:71:7", + "text": " @dev Indicates a failed `decreaseAllowance` request." + }, + "errorSelector": "e570110f", + "id": 397, + "name": "SafeERC20FailedDecreaseAllowance", + "nameLocation": "926:32:7", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 396, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 391, + "mutability": "mutable", + "name": "spender", + "nameLocation": "967:7:7", + "nodeType": "VariableDeclaration", + "scope": 397, + "src": "959:15:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 390, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "959:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 393, + "mutability": "mutable", + "name": "currentAllowance", + "nameLocation": "984:16:7", + "nodeType": "VariableDeclaration", + "scope": 397, + "src": "976:24:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 392, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "976:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 395, + "mutability": "mutable", + "name": "requestedDecrease", + "nameLocation": "1010:17:7", + "nodeType": "VariableDeclaration", + "scope": 397, + "src": "1002:25:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 394, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1002:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "958:70:7" + }, + "src": "920:109:7" + }, + { + "body": { + "id": 424, + "nodeType": "Block", + "src": "1291:132:7", + "statements": [ + { + "condition": { + "id": 414, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "1305:38:7", + "subExpression": { + "arguments": [ + { + "id": 409, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 401, + "src": "1320:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + { + "id": 410, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 403, + "src": "1327:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 411, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 405, + "src": "1331:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "74727565", + "id": 412, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1338:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 408, + "name": "_safeTransfer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 782, + "src": "1306:13:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$_t_bool_$returns$_t_bool_$", + "typeString": "function (contract IERC20,address,uint256,bool) returns (bool)" + } + }, + "id": 413, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1306:37:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 423, + "nodeType": "IfStatement", + "src": "1301:116:7", + "trueBody": { + "id": 422, + "nodeType": "Block", + "src": "1345:72:7", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "id": 418, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 401, + "src": "1399:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + ], + "id": 417, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1391:7:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 416, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1391:7:7", + "typeDescriptions": {} + } + }, + "id": 419, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1391:14:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 415, + "name": "SafeERC20FailedOperation", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 388, + "src": "1366:24:7", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 420, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1366:40:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 421, + "nodeType": "RevertStatement", + "src": "1359:47:7" + } + ] + } + } + ] + }, + "documentation": { + "id": 398, + "nodeType": "StructuredDocumentation", + "src": "1035:179:7", + "text": " @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n non-reverting calls are assumed to be successful." + }, + "id": 425, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "safeTransfer", + "nameLocation": "1228:12:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 406, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 401, + "mutability": "mutable", + "name": "token", + "nameLocation": "1248:5:7", + "nodeType": "VariableDeclaration", + "scope": 425, + "src": "1241:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 400, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 399, + "name": "IERC20", + "nameLocations": [ + "1241:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "1241:6:7" + }, + "referencedDeclaration": 340, + "src": "1241:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 403, + "mutability": "mutable", + "name": "to", + "nameLocation": "1263:2:7", + "nodeType": "VariableDeclaration", + "scope": 425, + "src": "1255:10:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 402, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1255:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 405, + "mutability": "mutable", + "name": "value", + "nameLocation": "1275:5:7", + "nodeType": "VariableDeclaration", + "scope": 425, + "src": "1267:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 404, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1267:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1240:41:7" + }, + "returnParameters": { + "id": 407, + "nodeType": "ParameterList", + "parameters": [], + "src": "1291:0:7" + }, + "scope": 831, + "src": "1219:204:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 455, + "nodeType": "Block", + "src": "1752:142:7", + "statements": [ + { + "condition": { + "id": 445, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "1766:48:7", + "subExpression": { + "arguments": [ + { + "id": 439, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 429, + "src": "1785:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + { + "id": 440, + "name": "from", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 431, + "src": "1792:4:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 441, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 433, + "src": "1798:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 442, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 435, + "src": "1802:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "74727565", + "id": 443, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1809:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 438, + "name": "_safeTransferFrom", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 807, + "src": "1767:17:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_address_$_t_uint256_$_t_bool_$returns$_t_bool_$", + "typeString": "function (contract IERC20,address,address,uint256,bool) returns (bool)" + } + }, + "id": 444, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1767:47:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 454, + "nodeType": "IfStatement", + "src": "1762:126:7", + "trueBody": { + "id": 453, + "nodeType": "Block", + "src": "1816:72:7", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "id": 449, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 429, + "src": "1870:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + ], + "id": 448, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1862:7:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 447, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1862:7:7", + "typeDescriptions": {} + } + }, + "id": 450, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1862:14:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 446, + "name": "SafeERC20FailedOperation", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 388, + "src": "1837:24:7", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 451, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1837:40:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 452, + "nodeType": "RevertStatement", + "src": "1830:47:7" + } + ] + } + } + ] + }, + "documentation": { + "id": 426, + "nodeType": "StructuredDocumentation", + "src": "1429:228:7", + "text": " @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n calling contract. If `token` returns no value, non-reverting calls are assumed to be successful." + }, + "id": 456, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "safeTransferFrom", + "nameLocation": "1671:16:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 436, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 429, + "mutability": "mutable", + "name": "token", + "nameLocation": "1695:5:7", + "nodeType": "VariableDeclaration", + "scope": 456, + "src": "1688:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 428, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 427, + "name": "IERC20", + "nameLocations": [ + "1688:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "1688:6:7" + }, + "referencedDeclaration": 340, + "src": "1688:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 431, + "mutability": "mutable", + "name": "from", + "nameLocation": "1710:4:7", + "nodeType": "VariableDeclaration", + "scope": 456, + "src": "1702:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 430, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1702:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 433, + "mutability": "mutable", + "name": "to", + "nameLocation": "1724:2:7", + "nodeType": "VariableDeclaration", + "scope": 456, + "src": "1716:10:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 432, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1716:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 435, + "mutability": "mutable", + "name": "value", + "nameLocation": "1736:5:7", + "nodeType": "VariableDeclaration", + "scope": 456, + "src": "1728:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 434, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1728:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1687:55:7" + }, + "returnParameters": { + "id": 437, + "nodeType": "ParameterList", + "parameters": [], + "src": "1752:0:7" + }, + "scope": 831, + "src": "1662:232:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 476, + "nodeType": "Block", + "src": "2121:62:7", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 470, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 460, + "src": "2152:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + { + "id": 471, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 462, + "src": "2159:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 472, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 464, + "src": "2163:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "66616c7365", + "id": 473, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2170:5:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 469, + "name": "_safeTransfer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 782, + "src": "2138:13:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$_t_bool_$returns$_t_bool_$", + "typeString": "function (contract IERC20,address,uint256,bool) returns (bool)" + } + }, + "id": 474, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2138:38:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 468, + "id": 475, + "nodeType": "Return", + "src": "2131:45:7" + } + ] + }, + "documentation": { + "id": 457, + "nodeType": "StructuredDocumentation", + "src": "1900:126:7", + "text": " @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful." + }, + "id": 477, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "trySafeTransfer", + "nameLocation": "2040:15:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 465, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 460, + "mutability": "mutable", + "name": "token", + "nameLocation": "2063:5:7", + "nodeType": "VariableDeclaration", + "scope": 477, + "src": "2056:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 459, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 458, + "name": "IERC20", + "nameLocations": [ + "2056:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "2056:6:7" + }, + "referencedDeclaration": 340, + "src": "2056:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 462, + "mutability": "mutable", + "name": "to", + "nameLocation": "2078:2:7", + "nodeType": "VariableDeclaration", + "scope": 477, + "src": "2070:10:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 461, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2070:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 464, + "mutability": "mutable", + "name": "value", + "nameLocation": "2090:5:7", + "nodeType": "VariableDeclaration", + "scope": 477, + "src": "2082:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 463, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2082:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2055:41:7" + }, + "returnParameters": { + "id": 468, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 467, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 477, + "src": "2115:4:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 466, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "2115:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "2114:6:7" + }, + "scope": 831, + "src": "2031:152:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 500, + "nodeType": "Block", + "src": "2432:72:7", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 493, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 481, + "src": "2467:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + { + "id": 494, + "name": "from", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 483, + "src": "2474:4:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 495, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 485, + "src": "2480:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 496, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 487, + "src": "2484:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "66616c7365", + "id": 497, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2491:5:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 492, + "name": "_safeTransferFrom", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 807, + "src": "2449:17:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_address_$_t_uint256_$_t_bool_$returns$_t_bool_$", + "typeString": "function (contract IERC20,address,address,uint256,bool) returns (bool)" + } + }, + "id": 498, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2449:48:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 491, + "id": 499, + "nodeType": "Return", + "src": "2442:55:7" + } + ] + }, + "documentation": { + "id": 478, + "nodeType": "StructuredDocumentation", + "src": "2189:130:7", + "text": " @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful." + }, + "id": 501, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "trySafeTransferFrom", + "nameLocation": "2333:19:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 488, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 481, + "mutability": "mutable", + "name": "token", + "nameLocation": "2360:5:7", + "nodeType": "VariableDeclaration", + "scope": 501, + "src": "2353:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 480, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 479, + "name": "IERC20", + "nameLocations": [ + "2353:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "2353:6:7" + }, + "referencedDeclaration": 340, + "src": "2353:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 483, + "mutability": "mutable", + "name": "from", + "nameLocation": "2375:4:7", + "nodeType": "VariableDeclaration", + "scope": 501, + "src": "2367:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 482, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2367:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 485, + "mutability": "mutable", + "name": "to", + "nameLocation": "2389:2:7", + "nodeType": "VariableDeclaration", + "scope": 501, + "src": "2381:10:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 484, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2381:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 487, + "mutability": "mutable", + "name": "value", + "nameLocation": "2401:5:7", + "nodeType": "VariableDeclaration", + "scope": 501, + "src": "2393:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 486, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2393:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2352:55:7" + }, + "returnParameters": { + "id": 491, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 490, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 501, + "src": "2426:4:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 489, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "2426:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "2425:6:7" + }, + "scope": 831, + "src": "2324:180:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 531, + "nodeType": "Block", + "src": "3246:139:7", + "statements": [ + { + "assignments": [ + 513 + ], + "declarations": [ + { + "constant": false, + "id": 513, + "mutability": "mutable", + "name": "oldAllowance", + "nameLocation": "3264:12:7", + "nodeType": "VariableDeclaration", + "scope": 531, + "src": "3256:20:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 512, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3256:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 522, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "id": 518, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "3303:4:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_SafeERC20_$831", + "typeString": "library SafeERC20" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_SafeERC20_$831", + "typeString": "library SafeERC20" + } + ], + "id": 517, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3295:7:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 516, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3295:7:7", + "typeDescriptions": {} + } + }, + "id": 519, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3295:13:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 520, + "name": "spender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 507, + "src": "3310:7:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "expression": { + "id": 514, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 505, + "src": "3279:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "id": 515, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3285:9:7", + "memberName": "allowance", + "nodeType": "MemberAccess", + "referencedDeclaration": 317, + "src": "3279:15:7", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_address_$_t_address_$returns$_t_uint256_$", + "typeString": "function (address,address) view external returns (uint256)" + } + }, + "id": 521, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3279:39:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3256:62:7" + }, + { + "expression": { + "arguments": [ + { + "id": 524, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 505, + "src": "3341:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + { + "id": 525, + "name": "spender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 507, + "src": "3348:7:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 528, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 526, + "name": "oldAllowance", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 513, + "src": "3357:12:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "id": 527, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 509, + "src": "3372:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3357:20:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 523, + "name": "forceApprove", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 626, + "src": "3328:12:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$returns$__$", + "typeString": "function (contract IERC20,address,uint256)" + } + }, + "id": 529, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3328:50:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 530, + "nodeType": "ExpressionStatement", + "src": "3328:50:7" + } + ] + }, + "documentation": { + "id": 502, + "nodeType": "StructuredDocumentation", + "src": "2510:645:7", + "text": " @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n non-reverting calls are assumed to be successful.\n IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the \"client\"\n smart contract uses ERC-7674 to set temporary allowances, then the \"client\" smart contract should avoid using\n this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract\n that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior." + }, + "id": 532, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "safeIncreaseAllowance", + "nameLocation": "3169:21:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 510, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 505, + "mutability": "mutable", + "name": "token", + "nameLocation": "3198:5:7", + "nodeType": "VariableDeclaration", + "scope": 532, + "src": "3191:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 504, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 503, + "name": "IERC20", + "nameLocations": [ + "3191:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "3191:6:7" + }, + "referencedDeclaration": 340, + "src": "3191:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 507, + "mutability": "mutable", + "name": "spender", + "nameLocation": "3213:7:7", + "nodeType": "VariableDeclaration", + "scope": 532, + "src": "3205:15:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 506, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3205:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 509, + "mutability": "mutable", + "name": "value", + "nameLocation": "3230:5:7", + "nodeType": "VariableDeclaration", + "scope": 532, + "src": "3222:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 508, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3222:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3190:46:7" + }, + "returnParameters": { + "id": 511, + "nodeType": "ParameterList", + "parameters": [], + "src": "3246:0:7" + }, + "scope": 831, + "src": "3160:225:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 574, + "nodeType": "Block", + "src": "4151:370:7", + "statements": [ + { + "id": 573, + "nodeType": "UncheckedBlock", + "src": "4161:354:7", + "statements": [ + { + "assignments": [ + 544 + ], + "declarations": [ + { + "constant": false, + "id": 544, + "mutability": "mutable", + "name": "currentAllowance", + "nameLocation": "4193:16:7", + "nodeType": "VariableDeclaration", + "scope": 573, + "src": "4185:24:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 543, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4185:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 553, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "id": 549, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "4236:4:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_SafeERC20_$831", + "typeString": "library SafeERC20" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_SafeERC20_$831", + "typeString": "library SafeERC20" + } + ], + "id": 548, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4228:7:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 547, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "4228:7:7", + "typeDescriptions": {} + } + }, + "id": 550, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4228:13:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 551, + "name": "spender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 538, + "src": "4243:7:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "expression": { + "id": 545, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 536, + "src": "4212:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "id": 546, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4218:9:7", + "memberName": "allowance", + "nodeType": "MemberAccess", + "referencedDeclaration": 317, + "src": "4212:15:7", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_address_$_t_address_$returns$_t_uint256_$", + "typeString": "function (address,address) view external returns (uint256)" + } + }, + "id": 552, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4212:39:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4185:66:7" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 556, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 554, + "name": "currentAllowance", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 544, + "src": "4269:16:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 555, + "name": "requestedDecrease", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 540, + "src": "4288:17:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4269:36:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 564, + "nodeType": "IfStatement", + "src": "4265:160:7", + "trueBody": { + "id": 563, + "nodeType": "Block", + "src": "4307:118:7", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "id": 558, + "name": "spender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 538, + "src": "4365:7:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 559, + "name": "currentAllowance", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 544, + "src": "4374:16:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 560, + "name": "requestedDecrease", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 540, + "src": "4392:17:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 557, + "name": "SafeERC20FailedDecreaseAllowance", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 397, + "src": "4332:32:7", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$_t_uint256_$_t_uint256_$returns$_t_error_$", + "typeString": "function (address,uint256,uint256) pure returns (error)" + } + }, + "id": 561, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4332:78:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 562, + "nodeType": "RevertStatement", + "src": "4325:85:7" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 566, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 536, + "src": "4451:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + { + "id": 567, + "name": "spender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 538, + "src": "4458:7:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 570, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 568, + "name": "currentAllowance", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 544, + "src": "4467:16:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "id": 569, + "name": "requestedDecrease", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 540, + "src": "4486:17:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4467:36:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 565, + "name": "forceApprove", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 626, + "src": "4438:12:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$returns$__$", + "typeString": "function (contract IERC20,address,uint256)" + } + }, + "id": 571, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4438:66:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 572, + "nodeType": "ExpressionStatement", + "src": "4438:66:7" + } + ] + } + ] + }, + "documentation": { + "id": 533, + "nodeType": "StructuredDocumentation", + "src": "3391:657:7", + "text": " @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no\n value, non-reverting calls are assumed to be successful.\n IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the \"client\"\n smart contract uses ERC-7674 to set temporary allowances, then the \"client\" smart contract should avoid using\n this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract\n that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior." + }, + "id": 575, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "safeDecreaseAllowance", + "nameLocation": "4062:21:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 541, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 536, + "mutability": "mutable", + "name": "token", + "nameLocation": "4091:5:7", + "nodeType": "VariableDeclaration", + "scope": 575, + "src": "4084:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 535, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 534, + "name": "IERC20", + "nameLocations": [ + "4084:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "4084:6:7" + }, + "referencedDeclaration": 340, + "src": "4084:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 538, + "mutability": "mutable", + "name": "spender", + "nameLocation": "4106:7:7", + "nodeType": "VariableDeclaration", + "scope": 575, + "src": "4098:15:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 537, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "4098:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 540, + "mutability": "mutable", + "name": "requestedDecrease", + "nameLocation": "4123:17:7", + "nodeType": "VariableDeclaration", + "scope": 575, + "src": "4115:25:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 539, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4115:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4083:58:7" + }, + "returnParameters": { + "id": 542, + "nodeType": "ParameterList", + "parameters": [], + "src": "4151:0:7" + }, + "scope": 831, + "src": "4053:468:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 625, + "nodeType": "Block", + "src": "5175:290:7", + "statements": [ + { + "condition": { + "id": 592, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "5189:43:7", + "subExpression": { + "arguments": [ + { + "id": 587, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 579, + "src": "5203:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + { + "id": 588, + "name": "spender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 581, + "src": "5210:7:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 589, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 583, + "src": "5219:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "66616c7365", + "id": 590, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5226:5:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 586, + "name": "_safeApprove", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 830, + "src": "5190:12:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$_t_bool_$returns$_t_bool_$", + "typeString": "function (contract IERC20,address,uint256,bool) returns (bool)" + } + }, + "id": 591, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5190:42:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 624, + "nodeType": "IfStatement", + "src": "5185:274:7", + "trueBody": { + "id": 623, + "nodeType": "Block", + "src": "5234:225:7", + "statements": [ + { + "condition": { + "id": 599, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "5252:38:7", + "subExpression": { + "arguments": [ + { + "id": 594, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 579, + "src": "5266:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + { + "id": 595, + "name": "spender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 581, + "src": "5273:7:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "hexValue": "30", + "id": 596, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5282:1:7", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "hexValue": "74727565", + "id": 597, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5285:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 593, + "name": "_safeApprove", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 830, + "src": "5253:12:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$_t_bool_$returns$_t_bool_$", + "typeString": "function (contract IERC20,address,uint256,bool) returns (bool)" + } + }, + "id": 598, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5253:37:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 607, + "nodeType": "IfStatement", + "src": "5248:91:7", + "trueBody": { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "id": 603, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 579, + "src": "5332:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + ], + "id": 602, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5324:7:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 601, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5324:7:7", + "typeDescriptions": {} + } + }, + "id": 604, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5324:14:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 600, + "name": "SafeERC20FailedOperation", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 388, + "src": "5299:24:7", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 605, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5299:40:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 606, + "nodeType": "RevertStatement", + "src": "5292:47:7" + } + }, + { + "condition": { + "id": 614, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "5357:42:7", + "subExpression": { + "arguments": [ + { + "id": 609, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 579, + "src": "5371:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + { + "id": 610, + "name": "spender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 581, + "src": "5378:7:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 611, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 583, + "src": "5387:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "74727565", + "id": 612, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5394:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 608, + "name": "_safeApprove", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 830, + "src": "5358:12:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$_t_bool_$returns$_t_bool_$", + "typeString": "function (contract IERC20,address,uint256,bool) returns (bool)" + } + }, + "id": 613, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5358:41:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 622, + "nodeType": "IfStatement", + "src": "5353:95:7", + "trueBody": { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "id": 618, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 579, + "src": "5441:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + ], + "id": 617, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5433:7:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 616, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5433:7:7", + "typeDescriptions": {} + } + }, + "id": 619, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5433:14:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 615, + "name": "SafeERC20FailedOperation", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 388, + "src": "5408:24:7", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 620, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5408:40:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 621, + "nodeType": "RevertStatement", + "src": "5401:47:7" + } + } + ] + } + } + ] + }, + "documentation": { + "id": 576, + "nodeType": "StructuredDocumentation", + "src": "4527:566:7", + "text": " @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n to be set to zero before setting it to a non-zero value, such as USDT.\n NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function\n only sets the \"standard\" allowance. Any temporary allowance will remain active, in addition to the value being\n set here." + }, + "id": 626, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "forceApprove", + "nameLocation": "5107:12:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 584, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 579, + "mutability": "mutable", + "name": "token", + "nameLocation": "5127:5:7", + "nodeType": "VariableDeclaration", + "scope": 626, + "src": "5120:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 578, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 577, + "name": "IERC20", + "nameLocations": [ + "5120:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "5120:6:7" + }, + "referencedDeclaration": 340, + "src": "5120:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 581, + "mutability": "mutable", + "name": "spender", + "nameLocation": "5142:7:7", + "nodeType": "VariableDeclaration", + "scope": 626, + "src": "5134:15:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 580, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5134:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 583, + "mutability": "mutable", + "name": "value", + "nameLocation": "5159:5:7", + "nodeType": "VariableDeclaration", + "scope": 626, + "src": "5151:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 582, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5151:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5119:46:7" + }, + "returnParameters": { + "id": 585, + "nodeType": "ParameterList", + "parameters": [], + "src": "5175:0:7" + }, + "scope": 831, + "src": "5098:367:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 668, + "nodeType": "Block", + "src": "5914:219:7", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 643, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "expression": { + "id": 639, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 632, + "src": "5928:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 640, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5931:4:7", + "memberName": "code", + "nodeType": "MemberAccess", + "src": "5928:7:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 641, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5936:6:7", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "5928:14:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 642, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5946:1:7", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "5928:19:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "id": 657, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "6014:39:7", + "subExpression": { + "arguments": [ + { + "id": 653, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 632, + "src": "6037:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 654, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 634, + "src": "6041:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 655, + "name": "data", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 636, + "src": "6048:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "id": 651, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 630, + "src": "6015:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + }, + "id": 652, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6021:15:7", + "memberName": "transferAndCall", + "nodeType": "MemberAccess", + "referencedDeclaration": 180, + "src": "6015:21:7", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_uint256_$_t_bytes_memory_ptr_$returns$_t_bool_$", + "typeString": "function (address,uint256,bytes memory) external returns (bool)" + } + }, + "id": 656, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6015:38:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 666, + "nodeType": "IfStatement", + "src": "6010:117:7", + "trueBody": { + "id": 665, + "nodeType": "Block", + "src": "6055:72:7", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "id": 661, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 630, + "src": "6109:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + ], + "id": 660, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6101:7:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 659, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6101:7:7", + "typeDescriptions": {} + } + }, + "id": 662, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6101:14:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 658, + "name": "SafeERC20FailedOperation", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 388, + "src": "6076:24:7", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 663, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6076:40:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 664, + "nodeType": "RevertStatement", + "src": "6069:47:7" + } + ] + } + }, + "id": 667, + "nodeType": "IfStatement", + "src": "5924:203:7", + "trueBody": { + "id": 650, + "nodeType": "Block", + "src": "5949:55:7", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 645, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 630, + "src": "5976:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + }, + { + "id": 646, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 632, + "src": "5983:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 647, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 634, + "src": "5987:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 644, + "name": "safeTransfer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 425, + "src": "5963:12:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$returns$__$", + "typeString": "function (contract IERC20,address,uint256)" + } + }, + "id": 648, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5963:30:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 649, + "nodeType": "ExpressionStatement", + "src": "5963:30:7" + } + ] + } + } + ] + }, + "documentation": { + "id": 627, + "nodeType": "StructuredDocumentation", + "src": "5471:335:7", + "text": " @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no\n code. This can be used to implement an {ERC721}-like safe transfer that relies on {ERC1363} checks when\n targeting contracts.\n Reverts if the returned value is other than `true`." + }, + "id": 669, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "transferAndCallRelaxed", + "nameLocation": "5820:22:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 637, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 630, + "mutability": "mutable", + "name": "token", + "nameLocation": "5852:5:7", + "nodeType": "VariableDeclaration", + "scope": 669, + "src": "5843:14:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + }, + "typeName": { + "id": 629, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 628, + "name": "IERC1363", + "nameLocations": [ + "5843:8:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 229, + "src": "5843:8:7" + }, + "referencedDeclaration": 229, + "src": "5843:8:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 632, + "mutability": "mutable", + "name": "to", + "nameLocation": "5867:2:7", + "nodeType": "VariableDeclaration", + "scope": 669, + "src": "5859:10:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 631, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5859:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 634, + "mutability": "mutable", + "name": "value", + "nameLocation": "5879:5:7", + "nodeType": "VariableDeclaration", + "scope": 669, + "src": "5871:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 633, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5871:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 636, + "mutability": "mutable", + "name": "data", + "nameLocation": "5899:4:7", + "nodeType": "VariableDeclaration", + "scope": 669, + "src": "5886:17:7", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 635, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5886:5:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "5842:62:7" + }, + "returnParameters": { + "id": 638, + "nodeType": "ParameterList", + "parameters": [], + "src": "5914:0:7" + }, + "scope": 831, + "src": "5811:322:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 715, + "nodeType": "Block", + "src": "6654:239:7", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 688, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "expression": { + "id": 684, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 677, + "src": "6668:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 685, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6671:4:7", + "memberName": "code", + "nodeType": "MemberAccess", + "src": "6668:7:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 686, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6676:6:7", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "6668:14:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 687, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6686:1:7", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "6668:19:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "id": 704, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "6764:49:7", + "subExpression": { + "arguments": [ + { + "id": 699, + "name": "from", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 675, + "src": "6791:4:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 700, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 677, + "src": "6797:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 701, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 679, + "src": "6801:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 702, + "name": "data", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 681, + "src": "6808:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "id": 697, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 673, + "src": "6765:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + }, + "id": 698, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6771:19:7", + "memberName": "transferFromAndCall", + "nodeType": "MemberAccess", + "referencedDeclaration": 206, + "src": "6765:25:7", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_address_$_t_uint256_$_t_bytes_memory_ptr_$returns$_t_bool_$", + "typeString": "function (address,address,uint256,bytes memory) external returns (bool)" + } + }, + "id": 703, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6765:48:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 713, + "nodeType": "IfStatement", + "src": "6760:127:7", + "trueBody": { + "id": 712, + "nodeType": "Block", + "src": "6815:72:7", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "id": 708, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 673, + "src": "6869:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + ], + "id": 707, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6861:7:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 706, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6861:7:7", + "typeDescriptions": {} + } + }, + "id": 709, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6861:14:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 705, + "name": "SafeERC20FailedOperation", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 388, + "src": "6836:24:7", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 710, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6836:40:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 711, + "nodeType": "RevertStatement", + "src": "6829:47:7" + } + ] + } + }, + "id": 714, + "nodeType": "IfStatement", + "src": "6664:223:7", + "trueBody": { + "id": 696, + "nodeType": "Block", + "src": "6689:65:7", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 690, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 673, + "src": "6720:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + }, + { + "id": 691, + "name": "from", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 675, + "src": "6727:4:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 692, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 677, + "src": "6733:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 693, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 679, + "src": "6737:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 689, + "name": "safeTransferFrom", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 456, + "src": "6703:16:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_address_$_t_uint256_$returns$__$", + "typeString": "function (contract IERC20,address,address,uint256)" + } + }, + "id": 694, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6703:40:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 695, + "nodeType": "ExpressionStatement", + "src": "6703:40:7" + } + ] + } + } + ] + }, + "documentation": { + "id": 670, + "nodeType": "StructuredDocumentation", + "src": "6139:343:7", + "text": " @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target\n has no code. This can be used to implement an {ERC721}-like safe transfer that relies on {ERC1363} checks when\n targeting contracts.\n Reverts if the returned value is other than `true`." + }, + "id": 716, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "transferFromAndCallRelaxed", + "nameLocation": "6496:26:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 682, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 673, + "mutability": "mutable", + "name": "token", + "nameLocation": "6541:5:7", + "nodeType": "VariableDeclaration", + "scope": 716, + "src": "6532:14:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + }, + "typeName": { + "id": 672, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 671, + "name": "IERC1363", + "nameLocations": [ + "6532:8:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 229, + "src": "6532:8:7" + }, + "referencedDeclaration": 229, + "src": "6532:8:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 675, + "mutability": "mutable", + "name": "from", + "nameLocation": "6564:4:7", + "nodeType": "VariableDeclaration", + "scope": 716, + "src": "6556:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 674, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6556:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 677, + "mutability": "mutable", + "name": "to", + "nameLocation": "6586:2:7", + "nodeType": "VariableDeclaration", + "scope": 716, + "src": "6578:10:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 676, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6578:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 679, + "mutability": "mutable", + "name": "value", + "nameLocation": "6606:5:7", + "nodeType": "VariableDeclaration", + "scope": 716, + "src": "6598:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 678, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6598:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 681, + "mutability": "mutable", + "name": "data", + "nameLocation": "6634:4:7", + "nodeType": "VariableDeclaration", + "scope": 716, + "src": "6621:17:7", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 680, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "6621:5:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "6522:122:7" + }, + "returnParameters": { + "id": 683, + "nodeType": "ParameterList", + "parameters": [], + "src": "6654:0:7" + }, + "scope": 831, + "src": "6487:406:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 758, + "nodeType": "Block", + "src": "7661:218:7", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 733, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "expression": { + "id": 729, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 722, + "src": "7675:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 730, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7678:4:7", + "memberName": "code", + "nodeType": "MemberAccess", + "src": "7675:7:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 731, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7683:6:7", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "7675:14:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 732, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7693:1:7", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "7675:19:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "id": 747, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "7761:38:7", + "subExpression": { + "arguments": [ + { + "id": 743, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 722, + "src": "7783:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 744, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 724, + "src": "7787:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 745, + "name": "data", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 726, + "src": "7794:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "id": 741, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 720, + "src": "7762:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + }, + "id": 742, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7768:14:7", + "memberName": "approveAndCall", + "nodeType": "MemberAccess", + "referencedDeclaration": 228, + "src": "7762:20:7", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_uint256_$_t_bytes_memory_ptr_$returns$_t_bool_$", + "typeString": "function (address,uint256,bytes memory) external returns (bool)" + } + }, + "id": 746, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7762:37:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 756, + "nodeType": "IfStatement", + "src": "7757:116:7", + "trueBody": { + "id": 755, + "nodeType": "Block", + "src": "7801:72:7", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "id": 751, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 720, + "src": "7855:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + ], + "id": 750, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "7847:7:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 749, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "7847:7:7", + "typeDescriptions": {} + } + }, + "id": 752, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7847:14:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 748, + "name": "SafeERC20FailedOperation", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 388, + "src": "7822:24:7", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 753, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7822:40:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 754, + "nodeType": "RevertStatement", + "src": "7815:47:7" + } + ] + } + }, + "id": 757, + "nodeType": "IfStatement", + "src": "7671:202:7", + "trueBody": { + "id": 740, + "nodeType": "Block", + "src": "7696:55:7", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 735, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 720, + "src": "7723:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + }, + { + "id": 736, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 722, + "src": "7730:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 737, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 724, + "src": "7734:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 734, + "name": "forceApprove", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 626, + "src": "7710:12:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$returns$__$", + "typeString": "function (contract IERC20,address,uint256)" + } + }, + "id": 738, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7710:30:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 739, + "nodeType": "ExpressionStatement", + "src": "7710:30:7" + } + ] + } + } + ] + }, + "documentation": { + "id": 717, + "nodeType": "StructuredDocumentation", + "src": "6899:655:7", + "text": " @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no\n code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\n targeting contracts.\n NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.\n Oppositely, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}\n once without retrying, and relies on the returned value to be true.\n Reverts if the returned value is other than `true`." + }, + "id": 759, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "approveAndCallRelaxed", + "nameLocation": "7568:21:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 727, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 720, + "mutability": "mutable", + "name": "token", + "nameLocation": "7599:5:7", + "nodeType": "VariableDeclaration", + "scope": 759, + "src": "7590:14:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + }, + "typeName": { + "id": 719, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 718, + "name": "IERC1363", + "nameLocations": [ + "7590:8:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 229, + "src": "7590:8:7" + }, + "referencedDeclaration": 229, + "src": "7590:8:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 722, + "mutability": "mutable", + "name": "to", + "nameLocation": "7614:2:7", + "nodeType": "VariableDeclaration", + "scope": 759, + "src": "7606:10:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 721, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "7606:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 724, + "mutability": "mutable", + "name": "value", + "nameLocation": "7626:5:7", + "nodeType": "VariableDeclaration", + "scope": 759, + "src": "7618:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 723, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7618:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 726, + "mutability": "mutable", + "name": "data", + "nameLocation": "7646:4:7", + "nodeType": "VariableDeclaration", + "scope": 759, + "src": "7633:17:7", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 725, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "7633:5:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "7589:62:7" + }, + "returnParameters": { + "id": 728, + "nodeType": "ParameterList", + "parameters": [], + "src": "7661:0:7" + }, + "scope": 831, + "src": "7559:320:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 781, + "nodeType": "Block", + "src": "8481:1136:7", + "statements": [ + { + "assignments": [ + 775 + ], + "declarations": [ + { + "constant": false, + "id": 775, + "mutability": "mutable", + "name": "selector", + "nameLocation": "8498:8:7", + "nodeType": "VariableDeclaration", + "scope": 781, + "src": "8491:15:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "typeName": { + "id": 774, + "name": "bytes4", + "nodeType": "ElementaryTypeName", + "src": "8491:6:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "visibility": "internal" + } + ], + "id": 779, + "initialValue": { + "expression": { + "expression": { + "id": 776, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "8509:6:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$340_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 777, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "8516:8:7", + "memberName": "transfer", + "nodeType": "MemberAccess", + "referencedDeclaration": 307, + "src": "8509:15:7", + "typeDescriptions": { + "typeIdentifier": "t_function_declaration_nonpayable$_t_address_$_t_uint256_$returns$_t_bool_$", + "typeString": "function IERC20.transfer(address,uint256) returns (bool)" + } + }, + "id": 778, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "8525:8:7", + "memberName": "selector", + "nodeType": "MemberAccess", + "src": "8509:24:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8491:42:7" + }, + { + "AST": { + "nativeSrc": "8569:1042:7", + "nodeType": "YulBlock", + "src": "8569:1042:7", + "statements": [ + { + "nativeSrc": "8583:22:7", + "nodeType": "YulVariableDeclaration", + "src": "8583:22:7", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "8600:4:7", + "nodeType": "YulLiteral", + "src": "8600:4:7", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "8594:5:7", + "nodeType": "YulIdentifier", + "src": "8594:5:7" + }, + "nativeSrc": "8594:11:7", + "nodeType": "YulFunctionCall", + "src": "8594:11:7" + }, + "variables": [ + { + "name": "fmp", + "nativeSrc": "8587:3:7", + "nodeType": "YulTypedName", + "src": "8587:3:7", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "8625:4:7", + "nodeType": "YulLiteral", + "src": "8625:4:7", + "type": "", + "value": "0x00" + }, + { + "name": "selector", + "nativeSrc": "8631:8:7", + "nodeType": "YulIdentifier", + "src": "8631:8:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8618:6:7", + "nodeType": "YulIdentifier", + "src": "8618:6:7" + }, + "nativeSrc": "8618:22:7", + "nodeType": "YulFunctionCall", + "src": "8618:22:7" + }, + "nativeSrc": "8618:22:7", + "nodeType": "YulExpressionStatement", + "src": "8618:22:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "8660:4:7", + "nodeType": "YulLiteral", + "src": "8660:4:7", + "type": "", + "value": "0x04" + }, + { + "arguments": [ + { + "name": "to", + "nativeSrc": "8670:2:7", + "nodeType": "YulIdentifier", + "src": "8670:2:7" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "8678:2:7", + "nodeType": "YulLiteral", + "src": "8678:2:7", + "type": "", + "value": "96" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "8686:1:7", + "nodeType": "YulLiteral", + "src": "8686:1:7", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "8682:3:7", + "nodeType": "YulIdentifier", + "src": "8682:3:7" + }, + "nativeSrc": "8682:6:7", + "nodeType": "YulFunctionCall", + "src": "8682:6:7" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "8674:3:7", + "nodeType": "YulIdentifier", + "src": "8674:3:7" + }, + "nativeSrc": "8674:15:7", + "nodeType": "YulFunctionCall", + "src": "8674:15:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "8666:3:7", + "nodeType": "YulIdentifier", + "src": "8666:3:7" + }, + "nativeSrc": "8666:24:7", + "nodeType": "YulFunctionCall", + "src": "8666:24:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8653:6:7", + "nodeType": "YulIdentifier", + "src": "8653:6:7" + }, + "nativeSrc": "8653:38:7", + "nodeType": "YulFunctionCall", + "src": "8653:38:7" + }, + "nativeSrc": "8653:38:7", + "nodeType": "YulExpressionStatement", + "src": "8653:38:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "8711:4:7", + "nodeType": "YulLiteral", + "src": "8711:4:7", + "type": "", + "value": "0x24" + }, + { + "name": "value", + "nativeSrc": "8717:5:7", + "nodeType": "YulIdentifier", + "src": "8717:5:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8704:6:7", + "nodeType": "YulIdentifier", + "src": "8704:6:7" + }, + "nativeSrc": "8704:19:7", + "nodeType": "YulFunctionCall", + "src": "8704:19:7" + }, + "nativeSrc": "8704:19:7", + "nodeType": "YulExpressionStatement", + "src": "8704:19:7" + }, + { + "nativeSrc": "8736:56:7", + "nodeType": "YulAssignment", + "src": "8736:56:7", + "value": { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "gas", + "nativeSrc": "8752:3:7", + "nodeType": "YulIdentifier", + "src": "8752:3:7" + }, + "nativeSrc": "8752:5:7", + "nodeType": "YulFunctionCall", + "src": "8752:5:7" + }, + { + "name": "token", + "nativeSrc": "8759:5:7", + "nodeType": "YulIdentifier", + "src": "8759:5:7" + }, + { + "kind": "number", + "nativeSrc": "8766:1:7", + "nodeType": "YulLiteral", + "src": "8766:1:7", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "8769:4:7", + "nodeType": "YulLiteral", + "src": "8769:4:7", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "8775:4:7", + "nodeType": "YulLiteral", + "src": "8775:4:7", + "type": "", + "value": "0x44" + }, + { + "kind": "number", + "nativeSrc": "8781:4:7", + "nodeType": "YulLiteral", + "src": "8781:4:7", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "8787:4:7", + "nodeType": "YulLiteral", + "src": "8787:4:7", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "call", + "nativeSrc": "8747:4:7", + "nodeType": "YulIdentifier", + "src": "8747:4:7" + }, + "nativeSrc": "8747:45:7", + "nodeType": "YulFunctionCall", + "src": "8747:45:7" + }, + "variableNames": [ + { + "name": "success", + "nativeSrc": "8736:7:7", + "nodeType": "YulIdentifier", + "src": "8736:7:7" + } + ] + }, + { + "body": { + "nativeSrc": "9009:562:7", + "nodeType": "YulBlock", + "src": "9009:562:7", + "statements": [ + { + "body": { + "nativeSrc": "9144:133:7", + "nodeType": "YulBlock", + "src": "9144:133:7", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "9181:3:7", + "nodeType": "YulIdentifier", + "src": "9181:3:7" + }, + { + "kind": "number", + "nativeSrc": "9186:4:7", + "nodeType": "YulLiteral", + "src": "9186:4:7", + "type": "", + "value": "0x00" + }, + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nativeSrc": "9192:14:7", + "nodeType": "YulIdentifier", + "src": "9192:14:7" + }, + "nativeSrc": "9192:16:7", + "nodeType": "YulFunctionCall", + "src": "9192:16:7" + } + ], + "functionName": { + "name": "returndatacopy", + "nativeSrc": "9166:14:7", + "nodeType": "YulIdentifier", + "src": "9166:14:7" + }, + "nativeSrc": "9166:43:7", + "nodeType": "YulFunctionCall", + "src": "9166:43:7" + }, + "nativeSrc": "9166:43:7", + "nodeType": "YulExpressionStatement", + "src": "9166:43:7" + }, + { + "expression": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "9237:3:7", + "nodeType": "YulIdentifier", + "src": "9237:3:7" + }, + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nativeSrc": "9242:14:7", + "nodeType": "YulIdentifier", + "src": "9242:14:7" + }, + "nativeSrc": "9242:16:7", + "nodeType": "YulFunctionCall", + "src": "9242:16:7" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "9230:6:7", + "nodeType": "YulIdentifier", + "src": "9230:6:7" + }, + "nativeSrc": "9230:29:7", + "nodeType": "YulFunctionCall", + "src": "9230:29:7" + }, + "nativeSrc": "9230:29:7", + "nodeType": "YulExpressionStatement", + "src": "9230:29:7" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "success", + "nativeSrc": "9126:7:7", + "nodeType": "YulIdentifier", + "src": "9126:7:7" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "9119:6:7", + "nodeType": "YulIdentifier", + "src": "9119:6:7" + }, + "nativeSrc": "9119:15:7", + "nodeType": "YulFunctionCall", + "src": "9119:15:7" + }, + { + "name": "bubble", + "nativeSrc": "9136:6:7", + "nodeType": "YulIdentifier", + "src": "9136:6:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "9115:3:7", + "nodeType": "YulIdentifier", + "src": "9115:3:7" + }, + "nativeSrc": "9115:28:7", + "nodeType": "YulFunctionCall", + "src": "9115:28:7" + }, + "nativeSrc": "9112:165:7", + "nodeType": "YulIf", + "src": "9112:165:7" + }, + { + "nativeSrc": "9476:81:7", + "nodeType": "YulAssignment", + "src": "9476:81:7", + "value": { + "arguments": [ + { + "name": "success", + "nativeSrc": "9491:7:7", + "nodeType": "YulIdentifier", + "src": "9491:7:7" + }, + { + "arguments": [ + { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nativeSrc": "9511:14:7", + "nodeType": "YulIdentifier", + "src": "9511:14:7" + }, + "nativeSrc": "9511:16:7", + "nodeType": "YulFunctionCall", + "src": "9511:16:7" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "9504:6:7", + "nodeType": "YulIdentifier", + "src": "9504:6:7" + }, + "nativeSrc": "9504:24:7", + "nodeType": "YulFunctionCall", + "src": "9504:24:7" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "token", + "nativeSrc": "9545:5:7", + "nodeType": "YulIdentifier", + "src": "9545:5:7" + } + ], + "functionName": { + "name": "extcodesize", + "nativeSrc": "9533:11:7", + "nodeType": "YulIdentifier", + "src": "9533:11:7" + }, + "nativeSrc": "9533:18:7", + "nodeType": "YulFunctionCall", + "src": "9533:18:7" + }, + { + "kind": "number", + "nativeSrc": "9553:1:7", + "nodeType": "YulLiteral", + "src": "9553:1:7", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "gt", + "nativeSrc": "9530:2:7", + "nodeType": "YulIdentifier", + "src": "9530:2:7" + }, + "nativeSrc": "9530:25:7", + "nodeType": "YulFunctionCall", + "src": "9530:25:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "9500:3:7", + "nodeType": "YulIdentifier", + "src": "9500:3:7" + }, + "nativeSrc": "9500:56:7", + "nodeType": "YulFunctionCall", + "src": "9500:56:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "9487:3:7", + "nodeType": "YulIdentifier", + "src": "9487:3:7" + }, + "nativeSrc": "9487:70:7", + "nodeType": "YulFunctionCall", + "src": "9487:70:7" + }, + "variableNames": [ + { + "name": "success", + "nativeSrc": "9476:7:7", + "nodeType": "YulIdentifier", + "src": "9476:7:7" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "success", + "nativeSrc": "8979:7:7", + "nodeType": "YulIdentifier", + "src": "8979:7:7" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "8997:4:7", + "nodeType": "YulLiteral", + "src": "8997:4:7", + "type": "", + "value": "0x00" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "8991:5:7", + "nodeType": "YulIdentifier", + "src": "8991:5:7" + }, + "nativeSrc": "8991:11:7", + "nodeType": "YulFunctionCall", + "src": "8991:11:7" + }, + { + "kind": "number", + "nativeSrc": "9004:1:7", + "nodeType": "YulLiteral", + "src": "9004:1:7", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "eq", + "nativeSrc": "8988:2:7", + "nodeType": "YulIdentifier", + "src": "8988:2:7" + }, + "nativeSrc": "8988:18:7", + "nodeType": "YulFunctionCall", + "src": "8988:18:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "8975:3:7", + "nodeType": "YulIdentifier", + "src": "8975:3:7" + }, + "nativeSrc": "8975:32:7", + "nodeType": "YulFunctionCall", + "src": "8975:32:7" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "8968:6:7", + "nodeType": "YulIdentifier", + "src": "8968:6:7" + }, + "nativeSrc": "8968:40:7", + "nodeType": "YulFunctionCall", + "src": "8968:40:7" + }, + "nativeSrc": "8965:606:7", + "nodeType": "YulIf", + "src": "8965:606:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9591:4:7", + "nodeType": "YulLiteral", + "src": "9591:4:7", + "type": "", + "value": "0x40" + }, + { + "name": "fmp", + "nativeSrc": "9597:3:7", + "nodeType": "YulIdentifier", + "src": "9597:3:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "9584:6:7", + "nodeType": "YulIdentifier", + "src": "9584:6:7" + }, + "nativeSrc": "9584:17:7", + "nodeType": "YulFunctionCall", + "src": "9584:17:7" + }, + "nativeSrc": "9584:17:7", + "nodeType": "YulExpressionStatement", + "src": "9584:17:7" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 769, + "isOffset": false, + "isSlot": false, + "src": "9136:6:7", + "valueSize": 1 + }, + { + "declaration": 775, + "isOffset": false, + "isSlot": false, + "src": "8631:8:7", + "valueSize": 1 + }, + { + "declaration": 772, + "isOffset": false, + "isSlot": false, + "src": "8736:7:7", + "valueSize": 1 + }, + { + "declaration": 772, + "isOffset": false, + "isSlot": false, + "src": "8979:7:7", + "valueSize": 1 + }, + { + "declaration": 772, + "isOffset": false, + "isSlot": false, + "src": "9126:7:7", + "valueSize": 1 + }, + { + "declaration": 772, + "isOffset": false, + "isSlot": false, + "src": "9476:7:7", + "valueSize": 1 + }, + { + "declaration": 772, + "isOffset": false, + "isSlot": false, + "src": "9491:7:7", + "valueSize": 1 + }, + { + "declaration": 765, + "isOffset": false, + "isSlot": false, + "src": "8670:2:7", + "valueSize": 1 + }, + { + "declaration": 763, + "isOffset": false, + "isSlot": false, + "src": "8759:5:7", + "valueSize": 1 + }, + { + "declaration": 763, + "isOffset": false, + "isSlot": false, + "src": "9545:5:7", + "valueSize": 1 + }, + { + "declaration": 767, + "isOffset": false, + "isSlot": false, + "src": "8717:5:7", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 780, + "nodeType": "InlineAssembly", + "src": "8544:1067:7" + } + ] + }, + "documentation": { + "id": 760, + "nodeType": "StructuredDocumentation", + "src": "7885:483:7", + "text": " @dev Imitates a Solidity `token.transfer(to, value)` call, relaxing the requirement on the return value: the\n return value is optional (but if data is returned, it must not be false).\n @param token The token targeted by the call.\n @param to The recipient of the tokens\n @param value The amount of token to transfer\n @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean." + }, + "id": 782, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_safeTransfer", + "nameLocation": "8382:13:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 770, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 763, + "mutability": "mutable", + "name": "token", + "nameLocation": "8403:5:7", + "nodeType": "VariableDeclaration", + "scope": 782, + "src": "8396:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 762, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 761, + "name": "IERC20", + "nameLocations": [ + "8396:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "8396:6:7" + }, + "referencedDeclaration": 340, + "src": "8396:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 765, + "mutability": "mutable", + "name": "to", + "nameLocation": "8418:2:7", + "nodeType": "VariableDeclaration", + "scope": 782, + "src": "8410:10:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 764, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "8410:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 767, + "mutability": "mutable", + "name": "value", + "nameLocation": "8430:5:7", + "nodeType": "VariableDeclaration", + "scope": 782, + "src": "8422:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 766, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8422:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 769, + "mutability": "mutable", + "name": "bubble", + "nameLocation": "8442:6:7", + "nodeType": "VariableDeclaration", + "scope": 782, + "src": "8437:11:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 768, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "8437:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "8395:54:7" + }, + "returnParameters": { + "id": 773, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 772, + "mutability": "mutable", + "name": "success", + "nameLocation": "8472:7:7", + "nodeType": "VariableDeclaration", + "scope": 782, + "src": "8467:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 771, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "8467:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "8466:14:7" + }, + "scope": 831, + "src": "8373:1244:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 806, + "nodeType": "Block", + "src": "10337:1221:7", + "statements": [ + { + "assignments": [ + 800 + ], + "declarations": [ + { + "constant": false, + "id": 800, + "mutability": "mutable", + "name": "selector", + "nameLocation": "10354:8:7", + "nodeType": "VariableDeclaration", + "scope": 806, + "src": "10347:15:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "typeName": { + "id": 799, + "name": "bytes4", + "nodeType": "ElementaryTypeName", + "src": "10347:6:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "visibility": "internal" + } + ], + "id": 804, + "initialValue": { + "expression": { + "expression": { + "id": 801, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "10365:6:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$340_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 802, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "10372:12:7", + "memberName": "transferFrom", + "nodeType": "MemberAccess", + "referencedDeclaration": 339, + "src": "10365:19:7", + "typeDescriptions": { + "typeIdentifier": "t_function_declaration_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$_t_bool_$", + "typeString": "function IERC20.transferFrom(address,address,uint256) returns (bool)" + } + }, + "id": 803, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "10385:8:7", + "memberName": "selector", + "nodeType": "MemberAccess", + "src": "10365:28:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "10347:46:7" + }, + { + "AST": { + "nativeSrc": "10429:1123:7", + "nodeType": "YulBlock", + "src": "10429:1123:7", + "statements": [ + { + "nativeSrc": "10443:22:7", + "nodeType": "YulVariableDeclaration", + "src": "10443:22:7", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10460:4:7", + "nodeType": "YulLiteral", + "src": "10460:4:7", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "10454:5:7", + "nodeType": "YulIdentifier", + "src": "10454:5:7" + }, + "nativeSrc": "10454:11:7", + "nodeType": "YulFunctionCall", + "src": "10454:11:7" + }, + "variables": [ + { + "name": "fmp", + "nativeSrc": "10447:3:7", + "nodeType": "YulTypedName", + "src": "10447:3:7", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10485:4:7", + "nodeType": "YulLiteral", + "src": "10485:4:7", + "type": "", + "value": "0x00" + }, + { + "name": "selector", + "nativeSrc": "10491:8:7", + "nodeType": "YulIdentifier", + "src": "10491:8:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10478:6:7", + "nodeType": "YulIdentifier", + "src": "10478:6:7" + }, + "nativeSrc": "10478:22:7", + "nodeType": "YulFunctionCall", + "src": "10478:22:7" + }, + "nativeSrc": "10478:22:7", + "nodeType": "YulExpressionStatement", + "src": "10478:22:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10520:4:7", + "nodeType": "YulLiteral", + "src": "10520:4:7", + "type": "", + "value": "0x04" + }, + { + "arguments": [ + { + "name": "from", + "nativeSrc": "10530:4:7", + "nodeType": "YulIdentifier", + "src": "10530:4:7" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10540:2:7", + "nodeType": "YulLiteral", + "src": "10540:2:7", + "type": "", + "value": "96" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10548:1:7", + "nodeType": "YulLiteral", + "src": "10548:1:7", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "10544:3:7", + "nodeType": "YulIdentifier", + "src": "10544:3:7" + }, + "nativeSrc": "10544:6:7", + "nodeType": "YulFunctionCall", + "src": "10544:6:7" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "10536:3:7", + "nodeType": "YulIdentifier", + "src": "10536:3:7" + }, + "nativeSrc": "10536:15:7", + "nodeType": "YulFunctionCall", + "src": "10536:15:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "10526:3:7", + "nodeType": "YulIdentifier", + "src": "10526:3:7" + }, + "nativeSrc": "10526:26:7", + "nodeType": "YulFunctionCall", + "src": "10526:26:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10513:6:7", + "nodeType": "YulIdentifier", + "src": "10513:6:7" + }, + "nativeSrc": "10513:40:7", + "nodeType": "YulFunctionCall", + "src": "10513:40:7" + }, + "nativeSrc": "10513:40:7", + "nodeType": "YulExpressionStatement", + "src": "10513:40:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10573:4:7", + "nodeType": "YulLiteral", + "src": "10573:4:7", + "type": "", + "value": "0x24" + }, + { + "arguments": [ + { + "name": "to", + "nativeSrc": "10583:2:7", + "nodeType": "YulIdentifier", + "src": "10583:2:7" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10591:2:7", + "nodeType": "YulLiteral", + "src": "10591:2:7", + "type": "", + "value": "96" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10599:1:7", + "nodeType": "YulLiteral", + "src": "10599:1:7", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "10595:3:7", + "nodeType": "YulIdentifier", + "src": "10595:3:7" + }, + "nativeSrc": "10595:6:7", + "nodeType": "YulFunctionCall", + "src": "10595:6:7" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "10587:3:7", + "nodeType": "YulIdentifier", + "src": "10587:3:7" + }, + "nativeSrc": "10587:15:7", + "nodeType": "YulFunctionCall", + "src": "10587:15:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "10579:3:7", + "nodeType": "YulIdentifier", + "src": "10579:3:7" + }, + "nativeSrc": "10579:24:7", + "nodeType": "YulFunctionCall", + "src": "10579:24:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10566:6:7", + "nodeType": "YulIdentifier", + "src": "10566:6:7" + }, + "nativeSrc": "10566:38:7", + "nodeType": "YulFunctionCall", + "src": "10566:38:7" + }, + "nativeSrc": "10566:38:7", + "nodeType": "YulExpressionStatement", + "src": "10566:38:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10624:4:7", + "nodeType": "YulLiteral", + "src": "10624:4:7", + "type": "", + "value": "0x44" + }, + { + "name": "value", + "nativeSrc": "10630:5:7", + "nodeType": "YulIdentifier", + "src": "10630:5:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10617:6:7", + "nodeType": "YulIdentifier", + "src": "10617:6:7" + }, + "nativeSrc": "10617:19:7", + "nodeType": "YulFunctionCall", + "src": "10617:19:7" + }, + "nativeSrc": "10617:19:7", + "nodeType": "YulExpressionStatement", + "src": "10617:19:7" + }, + { + "nativeSrc": "10649:56:7", + "nodeType": "YulAssignment", + "src": "10649:56:7", + "value": { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "gas", + "nativeSrc": "10665:3:7", + "nodeType": "YulIdentifier", + "src": "10665:3:7" + }, + "nativeSrc": "10665:5:7", + "nodeType": "YulFunctionCall", + "src": "10665:5:7" + }, + { + "name": "token", + "nativeSrc": "10672:5:7", + "nodeType": "YulIdentifier", + "src": "10672:5:7" + }, + { + "kind": "number", + "nativeSrc": "10679:1:7", + "nodeType": "YulLiteral", + "src": "10679:1:7", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "10682:4:7", + "nodeType": "YulLiteral", + "src": "10682:4:7", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "10688:4:7", + "nodeType": "YulLiteral", + "src": "10688:4:7", + "type": "", + "value": "0x64" + }, + { + "kind": "number", + "nativeSrc": "10694:4:7", + "nodeType": "YulLiteral", + "src": "10694:4:7", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "10700:4:7", + "nodeType": "YulLiteral", + "src": "10700:4:7", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "call", + "nativeSrc": "10660:4:7", + "nodeType": "YulIdentifier", + "src": "10660:4:7" + }, + "nativeSrc": "10660:45:7", + "nodeType": "YulFunctionCall", + "src": "10660:45:7" + }, + "variableNames": [ + { + "name": "success", + "nativeSrc": "10649:7:7", + "nodeType": "YulIdentifier", + "src": "10649:7:7" + } + ] + }, + { + "body": { + "nativeSrc": "10922:562:7", + "nodeType": "YulBlock", + "src": "10922:562:7", + "statements": [ + { + "body": { + "nativeSrc": "11057:133:7", + "nodeType": "YulBlock", + "src": "11057:133:7", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "11094:3:7", + "nodeType": "YulIdentifier", + "src": "11094:3:7" + }, + { + "kind": "number", + "nativeSrc": "11099:4:7", + "nodeType": "YulLiteral", + "src": "11099:4:7", + "type": "", + "value": "0x00" + }, + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nativeSrc": "11105:14:7", + "nodeType": "YulIdentifier", + "src": "11105:14:7" + }, + "nativeSrc": "11105:16:7", + "nodeType": "YulFunctionCall", + "src": "11105:16:7" + } + ], + "functionName": { + "name": "returndatacopy", + "nativeSrc": "11079:14:7", + "nodeType": "YulIdentifier", + "src": "11079:14:7" + }, + "nativeSrc": "11079:43:7", + "nodeType": "YulFunctionCall", + "src": "11079:43:7" + }, + "nativeSrc": "11079:43:7", + "nodeType": "YulExpressionStatement", + "src": "11079:43:7" + }, + { + "expression": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "11150:3:7", + "nodeType": "YulIdentifier", + "src": "11150:3:7" + }, + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nativeSrc": "11155:14:7", + "nodeType": "YulIdentifier", + "src": "11155:14:7" + }, + "nativeSrc": "11155:16:7", + "nodeType": "YulFunctionCall", + "src": "11155:16:7" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "11143:6:7", + "nodeType": "YulIdentifier", + "src": "11143:6:7" + }, + "nativeSrc": "11143:29:7", + "nodeType": "YulFunctionCall", + "src": "11143:29:7" + }, + "nativeSrc": "11143:29:7", + "nodeType": "YulExpressionStatement", + "src": "11143:29:7" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "success", + "nativeSrc": "11039:7:7", + "nodeType": "YulIdentifier", + "src": "11039:7:7" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "11032:6:7", + "nodeType": "YulIdentifier", + "src": "11032:6:7" + }, + "nativeSrc": "11032:15:7", + "nodeType": "YulFunctionCall", + "src": "11032:15:7" + }, + { + "name": "bubble", + "nativeSrc": "11049:6:7", + "nodeType": "YulIdentifier", + "src": "11049:6:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "11028:3:7", + "nodeType": "YulIdentifier", + "src": "11028:3:7" + }, + "nativeSrc": "11028:28:7", + "nodeType": "YulFunctionCall", + "src": "11028:28:7" + }, + "nativeSrc": "11025:165:7", + "nodeType": "YulIf", + "src": "11025:165:7" + }, + { + "nativeSrc": "11389:81:7", + "nodeType": "YulAssignment", + "src": "11389:81:7", + "value": { + "arguments": [ + { + "name": "success", + "nativeSrc": "11404:7:7", + "nodeType": "YulIdentifier", + "src": "11404:7:7" + }, + { + "arguments": [ + { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nativeSrc": "11424:14:7", + "nodeType": "YulIdentifier", + "src": "11424:14:7" + }, + "nativeSrc": "11424:16:7", + "nodeType": "YulFunctionCall", + "src": "11424:16:7" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "11417:6:7", + "nodeType": "YulIdentifier", + "src": "11417:6:7" + }, + "nativeSrc": "11417:24:7", + "nodeType": "YulFunctionCall", + "src": "11417:24:7" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "token", + "nativeSrc": "11458:5:7", + "nodeType": "YulIdentifier", + "src": "11458:5:7" + } + ], + "functionName": { + "name": "extcodesize", + "nativeSrc": "11446:11:7", + "nodeType": "YulIdentifier", + "src": "11446:11:7" + }, + "nativeSrc": "11446:18:7", + "nodeType": "YulFunctionCall", + "src": "11446:18:7" + }, + { + "kind": "number", + "nativeSrc": "11466:1:7", + "nodeType": "YulLiteral", + "src": "11466:1:7", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "gt", + "nativeSrc": "11443:2:7", + "nodeType": "YulIdentifier", + "src": "11443:2:7" + }, + "nativeSrc": "11443:25:7", + "nodeType": "YulFunctionCall", + "src": "11443:25:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "11413:3:7", + "nodeType": "YulIdentifier", + "src": "11413:3:7" + }, + "nativeSrc": "11413:56:7", + "nodeType": "YulFunctionCall", + "src": "11413:56:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "11400:3:7", + "nodeType": "YulIdentifier", + "src": "11400:3:7" + }, + "nativeSrc": "11400:70:7", + "nodeType": "YulFunctionCall", + "src": "11400:70:7" + }, + "variableNames": [ + { + "name": "success", + "nativeSrc": "11389:7:7", + "nodeType": "YulIdentifier", + "src": "11389:7:7" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "success", + "nativeSrc": "10892:7:7", + "nodeType": "YulIdentifier", + "src": "10892:7:7" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10910:4:7", + "nodeType": "YulLiteral", + "src": "10910:4:7", + "type": "", + "value": "0x00" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "10904:5:7", + "nodeType": "YulIdentifier", + "src": "10904:5:7" + }, + "nativeSrc": "10904:11:7", + "nodeType": "YulFunctionCall", + "src": "10904:11:7" + }, + { + "kind": "number", + "nativeSrc": "10917:1:7", + "nodeType": "YulLiteral", + "src": "10917:1:7", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "eq", + "nativeSrc": "10901:2:7", + "nodeType": "YulIdentifier", + "src": "10901:2:7" + }, + "nativeSrc": "10901:18:7", + "nodeType": "YulFunctionCall", + "src": "10901:18:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "10888:3:7", + "nodeType": "YulIdentifier", + "src": "10888:3:7" + }, + "nativeSrc": "10888:32:7", + "nodeType": "YulFunctionCall", + "src": "10888:32:7" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "10881:6:7", + "nodeType": "YulIdentifier", + "src": "10881:6:7" + }, + "nativeSrc": "10881:40:7", + "nodeType": "YulFunctionCall", + "src": "10881:40:7" + }, + "nativeSrc": "10878:606:7", + "nodeType": "YulIf", + "src": "10878:606:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11504:4:7", + "nodeType": "YulLiteral", + "src": "11504:4:7", + "type": "", + "value": "0x40" + }, + { + "name": "fmp", + "nativeSrc": "11510:3:7", + "nodeType": "YulIdentifier", + "src": "11510:3:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "11497:6:7", + "nodeType": "YulIdentifier", + "src": "11497:6:7" + }, + "nativeSrc": "11497:17:7", + "nodeType": "YulFunctionCall", + "src": "11497:17:7" + }, + "nativeSrc": "11497:17:7", + "nodeType": "YulExpressionStatement", + "src": "11497:17:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11534:4:7", + "nodeType": "YulLiteral", + "src": "11534:4:7", + "type": "", + "value": "0x60" + }, + { + "kind": "number", + "nativeSrc": "11540:1:7", + "nodeType": "YulLiteral", + "src": "11540:1:7", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "11527:6:7", + "nodeType": "YulIdentifier", + "src": "11527:6:7" + }, + "nativeSrc": "11527:15:7", + "nodeType": "YulFunctionCall", + "src": "11527:15:7" + }, + "nativeSrc": "11527:15:7", + "nodeType": "YulExpressionStatement", + "src": "11527:15:7" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 794, + "isOffset": false, + "isSlot": false, + "src": "11049:6:7", + "valueSize": 1 + }, + { + "declaration": 788, + "isOffset": false, + "isSlot": false, + "src": "10530:4:7", + "valueSize": 1 + }, + { + "declaration": 800, + "isOffset": false, + "isSlot": false, + "src": "10491:8:7", + "valueSize": 1 + }, + { + "declaration": 797, + "isOffset": false, + "isSlot": false, + "src": "10649:7:7", + "valueSize": 1 + }, + { + "declaration": 797, + "isOffset": false, + "isSlot": false, + "src": "10892:7:7", + "valueSize": 1 + }, + { + "declaration": 797, + "isOffset": false, + "isSlot": false, + "src": "11039:7:7", + "valueSize": 1 + }, + { + "declaration": 797, + "isOffset": false, + "isSlot": false, + "src": "11389:7:7", + "valueSize": 1 + }, + { + "declaration": 797, + "isOffset": false, + "isSlot": false, + "src": "11404:7:7", + "valueSize": 1 + }, + { + "declaration": 790, + "isOffset": false, + "isSlot": false, + "src": "10583:2:7", + "valueSize": 1 + }, + { + "declaration": 786, + "isOffset": false, + "isSlot": false, + "src": "10672:5:7", + "valueSize": 1 + }, + { + "declaration": 786, + "isOffset": false, + "isSlot": false, + "src": "11458:5:7", + "valueSize": 1 + }, + { + "declaration": 792, + "isOffset": false, + "isSlot": false, + "src": "10630:5:7", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 805, + "nodeType": "InlineAssembly", + "src": "10404:1148:7" + } + ] + }, + "documentation": { + "id": 783, + "nodeType": "StructuredDocumentation", + "src": "9623:537:7", + "text": " @dev Imitates a Solidity `token.transferFrom(from, to, value)` call, relaxing the requirement on the return\n value: the return value is optional (but if data is returned, it must not be false).\n @param token The token targeted by the call.\n @param from The sender of the tokens\n @param to The recipient of the tokens\n @param value The amount of token to transfer\n @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean." + }, + "id": 807, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_safeTransferFrom", + "nameLocation": "10174:17:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 795, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 786, + "mutability": "mutable", + "name": "token", + "nameLocation": "10208:5:7", + "nodeType": "VariableDeclaration", + "scope": 807, + "src": "10201:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 785, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 784, + "name": "IERC20", + "nameLocations": [ + "10201:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "10201:6:7" + }, + "referencedDeclaration": 340, + "src": "10201:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 788, + "mutability": "mutable", + "name": "from", + "nameLocation": "10231:4:7", + "nodeType": "VariableDeclaration", + "scope": 807, + "src": "10223:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 787, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "10223:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 790, + "mutability": "mutable", + "name": "to", + "nameLocation": "10253:2:7", + "nodeType": "VariableDeclaration", + "scope": 807, + "src": "10245:10:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 789, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "10245:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 792, + "mutability": "mutable", + "name": "value", + "nameLocation": "10273:5:7", + "nodeType": "VariableDeclaration", + "scope": 807, + "src": "10265:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 791, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10265:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 794, + "mutability": "mutable", + "name": "bubble", + "nameLocation": "10293:6:7", + "nodeType": "VariableDeclaration", + "scope": 807, + "src": "10288:11:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 793, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "10288:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "10191:114:7" + }, + "returnParameters": { + "id": 798, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 797, + "mutability": "mutable", + "name": "success", + "nameLocation": "10328:7:7", + "nodeType": "VariableDeclaration", + "scope": 807, + "src": "10323:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 796, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "10323:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "10322:14:7" + }, + "scope": 831, + "src": "10165:1393:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 829, + "nodeType": "Block", + "src": "12171:1140:7", + "statements": [ + { + "assignments": [ + 823 + ], + "declarations": [ + { + "constant": false, + "id": 823, + "mutability": "mutable", + "name": "selector", + "nameLocation": "12188:8:7", + "nodeType": "VariableDeclaration", + "scope": 829, + "src": "12181:15:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "typeName": { + "id": 822, + "name": "bytes4", + "nodeType": "ElementaryTypeName", + "src": "12181:6:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "visibility": "internal" + } + ], + "id": 827, + "initialValue": { + "expression": { + "expression": { + "id": 824, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "12199:6:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$340_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 825, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "12206:7:7", + "memberName": "approve", + "nodeType": "MemberAccess", + "referencedDeclaration": 327, + "src": "12199:14:7", + "typeDescriptions": { + "typeIdentifier": "t_function_declaration_nonpayable$_t_address_$_t_uint256_$returns$_t_bool_$", + "typeString": "function IERC20.approve(address,uint256) returns (bool)" + } + }, + "id": 826, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "12214:8:7", + "memberName": "selector", + "nodeType": "MemberAccess", + "src": "12199:23:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "12181:41:7" + }, + { + "AST": { + "nativeSrc": "12258:1047:7", + "nodeType": "YulBlock", + "src": "12258:1047:7", + "statements": [ + { + "nativeSrc": "12272:22:7", + "nodeType": "YulVariableDeclaration", + "src": "12272:22:7", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "12289:4:7", + "nodeType": "YulLiteral", + "src": "12289:4:7", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "12283:5:7", + "nodeType": "YulIdentifier", + "src": "12283:5:7" + }, + "nativeSrc": "12283:11:7", + "nodeType": "YulFunctionCall", + "src": "12283:11:7" + }, + "variables": [ + { + "name": "fmp", + "nativeSrc": "12276:3:7", + "nodeType": "YulTypedName", + "src": "12276:3:7", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "12314:4:7", + "nodeType": "YulLiteral", + "src": "12314:4:7", + "type": "", + "value": "0x00" + }, + { + "name": "selector", + "nativeSrc": "12320:8:7", + "nodeType": "YulIdentifier", + "src": "12320:8:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "12307:6:7", + "nodeType": "YulIdentifier", + "src": "12307:6:7" + }, + "nativeSrc": "12307:22:7", + "nodeType": "YulFunctionCall", + "src": "12307:22:7" + }, + "nativeSrc": "12307:22:7", + "nodeType": "YulExpressionStatement", + "src": "12307:22:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "12349:4:7", + "nodeType": "YulLiteral", + "src": "12349:4:7", + "type": "", + "value": "0x04" + }, + { + "arguments": [ + { + "name": "spender", + "nativeSrc": "12359:7:7", + "nodeType": "YulIdentifier", + "src": "12359:7:7" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "12372:2:7", + "nodeType": "YulLiteral", + "src": "12372:2:7", + "type": "", + "value": "96" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "12380:1:7", + "nodeType": "YulLiteral", + "src": "12380:1:7", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "12376:3:7", + "nodeType": "YulIdentifier", + "src": "12376:3:7" + }, + "nativeSrc": "12376:6:7", + "nodeType": "YulFunctionCall", + "src": "12376:6:7" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "12368:3:7", + "nodeType": "YulIdentifier", + "src": "12368:3:7" + }, + "nativeSrc": "12368:15:7", + "nodeType": "YulFunctionCall", + "src": "12368:15:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "12355:3:7", + "nodeType": "YulIdentifier", + "src": "12355:3:7" + }, + "nativeSrc": "12355:29:7", + "nodeType": "YulFunctionCall", + "src": "12355:29:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "12342:6:7", + "nodeType": "YulIdentifier", + "src": "12342:6:7" + }, + "nativeSrc": "12342:43:7", + "nodeType": "YulFunctionCall", + "src": "12342:43:7" + }, + "nativeSrc": "12342:43:7", + "nodeType": "YulExpressionStatement", + "src": "12342:43:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "12405:4:7", + "nodeType": "YulLiteral", + "src": "12405:4:7", + "type": "", + "value": "0x24" + }, + { + "name": "value", + "nativeSrc": "12411:5:7", + "nodeType": "YulIdentifier", + "src": "12411:5:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "12398:6:7", + "nodeType": "YulIdentifier", + "src": "12398:6:7" + }, + "nativeSrc": "12398:19:7", + "nodeType": "YulFunctionCall", + "src": "12398:19:7" + }, + "nativeSrc": "12398:19:7", + "nodeType": "YulExpressionStatement", + "src": "12398:19:7" + }, + { + "nativeSrc": "12430:56:7", + "nodeType": "YulAssignment", + "src": "12430:56:7", + "value": { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "gas", + "nativeSrc": "12446:3:7", + "nodeType": "YulIdentifier", + "src": "12446:3:7" + }, + "nativeSrc": "12446:5:7", + "nodeType": "YulFunctionCall", + "src": "12446:5:7" + }, + { + "name": "token", + "nativeSrc": "12453:5:7", + "nodeType": "YulIdentifier", + "src": "12453:5:7" + }, + { + "kind": "number", + "nativeSrc": "12460:1:7", + "nodeType": "YulLiteral", + "src": "12460:1:7", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "12463:4:7", + "nodeType": "YulLiteral", + "src": "12463:4:7", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "12469:4:7", + "nodeType": "YulLiteral", + "src": "12469:4:7", + "type": "", + "value": "0x44" + }, + { + "kind": "number", + "nativeSrc": "12475:4:7", + "nodeType": "YulLiteral", + "src": "12475:4:7", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "12481:4:7", + "nodeType": "YulLiteral", + "src": "12481:4:7", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "call", + "nativeSrc": "12441:4:7", + "nodeType": "YulIdentifier", + "src": "12441:4:7" + }, + "nativeSrc": "12441:45:7", + "nodeType": "YulFunctionCall", + "src": "12441:45:7" + }, + "variableNames": [ + { + "name": "success", + "nativeSrc": "12430:7:7", + "nodeType": "YulIdentifier", + "src": "12430:7:7" + } + ] + }, + { + "body": { + "nativeSrc": "12703:562:7", + "nodeType": "YulBlock", + "src": "12703:562:7", + "statements": [ + { + "body": { + "nativeSrc": "12838:133:7", + "nodeType": "YulBlock", + "src": "12838:133:7", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "12875:3:7", + "nodeType": "YulIdentifier", + "src": "12875:3:7" + }, + { + "kind": "number", + "nativeSrc": "12880:4:7", + "nodeType": "YulLiteral", + "src": "12880:4:7", + "type": "", + "value": "0x00" + }, + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nativeSrc": "12886:14:7", + "nodeType": "YulIdentifier", + "src": "12886:14:7" + }, + "nativeSrc": "12886:16:7", + "nodeType": "YulFunctionCall", + "src": "12886:16:7" + } + ], + "functionName": { + "name": "returndatacopy", + "nativeSrc": "12860:14:7", + "nodeType": "YulIdentifier", + "src": "12860:14:7" + }, + "nativeSrc": "12860:43:7", + "nodeType": "YulFunctionCall", + "src": "12860:43:7" + }, + "nativeSrc": "12860:43:7", + "nodeType": "YulExpressionStatement", + "src": "12860:43:7" + }, + { + "expression": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "12931:3:7", + "nodeType": "YulIdentifier", + "src": "12931:3:7" + }, + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nativeSrc": "12936:14:7", + "nodeType": "YulIdentifier", + "src": "12936:14:7" + }, + "nativeSrc": "12936:16:7", + "nodeType": "YulFunctionCall", + "src": "12936:16:7" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "12924:6:7", + "nodeType": "YulIdentifier", + "src": "12924:6:7" + }, + "nativeSrc": "12924:29:7", + "nodeType": "YulFunctionCall", + "src": "12924:29:7" + }, + "nativeSrc": "12924:29:7", + "nodeType": "YulExpressionStatement", + "src": "12924:29:7" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "success", + "nativeSrc": "12820:7:7", + "nodeType": "YulIdentifier", + "src": "12820:7:7" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "12813:6:7", + "nodeType": "YulIdentifier", + "src": "12813:6:7" + }, + "nativeSrc": "12813:15:7", + "nodeType": "YulFunctionCall", + "src": "12813:15:7" + }, + { + "name": "bubble", + "nativeSrc": "12830:6:7", + "nodeType": "YulIdentifier", + "src": "12830:6:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "12809:3:7", + "nodeType": "YulIdentifier", + "src": "12809:3:7" + }, + "nativeSrc": "12809:28:7", + "nodeType": "YulFunctionCall", + "src": "12809:28:7" + }, + "nativeSrc": "12806:165:7", + "nodeType": "YulIf", + "src": "12806:165:7" + }, + { + "nativeSrc": "13170:81:7", + "nodeType": "YulAssignment", + "src": "13170:81:7", + "value": { + "arguments": [ + { + "name": "success", + "nativeSrc": "13185:7:7", + "nodeType": "YulIdentifier", + "src": "13185:7:7" + }, + { + "arguments": [ + { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nativeSrc": "13205:14:7", + "nodeType": "YulIdentifier", + "src": "13205:14:7" + }, + "nativeSrc": "13205:16:7", + "nodeType": "YulFunctionCall", + "src": "13205:16:7" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "13198:6:7", + "nodeType": "YulIdentifier", + "src": "13198:6:7" + }, + "nativeSrc": "13198:24:7", + "nodeType": "YulFunctionCall", + "src": "13198:24:7" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "token", + "nativeSrc": "13239:5:7", + "nodeType": "YulIdentifier", + "src": "13239:5:7" + } + ], + "functionName": { + "name": "extcodesize", + "nativeSrc": "13227:11:7", + "nodeType": "YulIdentifier", + "src": "13227:11:7" + }, + "nativeSrc": "13227:18:7", + "nodeType": "YulFunctionCall", + "src": "13227:18:7" + }, + { + "kind": "number", + "nativeSrc": "13247:1:7", + "nodeType": "YulLiteral", + "src": "13247:1:7", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "gt", + "nativeSrc": "13224:2:7", + "nodeType": "YulIdentifier", + "src": "13224:2:7" + }, + "nativeSrc": "13224:25:7", + "nodeType": "YulFunctionCall", + "src": "13224:25:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "13194:3:7", + "nodeType": "YulIdentifier", + "src": "13194:3:7" + }, + "nativeSrc": "13194:56:7", + "nodeType": "YulFunctionCall", + "src": "13194:56:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "13181:3:7", + "nodeType": "YulIdentifier", + "src": "13181:3:7" + }, + "nativeSrc": "13181:70:7", + "nodeType": "YulFunctionCall", + "src": "13181:70:7" + }, + "variableNames": [ + { + "name": "success", + "nativeSrc": "13170:7:7", + "nodeType": "YulIdentifier", + "src": "13170:7:7" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "success", + "nativeSrc": "12673:7:7", + "nodeType": "YulIdentifier", + "src": "12673:7:7" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "12691:4:7", + "nodeType": "YulLiteral", + "src": "12691:4:7", + "type": "", + "value": "0x00" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "12685:5:7", + "nodeType": "YulIdentifier", + "src": "12685:5:7" + }, + "nativeSrc": "12685:11:7", + "nodeType": "YulFunctionCall", + "src": "12685:11:7" + }, + { + "kind": "number", + "nativeSrc": "12698:1:7", + "nodeType": "YulLiteral", + "src": "12698:1:7", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "eq", + "nativeSrc": "12682:2:7", + "nodeType": "YulIdentifier", + "src": "12682:2:7" + }, + "nativeSrc": "12682:18:7", + "nodeType": "YulFunctionCall", + "src": "12682:18:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "12669:3:7", + "nodeType": "YulIdentifier", + "src": "12669:3:7" + }, + "nativeSrc": "12669:32:7", + "nodeType": "YulFunctionCall", + "src": "12669:32:7" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "12662:6:7", + "nodeType": "YulIdentifier", + "src": "12662:6:7" + }, + "nativeSrc": "12662:40:7", + "nodeType": "YulFunctionCall", + "src": "12662:40:7" + }, + "nativeSrc": "12659:606:7", + "nodeType": "YulIf", + "src": "12659:606:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "13285:4:7", + "nodeType": "YulLiteral", + "src": "13285:4:7", + "type": "", + "value": "0x40" + }, + { + "name": "fmp", + "nativeSrc": "13291:3:7", + "nodeType": "YulIdentifier", + "src": "13291:3:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "13278:6:7", + "nodeType": "YulIdentifier", + "src": "13278:6:7" + }, + "nativeSrc": "13278:17:7", + "nodeType": "YulFunctionCall", + "src": "13278:17:7" + }, + "nativeSrc": "13278:17:7", + "nodeType": "YulExpressionStatement", + "src": "13278:17:7" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 817, + "isOffset": false, + "isSlot": false, + "src": "12830:6:7", + "valueSize": 1 + }, + { + "declaration": 823, + "isOffset": false, + "isSlot": false, + "src": "12320:8:7", + "valueSize": 1 + }, + { + "declaration": 813, + "isOffset": false, + "isSlot": false, + "src": "12359:7:7", + "valueSize": 1 + }, + { + "declaration": 820, + "isOffset": false, + "isSlot": false, + "src": "12430:7:7", + "valueSize": 1 + }, + { + "declaration": 820, + "isOffset": false, + "isSlot": false, + "src": "12673:7:7", + "valueSize": 1 + }, + { + "declaration": 820, + "isOffset": false, + "isSlot": false, + "src": "12820:7:7", + "valueSize": 1 + }, + { + "declaration": 820, + "isOffset": false, + "isSlot": false, + "src": "13170:7:7", + "valueSize": 1 + }, + { + "declaration": 820, + "isOffset": false, + "isSlot": false, + "src": "13185:7:7", + "valueSize": 1 + }, + { + "declaration": 811, + "isOffset": false, + "isSlot": false, + "src": "12453:5:7", + "valueSize": 1 + }, + { + "declaration": 811, + "isOffset": false, + "isSlot": false, + "src": "13239:5:7", + "valueSize": 1 + }, + { + "declaration": 815, + "isOffset": false, + "isSlot": false, + "src": "12411:5:7", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 828, + "nodeType": "InlineAssembly", + "src": "12233:1072:7" + } + ] + }, + "documentation": { + "id": 808, + "nodeType": "StructuredDocumentation", + "src": "11564:490:7", + "text": " @dev Imitates a Solidity `token.approve(spender, value)` call, relaxing the requirement on the return value:\n the return value is optional (but if data is returned, it must not be false).\n @param token The token targeted by the call.\n @param spender The spender of the tokens\n @param value The amount of token to transfer\n @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean." + }, + "id": 830, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_safeApprove", + "nameLocation": "12068:12:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 818, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 811, + "mutability": "mutable", + "name": "token", + "nameLocation": "12088:5:7", + "nodeType": "VariableDeclaration", + "scope": 830, + "src": "12081:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 810, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 809, + "name": "IERC20", + "nameLocations": [ + "12081:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "12081:6:7" + }, + "referencedDeclaration": 340, + "src": "12081:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 813, + "mutability": "mutable", + "name": "spender", + "nameLocation": "12103:7:7", + "nodeType": "VariableDeclaration", + "scope": 830, + "src": "12095:15:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 812, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "12095:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 815, + "mutability": "mutable", + "name": "value", + "nameLocation": "12120:5:7", + "nodeType": "VariableDeclaration", + "scope": 830, + "src": "12112:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 814, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12112:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 817, + "mutability": "mutable", + "name": "bubble", + "nameLocation": "12132:6:7", + "nodeType": "VariableDeclaration", + "scope": 830, + "src": "12127:11:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 816, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "12127:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "12080:59:7" + }, + "returnParameters": { + "id": 821, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 820, + "mutability": "mutable", + "name": "success", + "nameLocation": "12162:7:7", + "nodeType": "VariableDeclaration", + "scope": 830, + "src": "12157:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 819, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "12157:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "12156:14:7" + }, + "scope": 831, + "src": "12059:1252:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "private" + } + ], + "scope": 832, + "src": "698:12615:7", + "usedErrors": [ + 388, + 397 + ], + "usedEvents": [] + } + ], + "src": "115:13199:7" + }, + "id": 7 + }, + "@openzeppelin/contracts/utils/Bytes.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/Bytes.sol", + "exportedSymbols": { + "Bytes": [ + 1632 + ], + "Math": [ + 6204 + ] + }, + "id": 1633, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 833, + "literals": [ + "solidity", + "^", + "0.8", + ".24" + ], + "nodeType": "PragmaDirective", + "src": "99:24:8" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/math/Math.sol", + "file": "./math/Math.sol", + "id": 835, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 1633, + "sourceUnit": 6205, + "src": "125:37:8", + "symbolAliases": [ + { + "foreign": { + "id": 834, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "133:4:8", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "Bytes", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 836, + "nodeType": "StructuredDocumentation", + "src": "164:33:8", + "text": " @dev Bytes operations." + }, + "fullyImplemented": true, + "id": 1632, + "linearizedBaseContracts": [ + 1632 + ], + "name": "Bytes", + "nameLocation": "206:5:8", + "nodeType": "ContractDefinition", + "nodes": [ + { + "body": { + "id": 852, + "nodeType": "Block", + "src": "687:45:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 847, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 839, + "src": "712:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 848, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 841, + "src": "720:1:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + { + "hexValue": "30", + "id": 849, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "723:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 846, + "name": "indexOf", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 853, + 902 + ], + "referencedDeclaration": 902, + "src": "704:7:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_bytes1_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bytes memory,bytes1,uint256) pure returns (uint256)" + } + }, + "id": 850, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "704:21:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 845, + "id": 851, + "nodeType": "Return", + "src": "697:28:8" + } + ] + }, + "documentation": { + "id": 837, + "nodeType": "StructuredDocumentation", + "src": "218:384:8", + "text": " @dev Forward search for `s` in `buffer`\n * If `s` is present in the buffer, returns the index of the first instance\n * If `s` is not present in the buffer, returns type(uint256).max\n NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf[Javascript's `Array.indexOf`]" + }, + "id": 853, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "indexOf", + "nameLocation": "616:7:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 842, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 839, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "637:6:8", + "nodeType": "VariableDeclaration", + "scope": 853, + "src": "624:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 838, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "624:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 841, + "mutability": "mutable", + "name": "s", + "nameLocation": "652:1:8", + "nodeType": "VariableDeclaration", + "scope": 853, + "src": "645:8:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 840, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "645:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + } + ], + "src": "623:31:8" + }, + "returnParameters": { + "id": 845, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 844, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 853, + "src": "678:7:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 843, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "678:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "677:9:8" + }, + "scope": 1632, + "src": "607:125:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 901, + "nodeType": "Block", + "src": "1286:246:8", + "statements": [ + { + "assignments": [ + 866 + ], + "declarations": [ + { + "constant": false, + "id": 866, + "mutability": "mutable", + "name": "length", + "nameLocation": "1304:6:8", + "nodeType": "VariableDeclaration", + "scope": 901, + "src": "1296:14:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 865, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1296:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 869, + "initialValue": { + "expression": { + "id": 867, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 856, + "src": "1313:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 868, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "1320:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "1313:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1296:30:8" + }, + { + "body": { + "id": 893, + "nodeType": "Block", + "src": "1375:117:8", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "id": 888, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "arguments": [ + { + "id": 883, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 856, + "src": "1423:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 884, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 871, + "src": "1431:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 882, + "name": "_unsafeReadBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1631, + "src": "1400:22:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (bytes memory,uint256) pure returns (bytes32)" + } + }, + "id": 885, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1400:33:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 881, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1393:6:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 880, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "1393:6:8", + "typeDescriptions": {} + } + }, + "id": 886, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1393:41:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 887, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 858, + "src": "1438:1:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "src": "1393:46:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 892, + "nodeType": "IfStatement", + "src": "1389:93:8", + "trueBody": { + "id": 891, + "nodeType": "Block", + "src": "1441:41:8", + "statements": [ + { + "expression": { + "id": 889, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 871, + "src": "1466:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 864, + "id": 890, + "nodeType": "Return", + "src": "1459:8:8" + } + ] + } + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 876, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 874, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 871, + "src": "1358:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 875, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 866, + "src": "1362:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1358:10:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 894, + "initializationExpression": { + "assignments": [ + 871 + ], + "declarations": [ + { + "constant": false, + "id": 871, + "mutability": "mutable", + "name": "i", + "nameLocation": "1349:1:8", + "nodeType": "VariableDeclaration", + "scope": 894, + "src": "1341:9:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 870, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1341:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 873, + "initialValue": { + "id": 872, + "name": "pos", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 860, + "src": "1353:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1341:15:8" + }, + "isSimpleCounterLoop": true, + "loopExpression": { + "expression": { + "id": 878, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": true, + "src": "1370:3:8", + "subExpression": { + "id": 877, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 871, + "src": "1372:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 879, + "nodeType": "ExpressionStatement", + "src": "1370:3:8" + }, + "nodeType": "ForStatement", + "src": "1336:156:8" + }, + { + "expression": { + "expression": { + "arguments": [ + { + "id": 897, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1513:7:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 896, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1513:7:8", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + } + ], + "id": 895, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "1508:4:8", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 898, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1508:13:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint256", + "typeString": "type(uint256)" + } + }, + "id": 899, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "1522:3:8", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "1508:17:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 864, + "id": 900, + "nodeType": "Return", + "src": "1501:24:8" + } + ] + }, + "documentation": { + "id": 854, + "nodeType": "StructuredDocumentation", + "src": "738:450:8", + "text": " @dev Forward search for `s` in `buffer` starting at position `pos`\n * If `s` is present in the buffer (at or after `pos`), returns the index of the next instance\n * If `s` is not present in the buffer (at or after `pos`), returns type(uint256).max\n NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf[Javascript's `Array.indexOf`]" + }, + "id": 902, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "indexOf", + "nameLocation": "1202:7:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 861, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 856, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "1223:6:8", + "nodeType": "VariableDeclaration", + "scope": 902, + "src": "1210:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 855, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1210:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 858, + "mutability": "mutable", + "name": "s", + "nameLocation": "1238:1:8", + "nodeType": "VariableDeclaration", + "scope": 902, + "src": "1231:8:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 857, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "1231:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 860, + "mutability": "mutable", + "name": "pos", + "nameLocation": "1249:3:8", + "nodeType": "VariableDeclaration", + "scope": 902, + "src": "1241:11:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 859, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1241:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1209:44:8" + }, + "returnParameters": { + "id": 864, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 863, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 902, + "src": "1277:7:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 862, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1277:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1276:9:8" + }, + "scope": 1632, + "src": "1193:339:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 922, + "nodeType": "Block", + "src": "2019:65:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 913, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 905, + "src": "2048:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 914, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 907, + "src": "2056:1:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + { + "expression": { + "arguments": [ + { + "id": 917, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2064:7:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 916, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2064:7:8", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + } + ], + "id": 915, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "2059:4:8", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 918, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2059:13:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint256", + "typeString": "type(uint256)" + } + }, + "id": 919, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "2073:3:8", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "2059:17:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 912, + "name": "lastIndexOf", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 923, + 985 + ], + "referencedDeclaration": 985, + "src": "2036:11:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_bytes1_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bytes memory,bytes1,uint256) pure returns (uint256)" + } + }, + "id": 920, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2036:41:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 911, + "id": 921, + "nodeType": "Return", + "src": "2029:48:8" + } + ] + }, + "documentation": { + "id": 903, + "nodeType": "StructuredDocumentation", + "src": "1538:392:8", + "text": " @dev Backward search for `s` in `buffer`\n * If `s` is present in the buffer, returns the index of the last instance\n * If `s` is not present in the buffer, returns type(uint256).max\n NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf[Javascript's `Array.lastIndexOf`]" + }, + "id": 923, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "lastIndexOf", + "nameLocation": "1944:11:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 908, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 905, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "1969:6:8", + "nodeType": "VariableDeclaration", + "scope": 923, + "src": "1956:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 904, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1956:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 907, + "mutability": "mutable", + "name": "s", + "nameLocation": "1984:1:8", + "nodeType": "VariableDeclaration", + "scope": 923, + "src": "1977:8:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 906, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "1977:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + } + ], + "src": "1955:31:8" + }, + "returnParameters": { + "id": 911, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 910, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 923, + "src": "2010:7:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 909, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2010:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2009:9:8" + }, + "scope": 1632, + "src": "1935:149:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 984, + "nodeType": "Block", + "src": "2657:348:8", + "statements": [ + { + "id": 983, + "nodeType": "UncheckedBlock", + "src": "2667:332:8", + "statements": [ + { + "assignments": [ + 936 + ], + "declarations": [ + { + "constant": false, + "id": 936, + "mutability": "mutable", + "name": "length", + "nameLocation": "2699:6:8", + "nodeType": "VariableDeclaration", + "scope": 983, + "src": "2691:14:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 935, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2691:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 939, + "initialValue": { + "expression": { + "id": 937, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 926, + "src": "2708:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 938, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2715:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "2708:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2691:30:8" + }, + { + "body": { + "id": 975, + "nodeType": "Block", + "src": "2810:141:8", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "id": 968, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "arguments": [ + { + "id": 961, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 926, + "src": "2862:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 964, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 962, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 941, + "src": "2870:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "hexValue": "31", + "id": 963, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2874:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "2870:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 960, + "name": "_unsafeReadBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1631, + "src": "2839:22:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (bytes memory,uint256) pure returns (bytes32)" + } + }, + "id": 965, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2839:37:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 959, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2832:6:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 958, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "2832:6:8", + "typeDescriptions": {} + } + }, + "id": 966, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2832:45:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 967, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 928, + "src": "2881:1:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "src": "2832:50:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 974, + "nodeType": "IfStatement", + "src": "2828:109:8", + "trueBody": { + "id": 973, + "nodeType": "Block", + "src": "2884:53:8", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 971, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 969, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 941, + "src": "2913:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "hexValue": "31", + "id": 970, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2917:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "2913:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 934, + "id": 972, + "nodeType": "Return", + "src": "2906:12:8" + } + ] + } + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 954, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 952, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 941, + "src": "2798:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 953, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2802:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "2798:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 976, + "initializationExpression": { + "assignments": [ + 941 + ], + "declarations": [ + { + "constant": false, + "id": 941, + "mutability": "mutable", + "name": "i", + "nameLocation": "2748:1:8", + "nodeType": "VariableDeclaration", + "scope": 976, + "src": "2740:9:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 940, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2740:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 951, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "id": 946, + "name": "pos", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 930, + "src": "2780:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "31", + "id": 947, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2785:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + } + ], + "expression": { + "id": 944, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "2761:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 945, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2766:13:8", + "memberName": "saturatingAdd", + "nodeType": "MemberAccess", + "referencedDeclaration": 4759, + "src": "2761:18:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 948, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2761:26:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 949, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 936, + "src": "2789:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 942, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "2752:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 943, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2757:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "2752:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 950, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2752:44:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2740:56:8" + }, + "isSimpleCounterLoop": false, + "loopExpression": { + "expression": { + "id": 956, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "--", + "prefix": true, + "src": "2805:3:8", + "subExpression": { + "id": 955, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 941, + "src": "2807:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 957, + "nodeType": "ExpressionStatement", + "src": "2805:3:8" + }, + "nodeType": "ForStatement", + "src": "2735:216:8" + }, + { + "expression": { + "expression": { + "arguments": [ + { + "id": 979, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2976:7:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 978, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2976:7:8", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + } + ], + "id": 977, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "2971:4:8", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 980, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2971:13:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint256", + "typeString": "type(uint256)" + } + }, + "id": 981, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "2985:3:8", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "2971:17:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 934, + "id": 982, + "nodeType": "Return", + "src": "2964:24:8" + } + ] + } + ] + }, + "documentation": { + "id": 924, + "nodeType": "StructuredDocumentation", + "src": "2090:465:8", + "text": " @dev Backward search for `s` in `buffer` starting at position `pos`\n * If `s` is present in the buffer (at or before `pos`), returns the index of the previous instance\n * If `s` is not present in the buffer (at or before `pos`), returns type(uint256).max\n NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf[Javascript's `Array.lastIndexOf`]" + }, + "id": 985, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "lastIndexOf", + "nameLocation": "2569:11:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 931, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 926, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "2594:6:8", + "nodeType": "VariableDeclaration", + "scope": 985, + "src": "2581:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 925, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2581:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 928, + "mutability": "mutable", + "name": "s", + "nameLocation": "2609:1:8", + "nodeType": "VariableDeclaration", + "scope": 985, + "src": "2602:8:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 927, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "2602:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 930, + "mutability": "mutable", + "name": "pos", + "nameLocation": "2620:3:8", + "nodeType": "VariableDeclaration", + "scope": 985, + "src": "2612:11:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 929, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2612:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2580:44:8" + }, + "returnParameters": { + "id": 934, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 933, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 985, + "src": "2648:7:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 932, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2648:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2647:9:8" + }, + "scope": 1632, + "src": "2560:445:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1002, + "nodeType": "Block", + "src": "3416:59:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 996, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 988, + "src": "3439:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 997, + "name": "start", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 990, + "src": "3447:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 998, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 988, + "src": "3454:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 999, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3461:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "3454:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 995, + "name": "slice", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 1003, + 1045 + ], + "referencedDeclaration": 1045, + "src": "3433:5:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (bytes memory,uint256,uint256) pure returns (bytes memory)" + } + }, + "id": 1000, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3433:35:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "functionReturnParameters": 994, + "id": 1001, + "nodeType": "Return", + "src": "3426:42:8" + } + ] + }, + "documentation": { + "id": 986, + "nodeType": "StructuredDocumentation", + "src": "3011:312:8", + "text": " @dev Copies the content of `buffer`, from `start` (included) to the end of `buffer` into a new bytes object in\n memory.\n NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`]" + }, + "id": 1003, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "slice", + "nameLocation": "3337:5:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 991, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 988, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "3356:6:8", + "nodeType": "VariableDeclaration", + "scope": 1003, + "src": "3343:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 987, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3343:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 990, + "mutability": "mutable", + "name": "start", + "nameLocation": "3372:5:8", + "nodeType": "VariableDeclaration", + "scope": 1003, + "src": "3364:13:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 989, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3364:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3342:36:8" + }, + "returnParameters": { + "id": 994, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 993, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1003, + "src": "3402:12:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 992, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3402:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "3401:14:8" + }, + "scope": 1632, + "src": "3328:147:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1044, + "nodeType": "Block", + "src": "3959:347:8", + "statements": [ + { + "expression": { + "id": 1022, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1015, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1010, + "src": "3989:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 1018, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1010, + "src": "4004:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 1019, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1006, + "src": "4009:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1020, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4016:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "4009:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1016, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "3995:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1017, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4000:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "3995:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1021, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3995:28:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3989:34:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1023, + "nodeType": "ExpressionStatement", + "src": "3989:34:8" + }, + { + "expression": { + "id": 1030, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1024, + "name": "start", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1008, + "src": "4033:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 1027, + "name": "start", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1008, + "src": "4050:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 1028, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1010, + "src": "4057:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1025, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "4041:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1026, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4046:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "4041:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1029, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4041:20:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4033:28:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1031, + "nodeType": "ExpressionStatement", + "src": "4033:28:8" + }, + { + "assignments": [ + 1033 + ], + "declarations": [ + { + "constant": false, + "id": 1033, + "mutability": "mutable", + "name": "result", + "nameLocation": "4114:6:8", + "nodeType": "VariableDeclaration", + "scope": 1044, + "src": "4101:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1032, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4101:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 1040, + "initialValue": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1038, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1036, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1010, + "src": "4133:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "id": 1037, + "name": "start", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1008, + "src": "4139:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4133:11:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1035, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "4123:9:8", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (uint256) pure returns (bytes memory)" + }, + "typeName": { + "id": 1034, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4127:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + } + }, + "id": 1039, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4123:22:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4101:44:8" + }, + { + "AST": { + "nativeSrc": "4180:96:8", + "nodeType": "YulBlock", + "src": "4180:96:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "result", + "nativeSrc": "4204:6:8", + "nodeType": "YulIdentifier", + "src": "4204:6:8" + }, + { + "kind": "number", + "nativeSrc": "4212:4:8", + "nodeType": "YulLiteral", + "src": "4212:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4200:3:8", + "nodeType": "YulIdentifier", + "src": "4200:3:8" + }, + "nativeSrc": "4200:17:8", + "nodeType": "YulFunctionCall", + "src": "4200:17:8" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "4227:6:8", + "nodeType": "YulIdentifier", + "src": "4227:6:8" + }, + { + "kind": "number", + "nativeSrc": "4235:4:8", + "nodeType": "YulLiteral", + "src": "4235:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4223:3:8", + "nodeType": "YulIdentifier", + "src": "4223:3:8" + }, + "nativeSrc": "4223:17:8", + "nodeType": "YulFunctionCall", + "src": "4223:17:8" + }, + { + "name": "start", + "nativeSrc": "4242:5:8", + "nodeType": "YulIdentifier", + "src": "4242:5:8" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4219:3:8", + "nodeType": "YulIdentifier", + "src": "4219:3:8" + }, + "nativeSrc": "4219:29:8", + "nodeType": "YulFunctionCall", + "src": "4219:29:8" + }, + { + "arguments": [ + { + "name": "end", + "nativeSrc": "4254:3:8", + "nodeType": "YulIdentifier", + "src": "4254:3:8" + }, + { + "name": "start", + "nativeSrc": "4259:5:8", + "nodeType": "YulIdentifier", + "src": "4259:5:8" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "4250:3:8", + "nodeType": "YulIdentifier", + "src": "4250:3:8" + }, + "nativeSrc": "4250:15:8", + "nodeType": "YulFunctionCall", + "src": "4250:15:8" + } + ], + "functionName": { + "name": "mcopy", + "nativeSrc": "4194:5:8", + "nodeType": "YulIdentifier", + "src": "4194:5:8" + }, + "nativeSrc": "4194:72:8", + "nodeType": "YulFunctionCall", + "src": "4194:72:8" + }, + "nativeSrc": "4194:72:8", + "nodeType": "YulExpressionStatement", + "src": "4194:72:8" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 1006, + "isOffset": false, + "isSlot": false, + "src": "4227:6:8", + "valueSize": 1 + }, + { + "declaration": 1010, + "isOffset": false, + "isSlot": false, + "src": "4254:3:8", + "valueSize": 1 + }, + { + "declaration": 1033, + "isOffset": false, + "isSlot": false, + "src": "4204:6:8", + "valueSize": 1 + }, + { + "declaration": 1008, + "isOffset": false, + "isSlot": false, + "src": "4242:5:8", + "valueSize": 1 + }, + { + "declaration": 1008, + "isOffset": false, + "isSlot": false, + "src": "4259:5:8", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 1041, + "nodeType": "InlineAssembly", + "src": "4155:121:8" + }, + { + "expression": { + "id": 1042, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1033, + "src": "4293:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "functionReturnParameters": 1014, + "id": 1043, + "nodeType": "Return", + "src": "4286:13:8" + } + ] + }, + "documentation": { + "id": 1004, + "nodeType": "StructuredDocumentation", + "src": "3481:372:8", + "text": " @dev Copies the content of `buffer`, from `start` (included) to `end` (excluded) into a new bytes object in\n memory. The `end` argument is truncated to the length of the `buffer`.\n NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`]" + }, + "id": 1045, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "slice", + "nameLocation": "3867:5:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1011, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1006, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "3886:6:8", + "nodeType": "VariableDeclaration", + "scope": 1045, + "src": "3873:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1005, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3873:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1008, + "mutability": "mutable", + "name": "start", + "nameLocation": "3902:5:8", + "nodeType": "VariableDeclaration", + "scope": 1045, + "src": "3894:13:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1007, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3894:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1010, + "mutability": "mutable", + "name": "end", + "nameLocation": "3917:3:8", + "nodeType": "VariableDeclaration", + "scope": 1045, + "src": "3909:11:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1009, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3909:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3872:49:8" + }, + "returnParameters": { + "id": 1014, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1013, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1045, + "src": "3945:12:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1012, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3945:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "3944:14:8" + }, + "scope": 1632, + "src": "3858:448:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1062, + "nodeType": "Block", + "src": "4790:60:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 1056, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1048, + "src": "4814:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 1057, + "name": "start", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1050, + "src": "4822:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 1058, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1048, + "src": "4829:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1059, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4836:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "4829:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1055, + "name": "splice", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 1063, + 1096 + ], + "referencedDeclaration": 1096, + "src": "4807:6:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (bytes memory,uint256,uint256) pure returns (bytes memory)" + } + }, + "id": 1060, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4807:36:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "functionReturnParameters": 1054, + "id": 1061, + "nodeType": "Return", + "src": "4800:43:8" + } + ] + }, + "documentation": { + "id": 1046, + "nodeType": "StructuredDocumentation", + "src": "4312:384:8", + "text": " @dev Moves the content of `buffer`, from `start` (included) to the end of `buffer` to the start of that buffer,\n and shrinks the buffer length accordingly, effectively overriding the content of buffer with buffer[start:].\n NOTE: This function modifies the provided buffer in place. If you need to preserve the original buffer, use {slice} instead" + }, + "id": 1063, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "splice", + "nameLocation": "4710:6:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1051, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1048, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "4730:6:8", + "nodeType": "VariableDeclaration", + "scope": 1063, + "src": "4717:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1047, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4717:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1050, + "mutability": "mutable", + "name": "start", + "nameLocation": "4746:5:8", + "nodeType": "VariableDeclaration", + "scope": 1063, + "src": "4738:13:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1049, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4738:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4716:36:8" + }, + "returnParameters": { + "id": 1054, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1053, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1063, + "src": "4776:12:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1052, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4776:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "4775:14:8" + }, + "scope": 1632, + "src": "4701:149:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1095, + "nodeType": "Block", + "src": "5417:335:8", + "statements": [ + { + "expression": { + "id": 1082, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1075, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1070, + "src": "5447:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 1078, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1070, + "src": "5462:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 1079, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1066, + "src": "5467:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1080, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5474:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "5467:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1076, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "5453:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1077, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5458:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "5453:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1081, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5453:28:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5447:34:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1083, + "nodeType": "ExpressionStatement", + "src": "5447:34:8" + }, + { + "expression": { + "id": 1090, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1084, + "name": "start", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1068, + "src": "5491:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 1087, + "name": "start", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1068, + "src": "5508:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 1088, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1070, + "src": "5515:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1085, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "5499:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1086, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5504:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "5499:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1089, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5499:20:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5491:28:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1091, + "nodeType": "ExpressionStatement", + "src": "5491:28:8" + }, + { + "AST": { + "nativeSrc": "5582:140:8", + "nodeType": "YulBlock", + "src": "5582:140:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "5606:6:8", + "nodeType": "YulIdentifier", + "src": "5606:6:8" + }, + { + "kind": "number", + "nativeSrc": "5614:4:8", + "nodeType": "YulLiteral", + "src": "5614:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "5602:3:8", + "nodeType": "YulIdentifier", + "src": "5602:3:8" + }, + "nativeSrc": "5602:17:8", + "nodeType": "YulFunctionCall", + "src": "5602:17:8" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "5629:6:8", + "nodeType": "YulIdentifier", + "src": "5629:6:8" + }, + { + "kind": "number", + "nativeSrc": "5637:4:8", + "nodeType": "YulLiteral", + "src": "5637:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "5625:3:8", + "nodeType": "YulIdentifier", + "src": "5625:3:8" + }, + "nativeSrc": "5625:17:8", + "nodeType": "YulFunctionCall", + "src": "5625:17:8" + }, + { + "name": "start", + "nativeSrc": "5644:5:8", + "nodeType": "YulIdentifier", + "src": "5644:5:8" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "5621:3:8", + "nodeType": "YulIdentifier", + "src": "5621:3:8" + }, + "nativeSrc": "5621:29:8", + "nodeType": "YulFunctionCall", + "src": "5621:29:8" + }, + { + "arguments": [ + { + "name": "end", + "nativeSrc": "5656:3:8", + "nodeType": "YulIdentifier", + "src": "5656:3:8" + }, + { + "name": "start", + "nativeSrc": "5661:5:8", + "nodeType": "YulIdentifier", + "src": "5661:5:8" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "5652:3:8", + "nodeType": "YulIdentifier", + "src": "5652:3:8" + }, + "nativeSrc": "5652:15:8", + "nodeType": "YulFunctionCall", + "src": "5652:15:8" + } + ], + "functionName": { + "name": "mcopy", + "nativeSrc": "5596:5:8", + "nodeType": "YulIdentifier", + "src": "5596:5:8" + }, + "nativeSrc": "5596:72:8", + "nodeType": "YulFunctionCall", + "src": "5596:72:8" + }, + "nativeSrc": "5596:72:8", + "nodeType": "YulExpressionStatement", + "src": "5596:72:8" + }, + { + "expression": { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "5688:6:8", + "nodeType": "YulIdentifier", + "src": "5688:6:8" + }, + { + "arguments": [ + { + "name": "end", + "nativeSrc": "5700:3:8", + "nodeType": "YulIdentifier", + "src": "5700:3:8" + }, + { + "name": "start", + "nativeSrc": "5705:5:8", + "nodeType": "YulIdentifier", + "src": "5705:5:8" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "5696:3:8", + "nodeType": "YulIdentifier", + "src": "5696:3:8" + }, + "nativeSrc": "5696:15:8", + "nodeType": "YulFunctionCall", + "src": "5696:15:8" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "5681:6:8", + "nodeType": "YulIdentifier", + "src": "5681:6:8" + }, + "nativeSrc": "5681:31:8", + "nodeType": "YulFunctionCall", + "src": "5681:31:8" + }, + "nativeSrc": "5681:31:8", + "nodeType": "YulExpressionStatement", + "src": "5681:31:8" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 1066, + "isOffset": false, + "isSlot": false, + "src": "5606:6:8", + "valueSize": 1 + }, + { + "declaration": 1066, + "isOffset": false, + "isSlot": false, + "src": "5629:6:8", + "valueSize": 1 + }, + { + "declaration": 1066, + "isOffset": false, + "isSlot": false, + "src": "5688:6:8", + "valueSize": 1 + }, + { + "declaration": 1070, + "isOffset": false, + "isSlot": false, + "src": "5656:3:8", + "valueSize": 1 + }, + { + "declaration": 1070, + "isOffset": false, + "isSlot": false, + "src": "5700:3:8", + "valueSize": 1 + }, + { + "declaration": 1068, + "isOffset": false, + "isSlot": false, + "src": "5644:5:8", + "valueSize": 1 + }, + { + "declaration": 1068, + "isOffset": false, + "isSlot": false, + "src": "5661:5:8", + "valueSize": 1 + }, + { + "declaration": 1068, + "isOffset": false, + "isSlot": false, + "src": "5705:5:8", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 1092, + "nodeType": "InlineAssembly", + "src": "5557:165:8" + }, + { + "expression": { + "id": 1093, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1066, + "src": "5739:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "functionReturnParameters": 1074, + "id": 1094, + "nodeType": "Return", + "src": "5732:13:8" + } + ] + }, + "documentation": { + "id": 1064, + "nodeType": "StructuredDocumentation", + "src": "4856:454:8", + "text": " @dev Moves the content of `buffer`, from `start` (included) to `end` (excluded) to the start of that buffer,\n and shrinks the buffer length accordingly, effectively overriding the content of buffer with buffer[start:end].\n The `end` argument is truncated to the length of the `buffer`.\n NOTE: This function modifies the provided buffer in place. If you need to preserve the original buffer, use {slice} instead" + }, + "id": 1096, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "splice", + "nameLocation": "5324:6:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1071, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1066, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "5344:6:8", + "nodeType": "VariableDeclaration", + "scope": 1096, + "src": "5331:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1065, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5331:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1068, + "mutability": "mutable", + "name": "start", + "nameLocation": "5360:5:8", + "nodeType": "VariableDeclaration", + "scope": 1096, + "src": "5352:13:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1067, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5352:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1070, + "mutability": "mutable", + "name": "end", + "nameLocation": "5375:3:8", + "nodeType": "VariableDeclaration", + "scope": 1096, + "src": "5367:11:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1069, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5367:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5330:49:8" + }, + "returnParameters": { + "id": 1074, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1073, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1096, + "src": "5403:12:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1072, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5403:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "5402:14:8" + }, + "scope": 1632, + "src": "5315:437:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1117, + "nodeType": "Block", + "src": "6249:80:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 1109, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1099, + "src": "6274:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 1110, + "name": "pos", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1101, + "src": "6282:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 1111, + "name": "replacement", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1103, + "src": "6287:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "hexValue": "30", + "id": 1112, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6300:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "expression": { + "id": 1113, + "name": "replacement", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1103, + "src": "6303:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1114, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6315:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "6303:18:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1108, + "name": "replace", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 1118, + 1174 + ], + "referencedDeclaration": 1174, + "src": "6266:7:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (bytes memory,uint256,bytes memory,uint256,uint256) pure returns (bytes memory)" + } + }, + "id": 1115, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6266:56:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "functionReturnParameters": 1107, + "id": 1116, + "nodeType": "Return", + "src": "6259:63:8" + } + ] + }, + "documentation": { + "id": 1097, + "nodeType": "StructuredDocumentation", + "src": "5758:372:8", + "text": " @dev Replaces bytes in `buffer` starting at `pos` with all bytes from `replacement`.\n Parameters are clamped to valid ranges (i.e. `pos` is clamped to `[0, buffer.length]`).\n If `pos >= buffer.length`, no replacement occurs and the buffer is returned unchanged.\n NOTE: This function modifies the provided buffer in place." + }, + "id": 1118, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "replace", + "nameLocation": "6144:7:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1104, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1099, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "6165:6:8", + "nodeType": "VariableDeclaration", + "scope": 1118, + "src": "6152:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1098, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "6152:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1101, + "mutability": "mutable", + "name": "pos", + "nameLocation": "6181:3:8", + "nodeType": "VariableDeclaration", + "scope": 1118, + "src": "6173:11:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1100, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6173:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1103, + "mutability": "mutable", + "name": "replacement", + "nameLocation": "6199:11:8", + "nodeType": "VariableDeclaration", + "scope": 1118, + "src": "6186:24:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1102, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "6186:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "6151:60:8" + }, + "returnParameters": { + "id": 1107, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1106, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1118, + "src": "6235:12:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1105, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "6235:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "6234:14:8" + }, + "scope": 1632, + "src": "6135:194:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1173, + "nodeType": "Block", + "src": "7180:402:8", + "statements": [ + { + "expression": { + "id": 1141, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1134, + "name": "pos", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1123, + "src": "7210:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 1137, + "name": "pos", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1123, + "src": "7225:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 1138, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1121, + "src": "7230:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1139, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7237:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "7230:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1135, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "7216:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1136, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7221:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "7216:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1140, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7216:28:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7210:34:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1142, + "nodeType": "ExpressionStatement", + "src": "7210:34:8" + }, + { + "expression": { + "id": 1150, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1143, + "name": "offset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1127, + "src": "7254:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 1146, + "name": "offset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1127, + "src": "7272:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 1147, + "name": "replacement", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1125, + "src": "7280:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1148, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7292:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "7280:18:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1144, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "7263:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1145, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7268:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "7263:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1149, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7263:36:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7254:45:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1151, + "nodeType": "ExpressionStatement", + "src": "7254:45:8" + }, + { + "expression": { + "id": 1168, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1152, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1129, + "src": "7309:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 1155, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1129, + "src": "7327:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1161, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 1158, + "name": "replacement", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1125, + "src": "7344:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1159, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7356:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "7344:18:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "id": 1160, + "name": "offset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1127, + "src": "7365:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7344:27:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1165, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 1162, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1121, + "src": "7373:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1163, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7380:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "7373:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "id": 1164, + "name": "pos", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1123, + "src": "7389:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7373:19:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1156, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "7335:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1157, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7340:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "7335:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1166, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7335:58:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1153, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "7318:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1154, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7323:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "7318:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1167, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7318:76:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7309:85:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1169, + "nodeType": "ExpressionStatement", + "src": "7309:85:8" + }, + { + "AST": { + "nativeSrc": "7449:103:8", + "nodeType": "YulBlock", + "src": "7449:103:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "7477:6:8", + "nodeType": "YulIdentifier", + "src": "7477:6:8" + }, + { + "kind": "number", + "nativeSrc": "7485:4:8", + "nodeType": "YulLiteral", + "src": "7485:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7473:3:8", + "nodeType": "YulIdentifier", + "src": "7473:3:8" + }, + "nativeSrc": "7473:17:8", + "nodeType": "YulFunctionCall", + "src": "7473:17:8" + }, + { + "name": "pos", + "nativeSrc": "7492:3:8", + "nodeType": "YulIdentifier", + "src": "7492:3:8" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7469:3:8", + "nodeType": "YulIdentifier", + "src": "7469:3:8" + }, + "nativeSrc": "7469:27:8", + "nodeType": "YulFunctionCall", + "src": "7469:27:8" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "replacement", + "nativeSrc": "7506:11:8", + "nodeType": "YulIdentifier", + "src": "7506:11:8" + }, + { + "kind": "number", + "nativeSrc": "7519:4:8", + "nodeType": "YulLiteral", + "src": "7519:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7502:3:8", + "nodeType": "YulIdentifier", + "src": "7502:3:8" + }, + "nativeSrc": "7502:22:8", + "nodeType": "YulFunctionCall", + "src": "7502:22:8" + }, + { + "name": "offset", + "nativeSrc": "7526:6:8", + "nodeType": "YulIdentifier", + "src": "7526:6:8" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7498:3:8", + "nodeType": "YulIdentifier", + "src": "7498:3:8" + }, + "nativeSrc": "7498:35:8", + "nodeType": "YulFunctionCall", + "src": "7498:35:8" + }, + { + "name": "length", + "nativeSrc": "7535:6:8", + "nodeType": "YulIdentifier", + "src": "7535:6:8" + } + ], + "functionName": { + "name": "mcopy", + "nativeSrc": "7463:5:8", + "nodeType": "YulIdentifier", + "src": "7463:5:8" + }, + "nativeSrc": "7463:79:8", + "nodeType": "YulFunctionCall", + "src": "7463:79:8" + }, + "nativeSrc": "7463:79:8", + "nodeType": "YulExpressionStatement", + "src": "7463:79:8" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 1121, + "isOffset": false, + "isSlot": false, + "src": "7477:6:8", + "valueSize": 1 + }, + { + "declaration": 1129, + "isOffset": false, + "isSlot": false, + "src": "7535:6:8", + "valueSize": 1 + }, + { + "declaration": 1127, + "isOffset": false, + "isSlot": false, + "src": "7526:6:8", + "valueSize": 1 + }, + { + "declaration": 1123, + "isOffset": false, + "isSlot": false, + "src": "7492:3:8", + "valueSize": 1 + }, + { + "declaration": 1125, + "isOffset": false, + "isSlot": false, + "src": "7506:11:8", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 1170, + "nodeType": "InlineAssembly", + "src": "7424:128:8" + }, + { + "expression": { + "id": 1171, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1121, + "src": "7569:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "functionReturnParameters": 1133, + "id": 1172, + "nodeType": "Return", + "src": "7562:13:8" + } + ] + }, + "documentation": { + "id": 1119, + "nodeType": "StructuredDocumentation", + "src": "6335:648:8", + "text": " @dev Replaces bytes in `buffer` starting at `pos` with bytes from `replacement` starting at `offset`.\n Copies at most `length` bytes from `replacement` to `buffer`.\n Parameters are clamped to valid ranges (i.e. `pos` is clamped to `[0, buffer.length]`, `offset` is\n clamped to `[0, replacement.length]`, and `length` is clamped to `min(length, replacement.length - offset,\n buffer.length - pos))`. If `pos >= buffer.length` or `offset >= replacement.length`, no replacement occurs\n and the buffer is returned unchanged.\n NOTE: This function modifies the provided buffer in place." + }, + "id": 1174, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "replace", + "nameLocation": "6997:7:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1130, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1121, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "7027:6:8", + "nodeType": "VariableDeclaration", + "scope": 1174, + "src": "7014:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1120, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "7014:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1123, + "mutability": "mutable", + "name": "pos", + "nameLocation": "7051:3:8", + "nodeType": "VariableDeclaration", + "scope": 1174, + "src": "7043:11:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1122, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7043:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1125, + "mutability": "mutable", + "name": "replacement", + "nameLocation": "7077:11:8", + "nodeType": "VariableDeclaration", + "scope": 1174, + "src": "7064:24:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1124, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "7064:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1127, + "mutability": "mutable", + "name": "offset", + "nameLocation": "7106:6:8", + "nodeType": "VariableDeclaration", + "scope": 1174, + "src": "7098:14:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1126, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7098:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1129, + "mutability": "mutable", + "name": "length", + "nameLocation": "7130:6:8", + "nodeType": "VariableDeclaration", + "scope": 1174, + "src": "7122:14:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1128, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7122:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7004:138:8" + }, + "returnParameters": { + "id": 1133, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1132, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1174, + "src": "7166:12:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1131, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "7166:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "7165:14:8" + }, + "scope": 1632, + "src": "6988:594:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1246, + "nodeType": "Block", + "src": "8119:563:8", + "statements": [ + { + "assignments": [ + 1184 + ], + "declarations": [ + { + "constant": false, + "id": 1184, + "mutability": "mutable", + "name": "length", + "nameLocation": "8137:6:8", + "nodeType": "VariableDeclaration", + "scope": 1246, + "src": "8129:14:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1183, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8129:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 1186, + "initialValue": { + "hexValue": "30", + "id": 1185, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8146:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "8129:18:8" + }, + { + "body": { + "id": 1205, + "nodeType": "Block", + "src": "8202:52:8", + "statements": [ + { + "expression": { + "id": 1203, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1198, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1184, + "src": "8216:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "expression": { + "baseExpression": { + "id": 1199, + "name": "buffers", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1178, + "src": "8226:7:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_memory_ptr_$dyn_memory_ptr", + "typeString": "bytes memory[] memory" + } + }, + "id": 1201, + "indexExpression": { + "id": 1200, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1188, + "src": "8234:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8226:10:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1202, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "8237:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "8226:17:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8216:27:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1204, + "nodeType": "ExpressionStatement", + "src": "8216:27:8" + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1194, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1191, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1188, + "src": "8177:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "expression": { + "id": 1192, + "name": "buffers", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1178, + "src": "8181:7:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_memory_ptr_$dyn_memory_ptr", + "typeString": "bytes memory[] memory" + } + }, + "id": 1193, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "8189:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "8181:14:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8177:18:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 1206, + "initializationExpression": { + "assignments": [ + 1188 + ], + "declarations": [ + { + "constant": false, + "id": 1188, + "mutability": "mutable", + "name": "i", + "nameLocation": "8170:1:8", + "nodeType": "VariableDeclaration", + "scope": 1206, + "src": "8162:9:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1187, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8162:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 1190, + "initialValue": { + "hexValue": "30", + "id": 1189, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8174:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "8162:13:8" + }, + "isSimpleCounterLoop": true, + "loopExpression": { + "expression": { + "id": 1196, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": true, + "src": "8197:3:8", + "subExpression": { + "id": 1195, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1188, + "src": "8199:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1197, + "nodeType": "ExpressionStatement", + "src": "8197:3:8" + }, + "nodeType": "ForStatement", + "src": "8157:97:8" + }, + { + "assignments": [ + 1208 + ], + "declarations": [ + { + "constant": false, + "id": 1208, + "mutability": "mutable", + "name": "result", + "nameLocation": "8277:6:8", + "nodeType": "VariableDeclaration", + "scope": 1246, + "src": "8264:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1207, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "8264:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 1213, + "initialValue": { + "arguments": [ + { + "id": 1211, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1184, + "src": "8296:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1210, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "8286:9:8", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (uint256) pure returns (bytes memory)" + }, + "typeName": { + "id": 1209, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "8290:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + } + }, + "id": 1212, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8286:17:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8264:39:8" + }, + { + "assignments": [ + 1215 + ], + "declarations": [ + { + "constant": false, + "id": 1215, + "mutability": "mutable", + "name": "offset", + "nameLocation": "8322:6:8", + "nodeType": "VariableDeclaration", + "scope": 1246, + "src": "8314:14:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1214, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8314:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 1217, + "initialValue": { + "hexValue": "30783230", + "id": 1216, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8331:4:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "0x20" + }, + "nodeType": "VariableDeclarationStatement", + "src": "8314:21:8" + }, + { + "body": { + "id": 1242, + "nodeType": "Block", + "src": "8390:262:8", + "statements": [ + { + "assignments": [ + 1230 + ], + "declarations": [ + { + "constant": false, + "id": 1230, + "mutability": "mutable", + "name": "input", + "nameLocation": "8417:5:8", + "nodeType": "VariableDeclaration", + "scope": 1242, + "src": "8404:18:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1229, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "8404:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 1234, + "initialValue": { + "baseExpression": { + "id": 1231, + "name": "buffers", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1178, + "src": "8425:7:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_memory_ptr_$dyn_memory_ptr", + "typeString": "bytes memory[] memory" + } + }, + "id": 1233, + "indexExpression": { + "id": 1232, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1219, + "src": "8433:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8425:10:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8404:31:8" + }, + { + "AST": { + "nativeSrc": "8474:90:8", + "nodeType": "YulBlock", + "src": "8474:90:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "result", + "nativeSrc": "8502:6:8", + "nodeType": "YulIdentifier", + "src": "8502:6:8" + }, + { + "name": "offset", + "nativeSrc": "8510:6:8", + "nodeType": "YulIdentifier", + "src": "8510:6:8" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8498:3:8", + "nodeType": "YulIdentifier", + "src": "8498:3:8" + }, + "nativeSrc": "8498:19:8", + "nodeType": "YulFunctionCall", + "src": "8498:19:8" + }, + { + "arguments": [ + { + "name": "input", + "nativeSrc": "8523:5:8", + "nodeType": "YulIdentifier", + "src": "8523:5:8" + }, + { + "kind": "number", + "nativeSrc": "8530:4:8", + "nodeType": "YulLiteral", + "src": "8530:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8519:3:8", + "nodeType": "YulIdentifier", + "src": "8519:3:8" + }, + "nativeSrc": "8519:16:8", + "nodeType": "YulFunctionCall", + "src": "8519:16:8" + }, + { + "arguments": [ + { + "name": "input", + "nativeSrc": "8543:5:8", + "nodeType": "YulIdentifier", + "src": "8543:5:8" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "8537:5:8", + "nodeType": "YulIdentifier", + "src": "8537:5:8" + }, + "nativeSrc": "8537:12:8", + "nodeType": "YulFunctionCall", + "src": "8537:12:8" + } + ], + "functionName": { + "name": "mcopy", + "nativeSrc": "8492:5:8", + "nodeType": "YulIdentifier", + "src": "8492:5:8" + }, + "nativeSrc": "8492:58:8", + "nodeType": "YulFunctionCall", + "src": "8492:58:8" + }, + "nativeSrc": "8492:58:8", + "nodeType": "YulExpressionStatement", + "src": "8492:58:8" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 1230, + "isOffset": false, + "isSlot": false, + "src": "8523:5:8", + "valueSize": 1 + }, + { + "declaration": 1230, + "isOffset": false, + "isSlot": false, + "src": "8543:5:8", + "valueSize": 1 + }, + { + "declaration": 1215, + "isOffset": false, + "isSlot": false, + "src": "8510:6:8", + "valueSize": 1 + }, + { + "declaration": 1208, + "isOffset": false, + "isSlot": false, + "src": "8502:6:8", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 1235, + "nodeType": "InlineAssembly", + "src": "8449:115:8" + }, + { + "id": 1241, + "nodeType": "UncheckedBlock", + "src": "8577:65:8", + "statements": [ + { + "expression": { + "id": 1239, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1236, + "name": "offset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1215, + "src": "8605:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "expression": { + "id": 1237, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1230, + "src": "8615:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1238, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "8621:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "8615:12:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8605:22:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1240, + "nodeType": "ExpressionStatement", + "src": "8605:22:8" + } + ] + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1225, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1222, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1219, + "src": "8365:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "expression": { + "id": 1223, + "name": "buffers", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1178, + "src": "8369:7:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_memory_ptr_$dyn_memory_ptr", + "typeString": "bytes memory[] memory" + } + }, + "id": 1224, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "8377:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "8369:14:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8365:18:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 1243, + "initializationExpression": { + "assignments": [ + 1219 + ], + "declarations": [ + { + "constant": false, + "id": 1219, + "mutability": "mutable", + "name": "i", + "nameLocation": "8358:1:8", + "nodeType": "VariableDeclaration", + "scope": 1243, + "src": "8350:9:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1218, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8350:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 1221, + "initialValue": { + "hexValue": "30", + "id": 1220, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8362:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "8350:13:8" + }, + "isSimpleCounterLoop": true, + "loopExpression": { + "expression": { + "id": 1227, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": true, + "src": "8385:3:8", + "subExpression": { + "id": 1226, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1219, + "src": "8387:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1228, + "nodeType": "ExpressionStatement", + "src": "8385:3:8" + }, + "nodeType": "ForStatement", + "src": "8345:307:8" + }, + { + "expression": { + "id": 1244, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1208, + "src": "8669:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "functionReturnParameters": 1182, + "id": 1245, + "nodeType": "Return", + "src": "8662:13:8" + } + ] + }, + "documentation": { + "id": 1175, + "nodeType": "StructuredDocumentation", + "src": "7588:449:8", + "text": " @dev Concatenate an array of bytes into a single bytes object.\n For fixed bytes types, we recommend using the solidity built-in `bytes.concat` or (equivalent)\n `abi.encodePacked`.\n NOTE: this could be done in assembly with a single loop that expands starting at the FMP, but that would be\n significantly less readable. It might be worth benchmarking the savings of the full-assembly approach." + }, + "id": 1247, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "concat", + "nameLocation": "8051:6:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1179, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1178, + "mutability": "mutable", + "name": "buffers", + "nameLocation": "8073:7:8", + "nodeType": "VariableDeclaration", + "scope": 1247, + "src": "8058:22:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_memory_ptr_$dyn_memory_ptr", + "typeString": "bytes[]" + }, + "typeName": { + "baseType": { + "id": 1176, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "8058:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "id": 1177, + "nodeType": "ArrayTypeName", + "src": "8058:7:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_storage_$dyn_storage_ptr", + "typeString": "bytes[]" + } + }, + "visibility": "internal" + } + ], + "src": "8057:24:8" + }, + "returnParameters": { + "id": 1182, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1181, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1247, + "src": "8105:12:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1180, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "8105:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "8104:14:8" + }, + "scope": 1632, + "src": "8042:640:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1256, + "nodeType": "Block", + "src": "8920:1416:8", + "statements": [ + { + "AST": { + "nativeSrc": "8955:1375:8", + "nodeType": "YulBlock", + "src": "8955:1375:8", + "statements": [ + { + "nativeSrc": "8969:26:8", + "nodeType": "YulVariableDeclaration", + "src": "8969:26:8", + "value": { + "arguments": [ + { + "name": "input", + "nativeSrc": "8989:5:8", + "nodeType": "YulIdentifier", + "src": "8989:5:8" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "8983:5:8", + "nodeType": "YulIdentifier", + "src": "8983:5:8" + }, + "nativeSrc": "8983:12:8", + "nodeType": "YulFunctionCall", + "src": "8983:12:8" + }, + "variables": [ + { + "name": "length", + "nativeSrc": "8973:6:8", + "nodeType": "YulTypedName", + "src": "8973:6:8", + "type": "" + } + ] + }, + { + "nativeSrc": "9008:21:8", + "nodeType": "YulAssignment", + "src": "9008:21:8", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9024:4:8", + "nodeType": "YulLiteral", + "src": "9024:4:8", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "9018:5:8", + "nodeType": "YulIdentifier", + "src": "9018:5:8" + }, + "nativeSrc": "9018:11:8", + "nodeType": "YulFunctionCall", + "src": "9018:11:8" + }, + "variableNames": [ + { + "name": "output", + "nativeSrc": "9008:6:8", + "nodeType": "YulIdentifier", + "src": "9008:6:8" + } + ] + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9049:4:8", + "nodeType": "YulLiteral", + "src": "9049:4:8", + "type": "", + "value": "0x40" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "output", + "nativeSrc": "9063:6:8", + "nodeType": "YulIdentifier", + "src": "9063:6:8" + }, + { + "kind": "number", + "nativeSrc": "9071:4:8", + "nodeType": "YulLiteral", + "src": "9071:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9059:3:8", + "nodeType": "YulIdentifier", + "src": "9059:3:8" + }, + "nativeSrc": "9059:17:8", + "nodeType": "YulFunctionCall", + "src": "9059:17:8" + }, + { + "arguments": [ + { + "name": "length", + "nativeSrc": "9082:6:8", + "nodeType": "YulIdentifier", + "src": "9082:6:8" + }, + { + "kind": "number", + "nativeSrc": "9090:1:8", + "nodeType": "YulLiteral", + "src": "9090:1:8", + "type": "", + "value": "2" + } + ], + "functionName": { + "name": "mul", + "nativeSrc": "9078:3:8", + "nodeType": "YulIdentifier", + "src": "9078:3:8" + }, + "nativeSrc": "9078:14:8", + "nodeType": "YulFunctionCall", + "src": "9078:14:8" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9055:3:8", + "nodeType": "YulIdentifier", + "src": "9055:3:8" + }, + "nativeSrc": "9055:38:8", + "nodeType": "YulFunctionCall", + "src": "9055:38:8" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "9042:6:8", + "nodeType": "YulIdentifier", + "src": "9042:6:8" + }, + "nativeSrc": "9042:52:8", + "nodeType": "YulFunctionCall", + "src": "9042:52:8" + }, + "nativeSrc": "9042:52:8", + "nodeType": "YulExpressionStatement", + "src": "9042:52:8" + }, + { + "expression": { + "arguments": [ + { + "name": "output", + "nativeSrc": "9114:6:8", + "nodeType": "YulIdentifier", + "src": "9114:6:8" + }, + { + "arguments": [ + { + "name": "length", + "nativeSrc": "9126:6:8", + "nodeType": "YulIdentifier", + "src": "9126:6:8" + }, + { + "kind": "number", + "nativeSrc": "9134:1:8", + "nodeType": "YulLiteral", + "src": "9134:1:8", + "type": "", + "value": "2" + } + ], + "functionName": { + "name": "mul", + "nativeSrc": "9122:3:8", + "nodeType": "YulIdentifier", + "src": "9122:3:8" + }, + "nativeSrc": "9122:14:8", + "nodeType": "YulFunctionCall", + "src": "9122:14:8" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "9107:6:8", + "nodeType": "YulIdentifier", + "src": "9107:6:8" + }, + "nativeSrc": "9107:30:8", + "nodeType": "YulFunctionCall", + "src": "9107:30:8" + }, + "nativeSrc": "9107:30:8", + "nodeType": "YulExpressionStatement", + "src": "9107:30:8" + }, + { + "body": { + "nativeSrc": "9261:1059:8", + "nodeType": "YulBlock", + "src": "9261:1059:8", + "statements": [ + { + "nativeSrc": "9279:54:8", + "nodeType": "YulVariableDeclaration", + "src": "9279:54:8", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9296:3:8", + "nodeType": "YulLiteral", + "src": "9296:3:8", + "type": "", + "value": "128" + }, + { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "input", + "nativeSrc": "9315:5:8", + "nodeType": "YulIdentifier", + "src": "9315:5:8" + }, + { + "kind": "number", + "nativeSrc": "9322:4:8", + "nodeType": "YulLiteral", + "src": "9322:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9311:3:8", + "nodeType": "YulIdentifier", + "src": "9311:3:8" + }, + "nativeSrc": "9311:16:8", + "nodeType": "YulFunctionCall", + "src": "9311:16:8" + }, + { + "name": "i", + "nativeSrc": "9329:1:8", + "nodeType": "YulIdentifier", + "src": "9329:1:8" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9307:3:8", + "nodeType": "YulIdentifier", + "src": "9307:3:8" + }, + "nativeSrc": "9307:24:8", + "nodeType": "YulFunctionCall", + "src": "9307:24:8" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "9301:5:8", + "nodeType": "YulIdentifier", + "src": "9301:5:8" + }, + "nativeSrc": "9301:31:8", + "nodeType": "YulFunctionCall", + "src": "9301:31:8" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "9292:3:8", + "nodeType": "YulIdentifier", + "src": "9292:3:8" + }, + "nativeSrc": "9292:41:8", + "nodeType": "YulFunctionCall", + "src": "9292:41:8" + }, + "variables": [ + { + "name": "chunk", + "nativeSrc": "9283:5:8", + "nodeType": "YulTypedName", + "src": "9283:5:8", + "type": "" + } + ] + }, + { + "nativeSrc": "9350:165:8", + "nodeType": "YulAssignment", + "src": "9350:165:8", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9384:66:8", + "nodeType": "YulLiteral", + "src": "9384:66:8", + "type": "", + "value": "0x0000000000000000ffffffffffffffff0000000000000000ffffffffffffffff" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9479:2:8", + "nodeType": "YulLiteral", + "src": "9479:2:8", + "type": "", + "value": "64" + }, + { + "name": "chunk", + "nativeSrc": "9483:5:8", + "nodeType": "YulIdentifier", + "src": "9483:5:8" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "9475:3:8", + "nodeType": "YulIdentifier", + "src": "9475:3:8" + }, + "nativeSrc": "9475:14:8", + "nodeType": "YulFunctionCall", + "src": "9475:14:8" + }, + { + "name": "chunk", + "nativeSrc": "9491:5:8", + "nodeType": "YulIdentifier", + "src": "9491:5:8" + } + ], + "functionName": { + "name": "or", + "nativeSrc": "9472:2:8", + "nodeType": "YulIdentifier", + "src": "9472:2:8" + }, + "nativeSrc": "9472:25:8", + "nodeType": "YulFunctionCall", + "src": "9472:25:8" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "9359:3:8", + "nodeType": "YulIdentifier", + "src": "9359:3:8" + }, + "nativeSrc": "9359:156:8", + "nodeType": "YulFunctionCall", + "src": "9359:156:8" + }, + "variableNames": [ + { + "name": "chunk", + "nativeSrc": "9350:5:8", + "nodeType": "YulIdentifier", + "src": "9350:5:8" + } + ] + }, + { + "nativeSrc": "9532:165:8", + "nodeType": "YulAssignment", + "src": "9532:165:8", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9566:66:8", + "nodeType": "YulLiteral", + "src": "9566:66:8", + "type": "", + "value": "0x00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9661:2:8", + "nodeType": "YulLiteral", + "src": "9661:2:8", + "type": "", + "value": "32" + }, + { + "name": "chunk", + "nativeSrc": "9665:5:8", + "nodeType": "YulIdentifier", + "src": "9665:5:8" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "9657:3:8", + "nodeType": "YulIdentifier", + "src": "9657:3:8" + }, + "nativeSrc": "9657:14:8", + "nodeType": "YulFunctionCall", + "src": "9657:14:8" + }, + { + "name": "chunk", + "nativeSrc": "9673:5:8", + "nodeType": "YulIdentifier", + "src": "9673:5:8" + } + ], + "functionName": { + "name": "or", + "nativeSrc": "9654:2:8", + "nodeType": "YulIdentifier", + "src": "9654:2:8" + }, + "nativeSrc": "9654:25:8", + "nodeType": "YulFunctionCall", + "src": "9654:25:8" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "9541:3:8", + "nodeType": "YulIdentifier", + "src": "9541:3:8" + }, + "nativeSrc": "9541:156:8", + "nodeType": "YulFunctionCall", + "src": "9541:156:8" + }, + "variableNames": [ + { + "name": "chunk", + "nativeSrc": "9532:5:8", + "nodeType": "YulIdentifier", + "src": "9532:5:8" + } + ] + }, + { + "nativeSrc": "9714:165:8", + "nodeType": "YulAssignment", + "src": "9714:165:8", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9748:66:8", + "nodeType": "YulLiteral", + "src": "9748:66:8", + "type": "", + "value": "0x0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9843:2:8", + "nodeType": "YulLiteral", + "src": "9843:2:8", + "type": "", + "value": "16" + }, + { + "name": "chunk", + "nativeSrc": "9847:5:8", + "nodeType": "YulIdentifier", + "src": "9847:5:8" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "9839:3:8", + "nodeType": "YulIdentifier", + "src": "9839:3:8" + }, + "nativeSrc": "9839:14:8", + "nodeType": "YulFunctionCall", + "src": "9839:14:8" + }, + { + "name": "chunk", + "nativeSrc": "9855:5:8", + "nodeType": "YulIdentifier", + "src": "9855:5:8" + } + ], + "functionName": { + "name": "or", + "nativeSrc": "9836:2:8", + "nodeType": "YulIdentifier", + "src": "9836:2:8" + }, + "nativeSrc": "9836:25:8", + "nodeType": "YulFunctionCall", + "src": "9836:25:8" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "9723:3:8", + "nodeType": "YulIdentifier", + "src": "9723:3:8" + }, + "nativeSrc": "9723:156:8", + "nodeType": "YulFunctionCall", + "src": "9723:156:8" + }, + "variableNames": [ + { + "name": "chunk", + "nativeSrc": "9714:5:8", + "nodeType": "YulIdentifier", + "src": "9714:5:8" + } + ] + }, + { + "nativeSrc": "9896:164:8", + "nodeType": "YulAssignment", + "src": "9896:164:8", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9930:66:8", + "nodeType": "YulLiteral", + "src": "9930:66:8", + "type": "", + "value": "0x00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10025:1:8", + "nodeType": "YulLiteral", + "src": "10025:1:8", + "type": "", + "value": "8" + }, + { + "name": "chunk", + "nativeSrc": "10028:5:8", + "nodeType": "YulIdentifier", + "src": "10028:5:8" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "10021:3:8", + "nodeType": "YulIdentifier", + "src": "10021:3:8" + }, + "nativeSrc": "10021:13:8", + "nodeType": "YulFunctionCall", + "src": "10021:13:8" + }, + { + "name": "chunk", + "nativeSrc": "10036:5:8", + "nodeType": "YulIdentifier", + "src": "10036:5:8" + } + ], + "functionName": { + "name": "or", + "nativeSrc": "10018:2:8", + "nodeType": "YulIdentifier", + "src": "10018:2:8" + }, + "nativeSrc": "10018:24:8", + "nodeType": "YulFunctionCall", + "src": "10018:24:8" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "9905:3:8", + "nodeType": "YulIdentifier", + "src": "9905:3:8" + }, + "nativeSrc": "9905:155:8", + "nodeType": "YulFunctionCall", + "src": "9905:155:8" + }, + "variableNames": [ + { + "name": "chunk", + "nativeSrc": "9896:5:8", + "nodeType": "YulIdentifier", + "src": "9896:5:8" + } + ] + }, + { + "nativeSrc": "10077:164:8", + "nodeType": "YulAssignment", + "src": "10077:164:8", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10111:66:8", + "nodeType": "YulLiteral", + "src": "10111:66:8", + "type": "", + "value": "0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10206:1:8", + "nodeType": "YulLiteral", + "src": "10206:1:8", + "type": "", + "value": "4" + }, + { + "name": "chunk", + "nativeSrc": "10209:5:8", + "nodeType": "YulIdentifier", + "src": "10209:5:8" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "10202:3:8", + "nodeType": "YulIdentifier", + "src": "10202:3:8" + }, + "nativeSrc": "10202:13:8", + "nodeType": "YulFunctionCall", + "src": "10202:13:8" + }, + { + "name": "chunk", + "nativeSrc": "10217:5:8", + "nodeType": "YulIdentifier", + "src": "10217:5:8" + } + ], + "functionName": { + "name": "or", + "nativeSrc": "10199:2:8", + "nodeType": "YulIdentifier", + "src": "10199:2:8" + }, + "nativeSrc": "10199:24:8", + "nodeType": "YulFunctionCall", + "src": "10199:24:8" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "10086:3:8", + "nodeType": "YulIdentifier", + "src": "10086:3:8" + }, + "nativeSrc": "10086:155:8", + "nodeType": "YulFunctionCall", + "src": "10086:155:8" + }, + "variableNames": [ + { + "name": "chunk", + "nativeSrc": "10077:5:8", + "nodeType": "YulIdentifier", + "src": "10077:5:8" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "output", + "nativeSrc": "10273:6:8", + "nodeType": "YulIdentifier", + "src": "10273:6:8" + }, + { + "kind": "number", + "nativeSrc": "10281:4:8", + "nodeType": "YulLiteral", + "src": "10281:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10269:3:8", + "nodeType": "YulIdentifier", + "src": "10269:3:8" + }, + "nativeSrc": "10269:17:8", + "nodeType": "YulFunctionCall", + "src": "10269:17:8" + }, + { + "arguments": [ + { + "name": "i", + "nativeSrc": "10292:1:8", + "nodeType": "YulIdentifier", + "src": "10292:1:8" + }, + { + "kind": "number", + "nativeSrc": "10295:1:8", + "nodeType": "YulLiteral", + "src": "10295:1:8", + "type": "", + "value": "2" + } + ], + "functionName": { + "name": "mul", + "nativeSrc": "10288:3:8", + "nodeType": "YulIdentifier", + "src": "10288:3:8" + }, + "nativeSrc": "10288:9:8", + "nodeType": "YulFunctionCall", + "src": "10288:9:8" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10265:3:8", + "nodeType": "YulIdentifier", + "src": "10265:3:8" + }, + "nativeSrc": "10265:33:8", + "nodeType": "YulFunctionCall", + "src": "10265:33:8" + }, + { + "name": "chunk", + "nativeSrc": "10300:5:8", + "nodeType": "YulIdentifier", + "src": "10300:5:8" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10258:6:8", + "nodeType": "YulIdentifier", + "src": "10258:6:8" + }, + "nativeSrc": "10258:48:8", + "nodeType": "YulFunctionCall", + "src": "10258:48:8" + }, + "nativeSrc": "10258:48:8", + "nodeType": "YulExpressionStatement", + "src": "10258:48:8" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "i", + "nativeSrc": "9200:1:8", + "nodeType": "YulIdentifier", + "src": "9200:1:8" + }, + { + "name": "length", + "nativeSrc": "9203:6:8", + "nodeType": "YulIdentifier", + "src": "9203:6:8" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "9197:2:8", + "nodeType": "YulIdentifier", + "src": "9197:2:8" + }, + "nativeSrc": "9197:13:8", + "nodeType": "YulFunctionCall", + "src": "9197:13:8" + }, + "nativeSrc": "9150:1170:8", + "nodeType": "YulForLoop", + "post": { + "nativeSrc": "9211:49:8", + "nodeType": "YulBlock", + "src": "9211:49:8", + "statements": [ + { + "nativeSrc": "9229:17:8", + "nodeType": "YulAssignment", + "src": "9229:17:8", + "value": { + "arguments": [ + { + "name": "i", + "nativeSrc": "9238:1:8", + "nodeType": "YulIdentifier", + "src": "9238:1:8" + }, + { + "kind": "number", + "nativeSrc": "9241:4:8", + "nodeType": "YulLiteral", + "src": "9241:4:8", + "type": "", + "value": "0x10" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9234:3:8", + "nodeType": "YulIdentifier", + "src": "9234:3:8" + }, + "nativeSrc": "9234:12:8", + "nodeType": "YulFunctionCall", + "src": "9234:12:8" + }, + "variableNames": [ + { + "name": "i", + "nativeSrc": "9229:1:8", + "nodeType": "YulIdentifier", + "src": "9229:1:8" + } + ] + } + ] + }, + "pre": { + "nativeSrc": "9154:42:8", + "nodeType": "YulBlock", + "src": "9154:42:8", + "statements": [ + { + "nativeSrc": "9172:10:8", + "nodeType": "YulVariableDeclaration", + "src": "9172:10:8", + "value": { + "kind": "number", + "nativeSrc": "9181:1:8", + "nodeType": "YulLiteral", + "src": "9181:1:8", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "i", + "nativeSrc": "9176:1:8", + "nodeType": "YulTypedName", + "src": "9176:1:8", + "type": "" + } + ] + } + ] + }, + "src": "9150:1170:8" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 1250, + "isOffset": false, + "isSlot": false, + "src": "8989:5:8", + "valueSize": 1 + }, + { + "declaration": 1250, + "isOffset": false, + "isSlot": false, + "src": "9315:5:8", + "valueSize": 1 + }, + { + "declaration": 1253, + "isOffset": false, + "isSlot": false, + "src": "10273:6:8", + "valueSize": 1 + }, + { + "declaration": 1253, + "isOffset": false, + "isSlot": false, + "src": "9008:6:8", + "valueSize": 1 + }, + { + "declaration": 1253, + "isOffset": false, + "isSlot": false, + "src": "9063:6:8", + "valueSize": 1 + }, + { + "declaration": 1253, + "isOffset": false, + "isSlot": false, + "src": "9114:6:8", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 1255, + "nodeType": "InlineAssembly", + "src": "8930:1400:8" + } + ] + }, + "documentation": { + "id": 1248, + "nodeType": "StructuredDocumentation", + "src": "8688:144:8", + "text": " @dev Split each byte in `input` into two nibbles (4 bits each)\n Example: hex\"01234567\" → hex\"0001020304050607\"" + }, + "id": 1257, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toNibbles", + "nameLocation": "8846:9:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1251, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1250, + "mutability": "mutable", + "name": "input", + "nameLocation": "8869:5:8", + "nodeType": "VariableDeclaration", + "scope": 1257, + "src": "8856:18:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1249, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "8856:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "8855:20:8" + }, + "returnParameters": { + "id": 1254, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1253, + "mutability": "mutable", + "name": "output", + "nameLocation": "8912:6:8", + "nodeType": "VariableDeclaration", + "scope": 1257, + "src": "8899:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1252, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "8899:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "8898:21:8" + }, + "scope": 1632, + "src": "8837:1499:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1281, + "nodeType": "Block", + "src": "10494:76:8", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 1279, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1271, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 1267, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1260, + "src": "10511:1:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1268, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "10513:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "10511:8:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "expression": { + "id": 1269, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1262, + "src": "10523:1:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1270, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "10525:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "10523:8:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10511:20:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1278, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 1273, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1260, + "src": "10545:1:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 1272, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "10535:9:8", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 1274, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10535:12:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "arguments": [ + { + "id": 1276, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1262, + "src": "10561:1:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 1275, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "10551:9:8", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 1277, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10551:12:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "10535:28:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "10511:52:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 1266, + "id": 1280, + "nodeType": "Return", + "src": "10504:59:8" + } + ] + }, + "documentation": { + "id": 1258, + "nodeType": "StructuredDocumentation", + "src": "10342:71:8", + "text": " @dev Returns true if the two byte buffers are equal." + }, + "id": 1282, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "equal", + "nameLocation": "10427:5:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1263, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1260, + "mutability": "mutable", + "name": "a", + "nameLocation": "10446:1:8", + "nodeType": "VariableDeclaration", + "scope": 1282, + "src": "10433:14:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1259, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "10433:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1262, + "mutability": "mutable", + "name": "b", + "nameLocation": "10462:1:8", + "nodeType": "VariableDeclaration", + "scope": 1282, + "src": "10449:14:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1261, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "10449:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "10432:32:8" + }, + "returnParameters": { + "id": 1266, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1265, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1282, + "src": "10488:4:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 1264, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "10488:4:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "10487:6:8" + }, + "scope": 1632, + "src": "10418:152:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1372, + "nodeType": "Block", + "src": "10874:1024:8", + "statements": [ + { + "expression": { + "id": 1306, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1290, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "10884:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1305, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1296, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1293, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1291, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "10920:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "38", + "id": 1292, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10929:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "10920:10:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1294, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "10919:12:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830304646303046463030464630304646303046463030464630304646303046463030464630304646303046463030464630304646303046463030464630304646", + "id": 1295, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10934:66:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_450552876409790643671482431940419874915447411150352389258589821042463539455_by_1", + "typeString": "int_const 4505...(67 digits omitted)...9455" + }, + "value": "0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF" + }, + "src": "10919:81:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1297, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "10918:83:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1303, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1300, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1298, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11018:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830304646303046463030464630304646303046463030464630304646303046463030464630304646303046463030464630304646303046463030464630304646", + "id": 1299, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11026:66:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_450552876409790643671482431940419874915447411150352389258589821042463539455_by_1", + "typeString": "int_const 4505...(67 digits omitted)...9455" + }, + "value": "0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF" + }, + "src": "11018:74:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1301, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11017:76:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "38", + "id": 1302, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11097:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "11017:81:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1304, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11016:83:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "10918:181:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "10884:215:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 1307, + "nodeType": "ExpressionStatement", + "src": "10884:215:8" + }, + { + "expression": { + "id": 1324, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1308, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11109:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1323, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1314, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1311, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1309, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11157:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "3136", + "id": 1310, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11166:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "11157:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1312, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11156:13:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830303030464646463030303046464646303030304646464630303030464646463030303046464646303030304646464630303030464646463030303046464646", + "id": 1313, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11172:66:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_1766820105243087041267848467410591083712559083657179364930612997358944255_by_1", + "typeString": "int_const 1766...(65 digits omitted)...4255" + }, + "value": "0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF" + }, + "src": "11156:82:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1315, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11155:84:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1321, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1318, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1316, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11256:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830303030464646463030303046464646303030304646464630303030464646463030303046464646303030304646464630303030464646463030303046464646", + "id": 1317, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11264:66:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_1766820105243087041267848467410591083712559083657179364930612997358944255_by_1", + "typeString": "int_const 1766...(65 digits omitted)...4255" + }, + "value": "0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF" + }, + "src": "11256:74:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1319, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11255:76:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3136", + "id": 1320, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11335:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "11255:82:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1322, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11254:84:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "11155:183:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "11109:229:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 1325, + "nodeType": "ExpressionStatement", + "src": "11109:229:8" + }, + { + "expression": { + "id": 1342, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1326, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11348:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1341, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1332, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1329, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1327, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11396:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "3332", + "id": 1328, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11405:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "11396:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1330, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11395:13:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830303030303030304646464646464646303030303030303046464646464646463030303030303030464646464646464630303030303030304646464646464646", + "id": 1331, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11411:66:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_26959946660873538060741835960174461801791452538186943042387869433855_by_1", + "typeString": "int_const 2695...(60 digits omitted)...3855" + }, + "value": "0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF" + }, + "src": "11395:82:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1333, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11394:84:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1339, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1336, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1334, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11495:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830303030303030304646464646464646303030303030303046464646464646463030303030303030464646464646464630303030303030304646464646464646", + "id": 1335, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11503:66:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_26959946660873538060741835960174461801791452538186943042387869433855_by_1", + "typeString": "int_const 2695...(60 digits omitted)...3855" + }, + "value": "0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF" + }, + "src": "11495:74:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1337, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11494:76:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3332", + "id": 1338, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11574:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "11494:82:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1340, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11493:84:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "11394:183:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "11348:229:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 1343, + "nodeType": "ExpressionStatement", + "src": "11348:229:8" + }, + { + "expression": { + "id": 1360, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1344, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11587:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1359, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1350, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1347, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1345, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11635:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "3634", + "id": 1346, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11644:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "11635:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1348, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11634:13:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830303030303030303030303030303030464646464646464646464646464646463030303030303030303030303030303046464646464646464646464646464646", + "id": 1349, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11650:66:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_6277101735386680763495507056286727952657427581105975853055_by_1", + "typeString": "int_const 6277...(50 digits omitted)...3055" + }, + "value": "0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF" + }, + "src": "11634:82:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1351, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11633:84:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1357, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1354, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1352, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11734:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830303030303030303030303030303030464646464646464646464646464646463030303030303030303030303030303046464646464646464646464646464646", + "id": 1353, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11742:66:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_6277101735386680763495507056286727952657427581105975853055_by_1", + "typeString": "int_const 6277...(50 digits omitted)...3055" + }, + "value": "0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF" + }, + "src": "11734:74:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1355, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11733:76:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3634", + "id": 1356, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11813:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "11733:82:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1358, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11732:84:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "11633:183:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "11587:229:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 1361, + "nodeType": "ExpressionStatement", + "src": "11587:229:8" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1370, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1364, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1362, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11834:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "313238", + "id": 1363, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11843:3:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_128_by_1", + "typeString": "int_const 128" + }, + "value": "128" + }, + "src": "11834:12:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1365, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11833:14:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1368, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1366, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11851:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "313238", + "id": 1367, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11860:3:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_128_by_1", + "typeString": "int_const 128" + }, + "value": "128" + }, + "src": "11851:12:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1369, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11850:14:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "11833:31:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 1289, + "id": 1371, + "nodeType": "Return", + "src": "11826:38:8" + } + ] + }, + "documentation": { + "id": 1283, + "nodeType": "StructuredDocumentation", + "src": "10576:222:8", + "text": " @dev Reverses the byte order of a bytes32 value, converting between little-endian and big-endian.\n Inspired by https://graphics.stanford.edu/~seander/bithacks.html#ReverseParallel[Reverse Parallel]" + }, + "id": 1373, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "reverseBytes32", + "nameLocation": "10812:14:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1286, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1285, + "mutability": "mutable", + "name": "value", + "nameLocation": "10835:5:8", + "nodeType": "VariableDeclaration", + "scope": 1373, + "src": "10827:13:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 1284, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "10827:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "10826:15:8" + }, + "returnParameters": { + "id": 1289, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1288, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1373, + "src": "10865:7:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 1287, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "10865:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "10864:9:8" + }, + "scope": 1632, + "src": "10803:1095:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1445, + "nodeType": "Block", + "src": "12047:590:8", + "statements": [ + { + "expression": { + "id": 1397, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1381, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12057:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1396, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1387, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1384, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1382, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12093:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30784646303046463030464630304646303046463030464630304646303046463030", + "id": 1383, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12101:34:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_338958311018522360492699998064329424640_by_1", + "typeString": "int_const 3389...(31 digits omitted)...4640" + }, + "value": "0xFF00FF00FF00FF00FF00FF00FF00FF00" + }, + "src": "12093:42:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1385, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12092:44:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "38", + "id": 1386, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12140:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "12092:49:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1388, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12091:51:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1394, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1391, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1389, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12159:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30783030464630304646303046463030464630304646303046463030464630304646", + "id": 1390, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12167:34:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_1324055902416102970674609367438786815_by_1", + "typeString": "int_const 1324...(29 digits omitted)...6815" + }, + "value": "0x00FF00FF00FF00FF00FF00FF00FF00FF" + }, + "src": "12159:42:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1392, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12158:44:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "38", + "id": 1393, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12206:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "12158:49:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1395, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12157:51:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "src": "12091:117:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "src": "12057:151:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "id": 1398, + "nodeType": "ExpressionStatement", + "src": "12057:151:8" + }, + { + "expression": { + "id": 1415, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1399, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12218:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1414, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1405, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1402, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1400, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12266:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30784646464630303030464646463030303046464646303030304646464630303030", + "id": 1401, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12274:34:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_340277174703306882242637262502835978240_by_1", + "typeString": "int_const 3402...(31 digits omitted)...8240" + }, + "value": "0xFFFF0000FFFF0000FFFF0000FFFF0000" + }, + "src": "12266:42:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1403, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12265:44:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "3136", + "id": 1404, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12313:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "12265:50:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1406, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12264:52:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1412, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1409, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1407, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12333:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30783030303046464646303030304646464630303030464646463030303046464646", + "id": 1408, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12341:34:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_5192217631581220737344928932233215_by_1", + "typeString": "int_const 5192...(26 digits omitted)...3215" + }, + "value": "0x0000FFFF0000FFFF0000FFFF0000FFFF" + }, + "src": "12333:42:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1410, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12332:44:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3136", + "id": 1411, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12380:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "12332:50:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1413, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12331:52:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "src": "12264:119:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "src": "12218:165:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "id": 1416, + "nodeType": "ExpressionStatement", + "src": "12218:165:8" + }, + { + "expression": { + "id": 1433, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1417, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12393:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1432, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1423, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1420, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1418, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12441:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30784646464646464646303030303030303046464646464646463030303030303030", + "id": 1419, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12449:34:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_340282366841710300967557013907638845440_by_1", + "typeString": "int_const 3402...(31 digits omitted)...5440" + }, + "value": "0xFFFFFFFF00000000FFFFFFFF00000000" + }, + "src": "12441:42:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1421, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12440:44:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "3332", + "id": 1422, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12488:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "12440:50:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1424, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12439:52:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1430, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1427, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1425, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12508:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30783030303030303030464646464646464630303030303030304646464646464646", + "id": 1426, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12516:34:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_79228162495817593524129366015_by_1", + "typeString": "int_const 79228162495817593524129366015" + }, + "value": "0x00000000FFFFFFFF00000000FFFFFFFF" + }, + "src": "12508:42:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1428, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12507:44:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3332", + "id": 1429, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12555:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "12507:50:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1431, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12506:52:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "src": "12439:119:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "src": "12393:165:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "id": 1434, + "nodeType": "ExpressionStatement", + "src": "12393:165:8" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1443, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1437, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1435, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12576:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "3634", + "id": 1436, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12585:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "12576:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1438, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12575:13:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1441, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1439, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12592:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3634", + "id": 1440, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12601:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "12592:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1442, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12591:13:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "src": "12575:29:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "functionReturnParameters": 1380, + "id": 1444, + "nodeType": "Return", + "src": "12568:36:8" + } + ] + }, + "documentation": { + "id": 1374, + "nodeType": "StructuredDocumentation", + "src": "11904:67:8", + "text": "@dev Same as {reverseBytes32} but optimized for 128-bit values." + }, + "id": 1446, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "reverseBytes16", + "nameLocation": "11985:14:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1377, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1376, + "mutability": "mutable", + "name": "value", + "nameLocation": "12008:5:8", + "nodeType": "VariableDeclaration", + "scope": 1446, + "src": "12000:13:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "typeName": { + "id": 1375, + "name": "bytes16", + "nodeType": "ElementaryTypeName", + "src": "12000:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "visibility": "internal" + } + ], + "src": "11999:15:8" + }, + "returnParameters": { + "id": 1380, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1379, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1446, + "src": "12038:7:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "typeName": { + "id": 1378, + "name": "bytes16", + "nodeType": "ElementaryTypeName", + "src": "12038:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "visibility": "internal" + } + ], + "src": "12037:9:8" + }, + "scope": 1632, + "src": "11976:661:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1500, + "nodeType": "Block", + "src": "12782:303:8", + "statements": [ + { + "expression": { + "id": 1470, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1454, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1449, + "src": "12792:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1469, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1460, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1457, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1455, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1449, + "src": "12802:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307846463030464630304646303046463030", + "id": 1456, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12810:18:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_18374966859414961920_by_1", + "typeString": "int_const 18374966859414961920" + }, + "value": "0xFF00FF00FF00FF00" + }, + "src": "12802:26:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1458, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12801:28:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "38", + "id": 1459, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12833:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "12801:33:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1461, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12800:35:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1467, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1464, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1462, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1449, + "src": "12840:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830304646303046463030464630304646", + "id": 1463, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12848:18:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_71777214294589695_by_1", + "typeString": "int_const 71777214294589695" + }, + "value": "0x00FF00FF00FF00FF" + }, + "src": "12840:26:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1465, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12839:28:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "38", + "id": 1466, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12871:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "12839:33:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1468, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12838:35:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "src": "12800:73:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "src": "12792:81:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "id": 1471, + "nodeType": "ExpressionStatement", + "src": "12792:81:8" + }, + { + "expression": { + "id": 1488, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1472, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1449, + "src": "12897:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1487, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1478, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1475, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1473, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1449, + "src": "12907:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307846464646303030304646464630303030", + "id": 1474, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12915:18:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_18446462603027742720_by_1", + "typeString": "int_const 18446462603027742720" + }, + "value": "0xFFFF0000FFFF0000" + }, + "src": "12907:26:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1476, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12906:28:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "3136", + "id": 1477, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12938:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "12906:34:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1479, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12905:36:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1485, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1482, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1480, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1449, + "src": "12946:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830303030464646463030303046464646", + "id": 1481, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12954:18:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_281470681808895_by_1", + "typeString": "int_const 281470681808895" + }, + "value": "0x0000FFFF0000FFFF" + }, + "src": "12946:26:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1483, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12945:28:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3136", + "id": 1484, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12977:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "12945:34:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1486, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12944:36:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "src": "12905:75:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "src": "12897:83:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "id": 1489, + "nodeType": "ExpressionStatement", + "src": "12897:83:8" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1498, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1492, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1490, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1449, + "src": "13024:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "3332", + "id": 1491, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13033:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "13024:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1493, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13023:13:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1496, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1494, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1449, + "src": "13040:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3332", + "id": 1495, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13049:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "13040:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1497, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13039:13:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "src": "13023:29:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "functionReturnParameters": 1453, + "id": 1499, + "nodeType": "Return", + "src": "13016:36:8" + } + ] + }, + "documentation": { + "id": 1447, + "nodeType": "StructuredDocumentation", + "src": "12643:66:8", + "text": "@dev Same as {reverseBytes32} but optimized for 64-bit values." + }, + "id": 1501, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "reverseBytes8", + "nameLocation": "12723:13:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1450, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1449, + "mutability": "mutable", + "name": "value", + "nameLocation": "12744:5:8", + "nodeType": "VariableDeclaration", + "scope": 1501, + "src": "12737:12:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "typeName": { + "id": 1448, + "name": "bytes8", + "nodeType": "ElementaryTypeName", + "src": "12737:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "visibility": "internal" + } + ], + "src": "12736:14:8" + }, + "returnParameters": { + "id": 1453, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1452, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1501, + "src": "12774:6:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "typeName": { + "id": 1451, + "name": "bytes8", + "nodeType": "ElementaryTypeName", + "src": "12774:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "visibility": "internal" + } + ], + "src": "12773:8:8" + }, + "scope": 1632, + "src": "12714:371:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1537, + "nodeType": "Block", + "src": "13230:168:8", + "statements": [ + { + "expression": { + "id": 1525, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1509, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1504, + "src": "13240:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "id": 1524, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "id": 1515, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "id": 1512, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1510, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1504, + "src": "13250:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30784646303046463030", + "id": 1511, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13258:10:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_4278255360_by_1", + "typeString": "int_const 4278255360" + }, + "value": "0xFF00FF00" + }, + "src": "13250:18:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + } + ], + "id": 1513, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13249:20:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "38", + "id": 1514, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13273:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "13249:25:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + } + ], + "id": 1516, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13248:27:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "id": 1522, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "id": 1519, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1517, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1504, + "src": "13280:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30783030464630304646", + "id": 1518, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13288:10:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_16711935_by_1", + "typeString": "int_const 16711935" + }, + "value": "0x00FF00FF" + }, + "src": "13280:18:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + } + ], + "id": 1520, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13279:20:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "38", + "id": 1521, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13303:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "13279:25:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + } + ], + "id": 1523, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13278:27:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "src": "13248:57:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "src": "13240:65:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "id": 1526, + "nodeType": "ExpressionStatement", + "src": "13240:65:8" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "id": 1535, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "id": 1529, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1527, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1504, + "src": "13337:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "3136", + "id": 1528, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13346:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "13337:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + } + ], + "id": 1530, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13336:13:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "id": 1533, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1531, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1504, + "src": "13353:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3136", + "id": 1532, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13362:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "13353:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + } + ], + "id": 1534, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13352:13:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "src": "13336:29:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "functionReturnParameters": 1508, + "id": 1536, + "nodeType": "Return", + "src": "13329:36:8" + } + ] + }, + "documentation": { + "id": 1502, + "nodeType": "StructuredDocumentation", + "src": "13091:66:8", + "text": "@dev Same as {reverseBytes32} but optimized for 32-bit values." + }, + "id": 1538, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "reverseBytes4", + "nameLocation": "13171:13:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1505, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1504, + "mutability": "mutable", + "name": "value", + "nameLocation": "13192:5:8", + "nodeType": "VariableDeclaration", + "scope": 1538, + "src": "13185:12:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "typeName": { + "id": 1503, + "name": "bytes4", + "nodeType": "ElementaryTypeName", + "src": "13185:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "visibility": "internal" + } + ], + "src": "13184:14:8" + }, + "returnParameters": { + "id": 1508, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1507, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1538, + "src": "13222:6:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "typeName": { + "id": 1506, + "name": "bytes4", + "nodeType": "ElementaryTypeName", + "src": "13222:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "visibility": "internal" + } + ], + "src": "13221:8:8" + }, + "scope": 1632, + "src": "13162:236:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1556, + "nodeType": "Block", + "src": "13543:51:8", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + }, + "id": 1554, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + }, + "id": 1548, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1546, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1541, + "src": "13561:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "38", + "id": 1547, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13570:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "13561:10:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + } + ], + "id": 1549, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13560:12:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + }, + "id": 1552, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1550, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1541, + "src": "13576:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "38", + "id": 1551, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13585:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "13576:10:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + } + ], + "id": 1553, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13575:12:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "src": "13560:27:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "functionReturnParameters": 1545, + "id": 1555, + "nodeType": "Return", + "src": "13553:34:8" + } + ] + }, + "documentation": { + "id": 1539, + "nodeType": "StructuredDocumentation", + "src": "13404:66:8", + "text": "@dev Same as {reverseBytes32} but optimized for 16-bit values." + }, + "id": 1557, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "reverseBytes2", + "nameLocation": "13484:13:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1542, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1541, + "mutability": "mutable", + "name": "value", + "nameLocation": "13505:5:8", + "nodeType": "VariableDeclaration", + "scope": 1557, + "src": "13498:12:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + }, + "typeName": { + "id": 1540, + "name": "bytes2", + "nodeType": "ElementaryTypeName", + "src": "13498:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "visibility": "internal" + } + ], + "src": "13497:14:8" + }, + "returnParameters": { + "id": 1545, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1544, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1557, + "src": "13535:6:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + }, + "typeName": { + "id": 1543, + "name": "bytes2", + "nodeType": "ElementaryTypeName", + "src": "13535:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "visibility": "internal" + } + ], + "src": "13534:8:8" + }, + "scope": 1632, + "src": "13475:119:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1618, + "nodeType": "Block", + "src": "13811:313:8", + "statements": [ + { + "body": { + "id": 1611, + "nodeType": "Block", + "src": "13871:213:8", + "statements": [ + { + "assignments": [ + 1578 + ], + "declarations": [ + { + "constant": false, + "id": 1578, + "mutability": "mutable", + "name": "chunk", + "nameLocation": "13893:5:8", + "nodeType": "VariableDeclaration", + "scope": 1611, + "src": "13885:13:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 1577, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "13885:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 1583, + "initialValue": { + "arguments": [ + { + "id": 1580, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1560, + "src": "13924:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 1581, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1566, + "src": "13932:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1579, + "name": "_unsafeReadBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1631, + "src": "13901:22:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (bytes memory,uint256) pure returns (bytes32)" + } + }, + "id": 1582, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13901:33:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "13885:49:8" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1589, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1584, + "name": "chunk", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1578, + "src": "13952:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 1587, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13969:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 1586, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "13961:7:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes32_$", + "typeString": "type(bytes32)" + }, + "typeName": { + "id": 1585, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "13961:7:8", + "typeDescriptions": {} + } + }, + "id": 1588, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13961:10:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "13952:19:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 1610, + "nodeType": "IfStatement", + "src": "13948:126:8", + "trueBody": { + "id": 1609, + "nodeType": "Block", + "src": "13973:101:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1602, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1594, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "38", + "id": 1592, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14007:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 1593, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1566, + "src": "14011:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "14007:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "arguments": [ + { + "arguments": [ + { + "id": 1599, + "name": "chunk", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1578, + "src": "14032:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 1598, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "14024:7:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 1597, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "14024:7:8", + "typeDescriptions": {} + } + }, + "id": 1600, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14024:14:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1595, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "14015:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1596, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "14020:3:8", + "memberName": "clz", + "nodeType": "MemberAccess", + "referencedDeclaration": 6203, + "src": "14015:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256) pure returns (uint256)" + } + }, + "id": 1601, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14015:24:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "14007:32:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1606, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "38", + "id": 1603, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14041:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "expression": { + "id": 1604, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1560, + "src": "14045:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1605, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "14052:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "14045:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "14041:17:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1590, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "13998:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1591, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "14003:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "13998:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1607, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13998:61:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 1564, + "id": 1608, + "nodeType": "Return", + "src": "13991:68:8" + } + ] + } + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1572, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1569, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1566, + "src": "13841:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "expression": { + "id": 1570, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1560, + "src": "13845:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1571, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "13852:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "13845:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "13841:17:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 1612, + "initializationExpression": { + "assignments": [ + 1566 + ], + "declarations": [ + { + "constant": false, + "id": 1566, + "mutability": "mutable", + "name": "i", + "nameLocation": "13834:1:8", + "nodeType": "VariableDeclaration", + "scope": 1612, + "src": "13826:9:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1565, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13826:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 1568, + "initialValue": { + "hexValue": "30", + "id": 1567, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13838:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "13826:13:8" + }, + "isSimpleCounterLoop": false, + "loopExpression": { + "expression": { + "id": 1575, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1573, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1566, + "src": "13860:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "hexValue": "30783230", + "id": 1574, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13865:4:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "0x20" + }, + "src": "13860:9:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1576, + "nodeType": "ExpressionStatement", + "src": "13860:9:8" + }, + "nodeType": "ForStatement", + "src": "13821:263:8" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1616, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "38", + "id": 1613, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14100:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "expression": { + "id": 1614, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1560, + "src": "14104:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1615, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "14111:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "14104:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "14100:17:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 1564, + "id": 1617, + "nodeType": "Return", + "src": "14093:24:8" + } + ] + }, + "documentation": { + "id": 1558, + "nodeType": "StructuredDocumentation", + "src": "13600:140:8", + "text": " @dev Counts the number of leading zero bits a bytes array. Returns `8 * buffer.length`\n if the buffer is all zeros." + }, + "id": 1619, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "clz", + "nameLocation": "13754:3:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1561, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1560, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "13771:6:8", + "nodeType": "VariableDeclaration", + "scope": 1619, + "src": "13758:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1559, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "13758:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "13757:21:8" + }, + "returnParameters": { + "id": 1564, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1563, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1619, + "src": "13802:7:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1562, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13802:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "13801:9:8" + }, + "scope": 1632, + "src": "13745:379:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1630, + "nodeType": "Block", + "src": "14509:225:8", + "statements": [ + { + "AST": { + "nativeSrc": "14658:70:8", + "nodeType": "YulBlock", + "src": "14658:70:8", + "statements": [ + { + "nativeSrc": "14672:46:8", + "nodeType": "YulAssignment", + "src": "14672:46:8", + "value": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "14695:6:8", + "nodeType": "YulIdentifier", + "src": "14695:6:8" + }, + { + "kind": "number", + "nativeSrc": "14703:4:8", + "nodeType": "YulLiteral", + "src": "14703:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "14691:3:8", + "nodeType": "YulIdentifier", + "src": "14691:3:8" + }, + "nativeSrc": "14691:17:8", + "nodeType": "YulFunctionCall", + "src": "14691:17:8" + }, + { + "name": "offset", + "nativeSrc": "14710:6:8", + "nodeType": "YulIdentifier", + "src": "14710:6:8" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "14687:3:8", + "nodeType": "YulIdentifier", + "src": "14687:3:8" + }, + "nativeSrc": "14687:30:8", + "nodeType": "YulFunctionCall", + "src": "14687:30:8" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "14681:5:8", + "nodeType": "YulIdentifier", + "src": "14681:5:8" + }, + "nativeSrc": "14681:37:8", + "nodeType": "YulFunctionCall", + "src": "14681:37:8" + }, + "variableNames": [ + { + "name": "value", + "nativeSrc": "14672:5:8", + "nodeType": "YulIdentifier", + "src": "14672:5:8" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 1622, + "isOffset": false, + "isSlot": false, + "src": "14695:6:8", + "valueSize": 1 + }, + { + "declaration": 1624, + "isOffset": false, + "isSlot": false, + "src": "14710:6:8", + "valueSize": 1 + }, + { + "declaration": 1627, + "isOffset": false, + "isSlot": false, + "src": "14672:5:8", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 1629, + "nodeType": "InlineAssembly", + "src": "14633:95:8" + } + ] + }, + "documentation": { + "id": 1620, + "nodeType": "StructuredDocumentation", + "src": "14130:268:8", + "text": " @dev Reads a bytes32 from a bytes array without bounds checking.\n NOTE: making this function internal would mean it could be used with memory unsafe offset, and marking the\n assembly block as such would prevent some optimizations." + }, + "id": 1631, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_unsafeReadBytesOffset", + "nameLocation": "14412:22:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1625, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1622, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "14448:6:8", + "nodeType": "VariableDeclaration", + "scope": 1631, + "src": "14435:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1621, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "14435:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1624, + "mutability": "mutable", + "name": "offset", + "nameLocation": "14464:6:8", + "nodeType": "VariableDeclaration", + "scope": 1631, + "src": "14456:14:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1623, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "14456:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "14434:37:8" + }, + "returnParameters": { + "id": 1628, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1627, + "mutability": "mutable", + "name": "value", + "nameLocation": "14502:5:8", + "nodeType": "VariableDeclaration", + "scope": 1631, + "src": "14494:13:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 1626, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "14494:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "14493:15:8" + }, + "scope": 1632, + "src": "14403:331:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "private" + } + ], + "scope": 1633, + "src": "198:14538:8", + "usedErrors": [], + "usedEvents": [] + } + ], + "src": "99:14638:8" + }, + "id": 8 + }, + "@openzeppelin/contracts/utils/Context.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/Context.sol", + "exportedSymbols": { + "Context": [ + 1662 + ] + }, + "id": 1663, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1634, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "101:24:9" + }, + { + "abstract": true, + "baseContracts": [], + "canonicalName": "Context", + "contractDependencies": [], + "contractKind": "contract", + "documentation": { + "id": 1635, + "nodeType": "StructuredDocumentation", + "src": "127:496:9", + "text": " @dev Provides information about the current execution context, including the\n sender of the transaction and its data. While these are generally available\n via msg.sender and msg.data, they should not be accessed in such a direct\n manner, since when dealing with meta-transactions the account sending and\n paying for execution may not be the actual sender (as far as an application\n is concerned).\n This contract is only required for intermediate, library-like contracts." + }, + "fullyImplemented": true, + "id": 1662, + "linearizedBaseContracts": [ + 1662 + ], + "name": "Context", + "nameLocation": "642:7:9", + "nodeType": "ContractDefinition", + "nodes": [ + { + "body": { + "id": 1643, + "nodeType": "Block", + "src": "718:34:9", + "statements": [ + { + "expression": { + "expression": { + "id": 1640, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -15, + "src": "735:3:9", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 1641, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "739:6:9", + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "735:10:9", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 1639, + "id": 1642, + "nodeType": "Return", + "src": "728:17:9" + } + ] + }, + "id": 1644, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_msgSender", + "nameLocation": "665:10:9", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1636, + "nodeType": "ParameterList", + "parameters": [], + "src": "675:2:9" + }, + "returnParameters": { + "id": 1639, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1638, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1644, + "src": "709:7:9", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 1637, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "709:7:9", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "708:9:9" + }, + "scope": 1662, + "src": "656:96:9", + "stateMutability": "view", + "virtual": true, + "visibility": "internal" + }, + { + "body": { + "id": 1652, + "nodeType": "Block", + "src": "825:32:9", + "statements": [ + { + "expression": { + "expression": { + "id": 1649, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -15, + "src": "842:3:9", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 1650, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "846:4:9", + "memberName": "data", + "nodeType": "MemberAccess", + "src": "842:8:9", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + } + }, + "functionReturnParameters": 1648, + "id": 1651, + "nodeType": "Return", + "src": "835:15:9" + } + ] + }, + "id": 1653, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_msgData", + "nameLocation": "767:8:9", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1645, + "nodeType": "ParameterList", + "parameters": [], + "src": "775:2:9" + }, + "returnParameters": { + "id": 1648, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1647, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1653, + "src": "809:14:9", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1646, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "809:5:9", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "808:16:9" + }, + "scope": 1662, + "src": "758:99:9", + "stateMutability": "view", + "virtual": true, + "visibility": "internal" + }, + { + "body": { + "id": 1660, + "nodeType": "Block", + "src": "935:25:9", + "statements": [ + { + "expression": { + "hexValue": "30", + "id": 1658, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "952:1:9", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "functionReturnParameters": 1657, + "id": 1659, + "nodeType": "Return", + "src": "945:8:9" + } + ] + }, + "id": 1661, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_contextSuffixLength", + "nameLocation": "872:20:9", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1654, + "nodeType": "ParameterList", + "parameters": [], + "src": "892:2:9" + }, + "returnParameters": { + "id": 1657, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1656, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1661, + "src": "926:7:9", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1655, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "926:7:9", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "925:9:9" + }, + "scope": 1662, + "src": "863:97:9", + "stateMutability": "view", + "virtual": true, + "visibility": "internal" + } + ], + "scope": 1663, + "src": "624:338:9", + "usedErrors": [], + "usedEvents": [] + } + ], + "src": "101:862:9" + }, + "id": 9 + }, + "@openzeppelin/contracts/utils/Panic.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/Panic.sol", + "exportedSymbols": { + "Panic": [ + 1714 + ] + }, + "id": 1715, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1664, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "99:24:10" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "Panic", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 1665, + "nodeType": "StructuredDocumentation", + "src": "125:489:10", + "text": " @dev Helper library for emitting standardized panic codes.\n ```solidity\n contract Example {\n using Panic for uint256;\n // Use any of the declared internal constants\n function foo() { Panic.GENERIC.panic(); }\n // Alternatively\n function foo() { Panic.panic(Panic.GENERIC); }\n }\n ```\n Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil].\n _Available since v5.1._" + }, + "fullyImplemented": true, + "id": 1714, + "linearizedBaseContracts": [ + 1714 + ], + "name": "Panic", + "nameLocation": "665:5:10", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": true, + "documentation": { + "id": 1666, + "nodeType": "StructuredDocumentation", + "src": "677:36:10", + "text": "@dev generic / unspecified error" + }, + "id": 1669, + "mutability": "constant", + "name": "GENERIC", + "nameLocation": "744:7:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "718:40:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1667, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "718:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783030", + "id": 1668, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "754:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0x00" + }, + "visibility": "internal" + }, + { + "constant": true, + "documentation": { + "id": 1670, + "nodeType": "StructuredDocumentation", + "src": "764:37:10", + "text": "@dev used by the assert() builtin" + }, + "id": 1673, + "mutability": "constant", + "name": "ASSERT", + "nameLocation": "832:6:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "806:39:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1671, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "806:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783031", + "id": 1672, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "841:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "0x01" + }, + "visibility": "internal" + }, + { + "constant": true, + "documentation": { + "id": 1674, + "nodeType": "StructuredDocumentation", + "src": "851:41:10", + "text": "@dev arithmetic underflow or overflow" + }, + "id": 1677, + "mutability": "constant", + "name": "UNDER_OVERFLOW", + "nameLocation": "923:14:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "897:47:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1675, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "897:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783131", + "id": 1676, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "940:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_17_by_1", + "typeString": "int_const 17" + }, + "value": "0x11" + }, + "visibility": "internal" + }, + { + "constant": true, + "documentation": { + "id": 1678, + "nodeType": "StructuredDocumentation", + "src": "950:35:10", + "text": "@dev division or modulo by zero" + }, + "id": 1681, + "mutability": "constant", + "name": "DIVISION_BY_ZERO", + "nameLocation": "1016:16:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "990:49:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1679, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "990:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783132", + "id": 1680, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1035:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_18_by_1", + "typeString": "int_const 18" + }, + "value": "0x12" + }, + "visibility": "internal" + }, + { + "constant": true, + "documentation": { + "id": 1682, + "nodeType": "StructuredDocumentation", + "src": "1045:30:10", + "text": "@dev enum conversion error" + }, + "id": 1685, + "mutability": "constant", + "name": "ENUM_CONVERSION_ERROR", + "nameLocation": "1106:21:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "1080:54:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1683, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1080:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783231", + "id": 1684, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1130:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_33_by_1", + "typeString": "int_const 33" + }, + "value": "0x21" + }, + "visibility": "internal" + }, + { + "constant": true, + "documentation": { + "id": 1686, + "nodeType": "StructuredDocumentation", + "src": "1140:36:10", + "text": "@dev invalid encoding in storage" + }, + "id": 1689, + "mutability": "constant", + "name": "STORAGE_ENCODING_ERROR", + "nameLocation": "1207:22:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "1181:55:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1687, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1181:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783232", + "id": 1688, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1232:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_34_by_1", + "typeString": "int_const 34" + }, + "value": "0x22" + }, + "visibility": "internal" + }, + { + "constant": true, + "documentation": { + "id": 1690, + "nodeType": "StructuredDocumentation", + "src": "1242:24:10", + "text": "@dev empty array pop" + }, + "id": 1693, + "mutability": "constant", + "name": "EMPTY_ARRAY_POP", + "nameLocation": "1297:15:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "1271:48:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1691, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1271:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783331", + "id": 1692, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1315:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_49_by_1", + "typeString": "int_const 49" + }, + "value": "0x31" + }, + "visibility": "internal" + }, + { + "constant": true, + "documentation": { + "id": 1694, + "nodeType": "StructuredDocumentation", + "src": "1325:35:10", + "text": "@dev array out of bounds access" + }, + "id": 1697, + "mutability": "constant", + "name": "ARRAY_OUT_OF_BOUNDS", + "nameLocation": "1391:19:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "1365:52:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1695, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1365:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783332", + "id": 1696, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1413:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_50_by_1", + "typeString": "int_const 50" + }, + "value": "0x32" + }, + "visibility": "internal" + }, + { + "constant": true, + "documentation": { + "id": 1698, + "nodeType": "StructuredDocumentation", + "src": "1423:65:10", + "text": "@dev resource error (too large allocation or too large array)" + }, + "id": 1701, + "mutability": "constant", + "name": "RESOURCE_ERROR", + "nameLocation": "1519:14:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "1493:47:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1699, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1493:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783431", + "id": 1700, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1536:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_65_by_1", + "typeString": "int_const 65" + }, + "value": "0x41" + }, + "visibility": "internal" + }, + { + "constant": true, + "documentation": { + "id": 1702, + "nodeType": "StructuredDocumentation", + "src": "1546:42:10", + "text": "@dev calling invalid internal function" + }, + "id": 1705, + "mutability": "constant", + "name": "INVALID_INTERNAL_FUNCTION", + "nameLocation": "1619:25:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "1593:58:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1703, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1593:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783531", + "id": 1704, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1647:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_81_by_1", + "typeString": "int_const 81" + }, + "value": "0x51" + }, + "visibility": "internal" + }, + { + "body": { + "id": 1712, + "nodeType": "Block", + "src": "1819:151:10", + "statements": [ + { + "AST": { + "nativeSrc": "1854:110:10", + "nodeType": "YulBlock", + "src": "1854:110:10", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1875:4:10", + "nodeType": "YulLiteral", + "src": "1875:4:10", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "1881:10:10", + "nodeType": "YulLiteral", + "src": "1881:10:10", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1868:6:10", + "nodeType": "YulIdentifier", + "src": "1868:6:10" + }, + "nativeSrc": "1868:24:10", + "nodeType": "YulFunctionCall", + "src": "1868:24:10" + }, + "nativeSrc": "1868:24:10", + "nodeType": "YulExpressionStatement", + "src": "1868:24:10" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1912:4:10", + "nodeType": "YulLiteral", + "src": "1912:4:10", + "type": "", + "value": "0x20" + }, + { + "name": "code", + "nativeSrc": "1918:4:10", + "nodeType": "YulIdentifier", + "src": "1918:4:10" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1905:6:10", + "nodeType": "YulIdentifier", + "src": "1905:6:10" + }, + "nativeSrc": "1905:18:10", + "nodeType": "YulFunctionCall", + "src": "1905:18:10" + }, + "nativeSrc": "1905:18:10", + "nodeType": "YulExpressionStatement", + "src": "1905:18:10" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1943:4:10", + "nodeType": "YulLiteral", + "src": "1943:4:10", + "type": "", + "value": "0x1c" + }, + { + "kind": "number", + "nativeSrc": "1949:4:10", + "nodeType": "YulLiteral", + "src": "1949:4:10", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "1936:6:10", + "nodeType": "YulIdentifier", + "src": "1936:6:10" + }, + "nativeSrc": "1936:18:10", + "nodeType": "YulFunctionCall", + "src": "1936:18:10" + }, + "nativeSrc": "1936:18:10", + "nodeType": "YulExpressionStatement", + "src": "1936:18:10" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 1708, + "isOffset": false, + "isSlot": false, + "src": "1918:4:10", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 1711, + "nodeType": "InlineAssembly", + "src": "1829:135:10" + } + ] + }, + "documentation": { + "id": 1706, + "nodeType": "StructuredDocumentation", + "src": "1658:113:10", + "text": "@dev Reverts with a panic code. Recommended to use with\n the internal constants with predefined codes." + }, + "id": 1713, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "panic", + "nameLocation": "1785:5:10", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1709, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1708, + "mutability": "mutable", + "name": "code", + "nameLocation": "1799:4:10", + "nodeType": "VariableDeclaration", + "scope": 1713, + "src": "1791:12:10", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1707, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1791:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1790:14:10" + }, + "returnParameters": { + "id": 1710, + "nodeType": "ParameterList", + "parameters": [], + "src": "1819:0:10" + }, + "scope": 1714, + "src": "1776:194:10", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + } + ], + "scope": 1715, + "src": "657:1315:10", + "usedErrors": [], + "usedEvents": [] + } + ], + "src": "99:1874:10" + }, + "id": 10 + }, + "@openzeppelin/contracts/utils/ReentrancyGuard.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/ReentrancyGuard.sol", + "exportedSymbols": { + "ReentrancyGuard": [ + 1827 + ], + "StorageSlot": [ + 2168 + ] + }, + "id": 1828, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1716, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "109:24:11" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/StorageSlot.sol", + "file": "./StorageSlot.sol", + "id": 1718, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 1828, + "sourceUnit": 2169, + "src": "135:46:11", + "symbolAliases": [ + { + "foreign": { + "id": 1717, + "name": "StorageSlot", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2168, + "src": "143:11:11", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": true, + "baseContracts": [], + "canonicalName": "ReentrancyGuard", + "contractDependencies": [], + "contractKind": "contract", + "documentation": { + "id": 1719, + "nodeType": "StructuredDocumentation", + "src": "183:1066:11", + "text": " @dev Contract module that helps prevent reentrant calls to a function.\n Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n available, which can be applied to functions to make sure there are no nested\n (reentrant) calls to them.\n Note that because there is a single `nonReentrant` guard, functions marked as\n `nonReentrant` may not call one another. This can be worked around by making\n those functions `private`, and then adding `external` `nonReentrant` entry\n points to them.\n TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,\n consider using {ReentrancyGuardTransient} instead.\n TIP: If you would like to learn more about reentrancy and alternative ways\n to protect against it, check out our blog post\n https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n IMPORTANT: Deprecated. This storage-based reentrancy guard will be removed and replaced\n by the {ReentrancyGuardTransient} variant in v6.0.\n @custom:stateless" + }, + "fullyImplemented": true, + "id": 1827, + "linearizedBaseContracts": [ + 1827 + ], + "name": "ReentrancyGuard", + "nameLocation": "1268:15:11", + "nodeType": "ContractDefinition", + "nodes": [ + { + "global": false, + "id": 1722, + "libraryName": { + "id": 1720, + "name": "StorageSlot", + "nameLocations": [ + "1296:11:11" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2168, + "src": "1296:11:11" + }, + "nodeType": "UsingForDirective", + "src": "1290:30:11", + "typeName": { + "id": 1721, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1312:7:11", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + }, + { + "constant": true, + "id": 1725, + "mutability": "constant", + "name": "REENTRANCY_GUARD_STORAGE", + "nameLocation": "1470:24:11", + "nodeType": "VariableDeclaration", + "scope": 1827, + "src": "1445:126:11", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 1723, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1445:7:11", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": { + "hexValue": "307839623737396231373432326430646639323232333031386233326234643166613436653037313732336436383137653234383664303033626563633535663030", + "id": 1724, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1505:66:11", + "typeDescriptions": { + "typeIdentifier": "t_rational_70319816728846589445362000750570655803700195216363692647688146666176345628416_by_1", + "typeString": "int_const 7031...(69 digits omitted)...8416" + }, + "value": "0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00" + }, + "visibility": "private" + }, + { + "constant": true, + "id": 1728, + "mutability": "constant", + "name": "NOT_ENTERED", + "nameLocation": "2351:11:11", + "nodeType": "VariableDeclaration", + "scope": 1827, + "src": "2326:40:11", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1726, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2326:7:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "31", + "id": 1727, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2365:1:11", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "visibility": "private" + }, + { + "constant": true, + "id": 1731, + "mutability": "constant", + "name": "ENTERED", + "nameLocation": "2397:7:11", + "nodeType": "VariableDeclaration", + "scope": 1827, + "src": "2372:36:11", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1729, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2372:7:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "32", + "id": 1730, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2407:1:11", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "visibility": "private" + }, + { + "documentation": { + "id": 1732, + "nodeType": "StructuredDocumentation", + "src": "2415:52:11", + "text": " @dev Unauthorized reentrant call." + }, + "errorSelector": "3ee5aeb5", + "id": 1734, + "name": "ReentrancyGuardReentrantCall", + "nameLocation": "2478:28:11", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 1733, + "nodeType": "ParameterList", + "parameters": [], + "src": "2506:2:11" + }, + "src": "2472:37:11" + }, + { + "body": { + "id": 1745, + "nodeType": "Block", + "src": "2529:83:11", + "statements": [ + { + "expression": { + "id": 1743, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1737, + "name": "_reentrancyGuardStorageSlot", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1826, + "src": "2539:27:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$__$returns$_t_bytes32_$", + "typeString": "function () pure returns (bytes32)" + } + }, + "id": 1738, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2539:29:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 1739, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2569:14:11", + "memberName": "getUint256Slot", + "nodeType": "MemberAccess", + "referencedDeclaration": 2112, + "src": "2539:44:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$_t_struct$_Uint256Slot_$2059_storage_ptr_$attached_to$_t_bytes32_$", + "typeString": "function (bytes32) pure returns (struct StorageSlot.Uint256Slot storage pointer)" + } + }, + "id": 1740, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2539:46:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_struct$_Uint256Slot_$2059_storage_ptr", + "typeString": "struct StorageSlot.Uint256Slot storage pointer" + } + }, + "id": 1741, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberLocation": "2586:5:11", + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": 2058, + "src": "2539:52:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 1742, + "name": "NOT_ENTERED", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1728, + "src": "2594:11:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2539:66:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1744, + "nodeType": "ExpressionStatement", + "src": "2539:66:11" + } + ] + }, + "id": 1746, + "implemented": true, + "kind": "constructor", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1735, + "nodeType": "ParameterList", + "parameters": [], + "src": "2526:2:11" + }, + "returnParameters": { + "id": 1736, + "nodeType": "ParameterList", + "parameters": [], + "src": "2529:0:11" + }, + "scope": 1827, + "src": "2515:97:11", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1756, + "nodeType": "Block", + "src": "3013:79:11", + "statements": [ + { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1749, + "name": "_nonReentrantBefore", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1791, + "src": "3023:19:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$__$returns$__$", + "typeString": "function ()" + } + }, + "id": 1750, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3023:21:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1751, + "nodeType": "ExpressionStatement", + "src": "3023:21:11" + }, + { + "id": 1752, + "nodeType": "PlaceholderStatement", + "src": "3054:1:11" + }, + { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1753, + "name": "_nonReentrantAfter", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1803, + "src": "3065:18:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$__$returns$__$", + "typeString": "function ()" + } + }, + "id": 1754, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3065:20:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1755, + "nodeType": "ExpressionStatement", + "src": "3065:20:11" + } + ] + }, + "documentation": { + "id": 1747, + "nodeType": "StructuredDocumentation", + "src": "2618:366:11", + "text": " @dev Prevents a contract from calling itself, directly or indirectly.\n Calling a `nonReentrant` function from another `nonReentrant`\n function is not supported. It is possible to prevent this from happening\n by making the `nonReentrant` function external, and making it call a\n `private` function that does the actual work." + }, + "id": 1757, + "name": "nonReentrant", + "nameLocation": "2998:12:11", + "nodeType": "ModifierDefinition", + "parameters": { + "id": 1748, + "nodeType": "ParameterList", + "parameters": [], + "src": "3010:2:11" + }, + "src": "2989:103:11", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1764, + "nodeType": "Block", + "src": "3527:53:11", + "statements": [ + { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1760, + "name": "_nonReentrantBeforeView", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1776, + "src": "3537:23:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$__$", + "typeString": "function () view" + } + }, + "id": 1761, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3537:25:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1762, + "nodeType": "ExpressionStatement", + "src": "3537:25:11" + }, + { + "id": 1763, + "nodeType": "PlaceholderStatement", + "src": "3572:1:11" + } + ] + }, + "documentation": { + "id": 1758, + "nodeType": "StructuredDocumentation", + "src": "3098:396:11", + "text": " @dev A `view` only version of {nonReentrant}. Use to block view functions\n from being called, preventing reading from inconsistent contract state.\n CAUTION: This is a \"view\" modifier and does not change the reentrancy\n status. Use it only on view functions. For payable or non-payable functions,\n use the standard {nonReentrant} modifier instead." + }, + "id": 1765, + "name": "nonReentrantView", + "nameLocation": "3508:16:11", + "nodeType": "ModifierDefinition", + "parameters": { + "id": 1759, + "nodeType": "ParameterList", + "parameters": [], + "src": "3524:2:11" + }, + "src": "3499:81:11", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1775, + "nodeType": "Block", + "src": "3634:109:11", + "statements": [ + { + "condition": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1768, + "name": "_reentrancyGuardEntered", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1818, + "src": "3648:23:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_bool_$", + "typeString": "function () view returns (bool)" + } + }, + "id": 1769, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3648:25:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 1774, + "nodeType": "IfStatement", + "src": "3644:93:11", + "trueBody": { + "id": 1773, + "nodeType": "Block", + "src": "3675:62:11", + "statements": [ + { + "errorCall": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1770, + "name": "ReentrancyGuardReentrantCall", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1734, + "src": "3696:28:11", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$__$returns$_t_error_$", + "typeString": "function () pure returns (error)" + } + }, + "id": 1771, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3696:30:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 1772, + "nodeType": "RevertStatement", + "src": "3689:37:11" + } + ] + } + } + ] + }, + "id": 1776, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_nonReentrantBeforeView", + "nameLocation": "3595:23:11", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1766, + "nodeType": "ParameterList", + "parameters": [], + "src": "3618:2:11" + }, + "returnParameters": { + "id": 1767, + "nodeType": "ParameterList", + "parameters": [], + "src": "3634:0:11" + }, + "scope": 1827, + "src": "3586:157:11", + "stateMutability": "view", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 1790, + "nodeType": "Block", + "src": "3788:253:11", + "statements": [ + { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1779, + "name": "_nonReentrantBeforeView", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1776, + "src": "3872:23:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$__$", + "typeString": "function () view" + } + }, + "id": 1780, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3872:25:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1781, + "nodeType": "ExpressionStatement", + "src": "3872:25:11" + }, + { + "expression": { + "id": 1788, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1782, + "name": "_reentrancyGuardStorageSlot", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1826, + "src": "3972:27:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$__$returns$_t_bytes32_$", + "typeString": "function () pure returns (bytes32)" + } + }, + "id": 1783, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3972:29:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 1784, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4002:14:11", + "memberName": "getUint256Slot", + "nodeType": "MemberAccess", + "referencedDeclaration": 2112, + "src": "3972:44:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$_t_struct$_Uint256Slot_$2059_storage_ptr_$attached_to$_t_bytes32_$", + "typeString": "function (bytes32) pure returns (struct StorageSlot.Uint256Slot storage pointer)" + } + }, + "id": 1785, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3972:46:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_struct$_Uint256Slot_$2059_storage_ptr", + "typeString": "struct StorageSlot.Uint256Slot storage pointer" + } + }, + "id": 1786, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberLocation": "4019:5:11", + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": 2058, + "src": "3972:52:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 1787, + "name": "ENTERED", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1731, + "src": "4027:7:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3972:62:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1789, + "nodeType": "ExpressionStatement", + "src": "3972:62:11" + } + ] + }, + "id": 1791, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_nonReentrantBefore", + "nameLocation": "3758:19:11", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1777, + "nodeType": "ParameterList", + "parameters": [], + "src": "3777:2:11" + }, + "returnParameters": { + "id": 1778, + "nodeType": "ParameterList", + "parameters": [], + "src": "3788:0:11" + }, + "scope": 1827, + "src": "3749:292:11", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 1802, + "nodeType": "Block", + "src": "4085:215:11", + "statements": [ + { + "expression": { + "id": 1800, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1794, + "name": "_reentrancyGuardStorageSlot", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1826, + "src": "4227:27:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$__$returns$_t_bytes32_$", + "typeString": "function () pure returns (bytes32)" + } + }, + "id": 1795, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4227:29:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 1796, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4257:14:11", + "memberName": "getUint256Slot", + "nodeType": "MemberAccess", + "referencedDeclaration": 2112, + "src": "4227:44:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$_t_struct$_Uint256Slot_$2059_storage_ptr_$attached_to$_t_bytes32_$", + "typeString": "function (bytes32) pure returns (struct StorageSlot.Uint256Slot storage pointer)" + } + }, + "id": 1797, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4227:46:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_struct$_Uint256Slot_$2059_storage_ptr", + "typeString": "struct StorageSlot.Uint256Slot storage pointer" + } + }, + "id": 1798, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberLocation": "4274:5:11", + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": 2058, + "src": "4227:52:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 1799, + "name": "NOT_ENTERED", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1728, + "src": "4282:11:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4227:66:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1801, + "nodeType": "ExpressionStatement", + "src": "4227:66:11" + } + ] + }, + "id": 1803, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_nonReentrantAfter", + "nameLocation": "4056:18:11", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1792, + "nodeType": "ParameterList", + "parameters": [], + "src": "4074:2:11" + }, + "returnParameters": { + "id": 1793, + "nodeType": "ParameterList", + "parameters": [], + "src": "4085:0:11" + }, + "scope": 1827, + "src": "4047:253:11", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 1817, + "nodeType": "Block", + "src": "4543:87:11", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1815, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1809, + "name": "_reentrancyGuardStorageSlot", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1826, + "src": "4560:27:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$__$returns$_t_bytes32_$", + "typeString": "function () pure returns (bytes32)" + } + }, + "id": 1810, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4560:29:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 1811, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4590:14:11", + "memberName": "getUint256Slot", + "nodeType": "MemberAccess", + "referencedDeclaration": 2112, + "src": "4560:44:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$_t_struct$_Uint256Slot_$2059_storage_ptr_$attached_to$_t_bytes32_$", + "typeString": "function (bytes32) pure returns (struct StorageSlot.Uint256Slot storage pointer)" + } + }, + "id": 1812, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4560:46:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_struct$_Uint256Slot_$2059_storage_ptr", + "typeString": "struct StorageSlot.Uint256Slot storage pointer" + } + }, + "id": 1813, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4607:5:11", + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": 2058, + "src": "4560:52:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 1814, + "name": "ENTERED", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1731, + "src": "4616:7:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4560:63:11", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 1808, + "id": 1816, + "nodeType": "Return", + "src": "4553:70:11" + } + ] + }, + "documentation": { + "id": 1804, + "nodeType": "StructuredDocumentation", + "src": "4306:168:11", + "text": " @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n `nonReentrant` function in the call stack." + }, + "id": 1818, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_reentrancyGuardEntered", + "nameLocation": "4488:23:11", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1805, + "nodeType": "ParameterList", + "parameters": [], + "src": "4511:2:11" + }, + "returnParameters": { + "id": 1808, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1807, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1818, + "src": "4537:4:11", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 1806, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "4537:4:11", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "4536:6:11" + }, + "scope": 1827, + "src": "4479:151:11", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1825, + "nodeType": "Block", + "src": "4715:48:11", + "statements": [ + { + "expression": { + "id": 1823, + "name": "REENTRANCY_GUARD_STORAGE", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1725, + "src": "4732:24:11", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 1822, + "id": 1824, + "nodeType": "Return", + "src": "4725:31:11" + } + ] + }, + "id": 1826, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_reentrancyGuardStorageSlot", + "nameLocation": "4645:27:11", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1819, + "nodeType": "ParameterList", + "parameters": [], + "src": "4672:2:11" + }, + "returnParameters": { + "id": 1822, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1821, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1826, + "src": "4706:7:11", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 1820, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "4706:7:11", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "4705:9:11" + }, + "scope": 1827, + "src": "4636:127:11", + "stateMutability": "pure", + "virtual": true, + "visibility": "internal" + } + ], + "scope": 1828, + "src": "1250:3515:11", + "usedErrors": [ + 1734 + ], + "usedEvents": [] + } + ], + "src": "109:4657:11" + }, + "id": 11 + }, + "@openzeppelin/contracts/utils/ShortStrings.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/ShortStrings.sol", + "exportedSymbols": { + "ShortString": [ + 1833 + ], + "ShortStrings": [ + 2044 + ], + "StorageSlot": [ + 2168 + ] + }, + "id": 2045, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1829, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "106:24:12" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/StorageSlot.sol", + "file": "./StorageSlot.sol", + "id": 1831, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 2045, + "sourceUnit": 2169, + "src": "132:46:12", + "symbolAliases": [ + { + "foreign": { + "id": 1830, + "name": "StorageSlot", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2168, + "src": "140:11:12", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "canonicalName": "ShortString", + "id": 1833, + "name": "ShortString", + "nameLocation": "353:11:12", + "nodeType": "UserDefinedValueTypeDefinition", + "src": "348:28:12", + "underlyingType": { + "id": 1832, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "368:7:12", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "ShortStrings", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 1834, + "nodeType": "StructuredDocumentation", + "src": "378:876:12", + "text": " @dev This library provides functions to convert short memory strings\n into a `ShortString` type that can be used as an immutable variable.\n Strings of arbitrary length can be optimized using this library if\n they are short enough (up to 31 bytes) by packing them with their\n length (1 byte) in a single EVM word (32 bytes). Additionally, a\n fallback mechanism can be used for every other case.\n Usage example:\n ```solidity\n contract Named {\n using ShortStrings for *;\n ShortString private immutable _name;\n string private _nameFallback;\n constructor(string memory contractName) {\n _name = contractName.toShortStringWithFallback(_nameFallback);\n }\n function name() external view returns (string memory) {\n return _name.toStringWithFallback(_nameFallback);\n }\n }\n ```" + }, + "fullyImplemented": true, + "id": 2044, + "linearizedBaseContracts": [ + 2044 + ], + "name": "ShortStrings", + "nameLocation": "1263:12:12", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": true, + "id": 1837, + "mutability": "constant", + "name": "FALLBACK_SENTINEL", + "nameLocation": "1370:17:12", + "nodeType": "VariableDeclaration", + "scope": 2044, + "src": "1345:111:12", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 1835, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1345:7:12", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": { + "hexValue": "307830303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030304646", + "id": 1836, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1390:66:12", + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "0x00000000000000000000000000000000000000000000000000000000000000FF" + }, + "visibility": "private" + }, + { + "errorSelector": "305a27a9", + "id": 1841, + "name": "StringTooLong", + "nameLocation": "1469:13:12", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 1840, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1839, + "mutability": "mutable", + "name": "str", + "nameLocation": "1490:3:12", + "nodeType": "VariableDeclaration", + "scope": 1841, + "src": "1483:10:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 1838, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1483:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "1482:12:12" + }, + "src": "1463:32:12" + }, + { + "errorSelector": "b3512b0c", + "id": 1843, + "name": "InvalidShortString", + "nameLocation": "1506:18:12", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 1842, + "nodeType": "ParameterList", + "parameters": [], + "src": "1524:2:12" + }, + "src": "1500:27:12" + }, + { + "body": { + "id": 1886, + "nodeType": "Block", + "src": "1786:210:12", + "statements": [ + { + "assignments": [ + 1853 + ], + "declarations": [ + { + "constant": false, + "id": 1853, + "mutability": "mutable", + "name": "bstr", + "nameLocation": "1809:4:12", + "nodeType": "VariableDeclaration", + "scope": 1886, + "src": "1796:17:12", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1852, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1796:5:12", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 1858, + "initialValue": { + "arguments": [ + { + "id": 1856, + "name": "str", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1846, + "src": "1822:3:12", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 1855, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1816:5:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 1854, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1816:5:12", + "typeDescriptions": {} + } + }, + "id": 1857, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1816:10:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1796:30:12" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1862, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 1859, + "name": "bstr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1853, + "src": "1840:4:12", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1860, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "1845:6:12", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "1840:11:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30783166", + "id": 1861, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1854:4:12", + "typeDescriptions": { + "typeIdentifier": "t_rational_31_by_1", + "typeString": "int_const 31" + }, + "value": "0x1f" + }, + "src": "1840:18:12", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 1868, + "nodeType": "IfStatement", + "src": "1836:74:12", + "trueBody": { + "id": 1867, + "nodeType": "Block", + "src": "1860:50:12", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "id": 1864, + "name": "str", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1846, + "src": "1895:3:12", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 1863, + "name": "StringTooLong", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1841, + "src": "1881:13:12", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_string_memory_ptr_$returns$_t_error_$", + "typeString": "function (string memory) pure returns (error)" + } + }, + "id": 1865, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1881:18:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 1866, + "nodeType": "RevertStatement", + "src": "1874:25:12" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1882, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "arguments": [ + { + "id": 1877, + "name": "bstr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1853, + "src": "1967:4:12", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 1876, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1959:7:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes32_$", + "typeString": "type(bytes32)" + }, + "typeName": { + "id": 1875, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1959:7:12", + "typeDescriptions": {} + } + }, + "id": 1878, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1959:13:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 1874, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1951:7:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 1873, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1951:7:12", + "typeDescriptions": {} + } + }, + "id": 1879, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1951:22:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "expression": { + "id": 1880, + "name": "bstr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1853, + "src": "1976:4:12", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1881, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "1981:6:12", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "1976:11:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1951:36:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1872, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1943:7:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes32_$", + "typeString": "type(bytes32)" + }, + "typeName": { + "id": 1871, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1943:7:12", + "typeDescriptions": {} + } + }, + "id": 1883, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1943:45:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "id": 1869, + "name": "ShortString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1833, + "src": "1926:11:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "type(ShortString)" + } + }, + "id": 1870, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "1938:4:12", + "memberName": "wrap", + "nodeType": "MemberAccess", + "src": "1926:16:12", + "typeDescriptions": { + "typeIdentifier": "t_function_wrap_pure$_t_bytes32_$returns$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "function (bytes32) pure returns (ShortString)" + } + }, + "id": 1884, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1926:63:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "functionReturnParameters": 1851, + "id": 1885, + "nodeType": "Return", + "src": "1919:70:12" + } + ] + }, + "documentation": { + "id": 1844, + "nodeType": "StructuredDocumentation", + "src": "1533:170:12", + "text": " @dev Encode a string of at most 31 chars into a `ShortString`.\n This will trigger a `StringTooLong` error is the input string is too long." + }, + "id": 1887, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toShortString", + "nameLocation": "1717:13:12", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1847, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1846, + "mutability": "mutable", + "name": "str", + "nameLocation": "1745:3:12", + "nodeType": "VariableDeclaration", + "scope": 1887, + "src": "1731:17:12", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 1845, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1731:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "1730:19:12" + }, + "returnParameters": { + "id": 1851, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1850, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1887, + "src": "1773:11:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + }, + "typeName": { + "id": 1849, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 1848, + "name": "ShortString", + "nameLocations": [ + "1773:11:12" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1833, + "src": "1773:11:12" + }, + "referencedDeclaration": 1833, + "src": "1773:11:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "visibility": "internal" + } + ], + "src": "1772:13:12" + }, + "scope": 2044, + "src": "1708:288:12", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1912, + "nodeType": "Block", + "src": "2154:306:12", + "statements": [ + { + "assignments": [ + 1897 + ], + "declarations": [ + { + "constant": false, + "id": 1897, + "mutability": "mutable", + "name": "len", + "nameLocation": "2172:3:12", + "nodeType": "VariableDeclaration", + "scope": 1912, + "src": "2164:11:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1896, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2164:7:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 1901, + "initialValue": { + "arguments": [ + { + "id": 1899, + "name": "sstr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1891, + "src": "2189:4:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + ], + "id": 1898, + "name": "byteLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1945, + "src": "2178:10:12", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_userDefinedValueType$_ShortString_$1833_$returns$_t_uint256_$", + "typeString": "function (ShortString) pure returns (uint256)" + } + }, + "id": 1900, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2178:16:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2164:30:12" + }, + { + "assignments": [ + 1903 + ], + "declarations": [ + { + "constant": false, + "id": 1903, + "mutability": "mutable", + "name": "str", + "nameLocation": "2296:3:12", + "nodeType": "VariableDeclaration", + "scope": 1912, + "src": "2282:17:12", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 1902, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2282:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "id": 1908, + "initialValue": { + "arguments": [ + { + "hexValue": "30783230", + "id": 1906, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2313:4:12", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "0x20" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + } + ], + "id": 1905, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "2302:10:12", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_string_memory_ptr_$", + "typeString": "function (uint256) pure returns (string memory)" + }, + "typeName": { + "id": 1904, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2306:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + } + }, + "id": 1907, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2302:16:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2282:36:12" + }, + { + "AST": { + "nativeSrc": "2353:81:12", + "nodeType": "YulBlock", + "src": "2353:81:12", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "str", + "nativeSrc": "2374:3:12", + "nodeType": "YulIdentifier", + "src": "2374:3:12" + }, + { + "name": "len", + "nativeSrc": "2379:3:12", + "nodeType": "YulIdentifier", + "src": "2379:3:12" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "2367:6:12", + "nodeType": "YulIdentifier", + "src": "2367:6:12" + }, + "nativeSrc": "2367:16:12", + "nodeType": "YulFunctionCall", + "src": "2367:16:12" + }, + "nativeSrc": "2367:16:12", + "nodeType": "YulExpressionStatement", + "src": "2367:16:12" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "str", + "nativeSrc": "2407:3:12", + "nodeType": "YulIdentifier", + "src": "2407:3:12" + }, + { + "kind": "number", + "nativeSrc": "2412:4:12", + "nodeType": "YulLiteral", + "src": "2412:4:12", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2403:3:12", + "nodeType": "YulIdentifier", + "src": "2403:3:12" + }, + "nativeSrc": "2403:14:12", + "nodeType": "YulFunctionCall", + "src": "2403:14:12" + }, + { + "name": "sstr", + "nativeSrc": "2419:4:12", + "nodeType": "YulIdentifier", + "src": "2419:4:12" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "2396:6:12", + "nodeType": "YulIdentifier", + "src": "2396:6:12" + }, + "nativeSrc": "2396:28:12", + "nodeType": "YulFunctionCall", + "src": "2396:28:12" + }, + "nativeSrc": "2396:28:12", + "nodeType": "YulExpressionStatement", + "src": "2396:28:12" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 1897, + "isOffset": false, + "isSlot": false, + "src": "2379:3:12", + "valueSize": 1 + }, + { + "declaration": 1891, + "isOffset": false, + "isSlot": false, + "src": "2419:4:12", + "valueSize": 1 + }, + { + "declaration": 1903, + "isOffset": false, + "isSlot": false, + "src": "2374:3:12", + "valueSize": 1 + }, + { + "declaration": 1903, + "isOffset": false, + "isSlot": false, + "src": "2407:3:12", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 1909, + "nodeType": "InlineAssembly", + "src": "2328:106:12" + }, + { + "expression": { + "id": 1910, + "name": "str", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1903, + "src": "2450:3:12", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 1895, + "id": 1911, + "nodeType": "Return", + "src": "2443:10:12" + } + ] + }, + "documentation": { + "id": 1888, + "nodeType": "StructuredDocumentation", + "src": "2002:73:12", + "text": " @dev Decode a `ShortString` back to a \"normal\" string." + }, + "id": 1913, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toString", + "nameLocation": "2089:8:12", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1892, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1891, + "mutability": "mutable", + "name": "sstr", + "nameLocation": "2110:4:12", + "nodeType": "VariableDeclaration", + "scope": 1913, + "src": "2098:16:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + }, + "typeName": { + "id": 1890, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 1889, + "name": "ShortString", + "nameLocations": [ + "2098:11:12" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1833, + "src": "2098:11:12" + }, + "referencedDeclaration": 1833, + "src": "2098:11:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "visibility": "internal" + } + ], + "src": "2097:18:12" + }, + "returnParameters": { + "id": 1895, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1894, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1913, + "src": "2139:13:12", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 1893, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2139:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "2138:15:12" + }, + "scope": 2044, + "src": "2080:380:12", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1944, + "nodeType": "Block", + "src": "2602:177:12", + "statements": [ + { + "assignments": [ + 1923 + ], + "declarations": [ + { + "constant": false, + "id": 1923, + "mutability": "mutable", + "name": "result", + "nameLocation": "2620:6:12", + "nodeType": "VariableDeclaration", + "scope": 1944, + "src": "2612:14:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1922, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2612:7:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 1933, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1932, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "arguments": [ + { + "id": 1928, + "name": "sstr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1917, + "src": "2656:4:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + ], + "expression": { + "id": 1926, + "name": "ShortString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1833, + "src": "2637:11:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "type(ShortString)" + } + }, + "id": 1927, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "2649:6:12", + "memberName": "unwrap", + "nodeType": "MemberAccess", + "src": "2637:18:12", + "typeDescriptions": { + "typeIdentifier": "t_function_unwrap_pure$_t_userDefinedValueType$_ShortString_$1833_$returns$_t_bytes32_$", + "typeString": "function (ShortString) pure returns (bytes32)" + } + }, + "id": 1929, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2637:24:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 1925, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2629:7:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 1924, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2629:7:12", + "typeDescriptions": {} + } + }, + "id": 1930, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2629:33:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30784646", + "id": 1931, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2665:4:12", + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "0xFF" + }, + "src": "2629:40:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2612:57:12" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1936, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1934, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1923, + "src": "2683:6:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30783166", + "id": 1935, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2692:4:12", + "typeDescriptions": { + "typeIdentifier": "t_rational_31_by_1", + "typeString": "int_const 31" + }, + "value": "0x1f" + }, + "src": "2683:13:12", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 1941, + "nodeType": "IfStatement", + "src": "2679:71:12", + "trueBody": { + "id": 1940, + "nodeType": "Block", + "src": "2698:52:12", + "statements": [ + { + "errorCall": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1937, + "name": "InvalidShortString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1843, + "src": "2719:18:12", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$__$returns$_t_error_$", + "typeString": "function () pure returns (error)" + } + }, + "id": 1938, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2719:20:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 1939, + "nodeType": "RevertStatement", + "src": "2712:27:12" + } + ] + } + }, + { + "expression": { + "id": 1942, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1923, + "src": "2766:6:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 1921, + "id": 1943, + "nodeType": "Return", + "src": "2759:13:12" + } + ] + }, + "documentation": { + "id": 1914, + "nodeType": "StructuredDocumentation", + "src": "2466:61:12", + "text": " @dev Return the length of a `ShortString`." + }, + "id": 1945, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "byteLength", + "nameLocation": "2541:10:12", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1918, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1917, + "mutability": "mutable", + "name": "sstr", + "nameLocation": "2564:4:12", + "nodeType": "VariableDeclaration", + "scope": 1945, + "src": "2552:16:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + }, + "typeName": { + "id": 1916, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 1915, + "name": "ShortString", + "nameLocations": [ + "2552:11:12" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1833, + "src": "2552:11:12" + }, + "referencedDeclaration": 1833, + "src": "2552:11:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "visibility": "internal" + } + ], + "src": "2551:18:12" + }, + "returnParameters": { + "id": 1921, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1920, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1945, + "src": "2593:7:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1919, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2593:7:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2592:9:12" + }, + "scope": 2044, + "src": "2532:247:12", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1984, + "nodeType": "Block", + "src": "3002:233:12", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1962, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "arguments": [ + { + "id": 1958, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1948, + "src": "3022:5:12", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 1957, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3016:5:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 1956, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3016:5:12", + "typeDescriptions": {} + } + }, + "id": 1959, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3016:12:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1960, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3029:6:12", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "3016:19:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "hexValue": "30783230", + "id": 1961, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3038:4:12", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "0x20" + }, + "src": "3016:26:12", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 1982, + "nodeType": "Block", + "src": "3102:127:12", + "statements": [ + { + "expression": { + "id": 1975, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "expression": { + "arguments": [ + { + "id": 1971, + "name": "store", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1950, + "src": "3142:5:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string storage pointer" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string storage pointer" + } + ], + "expression": { + "id": 1968, + "name": "StorageSlot", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2168, + "src": "3116:11:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_StorageSlot_$2168_$", + "typeString": "type(library StorageSlot)" + } + }, + "id": 1970, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3128:13:12", + "memberName": "getStringSlot", + "nodeType": "MemberAccess", + "referencedDeclaration": 2145, + "src": "3116:25:12", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_storage_ptr_$returns$_t_struct$_StringSlot_$2065_storage_ptr_$", + "typeString": "function (string storage pointer) pure returns (struct StorageSlot.StringSlot storage pointer)" + } + }, + "id": 1972, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3116:32:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_struct$_StringSlot_$2065_storage_ptr", + "typeString": "struct StorageSlot.StringSlot storage pointer" + } + }, + "id": 1973, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberLocation": "3149:5:12", + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": 2064, + "src": "3116:38:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 1974, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1948, + "src": "3157:5:12", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "src": "3116:46:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "id": 1976, + "nodeType": "ExpressionStatement", + "src": "3116:46:12" + }, + { + "expression": { + "arguments": [ + { + "id": 1979, + "name": "FALLBACK_SENTINEL", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1837, + "src": "3200:17:12", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "id": 1977, + "name": "ShortString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1833, + "src": "3183:11:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "type(ShortString)" + } + }, + "id": 1978, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "3195:4:12", + "memberName": "wrap", + "nodeType": "MemberAccess", + "src": "3183:16:12", + "typeDescriptions": { + "typeIdentifier": "t_function_wrap_pure$_t_bytes32_$returns$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "function (bytes32) pure returns (ShortString)" + } + }, + "id": 1980, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3183:35:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "functionReturnParameters": 1955, + "id": 1981, + "nodeType": "Return", + "src": "3176:42:12" + } + ] + }, + "id": 1983, + "nodeType": "IfStatement", + "src": "3012:217:12", + "trueBody": { + "id": 1967, + "nodeType": "Block", + "src": "3044:52:12", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 1964, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1948, + "src": "3079:5:12", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 1963, + "name": "toShortString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1887, + "src": "3065:13:12", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$returns$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "function (string memory) pure returns (ShortString)" + } + }, + "id": 1965, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3065:20:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "functionReturnParameters": 1955, + "id": 1966, + "nodeType": "Return", + "src": "3058:27:12" + } + ] + } + } + ] + }, + "documentation": { + "id": 1946, + "nodeType": "StructuredDocumentation", + "src": "2785:103:12", + "text": " @dev Encode a string into a `ShortString`, or write it to storage if it is too long." + }, + "id": 1985, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toShortStringWithFallback", + "nameLocation": "2902:25:12", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1951, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1948, + "mutability": "mutable", + "name": "value", + "nameLocation": "2942:5:12", + "nodeType": "VariableDeclaration", + "scope": 1985, + "src": "2928:19:12", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 1947, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2928:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1950, + "mutability": "mutable", + "name": "store", + "nameLocation": "2964:5:12", + "nodeType": "VariableDeclaration", + "scope": 1985, + "src": "2949:20:12", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + }, + "typeName": { + "id": 1949, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2949:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "2927:43:12" + }, + "returnParameters": { + "id": 1955, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1954, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1985, + "src": "2989:11:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + }, + "typeName": { + "id": 1953, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 1952, + "name": "ShortString", + "nameLocations": [ + "2989:11:12" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1833, + "src": "2989:11:12" + }, + "referencedDeclaration": 1833, + "src": "2989:11:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "visibility": "internal" + } + ], + "src": "2988:13:12" + }, + "scope": 2044, + "src": "2893:342:12", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2011, + "nodeType": "Block", + "src": "3485:158:12", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 2001, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 1998, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1989, + "src": "3518:5:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + ], + "expression": { + "id": 1996, + "name": "ShortString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1833, + "src": "3499:11:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "type(ShortString)" + } + }, + "id": 1997, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "3511:6:12", + "memberName": "unwrap", + "nodeType": "MemberAccess", + "src": "3499:18:12", + "typeDescriptions": { + "typeIdentifier": "t_function_unwrap_pure$_t_userDefinedValueType$_ShortString_$1833_$returns$_t_bytes32_$", + "typeString": "function (ShortString) pure returns (bytes32)" + } + }, + "id": 1999, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3499:25:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 2000, + "name": "FALLBACK_SENTINEL", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1837, + "src": "3528:17:12", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "3499:46:12", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 2009, + "nodeType": "Block", + "src": "3600:37:12", + "statements": [ + { + "expression": { + "id": 2007, + "name": "store", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1991, + "src": "3621:5:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string storage pointer" + } + }, + "functionReturnParameters": 1995, + "id": 2008, + "nodeType": "Return", + "src": "3614:12:12" + } + ] + }, + "id": 2010, + "nodeType": "IfStatement", + "src": "3495:142:12", + "trueBody": { + "id": 2006, + "nodeType": "Block", + "src": "3547:47:12", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2003, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1989, + "src": "3577:5:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + ], + "id": 2002, + "name": "toString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1913, + "src": "3568:8:12", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_userDefinedValueType$_ShortString_$1833_$returns$_t_string_memory_ptr_$", + "typeString": "function (ShortString) pure returns (string memory)" + } + }, + "id": 2004, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3568:15:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 1995, + "id": 2005, + "nodeType": "Return", + "src": "3561:22:12" + } + ] + } + } + ] + }, + "documentation": { + "id": 1986, + "nodeType": "StructuredDocumentation", + "src": "3241:130:12", + "text": " @dev Decode a string that was encoded to `ShortString` or written to storage using {toShortStringWithFallback}." + }, + "id": 2012, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toStringWithFallback", + "nameLocation": "3385:20:12", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1992, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1989, + "mutability": "mutable", + "name": "value", + "nameLocation": "3418:5:12", + "nodeType": "VariableDeclaration", + "scope": 2012, + "src": "3406:17:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + }, + "typeName": { + "id": 1988, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 1987, + "name": "ShortString", + "nameLocations": [ + "3406:11:12" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1833, + "src": "3406:11:12" + }, + "referencedDeclaration": 1833, + "src": "3406:11:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1991, + "mutability": "mutable", + "name": "store", + "nameLocation": "3440:5:12", + "nodeType": "VariableDeclaration", + "scope": 2012, + "src": "3425:20:12", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + }, + "typeName": { + "id": 1990, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "3425:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "3405:41:12" + }, + "returnParameters": { + "id": 1995, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1994, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2012, + "src": "3470:13:12", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 1993, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "3470:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "3469:15:12" + }, + "scope": 2044, + "src": "3376:267:12", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2042, + "nodeType": "Block", + "src": "4133:174:12", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 2028, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 2025, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2016, + "src": "4166:5:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + ], + "expression": { + "id": 2023, + "name": "ShortString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1833, + "src": "4147:11:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "type(ShortString)" + } + }, + "id": 2024, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "4159:6:12", + "memberName": "unwrap", + "nodeType": "MemberAccess", + "src": "4147:18:12", + "typeDescriptions": { + "typeIdentifier": "t_function_unwrap_pure$_t_userDefinedValueType$_ShortString_$1833_$returns$_t_bytes32_$", + "typeString": "function (ShortString) pure returns (bytes32)" + } + }, + "id": 2026, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4147:25:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 2027, + "name": "FALLBACK_SENTINEL", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1837, + "src": "4176:17:12", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "4147:46:12", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 2040, + "nodeType": "Block", + "src": "4250:51:12", + "statements": [ + { + "expression": { + "expression": { + "arguments": [ + { + "id": 2036, + "name": "store", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2018, + "src": "4277:5:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string storage pointer" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string storage pointer" + } + ], + "id": 2035, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4271:5:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2034, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4271:5:12", + "typeDescriptions": {} + } + }, + "id": 2037, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4271:12:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes storage pointer" + } + }, + "id": 2038, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4284:6:12", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "4271:19:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 2022, + "id": 2039, + "nodeType": "Return", + "src": "4264:26:12" + } + ] + }, + "id": 2041, + "nodeType": "IfStatement", + "src": "4143:158:12", + "trueBody": { + "id": 2033, + "nodeType": "Block", + "src": "4195:49:12", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2030, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2016, + "src": "4227:5:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + ], + "id": 2029, + "name": "byteLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1945, + "src": "4216:10:12", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_userDefinedValueType$_ShortString_$1833_$returns$_t_uint256_$", + "typeString": "function (ShortString) pure returns (uint256)" + } + }, + "id": 2031, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4216:17:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 2022, + "id": 2032, + "nodeType": "Return", + "src": "4209:24:12" + } + ] + } + } + ] + }, + "documentation": { + "id": 2013, + "nodeType": "StructuredDocumentation", + "src": "3649:374:12", + "text": " @dev Return the length of a string that was encoded to `ShortString` or written to storage using\n {toShortStringWithFallback}.\n WARNING: This will return the \"byte length\" of the string. This may not reflect the actual length in terms of\n actual characters as the UTF-8 encoding of a single character can span over multiple bytes." + }, + "id": 2043, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "byteLengthWithFallback", + "nameLocation": "4037:22:12", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2019, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2016, + "mutability": "mutable", + "name": "value", + "nameLocation": "4072:5:12", + "nodeType": "VariableDeclaration", + "scope": 2043, + "src": "4060:17:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + }, + "typeName": { + "id": 2015, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2014, + "name": "ShortString", + "nameLocations": [ + "4060:11:12" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1833, + "src": "4060:11:12" + }, + "referencedDeclaration": 1833, + "src": "4060:11:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2018, + "mutability": "mutable", + "name": "store", + "nameLocation": "4094:5:12", + "nodeType": "VariableDeclaration", + "scope": 2043, + "src": "4079:20:12", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2017, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "4079:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "4059:41:12" + }, + "returnParameters": { + "id": 2022, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2021, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2043, + "src": "4124:7:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2020, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4124:7:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4123:9:12" + }, + "scope": 2044, + "src": "4028:279:12", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + } + ], + "scope": 2045, + "src": "1255:3054:12", + "usedErrors": [ + 1841, + 1843 + ], + "usedEvents": [] + } + ], + "src": "106:4204:12" + }, + "id": 12 + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/StorageSlot.sol", + "exportedSymbols": { + "StorageSlot": [ + 2168 + ] + }, + "id": 2169, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 2046, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "193:24:13" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "StorageSlot", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 2047, + "nodeType": "StructuredDocumentation", + "src": "219:1187:13", + "text": " @dev Library for reading and writing primitive types to specific storage slots.\n Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n This library helps with reading and writing to such slots without the need for inline assembly.\n The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n Example usage to set ERC-1967 implementation slot:\n ```solidity\n contract ERC1967 {\n // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n function _setImplementation(address newImplementation) internal {\n require(newImplementation.code.length > 0);\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n }\n ```\n TIP: Consider using this library along with {SlotDerivation}." + }, + "fullyImplemented": true, + "id": 2168, + "linearizedBaseContracts": [ + 2168 + ], + "name": "StorageSlot", + "nameLocation": "1415:11:13", + "nodeType": "ContractDefinition", + "nodes": [ + { + "canonicalName": "StorageSlot.AddressSlot", + "id": 2050, + "members": [ + { + "constant": false, + "id": 2049, + "mutability": "mutable", + "name": "value", + "nameLocation": "1470:5:13", + "nodeType": "VariableDeclaration", + "scope": 2050, + "src": "1462:13:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 2048, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1462:7:13", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "name": "AddressSlot", + "nameLocation": "1440:11:13", + "nodeType": "StructDefinition", + "scope": 2168, + "src": "1433:49:13", + "visibility": "public" + }, + { + "canonicalName": "StorageSlot.BooleanSlot", + "id": 2053, + "members": [ + { + "constant": false, + "id": 2052, + "mutability": "mutable", + "name": "value", + "nameLocation": "1522:5:13", + "nodeType": "VariableDeclaration", + "scope": 2053, + "src": "1517:10:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2051, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "1517:4:13", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "name": "BooleanSlot", + "nameLocation": "1495:11:13", + "nodeType": "StructDefinition", + "scope": 2168, + "src": "1488:46:13", + "visibility": "public" + }, + { + "canonicalName": "StorageSlot.Bytes32Slot", + "id": 2056, + "members": [ + { + "constant": false, + "id": 2055, + "mutability": "mutable", + "name": "value", + "nameLocation": "1577:5:13", + "nodeType": "VariableDeclaration", + "scope": 2056, + "src": "1569:13:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2054, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1569:7:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "name": "Bytes32Slot", + "nameLocation": "1547:11:13", + "nodeType": "StructDefinition", + "scope": 2168, + "src": "1540:49:13", + "visibility": "public" + }, + { + "canonicalName": "StorageSlot.Uint256Slot", + "id": 2059, + "members": [ + { + "constant": false, + "id": 2058, + "mutability": "mutable", + "name": "value", + "nameLocation": "1632:5:13", + "nodeType": "VariableDeclaration", + "scope": 2059, + "src": "1624:13:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2057, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1624:7:13", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "name": "Uint256Slot", + "nameLocation": "1602:11:13", + "nodeType": "StructDefinition", + "scope": 2168, + "src": "1595:49:13", + "visibility": "public" + }, + { + "canonicalName": "StorageSlot.Int256Slot", + "id": 2062, + "members": [ + { + "constant": false, + "id": 2061, + "mutability": "mutable", + "name": "value", + "nameLocation": "1685:5:13", + "nodeType": "VariableDeclaration", + "scope": 2062, + "src": "1678:12:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 2060, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1678:6:13", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "name": "Int256Slot", + "nameLocation": "1657:10:13", + "nodeType": "StructDefinition", + "scope": 2168, + "src": "1650:47:13", + "visibility": "public" + }, + { + "canonicalName": "StorageSlot.StringSlot", + "id": 2065, + "members": [ + { + "constant": false, + "id": 2064, + "mutability": "mutable", + "name": "value", + "nameLocation": "1738:5:13", + "nodeType": "VariableDeclaration", + "scope": 2065, + "src": "1731:12:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2063, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1731:6:13", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "name": "StringSlot", + "nameLocation": "1710:10:13", + "nodeType": "StructDefinition", + "scope": 2168, + "src": "1703:47:13", + "visibility": "public" + }, + { + "canonicalName": "StorageSlot.BytesSlot", + "id": 2068, + "members": [ + { + "constant": false, + "id": 2067, + "mutability": "mutable", + "name": "value", + "nameLocation": "1789:5:13", + "nodeType": "VariableDeclaration", + "scope": 2068, + "src": "1783:11:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2066, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1783:5:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "name": "BytesSlot", + "nameLocation": "1763:9:13", + "nodeType": "StructDefinition", + "scope": 2168, + "src": "1756:45:13", + "visibility": "public" + }, + { + "body": { + "id": 2078, + "nodeType": "Block", + "src": "1983:79:13", + "statements": [ + { + "AST": { + "nativeSrc": "2018:38:13", + "nodeType": "YulBlock", + "src": "2018:38:13", + "statements": [ + { + "nativeSrc": "2032:14:13", + "nodeType": "YulAssignment", + "src": "2032:14:13", + "value": { + "name": "slot", + "nativeSrc": "2042:4:13", + "nodeType": "YulIdentifier", + "src": "2042:4:13" + }, + "variableNames": [ + { + "name": "r.slot", + "nativeSrc": "2032:6:13", + "nodeType": "YulIdentifier", + "src": "2032:6:13" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2075, + "isOffset": false, + "isSlot": true, + "src": "2032:6:13", + "suffix": "slot", + "valueSize": 1 + }, + { + "declaration": 2071, + "isOffset": false, + "isSlot": false, + "src": "2042:4:13", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2077, + "nodeType": "InlineAssembly", + "src": "1993:63:13" + } + ] + }, + "documentation": { + "id": 2069, + "nodeType": "StructuredDocumentation", + "src": "1807:87:13", + "text": " @dev Returns an `AddressSlot` with member `value` located at `slot`." + }, + "id": 2079, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getAddressSlot", + "nameLocation": "1908:14:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2072, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2071, + "mutability": "mutable", + "name": "slot", + "nameLocation": "1931:4:13", + "nodeType": "VariableDeclaration", + "scope": 2079, + "src": "1923:12:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2070, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1923:7:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "1922:14:13" + }, + "returnParameters": { + "id": 2076, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2075, + "mutability": "mutable", + "name": "r", + "nameLocation": "1980:1:13", + "nodeType": "VariableDeclaration", + "scope": 2079, + "src": "1960:21:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_AddressSlot_$2050_storage_ptr", + "typeString": "struct StorageSlot.AddressSlot" + }, + "typeName": { + "id": 2074, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2073, + "name": "AddressSlot", + "nameLocations": [ + "1960:11:13" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2050, + "src": "1960:11:13" + }, + "referencedDeclaration": 2050, + "src": "1960:11:13", + "typeDescriptions": { + "typeIdentifier": "t_struct$_AddressSlot_$2050_storage_ptr", + "typeString": "struct StorageSlot.AddressSlot" + } + }, + "visibility": "internal" + } + ], + "src": "1959:23:13" + }, + "scope": 2168, + "src": "1899:163:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2089, + "nodeType": "Block", + "src": "2243:79:13", + "statements": [ + { + "AST": { + "nativeSrc": "2278:38:13", + "nodeType": "YulBlock", + "src": "2278:38:13", + "statements": [ + { + "nativeSrc": "2292:14:13", + "nodeType": "YulAssignment", + "src": "2292:14:13", + "value": { + "name": "slot", + "nativeSrc": "2302:4:13", + "nodeType": "YulIdentifier", + "src": "2302:4:13" + }, + "variableNames": [ + { + "name": "r.slot", + "nativeSrc": "2292:6:13", + "nodeType": "YulIdentifier", + "src": "2292:6:13" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2086, + "isOffset": false, + "isSlot": true, + "src": "2292:6:13", + "suffix": "slot", + "valueSize": 1 + }, + { + "declaration": 2082, + "isOffset": false, + "isSlot": false, + "src": "2302:4:13", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2088, + "nodeType": "InlineAssembly", + "src": "2253:63:13" + } + ] + }, + "documentation": { + "id": 2080, + "nodeType": "StructuredDocumentation", + "src": "2068:86:13", + "text": " @dev Returns a `BooleanSlot` with member `value` located at `slot`." + }, + "id": 2090, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getBooleanSlot", + "nameLocation": "2168:14:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2083, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2082, + "mutability": "mutable", + "name": "slot", + "nameLocation": "2191:4:13", + "nodeType": "VariableDeclaration", + "scope": 2090, + "src": "2183:12:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2081, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2183:7:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "2182:14:13" + }, + "returnParameters": { + "id": 2087, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2086, + "mutability": "mutable", + "name": "r", + "nameLocation": "2240:1:13", + "nodeType": "VariableDeclaration", + "scope": 2090, + "src": "2220:21:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_BooleanSlot_$2053_storage_ptr", + "typeString": "struct StorageSlot.BooleanSlot" + }, + "typeName": { + "id": 2085, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2084, + "name": "BooleanSlot", + "nameLocations": [ + "2220:11:13" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2053, + "src": "2220:11:13" + }, + "referencedDeclaration": 2053, + "src": "2220:11:13", + "typeDescriptions": { + "typeIdentifier": "t_struct$_BooleanSlot_$2053_storage_ptr", + "typeString": "struct StorageSlot.BooleanSlot" + } + }, + "visibility": "internal" + } + ], + "src": "2219:23:13" + }, + "scope": 2168, + "src": "2159:163:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2100, + "nodeType": "Block", + "src": "2503:79:13", + "statements": [ + { + "AST": { + "nativeSrc": "2538:38:13", + "nodeType": "YulBlock", + "src": "2538:38:13", + "statements": [ + { + "nativeSrc": "2552:14:13", + "nodeType": "YulAssignment", + "src": "2552:14:13", + "value": { + "name": "slot", + "nativeSrc": "2562:4:13", + "nodeType": "YulIdentifier", + "src": "2562:4:13" + }, + "variableNames": [ + { + "name": "r.slot", + "nativeSrc": "2552:6:13", + "nodeType": "YulIdentifier", + "src": "2552:6:13" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2097, + "isOffset": false, + "isSlot": true, + "src": "2552:6:13", + "suffix": "slot", + "valueSize": 1 + }, + { + "declaration": 2093, + "isOffset": false, + "isSlot": false, + "src": "2562:4:13", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2099, + "nodeType": "InlineAssembly", + "src": "2513:63:13" + } + ] + }, + "documentation": { + "id": 2091, + "nodeType": "StructuredDocumentation", + "src": "2328:86:13", + "text": " @dev Returns a `Bytes32Slot` with member `value` located at `slot`." + }, + "id": 2101, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getBytes32Slot", + "nameLocation": "2428:14:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2094, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2093, + "mutability": "mutable", + "name": "slot", + "nameLocation": "2451:4:13", + "nodeType": "VariableDeclaration", + "scope": 2101, + "src": "2443:12:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2092, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2443:7:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "2442:14:13" + }, + "returnParameters": { + "id": 2098, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2097, + "mutability": "mutable", + "name": "r", + "nameLocation": "2500:1:13", + "nodeType": "VariableDeclaration", + "scope": 2101, + "src": "2480:21:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Bytes32Slot_$2056_storage_ptr", + "typeString": "struct StorageSlot.Bytes32Slot" + }, + "typeName": { + "id": 2096, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2095, + "name": "Bytes32Slot", + "nameLocations": [ + "2480:11:13" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2056, + "src": "2480:11:13" + }, + "referencedDeclaration": 2056, + "src": "2480:11:13", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Bytes32Slot_$2056_storage_ptr", + "typeString": "struct StorageSlot.Bytes32Slot" + } + }, + "visibility": "internal" + } + ], + "src": "2479:23:13" + }, + "scope": 2168, + "src": "2419:163:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2111, + "nodeType": "Block", + "src": "2763:79:13", + "statements": [ + { + "AST": { + "nativeSrc": "2798:38:13", + "nodeType": "YulBlock", + "src": "2798:38:13", + "statements": [ + { + "nativeSrc": "2812:14:13", + "nodeType": "YulAssignment", + "src": "2812:14:13", + "value": { + "name": "slot", + "nativeSrc": "2822:4:13", + "nodeType": "YulIdentifier", + "src": "2822:4:13" + }, + "variableNames": [ + { + "name": "r.slot", + "nativeSrc": "2812:6:13", + "nodeType": "YulIdentifier", + "src": "2812:6:13" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2108, + "isOffset": false, + "isSlot": true, + "src": "2812:6:13", + "suffix": "slot", + "valueSize": 1 + }, + { + "declaration": 2104, + "isOffset": false, + "isSlot": false, + "src": "2822:4:13", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2110, + "nodeType": "InlineAssembly", + "src": "2773:63:13" + } + ] + }, + "documentation": { + "id": 2102, + "nodeType": "StructuredDocumentation", + "src": "2588:86:13", + "text": " @dev Returns a `Uint256Slot` with member `value` located at `slot`." + }, + "id": 2112, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getUint256Slot", + "nameLocation": "2688:14:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2105, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2104, + "mutability": "mutable", + "name": "slot", + "nameLocation": "2711:4:13", + "nodeType": "VariableDeclaration", + "scope": 2112, + "src": "2703:12:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2103, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2703:7:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "2702:14:13" + }, + "returnParameters": { + "id": 2109, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2108, + "mutability": "mutable", + "name": "r", + "nameLocation": "2760:1:13", + "nodeType": "VariableDeclaration", + "scope": 2112, + "src": "2740:21:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Uint256Slot_$2059_storage_ptr", + "typeString": "struct StorageSlot.Uint256Slot" + }, + "typeName": { + "id": 2107, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2106, + "name": "Uint256Slot", + "nameLocations": [ + "2740:11:13" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2059, + "src": "2740:11:13" + }, + "referencedDeclaration": 2059, + "src": "2740:11:13", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Uint256Slot_$2059_storage_ptr", + "typeString": "struct StorageSlot.Uint256Slot" + } + }, + "visibility": "internal" + } + ], + "src": "2739:23:13" + }, + "scope": 2168, + "src": "2679:163:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2122, + "nodeType": "Block", + "src": "3020:79:13", + "statements": [ + { + "AST": { + "nativeSrc": "3055:38:13", + "nodeType": "YulBlock", + "src": "3055:38:13", + "statements": [ + { + "nativeSrc": "3069:14:13", + "nodeType": "YulAssignment", + "src": "3069:14:13", + "value": { + "name": "slot", + "nativeSrc": "3079:4:13", + "nodeType": "YulIdentifier", + "src": "3079:4:13" + }, + "variableNames": [ + { + "name": "r.slot", + "nativeSrc": "3069:6:13", + "nodeType": "YulIdentifier", + "src": "3069:6:13" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2119, + "isOffset": false, + "isSlot": true, + "src": "3069:6:13", + "suffix": "slot", + "valueSize": 1 + }, + { + "declaration": 2115, + "isOffset": false, + "isSlot": false, + "src": "3079:4:13", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2121, + "nodeType": "InlineAssembly", + "src": "3030:63:13" + } + ] + }, + "documentation": { + "id": 2113, + "nodeType": "StructuredDocumentation", + "src": "2848:85:13", + "text": " @dev Returns a `Int256Slot` with member `value` located at `slot`." + }, + "id": 2123, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getInt256Slot", + "nameLocation": "2947:13:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2116, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2115, + "mutability": "mutable", + "name": "slot", + "nameLocation": "2969:4:13", + "nodeType": "VariableDeclaration", + "scope": 2123, + "src": "2961:12:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2114, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2961:7:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "2960:14:13" + }, + "returnParameters": { + "id": 2120, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2119, + "mutability": "mutable", + "name": "r", + "nameLocation": "3017:1:13", + "nodeType": "VariableDeclaration", + "scope": 2123, + "src": "2998:20:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Int256Slot_$2062_storage_ptr", + "typeString": "struct StorageSlot.Int256Slot" + }, + "typeName": { + "id": 2118, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2117, + "name": "Int256Slot", + "nameLocations": [ + "2998:10:13" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2062, + "src": "2998:10:13" + }, + "referencedDeclaration": 2062, + "src": "2998:10:13", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Int256Slot_$2062_storage_ptr", + "typeString": "struct StorageSlot.Int256Slot" + } + }, + "visibility": "internal" + } + ], + "src": "2997:22:13" + }, + "scope": 2168, + "src": "2938:161:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2133, + "nodeType": "Block", + "src": "3277:79:13", + "statements": [ + { + "AST": { + "nativeSrc": "3312:38:13", + "nodeType": "YulBlock", + "src": "3312:38:13", + "statements": [ + { + "nativeSrc": "3326:14:13", + "nodeType": "YulAssignment", + "src": "3326:14:13", + "value": { + "name": "slot", + "nativeSrc": "3336:4:13", + "nodeType": "YulIdentifier", + "src": "3336:4:13" + }, + "variableNames": [ + { + "name": "r.slot", + "nativeSrc": "3326:6:13", + "nodeType": "YulIdentifier", + "src": "3326:6:13" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2130, + "isOffset": false, + "isSlot": true, + "src": "3326:6:13", + "suffix": "slot", + "valueSize": 1 + }, + { + "declaration": 2126, + "isOffset": false, + "isSlot": false, + "src": "3336:4:13", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2132, + "nodeType": "InlineAssembly", + "src": "3287:63:13" + } + ] + }, + "documentation": { + "id": 2124, + "nodeType": "StructuredDocumentation", + "src": "3105:85:13", + "text": " @dev Returns a `StringSlot` with member `value` located at `slot`." + }, + "id": 2134, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getStringSlot", + "nameLocation": "3204:13:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2127, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2126, + "mutability": "mutable", + "name": "slot", + "nameLocation": "3226:4:13", + "nodeType": "VariableDeclaration", + "scope": 2134, + "src": "3218:12:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2125, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3218:7:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "3217:14:13" + }, + "returnParameters": { + "id": 2131, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2130, + "mutability": "mutable", + "name": "r", + "nameLocation": "3274:1:13", + "nodeType": "VariableDeclaration", + "scope": 2134, + "src": "3255:20:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_StringSlot_$2065_storage_ptr", + "typeString": "struct StorageSlot.StringSlot" + }, + "typeName": { + "id": 2129, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2128, + "name": "StringSlot", + "nameLocations": [ + "3255:10:13" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2065, + "src": "3255:10:13" + }, + "referencedDeclaration": 2065, + "src": "3255:10:13", + "typeDescriptions": { + "typeIdentifier": "t_struct$_StringSlot_$2065_storage_ptr", + "typeString": "struct StorageSlot.StringSlot" + } + }, + "visibility": "internal" + } + ], + "src": "3254:22:13" + }, + "scope": 2168, + "src": "3195:161:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2144, + "nodeType": "Block", + "src": "3558:85:13", + "statements": [ + { + "AST": { + "nativeSrc": "3593:44:13", + "nodeType": "YulBlock", + "src": "3593:44:13", + "statements": [ + { + "nativeSrc": "3607:20:13", + "nodeType": "YulAssignment", + "src": "3607:20:13", + "value": { + "name": "store.slot", + "nativeSrc": "3617:10:13", + "nodeType": "YulIdentifier", + "src": "3617:10:13" + }, + "variableNames": [ + { + "name": "r.slot", + "nativeSrc": "3607:6:13", + "nodeType": "YulIdentifier", + "src": "3607:6:13" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2141, + "isOffset": false, + "isSlot": true, + "src": "3607:6:13", + "suffix": "slot", + "valueSize": 1 + }, + { + "declaration": 2137, + "isOffset": false, + "isSlot": true, + "src": "3617:10:13", + "suffix": "slot", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2143, + "nodeType": "InlineAssembly", + "src": "3568:69:13" + } + ] + }, + "documentation": { + "id": 2135, + "nodeType": "StructuredDocumentation", + "src": "3362:101:13", + "text": " @dev Returns an `StringSlot` representation of the string storage pointer `store`." + }, + "id": 2145, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getStringSlot", + "nameLocation": "3477:13:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2138, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2137, + "mutability": "mutable", + "name": "store", + "nameLocation": "3506:5:13", + "nodeType": "VariableDeclaration", + "scope": 2145, + "src": "3491:20:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2136, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "3491:6:13", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "3490:22:13" + }, + "returnParameters": { + "id": 2142, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2141, + "mutability": "mutable", + "name": "r", + "nameLocation": "3555:1:13", + "nodeType": "VariableDeclaration", + "scope": 2145, + "src": "3536:20:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_StringSlot_$2065_storage_ptr", + "typeString": "struct StorageSlot.StringSlot" + }, + "typeName": { + "id": 2140, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2139, + "name": "StringSlot", + "nameLocations": [ + "3536:10:13" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2065, + "src": "3536:10:13" + }, + "referencedDeclaration": 2065, + "src": "3536:10:13", + "typeDescriptions": { + "typeIdentifier": "t_struct$_StringSlot_$2065_storage_ptr", + "typeString": "struct StorageSlot.StringSlot" + } + }, + "visibility": "internal" + } + ], + "src": "3535:22:13" + }, + "scope": 2168, + "src": "3468:175:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2155, + "nodeType": "Block", + "src": "3818:79:13", + "statements": [ + { + "AST": { + "nativeSrc": "3853:38:13", + "nodeType": "YulBlock", + "src": "3853:38:13", + "statements": [ + { + "nativeSrc": "3867:14:13", + "nodeType": "YulAssignment", + "src": "3867:14:13", + "value": { + "name": "slot", + "nativeSrc": "3877:4:13", + "nodeType": "YulIdentifier", + "src": "3877:4:13" + }, + "variableNames": [ + { + "name": "r.slot", + "nativeSrc": "3867:6:13", + "nodeType": "YulIdentifier", + "src": "3867:6:13" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2152, + "isOffset": false, + "isSlot": true, + "src": "3867:6:13", + "suffix": "slot", + "valueSize": 1 + }, + { + "declaration": 2148, + "isOffset": false, + "isSlot": false, + "src": "3877:4:13", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2154, + "nodeType": "InlineAssembly", + "src": "3828:63:13" + } + ] + }, + "documentation": { + "id": 2146, + "nodeType": "StructuredDocumentation", + "src": "3649:84:13", + "text": " @dev Returns a `BytesSlot` with member `value` located at `slot`." + }, + "id": 2156, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getBytesSlot", + "nameLocation": "3747:12:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2149, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2148, + "mutability": "mutable", + "name": "slot", + "nameLocation": "3768:4:13", + "nodeType": "VariableDeclaration", + "scope": 2156, + "src": "3760:12:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2147, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3760:7:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "3759:14:13" + }, + "returnParameters": { + "id": 2153, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2152, + "mutability": "mutable", + "name": "r", + "nameLocation": "3815:1:13", + "nodeType": "VariableDeclaration", + "scope": 2156, + "src": "3797:19:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_BytesSlot_$2068_storage_ptr", + "typeString": "struct StorageSlot.BytesSlot" + }, + "typeName": { + "id": 2151, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2150, + "name": "BytesSlot", + "nameLocations": [ + "3797:9:13" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2068, + "src": "3797:9:13" + }, + "referencedDeclaration": 2068, + "src": "3797:9:13", + "typeDescriptions": { + "typeIdentifier": "t_struct$_BytesSlot_$2068_storage_ptr", + "typeString": "struct StorageSlot.BytesSlot" + } + }, + "visibility": "internal" + } + ], + "src": "3796:21:13" + }, + "scope": 2168, + "src": "3738:159:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2166, + "nodeType": "Block", + "src": "4094:85:13", + "statements": [ + { + "AST": { + "nativeSrc": "4129:44:13", + "nodeType": "YulBlock", + "src": "4129:44:13", + "statements": [ + { + "nativeSrc": "4143:20:13", + "nodeType": "YulAssignment", + "src": "4143:20:13", + "value": { + "name": "store.slot", + "nativeSrc": "4153:10:13", + "nodeType": "YulIdentifier", + "src": "4153:10:13" + }, + "variableNames": [ + { + "name": "r.slot", + "nativeSrc": "4143:6:13", + "nodeType": "YulIdentifier", + "src": "4143:6:13" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2163, + "isOffset": false, + "isSlot": true, + "src": "4143:6:13", + "suffix": "slot", + "valueSize": 1 + }, + { + "declaration": 2159, + "isOffset": false, + "isSlot": true, + "src": "4153:10:13", + "suffix": "slot", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2165, + "nodeType": "InlineAssembly", + "src": "4104:69:13" + } + ] + }, + "documentation": { + "id": 2157, + "nodeType": "StructuredDocumentation", + "src": "3903:99:13", + "text": " @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`." + }, + "id": 2167, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getBytesSlot", + "nameLocation": "4016:12:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2160, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2159, + "mutability": "mutable", + "name": "store", + "nameLocation": "4043:5:13", + "nodeType": "VariableDeclaration", + "scope": 2167, + "src": "4029:19:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2158, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4029:5:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "4028:21:13" + }, + "returnParameters": { + "id": 2164, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2163, + "mutability": "mutable", + "name": "r", + "nameLocation": "4091:1:13", + "nodeType": "VariableDeclaration", + "scope": 2167, + "src": "4073:19:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_BytesSlot_$2068_storage_ptr", + "typeString": "struct StorageSlot.BytesSlot" + }, + "typeName": { + "id": 2162, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2161, + "name": "BytesSlot", + "nameLocations": [ + "4073:9:13" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2068, + "src": "4073:9:13" + }, + "referencedDeclaration": 2068, + "src": "4073:9:13", + "typeDescriptions": { + "typeIdentifier": "t_struct$_BytesSlot_$2068_storage_ptr", + "typeString": "struct StorageSlot.BytesSlot" + } + }, + "visibility": "internal" + } + ], + "src": "4072:21:13" + }, + "scope": 2168, + "src": "4007:172:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + } + ], + "scope": 2169, + "src": "1407:2774:13", + "usedErrors": [], + "usedEvents": [] + } + ], + "src": "193:3989:13" + }, + "id": 13 + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/Strings.sol", + "exportedSymbols": { + "Bytes": [ + 1632 + ], + "Math": [ + 6204 + ], + "SafeCast": [ + 7969 + ], + "SignedMath": [ + 8113 + ], + "Strings": [ + 3678 + ] + }, + "id": 3679, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 2170, + "literals": [ + "solidity", + "^", + "0.8", + ".24" + ], + "nodeType": "PragmaDirective", + "src": "101:24:14" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/math/Math.sol", + "file": "./math/Math.sol", + "id": 2172, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3679, + "sourceUnit": 6205, + "src": "127:37:14", + "symbolAliases": [ + { + "foreign": { + "id": 2171, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "135:4:14", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/math/SafeCast.sol", + "file": "./math/SafeCast.sol", + "id": 2174, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3679, + "sourceUnit": 7970, + "src": "165:45:14", + "symbolAliases": [ + { + "foreign": { + "id": 2173, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "173:8:14", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/math/SignedMath.sol", + "file": "./math/SignedMath.sol", + "id": 2176, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3679, + "sourceUnit": 8114, + "src": "211:49:14", + "symbolAliases": [ + { + "foreign": { + "id": 2175, + "name": "SignedMath", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8113, + "src": "219:10:14", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/Bytes.sol", + "file": "./Bytes.sol", + "id": 2178, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3679, + "sourceUnit": 1633, + "src": "261:34:14", + "symbolAliases": [ + { + "foreign": { + "id": 2177, + "name": "Bytes", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1632, + "src": "269:5:14", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "Strings", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 2179, + "nodeType": "StructuredDocumentation", + "src": "297:34:14", + "text": " @dev String operations." + }, + "fullyImplemented": true, + "id": 3678, + "linearizedBaseContracts": [ + 3678 + ], + "name": "Strings", + "nameLocation": "340:7:14", + "nodeType": "ContractDefinition", + "nodes": [ + { + "global": false, + "id": 2181, + "libraryName": { + "id": 2180, + "name": "SafeCast", + "nameLocations": [ + "360:8:14" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 7969, + "src": "360:8:14" + }, + "nodeType": "UsingForDirective", + "src": "354:21:14" + }, + { + "constant": true, + "id": 2184, + "mutability": "constant", + "name": "HEX_DIGITS", + "nameLocation": "406:10:14", + "nodeType": "VariableDeclaration", + "scope": 3678, + "src": "381:56:14", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "typeName": { + "id": 2182, + "name": "bytes16", + "nodeType": "ElementaryTypeName", + "src": "381:7:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "value": { + "hexValue": "30313233343536373839616263646566", + "id": 2183, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "419:18:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_cb29997ed99ead0db59ce4d12b7d3723198c827273e5796737c926d78019c39f", + "typeString": "literal_string \"0123456789abcdef\"" + }, + "value": "0123456789abcdef" + }, + "visibility": "private" + }, + { + "constant": true, + "id": 2187, + "mutability": "constant", + "name": "ADDRESS_LENGTH", + "nameLocation": "466:14:14", + "nodeType": "VariableDeclaration", + "scope": 3678, + "src": "443:42:14", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 2185, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "443:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "value": { + "hexValue": "3230", + "id": 2186, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "483:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_20_by_1", + "typeString": "int_const 20" + }, + "value": "20" + }, + "visibility": "private" + }, + { + "constant": true, + "id": 2200, + "mutability": "constant", + "name": "SPECIAL_CHARS_LOOKUP", + "nameLocation": "516:20:14", + "nodeType": "VariableDeclaration", + "scope": 3678, + "src": "491:210:14", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2188, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "491:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "commonType": { + "typeIdentifier": "t_rational_4951760157141521121071333375_by_1", + "typeString": "int_const 4951760157141521121071333375" + }, + "id": 2199, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_rational_21474836479_by_1", + "typeString": "int_const 21474836479" + }, + "id": 2194, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "30786666666666666666", + "id": 2189, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "547:10:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_4294967295_by_1", + "typeString": "int_const 4294967295" + }, + "value": "0xffffffff" + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_rational_17179869184_by_1", + "typeString": "int_const 17179869184" + }, + "id": 2192, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 2190, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "649:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "30783232", + "id": 2191, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "654:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_34_by_1", + "typeString": "int_const 34" + }, + "value": "0x22" + }, + "src": "649:9:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_17179869184_by_1", + "typeString": "int_const 17179869184" + } + } + ], + "id": 2193, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "648:11:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_17179869184_by_1", + "typeString": "int_const 17179869184" + } + }, + "src": "547:112:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_21474836479_by_1", + "typeString": "int_const 21474836479" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_rational_4951760157141521099596496896_by_1", + "typeString": "int_const 4951760157141521099596496896" + }, + "id": 2197, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 2195, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "691:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "30783563", + "id": 2196, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "696:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_92_by_1", + "typeString": "int_const 92" + }, + "value": "0x5c" + }, + "src": "691:9:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_4951760157141521099596496896_by_1", + "typeString": "int_const 4951760157141521099596496896" + } + } + ], + "id": 2198, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "690:11:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_4951760157141521099596496896_by_1", + "typeString": "int_const 4951760157141521099596496896" + } + }, + "src": "547:154:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_4951760157141521121071333375_by_1", + "typeString": "int_const 4951760157141521121071333375" + } + }, + "visibility": "private" + }, + { + "documentation": { + "id": 2201, + "nodeType": "StructuredDocumentation", + "src": "721:81:14", + "text": " @dev The `value` string doesn't fit in the specified `length`." + }, + "errorSelector": "e22e27eb", + "id": 2207, + "name": "StringsInsufficientHexLength", + "nameLocation": "813:28:14", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 2206, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2203, + "mutability": "mutable", + "name": "value", + "nameLocation": "850:5:14", + "nodeType": "VariableDeclaration", + "scope": 2207, + "src": "842:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2202, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "842:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2205, + "mutability": "mutable", + "name": "length", + "nameLocation": "865:6:14", + "nodeType": "VariableDeclaration", + "scope": 2207, + "src": "857:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2204, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "857:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "841:31:14" + }, + "src": "807:66:14" + }, + { + "documentation": { + "id": 2208, + "nodeType": "StructuredDocumentation", + "src": "879:108:14", + "text": " @dev The string being parsed contains characters that are not in scope of the given base." + }, + "errorSelector": "94e2737e", + "id": 2210, + "name": "StringsInvalidChar", + "nameLocation": "998:18:14", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 2209, + "nodeType": "ParameterList", + "parameters": [], + "src": "1016:2:14" + }, + "src": "992:27:14" + }, + { + "documentation": { + "id": 2211, + "nodeType": "StructuredDocumentation", + "src": "1025:84:14", + "text": " @dev The string being parsed is not a properly formatted address." + }, + "errorSelector": "1d15ae44", + "id": 2213, + "name": "StringsInvalidAddressFormat", + "nameLocation": "1120:27:14", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 2212, + "nodeType": "ParameterList", + "parameters": [], + "src": "1147:2:14" + }, + "src": "1114:36:14" + }, + { + "body": { + "id": 2260, + "nodeType": "Block", + "src": "1322:563:14", + "statements": [ + { + "id": 2259, + "nodeType": "UncheckedBlock", + "src": "1332:547:14", + "statements": [ + { + "assignments": [ + 2222 + ], + "declarations": [ + { + "constant": false, + "id": 2222, + "mutability": "mutable", + "name": "length", + "nameLocation": "1364:6:14", + "nodeType": "VariableDeclaration", + "scope": 2259, + "src": "1356:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2221, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1356:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2229, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2228, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 2225, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2216, + "src": "1384:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 2223, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "1373:4:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 2224, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "1378:5:14", + "memberName": "log10", + "nodeType": "MemberAccess", + "referencedDeclaration": 6015, + "src": "1373:10:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256) pure returns (uint256)" + } + }, + "id": 2226, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1373:17:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "31", + "id": 2227, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1393:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "1373:21:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1356:38:14" + }, + { + "assignments": [ + 2231 + ], + "declarations": [ + { + "constant": false, + "id": 2231, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "1422:6:14", + "nodeType": "VariableDeclaration", + "scope": 2259, + "src": "1408:20:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2230, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1408:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "id": 2236, + "initialValue": { + "arguments": [ + { + "id": 2234, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2222, + "src": "1442:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2233, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "1431:10:14", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_string_memory_ptr_$", + "typeString": "function (uint256) pure returns (string memory)" + }, + "typeName": { + "id": 2232, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1435:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + } + }, + "id": 2235, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1431:18:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1408:41:14" + }, + { + "assignments": [ + 2238 + ], + "declarations": [ + { + "constant": false, + "id": 2238, + "mutability": "mutable", + "name": "ptr", + "nameLocation": "1471:3:14", + "nodeType": "VariableDeclaration", + "scope": 2259, + "src": "1463:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2237, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1463:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2239, + "nodeType": "VariableDeclarationStatement", + "src": "1463:11:14" + }, + { + "AST": { + "nativeSrc": "1513:69:14", + "nodeType": "YulBlock", + "src": "1513:69:14", + "statements": [ + { + "nativeSrc": "1531:37:14", + "nodeType": "YulAssignment", + "src": "1531:37:14", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "1546:6:14", + "nodeType": "YulIdentifier", + "src": "1546:6:14" + }, + { + "kind": "number", + "nativeSrc": "1554:4:14", + "nodeType": "YulLiteral", + "src": "1554:4:14", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1542:3:14", + "nodeType": "YulIdentifier", + "src": "1542:3:14" + }, + "nativeSrc": "1542:17:14", + "nodeType": "YulFunctionCall", + "src": "1542:17:14" + }, + { + "name": "length", + "nativeSrc": "1561:6:14", + "nodeType": "YulIdentifier", + "src": "1561:6:14" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1538:3:14", + "nodeType": "YulIdentifier", + "src": "1538:3:14" + }, + "nativeSrc": "1538:30:14", + "nodeType": "YulFunctionCall", + "src": "1538:30:14" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "1531:3:14", + "nodeType": "YulIdentifier", + "src": "1531:3:14" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2231, + "isOffset": false, + "isSlot": false, + "src": "1546:6:14", + "valueSize": 1 + }, + { + "declaration": 2222, + "isOffset": false, + "isSlot": false, + "src": "1561:6:14", + "valueSize": 1 + }, + { + "declaration": 2238, + "isOffset": false, + "isSlot": false, + "src": "1531:3:14", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2240, + "nodeType": "InlineAssembly", + "src": "1488:94:14" + }, + { + "body": { + "id": 2255, + "nodeType": "Block", + "src": "1608:234:14", + "statements": [ + { + "expression": { + "id": 2243, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "--", + "prefix": false, + "src": "1626:5:14", + "subExpression": { + "id": 2242, + "name": "ptr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2238, + "src": "1626:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2244, + "nodeType": "ExpressionStatement", + "src": "1626:5:14" + }, + { + "AST": { + "nativeSrc": "1674:86:14", + "nodeType": "YulBlock", + "src": "1674:86:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "1704:3:14", + "nodeType": "YulIdentifier", + "src": "1704:3:14" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nativeSrc": "1718:5:14", + "nodeType": "YulIdentifier", + "src": "1718:5:14" + }, + { + "kind": "number", + "nativeSrc": "1725:2:14", + "nodeType": "YulLiteral", + "src": "1725:2:14", + "type": "", + "value": "10" + } + ], + "functionName": { + "name": "mod", + "nativeSrc": "1714:3:14", + "nodeType": "YulIdentifier", + "src": "1714:3:14" + }, + "nativeSrc": "1714:14:14", + "nodeType": "YulFunctionCall", + "src": "1714:14:14" + }, + { + "name": "HEX_DIGITS", + "nativeSrc": "1730:10:14", + "nodeType": "YulIdentifier", + "src": "1730:10:14" + } + ], + "functionName": { + "name": "byte", + "nativeSrc": "1709:4:14", + "nodeType": "YulIdentifier", + "src": "1709:4:14" + }, + "nativeSrc": "1709:32:14", + "nodeType": "YulFunctionCall", + "src": "1709:32:14" + } + ], + "functionName": { + "name": "mstore8", + "nativeSrc": "1696:7:14", + "nodeType": "YulIdentifier", + "src": "1696:7:14" + }, + "nativeSrc": "1696:46:14", + "nodeType": "YulFunctionCall", + "src": "1696:46:14" + }, + "nativeSrc": "1696:46:14", + "nodeType": "YulExpressionStatement", + "src": "1696:46:14" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2184, + "isOffset": false, + "isSlot": false, + "src": "1730:10:14", + "valueSize": 1 + }, + { + "declaration": 2238, + "isOffset": false, + "isSlot": false, + "src": "1704:3:14", + "valueSize": 1 + }, + { + "declaration": 2216, + "isOffset": false, + "isSlot": false, + "src": "1718:5:14", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2245, + "nodeType": "InlineAssembly", + "src": "1649:111:14" + }, + { + "expression": { + "id": 2248, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 2246, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2216, + "src": "1777:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "/=", + "rightHandSide": { + "hexValue": "3130", + "id": 2247, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1786:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "src": "1777:11:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2249, + "nodeType": "ExpressionStatement", + "src": "1777:11:14" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2252, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2250, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2216, + "src": "1810:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 2251, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1819:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "1810:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2254, + "nodeType": "IfStatement", + "src": "1806:21:14", + "trueBody": { + "id": 2253, + "nodeType": "Break", + "src": "1822:5:14" + } + } + ] + }, + "condition": { + "hexValue": "74727565", + "id": 2241, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1602:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "id": 2256, + "nodeType": "WhileStatement", + "src": "1595:247:14" + }, + { + "expression": { + "id": 2257, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2231, + "src": "1862:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 2220, + "id": 2258, + "nodeType": "Return", + "src": "1855:13:14" + } + ] + } + ] + }, + "documentation": { + "id": 2214, + "nodeType": "StructuredDocumentation", + "src": "1156:90:14", + "text": " @dev Converts a `uint256` to its ASCII `string` decimal representation." + }, + "id": 2261, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toString", + "nameLocation": "1260:8:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2217, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2216, + "mutability": "mutable", + "name": "value", + "nameLocation": "1277:5:14", + "nodeType": "VariableDeclaration", + "scope": 2261, + "src": "1269:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2215, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1269:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1268:15:14" + }, + "returnParameters": { + "id": 2220, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2219, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2261, + "src": "1307:13:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2218, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1307:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "1306:15:14" + }, + "scope": 3678, + "src": "1251:634:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2286, + "nodeType": "Block", + "src": "2061:92:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 2274, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2272, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2264, + "src": "2092:5:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "hexValue": "30", + "id": 2273, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2100:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "2092:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseExpression": { + "hexValue": "", + "id": 2276, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2110:2:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "typeString": "literal_string \"\"" + }, + "value": "" + }, + "id": 2277, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "Conditional", + "src": "2092:20:14", + "trueExpression": { + "hexValue": "2d", + "id": 2275, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2104:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_d3b8281179950f98149eefdb158d0e1acb56f56e8e343aa9fefafa7e36959561", + "typeString": "literal_string \"-\"" + }, + "value": "-" + }, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "arguments": [ + { + "arguments": [ + { + "id": 2281, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2264, + "src": "2138:5:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "expression": { + "id": 2279, + "name": "SignedMath", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8113, + "src": "2123:10:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SignedMath_$8113_$", + "typeString": "type(library SignedMath)" + } + }, + "id": 2280, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2134:3:14", + "memberName": "abs", + "nodeType": "MemberAccess", + "referencedDeclaration": 8112, + "src": "2123:14:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_int256_$returns$_t_uint256_$", + "typeString": "function (int256) pure returns (uint256)" + } + }, + "id": 2282, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2123:21:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2278, + "name": "toString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2261, + "src": "2114:8:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_string_memory_ptr_$", + "typeString": "function (uint256) pure returns (string memory)" + } + }, + "id": 2283, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2114:31:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "expression": { + "id": 2270, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2078:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_string_storage_ptr_$", + "typeString": "type(string storage pointer)" + }, + "typeName": { + "id": 2269, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2078:6:14", + "typeDescriptions": {} + } + }, + "id": 2271, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2085:6:14", + "memberName": "concat", + "nodeType": "MemberAccess", + "src": "2078:13:14", + "typeDescriptions": { + "typeIdentifier": "t_function_stringconcat_pure$__$returns$_t_string_memory_ptr_$", + "typeString": "function () pure returns (string memory)" + } + }, + "id": 2284, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2078:68:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 2268, + "id": 2285, + "nodeType": "Return", + "src": "2071:75:14" + } + ] + }, + "documentation": { + "id": 2262, + "nodeType": "StructuredDocumentation", + "src": "1891:89:14", + "text": " @dev Converts a `int256` to its ASCII `string` decimal representation." + }, + "id": 2287, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toStringSigned", + "nameLocation": "1994:14:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2265, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2264, + "mutability": "mutable", + "name": "value", + "nameLocation": "2016:5:14", + "nodeType": "VariableDeclaration", + "scope": 2287, + "src": "2009:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 2263, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "2009:6:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "2008:14:14" + }, + "returnParameters": { + "id": 2268, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2267, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2287, + "src": "2046:13:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2266, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2046:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "2045:15:14" + }, + "scope": 3678, + "src": "1985:168:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2306, + "nodeType": "Block", + "src": "2332:100:14", + "statements": [ + { + "id": 2305, + "nodeType": "UncheckedBlock", + "src": "2342:84:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2296, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2290, + "src": "2385:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2302, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 2299, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2290, + "src": "2404:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 2297, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "2392:4:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 2298, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2397:6:14", + "memberName": "log256", + "nodeType": "MemberAccess", + "referencedDeclaration": 6126, + "src": "2392:11:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256) pure returns (uint256)" + } + }, + "id": 2300, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2392:18:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "31", + "id": 2301, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2413:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "2392:22:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2295, + "name": "toHexString", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2307, + 2390, + 2410, + 2564 + ], + "referencedDeclaration": 2390, + "src": "2373:11:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_string_memory_ptr_$", + "typeString": "function (uint256,uint256) pure returns (string memory)" + } + }, + "id": 2303, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2373:42:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 2294, + "id": 2304, + "nodeType": "Return", + "src": "2366:49:14" + } + ] + } + ] + }, + "documentation": { + "id": 2288, + "nodeType": "StructuredDocumentation", + "src": "2159:94:14", + "text": " @dev Converts a `uint256` to its ASCII `string` hexadecimal representation." + }, + "id": 2307, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toHexString", + "nameLocation": "2267:11:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2291, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2290, + "mutability": "mutable", + "name": "value", + "nameLocation": "2287:5:14", + "nodeType": "VariableDeclaration", + "scope": 2307, + "src": "2279:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2289, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2279:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2278:15:14" + }, + "returnParameters": { + "id": 2294, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2293, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2307, + "src": "2317:13:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2292, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2317:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "2316:15:14" + }, + "scope": 3678, + "src": "2258:174:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2389, + "nodeType": "Block", + "src": "2645:435:14", + "statements": [ + { + "assignments": [ + 2318 + ], + "declarations": [ + { + "constant": false, + "id": 2318, + "mutability": "mutable", + "name": "localValue", + "nameLocation": "2663:10:14", + "nodeType": "VariableDeclaration", + "scope": 2389, + "src": "2655:18:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2317, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2655:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2320, + "initialValue": { + "id": 2319, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2310, + "src": "2676:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2655:26:14" + }, + { + "assignments": [ + 2322 + ], + "declarations": [ + { + "constant": false, + "id": 2322, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "2704:6:14", + "nodeType": "VariableDeclaration", + "scope": 2389, + "src": "2691:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2321, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2691:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 2331, + "initialValue": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2329, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2327, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 2325, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2723:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 2326, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2312, + "src": "2727:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2723:10:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "32", + "id": 2328, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2736:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "2723:14:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2324, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "2713:9:14", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (uint256) pure returns (bytes memory)" + }, + "typeName": { + "id": 2323, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2717:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + } + }, + "id": 2330, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2713:25:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2691:47:14" + }, + { + "expression": { + "id": 2336, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 2332, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2322, + "src": "2748:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2334, + "indexExpression": { + "hexValue": "30", + "id": 2333, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2755:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2748:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "hexValue": "30", + "id": 2335, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2760:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", + "typeString": "literal_string \"0\"" + }, + "value": "0" + }, + "src": "2748:15:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 2337, + "nodeType": "ExpressionStatement", + "src": "2748:15:14" + }, + { + "expression": { + "id": 2342, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 2338, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2322, + "src": "2773:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2340, + "indexExpression": { + "hexValue": "31", + "id": 2339, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2780:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2773:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "hexValue": "78", + "id": 2341, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2785:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_7521d1cadbcfa91eec65aa16715b94ffc1c9654ba57ea2ef1a2127bca1127a83", + "typeString": "literal_string \"x\"" + }, + "value": "x" + }, + "src": "2773:15:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 2343, + "nodeType": "ExpressionStatement", + "src": "2773:15:14" + }, + { + "body": { + "id": 2372, + "nodeType": "Block", + "src": "2843:95:14", + "statements": [ + { + "expression": { + "id": 2366, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 2358, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2322, + "src": "2857:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2360, + "indexExpression": { + "id": 2359, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2345, + "src": "2864:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2857:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "baseExpression": { + "id": 2361, + "name": "HEX_DIGITS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2184, + "src": "2869:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "id": 2365, + "indexExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2364, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2362, + "name": "localValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2318, + "src": "2880:10:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307866", + "id": 2363, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2893:3:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_15_by_1", + "typeString": "int_const 15" + }, + "value": "0xf" + }, + "src": "2880:16:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2869:28:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "src": "2857:40:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 2367, + "nodeType": "ExpressionStatement", + "src": "2857:40:14" + }, + { + "expression": { + "id": 2370, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 2368, + "name": "localValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2318, + "src": "2911:10:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": ">>=", + "rightHandSide": { + "hexValue": "34", + "id": 2369, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2926:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "2911:16:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2371, + "nodeType": "ExpressionStatement", + "src": "2911:16:14" + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2354, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2352, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2345, + "src": "2831:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "31", + "id": 2353, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2835:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "2831:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2373, + "initializationExpression": { + "assignments": [ + 2345 + ], + "declarations": [ + { + "constant": false, + "id": 2345, + "mutability": "mutable", + "name": "i", + "nameLocation": "2811:1:14", + "nodeType": "VariableDeclaration", + "scope": 2373, + "src": "2803:9:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2344, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2803:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2351, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2350, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2348, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 2346, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2815:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 2347, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2312, + "src": "2819:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2815:10:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "31", + "id": 2349, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2828:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "2815:14:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2803:26:14" + }, + "isSimpleCounterLoop": false, + "loopExpression": { + "expression": { + "id": 2356, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "--", + "prefix": true, + "src": "2838:3:14", + "subExpression": { + "id": 2355, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2345, + "src": "2840:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2357, + "nodeType": "ExpressionStatement", + "src": "2838:3:14" + }, + "nodeType": "ForStatement", + "src": "2798:140:14" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2376, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2374, + "name": "localValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2318, + "src": "2951:10:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "hexValue": "30", + "id": 2375, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2965:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "2951:15:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2383, + "nodeType": "IfStatement", + "src": "2947:96:14", + "trueBody": { + "id": 2382, + "nodeType": "Block", + "src": "2968:75:14", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "id": 2378, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2310, + "src": "3018:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2379, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2312, + "src": "3025:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2377, + "name": "StringsInsufficientHexLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2207, + "src": "2989:28:14", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint256_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint256,uint256) pure returns (error)" + } + }, + "id": 2380, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2989:43:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 2381, + "nodeType": "RevertStatement", + "src": "2982:50:14" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 2386, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2322, + "src": "3066:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 2385, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3059:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_string_storage_ptr_$", + "typeString": "type(string storage pointer)" + }, + "typeName": { + "id": 2384, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "3059:6:14", + "typeDescriptions": {} + } + }, + "id": 2387, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3059:14:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 2316, + "id": 2388, + "nodeType": "Return", + "src": "3052:21:14" + } + ] + }, + "documentation": { + "id": 2308, + "nodeType": "StructuredDocumentation", + "src": "2438:112:14", + "text": " @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length." + }, + "id": 2390, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toHexString", + "nameLocation": "2564:11:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2313, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2310, + "mutability": "mutable", + "name": "value", + "nameLocation": "2584:5:14", + "nodeType": "VariableDeclaration", + "scope": 2390, + "src": "2576:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2309, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2576:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2312, + "mutability": "mutable", + "name": "length", + "nameLocation": "2599:6:14", + "nodeType": "VariableDeclaration", + "scope": 2390, + "src": "2591:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2311, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2591:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2575:31:14" + }, + "returnParameters": { + "id": 2316, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2315, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2390, + "src": "2630:13:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2314, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2630:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "2629:15:14" + }, + "scope": 3678, + "src": "2555:525:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2409, + "nodeType": "Block", + "src": "3312:75:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "id": 2403, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2393, + "src": "3357:4:14", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 2402, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3349:7:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint160_$", + "typeString": "type(uint160)" + }, + "typeName": { + "id": 2401, + "name": "uint160", + "nodeType": "ElementaryTypeName", + "src": "3349:7:14", + "typeDescriptions": {} + } + }, + "id": 2404, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3349:13:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint160", + "typeString": "uint160" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint160", + "typeString": "uint160" + } + ], + "id": 2400, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3341:7:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 2399, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3341:7:14", + "typeDescriptions": {} + } + }, + "id": 2405, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3341:22:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2406, + "name": "ADDRESS_LENGTH", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2187, + "src": "3365:14:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + ], + "id": 2398, + "name": "toHexString", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2307, + 2390, + 2410, + 2564 + ], + "referencedDeclaration": 2390, + "src": "3329:11:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_string_memory_ptr_$", + "typeString": "function (uint256,uint256) pure returns (string memory)" + } + }, + "id": 2407, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3329:51:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 2397, + "id": 2408, + "nodeType": "Return", + "src": "3322:58:14" + } + ] + }, + "documentation": { + "id": 2391, + "nodeType": "StructuredDocumentation", + "src": "3086:148:14", + "text": " @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal\n representation." + }, + "id": 2410, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toHexString", + "nameLocation": "3248:11:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2394, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2393, + "mutability": "mutable", + "name": "addr", + "nameLocation": "3268:4:14", + "nodeType": "VariableDeclaration", + "scope": 2410, + "src": "3260:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 2392, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3260:7:14", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "3259:14:14" + }, + "returnParameters": { + "id": 2397, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2396, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2410, + "src": "3297:13:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2395, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "3297:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "3296:15:14" + }, + "scope": 3678, + "src": "3239:148:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2474, + "nodeType": "Block", + "src": "3644:642:14", + "statements": [ + { + "assignments": [ + 2419 + ], + "declarations": [ + { + "constant": false, + "id": 2419, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "3667:6:14", + "nodeType": "VariableDeclaration", + "scope": 2474, + "src": "3654:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2418, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3654:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 2426, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "id": 2423, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2413, + "src": "3694:4:14", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 2422, + "name": "toHexString", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2307, + 2390, + 2410, + 2564 + ], + "referencedDeclaration": 2410, + "src": "3682:11:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_address_$returns$_t_string_memory_ptr_$", + "typeString": "function (address) pure returns (string memory)" + } + }, + "id": 2424, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3682:17:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2421, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3676:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2420, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3676:5:14", + "typeDescriptions": {} + } + }, + "id": 2425, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3676:24:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3654:46:14" + }, + { + "assignments": [ + 2428 + ], + "declarations": [ + { + "constant": false, + "id": 2428, + "mutability": "mutable", + "name": "hashValue", + "nameLocation": "3793:9:14", + "nodeType": "VariableDeclaration", + "scope": 2474, + "src": "3785:17:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2427, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3785:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2429, + "nodeType": "VariableDeclarationStatement", + "src": "3785:17:14" + }, + { + "AST": { + "nativeSrc": "3837:78:14", + "nodeType": "YulBlock", + "src": "3837:78:14", + "statements": [ + { + "nativeSrc": "3851:54:14", + "nodeType": "YulAssignment", + "src": "3851:54:14", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3868:2:14", + "nodeType": "YulLiteral", + "src": "3868:2:14", + "type": "", + "value": "96" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "3886:6:14", + "nodeType": "YulIdentifier", + "src": "3886:6:14" + }, + { + "kind": "number", + "nativeSrc": "3894:4:14", + "nodeType": "YulLiteral", + "src": "3894:4:14", + "type": "", + "value": "0x22" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3882:3:14", + "nodeType": "YulIdentifier", + "src": "3882:3:14" + }, + "nativeSrc": "3882:17:14", + "nodeType": "YulFunctionCall", + "src": "3882:17:14" + }, + { + "kind": "number", + "nativeSrc": "3901:2:14", + "nodeType": "YulLiteral", + "src": "3901:2:14", + "type": "", + "value": "40" + } + ], + "functionName": { + "name": "keccak256", + "nativeSrc": "3872:9:14", + "nodeType": "YulIdentifier", + "src": "3872:9:14" + }, + "nativeSrc": "3872:32:14", + "nodeType": "YulFunctionCall", + "src": "3872:32:14" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "3864:3:14", + "nodeType": "YulIdentifier", + "src": "3864:3:14" + }, + "nativeSrc": "3864:41:14", + "nodeType": "YulFunctionCall", + "src": "3864:41:14" + }, + "variableNames": [ + { + "name": "hashValue", + "nativeSrc": "3851:9:14", + "nodeType": "YulIdentifier", + "src": "3851:9:14" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2419, + "isOffset": false, + "isSlot": false, + "src": "3886:6:14", + "valueSize": 1 + }, + { + "declaration": 2428, + "isOffset": false, + "isSlot": false, + "src": "3851:9:14", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2430, + "nodeType": "InlineAssembly", + "src": "3812:103:14" + }, + { + "body": { + "id": 2467, + "nodeType": "Block", + "src": "3958:291:14", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 2454, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2445, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2443, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2441, + "name": "hashValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2428, + "src": "4064:9:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307866", + "id": 2442, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4076:3:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_15_by_1", + "typeString": "int_const 15" + }, + "value": "0xf" + }, + "src": "4064:15:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "37", + "id": 2444, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4082:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_7_by_1", + "typeString": "int_const 7" + }, + "value": "7" + }, + "src": "4064:19:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 2453, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "baseExpression": { + "id": 2448, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2419, + "src": "4093:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2450, + "indexExpression": { + "id": 2449, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2432, + "src": "4100:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4093:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 2447, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4087:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": { + "id": 2446, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "4087:5:14", + "typeDescriptions": {} + } + }, + "id": 2451, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4087:16:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "3936", + "id": 2452, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4106:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_96_by_1", + "typeString": "int_const 96" + }, + "value": "96" + }, + "src": "4087:21:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "4064:44:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2462, + "nodeType": "IfStatement", + "src": "4060:150:14", + "trueBody": { + "id": 2461, + "nodeType": "Block", + "src": "4110:100:14", + "statements": [ + { + "expression": { + "id": 2459, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 2455, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2419, + "src": "4178:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2457, + "indexExpression": { + "id": 2456, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2432, + "src": "4185:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "4178:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "Assignment", + "operator": "^=", + "rightHandSide": { + "hexValue": "30783230", + "id": 2458, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4191:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "0x20" + }, + "src": "4178:17:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 2460, + "nodeType": "ExpressionStatement", + "src": "4178:17:14" + } + ] + } + }, + { + "expression": { + "id": 2465, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 2463, + "name": "hashValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2428, + "src": "4223:9:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": ">>=", + "rightHandSide": { + "hexValue": "34", + "id": 2464, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4237:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "4223:15:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2466, + "nodeType": "ExpressionStatement", + "src": "4223:15:14" + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2437, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2435, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2432, + "src": "3946:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "31", + "id": 2436, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3950:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "3946:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2468, + "initializationExpression": { + "assignments": [ + 2432 + ], + "declarations": [ + { + "constant": false, + "id": 2432, + "mutability": "mutable", + "name": "i", + "nameLocation": "3938:1:14", + "nodeType": "VariableDeclaration", + "scope": 2468, + "src": "3930:9:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2431, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3930:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2434, + "initialValue": { + "hexValue": "3431", + "id": 2433, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3942:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_41_by_1", + "typeString": "int_const 41" + }, + "value": "41" + }, + "nodeType": "VariableDeclarationStatement", + "src": "3930:14:14" + }, + "isSimpleCounterLoop": false, + "loopExpression": { + "expression": { + "id": 2439, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "--", + "prefix": true, + "src": "3953:3:14", + "subExpression": { + "id": 2438, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2432, + "src": "3955:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2440, + "nodeType": "ExpressionStatement", + "src": "3953:3:14" + }, + "nodeType": "ForStatement", + "src": "3925:324:14" + }, + { + "expression": { + "arguments": [ + { + "id": 2471, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2419, + "src": "4272:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 2470, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4265:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_string_storage_ptr_$", + "typeString": "type(string storage pointer)" + }, + "typeName": { + "id": 2469, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "4265:6:14", + "typeDescriptions": {} + } + }, + "id": 2472, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4265:14:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 2417, + "id": 2473, + "nodeType": "Return", + "src": "4258:21:14" + } + ] + }, + "documentation": { + "id": 2411, + "nodeType": "StructuredDocumentation", + "src": "3393:165:14", + "text": " @dev Converts an `address` with fixed length of 20 bytes to its checksummed ASCII `string` hexadecimal\n representation, according to EIP-55." + }, + "id": 2475, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toChecksumHexString", + "nameLocation": "3572:19:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2414, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2413, + "mutability": "mutable", + "name": "addr", + "nameLocation": "3600:4:14", + "nodeType": "VariableDeclaration", + "scope": 2475, + "src": "3592:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 2412, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3592:7:14", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "3591:14:14" + }, + "returnParameters": { + "id": 2417, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2416, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2475, + "src": "3629:13:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2415, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "3629:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "3628:15:14" + }, + "scope": 3678, + "src": "3563:723:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2563, + "nodeType": "Block", + "src": "4475:424:14", + "statements": [ + { + "id": 2562, + "nodeType": "UncheckedBlock", + "src": "4485:408:14", + "statements": [ + { + "assignments": [ + 2484 + ], + "declarations": [ + { + "constant": false, + "id": 2484, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "4522:6:14", + "nodeType": "VariableDeclaration", + "scope": 2562, + "src": "4509:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2483, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4509:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 2494, + "initialValue": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2492, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2490, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 2487, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4541:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "expression": { + "id": 2488, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2478, + "src": "4545:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2489, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4551:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "4545:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4541:16:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "32", + "id": 2491, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4560:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "4541:20:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2486, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "4531:9:14", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (uint256) pure returns (bytes memory)" + }, + "typeName": { + "id": 2485, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4535:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + } + }, + "id": 2493, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4531:31:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4509:53:14" + }, + { + "expression": { + "id": 2499, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 2495, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2484, + "src": "4576:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2497, + "indexExpression": { + "hexValue": "30", + "id": 2496, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4583:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "4576:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "hexValue": "30", + "id": 2498, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4588:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", + "typeString": "literal_string \"0\"" + }, + "value": "0" + }, + "src": "4576:15:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 2500, + "nodeType": "ExpressionStatement", + "src": "4576:15:14" + }, + { + "expression": { + "id": 2505, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 2501, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2484, + "src": "4605:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2503, + "indexExpression": { + "hexValue": "31", + "id": 2502, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4612:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "4605:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "hexValue": "78", + "id": 2504, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4617:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_7521d1cadbcfa91eec65aa16715b94ffc1c9654ba57ea2ef1a2127bca1127a83", + "typeString": "literal_string \"x\"" + }, + "value": "x" + }, + "src": "4605:15:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 2506, + "nodeType": "ExpressionStatement", + "src": "4605:15:14" + }, + { + "body": { + "id": 2555, + "nodeType": "Block", + "src": "4677:171:14", + "statements": [ + { + "assignments": [ + 2519 + ], + "declarations": [ + { + "constant": false, + "id": 2519, + "mutability": "mutable", + "name": "v", + "nameLocation": "4701:1:14", + "nodeType": "VariableDeclaration", + "scope": 2555, + "src": "4695:7:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 2518, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "4695:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "id": 2526, + "initialValue": { + "arguments": [ + { + "baseExpression": { + "id": 2522, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2478, + "src": "4711:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2524, + "indexExpression": { + "id": 2523, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2508, + "src": "4717:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4711:8:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 2521, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4705:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": { + "id": 2520, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "4705:5:14", + "typeDescriptions": {} + } + }, + "id": 2525, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4705:15:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4695:25:14" + }, + { + "expression": { + "id": 2539, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 2527, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2484, + "src": "4738:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2533, + "indexExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2532, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2530, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 2528, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4745:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 2529, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2508, + "src": "4749:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4745:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "32", + "id": 2531, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4753:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "4745:9:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "4738:17:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "baseExpression": { + "id": 2534, + "name": "HEX_DIGITS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2184, + "src": "4758:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "id": 2538, + "indexExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 2537, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2535, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2519, + "src": "4769:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "34", + "id": 2536, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4774:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "4769:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4758:18:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "src": "4738:38:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 2540, + "nodeType": "ExpressionStatement", + "src": "4738:38:14" + }, + { + "expression": { + "id": 2553, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 2541, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2484, + "src": "4794:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2547, + "indexExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2546, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2544, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 2542, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4801:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 2543, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2508, + "src": "4805:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4801:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "33", + "id": 2545, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4809:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "src": "4801:9:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "4794:17:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "baseExpression": { + "id": 2548, + "name": "HEX_DIGITS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2184, + "src": "4814:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "id": 2552, + "indexExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 2551, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2549, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2519, + "src": "4825:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307866", + "id": 2550, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4829:3:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_15_by_1", + "typeString": "int_const 15" + }, + "value": "0xf" + }, + "src": "4825:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4814:19:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "src": "4794:39:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 2554, + "nodeType": "ExpressionStatement", + "src": "4794:39:14" + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2514, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2511, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2508, + "src": "4654:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "expression": { + "id": 2512, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2478, + "src": "4658:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2513, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4664:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "4658:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4654:16:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2556, + "initializationExpression": { + "assignments": [ + 2508 + ], + "declarations": [ + { + "constant": false, + "id": 2508, + "mutability": "mutable", + "name": "i", + "nameLocation": "4647:1:14", + "nodeType": "VariableDeclaration", + "scope": 2556, + "src": "4639:9:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2507, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4639:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2510, + "initialValue": { + "hexValue": "30", + "id": 2509, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4651:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "4639:13:14" + }, + "isSimpleCounterLoop": true, + "loopExpression": { + "expression": { + "id": 2516, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": true, + "src": "4672:3:14", + "subExpression": { + "id": 2515, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2508, + "src": "4674:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2517, + "nodeType": "ExpressionStatement", + "src": "4672:3:14" + }, + "nodeType": "ForStatement", + "src": "4634:214:14" + }, + { + "expression": { + "arguments": [ + { + "id": 2559, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2484, + "src": "4875:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 2558, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4868:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_string_storage_ptr_$", + "typeString": "type(string storage pointer)" + }, + "typeName": { + "id": 2557, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "4868:6:14", + "typeDescriptions": {} + } + }, + "id": 2560, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4868:14:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 2482, + "id": 2561, + "nodeType": "Return", + "src": "4861:21:14" + } + ] + } + ] + }, + "documentation": { + "id": 2476, + "nodeType": "StructuredDocumentation", + "src": "4292:99:14", + "text": " @dev Converts a `bytes` buffer to its ASCII `string` hexadecimal representation." + }, + "id": 2564, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toHexString", + "nameLocation": "4405:11:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2479, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2478, + "mutability": "mutable", + "name": "input", + "nameLocation": "4430:5:14", + "nodeType": "VariableDeclaration", + "scope": 2564, + "src": "4417:18:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2477, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4417:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "4416:20:14" + }, + "returnParameters": { + "id": 2482, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2481, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2564, + "src": "4460:13:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2480, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "4460:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "4459:15:14" + }, + "scope": 3678, + "src": "4396:503:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2586, + "nodeType": "Block", + "src": "5054:55:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "id": 2578, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2567, + "src": "5089:1:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2577, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5083:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2576, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5083:5:14", + "typeDescriptions": {} + } + }, + "id": 2579, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5083:8:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "arguments": [ + { + "id": 2582, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2569, + "src": "5099:1:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2581, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5093:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2580, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5093:5:14", + "typeDescriptions": {} + } + }, + "id": 2583, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5093:8:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "id": 2574, + "name": "Bytes", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1632, + "src": "5071:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Bytes_$1632_$", + "typeString": "type(library Bytes)" + } + }, + "id": 2575, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5077:5:14", + "memberName": "equal", + "nodeType": "MemberAccess", + "referencedDeclaration": 1282, + "src": "5071:11:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_bytes_memory_ptr_$returns$_t_bool_$", + "typeString": "function (bytes memory,bytes memory) pure returns (bool)" + } + }, + "id": 2584, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5071:31:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 2573, + "id": 2585, + "nodeType": "Return", + "src": "5064:38:14" + } + ] + }, + "documentation": { + "id": 2565, + "nodeType": "StructuredDocumentation", + "src": "4905:66:14", + "text": " @dev Returns true if the two strings are equal." + }, + "id": 2587, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "equal", + "nameLocation": "4985:5:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2570, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2567, + "mutability": "mutable", + "name": "a", + "nameLocation": "5005:1:14", + "nodeType": "VariableDeclaration", + "scope": 2587, + "src": "4991:15:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2566, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "4991:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2569, + "mutability": "mutable", + "name": "b", + "nameLocation": "5022:1:14", + "nodeType": "VariableDeclaration", + "scope": 2587, + "src": "5008:15:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2568, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "5008:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "4990:34:14" + }, + "returnParameters": { + "id": 2573, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2572, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2587, + "src": "5048:4:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2571, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "5048:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "5047:6:14" + }, + "scope": 3678, + "src": "4976:133:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2605, + "nodeType": "Block", + "src": "5406:64:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2596, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2590, + "src": "5433:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "hexValue": "30", + "id": 2597, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5440:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "expression": { + "arguments": [ + { + "id": 2600, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2590, + "src": "5449:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2599, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5443:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2598, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5443:5:14", + "typeDescriptions": {} + } + }, + "id": 2601, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5443:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2602, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5456:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "5443:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2595, + "name": "parseUint", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2606, + 2637 + ], + "referencedDeclaration": 2637, + "src": "5423:9:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (uint256)" + } + }, + "id": 2603, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5423:40:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 2594, + "id": 2604, + "nodeType": "Return", + "src": "5416:47:14" + } + ] + }, + "documentation": { + "id": 2588, + "nodeType": "StructuredDocumentation", + "src": "5115:214:14", + "text": " @dev Parse a decimal string and returns the value as a `uint256`.\n Requirements:\n - The string must be formatted as `[0-9]*`\n - The result must fit into an `uint256` type" + }, + "id": 2606, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parseUint", + "nameLocation": "5343:9:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2591, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2590, + "mutability": "mutable", + "name": "input", + "nameLocation": "5367:5:14", + "nodeType": "VariableDeclaration", + "scope": 2606, + "src": "5353:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2589, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "5353:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "5352:21:14" + }, + "returnParameters": { + "id": 2594, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2593, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2606, + "src": "5397:7:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2592, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5397:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5396:9:14" + }, + "scope": 3678, + "src": "5334:136:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2636, + "nodeType": "Block", + "src": "5875:153:14", + "statements": [ + { + "assignments": [ + 2619, + 2621 + ], + "declarations": [ + { + "constant": false, + "id": 2619, + "mutability": "mutable", + "name": "success", + "nameLocation": "5891:7:14", + "nodeType": "VariableDeclaration", + "scope": 2636, + "src": "5886:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2618, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "5886:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2621, + "mutability": "mutable", + "name": "value", + "nameLocation": "5908:5:14", + "nodeType": "VariableDeclaration", + "scope": 2636, + "src": "5900:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2620, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5900:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2627, + "initialValue": { + "arguments": [ + { + "id": 2623, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2609, + "src": "5930:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "id": 2624, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2611, + "src": "5937:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2625, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2613, + "src": "5944:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2622, + "name": "tryParseUint", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2658, + 2695 + ], + "referencedDeclaration": 2695, + "src": "5917:12:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 2626, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5917:31:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "5885:63:14" + }, + { + "condition": { + "id": 2629, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "5962:8:14", + "subExpression": { + "id": 2628, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2619, + "src": "5963:7:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2633, + "nodeType": "IfStatement", + "src": "5958:41:14", + "trueBody": { + "errorCall": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 2630, + "name": "StringsInvalidChar", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2210, + "src": "5979:18:14", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$__$returns$_t_error_$", + "typeString": "function () pure returns (error)" + } + }, + "id": 2631, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5979:20:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 2632, + "nodeType": "RevertStatement", + "src": "5972:27:14" + } + }, + { + "expression": { + "id": 2634, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2621, + "src": "6016:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 2617, + "id": 2635, + "nodeType": "Return", + "src": "6009:12:14" + } + ] + }, + "documentation": { + "id": 2607, + "nodeType": "StructuredDocumentation", + "src": "5476:294:14", + "text": " @dev Variant of {parseUint-string} that parses a substring of `input` located between position `begin` (included) and\n `end` (excluded).\n Requirements:\n - The substring must be formatted as `[0-9]*`\n - The result must fit into an `uint256` type" + }, + "id": 2637, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parseUint", + "nameLocation": "5784:9:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2614, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2609, + "mutability": "mutable", + "name": "input", + "nameLocation": "5808:5:14", + "nodeType": "VariableDeclaration", + "scope": 2637, + "src": "5794:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2608, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "5794:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2611, + "mutability": "mutable", + "name": "begin", + "nameLocation": "5823:5:14", + "nodeType": "VariableDeclaration", + "scope": 2637, + "src": "5815:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2610, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5815:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2613, + "mutability": "mutable", + "name": "end", + "nameLocation": "5838:3:14", + "nodeType": "VariableDeclaration", + "scope": 2637, + "src": "5830:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2612, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5830:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5793:49:14" + }, + "returnParameters": { + "id": 2617, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2616, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2637, + "src": "5866:7:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2615, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5866:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5865:9:14" + }, + "scope": 3678, + "src": "5775:253:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2657, + "nodeType": "Block", + "src": "6349:83:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2648, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2640, + "src": "6395:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "hexValue": "30", + "id": 2649, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6402:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "expression": { + "arguments": [ + { + "id": 2652, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2640, + "src": "6411:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2651, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6405:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2650, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "6405:5:14", + "typeDescriptions": {} + } + }, + "id": 2653, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6405:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2654, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6418:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "6405:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2647, + "name": "_tryParseUintUncheckedBounds", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2765, + "src": "6366:28:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 2655, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6366:59:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "functionReturnParameters": 2646, + "id": 2656, + "nodeType": "Return", + "src": "6359:66:14" + } + ] + }, + "documentation": { + "id": 2638, + "nodeType": "StructuredDocumentation", + "src": "6034:215:14", + "text": " @dev Variant of {parseUint-string} that returns false if the parsing fails because of an invalid character.\n NOTE: This function will revert if the result does not fit in a `uint256`." + }, + "id": 2658, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryParseUint", + "nameLocation": "6263:12:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2641, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2640, + "mutability": "mutable", + "name": "input", + "nameLocation": "6290:5:14", + "nodeType": "VariableDeclaration", + "scope": 2658, + "src": "6276:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2639, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "6276:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "6275:21:14" + }, + "returnParameters": { + "id": 2646, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2643, + "mutability": "mutable", + "name": "success", + "nameLocation": "6325:7:14", + "nodeType": "VariableDeclaration", + "scope": 2658, + "src": "6320:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2642, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "6320:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2645, + "mutability": "mutable", + "name": "value", + "nameLocation": "6342:5:14", + "nodeType": "VariableDeclaration", + "scope": 2658, + "src": "6334:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2644, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6334:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "6319:29:14" + }, + "scope": 3678, + "src": "6254:178:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2694, + "nodeType": "Block", + "src": "6834:144:14", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 2682, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2678, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2672, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2665, + "src": "6848:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 2675, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2661, + "src": "6860:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2674, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6854:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2673, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "6854:5:14", + "typeDescriptions": {} + } + }, + "id": 2676, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6854:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2677, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6867:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "6854:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6848:25:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2681, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2679, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2663, + "src": "6877:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "id": 2680, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2665, + "src": "6885:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6877:11:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "6848:40:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2687, + "nodeType": "IfStatement", + "src": "6844:63:14", + "trueBody": { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 2683, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6898:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "hexValue": "30", + "id": 2684, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6905:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "id": 2685, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "6897:10:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$", + "typeString": "tuple(bool,int_const 0)" + } + }, + "functionReturnParameters": 2671, + "id": 2686, + "nodeType": "Return", + "src": "6890:17:14" + } + }, + { + "expression": { + "arguments": [ + { + "id": 2689, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2661, + "src": "6953:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "id": 2690, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2663, + "src": "6960:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2691, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2665, + "src": "6967:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2688, + "name": "_tryParseUintUncheckedBounds", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2765, + "src": "6924:28:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 2692, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6924:47:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "functionReturnParameters": 2671, + "id": 2693, + "nodeType": "Return", + "src": "6917:54:14" + } + ] + }, + "documentation": { + "id": 2659, + "nodeType": "StructuredDocumentation", + "src": "6438:238:14", + "text": " @dev Variant of {parseUint-string-uint256-uint256} that returns false if the parsing fails because of an invalid\n character.\n NOTE: This function will revert if the result does not fit in a `uint256`." + }, + "id": 2695, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryParseUint", + "nameLocation": "6690:12:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2666, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2661, + "mutability": "mutable", + "name": "input", + "nameLocation": "6726:5:14", + "nodeType": "VariableDeclaration", + "scope": 2695, + "src": "6712:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2660, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "6712:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2663, + "mutability": "mutable", + "name": "begin", + "nameLocation": "6749:5:14", + "nodeType": "VariableDeclaration", + "scope": 2695, + "src": "6741:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2662, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6741:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2665, + "mutability": "mutable", + "name": "end", + "nameLocation": "6772:3:14", + "nodeType": "VariableDeclaration", + "scope": 2695, + "src": "6764:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2664, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6764:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "6702:79:14" + }, + "returnParameters": { + "id": 2671, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2668, + "mutability": "mutable", + "name": "success", + "nameLocation": "6810:7:14", + "nodeType": "VariableDeclaration", + "scope": 2695, + "src": "6805:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2667, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "6805:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2670, + "mutability": "mutable", + "name": "value", + "nameLocation": "6827:5:14", + "nodeType": "VariableDeclaration", + "scope": 2695, + "src": "6819:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2669, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6819:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "6804:29:14" + }, + "scope": 3678, + "src": "6681:297:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2764, + "nodeType": "Block", + "src": "7381:347:14", + "statements": [ + { + "assignments": [ + 2710 + ], + "declarations": [ + { + "constant": false, + "id": 2710, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "7404:6:14", + "nodeType": "VariableDeclaration", + "scope": 2764, + "src": "7391:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2709, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "7391:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 2715, + "initialValue": { + "arguments": [ + { + "id": 2713, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2698, + "src": "7419:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2712, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "7413:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2711, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "7413:5:14", + "typeDescriptions": {} + } + }, + "id": 2714, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7413:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "7391:34:14" + }, + { + "assignments": [ + 2717 + ], + "declarations": [ + { + "constant": false, + "id": 2717, + "mutability": "mutable", + "name": "result", + "nameLocation": "7444:6:14", + "nodeType": "VariableDeclaration", + "scope": 2764, + "src": "7436:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2716, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7436:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2719, + "initialValue": { + "hexValue": "30", + "id": 2718, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7453:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "7436:18:14" + }, + { + "body": { + "id": 2758, + "nodeType": "Block", + "src": "7502:189:14", + "statements": [ + { + "assignments": [ + 2731 + ], + "declarations": [ + { + "constant": false, + "id": 2731, + "mutability": "mutable", + "name": "chr", + "nameLocation": "7522:3:14", + "nodeType": "VariableDeclaration", + "scope": 2758, + "src": "7516:9:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 2730, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "7516:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "id": 2741, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "id": 2736, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2710, + "src": "7571:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 2737, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2721, + "src": "7579:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2735, + "name": "_unsafeReadBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3665, + "src": "7548:22:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (bytes memory,uint256) pure returns (bytes32)" + } + }, + "id": 2738, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7548:33:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 2734, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "7541:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 2733, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "7541:6:14", + "typeDescriptions": {} + } + }, + "id": 2739, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7541:41:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 2732, + "name": "_tryParseChr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3445, + "src": "7528:12:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes1_$returns$_t_uint8_$", + "typeString": "function (bytes1) pure returns (uint8)" + } + }, + "id": 2740, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7528:55:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "7516:67:14" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 2744, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2742, + "name": "chr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2731, + "src": "7601:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "39", + "id": 2743, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7607:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_9_by_1", + "typeString": "int_const 9" + }, + "value": "9" + }, + "src": "7601:7:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2749, + "nodeType": "IfStatement", + "src": "7597:30:14", + "trueBody": { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 2745, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7618:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "hexValue": "30", + "id": 2746, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7625:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "id": 2747, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "7617:10:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$", + "typeString": "tuple(bool,int_const 0)" + } + }, + "functionReturnParameters": 2708, + "id": 2748, + "nodeType": "Return", + "src": "7610:17:14" + } + }, + { + "expression": { + "id": 2752, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 2750, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2717, + "src": "7641:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "*=", + "rightHandSide": { + "hexValue": "3130", + "id": 2751, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7651:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "src": "7641:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2753, + "nodeType": "ExpressionStatement", + "src": "7641:12:14" + }, + { + "expression": { + "id": 2756, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 2754, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2717, + "src": "7667:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "id": 2755, + "name": "chr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2731, + "src": "7677:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "src": "7667:13:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2757, + "nodeType": "ExpressionStatement", + "src": "7667:13:14" + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2726, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2724, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2721, + "src": "7488:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 2725, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2702, + "src": "7492:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7488:7:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2759, + "initializationExpression": { + "assignments": [ + 2721 + ], + "declarations": [ + { + "constant": false, + "id": 2721, + "mutability": "mutable", + "name": "i", + "nameLocation": "7477:1:14", + "nodeType": "VariableDeclaration", + "scope": 2759, + "src": "7469:9:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2720, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7469:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2723, + "initialValue": { + "id": 2722, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2700, + "src": "7481:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "7469:17:14" + }, + "isSimpleCounterLoop": true, + "loopExpression": { + "expression": { + "id": 2728, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": true, + "src": "7497:3:14", + "subExpression": { + "id": 2727, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2721, + "src": "7499:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2729, + "nodeType": "ExpressionStatement", + "src": "7497:3:14" + }, + "nodeType": "ForStatement", + "src": "7464:227:14" + }, + { + "expression": { + "components": [ + { + "hexValue": "74727565", + "id": 2760, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7708:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + { + "id": 2761, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2717, + "src": "7714:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 2762, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "7707:14:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "functionReturnParameters": 2708, + "id": 2763, + "nodeType": "Return", + "src": "7700:21:14" + } + ] + }, + "documentation": { + "id": 2696, + "nodeType": "StructuredDocumentation", + "src": "6984:224:14", + "text": " @dev Implementation of {tryParseUint-string-uint256-uint256} that does not check bounds. Caller should make sure that\n `begin <= end <= input.length`. Other inputs would result in undefined behavior." + }, + "id": 2765, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_tryParseUintUncheckedBounds", + "nameLocation": "7222:28:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2703, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2698, + "mutability": "mutable", + "name": "input", + "nameLocation": "7274:5:14", + "nodeType": "VariableDeclaration", + "scope": 2765, + "src": "7260:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2697, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "7260:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2700, + "mutability": "mutable", + "name": "begin", + "nameLocation": "7297:5:14", + "nodeType": "VariableDeclaration", + "scope": 2765, + "src": "7289:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2699, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7289:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2702, + "mutability": "mutable", + "name": "end", + "nameLocation": "7320:3:14", + "nodeType": "VariableDeclaration", + "scope": 2765, + "src": "7312:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2701, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7312:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7250:79:14" + }, + "returnParameters": { + "id": 2708, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2705, + "mutability": "mutable", + "name": "success", + "nameLocation": "7357:7:14", + "nodeType": "VariableDeclaration", + "scope": 2765, + "src": "7352:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2704, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "7352:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2707, + "mutability": "mutable", + "name": "value", + "nameLocation": "7374:5:14", + "nodeType": "VariableDeclaration", + "scope": 2765, + "src": "7366:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2706, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7366:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7351:29:14" + }, + "scope": 3678, + "src": "7213:515:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 2783, + "nodeType": "Block", + "src": "8025:63:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2774, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2768, + "src": "8051:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "hexValue": "30", + "id": 2775, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8058:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "expression": { + "arguments": [ + { + "id": 2778, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2768, + "src": "8067:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2777, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8061:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2776, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "8061:5:14", + "typeDescriptions": {} + } + }, + "id": 2779, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8061:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2780, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "8074:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "8061:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2773, + "name": "parseInt", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2784, + 2815 + ], + "referencedDeclaration": 2815, + "src": "8042:8:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_int256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (int256)" + } + }, + "id": 2781, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8042:39:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "functionReturnParameters": 2772, + "id": 2782, + "nodeType": "Return", + "src": "8035:46:14" + } + ] + }, + "documentation": { + "id": 2766, + "nodeType": "StructuredDocumentation", + "src": "7734:216:14", + "text": " @dev Parse a decimal string and returns the value as a `int256`.\n Requirements:\n - The string must be formatted as `[-+]?[0-9]*`\n - The result must fit in an `int256` type." + }, + "id": 2784, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parseInt", + "nameLocation": "7964:8:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2769, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2768, + "mutability": "mutable", + "name": "input", + "nameLocation": "7987:5:14", + "nodeType": "VariableDeclaration", + "scope": 2784, + "src": "7973:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2767, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "7973:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "7972:21:14" + }, + "returnParameters": { + "id": 2772, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2771, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2784, + "src": "8017:6:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 2770, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "8017:6:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "8016:8:14" + }, + "scope": 3678, + "src": "7955:133:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2814, + "nodeType": "Block", + "src": "8493:151:14", + "statements": [ + { + "assignments": [ + 2797, + 2799 + ], + "declarations": [ + { + "constant": false, + "id": 2797, + "mutability": "mutable", + "name": "success", + "nameLocation": "8509:7:14", + "nodeType": "VariableDeclaration", + "scope": 2814, + "src": "8504:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2796, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "8504:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2799, + "mutability": "mutable", + "name": "value", + "nameLocation": "8525:5:14", + "nodeType": "VariableDeclaration", + "scope": 2814, + "src": "8518:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 2798, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "8518:6:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "id": 2805, + "initialValue": { + "arguments": [ + { + "id": 2801, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2787, + "src": "8546:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "id": 2802, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2789, + "src": "8553:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2803, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2791, + "src": "8560:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2800, + "name": "tryParseInt", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2836, + 2878 + ], + "referencedDeclaration": 2878, + "src": "8534:11:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_int256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,int256)" + } + }, + "id": 2804, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8534:30:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_int256_$", + "typeString": "tuple(bool,int256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8503:61:14" + }, + { + "condition": { + "id": 2807, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "8578:8:14", + "subExpression": { + "id": 2806, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2797, + "src": "8579:7:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2811, + "nodeType": "IfStatement", + "src": "8574:41:14", + "trueBody": { + "errorCall": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 2808, + "name": "StringsInvalidChar", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2210, + "src": "8595:18:14", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$__$returns$_t_error_$", + "typeString": "function () pure returns (error)" + } + }, + "id": 2809, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8595:20:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 2810, + "nodeType": "RevertStatement", + "src": "8588:27:14" + } + }, + { + "expression": { + "id": 2812, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2799, + "src": "8632:5:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "functionReturnParameters": 2795, + "id": 2813, + "nodeType": "Return", + "src": "8625:12:14" + } + ] + }, + "documentation": { + "id": 2785, + "nodeType": "StructuredDocumentation", + "src": "8094:296:14", + "text": " @dev Variant of {parseInt-string} that parses a substring of `input` located between position `begin` (included) and\n `end` (excluded).\n Requirements:\n - The substring must be formatted as `[-+]?[0-9]*`\n - The result must fit in an `int256` type." + }, + "id": 2815, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parseInt", + "nameLocation": "8404:8:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2792, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2787, + "mutability": "mutable", + "name": "input", + "nameLocation": "8427:5:14", + "nodeType": "VariableDeclaration", + "scope": 2815, + "src": "8413:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2786, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "8413:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2789, + "mutability": "mutable", + "name": "begin", + "nameLocation": "8442:5:14", + "nodeType": "VariableDeclaration", + "scope": 2815, + "src": "8434:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2788, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8434:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2791, + "mutability": "mutable", + "name": "end", + "nameLocation": "8457:3:14", + "nodeType": "VariableDeclaration", + "scope": 2815, + "src": "8449:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2790, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8449:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "8412:49:14" + }, + "returnParameters": { + "id": 2795, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2794, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2815, + "src": "8485:6:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 2793, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "8485:6:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "8484:8:14" + }, + "scope": 3678, + "src": "8395:249:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2835, + "nodeType": "Block", + "src": "9035:82:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2826, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2818, + "src": "9080:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "hexValue": "30", + "id": 2827, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9087:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "expression": { + "arguments": [ + { + "id": 2830, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2818, + "src": "9096:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2829, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "9090:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2828, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "9090:5:14", + "typeDescriptions": {} + } + }, + "id": 2831, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9090:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2832, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "9103:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "9090:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2825, + "name": "_tryParseIntUncheckedBounds", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2999, + "src": "9052:27:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_int256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,int256)" + } + }, + "id": 2833, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9052:58:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_int256_$", + "typeString": "tuple(bool,int256)" + } + }, + "functionReturnParameters": 2824, + "id": 2834, + "nodeType": "Return", + "src": "9045:65:14" + } + ] + }, + "documentation": { + "id": 2816, + "nodeType": "StructuredDocumentation", + "src": "8650:287:14", + "text": " @dev Variant of {parseInt-string} that returns false if the parsing fails because of an invalid character or if\n the result does not fit in a `int256`.\n NOTE: This function will revert if the absolute value of the result does not fit in a `uint256`." + }, + "id": 2836, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryParseInt", + "nameLocation": "8951:11:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2819, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2818, + "mutability": "mutable", + "name": "input", + "nameLocation": "8977:5:14", + "nodeType": "VariableDeclaration", + "scope": 2836, + "src": "8963:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2817, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "8963:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "8962:21:14" + }, + "returnParameters": { + "id": 2824, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2821, + "mutability": "mutable", + "name": "success", + "nameLocation": "9012:7:14", + "nodeType": "VariableDeclaration", + "scope": 2836, + "src": "9007:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2820, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "9007:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2823, + "mutability": "mutable", + "name": "value", + "nameLocation": "9028:5:14", + "nodeType": "VariableDeclaration", + "scope": 2836, + "src": "9021:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 2822, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "9021:6:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "9006:28:14" + }, + "scope": 3678, + "src": "8942:175:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "constant": true, + "id": 2841, + "mutability": "constant", + "name": "ABS_MIN_INT256", + "nameLocation": "9148:14:14", + "nodeType": "VariableDeclaration", + "scope": 3678, + "src": "9123:50:14", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2837, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "9123:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "commonType": { + "typeIdentifier": "t_rational_57896044618658097711785492504343953926634992332820282019728792003956564819968_by_1", + "typeString": "int_const 5789...(69 digits omitted)...9968" + }, + "id": 2840, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 2838, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9165:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "323535", + "id": 2839, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9170:3:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "255" + }, + "src": "9165:8:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_57896044618658097711785492504343953926634992332820282019728792003956564819968_by_1", + "typeString": "int_const 5789...(69 digits omitted)...9968" + } + }, + "visibility": "private" + }, + { + "body": { + "id": 2877, + "nodeType": "Block", + "src": "9639:143:14", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 2865, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2861, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2855, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2848, + "src": "9653:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 2858, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2844, + "src": "9665:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2857, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "9659:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2856, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "9659:5:14", + "typeDescriptions": {} + } + }, + "id": 2859, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9659:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2860, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "9672:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "9659:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "9653:25:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2864, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2862, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2846, + "src": "9682:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "id": 2863, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2848, + "src": "9690:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "9682:11:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "9653:40:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2870, + "nodeType": "IfStatement", + "src": "9649:63:14", + "trueBody": { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 2866, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9703:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "hexValue": "30", + "id": 2867, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9710:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "id": 2868, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "9702:10:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$", + "typeString": "tuple(bool,int_const 0)" + } + }, + "functionReturnParameters": 2854, + "id": 2869, + "nodeType": "Return", + "src": "9695:17:14" + } + }, + { + "expression": { + "arguments": [ + { + "id": 2872, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2844, + "src": "9757:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "id": 2873, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2846, + "src": "9764:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2874, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2848, + "src": "9771:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2871, + "name": "_tryParseIntUncheckedBounds", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2999, + "src": "9729:27:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_int256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,int256)" + } + }, + "id": 2875, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9729:46:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_int256_$", + "typeString": "tuple(bool,int256)" + } + }, + "functionReturnParameters": 2854, + "id": 2876, + "nodeType": "Return", + "src": "9722:53:14" + } + ] + }, + "documentation": { + "id": 2842, + "nodeType": "StructuredDocumentation", + "src": "9180:303:14", + "text": " @dev Variant of {parseInt-string-uint256-uint256} that returns false if the parsing fails because of an invalid\n character or if the result does not fit in a `int256`.\n NOTE: This function will revert if the absolute value of the result does not fit in a `uint256`." + }, + "id": 2878, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryParseInt", + "nameLocation": "9497:11:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2849, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2844, + "mutability": "mutable", + "name": "input", + "nameLocation": "9532:5:14", + "nodeType": "VariableDeclaration", + "scope": 2878, + "src": "9518:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2843, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "9518:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2846, + "mutability": "mutable", + "name": "begin", + "nameLocation": "9555:5:14", + "nodeType": "VariableDeclaration", + "scope": 2878, + "src": "9547:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2845, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "9547:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2848, + "mutability": "mutable", + "name": "end", + "nameLocation": "9578:3:14", + "nodeType": "VariableDeclaration", + "scope": 2878, + "src": "9570:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2847, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "9570:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "9508:79:14" + }, + "returnParameters": { + "id": 2854, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2851, + "mutability": "mutable", + "name": "success", + "nameLocation": "9616:7:14", + "nodeType": "VariableDeclaration", + "scope": 2878, + "src": "9611:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2850, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "9611:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2853, + "mutability": "mutable", + "name": "value", + "nameLocation": "9632:5:14", + "nodeType": "VariableDeclaration", + "scope": 2878, + "src": "9625:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 2852, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "9625:6:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "9610:28:14" + }, + "scope": 3678, + "src": "9488:294:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2998, + "nodeType": "Block", + "src": "10182:812:14", + "statements": [ + { + "assignments": [ + 2893 + ], + "declarations": [ + { + "constant": false, + "id": 2893, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "10205:6:14", + "nodeType": "VariableDeclaration", + "scope": 2998, + "src": "10192:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2892, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "10192:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 2898, + "initialValue": { + "arguments": [ + { + "id": 2896, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2881, + "src": "10220:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2895, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10214:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2894, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "10214:5:14", + "typeDescriptions": {} + } + }, + "id": 2897, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10214:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "10192:34:14" + }, + { + "assignments": [ + 2900 + ], + "declarations": [ + { + "constant": false, + "id": 2900, + "mutability": "mutable", + "name": "sign", + "nameLocation": "10290:4:14", + "nodeType": "VariableDeclaration", + "scope": 2998, + "src": "10283:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 2899, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "10283:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + } + ], + "id": 2916, + "initialValue": { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2903, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2901, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2883, + "src": "10297:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 2902, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2885, + "src": "10306:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10297:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseExpression": { + "arguments": [ + { + "arguments": [ + { + "id": 2911, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2893, + "src": "10354:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 2912, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2883, + "src": "10362:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2910, + "name": "_unsafeReadBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3665, + "src": "10331:22:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (bytes memory,uint256) pure returns (bytes32)" + } + }, + "id": 2913, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10331:37:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 2909, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10324:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 2908, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "10324:6:14", + "typeDescriptions": {} + } + }, + "id": 2914, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10324:45:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 2915, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "Conditional", + "src": "10297:72:14", + "trueExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 2906, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10319:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 2905, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10312:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 2904, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "10312:6:14", + "typeDescriptions": {} + } + }, + "id": 2907, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10312:9:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "10283:86:14" + }, + { + "assignments": [ + 2918 + ], + "declarations": [ + { + "constant": false, + "id": 2918, + "mutability": "mutable", + "name": "positiveSign", + "nameLocation": "10455:12:14", + "nodeType": "VariableDeclaration", + "scope": 2998, + "src": "10450:17:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2917, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "10450:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "id": 2925, + "initialValue": { + "commonType": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "id": 2924, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2919, + "name": "sign", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2900, + "src": "10470:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "arguments": [ + { + "hexValue": "2b", + "id": 2922, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10485:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_728b8dbbe730d9acd55e30e768e6a28a04bea0c61b88108287c2c87d79c98bb8", + "typeString": "literal_string \"+\"" + }, + "value": "+" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_728b8dbbe730d9acd55e30e768e6a28a04bea0c61b88108287c2c87d79c98bb8", + "typeString": "literal_string \"+\"" + } + ], + "id": 2921, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10478:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 2920, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "10478:6:14", + "typeDescriptions": {} + } + }, + "id": 2923, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10478:11:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "src": "10470:19:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "10450:39:14" + }, + { + "assignments": [ + 2927 + ], + "declarations": [ + { + "constant": false, + "id": 2927, + "mutability": "mutable", + "name": "negativeSign", + "nameLocation": "10504:12:14", + "nodeType": "VariableDeclaration", + "scope": 2998, + "src": "10499:17:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2926, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "10499:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "id": 2934, + "initialValue": { + "commonType": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "id": 2933, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2928, + "name": "sign", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2900, + "src": "10519:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "arguments": [ + { + "hexValue": "2d", + "id": 2931, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10534:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_d3b8281179950f98149eefdb158d0e1acb56f56e8e343aa9fefafa7e36959561", + "typeString": "literal_string \"-\"" + }, + "value": "-" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_d3b8281179950f98149eefdb158d0e1acb56f56e8e343aa9fefafa7e36959561", + "typeString": "literal_string \"-\"" + } + ], + "id": 2930, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10527:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 2929, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "10527:6:14", + "typeDescriptions": {} + } + }, + "id": 2932, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10527:11:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "src": "10519:19:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "10499:39:14" + }, + { + "assignments": [ + 2936 + ], + "declarations": [ + { + "constant": false, + "id": 2936, + "mutability": "mutable", + "name": "offset", + "nameLocation": "10556:6:14", + "nodeType": "VariableDeclaration", + "scope": 2998, + "src": "10548:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2935, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10548:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2943, + "initialValue": { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 2939, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2937, + "name": "positiveSign", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2918, + "src": "10566:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "id": 2938, + "name": "negativeSign", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2927, + "src": "10582:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "10566:28:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "id": 2940, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "10565:30:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2941, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "10596:6:14", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "10565:37:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$attached_to$_t_bool_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 2942, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10565:39:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "10548:56:14" + }, + { + "assignments": [ + 2945, + 2947 + ], + "declarations": [ + { + "constant": false, + "id": 2945, + "mutability": "mutable", + "name": "absSuccess", + "nameLocation": "10621:10:14", + "nodeType": "VariableDeclaration", + "scope": 2998, + "src": "10616:15:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2944, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "10616:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2947, + "mutability": "mutable", + "name": "absValue", + "nameLocation": "10641:8:14", + "nodeType": "VariableDeclaration", + "scope": 2998, + "src": "10633:16:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2946, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10633:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2955, + "initialValue": { + "arguments": [ + { + "id": 2949, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2881, + "src": "10666:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2952, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2950, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2883, + "src": "10673:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "id": 2951, + "name": "offset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2936, + "src": "10681:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10673:14:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2953, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2885, + "src": "10689:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2948, + "name": "tryParseUint", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2658, + 2695 + ], + "referencedDeclaration": 2695, + "src": "10653:12:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 2954, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10653:40:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "10615:78:14" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 2960, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2956, + "name": "absSuccess", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2945, + "src": "10708:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2959, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2957, + "name": "absValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2947, + "src": "10722:8:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 2958, + "name": "ABS_MIN_INT256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2841, + "src": "10733:14:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10722:25:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "10708:39:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 2982, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 2978, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2976, + "name": "absSuccess", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2945, + "src": "10850:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "id": 2977, + "name": "negativeSign", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2927, + "src": "10864:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "10850:26:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2981, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2979, + "name": "absValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2947, + "src": "10880:8:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 2980, + "name": "ABS_MIN_INT256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2841, + "src": "10892:14:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10880:26:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "10850:56:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 2992, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10978:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "hexValue": "30", + "id": 2993, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10985:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "id": 2994, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "10977:10:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$", + "typeString": "tuple(bool,int_const 0)" + } + }, + "functionReturnParameters": 2891, + "id": 2995, + "nodeType": "Return", + "src": "10970:17:14" + }, + "id": 2996, + "nodeType": "IfStatement", + "src": "10846:141:14", + "trueBody": { + "id": 2991, + "nodeType": "Block", + "src": "10908:56:14", + "statements": [ + { + "expression": { + "components": [ + { + "hexValue": "74727565", + "id": 2983, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10930:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + { + "expression": { + "arguments": [ + { + "id": 2986, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10941:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + }, + "typeName": { + "id": 2985, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "10941:6:14", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + } + ], + "id": 2984, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "10936:4:14", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 2987, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10936:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_int256", + "typeString": "type(int256)" + } + }, + "id": 2988, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "10949:3:14", + "memberName": "min", + "nodeType": "MemberAccess", + "src": "10936:16:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 2989, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "10929:24:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_int256_$", + "typeString": "tuple(bool,int256)" + } + }, + "functionReturnParameters": 2891, + "id": 2990, + "nodeType": "Return", + "src": "10922:31:14" + } + ] + } + }, + "id": 2997, + "nodeType": "IfStatement", + "src": "10704:283:14", + "trueBody": { + "id": 2975, + "nodeType": "Block", + "src": "10749:91:14", + "statements": [ + { + "expression": { + "components": [ + { + "hexValue": "74727565", + "id": 2961, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10771:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + { + "condition": { + "id": 2962, + "name": "negativeSign", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2927, + "src": "10777:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseExpression": { + "arguments": [ + { + "id": 2970, + "name": "absValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2947, + "src": "10819:8:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2969, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10812:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + }, + "typeName": { + "id": 2968, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "10812:6:14", + "typeDescriptions": {} + } + }, + "id": 2971, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10812:16:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "id": 2972, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "Conditional", + "src": "10777:51:14", + "trueExpression": { + "id": 2967, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "-", + "prefix": true, + "src": "10792:17:14", + "subExpression": { + "arguments": [ + { + "id": 2965, + "name": "absValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2947, + "src": "10800:8:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2964, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10793:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + }, + "typeName": { + "id": 2963, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "10793:6:14", + "typeDescriptions": {} + } + }, + "id": 2966, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10793:16:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 2973, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "10770:59:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_int256_$", + "typeString": "tuple(bool,int256)" + } + }, + "functionReturnParameters": 2891, + "id": 2974, + "nodeType": "Return", + "src": "10763:66:14" + } + ] + } + } + ] + }, + "documentation": { + "id": 2879, + "nodeType": "StructuredDocumentation", + "src": "9788:223:14", + "text": " @dev Implementation of {tryParseInt-string-uint256-uint256} that does not check bounds. Caller should make sure that\n `begin <= end <= input.length`. Other inputs would result in undefined behavior." + }, + "id": 2999, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_tryParseIntUncheckedBounds", + "nameLocation": "10025:27:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2886, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2881, + "mutability": "mutable", + "name": "input", + "nameLocation": "10076:5:14", + "nodeType": "VariableDeclaration", + "scope": 2999, + "src": "10062:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2880, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "10062:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2883, + "mutability": "mutable", + "name": "begin", + "nameLocation": "10099:5:14", + "nodeType": "VariableDeclaration", + "scope": 2999, + "src": "10091:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2882, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10091:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2885, + "mutability": "mutable", + "name": "end", + "nameLocation": "10122:3:14", + "nodeType": "VariableDeclaration", + "scope": 2999, + "src": "10114:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2884, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10114:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "10052:79:14" + }, + "returnParameters": { + "id": 2891, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2888, + "mutability": "mutable", + "name": "success", + "nameLocation": "10159:7:14", + "nodeType": "VariableDeclaration", + "scope": 2999, + "src": "10154:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2887, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "10154:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2890, + "mutability": "mutable", + "name": "value", + "nameLocation": "10175:5:14", + "nodeType": "VariableDeclaration", + "scope": 2999, + "src": "10168:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 2889, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "10168:6:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "10153:28:14" + }, + "scope": 3678, + "src": "10016:978:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 3017, + "nodeType": "Block", + "src": "11339:67:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3008, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3002, + "src": "11369:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "hexValue": "30", + "id": 3009, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11376:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "expression": { + "arguments": [ + { + "id": 3012, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3002, + "src": "11385:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 3011, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "11379:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 3010, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "11379:5:14", + "typeDescriptions": {} + } + }, + "id": 3013, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11379:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 3014, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "11392:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "11379:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3007, + "name": "parseHexUint", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3018, + 3049 + ], + "referencedDeclaration": 3049, + "src": "11356:12:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (uint256)" + } + }, + "id": 3015, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11356:43:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 3006, + "id": 3016, + "nodeType": "Return", + "src": "11349:50:14" + } + ] + }, + "documentation": { + "id": 3000, + "nodeType": "StructuredDocumentation", + "src": "11000:259:14", + "text": " @dev Parse a hexadecimal string (with or without \"0x\" prefix), and returns the value as a `uint256`.\n Requirements:\n - The string must be formatted as `(0x)?[0-9a-fA-F]*`\n - The result must fit in an `uint256` type." + }, + "id": 3018, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parseHexUint", + "nameLocation": "11273:12:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3003, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3002, + "mutability": "mutable", + "name": "input", + "nameLocation": "11300:5:14", + "nodeType": "VariableDeclaration", + "scope": 3018, + "src": "11286:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3001, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "11286:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "11285:21:14" + }, + "returnParameters": { + "id": 3006, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3005, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3018, + "src": "11330:7:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3004, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11330:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "11329:9:14" + }, + "scope": 3678, + "src": "11264:142:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3048, + "nodeType": "Block", + "src": "11827:156:14", + "statements": [ + { + "assignments": [ + 3031, + 3033 + ], + "declarations": [ + { + "constant": false, + "id": 3031, + "mutability": "mutable", + "name": "success", + "nameLocation": "11843:7:14", + "nodeType": "VariableDeclaration", + "scope": 3048, + "src": "11838:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3030, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "11838:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3033, + "mutability": "mutable", + "name": "value", + "nameLocation": "11860:5:14", + "nodeType": "VariableDeclaration", + "scope": 3048, + "src": "11852:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3032, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11852:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3039, + "initialValue": { + "arguments": [ + { + "id": 3035, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3021, + "src": "11885:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "id": 3036, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3023, + "src": "11892:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 3037, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3025, + "src": "11899:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3034, + "name": "tryParseHexUint", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3070, + 3107 + ], + "referencedDeclaration": 3107, + "src": "11869:15:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 3038, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11869:34:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "11837:66:14" + }, + { + "condition": { + "id": 3041, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "11917:8:14", + "subExpression": { + "id": 3040, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3031, + "src": "11918:7:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3045, + "nodeType": "IfStatement", + "src": "11913:41:14", + "trueBody": { + "errorCall": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 3042, + "name": "StringsInvalidChar", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2210, + "src": "11934:18:14", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$__$returns$_t_error_$", + "typeString": "function () pure returns (error)" + } + }, + "id": 3043, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11934:20:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 3044, + "nodeType": "RevertStatement", + "src": "11927:27:14" + } + }, + { + "expression": { + "id": 3046, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3033, + "src": "11971:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 3029, + "id": 3047, + "nodeType": "Return", + "src": "11964:12:14" + } + ] + }, + "documentation": { + "id": 3019, + "nodeType": "StructuredDocumentation", + "src": "11412:307:14", + "text": " @dev Variant of {parseHexUint-string} that parses a substring of `input` located between position `begin` (included) and\n `end` (excluded).\n Requirements:\n - The substring must be formatted as `(0x)?[0-9a-fA-F]*`\n - The result must fit in an `uint256` type." + }, + "id": 3049, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parseHexUint", + "nameLocation": "11733:12:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3026, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3021, + "mutability": "mutable", + "name": "input", + "nameLocation": "11760:5:14", + "nodeType": "VariableDeclaration", + "scope": 3049, + "src": "11746:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3020, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "11746:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3023, + "mutability": "mutable", + "name": "begin", + "nameLocation": "11775:5:14", + "nodeType": "VariableDeclaration", + "scope": 3049, + "src": "11767:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3022, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11767:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3025, + "mutability": "mutable", + "name": "end", + "nameLocation": "11790:3:14", + "nodeType": "VariableDeclaration", + "scope": 3049, + "src": "11782:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3024, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11782:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "11745:49:14" + }, + "returnParameters": { + "id": 3029, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3028, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3049, + "src": "11818:7:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3027, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11818:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "11817:9:14" + }, + "scope": 3678, + "src": "11724:259:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3069, + "nodeType": "Block", + "src": "12310:86:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3060, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3052, + "src": "12359:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "hexValue": "30", + "id": 3061, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12366:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "expression": { + "arguments": [ + { + "id": 3064, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3052, + "src": "12375:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 3063, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "12369:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 3062, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "12369:5:14", + "typeDescriptions": {} + } + }, + "id": 3065, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12369:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 3066, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "12382:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "12369:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3059, + "name": "_tryParseHexUintUncheckedBounds", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3210, + "src": "12327:31:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 3067, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12327:62:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "functionReturnParameters": 3058, + "id": 3068, + "nodeType": "Return", + "src": "12320:69:14" + } + ] + }, + "documentation": { + "id": 3050, + "nodeType": "StructuredDocumentation", + "src": "11989:218:14", + "text": " @dev Variant of {parseHexUint-string} that returns false if the parsing fails because of an invalid character.\n NOTE: This function will revert if the result does not fit in a `uint256`." + }, + "id": 3070, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryParseHexUint", + "nameLocation": "12221:15:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3053, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3052, + "mutability": "mutable", + "name": "input", + "nameLocation": "12251:5:14", + "nodeType": "VariableDeclaration", + "scope": 3070, + "src": "12237:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3051, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "12237:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "12236:21:14" + }, + "returnParameters": { + "id": 3058, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3055, + "mutability": "mutable", + "name": "success", + "nameLocation": "12286:7:14", + "nodeType": "VariableDeclaration", + "scope": 3070, + "src": "12281:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3054, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "12281:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3057, + "mutability": "mutable", + "name": "value", + "nameLocation": "12303:5:14", + "nodeType": "VariableDeclaration", + "scope": 3070, + "src": "12295:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3056, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12295:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "12280:29:14" + }, + "scope": 3678, + "src": "12212:184:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3106, + "nodeType": "Block", + "src": "12804:147:14", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 3094, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3090, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3084, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3077, + "src": "12818:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 3087, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3073, + "src": "12830:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 3086, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "12824:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 3085, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "12824:5:14", + "typeDescriptions": {} + } + }, + "id": 3088, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12824:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 3089, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "12837:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "12824:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "12818:25:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3093, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3091, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3075, + "src": "12847:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "id": 3092, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3077, + "src": "12855:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "12847:11:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "12818:40:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3099, + "nodeType": "IfStatement", + "src": "12814:63:14", + "trueBody": { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 3095, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12868:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "hexValue": "30", + "id": 3096, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12875:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "id": 3097, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12867:10:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$", + "typeString": "tuple(bool,int_const 0)" + } + }, + "functionReturnParameters": 3083, + "id": 3098, + "nodeType": "Return", + "src": "12860:17:14" + } + }, + { + "expression": { + "arguments": [ + { + "id": 3101, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3073, + "src": "12926:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "id": 3102, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3075, + "src": "12933:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 3103, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3077, + "src": "12940:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3100, + "name": "_tryParseHexUintUncheckedBounds", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3210, + "src": "12894:31:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 3104, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12894:50:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "functionReturnParameters": 3083, + "id": 3105, + "nodeType": "Return", + "src": "12887:57:14" + } + ] + }, + "documentation": { + "id": 3071, + "nodeType": "StructuredDocumentation", + "src": "12402:241:14", + "text": " @dev Variant of {parseHexUint-string-uint256-uint256} that returns false if the parsing fails because of an\n invalid character.\n NOTE: This function will revert if the result does not fit in a `uint256`." + }, + "id": 3107, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryParseHexUint", + "nameLocation": "12657:15:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3078, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3073, + "mutability": "mutable", + "name": "input", + "nameLocation": "12696:5:14", + "nodeType": "VariableDeclaration", + "scope": 3107, + "src": "12682:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3072, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "12682:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3075, + "mutability": "mutable", + "name": "begin", + "nameLocation": "12719:5:14", + "nodeType": "VariableDeclaration", + "scope": 3107, + "src": "12711:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3074, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12711:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3077, + "mutability": "mutable", + "name": "end", + "nameLocation": "12742:3:14", + "nodeType": "VariableDeclaration", + "scope": 3107, + "src": "12734:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3076, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12734:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "12672:79:14" + }, + "returnParameters": { + "id": 3083, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3080, + "mutability": "mutable", + "name": "success", + "nameLocation": "12780:7:14", + "nodeType": "VariableDeclaration", + "scope": 3107, + "src": "12775:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3079, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "12775:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3082, + "mutability": "mutable", + "name": "value", + "nameLocation": "12797:5:14", + "nodeType": "VariableDeclaration", + "scope": 3107, + "src": "12789:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3081, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12789:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "12774:29:14" + }, + "scope": 3678, + "src": "12648:303:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3209, + "nodeType": "Block", + "src": "13360:881:14", + "statements": [ + { + "assignments": [ + 3122 + ], + "declarations": [ + { + "constant": false, + "id": 3122, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "13383:6:14", + "nodeType": "VariableDeclaration", + "scope": 3209, + "src": "13370:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 3121, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "13370:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 3127, + "initialValue": { + "arguments": [ + { + "id": 3125, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3110, + "src": "13398:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 3124, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "13392:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 3123, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "13392:5:14", + "typeDescriptions": {} + } + }, + "id": 3126, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13392:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "13370:34:14" + }, + { + "assignments": [ + 3129 + ], + "declarations": [ + { + "constant": false, + "id": 3129, + "mutability": "mutable", + "name": "hasPrefix", + "nameLocation": "13457:9:14", + "nodeType": "VariableDeclaration", + "scope": 3209, + "src": "13452:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3128, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "13452:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "id": 3149, + "initialValue": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 3148, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3134, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3130, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3114, + "src": "13470:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3133, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3131, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3112, + "src": "13476:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "31", + "id": 3132, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13484:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "13476:9:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "13470:15:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "id": 3135, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13469:17:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + }, + "id": 3147, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "arguments": [ + { + "id": 3139, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3122, + "src": "13520:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3140, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3112, + "src": "13528:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3138, + "name": "_unsafeReadBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3665, + "src": "13497:22:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (bytes memory,uint256) pure returns (bytes32)" + } + }, + "id": 3141, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13497:37:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3137, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "13490:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes2_$", + "typeString": "type(bytes2)" + }, + "typeName": { + "id": 3136, + "name": "bytes2", + "nodeType": "ElementaryTypeName", + "src": "13490:6:14", + "typeDescriptions": {} + } + }, + "id": 3142, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13490:45:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "arguments": [ + { + "hexValue": "3078", + "id": 3145, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13546:4:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_39bef1777deb3dfb14f64b9f81ced092c501fee72f90e93d03bb95ee89df9837", + "typeString": "literal_string \"0x\"" + }, + "value": "0x" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_39bef1777deb3dfb14f64b9f81ced092c501fee72f90e93d03bb95ee89df9837", + "typeString": "literal_string \"0x\"" + } + ], + "id": 3144, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "13539:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes2_$", + "typeString": "type(bytes2)" + }, + "typeName": { + "id": 3143, + "name": "bytes2", + "nodeType": "ElementaryTypeName", + "src": "13539:6:14", + "typeDescriptions": {} + } + }, + "id": 3146, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13539:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "src": "13490:61:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "13469:82:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "13452:99:14" + }, + { + "assignments": [ + 3151 + ], + "declarations": [ + { + "constant": false, + "id": 3151, + "mutability": "mutable", + "name": "offset", + "nameLocation": "13640:6:14", + "nodeType": "VariableDeclaration", + "scope": 3209, + "src": "13632:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3150, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13632:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3157, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3156, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "id": 3152, + "name": "hasPrefix", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3129, + "src": "13649:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3153, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "13659:6:14", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "13649:16:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$attached_to$_t_bool_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 3154, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13649:18:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "hexValue": "32", + "id": 3155, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13670:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "13649:22:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "13632:39:14" + }, + { + "assignments": [ + 3159 + ], + "declarations": [ + { + "constant": false, + "id": 3159, + "mutability": "mutable", + "name": "result", + "nameLocation": "13690:6:14", + "nodeType": "VariableDeclaration", + "scope": 3209, + "src": "13682:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3158, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13682:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3161, + "initialValue": { + "hexValue": "30", + "id": 3160, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13699:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "13682:18:14" + }, + { + "body": { + "id": 3203, + "nodeType": "Block", + "src": "13757:447:14", + "statements": [ + { + "assignments": [ + 3175 + ], + "declarations": [ + { + "constant": false, + "id": 3175, + "mutability": "mutable", + "name": "chr", + "nameLocation": "13777:3:14", + "nodeType": "VariableDeclaration", + "scope": 3203, + "src": "13771:9:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 3174, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "13771:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "id": 3185, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "id": 3180, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3122, + "src": "13826:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3181, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3163, + "src": "13834:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3179, + "name": "_unsafeReadBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3665, + "src": "13803:22:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (bytes memory,uint256) pure returns (bytes32)" + } + }, + "id": 3182, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13803:33:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3178, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "13796:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 3177, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "13796:6:14", + "typeDescriptions": {} + } + }, + "id": 3183, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13796:41:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 3176, + "name": "_tryParseChr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3445, + "src": "13783:12:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes1_$returns$_t_uint8_$", + "typeString": "function (bytes1) pure returns (uint8)" + } + }, + "id": 3184, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13783:55:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "13771:67:14" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3188, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3186, + "name": "chr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3175, + "src": "13856:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "3135", + "id": 3187, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13862:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_15_by_1", + "typeString": "int_const 15" + }, + "value": "15" + }, + "src": "13856:8:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3193, + "nodeType": "IfStatement", + "src": "13852:31:14", + "trueBody": { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 3189, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13874:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "hexValue": "30", + "id": 3190, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13881:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "id": 3191, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13873:10:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$", + "typeString": "tuple(bool,int_const 0)" + } + }, + "functionReturnParameters": 3120, + "id": 3192, + "nodeType": "Return", + "src": "13866:17:14" + } + }, + { + "expression": { + "id": 3196, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 3194, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3159, + "src": "13897:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "*=", + "rightHandSide": { + "hexValue": "3136", + "id": 3195, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13907:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "13897:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 3197, + "nodeType": "ExpressionStatement", + "src": "13897:12:14" + }, + { + "id": 3202, + "nodeType": "UncheckedBlock", + "src": "13923:271:14", + "statements": [ + { + "expression": { + "id": 3200, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 3198, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3159, + "src": "14166:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "id": 3199, + "name": "chr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3175, + "src": "14176:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "src": "14166:13:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 3201, + "nodeType": "ExpressionStatement", + "src": "14166:13:14" + } + ] + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3170, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3168, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3163, + "src": "13743:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 3169, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3114, + "src": "13747:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "13743:7:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3204, + "initializationExpression": { + "assignments": [ + 3163 + ], + "declarations": [ + { + "constant": false, + "id": 3163, + "mutability": "mutable", + "name": "i", + "nameLocation": "13723:1:14", + "nodeType": "VariableDeclaration", + "scope": 3204, + "src": "13715:9:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3162, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13715:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3167, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3166, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3164, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3112, + "src": "13727:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "id": 3165, + "name": "offset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3151, + "src": "13735:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "13727:14:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "13715:26:14" + }, + "isSimpleCounterLoop": true, + "loopExpression": { + "expression": { + "id": 3172, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": true, + "src": "13752:3:14", + "subExpression": { + "id": 3171, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3163, + "src": "13754:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 3173, + "nodeType": "ExpressionStatement", + "src": "13752:3:14" + }, + "nodeType": "ForStatement", + "src": "13710:494:14" + }, + { + "expression": { + "components": [ + { + "hexValue": "74727565", + "id": 3205, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14221:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + { + "id": 3206, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3159, + "src": "14227:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 3207, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "14220:14:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "functionReturnParameters": 3120, + "id": 3208, + "nodeType": "Return", + "src": "14213:21:14" + } + ] + }, + "documentation": { + "id": 3108, + "nodeType": "StructuredDocumentation", + "src": "12957:227:14", + "text": " @dev Implementation of {tryParseHexUint-string-uint256-uint256} that does not check bounds. Caller should make sure that\n `begin <= end <= input.length`. Other inputs would result in undefined behavior." + }, + "id": 3210, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_tryParseHexUintUncheckedBounds", + "nameLocation": "13198:31:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3115, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3110, + "mutability": "mutable", + "name": "input", + "nameLocation": "13253:5:14", + "nodeType": "VariableDeclaration", + "scope": 3210, + "src": "13239:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3109, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "13239:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3112, + "mutability": "mutable", + "name": "begin", + "nameLocation": "13276:5:14", + "nodeType": "VariableDeclaration", + "scope": 3210, + "src": "13268:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3111, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13268:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3114, + "mutability": "mutable", + "name": "end", + "nameLocation": "13299:3:14", + "nodeType": "VariableDeclaration", + "scope": 3210, + "src": "13291:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3113, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13291:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "13229:79:14" + }, + "returnParameters": { + "id": 3120, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3117, + "mutability": "mutable", + "name": "success", + "nameLocation": "13336:7:14", + "nodeType": "VariableDeclaration", + "scope": 3210, + "src": "13331:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3116, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "13331:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3119, + "mutability": "mutable", + "name": "value", + "nameLocation": "13353:5:14", + "nodeType": "VariableDeclaration", + "scope": 3210, + "src": "13345:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3118, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13345:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "13330:29:14" + }, + "scope": 3678, + "src": "13189:1052:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 3228, + "nodeType": "Block", + "src": "14539:67:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3219, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3213, + "src": "14569:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "hexValue": "30", + "id": 3220, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14576:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "expression": { + "arguments": [ + { + "id": 3223, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3213, + "src": "14585:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 3222, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "14579:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 3221, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "14579:5:14", + "typeDescriptions": {} + } + }, + "id": 3224, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14579:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 3225, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "14592:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "14579:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3218, + "name": "parseAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3229, + 3260 + ], + "referencedDeclaration": 3260, + "src": "14556:12:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_address_$", + "typeString": "function (string memory,uint256,uint256) pure returns (address)" + } + }, + "id": 3226, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14556:43:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 3217, + "id": 3227, + "nodeType": "Return", + "src": "14549:50:14" + } + ] + }, + "documentation": { + "id": 3211, + "nodeType": "StructuredDocumentation", + "src": "14247:212:14", + "text": " @dev Parse a hexadecimal string (with or without \"0x\" prefix), and returns the value as an `address`.\n Requirements:\n - The string must be formatted as `(0x)?[0-9a-fA-F]{40}`" + }, + "id": 3229, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parseAddress", + "nameLocation": "14473:12:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3214, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3213, + "mutability": "mutable", + "name": "input", + "nameLocation": "14500:5:14", + "nodeType": "VariableDeclaration", + "scope": 3229, + "src": "14486:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3212, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "14486:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "14485:21:14" + }, + "returnParameters": { + "id": 3217, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3216, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3229, + "src": "14530:7:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3215, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "14530:7:14", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "14529:9:14" + }, + "scope": 3678, + "src": "14464:142:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3259, + "nodeType": "Block", + "src": "14979:165:14", + "statements": [ + { + "assignments": [ + 3242, + 3244 + ], + "declarations": [ + { + "constant": false, + "id": 3242, + "mutability": "mutable", + "name": "success", + "nameLocation": "14995:7:14", + "nodeType": "VariableDeclaration", + "scope": 3259, + "src": "14990:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3241, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "14990:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3244, + "mutability": "mutable", + "name": "value", + "nameLocation": "15012:5:14", + "nodeType": "VariableDeclaration", + "scope": 3259, + "src": "15004:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3243, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "15004:7:14", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "id": 3250, + "initialValue": { + "arguments": [ + { + "id": 3246, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3232, + "src": "15037:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "id": 3247, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3234, + "src": "15044:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 3248, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3236, + "src": "15051:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3245, + "name": "tryParseAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3281, + 3385 + ], + "referencedDeclaration": 3385, + "src": "15021:15:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_address_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,address)" + } + }, + "id": 3249, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15021:34:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_address_$", + "typeString": "tuple(bool,address)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "14989:66:14" + }, + { + "condition": { + "id": 3252, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "15069:8:14", + "subExpression": { + "id": 3251, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3242, + "src": "15070:7:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3256, + "nodeType": "IfStatement", + "src": "15065:50:14", + "trueBody": { + "errorCall": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 3253, + "name": "StringsInvalidAddressFormat", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2213, + "src": "15086:27:14", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$__$returns$_t_error_$", + "typeString": "function () pure returns (error)" + } + }, + "id": 3254, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15086:29:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 3255, + "nodeType": "RevertStatement", + "src": "15079:36:14" + } + }, + { + "expression": { + "id": 3257, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3244, + "src": "15132:5:14", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 3240, + "id": 3258, + "nodeType": "Return", + "src": "15125:12:14" + } + ] + }, + "documentation": { + "id": 3230, + "nodeType": "StructuredDocumentation", + "src": "14612:259:14", + "text": " @dev Variant of {parseAddress-string} that parses a substring of `input` located between position `begin` (included) and\n `end` (excluded).\n Requirements:\n - The substring must be formatted as `(0x)?[0-9a-fA-F]{40}`" + }, + "id": 3260, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parseAddress", + "nameLocation": "14885:12:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3237, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3232, + "mutability": "mutable", + "name": "input", + "nameLocation": "14912:5:14", + "nodeType": "VariableDeclaration", + "scope": 3260, + "src": "14898:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3231, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "14898:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3234, + "mutability": "mutable", + "name": "begin", + "nameLocation": "14927:5:14", + "nodeType": "VariableDeclaration", + "scope": 3260, + "src": "14919:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3233, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "14919:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3236, + "mutability": "mutable", + "name": "end", + "nameLocation": "14942:3:14", + "nodeType": "VariableDeclaration", + "scope": 3260, + "src": "14934:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3235, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "14934:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "14897:49:14" + }, + "returnParameters": { + "id": 3240, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3239, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3260, + "src": "14970:7:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3238, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "14970:7:14", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "14969:9:14" + }, + "scope": 3678, + "src": "14876:268:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3280, + "nodeType": "Block", + "src": "15451:70:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3271, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3263, + "src": "15484:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "hexValue": "30", + "id": 3272, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "15491:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "expression": { + "arguments": [ + { + "id": 3275, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3263, + "src": "15500:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 3274, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "15494:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 3273, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "15494:5:14", + "typeDescriptions": {} + } + }, + "id": 3276, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15494:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 3277, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "15507:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "15494:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3270, + "name": "tryParseAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3281, + 3385 + ], + "referencedDeclaration": 3385, + "src": "15468:15:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_address_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,address)" + } + }, + "id": 3278, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15468:46:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_address_$", + "typeString": "tuple(bool,address)" + } + }, + "functionReturnParameters": 3269, + "id": 3279, + "nodeType": "Return", + "src": "15461:53:14" + } + ] + }, + "documentation": { + "id": 3261, + "nodeType": "StructuredDocumentation", + "src": "15150:198:14", + "text": " @dev Variant of {parseAddress-string} that returns false if the parsing fails because the input is not a properly\n formatted address. See {parseAddress-string} requirements." + }, + "id": 3281, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryParseAddress", + "nameLocation": "15362:15:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3264, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3263, + "mutability": "mutable", + "name": "input", + "nameLocation": "15392:5:14", + "nodeType": "VariableDeclaration", + "scope": 3281, + "src": "15378:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3262, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "15378:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "15377:21:14" + }, + "returnParameters": { + "id": 3269, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3266, + "mutability": "mutable", + "name": "success", + "nameLocation": "15427:7:14", + "nodeType": "VariableDeclaration", + "scope": 3281, + "src": "15422:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3265, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "15422:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3268, + "mutability": "mutable", + "name": "value", + "nameLocation": "15444:5:14", + "nodeType": "VariableDeclaration", + "scope": 3281, + "src": "15436:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3267, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "15436:7:14", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "15421:29:14" + }, + "scope": 3678, + "src": "15353:168:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3384, + "nodeType": "Block", + "src": "15914:733:14", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 3305, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3301, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3295, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3288, + "src": "15928:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 3298, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3284, + "src": "15940:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 3297, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "15934:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 3296, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "15934:5:14", + "typeDescriptions": {} + } + }, + "id": 3299, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15934:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 3300, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "15947:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "15934:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "15928:25:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3304, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3302, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3286, + "src": "15957:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "id": 3303, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3288, + "src": "15965:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "15957:11:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "15928:40:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3313, + "nodeType": "IfStatement", + "src": "15924:72:14", + "trueBody": { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 3306, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "15978:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "arguments": [ + { + "hexValue": "30", + "id": 3309, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "15993:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 3308, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "15985:7:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3307, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "15985:7:14", + "typeDescriptions": {} + } + }, + "id": 3310, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15985:10:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "id": 3311, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "15977:19:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_address_$", + "typeString": "tuple(bool,address)" + } + }, + "functionReturnParameters": 3294, + "id": 3312, + "nodeType": "Return", + "src": "15970:26:14" + } + }, + { + "assignments": [ + 3315 + ], + "declarations": [ + { + "constant": false, + "id": 3315, + "mutability": "mutable", + "name": "hasPrefix", + "nameLocation": "16012:9:14", + "nodeType": "VariableDeclaration", + "scope": 3384, + "src": "16007:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3314, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "16007:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "id": 3338, + "initialValue": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 3337, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3320, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3316, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3288, + "src": "16025:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3319, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3317, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3286, + "src": "16031:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "31", + "id": 3318, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16039:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "16031:9:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "16025:15:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "id": 3321, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "16024:17:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + }, + "id": 3336, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "id": 3327, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3284, + "src": "16081:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 3326, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16075:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 3325, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "16075:5:14", + "typeDescriptions": {} + } + }, + "id": 3328, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16075:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3329, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3286, + "src": "16089:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3324, + "name": "_unsafeReadBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3665, + "src": "16052:22:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (bytes memory,uint256) pure returns (bytes32)" + } + }, + "id": 3330, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16052:43:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3323, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16045:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes2_$", + "typeString": "type(bytes2)" + }, + "typeName": { + "id": 3322, + "name": "bytes2", + "nodeType": "ElementaryTypeName", + "src": "16045:6:14", + "typeDescriptions": {} + } + }, + "id": 3331, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16045:51:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "arguments": [ + { + "hexValue": "3078", + "id": 3334, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16107:4:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_39bef1777deb3dfb14f64b9f81ced092c501fee72f90e93d03bb95ee89df9837", + "typeString": "literal_string \"0x\"" + }, + "value": "0x" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_39bef1777deb3dfb14f64b9f81ced092c501fee72f90e93d03bb95ee89df9837", + "typeString": "literal_string \"0x\"" + } + ], + "id": 3333, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16100:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes2_$", + "typeString": "type(bytes2)" + }, + "typeName": { + "id": 3332, + "name": "bytes2", + "nodeType": "ElementaryTypeName", + "src": "16100:6:14", + "typeDescriptions": {} + } + }, + "id": 3335, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16100:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "src": "16045:67:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "16024:88:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "16007:105:14" + }, + { + "assignments": [ + 3340 + ], + "declarations": [ + { + "constant": false, + "id": 3340, + "mutability": "mutable", + "name": "expectedLength", + "nameLocation": "16201:14:14", + "nodeType": "VariableDeclaration", + "scope": 3384, + "src": "16193:22:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3339, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "16193:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3348, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3347, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3430", + "id": 3341, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16218:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_40_by_1", + "typeString": "int_const 40" + }, + "value": "40" + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3346, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "id": 3342, + "name": "hasPrefix", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3315, + "src": "16223:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3343, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "16233:6:14", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "16223:16:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$attached_to$_t_bool_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 3344, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16223:18:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "hexValue": "32", + "id": 3345, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16244:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "16223:22:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "16218:27:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "16193:52:14" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3353, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3351, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3349, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3288, + "src": "16310:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "id": 3350, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3286, + "src": "16316:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "16310:11:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 3352, + "name": "expectedLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3340, + "src": "16325:14:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "16310:29:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 3382, + "nodeType": "Block", + "src": "16590:51:14", + "statements": [ + { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 3375, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16612:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "arguments": [ + { + "hexValue": "30", + "id": 3378, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16627:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 3377, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16619:7:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3376, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "16619:7:14", + "typeDescriptions": {} + } + }, + "id": 3379, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16619:10:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "id": 3380, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "16611:19:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_address_$", + "typeString": "tuple(bool,address)" + } + }, + "functionReturnParameters": 3294, + "id": 3381, + "nodeType": "Return", + "src": "16604:26:14" + } + ] + }, + "id": 3383, + "nodeType": "IfStatement", + "src": "16306:335:14", + "trueBody": { + "id": 3374, + "nodeType": "Block", + "src": "16341:243:14", + "statements": [ + { + "assignments": [ + 3355, + 3357 + ], + "declarations": [ + { + "constant": false, + "id": 3355, + "mutability": "mutable", + "name": "s", + "nameLocation": "16462:1:14", + "nodeType": "VariableDeclaration", + "scope": 3374, + "src": "16457:6:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3354, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "16457:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3357, + "mutability": "mutable", + "name": "v", + "nameLocation": "16473:1:14", + "nodeType": "VariableDeclaration", + "scope": 3374, + "src": "16465:9:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3356, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "16465:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3363, + "initialValue": { + "arguments": [ + { + "id": 3359, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3284, + "src": "16510:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "id": 3360, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3286, + "src": "16517:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 3361, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3288, + "src": "16524:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3358, + "name": "_tryParseHexUintUncheckedBounds", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3210, + "src": "16478:31:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 3362, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16478:50:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "16456:72:14" + }, + { + "expression": { + "components": [ + { + "id": 3364, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3355, + "src": "16550:1:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "arguments": [ + { + "arguments": [ + { + "id": 3369, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3357, + "src": "16569:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3368, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16561:7:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint160_$", + "typeString": "type(uint160)" + }, + "typeName": { + "id": 3367, + "name": "uint160", + "nodeType": "ElementaryTypeName", + "src": "16561:7:14", + "typeDescriptions": {} + } + }, + "id": 3370, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16561:10:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint160", + "typeString": "uint160" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint160", + "typeString": "uint160" + } + ], + "id": 3366, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16553:7:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3365, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "16553:7:14", + "typeDescriptions": {} + } + }, + "id": 3371, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16553:19:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "id": 3372, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "16549:24:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_address_$", + "typeString": "tuple(bool,address)" + } + }, + "functionReturnParameters": 3294, + "id": 3373, + "nodeType": "Return", + "src": "16542:31:14" + } + ] + } + } + ] + }, + "documentation": { + "id": 3282, + "nodeType": "StructuredDocumentation", + "src": "15527:226:14", + "text": " @dev Variant of {parseAddress-string-uint256-uint256} that returns false if the parsing fails because input is not a properly\n formatted address. See {parseAddress-string-uint256-uint256} requirements." + }, + "id": 3385, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryParseAddress", + "nameLocation": "15767:15:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3289, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3284, + "mutability": "mutable", + "name": "input", + "nameLocation": "15806:5:14", + "nodeType": "VariableDeclaration", + "scope": 3385, + "src": "15792:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3283, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "15792:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3286, + "mutability": "mutable", + "name": "begin", + "nameLocation": "15829:5:14", + "nodeType": "VariableDeclaration", + "scope": 3385, + "src": "15821:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3285, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "15821:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3288, + "mutability": "mutable", + "name": "end", + "nameLocation": "15852:3:14", + "nodeType": "VariableDeclaration", + "scope": 3385, + "src": "15844:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3287, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "15844:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "15782:79:14" + }, + "returnParameters": { + "id": 3294, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3291, + "mutability": "mutable", + "name": "success", + "nameLocation": "15890:7:14", + "nodeType": "VariableDeclaration", + "scope": 3385, + "src": "15885:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3290, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "15885:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3293, + "mutability": "mutable", + "name": "value", + "nameLocation": "15907:5:14", + "nodeType": "VariableDeclaration", + "scope": 3385, + "src": "15899:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3292, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "15899:7:14", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "15884:29:14" + }, + "scope": 3678, + "src": "15758:889:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3444, + "nodeType": "Block", + "src": "16716:461:14", + "statements": [ + { + "assignments": [ + 3393 + ], + "declarations": [ + { + "constant": false, + "id": 3393, + "mutability": "mutable", + "name": "value", + "nameLocation": "16732:5:14", + "nodeType": "VariableDeclaration", + "scope": 3444, + "src": "16726:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 3392, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "16726:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "id": 3398, + "initialValue": { + "arguments": [ + { + "id": 3396, + "name": "chr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3387, + "src": "16746:3:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 3395, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16740:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": { + "id": 3394, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "16740:5:14", + "typeDescriptions": {} + } + }, + "id": 3397, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16740:10:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "16726:24:14" + }, + { + "id": 3441, + "nodeType": "UncheckedBlock", + "src": "16910:238:14", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 3405, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3401, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3399, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "16938:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "3437", + "id": 3400, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16946:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_47_by_1", + "typeString": "int_const 47" + }, + "value": "47" + }, + "src": "16938:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3404, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3402, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "16952:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "hexValue": "3538", + "id": 3403, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16960:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_58_by_1", + "typeString": "int_const 58" + }, + "value": "58" + }, + "src": "16952:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "16938:24:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 3416, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3412, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3410, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "16998:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "3936", + "id": 3411, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17006:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_96_by_1", + "typeString": "int_const 96" + }, + "value": "96" + }, + "src": "16998:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3415, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3413, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "17012:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "hexValue": "313033", + "id": 3414, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17020:3:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_103_by_1", + "typeString": "int_const 103" + }, + "value": "103" + }, + "src": "17012:11:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "16998:25:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 3427, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3423, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3421, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "17059:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "3634", + "id": 3422, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17067:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "17059:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3426, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3424, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "17073:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "hexValue": "3731", + "id": 3425, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17081:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_71_by_1", + "typeString": "int_const 71" + }, + "value": "71" + }, + "src": "17073:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "17059:24:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "expression": { + "expression": { + "arguments": [ + { + "id": 3434, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "17127:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": { + "id": 3433, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "17127:5:14", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + } + ], + "id": 3432, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "17122:4:14", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 3435, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "17122:11:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint8", + "typeString": "type(uint8)" + } + }, + "id": 3436, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "17134:3:14", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "17122:15:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "functionReturnParameters": 3391, + "id": 3437, + "nodeType": "Return", + "src": "17115:22:14" + }, + "id": 3438, + "nodeType": "IfStatement", + "src": "17055:82:14", + "trueBody": { + "expression": { + "id": 3430, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 3428, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "17085:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "Assignment", + "operator": "-=", + "rightHandSide": { + "hexValue": "3535", + "id": 3429, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17094:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_55_by_1", + "typeString": "int_const 55" + }, + "value": "55" + }, + "src": "17085:11:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "id": 3431, + "nodeType": "ExpressionStatement", + "src": "17085:11:14" + } + }, + "id": 3439, + "nodeType": "IfStatement", + "src": "16994:143:14", + "trueBody": { + "expression": { + "id": 3419, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 3417, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "17025:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "Assignment", + "operator": "-=", + "rightHandSide": { + "hexValue": "3837", + "id": 3418, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17034:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_87_by_1", + "typeString": "int_const 87" + }, + "value": "87" + }, + "src": "17025:11:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "id": 3420, + "nodeType": "ExpressionStatement", + "src": "17025:11:14" + } + }, + "id": 3440, + "nodeType": "IfStatement", + "src": "16934:203:14", + "trueBody": { + "expression": { + "id": 3408, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 3406, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "16964:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "Assignment", + "operator": "-=", + "rightHandSide": { + "hexValue": "3438", + "id": 3407, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16973:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_48_by_1", + "typeString": "int_const 48" + }, + "value": "48" + }, + "src": "16964:11:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "id": 3409, + "nodeType": "ExpressionStatement", + "src": "16964:11:14" + } + } + ] + }, + { + "expression": { + "id": 3442, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "17165:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "functionReturnParameters": 3391, + "id": 3443, + "nodeType": "Return", + "src": "17158:12:14" + } + ] + }, + "id": 3445, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_tryParseChr", + "nameLocation": "16662:12:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3388, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3387, + "mutability": "mutable", + "name": "chr", + "nameLocation": "16682:3:14", + "nodeType": "VariableDeclaration", + "scope": 3445, + "src": "16675:10:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 3386, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "16675:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + } + ], + "src": "16674:12:14" + }, + "returnParameters": { + "id": 3391, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3390, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3445, + "src": "16709:5:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 3389, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "16709:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "src": "16708:7:14" + }, + "scope": 3678, + "src": "16653:524:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 3652, + "nodeType": "Block", + "src": "17984:2333:14", + "statements": [ + { + "assignments": [ + 3454 + ], + "declarations": [ + { + "constant": false, + "id": 3454, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "18007:6:14", + "nodeType": "VariableDeclaration", + "scope": 3652, + "src": "17994:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 3453, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "17994:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 3459, + "initialValue": { + "arguments": [ + { + "id": 3457, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3448, + "src": "18022:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 3456, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "18016:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 3455, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "18016:5:14", + "typeDescriptions": {} + } + }, + "id": 3458, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18016:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "17994:34:14" + }, + { + "assignments": [ + 3461 + ], + "declarations": [ + { + "constant": false, + "id": 3461, + "mutability": "mutable", + "name": "output", + "nameLocation": "18318:6:14", + "nodeType": "VariableDeclaration", + "scope": 3652, + "src": "18305:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 3460, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "18305:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 3462, + "nodeType": "VariableDeclarationStatement", + "src": "18305:19:14" + }, + { + "AST": { + "nativeSrc": "18359:45:14", + "nodeType": "YulBlock", + "src": "18359:45:14", + "statements": [ + { + "nativeSrc": "18373:21:14", + "nodeType": "YulAssignment", + "src": "18373:21:14", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "18389:4:14", + "nodeType": "YulLiteral", + "src": "18389:4:14", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "18383:5:14", + "nodeType": "YulIdentifier", + "src": "18383:5:14" + }, + "nativeSrc": "18383:11:14", + "nodeType": "YulFunctionCall", + "src": "18383:11:14" + }, + "variableNames": [ + { + "name": "output", + "nativeSrc": "18373:6:14", + "nodeType": "YulIdentifier", + "src": "18373:6:14" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 3461, + "isOffset": false, + "isSlot": false, + "src": "18373:6:14", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 3463, + "nodeType": "InlineAssembly", + "src": "18334:70:14" + }, + { + "assignments": [ + 3465 + ], + "declarations": [ + { + "constant": false, + "id": 3465, + "mutability": "mutable", + "name": "outputLength", + "nameLocation": "18421:12:14", + "nodeType": "VariableDeclaration", + "scope": 3652, + "src": "18413:20:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3464, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "18413:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3467, + "initialValue": { + "hexValue": "30", + "id": 3466, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18436:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "18413:24:14" + }, + { + "body": { + "id": 3644, + "nodeType": "Block", + "src": "18492:1584:14", + "statements": [ + { + "assignments": [ + 3480 + ], + "declarations": [ + { + "constant": false, + "id": 3480, + "mutability": "mutable", + "name": "char", + "nameLocation": "18512:4:14", + "nodeType": "VariableDeclaration", + "scope": 3644, + "src": "18506:10:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 3479, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "18506:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "id": 3491, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "id": 3486, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3454, + "src": "18555:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3487, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3469, + "src": "18563:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3485, + "name": "_unsafeReadBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3665, + "src": "18532:22:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (bytes memory,uint256) pure returns (bytes32)" + } + }, + "id": 3488, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18532:33:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3484, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "18525:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 3483, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "18525:6:14", + "typeDescriptions": {} + } + }, + "id": 3489, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18525:41:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 3482, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "18519:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": { + "id": 3481, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "18519:5:14", + "typeDescriptions": {} + } + }, + "id": 3490, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18519:48:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "18506:61:14" + }, + { + "condition": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3500, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3497, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3492, + "name": "SPECIAL_CHARS_LOOKUP", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2200, + "src": "18587:20:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3495, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 3493, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18611:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "id": 3494, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "18616:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "src": "18611:9:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 3496, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "18610:11:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "18587:34:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 3498, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "18586:36:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "hexValue": "30", + "id": 3499, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18626:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "18586:41:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "id": 3501, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "18585:43:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 3642, + "nodeType": "Block", + "src": "19972:94:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3633, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "20014:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3635, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "20022:14:14", + "subExpression": { + "id": 3634, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "20022:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [ + { + "id": 3638, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "20045:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + ], + "id": 3637, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "20038:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 3636, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "20038:6:14", + "typeDescriptions": {} + } + }, + "id": 3639, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "20038:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 3632, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19990:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3640, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19990:61:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3641, + "nodeType": "ExpressionStatement", + "src": "19990:61:14" + } + ] + }, + "id": 3643, + "nodeType": "IfStatement", + "src": "18581:1485:14", + "trueBody": { + "id": 3631, + "nodeType": "Block", + "src": "18630:1336:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3503, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "18672:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3505, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "18680:14:14", + "subExpression": { + "id": 3504, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "18680:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "5c", + "id": 3506, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18696:4:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_731553fa98541ade8b78284229adfe09a819380dee9244baac20dd1e0aa24095", + "typeString": "literal_string \"\\\"" + }, + "value": "\\" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_731553fa98541ade8b78284229adfe09a819380dee9244baac20dd1e0aa24095", + "typeString": "literal_string \"\\\"" + } + ], + "id": 3502, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "18648:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3507, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18648:53:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3508, + "nodeType": "ExpressionStatement", + "src": "18648:53:14" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3511, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3509, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "18723:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30783038", + "id": 3510, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18731:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "0x08" + }, + "src": "18723:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3521, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3519, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "18816:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30783039", + "id": 3520, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18824:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_9_by_1", + "typeString": "int_const 9" + }, + "value": "0x09" + }, + "src": "18816:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3531, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3529, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "18909:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30783061", + "id": 3530, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18917:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "0x0a" + }, + "src": "18909:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3541, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3539, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "19002:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30783063", + "id": 3540, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19010:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_12_by_1", + "typeString": "int_const 12" + }, + "value": "0x0c" + }, + "src": "19002:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3551, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3549, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "19095:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30783064", + "id": 3550, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19103:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_13_by_1", + "typeString": "int_const 13" + }, + "value": "0x0d" + }, + "src": "19095:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3561, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3559, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "19188:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30783563", + "id": 3560, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19196:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_92_by_1", + "typeString": "int_const 92" + }, + "value": "0x5c" + }, + "src": "19188:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3571, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3569, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "19282:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30783232", + "id": 3570, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19290:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_34_by_1", + "typeString": "int_const 34" + }, + "value": "0x22" + }, + "src": "19282:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 3623, + "nodeType": "Block", + "src": "19451:501:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3581, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "19571:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3583, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "19579:14:14", + "subExpression": { + "id": 3582, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "19579:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "75", + "id": 3584, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19595:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_32cefdcd8e794145c9af8dd1f4b1fbd92d6e547ae855553080fc8bd19c4883a0", + "typeString": "literal_string \"u\"" + }, + "value": "u" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_32cefdcd8e794145c9af8dd1f4b1fbd92d6e547ae855553080fc8bd19c4883a0", + "typeString": "literal_string \"u\"" + } + ], + "id": 3580, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19547:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3585, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19547:52:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3586, + "nodeType": "ExpressionStatement", + "src": "19547:52:14" + }, + { + "expression": { + "arguments": [ + { + "id": 3588, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "19645:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3590, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "19653:14:14", + "subExpression": { + "id": 3589, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "19653:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "30", + "id": 3591, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19669:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", + "typeString": "literal_string \"0\"" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", + "typeString": "literal_string \"0\"" + } + ], + "id": 3587, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19621:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3592, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19621:52:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3593, + "nodeType": "ExpressionStatement", + "src": "19621:52:14" + }, + { + "expression": { + "arguments": [ + { + "id": 3595, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "19719:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3597, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "19727:14:14", + "subExpression": { + "id": 3596, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "19727:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "30", + "id": 3598, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19743:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", + "typeString": "literal_string \"0\"" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", + "typeString": "literal_string \"0\"" + } + ], + "id": 3594, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19695:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3599, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19695:52:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3600, + "nodeType": "ExpressionStatement", + "src": "19695:52:14" + }, + { + "expression": { + "arguments": [ + { + "id": 3602, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "19793:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3604, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "19801:14:14", + "subExpression": { + "id": 3603, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "19801:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "baseExpression": { + "id": 3605, + "name": "HEX_DIGITS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2184, + "src": "19817:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "id": 3609, + "indexExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3608, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3606, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "19828:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "34", + "id": 3607, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19836:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "19828:9:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "19817:21:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 3601, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19769:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3610, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19769:70:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3611, + "nodeType": "ExpressionStatement", + "src": "19769:70:14" + }, + { + "expression": { + "arguments": [ + { + "id": 3613, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "19885:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3615, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "19893:14:14", + "subExpression": { + "id": 3614, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "19893:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "baseExpression": { + "id": 3616, + "name": "HEX_DIGITS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2184, + "src": "19909:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "id": 3620, + "indexExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3619, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3617, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "19920:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30783066", + "id": 3618, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19927:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_15_by_1", + "typeString": "int_const 15" + }, + "value": "0x0f" + }, + "src": "19920:11:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "19909:23:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 3612, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19861:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3621, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19861:72:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3622, + "nodeType": "ExpressionStatement", + "src": "19861:72:14" + } + ] + }, + "id": 3624, + "nodeType": "IfStatement", + "src": "19278:674:14", + "trueBody": { + "id": 3579, + "nodeType": "Block", + "src": "19296:149:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3573, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "19398:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3575, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "19406:14:14", + "subExpression": { + "id": 3574, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "19406:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "22", + "id": 3576, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19422:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_6e9f33448a4153023cdaf3eb759f1afdc24aba433a3e18b683f8c04a6eaa69f0", + "typeString": "literal_string \"\"\"" + }, + "value": "\"" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_6e9f33448a4153023cdaf3eb759f1afdc24aba433a3e18b683f8c04a6eaa69f0", + "typeString": "literal_string \"\"\"" + } + ], + "id": 3572, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19374:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3577, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19374:52:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3578, + "nodeType": "ExpressionStatement", + "src": "19374:52:14" + } + ] + } + }, + "id": 3625, + "nodeType": "IfStatement", + "src": "19184:768:14", + "trueBody": { + "expression": { + "arguments": [ + { + "id": 3563, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "19226:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3565, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "19234:14:14", + "subExpression": { + "id": 3564, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "19234:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "5c", + "id": 3566, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19250:4:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_731553fa98541ade8b78284229adfe09a819380dee9244baac20dd1e0aa24095", + "typeString": "literal_string \"\\\"" + }, + "value": "\\" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_731553fa98541ade8b78284229adfe09a819380dee9244baac20dd1e0aa24095", + "typeString": "literal_string \"\\\"" + } + ], + "id": 3562, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19202:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3567, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19202:53:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3568, + "nodeType": "ExpressionStatement", + "src": "19202:53:14" + } + }, + "id": 3626, + "nodeType": "IfStatement", + "src": "19091:861:14", + "trueBody": { + "expression": { + "arguments": [ + { + "id": 3553, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "19133:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3555, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "19141:14:14", + "subExpression": { + "id": 3554, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "19141:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "72", + "id": 3556, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19157:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_414f72a4d550cad29f17d9d99a4af64b3776ec5538cd440cef0f03fef2e9e010", + "typeString": "literal_string \"r\"" + }, + "value": "r" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_414f72a4d550cad29f17d9d99a4af64b3776ec5538cd440cef0f03fef2e9e010", + "typeString": "literal_string \"r\"" + } + ], + "id": 3552, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19109:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3557, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19109:52:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3558, + "nodeType": "ExpressionStatement", + "src": "19109:52:14" + } + }, + "id": 3627, + "nodeType": "IfStatement", + "src": "18998:954:14", + "trueBody": { + "expression": { + "arguments": [ + { + "id": 3543, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "19040:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3545, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "19048:14:14", + "subExpression": { + "id": 3544, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "19048:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "66", + "id": 3546, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19064:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_d1e8aeb79500496ef3dc2e57ba746a8315d048b7a664a2bf948db4fa91960483", + "typeString": "literal_string \"f\"" + }, + "value": "f" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_d1e8aeb79500496ef3dc2e57ba746a8315d048b7a664a2bf948db4fa91960483", + "typeString": "literal_string \"f\"" + } + ], + "id": 3542, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19016:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3547, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19016:52:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3548, + "nodeType": "ExpressionStatement", + "src": "19016:52:14" + } + }, + "id": 3628, + "nodeType": "IfStatement", + "src": "18905:1047:14", + "trueBody": { + "expression": { + "arguments": [ + { + "id": 3533, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "18947:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3535, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "18955:14:14", + "subExpression": { + "id": 3534, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "18955:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "6e", + "id": 3536, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18971:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_4b4ecedb4964a40fe416b16c7bd8b46092040ec42ef0aa69e59f09872f105cf3", + "typeString": "literal_string \"n\"" + }, + "value": "n" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_4b4ecedb4964a40fe416b16c7bd8b46092040ec42ef0aa69e59f09872f105cf3", + "typeString": "literal_string \"n\"" + } + ], + "id": 3532, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "18923:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3537, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18923:52:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3538, + "nodeType": "ExpressionStatement", + "src": "18923:52:14" + } + }, + "id": 3629, + "nodeType": "IfStatement", + "src": "18812:1140:14", + "trueBody": { + "expression": { + "arguments": [ + { + "id": 3523, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "18854:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3525, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "18862:14:14", + "subExpression": { + "id": 3524, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "18862:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "74", + "id": 3526, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18878:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_cac1bb71f0a97c8ac94ca9546b43178a9ad254c7b757ac07433aa6df35cd8089", + "typeString": "literal_string \"t\"" + }, + "value": "t" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_cac1bb71f0a97c8ac94ca9546b43178a9ad254c7b757ac07433aa6df35cd8089", + "typeString": "literal_string \"t\"" + } + ], + "id": 3522, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "18830:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3527, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18830:52:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3528, + "nodeType": "ExpressionStatement", + "src": "18830:52:14" + } + }, + "id": 3630, + "nodeType": "IfStatement", + "src": "18719:1233:14", + "trueBody": { + "expression": { + "arguments": [ + { + "id": 3513, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "18761:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3515, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "18769:14:14", + "subExpression": { + "id": 3514, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "18769:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "62", + "id": 3516, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18785:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_b5553de315e0edf504d9150af82dafa5c4667fa618ed0a6f19c69b41166c5510", + "typeString": "literal_string \"b\"" + }, + "value": "b" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_b5553de315e0edf504d9150af82dafa5c4667fa618ed0a6f19c69b41166c5510", + "typeString": "literal_string \"b\"" + } + ], + "id": 3512, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "18737:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3517, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18737:52:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3518, + "nodeType": "ExpressionStatement", + "src": "18737:52:14" + } + } + ] + } + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3475, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3472, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3469, + "src": "18468:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "expression": { + "id": 3473, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3454, + "src": "18472:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 3474, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "18479:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "18472:13:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "18468:17:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3645, + "initializationExpression": { + "assignments": [ + 3469 + ], + "declarations": [ + { + "constant": false, + "id": 3469, + "mutability": "mutable", + "name": "i", + "nameLocation": "18461:1:14", + "nodeType": "VariableDeclaration", + "scope": 3645, + "src": "18453:9:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3468, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "18453:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3471, + "initialValue": { + "hexValue": "30", + "id": 3470, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18465:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "18453:13:14" + }, + "isSimpleCounterLoop": true, + "loopExpression": { + "expression": { + "id": 3477, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": true, + "src": "18487:3:14", + "subExpression": { + "id": 3476, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3469, + "src": "18489:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 3478, + "nodeType": "ExpressionStatement", + "src": "18487:3:14" + }, + "nodeType": "ForStatement", + "src": "18448:1628:14" + }, + { + "AST": { + "nativeSrc": "20164:115:14", + "nodeType": "YulBlock", + "src": "20164:115:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "output", + "nativeSrc": "20185:6:14", + "nodeType": "YulIdentifier", + "src": "20185:6:14" + }, + { + "name": "outputLength", + "nativeSrc": "20193:12:14", + "nodeType": "YulIdentifier", + "src": "20193:12:14" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "20178:6:14", + "nodeType": "YulIdentifier", + "src": "20178:6:14" + }, + "nativeSrc": "20178:28:14", + "nodeType": "YulFunctionCall", + "src": "20178:28:14" + }, + "nativeSrc": "20178:28:14", + "nodeType": "YulExpressionStatement", + "src": "20178:28:14" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "20226:4:14", + "nodeType": "YulLiteral", + "src": "20226:4:14", + "type": "", + "value": "0x40" + }, + { + "arguments": [ + { + "name": "output", + "nativeSrc": "20236:6:14", + "nodeType": "YulIdentifier", + "src": "20236:6:14" + }, + { + "arguments": [ + { + "name": "outputLength", + "nativeSrc": "20248:12:14", + "nodeType": "YulIdentifier", + "src": "20248:12:14" + }, + { + "kind": "number", + "nativeSrc": "20262:4:14", + "nodeType": "YulLiteral", + "src": "20262:4:14", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "20244:3:14", + "nodeType": "YulIdentifier", + "src": "20244:3:14" + }, + "nativeSrc": "20244:23:14", + "nodeType": "YulFunctionCall", + "src": "20244:23:14" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "20232:3:14", + "nodeType": "YulIdentifier", + "src": "20232:3:14" + }, + "nativeSrc": "20232:36:14", + "nodeType": "YulFunctionCall", + "src": "20232:36:14" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "20219:6:14", + "nodeType": "YulIdentifier", + "src": "20219:6:14" + }, + "nativeSrc": "20219:50:14", + "nodeType": "YulFunctionCall", + "src": "20219:50:14" + }, + "nativeSrc": "20219:50:14", + "nodeType": "YulExpressionStatement", + "src": "20219:50:14" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 3461, + "isOffset": false, + "isSlot": false, + "src": "20185:6:14", + "valueSize": 1 + }, + { + "declaration": 3461, + "isOffset": false, + "isSlot": false, + "src": "20236:6:14", + "valueSize": 1 + }, + { + "declaration": 3465, + "isOffset": false, + "isSlot": false, + "src": "20193:12:14", + "valueSize": 1 + }, + { + "declaration": 3465, + "isOffset": false, + "isSlot": false, + "src": "20248:12:14", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 3646, + "nodeType": "InlineAssembly", + "src": "20139:140:14" + }, + { + "expression": { + "arguments": [ + { + "id": 3649, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "20303:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 3648, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "20296:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_string_storage_ptr_$", + "typeString": "type(string storage pointer)" + }, + "typeName": { + "id": 3647, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "20296:6:14", + "typeDescriptions": {} + } + }, + "id": 3650, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "20296:14:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 3452, + "id": 3651, + "nodeType": "Return", + "src": "20289:21:14" + } + ] + }, + "documentation": { + "id": 3446, + "nodeType": "StructuredDocumentation", + "src": "17183:717:14", + "text": " @dev Escape special characters in JSON strings. This can be useful to prevent JSON injection in NFT metadata.\n WARNING: This function should only be used in double quoted JSON strings. Single quotes are not escaped.\n NOTE: This function escapes backslashes (including those in \\uXXXX sequences) and the characters in ranges\n defined in section 2.5 of RFC-4627 (U+0000 to U+001F, U+0022 and U+005C). All control characters in U+0000\n to U+001F are escaped (\\b, \\t, \\n, \\f, \\r use short form; others use \\u00XX). ECMAScript's `JSON.parse` does\n recover escaped unicode characters that are not in this range, but other tooling may provide different results." + }, + "id": 3653, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "escapeJSON", + "nameLocation": "17914:10:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3449, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3448, + "mutability": "mutable", + "name": "input", + "nameLocation": "17939:5:14", + "nodeType": "VariableDeclaration", + "scope": 3653, + "src": "17925:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3447, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "17925:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "17924:21:14" + }, + "returnParameters": { + "id": 3452, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3451, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3653, + "src": "17969:13:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3450, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "17969:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "17968:15:14" + }, + "scope": 3678, + "src": "17905:2412:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3664, + "nodeType": "Block", + "src": "20702:225:14", + "statements": [ + { + "AST": { + "nativeSrc": "20851:70:14", + "nodeType": "YulBlock", + "src": "20851:70:14", + "statements": [ + { + "nativeSrc": "20865:46:14", + "nodeType": "YulAssignment", + "src": "20865:46:14", + "value": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "20888:6:14", + "nodeType": "YulIdentifier", + "src": "20888:6:14" + }, + { + "kind": "number", + "nativeSrc": "20896:4:14", + "nodeType": "YulLiteral", + "src": "20896:4:14", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "20884:3:14", + "nodeType": "YulIdentifier", + "src": "20884:3:14" + }, + "nativeSrc": "20884:17:14", + "nodeType": "YulFunctionCall", + "src": "20884:17:14" + }, + { + "name": "offset", + "nativeSrc": "20903:6:14", + "nodeType": "YulIdentifier", + "src": "20903:6:14" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "20880:3:14", + "nodeType": "YulIdentifier", + "src": "20880:3:14" + }, + "nativeSrc": "20880:30:14", + "nodeType": "YulFunctionCall", + "src": "20880:30:14" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "20874:5:14", + "nodeType": "YulIdentifier", + "src": "20874:5:14" + }, + "nativeSrc": "20874:37:14", + "nodeType": "YulFunctionCall", + "src": "20874:37:14" + }, + "variableNames": [ + { + "name": "value", + "nativeSrc": "20865:5:14", + "nodeType": "YulIdentifier", + "src": "20865:5:14" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 3656, + "isOffset": false, + "isSlot": false, + "src": "20888:6:14", + "valueSize": 1 + }, + { + "declaration": 3658, + "isOffset": false, + "isSlot": false, + "src": "20903:6:14", + "valueSize": 1 + }, + { + "declaration": 3661, + "isOffset": false, + "isSlot": false, + "src": "20865:5:14", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 3663, + "nodeType": "InlineAssembly", + "src": "20826:95:14" + } + ] + }, + "documentation": { + "id": 3654, + "nodeType": "StructuredDocumentation", + "src": "20323:268:14", + "text": " @dev Reads a bytes32 from a bytes array without bounds checking.\n NOTE: making this function internal would mean it could be used with memory unsafe offset, and marking the\n assembly block as such would prevent some optimizations." + }, + "id": 3665, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_unsafeReadBytesOffset", + "nameLocation": "20605:22:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3659, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3656, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "20641:6:14", + "nodeType": "VariableDeclaration", + "scope": 3665, + "src": "20628:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 3655, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "20628:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3658, + "mutability": "mutable", + "name": "offset", + "nameLocation": "20657:6:14", + "nodeType": "VariableDeclaration", + "scope": 3665, + "src": "20649:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3657, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "20649:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "20627:37:14" + }, + "returnParameters": { + "id": 3662, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3661, + "mutability": "mutable", + "name": "value", + "nameLocation": "20695:5:14", + "nodeType": "VariableDeclaration", + "scope": 3665, + "src": "20687:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3660, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "20687:7:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "20686:15:14" + }, + "scope": 3678, + "src": "20596:331:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 3676, + "nodeType": "Block", + "src": "21300:235:14", + "statements": [ + { + "AST": { + "nativeSrc": "21449:80:14", + "nodeType": "YulBlock", + "src": "21449:80:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "21479:6:14", + "nodeType": "YulIdentifier", + "src": "21479:6:14" + }, + { + "kind": "number", + "nativeSrc": "21487:4:14", + "nodeType": "YulLiteral", + "src": "21487:4:14", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "21475:3:14", + "nodeType": "YulIdentifier", + "src": "21475:3:14" + }, + "nativeSrc": "21475:17:14", + "nodeType": "YulFunctionCall", + "src": "21475:17:14" + }, + { + "name": "offset", + "nativeSrc": "21494:6:14", + "nodeType": "YulIdentifier", + "src": "21494:6:14" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "21471:3:14", + "nodeType": "YulIdentifier", + "src": "21471:3:14" + }, + "nativeSrc": "21471:30:14", + "nodeType": "YulFunctionCall", + "src": "21471:30:14" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "21507:3:14", + "nodeType": "YulLiteral", + "src": "21507:3:14", + "type": "", + "value": "248" + }, + { + "name": "value", + "nativeSrc": "21512:5:14", + "nodeType": "YulIdentifier", + "src": "21512:5:14" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "21503:3:14", + "nodeType": "YulIdentifier", + "src": "21503:3:14" + }, + "nativeSrc": "21503:15:14", + "nodeType": "YulFunctionCall", + "src": "21503:15:14" + } + ], + "functionName": { + "name": "mstore8", + "nativeSrc": "21463:7:14", + "nodeType": "YulIdentifier", + "src": "21463:7:14" + }, + "nativeSrc": "21463:56:14", + "nodeType": "YulFunctionCall", + "src": "21463:56:14" + }, + "nativeSrc": "21463:56:14", + "nodeType": "YulExpressionStatement", + "src": "21463:56:14" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 3668, + "isOffset": false, + "isSlot": false, + "src": "21479:6:14", + "valueSize": 1 + }, + { + "declaration": 3670, + "isOffset": false, + "isSlot": false, + "src": "21494:6:14", + "valueSize": 1 + }, + { + "declaration": 3672, + "isOffset": false, + "isSlot": false, + "src": "21512:5:14", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 3675, + "nodeType": "InlineAssembly", + "src": "21424:105:14" + } + ] + }, + "documentation": { + "id": 3666, + "nodeType": "StructuredDocumentation", + "src": "20933:265:14", + "text": " @dev Write a bytes1 to a bytes array without bounds checking.\n NOTE: making this function internal would mean it could be used with memory unsafe offset, and marking the\n assembly block as such would prevent some optimizations." + }, + "id": 3677, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_unsafeWriteBytesOffset", + "nameLocation": "21212:23:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3673, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3668, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "21249:6:14", + "nodeType": "VariableDeclaration", + "scope": 3677, + "src": "21236:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 3667, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "21236:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3670, + "mutability": "mutable", + "name": "offset", + "nameLocation": "21265:6:14", + "nodeType": "VariableDeclaration", + "scope": 3677, + "src": "21257:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3669, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "21257:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3672, + "mutability": "mutable", + "name": "value", + "nameLocation": "21280:5:14", + "nodeType": "VariableDeclaration", + "scope": 3677, + "src": "21273:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 3671, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "21273:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + } + ], + "src": "21235:51:14" + }, + "returnParameters": { + "id": 3674, + "nodeType": "ParameterList", + "parameters": [], + "src": "21300:0:14" + }, + "scope": 3678, + "src": "21203:332:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "private" + } + ], + "scope": 3679, + "src": "332:21205:14", + "usedErrors": [ + 2207, + 2210, + 2213 + ], + "usedEvents": [] + } + ], + "src": "101:21437:14" + }, + "id": 14 + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/cryptography/ECDSA.sol", + "exportedSymbols": { + "ECDSA": [ + 4137 + ] + }, + "id": 4138, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 3680, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "112:24:15" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "ECDSA", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 3681, + "nodeType": "StructuredDocumentation", + "src": "138:205:15", + "text": " @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n These functions can be used to verify that a message was signed by the holder\n of the private keys of a given address." + }, + "fullyImplemented": true, + "id": 4137, + "linearizedBaseContracts": [ + 4137 + ], + "name": "ECDSA", + "nameLocation": "352:5:15", + "nodeType": "ContractDefinition", + "nodes": [ + { + "canonicalName": "ECDSA.RecoverError", + "id": 3686, + "members": [ + { + "id": 3682, + "name": "NoError", + "nameLocation": "392:7:15", + "nodeType": "EnumValue", + "src": "392:7:15" + }, + { + "id": 3683, + "name": "InvalidSignature", + "nameLocation": "409:16:15", + "nodeType": "EnumValue", + "src": "409:16:15" + }, + { + "id": 3684, + "name": "InvalidSignatureLength", + "nameLocation": "435:22:15", + "nodeType": "EnumValue", + "src": "435:22:15" + }, + { + "id": 3685, + "name": "InvalidSignatureS", + "nameLocation": "467:17:15", + "nodeType": "EnumValue", + "src": "467:17:15" + } + ], + "name": "RecoverError", + "nameLocation": "369:12:15", + "nodeType": "EnumDefinition", + "src": "364:126:15" + }, + { + "documentation": { + "id": 3687, + "nodeType": "StructuredDocumentation", + "src": "496:49:15", + "text": " @dev The signature is invalid." + }, + "errorSelector": "f645eedf", + "id": 3689, + "name": "ECDSAInvalidSignature", + "nameLocation": "556:21:15", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 3688, + "nodeType": "ParameterList", + "parameters": [], + "src": "577:2:15" + }, + "src": "550:30:15" + }, + { + "documentation": { + "id": 3690, + "nodeType": "StructuredDocumentation", + "src": "586:60:15", + "text": " @dev The signature has an invalid length." + }, + "errorSelector": "fce698f7", + "id": 3694, + "name": "ECDSAInvalidSignatureLength", + "nameLocation": "657:27:15", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 3693, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3692, + "mutability": "mutable", + "name": "length", + "nameLocation": "693:6:15", + "nodeType": "VariableDeclaration", + "scope": 3694, + "src": "685:14:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3691, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "685:7:15", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "684:16:15" + }, + "src": "651:50:15" + }, + { + "documentation": { + "id": 3695, + "nodeType": "StructuredDocumentation", + "src": "707:85:15", + "text": " @dev The signature has an S value that is in the upper half order." + }, + "errorSelector": "d78bce0c", + "id": 3699, + "name": "ECDSAInvalidSignatureS", + "nameLocation": "803:22:15", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 3698, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3697, + "mutability": "mutable", + "name": "s", + "nameLocation": "834:1:15", + "nodeType": "VariableDeclaration", + "scope": 3699, + "src": "826:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3696, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "826:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "825:11:15" + }, + "src": "797:40:15" + }, + { + "body": { + "id": 3751, + "nodeType": "Block", + "src": "2575:622:15", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3717, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 3714, + "name": "signature", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3704, + "src": "2589:9:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 3715, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2599:6:15", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "2589:16:15", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "3635", + "id": 3716, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2609:2:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_65_by_1", + "typeString": "int_const 65" + }, + "value": "65" + }, + "src": "2589:22:15", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 3749, + "nodeType": "Block", + "src": "3083:108:15", + "statements": [ + { + "expression": { + "components": [ + { + "arguments": [ + { + "hexValue": "30", + "id": 3738, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3113:1:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 3737, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3105:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3736, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3105:7:15", + "typeDescriptions": {} + } + }, + "id": 3739, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3105:10:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 3740, + "name": "RecoverError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3686, + "src": "3117:12:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_RecoverError_$3686_$", + "typeString": "type(enum ECDSA.RecoverError)" + } + }, + "id": 3741, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "3130:22:15", + "memberName": "InvalidSignatureLength", + "nodeType": "MemberAccess", + "referencedDeclaration": 3684, + "src": "3117:35:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + { + "arguments": [ + { + "expression": { + "id": 3744, + "name": "signature", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3704, + "src": "3162:9:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 3745, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3172:6:15", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "3162:16:15", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3743, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3154:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes32_$", + "typeString": "type(bytes32)" + }, + "typeName": { + "id": 3742, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3154:7:15", + "typeDescriptions": {} + } + }, + "id": 3746, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3154:25:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 3747, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "3104:76:15", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "functionReturnParameters": 3713, + "id": 3748, + "nodeType": "Return", + "src": "3097:83:15" + } + ] + }, + "id": 3750, + "nodeType": "IfStatement", + "src": "2585:606:15", + "trueBody": { + "id": 3735, + "nodeType": "Block", + "src": "2613:464:15", + "statements": [ + { + "assignments": [ + 3719 + ], + "declarations": [ + { + "constant": false, + "id": 3719, + "mutability": "mutable", + "name": "r", + "nameLocation": "2635:1:15", + "nodeType": "VariableDeclaration", + "scope": 3735, + "src": "2627:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3718, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2627:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 3720, + "nodeType": "VariableDeclarationStatement", + "src": "2627:9:15" + }, + { + "assignments": [ + 3722 + ], + "declarations": [ + { + "constant": false, + "id": 3722, + "mutability": "mutable", + "name": "s", + "nameLocation": "2658:1:15", + "nodeType": "VariableDeclaration", + "scope": 3735, + "src": "2650:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3721, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2650:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 3723, + "nodeType": "VariableDeclarationStatement", + "src": "2650:9:15" + }, + { + "assignments": [ + 3725 + ], + "declarations": [ + { + "constant": false, + "id": 3725, + "mutability": "mutable", + "name": "v", + "nameLocation": "2679:1:15", + "nodeType": "VariableDeclaration", + "scope": 3735, + "src": "2673:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 3724, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "2673:5:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "id": 3726, + "nodeType": "VariableDeclarationStatement", + "src": "2673:7:15" + }, + { + "AST": { + "nativeSrc": "2850:171:15", + "nodeType": "YulBlock", + "src": "2850:171:15", + "statements": [ + { + "nativeSrc": "2868:32:15", + "nodeType": "YulAssignment", + "src": "2868:32:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "signature", + "nativeSrc": "2883:9:15", + "nodeType": "YulIdentifier", + "src": "2883:9:15" + }, + { + "kind": "number", + "nativeSrc": "2894:4:15", + "nodeType": "YulLiteral", + "src": "2894:4:15", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2879:3:15", + "nodeType": "YulIdentifier", + "src": "2879:3:15" + }, + "nativeSrc": "2879:20:15", + "nodeType": "YulFunctionCall", + "src": "2879:20:15" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "2873:5:15", + "nodeType": "YulIdentifier", + "src": "2873:5:15" + }, + "nativeSrc": "2873:27:15", + "nodeType": "YulFunctionCall", + "src": "2873:27:15" + }, + "variableNames": [ + { + "name": "r", + "nativeSrc": "2868:1:15", + "nodeType": "YulIdentifier", + "src": "2868:1:15" + } + ] + }, + { + "nativeSrc": "2917:32:15", + "nodeType": "YulAssignment", + "src": "2917:32:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "signature", + "nativeSrc": "2932:9:15", + "nodeType": "YulIdentifier", + "src": "2932:9:15" + }, + { + "kind": "number", + "nativeSrc": "2943:4:15", + "nodeType": "YulLiteral", + "src": "2943:4:15", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2928:3:15", + "nodeType": "YulIdentifier", + "src": "2928:3:15" + }, + "nativeSrc": "2928:20:15", + "nodeType": "YulFunctionCall", + "src": "2928:20:15" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "2922:5:15", + "nodeType": "YulIdentifier", + "src": "2922:5:15" + }, + "nativeSrc": "2922:27:15", + "nodeType": "YulFunctionCall", + "src": "2922:27:15" + }, + "variableNames": [ + { + "name": "s", + "nativeSrc": "2917:1:15", + "nodeType": "YulIdentifier", + "src": "2917:1:15" + } + ] + }, + { + "nativeSrc": "2966:41:15", + "nodeType": "YulAssignment", + "src": "2966:41:15", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2976:1:15", + "nodeType": "YulLiteral", + "src": "2976:1:15", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "signature", + "nativeSrc": "2989:9:15", + "nodeType": "YulIdentifier", + "src": "2989:9:15" + }, + { + "kind": "number", + "nativeSrc": "3000:4:15", + "nodeType": "YulLiteral", + "src": "3000:4:15", + "type": "", + "value": "0x60" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2985:3:15", + "nodeType": "YulIdentifier", + "src": "2985:3:15" + }, + "nativeSrc": "2985:20:15", + "nodeType": "YulFunctionCall", + "src": "2985:20:15" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "2979:5:15", + "nodeType": "YulIdentifier", + "src": "2979:5:15" + }, + "nativeSrc": "2979:27:15", + "nodeType": "YulFunctionCall", + "src": "2979:27:15" + } + ], + "functionName": { + "name": "byte", + "nativeSrc": "2971:4:15", + "nodeType": "YulIdentifier", + "src": "2971:4:15" + }, + "nativeSrc": "2971:36:15", + "nodeType": "YulFunctionCall", + "src": "2971:36:15" + }, + "variableNames": [ + { + "name": "v", + "nativeSrc": "2966:1:15", + "nodeType": "YulIdentifier", + "src": "2966:1:15" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 3719, + "isOffset": false, + "isSlot": false, + "src": "2868:1:15", + "valueSize": 1 + }, + { + "declaration": 3722, + "isOffset": false, + "isSlot": false, + "src": "2917:1:15", + "valueSize": 1 + }, + { + "declaration": 3704, + "isOffset": false, + "isSlot": false, + "src": "2883:9:15", + "valueSize": 1 + }, + { + "declaration": 3704, + "isOffset": false, + "isSlot": false, + "src": "2932:9:15", + "valueSize": 1 + }, + { + "declaration": 3704, + "isOffset": false, + "isSlot": false, + "src": "2989:9:15", + "valueSize": 1 + }, + { + "declaration": 3725, + "isOffset": false, + "isSlot": false, + "src": "2966:1:15", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 3727, + "nodeType": "InlineAssembly", + "src": "2825:196:15" + }, + { + "expression": { + "arguments": [ + { + "id": 3729, + "name": "hash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3702, + "src": "3052:4:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3730, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3725, + "src": "3058:1:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + { + "id": 3731, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3719, + "src": "3061:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3732, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3722, + "src": "3064:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3728, + "name": "tryRecover", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3752, + 3915, + 4023 + ], + "referencedDeclaration": 4023, + "src": "3041:10:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_uint8_$_t_bytes32_$_t_bytes32_$returns$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "function (bytes32,uint8,bytes32,bytes32) pure returns (address,enum ECDSA.RecoverError,bytes32)" + } + }, + "id": 3733, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3041:25:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "functionReturnParameters": 3713, + "id": 3734, + "nodeType": "Return", + "src": "3034:32:15" + } + ] + } + } + ] + }, + "documentation": { + "id": 3700, + "nodeType": "StructuredDocumentation", + "src": "843:1571:15", + "text": " @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not\n return address(0) without also returning an error description. Errors are documented using an enum (error type)\n and a bytes32 providing additional information about the error.\n If no error is returned, then the address can be used for verification purposes.\n The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:\n this function rejects them by requiring the `s` value to be in the lower\n half order, and the `v` value to be either 27 or 28.\n NOTE: This function only supports 65-byte signatures. ERC-2098 short signatures are rejected. This restriction\n is DEPRECATED and will be removed in v6.0. Developers SHOULD NOT use signatures as unique identifiers; use hash\n invalidation or nonces for replay protection.\n IMPORTANT: `hash` _must_ be the result of a hash operation for the\n verification to be secure: it is possible to craft signatures that\n recover to arbitrary addresses for non-hashed data. A safe way to ensure\n this is by receiving a hash of the original message (which may otherwise\n be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.\n Documentation for signature generation:\n - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]" + }, + "id": 3752, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryRecover", + "nameLocation": "2428:10:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3705, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3702, + "mutability": "mutable", + "name": "hash", + "nameLocation": "2456:4:15", + "nodeType": "VariableDeclaration", + "scope": 3752, + "src": "2448:12:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3701, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2448:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3704, + "mutability": "mutable", + "name": "signature", + "nameLocation": "2483:9:15", + "nodeType": "VariableDeclaration", + "scope": 3752, + "src": "2470:22:15", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 3703, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2470:5:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "2438:60:15" + }, + "returnParameters": { + "id": 3713, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3707, + "mutability": "mutable", + "name": "recovered", + "nameLocation": "2530:9:15", + "nodeType": "VariableDeclaration", + "scope": 3752, + "src": "2522:17:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3706, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2522:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3710, + "mutability": "mutable", + "name": "err", + "nameLocation": "2554:3:15", + "nodeType": "VariableDeclaration", + "scope": 3752, + "src": "2541:16:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "typeName": { + "id": 3709, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 3708, + "name": "RecoverError", + "nameLocations": [ + "2541:12:15" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3686, + "src": "2541:12:15" + }, + "referencedDeclaration": 3686, + "src": "2541:12:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3712, + "mutability": "mutable", + "name": "errArg", + "nameLocation": "2567:6:15", + "nodeType": "VariableDeclaration", + "scope": 3752, + "src": "2559:14:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3711, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2559:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "2521:53:15" + }, + "scope": 4137, + "src": "2419:778:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3804, + "nodeType": "Block", + "src": "3456:716:15", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3770, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 3767, + "name": "signature", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3757, + "src": "3470:9:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + } + }, + "id": 3768, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3480:6:15", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "3470:16:15", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "3635", + "id": 3769, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3490:2:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_65_by_1", + "typeString": "int_const 65" + }, + "value": "65" + }, + "src": "3470:22:15", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 3802, + "nodeType": "Block", + "src": "4058:108:15", + "statements": [ + { + "expression": { + "components": [ + { + "arguments": [ + { + "hexValue": "30", + "id": 3791, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4088:1:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 3790, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4080:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3789, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "4080:7:15", + "typeDescriptions": {} + } + }, + "id": 3792, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4080:10:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 3793, + "name": "RecoverError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3686, + "src": "4092:12:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_RecoverError_$3686_$", + "typeString": "type(enum ECDSA.RecoverError)" + } + }, + "id": 3794, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "4105:22:15", + "memberName": "InvalidSignatureLength", + "nodeType": "MemberAccess", + "referencedDeclaration": 3684, + "src": "4092:35:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + { + "arguments": [ + { + "expression": { + "id": 3797, + "name": "signature", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3757, + "src": "4137:9:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + } + }, + "id": 3798, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4147:6:15", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "4137:16:15", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3796, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4129:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes32_$", + "typeString": "type(bytes32)" + }, + "typeName": { + "id": 3795, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "4129:7:15", + "typeDescriptions": {} + } + }, + "id": 3799, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4129:25:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 3800, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "4079:76:15", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "functionReturnParameters": 3766, + "id": 3801, + "nodeType": "Return", + "src": "4072:83:15" + } + ] + }, + "id": 3803, + "nodeType": "IfStatement", + "src": "3466:700:15", + "trueBody": { + "id": 3788, + "nodeType": "Block", + "src": "3494:558:15", + "statements": [ + { + "assignments": [ + 3772 + ], + "declarations": [ + { + "constant": false, + "id": 3772, + "mutability": "mutable", + "name": "r", + "nameLocation": "3516:1:15", + "nodeType": "VariableDeclaration", + "scope": 3788, + "src": "3508:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3771, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3508:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 3773, + "nodeType": "VariableDeclarationStatement", + "src": "3508:9:15" + }, + { + "assignments": [ + 3775 + ], + "declarations": [ + { + "constant": false, + "id": 3775, + "mutability": "mutable", + "name": "s", + "nameLocation": "3539:1:15", + "nodeType": "VariableDeclaration", + "scope": 3788, + "src": "3531:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3774, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3531:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 3776, + "nodeType": "VariableDeclarationStatement", + "src": "3531:9:15" + }, + { + "assignments": [ + 3778 + ], + "declarations": [ + { + "constant": false, + "id": 3778, + "mutability": "mutable", + "name": "v", + "nameLocation": "3560:1:15", + "nodeType": "VariableDeclaration", + "scope": 3788, + "src": "3554:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 3777, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "3554:5:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "id": 3779, + "nodeType": "VariableDeclarationStatement", + "src": "3554:7:15" + }, + { + "AST": { + "nativeSrc": "3794:202:15", + "nodeType": "YulBlock", + "src": "3794:202:15", + "statements": [ + { + "nativeSrc": "3812:35:15", + "nodeType": "YulAssignment", + "src": "3812:35:15", + "value": { + "arguments": [ + { + "name": "signature.offset", + "nativeSrc": "3830:16:15", + "nodeType": "YulIdentifier", + "src": "3830:16:15" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "3817:12:15", + "nodeType": "YulIdentifier", + "src": "3817:12:15" + }, + "nativeSrc": "3817:30:15", + "nodeType": "YulFunctionCall", + "src": "3817:30:15" + }, + "variableNames": [ + { + "name": "r", + "nativeSrc": "3812:1:15", + "nodeType": "YulIdentifier", + "src": "3812:1:15" + } + ] + }, + { + "nativeSrc": "3864:46:15", + "nodeType": "YulAssignment", + "src": "3864:46:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "signature.offset", + "nativeSrc": "3886:16:15", + "nodeType": "YulIdentifier", + "src": "3886:16:15" + }, + { + "kind": "number", + "nativeSrc": "3904:4:15", + "nodeType": "YulLiteral", + "src": "3904:4:15", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3882:3:15", + "nodeType": "YulIdentifier", + "src": "3882:3:15" + }, + "nativeSrc": "3882:27:15", + "nodeType": "YulFunctionCall", + "src": "3882:27:15" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "3869:12:15", + "nodeType": "YulIdentifier", + "src": "3869:12:15" + }, + "nativeSrc": "3869:41:15", + "nodeType": "YulFunctionCall", + "src": "3869:41:15" + }, + "variableNames": [ + { + "name": "s", + "nativeSrc": "3864:1:15", + "nodeType": "YulIdentifier", + "src": "3864:1:15" + } + ] + }, + { + "nativeSrc": "3927:55:15", + "nodeType": "YulAssignment", + "src": "3927:55:15", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3937:1:15", + "nodeType": "YulLiteral", + "src": "3937:1:15", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "signature.offset", + "nativeSrc": "3957:16:15", + "nodeType": "YulIdentifier", + "src": "3957:16:15" + }, + { + "kind": "number", + "nativeSrc": "3975:4:15", + "nodeType": "YulLiteral", + "src": "3975:4:15", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3953:3:15", + "nodeType": "YulIdentifier", + "src": "3953:3:15" + }, + "nativeSrc": "3953:27:15", + "nodeType": "YulFunctionCall", + "src": "3953:27:15" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "3940:12:15", + "nodeType": "YulIdentifier", + "src": "3940:12:15" + }, + "nativeSrc": "3940:41:15", + "nodeType": "YulFunctionCall", + "src": "3940:41:15" + } + ], + "functionName": { + "name": "byte", + "nativeSrc": "3932:4:15", + "nodeType": "YulIdentifier", + "src": "3932:4:15" + }, + "nativeSrc": "3932:50:15", + "nodeType": "YulFunctionCall", + "src": "3932:50:15" + }, + "variableNames": [ + { + "name": "v", + "nativeSrc": "3927:1:15", + "nodeType": "YulIdentifier", + "src": "3927:1:15" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 3772, + "isOffset": false, + "isSlot": false, + "src": "3812:1:15", + "valueSize": 1 + }, + { + "declaration": 3775, + "isOffset": false, + "isSlot": false, + "src": "3864:1:15", + "valueSize": 1 + }, + { + "declaration": 3757, + "isOffset": true, + "isSlot": false, + "src": "3830:16:15", + "suffix": "offset", + "valueSize": 1 + }, + { + "declaration": 3757, + "isOffset": true, + "isSlot": false, + "src": "3886:16:15", + "suffix": "offset", + "valueSize": 1 + }, + { + "declaration": 3757, + "isOffset": true, + "isSlot": false, + "src": "3957:16:15", + "suffix": "offset", + "valueSize": 1 + }, + { + "declaration": 3778, + "isOffset": false, + "isSlot": false, + "src": "3927:1:15", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 3780, + "nodeType": "InlineAssembly", + "src": "3769:227:15" + }, + { + "expression": { + "arguments": [ + { + "id": 3782, + "name": "hash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3755, + "src": "4027:4:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3783, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3778, + "src": "4033:1:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + { + "id": 3784, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3772, + "src": "4036:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3785, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3775, + "src": "4039:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3781, + "name": "tryRecover", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3752, + 3915, + 4023 + ], + "referencedDeclaration": 4023, + "src": "4016:10:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_uint8_$_t_bytes32_$_t_bytes32_$returns$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "function (bytes32,uint8,bytes32,bytes32) pure returns (address,enum ECDSA.RecoverError,bytes32)" + } + }, + "id": 3786, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4016:25:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "functionReturnParameters": 3766, + "id": 3787, + "nodeType": "Return", + "src": "4009:32:15" + } + ] + } + } + ] + }, + "documentation": { + "id": 3753, + "nodeType": "StructuredDocumentation", + "src": "3203:82:15", + "text": " @dev Variant of {tryRecover} that takes a signature in calldata" + }, + "id": 3805, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryRecoverCalldata", + "nameLocation": "3299:18:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3758, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3755, + "mutability": "mutable", + "name": "hash", + "nameLocation": "3335:4:15", + "nodeType": "VariableDeclaration", + "scope": 3805, + "src": "3327:12:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3754, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3327:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3757, + "mutability": "mutable", + "name": "signature", + "nameLocation": "3364:9:15", + "nodeType": "VariableDeclaration", + "scope": 3805, + "src": "3349:24:15", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 3756, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3349:5:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "3317:62:15" + }, + "returnParameters": { + "id": 3766, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3760, + "mutability": "mutable", + "name": "recovered", + "nameLocation": "3411:9:15", + "nodeType": "VariableDeclaration", + "scope": 3805, + "src": "3403:17:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3759, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3403:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3763, + "mutability": "mutable", + "name": "err", + "nameLocation": "3435:3:15", + "nodeType": "VariableDeclaration", + "scope": 3805, + "src": "3422:16:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "typeName": { + "id": 3762, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 3761, + "name": "RecoverError", + "nameLocations": [ + "3422:12:15" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3686, + "src": "3422:12:15" + }, + "referencedDeclaration": 3686, + "src": "3422:12:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3765, + "mutability": "mutable", + "name": "errArg", + "nameLocation": "3448:6:15", + "nodeType": "VariableDeclaration", + "scope": 3805, + "src": "3440:14:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3764, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3440:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "3402:53:15" + }, + "scope": 4137, + "src": "3290:882:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3834, + "nodeType": "Block", + "src": "5363:168:15", + "statements": [ + { + "assignments": [ + 3816, + 3819, + 3821 + ], + "declarations": [ + { + "constant": false, + "id": 3816, + "mutability": "mutable", + "name": "recovered", + "nameLocation": "5382:9:15", + "nodeType": "VariableDeclaration", + "scope": 3834, + "src": "5374:17:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3815, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5374:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3819, + "mutability": "mutable", + "name": "error", + "nameLocation": "5406:5:15", + "nodeType": "VariableDeclaration", + "scope": 3834, + "src": "5393:18:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "typeName": { + "id": 3818, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 3817, + "name": "RecoverError", + "nameLocations": [ + "5393:12:15" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3686, + "src": "5393:12:15" + }, + "referencedDeclaration": 3686, + "src": "5393:12:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3821, + "mutability": "mutable", + "name": "errorArg", + "nameLocation": "5421:8:15", + "nodeType": "VariableDeclaration", + "scope": 3834, + "src": "5413:16:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3820, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5413:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 3826, + "initialValue": { + "arguments": [ + { + "id": 3823, + "name": "hash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3808, + "src": "5444:4:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3824, + "name": "signature", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3810, + "src": "5450:9:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 3822, + "name": "tryRecover", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3752, + 3915, + 4023 + ], + "referencedDeclaration": 3752, + "src": "5433:10:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_bytes_memory_ptr_$returns$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "function (bytes32,bytes memory) pure returns (address,enum ECDSA.RecoverError,bytes32)" + } + }, + "id": 3825, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5433:27:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "5373:87:15" + }, + { + "expression": { + "arguments": [ + { + "id": 3828, + "name": "error", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3819, + "src": "5482:5:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + { + "id": 3829, + "name": "errorArg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3821, + "src": "5489:8:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3827, + "name": "_throwError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4136, + "src": "5470:11:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_RecoverError_$3686_$_t_bytes32_$returns$__$", + "typeString": "function (enum ECDSA.RecoverError,bytes32) pure" + } + }, + "id": 3830, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5470:28:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3831, + "nodeType": "ExpressionStatement", + "src": "5470:28:15" + }, + { + "expression": { + "id": 3832, + "name": "recovered", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3816, + "src": "5515:9:15", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 3814, + "id": 3833, + "nodeType": "Return", + "src": "5508:16:15" + } + ] + }, + "documentation": { + "id": 3806, + "nodeType": "StructuredDocumentation", + "src": "4178:1093:15", + "text": " @dev Returns the address that signed a hashed message (`hash`) with\n `signature`. This address can then be used for verification purposes.\n The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:\n this function rejects them by requiring the `s` value to be in the lower\n half order, and the `v` value to be either 27 or 28.\n NOTE: This function only supports 65-byte signatures. ERC-2098 short signatures are rejected. This restriction\n is DEPRECATED and will be removed in v6.0. Developers SHOULD NOT use signatures as unique identifiers; use hash\n invalidation or nonces for replay protection.\n IMPORTANT: `hash` _must_ be the result of a hash operation for the\n verification to be secure: it is possible to craft signatures that\n recover to arbitrary addresses for non-hashed data. A safe way to ensure\n this is by receiving a hash of the original message (which may otherwise\n be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it." + }, + "id": 3835, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "recover", + "nameLocation": "5285:7:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3811, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3808, + "mutability": "mutable", + "name": "hash", + "nameLocation": "5301:4:15", + "nodeType": "VariableDeclaration", + "scope": 3835, + "src": "5293:12:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3807, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5293:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3810, + "mutability": "mutable", + "name": "signature", + "nameLocation": "5320:9:15", + "nodeType": "VariableDeclaration", + "scope": 3835, + "src": "5307:22:15", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 3809, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5307:5:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "5292:38:15" + }, + "returnParameters": { + "id": 3814, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3813, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3835, + "src": "5354:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3812, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5354:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "5353:9:15" + }, + "scope": 4137, + "src": "5276:255:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3864, + "nodeType": "Block", + "src": "5718:176:15", + "statements": [ + { + "assignments": [ + 3846, + 3849, + 3851 + ], + "declarations": [ + { + "constant": false, + "id": 3846, + "mutability": "mutable", + "name": "recovered", + "nameLocation": "5737:9:15", + "nodeType": "VariableDeclaration", + "scope": 3864, + "src": "5729:17:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3845, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5729:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3849, + "mutability": "mutable", + "name": "error", + "nameLocation": "5761:5:15", + "nodeType": "VariableDeclaration", + "scope": 3864, + "src": "5748:18:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "typeName": { + "id": 3848, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 3847, + "name": "RecoverError", + "nameLocations": [ + "5748:12:15" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3686, + "src": "5748:12:15" + }, + "referencedDeclaration": 3686, + "src": "5748:12:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3851, + "mutability": "mutable", + "name": "errorArg", + "nameLocation": "5776:8:15", + "nodeType": "VariableDeclaration", + "scope": 3864, + "src": "5768:16:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3850, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5768:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 3856, + "initialValue": { + "arguments": [ + { + "id": 3853, + "name": "hash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3838, + "src": "5807:4:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3854, + "name": "signature", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3840, + "src": "5813:9:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + } + ], + "id": 3852, + "name": "tryRecoverCalldata", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3805, + "src": "5788:18:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_bytes_calldata_ptr_$returns$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "function (bytes32,bytes calldata) pure returns (address,enum ECDSA.RecoverError,bytes32)" + } + }, + "id": 3855, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5788:35:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "5728:95:15" + }, + { + "expression": { + "arguments": [ + { + "id": 3858, + "name": "error", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3849, + "src": "5845:5:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + { + "id": 3859, + "name": "errorArg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3851, + "src": "5852:8:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3857, + "name": "_throwError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4136, + "src": "5833:11:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_RecoverError_$3686_$_t_bytes32_$returns$__$", + "typeString": "function (enum ECDSA.RecoverError,bytes32) pure" + } + }, + "id": 3860, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5833:28:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3861, + "nodeType": "ExpressionStatement", + "src": "5833:28:15" + }, + { + "expression": { + "id": 3862, + "name": "recovered", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3846, + "src": "5878:9:15", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 3844, + "id": 3863, + "nodeType": "Return", + "src": "5871:16:15" + } + ] + }, + "documentation": { + "id": 3836, + "nodeType": "StructuredDocumentation", + "src": "5537:79:15", + "text": " @dev Variant of {recover} that takes a signature in calldata" + }, + "id": 3865, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "recoverCalldata", + "nameLocation": "5630:15:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3841, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3838, + "mutability": "mutable", + "name": "hash", + "nameLocation": "5654:4:15", + "nodeType": "VariableDeclaration", + "scope": 3865, + "src": "5646:12:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3837, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5646:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3840, + "mutability": "mutable", + "name": "signature", + "nameLocation": "5675:9:15", + "nodeType": "VariableDeclaration", + "scope": 3865, + "src": "5660:24:15", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 3839, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5660:5:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "5645:40:15" + }, + "returnParameters": { + "id": 3844, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3843, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3865, + "src": "5709:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3842, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5709:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "5708:9:15" + }, + "scope": 4137, + "src": "5621:273:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3914, + "nodeType": "Block", + "src": "6273:342:15", + "statements": [ + { + "id": 3913, + "nodeType": "UncheckedBlock", + "src": "6283:326:15", + "statements": [ + { + "assignments": [ + 3883 + ], + "declarations": [ + { + "constant": false, + "id": 3883, + "mutability": "mutable", + "name": "s", + "nameLocation": "6315:1:15", + "nodeType": "VariableDeclaration", + "scope": 3913, + "src": "6307:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3882, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6307:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 3890, + "initialValue": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 3889, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3884, + "name": "vs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3872, + "src": "6319:2:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "arguments": [ + { + "hexValue": "307837666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666", + "id": 3887, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6332:66:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_57896044618658097711785492504343953926634992332820282019728792003956564819967_by_1", + "typeString": "int_const 5789...(69 digits omitted)...9967" + }, + "value": "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_57896044618658097711785492504343953926634992332820282019728792003956564819967_by_1", + "typeString": "int_const 5789...(69 digits omitted)...9967" + } + ], + "id": 3886, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6324:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes32_$", + "typeString": "type(bytes32)" + }, + "typeName": { + "id": 3885, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6324:7:15", + "typeDescriptions": {} + } + }, + "id": 3888, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6324:75:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "6319:80:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "6307:92:15" + }, + { + "assignments": [ + 3892 + ], + "declarations": [ + { + "constant": false, + "id": 3892, + "mutability": "mutable", + "name": "v", + "nameLocation": "6516:1:15", + "nodeType": "VariableDeclaration", + "scope": 3913, + "src": "6510:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 3891, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "6510:5:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "id": 3905, + "initialValue": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3903, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3900, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 3897, + "name": "vs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3872, + "src": "6535:2:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3896, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6527:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 3895, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6527:7:15", + "typeDescriptions": {} + } + }, + "id": 3898, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6527:11:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "323535", + "id": 3899, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6542:3:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "255" + }, + "src": "6527:18:15", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 3901, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "6526:20:15", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "3237", + "id": 3902, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6549:2:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_27_by_1", + "typeString": "int_const 27" + }, + "value": "27" + }, + "src": "6526:25:15", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3894, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6520:5:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": { + "id": 3893, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "6520:5:15", + "typeDescriptions": {} + } + }, + "id": 3904, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6520:32:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "6510:42:15" + }, + { + "expression": { + "arguments": [ + { + "id": 3907, + "name": "hash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3868, + "src": "6584:4:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3908, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3892, + "src": "6590:1:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + { + "id": 3909, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3870, + "src": "6593:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3910, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3883, + "src": "6596:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3906, + "name": "tryRecover", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3752, + 3915, + 4023 + ], + "referencedDeclaration": 4023, + "src": "6573:10:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_uint8_$_t_bytes32_$_t_bytes32_$returns$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "function (bytes32,uint8,bytes32,bytes32) pure returns (address,enum ECDSA.RecoverError,bytes32)" + } + }, + "id": 3911, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6573:25:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "functionReturnParameters": 3881, + "id": 3912, + "nodeType": "Return", + "src": "6566:32:15" + } + ] + } + ] + }, + "documentation": { + "id": 3866, + "nodeType": "StructuredDocumentation", + "src": "5900:205:15", + "text": " @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n See https://eips.ethereum.org/EIPS/eip-2098[ERC-2098 short signatures]" + }, + "id": 3915, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryRecover", + "nameLocation": "6119:10:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3873, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3868, + "mutability": "mutable", + "name": "hash", + "nameLocation": "6147:4:15", + "nodeType": "VariableDeclaration", + "scope": 3915, + "src": "6139:12:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3867, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6139:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3870, + "mutability": "mutable", + "name": "r", + "nameLocation": "6169:1:15", + "nodeType": "VariableDeclaration", + "scope": 3915, + "src": "6161:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3869, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6161:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3872, + "mutability": "mutable", + "name": "vs", + "nameLocation": "6188:2:15", + "nodeType": "VariableDeclaration", + "scope": 3915, + "src": "6180:10:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3871, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6180:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "6129:67:15" + }, + "returnParameters": { + "id": 3881, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3875, + "mutability": "mutable", + "name": "recovered", + "nameLocation": "6228:9:15", + "nodeType": "VariableDeclaration", + "scope": 3915, + "src": "6220:17:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3874, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6220:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3878, + "mutability": "mutable", + "name": "err", + "nameLocation": "6252:3:15", + "nodeType": "VariableDeclaration", + "scope": 3915, + "src": "6239:16:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "typeName": { + "id": 3877, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 3876, + "name": "RecoverError", + "nameLocations": [ + "6239:12:15" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3686, + "src": "6239:12:15" + }, + "referencedDeclaration": 3686, + "src": "6239:12:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3880, + "mutability": "mutable", + "name": "errArg", + "nameLocation": "6265:6:15", + "nodeType": "VariableDeclaration", + "scope": 3915, + "src": "6257:14:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3879, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6257:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "6219:53:15" + }, + "scope": 4137, + "src": "6110:505:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3947, + "nodeType": "Block", + "src": "6829:164:15", + "statements": [ + { + "assignments": [ + 3928, + 3931, + 3933 + ], + "declarations": [ + { + "constant": false, + "id": 3928, + "mutability": "mutable", + "name": "recovered", + "nameLocation": "6848:9:15", + "nodeType": "VariableDeclaration", + "scope": 3947, + "src": "6840:17:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3927, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6840:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3931, + "mutability": "mutable", + "name": "error", + "nameLocation": "6872:5:15", + "nodeType": "VariableDeclaration", + "scope": 3947, + "src": "6859:18:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "typeName": { + "id": 3930, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 3929, + "name": "RecoverError", + "nameLocations": [ + "6859:12:15" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3686, + "src": "6859:12:15" + }, + "referencedDeclaration": 3686, + "src": "6859:12:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3933, + "mutability": "mutable", + "name": "errorArg", + "nameLocation": "6887:8:15", + "nodeType": "VariableDeclaration", + "scope": 3947, + "src": "6879:16:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3932, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6879:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 3939, + "initialValue": { + "arguments": [ + { + "id": 3935, + "name": "hash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3918, + "src": "6910:4:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3936, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3920, + "src": "6916:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3937, + "name": "vs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3922, + "src": "6919:2:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3934, + "name": "tryRecover", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3752, + 3915, + 4023 + ], + "referencedDeclaration": 3915, + "src": "6899:10:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_bytes32_$_t_bytes32_$returns$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "function (bytes32,bytes32,bytes32) pure returns (address,enum ECDSA.RecoverError,bytes32)" + } + }, + "id": 3938, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6899:23:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "6839:83:15" + }, + { + "expression": { + "arguments": [ + { + "id": 3941, + "name": "error", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3931, + "src": "6944:5:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + { + "id": 3942, + "name": "errorArg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3933, + "src": "6951:8:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3940, + "name": "_throwError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4136, + "src": "6932:11:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_RecoverError_$3686_$_t_bytes32_$returns$__$", + "typeString": "function (enum ECDSA.RecoverError,bytes32) pure" + } + }, + "id": 3943, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6932:28:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3944, + "nodeType": "ExpressionStatement", + "src": "6932:28:15" + }, + { + "expression": { + "id": 3945, + "name": "recovered", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3928, + "src": "6977:9:15", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 3926, + "id": 3946, + "nodeType": "Return", + "src": "6970:16:15" + } + ] + }, + "documentation": { + "id": 3916, + "nodeType": "StructuredDocumentation", + "src": "6621:117:15", + "text": " @dev Overload of {ECDSA-recover} that receives the `r` and `vs` short-signature fields separately." + }, + "id": 3948, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "recover", + "nameLocation": "6752:7:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3923, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3918, + "mutability": "mutable", + "name": "hash", + "nameLocation": "6768:4:15", + "nodeType": "VariableDeclaration", + "scope": 3948, + "src": "6760:12:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3917, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6760:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3920, + "mutability": "mutable", + "name": "r", + "nameLocation": "6782:1:15", + "nodeType": "VariableDeclaration", + "scope": 3948, + "src": "6774:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3919, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6774:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3922, + "mutability": "mutable", + "name": "vs", + "nameLocation": "6793:2:15", + "nodeType": "VariableDeclaration", + "scope": 3948, + "src": "6785:10:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3921, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6785:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "6759:37:15" + }, + "returnParameters": { + "id": 3926, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3925, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3948, + "src": "6820:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3924, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6820:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "6819:9:15" + }, + "scope": 4137, + "src": "6743:250:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4022, + "nodeType": "Block", + "src": "7308:1372:15", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3972, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 3969, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3957, + "src": "8204:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3968, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8196:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 3967, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8196:7:15", + "typeDescriptions": {} + } + }, + "id": 3970, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8196:10:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "307837464646464646464646464646464646464646464646464646464646464646463544353736453733353741343530314444464539324634363638314232304130", + "id": 3971, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8209:66:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_57896044618658097711785492504343953926418782139537452191302581570759080747168_by_1", + "typeString": "int_const 5789...(69 digits omitted)...7168" + }, + "value": "0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0" + }, + "src": "8196:79:15", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3983, + "nodeType": "IfStatement", + "src": "8192:164:15", + "trueBody": { + "id": 3982, + "nodeType": "Block", + "src": "8277:79:15", + "statements": [ + { + "expression": { + "components": [ + { + "arguments": [ + { + "hexValue": "30", + "id": 3975, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8307:1:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 3974, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8299:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3973, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "8299:7:15", + "typeDescriptions": {} + } + }, + "id": 3976, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8299:10:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 3977, + "name": "RecoverError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3686, + "src": "8311:12:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_RecoverError_$3686_$", + "typeString": "type(enum ECDSA.RecoverError)" + } + }, + "id": 3978, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "8324:17:15", + "memberName": "InvalidSignatureS", + "nodeType": "MemberAccess", + "referencedDeclaration": 3685, + "src": "8311:30:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + { + "id": 3979, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3957, + "src": "8343:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 3980, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "8298:47:15", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "functionReturnParameters": 3966, + "id": 3981, + "nodeType": "Return", + "src": "8291:54:15" + } + ] + } + }, + { + "assignments": [ + 3985 + ], + "declarations": [ + { + "constant": false, + "id": 3985, + "mutability": "mutable", + "name": "signer", + "nameLocation": "8458:6:15", + "nodeType": "VariableDeclaration", + "scope": 4022, + "src": "8450:14:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3984, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "8450:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "id": 3992, + "initialValue": { + "arguments": [ + { + "id": 3987, + "name": "hash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3951, + "src": "8477:4:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3988, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3953, + "src": "8483:1:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + { + "id": 3989, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3955, + "src": "8486:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3990, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3957, + "src": "8489:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3986, + "name": "ecrecover", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -6, + "src": "8467:9:15", + "typeDescriptions": { + "typeIdentifier": "t_function_ecrecover_pure$_t_bytes32_$_t_uint8_$_t_bytes32_$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32,uint8,bytes32,bytes32) pure returns (address)" + } + }, + "id": 3991, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8467:24:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8450:41:15" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 3998, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3993, + "name": "signer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3985, + "src": "8505:6:15", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 3996, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8523:1:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 3995, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8515:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3994, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "8515:7:15", + "typeDescriptions": {} + } + }, + "id": 3997, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8515:10:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "8505:20:15", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4012, + "nodeType": "IfStatement", + "src": "8501:113:15", + "trueBody": { + "id": 4011, + "nodeType": "Block", + "src": "8527:87:15", + "statements": [ + { + "expression": { + "components": [ + { + "arguments": [ + { + "hexValue": "30", + "id": 4001, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8557:1:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 4000, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8549:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3999, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "8549:7:15", + "typeDescriptions": {} + } + }, + "id": 4002, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8549:10:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 4003, + "name": "RecoverError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3686, + "src": "8561:12:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_RecoverError_$3686_$", + "typeString": "type(enum ECDSA.RecoverError)" + } + }, + "id": 4004, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "8574:16:15", + "memberName": "InvalidSignature", + "nodeType": "MemberAccess", + "referencedDeclaration": 3683, + "src": "8561:29:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + { + "arguments": [ + { + "hexValue": "30", + "id": 4007, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8600:1:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 4006, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8592:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes32_$", + "typeString": "type(bytes32)" + }, + "typeName": { + "id": 4005, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "8592:7:15", + "typeDescriptions": {} + } + }, + "id": 4008, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8592:10:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 4009, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "8548:55:15", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "functionReturnParameters": 3966, + "id": 4010, + "nodeType": "Return", + "src": "8541:62:15" + } + ] + } + }, + { + "expression": { + "components": [ + { + "id": 4013, + "name": "signer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3985, + "src": "8632:6:15", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 4014, + "name": "RecoverError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3686, + "src": "8640:12:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_RecoverError_$3686_$", + "typeString": "type(enum ECDSA.RecoverError)" + } + }, + "id": 4015, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "8653:7:15", + "memberName": "NoError", + "nodeType": "MemberAccess", + "referencedDeclaration": 3682, + "src": "8640:20:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + { + "arguments": [ + { + "hexValue": "30", + "id": 4018, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8670:1:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 4017, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8662:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes32_$", + "typeString": "type(bytes32)" + }, + "typeName": { + "id": 4016, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "8662:7:15", + "typeDescriptions": {} + } + }, + "id": 4019, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8662:10:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 4020, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "8631:42:15", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "functionReturnParameters": 3966, + "id": 4021, + "nodeType": "Return", + "src": "8624:49:15" + } + ] + }, + "documentation": { + "id": 3949, + "nodeType": "StructuredDocumentation", + "src": "6999:125:15", + "text": " @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n `r` and `s` signature fields separately." + }, + "id": 4023, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryRecover", + "nameLocation": "7138:10:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3958, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3951, + "mutability": "mutable", + "name": "hash", + "nameLocation": "7166:4:15", + "nodeType": "VariableDeclaration", + "scope": 4023, + "src": "7158:12:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3950, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "7158:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3953, + "mutability": "mutable", + "name": "v", + "nameLocation": "7186:1:15", + "nodeType": "VariableDeclaration", + "scope": 4023, + "src": "7180:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 3952, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "7180:5:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3955, + "mutability": "mutable", + "name": "r", + "nameLocation": "7205:1:15", + "nodeType": "VariableDeclaration", + "scope": 4023, + "src": "7197:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3954, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "7197:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3957, + "mutability": "mutable", + "name": "s", + "nameLocation": "7224:1:15", + "nodeType": "VariableDeclaration", + "scope": 4023, + "src": "7216:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3956, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "7216:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "7148:83:15" + }, + "returnParameters": { + "id": 3966, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3960, + "mutability": "mutable", + "name": "recovered", + "nameLocation": "7263:9:15", + "nodeType": "VariableDeclaration", + "scope": 4023, + "src": "7255:17:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3959, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "7255:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3963, + "mutability": "mutable", + "name": "err", + "nameLocation": "7287:3:15", + "nodeType": "VariableDeclaration", + "scope": 4023, + "src": "7274:16:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "typeName": { + "id": 3962, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 3961, + "name": "RecoverError", + "nameLocations": [ + "7274:12:15" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3686, + "src": "7274:12:15" + }, + "referencedDeclaration": 3686, + "src": "7274:12:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3965, + "mutability": "mutable", + "name": "errArg", + "nameLocation": "7300:6:15", + "nodeType": "VariableDeclaration", + "scope": 4023, + "src": "7292:14:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3964, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "7292:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "7254:53:15" + }, + "scope": 4137, + "src": "7129:1551:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4058, + "nodeType": "Block", + "src": "8907:166:15", + "statements": [ + { + "assignments": [ + 4038, + 4041, + 4043 + ], + "declarations": [ + { + "constant": false, + "id": 4038, + "mutability": "mutable", + "name": "recovered", + "nameLocation": "8926:9:15", + "nodeType": "VariableDeclaration", + "scope": 4058, + "src": "8918:17:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 4037, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "8918:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4041, + "mutability": "mutable", + "name": "error", + "nameLocation": "8950:5:15", + "nodeType": "VariableDeclaration", + "scope": 4058, + "src": "8937:18:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "typeName": { + "id": 4040, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 4039, + "name": "RecoverError", + "nameLocations": [ + "8937:12:15" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3686, + "src": "8937:12:15" + }, + "referencedDeclaration": 3686, + "src": "8937:12:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4043, + "mutability": "mutable", + "name": "errorArg", + "nameLocation": "8965:8:15", + "nodeType": "VariableDeclaration", + "scope": 4058, + "src": "8957:16:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4042, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "8957:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 4050, + "initialValue": { + "arguments": [ + { + "id": 4045, + "name": "hash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4026, + "src": "8988:4:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 4046, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4028, + "src": "8994:1:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + { + "id": 4047, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4030, + "src": "8997:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 4048, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4032, + "src": "9000:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 4044, + "name": "tryRecover", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3752, + 3915, + 4023 + ], + "referencedDeclaration": 4023, + "src": "8977:10:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_uint8_$_t_bytes32_$_t_bytes32_$returns$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "function (bytes32,uint8,bytes32,bytes32) pure returns (address,enum ECDSA.RecoverError,bytes32)" + } + }, + "id": 4049, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8977:25:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8917:85:15" + }, + { + "expression": { + "arguments": [ + { + "id": 4052, + "name": "error", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4041, + "src": "9024:5:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + { + "id": 4053, + "name": "errorArg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4043, + "src": "9031:8:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 4051, + "name": "_throwError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4136, + "src": "9012:11:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_RecoverError_$3686_$_t_bytes32_$returns$__$", + "typeString": "function (enum ECDSA.RecoverError,bytes32) pure" + } + }, + "id": 4054, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9012:28:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 4055, + "nodeType": "ExpressionStatement", + "src": "9012:28:15" + }, + { + "expression": { + "id": 4056, + "name": "recovered", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4038, + "src": "9057:9:15", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 4036, + "id": 4057, + "nodeType": "Return", + "src": "9050:16:15" + } + ] + }, + "documentation": { + "id": 4024, + "nodeType": "StructuredDocumentation", + "src": "8686:122:15", + "text": " @dev Overload of {ECDSA-recover} that receives the `v`,\n `r` and `s` signature fields separately." + }, + "id": 4059, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "recover", + "nameLocation": "8822:7:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4033, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4026, + "mutability": "mutable", + "name": "hash", + "nameLocation": "8838:4:15", + "nodeType": "VariableDeclaration", + "scope": 4059, + "src": "8830:12:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4025, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "8830:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4028, + "mutability": "mutable", + "name": "v", + "nameLocation": "8850:1:15", + "nodeType": "VariableDeclaration", + "scope": 4059, + "src": "8844:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 4027, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "8844:5:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4030, + "mutability": "mutable", + "name": "r", + "nameLocation": "8861:1:15", + "nodeType": "VariableDeclaration", + "scope": 4059, + "src": "8853:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4029, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "8853:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4032, + "mutability": "mutable", + "name": "s", + "nameLocation": "8872:1:15", + "nodeType": "VariableDeclaration", + "scope": 4059, + "src": "8864:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4031, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "8864:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "8829:45:15" + }, + "returnParameters": { + "id": 4036, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4035, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4059, + "src": "8898:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 4034, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "8898:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "8897:9:15" + }, + "scope": 4137, + "src": "8813:260:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4072, + "nodeType": "Block", + "src": "9659:793:15", + "statements": [ + { + "AST": { + "nativeSrc": "9694:752:15", + "nodeType": "YulBlock", + "src": "9694:752:15", + "statements": [ + { + "cases": [ + { + "body": { + "nativeSrc": "9847:171:15", + "nodeType": "YulBlock", + "src": "9847:171:15", + "statements": [ + { + "nativeSrc": "9865:32:15", + "nodeType": "YulAssignment", + "src": "9865:32:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "signature", + "nativeSrc": "9880:9:15", + "nodeType": "YulIdentifier", + "src": "9880:9:15" + }, + { + "kind": "number", + "nativeSrc": "9891:4:15", + "nodeType": "YulLiteral", + "src": "9891:4:15", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9876:3:15", + "nodeType": "YulIdentifier", + "src": "9876:3:15" + }, + "nativeSrc": "9876:20:15", + "nodeType": "YulFunctionCall", + "src": "9876:20:15" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "9870:5:15", + "nodeType": "YulIdentifier", + "src": "9870:5:15" + }, + "nativeSrc": "9870:27:15", + "nodeType": "YulFunctionCall", + "src": "9870:27:15" + }, + "variableNames": [ + { + "name": "r", + "nativeSrc": "9865:1:15", + "nodeType": "YulIdentifier", + "src": "9865:1:15" + } + ] + }, + { + "nativeSrc": "9914:32:15", + "nodeType": "YulAssignment", + "src": "9914:32:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "signature", + "nativeSrc": "9929:9:15", + "nodeType": "YulIdentifier", + "src": "9929:9:15" + }, + { + "kind": "number", + "nativeSrc": "9940:4:15", + "nodeType": "YulLiteral", + "src": "9940:4:15", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9925:3:15", + "nodeType": "YulIdentifier", + "src": "9925:3:15" + }, + "nativeSrc": "9925:20:15", + "nodeType": "YulFunctionCall", + "src": "9925:20:15" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "9919:5:15", + "nodeType": "YulIdentifier", + "src": "9919:5:15" + }, + "nativeSrc": "9919:27:15", + "nodeType": "YulFunctionCall", + "src": "9919:27:15" + }, + "variableNames": [ + { + "name": "s", + "nativeSrc": "9914:1:15", + "nodeType": "YulIdentifier", + "src": "9914:1:15" + } + ] + }, + { + "nativeSrc": "9963:41:15", + "nodeType": "YulAssignment", + "src": "9963:41:15", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9973:1:15", + "nodeType": "YulLiteral", + "src": "9973:1:15", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "signature", + "nativeSrc": "9986:9:15", + "nodeType": "YulIdentifier", + "src": "9986:9:15" + }, + { + "kind": "number", + "nativeSrc": "9997:4:15", + "nodeType": "YulLiteral", + "src": "9997:4:15", + "type": "", + "value": "0x60" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9982:3:15", + "nodeType": "YulIdentifier", + "src": "9982:3:15" + }, + "nativeSrc": "9982:20:15", + "nodeType": "YulFunctionCall", + "src": "9982:20:15" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "9976:5:15", + "nodeType": "YulIdentifier", + "src": "9976:5:15" + }, + "nativeSrc": "9976:27:15", + "nodeType": "YulFunctionCall", + "src": "9976:27:15" + } + ], + "functionName": { + "name": "byte", + "nativeSrc": "9968:4:15", + "nodeType": "YulIdentifier", + "src": "9968:4:15" + }, + "nativeSrc": "9968:36:15", + "nodeType": "YulFunctionCall", + "src": "9968:36:15" + }, + "variableNames": [ + { + "name": "v", + "nativeSrc": "9963:1:15", + "nodeType": "YulIdentifier", + "src": "9963:1:15" + } + ] + } + ] + }, + "nativeSrc": "9839:179:15", + "nodeType": "YulCase", + "src": "9839:179:15", + "value": { + "kind": "number", + "nativeSrc": "9844:2:15", + "nodeType": "YulLiteral", + "src": "9844:2:15", + "type": "", + "value": "65" + } + }, + { + "body": { + "nativeSrc": "10125:206:15", + "nodeType": "YulBlock", + "src": "10125:206:15", + "statements": [ + { + "nativeSrc": "10143:37:15", + "nodeType": "YulVariableDeclaration", + "src": "10143:37:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "signature", + "nativeSrc": "10163:9:15", + "nodeType": "YulIdentifier", + "src": "10163:9:15" + }, + { + "kind": "number", + "nativeSrc": "10174:4:15", + "nodeType": "YulLiteral", + "src": "10174:4:15", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10159:3:15", + "nodeType": "YulIdentifier", + "src": "10159:3:15" + }, + "nativeSrc": "10159:20:15", + "nodeType": "YulFunctionCall", + "src": "10159:20:15" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "10153:5:15", + "nodeType": "YulIdentifier", + "src": "10153:5:15" + }, + "nativeSrc": "10153:27:15", + "nodeType": "YulFunctionCall", + "src": "10153:27:15" + }, + "variables": [ + { + "name": "vs", + "nativeSrc": "10147:2:15", + "nodeType": "YulTypedName", + "src": "10147:2:15", + "type": "" + } + ] + }, + { + "nativeSrc": "10197:32:15", + "nodeType": "YulAssignment", + "src": "10197:32:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "signature", + "nativeSrc": "10212:9:15", + "nodeType": "YulIdentifier", + "src": "10212:9:15" + }, + { + "kind": "number", + "nativeSrc": "10223:4:15", + "nodeType": "YulLiteral", + "src": "10223:4:15", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10208:3:15", + "nodeType": "YulIdentifier", + "src": "10208:3:15" + }, + "nativeSrc": "10208:20:15", + "nodeType": "YulFunctionCall", + "src": "10208:20:15" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "10202:5:15", + "nodeType": "YulIdentifier", + "src": "10202:5:15" + }, + "nativeSrc": "10202:27:15", + "nodeType": "YulFunctionCall", + "src": "10202:27:15" + }, + "variableNames": [ + { + "name": "r", + "nativeSrc": "10197:1:15", + "nodeType": "YulIdentifier", + "src": "10197:1:15" + } + ] + }, + { + "nativeSrc": "10246:28:15", + "nodeType": "YulAssignment", + "src": "10246:28:15", + "value": { + "arguments": [ + { + "name": "vs", + "nativeSrc": "10255:2:15", + "nodeType": "YulIdentifier", + "src": "10255:2:15" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10263:1:15", + "nodeType": "YulLiteral", + "src": "10263:1:15", + "type": "", + "value": "1" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10270:1:15", + "nodeType": "YulLiteral", + "src": "10270:1:15", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "10266:3:15", + "nodeType": "YulIdentifier", + "src": "10266:3:15" + }, + "nativeSrc": "10266:6:15", + "nodeType": "YulFunctionCall", + "src": "10266:6:15" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "10259:3:15", + "nodeType": "YulIdentifier", + "src": "10259:3:15" + }, + "nativeSrc": "10259:14:15", + "nodeType": "YulFunctionCall", + "src": "10259:14:15" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "10251:3:15", + "nodeType": "YulIdentifier", + "src": "10251:3:15" + }, + "nativeSrc": "10251:23:15", + "nodeType": "YulFunctionCall", + "src": "10251:23:15" + }, + "variableNames": [ + { + "name": "s", + "nativeSrc": "10246:1:15", + "nodeType": "YulIdentifier", + "src": "10246:1:15" + } + ] + }, + { + "nativeSrc": "10291:26:15", + "nodeType": "YulAssignment", + "src": "10291:26:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10304:3:15", + "nodeType": "YulLiteral", + "src": "10304:3:15", + "type": "", + "value": "255" + }, + { + "name": "vs", + "nativeSrc": "10309:2:15", + "nodeType": "YulIdentifier", + "src": "10309:2:15" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "10300:3:15", + "nodeType": "YulIdentifier", + "src": "10300:3:15" + }, + "nativeSrc": "10300:12:15", + "nodeType": "YulFunctionCall", + "src": "10300:12:15" + }, + { + "kind": "number", + "nativeSrc": "10314:2:15", + "nodeType": "YulLiteral", + "src": "10314:2:15", + "type": "", + "value": "27" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10296:3:15", + "nodeType": "YulIdentifier", + "src": "10296:3:15" + }, + "nativeSrc": "10296:21:15", + "nodeType": "YulFunctionCall", + "src": "10296:21:15" + }, + "variableNames": [ + { + "name": "v", + "nativeSrc": "10291:1:15", + "nodeType": "YulIdentifier", + "src": "10291:1:15" + } + ] + } + ] + }, + "nativeSrc": "10117:214:15", + "nodeType": "YulCase", + "src": "10117:214:15", + "value": { + "kind": "number", + "nativeSrc": "10122:2:15", + "nodeType": "YulLiteral", + "src": "10122:2:15", + "type": "", + "value": "64" + } + }, + { + "body": { + "nativeSrc": "10352:84:15", + "nodeType": "YulBlock", + "src": "10352:84:15", + "statements": [ + { + "nativeSrc": "10370:6:15", + "nodeType": "YulAssignment", + "src": "10370:6:15", + "value": { + "kind": "number", + "nativeSrc": "10375:1:15", + "nodeType": "YulLiteral", + "src": "10375:1:15", + "type": "", + "value": "0" + }, + "variableNames": [ + { + "name": "r", + "nativeSrc": "10370:1:15", + "nodeType": "YulIdentifier", + "src": "10370:1:15" + } + ] + }, + { + "nativeSrc": "10393:6:15", + "nodeType": "YulAssignment", + "src": "10393:6:15", + "value": { + "kind": "number", + "nativeSrc": "10398:1:15", + "nodeType": "YulLiteral", + "src": "10398:1:15", + "type": "", + "value": "0" + }, + "variableNames": [ + { + "name": "s", + "nativeSrc": "10393:1:15", + "nodeType": "YulIdentifier", + "src": "10393:1:15" + } + ] + }, + { + "nativeSrc": "10416:6:15", + "nodeType": "YulAssignment", + "src": "10416:6:15", + "value": { + "kind": "number", + "nativeSrc": "10421:1:15", + "nodeType": "YulLiteral", + "src": "10421:1:15", + "type": "", + "value": "0" + }, + "variableNames": [ + { + "name": "v", + "nativeSrc": "10416:1:15", + "nodeType": "YulIdentifier", + "src": "10416:1:15" + } + ] + } + ] + }, + "nativeSrc": "10344:92:15", + "nodeType": "YulCase", + "src": "10344:92:15", + "value": "default" + } + ], + "expression": { + "arguments": [ + { + "name": "signature", + "nativeSrc": "9763:9:15", + "nodeType": "YulIdentifier", + "src": "9763:9:15" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "9757:5:15", + "nodeType": "YulIdentifier", + "src": "9757:5:15" + }, + "nativeSrc": "9757:16:15", + "nodeType": "YulFunctionCall", + "src": "9757:16:15" + }, + "nativeSrc": "9750:686:15", + "nodeType": "YulSwitch", + "src": "9750:686:15" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4067, + "isOffset": false, + "isSlot": false, + "src": "10197:1:15", + "valueSize": 1 + }, + { + "declaration": 4067, + "isOffset": false, + "isSlot": false, + "src": "10370:1:15", + "valueSize": 1 + }, + { + "declaration": 4067, + "isOffset": false, + "isSlot": false, + "src": "9865:1:15", + "valueSize": 1 + }, + { + "declaration": 4069, + "isOffset": false, + "isSlot": false, + "src": "10246:1:15", + "valueSize": 1 + }, + { + "declaration": 4069, + "isOffset": false, + "isSlot": false, + "src": "10393:1:15", + "valueSize": 1 + }, + { + "declaration": 4069, + "isOffset": false, + "isSlot": false, + "src": "9914:1:15", + "valueSize": 1 + }, + { + "declaration": 4062, + "isOffset": false, + "isSlot": false, + "src": "10163:9:15", + "valueSize": 1 + }, + { + "declaration": 4062, + "isOffset": false, + "isSlot": false, + "src": "10212:9:15", + "valueSize": 1 + }, + { + "declaration": 4062, + "isOffset": false, + "isSlot": false, + "src": "9763:9:15", + "valueSize": 1 + }, + { + "declaration": 4062, + "isOffset": false, + "isSlot": false, + "src": "9880:9:15", + "valueSize": 1 + }, + { + "declaration": 4062, + "isOffset": false, + "isSlot": false, + "src": "9929:9:15", + "valueSize": 1 + }, + { + "declaration": 4062, + "isOffset": false, + "isSlot": false, + "src": "9986:9:15", + "valueSize": 1 + }, + { + "declaration": 4065, + "isOffset": false, + "isSlot": false, + "src": "10291:1:15", + "valueSize": 1 + }, + { + "declaration": 4065, + "isOffset": false, + "isSlot": false, + "src": "10416:1:15", + "valueSize": 1 + }, + { + "declaration": 4065, + "isOffset": false, + "isSlot": false, + "src": "9963:1:15", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4071, + "nodeType": "InlineAssembly", + "src": "9669:777:15" + } + ] + }, + "documentation": { + "id": 4060, + "nodeType": "StructuredDocumentation", + "src": "9079:482:15", + "text": " @dev Parse a signature into its `v`, `r` and `s` components. Supports 65-byte and 64-byte (ERC-2098)\n formats. Returns (0,0,0) for invalid signatures.\n For 64-byte signatures, `v` is automatically normalized to 27 or 28.\n For 65-byte signatures, `v` is returned as-is and MUST already be 27 or 28 for use with ecrecover.\n Consider validating the result before use, or use {tryRecover}/{recover} which perform full validation." + }, + "id": 4073, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parse", + "nameLocation": "9575:5:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4063, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4062, + "mutability": "mutable", + "name": "signature", + "nameLocation": "9594:9:15", + "nodeType": "VariableDeclaration", + "scope": 4073, + "src": "9581:22:15", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 4061, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "9581:5:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "9580:24:15" + }, + "returnParameters": { + "id": 4070, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4065, + "mutability": "mutable", + "name": "v", + "nameLocation": "9634:1:15", + "nodeType": "VariableDeclaration", + "scope": 4073, + "src": "9628:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 4064, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "9628:5:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4067, + "mutability": "mutable", + "name": "r", + "nameLocation": "9645:1:15", + "nodeType": "VariableDeclaration", + "scope": 4073, + "src": "9637:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4066, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "9637:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4069, + "mutability": "mutable", + "name": "s", + "nameLocation": "9656:1:15", + "nodeType": "VariableDeclaration", + "scope": 4073, + "src": "9648:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4068, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "9648:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "9627:31:15" + }, + "scope": 4137, + "src": "9566:886:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4086, + "nodeType": "Block", + "src": "10643:841:15", + "statements": [ + { + "AST": { + "nativeSrc": "10678:800:15", + "nodeType": "YulBlock", + "src": "10678:800:15", + "statements": [ + { + "cases": [ + { + "body": { + "nativeSrc": "10831:202:15", + "nodeType": "YulBlock", + "src": "10831:202:15", + "statements": [ + { + "nativeSrc": "10849:35:15", + "nodeType": "YulAssignment", + "src": "10849:35:15", + "value": { + "arguments": [ + { + "name": "signature.offset", + "nativeSrc": "10867:16:15", + "nodeType": "YulIdentifier", + "src": "10867:16:15" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "10854:12:15", + "nodeType": "YulIdentifier", + "src": "10854:12:15" + }, + "nativeSrc": "10854:30:15", + "nodeType": "YulFunctionCall", + "src": "10854:30:15" + }, + "variableNames": [ + { + "name": "r", + "nativeSrc": "10849:1:15", + "nodeType": "YulIdentifier", + "src": "10849:1:15" + } + ] + }, + { + "nativeSrc": "10901:46:15", + "nodeType": "YulAssignment", + "src": "10901:46:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "signature.offset", + "nativeSrc": "10923:16:15", + "nodeType": "YulIdentifier", + "src": "10923:16:15" + }, + { + "kind": "number", + "nativeSrc": "10941:4:15", + "nodeType": "YulLiteral", + "src": "10941:4:15", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10919:3:15", + "nodeType": "YulIdentifier", + "src": "10919:3:15" + }, + "nativeSrc": "10919:27:15", + "nodeType": "YulFunctionCall", + "src": "10919:27:15" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "10906:12:15", + "nodeType": "YulIdentifier", + "src": "10906:12:15" + }, + "nativeSrc": "10906:41:15", + "nodeType": "YulFunctionCall", + "src": "10906:41:15" + }, + "variableNames": [ + { + "name": "s", + "nativeSrc": "10901:1:15", + "nodeType": "YulIdentifier", + "src": "10901:1:15" + } + ] + }, + { + "nativeSrc": "10964:55:15", + "nodeType": "YulAssignment", + "src": "10964:55:15", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10974:1:15", + "nodeType": "YulLiteral", + "src": "10974:1:15", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "signature.offset", + "nativeSrc": "10994:16:15", + "nodeType": "YulIdentifier", + "src": "10994:16:15" + }, + { + "kind": "number", + "nativeSrc": "11012:4:15", + "nodeType": "YulLiteral", + "src": "11012:4:15", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10990:3:15", + "nodeType": "YulIdentifier", + "src": "10990:3:15" + }, + "nativeSrc": "10990:27:15", + "nodeType": "YulFunctionCall", + "src": "10990:27:15" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "10977:12:15", + "nodeType": "YulIdentifier", + "src": "10977:12:15" + }, + "nativeSrc": "10977:41:15", + "nodeType": "YulFunctionCall", + "src": "10977:41:15" + } + ], + "functionName": { + "name": "byte", + "nativeSrc": "10969:4:15", + "nodeType": "YulIdentifier", + "src": "10969:4:15" + }, + "nativeSrc": "10969:50:15", + "nodeType": "YulFunctionCall", + "src": "10969:50:15" + }, + "variableNames": [ + { + "name": "v", + "nativeSrc": "10964:1:15", + "nodeType": "YulIdentifier", + "src": "10964:1:15" + } + ] + } + ] + }, + "nativeSrc": "10823:210:15", + "nodeType": "YulCase", + "src": "10823:210:15", + "value": { + "kind": "number", + "nativeSrc": "10828:2:15", + "nodeType": "YulLiteral", + "src": "10828:2:15", + "type": "", + "value": "65" + } + }, + { + "body": { + "nativeSrc": "11140:223:15", + "nodeType": "YulBlock", + "src": "11140:223:15", + "statements": [ + { + "nativeSrc": "11158:51:15", + "nodeType": "YulVariableDeclaration", + "src": "11158:51:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "signature.offset", + "nativeSrc": "11185:16:15", + "nodeType": "YulIdentifier", + "src": "11185:16:15" + }, + { + "kind": "number", + "nativeSrc": "11203:4:15", + "nodeType": "YulLiteral", + "src": "11203:4:15", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "11181:3:15", + "nodeType": "YulIdentifier", + "src": "11181:3:15" + }, + "nativeSrc": "11181:27:15", + "nodeType": "YulFunctionCall", + "src": "11181:27:15" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "11168:12:15", + "nodeType": "YulIdentifier", + "src": "11168:12:15" + }, + "nativeSrc": "11168:41:15", + "nodeType": "YulFunctionCall", + "src": "11168:41:15" + }, + "variables": [ + { + "name": "vs", + "nativeSrc": "11162:2:15", + "nodeType": "YulTypedName", + "src": "11162:2:15", + "type": "" + } + ] + }, + { + "nativeSrc": "11226:35:15", + "nodeType": "YulAssignment", + "src": "11226:35:15", + "value": { + "arguments": [ + { + "name": "signature.offset", + "nativeSrc": "11244:16:15", + "nodeType": "YulIdentifier", + "src": "11244:16:15" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "11231:12:15", + "nodeType": "YulIdentifier", + "src": "11231:12:15" + }, + "nativeSrc": "11231:30:15", + "nodeType": "YulFunctionCall", + "src": "11231:30:15" + }, + "variableNames": [ + { + "name": "r", + "nativeSrc": "11226:1:15", + "nodeType": "YulIdentifier", + "src": "11226:1:15" + } + ] + }, + { + "nativeSrc": "11278:28:15", + "nodeType": "YulAssignment", + "src": "11278:28:15", + "value": { + "arguments": [ + { + "name": "vs", + "nativeSrc": "11287:2:15", + "nodeType": "YulIdentifier", + "src": "11287:2:15" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11295:1:15", + "nodeType": "YulLiteral", + "src": "11295:1:15", + "type": "", + "value": "1" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11302:1:15", + "nodeType": "YulLiteral", + "src": "11302:1:15", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "11298:3:15", + "nodeType": "YulIdentifier", + "src": "11298:3:15" + }, + "nativeSrc": "11298:6:15", + "nodeType": "YulFunctionCall", + "src": "11298:6:15" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "11291:3:15", + "nodeType": "YulIdentifier", + "src": "11291:3:15" + }, + "nativeSrc": "11291:14:15", + "nodeType": "YulFunctionCall", + "src": "11291:14:15" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "11283:3:15", + "nodeType": "YulIdentifier", + "src": "11283:3:15" + }, + "nativeSrc": "11283:23:15", + "nodeType": "YulFunctionCall", + "src": "11283:23:15" + }, + "variableNames": [ + { + "name": "s", + "nativeSrc": "11278:1:15", + "nodeType": "YulIdentifier", + "src": "11278:1:15" + } + ] + }, + { + "nativeSrc": "11323:26:15", + "nodeType": "YulAssignment", + "src": "11323:26:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11336:3:15", + "nodeType": "YulLiteral", + "src": "11336:3:15", + "type": "", + "value": "255" + }, + { + "name": "vs", + "nativeSrc": "11341:2:15", + "nodeType": "YulIdentifier", + "src": "11341:2:15" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "11332:3:15", + "nodeType": "YulIdentifier", + "src": "11332:3:15" + }, + "nativeSrc": "11332:12:15", + "nodeType": "YulFunctionCall", + "src": "11332:12:15" + }, + { + "kind": "number", + "nativeSrc": "11346:2:15", + "nodeType": "YulLiteral", + "src": "11346:2:15", + "type": "", + "value": "27" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "11328:3:15", + "nodeType": "YulIdentifier", + "src": "11328:3:15" + }, + "nativeSrc": "11328:21:15", + "nodeType": "YulFunctionCall", + "src": "11328:21:15" + }, + "variableNames": [ + { + "name": "v", + "nativeSrc": "11323:1:15", + "nodeType": "YulIdentifier", + "src": "11323:1:15" + } + ] + } + ] + }, + "nativeSrc": "11132:231:15", + "nodeType": "YulCase", + "src": "11132:231:15", + "value": { + "kind": "number", + "nativeSrc": "11137:2:15", + "nodeType": "YulLiteral", + "src": "11137:2:15", + "type": "", + "value": "64" + } + }, + { + "body": { + "nativeSrc": "11384:84:15", + "nodeType": "YulBlock", + "src": "11384:84:15", + "statements": [ + { + "nativeSrc": "11402:6:15", + "nodeType": "YulAssignment", + "src": "11402:6:15", + "value": { + "kind": "number", + "nativeSrc": "11407:1:15", + "nodeType": "YulLiteral", + "src": "11407:1:15", + "type": "", + "value": "0" + }, + "variableNames": [ + { + "name": "r", + "nativeSrc": "11402:1:15", + "nodeType": "YulIdentifier", + "src": "11402:1:15" + } + ] + }, + { + "nativeSrc": "11425:6:15", + "nodeType": "YulAssignment", + "src": "11425:6:15", + "value": { + "kind": "number", + "nativeSrc": "11430:1:15", + "nodeType": "YulLiteral", + "src": "11430:1:15", + "type": "", + "value": "0" + }, + "variableNames": [ + { + "name": "s", + "nativeSrc": "11425:1:15", + "nodeType": "YulIdentifier", + "src": "11425:1:15" + } + ] + }, + { + "nativeSrc": "11448:6:15", + "nodeType": "YulAssignment", + "src": "11448:6:15", + "value": { + "kind": "number", + "nativeSrc": "11453:1:15", + "nodeType": "YulLiteral", + "src": "11453:1:15", + "type": "", + "value": "0" + }, + "variableNames": [ + { + "name": "v", + "nativeSrc": "11448:1:15", + "nodeType": "YulIdentifier", + "src": "11448:1:15" + } + ] + } + ] + }, + "nativeSrc": "11376:92:15", + "nodeType": "YulCase", + "src": "11376:92:15", + "value": "default" + } + ], + "expression": { + "name": "signature.length", + "nativeSrc": "10741:16:15", + "nodeType": "YulIdentifier", + "src": "10741:16:15" + }, + "nativeSrc": "10734:734:15", + "nodeType": "YulSwitch", + "src": "10734:734:15" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4081, + "isOffset": false, + "isSlot": false, + "src": "10849:1:15", + "valueSize": 1 + }, + { + "declaration": 4081, + "isOffset": false, + "isSlot": false, + "src": "11226:1:15", + "valueSize": 1 + }, + { + "declaration": 4081, + "isOffset": false, + "isSlot": false, + "src": "11402:1:15", + "valueSize": 1 + }, + { + "declaration": 4083, + "isOffset": false, + "isSlot": false, + "src": "10901:1:15", + "valueSize": 1 + }, + { + "declaration": 4083, + "isOffset": false, + "isSlot": false, + "src": "11278:1:15", + "valueSize": 1 + }, + { + "declaration": 4083, + "isOffset": false, + "isSlot": false, + "src": "11425:1:15", + "valueSize": 1 + }, + { + "declaration": 4076, + "isOffset": false, + "isSlot": false, + "src": "10741:16:15", + "suffix": "length", + "valueSize": 1 + }, + { + "declaration": 4076, + "isOffset": true, + "isSlot": false, + "src": "10867:16:15", + "suffix": "offset", + "valueSize": 1 + }, + { + "declaration": 4076, + "isOffset": true, + "isSlot": false, + "src": "10923:16:15", + "suffix": "offset", + "valueSize": 1 + }, + { + "declaration": 4076, + "isOffset": true, + "isSlot": false, + "src": "10994:16:15", + "suffix": "offset", + "valueSize": 1 + }, + { + "declaration": 4076, + "isOffset": true, + "isSlot": false, + "src": "11185:16:15", + "suffix": "offset", + "valueSize": 1 + }, + { + "declaration": 4076, + "isOffset": true, + "isSlot": false, + "src": "11244:16:15", + "suffix": "offset", + "valueSize": 1 + }, + { + "declaration": 4079, + "isOffset": false, + "isSlot": false, + "src": "10964:1:15", + "valueSize": 1 + }, + { + "declaration": 4079, + "isOffset": false, + "isSlot": false, + "src": "11323:1:15", + "valueSize": 1 + }, + { + "declaration": 4079, + "isOffset": false, + "isSlot": false, + "src": "11448:1:15", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4085, + "nodeType": "InlineAssembly", + "src": "10653:825:15" + } + ] + }, + "documentation": { + "id": 4074, + "nodeType": "StructuredDocumentation", + "src": "10458:77:15", + "text": " @dev Variant of {parse} that takes a signature in calldata" + }, + "id": 4087, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parseCalldata", + "nameLocation": "10549:13:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4077, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4076, + "mutability": "mutable", + "name": "signature", + "nameLocation": "10578:9:15", + "nodeType": "VariableDeclaration", + "scope": 4087, + "src": "10563:24:15", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 4075, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "10563:5:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "10562:26:15" + }, + "returnParameters": { + "id": 4084, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4079, + "mutability": "mutable", + "name": "v", + "nameLocation": "10618:1:15", + "nodeType": "VariableDeclaration", + "scope": 4087, + "src": "10612:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 4078, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "10612:5:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4081, + "mutability": "mutable", + "name": "r", + "nameLocation": "10629:1:15", + "nodeType": "VariableDeclaration", + "scope": 4087, + "src": "10621:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4080, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "10621:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4083, + "mutability": "mutable", + "name": "s", + "nameLocation": "10640:1:15", + "nodeType": "VariableDeclaration", + "scope": 4087, + "src": "10632:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4082, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "10632:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "10611:31:15" + }, + "scope": 4137, + "src": "10540:944:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4135, + "nodeType": "Block", + "src": "11689:460:15", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "id": 4099, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4096, + "name": "error", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4091, + "src": "11703:5:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "expression": { + "id": 4097, + "name": "RecoverError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3686, + "src": "11712:12:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_RecoverError_$3686_$", + "typeString": "type(enum ECDSA.RecoverError)" + } + }, + "id": 4098, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "11725:7:15", + "memberName": "NoError", + "nodeType": "MemberAccess", + "referencedDeclaration": 3682, + "src": "11712:20:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "src": "11703:29:15", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "id": 4105, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4102, + "name": "error", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4091, + "src": "11799:5:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "expression": { + "id": 4103, + "name": "RecoverError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3686, + "src": "11808:12:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_RecoverError_$3686_$", + "typeString": "type(enum ECDSA.RecoverError)" + } + }, + "id": 4104, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "11821:16:15", + "memberName": "InvalidSignature", + "nodeType": "MemberAccess", + "referencedDeclaration": 3683, + "src": "11808:29:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "src": "11799:38:15", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "id": 4113, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4110, + "name": "error", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4091, + "src": "11904:5:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "expression": { + "id": 4111, + "name": "RecoverError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3686, + "src": "11913:12:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_RecoverError_$3686_$", + "typeString": "type(enum ECDSA.RecoverError)" + } + }, + "id": 4112, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "11926:22:15", + "memberName": "InvalidSignatureLength", + "nodeType": "MemberAccess", + "referencedDeclaration": 3684, + "src": "11913:35:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "src": "11904:44:15", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "id": 4125, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4122, + "name": "error", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4091, + "src": "12038:5:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "expression": { + "id": 4123, + "name": "RecoverError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3686, + "src": "12047:12:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_RecoverError_$3686_$", + "typeString": "type(enum ECDSA.RecoverError)" + } + }, + "id": 4124, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "12060:17:15", + "memberName": "InvalidSignatureS", + "nodeType": "MemberAccess", + "referencedDeclaration": 3685, + "src": "12047:30:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "src": "12038:39:15", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4131, + "nodeType": "IfStatement", + "src": "12034:109:15", + "trueBody": { + "id": 4130, + "nodeType": "Block", + "src": "12079:64:15", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "id": 4127, + "name": "errorArg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4093, + "src": "12123:8:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 4126, + "name": "ECDSAInvalidSignatureS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3699, + "src": "12100:22:15", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_bytes32_$returns$_t_error_$", + "typeString": "function (bytes32) pure returns (error)" + } + }, + "id": 4128, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12100:32:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 4129, + "nodeType": "RevertStatement", + "src": "12093:39:15" + } + ] + } + }, + "id": 4132, + "nodeType": "IfStatement", + "src": "11900:243:15", + "trueBody": { + "id": 4121, + "nodeType": "Block", + "src": "11950:78:15", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "id": 4117, + "name": "errorArg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4093, + "src": "12007:8:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 4116, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "11999:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 4115, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11999:7:15", + "typeDescriptions": {} + } + }, + "id": 4118, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11999:17:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4114, + "name": "ECDSAInvalidSignatureLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3694, + "src": "11971:27:15", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint256) pure returns (error)" + } + }, + "id": 4119, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11971:46:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 4120, + "nodeType": "RevertStatement", + "src": "11964:53:15" + } + ] + } + }, + "id": 4133, + "nodeType": "IfStatement", + "src": "11795:348:15", + "trueBody": { + "id": 4109, + "nodeType": "Block", + "src": "11839:55:15", + "statements": [ + { + "errorCall": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 4106, + "name": "ECDSAInvalidSignature", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3689, + "src": "11860:21:15", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$__$returns$_t_error_$", + "typeString": "function () pure returns (error)" + } + }, + "id": 4107, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11860:23:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 4108, + "nodeType": "RevertStatement", + "src": "11853:30:15" + } + ] + } + }, + "id": 4134, + "nodeType": "IfStatement", + "src": "11699:444:15", + "trueBody": { + "id": 4101, + "nodeType": "Block", + "src": "11734:55:15", + "statements": [ + { + "functionReturnParameters": 4095, + "id": 4100, + "nodeType": "Return", + "src": "11748:7:15" + } + ] + } + } + ] + }, + "documentation": { + "id": 4088, + "nodeType": "StructuredDocumentation", + "src": "11490:122:15", + "text": " @dev Optionally reverts with the corresponding custom error according to the `error` argument provided." + }, + "id": 4136, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_throwError", + "nameLocation": "11626:11:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4094, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4091, + "mutability": "mutable", + "name": "error", + "nameLocation": "11651:5:15", + "nodeType": "VariableDeclaration", + "scope": 4136, + "src": "11638:18:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "typeName": { + "id": 4090, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 4089, + "name": "RecoverError", + "nameLocations": [ + "11638:12:15" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3686, + "src": "11638:12:15" + }, + "referencedDeclaration": 3686, + "src": "11638:12:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4093, + "mutability": "mutable", + "name": "errorArg", + "nameLocation": "11666:8:15", + "nodeType": "VariableDeclaration", + "scope": 4136, + "src": "11658:16:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4092, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "11658:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "11637:38:15" + }, + "returnParameters": { + "id": 4095, + "nodeType": "ParameterList", + "parameters": [], + "src": "11689:0:15" + }, + "scope": 4137, + "src": "11617:532:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "private" + } + ], + "scope": 4138, + "src": "344:11807:15", + "usedErrors": [ + 3689, + 3694, + 3699 + ], + "usedEvents": [] + } + ], + "src": "112:12040:15" + }, + "id": 15 + }, + "@openzeppelin/contracts/utils/cryptography/EIP712.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/cryptography/EIP712.sol", + "exportedSymbols": { + "EIP712": [ + 4364 + ], + "IERC5267": [ + 262 + ], + "MessageHashUtils": [ + 4535 + ], + "ShortString": [ + 1833 + ], + "ShortStrings": [ + 2044 + ] + }, + "id": 4365, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 4139, + "literals": [ + "solidity", + "^", + "0.8", + ".24" + ], + "nodeType": "PragmaDirective", + "src": "113:24:16" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol", + "file": "./MessageHashUtils.sol", + "id": 4141, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 4365, + "sourceUnit": 4536, + "src": "139:56:16", + "symbolAliases": [ + { + "foreign": { + "id": 4140, + "name": "MessageHashUtils", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4535, + "src": "147:16:16", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/ShortStrings.sol", + "file": "../ShortStrings.sol", + "id": 4144, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 4365, + "sourceUnit": 2045, + "src": "196:62:16", + "symbolAliases": [ + { + "foreign": { + "id": 4142, + "name": "ShortStrings", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2044, + "src": "204:12:16", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + }, + { + "foreign": { + "id": 4143, + "name": "ShortString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1833, + "src": "218:11:16", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/interfaces/IERC5267.sol", + "file": "../../interfaces/IERC5267.sol", + "id": 4146, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 4365, + "sourceUnit": 263, + "src": "259:55:16", + "symbolAliases": [ + { + "foreign": { + "id": 4145, + "name": "IERC5267", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 262, + "src": "267:8:16", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": true, + "baseContracts": [ + { + "baseName": { + "id": 4148, + "name": "IERC5267", + "nameLocations": [ + "1988:8:16" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 262, + "src": "1988:8:16" + }, + "id": 4149, + "nodeType": "InheritanceSpecifier", + "src": "1988:8:16" + } + ], + "canonicalName": "EIP712", + "contractDependencies": [], + "contractKind": "contract", + "documentation": { + "id": 4147, + "nodeType": "StructuredDocumentation", + "src": "316:1643:16", + "text": " @dev https://eips.ethereum.org/EIPS/eip-712[EIP-712] is a standard for hashing and signing of typed structured data.\n The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose\n encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract\n does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to\n produce the hash of their typed data using a combination of `abi.encode` and `keccak256`.\n This contract implements the EIP-712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n ({_hashTypedDataV4}).\n The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n the chain id to protect against replay attacks on an eventual fork of the chain.\n NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\n separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the\n separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\n @custom:oz-upgrades-unsafe-allow state-variable-immutable" + }, + "fullyImplemented": true, + "id": 4364, + "linearizedBaseContracts": [ + 4364, + 262 + ], + "name": "EIP712", + "nameLocation": "1978:6:16", + "nodeType": "ContractDefinition", + "nodes": [ + { + "global": false, + "id": 4151, + "libraryName": { + "id": 4150, + "name": "ShortStrings", + "nameLocations": [ + "2009:12:16" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2044, + "src": "2009:12:16" + }, + "nodeType": "UsingForDirective", + "src": "2003:25:16" + }, + { + "constant": true, + "id": 4156, + "mutability": "constant", + "name": "TYPE_HASH", + "nameLocation": "2059:9:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2034:140:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4152, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2034:7:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": { + "arguments": [ + { + "hexValue": "454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429", + "id": 4154, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2089:84:16", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f", + "typeString": "literal_string \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"" + }, + "value": "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f", + "typeString": "literal_string \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"" + } + ], + "id": 4153, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "2079:9:16", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 4155, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2079:95:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "private" + }, + { + "constant": false, + "id": 4158, + "mutability": "immutable", + "name": "_cachedDomainSeparator", + "nameLocation": "2399:22:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2373:48:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4157, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2373:7:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "private" + }, + { + "constant": false, + "id": 4160, + "mutability": "immutable", + "name": "_cachedChainId", + "nameLocation": "2453:14:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2427:40:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4159, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2427:7:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "private" + }, + { + "constant": false, + "id": 4162, + "mutability": "immutable", + "name": "_cachedThis", + "nameLocation": "2499:11:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2473:37:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 4161, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2473:7:16", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "private" + }, + { + "constant": false, + "id": 4164, + "mutability": "immutable", + "name": "_hashedName", + "nameLocation": "2543:11:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2517:37:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4163, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2517:7:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "private" + }, + { + "constant": false, + "id": 4166, + "mutability": "immutable", + "name": "_hashedVersion", + "nameLocation": "2586:14:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2560:40:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4165, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2560:7:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "private" + }, + { + "constant": false, + "id": 4169, + "mutability": "immutable", + "name": "_name", + "nameLocation": "2637:5:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2607:35:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + }, + "typeName": { + "id": 4168, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 4167, + "name": "ShortString", + "nameLocations": [ + "2607:11:16" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1833, + "src": "2607:11:16" + }, + "referencedDeclaration": 1833, + "src": "2607:11:16", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "visibility": "private" + }, + { + "constant": false, + "id": 4172, + "mutability": "immutable", + "name": "_version", + "nameLocation": "2678:8:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2648:38:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + }, + "typeName": { + "id": 4171, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 4170, + "name": "ShortString", + "nameLocations": [ + "2648:11:16" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1833, + "src": "2648:11:16" + }, + "referencedDeclaration": 1833, + "src": "2648:11:16", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "visibility": "private" + }, + { + "constant": false, + "id": 4174, + "mutability": "mutable", + "name": "_nameFallback", + "nameLocation": "2757:13:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2742:28:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string" + }, + "typeName": { + "id": 4173, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2742:6:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "private" + }, + { + "constant": false, + "id": 4176, + "mutability": "mutable", + "name": "_versionFallback", + "nameLocation": "2841:16:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2826:31:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string" + }, + "typeName": { + "id": 4175, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2826:6:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "private" + }, + { + "body": { + "id": 4233, + "nodeType": "Block", + "src": "3483:376:16", + "statements": [ + { + "expression": { + "id": 4189, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4184, + "name": "_name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4169, + "src": "3493:5:16", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 4187, + "name": "_nameFallback", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4174, + "src": "3532:13:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + ], + "expression": { + "id": 4185, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4179, + "src": "3501:4:16", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "id": 4186, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3506:25:16", + "memberName": "toShortStringWithFallback", + "nodeType": "MemberAccess", + "referencedDeclaration": 1985, + "src": "3501:30:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_string_memory_ptr_$_t_string_storage_ptr_$returns$_t_userDefinedValueType$_ShortString_$1833_$attached_to$_t_string_memory_ptr_$", + "typeString": "function (string memory,string storage pointer) returns (ShortString)" + } + }, + "id": 4188, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3501:45:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "src": "3493:53:16", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "id": 4190, + "nodeType": "ExpressionStatement", + "src": "3493:53:16" + }, + { + "expression": { + "id": 4196, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4191, + "name": "_version", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4172, + "src": "3556:8:16", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 4194, + "name": "_versionFallback", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4176, + "src": "3601:16:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + ], + "expression": { + "id": 4192, + "name": "version", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4181, + "src": "3567:7:16", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "id": 4193, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3575:25:16", + "memberName": "toShortStringWithFallback", + "nodeType": "MemberAccess", + "referencedDeclaration": 1985, + "src": "3567:33:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_string_memory_ptr_$_t_string_storage_ptr_$returns$_t_userDefinedValueType$_ShortString_$1833_$attached_to$_t_string_memory_ptr_$", + "typeString": "function (string memory,string storage pointer) returns (ShortString)" + } + }, + "id": 4195, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3567:51:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "src": "3556:62:16", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "id": 4197, + "nodeType": "ExpressionStatement", + "src": "3556:62:16" + }, + { + "expression": { + "id": 4205, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4198, + "name": "_hashedName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4164, + "src": "3628:11:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "arguments": [ + { + "id": 4202, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4179, + "src": "3658:4:16", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 4201, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3652:5:16", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 4200, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3652:5:16", + "typeDescriptions": {} + } + }, + "id": 4203, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3652:11:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 4199, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "3642:9:16", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 4204, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3642:22:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "3628:36:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 4206, + "nodeType": "ExpressionStatement", + "src": "3628:36:16" + }, + { + "expression": { + "id": 4214, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4207, + "name": "_hashedVersion", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4166, + "src": "3674:14:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "arguments": [ + { + "id": 4211, + "name": "version", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4181, + "src": "3707:7:16", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 4210, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3701:5:16", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 4209, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3701:5:16", + "typeDescriptions": {} + } + }, + "id": 4212, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3701:14:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 4208, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "3691:9:16", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 4213, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3691:25:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "3674:42:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 4215, + "nodeType": "ExpressionStatement", + "src": "3674:42:16" + }, + { + "expression": { + "id": 4219, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4216, + "name": "_cachedChainId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4160, + "src": "3727:14:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "expression": { + "id": 4217, + "name": "block", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -4, + "src": "3744:5:16", + "typeDescriptions": { + "typeIdentifier": "t_magic_block", + "typeString": "block" + } + }, + "id": 4218, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3750:7:16", + "memberName": "chainid", + "nodeType": "MemberAccess", + "src": "3744:13:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3727:30:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 4220, + "nodeType": "ExpressionStatement", + "src": "3727:30:16" + }, + { + "expression": { + "id": 4224, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4221, + "name": "_cachedDomainSeparator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4158, + "src": "3767:22:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 4222, + "name": "_buildDomainSeparator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4281, + "src": "3792:21:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_bytes32_$", + "typeString": "function () view returns (bytes32)" + } + }, + "id": 4223, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3792:23:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "3767:48:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 4225, + "nodeType": "ExpressionStatement", + "src": "3767:48:16" + }, + { + "expression": { + "id": 4231, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4226, + "name": "_cachedThis", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4162, + "src": "3825:11:16", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 4229, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "3847:4:16", + "typeDescriptions": { + "typeIdentifier": "t_contract$_EIP712_$4364", + "typeString": "contract EIP712" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_EIP712_$4364", + "typeString": "contract EIP712" + } + ], + "id": 4228, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3839:7:16", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 4227, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3839:7:16", + "typeDescriptions": {} + } + }, + "id": 4230, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3839:13:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "3825:27:16", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 4232, + "nodeType": "ExpressionStatement", + "src": "3825:27:16" + } + ] + }, + "documentation": { + "id": 4177, + "nodeType": "StructuredDocumentation", + "src": "2864:559:16", + "text": " @dev Initializes the domain separator and parameter caches.\n The meaning of `name` and `version` is specified in\n https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP-712]:\n - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n - `version`: the current major version of the signing domain.\n NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n contract upgrade]." + }, + "id": 4234, + "implemented": true, + "kind": "constructor", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4182, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4179, + "mutability": "mutable", + "name": "name", + "nameLocation": "3454:4:16", + "nodeType": "VariableDeclaration", + "scope": 4234, + "src": "3440:18:16", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 4178, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "3440:6:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4181, + "mutability": "mutable", + "name": "version", + "nameLocation": "3474:7:16", + "nodeType": "VariableDeclaration", + "scope": 4234, + "src": "3460:21:16", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 4180, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "3460:6:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "3439:43:16" + }, + "returnParameters": { + "id": 4183, + "nodeType": "ParameterList", + "parameters": [], + "src": "3483:0:16" + }, + "scope": 4364, + "src": "3428:431:16", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4259, + "nodeType": "Block", + "src": "4007:200:16", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 4250, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 4245, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 4242, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "4029:4:16", + "typeDescriptions": { + "typeIdentifier": "t_contract$_EIP712_$4364", + "typeString": "contract EIP712" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_EIP712_$4364", + "typeString": "contract EIP712" + } + ], + "id": 4241, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4021:7:16", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 4240, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "4021:7:16", + "typeDescriptions": {} + } + }, + "id": 4243, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4021:13:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 4244, + "name": "_cachedThis", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4162, + "src": "4038:11:16", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "4021:28:16", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4249, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 4246, + "name": "block", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -4, + "src": "4053:5:16", + "typeDescriptions": { + "typeIdentifier": "t_magic_block", + "typeString": "block" + } + }, + "id": 4247, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4059:7:16", + "memberName": "chainid", + "nodeType": "MemberAccess", + "src": "4053:13:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 4248, + "name": "_cachedChainId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4160, + "src": "4070:14:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4053:31:16", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "4021:63:16", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 4257, + "nodeType": "Block", + "src": "4146:55:16", + "statements": [ + { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 4254, + "name": "_buildDomainSeparator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4281, + "src": "4167:21:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_bytes32_$", + "typeString": "function () view returns (bytes32)" + } + }, + "id": 4255, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4167:23:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 4239, + "id": 4256, + "nodeType": "Return", + "src": "4160:30:16" + } + ] + }, + "id": 4258, + "nodeType": "IfStatement", + "src": "4017:184:16", + "trueBody": { + "id": 4253, + "nodeType": "Block", + "src": "4086:54:16", + "statements": [ + { + "expression": { + "id": 4251, + "name": "_cachedDomainSeparator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4158, + "src": "4107:22:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 4239, + "id": 4252, + "nodeType": "Return", + "src": "4100:29:16" + } + ] + } + } + ] + }, + "documentation": { + "id": 4235, + "nodeType": "StructuredDocumentation", + "src": "3865:75:16", + "text": " @dev Returns the domain separator for the current chain." + }, + "id": 4260, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_domainSeparatorV4", + "nameLocation": "3954:18:16", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4236, + "nodeType": "ParameterList", + "parameters": [], + "src": "3972:2:16" + }, + "returnParameters": { + "id": 4239, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4238, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4260, + "src": "3998:7:16", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4237, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3998:7:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "3997:9:16" + }, + "scope": 4364, + "src": "3945:262:16", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4280, + "nodeType": "Block", + "src": "4277:115:16", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "id": 4268, + "name": "TYPE_HASH", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4156, + "src": "4315:9:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 4269, + "name": "_hashedName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4164, + "src": "4326:11:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 4270, + "name": "_hashedVersion", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4166, + "src": "4339:14:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 4271, + "name": "block", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -4, + "src": "4355:5:16", + "typeDescriptions": { + "typeIdentifier": "t_magic_block", + "typeString": "block" + } + }, + "id": 4272, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4361:7:16", + "memberName": "chainid", + "nodeType": "MemberAccess", + "src": "4355:13:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [ + { + "id": 4275, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "4378:4:16", + "typeDescriptions": { + "typeIdentifier": "t_contract$_EIP712_$4364", + "typeString": "contract EIP712" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_EIP712_$4364", + "typeString": "contract EIP712" + } + ], + "id": 4274, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4370:7:16", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 4273, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "4370:7:16", + "typeDescriptions": {} + } + }, + "id": 4276, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4370:13:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "expression": { + "id": 4266, + "name": "abi", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -1, + "src": "4304:3:16", + "typeDescriptions": { + "typeIdentifier": "t_magic_abi", + "typeString": "abi" + } + }, + "id": 4267, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "4308:6:16", + "memberName": "encode", + "nodeType": "MemberAccess", + "src": "4304:10:16", + "typeDescriptions": { + "typeIdentifier": "t_function_abiencode_pure$__$returns$_t_bytes_memory_ptr_$", + "typeString": "function () pure returns (bytes memory)" + } + }, + "id": 4277, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4304:80:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 4265, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "4294:9:16", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 4278, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4294:91:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 4264, + "id": 4279, + "nodeType": "Return", + "src": "4287:98:16" + } + ] + }, + "id": 4281, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_buildDomainSeparator", + "nameLocation": "4222:21:16", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4261, + "nodeType": "ParameterList", + "parameters": [], + "src": "4243:2:16" + }, + "returnParameters": { + "id": 4264, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4263, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4281, + "src": "4268:7:16", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4262, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "4268:7:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "4267:9:16" + }, + "scope": 4364, + "src": "4213:179:16", + "stateMutability": "view", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 4296, + "nodeType": "Block", + "src": "5103:90:16", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 4291, + "name": "_domainSeparatorV4", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4260, + "src": "5153:18:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_bytes32_$", + "typeString": "function () view returns (bytes32)" + } + }, + "id": 4292, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5153:20:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 4293, + "name": "structHash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4284, + "src": "5175:10:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "id": 4289, + "name": "MessageHashUtils", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4535, + "src": "5120:16:16", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_MessageHashUtils_$4535_$", + "typeString": "type(library MessageHashUtils)" + } + }, + "id": 4290, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5137:15:16", + "memberName": "toTypedDataHash", + "nodeType": "MemberAccess", + "referencedDeclaration": 4451, + "src": "5120:32:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_bytes32_$returns$_t_bytes32_$", + "typeString": "function (bytes32,bytes32) pure returns (bytes32)" + } + }, + "id": 4294, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5120:66:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 4288, + "id": 4295, + "nodeType": "Return", + "src": "5113:73:16" + } + ] + }, + "documentation": { + "id": 4282, + "nodeType": "StructuredDocumentation", + "src": "4398:614:16", + "text": " @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n function returns the hash of the fully encoded EIP712 message for this domain.\n This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n ```solidity\n bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n keccak256(\"Mail(address to,string contents)\"),\n mailTo,\n keccak256(bytes(mailContents))\n )));\n address signer = ECDSA.recover(digest, signature);\n ```" + }, + "id": 4297, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_hashTypedDataV4", + "nameLocation": "5026:16:16", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4285, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4284, + "mutability": "mutable", + "name": "structHash", + "nameLocation": "5051:10:16", + "nodeType": "VariableDeclaration", + "scope": 4297, + "src": "5043:18:16", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4283, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5043:7:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "5042:20:16" + }, + "returnParameters": { + "id": 4288, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4287, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4297, + "src": "5094:7:16", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4286, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5094:7:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "5093:9:16" + }, + "scope": 4364, + "src": "5017:176:16", + "stateMutability": "view", + "virtual": true, + "visibility": "internal" + }, + { + "baseFunctions": [ + 261 + ], + "body": { + "id": 4338, + "nodeType": "Block", + "src": "5556:229:16", + "statements": [ + { + "expression": { + "components": [ + { + "hexValue": "0f", + "id": 4316, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "hexString", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5587:7:16", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_3d725c5ee53025f027da36bea8d3af3b6a3e9d2d1542d47c162631de48e66c1c", + "typeString": "literal_string hex\"0f\"" + }, + "value": "\u000f" + }, + { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 4317, + "name": "_EIP712Name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4351, + "src": "5617:11:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_string_memory_ptr_$", + "typeString": "function () view returns (string memory)" + } + }, + "id": 4318, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5617:13:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 4319, + "name": "_EIP712Version", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4363, + "src": "5644:14:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_string_memory_ptr_$", + "typeString": "function () view returns (string memory)" + } + }, + "id": 4320, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5644:16:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "expression": { + "id": 4321, + "name": "block", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -4, + "src": "5674:5:16", + "typeDescriptions": { + "typeIdentifier": "t_magic_block", + "typeString": "block" + } + }, + "id": 4322, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5680:7:16", + "memberName": "chainid", + "nodeType": "MemberAccess", + "src": "5674:13:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [ + { + "id": 4325, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "5709:4:16", + "typeDescriptions": { + "typeIdentifier": "t_contract$_EIP712_$4364", + "typeString": "contract EIP712" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_EIP712_$4364", + "typeString": "contract EIP712" + } + ], + "id": 4324, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5701:7:16", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 4323, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5701:7:16", + "typeDescriptions": {} + } + }, + "id": 4326, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5701:13:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "arguments": [ + { + "hexValue": "30", + "id": 4329, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5736:1:16", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 4328, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5728:7:16", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes32_$", + "typeString": "type(bytes32)" + }, + "typeName": { + "id": 4327, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5728:7:16", + "typeDescriptions": {} + } + }, + "id": 4330, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5728:10:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "arguments": [ + { + "hexValue": "30", + "id": 4334, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5766:1:16", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 4333, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "5752:13:16", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_ptr_$", + "typeString": "function (uint256) pure returns (uint256[] memory)" + }, + "typeName": { + "baseType": { + "id": 4331, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5756:7:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 4332, + "nodeType": "ArrayTypeName", + "src": "5756:9:16", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + } + }, + "id": 4335, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5752:16:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + } + ], + "id": 4336, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "5573:205:16", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_stringliteral_3d725c5ee53025f027da36bea8d3af3b6a3e9d2d1542d47c162631de48e66c1c_$_t_string_memory_ptr_$_t_string_memory_ptr_$_t_uint256_$_t_address_$_t_bytes32_$_t_array$_t_uint256_$dyn_memory_ptr_$", + "typeString": "tuple(literal_string hex\"0f\",string memory,string memory,uint256,address,bytes32,uint256[] memory)" + } + }, + "functionReturnParameters": 4315, + "id": 4337, + "nodeType": "Return", + "src": "5566:212:16" + } + ] + }, + "documentation": { + "id": 4298, + "nodeType": "StructuredDocumentation", + "src": "5199:24:16", + "text": "@inheritdoc IERC5267" + }, + "functionSelector": "84b0196e", + "id": 4339, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "eip712Domain", + "nameLocation": "5237:12:16", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4299, + "nodeType": "ParameterList", + "parameters": [], + "src": "5249:2:16" + }, + "returnParameters": { + "id": 4315, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4301, + "mutability": "mutable", + "name": "fields", + "nameLocation": "5333:6:16", + "nodeType": "VariableDeclaration", + "scope": 4339, + "src": "5326:13:16", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 4300, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "5326:6:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4303, + "mutability": "mutable", + "name": "name", + "nameLocation": "5367:4:16", + "nodeType": "VariableDeclaration", + "scope": 4339, + "src": "5353:18:16", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 4302, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "5353:6:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4305, + "mutability": "mutable", + "name": "version", + "nameLocation": "5399:7:16", + "nodeType": "VariableDeclaration", + "scope": 4339, + "src": "5385:21:16", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 4304, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "5385:6:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4307, + "mutability": "mutable", + "name": "chainId", + "nameLocation": "5428:7:16", + "nodeType": "VariableDeclaration", + "scope": 4339, + "src": "5420:15:16", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4306, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5420:7:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4309, + "mutability": "mutable", + "name": "verifyingContract", + "nameLocation": "5457:17:16", + "nodeType": "VariableDeclaration", + "scope": 4339, + "src": "5449:25:16", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 4308, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5449:7:16", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4311, + "mutability": "mutable", + "name": "salt", + "nameLocation": "5496:4:16", + "nodeType": "VariableDeclaration", + "scope": 4339, + "src": "5488:12:16", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4310, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5488:7:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4314, + "mutability": "mutable", + "name": "extensions", + "nameLocation": "5531:10:16", + "nodeType": "VariableDeclaration", + "scope": 4339, + "src": "5514:27:16", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[]" + }, + "typeName": { + "baseType": { + "id": 4312, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5514:7:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 4313, + "nodeType": "ArrayTypeName", + "src": "5514:9:16", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "visibility": "internal" + } + ], + "src": "5312:239:16" + }, + "scope": 4364, + "src": "5228:557:16", + "stateMutability": "view", + "virtual": true, + "visibility": "public" + }, + { + "body": { + "id": 4350, + "nodeType": "Block", + "src": "6166:65:16", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 4347, + "name": "_nameFallback", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4174, + "src": "6210:13:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + ], + "expression": { + "id": 4345, + "name": "_name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4169, + "src": "6183:5:16", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "id": 4346, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6189:20:16", + "memberName": "toStringWithFallback", + "nodeType": "MemberAccess", + "referencedDeclaration": 2012, + "src": "6183:26:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_userDefinedValueType$_ShortString_$1833_$_t_string_storage_ptr_$returns$_t_string_memory_ptr_$attached_to$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "function (ShortString,string storage pointer) pure returns (string memory)" + } + }, + "id": 4348, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6183:41:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 4344, + "id": 4349, + "nodeType": "Return", + "src": "6176:48:16" + } + ] + }, + "documentation": { + "id": 4340, + "nodeType": "StructuredDocumentation", + "src": "5791:256:16", + "text": " @dev The name parameter for the EIP712 domain.\n NOTE: By default this function reads _name which is an immutable value.\n It only reads from storage if necessary (in case the value is too large to fit in a ShortString)." + }, + "id": 4351, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_EIP712Name", + "nameLocation": "6114:11:16", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4341, + "nodeType": "ParameterList", + "parameters": [], + "src": "6125:2:16" + }, + "returnParameters": { + "id": 4344, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4343, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4351, + "src": "6151:13:16", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 4342, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "6151:6:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "6150:15:16" + }, + "scope": 4364, + "src": "6105:126:16", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4362, + "nodeType": "Block", + "src": "6621:71:16", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 4359, + "name": "_versionFallback", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4176, + "src": "6668:16:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + ], + "expression": { + "id": 4357, + "name": "_version", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4172, + "src": "6638:8:16", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "id": 4358, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6647:20:16", + "memberName": "toStringWithFallback", + "nodeType": "MemberAccess", + "referencedDeclaration": 2012, + "src": "6638:29:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_userDefinedValueType$_ShortString_$1833_$_t_string_storage_ptr_$returns$_t_string_memory_ptr_$attached_to$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "function (ShortString,string storage pointer) pure returns (string memory)" + } + }, + "id": 4360, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6638:47:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 4356, + "id": 4361, + "nodeType": "Return", + "src": "6631:54:16" + } + ] + }, + "documentation": { + "id": 4352, + "nodeType": "StructuredDocumentation", + "src": "6237:262:16", + "text": " @dev The version parameter for the EIP712 domain.\n NOTE: By default this function reads _version which is an immutable value.\n It only reads from storage if necessary (in case the value is too large to fit in a ShortString)." + }, + "id": 4363, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_EIP712Version", + "nameLocation": "6566:14:16", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4353, + "nodeType": "ParameterList", + "parameters": [], + "src": "6580:2:16" + }, + "returnParameters": { + "id": 4356, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4355, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4363, + "src": "6606:13:16", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 4354, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "6606:6:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "6605:15:16" + }, + "scope": 4364, + "src": "6557:135:16", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + } + ], + "scope": 4365, + "src": "1960:4734:16", + "usedErrors": [ + 1841, + 1843 + ], + "usedEvents": [ + 242 + ] + } + ], + "src": "113:6582:16" + }, + "id": 16 + }, + "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol", + "exportedSymbols": { + "MessageHashUtils": [ + 4535 + ], + "Strings": [ + 3678 + ] + }, + "id": 4536, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 4366, + "literals": [ + "solidity", + "^", + "0.8", + ".24" + ], + "nodeType": "PragmaDirective", + "src": "123:24:17" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/Strings.sol", + "file": "../Strings.sol", + "id": 4368, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 4536, + "sourceUnit": 3679, + "src": "149:39:17", + "symbolAliases": [ + { + "foreign": { + "id": 4367, + "name": "Strings", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3678, + "src": "157:7:17", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "MessageHashUtils", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 4369, + "nodeType": "StructuredDocumentation", + "src": "190:330:17", + "text": " @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.\n The library provides methods for generating a hash of a message that conforms to the\n https://eips.ethereum.org/EIPS/eip-191[ERC-191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]\n specifications." + }, + "fullyImplemented": true, + "id": 4535, + "linearizedBaseContracts": [ + 4535 + ], + "name": "MessageHashUtils", + "nameLocation": "529:16:17", + "nodeType": "ContractDefinition", + "nodes": [ + { + "errorSelector": "db00f904", + "id": 4371, + "name": "ERC5267ExtensionsNotSupported", + "nameLocation": "558:29:17", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 4370, + "nodeType": "ParameterList", + "parameters": [], + "src": "587:2:17" + }, + "src": "552:38:17" + }, + { + "body": { + "id": 4380, + "nodeType": "Block", + "src": "1383:341:17", + "statements": [ + { + "AST": { + "nativeSrc": "1418:300:17", + "nodeType": "YulBlock", + "src": "1418:300:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1439:4:17", + "nodeType": "YulLiteral", + "src": "1439:4:17", + "type": "", + "value": "0x00" + }, + { + "hexValue": "19457468657265756d205369676e6564204d6573736167653a0a3332", + "kind": "string", + "nativeSrc": "1445:34:17", + "nodeType": "YulLiteral", + "src": "1445:34:17", + "type": "", + "value": "\u0019Ethereum Signed Message:\n32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1432:6:17", + "nodeType": "YulIdentifier", + "src": "1432:6:17" + }, + "nativeSrc": "1432:48:17", + "nodeType": "YulFunctionCall", + "src": "1432:48:17" + }, + "nativeSrc": "1432:48:17", + "nodeType": "YulExpressionStatement", + "src": "1432:48:17" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1541:4:17", + "nodeType": "YulLiteral", + "src": "1541:4:17", + "type": "", + "value": "0x1c" + }, + { + "name": "messageHash", + "nativeSrc": "1547:11:17", + "nodeType": "YulIdentifier", + "src": "1547:11:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1534:6:17", + "nodeType": "YulIdentifier", + "src": "1534:6:17" + }, + "nativeSrc": "1534:25:17", + "nodeType": "YulFunctionCall", + "src": "1534:25:17" + }, + "nativeSrc": "1534:25:17", + "nodeType": "YulExpressionStatement", + "src": "1534:25:17" + }, + { + "nativeSrc": "1613:31:17", + "nodeType": "YulAssignment", + "src": "1613:31:17", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1633:4:17", + "nodeType": "YulLiteral", + "src": "1633:4:17", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "1639:4:17", + "nodeType": "YulLiteral", + "src": "1639:4:17", + "type": "", + "value": "0x3c" + } + ], + "functionName": { + "name": "keccak256", + "nativeSrc": "1623:9:17", + "nodeType": "YulIdentifier", + "src": "1623:9:17" + }, + "nativeSrc": "1623:21:17", + "nodeType": "YulFunctionCall", + "src": "1623:21:17" + }, + "variableNames": [ + { + "name": "digest", + "nativeSrc": "1613:6:17", + "nodeType": "YulIdentifier", + "src": "1613:6:17" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4377, + "isOffset": false, + "isSlot": false, + "src": "1613:6:17", + "valueSize": 1 + }, + { + "declaration": 4374, + "isOffset": false, + "isSlot": false, + "src": "1547:11:17", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4379, + "nodeType": "InlineAssembly", + "src": "1393:325:17" + } + ] + }, + "documentation": { + "id": 4372, + "nodeType": "StructuredDocumentation", + "src": "596:690:17", + "text": " @dev Returns the keccak256 digest of an ERC-191 signed data with version\n `0x45` (`personal_sign` messages).\n The digest is calculated by prefixing a bytes32 `messageHash` with\n `\"\\x19Ethereum Signed Message:\\n32\"` and hashing the result. It corresponds with the\n hash signed when using the https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sign[`eth_sign`] JSON-RPC method.\n NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with\n keccak256, although any bytes32 value can be safely used because the final digest will\n be re-hashed.\n See {ECDSA-recover}." + }, + "id": 4381, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toEthSignedMessageHash", + "nameLocation": "1300:22:17", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4375, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4374, + "mutability": "mutable", + "name": "messageHash", + "nameLocation": "1331:11:17", + "nodeType": "VariableDeclaration", + "scope": 4381, + "src": "1323:19:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4373, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1323:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "1322:21:17" + }, + "returnParameters": { + "id": 4378, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4377, + "mutability": "mutable", + "name": "digest", + "nameLocation": "1375:6:17", + "nodeType": "VariableDeclaration", + "scope": 4381, + "src": "1367:14:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4376, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1367:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "1366:16:17" + }, + "scope": 4535, + "src": "1291:433:17", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4406, + "nodeType": "Block", + "src": "2301:143:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "hexValue": "19457468657265756d205369676e6564204d6573736167653a0a", + "id": 4393, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2353:32:17", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_9af2d9c228f6cfddaa6d1e5b94e0bce4ab16bd9a472a2b7fbfd74ebff4c720b4", + "typeString": "literal_string hex\"19457468657265756d205369676e6564204d6573736167653a0a\"" + }, + "value": "\u0019Ethereum Signed Message:\n" + }, + { + "arguments": [ + { + "arguments": [ + { + "expression": { + "id": 4398, + "name": "message", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4384, + "src": "2410:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 4399, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2418:6:17", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "2410:14:17", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 4396, + "name": "Strings", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3678, + "src": "2393:7:17", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Strings_$3678_$", + "typeString": "type(library Strings)" + } + }, + "id": 4397, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2401:8:17", + "memberName": "toString", + "nodeType": "MemberAccess", + "referencedDeclaration": 2261, + "src": "2393:16:17", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_string_memory_ptr_$", + "typeString": "function (uint256) pure returns (string memory)" + } + }, + "id": 4400, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2393:32:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 4395, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2387:5:17", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 4394, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2387:5:17", + "typeDescriptions": {} + } + }, + "id": 4401, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2387:39:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 4402, + "name": "message", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4384, + "src": "2428:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_9af2d9c228f6cfddaa6d1e5b94e0bce4ab16bd9a472a2b7fbfd74ebff4c720b4", + "typeString": "literal_string hex\"19457468657265756d205369676e6564204d6573736167653a0a\"" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "id": 4391, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2340:5:17", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 4390, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2340:5:17", + "typeDescriptions": {} + } + }, + "id": 4392, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2346:6:17", + "memberName": "concat", + "nodeType": "MemberAccess", + "src": "2340:12:17", + "typeDescriptions": { + "typeIdentifier": "t_function_bytesconcat_pure$__$returns$_t_bytes_memory_ptr_$", + "typeString": "function () pure returns (bytes memory)" + } + }, + "id": 4403, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2340:96:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 4389, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "2330:9:17", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 4404, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2330:107:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 4388, + "id": 4405, + "nodeType": "Return", + "src": "2311:126:17" + } + ] + }, + "documentation": { + "id": 4382, + "nodeType": "StructuredDocumentation", + "src": "1730:480:17", + "text": " @dev Returns the keccak256 digest of an ERC-191 signed data with version\n `0x45` (`personal_sign` messages).\n The digest is calculated by prefixing an arbitrary `message` with\n `\"\\x19Ethereum Signed Message:\\n\" + len(message)` and hashing the result. It corresponds with the\n hash signed when using the https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sign[`eth_sign`] JSON-RPC method.\n See {ECDSA-recover}." + }, + "id": 4407, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toEthSignedMessageHash", + "nameLocation": "2224:22:17", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4385, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4384, + "mutability": "mutable", + "name": "message", + "nameLocation": "2260:7:17", + "nodeType": "VariableDeclaration", + "scope": 4407, + "src": "2247:20:17", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 4383, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2247:5:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "2246:22:17" + }, + "returnParameters": { + "id": 4388, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4387, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4407, + "src": "2292:7:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4386, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2292:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "2291:9:17" + }, + "scope": 4535, + "src": "2215:229:17", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4426, + "nodeType": "Block", + "src": "2898:80:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "hexValue": "1900", + "id": 4420, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "hexString", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2942:10:17", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_73fd5d154550a4a103564cb191928cd38898034de1b952dc21b290898b4b697a", + "typeString": "literal_string hex\"1900\"" + }, + "value": "\u0019\u0000" + }, + { + "id": 4421, + "name": "validator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4410, + "src": "2954:9:17", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 4422, + "name": "data", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4412, + "src": "2965:4:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_73fd5d154550a4a103564cb191928cd38898034de1b952dc21b290898b4b697a", + "typeString": "literal_string hex\"1900\"" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "id": 4418, + "name": "abi", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -1, + "src": "2925:3:17", + "typeDescriptions": { + "typeIdentifier": "t_magic_abi", + "typeString": "abi" + } + }, + "id": 4419, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "2929:12:17", + "memberName": "encodePacked", + "nodeType": "MemberAccess", + "src": "2925:16:17", + "typeDescriptions": { + "typeIdentifier": "t_function_abiencodepacked_pure$__$returns$_t_bytes_memory_ptr_$", + "typeString": "function () pure returns (bytes memory)" + } + }, + "id": 4423, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2925:45:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 4417, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "2915:9:17", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 4424, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2915:56:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 4416, + "id": 4425, + "nodeType": "Return", + "src": "2908:63:17" + } + ] + }, + "documentation": { + "id": 4408, + "nodeType": "StructuredDocumentation", + "src": "2450:332:17", + "text": " @dev Returns the keccak256 digest of an ERC-191 signed data with version\n `0x00` (data with intended validator).\n The digest is calculated by prefixing an arbitrary `data` with `\"\\x19\\x00\"` and the intended\n `validator` address. Then hashing the result.\n See {ECDSA-recover}." + }, + "id": 4427, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toDataWithIntendedValidatorHash", + "nameLocation": "2796:31:17", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4413, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4410, + "mutability": "mutable", + "name": "validator", + "nameLocation": "2836:9:17", + "nodeType": "VariableDeclaration", + "scope": 4427, + "src": "2828:17:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 4409, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2828:7:17", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4412, + "mutability": "mutable", + "name": "data", + "nameLocation": "2860:4:17", + "nodeType": "VariableDeclaration", + "scope": 4427, + "src": "2847:17:17", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 4411, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2847:5:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "2827:38:17" + }, + "returnParameters": { + "id": 4416, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4415, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4427, + "src": "2889:7:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4414, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2889:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "2888:9:17" + }, + "scope": 4535, + "src": "2787:191:17", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4438, + "nodeType": "Block", + "src": "3260:216:17", + "statements": [ + { + "AST": { + "nativeSrc": "3295:175:17", + "nodeType": "YulBlock", + "src": "3295:175:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3316:4:17", + "nodeType": "YulLiteral", + "src": "3316:4:17", + "type": "", + "value": "0x00" + }, + { + "hexValue": "1900", + "kind": "string", + "nativeSrc": "3322:10:17", + "nodeType": "YulLiteral", + "src": "3322:10:17", + "type": "", + "value": "\u0019\u0000" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3309:6:17", + "nodeType": "YulIdentifier", + "src": "3309:6:17" + }, + "nativeSrc": "3309:24:17", + "nodeType": "YulFunctionCall", + "src": "3309:24:17" + }, + "nativeSrc": "3309:24:17", + "nodeType": "YulExpressionStatement", + "src": "3309:24:17" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3353:4:17", + "nodeType": "YulLiteral", + "src": "3353:4:17", + "type": "", + "value": "0x02" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3363:2:17", + "nodeType": "YulLiteral", + "src": "3363:2:17", + "type": "", + "value": "96" + }, + { + "name": "validator", + "nativeSrc": "3367:9:17", + "nodeType": "YulIdentifier", + "src": "3367:9:17" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "3359:3:17", + "nodeType": "YulIdentifier", + "src": "3359:3:17" + }, + "nativeSrc": "3359:18:17", + "nodeType": "YulFunctionCall", + "src": "3359:18:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3346:6:17", + "nodeType": "YulIdentifier", + "src": "3346:6:17" + }, + "nativeSrc": "3346:32:17", + "nodeType": "YulFunctionCall", + "src": "3346:32:17" + }, + "nativeSrc": "3346:32:17", + "nodeType": "YulExpressionStatement", + "src": "3346:32:17" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3398:4:17", + "nodeType": "YulLiteral", + "src": "3398:4:17", + "type": "", + "value": "0x16" + }, + { + "name": "messageHash", + "nativeSrc": "3404:11:17", + "nodeType": "YulIdentifier", + "src": "3404:11:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3391:6:17", + "nodeType": "YulIdentifier", + "src": "3391:6:17" + }, + "nativeSrc": "3391:25:17", + "nodeType": "YulFunctionCall", + "src": "3391:25:17" + }, + "nativeSrc": "3391:25:17", + "nodeType": "YulExpressionStatement", + "src": "3391:25:17" + }, + { + "nativeSrc": "3429:31:17", + "nodeType": "YulAssignment", + "src": "3429:31:17", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3449:4:17", + "nodeType": "YulLiteral", + "src": "3449:4:17", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "3455:4:17", + "nodeType": "YulLiteral", + "src": "3455:4:17", + "type": "", + "value": "0x36" + } + ], + "functionName": { + "name": "keccak256", + "nativeSrc": "3439:9:17", + "nodeType": "YulIdentifier", + "src": "3439:9:17" + }, + "nativeSrc": "3439:21:17", + "nodeType": "YulFunctionCall", + "src": "3439:21:17" + }, + "variableNames": [ + { + "name": "digest", + "nativeSrc": "3429:6:17", + "nodeType": "YulIdentifier", + "src": "3429:6:17" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4435, + "isOffset": false, + "isSlot": false, + "src": "3429:6:17", + "valueSize": 1 + }, + { + "declaration": 4432, + "isOffset": false, + "isSlot": false, + "src": "3404:11:17", + "valueSize": 1 + }, + { + "declaration": 4430, + "isOffset": false, + "isSlot": false, + "src": "3367:9:17", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4437, + "nodeType": "InlineAssembly", + "src": "3270:200:17" + } + ] + }, + "documentation": { + "id": 4428, + "nodeType": "StructuredDocumentation", + "src": "2984:129:17", + "text": " @dev Variant of {toDataWithIntendedValidatorHash-address-bytes} optimized for cases where `data` is a bytes32." + }, + "id": 4439, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toDataWithIntendedValidatorHash", + "nameLocation": "3127:31:17", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4433, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4430, + "mutability": "mutable", + "name": "validator", + "nameLocation": "3176:9:17", + "nodeType": "VariableDeclaration", + "scope": 4439, + "src": "3168:17:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 4429, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3168:7:17", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4432, + "mutability": "mutable", + "name": "messageHash", + "nameLocation": "3203:11:17", + "nodeType": "VariableDeclaration", + "scope": 4439, + "src": "3195:19:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4431, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3195:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "3158:62:17" + }, + "returnParameters": { + "id": 4436, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4435, + "mutability": "mutable", + "name": "digest", + "nameLocation": "3252:6:17", + "nodeType": "VariableDeclaration", + "scope": 4439, + "src": "3244:14:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4434, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3244:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "3243:16:17" + }, + "scope": 4535, + "src": "3118:358:17", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4450, + "nodeType": "Block", + "src": "4027:265:17", + "statements": [ + { + "AST": { + "nativeSrc": "4062:224:17", + "nodeType": "YulBlock", + "src": "4062:224:17", + "statements": [ + { + "nativeSrc": "4076:22:17", + "nodeType": "YulVariableDeclaration", + "src": "4076:22:17", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "4093:4:17", + "nodeType": "YulLiteral", + "src": "4093:4:17", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "4087:5:17", + "nodeType": "YulIdentifier", + "src": "4087:5:17" + }, + "nativeSrc": "4087:11:17", + "nodeType": "YulFunctionCall", + "src": "4087:11:17" + }, + "variables": [ + { + "name": "ptr", + "nativeSrc": "4080:3:17", + "nodeType": "YulTypedName", + "src": "4080:3:17", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "4118:3:17", + "nodeType": "YulIdentifier", + "src": "4118:3:17" + }, + { + "hexValue": "1901", + "kind": "string", + "nativeSrc": "4123:10:17", + "nodeType": "YulLiteral", + "src": "4123:10:17", + "type": "", + "value": "\u0019\u0001" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4111:6:17", + "nodeType": "YulIdentifier", + "src": "4111:6:17" + }, + "nativeSrc": "4111:23:17", + "nodeType": "YulFunctionCall", + "src": "4111:23:17" + }, + "nativeSrc": "4111:23:17", + "nodeType": "YulExpressionStatement", + "src": "4111:23:17" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "4158:3:17", + "nodeType": "YulIdentifier", + "src": "4158:3:17" + }, + { + "kind": "number", + "nativeSrc": "4163:4:17", + "nodeType": "YulLiteral", + "src": "4163:4:17", + "type": "", + "value": "0x02" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4154:3:17", + "nodeType": "YulIdentifier", + "src": "4154:3:17" + }, + "nativeSrc": "4154:14:17", + "nodeType": "YulFunctionCall", + "src": "4154:14:17" + }, + { + "name": "domainSeparator", + "nativeSrc": "4170:15:17", + "nodeType": "YulIdentifier", + "src": "4170:15:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4147:6:17", + "nodeType": "YulIdentifier", + "src": "4147:6:17" + }, + "nativeSrc": "4147:39:17", + "nodeType": "YulFunctionCall", + "src": "4147:39:17" + }, + "nativeSrc": "4147:39:17", + "nodeType": "YulExpressionStatement", + "src": "4147:39:17" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "4210:3:17", + "nodeType": "YulIdentifier", + "src": "4210:3:17" + }, + { + "kind": "number", + "nativeSrc": "4215:4:17", + "nodeType": "YulLiteral", + "src": "4215:4:17", + "type": "", + "value": "0x22" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4206:3:17", + "nodeType": "YulIdentifier", + "src": "4206:3:17" + }, + "nativeSrc": "4206:14:17", + "nodeType": "YulFunctionCall", + "src": "4206:14:17" + }, + { + "name": "structHash", + "nativeSrc": "4222:10:17", + "nodeType": "YulIdentifier", + "src": "4222:10:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4199:6:17", + "nodeType": "YulIdentifier", + "src": "4199:6:17" + }, + "nativeSrc": "4199:34:17", + "nodeType": "YulFunctionCall", + "src": "4199:34:17" + }, + "nativeSrc": "4199:34:17", + "nodeType": "YulExpressionStatement", + "src": "4199:34:17" + }, + { + "nativeSrc": "4246:30:17", + "nodeType": "YulAssignment", + "src": "4246:30:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "4266:3:17", + "nodeType": "YulIdentifier", + "src": "4266:3:17" + }, + { + "kind": "number", + "nativeSrc": "4271:4:17", + "nodeType": "YulLiteral", + "src": "4271:4:17", + "type": "", + "value": "0x42" + } + ], + "functionName": { + "name": "keccak256", + "nativeSrc": "4256:9:17", + "nodeType": "YulIdentifier", + "src": "4256:9:17" + }, + "nativeSrc": "4256:20:17", + "nodeType": "YulFunctionCall", + "src": "4256:20:17" + }, + "variableNames": [ + { + "name": "digest", + "nativeSrc": "4246:6:17", + "nodeType": "YulIdentifier", + "src": "4246:6:17" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4447, + "isOffset": false, + "isSlot": false, + "src": "4246:6:17", + "valueSize": 1 + }, + { + "declaration": 4442, + "isOffset": false, + "isSlot": false, + "src": "4170:15:17", + "valueSize": 1 + }, + { + "declaration": 4444, + "isOffset": false, + "isSlot": false, + "src": "4222:10:17", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4449, + "nodeType": "InlineAssembly", + "src": "4037:249:17" + } + ] + }, + "documentation": { + "id": 4440, + "nodeType": "StructuredDocumentation", + "src": "3482:431:17", + "text": " @dev Returns the keccak256 digest of an EIP-712 typed data (ERC-191 version `0x01`).\n The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with\n `\\x19\\x01` and hashing the result. It corresponds to the hash signed by the\n https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.\n See {ECDSA-recover}." + }, + "id": 4451, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toTypedDataHash", + "nameLocation": "3927:15:17", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4445, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4442, + "mutability": "mutable", + "name": "domainSeparator", + "nameLocation": "3951:15:17", + "nodeType": "VariableDeclaration", + "scope": 4451, + "src": "3943:23:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4441, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3943:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4444, + "mutability": "mutable", + "name": "structHash", + "nameLocation": "3976:10:17", + "nodeType": "VariableDeclaration", + "scope": 4451, + "src": "3968:18:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4443, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3968:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "3942:45:17" + }, + "returnParameters": { + "id": 4448, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4447, + "mutability": "mutable", + "name": "digest", + "nameLocation": "4019:6:17", + "nodeType": "VariableDeclaration", + "scope": 4451, + "src": "4011:14:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4446, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "4011:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "4010:16:17" + }, + "scope": 4535, + "src": "3918:374:17", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4488, + "nodeType": "Block", + "src": "5222:256:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 4470, + "name": "fields", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4454, + "src": "5286:6:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + { + "arguments": [ + { + "arguments": [ + { + "id": 4474, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4456, + "src": "5326:4:17", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 4473, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5320:5:17", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 4472, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5320:5:17", + "typeDescriptions": {} + } + }, + "id": 4475, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5320:11:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 4471, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "5310:9:17", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 4476, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5310:22:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "arguments": [ + { + "arguments": [ + { + "id": 4480, + "name": "version", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4458, + "src": "5366:7:17", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 4479, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5360:5:17", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 4478, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5360:5:17", + "typeDescriptions": {} + } + }, + "id": 4481, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5360:14:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 4477, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "5350:9:17", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 4482, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5350:25:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 4483, + "name": "chainId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4460, + "src": "5393:7:17", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 4484, + "name": "verifyingContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4462, + "src": "5418:17:17", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 4485, + "name": "salt", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4464, + "src": "5453:4:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 4469, + "name": "toDomainSeparator", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4489, + 4515 + ], + "referencedDeclaration": 4515, + "src": "5251:17:17", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes1_$_t_bytes32_$_t_bytes32_$_t_uint256_$_t_address_$_t_bytes32_$returns$_t_bytes32_$", + "typeString": "function (bytes1,bytes32,bytes32,uint256,address,bytes32) pure returns (bytes32)" + } + }, + "id": 4486, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5251:220:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 4468, + "id": 4487, + "nodeType": "Return", + "src": "5232:239:17" + } + ] + }, + "documentation": { + "id": 4452, + "nodeType": "StructuredDocumentation", + "src": "4298:685:17", + "text": " @dev Returns the EIP-712 domain separator constructed from an `eip712Domain`. See {IERC5267-eip712Domain}\n This function dynamically constructs the domain separator based on which fields are present in the\n `fields` parameter. It contains flags that indicate which domain fields are present:\n * Bit 0 (0x01): name\n * Bit 1 (0x02): version\n * Bit 2 (0x04): chainId\n * Bit 3 (0x08): verifyingContract\n * Bit 4 (0x10): salt\n Arguments that correspond to fields which are not present in `fields` are ignored. For example, if `fields` is\n `0x0f` (`0b01111`), then the `salt` parameter is ignored." + }, + "id": 4489, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toDomainSeparator", + "nameLocation": "4997:17:17", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4465, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4454, + "mutability": "mutable", + "name": "fields", + "nameLocation": "5031:6:17", + "nodeType": "VariableDeclaration", + "scope": 4489, + "src": "5024:13:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 4453, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "5024:6:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4456, + "mutability": "mutable", + "name": "name", + "nameLocation": "5061:4:17", + "nodeType": "VariableDeclaration", + "scope": 4489, + "src": "5047:18:17", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 4455, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "5047:6:17", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4458, + "mutability": "mutable", + "name": "version", + "nameLocation": "5089:7:17", + "nodeType": "VariableDeclaration", + "scope": 4489, + "src": "5075:21:17", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 4457, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "5075:6:17", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4460, + "mutability": "mutable", + "name": "chainId", + "nameLocation": "5114:7:17", + "nodeType": "VariableDeclaration", + "scope": 4489, + "src": "5106:15:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4459, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5106:7:17", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4462, + "mutability": "mutable", + "name": "verifyingContract", + "nameLocation": "5139:17:17", + "nodeType": "VariableDeclaration", + "scope": 4489, + "src": "5131:25:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 4461, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5131:7:17", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4464, + "mutability": "mutable", + "name": "salt", + "nameLocation": "5174:4:17", + "nodeType": "VariableDeclaration", + "scope": 4489, + "src": "5166:12:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4463, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5166:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "5014:170:17" + }, + "returnParameters": { + "id": 4468, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4467, + "mutability": "mutable", + "name": "hash", + "nameLocation": "5216:4:17", + "nodeType": "VariableDeclaration", + "scope": 4489, + "src": "5208:12:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4466, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5208:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "5207:14:17" + }, + "scope": 4535, + "src": "4988:490:17", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4514, + "nodeType": "Block", + "src": "5838:1051:17", + "statements": [ + { + "assignments": [ + 4508 + ], + "declarations": [ + { + "constant": false, + "id": 4508, + "mutability": "mutable", + "name": "domainTypeHash", + "nameLocation": "5856:14:17", + "nodeType": "VariableDeclaration", + "scope": 4514, + "src": "5848:22:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4507, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5848:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 4512, + "initialValue": { + "arguments": [ + { + "id": 4510, + "name": "fields", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4492, + "src": "5890:6:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 4509, + "name": "toDomainTypeHash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4534, + "src": "5873:16:17", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes1_$returns$_t_bytes32_$", + "typeString": "function (bytes1) pure returns (bytes32)" + } + }, + "id": 4511, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5873:24:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "5848:49:17" + }, + { + "AST": { + "nativeSrc": "5933:950:17", + "nodeType": "YulBlock", + "src": "5933:950:17", + "statements": [ + { + "nativeSrc": "6008:26:17", + "nodeType": "YulAssignment", + "src": "6008:26:17", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "6022:3:17", + "nodeType": "YulLiteral", + "src": "6022:3:17", + "type": "", + "value": "248" + }, + { + "name": "fields", + "nativeSrc": "6027:6:17", + "nodeType": "YulIdentifier", + "src": "6027:6:17" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "6018:3:17", + "nodeType": "YulIdentifier", + "src": "6018:3:17" + }, + "nativeSrc": "6018:16:17", + "nodeType": "YulFunctionCall", + "src": "6018:16:17" + }, + "variableNames": [ + { + "name": "fields", + "nativeSrc": "6008:6:17", + "nodeType": "YulIdentifier", + "src": "6008:6:17" + } + ] + }, + { + "nativeSrc": "6089:22:17", + "nodeType": "YulVariableDeclaration", + "src": "6089:22:17", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "6106:4:17", + "nodeType": "YulLiteral", + "src": "6106:4:17", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "6100:5:17", + "nodeType": "YulIdentifier", + "src": "6100:5:17" + }, + "nativeSrc": "6100:11:17", + "nodeType": "YulFunctionCall", + "src": "6100:11:17" + }, + "variables": [ + { + "name": "fmp", + "nativeSrc": "6093:3:17", + "nodeType": "YulTypedName", + "src": "6093:3:17", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "6131:3:17", + "nodeType": "YulIdentifier", + "src": "6131:3:17" + }, + { + "name": "domainTypeHash", + "nativeSrc": "6136:14:17", + "nodeType": "YulIdentifier", + "src": "6136:14:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6124:6:17", + "nodeType": "YulIdentifier", + "src": "6124:6:17" + }, + "nativeSrc": "6124:27:17", + "nodeType": "YulFunctionCall", + "src": "6124:27:17" + }, + "nativeSrc": "6124:27:17", + "nodeType": "YulExpressionStatement", + "src": "6124:27:17" + }, + { + "nativeSrc": "6165:25:17", + "nodeType": "YulVariableDeclaration", + "src": "6165:25:17", + "value": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "6180:3:17", + "nodeType": "YulIdentifier", + "src": "6180:3:17" + }, + { + "kind": "number", + "nativeSrc": "6185:4:17", + "nodeType": "YulLiteral", + "src": "6185:4:17", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6176:3:17", + "nodeType": "YulIdentifier", + "src": "6176:3:17" + }, + "nativeSrc": "6176:14:17", + "nodeType": "YulFunctionCall", + "src": "6176:14:17" + }, + "variables": [ + { + "name": "ptr", + "nativeSrc": "6169:3:17", + "nodeType": "YulTypedName", + "src": "6169:3:17", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "6224:91:17", + "nodeType": "YulBlock", + "src": "6224:91:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6249:3:17", + "nodeType": "YulIdentifier", + "src": "6249:3:17" + }, + { + "name": "nameHash", + "nativeSrc": "6254:8:17", + "nodeType": "YulIdentifier", + "src": "6254:8:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6242:6:17", + "nodeType": "YulIdentifier", + "src": "6242:6:17" + }, + "nativeSrc": "6242:21:17", + "nodeType": "YulFunctionCall", + "src": "6242:21:17" + }, + "nativeSrc": "6242:21:17", + "nodeType": "YulExpressionStatement", + "src": "6242:21:17" + }, + { + "nativeSrc": "6280:21:17", + "nodeType": "YulAssignment", + "src": "6280:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6291:3:17", + "nodeType": "YulIdentifier", + "src": "6291:3:17" + }, + { + "kind": "number", + "nativeSrc": "6296:4:17", + "nodeType": "YulLiteral", + "src": "6296:4:17", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6287:3:17", + "nodeType": "YulIdentifier", + "src": "6287:3:17" + }, + "nativeSrc": "6287:14:17", + "nodeType": "YulFunctionCall", + "src": "6287:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "6280:3:17", + "nodeType": "YulIdentifier", + "src": "6280:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "6210:6:17", + "nodeType": "YulIdentifier", + "src": "6210:6:17" + }, + { + "kind": "number", + "nativeSrc": "6218:4:17", + "nodeType": "YulLiteral", + "src": "6218:4:17", + "type": "", + "value": "0x01" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "6206:3:17", + "nodeType": "YulIdentifier", + "src": "6206:3:17" + }, + "nativeSrc": "6206:17:17", + "nodeType": "YulFunctionCall", + "src": "6206:17:17" + }, + "nativeSrc": "6203:112:17", + "nodeType": "YulIf", + "src": "6203:112:17" + }, + { + "body": { + "nativeSrc": "6349:94:17", + "nodeType": "YulBlock", + "src": "6349:94:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6374:3:17", + "nodeType": "YulIdentifier", + "src": "6374:3:17" + }, + { + "name": "versionHash", + "nativeSrc": "6379:11:17", + "nodeType": "YulIdentifier", + "src": "6379:11:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6367:6:17", + "nodeType": "YulIdentifier", + "src": "6367:6:17" + }, + "nativeSrc": "6367:24:17", + "nodeType": "YulFunctionCall", + "src": "6367:24:17" + }, + "nativeSrc": "6367:24:17", + "nodeType": "YulExpressionStatement", + "src": "6367:24:17" + }, + { + "nativeSrc": "6408:21:17", + "nodeType": "YulAssignment", + "src": "6408:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6419:3:17", + "nodeType": "YulIdentifier", + "src": "6419:3:17" + }, + { + "kind": "number", + "nativeSrc": "6424:4:17", + "nodeType": "YulLiteral", + "src": "6424:4:17", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6415:3:17", + "nodeType": "YulIdentifier", + "src": "6415:3:17" + }, + "nativeSrc": "6415:14:17", + "nodeType": "YulFunctionCall", + "src": "6415:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "6408:3:17", + "nodeType": "YulIdentifier", + "src": "6408:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "6335:6:17", + "nodeType": "YulIdentifier", + "src": "6335:6:17" + }, + { + "kind": "number", + "nativeSrc": "6343:4:17", + "nodeType": "YulLiteral", + "src": "6343:4:17", + "type": "", + "value": "0x02" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "6331:3:17", + "nodeType": "YulIdentifier", + "src": "6331:3:17" + }, + "nativeSrc": "6331:17:17", + "nodeType": "YulFunctionCall", + "src": "6331:17:17" + }, + "nativeSrc": "6328:115:17", + "nodeType": "YulIf", + "src": "6328:115:17" + }, + { + "body": { + "nativeSrc": "6477:90:17", + "nodeType": "YulBlock", + "src": "6477:90:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6502:3:17", + "nodeType": "YulIdentifier", + "src": "6502:3:17" + }, + { + "name": "chainId", + "nativeSrc": "6507:7:17", + "nodeType": "YulIdentifier", + "src": "6507:7:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6495:6:17", + "nodeType": "YulIdentifier", + "src": "6495:6:17" + }, + "nativeSrc": "6495:20:17", + "nodeType": "YulFunctionCall", + "src": "6495:20:17" + }, + "nativeSrc": "6495:20:17", + "nodeType": "YulExpressionStatement", + "src": "6495:20:17" + }, + { + "nativeSrc": "6532:21:17", + "nodeType": "YulAssignment", + "src": "6532:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6543:3:17", + "nodeType": "YulIdentifier", + "src": "6543:3:17" + }, + { + "kind": "number", + "nativeSrc": "6548:4:17", + "nodeType": "YulLiteral", + "src": "6548:4:17", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6539:3:17", + "nodeType": "YulIdentifier", + "src": "6539:3:17" + }, + "nativeSrc": "6539:14:17", + "nodeType": "YulFunctionCall", + "src": "6539:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "6532:3:17", + "nodeType": "YulIdentifier", + "src": "6532:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "6463:6:17", + "nodeType": "YulIdentifier", + "src": "6463:6:17" + }, + { + "kind": "number", + "nativeSrc": "6471:4:17", + "nodeType": "YulLiteral", + "src": "6471:4:17", + "type": "", + "value": "0x04" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "6459:3:17", + "nodeType": "YulIdentifier", + "src": "6459:3:17" + }, + "nativeSrc": "6459:17:17", + "nodeType": "YulFunctionCall", + "src": "6459:17:17" + }, + "nativeSrc": "6456:111:17", + "nodeType": "YulIf", + "src": "6456:111:17" + }, + { + "body": { + "nativeSrc": "6601:100:17", + "nodeType": "YulBlock", + "src": "6601:100:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6626:3:17", + "nodeType": "YulIdentifier", + "src": "6626:3:17" + }, + { + "name": "verifyingContract", + "nativeSrc": "6631:17:17", + "nodeType": "YulIdentifier", + "src": "6631:17:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6619:6:17", + "nodeType": "YulIdentifier", + "src": "6619:6:17" + }, + "nativeSrc": "6619:30:17", + "nodeType": "YulFunctionCall", + "src": "6619:30:17" + }, + "nativeSrc": "6619:30:17", + "nodeType": "YulExpressionStatement", + "src": "6619:30:17" + }, + { + "nativeSrc": "6666:21:17", + "nodeType": "YulAssignment", + "src": "6666:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6677:3:17", + "nodeType": "YulIdentifier", + "src": "6677:3:17" + }, + { + "kind": "number", + "nativeSrc": "6682:4:17", + "nodeType": "YulLiteral", + "src": "6682:4:17", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6673:3:17", + "nodeType": "YulIdentifier", + "src": "6673:3:17" + }, + "nativeSrc": "6673:14:17", + "nodeType": "YulFunctionCall", + "src": "6673:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "6666:3:17", + "nodeType": "YulIdentifier", + "src": "6666:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "6587:6:17", + "nodeType": "YulIdentifier", + "src": "6587:6:17" + }, + { + "kind": "number", + "nativeSrc": "6595:4:17", + "nodeType": "YulLiteral", + "src": "6595:4:17", + "type": "", + "value": "0x08" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "6583:3:17", + "nodeType": "YulIdentifier", + "src": "6583:3:17" + }, + "nativeSrc": "6583:17:17", + "nodeType": "YulFunctionCall", + "src": "6583:17:17" + }, + "nativeSrc": "6580:121:17", + "nodeType": "YulIf", + "src": "6580:121:17" + }, + { + "body": { + "nativeSrc": "6735:87:17", + "nodeType": "YulBlock", + "src": "6735:87:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6760:3:17", + "nodeType": "YulIdentifier", + "src": "6760:3:17" + }, + { + "name": "salt", + "nativeSrc": "6765:4:17", + "nodeType": "YulIdentifier", + "src": "6765:4:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6753:6:17", + "nodeType": "YulIdentifier", + "src": "6753:6:17" + }, + "nativeSrc": "6753:17:17", + "nodeType": "YulFunctionCall", + "src": "6753:17:17" + }, + "nativeSrc": "6753:17:17", + "nodeType": "YulExpressionStatement", + "src": "6753:17:17" + }, + { + "nativeSrc": "6787:21:17", + "nodeType": "YulAssignment", + "src": "6787:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6798:3:17", + "nodeType": "YulIdentifier", + "src": "6798:3:17" + }, + { + "kind": "number", + "nativeSrc": "6803:4:17", + "nodeType": "YulLiteral", + "src": "6803:4:17", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6794:3:17", + "nodeType": "YulIdentifier", + "src": "6794:3:17" + }, + "nativeSrc": "6794:14:17", + "nodeType": "YulFunctionCall", + "src": "6794:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "6787:3:17", + "nodeType": "YulIdentifier", + "src": "6787:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "6721:6:17", + "nodeType": "YulIdentifier", + "src": "6721:6:17" + }, + { + "kind": "number", + "nativeSrc": "6729:4:17", + "nodeType": "YulLiteral", + "src": "6729:4:17", + "type": "", + "value": "0x10" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "6717:3:17", + "nodeType": "YulIdentifier", + "src": "6717:3:17" + }, + "nativeSrc": "6717:17:17", + "nodeType": "YulFunctionCall", + "src": "6717:17:17" + }, + "nativeSrc": "6714:108:17", + "nodeType": "YulIf", + "src": "6714:108:17" + }, + { + "nativeSrc": "6836:37:17", + "nodeType": "YulAssignment", + "src": "6836:37:17", + "value": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "6854:3:17", + "nodeType": "YulIdentifier", + "src": "6854:3:17" + }, + { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6863:3:17", + "nodeType": "YulIdentifier", + "src": "6863:3:17" + }, + { + "name": "fmp", + "nativeSrc": "6868:3:17", + "nodeType": "YulIdentifier", + "src": "6868:3:17" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "6859:3:17", + "nodeType": "YulIdentifier", + "src": "6859:3:17" + }, + "nativeSrc": "6859:13:17", + "nodeType": "YulFunctionCall", + "src": "6859:13:17" + } + ], + "functionName": { + "name": "keccak256", + "nativeSrc": "6844:9:17", + "nodeType": "YulIdentifier", + "src": "6844:9:17" + }, + "nativeSrc": "6844:29:17", + "nodeType": "YulFunctionCall", + "src": "6844:29:17" + }, + "variableNames": [ + { + "name": "hash", + "nativeSrc": "6836:4:17", + "nodeType": "YulIdentifier", + "src": "6836:4:17" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4498, + "isOffset": false, + "isSlot": false, + "src": "6507:7:17", + "valueSize": 1 + }, + { + "declaration": 4508, + "isOffset": false, + "isSlot": false, + "src": "6136:14:17", + "valueSize": 1 + }, + { + "declaration": 4492, + "isOffset": false, + "isSlot": false, + "src": "6008:6:17", + "valueSize": 1 + }, + { + "declaration": 4492, + "isOffset": false, + "isSlot": false, + "src": "6027:6:17", + "valueSize": 1 + }, + { + "declaration": 4492, + "isOffset": false, + "isSlot": false, + "src": "6210:6:17", + "valueSize": 1 + }, + { + "declaration": 4492, + "isOffset": false, + "isSlot": false, + "src": "6335:6:17", + "valueSize": 1 + }, + { + "declaration": 4492, + "isOffset": false, + "isSlot": false, + "src": "6463:6:17", + "valueSize": 1 + }, + { + "declaration": 4492, + "isOffset": false, + "isSlot": false, + "src": "6587:6:17", + "valueSize": 1 + }, + { + "declaration": 4492, + "isOffset": false, + "isSlot": false, + "src": "6721:6:17", + "valueSize": 1 + }, + { + "declaration": 4505, + "isOffset": false, + "isSlot": false, + "src": "6836:4:17", + "valueSize": 1 + }, + { + "declaration": 4494, + "isOffset": false, + "isSlot": false, + "src": "6254:8:17", + "valueSize": 1 + }, + { + "declaration": 4502, + "isOffset": false, + "isSlot": false, + "src": "6765:4:17", + "valueSize": 1 + }, + { + "declaration": 4500, + "isOffset": false, + "isSlot": false, + "src": "6631:17:17", + "valueSize": 1 + }, + { + "declaration": 4496, + "isOffset": false, + "isSlot": false, + "src": "6379:11:17", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4513, + "nodeType": "InlineAssembly", + "src": "5908:975:17" + } + ] + }, + "documentation": { + "id": 4490, + "nodeType": "StructuredDocumentation", + "src": "5484:119:17", + "text": "@dev Variant of {toDomainSeparator-bytes1-string-string-uint256-address-bytes32} that uses hashed name and version." + }, + "id": 4515, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toDomainSeparator", + "nameLocation": "5617:17:17", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4503, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4492, + "mutability": "mutable", + "name": "fields", + "nameLocation": "5651:6:17", + "nodeType": "VariableDeclaration", + "scope": 4515, + "src": "5644:13:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 4491, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "5644:6:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4494, + "mutability": "mutable", + "name": "nameHash", + "nameLocation": "5675:8:17", + "nodeType": "VariableDeclaration", + "scope": 4515, + "src": "5667:16:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4493, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5667:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4496, + "mutability": "mutable", + "name": "versionHash", + "nameLocation": "5701:11:17", + "nodeType": "VariableDeclaration", + "scope": 4515, + "src": "5693:19:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4495, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5693:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4498, + "mutability": "mutable", + "name": "chainId", + "nameLocation": "5730:7:17", + "nodeType": "VariableDeclaration", + "scope": 4515, + "src": "5722:15:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4497, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5722:7:17", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4500, + "mutability": "mutable", + "name": "verifyingContract", + "nameLocation": "5755:17:17", + "nodeType": "VariableDeclaration", + "scope": 4515, + "src": "5747:25:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 4499, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5747:7:17", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4502, + "mutability": "mutable", + "name": "salt", + "nameLocation": "5790:4:17", + "nodeType": "VariableDeclaration", + "scope": 4515, + "src": "5782:12:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4501, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5782:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "5634:166:17" + }, + "returnParameters": { + "id": 4506, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4505, + "mutability": "mutable", + "name": "hash", + "nameLocation": "5832:4:17", + "nodeType": "VariableDeclaration", + "scope": 4515, + "src": "5824:12:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4504, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5824:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "5823:14:17" + }, + "scope": 4535, + "src": "5608:1281:17", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4533, + "nodeType": "Block", + "src": "7117:1511:17", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "id": 4527, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "id": 4525, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4523, + "name": "fields", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4518, + "src": "7131:6:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30783230", + "id": 4524, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7140:4:17", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "0x20" + }, + "src": "7131:13:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30783230", + "id": 4526, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7148:4:17", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "0x20" + }, + "src": "7131:21:17", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4531, + "nodeType": "IfStatement", + "src": "7127:65:17", + "trueBody": { + "errorCall": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 4528, + "name": "ERC5267ExtensionsNotSupported", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4371, + "src": "7161:29:17", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$__$returns$_t_error_$", + "typeString": "function () pure returns (error)" + } + }, + "id": 4529, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7161:31:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 4530, + "nodeType": "RevertStatement", + "src": "7154:38:17" + } + }, + { + "AST": { + "nativeSrc": "7228:1394:17", + "nodeType": "YulBlock", + "src": "7228:1394:17", + "statements": [ + { + "nativeSrc": "7303:26:17", + "nodeType": "YulAssignment", + "src": "7303:26:17", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "7317:3:17", + "nodeType": "YulLiteral", + "src": "7317:3:17", + "type": "", + "value": "248" + }, + { + "name": "fields", + "nativeSrc": "7322:6:17", + "nodeType": "YulIdentifier", + "src": "7322:6:17" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "7313:3:17", + "nodeType": "YulIdentifier", + "src": "7313:3:17" + }, + "nativeSrc": "7313:16:17", + "nodeType": "YulFunctionCall", + "src": "7313:16:17" + }, + "variableNames": [ + { + "name": "fields", + "nativeSrc": "7303:6:17", + "nodeType": "YulIdentifier", + "src": "7303:6:17" + } + ] + }, + { + "nativeSrc": "7384:22:17", + "nodeType": "YulVariableDeclaration", + "src": "7384:22:17", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "7401:4:17", + "nodeType": "YulLiteral", + "src": "7401:4:17", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "7395:5:17", + "nodeType": "YulIdentifier", + "src": "7395:5:17" + }, + "nativeSrc": "7395:11:17", + "nodeType": "YulFunctionCall", + "src": "7395:11:17" + }, + "variables": [ + { + "name": "fmp", + "nativeSrc": "7388:3:17", + "nodeType": "YulTypedName", + "src": "7388:3:17", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "7426:3:17", + "nodeType": "YulIdentifier", + "src": "7426:3:17" + }, + { + "hexValue": "454950373132446f6d61696e28", + "kind": "string", + "nativeSrc": "7431:15:17", + "nodeType": "YulLiteral", + "src": "7431:15:17", + "type": "", + "value": "EIP712Domain(" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7419:6:17", + "nodeType": "YulIdentifier", + "src": "7419:6:17" + }, + "nativeSrc": "7419:28:17", + "nodeType": "YulFunctionCall", + "src": "7419:28:17" + }, + "nativeSrc": "7419:28:17", + "nodeType": "YulExpressionStatement", + "src": "7419:28:17" + }, + { + "nativeSrc": "7461:25:17", + "nodeType": "YulVariableDeclaration", + "src": "7461:25:17", + "value": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "7476:3:17", + "nodeType": "YulIdentifier", + "src": "7476:3:17" + }, + { + "kind": "number", + "nativeSrc": "7481:4:17", + "nodeType": "YulLiteral", + "src": "7481:4:17", + "type": "", + "value": "0x0d" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7472:3:17", + "nodeType": "YulIdentifier", + "src": "7472:3:17" + }, + "nativeSrc": "7472:14:17", + "nodeType": "YulFunctionCall", + "src": "7472:14:17" + }, + "variables": [ + { + "name": "ptr", + "nativeSrc": "7465:3:17", + "nodeType": "YulTypedName", + "src": "7465:3:17", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "7546:97:17", + "nodeType": "YulBlock", + "src": "7546:97:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "7571:3:17", + "nodeType": "YulIdentifier", + "src": "7571:3:17" + }, + { + "hexValue": "737472696e67206e616d652c", + "kind": "string", + "nativeSrc": "7576:14:17", + "nodeType": "YulLiteral", + "src": "7576:14:17", + "type": "", + "value": "string name," + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7564:6:17", + "nodeType": "YulIdentifier", + "src": "7564:6:17" + }, + "nativeSrc": "7564:27:17", + "nodeType": "YulFunctionCall", + "src": "7564:27:17" + }, + "nativeSrc": "7564:27:17", + "nodeType": "YulExpressionStatement", + "src": "7564:27:17" + }, + { + "nativeSrc": "7608:21:17", + "nodeType": "YulAssignment", + "src": "7608:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "7619:3:17", + "nodeType": "YulIdentifier", + "src": "7619:3:17" + }, + { + "kind": "number", + "nativeSrc": "7624:4:17", + "nodeType": "YulLiteral", + "src": "7624:4:17", + "type": "", + "value": "0x0c" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7615:3:17", + "nodeType": "YulIdentifier", + "src": "7615:3:17" + }, + "nativeSrc": "7615:14:17", + "nodeType": "YulFunctionCall", + "src": "7615:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "7608:3:17", + "nodeType": "YulIdentifier", + "src": "7608:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "7532:6:17", + "nodeType": "YulIdentifier", + "src": "7532:6:17" + }, + { + "kind": "number", + "nativeSrc": "7540:4:17", + "nodeType": "YulLiteral", + "src": "7540:4:17", + "type": "", + "value": "0x01" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "7528:3:17", + "nodeType": "YulIdentifier", + "src": "7528:3:17" + }, + "nativeSrc": "7528:17:17", + "nodeType": "YulFunctionCall", + "src": "7528:17:17" + }, + "nativeSrc": "7525:118:17", + "nodeType": "YulIf", + "src": "7525:118:17" + }, + { + "body": { + "nativeSrc": "7706:100:17", + "nodeType": "YulBlock", + "src": "7706:100:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "7731:3:17", + "nodeType": "YulIdentifier", + "src": "7731:3:17" + }, + { + "hexValue": "737472696e672076657273696f6e2c", + "kind": "string", + "nativeSrc": "7736:17:17", + "nodeType": "YulLiteral", + "src": "7736:17:17", + "type": "", + "value": "string version," + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7724:6:17", + "nodeType": "YulIdentifier", + "src": "7724:6:17" + }, + "nativeSrc": "7724:30:17", + "nodeType": "YulFunctionCall", + "src": "7724:30:17" + }, + "nativeSrc": "7724:30:17", + "nodeType": "YulExpressionStatement", + "src": "7724:30:17" + }, + { + "nativeSrc": "7771:21:17", + "nodeType": "YulAssignment", + "src": "7771:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "7782:3:17", + "nodeType": "YulIdentifier", + "src": "7782:3:17" + }, + { + "kind": "number", + "nativeSrc": "7787:4:17", + "nodeType": "YulLiteral", + "src": "7787:4:17", + "type": "", + "value": "0x0f" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7778:3:17", + "nodeType": "YulIdentifier", + "src": "7778:3:17" + }, + "nativeSrc": "7778:14:17", + "nodeType": "YulFunctionCall", + "src": "7778:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "7771:3:17", + "nodeType": "YulIdentifier", + "src": "7771:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "7692:6:17", + "nodeType": "YulIdentifier", + "src": "7692:6:17" + }, + { + "kind": "number", + "nativeSrc": "7700:4:17", + "nodeType": "YulLiteral", + "src": "7700:4:17", + "type": "", + "value": "0x02" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "7688:3:17", + "nodeType": "YulIdentifier", + "src": "7688:3:17" + }, + "nativeSrc": "7688:17:17", + "nodeType": "YulFunctionCall", + "src": "7688:17:17" + }, + "nativeSrc": "7685:121:17", + "nodeType": "YulIf", + "src": "7685:121:17" + }, + { + "body": { + "nativeSrc": "7869:101:17", + "nodeType": "YulBlock", + "src": "7869:101:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "7894:3:17", + "nodeType": "YulIdentifier", + "src": "7894:3:17" + }, + { + "hexValue": "75696e7432353620636861696e49642c", + "kind": "string", + "nativeSrc": "7899:18:17", + "nodeType": "YulLiteral", + "src": "7899:18:17", + "type": "", + "value": "uint256 chainId," + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7887:6:17", + "nodeType": "YulIdentifier", + "src": "7887:6:17" + }, + "nativeSrc": "7887:31:17", + "nodeType": "YulFunctionCall", + "src": "7887:31:17" + }, + "nativeSrc": "7887:31:17", + "nodeType": "YulExpressionStatement", + "src": "7887:31:17" + }, + { + "nativeSrc": "7935:21:17", + "nodeType": "YulAssignment", + "src": "7935:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "7946:3:17", + "nodeType": "YulIdentifier", + "src": "7946:3:17" + }, + { + "kind": "number", + "nativeSrc": "7951:4:17", + "nodeType": "YulLiteral", + "src": "7951:4:17", + "type": "", + "value": "0x10" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7942:3:17", + "nodeType": "YulIdentifier", + "src": "7942:3:17" + }, + "nativeSrc": "7942:14:17", + "nodeType": "YulFunctionCall", + "src": "7942:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "7935:3:17", + "nodeType": "YulIdentifier", + "src": "7935:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "7855:6:17", + "nodeType": "YulIdentifier", + "src": "7855:6:17" + }, + { + "kind": "number", + "nativeSrc": "7863:4:17", + "nodeType": "YulLiteral", + "src": "7863:4:17", + "type": "", + "value": "0x04" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "7851:3:17", + "nodeType": "YulIdentifier", + "src": "7851:3:17" + }, + "nativeSrc": "7851:17:17", + "nodeType": "YulFunctionCall", + "src": "7851:17:17" + }, + "nativeSrc": "7848:122:17", + "nodeType": "YulIf", + "src": "7848:122:17" + }, + { + "body": { + "nativeSrc": "8043:111:17", + "nodeType": "YulBlock", + "src": "8043:111:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "8068:3:17", + "nodeType": "YulIdentifier", + "src": "8068:3:17" + }, + { + "hexValue": "6164647265737320766572696679696e67436f6e74726163742c", + "kind": "string", + "nativeSrc": "8073:28:17", + "nodeType": "YulLiteral", + "src": "8073:28:17", + "type": "", + "value": "address verifyingContract," + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8061:6:17", + "nodeType": "YulIdentifier", + "src": "8061:6:17" + }, + "nativeSrc": "8061:41:17", + "nodeType": "YulFunctionCall", + "src": "8061:41:17" + }, + "nativeSrc": "8061:41:17", + "nodeType": "YulExpressionStatement", + "src": "8061:41:17" + }, + { + "nativeSrc": "8119:21:17", + "nodeType": "YulAssignment", + "src": "8119:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "8130:3:17", + "nodeType": "YulIdentifier", + "src": "8130:3:17" + }, + { + "kind": "number", + "nativeSrc": "8135:4:17", + "nodeType": "YulLiteral", + "src": "8135:4:17", + "type": "", + "value": "0x1a" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8126:3:17", + "nodeType": "YulIdentifier", + "src": "8126:3:17" + }, + "nativeSrc": "8126:14:17", + "nodeType": "YulFunctionCall", + "src": "8126:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "8119:3:17", + "nodeType": "YulIdentifier", + "src": "8119:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "8029:6:17", + "nodeType": "YulIdentifier", + "src": "8029:6:17" + }, + { + "kind": "number", + "nativeSrc": "8037:4:17", + "nodeType": "YulLiteral", + "src": "8037:4:17", + "type": "", + "value": "0x08" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "8025:3:17", + "nodeType": "YulIdentifier", + "src": "8025:3:17" + }, + "nativeSrc": "8025:17:17", + "nodeType": "YulFunctionCall", + "src": "8025:17:17" + }, + "nativeSrc": "8022:132:17", + "nodeType": "YulIf", + "src": "8022:132:17" + }, + { + "body": { + "nativeSrc": "8214:98:17", + "nodeType": "YulBlock", + "src": "8214:98:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "8239:3:17", + "nodeType": "YulIdentifier", + "src": "8239:3:17" + }, + { + "hexValue": "627974657333322073616c742c", + "kind": "string", + "nativeSrc": "8244:15:17", + "nodeType": "YulLiteral", + "src": "8244:15:17", + "type": "", + "value": "bytes32 salt," + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8232:6:17", + "nodeType": "YulIdentifier", + "src": "8232:6:17" + }, + "nativeSrc": "8232:28:17", + "nodeType": "YulFunctionCall", + "src": "8232:28:17" + }, + "nativeSrc": "8232:28:17", + "nodeType": "YulExpressionStatement", + "src": "8232:28:17" + }, + { + "nativeSrc": "8277:21:17", + "nodeType": "YulAssignment", + "src": "8277:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "8288:3:17", + "nodeType": "YulIdentifier", + "src": "8288:3:17" + }, + { + "kind": "number", + "nativeSrc": "8293:4:17", + "nodeType": "YulLiteral", + "src": "8293:4:17", + "type": "", + "value": "0x0d" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8284:3:17", + "nodeType": "YulIdentifier", + "src": "8284:3:17" + }, + "nativeSrc": "8284:14:17", + "nodeType": "YulFunctionCall", + "src": "8284:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "8277:3:17", + "nodeType": "YulIdentifier", + "src": "8277:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "8200:6:17", + "nodeType": "YulIdentifier", + "src": "8200:6:17" + }, + { + "kind": "number", + "nativeSrc": "8208:4:17", + "nodeType": "YulLiteral", + "src": "8208:4:17", + "type": "", + "value": "0x10" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "8196:3:17", + "nodeType": "YulIdentifier", + "src": "8196:3:17" + }, + "nativeSrc": "8196:17:17", + "nodeType": "YulFunctionCall", + "src": "8196:17:17" + }, + "nativeSrc": "8193:119:17", + "nodeType": "YulIf", + "src": "8193:119:17" + }, + { + "nativeSrc": "8391:50:17", + "nodeType": "YulAssignment", + "src": "8391:50:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "8402:3:17", + "nodeType": "YulIdentifier", + "src": "8402:3:17" + }, + { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "fields", + "nativeSrc": "8425:6:17", + "nodeType": "YulIdentifier", + "src": "8425:6:17" + }, + { + "kind": "number", + "nativeSrc": "8433:4:17", + "nodeType": "YulLiteral", + "src": "8433:4:17", + "type": "", + "value": "0x1f" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "8421:3:17", + "nodeType": "YulIdentifier", + "src": "8421:3:17" + }, + "nativeSrc": "8421:17:17", + "nodeType": "YulFunctionCall", + "src": "8421:17:17" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "8414:6:17", + "nodeType": "YulIdentifier", + "src": "8414:6:17" + }, + "nativeSrc": "8414:25:17", + "nodeType": "YulFunctionCall", + "src": "8414:25:17" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "8407:6:17", + "nodeType": "YulIdentifier", + "src": "8407:6:17" + }, + "nativeSrc": "8407:33:17", + "nodeType": "YulFunctionCall", + "src": "8407:33:17" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "8398:3:17", + "nodeType": "YulIdentifier", + "src": "8398:3:17" + }, + "nativeSrc": "8398:43:17", + "nodeType": "YulFunctionCall", + "src": "8398:43:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "8391:3:17", + "nodeType": "YulIdentifier", + "src": "8391:3:17" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "8499:3:17", + "nodeType": "YulIdentifier", + "src": "8499:3:17" + }, + { + "kind": "number", + "nativeSrc": "8504:4:17", + "nodeType": "YulLiteral", + "src": "8504:4:17", + "type": "", + "value": "0x29" + } + ], + "functionName": { + "name": "mstore8", + "nativeSrc": "8491:7:17", + "nodeType": "YulIdentifier", + "src": "8491:7:17" + }, + "nativeSrc": "8491:18:17", + "nodeType": "YulFunctionCall", + "src": "8491:18:17" + }, + "nativeSrc": "8491:18:17", + "nodeType": "YulExpressionStatement", + "src": "8491:18:17" + }, + { + "nativeSrc": "8543:18:17", + "nodeType": "YulAssignment", + "src": "8543:18:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "8554:3:17", + "nodeType": "YulIdentifier", + "src": "8554:3:17" + }, + { + "kind": "number", + "nativeSrc": "8559:1:17", + "nodeType": "YulLiteral", + "src": "8559:1:17", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8550:3:17", + "nodeType": "YulIdentifier", + "src": "8550:3:17" + }, + "nativeSrc": "8550:11:17", + "nodeType": "YulFunctionCall", + "src": "8550:11:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "8543:3:17", + "nodeType": "YulIdentifier", + "src": "8543:3:17" + } + ] + }, + { + "nativeSrc": "8575:37:17", + "nodeType": "YulAssignment", + "src": "8575:37:17", + "value": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "8593:3:17", + "nodeType": "YulIdentifier", + "src": "8593:3:17" + }, + { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "8602:3:17", + "nodeType": "YulIdentifier", + "src": "8602:3:17" + }, + { + "name": "fmp", + "nativeSrc": "8607:3:17", + "nodeType": "YulIdentifier", + "src": "8607:3:17" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "8598:3:17", + "nodeType": "YulIdentifier", + "src": "8598:3:17" + }, + "nativeSrc": "8598:13:17", + "nodeType": "YulFunctionCall", + "src": "8598:13:17" + } + ], + "functionName": { + "name": "keccak256", + "nativeSrc": "8583:9:17", + "nodeType": "YulIdentifier", + "src": "8583:9:17" + }, + "nativeSrc": "8583:29:17", + "nodeType": "YulFunctionCall", + "src": "8583:29:17" + }, + "variableNames": [ + { + "name": "hash", + "nativeSrc": "8575:4:17", + "nodeType": "YulIdentifier", + "src": "8575:4:17" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4518, + "isOffset": false, + "isSlot": false, + "src": "7303:6:17", + "valueSize": 1 + }, + { + "declaration": 4518, + "isOffset": false, + "isSlot": false, + "src": "7322:6:17", + "valueSize": 1 + }, + { + "declaration": 4518, + "isOffset": false, + "isSlot": false, + "src": "7532:6:17", + "valueSize": 1 + }, + { + "declaration": 4518, + "isOffset": false, + "isSlot": false, + "src": "7692:6:17", + "valueSize": 1 + }, + { + "declaration": 4518, + "isOffset": false, + "isSlot": false, + "src": "7855:6:17", + "valueSize": 1 + }, + { + "declaration": 4518, + "isOffset": false, + "isSlot": false, + "src": "8029:6:17", + "valueSize": 1 + }, + { + "declaration": 4518, + "isOffset": false, + "isSlot": false, + "src": "8200:6:17", + "valueSize": 1 + }, + { + "declaration": 4518, + "isOffset": false, + "isSlot": false, + "src": "8425:6:17", + "valueSize": 1 + }, + { + "declaration": 4521, + "isOffset": false, + "isSlot": false, + "src": "8575:4:17", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4532, + "nodeType": "InlineAssembly", + "src": "7203:1419:17" + } + ] + }, + "documentation": { + "id": 4516, + "nodeType": "StructuredDocumentation", + "src": "6895:139:17", + "text": "@dev Builds an EIP-712 domain type hash depending on the `fields` provided, following https://eips.ethereum.org/EIPS/eip-5267[ERC-5267]" + }, + "id": 4534, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toDomainTypeHash", + "nameLocation": "7048:16:17", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4519, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4518, + "mutability": "mutable", + "name": "fields", + "nameLocation": "7072:6:17", + "nodeType": "VariableDeclaration", + "scope": 4534, + "src": "7065:13:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 4517, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "7065:6:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + } + ], + "src": "7064:15:17" + }, + "returnParameters": { + "id": 4522, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4521, + "mutability": "mutable", + "name": "hash", + "nameLocation": "7111:4:17", + "nodeType": "VariableDeclaration", + "scope": 4534, + "src": "7103:12:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4520, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "7103:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "7102:14:17" + }, + "scope": 4535, + "src": "7039:1589:17", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + } + ], + "scope": 4536, + "src": "521:8109:17", + "usedErrors": [ + 4371 + ], + "usedEvents": [] + } + ], + "src": "123:8508:17" + }, + "id": 17 + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/introspection/IERC165.sol", + "exportedSymbols": { + "IERC165": [ + 4547 + ] + }, + "id": 4548, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 4537, + "literals": [ + "solidity", + ">=", + "0.4", + ".16" + ], + "nodeType": "PragmaDirective", + "src": "115:25:18" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "IERC165", + "contractDependencies": [], + "contractKind": "interface", + "documentation": { + "id": 4538, + "nodeType": "StructuredDocumentation", + "src": "142:280:18", + "text": " @dev Interface of the ERC-165 standard, as defined in the\n https://eips.ethereum.org/EIPS/eip-165[ERC].\n Implementers can declare support of contract interfaces, which can then be\n queried by others ({ERC165Checker}).\n For an implementation, see {ERC165}." + }, + "fullyImplemented": false, + "id": 4547, + "linearizedBaseContracts": [ + 4547 + ], + "name": "IERC165", + "nameLocation": "433:7:18", + "nodeType": "ContractDefinition", + "nodes": [ + { + "documentation": { + "id": 4539, + "nodeType": "StructuredDocumentation", + "src": "447:340:18", + "text": " @dev Returns true if this contract implements the interface defined by\n `interfaceId`. See the corresponding\n https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n to learn more about how these ids are created.\n This function call must use less than 30 000 gas." + }, + "functionSelector": "01ffc9a7", + "id": 4546, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "supportsInterface", + "nameLocation": "801:17:18", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4542, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4541, + "mutability": "mutable", + "name": "interfaceId", + "nameLocation": "826:11:18", + "nodeType": "VariableDeclaration", + "scope": 4546, + "src": "819:18:18", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "typeName": { + "id": 4540, + "name": "bytes4", + "nodeType": "ElementaryTypeName", + "src": "819:6:18", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "visibility": "internal" + } + ], + "src": "818:20:18" + }, + "returnParameters": { + "id": 4545, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4544, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4546, + "src": "862:4:18", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 4543, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "862:4:18", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "861:6:18" + }, + "scope": 4547, + "src": "792:76:18", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + } + ], + "scope": 4548, + "src": "423:447:18", + "usedErrors": [], + "usedEvents": [] + } + ], + "src": "115:756:18" + }, + "id": 18 + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/math/Math.sol", + "exportedSymbols": { + "Math": [ + 6204 + ], + "Panic": [ + 1714 + ], + "SafeCast": [ + 7969 + ] + }, + "id": 6205, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 4549, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "103:24:19" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/Panic.sol", + "file": "../Panic.sol", + "id": 4551, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 6205, + "sourceUnit": 1715, + "src": "129:35:19", + "symbolAliases": [ + { + "foreign": { + "id": 4550, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "137:5:19", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/math/SafeCast.sol", + "file": "./SafeCast.sol", + "id": 4553, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 6205, + "sourceUnit": 7970, + "src": "165:40:19", + "symbolAliases": [ + { + "foreign": { + "id": 4552, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "173:8:19", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "Math", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 4554, + "nodeType": "StructuredDocumentation", + "src": "207:73:19", + "text": " @dev Standard math utilities missing in the Solidity language." + }, + "fullyImplemented": true, + "id": 6204, + "linearizedBaseContracts": [ + 6204 + ], + "name": "Math", + "nameLocation": "289:4:19", + "nodeType": "ContractDefinition", + "nodes": [ + { + "canonicalName": "Math.Rounding", + "id": 4559, + "members": [ + { + "id": 4555, + "name": "Floor", + "nameLocation": "324:5:19", + "nodeType": "EnumValue", + "src": "324:5:19" + }, + { + "id": 4556, + "name": "Ceil", + "nameLocation": "367:4:19", + "nodeType": "EnumValue", + "src": "367:4:19" + }, + { + "id": 4557, + "name": "Trunc", + "nameLocation": "409:5:19", + "nodeType": "EnumValue", + "src": "409:5:19" + }, + { + "id": 4558, + "name": "Expand", + "nameLocation": "439:6:19", + "nodeType": "EnumValue", + "src": "439:6:19" + } + ], + "name": "Rounding", + "nameLocation": "305:8:19", + "nodeType": "EnumDefinition", + "src": "300:169:19" + }, + { + "body": { + "id": 4572, + "nodeType": "Block", + "src": "731:112:19", + "statements": [ + { + "AST": { + "nativeSrc": "766:71:19", + "nodeType": "YulBlock", + "src": "766:71:19", + "statements": [ + { + "nativeSrc": "780:16:19", + "nodeType": "YulAssignment", + "src": "780:16:19", + "value": { + "arguments": [ + { + "name": "a", + "nativeSrc": "791:1:19", + "nodeType": "YulIdentifier", + "src": "791:1:19" + }, + { + "name": "b", + "nativeSrc": "794:1:19", + "nodeType": "YulIdentifier", + "src": "794:1:19" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "787:3:19", + "nodeType": "YulIdentifier", + "src": "787:3:19" + }, + "nativeSrc": "787:9:19", + "nodeType": "YulFunctionCall", + "src": "787:9:19" + }, + "variableNames": [ + { + "name": "low", + "nativeSrc": "780:3:19", + "nodeType": "YulIdentifier", + "src": "780:3:19" + } + ] + }, + { + "nativeSrc": "809:18:19", + "nodeType": "YulAssignment", + "src": "809:18:19", + "value": { + "arguments": [ + { + "name": "low", + "nativeSrc": "820:3:19", + "nodeType": "YulIdentifier", + "src": "820:3:19" + }, + { + "name": "a", + "nativeSrc": "825:1:19", + "nodeType": "YulIdentifier", + "src": "825:1:19" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "817:2:19", + "nodeType": "YulIdentifier", + "src": "817:2:19" + }, + "nativeSrc": "817:10:19", + "nodeType": "YulFunctionCall", + "src": "817:10:19" + }, + "variableNames": [ + { + "name": "high", + "nativeSrc": "809:4:19", + "nodeType": "YulIdentifier", + "src": "809:4:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4562, + "isOffset": false, + "isSlot": false, + "src": "791:1:19", + "valueSize": 1 + }, + { + "declaration": 4562, + "isOffset": false, + "isSlot": false, + "src": "825:1:19", + "valueSize": 1 + }, + { + "declaration": 4564, + "isOffset": false, + "isSlot": false, + "src": "794:1:19", + "valueSize": 1 + }, + { + "declaration": 4567, + "isOffset": false, + "isSlot": false, + "src": "809:4:19", + "valueSize": 1 + }, + { + "declaration": 4569, + "isOffset": false, + "isSlot": false, + "src": "780:3:19", + "valueSize": 1 + }, + { + "declaration": 4569, + "isOffset": false, + "isSlot": false, + "src": "820:3:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4571, + "nodeType": "InlineAssembly", + "src": "741:96:19" + } + ] + }, + "documentation": { + "id": 4560, + "nodeType": "StructuredDocumentation", + "src": "475:163:19", + "text": " @dev Return the 512-bit addition of two uint256.\n The result is stored in two 256 variables such that sum = high * 2²⁵⁶ + low." + }, + "id": 4573, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "add512", + "nameLocation": "652:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4565, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4562, + "mutability": "mutable", + "name": "a", + "nameLocation": "667:1:19", + "nodeType": "VariableDeclaration", + "scope": 4573, + "src": "659:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4561, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "659:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4564, + "mutability": "mutable", + "name": "b", + "nameLocation": "678:1:19", + "nodeType": "VariableDeclaration", + "scope": 4573, + "src": "670:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4563, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "670:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "658:22:19" + }, + "returnParameters": { + "id": 4570, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4567, + "mutability": "mutable", + "name": "high", + "nameLocation": "712:4:19", + "nodeType": "VariableDeclaration", + "scope": 4573, + "src": "704:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4566, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "704:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4569, + "mutability": "mutable", + "name": "low", + "nameLocation": "726:3:19", + "nodeType": "VariableDeclaration", + "scope": 4573, + "src": "718:11:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4568, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "718:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "703:27:19" + }, + "scope": 6204, + "src": "643:200:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4586, + "nodeType": "Block", + "src": "1115:462:19", + "statements": [ + { + "AST": { + "nativeSrc": "1437:134:19", + "nodeType": "YulBlock", + "src": "1437:134:19", + "statements": [ + { + "nativeSrc": "1451:30:19", + "nodeType": "YulVariableDeclaration", + "src": "1451:30:19", + "value": { + "arguments": [ + { + "name": "a", + "nativeSrc": "1468:1:19", + "nodeType": "YulIdentifier", + "src": "1468:1:19" + }, + { + "name": "b", + "nativeSrc": "1471:1:19", + "nodeType": "YulIdentifier", + "src": "1471:1:19" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1478:1:19", + "nodeType": "YulLiteral", + "src": "1478:1:19", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "1474:3:19", + "nodeType": "YulIdentifier", + "src": "1474:3:19" + }, + "nativeSrc": "1474:6:19", + "nodeType": "YulFunctionCall", + "src": "1474:6:19" + } + ], + "functionName": { + "name": "mulmod", + "nativeSrc": "1461:6:19", + "nodeType": "YulIdentifier", + "src": "1461:6:19" + }, + "nativeSrc": "1461:20:19", + "nodeType": "YulFunctionCall", + "src": "1461:20:19" + }, + "variables": [ + { + "name": "mm", + "nativeSrc": "1455:2:19", + "nodeType": "YulTypedName", + "src": "1455:2:19", + "type": "" + } + ] + }, + { + "nativeSrc": "1494:16:19", + "nodeType": "YulAssignment", + "src": "1494:16:19", + "value": { + "arguments": [ + { + "name": "a", + "nativeSrc": "1505:1:19", + "nodeType": "YulIdentifier", + "src": "1505:1:19" + }, + { + "name": "b", + "nativeSrc": "1508:1:19", + "nodeType": "YulIdentifier", + "src": "1508:1:19" + } + ], + "functionName": { + "name": "mul", + "nativeSrc": "1501:3:19", + "nodeType": "YulIdentifier", + "src": "1501:3:19" + }, + "nativeSrc": "1501:9:19", + "nodeType": "YulFunctionCall", + "src": "1501:9:19" + }, + "variableNames": [ + { + "name": "low", + "nativeSrc": "1494:3:19", + "nodeType": "YulIdentifier", + "src": "1494:3:19" + } + ] + }, + { + "nativeSrc": "1523:38:19", + "nodeType": "YulAssignment", + "src": "1523:38:19", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "mm", + "nativeSrc": "1539:2:19", + "nodeType": "YulIdentifier", + "src": "1539:2:19" + }, + { + "name": "low", + "nativeSrc": "1543:3:19", + "nodeType": "YulIdentifier", + "src": "1543:3:19" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "1535:3:19", + "nodeType": "YulIdentifier", + "src": "1535:3:19" + }, + "nativeSrc": "1535:12:19", + "nodeType": "YulFunctionCall", + "src": "1535:12:19" + }, + { + "arguments": [ + { + "name": "mm", + "nativeSrc": "1552:2:19", + "nodeType": "YulIdentifier", + "src": "1552:2:19" + }, + { + "name": "low", + "nativeSrc": "1556:3:19", + "nodeType": "YulIdentifier", + "src": "1556:3:19" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "1549:2:19", + "nodeType": "YulIdentifier", + "src": "1549:2:19" + }, + "nativeSrc": "1549:11:19", + "nodeType": "YulFunctionCall", + "src": "1549:11:19" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "1531:3:19", + "nodeType": "YulIdentifier", + "src": "1531:3:19" + }, + "nativeSrc": "1531:30:19", + "nodeType": "YulFunctionCall", + "src": "1531:30:19" + }, + "variableNames": [ + { + "name": "high", + "nativeSrc": "1523:4:19", + "nodeType": "YulIdentifier", + "src": "1523:4:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4576, + "isOffset": false, + "isSlot": false, + "src": "1468:1:19", + "valueSize": 1 + }, + { + "declaration": 4576, + "isOffset": false, + "isSlot": false, + "src": "1505:1:19", + "valueSize": 1 + }, + { + "declaration": 4578, + "isOffset": false, + "isSlot": false, + "src": "1471:1:19", + "valueSize": 1 + }, + { + "declaration": 4578, + "isOffset": false, + "isSlot": false, + "src": "1508:1:19", + "valueSize": 1 + }, + { + "declaration": 4581, + "isOffset": false, + "isSlot": false, + "src": "1523:4:19", + "valueSize": 1 + }, + { + "declaration": 4583, + "isOffset": false, + "isSlot": false, + "src": "1494:3:19", + "valueSize": 1 + }, + { + "declaration": 4583, + "isOffset": false, + "isSlot": false, + "src": "1543:3:19", + "valueSize": 1 + }, + { + "declaration": 4583, + "isOffset": false, + "isSlot": false, + "src": "1556:3:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4585, + "nodeType": "InlineAssembly", + "src": "1412:159:19" + } + ] + }, + "documentation": { + "id": 4574, + "nodeType": "StructuredDocumentation", + "src": "849:173:19", + "text": " @dev Return the 512-bit multiplication of two uint256.\n The result is stored in two 256 variables such that product = high * 2²⁵⁶ + low." + }, + "id": 4587, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "mul512", + "nameLocation": "1036:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4579, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4576, + "mutability": "mutable", + "name": "a", + "nameLocation": "1051:1:19", + "nodeType": "VariableDeclaration", + "scope": 4587, + "src": "1043:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4575, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1043:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4578, + "mutability": "mutable", + "name": "b", + "nameLocation": "1062:1:19", + "nodeType": "VariableDeclaration", + "scope": 4587, + "src": "1054:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4577, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1054:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1042:22:19" + }, + "returnParameters": { + "id": 4584, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4581, + "mutability": "mutable", + "name": "high", + "nameLocation": "1096:4:19", + "nodeType": "VariableDeclaration", + "scope": 4587, + "src": "1088:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4580, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1088:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4583, + "mutability": "mutable", + "name": "low", + "nameLocation": "1110:3:19", + "nodeType": "VariableDeclaration", + "scope": 4587, + "src": "1102:11:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4582, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1102:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1087:27:19" + }, + "scope": 6204, + "src": "1027:550:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4621, + "nodeType": "Block", + "src": "1784:149:19", + "statements": [ + { + "id": 4620, + "nodeType": "UncheckedBlock", + "src": "1794:133:19", + "statements": [ + { + "assignments": [ + 4600 + ], + "declarations": [ + { + "constant": false, + "id": 4600, + "mutability": "mutable", + "name": "c", + "nameLocation": "1826:1:19", + "nodeType": "VariableDeclaration", + "scope": 4620, + "src": "1818:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4599, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1818:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 4604, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4603, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4601, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4590, + "src": "1830:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "id": 4602, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4592, + "src": "1834:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1830:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1818:17:19" + }, + { + "expression": { + "id": 4609, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4605, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4595, + "src": "1849:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4608, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4606, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4600, + "src": "1859:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "id": 4607, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4590, + "src": "1864:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1859:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "1849:16:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4610, + "nodeType": "ExpressionStatement", + "src": "1849:16:19" + }, + { + "expression": { + "id": 4618, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4611, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4597, + "src": "1879:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4617, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4612, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4600, + "src": "1888:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "arguments": [ + { + "id": 4615, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4595, + "src": "1908:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 4613, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "1892:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 4614, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "1901:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "1892:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 4616, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1892:24:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1888:28:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1879:37:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 4619, + "nodeType": "ExpressionStatement", + "src": "1879:37:19" + } + ] + } + ] + }, + "documentation": { + "id": 4588, + "nodeType": "StructuredDocumentation", + "src": "1583:105:19", + "text": " @dev Returns the addition of two unsigned integers, with a success flag (no overflow)." + }, + "id": 4622, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryAdd", + "nameLocation": "1702:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4593, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4590, + "mutability": "mutable", + "name": "a", + "nameLocation": "1717:1:19", + "nodeType": "VariableDeclaration", + "scope": 4622, + "src": "1709:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4589, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1709:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4592, + "mutability": "mutable", + "name": "b", + "nameLocation": "1728:1:19", + "nodeType": "VariableDeclaration", + "scope": 4622, + "src": "1720:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4591, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1720:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1708:22:19" + }, + "returnParameters": { + "id": 4598, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4595, + "mutability": "mutable", + "name": "success", + "nameLocation": "1759:7:19", + "nodeType": "VariableDeclaration", + "scope": 4622, + "src": "1754:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 4594, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "1754:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4597, + "mutability": "mutable", + "name": "result", + "nameLocation": "1776:6:19", + "nodeType": "VariableDeclaration", + "scope": 4622, + "src": "1768:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4596, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1768:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1753:30:19" + }, + "scope": 6204, + "src": "1693:240:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4656, + "nodeType": "Block", + "src": "2143:149:19", + "statements": [ + { + "id": 4655, + "nodeType": "UncheckedBlock", + "src": "2153:133:19", + "statements": [ + { + "assignments": [ + 4635 + ], + "declarations": [ + { + "constant": false, + "id": 4635, + "mutability": "mutable", + "name": "c", + "nameLocation": "2185:1:19", + "nodeType": "VariableDeclaration", + "scope": 4655, + "src": "2177:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4634, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2177:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 4639, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4638, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4636, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4625, + "src": "2189:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "id": 4637, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4627, + "src": "2193:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2189:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2177:17:19" + }, + { + "expression": { + "id": 4644, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4640, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4630, + "src": "2208:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4643, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4641, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4635, + "src": "2218:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<=", + "rightExpression": { + "id": 4642, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4625, + "src": "2223:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2218:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "2208:16:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4645, + "nodeType": "ExpressionStatement", + "src": "2208:16:19" + }, + { + "expression": { + "id": 4653, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4646, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4632, + "src": "2238:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4652, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4647, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4635, + "src": "2247:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "arguments": [ + { + "id": 4650, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4630, + "src": "2267:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 4648, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "2251:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 4649, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2260:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "2251:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 4651, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2251:24:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2247:28:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2238:37:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 4654, + "nodeType": "ExpressionStatement", + "src": "2238:37:19" + } + ] + } + ] + }, + "documentation": { + "id": 4623, + "nodeType": "StructuredDocumentation", + "src": "1939:108:19", + "text": " @dev Returns the subtraction of two unsigned integers, with a success flag (no overflow)." + }, + "id": 4657, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "trySub", + "nameLocation": "2061:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4628, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4625, + "mutability": "mutable", + "name": "a", + "nameLocation": "2076:1:19", + "nodeType": "VariableDeclaration", + "scope": 4657, + "src": "2068:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4624, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2068:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4627, + "mutability": "mutable", + "name": "b", + "nameLocation": "2087:1:19", + "nodeType": "VariableDeclaration", + "scope": 4657, + "src": "2079:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4626, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2079:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2067:22:19" + }, + "returnParameters": { + "id": 4633, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4630, + "mutability": "mutable", + "name": "success", + "nameLocation": "2118:7:19", + "nodeType": "VariableDeclaration", + "scope": 4657, + "src": "2113:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 4629, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "2113:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4632, + "mutability": "mutable", + "name": "result", + "nameLocation": "2135:6:19", + "nodeType": "VariableDeclaration", + "scope": 4657, + "src": "2127:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4631, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2127:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2112:30:19" + }, + "scope": 6204, + "src": "2052:240:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4686, + "nodeType": "Block", + "src": "2505:391:19", + "statements": [ + { + "id": 4685, + "nodeType": "UncheckedBlock", + "src": "2515:375:19", + "statements": [ + { + "assignments": [ + 4670 + ], + "declarations": [ + { + "constant": false, + "id": 4670, + "mutability": "mutable", + "name": "c", + "nameLocation": "2547:1:19", + "nodeType": "VariableDeclaration", + "scope": 4685, + "src": "2539:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4669, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2539:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 4674, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4673, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4671, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4660, + "src": "2551:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 4672, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4662, + "src": "2555:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2551:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2539:17:19" + }, + { + "AST": { + "nativeSrc": "2595:188:19", + "nodeType": "YulBlock", + "src": "2595:188:19", + "statements": [ + { + "nativeSrc": "2727:42:19", + "nodeType": "YulAssignment", + "src": "2727:42:19", + "value": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "c", + "nativeSrc": "2748:1:19", + "nodeType": "YulIdentifier", + "src": "2748:1:19" + }, + { + "name": "a", + "nativeSrc": "2751:1:19", + "nodeType": "YulIdentifier", + "src": "2751:1:19" + } + ], + "functionName": { + "name": "div", + "nativeSrc": "2744:3:19", + "nodeType": "YulIdentifier", + "src": "2744:3:19" + }, + "nativeSrc": "2744:9:19", + "nodeType": "YulFunctionCall", + "src": "2744:9:19" + }, + { + "name": "b", + "nativeSrc": "2755:1:19", + "nodeType": "YulIdentifier", + "src": "2755:1:19" + } + ], + "functionName": { + "name": "eq", + "nativeSrc": "2741:2:19", + "nodeType": "YulIdentifier", + "src": "2741:2:19" + }, + "nativeSrc": "2741:16:19", + "nodeType": "YulFunctionCall", + "src": "2741:16:19" + }, + { + "arguments": [ + { + "name": "a", + "nativeSrc": "2766:1:19", + "nodeType": "YulIdentifier", + "src": "2766:1:19" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "2759:6:19", + "nodeType": "YulIdentifier", + "src": "2759:6:19" + }, + "nativeSrc": "2759:9:19", + "nodeType": "YulFunctionCall", + "src": "2759:9:19" + } + ], + "functionName": { + "name": "or", + "nativeSrc": "2738:2:19", + "nodeType": "YulIdentifier", + "src": "2738:2:19" + }, + "nativeSrc": "2738:31:19", + "nodeType": "YulFunctionCall", + "src": "2738:31:19" + }, + "variableNames": [ + { + "name": "success", + "nativeSrc": "2727:7:19", + "nodeType": "YulIdentifier", + "src": "2727:7:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4660, + "isOffset": false, + "isSlot": false, + "src": "2751:1:19", + "valueSize": 1 + }, + { + "declaration": 4660, + "isOffset": false, + "isSlot": false, + "src": "2766:1:19", + "valueSize": 1 + }, + { + "declaration": 4662, + "isOffset": false, + "isSlot": false, + "src": "2755:1:19", + "valueSize": 1 + }, + { + "declaration": 4670, + "isOffset": false, + "isSlot": false, + "src": "2748:1:19", + "valueSize": 1 + }, + { + "declaration": 4665, + "isOffset": false, + "isSlot": false, + "src": "2727:7:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4675, + "nodeType": "InlineAssembly", + "src": "2570:213:19" + }, + { + "expression": { + "id": 4683, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4676, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4667, + "src": "2842:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4682, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4677, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4670, + "src": "2851:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "arguments": [ + { + "id": 4680, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4665, + "src": "2871:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 4678, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "2855:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 4679, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2864:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "2855:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 4681, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2855:24:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2851:28:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2842:37:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 4684, + "nodeType": "ExpressionStatement", + "src": "2842:37:19" + } + ] + } + ] + }, + "documentation": { + "id": 4658, + "nodeType": "StructuredDocumentation", + "src": "2298:111:19", + "text": " @dev Returns the multiplication of two unsigned integers, with a success flag (no overflow)." + }, + "id": 4687, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryMul", + "nameLocation": "2423:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4663, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4660, + "mutability": "mutable", + "name": "a", + "nameLocation": "2438:1:19", + "nodeType": "VariableDeclaration", + "scope": 4687, + "src": "2430:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4659, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2430:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4662, + "mutability": "mutable", + "name": "b", + "nameLocation": "2449:1:19", + "nodeType": "VariableDeclaration", + "scope": 4687, + "src": "2441:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4661, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2441:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2429:22:19" + }, + "returnParameters": { + "id": 4668, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4665, + "mutability": "mutable", + "name": "success", + "nameLocation": "2480:7:19", + "nodeType": "VariableDeclaration", + "scope": 4687, + "src": "2475:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 4664, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "2475:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4667, + "mutability": "mutable", + "name": "result", + "nameLocation": "2497:6:19", + "nodeType": "VariableDeclaration", + "scope": 4687, + "src": "2489:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4666, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2489:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2474:30:19" + }, + "scope": 6204, + "src": "2414:482:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4707, + "nodeType": "Block", + "src": "3111:231:19", + "statements": [ + { + "id": 4706, + "nodeType": "UncheckedBlock", + "src": "3121:215:19", + "statements": [ + { + "expression": { + "id": 4703, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4699, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4695, + "src": "3145:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4702, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4700, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4692, + "src": "3155:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 4701, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3159:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "3155:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "3145:15:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4704, + "nodeType": "ExpressionStatement", + "src": "3145:15:19" + }, + { + "AST": { + "nativeSrc": "3199:127:19", + "nodeType": "YulBlock", + "src": "3199:127:19", + "statements": [ + { + "nativeSrc": "3293:19:19", + "nodeType": "YulAssignment", + "src": "3293:19:19", + "value": { + "arguments": [ + { + "name": "a", + "nativeSrc": "3307:1:19", + "nodeType": "YulIdentifier", + "src": "3307:1:19" + }, + { + "name": "b", + "nativeSrc": "3310:1:19", + "nodeType": "YulIdentifier", + "src": "3310:1:19" + } + ], + "functionName": { + "name": "div", + "nativeSrc": "3303:3:19", + "nodeType": "YulIdentifier", + "src": "3303:3:19" + }, + "nativeSrc": "3303:9:19", + "nodeType": "YulFunctionCall", + "src": "3303:9:19" + }, + "variableNames": [ + { + "name": "result", + "nativeSrc": "3293:6:19", + "nodeType": "YulIdentifier", + "src": "3293:6:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4690, + "isOffset": false, + "isSlot": false, + "src": "3307:1:19", + "valueSize": 1 + }, + { + "declaration": 4692, + "isOffset": false, + "isSlot": false, + "src": "3310:1:19", + "valueSize": 1 + }, + { + "declaration": 4697, + "isOffset": false, + "isSlot": false, + "src": "3293:6:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4705, + "nodeType": "InlineAssembly", + "src": "3174:152:19" + } + ] + } + ] + }, + "documentation": { + "id": 4688, + "nodeType": "StructuredDocumentation", + "src": "2902:113:19", + "text": " @dev Returns the division of two unsigned integers, with a success flag (no division by zero)." + }, + "id": 4708, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryDiv", + "nameLocation": "3029:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4693, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4690, + "mutability": "mutable", + "name": "a", + "nameLocation": "3044:1:19", + "nodeType": "VariableDeclaration", + "scope": 4708, + "src": "3036:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4689, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3036:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4692, + "mutability": "mutable", + "name": "b", + "nameLocation": "3055:1:19", + "nodeType": "VariableDeclaration", + "scope": 4708, + "src": "3047:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4691, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3047:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3035:22:19" + }, + "returnParameters": { + "id": 4698, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4695, + "mutability": "mutable", + "name": "success", + "nameLocation": "3086:7:19", + "nodeType": "VariableDeclaration", + "scope": 4708, + "src": "3081:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 4694, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "3081:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4697, + "mutability": "mutable", + "name": "result", + "nameLocation": "3103:6:19", + "nodeType": "VariableDeclaration", + "scope": 4708, + "src": "3095:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4696, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3095:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3080:30:19" + }, + "scope": 6204, + "src": "3020:322:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4728, + "nodeType": "Block", + "src": "3567:231:19", + "statements": [ + { + "id": 4727, + "nodeType": "UncheckedBlock", + "src": "3577:215:19", + "statements": [ + { + "expression": { + "id": 4724, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4720, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4716, + "src": "3601:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4723, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4721, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4713, + "src": "3611:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 4722, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3615:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "3611:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "3601:15:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4725, + "nodeType": "ExpressionStatement", + "src": "3601:15:19" + }, + { + "AST": { + "nativeSrc": "3655:127:19", + "nodeType": "YulBlock", + "src": "3655:127:19", + "statements": [ + { + "nativeSrc": "3749:19:19", + "nodeType": "YulAssignment", + "src": "3749:19:19", + "value": { + "arguments": [ + { + "name": "a", + "nativeSrc": "3763:1:19", + "nodeType": "YulIdentifier", + "src": "3763:1:19" + }, + { + "name": "b", + "nativeSrc": "3766:1:19", + "nodeType": "YulIdentifier", + "src": "3766:1:19" + } + ], + "functionName": { + "name": "mod", + "nativeSrc": "3759:3:19", + "nodeType": "YulIdentifier", + "src": "3759:3:19" + }, + "nativeSrc": "3759:9:19", + "nodeType": "YulFunctionCall", + "src": "3759:9:19" + }, + "variableNames": [ + { + "name": "result", + "nativeSrc": "3749:6:19", + "nodeType": "YulIdentifier", + "src": "3749:6:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4711, + "isOffset": false, + "isSlot": false, + "src": "3763:1:19", + "valueSize": 1 + }, + { + "declaration": 4713, + "isOffset": false, + "isSlot": false, + "src": "3766:1:19", + "valueSize": 1 + }, + { + "declaration": 4718, + "isOffset": false, + "isSlot": false, + "src": "3749:6:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4726, + "nodeType": "InlineAssembly", + "src": "3630:152:19" + } + ] + } + ] + }, + "documentation": { + "id": 4709, + "nodeType": "StructuredDocumentation", + "src": "3348:123:19", + "text": " @dev Returns the remainder of dividing two unsigned integers, with a success flag (no division by zero)." + }, + "id": 4729, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryMod", + "nameLocation": "3485:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4714, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4711, + "mutability": "mutable", + "name": "a", + "nameLocation": "3500:1:19", + "nodeType": "VariableDeclaration", + "scope": 4729, + "src": "3492:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4710, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3492:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4713, + "mutability": "mutable", + "name": "b", + "nameLocation": "3511:1:19", + "nodeType": "VariableDeclaration", + "scope": 4729, + "src": "3503:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4712, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3503:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3491:22:19" + }, + "returnParameters": { + "id": 4719, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4716, + "mutability": "mutable", + "name": "success", + "nameLocation": "3542:7:19", + "nodeType": "VariableDeclaration", + "scope": 4729, + "src": "3537:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 4715, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "3537:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4718, + "mutability": "mutable", + "name": "result", + "nameLocation": "3559:6:19", + "nodeType": "VariableDeclaration", + "scope": 4729, + "src": "3551:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4717, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3551:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3536:30:19" + }, + "scope": 6204, + "src": "3476:322:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4758, + "nodeType": "Block", + "src": "3989:122:19", + "statements": [ + { + "assignments": [ + 4740, + 4742 + ], + "declarations": [ + { + "constant": false, + "id": 4740, + "mutability": "mutable", + "name": "success", + "nameLocation": "4005:7:19", + "nodeType": "VariableDeclaration", + "scope": 4758, + "src": "4000:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 4739, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "4000:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4742, + "mutability": "mutable", + "name": "result", + "nameLocation": "4022:6:19", + "nodeType": "VariableDeclaration", + "scope": 4758, + "src": "4014:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4741, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4014:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 4747, + "initialValue": { + "arguments": [ + { + "id": 4744, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4732, + "src": "4039:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 4745, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4734, + "src": "4042:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4743, + "name": "tryAdd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4622, + "src": "4032:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 4746, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4032:12:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3999:45:19" + }, + { + "expression": { + "arguments": [ + { + "id": 4749, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4740, + "src": "4069:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "id": 4750, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4742, + "src": "4078:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "arguments": [ + { + "id": 4753, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4091:7:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 4752, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4091:7:19", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + } + ], + "id": 4751, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "4086:4:19", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 4754, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4086:13:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint256", + "typeString": "type(uint256)" + } + }, + "id": 4755, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "4100:3:19", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "4086:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4748, + "name": "ternary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4836, + "src": "4061:7:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bool,uint256,uint256) pure returns (uint256)" + } + }, + "id": 4756, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4061:43:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4738, + "id": 4757, + "nodeType": "Return", + "src": "4054:50:19" + } + ] + }, + "documentation": { + "id": 4730, + "nodeType": "StructuredDocumentation", + "src": "3804:103:19", + "text": " @dev Unsigned saturating addition, bounds to `2²⁵⁶ - 1` instead of overflowing." + }, + "id": 4759, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "saturatingAdd", + "nameLocation": "3921:13:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4735, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4732, + "mutability": "mutable", + "name": "a", + "nameLocation": "3943:1:19", + "nodeType": "VariableDeclaration", + "scope": 4759, + "src": "3935:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4731, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3935:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4734, + "mutability": "mutable", + "name": "b", + "nameLocation": "3954:1:19", + "nodeType": "VariableDeclaration", + "scope": 4759, + "src": "3946:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4733, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3946:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3934:22:19" + }, + "returnParameters": { + "id": 4738, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4737, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4759, + "src": "3980:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4736, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3980:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3979:9:19" + }, + "scope": 6204, + "src": "3912:199:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4778, + "nodeType": "Block", + "src": "4294:73:19", + "statements": [ + { + "assignments": [ + null, + 4770 + ], + "declarations": [ + null, + { + "constant": false, + "id": 4770, + "mutability": "mutable", + "name": "result", + "nameLocation": "4315:6:19", + "nodeType": "VariableDeclaration", + "scope": 4778, + "src": "4307:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4769, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4307:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 4775, + "initialValue": { + "arguments": [ + { + "id": 4772, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4762, + "src": "4332:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 4773, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4764, + "src": "4335:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4771, + "name": "trySub", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4657, + "src": "4325:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 4774, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4325:12:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4304:33:19" + }, + { + "expression": { + "id": 4776, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4770, + "src": "4354:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4768, + "id": 4777, + "nodeType": "Return", + "src": "4347:13:19" + } + ] + }, + "documentation": { + "id": 4760, + "nodeType": "StructuredDocumentation", + "src": "4117:95:19", + "text": " @dev Unsigned saturating subtraction, bounds to zero instead of overflowing." + }, + "id": 4779, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "saturatingSub", + "nameLocation": "4226:13:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4765, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4762, + "mutability": "mutable", + "name": "a", + "nameLocation": "4248:1:19", + "nodeType": "VariableDeclaration", + "scope": 4779, + "src": "4240:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4761, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4240:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4764, + "mutability": "mutable", + "name": "b", + "nameLocation": "4259:1:19", + "nodeType": "VariableDeclaration", + "scope": 4779, + "src": "4251:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4763, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4251:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4239:22:19" + }, + "returnParameters": { + "id": 4768, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4767, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4779, + "src": "4285:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4766, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4285:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4284:9:19" + }, + "scope": 6204, + "src": "4217:150:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4808, + "nodeType": "Block", + "src": "4564:122:19", + "statements": [ + { + "assignments": [ + 4790, + 4792 + ], + "declarations": [ + { + "constant": false, + "id": 4790, + "mutability": "mutable", + "name": "success", + "nameLocation": "4580:7:19", + "nodeType": "VariableDeclaration", + "scope": 4808, + "src": "4575:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 4789, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "4575:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4792, + "mutability": "mutable", + "name": "result", + "nameLocation": "4597:6:19", + "nodeType": "VariableDeclaration", + "scope": 4808, + "src": "4589:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4791, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4589:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 4797, + "initialValue": { + "arguments": [ + { + "id": 4794, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4782, + "src": "4614:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 4795, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4784, + "src": "4617:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4793, + "name": "tryMul", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4687, + "src": "4607:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 4796, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4607:12:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4574:45:19" + }, + { + "expression": { + "arguments": [ + { + "id": 4799, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4790, + "src": "4644:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "id": 4800, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4792, + "src": "4653:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "arguments": [ + { + "id": 4803, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4666:7:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 4802, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4666:7:19", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + } + ], + "id": 4801, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "4661:4:19", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 4804, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4661:13:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint256", + "typeString": "type(uint256)" + } + }, + "id": 4805, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "4675:3:19", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "4661:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4798, + "name": "ternary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4836, + "src": "4636:7:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bool,uint256,uint256) pure returns (uint256)" + } + }, + "id": 4806, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4636:43:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4788, + "id": 4807, + "nodeType": "Return", + "src": "4629:50:19" + } + ] + }, + "documentation": { + "id": 4780, + "nodeType": "StructuredDocumentation", + "src": "4373:109:19", + "text": " @dev Unsigned saturating multiplication, bounds to `2²⁵⁶ - 1` instead of overflowing." + }, + "id": 4809, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "saturatingMul", + "nameLocation": "4496:13:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4785, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4782, + "mutability": "mutable", + "name": "a", + "nameLocation": "4518:1:19", + "nodeType": "VariableDeclaration", + "scope": 4809, + "src": "4510:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4781, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4510:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4784, + "mutability": "mutable", + "name": "b", + "nameLocation": "4529:1:19", + "nodeType": "VariableDeclaration", + "scope": 4809, + "src": "4521:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4783, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4521:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4509:22:19" + }, + "returnParameters": { + "id": 4788, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4787, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4809, + "src": "4555:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4786, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4555:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4554:9:19" + }, + "scope": 6204, + "src": "4487:199:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4835, + "nodeType": "Block", + "src": "5174:207:19", + "statements": [ + { + "id": 4834, + "nodeType": "UncheckedBlock", + "src": "5184:191:19", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4832, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4821, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4816, + "src": "5322:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "^", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4830, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4824, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4822, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4814, + "src": "5328:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "^", + "rightExpression": { + "id": 4823, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4816, + "src": "5332:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5328:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 4825, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "5327:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "arguments": [ + { + "id": 4828, + "name": "condition", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4812, + "src": "5353:9:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 4826, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "5337:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 4827, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5346:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "5337:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 4829, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5337:26:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5327:36:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 4831, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "5326:38:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5322:42:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4820, + "id": 4833, + "nodeType": "Return", + "src": "5315:49:19" + } + ] + } + ] + }, + "documentation": { + "id": 4810, + "nodeType": "StructuredDocumentation", + "src": "4692:390:19", + "text": " @dev Branchless ternary evaluation for `condition ? a : b`. Gas costs are constant.\n IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.\n However, the compiler may optimize Solidity ternary operations (i.e. `condition ? a : b`) to only compute\n one branch when needed, making this function more expensive." + }, + "id": 4836, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ternary", + "nameLocation": "5096:7:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4817, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4812, + "mutability": "mutable", + "name": "condition", + "nameLocation": "5109:9:19", + "nodeType": "VariableDeclaration", + "scope": 4836, + "src": "5104:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 4811, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "5104:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4814, + "mutability": "mutable", + "name": "a", + "nameLocation": "5128:1:19", + "nodeType": "VariableDeclaration", + "scope": 4836, + "src": "5120:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4813, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5120:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4816, + "mutability": "mutable", + "name": "b", + "nameLocation": "5139:1:19", + "nodeType": "VariableDeclaration", + "scope": 4836, + "src": "5131:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4815, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5131:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5103:38:19" + }, + "returnParameters": { + "id": 4820, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4819, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4836, + "src": "5165:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4818, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5165:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5164:9:19" + }, + "scope": 6204, + "src": "5087:294:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4854, + "nodeType": "Block", + "src": "5518:44:19", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4849, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4847, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4839, + "src": "5543:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "id": 4848, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4841, + "src": "5547:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5543:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "id": 4850, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4839, + "src": "5550:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 4851, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4841, + "src": "5553:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4846, + "name": "ternary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4836, + "src": "5535:7:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bool,uint256,uint256) pure returns (uint256)" + } + }, + "id": 4852, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5535:20:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4845, + "id": 4853, + "nodeType": "Return", + "src": "5528:27:19" + } + ] + }, + "documentation": { + "id": 4837, + "nodeType": "StructuredDocumentation", + "src": "5387:59:19", + "text": " @dev Returns the largest of two numbers." + }, + "id": 4855, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "max", + "nameLocation": "5460:3:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4842, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4839, + "mutability": "mutable", + "name": "a", + "nameLocation": "5472:1:19", + "nodeType": "VariableDeclaration", + "scope": 4855, + "src": "5464:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4838, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5464:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4841, + "mutability": "mutable", + "name": "b", + "nameLocation": "5483:1:19", + "nodeType": "VariableDeclaration", + "scope": 4855, + "src": "5475:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4840, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5475:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5463:22:19" + }, + "returnParameters": { + "id": 4845, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4844, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4855, + "src": "5509:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4843, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5509:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5508:9:19" + }, + "scope": 6204, + "src": "5451:111:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4873, + "nodeType": "Block", + "src": "5700:44:19", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4868, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4866, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4858, + "src": "5725:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 4867, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4860, + "src": "5729:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5725:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "id": 4869, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4858, + "src": "5732:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 4870, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4860, + "src": "5735:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4865, + "name": "ternary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4836, + "src": "5717:7:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bool,uint256,uint256) pure returns (uint256)" + } + }, + "id": 4871, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5717:20:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4864, + "id": 4872, + "nodeType": "Return", + "src": "5710:27:19" + } + ] + }, + "documentation": { + "id": 4856, + "nodeType": "StructuredDocumentation", + "src": "5568:60:19", + "text": " @dev Returns the smallest of two numbers." + }, + "id": 4874, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "min", + "nameLocation": "5642:3:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4861, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4858, + "mutability": "mutable", + "name": "a", + "nameLocation": "5654:1:19", + "nodeType": "VariableDeclaration", + "scope": 4874, + "src": "5646:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4857, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5646:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4860, + "mutability": "mutable", + "name": "b", + "nameLocation": "5665:1:19", + "nodeType": "VariableDeclaration", + "scope": 4874, + "src": "5657:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4859, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5657:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5645:22:19" + }, + "returnParameters": { + "id": 4864, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4863, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4874, + "src": "5691:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4862, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5691:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5690:9:19" + }, + "scope": 6204, + "src": "5633:111:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4897, + "nodeType": "Block", + "src": "5928:120:19", + "statements": [ + { + "id": 4896, + "nodeType": "UncheckedBlock", + "src": "5938:104:19", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4894, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4886, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4884, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4877, + "src": "6011:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "id": 4885, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4879, + "src": "6015:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6011:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 4887, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "6010:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4893, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4890, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4888, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4877, + "src": "6021:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "^", + "rightExpression": { + "id": 4889, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4879, + "src": "6025:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6021:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 4891, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "6020:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "hexValue": "32", + "id": 4892, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6030:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "6020:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6010:21:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4883, + "id": 4895, + "nodeType": "Return", + "src": "6003:28:19" + } + ] + } + ] + }, + "documentation": { + "id": 4875, + "nodeType": "StructuredDocumentation", + "src": "5750:102:19", + "text": " @dev Returns the average of two numbers. The result is rounded towards\n zero." + }, + "id": 4898, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "average", + "nameLocation": "5866:7:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4880, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4877, + "mutability": "mutable", + "name": "a", + "nameLocation": "5882:1:19", + "nodeType": "VariableDeclaration", + "scope": 4898, + "src": "5874:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4876, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5874:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4879, + "mutability": "mutable", + "name": "b", + "nameLocation": "5893:1:19", + "nodeType": "VariableDeclaration", + "scope": 4898, + "src": "5885:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4878, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5885:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5873:22:19" + }, + "returnParameters": { + "id": 4883, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4882, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4898, + "src": "5919:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4881, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5919:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5918:9:19" + }, + "scope": 6204, + "src": "5857:191:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4938, + "nodeType": "Block", + "src": "6340:633:19", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4910, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4908, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4903, + "src": "6354:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 4909, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6359:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "6354:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4919, + "nodeType": "IfStatement", + "src": "6350:150:19", + "trueBody": { + "id": 4918, + "nodeType": "Block", + "src": "6362:138:19", + "statements": [ + { + "expression": { + "arguments": [ + { + "expression": { + "id": 4914, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "6466:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 4915, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "6472:16:19", + "memberName": "DIVISION_BY_ZERO", + "nodeType": "MemberAccess", + "referencedDeclaration": 1681, + "src": "6466:22:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 4911, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "6454:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 4913, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6460:5:19", + "memberName": "panic", + "nodeType": "MemberAccess", + "referencedDeclaration": 1713, + "src": "6454:11:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$__$", + "typeString": "function (uint256) pure" + } + }, + "id": 4916, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6454:35:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 4917, + "nodeType": "ExpressionStatement", + "src": "6454:35:19" + } + ] + } + }, + { + "id": 4937, + "nodeType": "UncheckedBlock", + "src": "6883:84:19", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4935, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4924, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4922, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4901, + "src": "6930:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 4923, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6934:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "6930:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 4920, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "6914:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 4921, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6923:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "6914:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 4925, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6914:22:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4933, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4931, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4928, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4926, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4901, + "src": "6941:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "hexValue": "31", + "id": 4927, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6945:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "6941:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 4929, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "6940:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 4930, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4903, + "src": "6950:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6940:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "31", + "id": 4932, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6954:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "6940:15:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 4934, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "6939:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6914:42:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4907, + "id": 4936, + "nodeType": "Return", + "src": "6907:49:19" + } + ] + } + ] + }, + "documentation": { + "id": 4899, + "nodeType": "StructuredDocumentation", + "src": "6054:210:19", + "text": " @dev Returns the ceiling of the division of two numbers.\n This differs from standard division with `/` in that it rounds towards infinity instead\n of rounding towards zero." + }, + "id": 4939, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ceilDiv", + "nameLocation": "6278:7:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4904, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4901, + "mutability": "mutable", + "name": "a", + "nameLocation": "6294:1:19", + "nodeType": "VariableDeclaration", + "scope": 4939, + "src": "6286:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4900, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6286:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4903, + "mutability": "mutable", + "name": "b", + "nameLocation": "6305:1:19", + "nodeType": "VariableDeclaration", + "scope": 4939, + "src": "6297:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4902, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6297:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "6285:22:19" + }, + "returnParameters": { + "id": 4907, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4906, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4939, + "src": "6331:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4905, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6331:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "6330:9:19" + }, + "scope": 6204, + "src": "6269:704:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5074, + "nodeType": "Block", + "src": "7394:3585:19", + "statements": [ + { + "id": 5073, + "nodeType": "UncheckedBlock", + "src": "7404:3569:19", + "statements": [ + { + "assignments": [ + 4952, + 4954 + ], + "declarations": [ + { + "constant": false, + "id": 4952, + "mutability": "mutable", + "name": "high", + "nameLocation": "7437:4:19", + "nodeType": "VariableDeclaration", + "scope": 5073, + "src": "7429:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4951, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7429:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4954, + "mutability": "mutable", + "name": "low", + "nameLocation": "7451:3:19", + "nodeType": "VariableDeclaration", + "scope": 5073, + "src": "7443:11:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4953, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7443:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 4959, + "initialValue": { + "arguments": [ + { + "id": 4956, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4942, + "src": "7465:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 4957, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4944, + "src": "7468:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4955, + "name": "mul512", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4587, + "src": "7458:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256,uint256)" + } + }, + "id": 4958, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7458:12:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "7428:42:19" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4962, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4960, + "name": "high", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4952, + "src": "7552:4:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 4961, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7560:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "7552:9:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4968, + "nodeType": "IfStatement", + "src": "7548:365:19", + "trueBody": { + "id": 4967, + "nodeType": "Block", + "src": "7563:350:19", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4965, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4963, + "name": "low", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4954, + "src": "7881:3:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 4964, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "7887:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7881:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4950, + "id": 4966, + "nodeType": "Return", + "src": "7874:24:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4971, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4969, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "8023:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<=", + "rightExpression": { + "id": 4970, + "name": "high", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4952, + "src": "8038:4:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8023:19:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4987, + "nodeType": "IfStatement", + "src": "8019:142:19", + "trueBody": { + "id": 4986, + "nodeType": "Block", + "src": "8044:117:19", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4978, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4976, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "8082:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 4977, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8097:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "8082:16:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "expression": { + "id": 4979, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "8100:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 4980, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "8106:16:19", + "memberName": "DIVISION_BY_ZERO", + "nodeType": "MemberAccess", + "referencedDeclaration": 1681, + "src": "8100:22:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 4981, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "8124:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 4982, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "8130:14:19", + "memberName": "UNDER_OVERFLOW", + "nodeType": "MemberAccess", + "referencedDeclaration": 1677, + "src": "8124:20:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4975, + "name": "ternary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4836, + "src": "8074:7:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bool,uint256,uint256) pure returns (uint256)" + } + }, + "id": 4983, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8074:71:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 4972, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "8062:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 4974, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "8068:5:19", + "memberName": "panic", + "nodeType": "MemberAccess", + "referencedDeclaration": 1713, + "src": "8062:11:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$__$", + "typeString": "function (uint256) pure" + } + }, + "id": 4984, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8062:84:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 4985, + "nodeType": "ExpressionStatement", + "src": "8062:84:19" + } + ] + } + }, + { + "assignments": [ + 4989 + ], + "declarations": [ + { + "constant": false, + "id": 4989, + "mutability": "mutable", + "name": "remainder", + "nameLocation": "8421:9:19", + "nodeType": "VariableDeclaration", + "scope": 5073, + "src": "8413:17:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4988, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8413:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 4990, + "nodeType": "VariableDeclarationStatement", + "src": "8413:17:19" + }, + { + "AST": { + "nativeSrc": "8469:283:19", + "nodeType": "YulBlock", + "src": "8469:283:19", + "statements": [ + { + "nativeSrc": "8538:38:19", + "nodeType": "YulAssignment", + "src": "8538:38:19", + "value": { + "arguments": [ + { + "name": "x", + "nativeSrc": "8558:1:19", + "nodeType": "YulIdentifier", + "src": "8558:1:19" + }, + { + "name": "y", + "nativeSrc": "8561:1:19", + "nodeType": "YulIdentifier", + "src": "8561:1:19" + }, + { + "name": "denominator", + "nativeSrc": "8564:11:19", + "nodeType": "YulIdentifier", + "src": "8564:11:19" + } + ], + "functionName": { + "name": "mulmod", + "nativeSrc": "8551:6:19", + "nodeType": "YulIdentifier", + "src": "8551:6:19" + }, + "nativeSrc": "8551:25:19", + "nodeType": "YulFunctionCall", + "src": "8551:25:19" + }, + "variableNames": [ + { + "name": "remainder", + "nativeSrc": "8538:9:19", + "nodeType": "YulIdentifier", + "src": "8538:9:19" + } + ] + }, + { + "nativeSrc": "8658:37:19", + "nodeType": "YulAssignment", + "src": "8658:37:19", + "value": { + "arguments": [ + { + "name": "high", + "nativeSrc": "8670:4:19", + "nodeType": "YulIdentifier", + "src": "8670:4:19" + }, + { + "arguments": [ + { + "name": "remainder", + "nativeSrc": "8679:9:19", + "nodeType": "YulIdentifier", + "src": "8679:9:19" + }, + { + "name": "low", + "nativeSrc": "8690:3:19", + "nodeType": "YulIdentifier", + "src": "8690:3:19" + } + ], + "functionName": { + "name": "gt", + "nativeSrc": "8676:2:19", + "nodeType": "YulIdentifier", + "src": "8676:2:19" + }, + "nativeSrc": "8676:18:19", + "nodeType": "YulFunctionCall", + "src": "8676:18:19" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "8666:3:19", + "nodeType": "YulIdentifier", + "src": "8666:3:19" + }, + "nativeSrc": "8666:29:19", + "nodeType": "YulFunctionCall", + "src": "8666:29:19" + }, + "variableNames": [ + { + "name": "high", + "nativeSrc": "8658:4:19", + "nodeType": "YulIdentifier", + "src": "8658:4:19" + } + ] + }, + { + "nativeSrc": "8712:26:19", + "nodeType": "YulAssignment", + "src": "8712:26:19", + "value": { + "arguments": [ + { + "name": "low", + "nativeSrc": "8723:3:19", + "nodeType": "YulIdentifier", + "src": "8723:3:19" + }, + { + "name": "remainder", + "nativeSrc": "8728:9:19", + "nodeType": "YulIdentifier", + "src": "8728:9:19" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "8719:3:19", + "nodeType": "YulIdentifier", + "src": "8719:3:19" + }, + "nativeSrc": "8719:19:19", + "nodeType": "YulFunctionCall", + "src": "8719:19:19" + }, + "variableNames": [ + { + "name": "low", + "nativeSrc": "8712:3:19", + "nodeType": "YulIdentifier", + "src": "8712:3:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4946, + "isOffset": false, + "isSlot": false, + "src": "8564:11:19", + "valueSize": 1 + }, + { + "declaration": 4952, + "isOffset": false, + "isSlot": false, + "src": "8658:4:19", + "valueSize": 1 + }, + { + "declaration": 4952, + "isOffset": false, + "isSlot": false, + "src": "8670:4:19", + "valueSize": 1 + }, + { + "declaration": 4954, + "isOffset": false, + "isSlot": false, + "src": "8690:3:19", + "valueSize": 1 + }, + { + "declaration": 4954, + "isOffset": false, + "isSlot": false, + "src": "8712:3:19", + "valueSize": 1 + }, + { + "declaration": 4954, + "isOffset": false, + "isSlot": false, + "src": "8723:3:19", + "valueSize": 1 + }, + { + "declaration": 4989, + "isOffset": false, + "isSlot": false, + "src": "8538:9:19", + "valueSize": 1 + }, + { + "declaration": 4989, + "isOffset": false, + "isSlot": false, + "src": "8679:9:19", + "valueSize": 1 + }, + { + "declaration": 4989, + "isOffset": false, + "isSlot": false, + "src": "8728:9:19", + "valueSize": 1 + }, + { + "declaration": 4942, + "isOffset": false, + "isSlot": false, + "src": "8558:1:19", + "valueSize": 1 + }, + { + "declaration": 4944, + "isOffset": false, + "isSlot": false, + "src": "8561:1:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4991, + "nodeType": "InlineAssembly", + "src": "8444:308:19" + }, + { + "assignments": [ + 4993 + ], + "declarations": [ + { + "constant": false, + "id": 4993, + "mutability": "mutable", + "name": "twos", + "nameLocation": "8964:4:19", + "nodeType": "VariableDeclaration", + "scope": 5073, + "src": "8956:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4992, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8956:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5000, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4999, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4994, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "8971:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4997, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "30", + "id": 4995, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8986:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "id": 4996, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "8990:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8986:15:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 4998, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "8985:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8971:31:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8956:46:19" + }, + { + "AST": { + "nativeSrc": "9041:359:19", + "nodeType": "YulBlock", + "src": "9041:359:19", + "statements": [ + { + "nativeSrc": "9106:37:19", + "nodeType": "YulAssignment", + "src": "9106:37:19", + "value": { + "arguments": [ + { + "name": "denominator", + "nativeSrc": "9125:11:19", + "nodeType": "YulIdentifier", + "src": "9125:11:19" + }, + { + "name": "twos", + "nativeSrc": "9138:4:19", + "nodeType": "YulIdentifier", + "src": "9138:4:19" + } + ], + "functionName": { + "name": "div", + "nativeSrc": "9121:3:19", + "nodeType": "YulIdentifier", + "src": "9121:3:19" + }, + "nativeSrc": "9121:22:19", + "nodeType": "YulFunctionCall", + "src": "9121:22:19" + }, + "variableNames": [ + { + "name": "denominator", + "nativeSrc": "9106:11:19", + "nodeType": "YulIdentifier", + "src": "9106:11:19" + } + ] + }, + { + "nativeSrc": "9207:21:19", + "nodeType": "YulAssignment", + "src": "9207:21:19", + "value": { + "arguments": [ + { + "name": "low", + "nativeSrc": "9218:3:19", + "nodeType": "YulIdentifier", + "src": "9218:3:19" + }, + { + "name": "twos", + "nativeSrc": "9223:4:19", + "nodeType": "YulIdentifier", + "src": "9223:4:19" + } + ], + "functionName": { + "name": "div", + "nativeSrc": "9214:3:19", + "nodeType": "YulIdentifier", + "src": "9214:3:19" + }, + "nativeSrc": "9214:14:19", + "nodeType": "YulFunctionCall", + "src": "9214:14:19" + }, + "variableNames": [ + { + "name": "low", + "nativeSrc": "9207:3:19", + "nodeType": "YulIdentifier", + "src": "9207:3:19" + } + ] + }, + { + "nativeSrc": "9347:39:19", + "nodeType": "YulAssignment", + "src": "9347:39:19", + "value": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9367:1:19", + "nodeType": "YulLiteral", + "src": "9367:1:19", + "type": "", + "value": "0" + }, + { + "name": "twos", + "nativeSrc": "9370:4:19", + "nodeType": "YulIdentifier", + "src": "9370:4:19" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "9363:3:19", + "nodeType": "YulIdentifier", + "src": "9363:3:19" + }, + "nativeSrc": "9363:12:19", + "nodeType": "YulFunctionCall", + "src": "9363:12:19" + }, + { + "name": "twos", + "nativeSrc": "9377:4:19", + "nodeType": "YulIdentifier", + "src": "9377:4:19" + } + ], + "functionName": { + "name": "div", + "nativeSrc": "9359:3:19", + "nodeType": "YulIdentifier", + "src": "9359:3:19" + }, + "nativeSrc": "9359:23:19", + "nodeType": "YulFunctionCall", + "src": "9359:23:19" + }, + { + "kind": "number", + "nativeSrc": "9384:1:19", + "nodeType": "YulLiteral", + "src": "9384:1:19", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9355:3:19", + "nodeType": "YulIdentifier", + "src": "9355:3:19" + }, + "nativeSrc": "9355:31:19", + "nodeType": "YulFunctionCall", + "src": "9355:31:19" + }, + "variableNames": [ + { + "name": "twos", + "nativeSrc": "9347:4:19", + "nodeType": "YulIdentifier", + "src": "9347:4:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4946, + "isOffset": false, + "isSlot": false, + "src": "9106:11:19", + "valueSize": 1 + }, + { + "declaration": 4946, + "isOffset": false, + "isSlot": false, + "src": "9125:11:19", + "valueSize": 1 + }, + { + "declaration": 4954, + "isOffset": false, + "isSlot": false, + "src": "9207:3:19", + "valueSize": 1 + }, + { + "declaration": 4954, + "isOffset": false, + "isSlot": false, + "src": "9218:3:19", + "valueSize": 1 + }, + { + "declaration": 4993, + "isOffset": false, + "isSlot": false, + "src": "9138:4:19", + "valueSize": 1 + }, + { + "declaration": 4993, + "isOffset": false, + "isSlot": false, + "src": "9223:4:19", + "valueSize": 1 + }, + { + "declaration": 4993, + "isOffset": false, + "isSlot": false, + "src": "9347:4:19", + "valueSize": 1 + }, + { + "declaration": 4993, + "isOffset": false, + "isSlot": false, + "src": "9370:4:19", + "valueSize": 1 + }, + { + "declaration": 4993, + "isOffset": false, + "isSlot": false, + "src": "9377:4:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 5001, + "nodeType": "InlineAssembly", + "src": "9016:384:19" + }, + { + "expression": { + "id": 5006, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5002, + "name": "low", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4954, + "src": "9463:3:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "|=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5005, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5003, + "name": "high", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4952, + "src": "9470:4:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5004, + "name": "twos", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4993, + "src": "9477:4:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "9470:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "9463:18:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5007, + "nodeType": "ExpressionStatement", + "src": "9463:18:19" + }, + { + "assignments": [ + 5009 + ], + "declarations": [ + { + "constant": false, + "id": 5009, + "mutability": "mutable", + "name": "inverse", + "nameLocation": "9824:7:19", + "nodeType": "VariableDeclaration", + "scope": 5073, + "src": "9816:15:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5008, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "9816:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5016, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5015, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5012, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "33", + "id": 5010, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9835:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5011, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "9839:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "9835:15:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5013, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "9834:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "^", + "rightExpression": { + "hexValue": "32", + "id": 5014, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9854:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "9834:21:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "9816:39:19" + }, + { + "expression": { + "id": 5023, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5017, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10072:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "*=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5022, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 5018, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10083:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5021, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5019, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "10087:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5020, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10101:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10087:21:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10083:25:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10072:36:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5024, + "nodeType": "ExpressionStatement", + "src": "10072:36:19" + }, + { + "expression": { + "id": 5031, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5025, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10142:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "*=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5030, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 5026, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10153:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5029, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5027, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "10157:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5028, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10171:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10157:21:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10153:25:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10142:36:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5032, + "nodeType": "ExpressionStatement", + "src": "10142:36:19" + }, + { + "expression": { + "id": 5039, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5033, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10214:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "*=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5038, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 5034, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10225:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5037, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5035, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "10229:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5036, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10243:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10229:21:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10225:25:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10214:36:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5040, + "nodeType": "ExpressionStatement", + "src": "10214:36:19" + }, + { + "expression": { + "id": 5047, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5041, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10285:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "*=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5046, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 5042, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10296:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5045, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5043, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "10300:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5044, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10314:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10300:21:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10296:25:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10285:36:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5048, + "nodeType": "ExpressionStatement", + "src": "10285:36:19" + }, + { + "expression": { + "id": 5055, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5049, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10358:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "*=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5054, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 5050, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10369:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5053, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5051, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "10373:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5052, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10387:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10373:21:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10369:25:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10358:36:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5056, + "nodeType": "ExpressionStatement", + "src": "10358:36:19" + }, + { + "expression": { + "id": 5063, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5057, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10432:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "*=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5062, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 5058, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10443:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5061, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5059, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "10447:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5060, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10461:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10447:21:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10443:25:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10432:36:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5064, + "nodeType": "ExpressionStatement", + "src": "10432:36:19" + }, + { + "expression": { + "id": 5069, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5065, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4949, + "src": "10913:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5068, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5066, + "name": "low", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4954, + "src": "10922:3:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5067, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10928:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10922:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10913:22:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5070, + "nodeType": "ExpressionStatement", + "src": "10913:22:19" + }, + { + "expression": { + "id": 5071, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4949, + "src": "10956:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4950, + "id": 5072, + "nodeType": "Return", + "src": "10949:13:19" + } + ] + } + ] + }, + "documentation": { + "id": 4940, + "nodeType": "StructuredDocumentation", + "src": "6979:312:19", + "text": " @dev Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or\n denominator == 0.\n Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by\n Uniswap Labs also under MIT license." + }, + "id": 5075, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "mulDiv", + "nameLocation": "7305:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4947, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4942, + "mutability": "mutable", + "name": "x", + "nameLocation": "7320:1:19", + "nodeType": "VariableDeclaration", + "scope": 5075, + "src": "7312:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4941, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7312:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4944, + "mutability": "mutable", + "name": "y", + "nameLocation": "7331:1:19", + "nodeType": "VariableDeclaration", + "scope": 5075, + "src": "7323:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4943, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7323:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4946, + "mutability": "mutable", + "name": "denominator", + "nameLocation": "7342:11:19", + "nodeType": "VariableDeclaration", + "scope": 5075, + "src": "7334:19:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4945, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7334:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7311:43:19" + }, + "returnParameters": { + "id": 4950, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4949, + "mutability": "mutable", + "name": "result", + "nameLocation": "7386:6:19", + "nodeType": "VariableDeclaration", + "scope": 5075, + "src": "7378:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4948, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7378:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7377:16:19" + }, + "scope": 6204, + "src": "7296:3683:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5111, + "nodeType": "Block", + "src": "11218:128:19", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5109, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 5091, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5078, + "src": "11242:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5092, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5080, + "src": "11245:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5093, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5082, + "src": "11248:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5090, + "name": "mulDiv", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 5075, + 5112 + ], + "referencedDeclaration": 5075, + "src": "11235:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 5094, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11235:25:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 5107, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 5098, + "name": "rounding", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5085, + "src": "11296:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + ], + "id": 5097, + "name": "unsignedRoundsUp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6182, + "src": "11279:16:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_Rounding_$4559_$returns$_t_bool_$", + "typeString": "function (enum Math.Rounding) pure returns (bool)" + } + }, + "id": 5099, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11279:26:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5106, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 5101, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5078, + "src": "11316:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5102, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5080, + "src": "11319:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5103, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5082, + "src": "11322:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5100, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -16, + "src": "11309:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 5104, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11309:25:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 5105, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11337:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "11309:29:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "11279:59:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5095, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "11263:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5096, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "11272:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "11263:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5108, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11263:76:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "11235:104:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5089, + "id": 5110, + "nodeType": "Return", + "src": "11228:111:19" + } + ] + }, + "documentation": { + "id": 5076, + "nodeType": "StructuredDocumentation", + "src": "10985:118:19", + "text": " @dev Calculates x * y / denominator with full precision, following the selected rounding direction." + }, + "id": 5112, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "mulDiv", + "nameLocation": "11117:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5086, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5078, + "mutability": "mutable", + "name": "x", + "nameLocation": "11132:1:19", + "nodeType": "VariableDeclaration", + "scope": 5112, + "src": "11124:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5077, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11124:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5080, + "mutability": "mutable", + "name": "y", + "nameLocation": "11143:1:19", + "nodeType": "VariableDeclaration", + "scope": 5112, + "src": "11135:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5079, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11135:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5082, + "mutability": "mutable", + "name": "denominator", + "nameLocation": "11154:11:19", + "nodeType": "VariableDeclaration", + "scope": 5112, + "src": "11146:19:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5081, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11146:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5085, + "mutability": "mutable", + "name": "rounding", + "nameLocation": "11176:8:19", + "nodeType": "VariableDeclaration", + "scope": 5112, + "src": "11167:17:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + }, + "typeName": { + "id": 5084, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 5083, + "name": "Rounding", + "nameLocations": [ + "11167:8:19" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4559, + "src": "11167:8:19" + }, + "referencedDeclaration": 4559, + "src": "11167:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + }, + "visibility": "internal" + } + ], + "src": "11123:62:19" + }, + "returnParameters": { + "id": 5089, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5088, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5112, + "src": "11209:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5087, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11209:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "11208:9:19" + }, + "scope": 6204, + "src": "11108:238:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5161, + "nodeType": "Block", + "src": "11554:245:19", + "statements": [ + { + "id": 5160, + "nodeType": "UncheckedBlock", + "src": "11564:229:19", + "statements": [ + { + "assignments": [ + 5125, + 5127 + ], + "declarations": [ + { + "constant": false, + "id": 5125, + "mutability": "mutable", + "name": "high", + "nameLocation": "11597:4:19", + "nodeType": "VariableDeclaration", + "scope": 5160, + "src": "11589:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5124, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11589:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5127, + "mutability": "mutable", + "name": "low", + "nameLocation": "11611:3:19", + "nodeType": "VariableDeclaration", + "scope": 5160, + "src": "11603:11:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5126, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11603:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5132, + "initialValue": { + "arguments": [ + { + "id": 5129, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5115, + "src": "11625:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5130, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5117, + "src": "11628:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5128, + "name": "mul512", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4587, + "src": "11618:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256,uint256)" + } + }, + "id": 5131, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11618:12:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "11588:42:19" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5137, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5133, + "name": "high", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5125, + "src": "11648:4:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5136, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5134, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11656:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "id": 5135, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5119, + "src": "11661:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "src": "11656:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "11648:14:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5146, + "nodeType": "IfStatement", + "src": "11644:86:19", + "trueBody": { + "id": 5145, + "nodeType": "Block", + "src": "11664:66:19", + "statements": [ + { + "expression": { + "arguments": [ + { + "expression": { + "id": 5141, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "11694:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 5142, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "11700:14:19", + "memberName": "UNDER_OVERFLOW", + "nodeType": "MemberAccess", + "referencedDeclaration": 1677, + "src": "11694:20:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 5138, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "11682:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 5140, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "11688:5:19", + "memberName": "panic", + "nodeType": "MemberAccess", + "referencedDeclaration": 1713, + "src": "11682:11:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$__$", + "typeString": "function (uint256) pure" + } + }, + "id": 5143, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11682:33:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 5144, + "nodeType": "ExpressionStatement", + "src": "11682:33:19" + } + ] + } + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5158, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5152, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5147, + "name": "high", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5125, + "src": "11751:4:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint16", + "typeString": "uint16" + }, + "id": 5150, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "323536", + "id": 5148, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11760:3:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_256_by_1", + "typeString": "int_const 256" + }, + "value": "256" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "id": 5149, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5119, + "src": "11766:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "src": "11760:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint16", + "typeString": "uint16" + } + } + ], + "id": 5151, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11759:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint16", + "typeString": "uint16" + } + }, + "src": "11751:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5153, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11750:19:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5156, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5154, + "name": "low", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5127, + "src": "11773:3:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 5155, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5119, + "src": "11780:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "src": "11773:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5157, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11772:10:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "11750:32:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5123, + "id": 5159, + "nodeType": "Return", + "src": "11743:39:19" + } + ] + } + ] + }, + "documentation": { + "id": 5113, + "nodeType": "StructuredDocumentation", + "src": "11352:111:19", + "text": " @dev Calculates floor(x * y >> n) with full precision. Throws if result overflows a uint256." + }, + "id": 5162, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "mulShr", + "nameLocation": "11477:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5120, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5115, + "mutability": "mutable", + "name": "x", + "nameLocation": "11492:1:19", + "nodeType": "VariableDeclaration", + "scope": 5162, + "src": "11484:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5114, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11484:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5117, + "mutability": "mutable", + "name": "y", + "nameLocation": "11503:1:19", + "nodeType": "VariableDeclaration", + "scope": 5162, + "src": "11495:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5116, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11495:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5119, + "mutability": "mutable", + "name": "n", + "nameLocation": "11512:1:19", + "nodeType": "VariableDeclaration", + "scope": 5162, + "src": "11506:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 5118, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "11506:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "src": "11483:31:19" + }, + "returnParameters": { + "id": 5123, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5122, + "mutability": "mutable", + "name": "result", + "nameLocation": "11546:6:19", + "nodeType": "VariableDeclaration", + "scope": 5162, + "src": "11538:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5121, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11538:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "11537:16:19" + }, + "scope": 6204, + "src": "11468:331:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5200, + "nodeType": "Block", + "src": "12017:113:19", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5198, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 5178, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5165, + "src": "12041:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5179, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5167, + "src": "12044:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5180, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5169, + "src": "12047:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + ], + "id": 5177, + "name": "mulShr", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 5162, + 5201 + ], + "referencedDeclaration": 5162, + "src": "12034:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint8_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint8) pure returns (uint256)" + } + }, + "id": 5181, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12034:15:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 5196, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 5185, + "name": "rounding", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5172, + "src": "12085:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + ], + "id": 5184, + "name": "unsignedRoundsUp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6182, + "src": "12068:16:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_Rounding_$4559_$returns$_t_bool_$", + "typeString": "function (enum Math.Rounding) pure returns (bool)" + } + }, + "id": 5186, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12068:26:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5195, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 5188, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5165, + "src": "12105:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5189, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5167, + "src": "12108:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5192, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5190, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12111:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "id": 5191, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5169, + "src": "12116:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "src": "12111:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5187, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -16, + "src": "12098:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 5193, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12098:20:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 5194, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12121:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "12098:24:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "12068:54:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5182, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "12052:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5183, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "12061:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "12052:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5197, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12052:71:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "12034:89:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5176, + "id": 5199, + "nodeType": "Return", + "src": "12027:96:19" + } + ] + }, + "documentation": { + "id": 5163, + "nodeType": "StructuredDocumentation", + "src": "11805:109:19", + "text": " @dev Calculates x * y >> n with full precision, following the selected rounding direction." + }, + "id": 5201, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "mulShr", + "nameLocation": "11928:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5173, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5165, + "mutability": "mutable", + "name": "x", + "nameLocation": "11943:1:19", + "nodeType": "VariableDeclaration", + "scope": 5201, + "src": "11935:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5164, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11935:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5167, + "mutability": "mutable", + "name": "y", + "nameLocation": "11954:1:19", + "nodeType": "VariableDeclaration", + "scope": 5201, + "src": "11946:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5166, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11946:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5169, + "mutability": "mutable", + "name": "n", + "nameLocation": "11963:1:19", + "nodeType": "VariableDeclaration", + "scope": 5201, + "src": "11957:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 5168, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "11957:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5172, + "mutability": "mutable", + "name": "rounding", + "nameLocation": "11975:8:19", + "nodeType": "VariableDeclaration", + "scope": 5201, + "src": "11966:17:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + }, + "typeName": { + "id": 5171, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 5170, + "name": "Rounding", + "nameLocations": [ + "11966:8:19" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4559, + "src": "11966:8:19" + }, + "referencedDeclaration": 4559, + "src": "11966:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + }, + "visibility": "internal" + } + ], + "src": "11934:50:19" + }, + "returnParameters": { + "id": 5176, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5175, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5201, + "src": "12008:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5174, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12008:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "12007:9:19" + }, + "scope": 6204, + "src": "11919:211:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5297, + "nodeType": "Block", + "src": "12764:1849:19", + "statements": [ + { + "id": 5296, + "nodeType": "UncheckedBlock", + "src": "12774:1833:19", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5213, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5211, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5206, + "src": "12802:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 5212, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12807:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "12802:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5216, + "nodeType": "IfStatement", + "src": "12798:20:19", + "trueBody": { + "expression": { + "hexValue": "30", + "id": 5214, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12817:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "functionReturnParameters": 5210, + "id": 5215, + "nodeType": "Return", + "src": "12810:8:19" + } + }, + { + "assignments": [ + 5218 + ], + "declarations": [ + { + "constant": false, + "id": 5218, + "mutability": "mutable", + "name": "remainder", + "nameLocation": "13297:9:19", + "nodeType": "VariableDeclaration", + "scope": 5296, + "src": "13289:17:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5217, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13289:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5222, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5221, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5219, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5204, + "src": "13309:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { + "id": 5220, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5206, + "src": "13313:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "13309:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "13289:25:19" + }, + { + "assignments": [ + 5224 + ], + "declarations": [ + { + "constant": false, + "id": 5224, + "mutability": "mutable", + "name": "gcd", + "nameLocation": "13336:3:19", + "nodeType": "VariableDeclaration", + "scope": 5296, + "src": "13328:11:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5223, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13328:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5226, + "initialValue": { + "id": 5225, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5206, + "src": "13342:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "13328:15:19" + }, + { + "assignments": [ + 5228 + ], + "declarations": [ + { + "constant": false, + "id": 5228, + "mutability": "mutable", + "name": "x", + "nameLocation": "13486:1:19", + "nodeType": "VariableDeclaration", + "scope": 5296, + "src": "13479:8:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 5227, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "13479:6:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "id": 5230, + "initialValue": { + "hexValue": "30", + "id": 5229, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13490:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "13479:12:19" + }, + { + "assignments": [ + 5232 + ], + "declarations": [ + { + "constant": false, + "id": 5232, + "mutability": "mutable", + "name": "y", + "nameLocation": "13512:1:19", + "nodeType": "VariableDeclaration", + "scope": 5296, + "src": "13505:8:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 5231, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "13505:6:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "id": 5234, + "initialValue": { + "hexValue": "31", + "id": 5233, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13516:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "VariableDeclarationStatement", + "src": "13505:12:19" + }, + { + "body": { + "id": 5271, + "nodeType": "Block", + "src": "13555:882:19", + "statements": [ + { + "assignments": [ + 5239 + ], + "declarations": [ + { + "constant": false, + "id": 5239, + "mutability": "mutable", + "name": "quotient", + "nameLocation": "13581:8:19", + "nodeType": "VariableDeclaration", + "scope": 5271, + "src": "13573:16:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5238, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13573:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5243, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5242, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5240, + "name": "gcd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5224, + "src": "13592:3:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 5241, + "name": "remainder", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5218, + "src": "13598:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "13592:15:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "13573:34:19" + }, + { + "expression": { + "id": 5254, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "components": [ + { + "id": 5244, + "name": "gcd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5224, + "src": "13627:3:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5245, + "name": "remainder", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5218, + "src": "13632:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5246, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "13626:16:19", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "components": [ + { + "id": 5247, + "name": "remainder", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5218, + "src": "13732:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5252, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5248, + "name": "gcd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5224, + "src": "13977:3:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5251, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5249, + "name": "remainder", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5218, + "src": "13983:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5250, + "name": "quotient", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5239, + "src": "13995:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "13983:20:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "13977:26:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5253, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13645:376:19", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "13626:395:19", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 5255, + "nodeType": "ExpressionStatement", + "src": "13626:395:19" + }, + { + "expression": { + "id": 5269, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "components": [ + { + "id": 5256, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5228, + "src": "14041:1:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + { + "id": 5257, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5232, + "src": "14044:1:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 5258, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "14040:6:19", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_int256_$_t_int256_$", + "typeString": "tuple(int256,int256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "components": [ + { + "id": 5259, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5232, + "src": "14126:1:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 5267, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5260, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5228, + "src": "14380:1:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 5266, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5261, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5232, + "src": "14384:1:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "arguments": [ + { + "id": 5264, + "name": "quotient", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5239, + "src": "14395:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5263, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "14388:6:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + }, + "typeName": { + "id": 5262, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "14388:6:19", + "typeDescriptions": {} + } + }, + "id": 5265, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14388:16:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "14384:20:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "14380:24:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 5268, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "14049:373:19", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_int256_$_t_int256_$", + "typeString": "tuple(int256,int256)" + } + }, + "src": "14040:382:19", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 5270, + "nodeType": "ExpressionStatement", + "src": "14040:382:19" + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5237, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5235, + "name": "remainder", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5218, + "src": "13539:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "hexValue": "30", + "id": 5236, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13552:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "13539:14:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5272, + "nodeType": "WhileStatement", + "src": "13532:905:19" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5275, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5273, + "name": "gcd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5224, + "src": "14455:3:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "hexValue": "31", + "id": 5274, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14462:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "14455:8:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5278, + "nodeType": "IfStatement", + "src": "14451:22:19", + "trueBody": { + "expression": { + "hexValue": "30", + "id": 5276, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14472:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "functionReturnParameters": 5210, + "id": 5277, + "nodeType": "Return", + "src": "14465:8:19" + } + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 5282, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5280, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5228, + "src": "14524:1:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "hexValue": "30", + "id": 5281, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14528:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "14524:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5289, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5283, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5206, + "src": "14531:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "arguments": [ + { + "id": 5287, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "-", + "prefix": true, + "src": "14543:2:19", + "subExpression": { + "id": 5286, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5228, + "src": "14544:1:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 5285, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "14535:7:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 5284, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "14535:7:19", + "typeDescriptions": {} + } + }, + "id": 5288, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14535:11:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "14531:15:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [ + { + "id": 5292, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5228, + "src": "14556:1:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 5291, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "14548:7:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 5290, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "14548:7:19", + "typeDescriptions": {} + } + }, + "id": 5293, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14548:10:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5279, + "name": "ternary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4836, + "src": "14516:7:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bool,uint256,uint256) pure returns (uint256)" + } + }, + "id": 5294, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14516:43:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5210, + "id": 5295, + "nodeType": "Return", + "src": "14509:50:19" + } + ] + } + ] + }, + "documentation": { + "id": 5202, + "nodeType": "StructuredDocumentation", + "src": "12136:553:19", + "text": " @dev Calculate the modular multiplicative inverse of a number in Z/nZ.\n If n is a prime, then Z/nZ is a field. In that case all elements are inversible, except 0.\n If n is not a prime, then Z/nZ is not a field, and some elements might not be inversible.\n If the input value is not inversible, 0 is returned.\n NOTE: If you know for sure that n is (big) a prime, it may be cheaper to use Fermat's little theorem and get the\n inverse using `Math.modExp(a, n - 2, n)`. See {invModPrime}." + }, + "id": 5298, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "invMod", + "nameLocation": "12703:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5207, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5204, + "mutability": "mutable", + "name": "a", + "nameLocation": "12718:1:19", + "nodeType": "VariableDeclaration", + "scope": 5298, + "src": "12710:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5203, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12710:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5206, + "mutability": "mutable", + "name": "n", + "nameLocation": "12729:1:19", + "nodeType": "VariableDeclaration", + "scope": 5298, + "src": "12721:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5205, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12721:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "12709:22:19" + }, + "returnParameters": { + "id": 5210, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5209, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5298, + "src": "12755:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5208, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12755:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "12754:9:19" + }, + "scope": 6204, + "src": "12694:1919:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5318, + "nodeType": "Block", + "src": "15213:82:19", + "statements": [ + { + "id": 5317, + "nodeType": "UncheckedBlock", + "src": "15223:66:19", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 5310, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5301, + "src": "15266:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5313, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5311, + "name": "p", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5303, + "src": "15269:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "hexValue": "32", + "id": 5312, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "15273:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "15269:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5314, + "name": "p", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5303, + "src": "15276:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 5308, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "15254:4:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 5309, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "15259:6:19", + "memberName": "modExp", + "nodeType": "MemberAccess", + "referencedDeclaration": 5355, + "src": "15254:11:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) view returns (uint256)" + } + }, + "id": 5315, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15254:24:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5307, + "id": 5316, + "nodeType": "Return", + "src": "15247:31:19" + } + ] + } + ] + }, + "documentation": { + "id": 5299, + "nodeType": "StructuredDocumentation", + "src": "14619:514:19", + "text": " @dev Variant of {invMod}. More efficient, but only works if `p` is known to be a prime greater than `2`.\n From https://en.wikipedia.org/wiki/Fermat%27s_little_theorem[Fermat's little theorem], we know that if p is\n prime, then `a**(p-1) ≡ 1 mod p`. As a consequence, we have `a * a**(p-2) ≡ 1 mod p`, which means that\n `a**(p-2)` is the modular multiplicative inverse of a in Fp.\n NOTE: this function does NOT check that `p` is a prime greater than `2`." + }, + "id": 5319, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "invModPrime", + "nameLocation": "15147:11:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5304, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5301, + "mutability": "mutable", + "name": "a", + "nameLocation": "15167:1:19", + "nodeType": "VariableDeclaration", + "scope": 5319, + "src": "15159:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5300, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "15159:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5303, + "mutability": "mutable", + "name": "p", + "nameLocation": "15178:1:19", + "nodeType": "VariableDeclaration", + "scope": 5319, + "src": "15170:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5302, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "15170:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "15158:22:19" + }, + "returnParameters": { + "id": 5307, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5306, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5319, + "src": "15204:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5305, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "15204:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "15203:9:19" + }, + "scope": 6204, + "src": "15138:157:19", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5354, + "nodeType": "Block", + "src": "16065:174:19", + "statements": [ + { + "assignments": [ + 5332, + 5334 + ], + "declarations": [ + { + "constant": false, + "id": 5332, + "mutability": "mutable", + "name": "success", + "nameLocation": "16081:7:19", + "nodeType": "VariableDeclaration", + "scope": 5354, + "src": "16076:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 5331, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "16076:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5334, + "mutability": "mutable", + "name": "result", + "nameLocation": "16098:6:19", + "nodeType": "VariableDeclaration", + "scope": 5354, + "src": "16090:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5333, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "16090:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5340, + "initialValue": { + "arguments": [ + { + "id": 5336, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5322, + "src": "16118:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5337, + "name": "e", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5324, + "src": "16121:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5338, + "name": "m", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5326, + "src": "16124:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5335, + "name": "tryModExp", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 5379, + 5461 + ], + "referencedDeclaration": 5379, + "src": "16108:9:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) view returns (bool,uint256)" + } + }, + "id": 5339, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16108:18:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "16075:51:19" + }, + { + "condition": { + "id": 5342, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "16140:8:19", + "subExpression": { + "id": 5341, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5332, + "src": "16141:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5351, + "nodeType": "IfStatement", + "src": "16136:74:19", + "trueBody": { + "id": 5350, + "nodeType": "Block", + "src": "16150:60:19", + "statements": [ + { + "expression": { + "arguments": [ + { + "expression": { + "id": 5346, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "16176:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 5347, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "16182:16:19", + "memberName": "DIVISION_BY_ZERO", + "nodeType": "MemberAccess", + "referencedDeclaration": 1681, + "src": "16176:22:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 5343, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "16164:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 5345, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "16170:5:19", + "memberName": "panic", + "nodeType": "MemberAccess", + "referencedDeclaration": 1713, + "src": "16164:11:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$__$", + "typeString": "function (uint256) pure" + } + }, + "id": 5348, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16164:35:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 5349, + "nodeType": "ExpressionStatement", + "src": "16164:35:19" + } + ] + } + }, + { + "expression": { + "id": 5352, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5334, + "src": "16226:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5330, + "id": 5353, + "nodeType": "Return", + "src": "16219:13:19" + } + ] + }, + "documentation": { + "id": 5320, + "nodeType": "StructuredDocumentation", + "src": "15301:678:19", + "text": " @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m)\n Requirements:\n - modulus can't be zero\n - underlying staticcall to precompile must succeed\n IMPORTANT: The result is only valid if the underlying call succeeds. When using this function, make\n sure the chain you're using it on supports the precompiled contract for modular exponentiation\n at address 0x05 as specified in https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise,\n the underlying function will succeed given the lack of a revert, but the result may be incorrectly\n interpreted as 0." + }, + "id": 5355, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "modExp", + "nameLocation": "15993:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5327, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5322, + "mutability": "mutable", + "name": "b", + "nameLocation": "16008:1:19", + "nodeType": "VariableDeclaration", + "scope": 5355, + "src": "16000:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5321, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "16000:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5324, + "mutability": "mutable", + "name": "e", + "nameLocation": "16019:1:19", + "nodeType": "VariableDeclaration", + "scope": 5355, + "src": "16011:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5323, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "16011:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5326, + "mutability": "mutable", + "name": "m", + "nameLocation": "16030:1:19", + "nodeType": "VariableDeclaration", + "scope": 5355, + "src": "16022:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5325, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "16022:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "15999:33:19" + }, + "returnParameters": { + "id": 5330, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5329, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5355, + "src": "16056:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5328, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "16056:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "16055:9:19" + }, + "scope": 6204, + "src": "15984:255:19", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5378, + "nodeType": "Block", + "src": "17093:1493:19", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5371, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5369, + "name": "m", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5362, + "src": "17107:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 5370, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17112:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "17107:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5376, + "nodeType": "IfStatement", + "src": "17103:29:19", + "trueBody": { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 5372, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17123:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "hexValue": "30", + "id": 5373, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17130:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "id": 5374, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "17122:10:19", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$", + "typeString": "tuple(bool,int_const 0)" + } + }, + "functionReturnParameters": 5368, + "id": 5375, + "nodeType": "Return", + "src": "17115:17:19" + } + }, + { + "AST": { + "nativeSrc": "17167:1413:19", + "nodeType": "YulBlock", + "src": "17167:1413:19", + "statements": [ + { + "nativeSrc": "17181:22:19", + "nodeType": "YulVariableDeclaration", + "src": "17181:22:19", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "17198:4:19", + "nodeType": "YulLiteral", + "src": "17198:4:19", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "17192:5:19", + "nodeType": "YulIdentifier", + "src": "17192:5:19" + }, + "nativeSrc": "17192:11:19", + "nodeType": "YulFunctionCall", + "src": "17192:11:19" + }, + "variables": [ + { + "name": "ptr", + "nativeSrc": "17185:3:19", + "nodeType": "YulTypedName", + "src": "17185:3:19", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "18111:3:19", + "nodeType": "YulIdentifier", + "src": "18111:3:19" + }, + { + "kind": "number", + "nativeSrc": "18116:4:19", + "nodeType": "YulLiteral", + "src": "18116:4:19", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "18104:6:19", + "nodeType": "YulIdentifier", + "src": "18104:6:19" + }, + "nativeSrc": "18104:17:19", + "nodeType": "YulFunctionCall", + "src": "18104:17:19" + }, + "nativeSrc": "18104:17:19", + "nodeType": "YulExpressionStatement", + "src": "18104:17:19" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "18145:3:19", + "nodeType": "YulIdentifier", + "src": "18145:3:19" + }, + { + "kind": "number", + "nativeSrc": "18150:4:19", + "nodeType": "YulLiteral", + "src": "18150:4:19", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "18141:3:19", + "nodeType": "YulIdentifier", + "src": "18141:3:19" + }, + "nativeSrc": "18141:14:19", + "nodeType": "YulFunctionCall", + "src": "18141:14:19" + }, + { + "kind": "number", + "nativeSrc": "18157:4:19", + "nodeType": "YulLiteral", + "src": "18157:4:19", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "18134:6:19", + "nodeType": "YulIdentifier", + "src": "18134:6:19" + }, + "nativeSrc": "18134:28:19", + "nodeType": "YulFunctionCall", + "src": "18134:28:19" + }, + "nativeSrc": "18134:28:19", + "nodeType": "YulExpressionStatement", + "src": "18134:28:19" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "18186:3:19", + "nodeType": "YulIdentifier", + "src": "18186:3:19" + }, + { + "kind": "number", + "nativeSrc": "18191:4:19", + "nodeType": "YulLiteral", + "src": "18191:4:19", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "18182:3:19", + "nodeType": "YulIdentifier", + "src": "18182:3:19" + }, + "nativeSrc": "18182:14:19", + "nodeType": "YulFunctionCall", + "src": "18182:14:19" + }, + { + "kind": "number", + "nativeSrc": "18198:4:19", + "nodeType": "YulLiteral", + "src": "18198:4:19", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "18175:6:19", + "nodeType": "YulIdentifier", + "src": "18175:6:19" + }, + "nativeSrc": "18175:28:19", + "nodeType": "YulFunctionCall", + "src": "18175:28:19" + }, + "nativeSrc": "18175:28:19", + "nodeType": "YulExpressionStatement", + "src": "18175:28:19" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "18227:3:19", + "nodeType": "YulIdentifier", + "src": "18227:3:19" + }, + { + "kind": "number", + "nativeSrc": "18232:4:19", + "nodeType": "YulLiteral", + "src": "18232:4:19", + "type": "", + "value": "0x60" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "18223:3:19", + "nodeType": "YulIdentifier", + "src": "18223:3:19" + }, + "nativeSrc": "18223:14:19", + "nodeType": "YulFunctionCall", + "src": "18223:14:19" + }, + { + "name": "b", + "nativeSrc": "18239:1:19", + "nodeType": "YulIdentifier", + "src": "18239:1:19" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "18216:6:19", + "nodeType": "YulIdentifier", + "src": "18216:6:19" + }, + "nativeSrc": "18216:25:19", + "nodeType": "YulFunctionCall", + "src": "18216:25:19" + }, + "nativeSrc": "18216:25:19", + "nodeType": "YulExpressionStatement", + "src": "18216:25:19" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "18265:3:19", + "nodeType": "YulIdentifier", + "src": "18265:3:19" + }, + { + "kind": "number", + "nativeSrc": "18270:4:19", + "nodeType": "YulLiteral", + "src": "18270:4:19", + "type": "", + "value": "0x80" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "18261:3:19", + "nodeType": "YulIdentifier", + "src": "18261:3:19" + }, + "nativeSrc": "18261:14:19", + "nodeType": "YulFunctionCall", + "src": "18261:14:19" + }, + { + "name": "e", + "nativeSrc": "18277:1:19", + "nodeType": "YulIdentifier", + "src": "18277:1:19" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "18254:6:19", + "nodeType": "YulIdentifier", + "src": "18254:6:19" + }, + "nativeSrc": "18254:25:19", + "nodeType": "YulFunctionCall", + "src": "18254:25:19" + }, + "nativeSrc": "18254:25:19", + "nodeType": "YulExpressionStatement", + "src": "18254:25:19" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "18303:3:19", + "nodeType": "YulIdentifier", + "src": "18303:3:19" + }, + { + "kind": "number", + "nativeSrc": "18308:4:19", + "nodeType": "YulLiteral", + "src": "18308:4:19", + "type": "", + "value": "0xa0" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "18299:3:19", + "nodeType": "YulIdentifier", + "src": "18299:3:19" + }, + "nativeSrc": "18299:14:19", + "nodeType": "YulFunctionCall", + "src": "18299:14:19" + }, + { + "name": "m", + "nativeSrc": "18315:1:19", + "nodeType": "YulIdentifier", + "src": "18315:1:19" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "18292:6:19", + "nodeType": "YulIdentifier", + "src": "18292:6:19" + }, + "nativeSrc": "18292:25:19", + "nodeType": "YulFunctionCall", + "src": "18292:25:19" + }, + "nativeSrc": "18292:25:19", + "nodeType": "YulExpressionStatement", + "src": "18292:25:19" + }, + { + "nativeSrc": "18479:57:19", + "nodeType": "YulAssignment", + "src": "18479:57:19", + "value": { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "gas", + "nativeSrc": "18501:3:19", + "nodeType": "YulIdentifier", + "src": "18501:3:19" + }, + "nativeSrc": "18501:5:19", + "nodeType": "YulFunctionCall", + "src": "18501:5:19" + }, + { + "kind": "number", + "nativeSrc": "18508:4:19", + "nodeType": "YulLiteral", + "src": "18508:4:19", + "type": "", + "value": "0x05" + }, + { + "name": "ptr", + "nativeSrc": "18514:3:19", + "nodeType": "YulIdentifier", + "src": "18514:3:19" + }, + { + "kind": "number", + "nativeSrc": "18519:4:19", + "nodeType": "YulLiteral", + "src": "18519:4:19", + "type": "", + "value": "0xc0" + }, + { + "kind": "number", + "nativeSrc": "18525:4:19", + "nodeType": "YulLiteral", + "src": "18525:4:19", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "18531:4:19", + "nodeType": "YulLiteral", + "src": "18531:4:19", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "staticcall", + "nativeSrc": "18490:10:19", + "nodeType": "YulIdentifier", + "src": "18490:10:19" + }, + "nativeSrc": "18490:46:19", + "nodeType": "YulFunctionCall", + "src": "18490:46:19" + }, + "variableNames": [ + { + "name": "success", + "nativeSrc": "18479:7:19", + "nodeType": "YulIdentifier", + "src": "18479:7:19" + } + ] + }, + { + "nativeSrc": "18549:21:19", + "nodeType": "YulAssignment", + "src": "18549:21:19", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "18565:4:19", + "nodeType": "YulLiteral", + "src": "18565:4:19", + "type": "", + "value": "0x00" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "18559:5:19", + "nodeType": "YulIdentifier", + "src": "18559:5:19" + }, + "nativeSrc": "18559:11:19", + "nodeType": "YulFunctionCall", + "src": "18559:11:19" + }, + "variableNames": [ + { + "name": "result", + "nativeSrc": "18549:6:19", + "nodeType": "YulIdentifier", + "src": "18549:6:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 5358, + "isOffset": false, + "isSlot": false, + "src": "18239:1:19", + "valueSize": 1 + }, + { + "declaration": 5360, + "isOffset": false, + "isSlot": false, + "src": "18277:1:19", + "valueSize": 1 + }, + { + "declaration": 5362, + "isOffset": false, + "isSlot": false, + "src": "18315:1:19", + "valueSize": 1 + }, + { + "declaration": 5367, + "isOffset": false, + "isSlot": false, + "src": "18549:6:19", + "valueSize": 1 + }, + { + "declaration": 5365, + "isOffset": false, + "isSlot": false, + "src": "18479:7:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 5377, + "nodeType": "InlineAssembly", + "src": "17142:1438:19" + } + ] + }, + "documentation": { + "id": 5356, + "nodeType": "StructuredDocumentation", + "src": "16245:738:19", + "text": " @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m).\n It includes a success flag indicating if the operation succeeded. Operation will be marked as failed if trying\n to operate modulo 0 or if the underlying precompile reverted.\n IMPORTANT: The result is only valid if the success flag is true. When using this function, make sure the chain\n you're using it on supports the precompiled contract for modular exponentiation at address 0x05 as specified in\n https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, the underlying function will succeed given the lack\n of a revert, but the result may be incorrectly interpreted as 0." + }, + "id": 5379, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryModExp", + "nameLocation": "16997:9:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5363, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5358, + "mutability": "mutable", + "name": "b", + "nameLocation": "17015:1:19", + "nodeType": "VariableDeclaration", + "scope": 5379, + "src": "17007:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5357, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "17007:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5360, + "mutability": "mutable", + "name": "e", + "nameLocation": "17026:1:19", + "nodeType": "VariableDeclaration", + "scope": 5379, + "src": "17018:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5359, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "17018:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5362, + "mutability": "mutable", + "name": "m", + "nameLocation": "17037:1:19", + "nodeType": "VariableDeclaration", + "scope": 5379, + "src": "17029:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5361, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "17029:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "17006:33:19" + }, + "returnParameters": { + "id": 5368, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5365, + "mutability": "mutable", + "name": "success", + "nameLocation": "17068:7:19", + "nodeType": "VariableDeclaration", + "scope": 5379, + "src": "17063:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 5364, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "17063:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5367, + "mutability": "mutable", + "name": "result", + "nameLocation": "17085:6:19", + "nodeType": "VariableDeclaration", + "scope": 5379, + "src": "17077:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5366, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "17077:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "17062:30:19" + }, + "scope": 6204, + "src": "16988:1598:19", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5414, + "nodeType": "Block", + "src": "18783:179:19", + "statements": [ + { + "assignments": [ + 5392, + 5394 + ], + "declarations": [ + { + "constant": false, + "id": 5392, + "mutability": "mutable", + "name": "success", + "nameLocation": "18799:7:19", + "nodeType": "VariableDeclaration", + "scope": 5414, + "src": "18794:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 5391, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "18794:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5394, + "mutability": "mutable", + "name": "result", + "nameLocation": "18821:6:19", + "nodeType": "VariableDeclaration", + "scope": 5414, + "src": "18808:19:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5393, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "18808:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 5400, + "initialValue": { + "arguments": [ + { + "id": 5396, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5382, + "src": "18841:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 5397, + "name": "e", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5384, + "src": "18844:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 5398, + "name": "m", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5386, + "src": "18847:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 5395, + "name": "tryModExp", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 5379, + 5461 + ], + "referencedDeclaration": 5461, + "src": "18831:9:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes_memory_ptr_$_t_bytes_memory_ptr_$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$", + "typeString": "function (bytes memory,bytes memory,bytes memory) view returns (bool,bytes memory)" + } + }, + "id": 5399, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18831:18:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$", + "typeString": "tuple(bool,bytes memory)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "18793:56:19" + }, + { + "condition": { + "id": 5402, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "18863:8:19", + "subExpression": { + "id": 5401, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5392, + "src": "18864:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5411, + "nodeType": "IfStatement", + "src": "18859:74:19", + "trueBody": { + "id": 5410, + "nodeType": "Block", + "src": "18873:60:19", + "statements": [ + { + "expression": { + "arguments": [ + { + "expression": { + "id": 5406, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "18899:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 5407, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "18905:16:19", + "memberName": "DIVISION_BY_ZERO", + "nodeType": "MemberAccess", + "referencedDeclaration": 1681, + "src": "18899:22:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 5403, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "18887:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 5405, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "18893:5:19", + "memberName": "panic", + "nodeType": "MemberAccess", + "referencedDeclaration": 1713, + "src": "18887:11:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$__$", + "typeString": "function (uint256) pure" + } + }, + "id": 5408, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18887:35:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 5409, + "nodeType": "ExpressionStatement", + "src": "18887:35:19" + } + ] + } + }, + { + "expression": { + "id": 5412, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5394, + "src": "18949:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "functionReturnParameters": 5390, + "id": 5413, + "nodeType": "Return", + "src": "18942:13:19" + } + ] + }, + "documentation": { + "id": 5380, + "nodeType": "StructuredDocumentation", + "src": "18592:85:19", + "text": " @dev Variant of {modExp} that supports inputs of arbitrary length." + }, + "id": 5415, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "modExp", + "nameLocation": "18691:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5387, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5382, + "mutability": "mutable", + "name": "b", + "nameLocation": "18711:1:19", + "nodeType": "VariableDeclaration", + "scope": 5415, + "src": "18698:14:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5381, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "18698:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5384, + "mutability": "mutable", + "name": "e", + "nameLocation": "18727:1:19", + "nodeType": "VariableDeclaration", + "scope": 5415, + "src": "18714:14:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5383, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "18714:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5386, + "mutability": "mutable", + "name": "m", + "nameLocation": "18743:1:19", + "nodeType": "VariableDeclaration", + "scope": 5415, + "src": "18730:14:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5385, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "18730:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "18697:48:19" + }, + "returnParameters": { + "id": 5390, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5389, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5415, + "src": "18769:12:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5388, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "18769:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "18768:14:19" + }, + "scope": 6204, + "src": "18682:280:19", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5460, + "nodeType": "Block", + "src": "19216:771:19", + "statements": [ + { + "condition": { + "arguments": [ + { + "id": 5430, + "name": "m", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5422, + "src": "19241:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 5429, + "name": "_zeroBytes", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5508, + "src": "19230:10:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$returns$_t_bool_$", + "typeString": "function (bytes memory) pure returns (bool)" + } + }, + "id": 5431, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19230:13:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5439, + "nodeType": "IfStatement", + "src": "19226:47:19", + "trueBody": { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 5432, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19253:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "arguments": [ + { + "hexValue": "30", + "id": 5435, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19270:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 5434, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "19260:9:19", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (uint256) pure returns (bytes memory)" + }, + "typeName": { + "id": 5433, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "19264:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + } + }, + "id": 5436, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19260:12:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "id": 5437, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "19252:21:19", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$", + "typeString": "tuple(bool,bytes memory)" + } + }, + "functionReturnParameters": 5428, + "id": 5438, + "nodeType": "Return", + "src": "19245:28:19" + } + }, + { + "assignments": [ + 5441 + ], + "declarations": [ + { + "constant": false, + "id": 5441, + "mutability": "mutable", + "name": "mLen", + "nameLocation": "19292:4:19", + "nodeType": "VariableDeclaration", + "scope": 5460, + "src": "19284:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5440, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "19284:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5444, + "initialValue": { + "expression": { + "id": 5442, + "name": "m", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5422, + "src": "19299:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 5443, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "19301:6:19", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "19299:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "19284:23:19" + }, + { + "expression": { + "id": 5457, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5445, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5427, + "src": "19389:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "expression": { + "id": 5448, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5418, + "src": "19415:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 5449, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "19417:6:19", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "19415:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 5450, + "name": "e", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5420, + "src": "19425:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 5451, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "19427:6:19", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "19425:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5452, + "name": "mLen", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5441, + "src": "19435:4:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5453, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5418, + "src": "19441:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 5454, + "name": "e", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5420, + "src": "19444:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 5455, + "name": "m", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5422, + "src": "19447:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "id": 5446, + "name": "abi", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -1, + "src": "19398:3:19", + "typeDescriptions": { + "typeIdentifier": "t_magic_abi", + "typeString": "abi" + } + }, + "id": 5447, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "19402:12:19", + "memberName": "encodePacked", + "nodeType": "MemberAccess", + "src": "19398:16:19", + "typeDescriptions": { + "typeIdentifier": "t_function_abiencodepacked_pure$__$returns$_t_bytes_memory_ptr_$", + "typeString": "function () pure returns (bytes memory)" + } + }, + "id": 5456, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19398:51:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "src": "19389:60:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 5458, + "nodeType": "ExpressionStatement", + "src": "19389:60:19" + }, + { + "AST": { + "nativeSrc": "19485:496:19", + "nodeType": "YulBlock", + "src": "19485:496:19", + "statements": [ + { + "nativeSrc": "19499:32:19", + "nodeType": "YulVariableDeclaration", + "src": "19499:32:19", + "value": { + "arguments": [ + { + "name": "result", + "nativeSrc": "19518:6:19", + "nodeType": "YulIdentifier", + "src": "19518:6:19" + }, + { + "kind": "number", + "nativeSrc": "19526:4:19", + "nodeType": "YulLiteral", + "src": "19526:4:19", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "19514:3:19", + "nodeType": "YulIdentifier", + "src": "19514:3:19" + }, + "nativeSrc": "19514:17:19", + "nodeType": "YulFunctionCall", + "src": "19514:17:19" + }, + "variables": [ + { + "name": "dataPtr", + "nativeSrc": "19503:7:19", + "nodeType": "YulTypedName", + "src": "19503:7:19", + "type": "" + } + ] + }, + { + "nativeSrc": "19621:73:19", + "nodeType": "YulAssignment", + "src": "19621:73:19", + "value": { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "gas", + "nativeSrc": "19643:3:19", + "nodeType": "YulIdentifier", + "src": "19643:3:19" + }, + "nativeSrc": "19643:5:19", + "nodeType": "YulFunctionCall", + "src": "19643:5:19" + }, + { + "kind": "number", + "nativeSrc": "19650:4:19", + "nodeType": "YulLiteral", + "src": "19650:4:19", + "type": "", + "value": "0x05" + }, + { + "name": "dataPtr", + "nativeSrc": "19656:7:19", + "nodeType": "YulIdentifier", + "src": "19656:7:19" + }, + { + "arguments": [ + { + "name": "result", + "nativeSrc": "19671:6:19", + "nodeType": "YulIdentifier", + "src": "19671:6:19" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "19665:5:19", + "nodeType": "YulIdentifier", + "src": "19665:5:19" + }, + "nativeSrc": "19665:13:19", + "nodeType": "YulFunctionCall", + "src": "19665:13:19" + }, + { + "name": "dataPtr", + "nativeSrc": "19680:7:19", + "nodeType": "YulIdentifier", + "src": "19680:7:19" + }, + { + "name": "mLen", + "nativeSrc": "19689:4:19", + "nodeType": "YulIdentifier", + "src": "19689:4:19" + } + ], + "functionName": { + "name": "staticcall", + "nativeSrc": "19632:10:19", + "nodeType": "YulIdentifier", + "src": "19632:10:19" + }, + "nativeSrc": "19632:62:19", + "nodeType": "YulFunctionCall", + "src": "19632:62:19" + }, + "variableNames": [ + { + "name": "success", + "nativeSrc": "19621:7:19", + "nodeType": "YulIdentifier", + "src": "19621:7:19" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "result", + "nativeSrc": "19850:6:19", + "nodeType": "YulIdentifier", + "src": "19850:6:19" + }, + { + "name": "mLen", + "nativeSrc": "19858:4:19", + "nodeType": "YulIdentifier", + "src": "19858:4:19" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "19843:6:19", + "nodeType": "YulIdentifier", + "src": "19843:6:19" + }, + "nativeSrc": "19843:20:19", + "nodeType": "YulFunctionCall", + "src": "19843:20:19" + }, + "nativeSrc": "19843:20:19", + "nodeType": "YulExpressionStatement", + "src": "19843:20:19" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "19946:4:19", + "nodeType": "YulLiteral", + "src": "19946:4:19", + "type": "", + "value": "0x40" + }, + { + "arguments": [ + { + "name": "dataPtr", + "nativeSrc": "19956:7:19", + "nodeType": "YulIdentifier", + "src": "19956:7:19" + }, + { + "name": "mLen", + "nativeSrc": "19965:4:19", + "nodeType": "YulIdentifier", + "src": "19965:4:19" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "19952:3:19", + "nodeType": "YulIdentifier", + "src": "19952:3:19" + }, + "nativeSrc": "19952:18:19", + "nodeType": "YulFunctionCall", + "src": "19952:18:19" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "19939:6:19", + "nodeType": "YulIdentifier", + "src": "19939:6:19" + }, + "nativeSrc": "19939:32:19", + "nodeType": "YulFunctionCall", + "src": "19939:32:19" + }, + "nativeSrc": "19939:32:19", + "nodeType": "YulExpressionStatement", + "src": "19939:32:19" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 5441, + "isOffset": false, + "isSlot": false, + "src": "19689:4:19", + "valueSize": 1 + }, + { + "declaration": 5441, + "isOffset": false, + "isSlot": false, + "src": "19858:4:19", + "valueSize": 1 + }, + { + "declaration": 5441, + "isOffset": false, + "isSlot": false, + "src": "19965:4:19", + "valueSize": 1 + }, + { + "declaration": 5427, + "isOffset": false, + "isSlot": false, + "src": "19518:6:19", + "valueSize": 1 + }, + { + "declaration": 5427, + "isOffset": false, + "isSlot": false, + "src": "19671:6:19", + "valueSize": 1 + }, + { + "declaration": 5427, + "isOffset": false, + "isSlot": false, + "src": "19850:6:19", + "valueSize": 1 + }, + { + "declaration": 5425, + "isOffset": false, + "isSlot": false, + "src": "19621:7:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 5459, + "nodeType": "InlineAssembly", + "src": "19460:521:19" + } + ] + }, + "documentation": { + "id": 5416, + "nodeType": "StructuredDocumentation", + "src": "18968:88:19", + "text": " @dev Variant of {tryModExp} that supports inputs of arbitrary length." + }, + "id": 5461, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryModExp", + "nameLocation": "19070:9:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5423, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5418, + "mutability": "mutable", + "name": "b", + "nameLocation": "19102:1:19", + "nodeType": "VariableDeclaration", + "scope": 5461, + "src": "19089:14:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5417, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "19089:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5420, + "mutability": "mutable", + "name": "e", + "nameLocation": "19126:1:19", + "nodeType": "VariableDeclaration", + "scope": 5461, + "src": "19113:14:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5419, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "19113:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5422, + "mutability": "mutable", + "name": "m", + "nameLocation": "19150:1:19", + "nodeType": "VariableDeclaration", + "scope": 5461, + "src": "19137:14:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5421, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "19137:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "19079:78:19" + }, + "returnParameters": { + "id": 5428, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5425, + "mutability": "mutable", + "name": "success", + "nameLocation": "19186:7:19", + "nodeType": "VariableDeclaration", + "scope": 5461, + "src": "19181:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 5424, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "19181:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5427, + "mutability": "mutable", + "name": "result", + "nameLocation": "19208:6:19", + "nodeType": "VariableDeclaration", + "scope": 5461, + "src": "19195:19:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5426, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "19195:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "19180:35:19" + }, + "scope": 6204, + "src": "19061:926:19", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5507, + "nodeType": "Block", + "src": "20139:417:19", + "statements": [ + { + "assignments": [ + 5470 + ], + "declarations": [ + { + "constant": false, + "id": 5470, + "mutability": "mutable", + "name": "chunk", + "nameLocation": "20157:5:19", + "nodeType": "VariableDeclaration", + "scope": 5507, + "src": "20149:13:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5469, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "20149:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5471, + "nodeType": "VariableDeclarationStatement", + "src": "20149:13:19" + }, + { + "body": { + "id": 5503, + "nodeType": "Block", + "src": "20222:307:19", + "statements": [ + { + "AST": { + "nativeSrc": "20324:73:19", + "nodeType": "YulBlock", + "src": "20324:73:19", + "statements": [ + { + "nativeSrc": "20342:41:19", + "nodeType": "YulAssignment", + "src": "20342:41:19", + "value": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "20365:6:19", + "nodeType": "YulIdentifier", + "src": "20365:6:19" + }, + { + "kind": "number", + "nativeSrc": "20373:4:19", + "nodeType": "YulLiteral", + "src": "20373:4:19", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "20361:3:19", + "nodeType": "YulIdentifier", + "src": "20361:3:19" + }, + "nativeSrc": "20361:17:19", + "nodeType": "YulFunctionCall", + "src": "20361:17:19" + }, + { + "name": "i", + "nativeSrc": "20380:1:19", + "nodeType": "YulIdentifier", + "src": "20380:1:19" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "20357:3:19", + "nodeType": "YulIdentifier", + "src": "20357:3:19" + }, + "nativeSrc": "20357:25:19", + "nodeType": "YulFunctionCall", + "src": "20357:25:19" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "20351:5:19", + "nodeType": "YulIdentifier", + "src": "20351:5:19" + }, + "nativeSrc": "20351:32:19", + "nodeType": "YulFunctionCall", + "src": "20351:32:19" + }, + "variableNames": [ + { + "name": "chunk", + "nativeSrc": "20342:5:19", + "nodeType": "YulIdentifier", + "src": "20342:5:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 5464, + "isOffset": false, + "isSlot": false, + "src": "20365:6:19", + "valueSize": 1 + }, + { + "declaration": 5470, + "isOffset": false, + "isSlot": false, + "src": "20342:5:19", + "valueSize": 1 + }, + { + "declaration": 5473, + "isOffset": false, + "isSlot": false, + "src": "20380:1:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 5484, + "nodeType": "InlineAssembly", + "src": "20299:98:19" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5498, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5496, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5485, + "name": "chunk", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5470, + "src": "20414:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5494, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "38", + "id": 5486, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "20424:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5490, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5488, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5473, + "src": "20442:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "30783230", + "id": 5489, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "20446:4:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "0x20" + }, + "src": "20442:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 5491, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5464, + "src": "20452:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 5492, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "20459:6:19", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "20452:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5487, + "name": "saturatingSub", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4779, + "src": "20428:13:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 5493, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "20428:38:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "20424:42:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5495, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "20423:44:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "20414:53:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "hexValue": "30", + "id": 5497, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "20471:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "20414:58:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5502, + "nodeType": "IfStatement", + "src": "20410:109:19", + "trueBody": { + "id": 5501, + "nodeType": "Block", + "src": "20474:45:19", + "statements": [ + { + "expression": { + "hexValue": "66616c7365", + "id": 5499, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "20499:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + "functionReturnParameters": 5468, + "id": 5500, + "nodeType": "Return", + "src": "20492:12:19" + } + ] + } + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5479, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5476, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5473, + "src": "20192:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "expression": { + "id": 5477, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5464, + "src": "20196:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 5478, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "20203:6:19", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "20196:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "20192:17:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5504, + "initializationExpression": { + "assignments": [ + 5473 + ], + "declarations": [ + { + "constant": false, + "id": 5473, + "mutability": "mutable", + "name": "i", + "nameLocation": "20185:1:19", + "nodeType": "VariableDeclaration", + "scope": 5504, + "src": "20177:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5472, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "20177:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5475, + "initialValue": { + "hexValue": "30", + "id": 5474, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "20189:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "20177:13:19" + }, + "isSimpleCounterLoop": false, + "loopExpression": { + "expression": { + "id": 5482, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5480, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5473, + "src": "20211:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "hexValue": "30783230", + "id": 5481, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "20216:4:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "0x20" + }, + "src": "20211:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5483, + "nodeType": "ExpressionStatement", + "src": "20211:9:19" + }, + "nodeType": "ForStatement", + "src": "20172:357:19" + }, + { + "expression": { + "hexValue": "74727565", + "id": 5505, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "20545:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "functionReturnParameters": 5468, + "id": 5506, + "nodeType": "Return", + "src": "20538:11:19" + } + ] + }, + "documentation": { + "id": 5462, + "nodeType": "StructuredDocumentation", + "src": "19993:72:19", + "text": " @dev Returns whether the provided byte array is zero." + }, + "id": 5508, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_zeroBytes", + "nameLocation": "20079:10:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5465, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5464, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "20103:6:19", + "nodeType": "VariableDeclaration", + "scope": 5508, + "src": "20090:19:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5463, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "20090:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "20089:21:19" + }, + "returnParameters": { + "id": 5468, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5467, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5508, + "src": "20133:4:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 5466, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "20133:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "20132:6:19" + }, + "scope": 6204, + "src": "20070:486:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 5726, + "nodeType": "Block", + "src": "20916:5124:19", + "statements": [ + { + "id": 5725, + "nodeType": "UncheckedBlock", + "src": "20926:5108:19", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5518, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5516, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "21020:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<=", + "rightExpression": { + "hexValue": "31", + "id": 5517, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "21025:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "21020:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5522, + "nodeType": "IfStatement", + "src": "21016:53:19", + "trueBody": { + "id": 5521, + "nodeType": "Block", + "src": "21028:41:19", + "statements": [ + { + "expression": { + "id": 5519, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "21053:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5515, + "id": 5520, + "nodeType": "Return", + "src": "21046:8:19" + } + ] + } + }, + { + "assignments": [ + 5524 + ], + "declarations": [ + { + "constant": false, + "id": 5524, + "mutability": "mutable", + "name": "aa", + "nameLocation": "22004:2:19", + "nodeType": "VariableDeclaration", + "scope": 5725, + "src": "21996:10:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5523, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "21996:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5526, + "initialValue": { + "id": 5525, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "22009:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "21996:14:19" + }, + { + "assignments": [ + 5528 + ], + "declarations": [ + { + "constant": false, + "id": 5528, + "mutability": "mutable", + "name": "xn", + "nameLocation": "22032:2:19", + "nodeType": "VariableDeclaration", + "scope": 5725, + "src": "22024:10:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5527, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "22024:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5530, + "initialValue": { + "hexValue": "31", + "id": 5529, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22037:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "VariableDeclarationStatement", + "src": "22024:14:19" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5536, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5531, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22057:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_rational_340282366920938463463374607431768211456_by_1", + "typeString": "int_const 3402...(31 digits omitted)...1456" + }, + "id": 5534, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5532, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22064:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "313238", + "id": 5533, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22069:3:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_128_by_1", + "typeString": "int_const 128" + }, + "value": "128" + }, + "src": "22064:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_340282366920938463463374607431768211456_by_1", + "typeString": "int_const 3402...(31 digits omitted)...1456" + } + } + ], + "id": 5535, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "22063:10:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_340282366920938463463374607431768211456_by_1", + "typeString": "int_const 3402...(31 digits omitted)...1456" + } + }, + "src": "22057:16:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5546, + "nodeType": "IfStatement", + "src": "22053:92:19", + "trueBody": { + "id": 5545, + "nodeType": "Block", + "src": "22075:70:19", + "statements": [ + { + "expression": { + "id": 5539, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5537, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22093:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": ">>=", + "rightHandSide": { + "hexValue": "313238", + "id": 5538, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22100:3:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_128_by_1", + "typeString": "int_const 128" + }, + "value": "128" + }, + "src": "22093:10:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5540, + "nodeType": "ExpressionStatement", + "src": "22093:10:19" + }, + { + "expression": { + "id": 5543, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5541, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "22121:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "<<=", + "rightHandSide": { + "hexValue": "3634", + "id": 5542, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22128:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "22121:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5544, + "nodeType": "ExpressionStatement", + "src": "22121:9:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5552, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5547, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22162:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_rational_18446744073709551616_by_1", + "typeString": "int_const 18446744073709551616" + }, + "id": 5550, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5548, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22169:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3634", + "id": 5549, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22174:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "22169:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_18446744073709551616_by_1", + "typeString": "int_const 18446744073709551616" + } + } + ], + "id": 5551, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "22168:9:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_18446744073709551616_by_1", + "typeString": "int_const 18446744073709551616" + } + }, + "src": "22162:15:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5562, + "nodeType": "IfStatement", + "src": "22158:90:19", + "trueBody": { + "id": 5561, + "nodeType": "Block", + "src": "22179:69:19", + "statements": [ + { + "expression": { + "id": 5555, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5553, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22197:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": ">>=", + "rightHandSide": { + "hexValue": "3634", + "id": 5554, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22204:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "22197:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5556, + "nodeType": "ExpressionStatement", + "src": "22197:9:19" + }, + { + "expression": { + "id": 5559, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5557, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "22224:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "<<=", + "rightHandSide": { + "hexValue": "3332", + "id": 5558, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22231:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "22224:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5560, + "nodeType": "ExpressionStatement", + "src": "22224:9:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5568, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5563, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22265:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_rational_4294967296_by_1", + "typeString": "int_const 4294967296" + }, + "id": 5566, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5564, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22272:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3332", + "id": 5565, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22277:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "22272:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4294967296_by_1", + "typeString": "int_const 4294967296" + } + } + ], + "id": 5567, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "22271:9:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4294967296_by_1", + "typeString": "int_const 4294967296" + } + }, + "src": "22265:15:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5578, + "nodeType": "IfStatement", + "src": "22261:90:19", + "trueBody": { + "id": 5577, + "nodeType": "Block", + "src": "22282:69:19", + "statements": [ + { + "expression": { + "id": 5571, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5569, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22300:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": ">>=", + "rightHandSide": { + "hexValue": "3332", + "id": 5570, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22307:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "22300:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5572, + "nodeType": "ExpressionStatement", + "src": "22300:9:19" + }, + { + "expression": { + "id": 5575, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5573, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "22327:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "<<=", + "rightHandSide": { + "hexValue": "3136", + "id": 5574, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22334:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "22327:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5576, + "nodeType": "ExpressionStatement", + "src": "22327:9:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5584, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5579, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22368:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_rational_65536_by_1", + "typeString": "int_const 65536" + }, + "id": 5582, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5580, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22375:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3136", + "id": 5581, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22380:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "22375:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_65536_by_1", + "typeString": "int_const 65536" + } + } + ], + "id": 5583, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "22374:9:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_65536_by_1", + "typeString": "int_const 65536" + } + }, + "src": "22368:15:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5594, + "nodeType": "IfStatement", + "src": "22364:89:19", + "trueBody": { + "id": 5593, + "nodeType": "Block", + "src": "22385:68:19", + "statements": [ + { + "expression": { + "id": 5587, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5585, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22403:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": ">>=", + "rightHandSide": { + "hexValue": "3136", + "id": 5586, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22410:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "22403:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5588, + "nodeType": "ExpressionStatement", + "src": "22403:9:19" + }, + { + "expression": { + "id": 5591, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5589, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "22430:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "<<=", + "rightHandSide": { + "hexValue": "38", + "id": 5590, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22437:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "22430:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5592, + "nodeType": "ExpressionStatement", + "src": "22430:8:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5600, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5595, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22470:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_rational_256_by_1", + "typeString": "int_const 256" + }, + "id": 5598, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5596, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22477:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "38", + "id": 5597, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22482:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "22477:6:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_256_by_1", + "typeString": "int_const 256" + } + } + ], + "id": 5599, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "22476:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_256_by_1", + "typeString": "int_const 256" + } + }, + "src": "22470:14:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5610, + "nodeType": "IfStatement", + "src": "22466:87:19", + "trueBody": { + "id": 5609, + "nodeType": "Block", + "src": "22486:67:19", + "statements": [ + { + "expression": { + "id": 5603, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5601, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22504:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": ">>=", + "rightHandSide": { + "hexValue": "38", + "id": 5602, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22511:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "22504:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5604, + "nodeType": "ExpressionStatement", + "src": "22504:8:19" + }, + { + "expression": { + "id": 5607, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5605, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "22530:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "<<=", + "rightHandSide": { + "hexValue": "34", + "id": 5606, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22537:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "22530:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5608, + "nodeType": "ExpressionStatement", + "src": "22530:8:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5616, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5611, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22570:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "id": 5614, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5612, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22577:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "34", + "id": 5613, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22582:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "22577:6:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + } + } + ], + "id": 5615, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "22576:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + } + }, + "src": "22570:14:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5626, + "nodeType": "IfStatement", + "src": "22566:87:19", + "trueBody": { + "id": 5625, + "nodeType": "Block", + "src": "22586:67:19", + "statements": [ + { + "expression": { + "id": 5619, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5617, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22604:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": ">>=", + "rightHandSide": { + "hexValue": "34", + "id": 5618, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22611:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "22604:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5620, + "nodeType": "ExpressionStatement", + "src": "22604:8:19" + }, + { + "expression": { + "id": 5623, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5621, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "22630:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "<<=", + "rightHandSide": { + "hexValue": "32", + "id": 5622, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22637:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "22630:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5624, + "nodeType": "ExpressionStatement", + "src": "22630:8:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5632, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5627, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22670:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "id": 5630, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5628, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22677:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "32", + "id": 5629, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22682:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "22677:6:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + } + } + ], + "id": 5631, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "22676:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + } + }, + "src": "22670:14:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5638, + "nodeType": "IfStatement", + "src": "22666:61:19", + "trueBody": { + "id": 5637, + "nodeType": "Block", + "src": "22686:41:19", + "statements": [ + { + "expression": { + "id": 5635, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5633, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "22704:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "<<=", + "rightHandSide": { + "hexValue": "31", + "id": 5634, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22711:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "22704:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5636, + "nodeType": "ExpressionStatement", + "src": "22704:8:19" + } + ] + } + }, + { + "expression": { + "id": 5646, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5639, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "23147:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5645, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5642, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "33", + "id": 5640, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "23153:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5641, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "23157:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "23153:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5643, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "23152:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "31", + "id": 5644, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "23164:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "23152:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "23147:18:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5647, + "nodeType": "ExpressionStatement", + "src": "23147:18:19" + }, + { + "expression": { + "id": 5657, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5648, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25052:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5656, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5653, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5649, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25058:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5652, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5650, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "25063:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 5651, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25067:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25063:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25058:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5654, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "25057:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "31", + "id": 5655, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "25074:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "25057:18:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25052:23:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5658, + "nodeType": "ExpressionStatement", + "src": "25052:23:19" + }, + { + "expression": { + "id": 5668, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5659, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25161:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5667, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5664, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5660, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25167:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5663, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5661, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "25172:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 5662, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25176:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25172:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25167:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5665, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "25166:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "31", + "id": 5666, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "25183:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "25166:18:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25161:23:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5669, + "nodeType": "ExpressionStatement", + "src": "25161:23:19" + }, + { + "expression": { + "id": 5679, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5670, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25272:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5678, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5675, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5671, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25278:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5674, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5672, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "25283:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 5673, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25287:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25283:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25278:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5676, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "25277:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "31", + "id": 5677, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "25294:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "25277:18:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25272:23:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5680, + "nodeType": "ExpressionStatement", + "src": "25272:23:19" + }, + { + "expression": { + "id": 5690, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5681, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25381:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5689, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5686, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5682, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25387:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5685, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5683, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "25392:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 5684, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25396:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25392:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25387:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5687, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "25386:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "31", + "id": 5688, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "25403:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "25386:18:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25381:23:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5691, + "nodeType": "ExpressionStatement", + "src": "25381:23:19" + }, + { + "expression": { + "id": 5701, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5692, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25491:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5700, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5697, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5693, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25497:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5696, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5694, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "25502:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 5695, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25506:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25502:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25497:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5698, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "25496:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "31", + "id": 5699, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "25513:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "25496:18:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25491:23:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5702, + "nodeType": "ExpressionStatement", + "src": "25491:23:19" + }, + { + "expression": { + "id": 5712, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5703, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25601:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5711, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5708, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5704, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25607:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5707, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5705, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "25612:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 5706, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25616:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25612:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25607:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5709, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "25606:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "31", + "id": 5710, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "25623:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "25606:18:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25601:23:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5713, + "nodeType": "ExpressionStatement", + "src": "25601:23:19" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5723, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5714, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25990:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5721, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5717, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "26011:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5720, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5718, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "26016:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 5719, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "26020:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26016:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26011:11:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5715, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "25995:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5716, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "26004:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "25995:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5722, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "25995:28:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25990:33:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5515, + "id": 5724, + "nodeType": "Return", + "src": "25983:40:19" + } + ] + } + ] + }, + "documentation": { + "id": 5509, + "nodeType": "StructuredDocumentation", + "src": "20562:292:19", + "text": " @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded\n towards zero.\n This method is based on Newton's method for computing square roots; the algorithm is restricted to only\n using integer operations." + }, + "id": 5727, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "sqrt", + "nameLocation": "20868:4:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5512, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5511, + "mutability": "mutable", + "name": "a", + "nameLocation": "20881:1:19", + "nodeType": "VariableDeclaration", + "scope": 5727, + "src": "20873:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5510, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "20873:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "20872:11:19" + }, + "returnParameters": { + "id": 5515, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5514, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5727, + "src": "20907:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5513, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "20907:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "20906:9:19" + }, + "scope": 6204, + "src": "20859:5181:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5760, + "nodeType": "Block", + "src": "26213:171:19", + "statements": [ + { + "id": 5759, + "nodeType": "UncheckedBlock", + "src": "26223:155:19", + "statements": [ + { + "assignments": [ + 5739 + ], + "declarations": [ + { + "constant": false, + "id": 5739, + "mutability": "mutable", + "name": "result", + "nameLocation": "26255:6:19", + "nodeType": "VariableDeclaration", + "scope": 5759, + "src": "26247:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5738, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "26247:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5743, + "initialValue": { + "arguments": [ + { + "id": 5741, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5730, + "src": "26269:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5740, + "name": "sqrt", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 5727, + 5761 + ], + "referencedDeclaration": 5727, + "src": "26264:4:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256) pure returns (uint256)" + } + }, + "id": 5742, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "26264:7:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "26247:24:19" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5757, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5744, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5739, + "src": "26292:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 5755, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 5748, + "name": "rounding", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5733, + "src": "26334:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + ], + "id": 5747, + "name": "unsignedRoundsUp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6182, + "src": "26317:16:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_Rounding_$4559_$returns$_t_bool_$", + "typeString": "function (enum Math.Rounding) pure returns (bool)" + } + }, + "id": 5749, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "26317:26:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5754, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5752, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5750, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5739, + "src": "26347:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5751, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5739, + "src": "26356:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26347:15:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 5753, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5730, + "src": "26365:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26347:19:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "26317:49:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5745, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "26301:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5746, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "26310:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "26301:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5756, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "26301:66:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26292:75:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5737, + "id": 5758, + "nodeType": "Return", + "src": "26285:82:19" + } + ] + } + ] + }, + "documentation": { + "id": 5728, + "nodeType": "StructuredDocumentation", + "src": "26046:86:19", + "text": " @dev Calculates sqrt(a), following the selected rounding direction." + }, + "id": 5761, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "sqrt", + "nameLocation": "26146:4:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5734, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5730, + "mutability": "mutable", + "name": "a", + "nameLocation": "26159:1:19", + "nodeType": "VariableDeclaration", + "scope": 5761, + "src": "26151:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5729, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "26151:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5733, + "mutability": "mutable", + "name": "rounding", + "nameLocation": "26171:8:19", + "nodeType": "VariableDeclaration", + "scope": 5761, + "src": "26162:17:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + }, + "typeName": { + "id": 5732, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 5731, + "name": "Rounding", + "nameLocations": [ + "26162:8:19" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4559, + "src": "26162:8:19" + }, + "referencedDeclaration": 4559, + "src": "26162:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + }, + "visibility": "internal" + } + ], + "src": "26150:30:19" + }, + "returnParameters": { + "id": 5737, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5736, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5761, + "src": "26204:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5735, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "26204:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "26203:9:19" + }, + "scope": 6204, + "src": "26137:247:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5851, + "nodeType": "Block", + "src": "26573:2359:19", + "statements": [ + { + "expression": { + "id": 5778, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5769, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "26655:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5777, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5774, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5772, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5764, + "src": "26675:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30786666666666666666666666666666666666666666666666666666666666666666", + "id": 5773, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "26679:34:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_340282366920938463463374607431768211455_by_1", + "typeString": "int_const 3402...(31 digits omitted)...1455" + }, + "value": "0xffffffffffffffffffffffffffffffff" + }, + "src": "26675:38:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5770, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "26659:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5771, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "26668:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "26659:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5775, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "26659:55:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "37", + "id": 5776, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "26718:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_7_by_1", + "typeString": "int_const 7" + }, + "value": "7" + }, + "src": "26659:60:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26655:64:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5779, + "nodeType": "ExpressionStatement", + "src": "26655:64:19" + }, + { + "expression": { + "id": 5792, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5780, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "26795:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "|=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5791, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5788, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5785, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5783, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5764, + "src": "26817:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 5784, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "26822:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26817:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5786, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "26816:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "307866666666666666666666666666666666", + "id": 5787, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "26827:18:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_18446744073709551615_by_1", + "typeString": "int_const 18446744073709551615" + }, + "value": "0xffffffffffffffff" + }, + "src": "26816:29:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5781, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "26800:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5782, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "26809:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "26800:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5789, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "26800:46:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "36", + "id": 5790, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "26850:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_6_by_1", + "typeString": "int_const 6" + }, + "value": "6" + }, + "src": "26800:51:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26795:56:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5793, + "nodeType": "ExpressionStatement", + "src": "26795:56:19" + }, + { + "expression": { + "id": 5806, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5794, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "26926:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "|=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5805, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5802, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5799, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5797, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5764, + "src": "26948:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 5798, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "26953:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26948:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5800, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "26947:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30786666666666666666", + "id": 5801, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "26958:10:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4294967295_by_1", + "typeString": "int_const 4294967295" + }, + "value": "0xffffffff" + }, + "src": "26947:21:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5795, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "26931:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5796, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "26940:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "26931:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5803, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "26931:38:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "35", + "id": 5804, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "26973:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_5_by_1", + "typeString": "int_const 5" + }, + "value": "5" + }, + "src": "26931:43:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26926:48:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5807, + "nodeType": "ExpressionStatement", + "src": "26926:48:19" + }, + { + "expression": { + "id": 5820, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5808, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "27049:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "|=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5819, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5816, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5813, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5811, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5764, + "src": "27071:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 5812, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "27076:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "27071:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5814, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "27070:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "307866666666", + "id": 5815, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "27081:6:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_65535_by_1", + "typeString": "int_const 65535" + }, + "value": "0xffff" + }, + "src": "27070:17:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5809, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "27054:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5810, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "27063:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "27054:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5817, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "27054:34:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "34", + "id": 5818, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "27092:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "27054:39:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "27049:44:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5821, + "nodeType": "ExpressionStatement", + "src": "27049:44:19" + }, + { + "expression": { + "id": 5834, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5822, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "27166:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "|=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5833, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5830, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5827, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5825, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5764, + "src": "27188:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 5826, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "27193:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "27188:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5828, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "27187:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30786666", + "id": 5829, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "27198:4:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "0xff" + }, + "src": "27187:15:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5823, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "27171:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5824, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "27180:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "27171:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5831, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "27171:32:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "33", + "id": 5832, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "27207:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "src": "27171:37:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "27166:42:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5835, + "nodeType": "ExpressionStatement", + "src": "27166:42:19" + }, + { + "expression": { + "id": 5848, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5836, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "27280:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "|=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5847, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5844, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5841, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5839, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5764, + "src": "27302:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 5840, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "27307:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "27302:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5842, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "27301:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "307866", + "id": 5843, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "27312:3:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_15_by_1", + "typeString": "int_const 15" + }, + "value": "0xf" + }, + "src": "27301:14:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5837, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "27285:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5838, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "27294:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "27285:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5845, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "27285:31:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "32", + "id": 5846, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "27320:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "27285:36:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "27280:41:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5849, + "nodeType": "ExpressionStatement", + "src": "27280:41:19" + }, + { + "AST": { + "nativeSrc": "28807:119:19", + "nodeType": "YulBlock", + "src": "28807:119:19", + "statements": [ + { + "nativeSrc": "28821:95:19", + "nodeType": "YulAssignment", + "src": "28821:95:19", + "value": { + "arguments": [ + { + "name": "r", + "nativeSrc": "28829:1:19", + "nodeType": "YulIdentifier", + "src": "28829:1:19" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "r", + "nativeSrc": "28841:1:19", + "nodeType": "YulIdentifier", + "src": "28841:1:19" + }, + { + "name": "x", + "nativeSrc": "28844:1:19", + "nodeType": "YulIdentifier", + "src": "28844:1:19" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "28837:3:19", + "nodeType": "YulIdentifier", + "src": "28837:3:19" + }, + "nativeSrc": "28837:9:19", + "nodeType": "YulFunctionCall", + "src": "28837:9:19" + }, + { + "kind": "number", + "nativeSrc": "28848:66:19", + "nodeType": "YulLiteral", + "src": "28848:66:19", + "type": "", + "value": "0x0000010102020202030303030303030300000000000000000000000000000000" + } + ], + "functionName": { + "name": "byte", + "nativeSrc": "28832:4:19", + "nodeType": "YulIdentifier", + "src": "28832:4:19" + }, + "nativeSrc": "28832:83:19", + "nodeType": "YulFunctionCall", + "src": "28832:83:19" + } + ], + "functionName": { + "name": "or", + "nativeSrc": "28826:2:19", + "nodeType": "YulIdentifier", + "src": "28826:2:19" + }, + "nativeSrc": "28826:90:19", + "nodeType": "YulFunctionCall", + "src": "28826:90:19" + }, + "variableNames": [ + { + "name": "r", + "nativeSrc": "28821:1:19", + "nodeType": "YulIdentifier", + "src": "28821:1:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 5767, + "isOffset": false, + "isSlot": false, + "src": "28821:1:19", + "valueSize": 1 + }, + { + "declaration": 5767, + "isOffset": false, + "isSlot": false, + "src": "28829:1:19", + "valueSize": 1 + }, + { + "declaration": 5767, + "isOffset": false, + "isSlot": false, + "src": "28841:1:19", + "valueSize": 1 + }, + { + "declaration": 5764, + "isOffset": false, + "isSlot": false, + "src": "28844:1:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 5850, + "nodeType": "InlineAssembly", + "src": "28782:144:19" + } + ] + }, + "documentation": { + "id": 5762, + "nodeType": "StructuredDocumentation", + "src": "26390:119:19", + "text": " @dev Return the log in base 2 of a positive value rounded towards zero.\n Returns 0 if given 0." + }, + "id": 5852, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "log2", + "nameLocation": "26523:4:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5765, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5764, + "mutability": "mutable", + "name": "x", + "nameLocation": "26536:1:19", + "nodeType": "VariableDeclaration", + "scope": 5852, + "src": "26528:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5763, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "26528:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "26527:11:19" + }, + "returnParameters": { + "id": 5768, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5767, + "mutability": "mutable", + "name": "r", + "nameLocation": "26570:1:19", + "nodeType": "VariableDeclaration", + "scope": 5852, + "src": "26562:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5766, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "26562:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "26561:11:19" + }, + "scope": 6204, + "src": "26514:2418:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5885, + "nodeType": "Block", + "src": "29165:175:19", + "statements": [ + { + "id": 5884, + "nodeType": "UncheckedBlock", + "src": "29175:159:19", + "statements": [ + { + "assignments": [ + 5864 + ], + "declarations": [ + { + "constant": false, + "id": 5864, + "mutability": "mutable", + "name": "result", + "nameLocation": "29207:6:19", + "nodeType": "VariableDeclaration", + "scope": 5884, + "src": "29199:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5863, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "29199:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5868, + "initialValue": { + "arguments": [ + { + "id": 5866, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5855, + "src": "29221:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5865, + "name": "log2", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 5852, + 5886 + ], + "referencedDeclaration": 5852, + "src": "29216:4:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256) pure returns (uint256)" + } + }, + "id": 5867, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "29216:11:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "29199:28:19" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5882, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5869, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5864, + "src": "29248:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 5880, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 5873, + "name": "rounding", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5858, + "src": "29290:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + ], + "id": 5872, + "name": "unsignedRoundsUp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6182, + "src": "29273:16:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_Rounding_$4559_$returns$_t_bool_$", + "typeString": "function (enum Math.Rounding) pure returns (bool)" + } + }, + "id": 5874, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "29273:26:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5879, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5877, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5875, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29303:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "id": 5876, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5864, + "src": "29308:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "29303:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 5878, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5855, + "src": "29317:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "29303:19:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "29273:49:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5870, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "29257:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5871, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "29266:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "29257:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5881, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "29257:66:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "29248:75:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5862, + "id": 5883, + "nodeType": "Return", + "src": "29241:82:19" + } + ] + } + ] + }, + "documentation": { + "id": 5853, + "nodeType": "StructuredDocumentation", + "src": "28938:142:19", + "text": " @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n Returns 0 if given 0." + }, + "id": 5886, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "log2", + "nameLocation": "29094:4:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5859, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5855, + "mutability": "mutable", + "name": "value", + "nameLocation": "29107:5:19", + "nodeType": "VariableDeclaration", + "scope": 5886, + "src": "29099:13:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5854, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "29099:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5858, + "mutability": "mutable", + "name": "rounding", + "nameLocation": "29123:8:19", + "nodeType": "VariableDeclaration", + "scope": 5886, + "src": "29114:17:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + }, + "typeName": { + "id": 5857, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 5856, + "name": "Rounding", + "nameLocations": [ + "29114:8:19" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4559, + "src": "29114:8:19" + }, + "referencedDeclaration": 4559, + "src": "29114:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + }, + "visibility": "internal" + } + ], + "src": "29098:34:19" + }, + "returnParameters": { + "id": 5862, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5861, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5886, + "src": "29156:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5860, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "29156:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "29155:9:19" + }, + "scope": 6204, + "src": "29085:255:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6014, + "nodeType": "Block", + "src": "29533:854:19", + "statements": [ + { + "assignments": [ + 5895 + ], + "declarations": [ + { + "constant": false, + "id": 5895, + "mutability": "mutable", + "name": "result", + "nameLocation": "29551:6:19", + "nodeType": "VariableDeclaration", + "scope": 6014, + "src": "29543:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5894, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "29543:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5897, + "initialValue": { + "hexValue": "30", + "id": 5896, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29560:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "29543:18:19" + }, + { + "id": 6011, + "nodeType": "UncheckedBlock", + "src": "29571:787:19", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5902, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5898, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "29599:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_rational_10000000000000000000000000000000000000000000000000000000000000000_by_1", + "typeString": "int_const 1000...(57 digits omitted)...0000" + }, + "id": 5901, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5899, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29608:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "3634", + "id": 5900, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29614:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "29608:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10000000000000000000000000000000000000000000000000000000000000000_by_1", + "typeString": "int_const 1000...(57 digits omitted)...0000" + } + }, + "src": "29599:17:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5914, + "nodeType": "IfStatement", + "src": "29595:103:19", + "trueBody": { + "id": 5913, + "nodeType": "Block", + "src": "29618:80:19", + "statements": [ + { + "expression": { + "id": 5907, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5903, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "29636:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "/=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_rational_10000000000000000000000000000000000000000000000000000000000000000_by_1", + "typeString": "int_const 1000...(57 digits omitted)...0000" + }, + "id": 5906, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5904, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29645:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "3634", + "id": 5905, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29651:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "29645:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10000000000000000000000000000000000000000000000000000000000000000_by_1", + "typeString": "int_const 1000...(57 digits omitted)...0000" + } + }, + "src": "29636:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5908, + "nodeType": "ExpressionStatement", + "src": "29636:17:19" + }, + { + "expression": { + "id": 5911, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5909, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5895, + "src": "29671:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "hexValue": "3634", + "id": 5910, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29681:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "29671:12:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5912, + "nodeType": "ExpressionStatement", + "src": "29671:12:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5919, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5915, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "29715:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_rational_100000000000000000000000000000000_by_1", + "typeString": "int_const 1000...(25 digits omitted)...0000" + }, + "id": 5918, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5916, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29724:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "3332", + "id": 5917, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29730:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "29724:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_100000000000000000000000000000000_by_1", + "typeString": "int_const 1000...(25 digits omitted)...0000" + } + }, + "src": "29715:17:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5931, + "nodeType": "IfStatement", + "src": "29711:103:19", + "trueBody": { + "id": 5930, + "nodeType": "Block", + "src": "29734:80:19", + "statements": [ + { + "expression": { + "id": 5924, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5920, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "29752:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "/=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_rational_100000000000000000000000000000000_by_1", + "typeString": "int_const 1000...(25 digits omitted)...0000" + }, + "id": 5923, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5921, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29761:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "3332", + "id": 5922, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29767:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "29761:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_100000000000000000000000000000000_by_1", + "typeString": "int_const 1000...(25 digits omitted)...0000" + } + }, + "src": "29752:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5925, + "nodeType": "ExpressionStatement", + "src": "29752:17:19" + }, + { + "expression": { + "id": 5928, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5926, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5895, + "src": "29787:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "hexValue": "3332", + "id": 5927, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29797:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "29787:12:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5929, + "nodeType": "ExpressionStatement", + "src": "29787:12:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5936, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5932, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "29831:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_rational_10000000000000000_by_1", + "typeString": "int_const 10000000000000000" + }, + "id": 5935, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5933, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29840:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "3136", + "id": 5934, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29846:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "29840:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10000000000000000_by_1", + "typeString": "int_const 10000000000000000" + } + }, + "src": "29831:17:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5948, + "nodeType": "IfStatement", + "src": "29827:103:19", + "trueBody": { + "id": 5947, + "nodeType": "Block", + "src": "29850:80:19", + "statements": [ + { + "expression": { + "id": 5941, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5937, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "29868:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "/=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_rational_10000000000000000_by_1", + "typeString": "int_const 10000000000000000" + }, + "id": 5940, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5938, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29877:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "3136", + "id": 5939, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29883:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "29877:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10000000000000000_by_1", + "typeString": "int_const 10000000000000000" + } + }, + "src": "29868:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5942, + "nodeType": "ExpressionStatement", + "src": "29868:17:19" + }, + { + "expression": { + "id": 5945, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5943, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5895, + "src": "29903:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "hexValue": "3136", + "id": 5944, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29913:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "29903:12:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5946, + "nodeType": "ExpressionStatement", + "src": "29903:12:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5953, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5949, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "29947:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_rational_100000000_by_1", + "typeString": "int_const 100000000" + }, + "id": 5952, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5950, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29956:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "38", + "id": 5951, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29962:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "29956:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_100000000_by_1", + "typeString": "int_const 100000000" + } + }, + "src": "29947:16:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5965, + "nodeType": "IfStatement", + "src": "29943:100:19", + "trueBody": { + "id": 5964, + "nodeType": "Block", + "src": "29965:78:19", + "statements": [ + { + "expression": { + "id": 5958, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5954, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "29983:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "/=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_rational_100000000_by_1", + "typeString": "int_const 100000000" + }, + "id": 5957, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5955, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29992:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "38", + "id": 5956, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29998:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "29992:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_100000000_by_1", + "typeString": "int_const 100000000" + } + }, + "src": "29983:16:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5959, + "nodeType": "ExpressionStatement", + "src": "29983:16:19" + }, + { + "expression": { + "id": 5962, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5960, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5895, + "src": "30017:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "hexValue": "38", + "id": 5961, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30027:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "30017:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5963, + "nodeType": "ExpressionStatement", + "src": "30017:11:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5970, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5966, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "30060:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_rational_10000_by_1", + "typeString": "int_const 10000" + }, + "id": 5969, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5967, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30069:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "34", + "id": 5968, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30075:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "30069:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10000_by_1", + "typeString": "int_const 10000" + } + }, + "src": "30060:16:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5982, + "nodeType": "IfStatement", + "src": "30056:100:19", + "trueBody": { + "id": 5981, + "nodeType": "Block", + "src": "30078:78:19", + "statements": [ + { + "expression": { + "id": 5975, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5971, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "30096:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "/=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_rational_10000_by_1", + "typeString": "int_const 10000" + }, + "id": 5974, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5972, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30105:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "34", + "id": 5973, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30111:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "30105:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10000_by_1", + "typeString": "int_const 10000" + } + }, + "src": "30096:16:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5976, + "nodeType": "ExpressionStatement", + "src": "30096:16:19" + }, + { + "expression": { + "id": 5979, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5977, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5895, + "src": "30130:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "hexValue": "34", + "id": 5978, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30140:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "30130:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5980, + "nodeType": "ExpressionStatement", + "src": "30130:11:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5987, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5983, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "30173:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_rational_100_by_1", + "typeString": "int_const 100" + }, + "id": 5986, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5984, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30182:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "32", + "id": 5985, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30188:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "30182:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_100_by_1", + "typeString": "int_const 100" + } + }, + "src": "30173:16:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5999, + "nodeType": "IfStatement", + "src": "30169:100:19", + "trueBody": { + "id": 5998, + "nodeType": "Block", + "src": "30191:78:19", + "statements": [ + { + "expression": { + "id": 5992, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5988, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "30209:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "/=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_rational_100_by_1", + "typeString": "int_const 100" + }, + "id": 5991, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5989, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30218:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "32", + "id": 5990, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30224:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "30218:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_100_by_1", + "typeString": "int_const 100" + } + }, + "src": "30209:16:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5993, + "nodeType": "ExpressionStatement", + "src": "30209:16:19" + }, + { + "expression": { + "id": 5996, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5994, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5895, + "src": "30243:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "hexValue": "32", + "id": 5995, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30253:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "30243:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5997, + "nodeType": "ExpressionStatement", + "src": "30243:11:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6004, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6000, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "30286:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "id": 6003, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 6001, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30295:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "31", + "id": 6002, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30301:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "30295:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + } + }, + "src": "30286:16:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6010, + "nodeType": "IfStatement", + "src": "30282:66:19", + "trueBody": { + "id": 6009, + "nodeType": "Block", + "src": "30304:44:19", + "statements": [ + { + "expression": { + "id": 6007, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 6005, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5895, + "src": "30322:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "hexValue": "31", + "id": 6006, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30332:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "30322:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 6008, + "nodeType": "ExpressionStatement", + "src": "30322:11:19" + } + ] + } + } + ] + }, + { + "expression": { + "id": 6012, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5895, + "src": "30374:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5893, + "id": 6013, + "nodeType": "Return", + "src": "30367:13:19" + } + ] + }, + "documentation": { + "id": 5887, + "nodeType": "StructuredDocumentation", + "src": "29346:120:19", + "text": " @dev Return the log in base 10 of a positive value rounded towards zero.\n Returns 0 if given 0." + }, + "id": 6015, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "log10", + "nameLocation": "29480:5:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5890, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5889, + "mutability": "mutable", + "name": "value", + "nameLocation": "29494:5:19", + "nodeType": "VariableDeclaration", + "scope": 6015, + "src": "29486:13:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5888, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "29486:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "29485:15:19" + }, + "returnParameters": { + "id": 5893, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5892, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6015, + "src": "29524:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5891, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "29524:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "29523:9:19" + }, + "scope": 6204, + "src": "29471:916:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6048, + "nodeType": "Block", + "src": "30622:177:19", + "statements": [ + { + "id": 6047, + "nodeType": "UncheckedBlock", + "src": "30632:161:19", + "statements": [ + { + "assignments": [ + 6027 + ], + "declarations": [ + { + "constant": false, + "id": 6027, + "mutability": "mutable", + "name": "result", + "nameLocation": "30664:6:19", + "nodeType": "VariableDeclaration", + "scope": 6047, + "src": "30656:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6026, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "30656:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 6031, + "initialValue": { + "arguments": [ + { + "id": 6029, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6018, + "src": "30679:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6028, + "name": "log10", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 6015, + 6049 + ], + "referencedDeclaration": 6015, + "src": "30673:5:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256) pure returns (uint256)" + } + }, + "id": 6030, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "30673:12:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "30656:29:19" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6045, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6032, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6027, + "src": "30706:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 6043, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 6036, + "name": "rounding", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6021, + "src": "30748:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + ], + "id": 6035, + "name": "unsignedRoundsUp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6182, + "src": "30731:16:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_Rounding_$4559_$returns$_t_bool_$", + "typeString": "function (enum Math.Rounding) pure returns (bool)" + } + }, + "id": 6037, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "30731:26:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6042, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6040, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 6038, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30761:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "id": 6039, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6027, + "src": "30767:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "30761:12:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 6041, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6018, + "src": "30776:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "30761:20:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "30731:50:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 6033, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "30715:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 6034, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "30724:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "30715:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 6044, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "30715:67:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "30706:76:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 6025, + "id": 6046, + "nodeType": "Return", + "src": "30699:83:19" + } + ] + } + ] + }, + "documentation": { + "id": 6016, + "nodeType": "StructuredDocumentation", + "src": "30393:143:19", + "text": " @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n Returns 0 if given 0." + }, + "id": 6049, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "log10", + "nameLocation": "30550:5:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6022, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6018, + "mutability": "mutable", + "name": "value", + "nameLocation": "30564:5:19", + "nodeType": "VariableDeclaration", + "scope": 6049, + "src": "30556:13:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6017, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "30556:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 6021, + "mutability": "mutable", + "name": "rounding", + "nameLocation": "30580:8:19", + "nodeType": "VariableDeclaration", + "scope": 6049, + "src": "30571:17:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + }, + "typeName": { + "id": 6020, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 6019, + "name": "Rounding", + "nameLocations": [ + "30571:8:19" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4559, + "src": "30571:8:19" + }, + "referencedDeclaration": 4559, + "src": "30571:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + }, + "visibility": "internal" + } + ], + "src": "30555:34:19" + }, + "returnParameters": { + "id": 6025, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6024, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6049, + "src": "30613:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6023, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "30613:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "30612:9:19" + }, + "scope": 6204, + "src": "30541:258:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6125, + "nodeType": "Block", + "src": "31117:675:19", + "statements": [ + { + "expression": { + "id": 6066, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 6057, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6055, + "src": "31199:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6065, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6062, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6060, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6052, + "src": "31219:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30786666666666666666666666666666666666666666666666666666666666666666", + "id": 6061, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31223:34:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_340282366920938463463374607431768211455_by_1", + "typeString": "int_const 3402...(31 digits omitted)...1455" + }, + "value": "0xffffffffffffffffffffffffffffffff" + }, + "src": "31219:38:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 6058, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "31203:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 6059, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "31212:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "31203:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 6063, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "31203:55:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "37", + "id": 6064, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31262:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_7_by_1", + "typeString": "int_const 7" + }, + "value": "7" + }, + "src": "31203:60:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "31199:64:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 6067, + "nodeType": "ExpressionStatement", + "src": "31199:64:19" + }, + { + "expression": { + "id": 6080, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 6068, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6055, + "src": "31339:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "|=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6079, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6076, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6073, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6071, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6052, + "src": "31361:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 6072, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6055, + "src": "31366:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "31361:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 6074, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "31360:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "307866666666666666666666666666666666", + "id": 6075, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31371:18:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_18446744073709551615_by_1", + "typeString": "int_const 18446744073709551615" + }, + "value": "0xffffffffffffffff" + }, + "src": "31360:29:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 6069, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "31344:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 6070, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "31353:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "31344:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 6077, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "31344:46:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "36", + "id": 6078, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31394:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_6_by_1", + "typeString": "int_const 6" + }, + "value": "6" + }, + "src": "31344:51:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "31339:56:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 6081, + "nodeType": "ExpressionStatement", + "src": "31339:56:19" + }, + { + "expression": { + "id": 6094, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 6082, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6055, + "src": "31470:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "|=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6093, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6090, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6087, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6085, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6052, + "src": "31492:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 6086, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6055, + "src": "31497:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "31492:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 6088, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "31491:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30786666666666666666", + "id": 6089, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31502:10:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4294967295_by_1", + "typeString": "int_const 4294967295" + }, + "value": "0xffffffff" + }, + "src": "31491:21:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 6083, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "31475:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 6084, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "31484:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "31475:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 6091, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "31475:38:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "35", + "id": 6092, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31517:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_5_by_1", + "typeString": "int_const 5" + }, + "value": "5" + }, + "src": "31475:43:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "31470:48:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 6095, + "nodeType": "ExpressionStatement", + "src": "31470:48:19" + }, + { + "expression": { + "id": 6108, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 6096, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6055, + "src": "31593:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "|=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6107, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6104, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6101, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6099, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6052, + "src": "31615:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 6100, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6055, + "src": "31620:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "31615:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 6102, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "31614:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "307866666666", + "id": 6103, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31625:6:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_65535_by_1", + "typeString": "int_const 65535" + }, + "value": "0xffff" + }, + "src": "31614:17:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 6097, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "31598:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 6098, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "31607:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "31598:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 6105, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "31598:34:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "34", + "id": 6106, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31636:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "31598:39:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "31593:44:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 6109, + "nodeType": "ExpressionStatement", + "src": "31593:44:19" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6123, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6112, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6110, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6055, + "src": "31743:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "33", + "id": 6111, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31748:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "src": "31743:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 6113, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "31742:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6121, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6118, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6116, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6052, + "src": "31770:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 6117, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6055, + "src": "31775:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "31770:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 6119, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "31769:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30786666", + "id": 6120, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31780:4:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "0xff" + }, + "src": "31769:15:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 6114, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "31753:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 6115, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "31762:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "31753:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 6122, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "31753:32:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "31742:43:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 6056, + "id": 6124, + "nodeType": "Return", + "src": "31735:50:19" + } + ] + }, + "documentation": { + "id": 6050, + "nodeType": "StructuredDocumentation", + "src": "30805:246:19", + "text": " @dev Return the log in base 256 of a positive value rounded towards zero.\n Returns 0 if given 0.\n Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string." + }, + "id": 6126, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "log256", + "nameLocation": "31065:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6053, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6052, + "mutability": "mutable", + "name": "x", + "nameLocation": "31080:1:19", + "nodeType": "VariableDeclaration", + "scope": 6126, + "src": "31072:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6051, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "31072:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "31071:11:19" + }, + "returnParameters": { + "id": 6056, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6055, + "mutability": "mutable", + "name": "r", + "nameLocation": "31114:1:19", + "nodeType": "VariableDeclaration", + "scope": 6126, + "src": "31106:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6054, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "31106:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "31105:11:19" + }, + "scope": 6204, + "src": "31056:736:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6162, + "nodeType": "Block", + "src": "32029:184:19", + "statements": [ + { + "id": 6161, + "nodeType": "UncheckedBlock", + "src": "32039:168:19", + "statements": [ + { + "assignments": [ + 6138 + ], + "declarations": [ + { + "constant": false, + "id": 6138, + "mutability": "mutable", + "name": "result", + "nameLocation": "32071:6:19", + "nodeType": "VariableDeclaration", + "scope": 6161, + "src": "32063:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6137, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "32063:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 6142, + "initialValue": { + "arguments": [ + { + "id": 6140, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6129, + "src": "32087:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6139, + "name": "log256", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 6126, + 6163 + ], + "referencedDeclaration": 6126, + "src": "32080:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256) pure returns (uint256)" + } + }, + "id": 6141, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "32080:13:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "32063:30:19" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6159, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6143, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6138, + "src": "32114:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 6157, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 6147, + "name": "rounding", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6132, + "src": "32156:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + ], + "id": 6146, + "name": "unsignedRoundsUp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6182, + "src": "32139:16:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_Rounding_$4559_$returns$_t_bool_$", + "typeString": "function (enum Math.Rounding) pure returns (bool)" + } + }, + "id": 6148, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "32139:26:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6156, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6154, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 6149, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "32169:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6152, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6150, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6138, + "src": "32175:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "33", + "id": 6151, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "32185:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "src": "32175:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 6153, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "32174:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "32169:18:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 6155, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6129, + "src": "32190:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "32169:26:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "32139:56:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 6144, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "32123:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 6145, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "32132:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "32123:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 6158, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "32123:73:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "32114:82:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 6136, + "id": 6160, + "nodeType": "Return", + "src": "32107:89:19" + } + ] + } + ] + }, + "documentation": { + "id": 6127, + "nodeType": "StructuredDocumentation", + "src": "31798:144:19", + "text": " @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n Returns 0 if given 0." + }, + "id": 6163, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "log256", + "nameLocation": "31956:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6133, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6129, + "mutability": "mutable", + "name": "value", + "nameLocation": "31971:5:19", + "nodeType": "VariableDeclaration", + "scope": 6163, + "src": "31963:13:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6128, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "31963:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 6132, + "mutability": "mutable", + "name": "rounding", + "nameLocation": "31987:8:19", + "nodeType": "VariableDeclaration", + "scope": 6163, + "src": "31978:17:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + }, + "typeName": { + "id": 6131, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 6130, + "name": "Rounding", + "nameLocations": [ + "31978:8:19" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4559, + "src": "31978:8:19" + }, + "referencedDeclaration": 4559, + "src": "31978:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + }, + "visibility": "internal" + } + ], + "src": "31962:34:19" + }, + "returnParameters": { + "id": 6136, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6135, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6163, + "src": "32020:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6134, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "32020:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "32019:9:19" + }, + "scope": 6204, + "src": "31947:266:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6181, + "nodeType": "Block", + "src": "32411:48:19", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 6179, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 6177, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 6174, + "name": "rounding", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6167, + "src": "32434:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + ], + "id": 6173, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "32428:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": { + "id": 6172, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "32428:5:19", + "typeDescriptions": {} + } + }, + "id": 6175, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "32428:15:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { + "hexValue": "32", + "id": 6176, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "32446:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "32428:19:19", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "31", + "id": 6178, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "32451:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "32428:24:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 6171, + "id": 6180, + "nodeType": "Return", + "src": "32421:31:19" + } + ] + }, + "documentation": { + "id": 6164, + "nodeType": "StructuredDocumentation", + "src": "32219:113:19", + "text": " @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers." + }, + "id": 6182, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "unsignedRoundsUp", + "nameLocation": "32346:16:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6168, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6167, + "mutability": "mutable", + "name": "rounding", + "nameLocation": "32372:8:19", + "nodeType": "VariableDeclaration", + "scope": 6182, + "src": "32363:17:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + }, + "typeName": { + "id": 6166, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 6165, + "name": "Rounding", + "nameLocations": [ + "32363:8:19" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4559, + "src": "32363:8:19" + }, + "referencedDeclaration": 4559, + "src": "32363:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + }, + "visibility": "internal" + } + ], + "src": "32362:19:19" + }, + "returnParameters": { + "id": 6171, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6170, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6182, + "src": "32405:4:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 6169, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "32405:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "32404:6:19" + }, + "scope": 6204, + "src": "32337:122:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6202, + "nodeType": "Block", + "src": "32602:59:19", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6193, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6191, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6185, + "src": "32627:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 6192, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "32632:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "32627:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "323536", + "id": 6194, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "32635:3:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_256_by_1", + "typeString": "int_const 256" + }, + "value": "256" + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6199, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "323535", + "id": 6195, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "32640:3:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "255" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "arguments": [ + { + "id": 6197, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6185, + "src": "32651:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6196, + "name": "log2", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 5852, + 5886 + ], + "referencedDeclaration": 5852, + "src": "32646:4:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256) pure returns (uint256)" + } + }, + "id": 6198, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "32646:7:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "32640:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_rational_256_by_1", + "typeString": "int_const 256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6190, + "name": "ternary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4836, + "src": "32619:7:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bool,uint256,uint256) pure returns (uint256)" + } + }, + "id": 6200, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "32619:35:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 6189, + "id": 6201, + "nodeType": "Return", + "src": "32612:42:19" + } + ] + }, + "documentation": { + "id": 6183, + "nodeType": "StructuredDocumentation", + "src": "32465:76:19", + "text": " @dev Counts the number of leading zero bits in a uint256." + }, + "id": 6203, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "clz", + "nameLocation": "32555:3:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6186, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6185, + "mutability": "mutable", + "name": "x", + "nameLocation": "32567:1:19", + "nodeType": "VariableDeclaration", + "scope": 6203, + "src": "32559:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6184, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "32559:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "32558:11:19" + }, + "returnParameters": { + "id": 6189, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6188, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6203, + "src": "32593:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6187, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "32593:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "32592:9:19" + }, + "scope": 6204, + "src": "32546:115:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + } + ], + "scope": 6205, + "src": "281:32382:19", + "usedErrors": [], + "usedEvents": [] + } + ], + "src": "103:32561:19" + }, + "id": 19 + }, + "@openzeppelin/contracts/utils/math/SafeCast.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/math/SafeCast.sol", + "exportedSymbols": { + "SafeCast": [ + 7969 + ] + }, + "id": 7970, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 6206, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "192:24:20" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "SafeCast", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 6207, + "nodeType": "StructuredDocumentation", + "src": "218:550:20", + "text": " @dev Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow\n checks.\n Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n easily result in undesired exploitation or bugs, since developers usually\n assume that overflows raise errors. `SafeCast` restores this intuition by\n reverting the transaction when such an operation overflows.\n Using this library instead of the unchecked operations eliminates an entire\n class of bugs, so it's recommended to use it always." + }, + "fullyImplemented": true, + "id": 7969, + "linearizedBaseContracts": [ + 7969 + ], + "name": "SafeCast", + "nameLocation": "777:8:20", + "nodeType": "ContractDefinition", + "nodes": [ + { + "documentation": { + "id": 6208, + "nodeType": "StructuredDocumentation", + "src": "792:67:20", + "text": " @dev Value doesn't fit in a uint of `bits` size." + }, + "errorSelector": "6dfcc650", + "id": 6214, + "name": "SafeCastOverflowedUintDowncast", + "nameLocation": "870:30:20", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 6213, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6210, + "mutability": "mutable", + "name": "bits", + "nameLocation": "907:4:20", + "nodeType": "VariableDeclaration", + "scope": 6214, + "src": "901:10:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 6209, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "901:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 6212, + "mutability": "mutable", + "name": "value", + "nameLocation": "921:5:20", + "nodeType": "VariableDeclaration", + "scope": 6214, + "src": "913:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6211, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "913:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "900:27:20" + }, + "src": "864:64:20" + }, + { + "documentation": { + "id": 6215, + "nodeType": "StructuredDocumentation", + "src": "934:74:20", + "text": " @dev An int value doesn't fit in a uint of `bits` size." + }, + "errorSelector": "a8ce4432", + "id": 6219, + "name": "SafeCastOverflowedIntToUint", + "nameLocation": "1019:27:20", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 6218, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6217, + "mutability": "mutable", + "name": "value", + "nameLocation": "1054:5:20", + "nodeType": "VariableDeclaration", + "scope": 6219, + "src": "1047:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 6216, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1047:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "1046:14:20" + }, + "src": "1013:48:20" + }, + { + "documentation": { + "id": 6220, + "nodeType": "StructuredDocumentation", + "src": "1067:67:20", + "text": " @dev Value doesn't fit in an int of `bits` size." + }, + "errorSelector": "327269a7", + "id": 6226, + "name": "SafeCastOverflowedIntDowncast", + "nameLocation": "1145:29:20", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 6225, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6222, + "mutability": "mutable", + "name": "bits", + "nameLocation": "1181:4:20", + "nodeType": "VariableDeclaration", + "scope": 6226, + "src": "1175:10:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 6221, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "1175:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 6224, + "mutability": "mutable", + "name": "value", + "nameLocation": "1194:5:20", + "nodeType": "VariableDeclaration", + "scope": 6226, + "src": "1187:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 6223, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1187:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "1174:26:20" + }, + "src": "1139:62:20" + }, + { + "documentation": { + "id": 6227, + "nodeType": "StructuredDocumentation", + "src": "1207:74:20", + "text": " @dev A uint value doesn't fit in an int of `bits` size." + }, + "errorSelector": "24775e06", + "id": 6231, + "name": "SafeCastOverflowedUintToInt", + "nameLocation": "1292:27:20", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 6230, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6229, + "mutability": "mutable", + "name": "value", + "nameLocation": "1328:5:20", + "nodeType": "VariableDeclaration", + "scope": 6231, + "src": "1320:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6228, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1320:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1319:15:20" + }, + "src": "1286:49:20" + }, + { + "body": { + "id": 6258, + "nodeType": "Block", + "src": "1692:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6245, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6239, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6234, + "src": "1706:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6242, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1719:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint248_$", + "typeString": "type(uint248)" + }, + "typeName": { + "id": 6241, + "name": "uint248", + "nodeType": "ElementaryTypeName", + "src": "1719:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint248_$", + "typeString": "type(uint248)" + } + ], + "id": 6240, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "1714:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6243, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1714:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint248", + "typeString": "type(uint248)" + } + }, + "id": 6244, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "1728:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "1714:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint248", + "typeString": "uint248" + } + }, + "src": "1706:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6252, + "nodeType": "IfStatement", + "src": "1702:105:20", + "trueBody": { + "id": 6251, + "nodeType": "Block", + "src": "1733:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323438", + "id": 6247, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1785:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_248_by_1", + "typeString": "int_const 248" + }, + "value": "248" + }, + { + "id": 6248, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6234, + "src": "1790:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_248_by_1", + "typeString": "int_const 248" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6246, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "1754:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6249, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1754:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6250, + "nodeType": "RevertStatement", + "src": "1747:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6255, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6234, + "src": "1831:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6254, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1823:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint248_$", + "typeString": "type(uint248)" + }, + "typeName": { + "id": 6253, + "name": "uint248", + "nodeType": "ElementaryTypeName", + "src": "1823:7:20", + "typeDescriptions": {} + } + }, + "id": 6256, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1823:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint248", + "typeString": "uint248" + } + }, + "functionReturnParameters": 6238, + "id": 6257, + "nodeType": "Return", + "src": "1816:21:20" + } + ] + }, + "documentation": { + "id": 6232, + "nodeType": "StructuredDocumentation", + "src": "1341:280:20", + "text": " @dev Returns the downcasted uint248 from uint256, reverting on\n overflow (when the input is greater than largest uint248).\n Counterpart to Solidity's `uint248` operator.\n Requirements:\n - input must fit into 248 bits" + }, + "id": 6259, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint248", + "nameLocation": "1635:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6235, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6234, + "mutability": "mutable", + "name": "value", + "nameLocation": "1653:5:20", + "nodeType": "VariableDeclaration", + "scope": 6259, + "src": "1645:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6233, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1645:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1644:15:20" + }, + "returnParameters": { + "id": 6238, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6237, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6259, + "src": "1683:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint248", + "typeString": "uint248" + }, + "typeName": { + "id": 6236, + "name": "uint248", + "nodeType": "ElementaryTypeName", + "src": "1683:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint248", + "typeString": "uint248" + } + }, + "visibility": "internal" + } + ], + "src": "1682:9:20" + }, + "scope": 7969, + "src": "1626:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6286, + "nodeType": "Block", + "src": "2201:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6273, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6267, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6262, + "src": "2215:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6270, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2228:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint240_$", + "typeString": "type(uint240)" + }, + "typeName": { + "id": 6269, + "name": "uint240", + "nodeType": "ElementaryTypeName", + "src": "2228:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint240_$", + "typeString": "type(uint240)" + } + ], + "id": 6268, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "2223:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6271, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2223:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint240", + "typeString": "type(uint240)" + } + }, + "id": 6272, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "2237:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "2223:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint240", + "typeString": "uint240" + } + }, + "src": "2215:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6280, + "nodeType": "IfStatement", + "src": "2211:105:20", + "trueBody": { + "id": 6279, + "nodeType": "Block", + "src": "2242:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323430", + "id": 6275, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2294:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_240_by_1", + "typeString": "int_const 240" + }, + "value": "240" + }, + { + "id": 6276, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6262, + "src": "2299:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_240_by_1", + "typeString": "int_const 240" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6274, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "2263:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6277, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2263:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6278, + "nodeType": "RevertStatement", + "src": "2256:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6283, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6262, + "src": "2340:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6282, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2332:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint240_$", + "typeString": "type(uint240)" + }, + "typeName": { + "id": 6281, + "name": "uint240", + "nodeType": "ElementaryTypeName", + "src": "2332:7:20", + "typeDescriptions": {} + } + }, + "id": 6284, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2332:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint240", + "typeString": "uint240" + } + }, + "functionReturnParameters": 6266, + "id": 6285, + "nodeType": "Return", + "src": "2325:21:20" + } + ] + }, + "documentation": { + "id": 6260, + "nodeType": "StructuredDocumentation", + "src": "1850:280:20", + "text": " @dev Returns the downcasted uint240 from uint256, reverting on\n overflow (when the input is greater than largest uint240).\n Counterpart to Solidity's `uint240` operator.\n Requirements:\n - input must fit into 240 bits" + }, + "id": 6287, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint240", + "nameLocation": "2144:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6263, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6262, + "mutability": "mutable", + "name": "value", + "nameLocation": "2162:5:20", + "nodeType": "VariableDeclaration", + "scope": 6287, + "src": "2154:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6261, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2154:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2153:15:20" + }, + "returnParameters": { + "id": 6266, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6265, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6287, + "src": "2192:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint240", + "typeString": "uint240" + }, + "typeName": { + "id": 6264, + "name": "uint240", + "nodeType": "ElementaryTypeName", + "src": "2192:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint240", + "typeString": "uint240" + } + }, + "visibility": "internal" + } + ], + "src": "2191:9:20" + }, + "scope": 7969, + "src": "2135:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6314, + "nodeType": "Block", + "src": "2710:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6301, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6295, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6290, + "src": "2724:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6298, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2737:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint232_$", + "typeString": "type(uint232)" + }, + "typeName": { + "id": 6297, + "name": "uint232", + "nodeType": "ElementaryTypeName", + "src": "2737:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint232_$", + "typeString": "type(uint232)" + } + ], + "id": 6296, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "2732:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6299, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2732:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint232", + "typeString": "type(uint232)" + } + }, + "id": 6300, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "2746:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "2732:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint232", + "typeString": "uint232" + } + }, + "src": "2724:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6308, + "nodeType": "IfStatement", + "src": "2720:105:20", + "trueBody": { + "id": 6307, + "nodeType": "Block", + "src": "2751:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323332", + "id": 6303, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2803:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_232_by_1", + "typeString": "int_const 232" + }, + "value": "232" + }, + { + "id": 6304, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6290, + "src": "2808:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_232_by_1", + "typeString": "int_const 232" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6302, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "2772:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6305, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2772:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6306, + "nodeType": "RevertStatement", + "src": "2765:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6311, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6290, + "src": "2849:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6310, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2841:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint232_$", + "typeString": "type(uint232)" + }, + "typeName": { + "id": 6309, + "name": "uint232", + "nodeType": "ElementaryTypeName", + "src": "2841:7:20", + "typeDescriptions": {} + } + }, + "id": 6312, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2841:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint232", + "typeString": "uint232" + } + }, + "functionReturnParameters": 6294, + "id": 6313, + "nodeType": "Return", + "src": "2834:21:20" + } + ] + }, + "documentation": { + "id": 6288, + "nodeType": "StructuredDocumentation", + "src": "2359:280:20", + "text": " @dev Returns the downcasted uint232 from uint256, reverting on\n overflow (when the input is greater than largest uint232).\n Counterpart to Solidity's `uint232` operator.\n Requirements:\n - input must fit into 232 bits" + }, + "id": 6315, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint232", + "nameLocation": "2653:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6291, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6290, + "mutability": "mutable", + "name": "value", + "nameLocation": "2671:5:20", + "nodeType": "VariableDeclaration", + "scope": 6315, + "src": "2663:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6289, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2663:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2662:15:20" + }, + "returnParameters": { + "id": 6294, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6293, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6315, + "src": "2701:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint232", + "typeString": "uint232" + }, + "typeName": { + "id": 6292, + "name": "uint232", + "nodeType": "ElementaryTypeName", + "src": "2701:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint232", + "typeString": "uint232" + } + }, + "visibility": "internal" + } + ], + "src": "2700:9:20" + }, + "scope": 7969, + "src": "2644:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6342, + "nodeType": "Block", + "src": "3219:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6329, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6323, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6318, + "src": "3233:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6326, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3246:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint224_$", + "typeString": "type(uint224)" + }, + "typeName": { + "id": 6325, + "name": "uint224", + "nodeType": "ElementaryTypeName", + "src": "3246:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint224_$", + "typeString": "type(uint224)" + } + ], + "id": 6324, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "3241:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6327, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3241:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint224", + "typeString": "type(uint224)" + } + }, + "id": 6328, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "3255:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "3241:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint224", + "typeString": "uint224" + } + }, + "src": "3233:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6336, + "nodeType": "IfStatement", + "src": "3229:105:20", + "trueBody": { + "id": 6335, + "nodeType": "Block", + "src": "3260:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323234", + "id": 6331, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3312:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_224_by_1", + "typeString": "int_const 224" + }, + "value": "224" + }, + { + "id": 6332, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6318, + "src": "3317:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_224_by_1", + "typeString": "int_const 224" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6330, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "3281:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6333, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3281:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6334, + "nodeType": "RevertStatement", + "src": "3274:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6339, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6318, + "src": "3358:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6338, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3350:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint224_$", + "typeString": "type(uint224)" + }, + "typeName": { + "id": 6337, + "name": "uint224", + "nodeType": "ElementaryTypeName", + "src": "3350:7:20", + "typeDescriptions": {} + } + }, + "id": 6340, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3350:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint224", + "typeString": "uint224" + } + }, + "functionReturnParameters": 6322, + "id": 6341, + "nodeType": "Return", + "src": "3343:21:20" + } + ] + }, + "documentation": { + "id": 6316, + "nodeType": "StructuredDocumentation", + "src": "2868:280:20", + "text": " @dev Returns the downcasted uint224 from uint256, reverting on\n overflow (when the input is greater than largest uint224).\n Counterpart to Solidity's `uint224` operator.\n Requirements:\n - input must fit into 224 bits" + }, + "id": 6343, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint224", + "nameLocation": "3162:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6319, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6318, + "mutability": "mutable", + "name": "value", + "nameLocation": "3180:5:20", + "nodeType": "VariableDeclaration", + "scope": 6343, + "src": "3172:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6317, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3172:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3171:15:20" + }, + "returnParameters": { + "id": 6322, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6321, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6343, + "src": "3210:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint224", + "typeString": "uint224" + }, + "typeName": { + "id": 6320, + "name": "uint224", + "nodeType": "ElementaryTypeName", + "src": "3210:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint224", + "typeString": "uint224" + } + }, + "visibility": "internal" + } + ], + "src": "3209:9:20" + }, + "scope": 7969, + "src": "3153:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6370, + "nodeType": "Block", + "src": "3728:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6357, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6351, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6346, + "src": "3742:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6354, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3755:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint216_$", + "typeString": "type(uint216)" + }, + "typeName": { + "id": 6353, + "name": "uint216", + "nodeType": "ElementaryTypeName", + "src": "3755:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint216_$", + "typeString": "type(uint216)" + } + ], + "id": 6352, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "3750:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6355, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3750:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint216", + "typeString": "type(uint216)" + } + }, + "id": 6356, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "3764:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "3750:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint216", + "typeString": "uint216" + } + }, + "src": "3742:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6364, + "nodeType": "IfStatement", + "src": "3738:105:20", + "trueBody": { + "id": 6363, + "nodeType": "Block", + "src": "3769:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323136", + "id": 6359, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3821:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_216_by_1", + "typeString": "int_const 216" + }, + "value": "216" + }, + { + "id": 6360, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6346, + "src": "3826:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_216_by_1", + "typeString": "int_const 216" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6358, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "3790:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6361, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3790:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6362, + "nodeType": "RevertStatement", + "src": "3783:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6367, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6346, + "src": "3867:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6366, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3859:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint216_$", + "typeString": "type(uint216)" + }, + "typeName": { + "id": 6365, + "name": "uint216", + "nodeType": "ElementaryTypeName", + "src": "3859:7:20", + "typeDescriptions": {} + } + }, + "id": 6368, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3859:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint216", + "typeString": "uint216" + } + }, + "functionReturnParameters": 6350, + "id": 6369, + "nodeType": "Return", + "src": "3852:21:20" + } + ] + }, + "documentation": { + "id": 6344, + "nodeType": "StructuredDocumentation", + "src": "3377:280:20", + "text": " @dev Returns the downcasted uint216 from uint256, reverting on\n overflow (when the input is greater than largest uint216).\n Counterpart to Solidity's `uint216` operator.\n Requirements:\n - input must fit into 216 bits" + }, + "id": 6371, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint216", + "nameLocation": "3671:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6347, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6346, + "mutability": "mutable", + "name": "value", + "nameLocation": "3689:5:20", + "nodeType": "VariableDeclaration", + "scope": 6371, + "src": "3681:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6345, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3681:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3680:15:20" + }, + "returnParameters": { + "id": 6350, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6349, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6371, + "src": "3719:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint216", + "typeString": "uint216" + }, + "typeName": { + "id": 6348, + "name": "uint216", + "nodeType": "ElementaryTypeName", + "src": "3719:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint216", + "typeString": "uint216" + } + }, + "visibility": "internal" + } + ], + "src": "3718:9:20" + }, + "scope": 7969, + "src": "3662:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6398, + "nodeType": "Block", + "src": "4237:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6385, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6379, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6374, + "src": "4251:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6382, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4264:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint208_$", + "typeString": "type(uint208)" + }, + "typeName": { + "id": 6381, + "name": "uint208", + "nodeType": "ElementaryTypeName", + "src": "4264:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint208_$", + "typeString": "type(uint208)" + } + ], + "id": 6380, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "4259:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6383, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4259:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint208", + "typeString": "type(uint208)" + } + }, + "id": 6384, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "4273:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "4259:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint208", + "typeString": "uint208" + } + }, + "src": "4251:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6392, + "nodeType": "IfStatement", + "src": "4247:105:20", + "trueBody": { + "id": 6391, + "nodeType": "Block", + "src": "4278:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323038", + "id": 6387, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4330:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_208_by_1", + "typeString": "int_const 208" + }, + "value": "208" + }, + { + "id": 6388, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6374, + "src": "4335:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_208_by_1", + "typeString": "int_const 208" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6386, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "4299:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6389, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4299:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6390, + "nodeType": "RevertStatement", + "src": "4292:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6395, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6374, + "src": "4376:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6394, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4368:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint208_$", + "typeString": "type(uint208)" + }, + "typeName": { + "id": 6393, + "name": "uint208", + "nodeType": "ElementaryTypeName", + "src": "4368:7:20", + "typeDescriptions": {} + } + }, + "id": 6396, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4368:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint208", + "typeString": "uint208" + } + }, + "functionReturnParameters": 6378, + "id": 6397, + "nodeType": "Return", + "src": "4361:21:20" + } + ] + }, + "documentation": { + "id": 6372, + "nodeType": "StructuredDocumentation", + "src": "3886:280:20", + "text": " @dev Returns the downcasted uint208 from uint256, reverting on\n overflow (when the input is greater than largest uint208).\n Counterpart to Solidity's `uint208` operator.\n Requirements:\n - input must fit into 208 bits" + }, + "id": 6399, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint208", + "nameLocation": "4180:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6375, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6374, + "mutability": "mutable", + "name": "value", + "nameLocation": "4198:5:20", + "nodeType": "VariableDeclaration", + "scope": 6399, + "src": "4190:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6373, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4190:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4189:15:20" + }, + "returnParameters": { + "id": 6378, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6377, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6399, + "src": "4228:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint208", + "typeString": "uint208" + }, + "typeName": { + "id": 6376, + "name": "uint208", + "nodeType": "ElementaryTypeName", + "src": "4228:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint208", + "typeString": "uint208" + } + }, + "visibility": "internal" + } + ], + "src": "4227:9:20" + }, + "scope": 7969, + "src": "4171:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6426, + "nodeType": "Block", + "src": "4746:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6413, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6407, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6402, + "src": "4760:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6410, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4773:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint200_$", + "typeString": "type(uint200)" + }, + "typeName": { + "id": 6409, + "name": "uint200", + "nodeType": "ElementaryTypeName", + "src": "4773:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint200_$", + "typeString": "type(uint200)" + } + ], + "id": 6408, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "4768:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6411, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4768:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint200", + "typeString": "type(uint200)" + } + }, + "id": 6412, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "4782:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "4768:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint200", + "typeString": "uint200" + } + }, + "src": "4760:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6420, + "nodeType": "IfStatement", + "src": "4756:105:20", + "trueBody": { + "id": 6419, + "nodeType": "Block", + "src": "4787:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323030", + "id": 6415, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4839:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_200_by_1", + "typeString": "int_const 200" + }, + "value": "200" + }, + { + "id": 6416, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6402, + "src": "4844:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_200_by_1", + "typeString": "int_const 200" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6414, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "4808:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6417, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4808:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6418, + "nodeType": "RevertStatement", + "src": "4801:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6423, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6402, + "src": "4885:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6422, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4877:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint200_$", + "typeString": "type(uint200)" + }, + "typeName": { + "id": 6421, + "name": "uint200", + "nodeType": "ElementaryTypeName", + "src": "4877:7:20", + "typeDescriptions": {} + } + }, + "id": 6424, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4877:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint200", + "typeString": "uint200" + } + }, + "functionReturnParameters": 6406, + "id": 6425, + "nodeType": "Return", + "src": "4870:21:20" + } + ] + }, + "documentation": { + "id": 6400, + "nodeType": "StructuredDocumentation", + "src": "4395:280:20", + "text": " @dev Returns the downcasted uint200 from uint256, reverting on\n overflow (when the input is greater than largest uint200).\n Counterpart to Solidity's `uint200` operator.\n Requirements:\n - input must fit into 200 bits" + }, + "id": 6427, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint200", + "nameLocation": "4689:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6403, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6402, + "mutability": "mutable", + "name": "value", + "nameLocation": "4707:5:20", + "nodeType": "VariableDeclaration", + "scope": 6427, + "src": "4699:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6401, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4699:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4698:15:20" + }, + "returnParameters": { + "id": 6406, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6405, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6427, + "src": "4737:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint200", + "typeString": "uint200" + }, + "typeName": { + "id": 6404, + "name": "uint200", + "nodeType": "ElementaryTypeName", + "src": "4737:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint200", + "typeString": "uint200" + } + }, + "visibility": "internal" + } + ], + "src": "4736:9:20" + }, + "scope": 7969, + "src": "4680:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6454, + "nodeType": "Block", + "src": "5255:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6441, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6435, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6430, + "src": "5269:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6438, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5282:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint192_$", + "typeString": "type(uint192)" + }, + "typeName": { + "id": 6437, + "name": "uint192", + "nodeType": "ElementaryTypeName", + "src": "5282:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint192_$", + "typeString": "type(uint192)" + } + ], + "id": 6436, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "5277:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6439, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5277:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint192", + "typeString": "type(uint192)" + } + }, + "id": 6440, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "5291:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "5277:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint192", + "typeString": "uint192" + } + }, + "src": "5269:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6448, + "nodeType": "IfStatement", + "src": "5265:105:20", + "trueBody": { + "id": 6447, + "nodeType": "Block", + "src": "5296:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313932", + "id": 6443, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5348:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_192_by_1", + "typeString": "int_const 192" + }, + "value": "192" + }, + { + "id": 6444, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6430, + "src": "5353:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_192_by_1", + "typeString": "int_const 192" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6442, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "5317:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6445, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5317:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6446, + "nodeType": "RevertStatement", + "src": "5310:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6451, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6430, + "src": "5394:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6450, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5386:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint192_$", + "typeString": "type(uint192)" + }, + "typeName": { + "id": 6449, + "name": "uint192", + "nodeType": "ElementaryTypeName", + "src": "5386:7:20", + "typeDescriptions": {} + } + }, + "id": 6452, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5386:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint192", + "typeString": "uint192" + } + }, + "functionReturnParameters": 6434, + "id": 6453, + "nodeType": "Return", + "src": "5379:21:20" + } + ] + }, + "documentation": { + "id": 6428, + "nodeType": "StructuredDocumentation", + "src": "4904:280:20", + "text": " @dev Returns the downcasted uint192 from uint256, reverting on\n overflow (when the input is greater than largest uint192).\n Counterpart to Solidity's `uint192` operator.\n Requirements:\n - input must fit into 192 bits" + }, + "id": 6455, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint192", + "nameLocation": "5198:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6431, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6430, + "mutability": "mutable", + "name": "value", + "nameLocation": "5216:5:20", + "nodeType": "VariableDeclaration", + "scope": 6455, + "src": "5208:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6429, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5208:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5207:15:20" + }, + "returnParameters": { + "id": 6434, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6433, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6455, + "src": "5246:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint192", + "typeString": "uint192" + }, + "typeName": { + "id": 6432, + "name": "uint192", + "nodeType": "ElementaryTypeName", + "src": "5246:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint192", + "typeString": "uint192" + } + }, + "visibility": "internal" + } + ], + "src": "5245:9:20" + }, + "scope": 7969, + "src": "5189:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6482, + "nodeType": "Block", + "src": "5764:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6469, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6463, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6458, + "src": "5778:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6466, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5791:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint184_$", + "typeString": "type(uint184)" + }, + "typeName": { + "id": 6465, + "name": "uint184", + "nodeType": "ElementaryTypeName", + "src": "5791:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint184_$", + "typeString": "type(uint184)" + } + ], + "id": 6464, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "5786:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6467, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5786:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint184", + "typeString": "type(uint184)" + } + }, + "id": 6468, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "5800:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "5786:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint184", + "typeString": "uint184" + } + }, + "src": "5778:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6476, + "nodeType": "IfStatement", + "src": "5774:105:20", + "trueBody": { + "id": 6475, + "nodeType": "Block", + "src": "5805:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313834", + "id": 6471, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5857:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_184_by_1", + "typeString": "int_const 184" + }, + "value": "184" + }, + { + "id": 6472, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6458, + "src": "5862:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_184_by_1", + "typeString": "int_const 184" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6470, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "5826:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6473, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5826:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6474, + "nodeType": "RevertStatement", + "src": "5819:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6479, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6458, + "src": "5903:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6478, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5895:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint184_$", + "typeString": "type(uint184)" + }, + "typeName": { + "id": 6477, + "name": "uint184", + "nodeType": "ElementaryTypeName", + "src": "5895:7:20", + "typeDescriptions": {} + } + }, + "id": 6480, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5895:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint184", + "typeString": "uint184" + } + }, + "functionReturnParameters": 6462, + "id": 6481, + "nodeType": "Return", + "src": "5888:21:20" + } + ] + }, + "documentation": { + "id": 6456, + "nodeType": "StructuredDocumentation", + "src": "5413:280:20", + "text": " @dev Returns the downcasted uint184 from uint256, reverting on\n overflow (when the input is greater than largest uint184).\n Counterpart to Solidity's `uint184` operator.\n Requirements:\n - input must fit into 184 bits" + }, + "id": 6483, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint184", + "nameLocation": "5707:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6459, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6458, + "mutability": "mutable", + "name": "value", + "nameLocation": "5725:5:20", + "nodeType": "VariableDeclaration", + "scope": 6483, + "src": "5717:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6457, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5717:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5716:15:20" + }, + "returnParameters": { + "id": 6462, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6461, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6483, + "src": "5755:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint184", + "typeString": "uint184" + }, + "typeName": { + "id": 6460, + "name": "uint184", + "nodeType": "ElementaryTypeName", + "src": "5755:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint184", + "typeString": "uint184" + } + }, + "visibility": "internal" + } + ], + "src": "5754:9:20" + }, + "scope": 7969, + "src": "5698:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6510, + "nodeType": "Block", + "src": "6273:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6497, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6491, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6486, + "src": "6287:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6494, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6300:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint176_$", + "typeString": "type(uint176)" + }, + "typeName": { + "id": 6493, + "name": "uint176", + "nodeType": "ElementaryTypeName", + "src": "6300:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint176_$", + "typeString": "type(uint176)" + } + ], + "id": 6492, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "6295:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6495, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6295:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint176", + "typeString": "type(uint176)" + } + }, + "id": 6496, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "6309:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "6295:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint176", + "typeString": "uint176" + } + }, + "src": "6287:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6504, + "nodeType": "IfStatement", + "src": "6283:105:20", + "trueBody": { + "id": 6503, + "nodeType": "Block", + "src": "6314:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313736", + "id": 6499, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6366:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_176_by_1", + "typeString": "int_const 176" + }, + "value": "176" + }, + { + "id": 6500, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6486, + "src": "6371:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_176_by_1", + "typeString": "int_const 176" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6498, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "6335:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6501, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6335:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6502, + "nodeType": "RevertStatement", + "src": "6328:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6507, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6486, + "src": "6412:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6506, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6404:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint176_$", + "typeString": "type(uint176)" + }, + "typeName": { + "id": 6505, + "name": "uint176", + "nodeType": "ElementaryTypeName", + "src": "6404:7:20", + "typeDescriptions": {} + } + }, + "id": 6508, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6404:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint176", + "typeString": "uint176" + } + }, + "functionReturnParameters": 6490, + "id": 6509, + "nodeType": "Return", + "src": "6397:21:20" + } + ] + }, + "documentation": { + "id": 6484, + "nodeType": "StructuredDocumentation", + "src": "5922:280:20", + "text": " @dev Returns the downcasted uint176 from uint256, reverting on\n overflow (when the input is greater than largest uint176).\n Counterpart to Solidity's `uint176` operator.\n Requirements:\n - input must fit into 176 bits" + }, + "id": 6511, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint176", + "nameLocation": "6216:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6487, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6486, + "mutability": "mutable", + "name": "value", + "nameLocation": "6234:5:20", + "nodeType": "VariableDeclaration", + "scope": 6511, + "src": "6226:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6485, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6226:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "6225:15:20" + }, + "returnParameters": { + "id": 6490, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6489, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6511, + "src": "6264:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint176", + "typeString": "uint176" + }, + "typeName": { + "id": 6488, + "name": "uint176", + "nodeType": "ElementaryTypeName", + "src": "6264:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint176", + "typeString": "uint176" + } + }, + "visibility": "internal" + } + ], + "src": "6263:9:20" + }, + "scope": 7969, + "src": "6207:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6538, + "nodeType": "Block", + "src": "6782:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6525, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6519, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6514, + "src": "6796:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6522, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6809:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint168_$", + "typeString": "type(uint168)" + }, + "typeName": { + "id": 6521, + "name": "uint168", + "nodeType": "ElementaryTypeName", + "src": "6809:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint168_$", + "typeString": "type(uint168)" + } + ], + "id": 6520, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "6804:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6523, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6804:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint168", + "typeString": "type(uint168)" + } + }, + "id": 6524, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "6818:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "6804:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint168", + "typeString": "uint168" + } + }, + "src": "6796:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6532, + "nodeType": "IfStatement", + "src": "6792:105:20", + "trueBody": { + "id": 6531, + "nodeType": "Block", + "src": "6823:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313638", + "id": 6527, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6875:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_168_by_1", + "typeString": "int_const 168" + }, + "value": "168" + }, + { + "id": 6528, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6514, + "src": "6880:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_168_by_1", + "typeString": "int_const 168" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6526, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "6844:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6529, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6844:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6530, + "nodeType": "RevertStatement", + "src": "6837:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6535, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6514, + "src": "6921:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6534, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6913:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint168_$", + "typeString": "type(uint168)" + }, + "typeName": { + "id": 6533, + "name": "uint168", + "nodeType": "ElementaryTypeName", + "src": "6913:7:20", + "typeDescriptions": {} + } + }, + "id": 6536, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6913:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint168", + "typeString": "uint168" + } + }, + "functionReturnParameters": 6518, + "id": 6537, + "nodeType": "Return", + "src": "6906:21:20" + } + ] + }, + "documentation": { + "id": 6512, + "nodeType": "StructuredDocumentation", + "src": "6431:280:20", + "text": " @dev Returns the downcasted uint168 from uint256, reverting on\n overflow (when the input is greater than largest uint168).\n Counterpart to Solidity's `uint168` operator.\n Requirements:\n - input must fit into 168 bits" + }, + "id": 6539, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint168", + "nameLocation": "6725:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6515, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6514, + "mutability": "mutable", + "name": "value", + "nameLocation": "6743:5:20", + "nodeType": "VariableDeclaration", + "scope": 6539, + "src": "6735:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6513, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6735:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "6734:15:20" + }, + "returnParameters": { + "id": 6518, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6517, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6539, + "src": "6773:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint168", + "typeString": "uint168" + }, + "typeName": { + "id": 6516, + "name": "uint168", + "nodeType": "ElementaryTypeName", + "src": "6773:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint168", + "typeString": "uint168" + } + }, + "visibility": "internal" + } + ], + "src": "6772:9:20" + }, + "scope": 7969, + "src": "6716:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6566, + "nodeType": "Block", + "src": "7291:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6553, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6547, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6542, + "src": "7305:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6550, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "7318:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint160_$", + "typeString": "type(uint160)" + }, + "typeName": { + "id": 6549, + "name": "uint160", + "nodeType": "ElementaryTypeName", + "src": "7318:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint160_$", + "typeString": "type(uint160)" + } + ], + "id": 6548, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "7313:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6551, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7313:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint160", + "typeString": "type(uint160)" + } + }, + "id": 6552, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "7327:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "7313:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint160", + "typeString": "uint160" + } + }, + "src": "7305:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6560, + "nodeType": "IfStatement", + "src": "7301:105:20", + "trueBody": { + "id": 6559, + "nodeType": "Block", + "src": "7332:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313630", + "id": 6555, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7384:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_160_by_1", + "typeString": "int_const 160" + }, + "value": "160" + }, + { + "id": 6556, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6542, + "src": "7389:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_160_by_1", + "typeString": "int_const 160" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6554, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "7353:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6557, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7353:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6558, + "nodeType": "RevertStatement", + "src": "7346:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6563, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6542, + "src": "7430:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6562, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "7422:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint160_$", + "typeString": "type(uint160)" + }, + "typeName": { + "id": 6561, + "name": "uint160", + "nodeType": "ElementaryTypeName", + "src": "7422:7:20", + "typeDescriptions": {} + } + }, + "id": 6564, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7422:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint160", + "typeString": "uint160" + } + }, + "functionReturnParameters": 6546, + "id": 6565, + "nodeType": "Return", + "src": "7415:21:20" + } + ] + }, + "documentation": { + "id": 6540, + "nodeType": "StructuredDocumentation", + "src": "6940:280:20", + "text": " @dev Returns the downcasted uint160 from uint256, reverting on\n overflow (when the input is greater than largest uint160).\n Counterpart to Solidity's `uint160` operator.\n Requirements:\n - input must fit into 160 bits" + }, + "id": 6567, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint160", + "nameLocation": "7234:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6543, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6542, + "mutability": "mutable", + "name": "value", + "nameLocation": "7252:5:20", + "nodeType": "VariableDeclaration", + "scope": 6567, + "src": "7244:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6541, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7244:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7243:15:20" + }, + "returnParameters": { + "id": 6546, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6545, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6567, + "src": "7282:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint160", + "typeString": "uint160" + }, + "typeName": { + "id": 6544, + "name": "uint160", + "nodeType": "ElementaryTypeName", + "src": "7282:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint160", + "typeString": "uint160" + } + }, + "visibility": "internal" + } + ], + "src": "7281:9:20" + }, + "scope": 7969, + "src": "7225:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6594, + "nodeType": "Block", + "src": "7800:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6581, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6575, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6570, + "src": "7814:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6578, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "7827:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint152_$", + "typeString": "type(uint152)" + }, + "typeName": { + "id": 6577, + "name": "uint152", + "nodeType": "ElementaryTypeName", + "src": "7827:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint152_$", + "typeString": "type(uint152)" + } + ], + "id": 6576, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "7822:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6579, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7822:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint152", + "typeString": "type(uint152)" + } + }, + "id": 6580, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "7836:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "7822:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint152", + "typeString": "uint152" + } + }, + "src": "7814:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6588, + "nodeType": "IfStatement", + "src": "7810:105:20", + "trueBody": { + "id": 6587, + "nodeType": "Block", + "src": "7841:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313532", + "id": 6583, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7893:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_152_by_1", + "typeString": "int_const 152" + }, + "value": "152" + }, + { + "id": 6584, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6570, + "src": "7898:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_152_by_1", + "typeString": "int_const 152" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6582, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "7862:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6585, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7862:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6586, + "nodeType": "RevertStatement", + "src": "7855:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6591, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6570, + "src": "7939:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6590, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "7931:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint152_$", + "typeString": "type(uint152)" + }, + "typeName": { + "id": 6589, + "name": "uint152", + "nodeType": "ElementaryTypeName", + "src": "7931:7:20", + "typeDescriptions": {} + } + }, + "id": 6592, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7931:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint152", + "typeString": "uint152" + } + }, + "functionReturnParameters": 6574, + "id": 6593, + "nodeType": "Return", + "src": "7924:21:20" + } + ] + }, + "documentation": { + "id": 6568, + "nodeType": "StructuredDocumentation", + "src": "7449:280:20", + "text": " @dev Returns the downcasted uint152 from uint256, reverting on\n overflow (when the input is greater than largest uint152).\n Counterpart to Solidity's `uint152` operator.\n Requirements:\n - input must fit into 152 bits" + }, + "id": 6595, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint152", + "nameLocation": "7743:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6571, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6570, + "mutability": "mutable", + "name": "value", + "nameLocation": "7761:5:20", + "nodeType": "VariableDeclaration", + "scope": 6595, + "src": "7753:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6569, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7753:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7752:15:20" + }, + "returnParameters": { + "id": 6574, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6573, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6595, + "src": "7791:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint152", + "typeString": "uint152" + }, + "typeName": { + "id": 6572, + "name": "uint152", + "nodeType": "ElementaryTypeName", + "src": "7791:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint152", + "typeString": "uint152" + } + }, + "visibility": "internal" + } + ], + "src": "7790:9:20" + }, + "scope": 7969, + "src": "7734:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6622, + "nodeType": "Block", + "src": "8309:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6609, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6603, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6598, + "src": "8323:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6606, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8336:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint144_$", + "typeString": "type(uint144)" + }, + "typeName": { + "id": 6605, + "name": "uint144", + "nodeType": "ElementaryTypeName", + "src": "8336:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint144_$", + "typeString": "type(uint144)" + } + ], + "id": 6604, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "8331:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6607, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8331:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint144", + "typeString": "type(uint144)" + } + }, + "id": 6608, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "8345:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "8331:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint144", + "typeString": "uint144" + } + }, + "src": "8323:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6616, + "nodeType": "IfStatement", + "src": "8319:105:20", + "trueBody": { + "id": 6615, + "nodeType": "Block", + "src": "8350:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313434", + "id": 6611, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8402:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_144_by_1", + "typeString": "int_const 144" + }, + "value": "144" + }, + { + "id": 6612, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6598, + "src": "8407:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_144_by_1", + "typeString": "int_const 144" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6610, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "8371:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6613, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8371:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6614, + "nodeType": "RevertStatement", + "src": "8364:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6619, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6598, + "src": "8448:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6618, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8440:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint144_$", + "typeString": "type(uint144)" + }, + "typeName": { + "id": 6617, + "name": "uint144", + "nodeType": "ElementaryTypeName", + "src": "8440:7:20", + "typeDescriptions": {} + } + }, + "id": 6620, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8440:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint144", + "typeString": "uint144" + } + }, + "functionReturnParameters": 6602, + "id": 6621, + "nodeType": "Return", + "src": "8433:21:20" + } + ] + }, + "documentation": { + "id": 6596, + "nodeType": "StructuredDocumentation", + "src": "7958:280:20", + "text": " @dev Returns the downcasted uint144 from uint256, reverting on\n overflow (when the input is greater than largest uint144).\n Counterpart to Solidity's `uint144` operator.\n Requirements:\n - input must fit into 144 bits" + }, + "id": 6623, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint144", + "nameLocation": "8252:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6599, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6598, + "mutability": "mutable", + "name": "value", + "nameLocation": "8270:5:20", + "nodeType": "VariableDeclaration", + "scope": 6623, + "src": "8262:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6597, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8262:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "8261:15:20" + }, + "returnParameters": { + "id": 6602, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6601, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6623, + "src": "8300:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint144", + "typeString": "uint144" + }, + "typeName": { + "id": 6600, + "name": "uint144", + "nodeType": "ElementaryTypeName", + "src": "8300:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint144", + "typeString": "uint144" + } + }, + "visibility": "internal" + } + ], + "src": "8299:9:20" + }, + "scope": 7969, + "src": "8243:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6650, + "nodeType": "Block", + "src": "8818:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6637, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6631, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6626, + "src": "8832:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6634, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8845:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint136_$", + "typeString": "type(uint136)" + }, + "typeName": { + "id": 6633, + "name": "uint136", + "nodeType": "ElementaryTypeName", + "src": "8845:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint136_$", + "typeString": "type(uint136)" + } + ], + "id": 6632, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "8840:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6635, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8840:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint136", + "typeString": "type(uint136)" + } + }, + "id": 6636, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "8854:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "8840:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint136", + "typeString": "uint136" + } + }, + "src": "8832:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6644, + "nodeType": "IfStatement", + "src": "8828:105:20", + "trueBody": { + "id": 6643, + "nodeType": "Block", + "src": "8859:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313336", + "id": 6639, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8911:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_136_by_1", + "typeString": "int_const 136" + }, + "value": "136" + }, + { + "id": 6640, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6626, + "src": "8916:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_136_by_1", + "typeString": "int_const 136" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6638, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "8880:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6641, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8880:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6642, + "nodeType": "RevertStatement", + "src": "8873:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6647, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6626, + "src": "8957:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6646, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8949:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint136_$", + "typeString": "type(uint136)" + }, + "typeName": { + "id": 6645, + "name": "uint136", + "nodeType": "ElementaryTypeName", + "src": "8949:7:20", + "typeDescriptions": {} + } + }, + "id": 6648, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8949:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint136", + "typeString": "uint136" + } + }, + "functionReturnParameters": 6630, + "id": 6649, + "nodeType": "Return", + "src": "8942:21:20" + } + ] + }, + "documentation": { + "id": 6624, + "nodeType": "StructuredDocumentation", + "src": "8467:280:20", + "text": " @dev Returns the downcasted uint136 from uint256, reverting on\n overflow (when the input is greater than largest uint136).\n Counterpart to Solidity's `uint136` operator.\n Requirements:\n - input must fit into 136 bits" + }, + "id": 6651, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint136", + "nameLocation": "8761:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6627, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6626, + "mutability": "mutable", + "name": "value", + "nameLocation": "8779:5:20", + "nodeType": "VariableDeclaration", + "scope": 6651, + "src": "8771:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6625, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8771:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "8770:15:20" + }, + "returnParameters": { + "id": 6630, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6629, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6651, + "src": "8809:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint136", + "typeString": "uint136" + }, + "typeName": { + "id": 6628, + "name": "uint136", + "nodeType": "ElementaryTypeName", + "src": "8809:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint136", + "typeString": "uint136" + } + }, + "visibility": "internal" + } + ], + "src": "8808:9:20" + }, + "scope": 7969, + "src": "8752:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6678, + "nodeType": "Block", + "src": "9327:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6665, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6659, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6654, + "src": "9341:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6662, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "9354:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint128_$", + "typeString": "type(uint128)" + }, + "typeName": { + "id": 6661, + "name": "uint128", + "nodeType": "ElementaryTypeName", + "src": "9354:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint128_$", + "typeString": "type(uint128)" + } + ], + "id": 6660, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "9349:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6663, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9349:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint128", + "typeString": "type(uint128)" + } + }, + "id": 6664, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "9363:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "9349:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint128", + "typeString": "uint128" + } + }, + "src": "9341:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6672, + "nodeType": "IfStatement", + "src": "9337:105:20", + "trueBody": { + "id": 6671, + "nodeType": "Block", + "src": "9368:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313238", + "id": 6667, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9420:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_128_by_1", + "typeString": "int_const 128" + }, + "value": "128" + }, + { + "id": 6668, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6654, + "src": "9425:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_128_by_1", + "typeString": "int_const 128" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6666, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "9389:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6669, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9389:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6670, + "nodeType": "RevertStatement", + "src": "9382:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6675, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6654, + "src": "9466:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6674, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "9458:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint128_$", + "typeString": "type(uint128)" + }, + "typeName": { + "id": 6673, + "name": "uint128", + "nodeType": "ElementaryTypeName", + "src": "9458:7:20", + "typeDescriptions": {} + } + }, + "id": 6676, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9458:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint128", + "typeString": "uint128" + } + }, + "functionReturnParameters": 6658, + "id": 6677, + "nodeType": "Return", + "src": "9451:21:20" + } + ] + }, + "documentation": { + "id": 6652, + "nodeType": "StructuredDocumentation", + "src": "8976:280:20", + "text": " @dev Returns the downcasted uint128 from uint256, reverting on\n overflow (when the input is greater than largest uint128).\n Counterpart to Solidity's `uint128` operator.\n Requirements:\n - input must fit into 128 bits" + }, + "id": 6679, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint128", + "nameLocation": "9270:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6655, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6654, + "mutability": "mutable", + "name": "value", + "nameLocation": "9288:5:20", + "nodeType": "VariableDeclaration", + "scope": 6679, + "src": "9280:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6653, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "9280:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "9279:15:20" + }, + "returnParameters": { + "id": 6658, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6657, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6679, + "src": "9318:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint128", + "typeString": "uint128" + }, + "typeName": { + "id": 6656, + "name": "uint128", + "nodeType": "ElementaryTypeName", + "src": "9318:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint128", + "typeString": "uint128" + } + }, + "visibility": "internal" + } + ], + "src": "9317:9:20" + }, + "scope": 7969, + "src": "9261:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6706, + "nodeType": "Block", + "src": "9836:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6693, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6687, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6682, + "src": "9850:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6690, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "9863:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint120_$", + "typeString": "type(uint120)" + }, + "typeName": { + "id": 6689, + "name": "uint120", + "nodeType": "ElementaryTypeName", + "src": "9863:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint120_$", + "typeString": "type(uint120)" + } + ], + "id": 6688, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "9858:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6691, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9858:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint120", + "typeString": "type(uint120)" + } + }, + "id": 6692, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "9872:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "9858:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint120", + "typeString": "uint120" + } + }, + "src": "9850:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6700, + "nodeType": "IfStatement", + "src": "9846:105:20", + "trueBody": { + "id": 6699, + "nodeType": "Block", + "src": "9877:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313230", + "id": 6695, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9929:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_120_by_1", + "typeString": "int_const 120" + }, + "value": "120" + }, + { + "id": 6696, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6682, + "src": "9934:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_120_by_1", + "typeString": "int_const 120" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6694, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "9898:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6697, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9898:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6698, + "nodeType": "RevertStatement", + "src": "9891:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6703, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6682, + "src": "9975:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6702, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "9967:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint120_$", + "typeString": "type(uint120)" + }, + "typeName": { + "id": 6701, + "name": "uint120", + "nodeType": "ElementaryTypeName", + "src": "9967:7:20", + "typeDescriptions": {} + } + }, + "id": 6704, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9967:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint120", + "typeString": "uint120" + } + }, + "functionReturnParameters": 6686, + "id": 6705, + "nodeType": "Return", + "src": "9960:21:20" + } + ] + }, + "documentation": { + "id": 6680, + "nodeType": "StructuredDocumentation", + "src": "9485:280:20", + "text": " @dev Returns the downcasted uint120 from uint256, reverting on\n overflow (when the input is greater than largest uint120).\n Counterpart to Solidity's `uint120` operator.\n Requirements:\n - input must fit into 120 bits" + }, + "id": 6707, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint120", + "nameLocation": "9779:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6683, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6682, + "mutability": "mutable", + "name": "value", + "nameLocation": "9797:5:20", + "nodeType": "VariableDeclaration", + "scope": 6707, + "src": "9789:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6681, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "9789:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "9788:15:20" + }, + "returnParameters": { + "id": 6686, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6685, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6707, + "src": "9827:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint120", + "typeString": "uint120" + }, + "typeName": { + "id": 6684, + "name": "uint120", + "nodeType": "ElementaryTypeName", + "src": "9827:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint120", + "typeString": "uint120" + } + }, + "visibility": "internal" + } + ], + "src": "9826:9:20" + }, + "scope": 7969, + "src": "9770:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6734, + "nodeType": "Block", + "src": "10345:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6721, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6715, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6710, + "src": "10359:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6718, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10372:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint112_$", + "typeString": "type(uint112)" + }, + "typeName": { + "id": 6717, + "name": "uint112", + "nodeType": "ElementaryTypeName", + "src": "10372:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint112_$", + "typeString": "type(uint112)" + } + ], + "id": 6716, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "10367:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6719, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10367:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint112", + "typeString": "type(uint112)" + } + }, + "id": 6720, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "10381:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "10367:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint112", + "typeString": "uint112" + } + }, + "src": "10359:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6728, + "nodeType": "IfStatement", + "src": "10355:105:20", + "trueBody": { + "id": 6727, + "nodeType": "Block", + "src": "10386:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313132", + "id": 6723, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10438:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_112_by_1", + "typeString": "int_const 112" + }, + "value": "112" + }, + { + "id": 6724, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6710, + "src": "10443:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_112_by_1", + "typeString": "int_const 112" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6722, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "10407:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6725, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10407:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6726, + "nodeType": "RevertStatement", + "src": "10400:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6731, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6710, + "src": "10484:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6730, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10476:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint112_$", + "typeString": "type(uint112)" + }, + "typeName": { + "id": 6729, + "name": "uint112", + "nodeType": "ElementaryTypeName", + "src": "10476:7:20", + "typeDescriptions": {} + } + }, + "id": 6732, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10476:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint112", + "typeString": "uint112" + } + }, + "functionReturnParameters": 6714, + "id": 6733, + "nodeType": "Return", + "src": "10469:21:20" + } + ] + }, + "documentation": { + "id": 6708, + "nodeType": "StructuredDocumentation", + "src": "9994:280:20", + "text": " @dev Returns the downcasted uint112 from uint256, reverting on\n overflow (when the input is greater than largest uint112).\n Counterpart to Solidity's `uint112` operator.\n Requirements:\n - input must fit into 112 bits" + }, + "id": 6735, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint112", + "nameLocation": "10288:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6711, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6710, + "mutability": "mutable", + "name": "value", + "nameLocation": "10306:5:20", + "nodeType": "VariableDeclaration", + "scope": 6735, + "src": "10298:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6709, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10298:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "10297:15:20" + }, + "returnParameters": { + "id": 6714, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6713, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6735, + "src": "10336:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint112", + "typeString": "uint112" + }, + "typeName": { + "id": 6712, + "name": "uint112", + "nodeType": "ElementaryTypeName", + "src": "10336:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint112", + "typeString": "uint112" + } + }, + "visibility": "internal" + } + ], + "src": "10335:9:20" + }, + "scope": 7969, + "src": "10279:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6762, + "nodeType": "Block", + "src": "10854:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6749, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6743, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6738, + "src": "10868:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6746, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10881:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint104_$", + "typeString": "type(uint104)" + }, + "typeName": { + "id": 6745, + "name": "uint104", + "nodeType": "ElementaryTypeName", + "src": "10881:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint104_$", + "typeString": "type(uint104)" + } + ], + "id": 6744, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "10876:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6747, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10876:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint104", + "typeString": "type(uint104)" + } + }, + "id": 6748, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "10890:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "10876:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint104", + "typeString": "uint104" + } + }, + "src": "10868:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6756, + "nodeType": "IfStatement", + "src": "10864:105:20", + "trueBody": { + "id": 6755, + "nodeType": "Block", + "src": "10895:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313034", + "id": 6751, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10947:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_104_by_1", + "typeString": "int_const 104" + }, + "value": "104" + }, + { + "id": 6752, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6738, + "src": "10952:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_104_by_1", + "typeString": "int_const 104" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6750, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "10916:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6753, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10916:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6754, + "nodeType": "RevertStatement", + "src": "10909:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6759, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6738, + "src": "10993:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6758, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10985:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint104_$", + "typeString": "type(uint104)" + }, + "typeName": { + "id": 6757, + "name": "uint104", + "nodeType": "ElementaryTypeName", + "src": "10985:7:20", + "typeDescriptions": {} + } + }, + "id": 6760, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10985:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint104", + "typeString": "uint104" + } + }, + "functionReturnParameters": 6742, + "id": 6761, + "nodeType": "Return", + "src": "10978:21:20" + } + ] + }, + "documentation": { + "id": 6736, + "nodeType": "StructuredDocumentation", + "src": "10503:280:20", + "text": " @dev Returns the downcasted uint104 from uint256, reverting on\n overflow (when the input is greater than largest uint104).\n Counterpart to Solidity's `uint104` operator.\n Requirements:\n - input must fit into 104 bits" + }, + "id": 6763, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint104", + "nameLocation": "10797:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6739, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6738, + "mutability": "mutable", + "name": "value", + "nameLocation": "10815:5:20", + "nodeType": "VariableDeclaration", + "scope": 6763, + "src": "10807:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6737, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10807:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "10806:15:20" + }, + "returnParameters": { + "id": 6742, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6741, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6763, + "src": "10845:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint104", + "typeString": "uint104" + }, + "typeName": { + "id": 6740, + "name": "uint104", + "nodeType": "ElementaryTypeName", + "src": "10845:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint104", + "typeString": "uint104" + } + }, + "visibility": "internal" + } + ], + "src": "10844:9:20" + }, + "scope": 7969, + "src": "10788:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6790, + "nodeType": "Block", + "src": "11357:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6777, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6771, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6766, + "src": "11371:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6774, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "11384:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint96_$", + "typeString": "type(uint96)" + }, + "typeName": { + "id": 6773, + "name": "uint96", + "nodeType": "ElementaryTypeName", + "src": "11384:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint96_$", + "typeString": "type(uint96)" + } + ], + "id": 6772, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "11379:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6775, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11379:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint96", + "typeString": "type(uint96)" + } + }, + "id": 6776, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "11392:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "11379:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint96", + "typeString": "uint96" + } + }, + "src": "11371:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6784, + "nodeType": "IfStatement", + "src": "11367:103:20", + "trueBody": { + "id": 6783, + "nodeType": "Block", + "src": "11397:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3936", + "id": 6779, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11449:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_96_by_1", + "typeString": "int_const 96" + }, + "value": "96" + }, + { + "id": 6780, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6766, + "src": "11453:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_96_by_1", + "typeString": "int_const 96" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6778, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "11418:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6781, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11418:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6782, + "nodeType": "RevertStatement", + "src": "11411:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6787, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6766, + "src": "11493:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6786, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "11486:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint96_$", + "typeString": "type(uint96)" + }, + "typeName": { + "id": 6785, + "name": "uint96", + "nodeType": "ElementaryTypeName", + "src": "11486:6:20", + "typeDescriptions": {} + } + }, + "id": 6788, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11486:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint96", + "typeString": "uint96" + } + }, + "functionReturnParameters": 6770, + "id": 6789, + "nodeType": "Return", + "src": "11479:20:20" + } + ] + }, + "documentation": { + "id": 6764, + "nodeType": "StructuredDocumentation", + "src": "11012:276:20", + "text": " @dev Returns the downcasted uint96 from uint256, reverting on\n overflow (when the input is greater than largest uint96).\n Counterpart to Solidity's `uint96` operator.\n Requirements:\n - input must fit into 96 bits" + }, + "id": 6791, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint96", + "nameLocation": "11302:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6767, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6766, + "mutability": "mutable", + "name": "value", + "nameLocation": "11319:5:20", + "nodeType": "VariableDeclaration", + "scope": 6791, + "src": "11311:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6765, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11311:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "11310:15:20" + }, + "returnParameters": { + "id": 6770, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6769, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6791, + "src": "11349:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint96", + "typeString": "uint96" + }, + "typeName": { + "id": 6768, + "name": "uint96", + "nodeType": "ElementaryTypeName", + "src": "11349:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint96", + "typeString": "uint96" + } + }, + "visibility": "internal" + } + ], + "src": "11348:8:20" + }, + "scope": 7969, + "src": "11293:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6818, + "nodeType": "Block", + "src": "11857:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6805, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6799, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6794, + "src": "11871:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6802, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "11884:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint88_$", + "typeString": "type(uint88)" + }, + "typeName": { + "id": 6801, + "name": "uint88", + "nodeType": "ElementaryTypeName", + "src": "11884:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint88_$", + "typeString": "type(uint88)" + } + ], + "id": 6800, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "11879:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6803, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11879:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint88", + "typeString": "type(uint88)" + } + }, + "id": 6804, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "11892:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "11879:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint88", + "typeString": "uint88" + } + }, + "src": "11871:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6812, + "nodeType": "IfStatement", + "src": "11867:103:20", + "trueBody": { + "id": 6811, + "nodeType": "Block", + "src": "11897:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3838", + "id": 6807, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11949:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_88_by_1", + "typeString": "int_const 88" + }, + "value": "88" + }, + { + "id": 6808, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6794, + "src": "11953:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_88_by_1", + "typeString": "int_const 88" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6806, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "11918:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6809, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11918:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6810, + "nodeType": "RevertStatement", + "src": "11911:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6815, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6794, + "src": "11993:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6814, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "11986:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint88_$", + "typeString": "type(uint88)" + }, + "typeName": { + "id": 6813, + "name": "uint88", + "nodeType": "ElementaryTypeName", + "src": "11986:6:20", + "typeDescriptions": {} + } + }, + "id": 6816, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11986:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint88", + "typeString": "uint88" + } + }, + "functionReturnParameters": 6798, + "id": 6817, + "nodeType": "Return", + "src": "11979:20:20" + } + ] + }, + "documentation": { + "id": 6792, + "nodeType": "StructuredDocumentation", + "src": "11512:276:20", + "text": " @dev Returns the downcasted uint88 from uint256, reverting on\n overflow (when the input is greater than largest uint88).\n Counterpart to Solidity's `uint88` operator.\n Requirements:\n - input must fit into 88 bits" + }, + "id": 6819, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint88", + "nameLocation": "11802:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6795, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6794, + "mutability": "mutable", + "name": "value", + "nameLocation": "11819:5:20", + "nodeType": "VariableDeclaration", + "scope": 6819, + "src": "11811:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6793, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11811:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "11810:15:20" + }, + "returnParameters": { + "id": 6798, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6797, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6819, + "src": "11849:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint88", + "typeString": "uint88" + }, + "typeName": { + "id": 6796, + "name": "uint88", + "nodeType": "ElementaryTypeName", + "src": "11849:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint88", + "typeString": "uint88" + } + }, + "visibility": "internal" + } + ], + "src": "11848:8:20" + }, + "scope": 7969, + "src": "11793:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6846, + "nodeType": "Block", + "src": "12357:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6833, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6827, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6822, + "src": "12371:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6830, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "12384:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint80_$", + "typeString": "type(uint80)" + }, + "typeName": { + "id": 6829, + "name": "uint80", + "nodeType": "ElementaryTypeName", + "src": "12384:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint80_$", + "typeString": "type(uint80)" + } + ], + "id": 6828, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "12379:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6831, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12379:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint80", + "typeString": "type(uint80)" + } + }, + "id": 6832, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "12392:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "12379:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint80", + "typeString": "uint80" + } + }, + "src": "12371:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6840, + "nodeType": "IfStatement", + "src": "12367:103:20", + "trueBody": { + "id": 6839, + "nodeType": "Block", + "src": "12397:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3830", + "id": 6835, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12449:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_80_by_1", + "typeString": "int_const 80" + }, + "value": "80" + }, + { + "id": 6836, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6822, + "src": "12453:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_80_by_1", + "typeString": "int_const 80" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6834, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "12418:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6837, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12418:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6838, + "nodeType": "RevertStatement", + "src": "12411:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6843, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6822, + "src": "12493:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6842, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "12486:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint80_$", + "typeString": "type(uint80)" + }, + "typeName": { + "id": 6841, + "name": "uint80", + "nodeType": "ElementaryTypeName", + "src": "12486:6:20", + "typeDescriptions": {} + } + }, + "id": 6844, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12486:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint80", + "typeString": "uint80" + } + }, + "functionReturnParameters": 6826, + "id": 6845, + "nodeType": "Return", + "src": "12479:20:20" + } + ] + }, + "documentation": { + "id": 6820, + "nodeType": "StructuredDocumentation", + "src": "12012:276:20", + "text": " @dev Returns the downcasted uint80 from uint256, reverting on\n overflow (when the input is greater than largest uint80).\n Counterpart to Solidity's `uint80` operator.\n Requirements:\n - input must fit into 80 bits" + }, + "id": 6847, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint80", + "nameLocation": "12302:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6823, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6822, + "mutability": "mutable", + "name": "value", + "nameLocation": "12319:5:20", + "nodeType": "VariableDeclaration", + "scope": 6847, + "src": "12311:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6821, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12311:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "12310:15:20" + }, + "returnParameters": { + "id": 6826, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6825, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6847, + "src": "12349:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint80", + "typeString": "uint80" + }, + "typeName": { + "id": 6824, + "name": "uint80", + "nodeType": "ElementaryTypeName", + "src": "12349:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint80", + "typeString": "uint80" + } + }, + "visibility": "internal" + } + ], + "src": "12348:8:20" + }, + "scope": 7969, + "src": "12293:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6874, + "nodeType": "Block", + "src": "12857:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6861, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6855, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6850, + "src": "12871:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6858, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "12884:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint72_$", + "typeString": "type(uint72)" + }, + "typeName": { + "id": 6857, + "name": "uint72", + "nodeType": "ElementaryTypeName", + "src": "12884:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint72_$", + "typeString": "type(uint72)" + } + ], + "id": 6856, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "12879:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6859, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12879:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint72", + "typeString": "type(uint72)" + } + }, + "id": 6860, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "12892:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "12879:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint72", + "typeString": "uint72" + } + }, + "src": "12871:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6868, + "nodeType": "IfStatement", + "src": "12867:103:20", + "trueBody": { + "id": 6867, + "nodeType": "Block", + "src": "12897:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3732", + "id": 6863, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12949:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_72_by_1", + "typeString": "int_const 72" + }, + "value": "72" + }, + { + "id": 6864, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6850, + "src": "12953:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_72_by_1", + "typeString": "int_const 72" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6862, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "12918:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6865, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12918:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6866, + "nodeType": "RevertStatement", + "src": "12911:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6871, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6850, + "src": "12993:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6870, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "12986:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint72_$", + "typeString": "type(uint72)" + }, + "typeName": { + "id": 6869, + "name": "uint72", + "nodeType": "ElementaryTypeName", + "src": "12986:6:20", + "typeDescriptions": {} + } + }, + "id": 6872, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12986:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint72", + "typeString": "uint72" + } + }, + "functionReturnParameters": 6854, + "id": 6873, + "nodeType": "Return", + "src": "12979:20:20" + } + ] + }, + "documentation": { + "id": 6848, + "nodeType": "StructuredDocumentation", + "src": "12512:276:20", + "text": " @dev Returns the downcasted uint72 from uint256, reverting on\n overflow (when the input is greater than largest uint72).\n Counterpart to Solidity's `uint72` operator.\n Requirements:\n - input must fit into 72 bits" + }, + "id": 6875, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint72", + "nameLocation": "12802:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6851, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6850, + "mutability": "mutable", + "name": "value", + "nameLocation": "12819:5:20", + "nodeType": "VariableDeclaration", + "scope": 6875, + "src": "12811:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6849, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12811:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "12810:15:20" + }, + "returnParameters": { + "id": 6854, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6853, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6875, + "src": "12849:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint72", + "typeString": "uint72" + }, + "typeName": { + "id": 6852, + "name": "uint72", + "nodeType": "ElementaryTypeName", + "src": "12849:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint72", + "typeString": "uint72" + } + }, + "visibility": "internal" + } + ], + "src": "12848:8:20" + }, + "scope": 7969, + "src": "12793:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6902, + "nodeType": "Block", + "src": "13357:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6889, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6883, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6878, + "src": "13371:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6886, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "13384:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint64_$", + "typeString": "type(uint64)" + }, + "typeName": { + "id": 6885, + "name": "uint64", + "nodeType": "ElementaryTypeName", + "src": "13384:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint64_$", + "typeString": "type(uint64)" + } + ], + "id": 6884, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "13379:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6887, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13379:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint64", + "typeString": "type(uint64)" + } + }, + "id": 6888, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "13392:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "13379:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint64", + "typeString": "uint64" + } + }, + "src": "13371:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6896, + "nodeType": "IfStatement", + "src": "13367:103:20", + "trueBody": { + "id": 6895, + "nodeType": "Block", + "src": "13397:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3634", + "id": 6891, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13449:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + { + "id": 6892, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6878, + "src": "13453:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6890, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "13418:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6893, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13418:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6894, + "nodeType": "RevertStatement", + "src": "13411:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6899, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6878, + "src": "13493:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6898, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "13486:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint64_$", + "typeString": "type(uint64)" + }, + "typeName": { + "id": 6897, + "name": "uint64", + "nodeType": "ElementaryTypeName", + "src": "13486:6:20", + "typeDescriptions": {} + } + }, + "id": 6900, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13486:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint64", + "typeString": "uint64" + } + }, + "functionReturnParameters": 6882, + "id": 6901, + "nodeType": "Return", + "src": "13479:20:20" + } + ] + }, + "documentation": { + "id": 6876, + "nodeType": "StructuredDocumentation", + "src": "13012:276:20", + "text": " @dev Returns the downcasted uint64 from uint256, reverting on\n overflow (when the input is greater than largest uint64).\n Counterpart to Solidity's `uint64` operator.\n Requirements:\n - input must fit into 64 bits" + }, + "id": 6903, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint64", + "nameLocation": "13302:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6879, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6878, + "mutability": "mutable", + "name": "value", + "nameLocation": "13319:5:20", + "nodeType": "VariableDeclaration", + "scope": 6903, + "src": "13311:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6877, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13311:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "13310:15:20" + }, + "returnParameters": { + "id": 6882, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6881, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6903, + "src": "13349:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint64", + "typeString": "uint64" + }, + "typeName": { + "id": 6880, + "name": "uint64", + "nodeType": "ElementaryTypeName", + "src": "13349:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint64", + "typeString": "uint64" + } + }, + "visibility": "internal" + } + ], + "src": "13348:8:20" + }, + "scope": 7969, + "src": "13293:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6930, + "nodeType": "Block", + "src": "13857:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6917, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6911, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6906, + "src": "13871:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6914, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "13884:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint56_$", + "typeString": "type(uint56)" + }, + "typeName": { + "id": 6913, + "name": "uint56", + "nodeType": "ElementaryTypeName", + "src": "13884:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint56_$", + "typeString": "type(uint56)" + } + ], + "id": 6912, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "13879:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6915, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13879:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint56", + "typeString": "type(uint56)" + } + }, + "id": 6916, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "13892:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "13879:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint56", + "typeString": "uint56" + } + }, + "src": "13871:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6924, + "nodeType": "IfStatement", + "src": "13867:103:20", + "trueBody": { + "id": 6923, + "nodeType": "Block", + "src": "13897:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3536", + "id": 6919, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13949:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_56_by_1", + "typeString": "int_const 56" + }, + "value": "56" + }, + { + "id": 6920, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6906, + "src": "13953:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_56_by_1", + "typeString": "int_const 56" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6918, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "13918:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6921, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13918:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6922, + "nodeType": "RevertStatement", + "src": "13911:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6927, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6906, + "src": "13993:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6926, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "13986:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint56_$", + "typeString": "type(uint56)" + }, + "typeName": { + "id": 6925, + "name": "uint56", + "nodeType": "ElementaryTypeName", + "src": "13986:6:20", + "typeDescriptions": {} + } + }, + "id": 6928, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13986:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint56", + "typeString": "uint56" + } + }, + "functionReturnParameters": 6910, + "id": 6929, + "nodeType": "Return", + "src": "13979:20:20" + } + ] + }, + "documentation": { + "id": 6904, + "nodeType": "StructuredDocumentation", + "src": "13512:276:20", + "text": " @dev Returns the downcasted uint56 from uint256, reverting on\n overflow (when the input is greater than largest uint56).\n Counterpart to Solidity's `uint56` operator.\n Requirements:\n - input must fit into 56 bits" + }, + "id": 6931, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint56", + "nameLocation": "13802:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6907, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6906, + "mutability": "mutable", + "name": "value", + "nameLocation": "13819:5:20", + "nodeType": "VariableDeclaration", + "scope": 6931, + "src": "13811:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6905, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13811:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "13810:15:20" + }, + "returnParameters": { + "id": 6910, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6909, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6931, + "src": "13849:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint56", + "typeString": "uint56" + }, + "typeName": { + "id": 6908, + "name": "uint56", + "nodeType": "ElementaryTypeName", + "src": "13849:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint56", + "typeString": "uint56" + } + }, + "visibility": "internal" + } + ], + "src": "13848:8:20" + }, + "scope": 7969, + "src": "13793:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6958, + "nodeType": "Block", + "src": "14357:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6945, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6939, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6934, + "src": "14371:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6942, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "14384:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint48_$", + "typeString": "type(uint48)" + }, + "typeName": { + "id": 6941, + "name": "uint48", + "nodeType": "ElementaryTypeName", + "src": "14384:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint48_$", + "typeString": "type(uint48)" + } + ], + "id": 6940, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "14379:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6943, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14379:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint48", + "typeString": "type(uint48)" + } + }, + "id": 6944, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "14392:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "14379:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint48", + "typeString": "uint48" + } + }, + "src": "14371:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6952, + "nodeType": "IfStatement", + "src": "14367:103:20", + "trueBody": { + "id": 6951, + "nodeType": "Block", + "src": "14397:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3438", + "id": 6947, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14449:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_48_by_1", + "typeString": "int_const 48" + }, + "value": "48" + }, + { + "id": 6948, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6934, + "src": "14453:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_48_by_1", + "typeString": "int_const 48" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6946, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "14418:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6949, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14418:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6950, + "nodeType": "RevertStatement", + "src": "14411:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6955, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6934, + "src": "14493:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6954, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "14486:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint48_$", + "typeString": "type(uint48)" + }, + "typeName": { + "id": 6953, + "name": "uint48", + "nodeType": "ElementaryTypeName", + "src": "14486:6:20", + "typeDescriptions": {} + } + }, + "id": 6956, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14486:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint48", + "typeString": "uint48" + } + }, + "functionReturnParameters": 6938, + "id": 6957, + "nodeType": "Return", + "src": "14479:20:20" + } + ] + }, + "documentation": { + "id": 6932, + "nodeType": "StructuredDocumentation", + "src": "14012:276:20", + "text": " @dev Returns the downcasted uint48 from uint256, reverting on\n overflow (when the input is greater than largest uint48).\n Counterpart to Solidity's `uint48` operator.\n Requirements:\n - input must fit into 48 bits" + }, + "id": 6959, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint48", + "nameLocation": "14302:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6935, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6934, + "mutability": "mutable", + "name": "value", + "nameLocation": "14319:5:20", + "nodeType": "VariableDeclaration", + "scope": 6959, + "src": "14311:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6933, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "14311:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "14310:15:20" + }, + "returnParameters": { + "id": 6938, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6937, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6959, + "src": "14349:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint48", + "typeString": "uint48" + }, + "typeName": { + "id": 6936, + "name": "uint48", + "nodeType": "ElementaryTypeName", + "src": "14349:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint48", + "typeString": "uint48" + } + }, + "visibility": "internal" + } + ], + "src": "14348:8:20" + }, + "scope": 7969, + "src": "14293:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6986, + "nodeType": "Block", + "src": "14857:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6973, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6967, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6962, + "src": "14871:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6970, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "14884:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint40_$", + "typeString": "type(uint40)" + }, + "typeName": { + "id": 6969, + "name": "uint40", + "nodeType": "ElementaryTypeName", + "src": "14884:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint40_$", + "typeString": "type(uint40)" + } + ], + "id": 6968, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "14879:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6971, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14879:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint40", + "typeString": "type(uint40)" + } + }, + "id": 6972, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "14892:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "14879:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint40", + "typeString": "uint40" + } + }, + "src": "14871:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6980, + "nodeType": "IfStatement", + "src": "14867:103:20", + "trueBody": { + "id": 6979, + "nodeType": "Block", + "src": "14897:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3430", + "id": 6975, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14949:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_40_by_1", + "typeString": "int_const 40" + }, + "value": "40" + }, + { + "id": 6976, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6962, + "src": "14953:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_40_by_1", + "typeString": "int_const 40" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6974, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "14918:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6977, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14918:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6978, + "nodeType": "RevertStatement", + "src": "14911:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6983, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6962, + "src": "14993:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6982, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "14986:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint40_$", + "typeString": "type(uint40)" + }, + "typeName": { + "id": 6981, + "name": "uint40", + "nodeType": "ElementaryTypeName", + "src": "14986:6:20", + "typeDescriptions": {} + } + }, + "id": 6984, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14986:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint40", + "typeString": "uint40" + } + }, + "functionReturnParameters": 6966, + "id": 6985, + "nodeType": "Return", + "src": "14979:20:20" + } + ] + }, + "documentation": { + "id": 6960, + "nodeType": "StructuredDocumentation", + "src": "14512:276:20", + "text": " @dev Returns the downcasted uint40 from uint256, reverting on\n overflow (when the input is greater than largest uint40).\n Counterpart to Solidity's `uint40` operator.\n Requirements:\n - input must fit into 40 bits" + }, + "id": 6987, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint40", + "nameLocation": "14802:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6963, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6962, + "mutability": "mutable", + "name": "value", + "nameLocation": "14819:5:20", + "nodeType": "VariableDeclaration", + "scope": 6987, + "src": "14811:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6961, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "14811:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "14810:15:20" + }, + "returnParameters": { + "id": 6966, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6965, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6987, + "src": "14849:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint40", + "typeString": "uint40" + }, + "typeName": { + "id": 6964, + "name": "uint40", + "nodeType": "ElementaryTypeName", + "src": "14849:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint40", + "typeString": "uint40" + } + }, + "visibility": "internal" + } + ], + "src": "14848:8:20" + }, + "scope": 7969, + "src": "14793:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7014, + "nodeType": "Block", + "src": "15357:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 7001, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6995, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6990, + "src": "15371:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6998, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "15384:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint32_$", + "typeString": "type(uint32)" + }, + "typeName": { + "id": 6997, + "name": "uint32", + "nodeType": "ElementaryTypeName", + "src": "15384:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint32_$", + "typeString": "type(uint32)" + } + ], + "id": 6996, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "15379:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6999, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15379:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint32", + "typeString": "type(uint32)" + } + }, + "id": 7000, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "15392:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "15379:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint32", + "typeString": "uint32" + } + }, + "src": "15371:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7008, + "nodeType": "IfStatement", + "src": "15367:103:20", + "trueBody": { + "id": 7007, + "nodeType": "Block", + "src": "15397:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3332", + "id": 7003, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "15449:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + { + "id": 7004, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6990, + "src": "15453:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7002, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "15418:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 7005, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15418:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7006, + "nodeType": "RevertStatement", + "src": "15411:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 7011, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6990, + "src": "15493:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7010, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "15486:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint32_$", + "typeString": "type(uint32)" + }, + "typeName": { + "id": 7009, + "name": "uint32", + "nodeType": "ElementaryTypeName", + "src": "15486:6:20", + "typeDescriptions": {} + } + }, + "id": 7012, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15486:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint32", + "typeString": "uint32" + } + }, + "functionReturnParameters": 6994, + "id": 7013, + "nodeType": "Return", + "src": "15479:20:20" + } + ] + }, + "documentation": { + "id": 6988, + "nodeType": "StructuredDocumentation", + "src": "15012:276:20", + "text": " @dev Returns the downcasted uint32 from uint256, reverting on\n overflow (when the input is greater than largest uint32).\n Counterpart to Solidity's `uint32` operator.\n Requirements:\n - input must fit into 32 bits" + }, + "id": 7015, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint32", + "nameLocation": "15302:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6991, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6990, + "mutability": "mutable", + "name": "value", + "nameLocation": "15319:5:20", + "nodeType": "VariableDeclaration", + "scope": 7015, + "src": "15311:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6989, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "15311:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "15310:15:20" + }, + "returnParameters": { + "id": 6994, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6993, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 7015, + "src": "15349:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint32", + "typeString": "uint32" + }, + "typeName": { + "id": 6992, + "name": "uint32", + "nodeType": "ElementaryTypeName", + "src": "15349:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint32", + "typeString": "uint32" + } + }, + "visibility": "internal" + } + ], + "src": "15348:8:20" + }, + "scope": 7969, + "src": "15293:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7042, + "nodeType": "Block", + "src": "15857:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 7029, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7023, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7018, + "src": "15871:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 7026, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "15884:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint24_$", + "typeString": "type(uint24)" + }, + "typeName": { + "id": 7025, + "name": "uint24", + "nodeType": "ElementaryTypeName", + "src": "15884:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint24_$", + "typeString": "type(uint24)" + } + ], + "id": 7024, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "15879:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 7027, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15879:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint24", + "typeString": "type(uint24)" + } + }, + "id": 7028, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "15892:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "15879:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint24", + "typeString": "uint24" + } + }, + "src": "15871:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7036, + "nodeType": "IfStatement", + "src": "15867:103:20", + "trueBody": { + "id": 7035, + "nodeType": "Block", + "src": "15897:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3234", + "id": 7031, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "15949:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_24_by_1", + "typeString": "int_const 24" + }, + "value": "24" + }, + { + "id": 7032, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7018, + "src": "15953:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_24_by_1", + "typeString": "int_const 24" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7030, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "15918:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 7033, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15918:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7034, + "nodeType": "RevertStatement", + "src": "15911:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 7039, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7018, + "src": "15993:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7038, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "15986:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint24_$", + "typeString": "type(uint24)" + }, + "typeName": { + "id": 7037, + "name": "uint24", + "nodeType": "ElementaryTypeName", + "src": "15986:6:20", + "typeDescriptions": {} + } + }, + "id": 7040, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15986:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint24", + "typeString": "uint24" + } + }, + "functionReturnParameters": 7022, + "id": 7041, + "nodeType": "Return", + "src": "15979:20:20" + } + ] + }, + "documentation": { + "id": 7016, + "nodeType": "StructuredDocumentation", + "src": "15512:276:20", + "text": " @dev Returns the downcasted uint24 from uint256, reverting on\n overflow (when the input is greater than largest uint24).\n Counterpart to Solidity's `uint24` operator.\n Requirements:\n - input must fit into 24 bits" + }, + "id": 7043, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint24", + "nameLocation": "15802:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7019, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7018, + "mutability": "mutable", + "name": "value", + "nameLocation": "15819:5:20", + "nodeType": "VariableDeclaration", + "scope": 7043, + "src": "15811:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 7017, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "15811:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "15810:15:20" + }, + "returnParameters": { + "id": 7022, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7021, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 7043, + "src": "15849:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint24", + "typeString": "uint24" + }, + "typeName": { + "id": 7020, + "name": "uint24", + "nodeType": "ElementaryTypeName", + "src": "15849:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint24", + "typeString": "uint24" + } + }, + "visibility": "internal" + } + ], + "src": "15848:8:20" + }, + "scope": 7969, + "src": "15793:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7070, + "nodeType": "Block", + "src": "16357:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 7057, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7051, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7046, + "src": "16371:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 7054, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16384:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint16_$", + "typeString": "type(uint16)" + }, + "typeName": { + "id": 7053, + "name": "uint16", + "nodeType": "ElementaryTypeName", + "src": "16384:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint16_$", + "typeString": "type(uint16)" + } + ], + "id": 7052, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "16379:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 7055, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16379:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint16", + "typeString": "type(uint16)" + } + }, + "id": 7056, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "16392:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "16379:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint16", + "typeString": "uint16" + } + }, + "src": "16371:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7064, + "nodeType": "IfStatement", + "src": "16367:103:20", + "trueBody": { + "id": 7063, + "nodeType": "Block", + "src": "16397:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3136", + "id": 7059, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16449:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + { + "id": 7060, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7046, + "src": "16453:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7058, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "16418:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 7061, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16418:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7062, + "nodeType": "RevertStatement", + "src": "16411:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 7067, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7046, + "src": "16493:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7066, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16486:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint16_$", + "typeString": "type(uint16)" + }, + "typeName": { + "id": 7065, + "name": "uint16", + "nodeType": "ElementaryTypeName", + "src": "16486:6:20", + "typeDescriptions": {} + } + }, + "id": 7068, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16486:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint16", + "typeString": "uint16" + } + }, + "functionReturnParameters": 7050, + "id": 7069, + "nodeType": "Return", + "src": "16479:20:20" + } + ] + }, + "documentation": { + "id": 7044, + "nodeType": "StructuredDocumentation", + "src": "16012:276:20", + "text": " @dev Returns the downcasted uint16 from uint256, reverting on\n overflow (when the input is greater than largest uint16).\n Counterpart to Solidity's `uint16` operator.\n Requirements:\n - input must fit into 16 bits" + }, + "id": 7071, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint16", + "nameLocation": "16302:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7047, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7046, + "mutability": "mutable", + "name": "value", + "nameLocation": "16319:5:20", + "nodeType": "VariableDeclaration", + "scope": 7071, + "src": "16311:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 7045, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "16311:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "16310:15:20" + }, + "returnParameters": { + "id": 7050, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7049, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 7071, + "src": "16349:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint16", + "typeString": "uint16" + }, + "typeName": { + "id": 7048, + "name": "uint16", + "nodeType": "ElementaryTypeName", + "src": "16349:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint16", + "typeString": "uint16" + } + }, + "visibility": "internal" + } + ], + "src": "16348:8:20" + }, + "scope": 7969, + "src": "16293:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7098, + "nodeType": "Block", + "src": "16851:146:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 7085, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7079, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7074, + "src": "16865:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 7082, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16878:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": { + "id": 7081, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "16878:5:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + } + ], + "id": 7080, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "16873:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 7083, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16873:11:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint8", + "typeString": "type(uint8)" + } + }, + "id": 7084, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "16885:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "16873:15:20", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "src": "16865:23:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7092, + "nodeType": "IfStatement", + "src": "16861:101:20", + "trueBody": { + "id": 7091, + "nodeType": "Block", + "src": "16890:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "38", + "id": 7087, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16942:1:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + { + "id": 7088, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7074, + "src": "16945:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7086, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "16911:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 7089, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16911:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7090, + "nodeType": "RevertStatement", + "src": "16904:47:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 7095, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7074, + "src": "16984:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7094, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16978:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": { + "id": 7093, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "16978:5:20", + "typeDescriptions": {} + } + }, + "id": 7096, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16978:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "functionReturnParameters": 7078, + "id": 7097, + "nodeType": "Return", + "src": "16971:19:20" + } + ] + }, + "documentation": { + "id": 7072, + "nodeType": "StructuredDocumentation", + "src": "16512:272:20", + "text": " @dev Returns the downcasted uint8 from uint256, reverting on\n overflow (when the input is greater than largest uint8).\n Counterpart to Solidity's `uint8` operator.\n Requirements:\n - input must fit into 8 bits" + }, + "id": 7099, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint8", + "nameLocation": "16798:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7075, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7074, + "mutability": "mutable", + "name": "value", + "nameLocation": "16814:5:20", + "nodeType": "VariableDeclaration", + "scope": 7099, + "src": "16806:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 7073, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "16806:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "16805:15:20" + }, + "returnParameters": { + "id": 7078, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7077, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 7099, + "src": "16844:5:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 7076, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "16844:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "src": "16843:7:20" + }, + "scope": 7969, + "src": "16789:208:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7121, + "nodeType": "Block", + "src": "17233:128:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7109, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7107, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7102, + "src": "17247:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "hexValue": "30", + "id": 7108, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17255:1:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "17247:9:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7115, + "nodeType": "IfStatement", + "src": "17243:81:20", + "trueBody": { + "id": 7114, + "nodeType": "Block", + "src": "17258:66:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "id": 7111, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7102, + "src": "17307:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7110, + "name": "SafeCastOverflowedIntToUint", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6219, + "src": "17279:27:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_int256_$returns$_t_error_$", + "typeString": "function (int256) pure returns (error)" + } + }, + "id": 7112, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "17279:34:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7113, + "nodeType": "RevertStatement", + "src": "17272:41:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 7118, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7102, + "src": "17348:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7117, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "17340:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 7116, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "17340:7:20", + "typeDescriptions": {} + } + }, + "id": 7119, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "17340:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 7106, + "id": 7120, + "nodeType": "Return", + "src": "17333:21:20" + } + ] + }, + "documentation": { + "id": 7100, + "nodeType": "StructuredDocumentation", + "src": "17003:160:20", + "text": " @dev Converts a signed int256 into an unsigned uint256.\n Requirements:\n - input must be greater than or equal to 0." + }, + "id": 7122, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint256", + "nameLocation": "17177:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7103, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7102, + "mutability": "mutable", + "name": "value", + "nameLocation": "17194:5:20", + "nodeType": "VariableDeclaration", + "scope": 7122, + "src": "17187:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7101, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "17187:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "17186:14:20" + }, + "returnParameters": { + "id": 7106, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7105, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 7122, + "src": "17224:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 7104, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "17224:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "17223:9:20" + }, + "scope": 7969, + "src": "17168:193:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7147, + "nodeType": "Block", + "src": "17758:150:20", + "statements": [ + { + "expression": { + "id": 7135, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7130, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7128, + "src": "17768:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int248", + "typeString": "int248" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7133, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7125, + "src": "17788:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7132, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "17781:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int248_$", + "typeString": "type(int248)" + }, + "typeName": { + "id": 7131, + "name": "int248", + "nodeType": "ElementaryTypeName", + "src": "17781:6:20", + "typeDescriptions": {} + } + }, + "id": 7134, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "17781:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int248", + "typeString": "int248" + } + }, + "src": "17768:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int248", + "typeString": "int248" + } + }, + "id": 7136, + "nodeType": "ExpressionStatement", + "src": "17768:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7139, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7137, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7128, + "src": "17808:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int248", + "typeString": "int248" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7138, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7125, + "src": "17822:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "17808:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7146, + "nodeType": "IfStatement", + "src": "17804:98:20", + "trueBody": { + "id": 7145, + "nodeType": "Block", + "src": "17829:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323438", + "id": 7141, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17880:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_248_by_1", + "typeString": "int_const 248" + }, + "value": "248" + }, + { + "id": 7142, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7125, + "src": "17885:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_248_by_1", + "typeString": "int_const 248" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7140, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "17850:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7143, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "17850:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7144, + "nodeType": "RevertStatement", + "src": "17843:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7123, + "nodeType": "StructuredDocumentation", + "src": "17367:312:20", + "text": " @dev Returns the downcasted int248 from int256, reverting on\n overflow (when the input is less than smallest int248 or\n greater than largest int248).\n Counterpart to Solidity's `int248` operator.\n Requirements:\n - input must fit into 248 bits" + }, + "id": 7148, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt248", + "nameLocation": "17693:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7126, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7125, + "mutability": "mutable", + "name": "value", + "nameLocation": "17709:5:20", + "nodeType": "VariableDeclaration", + "scope": 7148, + "src": "17702:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7124, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "17702:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "17701:14:20" + }, + "returnParameters": { + "id": 7129, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7128, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "17746:10:20", + "nodeType": "VariableDeclaration", + "scope": 7148, + "src": "17739:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int248", + "typeString": "int248" + }, + "typeName": { + "id": 7127, + "name": "int248", + "nodeType": "ElementaryTypeName", + "src": "17739:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int248", + "typeString": "int248" + } + }, + "visibility": "internal" + } + ], + "src": "17738:19:20" + }, + "scope": 7969, + "src": "17684:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7173, + "nodeType": "Block", + "src": "18305:150:20", + "statements": [ + { + "expression": { + "id": 7161, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7156, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7154, + "src": "18315:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int240", + "typeString": "int240" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7159, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7151, + "src": "18335:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7158, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "18328:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int240_$", + "typeString": "type(int240)" + }, + "typeName": { + "id": 7157, + "name": "int240", + "nodeType": "ElementaryTypeName", + "src": "18328:6:20", + "typeDescriptions": {} + } + }, + "id": 7160, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18328:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int240", + "typeString": "int240" + } + }, + "src": "18315:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int240", + "typeString": "int240" + } + }, + "id": 7162, + "nodeType": "ExpressionStatement", + "src": "18315:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7165, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7163, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7154, + "src": "18355:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int240", + "typeString": "int240" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7164, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7151, + "src": "18369:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "18355:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7172, + "nodeType": "IfStatement", + "src": "18351:98:20", + "trueBody": { + "id": 7171, + "nodeType": "Block", + "src": "18376:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323430", + "id": 7167, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18427:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_240_by_1", + "typeString": "int_const 240" + }, + "value": "240" + }, + { + "id": 7168, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7151, + "src": "18432:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_240_by_1", + "typeString": "int_const 240" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7166, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "18397:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7169, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18397:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7170, + "nodeType": "RevertStatement", + "src": "18390:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7149, + "nodeType": "StructuredDocumentation", + "src": "17914:312:20", + "text": " @dev Returns the downcasted int240 from int256, reverting on\n overflow (when the input is less than smallest int240 or\n greater than largest int240).\n Counterpart to Solidity's `int240` operator.\n Requirements:\n - input must fit into 240 bits" + }, + "id": 7174, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt240", + "nameLocation": "18240:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7152, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7151, + "mutability": "mutable", + "name": "value", + "nameLocation": "18256:5:20", + "nodeType": "VariableDeclaration", + "scope": 7174, + "src": "18249:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7150, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "18249:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "18248:14:20" + }, + "returnParameters": { + "id": 7155, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7154, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "18293:10:20", + "nodeType": "VariableDeclaration", + "scope": 7174, + "src": "18286:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int240", + "typeString": "int240" + }, + "typeName": { + "id": 7153, + "name": "int240", + "nodeType": "ElementaryTypeName", + "src": "18286:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int240", + "typeString": "int240" + } + }, + "visibility": "internal" + } + ], + "src": "18285:19:20" + }, + "scope": 7969, + "src": "18231:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7199, + "nodeType": "Block", + "src": "18852:150:20", + "statements": [ + { + "expression": { + "id": 7187, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7182, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7180, + "src": "18862:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int232", + "typeString": "int232" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7185, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7177, + "src": "18882:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7184, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "18875:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int232_$", + "typeString": "type(int232)" + }, + "typeName": { + "id": 7183, + "name": "int232", + "nodeType": "ElementaryTypeName", + "src": "18875:6:20", + "typeDescriptions": {} + } + }, + "id": 7186, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18875:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int232", + "typeString": "int232" + } + }, + "src": "18862:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int232", + "typeString": "int232" + } + }, + "id": 7188, + "nodeType": "ExpressionStatement", + "src": "18862:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7191, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7189, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7180, + "src": "18902:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int232", + "typeString": "int232" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7190, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7177, + "src": "18916:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "18902:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7198, + "nodeType": "IfStatement", + "src": "18898:98:20", + "trueBody": { + "id": 7197, + "nodeType": "Block", + "src": "18923:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323332", + "id": 7193, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18974:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_232_by_1", + "typeString": "int_const 232" + }, + "value": "232" + }, + { + "id": 7194, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7177, + "src": "18979:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_232_by_1", + "typeString": "int_const 232" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7192, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "18944:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7195, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18944:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7196, + "nodeType": "RevertStatement", + "src": "18937:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7175, + "nodeType": "StructuredDocumentation", + "src": "18461:312:20", + "text": " @dev Returns the downcasted int232 from int256, reverting on\n overflow (when the input is less than smallest int232 or\n greater than largest int232).\n Counterpart to Solidity's `int232` operator.\n Requirements:\n - input must fit into 232 bits" + }, + "id": 7200, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt232", + "nameLocation": "18787:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7178, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7177, + "mutability": "mutable", + "name": "value", + "nameLocation": "18803:5:20", + "nodeType": "VariableDeclaration", + "scope": 7200, + "src": "18796:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7176, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "18796:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "18795:14:20" + }, + "returnParameters": { + "id": 7181, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7180, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "18840:10:20", + "nodeType": "VariableDeclaration", + "scope": 7200, + "src": "18833:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int232", + "typeString": "int232" + }, + "typeName": { + "id": 7179, + "name": "int232", + "nodeType": "ElementaryTypeName", + "src": "18833:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int232", + "typeString": "int232" + } + }, + "visibility": "internal" + } + ], + "src": "18832:19:20" + }, + "scope": 7969, + "src": "18778:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7225, + "nodeType": "Block", + "src": "19399:150:20", + "statements": [ + { + "expression": { + "id": 7213, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7208, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7206, + "src": "19409:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int224", + "typeString": "int224" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7211, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7203, + "src": "19429:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7210, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "19422:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int224_$", + "typeString": "type(int224)" + }, + "typeName": { + "id": 7209, + "name": "int224", + "nodeType": "ElementaryTypeName", + "src": "19422:6:20", + "typeDescriptions": {} + } + }, + "id": 7212, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19422:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int224", + "typeString": "int224" + } + }, + "src": "19409:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int224", + "typeString": "int224" + } + }, + "id": 7214, + "nodeType": "ExpressionStatement", + "src": "19409:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7217, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7215, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7206, + "src": "19449:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int224", + "typeString": "int224" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7216, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7203, + "src": "19463:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "19449:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7224, + "nodeType": "IfStatement", + "src": "19445:98:20", + "trueBody": { + "id": 7223, + "nodeType": "Block", + "src": "19470:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323234", + "id": 7219, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19521:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_224_by_1", + "typeString": "int_const 224" + }, + "value": "224" + }, + { + "id": 7220, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7203, + "src": "19526:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_224_by_1", + "typeString": "int_const 224" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7218, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "19491:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7221, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19491:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7222, + "nodeType": "RevertStatement", + "src": "19484:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7201, + "nodeType": "StructuredDocumentation", + "src": "19008:312:20", + "text": " @dev Returns the downcasted int224 from int256, reverting on\n overflow (when the input is less than smallest int224 or\n greater than largest int224).\n Counterpart to Solidity's `int224` operator.\n Requirements:\n - input must fit into 224 bits" + }, + "id": 7226, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt224", + "nameLocation": "19334:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7204, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7203, + "mutability": "mutable", + "name": "value", + "nameLocation": "19350:5:20", + "nodeType": "VariableDeclaration", + "scope": 7226, + "src": "19343:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7202, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "19343:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "19342:14:20" + }, + "returnParameters": { + "id": 7207, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7206, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "19387:10:20", + "nodeType": "VariableDeclaration", + "scope": 7226, + "src": "19380:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int224", + "typeString": "int224" + }, + "typeName": { + "id": 7205, + "name": "int224", + "nodeType": "ElementaryTypeName", + "src": "19380:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int224", + "typeString": "int224" + } + }, + "visibility": "internal" + } + ], + "src": "19379:19:20" + }, + "scope": 7969, + "src": "19325:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7251, + "nodeType": "Block", + "src": "19946:150:20", + "statements": [ + { + "expression": { + "id": 7239, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7234, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7232, + "src": "19956:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int216", + "typeString": "int216" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7237, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7229, + "src": "19976:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7236, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "19969:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int216_$", + "typeString": "type(int216)" + }, + "typeName": { + "id": 7235, + "name": "int216", + "nodeType": "ElementaryTypeName", + "src": "19969:6:20", + "typeDescriptions": {} + } + }, + "id": 7238, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19969:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int216", + "typeString": "int216" + } + }, + "src": "19956:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int216", + "typeString": "int216" + } + }, + "id": 7240, + "nodeType": "ExpressionStatement", + "src": "19956:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7243, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7241, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7232, + "src": "19996:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int216", + "typeString": "int216" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7242, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7229, + "src": "20010:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "19996:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7250, + "nodeType": "IfStatement", + "src": "19992:98:20", + "trueBody": { + "id": 7249, + "nodeType": "Block", + "src": "20017:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323136", + "id": 7245, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "20068:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_216_by_1", + "typeString": "int_const 216" + }, + "value": "216" + }, + { + "id": 7246, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7229, + "src": "20073:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_216_by_1", + "typeString": "int_const 216" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7244, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "20038:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7247, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "20038:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7248, + "nodeType": "RevertStatement", + "src": "20031:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7227, + "nodeType": "StructuredDocumentation", + "src": "19555:312:20", + "text": " @dev Returns the downcasted int216 from int256, reverting on\n overflow (when the input is less than smallest int216 or\n greater than largest int216).\n Counterpart to Solidity's `int216` operator.\n Requirements:\n - input must fit into 216 bits" + }, + "id": 7252, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt216", + "nameLocation": "19881:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7230, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7229, + "mutability": "mutable", + "name": "value", + "nameLocation": "19897:5:20", + "nodeType": "VariableDeclaration", + "scope": 7252, + "src": "19890:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7228, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "19890:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "19889:14:20" + }, + "returnParameters": { + "id": 7233, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7232, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "19934:10:20", + "nodeType": "VariableDeclaration", + "scope": 7252, + "src": "19927:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int216", + "typeString": "int216" + }, + "typeName": { + "id": 7231, + "name": "int216", + "nodeType": "ElementaryTypeName", + "src": "19927:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int216", + "typeString": "int216" + } + }, + "visibility": "internal" + } + ], + "src": "19926:19:20" + }, + "scope": 7969, + "src": "19872:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7277, + "nodeType": "Block", + "src": "20493:150:20", + "statements": [ + { + "expression": { + "id": 7265, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7260, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7258, + "src": "20503:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int208", + "typeString": "int208" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7263, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7255, + "src": "20523:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7262, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "20516:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int208_$", + "typeString": "type(int208)" + }, + "typeName": { + "id": 7261, + "name": "int208", + "nodeType": "ElementaryTypeName", + "src": "20516:6:20", + "typeDescriptions": {} + } + }, + "id": 7264, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "20516:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int208", + "typeString": "int208" + } + }, + "src": "20503:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int208", + "typeString": "int208" + } + }, + "id": 7266, + "nodeType": "ExpressionStatement", + "src": "20503:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7269, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7267, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7258, + "src": "20543:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int208", + "typeString": "int208" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7268, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7255, + "src": "20557:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "20543:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7276, + "nodeType": "IfStatement", + "src": "20539:98:20", + "trueBody": { + "id": 7275, + "nodeType": "Block", + "src": "20564:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323038", + "id": 7271, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "20615:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_208_by_1", + "typeString": "int_const 208" + }, + "value": "208" + }, + { + "id": 7272, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7255, + "src": "20620:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_208_by_1", + "typeString": "int_const 208" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7270, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "20585:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7273, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "20585:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7274, + "nodeType": "RevertStatement", + "src": "20578:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7253, + "nodeType": "StructuredDocumentation", + "src": "20102:312:20", + "text": " @dev Returns the downcasted int208 from int256, reverting on\n overflow (when the input is less than smallest int208 or\n greater than largest int208).\n Counterpart to Solidity's `int208` operator.\n Requirements:\n - input must fit into 208 bits" + }, + "id": 7278, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt208", + "nameLocation": "20428:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7256, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7255, + "mutability": "mutable", + "name": "value", + "nameLocation": "20444:5:20", + "nodeType": "VariableDeclaration", + "scope": 7278, + "src": "20437:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7254, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "20437:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "20436:14:20" + }, + "returnParameters": { + "id": 7259, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7258, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "20481:10:20", + "nodeType": "VariableDeclaration", + "scope": 7278, + "src": "20474:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int208", + "typeString": "int208" + }, + "typeName": { + "id": 7257, + "name": "int208", + "nodeType": "ElementaryTypeName", + "src": "20474:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int208", + "typeString": "int208" + } + }, + "visibility": "internal" + } + ], + "src": "20473:19:20" + }, + "scope": 7969, + "src": "20419:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7303, + "nodeType": "Block", + "src": "21040:150:20", + "statements": [ + { + "expression": { + "id": 7291, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7286, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7284, + "src": "21050:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int200", + "typeString": "int200" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7289, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7281, + "src": "21070:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7288, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "21063:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int200_$", + "typeString": "type(int200)" + }, + "typeName": { + "id": 7287, + "name": "int200", + "nodeType": "ElementaryTypeName", + "src": "21063:6:20", + "typeDescriptions": {} + } + }, + "id": 7290, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "21063:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int200", + "typeString": "int200" + } + }, + "src": "21050:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int200", + "typeString": "int200" + } + }, + "id": 7292, + "nodeType": "ExpressionStatement", + "src": "21050:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7295, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7293, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7284, + "src": "21090:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int200", + "typeString": "int200" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7294, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7281, + "src": "21104:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "21090:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7302, + "nodeType": "IfStatement", + "src": "21086:98:20", + "trueBody": { + "id": 7301, + "nodeType": "Block", + "src": "21111:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323030", + "id": 7297, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "21162:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_200_by_1", + "typeString": "int_const 200" + }, + "value": "200" + }, + { + "id": 7298, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7281, + "src": "21167:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_200_by_1", + "typeString": "int_const 200" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7296, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "21132:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7299, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "21132:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7300, + "nodeType": "RevertStatement", + "src": "21125:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7279, + "nodeType": "StructuredDocumentation", + "src": "20649:312:20", + "text": " @dev Returns the downcasted int200 from int256, reverting on\n overflow (when the input is less than smallest int200 or\n greater than largest int200).\n Counterpart to Solidity's `int200` operator.\n Requirements:\n - input must fit into 200 bits" + }, + "id": 7304, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt200", + "nameLocation": "20975:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7282, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7281, + "mutability": "mutable", + "name": "value", + "nameLocation": "20991:5:20", + "nodeType": "VariableDeclaration", + "scope": 7304, + "src": "20984:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7280, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "20984:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "20983:14:20" + }, + "returnParameters": { + "id": 7285, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7284, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "21028:10:20", + "nodeType": "VariableDeclaration", + "scope": 7304, + "src": "21021:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int200", + "typeString": "int200" + }, + "typeName": { + "id": 7283, + "name": "int200", + "nodeType": "ElementaryTypeName", + "src": "21021:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int200", + "typeString": "int200" + } + }, + "visibility": "internal" + } + ], + "src": "21020:19:20" + }, + "scope": 7969, + "src": "20966:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7329, + "nodeType": "Block", + "src": "21587:150:20", + "statements": [ + { + "expression": { + "id": 7317, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7312, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7310, + "src": "21597:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int192", + "typeString": "int192" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7315, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7307, + "src": "21617:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7314, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "21610:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int192_$", + "typeString": "type(int192)" + }, + "typeName": { + "id": 7313, + "name": "int192", + "nodeType": "ElementaryTypeName", + "src": "21610:6:20", + "typeDescriptions": {} + } + }, + "id": 7316, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "21610:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int192", + "typeString": "int192" + } + }, + "src": "21597:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int192", + "typeString": "int192" + } + }, + "id": 7318, + "nodeType": "ExpressionStatement", + "src": "21597:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7321, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7319, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7310, + "src": "21637:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int192", + "typeString": "int192" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7320, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7307, + "src": "21651:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "21637:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7328, + "nodeType": "IfStatement", + "src": "21633:98:20", + "trueBody": { + "id": 7327, + "nodeType": "Block", + "src": "21658:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313932", + "id": 7323, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "21709:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_192_by_1", + "typeString": "int_const 192" + }, + "value": "192" + }, + { + "id": 7324, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7307, + "src": "21714:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_192_by_1", + "typeString": "int_const 192" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7322, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "21679:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7325, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "21679:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7326, + "nodeType": "RevertStatement", + "src": "21672:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7305, + "nodeType": "StructuredDocumentation", + "src": "21196:312:20", + "text": " @dev Returns the downcasted int192 from int256, reverting on\n overflow (when the input is less than smallest int192 or\n greater than largest int192).\n Counterpart to Solidity's `int192` operator.\n Requirements:\n - input must fit into 192 bits" + }, + "id": 7330, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt192", + "nameLocation": "21522:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7308, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7307, + "mutability": "mutable", + "name": "value", + "nameLocation": "21538:5:20", + "nodeType": "VariableDeclaration", + "scope": 7330, + "src": "21531:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7306, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "21531:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "21530:14:20" + }, + "returnParameters": { + "id": 7311, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7310, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "21575:10:20", + "nodeType": "VariableDeclaration", + "scope": 7330, + "src": "21568:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int192", + "typeString": "int192" + }, + "typeName": { + "id": 7309, + "name": "int192", + "nodeType": "ElementaryTypeName", + "src": "21568:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int192", + "typeString": "int192" + } + }, + "visibility": "internal" + } + ], + "src": "21567:19:20" + }, + "scope": 7969, + "src": "21513:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7355, + "nodeType": "Block", + "src": "22134:150:20", + "statements": [ + { + "expression": { + "id": 7343, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7338, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7336, + "src": "22144:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int184", + "typeString": "int184" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7341, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7333, + "src": "22164:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7340, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "22157:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int184_$", + "typeString": "type(int184)" + }, + "typeName": { + "id": 7339, + "name": "int184", + "nodeType": "ElementaryTypeName", + "src": "22157:6:20", + "typeDescriptions": {} + } + }, + "id": 7342, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "22157:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int184", + "typeString": "int184" + } + }, + "src": "22144:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int184", + "typeString": "int184" + } + }, + "id": 7344, + "nodeType": "ExpressionStatement", + "src": "22144:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7347, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7345, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7336, + "src": "22184:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int184", + "typeString": "int184" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7346, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7333, + "src": "22198:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "22184:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7354, + "nodeType": "IfStatement", + "src": "22180:98:20", + "trueBody": { + "id": 7353, + "nodeType": "Block", + "src": "22205:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313834", + "id": 7349, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22256:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_184_by_1", + "typeString": "int_const 184" + }, + "value": "184" + }, + { + "id": 7350, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7333, + "src": "22261:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_184_by_1", + "typeString": "int_const 184" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7348, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "22226:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7351, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "22226:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7352, + "nodeType": "RevertStatement", + "src": "22219:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7331, + "nodeType": "StructuredDocumentation", + "src": "21743:312:20", + "text": " @dev Returns the downcasted int184 from int256, reverting on\n overflow (when the input is less than smallest int184 or\n greater than largest int184).\n Counterpart to Solidity's `int184` operator.\n Requirements:\n - input must fit into 184 bits" + }, + "id": 7356, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt184", + "nameLocation": "22069:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7334, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7333, + "mutability": "mutable", + "name": "value", + "nameLocation": "22085:5:20", + "nodeType": "VariableDeclaration", + "scope": 7356, + "src": "22078:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7332, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "22078:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "22077:14:20" + }, + "returnParameters": { + "id": 7337, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7336, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "22122:10:20", + "nodeType": "VariableDeclaration", + "scope": 7356, + "src": "22115:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int184", + "typeString": "int184" + }, + "typeName": { + "id": 7335, + "name": "int184", + "nodeType": "ElementaryTypeName", + "src": "22115:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int184", + "typeString": "int184" + } + }, + "visibility": "internal" + } + ], + "src": "22114:19:20" + }, + "scope": 7969, + "src": "22060:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7381, + "nodeType": "Block", + "src": "22681:150:20", + "statements": [ + { + "expression": { + "id": 7369, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7364, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7362, + "src": "22691:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int176", + "typeString": "int176" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7367, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7359, + "src": "22711:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7366, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "22704:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int176_$", + "typeString": "type(int176)" + }, + "typeName": { + "id": 7365, + "name": "int176", + "nodeType": "ElementaryTypeName", + "src": "22704:6:20", + "typeDescriptions": {} + } + }, + "id": 7368, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "22704:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int176", + "typeString": "int176" + } + }, + "src": "22691:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int176", + "typeString": "int176" + } + }, + "id": 7370, + "nodeType": "ExpressionStatement", + "src": "22691:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7373, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7371, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7362, + "src": "22731:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int176", + "typeString": "int176" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7372, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7359, + "src": "22745:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "22731:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7380, + "nodeType": "IfStatement", + "src": "22727:98:20", + "trueBody": { + "id": 7379, + "nodeType": "Block", + "src": "22752:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313736", + "id": 7375, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22803:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_176_by_1", + "typeString": "int_const 176" + }, + "value": "176" + }, + { + "id": 7376, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7359, + "src": "22808:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_176_by_1", + "typeString": "int_const 176" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7374, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "22773:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7377, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "22773:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7378, + "nodeType": "RevertStatement", + "src": "22766:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7357, + "nodeType": "StructuredDocumentation", + "src": "22290:312:20", + "text": " @dev Returns the downcasted int176 from int256, reverting on\n overflow (when the input is less than smallest int176 or\n greater than largest int176).\n Counterpart to Solidity's `int176` operator.\n Requirements:\n - input must fit into 176 bits" + }, + "id": 7382, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt176", + "nameLocation": "22616:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7360, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7359, + "mutability": "mutable", + "name": "value", + "nameLocation": "22632:5:20", + "nodeType": "VariableDeclaration", + "scope": 7382, + "src": "22625:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7358, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "22625:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "22624:14:20" + }, + "returnParameters": { + "id": 7363, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7362, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "22669:10:20", + "nodeType": "VariableDeclaration", + "scope": 7382, + "src": "22662:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int176", + "typeString": "int176" + }, + "typeName": { + "id": 7361, + "name": "int176", + "nodeType": "ElementaryTypeName", + "src": "22662:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int176", + "typeString": "int176" + } + }, + "visibility": "internal" + } + ], + "src": "22661:19:20" + }, + "scope": 7969, + "src": "22607:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7407, + "nodeType": "Block", + "src": "23228:150:20", + "statements": [ + { + "expression": { + "id": 7395, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7390, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7388, + "src": "23238:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int168", + "typeString": "int168" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7393, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7385, + "src": "23258:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7392, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "23251:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int168_$", + "typeString": "type(int168)" + }, + "typeName": { + "id": 7391, + "name": "int168", + "nodeType": "ElementaryTypeName", + "src": "23251:6:20", + "typeDescriptions": {} + } + }, + "id": 7394, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "23251:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int168", + "typeString": "int168" + } + }, + "src": "23238:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int168", + "typeString": "int168" + } + }, + "id": 7396, + "nodeType": "ExpressionStatement", + "src": "23238:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7399, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7397, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7388, + "src": "23278:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int168", + "typeString": "int168" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7398, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7385, + "src": "23292:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "23278:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7406, + "nodeType": "IfStatement", + "src": "23274:98:20", + "trueBody": { + "id": 7405, + "nodeType": "Block", + "src": "23299:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313638", + "id": 7401, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "23350:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_168_by_1", + "typeString": "int_const 168" + }, + "value": "168" + }, + { + "id": 7402, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7385, + "src": "23355:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_168_by_1", + "typeString": "int_const 168" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7400, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "23320:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7403, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "23320:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7404, + "nodeType": "RevertStatement", + "src": "23313:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7383, + "nodeType": "StructuredDocumentation", + "src": "22837:312:20", + "text": " @dev Returns the downcasted int168 from int256, reverting on\n overflow (when the input is less than smallest int168 or\n greater than largest int168).\n Counterpart to Solidity's `int168` operator.\n Requirements:\n - input must fit into 168 bits" + }, + "id": 7408, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt168", + "nameLocation": "23163:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7386, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7385, + "mutability": "mutable", + "name": "value", + "nameLocation": "23179:5:20", + "nodeType": "VariableDeclaration", + "scope": 7408, + "src": "23172:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7384, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "23172:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "23171:14:20" + }, + "returnParameters": { + "id": 7389, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7388, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "23216:10:20", + "nodeType": "VariableDeclaration", + "scope": 7408, + "src": "23209:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int168", + "typeString": "int168" + }, + "typeName": { + "id": 7387, + "name": "int168", + "nodeType": "ElementaryTypeName", + "src": "23209:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int168", + "typeString": "int168" + } + }, + "visibility": "internal" + } + ], + "src": "23208:19:20" + }, + "scope": 7969, + "src": "23154:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7433, + "nodeType": "Block", + "src": "23775:150:20", + "statements": [ + { + "expression": { + "id": 7421, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7416, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7414, + "src": "23785:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int160", + "typeString": "int160" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7419, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7411, + "src": "23805:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7418, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "23798:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int160_$", + "typeString": "type(int160)" + }, + "typeName": { + "id": 7417, + "name": "int160", + "nodeType": "ElementaryTypeName", + "src": "23798:6:20", + "typeDescriptions": {} + } + }, + "id": 7420, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "23798:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int160", + "typeString": "int160" + } + }, + "src": "23785:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int160", + "typeString": "int160" + } + }, + "id": 7422, + "nodeType": "ExpressionStatement", + "src": "23785:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7425, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7423, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7414, + "src": "23825:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int160", + "typeString": "int160" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7424, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7411, + "src": "23839:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "23825:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7432, + "nodeType": "IfStatement", + "src": "23821:98:20", + "trueBody": { + "id": 7431, + "nodeType": "Block", + "src": "23846:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313630", + "id": 7427, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "23897:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_160_by_1", + "typeString": "int_const 160" + }, + "value": "160" + }, + { + "id": 7428, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7411, + "src": "23902:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_160_by_1", + "typeString": "int_const 160" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7426, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "23867:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7429, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "23867:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7430, + "nodeType": "RevertStatement", + "src": "23860:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7409, + "nodeType": "StructuredDocumentation", + "src": "23384:312:20", + "text": " @dev Returns the downcasted int160 from int256, reverting on\n overflow (when the input is less than smallest int160 or\n greater than largest int160).\n Counterpart to Solidity's `int160` operator.\n Requirements:\n - input must fit into 160 bits" + }, + "id": 7434, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt160", + "nameLocation": "23710:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7412, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7411, + "mutability": "mutable", + "name": "value", + "nameLocation": "23726:5:20", + "nodeType": "VariableDeclaration", + "scope": 7434, + "src": "23719:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7410, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "23719:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "23718:14:20" + }, + "returnParameters": { + "id": 7415, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7414, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "23763:10:20", + "nodeType": "VariableDeclaration", + "scope": 7434, + "src": "23756:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int160", + "typeString": "int160" + }, + "typeName": { + "id": 7413, + "name": "int160", + "nodeType": "ElementaryTypeName", + "src": "23756:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int160", + "typeString": "int160" + } + }, + "visibility": "internal" + } + ], + "src": "23755:19:20" + }, + "scope": 7969, + "src": "23701:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7459, + "nodeType": "Block", + "src": "24322:150:20", + "statements": [ + { + "expression": { + "id": 7447, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7442, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7440, + "src": "24332:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int152", + "typeString": "int152" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7445, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7437, + "src": "24352:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7444, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "24345:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int152_$", + "typeString": "type(int152)" + }, + "typeName": { + "id": 7443, + "name": "int152", + "nodeType": "ElementaryTypeName", + "src": "24345:6:20", + "typeDescriptions": {} + } + }, + "id": 7446, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "24345:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int152", + "typeString": "int152" + } + }, + "src": "24332:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int152", + "typeString": "int152" + } + }, + "id": 7448, + "nodeType": "ExpressionStatement", + "src": "24332:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7451, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7449, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7440, + "src": "24372:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int152", + "typeString": "int152" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7450, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7437, + "src": "24386:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "24372:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7458, + "nodeType": "IfStatement", + "src": "24368:98:20", + "trueBody": { + "id": 7457, + "nodeType": "Block", + "src": "24393:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313532", + "id": 7453, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "24444:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_152_by_1", + "typeString": "int_const 152" + }, + "value": "152" + }, + { + "id": 7454, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7437, + "src": "24449:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_152_by_1", + "typeString": "int_const 152" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7452, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "24414:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7455, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "24414:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7456, + "nodeType": "RevertStatement", + "src": "24407:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7435, + "nodeType": "StructuredDocumentation", + "src": "23931:312:20", + "text": " @dev Returns the downcasted int152 from int256, reverting on\n overflow (when the input is less than smallest int152 or\n greater than largest int152).\n Counterpart to Solidity's `int152` operator.\n Requirements:\n - input must fit into 152 bits" + }, + "id": 7460, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt152", + "nameLocation": "24257:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7438, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7437, + "mutability": "mutable", + "name": "value", + "nameLocation": "24273:5:20", + "nodeType": "VariableDeclaration", + "scope": 7460, + "src": "24266:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7436, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "24266:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "24265:14:20" + }, + "returnParameters": { + "id": 7441, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7440, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "24310:10:20", + "nodeType": "VariableDeclaration", + "scope": 7460, + "src": "24303:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int152", + "typeString": "int152" + }, + "typeName": { + "id": 7439, + "name": "int152", + "nodeType": "ElementaryTypeName", + "src": "24303:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int152", + "typeString": "int152" + } + }, + "visibility": "internal" + } + ], + "src": "24302:19:20" + }, + "scope": 7969, + "src": "24248:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7485, + "nodeType": "Block", + "src": "24869:150:20", + "statements": [ + { + "expression": { + "id": 7473, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7468, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7466, + "src": "24879:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int144", + "typeString": "int144" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7471, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7463, + "src": "24899:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7470, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "24892:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int144_$", + "typeString": "type(int144)" + }, + "typeName": { + "id": 7469, + "name": "int144", + "nodeType": "ElementaryTypeName", + "src": "24892:6:20", + "typeDescriptions": {} + } + }, + "id": 7472, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "24892:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int144", + "typeString": "int144" + } + }, + "src": "24879:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int144", + "typeString": "int144" + } + }, + "id": 7474, + "nodeType": "ExpressionStatement", + "src": "24879:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7477, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7475, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7466, + "src": "24919:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int144", + "typeString": "int144" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7476, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7463, + "src": "24933:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "24919:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7484, + "nodeType": "IfStatement", + "src": "24915:98:20", + "trueBody": { + "id": 7483, + "nodeType": "Block", + "src": "24940:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313434", + "id": 7479, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "24991:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_144_by_1", + "typeString": "int_const 144" + }, + "value": "144" + }, + { + "id": 7480, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7463, + "src": "24996:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_144_by_1", + "typeString": "int_const 144" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7478, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "24961:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7481, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "24961:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7482, + "nodeType": "RevertStatement", + "src": "24954:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7461, + "nodeType": "StructuredDocumentation", + "src": "24478:312:20", + "text": " @dev Returns the downcasted int144 from int256, reverting on\n overflow (when the input is less than smallest int144 or\n greater than largest int144).\n Counterpart to Solidity's `int144` operator.\n Requirements:\n - input must fit into 144 bits" + }, + "id": 7486, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt144", + "nameLocation": "24804:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7464, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7463, + "mutability": "mutable", + "name": "value", + "nameLocation": "24820:5:20", + "nodeType": "VariableDeclaration", + "scope": 7486, + "src": "24813:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7462, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "24813:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "24812:14:20" + }, + "returnParameters": { + "id": 7467, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7466, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "24857:10:20", + "nodeType": "VariableDeclaration", + "scope": 7486, + "src": "24850:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int144", + "typeString": "int144" + }, + "typeName": { + "id": 7465, + "name": "int144", + "nodeType": "ElementaryTypeName", + "src": "24850:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int144", + "typeString": "int144" + } + }, + "visibility": "internal" + } + ], + "src": "24849:19:20" + }, + "scope": 7969, + "src": "24795:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7511, + "nodeType": "Block", + "src": "25416:150:20", + "statements": [ + { + "expression": { + "id": 7499, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7494, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7492, + "src": "25426:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int136", + "typeString": "int136" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7497, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7489, + "src": "25446:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7496, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "25439:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int136_$", + "typeString": "type(int136)" + }, + "typeName": { + "id": 7495, + "name": "int136", + "nodeType": "ElementaryTypeName", + "src": "25439:6:20", + "typeDescriptions": {} + } + }, + "id": 7498, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "25439:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int136", + "typeString": "int136" + } + }, + "src": "25426:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int136", + "typeString": "int136" + } + }, + "id": 7500, + "nodeType": "ExpressionStatement", + "src": "25426:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7503, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7501, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7492, + "src": "25466:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int136", + "typeString": "int136" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7502, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7489, + "src": "25480:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "25466:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7510, + "nodeType": "IfStatement", + "src": "25462:98:20", + "trueBody": { + "id": 7509, + "nodeType": "Block", + "src": "25487:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313336", + "id": 7505, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "25538:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_136_by_1", + "typeString": "int_const 136" + }, + "value": "136" + }, + { + "id": 7506, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7489, + "src": "25543:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_136_by_1", + "typeString": "int_const 136" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7504, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "25508:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7507, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "25508:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7508, + "nodeType": "RevertStatement", + "src": "25501:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7487, + "nodeType": "StructuredDocumentation", + "src": "25025:312:20", + "text": " @dev Returns the downcasted int136 from int256, reverting on\n overflow (when the input is less than smallest int136 or\n greater than largest int136).\n Counterpart to Solidity's `int136` operator.\n Requirements:\n - input must fit into 136 bits" + }, + "id": 7512, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt136", + "nameLocation": "25351:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7490, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7489, + "mutability": "mutable", + "name": "value", + "nameLocation": "25367:5:20", + "nodeType": "VariableDeclaration", + "scope": 7512, + "src": "25360:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7488, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "25360:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "25359:14:20" + }, + "returnParameters": { + "id": 7493, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7492, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "25404:10:20", + "nodeType": "VariableDeclaration", + "scope": 7512, + "src": "25397:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int136", + "typeString": "int136" + }, + "typeName": { + "id": 7491, + "name": "int136", + "nodeType": "ElementaryTypeName", + "src": "25397:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int136", + "typeString": "int136" + } + }, + "visibility": "internal" + } + ], + "src": "25396:19:20" + }, + "scope": 7969, + "src": "25342:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7537, + "nodeType": "Block", + "src": "25963:150:20", + "statements": [ + { + "expression": { + "id": 7525, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7520, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7518, + "src": "25973:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int128", + "typeString": "int128" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7523, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7515, + "src": "25993:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7522, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "25986:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int128_$", + "typeString": "type(int128)" + }, + "typeName": { + "id": 7521, + "name": "int128", + "nodeType": "ElementaryTypeName", + "src": "25986:6:20", + "typeDescriptions": {} + } + }, + "id": 7524, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "25986:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int128", + "typeString": "int128" + } + }, + "src": "25973:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int128", + "typeString": "int128" + } + }, + "id": 7526, + "nodeType": "ExpressionStatement", + "src": "25973:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7529, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7527, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7518, + "src": "26013:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int128", + "typeString": "int128" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7528, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7515, + "src": "26027:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "26013:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7536, + "nodeType": "IfStatement", + "src": "26009:98:20", + "trueBody": { + "id": 7535, + "nodeType": "Block", + "src": "26034:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313238", + "id": 7531, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "26085:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_128_by_1", + "typeString": "int_const 128" + }, + "value": "128" + }, + { + "id": 7532, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7515, + "src": "26090:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_128_by_1", + "typeString": "int_const 128" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7530, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "26055:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7533, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "26055:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7534, + "nodeType": "RevertStatement", + "src": "26048:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7513, + "nodeType": "StructuredDocumentation", + "src": "25572:312:20", + "text": " @dev Returns the downcasted int128 from int256, reverting on\n overflow (when the input is less than smallest int128 or\n greater than largest int128).\n Counterpart to Solidity's `int128` operator.\n Requirements:\n - input must fit into 128 bits" + }, + "id": 7538, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt128", + "nameLocation": "25898:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7516, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7515, + "mutability": "mutable", + "name": "value", + "nameLocation": "25914:5:20", + "nodeType": "VariableDeclaration", + "scope": 7538, + "src": "25907:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7514, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "25907:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "25906:14:20" + }, + "returnParameters": { + "id": 7519, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7518, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "25951:10:20", + "nodeType": "VariableDeclaration", + "scope": 7538, + "src": "25944:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int128", + "typeString": "int128" + }, + "typeName": { + "id": 7517, + "name": "int128", + "nodeType": "ElementaryTypeName", + "src": "25944:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int128", + "typeString": "int128" + } + }, + "visibility": "internal" + } + ], + "src": "25943:19:20" + }, + "scope": 7969, + "src": "25889:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7563, + "nodeType": "Block", + "src": "26510:150:20", + "statements": [ + { + "expression": { + "id": 7551, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7546, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7544, + "src": "26520:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int120", + "typeString": "int120" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7549, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7541, + "src": "26540:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7548, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "26533:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int120_$", + "typeString": "type(int120)" + }, + "typeName": { + "id": 7547, + "name": "int120", + "nodeType": "ElementaryTypeName", + "src": "26533:6:20", + "typeDescriptions": {} + } + }, + "id": 7550, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "26533:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int120", + "typeString": "int120" + } + }, + "src": "26520:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int120", + "typeString": "int120" + } + }, + "id": 7552, + "nodeType": "ExpressionStatement", + "src": "26520:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7555, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7553, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7544, + "src": "26560:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int120", + "typeString": "int120" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7554, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7541, + "src": "26574:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "26560:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7562, + "nodeType": "IfStatement", + "src": "26556:98:20", + "trueBody": { + "id": 7561, + "nodeType": "Block", + "src": "26581:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313230", + "id": 7557, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "26632:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_120_by_1", + "typeString": "int_const 120" + }, + "value": "120" + }, + { + "id": 7558, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7541, + "src": "26637:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_120_by_1", + "typeString": "int_const 120" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7556, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "26602:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7559, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "26602:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7560, + "nodeType": "RevertStatement", + "src": "26595:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7539, + "nodeType": "StructuredDocumentation", + "src": "26119:312:20", + "text": " @dev Returns the downcasted int120 from int256, reverting on\n overflow (when the input is less than smallest int120 or\n greater than largest int120).\n Counterpart to Solidity's `int120` operator.\n Requirements:\n - input must fit into 120 bits" + }, + "id": 7564, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt120", + "nameLocation": "26445:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7542, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7541, + "mutability": "mutable", + "name": "value", + "nameLocation": "26461:5:20", + "nodeType": "VariableDeclaration", + "scope": 7564, + "src": "26454:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7540, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "26454:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "26453:14:20" + }, + "returnParameters": { + "id": 7545, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7544, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "26498:10:20", + "nodeType": "VariableDeclaration", + "scope": 7564, + "src": "26491:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int120", + "typeString": "int120" + }, + "typeName": { + "id": 7543, + "name": "int120", + "nodeType": "ElementaryTypeName", + "src": "26491:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int120", + "typeString": "int120" + } + }, + "visibility": "internal" + } + ], + "src": "26490:19:20" + }, + "scope": 7969, + "src": "26436:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7589, + "nodeType": "Block", + "src": "27057:150:20", + "statements": [ + { + "expression": { + "id": 7577, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7572, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7570, + "src": "27067:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int112", + "typeString": "int112" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7575, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7567, + "src": "27087:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7574, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "27080:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int112_$", + "typeString": "type(int112)" + }, + "typeName": { + "id": 7573, + "name": "int112", + "nodeType": "ElementaryTypeName", + "src": "27080:6:20", + "typeDescriptions": {} + } + }, + "id": 7576, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "27080:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int112", + "typeString": "int112" + } + }, + "src": "27067:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int112", + "typeString": "int112" + } + }, + "id": 7578, + "nodeType": "ExpressionStatement", + "src": "27067:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7581, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7579, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7570, + "src": "27107:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int112", + "typeString": "int112" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7580, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7567, + "src": "27121:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "27107:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7588, + "nodeType": "IfStatement", + "src": "27103:98:20", + "trueBody": { + "id": 7587, + "nodeType": "Block", + "src": "27128:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313132", + "id": 7583, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "27179:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_112_by_1", + "typeString": "int_const 112" + }, + "value": "112" + }, + { + "id": 7584, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7567, + "src": "27184:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_112_by_1", + "typeString": "int_const 112" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7582, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "27149:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7585, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "27149:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7586, + "nodeType": "RevertStatement", + "src": "27142:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7565, + "nodeType": "StructuredDocumentation", + "src": "26666:312:20", + "text": " @dev Returns the downcasted int112 from int256, reverting on\n overflow (when the input is less than smallest int112 or\n greater than largest int112).\n Counterpart to Solidity's `int112` operator.\n Requirements:\n - input must fit into 112 bits" + }, + "id": 7590, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt112", + "nameLocation": "26992:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7568, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7567, + "mutability": "mutable", + "name": "value", + "nameLocation": "27008:5:20", + "nodeType": "VariableDeclaration", + "scope": 7590, + "src": "27001:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7566, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "27001:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "27000:14:20" + }, + "returnParameters": { + "id": 7571, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7570, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "27045:10:20", + "nodeType": "VariableDeclaration", + "scope": 7590, + "src": "27038:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int112", + "typeString": "int112" + }, + "typeName": { + "id": 7569, + "name": "int112", + "nodeType": "ElementaryTypeName", + "src": "27038:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int112", + "typeString": "int112" + } + }, + "visibility": "internal" + } + ], + "src": "27037:19:20" + }, + "scope": 7969, + "src": "26983:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7615, + "nodeType": "Block", + "src": "27604:150:20", + "statements": [ + { + "expression": { + "id": 7603, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7598, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7596, + "src": "27614:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int104", + "typeString": "int104" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7601, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7593, + "src": "27634:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7600, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "27627:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int104_$", + "typeString": "type(int104)" + }, + "typeName": { + "id": 7599, + "name": "int104", + "nodeType": "ElementaryTypeName", + "src": "27627:6:20", + "typeDescriptions": {} + } + }, + "id": 7602, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "27627:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int104", + "typeString": "int104" + } + }, + "src": "27614:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int104", + "typeString": "int104" + } + }, + "id": 7604, + "nodeType": "ExpressionStatement", + "src": "27614:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7607, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7605, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7596, + "src": "27654:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int104", + "typeString": "int104" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7606, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7593, + "src": "27668:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "27654:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7614, + "nodeType": "IfStatement", + "src": "27650:98:20", + "trueBody": { + "id": 7613, + "nodeType": "Block", + "src": "27675:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313034", + "id": 7609, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "27726:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_104_by_1", + "typeString": "int_const 104" + }, + "value": "104" + }, + { + "id": 7610, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7593, + "src": "27731:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_104_by_1", + "typeString": "int_const 104" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7608, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "27696:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7611, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "27696:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7612, + "nodeType": "RevertStatement", + "src": "27689:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7591, + "nodeType": "StructuredDocumentation", + "src": "27213:312:20", + "text": " @dev Returns the downcasted int104 from int256, reverting on\n overflow (when the input is less than smallest int104 or\n greater than largest int104).\n Counterpart to Solidity's `int104` operator.\n Requirements:\n - input must fit into 104 bits" + }, + "id": 7616, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt104", + "nameLocation": "27539:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7594, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7593, + "mutability": "mutable", + "name": "value", + "nameLocation": "27555:5:20", + "nodeType": "VariableDeclaration", + "scope": 7616, + "src": "27548:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7592, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "27548:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "27547:14:20" + }, + "returnParameters": { + "id": 7597, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7596, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "27592:10:20", + "nodeType": "VariableDeclaration", + "scope": 7616, + "src": "27585:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int104", + "typeString": "int104" + }, + "typeName": { + "id": 7595, + "name": "int104", + "nodeType": "ElementaryTypeName", + "src": "27585:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int104", + "typeString": "int104" + } + }, + "visibility": "internal" + } + ], + "src": "27584:19:20" + }, + "scope": 7969, + "src": "27530:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7641, + "nodeType": "Block", + "src": "28144:148:20", + "statements": [ + { + "expression": { + "id": 7629, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7624, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7622, + "src": "28154:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int96", + "typeString": "int96" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7627, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7619, + "src": "28173:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7626, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "28167:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int96_$", + "typeString": "type(int96)" + }, + "typeName": { + "id": 7625, + "name": "int96", + "nodeType": "ElementaryTypeName", + "src": "28167:5:20", + "typeDescriptions": {} + } + }, + "id": 7628, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "28167:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int96", + "typeString": "int96" + } + }, + "src": "28154:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int96", + "typeString": "int96" + } + }, + "id": 7630, + "nodeType": "ExpressionStatement", + "src": "28154:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7633, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7631, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7622, + "src": "28193:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int96", + "typeString": "int96" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7632, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7619, + "src": "28207:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "28193:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7640, + "nodeType": "IfStatement", + "src": "28189:97:20", + "trueBody": { + "id": 7639, + "nodeType": "Block", + "src": "28214:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3936", + "id": 7635, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "28265:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_96_by_1", + "typeString": "int_const 96" + }, + "value": "96" + }, + { + "id": 7636, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7619, + "src": "28269:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_96_by_1", + "typeString": "int_const 96" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7634, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "28235:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7637, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "28235:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7638, + "nodeType": "RevertStatement", + "src": "28228:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7617, + "nodeType": "StructuredDocumentation", + "src": "27760:307:20", + "text": " @dev Returns the downcasted int96 from int256, reverting on\n overflow (when the input is less than smallest int96 or\n greater than largest int96).\n Counterpart to Solidity's `int96` operator.\n Requirements:\n - input must fit into 96 bits" + }, + "id": 7642, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt96", + "nameLocation": "28081:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7620, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7619, + "mutability": "mutable", + "name": "value", + "nameLocation": "28096:5:20", + "nodeType": "VariableDeclaration", + "scope": 7642, + "src": "28089:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7618, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "28089:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "28088:14:20" + }, + "returnParameters": { + "id": 7623, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7622, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "28132:10:20", + "nodeType": "VariableDeclaration", + "scope": 7642, + "src": "28126:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int96", + "typeString": "int96" + }, + "typeName": { + "id": 7621, + "name": "int96", + "nodeType": "ElementaryTypeName", + "src": "28126:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int96", + "typeString": "int96" + } + }, + "visibility": "internal" + } + ], + "src": "28125:18:20" + }, + "scope": 7969, + "src": "28072:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7667, + "nodeType": "Block", + "src": "28682:148:20", + "statements": [ + { + "expression": { + "id": 7655, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7650, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7648, + "src": "28692:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int88", + "typeString": "int88" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7653, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7645, + "src": "28711:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7652, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "28705:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int88_$", + "typeString": "type(int88)" + }, + "typeName": { + "id": 7651, + "name": "int88", + "nodeType": "ElementaryTypeName", + "src": "28705:5:20", + "typeDescriptions": {} + } + }, + "id": 7654, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "28705:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int88", + "typeString": "int88" + } + }, + "src": "28692:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int88", + "typeString": "int88" + } + }, + "id": 7656, + "nodeType": "ExpressionStatement", + "src": "28692:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7659, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7657, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7648, + "src": "28731:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int88", + "typeString": "int88" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7658, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7645, + "src": "28745:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "28731:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7666, + "nodeType": "IfStatement", + "src": "28727:97:20", + "trueBody": { + "id": 7665, + "nodeType": "Block", + "src": "28752:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3838", + "id": 7661, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "28803:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_88_by_1", + "typeString": "int_const 88" + }, + "value": "88" + }, + { + "id": 7662, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7645, + "src": "28807:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_88_by_1", + "typeString": "int_const 88" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7660, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "28773:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7663, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "28773:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7664, + "nodeType": "RevertStatement", + "src": "28766:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7643, + "nodeType": "StructuredDocumentation", + "src": "28298:307:20", + "text": " @dev Returns the downcasted int88 from int256, reverting on\n overflow (when the input is less than smallest int88 or\n greater than largest int88).\n Counterpart to Solidity's `int88` operator.\n Requirements:\n - input must fit into 88 bits" + }, + "id": 7668, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt88", + "nameLocation": "28619:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7646, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7645, + "mutability": "mutable", + "name": "value", + "nameLocation": "28634:5:20", + "nodeType": "VariableDeclaration", + "scope": 7668, + "src": "28627:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7644, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "28627:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "28626:14:20" + }, + "returnParameters": { + "id": 7649, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7648, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "28670:10:20", + "nodeType": "VariableDeclaration", + "scope": 7668, + "src": "28664:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int88", + "typeString": "int88" + }, + "typeName": { + "id": 7647, + "name": "int88", + "nodeType": "ElementaryTypeName", + "src": "28664:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int88", + "typeString": "int88" + } + }, + "visibility": "internal" + } + ], + "src": "28663:18:20" + }, + "scope": 7969, + "src": "28610:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7693, + "nodeType": "Block", + "src": "29220:148:20", + "statements": [ + { + "expression": { + "id": 7681, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7676, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7674, + "src": "29230:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int80", + "typeString": "int80" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7679, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7671, + "src": "29249:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7678, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "29243:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int80_$", + "typeString": "type(int80)" + }, + "typeName": { + "id": 7677, + "name": "int80", + "nodeType": "ElementaryTypeName", + "src": "29243:5:20", + "typeDescriptions": {} + } + }, + "id": 7680, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "29243:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int80", + "typeString": "int80" + } + }, + "src": "29230:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int80", + "typeString": "int80" + } + }, + "id": 7682, + "nodeType": "ExpressionStatement", + "src": "29230:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7685, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7683, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7674, + "src": "29269:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int80", + "typeString": "int80" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7684, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7671, + "src": "29283:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "29269:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7692, + "nodeType": "IfStatement", + "src": "29265:97:20", + "trueBody": { + "id": 7691, + "nodeType": "Block", + "src": "29290:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3830", + "id": 7687, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29341:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_80_by_1", + "typeString": "int_const 80" + }, + "value": "80" + }, + { + "id": 7688, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7671, + "src": "29345:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_80_by_1", + "typeString": "int_const 80" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7686, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "29311:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7689, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "29311:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7690, + "nodeType": "RevertStatement", + "src": "29304:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7669, + "nodeType": "StructuredDocumentation", + "src": "28836:307:20", + "text": " @dev Returns the downcasted int80 from int256, reverting on\n overflow (when the input is less than smallest int80 or\n greater than largest int80).\n Counterpart to Solidity's `int80` operator.\n Requirements:\n - input must fit into 80 bits" + }, + "id": 7694, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt80", + "nameLocation": "29157:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7672, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7671, + "mutability": "mutable", + "name": "value", + "nameLocation": "29172:5:20", + "nodeType": "VariableDeclaration", + "scope": 7694, + "src": "29165:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7670, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "29165:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "29164:14:20" + }, + "returnParameters": { + "id": 7675, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7674, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "29208:10:20", + "nodeType": "VariableDeclaration", + "scope": 7694, + "src": "29202:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int80", + "typeString": "int80" + }, + "typeName": { + "id": 7673, + "name": "int80", + "nodeType": "ElementaryTypeName", + "src": "29202:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int80", + "typeString": "int80" + } + }, + "visibility": "internal" + } + ], + "src": "29201:18:20" + }, + "scope": 7969, + "src": "29148:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7719, + "nodeType": "Block", + "src": "29758:148:20", + "statements": [ + { + "expression": { + "id": 7707, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7702, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7700, + "src": "29768:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int72", + "typeString": "int72" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7705, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7697, + "src": "29787:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7704, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "29781:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int72_$", + "typeString": "type(int72)" + }, + "typeName": { + "id": 7703, + "name": "int72", + "nodeType": "ElementaryTypeName", + "src": "29781:5:20", + "typeDescriptions": {} + } + }, + "id": 7706, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "29781:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int72", + "typeString": "int72" + } + }, + "src": "29768:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int72", + "typeString": "int72" + } + }, + "id": 7708, + "nodeType": "ExpressionStatement", + "src": "29768:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7711, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7709, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7700, + "src": "29807:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int72", + "typeString": "int72" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7710, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7697, + "src": "29821:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "29807:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7718, + "nodeType": "IfStatement", + "src": "29803:97:20", + "trueBody": { + "id": 7717, + "nodeType": "Block", + "src": "29828:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3732", + "id": 7713, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29879:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_72_by_1", + "typeString": "int_const 72" + }, + "value": "72" + }, + { + "id": 7714, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7697, + "src": "29883:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_72_by_1", + "typeString": "int_const 72" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7712, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "29849:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7715, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "29849:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7716, + "nodeType": "RevertStatement", + "src": "29842:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7695, + "nodeType": "StructuredDocumentation", + "src": "29374:307:20", + "text": " @dev Returns the downcasted int72 from int256, reverting on\n overflow (when the input is less than smallest int72 or\n greater than largest int72).\n Counterpart to Solidity's `int72` operator.\n Requirements:\n - input must fit into 72 bits" + }, + "id": 7720, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt72", + "nameLocation": "29695:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7698, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7697, + "mutability": "mutable", + "name": "value", + "nameLocation": "29710:5:20", + "nodeType": "VariableDeclaration", + "scope": 7720, + "src": "29703:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7696, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "29703:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "29702:14:20" + }, + "returnParameters": { + "id": 7701, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7700, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "29746:10:20", + "nodeType": "VariableDeclaration", + "scope": 7720, + "src": "29740:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int72", + "typeString": "int72" + }, + "typeName": { + "id": 7699, + "name": "int72", + "nodeType": "ElementaryTypeName", + "src": "29740:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int72", + "typeString": "int72" + } + }, + "visibility": "internal" + } + ], + "src": "29739:18:20" + }, + "scope": 7969, + "src": "29686:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7745, + "nodeType": "Block", + "src": "30296:148:20", + "statements": [ + { + "expression": { + "id": 7733, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7728, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7726, + "src": "30306:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int64", + "typeString": "int64" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7731, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7723, + "src": "30325:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7730, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "30319:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int64_$", + "typeString": "type(int64)" + }, + "typeName": { + "id": 7729, + "name": "int64", + "nodeType": "ElementaryTypeName", + "src": "30319:5:20", + "typeDescriptions": {} + } + }, + "id": 7732, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "30319:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int64", + "typeString": "int64" + } + }, + "src": "30306:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int64", + "typeString": "int64" + } + }, + "id": 7734, + "nodeType": "ExpressionStatement", + "src": "30306:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7737, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7735, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7726, + "src": "30345:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int64", + "typeString": "int64" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7736, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7723, + "src": "30359:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "30345:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7744, + "nodeType": "IfStatement", + "src": "30341:97:20", + "trueBody": { + "id": 7743, + "nodeType": "Block", + "src": "30366:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3634", + "id": 7739, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30417:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + { + "id": 7740, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7723, + "src": "30421:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7738, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "30387:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7741, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "30387:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7742, + "nodeType": "RevertStatement", + "src": "30380:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7721, + "nodeType": "StructuredDocumentation", + "src": "29912:307:20", + "text": " @dev Returns the downcasted int64 from int256, reverting on\n overflow (when the input is less than smallest int64 or\n greater than largest int64).\n Counterpart to Solidity's `int64` operator.\n Requirements:\n - input must fit into 64 bits" + }, + "id": 7746, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt64", + "nameLocation": "30233:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7724, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7723, + "mutability": "mutable", + "name": "value", + "nameLocation": "30248:5:20", + "nodeType": "VariableDeclaration", + "scope": 7746, + "src": "30241:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7722, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "30241:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "30240:14:20" + }, + "returnParameters": { + "id": 7727, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7726, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "30284:10:20", + "nodeType": "VariableDeclaration", + "scope": 7746, + "src": "30278:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int64", + "typeString": "int64" + }, + "typeName": { + "id": 7725, + "name": "int64", + "nodeType": "ElementaryTypeName", + "src": "30278:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int64", + "typeString": "int64" + } + }, + "visibility": "internal" + } + ], + "src": "30277:18:20" + }, + "scope": 7969, + "src": "30224:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7771, + "nodeType": "Block", + "src": "30834:148:20", + "statements": [ + { + "expression": { + "id": 7759, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7754, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7752, + "src": "30844:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int56", + "typeString": "int56" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7757, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7749, + "src": "30863:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7756, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "30857:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int56_$", + "typeString": "type(int56)" + }, + "typeName": { + "id": 7755, + "name": "int56", + "nodeType": "ElementaryTypeName", + "src": "30857:5:20", + "typeDescriptions": {} + } + }, + "id": 7758, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "30857:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int56", + "typeString": "int56" + } + }, + "src": "30844:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int56", + "typeString": "int56" + } + }, + "id": 7760, + "nodeType": "ExpressionStatement", + "src": "30844:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7763, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7761, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7752, + "src": "30883:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int56", + "typeString": "int56" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7762, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7749, + "src": "30897:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "30883:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7770, + "nodeType": "IfStatement", + "src": "30879:97:20", + "trueBody": { + "id": 7769, + "nodeType": "Block", + "src": "30904:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3536", + "id": 7765, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30955:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_56_by_1", + "typeString": "int_const 56" + }, + "value": "56" + }, + { + "id": 7766, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7749, + "src": "30959:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_56_by_1", + "typeString": "int_const 56" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7764, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "30925:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7767, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "30925:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7768, + "nodeType": "RevertStatement", + "src": "30918:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7747, + "nodeType": "StructuredDocumentation", + "src": "30450:307:20", + "text": " @dev Returns the downcasted int56 from int256, reverting on\n overflow (when the input is less than smallest int56 or\n greater than largest int56).\n Counterpart to Solidity's `int56` operator.\n Requirements:\n - input must fit into 56 bits" + }, + "id": 7772, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt56", + "nameLocation": "30771:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7750, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7749, + "mutability": "mutable", + "name": "value", + "nameLocation": "30786:5:20", + "nodeType": "VariableDeclaration", + "scope": 7772, + "src": "30779:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7748, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "30779:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "30778:14:20" + }, + "returnParameters": { + "id": 7753, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7752, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "30822:10:20", + "nodeType": "VariableDeclaration", + "scope": 7772, + "src": "30816:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int56", + "typeString": "int56" + }, + "typeName": { + "id": 7751, + "name": "int56", + "nodeType": "ElementaryTypeName", + "src": "30816:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int56", + "typeString": "int56" + } + }, + "visibility": "internal" + } + ], + "src": "30815:18:20" + }, + "scope": 7969, + "src": "30762:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7797, + "nodeType": "Block", + "src": "31372:148:20", + "statements": [ + { + "expression": { + "id": 7785, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7780, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7778, + "src": "31382:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int48", + "typeString": "int48" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7783, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7775, + "src": "31401:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7782, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "31395:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int48_$", + "typeString": "type(int48)" + }, + "typeName": { + "id": 7781, + "name": "int48", + "nodeType": "ElementaryTypeName", + "src": "31395:5:20", + "typeDescriptions": {} + } + }, + "id": 7784, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "31395:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int48", + "typeString": "int48" + } + }, + "src": "31382:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int48", + "typeString": "int48" + } + }, + "id": 7786, + "nodeType": "ExpressionStatement", + "src": "31382:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7789, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7787, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7778, + "src": "31421:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int48", + "typeString": "int48" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7788, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7775, + "src": "31435:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "31421:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7796, + "nodeType": "IfStatement", + "src": "31417:97:20", + "trueBody": { + "id": 7795, + "nodeType": "Block", + "src": "31442:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3438", + "id": 7791, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31493:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_48_by_1", + "typeString": "int_const 48" + }, + "value": "48" + }, + { + "id": 7792, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7775, + "src": "31497:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_48_by_1", + "typeString": "int_const 48" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7790, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "31463:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7793, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "31463:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7794, + "nodeType": "RevertStatement", + "src": "31456:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7773, + "nodeType": "StructuredDocumentation", + "src": "30988:307:20", + "text": " @dev Returns the downcasted int48 from int256, reverting on\n overflow (when the input is less than smallest int48 or\n greater than largest int48).\n Counterpart to Solidity's `int48` operator.\n Requirements:\n - input must fit into 48 bits" + }, + "id": 7798, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt48", + "nameLocation": "31309:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7776, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7775, + "mutability": "mutable", + "name": "value", + "nameLocation": "31324:5:20", + "nodeType": "VariableDeclaration", + "scope": 7798, + "src": "31317:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7774, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "31317:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "31316:14:20" + }, + "returnParameters": { + "id": 7779, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7778, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "31360:10:20", + "nodeType": "VariableDeclaration", + "scope": 7798, + "src": "31354:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int48", + "typeString": "int48" + }, + "typeName": { + "id": 7777, + "name": "int48", + "nodeType": "ElementaryTypeName", + "src": "31354:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int48", + "typeString": "int48" + } + }, + "visibility": "internal" + } + ], + "src": "31353:18:20" + }, + "scope": 7969, + "src": "31300:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7823, + "nodeType": "Block", + "src": "31910:148:20", + "statements": [ + { + "expression": { + "id": 7811, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7806, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7804, + "src": "31920:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int40", + "typeString": "int40" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7809, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7801, + "src": "31939:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7808, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "31933:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int40_$", + "typeString": "type(int40)" + }, + "typeName": { + "id": 7807, + "name": "int40", + "nodeType": "ElementaryTypeName", + "src": "31933:5:20", + "typeDescriptions": {} + } + }, + "id": 7810, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "31933:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int40", + "typeString": "int40" + } + }, + "src": "31920:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int40", + "typeString": "int40" + } + }, + "id": 7812, + "nodeType": "ExpressionStatement", + "src": "31920:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7815, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7813, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7804, + "src": "31959:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int40", + "typeString": "int40" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7814, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7801, + "src": "31973:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "31959:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7822, + "nodeType": "IfStatement", + "src": "31955:97:20", + "trueBody": { + "id": 7821, + "nodeType": "Block", + "src": "31980:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3430", + "id": 7817, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "32031:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_40_by_1", + "typeString": "int_const 40" + }, + "value": "40" + }, + { + "id": 7818, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7801, + "src": "32035:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_40_by_1", + "typeString": "int_const 40" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7816, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "32001:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7819, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "32001:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7820, + "nodeType": "RevertStatement", + "src": "31994:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7799, + "nodeType": "StructuredDocumentation", + "src": "31526:307:20", + "text": " @dev Returns the downcasted int40 from int256, reverting on\n overflow (when the input is less than smallest int40 or\n greater than largest int40).\n Counterpart to Solidity's `int40` operator.\n Requirements:\n - input must fit into 40 bits" + }, + "id": 7824, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt40", + "nameLocation": "31847:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7802, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7801, + "mutability": "mutable", + "name": "value", + "nameLocation": "31862:5:20", + "nodeType": "VariableDeclaration", + "scope": 7824, + "src": "31855:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7800, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "31855:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "31854:14:20" + }, + "returnParameters": { + "id": 7805, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7804, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "31898:10:20", + "nodeType": "VariableDeclaration", + "scope": 7824, + "src": "31892:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int40", + "typeString": "int40" + }, + "typeName": { + "id": 7803, + "name": "int40", + "nodeType": "ElementaryTypeName", + "src": "31892:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int40", + "typeString": "int40" + } + }, + "visibility": "internal" + } + ], + "src": "31891:18:20" + }, + "scope": 7969, + "src": "31838:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7849, + "nodeType": "Block", + "src": "32448:148:20", + "statements": [ + { + "expression": { + "id": 7837, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7832, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7830, + "src": "32458:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int32", + "typeString": "int32" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7835, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7827, + "src": "32477:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7834, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "32471:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int32_$", + "typeString": "type(int32)" + }, + "typeName": { + "id": 7833, + "name": "int32", + "nodeType": "ElementaryTypeName", + "src": "32471:5:20", + "typeDescriptions": {} + } + }, + "id": 7836, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "32471:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int32", + "typeString": "int32" + } + }, + "src": "32458:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int32", + "typeString": "int32" + } + }, + "id": 7838, + "nodeType": "ExpressionStatement", + "src": "32458:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7841, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7839, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7830, + "src": "32497:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int32", + "typeString": "int32" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7840, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7827, + "src": "32511:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "32497:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7848, + "nodeType": "IfStatement", + "src": "32493:97:20", + "trueBody": { + "id": 7847, + "nodeType": "Block", + "src": "32518:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3332", + "id": 7843, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "32569:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + { + "id": 7844, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7827, + "src": "32573:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7842, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "32539:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7845, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "32539:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7846, + "nodeType": "RevertStatement", + "src": "32532:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7825, + "nodeType": "StructuredDocumentation", + "src": "32064:307:20", + "text": " @dev Returns the downcasted int32 from int256, reverting on\n overflow (when the input is less than smallest int32 or\n greater than largest int32).\n Counterpart to Solidity's `int32` operator.\n Requirements:\n - input must fit into 32 bits" + }, + "id": 7850, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt32", + "nameLocation": "32385:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7828, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7827, + "mutability": "mutable", + "name": "value", + "nameLocation": "32400:5:20", + "nodeType": "VariableDeclaration", + "scope": 7850, + "src": "32393:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7826, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "32393:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "32392:14:20" + }, + "returnParameters": { + "id": 7831, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7830, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "32436:10:20", + "nodeType": "VariableDeclaration", + "scope": 7850, + "src": "32430:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int32", + "typeString": "int32" + }, + "typeName": { + "id": 7829, + "name": "int32", + "nodeType": "ElementaryTypeName", + "src": "32430:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int32", + "typeString": "int32" + } + }, + "visibility": "internal" + } + ], + "src": "32429:18:20" + }, + "scope": 7969, + "src": "32376:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7875, + "nodeType": "Block", + "src": "32986:148:20", + "statements": [ + { + "expression": { + "id": 7863, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7858, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7856, + "src": "32996:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int24", + "typeString": "int24" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7861, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7853, + "src": "33015:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7860, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "33009:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int24_$", + "typeString": "type(int24)" + }, + "typeName": { + "id": 7859, + "name": "int24", + "nodeType": "ElementaryTypeName", + "src": "33009:5:20", + "typeDescriptions": {} + } + }, + "id": 7862, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "33009:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int24", + "typeString": "int24" + } + }, + "src": "32996:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int24", + "typeString": "int24" + } + }, + "id": 7864, + "nodeType": "ExpressionStatement", + "src": "32996:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7867, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7865, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7856, + "src": "33035:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int24", + "typeString": "int24" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7866, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7853, + "src": "33049:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "33035:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7874, + "nodeType": "IfStatement", + "src": "33031:97:20", + "trueBody": { + "id": 7873, + "nodeType": "Block", + "src": "33056:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3234", + "id": 7869, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "33107:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_24_by_1", + "typeString": "int_const 24" + }, + "value": "24" + }, + { + "id": 7870, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7853, + "src": "33111:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_24_by_1", + "typeString": "int_const 24" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7868, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "33077:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7871, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "33077:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7872, + "nodeType": "RevertStatement", + "src": "33070:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7851, + "nodeType": "StructuredDocumentation", + "src": "32602:307:20", + "text": " @dev Returns the downcasted int24 from int256, reverting on\n overflow (when the input is less than smallest int24 or\n greater than largest int24).\n Counterpart to Solidity's `int24` operator.\n Requirements:\n - input must fit into 24 bits" + }, + "id": 7876, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt24", + "nameLocation": "32923:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7854, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7853, + "mutability": "mutable", + "name": "value", + "nameLocation": "32938:5:20", + "nodeType": "VariableDeclaration", + "scope": 7876, + "src": "32931:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7852, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "32931:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "32930:14:20" + }, + "returnParameters": { + "id": 7857, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7856, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "32974:10:20", + "nodeType": "VariableDeclaration", + "scope": 7876, + "src": "32968:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int24", + "typeString": "int24" + }, + "typeName": { + "id": 7855, + "name": "int24", + "nodeType": "ElementaryTypeName", + "src": "32968:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int24", + "typeString": "int24" + } + }, + "visibility": "internal" + } + ], + "src": "32967:18:20" + }, + "scope": 7969, + "src": "32914:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7901, + "nodeType": "Block", + "src": "33524:148:20", + "statements": [ + { + "expression": { + "id": 7889, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7884, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7882, + "src": "33534:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int16", + "typeString": "int16" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7887, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7879, + "src": "33553:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7886, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "33547:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int16_$", + "typeString": "type(int16)" + }, + "typeName": { + "id": 7885, + "name": "int16", + "nodeType": "ElementaryTypeName", + "src": "33547:5:20", + "typeDescriptions": {} + } + }, + "id": 7888, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "33547:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int16", + "typeString": "int16" + } + }, + "src": "33534:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int16", + "typeString": "int16" + } + }, + "id": 7890, + "nodeType": "ExpressionStatement", + "src": "33534:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7893, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7891, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7882, + "src": "33573:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int16", + "typeString": "int16" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7892, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7879, + "src": "33587:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "33573:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7900, + "nodeType": "IfStatement", + "src": "33569:97:20", + "trueBody": { + "id": 7899, + "nodeType": "Block", + "src": "33594:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3136", + "id": 7895, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "33645:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + { + "id": 7896, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7879, + "src": "33649:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7894, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "33615:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7897, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "33615:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7898, + "nodeType": "RevertStatement", + "src": "33608:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7877, + "nodeType": "StructuredDocumentation", + "src": "33140:307:20", + "text": " @dev Returns the downcasted int16 from int256, reverting on\n overflow (when the input is less than smallest int16 or\n greater than largest int16).\n Counterpart to Solidity's `int16` operator.\n Requirements:\n - input must fit into 16 bits" + }, + "id": 7902, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt16", + "nameLocation": "33461:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7880, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7879, + "mutability": "mutable", + "name": "value", + "nameLocation": "33476:5:20", + "nodeType": "VariableDeclaration", + "scope": 7902, + "src": "33469:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7878, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "33469:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "33468:14:20" + }, + "returnParameters": { + "id": 7883, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7882, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "33512:10:20", + "nodeType": "VariableDeclaration", + "scope": 7902, + "src": "33506:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int16", + "typeString": "int16" + }, + "typeName": { + "id": 7881, + "name": "int16", + "nodeType": "ElementaryTypeName", + "src": "33506:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int16", + "typeString": "int16" + } + }, + "visibility": "internal" + } + ], + "src": "33505:18:20" + }, + "scope": 7969, + "src": "33452:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7927, + "nodeType": "Block", + "src": "34055:146:20", + "statements": [ + { + "expression": { + "id": 7915, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7910, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7908, + "src": "34065:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int8", + "typeString": "int8" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7913, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7905, + "src": "34083:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7912, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "34078:4:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int8_$", + "typeString": "type(int8)" + }, + "typeName": { + "id": 7911, + "name": "int8", + "nodeType": "ElementaryTypeName", + "src": "34078:4:20", + "typeDescriptions": {} + } + }, + "id": 7914, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "34078:11:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int8", + "typeString": "int8" + } + }, + "src": "34065:24:20", + "typeDescriptions": { + "typeIdentifier": "t_int8", + "typeString": "int8" + } + }, + "id": 7916, + "nodeType": "ExpressionStatement", + "src": "34065:24:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7919, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7917, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7908, + "src": "34103:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int8", + "typeString": "int8" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7918, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7905, + "src": "34117:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "34103:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7926, + "nodeType": "IfStatement", + "src": "34099:96:20", + "trueBody": { + "id": 7925, + "nodeType": "Block", + "src": "34124:71:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "38", + "id": 7921, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "34175:1:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + { + "id": 7922, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7905, + "src": "34178:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7920, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "34145:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7923, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "34145:39:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7924, + "nodeType": "RevertStatement", + "src": "34138:46:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7903, + "nodeType": "StructuredDocumentation", + "src": "33678:302:20", + "text": " @dev Returns the downcasted int8 from int256, reverting on\n overflow (when the input is less than smallest int8 or\n greater than largest int8).\n Counterpart to Solidity's `int8` operator.\n Requirements:\n - input must fit into 8 bits" + }, + "id": 7928, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt8", + "nameLocation": "33994:6:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7906, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7905, + "mutability": "mutable", + "name": "value", + "nameLocation": "34008:5:20", + "nodeType": "VariableDeclaration", + "scope": 7928, + "src": "34001:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7904, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "34001:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "34000:14:20" + }, + "returnParameters": { + "id": 7909, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7908, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "34043:10:20", + "nodeType": "VariableDeclaration", + "scope": 7928, + "src": "34038:15:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int8", + "typeString": "int8" + }, + "typeName": { + "id": 7907, + "name": "int8", + "nodeType": "ElementaryTypeName", + "src": "34038:4:20", + "typeDescriptions": { + "typeIdentifier": "t_int8", + "typeString": "int8" + } + }, + "visibility": "internal" + } + ], + "src": "34037:17:20" + }, + "scope": 7969, + "src": "33985:216:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7957, + "nodeType": "Block", + "src": "34441:250:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 7945, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7936, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7931, + "src": "34554:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "arguments": [ + { + "expression": { + "arguments": [ + { + "id": 7941, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "34575:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + }, + "typeName": { + "id": 7940, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "34575:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + } + ], + "id": 7939, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "34570:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 7942, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "34570:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_int256", + "typeString": "type(int256)" + } + }, + "id": 7943, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "34583:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "34570:16:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7938, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "34562:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 7937, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "34562:7:20", + "typeDescriptions": {} + } + }, + "id": 7944, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "34562:25:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "34554:33:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7951, + "nodeType": "IfStatement", + "src": "34550:105:20", + "trueBody": { + "id": 7950, + "nodeType": "Block", + "src": "34589:66:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "id": 7947, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7931, + "src": "34638:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7946, + "name": "SafeCastOverflowedUintToInt", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6231, + "src": "34610:27:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint256) pure returns (error)" + } + }, + "id": 7948, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "34610:34:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7949, + "nodeType": "RevertStatement", + "src": "34603:41:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 7954, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7931, + "src": "34678:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7953, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "34671:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + }, + "typeName": { + "id": 7952, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "34671:6:20", + "typeDescriptions": {} + } + }, + "id": 7955, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "34671:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "functionReturnParameters": 7935, + "id": 7956, + "nodeType": "Return", + "src": "34664:20:20" + } + ] + }, + "documentation": { + "id": 7929, + "nodeType": "StructuredDocumentation", + "src": "34207:165:20", + "text": " @dev Converts an unsigned uint256 into a signed int256.\n Requirements:\n - input must be less than or equal to maxInt256." + }, + "id": 7958, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt256", + "nameLocation": "34386:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7932, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7931, + "mutability": "mutable", + "name": "value", + "nameLocation": "34403:5:20", + "nodeType": "VariableDeclaration", + "scope": 7958, + "src": "34395:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 7930, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "34395:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "34394:15:20" + }, + "returnParameters": { + "id": 7935, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7934, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 7958, + "src": "34433:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7933, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "34433:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "34432:8:20" + }, + "scope": 7969, + "src": "34377:314:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7967, + "nodeType": "Block", + "src": "34850:87:20", + "statements": [ + { + "AST": { + "nativeSrc": "34885:46:20", + "nodeType": "YulBlock", + "src": "34885:46:20", + "statements": [ + { + "nativeSrc": "34899:22:20", + "nodeType": "YulAssignment", + "src": "34899:22:20", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "b", + "nativeSrc": "34918:1:20", + "nodeType": "YulIdentifier", + "src": "34918:1:20" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "34911:6:20", + "nodeType": "YulIdentifier", + "src": "34911:6:20" + }, + "nativeSrc": "34911:9:20", + "nodeType": "YulFunctionCall", + "src": "34911:9:20" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "34904:6:20", + "nodeType": "YulIdentifier", + "src": "34904:6:20" + }, + "nativeSrc": "34904:17:20", + "nodeType": "YulFunctionCall", + "src": "34904:17:20" + }, + "variableNames": [ + { + "name": "u", + "nativeSrc": "34899:1:20", + "nodeType": "YulIdentifier", + "src": "34899:1:20" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 7961, + "isOffset": false, + "isSlot": false, + "src": "34918:1:20", + "valueSize": 1 + }, + { + "declaration": 7964, + "isOffset": false, + "isSlot": false, + "src": "34899:1:20", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 7966, + "nodeType": "InlineAssembly", + "src": "34860:71:20" + } + ] + }, + "documentation": { + "id": 7959, + "nodeType": "StructuredDocumentation", + "src": "34697:90:20", + "text": " @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump." + }, + "id": 7968, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint", + "nameLocation": "34801:6:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7962, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7961, + "mutability": "mutable", + "name": "b", + "nameLocation": "34813:1:20", + "nodeType": "VariableDeclaration", + "scope": 7968, + "src": "34808:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 7960, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "34808:4:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "34807:8:20" + }, + "returnParameters": { + "id": 7965, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7964, + "mutability": "mutable", + "name": "u", + "nameLocation": "34847:1:20", + "nodeType": "VariableDeclaration", + "scope": 7968, + "src": "34839:9:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 7963, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "34839:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "34838:11:20" + }, + "scope": 7969, + "src": "34792:145:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + } + ], + "scope": 7970, + "src": "769:34170:20", + "usedErrors": [ + 6214, + 6219, + 6226, + 6231 + ], + "usedEvents": [] + } + ], + "src": "192:34748:20" + }, + "id": 20 + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/math/SignedMath.sol", + "exportedSymbols": { + "SafeCast": [ + 7969 + ], + "SignedMath": [ + 8113 + ] + }, + "id": 8114, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 7971, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "109:24:21" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/math/SafeCast.sol", + "file": "./SafeCast.sol", + "id": 7973, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 8114, + "sourceUnit": 7970, + "src": "135:40:21", + "symbolAliases": [ + { + "foreign": { + "id": 7972, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "143:8:21", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "SignedMath", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 7974, + "nodeType": "StructuredDocumentation", + "src": "177:80:21", + "text": " @dev Standard signed math utilities missing in the Solidity language." + }, + "fullyImplemented": true, + "id": 8113, + "linearizedBaseContracts": [ + 8113 + ], + "name": "SignedMath", + "nameLocation": "266:10:21", + "nodeType": "ContractDefinition", + "nodes": [ + { + "body": { + "id": 8003, + "nodeType": "Block", + "src": "746:215:21", + "statements": [ + { + "id": 8002, + "nodeType": "UncheckedBlock", + "src": "756:199:21", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8000, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7986, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7981, + "src": "894:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "^", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7998, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7989, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7987, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7979, + "src": "900:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "^", + "rightExpression": { + "id": 7988, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7981, + "src": "904:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "900:5:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 7990, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "899:7:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "arguments": [ + { + "arguments": [ + { + "id": 7995, + "name": "condition", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7977, + "src": "932:9:21", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 7993, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "916:8:21", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 7994, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "925:6:21", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "916:15:21", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 7996, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "916:26:21", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7992, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "909:6:21", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + }, + "typeName": { + "id": 7991, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "909:6:21", + "typeDescriptions": {} + } + }, + "id": 7997, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "909:34:21", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "899:44:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 7999, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "898:46:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "894:50:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "functionReturnParameters": 7985, + "id": 8001, + "nodeType": "Return", + "src": "887:57:21" + } + ] + } + ] + }, + "documentation": { + "id": 7975, + "nodeType": "StructuredDocumentation", + "src": "283:374:21", + "text": " @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant.\n IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.\n However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute\n one branch when needed, making this function more expensive." + }, + "id": 8004, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ternary", + "nameLocation": "671:7:21", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7982, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7977, + "mutability": "mutable", + "name": "condition", + "nameLocation": "684:9:21", + "nodeType": "VariableDeclaration", + "scope": 8004, + "src": "679:14:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 7976, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "679:4:21", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 7979, + "mutability": "mutable", + "name": "a", + "nameLocation": "702:1:21", + "nodeType": "VariableDeclaration", + "scope": 8004, + "src": "695:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7978, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "695:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 7981, + "mutability": "mutable", + "name": "b", + "nameLocation": "712:1:21", + "nodeType": "VariableDeclaration", + "scope": 8004, + "src": "705:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7980, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "705:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "678:36:21" + }, + "returnParameters": { + "id": 7985, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7984, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 8004, + "src": "738:6:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7983, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "738:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "737:8:21" + }, + "scope": 8113, + "src": "662:299:21", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 8022, + "nodeType": "Block", + "src": "1102:44:21", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8017, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8015, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8007, + "src": "1127:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "id": 8016, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8009, + "src": "1131:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "1127:5:21", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "id": 8018, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8007, + "src": "1134:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + { + "id": 8019, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8009, + "src": "1137:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 8014, + "name": "ternary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8004, + "src": "1119:7:21", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$_t_int256_$_t_int256_$returns$_t_int256_$", + "typeString": "function (bool,int256,int256) pure returns (int256)" + } + }, + "id": 8020, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1119:20:21", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "functionReturnParameters": 8013, + "id": 8021, + "nodeType": "Return", + "src": "1112:27:21" + } + ] + }, + "documentation": { + "id": 8005, + "nodeType": "StructuredDocumentation", + "src": "967:66:21", + "text": " @dev Returns the largest of two signed numbers." + }, + "id": 8023, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "max", + "nameLocation": "1047:3:21", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8010, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8007, + "mutability": "mutable", + "name": "a", + "nameLocation": "1058:1:21", + "nodeType": "VariableDeclaration", + "scope": 8023, + "src": "1051:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8006, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1051:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8009, + "mutability": "mutable", + "name": "b", + "nameLocation": "1068:1:21", + "nodeType": "VariableDeclaration", + "scope": 8023, + "src": "1061:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8008, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1061:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "1050:20:21" + }, + "returnParameters": { + "id": 8013, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8012, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 8023, + "src": "1094:6:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8011, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1094:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "1093:8:21" + }, + "scope": 8113, + "src": "1038:108:21", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 8041, + "nodeType": "Block", + "src": "1288:44:21", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8036, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8034, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8026, + "src": "1313:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 8035, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8028, + "src": "1317:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "1313:5:21", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "id": 8037, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8026, + "src": "1320:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + { + "id": 8038, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8028, + "src": "1323:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 8033, + "name": "ternary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8004, + "src": "1305:7:21", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$_t_int256_$_t_int256_$returns$_t_int256_$", + "typeString": "function (bool,int256,int256) pure returns (int256)" + } + }, + "id": 8039, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1305:20:21", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "functionReturnParameters": 8032, + "id": 8040, + "nodeType": "Return", + "src": "1298:27:21" + } + ] + }, + "documentation": { + "id": 8024, + "nodeType": "StructuredDocumentation", + "src": "1152:67:21", + "text": " @dev Returns the smallest of two signed numbers." + }, + "id": 8042, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "min", + "nameLocation": "1233:3:21", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8029, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8026, + "mutability": "mutable", + "name": "a", + "nameLocation": "1244:1:21", + "nodeType": "VariableDeclaration", + "scope": 8042, + "src": "1237:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8025, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1237:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8028, + "mutability": "mutable", + "name": "b", + "nameLocation": "1254:1:21", + "nodeType": "VariableDeclaration", + "scope": 8042, + "src": "1247:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8027, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1247:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "1236:20:21" + }, + "returnParameters": { + "id": 8032, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8031, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 8042, + "src": "1280:6:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8030, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1280:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "1279:8:21" + }, + "scope": 8113, + "src": "1224:108:21", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 8085, + "nodeType": "Block", + "src": "1537:162:21", + "statements": [ + { + "assignments": [ + 8053 + ], + "declarations": [ + { + "constant": false, + "id": 8053, + "mutability": "mutable", + "name": "x", + "nameLocation": "1606:1:21", + "nodeType": "VariableDeclaration", + "scope": 8085, + "src": "1599:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8052, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1599:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "id": 8066, + "initialValue": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8065, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8056, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8054, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8045, + "src": "1611:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "id": 8055, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8047, + "src": "1615:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "1611:5:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 8057, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1610:7:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8063, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8060, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8058, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8045, + "src": "1622:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "^", + "rightExpression": { + "id": 8059, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8047, + "src": "1626:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "1622:5:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 8061, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1621:7:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "31", + "id": 8062, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1632:1:21", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "1621:12:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 8064, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1620:14:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "1610:24:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1599:35:21" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8083, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8067, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8053, + "src": "1651:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8081, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 8075, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 8072, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8053, + "src": "1671:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 8071, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1663:7:21", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 8070, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1663:7:21", + "typeDescriptions": {} + } + }, + "id": 8073, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1663:10:21", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "323535", + "id": 8074, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1677:3:21", + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "255" + }, + "src": "1663:17:21", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 8069, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1656:6:21", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + }, + "typeName": { + "id": 8068, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1656:6:21", + "typeDescriptions": {} + } + }, + "id": 8076, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1656:25:21", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8079, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8077, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8045, + "src": "1685:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "^", + "rightExpression": { + "id": 8078, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8047, + "src": "1689:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "1685:5:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 8080, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1684:7:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "1656:35:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 8082, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1655:37:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "1651:41:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "functionReturnParameters": 8051, + "id": 8084, + "nodeType": "Return", + "src": "1644:48:21" + } + ] + }, + "documentation": { + "id": 8043, + "nodeType": "StructuredDocumentation", + "src": "1338:126:21", + "text": " @dev Returns the average of two signed numbers without overflow.\n The result is rounded towards zero." + }, + "id": 8086, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "average", + "nameLocation": "1478:7:21", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8048, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8045, + "mutability": "mutable", + "name": "a", + "nameLocation": "1493:1:21", + "nodeType": "VariableDeclaration", + "scope": 8086, + "src": "1486:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8044, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1486:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8047, + "mutability": "mutable", + "name": "b", + "nameLocation": "1503:1:21", + "nodeType": "VariableDeclaration", + "scope": 8086, + "src": "1496:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8046, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1496:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "1485:20:21" + }, + "returnParameters": { + "id": 8051, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8050, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 8086, + "src": "1529:6:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8049, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1529:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "1528:8:21" + }, + "scope": 8113, + "src": "1469:230:21", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 8111, + "nodeType": "Block", + "src": "1843:767:21", + "statements": [ + { + "id": 8110, + "nodeType": "UncheckedBlock", + "src": "1853:751:21", + "statements": [ + { + "assignments": [ + 8095 + ], + "declarations": [ + { + "constant": false, + "id": 8095, + "mutability": "mutable", + "name": "mask", + "nameLocation": "2424:4:21", + "nodeType": "VariableDeclaration", + "scope": 8110, + "src": "2417:11:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8094, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "2417:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "id": 8099, + "initialValue": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8098, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8096, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8089, + "src": "2431:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "323535", + "id": 8097, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2436:3:21", + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "255" + }, + "src": "2431:8:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2417:22:21" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8107, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8104, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8102, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8089, + "src": "2576:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "id": 8103, + "name": "mask", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8095, + "src": "2580:4:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "2576:8:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 8105, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "2575:10:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "^", + "rightExpression": { + "id": 8106, + "name": "mask", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8095, + "src": "2588:4:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "2575:17:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 8101, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2567:7:21", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 8100, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2567:7:21", + "typeDescriptions": {} + } + }, + "id": 8108, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2567:26:21", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 8093, + "id": 8109, + "nodeType": "Return", + "src": "2560:33:21" + } + ] + } + ] + }, + "documentation": { + "id": 8087, + "nodeType": "StructuredDocumentation", + "src": "1705:78:21", + "text": " @dev Returns the absolute unsigned value of a signed value." + }, + "id": 8112, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "abs", + "nameLocation": "1797:3:21", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8090, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8089, + "mutability": "mutable", + "name": "n", + "nameLocation": "1808:1:21", + "nodeType": "VariableDeclaration", + "scope": 8112, + "src": "1801:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8088, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1801:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "1800:10:21" + }, + "returnParameters": { + "id": 8093, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8092, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 8112, + "src": "1834:7:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8091, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1834:7:21", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1833:9:21" + }, + "scope": 8113, + "src": "1788:822:21", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + } + ], + "scope": 8114, + "src": "258:2354:21", + "usedErrors": [], + "usedEvents": [] + } + ], + "src": "109:2504:21" + }, + "id": 21 + }, + "contracts/TokenRelayer.sol": { + "ast": { + "absolutePath": "contracts/TokenRelayer.sol", + "exportedSymbols": { + "ECDSA": [ + 4137 + ], + "EIP712": [ + 4364 + ], + "IERC20": [ + 340 + ], + "IERC20Permit": [ + 376 + ], + "Ownable": [ + 147 + ], + "ReentrancyGuard": [ + 1827 + ], + "SafeERC20": [ + 831 + ], + "TokenRelayer": [ + 8603 + ] + }, + "id": 8604, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 8115, + "literals": [ + "solidity", + "^", + "0.8", + ".28" + ], + "nodeType": "PragmaDirective", + "src": "32:24:22" + }, + { + "absolutePath": "@openzeppelin/contracts/access/Ownable.sol", + "file": "@openzeppelin/contracts/access/Ownable.sol", + "id": 8117, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 8604, + "sourceUnit": 148, + "src": "58:67:22", + "symbolAliases": [ + { + "foreign": { + "id": 8116, + "name": "Ownable", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 147, + "src": "66:7:22", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/token/ERC20/IERC20.sol", + "file": "@openzeppelin/contracts/token/ERC20/IERC20.sol", + "id": 8119, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 8604, + "sourceUnit": 341, + "src": "126:70:22", + "symbolAliases": [ + { + "foreign": { + "id": 8118, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "134:6:22", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol", + "file": "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol", + "id": 8121, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 8604, + "sourceUnit": 377, + "src": "197:93:22", + "symbolAliases": [ + { + "foreign": { + "id": 8120, + "name": "IERC20Permit", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 376, + "src": "205:12:22", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol", + "file": "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol", + "id": 8123, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 8604, + "sourceUnit": 832, + "src": "291:82:22", + "symbolAliases": [ + { + "foreign": { + "id": 8122, + "name": "SafeERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "299:9:22", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/ReentrancyGuard.sol", + "file": "@openzeppelin/contracts/utils/ReentrancyGuard.sol", + "id": 8125, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 8604, + "sourceUnit": 1828, + "src": "374:82:22", + "symbolAliases": [ + { + "foreign": { + "id": 8124, + "name": "ReentrancyGuard", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1827, + "src": "382:15:22", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/cryptography/ECDSA.sol", + "file": "@openzeppelin/contracts/utils/cryptography/ECDSA.sol", + "id": 8127, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 8604, + "sourceUnit": 4138, + "src": "457:75:22", + "symbolAliases": [ + { + "foreign": { + "id": 8126, + "name": "ECDSA", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4137, + "src": "465:5:22", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/cryptography/EIP712.sol", + "file": "@openzeppelin/contracts/utils/cryptography/EIP712.sol", + "id": 8129, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 8604, + "sourceUnit": 4365, + "src": "533:77:22", + "symbolAliases": [ + { + "foreign": { + "id": 8128, + "name": "EIP712", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4364, + "src": "541:6:22", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [ + { + "baseName": { + "id": 8131, + "name": "Ownable", + "nameLocations": [ + "1183:7:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 147, + "src": "1183:7:22" + }, + "id": 8132, + "nodeType": "InheritanceSpecifier", + "src": "1183:7:22" + }, + { + "baseName": { + "id": 8133, + "name": "ReentrancyGuard", + "nameLocations": [ + "1192:15:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1827, + "src": "1192:15:22" + }, + "id": 8134, + "nodeType": "InheritanceSpecifier", + "src": "1192:15:22" + }, + { + "baseName": { + "id": 8135, + "name": "EIP712", + "nameLocations": [ + "1209:6:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4364, + "src": "1209:6:22" + }, + "id": 8136, + "nodeType": "InheritanceSpecifier", + "src": "1209:6:22" + } + ], + "canonicalName": "TokenRelayer", + "contractDependencies": [], + "contractKind": "contract", + "documentation": { + "id": 8130, + "nodeType": "StructuredDocumentation", + "src": "612:545:22", + "text": " @title TokenRelayer\n @notice A relayer contract that accepts ERC20 permit signatures and executes\n arbitrary calls to a destination contract, both authorized via signature.\n \n Flow:\n 1. User signs a permit allowing the relayer to spend their tokens\n 2. User signs a payload (e.g., transfer from relayer to another user)\n 3. Relayer:\n a. Executes permit to approve the tokens\n b. Transfers tokens from user to relayer (via transferFrom)\n c. Forwards the payload call (transfer from relayer to another user)" + }, + "fullyImplemented": true, + "id": 8603, + "linearizedBaseContracts": [ + 8603, + 4364, + 262, + 1827, + 147, + 1662 + ], + "name": "TokenRelayer", + "nameLocation": "1167:12:22", + "nodeType": "ContractDefinition", + "nodes": [ + { + "global": false, + "id": 8140, + "libraryName": { + "id": 8137, + "name": "SafeERC20", + "nameLocations": [ + "1228:9:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 831, + "src": "1228:9:22" + }, + "nodeType": "UsingForDirective", + "src": "1222:27:22", + "typeName": { + "id": 8139, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 8138, + "name": "IERC20", + "nameLocations": [ + "1242:6:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "1242:6:22" + }, + "referencedDeclaration": 340, + "src": "1242:6:22", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + } + }, + { + "constant": true, + "id": 8145, + "mutability": "constant", + "name": "_TYPE_HASH_PAYLOAD", + "nameLocation": "1335:18:22", + "nodeType": "VariableDeclaration", + "scope": 8603, + "src": "1310:202:22", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8141, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1310:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": { + "arguments": [ + { + "hexValue": "5061796c6f616428616464726573732064657374696e6174696f6e2c61646472657373206f776e65722c6164647265737320746f6b656e2c75696e743235362076616c75652c627974657320646174612c75696e743235362065746856616c75652c75696e74323536206e6f6e63652c75696e7432353620646561646c696e6529", + "id": 8143, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1375:131:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_f0543e2024fd0ae16ccb842686c2733758ec65acfd69fb599c05b286f8db8844", + "typeString": "literal_string \"Payload(address destination,address owner,address token,uint256 value,bytes data,uint256 ethValue,uint256 nonce,uint256 deadline)\"" + }, + "value": "Payload(address destination,address owner,address token,uint256 value,bytes data,uint256 ethValue,uint256 nonce,uint256 deadline)" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_f0543e2024fd0ae16ccb842686c2733758ec65acfd69fb599c05b286f8db8844", + "typeString": "literal_string \"Payload(address destination,address owner,address token,uint256 value,bytes data,uint256 ethValue,uint256 nonce,uint256 deadline)\"" + } + ], + "id": 8142, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "1356:9:22", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 8144, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1356:156:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "private" + }, + { + "constant": false, + "functionSelector": "75bd6863", + "id": 8147, + "mutability": "immutable", + "name": "destinationContract", + "nameLocation": "1544:19:22", + "nodeType": "VariableDeclaration", + "scope": 8603, + "src": "1519:44:22", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8146, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1519:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "public" + }, + { + "constant": false, + "functionSelector": "d850124e", + "id": 8153, + "mutability": "mutable", + "name": "usedPayloadNonces", + "nameLocation": "1622:17:22", + "nodeType": "VariableDeclaration", + "scope": 8603, + "src": "1570:69:22", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_uint256_$_t_bool_$_$", + "typeString": "mapping(address => mapping(uint256 => bool))" + }, + "typeName": { + "id": 8152, + "keyName": "", + "keyNameLocation": "-1:-1:-1", + "keyType": { + "id": 8148, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1578:7:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Mapping", + "src": "1570:44:22", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_uint256_$_t_bool_$_$", + "typeString": "mapping(address => mapping(uint256 => bool))" + }, + "valueName": "", + "valueNameLocation": "-1:-1:-1", + "valueType": { + "id": 8151, + "keyName": "", + "keyNameLocation": "-1:-1:-1", + "keyType": { + "id": 8149, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1597:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Mapping", + "src": "1589:24:22", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_bool_$", + "typeString": "mapping(uint256 => bool)" + }, + "valueName": "", + "valueNameLocation": "-1:-1:-1", + "valueType": { + "id": 8150, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "1608:4:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + } + }, + "visibility": "public" + }, + { + "canonicalName": "TokenRelayer.ExecuteParams", + "id": 8182, + "members": [ + { + "constant": false, + "id": 8155, + "mutability": "mutable", + "name": "token", + "nameLocation": "1768:5:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1760:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8154, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1760:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8157, + "mutability": "mutable", + "name": "owner", + "nameLocation": "1791:5:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1783:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8156, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1783:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8159, + "mutability": "mutable", + "name": "value", + "nameLocation": "1814:5:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1806:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8158, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1806:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8161, + "mutability": "mutable", + "name": "deadline", + "nameLocation": "1837:8:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1829:16:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8160, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1829:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8163, + "mutability": "mutable", + "name": "permitV", + "nameLocation": "1861:7:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1855:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 8162, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "1855:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8165, + "mutability": "mutable", + "name": "permitR", + "nameLocation": "1886:7:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1878:15:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8164, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1878:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8167, + "mutability": "mutable", + "name": "permitS", + "nameLocation": "1911:7:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1903:15:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8166, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1903:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8169, + "mutability": "mutable", + "name": "payloadData", + "nameLocation": "1934:11:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1928:17:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 8168, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1928:5:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8171, + "mutability": "mutable", + "name": "payloadValue", + "nameLocation": "1963:12:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1955:20:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8170, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1955:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8173, + "mutability": "mutable", + "name": "payloadNonce", + "nameLocation": "1993:12:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1985:20:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8172, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1985:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8175, + "mutability": "mutable", + "name": "payloadDeadline", + "nameLocation": "2023:15:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "2015:23:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8174, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2015:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8177, + "mutability": "mutable", + "name": "payloadV", + "nameLocation": "2054:8:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "2048:14:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 8176, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "2048:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8179, + "mutability": "mutable", + "name": "payloadR", + "nameLocation": "2080:8:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "2072:16:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8178, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2072:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8181, + "mutability": "mutable", + "name": "payloadS", + "nameLocation": "2106:8:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "2098:16:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8180, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2098:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "name": "ExecuteParams", + "nameLocation": "1736:13:22", + "nodeType": "StructDefinition", + "scope": 8603, + "src": "1729:392:22", + "visibility": "public" + }, + { + "anonymous": false, + "eventSelector": "78129a649632642d8e9f346c85d9efb70d32d50a36774c4585491a9228bbd350", + "id": 8190, + "name": "RelayerExecuted", + "nameLocation": "2133:15:22", + "nodeType": "EventDefinition", + "parameters": { + "id": 8189, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8184, + "indexed": true, + "mutability": "mutable", + "name": "signer", + "nameLocation": "2174:6:22", + "nodeType": "VariableDeclaration", + "scope": 8190, + "src": "2158:22:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8183, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2158:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8186, + "indexed": true, + "mutability": "mutable", + "name": "token", + "nameLocation": "2206:5:22", + "nodeType": "VariableDeclaration", + "scope": 8190, + "src": "2190:21:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8185, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2190:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8188, + "indexed": false, + "mutability": "mutable", + "name": "amount", + "nameLocation": "2229:6:22", + "nodeType": "VariableDeclaration", + "scope": 8190, + "src": "2221:14:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8187, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2221:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2148:93:22" + }, + "src": "2127:115:22" + }, + { + "anonymous": false, + "eventSelector": "a0524ee0fd8662d6c046d199da2a6d3dc49445182cec055873a5bb9c2843c8e0", + "id": 8198, + "name": "TokenWithdrawn", + "nameLocation": "2294:14:22", + "nodeType": "EventDefinition", + "parameters": { + "id": 8197, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8192, + "indexed": true, + "mutability": "mutable", + "name": "token", + "nameLocation": "2325:5:22", + "nodeType": "VariableDeclaration", + "scope": 8198, + "src": "2309:21:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8191, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2309:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8194, + "indexed": false, + "mutability": "mutable", + "name": "amount", + "nameLocation": "2340:6:22", + "nodeType": "VariableDeclaration", + "scope": 8198, + "src": "2332:14:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8193, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2332:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8196, + "indexed": true, + "mutability": "mutable", + "name": "to", + "nameLocation": "2364:2:22", + "nodeType": "VariableDeclaration", + "scope": 8198, + "src": "2348:18:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8195, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2348:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "2308:59:22" + }, + "src": "2288:80:22" + }, + { + "anonymous": false, + "eventSelector": "6148672a948a12b8e0bf92a9338349b9ac890fad62a234abaf0a4da99f62cfcc", + "id": 8204, + "name": "ETHWithdrawn", + "nameLocation": "2379:12:22", + "nodeType": "EventDefinition", + "parameters": { + "id": 8203, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8200, + "indexed": false, + "mutability": "mutable", + "name": "amount", + "nameLocation": "2400:6:22", + "nodeType": "VariableDeclaration", + "scope": 8204, + "src": "2392:14:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8199, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2392:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8202, + "indexed": true, + "mutability": "mutable", + "name": "to", + "nameLocation": "2424:2:22", + "nodeType": "VariableDeclaration", + "scope": 8204, + "src": "2408:18:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8201, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2408:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "2391:36:22" + }, + "src": "2373:55:22" + }, + { + "body": { + "id": 8231, + "nodeType": "Block", + "src": "2614:135:22", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 8223, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8218, + "name": "_destinationContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8206, + "src": "2632:20:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 8221, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2664:1:22", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 8220, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2656:7:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 8219, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2656:7:22", + "typeDescriptions": {} + } + }, + "id": 8222, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2656:10:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "2632:34:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "496e76616c69642064657374696e6174696f6e", + "id": 8224, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2668:21:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_480a3d2cf1e4838d740f40eac57f23eb6facc0baaf1a65a7b61df6a5a00ed368", + "typeString": "literal_string \"Invalid destination\"" + }, + "value": "Invalid destination" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_480a3d2cf1e4838d740f40eac57f23eb6facc0baaf1a65a7b61df6a5a00ed368", + "typeString": "literal_string \"Invalid destination\"" + } + ], + "id": 8217, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "2624:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8225, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2624:66:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8226, + "nodeType": "ExpressionStatement", + "src": "2624:66:22" + }, + { + "expression": { + "id": 8229, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 8227, + "name": "destinationContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8147, + "src": "2700:19:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 8228, + "name": "_destinationContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8206, + "src": "2722:20:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "2700:42:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 8230, + "nodeType": "ExpressionStatement", + "src": "2700:42:22" + } + ] + }, + "id": 8232, + "implemented": true, + "kind": "constructor", + "modifiers": [ + { + "arguments": [ + { + "expression": { + "id": 8209, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -15, + "src": "2562:3:22", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 8210, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2566:6:22", + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "2562:10:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "id": 8211, + "kind": "baseConstructorSpecifier", + "modifierName": { + "id": 8208, + "name": "Ownable", + "nameLocations": [ + "2554:7:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 147, + "src": "2554:7:22" + }, + "nodeType": "ModifierInvocation", + "src": "2554:19:22" + }, + { + "arguments": [ + { + "hexValue": "546f6b656e52656c61796572", + "id": 8213, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2589:14:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_142b4a499251a4eacaab3f10318ce24bd0fa67fa5375e1dfcd0a44e62c5b47a4", + "typeString": "literal_string \"TokenRelayer\"" + }, + "value": "TokenRelayer" + }, + { + "hexValue": "31", + "id": 8214, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2605:3:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_c89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6", + "typeString": "literal_string \"1\"" + }, + "value": "1" + } + ], + "id": 8215, + "kind": "baseConstructorSpecifier", + "modifierName": { + "id": 8212, + "name": "EIP712", + "nameLocations": [ + "2582:6:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4364, + "src": "2582:6:22" + }, + "nodeType": "ModifierInvocation", + "src": "2582:27:22" + } + ], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8207, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8206, + "mutability": "mutable", + "name": "_destinationContract", + "nameLocation": "2524:20:22", + "nodeType": "VariableDeclaration", + "scope": 8232, + "src": "2516:28:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8205, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2516:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "2515:30:22" + }, + "returnParameters": { + "id": 8216, + "nodeType": "ParameterList", + "parameters": [], + "src": "2614:0:22" + }, + "scope": 8603, + "src": "2504:245:22", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 8235, + "nodeType": "Block", + "src": "2852:2:22", + "statements": [] + }, + "id": 8236, + "implemented": true, + "kind": "receive", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8233, + "nodeType": "ParameterList", + "parameters": [], + "src": "2832:2:22" + }, + "returnParameters": { + "id": 8234, + "nodeType": "ParameterList", + "parameters": [], + "src": "2852:0:22" + }, + "scope": 8603, + "src": "2825:29:22", + "stateMutability": "payable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 8401, + "nodeType": "Block", + "src": "3073:1918:22", + "statements": [ + { + "assignments": [ + 8245 + ], + "declarations": [ + { + "constant": false, + "id": 8245, + "mutability": "mutable", + "name": "owner", + "nameLocation": "3091:5:22", + "nodeType": "VariableDeclaration", + "scope": 8401, + "src": "3083:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8244, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3083:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "id": 8248, + "initialValue": { + "expression": { + "id": 8246, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3099:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8247, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3106:5:22", + "memberName": "owner", + "nodeType": "MemberAccess", + "referencedDeclaration": 8157, + "src": "3099:12:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3083:28:22" + }, + { + "assignments": [ + 8250 + ], + "declarations": [ + { + "constant": false, + "id": 8250, + "mutability": "mutable", + "name": "nonce", + "nameLocation": "3129:5:22", + "nodeType": "VariableDeclaration", + "scope": 8401, + "src": "3121:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8249, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3121:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 8253, + "initialValue": { + "expression": { + "id": 8251, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3137:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8252, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3144:12:22", + "memberName": "payloadNonce", + "nodeType": "MemberAccess", + "referencedDeclaration": 8173, + "src": "3137:19:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3121:35:22" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 8260, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8255, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8245, + "src": "3201:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 8258, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3218:1:22", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 8257, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3210:7:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 8256, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3210:7:22", + "typeDescriptions": {} + } + }, + "id": 8259, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3210:10:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "3201:19:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "496e76616c6964206f776e6572", + "id": 8261, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3222:15:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_110461b12e459dc76e692e7a47f9621cf45c7d48020c3c7b2066107cdf1f52ae", + "typeString": "literal_string \"Invalid owner\"" + }, + "value": "Invalid owner" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_110461b12e459dc76e692e7a47f9621cf45c7d48020c3c7b2066107cdf1f52ae", + "typeString": "literal_string \"Invalid owner\"" + } + ], + "id": 8254, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "3193:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8262, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3193:45:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8263, + "nodeType": "ExpressionStatement", + "src": "3193:45:22" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 8271, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 8265, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3256:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8266, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3263:5:22", + "memberName": "token", + "nodeType": "MemberAccess", + "referencedDeclaration": 8155, + "src": "3256:12:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 8269, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3280:1:22", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 8268, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3272:7:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 8267, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3272:7:22", + "typeDescriptions": {} + } + }, + "id": 8270, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3272:10:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "3256:26:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "496e76616c696420746f6b656e", + "id": 8272, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3284:15:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_5e70ebd1d4072d337a7fabaa7bda70fa2633d6e3f89d5cb725a16b10d07e54c6", + "typeString": "literal_string \"Invalid token\"" + }, + "value": "Invalid token" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_5e70ebd1d4072d337a7fabaa7bda70fa2633d6e3f89d5cb725a16b10d07e54c6", + "typeString": "literal_string \"Invalid token\"" + } + ], + "id": 8264, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "3248:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8273, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3248:52:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8274, + "nodeType": "ExpressionStatement", + "src": "3248:52:22" + }, + { + "expression": { + "arguments": [ + { + "id": 8281, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "3318:32:22", + "subExpression": { + "baseExpression": { + "baseExpression": { + "id": 8276, + "name": "usedPayloadNonces", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8153, + "src": "3319:17:22", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_uint256_$_t_bool_$_$", + "typeString": "mapping(address => mapping(uint256 => bool))" + } + }, + "id": 8278, + "indexExpression": { + "id": 8277, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8245, + "src": "3337:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "3319:24:22", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_bool_$", + "typeString": "mapping(uint256 => bool)" + } + }, + "id": 8280, + "indexExpression": { + "id": 8279, + "name": "nonce", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8250, + "src": "3344:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "3319:31:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "4e6f6e63652075736564", + "id": 8282, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3352:12:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_15d72127d094a30af360ead73641c61eda3d745ce4d04d12675a5e9a899f8b21", + "typeString": "literal_string \"Nonce used\"" + }, + "value": "Nonce used" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_15d72127d094a30af360ead73641c61eda3d745ce4d04d12675a5e9a899f8b21", + "typeString": "literal_string \"Nonce used\"" + } + ], + "id": 8275, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "3310:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8283, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3310:55:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8284, + "nodeType": "ExpressionStatement", + "src": "3310:55:22" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 8290, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 8286, + "name": "block", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -4, + "src": "3383:5:22", + "typeDescriptions": { + "typeIdentifier": "t_magic_block", + "typeString": "block" + } + }, + "id": 8287, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3389:9:22", + "memberName": "timestamp", + "nodeType": "MemberAccess", + "src": "3383:15:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<=", + "rightExpression": { + "expression": { + "id": 8288, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3402:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8289, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3409:15:22", + "memberName": "payloadDeadline", + "nodeType": "MemberAccess", + "referencedDeclaration": 8175, + "src": "3402:22:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3383:41:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "5061796c6f61642065787069726564", + "id": 8291, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3426:17:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_27859e47e6c2167c8e8d38addfca16b9afb9d8e9750b6a1e67c29196d4d99fae", + "typeString": "literal_string \"Payload expired\"" + }, + "value": "Payload expired" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_27859e47e6c2167c8e8d38addfca16b9afb9d8e9750b6a1e67c29196d4d99fae", + "typeString": "literal_string \"Payload expired\"" + } + ], + "id": 8285, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "3375:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8292, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3375:69:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8293, + "nodeType": "ExpressionStatement", + "src": "3375:69:22" + }, + { + "assignments": [ + 8295 + ], + "declarations": [ + { + "constant": false, + "id": 8295, + "mutability": "mutable", + "name": "digest", + "nameLocation": "3531:6:22", + "nodeType": "VariableDeclaration", + "scope": 8401, + "src": "3523:14:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8294, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3523:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 8310, + "initialValue": { + "arguments": [ + { + "id": 8297, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8245, + "src": "3568:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 8298, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3587:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8299, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3594:5:22", + "memberName": "token", + "nodeType": "MemberAccess", + "referencedDeclaration": 8155, + "src": "3587:12:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 8300, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3613:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8301, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3620:5:22", + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": 8159, + "src": "3613:12:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 8302, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3639:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8303, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3646:11:22", + "memberName": "payloadData", + "nodeType": "MemberAccess", + "referencedDeclaration": 8169, + "src": "3639:18:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + } + }, + { + "expression": { + "id": 8304, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3671:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8305, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3678:12:22", + "memberName": "payloadValue", + "nodeType": "MemberAccess", + "referencedDeclaration": 8171, + "src": "3671:19:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 8306, + "name": "nonce", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8250, + "src": "3704:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 8307, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3723:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8308, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3730:15:22", + "memberName": "payloadDeadline", + "nodeType": "MemberAccess", + "referencedDeclaration": 8175, + "src": "3723:22:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 8296, + "name": "_computeDigest", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8441, + "src": "3540:14:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_address_$_t_address_$_t_uint256_$_t_bytes_memory_ptr_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (address,address,uint256,bytes memory,uint256,uint256,uint256) view returns (bytes32)" + } + }, + "id": 8309, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3540:215:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3523:232:22" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 8323, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 8314, + "name": "digest", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8295, + "src": "3864:6:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 8315, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3872:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8316, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3879:8:22", + "memberName": "payloadV", + "nodeType": "MemberAccess", + "referencedDeclaration": 8177, + "src": "3872:15:22", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + { + "expression": { + "id": 8317, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3889:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8318, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3896:8:22", + "memberName": "payloadR", + "nodeType": "MemberAccess", + "referencedDeclaration": 8179, + "src": "3889:15:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 8319, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3906:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8320, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3913:8:22", + "memberName": "payloadS", + "nodeType": "MemberAccess", + "referencedDeclaration": 8181, + "src": "3906:15:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "id": 8312, + "name": "ECDSA", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4137, + "src": "3850:5:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_ECDSA_$4137_$", + "typeString": "type(library ECDSA)" + } + }, + "id": 8313, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3856:7:22", + "memberName": "recover", + "nodeType": "MemberAccess", + "referencedDeclaration": 4059, + "src": "3850:13:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_uint8_$_t_bytes32_$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32,uint8,bytes32,bytes32) pure returns (address)" + } + }, + "id": 8321, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3850:72:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 8322, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8245, + "src": "3926:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "3850:81:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "496e76616c696420736967", + "id": 8324, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3933:13:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_31734eed34fab74fa1579246aaad104a344891a284044483c0c5a792a9f83a72", + "typeString": "literal_string \"Invalid sig\"" + }, + "value": "Invalid sig" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_31734eed34fab74fa1579246aaad104a344891a284044483c0c5a792a9f83a72", + "typeString": "literal_string \"Invalid sig\"" + } + ], + "id": 8311, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "3842:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8325, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3842:105:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8326, + "nodeType": "ExpressionStatement", + "src": "3842:105:22" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 8332, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 8328, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -15, + "src": "3966:3:22", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 8329, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3970:5:22", + "memberName": "value", + "nodeType": "MemberAccess", + "src": "3966:9:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "expression": { + "id": 8330, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3979:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8331, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3986:12:22", + "memberName": "payloadValue", + "nodeType": "MemberAccess", + "referencedDeclaration": 8171, + "src": "3979:19:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3966:32:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "496e636f7272656374204554482076616c75652070726f7669646564", + "id": 8333, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4000:30:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_a793dc5bde52ab2d5349f1208a34905b1d68ab9298f549a2e514542cba0a8c76", + "typeString": "literal_string \"Incorrect ETH value provided\"" + }, + "value": "Incorrect ETH value provided" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_a793dc5bde52ab2d5349f1208a34905b1d68ab9298f549a2e514542cba0a8c76", + "typeString": "literal_string \"Incorrect ETH value provided\"" + } + ], + "id": 8327, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "3958:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8334, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3958:73:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8335, + "nodeType": "ExpressionStatement", + "src": "3958:73:22" + }, + { + "expression": { + "id": 8342, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "baseExpression": { + "id": 8336, + "name": "usedPayloadNonces", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8153, + "src": "4158:17:22", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_uint256_$_t_bool_$_$", + "typeString": "mapping(address => mapping(uint256 => bool))" + } + }, + "id": 8339, + "indexExpression": { + "id": 8337, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8245, + "src": "4176:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4158:24:22", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_bool_$", + "typeString": "mapping(uint256 => bool)" + } + }, + "id": 8340, + "indexExpression": { + "id": 8338, + "name": "nonce", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8250, + "src": "4183:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "4158:31:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "hexValue": "74727565", + "id": 8341, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4192:4:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "src": "4158:38:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 8343, + "nodeType": "ExpressionStatement", + "src": "4158:38:22" + }, + { + "expression": { + "arguments": [ + { + "expression": { + "id": 8345, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4342:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8346, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4349:5:22", + "memberName": "token", + "nodeType": "MemberAccess", + "referencedDeclaration": 8155, + "src": "4342:12:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 8347, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8245, + "src": "4368:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 8348, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4387:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8349, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4394:5:22", + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": 8159, + "src": "4387:12:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 8350, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4413:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8351, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4420:8:22", + "memberName": "deadline", + "nodeType": "MemberAccess", + "referencedDeclaration": 8161, + "src": "4413:15:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 8352, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4442:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8353, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4449:7:22", + "memberName": "permitV", + "nodeType": "MemberAccess", + "referencedDeclaration": 8163, + "src": "4442:14:22", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + { + "expression": { + "id": 8354, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4470:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8355, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4477:7:22", + "memberName": "permitR", + "nodeType": "MemberAccess", + "referencedDeclaration": 8165, + "src": "4470:14:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 8356, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4498:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8357, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4505:7:22", + "memberName": "permitS", + "nodeType": "MemberAccess", + "referencedDeclaration": 8167, + "src": "4498:14:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 8344, + "name": "_executePermitAndTransfer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8508, + "src": "4303:25:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_address_$_t_uint256_$_t_uint256_$_t_uint8_$_t_bytes32_$_t_bytes32_$returns$__$", + "typeString": "function (address,address,uint256,uint256,uint8,bytes32,bytes32)" + } + }, + "id": 8358, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4303:219:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8359, + "nodeType": "ExpressionStatement", + "src": "4303:219:22" + }, + { + "expression": { + "arguments": [ + { + "id": 8365, + "name": "destinationContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8147, + "src": "4626:19:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 8366, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4647:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8367, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4654:5:22", + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": 8159, + "src": "4647:12:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [ + { + "expression": { + "id": 8361, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4599:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8362, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4606:5:22", + "memberName": "token", + "nodeType": "MemberAccess", + "referencedDeclaration": 8155, + "src": "4599:12:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 8360, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "4592:6:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$340_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 8363, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4592:20:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "id": 8364, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4613:12:22", + "memberName": "forceApprove", + "nodeType": "MemberAccess", + "referencedDeclaration": 626, + "src": "4592:33:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$returns$__$attached_to$_t_contract$_IERC20_$340_$", + "typeString": "function (contract IERC20,address,uint256)" + } + }, + "id": 8368, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4592:68:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8369, + "nodeType": "ExpressionStatement", + "src": "4592:68:22" + }, + { + "assignments": [ + 8371 + ], + "declarations": [ + { + "constant": false, + "id": 8371, + "mutability": "mutable", + "name": "callSuccess", + "nameLocation": "4676:11:22", + "nodeType": "VariableDeclaration", + "scope": 8401, + "src": "4671:16:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 8370, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "4671:4:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "id": 8378, + "initialValue": { + "arguments": [ + { + "expression": { + "id": 8373, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4703:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8374, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4710:11:22", + "memberName": "payloadData", + "nodeType": "MemberAccess", + "referencedDeclaration": 8169, + "src": "4703:18:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + } + }, + { + "expression": { + "id": 8375, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -15, + "src": "4723:3:22", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 8376, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4727:5:22", + "memberName": "value", + "nodeType": "MemberAccess", + "src": "4723:9:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 8372, + "name": "_forwardCall", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8529, + "src": "4690:12:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bool_$", + "typeString": "function (bytes memory,uint256) returns (bool)" + } + }, + "id": 8377, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4690:43:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4671:62:22" + }, + { + "expression": { + "arguments": [ + { + "id": 8380, + "name": "callSuccess", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8371, + "src": "4751:11:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "43616c6c206661696c6564", + "id": 8381, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4764:13:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_066ad49a0ed9e5d6a9f3c20fca13a038f0a5d629f0aaf09d634ae2a7c232ac2b", + "typeString": "literal_string \"Call failed\"" + }, + "value": "Call failed" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_066ad49a0ed9e5d6a9f3c20fca13a038f0a5d629f0aaf09d634ae2a7c232ac2b", + "typeString": "literal_string \"Call failed\"" + } + ], + "id": 8379, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "4743:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8382, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4743:35:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8383, + "nodeType": "ExpressionStatement", + "src": "4743:35:22" + }, + { + "expression": { + "arguments": [ + { + "id": 8389, + "name": "destinationContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8147, + "src": "4895:19:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "hexValue": "30", + "id": 8390, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4916:1:22", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "expression": { + "arguments": [ + { + "expression": { + "id": 8385, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4868:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8386, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4875:5:22", + "memberName": "token", + "nodeType": "MemberAccess", + "referencedDeclaration": 8155, + "src": "4868:12:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 8384, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "4861:6:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$340_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 8387, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4861:20:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "id": 8388, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4882:12:22", + "memberName": "forceApprove", + "nodeType": "MemberAccess", + "referencedDeclaration": 626, + "src": "4861:33:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$returns$__$attached_to$_t_contract$_IERC20_$340_$", + "typeString": "function (contract IERC20,address,uint256)" + } + }, + "id": 8391, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4861:57:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8392, + "nodeType": "ExpressionStatement", + "src": "4861:57:22" + }, + { + "eventCall": { + "arguments": [ + { + "id": 8394, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8245, + "src": "4950:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 8395, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4957:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8396, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4964:5:22", + "memberName": "token", + "nodeType": "MemberAccess", + "referencedDeclaration": 8155, + "src": "4957:12:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 8397, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4971:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8398, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4978:5:22", + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": 8159, + "src": "4971:12:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 8393, + "name": "RelayerExecuted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8190, + "src": "4934:15:22", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$__$", + "typeString": "function (address,address,uint256)" + } + }, + "id": 8399, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4934:50:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8400, + "nodeType": "EmitStatement", + "src": "4929:55:22" + } + ] + }, + "functionSelector": "2af83bfe", + "id": 8402, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 8242, + "kind": "modifierInvocation", + "modifierName": { + "id": 8241, + "name": "nonReentrant", + "nameLocations": [ + "3060:12:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1757, + "src": "3060:12:22" + }, + "nodeType": "ModifierInvocation", + "src": "3060:12:22" + } + ], + "name": "execute", + "nameLocation": "3004:7:22", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8240, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8239, + "mutability": "mutable", + "name": "params", + "nameLocation": "3035:6:22", + "nodeType": "VariableDeclaration", + "scope": 8402, + "src": "3012:29:22", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams" + }, + "typeName": { + "id": 8238, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 8237, + "name": "ExecuteParams", + "nameLocations": [ + "3012:13:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 8182, + "src": "3012:13:22" + }, + "referencedDeclaration": 8182, + "src": "3012:13:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_storage_ptr", + "typeString": "struct TokenRelayer.ExecuteParams" + } + }, + "visibility": "internal" + } + ], + "src": "3011:31:22" + }, + "returnParameters": { + "id": 8243, + "nodeType": "ParameterList", + "parameters": [], + "src": "3073:0:22" + }, + "scope": 8603, + "src": "2995:1996:22", + "stateMutability": "payable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 8440, + "nodeType": "Block", + "src": "5285:400:22", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "id": 8425, + "name": "_TYPE_HASH_PAYLOAD", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8145, + "src": "5370:18:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 8426, + "name": "destinationContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8147, + "src": "5406:19:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 8427, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8404, + "src": "5494:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 8428, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8406, + "src": "5517:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 8429, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8408, + "src": "5540:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [ + { + "id": 8431, + "name": "data", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8410, + "src": "5573:4:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 8430, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "5563:9:22", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 8432, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5563:15:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 8433, + "name": "ethValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8412, + "src": "5596:8:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 8434, + "name": "nonce", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8414, + "src": "5622:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 8435, + "name": "deadline", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8416, + "src": "5645:8:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 8423, + "name": "abi", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -1, + "src": "5342:3:22", + "typeDescriptions": { + "typeIdentifier": "t_magic_abi", + "typeString": "abi" + } + }, + "id": 8424, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "5346:6:22", + "memberName": "encode", + "nodeType": "MemberAccess", + "src": "5342:10:22", + "typeDescriptions": { + "typeIdentifier": "t_function_abiencode_pure$__$returns$_t_bytes_memory_ptr_$", + "typeString": "function () pure returns (bytes memory)" + } + }, + "id": 8436, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5342:325:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 8422, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "5332:9:22", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 8437, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5332:336:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 8421, + "name": "_hashTypedDataV4", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4297, + "src": "5302:16:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_bytes32_$", + "typeString": "function (bytes32) view returns (bytes32)" + } + }, + "id": 8438, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5302:376:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 8420, + "id": 8439, + "nodeType": "Return", + "src": "5295:383:22" + } + ] + }, + "id": 8441, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_computeDigest", + "nameLocation": "5062:14:22", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8417, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8404, + "mutability": "mutable", + "name": "owner", + "nameLocation": "5094:5:22", + "nodeType": "VariableDeclaration", + "scope": 8441, + "src": "5086:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8403, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5086:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8406, + "mutability": "mutable", + "name": "token", + "nameLocation": "5117:5:22", + "nodeType": "VariableDeclaration", + "scope": 8441, + "src": "5109:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8405, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5109:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8408, + "mutability": "mutable", + "name": "value", + "nameLocation": "5140:5:22", + "nodeType": "VariableDeclaration", + "scope": 8441, + "src": "5132:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8407, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5132:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8410, + "mutability": "mutable", + "name": "data", + "nameLocation": "5168:4:22", + "nodeType": "VariableDeclaration", + "scope": 8441, + "src": "5155:17:22", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 8409, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5155:5:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8412, + "mutability": "mutable", + "name": "ethValue", + "nameLocation": "5190:8:22", + "nodeType": "VariableDeclaration", + "scope": 8441, + "src": "5182:16:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8411, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5182:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8414, + "mutability": "mutable", + "name": "nonce", + "nameLocation": "5216:5:22", + "nodeType": "VariableDeclaration", + "scope": 8441, + "src": "5208:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8413, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5208:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8416, + "mutability": "mutable", + "name": "deadline", + "nameLocation": "5239:8:22", + "nodeType": "VariableDeclaration", + "scope": 8441, + "src": "5231:16:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8415, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5231:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5076:177:22" + }, + "returnParameters": { + "id": 8420, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8419, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 8441, + "src": "5276:7:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8418, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5276:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "5275:9:22" + }, + "scope": 8603, + "src": "5053:632:22", + "stateMutability": "view", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 8507, + "nodeType": "Block", + "src": "6141:577:22", + "statements": [ + { + "clauses": [ + { + "block": { + "id": 8474, + "nodeType": "Block", + "src": "6291:43:22", + "statements": [] + }, + "errorName": "", + "id": 8475, + "nodeType": "TryCatchClause", + "src": "6291:43:22" + }, + { + "block": { + "id": 8492, + "nodeType": "Block", + "src": "6341:246:22", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 8488, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 8481, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8446, + "src": "6472:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "arguments": [ + { + "id": 8484, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "6487:4:22", + "typeDescriptions": { + "typeIdentifier": "t_contract$_TokenRelayer_$8603", + "typeString": "contract TokenRelayer" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_TokenRelayer_$8603", + "typeString": "contract TokenRelayer" + } + ], + "id": 8483, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6479:7:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 8482, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6479:7:22", + "typeDescriptions": {} + } + }, + "id": 8485, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6479:13:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "expression": { + "arguments": [ + { + "id": 8478, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8444, + "src": "6455:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 8477, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "6448:6:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$340_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 8479, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6448:13:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "id": 8480, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6462:9:22", + "memberName": "allowance", + "nodeType": "MemberAccess", + "referencedDeclaration": 317, + "src": "6448:23:22", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_address_$_t_address_$returns$_t_uint256_$", + "typeString": "function (address,address) view external returns (uint256)" + } + }, + "id": 8486, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6448:45:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "id": 8487, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8448, + "src": "6497:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6448:54:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "5065726d6974206661696c656420616e6420696e73756666696369656e7420616c6c6f77616e6365", + "id": 8489, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6520:42:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_0acc7f0c8df1a6717d2b423ae4591ac135687015764ac37dd4cf0150a9322b15", + "typeString": "literal_string \"Permit failed and insufficient allowance\"" + }, + "value": "Permit failed and insufficient allowance" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_0acc7f0c8df1a6717d2b423ae4591ac135687015764ac37dd4cf0150a9322b15", + "typeString": "literal_string \"Permit failed and insufficient allowance\"" + } + ], + "id": 8476, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "6423:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8490, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6423:153:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8491, + "nodeType": "ExpressionStatement", + "src": "6423:153:22" + } + ] + }, + "errorName": "", + "id": 8493, + "nodeType": "TryCatchClause", + "src": "6335:252:22" + } + ], + "externalCall": { + "arguments": [ + { + "id": 8463, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8446, + "src": "6243:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "arguments": [ + { + "id": 8466, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "6258:4:22", + "typeDescriptions": { + "typeIdentifier": "t_contract$_TokenRelayer_$8603", + "typeString": "contract TokenRelayer" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_TokenRelayer_$8603", + "typeString": "contract TokenRelayer" + } + ], + "id": 8465, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6250:7:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 8464, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6250:7:22", + "typeDescriptions": {} + } + }, + "id": 8467, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6250:13:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 8468, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8448, + "src": "6265:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 8469, + "name": "deadline", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8450, + "src": "6272:8:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 8470, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8452, + "src": "6282:1:22", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + { + "id": 8471, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8454, + "src": "6285:1:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 8472, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8456, + "src": "6288:1:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "arguments": [ + { + "id": 8460, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8444, + "src": "6229:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 8459, + "name": "IERC20Permit", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 376, + "src": "6216:12:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20Permit_$376_$", + "typeString": "type(contract IERC20Permit)" + } + }, + "id": 8461, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6216:19:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20Permit_$376", + "typeString": "contract IERC20Permit" + } + }, + "id": 8462, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6236:6:22", + "memberName": "permit", + "nodeType": "MemberAccess", + "referencedDeclaration": 361, + "src": "6216:26:22", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_address_$_t_uint256_$_t_uint256_$_t_uint8_$_t_bytes32_$_t_bytes32_$returns$__$", + "typeString": "function (address,address,uint256,uint256,uint8,bytes32,bytes32) external" + } + }, + "id": 8473, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6216:74:22", + "tryCall": true, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8494, + "nodeType": "TryStatement", + "src": "6212:375:22" + }, + { + "expression": { + "arguments": [ + { + "id": 8499, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8446, + "src": "6683:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "arguments": [ + { + "id": 8502, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "6698:4:22", + "typeDescriptions": { + "typeIdentifier": "t_contract$_TokenRelayer_$8603", + "typeString": "contract TokenRelayer" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_TokenRelayer_$8603", + "typeString": "contract TokenRelayer" + } + ], + "id": 8501, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6690:7:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 8500, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6690:7:22", + "typeDescriptions": {} + } + }, + "id": 8503, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6690:13:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 8504, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8448, + "src": "6705:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [ + { + "id": 8496, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8444, + "src": "6659:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 8495, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "6652:6:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$340_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 8497, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6652:13:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "id": 8498, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6666:16:22", + "memberName": "safeTransferFrom", + "nodeType": "MemberAccess", + "referencedDeclaration": 456, + "src": "6652:30:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_address_$_t_uint256_$returns$__$attached_to$_t_contract$_IERC20_$340_$", + "typeString": "function (contract IERC20,address,address,uint256)" + } + }, + "id": 8505, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6652:59:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8506, + "nodeType": "ExpressionStatement", + "src": "6652:59:22" + } + ] + }, + "documentation": { + "id": 8442, + "nodeType": "StructuredDocumentation", + "src": "5691:245:22", + "text": " @dev Execute permit approval and then transfer tokens from owner to self (relayer).\n Permit is wrapped in try-catch: if it was front-run, we check\n that the allowance is already sufficient before proceeding." + }, + "id": 8508, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_executePermitAndTransfer", + "nameLocation": "5950:25:22", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8457, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8444, + "mutability": "mutable", + "name": "token", + "nameLocation": "5993:5:22", + "nodeType": "VariableDeclaration", + "scope": 8508, + "src": "5985:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8443, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5985:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8446, + "mutability": "mutable", + "name": "owner", + "nameLocation": "6016:5:22", + "nodeType": "VariableDeclaration", + "scope": 8508, + "src": "6008:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8445, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6008:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8448, + "mutability": "mutable", + "name": "value", + "nameLocation": "6039:5:22", + "nodeType": "VariableDeclaration", + "scope": 8508, + "src": "6031:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8447, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6031:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8450, + "mutability": "mutable", + "name": "deadline", + "nameLocation": "6062:8:22", + "nodeType": "VariableDeclaration", + "scope": 8508, + "src": "6054:16:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8449, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6054:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8452, + "mutability": "mutable", + "name": "v", + "nameLocation": "6086:1:22", + "nodeType": "VariableDeclaration", + "scope": 8508, + "src": "6080:7:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 8451, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "6080:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8454, + "mutability": "mutable", + "name": "r", + "nameLocation": "6105:1:22", + "nodeType": "VariableDeclaration", + "scope": 8508, + "src": "6097:9:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8453, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6097:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8456, + "mutability": "mutable", + "name": "s", + "nameLocation": "6124:1:22", + "nodeType": "VariableDeclaration", + "scope": 8508, + "src": "6116:9:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8455, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6116:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "5975:156:22" + }, + "returnParameters": { + "id": 8458, + "nodeType": "ParameterList", + "parameters": [], + "src": "6141:0:22" + }, + "scope": 8603, + "src": "5941:777:22", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 8528, + "nodeType": "Block", + "src": "6804:104:22", + "statements": [ + { + "assignments": [ + 8518, + null + ], + "declarations": [ + { + "constant": false, + "id": 8518, + "mutability": "mutable", + "name": "success", + "nameLocation": "6820:7:22", + "nodeType": "VariableDeclaration", + "scope": 8528, + "src": "6815:12:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 8517, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "6815:4:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + null + ], + "id": 8525, + "initialValue": { + "arguments": [ + { + "id": 8523, + "name": "data", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8510, + "src": "6872:4:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "id": 8519, + "name": "destinationContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8147, + "src": "6833:19:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 8520, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6853:4:22", + "memberName": "call", + "nodeType": "MemberAccess", + "src": "6833:24:22", + "typeDescriptions": { + "typeIdentifier": "t_function_barecall_payable$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$", + "typeString": "function (bytes memory) payable returns (bool,bytes memory)" + } + }, + "id": 8522, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "names": [ + "value" + ], + "nodeType": "FunctionCallOptions", + "options": [ + { + "id": 8521, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8512, + "src": "6865:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "src": "6833:38:22", + "typeDescriptions": { + "typeIdentifier": "t_function_barecall_payable$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$value", + "typeString": "function (bytes memory) payable returns (bool,bytes memory)" + } + }, + "id": 8524, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6833:44:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$", + "typeString": "tuple(bool,bytes memory)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "6814:63:22" + }, + { + "expression": { + "id": 8526, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8518, + "src": "6894:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 8516, + "id": 8527, + "nodeType": "Return", + "src": "6887:14:22" + } + ] + }, + "id": 8529, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_forwardCall", + "nameLocation": "6733:12:22", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8513, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8510, + "mutability": "mutable", + "name": "data", + "nameLocation": "6759:4:22", + "nodeType": "VariableDeclaration", + "scope": 8529, + "src": "6746:17:22", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 8509, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "6746:5:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8512, + "mutability": "mutable", + "name": "value", + "nameLocation": "6773:5:22", + "nodeType": "VariableDeclaration", + "scope": 8529, + "src": "6765:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8511, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6765:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "6745:34:22" + }, + "returnParameters": { + "id": 8516, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8515, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 8529, + "src": "6798:4:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 8514, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "6798:4:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "6797:6:22" + }, + "scope": 8603, + "src": "6724:184:22", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 8555, + "nodeType": "Block", + "src": "7309:113:22", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 8543, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 67, + "src": "7346:5:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", + "typeString": "function () view returns (address)" + } + }, + "id": 8544, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7346:7:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 8545, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8534, + "src": "7355:6:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [ + { + "id": 8540, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8532, + "src": "7326:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 8539, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "7319:6:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$340_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 8541, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7319:13:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "id": 8542, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7333:12:22", + "memberName": "safeTransfer", + "nodeType": "MemberAccess", + "referencedDeclaration": 425, + "src": "7319:26:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$returns$__$attached_to$_t_contract$_IERC20_$340_$", + "typeString": "function (contract IERC20,address,uint256)" + } + }, + "id": 8546, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7319:43:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8547, + "nodeType": "ExpressionStatement", + "src": "7319:43:22" + }, + { + "eventCall": { + "arguments": [ + { + "id": 8549, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8532, + "src": "7392:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 8550, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8534, + "src": "7399:6:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 8551, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 67, + "src": "7407:5:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", + "typeString": "function () view returns (address)" + } + }, + "id": 8552, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7407:7:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 8548, + "name": "TokenWithdrawn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8198, + "src": "7377:14:22", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_uint256_$_t_address_$returns$__$", + "typeString": "function (address,uint256,address)" + } + }, + "id": 8553, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7377:38:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8554, + "nodeType": "EmitStatement", + "src": "7372:43:22" + } + ] + }, + "documentation": { + "id": 8530, + "nodeType": "StructuredDocumentation", + "src": "6914:217:22", + "text": " @notice Allows the owner to recover any ERC20 tokens held by this contract.\n @param token The ERC20 token contract address.\n @param amount The amount of tokens to transfer to the owner." + }, + "functionSelector": "9e281a98", + "id": 8556, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 8537, + "kind": "modifierInvocation", + "modifierName": { + "id": 8536, + "name": "onlyOwner", + "nameLocations": [ + "7299:9:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 58, + "src": "7299:9:22" + }, + "nodeType": "ModifierInvocation", + "src": "7299:9:22" + } + ], + "name": "withdrawToken", + "nameLocation": "7245:13:22", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8535, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8532, + "mutability": "mutable", + "name": "token", + "nameLocation": "7267:5:22", + "nodeType": "VariableDeclaration", + "scope": 8556, + "src": "7259:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8531, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "7259:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8534, + "mutability": "mutable", + "name": "amount", + "nameLocation": "7282:6:22", + "nodeType": "VariableDeclaration", + "scope": 8556, + "src": "7274:14:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8533, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7274:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7258:31:22" + }, + "returnParameters": { + "id": 8538, + "nodeType": "ParameterList", + "parameters": [], + "src": "7309:0:22" + }, + "scope": 8603, + "src": "7236:186:22", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 8585, + "nodeType": "Block", + "src": "7675:160:22", + "statements": [ + { + "assignments": [ + 8565, + null + ], + "declarations": [ + { + "constant": false, + "id": 8565, + "mutability": "mutable", + "name": "success", + "nameLocation": "7691:7:22", + "nodeType": "VariableDeclaration", + "scope": 8585, + "src": "7686:12:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 8564, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "7686:4:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + null + ], + "id": 8573, + "initialValue": { + "arguments": [ + { + "hexValue": "", + "id": 8571, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7732:2:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "typeString": "literal_string \"\"" + }, + "value": "" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "typeString": "literal_string \"\"" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "typeString": "literal_string \"\"" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 8566, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 67, + "src": "7704:5:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", + "typeString": "function () view returns (address)" + } + }, + "id": 8567, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7704:7:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 8568, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7712:4:22", + "memberName": "call", + "nodeType": "MemberAccess", + "src": "7704:12:22", + "typeDescriptions": { + "typeIdentifier": "t_function_barecall_payable$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$", + "typeString": "function (bytes memory) payable returns (bool,bytes memory)" + } + }, + "id": 8570, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "names": [ + "value" + ], + "nodeType": "FunctionCallOptions", + "options": [ + { + "id": 8569, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8559, + "src": "7724:6:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "src": "7704:27:22", + "typeDescriptions": { + "typeIdentifier": "t_function_barecall_payable$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$value", + "typeString": "function (bytes memory) payable returns (bool,bytes memory)" + } + }, + "id": 8572, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7704:31:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$", + "typeString": "tuple(bool,bytes memory)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "7685:50:22" + }, + { + "expression": { + "arguments": [ + { + "id": 8575, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8565, + "src": "7753:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "455448207472616e73666572206661696c6564", + "id": 8576, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7762:21:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_c7c2be2f1b63a3793f6e2d447ce95ba2239687186a7fd6b5268a969dcdb42dcd", + "typeString": "literal_string \"ETH transfer failed\"" + }, + "value": "ETH transfer failed" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_c7c2be2f1b63a3793f6e2d447ce95ba2239687186a7fd6b5268a969dcdb42dcd", + "typeString": "literal_string \"ETH transfer failed\"" + } + ], + "id": 8574, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "7745:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8577, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7745:39:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8578, + "nodeType": "ExpressionStatement", + "src": "7745:39:22" + }, + { + "eventCall": { + "arguments": [ + { + "id": 8580, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8559, + "src": "7812:6:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 8581, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 67, + "src": "7820:5:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", + "typeString": "function () view returns (address)" + } + }, + "id": 8582, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7820:7:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 8579, + "name": "ETHWithdrawn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8204, + "src": "7799:12:22", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_uint256_$_t_address_$returns$__$", + "typeString": "function (uint256,address)" + } + }, + "id": 8583, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7799:29:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8584, + "nodeType": "EmitStatement", + "src": "7794:34:22" + } + ] + }, + "documentation": { + "id": 8557, + "nodeType": "StructuredDocumentation", + "src": "7428:157:22", + "text": " @notice Allows the owner to recover any native ETH held by this contract.\n @param amount The amount of ETH to transfer to the owner." + }, + "functionSelector": "f14210a6", + "id": 8586, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 8562, + "kind": "modifierInvocation", + "modifierName": { + "id": 8561, + "name": "onlyOwner", + "nameLocations": [ + "7665:9:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 58, + "src": "7665:9:22" + }, + "nodeType": "ModifierInvocation", + "src": "7665:9:22" + } + ], + "name": "withdrawETH", + "nameLocation": "7628:11:22", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8560, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8559, + "mutability": "mutable", + "name": "amount", + "nameLocation": "7648:6:22", + "nodeType": "VariableDeclaration", + "scope": 8586, + "src": "7640:14:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8558, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7640:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7639:16:22" + }, + "returnParameters": { + "id": 8563, + "nodeType": "ParameterList", + "parameters": [], + "src": "7675:0:22" + }, + "scope": 8603, + "src": "7619:216:22", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 8601, + "nodeType": "Block", + "src": "7997:56:22", + "statements": [ + { + "expression": { + "baseExpression": { + "baseExpression": { + "id": 8595, + "name": "usedPayloadNonces", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8153, + "src": "8014:17:22", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_uint256_$_t_bool_$_$", + "typeString": "mapping(address => mapping(uint256 => bool))" + } + }, + "id": 8597, + "indexExpression": { + "id": 8596, + "name": "signer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8588, + "src": "8032:6:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8014:25:22", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_bool_$", + "typeString": "mapping(uint256 => bool)" + } + }, + "id": 8599, + "indexExpression": { + "id": 8598, + "name": "nonce", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8590, + "src": "8040:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8014:32:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 8594, + "id": 8600, + "nodeType": "Return", + "src": "8007:39:22" + } + ] + }, + "functionSelector": "dcb79457", + "id": 8602, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "isExecutionCompleted", + "nameLocation": "7916:20:22", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8591, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8588, + "mutability": "mutable", + "name": "signer", + "nameLocation": "7945:6:22", + "nodeType": "VariableDeclaration", + "scope": 8602, + "src": "7937:14:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8587, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "7937:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8590, + "mutability": "mutable", + "name": "nonce", + "nameLocation": "7961:5:22", + "nodeType": "VariableDeclaration", + "scope": 8602, + "src": "7953:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8589, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7953:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7936:31:22" + }, + "returnParameters": { + "id": 8594, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8593, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 8602, + "src": "7991:4:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 8592, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "7991:4:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "7990:6:22" + }, + "scope": 8603, + "src": "7907:146:22", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + } + ], + "scope": 8604, + "src": "1158:6897:22", + "usedErrors": [ + 13, + 18, + 388, + 1734, + 1841, + 1843, + 3689, + 3694, + 3699 + ], + "usedEvents": [ + 24, + 242, + 8190, + 8198, + 8204 + ] + } + ], + "src": "32:8024:22" + }, + "id": 22 + } + }, + "contracts": { + "@openzeppelin/contracts/access/Ownable.sol": { + "Ownable": { + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnableInvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "OwnableUnauthorizedAccount", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "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" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "methodIdentifiers": { + "owner()": "8da5cb5b", + "renounceOwnership()": "715018a6", + "transferOwnership(address)": "f2fde38b" + } + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"OwnableInvalidOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"OwnableUnauthorizedAccount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"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\"}],\"devdoc\":{\"details\":\"Contract module which provides a basic access control mechanism, where there is an account (an owner) that can be granted exclusive access to specific functions. The initial owner is set to the address provided by the deployer. This can later be changed with {transferOwnership}. This module is used through inheritance. It will make available the modifier `onlyOwner`, which can be applied to your functions to restrict their use to the owner.\",\"errors\":{\"OwnableInvalidOwner(address)\":[{\"details\":\"The owner is not a valid owner account. (eg. `address(0)`)\"}],\"OwnableUnauthorizedAccount(address)\":[{\"details\":\"The caller account is not authorized to perform an operation.\"}]},\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the contract setting the address provided by the deployer as the initial owner.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"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\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/access/Ownable.sol\":\"Ownable\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"keccak256\":\"0xff6d0bb2e285473e5311d9d3caacb525ae3538a80758c10649a4d61029b017bb\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8ed324d3920bb545059d66ab97d43e43ee85fd3bd52e03e401f020afb0b120f6\",\"dweb:/ipfs/QmfEckWLmZkDDcoWrkEvMWhms66xwTLff9DDhegYpvHo1a\"]},\"@openzeppelin/contracts/utils/Context.sol\":{\"keccak256\":\"0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6a708e8a5bdb1011c2c381c9a5cfd8a9a956d7d0a9dc1bd8bcdaf52f76ef2f12\",\"dweb:/ipfs/Qmax9WHBnVsZP46ZxEMNRQpLQnrdE4dK8LehML1Py8FowF\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/interfaces/IERC1363.sol": { + "IERC1363": { + "abi": [ + { + "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": 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": "value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "approveAndCall", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "approveAndCall", + "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": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "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": "value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "transferAndCall", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "transferAndCall", + "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": "value", + "type": "uint256" + } + ], + "name": "transferFrom", + "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": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "transferFromAndCall", + "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": "value", + "type": "uint256" + } + ], + "name": "transferFromAndCall", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "methodIdentifiers": { + "allowance(address,address)": "dd62ed3e", + "approve(address,uint256)": "095ea7b3", + "approveAndCall(address,uint256)": "3177029f", + "approveAndCall(address,uint256,bytes)": "cae9ca51", + "balanceOf(address)": "70a08231", + "supportsInterface(bytes4)": "01ffc9a7", + "totalSupply()": "18160ddd", + "transfer(address,uint256)": "a9059cbb", + "transferAndCall(address,uint256)": "1296ee62", + "transferAndCall(address,uint256,bytes)": "4000aea0", + "transferFrom(address,address,uint256)": "23b872dd", + "transferFromAndCall(address,address,uint256)": "d8fbe994", + "transferFromAndCall(address,address,uint256,bytes)": "c1d34b89" + } + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"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\":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\":\"value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"approveAndCall\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"approveAndCall\",\"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\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"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\":\"value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"transferAndCall\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"transferAndCall\",\"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\":\"value\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"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\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"transferFromAndCall\",\"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\":\"value\",\"type\":\"uint256\"}],\"name\":\"transferFromAndCall\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363]. Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.\",\"events\":{\"Approval(address,address,uint256)\":{\"details\":\"Emitted when the allowance of a `spender` for an `owner` is set by a call to {approve}. `value` is the new allowance.\"},\"Transfer(address,address,uint256)\":{\"details\":\"Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero.\"}},\"kind\":\"dev\",\"methods\":{\"allowance(address,address)\":{\"details\":\"Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called.\"},\"approve(address,uint256)\":{\"details\":\"Sets a `value` amount of tokens as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {Approval} event.\"},\"approveAndCall(address,uint256)\":{\"details\":\"Sets a `value` amount of tokens as the allowance of `spender` over the caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\",\"params\":{\"spender\":\"The address which will spend the funds.\",\"value\":\"The amount of tokens to be spent.\"},\"returns\":{\"_0\":\"A boolean value indicating whether the operation succeeded unless throwing.\"}},\"approveAndCall(address,uint256,bytes)\":{\"details\":\"Sets a `value` amount of tokens as the allowance of `spender` over the caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\",\"params\":{\"data\":\"Additional data with no specified format, sent in call to `spender`.\",\"spender\":\"The address which will spend the funds.\",\"value\":\"The amount of tokens to be spent.\"},\"returns\":{\"_0\":\"A boolean value indicating whether the operation succeeded unless throwing.\"}},\"balanceOf(address)\":{\"details\":\"Returns the value of tokens owned by `account`.\"},\"supportsInterface(bytes4)\":{\"details\":\"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section] to learn more about how these ids are created. This function call must use less than 30 000 gas.\"},\"totalSupply()\":{\"details\":\"Returns the value of tokens in existence.\"},\"transfer(address,uint256)\":{\"details\":\"Moves a `value` amount of tokens from the caller's account to `to`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.\"},\"transferAndCall(address,uint256)\":{\"details\":\"Moves a `value` amount of tokens from the caller's account to `to` and then calls {IERC1363Receiver-onTransferReceived} on `to`.\",\"params\":{\"to\":\"The address which you want to transfer to.\",\"value\":\"The amount of tokens to be transferred.\"},\"returns\":{\"_0\":\"A boolean value indicating whether the operation succeeded unless throwing.\"}},\"transferAndCall(address,uint256,bytes)\":{\"details\":\"Moves a `value` amount of tokens from the caller's account to `to` and then calls {IERC1363Receiver-onTransferReceived} on `to`.\",\"params\":{\"data\":\"Additional data with no specified format, sent in call to `to`.\",\"to\":\"The address which you want to transfer to.\",\"value\":\"The amount of tokens to be transferred.\"},\"returns\":{\"_0\":\"A boolean value indicating whether the operation succeeded unless throwing.\"}},\"transferFrom(address,address,uint256)\":{\"details\":\"Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism. `value` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.\"},\"transferFromAndCall(address,address,uint256)\":{\"details\":\"Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism and then calls {IERC1363Receiver-onTransferReceived} on `to`.\",\"params\":{\"from\":\"The address which you want to send tokens from.\",\"to\":\"The address which you want to transfer to.\",\"value\":\"The amount of tokens to be transferred.\"},\"returns\":{\"_0\":\"A boolean value indicating whether the operation succeeded unless throwing.\"}},\"transferFromAndCall(address,address,uint256,bytes)\":{\"details\":\"Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism and then calls {IERC1363Receiver-onTransferReceived} on `to`.\",\"params\":{\"data\":\"Additional data with no specified format, sent in call to `to`.\",\"from\":\"The address which you want to send tokens from.\",\"to\":\"The address which you want to transfer to.\",\"value\":\"The amount of tokens to be transferred.\"},\"returns\":{\"_0\":\"A boolean value indicating whether the operation succeeded unless throwing.\"}}},\"title\":\"IERC1363\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/interfaces/IERC1363.sol\":\"IERC1363\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/IERC1363.sol\":{\"keccak256\":\"0xd5ea07362ab630a6a3dee4285a74cf2377044ca2e4be472755ad64d7c5d4b69d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://da5e832b40fc5c3145d3781e2e5fa60ac2052c9d08af7e300dc8ab80c4343100\",\"dweb:/ipfs/QmTzf7N5ZUdh5raqtzbM11yexiUoLC9z3Ws632MCuycq1d\"]},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"keccak256\":\"0x0afcb7e740d1537b252cb2676f600465ce6938398569f09ba1b9ca240dde2dfc\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1c299900ac4ec268d4570ecef0d697a3013cd11a6eb74e295ee3fbc945056037\",\"dweb:/ipfs/Qmab9owJoxcA7vJT5XNayCMaUR1qxqj1NDzzisduwaJMcZ\"]},\"@openzeppelin/contracts/interfaces/IERC20.sol\":{\"keccak256\":\"0x1a6221315ce0307746c2c4827c125d821ee796c74a676787762f4778671d4f44\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1bb2332a7ee26dd0b0de9b7fe266749f54820c99ab6a3bcb6f7e6b751d47ee2d\",\"dweb:/ipfs/QmcRWpaBeCYkhy68PR3B4AgD7asuQk7PwkWxrvJbZcikLF\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x74ed01eb66b923d0d0cfe3be84604ac04b76482a55f9dd655e1ef4d367f95bc2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5282825a626cfe924e504274b864a652b0023591fa66f06a067b25b51ba9b303\",\"dweb:/ipfs/QmeCfPykghhMc81VJTrHTC7sF6CRvaA1FXVq2pJhwYp1dV\"]},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x8891738ffe910f0cf2da09566928589bf5d63f4524dd734fd9cedbac3274dd5c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://971f954442df5c2ef5b5ebf1eb245d7105d9fbacc7386ee5c796df1d45b21617\",\"dweb:/ipfs/QmadRjHbkicwqwwh61raUEapaVEtaLMcYbQZWs9gUkgj3u\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/interfaces/IERC5267.sol": { + "IERC5267": { + "abi": [ + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "methodIdentifiers": { + "eip712Domain()": "84b0196e" + } + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[],\"name\":\"EIP712DomainChanged\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"eip712Domain\",\"outputs\":[{\"internalType\":\"bytes1\",\"name\":\"fields\",\"type\":\"bytes1\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"verifyingContract\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"extensions\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"EIP712DomainChanged()\":{\"details\":\"MAY be emitted to signal that the domain could have changed.\"}},\"kind\":\"dev\",\"methods\":{\"eip712Domain()\":{\"details\":\"returns the fields and values that describe the domain separator used by this contract for EIP-712 signature.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/interfaces/IERC5267.sol\":\"IERC5267\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/IERC5267.sol\":{\"keccak256\":\"0xfb223a85dd0b2175cfbbaa325a744e2cd74ecd17c3df2b77b0722f991d2725ee\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://84bf1dea0589ec49c8d15d559cc6d86ee493048a89b2d4adb60fbe705a3d89ae\",\"dweb:/ipfs/Qmd56n556d529wk2pRMhYhm5nhMDhviwereodDikjs68w1\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "IERC20": { + "abi": [ + { + "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": 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": "value", + "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": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "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": "value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "methodIdentifiers": { + "allowance(address,address)": "dd62ed3e", + "approve(address,uint256)": "095ea7b3", + "balanceOf(address)": "70a08231", + "totalSupply()": "18160ddd", + "transfer(address,uint256)": "a9059cbb", + "transferFrom(address,address,uint256)": "23b872dd" + } + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"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\":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\":\"value\",\"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\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"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\":\"value\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Interface of the ERC-20 standard as defined in the ERC.\",\"events\":{\"Approval(address,address,uint256)\":{\"details\":\"Emitted when the allowance of a `spender` for an `owner` is set by a call to {approve}. `value` is the new allowance.\"},\"Transfer(address,address,uint256)\":{\"details\":\"Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero.\"}},\"kind\":\"dev\",\"methods\":{\"allowance(address,address)\":{\"details\":\"Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called.\"},\"approve(address,uint256)\":{\"details\":\"Sets a `value` amount of tokens as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {Approval} event.\"},\"balanceOf(address)\":{\"details\":\"Returns the value of tokens owned by `account`.\"},\"totalSupply()\":{\"details\":\"Returns the value of tokens in existence.\"},\"transfer(address,uint256)\":{\"details\":\"Moves a `value` amount of tokens from the caller's account to `to`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism. `value` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":\"IERC20\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x74ed01eb66b923d0d0cfe3be84604ac04b76482a55f9dd655e1ef4d367f95bc2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5282825a626cfe924e504274b864a652b0023591fa66f06a067b25b51ba9b303\",\"dweb:/ipfs/QmeCfPykghhMc81VJTrHTC7sF6CRvaA1FXVq2pJhwYp1dV\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": { + "IERC20Permit": { + "abi": [ + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "methodIdentifiers": { + "DOMAIN_SEPARATOR()": "3644e515", + "nonces(address)": "7ecebe00", + "permit(address,address,uint256,uint256,uint8,bytes32,bytes32)": "d505accf" + } + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"DOMAIN_SEPARATOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"nonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"permit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Interface of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in https://eips.ethereum.org/EIPS/eip-2612[ERC-2612]. Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't need to send a transaction, and thus is not required to hold Ether at all. ==== Security Considerations There are two important considerations concerning the use of `permit`. The first is that a valid permit signature expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be considered as an intention to spend the allowance in any specific way. The second is that because permits have built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be generally recommended is: ```solidity function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} doThing(..., value); } function doThing(..., uint256 value) public { token.safeTransferFrom(msg.sender, address(this), value); ... } ``` Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also {SafeERC20-safeTransferFrom}). Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so contracts should have entry points that don't rely on permit.\",\"kind\":\"dev\",\"methods\":{\"DOMAIN_SEPARATOR()\":{\"details\":\"Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\"},\"nonces(address)\":{\"details\":\"Returns the current nonce for `owner`. This value must be included whenever a signature is generated for {permit}. Every successful call to {permit} increases ``owner``'s nonce by one. This prevents a signature from being used multiple times.\"},\"permit(address,address,uint256,uint256,uint8,bytes32,bytes32)\":{\"details\":\"Sets `value` as the allowance of `spender` over ``owner``'s tokens, given ``owner``'s signed approval. IMPORTANT: The same issues {IERC20-approve} has related to transaction ordering also applies here. Emits an {Approval} event. Requirements: - `spender` cannot be the zero address. - `deadline` must be a timestamp in the future. - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` over the EIP712-formatted function arguments. - the signature must use ``owner``'s current nonce (see {nonces}). For more information on the signature format, see the https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP section]. CAUTION: See Security Considerations above.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\":\"IERC20Permit\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\":{\"keccak256\":\"0x53befc41288eaa87edcd3a7be7e8475a32e44c6a29f9bf52fae789781301d9ff\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a1d7fab53c4ceaf42391b83d9b36d7e9cc524a8da125cffdcd32c56560f9d1c9\",\"dweb:/ipfs/QmaRZdVhQdqNXofeimibkBG65q9GVcXVZEGpycwwX3znC6\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "SafeERC20": { + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "currentAllowance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestedDecrease", + "type": "uint256" + } + ], + "name": "SafeERC20FailedDecreaseAllowance", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "SafeERC20FailedOperation", + "type": "error" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212205c28a953d80cbde5965c90d7d69e4200c2946ffa7d85a8c75c36f5291a6d6e6464736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 TLOAD 0x28 0xA9 MSTORE8 0xD8 0xC 0xBD 0xE5 SWAP7 TLOAD SWAP1 0xD7 0xD6 SWAP15 TIMESTAMP STOP 0xC2 SWAP5 PUSH16 0xFA7D85A8C75C36F5291A6D6E6464736F PUSH13 0x634300081C0033000000000000 ", + "sourceMap": "698:12615:7:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;698:12615:7;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212205c28a953d80cbde5965c90d7d69e4200c2946ffa7d85a8c75c36f5291a6d6e6464736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 TLOAD 0x28 0xA9 MSTORE8 0xD8 0xC 0xBD 0xE5 SWAP7 TLOAD SWAP1 0xD7 0xD6 SWAP15 TIMESTAMP STOP 0xC2 SWAP5 PUSH16 0xFA7D85A8C75C36F5291A6D6E6464736F PUSH13 0x634300081C0033000000000000 ", + "sourceMap": "698:12615:7:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"currentAllowance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestedDecrease\",\"type\":\"uint256\"}],\"name\":\"SafeERC20FailedDecreaseAllowance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"SafeERC20FailedOperation\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"Wrappers around ERC-20 operations that throw on failure (when the token contract returns false). Tokens that return no value (and instead revert or throw on failure) are also supported, non-reverting calls are assumed to be successful. To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\",\"errors\":{\"SafeERC20FailedDecreaseAllowance(address,uint256,uint256)\":[{\"details\":\"Indicates a failed `decreaseAllowance` request.\"}],\"SafeERC20FailedOperation(address)\":[{\"details\":\"An operation with an ERC-20 token failed.\"}]},\"kind\":\"dev\",\"methods\":{},\"title\":\"SafeERC20\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":\"SafeERC20\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/IERC1363.sol\":{\"keccak256\":\"0xd5ea07362ab630a6a3dee4285a74cf2377044ca2e4be472755ad64d7c5d4b69d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://da5e832b40fc5c3145d3781e2e5fa60ac2052c9d08af7e300dc8ab80c4343100\",\"dweb:/ipfs/QmTzf7N5ZUdh5raqtzbM11yexiUoLC9z3Ws632MCuycq1d\"]},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"keccak256\":\"0x0afcb7e740d1537b252cb2676f600465ce6938398569f09ba1b9ca240dde2dfc\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1c299900ac4ec268d4570ecef0d697a3013cd11a6eb74e295ee3fbc945056037\",\"dweb:/ipfs/Qmab9owJoxcA7vJT5XNayCMaUR1qxqj1NDzzisduwaJMcZ\"]},\"@openzeppelin/contracts/interfaces/IERC20.sol\":{\"keccak256\":\"0x1a6221315ce0307746c2c4827c125d821ee796c74a676787762f4778671d4f44\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1bb2332a7ee26dd0b0de9b7fe266749f54820c99ab6a3bcb6f7e6b751d47ee2d\",\"dweb:/ipfs/QmcRWpaBeCYkhy68PR3B4AgD7asuQk7PwkWxrvJbZcikLF\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x74ed01eb66b923d0d0cfe3be84604ac04b76482a55f9dd655e1ef4d367f95bc2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5282825a626cfe924e504274b864a652b0023591fa66f06a067b25b51ba9b303\",\"dweb:/ipfs/QmeCfPykghhMc81VJTrHTC7sF6CRvaA1FXVq2pJhwYp1dV\"]},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"keccak256\":\"0x304d732678032a9781ae85c8f204c8fba3d3a5e31c02616964e75cfdc5049098\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://299ced486011781dc98f638059678323c03079fefae1482abaa2135b22fa92d0\",\"dweb:/ipfs/QmbZNbcPTBxNvwChavN2kkZZs7xHhYL7mv51KrxMhsMs3j\"]},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x8891738ffe910f0cf2da09566928589bf5d63f4524dd734fd9cedbac3274dd5c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://971f954442df5c2ef5b5ebf1eb245d7105d9fbacc7386ee5c796df1d45b21617\",\"dweb:/ipfs/QmadRjHbkicwqwwh61raUEapaVEtaLMcYbQZWs9gUkgj3u\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/Bytes.sol": { + "Bytes": { + "abi": [], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea2646970667358221220072fadf3f16461513580a2d3f78bb66cb36505b035a64cbbe629d90098ae436d64736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 SMOD 0x2F 0xAD RETURN CALL PUSH5 0x61513580A2 0xD3 0xF7 DUP12 0xB6 PUSH13 0xB36505B035A64CBBE629D90098 0xAE NUMBER PUSH14 0x64736F6C634300081C0033000000 ", + "sourceMap": "198:14538:8:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;198:14538:8;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea2646970667358221220072fadf3f16461513580a2d3f78bb66cb36505b035a64cbbe629d90098ae436d64736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 SMOD 0x2F 0xAD RETURN CALL PUSH5 0x61513580A2 0xD3 0xF7 DUP12 0xB6 PUSH13 0xB36505B035A64CBBE629D90098 0xAE NUMBER PUSH14 0x64736F6C634300081C0033000000 ", + "sourceMap": "198:14538:8:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Bytes operations.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/Bytes.sol\":\"Bytes\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Bytes.sol\":{\"keccak256\":\"0xf80e4b96b6849936ea0fabd76cf81b13d7276295fddb1e1c07afb3ddf650b0ac\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6430007255ac11c6e9c4331a418f3af52ff66fbbae959f645301d025b20aeb08\",\"dweb:/ipfs/QmQE5fjmBBRw9ndnzJuC2uskYss1gbaR7JdazoCf1FGoBj\"]},\"@openzeppelin/contracts/utils/Panic.sol\":{\"keccak256\":\"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c6a5ff4f9fd8649b7ee20800b7fa387d3465bd77cf20c2d1068cd5c98e1ed57a\",\"dweb:/ipfs/QmVSaVJf9FXFhdYEYeCEfjMVHrxDh5qL4CGkxdMWpQCrqG\"]},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"keccak256\":\"0x59973a93b1f983f94e10529f46ca46544a9fec2b5f56fb1390bbe9e0dc79f857\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c55ef8f0b9719790c2ae6f81d80a59ffb89f2f0abe6bc065585bd79edce058c5\",\"dweb:/ipfs/QmNNmCbX9NjPXKqHJN8R1WC2rNeZSQrPZLd6FF6AKLyH5Y\"]},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"keccak256\":\"0xc8cae21c9ae4a46e5162ff9bf5b351d6fa6a6eba72d515f3bc1bdfeda7fdf083\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce830ebcf28e31643caba318996db3763c36d52cd0f23798ba83c135355d45e9\",\"dweb:/ipfs/QmdGPcvptHN7UBCbUYBbRX3hiRVRFLRwno8b4uga6uFNif\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/Context.sol": { + "Context": { + "abi": [], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Provides information about the current execution context, including the sender of the transaction and its data. While these are generally available via msg.sender and msg.data, they should not be accessed in such a direct manner, since when dealing with meta-transactions the account sending and paying for execution may not be the actual sender (as far as an application is concerned). This contract is only required for intermediate, library-like contracts.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/Context.sol\":\"Context\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Context.sol\":{\"keccak256\":\"0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6a708e8a5bdb1011c2c381c9a5cfd8a9a956d7d0a9dc1bd8bcdaf52f76ef2f12\",\"dweb:/ipfs/Qmax9WHBnVsZP46ZxEMNRQpLQnrdE4dK8LehML1Py8FowF\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/Panic.sol": { + "Panic": { + "abi": [], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea2646970667358221220cca8e34ba4a10a3072e457ee409c3e14973552ffad66786674cea596605f229764736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xCC 0xA8 0xE3 0x4B LOG4 LOG1 EXP ADDRESS PUSH19 0xE457EE409C3E14973552FFAD66786674CEA596 PUSH1 0x5F 0x22 SWAP8 PUSH5 0x736F6C6343 STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "657:1315:10:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;657:1315:10;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea2646970667358221220cca8e34ba4a10a3072e457ee409c3e14973552ffad66786674cea596605f229764736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xCC 0xA8 0xE3 0x4B LOG4 LOG1 EXP ADDRESS PUSH19 0xE457EE409C3E14973552FFAD66786674CEA596 PUSH1 0x5F 0x22 SWAP8 PUSH5 0x736F6C6343 STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "657:1315:10:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Helper library for emitting standardized panic codes. ```solidity contract Example { using Panic for uint256; // Use any of the declared internal constants function foo() { Panic.GENERIC.panic(); } // Alternatively function foo() { Panic.panic(Panic.GENERIC); } } ``` Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil]. _Available since v5.1._\",\"kind\":\"dev\",\"methods\":{},\"stateVariables\":{\"ARRAY_OUT_OF_BOUNDS\":{\"details\":\"array out of bounds access\"},\"ASSERT\":{\"details\":\"used by the assert() builtin\"},\"DIVISION_BY_ZERO\":{\"details\":\"division or modulo by zero\"},\"EMPTY_ARRAY_POP\":{\"details\":\"empty array pop\"},\"ENUM_CONVERSION_ERROR\":{\"details\":\"enum conversion error\"},\"GENERIC\":{\"details\":\"generic / unspecified error\"},\"INVALID_INTERNAL_FUNCTION\":{\"details\":\"calling invalid internal function\"},\"RESOURCE_ERROR\":{\"details\":\"resource error (too large allocation or too large array)\"},\"STORAGE_ENCODING_ERROR\":{\"details\":\"invalid encoding in storage\"},\"UNDER_OVERFLOW\":{\"details\":\"arithmetic underflow or overflow\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/Panic.sol\":\"Panic\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Panic.sol\":{\"keccak256\":\"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c6a5ff4f9fd8649b7ee20800b7fa387d3465bd77cf20c2d1068cd5c98e1ed57a\",\"dweb:/ipfs/QmVSaVJf9FXFhdYEYeCEfjMVHrxDh5qL4CGkxdMWpQCrqG\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/ReentrancyGuard.sol": { + "ReentrancyGuard": { + "abi": [ + { + "inputs": [], + "name": "ReentrancyGuardReentrantCall", + "type": "error" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"ReentrancyGuardReentrantCall\",\"type\":\"error\"}],\"devdoc\":{\"custom:stateless\":\"\",\"details\":\"Contract module that helps prevent reentrant calls to a function. Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier available, which can be applied to functions to make sure there are no nested (reentrant) calls to them. Note that because there is a single `nonReentrant` guard, functions marked as `nonReentrant` may not call one another. This can be worked around by making those functions `private`, and then adding `external` `nonReentrant` entry points to them. TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at, consider using {ReentrancyGuardTransient} instead. TIP: If you would like to learn more about reentrancy and alternative ways to protect against it, check out our blog post https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. IMPORTANT: Deprecated. This storage-based reentrancy guard will be removed and replaced by the {ReentrancyGuardTransient} variant in v6.0.\",\"errors\":{\"ReentrancyGuardReentrantCall()\":[{\"details\":\"Unauthorized reentrant call.\"}]},\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/ReentrancyGuard.sol\":\"ReentrancyGuard\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/ReentrancyGuard.sol\":{\"keccak256\":\"0xa516cbf1c7d15d3517c2d668601ce016c54395bf5171918a14e2686977465f53\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1e1d079e8edfb58efd23a311e315a4807b01b5d1cf153f8fa2d0608b9dec3e99\",\"dweb:/ipfs/QmTBExeX2SDTkn5xbk5ssbYSx7VqRp9H4Ux1CY4uQM4b9N\"]},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"keccak256\":\"0xcf74f855663ce2ae00ed8352666b7935f6cddea2932fdf2c3ecd30a9b1cd0e97\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9f660b1f351b757dfe01438e59888f31f33ded3afcf5cb5b0d9bf9aa6f320a8b\",\"dweb:/ipfs/QmarDJ5hZEgBtCmmrVzEZWjub9769eD686jmzb2XpSU1cM\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/ShortStrings.sol": { + "ShortStrings": { + "abi": [ + { + "inputs": [], + "name": "InvalidShortString", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "str", + "type": "string" + } + ], + "name": "StringTooLong", + "type": "error" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212205331629f8f9bf0cbfbabc3d9173056cd00dba4e3cc0330036bc4382e2359a42464736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 MSTORE8 BALANCE PUSH3 0x9F8F9B CREATE 0xCB 0xFB 0xAB 0xC3 0xD9 OR ADDRESS JUMP 0xCD STOP 0xDB LOG4 0xE3 0xCC SUB ADDRESS SUB PUSH12 0xC4382E2359A42464736F6C63 NUMBER STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "1255:3054:12:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;1255:3054:12;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212205331629f8f9bf0cbfbabc3d9173056cd00dba4e3cc0330036bc4382e2359a42464736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 MSTORE8 BALANCE PUSH3 0x9F8F9B CREATE 0xCB 0xFB 0xAB 0xC3 0xD9 OR ADDRESS JUMP 0xCD STOP 0xDB LOG4 0xE3 0xCC SUB ADDRESS SUB PUSH12 0xC4382E2359A42464736F6C63 NUMBER STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "1255:3054:12:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"InvalidShortString\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"str\",\"type\":\"string\"}],\"name\":\"StringTooLong\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"This library provides functions to convert short memory strings into a `ShortString` type that can be used as an immutable variable. Strings of arbitrary length can be optimized using this library if they are short enough (up to 31 bytes) by packing them with their length (1 byte) in a single EVM word (32 bytes). Additionally, a fallback mechanism can be used for every other case. Usage example: ```solidity contract Named { using ShortStrings for *; ShortString private immutable _name; string private _nameFallback; constructor(string memory contractName) { _name = contractName.toShortStringWithFallback(_nameFallback); } function name() external view returns (string memory) { return _name.toStringWithFallback(_nameFallback); } } ```\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/ShortStrings.sol\":\"ShortStrings\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/ShortStrings.sol\":{\"keccak256\":\"0x0768b3bdb701fe4994b3be932ca8635551dfebe04c645f77500322741bebf57c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a2059f9ca8d3c11c49ca49fc9c5fb070f18cc85d12a7688e45322ed0e2a1cb99\",\"dweb:/ipfs/QmS2gwX51RAvSw4tYbjHccY2CKbh2uvDzqHLAFXdsddgia\"]},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"keccak256\":\"0xcf74f855663ce2ae00ed8352666b7935f6cddea2932fdf2c3ecd30a9b1cd0e97\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9f660b1f351b757dfe01438e59888f31f33ded3afcf5cb5b0d9bf9aa6f320a8b\",\"dweb:/ipfs/QmarDJ5hZEgBtCmmrVzEZWjub9769eD686jmzb2XpSU1cM\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "StorageSlot": { + "abi": [], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212202e11909616c8a357ae57cd11f3e744f7b7de3a3174b44a2b6467fa9904f2585764736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0x2E GT SWAP1 SWAP7 AND 0xC8 LOG3 JUMPI 0xAE JUMPI 0xCD GT RETURN 0xE7 PREVRANDAO 0xF7 0xB7 0xDE GASPRICE BALANCE PUSH21 0xB44A2B6467FA9904F2585764736F6C634300081C00 CALLER ", + "sourceMap": "1407:2774:13:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;1407:2774:13;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212202e11909616c8a357ae57cd11f3e744f7b7de3a3174b44a2b6467fa9904f2585764736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0x2E GT SWAP1 SWAP7 AND 0xC8 LOG3 JUMPI 0xAE JUMPI 0xCD GT RETURN 0xE7 PREVRANDAO 0xF7 0xB7 0xDE GASPRICE BALANCE PUSH21 0xB44A2B6467FA9904F2585764736F6C634300081C00 CALLER ", + "sourceMap": "1407:2774:13:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Library for reading and writing primitive types to specific storage slots. Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. This library helps with reading and writing to such slots without the need for inline assembly. The functions in this library return Slot structs that contain a `value` member that can be used to read or write. Example usage to set ERC-1967 implementation slot: ```solidity contract ERC1967 { // Define the slot. Alternatively, use the SlotDerivation library to derive the slot. bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; function _getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; } function _setImplementation(address newImplementation) internal { require(newImplementation.code.length > 0); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } } ``` TIP: Consider using this library along with {SlotDerivation}.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/StorageSlot.sol\":\"StorageSlot\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"keccak256\":\"0xcf74f855663ce2ae00ed8352666b7935f6cddea2932fdf2c3ecd30a9b1cd0e97\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9f660b1f351b757dfe01438e59888f31f33ded3afcf5cb5b0d9bf9aa6f320a8b\",\"dweb:/ipfs/QmarDJ5hZEgBtCmmrVzEZWjub9769eD686jmzb2XpSU1cM\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "Strings": { + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "length", + "type": "uint256" + } + ], + "name": "StringsInsufficientHexLength", + "type": "error" + }, + { + "inputs": [], + "name": "StringsInvalidAddressFormat", + "type": "error" + }, + { + "inputs": [], + "name": "StringsInvalidChar", + "type": "error" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea2646970667358221220172eadb738f4060c9567e763c4ffa1f0bf958b6bde49f20427622bab52603b4264736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 OR 0x2E 0xAD 0xB7 CODESIZE DELEGATECALL MOD 0xC SWAP6 PUSH8 0xE763C4FFA1F0BF95 DUP12 PUSH12 0xDE49F20427622BAB52603B42 PUSH5 0x736F6C6343 STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "332:21205:14:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;332:21205:14;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea2646970667358221220172eadb738f4060c9567e763c4ffa1f0bf958b6bde49f20427622bab52603b4264736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 OR 0x2E 0xAD 0xB7 CODESIZE DELEGATECALL MOD 0xC SWAP6 PUSH8 0xE763C4FFA1F0BF95 DUP12 PUSH12 0xDE49F20427622BAB52603B42 PUSH5 0x736F6C6343 STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "332:21205:14:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"length\",\"type\":\"uint256\"}],\"name\":\"StringsInsufficientHexLength\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StringsInvalidAddressFormat\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StringsInvalidChar\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"String operations.\",\"errors\":{\"StringsInsufficientHexLength(uint256,uint256)\":[{\"details\":\"The `value` string doesn't fit in the specified `length`.\"}],\"StringsInvalidAddressFormat()\":[{\"details\":\"The string being parsed is not a properly formatted address.\"}],\"StringsInvalidChar()\":[{\"details\":\"The string being parsed contains characters that are not in scope of the given base.\"}]},\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/Strings.sol\":\"Strings\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Bytes.sol\":{\"keccak256\":\"0xf80e4b96b6849936ea0fabd76cf81b13d7276295fddb1e1c07afb3ddf650b0ac\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6430007255ac11c6e9c4331a418f3af52ff66fbbae959f645301d025b20aeb08\",\"dweb:/ipfs/QmQE5fjmBBRw9ndnzJuC2uskYss1gbaR7JdazoCf1FGoBj\"]},\"@openzeppelin/contracts/utils/Panic.sol\":{\"keccak256\":\"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c6a5ff4f9fd8649b7ee20800b7fa387d3465bd77cf20c2d1068cd5c98e1ed57a\",\"dweb:/ipfs/QmVSaVJf9FXFhdYEYeCEfjMVHrxDh5qL4CGkxdMWpQCrqG\"]},\"@openzeppelin/contracts/utils/Strings.sol\":{\"keccak256\":\"0x1fdc2de9585ab0f1c417f02a873a2b6343cd64bb7ffec6b00ffa11a4a158d9e8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1ab223a3d969c6cd7610049431dd42740960c477e45878f5d8b54411f7a32bdc\",\"dweb:/ipfs/QmWumhjvhpKcwx3vDPQninsNVTc3BGvqaihkQakFkQYpaS\"]},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"keccak256\":\"0x59973a93b1f983f94e10529f46ca46544a9fec2b5f56fb1390bbe9e0dc79f857\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c55ef8f0b9719790c2ae6f81d80a59ffb89f2f0abe6bc065585bd79edce058c5\",\"dweb:/ipfs/QmNNmCbX9NjPXKqHJN8R1WC2rNeZSQrPZLd6FF6AKLyH5Y\"]},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"keccak256\":\"0xc8cae21c9ae4a46e5162ff9bf5b351d6fa6a6eba72d515f3bc1bdfeda7fdf083\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce830ebcf28e31643caba318996db3763c36d52cd0f23798ba83c135355d45e9\",\"dweb:/ipfs/QmdGPcvptHN7UBCbUYBbRX3hiRVRFLRwno8b4uga6uFNif\"]},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"keccak256\":\"0xb1970fac7b64e6c09611e6691791e848d5e3fe410fa5899e7df2e0afd77a99e3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://db5fbb3dddd8b7047465b62575d96231ba8a2774d37fb4737fbf23340fabbb03\",\"dweb:/ipfs/QmVUSvooZKEdEdap619tcJjTLcAuH6QBdZqAzWwnAXZAWJ\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "ECDSA": { + "abi": [ + { + "inputs": [], + "name": "ECDSAInvalidSignature", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "length", + "type": "uint256" + } + ], + "name": "ECDSAInvalidSignatureLength", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "ECDSAInvalidSignatureS", + "type": "error" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea2646970667358221220861fc53c54256420d26202ed953c1a6a70251bfd2cbefbfb0e98c93d2669cfb464736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 DUP7 0x1F 0xC5 EXTCODECOPY SLOAD 0x25 PUSH5 0x20D26202ED SWAP6 EXTCODECOPY BYTE PUSH11 0x70251BFD2CBEFBFB0E98C9 RETURNDATASIZE 0x26 PUSH10 0xCFB464736F6C63430008 SHR STOP CALLER ", + "sourceMap": "344:11807:15:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;344:11807:15;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea2646970667358221220861fc53c54256420d26202ed953c1a6a70251bfd2cbefbfb0e98c93d2669cfb464736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 DUP7 0x1F 0xC5 EXTCODECOPY SLOAD 0x25 PUSH5 0x20D26202ED SWAP6 EXTCODECOPY BYTE PUSH11 0x70251BFD2CBEFBFB0E98C9 RETURNDATASIZE 0x26 PUSH10 0xCFB464736F6C63430008 SHR STOP CALLER ", + "sourceMap": "344:11807:15:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"ECDSAInvalidSignature\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"length\",\"type\":\"uint256\"}],\"name\":\"ECDSAInvalidSignatureLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"ECDSAInvalidSignatureS\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"Elliptic Curve Digital Signature Algorithm (ECDSA) operations. These functions can be used to verify that a message was signed by the holder of the private keys of a given address.\",\"errors\":{\"ECDSAInvalidSignature()\":[{\"details\":\"The signature is invalid.\"}],\"ECDSAInvalidSignatureLength(uint256)\":[{\"details\":\"The signature has an invalid length.\"}],\"ECDSAInvalidSignatureS(bytes32)\":[{\"details\":\"The signature has an S value that is in the upper half order.\"}]},\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":\"ECDSA\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"keccak256\":\"0xbeb5cad8aaabe0d35d2ec1a8414d91e81e5a8ca679add4cf57e2f33476861f40\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ebb272a5ee2da4e8bd5551334e0ce8dce4e9c56a04570d6bf046d260fab3116a\",\"dweb:/ipfs/QmNw6RyM769qcqFocDq6HJMG2WiEnQbvizpRaUXsACHho2\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/cryptography/EIP712.sol": { + "EIP712": { + "abi": [ + { + "inputs": [], + "name": "InvalidShortString", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "str", + "type": "string" + } + ], + "name": "StringTooLong", + "type": "error" + }, + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "methodIdentifiers": { + "eip712Domain()": "84b0196e" + } + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"InvalidShortString\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"str\",\"type\":\"string\"}],\"name\":\"StringTooLong\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"EIP712DomainChanged\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"eip712Domain\",\"outputs\":[{\"internalType\":\"bytes1\",\"name\":\"fields\",\"type\":\"bytes1\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"verifyingContract\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"extensions\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"custom:oz-upgrades-unsafe-allow\":\"state-variable-immutable\",\"details\":\"https://eips.ethereum.org/EIPS/eip-712[EIP-712] is a standard for hashing and signing of typed structured data. The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to produce the hash of their typed data using a combination of `abi.encode` and `keccak256`. This contract implements the EIP-712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA ({_hashTypedDataV4}). The implementation of the domain separator was designed to be as efficient as possible while still properly updating the chain id to protect against replay attacks on an eventual fork of the chain. NOTE: This contract implements the version of the encoding known as \\\"v4\\\", as implemented by the JSON RPC method https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\",\"events\":{\"EIP712DomainChanged()\":{\"details\":\"MAY be emitted to signal that the domain could have changed.\"}},\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the domain separator and parameter caches. The meaning of `name` and `version` is specified in https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP-712]: - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. - `version`: the current major version of the signing domain. NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart contract upgrade].\"},\"eip712Domain()\":{\"details\":\"returns the fields and values that describe the domain separator used by this contract for EIP-712 signature.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/cryptography/EIP712.sol\":\"EIP712\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/IERC5267.sol\":{\"keccak256\":\"0xfb223a85dd0b2175cfbbaa325a744e2cd74ecd17c3df2b77b0722f991d2725ee\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://84bf1dea0589ec49c8d15d559cc6d86ee493048a89b2d4adb60fbe705a3d89ae\",\"dweb:/ipfs/Qmd56n556d529wk2pRMhYhm5nhMDhviwereodDikjs68w1\"]},\"@openzeppelin/contracts/utils/Bytes.sol\":{\"keccak256\":\"0xf80e4b96b6849936ea0fabd76cf81b13d7276295fddb1e1c07afb3ddf650b0ac\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6430007255ac11c6e9c4331a418f3af52ff66fbbae959f645301d025b20aeb08\",\"dweb:/ipfs/QmQE5fjmBBRw9ndnzJuC2uskYss1gbaR7JdazoCf1FGoBj\"]},\"@openzeppelin/contracts/utils/Panic.sol\":{\"keccak256\":\"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c6a5ff4f9fd8649b7ee20800b7fa387d3465bd77cf20c2d1068cd5c98e1ed57a\",\"dweb:/ipfs/QmVSaVJf9FXFhdYEYeCEfjMVHrxDh5qL4CGkxdMWpQCrqG\"]},\"@openzeppelin/contracts/utils/ShortStrings.sol\":{\"keccak256\":\"0x0768b3bdb701fe4994b3be932ca8635551dfebe04c645f77500322741bebf57c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a2059f9ca8d3c11c49ca49fc9c5fb070f18cc85d12a7688e45322ed0e2a1cb99\",\"dweb:/ipfs/QmS2gwX51RAvSw4tYbjHccY2CKbh2uvDzqHLAFXdsddgia\"]},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"keccak256\":\"0xcf74f855663ce2ae00ed8352666b7935f6cddea2932fdf2c3ecd30a9b1cd0e97\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9f660b1f351b757dfe01438e59888f31f33ded3afcf5cb5b0d9bf9aa6f320a8b\",\"dweb:/ipfs/QmarDJ5hZEgBtCmmrVzEZWjub9769eD686jmzb2XpSU1cM\"]},\"@openzeppelin/contracts/utils/Strings.sol\":{\"keccak256\":\"0x1fdc2de9585ab0f1c417f02a873a2b6343cd64bb7ffec6b00ffa11a4a158d9e8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1ab223a3d969c6cd7610049431dd42740960c477e45878f5d8b54411f7a32bdc\",\"dweb:/ipfs/QmWumhjvhpKcwx3vDPQninsNVTc3BGvqaihkQakFkQYpaS\"]},\"@openzeppelin/contracts/utils/cryptography/EIP712.sol\":{\"keccak256\":\"0x8440117ea216b97a7bad690a67449fd372c840d073c8375822667e14702782b4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ebb6645995b8290d0b9121825e2533e4e28977b2c6befee76e15e58f0feb61d4\",\"dweb:/ipfs/QmVR72j6kL5R2txuihieDev1FeTi4KWJS1Z6ABbwL3Qtph\"]},\"@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol\":{\"keccak256\":\"0x6d8579873b9650426bfbd2a754092d1725049ca05e4e3c8c2c82dd9f3453129d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1fa3127a8968d55096d37124a9e212013af112affa5e30b84a1d22263c31576c\",\"dweb:/ipfs/QmetxaVcn5Q6nkpF9yXzaxPQ7d3rgrhV13sTH9BgiuzGJL\"]},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"keccak256\":\"0x59973a93b1f983f94e10529f46ca46544a9fec2b5f56fb1390bbe9e0dc79f857\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c55ef8f0b9719790c2ae6f81d80a59ffb89f2f0abe6bc065585bd79edce058c5\",\"dweb:/ipfs/QmNNmCbX9NjPXKqHJN8R1WC2rNeZSQrPZLd6FF6AKLyH5Y\"]},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"keccak256\":\"0xc8cae21c9ae4a46e5162ff9bf5b351d6fa6a6eba72d515f3bc1bdfeda7fdf083\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce830ebcf28e31643caba318996db3763c36d52cd0f23798ba83c135355d45e9\",\"dweb:/ipfs/QmdGPcvptHN7UBCbUYBbRX3hiRVRFLRwno8b4uga6uFNif\"]},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"keccak256\":\"0xb1970fac7b64e6c09611e6691791e848d5e3fe410fa5899e7df2e0afd77a99e3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://db5fbb3dddd8b7047465b62575d96231ba8a2774d37fb4737fbf23340fabbb03\",\"dweb:/ipfs/QmVUSvooZKEdEdap619tcJjTLcAuH6QBdZqAzWwnAXZAWJ\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol": { + "MessageHashUtils": { + "abi": [ + { + "inputs": [], + "name": "ERC5267ExtensionsNotSupported", + "type": "error" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212206131ed8ee4dbbce47bcc4c6f88c9616eec0a3b2c76e6ecedd23ff36dd351a5da64736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 PUSH2 0x31ED DUP15 0xE4 0xDB 0xBC 0xE4 PUSH28 0xCC4C6F88C9616EEC0A3B2C76E6ECEDD23FF36DD351A5DA64736F6C63 NUMBER STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "521:8109:17:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;521:8109:17;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212206131ed8ee4dbbce47bcc4c6f88c9616eec0a3b2c76e6ecedd23ff36dd351a5da64736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 PUSH2 0x31ED DUP15 0xE4 0xDB 0xBC 0xE4 PUSH28 0xCC4C6F88C9616EEC0A3B2C76E6ECEDD23FF36DD351A5DA64736F6C63 NUMBER STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "521:8109:17:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"ERC5267ExtensionsNotSupported\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing. The library provides methods for generating a hash of a message that conforms to the https://eips.ethereum.org/EIPS/eip-191[ERC-191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712] specifications.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol\":\"MessageHashUtils\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Bytes.sol\":{\"keccak256\":\"0xf80e4b96b6849936ea0fabd76cf81b13d7276295fddb1e1c07afb3ddf650b0ac\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6430007255ac11c6e9c4331a418f3af52ff66fbbae959f645301d025b20aeb08\",\"dweb:/ipfs/QmQE5fjmBBRw9ndnzJuC2uskYss1gbaR7JdazoCf1FGoBj\"]},\"@openzeppelin/contracts/utils/Panic.sol\":{\"keccak256\":\"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c6a5ff4f9fd8649b7ee20800b7fa387d3465bd77cf20c2d1068cd5c98e1ed57a\",\"dweb:/ipfs/QmVSaVJf9FXFhdYEYeCEfjMVHrxDh5qL4CGkxdMWpQCrqG\"]},\"@openzeppelin/contracts/utils/Strings.sol\":{\"keccak256\":\"0x1fdc2de9585ab0f1c417f02a873a2b6343cd64bb7ffec6b00ffa11a4a158d9e8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1ab223a3d969c6cd7610049431dd42740960c477e45878f5d8b54411f7a32bdc\",\"dweb:/ipfs/QmWumhjvhpKcwx3vDPQninsNVTc3BGvqaihkQakFkQYpaS\"]},\"@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol\":{\"keccak256\":\"0x6d8579873b9650426bfbd2a754092d1725049ca05e4e3c8c2c82dd9f3453129d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1fa3127a8968d55096d37124a9e212013af112affa5e30b84a1d22263c31576c\",\"dweb:/ipfs/QmetxaVcn5Q6nkpF9yXzaxPQ7d3rgrhV13sTH9BgiuzGJL\"]},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"keccak256\":\"0x59973a93b1f983f94e10529f46ca46544a9fec2b5f56fb1390bbe9e0dc79f857\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c55ef8f0b9719790c2ae6f81d80a59ffb89f2f0abe6bc065585bd79edce058c5\",\"dweb:/ipfs/QmNNmCbX9NjPXKqHJN8R1WC2rNeZSQrPZLd6FF6AKLyH5Y\"]},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"keccak256\":\"0xc8cae21c9ae4a46e5162ff9bf5b351d6fa6a6eba72d515f3bc1bdfeda7fdf083\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce830ebcf28e31643caba318996db3763c36d52cd0f23798ba83c135355d45e9\",\"dweb:/ipfs/QmdGPcvptHN7UBCbUYBbRX3hiRVRFLRwno8b4uga6uFNif\"]},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"keccak256\":\"0xb1970fac7b64e6c09611e6691791e848d5e3fe410fa5899e7df2e0afd77a99e3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://db5fbb3dddd8b7047465b62575d96231ba8a2774d37fb4737fbf23340fabbb03\",\"dweb:/ipfs/QmVUSvooZKEdEdap619tcJjTLcAuH6QBdZqAzWwnAXZAWJ\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "IERC165": { + "abi": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "methodIdentifiers": { + "supportsInterface(bytes4)": "01ffc9a7" + } + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Interface of the ERC-165 standard, as defined in the https://eips.ethereum.org/EIPS/eip-165[ERC]. Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}.\",\"kind\":\"dev\",\"methods\":{\"supportsInterface(bytes4)\":{\"details\":\"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section] to learn more about how these ids are created. This function call must use less than 30 000 gas.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":\"IERC165\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x8891738ffe910f0cf2da09566928589bf5d63f4524dd734fd9cedbac3274dd5c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://971f954442df5c2ef5b5ebf1eb245d7105d9fbacc7386ee5c796df1d45b21617\",\"dweb:/ipfs/QmadRjHbkicwqwwh61raUEapaVEtaLMcYbQZWs9gUkgj3u\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "Math": { + "abi": [], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea264697066735822122091005e0c663891cd7c55899184f368372b30b74607e9cbbb4e1eb5ac7371189564736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 SWAP2 STOP MCOPY 0xC PUSH7 0x3891CD7C558991 DUP5 RETURN PUSH9 0x372B30B74607E9CBBB 0x4E 0x1E 0xB5 0xAC PUSH20 0x71189564736F6C634300081C0033000000000000 ", + "sourceMap": "281:32382:19:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;281:32382:19;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea264697066735822122091005e0c663891cd7c55899184f368372b30b74607e9cbbb4e1eb5ac7371189564736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 SWAP2 STOP MCOPY 0xC PUSH7 0x3891CD7C558991 DUP5 RETURN PUSH9 0x372B30B74607E9CBBB 0x4E 0x1E 0xB5 0xAC PUSH20 0x71189564736F6C634300081C0033000000000000 ", + "sourceMap": "281:32382:19:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Standard math utilities missing in the Solidity language.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/math/Math.sol\":\"Math\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Panic.sol\":{\"keccak256\":\"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c6a5ff4f9fd8649b7ee20800b7fa387d3465bd77cf20c2d1068cd5c98e1ed57a\",\"dweb:/ipfs/QmVSaVJf9FXFhdYEYeCEfjMVHrxDh5qL4CGkxdMWpQCrqG\"]},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"keccak256\":\"0x59973a93b1f983f94e10529f46ca46544a9fec2b5f56fb1390bbe9e0dc79f857\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c55ef8f0b9719790c2ae6f81d80a59ffb89f2f0abe6bc065585bd79edce058c5\",\"dweb:/ipfs/QmNNmCbX9NjPXKqHJN8R1WC2rNeZSQrPZLd6FF6AKLyH5Y\"]},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"keccak256\":\"0xc8cae21c9ae4a46e5162ff9bf5b351d6fa6a6eba72d515f3bc1bdfeda7fdf083\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce830ebcf28e31643caba318996db3763c36d52cd0f23798ba83c135355d45e9\",\"dweb:/ipfs/QmdGPcvptHN7UBCbUYBbRX3hiRVRFLRwno8b4uga6uFNif\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/math/SafeCast.sol": { + "SafeCast": { + "abi": [ + { + "inputs": [ + { + "internalType": "uint8", + "name": "bits", + "type": "uint8" + }, + { + "internalType": "int256", + "name": "value", + "type": "int256" + } + ], + "name": "SafeCastOverflowedIntDowncast", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "int256", + "name": "value", + "type": "int256" + } + ], + "name": "SafeCastOverflowedIntToUint", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "bits", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "SafeCastOverflowedUintDowncast", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "SafeCastOverflowedUintToInt", + "type": "error" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212206e23643c396df695b2797f650857ef0eb0576e47d97a4599ed83883f99aad72664736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 PUSH15 0x23643C396DF695B2797F650857EF0E 0xB0 JUMPI PUSH15 0x47D97A4599ED83883F99AAD7266473 PUSH16 0x6C634300081C00330000000000000000 ", + "sourceMap": "769:34170:20:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;769:34170:20;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212206e23643c396df695b2797f650857ef0eb0576e47d97a4599ed83883f99aad72664736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 PUSH15 0x23643C396DF695B2797F650857EF0E 0xB0 JUMPI PUSH15 0x47D97A4599ED83883F99AAD7266473 PUSH16 0x6C634300081C00330000000000000000 ", + "sourceMap": "769:34170:20:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"bits\",\"type\":\"uint8\"},{\"internalType\":\"int256\",\"name\":\"value\",\"type\":\"int256\"}],\"name\":\"SafeCastOverflowedIntDowncast\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"int256\",\"name\":\"value\",\"type\":\"int256\"}],\"name\":\"SafeCastOverflowedIntToUint\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"bits\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"SafeCastOverflowedUintDowncast\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"SafeCastOverflowedUintToInt\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow checks. Downcasting from uint256/int256 in Solidity does not revert on overflow. This can easily result in undesired exploitation or bugs, since developers usually assume that overflows raise errors. `SafeCast` restores this intuition by reverting the transaction when such an operation overflows. Using this library instead of the unchecked operations eliminates an entire class of bugs, so it's recommended to use it always.\",\"errors\":{\"SafeCastOverflowedIntDowncast(uint8,int256)\":[{\"details\":\"Value doesn't fit in an int of `bits` size.\"}],\"SafeCastOverflowedIntToUint(int256)\":[{\"details\":\"An int value doesn't fit in a uint of `bits` size.\"}],\"SafeCastOverflowedUintDowncast(uint8,uint256)\":[{\"details\":\"Value doesn't fit in a uint of `bits` size.\"}],\"SafeCastOverflowedUintToInt(uint256)\":[{\"details\":\"A uint value doesn't fit in an int of `bits` size.\"}]},\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/math/SafeCast.sol\":\"SafeCast\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"keccak256\":\"0xc8cae21c9ae4a46e5162ff9bf5b351d6fa6a6eba72d515f3bc1bdfeda7fdf083\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce830ebcf28e31643caba318996db3763c36d52cd0f23798ba83c135355d45e9\",\"dweb:/ipfs/QmdGPcvptHN7UBCbUYBbRX3hiRVRFLRwno8b4uga6uFNif\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "SignedMath": { + "abi": [], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212202c4428eb6666cae863602bfb74d48242f67136c2baeeed29a59362a5e64d7e8564736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0x2C PREVRANDAO 0x28 0xEB PUSH7 0x66CAE863602BFB PUSH21 0xD48242F67136C2BAEEED29A59362A5E64D7E856473 PUSH16 0x6C634300081C00330000000000000000 ", + "sourceMap": "258:2354:21:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;258:2354:21;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212202c4428eb6666cae863602bfb74d48242f67136c2baeeed29a59362a5e64d7e8564736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0x2C PREVRANDAO 0x28 0xEB PUSH7 0x66CAE863602BFB PUSH21 0xD48242F67136C2BAEEED29A59362A5E64D7E856473 PUSH16 0x6C634300081C00330000000000000000 ", + "sourceMap": "258:2354:21:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Standard signed math utilities missing in the Solidity language.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/math/SignedMath.sol\":\"SignedMath\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"keccak256\":\"0xc8cae21c9ae4a46e5162ff9bf5b351d6fa6a6eba72d515f3bc1bdfeda7fdf083\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce830ebcf28e31643caba318996db3763c36d52cd0f23798ba83c135355d45e9\",\"dweb:/ipfs/QmdGPcvptHN7UBCbUYBbRX3hiRVRFLRwno8b4uga6uFNif\"]},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"keccak256\":\"0xb1970fac7b64e6c09611e6691791e848d5e3fe410fa5899e7df2e0afd77a99e3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://db5fbb3dddd8b7047465b62575d96231ba8a2774d37fb4737fbf23340fabbb03\",\"dweb:/ipfs/QmVUSvooZKEdEdap619tcJjTLcAuH6QBdZqAzWwnAXZAWJ\"]}},\"version\":1}" + } + }, + "contracts/TokenRelayer.sol": { + "TokenRelayer": { + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_destinationContract", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "ECDSAInvalidSignature", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "length", + "type": "uint256" + } + ], + "name": "ECDSAInvalidSignatureLength", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "ECDSAInvalidSignatureS", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidShortString", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnableInvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "OwnableUnauthorizedAccount", + "type": "error" + }, + { + "inputs": [], + "name": "ReentrancyGuardReentrantCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "SafeERC20FailedOperation", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "str", + "type": "string" + } + ], + "name": "StringTooLong", + "type": "error" + }, + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "ETHWithdrawn", + "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": true, + "internalType": "address", + "name": "signer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RelayerExecuted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "TokenWithdrawn", + "type": "event" + }, + { + "inputs": [], + "name": "destinationContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "permitV", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "permitR", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "permitS", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "payloadData", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "payloadValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "payloadNonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "payloadDeadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "payloadV", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "payloadR", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "payloadS", + "type": "bytes32" + } + ], + "internalType": "struct TokenRelayer.ExecuteParams", + "name": "params", + "type": "tuple" + } + ], + "name": "execute", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "signer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + } + ], + "name": "isExecutionCompleted", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "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": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "usedPayloadNonces", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdrawETH", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdrawToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "evm": { + "bytecode": { + "functionDebugData": { + "@_1746": { + "entryPoint": null, + "id": 1746, + "parameterSlots": 0, + "returnSlots": 0 + }, + "@_4234": { + "entryPoint": null, + "id": 4234, + "parameterSlots": 2, + "returnSlots": 0 + }, + "@_50": { + "entryPoint": null, + "id": 50, + "parameterSlots": 1, + "returnSlots": 0 + }, + "@_8232": { + "entryPoint": null, + "id": 8232, + "parameterSlots": 1, + "returnSlots": 0 + }, + "@_buildDomainSeparator_4281": { + "entryPoint": null, + "id": 4281, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@_reentrancyGuardStorageSlot_1826": { + "entryPoint": null, + "id": 1826, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@_transferOwnership_146": { + "entryPoint": 470, + "id": 146, + "parameterSlots": 1, + "returnSlots": 0 + }, + "@getStringSlot_2145": { + "entryPoint": null, + "id": 2145, + "parameterSlots": 1, + "returnSlots": 1 + }, + "@getUint256Slot_2112": { + "entryPoint": null, + "id": 2112, + "parameterSlots": 1, + "returnSlots": 1 + }, + "@toShortStringWithFallback_1985": { + "entryPoint": 549, + "id": 1985, + "parameterSlots": 2, + "returnSlots": 1 + }, + "@toShortString_1887": { + "entryPoint": 599, + "id": 1887, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_decode_tuple_t_address_fromMemory": { + "entryPoint": 660, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_tuple_t_address__to_t_address__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_tuple_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__to_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 6, + "returnSlots": 1 + }, + "abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": 1043, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_480a3d2cf1e4838d740f40eac57f23eb6facc0baaf1a65a7b61df6a5a00ed368__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "array_dataslot_string_storage": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "clean_up_bytearray_end_slots_string_storage": { + "entryPoint": 781, + "id": null, + "parameterSlots": 3, + "returnSlots": 0 + }, + "convert_bytes_to_fixedbytes_from_t_bytes_memory_ptr_to_t_bytes32": { + "entryPoint": 1096, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "copy_byte_array_to_storage_from_t_string_memory_ptr_to_t_string_storage": { + "entryPoint": 857, + "id": null, + "parameterSlots": 2, + "returnSlots": 0 + }, + "extract_byte_array_length": { + "entryPoint": 725, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "extract_used_part_and_set_length_of_short_byte_array": { + "entryPoint": null, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "panic_error_0x41": { + "entryPoint": 705, + "id": null, + "parameterSlots": 0, + "returnSlots": 0 + } + }, + "generatedSources": [ + { + "ast": { + "nativeSrc": "0:4722:23", + "nodeType": "YulBlock", + "src": "0:4722:23", + "statements": [ + { + "nativeSrc": "6:3:23", + "nodeType": "YulBlock", + "src": "6:3:23", + "statements": [] + }, + { + "body": { + "nativeSrc": "95:209:23", + "nodeType": "YulBlock", + "src": "95:209:23", + "statements": [ + { + "body": { + "nativeSrc": "141:16:23", + "nodeType": "YulBlock", + "src": "141:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "150:1:23", + "nodeType": "YulLiteral", + "src": "150:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "153:1:23", + "nodeType": "YulLiteral", + "src": "153:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "143:6:23", + "nodeType": "YulIdentifier", + "src": "143:6:23" + }, + "nativeSrc": "143:12:23", + "nodeType": "YulFunctionCall", + "src": "143:12:23" + }, + "nativeSrc": "143:12:23", + "nodeType": "YulExpressionStatement", + "src": "143:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nativeSrc": "116:7:23", + "nodeType": "YulIdentifier", + "src": "116:7:23" + }, + { + "name": "headStart", + "nativeSrc": "125:9:23", + "nodeType": "YulIdentifier", + "src": "125:9:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "112:3:23", + "nodeType": "YulIdentifier", + "src": "112:3:23" + }, + "nativeSrc": "112:23:23", + "nodeType": "YulFunctionCall", + "src": "112:23:23" + }, + { + "kind": "number", + "nativeSrc": "137:2:23", + "nodeType": "YulLiteral", + "src": "137:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nativeSrc": "108:3:23", + "nodeType": "YulIdentifier", + "src": "108:3:23" + }, + "nativeSrc": "108:32:23", + "nodeType": "YulFunctionCall", + "src": "108:32:23" + }, + "nativeSrc": "105:52:23", + "nodeType": "YulIf", + "src": "105:52:23" + }, + { + "nativeSrc": "166:29:23", + "nodeType": "YulVariableDeclaration", + "src": "166:29:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "185:9:23", + "nodeType": "YulIdentifier", + "src": "185:9:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "179:5:23", + "nodeType": "YulIdentifier", + "src": "179:5:23" + }, + "nativeSrc": "179:16:23", + "nodeType": "YulFunctionCall", + "src": "179:16:23" + }, + "variables": [ + { + "name": "value", + "nativeSrc": "170:5:23", + "nodeType": "YulTypedName", + "src": "170:5:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "258:16:23", + "nodeType": "YulBlock", + "src": "258:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "267:1:23", + "nodeType": "YulLiteral", + "src": "267:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "270:1:23", + "nodeType": "YulLiteral", + "src": "270:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "260:6:23", + "nodeType": "YulIdentifier", + "src": "260:6:23" + }, + "nativeSrc": "260:12:23", + "nodeType": "YulFunctionCall", + "src": "260:12:23" + }, + "nativeSrc": "260:12:23", + "nodeType": "YulExpressionStatement", + "src": "260:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nativeSrc": "217:5:23", + "nodeType": "YulIdentifier", + "src": "217:5:23" + }, + { + "arguments": [ + { + "name": "value", + "nativeSrc": "228:5:23", + "nodeType": "YulIdentifier", + "src": "228:5:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "243:3:23", + "nodeType": "YulLiteral", + "src": "243:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "248:1:23", + "nodeType": "YulLiteral", + "src": "248:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "239:3:23", + "nodeType": "YulIdentifier", + "src": "239:3:23" + }, + "nativeSrc": "239:11:23", + "nodeType": "YulFunctionCall", + "src": "239:11:23" + }, + { + "kind": "number", + "nativeSrc": "252:1:23", + "nodeType": "YulLiteral", + "src": "252:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "235:3:23", + "nodeType": "YulIdentifier", + "src": "235:3:23" + }, + "nativeSrc": "235:19:23", + "nodeType": "YulFunctionCall", + "src": "235:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "224:3:23", + "nodeType": "YulIdentifier", + "src": "224:3:23" + }, + "nativeSrc": "224:31:23", + "nodeType": "YulFunctionCall", + "src": "224:31:23" + } + ], + "functionName": { + "name": "eq", + "nativeSrc": "214:2:23", + "nodeType": "YulIdentifier", + "src": "214:2:23" + }, + "nativeSrc": "214:42:23", + "nodeType": "YulFunctionCall", + "src": "214:42:23" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "207:6:23", + "nodeType": "YulIdentifier", + "src": "207:6:23" + }, + "nativeSrc": "207:50:23", + "nodeType": "YulFunctionCall", + "src": "207:50:23" + }, + "nativeSrc": "204:70:23", + "nodeType": "YulIf", + "src": "204:70:23" + }, + { + "nativeSrc": "283:15:23", + "nodeType": "YulAssignment", + "src": "283:15:23", + "value": { + "name": "value", + "nativeSrc": "293:5:23", + "nodeType": "YulIdentifier", + "src": "293:5:23" + }, + "variableNames": [ + { + "name": "value0", + "nativeSrc": "283:6:23", + "nodeType": "YulIdentifier", + "src": "283:6:23" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_address_fromMemory", + "nativeSrc": "14:290:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "61:9:23", + "nodeType": "YulTypedName", + "src": "61:9:23", + "type": "" + }, + { + "name": "dataEnd", + "nativeSrc": "72:7:23", + "nodeType": "YulTypedName", + "src": "72:7:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nativeSrc": "84:6:23", + "nodeType": "YulTypedName", + "src": "84:6:23", + "type": "" + } + ], + "src": "14:290:23" + }, + { + "body": { + "nativeSrc": "410:102:23", + "nodeType": "YulBlock", + "src": "410:102:23", + "statements": [ + { + "nativeSrc": "420:26:23", + "nodeType": "YulAssignment", + "src": "420:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "432:9:23", + "nodeType": "YulIdentifier", + "src": "432:9:23" + }, + { + "kind": "number", + "nativeSrc": "443:2:23", + "nodeType": "YulLiteral", + "src": "443:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "428:3:23", + "nodeType": "YulIdentifier", + "src": "428:3:23" + }, + "nativeSrc": "428:18:23", + "nodeType": "YulFunctionCall", + "src": "428:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "420:4:23", + "nodeType": "YulIdentifier", + "src": "420:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "462:9:23", + "nodeType": "YulIdentifier", + "src": "462:9:23" + }, + { + "arguments": [ + { + "name": "value0", + "nativeSrc": "477:6:23", + "nodeType": "YulIdentifier", + "src": "477:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "493:3:23", + "nodeType": "YulLiteral", + "src": "493:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "498:1:23", + "nodeType": "YulLiteral", + "src": "498:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "489:3:23", + "nodeType": "YulIdentifier", + "src": "489:3:23" + }, + "nativeSrc": "489:11:23", + "nodeType": "YulFunctionCall", + "src": "489:11:23" + }, + { + "kind": "number", + "nativeSrc": "502:1:23", + "nodeType": "YulLiteral", + "src": "502:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "485:3:23", + "nodeType": "YulIdentifier", + "src": "485:3:23" + }, + "nativeSrc": "485:19:23", + "nodeType": "YulFunctionCall", + "src": "485:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "473:3:23", + "nodeType": "YulIdentifier", + "src": "473:3:23" + }, + "nativeSrc": "473:32:23", + "nodeType": "YulFunctionCall", + "src": "473:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "455:6:23", + "nodeType": "YulIdentifier", + "src": "455:6:23" + }, + "nativeSrc": "455:51:23", + "nodeType": "YulFunctionCall", + "src": "455:51:23" + }, + "nativeSrc": "455:51:23", + "nodeType": "YulExpressionStatement", + "src": "455:51:23" + } + ] + }, + "name": "abi_encode_tuple_t_address__to_t_address__fromStack_reversed", + "nativeSrc": "309:203:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "379:9:23", + "nodeType": "YulTypedName", + "src": "379:9:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "390:6:23", + "nodeType": "YulTypedName", + "src": "390:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "401:4:23", + "nodeType": "YulTypedName", + "src": "401:4:23", + "type": "" + } + ], + "src": "309:203:23" + }, + { + "body": { + "nativeSrc": "691:169:23", + "nodeType": "YulBlock", + "src": "691:169:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "708:9:23", + "nodeType": "YulIdentifier", + "src": "708:9:23" + }, + { + "kind": "number", + "nativeSrc": "719:2:23", + "nodeType": "YulLiteral", + "src": "719:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "701:6:23", + "nodeType": "YulIdentifier", + "src": "701:6:23" + }, + "nativeSrc": "701:21:23", + "nodeType": "YulFunctionCall", + "src": "701:21:23" + }, + "nativeSrc": "701:21:23", + "nodeType": "YulExpressionStatement", + "src": "701:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "742:9:23", + "nodeType": "YulIdentifier", + "src": "742:9:23" + }, + { + "kind": "number", + "nativeSrc": "753:2:23", + "nodeType": "YulLiteral", + "src": "753:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "738:3:23", + "nodeType": "YulIdentifier", + "src": "738:3:23" + }, + "nativeSrc": "738:18:23", + "nodeType": "YulFunctionCall", + "src": "738:18:23" + }, + { + "kind": "number", + "nativeSrc": "758:2:23", + "nodeType": "YulLiteral", + "src": "758:2:23", + "type": "", + "value": "19" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "731:6:23", + "nodeType": "YulIdentifier", + "src": "731:6:23" + }, + "nativeSrc": "731:30:23", + "nodeType": "YulFunctionCall", + "src": "731:30:23" + }, + "nativeSrc": "731:30:23", + "nodeType": "YulExpressionStatement", + "src": "731:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "781:9:23", + "nodeType": "YulIdentifier", + "src": "781:9:23" + }, + { + "kind": "number", + "nativeSrc": "792:2:23", + "nodeType": "YulLiteral", + "src": "792:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "777:3:23", + "nodeType": "YulIdentifier", + "src": "777:3:23" + }, + "nativeSrc": "777:18:23", + "nodeType": "YulFunctionCall", + "src": "777:18:23" + }, + { + "hexValue": "496e76616c69642064657374696e6174696f6e", + "kind": "string", + "nativeSrc": "797:21:23", + "nodeType": "YulLiteral", + "src": "797:21:23", + "type": "", + "value": "Invalid destination" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "770:6:23", + "nodeType": "YulIdentifier", + "src": "770:6:23" + }, + "nativeSrc": "770:49:23", + "nodeType": "YulFunctionCall", + "src": "770:49:23" + }, + "nativeSrc": "770:49:23", + "nodeType": "YulExpressionStatement", + "src": "770:49:23" + }, + { + "nativeSrc": "828:26:23", + "nodeType": "YulAssignment", + "src": "828:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "840:9:23", + "nodeType": "YulIdentifier", + "src": "840:9:23" + }, + { + "kind": "number", + "nativeSrc": "851:2:23", + "nodeType": "YulLiteral", + "src": "851:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "836:3:23", + "nodeType": "YulIdentifier", + "src": "836:3:23" + }, + "nativeSrc": "836:18:23", + "nodeType": "YulFunctionCall", + "src": "836:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "828:4:23", + "nodeType": "YulIdentifier", + "src": "828:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_480a3d2cf1e4838d740f40eac57f23eb6facc0baaf1a65a7b61df6a5a00ed368__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "517:343:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "668:9:23", + "nodeType": "YulTypedName", + "src": "668:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "682:4:23", + "nodeType": "YulTypedName", + "src": "682:4:23", + "type": "" + } + ], + "src": "517:343:23" + }, + { + "body": { + "nativeSrc": "897:95:23", + "nodeType": "YulBlock", + "src": "897:95:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "914:1:23", + "nodeType": "YulLiteral", + "src": "914:1:23", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "921:3:23", + "nodeType": "YulLiteral", + "src": "921:3:23", + "type": "", + "value": "224" + }, + { + "kind": "number", + "nativeSrc": "926:10:23", + "nodeType": "YulLiteral", + "src": "926:10:23", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "917:3:23", + "nodeType": "YulIdentifier", + "src": "917:3:23" + }, + "nativeSrc": "917:20:23", + "nodeType": "YulFunctionCall", + "src": "917:20:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "907:6:23", + "nodeType": "YulIdentifier", + "src": "907:6:23" + }, + "nativeSrc": "907:31:23", + "nodeType": "YulFunctionCall", + "src": "907:31:23" + }, + "nativeSrc": "907:31:23", + "nodeType": "YulExpressionStatement", + "src": "907:31:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "954:1:23", + "nodeType": "YulLiteral", + "src": "954:1:23", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nativeSrc": "957:4:23", + "nodeType": "YulLiteral", + "src": "957:4:23", + "type": "", + "value": "0x41" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "947:6:23", + "nodeType": "YulIdentifier", + "src": "947:6:23" + }, + "nativeSrc": "947:15:23", + "nodeType": "YulFunctionCall", + "src": "947:15:23" + }, + "nativeSrc": "947:15:23", + "nodeType": "YulExpressionStatement", + "src": "947:15:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "978:1:23", + "nodeType": "YulLiteral", + "src": "978:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "981:4:23", + "nodeType": "YulLiteral", + "src": "981:4:23", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "971:6:23", + "nodeType": "YulIdentifier", + "src": "971:6:23" + }, + "nativeSrc": "971:15:23", + "nodeType": "YulFunctionCall", + "src": "971:15:23" + }, + "nativeSrc": "971:15:23", + "nodeType": "YulExpressionStatement", + "src": "971:15:23" + } + ] + }, + "name": "panic_error_0x41", + "nativeSrc": "865:127:23", + "nodeType": "YulFunctionDefinition", + "src": "865:127:23" + }, + { + "body": { + "nativeSrc": "1052:325:23", + "nodeType": "YulBlock", + "src": "1052:325:23", + "statements": [ + { + "nativeSrc": "1062:22:23", + "nodeType": "YulAssignment", + "src": "1062:22:23", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1076:1:23", + "nodeType": "YulLiteral", + "src": "1076:1:23", + "type": "", + "value": "1" + }, + { + "name": "data", + "nativeSrc": "1079:4:23", + "nodeType": "YulIdentifier", + "src": "1079:4:23" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "1072:3:23", + "nodeType": "YulIdentifier", + "src": "1072:3:23" + }, + "nativeSrc": "1072:12:23", + "nodeType": "YulFunctionCall", + "src": "1072:12:23" + }, + "variableNames": [ + { + "name": "length", + "nativeSrc": "1062:6:23", + "nodeType": "YulIdentifier", + "src": "1062:6:23" + } + ] + }, + { + "nativeSrc": "1093:38:23", + "nodeType": "YulVariableDeclaration", + "src": "1093:38:23", + "value": { + "arguments": [ + { + "name": "data", + "nativeSrc": "1123:4:23", + "nodeType": "YulIdentifier", + "src": "1123:4:23" + }, + { + "kind": "number", + "nativeSrc": "1129:1:23", + "nodeType": "YulLiteral", + "src": "1129:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "1119:3:23", + "nodeType": "YulIdentifier", + "src": "1119:3:23" + }, + "nativeSrc": "1119:12:23", + "nodeType": "YulFunctionCall", + "src": "1119:12:23" + }, + "variables": [ + { + "name": "outOfPlaceEncoding", + "nativeSrc": "1097:18:23", + "nodeType": "YulTypedName", + "src": "1097:18:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "1170:31:23", + "nodeType": "YulBlock", + "src": "1170:31:23", + "statements": [ + { + "nativeSrc": "1172:27:23", + "nodeType": "YulAssignment", + "src": "1172:27:23", + "value": { + "arguments": [ + { + "name": "length", + "nativeSrc": "1186:6:23", + "nodeType": "YulIdentifier", + "src": "1186:6:23" + }, + { + "kind": "number", + "nativeSrc": "1194:4:23", + "nodeType": "YulLiteral", + "src": "1194:4:23", + "type": "", + "value": "0x7f" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "1182:3:23", + "nodeType": "YulIdentifier", + "src": "1182:3:23" + }, + "nativeSrc": "1182:17:23", + "nodeType": "YulFunctionCall", + "src": "1182:17:23" + }, + "variableNames": [ + { + "name": "length", + "nativeSrc": "1172:6:23", + "nodeType": "YulIdentifier", + "src": "1172:6:23" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nativeSrc": "1150:18:23", + "nodeType": "YulIdentifier", + "src": "1150:18:23" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "1143:6:23", + "nodeType": "YulIdentifier", + "src": "1143:6:23" + }, + "nativeSrc": "1143:26:23", + "nodeType": "YulFunctionCall", + "src": "1143:26:23" + }, + "nativeSrc": "1140:61:23", + "nodeType": "YulIf", + "src": "1140:61:23" + }, + { + "body": { + "nativeSrc": "1260:111:23", + "nodeType": "YulBlock", + "src": "1260:111:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1281:1:23", + "nodeType": "YulLiteral", + "src": "1281:1:23", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1288:3:23", + "nodeType": "YulLiteral", + "src": "1288:3:23", + "type": "", + "value": "224" + }, + { + "kind": "number", + "nativeSrc": "1293:10:23", + "nodeType": "YulLiteral", + "src": "1293:10:23", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "1284:3:23", + "nodeType": "YulIdentifier", + "src": "1284:3:23" + }, + "nativeSrc": "1284:20:23", + "nodeType": "YulFunctionCall", + "src": "1284:20:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1274:6:23", + "nodeType": "YulIdentifier", + "src": "1274:6:23" + }, + "nativeSrc": "1274:31:23", + "nodeType": "YulFunctionCall", + "src": "1274:31:23" + }, + "nativeSrc": "1274:31:23", + "nodeType": "YulExpressionStatement", + "src": "1274:31:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1325:1:23", + "nodeType": "YulLiteral", + "src": "1325:1:23", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nativeSrc": "1328:4:23", + "nodeType": "YulLiteral", + "src": "1328:4:23", + "type": "", + "value": "0x22" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1318:6:23", + "nodeType": "YulIdentifier", + "src": "1318:6:23" + }, + "nativeSrc": "1318:15:23", + "nodeType": "YulFunctionCall", + "src": "1318:15:23" + }, + "nativeSrc": "1318:15:23", + "nodeType": "YulExpressionStatement", + "src": "1318:15:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1353:1:23", + "nodeType": "YulLiteral", + "src": "1353:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "1356:4:23", + "nodeType": "YulLiteral", + "src": "1356:4:23", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "1346:6:23", + "nodeType": "YulIdentifier", + "src": "1346:6:23" + }, + "nativeSrc": "1346:15:23", + "nodeType": "YulFunctionCall", + "src": "1346:15:23" + }, + "nativeSrc": "1346:15:23", + "nodeType": "YulExpressionStatement", + "src": "1346:15:23" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nativeSrc": "1216:18:23", + "nodeType": "YulIdentifier", + "src": "1216:18:23" + }, + { + "arguments": [ + { + "name": "length", + "nativeSrc": "1239:6:23", + "nodeType": "YulIdentifier", + "src": "1239:6:23" + }, + { + "kind": "number", + "nativeSrc": "1247:2:23", + "nodeType": "YulLiteral", + "src": "1247:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "1236:2:23", + "nodeType": "YulIdentifier", + "src": "1236:2:23" + }, + "nativeSrc": "1236:14:23", + "nodeType": "YulFunctionCall", + "src": "1236:14:23" + } + ], + "functionName": { + "name": "eq", + "nativeSrc": "1213:2:23", + "nodeType": "YulIdentifier", + "src": "1213:2:23" + }, + "nativeSrc": "1213:38:23", + "nodeType": "YulFunctionCall", + "src": "1213:38:23" + }, + "nativeSrc": "1210:161:23", + "nodeType": "YulIf", + "src": "1210:161:23" + } + ] + }, + "name": "extract_byte_array_length", + "nativeSrc": "997:380:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "data", + "nativeSrc": "1032:4:23", + "nodeType": "YulTypedName", + "src": "1032:4:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "length", + "nativeSrc": "1041:6:23", + "nodeType": "YulTypedName", + "src": "1041:6:23", + "type": "" + } + ], + "src": "997:380:23" + }, + { + "body": { + "nativeSrc": "1438:65:23", + "nodeType": "YulBlock", + "src": "1438:65:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1455:1:23", + "nodeType": "YulLiteral", + "src": "1455:1:23", + "type": "", + "value": "0" + }, + { + "name": "ptr", + "nativeSrc": "1458:3:23", + "nodeType": "YulIdentifier", + "src": "1458:3:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1448:6:23", + "nodeType": "YulIdentifier", + "src": "1448:6:23" + }, + "nativeSrc": "1448:14:23", + "nodeType": "YulFunctionCall", + "src": "1448:14:23" + }, + "nativeSrc": "1448:14:23", + "nodeType": "YulExpressionStatement", + "src": "1448:14:23" + }, + { + "nativeSrc": "1471:26:23", + "nodeType": "YulAssignment", + "src": "1471:26:23", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1489:1:23", + "nodeType": "YulLiteral", + "src": "1489:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "1492:4:23", + "nodeType": "YulLiteral", + "src": "1492:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "keccak256", + "nativeSrc": "1479:9:23", + "nodeType": "YulIdentifier", + "src": "1479:9:23" + }, + "nativeSrc": "1479:18:23", + "nodeType": "YulFunctionCall", + "src": "1479:18:23" + }, + "variableNames": [ + { + "name": "data", + "nativeSrc": "1471:4:23", + "nodeType": "YulIdentifier", + "src": "1471:4:23" + } + ] + } + ] + }, + "name": "array_dataslot_string_storage", + "nativeSrc": "1382:121:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "ptr", + "nativeSrc": "1421:3:23", + "nodeType": "YulTypedName", + "src": "1421:3:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "data", + "nativeSrc": "1429:4:23", + "nodeType": "YulTypedName", + "src": "1429:4:23", + "type": "" + } + ], + "src": "1382:121:23" + }, + { + "body": { + "nativeSrc": "1589:437:23", + "nodeType": "YulBlock", + "src": "1589:437:23", + "statements": [ + { + "body": { + "nativeSrc": "1622:398:23", + "nodeType": "YulBlock", + "src": "1622:398:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1643:1:23", + "nodeType": "YulLiteral", + "src": "1643:1:23", + "type": "", + "value": "0" + }, + { + "name": "array", + "nativeSrc": "1646:5:23", + "nodeType": "YulIdentifier", + "src": "1646:5:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1636:6:23", + "nodeType": "YulIdentifier", + "src": "1636:6:23" + }, + "nativeSrc": "1636:16:23", + "nodeType": "YulFunctionCall", + "src": "1636:16:23" + }, + "nativeSrc": "1636:16:23", + "nodeType": "YulExpressionStatement", + "src": "1636:16:23" + }, + { + "nativeSrc": "1665:30:23", + "nodeType": "YulVariableDeclaration", + "src": "1665:30:23", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1687:1:23", + "nodeType": "YulLiteral", + "src": "1687:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "1690:4:23", + "nodeType": "YulLiteral", + "src": "1690:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "keccak256", + "nativeSrc": "1677:9:23", + "nodeType": "YulIdentifier", + "src": "1677:9:23" + }, + "nativeSrc": "1677:18:23", + "nodeType": "YulFunctionCall", + "src": "1677:18:23" + }, + "variables": [ + { + "name": "data", + "nativeSrc": "1669:4:23", + "nodeType": "YulTypedName", + "src": "1669:4:23", + "type": "" + } + ] + }, + { + "nativeSrc": "1708:57:23", + "nodeType": "YulVariableDeclaration", + "src": "1708:57:23", + "value": { + "arguments": [ + { + "name": "data", + "nativeSrc": "1731:4:23", + "nodeType": "YulIdentifier", + "src": "1731:4:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1741:1:23", + "nodeType": "YulLiteral", + "src": "1741:1:23", + "type": "", + "value": "5" + }, + { + "arguments": [ + { + "name": "startIndex", + "nativeSrc": "1748:10:23", + "nodeType": "YulIdentifier", + "src": "1748:10:23" + }, + { + "kind": "number", + "nativeSrc": "1760:2:23", + "nodeType": "YulLiteral", + "src": "1760:2:23", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1744:3:23", + "nodeType": "YulIdentifier", + "src": "1744:3:23" + }, + "nativeSrc": "1744:19:23", + "nodeType": "YulFunctionCall", + "src": "1744:19:23" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "1737:3:23", + "nodeType": "YulIdentifier", + "src": "1737:3:23" + }, + "nativeSrc": "1737:27:23", + "nodeType": "YulFunctionCall", + "src": "1737:27:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1727:3:23", + "nodeType": "YulIdentifier", + "src": "1727:3:23" + }, + "nativeSrc": "1727:38:23", + "nodeType": "YulFunctionCall", + "src": "1727:38:23" + }, + "variables": [ + { + "name": "deleteStart", + "nativeSrc": "1712:11:23", + "nodeType": "YulTypedName", + "src": "1712:11:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "1802:23:23", + "nodeType": "YulBlock", + "src": "1802:23:23", + "statements": [ + { + "nativeSrc": "1804:19:23", + "nodeType": "YulAssignment", + "src": "1804:19:23", + "value": { + "name": "data", + "nativeSrc": "1819:4:23", + "nodeType": "YulIdentifier", + "src": "1819:4:23" + }, + "variableNames": [ + { + "name": "deleteStart", + "nativeSrc": "1804:11:23", + "nodeType": "YulIdentifier", + "src": "1804:11:23" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "startIndex", + "nativeSrc": "1784:10:23", + "nodeType": "YulIdentifier", + "src": "1784:10:23" + }, + { + "kind": "number", + "nativeSrc": "1796:4:23", + "nodeType": "YulLiteral", + "src": "1796:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "1781:2:23", + "nodeType": "YulIdentifier", + "src": "1781:2:23" + }, + "nativeSrc": "1781:20:23", + "nodeType": "YulFunctionCall", + "src": "1781:20:23" + }, + "nativeSrc": "1778:47:23", + "nodeType": "YulIf", + "src": "1778:47:23" + }, + { + "nativeSrc": "1838:41:23", + "nodeType": "YulVariableDeclaration", + "src": "1838:41:23", + "value": { + "arguments": [ + { + "name": "data", + "nativeSrc": "1852:4:23", + "nodeType": "YulIdentifier", + "src": "1852:4:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1862:1:23", + "nodeType": "YulLiteral", + "src": "1862:1:23", + "type": "", + "value": "5" + }, + { + "arguments": [ + { + "name": "len", + "nativeSrc": "1869:3:23", + "nodeType": "YulIdentifier", + "src": "1869:3:23" + }, + { + "kind": "number", + "nativeSrc": "1874:2:23", + "nodeType": "YulLiteral", + "src": "1874:2:23", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1865:3:23", + "nodeType": "YulIdentifier", + "src": "1865:3:23" + }, + "nativeSrc": "1865:12:23", + "nodeType": "YulFunctionCall", + "src": "1865:12:23" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "1858:3:23", + "nodeType": "YulIdentifier", + "src": "1858:3:23" + }, + "nativeSrc": "1858:20:23", + "nodeType": "YulFunctionCall", + "src": "1858:20:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1848:3:23", + "nodeType": "YulIdentifier", + "src": "1848:3:23" + }, + "nativeSrc": "1848:31:23", + "nodeType": "YulFunctionCall", + "src": "1848:31:23" + }, + "variables": [ + { + "name": "_1", + "nativeSrc": "1842:2:23", + "nodeType": "YulTypedName", + "src": "1842:2:23", + "type": "" + } + ] + }, + { + "nativeSrc": "1892:24:23", + "nodeType": "YulVariableDeclaration", + "src": "1892:24:23", + "value": { + "name": "deleteStart", + "nativeSrc": "1905:11:23", + "nodeType": "YulIdentifier", + "src": "1905:11:23" + }, + "variables": [ + { + "name": "start", + "nativeSrc": "1896:5:23", + "nodeType": "YulTypedName", + "src": "1896:5:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "1990:20:23", + "nodeType": "YulBlock", + "src": "1990:20:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "start", + "nativeSrc": "1999:5:23", + "nodeType": "YulIdentifier", + "src": "1999:5:23" + }, + { + "kind": "number", + "nativeSrc": "2006:1:23", + "nodeType": "YulLiteral", + "src": "2006:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "sstore", + "nativeSrc": "1992:6:23", + "nodeType": "YulIdentifier", + "src": "1992:6:23" + }, + "nativeSrc": "1992:16:23", + "nodeType": "YulFunctionCall", + "src": "1992:16:23" + }, + "nativeSrc": "1992:16:23", + "nodeType": "YulExpressionStatement", + "src": "1992:16:23" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "start", + "nativeSrc": "1940:5:23", + "nodeType": "YulIdentifier", + "src": "1940:5:23" + }, + { + "name": "_1", + "nativeSrc": "1947:2:23", + "nodeType": "YulIdentifier", + "src": "1947:2:23" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "1937:2:23", + "nodeType": "YulIdentifier", + "src": "1937:2:23" + }, + "nativeSrc": "1937:13:23", + "nodeType": "YulFunctionCall", + "src": "1937:13:23" + }, + "nativeSrc": "1929:81:23", + "nodeType": "YulForLoop", + "post": { + "nativeSrc": "1951:26:23", + "nodeType": "YulBlock", + "src": "1951:26:23", + "statements": [ + { + "nativeSrc": "1953:22:23", + "nodeType": "YulAssignment", + "src": "1953:22:23", + "value": { + "arguments": [ + { + "name": "start", + "nativeSrc": "1966:5:23", + "nodeType": "YulIdentifier", + "src": "1966:5:23" + }, + { + "kind": "number", + "nativeSrc": "1973:1:23", + "nodeType": "YulLiteral", + "src": "1973:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1962:3:23", + "nodeType": "YulIdentifier", + "src": "1962:3:23" + }, + "nativeSrc": "1962:13:23", + "nodeType": "YulFunctionCall", + "src": "1962:13:23" + }, + "variableNames": [ + { + "name": "start", + "nativeSrc": "1953:5:23", + "nodeType": "YulIdentifier", + "src": "1953:5:23" + } + ] + } + ] + }, + "pre": { + "nativeSrc": "1933:3:23", + "nodeType": "YulBlock", + "src": "1933:3:23", + "statements": [] + }, + "src": "1929:81:23" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "len", + "nativeSrc": "1605:3:23", + "nodeType": "YulIdentifier", + "src": "1605:3:23" + }, + { + "kind": "number", + "nativeSrc": "1610:2:23", + "nodeType": "YulLiteral", + "src": "1610:2:23", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "gt", + "nativeSrc": "1602:2:23", + "nodeType": "YulIdentifier", + "src": "1602:2:23" + }, + "nativeSrc": "1602:11:23", + "nodeType": "YulFunctionCall", + "src": "1602:11:23" + }, + "nativeSrc": "1599:421:23", + "nodeType": "YulIf", + "src": "1599:421:23" + } + ] + }, + "name": "clean_up_bytearray_end_slots_string_storage", + "nativeSrc": "1508:518:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "array", + "nativeSrc": "1561:5:23", + "nodeType": "YulTypedName", + "src": "1561:5:23", + "type": "" + }, + { + "name": "len", + "nativeSrc": "1568:3:23", + "nodeType": "YulTypedName", + "src": "1568:3:23", + "type": "" + }, + { + "name": "startIndex", + "nativeSrc": "1573:10:23", + "nodeType": "YulTypedName", + "src": "1573:10:23", + "type": "" + } + ], + "src": "1508:518:23" + }, + { + "body": { + "nativeSrc": "2116:81:23", + "nodeType": "YulBlock", + "src": "2116:81:23", + "statements": [ + { + "nativeSrc": "2126:65:23", + "nodeType": "YulAssignment", + "src": "2126:65:23", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "data", + "nativeSrc": "2141:4:23", + "nodeType": "YulIdentifier", + "src": "2141:4:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2159:1:23", + "nodeType": "YulLiteral", + "src": "2159:1:23", + "type": "", + "value": "3" + }, + { + "name": "len", + "nativeSrc": "2162:3:23", + "nodeType": "YulIdentifier", + "src": "2162:3:23" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "2155:3:23", + "nodeType": "YulIdentifier", + "src": "2155:3:23" + }, + "nativeSrc": "2155:11:23", + "nodeType": "YulFunctionCall", + "src": "2155:11:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2172:1:23", + "nodeType": "YulLiteral", + "src": "2172:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "2168:3:23", + "nodeType": "YulIdentifier", + "src": "2168:3:23" + }, + "nativeSrc": "2168:6:23", + "nodeType": "YulFunctionCall", + "src": "2168:6:23" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "2151:3:23", + "nodeType": "YulIdentifier", + "src": "2151:3:23" + }, + "nativeSrc": "2151:24:23", + "nodeType": "YulFunctionCall", + "src": "2151:24:23" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "2147:3:23", + "nodeType": "YulIdentifier", + "src": "2147:3:23" + }, + "nativeSrc": "2147:29:23", + "nodeType": "YulFunctionCall", + "src": "2147:29:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "2137:3:23", + "nodeType": "YulIdentifier", + "src": "2137:3:23" + }, + "nativeSrc": "2137:40:23", + "nodeType": "YulFunctionCall", + "src": "2137:40:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2183:1:23", + "nodeType": "YulLiteral", + "src": "2183:1:23", + "type": "", + "value": "1" + }, + { + "name": "len", + "nativeSrc": "2186:3:23", + "nodeType": "YulIdentifier", + "src": "2186:3:23" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "2179:3:23", + "nodeType": "YulIdentifier", + "src": "2179:3:23" + }, + "nativeSrc": "2179:11:23", + "nodeType": "YulFunctionCall", + "src": "2179:11:23" + } + ], + "functionName": { + "name": "or", + "nativeSrc": "2134:2:23", + "nodeType": "YulIdentifier", + "src": "2134:2:23" + }, + "nativeSrc": "2134:57:23", + "nodeType": "YulFunctionCall", + "src": "2134:57:23" + }, + "variableNames": [ + { + "name": "used", + "nativeSrc": "2126:4:23", + "nodeType": "YulIdentifier", + "src": "2126:4:23" + } + ] + } + ] + }, + "name": "extract_used_part_and_set_length_of_short_byte_array", + "nativeSrc": "2031:166:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "data", + "nativeSrc": "2093:4:23", + "nodeType": "YulTypedName", + "src": "2093:4:23", + "type": "" + }, + { + "name": "len", + "nativeSrc": "2099:3:23", + "nodeType": "YulTypedName", + "src": "2099:3:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "used", + "nativeSrc": "2107:4:23", + "nodeType": "YulTypedName", + "src": "2107:4:23", + "type": "" + } + ], + "src": "2031:166:23" + }, + { + "body": { + "nativeSrc": "2298:1203:23", + "nodeType": "YulBlock", + "src": "2298:1203:23", + "statements": [ + { + "nativeSrc": "2308:24:23", + "nodeType": "YulVariableDeclaration", + "src": "2308:24:23", + "value": { + "arguments": [ + { + "name": "src", + "nativeSrc": "2328:3:23", + "nodeType": "YulIdentifier", + "src": "2328:3:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "2322:5:23", + "nodeType": "YulIdentifier", + "src": "2322:5:23" + }, + "nativeSrc": "2322:10:23", + "nodeType": "YulFunctionCall", + "src": "2322:10:23" + }, + "variables": [ + { + "name": "newLen", + "nativeSrc": "2312:6:23", + "nodeType": "YulTypedName", + "src": "2312:6:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "2375:22:23", + "nodeType": "YulBlock", + "src": "2375:22:23", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x41", + "nativeSrc": "2377:16:23", + "nodeType": "YulIdentifier", + "src": "2377:16:23" + }, + "nativeSrc": "2377:18:23", + "nodeType": "YulFunctionCall", + "src": "2377:18:23" + }, + "nativeSrc": "2377:18:23", + "nodeType": "YulExpressionStatement", + "src": "2377:18:23" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "newLen", + "nativeSrc": "2347:6:23", + "nodeType": "YulIdentifier", + "src": "2347:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2363:2:23", + "nodeType": "YulLiteral", + "src": "2363:2:23", + "type": "", + "value": "64" + }, + { + "kind": "number", + "nativeSrc": "2367:1:23", + "nodeType": "YulLiteral", + "src": "2367:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "2359:3:23", + "nodeType": "YulIdentifier", + "src": "2359:3:23" + }, + "nativeSrc": "2359:10:23", + "nodeType": "YulFunctionCall", + "src": "2359:10:23" + }, + { + "kind": "number", + "nativeSrc": "2371:1:23", + "nodeType": "YulLiteral", + "src": "2371:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "2355:3:23", + "nodeType": "YulIdentifier", + "src": "2355:3:23" + }, + "nativeSrc": "2355:18:23", + "nodeType": "YulFunctionCall", + "src": "2355:18:23" + } + ], + "functionName": { + "name": "gt", + "nativeSrc": "2344:2:23", + "nodeType": "YulIdentifier", + "src": "2344:2:23" + }, + "nativeSrc": "2344:30:23", + "nodeType": "YulFunctionCall", + "src": "2344:30:23" + }, + "nativeSrc": "2341:56:23", + "nodeType": "YulIf", + "src": "2341:56:23" + }, + { + "expression": { + "arguments": [ + { + "name": "slot", + "nativeSrc": "2450:4:23", + "nodeType": "YulIdentifier", + "src": "2450:4:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "slot", + "nativeSrc": "2488:4:23", + "nodeType": "YulIdentifier", + "src": "2488:4:23" + } + ], + "functionName": { + "name": "sload", + "nativeSrc": "2482:5:23", + "nodeType": "YulIdentifier", + "src": "2482:5:23" + }, + "nativeSrc": "2482:11:23", + "nodeType": "YulFunctionCall", + "src": "2482:11:23" + } + ], + "functionName": { + "name": "extract_byte_array_length", + "nativeSrc": "2456:25:23", + "nodeType": "YulIdentifier", + "src": "2456:25:23" + }, + "nativeSrc": "2456:38:23", + "nodeType": "YulFunctionCall", + "src": "2456:38:23" + }, + { + "name": "newLen", + "nativeSrc": "2496:6:23", + "nodeType": "YulIdentifier", + "src": "2496:6:23" + } + ], + "functionName": { + "name": "clean_up_bytearray_end_slots_string_storage", + "nativeSrc": "2406:43:23", + "nodeType": "YulIdentifier", + "src": "2406:43:23" + }, + "nativeSrc": "2406:97:23", + "nodeType": "YulFunctionCall", + "src": "2406:97:23" + }, + "nativeSrc": "2406:97:23", + "nodeType": "YulExpressionStatement", + "src": "2406:97:23" + }, + { + "nativeSrc": "2512:18:23", + "nodeType": "YulVariableDeclaration", + "src": "2512:18:23", + "value": { + "kind": "number", + "nativeSrc": "2529:1:23", + "nodeType": "YulLiteral", + "src": "2529:1:23", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "srcOffset", + "nativeSrc": "2516:9:23", + "nodeType": "YulTypedName", + "src": "2516:9:23", + "type": "" + } + ] + }, + { + "nativeSrc": "2539:17:23", + "nodeType": "YulAssignment", + "src": "2539:17:23", + "value": { + "kind": "number", + "nativeSrc": "2552:4:23", + "nodeType": "YulLiteral", + "src": "2552:4:23", + "type": "", + "value": "0x20" + }, + "variableNames": [ + { + "name": "srcOffset", + "nativeSrc": "2539:9:23", + "nodeType": "YulIdentifier", + "src": "2539:9:23" + } + ] + }, + { + "cases": [ + { + "body": { + "nativeSrc": "2602:642:23", + "nodeType": "YulBlock", + "src": "2602:642:23", + "statements": [ + { + "nativeSrc": "2616:35:23", + "nodeType": "YulVariableDeclaration", + "src": "2616:35:23", + "value": { + "arguments": [ + { + "name": "newLen", + "nativeSrc": "2635:6:23", + "nodeType": "YulIdentifier", + "src": "2635:6:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2647:2:23", + "nodeType": "YulLiteral", + "src": "2647:2:23", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "2643:3:23", + "nodeType": "YulIdentifier", + "src": "2643:3:23" + }, + "nativeSrc": "2643:7:23", + "nodeType": "YulFunctionCall", + "src": "2643:7:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "2631:3:23", + "nodeType": "YulIdentifier", + "src": "2631:3:23" + }, + "nativeSrc": "2631:20:23", + "nodeType": "YulFunctionCall", + "src": "2631:20:23" + }, + "variables": [ + { + "name": "loopEnd", + "nativeSrc": "2620:7:23", + "nodeType": "YulTypedName", + "src": "2620:7:23", + "type": "" + } + ] + }, + { + "nativeSrc": "2664:49:23", + "nodeType": "YulVariableDeclaration", + "src": "2664:49:23", + "value": { + "arguments": [ + { + "name": "slot", + "nativeSrc": "2708:4:23", + "nodeType": "YulIdentifier", + "src": "2708:4:23" + } + ], + "functionName": { + "name": "array_dataslot_string_storage", + "nativeSrc": "2678:29:23", + "nodeType": "YulIdentifier", + "src": "2678:29:23" + }, + "nativeSrc": "2678:35:23", + "nodeType": "YulFunctionCall", + "src": "2678:35:23" + }, + "variables": [ + { + "name": "dstPtr", + "nativeSrc": "2668:6:23", + "nodeType": "YulTypedName", + "src": "2668:6:23", + "type": "" + } + ] + }, + { + "nativeSrc": "2726:10:23", + "nodeType": "YulVariableDeclaration", + "src": "2726:10:23", + "value": { + "kind": "number", + "nativeSrc": "2735:1:23", + "nodeType": "YulLiteral", + "src": "2735:1:23", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "i", + "nativeSrc": "2730:1:23", + "nodeType": "YulTypedName", + "src": "2730:1:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "2806:165:23", + "nodeType": "YulBlock", + "src": "2806:165:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "dstPtr", + "nativeSrc": "2831:6:23", + "nodeType": "YulIdentifier", + "src": "2831:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "src", + "nativeSrc": "2849:3:23", + "nodeType": "YulIdentifier", + "src": "2849:3:23" + }, + { + "name": "srcOffset", + "nativeSrc": "2854:9:23", + "nodeType": "YulIdentifier", + "src": "2854:9:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2845:3:23", + "nodeType": "YulIdentifier", + "src": "2845:3:23" + }, + "nativeSrc": "2845:19:23", + "nodeType": "YulFunctionCall", + "src": "2845:19:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "2839:5:23", + "nodeType": "YulIdentifier", + "src": "2839:5:23" + }, + "nativeSrc": "2839:26:23", + "nodeType": "YulFunctionCall", + "src": "2839:26:23" + } + ], + "functionName": { + "name": "sstore", + "nativeSrc": "2824:6:23", + "nodeType": "YulIdentifier", + "src": "2824:6:23" + }, + "nativeSrc": "2824:42:23", + "nodeType": "YulFunctionCall", + "src": "2824:42:23" + }, + "nativeSrc": "2824:42:23", + "nodeType": "YulExpressionStatement", + "src": "2824:42:23" + }, + { + "nativeSrc": "2883:24:23", + "nodeType": "YulAssignment", + "src": "2883:24:23", + "value": { + "arguments": [ + { + "name": "dstPtr", + "nativeSrc": "2897:6:23", + "nodeType": "YulIdentifier", + "src": "2897:6:23" + }, + { + "kind": "number", + "nativeSrc": "2905:1:23", + "nodeType": "YulLiteral", + "src": "2905:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2893:3:23", + "nodeType": "YulIdentifier", + "src": "2893:3:23" + }, + "nativeSrc": "2893:14:23", + "nodeType": "YulFunctionCall", + "src": "2893:14:23" + }, + "variableNames": [ + { + "name": "dstPtr", + "nativeSrc": "2883:6:23", + "nodeType": "YulIdentifier", + "src": "2883:6:23" + } + ] + }, + { + "nativeSrc": "2924:33:23", + "nodeType": "YulAssignment", + "src": "2924:33:23", + "value": { + "arguments": [ + { + "name": "srcOffset", + "nativeSrc": "2941:9:23", + "nodeType": "YulIdentifier", + "src": "2941:9:23" + }, + { + "kind": "number", + "nativeSrc": "2952:4:23", + "nodeType": "YulLiteral", + "src": "2952:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2937:3:23", + "nodeType": "YulIdentifier", + "src": "2937:3:23" + }, + "nativeSrc": "2937:20:23", + "nodeType": "YulFunctionCall", + "src": "2937:20:23" + }, + "variableNames": [ + { + "name": "srcOffset", + "nativeSrc": "2924:9:23", + "nodeType": "YulIdentifier", + "src": "2924:9:23" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "i", + "nativeSrc": "2760:1:23", + "nodeType": "YulIdentifier", + "src": "2760:1:23" + }, + { + "name": "loopEnd", + "nativeSrc": "2763:7:23", + "nodeType": "YulIdentifier", + "src": "2763:7:23" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "2757:2:23", + "nodeType": "YulIdentifier", + "src": "2757:2:23" + }, + "nativeSrc": "2757:14:23", + "nodeType": "YulFunctionCall", + "src": "2757:14:23" + }, + "nativeSrc": "2749:222:23", + "nodeType": "YulForLoop", + "post": { + "nativeSrc": "2772:21:23", + "nodeType": "YulBlock", + "src": "2772:21:23", + "statements": [ + { + "nativeSrc": "2774:17:23", + "nodeType": "YulAssignment", + "src": "2774:17:23", + "value": { + "arguments": [ + { + "name": "i", + "nativeSrc": "2783:1:23", + "nodeType": "YulIdentifier", + "src": "2783:1:23" + }, + { + "kind": "number", + "nativeSrc": "2786:4:23", + "nodeType": "YulLiteral", + "src": "2786:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2779:3:23", + "nodeType": "YulIdentifier", + "src": "2779:3:23" + }, + "nativeSrc": "2779:12:23", + "nodeType": "YulFunctionCall", + "src": "2779:12:23" + }, + "variableNames": [ + { + "name": "i", + "nativeSrc": "2774:1:23", + "nodeType": "YulIdentifier", + "src": "2774:1:23" + } + ] + } + ] + }, + "pre": { + "nativeSrc": "2753:3:23", + "nodeType": "YulBlock", + "src": "2753:3:23", + "statements": [] + }, + "src": "2749:222:23" + }, + { + "body": { + "nativeSrc": "3019:166:23", + "nodeType": "YulBlock", + "src": "3019:166:23", + "statements": [ + { + "nativeSrc": "3037:43:23", + "nodeType": "YulVariableDeclaration", + "src": "3037:43:23", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "src", + "nativeSrc": "3064:3:23", + "nodeType": "YulIdentifier", + "src": "3064:3:23" + }, + { + "name": "srcOffset", + "nativeSrc": "3069:9:23", + "nodeType": "YulIdentifier", + "src": "3069:9:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3060:3:23", + "nodeType": "YulIdentifier", + "src": "3060:3:23" + }, + "nativeSrc": "3060:19:23", + "nodeType": "YulFunctionCall", + "src": "3060:19:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "3054:5:23", + "nodeType": "YulIdentifier", + "src": "3054:5:23" + }, + "nativeSrc": "3054:26:23", + "nodeType": "YulFunctionCall", + "src": "3054:26:23" + }, + "variables": [ + { + "name": "lastValue", + "nativeSrc": "3041:9:23", + "nodeType": "YulTypedName", + "src": "3041:9:23", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "dstPtr", + "nativeSrc": "3104:6:23", + "nodeType": "YulIdentifier", + "src": "3104:6:23" + }, + { + "arguments": [ + { + "name": "lastValue", + "nativeSrc": "3116:9:23", + "nodeType": "YulIdentifier", + "src": "3116:9:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3143:1:23", + "nodeType": "YulLiteral", + "src": "3143:1:23", + "type": "", + "value": "3" + }, + { + "name": "newLen", + "nativeSrc": "3146:6:23", + "nodeType": "YulIdentifier", + "src": "3146:6:23" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "3139:3:23", + "nodeType": "YulIdentifier", + "src": "3139:3:23" + }, + "nativeSrc": "3139:14:23", + "nodeType": "YulFunctionCall", + "src": "3139:14:23" + }, + { + "kind": "number", + "nativeSrc": "3155:3:23", + "nodeType": "YulLiteral", + "src": "3155:3:23", + "type": "", + "value": "248" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "3135:3:23", + "nodeType": "YulIdentifier", + "src": "3135:3:23" + }, + "nativeSrc": "3135:24:23", + "nodeType": "YulFunctionCall", + "src": "3135:24:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3165:1:23", + "nodeType": "YulLiteral", + "src": "3165:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "3161:3:23", + "nodeType": "YulIdentifier", + "src": "3161:3:23" + }, + "nativeSrc": "3161:6:23", + "nodeType": "YulFunctionCall", + "src": "3161:6:23" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "3131:3:23", + "nodeType": "YulIdentifier", + "src": "3131:3:23" + }, + "nativeSrc": "3131:37:23", + "nodeType": "YulFunctionCall", + "src": "3131:37:23" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "3127:3:23", + "nodeType": "YulIdentifier", + "src": "3127:3:23" + }, + "nativeSrc": "3127:42:23", + "nodeType": "YulFunctionCall", + "src": "3127:42:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "3112:3:23", + "nodeType": "YulIdentifier", + "src": "3112:3:23" + }, + "nativeSrc": "3112:58:23", + "nodeType": "YulFunctionCall", + "src": "3112:58:23" + } + ], + "functionName": { + "name": "sstore", + "nativeSrc": "3097:6:23", + "nodeType": "YulIdentifier", + "src": "3097:6:23" + }, + "nativeSrc": "3097:74:23", + "nodeType": "YulFunctionCall", + "src": "3097:74:23" + }, + "nativeSrc": "3097:74:23", + "nodeType": "YulExpressionStatement", + "src": "3097:74:23" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "loopEnd", + "nativeSrc": "2990:7:23", + "nodeType": "YulIdentifier", + "src": "2990:7:23" + }, + { + "name": "newLen", + "nativeSrc": "2999:6:23", + "nodeType": "YulIdentifier", + "src": "2999:6:23" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "2987:2:23", + "nodeType": "YulIdentifier", + "src": "2987:2:23" + }, + "nativeSrc": "2987:19:23", + "nodeType": "YulFunctionCall", + "src": "2987:19:23" + }, + "nativeSrc": "2984:201:23", + "nodeType": "YulIf", + "src": "2984:201:23" + }, + { + "expression": { + "arguments": [ + { + "name": "slot", + "nativeSrc": "3205:4:23", + "nodeType": "YulIdentifier", + "src": "3205:4:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3219:1:23", + "nodeType": "YulLiteral", + "src": "3219:1:23", + "type": "", + "value": "1" + }, + { + "name": "newLen", + "nativeSrc": "3222:6:23", + "nodeType": "YulIdentifier", + "src": "3222:6:23" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "3215:3:23", + "nodeType": "YulIdentifier", + "src": "3215:3:23" + }, + "nativeSrc": "3215:14:23", + "nodeType": "YulFunctionCall", + "src": "3215:14:23" + }, + { + "kind": "number", + "nativeSrc": "3231:1:23", + "nodeType": "YulLiteral", + "src": "3231:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3211:3:23", + "nodeType": "YulIdentifier", + "src": "3211:3:23" + }, + "nativeSrc": "3211:22:23", + "nodeType": "YulFunctionCall", + "src": "3211:22:23" + } + ], + "functionName": { + "name": "sstore", + "nativeSrc": "3198:6:23", + "nodeType": "YulIdentifier", + "src": "3198:6:23" + }, + "nativeSrc": "3198:36:23", + "nodeType": "YulFunctionCall", + "src": "3198:36:23" + }, + "nativeSrc": "3198:36:23", + "nodeType": "YulExpressionStatement", + "src": "3198:36:23" + } + ] + }, + "nativeSrc": "2595:649:23", + "nodeType": "YulCase", + "src": "2595:649:23", + "value": { + "kind": "number", + "nativeSrc": "2600:1:23", + "nodeType": "YulLiteral", + "src": "2600:1:23", + "type": "", + "value": "1" + } + }, + { + "body": { + "nativeSrc": "3261:234:23", + "nodeType": "YulBlock", + "src": "3261:234:23", + "statements": [ + { + "nativeSrc": "3275:14:23", + "nodeType": "YulVariableDeclaration", + "src": "3275:14:23", + "value": { + "kind": "number", + "nativeSrc": "3288:1:23", + "nodeType": "YulLiteral", + "src": "3288:1:23", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "value", + "nativeSrc": "3279:5:23", + "nodeType": "YulTypedName", + "src": "3279:5:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "3324:67:23", + "nodeType": "YulBlock", + "src": "3324:67:23", + "statements": [ + { + "nativeSrc": "3342:35:23", + "nodeType": "YulAssignment", + "src": "3342:35:23", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "src", + "nativeSrc": "3361:3:23", + "nodeType": "YulIdentifier", + "src": "3361:3:23" + }, + { + "name": "srcOffset", + "nativeSrc": "3366:9:23", + "nodeType": "YulIdentifier", + "src": "3366:9:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3357:3:23", + "nodeType": "YulIdentifier", + "src": "3357:3:23" + }, + "nativeSrc": "3357:19:23", + "nodeType": "YulFunctionCall", + "src": "3357:19:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "3351:5:23", + "nodeType": "YulIdentifier", + "src": "3351:5:23" + }, + "nativeSrc": "3351:26:23", + "nodeType": "YulFunctionCall", + "src": "3351:26:23" + }, + "variableNames": [ + { + "name": "value", + "nativeSrc": "3342:5:23", + "nodeType": "YulIdentifier", + "src": "3342:5:23" + } + ] + } + ] + }, + "condition": { + "name": "newLen", + "nativeSrc": "3305:6:23", + "nodeType": "YulIdentifier", + "src": "3305:6:23" + }, + "nativeSrc": "3302:89:23", + "nodeType": "YulIf", + "src": "3302:89:23" + }, + { + "expression": { + "arguments": [ + { + "name": "slot", + "nativeSrc": "3411:4:23", + "nodeType": "YulIdentifier", + "src": "3411:4:23" + }, + { + "arguments": [ + { + "name": "value", + "nativeSrc": "3470:5:23", + "nodeType": "YulIdentifier", + "src": "3470:5:23" + }, + { + "name": "newLen", + "nativeSrc": "3477:6:23", + "nodeType": "YulIdentifier", + "src": "3477:6:23" + } + ], + "functionName": { + "name": "extract_used_part_and_set_length_of_short_byte_array", + "nativeSrc": "3417:52:23", + "nodeType": "YulIdentifier", + "src": "3417:52:23" + }, + "nativeSrc": "3417:67:23", + "nodeType": "YulFunctionCall", + "src": "3417:67:23" + } + ], + "functionName": { + "name": "sstore", + "nativeSrc": "3404:6:23", + "nodeType": "YulIdentifier", + "src": "3404:6:23" + }, + "nativeSrc": "3404:81:23", + "nodeType": "YulFunctionCall", + "src": "3404:81:23" + }, + "nativeSrc": "3404:81:23", + "nodeType": "YulExpressionStatement", + "src": "3404:81:23" + } + ] + }, + "nativeSrc": "3253:242:23", + "nodeType": "YulCase", + "src": "3253:242:23", + "value": "default" + } + ], + "expression": { + "arguments": [ + { + "name": "newLen", + "nativeSrc": "2575:6:23", + "nodeType": "YulIdentifier", + "src": "2575:6:23" + }, + { + "kind": "number", + "nativeSrc": "2583:2:23", + "nodeType": "YulLiteral", + "src": "2583:2:23", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "gt", + "nativeSrc": "2572:2:23", + "nodeType": "YulIdentifier", + "src": "2572:2:23" + }, + "nativeSrc": "2572:14:23", + "nodeType": "YulFunctionCall", + "src": "2572:14:23" + }, + "nativeSrc": "2565:930:23", + "nodeType": "YulSwitch", + "src": "2565:930:23" + } + ] + }, + "name": "copy_byte_array_to_storage_from_t_string_memory_ptr_to_t_string_storage", + "nativeSrc": "2202:1299:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "slot", + "nativeSrc": "2283:4:23", + "nodeType": "YulTypedName", + "src": "2283:4:23", + "type": "" + }, + { + "name": "src", + "nativeSrc": "2289:3:23", + "nodeType": "YulTypedName", + "src": "2289:3:23", + "type": "" + } + ], + "src": "2202:1299:23" + }, + { + "body": { + "nativeSrc": "3719:276:23", + "nodeType": "YulBlock", + "src": "3719:276:23", + "statements": [ + { + "nativeSrc": "3729:27:23", + "nodeType": "YulAssignment", + "src": "3729:27:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3741:9:23", + "nodeType": "YulIdentifier", + "src": "3741:9:23" + }, + { + "kind": "number", + "nativeSrc": "3752:3:23", + "nodeType": "YulLiteral", + "src": "3752:3:23", + "type": "", + "value": "160" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3737:3:23", + "nodeType": "YulIdentifier", + "src": "3737:3:23" + }, + "nativeSrc": "3737:19:23", + "nodeType": "YulFunctionCall", + "src": "3737:19:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "3729:4:23", + "nodeType": "YulIdentifier", + "src": "3729:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3772:9:23", + "nodeType": "YulIdentifier", + "src": "3772:9:23" + }, + { + "name": "value0", + "nativeSrc": "3783:6:23", + "nodeType": "YulIdentifier", + "src": "3783:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3765:6:23", + "nodeType": "YulIdentifier", + "src": "3765:6:23" + }, + "nativeSrc": "3765:25:23", + "nodeType": "YulFunctionCall", + "src": "3765:25:23" + }, + "nativeSrc": "3765:25:23", + "nodeType": "YulExpressionStatement", + "src": "3765:25:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3810:9:23", + "nodeType": "YulIdentifier", + "src": "3810:9:23" + }, + { + "kind": "number", + "nativeSrc": "3821:2:23", + "nodeType": "YulLiteral", + "src": "3821:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3806:3:23", + "nodeType": "YulIdentifier", + "src": "3806:3:23" + }, + "nativeSrc": "3806:18:23", + "nodeType": "YulFunctionCall", + "src": "3806:18:23" + }, + { + "name": "value1", + "nativeSrc": "3826:6:23", + "nodeType": "YulIdentifier", + "src": "3826:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3799:6:23", + "nodeType": "YulIdentifier", + "src": "3799:6:23" + }, + "nativeSrc": "3799:34:23", + "nodeType": "YulFunctionCall", + "src": "3799:34:23" + }, + "nativeSrc": "3799:34:23", + "nodeType": "YulExpressionStatement", + "src": "3799:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3853:9:23", + "nodeType": "YulIdentifier", + "src": "3853:9:23" + }, + { + "kind": "number", + "nativeSrc": "3864:2:23", + "nodeType": "YulLiteral", + "src": "3864:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3849:3:23", + "nodeType": "YulIdentifier", + "src": "3849:3:23" + }, + "nativeSrc": "3849:18:23", + "nodeType": "YulFunctionCall", + "src": "3849:18:23" + }, + { + "name": "value2", + "nativeSrc": "3869:6:23", + "nodeType": "YulIdentifier", + "src": "3869:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3842:6:23", + "nodeType": "YulIdentifier", + "src": "3842:6:23" + }, + "nativeSrc": "3842:34:23", + "nodeType": "YulFunctionCall", + "src": "3842:34:23" + }, + "nativeSrc": "3842:34:23", + "nodeType": "YulExpressionStatement", + "src": "3842:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3896:9:23", + "nodeType": "YulIdentifier", + "src": "3896:9:23" + }, + { + "kind": "number", + "nativeSrc": "3907:2:23", + "nodeType": "YulLiteral", + "src": "3907:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3892:3:23", + "nodeType": "YulIdentifier", + "src": "3892:3:23" + }, + "nativeSrc": "3892:18:23", + "nodeType": "YulFunctionCall", + "src": "3892:18:23" + }, + { + "name": "value3", + "nativeSrc": "3912:6:23", + "nodeType": "YulIdentifier", + "src": "3912:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3885:6:23", + "nodeType": "YulIdentifier", + "src": "3885:6:23" + }, + "nativeSrc": "3885:34:23", + "nodeType": "YulFunctionCall", + "src": "3885:34:23" + }, + "nativeSrc": "3885:34:23", + "nodeType": "YulExpressionStatement", + "src": "3885:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3939:9:23", + "nodeType": "YulIdentifier", + "src": "3939:9:23" + }, + { + "kind": "number", + "nativeSrc": "3950:3:23", + "nodeType": "YulLiteral", + "src": "3950:3:23", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3935:3:23", + "nodeType": "YulIdentifier", + "src": "3935:3:23" + }, + "nativeSrc": "3935:19:23", + "nodeType": "YulFunctionCall", + "src": "3935:19:23" + }, + { + "arguments": [ + { + "name": "value4", + "nativeSrc": "3960:6:23", + "nodeType": "YulIdentifier", + "src": "3960:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3976:3:23", + "nodeType": "YulLiteral", + "src": "3976:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "3981:1:23", + "nodeType": "YulLiteral", + "src": "3981:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "3972:3:23", + "nodeType": "YulIdentifier", + "src": "3972:3:23" + }, + "nativeSrc": "3972:11:23", + "nodeType": "YulFunctionCall", + "src": "3972:11:23" + }, + { + "kind": "number", + "nativeSrc": "3985:1:23", + "nodeType": "YulLiteral", + "src": "3985:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "3968:3:23", + "nodeType": "YulIdentifier", + "src": "3968:3:23" + }, + "nativeSrc": "3968:19:23", + "nodeType": "YulFunctionCall", + "src": "3968:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "3956:3:23", + "nodeType": "YulIdentifier", + "src": "3956:3:23" + }, + "nativeSrc": "3956:32:23", + "nodeType": "YulFunctionCall", + "src": "3956:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3928:6:23", + "nodeType": "YulIdentifier", + "src": "3928:6:23" + }, + "nativeSrc": "3928:61:23", + "nodeType": "YulFunctionCall", + "src": "3928:61:23" + }, + "nativeSrc": "3928:61:23", + "nodeType": "YulExpressionStatement", + "src": "3928:61:23" + } + ] + }, + "name": "abi_encode_tuple_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__to_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__fromStack_reversed", + "nativeSrc": "3506:489:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "3656:9:23", + "nodeType": "YulTypedName", + "src": "3656:9:23", + "type": "" + }, + { + "name": "value4", + "nativeSrc": "3667:6:23", + "nodeType": "YulTypedName", + "src": "3667:6:23", + "type": "" + }, + { + "name": "value3", + "nativeSrc": "3675:6:23", + "nodeType": "YulTypedName", + "src": "3675:6:23", + "type": "" + }, + { + "name": "value2", + "nativeSrc": "3683:6:23", + "nodeType": "YulTypedName", + "src": "3683:6:23", + "type": "" + }, + { + "name": "value1", + "nativeSrc": "3691:6:23", + "nodeType": "YulTypedName", + "src": "3691:6:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "3699:6:23", + "nodeType": "YulTypedName", + "src": "3699:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "3710:4:23", + "nodeType": "YulTypedName", + "src": "3710:4:23", + "type": "" + } + ], + "src": "3506:489:23" + }, + { + "body": { + "nativeSrc": "4121:297:23", + "nodeType": "YulBlock", + "src": "4121:297:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4138:9:23", + "nodeType": "YulIdentifier", + "src": "4138:9:23" + }, + { + "kind": "number", + "nativeSrc": "4149:2:23", + "nodeType": "YulLiteral", + "src": "4149:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4131:6:23", + "nodeType": "YulIdentifier", + "src": "4131:6:23" + }, + "nativeSrc": "4131:21:23", + "nodeType": "YulFunctionCall", + "src": "4131:21:23" + }, + "nativeSrc": "4131:21:23", + "nodeType": "YulExpressionStatement", + "src": "4131:21:23" + }, + { + "nativeSrc": "4161:27:23", + "nodeType": "YulVariableDeclaration", + "src": "4161:27:23", + "value": { + "arguments": [ + { + "name": "value0", + "nativeSrc": "4181:6:23", + "nodeType": "YulIdentifier", + "src": "4181:6:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "4175:5:23", + "nodeType": "YulIdentifier", + "src": "4175:5:23" + }, + "nativeSrc": "4175:13:23", + "nodeType": "YulFunctionCall", + "src": "4175:13:23" + }, + "variables": [ + { + "name": "length", + "nativeSrc": "4165:6:23", + "nodeType": "YulTypedName", + "src": "4165:6:23", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4208:9:23", + "nodeType": "YulIdentifier", + "src": "4208:9:23" + }, + { + "kind": "number", + "nativeSrc": "4219:2:23", + "nodeType": "YulLiteral", + "src": "4219:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4204:3:23", + "nodeType": "YulIdentifier", + "src": "4204:3:23" + }, + "nativeSrc": "4204:18:23", + "nodeType": "YulFunctionCall", + "src": "4204:18:23" + }, + { + "name": "length", + "nativeSrc": "4224:6:23", + "nodeType": "YulIdentifier", + "src": "4224:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4197:6:23", + "nodeType": "YulIdentifier", + "src": "4197:6:23" + }, + "nativeSrc": "4197:34:23", + "nodeType": "YulFunctionCall", + "src": "4197:34:23" + }, + "nativeSrc": "4197:34:23", + "nodeType": "YulExpressionStatement", + "src": "4197:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4250:9:23", + "nodeType": "YulIdentifier", + "src": "4250:9:23" + }, + { + "kind": "number", + "nativeSrc": "4261:2:23", + "nodeType": "YulLiteral", + "src": "4261:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4246:3:23", + "nodeType": "YulIdentifier", + "src": "4246:3:23" + }, + "nativeSrc": "4246:18:23", + "nodeType": "YulFunctionCall", + "src": "4246:18:23" + }, + { + "arguments": [ + { + "name": "value0", + "nativeSrc": "4270:6:23", + "nodeType": "YulIdentifier", + "src": "4270:6:23" + }, + { + "kind": "number", + "nativeSrc": "4278:2:23", + "nodeType": "YulLiteral", + "src": "4278:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4266:3:23", + "nodeType": "YulIdentifier", + "src": "4266:3:23" + }, + "nativeSrc": "4266:15:23", + "nodeType": "YulFunctionCall", + "src": "4266:15:23" + }, + { + "name": "length", + "nativeSrc": "4283:6:23", + "nodeType": "YulIdentifier", + "src": "4283:6:23" + } + ], + "functionName": { + "name": "mcopy", + "nativeSrc": "4240:5:23", + "nodeType": "YulIdentifier", + "src": "4240:5:23" + }, + "nativeSrc": "4240:50:23", + "nodeType": "YulFunctionCall", + "src": "4240:50:23" + }, + "nativeSrc": "4240:50:23", + "nodeType": "YulExpressionStatement", + "src": "4240:50:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4314:9:23", + "nodeType": "YulIdentifier", + "src": "4314:9:23" + }, + { + "name": "length", + "nativeSrc": "4325:6:23", + "nodeType": "YulIdentifier", + "src": "4325:6:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4310:3:23", + "nodeType": "YulIdentifier", + "src": "4310:3:23" + }, + "nativeSrc": "4310:22:23", + "nodeType": "YulFunctionCall", + "src": "4310:22:23" + }, + { + "kind": "number", + "nativeSrc": "4334:2:23", + "nodeType": "YulLiteral", + "src": "4334:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4306:3:23", + "nodeType": "YulIdentifier", + "src": "4306:3:23" + }, + "nativeSrc": "4306:31:23", + "nodeType": "YulFunctionCall", + "src": "4306:31:23" + }, + { + "kind": "number", + "nativeSrc": "4339:1:23", + "nodeType": "YulLiteral", + "src": "4339:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4299:6:23", + "nodeType": "YulIdentifier", + "src": "4299:6:23" + }, + "nativeSrc": "4299:42:23", + "nodeType": "YulFunctionCall", + "src": "4299:42:23" + }, + "nativeSrc": "4299:42:23", + "nodeType": "YulExpressionStatement", + "src": "4299:42:23" + }, + { + "nativeSrc": "4350:62:23", + "nodeType": "YulAssignment", + "src": "4350:62:23", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4366:9:23", + "nodeType": "YulIdentifier", + "src": "4366:9:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "length", + "nativeSrc": "4385:6:23", + "nodeType": "YulIdentifier", + "src": "4385:6:23" + }, + { + "kind": "number", + "nativeSrc": "4393:2:23", + "nodeType": "YulLiteral", + "src": "4393:2:23", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4381:3:23", + "nodeType": "YulIdentifier", + "src": "4381:3:23" + }, + "nativeSrc": "4381:15:23", + "nodeType": "YulFunctionCall", + "src": "4381:15:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "4402:2:23", + "nodeType": "YulLiteral", + "src": "4402:2:23", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "4398:3:23", + "nodeType": "YulIdentifier", + "src": "4398:3:23" + }, + "nativeSrc": "4398:7:23", + "nodeType": "YulFunctionCall", + "src": "4398:7:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "4377:3:23", + "nodeType": "YulIdentifier", + "src": "4377:3:23" + }, + "nativeSrc": "4377:29:23", + "nodeType": "YulFunctionCall", + "src": "4377:29:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4362:3:23", + "nodeType": "YulIdentifier", + "src": "4362:3:23" + }, + "nativeSrc": "4362:45:23", + "nodeType": "YulFunctionCall", + "src": "4362:45:23" + }, + { + "kind": "number", + "nativeSrc": "4409:2:23", + "nodeType": "YulLiteral", + "src": "4409:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4358:3:23", + "nodeType": "YulIdentifier", + "src": "4358:3:23" + }, + "nativeSrc": "4358:54:23", + "nodeType": "YulFunctionCall", + "src": "4358:54:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "4350:4:23", + "nodeType": "YulIdentifier", + "src": "4350:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "4000:418:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "4090:9:23", + "nodeType": "YulTypedName", + "src": "4090:9:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "4101:6:23", + "nodeType": "YulTypedName", + "src": "4101:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "4112:4:23", + "nodeType": "YulTypedName", + "src": "4112:4:23", + "type": "" + } + ], + "src": "4000:418:23" + }, + { + "body": { + "nativeSrc": "4517:203:23", + "nodeType": "YulBlock", + "src": "4517:203:23", + "statements": [ + { + "nativeSrc": "4527:26:23", + "nodeType": "YulVariableDeclaration", + "src": "4527:26:23", + "value": { + "arguments": [ + { + "name": "array", + "nativeSrc": "4547:5:23", + "nodeType": "YulIdentifier", + "src": "4547:5:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "4541:5:23", + "nodeType": "YulIdentifier", + "src": "4541:5:23" + }, + "nativeSrc": "4541:12:23", + "nodeType": "YulFunctionCall", + "src": "4541:12:23" + }, + "variables": [ + { + "name": "length", + "nativeSrc": "4531:6:23", + "nodeType": "YulTypedName", + "src": "4531:6:23", + "type": "" + } + ] + }, + { + "nativeSrc": "4562:32:23", + "nodeType": "YulAssignment", + "src": "4562:32:23", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "array", + "nativeSrc": "4581:5:23", + "nodeType": "YulIdentifier", + "src": "4581:5:23" + }, + { + "kind": "number", + "nativeSrc": "4588:4:23", + "nodeType": "YulLiteral", + "src": "4588:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4577:3:23", + "nodeType": "YulIdentifier", + "src": "4577:3:23" + }, + "nativeSrc": "4577:16:23", + "nodeType": "YulFunctionCall", + "src": "4577:16:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "4571:5:23", + "nodeType": "YulIdentifier", + "src": "4571:5:23" + }, + "nativeSrc": "4571:23:23", + "nodeType": "YulFunctionCall", + "src": "4571:23:23" + }, + "variableNames": [ + { + "name": "value", + "nativeSrc": "4562:5:23", + "nodeType": "YulIdentifier", + "src": "4562:5:23" + } + ] + }, + { + "body": { + "nativeSrc": "4631:83:23", + "nodeType": "YulBlock", + "src": "4631:83:23", + "statements": [ + { + "nativeSrc": "4645:59:23", + "nodeType": "YulAssignment", + "src": "4645:59:23", + "value": { + "arguments": [ + { + "name": "value", + "nativeSrc": "4658:5:23", + "nodeType": "YulIdentifier", + "src": "4658:5:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "4673:1:23", + "nodeType": "YulLiteral", + "src": "4673:1:23", + "type": "", + "value": "3" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "4680:4:23", + "nodeType": "YulLiteral", + "src": "4680:4:23", + "type": "", + "value": "0x20" + }, + { + "name": "length", + "nativeSrc": "4686:6:23", + "nodeType": "YulIdentifier", + "src": "4686:6:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "4676:3:23", + "nodeType": "YulIdentifier", + "src": "4676:3:23" + }, + "nativeSrc": "4676:17:23", + "nodeType": "YulFunctionCall", + "src": "4676:17:23" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "4669:3:23", + "nodeType": "YulIdentifier", + "src": "4669:3:23" + }, + "nativeSrc": "4669:25:23", + "nodeType": "YulFunctionCall", + "src": "4669:25:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "4700:1:23", + "nodeType": "YulLiteral", + "src": "4700:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "4696:3:23", + "nodeType": "YulIdentifier", + "src": "4696:3:23" + }, + "nativeSrc": "4696:6:23", + "nodeType": "YulFunctionCall", + "src": "4696:6:23" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "4665:3:23", + "nodeType": "YulIdentifier", + "src": "4665:3:23" + }, + "nativeSrc": "4665:38:23", + "nodeType": "YulFunctionCall", + "src": "4665:38:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "4654:3:23", + "nodeType": "YulIdentifier", + "src": "4654:3:23" + }, + "nativeSrc": "4654:50:23", + "nodeType": "YulFunctionCall", + "src": "4654:50:23" + }, + "variableNames": [ + { + "name": "value", + "nativeSrc": "4645:5:23", + "nodeType": "YulIdentifier", + "src": "4645:5:23" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "length", + "nativeSrc": "4609:6:23", + "nodeType": "YulIdentifier", + "src": "4609:6:23" + }, + { + "kind": "number", + "nativeSrc": "4617:4:23", + "nodeType": "YulLiteral", + "src": "4617:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "4606:2:23", + "nodeType": "YulIdentifier", + "src": "4606:2:23" + }, + "nativeSrc": "4606:16:23", + "nodeType": "YulFunctionCall", + "src": "4606:16:23" + }, + "nativeSrc": "4603:111:23", + "nodeType": "YulIf", + "src": "4603:111:23" + } + ] + }, + "name": "convert_bytes_to_fixedbytes_from_t_bytes_memory_ptr_to_t_bytes32", + "nativeSrc": "4423:297:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "array", + "nativeSrc": "4497:5:23", + "nodeType": "YulTypedName", + "src": "4497:5:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value", + "nativeSrc": "4507:5:23", + "nodeType": "YulTypedName", + "src": "4507:5:23", + "type": "" + } + ], + "src": "4423:297:23" + } + ] + }, + "contents": "{\n { }\n function abi_decode_tuple_t_address_fromMemory(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n let value := mload(headStart)\n if iszero(eq(value, and(value, sub(shl(160, 1), 1)))) { revert(0, 0) }\n value0 := value\n }\n function abi_encode_tuple_t_address__to_t_address__fromStack_reversed(headStart, value0) -> tail\n {\n tail := add(headStart, 32)\n mstore(headStart, and(value0, sub(shl(160, 1), 1)))\n }\n function abi_encode_tuple_t_stringliteral_480a3d2cf1e4838d740f40eac57f23eb6facc0baaf1a65a7b61df6a5a00ed368__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 19)\n mstore(add(headStart, 64), \"Invalid destination\")\n tail := add(headStart, 96)\n }\n function panic_error_0x41()\n {\n mstore(0, shl(224, 0x4e487b71))\n mstore(4, 0x41)\n revert(0, 0x24)\n }\n function extract_byte_array_length(data) -> length\n {\n length := shr(1, data)\n let outOfPlaceEncoding := and(data, 1)\n if iszero(outOfPlaceEncoding) { length := and(length, 0x7f) }\n if eq(outOfPlaceEncoding, lt(length, 32))\n {\n mstore(0, shl(224, 0x4e487b71))\n mstore(4, 0x22)\n revert(0, 0x24)\n }\n }\n function array_dataslot_string_storage(ptr) -> data\n {\n mstore(0, ptr)\n data := keccak256(0, 0x20)\n }\n function clean_up_bytearray_end_slots_string_storage(array, len, startIndex)\n {\n if gt(len, 31)\n {\n mstore(0, array)\n let data := keccak256(0, 0x20)\n let deleteStart := add(data, shr(5, add(startIndex, 31)))\n if lt(startIndex, 0x20) { deleteStart := data }\n let _1 := add(data, shr(5, add(len, 31)))\n let start := deleteStart\n for { } lt(start, _1) { start := add(start, 1) }\n { sstore(start, 0) }\n }\n }\n function extract_used_part_and_set_length_of_short_byte_array(data, len) -> used\n {\n used := or(and(data, not(shr(shl(3, len), not(0)))), shl(1, len))\n }\n function copy_byte_array_to_storage_from_t_string_memory_ptr_to_t_string_storage(slot, src)\n {\n let newLen := mload(src)\n if gt(newLen, sub(shl(64, 1), 1)) { panic_error_0x41() }\n clean_up_bytearray_end_slots_string_storage(slot, extract_byte_array_length(sload(slot)), newLen)\n let srcOffset := 0\n srcOffset := 0x20\n switch gt(newLen, 31)\n case 1 {\n let loopEnd := and(newLen, not(31))\n let dstPtr := array_dataslot_string_storage(slot)\n let i := 0\n for { } lt(i, loopEnd) { i := add(i, 0x20) }\n {\n sstore(dstPtr, mload(add(src, srcOffset)))\n dstPtr := add(dstPtr, 1)\n srcOffset := add(srcOffset, 0x20)\n }\n if lt(loopEnd, newLen)\n {\n let lastValue := mload(add(src, srcOffset))\n sstore(dstPtr, and(lastValue, not(shr(and(shl(3, newLen), 248), not(0)))))\n }\n sstore(slot, add(shl(1, newLen), 1))\n }\n default {\n let value := 0\n if newLen\n {\n value := mload(add(src, srcOffset))\n }\n sstore(slot, extract_used_part_and_set_length_of_short_byte_array(value, newLen))\n }\n }\n function abi_encode_tuple_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__to_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__fromStack_reversed(headStart, value4, value3, value2, value1, value0) -> tail\n {\n tail := add(headStart, 160)\n mstore(headStart, value0)\n mstore(add(headStart, 32), value1)\n mstore(add(headStart, 64), value2)\n mstore(add(headStart, 96), value3)\n mstore(add(headStart, 128), and(value4, sub(shl(160, 1), 1)))\n }\n function abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed(headStart, value0) -> tail\n {\n mstore(headStart, 32)\n let length := mload(value0)\n mstore(add(headStart, 32), length)\n mcopy(add(headStart, 64), add(value0, 32), length)\n mstore(add(add(headStart, length), 64), 0)\n tail := add(add(headStart, and(add(length, 31), not(31))), 64)\n }\n function convert_bytes_to_fixedbytes_from_t_bytes_memory_ptr_to_t_bytes32(array) -> value\n {\n let length := mload(array)\n value := mload(add(array, 0x20))\n if lt(length, 0x20)\n {\n value := and(value, shl(shl(3, sub(0x20, length)), not(0)))\n }\n }\n}", + "id": 23, + "language": "Yul", + "name": "#utility.yul" + } + ], + "linkReferences": {}, + "object": "610180604052348015610010575f5ffd5b50604051611a4d380380611a4d83398101604081905261002f91610294565b604080518082018252600c81526b2a37b5b2b72932b630bcb2b960a11b602080830191909152825180840190935260018352603160f81b9083015290338061009157604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b61009a816101d6565b5060017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00556100ca826001610225565b610120526100d9816002610225565b61014052815160208084019190912060e052815190820120610100524660a05261016560e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b60805250503060c0526001600160a01b0381166101c45760405162461bcd60e51b815260206004820152601360248201527f496e76616c69642064657374696e6174696f6e000000000000000000000000006044820152606401610088565b6001600160a01b03166101605261046b565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f6020835110156102405761023983610257565b9050610251565b8161024b8482610359565b5060ff90505b92915050565b5f5f829050601f81511115610281578260405163305a27a960e01b81526004016100889190610413565b805161028c82610448565b179392505050565b5f602082840312156102a4575f5ffd5b81516001600160a01b03811681146102ba575f5ffd5b9392505050565b634e487b7160e01b5f52604160045260245ffd5b600181811c908216806102e957607f821691505b60208210810361030757634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111561035457805f5260205f20601f840160051c810160208510156103325750805b601f840160051c820191505b81811015610351575f815560010161033e565b50505b505050565b81516001600160401b03811115610372576103726102c1565b6103868161038084546102d5565b8461030d565b6020601f8211600181146103b8575f83156103a15750848201515b5f19600385901b1c1916600184901b178455610351565b5f84815260208120601f198516915b828110156103e757878501518255602094850194600190920191016103c7565b508482101561040457868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b80516020808301519190811015610307575f1960209190910360031b1b16919050565b60805160a05160c05160e0516101005161012051610140516101605161156c6104e15f395f818160d701528181610525015281816105f4015281816109500152610bf801525f610d2d01525f610cfb01525f6111bc01525f61119401525f6110ef01525f61111901525f611143015261156c5ff3fe608060405260043610610092575f3560e01c80639e281a98116100575780639e281a9814610159578063d850124e14610178578063dcb79457146101c1578063f14210a6146101e0578063f2fde38b146101ff575f5ffd5b80632af83bfe1461009d578063715018a6146100b257806375bd6863146100c657806384b0196e146101165780638da5cb5b1461013d575f5ffd5b3661009957005b5f5ffd5b6100b06100ab3660046112dd565b61021e565b005b3480156100bd575f5ffd5b506100b06106ae565b3480156100d1575f5ffd5b506100f97f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b348015610121575f5ffd5b5061012a6106c1565b60405161010d979695949392919061134a565b348015610148575f5ffd5b505f546001600160a01b03166100f9565b348015610164575f5ffd5b506100b06101733660046113fb565b610703565b348015610183575f5ffd5b506101b16101923660046113fb565b600360209081525f928352604080842090915290825290205460ff1681565b604051901515815260200161010d565b3480156101cc575f5ffd5b506101b16101db3660046113fb565b61078b565b3480156101eb575f5ffd5b506100b06101fa366004611423565b6107b8565b34801561020a575f5ffd5b506100b061021936600461143a565b6108a7565b6102266108e1565b5f610237604083016020840161143a565b90506101208201356001600160a01b03821661028a5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21037bbb732b960991b60448201526064015b60405180910390fd5b5f610298602085018561143a565b6001600160a01b0316036102de5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2103a37b5b2b760991b6044820152606401610281565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff161561033e5760405162461bcd60e51b815260206004820152600a602482015269139bdb98d9481d5cd95960b21b6044820152606401610281565b8261014001354211156103855760405162461bcd60e51b815260206004820152600f60248201526e14185e5b1bd85908195e1c1a5c9959608a1b6044820152606401610281565b5f6103ee83610397602087018761143a565b60408701356103a960e0890189611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250505050610100890135876101408b013561090f565b90506001600160a01b038316610421826104106101808801610160890161149d565b876101800135886101a001356109db565b6001600160a01b0316146104655760405162461bcd60e51b815260206004820152600b60248201526a496e76616c69642073696760a81b6044820152606401610281565b83610100013534146104b95760405162461bcd60e51b815260206004820152601c60248201527f496e636f7272656374204554482076616c75652070726f7669646564000000006044820152606401610281565b6001600160a01b0383165f9081526003602090815260408083208584528252909120805460ff19166001179055610520906104f69086018661143a565b846040870135606088013561051160a08a0160808b0161149d565b8960a001358a60c00135610a07565b6105667f00000000000000000000000000000000000000000000000000000000000000006040860135610556602088018861143a565b6001600160a01b03169190610b75565b5f6105b261057760e0870187611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250349250610bf4915050565b9050806105ef5760405162461bcd60e51b815260206004820152600b60248201526a10d85b1b0819985a5b195960aa1b6044820152606401610281565b6106217f00000000000000000000000000000000000000000000000000000000000000005f610556602089018961143a565b61062e602086018661143a565b6001600160a01b0316846001600160a01b03167f78129a649632642d8e9f346c85d9efb70d32d50a36774c4585491a9228bbd350876040013560405161067691815260200190565b60405180910390a3505050506106ab60017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b50565b6106b6610c79565b6106bf5f610ca5565b565b5f6060805f5f5f60606106d2610cf4565b6106da610d26565b604080515f80825260208201909252600f60f81b9b939a50919850469750309650945092509050565b61070b610c79565b61073061071f5f546001600160a01b031690565b6001600160a01b0384169083610d53565b5f546001600160a01b03166001600160a01b0316826001600160a01b03167fa0524ee0fd8662d6c046d199da2a6d3dc49445182cec055873a5bb9c2843c8e08360405161077f91815260200190565b60405180910390a35050565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff165b92915050565b6107c0610c79565b5f80546040516001600160a01b039091169083908381818185875af1925050503d805f811461080a576040519150601f19603f3d011682016040523d82523d5f602084013e61080f565b606091505b50509050806108565760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610281565b5f546001600160a01b03166001600160a01b03167f6148672a948a12b8e0bf92a9338349b9ac890fad62a234abaf0a4da99f62cfcc8360405161089b91815260200190565b60405180910390a25050565b6108af610c79565b6001600160a01b0381166108d857604051631e4fbdf760e01b81525f6004820152602401610281565b6106ab81610ca5565b6108e9610d60565b60027f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b8351602080860191909120604080517ff0543e2024fd0ae16ccb842686c2733758ec65acfd69fb599c05b286f8db8844938101939093526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691840191909152808a1660608401528816608083015260a0820187905260c082015260e08101849052610100810183905261012081018290525f906109cf906101400160405160208183030381529060405280519060200120610da2565b98975050505050505050565b5f5f5f5f6109eb88888888610dce565b9250925092506109fb8282610e96565b50909695505050505050565b60405163d505accf60e01b81526001600160a01b038781166004830152306024830152604482018790526064820186905260ff8516608483015260a4820184905260c4820183905288169063d505accf9060e4015f604051808303815f87803b158015610a72575f5ffd5b505af1925050508015610a83575060015b610b5757604051636eb1769f60e11b81526001600160a01b03878116600483015230602483015286919089169063dd62ed3e90604401602060405180830381865afa158015610ad4573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610af891906114bd565b1015610b575760405162461bcd60e51b815260206004820152602860248201527f5065726d6974206661696c656420616e6420696e73756666696369656e7420616044820152676c6c6f77616e636560c01b6064820152608401610281565b610b6c6001600160a01b038816873088610f52565b50505050505050565b610b818383835f610f8e565b610bef57610b9283835f6001610f8e565b610bba57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b610bc78383836001610f8e565b610bef57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b505050565b5f5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168385604051610c2f91906114d4565b5f6040518083038185875af1925050503d805f8114610c69576040519150601f19603f3d011682016040523d82523d5f602084013e610c6e565b606091505b509095945050505050565b5f546001600160a01b031633146106bf5760405163118cdaa760e01b8152336004820152602401610281565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006001610ff0565b905090565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006002610ff0565b610bc78383836001611099565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00546002036106bf57604051633ee5aeb560e01b815260040160405180910390fd5b5f6107b2610dae6110e3565b8360405161190160f01b8152600281019290925260228201526042902090565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115610e0757505f91506003905082610e8c565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015610e58573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b038116610e8357505f925060019150829050610e8c565b92505f91508190505b9450945094915050565b5f826003811115610ea957610ea96114ea565b03610eb2575050565b6001826003811115610ec657610ec66114ea565b03610ee45760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115610ef857610ef86114ea565b03610f195760405163fce698f760e01b815260048101829052602401610281565b6003826003811115610f2d57610f2d6114ea565b03610f4e576040516335e2f38360e21b815260048101829052602401610281565b5050565b610f6084848484600161120c565b610f8857604051635274afe760e01b81526001600160a01b0385166004820152602401610281565b50505050565b60405163095ea7b360e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f873b113d1516831692505b60405250949350505050565b606060ff831461100a5761100383611279565b90506107b2565b818054611016906114fe565b80601f0160208091040260200160405190810160405280929190818152602001828054611042906114fe565b801561108d5780601f106110645761010080835404028352916020019161108d565b820191905f5260205f20905b81548152906001019060200180831161107057829003601f168201915b505050505090506107b2565b60405163a9059cbb60e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561113b57507f000000000000000000000000000000000000000000000000000000000000000046145b1561116557507f000000000000000000000000000000000000000000000000000000000000000090565b610d21604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b6040516323b872dd60e01b5f8181526001600160a01b038781166004528616602452604485905291602083606481808c5af1925060015f5114831661126857838315161561125c573d5f823e3d81fd5b5f883b113d1516831692505b604052505f60605295945050505050565b60605f611285836112b6565b6040805160208082528183019092529192505f91906020820181803683375050509182525060208101929092525090565b5f60ff8216601f8111156107b257604051632cd44ac360e21b815260040160405180910390fd5b5f602082840312156112ed575f5ffd5b813567ffffffffffffffff811115611303575f5ffd5b82016101c08185031215611315575f5ffd5b9392505050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b60ff60f81b8816815260e060208201525f61136860e083018961131c565b828103604084015261137a818961131c565b606084018890526001600160a01b038716608085015260a0840186905283810360c0850152845180825260208087019350909101905f5b818110156113cf5783518352602093840193909201916001016113b1565b50909b9a5050505050505050505050565b80356001600160a01b03811681146113f6575f5ffd5b919050565b5f5f6040838503121561140c575f5ffd5b611415836113e0565b946020939093013593505050565b5f60208284031215611433575f5ffd5b5035919050565b5f6020828403121561144a575f5ffd5b611315826113e0565b5f5f8335601e19843603018112611468575f5ffd5b83018035915067ffffffffffffffff821115611482575f5ffd5b602001915036819003821315611496575f5ffd5b9250929050565b5f602082840312156114ad575f5ffd5b813560ff81168114611315575f5ffd5b5f602082840312156114cd575f5ffd5b5051919050565b5f82518060208501845e5f920191825250919050565b634e487b7160e01b5f52602160045260245ffd5b600181811c9082168061151257607f821691505b60208210810361153057634e487b7160e01b5f52602260045260245ffd5b5091905056fea26469706673582212209c34db2f6f83af136a5340cce7fe8ef554ea8eb633656fbf9bff3bd731aec40f64736f6c634300081c0033", + "opcodes": "PUSH2 0x180 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH2 0x1A4D CODESIZE SUB DUP1 PUSH2 0x1A4D DUP4 CODECOPY DUP2 ADD PUSH1 0x40 DUP2 SWAP1 MSTORE PUSH2 0x2F SWAP2 PUSH2 0x294 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD DUP3 MSTORE PUSH1 0xC DUP2 MSTORE PUSH12 0x2A37B5B2B72932B630BCB2B9 PUSH1 0xA1 SHL PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP3 MLOAD DUP1 DUP5 ADD SWAP1 SWAP4 MSTORE PUSH1 0x1 DUP4 MSTORE PUSH1 0x31 PUSH1 0xF8 SHL SWAP1 DUP4 ADD MSTORE SWAP1 CALLER DUP1 PUSH2 0x91 JUMPI PUSH1 0x40 MLOAD PUSH4 0x1E4FBDF7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH0 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0x9A DUP2 PUSH2 0x1D6 JUMP JUMPDEST POP PUSH1 0x1 PUSH32 0x9B779B17422D0DF92223018B32B4D1FA46E071723D6817E2486D003BECC55F00 SSTORE PUSH2 0xCA DUP3 PUSH1 0x1 PUSH2 0x225 JUMP JUMPDEST PUSH2 0x120 MSTORE PUSH2 0xD9 DUP2 PUSH1 0x2 PUSH2 0x225 JUMP JUMPDEST PUSH2 0x140 MSTORE DUP2 MLOAD PUSH1 0x20 DUP1 DUP5 ADD SWAP2 SWAP1 SWAP2 KECCAK256 PUSH1 0xE0 MSTORE DUP2 MLOAD SWAP1 DUP3 ADD KECCAK256 PUSH2 0x100 MSTORE CHAINID PUSH1 0xA0 MSTORE PUSH2 0x165 PUSH1 0xE0 MLOAD PUSH2 0x100 MLOAD PUSH1 0x40 DUP1 MLOAD PUSH32 0x8B73C3C69BB8FE3D512ECC4CF759CC79239F7B179B0FFACAA9A75D522B39400F PUSH1 0x20 DUP3 ADD MSTORE SWAP1 DUP2 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x60 DUP3 ADD MSTORE CHAINID PUSH1 0x80 DUP3 ADD MSTORE ADDRESS PUSH1 0xA0 DUP3 ADD MSTORE PUSH0 SWAP1 PUSH1 0xC0 ADD PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 DUP4 SUB SUB DUP2 MSTORE SWAP1 PUSH1 0x40 MSTORE DUP1 MLOAD SWAP1 PUSH1 0x20 ADD KECCAK256 SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x80 MSTORE POP POP ADDRESS PUSH1 0xC0 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND PUSH2 0x1C4 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x496E76616C69642064657374696E6174696F6E00000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x88 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH2 0x160 MSTORE PUSH2 0x46B JUMP JUMPDEST PUSH0 DUP1 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP4 DUP2 AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB NOT DUP4 AND DUP2 OR DUP5 SSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP3 AND SWAP3 DUP4 SWAP2 PUSH32 0x8BE0079C531659141344CD1FD0A4F28419497F9722A3DAAFE3B4186F6B6457E0 SWAP2 SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP4 MLOAD LT ISZERO PUSH2 0x240 JUMPI PUSH2 0x239 DUP4 PUSH2 0x257 JUMP JUMPDEST SWAP1 POP PUSH2 0x251 JUMP JUMPDEST DUP2 PUSH2 0x24B DUP5 DUP3 PUSH2 0x359 JUMP JUMPDEST POP PUSH1 0xFF SWAP1 POP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH0 PUSH0 DUP3 SWAP1 POP PUSH1 0x1F DUP2 MLOAD GT ISZERO PUSH2 0x281 JUMPI DUP3 PUSH1 0x40 MLOAD PUSH4 0x305A27A9 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x88 SWAP2 SWAP1 PUSH2 0x413 JUMP JUMPDEST DUP1 MLOAD PUSH2 0x28C DUP3 PUSH2 0x448 JUMP JUMPDEST OR SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x2A4 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP2 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND DUP2 EQ PUSH2 0x2BA JUMPI PUSH0 PUSH0 REVERT JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x41 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST PUSH1 0x1 DUP2 DUP2 SHR SWAP1 DUP3 AND DUP1 PUSH2 0x2E9 JUMPI PUSH1 0x7F DUP3 AND SWAP2 POP JUMPDEST PUSH1 0x20 DUP3 LT DUP2 SUB PUSH2 0x307 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x22 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x1F DUP3 GT ISZERO PUSH2 0x354 JUMPI DUP1 PUSH0 MSTORE PUSH1 0x20 PUSH0 KECCAK256 PUSH1 0x1F DUP5 ADD PUSH1 0x5 SHR DUP2 ADD PUSH1 0x20 DUP6 LT ISZERO PUSH2 0x332 JUMPI POP DUP1 JUMPDEST PUSH1 0x1F DUP5 ADD PUSH1 0x5 SHR DUP3 ADD SWAP2 POP JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x351 JUMPI PUSH0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0x33E JUMP JUMPDEST POP POP JUMPDEST POP POP POP JUMP JUMPDEST DUP2 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x372 JUMPI PUSH2 0x372 PUSH2 0x2C1 JUMP JUMPDEST PUSH2 0x386 DUP2 PUSH2 0x380 DUP5 SLOAD PUSH2 0x2D5 JUMP JUMPDEST DUP5 PUSH2 0x30D JUMP JUMPDEST PUSH1 0x20 PUSH1 0x1F DUP3 GT PUSH1 0x1 DUP2 EQ PUSH2 0x3B8 JUMPI PUSH0 DUP4 ISZERO PUSH2 0x3A1 JUMPI POP DUP5 DUP3 ADD MLOAD JUMPDEST PUSH0 NOT PUSH1 0x3 DUP6 SWAP1 SHL SHR NOT AND PUSH1 0x1 DUP5 SWAP1 SHL OR DUP5 SSTORE PUSH2 0x351 JUMP JUMPDEST PUSH0 DUP5 DUP2 MSTORE PUSH1 0x20 DUP2 KECCAK256 PUSH1 0x1F NOT DUP6 AND SWAP2 JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0x3E7 JUMPI DUP8 DUP6 ADD MLOAD DUP3 SSTORE PUSH1 0x20 SWAP5 DUP6 ADD SWAP5 PUSH1 0x1 SWAP1 SWAP3 ADD SWAP2 ADD PUSH2 0x3C7 JUMP JUMPDEST POP DUP5 DUP3 LT ISZERO PUSH2 0x404 JUMPI DUP7 DUP5 ADD MLOAD PUSH0 NOT PUSH1 0x3 DUP8 SWAP1 SHL PUSH1 0xF8 AND SHR NOT AND DUP2 SSTORE JUMPDEST POP POP POP POP PUSH1 0x1 SWAP1 DUP2 SHL ADD SWAP1 SSTORE POP JUMP JUMPDEST PUSH1 0x20 DUP2 MSTORE PUSH0 DUP3 MLOAD DUP1 PUSH1 0x20 DUP5 ADD MSTORE DUP1 PUSH1 0x20 DUP6 ADD PUSH1 0x40 DUP6 ADD MCOPY PUSH0 PUSH1 0x40 DUP3 DUP6 ADD ADD MSTORE PUSH1 0x40 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND DUP5 ADD ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST DUP1 MLOAD PUSH1 0x20 DUP1 DUP4 ADD MLOAD SWAP2 SWAP1 DUP2 LT ISZERO PUSH2 0x307 JUMPI PUSH0 NOT PUSH1 0x20 SWAP2 SWAP1 SWAP2 SUB PUSH1 0x3 SHL SHL AND SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x80 MLOAD PUSH1 0xA0 MLOAD PUSH1 0xC0 MLOAD PUSH1 0xE0 MLOAD PUSH2 0x100 MLOAD PUSH2 0x120 MLOAD PUSH2 0x140 MLOAD PUSH2 0x160 MLOAD PUSH2 0x156C PUSH2 0x4E1 PUSH0 CODECOPY PUSH0 DUP2 DUP2 PUSH1 0xD7 ADD MSTORE DUP2 DUP2 PUSH2 0x525 ADD MSTORE DUP2 DUP2 PUSH2 0x5F4 ADD MSTORE DUP2 DUP2 PUSH2 0x950 ADD MSTORE PUSH2 0xBF8 ADD MSTORE PUSH0 PUSH2 0xD2D ADD MSTORE PUSH0 PUSH2 0xCFB ADD MSTORE PUSH0 PUSH2 0x11BC ADD MSTORE PUSH0 PUSH2 0x1194 ADD MSTORE PUSH0 PUSH2 0x10EF ADD MSTORE PUSH0 PUSH2 0x1119 ADD MSTORE PUSH0 PUSH2 0x1143 ADD MSTORE PUSH2 0x156C PUSH0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x92 JUMPI PUSH0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x9E281A98 GT PUSH2 0x57 JUMPI DUP1 PUSH4 0x9E281A98 EQ PUSH2 0x159 JUMPI DUP1 PUSH4 0xD850124E EQ PUSH2 0x178 JUMPI DUP1 PUSH4 0xDCB79457 EQ PUSH2 0x1C1 JUMPI DUP1 PUSH4 0xF14210A6 EQ PUSH2 0x1E0 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x1FF JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP1 PUSH4 0x2AF83BFE EQ PUSH2 0x9D JUMPI DUP1 PUSH4 0x715018A6 EQ PUSH2 0xB2 JUMPI DUP1 PUSH4 0x75BD6863 EQ PUSH2 0xC6 JUMPI DUP1 PUSH4 0x84B0196E EQ PUSH2 0x116 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x13D JUMPI PUSH0 PUSH0 REVERT JUMPDEST CALLDATASIZE PUSH2 0x99 JUMPI STOP JUMPDEST PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0xB0 PUSH2 0xAB CALLDATASIZE PUSH1 0x4 PUSH2 0x12DD JUMP JUMPDEST PUSH2 0x21E JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xBD JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xB0 PUSH2 0x6AE JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xD1 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xF9 PUSH32 0x0 DUP2 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP2 AND DUP2 MSTORE PUSH1 0x20 ADD JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x121 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x12A PUSH2 0x6C1 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x10D SWAP8 SWAP7 SWAP6 SWAP5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x134A JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x148 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH2 0xF9 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x164 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xB0 PUSH2 0x173 CALLDATASIZE PUSH1 0x4 PUSH2 0x13FB JUMP JUMPDEST PUSH2 0x703 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x183 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x1B1 PUSH2 0x192 CALLDATASIZE PUSH1 0x4 PUSH2 0x13FB JUMP JUMPDEST PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x40 MLOAD SWAP1 ISZERO ISZERO DUP2 MSTORE PUSH1 0x20 ADD PUSH2 0x10D JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1CC JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x1B1 PUSH2 0x1DB CALLDATASIZE PUSH1 0x4 PUSH2 0x13FB JUMP JUMPDEST PUSH2 0x78B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1EB JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xB0 PUSH2 0x1FA CALLDATASIZE PUSH1 0x4 PUSH2 0x1423 JUMP JUMPDEST PUSH2 0x7B8 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x20A JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xB0 PUSH2 0x219 CALLDATASIZE PUSH1 0x4 PUSH2 0x143A JUMP JUMPDEST PUSH2 0x8A7 JUMP JUMPDEST PUSH2 0x226 PUSH2 0x8E1 JUMP JUMPDEST PUSH0 PUSH2 0x237 PUSH1 0x40 DUP4 ADD PUSH1 0x20 DUP5 ADD PUSH2 0x143A JUMP JUMPDEST SWAP1 POP PUSH2 0x120 DUP3 ADD CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP3 AND PUSH2 0x28A JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xD PUSH1 0x24 DUP3 ADD MSTORE PUSH13 0x24B73B30B634B21037BBB732B9 PUSH1 0x99 SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH0 PUSH2 0x298 PUSH1 0x20 DUP6 ADD DUP6 PUSH2 0x143A JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND SUB PUSH2 0x2DE JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xD PUSH1 0x24 DUP3 ADD MSTORE PUSH13 0x24B73B30B634B2103A37B5B2B7 PUSH1 0x99 SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP3 AND PUSH0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP5 DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x33E JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xA PUSH1 0x24 DUP3 ADD MSTORE PUSH10 0x139BDB98D9481D5CD959 PUSH1 0xB2 SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST DUP3 PUSH2 0x140 ADD CALLDATALOAD TIMESTAMP GT ISZERO PUSH2 0x385 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xF PUSH1 0x24 DUP3 ADD MSTORE PUSH15 0x14185E5B1BD85908195E1C1A5C9959 PUSH1 0x8A SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH0 PUSH2 0x3EE DUP4 PUSH2 0x397 PUSH1 0x20 DUP8 ADD DUP8 PUSH2 0x143A JUMP JUMPDEST PUSH1 0x40 DUP8 ADD CALLDATALOAD PUSH2 0x3A9 PUSH1 0xE0 DUP10 ADD DUP10 PUSH2 0x1453 JUMP JUMPDEST DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY PUSH0 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP POP POP POP PUSH2 0x100 DUP10 ADD CALLDATALOAD DUP8 PUSH2 0x140 DUP12 ADD CALLDATALOAD PUSH2 0x90F JUMP JUMPDEST SWAP1 POP PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP4 AND PUSH2 0x421 DUP3 PUSH2 0x410 PUSH2 0x180 DUP9 ADD PUSH2 0x160 DUP10 ADD PUSH2 0x149D JUMP JUMPDEST DUP8 PUSH2 0x180 ADD CALLDATALOAD DUP9 PUSH2 0x1A0 ADD CALLDATALOAD PUSH2 0x9DB JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND EQ PUSH2 0x465 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xB PUSH1 0x24 DUP3 ADD MSTORE PUSH11 0x496E76616C696420736967 PUSH1 0xA8 SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST DUP4 PUSH2 0x100 ADD CALLDATALOAD CALLVALUE EQ PUSH2 0x4B9 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1C PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x496E636F7272656374204554482076616C75652070726F766964656400000000 PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP4 AND PUSH0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP6 DUP5 MSTORE DUP3 MSTORE SWAP1 SWAP2 KECCAK256 DUP1 SLOAD PUSH1 0xFF NOT AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0x520 SWAP1 PUSH2 0x4F6 SWAP1 DUP7 ADD DUP7 PUSH2 0x143A JUMP JUMPDEST DUP5 PUSH1 0x40 DUP8 ADD CALLDATALOAD PUSH1 0x60 DUP9 ADD CALLDATALOAD PUSH2 0x511 PUSH1 0xA0 DUP11 ADD PUSH1 0x80 DUP12 ADD PUSH2 0x149D JUMP JUMPDEST DUP10 PUSH1 0xA0 ADD CALLDATALOAD DUP11 PUSH1 0xC0 ADD CALLDATALOAD PUSH2 0xA07 JUMP JUMPDEST PUSH2 0x566 PUSH32 0x0 PUSH1 0x40 DUP7 ADD CALLDATALOAD PUSH2 0x556 PUSH1 0x20 DUP9 ADD DUP9 PUSH2 0x143A JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND SWAP2 SWAP1 PUSH2 0xB75 JUMP JUMPDEST PUSH0 PUSH2 0x5B2 PUSH2 0x577 PUSH1 0xE0 DUP8 ADD DUP8 PUSH2 0x1453 JUMP JUMPDEST DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY PUSH0 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP CALLVALUE SWAP3 POP PUSH2 0xBF4 SWAP2 POP POP JUMP JUMPDEST SWAP1 POP DUP1 PUSH2 0x5EF JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xB PUSH1 0x24 DUP3 ADD MSTORE PUSH11 0x10D85B1B0819985A5B1959 PUSH1 0xAA SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH2 0x621 PUSH32 0x0 PUSH0 PUSH2 0x556 PUSH1 0x20 DUP10 ADD DUP10 PUSH2 0x143A JUMP JUMPDEST PUSH2 0x62E PUSH1 0x20 DUP7 ADD DUP7 PUSH2 0x143A JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP5 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH32 0x78129A649632642D8E9F346C85D9EFB70D32D50A36774C4585491A9228BBD350 DUP8 PUSH1 0x40 ADD CALLDATALOAD PUSH1 0x40 MLOAD PUSH2 0x676 SWAP2 DUP2 MSTORE PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP POP POP PUSH2 0x6AB PUSH1 0x1 PUSH32 0x9B779B17422D0DF92223018B32B4D1FA46E071723D6817E2486D003BECC55F00 SSTORE JUMP JUMPDEST POP JUMP JUMPDEST PUSH2 0x6B6 PUSH2 0xC79 JUMP JUMPDEST PUSH2 0x6BF PUSH0 PUSH2 0xCA5 JUMP JUMPDEST JUMP JUMPDEST PUSH0 PUSH1 0x60 DUP1 PUSH0 PUSH0 PUSH0 PUSH1 0x60 PUSH2 0x6D2 PUSH2 0xCF4 JUMP JUMPDEST PUSH2 0x6DA PUSH2 0xD26 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH0 DUP1 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 SWAP3 MSTORE PUSH1 0xF PUSH1 0xF8 SHL SWAP12 SWAP4 SWAP11 POP SWAP2 SWAP9 POP CHAINID SWAP8 POP ADDRESS SWAP7 POP SWAP5 POP SWAP3 POP SWAP1 POP JUMP JUMPDEST PUSH2 0x70B PUSH2 0xC79 JUMP JUMPDEST PUSH2 0x730 PUSH2 0x71F PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND SWAP1 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP5 AND SWAP1 DUP4 PUSH2 0xD53 JUMP JUMPDEST PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP3 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH32 0xA0524EE0FD8662D6C046D199DA2A6D3DC49445182CEC055873A5BB9C2843C8E0 DUP4 PUSH1 0x40 MLOAD PUSH2 0x77F SWAP2 DUP2 MSTORE PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP3 AND PUSH0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP5 DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x7C0 PUSH2 0xC79 JUMP JUMPDEST PUSH0 DUP1 SLOAD PUSH1 0x40 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP2 AND SWAP1 DUP4 SWAP1 DUP4 DUP2 DUP2 DUP2 DUP6 DUP8 GAS CALL SWAP3 POP POP POP RETURNDATASIZE DUP1 PUSH0 DUP2 EQ PUSH2 0x80A JUMPI PUSH1 0x40 MLOAD SWAP2 POP PUSH1 0x1F NOT PUSH1 0x3F RETURNDATASIZE ADD AND DUP3 ADD PUSH1 0x40 MSTORE RETURNDATASIZE DUP3 MSTORE RETURNDATASIZE PUSH0 PUSH1 0x20 DUP5 ADD RETURNDATACOPY PUSH2 0x80F JUMP JUMPDEST PUSH1 0x60 SWAP2 POP JUMPDEST POP POP SWAP1 POP DUP1 PUSH2 0x856 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH19 0x115512081D1C985B9CD9995C8819985A5B1959 PUSH1 0x6A SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH32 0x6148672A948A12B8E0BF92A9338349B9AC890FAD62A234ABAF0A4DA99F62CFCC DUP4 PUSH1 0x40 MLOAD PUSH2 0x89B SWAP2 DUP2 MSTORE PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 POP POP JUMP JUMPDEST PUSH2 0x8AF PUSH2 0xC79 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND PUSH2 0x8D8 JUMPI PUSH1 0x40 MLOAD PUSH4 0x1E4FBDF7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH0 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST PUSH2 0x6AB DUP2 PUSH2 0xCA5 JUMP JUMPDEST PUSH2 0x8E9 PUSH2 0xD60 JUMP JUMPDEST PUSH1 0x2 PUSH32 0x9B779B17422D0DF92223018B32B4D1FA46E071723D6817E2486D003BECC55F00 SSTORE JUMP JUMPDEST DUP4 MLOAD PUSH1 0x20 DUP1 DUP7 ADD SWAP2 SWAP1 SWAP2 KECCAK256 PUSH1 0x40 DUP1 MLOAD PUSH32 0xF0543E2024FD0AE16CCB842686C2733758EC65ACFD69FB599C05B286F8DB8844 SWAP4 DUP2 ADD SWAP4 SWAP1 SWAP4 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB PUSH32 0x0 DUP2 AND SWAP2 DUP5 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP1 DUP11 AND PUSH1 0x60 DUP5 ADD MSTORE DUP9 AND PUSH1 0x80 DUP4 ADD MSTORE PUSH1 0xA0 DUP3 ADD DUP8 SWAP1 MSTORE PUSH1 0xC0 DUP3 ADD MSTORE PUSH1 0xE0 DUP2 ADD DUP5 SWAP1 MSTORE PUSH2 0x100 DUP2 ADD DUP4 SWAP1 MSTORE PUSH2 0x120 DUP2 ADD DUP3 SWAP1 MSTORE PUSH0 SWAP1 PUSH2 0x9CF SWAP1 PUSH2 0x140 ADD PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 DUP4 SUB SUB DUP2 MSTORE SWAP1 PUSH1 0x40 MSTORE DUP1 MLOAD SWAP1 PUSH1 0x20 ADD KECCAK256 PUSH2 0xDA2 JUMP JUMPDEST SWAP9 SWAP8 POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH0 PUSH0 PUSH0 PUSH0 PUSH2 0x9EB DUP9 DUP9 DUP9 DUP9 PUSH2 0xDCE JUMP JUMPDEST SWAP3 POP SWAP3 POP SWAP3 POP PUSH2 0x9FB DUP3 DUP3 PUSH2 0xE96 JUMP JUMPDEST POP SWAP1 SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH4 0xD505ACCF PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP8 DUP2 AND PUSH1 0x4 DUP4 ADD MSTORE ADDRESS PUSH1 0x24 DUP4 ADD MSTORE PUSH1 0x44 DUP3 ADD DUP8 SWAP1 MSTORE PUSH1 0x64 DUP3 ADD DUP7 SWAP1 MSTORE PUSH1 0xFF DUP6 AND PUSH1 0x84 DUP4 ADD MSTORE PUSH1 0xA4 DUP3 ADD DUP5 SWAP1 MSTORE PUSH1 0xC4 DUP3 ADD DUP4 SWAP1 MSTORE DUP9 AND SWAP1 PUSH4 0xD505ACCF SWAP1 PUSH1 0xE4 ADD PUSH0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0xA72 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP GAS CALL SWAP3 POP POP POP DUP1 ISZERO PUSH2 0xA83 JUMPI POP PUSH1 0x1 JUMPDEST PUSH2 0xB57 JUMPI PUSH1 0x40 MLOAD PUSH4 0x6EB1769F PUSH1 0xE1 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP8 DUP2 AND PUSH1 0x4 DUP4 ADD MSTORE ADDRESS PUSH1 0x24 DUP4 ADD MSTORE DUP7 SWAP2 SWAP1 DUP10 AND SWAP1 PUSH4 0xDD62ED3E SWAP1 PUSH1 0x44 ADD PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP7 GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0xAD4 JUMPI RETURNDATASIZE PUSH0 PUSH0 RETURNDATACOPY RETURNDATASIZE PUSH0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0xAF8 SWAP2 SWAP1 PUSH2 0x14BD JUMP JUMPDEST LT ISZERO PUSH2 0xB57 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x28 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5065726D6974206661696C656420616E6420696E73756666696369656E742061 PUSH1 0x44 DUP3 ADD MSTORE PUSH8 0x6C6C6F77616E6365 PUSH1 0xC0 SHL PUSH1 0x64 DUP3 ADD MSTORE PUSH1 0x84 ADD PUSH2 0x281 JUMP JUMPDEST PUSH2 0xB6C PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP9 AND DUP8 ADDRESS DUP9 PUSH2 0xF52 JUMP JUMPDEST POP POP POP POP POP POP POP JUMP JUMPDEST PUSH2 0xB81 DUP4 DUP4 DUP4 PUSH0 PUSH2 0xF8E JUMP JUMPDEST PUSH2 0xBEF JUMPI PUSH2 0xB92 DUP4 DUP4 PUSH0 PUSH1 0x1 PUSH2 0xF8E JUMP JUMPDEST PUSH2 0xBBA JUMPI PUSH1 0x40 MLOAD PUSH4 0x5274AFE7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP5 AND PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST PUSH2 0xBC7 DUP4 DUP4 DUP4 PUSH1 0x1 PUSH2 0xF8E JUMP JUMPDEST PUSH2 0xBEF JUMPI PUSH1 0x40 MLOAD PUSH4 0x5274AFE7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP5 AND PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST POP POP POP JUMP JUMPDEST PUSH0 PUSH0 PUSH32 0x0 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP4 DUP6 PUSH1 0x40 MLOAD PUSH2 0xC2F SWAP2 SWAP1 PUSH2 0x14D4 JUMP JUMPDEST PUSH0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 DUP8 GAS CALL SWAP3 POP POP POP RETURNDATASIZE DUP1 PUSH0 DUP2 EQ PUSH2 0xC69 JUMPI PUSH1 0x40 MLOAD SWAP2 POP PUSH1 0x1F NOT PUSH1 0x3F RETURNDATASIZE ADD AND DUP3 ADD PUSH1 0x40 MSTORE RETURNDATASIZE DUP3 MSTORE RETURNDATASIZE PUSH0 PUSH1 0x20 DUP5 ADD RETURNDATACOPY PUSH2 0xC6E JUMP JUMPDEST PUSH1 0x60 SWAP2 POP JUMPDEST POP SWAP1 SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND CALLER EQ PUSH2 0x6BF JUMPI PUSH1 0x40 MLOAD PUSH4 0x118CDAA7 PUSH1 0xE0 SHL DUP2 MSTORE CALLER PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST PUSH0 DUP1 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP4 DUP2 AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB NOT DUP4 AND DUP2 OR DUP5 SSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP3 AND SWAP3 DUP4 SWAP2 PUSH32 0x8BE0079C531659141344CD1FD0A4F28419497F9722A3DAAFE3B4186F6B6457E0 SWAP2 SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x60 PUSH2 0xD21 PUSH32 0x0 PUSH1 0x1 PUSH2 0xFF0 JUMP JUMPDEST SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x60 PUSH2 0xD21 PUSH32 0x0 PUSH1 0x2 PUSH2 0xFF0 JUMP JUMPDEST PUSH2 0xBC7 DUP4 DUP4 DUP4 PUSH1 0x1 PUSH2 0x1099 JUMP JUMPDEST PUSH32 0x9B779B17422D0DF92223018B32B4D1FA46E071723D6817E2486D003BECC55F00 SLOAD PUSH1 0x2 SUB PUSH2 0x6BF JUMPI PUSH1 0x40 MLOAD PUSH4 0x3EE5AEB5 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH0 PUSH2 0x7B2 PUSH2 0xDAE PUSH2 0x10E3 JUMP JUMPDEST DUP4 PUSH1 0x40 MLOAD PUSH2 0x1901 PUSH1 0xF0 SHL DUP2 MSTORE PUSH1 0x2 DUP2 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x22 DUP3 ADD MSTORE PUSH1 0x42 SWAP1 KECCAK256 SWAP1 JUMP JUMPDEST PUSH0 DUP1 DUP1 PUSH32 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0 DUP5 GT ISZERO PUSH2 0xE07 JUMPI POP PUSH0 SWAP2 POP PUSH1 0x3 SWAP1 POP DUP3 PUSH2 0xE8C JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH0 DUP1 DUP3 MSTORE PUSH1 0x20 DUP3 ADD DUP1 DUP5 MSTORE DUP11 SWAP1 MSTORE PUSH1 0xFF DUP10 AND SWAP3 DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x60 DUP2 ADD DUP8 SWAP1 MSTORE PUSH1 0x80 DUP2 ADD DUP7 SWAP1 MSTORE PUSH1 0x1 SWAP1 PUSH1 0xA0 ADD PUSH1 0x20 PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 SUB SWAP1 DUP1 DUP5 SUB SWAP1 DUP6 GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0xE58 JUMPI RETURNDATASIZE PUSH0 PUSH0 RETURNDATACOPY RETURNDATASIZE PUSH0 REVERT JUMPDEST POP POP PUSH1 0x40 MLOAD PUSH1 0x1F NOT ADD MLOAD SWAP2 POP POP PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND PUSH2 0xE83 JUMPI POP PUSH0 SWAP3 POP PUSH1 0x1 SWAP2 POP DUP3 SWAP1 POP PUSH2 0xE8C JUMP JUMPDEST SWAP3 POP PUSH0 SWAP2 POP DUP2 SWAP1 POP JUMPDEST SWAP5 POP SWAP5 POP SWAP5 SWAP2 POP POP JUMP JUMPDEST PUSH0 DUP3 PUSH1 0x3 DUP2 GT ISZERO PUSH2 0xEA9 JUMPI PUSH2 0xEA9 PUSH2 0x14EA JUMP JUMPDEST SUB PUSH2 0xEB2 JUMPI POP POP JUMP JUMPDEST PUSH1 0x1 DUP3 PUSH1 0x3 DUP2 GT ISZERO PUSH2 0xEC6 JUMPI PUSH2 0xEC6 PUSH2 0x14EA JUMP JUMPDEST SUB PUSH2 0xEE4 JUMPI PUSH1 0x40 MLOAD PUSH4 0xF645EEDF PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x2 DUP3 PUSH1 0x3 DUP2 GT ISZERO PUSH2 0xEF8 JUMPI PUSH2 0xEF8 PUSH2 0x14EA JUMP JUMPDEST SUB PUSH2 0xF19 JUMPI PUSH1 0x40 MLOAD PUSH4 0xFCE698F7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 DUP2 ADD DUP3 SWAP1 MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST PUSH1 0x3 DUP3 PUSH1 0x3 DUP2 GT ISZERO PUSH2 0xF2D JUMPI PUSH2 0xF2D PUSH2 0x14EA JUMP JUMPDEST SUB PUSH2 0xF4E JUMPI PUSH1 0x40 MLOAD PUSH4 0x35E2F383 PUSH1 0xE2 SHL DUP2 MSTORE PUSH1 0x4 DUP2 ADD DUP3 SWAP1 MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST POP POP JUMP JUMPDEST PUSH2 0xF60 DUP5 DUP5 DUP5 DUP5 PUSH1 0x1 PUSH2 0x120C JUMP JUMPDEST PUSH2 0xF88 JUMPI PUSH1 0x40 MLOAD PUSH4 0x5274AFE7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP6 AND PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH4 0x95EA7B3 PUSH1 0xE0 SHL PUSH0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP7 AND PUSH1 0x4 MSTORE PUSH1 0x24 DUP6 SWAP1 MSTORE SWAP2 PUSH1 0x20 DUP4 PUSH1 0x44 DUP2 DUP1 DUP12 GAS CALL SWAP3 POP PUSH1 0x1 PUSH0 MLOAD EQ DUP4 AND PUSH2 0xFE4 JUMPI DUP4 DUP4 ISZERO AND ISZERO PUSH2 0xFD8 JUMPI RETURNDATASIZE PUSH0 DUP3 RETURNDATACOPY RETURNDATASIZE DUP2 REVERT JUMPDEST PUSH0 DUP8 EXTCODESIZE GT RETURNDATASIZE ISZERO AND DUP4 AND SWAP3 POP JUMPDEST PUSH1 0x40 MSTORE POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x60 PUSH1 0xFF DUP4 EQ PUSH2 0x100A JUMPI PUSH2 0x1003 DUP4 PUSH2 0x1279 JUMP JUMPDEST SWAP1 POP PUSH2 0x7B2 JUMP JUMPDEST DUP2 DUP1 SLOAD PUSH2 0x1016 SWAP1 PUSH2 0x14FE JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0x1042 SWAP1 PUSH2 0x14FE JUMP JUMPDEST DUP1 ISZERO PUSH2 0x108D JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x1064 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x108D JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH0 MSTORE PUSH1 0x20 PUSH0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x1070 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP PUSH2 0x7B2 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH4 0xA9059CBB PUSH1 0xE0 SHL PUSH0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP7 AND PUSH1 0x4 MSTORE PUSH1 0x24 DUP6 SWAP1 MSTORE SWAP2 PUSH1 0x20 DUP4 PUSH1 0x44 DUP2 DUP1 DUP12 GAS CALL SWAP3 POP PUSH1 0x1 PUSH0 MLOAD EQ DUP4 AND PUSH2 0xFE4 JUMPI DUP4 DUP4 ISZERO AND ISZERO PUSH2 0xFD8 JUMPI RETURNDATASIZE PUSH0 DUP3 RETURNDATACOPY RETURNDATASIZE DUP2 REVERT JUMPDEST PUSH0 ADDRESS PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB PUSH32 0x0 AND EQ DUP1 ISZERO PUSH2 0x113B JUMPI POP PUSH32 0x0 CHAINID EQ JUMPDEST ISZERO PUSH2 0x1165 JUMPI POP PUSH32 0x0 SWAP1 JUMP JUMPDEST PUSH2 0xD21 PUSH1 0x40 DUP1 MLOAD PUSH32 0x8B73C3C69BB8FE3D512ECC4CF759CC79239F7B179B0FFACAA9A75D522B39400F PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x0 SWAP2 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH32 0x0 PUSH1 0x60 DUP3 ADD MSTORE CHAINID PUSH1 0x80 DUP3 ADD MSTORE ADDRESS PUSH1 0xA0 DUP3 ADD MSTORE PUSH0 SWAP1 PUSH1 0xC0 ADD PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 DUP4 SUB SUB DUP2 MSTORE SWAP1 PUSH1 0x40 MSTORE DUP1 MLOAD SWAP1 PUSH1 0x20 ADD KECCAK256 SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH4 0x23B872DD PUSH1 0xE0 SHL PUSH0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP8 DUP2 AND PUSH1 0x4 MSTORE DUP7 AND PUSH1 0x24 MSTORE PUSH1 0x44 DUP6 SWAP1 MSTORE SWAP2 PUSH1 0x20 DUP4 PUSH1 0x64 DUP2 DUP1 DUP13 GAS CALL SWAP3 POP PUSH1 0x1 PUSH0 MLOAD EQ DUP4 AND PUSH2 0x1268 JUMPI DUP4 DUP4 ISZERO AND ISZERO PUSH2 0x125C JUMPI RETURNDATASIZE PUSH0 DUP3 RETURNDATACOPY RETURNDATASIZE DUP2 REVERT JUMPDEST PUSH0 DUP9 EXTCODESIZE GT RETURNDATASIZE ISZERO AND DUP4 AND SWAP3 POP JUMPDEST PUSH1 0x40 MSTORE POP PUSH0 PUSH1 0x60 MSTORE SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x60 PUSH0 PUSH2 0x1285 DUP4 PUSH2 0x12B6 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 DUP4 ADD SWAP1 SWAP3 MSTORE SWAP2 SWAP3 POP PUSH0 SWAP2 SWAP1 PUSH1 0x20 DUP3 ADD DUP2 DUP1 CALLDATASIZE DUP4 CALLDATACOPY POP POP POP SWAP2 DUP3 MSTORE POP PUSH1 0x20 DUP2 ADD SWAP3 SWAP1 SWAP3 MSTORE POP SWAP1 JUMP JUMPDEST PUSH0 PUSH1 0xFF DUP3 AND PUSH1 0x1F DUP2 GT ISZERO PUSH2 0x7B2 JUMPI PUSH1 0x40 MLOAD PUSH4 0x2CD44AC3 PUSH1 0xE2 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x12ED JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1303 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP3 ADD PUSH2 0x1C0 DUP2 DUP6 SUB SLT ISZERO PUSH2 0x1315 JUMPI PUSH0 PUSH0 REVERT JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH0 DUP2 MLOAD DUP1 DUP5 MSTORE DUP1 PUSH1 0x20 DUP5 ADD PUSH1 0x20 DUP7 ADD MCOPY PUSH0 PUSH1 0x20 DUP3 DUP7 ADD ADD MSTORE PUSH1 0x20 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND DUP6 ADD ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0xFF PUSH1 0xF8 SHL DUP9 AND DUP2 MSTORE PUSH1 0xE0 PUSH1 0x20 DUP3 ADD MSTORE PUSH0 PUSH2 0x1368 PUSH1 0xE0 DUP4 ADD DUP10 PUSH2 0x131C JUMP JUMPDEST DUP3 DUP2 SUB PUSH1 0x40 DUP5 ADD MSTORE PUSH2 0x137A DUP2 DUP10 PUSH2 0x131C JUMP JUMPDEST PUSH1 0x60 DUP5 ADD DUP9 SWAP1 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP8 AND PUSH1 0x80 DUP6 ADD MSTORE PUSH1 0xA0 DUP5 ADD DUP7 SWAP1 MSTORE DUP4 DUP2 SUB PUSH1 0xC0 DUP6 ADD MSTORE DUP5 MLOAD DUP1 DUP3 MSTORE PUSH1 0x20 DUP1 DUP8 ADD SWAP4 POP SWAP1 SWAP2 ADD SWAP1 PUSH0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x13CF JUMPI DUP4 MLOAD DUP4 MSTORE PUSH1 0x20 SWAP4 DUP5 ADD SWAP4 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x1 ADD PUSH2 0x13B1 JUMP JUMPDEST POP SWAP1 SWAP12 SWAP11 POP POP POP POP POP POP POP POP POP POP POP JUMP JUMPDEST DUP1 CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND DUP2 EQ PUSH2 0x13F6 JUMPI PUSH0 PUSH0 REVERT JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH0 PUSH0 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x140C JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x1415 DUP4 PUSH2 0x13E0 JUMP JUMPDEST SWAP5 PUSH1 0x20 SWAP4 SWAP1 SWAP4 ADD CALLDATALOAD SWAP4 POP POP POP JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x1433 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP CALLDATALOAD SWAP2 SWAP1 POP JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x144A JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x1315 DUP3 PUSH2 0x13E0 JUMP JUMPDEST PUSH0 PUSH0 DUP4 CALLDATALOAD PUSH1 0x1E NOT DUP5 CALLDATASIZE SUB ADD DUP2 SLT PUSH2 0x1468 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP4 ADD DUP1 CALLDATALOAD SWAP2 POP PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x1482 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH1 0x20 ADD SWAP2 POP CALLDATASIZE DUP2 SWAP1 SUB DUP3 SGT ISZERO PUSH2 0x1496 JUMPI PUSH0 PUSH0 REVERT JUMPDEST SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x14AD JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH1 0xFF DUP2 AND DUP2 EQ PUSH2 0x1315 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x14CD JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP MLOAD SWAP2 SWAP1 POP JUMP JUMPDEST PUSH0 DUP3 MLOAD DUP1 PUSH1 0x20 DUP6 ADD DUP5 MCOPY PUSH0 SWAP3 ADD SWAP2 DUP3 MSTORE POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x21 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST PUSH1 0x1 DUP2 DUP2 SHR SWAP1 DUP3 AND DUP1 PUSH2 0x1512 JUMPI PUSH1 0x7F DUP3 AND SWAP2 POP JUMPDEST PUSH1 0x20 DUP3 LT DUP2 SUB PUSH2 0x1530 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x22 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST POP SWAP2 SWAP1 POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 SWAP13 CALLVALUE 0xDB 0x2F PUSH16 0x83AF136A5340CCE7FE8EF554EA8EB633 PUSH6 0x6FBF9BFF3BD7 BALANCE 0xAE 0xC4 0xF PUSH5 0x736F6C6343 STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "1158:6897:22:-:0;;;2504:245;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;3428:431:16;;;;;;;;;;;-1:-1:-1;;;3428:431:16;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;3428:431:16;;;;;2562:10:22;;1269:95:0;;1322:31;;-1:-1:-1;;;1322:31:0;;1350:1;1322:31;;;455:51:23;428:18;;1322:31:0;;;;;;;;1269:95;1373:32;1392:12;1373:18;:32::i;:::-;-1:-1:-1;2365:1:11;1505:66;2539;3501:45:16;:4;3532:13;3501:30;:45::i;:::-;3493:53;;3567:51;:7;3601:16;3567:33;:51::i;:::-;3556:62;;3642:22;;;;;;;;;;3628:36;;3691:25;;;;;;3674:42;;3744:13;3727:30;;3792:23;4326:11;;4339:14;;4304:80;;;2079:95;4304:80;;;3765:25:23;3806:18;;;3799:34;;;;3849:18;;;3842:34;4355:13:16;3892:18:23;;;3885:34;4378:4:16;3935:19:23;;;3928:61;4268:7:16;;3737:19:23;;4304:80:16;;;;;;;;;;;;4294:91;;;;;;4287:98;;4213:179;;3792:23;3767:48;;-1:-1:-1;;3847:4:16;3825:27;;-1:-1:-1;;;;;2632:34:22;::::2;2624:66;;;::::0;-1:-1:-1;;;2624:66:22;;719:2:23;2624:66:22::2;::::0;::::2;701:21:23::0;758:2;738:18;;;731:30;797:21;777:18;;;770:49;836:18;;2624:66:22::2;517:343:23::0;2624:66:22::2;-1:-1:-1::0;;;;;2700:42:22::2;;::::0;1158:6897;;2912:187:0;2985:16;3004:6;;-1:-1:-1;;;;;3020:17:0;;;-1:-1:-1;;;;;;3020:17:0;;;;;;3052:40;;3004:6;;;;;;;3052:40;;2985:16;3052:40;2975:124;2912:187;:::o;2893:342:12:-;2989:11;3038:4;3022:5;3016:19;:26;3012:217;;;3065:20;3079:5;3065:13;:20::i;:::-;3058:27;;;;3012:217;3142:5;3116:46;3157:5;3142;3116:46;:::i;:::-;-1:-1:-1;1390:66:12;;-1:-1:-1;3012:217:12;2893:342;;;;:::o;1708:288::-;1773:11;1796:17;1822:3;1796:30;;1854:4;1840;:11;:18;1836:74;;;1895:3;1881:18;;-1:-1:-1;;;1881:18:12;;;;;;;;:::i;1836:74::-;1976:11;;1959:13;1976:4;1959:13;:::i;:::-;1951:36;;1708:288;-1:-1:-1;;;1708:288:12:o;14:290:23:-;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:23;;214:42;;204:70;;270:1;267;260:12;204:70;293:5;14:290;-1:-1:-1;;;14:290:23:o;865:127::-;926:10;921:3;917:20;914:1;907:31;957:4;954:1;947:15;981:4;978:1;971:15;997:380;1076:1;1072:12;;;;1119;;;1140:61;;1194:4;1186:6;1182:17;1172:27;;1140:61;1247:2;1239:6;1236:14;1216:18;1213:38;1210:161;;1293:10;1288:3;1284:20;1281:1;1274:31;1328:4;1325:1;1318:15;1356:4;1353:1;1346:15;1210:161;;997:380;;;:::o;1508:518::-;1610:2;1605:3;1602:11;1599:421;;;1646:5;1643:1;1636:16;1690:4;1687:1;1677:18;1760:2;1748:10;1744:19;1741:1;1737:27;1731:4;1727:38;1796:4;1784:10;1781:20;1778:47;;;-1:-1:-1;1819:4:23;1778:47;1874:2;1869:3;1865:12;1862:1;1858:20;1852:4;1848:31;1838:41;;1929:81;1947:2;1940:5;1937:13;1929:81;;;2006:1;1992:16;;1973:1;1962:13;1929:81;;;1933:3;;1599:421;1508:518;;;:::o;2202:1299::-;2322:10;;-1:-1:-1;;;;;2344:30:23;;2341:56;;;2377:18;;:::i;:::-;2406:97;2496:6;2456:38;2488:4;2482:11;2456:38;:::i;:::-;2450:4;2406:97;:::i;:::-;2552:4;2583:2;2572:14;;2600:1;2595:649;;;;3288:1;3305:6;3302:89;;;-1:-1:-1;3357:19:23;;;3351:26;3302:89;-1:-1:-1;;2159:1:23;2155:11;;;2151:24;2147:29;2137:40;2183:1;2179:11;;;2134:57;3404:81;;2565:930;;2595:649;1455:1;1448:14;;;1492:4;1479:18;;-1:-1:-1;;2631:20:23;;;2749:222;2763:7;2760:1;2757:14;2749:222;;;2845:19;;;2839:26;2824:42;;2952:4;2937:20;;;;2905:1;2893:14;;;;2779:12;2749:222;;;2753:3;2999:6;2990:7;2987:19;2984:201;;;3060:19;;;3054:26;-1:-1:-1;;3143:1:23;3139:14;;;3155:3;3135:24;3131:37;3127:42;3112:58;3097:74;;2984:201;-1:-1:-1;;;;3231:1:23;3215:14;;;3211:22;3198:36;;-1:-1:-1;2202:1299:23:o;4000:418::-;4149:2;4138:9;4131:21;4112:4;4181:6;4175:13;4224:6;4219:2;4208:9;4204:18;4197:34;4283:6;4278:2;4270:6;4266:15;4261:2;4250:9;4246:18;4240:50;4339:1;4334:2;4325:6;4314:9;4310:22;4306:31;4299:42;4409:2;4402;4398:7;4393:2;4385:6;4381:15;4377:29;4366:9;4362:45;4358:54;4350:62;;;4000:418;;;;:::o;4423:297::-;4541:12;;4588:4;4577:16;;;4571:23;;4541:12;4606:16;;4603:111;;;-1:-1:-1;;4680:4:23;4676:17;;;;4673:1;4669:25;4665:38;4654:50;;4423:297;-1:-1:-1;4423:297:23:o;:::-;1158:6897:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": { + "@_8236": { + "entryPoint": null, + "id": 8236, + "parameterSlots": 0, + "returnSlots": 0 + }, + "@_EIP712Name_4351": { + "entryPoint": 3316, + "id": 4351, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@_EIP712Version_4363": { + "entryPoint": 3366, + "id": 4363, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@_buildDomainSeparator_4281": { + "entryPoint": null, + "id": 4281, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@_checkOwner_84": { + "entryPoint": 3193, + "id": 84, + "parameterSlots": 0, + "returnSlots": 0 + }, + "@_computeDigest_8441": { + "entryPoint": 2319, + "id": 8441, + "parameterSlots": 7, + "returnSlots": 1 + }, + "@_domainSeparatorV4_4260": { + "entryPoint": 4323, + "id": 4260, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@_executePermitAndTransfer_8508": { + "entryPoint": 2567, + "id": 8508, + "parameterSlots": 7, + "returnSlots": 0 + }, + "@_forwardCall_8529": { + "entryPoint": 3060, + "id": 8529, + "parameterSlots": 2, + "returnSlots": 1 + }, + "@_hashTypedDataV4_4297": { + "entryPoint": 3490, + "id": 4297, + "parameterSlots": 1, + "returnSlots": 1 + }, + "@_msgSender_1644": { + "entryPoint": null, + "id": 1644, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@_nonReentrantAfter_1803": { + "entryPoint": null, + "id": 1803, + "parameterSlots": 0, + "returnSlots": 0 + }, + "@_nonReentrantBeforeView_1776": { + "entryPoint": 3424, + "id": 1776, + "parameterSlots": 0, + "returnSlots": 0 + }, + "@_nonReentrantBefore_1791": { + "entryPoint": 2273, + "id": 1791, + "parameterSlots": 0, + "returnSlots": 0 + }, + "@_reentrancyGuardEntered_1818": { + "entryPoint": null, + "id": 1818, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@_reentrancyGuardStorageSlot_1826": { + "entryPoint": null, + "id": 1826, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@_safeApprove_830": { + "entryPoint": 3982, + "id": 830, + "parameterSlots": 4, + "returnSlots": 1 + }, + "@_safeTransferFrom_807": { + "entryPoint": 4620, + "id": 807, + "parameterSlots": 5, + "returnSlots": 1 + }, + "@_safeTransfer_782": { + "entryPoint": 4249, + "id": 782, + "parameterSlots": 4, + "returnSlots": 1 + }, + "@_throwError_4136": { + "entryPoint": 3734, + "id": 4136, + "parameterSlots": 2, + "returnSlots": 0 + }, + "@_transferOwnership_146": { + "entryPoint": 3237, + "id": 146, + "parameterSlots": 1, + "returnSlots": 0 + }, + "@byteLength_1945": { + "entryPoint": 4790, + "id": 1945, + "parameterSlots": 1, + "returnSlots": 1 + }, + "@destinationContract_8147": { + "entryPoint": null, + "id": 8147, + "parameterSlots": 0, + "returnSlots": 0 + }, + "@eip712Domain_4339": { + "entryPoint": 1729, + "id": 4339, + "parameterSlots": 0, + "returnSlots": 7 + }, + "@execute_8402": { + "entryPoint": 542, + "id": 8402, + "parameterSlots": 1, + "returnSlots": 0 + }, + "@forceApprove_626": { + "entryPoint": 2933, + "id": 626, + "parameterSlots": 3, + "returnSlots": 0 + }, + "@getUint256Slot_2112": { + "entryPoint": null, + "id": 2112, + "parameterSlots": 1, + "returnSlots": 1 + }, + "@isExecutionCompleted_8602": { + "entryPoint": 1931, + "id": 8602, + "parameterSlots": 2, + "returnSlots": 1 + }, + "@owner_67": { + "entryPoint": null, + "id": 67, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@recover_4059": { + "entryPoint": 2523, + "id": 4059, + "parameterSlots": 4, + "returnSlots": 1 + }, + "@renounceOwnership_98": { + "entryPoint": 1710, + "id": 98, + "parameterSlots": 0, + "returnSlots": 0 + }, + "@safeTransferFrom_456": { + "entryPoint": 3922, + "id": 456, + "parameterSlots": 4, + "returnSlots": 0 + }, + "@safeTransfer_425": { + "entryPoint": 3411, + "id": 425, + "parameterSlots": 3, + "returnSlots": 0 + }, + "@toStringWithFallback_2012": { + "entryPoint": 4080, + "id": 2012, + "parameterSlots": 2, + "returnSlots": 1 + }, + "@toString_1913": { + "entryPoint": 4729, + "id": 1913, + "parameterSlots": 1, + "returnSlots": 1 + }, + "@toTypedDataHash_4451": { + "entryPoint": null, + "id": 4451, + "parameterSlots": 2, + "returnSlots": 1 + }, + "@transferOwnership_126": { + "entryPoint": 2215, + "id": 126, + "parameterSlots": 1, + "returnSlots": 0 + }, + "@tryRecover_4023": { + "entryPoint": 3534, + "id": 4023, + "parameterSlots": 4, + "returnSlots": 3 + }, + "@usedPayloadNonces_8153": { + "entryPoint": null, + "id": 8153, + "parameterSlots": 0, + "returnSlots": 0 + }, + "@withdrawETH_8586": { + "entryPoint": 1976, + "id": 8586, + "parameterSlots": 1, + "returnSlots": 0 + }, + "@withdrawToken_8556": { + "entryPoint": 1795, + "id": 8556, + "parameterSlots": 2, + "returnSlots": 0 + }, + "abi_decode_address": { + "entryPoint": 5088, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_decode_tuple_t_address": { + "entryPoint": 5178, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_decode_tuple_t_addresst_uint256": { + "entryPoint": 5115, + "id": null, + "parameterSlots": 2, + "returnSlots": 2 + }, + "abi_decode_tuple_t_struct$_ExecuteParams_$8182_calldata_ptr": { + "entryPoint": 4829, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_decode_tuple_t_uint256": { + "entryPoint": 5155, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_decode_tuple_t_uint256_fromMemory": { + "entryPoint": 5309, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_decode_tuple_t_uint8": { + "entryPoint": 5277, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_string": { + "entryPoint": 4892, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_tuple_packed_t_bytes_memory_ptr__to_t_bytes_memory_ptr__nonPadded_inplace_fromStack_reversed": { + "entryPoint": 5332, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_tuple_packed_t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470__to_t_bytes_memory_ptr__nonPadded_inplace_fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_address__to_t_address__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_tuple_t_address_t_address__to_t_address_t_address__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 3, + "returnSlots": 1 + }, + "abi_encode_tuple_t_address_t_address_t_uint256_t_uint256_t_uint8_t_bytes32_t_bytes32__to_t_address_t_address_t_uint256_t_uint256_t_uint8_t_bytes32_t_bytes32__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 8, + "returnSlots": 1 + }, + "abi_encode_tuple_t_bool__to_t_bool__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_tuple_t_bytes1_t_string_memory_ptr_t_string_memory_ptr_t_uint256_t_address_t_bytes32_t_array$_t_uint256_$dyn_memory_ptr__to_t_bytes1_t_string_memory_ptr_t_string_memory_ptr_t_uint256_t_address_t_bytes32_t_array$_t_uint256_$dyn_memory_ptr__fromStack_reversed": { + "entryPoint": 4938, + "id": null, + "parameterSlots": 8, + "returnSlots": 1 + }, + "abi_encode_tuple_t_bytes32__to_t_bytes32__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_tuple_t_bytes32_t_address_t_address_t_address_t_uint256_t_bytes32_t_uint256_t_uint256_t_uint256__to_t_bytes32_t_address_t_address_t_address_t_uint256_t_bytes32_t_uint256_t_uint256_t_uint256__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 10, + "returnSlots": 1 + }, + "abi_encode_tuple_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__to_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 6, + "returnSlots": 1 + }, + "abi_encode_tuple_t_bytes32_t_uint8_t_bytes32_t_bytes32__to_t_bytes32_t_uint8_t_bytes32_t_bytes32__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 5, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_066ad49a0ed9e5d6a9f3c20fca13a038f0a5d629f0aaf09d634ae2a7c232ac2b__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_0acc7f0c8df1a6717d2b423ae4591ac135687015764ac37dd4cf0150a9322b15__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_110461b12e459dc76e692e7a47f9621cf45c7d48020c3c7b2066107cdf1f52ae__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_15d72127d094a30af360ead73641c61eda3d745ce4d04d12675a5e9a899f8b21__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_27859e47e6c2167c8e8d38addfca16b9afb9d8e9750b6a1e67c29196d4d99fae__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_31734eed34fab74fa1579246aaad104a344891a284044483c0c5a792a9f83a72__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_5e70ebd1d4072d337a7fabaa7bda70fa2633d6e3f89d5cb725a16b10d07e54c6__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_a793dc5bde52ab2d5349f1208a34905b1d68ab9298f549a2e514542cba0a8c76__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_c7c2be2f1b63a3793f6e2d447ce95ba2239687186a7fd6b5268a969dcdb42dcd__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "access_calldata_tail_t_bytes_calldata_ptr": { + "entryPoint": 5203, + "id": null, + "parameterSlots": 2, + "returnSlots": 2 + }, + "extract_byte_array_length": { + "entryPoint": 5374, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "panic_error_0x21": { + "entryPoint": 5354, + "id": null, + "parameterSlots": 0, + "returnSlots": 0 + }, + "panic_error_0x41": { + "entryPoint": null, + "id": null, + "parameterSlots": 0, + "returnSlots": 0 + } + }, + "generatedSources": [ + { + "ast": { + "nativeSrc": "0:11637:23", + "nodeType": "YulBlock", + "src": "0:11637:23", + "statements": [ + { + "nativeSrc": "6:3:23", + "nodeType": "YulBlock", + "src": "6:3:23", + "statements": [] + }, + { + "body": { + "nativeSrc": "117:290:23", + "nodeType": "YulBlock", + "src": "117:290:23", + "statements": [ + { + "body": { + "nativeSrc": "163:16:23", + "nodeType": "YulBlock", + "src": "163:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "172:1:23", + "nodeType": "YulLiteral", + "src": "172:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "175:1:23", + "nodeType": "YulLiteral", + "src": "175:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "165:6:23", + "nodeType": "YulIdentifier", + "src": "165:6:23" + }, + "nativeSrc": "165:12:23", + "nodeType": "YulFunctionCall", + "src": "165:12:23" + }, + "nativeSrc": "165:12:23", + "nodeType": "YulExpressionStatement", + "src": "165:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nativeSrc": "138:7:23", + "nodeType": "YulIdentifier", + "src": "138:7:23" + }, + { + "name": "headStart", + "nativeSrc": "147:9:23", + "nodeType": "YulIdentifier", + "src": "147:9:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "134:3:23", + "nodeType": "YulIdentifier", + "src": "134:3:23" + }, + "nativeSrc": "134:23:23", + "nodeType": "YulFunctionCall", + "src": "134:23:23" + }, + { + "kind": "number", + "nativeSrc": "159:2:23", + "nodeType": "YulLiteral", + "src": "159:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nativeSrc": "130:3:23", + "nodeType": "YulIdentifier", + "src": "130:3:23" + }, + "nativeSrc": "130:32:23", + "nodeType": "YulFunctionCall", + "src": "130:32:23" + }, + "nativeSrc": "127:52:23", + "nodeType": "YulIf", + "src": "127:52:23" + }, + { + "nativeSrc": "188:37:23", + "nodeType": "YulVariableDeclaration", + "src": "188:37:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "215:9:23", + "nodeType": "YulIdentifier", + "src": "215:9:23" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "202:12:23", + "nodeType": "YulIdentifier", + "src": "202:12:23" + }, + "nativeSrc": "202:23:23", + "nodeType": "YulFunctionCall", + "src": "202:23:23" + }, + "variables": [ + { + "name": "offset", + "nativeSrc": "192:6:23", + "nodeType": "YulTypedName", + "src": "192:6:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "268:16:23", + "nodeType": "YulBlock", + "src": "268:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "277:1:23", + "nodeType": "YulLiteral", + "src": "277:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "280:1:23", + "nodeType": "YulLiteral", + "src": "280:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "270:6:23", + "nodeType": "YulIdentifier", + "src": "270:6:23" + }, + "nativeSrc": "270:12:23", + "nodeType": "YulFunctionCall", + "src": "270:12:23" + }, + "nativeSrc": "270:12:23", + "nodeType": "YulExpressionStatement", + "src": "270:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "offset", + "nativeSrc": "240:6:23", + "nodeType": "YulIdentifier", + "src": "240:6:23" + }, + { + "kind": "number", + "nativeSrc": "248:18:23", + "nodeType": "YulLiteral", + "src": "248:18:23", + "type": "", + "value": "0xffffffffffffffff" + } + ], + "functionName": { + "name": "gt", + "nativeSrc": "237:2:23", + "nodeType": "YulIdentifier", + "src": "237:2:23" + }, + "nativeSrc": "237:30:23", + "nodeType": "YulFunctionCall", + "src": "237:30:23" + }, + "nativeSrc": "234:50:23", + "nodeType": "YulIf", + "src": "234:50:23" + }, + { + "nativeSrc": "293:32:23", + "nodeType": "YulVariableDeclaration", + "src": "293:32:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "307:9:23", + "nodeType": "YulIdentifier", + "src": "307:9:23" + }, + { + "name": "offset", + "nativeSrc": "318:6:23", + "nodeType": "YulIdentifier", + "src": "318:6:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "303:3:23", + "nodeType": "YulIdentifier", + "src": "303:3:23" + }, + "nativeSrc": "303:22:23", + "nodeType": "YulFunctionCall", + "src": "303:22:23" + }, + "variables": [ + { + "name": "_1", + "nativeSrc": "297:2:23", + "nodeType": "YulTypedName", + "src": "297:2:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "364:16:23", + "nodeType": "YulBlock", + "src": "364:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "373:1:23", + "nodeType": "YulLiteral", + "src": "373:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "376:1:23", + "nodeType": "YulLiteral", + "src": "376:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "366:6:23", + "nodeType": "YulIdentifier", + "src": "366:6:23" + }, + "nativeSrc": "366:12:23", + "nodeType": "YulFunctionCall", + "src": "366:12:23" + }, + "nativeSrc": "366:12:23", + "nodeType": "YulExpressionStatement", + "src": "366:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nativeSrc": "345:7:23", + "nodeType": "YulIdentifier", + "src": "345:7:23" + }, + { + "name": "_1", + "nativeSrc": "354:2:23", + "nodeType": "YulIdentifier", + "src": "354:2:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "341:3:23", + "nodeType": "YulIdentifier", + "src": "341:3:23" + }, + "nativeSrc": "341:16:23", + "nodeType": "YulFunctionCall", + "src": "341:16:23" + }, + { + "kind": "number", + "nativeSrc": "359:3:23", + "nodeType": "YulLiteral", + "src": "359:3:23", + "type": "", + "value": "448" + } + ], + "functionName": { + "name": "slt", + "nativeSrc": "337:3:23", + "nodeType": "YulIdentifier", + "src": "337:3:23" + }, + "nativeSrc": "337:26:23", + "nodeType": "YulFunctionCall", + "src": "337:26:23" + }, + "nativeSrc": "334:46:23", + "nodeType": "YulIf", + "src": "334:46:23" + }, + { + "nativeSrc": "389:12:23", + "nodeType": "YulAssignment", + "src": "389:12:23", + "value": { + "name": "_1", + "nativeSrc": "399:2:23", + "nodeType": "YulIdentifier", + "src": "399:2:23" + }, + "variableNames": [ + { + "name": "value0", + "nativeSrc": "389:6:23", + "nodeType": "YulIdentifier", + "src": "389:6:23" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_struct$_ExecuteParams_$8182_calldata_ptr", + "nativeSrc": "14:393:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "83:9:23", + "nodeType": "YulTypedName", + "src": "83:9:23", + "type": "" + }, + { + "name": "dataEnd", + "nativeSrc": "94:7:23", + "nodeType": "YulTypedName", + "src": "94:7:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nativeSrc": "106:6:23", + "nodeType": "YulTypedName", + "src": "106:6:23", + "type": "" + } + ], + "src": "14:393:23" + }, + { + "body": { + "nativeSrc": "513:102:23", + "nodeType": "YulBlock", + "src": "513:102:23", + "statements": [ + { + "nativeSrc": "523:26:23", + "nodeType": "YulAssignment", + "src": "523:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "535:9:23", + "nodeType": "YulIdentifier", + "src": "535:9:23" + }, + { + "kind": "number", + "nativeSrc": "546:2:23", + "nodeType": "YulLiteral", + "src": "546:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "531:3:23", + "nodeType": "YulIdentifier", + "src": "531:3:23" + }, + "nativeSrc": "531:18:23", + "nodeType": "YulFunctionCall", + "src": "531:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "523:4:23", + "nodeType": "YulIdentifier", + "src": "523:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "565:9:23", + "nodeType": "YulIdentifier", + "src": "565:9:23" + }, + { + "arguments": [ + { + "name": "value0", + "nativeSrc": "580:6:23", + "nodeType": "YulIdentifier", + "src": "580:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "596:3:23", + "nodeType": "YulLiteral", + "src": "596:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "601:1:23", + "nodeType": "YulLiteral", + "src": "601:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "592:3:23", + "nodeType": "YulIdentifier", + "src": "592:3:23" + }, + "nativeSrc": "592:11:23", + "nodeType": "YulFunctionCall", + "src": "592:11:23" + }, + { + "kind": "number", + "nativeSrc": "605:1:23", + "nodeType": "YulLiteral", + "src": "605:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "588:3:23", + "nodeType": "YulIdentifier", + "src": "588:3:23" + }, + "nativeSrc": "588:19:23", + "nodeType": "YulFunctionCall", + "src": "588:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "576:3:23", + "nodeType": "YulIdentifier", + "src": "576:3:23" + }, + "nativeSrc": "576:32:23", + "nodeType": "YulFunctionCall", + "src": "576:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "558:6:23", + "nodeType": "YulIdentifier", + "src": "558:6:23" + }, + "nativeSrc": "558:51:23", + "nodeType": "YulFunctionCall", + "src": "558:51:23" + }, + "nativeSrc": "558:51:23", + "nodeType": "YulExpressionStatement", + "src": "558:51:23" + } + ] + }, + "name": "abi_encode_tuple_t_address__to_t_address__fromStack_reversed", + "nativeSrc": "412:203:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "482:9:23", + "nodeType": "YulTypedName", + "src": "482:9:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "493:6:23", + "nodeType": "YulTypedName", + "src": "493:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "504:4:23", + "nodeType": "YulTypedName", + "src": "504:4:23", + "type": "" + } + ], + "src": "412:203:23" + }, + { + "body": { + "nativeSrc": "670:239:23", + "nodeType": "YulBlock", + "src": "670:239:23", + "statements": [ + { + "nativeSrc": "680:26:23", + "nodeType": "YulVariableDeclaration", + "src": "680:26:23", + "value": { + "arguments": [ + { + "name": "value", + "nativeSrc": "700:5:23", + "nodeType": "YulIdentifier", + "src": "700:5:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "694:5:23", + "nodeType": "YulIdentifier", + "src": "694:5:23" + }, + "nativeSrc": "694:12:23", + "nodeType": "YulFunctionCall", + "src": "694:12:23" + }, + "variables": [ + { + "name": "length", + "nativeSrc": "684:6:23", + "nodeType": "YulTypedName", + "src": "684:6:23", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "pos", + "nativeSrc": "722:3:23", + "nodeType": "YulIdentifier", + "src": "722:3:23" + }, + { + "name": "length", + "nativeSrc": "727:6:23", + "nodeType": "YulIdentifier", + "src": "727:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "715:6:23", + "nodeType": "YulIdentifier", + "src": "715:6:23" + }, + "nativeSrc": "715:19:23", + "nodeType": "YulFunctionCall", + "src": "715:19:23" + }, + "nativeSrc": "715:19:23", + "nodeType": "YulExpressionStatement", + "src": "715:19:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "pos", + "nativeSrc": "753:3:23", + "nodeType": "YulIdentifier", + "src": "753:3:23" + }, + { + "kind": "number", + "nativeSrc": "758:4:23", + "nodeType": "YulLiteral", + "src": "758:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "749:3:23", + "nodeType": "YulIdentifier", + "src": "749:3:23" + }, + "nativeSrc": "749:14:23", + "nodeType": "YulFunctionCall", + "src": "749:14:23" + }, + { + "arguments": [ + { + "name": "value", + "nativeSrc": "769:5:23", + "nodeType": "YulIdentifier", + "src": "769:5:23" + }, + { + "kind": "number", + "nativeSrc": "776:4:23", + "nodeType": "YulLiteral", + "src": "776:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "765:3:23", + "nodeType": "YulIdentifier", + "src": "765:3:23" + }, + "nativeSrc": "765:16:23", + "nodeType": "YulFunctionCall", + "src": "765:16:23" + }, + { + "name": "length", + "nativeSrc": "783:6:23", + "nodeType": "YulIdentifier", + "src": "783:6:23" + } + ], + "functionName": { + "name": "mcopy", + "nativeSrc": "743:5:23", + "nodeType": "YulIdentifier", + "src": "743:5:23" + }, + "nativeSrc": "743:47:23", + "nodeType": "YulFunctionCall", + "src": "743:47:23" + }, + "nativeSrc": "743:47:23", + "nodeType": "YulExpressionStatement", + "src": "743:47:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "pos", + "nativeSrc": "814:3:23", + "nodeType": "YulIdentifier", + "src": "814:3:23" + }, + { + "name": "length", + "nativeSrc": "819:6:23", + "nodeType": "YulIdentifier", + "src": "819:6:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "810:3:23", + "nodeType": "YulIdentifier", + "src": "810:3:23" + }, + "nativeSrc": "810:16:23", + "nodeType": "YulFunctionCall", + "src": "810:16:23" + }, + { + "kind": "number", + "nativeSrc": "828:4:23", + "nodeType": "YulLiteral", + "src": "828:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "806:3:23", + "nodeType": "YulIdentifier", + "src": "806:3:23" + }, + "nativeSrc": "806:27:23", + "nodeType": "YulFunctionCall", + "src": "806:27:23" + }, + { + "kind": "number", + "nativeSrc": "835:1:23", + "nodeType": "YulLiteral", + "src": "835:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "799:6:23", + "nodeType": "YulIdentifier", + "src": "799:6:23" + }, + "nativeSrc": "799:38:23", + "nodeType": "YulFunctionCall", + "src": "799:38:23" + }, + "nativeSrc": "799:38:23", + "nodeType": "YulExpressionStatement", + "src": "799:38:23" + }, + { + "nativeSrc": "846:57:23", + "nodeType": "YulAssignment", + "src": "846:57:23", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "pos", + "nativeSrc": "861:3:23", + "nodeType": "YulIdentifier", + "src": "861:3:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "length", + "nativeSrc": "874:6:23", + "nodeType": "YulIdentifier", + "src": "874:6:23" + }, + { + "kind": "number", + "nativeSrc": "882:2:23", + "nodeType": "YulLiteral", + "src": "882:2:23", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "870:3:23", + "nodeType": "YulIdentifier", + "src": "870:3:23" + }, + "nativeSrc": "870:15:23", + "nodeType": "YulFunctionCall", + "src": "870:15:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "891:2:23", + "nodeType": "YulLiteral", + "src": "891:2:23", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "887:3:23", + "nodeType": "YulIdentifier", + "src": "887:3:23" + }, + "nativeSrc": "887:7:23", + "nodeType": "YulFunctionCall", + "src": "887:7:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "866:3:23", + "nodeType": "YulIdentifier", + "src": "866:3:23" + }, + "nativeSrc": "866:29:23", + "nodeType": "YulFunctionCall", + "src": "866:29:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "857:3:23", + "nodeType": "YulIdentifier", + "src": "857:3:23" + }, + "nativeSrc": "857:39:23", + "nodeType": "YulFunctionCall", + "src": "857:39:23" + }, + { + "kind": "number", + "nativeSrc": "898:4:23", + "nodeType": "YulLiteral", + "src": "898:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "853:3:23", + "nodeType": "YulIdentifier", + "src": "853:3:23" + }, + "nativeSrc": "853:50:23", + "nodeType": "YulFunctionCall", + "src": "853:50:23" + }, + "variableNames": [ + { + "name": "end", + "nativeSrc": "846:3:23", + "nodeType": "YulIdentifier", + "src": "846:3:23" + } + ] + } + ] + }, + "name": "abi_encode_string", + "nativeSrc": "620:289:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nativeSrc": "647:5:23", + "nodeType": "YulTypedName", + "src": "647:5:23", + "type": "" + }, + { + "name": "pos", + "nativeSrc": "654:3:23", + "nodeType": "YulTypedName", + "src": "654:3:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nativeSrc": "662:3:23", + "nodeType": "YulTypedName", + "src": "662:3:23", + "type": "" + } + ], + "src": "620:289:23" + }, + { + "body": { + "nativeSrc": "1271:881:23", + "nodeType": "YulBlock", + "src": "1271:881:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "1288:9:23", + "nodeType": "YulIdentifier", + "src": "1288:9:23" + }, + { + "arguments": [ + { + "name": "value0", + "nativeSrc": "1303:6:23", + "nodeType": "YulIdentifier", + "src": "1303:6:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1315:3:23", + "nodeType": "YulLiteral", + "src": "1315:3:23", + "type": "", + "value": "248" + }, + { + "kind": "number", + "nativeSrc": "1320:3:23", + "nodeType": "YulLiteral", + "src": "1320:3:23", + "type": "", + "value": "255" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "1311:3:23", + "nodeType": "YulIdentifier", + "src": "1311:3:23" + }, + "nativeSrc": "1311:13:23", + "nodeType": "YulFunctionCall", + "src": "1311:13:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "1299:3:23", + "nodeType": "YulIdentifier", + "src": "1299:3:23" + }, + "nativeSrc": "1299:26:23", + "nodeType": "YulFunctionCall", + "src": "1299:26:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1281:6:23", + "nodeType": "YulIdentifier", + "src": "1281:6:23" + }, + "nativeSrc": "1281:45:23", + "nodeType": "YulFunctionCall", + "src": "1281:45:23" + }, + "nativeSrc": "1281:45:23", + "nodeType": "YulExpressionStatement", + "src": "1281:45:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "1346:9:23", + "nodeType": "YulIdentifier", + "src": "1346:9:23" + }, + { + "kind": "number", + "nativeSrc": "1357:2:23", + "nodeType": "YulLiteral", + "src": "1357:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1342:3:23", + "nodeType": "YulIdentifier", + "src": "1342:3:23" + }, + "nativeSrc": "1342:18:23", + "nodeType": "YulFunctionCall", + "src": "1342:18:23" + }, + { + "kind": "number", + "nativeSrc": "1362:3:23", + "nodeType": "YulLiteral", + "src": "1362:3:23", + "type": "", + "value": "224" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1335:6:23", + "nodeType": "YulIdentifier", + "src": "1335:6:23" + }, + "nativeSrc": "1335:31:23", + "nodeType": "YulFunctionCall", + "src": "1335:31:23" + }, + "nativeSrc": "1335:31:23", + "nodeType": "YulExpressionStatement", + "src": "1335:31:23" + }, + { + "nativeSrc": "1375:60:23", + "nodeType": "YulVariableDeclaration", + "src": "1375:60:23", + "value": { + "arguments": [ + { + "name": "value1", + "nativeSrc": "1407:6:23", + "nodeType": "YulIdentifier", + "src": "1407:6:23" + }, + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "1419:9:23", + "nodeType": "YulIdentifier", + "src": "1419:9:23" + }, + { + "kind": "number", + "nativeSrc": "1430:3:23", + "nodeType": "YulLiteral", + "src": "1430:3:23", + "type": "", + "value": "224" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1415:3:23", + "nodeType": "YulIdentifier", + "src": "1415:3:23" + }, + "nativeSrc": "1415:19:23", + "nodeType": "YulFunctionCall", + "src": "1415:19:23" + } + ], + "functionName": { + "name": "abi_encode_string", + "nativeSrc": "1389:17:23", + "nodeType": "YulIdentifier", + "src": "1389:17:23" + }, + "nativeSrc": "1389:46:23", + "nodeType": "YulFunctionCall", + "src": "1389:46:23" + }, + "variables": [ + { + "name": "tail_1", + "nativeSrc": "1379:6:23", + "nodeType": "YulTypedName", + "src": "1379:6:23", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "1455:9:23", + "nodeType": "YulIdentifier", + "src": "1455:9:23" + }, + { + "kind": "number", + "nativeSrc": "1466:2:23", + "nodeType": "YulLiteral", + "src": "1466:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1451:3:23", + "nodeType": "YulIdentifier", + "src": "1451:3:23" + }, + "nativeSrc": "1451:18:23", + "nodeType": "YulFunctionCall", + "src": "1451:18:23" + }, + { + "arguments": [ + { + "name": "tail_1", + "nativeSrc": "1475:6:23", + "nodeType": "YulIdentifier", + "src": "1475:6:23" + }, + { + "name": "headStart", + "nativeSrc": "1483:9:23", + "nodeType": "YulIdentifier", + "src": "1483:9:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "1471:3:23", + "nodeType": "YulIdentifier", + "src": "1471:3:23" + }, + "nativeSrc": "1471:22:23", + "nodeType": "YulFunctionCall", + "src": "1471:22:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1444:6:23", + "nodeType": "YulIdentifier", + "src": "1444:6:23" + }, + "nativeSrc": "1444:50:23", + "nodeType": "YulFunctionCall", + "src": "1444:50:23" + }, + "nativeSrc": "1444:50:23", + "nodeType": "YulExpressionStatement", + "src": "1444:50:23" + }, + { + "nativeSrc": "1503:47:23", + "nodeType": "YulVariableDeclaration", + "src": "1503:47:23", + "value": { + "arguments": [ + { + "name": "value2", + "nativeSrc": "1535:6:23", + "nodeType": "YulIdentifier", + "src": "1535:6:23" + }, + { + "name": "tail_1", + "nativeSrc": "1543:6:23", + "nodeType": "YulIdentifier", + "src": "1543:6:23" + } + ], + "functionName": { + "name": "abi_encode_string", + "nativeSrc": "1517:17:23", + "nodeType": "YulIdentifier", + "src": "1517:17:23" + }, + "nativeSrc": "1517:33:23", + "nodeType": "YulFunctionCall", + "src": "1517:33:23" + }, + "variables": [ + { + "name": "tail_2", + "nativeSrc": "1507:6:23", + "nodeType": "YulTypedName", + "src": "1507:6:23", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "1570:9:23", + "nodeType": "YulIdentifier", + "src": "1570:9:23" + }, + { + "kind": "number", + "nativeSrc": "1581:2:23", + "nodeType": "YulLiteral", + "src": "1581:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1566:3:23", + "nodeType": "YulIdentifier", + "src": "1566:3:23" + }, + "nativeSrc": "1566:18:23", + "nodeType": "YulFunctionCall", + "src": "1566:18:23" + }, + { + "name": "value3", + "nativeSrc": "1586:6:23", + "nodeType": "YulIdentifier", + "src": "1586:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1559:6:23", + "nodeType": "YulIdentifier", + "src": "1559:6:23" + }, + "nativeSrc": "1559:34:23", + "nodeType": "YulFunctionCall", + "src": "1559:34:23" + }, + "nativeSrc": "1559:34:23", + "nodeType": "YulExpressionStatement", + "src": "1559:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "1613:9:23", + "nodeType": "YulIdentifier", + "src": "1613:9:23" + }, + { + "kind": "number", + "nativeSrc": "1624:3:23", + "nodeType": "YulLiteral", + "src": "1624:3:23", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1609:3:23", + "nodeType": "YulIdentifier", + "src": "1609:3:23" + }, + "nativeSrc": "1609:19:23", + "nodeType": "YulFunctionCall", + "src": "1609:19:23" + }, + { + "arguments": [ + { + "name": "value4", + "nativeSrc": "1634:6:23", + "nodeType": "YulIdentifier", + "src": "1634:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1650:3:23", + "nodeType": "YulLiteral", + "src": "1650:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "1655:1:23", + "nodeType": "YulLiteral", + "src": "1655:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "1646:3:23", + "nodeType": "YulIdentifier", + "src": "1646:3:23" + }, + "nativeSrc": "1646:11:23", + "nodeType": "YulFunctionCall", + "src": "1646:11:23" + }, + { + "kind": "number", + "nativeSrc": "1659:1:23", + "nodeType": "YulLiteral", + "src": "1659:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "1642:3:23", + "nodeType": "YulIdentifier", + "src": "1642:3:23" + }, + "nativeSrc": "1642:19:23", + "nodeType": "YulFunctionCall", + "src": "1642:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "1630:3:23", + "nodeType": "YulIdentifier", + "src": "1630:3:23" + }, + "nativeSrc": "1630:32:23", + "nodeType": "YulFunctionCall", + "src": "1630:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1602:6:23", + "nodeType": "YulIdentifier", + "src": "1602:6:23" + }, + "nativeSrc": "1602:61:23", + "nodeType": "YulFunctionCall", + "src": "1602:61:23" + }, + "nativeSrc": "1602:61:23", + "nodeType": "YulExpressionStatement", + "src": "1602:61:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "1683:9:23", + "nodeType": "YulIdentifier", + "src": "1683:9:23" + }, + { + "kind": "number", + "nativeSrc": "1694:3:23", + "nodeType": "YulLiteral", + "src": "1694:3:23", + "type": "", + "value": "160" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1679:3:23", + "nodeType": "YulIdentifier", + "src": "1679:3:23" + }, + "nativeSrc": "1679:19:23", + "nodeType": "YulFunctionCall", + "src": "1679:19:23" + }, + { + "name": "value5", + "nativeSrc": "1700:6:23", + "nodeType": "YulIdentifier", + "src": "1700:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1672:6:23", + "nodeType": "YulIdentifier", + "src": "1672:6:23" + }, + "nativeSrc": "1672:35:23", + "nodeType": "YulFunctionCall", + "src": "1672:35:23" + }, + "nativeSrc": "1672:35:23", + "nodeType": "YulExpressionStatement", + "src": "1672:35:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "1727:9:23", + "nodeType": "YulIdentifier", + "src": "1727:9:23" + }, + { + "kind": "number", + "nativeSrc": "1738:3:23", + "nodeType": "YulLiteral", + "src": "1738:3:23", + "type": "", + "value": "192" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1723:3:23", + "nodeType": "YulIdentifier", + "src": "1723:3:23" + }, + "nativeSrc": "1723:19:23", + "nodeType": "YulFunctionCall", + "src": "1723:19:23" + }, + { + "arguments": [ + { + "name": "tail_2", + "nativeSrc": "1748:6:23", + "nodeType": "YulIdentifier", + "src": "1748:6:23" + }, + { + "name": "headStart", + "nativeSrc": "1756:9:23", + "nodeType": "YulIdentifier", + "src": "1756:9:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "1744:3:23", + "nodeType": "YulIdentifier", + "src": "1744:3:23" + }, + "nativeSrc": "1744:22:23", + "nodeType": "YulFunctionCall", + "src": "1744:22:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1716:6:23", + "nodeType": "YulIdentifier", + "src": "1716:6:23" + }, + "nativeSrc": "1716:51:23", + "nodeType": "YulFunctionCall", + "src": "1716:51:23" + }, + "nativeSrc": "1716:51:23", + "nodeType": "YulExpressionStatement", + "src": "1716:51:23" + }, + { + "nativeSrc": "1776:17:23", + "nodeType": "YulVariableDeclaration", + "src": "1776:17:23", + "value": { + "name": "tail_2", + "nativeSrc": "1787:6:23", + "nodeType": "YulIdentifier", + "src": "1787:6:23" + }, + "variables": [ + { + "name": "pos", + "nativeSrc": "1780:3:23", + "nodeType": "YulTypedName", + "src": "1780:3:23", + "type": "" + } + ] + }, + { + "nativeSrc": "1802:27:23", + "nodeType": "YulVariableDeclaration", + "src": "1802:27:23", + "value": { + "arguments": [ + { + "name": "value6", + "nativeSrc": "1822:6:23", + "nodeType": "YulIdentifier", + "src": "1822:6:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "1816:5:23", + "nodeType": "YulIdentifier", + "src": "1816:5:23" + }, + "nativeSrc": "1816:13:23", + "nodeType": "YulFunctionCall", + "src": "1816:13:23" + }, + "variables": [ + { + "name": "length", + "nativeSrc": "1806:6:23", + "nodeType": "YulTypedName", + "src": "1806:6:23", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "tail_2", + "nativeSrc": "1845:6:23", + "nodeType": "YulIdentifier", + "src": "1845:6:23" + }, + { + "name": "length", + "nativeSrc": "1853:6:23", + "nodeType": "YulIdentifier", + "src": "1853:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1838:6:23", + "nodeType": "YulIdentifier", + "src": "1838:6:23" + }, + "nativeSrc": "1838:22:23", + "nodeType": "YulFunctionCall", + "src": "1838:22:23" + }, + "nativeSrc": "1838:22:23", + "nodeType": "YulExpressionStatement", + "src": "1838:22:23" + }, + { + "nativeSrc": "1869:22:23", + "nodeType": "YulAssignment", + "src": "1869:22:23", + "value": { + "arguments": [ + { + "name": "tail_2", + "nativeSrc": "1880:6:23", + "nodeType": "YulIdentifier", + "src": "1880:6:23" + }, + { + "kind": "number", + "nativeSrc": "1888:2:23", + "nodeType": "YulLiteral", + "src": "1888:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1876:3:23", + "nodeType": "YulIdentifier", + "src": "1876:3:23" + }, + "nativeSrc": "1876:15:23", + "nodeType": "YulFunctionCall", + "src": "1876:15:23" + }, + "variableNames": [ + { + "name": "pos", + "nativeSrc": "1869:3:23", + "nodeType": "YulIdentifier", + "src": "1869:3:23" + } + ] + }, + { + "nativeSrc": "1900:29:23", + "nodeType": "YulVariableDeclaration", + "src": "1900:29:23", + "value": { + "arguments": [ + { + "name": "value6", + "nativeSrc": "1918:6:23", + "nodeType": "YulIdentifier", + "src": "1918:6:23" + }, + { + "kind": "number", + "nativeSrc": "1926:2:23", + "nodeType": "YulLiteral", + "src": "1926:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1914:3:23", + "nodeType": "YulIdentifier", + "src": "1914:3:23" + }, + "nativeSrc": "1914:15:23", + "nodeType": "YulFunctionCall", + "src": "1914:15:23" + }, + "variables": [ + { + "name": "srcPtr", + "nativeSrc": "1904:6:23", + "nodeType": "YulTypedName", + "src": "1904:6:23", + "type": "" + } + ] + }, + { + "nativeSrc": "1938:10:23", + "nodeType": "YulVariableDeclaration", + "src": "1938:10:23", + "value": { + "kind": "number", + "nativeSrc": "1947:1:23", + "nodeType": "YulLiteral", + "src": "1947:1:23", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "i", + "nativeSrc": "1942:1:23", + "nodeType": "YulTypedName", + "src": "1942:1:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "2006:120:23", + "nodeType": "YulBlock", + "src": "2006:120:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "pos", + "nativeSrc": "2027:3:23", + "nodeType": "YulIdentifier", + "src": "2027:3:23" + }, + { + "arguments": [ + { + "name": "srcPtr", + "nativeSrc": "2038:6:23", + "nodeType": "YulIdentifier", + "src": "2038:6:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "2032:5:23", + "nodeType": "YulIdentifier", + "src": "2032:5:23" + }, + "nativeSrc": "2032:13:23", + "nodeType": "YulFunctionCall", + "src": "2032:13:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "2020:6:23", + "nodeType": "YulIdentifier", + "src": "2020:6:23" + }, + "nativeSrc": "2020:26:23", + "nodeType": "YulFunctionCall", + "src": "2020:26:23" + }, + "nativeSrc": "2020:26:23", + "nodeType": "YulExpressionStatement", + "src": "2020:26:23" + }, + { + "nativeSrc": "2059:19:23", + "nodeType": "YulAssignment", + "src": "2059:19:23", + "value": { + "arguments": [ + { + "name": "pos", + "nativeSrc": "2070:3:23", + "nodeType": "YulIdentifier", + "src": "2070:3:23" + }, + { + "kind": "number", + "nativeSrc": "2075:2:23", + "nodeType": "YulLiteral", + "src": "2075:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2066:3:23", + "nodeType": "YulIdentifier", + "src": "2066:3:23" + }, + "nativeSrc": "2066:12:23", + "nodeType": "YulFunctionCall", + "src": "2066:12:23" + }, + "variableNames": [ + { + "name": "pos", + "nativeSrc": "2059:3:23", + "nodeType": "YulIdentifier", + "src": "2059:3:23" + } + ] + }, + { + "nativeSrc": "2091:25:23", + "nodeType": "YulAssignment", + "src": "2091:25:23", + "value": { + "arguments": [ + { + "name": "srcPtr", + "nativeSrc": "2105:6:23", + "nodeType": "YulIdentifier", + "src": "2105:6:23" + }, + { + "kind": "number", + "nativeSrc": "2113:2:23", + "nodeType": "YulLiteral", + "src": "2113:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2101:3:23", + "nodeType": "YulIdentifier", + "src": "2101:3:23" + }, + "nativeSrc": "2101:15:23", + "nodeType": "YulFunctionCall", + "src": "2101:15:23" + }, + "variableNames": [ + { + "name": "srcPtr", + "nativeSrc": "2091:6:23", + "nodeType": "YulIdentifier", + "src": "2091:6:23" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "i", + "nativeSrc": "1968:1:23", + "nodeType": "YulIdentifier", + "src": "1968:1:23" + }, + { + "name": "length", + "nativeSrc": "1971:6:23", + "nodeType": "YulIdentifier", + "src": "1971:6:23" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "1965:2:23", + "nodeType": "YulIdentifier", + "src": "1965:2:23" + }, + "nativeSrc": "1965:13:23", + "nodeType": "YulFunctionCall", + "src": "1965:13:23" + }, + "nativeSrc": "1957:169:23", + "nodeType": "YulForLoop", + "post": { + "nativeSrc": "1979:18:23", + "nodeType": "YulBlock", + "src": "1979:18:23", + "statements": [ + { + "nativeSrc": "1981:14:23", + "nodeType": "YulAssignment", + "src": "1981:14:23", + "value": { + "arguments": [ + { + "name": "i", + "nativeSrc": "1990:1:23", + "nodeType": "YulIdentifier", + "src": "1990:1:23" + }, + { + "kind": "number", + "nativeSrc": "1993:1:23", + "nodeType": "YulLiteral", + "src": "1993:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1986:3:23", + "nodeType": "YulIdentifier", + "src": "1986:3:23" + }, + "nativeSrc": "1986:9:23", + "nodeType": "YulFunctionCall", + "src": "1986:9:23" + }, + "variableNames": [ + { + "name": "i", + "nativeSrc": "1981:1:23", + "nodeType": "YulIdentifier", + "src": "1981:1:23" + } + ] + } + ] + }, + "pre": { + "nativeSrc": "1961:3:23", + "nodeType": "YulBlock", + "src": "1961:3:23", + "statements": [] + }, + "src": "1957:169:23" + }, + { + "nativeSrc": "2135:11:23", + "nodeType": "YulAssignment", + "src": "2135:11:23", + "value": { + "name": "pos", + "nativeSrc": "2143:3:23", + "nodeType": "YulIdentifier", + "src": "2143:3:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "2135:4:23", + "nodeType": "YulIdentifier", + "src": "2135:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_bytes1_t_string_memory_ptr_t_string_memory_ptr_t_uint256_t_address_t_bytes32_t_array$_t_uint256_$dyn_memory_ptr__to_t_bytes1_t_string_memory_ptr_t_string_memory_ptr_t_uint256_t_address_t_bytes32_t_array$_t_uint256_$dyn_memory_ptr__fromStack_reversed", + "nativeSrc": "914:1238:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "1192:9:23", + "nodeType": "YulTypedName", + "src": "1192:9:23", + "type": "" + }, + { + "name": "value6", + "nativeSrc": "1203:6:23", + "nodeType": "YulTypedName", + "src": "1203:6:23", + "type": "" + }, + { + "name": "value5", + "nativeSrc": "1211:6:23", + "nodeType": "YulTypedName", + "src": "1211:6:23", + "type": "" + }, + { + "name": "value4", + "nativeSrc": "1219:6:23", + "nodeType": "YulTypedName", + "src": "1219:6:23", + "type": "" + }, + { + "name": "value3", + "nativeSrc": "1227:6:23", + "nodeType": "YulTypedName", + "src": "1227:6:23", + "type": "" + }, + { + "name": "value2", + "nativeSrc": "1235:6:23", + "nodeType": "YulTypedName", + "src": "1235:6:23", + "type": "" + }, + { + "name": "value1", + "nativeSrc": "1243:6:23", + "nodeType": "YulTypedName", + "src": "1243:6:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "1251:6:23", + "nodeType": "YulTypedName", + "src": "1251:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "1262:4:23", + "nodeType": "YulTypedName", + "src": "1262:4:23", + "type": "" + } + ], + "src": "914:1238:23" + }, + { + "body": { + "nativeSrc": "2206:124:23", + "nodeType": "YulBlock", + "src": "2206:124:23", + "statements": [ + { + "nativeSrc": "2216:29:23", + "nodeType": "YulAssignment", + "src": "2216:29:23", + "value": { + "arguments": [ + { + "name": "offset", + "nativeSrc": "2238:6:23", + "nodeType": "YulIdentifier", + "src": "2238:6:23" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "2225:12:23", + "nodeType": "YulIdentifier", + "src": "2225:12:23" + }, + "nativeSrc": "2225:20:23", + "nodeType": "YulFunctionCall", + "src": "2225:20:23" + }, + "variableNames": [ + { + "name": "value", + "nativeSrc": "2216:5:23", + "nodeType": "YulIdentifier", + "src": "2216:5:23" + } + ] + }, + { + "body": { + "nativeSrc": "2308:16:23", + "nodeType": "YulBlock", + "src": "2308:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2317:1:23", + "nodeType": "YulLiteral", + "src": "2317:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "2320:1:23", + "nodeType": "YulLiteral", + "src": "2320:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "2310:6:23", + "nodeType": "YulIdentifier", + "src": "2310:6:23" + }, + "nativeSrc": "2310:12:23", + "nodeType": "YulFunctionCall", + "src": "2310:12:23" + }, + "nativeSrc": "2310:12:23", + "nodeType": "YulExpressionStatement", + "src": "2310:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nativeSrc": "2267:5:23", + "nodeType": "YulIdentifier", + "src": "2267:5:23" + }, + { + "arguments": [ + { + "name": "value", + "nativeSrc": "2278:5:23", + "nodeType": "YulIdentifier", + "src": "2278:5:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2293:3:23", + "nodeType": "YulLiteral", + "src": "2293:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "2298:1:23", + "nodeType": "YulLiteral", + "src": "2298:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "2289:3:23", + "nodeType": "YulIdentifier", + "src": "2289:3:23" + }, + "nativeSrc": "2289:11:23", + "nodeType": "YulFunctionCall", + "src": "2289:11:23" + }, + { + "kind": "number", + "nativeSrc": "2302:1:23", + "nodeType": "YulLiteral", + "src": "2302:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "2285:3:23", + "nodeType": "YulIdentifier", + "src": "2285:3:23" + }, + "nativeSrc": "2285:19:23", + "nodeType": "YulFunctionCall", + "src": "2285:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "2274:3:23", + "nodeType": "YulIdentifier", + "src": "2274:3:23" + }, + "nativeSrc": "2274:31:23", + "nodeType": "YulFunctionCall", + "src": "2274:31:23" + } + ], + "functionName": { + "name": "eq", + "nativeSrc": "2264:2:23", + "nodeType": "YulIdentifier", + "src": "2264:2:23" + }, + "nativeSrc": "2264:42:23", + "nodeType": "YulFunctionCall", + "src": "2264:42:23" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "2257:6:23", + "nodeType": "YulIdentifier", + "src": "2257:6:23" + }, + "nativeSrc": "2257:50:23", + "nodeType": "YulFunctionCall", + "src": "2257:50:23" + }, + "nativeSrc": "2254:70:23", + "nodeType": "YulIf", + "src": "2254:70:23" + } + ] + }, + "name": "abi_decode_address", + "nativeSrc": "2157:173:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "offset", + "nativeSrc": "2185:6:23", + "nodeType": "YulTypedName", + "src": "2185:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value", + "nativeSrc": "2196:5:23", + "nodeType": "YulTypedName", + "src": "2196:5:23", + "type": "" + } + ], + "src": "2157:173:23" + }, + { + "body": { + "nativeSrc": "2422:213:23", + "nodeType": "YulBlock", + "src": "2422:213:23", + "statements": [ + { + "body": { + "nativeSrc": "2468:16:23", + "nodeType": "YulBlock", + "src": "2468:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2477:1:23", + "nodeType": "YulLiteral", + "src": "2477:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "2480:1:23", + "nodeType": "YulLiteral", + "src": "2480:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "2470:6:23", + "nodeType": "YulIdentifier", + "src": "2470:6:23" + }, + "nativeSrc": "2470:12:23", + "nodeType": "YulFunctionCall", + "src": "2470:12:23" + }, + "nativeSrc": "2470:12:23", + "nodeType": "YulExpressionStatement", + "src": "2470:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nativeSrc": "2443:7:23", + "nodeType": "YulIdentifier", + "src": "2443:7:23" + }, + { + "name": "headStart", + "nativeSrc": "2452:9:23", + "nodeType": "YulIdentifier", + "src": "2452:9:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "2439:3:23", + "nodeType": "YulIdentifier", + "src": "2439:3:23" + }, + "nativeSrc": "2439:23:23", + "nodeType": "YulFunctionCall", + "src": "2439:23:23" + }, + { + "kind": "number", + "nativeSrc": "2464:2:23", + "nodeType": "YulLiteral", + "src": "2464:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "slt", + "nativeSrc": "2435:3:23", + "nodeType": "YulIdentifier", + "src": "2435:3:23" + }, + "nativeSrc": "2435:32:23", + "nodeType": "YulFunctionCall", + "src": "2435:32:23" + }, + "nativeSrc": "2432:52:23", + "nodeType": "YulIf", + "src": "2432:52:23" + }, + { + "nativeSrc": "2493:39:23", + "nodeType": "YulAssignment", + "src": "2493:39:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "2522:9:23", + "nodeType": "YulIdentifier", + "src": "2522:9:23" + } + ], + "functionName": { + "name": "abi_decode_address", + "nativeSrc": "2503:18:23", + "nodeType": "YulIdentifier", + "src": "2503:18:23" + }, + "nativeSrc": "2503:29:23", + "nodeType": "YulFunctionCall", + "src": "2503:29:23" + }, + "variableNames": [ + { + "name": "value0", + "nativeSrc": "2493:6:23", + "nodeType": "YulIdentifier", + "src": "2493:6:23" + } + ] + }, + { + "nativeSrc": "2541:14:23", + "nodeType": "YulVariableDeclaration", + "src": "2541:14:23", + "value": { + "kind": "number", + "nativeSrc": "2554:1:23", + "nodeType": "YulLiteral", + "src": "2554:1:23", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "value", + "nativeSrc": "2545:5:23", + "nodeType": "YulTypedName", + "src": "2545:5:23", + "type": "" + } + ] + }, + { + "nativeSrc": "2564:41:23", + "nodeType": "YulAssignment", + "src": "2564:41:23", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "2590:9:23", + "nodeType": "YulIdentifier", + "src": "2590:9:23" + }, + { + "kind": "number", + "nativeSrc": "2601:2:23", + "nodeType": "YulLiteral", + "src": "2601:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2586:3:23", + "nodeType": "YulIdentifier", + "src": "2586:3:23" + }, + "nativeSrc": "2586:18:23", + "nodeType": "YulFunctionCall", + "src": "2586:18:23" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "2573:12:23", + "nodeType": "YulIdentifier", + "src": "2573:12:23" + }, + "nativeSrc": "2573:32:23", + "nodeType": "YulFunctionCall", + "src": "2573:32:23" + }, + "variableNames": [ + { + "name": "value", + "nativeSrc": "2564:5:23", + "nodeType": "YulIdentifier", + "src": "2564:5:23" + } + ] + }, + { + "nativeSrc": "2614:15:23", + "nodeType": "YulAssignment", + "src": "2614:15:23", + "value": { + "name": "value", + "nativeSrc": "2624:5:23", + "nodeType": "YulIdentifier", + "src": "2624:5:23" + }, + "variableNames": [ + { + "name": "value1", + "nativeSrc": "2614:6:23", + "nodeType": "YulIdentifier", + "src": "2614:6:23" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_addresst_uint256", + "nativeSrc": "2335:300:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "2380:9:23", + "nodeType": "YulTypedName", + "src": "2380:9:23", + "type": "" + }, + { + "name": "dataEnd", + "nativeSrc": "2391:7:23", + "nodeType": "YulTypedName", + "src": "2391:7:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nativeSrc": "2403:6:23", + "nodeType": "YulTypedName", + "src": "2403:6:23", + "type": "" + }, + { + "name": "value1", + "nativeSrc": "2411:6:23", + "nodeType": "YulTypedName", + "src": "2411:6:23", + "type": "" + } + ], + "src": "2335:300:23" + }, + { + "body": { + "nativeSrc": "2735:92:23", + "nodeType": "YulBlock", + "src": "2735:92:23", + "statements": [ + { + "nativeSrc": "2745:26:23", + "nodeType": "YulAssignment", + "src": "2745:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "2757:9:23", + "nodeType": "YulIdentifier", + "src": "2757:9:23" + }, + { + "kind": "number", + "nativeSrc": "2768:2:23", + "nodeType": "YulLiteral", + "src": "2768:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2753:3:23", + "nodeType": "YulIdentifier", + "src": "2753:3:23" + }, + "nativeSrc": "2753:18:23", + "nodeType": "YulFunctionCall", + "src": "2753:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "2745:4:23", + "nodeType": "YulIdentifier", + "src": "2745:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "2787:9:23", + "nodeType": "YulIdentifier", + "src": "2787:9:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "value0", + "nativeSrc": "2812:6:23", + "nodeType": "YulIdentifier", + "src": "2812:6:23" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "2805:6:23", + "nodeType": "YulIdentifier", + "src": "2805:6:23" + }, + "nativeSrc": "2805:14:23", + "nodeType": "YulFunctionCall", + "src": "2805:14:23" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "2798:6:23", + "nodeType": "YulIdentifier", + "src": "2798:6:23" + }, + "nativeSrc": "2798:22:23", + "nodeType": "YulFunctionCall", + "src": "2798:22:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "2780:6:23", + "nodeType": "YulIdentifier", + "src": "2780:6:23" + }, + "nativeSrc": "2780:41:23", + "nodeType": "YulFunctionCall", + "src": "2780:41:23" + }, + "nativeSrc": "2780:41:23", + "nodeType": "YulExpressionStatement", + "src": "2780:41:23" + } + ] + }, + "name": "abi_encode_tuple_t_bool__to_t_bool__fromStack_reversed", + "nativeSrc": "2640:187:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "2704:9:23", + "nodeType": "YulTypedName", + "src": "2704:9:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "2715:6:23", + "nodeType": "YulTypedName", + "src": "2715:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "2726:4:23", + "nodeType": "YulTypedName", + "src": "2726:4:23", + "type": "" + } + ], + "src": "2640:187:23" + }, + { + "body": { + "nativeSrc": "2902:156:23", + "nodeType": "YulBlock", + "src": "2902:156:23", + "statements": [ + { + "body": { + "nativeSrc": "2948:16:23", + "nodeType": "YulBlock", + "src": "2948:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2957:1:23", + "nodeType": "YulLiteral", + "src": "2957:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "2960:1:23", + "nodeType": "YulLiteral", + "src": "2960:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "2950:6:23", + "nodeType": "YulIdentifier", + "src": "2950:6:23" + }, + "nativeSrc": "2950:12:23", + "nodeType": "YulFunctionCall", + "src": "2950:12:23" + }, + "nativeSrc": "2950:12:23", + "nodeType": "YulExpressionStatement", + "src": "2950:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nativeSrc": "2923:7:23", + "nodeType": "YulIdentifier", + "src": "2923:7:23" + }, + { + "name": "headStart", + "nativeSrc": "2932:9:23", + "nodeType": "YulIdentifier", + "src": "2932:9:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "2919:3:23", + "nodeType": "YulIdentifier", + "src": "2919:3:23" + }, + "nativeSrc": "2919:23:23", + "nodeType": "YulFunctionCall", + "src": "2919:23:23" + }, + { + "kind": "number", + "nativeSrc": "2944:2:23", + "nodeType": "YulLiteral", + "src": "2944:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nativeSrc": "2915:3:23", + "nodeType": "YulIdentifier", + "src": "2915:3:23" + }, + "nativeSrc": "2915:32:23", + "nodeType": "YulFunctionCall", + "src": "2915:32:23" + }, + "nativeSrc": "2912:52:23", + "nodeType": "YulIf", + "src": "2912:52:23" + }, + { + "nativeSrc": "2973:14:23", + "nodeType": "YulVariableDeclaration", + "src": "2973:14:23", + "value": { + "kind": "number", + "nativeSrc": "2986:1:23", + "nodeType": "YulLiteral", + "src": "2986:1:23", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "value", + "nativeSrc": "2977:5:23", + "nodeType": "YulTypedName", + "src": "2977:5:23", + "type": "" + } + ] + }, + { + "nativeSrc": "2996:32:23", + "nodeType": "YulAssignment", + "src": "2996:32:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3018:9:23", + "nodeType": "YulIdentifier", + "src": "3018:9:23" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "3005:12:23", + "nodeType": "YulIdentifier", + "src": "3005:12:23" + }, + "nativeSrc": "3005:23:23", + "nodeType": "YulFunctionCall", + "src": "3005:23:23" + }, + "variableNames": [ + { + "name": "value", + "nativeSrc": "2996:5:23", + "nodeType": "YulIdentifier", + "src": "2996:5:23" + } + ] + }, + { + "nativeSrc": "3037:15:23", + "nodeType": "YulAssignment", + "src": "3037:15:23", + "value": { + "name": "value", + "nativeSrc": "3047:5:23", + "nodeType": "YulIdentifier", + "src": "3047:5:23" + }, + "variableNames": [ + { + "name": "value0", + "nativeSrc": "3037:6:23", + "nodeType": "YulIdentifier", + "src": "3037:6:23" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_uint256", + "nativeSrc": "2832:226:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "2868:9:23", + "nodeType": "YulTypedName", + "src": "2868:9:23", + "type": "" + }, + { + "name": "dataEnd", + "nativeSrc": "2879:7:23", + "nodeType": "YulTypedName", + "src": "2879:7:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nativeSrc": "2891:6:23", + "nodeType": "YulTypedName", + "src": "2891:6:23", + "type": "" + } + ], + "src": "2832:226:23" + }, + { + "body": { + "nativeSrc": "3133:116:23", + "nodeType": "YulBlock", + "src": "3133:116:23", + "statements": [ + { + "body": { + "nativeSrc": "3179:16:23", + "nodeType": "YulBlock", + "src": "3179:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3188:1:23", + "nodeType": "YulLiteral", + "src": "3188:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "3191:1:23", + "nodeType": "YulLiteral", + "src": "3191:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "3181:6:23", + "nodeType": "YulIdentifier", + "src": "3181:6:23" + }, + "nativeSrc": "3181:12:23", + "nodeType": "YulFunctionCall", + "src": "3181:12:23" + }, + "nativeSrc": "3181:12:23", + "nodeType": "YulExpressionStatement", + "src": "3181:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nativeSrc": "3154:7:23", + "nodeType": "YulIdentifier", + "src": "3154:7:23" + }, + { + "name": "headStart", + "nativeSrc": "3163:9:23", + "nodeType": "YulIdentifier", + "src": "3163:9:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "3150:3:23", + "nodeType": "YulIdentifier", + "src": "3150:3:23" + }, + "nativeSrc": "3150:23:23", + "nodeType": "YulFunctionCall", + "src": "3150:23:23" + }, + { + "kind": "number", + "nativeSrc": "3175:2:23", + "nodeType": "YulLiteral", + "src": "3175:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nativeSrc": "3146:3:23", + "nodeType": "YulIdentifier", + "src": "3146:3:23" + }, + "nativeSrc": "3146:32:23", + "nodeType": "YulFunctionCall", + "src": "3146:32:23" + }, + "nativeSrc": "3143:52:23", + "nodeType": "YulIf", + "src": "3143:52:23" + }, + { + "nativeSrc": "3204:39:23", + "nodeType": "YulAssignment", + "src": "3204:39:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3233:9:23", + "nodeType": "YulIdentifier", + "src": "3233:9:23" + } + ], + "functionName": { + "name": "abi_decode_address", + "nativeSrc": "3214:18:23", + "nodeType": "YulIdentifier", + "src": "3214:18:23" + }, + "nativeSrc": "3214:29:23", + "nodeType": "YulFunctionCall", + "src": "3214:29:23" + }, + "variableNames": [ + { + "name": "value0", + "nativeSrc": "3204:6:23", + "nodeType": "YulIdentifier", + "src": "3204:6:23" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_address", + "nativeSrc": "3063:186:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "3099:9:23", + "nodeType": "YulTypedName", + "src": "3099:9:23", + "type": "" + }, + { + "name": "dataEnd", + "nativeSrc": "3110:7:23", + "nodeType": "YulTypedName", + "src": "3110:7:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nativeSrc": "3122:6:23", + "nodeType": "YulTypedName", + "src": "3122:6:23", + "type": "" + } + ], + "src": "3063:186:23" + }, + { + "body": { + "nativeSrc": "3428:163:23", + "nodeType": "YulBlock", + "src": "3428:163:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3445:9:23", + "nodeType": "YulIdentifier", + "src": "3445:9:23" + }, + { + "kind": "number", + "nativeSrc": "3456:2:23", + "nodeType": "YulLiteral", + "src": "3456:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3438:6:23", + "nodeType": "YulIdentifier", + "src": "3438:6:23" + }, + "nativeSrc": "3438:21:23", + "nodeType": "YulFunctionCall", + "src": "3438:21:23" + }, + "nativeSrc": "3438:21:23", + "nodeType": "YulExpressionStatement", + "src": "3438:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3479:9:23", + "nodeType": "YulIdentifier", + "src": "3479:9:23" + }, + { + "kind": "number", + "nativeSrc": "3490:2:23", + "nodeType": "YulLiteral", + "src": "3490:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3475:3:23", + "nodeType": "YulIdentifier", + "src": "3475:3:23" + }, + "nativeSrc": "3475:18:23", + "nodeType": "YulFunctionCall", + "src": "3475:18:23" + }, + { + "kind": "number", + "nativeSrc": "3495:2:23", + "nodeType": "YulLiteral", + "src": "3495:2:23", + "type": "", + "value": "13" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3468:6:23", + "nodeType": "YulIdentifier", + "src": "3468:6:23" + }, + "nativeSrc": "3468:30:23", + "nodeType": "YulFunctionCall", + "src": "3468:30:23" + }, + "nativeSrc": "3468:30:23", + "nodeType": "YulExpressionStatement", + "src": "3468:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3518:9:23", + "nodeType": "YulIdentifier", + "src": "3518:9:23" + }, + { + "kind": "number", + "nativeSrc": "3529:2:23", + "nodeType": "YulLiteral", + "src": "3529:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3514:3:23", + "nodeType": "YulIdentifier", + "src": "3514:3:23" + }, + "nativeSrc": "3514:18:23", + "nodeType": "YulFunctionCall", + "src": "3514:18:23" + }, + { + "hexValue": "496e76616c6964206f776e6572", + "kind": "string", + "nativeSrc": "3534:15:23", + "nodeType": "YulLiteral", + "src": "3534:15:23", + "type": "", + "value": "Invalid owner" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3507:6:23", + "nodeType": "YulIdentifier", + "src": "3507:6:23" + }, + "nativeSrc": "3507:43:23", + "nodeType": "YulFunctionCall", + "src": "3507:43:23" + }, + "nativeSrc": "3507:43:23", + "nodeType": "YulExpressionStatement", + "src": "3507:43:23" + }, + { + "nativeSrc": "3559:26:23", + "nodeType": "YulAssignment", + "src": "3559:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3571:9:23", + "nodeType": "YulIdentifier", + "src": "3571:9:23" + }, + { + "kind": "number", + "nativeSrc": "3582:2:23", + "nodeType": "YulLiteral", + "src": "3582:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3567:3:23", + "nodeType": "YulIdentifier", + "src": "3567:3:23" + }, + "nativeSrc": "3567:18:23", + "nodeType": "YulFunctionCall", + "src": "3567:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "3559:4:23", + "nodeType": "YulIdentifier", + "src": "3559:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_110461b12e459dc76e692e7a47f9621cf45c7d48020c3c7b2066107cdf1f52ae__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "3254:337:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "3405:9:23", + "nodeType": "YulTypedName", + "src": "3405:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "3419:4:23", + "nodeType": "YulTypedName", + "src": "3419:4:23", + "type": "" + } + ], + "src": "3254:337:23" + }, + { + "body": { + "nativeSrc": "3770:163:23", + "nodeType": "YulBlock", + "src": "3770:163:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3787:9:23", + "nodeType": "YulIdentifier", + "src": "3787:9:23" + }, + { + "kind": "number", + "nativeSrc": "3798:2:23", + "nodeType": "YulLiteral", + "src": "3798:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3780:6:23", + "nodeType": "YulIdentifier", + "src": "3780:6:23" + }, + "nativeSrc": "3780:21:23", + "nodeType": "YulFunctionCall", + "src": "3780:21:23" + }, + "nativeSrc": "3780:21:23", + "nodeType": "YulExpressionStatement", + "src": "3780:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3821:9:23", + "nodeType": "YulIdentifier", + "src": "3821:9:23" + }, + { + "kind": "number", + "nativeSrc": "3832:2:23", + "nodeType": "YulLiteral", + "src": "3832:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3817:3:23", + "nodeType": "YulIdentifier", + "src": "3817:3:23" + }, + "nativeSrc": "3817:18:23", + "nodeType": "YulFunctionCall", + "src": "3817:18:23" + }, + { + "kind": "number", + "nativeSrc": "3837:2:23", + "nodeType": "YulLiteral", + "src": "3837:2:23", + "type": "", + "value": "13" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3810:6:23", + "nodeType": "YulIdentifier", + "src": "3810:6:23" + }, + "nativeSrc": "3810:30:23", + "nodeType": "YulFunctionCall", + "src": "3810:30:23" + }, + "nativeSrc": "3810:30:23", + "nodeType": "YulExpressionStatement", + "src": "3810:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3860:9:23", + "nodeType": "YulIdentifier", + "src": "3860:9:23" + }, + { + "kind": "number", + "nativeSrc": "3871:2:23", + "nodeType": "YulLiteral", + "src": "3871:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3856:3:23", + "nodeType": "YulIdentifier", + "src": "3856:3:23" + }, + "nativeSrc": "3856:18:23", + "nodeType": "YulFunctionCall", + "src": "3856:18:23" + }, + { + "hexValue": "496e76616c696420746f6b656e", + "kind": "string", + "nativeSrc": "3876:15:23", + "nodeType": "YulLiteral", + "src": "3876:15:23", + "type": "", + "value": "Invalid token" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3849:6:23", + "nodeType": "YulIdentifier", + "src": "3849:6:23" + }, + "nativeSrc": "3849:43:23", + "nodeType": "YulFunctionCall", + "src": "3849:43:23" + }, + "nativeSrc": "3849:43:23", + "nodeType": "YulExpressionStatement", + "src": "3849:43:23" + }, + { + "nativeSrc": "3901:26:23", + "nodeType": "YulAssignment", + "src": "3901:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3913:9:23", + "nodeType": "YulIdentifier", + "src": "3913:9:23" + }, + { + "kind": "number", + "nativeSrc": "3924:2:23", + "nodeType": "YulLiteral", + "src": "3924:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3909:3:23", + "nodeType": "YulIdentifier", + "src": "3909:3:23" + }, + "nativeSrc": "3909:18:23", + "nodeType": "YulFunctionCall", + "src": "3909:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "3901:4:23", + "nodeType": "YulIdentifier", + "src": "3901:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_5e70ebd1d4072d337a7fabaa7bda70fa2633d6e3f89d5cb725a16b10d07e54c6__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "3596:337:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "3747:9:23", + "nodeType": "YulTypedName", + "src": "3747:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "3761:4:23", + "nodeType": "YulTypedName", + "src": "3761:4:23", + "type": "" + } + ], + "src": "3596:337:23" + }, + { + "body": { + "nativeSrc": "4112:160:23", + "nodeType": "YulBlock", + "src": "4112:160:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4129:9:23", + "nodeType": "YulIdentifier", + "src": "4129:9:23" + }, + { + "kind": "number", + "nativeSrc": "4140:2:23", + "nodeType": "YulLiteral", + "src": "4140:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4122:6:23", + "nodeType": "YulIdentifier", + "src": "4122:6:23" + }, + "nativeSrc": "4122:21:23", + "nodeType": "YulFunctionCall", + "src": "4122:21:23" + }, + "nativeSrc": "4122:21:23", + "nodeType": "YulExpressionStatement", + "src": "4122:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4163:9:23", + "nodeType": "YulIdentifier", + "src": "4163:9:23" + }, + { + "kind": "number", + "nativeSrc": "4174:2:23", + "nodeType": "YulLiteral", + "src": "4174:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4159:3:23", + "nodeType": "YulIdentifier", + "src": "4159:3:23" + }, + "nativeSrc": "4159:18:23", + "nodeType": "YulFunctionCall", + "src": "4159:18:23" + }, + { + "kind": "number", + "nativeSrc": "4179:2:23", + "nodeType": "YulLiteral", + "src": "4179:2:23", + "type": "", + "value": "10" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4152:6:23", + "nodeType": "YulIdentifier", + "src": "4152:6:23" + }, + "nativeSrc": "4152:30:23", + "nodeType": "YulFunctionCall", + "src": "4152:30:23" + }, + "nativeSrc": "4152:30:23", + "nodeType": "YulExpressionStatement", + "src": "4152:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4202:9:23", + "nodeType": "YulIdentifier", + "src": "4202:9:23" + }, + { + "kind": "number", + "nativeSrc": "4213:2:23", + "nodeType": "YulLiteral", + "src": "4213:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4198:3:23", + "nodeType": "YulIdentifier", + "src": "4198:3:23" + }, + "nativeSrc": "4198:18:23", + "nodeType": "YulFunctionCall", + "src": "4198:18:23" + }, + { + "hexValue": "4e6f6e63652075736564", + "kind": "string", + "nativeSrc": "4218:12:23", + "nodeType": "YulLiteral", + "src": "4218:12:23", + "type": "", + "value": "Nonce used" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4191:6:23", + "nodeType": "YulIdentifier", + "src": "4191:6:23" + }, + "nativeSrc": "4191:40:23", + "nodeType": "YulFunctionCall", + "src": "4191:40:23" + }, + "nativeSrc": "4191:40:23", + "nodeType": "YulExpressionStatement", + "src": "4191:40:23" + }, + { + "nativeSrc": "4240:26:23", + "nodeType": "YulAssignment", + "src": "4240:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4252:9:23", + "nodeType": "YulIdentifier", + "src": "4252:9:23" + }, + { + "kind": "number", + "nativeSrc": "4263:2:23", + "nodeType": "YulLiteral", + "src": "4263:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4248:3:23", + "nodeType": "YulIdentifier", + "src": "4248:3:23" + }, + "nativeSrc": "4248:18:23", + "nodeType": "YulFunctionCall", + "src": "4248:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "4240:4:23", + "nodeType": "YulIdentifier", + "src": "4240:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_15d72127d094a30af360ead73641c61eda3d745ce4d04d12675a5e9a899f8b21__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "3938:334:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "4089:9:23", + "nodeType": "YulTypedName", + "src": "4089:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "4103:4:23", + "nodeType": "YulTypedName", + "src": "4103:4:23", + "type": "" + } + ], + "src": "3938:334:23" + }, + { + "body": { + "nativeSrc": "4451:165:23", + "nodeType": "YulBlock", + "src": "4451:165:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4468:9:23", + "nodeType": "YulIdentifier", + "src": "4468:9:23" + }, + { + "kind": "number", + "nativeSrc": "4479:2:23", + "nodeType": "YulLiteral", + "src": "4479:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4461:6:23", + "nodeType": "YulIdentifier", + "src": "4461:6:23" + }, + "nativeSrc": "4461:21:23", + "nodeType": "YulFunctionCall", + "src": "4461:21:23" + }, + "nativeSrc": "4461:21:23", + "nodeType": "YulExpressionStatement", + "src": "4461:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4502:9:23", + "nodeType": "YulIdentifier", + "src": "4502:9:23" + }, + { + "kind": "number", + "nativeSrc": "4513:2:23", + "nodeType": "YulLiteral", + "src": "4513:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4498:3:23", + "nodeType": "YulIdentifier", + "src": "4498:3:23" + }, + "nativeSrc": "4498:18:23", + "nodeType": "YulFunctionCall", + "src": "4498:18:23" + }, + { + "kind": "number", + "nativeSrc": "4518:2:23", + "nodeType": "YulLiteral", + "src": "4518:2:23", + "type": "", + "value": "15" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4491:6:23", + "nodeType": "YulIdentifier", + "src": "4491:6:23" + }, + "nativeSrc": "4491:30:23", + "nodeType": "YulFunctionCall", + "src": "4491:30:23" + }, + "nativeSrc": "4491:30:23", + "nodeType": "YulExpressionStatement", + "src": "4491:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4541:9:23", + "nodeType": "YulIdentifier", + "src": "4541:9:23" + }, + { + "kind": "number", + "nativeSrc": "4552:2:23", + "nodeType": "YulLiteral", + "src": "4552:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4537:3:23", + "nodeType": "YulIdentifier", + "src": "4537:3:23" + }, + "nativeSrc": "4537:18:23", + "nodeType": "YulFunctionCall", + "src": "4537:18:23" + }, + { + "hexValue": "5061796c6f61642065787069726564", + "kind": "string", + "nativeSrc": "4557:17:23", + "nodeType": "YulLiteral", + "src": "4557:17:23", + "type": "", + "value": "Payload expired" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4530:6:23", + "nodeType": "YulIdentifier", + "src": "4530:6:23" + }, + "nativeSrc": "4530:45:23", + "nodeType": "YulFunctionCall", + "src": "4530:45:23" + }, + "nativeSrc": "4530:45:23", + "nodeType": "YulExpressionStatement", + "src": "4530:45:23" + }, + { + "nativeSrc": "4584:26:23", + "nodeType": "YulAssignment", + "src": "4584:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4596:9:23", + "nodeType": "YulIdentifier", + "src": "4596:9:23" + }, + { + "kind": "number", + "nativeSrc": "4607:2:23", + "nodeType": "YulLiteral", + "src": "4607:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4592:3:23", + "nodeType": "YulIdentifier", + "src": "4592:3:23" + }, + "nativeSrc": "4592:18:23", + "nodeType": "YulFunctionCall", + "src": "4592:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "4584:4:23", + "nodeType": "YulIdentifier", + "src": "4584:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_27859e47e6c2167c8e8d38addfca16b9afb9d8e9750b6a1e67c29196d4d99fae__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "4277:339:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "4428:9:23", + "nodeType": "YulTypedName", + "src": "4428:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "4442:4:23", + "nodeType": "YulTypedName", + "src": "4442:4:23", + "type": "" + } + ], + "src": "4277:339:23" + }, + { + "body": { + "nativeSrc": "4715:427:23", + "nodeType": "YulBlock", + "src": "4715:427:23", + "statements": [ + { + "nativeSrc": "4725:51:23", + "nodeType": "YulVariableDeclaration", + "src": "4725:51:23", + "value": { + "arguments": [ + { + "name": "ptr_to_tail", + "nativeSrc": "4764:11:23", + "nodeType": "YulIdentifier", + "src": "4764:11:23" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "4751:12:23", + "nodeType": "YulIdentifier", + "src": "4751:12:23" + }, + "nativeSrc": "4751:25:23", + "nodeType": "YulFunctionCall", + "src": "4751:25:23" + }, + "variables": [ + { + "name": "rel_offset_of_tail", + "nativeSrc": "4729:18:23", + "nodeType": "YulTypedName", + "src": "4729:18:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "4865:16:23", + "nodeType": "YulBlock", + "src": "4865:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "4874:1:23", + "nodeType": "YulLiteral", + "src": "4874:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "4877:1:23", + "nodeType": "YulLiteral", + "src": "4877:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "4867:6:23", + "nodeType": "YulIdentifier", + "src": "4867:6:23" + }, + "nativeSrc": "4867:12:23", + "nodeType": "YulFunctionCall", + "src": "4867:12:23" + }, + "nativeSrc": "4867:12:23", + "nodeType": "YulExpressionStatement", + "src": "4867:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "rel_offset_of_tail", + "nativeSrc": "4799:18:23", + "nodeType": "YulIdentifier", + "src": "4799:18:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "calldatasize", + "nativeSrc": "4827:12:23", + "nodeType": "YulIdentifier", + "src": "4827:12:23" + }, + "nativeSrc": "4827:14:23", + "nodeType": "YulFunctionCall", + "src": "4827:14:23" + }, + { + "name": "base_ref", + "nativeSrc": "4843:8:23", + "nodeType": "YulIdentifier", + "src": "4843:8:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "4823:3:23", + "nodeType": "YulIdentifier", + "src": "4823:3:23" + }, + "nativeSrc": "4823:29:23", + "nodeType": "YulFunctionCall", + "src": "4823:29:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "4858:2:23", + "nodeType": "YulLiteral", + "src": "4858:2:23", + "type": "", + "value": "30" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "4854:3:23", + "nodeType": "YulIdentifier", + "src": "4854:3:23" + }, + "nativeSrc": "4854:7:23", + "nodeType": "YulFunctionCall", + "src": "4854:7:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4819:3:23", + "nodeType": "YulIdentifier", + "src": "4819:3:23" + }, + "nativeSrc": "4819:43:23", + "nodeType": "YulFunctionCall", + "src": "4819:43:23" + } + ], + "functionName": { + "name": "slt", + "nativeSrc": "4795:3:23", + "nodeType": "YulIdentifier", + "src": "4795:3:23" + }, + "nativeSrc": "4795:68:23", + "nodeType": "YulFunctionCall", + "src": "4795:68:23" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "4788:6:23", + "nodeType": "YulIdentifier", + "src": "4788:6:23" + }, + "nativeSrc": "4788:76:23", + "nodeType": "YulFunctionCall", + "src": "4788:76:23" + }, + "nativeSrc": "4785:96:23", + "nodeType": "YulIf", + "src": "4785:96:23" + }, + { + "nativeSrc": "4890:47:23", + "nodeType": "YulVariableDeclaration", + "src": "4890:47:23", + "value": { + "arguments": [ + { + "name": "base_ref", + "nativeSrc": "4908:8:23", + "nodeType": "YulIdentifier", + "src": "4908:8:23" + }, + { + "name": "rel_offset_of_tail", + "nativeSrc": "4918:18:23", + "nodeType": "YulIdentifier", + "src": "4918:18:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4904:3:23", + "nodeType": "YulIdentifier", + "src": "4904:3:23" + }, + "nativeSrc": "4904:33:23", + "nodeType": "YulFunctionCall", + "src": "4904:33:23" + }, + "variables": [ + { + "name": "addr_1", + "nativeSrc": "4894:6:23", + "nodeType": "YulTypedName", + "src": "4894:6:23", + "type": "" + } + ] + }, + { + "nativeSrc": "4946:30:23", + "nodeType": "YulAssignment", + "src": "4946:30:23", + "value": { + "arguments": [ + { + "name": "addr_1", + "nativeSrc": "4969:6:23", + "nodeType": "YulIdentifier", + "src": "4969:6:23" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "4956:12:23", + "nodeType": "YulIdentifier", + "src": "4956:12:23" + }, + "nativeSrc": "4956:20:23", + "nodeType": "YulFunctionCall", + "src": "4956:20:23" + }, + "variableNames": [ + { + "name": "length", + "nativeSrc": "4946:6:23", + "nodeType": "YulIdentifier", + "src": "4946:6:23" + } + ] + }, + { + "body": { + "nativeSrc": "5019:16:23", + "nodeType": "YulBlock", + "src": "5019:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "5028:1:23", + "nodeType": "YulLiteral", + "src": "5028:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "5031:1:23", + "nodeType": "YulLiteral", + "src": "5031:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "5021:6:23", + "nodeType": "YulIdentifier", + "src": "5021:6:23" + }, + "nativeSrc": "5021:12:23", + "nodeType": "YulFunctionCall", + "src": "5021:12:23" + }, + "nativeSrc": "5021:12:23", + "nodeType": "YulExpressionStatement", + "src": "5021:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "length", + "nativeSrc": "4991:6:23", + "nodeType": "YulIdentifier", + "src": "4991:6:23" + }, + { + "kind": "number", + "nativeSrc": "4999:18:23", + "nodeType": "YulLiteral", + "src": "4999:18:23", + "type": "", + "value": "0xffffffffffffffff" + } + ], + "functionName": { + "name": "gt", + "nativeSrc": "4988:2:23", + "nodeType": "YulIdentifier", + "src": "4988:2:23" + }, + "nativeSrc": "4988:30:23", + "nodeType": "YulFunctionCall", + "src": "4988:30:23" + }, + "nativeSrc": "4985:50:23", + "nodeType": "YulIf", + "src": "4985:50:23" + }, + { + "nativeSrc": "5044:25:23", + "nodeType": "YulAssignment", + "src": "5044:25:23", + "value": { + "arguments": [ + { + "name": "addr_1", + "nativeSrc": "5056:6:23", + "nodeType": "YulIdentifier", + "src": "5056:6:23" + }, + { + "kind": "number", + "nativeSrc": "5064:4:23", + "nodeType": "YulLiteral", + "src": "5064:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "5052:3:23", + "nodeType": "YulIdentifier", + "src": "5052:3:23" + }, + "nativeSrc": "5052:17:23", + "nodeType": "YulFunctionCall", + "src": "5052:17:23" + }, + "variableNames": [ + { + "name": "addr", + "nativeSrc": "5044:4:23", + "nodeType": "YulIdentifier", + "src": "5044:4:23" + } + ] + }, + { + "body": { + "nativeSrc": "5120:16:23", + "nodeType": "YulBlock", + "src": "5120:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "5129:1:23", + "nodeType": "YulLiteral", + "src": "5129:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "5132:1:23", + "nodeType": "YulLiteral", + "src": "5132:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "5122:6:23", + "nodeType": "YulIdentifier", + "src": "5122:6:23" + }, + "nativeSrc": "5122:12:23", + "nodeType": "YulFunctionCall", + "src": "5122:12:23" + }, + "nativeSrc": "5122:12:23", + "nodeType": "YulExpressionStatement", + "src": "5122:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "addr", + "nativeSrc": "5085:4:23", + "nodeType": "YulIdentifier", + "src": "5085:4:23" + }, + { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "calldatasize", + "nativeSrc": "5095:12:23", + "nodeType": "YulIdentifier", + "src": "5095:12:23" + }, + "nativeSrc": "5095:14:23", + "nodeType": "YulFunctionCall", + "src": "5095:14:23" + }, + { + "name": "length", + "nativeSrc": "5111:6:23", + "nodeType": "YulIdentifier", + "src": "5111:6:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "5091:3:23", + "nodeType": "YulIdentifier", + "src": "5091:3:23" + }, + "nativeSrc": "5091:27:23", + "nodeType": "YulFunctionCall", + "src": "5091:27:23" + } + ], + "functionName": { + "name": "sgt", + "nativeSrc": "5081:3:23", + "nodeType": "YulIdentifier", + "src": "5081:3:23" + }, + "nativeSrc": "5081:38:23", + "nodeType": "YulFunctionCall", + "src": "5081:38:23" + }, + "nativeSrc": "5078:58:23", + "nodeType": "YulIf", + "src": "5078:58:23" + } + ] + }, + "name": "access_calldata_tail_t_bytes_calldata_ptr", + "nativeSrc": "4621:521:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "base_ref", + "nativeSrc": "4672:8:23", + "nodeType": "YulTypedName", + "src": "4672:8:23", + "type": "" + }, + { + "name": "ptr_to_tail", + "nativeSrc": "4682:11:23", + "nodeType": "YulTypedName", + "src": "4682:11:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "addr", + "nativeSrc": "4698:4:23", + "nodeType": "YulTypedName", + "src": "4698:4:23", + "type": "" + }, + { + "name": "length", + "nativeSrc": "4704:6:23", + "nodeType": "YulTypedName", + "src": "4704:6:23", + "type": "" + } + ], + "src": "4621:521:23" + }, + { + "body": { + "nativeSrc": "5215:201:23", + "nodeType": "YulBlock", + "src": "5215:201:23", + "statements": [ + { + "body": { + "nativeSrc": "5261:16:23", + "nodeType": "YulBlock", + "src": "5261:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "5270:1:23", + "nodeType": "YulLiteral", + "src": "5270:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "5273:1:23", + "nodeType": "YulLiteral", + "src": "5273:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "5263:6:23", + "nodeType": "YulIdentifier", + "src": "5263:6:23" + }, + "nativeSrc": "5263:12:23", + "nodeType": "YulFunctionCall", + "src": "5263:12:23" + }, + "nativeSrc": "5263:12:23", + "nodeType": "YulExpressionStatement", + "src": "5263:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nativeSrc": "5236:7:23", + "nodeType": "YulIdentifier", + "src": "5236:7:23" + }, + { + "name": "headStart", + "nativeSrc": "5245:9:23", + "nodeType": "YulIdentifier", + "src": "5245:9:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "5232:3:23", + "nodeType": "YulIdentifier", + "src": "5232:3:23" + }, + "nativeSrc": "5232:23:23", + "nodeType": "YulFunctionCall", + "src": "5232:23:23" + }, + { + "kind": "number", + "nativeSrc": "5257:2:23", + "nodeType": "YulLiteral", + "src": "5257:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nativeSrc": "5228:3:23", + "nodeType": "YulIdentifier", + "src": "5228:3:23" + }, + "nativeSrc": "5228:32:23", + "nodeType": "YulFunctionCall", + "src": "5228:32:23" + }, + "nativeSrc": "5225:52:23", + "nodeType": "YulIf", + "src": "5225:52:23" + }, + { + "nativeSrc": "5286:36:23", + "nodeType": "YulVariableDeclaration", + "src": "5286:36:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "5312:9:23", + "nodeType": "YulIdentifier", + "src": "5312:9:23" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "5299:12:23", + "nodeType": "YulIdentifier", + "src": "5299:12:23" + }, + "nativeSrc": "5299:23:23", + "nodeType": "YulFunctionCall", + "src": "5299:23:23" + }, + "variables": [ + { + "name": "value", + "nativeSrc": "5290:5:23", + "nodeType": "YulTypedName", + "src": "5290:5:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "5370:16:23", + "nodeType": "YulBlock", + "src": "5370:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "5379:1:23", + "nodeType": "YulLiteral", + "src": "5379:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "5382:1:23", + "nodeType": "YulLiteral", + "src": "5382:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "5372:6:23", + "nodeType": "YulIdentifier", + "src": "5372:6:23" + }, + "nativeSrc": "5372:12:23", + "nodeType": "YulFunctionCall", + "src": "5372:12:23" + }, + "nativeSrc": "5372:12:23", + "nodeType": "YulExpressionStatement", + "src": "5372:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nativeSrc": "5344:5:23", + "nodeType": "YulIdentifier", + "src": "5344:5:23" + }, + { + "arguments": [ + { + "name": "value", + "nativeSrc": "5355:5:23", + "nodeType": "YulIdentifier", + "src": "5355:5:23" + }, + { + "kind": "number", + "nativeSrc": "5362:4:23", + "nodeType": "YulLiteral", + "src": "5362:4:23", + "type": "", + "value": "0xff" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "5351:3:23", + "nodeType": "YulIdentifier", + "src": "5351:3:23" + }, + "nativeSrc": "5351:16:23", + "nodeType": "YulFunctionCall", + "src": "5351:16:23" + } + ], + "functionName": { + "name": "eq", + "nativeSrc": "5341:2:23", + "nodeType": "YulIdentifier", + "src": "5341:2:23" + }, + "nativeSrc": "5341:27:23", + "nodeType": "YulFunctionCall", + "src": "5341:27:23" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "5334:6:23", + "nodeType": "YulIdentifier", + "src": "5334:6:23" + }, + "nativeSrc": "5334:35:23", + "nodeType": "YulFunctionCall", + "src": "5334:35:23" + }, + "nativeSrc": "5331:55:23", + "nodeType": "YulIf", + "src": "5331:55:23" + }, + { + "nativeSrc": "5395:15:23", + "nodeType": "YulAssignment", + "src": "5395:15:23", + "value": { + "name": "value", + "nativeSrc": "5405:5:23", + "nodeType": "YulIdentifier", + "src": "5405:5:23" + }, + "variableNames": [ + { + "name": "value0", + "nativeSrc": "5395:6:23", + "nodeType": "YulIdentifier", + "src": "5395:6:23" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_uint8", + "nativeSrc": "5147:269:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "5181:9:23", + "nodeType": "YulTypedName", + "src": "5181:9:23", + "type": "" + }, + { + "name": "dataEnd", + "nativeSrc": "5192:7:23", + "nodeType": "YulTypedName", + "src": "5192:7:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nativeSrc": "5204:6:23", + "nodeType": "YulTypedName", + "src": "5204:6:23", + "type": "" + } + ], + "src": "5147:269:23" + }, + { + "body": { + "nativeSrc": "5595:161:23", + "nodeType": "YulBlock", + "src": "5595:161:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "5612:9:23", + "nodeType": "YulIdentifier", + "src": "5612:9:23" + }, + { + "kind": "number", + "nativeSrc": "5623:2:23", + "nodeType": "YulLiteral", + "src": "5623:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "5605:6:23", + "nodeType": "YulIdentifier", + "src": "5605:6:23" + }, + "nativeSrc": "5605:21:23", + "nodeType": "YulFunctionCall", + "src": "5605:21:23" + }, + "nativeSrc": "5605:21:23", + "nodeType": "YulExpressionStatement", + "src": "5605:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "5646:9:23", + "nodeType": "YulIdentifier", + "src": "5646:9:23" + }, + { + "kind": "number", + "nativeSrc": "5657:2:23", + "nodeType": "YulLiteral", + "src": "5657:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "5642:3:23", + "nodeType": "YulIdentifier", + "src": "5642:3:23" + }, + "nativeSrc": "5642:18:23", + "nodeType": "YulFunctionCall", + "src": "5642:18:23" + }, + { + "kind": "number", + "nativeSrc": "5662:2:23", + "nodeType": "YulLiteral", + "src": "5662:2:23", + "type": "", + "value": "11" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "5635:6:23", + "nodeType": "YulIdentifier", + "src": "5635:6:23" + }, + "nativeSrc": "5635:30:23", + "nodeType": "YulFunctionCall", + "src": "5635:30:23" + }, + "nativeSrc": "5635:30:23", + "nodeType": "YulExpressionStatement", + "src": "5635:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "5685:9:23", + "nodeType": "YulIdentifier", + "src": "5685:9:23" + }, + { + "kind": "number", + "nativeSrc": "5696:2:23", + "nodeType": "YulLiteral", + "src": "5696:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "5681:3:23", + "nodeType": "YulIdentifier", + "src": "5681:3:23" + }, + "nativeSrc": "5681:18:23", + "nodeType": "YulFunctionCall", + "src": "5681:18:23" + }, + { + "hexValue": "496e76616c696420736967", + "kind": "string", + "nativeSrc": "5701:13:23", + "nodeType": "YulLiteral", + "src": "5701:13:23", + "type": "", + "value": "Invalid sig" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "5674:6:23", + "nodeType": "YulIdentifier", + "src": "5674:6:23" + }, + "nativeSrc": "5674:41:23", + "nodeType": "YulFunctionCall", + "src": "5674:41:23" + }, + "nativeSrc": "5674:41:23", + "nodeType": "YulExpressionStatement", + "src": "5674:41:23" + }, + { + "nativeSrc": "5724:26:23", + "nodeType": "YulAssignment", + "src": "5724:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "5736:9:23", + "nodeType": "YulIdentifier", + "src": "5736:9:23" + }, + { + "kind": "number", + "nativeSrc": "5747:2:23", + "nodeType": "YulLiteral", + "src": "5747:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "5732:3:23", + "nodeType": "YulIdentifier", + "src": "5732:3:23" + }, + "nativeSrc": "5732:18:23", + "nodeType": "YulFunctionCall", + "src": "5732:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "5724:4:23", + "nodeType": "YulIdentifier", + "src": "5724:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_31734eed34fab74fa1579246aaad104a344891a284044483c0c5a792a9f83a72__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "5421:335:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "5572:9:23", + "nodeType": "YulTypedName", + "src": "5572:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "5586:4:23", + "nodeType": "YulTypedName", + "src": "5586:4:23", + "type": "" + } + ], + "src": "5421:335:23" + }, + { + "body": { + "nativeSrc": "5935:178:23", + "nodeType": "YulBlock", + "src": "5935:178:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "5952:9:23", + "nodeType": "YulIdentifier", + "src": "5952:9:23" + }, + { + "kind": "number", + "nativeSrc": "5963:2:23", + "nodeType": "YulLiteral", + "src": "5963:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "5945:6:23", + "nodeType": "YulIdentifier", + "src": "5945:6:23" + }, + "nativeSrc": "5945:21:23", + "nodeType": "YulFunctionCall", + "src": "5945:21:23" + }, + "nativeSrc": "5945:21:23", + "nodeType": "YulExpressionStatement", + "src": "5945:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "5986:9:23", + "nodeType": "YulIdentifier", + "src": "5986:9:23" + }, + { + "kind": "number", + "nativeSrc": "5997:2:23", + "nodeType": "YulLiteral", + "src": "5997:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "5982:3:23", + "nodeType": "YulIdentifier", + "src": "5982:3:23" + }, + "nativeSrc": "5982:18:23", + "nodeType": "YulFunctionCall", + "src": "5982:18:23" + }, + { + "kind": "number", + "nativeSrc": "6002:2:23", + "nodeType": "YulLiteral", + "src": "6002:2:23", + "type": "", + "value": "28" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "5975:6:23", + "nodeType": "YulIdentifier", + "src": "5975:6:23" + }, + "nativeSrc": "5975:30:23", + "nodeType": "YulFunctionCall", + "src": "5975:30:23" + }, + "nativeSrc": "5975:30:23", + "nodeType": "YulExpressionStatement", + "src": "5975:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "6025:9:23", + "nodeType": "YulIdentifier", + "src": "6025:9:23" + }, + { + "kind": "number", + "nativeSrc": "6036:2:23", + "nodeType": "YulLiteral", + "src": "6036:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6021:3:23", + "nodeType": "YulIdentifier", + "src": "6021:3:23" + }, + "nativeSrc": "6021:18:23", + "nodeType": "YulFunctionCall", + "src": "6021:18:23" + }, + { + "hexValue": "496e636f7272656374204554482076616c75652070726f7669646564", + "kind": "string", + "nativeSrc": "6041:30:23", + "nodeType": "YulLiteral", + "src": "6041:30:23", + "type": "", + "value": "Incorrect ETH value provided" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6014:6:23", + "nodeType": "YulIdentifier", + "src": "6014:6:23" + }, + "nativeSrc": "6014:58:23", + "nodeType": "YulFunctionCall", + "src": "6014:58:23" + }, + "nativeSrc": "6014:58:23", + "nodeType": "YulExpressionStatement", + "src": "6014:58:23" + }, + { + "nativeSrc": "6081:26:23", + "nodeType": "YulAssignment", + "src": "6081:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "6093:9:23", + "nodeType": "YulIdentifier", + "src": "6093:9:23" + }, + { + "kind": "number", + "nativeSrc": "6104:2:23", + "nodeType": "YulLiteral", + "src": "6104:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6089:3:23", + "nodeType": "YulIdentifier", + "src": "6089:3:23" + }, + "nativeSrc": "6089:18:23", + "nodeType": "YulFunctionCall", + "src": "6089:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "6081:4:23", + "nodeType": "YulIdentifier", + "src": "6081:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_a793dc5bde52ab2d5349f1208a34905b1d68ab9298f549a2e514542cba0a8c76__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "5761:352:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "5912:9:23", + "nodeType": "YulTypedName", + "src": "5912:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "5926:4:23", + "nodeType": "YulTypedName", + "src": "5926:4:23", + "type": "" + } + ], + "src": "5761:352:23" + }, + { + "body": { + "nativeSrc": "6292:161:23", + "nodeType": "YulBlock", + "src": "6292:161:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "6309:9:23", + "nodeType": "YulIdentifier", + "src": "6309:9:23" + }, + { + "kind": "number", + "nativeSrc": "6320:2:23", + "nodeType": "YulLiteral", + "src": "6320:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6302:6:23", + "nodeType": "YulIdentifier", + "src": "6302:6:23" + }, + "nativeSrc": "6302:21:23", + "nodeType": "YulFunctionCall", + "src": "6302:21:23" + }, + "nativeSrc": "6302:21:23", + "nodeType": "YulExpressionStatement", + "src": "6302:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "6343:9:23", + "nodeType": "YulIdentifier", + "src": "6343:9:23" + }, + { + "kind": "number", + "nativeSrc": "6354:2:23", + "nodeType": "YulLiteral", + "src": "6354:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6339:3:23", + "nodeType": "YulIdentifier", + "src": "6339:3:23" + }, + "nativeSrc": "6339:18:23", + "nodeType": "YulFunctionCall", + "src": "6339:18:23" + }, + { + "kind": "number", + "nativeSrc": "6359:2:23", + "nodeType": "YulLiteral", + "src": "6359:2:23", + "type": "", + "value": "11" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6332:6:23", + "nodeType": "YulIdentifier", + "src": "6332:6:23" + }, + "nativeSrc": "6332:30:23", + "nodeType": "YulFunctionCall", + "src": "6332:30:23" + }, + "nativeSrc": "6332:30:23", + "nodeType": "YulExpressionStatement", + "src": "6332:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "6382:9:23", + "nodeType": "YulIdentifier", + "src": "6382:9:23" + }, + { + "kind": "number", + "nativeSrc": "6393:2:23", + "nodeType": "YulLiteral", + "src": "6393:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6378:3:23", + "nodeType": "YulIdentifier", + "src": "6378:3:23" + }, + "nativeSrc": "6378:18:23", + "nodeType": "YulFunctionCall", + "src": "6378:18:23" + }, + { + "hexValue": "43616c6c206661696c6564", + "kind": "string", + "nativeSrc": "6398:13:23", + "nodeType": "YulLiteral", + "src": "6398:13:23", + "type": "", + "value": "Call failed" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6371:6:23", + "nodeType": "YulIdentifier", + "src": "6371:6:23" + }, + "nativeSrc": "6371:41:23", + "nodeType": "YulFunctionCall", + "src": "6371:41:23" + }, + "nativeSrc": "6371:41:23", + "nodeType": "YulExpressionStatement", + "src": "6371:41:23" + }, + { + "nativeSrc": "6421:26:23", + "nodeType": "YulAssignment", + "src": "6421:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "6433:9:23", + "nodeType": "YulIdentifier", + "src": "6433:9:23" + }, + { + "kind": "number", + "nativeSrc": "6444:2:23", + "nodeType": "YulLiteral", + "src": "6444:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6429:3:23", + "nodeType": "YulIdentifier", + "src": "6429:3:23" + }, + "nativeSrc": "6429:18:23", + "nodeType": "YulFunctionCall", + "src": "6429:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "6421:4:23", + "nodeType": "YulIdentifier", + "src": "6421:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_066ad49a0ed9e5d6a9f3c20fca13a038f0a5d629f0aaf09d634ae2a7c232ac2b__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "6118:335:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "6269:9:23", + "nodeType": "YulTypedName", + "src": "6269:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "6283:4:23", + "nodeType": "YulTypedName", + "src": "6283:4:23", + "type": "" + } + ], + "src": "6118:335:23" + }, + { + "body": { + "nativeSrc": "6559:76:23", + "nodeType": "YulBlock", + "src": "6559:76:23", + "statements": [ + { + "nativeSrc": "6569:26:23", + "nodeType": "YulAssignment", + "src": "6569:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "6581:9:23", + "nodeType": "YulIdentifier", + "src": "6581:9:23" + }, + { + "kind": "number", + "nativeSrc": "6592:2:23", + "nodeType": "YulLiteral", + "src": "6592:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6577:3:23", + "nodeType": "YulIdentifier", + "src": "6577:3:23" + }, + "nativeSrc": "6577:18:23", + "nodeType": "YulFunctionCall", + "src": "6577:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "6569:4:23", + "nodeType": "YulIdentifier", + "src": "6569:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "6611:9:23", + "nodeType": "YulIdentifier", + "src": "6611:9:23" + }, + { + "name": "value0", + "nativeSrc": "6622:6:23", + "nodeType": "YulIdentifier", + "src": "6622:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6604:6:23", + "nodeType": "YulIdentifier", + "src": "6604:6:23" + }, + "nativeSrc": "6604:25:23", + "nodeType": "YulFunctionCall", + "src": "6604:25:23" + }, + "nativeSrc": "6604:25:23", + "nodeType": "YulExpressionStatement", + "src": "6604:25:23" + } + ] + }, + "name": "abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed", + "nativeSrc": "6458:177:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "6528:9:23", + "nodeType": "YulTypedName", + "src": "6528:9:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "6539:6:23", + "nodeType": "YulTypedName", + "src": "6539:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "6550:4:23", + "nodeType": "YulTypedName", + "src": "6550:4:23", + "type": "" + } + ], + "src": "6458:177:23" + }, + { + "body": { + "nativeSrc": "6672:95:23", + "nodeType": "YulBlock", + "src": "6672:95:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "6689:1:23", + "nodeType": "YulLiteral", + "src": "6689:1:23", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "6696:3:23", + "nodeType": "YulLiteral", + "src": "6696:3:23", + "type": "", + "value": "224" + }, + { + "kind": "number", + "nativeSrc": "6701:10:23", + "nodeType": "YulLiteral", + "src": "6701:10:23", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "6692:3:23", + "nodeType": "YulIdentifier", + "src": "6692:3:23" + }, + "nativeSrc": "6692:20:23", + "nodeType": "YulFunctionCall", + "src": "6692:20:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6682:6:23", + "nodeType": "YulIdentifier", + "src": "6682:6:23" + }, + "nativeSrc": "6682:31:23", + "nodeType": "YulFunctionCall", + "src": "6682:31:23" + }, + "nativeSrc": "6682:31:23", + "nodeType": "YulExpressionStatement", + "src": "6682:31:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "6729:1:23", + "nodeType": "YulLiteral", + "src": "6729:1:23", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nativeSrc": "6732:4:23", + "nodeType": "YulLiteral", + "src": "6732:4:23", + "type": "", + "value": "0x41" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6722:6:23", + "nodeType": "YulIdentifier", + "src": "6722:6:23" + }, + "nativeSrc": "6722:15:23", + "nodeType": "YulFunctionCall", + "src": "6722:15:23" + }, + "nativeSrc": "6722:15:23", + "nodeType": "YulExpressionStatement", + "src": "6722:15:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "6753:1:23", + "nodeType": "YulLiteral", + "src": "6753:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "6756:4:23", + "nodeType": "YulLiteral", + "src": "6756:4:23", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "6746:6:23", + "nodeType": "YulIdentifier", + "src": "6746:6:23" + }, + "nativeSrc": "6746:15:23", + "nodeType": "YulFunctionCall", + "src": "6746:15:23" + }, + "nativeSrc": "6746:15:23", + "nodeType": "YulExpressionStatement", + "src": "6746:15:23" + } + ] + }, + "name": "panic_error_0x41", + "nativeSrc": "6640:127:23", + "nodeType": "YulFunctionDefinition", + "src": "6640:127:23" + }, + { + "body": { + "nativeSrc": "6963:14:23", + "nodeType": "YulBlock", + "src": "6963:14:23", + "statements": [ + { + "nativeSrc": "6965:10:23", + "nodeType": "YulAssignment", + "src": "6965:10:23", + "value": { + "name": "pos", + "nativeSrc": "6972:3:23", + "nodeType": "YulIdentifier", + "src": "6972:3:23" + }, + "variableNames": [ + { + "name": "end", + "nativeSrc": "6965:3:23", + "nodeType": "YulIdentifier", + "src": "6965:3:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_packed_t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470__to_t_bytes_memory_ptr__nonPadded_inplace_fromStack_reversed", + "nativeSrc": "6772:205:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "pos", + "nativeSrc": "6947:3:23", + "nodeType": "YulTypedName", + "src": "6947:3:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nativeSrc": "6955:3:23", + "nodeType": "YulTypedName", + "src": "6955:3:23", + "type": "" + } + ], + "src": "6772:205:23" + }, + { + "body": { + "nativeSrc": "7156:169:23", + "nodeType": "YulBlock", + "src": "7156:169:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7173:9:23", + "nodeType": "YulIdentifier", + "src": "7173:9:23" + }, + { + "kind": "number", + "nativeSrc": "7184:2:23", + "nodeType": "YulLiteral", + "src": "7184:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7166:6:23", + "nodeType": "YulIdentifier", + "src": "7166:6:23" + }, + "nativeSrc": "7166:21:23", + "nodeType": "YulFunctionCall", + "src": "7166:21:23" + }, + "nativeSrc": "7166:21:23", + "nodeType": "YulExpressionStatement", + "src": "7166:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7207:9:23", + "nodeType": "YulIdentifier", + "src": "7207:9:23" + }, + { + "kind": "number", + "nativeSrc": "7218:2:23", + "nodeType": "YulLiteral", + "src": "7218:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7203:3:23", + "nodeType": "YulIdentifier", + "src": "7203:3:23" + }, + "nativeSrc": "7203:18:23", + "nodeType": "YulFunctionCall", + "src": "7203:18:23" + }, + { + "kind": "number", + "nativeSrc": "7223:2:23", + "nodeType": "YulLiteral", + "src": "7223:2:23", + "type": "", + "value": "19" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7196:6:23", + "nodeType": "YulIdentifier", + "src": "7196:6:23" + }, + "nativeSrc": "7196:30:23", + "nodeType": "YulFunctionCall", + "src": "7196:30:23" + }, + "nativeSrc": "7196:30:23", + "nodeType": "YulExpressionStatement", + "src": "7196:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7246:9:23", + "nodeType": "YulIdentifier", + "src": "7246:9:23" + }, + { + "kind": "number", + "nativeSrc": "7257:2:23", + "nodeType": "YulLiteral", + "src": "7257:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7242:3:23", + "nodeType": "YulIdentifier", + "src": "7242:3:23" + }, + "nativeSrc": "7242:18:23", + "nodeType": "YulFunctionCall", + "src": "7242:18:23" + }, + { + "hexValue": "455448207472616e73666572206661696c6564", + "kind": "string", + "nativeSrc": "7262:21:23", + "nodeType": "YulLiteral", + "src": "7262:21:23", + "type": "", + "value": "ETH transfer failed" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7235:6:23", + "nodeType": "YulIdentifier", + "src": "7235:6:23" + }, + "nativeSrc": "7235:49:23", + "nodeType": "YulFunctionCall", + "src": "7235:49:23" + }, + "nativeSrc": "7235:49:23", + "nodeType": "YulExpressionStatement", + "src": "7235:49:23" + }, + { + "nativeSrc": "7293:26:23", + "nodeType": "YulAssignment", + "src": "7293:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7305:9:23", + "nodeType": "YulIdentifier", + "src": "7305:9:23" + }, + { + "kind": "number", + "nativeSrc": "7316:2:23", + "nodeType": "YulLiteral", + "src": "7316:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7301:3:23", + "nodeType": "YulIdentifier", + "src": "7301:3:23" + }, + "nativeSrc": "7301:18:23", + "nodeType": "YulFunctionCall", + "src": "7301:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "7293:4:23", + "nodeType": "YulIdentifier", + "src": "7293:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_c7c2be2f1b63a3793f6e2d447ce95ba2239687186a7fd6b5268a969dcdb42dcd__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "6982:343:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "7133:9:23", + "nodeType": "YulTypedName", + "src": "7133:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "7147:4:23", + "nodeType": "YulTypedName", + "src": "7147:4:23", + "type": "" + } + ], + "src": "6982:343:23" + }, + { + "body": { + "nativeSrc": "7655:504:23", + "nodeType": "YulBlock", + "src": "7655:504:23", + "statements": [ + { + "nativeSrc": "7665:27:23", + "nodeType": "YulAssignment", + "src": "7665:27:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7677:9:23", + "nodeType": "YulIdentifier", + "src": "7677:9:23" + }, + { + "kind": "number", + "nativeSrc": "7688:3:23", + "nodeType": "YulLiteral", + "src": "7688:3:23", + "type": "", + "value": "288" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7673:3:23", + "nodeType": "YulIdentifier", + "src": "7673:3:23" + }, + "nativeSrc": "7673:19:23", + "nodeType": "YulFunctionCall", + "src": "7673:19:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "7665:4:23", + "nodeType": "YulIdentifier", + "src": "7665:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7708:9:23", + "nodeType": "YulIdentifier", + "src": "7708:9:23" + }, + { + "name": "value0", + "nativeSrc": "7719:6:23", + "nodeType": "YulIdentifier", + "src": "7719:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7701:6:23", + "nodeType": "YulIdentifier", + "src": "7701:6:23" + }, + "nativeSrc": "7701:25:23", + "nodeType": "YulFunctionCall", + "src": "7701:25:23" + }, + "nativeSrc": "7701:25:23", + "nodeType": "YulExpressionStatement", + "src": "7701:25:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7746:9:23", + "nodeType": "YulIdentifier", + "src": "7746:9:23" + }, + { + "kind": "number", + "nativeSrc": "7757:2:23", + "nodeType": "YulLiteral", + "src": "7757:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7742:3:23", + "nodeType": "YulIdentifier", + "src": "7742:3:23" + }, + "nativeSrc": "7742:18:23", + "nodeType": "YulFunctionCall", + "src": "7742:18:23" + }, + { + "arguments": [ + { + "name": "value1", + "nativeSrc": "7766:6:23", + "nodeType": "YulIdentifier", + "src": "7766:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "7782:3:23", + "nodeType": "YulLiteral", + "src": "7782:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "7787:1:23", + "nodeType": "YulLiteral", + "src": "7787:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "7778:3:23", + "nodeType": "YulIdentifier", + "src": "7778:3:23" + }, + "nativeSrc": "7778:11:23", + "nodeType": "YulFunctionCall", + "src": "7778:11:23" + }, + { + "kind": "number", + "nativeSrc": "7791:1:23", + "nodeType": "YulLiteral", + "src": "7791:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "7774:3:23", + "nodeType": "YulIdentifier", + "src": "7774:3:23" + }, + "nativeSrc": "7774:19:23", + "nodeType": "YulFunctionCall", + "src": "7774:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "7762:3:23", + "nodeType": "YulIdentifier", + "src": "7762:3:23" + }, + "nativeSrc": "7762:32:23", + "nodeType": "YulFunctionCall", + "src": "7762:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7735:6:23", + "nodeType": "YulIdentifier", + "src": "7735:6:23" + }, + "nativeSrc": "7735:60:23", + "nodeType": "YulFunctionCall", + "src": "7735:60:23" + }, + "nativeSrc": "7735:60:23", + "nodeType": "YulExpressionStatement", + "src": "7735:60:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7815:9:23", + "nodeType": "YulIdentifier", + "src": "7815:9:23" + }, + { + "kind": "number", + "nativeSrc": "7826:2:23", + "nodeType": "YulLiteral", + "src": "7826:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7811:3:23", + "nodeType": "YulIdentifier", + "src": "7811:3:23" + }, + "nativeSrc": "7811:18:23", + "nodeType": "YulFunctionCall", + "src": "7811:18:23" + }, + { + "arguments": [ + { + "name": "value2", + "nativeSrc": "7835:6:23", + "nodeType": "YulIdentifier", + "src": "7835:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "7851:3:23", + "nodeType": "YulLiteral", + "src": "7851:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "7856:1:23", + "nodeType": "YulLiteral", + "src": "7856:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "7847:3:23", + "nodeType": "YulIdentifier", + "src": "7847:3:23" + }, + "nativeSrc": "7847:11:23", + "nodeType": "YulFunctionCall", + "src": "7847:11:23" + }, + { + "kind": "number", + "nativeSrc": "7860:1:23", + "nodeType": "YulLiteral", + "src": "7860:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "7843:3:23", + "nodeType": "YulIdentifier", + "src": "7843:3:23" + }, + "nativeSrc": "7843:19:23", + "nodeType": "YulFunctionCall", + "src": "7843:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "7831:3:23", + "nodeType": "YulIdentifier", + "src": "7831:3:23" + }, + "nativeSrc": "7831:32:23", + "nodeType": "YulFunctionCall", + "src": "7831:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7804:6:23", + "nodeType": "YulIdentifier", + "src": "7804:6:23" + }, + "nativeSrc": "7804:60:23", + "nodeType": "YulFunctionCall", + "src": "7804:60:23" + }, + "nativeSrc": "7804:60:23", + "nodeType": "YulExpressionStatement", + "src": "7804:60:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7884:9:23", + "nodeType": "YulIdentifier", + "src": "7884:9:23" + }, + { + "kind": "number", + "nativeSrc": "7895:2:23", + "nodeType": "YulLiteral", + "src": "7895:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7880:3:23", + "nodeType": "YulIdentifier", + "src": "7880:3:23" + }, + "nativeSrc": "7880:18:23", + "nodeType": "YulFunctionCall", + "src": "7880:18:23" + }, + { + "arguments": [ + { + "name": "value3", + "nativeSrc": "7904:6:23", + "nodeType": "YulIdentifier", + "src": "7904:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "7920:3:23", + "nodeType": "YulLiteral", + "src": "7920:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "7925:1:23", + "nodeType": "YulLiteral", + "src": "7925:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "7916:3:23", + "nodeType": "YulIdentifier", + "src": "7916:3:23" + }, + "nativeSrc": "7916:11:23", + "nodeType": "YulFunctionCall", + "src": "7916:11:23" + }, + { + "kind": "number", + "nativeSrc": "7929:1:23", + "nodeType": "YulLiteral", + "src": "7929:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "7912:3:23", + "nodeType": "YulIdentifier", + "src": "7912:3:23" + }, + "nativeSrc": "7912:19:23", + "nodeType": "YulFunctionCall", + "src": "7912:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "7900:3:23", + "nodeType": "YulIdentifier", + "src": "7900:3:23" + }, + "nativeSrc": "7900:32:23", + "nodeType": "YulFunctionCall", + "src": "7900:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7873:6:23", + "nodeType": "YulIdentifier", + "src": "7873:6:23" + }, + "nativeSrc": "7873:60:23", + "nodeType": "YulFunctionCall", + "src": "7873:60:23" + }, + "nativeSrc": "7873:60:23", + "nodeType": "YulExpressionStatement", + "src": "7873:60:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7953:9:23", + "nodeType": "YulIdentifier", + "src": "7953:9:23" + }, + { + "kind": "number", + "nativeSrc": "7964:3:23", + "nodeType": "YulLiteral", + "src": "7964:3:23", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7949:3:23", + "nodeType": "YulIdentifier", + "src": "7949:3:23" + }, + "nativeSrc": "7949:19:23", + "nodeType": "YulFunctionCall", + "src": "7949:19:23" + }, + { + "name": "value4", + "nativeSrc": "7970:6:23", + "nodeType": "YulIdentifier", + "src": "7970:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7942:6:23", + "nodeType": "YulIdentifier", + "src": "7942:6:23" + }, + "nativeSrc": "7942:35:23", + "nodeType": "YulFunctionCall", + "src": "7942:35:23" + }, + "nativeSrc": "7942:35:23", + "nodeType": "YulExpressionStatement", + "src": "7942:35:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7997:9:23", + "nodeType": "YulIdentifier", + "src": "7997:9:23" + }, + { + "kind": "number", + "nativeSrc": "8008:3:23", + "nodeType": "YulLiteral", + "src": "8008:3:23", + "type": "", + "value": "160" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7993:3:23", + "nodeType": "YulIdentifier", + "src": "7993:3:23" + }, + "nativeSrc": "7993:19:23", + "nodeType": "YulFunctionCall", + "src": "7993:19:23" + }, + { + "name": "value5", + "nativeSrc": "8014:6:23", + "nodeType": "YulIdentifier", + "src": "8014:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7986:6:23", + "nodeType": "YulIdentifier", + "src": "7986:6:23" + }, + "nativeSrc": "7986:35:23", + "nodeType": "YulFunctionCall", + "src": "7986:35:23" + }, + "nativeSrc": "7986:35:23", + "nodeType": "YulExpressionStatement", + "src": "7986:35:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8041:9:23", + "nodeType": "YulIdentifier", + "src": "8041:9:23" + }, + { + "kind": "number", + "nativeSrc": "8052:3:23", + "nodeType": "YulLiteral", + "src": "8052:3:23", + "type": "", + "value": "192" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8037:3:23", + "nodeType": "YulIdentifier", + "src": "8037:3:23" + }, + "nativeSrc": "8037:19:23", + "nodeType": "YulFunctionCall", + "src": "8037:19:23" + }, + { + "name": "value6", + "nativeSrc": "8058:6:23", + "nodeType": "YulIdentifier", + "src": "8058:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8030:6:23", + "nodeType": "YulIdentifier", + "src": "8030:6:23" + }, + "nativeSrc": "8030:35:23", + "nodeType": "YulFunctionCall", + "src": "8030:35:23" + }, + "nativeSrc": "8030:35:23", + "nodeType": "YulExpressionStatement", + "src": "8030:35:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8085:9:23", + "nodeType": "YulIdentifier", + "src": "8085:9:23" + }, + { + "kind": "number", + "nativeSrc": "8096:3:23", + "nodeType": "YulLiteral", + "src": "8096:3:23", + "type": "", + "value": "224" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8081:3:23", + "nodeType": "YulIdentifier", + "src": "8081:3:23" + }, + "nativeSrc": "8081:19:23", + "nodeType": "YulFunctionCall", + "src": "8081:19:23" + }, + { + "name": "value7", + "nativeSrc": "8102:6:23", + "nodeType": "YulIdentifier", + "src": "8102:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8074:6:23", + "nodeType": "YulIdentifier", + "src": "8074:6:23" + }, + "nativeSrc": "8074:35:23", + "nodeType": "YulFunctionCall", + "src": "8074:35:23" + }, + "nativeSrc": "8074:35:23", + "nodeType": "YulExpressionStatement", + "src": "8074:35:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8129:9:23", + "nodeType": "YulIdentifier", + "src": "8129:9:23" + }, + { + "kind": "number", + "nativeSrc": "8140:3:23", + "nodeType": "YulLiteral", + "src": "8140:3:23", + "type": "", + "value": "256" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8125:3:23", + "nodeType": "YulIdentifier", + "src": "8125:3:23" + }, + "nativeSrc": "8125:19:23", + "nodeType": "YulFunctionCall", + "src": "8125:19:23" + }, + { + "name": "value8", + "nativeSrc": "8146:6:23", + "nodeType": "YulIdentifier", + "src": "8146:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8118:6:23", + "nodeType": "YulIdentifier", + "src": "8118:6:23" + }, + "nativeSrc": "8118:35:23", + "nodeType": "YulFunctionCall", + "src": "8118:35:23" + }, + "nativeSrc": "8118:35:23", + "nodeType": "YulExpressionStatement", + "src": "8118:35:23" + } + ] + }, + "name": "abi_encode_tuple_t_bytes32_t_address_t_address_t_address_t_uint256_t_bytes32_t_uint256_t_uint256_t_uint256__to_t_bytes32_t_address_t_address_t_address_t_uint256_t_bytes32_t_uint256_t_uint256_t_uint256__fromStack_reversed", + "nativeSrc": "7330:829:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "7560:9:23", + "nodeType": "YulTypedName", + "src": "7560:9:23", + "type": "" + }, + { + "name": "value8", + "nativeSrc": "7571:6:23", + "nodeType": "YulTypedName", + "src": "7571:6:23", + "type": "" + }, + { + "name": "value7", + "nativeSrc": "7579:6:23", + "nodeType": "YulTypedName", + "src": "7579:6:23", + "type": "" + }, + { + "name": "value6", + "nativeSrc": "7587:6:23", + "nodeType": "YulTypedName", + "src": "7587:6:23", + "type": "" + }, + { + "name": "value5", + "nativeSrc": "7595:6:23", + "nodeType": "YulTypedName", + "src": "7595:6:23", + "type": "" + }, + { + "name": "value4", + "nativeSrc": "7603:6:23", + "nodeType": "YulTypedName", + "src": "7603:6:23", + "type": "" + }, + { + "name": "value3", + "nativeSrc": "7611:6:23", + "nodeType": "YulTypedName", + "src": "7611:6:23", + "type": "" + }, + { + "name": "value2", + "nativeSrc": "7619:6:23", + "nodeType": "YulTypedName", + "src": "7619:6:23", + "type": "" + }, + { + "name": "value1", + "nativeSrc": "7627:6:23", + "nodeType": "YulTypedName", + "src": "7627:6:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "7635:6:23", + "nodeType": "YulTypedName", + "src": "7635:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "7646:4:23", + "nodeType": "YulTypedName", + "src": "7646:4:23", + "type": "" + } + ], + "src": "7330:829:23" + }, + { + "body": { + "nativeSrc": "8429:401:23", + "nodeType": "YulBlock", + "src": "8429:401:23", + "statements": [ + { + "nativeSrc": "8439:27:23", + "nodeType": "YulAssignment", + "src": "8439:27:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8451:9:23", + "nodeType": "YulIdentifier", + "src": "8451:9:23" + }, + { + "kind": "number", + "nativeSrc": "8462:3:23", + "nodeType": "YulLiteral", + "src": "8462:3:23", + "type": "", + "value": "224" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8447:3:23", + "nodeType": "YulIdentifier", + "src": "8447:3:23" + }, + "nativeSrc": "8447:19:23", + "nodeType": "YulFunctionCall", + "src": "8447:19:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "8439:4:23", + "nodeType": "YulIdentifier", + "src": "8439:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8482:9:23", + "nodeType": "YulIdentifier", + "src": "8482:9:23" + }, + { + "arguments": [ + { + "name": "value0", + "nativeSrc": "8497:6:23", + "nodeType": "YulIdentifier", + "src": "8497:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "8513:3:23", + "nodeType": "YulLiteral", + "src": "8513:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "8518:1:23", + "nodeType": "YulLiteral", + "src": "8518:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "8509:3:23", + "nodeType": "YulIdentifier", + "src": "8509:3:23" + }, + "nativeSrc": "8509:11:23", + "nodeType": "YulFunctionCall", + "src": "8509:11:23" + }, + { + "kind": "number", + "nativeSrc": "8522:1:23", + "nodeType": "YulLiteral", + "src": "8522:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "8505:3:23", + "nodeType": "YulIdentifier", + "src": "8505:3:23" + }, + "nativeSrc": "8505:19:23", + "nodeType": "YulFunctionCall", + "src": "8505:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "8493:3:23", + "nodeType": "YulIdentifier", + "src": "8493:3:23" + }, + "nativeSrc": "8493:32:23", + "nodeType": "YulFunctionCall", + "src": "8493:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8475:6:23", + "nodeType": "YulIdentifier", + "src": "8475:6:23" + }, + "nativeSrc": "8475:51:23", + "nodeType": "YulFunctionCall", + "src": "8475:51:23" + }, + "nativeSrc": "8475:51:23", + "nodeType": "YulExpressionStatement", + "src": "8475:51:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8546:9:23", + "nodeType": "YulIdentifier", + "src": "8546:9:23" + }, + { + "kind": "number", + "nativeSrc": "8557:2:23", + "nodeType": "YulLiteral", + "src": "8557:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8542:3:23", + "nodeType": "YulIdentifier", + "src": "8542:3:23" + }, + "nativeSrc": "8542:18:23", + "nodeType": "YulFunctionCall", + "src": "8542:18:23" + }, + { + "arguments": [ + { + "name": "value1", + "nativeSrc": "8566:6:23", + "nodeType": "YulIdentifier", + "src": "8566:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "8582:3:23", + "nodeType": "YulLiteral", + "src": "8582:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "8587:1:23", + "nodeType": "YulLiteral", + "src": "8587:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "8578:3:23", + "nodeType": "YulIdentifier", + "src": "8578:3:23" + }, + "nativeSrc": "8578:11:23", + "nodeType": "YulFunctionCall", + "src": "8578:11:23" + }, + { + "kind": "number", + "nativeSrc": "8591:1:23", + "nodeType": "YulLiteral", + "src": "8591:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "8574:3:23", + "nodeType": "YulIdentifier", + "src": "8574:3:23" + }, + "nativeSrc": "8574:19:23", + "nodeType": "YulFunctionCall", + "src": "8574:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "8562:3:23", + "nodeType": "YulIdentifier", + "src": "8562:3:23" + }, + "nativeSrc": "8562:32:23", + "nodeType": "YulFunctionCall", + "src": "8562:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8535:6:23", + "nodeType": "YulIdentifier", + "src": "8535:6:23" + }, + "nativeSrc": "8535:60:23", + "nodeType": "YulFunctionCall", + "src": "8535:60:23" + }, + "nativeSrc": "8535:60:23", + "nodeType": "YulExpressionStatement", + "src": "8535:60:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8615:9:23", + "nodeType": "YulIdentifier", + "src": "8615:9:23" + }, + { + "kind": "number", + "nativeSrc": "8626:2:23", + "nodeType": "YulLiteral", + "src": "8626:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8611:3:23", + "nodeType": "YulIdentifier", + "src": "8611:3:23" + }, + "nativeSrc": "8611:18:23", + "nodeType": "YulFunctionCall", + "src": "8611:18:23" + }, + { + "name": "value2", + "nativeSrc": "8631:6:23", + "nodeType": "YulIdentifier", + "src": "8631:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8604:6:23", + "nodeType": "YulIdentifier", + "src": "8604:6:23" + }, + "nativeSrc": "8604:34:23", + "nodeType": "YulFunctionCall", + "src": "8604:34:23" + }, + "nativeSrc": "8604:34:23", + "nodeType": "YulExpressionStatement", + "src": "8604:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8658:9:23", + "nodeType": "YulIdentifier", + "src": "8658:9:23" + }, + { + "kind": "number", + "nativeSrc": "8669:2:23", + "nodeType": "YulLiteral", + "src": "8669:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8654:3:23", + "nodeType": "YulIdentifier", + "src": "8654:3:23" + }, + "nativeSrc": "8654:18:23", + "nodeType": "YulFunctionCall", + "src": "8654:18:23" + }, + { + "name": "value3", + "nativeSrc": "8674:6:23", + "nodeType": "YulIdentifier", + "src": "8674:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8647:6:23", + "nodeType": "YulIdentifier", + "src": "8647:6:23" + }, + "nativeSrc": "8647:34:23", + "nodeType": "YulFunctionCall", + "src": "8647:34:23" + }, + "nativeSrc": "8647:34:23", + "nodeType": "YulExpressionStatement", + "src": "8647:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8701:9:23", + "nodeType": "YulIdentifier", + "src": "8701:9:23" + }, + { + "kind": "number", + "nativeSrc": "8712:3:23", + "nodeType": "YulLiteral", + "src": "8712:3:23", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8697:3:23", + "nodeType": "YulIdentifier", + "src": "8697:3:23" + }, + "nativeSrc": "8697:19:23", + "nodeType": "YulFunctionCall", + "src": "8697:19:23" + }, + { + "arguments": [ + { + "name": "value4", + "nativeSrc": "8722:6:23", + "nodeType": "YulIdentifier", + "src": "8722:6:23" + }, + { + "kind": "number", + "nativeSrc": "8730:4:23", + "nodeType": "YulLiteral", + "src": "8730:4:23", + "type": "", + "value": "0xff" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "8718:3:23", + "nodeType": "YulIdentifier", + "src": "8718:3:23" + }, + "nativeSrc": "8718:17:23", + "nodeType": "YulFunctionCall", + "src": "8718:17:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8690:6:23", + "nodeType": "YulIdentifier", + "src": "8690:6:23" + }, + "nativeSrc": "8690:46:23", + "nodeType": "YulFunctionCall", + "src": "8690:46:23" + }, + "nativeSrc": "8690:46:23", + "nodeType": "YulExpressionStatement", + "src": "8690:46:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8756:9:23", + "nodeType": "YulIdentifier", + "src": "8756:9:23" + }, + { + "kind": "number", + "nativeSrc": "8767:3:23", + "nodeType": "YulLiteral", + "src": "8767:3:23", + "type": "", + "value": "160" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8752:3:23", + "nodeType": "YulIdentifier", + "src": "8752:3:23" + }, + "nativeSrc": "8752:19:23", + "nodeType": "YulFunctionCall", + "src": "8752:19:23" + }, + { + "name": "value5", + "nativeSrc": "8773:6:23", + "nodeType": "YulIdentifier", + "src": "8773:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8745:6:23", + "nodeType": "YulIdentifier", + "src": "8745:6:23" + }, + "nativeSrc": "8745:35:23", + "nodeType": "YulFunctionCall", + "src": "8745:35:23" + }, + "nativeSrc": "8745:35:23", + "nodeType": "YulExpressionStatement", + "src": "8745:35:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8800:9:23", + "nodeType": "YulIdentifier", + "src": "8800:9:23" + }, + { + "kind": "number", + "nativeSrc": "8811:3:23", + "nodeType": "YulLiteral", + "src": "8811:3:23", + "type": "", + "value": "192" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8796:3:23", + "nodeType": "YulIdentifier", + "src": "8796:3:23" + }, + "nativeSrc": "8796:19:23", + "nodeType": "YulFunctionCall", + "src": "8796:19:23" + }, + { + "name": "value6", + "nativeSrc": "8817:6:23", + "nodeType": "YulIdentifier", + "src": "8817:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8789:6:23", + "nodeType": "YulIdentifier", + "src": "8789:6:23" + }, + "nativeSrc": "8789:35:23", + "nodeType": "YulFunctionCall", + "src": "8789:35:23" + }, + "nativeSrc": "8789:35:23", + "nodeType": "YulExpressionStatement", + "src": "8789:35:23" + } + ] + }, + "name": "abi_encode_tuple_t_address_t_address_t_uint256_t_uint256_t_uint8_t_bytes32_t_bytes32__to_t_address_t_address_t_uint256_t_uint256_t_uint8_t_bytes32_t_bytes32__fromStack_reversed", + "nativeSrc": "8164:666:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "8350:9:23", + "nodeType": "YulTypedName", + "src": "8350:9:23", + "type": "" + }, + { + "name": "value6", + "nativeSrc": "8361:6:23", + "nodeType": "YulTypedName", + "src": "8361:6:23", + "type": "" + }, + { + "name": "value5", + "nativeSrc": "8369:6:23", + "nodeType": "YulTypedName", + "src": "8369:6:23", + "type": "" + }, + { + "name": "value4", + "nativeSrc": "8377:6:23", + "nodeType": "YulTypedName", + "src": "8377:6:23", + "type": "" + }, + { + "name": "value3", + "nativeSrc": "8385:6:23", + "nodeType": "YulTypedName", + "src": "8385:6:23", + "type": "" + }, + { + "name": "value2", + "nativeSrc": "8393:6:23", + "nodeType": "YulTypedName", + "src": "8393:6:23", + "type": "" + }, + { + "name": "value1", + "nativeSrc": "8401:6:23", + "nodeType": "YulTypedName", + "src": "8401:6:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "8409:6:23", + "nodeType": "YulTypedName", + "src": "8409:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "8420:4:23", + "nodeType": "YulTypedName", + "src": "8420:4:23", + "type": "" + } + ], + "src": "8164:666:23" + }, + { + "body": { + "nativeSrc": "8964:171:23", + "nodeType": "YulBlock", + "src": "8964:171:23", + "statements": [ + { + "nativeSrc": "8974:26:23", + "nodeType": "YulAssignment", + "src": "8974:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8986:9:23", + "nodeType": "YulIdentifier", + "src": "8986:9:23" + }, + { + "kind": "number", + "nativeSrc": "8997:2:23", + "nodeType": "YulLiteral", + "src": "8997:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8982:3:23", + "nodeType": "YulIdentifier", + "src": "8982:3:23" + }, + "nativeSrc": "8982:18:23", + "nodeType": "YulFunctionCall", + "src": "8982:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "8974:4:23", + "nodeType": "YulIdentifier", + "src": "8974:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "9016:9:23", + "nodeType": "YulIdentifier", + "src": "9016:9:23" + }, + { + "arguments": [ + { + "name": "value0", + "nativeSrc": "9031:6:23", + "nodeType": "YulIdentifier", + "src": "9031:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9047:3:23", + "nodeType": "YulLiteral", + "src": "9047:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "9052:1:23", + "nodeType": "YulLiteral", + "src": "9052:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "9043:3:23", + "nodeType": "YulIdentifier", + "src": "9043:3:23" + }, + "nativeSrc": "9043:11:23", + "nodeType": "YulFunctionCall", + "src": "9043:11:23" + }, + { + "kind": "number", + "nativeSrc": "9056:1:23", + "nodeType": "YulLiteral", + "src": "9056:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "9039:3:23", + "nodeType": "YulIdentifier", + "src": "9039:3:23" + }, + "nativeSrc": "9039:19:23", + "nodeType": "YulFunctionCall", + "src": "9039:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "9027:3:23", + "nodeType": "YulIdentifier", + "src": "9027:3:23" + }, + "nativeSrc": "9027:32:23", + "nodeType": "YulFunctionCall", + "src": "9027:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "9009:6:23", + "nodeType": "YulIdentifier", + "src": "9009:6:23" + }, + "nativeSrc": "9009:51:23", + "nodeType": "YulFunctionCall", + "src": "9009:51:23" + }, + "nativeSrc": "9009:51:23", + "nodeType": "YulExpressionStatement", + "src": "9009:51:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "9080:9:23", + "nodeType": "YulIdentifier", + "src": "9080:9:23" + }, + { + "kind": "number", + "nativeSrc": "9091:2:23", + "nodeType": "YulLiteral", + "src": "9091:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9076:3:23", + "nodeType": "YulIdentifier", + "src": "9076:3:23" + }, + "nativeSrc": "9076:18:23", + "nodeType": "YulFunctionCall", + "src": "9076:18:23" + }, + { + "arguments": [ + { + "name": "value1", + "nativeSrc": "9100:6:23", + "nodeType": "YulIdentifier", + "src": "9100:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9116:3:23", + "nodeType": "YulLiteral", + "src": "9116:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "9121:1:23", + "nodeType": "YulLiteral", + "src": "9121:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "9112:3:23", + "nodeType": "YulIdentifier", + "src": "9112:3:23" + }, + "nativeSrc": "9112:11:23", + "nodeType": "YulFunctionCall", + "src": "9112:11:23" + }, + { + "kind": "number", + "nativeSrc": "9125:1:23", + "nodeType": "YulLiteral", + "src": "9125:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "9108:3:23", + "nodeType": "YulIdentifier", + "src": "9108:3:23" + }, + "nativeSrc": "9108:19:23", + "nodeType": "YulFunctionCall", + "src": "9108:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "9096:3:23", + "nodeType": "YulIdentifier", + "src": "9096:3:23" + }, + "nativeSrc": "9096:32:23", + "nodeType": "YulFunctionCall", + "src": "9096:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "9069:6:23", + "nodeType": "YulIdentifier", + "src": "9069:6:23" + }, + "nativeSrc": "9069:60:23", + "nodeType": "YulFunctionCall", + "src": "9069:60:23" + }, + "nativeSrc": "9069:60:23", + "nodeType": "YulExpressionStatement", + "src": "9069:60:23" + } + ] + }, + "name": "abi_encode_tuple_t_address_t_address__to_t_address_t_address__fromStack_reversed", + "nativeSrc": "8835:300:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "8925:9:23", + "nodeType": "YulTypedName", + "src": "8925:9:23", + "type": "" + }, + { + "name": "value1", + "nativeSrc": "8936:6:23", + "nodeType": "YulTypedName", + "src": "8936:6:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "8944:6:23", + "nodeType": "YulTypedName", + "src": "8944:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "8955:4:23", + "nodeType": "YulTypedName", + "src": "8955:4:23", + "type": "" + } + ], + "src": "8835:300:23" + }, + { + "body": { + "nativeSrc": "9221:103:23", + "nodeType": "YulBlock", + "src": "9221:103:23", + "statements": [ + { + "body": { + "nativeSrc": "9267:16:23", + "nodeType": "YulBlock", + "src": "9267:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9276:1:23", + "nodeType": "YulLiteral", + "src": "9276:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "9279:1:23", + "nodeType": "YulLiteral", + "src": "9279:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "9269:6:23", + "nodeType": "YulIdentifier", + "src": "9269:6:23" + }, + "nativeSrc": "9269:12:23", + "nodeType": "YulFunctionCall", + "src": "9269:12:23" + }, + "nativeSrc": "9269:12:23", + "nodeType": "YulExpressionStatement", + "src": "9269:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nativeSrc": "9242:7:23", + "nodeType": "YulIdentifier", + "src": "9242:7:23" + }, + { + "name": "headStart", + "nativeSrc": "9251:9:23", + "nodeType": "YulIdentifier", + "src": "9251:9:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "9238:3:23", + "nodeType": "YulIdentifier", + "src": "9238:3:23" + }, + "nativeSrc": "9238:23:23", + "nodeType": "YulFunctionCall", + "src": "9238:23:23" + }, + { + "kind": "number", + "nativeSrc": "9263:2:23", + "nodeType": "YulLiteral", + "src": "9263:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nativeSrc": "9234:3:23", + "nodeType": "YulIdentifier", + "src": "9234:3:23" + }, + "nativeSrc": "9234:32:23", + "nodeType": "YulFunctionCall", + "src": "9234:32:23" + }, + "nativeSrc": "9231:52:23", + "nodeType": "YulIf", + "src": "9231:52:23" + }, + { + "nativeSrc": "9292:26:23", + "nodeType": "YulAssignment", + "src": "9292:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "9308:9:23", + "nodeType": "YulIdentifier", + "src": "9308:9:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "9302:5:23", + "nodeType": "YulIdentifier", + "src": "9302:5:23" + }, + "nativeSrc": "9302:16:23", + "nodeType": "YulFunctionCall", + "src": "9302:16:23" + }, + "variableNames": [ + { + "name": "value0", + "nativeSrc": "9292:6:23", + "nodeType": "YulIdentifier", + "src": "9292:6:23" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_uint256_fromMemory", + "nativeSrc": "9140:184:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "9187:9:23", + "nodeType": "YulTypedName", + "src": "9187:9:23", + "type": "" + }, + { + "name": "dataEnd", + "nativeSrc": "9198:7:23", + "nodeType": "YulTypedName", + "src": "9198:7:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nativeSrc": "9210:6:23", + "nodeType": "YulTypedName", + "src": "9210:6:23", + "type": "" + } + ], + "src": "9140:184:23" + }, + { + "body": { + "nativeSrc": "9503:230:23", + "nodeType": "YulBlock", + "src": "9503:230:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "9520:9:23", + "nodeType": "YulIdentifier", + "src": "9520:9:23" + }, + { + "kind": "number", + "nativeSrc": "9531:2:23", + "nodeType": "YulLiteral", + "src": "9531:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "9513:6:23", + "nodeType": "YulIdentifier", + "src": "9513:6:23" + }, + "nativeSrc": "9513:21:23", + "nodeType": "YulFunctionCall", + "src": "9513:21:23" + }, + "nativeSrc": "9513:21:23", + "nodeType": "YulExpressionStatement", + "src": "9513:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "9554:9:23", + "nodeType": "YulIdentifier", + "src": "9554:9:23" + }, + { + "kind": "number", + "nativeSrc": "9565:2:23", + "nodeType": "YulLiteral", + "src": "9565:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9550:3:23", + "nodeType": "YulIdentifier", + "src": "9550:3:23" + }, + "nativeSrc": "9550:18:23", + "nodeType": "YulFunctionCall", + "src": "9550:18:23" + }, + { + "kind": "number", + "nativeSrc": "9570:2:23", + "nodeType": "YulLiteral", + "src": "9570:2:23", + "type": "", + "value": "40" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "9543:6:23", + "nodeType": "YulIdentifier", + "src": "9543:6:23" + }, + "nativeSrc": "9543:30:23", + "nodeType": "YulFunctionCall", + "src": "9543:30:23" + }, + "nativeSrc": "9543:30:23", + "nodeType": "YulExpressionStatement", + "src": "9543:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "9593:9:23", + "nodeType": "YulIdentifier", + "src": "9593:9:23" + }, + { + "kind": "number", + "nativeSrc": "9604:2:23", + "nodeType": "YulLiteral", + "src": "9604:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9589:3:23", + "nodeType": "YulIdentifier", + "src": "9589:3:23" + }, + "nativeSrc": "9589:18:23", + "nodeType": "YulFunctionCall", + "src": "9589:18:23" + }, + { + "hexValue": "5065726d6974206661696c656420616e6420696e73756666696369656e742061", + "kind": "string", + "nativeSrc": "9609:34:23", + "nodeType": "YulLiteral", + "src": "9609:34:23", + "type": "", + "value": "Permit failed and insufficient a" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "9582:6:23", + "nodeType": "YulIdentifier", + "src": "9582:6:23" + }, + "nativeSrc": "9582:62:23", + "nodeType": "YulFunctionCall", + "src": "9582:62:23" + }, + "nativeSrc": "9582:62:23", + "nodeType": "YulExpressionStatement", + "src": "9582:62:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "9664:9:23", + "nodeType": "YulIdentifier", + "src": "9664:9:23" + }, + { + "kind": "number", + "nativeSrc": "9675:2:23", + "nodeType": "YulLiteral", + "src": "9675:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9660:3:23", + "nodeType": "YulIdentifier", + "src": "9660:3:23" + }, + "nativeSrc": "9660:18:23", + "nodeType": "YulFunctionCall", + "src": "9660:18:23" + }, + { + "hexValue": "6c6c6f77616e6365", + "kind": "string", + "nativeSrc": "9680:10:23", + "nodeType": "YulLiteral", + "src": "9680:10:23", + "type": "", + "value": "llowance" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "9653:6:23", + "nodeType": "YulIdentifier", + "src": "9653:6:23" + }, + "nativeSrc": "9653:38:23", + "nodeType": "YulFunctionCall", + "src": "9653:38:23" + }, + "nativeSrc": "9653:38:23", + "nodeType": "YulExpressionStatement", + "src": "9653:38:23" + }, + { + "nativeSrc": "9700:27:23", + "nodeType": "YulAssignment", + "src": "9700:27:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "9712:9:23", + "nodeType": "YulIdentifier", + "src": "9712:9:23" + }, + { + "kind": "number", + "nativeSrc": "9723:3:23", + "nodeType": "YulLiteral", + "src": "9723:3:23", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9708:3:23", + "nodeType": "YulIdentifier", + "src": "9708:3:23" + }, + "nativeSrc": "9708:19:23", + "nodeType": "YulFunctionCall", + "src": "9708:19:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "9700:4:23", + "nodeType": "YulIdentifier", + "src": "9700:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_0acc7f0c8df1a6717d2b423ae4591ac135687015764ac37dd4cf0150a9322b15__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "9329:404:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "9480:9:23", + "nodeType": "YulTypedName", + "src": "9480:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "9494:4:23", + "nodeType": "YulTypedName", + "src": "9494:4:23", + "type": "" + } + ], + "src": "9329:404:23" + }, + { + "body": { + "nativeSrc": "9875:164:23", + "nodeType": "YulBlock", + "src": "9875:164:23", + "statements": [ + { + "nativeSrc": "9885:27:23", + "nodeType": "YulVariableDeclaration", + "src": "9885:27:23", + "value": { + "arguments": [ + { + "name": "value0", + "nativeSrc": "9905:6:23", + "nodeType": "YulIdentifier", + "src": "9905:6:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "9899:5:23", + "nodeType": "YulIdentifier", + "src": "9899:5:23" + }, + "nativeSrc": "9899:13:23", + "nodeType": "YulFunctionCall", + "src": "9899:13:23" + }, + "variables": [ + { + "name": "length", + "nativeSrc": "9889:6:23", + "nodeType": "YulTypedName", + "src": "9889:6:23", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "pos", + "nativeSrc": "9927:3:23", + "nodeType": "YulIdentifier", + "src": "9927:3:23" + }, + { + "arguments": [ + { + "name": "value0", + "nativeSrc": "9936:6:23", + "nodeType": "YulIdentifier", + "src": "9936:6:23" + }, + { + "kind": "number", + "nativeSrc": "9944:4:23", + "nodeType": "YulLiteral", + "src": "9944:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9932:3:23", + "nodeType": "YulIdentifier", + "src": "9932:3:23" + }, + "nativeSrc": "9932:17:23", + "nodeType": "YulFunctionCall", + "src": "9932:17:23" + }, + { + "name": "length", + "nativeSrc": "9951:6:23", + "nodeType": "YulIdentifier", + "src": "9951:6:23" + } + ], + "functionName": { + "name": "mcopy", + "nativeSrc": "9921:5:23", + "nodeType": "YulIdentifier", + "src": "9921:5:23" + }, + "nativeSrc": "9921:37:23", + "nodeType": "YulFunctionCall", + "src": "9921:37:23" + }, + "nativeSrc": "9921:37:23", + "nodeType": "YulExpressionStatement", + "src": "9921:37:23" + }, + { + "nativeSrc": "9967:26:23", + "nodeType": "YulVariableDeclaration", + "src": "9967:26:23", + "value": { + "arguments": [ + { + "name": "pos", + "nativeSrc": "9981:3:23", + "nodeType": "YulIdentifier", + "src": "9981:3:23" + }, + { + "name": "length", + "nativeSrc": "9986:6:23", + "nodeType": "YulIdentifier", + "src": "9986:6:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9977:3:23", + "nodeType": "YulIdentifier", + "src": "9977:3:23" + }, + "nativeSrc": "9977:16:23", + "nodeType": "YulFunctionCall", + "src": "9977:16:23" + }, + "variables": [ + { + "name": "_1", + "nativeSrc": "9971:2:23", + "nodeType": "YulTypedName", + "src": "9971:2:23", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "_1", + "nativeSrc": "10009:2:23", + "nodeType": "YulIdentifier", + "src": "10009:2:23" + }, + { + "kind": "number", + "nativeSrc": "10013:1:23", + "nodeType": "YulLiteral", + "src": "10013:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10002:6:23", + "nodeType": "YulIdentifier", + "src": "10002:6:23" + }, + "nativeSrc": "10002:13:23", + "nodeType": "YulFunctionCall", + "src": "10002:13:23" + }, + "nativeSrc": "10002:13:23", + "nodeType": "YulExpressionStatement", + "src": "10002:13:23" + }, + { + "nativeSrc": "10024:9:23", + "nodeType": "YulAssignment", + "src": "10024:9:23", + "value": { + "name": "_1", + "nativeSrc": "10031:2:23", + "nodeType": "YulIdentifier", + "src": "10031:2:23" + }, + "variableNames": [ + { + "name": "end", + "nativeSrc": "10024:3:23", + "nodeType": "YulIdentifier", + "src": "10024:3:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_packed_t_bytes_memory_ptr__to_t_bytes_memory_ptr__nonPadded_inplace_fromStack_reversed", + "nativeSrc": "9738:301:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "pos", + "nativeSrc": "9851:3:23", + "nodeType": "YulTypedName", + "src": "9851:3:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "9856:6:23", + "nodeType": "YulTypedName", + "src": "9856:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nativeSrc": "9867:3:23", + "nodeType": "YulTypedName", + "src": "9867:3:23", + "type": "" + } + ], + "src": "9738:301:23" + }, + { + "body": { + "nativeSrc": "10225:217:23", + "nodeType": "YulBlock", + "src": "10225:217:23", + "statements": [ + { + "nativeSrc": "10235:27:23", + "nodeType": "YulAssignment", + "src": "10235:27:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "10247:9:23", + "nodeType": "YulIdentifier", + "src": "10247:9:23" + }, + { + "kind": "number", + "nativeSrc": "10258:3:23", + "nodeType": "YulLiteral", + "src": "10258:3:23", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10243:3:23", + "nodeType": "YulIdentifier", + "src": "10243:3:23" + }, + "nativeSrc": "10243:19:23", + "nodeType": "YulFunctionCall", + "src": "10243:19:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "10235:4:23", + "nodeType": "YulIdentifier", + "src": "10235:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "10278:9:23", + "nodeType": "YulIdentifier", + "src": "10278:9:23" + }, + { + "name": "value0", + "nativeSrc": "10289:6:23", + "nodeType": "YulIdentifier", + "src": "10289:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10271:6:23", + "nodeType": "YulIdentifier", + "src": "10271:6:23" + }, + "nativeSrc": "10271:25:23", + "nodeType": "YulFunctionCall", + "src": "10271:25:23" + }, + "nativeSrc": "10271:25:23", + "nodeType": "YulExpressionStatement", + "src": "10271:25:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "10316:9:23", + "nodeType": "YulIdentifier", + "src": "10316:9:23" + }, + { + "kind": "number", + "nativeSrc": "10327:2:23", + "nodeType": "YulLiteral", + "src": "10327:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10312:3:23", + "nodeType": "YulIdentifier", + "src": "10312:3:23" + }, + "nativeSrc": "10312:18:23", + "nodeType": "YulFunctionCall", + "src": "10312:18:23" + }, + { + "arguments": [ + { + "name": "value1", + "nativeSrc": "10336:6:23", + "nodeType": "YulIdentifier", + "src": "10336:6:23" + }, + { + "kind": "number", + "nativeSrc": "10344:4:23", + "nodeType": "YulLiteral", + "src": "10344:4:23", + "type": "", + "value": "0xff" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "10332:3:23", + "nodeType": "YulIdentifier", + "src": "10332:3:23" + }, + "nativeSrc": "10332:17:23", + "nodeType": "YulFunctionCall", + "src": "10332:17:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10305:6:23", + "nodeType": "YulIdentifier", + "src": "10305:6:23" + }, + "nativeSrc": "10305:45:23", + "nodeType": "YulFunctionCall", + "src": "10305:45:23" + }, + "nativeSrc": "10305:45:23", + "nodeType": "YulExpressionStatement", + "src": "10305:45:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "10370:9:23", + "nodeType": "YulIdentifier", + "src": "10370:9:23" + }, + { + "kind": "number", + "nativeSrc": "10381:2:23", + "nodeType": "YulLiteral", + "src": "10381:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10366:3:23", + "nodeType": "YulIdentifier", + "src": "10366:3:23" + }, + "nativeSrc": "10366:18:23", + "nodeType": "YulFunctionCall", + "src": "10366:18:23" + }, + { + "name": "value2", + "nativeSrc": "10386:6:23", + "nodeType": "YulIdentifier", + "src": "10386:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10359:6:23", + "nodeType": "YulIdentifier", + "src": "10359:6:23" + }, + "nativeSrc": "10359:34:23", + "nodeType": "YulFunctionCall", + "src": "10359:34:23" + }, + "nativeSrc": "10359:34:23", + "nodeType": "YulExpressionStatement", + "src": "10359:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "10413:9:23", + "nodeType": "YulIdentifier", + "src": "10413:9:23" + }, + { + "kind": "number", + "nativeSrc": "10424:2:23", + "nodeType": "YulLiteral", + "src": "10424:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10409:3:23", + "nodeType": "YulIdentifier", + "src": "10409:3:23" + }, + "nativeSrc": "10409:18:23", + "nodeType": "YulFunctionCall", + "src": "10409:18:23" + }, + { + "name": "value3", + "nativeSrc": "10429:6:23", + "nodeType": "YulIdentifier", + "src": "10429:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10402:6:23", + "nodeType": "YulIdentifier", + "src": "10402:6:23" + }, + "nativeSrc": "10402:34:23", + "nodeType": "YulFunctionCall", + "src": "10402:34:23" + }, + "nativeSrc": "10402:34:23", + "nodeType": "YulExpressionStatement", + "src": "10402:34:23" + } + ] + }, + "name": "abi_encode_tuple_t_bytes32_t_uint8_t_bytes32_t_bytes32__to_t_bytes32_t_uint8_t_bytes32_t_bytes32__fromStack_reversed", + "nativeSrc": "10044:398:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "10170:9:23", + "nodeType": "YulTypedName", + "src": "10170:9:23", + "type": "" + }, + { + "name": "value3", + "nativeSrc": "10181:6:23", + "nodeType": "YulTypedName", + "src": "10181:6:23", + "type": "" + }, + { + "name": "value2", + "nativeSrc": "10189:6:23", + "nodeType": "YulTypedName", + "src": "10189:6:23", + "type": "" + }, + { + "name": "value1", + "nativeSrc": "10197:6:23", + "nodeType": "YulTypedName", + "src": "10197:6:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "10205:6:23", + "nodeType": "YulTypedName", + "src": "10205:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "10216:4:23", + "nodeType": "YulTypedName", + "src": "10216:4:23", + "type": "" + } + ], + "src": "10044:398:23" + }, + { + "body": { + "nativeSrc": "10479:95:23", + "nodeType": "YulBlock", + "src": "10479:95:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10496:1:23", + "nodeType": "YulLiteral", + "src": "10496:1:23", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10503:3:23", + "nodeType": "YulLiteral", + "src": "10503:3:23", + "type": "", + "value": "224" + }, + { + "kind": "number", + "nativeSrc": "10508:10:23", + "nodeType": "YulLiteral", + "src": "10508:10:23", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "10499:3:23", + "nodeType": "YulIdentifier", + "src": "10499:3:23" + }, + "nativeSrc": "10499:20:23", + "nodeType": "YulFunctionCall", + "src": "10499:20:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10489:6:23", + "nodeType": "YulIdentifier", + "src": "10489:6:23" + }, + "nativeSrc": "10489:31:23", + "nodeType": "YulFunctionCall", + "src": "10489:31:23" + }, + "nativeSrc": "10489:31:23", + "nodeType": "YulExpressionStatement", + "src": "10489:31:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10536:1:23", + "nodeType": "YulLiteral", + "src": "10536:1:23", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nativeSrc": "10539:4:23", + "nodeType": "YulLiteral", + "src": "10539:4:23", + "type": "", + "value": "0x21" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10529:6:23", + "nodeType": "YulIdentifier", + "src": "10529:6:23" + }, + "nativeSrc": "10529:15:23", + "nodeType": "YulFunctionCall", + "src": "10529:15:23" + }, + "nativeSrc": "10529:15:23", + "nodeType": "YulExpressionStatement", + "src": "10529:15:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10560:1:23", + "nodeType": "YulLiteral", + "src": "10560:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "10563:4:23", + "nodeType": "YulLiteral", + "src": "10563:4:23", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "10553:6:23", + "nodeType": "YulIdentifier", + "src": "10553:6:23" + }, + "nativeSrc": "10553:15:23", + "nodeType": "YulFunctionCall", + "src": "10553:15:23" + }, + "nativeSrc": "10553:15:23", + "nodeType": "YulExpressionStatement", + "src": "10553:15:23" + } + ] + }, + "name": "panic_error_0x21", + "nativeSrc": "10447:127:23", + "nodeType": "YulFunctionDefinition", + "src": "10447:127:23" + }, + { + "body": { + "nativeSrc": "10680:76:23", + "nodeType": "YulBlock", + "src": "10680:76:23", + "statements": [ + { + "nativeSrc": "10690:26:23", + "nodeType": "YulAssignment", + "src": "10690:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "10702:9:23", + "nodeType": "YulIdentifier", + "src": "10702:9:23" + }, + { + "kind": "number", + "nativeSrc": "10713:2:23", + "nodeType": "YulLiteral", + "src": "10713:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10698:3:23", + "nodeType": "YulIdentifier", + "src": "10698:3:23" + }, + "nativeSrc": "10698:18:23", + "nodeType": "YulFunctionCall", + "src": "10698:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "10690:4:23", + "nodeType": "YulIdentifier", + "src": "10690:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "10732:9:23", + "nodeType": "YulIdentifier", + "src": "10732:9:23" + }, + { + "name": "value0", + "nativeSrc": "10743:6:23", + "nodeType": "YulIdentifier", + "src": "10743:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10725:6:23", + "nodeType": "YulIdentifier", + "src": "10725:6:23" + }, + "nativeSrc": "10725:25:23", + "nodeType": "YulFunctionCall", + "src": "10725:25:23" + }, + "nativeSrc": "10725:25:23", + "nodeType": "YulExpressionStatement", + "src": "10725:25:23" + } + ] + }, + "name": "abi_encode_tuple_t_bytes32__to_t_bytes32__fromStack_reversed", + "nativeSrc": "10579:177:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "10649:9:23", + "nodeType": "YulTypedName", + "src": "10649:9:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "10660:6:23", + "nodeType": "YulTypedName", + "src": "10660:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "10671:4:23", + "nodeType": "YulTypedName", + "src": "10671:4:23", + "type": "" + } + ], + "src": "10579:177:23" + }, + { + "body": { + "nativeSrc": "10816:325:23", + "nodeType": "YulBlock", + "src": "10816:325:23", + "statements": [ + { + "nativeSrc": "10826:22:23", + "nodeType": "YulAssignment", + "src": "10826:22:23", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10840:1:23", + "nodeType": "YulLiteral", + "src": "10840:1:23", + "type": "", + "value": "1" + }, + { + "name": "data", + "nativeSrc": "10843:4:23", + "nodeType": "YulIdentifier", + "src": "10843:4:23" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "10836:3:23", + "nodeType": "YulIdentifier", + "src": "10836:3:23" + }, + "nativeSrc": "10836:12:23", + "nodeType": "YulFunctionCall", + "src": "10836:12:23" + }, + "variableNames": [ + { + "name": "length", + "nativeSrc": "10826:6:23", + "nodeType": "YulIdentifier", + "src": "10826:6:23" + } + ] + }, + { + "nativeSrc": "10857:38:23", + "nodeType": "YulVariableDeclaration", + "src": "10857:38:23", + "value": { + "arguments": [ + { + "name": "data", + "nativeSrc": "10887:4:23", + "nodeType": "YulIdentifier", + "src": "10887:4:23" + }, + { + "kind": "number", + "nativeSrc": "10893:1:23", + "nodeType": "YulLiteral", + "src": "10893:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "10883:3:23", + "nodeType": "YulIdentifier", + "src": "10883:3:23" + }, + "nativeSrc": "10883:12:23", + "nodeType": "YulFunctionCall", + "src": "10883:12:23" + }, + "variables": [ + { + "name": "outOfPlaceEncoding", + "nativeSrc": "10861:18:23", + "nodeType": "YulTypedName", + "src": "10861:18:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "10934:31:23", + "nodeType": "YulBlock", + "src": "10934:31:23", + "statements": [ + { + "nativeSrc": "10936:27:23", + "nodeType": "YulAssignment", + "src": "10936:27:23", + "value": { + "arguments": [ + { + "name": "length", + "nativeSrc": "10950:6:23", + "nodeType": "YulIdentifier", + "src": "10950:6:23" + }, + { + "kind": "number", + "nativeSrc": "10958:4:23", + "nodeType": "YulLiteral", + "src": "10958:4:23", + "type": "", + "value": "0x7f" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "10946:3:23", + "nodeType": "YulIdentifier", + "src": "10946:3:23" + }, + "nativeSrc": "10946:17:23", + "nodeType": "YulFunctionCall", + "src": "10946:17:23" + }, + "variableNames": [ + { + "name": "length", + "nativeSrc": "10936:6:23", + "nodeType": "YulIdentifier", + "src": "10936:6:23" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nativeSrc": "10914:18:23", + "nodeType": "YulIdentifier", + "src": "10914:18:23" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "10907:6:23", + "nodeType": "YulIdentifier", + "src": "10907:6:23" + }, + "nativeSrc": "10907:26:23", + "nodeType": "YulFunctionCall", + "src": "10907:26:23" + }, + "nativeSrc": "10904:61:23", + "nodeType": "YulIf", + "src": "10904:61:23" + }, + { + "body": { + "nativeSrc": "11024:111:23", + "nodeType": "YulBlock", + "src": "11024:111:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11045:1:23", + "nodeType": "YulLiteral", + "src": "11045:1:23", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11052:3:23", + "nodeType": "YulLiteral", + "src": "11052:3:23", + "type": "", + "value": "224" + }, + { + "kind": "number", + "nativeSrc": "11057:10:23", + "nodeType": "YulLiteral", + "src": "11057:10:23", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "11048:3:23", + "nodeType": "YulIdentifier", + "src": "11048:3:23" + }, + "nativeSrc": "11048:20:23", + "nodeType": "YulFunctionCall", + "src": "11048:20:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "11038:6:23", + "nodeType": "YulIdentifier", + "src": "11038:6:23" + }, + "nativeSrc": "11038:31:23", + "nodeType": "YulFunctionCall", + "src": "11038:31:23" + }, + "nativeSrc": "11038:31:23", + "nodeType": "YulExpressionStatement", + "src": "11038:31:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11089:1:23", + "nodeType": "YulLiteral", + "src": "11089:1:23", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nativeSrc": "11092:4:23", + "nodeType": "YulLiteral", + "src": "11092:4:23", + "type": "", + "value": "0x22" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "11082:6:23", + "nodeType": "YulIdentifier", + "src": "11082:6:23" + }, + "nativeSrc": "11082:15:23", + "nodeType": "YulFunctionCall", + "src": "11082:15:23" + }, + "nativeSrc": "11082:15:23", + "nodeType": "YulExpressionStatement", + "src": "11082:15:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11117:1:23", + "nodeType": "YulLiteral", + "src": "11117:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "11120:4:23", + "nodeType": "YulLiteral", + "src": "11120:4:23", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "11110:6:23", + "nodeType": "YulIdentifier", + "src": "11110:6:23" + }, + "nativeSrc": "11110:15:23", + "nodeType": "YulFunctionCall", + "src": "11110:15:23" + }, + "nativeSrc": "11110:15:23", + "nodeType": "YulExpressionStatement", + "src": "11110:15:23" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nativeSrc": "10980:18:23", + "nodeType": "YulIdentifier", + "src": "10980:18:23" + }, + { + "arguments": [ + { + "name": "length", + "nativeSrc": "11003:6:23", + "nodeType": "YulIdentifier", + "src": "11003:6:23" + }, + { + "kind": "number", + "nativeSrc": "11011:2:23", + "nodeType": "YulLiteral", + "src": "11011:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "11000:2:23", + "nodeType": "YulIdentifier", + "src": "11000:2:23" + }, + "nativeSrc": "11000:14:23", + "nodeType": "YulFunctionCall", + "src": "11000:14:23" + } + ], + "functionName": { + "name": "eq", + "nativeSrc": "10977:2:23", + "nodeType": "YulIdentifier", + "src": "10977:2:23" + }, + "nativeSrc": "10977:38:23", + "nodeType": "YulFunctionCall", + "src": "10977:38:23" + }, + "nativeSrc": "10974:161:23", + "nodeType": "YulIf", + "src": "10974:161:23" + } + ] + }, + "name": "extract_byte_array_length", + "nativeSrc": "10761:380:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "data", + "nativeSrc": "10796:4:23", + "nodeType": "YulTypedName", + "src": "10796:4:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "length", + "nativeSrc": "10805:6:23", + "nodeType": "YulTypedName", + "src": "10805:6:23", + "type": "" + } + ], + "src": "10761:380:23" + }, + { + "body": { + "nativeSrc": "11359:276:23", + "nodeType": "YulBlock", + "src": "11359:276:23", + "statements": [ + { + "nativeSrc": "11369:27:23", + "nodeType": "YulAssignment", + "src": "11369:27:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "11381:9:23", + "nodeType": "YulIdentifier", + "src": "11381:9:23" + }, + { + "kind": "number", + "nativeSrc": "11392:3:23", + "nodeType": "YulLiteral", + "src": "11392:3:23", + "type": "", + "value": "160" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "11377:3:23", + "nodeType": "YulIdentifier", + "src": "11377:3:23" + }, + "nativeSrc": "11377:19:23", + "nodeType": "YulFunctionCall", + "src": "11377:19:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "11369:4:23", + "nodeType": "YulIdentifier", + "src": "11369:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "11412:9:23", + "nodeType": "YulIdentifier", + "src": "11412:9:23" + }, + { + "name": "value0", + "nativeSrc": "11423:6:23", + "nodeType": "YulIdentifier", + "src": "11423:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "11405:6:23", + "nodeType": "YulIdentifier", + "src": "11405:6:23" + }, + "nativeSrc": "11405:25:23", + "nodeType": "YulFunctionCall", + "src": "11405:25:23" + }, + "nativeSrc": "11405:25:23", + "nodeType": "YulExpressionStatement", + "src": "11405:25:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "11450:9:23", + "nodeType": "YulIdentifier", + "src": "11450:9:23" + }, + { + "kind": "number", + "nativeSrc": "11461:2:23", + "nodeType": "YulLiteral", + "src": "11461:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "11446:3:23", + "nodeType": "YulIdentifier", + "src": "11446:3:23" + }, + "nativeSrc": "11446:18:23", + "nodeType": "YulFunctionCall", + "src": "11446:18:23" + }, + { + "name": "value1", + "nativeSrc": "11466:6:23", + "nodeType": "YulIdentifier", + "src": "11466:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "11439:6:23", + "nodeType": "YulIdentifier", + "src": "11439:6:23" + }, + "nativeSrc": "11439:34:23", + "nodeType": "YulFunctionCall", + "src": "11439:34:23" + }, + "nativeSrc": "11439:34:23", + "nodeType": "YulExpressionStatement", + "src": "11439:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "11493:9:23", + "nodeType": "YulIdentifier", + "src": "11493:9:23" + }, + { + "kind": "number", + "nativeSrc": "11504:2:23", + "nodeType": "YulLiteral", + "src": "11504:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "11489:3:23", + "nodeType": "YulIdentifier", + "src": "11489:3:23" + }, + "nativeSrc": "11489:18:23", + "nodeType": "YulFunctionCall", + "src": "11489:18:23" + }, + { + "name": "value2", + "nativeSrc": "11509:6:23", + "nodeType": "YulIdentifier", + "src": "11509:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "11482:6:23", + "nodeType": "YulIdentifier", + "src": "11482:6:23" + }, + "nativeSrc": "11482:34:23", + "nodeType": "YulFunctionCall", + "src": "11482:34:23" + }, + "nativeSrc": "11482:34:23", + "nodeType": "YulExpressionStatement", + "src": "11482:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "11536:9:23", + "nodeType": "YulIdentifier", + "src": "11536:9:23" + }, + { + "kind": "number", + "nativeSrc": "11547:2:23", + "nodeType": "YulLiteral", + "src": "11547:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "11532:3:23", + "nodeType": "YulIdentifier", + "src": "11532:3:23" + }, + "nativeSrc": "11532:18:23", + "nodeType": "YulFunctionCall", + "src": "11532:18:23" + }, + { + "name": "value3", + "nativeSrc": "11552:6:23", + "nodeType": "YulIdentifier", + "src": "11552:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "11525:6:23", + "nodeType": "YulIdentifier", + "src": "11525:6:23" + }, + "nativeSrc": "11525:34:23", + "nodeType": "YulFunctionCall", + "src": "11525:34:23" + }, + "nativeSrc": "11525:34:23", + "nodeType": "YulExpressionStatement", + "src": "11525:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "11579:9:23", + "nodeType": "YulIdentifier", + "src": "11579:9:23" + }, + { + "kind": "number", + "nativeSrc": "11590:3:23", + "nodeType": "YulLiteral", + "src": "11590:3:23", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "11575:3:23", + "nodeType": "YulIdentifier", + "src": "11575:3:23" + }, + "nativeSrc": "11575:19:23", + "nodeType": "YulFunctionCall", + "src": "11575:19:23" + }, + { + "arguments": [ + { + "name": "value4", + "nativeSrc": "11600:6:23", + "nodeType": "YulIdentifier", + "src": "11600:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11616:3:23", + "nodeType": "YulLiteral", + "src": "11616:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "11621:1:23", + "nodeType": "YulLiteral", + "src": "11621:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "11612:3:23", + "nodeType": "YulIdentifier", + "src": "11612:3:23" + }, + "nativeSrc": "11612:11:23", + "nodeType": "YulFunctionCall", + "src": "11612:11:23" + }, + { + "kind": "number", + "nativeSrc": "11625:1:23", + "nodeType": "YulLiteral", + "src": "11625:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "11608:3:23", + "nodeType": "YulIdentifier", + "src": "11608:3:23" + }, + "nativeSrc": "11608:19:23", + "nodeType": "YulFunctionCall", + "src": "11608:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "11596:3:23", + "nodeType": "YulIdentifier", + "src": "11596:3:23" + }, + "nativeSrc": "11596:32:23", + "nodeType": "YulFunctionCall", + "src": "11596:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "11568:6:23", + "nodeType": "YulIdentifier", + "src": "11568:6:23" + }, + "nativeSrc": "11568:61:23", + "nodeType": "YulFunctionCall", + "src": "11568:61:23" + }, + "nativeSrc": "11568:61:23", + "nodeType": "YulExpressionStatement", + "src": "11568:61:23" + } + ] + }, + "name": "abi_encode_tuple_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__to_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__fromStack_reversed", + "nativeSrc": "11146:489:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "11296:9:23", + "nodeType": "YulTypedName", + "src": "11296:9:23", + "type": "" + }, + { + "name": "value4", + "nativeSrc": "11307:6:23", + "nodeType": "YulTypedName", + "src": "11307:6:23", + "type": "" + }, + { + "name": "value3", + "nativeSrc": "11315:6:23", + "nodeType": "YulTypedName", + "src": "11315:6:23", + "type": "" + }, + { + "name": "value2", + "nativeSrc": "11323:6:23", + "nodeType": "YulTypedName", + "src": "11323:6:23", + "type": "" + }, + { + "name": "value1", + "nativeSrc": "11331:6:23", + "nodeType": "YulTypedName", + "src": "11331:6:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "11339:6:23", + "nodeType": "YulTypedName", + "src": "11339:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "11350:4:23", + "nodeType": "YulTypedName", + "src": "11350:4:23", + "type": "" + } + ], + "src": "11146:489:23" + } + ] + }, + "contents": "{\n { }\n function abi_decode_tuple_t_struct$_ExecuteParams_$8182_calldata_ptr(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n let offset := calldataload(headStart)\n if gt(offset, 0xffffffffffffffff) { revert(0, 0) }\n let _1 := add(headStart, offset)\n if slt(sub(dataEnd, _1), 448) { revert(0, 0) }\n value0 := _1\n }\n function abi_encode_tuple_t_address__to_t_address__fromStack_reversed(headStart, value0) -> tail\n {\n tail := add(headStart, 32)\n mstore(headStart, and(value0, sub(shl(160, 1), 1)))\n }\n function abi_encode_string(value, pos) -> end\n {\n let length := mload(value)\n mstore(pos, length)\n mcopy(add(pos, 0x20), add(value, 0x20), length)\n mstore(add(add(pos, length), 0x20), 0)\n end := add(add(pos, and(add(length, 31), not(31))), 0x20)\n }\n function abi_encode_tuple_t_bytes1_t_string_memory_ptr_t_string_memory_ptr_t_uint256_t_address_t_bytes32_t_array$_t_uint256_$dyn_memory_ptr__to_t_bytes1_t_string_memory_ptr_t_string_memory_ptr_t_uint256_t_address_t_bytes32_t_array$_t_uint256_$dyn_memory_ptr__fromStack_reversed(headStart, value6, value5, value4, value3, value2, value1, value0) -> tail\n {\n mstore(headStart, and(value0, shl(248, 255)))\n mstore(add(headStart, 32), 224)\n let tail_1 := abi_encode_string(value1, add(headStart, 224))\n mstore(add(headStart, 64), sub(tail_1, headStart))\n let tail_2 := abi_encode_string(value2, tail_1)\n mstore(add(headStart, 96), value3)\n mstore(add(headStart, 128), and(value4, sub(shl(160, 1), 1)))\n mstore(add(headStart, 160), value5)\n mstore(add(headStart, 192), sub(tail_2, headStart))\n let pos := tail_2\n let length := mload(value6)\n mstore(tail_2, length)\n pos := add(tail_2, 32)\n let srcPtr := add(value6, 32)\n let i := 0\n for { } lt(i, length) { i := add(i, 1) }\n {\n mstore(pos, mload(srcPtr))\n pos := add(pos, 32)\n srcPtr := add(srcPtr, 32)\n }\n tail := pos\n }\n function abi_decode_address(offset) -> value\n {\n value := calldataload(offset)\n if iszero(eq(value, and(value, sub(shl(160, 1), 1)))) { revert(0, 0) }\n }\n function abi_decode_tuple_t_addresst_uint256(headStart, dataEnd) -> value0, value1\n {\n if slt(sub(dataEnd, headStart), 64) { revert(0, 0) }\n value0 := abi_decode_address(headStart)\n let value := 0\n value := calldataload(add(headStart, 32))\n value1 := value\n }\n function abi_encode_tuple_t_bool__to_t_bool__fromStack_reversed(headStart, value0) -> tail\n {\n tail := add(headStart, 32)\n mstore(headStart, iszero(iszero(value0)))\n }\n function abi_decode_tuple_t_uint256(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n let value := 0\n value := calldataload(headStart)\n value0 := value\n }\n function abi_decode_tuple_t_address(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n value0 := abi_decode_address(headStart)\n }\n function abi_encode_tuple_t_stringliteral_110461b12e459dc76e692e7a47f9621cf45c7d48020c3c7b2066107cdf1f52ae__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 13)\n mstore(add(headStart, 64), \"Invalid owner\")\n tail := add(headStart, 96)\n }\n function abi_encode_tuple_t_stringliteral_5e70ebd1d4072d337a7fabaa7bda70fa2633d6e3f89d5cb725a16b10d07e54c6__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 13)\n mstore(add(headStart, 64), \"Invalid token\")\n tail := add(headStart, 96)\n }\n function abi_encode_tuple_t_stringliteral_15d72127d094a30af360ead73641c61eda3d745ce4d04d12675a5e9a899f8b21__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 10)\n mstore(add(headStart, 64), \"Nonce used\")\n tail := add(headStart, 96)\n }\n function abi_encode_tuple_t_stringliteral_27859e47e6c2167c8e8d38addfca16b9afb9d8e9750b6a1e67c29196d4d99fae__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 15)\n mstore(add(headStart, 64), \"Payload expired\")\n tail := add(headStart, 96)\n }\n function access_calldata_tail_t_bytes_calldata_ptr(base_ref, ptr_to_tail) -> addr, length\n {\n let rel_offset_of_tail := calldataload(ptr_to_tail)\n if iszero(slt(rel_offset_of_tail, add(sub(calldatasize(), base_ref), not(30)))) { revert(0, 0) }\n let addr_1 := add(base_ref, rel_offset_of_tail)\n length := calldataload(addr_1)\n if gt(length, 0xffffffffffffffff) { revert(0, 0) }\n addr := add(addr_1, 0x20)\n if sgt(addr, sub(calldatasize(), length)) { revert(0, 0) }\n }\n function abi_decode_tuple_t_uint8(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n let value := calldataload(headStart)\n if iszero(eq(value, and(value, 0xff))) { revert(0, 0) }\n value0 := value\n }\n function abi_encode_tuple_t_stringliteral_31734eed34fab74fa1579246aaad104a344891a284044483c0c5a792a9f83a72__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 11)\n mstore(add(headStart, 64), \"Invalid sig\")\n tail := add(headStart, 96)\n }\n function abi_encode_tuple_t_stringliteral_a793dc5bde52ab2d5349f1208a34905b1d68ab9298f549a2e514542cba0a8c76__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 28)\n mstore(add(headStart, 64), \"Incorrect ETH value provided\")\n tail := add(headStart, 96)\n }\n function abi_encode_tuple_t_stringliteral_066ad49a0ed9e5d6a9f3c20fca13a038f0a5d629f0aaf09d634ae2a7c232ac2b__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 11)\n mstore(add(headStart, 64), \"Call failed\")\n tail := add(headStart, 96)\n }\n function abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed(headStart, value0) -> tail\n {\n tail := add(headStart, 32)\n mstore(headStart, value0)\n }\n function panic_error_0x41()\n {\n mstore(0, shl(224, 0x4e487b71))\n mstore(4, 0x41)\n revert(0, 0x24)\n }\n function abi_encode_tuple_packed_t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470__to_t_bytes_memory_ptr__nonPadded_inplace_fromStack_reversed(pos) -> end\n { end := pos }\n function abi_encode_tuple_t_stringliteral_c7c2be2f1b63a3793f6e2d447ce95ba2239687186a7fd6b5268a969dcdb42dcd__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 19)\n mstore(add(headStart, 64), \"ETH transfer failed\")\n tail := add(headStart, 96)\n }\n function abi_encode_tuple_t_bytes32_t_address_t_address_t_address_t_uint256_t_bytes32_t_uint256_t_uint256_t_uint256__to_t_bytes32_t_address_t_address_t_address_t_uint256_t_bytes32_t_uint256_t_uint256_t_uint256__fromStack_reversed(headStart, value8, value7, value6, value5, value4, value3, value2, value1, value0) -> tail\n {\n tail := add(headStart, 288)\n mstore(headStart, value0)\n mstore(add(headStart, 32), and(value1, sub(shl(160, 1), 1)))\n mstore(add(headStart, 64), and(value2, sub(shl(160, 1), 1)))\n mstore(add(headStart, 96), and(value3, sub(shl(160, 1), 1)))\n mstore(add(headStart, 128), value4)\n mstore(add(headStart, 160), value5)\n mstore(add(headStart, 192), value6)\n mstore(add(headStart, 224), value7)\n mstore(add(headStart, 256), value8)\n }\n function abi_encode_tuple_t_address_t_address_t_uint256_t_uint256_t_uint8_t_bytes32_t_bytes32__to_t_address_t_address_t_uint256_t_uint256_t_uint8_t_bytes32_t_bytes32__fromStack_reversed(headStart, value6, value5, value4, value3, value2, value1, value0) -> tail\n {\n tail := add(headStart, 224)\n mstore(headStart, and(value0, sub(shl(160, 1), 1)))\n mstore(add(headStart, 32), and(value1, sub(shl(160, 1), 1)))\n mstore(add(headStart, 64), value2)\n mstore(add(headStart, 96), value3)\n mstore(add(headStart, 128), and(value4, 0xff))\n mstore(add(headStart, 160), value5)\n mstore(add(headStart, 192), value6)\n }\n function abi_encode_tuple_t_address_t_address__to_t_address_t_address__fromStack_reversed(headStart, value1, value0) -> tail\n {\n tail := add(headStart, 64)\n mstore(headStart, and(value0, sub(shl(160, 1), 1)))\n mstore(add(headStart, 32), and(value1, sub(shl(160, 1), 1)))\n }\n function abi_decode_tuple_t_uint256_fromMemory(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n value0 := mload(headStart)\n }\n function abi_encode_tuple_t_stringliteral_0acc7f0c8df1a6717d2b423ae4591ac135687015764ac37dd4cf0150a9322b15__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 40)\n mstore(add(headStart, 64), \"Permit failed and insufficient a\")\n mstore(add(headStart, 96), \"llowance\")\n tail := add(headStart, 128)\n }\n function abi_encode_tuple_packed_t_bytes_memory_ptr__to_t_bytes_memory_ptr__nonPadded_inplace_fromStack_reversed(pos, value0) -> end\n {\n let length := mload(value0)\n mcopy(pos, add(value0, 0x20), length)\n let _1 := add(pos, length)\n mstore(_1, 0)\n end := _1\n }\n function abi_encode_tuple_t_bytes32_t_uint8_t_bytes32_t_bytes32__to_t_bytes32_t_uint8_t_bytes32_t_bytes32__fromStack_reversed(headStart, value3, value2, value1, value0) -> tail\n {\n tail := add(headStart, 128)\n mstore(headStart, value0)\n mstore(add(headStart, 32), and(value1, 0xff))\n mstore(add(headStart, 64), value2)\n mstore(add(headStart, 96), value3)\n }\n function panic_error_0x21()\n {\n mstore(0, shl(224, 0x4e487b71))\n mstore(4, 0x21)\n revert(0, 0x24)\n }\n function abi_encode_tuple_t_bytes32__to_t_bytes32__fromStack_reversed(headStart, value0) -> tail\n {\n tail := add(headStart, 32)\n mstore(headStart, value0)\n }\n function extract_byte_array_length(data) -> length\n {\n length := shr(1, data)\n let outOfPlaceEncoding := and(data, 1)\n if iszero(outOfPlaceEncoding) { length := and(length, 0x7f) }\n if eq(outOfPlaceEncoding, lt(length, 32))\n {\n mstore(0, shl(224, 0x4e487b71))\n mstore(4, 0x22)\n revert(0, 0x24)\n }\n }\n function abi_encode_tuple_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__to_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__fromStack_reversed(headStart, value4, value3, value2, value1, value0) -> tail\n {\n tail := add(headStart, 160)\n mstore(headStart, value0)\n mstore(add(headStart, 32), value1)\n mstore(add(headStart, 64), value2)\n mstore(add(headStart, 96), value3)\n mstore(add(headStart, 128), and(value4, sub(shl(160, 1), 1)))\n }\n}", + "id": 23, + "language": "Yul", + "name": "#utility.yul" + } + ], + "immutableReferences": { + "4158": [ + { + "length": 32, + "start": 4419 + } + ], + "4160": [ + { + "length": 32, + "start": 4377 + } + ], + "4162": [ + { + "length": 32, + "start": 4335 + } + ], + "4164": [ + { + "length": 32, + "start": 4500 + } + ], + "4166": [ + { + "length": 32, + "start": 4540 + } + ], + "4169": [ + { + "length": 32, + "start": 3323 + } + ], + "4172": [ + { + "length": 32, + "start": 3373 + } + ], + "8147": [ + { + "length": 32, + "start": 215 + }, + { + "length": 32, + "start": 1317 + }, + { + "length": 32, + "start": 1524 + }, + { + "length": 32, + "start": 2384 + }, + { + "length": 32, + "start": 3064 + } + ] + }, + "linkReferences": {}, + "object": "608060405260043610610092575f3560e01c80639e281a98116100575780639e281a9814610159578063d850124e14610178578063dcb79457146101c1578063f14210a6146101e0578063f2fde38b146101ff575f5ffd5b80632af83bfe1461009d578063715018a6146100b257806375bd6863146100c657806384b0196e146101165780638da5cb5b1461013d575f5ffd5b3661009957005b5f5ffd5b6100b06100ab3660046112dd565b61021e565b005b3480156100bd575f5ffd5b506100b06106ae565b3480156100d1575f5ffd5b506100f97f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b348015610121575f5ffd5b5061012a6106c1565b60405161010d979695949392919061134a565b348015610148575f5ffd5b505f546001600160a01b03166100f9565b348015610164575f5ffd5b506100b06101733660046113fb565b610703565b348015610183575f5ffd5b506101b16101923660046113fb565b600360209081525f928352604080842090915290825290205460ff1681565b604051901515815260200161010d565b3480156101cc575f5ffd5b506101b16101db3660046113fb565b61078b565b3480156101eb575f5ffd5b506100b06101fa366004611423565b6107b8565b34801561020a575f5ffd5b506100b061021936600461143a565b6108a7565b6102266108e1565b5f610237604083016020840161143a565b90506101208201356001600160a01b03821661028a5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21037bbb732b960991b60448201526064015b60405180910390fd5b5f610298602085018561143a565b6001600160a01b0316036102de5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2103a37b5b2b760991b6044820152606401610281565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff161561033e5760405162461bcd60e51b815260206004820152600a602482015269139bdb98d9481d5cd95960b21b6044820152606401610281565b8261014001354211156103855760405162461bcd60e51b815260206004820152600f60248201526e14185e5b1bd85908195e1c1a5c9959608a1b6044820152606401610281565b5f6103ee83610397602087018761143a565b60408701356103a960e0890189611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250505050610100890135876101408b013561090f565b90506001600160a01b038316610421826104106101808801610160890161149d565b876101800135886101a001356109db565b6001600160a01b0316146104655760405162461bcd60e51b815260206004820152600b60248201526a496e76616c69642073696760a81b6044820152606401610281565b83610100013534146104b95760405162461bcd60e51b815260206004820152601c60248201527f496e636f7272656374204554482076616c75652070726f7669646564000000006044820152606401610281565b6001600160a01b0383165f9081526003602090815260408083208584528252909120805460ff19166001179055610520906104f69086018661143a565b846040870135606088013561051160a08a0160808b0161149d565b8960a001358a60c00135610a07565b6105667f00000000000000000000000000000000000000000000000000000000000000006040860135610556602088018861143a565b6001600160a01b03169190610b75565b5f6105b261057760e0870187611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250349250610bf4915050565b9050806105ef5760405162461bcd60e51b815260206004820152600b60248201526a10d85b1b0819985a5b195960aa1b6044820152606401610281565b6106217f00000000000000000000000000000000000000000000000000000000000000005f610556602089018961143a565b61062e602086018661143a565b6001600160a01b0316846001600160a01b03167f78129a649632642d8e9f346c85d9efb70d32d50a36774c4585491a9228bbd350876040013560405161067691815260200190565b60405180910390a3505050506106ab60017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b50565b6106b6610c79565b6106bf5f610ca5565b565b5f6060805f5f5f60606106d2610cf4565b6106da610d26565b604080515f80825260208201909252600f60f81b9b939a50919850469750309650945092509050565b61070b610c79565b61073061071f5f546001600160a01b031690565b6001600160a01b0384169083610d53565b5f546001600160a01b03166001600160a01b0316826001600160a01b03167fa0524ee0fd8662d6c046d199da2a6d3dc49445182cec055873a5bb9c2843c8e08360405161077f91815260200190565b60405180910390a35050565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff165b92915050565b6107c0610c79565b5f80546040516001600160a01b039091169083908381818185875af1925050503d805f811461080a576040519150601f19603f3d011682016040523d82523d5f602084013e61080f565b606091505b50509050806108565760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610281565b5f546001600160a01b03166001600160a01b03167f6148672a948a12b8e0bf92a9338349b9ac890fad62a234abaf0a4da99f62cfcc8360405161089b91815260200190565b60405180910390a25050565b6108af610c79565b6001600160a01b0381166108d857604051631e4fbdf760e01b81525f6004820152602401610281565b6106ab81610ca5565b6108e9610d60565b60027f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b8351602080860191909120604080517ff0543e2024fd0ae16ccb842686c2733758ec65acfd69fb599c05b286f8db8844938101939093526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691840191909152808a1660608401528816608083015260a0820187905260c082015260e08101849052610100810183905261012081018290525f906109cf906101400160405160208183030381529060405280519060200120610da2565b98975050505050505050565b5f5f5f5f6109eb88888888610dce565b9250925092506109fb8282610e96565b50909695505050505050565b60405163d505accf60e01b81526001600160a01b038781166004830152306024830152604482018790526064820186905260ff8516608483015260a4820184905260c4820183905288169063d505accf9060e4015f604051808303815f87803b158015610a72575f5ffd5b505af1925050508015610a83575060015b610b5757604051636eb1769f60e11b81526001600160a01b03878116600483015230602483015286919089169063dd62ed3e90604401602060405180830381865afa158015610ad4573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610af891906114bd565b1015610b575760405162461bcd60e51b815260206004820152602860248201527f5065726d6974206661696c656420616e6420696e73756666696369656e7420616044820152676c6c6f77616e636560c01b6064820152608401610281565b610b6c6001600160a01b038816873088610f52565b50505050505050565b610b818383835f610f8e565b610bef57610b9283835f6001610f8e565b610bba57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b610bc78383836001610f8e565b610bef57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b505050565b5f5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168385604051610c2f91906114d4565b5f6040518083038185875af1925050503d805f8114610c69576040519150601f19603f3d011682016040523d82523d5f602084013e610c6e565b606091505b509095945050505050565b5f546001600160a01b031633146106bf5760405163118cdaa760e01b8152336004820152602401610281565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006001610ff0565b905090565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006002610ff0565b610bc78383836001611099565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00546002036106bf57604051633ee5aeb560e01b815260040160405180910390fd5b5f6107b2610dae6110e3565b8360405161190160f01b8152600281019290925260228201526042902090565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115610e0757505f91506003905082610e8c565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015610e58573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b038116610e8357505f925060019150829050610e8c565b92505f91508190505b9450945094915050565b5f826003811115610ea957610ea96114ea565b03610eb2575050565b6001826003811115610ec657610ec66114ea565b03610ee45760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115610ef857610ef86114ea565b03610f195760405163fce698f760e01b815260048101829052602401610281565b6003826003811115610f2d57610f2d6114ea565b03610f4e576040516335e2f38360e21b815260048101829052602401610281565b5050565b610f6084848484600161120c565b610f8857604051635274afe760e01b81526001600160a01b0385166004820152602401610281565b50505050565b60405163095ea7b360e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f873b113d1516831692505b60405250949350505050565b606060ff831461100a5761100383611279565b90506107b2565b818054611016906114fe565b80601f0160208091040260200160405190810160405280929190818152602001828054611042906114fe565b801561108d5780601f106110645761010080835404028352916020019161108d565b820191905f5260205f20905b81548152906001019060200180831161107057829003601f168201915b505050505090506107b2565b60405163a9059cbb60e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561113b57507f000000000000000000000000000000000000000000000000000000000000000046145b1561116557507f000000000000000000000000000000000000000000000000000000000000000090565b610d21604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b6040516323b872dd60e01b5f8181526001600160a01b038781166004528616602452604485905291602083606481808c5af1925060015f5114831661126857838315161561125c573d5f823e3d81fd5b5f883b113d1516831692505b604052505f60605295945050505050565b60605f611285836112b6565b6040805160208082528183019092529192505f91906020820181803683375050509182525060208101929092525090565b5f60ff8216601f8111156107b257604051632cd44ac360e21b815260040160405180910390fd5b5f602082840312156112ed575f5ffd5b813567ffffffffffffffff811115611303575f5ffd5b82016101c08185031215611315575f5ffd5b9392505050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b60ff60f81b8816815260e060208201525f61136860e083018961131c565b828103604084015261137a818961131c565b606084018890526001600160a01b038716608085015260a0840186905283810360c0850152845180825260208087019350909101905f5b818110156113cf5783518352602093840193909201916001016113b1565b50909b9a5050505050505050505050565b80356001600160a01b03811681146113f6575f5ffd5b919050565b5f5f6040838503121561140c575f5ffd5b611415836113e0565b946020939093013593505050565b5f60208284031215611433575f5ffd5b5035919050565b5f6020828403121561144a575f5ffd5b611315826113e0565b5f5f8335601e19843603018112611468575f5ffd5b83018035915067ffffffffffffffff821115611482575f5ffd5b602001915036819003821315611496575f5ffd5b9250929050565b5f602082840312156114ad575f5ffd5b813560ff81168114611315575f5ffd5b5f602082840312156114cd575f5ffd5b5051919050565b5f82518060208501845e5f920191825250919050565b634e487b7160e01b5f52602160045260245ffd5b600181811c9082168061151257607f821691505b60208210810361153057634e487b7160e01b5f52602260045260245ffd5b5091905056fea26469706673582212209c34db2f6f83af136a5340cce7fe8ef554ea8eb633656fbf9bff3bd731aec40f64736f6c634300081c0033", + "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x92 JUMPI PUSH0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x9E281A98 GT PUSH2 0x57 JUMPI DUP1 PUSH4 0x9E281A98 EQ PUSH2 0x159 JUMPI DUP1 PUSH4 0xD850124E EQ PUSH2 0x178 JUMPI DUP1 PUSH4 0xDCB79457 EQ PUSH2 0x1C1 JUMPI DUP1 PUSH4 0xF14210A6 EQ PUSH2 0x1E0 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x1FF JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP1 PUSH4 0x2AF83BFE EQ PUSH2 0x9D JUMPI DUP1 PUSH4 0x715018A6 EQ PUSH2 0xB2 JUMPI DUP1 PUSH4 0x75BD6863 EQ PUSH2 0xC6 JUMPI DUP1 PUSH4 0x84B0196E EQ PUSH2 0x116 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x13D JUMPI PUSH0 PUSH0 REVERT JUMPDEST CALLDATASIZE PUSH2 0x99 JUMPI STOP JUMPDEST PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0xB0 PUSH2 0xAB CALLDATASIZE PUSH1 0x4 PUSH2 0x12DD JUMP JUMPDEST PUSH2 0x21E JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xBD JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xB0 PUSH2 0x6AE JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xD1 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xF9 PUSH32 0x0 DUP2 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP2 AND DUP2 MSTORE PUSH1 0x20 ADD JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x121 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x12A PUSH2 0x6C1 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x10D SWAP8 SWAP7 SWAP6 SWAP5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x134A JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x148 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH2 0xF9 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x164 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xB0 PUSH2 0x173 CALLDATASIZE PUSH1 0x4 PUSH2 0x13FB JUMP JUMPDEST PUSH2 0x703 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x183 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x1B1 PUSH2 0x192 CALLDATASIZE PUSH1 0x4 PUSH2 0x13FB JUMP JUMPDEST PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x40 MLOAD SWAP1 ISZERO ISZERO DUP2 MSTORE PUSH1 0x20 ADD PUSH2 0x10D JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1CC JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x1B1 PUSH2 0x1DB CALLDATASIZE PUSH1 0x4 PUSH2 0x13FB JUMP JUMPDEST PUSH2 0x78B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1EB JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xB0 PUSH2 0x1FA CALLDATASIZE PUSH1 0x4 PUSH2 0x1423 JUMP JUMPDEST PUSH2 0x7B8 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x20A JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xB0 PUSH2 0x219 CALLDATASIZE PUSH1 0x4 PUSH2 0x143A JUMP JUMPDEST PUSH2 0x8A7 JUMP JUMPDEST PUSH2 0x226 PUSH2 0x8E1 JUMP JUMPDEST PUSH0 PUSH2 0x237 PUSH1 0x40 DUP4 ADD PUSH1 0x20 DUP5 ADD PUSH2 0x143A JUMP JUMPDEST SWAP1 POP PUSH2 0x120 DUP3 ADD CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP3 AND PUSH2 0x28A JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xD PUSH1 0x24 DUP3 ADD MSTORE PUSH13 0x24B73B30B634B21037BBB732B9 PUSH1 0x99 SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH0 PUSH2 0x298 PUSH1 0x20 DUP6 ADD DUP6 PUSH2 0x143A JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND SUB PUSH2 0x2DE JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xD PUSH1 0x24 DUP3 ADD MSTORE PUSH13 0x24B73B30B634B2103A37B5B2B7 PUSH1 0x99 SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP3 AND PUSH0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP5 DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x33E JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xA PUSH1 0x24 DUP3 ADD MSTORE PUSH10 0x139BDB98D9481D5CD959 PUSH1 0xB2 SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST DUP3 PUSH2 0x140 ADD CALLDATALOAD TIMESTAMP GT ISZERO PUSH2 0x385 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xF PUSH1 0x24 DUP3 ADD MSTORE PUSH15 0x14185E5B1BD85908195E1C1A5C9959 PUSH1 0x8A SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH0 PUSH2 0x3EE DUP4 PUSH2 0x397 PUSH1 0x20 DUP8 ADD DUP8 PUSH2 0x143A JUMP JUMPDEST PUSH1 0x40 DUP8 ADD CALLDATALOAD PUSH2 0x3A9 PUSH1 0xE0 DUP10 ADD DUP10 PUSH2 0x1453 JUMP JUMPDEST DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY PUSH0 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP POP POP POP PUSH2 0x100 DUP10 ADD CALLDATALOAD DUP8 PUSH2 0x140 DUP12 ADD CALLDATALOAD PUSH2 0x90F JUMP JUMPDEST SWAP1 POP PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP4 AND PUSH2 0x421 DUP3 PUSH2 0x410 PUSH2 0x180 DUP9 ADD PUSH2 0x160 DUP10 ADD PUSH2 0x149D JUMP JUMPDEST DUP8 PUSH2 0x180 ADD CALLDATALOAD DUP9 PUSH2 0x1A0 ADD CALLDATALOAD PUSH2 0x9DB JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND EQ PUSH2 0x465 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xB PUSH1 0x24 DUP3 ADD MSTORE PUSH11 0x496E76616C696420736967 PUSH1 0xA8 SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST DUP4 PUSH2 0x100 ADD CALLDATALOAD CALLVALUE EQ PUSH2 0x4B9 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1C PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x496E636F7272656374204554482076616C75652070726F766964656400000000 PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP4 AND PUSH0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP6 DUP5 MSTORE DUP3 MSTORE SWAP1 SWAP2 KECCAK256 DUP1 SLOAD PUSH1 0xFF NOT AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0x520 SWAP1 PUSH2 0x4F6 SWAP1 DUP7 ADD DUP7 PUSH2 0x143A JUMP JUMPDEST DUP5 PUSH1 0x40 DUP8 ADD CALLDATALOAD PUSH1 0x60 DUP9 ADD CALLDATALOAD PUSH2 0x511 PUSH1 0xA0 DUP11 ADD PUSH1 0x80 DUP12 ADD PUSH2 0x149D JUMP JUMPDEST DUP10 PUSH1 0xA0 ADD CALLDATALOAD DUP11 PUSH1 0xC0 ADD CALLDATALOAD PUSH2 0xA07 JUMP JUMPDEST PUSH2 0x566 PUSH32 0x0 PUSH1 0x40 DUP7 ADD CALLDATALOAD PUSH2 0x556 PUSH1 0x20 DUP9 ADD DUP9 PUSH2 0x143A JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND SWAP2 SWAP1 PUSH2 0xB75 JUMP JUMPDEST PUSH0 PUSH2 0x5B2 PUSH2 0x577 PUSH1 0xE0 DUP8 ADD DUP8 PUSH2 0x1453 JUMP JUMPDEST DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY PUSH0 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP CALLVALUE SWAP3 POP PUSH2 0xBF4 SWAP2 POP POP JUMP JUMPDEST SWAP1 POP DUP1 PUSH2 0x5EF JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xB PUSH1 0x24 DUP3 ADD MSTORE PUSH11 0x10D85B1B0819985A5B1959 PUSH1 0xAA SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH2 0x621 PUSH32 0x0 PUSH0 PUSH2 0x556 PUSH1 0x20 DUP10 ADD DUP10 PUSH2 0x143A JUMP JUMPDEST PUSH2 0x62E PUSH1 0x20 DUP7 ADD DUP7 PUSH2 0x143A JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP5 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH32 0x78129A649632642D8E9F346C85D9EFB70D32D50A36774C4585491A9228BBD350 DUP8 PUSH1 0x40 ADD CALLDATALOAD PUSH1 0x40 MLOAD PUSH2 0x676 SWAP2 DUP2 MSTORE PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP POP POP PUSH2 0x6AB PUSH1 0x1 PUSH32 0x9B779B17422D0DF92223018B32B4D1FA46E071723D6817E2486D003BECC55F00 SSTORE JUMP JUMPDEST POP JUMP JUMPDEST PUSH2 0x6B6 PUSH2 0xC79 JUMP JUMPDEST PUSH2 0x6BF PUSH0 PUSH2 0xCA5 JUMP JUMPDEST JUMP JUMPDEST PUSH0 PUSH1 0x60 DUP1 PUSH0 PUSH0 PUSH0 PUSH1 0x60 PUSH2 0x6D2 PUSH2 0xCF4 JUMP JUMPDEST PUSH2 0x6DA PUSH2 0xD26 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH0 DUP1 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 SWAP3 MSTORE PUSH1 0xF PUSH1 0xF8 SHL SWAP12 SWAP4 SWAP11 POP SWAP2 SWAP9 POP CHAINID SWAP8 POP ADDRESS SWAP7 POP SWAP5 POP SWAP3 POP SWAP1 POP JUMP JUMPDEST PUSH2 0x70B PUSH2 0xC79 JUMP JUMPDEST PUSH2 0x730 PUSH2 0x71F PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND SWAP1 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP5 AND SWAP1 DUP4 PUSH2 0xD53 JUMP JUMPDEST PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP3 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH32 0xA0524EE0FD8662D6C046D199DA2A6D3DC49445182CEC055873A5BB9C2843C8E0 DUP4 PUSH1 0x40 MLOAD PUSH2 0x77F SWAP2 DUP2 MSTORE PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP3 AND PUSH0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP5 DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x7C0 PUSH2 0xC79 JUMP JUMPDEST PUSH0 DUP1 SLOAD PUSH1 0x40 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP2 AND SWAP1 DUP4 SWAP1 DUP4 DUP2 DUP2 DUP2 DUP6 DUP8 GAS CALL SWAP3 POP POP POP RETURNDATASIZE DUP1 PUSH0 DUP2 EQ PUSH2 0x80A JUMPI PUSH1 0x40 MLOAD SWAP2 POP PUSH1 0x1F NOT PUSH1 0x3F RETURNDATASIZE ADD AND DUP3 ADD PUSH1 0x40 MSTORE RETURNDATASIZE DUP3 MSTORE RETURNDATASIZE PUSH0 PUSH1 0x20 DUP5 ADD RETURNDATACOPY PUSH2 0x80F JUMP JUMPDEST PUSH1 0x60 SWAP2 POP JUMPDEST POP POP SWAP1 POP DUP1 PUSH2 0x856 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH19 0x115512081D1C985B9CD9995C8819985A5B1959 PUSH1 0x6A SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH32 0x6148672A948A12B8E0BF92A9338349B9AC890FAD62A234ABAF0A4DA99F62CFCC DUP4 PUSH1 0x40 MLOAD PUSH2 0x89B SWAP2 DUP2 MSTORE PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 POP POP JUMP JUMPDEST PUSH2 0x8AF PUSH2 0xC79 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND PUSH2 0x8D8 JUMPI PUSH1 0x40 MLOAD PUSH4 0x1E4FBDF7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH0 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST PUSH2 0x6AB DUP2 PUSH2 0xCA5 JUMP JUMPDEST PUSH2 0x8E9 PUSH2 0xD60 JUMP JUMPDEST PUSH1 0x2 PUSH32 0x9B779B17422D0DF92223018B32B4D1FA46E071723D6817E2486D003BECC55F00 SSTORE JUMP JUMPDEST DUP4 MLOAD PUSH1 0x20 DUP1 DUP7 ADD SWAP2 SWAP1 SWAP2 KECCAK256 PUSH1 0x40 DUP1 MLOAD PUSH32 0xF0543E2024FD0AE16CCB842686C2733758EC65ACFD69FB599C05B286F8DB8844 SWAP4 DUP2 ADD SWAP4 SWAP1 SWAP4 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB PUSH32 0x0 DUP2 AND SWAP2 DUP5 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP1 DUP11 AND PUSH1 0x60 DUP5 ADD MSTORE DUP9 AND PUSH1 0x80 DUP4 ADD MSTORE PUSH1 0xA0 DUP3 ADD DUP8 SWAP1 MSTORE PUSH1 0xC0 DUP3 ADD MSTORE PUSH1 0xE0 DUP2 ADD DUP5 SWAP1 MSTORE PUSH2 0x100 DUP2 ADD DUP4 SWAP1 MSTORE PUSH2 0x120 DUP2 ADD DUP3 SWAP1 MSTORE PUSH0 SWAP1 PUSH2 0x9CF SWAP1 PUSH2 0x140 ADD PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 DUP4 SUB SUB DUP2 MSTORE SWAP1 PUSH1 0x40 MSTORE DUP1 MLOAD SWAP1 PUSH1 0x20 ADD KECCAK256 PUSH2 0xDA2 JUMP JUMPDEST SWAP9 SWAP8 POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH0 PUSH0 PUSH0 PUSH0 PUSH2 0x9EB DUP9 DUP9 DUP9 DUP9 PUSH2 0xDCE JUMP JUMPDEST SWAP3 POP SWAP3 POP SWAP3 POP PUSH2 0x9FB DUP3 DUP3 PUSH2 0xE96 JUMP JUMPDEST POP SWAP1 SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH4 0xD505ACCF PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP8 DUP2 AND PUSH1 0x4 DUP4 ADD MSTORE ADDRESS PUSH1 0x24 DUP4 ADD MSTORE PUSH1 0x44 DUP3 ADD DUP8 SWAP1 MSTORE PUSH1 0x64 DUP3 ADD DUP7 SWAP1 MSTORE PUSH1 0xFF DUP6 AND PUSH1 0x84 DUP4 ADD MSTORE PUSH1 0xA4 DUP3 ADD DUP5 SWAP1 MSTORE PUSH1 0xC4 DUP3 ADD DUP4 SWAP1 MSTORE DUP9 AND SWAP1 PUSH4 0xD505ACCF SWAP1 PUSH1 0xE4 ADD PUSH0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0xA72 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP GAS CALL SWAP3 POP POP POP DUP1 ISZERO PUSH2 0xA83 JUMPI POP PUSH1 0x1 JUMPDEST PUSH2 0xB57 JUMPI PUSH1 0x40 MLOAD PUSH4 0x6EB1769F PUSH1 0xE1 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP8 DUP2 AND PUSH1 0x4 DUP4 ADD MSTORE ADDRESS PUSH1 0x24 DUP4 ADD MSTORE DUP7 SWAP2 SWAP1 DUP10 AND SWAP1 PUSH4 0xDD62ED3E SWAP1 PUSH1 0x44 ADD PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP7 GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0xAD4 JUMPI RETURNDATASIZE PUSH0 PUSH0 RETURNDATACOPY RETURNDATASIZE PUSH0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0xAF8 SWAP2 SWAP1 PUSH2 0x14BD JUMP JUMPDEST LT ISZERO PUSH2 0xB57 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x28 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5065726D6974206661696C656420616E6420696E73756666696369656E742061 PUSH1 0x44 DUP3 ADD MSTORE PUSH8 0x6C6C6F77616E6365 PUSH1 0xC0 SHL PUSH1 0x64 DUP3 ADD MSTORE PUSH1 0x84 ADD PUSH2 0x281 JUMP JUMPDEST PUSH2 0xB6C PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP9 AND DUP8 ADDRESS DUP9 PUSH2 0xF52 JUMP JUMPDEST POP POP POP POP POP POP POP JUMP JUMPDEST PUSH2 0xB81 DUP4 DUP4 DUP4 PUSH0 PUSH2 0xF8E JUMP JUMPDEST PUSH2 0xBEF JUMPI PUSH2 0xB92 DUP4 DUP4 PUSH0 PUSH1 0x1 PUSH2 0xF8E JUMP JUMPDEST PUSH2 0xBBA JUMPI PUSH1 0x40 MLOAD PUSH4 0x5274AFE7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP5 AND PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST PUSH2 0xBC7 DUP4 DUP4 DUP4 PUSH1 0x1 PUSH2 0xF8E JUMP JUMPDEST PUSH2 0xBEF JUMPI PUSH1 0x40 MLOAD PUSH4 0x5274AFE7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP5 AND PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST POP POP POP JUMP JUMPDEST PUSH0 PUSH0 PUSH32 0x0 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP4 DUP6 PUSH1 0x40 MLOAD PUSH2 0xC2F SWAP2 SWAP1 PUSH2 0x14D4 JUMP JUMPDEST PUSH0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 DUP8 GAS CALL SWAP3 POP POP POP RETURNDATASIZE DUP1 PUSH0 DUP2 EQ PUSH2 0xC69 JUMPI PUSH1 0x40 MLOAD SWAP2 POP PUSH1 0x1F NOT PUSH1 0x3F RETURNDATASIZE ADD AND DUP3 ADD PUSH1 0x40 MSTORE RETURNDATASIZE DUP3 MSTORE RETURNDATASIZE PUSH0 PUSH1 0x20 DUP5 ADD RETURNDATACOPY PUSH2 0xC6E JUMP JUMPDEST PUSH1 0x60 SWAP2 POP JUMPDEST POP SWAP1 SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND CALLER EQ PUSH2 0x6BF JUMPI PUSH1 0x40 MLOAD PUSH4 0x118CDAA7 PUSH1 0xE0 SHL DUP2 MSTORE CALLER PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST PUSH0 DUP1 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP4 DUP2 AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB NOT DUP4 AND DUP2 OR DUP5 SSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP3 AND SWAP3 DUP4 SWAP2 PUSH32 0x8BE0079C531659141344CD1FD0A4F28419497F9722A3DAAFE3B4186F6B6457E0 SWAP2 SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x60 PUSH2 0xD21 PUSH32 0x0 PUSH1 0x1 PUSH2 0xFF0 JUMP JUMPDEST SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x60 PUSH2 0xD21 PUSH32 0x0 PUSH1 0x2 PUSH2 0xFF0 JUMP JUMPDEST PUSH2 0xBC7 DUP4 DUP4 DUP4 PUSH1 0x1 PUSH2 0x1099 JUMP JUMPDEST PUSH32 0x9B779B17422D0DF92223018B32B4D1FA46E071723D6817E2486D003BECC55F00 SLOAD PUSH1 0x2 SUB PUSH2 0x6BF JUMPI PUSH1 0x40 MLOAD PUSH4 0x3EE5AEB5 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH0 PUSH2 0x7B2 PUSH2 0xDAE PUSH2 0x10E3 JUMP JUMPDEST DUP4 PUSH1 0x40 MLOAD PUSH2 0x1901 PUSH1 0xF0 SHL DUP2 MSTORE PUSH1 0x2 DUP2 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x22 DUP3 ADD MSTORE PUSH1 0x42 SWAP1 KECCAK256 SWAP1 JUMP JUMPDEST PUSH0 DUP1 DUP1 PUSH32 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0 DUP5 GT ISZERO PUSH2 0xE07 JUMPI POP PUSH0 SWAP2 POP PUSH1 0x3 SWAP1 POP DUP3 PUSH2 0xE8C JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH0 DUP1 DUP3 MSTORE PUSH1 0x20 DUP3 ADD DUP1 DUP5 MSTORE DUP11 SWAP1 MSTORE PUSH1 0xFF DUP10 AND SWAP3 DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x60 DUP2 ADD DUP8 SWAP1 MSTORE PUSH1 0x80 DUP2 ADD DUP7 SWAP1 MSTORE PUSH1 0x1 SWAP1 PUSH1 0xA0 ADD PUSH1 0x20 PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 SUB SWAP1 DUP1 DUP5 SUB SWAP1 DUP6 GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0xE58 JUMPI RETURNDATASIZE PUSH0 PUSH0 RETURNDATACOPY RETURNDATASIZE PUSH0 REVERT JUMPDEST POP POP PUSH1 0x40 MLOAD PUSH1 0x1F NOT ADD MLOAD SWAP2 POP POP PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND PUSH2 0xE83 JUMPI POP PUSH0 SWAP3 POP PUSH1 0x1 SWAP2 POP DUP3 SWAP1 POP PUSH2 0xE8C JUMP JUMPDEST SWAP3 POP PUSH0 SWAP2 POP DUP2 SWAP1 POP JUMPDEST SWAP5 POP SWAP5 POP SWAP5 SWAP2 POP POP JUMP JUMPDEST PUSH0 DUP3 PUSH1 0x3 DUP2 GT ISZERO PUSH2 0xEA9 JUMPI PUSH2 0xEA9 PUSH2 0x14EA JUMP JUMPDEST SUB PUSH2 0xEB2 JUMPI POP POP JUMP JUMPDEST PUSH1 0x1 DUP3 PUSH1 0x3 DUP2 GT ISZERO PUSH2 0xEC6 JUMPI PUSH2 0xEC6 PUSH2 0x14EA JUMP JUMPDEST SUB PUSH2 0xEE4 JUMPI PUSH1 0x40 MLOAD PUSH4 0xF645EEDF PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x2 DUP3 PUSH1 0x3 DUP2 GT ISZERO PUSH2 0xEF8 JUMPI PUSH2 0xEF8 PUSH2 0x14EA JUMP JUMPDEST SUB PUSH2 0xF19 JUMPI PUSH1 0x40 MLOAD PUSH4 0xFCE698F7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 DUP2 ADD DUP3 SWAP1 MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST PUSH1 0x3 DUP3 PUSH1 0x3 DUP2 GT ISZERO PUSH2 0xF2D JUMPI PUSH2 0xF2D PUSH2 0x14EA JUMP JUMPDEST SUB PUSH2 0xF4E JUMPI PUSH1 0x40 MLOAD PUSH4 0x35E2F383 PUSH1 0xE2 SHL DUP2 MSTORE PUSH1 0x4 DUP2 ADD DUP3 SWAP1 MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST POP POP JUMP JUMPDEST PUSH2 0xF60 DUP5 DUP5 DUP5 DUP5 PUSH1 0x1 PUSH2 0x120C JUMP JUMPDEST PUSH2 0xF88 JUMPI PUSH1 0x40 MLOAD PUSH4 0x5274AFE7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP6 AND PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH4 0x95EA7B3 PUSH1 0xE0 SHL PUSH0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP7 AND PUSH1 0x4 MSTORE PUSH1 0x24 DUP6 SWAP1 MSTORE SWAP2 PUSH1 0x20 DUP4 PUSH1 0x44 DUP2 DUP1 DUP12 GAS CALL SWAP3 POP PUSH1 0x1 PUSH0 MLOAD EQ DUP4 AND PUSH2 0xFE4 JUMPI DUP4 DUP4 ISZERO AND ISZERO PUSH2 0xFD8 JUMPI RETURNDATASIZE PUSH0 DUP3 RETURNDATACOPY RETURNDATASIZE DUP2 REVERT JUMPDEST PUSH0 DUP8 EXTCODESIZE GT RETURNDATASIZE ISZERO AND DUP4 AND SWAP3 POP JUMPDEST PUSH1 0x40 MSTORE POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x60 PUSH1 0xFF DUP4 EQ PUSH2 0x100A JUMPI PUSH2 0x1003 DUP4 PUSH2 0x1279 JUMP JUMPDEST SWAP1 POP PUSH2 0x7B2 JUMP JUMPDEST DUP2 DUP1 SLOAD PUSH2 0x1016 SWAP1 PUSH2 0x14FE JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0x1042 SWAP1 PUSH2 0x14FE JUMP JUMPDEST DUP1 ISZERO PUSH2 0x108D JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x1064 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x108D JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH0 MSTORE PUSH1 0x20 PUSH0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x1070 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP PUSH2 0x7B2 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH4 0xA9059CBB PUSH1 0xE0 SHL PUSH0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP7 AND PUSH1 0x4 MSTORE PUSH1 0x24 DUP6 SWAP1 MSTORE SWAP2 PUSH1 0x20 DUP4 PUSH1 0x44 DUP2 DUP1 DUP12 GAS CALL SWAP3 POP PUSH1 0x1 PUSH0 MLOAD EQ DUP4 AND PUSH2 0xFE4 JUMPI DUP4 DUP4 ISZERO AND ISZERO PUSH2 0xFD8 JUMPI RETURNDATASIZE PUSH0 DUP3 RETURNDATACOPY RETURNDATASIZE DUP2 REVERT JUMPDEST PUSH0 ADDRESS PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB PUSH32 0x0 AND EQ DUP1 ISZERO PUSH2 0x113B JUMPI POP PUSH32 0x0 CHAINID EQ JUMPDEST ISZERO PUSH2 0x1165 JUMPI POP PUSH32 0x0 SWAP1 JUMP JUMPDEST PUSH2 0xD21 PUSH1 0x40 DUP1 MLOAD PUSH32 0x8B73C3C69BB8FE3D512ECC4CF759CC79239F7B179B0FFACAA9A75D522B39400F PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x0 SWAP2 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH32 0x0 PUSH1 0x60 DUP3 ADD MSTORE CHAINID PUSH1 0x80 DUP3 ADD MSTORE ADDRESS PUSH1 0xA0 DUP3 ADD MSTORE PUSH0 SWAP1 PUSH1 0xC0 ADD PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 DUP4 SUB SUB DUP2 MSTORE SWAP1 PUSH1 0x40 MSTORE DUP1 MLOAD SWAP1 PUSH1 0x20 ADD KECCAK256 SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH4 0x23B872DD PUSH1 0xE0 SHL PUSH0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP8 DUP2 AND PUSH1 0x4 MSTORE DUP7 AND PUSH1 0x24 MSTORE PUSH1 0x44 DUP6 SWAP1 MSTORE SWAP2 PUSH1 0x20 DUP4 PUSH1 0x64 DUP2 DUP1 DUP13 GAS CALL SWAP3 POP PUSH1 0x1 PUSH0 MLOAD EQ DUP4 AND PUSH2 0x1268 JUMPI DUP4 DUP4 ISZERO AND ISZERO PUSH2 0x125C JUMPI RETURNDATASIZE PUSH0 DUP3 RETURNDATACOPY RETURNDATASIZE DUP2 REVERT JUMPDEST PUSH0 DUP9 EXTCODESIZE GT RETURNDATASIZE ISZERO AND DUP4 AND SWAP3 POP JUMPDEST PUSH1 0x40 MSTORE POP PUSH0 PUSH1 0x60 MSTORE SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x60 PUSH0 PUSH2 0x1285 DUP4 PUSH2 0x12B6 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 DUP4 ADD SWAP1 SWAP3 MSTORE SWAP2 SWAP3 POP PUSH0 SWAP2 SWAP1 PUSH1 0x20 DUP3 ADD DUP2 DUP1 CALLDATASIZE DUP4 CALLDATACOPY POP POP POP SWAP2 DUP3 MSTORE POP PUSH1 0x20 DUP2 ADD SWAP3 SWAP1 SWAP3 MSTORE POP SWAP1 JUMP JUMPDEST PUSH0 PUSH1 0xFF DUP3 AND PUSH1 0x1F DUP2 GT ISZERO PUSH2 0x7B2 JUMPI PUSH1 0x40 MLOAD PUSH4 0x2CD44AC3 PUSH1 0xE2 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x12ED JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1303 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP3 ADD PUSH2 0x1C0 DUP2 DUP6 SUB SLT ISZERO PUSH2 0x1315 JUMPI PUSH0 PUSH0 REVERT JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH0 DUP2 MLOAD DUP1 DUP5 MSTORE DUP1 PUSH1 0x20 DUP5 ADD PUSH1 0x20 DUP7 ADD MCOPY PUSH0 PUSH1 0x20 DUP3 DUP7 ADD ADD MSTORE PUSH1 0x20 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND DUP6 ADD ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0xFF PUSH1 0xF8 SHL DUP9 AND DUP2 MSTORE PUSH1 0xE0 PUSH1 0x20 DUP3 ADD MSTORE PUSH0 PUSH2 0x1368 PUSH1 0xE0 DUP4 ADD DUP10 PUSH2 0x131C JUMP JUMPDEST DUP3 DUP2 SUB PUSH1 0x40 DUP5 ADD MSTORE PUSH2 0x137A DUP2 DUP10 PUSH2 0x131C JUMP JUMPDEST PUSH1 0x60 DUP5 ADD DUP9 SWAP1 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP8 AND PUSH1 0x80 DUP6 ADD MSTORE PUSH1 0xA0 DUP5 ADD DUP7 SWAP1 MSTORE DUP4 DUP2 SUB PUSH1 0xC0 DUP6 ADD MSTORE DUP5 MLOAD DUP1 DUP3 MSTORE PUSH1 0x20 DUP1 DUP8 ADD SWAP4 POP SWAP1 SWAP2 ADD SWAP1 PUSH0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x13CF JUMPI DUP4 MLOAD DUP4 MSTORE PUSH1 0x20 SWAP4 DUP5 ADD SWAP4 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x1 ADD PUSH2 0x13B1 JUMP JUMPDEST POP SWAP1 SWAP12 SWAP11 POP POP POP POP POP POP POP POP POP POP POP JUMP JUMPDEST DUP1 CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND DUP2 EQ PUSH2 0x13F6 JUMPI PUSH0 PUSH0 REVERT JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH0 PUSH0 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x140C JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x1415 DUP4 PUSH2 0x13E0 JUMP JUMPDEST SWAP5 PUSH1 0x20 SWAP4 SWAP1 SWAP4 ADD CALLDATALOAD SWAP4 POP POP POP JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x1433 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP CALLDATALOAD SWAP2 SWAP1 POP JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x144A JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x1315 DUP3 PUSH2 0x13E0 JUMP JUMPDEST PUSH0 PUSH0 DUP4 CALLDATALOAD PUSH1 0x1E NOT DUP5 CALLDATASIZE SUB ADD DUP2 SLT PUSH2 0x1468 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP4 ADD DUP1 CALLDATALOAD SWAP2 POP PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x1482 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH1 0x20 ADD SWAP2 POP CALLDATASIZE DUP2 SWAP1 SUB DUP3 SGT ISZERO PUSH2 0x1496 JUMPI PUSH0 PUSH0 REVERT JUMPDEST SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x14AD JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH1 0xFF DUP2 AND DUP2 EQ PUSH2 0x1315 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x14CD JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP MLOAD SWAP2 SWAP1 POP JUMP JUMPDEST PUSH0 DUP3 MLOAD DUP1 PUSH1 0x20 DUP6 ADD DUP5 MCOPY PUSH0 SWAP3 ADD SWAP2 DUP3 MSTORE POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x21 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST PUSH1 0x1 DUP2 DUP2 SHR SWAP1 DUP3 AND DUP1 PUSH2 0x1512 JUMPI PUSH1 0x7F DUP3 AND SWAP2 POP JUMPDEST PUSH1 0x20 DUP3 LT DUP2 SUB PUSH2 0x1530 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x22 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST POP SWAP2 SWAP1 POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 SWAP13 CALLVALUE 0xDB 0x2F PUSH16 0x83AF136A5340CCE7FE8EF554EA8EB633 PUSH6 0x6FBF9BFF3BD7 BALANCE 0xAE 0xC4 0xF PUSH5 0x736F6C6343 STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "1158:6897:22:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2995:1996;;;;;;:::i;:::-;;:::i;:::-;;2293:101:0;;;;;;;;;;;;;:::i;1519:44:22:-;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;576:32:23;;;558:51;;546:2;531:18;1519:44:22;;;;;;;;5228:557:16;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;:::i;1638:85:0:-;;;;;;;;;;-1:-1:-1;1684:7:0;1710:6;-1:-1:-1;;;;;1710:6:0;1638:85;;7236:186:22;;;;;;;;;;-1:-1:-1;7236:186:22;;;;;:::i;:::-;;:::i;1570:69::-;;;;;;;;;;-1:-1:-1;1570:69:22;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2805:14:23;;2798:22;2780:41;;2768:2;2753:18;1570:69:22;2640:187:23;7907:146:22;;;;;;;;;;-1:-1:-1;7907:146:22;;;;;:::i;:::-;;:::i;7619:216::-;;;;;;;;;;-1:-1:-1;7619:216:22;;;;;:::i;:::-;;:::i;2543:215:0:-;;;;;;;;;;-1:-1:-1;2543:215:0;;;;;:::i;:::-;;:::i;2995:1996:22:-;3023:21:11;:19;:21::i;:::-;3083:13:22::1;3099:12;::::0;;;::::1;::::0;::::1;;:::i;:::-;3083:28:::0;-1:-1:-1;3137:19:22::1;::::0;::::1;;-1:-1:-1::0;;;;;3201:19:22;::::1;3193:45;;;::::0;-1:-1:-1;;;3193:45:22;;3456:2:23;3193:45:22::1;::::0;::::1;3438:21:23::0;3495:2;3475:18;;;3468:30;-1:-1:-1;;;3514:18:23;;;3507:43;3567:18;;3193:45:22::1;;;;;;;;;3280:1;3256:12;;::::0;::::1;:6:::0;:12:::1;:::i;:::-;-1:-1:-1::0;;;;;3256:26:22::1;::::0;3248:52:::1;;;::::0;-1:-1:-1;;;3248:52:22;;3798:2:23;3248:52:22::1;::::0;::::1;3780:21:23::0;3837:2;3817:18;;;3810:30;-1:-1:-1;;;3856:18:23;;;3849:43;3909:18;;3248:52:22::1;3596:337:23::0;3248:52:22::1;-1:-1:-1::0;;;;;3319:24:22;::::1;;::::0;;;:17:::1;:24;::::0;;;;;;;:31;;;;;;;;;::::1;;3318:32;3310:55;;;::::0;-1:-1:-1;;;3310:55:22;;4140:2:23;3310:55:22::1;::::0;::::1;4122:21:23::0;4179:2;4159:18;;;4152:30;-1:-1:-1;;;4198:18:23;;;4191:40;4248:18;;3310:55:22::1;3938:334:23::0;3310:55:22::1;3402:6;:22;;;3383:15;:41;;3375:69;;;::::0;-1:-1:-1;;;3375:69:22;;4479:2:23;3375:69:22::1;::::0;::::1;4461:21:23::0;4518:2;4498:18;;;4491:30;-1:-1:-1;;;4537:18:23;;;4530:45;4592:18;;3375:69:22::1;4277:339:23::0;3375:69:22::1;3523:14;3540:215;3568:5:::0;3587:12:::1;;::::0;::::1;:6:::0;:12:::1;:::i;:::-;3613;::::0;::::1;;3639:18;;::::0;::::1;3613:6:::0;3639:18:::1;:::i;:::-;3540:215;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;::::0;;;;-1:-1:-1;;;;3671:19:22::1;::::0;::::1;;3704:5:::0;3723:22:::1;::::0;::::1;;3540:14;:215::i;:::-;3523:232:::0;-1:-1:-1;;;;;;3850:81:22;::::1;:72;3523:232:::0;3872:15:::1;::::0;;;::::1;::::0;::::1;;:::i;:::-;3889:6;:15;;;3906:6;:15;;;3850:13;:72::i;:::-;-1:-1:-1::0;;;;;3850:81:22::1;;3842:105;;;::::0;-1:-1:-1;;;3842:105:22;;5623:2:23;3842:105:22::1;::::0;::::1;5605:21:23::0;5662:2;5642:18;;;5635:30;-1:-1:-1;;;5681:18:23;;;5674:41;5732:18;;3842:105:22::1;5421:335:23::0;3842:105:22::1;3979:6;:19;;;3966:9;:32;3958:73;;;::::0;-1:-1:-1;;;3958:73:22;;5963:2:23;3958:73:22::1;::::0;::::1;5945:21:23::0;6002:2;5982:18;;;5975:30;6041;6021:18;;;6014:58;6089:18;;3958:73:22::1;5761:352:23::0;3958:73:22::1;-1:-1:-1::0;;;;;4158:24:22;::::1;;::::0;;;:17:::1;:24;::::0;;;;;;;:31;;;;;;;;:38;;-1:-1:-1;;4158:38:22::1;4192:4;4158:38;::::0;;4303:219:::1;::::0;4342:12:::1;::::0;;::::1;:6:::0;:12:::1;:::i;:::-;4368:5:::0;4387:12:::1;::::0;::::1;;4413:15;::::0;::::1;;4442:14;::::0;;;::::1;::::0;::::1;;:::i;:::-;4470:6;:14;;;4498:6;:14;;;4303:25;:219::i;:::-;4592:68;4626:19;4647:12;::::0;::::1;;4599;;::::0;::::1;4647:6:::0;4599:12:::1;:::i;:::-;-1:-1:-1::0;;;;;4592:33:22::1;::::0;:68;:33:::1;:68::i;:::-;4671:16;4690:43;4703:18;;::::0;::::1;:6:::0;:18:::1;:::i;:::-;4690:43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;::::0;;;;-1:-1:-1;4723:9:22::1;::::0;-1:-1:-1;4690:12:22::1;::::0;-1:-1:-1;;4690:43:22:i:1;:::-;4671:62;;4751:11;4743:35;;;::::0;-1:-1:-1;;;4743:35:22;;6320:2:23;4743:35:22::1;::::0;::::1;6302:21:23::0;6359:2;6339:18;;;6332:30;-1:-1:-1;;;6378:18:23;;;6371:41;6429:18;;4743:35:22::1;6118:335:23::0;4743:35:22::1;4861:57;4895:19;4916:1;4868:12;;::::0;::::1;:6:::0;:12:::1;:::i;4861:57::-;4957:12;;::::0;::::1;:6:::0;:12:::1;:::i;:::-;-1:-1:-1::0;;;;;4934:50:22::1;4950:5;-1:-1:-1::0;;;;;4934:50:22::1;;4971:6;:12;;;4934:50;;;;6604:25:23::0;;6592:2;6577:18;;6458:177;4934:50:22::1;;;;;;;;3073:1918;;;;3065:20:11::0;2365:1;1505:66;3972:62;3749:292;3065:20;2995:1996:22;:::o;2293:101:0:-;1531:13;:11;:13::i;:::-;2357:30:::1;2384:1;2357:18;:30::i;:::-;2293:101::o:0;5228:557:16:-;5326:13;5353:18;5385:21;5420:15;5449:25;5488:12;5514:27;5617:13;:11;:13::i;:::-;5644:16;:14;:16::i;:::-;5752;;;5736:1;5752:16;;;;;;;;;-1:-1:-1;;;5566:212:16;;;-1:-1:-1;5566:212:16;;-1:-1:-1;5674:13:16;;-1:-1:-1;5709:4:16;;-1:-1:-1;5736:1:16;-1:-1:-1;5752:16:16;-1:-1:-1;5566:212:16;-1:-1:-1;5228:557:16:o;7236:186:22:-;1531:13:0;:11;:13::i;:::-;7319:43:22::1;7346:7;1684::0::0;1710:6;-1:-1:-1;;;;;1710:6:0;;1638:85;7346:7:22::1;-1:-1:-1::0;;;;;7319:26:22;::::1;::::0;7355:6;7319:26:::1;:43::i;:::-;1684:7:0::0;1710:6;-1:-1:-1;;;;;1710:6:0;-1:-1:-1;;;;;7377:38:22::1;7392:5;-1:-1:-1::0;;;;;7377:38:22::1;;7399:6;7377:38;;;;6604:25:23::0;;6592:2;6577:18;;6458:177;7377:38:22::1;;;;;;;;7236:186:::0;;:::o;7907:146::-;-1:-1:-1;;;;;8014:25:22;;7991:4;8014:25;;;:17;:25;;;;;;;;:32;;;;;;;;;;;7907:146;;;;;:::o;7619:216::-;1531:13:0;:11;:13::i;:::-;7686:12:22::1;1710:6:0::0;;7704:31:22::1;::::0;-1:-1:-1;;;;;1710:6:0;;;;7724::22;;7686:12;7704:31;7686:12;7704:31;7724:6;1710::0;7704:31:22::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7685:50;;;7753:7;7745:39;;;::::0;-1:-1:-1;;;7745:39:22;;7184:2:23;7745:39:22::1;::::0;::::1;7166:21:23::0;7223:2;7203:18;;;7196:30;-1:-1:-1;;;7242:18:23;;;7235:49;7301:18;;7745:39:22::1;6982:343:23::0;7745:39:22::1;1684:7:0::0;1710:6;-1:-1:-1;;;;;1710:6:0;-1:-1:-1;;;;;7799:29:22::1;;7812:6;7799:29;;;;6604:25:23::0;;6592:2;6577:18;;6458:177;7799:29:22::1;;;;;;;;7675:160;7619:216:::0;:::o;2543:215:0:-;1531:13;:11;:13::i;:::-;-1:-1:-1;;;;;2627:22:0;::::1;2623:91;;2672:31;::::0;-1:-1:-1;;;2672:31:0;;2700:1:::1;2672:31;::::0;::::1;558:51:23::0;531:18;;2672:31:0::1;412:203:23::0;2623:91:0::1;2723:28;2742:8;2723:18;:28::i;3749:292:11:-:0;3872:25;:23;:25::i;:::-;2407:1;1505:66;3972:62;3749:292::o;5053:632:22:-;5563:15;;;;;;;;;;5342:325;;;1356:156;5342:325;;;7701:25:23;;;;-1:-1:-1;;;;;5406:19:22;7762:32:23;;7742:18;;;7735:60;;;;7831:32;;;7811:18;;;7804:60;7900:32;;7880:18;;;7873:60;7949:19;;;7942:35;;;7993:19;;;7986:35;8037:19;;;8030:35;;;8081:19;;;8074:35;;;8125:19;;;8118:35;;;5276:7:22;;5302:376;;7673:19:23;;5342:325:22;;;;;;;;;;;;5332:336;;;;;;5302:16;:376::i;:::-;5295:383;5053:632;-1:-1:-1;;;;;;;;5053:632:22:o;8813:260:15:-;8898:7;8918:17;8937:18;8957:16;8977:25;8988:4;8994:1;8997;9000;8977:10;:25::i;:::-;8917:85;;;;;;9012:28;9024:5;9031:8;9012:11;:28::i;:::-;-1:-1:-1;9057:9:15;;8813:260;-1:-1:-1;;;;;;8813:260:15:o;5941:777:22:-;6216:74;;-1:-1:-1;;;6216:74:22;;-1:-1:-1;;;;;8493:32:23;;;6216:74:22;;;8475:51:23;6258:4:22;8542:18:23;;;8535:60;8611:18;;;8604:34;;;8654:18;;;8647:34;;;8730:4;8718:17;;8697:19;;;8690:46;8752:19;;;8745:35;;;8796:19;;;8789:35;;;6216:26:22;;;;;8447:19:23;;6216:74:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6212:375;;6448:45;;-1:-1:-1;;;6448:45:22;;-1:-1:-1;;;;;9027:32:23;;;6448:45:22;;;9009:51:23;6487:4:22;9076:18:23;;;9069:60;6497:5:22;;6448:23;;;;;;8982:18:23;;6448:45:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:54;;6423:153;;;;-1:-1:-1;;;6423:153:22;;9531:2:23;6423:153:22;;;9513:21:23;9570:2;9550:18;;;9543:30;9609:34;9589:18;;;9582:62;-1:-1:-1;;;9660:18:23;;;9653:38;9708:19;;6423:153:22;9329:404:23;6423:153:22;6652:59;-1:-1:-1;;;;;6652:30:22;;6683:5;6698:4;6705:5;6652:30;:59::i;:::-;5941:777;;;;;;;:::o;5098:367:7:-;5190:42;5203:5;5210:7;5219:5;5226;5190:12;:42::i;:::-;5185:274;;5253:37;5266:5;5273:7;5282:1;5285:4;5253:12;:37::i;:::-;5248:91;;5299:40;;-1:-1:-1;;;5299:40:7;;-1:-1:-1;;;;;576:32:23;;5299:40:7;;;558:51:23;531:18;;5299:40:7;412:203:23;5248:91:7;5358:41;5371:5;5378:7;5387:5;5394:4;5358:12;:41::i;:::-;5353:95;;5408:40;;-1:-1:-1;;;5408:40:7;;-1:-1:-1;;;;;576:32:23;;5408:40:7;;;558:51:23;531:18;;5408:40:7;412:203:23;5353:95:7;5098:367;;;:::o;6724:184:22:-;6798:4;6815:12;6833:19;-1:-1:-1;;;;;6833:24:22;6865:5;6872:4;6833:44;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;6814:63:22;;6724:184;-1:-1:-1;;;;;6724:184:22:o;1796:162:0:-;1684:7;1710:6;-1:-1:-1;;;;;1710:6:0;735:10:9;1855:23:0;1851:101;;1901:40;;-1:-1:-1;;;1901:40:0;;735:10:9;1901:40:0;;;558:51:23;531:18;;1901:40:0;412:203:23;2912:187:0;2985:16;3004:6;;-1:-1:-1;;;;;3020:17:0;;;-1:-1:-1;;;;;;3020:17:0;;;;;;3052:40;;3004:6;;;;;;;3052:40;;2985:16;3052:40;2975:124;2912:187;:::o;6105:126:16:-;6151:13;6183:41;:5;6210:13;6183:26;:41::i;:::-;6176:48;;6105:126;:::o;6557:135::-;6606:13;6638:47;:8;6668:16;6638:29;:47::i;1219:204:7:-;1306:37;1320:5;1327:2;1331:5;1338:4;1306:13;:37::i;3586:157:11:-;1505:66;4560:52;2407:1;4560:63;3644:93;;3696:30;;-1:-1:-1;;;3696:30:11;;;;;;;;;;;5017:176:16;5094:7;5120:66;5153:20;:18;:20::i;:::-;5175:10;4093:4:17;4087:11;-1:-1:-1;;;4111:23:17;;4163:4;4154:14;;4147:39;;;;4215:4;4206:14;;4199:34;4271:4;4256:20;;;3918:374;7129:1551:15;7255:17;;;8209:66;8196:79;;8192:164;;;-1:-1:-1;8307:1:15;;-1:-1:-1;8311:30:15;;-1:-1:-1;8343:1:15;8291:54;;8192:164;8467:24;;;8450:14;8467:24;;;;;;;;;10271:25:23;;;10344:4;10332:17;;10312:18;;;10305:45;;;;10366:18;;;10359:34;;;10409:18;;;10402:34;;;8467:24:15;;10243:19:23;;8467:24:15;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;8467:24:15;;-1:-1:-1;;8467:24:15;;;-1:-1:-1;;;;;;;8505:20:15;;8501:113;;-1:-1:-1;8557:1:15;;-1:-1:-1;8561:29:15;;-1:-1:-1;8557:1:15;;-1:-1:-1;8541:62:15;;8501:113;8632:6;-1:-1:-1;8640:20:15;;-1:-1:-1;8640:20:15;;-1:-1:-1;7129:1551:15;;;;;;;;;:::o;11617:532::-;11712:20;11703:5;:29;;;;;;;;:::i;:::-;;11699:444;;11617:532;;:::o;11699:444::-;11808:29;11799:5;:38;;;;;;;;:::i;:::-;;11795:348;;11860:23;;-1:-1:-1;;;11860:23:15;;;;;;;;;;;11795:348;11913:35;11904:5;:44;;;;;;;;:::i;:::-;;11900:243;;11971:46;;-1:-1:-1;;;11971:46:15;;;;;6604:25:23;;;6577:18;;11971:46:15;6458:177:23;11900:243:15;12047:30;12038:5;:39;;;;;;;;:::i;:::-;;12034:109;;12100:32;;-1:-1:-1;;;12100:32:15;;;;;6604:25:23;;;6577:18;;12100:32:15;6458:177:23;12034:109:15;11617:532;;:::o;1662:232:7:-;1767:47;1785:5;1792:4;1798:2;1802:5;1809:4;1767:17;:47::i;:::-;1762:126;;1837:40;;-1:-1:-1;;;1837:40:7;;-1:-1:-1;;;;;576:32:23;;1837:40:7;;;558:51:23;531:18;;1837:40:7;412:203:23;1762:126:7;1662:232;;;;:::o;12059:1252::-;12289:4;12283:11;-1:-1:-1;;;12157:12:7;12307:22;;;-1:-1:-1;;;;;12355:29:7;;12349:4;12342:43;12405:4;12398:19;;;12157:12;12481:4;12157:12;12469:4;12157:12;;12453:5;12446;12441:45;12430:56;;12698:1;12691:4;12685:11;12682:18;12673:7;12669:32;12659:606;;12830:6;12820:7;12813:15;12809:28;12806:165;;;12886:16;12880:4;12875:3;12860:43;12936:16;12931:3;12924:29;12806:165;13247:1;13239:5;13227:18;13224:25;13205:16;13198:24;13194:56;13185:7;13181:70;13170:81;;12659:606;13285:4;13278:17;-1:-1:-1;12059:1252:7;;-1:-1:-1;;;;12059:1252:7:o;3376:267:12:-;3470:13;1390:66;3499:46;;3495:142;;3568:15;3577:5;3568:8;:15::i;:::-;3561:22;;;;3495:142;3621:5;3614:12;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8373:1244:7;8600:4;8594:11;-1:-1:-1;;;8467:12:7;8618:22;;;-1:-1:-1;;;;;8666:24:7;;8660:4;8653:38;8711:4;8704:19;;;8467:12;8787:4;8467:12;8775:4;8467:12;;8759:5;8752;8747:45;8736:56;;9004:1;8997:4;8991:11;8988:18;8979:7;8975:32;8965:606;;9136:6;9126:7;9119:15;9115:28;9112:165;;;9192:16;9186:4;9181:3;9166:43;9242:16;9237:3;9230:29;3945:262:16;3998:7;4029:4;-1:-1:-1;;;;;4038:11:16;4021:28;;:63;;;;;4070:14;4053:13;:31;4021:63;4017:184;;;-1:-1:-1;4107:22:16;;3945:262::o;4017:184::-;4167:23;4304:80;;;2079:95;4304:80;;;11405:25:23;4326:11:16;11446:18:23;;;11439:34;;;;4339:14:16;11489:18:23;;;11482:34;4355:13:16;11532:18:23;;;11525:34;4378:4:16;11575:19:23;;;11568:61;4268:7:16;;11377:19:23;;4304:80:16;;;;;;;;;;;;4294:91;;;;;;4287:98;;4213:179;;10165:1393:7;10460:4;10454:11;-1:-1:-1;;;10323:12:7;10478:22;;;-1:-1:-1;;;;;10526:26:7;;;10520:4;10513:40;10579:24;;10573:4;10566:38;10624:4;10617:19;;;10323:12;10700:4;10323:12;10688:4;10323:12;;10672:5;10665;10660:45;10649:56;;10917:1;10910:4;10904:11;10901:18;10892:7;10888:32;10878:606;;11049:6;11039:7;11032:15;11028:28;11025:165;;;11105:16;11099:4;11094:3;11079:43;11155:16;11150:3;11143:29;11025:165;11466:1;11458:5;11446:18;11443:25;11424:16;11417:24;11413:56;11404:7;11400:70;11389:81;;10878:606;11504:4;11497:17;-1:-1:-1;11540:1:7;11534:4;11527:15;10165:1393;;-1:-1:-1;;;;;10165:1393:7:o;2080:380:12:-;2139:13;2164:11;2178:16;2189:4;2178:10;:16::i;:::-;2302;;;2313:4;2302:16;;;;;;;;;2164:30;;-1:-1:-1;2282:17:12;;2302:16;;;;;;;;;-1:-1:-1;;;2367:16:12;;;-1:-1:-1;2412:4:12;2403:14;;2396:28;;;;-1:-1:-1;2367:16:12;2080:380::o;2532:247::-;2593:7;2665:4;2629:40;;2692:4;2683:13;;2679:71;;;2719:20;;-1:-1:-1;;;2719:20:12;;;;;;;;;;;14:393:23;106:6;159:2;147:9;138:7;134:23;130:32;127:52;;;175:1;172;165:12;127:52;215:9;202:23;248:18;240:6;237:30;234:50;;;280:1;277;270:12;234:50;303:22;;359:3;341:16;;;337:26;334:46;;;376:1;373;366:12;334:46;399:2;14:393;-1:-1:-1;;;14:393:23:o;620:289::-;662:3;700:5;694:12;727:6;722:3;715:19;783:6;776:4;769:5;765:16;758:4;753:3;749:14;743:47;835:1;828:4;819:6;814:3;810:16;806:27;799:38;898:4;891:2;887:7;882:2;874:6;870:15;866:29;861:3;857:39;853:50;846:57;;;620:289;;;;:::o;914:1238::-;1320:3;1315;1311:13;1303:6;1299:26;1288:9;1281:45;1362:3;1357:2;1346:9;1342:18;1335:31;1262:4;1389:46;1430:3;1419:9;1415:19;1407:6;1389:46;:::i;:::-;1483:9;1475:6;1471:22;1466:2;1455:9;1451:18;1444:50;1517:33;1543:6;1535;1517:33;:::i;:::-;1581:2;1566:18;;1559:34;;;-1:-1:-1;;;;;1630:32:23;;1624:3;1609:19;;1602:61;1650:3;1679:19;;1672:35;;;1744:22;;;1738:3;1723:19;;1716:51;1816:13;;1838:22;;;1888:2;1914:15;;;;-1:-1:-1;1876:15:23;;;;-1:-1:-1;1957:169:23;1971:6;1968:1;1965:13;1957:169;;;2032:13;;2020:26;;2075:2;2101:15;;;;2066:12;;;;1993:1;1986:9;1957:169;;;-1:-1:-1;2143:3:23;;914:1238;-1:-1:-1;;;;;;;;;;;914:1238:23:o;2157:173::-;2225:20;;-1:-1:-1;;;;;2274:31:23;;2264:42;;2254:70;;2320:1;2317;2310:12;2254:70;2157:173;;;:::o;2335:300::-;2403:6;2411;2464:2;2452:9;2443:7;2439:23;2435:32;2432:52;;;2480:1;2477;2470:12;2432:52;2503:29;2522:9;2503:29;:::i;:::-;2493:39;2601:2;2586:18;;;;2573:32;;-1:-1:-1;;;2335:300:23:o;2832:226::-;2891:6;2944:2;2932:9;2923:7;2919:23;2915:32;2912:52;;;2960:1;2957;2950:12;2912:52;-1:-1:-1;3005:23:23;;2832:226;-1:-1:-1;2832:226:23:o;3063:186::-;3122:6;3175:2;3163:9;3154:7;3150:23;3146:32;3143:52;;;3191:1;3188;3181:12;3143:52;3214:29;3233:9;3214:29;:::i;4621:521::-;4698:4;4704:6;4764:11;4751:25;4858:2;4854:7;4843:8;4827:14;4823:29;4819:43;4799:18;4795:68;4785:96;;4877:1;4874;4867:12;4785:96;4904:33;;4956:20;;;-1:-1:-1;4999:18:23;4988:30;;4985:50;;;5031:1;5028;5021:12;4985:50;5064:4;5052:17;;-1:-1:-1;5095:14:23;5091:27;;;5081:38;;5078:58;;;5132:1;5129;5122:12;5078:58;4621:521;;;;;:::o;5147:269::-;5204:6;5257:2;5245:9;5236:7;5232:23;5228:32;5225:52;;;5273:1;5270;5263:12;5225:52;5312:9;5299:23;5362:4;5355:5;5351:16;5344:5;5341:27;5331:55;;5382:1;5379;5372:12;9140:184;9210:6;9263:2;9251:9;9242:7;9238:23;9234:32;9231:52;;;9279:1;9276;9269:12;9231:52;-1:-1:-1;9302:16:23;;9140:184;-1:-1:-1;9140:184:23:o;9738:301::-;9867:3;9905:6;9899:13;9951:6;9944:4;9936:6;9932:17;9927:3;9921:37;10013:1;9977:16;;10002:13;;;-1:-1:-1;9977:16:23;9738:301;-1:-1:-1;9738:301:23:o;10447:127::-;10508:10;10503:3;10499:20;10496:1;10489:31;10539:4;10536:1;10529:15;10563:4;10560:1;10553:15;10761:380;10840:1;10836:12;;;;10883;;;10904:61;;10958:4;10950:6;10946:17;10936:27;;10904:61;11011:2;11003:6;11000:14;10980:18;10977:38;10974:161;;11057:10;11052:3;11048:20;11045:1;11038:31;11092:4;11089:1;11082:15;11120:4;11117:1;11110:15;10974:161;;10761:380;;;:::o" + }, + "methodIdentifiers": { + "destinationContract()": "75bd6863", + "eip712Domain()": "84b0196e", + "execute((address,address,uint256,uint256,uint8,bytes32,bytes32,bytes,uint256,uint256,uint256,uint8,bytes32,bytes32))": "2af83bfe", + "isExecutionCompleted(address,uint256)": "dcb79457", + "owner()": "8da5cb5b", + "renounceOwnership()": "715018a6", + "transferOwnership(address)": "f2fde38b", + "usedPayloadNonces(address,uint256)": "d850124e", + "withdrawETH(uint256)": "f14210a6", + "withdrawToken(address,uint256)": "9e281a98" + } + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_destinationContract\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ECDSAInvalidSignature\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"length\",\"type\":\"uint256\"}],\"name\":\"ECDSAInvalidSignatureLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"ECDSAInvalidSignatureS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidShortString\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"OwnableInvalidOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"OwnableUnauthorizedAccount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ReentrancyGuardReentrantCall\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"SafeERC20FailedOperation\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"str\",\"type\":\"string\"}],\"name\":\"StringTooLong\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"EIP712DomainChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"ETHWithdrawn\",\"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\":true,\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RelayerExecuted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"TokenWithdrawn\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"destinationContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"eip712Domain\",\"outputs\":[{\"internalType\":\"bytes1\",\"name\":\"fields\",\"type\":\"bytes1\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"verifyingContract\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"extensions\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"permitV\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"permitR\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"permitS\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"payloadData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"payloadValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"payloadNonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"payloadDeadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"payloadV\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"payloadR\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"payloadS\",\"type\":\"bytes32\"}],\"internalType\":\"struct TokenRelayer.ExecuteParams\",\"name\":\"params\",\"type\":\"tuple\"}],\"name\":\"execute\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"name\":\"isExecutionCompleted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"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\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"usedPayloadNonces\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdrawETH\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdrawToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"errors\":{\"ECDSAInvalidSignature()\":[{\"details\":\"The signature is invalid.\"}],\"ECDSAInvalidSignatureLength(uint256)\":[{\"details\":\"The signature has an invalid length.\"}],\"ECDSAInvalidSignatureS(bytes32)\":[{\"details\":\"The signature has an S value that is in the upper half order.\"}],\"OwnableInvalidOwner(address)\":[{\"details\":\"The owner is not a valid owner account. (eg. `address(0)`)\"}],\"OwnableUnauthorizedAccount(address)\":[{\"details\":\"The caller account is not authorized to perform an operation.\"}],\"ReentrancyGuardReentrantCall()\":[{\"details\":\"Unauthorized reentrant call.\"}],\"SafeERC20FailedOperation(address)\":[{\"details\":\"An operation with an ERC-20 token failed.\"}]},\"events\":{\"EIP712DomainChanged()\":{\"details\":\"MAY be emitted to signal that the domain could have changed.\"}},\"kind\":\"dev\",\"methods\":{\"eip712Domain()\":{\"details\":\"returns the fields and values that describe the domain separator used by this contract for EIP-712 signature.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"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.\"},\"withdrawETH(uint256)\":{\"params\":{\"amount\":\"The amount of ETH to transfer to the owner.\"}},\"withdrawToken(address,uint256)\":{\"params\":{\"amount\":\"The amount of tokens to transfer to the owner.\",\"token\":\"The ERC20 token contract address.\"}}},\"title\":\"TokenRelayer\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"withdrawETH(uint256)\":{\"notice\":\"Allows the owner to recover any native ETH held by this contract.\"},\"withdrawToken(address,uint256)\":{\"notice\":\"Allows the owner to recover any ERC20 tokens held by this contract.\"}},\"notice\":\"A relayer contract that accepts ERC20 permit signatures and executes arbitrary calls to a destination contract, both authorized via signature. Flow: 1. User signs a permit allowing the relayer to spend their tokens 2. User signs a payload (e.g., transfer from relayer to another user) 3. Relayer: a. Executes permit to approve the tokens b. Transfers tokens from user to relayer (via transferFrom) c. Forwards the payload call (transfer from relayer to another user)\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/TokenRelayer.sol\":\"TokenRelayer\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"keccak256\":\"0xff6d0bb2e285473e5311d9d3caacb525ae3538a80758c10649a4d61029b017bb\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8ed324d3920bb545059d66ab97d43e43ee85fd3bd52e03e401f020afb0b120f6\",\"dweb:/ipfs/QmfEckWLmZkDDcoWrkEvMWhms66xwTLff9DDhegYpvHo1a\"]},\"@openzeppelin/contracts/interfaces/IERC1363.sol\":{\"keccak256\":\"0xd5ea07362ab630a6a3dee4285a74cf2377044ca2e4be472755ad64d7c5d4b69d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://da5e832b40fc5c3145d3781e2e5fa60ac2052c9d08af7e300dc8ab80c4343100\",\"dweb:/ipfs/QmTzf7N5ZUdh5raqtzbM11yexiUoLC9z3Ws632MCuycq1d\"]},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"keccak256\":\"0x0afcb7e740d1537b252cb2676f600465ce6938398569f09ba1b9ca240dde2dfc\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1c299900ac4ec268d4570ecef0d697a3013cd11a6eb74e295ee3fbc945056037\",\"dweb:/ipfs/Qmab9owJoxcA7vJT5XNayCMaUR1qxqj1NDzzisduwaJMcZ\"]},\"@openzeppelin/contracts/interfaces/IERC20.sol\":{\"keccak256\":\"0x1a6221315ce0307746c2c4827c125d821ee796c74a676787762f4778671d4f44\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1bb2332a7ee26dd0b0de9b7fe266749f54820c99ab6a3bcb6f7e6b751d47ee2d\",\"dweb:/ipfs/QmcRWpaBeCYkhy68PR3B4AgD7asuQk7PwkWxrvJbZcikLF\"]},\"@openzeppelin/contracts/interfaces/IERC5267.sol\":{\"keccak256\":\"0xfb223a85dd0b2175cfbbaa325a744e2cd74ecd17c3df2b77b0722f991d2725ee\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://84bf1dea0589ec49c8d15d559cc6d86ee493048a89b2d4adb60fbe705a3d89ae\",\"dweb:/ipfs/Qmd56n556d529wk2pRMhYhm5nhMDhviwereodDikjs68w1\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x74ed01eb66b923d0d0cfe3be84604ac04b76482a55f9dd655e1ef4d367f95bc2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5282825a626cfe924e504274b864a652b0023591fa66f06a067b25b51ba9b303\",\"dweb:/ipfs/QmeCfPykghhMc81VJTrHTC7sF6CRvaA1FXVq2pJhwYp1dV\"]},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\":{\"keccak256\":\"0x53befc41288eaa87edcd3a7be7e8475a32e44c6a29f9bf52fae789781301d9ff\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a1d7fab53c4ceaf42391b83d9b36d7e9cc524a8da125cffdcd32c56560f9d1c9\",\"dweb:/ipfs/QmaRZdVhQdqNXofeimibkBG65q9GVcXVZEGpycwwX3znC6\"]},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"keccak256\":\"0x304d732678032a9781ae85c8f204c8fba3d3a5e31c02616964e75cfdc5049098\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://299ced486011781dc98f638059678323c03079fefae1482abaa2135b22fa92d0\",\"dweb:/ipfs/QmbZNbcPTBxNvwChavN2kkZZs7xHhYL7mv51KrxMhsMs3j\"]},\"@openzeppelin/contracts/utils/Bytes.sol\":{\"keccak256\":\"0xf80e4b96b6849936ea0fabd76cf81b13d7276295fddb1e1c07afb3ddf650b0ac\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6430007255ac11c6e9c4331a418f3af52ff66fbbae959f645301d025b20aeb08\",\"dweb:/ipfs/QmQE5fjmBBRw9ndnzJuC2uskYss1gbaR7JdazoCf1FGoBj\"]},\"@openzeppelin/contracts/utils/Context.sol\":{\"keccak256\":\"0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6a708e8a5bdb1011c2c381c9a5cfd8a9a956d7d0a9dc1bd8bcdaf52f76ef2f12\",\"dweb:/ipfs/Qmax9WHBnVsZP46ZxEMNRQpLQnrdE4dK8LehML1Py8FowF\"]},\"@openzeppelin/contracts/utils/Panic.sol\":{\"keccak256\":\"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c6a5ff4f9fd8649b7ee20800b7fa387d3465bd77cf20c2d1068cd5c98e1ed57a\",\"dweb:/ipfs/QmVSaVJf9FXFhdYEYeCEfjMVHrxDh5qL4CGkxdMWpQCrqG\"]},\"@openzeppelin/contracts/utils/ReentrancyGuard.sol\":{\"keccak256\":\"0xa516cbf1c7d15d3517c2d668601ce016c54395bf5171918a14e2686977465f53\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1e1d079e8edfb58efd23a311e315a4807b01b5d1cf153f8fa2d0608b9dec3e99\",\"dweb:/ipfs/QmTBExeX2SDTkn5xbk5ssbYSx7VqRp9H4Ux1CY4uQM4b9N\"]},\"@openzeppelin/contracts/utils/ShortStrings.sol\":{\"keccak256\":\"0x0768b3bdb701fe4994b3be932ca8635551dfebe04c645f77500322741bebf57c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a2059f9ca8d3c11c49ca49fc9c5fb070f18cc85d12a7688e45322ed0e2a1cb99\",\"dweb:/ipfs/QmS2gwX51RAvSw4tYbjHccY2CKbh2uvDzqHLAFXdsddgia\"]},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"keccak256\":\"0xcf74f855663ce2ae00ed8352666b7935f6cddea2932fdf2c3ecd30a9b1cd0e97\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9f660b1f351b757dfe01438e59888f31f33ded3afcf5cb5b0d9bf9aa6f320a8b\",\"dweb:/ipfs/QmarDJ5hZEgBtCmmrVzEZWjub9769eD686jmzb2XpSU1cM\"]},\"@openzeppelin/contracts/utils/Strings.sol\":{\"keccak256\":\"0x1fdc2de9585ab0f1c417f02a873a2b6343cd64bb7ffec6b00ffa11a4a158d9e8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1ab223a3d969c6cd7610049431dd42740960c477e45878f5d8b54411f7a32bdc\",\"dweb:/ipfs/QmWumhjvhpKcwx3vDPQninsNVTc3BGvqaihkQakFkQYpaS\"]},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"keccak256\":\"0xbeb5cad8aaabe0d35d2ec1a8414d91e81e5a8ca679add4cf57e2f33476861f40\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ebb272a5ee2da4e8bd5551334e0ce8dce4e9c56a04570d6bf046d260fab3116a\",\"dweb:/ipfs/QmNw6RyM769qcqFocDq6HJMG2WiEnQbvizpRaUXsACHho2\"]},\"@openzeppelin/contracts/utils/cryptography/EIP712.sol\":{\"keccak256\":\"0x8440117ea216b97a7bad690a67449fd372c840d073c8375822667e14702782b4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ebb6645995b8290d0b9121825e2533e4e28977b2c6befee76e15e58f0feb61d4\",\"dweb:/ipfs/QmVR72j6kL5R2txuihieDev1FeTi4KWJS1Z6ABbwL3Qtph\"]},\"@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol\":{\"keccak256\":\"0x6d8579873b9650426bfbd2a754092d1725049ca05e4e3c8c2c82dd9f3453129d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1fa3127a8968d55096d37124a9e212013af112affa5e30b84a1d22263c31576c\",\"dweb:/ipfs/QmetxaVcn5Q6nkpF9yXzaxPQ7d3rgrhV13sTH9BgiuzGJL\"]},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x8891738ffe910f0cf2da09566928589bf5d63f4524dd734fd9cedbac3274dd5c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://971f954442df5c2ef5b5ebf1eb245d7105d9fbacc7386ee5c796df1d45b21617\",\"dweb:/ipfs/QmadRjHbkicwqwwh61raUEapaVEtaLMcYbQZWs9gUkgj3u\"]},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"keccak256\":\"0x59973a93b1f983f94e10529f46ca46544a9fec2b5f56fb1390bbe9e0dc79f857\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c55ef8f0b9719790c2ae6f81d80a59ffb89f2f0abe6bc065585bd79edce058c5\",\"dweb:/ipfs/QmNNmCbX9NjPXKqHJN8R1WC2rNeZSQrPZLd6FF6AKLyH5Y\"]},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"keccak256\":\"0xc8cae21c9ae4a46e5162ff9bf5b351d6fa6a6eba72d515f3bc1bdfeda7fdf083\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce830ebcf28e31643caba318996db3763c36d52cd0f23798ba83c135355d45e9\",\"dweb:/ipfs/QmdGPcvptHN7UBCbUYBbRX3hiRVRFLRwno8b4uga6uFNif\"]},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"keccak256\":\"0xb1970fac7b64e6c09611e6691791e848d5e3fe410fa5899e7df2e0afd77a99e3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://db5fbb3dddd8b7047465b62575d96231ba8a2774d37fb4737fbf23340fabbb03\",\"dweb:/ipfs/QmVUSvooZKEdEdap619tcJjTLcAuH6QBdZqAzWwnAXZAWJ\"]},\"contracts/TokenRelayer.sol\":{\"keccak256\":\"0xa26c2b15e35622e16d260cc4de183ff686e24494dd64b25ef444068239a8eee4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f7e63a4f9e7b5f70ee521378c3009982c70603b25526a6dcc516a4761dfb3d2d\",\"dweb:/ipfs/QmSNc84AJ2RXBPx9rHrJkyPwAbgcqBdQUQ76cJV9qYWMTF\"]}},\"version\":1}" + } + } + } + } +} \ No newline at end of file diff --git a/contracts/relayer/ignition/deployments/chain-43114/deployed_addresses.json b/contracts/relayer/ignition/deployments/chain-43114/deployed_addresses.json new file mode 100644 index 000000000..ef4a49702 --- /dev/null +++ b/contracts/relayer/ignition/deployments/chain-43114/deployed_addresses.json @@ -0,0 +1,3 @@ +{ + "TokenRelayer#TokenRelayer": "0x11871C77Aa0170ae13864E4E82cFa471720e045e" +} diff --git a/contracts/relayer/ignition/deployments/chain-43114/journal.jsonl b/contracts/relayer/ignition/deployments/chain-43114/journal.jsonl new file mode 100644 index 000000000..4980613ac --- /dev/null +++ b/contracts/relayer/ignition/deployments/chain-43114/journal.jsonl @@ -0,0 +1,8 @@ + +{"chainId":43114,"type":"DEPLOYMENT_INITIALIZE"} +{"artifactId":"TokenRelayer#TokenRelayer","constructorArgs":["0xce16F69375520ab01377ce7B88f5BA8C48F8D666"],"contractName":"TokenRelayer","dependencies":[],"from":"0xec733ccc573cbb46211876149e1830c58c6133e2","futureId":"TokenRelayer#TokenRelayer","futureType":"NAMED_ARTIFACT_CONTRACT_DEPLOYMENT","libraries":{},"strategy":"basic","strategyConfig":{},"type":"DEPLOYMENT_EXECUTION_STATE_INITIALIZE","value":{"_kind":"bigint","value":"0"}} +{"futureId":"TokenRelayer#TokenRelayer","networkInteraction":{"data":"0x610180604052348015610010575f5ffd5b50604051611a4d380380611a4d83398101604081905261002f91610294565b604080518082018252600c81526b2a37b5b2b72932b630bcb2b960a11b602080830191909152825180840190935260018352603160f81b9083015290338061009157604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b61009a816101d6565b5060017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00556100ca826001610225565b610120526100d9816002610225565b61014052815160208084019190912060e052815190820120610100524660a05261016560e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b60805250503060c0526001600160a01b0381166101c45760405162461bcd60e51b815260206004820152601360248201527f496e76616c69642064657374696e6174696f6e000000000000000000000000006044820152606401610088565b6001600160a01b03166101605261046b565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f6020835110156102405761023983610257565b9050610251565b8161024b8482610359565b5060ff90505b92915050565b5f5f829050601f81511115610281578260405163305a27a960e01b81526004016100889190610413565b805161028c82610448565b179392505050565b5f602082840312156102a4575f5ffd5b81516001600160a01b03811681146102ba575f5ffd5b9392505050565b634e487b7160e01b5f52604160045260245ffd5b600181811c908216806102e957607f821691505b60208210810361030757634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111561035457805f5260205f20601f840160051c810160208510156103325750805b601f840160051c820191505b81811015610351575f815560010161033e565b50505b505050565b81516001600160401b03811115610372576103726102c1565b6103868161038084546102d5565b8461030d565b6020601f8211600181146103b8575f83156103a15750848201515b5f19600385901b1c1916600184901b178455610351565b5f84815260208120601f198516915b828110156103e757878501518255602094850194600190920191016103c7565b508482101561040457868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b80516020808301519190811015610307575f1960209190910360031b1b16919050565b60805160a05160c05160e0516101005161012051610140516101605161156c6104e15f395f818160d701528181610525015281816105f4015281816109500152610bf801525f610d2d01525f610cfb01525f6111bc01525f61119401525f6110ef01525f61111901525f611143015261156c5ff3fe608060405260043610610092575f3560e01c80639e281a98116100575780639e281a9814610159578063d850124e14610178578063dcb79457146101c1578063f14210a6146101e0578063f2fde38b146101ff575f5ffd5b80632af83bfe1461009d578063715018a6146100b257806375bd6863146100c657806384b0196e146101165780638da5cb5b1461013d575f5ffd5b3661009957005b5f5ffd5b6100b06100ab3660046112dd565b61021e565b005b3480156100bd575f5ffd5b506100b06106ae565b3480156100d1575f5ffd5b506100f97f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b348015610121575f5ffd5b5061012a6106c1565b60405161010d979695949392919061134a565b348015610148575f5ffd5b505f546001600160a01b03166100f9565b348015610164575f5ffd5b506100b06101733660046113fb565b610703565b348015610183575f5ffd5b506101b16101923660046113fb565b600360209081525f928352604080842090915290825290205460ff1681565b604051901515815260200161010d565b3480156101cc575f5ffd5b506101b16101db3660046113fb565b61078b565b3480156101eb575f5ffd5b506100b06101fa366004611423565b6107b8565b34801561020a575f5ffd5b506100b061021936600461143a565b6108a7565b6102266108e1565b5f610237604083016020840161143a565b90506101208201356001600160a01b03821661028a5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21037bbb732b960991b60448201526064015b60405180910390fd5b5f610298602085018561143a565b6001600160a01b0316036102de5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2103a37b5b2b760991b6044820152606401610281565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff161561033e5760405162461bcd60e51b815260206004820152600a602482015269139bdb98d9481d5cd95960b21b6044820152606401610281565b8261014001354211156103855760405162461bcd60e51b815260206004820152600f60248201526e14185e5b1bd85908195e1c1a5c9959608a1b6044820152606401610281565b5f6103ee83610397602087018761143a565b60408701356103a960e0890189611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250505050610100890135876101408b013561090f565b90506001600160a01b038316610421826104106101808801610160890161149d565b876101800135886101a001356109db565b6001600160a01b0316146104655760405162461bcd60e51b815260206004820152600b60248201526a496e76616c69642073696760a81b6044820152606401610281565b83610100013534146104b95760405162461bcd60e51b815260206004820152601c60248201527f496e636f7272656374204554482076616c75652070726f7669646564000000006044820152606401610281565b6001600160a01b0383165f9081526003602090815260408083208584528252909120805460ff19166001179055610520906104f69086018661143a565b846040870135606088013561051160a08a0160808b0161149d565b8960a001358a60c00135610a07565b6105667f00000000000000000000000000000000000000000000000000000000000000006040860135610556602088018861143a565b6001600160a01b03169190610b75565b5f6105b261057760e0870187611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250349250610bf4915050565b9050806105ef5760405162461bcd60e51b815260206004820152600b60248201526a10d85b1b0819985a5b195960aa1b6044820152606401610281565b6106217f00000000000000000000000000000000000000000000000000000000000000005f610556602089018961143a565b61062e602086018661143a565b6001600160a01b0316846001600160a01b03167f78129a649632642d8e9f346c85d9efb70d32d50a36774c4585491a9228bbd350876040013560405161067691815260200190565b60405180910390a3505050506106ab60017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b50565b6106b6610c79565b6106bf5f610ca5565b565b5f6060805f5f5f60606106d2610cf4565b6106da610d26565b604080515f80825260208201909252600f60f81b9b939a50919850469750309650945092509050565b61070b610c79565b61073061071f5f546001600160a01b031690565b6001600160a01b0384169083610d53565b5f546001600160a01b03166001600160a01b0316826001600160a01b03167fa0524ee0fd8662d6c046d199da2a6d3dc49445182cec055873a5bb9c2843c8e08360405161077f91815260200190565b60405180910390a35050565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff165b92915050565b6107c0610c79565b5f80546040516001600160a01b039091169083908381818185875af1925050503d805f811461080a576040519150601f19603f3d011682016040523d82523d5f602084013e61080f565b606091505b50509050806108565760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610281565b5f546001600160a01b03166001600160a01b03167f6148672a948a12b8e0bf92a9338349b9ac890fad62a234abaf0a4da99f62cfcc8360405161089b91815260200190565b60405180910390a25050565b6108af610c79565b6001600160a01b0381166108d857604051631e4fbdf760e01b81525f6004820152602401610281565b6106ab81610ca5565b6108e9610d60565b60027f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b8351602080860191909120604080517ff0543e2024fd0ae16ccb842686c2733758ec65acfd69fb599c05b286f8db8844938101939093526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691840191909152808a1660608401528816608083015260a0820187905260c082015260e08101849052610100810183905261012081018290525f906109cf906101400160405160208183030381529060405280519060200120610da2565b98975050505050505050565b5f5f5f5f6109eb88888888610dce565b9250925092506109fb8282610e96565b50909695505050505050565b60405163d505accf60e01b81526001600160a01b038781166004830152306024830152604482018790526064820186905260ff8516608483015260a4820184905260c4820183905288169063d505accf9060e4015f604051808303815f87803b158015610a72575f5ffd5b505af1925050508015610a83575060015b610b5757604051636eb1769f60e11b81526001600160a01b03878116600483015230602483015286919089169063dd62ed3e90604401602060405180830381865afa158015610ad4573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610af891906114bd565b1015610b575760405162461bcd60e51b815260206004820152602860248201527f5065726d6974206661696c656420616e6420696e73756666696369656e7420616044820152676c6c6f77616e636560c01b6064820152608401610281565b610b6c6001600160a01b038816873088610f52565b50505050505050565b610b818383835f610f8e565b610bef57610b9283835f6001610f8e565b610bba57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b610bc78383836001610f8e565b610bef57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b505050565b5f5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168385604051610c2f91906114d4565b5f6040518083038185875af1925050503d805f8114610c69576040519150601f19603f3d011682016040523d82523d5f602084013e610c6e565b606091505b509095945050505050565b5f546001600160a01b031633146106bf5760405163118cdaa760e01b8152336004820152602401610281565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006001610ff0565b905090565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006002610ff0565b610bc78383836001611099565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00546002036106bf57604051633ee5aeb560e01b815260040160405180910390fd5b5f6107b2610dae6110e3565b8360405161190160f01b8152600281019290925260228201526042902090565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115610e0757505f91506003905082610e8c565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015610e58573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b038116610e8357505f925060019150829050610e8c565b92505f91508190505b9450945094915050565b5f826003811115610ea957610ea96114ea565b03610eb2575050565b6001826003811115610ec657610ec66114ea565b03610ee45760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115610ef857610ef86114ea565b03610f195760405163fce698f760e01b815260048101829052602401610281565b6003826003811115610f2d57610f2d6114ea565b03610f4e576040516335e2f38360e21b815260048101829052602401610281565b5050565b610f6084848484600161120c565b610f8857604051635274afe760e01b81526001600160a01b0385166004820152602401610281565b50505050565b60405163095ea7b360e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f873b113d1516831692505b60405250949350505050565b606060ff831461100a5761100383611279565b90506107b2565b818054611016906114fe565b80601f0160208091040260200160405190810160405280929190818152602001828054611042906114fe565b801561108d5780601f106110645761010080835404028352916020019161108d565b820191905f5260205f20905b81548152906001019060200180831161107057829003601f168201915b505050505090506107b2565b60405163a9059cbb60e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561113b57507f000000000000000000000000000000000000000000000000000000000000000046145b1561116557507f000000000000000000000000000000000000000000000000000000000000000090565b610d21604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b6040516323b872dd60e01b5f8181526001600160a01b038781166004528616602452604485905291602083606481808c5af1925060015f5114831661126857838315161561125c573d5f823e3d81fd5b5f883b113d1516831692505b604052505f60605295945050505050565b60605f611285836112b6565b6040805160208082528183019092529192505f91906020820181803683375050509182525060208101929092525090565b5f60ff8216601f8111156107b257604051632cd44ac360e21b815260040160405180910390fd5b5f602082840312156112ed575f5ffd5b813567ffffffffffffffff811115611303575f5ffd5b82016101c08185031215611315575f5ffd5b9392505050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b60ff60f81b8816815260e060208201525f61136860e083018961131c565b828103604084015261137a818961131c565b606084018890526001600160a01b038716608085015260a0840186905283810360c0850152845180825260208087019350909101905f5b818110156113cf5783518352602093840193909201916001016113b1565b50909b9a5050505050505050505050565b80356001600160a01b03811681146113f6575f5ffd5b919050565b5f5f6040838503121561140c575f5ffd5b611415836113e0565b946020939093013593505050565b5f60208284031215611433575f5ffd5b5035919050565b5f6020828403121561144a575f5ffd5b611315826113e0565b5f5f8335601e19843603018112611468575f5ffd5b83018035915067ffffffffffffffff821115611482575f5ffd5b602001915036819003821315611496575f5ffd5b9250929050565b5f602082840312156114ad575f5ffd5b813560ff81168114611315575f5ffd5b5f602082840312156114cd575f5ffd5b5051919050565b5f82518060208501845e5f920191825250919050565b634e487b7160e01b5f52602160045260245ffd5b600181811c9082168061151257607f821691505b60208210810361153057634e487b7160e01b5f52602260045260245ffd5b5091905056fea26469706673582212209c34db2f6f83af136a5340cce7fe8ef554ea8eb633656fbf9bff3bd731aec40f64736f6c634300081c0033000000000000000000000000ce16f69375520ab01377ce7b88f5ba8c48f8d666","id":1,"type":"ONCHAIN_INTERACTION","value":{"_kind":"bigint","value":"0"}},"type":"NETWORK_INTERACTION_REQUEST"} +{"futureId":"TokenRelayer#TokenRelayer","networkInteractionId":1,"nonce":209,"type":"TRANSACTION_PREPARE_SEND"} +{"futureId":"TokenRelayer#TokenRelayer","networkInteractionId":1,"nonce":209,"transaction":{"fees":{"maxFeePerGas":{"_kind":"bigint","value":"58070846"},"maxPriorityFeePerGas":{"_kind":"bigint","value":"1000000"}},"hash":"0x9a8a026a0f6404334feb4cafb44affd66d517b862e51a2a01fa0f950a03db942"},"type":"TRANSACTION_SEND"} +{"futureId":"TokenRelayer#TokenRelayer","hash":"0x9a8a026a0f6404334feb4cafb44affd66d517b862e51a2a01fa0f950a03db942","networkInteractionId":1,"receipt":{"blockHash":"0xd51a58eff44c15fbedd17c4548a0b75a827d1fddc6cc76d9a46486fc369bd7b0","blockNumber":86607960,"contractAddress":"0x11871C77Aa0170ae13864E4E82cFa471720e045e","logs":[{"address":"0x11871C77Aa0170ae13864E4E82cFa471720e045e","data":"0x","logIndex":198,"topics":["0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000ec733ccc573cbb46211876149e1830c58c6133e2"]}],"status":"SUCCESS"},"type":"TRANSACTION_CONFIRM"} +{"futureId":"TokenRelayer#TokenRelayer","result":{"address":"0x11871C77Aa0170ae13864E4E82cFa471720e045e","type":"SUCCESS"},"type":"DEPLOYMENT_EXECUTION_STATE_COMPLETE"} \ No newline at end of file diff --git a/contracts/relayer/ignition/deployments/chain-56/artifacts/TokenRelayer#TokenRelayer.dbg.json b/contracts/relayer/ignition/deployments/chain-56/artifacts/TokenRelayer#TokenRelayer.dbg.json new file mode 100644 index 000000000..14933beb6 --- /dev/null +++ b/contracts/relayer/ignition/deployments/chain-56/artifacts/TokenRelayer#TokenRelayer.dbg.json @@ -0,0 +1,4 @@ +{ + "_format": "hh-sol-dbg-1", + "buildInfo": "../build-info/1f88a3ad5921d6bc8b511a85d672df5a.json" +} diff --git a/contracts/relayer/ignition/deployments/chain-56/artifacts/TokenRelayer#TokenRelayer.json b/contracts/relayer/ignition/deployments/chain-56/artifacts/TokenRelayer#TokenRelayer.json new file mode 100644 index 000000000..007aaf524 --- /dev/null +++ b/contracts/relayer/ignition/deployments/chain-56/artifacts/TokenRelayer#TokenRelayer.json @@ -0,0 +1,454 @@ +{ + "_format": "hh-sol-artifact-1", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_destinationContract", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "ECDSAInvalidSignature", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "length", + "type": "uint256" + } + ], + "name": "ECDSAInvalidSignatureLength", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "ECDSAInvalidSignatureS", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidShortString", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnableInvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "OwnableUnauthorizedAccount", + "type": "error" + }, + { + "inputs": [], + "name": "ReentrancyGuardReentrantCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "SafeERC20FailedOperation", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "str", + "type": "string" + } + ], + "name": "StringTooLong", + "type": "error" + }, + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "ETHWithdrawn", + "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": true, + "internalType": "address", + "name": "signer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RelayerExecuted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "TokenWithdrawn", + "type": "event" + }, + { + "inputs": [], + "name": "destinationContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "permitV", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "permitR", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "permitS", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "payloadData", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "payloadValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "payloadNonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "payloadDeadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "payloadV", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "payloadR", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "payloadS", + "type": "bytes32" + } + ], + "internalType": "struct TokenRelayer.ExecuteParams", + "name": "params", + "type": "tuple" + } + ], + "name": "execute", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "signer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + } + ], + "name": "isExecutionCompleted", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "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": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "usedPayloadNonces", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdrawETH", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdrawToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "bytecode": "0x610180604052348015610010575f5ffd5b50604051611a4d380380611a4d83398101604081905261002f91610294565b604080518082018252600c81526b2a37b5b2b72932b630bcb2b960a11b602080830191909152825180840190935260018352603160f81b9083015290338061009157604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b61009a816101d6565b5060017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00556100ca826001610225565b610120526100d9816002610225565b61014052815160208084019190912060e052815190820120610100524660a05261016560e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b60805250503060c0526001600160a01b0381166101c45760405162461bcd60e51b815260206004820152601360248201527f496e76616c69642064657374696e6174696f6e000000000000000000000000006044820152606401610088565b6001600160a01b03166101605261046b565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f6020835110156102405761023983610257565b9050610251565b8161024b8482610359565b5060ff90505b92915050565b5f5f829050601f81511115610281578260405163305a27a960e01b81526004016100889190610413565b805161028c82610448565b179392505050565b5f602082840312156102a4575f5ffd5b81516001600160a01b03811681146102ba575f5ffd5b9392505050565b634e487b7160e01b5f52604160045260245ffd5b600181811c908216806102e957607f821691505b60208210810361030757634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111561035457805f5260205f20601f840160051c810160208510156103325750805b601f840160051c820191505b81811015610351575f815560010161033e565b50505b505050565b81516001600160401b03811115610372576103726102c1565b6103868161038084546102d5565b8461030d565b6020601f8211600181146103b8575f83156103a15750848201515b5f19600385901b1c1916600184901b178455610351565b5f84815260208120601f198516915b828110156103e757878501518255602094850194600190920191016103c7565b508482101561040457868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b80516020808301519190811015610307575f1960209190910360031b1b16919050565b60805160a05160c05160e0516101005161012051610140516101605161156c6104e15f395f818160d701528181610525015281816105f4015281816109500152610bf801525f610d2d01525f610cfb01525f6111bc01525f61119401525f6110ef01525f61111901525f611143015261156c5ff3fe608060405260043610610092575f3560e01c80639e281a98116100575780639e281a9814610159578063d850124e14610178578063dcb79457146101c1578063f14210a6146101e0578063f2fde38b146101ff575f5ffd5b80632af83bfe1461009d578063715018a6146100b257806375bd6863146100c657806384b0196e146101165780638da5cb5b1461013d575f5ffd5b3661009957005b5f5ffd5b6100b06100ab3660046112dd565b61021e565b005b3480156100bd575f5ffd5b506100b06106ae565b3480156100d1575f5ffd5b506100f97f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b348015610121575f5ffd5b5061012a6106c1565b60405161010d979695949392919061134a565b348015610148575f5ffd5b505f546001600160a01b03166100f9565b348015610164575f5ffd5b506100b06101733660046113fb565b610703565b348015610183575f5ffd5b506101b16101923660046113fb565b600360209081525f928352604080842090915290825290205460ff1681565b604051901515815260200161010d565b3480156101cc575f5ffd5b506101b16101db3660046113fb565b61078b565b3480156101eb575f5ffd5b506100b06101fa366004611423565b6107b8565b34801561020a575f5ffd5b506100b061021936600461143a565b6108a7565b6102266108e1565b5f610237604083016020840161143a565b90506101208201356001600160a01b03821661028a5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21037bbb732b960991b60448201526064015b60405180910390fd5b5f610298602085018561143a565b6001600160a01b0316036102de5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2103a37b5b2b760991b6044820152606401610281565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff161561033e5760405162461bcd60e51b815260206004820152600a602482015269139bdb98d9481d5cd95960b21b6044820152606401610281565b8261014001354211156103855760405162461bcd60e51b815260206004820152600f60248201526e14185e5b1bd85908195e1c1a5c9959608a1b6044820152606401610281565b5f6103ee83610397602087018761143a565b60408701356103a960e0890189611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250505050610100890135876101408b013561090f565b90506001600160a01b038316610421826104106101808801610160890161149d565b876101800135886101a001356109db565b6001600160a01b0316146104655760405162461bcd60e51b815260206004820152600b60248201526a496e76616c69642073696760a81b6044820152606401610281565b83610100013534146104b95760405162461bcd60e51b815260206004820152601c60248201527f496e636f7272656374204554482076616c75652070726f7669646564000000006044820152606401610281565b6001600160a01b0383165f9081526003602090815260408083208584528252909120805460ff19166001179055610520906104f69086018661143a565b846040870135606088013561051160a08a0160808b0161149d565b8960a001358a60c00135610a07565b6105667f00000000000000000000000000000000000000000000000000000000000000006040860135610556602088018861143a565b6001600160a01b03169190610b75565b5f6105b261057760e0870187611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250349250610bf4915050565b9050806105ef5760405162461bcd60e51b815260206004820152600b60248201526a10d85b1b0819985a5b195960aa1b6044820152606401610281565b6106217f00000000000000000000000000000000000000000000000000000000000000005f610556602089018961143a565b61062e602086018661143a565b6001600160a01b0316846001600160a01b03167f78129a649632642d8e9f346c85d9efb70d32d50a36774c4585491a9228bbd350876040013560405161067691815260200190565b60405180910390a3505050506106ab60017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b50565b6106b6610c79565b6106bf5f610ca5565b565b5f6060805f5f5f60606106d2610cf4565b6106da610d26565b604080515f80825260208201909252600f60f81b9b939a50919850469750309650945092509050565b61070b610c79565b61073061071f5f546001600160a01b031690565b6001600160a01b0384169083610d53565b5f546001600160a01b03166001600160a01b0316826001600160a01b03167fa0524ee0fd8662d6c046d199da2a6d3dc49445182cec055873a5bb9c2843c8e08360405161077f91815260200190565b60405180910390a35050565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff165b92915050565b6107c0610c79565b5f80546040516001600160a01b039091169083908381818185875af1925050503d805f811461080a576040519150601f19603f3d011682016040523d82523d5f602084013e61080f565b606091505b50509050806108565760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610281565b5f546001600160a01b03166001600160a01b03167f6148672a948a12b8e0bf92a9338349b9ac890fad62a234abaf0a4da99f62cfcc8360405161089b91815260200190565b60405180910390a25050565b6108af610c79565b6001600160a01b0381166108d857604051631e4fbdf760e01b81525f6004820152602401610281565b6106ab81610ca5565b6108e9610d60565b60027f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b8351602080860191909120604080517ff0543e2024fd0ae16ccb842686c2733758ec65acfd69fb599c05b286f8db8844938101939093526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691840191909152808a1660608401528816608083015260a0820187905260c082015260e08101849052610100810183905261012081018290525f906109cf906101400160405160208183030381529060405280519060200120610da2565b98975050505050505050565b5f5f5f5f6109eb88888888610dce565b9250925092506109fb8282610e96565b50909695505050505050565b60405163d505accf60e01b81526001600160a01b038781166004830152306024830152604482018790526064820186905260ff8516608483015260a4820184905260c4820183905288169063d505accf9060e4015f604051808303815f87803b158015610a72575f5ffd5b505af1925050508015610a83575060015b610b5757604051636eb1769f60e11b81526001600160a01b03878116600483015230602483015286919089169063dd62ed3e90604401602060405180830381865afa158015610ad4573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610af891906114bd565b1015610b575760405162461bcd60e51b815260206004820152602860248201527f5065726d6974206661696c656420616e6420696e73756666696369656e7420616044820152676c6c6f77616e636560c01b6064820152608401610281565b610b6c6001600160a01b038816873088610f52565b50505050505050565b610b818383835f610f8e565b610bef57610b9283835f6001610f8e565b610bba57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b610bc78383836001610f8e565b610bef57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b505050565b5f5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168385604051610c2f91906114d4565b5f6040518083038185875af1925050503d805f8114610c69576040519150601f19603f3d011682016040523d82523d5f602084013e610c6e565b606091505b509095945050505050565b5f546001600160a01b031633146106bf5760405163118cdaa760e01b8152336004820152602401610281565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006001610ff0565b905090565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006002610ff0565b610bc78383836001611099565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00546002036106bf57604051633ee5aeb560e01b815260040160405180910390fd5b5f6107b2610dae6110e3565b8360405161190160f01b8152600281019290925260228201526042902090565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115610e0757505f91506003905082610e8c565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015610e58573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b038116610e8357505f925060019150829050610e8c565b92505f91508190505b9450945094915050565b5f826003811115610ea957610ea96114ea565b03610eb2575050565b6001826003811115610ec657610ec66114ea565b03610ee45760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115610ef857610ef86114ea565b03610f195760405163fce698f760e01b815260048101829052602401610281565b6003826003811115610f2d57610f2d6114ea565b03610f4e576040516335e2f38360e21b815260048101829052602401610281565b5050565b610f6084848484600161120c565b610f8857604051635274afe760e01b81526001600160a01b0385166004820152602401610281565b50505050565b60405163095ea7b360e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f873b113d1516831692505b60405250949350505050565b606060ff831461100a5761100383611279565b90506107b2565b818054611016906114fe565b80601f0160208091040260200160405190810160405280929190818152602001828054611042906114fe565b801561108d5780601f106110645761010080835404028352916020019161108d565b820191905f5260205f20905b81548152906001019060200180831161107057829003601f168201915b505050505090506107b2565b60405163a9059cbb60e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561113b57507f000000000000000000000000000000000000000000000000000000000000000046145b1561116557507f000000000000000000000000000000000000000000000000000000000000000090565b610d21604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b6040516323b872dd60e01b5f8181526001600160a01b038781166004528616602452604485905291602083606481808c5af1925060015f5114831661126857838315161561125c573d5f823e3d81fd5b5f883b113d1516831692505b604052505f60605295945050505050565b60605f611285836112b6565b6040805160208082528183019092529192505f91906020820181803683375050509182525060208101929092525090565b5f60ff8216601f8111156107b257604051632cd44ac360e21b815260040160405180910390fd5b5f602082840312156112ed575f5ffd5b813567ffffffffffffffff811115611303575f5ffd5b82016101c08185031215611315575f5ffd5b9392505050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b60ff60f81b8816815260e060208201525f61136860e083018961131c565b828103604084015261137a818961131c565b606084018890526001600160a01b038716608085015260a0840186905283810360c0850152845180825260208087019350909101905f5b818110156113cf5783518352602093840193909201916001016113b1565b50909b9a5050505050505050505050565b80356001600160a01b03811681146113f6575f5ffd5b919050565b5f5f6040838503121561140c575f5ffd5b611415836113e0565b946020939093013593505050565b5f60208284031215611433575f5ffd5b5035919050565b5f6020828403121561144a575f5ffd5b611315826113e0565b5f5f8335601e19843603018112611468575f5ffd5b83018035915067ffffffffffffffff821115611482575f5ffd5b602001915036819003821315611496575f5ffd5b9250929050565b5f602082840312156114ad575f5ffd5b813560ff81168114611315575f5ffd5b5f602082840312156114cd575f5ffd5b5051919050565b5f82518060208501845e5f920191825250919050565b634e487b7160e01b5f52602160045260245ffd5b600181811c9082168061151257607f821691505b60208210810361153057634e487b7160e01b5f52602260045260245ffd5b5091905056fea26469706673582212209c34db2f6f83af136a5340cce7fe8ef554ea8eb633656fbf9bff3bd731aec40f64736f6c634300081c0033", + "contractName": "TokenRelayer", + "deployedBytecode": "0x608060405260043610610092575f3560e01c80639e281a98116100575780639e281a9814610159578063d850124e14610178578063dcb79457146101c1578063f14210a6146101e0578063f2fde38b146101ff575f5ffd5b80632af83bfe1461009d578063715018a6146100b257806375bd6863146100c657806384b0196e146101165780638da5cb5b1461013d575f5ffd5b3661009957005b5f5ffd5b6100b06100ab3660046112dd565b61021e565b005b3480156100bd575f5ffd5b506100b06106ae565b3480156100d1575f5ffd5b506100f97f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b348015610121575f5ffd5b5061012a6106c1565b60405161010d979695949392919061134a565b348015610148575f5ffd5b505f546001600160a01b03166100f9565b348015610164575f5ffd5b506100b06101733660046113fb565b610703565b348015610183575f5ffd5b506101b16101923660046113fb565b600360209081525f928352604080842090915290825290205460ff1681565b604051901515815260200161010d565b3480156101cc575f5ffd5b506101b16101db3660046113fb565b61078b565b3480156101eb575f5ffd5b506100b06101fa366004611423565b6107b8565b34801561020a575f5ffd5b506100b061021936600461143a565b6108a7565b6102266108e1565b5f610237604083016020840161143a565b90506101208201356001600160a01b03821661028a5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21037bbb732b960991b60448201526064015b60405180910390fd5b5f610298602085018561143a565b6001600160a01b0316036102de5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2103a37b5b2b760991b6044820152606401610281565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff161561033e5760405162461bcd60e51b815260206004820152600a602482015269139bdb98d9481d5cd95960b21b6044820152606401610281565b8261014001354211156103855760405162461bcd60e51b815260206004820152600f60248201526e14185e5b1bd85908195e1c1a5c9959608a1b6044820152606401610281565b5f6103ee83610397602087018761143a565b60408701356103a960e0890189611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250505050610100890135876101408b013561090f565b90506001600160a01b038316610421826104106101808801610160890161149d565b876101800135886101a001356109db565b6001600160a01b0316146104655760405162461bcd60e51b815260206004820152600b60248201526a496e76616c69642073696760a81b6044820152606401610281565b83610100013534146104b95760405162461bcd60e51b815260206004820152601c60248201527f496e636f7272656374204554482076616c75652070726f7669646564000000006044820152606401610281565b6001600160a01b0383165f9081526003602090815260408083208584528252909120805460ff19166001179055610520906104f69086018661143a565b846040870135606088013561051160a08a0160808b0161149d565b8960a001358a60c00135610a07565b6105667f00000000000000000000000000000000000000000000000000000000000000006040860135610556602088018861143a565b6001600160a01b03169190610b75565b5f6105b261057760e0870187611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250349250610bf4915050565b9050806105ef5760405162461bcd60e51b815260206004820152600b60248201526a10d85b1b0819985a5b195960aa1b6044820152606401610281565b6106217f00000000000000000000000000000000000000000000000000000000000000005f610556602089018961143a565b61062e602086018661143a565b6001600160a01b0316846001600160a01b03167f78129a649632642d8e9f346c85d9efb70d32d50a36774c4585491a9228bbd350876040013560405161067691815260200190565b60405180910390a3505050506106ab60017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b50565b6106b6610c79565b6106bf5f610ca5565b565b5f6060805f5f5f60606106d2610cf4565b6106da610d26565b604080515f80825260208201909252600f60f81b9b939a50919850469750309650945092509050565b61070b610c79565b61073061071f5f546001600160a01b031690565b6001600160a01b0384169083610d53565b5f546001600160a01b03166001600160a01b0316826001600160a01b03167fa0524ee0fd8662d6c046d199da2a6d3dc49445182cec055873a5bb9c2843c8e08360405161077f91815260200190565b60405180910390a35050565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff165b92915050565b6107c0610c79565b5f80546040516001600160a01b039091169083908381818185875af1925050503d805f811461080a576040519150601f19603f3d011682016040523d82523d5f602084013e61080f565b606091505b50509050806108565760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610281565b5f546001600160a01b03166001600160a01b03167f6148672a948a12b8e0bf92a9338349b9ac890fad62a234abaf0a4da99f62cfcc8360405161089b91815260200190565b60405180910390a25050565b6108af610c79565b6001600160a01b0381166108d857604051631e4fbdf760e01b81525f6004820152602401610281565b6106ab81610ca5565b6108e9610d60565b60027f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b8351602080860191909120604080517ff0543e2024fd0ae16ccb842686c2733758ec65acfd69fb599c05b286f8db8844938101939093526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691840191909152808a1660608401528816608083015260a0820187905260c082015260e08101849052610100810183905261012081018290525f906109cf906101400160405160208183030381529060405280519060200120610da2565b98975050505050505050565b5f5f5f5f6109eb88888888610dce565b9250925092506109fb8282610e96565b50909695505050505050565b60405163d505accf60e01b81526001600160a01b038781166004830152306024830152604482018790526064820186905260ff8516608483015260a4820184905260c4820183905288169063d505accf9060e4015f604051808303815f87803b158015610a72575f5ffd5b505af1925050508015610a83575060015b610b5757604051636eb1769f60e11b81526001600160a01b03878116600483015230602483015286919089169063dd62ed3e90604401602060405180830381865afa158015610ad4573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610af891906114bd565b1015610b575760405162461bcd60e51b815260206004820152602860248201527f5065726d6974206661696c656420616e6420696e73756666696369656e7420616044820152676c6c6f77616e636560c01b6064820152608401610281565b610b6c6001600160a01b038816873088610f52565b50505050505050565b610b818383835f610f8e565b610bef57610b9283835f6001610f8e565b610bba57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b610bc78383836001610f8e565b610bef57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b505050565b5f5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168385604051610c2f91906114d4565b5f6040518083038185875af1925050503d805f8114610c69576040519150601f19603f3d011682016040523d82523d5f602084013e610c6e565b606091505b509095945050505050565b5f546001600160a01b031633146106bf5760405163118cdaa760e01b8152336004820152602401610281565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006001610ff0565b905090565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006002610ff0565b610bc78383836001611099565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00546002036106bf57604051633ee5aeb560e01b815260040160405180910390fd5b5f6107b2610dae6110e3565b8360405161190160f01b8152600281019290925260228201526042902090565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115610e0757505f91506003905082610e8c565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015610e58573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b038116610e8357505f925060019150829050610e8c565b92505f91508190505b9450945094915050565b5f826003811115610ea957610ea96114ea565b03610eb2575050565b6001826003811115610ec657610ec66114ea565b03610ee45760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115610ef857610ef86114ea565b03610f195760405163fce698f760e01b815260048101829052602401610281565b6003826003811115610f2d57610f2d6114ea565b03610f4e576040516335e2f38360e21b815260048101829052602401610281565b5050565b610f6084848484600161120c565b610f8857604051635274afe760e01b81526001600160a01b0385166004820152602401610281565b50505050565b60405163095ea7b360e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f873b113d1516831692505b60405250949350505050565b606060ff831461100a5761100383611279565b90506107b2565b818054611016906114fe565b80601f0160208091040260200160405190810160405280929190818152602001828054611042906114fe565b801561108d5780601f106110645761010080835404028352916020019161108d565b820191905f5260205f20905b81548152906001019060200180831161107057829003601f168201915b505050505090506107b2565b60405163a9059cbb60e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561113b57507f000000000000000000000000000000000000000000000000000000000000000046145b1561116557507f000000000000000000000000000000000000000000000000000000000000000090565b610d21604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b6040516323b872dd60e01b5f8181526001600160a01b038781166004528616602452604485905291602083606481808c5af1925060015f5114831661126857838315161561125c573d5f823e3d81fd5b5f883b113d1516831692505b604052505f60605295945050505050565b60605f611285836112b6565b6040805160208082528183019092529192505f91906020820181803683375050509182525060208101929092525090565b5f60ff8216601f8111156107b257604051632cd44ac360e21b815260040160405180910390fd5b5f602082840312156112ed575f5ffd5b813567ffffffffffffffff811115611303575f5ffd5b82016101c08185031215611315575f5ffd5b9392505050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b60ff60f81b8816815260e060208201525f61136860e083018961131c565b828103604084015261137a818961131c565b606084018890526001600160a01b038716608085015260a0840186905283810360c0850152845180825260208087019350909101905f5b818110156113cf5783518352602093840193909201916001016113b1565b50909b9a5050505050505050505050565b80356001600160a01b03811681146113f6575f5ffd5b919050565b5f5f6040838503121561140c575f5ffd5b611415836113e0565b946020939093013593505050565b5f60208284031215611433575f5ffd5b5035919050565b5f6020828403121561144a575f5ffd5b611315826113e0565b5f5f8335601e19843603018112611468575f5ffd5b83018035915067ffffffffffffffff821115611482575f5ffd5b602001915036819003821315611496575f5ffd5b9250929050565b5f602082840312156114ad575f5ffd5b813560ff81168114611315575f5ffd5b5f602082840312156114cd575f5ffd5b5051919050565b5f82518060208501845e5f920191825250919050565b634e487b7160e01b5f52602160045260245ffd5b600181811c9082168061151257607f821691505b60208210810361153057634e487b7160e01b5f52602260045260245ffd5b5091905056fea26469706673582212209c34db2f6f83af136a5340cce7fe8ef554ea8eb633656fbf9bff3bd731aec40f64736f6c634300081c0033", + "deployedLinkReferences": {}, + "linkReferences": {}, + "sourceName": "contracts/TokenRelayer.sol" +} diff --git a/contracts/relayer/ignition/deployments/chain-56/build-info/1f88a3ad5921d6bc8b511a85d672df5a.json b/contracts/relayer/ignition/deployments/chain-56/build-info/1f88a3ad5921d6bc8b511a85d672df5a.json new file mode 100644 index 000000000..8b7c007e9 --- /dev/null +++ b/contracts/relayer/ignition/deployments/chain-56/build-info/1f88a3ad5921d6bc8b511a85d672df5a.json @@ -0,0 +1,137942 @@ +{ + "id": "1f88a3ad5921d6bc8b511a85d672df5a", + "_format": "hh-sol-build-info-1", + "solcVersion": "0.8.28", + "solcLongVersion": "0.8.28+commit.7893614a", + "input": { + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)\n\npragma solidity ^0.8.20;\n\nimport {Context} from \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * The initial owner is set to the address provided by the deployer. This can\n * later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n /**\n * @dev The caller account is not authorized to perform an operation.\n */\n error OwnableUnauthorizedAccount(address account);\n\n /**\n * @dev The owner is not a valid owner account. (eg. `address(0)`)\n */\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\n */\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n _transferOwnership(initialOwner);\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC1363.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1363.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC20} from \"./IERC20.sol\";\nimport {IERC165} from \"./IERC165.sol\";\n\n/**\n * @title IERC1363\n * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].\n *\n * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract\n * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.\n */\ninterface IERC1363 is IERC20, IERC165 {\n /*\n * Note: the ERC-165 identifier for this interface is 0xb0202a11.\n * 0xb0202a11 ===\n * bytes4(keccak256('transferAndCall(address,uint256)')) ^\n * bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^\n * bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^\n * bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^\n * bytes4(keccak256('approveAndCall(address,uint256)')) ^\n * bytes4(keccak256('approveAndCall(address,uint256,bytes)'))\n */\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n * @param to The address which you want to transfer to.\n * @param value The amount of tokens to be transferred.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function transferAndCall(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n * @param to The address which you want to transfer to.\n * @param value The amount of tokens to be transferred.\n * @param data Additional data with no specified format, sent in call to `to`.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n * @param from The address which you want to send tokens from.\n * @param to The address which you want to transfer to.\n * @param value The amount of tokens to be transferred.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function transferFromAndCall(address from, address to, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n * @param from The address which you want to send tokens from.\n * @param to The address which you want to transfer to.\n * @param value The amount of tokens to be transferred.\n * @param data Additional data with no specified format, sent in call to `to`.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n * @param spender The address which will spend the funds.\n * @param value The amount of tokens to be spent.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function approveAndCall(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n * @param spender The address which will spend the funds.\n * @param value The amount of tokens to be spent.\n * @param data Additional data with no specified format, sent in call to `spender`.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC165.sol)\n\npragma solidity >=0.4.16;\n\nimport {IERC165} from \"../utils/introspection/IERC165.sol\";\n" + }, + "@openzeppelin/contracts/interfaces/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol)\n\npragma solidity >=0.4.16;\n\nimport {IERC20} from \"../token/ERC20/IERC20.sol\";\n" + }, + "@openzeppelin/contracts/interfaces/IERC5267.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC5267.sol)\n\npragma solidity >=0.4.16;\n\ninterface IERC5267 {\n /**\n * @dev MAY be emitted to signal that the domain could have changed.\n */\n event EIP712DomainChanged();\n\n /**\n * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\n * signature.\n */\n function eip712Domain()\n external\n view\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n );\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity >=0.4.16;\n\n/**\n * @dev Interface of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also applies here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n *\n * CAUTION: See Security Considerations above.\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)\n\npragma solidity >=0.4.16;\n\n/**\n * @dev Interface of the ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\nimport {IERC1363} from \"../../../interfaces/IERC1363.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n if (!_safeTransfer(token, to, value, true)) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n if (!_safeTransferFrom(token, from, to, value, true)) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.\n */\n function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {\n return _safeTransfer(token, to, value, false);\n }\n\n /**\n * @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.\n */\n function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {\n return _safeTransferFrom(token, from, to, value, false);\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n *\n * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the \"client\"\n * smart contract uses ERC-7674 to set temporary allowances, then the \"client\" smart contract should avoid using\n * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract\n * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.\n */\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n forceApprove(token, spender, oldAllowance + value);\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no\n * value, non-reverting calls are assumed to be successful.\n *\n * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the \"client\"\n * smart contract uses ERC-7674 to set temporary allowances, then the \"client\" smart contract should avoid using\n * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract\n * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.\n */\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance < requestedDecrease) {\n revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);\n }\n forceApprove(token, spender, currentAllowance - requestedDecrease);\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n *\n * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function\n * only sets the \"standard\" allowance. Any temporary allowance will remain active, in addition to the value being\n * set here.\n */\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n if (!_safeApprove(token, spender, value, false)) {\n if (!_safeApprove(token, spender, 0, true)) revert SafeERC20FailedOperation(address(token));\n if (!_safeApprove(token, spender, value, true)) revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no\n * code. This can be used to implement an {ERC721}-like safe transfer that relies on {ERC1363} checks when\n * targeting contracts.\n *\n * Reverts if the returned value is other than `true`.\n */\n function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {\n if (to.code.length == 0) {\n safeTransfer(token, to, value);\n } else if (!token.transferAndCall(to, value, data)) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target\n * has no code. This can be used to implement an {ERC721}-like safe transfer that relies on {ERC1363} checks when\n * targeting contracts.\n *\n * Reverts if the returned value is other than `true`.\n */\n function transferFromAndCallRelaxed(\n IERC1363 token,\n address from,\n address to,\n uint256 value,\n bytes memory data\n ) internal {\n if (to.code.length == 0) {\n safeTransferFrom(token, from, to, value);\n } else if (!token.transferFromAndCall(from, to, value, data)) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no\n * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\n * targeting contracts.\n *\n * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.\n * Oppositely, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}\n * once without retrying, and relies on the returned value to be true.\n *\n * Reverts if the returned value is other than `true`.\n */\n function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {\n if (to.code.length == 0) {\n forceApprove(token, to, value);\n } else if (!token.approveAndCall(to, value, data)) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity `token.transfer(to, value)` call, relaxing the requirement on the return value: the\n * return value is optional (but if data is returned, it must not be false).\n *\n * @param token The token targeted by the call.\n * @param to The recipient of the tokens\n * @param value The amount of token to transfer\n * @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.\n */\n function _safeTransfer(IERC20 token, address to, uint256 value, bool bubble) private returns (bool success) {\n bytes4 selector = IERC20.transfer.selector;\n\n assembly (\"memory-safe\") {\n let fmp := mload(0x40)\n mstore(0x00, selector)\n mstore(0x04, and(to, shr(96, not(0))))\n mstore(0x24, value)\n success := call(gas(), token, 0, 0x00, 0x44, 0x00, 0x20)\n // if call success and return is true, all is good.\n // otherwise (not success or return is not true), we need to perform further checks\n if iszero(and(success, eq(mload(0x00), 1))) {\n // if the call was a failure and bubble is enabled, bubble the error\n if and(iszero(success), bubble) {\n returndatacopy(fmp, 0x00, returndatasize())\n revert(fmp, returndatasize())\n }\n // if the return value is not true, then the call is only successful if:\n // - the token address has code\n // - the returndata is empty\n success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))\n }\n mstore(0x40, fmp)\n }\n }\n\n /**\n * @dev Imitates a Solidity `token.transferFrom(from, to, value)` call, relaxing the requirement on the return\n * value: the return value is optional (but if data is returned, it must not be false).\n *\n * @param token The token targeted by the call.\n * @param from The sender of the tokens\n * @param to The recipient of the tokens\n * @param value The amount of token to transfer\n * @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.\n */\n function _safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value,\n bool bubble\n ) private returns (bool success) {\n bytes4 selector = IERC20.transferFrom.selector;\n\n assembly (\"memory-safe\") {\n let fmp := mload(0x40)\n mstore(0x00, selector)\n mstore(0x04, and(from, shr(96, not(0))))\n mstore(0x24, and(to, shr(96, not(0))))\n mstore(0x44, value)\n success := call(gas(), token, 0, 0x00, 0x64, 0x00, 0x20)\n // if call success and return is true, all is good.\n // otherwise (not success or return is not true), we need to perform further checks\n if iszero(and(success, eq(mload(0x00), 1))) {\n // if the call was a failure and bubble is enabled, bubble the error\n if and(iszero(success), bubble) {\n returndatacopy(fmp, 0x00, returndatasize())\n revert(fmp, returndatasize())\n }\n // if the return value is not true, then the call is only successful if:\n // - the token address has code\n // - the returndata is empty\n success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))\n }\n mstore(0x40, fmp)\n mstore(0x60, 0)\n }\n }\n\n /**\n * @dev Imitates a Solidity `token.approve(spender, value)` call, relaxing the requirement on the return value:\n * the return value is optional (but if data is returned, it must not be false).\n *\n * @param token The token targeted by the call.\n * @param spender The spender of the tokens\n * @param value The amount of token to transfer\n * @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.\n */\n function _safeApprove(IERC20 token, address spender, uint256 value, bool bubble) private returns (bool success) {\n bytes4 selector = IERC20.approve.selector;\n\n assembly (\"memory-safe\") {\n let fmp := mload(0x40)\n mstore(0x00, selector)\n mstore(0x04, and(spender, shr(96, not(0))))\n mstore(0x24, value)\n success := call(gas(), token, 0, 0x00, 0x44, 0x00, 0x20)\n // if call success and return is true, all is good.\n // otherwise (not success or return is not true), we need to perform further checks\n if iszero(and(success, eq(mload(0x00), 1))) {\n // if the call was a failure and bubble is enabled, bubble the error\n if and(iszero(success), bubble) {\n returndatacopy(fmp, 0x00, returndatasize())\n revert(fmp, returndatasize())\n }\n // if the return value is not true, then the call is only successful if:\n // - the token address has code\n // - the returndata is empty\n success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))\n }\n mstore(0x40, fmp)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Bytes.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.6.0) (utils/Bytes.sol)\n\npragma solidity ^0.8.24;\n\nimport {Math} from \"./math/Math.sol\";\n\n/**\n * @dev Bytes operations.\n */\nlibrary Bytes {\n /**\n * @dev Forward search for `s` in `buffer`\n * * If `s` is present in the buffer, returns the index of the first instance\n * * If `s` is not present in the buffer, returns type(uint256).max\n *\n * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf[Javascript's `Array.indexOf`]\n */\n function indexOf(bytes memory buffer, bytes1 s) internal pure returns (uint256) {\n return indexOf(buffer, s, 0);\n }\n\n /**\n * @dev Forward search for `s` in `buffer` starting at position `pos`\n * * If `s` is present in the buffer (at or after `pos`), returns the index of the next instance\n * * If `s` is not present in the buffer (at or after `pos`), returns type(uint256).max\n *\n * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf[Javascript's `Array.indexOf`]\n */\n function indexOf(bytes memory buffer, bytes1 s, uint256 pos) internal pure returns (uint256) {\n uint256 length = buffer.length;\n for (uint256 i = pos; i < length; ++i) {\n if (bytes1(_unsafeReadBytesOffset(buffer, i)) == s) {\n return i;\n }\n }\n return type(uint256).max;\n }\n\n /**\n * @dev Backward search for `s` in `buffer`\n * * If `s` is present in the buffer, returns the index of the last instance\n * * If `s` is not present in the buffer, returns type(uint256).max\n *\n * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf[Javascript's `Array.lastIndexOf`]\n */\n function lastIndexOf(bytes memory buffer, bytes1 s) internal pure returns (uint256) {\n return lastIndexOf(buffer, s, type(uint256).max);\n }\n\n /**\n * @dev Backward search for `s` in `buffer` starting at position `pos`\n * * If `s` is present in the buffer (at or before `pos`), returns the index of the previous instance\n * * If `s` is not present in the buffer (at or before `pos`), returns type(uint256).max\n *\n * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf[Javascript's `Array.lastIndexOf`]\n */\n function lastIndexOf(bytes memory buffer, bytes1 s, uint256 pos) internal pure returns (uint256) {\n unchecked {\n uint256 length = buffer.length;\n for (uint256 i = Math.min(Math.saturatingAdd(pos, 1), length); i > 0; --i) {\n if (bytes1(_unsafeReadBytesOffset(buffer, i - 1)) == s) {\n return i - 1;\n }\n }\n return type(uint256).max;\n }\n }\n\n /**\n * @dev Copies the content of `buffer`, from `start` (included) to the end of `buffer` into a new bytes object in\n * memory.\n *\n * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`]\n */\n function slice(bytes memory buffer, uint256 start) internal pure returns (bytes memory) {\n return slice(buffer, start, buffer.length);\n }\n\n /**\n * @dev Copies the content of `buffer`, from `start` (included) to `end` (excluded) into a new bytes object in\n * memory. The `end` argument is truncated to the length of the `buffer`.\n *\n * NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`]\n */\n function slice(bytes memory buffer, uint256 start, uint256 end) internal pure returns (bytes memory) {\n // sanitize\n end = Math.min(end, buffer.length);\n start = Math.min(start, end);\n\n // allocate and copy\n bytes memory result = new bytes(end - start);\n assembly (\"memory-safe\") {\n mcopy(add(result, 0x20), add(add(buffer, 0x20), start), sub(end, start))\n }\n\n return result;\n }\n\n /**\n * @dev Moves the content of `buffer`, from `start` (included) to the end of `buffer` to the start of that buffer,\n * and shrinks the buffer length accordingly, effectively overriding the content of buffer with buffer[start:].\n *\n * NOTE: This function modifies the provided buffer in place. If you need to preserve the original buffer, use {slice} instead\n */\n function splice(bytes memory buffer, uint256 start) internal pure returns (bytes memory) {\n return splice(buffer, start, buffer.length);\n }\n\n /**\n * @dev Moves the content of `buffer`, from `start` (included) to `end` (excluded) to the start of that buffer,\n * and shrinks the buffer length accordingly, effectively overriding the content of buffer with buffer[start:end].\n * The `end` argument is truncated to the length of the `buffer`.\n *\n * NOTE: This function modifies the provided buffer in place. If you need to preserve the original buffer, use {slice} instead\n */\n function splice(bytes memory buffer, uint256 start, uint256 end) internal pure returns (bytes memory) {\n // sanitize\n end = Math.min(end, buffer.length);\n start = Math.min(start, end);\n\n // move and resize\n assembly (\"memory-safe\") {\n mcopy(add(buffer, 0x20), add(add(buffer, 0x20), start), sub(end, start))\n mstore(buffer, sub(end, start))\n }\n\n return buffer;\n }\n\n /**\n * @dev Replaces bytes in `buffer` starting at `pos` with all bytes from `replacement`.\n *\n * Parameters are clamped to valid ranges (i.e. `pos` is clamped to `[0, buffer.length]`).\n * If `pos >= buffer.length`, no replacement occurs and the buffer is returned unchanged.\n *\n * NOTE: This function modifies the provided buffer in place.\n */\n function replace(bytes memory buffer, uint256 pos, bytes memory replacement) internal pure returns (bytes memory) {\n return replace(buffer, pos, replacement, 0, replacement.length);\n }\n\n /**\n * @dev Replaces bytes in `buffer` starting at `pos` with bytes from `replacement` starting at `offset`.\n * Copies at most `length` bytes from `replacement` to `buffer`.\n *\n * Parameters are clamped to valid ranges (i.e. `pos` is clamped to `[0, buffer.length]`, `offset` is\n * clamped to `[0, replacement.length]`, and `length` is clamped to `min(length, replacement.length - offset,\n * buffer.length - pos))`. If `pos >= buffer.length` or `offset >= replacement.length`, no replacement occurs\n * and the buffer is returned unchanged.\n *\n * NOTE: This function modifies the provided buffer in place.\n */\n function replace(\n bytes memory buffer,\n uint256 pos,\n bytes memory replacement,\n uint256 offset,\n uint256 length\n ) internal pure returns (bytes memory) {\n // sanitize\n pos = Math.min(pos, buffer.length);\n offset = Math.min(offset, replacement.length);\n length = Math.min(length, Math.min(replacement.length - offset, buffer.length - pos));\n\n // replace\n assembly (\"memory-safe\") {\n mcopy(add(add(buffer, 0x20), pos), add(add(replacement, 0x20), offset), length)\n }\n\n return buffer;\n }\n\n /**\n * @dev Concatenate an array of bytes into a single bytes object.\n *\n * For fixed bytes types, we recommend using the solidity built-in `bytes.concat` or (equivalent)\n * `abi.encodePacked`.\n *\n * NOTE: this could be done in assembly with a single loop that expands starting at the FMP, but that would be\n * significantly less readable. It might be worth benchmarking the savings of the full-assembly approach.\n */\n function concat(bytes[] memory buffers) internal pure returns (bytes memory) {\n uint256 length = 0;\n for (uint256 i = 0; i < buffers.length; ++i) {\n length += buffers[i].length;\n }\n\n bytes memory result = new bytes(length);\n\n uint256 offset = 0x20;\n for (uint256 i = 0; i < buffers.length; ++i) {\n bytes memory input = buffers[i];\n assembly (\"memory-safe\") {\n mcopy(add(result, offset), add(input, 0x20), mload(input))\n }\n unchecked {\n offset += input.length;\n }\n }\n\n return result;\n }\n\n /**\n * @dev Split each byte in `input` into two nibbles (4 bits each)\n *\n * Example: hex\"01234567\" → hex\"0001020304050607\"\n */\n function toNibbles(bytes memory input) internal pure returns (bytes memory output) {\n assembly (\"memory-safe\") {\n let length := mload(input)\n output := mload(0x40)\n mstore(0x40, add(add(output, 0x20), mul(length, 2)))\n mstore(output, mul(length, 2))\n for {\n let i := 0\n } lt(i, length) {\n i := add(i, 0x10)\n } {\n let chunk := shr(128, mload(add(add(input, 0x20), i)))\n chunk := and(\n 0x0000000000000000ffffffffffffffff0000000000000000ffffffffffffffff,\n or(shl(64, chunk), chunk)\n )\n chunk := and(\n 0x00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff,\n or(shl(32, chunk), chunk)\n )\n chunk := and(\n 0x0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff,\n or(shl(16, chunk), chunk)\n )\n chunk := and(\n 0x00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff,\n or(shl(8, chunk), chunk)\n )\n chunk := and(\n 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f,\n or(shl(4, chunk), chunk)\n )\n mstore(add(add(output, 0x20), mul(i, 2)), chunk)\n }\n }\n }\n\n /**\n * @dev Returns true if the two byte buffers are equal.\n */\n function equal(bytes memory a, bytes memory b) internal pure returns (bool) {\n return a.length == b.length && keccak256(a) == keccak256(b);\n }\n\n /**\n * @dev Reverses the byte order of a bytes32 value, converting between little-endian and big-endian.\n * Inspired by https://graphics.stanford.edu/~seander/bithacks.html#ReverseParallel[Reverse Parallel]\n */\n function reverseBytes32(bytes32 value) internal pure returns (bytes32) {\n value = // swap bytes\n ((value >> 8) & 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF) |\n ((value & 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF) << 8);\n value = // swap 2-byte long pairs\n ((value >> 16) & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) |\n ((value & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) << 16);\n value = // swap 4-byte long pairs\n ((value >> 32) & 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) |\n ((value & 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) << 32);\n value = // swap 8-byte long pairs\n ((value >> 64) & 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) |\n ((value & 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) << 64);\n return (value >> 128) | (value << 128); // swap 16-byte long pairs\n }\n\n /// @dev Same as {reverseBytes32} but optimized for 128-bit values.\n function reverseBytes16(bytes16 value) internal pure returns (bytes16) {\n value = // swap bytes\n ((value & 0xFF00FF00FF00FF00FF00FF00FF00FF00) >> 8) |\n ((value & 0x00FF00FF00FF00FF00FF00FF00FF00FF) << 8);\n value = // swap 2-byte long pairs\n ((value & 0xFFFF0000FFFF0000FFFF0000FFFF0000) >> 16) |\n ((value & 0x0000FFFF0000FFFF0000FFFF0000FFFF) << 16);\n value = // swap 4-byte long pairs\n ((value & 0xFFFFFFFF00000000FFFFFFFF00000000) >> 32) |\n ((value & 0x00000000FFFFFFFF00000000FFFFFFFF) << 32);\n return (value >> 64) | (value << 64); // swap 8-byte long pairs\n }\n\n /// @dev Same as {reverseBytes32} but optimized for 64-bit values.\n function reverseBytes8(bytes8 value) internal pure returns (bytes8) {\n value = ((value & 0xFF00FF00FF00FF00) >> 8) | ((value & 0x00FF00FF00FF00FF) << 8); // swap bytes\n value = ((value & 0xFFFF0000FFFF0000) >> 16) | ((value & 0x0000FFFF0000FFFF) << 16); // swap 2-byte long pairs\n return (value >> 32) | (value << 32); // swap 4-byte long pairs\n }\n\n /// @dev Same as {reverseBytes32} but optimized for 32-bit values.\n function reverseBytes4(bytes4 value) internal pure returns (bytes4) {\n value = ((value & 0xFF00FF00) >> 8) | ((value & 0x00FF00FF) << 8); // swap bytes\n return (value >> 16) | (value << 16); // swap 2-byte long pairs\n }\n\n /// @dev Same as {reverseBytes32} but optimized for 16-bit values.\n function reverseBytes2(bytes2 value) internal pure returns (bytes2) {\n return (value >> 8) | (value << 8);\n }\n\n /**\n * @dev Counts the number of leading zero bits a bytes array. Returns `8 * buffer.length`\n * if the buffer is all zeros.\n */\n function clz(bytes memory buffer) internal pure returns (uint256) {\n for (uint256 i = 0; i < buffer.length; i += 0x20) {\n bytes32 chunk = _unsafeReadBytesOffset(buffer, i);\n if (chunk != bytes32(0)) {\n return Math.min(8 * i + Math.clz(uint256(chunk)), 8 * buffer.length);\n }\n }\n return 8 * buffer.length;\n }\n\n /**\n * @dev Reads a bytes32 from a bytes array without bounds checking.\n *\n * NOTE: making this function internal would mean it could be used with memory unsafe offset, and marking the\n * assembly block as such would prevent some optimizations.\n */\n function _unsafeReadBytesOffset(bytes memory buffer, uint256 offset) private pure returns (bytes32 value) {\n // This is not memory safe in the general case, but all calls to this private function are within bounds.\n assembly (\"memory-safe\") {\n value := mload(add(add(buffer, 0x20), offset))\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.6.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS\n }\n\n /**\n * @dev The signature is invalid.\n */\n error ECDSAInvalidSignature();\n\n /**\n * @dev The signature has an invalid length.\n */\n error ECDSAInvalidSignatureLength(uint256 length);\n\n /**\n * @dev The signature has an S value that is in the upper half order.\n */\n error ECDSAInvalidSignatureS(bytes32 s);\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not\n * return address(0) without also returning an error description. Errors are documented using an enum (error type)\n * and a bytes32 providing additional information about the error.\n *\n * If no error is returned, then the address can be used for verification purposes.\n *\n * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * NOTE: This function only supports 65-byte signatures. ERC-2098 short signatures are rejected. This restriction\n * is DEPRECATED and will be removed in v6.0. Developers SHOULD NOT use signatures as unique identifiers; use hash\n * invalidation or nonces for replay protection.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n *\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n */\n function tryRecover(\n bytes32 hash,\n bytes memory signature\n ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly (\"memory-safe\") {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));\n }\n }\n\n /**\n * @dev Variant of {tryRecover} that takes a signature in calldata\n */\n function tryRecoverCalldata(\n bytes32 hash,\n bytes calldata signature\n ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, calldata slices would work here, but are\n // significantly more expensive (length check) than using calldataload in assembly.\n assembly (\"memory-safe\") {\n r := calldataload(signature.offset)\n s := calldataload(add(signature.offset, 0x20))\n v := byte(0, calldataload(add(signature.offset, 0x40)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * NOTE: This function only supports 65-byte signatures. ERC-2098 short signatures are rejected. This restriction\n * is DEPRECATED and will be removed in v6.0. Developers SHOULD NOT use signatures as unique identifiers; use hash\n * invalidation or nonces for replay protection.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);\n _throwError(error, errorArg);\n return recovered;\n }\n\n /**\n * @dev Variant of {recover} that takes a signature in calldata\n */\n function recoverCalldata(bytes32 hash, bytes calldata signature) internal pure returns (address) {\n (address recovered, RecoverError error, bytes32 errorArg) = tryRecoverCalldata(hash, signature);\n _throwError(error, errorArg);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[ERC-2098 short signatures]\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {\n unchecked {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n // We do not check for an overflow here since the shift operation results in 0 or 1.\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r` and `vs` short-signature fields separately.\n */\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\n (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);\n _throwError(error, errorArg);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS, s);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature, bytes32(0));\n }\n\n return (signer, RecoverError.NoError, bytes32(0));\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);\n _throwError(error, errorArg);\n return recovered;\n }\n\n /**\n * @dev Parse a signature into its `v`, `r` and `s` components. Supports 65-byte and 64-byte (ERC-2098)\n * formats. Returns (0,0,0) for invalid signatures.\n *\n * For 64-byte signatures, `v` is automatically normalized to 27 or 28.\n * For 65-byte signatures, `v` is returned as-is and MUST already be 27 or 28 for use with ecrecover.\n *\n * Consider validating the result before use, or use {tryRecover}/{recover} which perform full validation.\n */\n function parse(bytes memory signature) internal pure returns (uint8 v, bytes32 r, bytes32 s) {\n assembly (\"memory-safe\") {\n // Check the signature length\n switch mload(signature)\n // - case 65: r,s,v signature (standard)\n case 65 {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098)\n case 64 {\n let vs := mload(add(signature, 0x40))\n r := mload(add(signature, 0x20))\n s := and(vs, shr(1, not(0)))\n v := add(shr(255, vs), 27)\n }\n default {\n r := 0\n s := 0\n v := 0\n }\n }\n }\n\n /**\n * @dev Variant of {parse} that takes a signature in calldata\n */\n function parseCalldata(bytes calldata signature) internal pure returns (uint8 v, bytes32 r, bytes32 s) {\n assembly (\"memory-safe\") {\n // Check the signature length\n switch signature.length\n // - case 65: r,s,v signature (standard)\n case 65 {\n r := calldataload(signature.offset)\n s := calldataload(add(signature.offset, 0x20))\n v := byte(0, calldataload(add(signature.offset, 0x40)))\n }\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098)\n case 64 {\n let vs := calldataload(add(signature.offset, 0x20))\n r := calldataload(signature.offset)\n s := and(vs, shr(1, not(0)))\n v := add(shr(255, vs), 27)\n }\n default {\n r := 0\n s := 0\n v := 0\n }\n }\n }\n\n /**\n * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.\n */\n function _throwError(RecoverError error, bytes32 errorArg) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert ECDSAInvalidSignature();\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert ECDSAInvalidSignatureLength(uint256(errorArg));\n } else if (error == RecoverError.InvalidSignatureS) {\n revert ECDSAInvalidSignatureS(errorArg);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/EIP712.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.24;\n\nimport {MessageHashUtils} from \"./MessageHashUtils.sol\";\nimport {ShortStrings, ShortString} from \"../ShortStrings.sol\";\nimport {IERC5267} from \"../../interfaces/IERC5267.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP-712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose\n * encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract\n * does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to\n * produce the hash of their typed data using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP-712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\n * separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the\n * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\n *\n * @custom:oz-upgrades-unsafe-allow state-variable-immutable\n */\nabstract contract EIP712 is IERC5267 {\n using ShortStrings for *;\n\n bytes32 private constant TYPE_HASH =\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\n // invalidate the cached domain separator if the chain id changes.\n bytes32 private immutable _cachedDomainSeparator;\n uint256 private immutable _cachedChainId;\n address private immutable _cachedThis;\n\n bytes32 private immutable _hashedName;\n bytes32 private immutable _hashedVersion;\n\n ShortString private immutable _name;\n ShortString private immutable _version;\n // slither-disable-next-line constable-states\n string private _nameFallback;\n // slither-disable-next-line constable-states\n string private _versionFallback;\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP-712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n constructor(string memory name, string memory version) {\n _name = name.toShortStringWithFallback(_nameFallback);\n _version = version.toShortStringWithFallback(_versionFallback);\n _hashedName = keccak256(bytes(name));\n _hashedVersion = keccak256(bytes(version));\n\n _cachedChainId = block.chainid;\n _cachedDomainSeparator = _buildDomainSeparator();\n _cachedThis = address(this);\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n if (address(this) == _cachedThis && block.chainid == _cachedChainId) {\n return _cachedDomainSeparator;\n } else {\n return _buildDomainSeparator();\n }\n }\n\n function _buildDomainSeparator() private view returns (bytes32) {\n return keccak256(abi.encode(TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n\n /// @inheritdoc IERC5267\n function eip712Domain()\n public\n view\n virtual\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n )\n {\n return (\n hex\"0f\", // 01111\n _EIP712Name(),\n _EIP712Version(),\n block.chainid,\n address(this),\n bytes32(0),\n new uint256[](0)\n );\n }\n\n /**\n * @dev The name parameter for the EIP712 domain.\n *\n * NOTE: By default this function reads _name which is an immutable value.\n * It only reads from storage if necessary (in case the value is too large to fit in a ShortString).\n */\n // solhint-disable-next-line func-name-mixedcase\n function _EIP712Name() internal view returns (string memory) {\n return _name.toStringWithFallback(_nameFallback);\n }\n\n /**\n * @dev The version parameter for the EIP712 domain.\n *\n * NOTE: By default this function reads _version which is an immutable value.\n * It only reads from storage if necessary (in case the value is too large to fit in a ShortString).\n */\n // solhint-disable-next-line func-name-mixedcase\n function _EIP712Version() internal view returns (string memory) {\n return _version.toStringWithFallback(_versionFallback);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.6.0) (utils/cryptography/MessageHashUtils.sol)\n\npragma solidity ^0.8.24;\n\nimport {Strings} from \"../Strings.sol\";\n\n/**\n * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.\n *\n * The library provides methods for generating a hash of a message that conforms to the\n * https://eips.ethereum.org/EIPS/eip-191[ERC-191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]\n * specifications.\n */\nlibrary MessageHashUtils {\n error ERC5267ExtensionsNotSupported();\n\n /**\n * @dev Returns the keccak256 digest of an ERC-191 signed data with version\n * `0x45` (`personal_sign` messages).\n *\n * The digest is calculated by prefixing a bytes32 `messageHash` with\n * `\"\\x19Ethereum Signed Message:\\n32\"` and hashing the result. It corresponds with the\n * hash signed when using the https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sign[`eth_sign`] JSON-RPC method.\n *\n * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with\n * keccak256, although any bytes32 value can be safely used because the final digest will\n * be re-hashed.\n *\n * See {ECDSA-recover}.\n */\n function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) {\n assembly (\"memory-safe\") {\n mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\") // 32 is the bytes-length of messageHash\n mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix\n digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20)\n }\n }\n\n /**\n * @dev Returns the keccak256 digest of an ERC-191 signed data with version\n * `0x45` (`personal_sign` messages).\n *\n * The digest is calculated by prefixing an arbitrary `message` with\n * `\"\\x19Ethereum Signed Message:\\n\" + len(message)` and hashing the result. It corresponds with the\n * hash signed when using the https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sign[`eth_sign`] JSON-RPC method.\n *\n * See {ECDSA-recover}.\n */\n function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) {\n return\n keccak256(bytes.concat(\"\\x19Ethereum Signed Message:\\n\", bytes(Strings.toString(message.length)), message));\n }\n\n /**\n * @dev Returns the keccak256 digest of an ERC-191 signed data with version\n * `0x00` (data with intended validator).\n *\n * The digest is calculated by prefixing an arbitrary `data` with `\"\\x19\\x00\"` and the intended\n * `validator` address. Then hashing the result.\n *\n * See {ECDSA-recover}.\n */\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(hex\"19_00\", validator, data));\n }\n\n /**\n * @dev Variant of {toDataWithIntendedValidatorHash-address-bytes} optimized for cases where `data` is a bytes32.\n */\n function toDataWithIntendedValidatorHash(\n address validator,\n bytes32 messageHash\n ) internal pure returns (bytes32 digest) {\n assembly (\"memory-safe\") {\n mstore(0x00, hex\"19_00\")\n mstore(0x02, shl(96, validator))\n mstore(0x16, messageHash)\n digest := keccak256(0x00, 0x36)\n }\n }\n\n /**\n * @dev Returns the keccak256 digest of an EIP-712 typed data (ERC-191 version `0x01`).\n *\n * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with\n * `\\x19\\x01` and hashing the result. It corresponds to the hash signed by the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.\n *\n * See {ECDSA-recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) {\n assembly (\"memory-safe\") {\n let ptr := mload(0x40)\n mstore(ptr, hex\"19_01\")\n mstore(add(ptr, 0x02), domainSeparator)\n mstore(add(ptr, 0x22), structHash)\n digest := keccak256(ptr, 0x42)\n }\n }\n\n /**\n * @dev Returns the EIP-712 domain separator constructed from an `eip712Domain`. See {IERC5267-eip712Domain}\n *\n * This function dynamically constructs the domain separator based on which fields are present in the\n * `fields` parameter. It contains flags that indicate which domain fields are present:\n *\n * * Bit 0 (0x01): name\n * * Bit 1 (0x02): version\n * * Bit 2 (0x04): chainId\n * * Bit 3 (0x08): verifyingContract\n * * Bit 4 (0x10): salt\n *\n * Arguments that correspond to fields which are not present in `fields` are ignored. For example, if `fields` is\n * `0x0f` (`0b01111`), then the `salt` parameter is ignored.\n */\n function toDomainSeparator(\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt\n ) internal pure returns (bytes32 hash) {\n return\n toDomainSeparator(\n fields,\n keccak256(bytes(name)),\n keccak256(bytes(version)),\n chainId,\n verifyingContract,\n salt\n );\n }\n\n /// @dev Variant of {toDomainSeparator-bytes1-string-string-uint256-address-bytes32} that uses hashed name and version.\n function toDomainSeparator(\n bytes1 fields,\n bytes32 nameHash,\n bytes32 versionHash,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt\n ) internal pure returns (bytes32 hash) {\n bytes32 domainTypeHash = toDomainTypeHash(fields);\n\n assembly (\"memory-safe\") {\n // align fields to the right for easy processing\n fields := shr(248, fields)\n\n // FMP used as scratch space\n let fmp := mload(0x40)\n mstore(fmp, domainTypeHash)\n\n let ptr := add(fmp, 0x20)\n if and(fields, 0x01) {\n mstore(ptr, nameHash)\n ptr := add(ptr, 0x20)\n }\n if and(fields, 0x02) {\n mstore(ptr, versionHash)\n ptr := add(ptr, 0x20)\n }\n if and(fields, 0x04) {\n mstore(ptr, chainId)\n ptr := add(ptr, 0x20)\n }\n if and(fields, 0x08) {\n mstore(ptr, verifyingContract)\n ptr := add(ptr, 0x20)\n }\n if and(fields, 0x10) {\n mstore(ptr, salt)\n ptr := add(ptr, 0x20)\n }\n\n hash := keccak256(fmp, sub(ptr, fmp))\n }\n }\n\n /// @dev Builds an EIP-712 domain type hash depending on the `fields` provided, following https://eips.ethereum.org/EIPS/eip-5267[ERC-5267]\n function toDomainTypeHash(bytes1 fields) internal pure returns (bytes32 hash) {\n if (fields & 0x20 == 0x20) revert ERC5267ExtensionsNotSupported();\n\n assembly (\"memory-safe\") {\n // align fields to the right for easy processing\n fields := shr(248, fields)\n\n // FMP used as scratch space\n let fmp := mload(0x40)\n mstore(fmp, \"EIP712Domain(\")\n\n let ptr := add(fmp, 0x0d)\n // name field\n if and(fields, 0x01) {\n mstore(ptr, \"string name,\")\n ptr := add(ptr, 0x0c)\n }\n // version field\n if and(fields, 0x02) {\n mstore(ptr, \"string version,\")\n ptr := add(ptr, 0x0f)\n }\n // chainId field\n if and(fields, 0x04) {\n mstore(ptr, \"uint256 chainId,\")\n ptr := add(ptr, 0x10)\n }\n // verifyingContract field\n if and(fields, 0x08) {\n mstore(ptr, \"address verifyingContract,\")\n ptr := add(ptr, 0x1a)\n }\n // salt field\n if and(fields, 0x10) {\n mstore(ptr, \"bytes32 salt,\")\n ptr := add(ptr, 0x0d)\n }\n // if any field is enabled, remove the trailing comma\n ptr := sub(ptr, iszero(iszero(and(fields, 0x1f))))\n // add the closing brace\n mstore8(ptr, 0x29) // add closing brace\n ptr := add(ptr, 1)\n\n hash := keccak256(fmp, sub(ptr, fmp))\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)\n\npragma solidity >=0.4.16;\n\n/**\n * @dev Interface of the ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.6.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.20;\n\nimport {Panic} from \"../Panic.sol\";\nimport {SafeCast} from \"./SafeCast.sol\";\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Floor, // Toward negative infinity\n Ceil, // Toward positive infinity\n Trunc, // Toward zero\n Expand // Away from zero\n }\n\n /**\n * @dev Return the 512-bit addition of two uint256.\n *\n * The result is stored in two 256 variables such that sum = high * 2²⁵⁶ + low.\n */\n function add512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {\n assembly (\"memory-safe\") {\n low := add(a, b)\n high := lt(low, a)\n }\n }\n\n /**\n * @dev Return the 512-bit multiplication of two uint256.\n *\n * The result is stored in two 256 variables such that product = high * 2²⁵⁶ + low.\n */\n function mul512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {\n // 512-bit multiply [high low] = x * y. Compute the product mod 2²⁵⁶ and mod 2²⁵⁶ - 1, then use\n // the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = high * 2²⁵⁶ + low.\n assembly (\"memory-safe\") {\n let mm := mulmod(a, b, not(0))\n low := mul(a, b)\n high := sub(sub(mm, low), lt(mm, low))\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, with a success flag (no overflow).\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n unchecked {\n uint256 c = a + b;\n success = c >= a;\n result = c * SafeCast.toUint(success);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with a success flag (no overflow).\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n unchecked {\n uint256 c = a - b;\n success = c <= a;\n result = c * SafeCast.toUint(success);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with a success flag (no overflow).\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n unchecked {\n uint256 c = a * b;\n assembly (\"memory-safe\") {\n // Only true when the multiplication doesn't overflow\n // (c / a == b) || (a == 0)\n success := or(eq(div(c, a), b), iszero(a))\n }\n // equivalent to: success ? c : 0\n result = c * SafeCast.toUint(success);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a success flag (no division by zero).\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n unchecked {\n success = b > 0;\n assembly (\"memory-safe\") {\n // The `DIV` opcode returns zero when the denominator is 0.\n result := div(a, b)\n }\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a success flag (no division by zero).\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n unchecked {\n success = b > 0;\n assembly (\"memory-safe\") {\n // The `MOD` opcode returns zero when the denominator is 0.\n result := mod(a, b)\n }\n }\n }\n\n /**\n * @dev Unsigned saturating addition, bounds to `2²⁵⁶ - 1` instead of overflowing.\n */\n function saturatingAdd(uint256 a, uint256 b) internal pure returns (uint256) {\n (bool success, uint256 result) = tryAdd(a, b);\n return ternary(success, result, type(uint256).max);\n }\n\n /**\n * @dev Unsigned saturating subtraction, bounds to zero instead of overflowing.\n */\n function saturatingSub(uint256 a, uint256 b) internal pure returns (uint256) {\n (, uint256 result) = trySub(a, b);\n return result;\n }\n\n /**\n * @dev Unsigned saturating multiplication, bounds to `2²⁵⁶ - 1` instead of overflowing.\n */\n function saturatingMul(uint256 a, uint256 b) internal pure returns (uint256) {\n (bool success, uint256 result) = tryMul(a, b);\n return ternary(success, result, type(uint256).max);\n }\n\n /**\n * @dev Branchless ternary evaluation for `condition ? a : b`. Gas costs are constant.\n *\n * IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.\n * However, the compiler may optimize Solidity ternary operations (i.e. `condition ? a : b`) to only compute\n * one branch when needed, making this function more expensive.\n */\n function ternary(bool condition, uint256 a, uint256 b) internal pure returns (uint256) {\n unchecked {\n // branchless ternary works because:\n // b ^ (a ^ b) == a\n // b ^ 0 == b\n return b ^ ((a ^ b) * SafeCast.toUint(condition));\n }\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return ternary(a > b, a, b);\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return ternary(a < b, a, b);\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n unchecked {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds towards infinity instead\n * of rounding towards zero.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n if (b == 0) {\n // Guarantee the same behavior as in a regular Solidity division.\n Panic.panic(Panic.DIVISION_BY_ZERO);\n }\n\n // The following calculation ensures accurate ceiling division without overflow.\n // Since a is non-zero, (a - 1) / b will not overflow.\n // The largest possible result occurs when (a - 1) / b is type(uint256).max,\n // but the largest value we can obtain is type(uint256).max - 1, which happens\n // when a = type(uint256).max and b = 1.\n unchecked {\n return SafeCast.toUint(a > 0) * ((a - 1) / b + 1);\n }\n }\n\n /**\n * @dev Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or\n * denominator == 0.\n *\n * Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by\n * Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n (uint256 high, uint256 low) = mul512(x, y);\n\n // Handle non-overflow cases, 256 by 256 division.\n if (high == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return low / denominator;\n }\n\n // Make sure the result is less than 2²⁵⁶. Also prevents denominator == 0.\n if (denominator <= high) {\n Panic.panic(ternary(denominator == 0, Panic.DIVISION_BY_ZERO, Panic.UNDER_OVERFLOW));\n }\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [high low].\n uint256 remainder;\n assembly (\"memory-safe\") {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n high := sub(high, gt(remainder, low))\n low := sub(low, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator.\n // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.\n\n uint256 twos = denominator & (0 - denominator);\n assembly (\"memory-safe\") {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [high low] by twos.\n low := div(low, twos)\n\n // Flip twos such that it is 2²⁵⁶ / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from high into low.\n low |= high * twos;\n\n // Invert denominator mod 2²⁵⁶. Now that denominator is an odd number, it has an inverse modulo 2²⁵⁶ such\n // that denominator * inv ≡ 1 mod 2²⁵⁶. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv ≡ 1 mod 2⁴.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also\n // works in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2⁸\n inverse *= 2 - denominator * inverse; // inverse mod 2¹⁶\n inverse *= 2 - denominator * inverse; // inverse mod 2³²\n inverse *= 2 - denominator * inverse; // inverse mod 2⁶⁴\n inverse *= 2 - denominator * inverse; // inverse mod 2¹²⁸\n inverse *= 2 - denominator * inverse; // inverse mod 2²⁵⁶\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2²⁵⁶. Since the preconditions guarantee that the outcome is\n // less than 2²⁵⁶, this is the final result. We don't need to compute the high bits of the result and high\n // is no longer required.\n result = low * inverse;\n return result;\n }\n }\n\n /**\n * @dev Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n return mulDiv(x, y, denominator) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0);\n }\n\n /**\n * @dev Calculates floor(x * y >> n) with full precision. Throws if result overflows a uint256.\n */\n function mulShr(uint256 x, uint256 y, uint8 n) internal pure returns (uint256 result) {\n unchecked {\n (uint256 high, uint256 low) = mul512(x, y);\n if (high >= 1 << n) {\n Panic.panic(Panic.UNDER_OVERFLOW);\n }\n return (high << (256 - n)) | (low >> n);\n }\n }\n\n /**\n * @dev Calculates x * y >> n with full precision, following the selected rounding direction.\n */\n function mulShr(uint256 x, uint256 y, uint8 n, Rounding rounding) internal pure returns (uint256) {\n return mulShr(x, y, n) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, 1 << n) > 0);\n }\n\n /**\n * @dev Calculate the modular multiplicative inverse of a number in Z/nZ.\n *\n * If n is a prime, then Z/nZ is a field. In that case all elements are inversible, except 0.\n * If n is not a prime, then Z/nZ is not a field, and some elements might not be inversible.\n *\n * If the input value is not inversible, 0 is returned.\n *\n * NOTE: If you know for sure that n is (big) a prime, it may be cheaper to use Fermat's little theorem and get the\n * inverse using `Math.modExp(a, n - 2, n)`. See {invModPrime}.\n */\n function invMod(uint256 a, uint256 n) internal pure returns (uint256) {\n unchecked {\n if (n == 0) return 0;\n\n // The inverse modulo is calculated using the Extended Euclidean Algorithm (iterative version)\n // Used to compute integers x and y such that: ax + ny = gcd(a, n).\n // When the gcd is 1, then the inverse of a modulo n exists and it's x.\n // ax + ny = 1\n // ax = 1 + (-y)n\n // ax ≡ 1 (mod n) # x is the inverse of a modulo n\n\n // If the remainder is 0 the gcd is n right away.\n uint256 remainder = a % n;\n uint256 gcd = n;\n\n // Therefore the initial coefficients are:\n // ax + ny = gcd(a, n) = n\n // 0a + 1n = n\n int256 x = 0;\n int256 y = 1;\n\n while (remainder != 0) {\n uint256 quotient = gcd / remainder;\n\n (gcd, remainder) = (\n // The old remainder is the next gcd to try.\n remainder,\n // Compute the next remainder.\n // Can't overflow given that (a % gcd) * (gcd // (a % gcd)) <= gcd\n // where gcd is at most n (capped to type(uint256).max)\n gcd - remainder * quotient\n );\n\n (x, y) = (\n // Increment the coefficient of a.\n y,\n // Decrement the coefficient of n.\n // Can overflow, but the result is casted to uint256 so that the\n // next value of y is \"wrapped around\" to a value between 0 and n - 1.\n x - y * int256(quotient)\n );\n }\n\n if (gcd != 1) return 0; // No inverse exists.\n return ternary(x < 0, n - uint256(-x), uint256(x)); // Wrap the result if it's negative.\n }\n }\n\n /**\n * @dev Variant of {invMod}. More efficient, but only works if `p` is known to be a prime greater than `2`.\n *\n * From https://en.wikipedia.org/wiki/Fermat%27s_little_theorem[Fermat's little theorem], we know that if p is\n * prime, then `a**(p-1) ≡ 1 mod p`. As a consequence, we have `a * a**(p-2) ≡ 1 mod p`, which means that\n * `a**(p-2)` is the modular multiplicative inverse of a in Fp.\n *\n * NOTE: this function does NOT check that `p` is a prime greater than `2`.\n */\n function invModPrime(uint256 a, uint256 p) internal view returns (uint256) {\n unchecked {\n return Math.modExp(a, p - 2, p);\n }\n }\n\n /**\n * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m)\n *\n * Requirements:\n * - modulus can't be zero\n * - underlying staticcall to precompile must succeed\n *\n * IMPORTANT: The result is only valid if the underlying call succeeds. When using this function, make\n * sure the chain you're using it on supports the precompiled contract for modular exponentiation\n * at address 0x05 as specified in https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise,\n * the underlying function will succeed given the lack of a revert, but the result may be incorrectly\n * interpreted as 0.\n */\n function modExp(uint256 b, uint256 e, uint256 m) internal view returns (uint256) {\n (bool success, uint256 result) = tryModExp(b, e, m);\n if (!success) {\n Panic.panic(Panic.DIVISION_BY_ZERO);\n }\n return result;\n }\n\n /**\n * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m).\n * It includes a success flag indicating if the operation succeeded. Operation will be marked as failed if trying\n * to operate modulo 0 or if the underlying precompile reverted.\n *\n * IMPORTANT: The result is only valid if the success flag is true. When using this function, make sure the chain\n * you're using it on supports the precompiled contract for modular exponentiation at address 0x05 as specified in\n * https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, the underlying function will succeed given the lack\n * of a revert, but the result may be incorrectly interpreted as 0.\n */\n function tryModExp(uint256 b, uint256 e, uint256 m) internal view returns (bool success, uint256 result) {\n if (m == 0) return (false, 0);\n assembly (\"memory-safe\") {\n let ptr := mload(0x40)\n // | Offset | Content | Content (Hex) |\n // |-----------|------------|--------------------------------------------------------------------|\n // | 0x00:0x1f | size of b | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n // | 0x20:0x3f | size of e | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n // | 0x40:0x5f | size of m | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n // | 0x60:0x7f | value of b | 0x<.............................................................b> |\n // | 0x80:0x9f | value of e | 0x<.............................................................e> |\n // | 0xa0:0xbf | value of m | 0x<.............................................................m> |\n mstore(ptr, 0x20)\n mstore(add(ptr, 0x20), 0x20)\n mstore(add(ptr, 0x40), 0x20)\n mstore(add(ptr, 0x60), b)\n mstore(add(ptr, 0x80), e)\n mstore(add(ptr, 0xa0), m)\n\n // Given the result < m, it's guaranteed to fit in 32 bytes,\n // so we can use the memory scratch space located at offset 0.\n success := staticcall(gas(), 0x05, ptr, 0xc0, 0x00, 0x20)\n result := mload(0x00)\n }\n }\n\n /**\n * @dev Variant of {modExp} that supports inputs of arbitrary length.\n */\n function modExp(bytes memory b, bytes memory e, bytes memory m) internal view returns (bytes memory) {\n (bool success, bytes memory result) = tryModExp(b, e, m);\n if (!success) {\n Panic.panic(Panic.DIVISION_BY_ZERO);\n }\n return result;\n }\n\n /**\n * @dev Variant of {tryModExp} that supports inputs of arbitrary length.\n */\n function tryModExp(\n bytes memory b,\n bytes memory e,\n bytes memory m\n ) internal view returns (bool success, bytes memory result) {\n if (_zeroBytes(m)) return (false, new bytes(0));\n\n uint256 mLen = m.length;\n\n // Encode call args in result and move the free memory pointer\n result = abi.encodePacked(b.length, e.length, mLen, b, e, m);\n\n assembly (\"memory-safe\") {\n let dataPtr := add(result, 0x20)\n // Write result on top of args to avoid allocating extra memory.\n success := staticcall(gas(), 0x05, dataPtr, mload(result), dataPtr, mLen)\n // Overwrite the length.\n // result.length > returndatasize() is guaranteed because returndatasize() == m.length\n mstore(result, mLen)\n // Set the memory pointer after the returned data.\n mstore(0x40, add(dataPtr, mLen))\n }\n }\n\n /**\n * @dev Returns whether the provided byte array is zero.\n */\n function _zeroBytes(bytes memory buffer) private pure returns (bool) {\n uint256 chunk;\n for (uint256 i = 0; i < buffer.length; i += 0x20) {\n // See _unsafeReadBytesOffset from utils/Bytes.sol\n assembly (\"memory-safe\") {\n chunk := mload(add(add(buffer, 0x20), i))\n }\n if (chunk >> (8 * saturatingSub(i + 0x20, buffer.length)) != 0) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded\n * towards zero.\n *\n * This method is based on Newton's method for computing square roots; the algorithm is restricted to only\n * using integer operations.\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n unchecked {\n // Take care of easy edge cases when a == 0 or a == 1\n if (a <= 1) {\n return a;\n }\n\n // In this function, we use Newton's method to get a root of `f(x) := x² - a`. It involves building a\n // sequence x_n that converges toward sqrt(a). For each iteration x_n, we also define the error between\n // the current value as `ε_n = | x_n - sqrt(a) |`.\n //\n // For our first estimation, we consider `e` the smallest power of 2 which is bigger than the square root\n // of the target. (i.e. `2**(e-1) ≤ sqrt(a) < 2**e`). We know that `e ≤ 128` because `(2¹²⁸)² = 2²⁵⁶` is\n // bigger than any uint256.\n //\n // By noticing that\n // `2**(e-1) ≤ sqrt(a) < 2**e → (2**(e-1))² ≤ a < (2**e)² → 2**(2*e-2) ≤ a < 2**(2*e)`\n // we can deduce that `e - 1` is `log2(a) / 2`. We can thus compute `x_n = 2**(e-1)` using a method similar\n // to the msb function.\n uint256 aa = a;\n uint256 xn = 1;\n\n if (aa >= (1 << 128)) {\n aa >>= 128;\n xn <<= 64;\n }\n if (aa >= (1 << 64)) {\n aa >>= 64;\n xn <<= 32;\n }\n if (aa >= (1 << 32)) {\n aa >>= 32;\n xn <<= 16;\n }\n if (aa >= (1 << 16)) {\n aa >>= 16;\n xn <<= 8;\n }\n if (aa >= (1 << 8)) {\n aa >>= 8;\n xn <<= 4;\n }\n if (aa >= (1 << 4)) {\n aa >>= 4;\n xn <<= 2;\n }\n if (aa >= (1 << 2)) {\n xn <<= 1;\n }\n\n // We now have x_n such that `x_n = 2**(e-1) ≤ sqrt(a) < 2**e = 2 * x_n`. This implies ε_n ≤ 2**(e-1).\n //\n // We can refine our estimation by noticing that the middle of that interval minimizes the error.\n // If we move x_n to equal 2**(e-1) + 2**(e-2), then we reduce the error to ε_n ≤ 2**(e-2).\n // This is going to be our x_0 (and ε_0)\n xn = (3 * xn) >> 1; // ε_0 := | x_0 - sqrt(a) | ≤ 2**(e-2)\n\n // From here, Newton's method give us:\n // x_{n+1} = (x_n + a / x_n) / 2\n //\n // One should note that:\n // x_{n+1}² - a = ((x_n + a / x_n) / 2)² - a\n // = ((x_n² + a) / (2 * x_n))² - a\n // = (x_n⁴ + 2 * a * x_n² + a²) / (4 * x_n²) - a\n // = (x_n⁴ + 2 * a * x_n² + a² - 4 * a * x_n²) / (4 * x_n²)\n // = (x_n⁴ - 2 * a * x_n² + a²) / (4 * x_n²)\n // = (x_n² - a)² / (2 * x_n)²\n // = ((x_n² - a) / (2 * x_n))²\n // ≥ 0\n // Which proves that for all n ≥ 1, sqrt(a) ≤ x_n\n //\n // This gives us the proof of quadratic convergence of the sequence:\n // ε_{n+1} = | x_{n+1} - sqrt(a) |\n // = | (x_n + a / x_n) / 2 - sqrt(a) |\n // = | (x_n² + a - 2*x_n*sqrt(a)) / (2 * x_n) |\n // = | (x_n - sqrt(a))² / (2 * x_n) |\n // = | ε_n² / (2 * x_n) |\n // = ε_n² / | (2 * x_n) |\n //\n // For the first iteration, we have a special case where x_0 is known:\n // ε_1 = ε_0² / | (2 * x_0) |\n // ≤ (2**(e-2))² / (2 * (2**(e-1) + 2**(e-2)))\n // ≤ 2**(2*e-4) / (3 * 2**(e-1))\n // ≤ 2**(e-3) / 3\n // ≤ 2**(e-3-log2(3))\n // ≤ 2**(e-4.5)\n //\n // For the following iterations, we use the fact that, 2**(e-1) ≤ sqrt(a) ≤ x_n:\n // ε_{n+1} = ε_n² / | (2 * x_n) |\n // ≤ (2**(e-k))² / (2 * 2**(e-1))\n // ≤ 2**(2*e-2*k) / 2**e\n // ≤ 2**(e-2*k)\n xn = (xn + a / xn) >> 1; // ε_1 := | x_1 - sqrt(a) | ≤ 2**(e-4.5) -- special case, see above\n xn = (xn + a / xn) >> 1; // ε_2 := | x_2 - sqrt(a) | ≤ 2**(e-9) -- general case with k = 4.5\n xn = (xn + a / xn) >> 1; // ε_3 := | x_3 - sqrt(a) | ≤ 2**(e-18) -- general case with k = 9\n xn = (xn + a / xn) >> 1; // ε_4 := | x_4 - sqrt(a) | ≤ 2**(e-36) -- general case with k = 18\n xn = (xn + a / xn) >> 1; // ε_5 := | x_5 - sqrt(a) | ≤ 2**(e-72) -- general case with k = 36\n xn = (xn + a / xn) >> 1; // ε_6 := | x_6 - sqrt(a) | ≤ 2**(e-144) -- general case with k = 72\n\n // Because e ≤ 128 (as discussed during the first estimation phase), we know have reached a precision\n // ε_6 ≤ 2**(e-144) < 1. Given we're operating on integers, then we can ensure that xn is now either\n // sqrt(a) or sqrt(a) + 1.\n return xn - SafeCast.toUint(xn > a / xn);\n }\n }\n\n /**\n * @dev Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + SafeCast.toUint(unsignedRoundsUp(rounding) && result * result < a);\n }\n }\n\n /**\n * @dev Return the log in base 2 of a positive value rounded towards zero.\n * Returns 0 if given 0.\n */\n function log2(uint256 x) internal pure returns (uint256 r) {\n // If value has upper 128 bits set, log2 result is at least 128\n r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;\n // If upper 64 bits of 128-bit half set, add 64 to result\n r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;\n // If upper 32 bits of 64-bit half set, add 32 to result\n r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;\n // If upper 16 bits of 32-bit half set, add 16 to result\n r |= SafeCast.toUint((x >> r) > 0xffff) << 4;\n // If upper 8 bits of 16-bit half set, add 8 to result\n r |= SafeCast.toUint((x >> r) > 0xff) << 3;\n // If upper 4 bits of 8-bit half set, add 4 to result\n r |= SafeCast.toUint((x >> r) > 0xf) << 2;\n\n // Shifts value right by the current result and use it as an index into this lookup table:\n //\n // | x (4 bits) | index | table[index] = MSB position |\n // |------------|---------|-----------------------------|\n // | 0000 | 0 | table[0] = 0 |\n // | 0001 | 1 | table[1] = 0 |\n // | 0010 | 2 | table[2] = 1 |\n // | 0011 | 3 | table[3] = 1 |\n // | 0100 | 4 | table[4] = 2 |\n // | 0101 | 5 | table[5] = 2 |\n // | 0110 | 6 | table[6] = 2 |\n // | 0111 | 7 | table[7] = 2 |\n // | 1000 | 8 | table[8] = 3 |\n // | 1001 | 9 | table[9] = 3 |\n // | 1010 | 10 | table[10] = 3 |\n // | 1011 | 11 | table[11] = 3 |\n // | 1100 | 12 | table[12] = 3 |\n // | 1101 | 13 | table[13] = 3 |\n // | 1110 | 14 | table[14] = 3 |\n // | 1111 | 15 | table[15] = 3 |\n //\n // The lookup table is represented as a 32-byte value with the MSB positions for 0-15 in the first 16 bytes (most significant half).\n assembly (\"memory-safe\") {\n r := or(r, byte(shr(r, x), 0x0000010102020202030303030303030300000000000000000000000000000000))\n }\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << result < value);\n }\n }\n\n /**\n * @dev Return the log in base 10 of a positive value rounded towards zero.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 10 ** result < value);\n }\n }\n\n /**\n * @dev Return the log in base 256 of a positive value rounded towards zero.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 x) internal pure returns (uint256 r) {\n // If value has upper 128 bits set, log2 result is at least 128\n r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;\n // If upper 64 bits of 128-bit half set, add 64 to result\n r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;\n // If upper 32 bits of 64-bit half set, add 32 to result\n r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;\n // If upper 16 bits of 32-bit half set, add 16 to result\n r |= SafeCast.toUint((x >> r) > 0xffff) << 4;\n // Add 1 if upper 8 bits of 16-bit half set, and divide accumulated result by 8\n return (r >> 3) | SafeCast.toUint((x >> r) > 0xff);\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << (result << 3) < value);\n }\n }\n\n /**\n * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.\n */\n function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {\n return uint8(rounding) % 2 == 1;\n }\n\n /**\n * @dev Counts the number of leading zero bits in a uint256.\n */\n function clz(uint256 x) internal pure returns (uint256) {\n return ternary(x == 0, 256, 255 - log2(x));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeCast.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.6.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeCast {\n /**\n * @dev Value doesn't fit in a uint of `bits` size.\n */\n error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);\n\n /**\n * @dev An int value doesn't fit in a uint of `bits` size.\n */\n error SafeCastOverflowedIntToUint(int256 value);\n\n /**\n * @dev Value doesn't fit in an int of `bits` size.\n */\n error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);\n\n /**\n * @dev A uint value doesn't fit in an int of `bits` size.\n */\n error SafeCastOverflowedUintToInt(uint256 value);\n\n /**\n * @dev Returns the downcasted uint248 from uint256, reverting on\n * overflow (when the input is greater than largest uint248).\n *\n * Counterpart to Solidity's `uint248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n */\n function toUint248(uint256 value) internal pure returns (uint248) {\n if (value > type(uint248).max) {\n revert SafeCastOverflowedUintDowncast(248, value);\n }\n return uint248(value);\n }\n\n /**\n * @dev Returns the downcasted uint240 from uint256, reverting on\n * overflow (when the input is greater than largest uint240).\n *\n * Counterpart to Solidity's `uint240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n */\n function toUint240(uint256 value) internal pure returns (uint240) {\n if (value > type(uint240).max) {\n revert SafeCastOverflowedUintDowncast(240, value);\n }\n return uint240(value);\n }\n\n /**\n * @dev Returns the downcasted uint232 from uint256, reverting on\n * overflow (when the input is greater than largest uint232).\n *\n * Counterpart to Solidity's `uint232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n */\n function toUint232(uint256 value) internal pure returns (uint232) {\n if (value > type(uint232).max) {\n revert SafeCastOverflowedUintDowncast(232, value);\n }\n return uint232(value);\n }\n\n /**\n * @dev Returns the downcasted uint224 from uint256, reverting on\n * overflow (when the input is greater than largest uint224).\n *\n * Counterpart to Solidity's `uint224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n */\n function toUint224(uint256 value) internal pure returns (uint224) {\n if (value > type(uint224).max) {\n revert SafeCastOverflowedUintDowncast(224, value);\n }\n return uint224(value);\n }\n\n /**\n * @dev Returns the downcasted uint216 from uint256, reverting on\n * overflow (when the input is greater than largest uint216).\n *\n * Counterpart to Solidity's `uint216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n */\n function toUint216(uint256 value) internal pure returns (uint216) {\n if (value > type(uint216).max) {\n revert SafeCastOverflowedUintDowncast(216, value);\n }\n return uint216(value);\n }\n\n /**\n * @dev Returns the downcasted uint208 from uint256, reverting on\n * overflow (when the input is greater than largest uint208).\n *\n * Counterpart to Solidity's `uint208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n */\n function toUint208(uint256 value) internal pure returns (uint208) {\n if (value > type(uint208).max) {\n revert SafeCastOverflowedUintDowncast(208, value);\n }\n return uint208(value);\n }\n\n /**\n * @dev Returns the downcasted uint200 from uint256, reverting on\n * overflow (when the input is greater than largest uint200).\n *\n * Counterpart to Solidity's `uint200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n */\n function toUint200(uint256 value) internal pure returns (uint200) {\n if (value > type(uint200).max) {\n revert SafeCastOverflowedUintDowncast(200, value);\n }\n return uint200(value);\n }\n\n /**\n * @dev Returns the downcasted uint192 from uint256, reverting on\n * overflow (when the input is greater than largest uint192).\n *\n * Counterpart to Solidity's `uint192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n */\n function toUint192(uint256 value) internal pure returns (uint192) {\n if (value > type(uint192).max) {\n revert SafeCastOverflowedUintDowncast(192, value);\n }\n return uint192(value);\n }\n\n /**\n * @dev Returns the downcasted uint184 from uint256, reverting on\n * overflow (when the input is greater than largest uint184).\n *\n * Counterpart to Solidity's `uint184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n */\n function toUint184(uint256 value) internal pure returns (uint184) {\n if (value > type(uint184).max) {\n revert SafeCastOverflowedUintDowncast(184, value);\n }\n return uint184(value);\n }\n\n /**\n * @dev Returns the downcasted uint176 from uint256, reverting on\n * overflow (when the input is greater than largest uint176).\n *\n * Counterpart to Solidity's `uint176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n */\n function toUint176(uint256 value) internal pure returns (uint176) {\n if (value > type(uint176).max) {\n revert SafeCastOverflowedUintDowncast(176, value);\n }\n return uint176(value);\n }\n\n /**\n * @dev Returns the downcasted uint168 from uint256, reverting on\n * overflow (when the input is greater than largest uint168).\n *\n * Counterpart to Solidity's `uint168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n */\n function toUint168(uint256 value) internal pure returns (uint168) {\n if (value > type(uint168).max) {\n revert SafeCastOverflowedUintDowncast(168, value);\n }\n return uint168(value);\n }\n\n /**\n * @dev Returns the downcasted uint160 from uint256, reverting on\n * overflow (when the input is greater than largest uint160).\n *\n * Counterpart to Solidity's `uint160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n */\n function toUint160(uint256 value) internal pure returns (uint160) {\n if (value > type(uint160).max) {\n revert SafeCastOverflowedUintDowncast(160, value);\n }\n return uint160(value);\n }\n\n /**\n * @dev Returns the downcasted uint152 from uint256, reverting on\n * overflow (when the input is greater than largest uint152).\n *\n * Counterpart to Solidity's `uint152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n */\n function toUint152(uint256 value) internal pure returns (uint152) {\n if (value > type(uint152).max) {\n revert SafeCastOverflowedUintDowncast(152, value);\n }\n return uint152(value);\n }\n\n /**\n * @dev Returns the downcasted uint144 from uint256, reverting on\n * overflow (when the input is greater than largest uint144).\n *\n * Counterpart to Solidity's `uint144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n */\n function toUint144(uint256 value) internal pure returns (uint144) {\n if (value > type(uint144).max) {\n revert SafeCastOverflowedUintDowncast(144, value);\n }\n return uint144(value);\n }\n\n /**\n * @dev Returns the downcasted uint136 from uint256, reverting on\n * overflow (when the input is greater than largest uint136).\n *\n * Counterpart to Solidity's `uint136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n */\n function toUint136(uint256 value) internal pure returns (uint136) {\n if (value > type(uint136).max) {\n revert SafeCastOverflowedUintDowncast(136, value);\n }\n return uint136(value);\n }\n\n /**\n * @dev Returns the downcasted uint128 from uint256, reverting on\n * overflow (when the input is greater than largest uint128).\n *\n * Counterpart to Solidity's `uint128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n */\n function toUint128(uint256 value) internal pure returns (uint128) {\n if (value > type(uint128).max) {\n revert SafeCastOverflowedUintDowncast(128, value);\n }\n return uint128(value);\n }\n\n /**\n * @dev Returns the downcasted uint120 from uint256, reverting on\n * overflow (when the input is greater than largest uint120).\n *\n * Counterpart to Solidity's `uint120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n */\n function toUint120(uint256 value) internal pure returns (uint120) {\n if (value > type(uint120).max) {\n revert SafeCastOverflowedUintDowncast(120, value);\n }\n return uint120(value);\n }\n\n /**\n * @dev Returns the downcasted uint112 from uint256, reverting on\n * overflow (when the input is greater than largest uint112).\n *\n * Counterpart to Solidity's `uint112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n */\n function toUint112(uint256 value) internal pure returns (uint112) {\n if (value > type(uint112).max) {\n revert SafeCastOverflowedUintDowncast(112, value);\n }\n return uint112(value);\n }\n\n /**\n * @dev Returns the downcasted uint104 from uint256, reverting on\n * overflow (when the input is greater than largest uint104).\n *\n * Counterpart to Solidity's `uint104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n */\n function toUint104(uint256 value) internal pure returns (uint104) {\n if (value > type(uint104).max) {\n revert SafeCastOverflowedUintDowncast(104, value);\n }\n return uint104(value);\n }\n\n /**\n * @dev Returns the downcasted uint96 from uint256, reverting on\n * overflow (when the input is greater than largest uint96).\n *\n * Counterpart to Solidity's `uint96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n */\n function toUint96(uint256 value) internal pure returns (uint96) {\n if (value > type(uint96).max) {\n revert SafeCastOverflowedUintDowncast(96, value);\n }\n return uint96(value);\n }\n\n /**\n * @dev Returns the downcasted uint88 from uint256, reverting on\n * overflow (when the input is greater than largest uint88).\n *\n * Counterpart to Solidity's `uint88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n */\n function toUint88(uint256 value) internal pure returns (uint88) {\n if (value > type(uint88).max) {\n revert SafeCastOverflowedUintDowncast(88, value);\n }\n return uint88(value);\n }\n\n /**\n * @dev Returns the downcasted uint80 from uint256, reverting on\n * overflow (when the input is greater than largest uint80).\n *\n * Counterpart to Solidity's `uint80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n */\n function toUint80(uint256 value) internal pure returns (uint80) {\n if (value > type(uint80).max) {\n revert SafeCastOverflowedUintDowncast(80, value);\n }\n return uint80(value);\n }\n\n /**\n * @dev Returns the downcasted uint72 from uint256, reverting on\n * overflow (when the input is greater than largest uint72).\n *\n * Counterpart to Solidity's `uint72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n */\n function toUint72(uint256 value) internal pure returns (uint72) {\n if (value > type(uint72).max) {\n revert SafeCastOverflowedUintDowncast(72, value);\n }\n return uint72(value);\n }\n\n /**\n * @dev Returns the downcasted uint64 from uint256, reverting on\n * overflow (when the input is greater than largest uint64).\n *\n * Counterpart to Solidity's `uint64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n */\n function toUint64(uint256 value) internal pure returns (uint64) {\n if (value > type(uint64).max) {\n revert SafeCastOverflowedUintDowncast(64, value);\n }\n return uint64(value);\n }\n\n /**\n * @dev Returns the downcasted uint56 from uint256, reverting on\n * overflow (when the input is greater than largest uint56).\n *\n * Counterpart to Solidity's `uint56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n */\n function toUint56(uint256 value) internal pure returns (uint56) {\n if (value > type(uint56).max) {\n revert SafeCastOverflowedUintDowncast(56, value);\n }\n return uint56(value);\n }\n\n /**\n * @dev Returns the downcasted uint48 from uint256, reverting on\n * overflow (when the input is greater than largest uint48).\n *\n * Counterpart to Solidity's `uint48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n */\n function toUint48(uint256 value) internal pure returns (uint48) {\n if (value > type(uint48).max) {\n revert SafeCastOverflowedUintDowncast(48, value);\n }\n return uint48(value);\n }\n\n /**\n * @dev Returns the downcasted uint40 from uint256, reverting on\n * overflow (when the input is greater than largest uint40).\n *\n * Counterpart to Solidity's `uint40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n */\n function toUint40(uint256 value) internal pure returns (uint40) {\n if (value > type(uint40).max) {\n revert SafeCastOverflowedUintDowncast(40, value);\n }\n return uint40(value);\n }\n\n /**\n * @dev Returns the downcasted uint32 from uint256, reverting on\n * overflow (when the input is greater than largest uint32).\n *\n * Counterpart to Solidity's `uint32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n */\n function toUint32(uint256 value) internal pure returns (uint32) {\n if (value > type(uint32).max) {\n revert SafeCastOverflowedUintDowncast(32, value);\n }\n return uint32(value);\n }\n\n /**\n * @dev Returns the downcasted uint24 from uint256, reverting on\n * overflow (when the input is greater than largest uint24).\n *\n * Counterpart to Solidity's `uint24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n */\n function toUint24(uint256 value) internal pure returns (uint24) {\n if (value > type(uint24).max) {\n revert SafeCastOverflowedUintDowncast(24, value);\n }\n return uint24(value);\n }\n\n /**\n * @dev Returns the downcasted uint16 from uint256, reverting on\n * overflow (when the input is greater than largest uint16).\n *\n * Counterpart to Solidity's `uint16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n */\n function toUint16(uint256 value) internal pure returns (uint16) {\n if (value > type(uint16).max) {\n revert SafeCastOverflowedUintDowncast(16, value);\n }\n return uint16(value);\n }\n\n /**\n * @dev Returns the downcasted uint8 from uint256, reverting on\n * overflow (when the input is greater than largest uint8).\n *\n * Counterpart to Solidity's `uint8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n */\n function toUint8(uint256 value) internal pure returns (uint8) {\n if (value > type(uint8).max) {\n revert SafeCastOverflowedUintDowncast(8, value);\n }\n return uint8(value);\n }\n\n /**\n * @dev Converts a signed int256 into an unsigned uint256.\n *\n * Requirements:\n *\n * - input must be greater than or equal to 0.\n */\n function toUint256(int256 value) internal pure returns (uint256) {\n if (value < 0) {\n revert SafeCastOverflowedIntToUint(value);\n }\n return uint256(value);\n }\n\n /**\n * @dev Returns the downcasted int248 from int256, reverting on\n * overflow (when the input is less than smallest int248 or\n * greater than largest int248).\n *\n * Counterpart to Solidity's `int248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n */\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\n downcasted = int248(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(248, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int240 from int256, reverting on\n * overflow (when the input is less than smallest int240 or\n * greater than largest int240).\n *\n * Counterpart to Solidity's `int240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n */\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\n downcasted = int240(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(240, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int232 from int256, reverting on\n * overflow (when the input is less than smallest int232 or\n * greater than largest int232).\n *\n * Counterpart to Solidity's `int232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n */\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\n downcasted = int232(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(232, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int224 from int256, reverting on\n * overflow (when the input is less than smallest int224 or\n * greater than largest int224).\n *\n * Counterpart to Solidity's `int224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n */\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\n downcasted = int224(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(224, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int216 from int256, reverting on\n * overflow (when the input is less than smallest int216 or\n * greater than largest int216).\n *\n * Counterpart to Solidity's `int216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n */\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\n downcasted = int216(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(216, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int208 from int256, reverting on\n * overflow (when the input is less than smallest int208 or\n * greater than largest int208).\n *\n * Counterpart to Solidity's `int208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n */\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\n downcasted = int208(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(208, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int200 from int256, reverting on\n * overflow (when the input is less than smallest int200 or\n * greater than largest int200).\n *\n * Counterpart to Solidity's `int200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n */\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\n downcasted = int200(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(200, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int192 from int256, reverting on\n * overflow (when the input is less than smallest int192 or\n * greater than largest int192).\n *\n * Counterpart to Solidity's `int192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n */\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\n downcasted = int192(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(192, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int184 from int256, reverting on\n * overflow (when the input is less than smallest int184 or\n * greater than largest int184).\n *\n * Counterpart to Solidity's `int184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n */\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\n downcasted = int184(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(184, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int176 from int256, reverting on\n * overflow (when the input is less than smallest int176 or\n * greater than largest int176).\n *\n * Counterpart to Solidity's `int176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n */\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\n downcasted = int176(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(176, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int168 from int256, reverting on\n * overflow (when the input is less than smallest int168 or\n * greater than largest int168).\n *\n * Counterpart to Solidity's `int168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n */\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\n downcasted = int168(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(168, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int160 from int256, reverting on\n * overflow (when the input is less than smallest int160 or\n * greater than largest int160).\n *\n * Counterpart to Solidity's `int160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n */\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\n downcasted = int160(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(160, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int152 from int256, reverting on\n * overflow (when the input is less than smallest int152 or\n * greater than largest int152).\n *\n * Counterpart to Solidity's `int152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n */\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\n downcasted = int152(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(152, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int144 from int256, reverting on\n * overflow (when the input is less than smallest int144 or\n * greater than largest int144).\n *\n * Counterpart to Solidity's `int144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n */\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\n downcasted = int144(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(144, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int136 from int256, reverting on\n * overflow (when the input is less than smallest int136 or\n * greater than largest int136).\n *\n * Counterpart to Solidity's `int136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n */\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\n downcasted = int136(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(136, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int128 from int256, reverting on\n * overflow (when the input is less than smallest int128 or\n * greater than largest int128).\n *\n * Counterpart to Solidity's `int128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n */\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\n downcasted = int128(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(128, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int120 from int256, reverting on\n * overflow (when the input is less than smallest int120 or\n * greater than largest int120).\n *\n * Counterpart to Solidity's `int120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n */\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\n downcasted = int120(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(120, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int112 from int256, reverting on\n * overflow (when the input is less than smallest int112 or\n * greater than largest int112).\n *\n * Counterpart to Solidity's `int112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n */\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\n downcasted = int112(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(112, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int104 from int256, reverting on\n * overflow (when the input is less than smallest int104 or\n * greater than largest int104).\n *\n * Counterpart to Solidity's `int104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n */\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\n downcasted = int104(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(104, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int96 from int256, reverting on\n * overflow (when the input is less than smallest int96 or\n * greater than largest int96).\n *\n * Counterpart to Solidity's `int96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n */\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\n downcasted = int96(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(96, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int88 from int256, reverting on\n * overflow (when the input is less than smallest int88 or\n * greater than largest int88).\n *\n * Counterpart to Solidity's `int88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n */\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\n downcasted = int88(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(88, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int80 from int256, reverting on\n * overflow (when the input is less than smallest int80 or\n * greater than largest int80).\n *\n * Counterpart to Solidity's `int80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n */\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\n downcasted = int80(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(80, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int72 from int256, reverting on\n * overflow (when the input is less than smallest int72 or\n * greater than largest int72).\n *\n * Counterpart to Solidity's `int72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n */\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\n downcasted = int72(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(72, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int64 from int256, reverting on\n * overflow (when the input is less than smallest int64 or\n * greater than largest int64).\n *\n * Counterpart to Solidity's `int64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n */\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\n downcasted = int64(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(64, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int56 from int256, reverting on\n * overflow (when the input is less than smallest int56 or\n * greater than largest int56).\n *\n * Counterpart to Solidity's `int56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n */\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\n downcasted = int56(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(56, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int48 from int256, reverting on\n * overflow (when the input is less than smallest int48 or\n * greater than largest int48).\n *\n * Counterpart to Solidity's `int48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n */\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\n downcasted = int48(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(48, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int40 from int256, reverting on\n * overflow (when the input is less than smallest int40 or\n * greater than largest int40).\n *\n * Counterpart to Solidity's `int40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n */\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\n downcasted = int40(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(40, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int32 from int256, reverting on\n * overflow (when the input is less than smallest int32 or\n * greater than largest int32).\n *\n * Counterpart to Solidity's `int32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n */\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\n downcasted = int32(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(32, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int24 from int256, reverting on\n * overflow (when the input is less than smallest int24 or\n * greater than largest int24).\n *\n * Counterpart to Solidity's `int24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n */\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\n downcasted = int24(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(24, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int16 from int256, reverting on\n * overflow (when the input is less than smallest int16 or\n * greater than largest int16).\n *\n * Counterpart to Solidity's `int16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n */\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\n downcasted = int16(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(16, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int8 from int256, reverting on\n * overflow (when the input is less than smallest int8 or\n * greater than largest int8).\n *\n * Counterpart to Solidity's `int8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n */\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\n downcasted = int8(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(8, value);\n }\n }\n\n /**\n * @dev Converts an unsigned uint256 into a signed int256.\n *\n * Requirements:\n *\n * - input must be less than or equal to maxInt256.\n */\n function toInt256(uint256 value) internal pure returns (int256) {\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n if (value > uint256(type(int256).max)) {\n revert SafeCastOverflowedUintToInt(value);\n }\n return int256(value);\n }\n\n /**\n * @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump.\n */\n function toUint(bool b) internal pure returns (uint256 u) {\n assembly (\"memory-safe\") {\n u := iszero(iszero(b))\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.20;\n\nimport {SafeCast} from \"./SafeCast.sol\";\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant.\n *\n * IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.\n * However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute\n * one branch when needed, making this function more expensive.\n */\n function ternary(bool condition, int256 a, int256 b) internal pure returns (int256) {\n unchecked {\n // branchless ternary works because:\n // b ^ (a ^ b) == a\n // b ^ 0 == b\n return b ^ ((a ^ b) * int256(SafeCast.toUint(condition)));\n }\n }\n\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return ternary(a > b, a, b);\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return ternary(a < b, a, b);\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // Formula from the \"Bit Twiddling Hacks\" by Sean Eron Anderson.\n // Since `n` is a signed integer, the generated bytecode will use the SAR opcode to perform the right shift,\n // taking advantage of the most significant (or \"sign\" bit) in two's complement representation.\n // This opcode adds new most significant bits set to the value of the previous most significant bit. As a result,\n // the mask will either be `bytes32(0)` (if n is positive) or `~bytes32(0)` (if n is negative).\n int256 mask = n >> 255;\n\n // A `bytes32(0)` mask leaves the input unchanged, while a `~bytes32(0)` mask complements it.\n return uint256((n + mask) ^ mask);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Panic.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/Panic.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Helper library for emitting standardized panic codes.\n *\n * ```solidity\n * contract Example {\n * using Panic for uint256;\n *\n * // Use any of the declared internal constants\n * function foo() { Panic.GENERIC.panic(); }\n *\n * // Alternatively\n * function foo() { Panic.panic(Panic.GENERIC); }\n * }\n * ```\n *\n * Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil].\n *\n * _Available since v5.1._\n */\n// slither-disable-next-line unused-state\nlibrary Panic {\n /// @dev generic / unspecified error\n uint256 internal constant GENERIC = 0x00;\n /// @dev used by the assert() builtin\n uint256 internal constant ASSERT = 0x01;\n /// @dev arithmetic underflow or overflow\n uint256 internal constant UNDER_OVERFLOW = 0x11;\n /// @dev division or modulo by zero\n uint256 internal constant DIVISION_BY_ZERO = 0x12;\n /// @dev enum conversion error\n uint256 internal constant ENUM_CONVERSION_ERROR = 0x21;\n /// @dev invalid encoding in storage\n uint256 internal constant STORAGE_ENCODING_ERROR = 0x22;\n /// @dev empty array pop\n uint256 internal constant EMPTY_ARRAY_POP = 0x31;\n /// @dev array out of bounds access\n uint256 internal constant ARRAY_OUT_OF_BOUNDS = 0x32;\n /// @dev resource error (too large allocation or too large array)\n uint256 internal constant RESOURCE_ERROR = 0x41;\n /// @dev calling invalid internal function\n uint256 internal constant INVALID_INTERNAL_FUNCTION = 0x51;\n\n /// @dev Reverts with a panic code. Recommended to use with\n /// the internal constants with predefined codes.\n function panic(uint256 code) internal pure {\n assembly (\"memory-safe\") {\n mstore(0x00, 0x4e487b71)\n mstore(0x20, code)\n revert(0x1c, 0x24)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (utils/ReentrancyGuard.sol)\n\npragma solidity ^0.8.20;\n\nimport {StorageSlot} from \"./StorageSlot.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,\n * consider using {ReentrancyGuardTransient} instead.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n *\n * IMPORTANT: Deprecated. This storage-based reentrancy guard will be removed and replaced\n * by the {ReentrancyGuardTransient} variant in v6.0.\n *\n * @custom:stateless\n */\nabstract contract ReentrancyGuard {\n using StorageSlot for bytes32;\n\n // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.ReentrancyGuard\")) - 1)) & ~bytes32(uint256(0xff))\n bytes32 private constant REENTRANCY_GUARD_STORAGE =\n 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;\n\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant NOT_ENTERED = 1;\n uint256 private constant ENTERED = 2;\n\n /**\n * @dev Unauthorized reentrant call.\n */\n error ReentrancyGuardReentrantCall();\n\n constructor() {\n _reentrancyGuardStorageSlot().getUint256Slot().value = NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n /**\n * @dev A `view` only version of {nonReentrant}. Use to block view functions\n * from being called, preventing reading from inconsistent contract state.\n *\n * CAUTION: This is a \"view\" modifier and does not change the reentrancy\n * status. Use it only on view functions. For payable or non-payable functions,\n * use the standard {nonReentrant} modifier instead.\n */\n modifier nonReentrantView() {\n _nonReentrantBeforeView();\n _;\n }\n\n function _nonReentrantBeforeView() private view {\n if (_reentrancyGuardEntered()) {\n revert ReentrancyGuardReentrantCall();\n }\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be NOT_ENTERED\n _nonReentrantBeforeView();\n\n // Any calls to nonReentrant after this point will fail\n _reentrancyGuardStorageSlot().getUint256Slot().value = ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _reentrancyGuardStorageSlot().getUint256Slot().value = NOT_ENTERED;\n }\n\n /**\n * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n * `nonReentrant` function in the call stack.\n */\n function _reentrancyGuardEntered() internal view returns (bool) {\n return _reentrancyGuardStorageSlot().getUint256Slot().value == ENTERED;\n }\n\n function _reentrancyGuardStorageSlot() internal pure virtual returns (bytes32) {\n return REENTRANCY_GUARD_STORAGE;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/ShortStrings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (utils/ShortStrings.sol)\n\npragma solidity ^0.8.20;\n\nimport {StorageSlot} from \"./StorageSlot.sol\";\n\n// | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |\n// | length | 0x BB |\ntype ShortString is bytes32;\n\n/**\n * @dev This library provides functions to convert short memory strings\n * into a `ShortString` type that can be used as an immutable variable.\n *\n * Strings of arbitrary length can be optimized using this library if\n * they are short enough (up to 31 bytes) by packing them with their\n * length (1 byte) in a single EVM word (32 bytes). Additionally, a\n * fallback mechanism can be used for every other case.\n *\n * Usage example:\n *\n * ```solidity\n * contract Named {\n * using ShortStrings for *;\n *\n * ShortString private immutable _name;\n * string private _nameFallback;\n *\n * constructor(string memory contractName) {\n * _name = contractName.toShortStringWithFallback(_nameFallback);\n * }\n *\n * function name() external view returns (string memory) {\n * return _name.toStringWithFallback(_nameFallback);\n * }\n * }\n * ```\n */\nlibrary ShortStrings {\n // Used as an identifier for strings longer than 31 bytes.\n bytes32 private constant FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;\n\n error StringTooLong(string str);\n error InvalidShortString();\n\n /**\n * @dev Encode a string of at most 31 chars into a `ShortString`.\n *\n * This will trigger a `StringTooLong` error is the input string is too long.\n */\n function toShortString(string memory str) internal pure returns (ShortString) {\n bytes memory bstr = bytes(str);\n if (bstr.length > 0x1f) {\n revert StringTooLong(str);\n }\n return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));\n }\n\n /**\n * @dev Decode a `ShortString` back to a \"normal\" string.\n */\n function toString(ShortString sstr) internal pure returns (string memory) {\n uint256 len = byteLength(sstr);\n // using `new string(len)` would work locally but is not memory safe.\n string memory str = new string(0x20);\n assembly (\"memory-safe\") {\n mstore(str, len)\n mstore(add(str, 0x20), sstr)\n }\n return str;\n }\n\n /**\n * @dev Return the length of a `ShortString`.\n */\n function byteLength(ShortString sstr) internal pure returns (uint256) {\n uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;\n if (result > 0x1f) {\n revert InvalidShortString();\n }\n return result;\n }\n\n /**\n * @dev Encode a string into a `ShortString`, or write it to storage if it is too long.\n */\n function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {\n if (bytes(value).length < 0x20) {\n return toShortString(value);\n } else {\n StorageSlot.getStringSlot(store).value = value;\n return ShortString.wrap(FALLBACK_SENTINEL);\n }\n }\n\n /**\n * @dev Decode a string that was encoded to `ShortString` or written to storage using {toShortStringWithFallback}.\n */\n function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {\n if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {\n return toString(value);\n } else {\n return store;\n }\n }\n\n /**\n * @dev Return the length of a string that was encoded to `ShortString` or written to storage using\n * {toShortStringWithFallback}.\n *\n * WARNING: This will return the \"byte length\" of the string. This may not reflect the actual length in terms of\n * actual characters as the UTF-8 encoding of a single character can span over multiple bytes.\n */\n function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {\n if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {\n return byteLength(value);\n } else {\n return bytes(store).length;\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC-1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n * // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(newImplementation.code.length > 0);\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * TIP: Consider using this library along with {SlotDerivation}.\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct Int256Slot {\n int256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns a `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns a `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns a `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns a `Int256Slot` with member `value` located at `slot`.\n */\n function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns a `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns a `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := store.slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.6.0) (utils/Strings.sol)\n\npragma solidity ^0.8.24;\n\nimport {Math} from \"./math/Math.sol\";\nimport {SafeCast} from \"./math/SafeCast.sol\";\nimport {SignedMath} from \"./math/SignedMath.sol\";\nimport {Bytes} from \"./Bytes.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n using SafeCast for *;\n\n bytes16 private constant HEX_DIGITS = \"0123456789abcdef\";\n uint8 private constant ADDRESS_LENGTH = 20;\n uint256 private constant SPECIAL_CHARS_LOOKUP =\n 0xffffffff | // first 32 bits corresponding to the control characters (U+0000 to U+001F)\n (1 << 0x22) | // double quote\n (1 << 0x5c); // backslash\n\n /**\n * @dev The `value` string doesn't fit in the specified `length`.\n */\n error StringsInsufficientHexLength(uint256 value, uint256 length);\n\n /**\n * @dev The string being parsed contains characters that are not in scope of the given base.\n */\n error StringsInvalidChar();\n\n /**\n * @dev The string being parsed is not a properly formatted address.\n */\n error StringsInvalidAddressFormat();\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n assembly (\"memory-safe\") {\n ptr := add(add(buffer, 0x20), length)\n }\n while (true) {\n ptr--;\n assembly (\"memory-safe\") {\n mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toStringSigned(int256 value) internal pure returns (string memory) {\n return string.concat(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value)));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n uint256 localValue = value;\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = HEX_DIGITS[localValue & 0xf];\n localValue >>= 4;\n }\n if (localValue != 0) {\n revert StringsInsufficientHexLength(value, length);\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal\n * representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its checksummed ASCII `string` hexadecimal\n * representation, according to EIP-55.\n */\n function toChecksumHexString(address addr) internal pure returns (string memory) {\n bytes memory buffer = bytes(toHexString(addr));\n\n // hash the hex part of buffer (skip length + 2 bytes, length 40)\n uint256 hashValue;\n assembly (\"memory-safe\") {\n hashValue := shr(96, keccak256(add(buffer, 0x22), 40))\n }\n\n for (uint256 i = 41; i > 1; --i) {\n // possible values for buffer[i] are 48 (0) to 57 (9) and 97 (a) to 102 (f)\n if (hashValue & 0xf > 7 && uint8(buffer[i]) > 96) {\n // case shift by xoring with 0x20\n buffer[i] ^= 0x20;\n }\n hashValue >>= 4;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `bytes` buffer to its ASCII `string` hexadecimal representation.\n */\n function toHexString(bytes memory input) internal pure returns (string memory) {\n unchecked {\n bytes memory buffer = new bytes(2 * input.length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 0; i < input.length; ++i) {\n uint8 v = uint8(input[i]);\n buffer[2 * i + 2] = HEX_DIGITS[v >> 4];\n buffer[2 * i + 3] = HEX_DIGITS[v & 0xf];\n }\n return string(buffer);\n }\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return Bytes.equal(bytes(a), bytes(b));\n }\n\n /**\n * @dev Parse a decimal string and returns the value as a `uint256`.\n *\n * Requirements:\n * - The string must be formatted as `[0-9]*`\n * - The result must fit into an `uint256` type\n */\n function parseUint(string memory input) internal pure returns (uint256) {\n return parseUint(input, 0, bytes(input).length);\n }\n\n /**\n * @dev Variant of {parseUint-string} that parses a substring of `input` located between position `begin` (included) and\n * `end` (excluded).\n *\n * Requirements:\n * - The substring must be formatted as `[0-9]*`\n * - The result must fit into an `uint256` type\n */\n function parseUint(string memory input, uint256 begin, uint256 end) internal pure returns (uint256) {\n (bool success, uint256 value) = tryParseUint(input, begin, end);\n if (!success) revert StringsInvalidChar();\n return value;\n }\n\n /**\n * @dev Variant of {parseUint-string} that returns false if the parsing fails because of an invalid character.\n *\n * NOTE: This function will revert if the result does not fit in a `uint256`.\n */\n function tryParseUint(string memory input) internal pure returns (bool success, uint256 value) {\n return _tryParseUintUncheckedBounds(input, 0, bytes(input).length);\n }\n\n /**\n * @dev Variant of {parseUint-string-uint256-uint256} that returns false if the parsing fails because of an invalid\n * character.\n *\n * NOTE: This function will revert if the result does not fit in a `uint256`.\n */\n function tryParseUint(\n string memory input,\n uint256 begin,\n uint256 end\n ) internal pure returns (bool success, uint256 value) {\n if (end > bytes(input).length || begin > end) return (false, 0);\n return _tryParseUintUncheckedBounds(input, begin, end);\n }\n\n /**\n * @dev Implementation of {tryParseUint-string-uint256-uint256} that does not check bounds. Caller should make sure that\n * `begin <= end <= input.length`. Other inputs would result in undefined behavior.\n */\n function _tryParseUintUncheckedBounds(\n string memory input,\n uint256 begin,\n uint256 end\n ) private pure returns (bool success, uint256 value) {\n bytes memory buffer = bytes(input);\n\n uint256 result = 0;\n for (uint256 i = begin; i < end; ++i) {\n uint8 chr = _tryParseChr(bytes1(_unsafeReadBytesOffset(buffer, i)));\n if (chr > 9) return (false, 0);\n result *= 10;\n result += chr;\n }\n return (true, result);\n }\n\n /**\n * @dev Parse a decimal string and returns the value as a `int256`.\n *\n * Requirements:\n * - The string must be formatted as `[-+]?[0-9]*`\n * - The result must fit in an `int256` type.\n */\n function parseInt(string memory input) internal pure returns (int256) {\n return parseInt(input, 0, bytes(input).length);\n }\n\n /**\n * @dev Variant of {parseInt-string} that parses a substring of `input` located between position `begin` (included) and\n * `end` (excluded).\n *\n * Requirements:\n * - The substring must be formatted as `[-+]?[0-9]*`\n * - The result must fit in an `int256` type.\n */\n function parseInt(string memory input, uint256 begin, uint256 end) internal pure returns (int256) {\n (bool success, int256 value) = tryParseInt(input, begin, end);\n if (!success) revert StringsInvalidChar();\n return value;\n }\n\n /**\n * @dev Variant of {parseInt-string} that returns false if the parsing fails because of an invalid character or if\n * the result does not fit in a `int256`.\n *\n * NOTE: This function will revert if the absolute value of the result does not fit in a `uint256`.\n */\n function tryParseInt(string memory input) internal pure returns (bool success, int256 value) {\n return _tryParseIntUncheckedBounds(input, 0, bytes(input).length);\n }\n\n uint256 private constant ABS_MIN_INT256 = 2 ** 255;\n\n /**\n * @dev Variant of {parseInt-string-uint256-uint256} that returns false if the parsing fails because of an invalid\n * character or if the result does not fit in a `int256`.\n *\n * NOTE: This function will revert if the absolute value of the result does not fit in a `uint256`.\n */\n function tryParseInt(\n string memory input,\n uint256 begin,\n uint256 end\n ) internal pure returns (bool success, int256 value) {\n if (end > bytes(input).length || begin > end) return (false, 0);\n return _tryParseIntUncheckedBounds(input, begin, end);\n }\n\n /**\n * @dev Implementation of {tryParseInt-string-uint256-uint256} that does not check bounds. Caller should make sure that\n * `begin <= end <= input.length`. Other inputs would result in undefined behavior.\n */\n function _tryParseIntUncheckedBounds(\n string memory input,\n uint256 begin,\n uint256 end\n ) private pure returns (bool success, int256 value) {\n bytes memory buffer = bytes(input);\n\n // Check presence of a negative sign.\n bytes1 sign = begin == end ? bytes1(0) : bytes1(_unsafeReadBytesOffset(buffer, begin)); // don't do out-of-bound (possibly unsafe) read if sub-string is empty\n bool positiveSign = sign == bytes1(\"+\");\n bool negativeSign = sign == bytes1(\"-\");\n uint256 offset = (positiveSign || negativeSign).toUint();\n\n (bool absSuccess, uint256 absValue) = tryParseUint(input, begin + offset, end);\n\n if (absSuccess && absValue < ABS_MIN_INT256) {\n return (true, negativeSign ? -int256(absValue) : int256(absValue));\n } else if (absSuccess && negativeSign && absValue == ABS_MIN_INT256) {\n return (true, type(int256).min);\n } else return (false, 0);\n }\n\n /**\n * @dev Parse a hexadecimal string (with or without \"0x\" prefix), and returns the value as a `uint256`.\n *\n * Requirements:\n * - The string must be formatted as `(0x)?[0-9a-fA-F]*`\n * - The result must fit in an `uint256` type.\n */\n function parseHexUint(string memory input) internal pure returns (uint256) {\n return parseHexUint(input, 0, bytes(input).length);\n }\n\n /**\n * @dev Variant of {parseHexUint-string} that parses a substring of `input` located between position `begin` (included) and\n * `end` (excluded).\n *\n * Requirements:\n * - The substring must be formatted as `(0x)?[0-9a-fA-F]*`\n * - The result must fit in an `uint256` type.\n */\n function parseHexUint(string memory input, uint256 begin, uint256 end) internal pure returns (uint256) {\n (bool success, uint256 value) = tryParseHexUint(input, begin, end);\n if (!success) revert StringsInvalidChar();\n return value;\n }\n\n /**\n * @dev Variant of {parseHexUint-string} that returns false if the parsing fails because of an invalid character.\n *\n * NOTE: This function will revert if the result does not fit in a `uint256`.\n */\n function tryParseHexUint(string memory input) internal pure returns (bool success, uint256 value) {\n return _tryParseHexUintUncheckedBounds(input, 0, bytes(input).length);\n }\n\n /**\n * @dev Variant of {parseHexUint-string-uint256-uint256} that returns false if the parsing fails because of an\n * invalid character.\n *\n * NOTE: This function will revert if the result does not fit in a `uint256`.\n */\n function tryParseHexUint(\n string memory input,\n uint256 begin,\n uint256 end\n ) internal pure returns (bool success, uint256 value) {\n if (end > bytes(input).length || begin > end) return (false, 0);\n return _tryParseHexUintUncheckedBounds(input, begin, end);\n }\n\n /**\n * @dev Implementation of {tryParseHexUint-string-uint256-uint256} that does not check bounds. Caller should make sure that\n * `begin <= end <= input.length`. Other inputs would result in undefined behavior.\n */\n function _tryParseHexUintUncheckedBounds(\n string memory input,\n uint256 begin,\n uint256 end\n ) private pure returns (bool success, uint256 value) {\n bytes memory buffer = bytes(input);\n\n // skip 0x prefix if present\n bool hasPrefix = (end > begin + 1) && bytes2(_unsafeReadBytesOffset(buffer, begin)) == bytes2(\"0x\"); // don't do out-of-bound (possibly unsafe) read if sub-string is empty\n uint256 offset = hasPrefix.toUint() * 2;\n\n uint256 result = 0;\n for (uint256 i = begin + offset; i < end; ++i) {\n uint8 chr = _tryParseChr(bytes1(_unsafeReadBytesOffset(buffer, i)));\n if (chr > 15) return (false, 0);\n result *= 16;\n unchecked {\n // Multiplying by 16 is equivalent to a shift of 4 bits (with additional overflow check).\n // This guarantees that adding a value < 16 will not cause an overflow, hence the unchecked.\n result += chr;\n }\n }\n return (true, result);\n }\n\n /**\n * @dev Parse a hexadecimal string (with or without \"0x\" prefix), and returns the value as an `address`.\n *\n * Requirements:\n * - The string must be formatted as `(0x)?[0-9a-fA-F]{40}`\n */\n function parseAddress(string memory input) internal pure returns (address) {\n return parseAddress(input, 0, bytes(input).length);\n }\n\n /**\n * @dev Variant of {parseAddress-string} that parses a substring of `input` located between position `begin` (included) and\n * `end` (excluded).\n *\n * Requirements:\n * - The substring must be formatted as `(0x)?[0-9a-fA-F]{40}`\n */\n function parseAddress(string memory input, uint256 begin, uint256 end) internal pure returns (address) {\n (bool success, address value) = tryParseAddress(input, begin, end);\n if (!success) revert StringsInvalidAddressFormat();\n return value;\n }\n\n /**\n * @dev Variant of {parseAddress-string} that returns false if the parsing fails because the input is not a properly\n * formatted address. See {parseAddress-string} requirements.\n */\n function tryParseAddress(string memory input) internal pure returns (bool success, address value) {\n return tryParseAddress(input, 0, bytes(input).length);\n }\n\n /**\n * @dev Variant of {parseAddress-string-uint256-uint256} that returns false if the parsing fails because input is not a properly\n * formatted address. See {parseAddress-string-uint256-uint256} requirements.\n */\n function tryParseAddress(\n string memory input,\n uint256 begin,\n uint256 end\n ) internal pure returns (bool success, address value) {\n if (end > bytes(input).length || begin > end) return (false, address(0));\n\n bool hasPrefix = (end > begin + 1) && bytes2(_unsafeReadBytesOffset(bytes(input), begin)) == bytes2(\"0x\"); // don't do out-of-bound (possibly unsafe) read if sub-string is empty\n uint256 expectedLength = 40 + hasPrefix.toUint() * 2;\n\n // check that input is the correct length\n if (end - begin == expectedLength) {\n // length guarantees that this does not overflow, and value is at most type(uint160).max\n (bool s, uint256 v) = _tryParseHexUintUncheckedBounds(input, begin, end);\n return (s, address(uint160(v)));\n } else {\n return (false, address(0));\n }\n }\n\n function _tryParseChr(bytes1 chr) private pure returns (uint8) {\n uint8 value = uint8(chr);\n\n // Try to parse `chr`:\n // - Case 1: [0-9]\n // - Case 2: [a-f]\n // - Case 3: [A-F]\n // - otherwise not supported\n unchecked {\n if (value > 47 && value < 58) value -= 48;\n else if (value > 96 && value < 103) value -= 87;\n else if (value > 64 && value < 71) value -= 55;\n else return type(uint8).max;\n }\n\n return value;\n }\n\n /**\n * @dev Escape special characters in JSON strings. This can be useful to prevent JSON injection in NFT metadata.\n *\n * WARNING: This function should only be used in double quoted JSON strings. Single quotes are not escaped.\n *\n * NOTE: This function escapes backslashes (including those in \\uXXXX sequences) and the characters in ranges\n * defined in section 2.5 of RFC-4627 (U+0000 to U+001F, U+0022 and U+005C). All control characters in U+0000\n * to U+001F are escaped (\\b, \\t, \\n, \\f, \\r use short form; others use \\u00XX). ECMAScript's `JSON.parse` does\n * recover escaped unicode characters that are not in this range, but other tooling may provide different results.\n */\n function escapeJSON(string memory input) internal pure returns (string memory) {\n bytes memory buffer = bytes(input);\n\n // Put output at the FMP. Memory will be reserved later when we figure out the actual length of the escaped\n // string. All write are done using _unsafeWriteBytesOffset, which avoid the (expensive) length checks for\n // each character written.\n bytes memory output;\n assembly (\"memory-safe\") {\n output := mload(0x40)\n }\n uint256 outputLength = 0;\n\n for (uint256 i = 0; i < buffer.length; ++i) {\n uint8 char = uint8(bytes1(_unsafeReadBytesOffset(buffer, i)));\n if (((SPECIAL_CHARS_LOOKUP & (1 << char)) != 0)) {\n _unsafeWriteBytesOffset(output, outputLength++, \"\\\\\");\n if (char == 0x08) _unsafeWriteBytesOffset(output, outputLength++, \"b\");\n else if (char == 0x09) _unsafeWriteBytesOffset(output, outputLength++, \"t\");\n else if (char == 0x0a) _unsafeWriteBytesOffset(output, outputLength++, \"n\");\n else if (char == 0x0c) _unsafeWriteBytesOffset(output, outputLength++, \"f\");\n else if (char == 0x0d) _unsafeWriteBytesOffset(output, outputLength++, \"r\");\n else if (char == 0x5c) _unsafeWriteBytesOffset(output, outputLength++, \"\\\\\");\n else if (char == 0x22) {\n // solhint-disable-next-line quotes\n _unsafeWriteBytesOffset(output, outputLength++, '\"');\n } else {\n // U+0000 to U+001F without short form: output \\u00XX\n _unsafeWriteBytesOffset(output, outputLength++, \"u\");\n _unsafeWriteBytesOffset(output, outputLength++, \"0\");\n _unsafeWriteBytesOffset(output, outputLength++, \"0\");\n _unsafeWriteBytesOffset(output, outputLength++, HEX_DIGITS[char >> 4]);\n _unsafeWriteBytesOffset(output, outputLength++, HEX_DIGITS[char & 0x0f]);\n }\n } else {\n _unsafeWriteBytesOffset(output, outputLength++, bytes1(char));\n }\n }\n // write the actual length and reserve memory\n assembly (\"memory-safe\") {\n mstore(output, outputLength)\n mstore(0x40, add(output, add(outputLength, 0x20)))\n }\n\n return string(output);\n }\n\n /**\n * @dev Reads a bytes32 from a bytes array without bounds checking.\n *\n * NOTE: making this function internal would mean it could be used with memory unsafe offset, and marking the\n * assembly block as such would prevent some optimizations.\n */\n function _unsafeReadBytesOffset(bytes memory buffer, uint256 offset) private pure returns (bytes32 value) {\n // This is not memory safe in the general case, but all calls to this private function are within bounds.\n assembly (\"memory-safe\") {\n value := mload(add(add(buffer, 0x20), offset))\n }\n }\n\n /**\n * @dev Write a bytes1 to a bytes array without bounds checking.\n *\n * NOTE: making this function internal would mean it could be used with memory unsafe offset, and marking the\n * assembly block as such would prevent some optimizations.\n */\n function _unsafeWriteBytesOffset(bytes memory buffer, uint256 offset, bytes1 value) private pure {\n // This is not memory safe in the general case, but all calls to this private function are within bounds.\n assembly (\"memory-safe\") {\n mstore8(add(add(buffer, 0x20), offset), shr(248, value))\n }\n }\n}\n" + }, + "contracts/TokenRelayer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.28;\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC20Permit} from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\";\nimport {ECDSA} from \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport {EIP712} from \"@openzeppelin/contracts/utils/cryptography/EIP712.sol\";\n\n/**\n * @title TokenRelayer\n * @notice A relayer contract that accepts ERC20 permit signatures and executes\n * arbitrary calls to a destination contract, both authorized via signature.\n * \n * Flow:\n * 1. User signs a permit allowing the relayer to spend their tokens\n * 2. User signs a payload (e.g., transfer from relayer to another user)\n * 3. Relayer:\n * a. Executes permit to approve the tokens\n * b. Transfers tokens from user to relayer (via transferFrom)\n * c. Forwards the payload call (transfer from relayer to another user)\n */\ncontract TokenRelayer is Ownable, ReentrancyGuard, EIP712 {\n using SafeERC20 for IERC20;\n\n // Using OZ EIP712 for domain separator management\n bytes32 private constant _TYPE_HASH_PAYLOAD = keccak256(\n \"Payload(address destination,address owner,address token,uint256 value,bytes data,uint256 ethValue,uint256 nonce,uint256 deadline)\"\n );\n\n address public immutable destinationContract;\n\n mapping(address => mapping(uint256 => bool)) public usedPayloadNonces;\n // Removed redundant executedCalls mapping — usedPayloadNonces is sufficient\n\n struct ExecuteParams {\n address token;\n address owner;\n uint256 value;\n uint256 deadline;\n uint8 permitV;\n bytes32 permitR;\n bytes32 permitS;\n bytes payloadData;\n uint256 payloadValue;\n uint256 payloadNonce;\n uint256 payloadDeadline;\n uint8 payloadV;\n bytes32 payloadR;\n bytes32 payloadS;\n }\n\n event RelayerExecuted(\n address indexed signer,\n address indexed token,\n uint256 amount\n );\n\n // Events for withdrawal operations\n event TokenWithdrawn(address indexed token, uint256 amount, address indexed to);\n event ETHWithdrawn(uint256 amount, address indexed to);\n\n // Ownable constructor sets deployer as owner; EIP712 constructor\n constructor(address _destinationContract)\n Ownable(msg.sender)\n EIP712(\"TokenRelayer\", \"1\")\n {\n require(_destinationContract != address(0), \"Invalid destination\");\n destinationContract = _destinationContract;\n }\n\n // Allow contract to receive ETH (e.g., refunds from destination)\n receive() external payable {}\n\n // nonReentrant modifier prevents reentrancy via _forwardCall\n // Removed redundant bool return — function reverts on failure\n function execute(ExecuteParams calldata params) external payable nonReentrant {\n address owner = params.owner;\n uint256 nonce = params.payloadNonce;\n\n // --- Checks ---\n require(owner != address(0), \"Invalid owner\");\n require(params.token != address(0), \"Invalid token\");\n require(!usedPayloadNonces[owner][nonce], \"Nonce used\");\n require(block.timestamp <= params.payloadDeadline, \"Payload expired\");\n\n // Verify payload signature and validate signed destination\n bytes32 digest = _computeDigest(\n owner,\n params.token,\n params.value,\n params.payloadData,\n params.payloadValue,\n nonce,\n params.payloadDeadline\n );\n // Using ECDSA.recover() which enforces low-s and rejects address(0)\n require(ECDSA.recover(digest, params.payloadV, params.payloadR, params.payloadS) == owner, \"Invalid sig\");\n\n require(msg.value == params.payloadValue, \"Incorrect ETH value provided\");\n\n // --- Effects (before interactions per CEI pattern) ---\n // State changes before any external calls\n usedPayloadNonces[owner][nonce] = true;\n\n // --- Interactions ---\n // permit wrapped in try-catch for front-run resilience\n _executePermitAndTransfer(\n params.token,\n owner,\n params.value,\n params.deadline,\n params.permitV,\n params.permitR,\n params.permitS\n );\n\n // Approve exact amount, forward call, then revoke\n IERC20(params.token).forceApprove(destinationContract, params.value);\n\n bool callSuccess = _forwardCall(params.payloadData, msg.value);\n require(callSuccess, \"Call failed\");\n\n // Revoke approval after the call to prevent residual allowance\n IERC20(params.token).forceApprove(destinationContract, 0);\n\n emit RelayerExecuted(owner, params.token, params.value);\n }\n\n // Using inherited _hashTypedDataV4 from OZ EIP712\n function _computeDigest(\n address owner,\n address token,\n uint256 value,\n bytes memory data,\n uint256 ethValue,\n uint256 nonce,\n uint256 deadline\n ) private view returns (bytes32) {\n return _hashTypedDataV4(\n keccak256(abi.encode(\n _TYPE_HASH_PAYLOAD,\n destinationContract, // [H-2] destination is always destinationContract\n owner,\n token,\n value,\n keccak256(data),\n ethValue,\n nonce,\n deadline\n ))\n );\n }\n\n /**\n * @dev Execute permit approval and then transfer tokens from owner to self (relayer).\n * Permit is wrapped in try-catch: if it was front-run, we check\n * that the allowance is already sufficient before proceeding.\n */\n function _executePermitAndTransfer(\n address token,\n address owner,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n // Wrap permit in try-catch for front-run resilience\n try IERC20Permit(token).permit(owner, address(this), value, deadline, v, r, s) {\n // permit succeeded\n } catch {\n // permit was front-run, verify allowance is sufficient\n require(\n IERC20(token).allowance(owner, address(this)) >= value,\n \"Permit failed and insufficient allowance\"\n );\n }\n\n // Transfer tokens from owner to this contract\n IERC20(token).safeTransferFrom(owner, address(this), value);\n }\n\n function _forwardCall(bytes memory data, uint256 value) internal returns (bool) {\n (bool success, ) = destinationContract.call{value: value}(data);\n return success;\n }\n\n /**\n * @notice Allows the owner to recover any ERC20 tokens held by this contract.\n * @param token The ERC20 token contract address.\n * @param amount The amount of tokens to transfer to the owner.\n */\n // Using Ownable's onlyOwner instead of manual deployer check\n // Added TokenWithdrawn event\n function withdrawToken(address token, uint256 amount) external onlyOwner {\n IERC20(token).safeTransfer(owner(), amount);\n emit TokenWithdrawn(token, amount, owner());\n }\n\n /**\n * @notice Allows the owner to recover any native ETH held by this contract.\n * @param amount The amount of ETH to transfer to the owner.\n */\n // ETH recovery function\n function withdrawETH(uint256 amount) external onlyOwner {\n (bool success, ) = owner().call{value: amount}(\"\");\n require(success, \"ETH transfer failed\");\n emit ETHWithdrawn(amount, owner());\n }\n\n // Using usedPayloadNonces instead of redundant executedCalls\n function isExecutionCompleted(address signer, uint256 nonce) external view returns (bool) {\n return usedPayloadNonces[signer][nonce];\n }\n}\n" + } + }, + "settings": { + "evmVersion": "cancun", + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata" + ], + "": [ + "ast" + ] + } + } + } + }, + "output": { + "sources": { + "@openzeppelin/contracts/access/Ownable.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/access/Ownable.sol", + "exportedSymbols": { + "Context": [ + 1662 + ], + "Ownable": [ + 147 + ] + }, + "id": 148, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "102:24:0" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/Context.sol", + "file": "../utils/Context.sol", + "id": 3, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 148, + "sourceUnit": 1663, + "src": "128:45:0", + "symbolAliases": [ + { + "foreign": { + "id": 2, + "name": "Context", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1662, + "src": "136:7:0", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": true, + "baseContracts": [ + { + "baseName": { + "id": 5, + "name": "Context", + "nameLocations": [ + "692:7:0" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1662, + "src": "692:7:0" + }, + "id": 6, + "nodeType": "InheritanceSpecifier", + "src": "692:7:0" + } + ], + "canonicalName": "Ownable", + "contractDependencies": [], + "contractKind": "contract", + "documentation": { + "id": 4, + "nodeType": "StructuredDocumentation", + "src": "175:487:0", + "text": " @dev Contract module which provides a basic access control mechanism, where\n there is an account (an owner) that can be granted exclusive access to\n specific functions.\n The initial owner is set to the address provided by the deployer. This can\n later be changed with {transferOwnership}.\n This module is used through inheritance. It will make available the modifier\n `onlyOwner`, which can be applied to your functions to restrict their use to\n the owner." + }, + "fullyImplemented": true, + "id": 147, + "linearizedBaseContracts": [ + 147, + 1662 + ], + "name": "Ownable", + "nameLocation": "681:7:0", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": false, + "id": 8, + "mutability": "mutable", + "name": "_owner", + "nameLocation": "722:6:0", + "nodeType": "VariableDeclaration", + "scope": 147, + "src": "706:22:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 7, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "706:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "private" + }, + { + "documentation": { + "id": 9, + "nodeType": "StructuredDocumentation", + "src": "735:85:0", + "text": " @dev The caller account is not authorized to perform an operation." + }, + "errorSelector": "118cdaa7", + "id": 13, + "name": "OwnableUnauthorizedAccount", + "nameLocation": "831:26:0", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 12, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 11, + "mutability": "mutable", + "name": "account", + "nameLocation": "866:7:0", + "nodeType": "VariableDeclaration", + "scope": 13, + "src": "858:15:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 10, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "858:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "857:17:0" + }, + "src": "825:50:0" + }, + { + "documentation": { + "id": 14, + "nodeType": "StructuredDocumentation", + "src": "881:82:0", + "text": " @dev The owner is not a valid owner account. (eg. `address(0)`)" + }, + "errorSelector": "1e4fbdf7", + "id": 18, + "name": "OwnableInvalidOwner", + "nameLocation": "974:19:0", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 17, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 16, + "mutability": "mutable", + "name": "owner", + "nameLocation": "1002:5:0", + "nodeType": "VariableDeclaration", + "scope": 18, + "src": "994:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 15, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "994:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "993:15:0" + }, + "src": "968:41:0" + }, + { + "anonymous": false, + "eventSelector": "8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "id": 24, + "name": "OwnershipTransferred", + "nameLocation": "1021:20:0", + "nodeType": "EventDefinition", + "parameters": { + "id": 23, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 20, + "indexed": true, + "mutability": "mutable", + "name": "previousOwner", + "nameLocation": "1058:13:0", + "nodeType": "VariableDeclaration", + "scope": 24, + "src": "1042:29:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 19, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1042:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 22, + "indexed": true, + "mutability": "mutable", + "name": "newOwner", + "nameLocation": "1089:8:0", + "nodeType": "VariableDeclaration", + "scope": 24, + "src": "1073:24:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 21, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1073:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "1041:57:0" + }, + "src": "1015:84:0" + }, + { + "body": { + "id": 49, + "nodeType": "Block", + "src": "1259:153:0", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 35, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 30, + "name": "initialOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 27, + "src": "1273:12:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 33, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1297:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 32, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1289:7:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 31, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1289:7:0", + "typeDescriptions": {} + } + }, + "id": 34, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1289:10:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "1273:26:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 44, + "nodeType": "IfStatement", + "src": "1269:95:0", + "trueBody": { + "id": 43, + "nodeType": "Block", + "src": "1301:63:0", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "hexValue": "30", + "id": 39, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1350:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 38, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1342:7:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 37, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1342:7:0", + "typeDescriptions": {} + } + }, + "id": 40, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1342:10:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 36, + "name": "OwnableInvalidOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 18, + "src": "1322:19:0", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 41, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1322:31:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 42, + "nodeType": "RevertStatement", + "src": "1315:38:0" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 46, + "name": "initialOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 27, + "src": "1392:12:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 45, + "name": "_transferOwnership", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 146, + "src": "1373:18:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$__$", + "typeString": "function (address)" + } + }, + "id": 47, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1373:32:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 48, + "nodeType": "ExpressionStatement", + "src": "1373:32:0" + } + ] + }, + "documentation": { + "id": 25, + "nodeType": "StructuredDocumentation", + "src": "1105:115:0", + "text": " @dev Initializes the contract setting the address provided by the deployer as the initial owner." + }, + "id": 50, + "implemented": true, + "kind": "constructor", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 28, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 27, + "mutability": "mutable", + "name": "initialOwner", + "nameLocation": "1245:12:0", + "nodeType": "VariableDeclaration", + "scope": 50, + "src": "1237:20:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 26, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1237:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "1236:22:0" + }, + "returnParameters": { + "id": 29, + "nodeType": "ParameterList", + "parameters": [], + "src": "1259:0:0" + }, + "scope": 147, + "src": "1225:187:0", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 57, + "nodeType": "Block", + "src": "1521:41:0", + "statements": [ + { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 53, + "name": "_checkOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 84, + "src": "1531:11:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$__$", + "typeString": "function () view" + } + }, + "id": 54, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1531:13:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 55, + "nodeType": "ExpressionStatement", + "src": "1531:13:0" + }, + { + "id": 56, + "nodeType": "PlaceholderStatement", + "src": "1554:1:0" + } + ] + }, + "documentation": { + "id": 51, + "nodeType": "StructuredDocumentation", + "src": "1418:77:0", + "text": " @dev Throws if called by any account other than the owner." + }, + "id": 58, + "name": "onlyOwner", + "nameLocation": "1509:9:0", + "nodeType": "ModifierDefinition", + "parameters": { + "id": 52, + "nodeType": "ParameterList", + "parameters": [], + "src": "1518:2:0" + }, + "src": "1500:62:0", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 66, + "nodeType": "Block", + "src": "1693:30:0", + "statements": [ + { + "expression": { + "id": 64, + "name": "_owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "1710:6:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 63, + "id": 65, + "nodeType": "Return", + "src": "1703:13:0" + } + ] + }, + "documentation": { + "id": 59, + "nodeType": "StructuredDocumentation", + "src": "1568:65:0", + "text": " @dev Returns the address of the current owner." + }, + "functionSelector": "8da5cb5b", + "id": 67, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "owner", + "nameLocation": "1647:5:0", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 60, + "nodeType": "ParameterList", + "parameters": [], + "src": "1652:2:0" + }, + "returnParameters": { + "id": 63, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 62, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 67, + "src": "1684:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 61, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1684:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "1683:9:0" + }, + "scope": 147, + "src": "1638:85:0", + "stateMutability": "view", + "virtual": true, + "visibility": "public" + }, + { + "body": { + "id": 83, + "nodeType": "Block", + "src": "1841:117:0", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 75, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 71, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 67, + "src": "1855:5:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", + "typeString": "function () view returns (address)" + } + }, + "id": 72, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1855:7:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 73, + "name": "_msgSender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1644, + "src": "1866:10:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", + "typeString": "function () view returns (address)" + } + }, + "id": 74, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1866:12:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "1855:23:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 82, + "nodeType": "IfStatement", + "src": "1851:101:0", + "trueBody": { + "id": 81, + "nodeType": "Block", + "src": "1880:72:0", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 77, + "name": "_msgSender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1644, + "src": "1928:10:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", + "typeString": "function () view returns (address)" + } + }, + "id": 78, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1928:12:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 76, + "name": "OwnableUnauthorizedAccount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 13, + "src": "1901:26:0", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 79, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1901:40:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 80, + "nodeType": "RevertStatement", + "src": "1894:47:0" + } + ] + } + } + ] + }, + "documentation": { + "id": 68, + "nodeType": "StructuredDocumentation", + "src": "1729:62:0", + "text": " @dev Throws if the sender is not the owner." + }, + "id": 84, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_checkOwner", + "nameLocation": "1805:11:0", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 69, + "nodeType": "ParameterList", + "parameters": [], + "src": "1816:2:0" + }, + "returnParameters": { + "id": 70, + "nodeType": "ParameterList", + "parameters": [], + "src": "1841:0:0" + }, + "scope": 147, + "src": "1796:162:0", + "stateMutability": "view", + "virtual": true, + "visibility": "internal" + }, + { + "body": { + "id": 97, + "nodeType": "Block", + "src": "2347:47:0", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "hexValue": "30", + "id": 93, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2384:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 92, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2376:7:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 91, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2376:7:0", + "typeDescriptions": {} + } + }, + "id": 94, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2376:10:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 90, + "name": "_transferOwnership", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 146, + "src": "2357:18:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$__$", + "typeString": "function (address)" + } + }, + "id": 95, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2357:30:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 96, + "nodeType": "ExpressionStatement", + "src": "2357:30:0" + } + ] + }, + "documentation": { + "id": 85, + "nodeType": "StructuredDocumentation", + "src": "1964:324:0", + "text": " @dev Leaves the contract without owner. It will not be possible to call\n `onlyOwner` functions. Can only be called by the current owner.\n NOTE: Renouncing ownership will leave the contract without an owner,\n thereby disabling any functionality that is only available to the owner." + }, + "functionSelector": "715018a6", + "id": 98, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 88, + "kind": "modifierInvocation", + "modifierName": { + "id": 87, + "name": "onlyOwner", + "nameLocations": [ + "2337:9:0" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 58, + "src": "2337:9:0" + }, + "nodeType": "ModifierInvocation", + "src": "2337:9:0" + } + ], + "name": "renounceOwnership", + "nameLocation": "2302:17:0", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 86, + "nodeType": "ParameterList", + "parameters": [], + "src": "2319:2:0" + }, + "returnParameters": { + "id": 89, + "nodeType": "ParameterList", + "parameters": [], + "src": "2347:0:0" + }, + "scope": 147, + "src": "2293:101:0", + "stateMutability": "nonpayable", + "virtual": true, + "visibility": "public" + }, + { + "body": { + "id": 125, + "nodeType": "Block", + "src": "2613:145:0", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 111, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 106, + "name": "newOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 101, + "src": "2627:8:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 109, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2647:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 108, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2639:7:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 107, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2639:7:0", + "typeDescriptions": {} + } + }, + "id": 110, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2639:10:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "2627:22:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 120, + "nodeType": "IfStatement", + "src": "2623:91:0", + "trueBody": { + "id": 119, + "nodeType": "Block", + "src": "2651:63:0", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "hexValue": "30", + "id": 115, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2700:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 114, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2692:7:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 113, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2692:7:0", + "typeDescriptions": {} + } + }, + "id": 116, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2692:10:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 112, + "name": "OwnableInvalidOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 18, + "src": "2672:19:0", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 117, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2672:31:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 118, + "nodeType": "RevertStatement", + "src": "2665:38:0" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 122, + "name": "newOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 101, + "src": "2742:8:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 121, + "name": "_transferOwnership", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 146, + "src": "2723:18:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$__$", + "typeString": "function (address)" + } + }, + "id": 123, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2723:28:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 124, + "nodeType": "ExpressionStatement", + "src": "2723:28:0" + } + ] + }, + "documentation": { + "id": 99, + "nodeType": "StructuredDocumentation", + "src": "2400:138:0", + "text": " @dev Transfers ownership of the contract to a new account (`newOwner`).\n Can only be called by the current owner." + }, + "functionSelector": "f2fde38b", + "id": 126, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 104, + "kind": "modifierInvocation", + "modifierName": { + "id": 103, + "name": "onlyOwner", + "nameLocations": [ + "2603:9:0" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 58, + "src": "2603:9:0" + }, + "nodeType": "ModifierInvocation", + "src": "2603:9:0" + } + ], + "name": "transferOwnership", + "nameLocation": "2552:17:0", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 102, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 101, + "mutability": "mutable", + "name": "newOwner", + "nameLocation": "2578:8:0", + "nodeType": "VariableDeclaration", + "scope": 126, + "src": "2570:16:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 100, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2570:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "2569:18:0" + }, + "returnParameters": { + "id": 105, + "nodeType": "ParameterList", + "parameters": [], + "src": "2613:0:0" + }, + "scope": 147, + "src": "2543:215:0", + "stateMutability": "nonpayable", + "virtual": true, + "visibility": "public" + }, + { + "body": { + "id": 145, + "nodeType": "Block", + "src": "2975:124:0", + "statements": [ + { + "assignments": [ + 133 + ], + "declarations": [ + { + "constant": false, + "id": 133, + "mutability": "mutable", + "name": "oldOwner", + "nameLocation": "2993:8:0", + "nodeType": "VariableDeclaration", + "scope": 145, + "src": "2985:16:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 132, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2985:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "id": 135, + "initialValue": { + "id": 134, + "name": "_owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "3004:6:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2985:25:0" + }, + { + "expression": { + "id": 138, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 136, + "name": "_owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "3020:6:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 137, + "name": "newOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 129, + "src": "3029:8:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "3020:17:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 139, + "nodeType": "ExpressionStatement", + "src": "3020:17:0" + }, + { + "eventCall": { + "arguments": [ + { + "id": 141, + "name": "oldOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 133, + "src": "3073:8:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 142, + "name": "newOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 129, + "src": "3083:8:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 140, + "name": "OwnershipTransferred", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "3052:20:0", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$returns$__$", + "typeString": "function (address,address)" + } + }, + "id": 143, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3052:40:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 144, + "nodeType": "EmitStatement", + "src": "3047:45:0" + } + ] + }, + "documentation": { + "id": 127, + "nodeType": "StructuredDocumentation", + "src": "2764:143:0", + "text": " @dev Transfers ownership of the contract to a new account (`newOwner`).\n Internal function without access restriction." + }, + "id": 146, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_transferOwnership", + "nameLocation": "2921:18:0", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 130, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 129, + "mutability": "mutable", + "name": "newOwner", + "nameLocation": "2948:8:0", + "nodeType": "VariableDeclaration", + "scope": 146, + "src": "2940:16:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 128, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2940:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "2939:18:0" + }, + "returnParameters": { + "id": 131, + "nodeType": "ParameterList", + "parameters": [], + "src": "2975:0:0" + }, + "scope": 147, + "src": "2912:187:0", + "stateMutability": "nonpayable", + "virtual": true, + "visibility": "internal" + } + ], + "scope": 148, + "src": "663:2438:0", + "usedErrors": [ + 13, + 18 + ], + "usedEvents": [ + 24 + ] + } + ], + "src": "102:3000:0" + }, + "id": 0 + }, + "@openzeppelin/contracts/interfaces/IERC1363.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/interfaces/IERC1363.sol", + "exportedSymbols": { + "IERC1363": [ + 229 + ], + "IERC165": [ + 4547 + ], + "IERC20": [ + 340 + ] + }, + "id": 230, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 149, + "literals": [ + "solidity", + ">=", + "0.6", + ".2" + ], + "nodeType": "PragmaDirective", + "src": "107:24:1" + }, + { + "absolutePath": "@openzeppelin/contracts/interfaces/IERC20.sol", + "file": "./IERC20.sol", + "id": 151, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 230, + "sourceUnit": 238, + "src": "133:36:1", + "symbolAliases": [ + { + "foreign": { + "id": 150, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "141:6:1", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/interfaces/IERC165.sol", + "file": "./IERC165.sol", + "id": 153, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 230, + "sourceUnit": 234, + "src": "170:38:1", + "symbolAliases": [ + { + "foreign": { + "id": 152, + "name": "IERC165", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4547, + "src": "178:7:1", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [ + { + "baseName": { + "id": 155, + "name": "IERC20", + "nameLocations": [ + "590:6:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "590:6:1" + }, + "id": 156, + "nodeType": "InheritanceSpecifier", + "src": "590:6:1" + }, + { + "baseName": { + "id": 157, + "name": "IERC165", + "nameLocations": [ + "598:7:1" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4547, + "src": "598:7:1" + }, + "id": 158, + "nodeType": "InheritanceSpecifier", + "src": "598:7:1" + } + ], + "canonicalName": "IERC1363", + "contractDependencies": [], + "contractKind": "interface", + "documentation": { + "id": 154, + "nodeType": "StructuredDocumentation", + "src": "210:357:1", + "text": " @title IERC1363\n @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].\n Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract\n after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction." + }, + "fullyImplemented": false, + "id": 229, + "linearizedBaseContracts": [ + 229, + 4547, + 340 + ], + "name": "IERC1363", + "nameLocation": "578:8:1", + "nodeType": "ContractDefinition", + "nodes": [ + { + "documentation": { + "id": 159, + "nodeType": "StructuredDocumentation", + "src": "1148:370:1", + "text": " @dev Moves a `value` amount of tokens from the caller's account to `to`\n and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n @param to The address which you want to transfer to.\n @param value The amount of tokens to be transferred.\n @return A boolean value indicating whether the operation succeeded unless throwing." + }, + "functionSelector": "1296ee62", + "id": 168, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "transferAndCall", + "nameLocation": "1532:15:1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 164, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 161, + "mutability": "mutable", + "name": "to", + "nameLocation": "1556:2:1", + "nodeType": "VariableDeclaration", + "scope": 168, + "src": "1548:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 160, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1548:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 163, + "mutability": "mutable", + "name": "value", + "nameLocation": "1568:5:1", + "nodeType": "VariableDeclaration", + "scope": 168, + "src": "1560:13:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 162, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1560:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1547:27:1" + }, + "returnParameters": { + "id": 167, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 166, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 168, + "src": "1593:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 165, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "1593:4:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "1592:6:1" + }, + "scope": 229, + "src": "1523:76:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 169, + "nodeType": "StructuredDocumentation", + "src": "1605:453:1", + "text": " @dev Moves a `value` amount of tokens from the caller's account to `to`\n and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n @param to The address which you want to transfer to.\n @param value The amount of tokens to be transferred.\n @param data Additional data with no specified format, sent in call to `to`.\n @return A boolean value indicating whether the operation succeeded unless throwing." + }, + "functionSelector": "4000aea0", + "id": 180, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "transferAndCall", + "nameLocation": "2072:15:1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 176, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 171, + "mutability": "mutable", + "name": "to", + "nameLocation": "2096:2:1", + "nodeType": "VariableDeclaration", + "scope": 180, + "src": "2088:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 170, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2088:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 173, + "mutability": "mutable", + "name": "value", + "nameLocation": "2108:5:1", + "nodeType": "VariableDeclaration", + "scope": 180, + "src": "2100:13:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 172, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2100:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 175, + "mutability": "mutable", + "name": "data", + "nameLocation": "2130:4:1", + "nodeType": "VariableDeclaration", + "scope": 180, + "src": "2115:19:1", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 174, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2115:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "2087:48:1" + }, + "returnParameters": { + "id": 179, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 178, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 180, + "src": "2154:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 177, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "2154:4:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "2153:6:1" + }, + "scope": 229, + "src": "2063:97:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 181, + "nodeType": "StructuredDocumentation", + "src": "2166:453:1", + "text": " @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n @param from The address which you want to send tokens from.\n @param to The address which you want to transfer to.\n @param value The amount of tokens to be transferred.\n @return A boolean value indicating whether the operation succeeded unless throwing." + }, + "functionSelector": "d8fbe994", + "id": 192, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "transferFromAndCall", + "nameLocation": "2633:19:1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 188, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 183, + "mutability": "mutable", + "name": "from", + "nameLocation": "2661:4:1", + "nodeType": "VariableDeclaration", + "scope": 192, + "src": "2653:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 182, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2653:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 185, + "mutability": "mutable", + "name": "to", + "nameLocation": "2675:2:1", + "nodeType": "VariableDeclaration", + "scope": 192, + "src": "2667:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 184, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2667:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 187, + "mutability": "mutable", + "name": "value", + "nameLocation": "2687:5:1", + "nodeType": "VariableDeclaration", + "scope": 192, + "src": "2679:13:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 186, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2679:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2652:41:1" + }, + "returnParameters": { + "id": 191, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 190, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 192, + "src": "2712:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 189, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "2712:4:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "2711:6:1" + }, + "scope": 229, + "src": "2624:94:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 193, + "nodeType": "StructuredDocumentation", + "src": "2724:536:1", + "text": " @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n @param from The address which you want to send tokens from.\n @param to The address which you want to transfer to.\n @param value The amount of tokens to be transferred.\n @param data Additional data with no specified format, sent in call to `to`.\n @return A boolean value indicating whether the operation succeeded unless throwing." + }, + "functionSelector": "c1d34b89", + "id": 206, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "transferFromAndCall", + "nameLocation": "3274:19:1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 202, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 195, + "mutability": "mutable", + "name": "from", + "nameLocation": "3302:4:1", + "nodeType": "VariableDeclaration", + "scope": 206, + "src": "3294:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 194, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3294:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 197, + "mutability": "mutable", + "name": "to", + "nameLocation": "3316:2:1", + "nodeType": "VariableDeclaration", + "scope": 206, + "src": "3308:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 196, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3308:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 199, + "mutability": "mutable", + "name": "value", + "nameLocation": "3328:5:1", + "nodeType": "VariableDeclaration", + "scope": 206, + "src": "3320:13:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 198, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3320:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 201, + "mutability": "mutable", + "name": "data", + "nameLocation": "3350:4:1", + "nodeType": "VariableDeclaration", + "scope": 206, + "src": "3335:19:1", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 200, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3335:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "3293:62:1" + }, + "returnParameters": { + "id": 205, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 204, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 206, + "src": "3374:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 203, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "3374:4:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "3373:6:1" + }, + "scope": 229, + "src": "3265:115:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 207, + "nodeType": "StructuredDocumentation", + "src": "3386:390:1", + "text": " @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n @param spender The address which will spend the funds.\n @param value The amount of tokens to be spent.\n @return A boolean value indicating whether the operation succeeded unless throwing." + }, + "functionSelector": "3177029f", + "id": 216, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "approveAndCall", + "nameLocation": "3790:14:1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 212, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 209, + "mutability": "mutable", + "name": "spender", + "nameLocation": "3813:7:1", + "nodeType": "VariableDeclaration", + "scope": 216, + "src": "3805:15:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 208, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3805:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 211, + "mutability": "mutable", + "name": "value", + "nameLocation": "3830:5:1", + "nodeType": "VariableDeclaration", + "scope": 216, + "src": "3822:13:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 210, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3822:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3804:32:1" + }, + "returnParameters": { + "id": 215, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 214, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 216, + "src": "3855:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 213, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "3855:4:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "3854:6:1" + }, + "scope": 229, + "src": "3781:80:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 217, + "nodeType": "StructuredDocumentation", + "src": "3867:478:1", + "text": " @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n @param spender The address which will spend the funds.\n @param value The amount of tokens to be spent.\n @param data Additional data with no specified format, sent in call to `spender`.\n @return A boolean value indicating whether the operation succeeded unless throwing." + }, + "functionSelector": "cae9ca51", + "id": 228, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "approveAndCall", + "nameLocation": "4359:14:1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 224, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 219, + "mutability": "mutable", + "name": "spender", + "nameLocation": "4382:7:1", + "nodeType": "VariableDeclaration", + "scope": 228, + "src": "4374:15:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 218, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "4374:7:1", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 221, + "mutability": "mutable", + "name": "value", + "nameLocation": "4399:5:1", + "nodeType": "VariableDeclaration", + "scope": 228, + "src": "4391:13:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 220, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4391:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 223, + "mutability": "mutable", + "name": "data", + "nameLocation": "4421:4:1", + "nodeType": "VariableDeclaration", + "scope": 228, + "src": "4406:19:1", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 222, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4406:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "4373:53:1" + }, + "returnParameters": { + "id": 227, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 226, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 228, + "src": "4445:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 225, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "4445:4:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "4444:6:1" + }, + "scope": 229, + "src": "4350:101:1", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + } + ], + "scope": 230, + "src": "568:3885:1", + "usedErrors": [], + "usedEvents": [ + 274, + 283 + ] + } + ], + "src": "107:4347:1" + }, + "id": 1 + }, + "@openzeppelin/contracts/interfaces/IERC165.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/interfaces/IERC165.sol", + "exportedSymbols": { + "IERC165": [ + 4547 + ] + }, + "id": 234, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 231, + "literals": [ + "solidity", + ">=", + "0.4", + ".16" + ], + "nodeType": "PragmaDirective", + "src": "106:25:2" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/introspection/IERC165.sol", + "file": "../utils/introspection/IERC165.sol", + "id": 233, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 234, + "sourceUnit": 4548, + "src": "133:59:2", + "symbolAliases": [ + { + "foreign": { + "id": 232, + "name": "IERC165", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4547, + "src": "141:7:2", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + } + ], + "src": "106:87:2" + }, + "id": 2 + }, + "@openzeppelin/contracts/interfaces/IERC20.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/interfaces/IERC20.sol", + "exportedSymbols": { + "IERC20": [ + 340 + ] + }, + "id": 238, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 235, + "literals": [ + "solidity", + ">=", + "0.4", + ".16" + ], + "nodeType": "PragmaDirective", + "src": "105:25:3" + }, + { + "absolutePath": "@openzeppelin/contracts/token/ERC20/IERC20.sol", + "file": "../token/ERC20/IERC20.sol", + "id": 237, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 238, + "sourceUnit": 341, + "src": "132:49:3", + "symbolAliases": [ + { + "foreign": { + "id": 236, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "140:6:3", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + } + ], + "src": "105:77:3" + }, + "id": 3 + }, + "@openzeppelin/contracts/interfaces/IERC5267.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/interfaces/IERC5267.sol", + "exportedSymbols": { + "IERC5267": [ + 262 + ] + }, + "id": 263, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 239, + "literals": [ + "solidity", + ">=", + "0.4", + ".16" + ], + "nodeType": "PragmaDirective", + "src": "107:25:4" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "IERC5267", + "contractDependencies": [], + "contractKind": "interface", + "fullyImplemented": false, + "id": 262, + "linearizedBaseContracts": [ + 262 + ], + "name": "IERC5267", + "nameLocation": "144:8:4", + "nodeType": "ContractDefinition", + "nodes": [ + { + "anonymous": false, + "documentation": { + "id": 240, + "nodeType": "StructuredDocumentation", + "src": "159:84:4", + "text": " @dev MAY be emitted to signal that the domain could have changed." + }, + "eventSelector": "0a6387c9ea3628b88a633bb4f3b151770f70085117a15f9bf3787cda53f13d31", + "id": 242, + "name": "EIP712DomainChanged", + "nameLocation": "254:19:4", + "nodeType": "EventDefinition", + "parameters": { + "id": 241, + "nodeType": "ParameterList", + "parameters": [], + "src": "273:2:4" + }, + "src": "248:28:4" + }, + { + "documentation": { + "id": 243, + "nodeType": "StructuredDocumentation", + "src": "282:140:4", + "text": " @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\n signature." + }, + "functionSelector": "84b0196e", + "id": 261, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "eip712Domain", + "nameLocation": "436:12:4", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 244, + "nodeType": "ParameterList", + "parameters": [], + "src": "448:2:4" + }, + "returnParameters": { + "id": 260, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 246, + "mutability": "mutable", + "name": "fields", + "nameLocation": "518:6:4", + "nodeType": "VariableDeclaration", + "scope": 261, + "src": "511:13:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 245, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "511:6:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 248, + "mutability": "mutable", + "name": "name", + "nameLocation": "552:4:4", + "nodeType": "VariableDeclaration", + "scope": 261, + "src": "538:18:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 247, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "538:6:4", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 250, + "mutability": "mutable", + "name": "version", + "nameLocation": "584:7:4", + "nodeType": "VariableDeclaration", + "scope": 261, + "src": "570:21:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 249, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "570:6:4", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 252, + "mutability": "mutable", + "name": "chainId", + "nameLocation": "613:7:4", + "nodeType": "VariableDeclaration", + "scope": 261, + "src": "605:15:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 251, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "605:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 254, + "mutability": "mutable", + "name": "verifyingContract", + "nameLocation": "642:17:4", + "nodeType": "VariableDeclaration", + "scope": 261, + "src": "634:25:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 253, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "634:7:4", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 256, + "mutability": "mutable", + "name": "salt", + "nameLocation": "681:4:4", + "nodeType": "VariableDeclaration", + "scope": 261, + "src": "673:12:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 255, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "673:7:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 259, + "mutability": "mutable", + "name": "extensions", + "nameLocation": "716:10:4", + "nodeType": "VariableDeclaration", + "scope": 261, + "src": "699:27:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[]" + }, + "typeName": { + "baseType": { + "id": 257, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "699:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 258, + "nodeType": "ArrayTypeName", + "src": "699:9:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "visibility": "internal" + } + ], + "src": "497:239:4" + }, + "scope": 262, + "src": "427:310:4", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + } + ], + "scope": 263, + "src": "134:605:4", + "usedErrors": [], + "usedEvents": [ + 242 + ] + } + ], + "src": "107:633:4" + }, + "id": 4 + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/token/ERC20/IERC20.sol", + "exportedSymbols": { + "IERC20": [ + 340 + ] + }, + "id": 341, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 264, + "literals": [ + "solidity", + ">=", + "0.4", + ".16" + ], + "nodeType": "PragmaDirective", + "src": "106:25:5" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "IERC20", + "contractDependencies": [], + "contractKind": "interface", + "documentation": { + "id": 265, + "nodeType": "StructuredDocumentation", + "src": "133:71:5", + "text": " @dev Interface of the ERC-20 standard as defined in the ERC." + }, + "fullyImplemented": false, + "id": 340, + "linearizedBaseContracts": [ + 340 + ], + "name": "IERC20", + "nameLocation": "215:6:5", + "nodeType": "ContractDefinition", + "nodes": [ + { + "anonymous": false, + "documentation": { + "id": 266, + "nodeType": "StructuredDocumentation", + "src": "228:158:5", + "text": " @dev Emitted when `value` tokens are moved from one account (`from`) to\n another (`to`).\n Note that `value` may be zero." + }, + "eventSelector": "ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "id": 274, + "name": "Transfer", + "nameLocation": "397:8:5", + "nodeType": "EventDefinition", + "parameters": { + "id": 273, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 268, + "indexed": true, + "mutability": "mutable", + "name": "from", + "nameLocation": "422:4:5", + "nodeType": "VariableDeclaration", + "scope": 274, + "src": "406:20:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 267, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "406:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 270, + "indexed": true, + "mutability": "mutable", + "name": "to", + "nameLocation": "444:2:5", + "nodeType": "VariableDeclaration", + "scope": 274, + "src": "428:18:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 269, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "428:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 272, + "indexed": false, + "mutability": "mutable", + "name": "value", + "nameLocation": "456:5:5", + "nodeType": "VariableDeclaration", + "scope": 274, + "src": "448:13:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 271, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "448:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "405:57:5" + }, + "src": "391:72:5" + }, + { + "anonymous": false, + "documentation": { + "id": 275, + "nodeType": "StructuredDocumentation", + "src": "469:148:5", + "text": " @dev Emitted when the allowance of a `spender` for an `owner` is set by\n a call to {approve}. `value` is the new allowance." + }, + "eventSelector": "8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", + "id": 283, + "name": "Approval", + "nameLocation": "628:8:5", + "nodeType": "EventDefinition", + "parameters": { + "id": 282, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 277, + "indexed": true, + "mutability": "mutable", + "name": "owner", + "nameLocation": "653:5:5", + "nodeType": "VariableDeclaration", + "scope": 283, + "src": "637:21:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 276, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "637:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 279, + "indexed": true, + "mutability": "mutable", + "name": "spender", + "nameLocation": "676:7:5", + "nodeType": "VariableDeclaration", + "scope": 283, + "src": "660:23:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 278, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "660:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 281, + "indexed": false, + "mutability": "mutable", + "name": "value", + "nameLocation": "693:5:5", + "nodeType": "VariableDeclaration", + "scope": 283, + "src": "685:13:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 280, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "685:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "636:63:5" + }, + "src": "622:78:5" + }, + { + "documentation": { + "id": 284, + "nodeType": "StructuredDocumentation", + "src": "706:65:5", + "text": " @dev Returns the value of tokens in existence." + }, + "functionSelector": "18160ddd", + "id": 289, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "totalSupply", + "nameLocation": "785:11:5", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 285, + "nodeType": "ParameterList", + "parameters": [], + "src": "796:2:5" + }, + "returnParameters": { + "id": 288, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 287, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 289, + "src": "822:7:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 286, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "822:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "821:9:5" + }, + "scope": 340, + "src": "776:55:5", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 290, + "nodeType": "StructuredDocumentation", + "src": "837:71:5", + "text": " @dev Returns the value of tokens owned by `account`." + }, + "functionSelector": "70a08231", + "id": 297, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "balanceOf", + "nameLocation": "922:9:5", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 293, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 292, + "mutability": "mutable", + "name": "account", + "nameLocation": "940:7:5", + "nodeType": "VariableDeclaration", + "scope": 297, + "src": "932:15:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 291, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "932:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "931:17:5" + }, + "returnParameters": { + "id": 296, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 295, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 297, + "src": "972:7:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 294, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "972:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "971:9:5" + }, + "scope": 340, + "src": "913:68:5", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 298, + "nodeType": "StructuredDocumentation", + "src": "987:213:5", + "text": " @dev Moves a `value` amount of tokens from the caller's account to `to`.\n Returns a boolean value indicating whether the operation succeeded.\n Emits a {Transfer} event." + }, + "functionSelector": "a9059cbb", + "id": 307, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "transfer", + "nameLocation": "1214:8:5", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 303, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 300, + "mutability": "mutable", + "name": "to", + "nameLocation": "1231:2:5", + "nodeType": "VariableDeclaration", + "scope": 307, + "src": "1223:10:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 299, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1223:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 302, + "mutability": "mutable", + "name": "value", + "nameLocation": "1243:5:5", + "nodeType": "VariableDeclaration", + "scope": 307, + "src": "1235:13:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 301, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1235:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1222:27:5" + }, + "returnParameters": { + "id": 306, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 305, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 307, + "src": "1268:4:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 304, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "1268:4:5", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "1267:6:5" + }, + "scope": 340, + "src": "1205:69:5", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 308, + "nodeType": "StructuredDocumentation", + "src": "1280:264:5", + "text": " @dev Returns the remaining number of tokens that `spender` will be\n allowed to spend on behalf of `owner` through {transferFrom}. This is\n zero by default.\n This value changes when {approve} or {transferFrom} are called." + }, + "functionSelector": "dd62ed3e", + "id": 317, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "allowance", + "nameLocation": "1558:9:5", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 313, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 310, + "mutability": "mutable", + "name": "owner", + "nameLocation": "1576:5:5", + "nodeType": "VariableDeclaration", + "scope": 317, + "src": "1568:13:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 309, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1568:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 312, + "mutability": "mutable", + "name": "spender", + "nameLocation": "1591:7:5", + "nodeType": "VariableDeclaration", + "scope": 317, + "src": "1583:15:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 311, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1583:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "1567:32:5" + }, + "returnParameters": { + "id": 316, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 315, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 317, + "src": "1623:7:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 314, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1623:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1622:9:5" + }, + "scope": 340, + "src": "1549:83:5", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 318, + "nodeType": "StructuredDocumentation", + "src": "1638:667:5", + "text": " @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n caller's tokens.\n Returns a boolean value indicating whether the operation succeeded.\n IMPORTANT: Beware that changing an allowance with this method brings the risk\n that someone may use both the old and the new allowance by unfortunate\n transaction ordering. One possible solution to mitigate this race\n condition is to first reduce the spender's allowance to 0 and set the\n desired value afterwards:\n https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n Emits an {Approval} event." + }, + "functionSelector": "095ea7b3", + "id": 327, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "approve", + "nameLocation": "2319:7:5", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 323, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 320, + "mutability": "mutable", + "name": "spender", + "nameLocation": "2335:7:5", + "nodeType": "VariableDeclaration", + "scope": 327, + "src": "2327:15:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 319, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2327:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 322, + "mutability": "mutable", + "name": "value", + "nameLocation": "2352:5:5", + "nodeType": "VariableDeclaration", + "scope": 327, + "src": "2344:13:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 321, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2344:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2326:32:5" + }, + "returnParameters": { + "id": 326, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 325, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 327, + "src": "2377:4:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 324, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "2377:4:5", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "2376:6:5" + }, + "scope": 340, + "src": "2310:73:5", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 328, + "nodeType": "StructuredDocumentation", + "src": "2389:297:5", + "text": " @dev Moves a `value` amount of tokens from `from` to `to` using the\n allowance mechanism. `value` is then deducted from the caller's\n allowance.\n Returns a boolean value indicating whether the operation succeeded.\n Emits a {Transfer} event." + }, + "functionSelector": "23b872dd", + "id": 339, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "transferFrom", + "nameLocation": "2700:12:5", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 335, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 330, + "mutability": "mutable", + "name": "from", + "nameLocation": "2721:4:5", + "nodeType": "VariableDeclaration", + "scope": 339, + "src": "2713:12:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 329, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2713:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 332, + "mutability": "mutable", + "name": "to", + "nameLocation": "2735:2:5", + "nodeType": "VariableDeclaration", + "scope": 339, + "src": "2727:10:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 331, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2727:7:5", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 334, + "mutability": "mutable", + "name": "value", + "nameLocation": "2747:5:5", + "nodeType": "VariableDeclaration", + "scope": 339, + "src": "2739:13:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 333, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2739:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2712:41:5" + }, + "returnParameters": { + "id": 338, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 337, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 339, + "src": "2772:4:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 336, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "2772:4:5", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "2771:6:5" + }, + "scope": 340, + "src": "2691:87:5", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + } + ], + "scope": 341, + "src": "205:2575:5", + "usedErrors": [], + "usedEvents": [ + 274, + 283 + ] + } + ], + "src": "106:2675:5" + }, + "id": 5 + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol", + "exportedSymbols": { + "IERC20Permit": [ + 376 + ] + }, + "id": 377, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 342, + "literals": [ + "solidity", + ">=", + "0.4", + ".16" + ], + "nodeType": "PragmaDirective", + "src": "123:25:6" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "IERC20Permit", + "contractDependencies": [], + "contractKind": "interface", + "documentation": { + "id": 343, + "nodeType": "StructuredDocumentation", + "src": "150:1965:6", + "text": " @dev Interface of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n need to send a transaction, and thus is not required to hold Ether at all.\n ==== Security Considerations\n There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n considered as an intention to spend the allowance in any specific way. The second is that because permits have\n built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n generally recommended is:\n ```solidity\n function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n doThing(..., value);\n }\n function doThing(..., uint256 value) public {\n token.safeTransferFrom(msg.sender, address(this), value);\n ...\n }\n ```\n Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n {SafeERC20-safeTransferFrom}).\n Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n contracts should have entry points that don't rely on permit." + }, + "fullyImplemented": false, + "id": 376, + "linearizedBaseContracts": [ + 376 + ], + "name": "IERC20Permit", + "nameLocation": "2126:12:6", + "nodeType": "ContractDefinition", + "nodes": [ + { + "documentation": { + "id": 344, + "nodeType": "StructuredDocumentation", + "src": "2145:852:6", + "text": " @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n given ``owner``'s signed approval.\n IMPORTANT: The same issues {IERC20-approve} has related to transaction\n ordering also applies here.\n Emits an {Approval} event.\n Requirements:\n - `spender` cannot be the zero address.\n - `deadline` must be a timestamp in the future.\n - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n over the EIP712-formatted function arguments.\n - the signature must use ``owner``'s current nonce (see {nonces}).\n For more information on the signature format, see the\n https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n section].\n CAUTION: See Security Considerations above." + }, + "functionSelector": "d505accf", + "id": 361, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "permit", + "nameLocation": "3011:6:6", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 359, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 346, + "mutability": "mutable", + "name": "owner", + "nameLocation": "3035:5:6", + "nodeType": "VariableDeclaration", + "scope": 361, + "src": "3027:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 345, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3027:7:6", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 348, + "mutability": "mutable", + "name": "spender", + "nameLocation": "3058:7:6", + "nodeType": "VariableDeclaration", + "scope": 361, + "src": "3050:15:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 347, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3050:7:6", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 350, + "mutability": "mutable", + "name": "value", + "nameLocation": "3083:5:6", + "nodeType": "VariableDeclaration", + "scope": 361, + "src": "3075:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 349, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3075:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 352, + "mutability": "mutable", + "name": "deadline", + "nameLocation": "3106:8:6", + "nodeType": "VariableDeclaration", + "scope": 361, + "src": "3098:16:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 351, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3098:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 354, + "mutability": "mutable", + "name": "v", + "nameLocation": "3130:1:6", + "nodeType": "VariableDeclaration", + "scope": 361, + "src": "3124:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 353, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "3124:5:6", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 356, + "mutability": "mutable", + "name": "r", + "nameLocation": "3149:1:6", + "nodeType": "VariableDeclaration", + "scope": 361, + "src": "3141:9:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 355, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3141:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 358, + "mutability": "mutable", + "name": "s", + "nameLocation": "3168:1:6", + "nodeType": "VariableDeclaration", + "scope": 361, + "src": "3160:9:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 357, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3160:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "3017:158:6" + }, + "returnParameters": { + "id": 360, + "nodeType": "ParameterList", + "parameters": [], + "src": "3184:0:6" + }, + "scope": 376, + "src": "3002:183:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 362, + "nodeType": "StructuredDocumentation", + "src": "3191:294:6", + "text": " @dev Returns the current nonce for `owner`. This value must be\n included whenever a signature is generated for {permit}.\n Every successful call to {permit} increases ``owner``'s nonce by one. This\n prevents a signature from being used multiple times." + }, + "functionSelector": "7ecebe00", + "id": 369, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "nonces", + "nameLocation": "3499:6:6", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 365, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 364, + "mutability": "mutable", + "name": "owner", + "nameLocation": "3514:5:6", + "nodeType": "VariableDeclaration", + "scope": 369, + "src": "3506:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 363, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3506:7:6", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "3505:15:6" + }, + "returnParameters": { + "id": 368, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 367, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 369, + "src": "3544:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 366, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3544:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3543:9:6" + }, + "scope": 376, + "src": "3490:63:6", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "documentation": { + "id": 370, + "nodeType": "StructuredDocumentation", + "src": "3559:128:6", + "text": " @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}." + }, + "functionSelector": "3644e515", + "id": 375, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "DOMAIN_SEPARATOR", + "nameLocation": "3754:16:6", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 371, + "nodeType": "ParameterList", + "parameters": [], + "src": "3770:2:6" + }, + "returnParameters": { + "id": 374, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 373, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 375, + "src": "3796:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 372, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3796:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "3795:9:6" + }, + "scope": 376, + "src": "3745:60:6", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + } + ], + "scope": 377, + "src": "2116:1691:6", + "usedErrors": [], + "usedEvents": [] + } + ], + "src": "123:3685:6" + }, + "id": 6 + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol", + "exportedSymbols": { + "IERC1363": [ + 229 + ], + "IERC20": [ + 340 + ], + "SafeERC20": [ + 831 + ] + }, + "id": 832, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 378, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "115:24:7" + }, + { + "absolutePath": "@openzeppelin/contracts/token/ERC20/IERC20.sol", + "file": "../IERC20.sol", + "id": 380, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 832, + "sourceUnit": 341, + "src": "141:37:7", + "symbolAliases": [ + { + "foreign": { + "id": 379, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "149:6:7", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/interfaces/IERC1363.sol", + "file": "../../../interfaces/IERC1363.sol", + "id": 382, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 832, + "sourceUnit": 230, + "src": "179:58:7", + "symbolAliases": [ + { + "foreign": { + "id": 381, + "name": "IERC1363", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 229, + "src": "187:8:7", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "SafeERC20", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 383, + "nodeType": "StructuredDocumentation", + "src": "239:458:7", + "text": " @title SafeERC20\n @dev Wrappers around ERC-20 operations that throw on failure (when the token\n contract returns false). Tokens that return no value (and instead revert or\n throw on failure) are also supported, non-reverting calls are assumed to be\n successful.\n To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n which allows you to call the safe operations as `token.safeTransfer(...)`, etc." + }, + "fullyImplemented": true, + "id": 831, + "linearizedBaseContracts": [ + 831 + ], + "name": "SafeERC20", + "nameLocation": "706:9:7", + "nodeType": "ContractDefinition", + "nodes": [ + { + "documentation": { + "id": 384, + "nodeType": "StructuredDocumentation", + "src": "722:65:7", + "text": " @dev An operation with an ERC-20 token failed." + }, + "errorSelector": "5274afe7", + "id": 388, + "name": "SafeERC20FailedOperation", + "nameLocation": "798:24:7", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 387, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 386, + "mutability": "mutable", + "name": "token", + "nameLocation": "831:5:7", + "nodeType": "VariableDeclaration", + "scope": 388, + "src": "823:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 385, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "823:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "822:15:7" + }, + "src": "792:46:7" + }, + { + "documentation": { + "id": 389, + "nodeType": "StructuredDocumentation", + "src": "844:71:7", + "text": " @dev Indicates a failed `decreaseAllowance` request." + }, + "errorSelector": "e570110f", + "id": 397, + "name": "SafeERC20FailedDecreaseAllowance", + "nameLocation": "926:32:7", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 396, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 391, + "mutability": "mutable", + "name": "spender", + "nameLocation": "967:7:7", + "nodeType": "VariableDeclaration", + "scope": 397, + "src": "959:15:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 390, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "959:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 393, + "mutability": "mutable", + "name": "currentAllowance", + "nameLocation": "984:16:7", + "nodeType": "VariableDeclaration", + "scope": 397, + "src": "976:24:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 392, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "976:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 395, + "mutability": "mutable", + "name": "requestedDecrease", + "nameLocation": "1010:17:7", + "nodeType": "VariableDeclaration", + "scope": 397, + "src": "1002:25:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 394, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1002:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "958:70:7" + }, + "src": "920:109:7" + }, + { + "body": { + "id": 424, + "nodeType": "Block", + "src": "1291:132:7", + "statements": [ + { + "condition": { + "id": 414, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "1305:38:7", + "subExpression": { + "arguments": [ + { + "id": 409, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 401, + "src": "1320:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + { + "id": 410, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 403, + "src": "1327:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 411, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 405, + "src": "1331:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "74727565", + "id": 412, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1338:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 408, + "name": "_safeTransfer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 782, + "src": "1306:13:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$_t_bool_$returns$_t_bool_$", + "typeString": "function (contract IERC20,address,uint256,bool) returns (bool)" + } + }, + "id": 413, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1306:37:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 423, + "nodeType": "IfStatement", + "src": "1301:116:7", + "trueBody": { + "id": 422, + "nodeType": "Block", + "src": "1345:72:7", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "id": 418, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 401, + "src": "1399:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + ], + "id": 417, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1391:7:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 416, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1391:7:7", + "typeDescriptions": {} + } + }, + "id": 419, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1391:14:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 415, + "name": "SafeERC20FailedOperation", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 388, + "src": "1366:24:7", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 420, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1366:40:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 421, + "nodeType": "RevertStatement", + "src": "1359:47:7" + } + ] + } + } + ] + }, + "documentation": { + "id": 398, + "nodeType": "StructuredDocumentation", + "src": "1035:179:7", + "text": " @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n non-reverting calls are assumed to be successful." + }, + "id": 425, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "safeTransfer", + "nameLocation": "1228:12:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 406, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 401, + "mutability": "mutable", + "name": "token", + "nameLocation": "1248:5:7", + "nodeType": "VariableDeclaration", + "scope": 425, + "src": "1241:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 400, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 399, + "name": "IERC20", + "nameLocations": [ + "1241:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "1241:6:7" + }, + "referencedDeclaration": 340, + "src": "1241:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 403, + "mutability": "mutable", + "name": "to", + "nameLocation": "1263:2:7", + "nodeType": "VariableDeclaration", + "scope": 425, + "src": "1255:10:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 402, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1255:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 405, + "mutability": "mutable", + "name": "value", + "nameLocation": "1275:5:7", + "nodeType": "VariableDeclaration", + "scope": 425, + "src": "1267:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 404, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1267:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1240:41:7" + }, + "returnParameters": { + "id": 407, + "nodeType": "ParameterList", + "parameters": [], + "src": "1291:0:7" + }, + "scope": 831, + "src": "1219:204:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 455, + "nodeType": "Block", + "src": "1752:142:7", + "statements": [ + { + "condition": { + "id": 445, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "1766:48:7", + "subExpression": { + "arguments": [ + { + "id": 439, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 429, + "src": "1785:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + { + "id": 440, + "name": "from", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 431, + "src": "1792:4:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 441, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 433, + "src": "1798:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 442, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 435, + "src": "1802:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "74727565", + "id": 443, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1809:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 438, + "name": "_safeTransferFrom", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 807, + "src": "1767:17:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_address_$_t_uint256_$_t_bool_$returns$_t_bool_$", + "typeString": "function (contract IERC20,address,address,uint256,bool) returns (bool)" + } + }, + "id": 444, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1767:47:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 454, + "nodeType": "IfStatement", + "src": "1762:126:7", + "trueBody": { + "id": 453, + "nodeType": "Block", + "src": "1816:72:7", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "id": 449, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 429, + "src": "1870:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + ], + "id": 448, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1862:7:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 447, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1862:7:7", + "typeDescriptions": {} + } + }, + "id": 450, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1862:14:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 446, + "name": "SafeERC20FailedOperation", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 388, + "src": "1837:24:7", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 451, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1837:40:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 452, + "nodeType": "RevertStatement", + "src": "1830:47:7" + } + ] + } + } + ] + }, + "documentation": { + "id": 426, + "nodeType": "StructuredDocumentation", + "src": "1429:228:7", + "text": " @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n calling contract. If `token` returns no value, non-reverting calls are assumed to be successful." + }, + "id": 456, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "safeTransferFrom", + "nameLocation": "1671:16:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 436, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 429, + "mutability": "mutable", + "name": "token", + "nameLocation": "1695:5:7", + "nodeType": "VariableDeclaration", + "scope": 456, + "src": "1688:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 428, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 427, + "name": "IERC20", + "nameLocations": [ + "1688:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "1688:6:7" + }, + "referencedDeclaration": 340, + "src": "1688:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 431, + "mutability": "mutable", + "name": "from", + "nameLocation": "1710:4:7", + "nodeType": "VariableDeclaration", + "scope": 456, + "src": "1702:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 430, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1702:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 433, + "mutability": "mutable", + "name": "to", + "nameLocation": "1724:2:7", + "nodeType": "VariableDeclaration", + "scope": 456, + "src": "1716:10:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 432, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1716:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 435, + "mutability": "mutable", + "name": "value", + "nameLocation": "1736:5:7", + "nodeType": "VariableDeclaration", + "scope": 456, + "src": "1728:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 434, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1728:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1687:55:7" + }, + "returnParameters": { + "id": 437, + "nodeType": "ParameterList", + "parameters": [], + "src": "1752:0:7" + }, + "scope": 831, + "src": "1662:232:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 476, + "nodeType": "Block", + "src": "2121:62:7", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 470, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 460, + "src": "2152:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + { + "id": 471, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 462, + "src": "2159:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 472, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 464, + "src": "2163:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "66616c7365", + "id": 473, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2170:5:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 469, + "name": "_safeTransfer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 782, + "src": "2138:13:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$_t_bool_$returns$_t_bool_$", + "typeString": "function (contract IERC20,address,uint256,bool) returns (bool)" + } + }, + "id": 474, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2138:38:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 468, + "id": 475, + "nodeType": "Return", + "src": "2131:45:7" + } + ] + }, + "documentation": { + "id": 457, + "nodeType": "StructuredDocumentation", + "src": "1900:126:7", + "text": " @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful." + }, + "id": 477, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "trySafeTransfer", + "nameLocation": "2040:15:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 465, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 460, + "mutability": "mutable", + "name": "token", + "nameLocation": "2063:5:7", + "nodeType": "VariableDeclaration", + "scope": 477, + "src": "2056:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 459, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 458, + "name": "IERC20", + "nameLocations": [ + "2056:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "2056:6:7" + }, + "referencedDeclaration": 340, + "src": "2056:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 462, + "mutability": "mutable", + "name": "to", + "nameLocation": "2078:2:7", + "nodeType": "VariableDeclaration", + "scope": 477, + "src": "2070:10:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 461, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2070:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 464, + "mutability": "mutable", + "name": "value", + "nameLocation": "2090:5:7", + "nodeType": "VariableDeclaration", + "scope": 477, + "src": "2082:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 463, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2082:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2055:41:7" + }, + "returnParameters": { + "id": 468, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 467, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 477, + "src": "2115:4:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 466, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "2115:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "2114:6:7" + }, + "scope": 831, + "src": "2031:152:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 500, + "nodeType": "Block", + "src": "2432:72:7", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 493, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 481, + "src": "2467:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + { + "id": 494, + "name": "from", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 483, + "src": "2474:4:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 495, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 485, + "src": "2480:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 496, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 487, + "src": "2484:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "66616c7365", + "id": 497, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2491:5:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 492, + "name": "_safeTransferFrom", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 807, + "src": "2449:17:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_address_$_t_uint256_$_t_bool_$returns$_t_bool_$", + "typeString": "function (contract IERC20,address,address,uint256,bool) returns (bool)" + } + }, + "id": 498, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2449:48:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 491, + "id": 499, + "nodeType": "Return", + "src": "2442:55:7" + } + ] + }, + "documentation": { + "id": 478, + "nodeType": "StructuredDocumentation", + "src": "2189:130:7", + "text": " @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful." + }, + "id": 501, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "trySafeTransferFrom", + "nameLocation": "2333:19:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 488, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 481, + "mutability": "mutable", + "name": "token", + "nameLocation": "2360:5:7", + "nodeType": "VariableDeclaration", + "scope": 501, + "src": "2353:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 480, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 479, + "name": "IERC20", + "nameLocations": [ + "2353:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "2353:6:7" + }, + "referencedDeclaration": 340, + "src": "2353:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 483, + "mutability": "mutable", + "name": "from", + "nameLocation": "2375:4:7", + "nodeType": "VariableDeclaration", + "scope": 501, + "src": "2367:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 482, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2367:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 485, + "mutability": "mutable", + "name": "to", + "nameLocation": "2389:2:7", + "nodeType": "VariableDeclaration", + "scope": 501, + "src": "2381:10:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 484, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2381:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 487, + "mutability": "mutable", + "name": "value", + "nameLocation": "2401:5:7", + "nodeType": "VariableDeclaration", + "scope": 501, + "src": "2393:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 486, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2393:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2352:55:7" + }, + "returnParameters": { + "id": 491, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 490, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 501, + "src": "2426:4:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 489, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "2426:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "2425:6:7" + }, + "scope": 831, + "src": "2324:180:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 531, + "nodeType": "Block", + "src": "3246:139:7", + "statements": [ + { + "assignments": [ + 513 + ], + "declarations": [ + { + "constant": false, + "id": 513, + "mutability": "mutable", + "name": "oldAllowance", + "nameLocation": "3264:12:7", + "nodeType": "VariableDeclaration", + "scope": 531, + "src": "3256:20:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 512, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3256:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 522, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "id": 518, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "3303:4:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_SafeERC20_$831", + "typeString": "library SafeERC20" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_SafeERC20_$831", + "typeString": "library SafeERC20" + } + ], + "id": 517, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3295:7:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 516, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3295:7:7", + "typeDescriptions": {} + } + }, + "id": 519, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3295:13:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 520, + "name": "spender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 507, + "src": "3310:7:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "expression": { + "id": 514, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 505, + "src": "3279:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "id": 515, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3285:9:7", + "memberName": "allowance", + "nodeType": "MemberAccess", + "referencedDeclaration": 317, + "src": "3279:15:7", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_address_$_t_address_$returns$_t_uint256_$", + "typeString": "function (address,address) view external returns (uint256)" + } + }, + "id": 521, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3279:39:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3256:62:7" + }, + { + "expression": { + "arguments": [ + { + "id": 524, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 505, + "src": "3341:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + { + "id": 525, + "name": "spender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 507, + "src": "3348:7:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 528, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 526, + "name": "oldAllowance", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 513, + "src": "3357:12:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "id": 527, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 509, + "src": "3372:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3357:20:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 523, + "name": "forceApprove", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 626, + "src": "3328:12:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$returns$__$", + "typeString": "function (contract IERC20,address,uint256)" + } + }, + "id": 529, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3328:50:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 530, + "nodeType": "ExpressionStatement", + "src": "3328:50:7" + } + ] + }, + "documentation": { + "id": 502, + "nodeType": "StructuredDocumentation", + "src": "2510:645:7", + "text": " @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n non-reverting calls are assumed to be successful.\n IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the \"client\"\n smart contract uses ERC-7674 to set temporary allowances, then the \"client\" smart contract should avoid using\n this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract\n that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior." + }, + "id": 532, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "safeIncreaseAllowance", + "nameLocation": "3169:21:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 510, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 505, + "mutability": "mutable", + "name": "token", + "nameLocation": "3198:5:7", + "nodeType": "VariableDeclaration", + "scope": 532, + "src": "3191:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 504, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 503, + "name": "IERC20", + "nameLocations": [ + "3191:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "3191:6:7" + }, + "referencedDeclaration": 340, + "src": "3191:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 507, + "mutability": "mutable", + "name": "spender", + "nameLocation": "3213:7:7", + "nodeType": "VariableDeclaration", + "scope": 532, + "src": "3205:15:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 506, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3205:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 509, + "mutability": "mutable", + "name": "value", + "nameLocation": "3230:5:7", + "nodeType": "VariableDeclaration", + "scope": 532, + "src": "3222:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 508, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3222:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3190:46:7" + }, + "returnParameters": { + "id": 511, + "nodeType": "ParameterList", + "parameters": [], + "src": "3246:0:7" + }, + "scope": 831, + "src": "3160:225:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 574, + "nodeType": "Block", + "src": "4151:370:7", + "statements": [ + { + "id": 573, + "nodeType": "UncheckedBlock", + "src": "4161:354:7", + "statements": [ + { + "assignments": [ + 544 + ], + "declarations": [ + { + "constant": false, + "id": 544, + "mutability": "mutable", + "name": "currentAllowance", + "nameLocation": "4193:16:7", + "nodeType": "VariableDeclaration", + "scope": 573, + "src": "4185:24:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 543, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4185:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 553, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "id": 549, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "4236:4:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_SafeERC20_$831", + "typeString": "library SafeERC20" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_SafeERC20_$831", + "typeString": "library SafeERC20" + } + ], + "id": 548, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4228:7:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 547, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "4228:7:7", + "typeDescriptions": {} + } + }, + "id": 550, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4228:13:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 551, + "name": "spender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 538, + "src": "4243:7:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "expression": { + "id": 545, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 536, + "src": "4212:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "id": 546, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4218:9:7", + "memberName": "allowance", + "nodeType": "MemberAccess", + "referencedDeclaration": 317, + "src": "4212:15:7", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_address_$_t_address_$returns$_t_uint256_$", + "typeString": "function (address,address) view external returns (uint256)" + } + }, + "id": 552, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4212:39:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4185:66:7" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 556, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 554, + "name": "currentAllowance", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 544, + "src": "4269:16:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 555, + "name": "requestedDecrease", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 540, + "src": "4288:17:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4269:36:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 564, + "nodeType": "IfStatement", + "src": "4265:160:7", + "trueBody": { + "id": 563, + "nodeType": "Block", + "src": "4307:118:7", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "id": 558, + "name": "spender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 538, + "src": "4365:7:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 559, + "name": "currentAllowance", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 544, + "src": "4374:16:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 560, + "name": "requestedDecrease", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 540, + "src": "4392:17:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 557, + "name": "SafeERC20FailedDecreaseAllowance", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 397, + "src": "4332:32:7", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$_t_uint256_$_t_uint256_$returns$_t_error_$", + "typeString": "function (address,uint256,uint256) pure returns (error)" + } + }, + "id": 561, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4332:78:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 562, + "nodeType": "RevertStatement", + "src": "4325:85:7" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 566, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 536, + "src": "4451:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + { + "id": 567, + "name": "spender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 538, + "src": "4458:7:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 570, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 568, + "name": "currentAllowance", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 544, + "src": "4467:16:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "id": 569, + "name": "requestedDecrease", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 540, + "src": "4486:17:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4467:36:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 565, + "name": "forceApprove", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 626, + "src": "4438:12:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$returns$__$", + "typeString": "function (contract IERC20,address,uint256)" + } + }, + "id": 571, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4438:66:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 572, + "nodeType": "ExpressionStatement", + "src": "4438:66:7" + } + ] + } + ] + }, + "documentation": { + "id": 533, + "nodeType": "StructuredDocumentation", + "src": "3391:657:7", + "text": " @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no\n value, non-reverting calls are assumed to be successful.\n IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the \"client\"\n smart contract uses ERC-7674 to set temporary allowances, then the \"client\" smart contract should avoid using\n this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract\n that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior." + }, + "id": 575, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "safeDecreaseAllowance", + "nameLocation": "4062:21:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 541, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 536, + "mutability": "mutable", + "name": "token", + "nameLocation": "4091:5:7", + "nodeType": "VariableDeclaration", + "scope": 575, + "src": "4084:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 535, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 534, + "name": "IERC20", + "nameLocations": [ + "4084:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "4084:6:7" + }, + "referencedDeclaration": 340, + "src": "4084:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 538, + "mutability": "mutable", + "name": "spender", + "nameLocation": "4106:7:7", + "nodeType": "VariableDeclaration", + "scope": 575, + "src": "4098:15:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 537, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "4098:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 540, + "mutability": "mutable", + "name": "requestedDecrease", + "nameLocation": "4123:17:7", + "nodeType": "VariableDeclaration", + "scope": 575, + "src": "4115:25:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 539, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4115:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4083:58:7" + }, + "returnParameters": { + "id": 542, + "nodeType": "ParameterList", + "parameters": [], + "src": "4151:0:7" + }, + "scope": 831, + "src": "4053:468:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 625, + "nodeType": "Block", + "src": "5175:290:7", + "statements": [ + { + "condition": { + "id": 592, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "5189:43:7", + "subExpression": { + "arguments": [ + { + "id": 587, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 579, + "src": "5203:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + { + "id": 588, + "name": "spender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 581, + "src": "5210:7:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 589, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 583, + "src": "5219:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "66616c7365", + "id": 590, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5226:5:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 586, + "name": "_safeApprove", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 830, + "src": "5190:12:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$_t_bool_$returns$_t_bool_$", + "typeString": "function (contract IERC20,address,uint256,bool) returns (bool)" + } + }, + "id": 591, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5190:42:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 624, + "nodeType": "IfStatement", + "src": "5185:274:7", + "trueBody": { + "id": 623, + "nodeType": "Block", + "src": "5234:225:7", + "statements": [ + { + "condition": { + "id": 599, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "5252:38:7", + "subExpression": { + "arguments": [ + { + "id": 594, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 579, + "src": "5266:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + { + "id": 595, + "name": "spender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 581, + "src": "5273:7:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "hexValue": "30", + "id": 596, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5282:1:7", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "hexValue": "74727565", + "id": 597, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5285:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 593, + "name": "_safeApprove", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 830, + "src": "5253:12:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$_t_bool_$returns$_t_bool_$", + "typeString": "function (contract IERC20,address,uint256,bool) returns (bool)" + } + }, + "id": 598, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5253:37:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 607, + "nodeType": "IfStatement", + "src": "5248:91:7", + "trueBody": { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "id": 603, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 579, + "src": "5332:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + ], + "id": 602, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5324:7:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 601, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5324:7:7", + "typeDescriptions": {} + } + }, + "id": 604, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5324:14:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 600, + "name": "SafeERC20FailedOperation", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 388, + "src": "5299:24:7", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 605, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5299:40:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 606, + "nodeType": "RevertStatement", + "src": "5292:47:7" + } + }, + { + "condition": { + "id": 614, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "5357:42:7", + "subExpression": { + "arguments": [ + { + "id": 609, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 579, + "src": "5371:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + { + "id": 610, + "name": "spender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 581, + "src": "5378:7:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 611, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 583, + "src": "5387:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "74727565", + "id": 612, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5394:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 608, + "name": "_safeApprove", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 830, + "src": "5358:12:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$_t_bool_$returns$_t_bool_$", + "typeString": "function (contract IERC20,address,uint256,bool) returns (bool)" + } + }, + "id": 613, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5358:41:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 622, + "nodeType": "IfStatement", + "src": "5353:95:7", + "trueBody": { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "id": 618, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 579, + "src": "5441:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + ], + "id": 617, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5433:7:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 616, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5433:7:7", + "typeDescriptions": {} + } + }, + "id": 619, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5433:14:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 615, + "name": "SafeERC20FailedOperation", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 388, + "src": "5408:24:7", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 620, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5408:40:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 621, + "nodeType": "RevertStatement", + "src": "5401:47:7" + } + } + ] + } + } + ] + }, + "documentation": { + "id": 576, + "nodeType": "StructuredDocumentation", + "src": "4527:566:7", + "text": " @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n to be set to zero before setting it to a non-zero value, such as USDT.\n NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function\n only sets the \"standard\" allowance. Any temporary allowance will remain active, in addition to the value being\n set here." + }, + "id": 626, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "forceApprove", + "nameLocation": "5107:12:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 584, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 579, + "mutability": "mutable", + "name": "token", + "nameLocation": "5127:5:7", + "nodeType": "VariableDeclaration", + "scope": 626, + "src": "5120:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 578, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 577, + "name": "IERC20", + "nameLocations": [ + "5120:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "5120:6:7" + }, + "referencedDeclaration": 340, + "src": "5120:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 581, + "mutability": "mutable", + "name": "spender", + "nameLocation": "5142:7:7", + "nodeType": "VariableDeclaration", + "scope": 626, + "src": "5134:15:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 580, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5134:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 583, + "mutability": "mutable", + "name": "value", + "nameLocation": "5159:5:7", + "nodeType": "VariableDeclaration", + "scope": 626, + "src": "5151:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 582, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5151:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5119:46:7" + }, + "returnParameters": { + "id": 585, + "nodeType": "ParameterList", + "parameters": [], + "src": "5175:0:7" + }, + "scope": 831, + "src": "5098:367:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 668, + "nodeType": "Block", + "src": "5914:219:7", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 643, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "expression": { + "id": 639, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 632, + "src": "5928:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 640, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5931:4:7", + "memberName": "code", + "nodeType": "MemberAccess", + "src": "5928:7:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 641, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5936:6:7", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "5928:14:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 642, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5946:1:7", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "5928:19:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "id": 657, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "6014:39:7", + "subExpression": { + "arguments": [ + { + "id": 653, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 632, + "src": "6037:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 654, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 634, + "src": "6041:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 655, + "name": "data", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 636, + "src": "6048:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "id": 651, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 630, + "src": "6015:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + }, + "id": 652, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6021:15:7", + "memberName": "transferAndCall", + "nodeType": "MemberAccess", + "referencedDeclaration": 180, + "src": "6015:21:7", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_uint256_$_t_bytes_memory_ptr_$returns$_t_bool_$", + "typeString": "function (address,uint256,bytes memory) external returns (bool)" + } + }, + "id": 656, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6015:38:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 666, + "nodeType": "IfStatement", + "src": "6010:117:7", + "trueBody": { + "id": 665, + "nodeType": "Block", + "src": "6055:72:7", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "id": 661, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 630, + "src": "6109:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + ], + "id": 660, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6101:7:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 659, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6101:7:7", + "typeDescriptions": {} + } + }, + "id": 662, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6101:14:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 658, + "name": "SafeERC20FailedOperation", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 388, + "src": "6076:24:7", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 663, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6076:40:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 664, + "nodeType": "RevertStatement", + "src": "6069:47:7" + } + ] + } + }, + "id": 667, + "nodeType": "IfStatement", + "src": "5924:203:7", + "trueBody": { + "id": 650, + "nodeType": "Block", + "src": "5949:55:7", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 645, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 630, + "src": "5976:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + }, + { + "id": 646, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 632, + "src": "5983:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 647, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 634, + "src": "5987:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 644, + "name": "safeTransfer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 425, + "src": "5963:12:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$returns$__$", + "typeString": "function (contract IERC20,address,uint256)" + } + }, + "id": 648, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5963:30:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 649, + "nodeType": "ExpressionStatement", + "src": "5963:30:7" + } + ] + } + } + ] + }, + "documentation": { + "id": 627, + "nodeType": "StructuredDocumentation", + "src": "5471:335:7", + "text": " @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no\n code. This can be used to implement an {ERC721}-like safe transfer that relies on {ERC1363} checks when\n targeting contracts.\n Reverts if the returned value is other than `true`." + }, + "id": 669, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "transferAndCallRelaxed", + "nameLocation": "5820:22:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 637, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 630, + "mutability": "mutable", + "name": "token", + "nameLocation": "5852:5:7", + "nodeType": "VariableDeclaration", + "scope": 669, + "src": "5843:14:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + }, + "typeName": { + "id": 629, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 628, + "name": "IERC1363", + "nameLocations": [ + "5843:8:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 229, + "src": "5843:8:7" + }, + "referencedDeclaration": 229, + "src": "5843:8:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 632, + "mutability": "mutable", + "name": "to", + "nameLocation": "5867:2:7", + "nodeType": "VariableDeclaration", + "scope": 669, + "src": "5859:10:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 631, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5859:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 634, + "mutability": "mutable", + "name": "value", + "nameLocation": "5879:5:7", + "nodeType": "VariableDeclaration", + "scope": 669, + "src": "5871:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 633, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5871:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 636, + "mutability": "mutable", + "name": "data", + "nameLocation": "5899:4:7", + "nodeType": "VariableDeclaration", + "scope": 669, + "src": "5886:17:7", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 635, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5886:5:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "5842:62:7" + }, + "returnParameters": { + "id": 638, + "nodeType": "ParameterList", + "parameters": [], + "src": "5914:0:7" + }, + "scope": 831, + "src": "5811:322:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 715, + "nodeType": "Block", + "src": "6654:239:7", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 688, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "expression": { + "id": 684, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 677, + "src": "6668:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 685, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6671:4:7", + "memberName": "code", + "nodeType": "MemberAccess", + "src": "6668:7:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 686, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6676:6:7", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "6668:14:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 687, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6686:1:7", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "6668:19:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "id": 704, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "6764:49:7", + "subExpression": { + "arguments": [ + { + "id": 699, + "name": "from", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 675, + "src": "6791:4:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 700, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 677, + "src": "6797:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 701, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 679, + "src": "6801:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 702, + "name": "data", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 681, + "src": "6808:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "id": 697, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 673, + "src": "6765:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + }, + "id": 698, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6771:19:7", + "memberName": "transferFromAndCall", + "nodeType": "MemberAccess", + "referencedDeclaration": 206, + "src": "6765:25:7", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_address_$_t_uint256_$_t_bytes_memory_ptr_$returns$_t_bool_$", + "typeString": "function (address,address,uint256,bytes memory) external returns (bool)" + } + }, + "id": 703, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6765:48:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 713, + "nodeType": "IfStatement", + "src": "6760:127:7", + "trueBody": { + "id": 712, + "nodeType": "Block", + "src": "6815:72:7", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "id": 708, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 673, + "src": "6869:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + ], + "id": 707, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6861:7:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 706, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6861:7:7", + "typeDescriptions": {} + } + }, + "id": 709, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6861:14:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 705, + "name": "SafeERC20FailedOperation", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 388, + "src": "6836:24:7", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 710, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6836:40:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 711, + "nodeType": "RevertStatement", + "src": "6829:47:7" + } + ] + } + }, + "id": 714, + "nodeType": "IfStatement", + "src": "6664:223:7", + "trueBody": { + "id": 696, + "nodeType": "Block", + "src": "6689:65:7", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 690, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 673, + "src": "6720:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + }, + { + "id": 691, + "name": "from", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 675, + "src": "6727:4:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 692, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 677, + "src": "6733:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 693, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 679, + "src": "6737:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 689, + "name": "safeTransferFrom", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 456, + "src": "6703:16:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_address_$_t_uint256_$returns$__$", + "typeString": "function (contract IERC20,address,address,uint256)" + } + }, + "id": 694, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6703:40:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 695, + "nodeType": "ExpressionStatement", + "src": "6703:40:7" + } + ] + } + } + ] + }, + "documentation": { + "id": 670, + "nodeType": "StructuredDocumentation", + "src": "6139:343:7", + "text": " @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target\n has no code. This can be used to implement an {ERC721}-like safe transfer that relies on {ERC1363} checks when\n targeting contracts.\n Reverts if the returned value is other than `true`." + }, + "id": 716, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "transferFromAndCallRelaxed", + "nameLocation": "6496:26:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 682, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 673, + "mutability": "mutable", + "name": "token", + "nameLocation": "6541:5:7", + "nodeType": "VariableDeclaration", + "scope": 716, + "src": "6532:14:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + }, + "typeName": { + "id": 672, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 671, + "name": "IERC1363", + "nameLocations": [ + "6532:8:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 229, + "src": "6532:8:7" + }, + "referencedDeclaration": 229, + "src": "6532:8:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 675, + "mutability": "mutable", + "name": "from", + "nameLocation": "6564:4:7", + "nodeType": "VariableDeclaration", + "scope": 716, + "src": "6556:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 674, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6556:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 677, + "mutability": "mutable", + "name": "to", + "nameLocation": "6586:2:7", + "nodeType": "VariableDeclaration", + "scope": 716, + "src": "6578:10:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 676, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6578:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 679, + "mutability": "mutable", + "name": "value", + "nameLocation": "6606:5:7", + "nodeType": "VariableDeclaration", + "scope": 716, + "src": "6598:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 678, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6598:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 681, + "mutability": "mutable", + "name": "data", + "nameLocation": "6634:4:7", + "nodeType": "VariableDeclaration", + "scope": 716, + "src": "6621:17:7", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 680, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "6621:5:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "6522:122:7" + }, + "returnParameters": { + "id": 683, + "nodeType": "ParameterList", + "parameters": [], + "src": "6654:0:7" + }, + "scope": 831, + "src": "6487:406:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 758, + "nodeType": "Block", + "src": "7661:218:7", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 733, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "expression": { + "id": 729, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 722, + "src": "7675:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 730, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7678:4:7", + "memberName": "code", + "nodeType": "MemberAccess", + "src": "7675:7:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 731, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7683:6:7", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "7675:14:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 732, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7693:1:7", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "7675:19:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "id": 747, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "7761:38:7", + "subExpression": { + "arguments": [ + { + "id": 743, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 722, + "src": "7783:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 744, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 724, + "src": "7787:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 745, + "name": "data", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 726, + "src": "7794:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "id": 741, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 720, + "src": "7762:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + }, + "id": 742, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7768:14:7", + "memberName": "approveAndCall", + "nodeType": "MemberAccess", + "referencedDeclaration": 228, + "src": "7762:20:7", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_uint256_$_t_bytes_memory_ptr_$returns$_t_bool_$", + "typeString": "function (address,uint256,bytes memory) external returns (bool)" + } + }, + "id": 746, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7762:37:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 756, + "nodeType": "IfStatement", + "src": "7757:116:7", + "trueBody": { + "id": 755, + "nodeType": "Block", + "src": "7801:72:7", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "id": 751, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 720, + "src": "7855:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + ], + "id": 750, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "7847:7:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 749, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "7847:7:7", + "typeDescriptions": {} + } + }, + "id": 752, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7847:14:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 748, + "name": "SafeERC20FailedOperation", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 388, + "src": "7822:24:7", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$_t_error_$", + "typeString": "function (address) pure returns (error)" + } + }, + "id": 753, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7822:40:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 754, + "nodeType": "RevertStatement", + "src": "7815:47:7" + } + ] + } + }, + "id": 757, + "nodeType": "IfStatement", + "src": "7671:202:7", + "trueBody": { + "id": 740, + "nodeType": "Block", + "src": "7696:55:7", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 735, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 720, + "src": "7723:5:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + }, + { + "id": 736, + "name": "to", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 722, + "src": "7730:2:7", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 737, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 724, + "src": "7734:5:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 734, + "name": "forceApprove", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 626, + "src": "7710:12:7", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$returns$__$", + "typeString": "function (contract IERC20,address,uint256)" + } + }, + "id": 738, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7710:30:7", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 739, + "nodeType": "ExpressionStatement", + "src": "7710:30:7" + } + ] + } + } + ] + }, + "documentation": { + "id": 717, + "nodeType": "StructuredDocumentation", + "src": "6899:655:7", + "text": " @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no\n code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\n targeting contracts.\n NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.\n Oppositely, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}\n once without retrying, and relies on the returned value to be true.\n Reverts if the returned value is other than `true`." + }, + "id": 759, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "approveAndCallRelaxed", + "nameLocation": "7568:21:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 727, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 720, + "mutability": "mutable", + "name": "token", + "nameLocation": "7599:5:7", + "nodeType": "VariableDeclaration", + "scope": 759, + "src": "7590:14:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + }, + "typeName": { + "id": 719, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 718, + "name": "IERC1363", + "nameLocations": [ + "7590:8:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 229, + "src": "7590:8:7" + }, + "referencedDeclaration": 229, + "src": "7590:8:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC1363_$229", + "typeString": "contract IERC1363" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 722, + "mutability": "mutable", + "name": "to", + "nameLocation": "7614:2:7", + "nodeType": "VariableDeclaration", + "scope": 759, + "src": "7606:10:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 721, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "7606:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 724, + "mutability": "mutable", + "name": "value", + "nameLocation": "7626:5:7", + "nodeType": "VariableDeclaration", + "scope": 759, + "src": "7618:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 723, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7618:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 726, + "mutability": "mutable", + "name": "data", + "nameLocation": "7646:4:7", + "nodeType": "VariableDeclaration", + "scope": 759, + "src": "7633:17:7", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 725, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "7633:5:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "7589:62:7" + }, + "returnParameters": { + "id": 728, + "nodeType": "ParameterList", + "parameters": [], + "src": "7661:0:7" + }, + "scope": 831, + "src": "7559:320:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 781, + "nodeType": "Block", + "src": "8481:1136:7", + "statements": [ + { + "assignments": [ + 775 + ], + "declarations": [ + { + "constant": false, + "id": 775, + "mutability": "mutable", + "name": "selector", + "nameLocation": "8498:8:7", + "nodeType": "VariableDeclaration", + "scope": 781, + "src": "8491:15:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "typeName": { + "id": 774, + "name": "bytes4", + "nodeType": "ElementaryTypeName", + "src": "8491:6:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "visibility": "internal" + } + ], + "id": 779, + "initialValue": { + "expression": { + "expression": { + "id": 776, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "8509:6:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$340_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 777, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "8516:8:7", + "memberName": "transfer", + "nodeType": "MemberAccess", + "referencedDeclaration": 307, + "src": "8509:15:7", + "typeDescriptions": { + "typeIdentifier": "t_function_declaration_nonpayable$_t_address_$_t_uint256_$returns$_t_bool_$", + "typeString": "function IERC20.transfer(address,uint256) returns (bool)" + } + }, + "id": 778, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "8525:8:7", + "memberName": "selector", + "nodeType": "MemberAccess", + "src": "8509:24:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8491:42:7" + }, + { + "AST": { + "nativeSrc": "8569:1042:7", + "nodeType": "YulBlock", + "src": "8569:1042:7", + "statements": [ + { + "nativeSrc": "8583:22:7", + "nodeType": "YulVariableDeclaration", + "src": "8583:22:7", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "8600:4:7", + "nodeType": "YulLiteral", + "src": "8600:4:7", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "8594:5:7", + "nodeType": "YulIdentifier", + "src": "8594:5:7" + }, + "nativeSrc": "8594:11:7", + "nodeType": "YulFunctionCall", + "src": "8594:11:7" + }, + "variables": [ + { + "name": "fmp", + "nativeSrc": "8587:3:7", + "nodeType": "YulTypedName", + "src": "8587:3:7", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "8625:4:7", + "nodeType": "YulLiteral", + "src": "8625:4:7", + "type": "", + "value": "0x00" + }, + { + "name": "selector", + "nativeSrc": "8631:8:7", + "nodeType": "YulIdentifier", + "src": "8631:8:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8618:6:7", + "nodeType": "YulIdentifier", + "src": "8618:6:7" + }, + "nativeSrc": "8618:22:7", + "nodeType": "YulFunctionCall", + "src": "8618:22:7" + }, + "nativeSrc": "8618:22:7", + "nodeType": "YulExpressionStatement", + "src": "8618:22:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "8660:4:7", + "nodeType": "YulLiteral", + "src": "8660:4:7", + "type": "", + "value": "0x04" + }, + { + "arguments": [ + { + "name": "to", + "nativeSrc": "8670:2:7", + "nodeType": "YulIdentifier", + "src": "8670:2:7" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "8678:2:7", + "nodeType": "YulLiteral", + "src": "8678:2:7", + "type": "", + "value": "96" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "8686:1:7", + "nodeType": "YulLiteral", + "src": "8686:1:7", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "8682:3:7", + "nodeType": "YulIdentifier", + "src": "8682:3:7" + }, + "nativeSrc": "8682:6:7", + "nodeType": "YulFunctionCall", + "src": "8682:6:7" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "8674:3:7", + "nodeType": "YulIdentifier", + "src": "8674:3:7" + }, + "nativeSrc": "8674:15:7", + "nodeType": "YulFunctionCall", + "src": "8674:15:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "8666:3:7", + "nodeType": "YulIdentifier", + "src": "8666:3:7" + }, + "nativeSrc": "8666:24:7", + "nodeType": "YulFunctionCall", + "src": "8666:24:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8653:6:7", + "nodeType": "YulIdentifier", + "src": "8653:6:7" + }, + "nativeSrc": "8653:38:7", + "nodeType": "YulFunctionCall", + "src": "8653:38:7" + }, + "nativeSrc": "8653:38:7", + "nodeType": "YulExpressionStatement", + "src": "8653:38:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "8711:4:7", + "nodeType": "YulLiteral", + "src": "8711:4:7", + "type": "", + "value": "0x24" + }, + { + "name": "value", + "nativeSrc": "8717:5:7", + "nodeType": "YulIdentifier", + "src": "8717:5:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8704:6:7", + "nodeType": "YulIdentifier", + "src": "8704:6:7" + }, + "nativeSrc": "8704:19:7", + "nodeType": "YulFunctionCall", + "src": "8704:19:7" + }, + "nativeSrc": "8704:19:7", + "nodeType": "YulExpressionStatement", + "src": "8704:19:7" + }, + { + "nativeSrc": "8736:56:7", + "nodeType": "YulAssignment", + "src": "8736:56:7", + "value": { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "gas", + "nativeSrc": "8752:3:7", + "nodeType": "YulIdentifier", + "src": "8752:3:7" + }, + "nativeSrc": "8752:5:7", + "nodeType": "YulFunctionCall", + "src": "8752:5:7" + }, + { + "name": "token", + "nativeSrc": "8759:5:7", + "nodeType": "YulIdentifier", + "src": "8759:5:7" + }, + { + "kind": "number", + "nativeSrc": "8766:1:7", + "nodeType": "YulLiteral", + "src": "8766:1:7", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "8769:4:7", + "nodeType": "YulLiteral", + "src": "8769:4:7", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "8775:4:7", + "nodeType": "YulLiteral", + "src": "8775:4:7", + "type": "", + "value": "0x44" + }, + { + "kind": "number", + "nativeSrc": "8781:4:7", + "nodeType": "YulLiteral", + "src": "8781:4:7", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "8787:4:7", + "nodeType": "YulLiteral", + "src": "8787:4:7", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "call", + "nativeSrc": "8747:4:7", + "nodeType": "YulIdentifier", + "src": "8747:4:7" + }, + "nativeSrc": "8747:45:7", + "nodeType": "YulFunctionCall", + "src": "8747:45:7" + }, + "variableNames": [ + { + "name": "success", + "nativeSrc": "8736:7:7", + "nodeType": "YulIdentifier", + "src": "8736:7:7" + } + ] + }, + { + "body": { + "nativeSrc": "9009:562:7", + "nodeType": "YulBlock", + "src": "9009:562:7", + "statements": [ + { + "body": { + "nativeSrc": "9144:133:7", + "nodeType": "YulBlock", + "src": "9144:133:7", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "9181:3:7", + "nodeType": "YulIdentifier", + "src": "9181:3:7" + }, + { + "kind": "number", + "nativeSrc": "9186:4:7", + "nodeType": "YulLiteral", + "src": "9186:4:7", + "type": "", + "value": "0x00" + }, + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nativeSrc": "9192:14:7", + "nodeType": "YulIdentifier", + "src": "9192:14:7" + }, + "nativeSrc": "9192:16:7", + "nodeType": "YulFunctionCall", + "src": "9192:16:7" + } + ], + "functionName": { + "name": "returndatacopy", + "nativeSrc": "9166:14:7", + "nodeType": "YulIdentifier", + "src": "9166:14:7" + }, + "nativeSrc": "9166:43:7", + "nodeType": "YulFunctionCall", + "src": "9166:43:7" + }, + "nativeSrc": "9166:43:7", + "nodeType": "YulExpressionStatement", + "src": "9166:43:7" + }, + { + "expression": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "9237:3:7", + "nodeType": "YulIdentifier", + "src": "9237:3:7" + }, + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nativeSrc": "9242:14:7", + "nodeType": "YulIdentifier", + "src": "9242:14:7" + }, + "nativeSrc": "9242:16:7", + "nodeType": "YulFunctionCall", + "src": "9242:16:7" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "9230:6:7", + "nodeType": "YulIdentifier", + "src": "9230:6:7" + }, + "nativeSrc": "9230:29:7", + "nodeType": "YulFunctionCall", + "src": "9230:29:7" + }, + "nativeSrc": "9230:29:7", + "nodeType": "YulExpressionStatement", + "src": "9230:29:7" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "success", + "nativeSrc": "9126:7:7", + "nodeType": "YulIdentifier", + "src": "9126:7:7" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "9119:6:7", + "nodeType": "YulIdentifier", + "src": "9119:6:7" + }, + "nativeSrc": "9119:15:7", + "nodeType": "YulFunctionCall", + "src": "9119:15:7" + }, + { + "name": "bubble", + "nativeSrc": "9136:6:7", + "nodeType": "YulIdentifier", + "src": "9136:6:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "9115:3:7", + "nodeType": "YulIdentifier", + "src": "9115:3:7" + }, + "nativeSrc": "9115:28:7", + "nodeType": "YulFunctionCall", + "src": "9115:28:7" + }, + "nativeSrc": "9112:165:7", + "nodeType": "YulIf", + "src": "9112:165:7" + }, + { + "nativeSrc": "9476:81:7", + "nodeType": "YulAssignment", + "src": "9476:81:7", + "value": { + "arguments": [ + { + "name": "success", + "nativeSrc": "9491:7:7", + "nodeType": "YulIdentifier", + "src": "9491:7:7" + }, + { + "arguments": [ + { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nativeSrc": "9511:14:7", + "nodeType": "YulIdentifier", + "src": "9511:14:7" + }, + "nativeSrc": "9511:16:7", + "nodeType": "YulFunctionCall", + "src": "9511:16:7" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "9504:6:7", + "nodeType": "YulIdentifier", + "src": "9504:6:7" + }, + "nativeSrc": "9504:24:7", + "nodeType": "YulFunctionCall", + "src": "9504:24:7" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "token", + "nativeSrc": "9545:5:7", + "nodeType": "YulIdentifier", + "src": "9545:5:7" + } + ], + "functionName": { + "name": "extcodesize", + "nativeSrc": "9533:11:7", + "nodeType": "YulIdentifier", + "src": "9533:11:7" + }, + "nativeSrc": "9533:18:7", + "nodeType": "YulFunctionCall", + "src": "9533:18:7" + }, + { + "kind": "number", + "nativeSrc": "9553:1:7", + "nodeType": "YulLiteral", + "src": "9553:1:7", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "gt", + "nativeSrc": "9530:2:7", + "nodeType": "YulIdentifier", + "src": "9530:2:7" + }, + "nativeSrc": "9530:25:7", + "nodeType": "YulFunctionCall", + "src": "9530:25:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "9500:3:7", + "nodeType": "YulIdentifier", + "src": "9500:3:7" + }, + "nativeSrc": "9500:56:7", + "nodeType": "YulFunctionCall", + "src": "9500:56:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "9487:3:7", + "nodeType": "YulIdentifier", + "src": "9487:3:7" + }, + "nativeSrc": "9487:70:7", + "nodeType": "YulFunctionCall", + "src": "9487:70:7" + }, + "variableNames": [ + { + "name": "success", + "nativeSrc": "9476:7:7", + "nodeType": "YulIdentifier", + "src": "9476:7:7" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "success", + "nativeSrc": "8979:7:7", + "nodeType": "YulIdentifier", + "src": "8979:7:7" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "8997:4:7", + "nodeType": "YulLiteral", + "src": "8997:4:7", + "type": "", + "value": "0x00" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "8991:5:7", + "nodeType": "YulIdentifier", + "src": "8991:5:7" + }, + "nativeSrc": "8991:11:7", + "nodeType": "YulFunctionCall", + "src": "8991:11:7" + }, + { + "kind": "number", + "nativeSrc": "9004:1:7", + "nodeType": "YulLiteral", + "src": "9004:1:7", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "eq", + "nativeSrc": "8988:2:7", + "nodeType": "YulIdentifier", + "src": "8988:2:7" + }, + "nativeSrc": "8988:18:7", + "nodeType": "YulFunctionCall", + "src": "8988:18:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "8975:3:7", + "nodeType": "YulIdentifier", + "src": "8975:3:7" + }, + "nativeSrc": "8975:32:7", + "nodeType": "YulFunctionCall", + "src": "8975:32:7" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "8968:6:7", + "nodeType": "YulIdentifier", + "src": "8968:6:7" + }, + "nativeSrc": "8968:40:7", + "nodeType": "YulFunctionCall", + "src": "8968:40:7" + }, + "nativeSrc": "8965:606:7", + "nodeType": "YulIf", + "src": "8965:606:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9591:4:7", + "nodeType": "YulLiteral", + "src": "9591:4:7", + "type": "", + "value": "0x40" + }, + { + "name": "fmp", + "nativeSrc": "9597:3:7", + "nodeType": "YulIdentifier", + "src": "9597:3:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "9584:6:7", + "nodeType": "YulIdentifier", + "src": "9584:6:7" + }, + "nativeSrc": "9584:17:7", + "nodeType": "YulFunctionCall", + "src": "9584:17:7" + }, + "nativeSrc": "9584:17:7", + "nodeType": "YulExpressionStatement", + "src": "9584:17:7" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 769, + "isOffset": false, + "isSlot": false, + "src": "9136:6:7", + "valueSize": 1 + }, + { + "declaration": 775, + "isOffset": false, + "isSlot": false, + "src": "8631:8:7", + "valueSize": 1 + }, + { + "declaration": 772, + "isOffset": false, + "isSlot": false, + "src": "8736:7:7", + "valueSize": 1 + }, + { + "declaration": 772, + "isOffset": false, + "isSlot": false, + "src": "8979:7:7", + "valueSize": 1 + }, + { + "declaration": 772, + "isOffset": false, + "isSlot": false, + "src": "9126:7:7", + "valueSize": 1 + }, + { + "declaration": 772, + "isOffset": false, + "isSlot": false, + "src": "9476:7:7", + "valueSize": 1 + }, + { + "declaration": 772, + "isOffset": false, + "isSlot": false, + "src": "9491:7:7", + "valueSize": 1 + }, + { + "declaration": 765, + "isOffset": false, + "isSlot": false, + "src": "8670:2:7", + "valueSize": 1 + }, + { + "declaration": 763, + "isOffset": false, + "isSlot": false, + "src": "8759:5:7", + "valueSize": 1 + }, + { + "declaration": 763, + "isOffset": false, + "isSlot": false, + "src": "9545:5:7", + "valueSize": 1 + }, + { + "declaration": 767, + "isOffset": false, + "isSlot": false, + "src": "8717:5:7", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 780, + "nodeType": "InlineAssembly", + "src": "8544:1067:7" + } + ] + }, + "documentation": { + "id": 760, + "nodeType": "StructuredDocumentation", + "src": "7885:483:7", + "text": " @dev Imitates a Solidity `token.transfer(to, value)` call, relaxing the requirement on the return value: the\n return value is optional (but if data is returned, it must not be false).\n @param token The token targeted by the call.\n @param to The recipient of the tokens\n @param value The amount of token to transfer\n @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean." + }, + "id": 782, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_safeTransfer", + "nameLocation": "8382:13:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 770, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 763, + "mutability": "mutable", + "name": "token", + "nameLocation": "8403:5:7", + "nodeType": "VariableDeclaration", + "scope": 782, + "src": "8396:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 762, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 761, + "name": "IERC20", + "nameLocations": [ + "8396:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "8396:6:7" + }, + "referencedDeclaration": 340, + "src": "8396:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 765, + "mutability": "mutable", + "name": "to", + "nameLocation": "8418:2:7", + "nodeType": "VariableDeclaration", + "scope": 782, + "src": "8410:10:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 764, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "8410:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 767, + "mutability": "mutable", + "name": "value", + "nameLocation": "8430:5:7", + "nodeType": "VariableDeclaration", + "scope": 782, + "src": "8422:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 766, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8422:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 769, + "mutability": "mutable", + "name": "bubble", + "nameLocation": "8442:6:7", + "nodeType": "VariableDeclaration", + "scope": 782, + "src": "8437:11:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 768, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "8437:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "8395:54:7" + }, + "returnParameters": { + "id": 773, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 772, + "mutability": "mutable", + "name": "success", + "nameLocation": "8472:7:7", + "nodeType": "VariableDeclaration", + "scope": 782, + "src": "8467:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 771, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "8467:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "8466:14:7" + }, + "scope": 831, + "src": "8373:1244:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 806, + "nodeType": "Block", + "src": "10337:1221:7", + "statements": [ + { + "assignments": [ + 800 + ], + "declarations": [ + { + "constant": false, + "id": 800, + "mutability": "mutable", + "name": "selector", + "nameLocation": "10354:8:7", + "nodeType": "VariableDeclaration", + "scope": 806, + "src": "10347:15:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "typeName": { + "id": 799, + "name": "bytes4", + "nodeType": "ElementaryTypeName", + "src": "10347:6:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "visibility": "internal" + } + ], + "id": 804, + "initialValue": { + "expression": { + "expression": { + "id": 801, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "10365:6:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$340_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 802, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "10372:12:7", + "memberName": "transferFrom", + "nodeType": "MemberAccess", + "referencedDeclaration": 339, + "src": "10365:19:7", + "typeDescriptions": { + "typeIdentifier": "t_function_declaration_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$_t_bool_$", + "typeString": "function IERC20.transferFrom(address,address,uint256) returns (bool)" + } + }, + "id": 803, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "10385:8:7", + "memberName": "selector", + "nodeType": "MemberAccess", + "src": "10365:28:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "10347:46:7" + }, + { + "AST": { + "nativeSrc": "10429:1123:7", + "nodeType": "YulBlock", + "src": "10429:1123:7", + "statements": [ + { + "nativeSrc": "10443:22:7", + "nodeType": "YulVariableDeclaration", + "src": "10443:22:7", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10460:4:7", + "nodeType": "YulLiteral", + "src": "10460:4:7", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "10454:5:7", + "nodeType": "YulIdentifier", + "src": "10454:5:7" + }, + "nativeSrc": "10454:11:7", + "nodeType": "YulFunctionCall", + "src": "10454:11:7" + }, + "variables": [ + { + "name": "fmp", + "nativeSrc": "10447:3:7", + "nodeType": "YulTypedName", + "src": "10447:3:7", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10485:4:7", + "nodeType": "YulLiteral", + "src": "10485:4:7", + "type": "", + "value": "0x00" + }, + { + "name": "selector", + "nativeSrc": "10491:8:7", + "nodeType": "YulIdentifier", + "src": "10491:8:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10478:6:7", + "nodeType": "YulIdentifier", + "src": "10478:6:7" + }, + "nativeSrc": "10478:22:7", + "nodeType": "YulFunctionCall", + "src": "10478:22:7" + }, + "nativeSrc": "10478:22:7", + "nodeType": "YulExpressionStatement", + "src": "10478:22:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10520:4:7", + "nodeType": "YulLiteral", + "src": "10520:4:7", + "type": "", + "value": "0x04" + }, + { + "arguments": [ + { + "name": "from", + "nativeSrc": "10530:4:7", + "nodeType": "YulIdentifier", + "src": "10530:4:7" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10540:2:7", + "nodeType": "YulLiteral", + "src": "10540:2:7", + "type": "", + "value": "96" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10548:1:7", + "nodeType": "YulLiteral", + "src": "10548:1:7", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "10544:3:7", + "nodeType": "YulIdentifier", + "src": "10544:3:7" + }, + "nativeSrc": "10544:6:7", + "nodeType": "YulFunctionCall", + "src": "10544:6:7" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "10536:3:7", + "nodeType": "YulIdentifier", + "src": "10536:3:7" + }, + "nativeSrc": "10536:15:7", + "nodeType": "YulFunctionCall", + "src": "10536:15:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "10526:3:7", + "nodeType": "YulIdentifier", + "src": "10526:3:7" + }, + "nativeSrc": "10526:26:7", + "nodeType": "YulFunctionCall", + "src": "10526:26:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10513:6:7", + "nodeType": "YulIdentifier", + "src": "10513:6:7" + }, + "nativeSrc": "10513:40:7", + "nodeType": "YulFunctionCall", + "src": "10513:40:7" + }, + "nativeSrc": "10513:40:7", + "nodeType": "YulExpressionStatement", + "src": "10513:40:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10573:4:7", + "nodeType": "YulLiteral", + "src": "10573:4:7", + "type": "", + "value": "0x24" + }, + { + "arguments": [ + { + "name": "to", + "nativeSrc": "10583:2:7", + "nodeType": "YulIdentifier", + "src": "10583:2:7" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10591:2:7", + "nodeType": "YulLiteral", + "src": "10591:2:7", + "type": "", + "value": "96" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10599:1:7", + "nodeType": "YulLiteral", + "src": "10599:1:7", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "10595:3:7", + "nodeType": "YulIdentifier", + "src": "10595:3:7" + }, + "nativeSrc": "10595:6:7", + "nodeType": "YulFunctionCall", + "src": "10595:6:7" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "10587:3:7", + "nodeType": "YulIdentifier", + "src": "10587:3:7" + }, + "nativeSrc": "10587:15:7", + "nodeType": "YulFunctionCall", + "src": "10587:15:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "10579:3:7", + "nodeType": "YulIdentifier", + "src": "10579:3:7" + }, + "nativeSrc": "10579:24:7", + "nodeType": "YulFunctionCall", + "src": "10579:24:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10566:6:7", + "nodeType": "YulIdentifier", + "src": "10566:6:7" + }, + "nativeSrc": "10566:38:7", + "nodeType": "YulFunctionCall", + "src": "10566:38:7" + }, + "nativeSrc": "10566:38:7", + "nodeType": "YulExpressionStatement", + "src": "10566:38:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10624:4:7", + "nodeType": "YulLiteral", + "src": "10624:4:7", + "type": "", + "value": "0x44" + }, + { + "name": "value", + "nativeSrc": "10630:5:7", + "nodeType": "YulIdentifier", + "src": "10630:5:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10617:6:7", + "nodeType": "YulIdentifier", + "src": "10617:6:7" + }, + "nativeSrc": "10617:19:7", + "nodeType": "YulFunctionCall", + "src": "10617:19:7" + }, + "nativeSrc": "10617:19:7", + "nodeType": "YulExpressionStatement", + "src": "10617:19:7" + }, + { + "nativeSrc": "10649:56:7", + "nodeType": "YulAssignment", + "src": "10649:56:7", + "value": { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "gas", + "nativeSrc": "10665:3:7", + "nodeType": "YulIdentifier", + "src": "10665:3:7" + }, + "nativeSrc": "10665:5:7", + "nodeType": "YulFunctionCall", + "src": "10665:5:7" + }, + { + "name": "token", + "nativeSrc": "10672:5:7", + "nodeType": "YulIdentifier", + "src": "10672:5:7" + }, + { + "kind": "number", + "nativeSrc": "10679:1:7", + "nodeType": "YulLiteral", + "src": "10679:1:7", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "10682:4:7", + "nodeType": "YulLiteral", + "src": "10682:4:7", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "10688:4:7", + "nodeType": "YulLiteral", + "src": "10688:4:7", + "type": "", + "value": "0x64" + }, + { + "kind": "number", + "nativeSrc": "10694:4:7", + "nodeType": "YulLiteral", + "src": "10694:4:7", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "10700:4:7", + "nodeType": "YulLiteral", + "src": "10700:4:7", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "call", + "nativeSrc": "10660:4:7", + "nodeType": "YulIdentifier", + "src": "10660:4:7" + }, + "nativeSrc": "10660:45:7", + "nodeType": "YulFunctionCall", + "src": "10660:45:7" + }, + "variableNames": [ + { + "name": "success", + "nativeSrc": "10649:7:7", + "nodeType": "YulIdentifier", + "src": "10649:7:7" + } + ] + }, + { + "body": { + "nativeSrc": "10922:562:7", + "nodeType": "YulBlock", + "src": "10922:562:7", + "statements": [ + { + "body": { + "nativeSrc": "11057:133:7", + "nodeType": "YulBlock", + "src": "11057:133:7", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "11094:3:7", + "nodeType": "YulIdentifier", + "src": "11094:3:7" + }, + { + "kind": "number", + "nativeSrc": "11099:4:7", + "nodeType": "YulLiteral", + "src": "11099:4:7", + "type": "", + "value": "0x00" + }, + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nativeSrc": "11105:14:7", + "nodeType": "YulIdentifier", + "src": "11105:14:7" + }, + "nativeSrc": "11105:16:7", + "nodeType": "YulFunctionCall", + "src": "11105:16:7" + } + ], + "functionName": { + "name": "returndatacopy", + "nativeSrc": "11079:14:7", + "nodeType": "YulIdentifier", + "src": "11079:14:7" + }, + "nativeSrc": "11079:43:7", + "nodeType": "YulFunctionCall", + "src": "11079:43:7" + }, + "nativeSrc": "11079:43:7", + "nodeType": "YulExpressionStatement", + "src": "11079:43:7" + }, + { + "expression": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "11150:3:7", + "nodeType": "YulIdentifier", + "src": "11150:3:7" + }, + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nativeSrc": "11155:14:7", + "nodeType": "YulIdentifier", + "src": "11155:14:7" + }, + "nativeSrc": "11155:16:7", + "nodeType": "YulFunctionCall", + "src": "11155:16:7" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "11143:6:7", + "nodeType": "YulIdentifier", + "src": "11143:6:7" + }, + "nativeSrc": "11143:29:7", + "nodeType": "YulFunctionCall", + "src": "11143:29:7" + }, + "nativeSrc": "11143:29:7", + "nodeType": "YulExpressionStatement", + "src": "11143:29:7" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "success", + "nativeSrc": "11039:7:7", + "nodeType": "YulIdentifier", + "src": "11039:7:7" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "11032:6:7", + "nodeType": "YulIdentifier", + "src": "11032:6:7" + }, + "nativeSrc": "11032:15:7", + "nodeType": "YulFunctionCall", + "src": "11032:15:7" + }, + { + "name": "bubble", + "nativeSrc": "11049:6:7", + "nodeType": "YulIdentifier", + "src": "11049:6:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "11028:3:7", + "nodeType": "YulIdentifier", + "src": "11028:3:7" + }, + "nativeSrc": "11028:28:7", + "nodeType": "YulFunctionCall", + "src": "11028:28:7" + }, + "nativeSrc": "11025:165:7", + "nodeType": "YulIf", + "src": "11025:165:7" + }, + { + "nativeSrc": "11389:81:7", + "nodeType": "YulAssignment", + "src": "11389:81:7", + "value": { + "arguments": [ + { + "name": "success", + "nativeSrc": "11404:7:7", + "nodeType": "YulIdentifier", + "src": "11404:7:7" + }, + { + "arguments": [ + { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nativeSrc": "11424:14:7", + "nodeType": "YulIdentifier", + "src": "11424:14:7" + }, + "nativeSrc": "11424:16:7", + "nodeType": "YulFunctionCall", + "src": "11424:16:7" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "11417:6:7", + "nodeType": "YulIdentifier", + "src": "11417:6:7" + }, + "nativeSrc": "11417:24:7", + "nodeType": "YulFunctionCall", + "src": "11417:24:7" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "token", + "nativeSrc": "11458:5:7", + "nodeType": "YulIdentifier", + "src": "11458:5:7" + } + ], + "functionName": { + "name": "extcodesize", + "nativeSrc": "11446:11:7", + "nodeType": "YulIdentifier", + "src": "11446:11:7" + }, + "nativeSrc": "11446:18:7", + "nodeType": "YulFunctionCall", + "src": "11446:18:7" + }, + { + "kind": "number", + "nativeSrc": "11466:1:7", + "nodeType": "YulLiteral", + "src": "11466:1:7", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "gt", + "nativeSrc": "11443:2:7", + "nodeType": "YulIdentifier", + "src": "11443:2:7" + }, + "nativeSrc": "11443:25:7", + "nodeType": "YulFunctionCall", + "src": "11443:25:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "11413:3:7", + "nodeType": "YulIdentifier", + "src": "11413:3:7" + }, + "nativeSrc": "11413:56:7", + "nodeType": "YulFunctionCall", + "src": "11413:56:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "11400:3:7", + "nodeType": "YulIdentifier", + "src": "11400:3:7" + }, + "nativeSrc": "11400:70:7", + "nodeType": "YulFunctionCall", + "src": "11400:70:7" + }, + "variableNames": [ + { + "name": "success", + "nativeSrc": "11389:7:7", + "nodeType": "YulIdentifier", + "src": "11389:7:7" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "success", + "nativeSrc": "10892:7:7", + "nodeType": "YulIdentifier", + "src": "10892:7:7" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10910:4:7", + "nodeType": "YulLiteral", + "src": "10910:4:7", + "type": "", + "value": "0x00" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "10904:5:7", + "nodeType": "YulIdentifier", + "src": "10904:5:7" + }, + "nativeSrc": "10904:11:7", + "nodeType": "YulFunctionCall", + "src": "10904:11:7" + }, + { + "kind": "number", + "nativeSrc": "10917:1:7", + "nodeType": "YulLiteral", + "src": "10917:1:7", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "eq", + "nativeSrc": "10901:2:7", + "nodeType": "YulIdentifier", + "src": "10901:2:7" + }, + "nativeSrc": "10901:18:7", + "nodeType": "YulFunctionCall", + "src": "10901:18:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "10888:3:7", + "nodeType": "YulIdentifier", + "src": "10888:3:7" + }, + "nativeSrc": "10888:32:7", + "nodeType": "YulFunctionCall", + "src": "10888:32:7" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "10881:6:7", + "nodeType": "YulIdentifier", + "src": "10881:6:7" + }, + "nativeSrc": "10881:40:7", + "nodeType": "YulFunctionCall", + "src": "10881:40:7" + }, + "nativeSrc": "10878:606:7", + "nodeType": "YulIf", + "src": "10878:606:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11504:4:7", + "nodeType": "YulLiteral", + "src": "11504:4:7", + "type": "", + "value": "0x40" + }, + { + "name": "fmp", + "nativeSrc": "11510:3:7", + "nodeType": "YulIdentifier", + "src": "11510:3:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "11497:6:7", + "nodeType": "YulIdentifier", + "src": "11497:6:7" + }, + "nativeSrc": "11497:17:7", + "nodeType": "YulFunctionCall", + "src": "11497:17:7" + }, + "nativeSrc": "11497:17:7", + "nodeType": "YulExpressionStatement", + "src": "11497:17:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11534:4:7", + "nodeType": "YulLiteral", + "src": "11534:4:7", + "type": "", + "value": "0x60" + }, + { + "kind": "number", + "nativeSrc": "11540:1:7", + "nodeType": "YulLiteral", + "src": "11540:1:7", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "11527:6:7", + "nodeType": "YulIdentifier", + "src": "11527:6:7" + }, + "nativeSrc": "11527:15:7", + "nodeType": "YulFunctionCall", + "src": "11527:15:7" + }, + "nativeSrc": "11527:15:7", + "nodeType": "YulExpressionStatement", + "src": "11527:15:7" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 794, + "isOffset": false, + "isSlot": false, + "src": "11049:6:7", + "valueSize": 1 + }, + { + "declaration": 788, + "isOffset": false, + "isSlot": false, + "src": "10530:4:7", + "valueSize": 1 + }, + { + "declaration": 800, + "isOffset": false, + "isSlot": false, + "src": "10491:8:7", + "valueSize": 1 + }, + { + "declaration": 797, + "isOffset": false, + "isSlot": false, + "src": "10649:7:7", + "valueSize": 1 + }, + { + "declaration": 797, + "isOffset": false, + "isSlot": false, + "src": "10892:7:7", + "valueSize": 1 + }, + { + "declaration": 797, + "isOffset": false, + "isSlot": false, + "src": "11039:7:7", + "valueSize": 1 + }, + { + "declaration": 797, + "isOffset": false, + "isSlot": false, + "src": "11389:7:7", + "valueSize": 1 + }, + { + "declaration": 797, + "isOffset": false, + "isSlot": false, + "src": "11404:7:7", + "valueSize": 1 + }, + { + "declaration": 790, + "isOffset": false, + "isSlot": false, + "src": "10583:2:7", + "valueSize": 1 + }, + { + "declaration": 786, + "isOffset": false, + "isSlot": false, + "src": "10672:5:7", + "valueSize": 1 + }, + { + "declaration": 786, + "isOffset": false, + "isSlot": false, + "src": "11458:5:7", + "valueSize": 1 + }, + { + "declaration": 792, + "isOffset": false, + "isSlot": false, + "src": "10630:5:7", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 805, + "nodeType": "InlineAssembly", + "src": "10404:1148:7" + } + ] + }, + "documentation": { + "id": 783, + "nodeType": "StructuredDocumentation", + "src": "9623:537:7", + "text": " @dev Imitates a Solidity `token.transferFrom(from, to, value)` call, relaxing the requirement on the return\n value: the return value is optional (but if data is returned, it must not be false).\n @param token The token targeted by the call.\n @param from The sender of the tokens\n @param to The recipient of the tokens\n @param value The amount of token to transfer\n @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean." + }, + "id": 807, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_safeTransferFrom", + "nameLocation": "10174:17:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 795, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 786, + "mutability": "mutable", + "name": "token", + "nameLocation": "10208:5:7", + "nodeType": "VariableDeclaration", + "scope": 807, + "src": "10201:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 785, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 784, + "name": "IERC20", + "nameLocations": [ + "10201:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "10201:6:7" + }, + "referencedDeclaration": 340, + "src": "10201:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 788, + "mutability": "mutable", + "name": "from", + "nameLocation": "10231:4:7", + "nodeType": "VariableDeclaration", + "scope": 807, + "src": "10223:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 787, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "10223:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 790, + "mutability": "mutable", + "name": "to", + "nameLocation": "10253:2:7", + "nodeType": "VariableDeclaration", + "scope": 807, + "src": "10245:10:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 789, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "10245:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 792, + "mutability": "mutable", + "name": "value", + "nameLocation": "10273:5:7", + "nodeType": "VariableDeclaration", + "scope": 807, + "src": "10265:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 791, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10265:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 794, + "mutability": "mutable", + "name": "bubble", + "nameLocation": "10293:6:7", + "nodeType": "VariableDeclaration", + "scope": 807, + "src": "10288:11:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 793, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "10288:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "10191:114:7" + }, + "returnParameters": { + "id": 798, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 797, + "mutability": "mutable", + "name": "success", + "nameLocation": "10328:7:7", + "nodeType": "VariableDeclaration", + "scope": 807, + "src": "10323:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 796, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "10323:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "10322:14:7" + }, + "scope": 831, + "src": "10165:1393:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 829, + "nodeType": "Block", + "src": "12171:1140:7", + "statements": [ + { + "assignments": [ + 823 + ], + "declarations": [ + { + "constant": false, + "id": 823, + "mutability": "mutable", + "name": "selector", + "nameLocation": "12188:8:7", + "nodeType": "VariableDeclaration", + "scope": 829, + "src": "12181:15:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "typeName": { + "id": 822, + "name": "bytes4", + "nodeType": "ElementaryTypeName", + "src": "12181:6:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "visibility": "internal" + } + ], + "id": 827, + "initialValue": { + "expression": { + "expression": { + "id": 824, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "12199:6:7", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$340_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 825, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "12206:7:7", + "memberName": "approve", + "nodeType": "MemberAccess", + "referencedDeclaration": 327, + "src": "12199:14:7", + "typeDescriptions": { + "typeIdentifier": "t_function_declaration_nonpayable$_t_address_$_t_uint256_$returns$_t_bool_$", + "typeString": "function IERC20.approve(address,uint256) returns (bool)" + } + }, + "id": 826, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "12214:8:7", + "memberName": "selector", + "nodeType": "MemberAccess", + "src": "12199:23:7", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "12181:41:7" + }, + { + "AST": { + "nativeSrc": "12258:1047:7", + "nodeType": "YulBlock", + "src": "12258:1047:7", + "statements": [ + { + "nativeSrc": "12272:22:7", + "nodeType": "YulVariableDeclaration", + "src": "12272:22:7", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "12289:4:7", + "nodeType": "YulLiteral", + "src": "12289:4:7", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "12283:5:7", + "nodeType": "YulIdentifier", + "src": "12283:5:7" + }, + "nativeSrc": "12283:11:7", + "nodeType": "YulFunctionCall", + "src": "12283:11:7" + }, + "variables": [ + { + "name": "fmp", + "nativeSrc": "12276:3:7", + "nodeType": "YulTypedName", + "src": "12276:3:7", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "12314:4:7", + "nodeType": "YulLiteral", + "src": "12314:4:7", + "type": "", + "value": "0x00" + }, + { + "name": "selector", + "nativeSrc": "12320:8:7", + "nodeType": "YulIdentifier", + "src": "12320:8:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "12307:6:7", + "nodeType": "YulIdentifier", + "src": "12307:6:7" + }, + "nativeSrc": "12307:22:7", + "nodeType": "YulFunctionCall", + "src": "12307:22:7" + }, + "nativeSrc": "12307:22:7", + "nodeType": "YulExpressionStatement", + "src": "12307:22:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "12349:4:7", + "nodeType": "YulLiteral", + "src": "12349:4:7", + "type": "", + "value": "0x04" + }, + { + "arguments": [ + { + "name": "spender", + "nativeSrc": "12359:7:7", + "nodeType": "YulIdentifier", + "src": "12359:7:7" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "12372:2:7", + "nodeType": "YulLiteral", + "src": "12372:2:7", + "type": "", + "value": "96" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "12380:1:7", + "nodeType": "YulLiteral", + "src": "12380:1:7", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "12376:3:7", + "nodeType": "YulIdentifier", + "src": "12376:3:7" + }, + "nativeSrc": "12376:6:7", + "nodeType": "YulFunctionCall", + "src": "12376:6:7" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "12368:3:7", + "nodeType": "YulIdentifier", + "src": "12368:3:7" + }, + "nativeSrc": "12368:15:7", + "nodeType": "YulFunctionCall", + "src": "12368:15:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "12355:3:7", + "nodeType": "YulIdentifier", + "src": "12355:3:7" + }, + "nativeSrc": "12355:29:7", + "nodeType": "YulFunctionCall", + "src": "12355:29:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "12342:6:7", + "nodeType": "YulIdentifier", + "src": "12342:6:7" + }, + "nativeSrc": "12342:43:7", + "nodeType": "YulFunctionCall", + "src": "12342:43:7" + }, + "nativeSrc": "12342:43:7", + "nodeType": "YulExpressionStatement", + "src": "12342:43:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "12405:4:7", + "nodeType": "YulLiteral", + "src": "12405:4:7", + "type": "", + "value": "0x24" + }, + { + "name": "value", + "nativeSrc": "12411:5:7", + "nodeType": "YulIdentifier", + "src": "12411:5:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "12398:6:7", + "nodeType": "YulIdentifier", + "src": "12398:6:7" + }, + "nativeSrc": "12398:19:7", + "nodeType": "YulFunctionCall", + "src": "12398:19:7" + }, + "nativeSrc": "12398:19:7", + "nodeType": "YulExpressionStatement", + "src": "12398:19:7" + }, + { + "nativeSrc": "12430:56:7", + "nodeType": "YulAssignment", + "src": "12430:56:7", + "value": { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "gas", + "nativeSrc": "12446:3:7", + "nodeType": "YulIdentifier", + "src": "12446:3:7" + }, + "nativeSrc": "12446:5:7", + "nodeType": "YulFunctionCall", + "src": "12446:5:7" + }, + { + "name": "token", + "nativeSrc": "12453:5:7", + "nodeType": "YulIdentifier", + "src": "12453:5:7" + }, + { + "kind": "number", + "nativeSrc": "12460:1:7", + "nodeType": "YulLiteral", + "src": "12460:1:7", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "12463:4:7", + "nodeType": "YulLiteral", + "src": "12463:4:7", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "12469:4:7", + "nodeType": "YulLiteral", + "src": "12469:4:7", + "type": "", + "value": "0x44" + }, + { + "kind": "number", + "nativeSrc": "12475:4:7", + "nodeType": "YulLiteral", + "src": "12475:4:7", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "12481:4:7", + "nodeType": "YulLiteral", + "src": "12481:4:7", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "call", + "nativeSrc": "12441:4:7", + "nodeType": "YulIdentifier", + "src": "12441:4:7" + }, + "nativeSrc": "12441:45:7", + "nodeType": "YulFunctionCall", + "src": "12441:45:7" + }, + "variableNames": [ + { + "name": "success", + "nativeSrc": "12430:7:7", + "nodeType": "YulIdentifier", + "src": "12430:7:7" + } + ] + }, + { + "body": { + "nativeSrc": "12703:562:7", + "nodeType": "YulBlock", + "src": "12703:562:7", + "statements": [ + { + "body": { + "nativeSrc": "12838:133:7", + "nodeType": "YulBlock", + "src": "12838:133:7", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "12875:3:7", + "nodeType": "YulIdentifier", + "src": "12875:3:7" + }, + { + "kind": "number", + "nativeSrc": "12880:4:7", + "nodeType": "YulLiteral", + "src": "12880:4:7", + "type": "", + "value": "0x00" + }, + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nativeSrc": "12886:14:7", + "nodeType": "YulIdentifier", + "src": "12886:14:7" + }, + "nativeSrc": "12886:16:7", + "nodeType": "YulFunctionCall", + "src": "12886:16:7" + } + ], + "functionName": { + "name": "returndatacopy", + "nativeSrc": "12860:14:7", + "nodeType": "YulIdentifier", + "src": "12860:14:7" + }, + "nativeSrc": "12860:43:7", + "nodeType": "YulFunctionCall", + "src": "12860:43:7" + }, + "nativeSrc": "12860:43:7", + "nodeType": "YulExpressionStatement", + "src": "12860:43:7" + }, + { + "expression": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "12931:3:7", + "nodeType": "YulIdentifier", + "src": "12931:3:7" + }, + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nativeSrc": "12936:14:7", + "nodeType": "YulIdentifier", + "src": "12936:14:7" + }, + "nativeSrc": "12936:16:7", + "nodeType": "YulFunctionCall", + "src": "12936:16:7" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "12924:6:7", + "nodeType": "YulIdentifier", + "src": "12924:6:7" + }, + "nativeSrc": "12924:29:7", + "nodeType": "YulFunctionCall", + "src": "12924:29:7" + }, + "nativeSrc": "12924:29:7", + "nodeType": "YulExpressionStatement", + "src": "12924:29:7" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "success", + "nativeSrc": "12820:7:7", + "nodeType": "YulIdentifier", + "src": "12820:7:7" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "12813:6:7", + "nodeType": "YulIdentifier", + "src": "12813:6:7" + }, + "nativeSrc": "12813:15:7", + "nodeType": "YulFunctionCall", + "src": "12813:15:7" + }, + { + "name": "bubble", + "nativeSrc": "12830:6:7", + "nodeType": "YulIdentifier", + "src": "12830:6:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "12809:3:7", + "nodeType": "YulIdentifier", + "src": "12809:3:7" + }, + "nativeSrc": "12809:28:7", + "nodeType": "YulFunctionCall", + "src": "12809:28:7" + }, + "nativeSrc": "12806:165:7", + "nodeType": "YulIf", + "src": "12806:165:7" + }, + { + "nativeSrc": "13170:81:7", + "nodeType": "YulAssignment", + "src": "13170:81:7", + "value": { + "arguments": [ + { + "name": "success", + "nativeSrc": "13185:7:7", + "nodeType": "YulIdentifier", + "src": "13185:7:7" + }, + { + "arguments": [ + { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nativeSrc": "13205:14:7", + "nodeType": "YulIdentifier", + "src": "13205:14:7" + }, + "nativeSrc": "13205:16:7", + "nodeType": "YulFunctionCall", + "src": "13205:16:7" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "13198:6:7", + "nodeType": "YulIdentifier", + "src": "13198:6:7" + }, + "nativeSrc": "13198:24:7", + "nodeType": "YulFunctionCall", + "src": "13198:24:7" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "token", + "nativeSrc": "13239:5:7", + "nodeType": "YulIdentifier", + "src": "13239:5:7" + } + ], + "functionName": { + "name": "extcodesize", + "nativeSrc": "13227:11:7", + "nodeType": "YulIdentifier", + "src": "13227:11:7" + }, + "nativeSrc": "13227:18:7", + "nodeType": "YulFunctionCall", + "src": "13227:18:7" + }, + { + "kind": "number", + "nativeSrc": "13247:1:7", + "nodeType": "YulLiteral", + "src": "13247:1:7", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "gt", + "nativeSrc": "13224:2:7", + "nodeType": "YulIdentifier", + "src": "13224:2:7" + }, + "nativeSrc": "13224:25:7", + "nodeType": "YulFunctionCall", + "src": "13224:25:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "13194:3:7", + "nodeType": "YulIdentifier", + "src": "13194:3:7" + }, + "nativeSrc": "13194:56:7", + "nodeType": "YulFunctionCall", + "src": "13194:56:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "13181:3:7", + "nodeType": "YulIdentifier", + "src": "13181:3:7" + }, + "nativeSrc": "13181:70:7", + "nodeType": "YulFunctionCall", + "src": "13181:70:7" + }, + "variableNames": [ + { + "name": "success", + "nativeSrc": "13170:7:7", + "nodeType": "YulIdentifier", + "src": "13170:7:7" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "success", + "nativeSrc": "12673:7:7", + "nodeType": "YulIdentifier", + "src": "12673:7:7" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "12691:4:7", + "nodeType": "YulLiteral", + "src": "12691:4:7", + "type": "", + "value": "0x00" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "12685:5:7", + "nodeType": "YulIdentifier", + "src": "12685:5:7" + }, + "nativeSrc": "12685:11:7", + "nodeType": "YulFunctionCall", + "src": "12685:11:7" + }, + { + "kind": "number", + "nativeSrc": "12698:1:7", + "nodeType": "YulLiteral", + "src": "12698:1:7", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "eq", + "nativeSrc": "12682:2:7", + "nodeType": "YulIdentifier", + "src": "12682:2:7" + }, + "nativeSrc": "12682:18:7", + "nodeType": "YulFunctionCall", + "src": "12682:18:7" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "12669:3:7", + "nodeType": "YulIdentifier", + "src": "12669:3:7" + }, + "nativeSrc": "12669:32:7", + "nodeType": "YulFunctionCall", + "src": "12669:32:7" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "12662:6:7", + "nodeType": "YulIdentifier", + "src": "12662:6:7" + }, + "nativeSrc": "12662:40:7", + "nodeType": "YulFunctionCall", + "src": "12662:40:7" + }, + "nativeSrc": "12659:606:7", + "nodeType": "YulIf", + "src": "12659:606:7" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "13285:4:7", + "nodeType": "YulLiteral", + "src": "13285:4:7", + "type": "", + "value": "0x40" + }, + { + "name": "fmp", + "nativeSrc": "13291:3:7", + "nodeType": "YulIdentifier", + "src": "13291:3:7" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "13278:6:7", + "nodeType": "YulIdentifier", + "src": "13278:6:7" + }, + "nativeSrc": "13278:17:7", + "nodeType": "YulFunctionCall", + "src": "13278:17:7" + }, + "nativeSrc": "13278:17:7", + "nodeType": "YulExpressionStatement", + "src": "13278:17:7" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 817, + "isOffset": false, + "isSlot": false, + "src": "12830:6:7", + "valueSize": 1 + }, + { + "declaration": 823, + "isOffset": false, + "isSlot": false, + "src": "12320:8:7", + "valueSize": 1 + }, + { + "declaration": 813, + "isOffset": false, + "isSlot": false, + "src": "12359:7:7", + "valueSize": 1 + }, + { + "declaration": 820, + "isOffset": false, + "isSlot": false, + "src": "12430:7:7", + "valueSize": 1 + }, + { + "declaration": 820, + "isOffset": false, + "isSlot": false, + "src": "12673:7:7", + "valueSize": 1 + }, + { + "declaration": 820, + "isOffset": false, + "isSlot": false, + "src": "12820:7:7", + "valueSize": 1 + }, + { + "declaration": 820, + "isOffset": false, + "isSlot": false, + "src": "13170:7:7", + "valueSize": 1 + }, + { + "declaration": 820, + "isOffset": false, + "isSlot": false, + "src": "13185:7:7", + "valueSize": 1 + }, + { + "declaration": 811, + "isOffset": false, + "isSlot": false, + "src": "12453:5:7", + "valueSize": 1 + }, + { + "declaration": 811, + "isOffset": false, + "isSlot": false, + "src": "13239:5:7", + "valueSize": 1 + }, + { + "declaration": 815, + "isOffset": false, + "isSlot": false, + "src": "12411:5:7", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 828, + "nodeType": "InlineAssembly", + "src": "12233:1072:7" + } + ] + }, + "documentation": { + "id": 808, + "nodeType": "StructuredDocumentation", + "src": "11564:490:7", + "text": " @dev Imitates a Solidity `token.approve(spender, value)` call, relaxing the requirement on the return value:\n the return value is optional (but if data is returned, it must not be false).\n @param token The token targeted by the call.\n @param spender The spender of the tokens\n @param value The amount of token to transfer\n @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean." + }, + "id": 830, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_safeApprove", + "nameLocation": "12068:12:7", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 818, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 811, + "mutability": "mutable", + "name": "token", + "nameLocation": "12088:5:7", + "nodeType": "VariableDeclaration", + "scope": 830, + "src": "12081:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 810, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 809, + "name": "IERC20", + "nameLocations": [ + "12081:6:7" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "12081:6:7" + }, + "referencedDeclaration": 340, + "src": "12081:6:7", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 813, + "mutability": "mutable", + "name": "spender", + "nameLocation": "12103:7:7", + "nodeType": "VariableDeclaration", + "scope": 830, + "src": "12095:15:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 812, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "12095:7:7", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 815, + "mutability": "mutable", + "name": "value", + "nameLocation": "12120:5:7", + "nodeType": "VariableDeclaration", + "scope": 830, + "src": "12112:13:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 814, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12112:7:7", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 817, + "mutability": "mutable", + "name": "bubble", + "nameLocation": "12132:6:7", + "nodeType": "VariableDeclaration", + "scope": 830, + "src": "12127:11:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 816, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "12127:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "12080:59:7" + }, + "returnParameters": { + "id": 821, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 820, + "mutability": "mutable", + "name": "success", + "nameLocation": "12162:7:7", + "nodeType": "VariableDeclaration", + "scope": 830, + "src": "12157:12:7", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 819, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "12157:4:7", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "12156:14:7" + }, + "scope": 831, + "src": "12059:1252:7", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "private" + } + ], + "scope": 832, + "src": "698:12615:7", + "usedErrors": [ + 388, + 397 + ], + "usedEvents": [] + } + ], + "src": "115:13199:7" + }, + "id": 7 + }, + "@openzeppelin/contracts/utils/Bytes.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/Bytes.sol", + "exportedSymbols": { + "Bytes": [ + 1632 + ], + "Math": [ + 6204 + ] + }, + "id": 1633, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 833, + "literals": [ + "solidity", + "^", + "0.8", + ".24" + ], + "nodeType": "PragmaDirective", + "src": "99:24:8" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/math/Math.sol", + "file": "./math/Math.sol", + "id": 835, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 1633, + "sourceUnit": 6205, + "src": "125:37:8", + "symbolAliases": [ + { + "foreign": { + "id": 834, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "133:4:8", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "Bytes", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 836, + "nodeType": "StructuredDocumentation", + "src": "164:33:8", + "text": " @dev Bytes operations." + }, + "fullyImplemented": true, + "id": 1632, + "linearizedBaseContracts": [ + 1632 + ], + "name": "Bytes", + "nameLocation": "206:5:8", + "nodeType": "ContractDefinition", + "nodes": [ + { + "body": { + "id": 852, + "nodeType": "Block", + "src": "687:45:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 847, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 839, + "src": "712:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 848, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 841, + "src": "720:1:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + { + "hexValue": "30", + "id": 849, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "723:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 846, + "name": "indexOf", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 853, + 902 + ], + "referencedDeclaration": 902, + "src": "704:7:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_bytes1_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bytes memory,bytes1,uint256) pure returns (uint256)" + } + }, + "id": 850, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "704:21:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 845, + "id": 851, + "nodeType": "Return", + "src": "697:28:8" + } + ] + }, + "documentation": { + "id": 837, + "nodeType": "StructuredDocumentation", + "src": "218:384:8", + "text": " @dev Forward search for `s` in `buffer`\n * If `s` is present in the buffer, returns the index of the first instance\n * If `s` is not present in the buffer, returns type(uint256).max\n NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf[Javascript's `Array.indexOf`]" + }, + "id": 853, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "indexOf", + "nameLocation": "616:7:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 842, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 839, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "637:6:8", + "nodeType": "VariableDeclaration", + "scope": 853, + "src": "624:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 838, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "624:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 841, + "mutability": "mutable", + "name": "s", + "nameLocation": "652:1:8", + "nodeType": "VariableDeclaration", + "scope": 853, + "src": "645:8:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 840, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "645:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + } + ], + "src": "623:31:8" + }, + "returnParameters": { + "id": 845, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 844, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 853, + "src": "678:7:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 843, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "678:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "677:9:8" + }, + "scope": 1632, + "src": "607:125:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 901, + "nodeType": "Block", + "src": "1286:246:8", + "statements": [ + { + "assignments": [ + 866 + ], + "declarations": [ + { + "constant": false, + "id": 866, + "mutability": "mutable", + "name": "length", + "nameLocation": "1304:6:8", + "nodeType": "VariableDeclaration", + "scope": 901, + "src": "1296:14:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 865, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1296:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 869, + "initialValue": { + "expression": { + "id": 867, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 856, + "src": "1313:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 868, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "1320:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "1313:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1296:30:8" + }, + { + "body": { + "id": 893, + "nodeType": "Block", + "src": "1375:117:8", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "id": 888, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "arguments": [ + { + "id": 883, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 856, + "src": "1423:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 884, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 871, + "src": "1431:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 882, + "name": "_unsafeReadBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1631, + "src": "1400:22:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (bytes memory,uint256) pure returns (bytes32)" + } + }, + "id": 885, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1400:33:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 881, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1393:6:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 880, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "1393:6:8", + "typeDescriptions": {} + } + }, + "id": 886, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1393:41:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 887, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 858, + "src": "1438:1:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "src": "1393:46:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 892, + "nodeType": "IfStatement", + "src": "1389:93:8", + "trueBody": { + "id": 891, + "nodeType": "Block", + "src": "1441:41:8", + "statements": [ + { + "expression": { + "id": 889, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 871, + "src": "1466:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 864, + "id": 890, + "nodeType": "Return", + "src": "1459:8:8" + } + ] + } + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 876, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 874, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 871, + "src": "1358:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 875, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 866, + "src": "1362:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1358:10:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 894, + "initializationExpression": { + "assignments": [ + 871 + ], + "declarations": [ + { + "constant": false, + "id": 871, + "mutability": "mutable", + "name": "i", + "nameLocation": "1349:1:8", + "nodeType": "VariableDeclaration", + "scope": 894, + "src": "1341:9:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 870, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1341:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 873, + "initialValue": { + "id": 872, + "name": "pos", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 860, + "src": "1353:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1341:15:8" + }, + "isSimpleCounterLoop": true, + "loopExpression": { + "expression": { + "id": 878, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": true, + "src": "1370:3:8", + "subExpression": { + "id": 877, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 871, + "src": "1372:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 879, + "nodeType": "ExpressionStatement", + "src": "1370:3:8" + }, + "nodeType": "ForStatement", + "src": "1336:156:8" + }, + { + "expression": { + "expression": { + "arguments": [ + { + "id": 897, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1513:7:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 896, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1513:7:8", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + } + ], + "id": 895, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "1508:4:8", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 898, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1508:13:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint256", + "typeString": "type(uint256)" + } + }, + "id": 899, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "1522:3:8", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "1508:17:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 864, + "id": 900, + "nodeType": "Return", + "src": "1501:24:8" + } + ] + }, + "documentation": { + "id": 854, + "nodeType": "StructuredDocumentation", + "src": "738:450:8", + "text": " @dev Forward search for `s` in `buffer` starting at position `pos`\n * If `s` is present in the buffer (at or after `pos`), returns the index of the next instance\n * If `s` is not present in the buffer (at or after `pos`), returns type(uint256).max\n NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf[Javascript's `Array.indexOf`]" + }, + "id": 902, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "indexOf", + "nameLocation": "1202:7:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 861, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 856, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "1223:6:8", + "nodeType": "VariableDeclaration", + "scope": 902, + "src": "1210:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 855, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1210:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 858, + "mutability": "mutable", + "name": "s", + "nameLocation": "1238:1:8", + "nodeType": "VariableDeclaration", + "scope": 902, + "src": "1231:8:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 857, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "1231:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 860, + "mutability": "mutable", + "name": "pos", + "nameLocation": "1249:3:8", + "nodeType": "VariableDeclaration", + "scope": 902, + "src": "1241:11:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 859, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1241:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1209:44:8" + }, + "returnParameters": { + "id": 864, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 863, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 902, + "src": "1277:7:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 862, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1277:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1276:9:8" + }, + "scope": 1632, + "src": "1193:339:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 922, + "nodeType": "Block", + "src": "2019:65:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 913, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 905, + "src": "2048:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 914, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 907, + "src": "2056:1:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + { + "expression": { + "arguments": [ + { + "id": 917, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2064:7:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 916, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2064:7:8", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + } + ], + "id": 915, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "2059:4:8", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 918, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2059:13:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint256", + "typeString": "type(uint256)" + } + }, + "id": 919, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "2073:3:8", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "2059:17:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 912, + "name": "lastIndexOf", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 923, + 985 + ], + "referencedDeclaration": 985, + "src": "2036:11:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_bytes1_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bytes memory,bytes1,uint256) pure returns (uint256)" + } + }, + "id": 920, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2036:41:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 911, + "id": 921, + "nodeType": "Return", + "src": "2029:48:8" + } + ] + }, + "documentation": { + "id": 903, + "nodeType": "StructuredDocumentation", + "src": "1538:392:8", + "text": " @dev Backward search for `s` in `buffer`\n * If `s` is present in the buffer, returns the index of the last instance\n * If `s` is not present in the buffer, returns type(uint256).max\n NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf[Javascript's `Array.lastIndexOf`]" + }, + "id": 923, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "lastIndexOf", + "nameLocation": "1944:11:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 908, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 905, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "1969:6:8", + "nodeType": "VariableDeclaration", + "scope": 923, + "src": "1956:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 904, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1956:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 907, + "mutability": "mutable", + "name": "s", + "nameLocation": "1984:1:8", + "nodeType": "VariableDeclaration", + "scope": 923, + "src": "1977:8:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 906, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "1977:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + } + ], + "src": "1955:31:8" + }, + "returnParameters": { + "id": 911, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 910, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 923, + "src": "2010:7:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 909, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2010:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2009:9:8" + }, + "scope": 1632, + "src": "1935:149:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 984, + "nodeType": "Block", + "src": "2657:348:8", + "statements": [ + { + "id": 983, + "nodeType": "UncheckedBlock", + "src": "2667:332:8", + "statements": [ + { + "assignments": [ + 936 + ], + "declarations": [ + { + "constant": false, + "id": 936, + "mutability": "mutable", + "name": "length", + "nameLocation": "2699:6:8", + "nodeType": "VariableDeclaration", + "scope": 983, + "src": "2691:14:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 935, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2691:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 939, + "initialValue": { + "expression": { + "id": 937, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 926, + "src": "2708:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 938, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2715:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "2708:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2691:30:8" + }, + { + "body": { + "id": 975, + "nodeType": "Block", + "src": "2810:141:8", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "id": 968, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "arguments": [ + { + "id": 961, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 926, + "src": "2862:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 964, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 962, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 941, + "src": "2870:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "hexValue": "31", + "id": 963, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2874:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "2870:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 960, + "name": "_unsafeReadBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1631, + "src": "2839:22:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (bytes memory,uint256) pure returns (bytes32)" + } + }, + "id": 965, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2839:37:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 959, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2832:6:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 958, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "2832:6:8", + "typeDescriptions": {} + } + }, + "id": 966, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2832:45:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 967, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 928, + "src": "2881:1:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "src": "2832:50:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 974, + "nodeType": "IfStatement", + "src": "2828:109:8", + "trueBody": { + "id": 973, + "nodeType": "Block", + "src": "2884:53:8", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 971, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 969, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 941, + "src": "2913:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "hexValue": "31", + "id": 970, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2917:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "2913:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 934, + "id": 972, + "nodeType": "Return", + "src": "2906:12:8" + } + ] + } + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 954, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 952, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 941, + "src": "2798:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 953, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2802:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "2798:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 976, + "initializationExpression": { + "assignments": [ + 941 + ], + "declarations": [ + { + "constant": false, + "id": 941, + "mutability": "mutable", + "name": "i", + "nameLocation": "2748:1:8", + "nodeType": "VariableDeclaration", + "scope": 976, + "src": "2740:9:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 940, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2740:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 951, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "id": 946, + "name": "pos", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 930, + "src": "2780:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "31", + "id": 947, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2785:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + } + ], + "expression": { + "id": 944, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "2761:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 945, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2766:13:8", + "memberName": "saturatingAdd", + "nodeType": "MemberAccess", + "referencedDeclaration": 4759, + "src": "2761:18:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 948, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2761:26:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 949, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 936, + "src": "2789:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 942, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "2752:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 943, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2757:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "2752:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 950, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2752:44:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2740:56:8" + }, + "isSimpleCounterLoop": false, + "loopExpression": { + "expression": { + "id": 956, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "--", + "prefix": true, + "src": "2805:3:8", + "subExpression": { + "id": 955, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 941, + "src": "2807:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 957, + "nodeType": "ExpressionStatement", + "src": "2805:3:8" + }, + "nodeType": "ForStatement", + "src": "2735:216:8" + }, + { + "expression": { + "expression": { + "arguments": [ + { + "id": 979, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2976:7:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 978, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2976:7:8", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + } + ], + "id": 977, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "2971:4:8", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 980, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2971:13:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint256", + "typeString": "type(uint256)" + } + }, + "id": 981, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "2985:3:8", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "2971:17:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 934, + "id": 982, + "nodeType": "Return", + "src": "2964:24:8" + } + ] + } + ] + }, + "documentation": { + "id": 924, + "nodeType": "StructuredDocumentation", + "src": "2090:465:8", + "text": " @dev Backward search for `s` in `buffer` starting at position `pos`\n * If `s` is present in the buffer (at or before `pos`), returns the index of the previous instance\n * If `s` is not present in the buffer (at or before `pos`), returns type(uint256).max\n NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf[Javascript's `Array.lastIndexOf`]" + }, + "id": 985, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "lastIndexOf", + "nameLocation": "2569:11:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 931, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 926, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "2594:6:8", + "nodeType": "VariableDeclaration", + "scope": 985, + "src": "2581:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 925, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2581:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 928, + "mutability": "mutable", + "name": "s", + "nameLocation": "2609:1:8", + "nodeType": "VariableDeclaration", + "scope": 985, + "src": "2602:8:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 927, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "2602:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 930, + "mutability": "mutable", + "name": "pos", + "nameLocation": "2620:3:8", + "nodeType": "VariableDeclaration", + "scope": 985, + "src": "2612:11:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 929, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2612:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2580:44:8" + }, + "returnParameters": { + "id": 934, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 933, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 985, + "src": "2648:7:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 932, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2648:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2647:9:8" + }, + "scope": 1632, + "src": "2560:445:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1002, + "nodeType": "Block", + "src": "3416:59:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 996, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 988, + "src": "3439:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 997, + "name": "start", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 990, + "src": "3447:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 998, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 988, + "src": "3454:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 999, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3461:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "3454:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 995, + "name": "slice", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 1003, + 1045 + ], + "referencedDeclaration": 1045, + "src": "3433:5:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (bytes memory,uint256,uint256) pure returns (bytes memory)" + } + }, + "id": 1000, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3433:35:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "functionReturnParameters": 994, + "id": 1001, + "nodeType": "Return", + "src": "3426:42:8" + } + ] + }, + "documentation": { + "id": 986, + "nodeType": "StructuredDocumentation", + "src": "3011:312:8", + "text": " @dev Copies the content of `buffer`, from `start` (included) to the end of `buffer` into a new bytes object in\n memory.\n NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`]" + }, + "id": 1003, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "slice", + "nameLocation": "3337:5:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 991, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 988, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "3356:6:8", + "nodeType": "VariableDeclaration", + "scope": 1003, + "src": "3343:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 987, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3343:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 990, + "mutability": "mutable", + "name": "start", + "nameLocation": "3372:5:8", + "nodeType": "VariableDeclaration", + "scope": 1003, + "src": "3364:13:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 989, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3364:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3342:36:8" + }, + "returnParameters": { + "id": 994, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 993, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1003, + "src": "3402:12:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 992, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3402:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "3401:14:8" + }, + "scope": 1632, + "src": "3328:147:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1044, + "nodeType": "Block", + "src": "3959:347:8", + "statements": [ + { + "expression": { + "id": 1022, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1015, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1010, + "src": "3989:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 1018, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1010, + "src": "4004:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 1019, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1006, + "src": "4009:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1020, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4016:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "4009:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1016, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "3995:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1017, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4000:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "3995:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1021, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3995:28:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3989:34:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1023, + "nodeType": "ExpressionStatement", + "src": "3989:34:8" + }, + { + "expression": { + "id": 1030, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1024, + "name": "start", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1008, + "src": "4033:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 1027, + "name": "start", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1008, + "src": "4050:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 1028, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1010, + "src": "4057:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1025, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "4041:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1026, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4046:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "4041:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1029, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4041:20:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4033:28:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1031, + "nodeType": "ExpressionStatement", + "src": "4033:28:8" + }, + { + "assignments": [ + 1033 + ], + "declarations": [ + { + "constant": false, + "id": 1033, + "mutability": "mutable", + "name": "result", + "nameLocation": "4114:6:8", + "nodeType": "VariableDeclaration", + "scope": 1044, + "src": "4101:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1032, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4101:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 1040, + "initialValue": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1038, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1036, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1010, + "src": "4133:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "id": 1037, + "name": "start", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1008, + "src": "4139:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4133:11:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1035, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "4123:9:8", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (uint256) pure returns (bytes memory)" + }, + "typeName": { + "id": 1034, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4127:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + } + }, + "id": 1039, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4123:22:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4101:44:8" + }, + { + "AST": { + "nativeSrc": "4180:96:8", + "nodeType": "YulBlock", + "src": "4180:96:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "result", + "nativeSrc": "4204:6:8", + "nodeType": "YulIdentifier", + "src": "4204:6:8" + }, + { + "kind": "number", + "nativeSrc": "4212:4:8", + "nodeType": "YulLiteral", + "src": "4212:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4200:3:8", + "nodeType": "YulIdentifier", + "src": "4200:3:8" + }, + "nativeSrc": "4200:17:8", + "nodeType": "YulFunctionCall", + "src": "4200:17:8" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "4227:6:8", + "nodeType": "YulIdentifier", + "src": "4227:6:8" + }, + { + "kind": "number", + "nativeSrc": "4235:4:8", + "nodeType": "YulLiteral", + "src": "4235:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4223:3:8", + "nodeType": "YulIdentifier", + "src": "4223:3:8" + }, + "nativeSrc": "4223:17:8", + "nodeType": "YulFunctionCall", + "src": "4223:17:8" + }, + { + "name": "start", + "nativeSrc": "4242:5:8", + "nodeType": "YulIdentifier", + "src": "4242:5:8" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4219:3:8", + "nodeType": "YulIdentifier", + "src": "4219:3:8" + }, + "nativeSrc": "4219:29:8", + "nodeType": "YulFunctionCall", + "src": "4219:29:8" + }, + { + "arguments": [ + { + "name": "end", + "nativeSrc": "4254:3:8", + "nodeType": "YulIdentifier", + "src": "4254:3:8" + }, + { + "name": "start", + "nativeSrc": "4259:5:8", + "nodeType": "YulIdentifier", + "src": "4259:5:8" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "4250:3:8", + "nodeType": "YulIdentifier", + "src": "4250:3:8" + }, + "nativeSrc": "4250:15:8", + "nodeType": "YulFunctionCall", + "src": "4250:15:8" + } + ], + "functionName": { + "name": "mcopy", + "nativeSrc": "4194:5:8", + "nodeType": "YulIdentifier", + "src": "4194:5:8" + }, + "nativeSrc": "4194:72:8", + "nodeType": "YulFunctionCall", + "src": "4194:72:8" + }, + "nativeSrc": "4194:72:8", + "nodeType": "YulExpressionStatement", + "src": "4194:72:8" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 1006, + "isOffset": false, + "isSlot": false, + "src": "4227:6:8", + "valueSize": 1 + }, + { + "declaration": 1010, + "isOffset": false, + "isSlot": false, + "src": "4254:3:8", + "valueSize": 1 + }, + { + "declaration": 1033, + "isOffset": false, + "isSlot": false, + "src": "4204:6:8", + "valueSize": 1 + }, + { + "declaration": 1008, + "isOffset": false, + "isSlot": false, + "src": "4242:5:8", + "valueSize": 1 + }, + { + "declaration": 1008, + "isOffset": false, + "isSlot": false, + "src": "4259:5:8", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 1041, + "nodeType": "InlineAssembly", + "src": "4155:121:8" + }, + { + "expression": { + "id": 1042, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1033, + "src": "4293:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "functionReturnParameters": 1014, + "id": 1043, + "nodeType": "Return", + "src": "4286:13:8" + } + ] + }, + "documentation": { + "id": 1004, + "nodeType": "StructuredDocumentation", + "src": "3481:372:8", + "text": " @dev Copies the content of `buffer`, from `start` (included) to `end` (excluded) into a new bytes object in\n memory. The `end` argument is truncated to the length of the `buffer`.\n NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`]" + }, + "id": 1045, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "slice", + "nameLocation": "3867:5:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1011, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1006, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "3886:6:8", + "nodeType": "VariableDeclaration", + "scope": 1045, + "src": "3873:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1005, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3873:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1008, + "mutability": "mutable", + "name": "start", + "nameLocation": "3902:5:8", + "nodeType": "VariableDeclaration", + "scope": 1045, + "src": "3894:13:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1007, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3894:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1010, + "mutability": "mutable", + "name": "end", + "nameLocation": "3917:3:8", + "nodeType": "VariableDeclaration", + "scope": 1045, + "src": "3909:11:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1009, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3909:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3872:49:8" + }, + "returnParameters": { + "id": 1014, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1013, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1045, + "src": "3945:12:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1012, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3945:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "3944:14:8" + }, + "scope": 1632, + "src": "3858:448:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1062, + "nodeType": "Block", + "src": "4790:60:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 1056, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1048, + "src": "4814:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 1057, + "name": "start", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1050, + "src": "4822:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 1058, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1048, + "src": "4829:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1059, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4836:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "4829:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1055, + "name": "splice", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 1063, + 1096 + ], + "referencedDeclaration": 1096, + "src": "4807:6:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (bytes memory,uint256,uint256) pure returns (bytes memory)" + } + }, + "id": 1060, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4807:36:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "functionReturnParameters": 1054, + "id": 1061, + "nodeType": "Return", + "src": "4800:43:8" + } + ] + }, + "documentation": { + "id": 1046, + "nodeType": "StructuredDocumentation", + "src": "4312:384:8", + "text": " @dev Moves the content of `buffer`, from `start` (included) to the end of `buffer` to the start of that buffer,\n and shrinks the buffer length accordingly, effectively overriding the content of buffer with buffer[start:].\n NOTE: This function modifies the provided buffer in place. If you need to preserve the original buffer, use {slice} instead" + }, + "id": 1063, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "splice", + "nameLocation": "4710:6:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1051, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1048, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "4730:6:8", + "nodeType": "VariableDeclaration", + "scope": 1063, + "src": "4717:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1047, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4717:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1050, + "mutability": "mutable", + "name": "start", + "nameLocation": "4746:5:8", + "nodeType": "VariableDeclaration", + "scope": 1063, + "src": "4738:13:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1049, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4738:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4716:36:8" + }, + "returnParameters": { + "id": 1054, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1053, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1063, + "src": "4776:12:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1052, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4776:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "4775:14:8" + }, + "scope": 1632, + "src": "4701:149:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1095, + "nodeType": "Block", + "src": "5417:335:8", + "statements": [ + { + "expression": { + "id": 1082, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1075, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1070, + "src": "5447:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 1078, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1070, + "src": "5462:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 1079, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1066, + "src": "5467:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1080, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5474:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "5467:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1076, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "5453:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1077, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5458:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "5453:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1081, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5453:28:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5447:34:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1083, + "nodeType": "ExpressionStatement", + "src": "5447:34:8" + }, + { + "expression": { + "id": 1090, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1084, + "name": "start", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1068, + "src": "5491:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 1087, + "name": "start", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1068, + "src": "5508:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 1088, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1070, + "src": "5515:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1085, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "5499:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1086, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5504:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "5499:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1089, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5499:20:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5491:28:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1091, + "nodeType": "ExpressionStatement", + "src": "5491:28:8" + }, + { + "AST": { + "nativeSrc": "5582:140:8", + "nodeType": "YulBlock", + "src": "5582:140:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "5606:6:8", + "nodeType": "YulIdentifier", + "src": "5606:6:8" + }, + { + "kind": "number", + "nativeSrc": "5614:4:8", + "nodeType": "YulLiteral", + "src": "5614:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "5602:3:8", + "nodeType": "YulIdentifier", + "src": "5602:3:8" + }, + "nativeSrc": "5602:17:8", + "nodeType": "YulFunctionCall", + "src": "5602:17:8" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "5629:6:8", + "nodeType": "YulIdentifier", + "src": "5629:6:8" + }, + { + "kind": "number", + "nativeSrc": "5637:4:8", + "nodeType": "YulLiteral", + "src": "5637:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "5625:3:8", + "nodeType": "YulIdentifier", + "src": "5625:3:8" + }, + "nativeSrc": "5625:17:8", + "nodeType": "YulFunctionCall", + "src": "5625:17:8" + }, + { + "name": "start", + "nativeSrc": "5644:5:8", + "nodeType": "YulIdentifier", + "src": "5644:5:8" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "5621:3:8", + "nodeType": "YulIdentifier", + "src": "5621:3:8" + }, + "nativeSrc": "5621:29:8", + "nodeType": "YulFunctionCall", + "src": "5621:29:8" + }, + { + "arguments": [ + { + "name": "end", + "nativeSrc": "5656:3:8", + "nodeType": "YulIdentifier", + "src": "5656:3:8" + }, + { + "name": "start", + "nativeSrc": "5661:5:8", + "nodeType": "YulIdentifier", + "src": "5661:5:8" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "5652:3:8", + "nodeType": "YulIdentifier", + "src": "5652:3:8" + }, + "nativeSrc": "5652:15:8", + "nodeType": "YulFunctionCall", + "src": "5652:15:8" + } + ], + "functionName": { + "name": "mcopy", + "nativeSrc": "5596:5:8", + "nodeType": "YulIdentifier", + "src": "5596:5:8" + }, + "nativeSrc": "5596:72:8", + "nodeType": "YulFunctionCall", + "src": "5596:72:8" + }, + "nativeSrc": "5596:72:8", + "nodeType": "YulExpressionStatement", + "src": "5596:72:8" + }, + { + "expression": { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "5688:6:8", + "nodeType": "YulIdentifier", + "src": "5688:6:8" + }, + { + "arguments": [ + { + "name": "end", + "nativeSrc": "5700:3:8", + "nodeType": "YulIdentifier", + "src": "5700:3:8" + }, + { + "name": "start", + "nativeSrc": "5705:5:8", + "nodeType": "YulIdentifier", + "src": "5705:5:8" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "5696:3:8", + "nodeType": "YulIdentifier", + "src": "5696:3:8" + }, + "nativeSrc": "5696:15:8", + "nodeType": "YulFunctionCall", + "src": "5696:15:8" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "5681:6:8", + "nodeType": "YulIdentifier", + "src": "5681:6:8" + }, + "nativeSrc": "5681:31:8", + "nodeType": "YulFunctionCall", + "src": "5681:31:8" + }, + "nativeSrc": "5681:31:8", + "nodeType": "YulExpressionStatement", + "src": "5681:31:8" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 1066, + "isOffset": false, + "isSlot": false, + "src": "5606:6:8", + "valueSize": 1 + }, + { + "declaration": 1066, + "isOffset": false, + "isSlot": false, + "src": "5629:6:8", + "valueSize": 1 + }, + { + "declaration": 1066, + "isOffset": false, + "isSlot": false, + "src": "5688:6:8", + "valueSize": 1 + }, + { + "declaration": 1070, + "isOffset": false, + "isSlot": false, + "src": "5656:3:8", + "valueSize": 1 + }, + { + "declaration": 1070, + "isOffset": false, + "isSlot": false, + "src": "5700:3:8", + "valueSize": 1 + }, + { + "declaration": 1068, + "isOffset": false, + "isSlot": false, + "src": "5644:5:8", + "valueSize": 1 + }, + { + "declaration": 1068, + "isOffset": false, + "isSlot": false, + "src": "5661:5:8", + "valueSize": 1 + }, + { + "declaration": 1068, + "isOffset": false, + "isSlot": false, + "src": "5705:5:8", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 1092, + "nodeType": "InlineAssembly", + "src": "5557:165:8" + }, + { + "expression": { + "id": 1093, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1066, + "src": "5739:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "functionReturnParameters": 1074, + "id": 1094, + "nodeType": "Return", + "src": "5732:13:8" + } + ] + }, + "documentation": { + "id": 1064, + "nodeType": "StructuredDocumentation", + "src": "4856:454:8", + "text": " @dev Moves the content of `buffer`, from `start` (included) to `end` (excluded) to the start of that buffer,\n and shrinks the buffer length accordingly, effectively overriding the content of buffer with buffer[start:end].\n The `end` argument is truncated to the length of the `buffer`.\n NOTE: This function modifies the provided buffer in place. If you need to preserve the original buffer, use {slice} instead" + }, + "id": 1096, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "splice", + "nameLocation": "5324:6:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1071, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1066, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "5344:6:8", + "nodeType": "VariableDeclaration", + "scope": 1096, + "src": "5331:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1065, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5331:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1068, + "mutability": "mutable", + "name": "start", + "nameLocation": "5360:5:8", + "nodeType": "VariableDeclaration", + "scope": 1096, + "src": "5352:13:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1067, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5352:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1070, + "mutability": "mutable", + "name": "end", + "nameLocation": "5375:3:8", + "nodeType": "VariableDeclaration", + "scope": 1096, + "src": "5367:11:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1069, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5367:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5330:49:8" + }, + "returnParameters": { + "id": 1074, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1073, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1096, + "src": "5403:12:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1072, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5403:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "5402:14:8" + }, + "scope": 1632, + "src": "5315:437:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1117, + "nodeType": "Block", + "src": "6249:80:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 1109, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1099, + "src": "6274:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 1110, + "name": "pos", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1101, + "src": "6282:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 1111, + "name": "replacement", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1103, + "src": "6287:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "hexValue": "30", + "id": 1112, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6300:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "expression": { + "id": 1113, + "name": "replacement", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1103, + "src": "6303:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1114, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6315:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "6303:18:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1108, + "name": "replace", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 1118, + 1174 + ], + "referencedDeclaration": 1174, + "src": "6266:7:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (bytes memory,uint256,bytes memory,uint256,uint256) pure returns (bytes memory)" + } + }, + "id": 1115, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6266:56:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "functionReturnParameters": 1107, + "id": 1116, + "nodeType": "Return", + "src": "6259:63:8" + } + ] + }, + "documentation": { + "id": 1097, + "nodeType": "StructuredDocumentation", + "src": "5758:372:8", + "text": " @dev Replaces bytes in `buffer` starting at `pos` with all bytes from `replacement`.\n Parameters are clamped to valid ranges (i.e. `pos` is clamped to `[0, buffer.length]`).\n If `pos >= buffer.length`, no replacement occurs and the buffer is returned unchanged.\n NOTE: This function modifies the provided buffer in place." + }, + "id": 1118, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "replace", + "nameLocation": "6144:7:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1104, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1099, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "6165:6:8", + "nodeType": "VariableDeclaration", + "scope": 1118, + "src": "6152:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1098, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "6152:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1101, + "mutability": "mutable", + "name": "pos", + "nameLocation": "6181:3:8", + "nodeType": "VariableDeclaration", + "scope": 1118, + "src": "6173:11:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1100, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6173:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1103, + "mutability": "mutable", + "name": "replacement", + "nameLocation": "6199:11:8", + "nodeType": "VariableDeclaration", + "scope": 1118, + "src": "6186:24:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1102, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "6186:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "6151:60:8" + }, + "returnParameters": { + "id": 1107, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1106, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1118, + "src": "6235:12:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1105, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "6235:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "6234:14:8" + }, + "scope": 1632, + "src": "6135:194:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1173, + "nodeType": "Block", + "src": "7180:402:8", + "statements": [ + { + "expression": { + "id": 1141, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1134, + "name": "pos", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1123, + "src": "7210:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 1137, + "name": "pos", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1123, + "src": "7225:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 1138, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1121, + "src": "7230:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1139, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7237:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "7230:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1135, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "7216:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1136, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7221:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "7216:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1140, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7216:28:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7210:34:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1142, + "nodeType": "ExpressionStatement", + "src": "7210:34:8" + }, + { + "expression": { + "id": 1150, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1143, + "name": "offset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1127, + "src": "7254:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 1146, + "name": "offset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1127, + "src": "7272:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 1147, + "name": "replacement", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1125, + "src": "7280:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1148, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7292:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "7280:18:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1144, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "7263:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1145, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7268:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "7263:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1149, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7263:36:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7254:45:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1151, + "nodeType": "ExpressionStatement", + "src": "7254:45:8" + }, + { + "expression": { + "id": 1168, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1152, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1129, + "src": "7309:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 1155, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1129, + "src": "7327:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1161, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 1158, + "name": "replacement", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1125, + "src": "7344:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1159, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7356:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "7344:18:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "id": 1160, + "name": "offset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1127, + "src": "7365:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7344:27:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1165, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 1162, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1121, + "src": "7373:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1163, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7380:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "7373:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "id": 1164, + "name": "pos", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1123, + "src": "7389:3:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7373:19:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1156, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "7335:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1157, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7340:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "7335:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1166, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7335:58:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1153, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "7318:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1154, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7323:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "7318:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1167, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7318:76:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7309:85:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1169, + "nodeType": "ExpressionStatement", + "src": "7309:85:8" + }, + { + "AST": { + "nativeSrc": "7449:103:8", + "nodeType": "YulBlock", + "src": "7449:103:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "7477:6:8", + "nodeType": "YulIdentifier", + "src": "7477:6:8" + }, + { + "kind": "number", + "nativeSrc": "7485:4:8", + "nodeType": "YulLiteral", + "src": "7485:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7473:3:8", + "nodeType": "YulIdentifier", + "src": "7473:3:8" + }, + "nativeSrc": "7473:17:8", + "nodeType": "YulFunctionCall", + "src": "7473:17:8" + }, + { + "name": "pos", + "nativeSrc": "7492:3:8", + "nodeType": "YulIdentifier", + "src": "7492:3:8" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7469:3:8", + "nodeType": "YulIdentifier", + "src": "7469:3:8" + }, + "nativeSrc": "7469:27:8", + "nodeType": "YulFunctionCall", + "src": "7469:27:8" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "replacement", + "nativeSrc": "7506:11:8", + "nodeType": "YulIdentifier", + "src": "7506:11:8" + }, + { + "kind": "number", + "nativeSrc": "7519:4:8", + "nodeType": "YulLiteral", + "src": "7519:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7502:3:8", + "nodeType": "YulIdentifier", + "src": "7502:3:8" + }, + "nativeSrc": "7502:22:8", + "nodeType": "YulFunctionCall", + "src": "7502:22:8" + }, + { + "name": "offset", + "nativeSrc": "7526:6:8", + "nodeType": "YulIdentifier", + "src": "7526:6:8" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7498:3:8", + "nodeType": "YulIdentifier", + "src": "7498:3:8" + }, + "nativeSrc": "7498:35:8", + "nodeType": "YulFunctionCall", + "src": "7498:35:8" + }, + { + "name": "length", + "nativeSrc": "7535:6:8", + "nodeType": "YulIdentifier", + "src": "7535:6:8" + } + ], + "functionName": { + "name": "mcopy", + "nativeSrc": "7463:5:8", + "nodeType": "YulIdentifier", + "src": "7463:5:8" + }, + "nativeSrc": "7463:79:8", + "nodeType": "YulFunctionCall", + "src": "7463:79:8" + }, + "nativeSrc": "7463:79:8", + "nodeType": "YulExpressionStatement", + "src": "7463:79:8" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 1121, + "isOffset": false, + "isSlot": false, + "src": "7477:6:8", + "valueSize": 1 + }, + { + "declaration": 1129, + "isOffset": false, + "isSlot": false, + "src": "7535:6:8", + "valueSize": 1 + }, + { + "declaration": 1127, + "isOffset": false, + "isSlot": false, + "src": "7526:6:8", + "valueSize": 1 + }, + { + "declaration": 1123, + "isOffset": false, + "isSlot": false, + "src": "7492:3:8", + "valueSize": 1 + }, + { + "declaration": 1125, + "isOffset": false, + "isSlot": false, + "src": "7506:11:8", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 1170, + "nodeType": "InlineAssembly", + "src": "7424:128:8" + }, + { + "expression": { + "id": 1171, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1121, + "src": "7569:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "functionReturnParameters": 1133, + "id": 1172, + "nodeType": "Return", + "src": "7562:13:8" + } + ] + }, + "documentation": { + "id": 1119, + "nodeType": "StructuredDocumentation", + "src": "6335:648:8", + "text": " @dev Replaces bytes in `buffer` starting at `pos` with bytes from `replacement` starting at `offset`.\n Copies at most `length` bytes from `replacement` to `buffer`.\n Parameters are clamped to valid ranges (i.e. `pos` is clamped to `[0, buffer.length]`, `offset` is\n clamped to `[0, replacement.length]`, and `length` is clamped to `min(length, replacement.length - offset,\n buffer.length - pos))`. If `pos >= buffer.length` or `offset >= replacement.length`, no replacement occurs\n and the buffer is returned unchanged.\n NOTE: This function modifies the provided buffer in place." + }, + "id": 1174, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "replace", + "nameLocation": "6997:7:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1130, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1121, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "7027:6:8", + "nodeType": "VariableDeclaration", + "scope": 1174, + "src": "7014:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1120, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "7014:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1123, + "mutability": "mutable", + "name": "pos", + "nameLocation": "7051:3:8", + "nodeType": "VariableDeclaration", + "scope": 1174, + "src": "7043:11:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1122, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7043:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1125, + "mutability": "mutable", + "name": "replacement", + "nameLocation": "7077:11:8", + "nodeType": "VariableDeclaration", + "scope": 1174, + "src": "7064:24:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1124, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "7064:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1127, + "mutability": "mutable", + "name": "offset", + "nameLocation": "7106:6:8", + "nodeType": "VariableDeclaration", + "scope": 1174, + "src": "7098:14:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1126, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7098:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1129, + "mutability": "mutable", + "name": "length", + "nameLocation": "7130:6:8", + "nodeType": "VariableDeclaration", + "scope": 1174, + "src": "7122:14:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1128, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7122:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7004:138:8" + }, + "returnParameters": { + "id": 1133, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1132, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1174, + "src": "7166:12:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1131, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "7166:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "7165:14:8" + }, + "scope": 1632, + "src": "6988:594:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1246, + "nodeType": "Block", + "src": "8119:563:8", + "statements": [ + { + "assignments": [ + 1184 + ], + "declarations": [ + { + "constant": false, + "id": 1184, + "mutability": "mutable", + "name": "length", + "nameLocation": "8137:6:8", + "nodeType": "VariableDeclaration", + "scope": 1246, + "src": "8129:14:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1183, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8129:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 1186, + "initialValue": { + "hexValue": "30", + "id": 1185, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8146:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "8129:18:8" + }, + { + "body": { + "id": 1205, + "nodeType": "Block", + "src": "8202:52:8", + "statements": [ + { + "expression": { + "id": 1203, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1198, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1184, + "src": "8216:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "expression": { + "baseExpression": { + "id": 1199, + "name": "buffers", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1178, + "src": "8226:7:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_memory_ptr_$dyn_memory_ptr", + "typeString": "bytes memory[] memory" + } + }, + "id": 1201, + "indexExpression": { + "id": 1200, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1188, + "src": "8234:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8226:10:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1202, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "8237:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "8226:17:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8216:27:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1204, + "nodeType": "ExpressionStatement", + "src": "8216:27:8" + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1194, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1191, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1188, + "src": "8177:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "expression": { + "id": 1192, + "name": "buffers", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1178, + "src": "8181:7:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_memory_ptr_$dyn_memory_ptr", + "typeString": "bytes memory[] memory" + } + }, + "id": 1193, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "8189:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "8181:14:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8177:18:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 1206, + "initializationExpression": { + "assignments": [ + 1188 + ], + "declarations": [ + { + "constant": false, + "id": 1188, + "mutability": "mutable", + "name": "i", + "nameLocation": "8170:1:8", + "nodeType": "VariableDeclaration", + "scope": 1206, + "src": "8162:9:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1187, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8162:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 1190, + "initialValue": { + "hexValue": "30", + "id": 1189, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8174:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "8162:13:8" + }, + "isSimpleCounterLoop": true, + "loopExpression": { + "expression": { + "id": 1196, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": true, + "src": "8197:3:8", + "subExpression": { + "id": 1195, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1188, + "src": "8199:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1197, + "nodeType": "ExpressionStatement", + "src": "8197:3:8" + }, + "nodeType": "ForStatement", + "src": "8157:97:8" + }, + { + "assignments": [ + 1208 + ], + "declarations": [ + { + "constant": false, + "id": 1208, + "mutability": "mutable", + "name": "result", + "nameLocation": "8277:6:8", + "nodeType": "VariableDeclaration", + "scope": 1246, + "src": "8264:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1207, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "8264:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 1213, + "initialValue": { + "arguments": [ + { + "id": 1211, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1184, + "src": "8296:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1210, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "8286:9:8", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (uint256) pure returns (bytes memory)" + }, + "typeName": { + "id": 1209, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "8290:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + } + }, + "id": 1212, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8286:17:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8264:39:8" + }, + { + "assignments": [ + 1215 + ], + "declarations": [ + { + "constant": false, + "id": 1215, + "mutability": "mutable", + "name": "offset", + "nameLocation": "8322:6:8", + "nodeType": "VariableDeclaration", + "scope": 1246, + "src": "8314:14:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1214, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8314:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 1217, + "initialValue": { + "hexValue": "30783230", + "id": 1216, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8331:4:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "0x20" + }, + "nodeType": "VariableDeclarationStatement", + "src": "8314:21:8" + }, + { + "body": { + "id": 1242, + "nodeType": "Block", + "src": "8390:262:8", + "statements": [ + { + "assignments": [ + 1230 + ], + "declarations": [ + { + "constant": false, + "id": 1230, + "mutability": "mutable", + "name": "input", + "nameLocation": "8417:5:8", + "nodeType": "VariableDeclaration", + "scope": 1242, + "src": "8404:18:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1229, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "8404:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 1234, + "initialValue": { + "baseExpression": { + "id": 1231, + "name": "buffers", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1178, + "src": "8425:7:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_memory_ptr_$dyn_memory_ptr", + "typeString": "bytes memory[] memory" + } + }, + "id": 1233, + "indexExpression": { + "id": 1232, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1219, + "src": "8433:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8425:10:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8404:31:8" + }, + { + "AST": { + "nativeSrc": "8474:90:8", + "nodeType": "YulBlock", + "src": "8474:90:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "result", + "nativeSrc": "8502:6:8", + "nodeType": "YulIdentifier", + "src": "8502:6:8" + }, + { + "name": "offset", + "nativeSrc": "8510:6:8", + "nodeType": "YulIdentifier", + "src": "8510:6:8" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8498:3:8", + "nodeType": "YulIdentifier", + "src": "8498:3:8" + }, + "nativeSrc": "8498:19:8", + "nodeType": "YulFunctionCall", + "src": "8498:19:8" + }, + { + "arguments": [ + { + "name": "input", + "nativeSrc": "8523:5:8", + "nodeType": "YulIdentifier", + "src": "8523:5:8" + }, + { + "kind": "number", + "nativeSrc": "8530:4:8", + "nodeType": "YulLiteral", + "src": "8530:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8519:3:8", + "nodeType": "YulIdentifier", + "src": "8519:3:8" + }, + "nativeSrc": "8519:16:8", + "nodeType": "YulFunctionCall", + "src": "8519:16:8" + }, + { + "arguments": [ + { + "name": "input", + "nativeSrc": "8543:5:8", + "nodeType": "YulIdentifier", + "src": "8543:5:8" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "8537:5:8", + "nodeType": "YulIdentifier", + "src": "8537:5:8" + }, + "nativeSrc": "8537:12:8", + "nodeType": "YulFunctionCall", + "src": "8537:12:8" + } + ], + "functionName": { + "name": "mcopy", + "nativeSrc": "8492:5:8", + "nodeType": "YulIdentifier", + "src": "8492:5:8" + }, + "nativeSrc": "8492:58:8", + "nodeType": "YulFunctionCall", + "src": "8492:58:8" + }, + "nativeSrc": "8492:58:8", + "nodeType": "YulExpressionStatement", + "src": "8492:58:8" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 1230, + "isOffset": false, + "isSlot": false, + "src": "8523:5:8", + "valueSize": 1 + }, + { + "declaration": 1230, + "isOffset": false, + "isSlot": false, + "src": "8543:5:8", + "valueSize": 1 + }, + { + "declaration": 1215, + "isOffset": false, + "isSlot": false, + "src": "8510:6:8", + "valueSize": 1 + }, + { + "declaration": 1208, + "isOffset": false, + "isSlot": false, + "src": "8502:6:8", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 1235, + "nodeType": "InlineAssembly", + "src": "8449:115:8" + }, + { + "id": 1241, + "nodeType": "UncheckedBlock", + "src": "8577:65:8", + "statements": [ + { + "expression": { + "id": 1239, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1236, + "name": "offset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1215, + "src": "8605:6:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "expression": { + "id": 1237, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1230, + "src": "8615:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1238, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "8621:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "8615:12:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8605:22:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1240, + "nodeType": "ExpressionStatement", + "src": "8605:22:8" + } + ] + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1225, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1222, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1219, + "src": "8365:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "expression": { + "id": 1223, + "name": "buffers", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1178, + "src": "8369:7:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_memory_ptr_$dyn_memory_ptr", + "typeString": "bytes memory[] memory" + } + }, + "id": 1224, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "8377:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "8369:14:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8365:18:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 1243, + "initializationExpression": { + "assignments": [ + 1219 + ], + "declarations": [ + { + "constant": false, + "id": 1219, + "mutability": "mutable", + "name": "i", + "nameLocation": "8358:1:8", + "nodeType": "VariableDeclaration", + "scope": 1243, + "src": "8350:9:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1218, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8350:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 1221, + "initialValue": { + "hexValue": "30", + "id": 1220, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8362:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "8350:13:8" + }, + "isSimpleCounterLoop": true, + "loopExpression": { + "expression": { + "id": 1227, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": true, + "src": "8385:3:8", + "subExpression": { + "id": 1226, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1219, + "src": "8387:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1228, + "nodeType": "ExpressionStatement", + "src": "8385:3:8" + }, + "nodeType": "ForStatement", + "src": "8345:307:8" + }, + { + "expression": { + "id": 1244, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1208, + "src": "8669:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "functionReturnParameters": 1182, + "id": 1245, + "nodeType": "Return", + "src": "8662:13:8" + } + ] + }, + "documentation": { + "id": 1175, + "nodeType": "StructuredDocumentation", + "src": "7588:449:8", + "text": " @dev Concatenate an array of bytes into a single bytes object.\n For fixed bytes types, we recommend using the solidity built-in `bytes.concat` or (equivalent)\n `abi.encodePacked`.\n NOTE: this could be done in assembly with a single loop that expands starting at the FMP, but that would be\n significantly less readable. It might be worth benchmarking the savings of the full-assembly approach." + }, + "id": 1247, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "concat", + "nameLocation": "8051:6:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1179, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1178, + "mutability": "mutable", + "name": "buffers", + "nameLocation": "8073:7:8", + "nodeType": "VariableDeclaration", + "scope": 1247, + "src": "8058:22:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_memory_ptr_$dyn_memory_ptr", + "typeString": "bytes[]" + }, + "typeName": { + "baseType": { + "id": 1176, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "8058:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "id": 1177, + "nodeType": "ArrayTypeName", + "src": "8058:7:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes_storage_$dyn_storage_ptr", + "typeString": "bytes[]" + } + }, + "visibility": "internal" + } + ], + "src": "8057:24:8" + }, + "returnParameters": { + "id": 1182, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1181, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1247, + "src": "8105:12:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1180, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "8105:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "8104:14:8" + }, + "scope": 1632, + "src": "8042:640:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1256, + "nodeType": "Block", + "src": "8920:1416:8", + "statements": [ + { + "AST": { + "nativeSrc": "8955:1375:8", + "nodeType": "YulBlock", + "src": "8955:1375:8", + "statements": [ + { + "nativeSrc": "8969:26:8", + "nodeType": "YulVariableDeclaration", + "src": "8969:26:8", + "value": { + "arguments": [ + { + "name": "input", + "nativeSrc": "8989:5:8", + "nodeType": "YulIdentifier", + "src": "8989:5:8" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "8983:5:8", + "nodeType": "YulIdentifier", + "src": "8983:5:8" + }, + "nativeSrc": "8983:12:8", + "nodeType": "YulFunctionCall", + "src": "8983:12:8" + }, + "variables": [ + { + "name": "length", + "nativeSrc": "8973:6:8", + "nodeType": "YulTypedName", + "src": "8973:6:8", + "type": "" + } + ] + }, + { + "nativeSrc": "9008:21:8", + "nodeType": "YulAssignment", + "src": "9008:21:8", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9024:4:8", + "nodeType": "YulLiteral", + "src": "9024:4:8", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "9018:5:8", + "nodeType": "YulIdentifier", + "src": "9018:5:8" + }, + "nativeSrc": "9018:11:8", + "nodeType": "YulFunctionCall", + "src": "9018:11:8" + }, + "variableNames": [ + { + "name": "output", + "nativeSrc": "9008:6:8", + "nodeType": "YulIdentifier", + "src": "9008:6:8" + } + ] + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9049:4:8", + "nodeType": "YulLiteral", + "src": "9049:4:8", + "type": "", + "value": "0x40" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "output", + "nativeSrc": "9063:6:8", + "nodeType": "YulIdentifier", + "src": "9063:6:8" + }, + { + "kind": "number", + "nativeSrc": "9071:4:8", + "nodeType": "YulLiteral", + "src": "9071:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9059:3:8", + "nodeType": "YulIdentifier", + "src": "9059:3:8" + }, + "nativeSrc": "9059:17:8", + "nodeType": "YulFunctionCall", + "src": "9059:17:8" + }, + { + "arguments": [ + { + "name": "length", + "nativeSrc": "9082:6:8", + "nodeType": "YulIdentifier", + "src": "9082:6:8" + }, + { + "kind": "number", + "nativeSrc": "9090:1:8", + "nodeType": "YulLiteral", + "src": "9090:1:8", + "type": "", + "value": "2" + } + ], + "functionName": { + "name": "mul", + "nativeSrc": "9078:3:8", + "nodeType": "YulIdentifier", + "src": "9078:3:8" + }, + "nativeSrc": "9078:14:8", + "nodeType": "YulFunctionCall", + "src": "9078:14:8" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9055:3:8", + "nodeType": "YulIdentifier", + "src": "9055:3:8" + }, + "nativeSrc": "9055:38:8", + "nodeType": "YulFunctionCall", + "src": "9055:38:8" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "9042:6:8", + "nodeType": "YulIdentifier", + "src": "9042:6:8" + }, + "nativeSrc": "9042:52:8", + "nodeType": "YulFunctionCall", + "src": "9042:52:8" + }, + "nativeSrc": "9042:52:8", + "nodeType": "YulExpressionStatement", + "src": "9042:52:8" + }, + { + "expression": { + "arguments": [ + { + "name": "output", + "nativeSrc": "9114:6:8", + "nodeType": "YulIdentifier", + "src": "9114:6:8" + }, + { + "arguments": [ + { + "name": "length", + "nativeSrc": "9126:6:8", + "nodeType": "YulIdentifier", + "src": "9126:6:8" + }, + { + "kind": "number", + "nativeSrc": "9134:1:8", + "nodeType": "YulLiteral", + "src": "9134:1:8", + "type": "", + "value": "2" + } + ], + "functionName": { + "name": "mul", + "nativeSrc": "9122:3:8", + "nodeType": "YulIdentifier", + "src": "9122:3:8" + }, + "nativeSrc": "9122:14:8", + "nodeType": "YulFunctionCall", + "src": "9122:14:8" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "9107:6:8", + "nodeType": "YulIdentifier", + "src": "9107:6:8" + }, + "nativeSrc": "9107:30:8", + "nodeType": "YulFunctionCall", + "src": "9107:30:8" + }, + "nativeSrc": "9107:30:8", + "nodeType": "YulExpressionStatement", + "src": "9107:30:8" + }, + { + "body": { + "nativeSrc": "9261:1059:8", + "nodeType": "YulBlock", + "src": "9261:1059:8", + "statements": [ + { + "nativeSrc": "9279:54:8", + "nodeType": "YulVariableDeclaration", + "src": "9279:54:8", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9296:3:8", + "nodeType": "YulLiteral", + "src": "9296:3:8", + "type": "", + "value": "128" + }, + { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "input", + "nativeSrc": "9315:5:8", + "nodeType": "YulIdentifier", + "src": "9315:5:8" + }, + { + "kind": "number", + "nativeSrc": "9322:4:8", + "nodeType": "YulLiteral", + "src": "9322:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9311:3:8", + "nodeType": "YulIdentifier", + "src": "9311:3:8" + }, + "nativeSrc": "9311:16:8", + "nodeType": "YulFunctionCall", + "src": "9311:16:8" + }, + { + "name": "i", + "nativeSrc": "9329:1:8", + "nodeType": "YulIdentifier", + "src": "9329:1:8" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9307:3:8", + "nodeType": "YulIdentifier", + "src": "9307:3:8" + }, + "nativeSrc": "9307:24:8", + "nodeType": "YulFunctionCall", + "src": "9307:24:8" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "9301:5:8", + "nodeType": "YulIdentifier", + "src": "9301:5:8" + }, + "nativeSrc": "9301:31:8", + "nodeType": "YulFunctionCall", + "src": "9301:31:8" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "9292:3:8", + "nodeType": "YulIdentifier", + "src": "9292:3:8" + }, + "nativeSrc": "9292:41:8", + "nodeType": "YulFunctionCall", + "src": "9292:41:8" + }, + "variables": [ + { + "name": "chunk", + "nativeSrc": "9283:5:8", + "nodeType": "YulTypedName", + "src": "9283:5:8", + "type": "" + } + ] + }, + { + "nativeSrc": "9350:165:8", + "nodeType": "YulAssignment", + "src": "9350:165:8", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9384:66:8", + "nodeType": "YulLiteral", + "src": "9384:66:8", + "type": "", + "value": "0x0000000000000000ffffffffffffffff0000000000000000ffffffffffffffff" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9479:2:8", + "nodeType": "YulLiteral", + "src": "9479:2:8", + "type": "", + "value": "64" + }, + { + "name": "chunk", + "nativeSrc": "9483:5:8", + "nodeType": "YulIdentifier", + "src": "9483:5:8" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "9475:3:8", + "nodeType": "YulIdentifier", + "src": "9475:3:8" + }, + "nativeSrc": "9475:14:8", + "nodeType": "YulFunctionCall", + "src": "9475:14:8" + }, + { + "name": "chunk", + "nativeSrc": "9491:5:8", + "nodeType": "YulIdentifier", + "src": "9491:5:8" + } + ], + "functionName": { + "name": "or", + "nativeSrc": "9472:2:8", + "nodeType": "YulIdentifier", + "src": "9472:2:8" + }, + "nativeSrc": "9472:25:8", + "nodeType": "YulFunctionCall", + "src": "9472:25:8" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "9359:3:8", + "nodeType": "YulIdentifier", + "src": "9359:3:8" + }, + "nativeSrc": "9359:156:8", + "nodeType": "YulFunctionCall", + "src": "9359:156:8" + }, + "variableNames": [ + { + "name": "chunk", + "nativeSrc": "9350:5:8", + "nodeType": "YulIdentifier", + "src": "9350:5:8" + } + ] + }, + { + "nativeSrc": "9532:165:8", + "nodeType": "YulAssignment", + "src": "9532:165:8", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9566:66:8", + "nodeType": "YulLiteral", + "src": "9566:66:8", + "type": "", + "value": "0x00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9661:2:8", + "nodeType": "YulLiteral", + "src": "9661:2:8", + "type": "", + "value": "32" + }, + { + "name": "chunk", + "nativeSrc": "9665:5:8", + "nodeType": "YulIdentifier", + "src": "9665:5:8" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "9657:3:8", + "nodeType": "YulIdentifier", + "src": "9657:3:8" + }, + "nativeSrc": "9657:14:8", + "nodeType": "YulFunctionCall", + "src": "9657:14:8" + }, + { + "name": "chunk", + "nativeSrc": "9673:5:8", + "nodeType": "YulIdentifier", + "src": "9673:5:8" + } + ], + "functionName": { + "name": "or", + "nativeSrc": "9654:2:8", + "nodeType": "YulIdentifier", + "src": "9654:2:8" + }, + "nativeSrc": "9654:25:8", + "nodeType": "YulFunctionCall", + "src": "9654:25:8" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "9541:3:8", + "nodeType": "YulIdentifier", + "src": "9541:3:8" + }, + "nativeSrc": "9541:156:8", + "nodeType": "YulFunctionCall", + "src": "9541:156:8" + }, + "variableNames": [ + { + "name": "chunk", + "nativeSrc": "9532:5:8", + "nodeType": "YulIdentifier", + "src": "9532:5:8" + } + ] + }, + { + "nativeSrc": "9714:165:8", + "nodeType": "YulAssignment", + "src": "9714:165:8", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9748:66:8", + "nodeType": "YulLiteral", + "src": "9748:66:8", + "type": "", + "value": "0x0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9843:2:8", + "nodeType": "YulLiteral", + "src": "9843:2:8", + "type": "", + "value": "16" + }, + { + "name": "chunk", + "nativeSrc": "9847:5:8", + "nodeType": "YulIdentifier", + "src": "9847:5:8" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "9839:3:8", + "nodeType": "YulIdentifier", + "src": "9839:3:8" + }, + "nativeSrc": "9839:14:8", + "nodeType": "YulFunctionCall", + "src": "9839:14:8" + }, + { + "name": "chunk", + "nativeSrc": "9855:5:8", + "nodeType": "YulIdentifier", + "src": "9855:5:8" + } + ], + "functionName": { + "name": "or", + "nativeSrc": "9836:2:8", + "nodeType": "YulIdentifier", + "src": "9836:2:8" + }, + "nativeSrc": "9836:25:8", + "nodeType": "YulFunctionCall", + "src": "9836:25:8" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "9723:3:8", + "nodeType": "YulIdentifier", + "src": "9723:3:8" + }, + "nativeSrc": "9723:156:8", + "nodeType": "YulFunctionCall", + "src": "9723:156:8" + }, + "variableNames": [ + { + "name": "chunk", + "nativeSrc": "9714:5:8", + "nodeType": "YulIdentifier", + "src": "9714:5:8" + } + ] + }, + { + "nativeSrc": "9896:164:8", + "nodeType": "YulAssignment", + "src": "9896:164:8", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9930:66:8", + "nodeType": "YulLiteral", + "src": "9930:66:8", + "type": "", + "value": "0x00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10025:1:8", + "nodeType": "YulLiteral", + "src": "10025:1:8", + "type": "", + "value": "8" + }, + { + "name": "chunk", + "nativeSrc": "10028:5:8", + "nodeType": "YulIdentifier", + "src": "10028:5:8" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "10021:3:8", + "nodeType": "YulIdentifier", + "src": "10021:3:8" + }, + "nativeSrc": "10021:13:8", + "nodeType": "YulFunctionCall", + "src": "10021:13:8" + }, + { + "name": "chunk", + "nativeSrc": "10036:5:8", + "nodeType": "YulIdentifier", + "src": "10036:5:8" + } + ], + "functionName": { + "name": "or", + "nativeSrc": "10018:2:8", + "nodeType": "YulIdentifier", + "src": "10018:2:8" + }, + "nativeSrc": "10018:24:8", + "nodeType": "YulFunctionCall", + "src": "10018:24:8" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "9905:3:8", + "nodeType": "YulIdentifier", + "src": "9905:3:8" + }, + "nativeSrc": "9905:155:8", + "nodeType": "YulFunctionCall", + "src": "9905:155:8" + }, + "variableNames": [ + { + "name": "chunk", + "nativeSrc": "9896:5:8", + "nodeType": "YulIdentifier", + "src": "9896:5:8" + } + ] + }, + { + "nativeSrc": "10077:164:8", + "nodeType": "YulAssignment", + "src": "10077:164:8", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10111:66:8", + "nodeType": "YulLiteral", + "src": "10111:66:8", + "type": "", + "value": "0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10206:1:8", + "nodeType": "YulLiteral", + "src": "10206:1:8", + "type": "", + "value": "4" + }, + { + "name": "chunk", + "nativeSrc": "10209:5:8", + "nodeType": "YulIdentifier", + "src": "10209:5:8" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "10202:3:8", + "nodeType": "YulIdentifier", + "src": "10202:3:8" + }, + "nativeSrc": "10202:13:8", + "nodeType": "YulFunctionCall", + "src": "10202:13:8" + }, + { + "name": "chunk", + "nativeSrc": "10217:5:8", + "nodeType": "YulIdentifier", + "src": "10217:5:8" + } + ], + "functionName": { + "name": "or", + "nativeSrc": "10199:2:8", + "nodeType": "YulIdentifier", + "src": "10199:2:8" + }, + "nativeSrc": "10199:24:8", + "nodeType": "YulFunctionCall", + "src": "10199:24:8" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "10086:3:8", + "nodeType": "YulIdentifier", + "src": "10086:3:8" + }, + "nativeSrc": "10086:155:8", + "nodeType": "YulFunctionCall", + "src": "10086:155:8" + }, + "variableNames": [ + { + "name": "chunk", + "nativeSrc": "10077:5:8", + "nodeType": "YulIdentifier", + "src": "10077:5:8" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "output", + "nativeSrc": "10273:6:8", + "nodeType": "YulIdentifier", + "src": "10273:6:8" + }, + { + "kind": "number", + "nativeSrc": "10281:4:8", + "nodeType": "YulLiteral", + "src": "10281:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10269:3:8", + "nodeType": "YulIdentifier", + "src": "10269:3:8" + }, + "nativeSrc": "10269:17:8", + "nodeType": "YulFunctionCall", + "src": "10269:17:8" + }, + { + "arguments": [ + { + "name": "i", + "nativeSrc": "10292:1:8", + "nodeType": "YulIdentifier", + "src": "10292:1:8" + }, + { + "kind": "number", + "nativeSrc": "10295:1:8", + "nodeType": "YulLiteral", + "src": "10295:1:8", + "type": "", + "value": "2" + } + ], + "functionName": { + "name": "mul", + "nativeSrc": "10288:3:8", + "nodeType": "YulIdentifier", + "src": "10288:3:8" + }, + "nativeSrc": "10288:9:8", + "nodeType": "YulFunctionCall", + "src": "10288:9:8" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10265:3:8", + "nodeType": "YulIdentifier", + "src": "10265:3:8" + }, + "nativeSrc": "10265:33:8", + "nodeType": "YulFunctionCall", + "src": "10265:33:8" + }, + { + "name": "chunk", + "nativeSrc": "10300:5:8", + "nodeType": "YulIdentifier", + "src": "10300:5:8" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10258:6:8", + "nodeType": "YulIdentifier", + "src": "10258:6:8" + }, + "nativeSrc": "10258:48:8", + "nodeType": "YulFunctionCall", + "src": "10258:48:8" + }, + "nativeSrc": "10258:48:8", + "nodeType": "YulExpressionStatement", + "src": "10258:48:8" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "i", + "nativeSrc": "9200:1:8", + "nodeType": "YulIdentifier", + "src": "9200:1:8" + }, + { + "name": "length", + "nativeSrc": "9203:6:8", + "nodeType": "YulIdentifier", + "src": "9203:6:8" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "9197:2:8", + "nodeType": "YulIdentifier", + "src": "9197:2:8" + }, + "nativeSrc": "9197:13:8", + "nodeType": "YulFunctionCall", + "src": "9197:13:8" + }, + "nativeSrc": "9150:1170:8", + "nodeType": "YulForLoop", + "post": { + "nativeSrc": "9211:49:8", + "nodeType": "YulBlock", + "src": "9211:49:8", + "statements": [ + { + "nativeSrc": "9229:17:8", + "nodeType": "YulAssignment", + "src": "9229:17:8", + "value": { + "arguments": [ + { + "name": "i", + "nativeSrc": "9238:1:8", + "nodeType": "YulIdentifier", + "src": "9238:1:8" + }, + { + "kind": "number", + "nativeSrc": "9241:4:8", + "nodeType": "YulLiteral", + "src": "9241:4:8", + "type": "", + "value": "0x10" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9234:3:8", + "nodeType": "YulIdentifier", + "src": "9234:3:8" + }, + "nativeSrc": "9234:12:8", + "nodeType": "YulFunctionCall", + "src": "9234:12:8" + }, + "variableNames": [ + { + "name": "i", + "nativeSrc": "9229:1:8", + "nodeType": "YulIdentifier", + "src": "9229:1:8" + } + ] + } + ] + }, + "pre": { + "nativeSrc": "9154:42:8", + "nodeType": "YulBlock", + "src": "9154:42:8", + "statements": [ + { + "nativeSrc": "9172:10:8", + "nodeType": "YulVariableDeclaration", + "src": "9172:10:8", + "value": { + "kind": "number", + "nativeSrc": "9181:1:8", + "nodeType": "YulLiteral", + "src": "9181:1:8", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "i", + "nativeSrc": "9176:1:8", + "nodeType": "YulTypedName", + "src": "9176:1:8", + "type": "" + } + ] + } + ] + }, + "src": "9150:1170:8" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 1250, + "isOffset": false, + "isSlot": false, + "src": "8989:5:8", + "valueSize": 1 + }, + { + "declaration": 1250, + "isOffset": false, + "isSlot": false, + "src": "9315:5:8", + "valueSize": 1 + }, + { + "declaration": 1253, + "isOffset": false, + "isSlot": false, + "src": "10273:6:8", + "valueSize": 1 + }, + { + "declaration": 1253, + "isOffset": false, + "isSlot": false, + "src": "9008:6:8", + "valueSize": 1 + }, + { + "declaration": 1253, + "isOffset": false, + "isSlot": false, + "src": "9063:6:8", + "valueSize": 1 + }, + { + "declaration": 1253, + "isOffset": false, + "isSlot": false, + "src": "9114:6:8", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 1255, + "nodeType": "InlineAssembly", + "src": "8930:1400:8" + } + ] + }, + "documentation": { + "id": 1248, + "nodeType": "StructuredDocumentation", + "src": "8688:144:8", + "text": " @dev Split each byte in `input` into two nibbles (4 bits each)\n Example: hex\"01234567\" → hex\"0001020304050607\"" + }, + "id": 1257, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toNibbles", + "nameLocation": "8846:9:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1251, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1250, + "mutability": "mutable", + "name": "input", + "nameLocation": "8869:5:8", + "nodeType": "VariableDeclaration", + "scope": 1257, + "src": "8856:18:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1249, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "8856:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "8855:20:8" + }, + "returnParameters": { + "id": 1254, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1253, + "mutability": "mutable", + "name": "output", + "nameLocation": "8912:6:8", + "nodeType": "VariableDeclaration", + "scope": 1257, + "src": "8899:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1252, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "8899:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "8898:21:8" + }, + "scope": 1632, + "src": "8837:1499:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1281, + "nodeType": "Block", + "src": "10494:76:8", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 1279, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1271, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 1267, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1260, + "src": "10511:1:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1268, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "10513:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "10511:8:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "expression": { + "id": 1269, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1262, + "src": "10523:1:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1270, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "10525:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "10523:8:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10511:20:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1278, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 1273, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1260, + "src": "10545:1:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 1272, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "10535:9:8", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 1274, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10535:12:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "arguments": [ + { + "id": 1276, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1262, + "src": "10561:1:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 1275, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "10551:9:8", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 1277, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10551:12:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "10535:28:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "10511:52:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 1266, + "id": 1280, + "nodeType": "Return", + "src": "10504:59:8" + } + ] + }, + "documentation": { + "id": 1258, + "nodeType": "StructuredDocumentation", + "src": "10342:71:8", + "text": " @dev Returns true if the two byte buffers are equal." + }, + "id": 1282, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "equal", + "nameLocation": "10427:5:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1263, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1260, + "mutability": "mutable", + "name": "a", + "nameLocation": "10446:1:8", + "nodeType": "VariableDeclaration", + "scope": 1282, + "src": "10433:14:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1259, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "10433:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1262, + "mutability": "mutable", + "name": "b", + "nameLocation": "10462:1:8", + "nodeType": "VariableDeclaration", + "scope": 1282, + "src": "10449:14:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1261, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "10449:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "10432:32:8" + }, + "returnParameters": { + "id": 1266, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1265, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1282, + "src": "10488:4:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 1264, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "10488:4:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "10487:6:8" + }, + "scope": 1632, + "src": "10418:152:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1372, + "nodeType": "Block", + "src": "10874:1024:8", + "statements": [ + { + "expression": { + "id": 1306, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1290, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "10884:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1305, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1296, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1293, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1291, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "10920:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "38", + "id": 1292, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10929:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "10920:10:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1294, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "10919:12:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830304646303046463030464630304646303046463030464630304646303046463030464630304646303046463030464630304646303046463030464630304646", + "id": 1295, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10934:66:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_450552876409790643671482431940419874915447411150352389258589821042463539455_by_1", + "typeString": "int_const 4505...(67 digits omitted)...9455" + }, + "value": "0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF" + }, + "src": "10919:81:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1297, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "10918:83:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1303, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1300, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1298, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11018:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830304646303046463030464630304646303046463030464630304646303046463030464630304646303046463030464630304646303046463030464630304646", + "id": 1299, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11026:66:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_450552876409790643671482431940419874915447411150352389258589821042463539455_by_1", + "typeString": "int_const 4505...(67 digits omitted)...9455" + }, + "value": "0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF" + }, + "src": "11018:74:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1301, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11017:76:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "38", + "id": 1302, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11097:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "11017:81:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1304, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11016:83:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "10918:181:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "10884:215:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 1307, + "nodeType": "ExpressionStatement", + "src": "10884:215:8" + }, + { + "expression": { + "id": 1324, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1308, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11109:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1323, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1314, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1311, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1309, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11157:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "3136", + "id": 1310, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11166:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "11157:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1312, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11156:13:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830303030464646463030303046464646303030304646464630303030464646463030303046464646303030304646464630303030464646463030303046464646", + "id": 1313, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11172:66:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_1766820105243087041267848467410591083712559083657179364930612997358944255_by_1", + "typeString": "int_const 1766...(65 digits omitted)...4255" + }, + "value": "0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF" + }, + "src": "11156:82:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1315, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11155:84:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1321, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1318, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1316, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11256:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830303030464646463030303046464646303030304646464630303030464646463030303046464646303030304646464630303030464646463030303046464646", + "id": 1317, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11264:66:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_1766820105243087041267848467410591083712559083657179364930612997358944255_by_1", + "typeString": "int_const 1766...(65 digits omitted)...4255" + }, + "value": "0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF" + }, + "src": "11256:74:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1319, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11255:76:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3136", + "id": 1320, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11335:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "11255:82:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1322, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11254:84:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "11155:183:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "11109:229:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 1325, + "nodeType": "ExpressionStatement", + "src": "11109:229:8" + }, + { + "expression": { + "id": 1342, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1326, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11348:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1341, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1332, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1329, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1327, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11396:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "3332", + "id": 1328, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11405:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "11396:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1330, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11395:13:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830303030303030304646464646464646303030303030303046464646464646463030303030303030464646464646464630303030303030304646464646464646", + "id": 1331, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11411:66:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_26959946660873538060741835960174461801791452538186943042387869433855_by_1", + "typeString": "int_const 2695...(60 digits omitted)...3855" + }, + "value": "0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF" + }, + "src": "11395:82:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1333, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11394:84:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1339, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1336, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1334, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11495:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830303030303030304646464646464646303030303030303046464646464646463030303030303030464646464646464630303030303030304646464646464646", + "id": 1335, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11503:66:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_26959946660873538060741835960174461801791452538186943042387869433855_by_1", + "typeString": "int_const 2695...(60 digits omitted)...3855" + }, + "value": "0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF" + }, + "src": "11495:74:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1337, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11494:76:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3332", + "id": 1338, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11574:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "11494:82:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1340, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11493:84:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "11394:183:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "11348:229:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 1343, + "nodeType": "ExpressionStatement", + "src": "11348:229:8" + }, + { + "expression": { + "id": 1360, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1344, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11587:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1359, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1350, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1347, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1345, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11635:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "3634", + "id": 1346, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11644:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "11635:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1348, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11634:13:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830303030303030303030303030303030464646464646464646464646464646463030303030303030303030303030303046464646464646464646464646464646", + "id": 1349, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11650:66:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_6277101735386680763495507056286727952657427581105975853055_by_1", + "typeString": "int_const 6277...(50 digits omitted)...3055" + }, + "value": "0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF" + }, + "src": "11634:82:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1351, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11633:84:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1357, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1354, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1352, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11734:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830303030303030303030303030303030464646464646464646464646464646463030303030303030303030303030303046464646464646464646464646464646", + "id": 1353, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11742:66:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_6277101735386680763495507056286727952657427581105975853055_by_1", + "typeString": "int_const 6277...(50 digits omitted)...3055" + }, + "value": "0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF" + }, + "src": "11734:74:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1355, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11733:76:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3634", + "id": 1356, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11813:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "11733:82:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1358, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11732:84:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "11633:183:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "11587:229:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 1361, + "nodeType": "ExpressionStatement", + "src": "11587:229:8" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1370, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1364, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1362, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11834:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "313238", + "id": 1363, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11843:3:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_128_by_1", + "typeString": "int_const 128" + }, + "value": "128" + }, + "src": "11834:12:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1365, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11833:14:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1368, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1366, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "11851:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "313238", + "id": 1367, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11860:3:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_128_by_1", + "typeString": "int_const 128" + }, + "value": "128" + }, + "src": "11851:12:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 1369, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11850:14:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "11833:31:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 1289, + "id": 1371, + "nodeType": "Return", + "src": "11826:38:8" + } + ] + }, + "documentation": { + "id": 1283, + "nodeType": "StructuredDocumentation", + "src": "10576:222:8", + "text": " @dev Reverses the byte order of a bytes32 value, converting between little-endian and big-endian.\n Inspired by https://graphics.stanford.edu/~seander/bithacks.html#ReverseParallel[Reverse Parallel]" + }, + "id": 1373, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "reverseBytes32", + "nameLocation": "10812:14:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1286, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1285, + "mutability": "mutable", + "name": "value", + "nameLocation": "10835:5:8", + "nodeType": "VariableDeclaration", + "scope": 1373, + "src": "10827:13:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 1284, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "10827:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "10826:15:8" + }, + "returnParameters": { + "id": 1289, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1288, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1373, + "src": "10865:7:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 1287, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "10865:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "10864:9:8" + }, + "scope": 1632, + "src": "10803:1095:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1445, + "nodeType": "Block", + "src": "12047:590:8", + "statements": [ + { + "expression": { + "id": 1397, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1381, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12057:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1396, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1387, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1384, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1382, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12093:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30784646303046463030464630304646303046463030464630304646303046463030", + "id": 1383, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12101:34:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_338958311018522360492699998064329424640_by_1", + "typeString": "int_const 3389...(31 digits omitted)...4640" + }, + "value": "0xFF00FF00FF00FF00FF00FF00FF00FF00" + }, + "src": "12093:42:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1385, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12092:44:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "38", + "id": 1386, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12140:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "12092:49:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1388, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12091:51:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1394, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1391, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1389, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12159:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30783030464630304646303046463030464630304646303046463030464630304646", + "id": 1390, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12167:34:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_1324055902416102970674609367438786815_by_1", + "typeString": "int_const 1324...(29 digits omitted)...6815" + }, + "value": "0x00FF00FF00FF00FF00FF00FF00FF00FF" + }, + "src": "12159:42:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1392, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12158:44:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "38", + "id": 1393, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12206:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "12158:49:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1395, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12157:51:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "src": "12091:117:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "src": "12057:151:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "id": 1398, + "nodeType": "ExpressionStatement", + "src": "12057:151:8" + }, + { + "expression": { + "id": 1415, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1399, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12218:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1414, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1405, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1402, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1400, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12266:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30784646464630303030464646463030303046464646303030304646464630303030", + "id": 1401, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12274:34:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_340277174703306882242637262502835978240_by_1", + "typeString": "int_const 3402...(31 digits omitted)...8240" + }, + "value": "0xFFFF0000FFFF0000FFFF0000FFFF0000" + }, + "src": "12266:42:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1403, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12265:44:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "3136", + "id": 1404, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12313:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "12265:50:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1406, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12264:52:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1412, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1409, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1407, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12333:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30783030303046464646303030304646464630303030464646463030303046464646", + "id": 1408, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12341:34:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_5192217631581220737344928932233215_by_1", + "typeString": "int_const 5192...(26 digits omitted)...3215" + }, + "value": "0x0000FFFF0000FFFF0000FFFF0000FFFF" + }, + "src": "12333:42:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1410, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12332:44:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3136", + "id": 1411, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12380:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "12332:50:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1413, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12331:52:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "src": "12264:119:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "src": "12218:165:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "id": 1416, + "nodeType": "ExpressionStatement", + "src": "12218:165:8" + }, + { + "expression": { + "id": 1433, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1417, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12393:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1432, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1423, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1420, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1418, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12441:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30784646464646464646303030303030303046464646464646463030303030303030", + "id": 1419, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12449:34:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_340282366841710300967557013907638845440_by_1", + "typeString": "int_const 3402...(31 digits omitted)...5440" + }, + "value": "0xFFFFFFFF00000000FFFFFFFF00000000" + }, + "src": "12441:42:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1421, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12440:44:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "3332", + "id": 1422, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12488:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "12440:50:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1424, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12439:52:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1430, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1427, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1425, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12508:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30783030303030303030464646464646464630303030303030304646464646464646", + "id": 1426, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12516:34:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_79228162495817593524129366015_by_1", + "typeString": "int_const 79228162495817593524129366015" + }, + "value": "0x00000000FFFFFFFF00000000FFFFFFFF" + }, + "src": "12508:42:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1428, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12507:44:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3332", + "id": 1429, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12555:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "12507:50:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1431, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12506:52:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "src": "12439:119:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "src": "12393:165:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "id": 1434, + "nodeType": "ExpressionStatement", + "src": "12393:165:8" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1443, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1437, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1435, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12576:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "3634", + "id": 1436, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12585:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "12576:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1438, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12575:13:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "id": 1441, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1439, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1376, + "src": "12592:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3634", + "id": 1440, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12601:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "12592:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + } + ], + "id": 1442, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12591:13:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "src": "12575:29:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "functionReturnParameters": 1380, + "id": 1444, + "nodeType": "Return", + "src": "12568:36:8" + } + ] + }, + "documentation": { + "id": 1374, + "nodeType": "StructuredDocumentation", + "src": "11904:67:8", + "text": "@dev Same as {reverseBytes32} but optimized for 128-bit values." + }, + "id": 1446, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "reverseBytes16", + "nameLocation": "11985:14:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1377, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1376, + "mutability": "mutable", + "name": "value", + "nameLocation": "12008:5:8", + "nodeType": "VariableDeclaration", + "scope": 1446, + "src": "12000:13:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "typeName": { + "id": 1375, + "name": "bytes16", + "nodeType": "ElementaryTypeName", + "src": "12000:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "visibility": "internal" + } + ], + "src": "11999:15:8" + }, + "returnParameters": { + "id": 1380, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1379, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1446, + "src": "12038:7:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "typeName": { + "id": 1378, + "name": "bytes16", + "nodeType": "ElementaryTypeName", + "src": "12038:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "visibility": "internal" + } + ], + "src": "12037:9:8" + }, + "scope": 1632, + "src": "11976:661:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1500, + "nodeType": "Block", + "src": "12782:303:8", + "statements": [ + { + "expression": { + "id": 1470, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1454, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1449, + "src": "12792:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1469, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1460, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1457, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1455, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1449, + "src": "12802:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307846463030464630304646303046463030", + "id": 1456, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12810:18:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_18374966859414961920_by_1", + "typeString": "int_const 18374966859414961920" + }, + "value": "0xFF00FF00FF00FF00" + }, + "src": "12802:26:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1458, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12801:28:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "38", + "id": 1459, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12833:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "12801:33:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1461, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12800:35:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1467, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1464, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1462, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1449, + "src": "12840:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830304646303046463030464630304646", + "id": 1463, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12848:18:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_71777214294589695_by_1", + "typeString": "int_const 71777214294589695" + }, + "value": "0x00FF00FF00FF00FF" + }, + "src": "12840:26:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1465, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12839:28:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "38", + "id": 1466, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12871:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "12839:33:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1468, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12838:35:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "src": "12800:73:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "src": "12792:81:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "id": 1471, + "nodeType": "ExpressionStatement", + "src": "12792:81:8" + }, + { + "expression": { + "id": 1488, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1472, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1449, + "src": "12897:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1487, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1478, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1475, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1473, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1449, + "src": "12907:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307846464646303030304646464630303030", + "id": 1474, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12915:18:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_18446462603027742720_by_1", + "typeString": "int_const 18446462603027742720" + }, + "value": "0xFFFF0000FFFF0000" + }, + "src": "12907:26:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1476, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12906:28:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "3136", + "id": 1477, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12938:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "12906:34:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1479, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12905:36:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1485, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1482, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1480, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1449, + "src": "12946:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307830303030464646463030303046464646", + "id": 1481, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12954:18:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_281470681808895_by_1", + "typeString": "int_const 281470681808895" + }, + "value": "0x0000FFFF0000FFFF" + }, + "src": "12946:26:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1483, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12945:28:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3136", + "id": 1484, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12977:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "12945:34:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1486, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12944:36:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "src": "12905:75:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "src": "12897:83:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "id": 1489, + "nodeType": "ExpressionStatement", + "src": "12897:83:8" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1498, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1492, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1490, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1449, + "src": "13024:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "3332", + "id": 1491, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13033:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "13024:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1493, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13023:13:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "id": 1496, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1494, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1449, + "src": "13040:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3332", + "id": 1495, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13049:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "13040:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + } + ], + "id": 1497, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13039:13:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "src": "13023:29:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "functionReturnParameters": 1453, + "id": 1499, + "nodeType": "Return", + "src": "13016:36:8" + } + ] + }, + "documentation": { + "id": 1447, + "nodeType": "StructuredDocumentation", + "src": "12643:66:8", + "text": "@dev Same as {reverseBytes32} but optimized for 64-bit values." + }, + "id": 1501, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "reverseBytes8", + "nameLocation": "12723:13:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1450, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1449, + "mutability": "mutable", + "name": "value", + "nameLocation": "12744:5:8", + "nodeType": "VariableDeclaration", + "scope": 1501, + "src": "12737:12:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "typeName": { + "id": 1448, + "name": "bytes8", + "nodeType": "ElementaryTypeName", + "src": "12737:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "visibility": "internal" + } + ], + "src": "12736:14:8" + }, + "returnParameters": { + "id": 1453, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1452, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1501, + "src": "12774:6:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + }, + "typeName": { + "id": 1451, + "name": "bytes8", + "nodeType": "ElementaryTypeName", + "src": "12774:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes8", + "typeString": "bytes8" + } + }, + "visibility": "internal" + } + ], + "src": "12773:8:8" + }, + "scope": 1632, + "src": "12714:371:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1537, + "nodeType": "Block", + "src": "13230:168:8", + "statements": [ + { + "expression": { + "id": 1525, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1509, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1504, + "src": "13240:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "id": 1524, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "id": 1515, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "id": 1512, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1510, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1504, + "src": "13250:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30784646303046463030", + "id": 1511, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13258:10:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_4278255360_by_1", + "typeString": "int_const 4278255360" + }, + "value": "0xFF00FF00" + }, + "src": "13250:18:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + } + ], + "id": 1513, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13249:20:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "38", + "id": 1514, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13273:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "13249:25:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + } + ], + "id": 1516, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13248:27:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "id": 1522, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "id": 1519, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1517, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1504, + "src": "13280:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30783030464630304646", + "id": 1518, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13288:10:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_16711935_by_1", + "typeString": "int_const 16711935" + }, + "value": "0x00FF00FF" + }, + "src": "13280:18:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + } + ], + "id": 1520, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13279:20:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "38", + "id": 1521, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13303:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "13279:25:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + } + ], + "id": 1523, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13278:27:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "src": "13248:57:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "src": "13240:65:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "id": 1526, + "nodeType": "ExpressionStatement", + "src": "13240:65:8" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "id": 1535, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "id": 1529, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1527, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1504, + "src": "13337:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "3136", + "id": 1528, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13346:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "13337:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + } + ], + "id": 1530, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13336:13:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "id": 1533, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1531, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1504, + "src": "13353:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3136", + "id": 1532, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13362:2:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "13353:11:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + } + ], + "id": 1534, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13352:13:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "src": "13336:29:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "functionReturnParameters": 1508, + "id": 1536, + "nodeType": "Return", + "src": "13329:36:8" + } + ] + }, + "documentation": { + "id": 1502, + "nodeType": "StructuredDocumentation", + "src": "13091:66:8", + "text": "@dev Same as {reverseBytes32} but optimized for 32-bit values." + }, + "id": 1538, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "reverseBytes4", + "nameLocation": "13171:13:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1505, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1504, + "mutability": "mutable", + "name": "value", + "nameLocation": "13192:5:8", + "nodeType": "VariableDeclaration", + "scope": 1538, + "src": "13185:12:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "typeName": { + "id": 1503, + "name": "bytes4", + "nodeType": "ElementaryTypeName", + "src": "13185:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "visibility": "internal" + } + ], + "src": "13184:14:8" + }, + "returnParameters": { + "id": 1508, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1507, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1538, + "src": "13222:6:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "typeName": { + "id": 1506, + "name": "bytes4", + "nodeType": "ElementaryTypeName", + "src": "13222:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "visibility": "internal" + } + ], + "src": "13221:8:8" + }, + "scope": 1632, + "src": "13162:236:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1556, + "nodeType": "Block", + "src": "13543:51:8", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + }, + "id": 1554, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + }, + "id": 1548, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1546, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1541, + "src": "13561:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "38", + "id": 1547, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13570:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "13561:10:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + } + ], + "id": 1549, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13560:12:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + }, + "id": 1552, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1550, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1541, + "src": "13576:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "38", + "id": 1551, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13585:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "13576:10:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + } + ], + "id": 1553, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13575:12:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "src": "13560:27:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "functionReturnParameters": 1545, + "id": 1555, + "nodeType": "Return", + "src": "13553:34:8" + } + ] + }, + "documentation": { + "id": 1539, + "nodeType": "StructuredDocumentation", + "src": "13404:66:8", + "text": "@dev Same as {reverseBytes32} but optimized for 16-bit values." + }, + "id": 1557, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "reverseBytes2", + "nameLocation": "13484:13:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1542, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1541, + "mutability": "mutable", + "name": "value", + "nameLocation": "13505:5:8", + "nodeType": "VariableDeclaration", + "scope": 1557, + "src": "13498:12:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + }, + "typeName": { + "id": 1540, + "name": "bytes2", + "nodeType": "ElementaryTypeName", + "src": "13498:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "visibility": "internal" + } + ], + "src": "13497:14:8" + }, + "returnParameters": { + "id": 1545, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1544, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1557, + "src": "13535:6:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + }, + "typeName": { + "id": 1543, + "name": "bytes2", + "nodeType": "ElementaryTypeName", + "src": "13535:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "visibility": "internal" + } + ], + "src": "13534:8:8" + }, + "scope": 1632, + "src": "13475:119:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1618, + "nodeType": "Block", + "src": "13811:313:8", + "statements": [ + { + "body": { + "id": 1611, + "nodeType": "Block", + "src": "13871:213:8", + "statements": [ + { + "assignments": [ + 1578 + ], + "declarations": [ + { + "constant": false, + "id": 1578, + "mutability": "mutable", + "name": "chunk", + "nameLocation": "13893:5:8", + "nodeType": "VariableDeclaration", + "scope": 1611, + "src": "13885:13:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 1577, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "13885:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 1583, + "initialValue": { + "arguments": [ + { + "id": 1580, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1560, + "src": "13924:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 1581, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1566, + "src": "13932:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1579, + "name": "_unsafeReadBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1631, + "src": "13901:22:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (bytes memory,uint256) pure returns (bytes32)" + } + }, + "id": 1582, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13901:33:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "13885:49:8" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 1589, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1584, + "name": "chunk", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1578, + "src": "13952:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 1587, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13969:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 1586, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "13961:7:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes32_$", + "typeString": "type(bytes32)" + }, + "typeName": { + "id": 1585, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "13961:7:8", + "typeDescriptions": {} + } + }, + "id": 1588, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13961:10:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "13952:19:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 1610, + "nodeType": "IfStatement", + "src": "13948:126:8", + "trueBody": { + "id": 1609, + "nodeType": "Block", + "src": "13973:101:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1602, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1594, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "38", + "id": 1592, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14007:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 1593, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1566, + "src": "14011:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "14007:5:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "arguments": [ + { + "arguments": [ + { + "id": 1599, + "name": "chunk", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1578, + "src": "14032:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 1598, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "14024:7:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 1597, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "14024:7:8", + "typeDescriptions": {} + } + }, + "id": 1600, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14024:14:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1595, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "14015:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1596, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "14020:3:8", + "memberName": "clz", + "nodeType": "MemberAccess", + "referencedDeclaration": 6203, + "src": "14015:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256) pure returns (uint256)" + } + }, + "id": 1601, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14015:24:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "14007:32:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1606, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "38", + "id": 1603, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14041:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "expression": { + "id": 1604, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1560, + "src": "14045:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1605, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "14052:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "14045:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "14041:17:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 1590, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "13998:4:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 1591, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "14003:3:8", + "memberName": "min", + "nodeType": "MemberAccess", + "referencedDeclaration": 4874, + "src": "13998:8:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1607, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13998:61:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 1564, + "id": 1608, + "nodeType": "Return", + "src": "13991:68:8" + } + ] + } + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1572, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1569, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1566, + "src": "13841:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "expression": { + "id": 1570, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1560, + "src": "13845:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1571, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "13852:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "13845:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "13841:17:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 1612, + "initializationExpression": { + "assignments": [ + 1566 + ], + "declarations": [ + { + "constant": false, + "id": 1566, + "mutability": "mutable", + "name": "i", + "nameLocation": "13834:1:8", + "nodeType": "VariableDeclaration", + "scope": 1612, + "src": "13826:9:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1565, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13826:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 1568, + "initialValue": { + "hexValue": "30", + "id": 1567, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13838:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "13826:13:8" + }, + "isSimpleCounterLoop": false, + "loopExpression": { + "expression": { + "id": 1575, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 1573, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1566, + "src": "13860:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "hexValue": "30783230", + "id": 1574, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13865:4:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "0x20" + }, + "src": "13860:9:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1576, + "nodeType": "ExpressionStatement", + "src": "13860:9:8" + }, + "nodeType": "ForStatement", + "src": "13821:263:8" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1616, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "38", + "id": 1613, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14100:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "expression": { + "id": 1614, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1560, + "src": "14104:6:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1615, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "14111:6:8", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "14104:13:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "14100:17:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 1564, + "id": 1617, + "nodeType": "Return", + "src": "14093:24:8" + } + ] + }, + "documentation": { + "id": 1558, + "nodeType": "StructuredDocumentation", + "src": "13600:140:8", + "text": " @dev Counts the number of leading zero bits a bytes array. Returns `8 * buffer.length`\n if the buffer is all zeros." + }, + "id": 1619, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "clz", + "nameLocation": "13754:3:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1561, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1560, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "13771:6:8", + "nodeType": "VariableDeclaration", + "scope": 1619, + "src": "13758:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1559, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "13758:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "13757:21:8" + }, + "returnParameters": { + "id": 1564, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1563, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1619, + "src": "13802:7:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1562, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13802:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "13801:9:8" + }, + "scope": 1632, + "src": "13745:379:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1630, + "nodeType": "Block", + "src": "14509:225:8", + "statements": [ + { + "AST": { + "nativeSrc": "14658:70:8", + "nodeType": "YulBlock", + "src": "14658:70:8", + "statements": [ + { + "nativeSrc": "14672:46:8", + "nodeType": "YulAssignment", + "src": "14672:46:8", + "value": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "14695:6:8", + "nodeType": "YulIdentifier", + "src": "14695:6:8" + }, + { + "kind": "number", + "nativeSrc": "14703:4:8", + "nodeType": "YulLiteral", + "src": "14703:4:8", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "14691:3:8", + "nodeType": "YulIdentifier", + "src": "14691:3:8" + }, + "nativeSrc": "14691:17:8", + "nodeType": "YulFunctionCall", + "src": "14691:17:8" + }, + { + "name": "offset", + "nativeSrc": "14710:6:8", + "nodeType": "YulIdentifier", + "src": "14710:6:8" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "14687:3:8", + "nodeType": "YulIdentifier", + "src": "14687:3:8" + }, + "nativeSrc": "14687:30:8", + "nodeType": "YulFunctionCall", + "src": "14687:30:8" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "14681:5:8", + "nodeType": "YulIdentifier", + "src": "14681:5:8" + }, + "nativeSrc": "14681:37:8", + "nodeType": "YulFunctionCall", + "src": "14681:37:8" + }, + "variableNames": [ + { + "name": "value", + "nativeSrc": "14672:5:8", + "nodeType": "YulIdentifier", + "src": "14672:5:8" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 1622, + "isOffset": false, + "isSlot": false, + "src": "14695:6:8", + "valueSize": 1 + }, + { + "declaration": 1624, + "isOffset": false, + "isSlot": false, + "src": "14710:6:8", + "valueSize": 1 + }, + { + "declaration": 1627, + "isOffset": false, + "isSlot": false, + "src": "14672:5:8", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 1629, + "nodeType": "InlineAssembly", + "src": "14633:95:8" + } + ] + }, + "documentation": { + "id": 1620, + "nodeType": "StructuredDocumentation", + "src": "14130:268:8", + "text": " @dev Reads a bytes32 from a bytes array without bounds checking.\n NOTE: making this function internal would mean it could be used with memory unsafe offset, and marking the\n assembly block as such would prevent some optimizations." + }, + "id": 1631, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_unsafeReadBytesOffset", + "nameLocation": "14412:22:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1625, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1622, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "14448:6:8", + "nodeType": "VariableDeclaration", + "scope": 1631, + "src": "14435:19:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1621, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "14435:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1624, + "mutability": "mutable", + "name": "offset", + "nameLocation": "14464:6:8", + "nodeType": "VariableDeclaration", + "scope": 1631, + "src": "14456:14:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1623, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "14456:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "14434:37:8" + }, + "returnParameters": { + "id": 1628, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1627, + "mutability": "mutable", + "name": "value", + "nameLocation": "14502:5:8", + "nodeType": "VariableDeclaration", + "scope": 1631, + "src": "14494:13:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 1626, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "14494:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "14493:15:8" + }, + "scope": 1632, + "src": "14403:331:8", + "stateMutability": "pure", + "virtual": false, + "visibility": "private" + } + ], + "scope": 1633, + "src": "198:14538:8", + "usedErrors": [], + "usedEvents": [] + } + ], + "src": "99:14638:8" + }, + "id": 8 + }, + "@openzeppelin/contracts/utils/Context.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/Context.sol", + "exportedSymbols": { + "Context": [ + 1662 + ] + }, + "id": 1663, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1634, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "101:24:9" + }, + { + "abstract": true, + "baseContracts": [], + "canonicalName": "Context", + "contractDependencies": [], + "contractKind": "contract", + "documentation": { + "id": 1635, + "nodeType": "StructuredDocumentation", + "src": "127:496:9", + "text": " @dev Provides information about the current execution context, including the\n sender of the transaction and its data. While these are generally available\n via msg.sender and msg.data, they should not be accessed in such a direct\n manner, since when dealing with meta-transactions the account sending and\n paying for execution may not be the actual sender (as far as an application\n is concerned).\n This contract is only required for intermediate, library-like contracts." + }, + "fullyImplemented": true, + "id": 1662, + "linearizedBaseContracts": [ + 1662 + ], + "name": "Context", + "nameLocation": "642:7:9", + "nodeType": "ContractDefinition", + "nodes": [ + { + "body": { + "id": 1643, + "nodeType": "Block", + "src": "718:34:9", + "statements": [ + { + "expression": { + "expression": { + "id": 1640, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -15, + "src": "735:3:9", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 1641, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "739:6:9", + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "735:10:9", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 1639, + "id": 1642, + "nodeType": "Return", + "src": "728:17:9" + } + ] + }, + "id": 1644, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_msgSender", + "nameLocation": "665:10:9", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1636, + "nodeType": "ParameterList", + "parameters": [], + "src": "675:2:9" + }, + "returnParameters": { + "id": 1639, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1638, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1644, + "src": "709:7:9", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 1637, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "709:7:9", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "708:9:9" + }, + "scope": 1662, + "src": "656:96:9", + "stateMutability": "view", + "virtual": true, + "visibility": "internal" + }, + { + "body": { + "id": 1652, + "nodeType": "Block", + "src": "825:32:9", + "statements": [ + { + "expression": { + "expression": { + "id": 1649, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -15, + "src": "842:3:9", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 1650, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "846:4:9", + "memberName": "data", + "nodeType": "MemberAccess", + "src": "842:8:9", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + } + }, + "functionReturnParameters": 1648, + "id": 1651, + "nodeType": "Return", + "src": "835:15:9" + } + ] + }, + "id": 1653, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_msgData", + "nameLocation": "767:8:9", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1645, + "nodeType": "ParameterList", + "parameters": [], + "src": "775:2:9" + }, + "returnParameters": { + "id": 1648, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1647, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1653, + "src": "809:14:9", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1646, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "809:5:9", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "808:16:9" + }, + "scope": 1662, + "src": "758:99:9", + "stateMutability": "view", + "virtual": true, + "visibility": "internal" + }, + { + "body": { + "id": 1660, + "nodeType": "Block", + "src": "935:25:9", + "statements": [ + { + "expression": { + "hexValue": "30", + "id": 1658, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "952:1:9", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "functionReturnParameters": 1657, + "id": 1659, + "nodeType": "Return", + "src": "945:8:9" + } + ] + }, + "id": 1661, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_contextSuffixLength", + "nameLocation": "872:20:9", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1654, + "nodeType": "ParameterList", + "parameters": [], + "src": "892:2:9" + }, + "returnParameters": { + "id": 1657, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1656, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1661, + "src": "926:7:9", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1655, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "926:7:9", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "925:9:9" + }, + "scope": 1662, + "src": "863:97:9", + "stateMutability": "view", + "virtual": true, + "visibility": "internal" + } + ], + "scope": 1663, + "src": "624:338:9", + "usedErrors": [], + "usedEvents": [] + } + ], + "src": "101:862:9" + }, + "id": 9 + }, + "@openzeppelin/contracts/utils/Panic.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/Panic.sol", + "exportedSymbols": { + "Panic": [ + 1714 + ] + }, + "id": 1715, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1664, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "99:24:10" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "Panic", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 1665, + "nodeType": "StructuredDocumentation", + "src": "125:489:10", + "text": " @dev Helper library for emitting standardized panic codes.\n ```solidity\n contract Example {\n using Panic for uint256;\n // Use any of the declared internal constants\n function foo() { Panic.GENERIC.panic(); }\n // Alternatively\n function foo() { Panic.panic(Panic.GENERIC); }\n }\n ```\n Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil].\n _Available since v5.1._" + }, + "fullyImplemented": true, + "id": 1714, + "linearizedBaseContracts": [ + 1714 + ], + "name": "Panic", + "nameLocation": "665:5:10", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": true, + "documentation": { + "id": 1666, + "nodeType": "StructuredDocumentation", + "src": "677:36:10", + "text": "@dev generic / unspecified error" + }, + "id": 1669, + "mutability": "constant", + "name": "GENERIC", + "nameLocation": "744:7:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "718:40:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1667, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "718:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783030", + "id": 1668, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "754:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0x00" + }, + "visibility": "internal" + }, + { + "constant": true, + "documentation": { + "id": 1670, + "nodeType": "StructuredDocumentation", + "src": "764:37:10", + "text": "@dev used by the assert() builtin" + }, + "id": 1673, + "mutability": "constant", + "name": "ASSERT", + "nameLocation": "832:6:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "806:39:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1671, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "806:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783031", + "id": 1672, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "841:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "0x01" + }, + "visibility": "internal" + }, + { + "constant": true, + "documentation": { + "id": 1674, + "nodeType": "StructuredDocumentation", + "src": "851:41:10", + "text": "@dev arithmetic underflow or overflow" + }, + "id": 1677, + "mutability": "constant", + "name": "UNDER_OVERFLOW", + "nameLocation": "923:14:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "897:47:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1675, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "897:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783131", + "id": 1676, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "940:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_17_by_1", + "typeString": "int_const 17" + }, + "value": "0x11" + }, + "visibility": "internal" + }, + { + "constant": true, + "documentation": { + "id": 1678, + "nodeType": "StructuredDocumentation", + "src": "950:35:10", + "text": "@dev division or modulo by zero" + }, + "id": 1681, + "mutability": "constant", + "name": "DIVISION_BY_ZERO", + "nameLocation": "1016:16:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "990:49:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1679, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "990:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783132", + "id": 1680, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1035:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_18_by_1", + "typeString": "int_const 18" + }, + "value": "0x12" + }, + "visibility": "internal" + }, + { + "constant": true, + "documentation": { + "id": 1682, + "nodeType": "StructuredDocumentation", + "src": "1045:30:10", + "text": "@dev enum conversion error" + }, + "id": 1685, + "mutability": "constant", + "name": "ENUM_CONVERSION_ERROR", + "nameLocation": "1106:21:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "1080:54:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1683, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1080:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783231", + "id": 1684, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1130:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_33_by_1", + "typeString": "int_const 33" + }, + "value": "0x21" + }, + "visibility": "internal" + }, + { + "constant": true, + "documentation": { + "id": 1686, + "nodeType": "StructuredDocumentation", + "src": "1140:36:10", + "text": "@dev invalid encoding in storage" + }, + "id": 1689, + "mutability": "constant", + "name": "STORAGE_ENCODING_ERROR", + "nameLocation": "1207:22:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "1181:55:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1687, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1181:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783232", + "id": 1688, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1232:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_34_by_1", + "typeString": "int_const 34" + }, + "value": "0x22" + }, + "visibility": "internal" + }, + { + "constant": true, + "documentation": { + "id": 1690, + "nodeType": "StructuredDocumentation", + "src": "1242:24:10", + "text": "@dev empty array pop" + }, + "id": 1693, + "mutability": "constant", + "name": "EMPTY_ARRAY_POP", + "nameLocation": "1297:15:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "1271:48:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1691, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1271:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783331", + "id": 1692, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1315:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_49_by_1", + "typeString": "int_const 49" + }, + "value": "0x31" + }, + "visibility": "internal" + }, + { + "constant": true, + "documentation": { + "id": 1694, + "nodeType": "StructuredDocumentation", + "src": "1325:35:10", + "text": "@dev array out of bounds access" + }, + "id": 1697, + "mutability": "constant", + "name": "ARRAY_OUT_OF_BOUNDS", + "nameLocation": "1391:19:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "1365:52:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1695, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1365:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783332", + "id": 1696, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1413:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_50_by_1", + "typeString": "int_const 50" + }, + "value": "0x32" + }, + "visibility": "internal" + }, + { + "constant": true, + "documentation": { + "id": 1698, + "nodeType": "StructuredDocumentation", + "src": "1423:65:10", + "text": "@dev resource error (too large allocation or too large array)" + }, + "id": 1701, + "mutability": "constant", + "name": "RESOURCE_ERROR", + "nameLocation": "1519:14:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "1493:47:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1699, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1493:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783431", + "id": 1700, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1536:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_65_by_1", + "typeString": "int_const 65" + }, + "value": "0x41" + }, + "visibility": "internal" + }, + { + "constant": true, + "documentation": { + "id": 1702, + "nodeType": "StructuredDocumentation", + "src": "1546:42:10", + "text": "@dev calling invalid internal function" + }, + "id": 1705, + "mutability": "constant", + "name": "INVALID_INTERNAL_FUNCTION", + "nameLocation": "1619:25:10", + "nodeType": "VariableDeclaration", + "scope": 1714, + "src": "1593:58:10", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1703, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1593:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "30783531", + "id": 1704, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1647:4:10", + "typeDescriptions": { + "typeIdentifier": "t_rational_81_by_1", + "typeString": "int_const 81" + }, + "value": "0x51" + }, + "visibility": "internal" + }, + { + "body": { + "id": 1712, + "nodeType": "Block", + "src": "1819:151:10", + "statements": [ + { + "AST": { + "nativeSrc": "1854:110:10", + "nodeType": "YulBlock", + "src": "1854:110:10", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1875:4:10", + "nodeType": "YulLiteral", + "src": "1875:4:10", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "1881:10:10", + "nodeType": "YulLiteral", + "src": "1881:10:10", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1868:6:10", + "nodeType": "YulIdentifier", + "src": "1868:6:10" + }, + "nativeSrc": "1868:24:10", + "nodeType": "YulFunctionCall", + "src": "1868:24:10" + }, + "nativeSrc": "1868:24:10", + "nodeType": "YulExpressionStatement", + "src": "1868:24:10" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1912:4:10", + "nodeType": "YulLiteral", + "src": "1912:4:10", + "type": "", + "value": "0x20" + }, + { + "name": "code", + "nativeSrc": "1918:4:10", + "nodeType": "YulIdentifier", + "src": "1918:4:10" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1905:6:10", + "nodeType": "YulIdentifier", + "src": "1905:6:10" + }, + "nativeSrc": "1905:18:10", + "nodeType": "YulFunctionCall", + "src": "1905:18:10" + }, + "nativeSrc": "1905:18:10", + "nodeType": "YulExpressionStatement", + "src": "1905:18:10" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1943:4:10", + "nodeType": "YulLiteral", + "src": "1943:4:10", + "type": "", + "value": "0x1c" + }, + { + "kind": "number", + "nativeSrc": "1949:4:10", + "nodeType": "YulLiteral", + "src": "1949:4:10", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "1936:6:10", + "nodeType": "YulIdentifier", + "src": "1936:6:10" + }, + "nativeSrc": "1936:18:10", + "nodeType": "YulFunctionCall", + "src": "1936:18:10" + }, + "nativeSrc": "1936:18:10", + "nodeType": "YulExpressionStatement", + "src": "1936:18:10" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 1708, + "isOffset": false, + "isSlot": false, + "src": "1918:4:10", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 1711, + "nodeType": "InlineAssembly", + "src": "1829:135:10" + } + ] + }, + "documentation": { + "id": 1706, + "nodeType": "StructuredDocumentation", + "src": "1658:113:10", + "text": "@dev Reverts with a panic code. Recommended to use with\n the internal constants with predefined codes." + }, + "id": 1713, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "panic", + "nameLocation": "1785:5:10", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1709, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1708, + "mutability": "mutable", + "name": "code", + "nameLocation": "1799:4:10", + "nodeType": "VariableDeclaration", + "scope": 1713, + "src": "1791:12:10", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1707, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1791:7:10", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1790:14:10" + }, + "returnParameters": { + "id": 1710, + "nodeType": "ParameterList", + "parameters": [], + "src": "1819:0:10" + }, + "scope": 1714, + "src": "1776:194:10", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + } + ], + "scope": 1715, + "src": "657:1315:10", + "usedErrors": [], + "usedEvents": [] + } + ], + "src": "99:1874:10" + }, + "id": 10 + }, + "@openzeppelin/contracts/utils/ReentrancyGuard.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/ReentrancyGuard.sol", + "exportedSymbols": { + "ReentrancyGuard": [ + 1827 + ], + "StorageSlot": [ + 2168 + ] + }, + "id": 1828, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1716, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "109:24:11" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/StorageSlot.sol", + "file": "./StorageSlot.sol", + "id": 1718, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 1828, + "sourceUnit": 2169, + "src": "135:46:11", + "symbolAliases": [ + { + "foreign": { + "id": 1717, + "name": "StorageSlot", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2168, + "src": "143:11:11", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": true, + "baseContracts": [], + "canonicalName": "ReentrancyGuard", + "contractDependencies": [], + "contractKind": "contract", + "documentation": { + "id": 1719, + "nodeType": "StructuredDocumentation", + "src": "183:1066:11", + "text": " @dev Contract module that helps prevent reentrant calls to a function.\n Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n available, which can be applied to functions to make sure there are no nested\n (reentrant) calls to them.\n Note that because there is a single `nonReentrant` guard, functions marked as\n `nonReentrant` may not call one another. This can be worked around by making\n those functions `private`, and then adding `external` `nonReentrant` entry\n points to them.\n TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,\n consider using {ReentrancyGuardTransient} instead.\n TIP: If you would like to learn more about reentrancy and alternative ways\n to protect against it, check out our blog post\n https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n IMPORTANT: Deprecated. This storage-based reentrancy guard will be removed and replaced\n by the {ReentrancyGuardTransient} variant in v6.0.\n @custom:stateless" + }, + "fullyImplemented": true, + "id": 1827, + "linearizedBaseContracts": [ + 1827 + ], + "name": "ReentrancyGuard", + "nameLocation": "1268:15:11", + "nodeType": "ContractDefinition", + "nodes": [ + { + "global": false, + "id": 1722, + "libraryName": { + "id": 1720, + "name": "StorageSlot", + "nameLocations": [ + "1296:11:11" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2168, + "src": "1296:11:11" + }, + "nodeType": "UsingForDirective", + "src": "1290:30:11", + "typeName": { + "id": 1721, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1312:7:11", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + }, + { + "constant": true, + "id": 1725, + "mutability": "constant", + "name": "REENTRANCY_GUARD_STORAGE", + "nameLocation": "1470:24:11", + "nodeType": "VariableDeclaration", + "scope": 1827, + "src": "1445:126:11", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 1723, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1445:7:11", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": { + "hexValue": "307839623737396231373432326430646639323232333031386233326234643166613436653037313732336436383137653234383664303033626563633535663030", + "id": 1724, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1505:66:11", + "typeDescriptions": { + "typeIdentifier": "t_rational_70319816728846589445362000750570655803700195216363692647688146666176345628416_by_1", + "typeString": "int_const 7031...(69 digits omitted)...8416" + }, + "value": "0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00" + }, + "visibility": "private" + }, + { + "constant": true, + "id": 1728, + "mutability": "constant", + "name": "NOT_ENTERED", + "nameLocation": "2351:11:11", + "nodeType": "VariableDeclaration", + "scope": 1827, + "src": "2326:40:11", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1726, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2326:7:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "31", + "id": 1727, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2365:1:11", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "visibility": "private" + }, + { + "constant": true, + "id": 1731, + "mutability": "constant", + "name": "ENTERED", + "nameLocation": "2397:7:11", + "nodeType": "VariableDeclaration", + "scope": 1827, + "src": "2372:36:11", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1729, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2372:7:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "32", + "id": 1730, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2407:1:11", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "visibility": "private" + }, + { + "documentation": { + "id": 1732, + "nodeType": "StructuredDocumentation", + "src": "2415:52:11", + "text": " @dev Unauthorized reentrant call." + }, + "errorSelector": "3ee5aeb5", + "id": 1734, + "name": "ReentrancyGuardReentrantCall", + "nameLocation": "2478:28:11", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 1733, + "nodeType": "ParameterList", + "parameters": [], + "src": "2506:2:11" + }, + "src": "2472:37:11" + }, + { + "body": { + "id": 1745, + "nodeType": "Block", + "src": "2529:83:11", + "statements": [ + { + "expression": { + "id": 1743, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1737, + "name": "_reentrancyGuardStorageSlot", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1826, + "src": "2539:27:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$__$returns$_t_bytes32_$", + "typeString": "function () pure returns (bytes32)" + } + }, + "id": 1738, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2539:29:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 1739, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2569:14:11", + "memberName": "getUint256Slot", + "nodeType": "MemberAccess", + "referencedDeclaration": 2112, + "src": "2539:44:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$_t_struct$_Uint256Slot_$2059_storage_ptr_$attached_to$_t_bytes32_$", + "typeString": "function (bytes32) pure returns (struct StorageSlot.Uint256Slot storage pointer)" + } + }, + "id": 1740, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2539:46:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_struct$_Uint256Slot_$2059_storage_ptr", + "typeString": "struct StorageSlot.Uint256Slot storage pointer" + } + }, + "id": 1741, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberLocation": "2586:5:11", + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": 2058, + "src": "2539:52:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 1742, + "name": "NOT_ENTERED", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1728, + "src": "2594:11:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2539:66:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1744, + "nodeType": "ExpressionStatement", + "src": "2539:66:11" + } + ] + }, + "id": 1746, + "implemented": true, + "kind": "constructor", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1735, + "nodeType": "ParameterList", + "parameters": [], + "src": "2526:2:11" + }, + "returnParameters": { + "id": 1736, + "nodeType": "ParameterList", + "parameters": [], + "src": "2529:0:11" + }, + "scope": 1827, + "src": "2515:97:11", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1756, + "nodeType": "Block", + "src": "3013:79:11", + "statements": [ + { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1749, + "name": "_nonReentrantBefore", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1791, + "src": "3023:19:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$__$returns$__$", + "typeString": "function ()" + } + }, + "id": 1750, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3023:21:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1751, + "nodeType": "ExpressionStatement", + "src": "3023:21:11" + }, + { + "id": 1752, + "nodeType": "PlaceholderStatement", + "src": "3054:1:11" + }, + { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1753, + "name": "_nonReentrantAfter", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1803, + "src": "3065:18:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$__$returns$__$", + "typeString": "function ()" + } + }, + "id": 1754, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3065:20:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1755, + "nodeType": "ExpressionStatement", + "src": "3065:20:11" + } + ] + }, + "documentation": { + "id": 1747, + "nodeType": "StructuredDocumentation", + "src": "2618:366:11", + "text": " @dev Prevents a contract from calling itself, directly or indirectly.\n Calling a `nonReentrant` function from another `nonReentrant`\n function is not supported. It is possible to prevent this from happening\n by making the `nonReentrant` function external, and making it call a\n `private` function that does the actual work." + }, + "id": 1757, + "name": "nonReentrant", + "nameLocation": "2998:12:11", + "nodeType": "ModifierDefinition", + "parameters": { + "id": 1748, + "nodeType": "ParameterList", + "parameters": [], + "src": "3010:2:11" + }, + "src": "2989:103:11", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1764, + "nodeType": "Block", + "src": "3527:53:11", + "statements": [ + { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1760, + "name": "_nonReentrantBeforeView", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1776, + "src": "3537:23:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$__$", + "typeString": "function () view" + } + }, + "id": 1761, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3537:25:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1762, + "nodeType": "ExpressionStatement", + "src": "3537:25:11" + }, + { + "id": 1763, + "nodeType": "PlaceholderStatement", + "src": "3572:1:11" + } + ] + }, + "documentation": { + "id": 1758, + "nodeType": "StructuredDocumentation", + "src": "3098:396:11", + "text": " @dev A `view` only version of {nonReentrant}. Use to block view functions\n from being called, preventing reading from inconsistent contract state.\n CAUTION: This is a \"view\" modifier and does not change the reentrancy\n status. Use it only on view functions. For payable or non-payable functions,\n use the standard {nonReentrant} modifier instead." + }, + "id": 1765, + "name": "nonReentrantView", + "nameLocation": "3508:16:11", + "nodeType": "ModifierDefinition", + "parameters": { + "id": 1759, + "nodeType": "ParameterList", + "parameters": [], + "src": "3524:2:11" + }, + "src": "3499:81:11", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1775, + "nodeType": "Block", + "src": "3634:109:11", + "statements": [ + { + "condition": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1768, + "name": "_reentrancyGuardEntered", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1818, + "src": "3648:23:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_bool_$", + "typeString": "function () view returns (bool)" + } + }, + "id": 1769, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3648:25:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 1774, + "nodeType": "IfStatement", + "src": "3644:93:11", + "trueBody": { + "id": 1773, + "nodeType": "Block", + "src": "3675:62:11", + "statements": [ + { + "errorCall": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1770, + "name": "ReentrancyGuardReentrantCall", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1734, + "src": "3696:28:11", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$__$returns$_t_error_$", + "typeString": "function () pure returns (error)" + } + }, + "id": 1771, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3696:30:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 1772, + "nodeType": "RevertStatement", + "src": "3689:37:11" + } + ] + } + } + ] + }, + "id": 1776, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_nonReentrantBeforeView", + "nameLocation": "3595:23:11", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1766, + "nodeType": "ParameterList", + "parameters": [], + "src": "3618:2:11" + }, + "returnParameters": { + "id": 1767, + "nodeType": "ParameterList", + "parameters": [], + "src": "3634:0:11" + }, + "scope": 1827, + "src": "3586:157:11", + "stateMutability": "view", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 1790, + "nodeType": "Block", + "src": "3788:253:11", + "statements": [ + { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1779, + "name": "_nonReentrantBeforeView", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1776, + "src": "3872:23:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$__$", + "typeString": "function () view" + } + }, + "id": 1780, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3872:25:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1781, + "nodeType": "ExpressionStatement", + "src": "3872:25:11" + }, + { + "expression": { + "id": 1788, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1782, + "name": "_reentrancyGuardStorageSlot", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1826, + "src": "3972:27:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$__$returns$_t_bytes32_$", + "typeString": "function () pure returns (bytes32)" + } + }, + "id": 1783, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3972:29:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 1784, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4002:14:11", + "memberName": "getUint256Slot", + "nodeType": "MemberAccess", + "referencedDeclaration": 2112, + "src": "3972:44:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$_t_struct$_Uint256Slot_$2059_storage_ptr_$attached_to$_t_bytes32_$", + "typeString": "function (bytes32) pure returns (struct StorageSlot.Uint256Slot storage pointer)" + } + }, + "id": 1785, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3972:46:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_struct$_Uint256Slot_$2059_storage_ptr", + "typeString": "struct StorageSlot.Uint256Slot storage pointer" + } + }, + "id": 1786, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberLocation": "4019:5:11", + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": 2058, + "src": "3972:52:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 1787, + "name": "ENTERED", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1731, + "src": "4027:7:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3972:62:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1789, + "nodeType": "ExpressionStatement", + "src": "3972:62:11" + } + ] + }, + "id": 1791, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_nonReentrantBefore", + "nameLocation": "3758:19:11", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1777, + "nodeType": "ParameterList", + "parameters": [], + "src": "3777:2:11" + }, + "returnParameters": { + "id": 1778, + "nodeType": "ParameterList", + "parameters": [], + "src": "3788:0:11" + }, + "scope": 1827, + "src": "3749:292:11", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 1802, + "nodeType": "Block", + "src": "4085:215:11", + "statements": [ + { + "expression": { + "id": 1800, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1794, + "name": "_reentrancyGuardStorageSlot", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1826, + "src": "4227:27:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$__$returns$_t_bytes32_$", + "typeString": "function () pure returns (bytes32)" + } + }, + "id": 1795, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4227:29:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 1796, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4257:14:11", + "memberName": "getUint256Slot", + "nodeType": "MemberAccess", + "referencedDeclaration": 2112, + "src": "4227:44:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$_t_struct$_Uint256Slot_$2059_storage_ptr_$attached_to$_t_bytes32_$", + "typeString": "function (bytes32) pure returns (struct StorageSlot.Uint256Slot storage pointer)" + } + }, + "id": 1797, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4227:46:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_struct$_Uint256Slot_$2059_storage_ptr", + "typeString": "struct StorageSlot.Uint256Slot storage pointer" + } + }, + "id": 1798, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberLocation": "4274:5:11", + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": 2058, + "src": "4227:52:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 1799, + "name": "NOT_ENTERED", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1728, + "src": "4282:11:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4227:66:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1801, + "nodeType": "ExpressionStatement", + "src": "4227:66:11" + } + ] + }, + "id": 1803, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_nonReentrantAfter", + "nameLocation": "4056:18:11", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1792, + "nodeType": "ParameterList", + "parameters": [], + "src": "4074:2:11" + }, + "returnParameters": { + "id": 1793, + "nodeType": "ParameterList", + "parameters": [], + "src": "4085:0:11" + }, + "scope": 1827, + "src": "4047:253:11", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 1817, + "nodeType": "Block", + "src": "4543:87:11", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1815, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1809, + "name": "_reentrancyGuardStorageSlot", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1826, + "src": "4560:27:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$__$returns$_t_bytes32_$", + "typeString": "function () pure returns (bytes32)" + } + }, + "id": 1810, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4560:29:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 1811, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4590:14:11", + "memberName": "getUint256Slot", + "nodeType": "MemberAccess", + "referencedDeclaration": 2112, + "src": "4560:44:11", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$_t_struct$_Uint256Slot_$2059_storage_ptr_$attached_to$_t_bytes32_$", + "typeString": "function (bytes32) pure returns (struct StorageSlot.Uint256Slot storage pointer)" + } + }, + "id": 1812, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4560:46:11", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_struct$_Uint256Slot_$2059_storage_ptr", + "typeString": "struct StorageSlot.Uint256Slot storage pointer" + } + }, + "id": 1813, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4607:5:11", + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": 2058, + "src": "4560:52:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 1814, + "name": "ENTERED", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1731, + "src": "4616:7:11", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4560:63:11", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 1808, + "id": 1816, + "nodeType": "Return", + "src": "4553:70:11" + } + ] + }, + "documentation": { + "id": 1804, + "nodeType": "StructuredDocumentation", + "src": "4306:168:11", + "text": " @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n `nonReentrant` function in the call stack." + }, + "id": 1818, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_reentrancyGuardEntered", + "nameLocation": "4488:23:11", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1805, + "nodeType": "ParameterList", + "parameters": [], + "src": "4511:2:11" + }, + "returnParameters": { + "id": 1808, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1807, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1818, + "src": "4537:4:11", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 1806, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "4537:4:11", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "4536:6:11" + }, + "scope": 1827, + "src": "4479:151:11", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1825, + "nodeType": "Block", + "src": "4715:48:11", + "statements": [ + { + "expression": { + "id": 1823, + "name": "REENTRANCY_GUARD_STORAGE", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1725, + "src": "4732:24:11", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 1822, + "id": 1824, + "nodeType": "Return", + "src": "4725:31:11" + } + ] + }, + "id": 1826, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_reentrancyGuardStorageSlot", + "nameLocation": "4645:27:11", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1819, + "nodeType": "ParameterList", + "parameters": [], + "src": "4672:2:11" + }, + "returnParameters": { + "id": 1822, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1821, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1826, + "src": "4706:7:11", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 1820, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "4706:7:11", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "4705:9:11" + }, + "scope": 1827, + "src": "4636:127:11", + "stateMutability": "pure", + "virtual": true, + "visibility": "internal" + } + ], + "scope": 1828, + "src": "1250:3515:11", + "usedErrors": [ + 1734 + ], + "usedEvents": [] + } + ], + "src": "109:4657:11" + }, + "id": 11 + }, + "@openzeppelin/contracts/utils/ShortStrings.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/ShortStrings.sol", + "exportedSymbols": { + "ShortString": [ + 1833 + ], + "ShortStrings": [ + 2044 + ], + "StorageSlot": [ + 2168 + ] + }, + "id": 2045, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1829, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "106:24:12" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/StorageSlot.sol", + "file": "./StorageSlot.sol", + "id": 1831, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 2045, + "sourceUnit": 2169, + "src": "132:46:12", + "symbolAliases": [ + { + "foreign": { + "id": 1830, + "name": "StorageSlot", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2168, + "src": "140:11:12", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "canonicalName": "ShortString", + "id": 1833, + "name": "ShortString", + "nameLocation": "353:11:12", + "nodeType": "UserDefinedValueTypeDefinition", + "src": "348:28:12", + "underlyingType": { + "id": 1832, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "368:7:12", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "ShortStrings", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 1834, + "nodeType": "StructuredDocumentation", + "src": "378:876:12", + "text": " @dev This library provides functions to convert short memory strings\n into a `ShortString` type that can be used as an immutable variable.\n Strings of arbitrary length can be optimized using this library if\n they are short enough (up to 31 bytes) by packing them with their\n length (1 byte) in a single EVM word (32 bytes). Additionally, a\n fallback mechanism can be used for every other case.\n Usage example:\n ```solidity\n contract Named {\n using ShortStrings for *;\n ShortString private immutable _name;\n string private _nameFallback;\n constructor(string memory contractName) {\n _name = contractName.toShortStringWithFallback(_nameFallback);\n }\n function name() external view returns (string memory) {\n return _name.toStringWithFallback(_nameFallback);\n }\n }\n ```" + }, + "fullyImplemented": true, + "id": 2044, + "linearizedBaseContracts": [ + 2044 + ], + "name": "ShortStrings", + "nameLocation": "1263:12:12", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": true, + "id": 1837, + "mutability": "constant", + "name": "FALLBACK_SENTINEL", + "nameLocation": "1370:17:12", + "nodeType": "VariableDeclaration", + "scope": 2044, + "src": "1345:111:12", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 1835, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1345:7:12", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": { + "hexValue": "307830303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030304646", + "id": 1836, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1390:66:12", + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "0x00000000000000000000000000000000000000000000000000000000000000FF" + }, + "visibility": "private" + }, + { + "errorSelector": "305a27a9", + "id": 1841, + "name": "StringTooLong", + "nameLocation": "1469:13:12", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 1840, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1839, + "mutability": "mutable", + "name": "str", + "nameLocation": "1490:3:12", + "nodeType": "VariableDeclaration", + "scope": 1841, + "src": "1483:10:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 1838, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1483:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "1482:12:12" + }, + "src": "1463:32:12" + }, + { + "errorSelector": "b3512b0c", + "id": 1843, + "name": "InvalidShortString", + "nameLocation": "1506:18:12", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 1842, + "nodeType": "ParameterList", + "parameters": [], + "src": "1524:2:12" + }, + "src": "1500:27:12" + }, + { + "body": { + "id": 1886, + "nodeType": "Block", + "src": "1786:210:12", + "statements": [ + { + "assignments": [ + 1853 + ], + "declarations": [ + { + "constant": false, + "id": 1853, + "mutability": "mutable", + "name": "bstr", + "nameLocation": "1809:4:12", + "nodeType": "VariableDeclaration", + "scope": 1886, + "src": "1796:17:12", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1852, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1796:5:12", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 1858, + "initialValue": { + "arguments": [ + { + "id": 1856, + "name": "str", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1846, + "src": "1822:3:12", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 1855, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1816:5:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 1854, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1816:5:12", + "typeDescriptions": {} + } + }, + "id": 1857, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1816:10:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1796:30:12" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1862, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 1859, + "name": "bstr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1853, + "src": "1840:4:12", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1860, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "1845:6:12", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "1840:11:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30783166", + "id": 1861, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1854:4:12", + "typeDescriptions": { + "typeIdentifier": "t_rational_31_by_1", + "typeString": "int_const 31" + }, + "value": "0x1f" + }, + "src": "1840:18:12", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 1868, + "nodeType": "IfStatement", + "src": "1836:74:12", + "trueBody": { + "id": 1867, + "nodeType": "Block", + "src": "1860:50:12", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "id": 1864, + "name": "str", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1846, + "src": "1895:3:12", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 1863, + "name": "StringTooLong", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1841, + "src": "1881:13:12", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_string_memory_ptr_$returns$_t_error_$", + "typeString": "function (string memory) pure returns (error)" + } + }, + "id": 1865, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1881:18:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 1866, + "nodeType": "RevertStatement", + "src": "1874:25:12" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1882, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "arguments": [ + { + "id": 1877, + "name": "bstr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1853, + "src": "1967:4:12", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 1876, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1959:7:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes32_$", + "typeString": "type(bytes32)" + }, + "typeName": { + "id": 1875, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1959:7:12", + "typeDescriptions": {} + } + }, + "id": 1878, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1959:13:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 1874, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1951:7:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 1873, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1951:7:12", + "typeDescriptions": {} + } + }, + "id": 1879, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1951:22:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "expression": { + "id": 1880, + "name": "bstr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1853, + "src": "1976:4:12", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1881, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "1981:6:12", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "1976:11:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1951:36:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1872, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1943:7:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes32_$", + "typeString": "type(bytes32)" + }, + "typeName": { + "id": 1871, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1943:7:12", + "typeDescriptions": {} + } + }, + "id": 1883, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1943:45:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "id": 1869, + "name": "ShortString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1833, + "src": "1926:11:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "type(ShortString)" + } + }, + "id": 1870, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "1938:4:12", + "memberName": "wrap", + "nodeType": "MemberAccess", + "src": "1926:16:12", + "typeDescriptions": { + "typeIdentifier": "t_function_wrap_pure$_t_bytes32_$returns$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "function (bytes32) pure returns (ShortString)" + } + }, + "id": 1884, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1926:63:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "functionReturnParameters": 1851, + "id": 1885, + "nodeType": "Return", + "src": "1919:70:12" + } + ] + }, + "documentation": { + "id": 1844, + "nodeType": "StructuredDocumentation", + "src": "1533:170:12", + "text": " @dev Encode a string of at most 31 chars into a `ShortString`.\n This will trigger a `StringTooLong` error is the input string is too long." + }, + "id": 1887, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toShortString", + "nameLocation": "1717:13:12", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1847, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1846, + "mutability": "mutable", + "name": "str", + "nameLocation": "1745:3:12", + "nodeType": "VariableDeclaration", + "scope": 1887, + "src": "1731:17:12", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 1845, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1731:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "1730:19:12" + }, + "returnParameters": { + "id": 1851, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1850, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1887, + "src": "1773:11:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + }, + "typeName": { + "id": 1849, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 1848, + "name": "ShortString", + "nameLocations": [ + "1773:11:12" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1833, + "src": "1773:11:12" + }, + "referencedDeclaration": 1833, + "src": "1773:11:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "visibility": "internal" + } + ], + "src": "1772:13:12" + }, + "scope": 2044, + "src": "1708:288:12", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1912, + "nodeType": "Block", + "src": "2154:306:12", + "statements": [ + { + "assignments": [ + 1897 + ], + "declarations": [ + { + "constant": false, + "id": 1897, + "mutability": "mutable", + "name": "len", + "nameLocation": "2172:3:12", + "nodeType": "VariableDeclaration", + "scope": 1912, + "src": "2164:11:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1896, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2164:7:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 1901, + "initialValue": { + "arguments": [ + { + "id": 1899, + "name": "sstr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1891, + "src": "2189:4:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + ], + "id": 1898, + "name": "byteLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1945, + "src": "2178:10:12", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_userDefinedValueType$_ShortString_$1833_$returns$_t_uint256_$", + "typeString": "function (ShortString) pure returns (uint256)" + } + }, + "id": 1900, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2178:16:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2164:30:12" + }, + { + "assignments": [ + 1903 + ], + "declarations": [ + { + "constant": false, + "id": 1903, + "mutability": "mutable", + "name": "str", + "nameLocation": "2296:3:12", + "nodeType": "VariableDeclaration", + "scope": 1912, + "src": "2282:17:12", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 1902, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2282:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "id": 1908, + "initialValue": { + "arguments": [ + { + "hexValue": "30783230", + "id": 1906, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2313:4:12", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "0x20" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + } + ], + "id": 1905, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "2302:10:12", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_string_memory_ptr_$", + "typeString": "function (uint256) pure returns (string memory)" + }, + "typeName": { + "id": 1904, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2306:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + } + }, + "id": 1907, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2302:16:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2282:36:12" + }, + { + "AST": { + "nativeSrc": "2353:81:12", + "nodeType": "YulBlock", + "src": "2353:81:12", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "str", + "nativeSrc": "2374:3:12", + "nodeType": "YulIdentifier", + "src": "2374:3:12" + }, + { + "name": "len", + "nativeSrc": "2379:3:12", + "nodeType": "YulIdentifier", + "src": "2379:3:12" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "2367:6:12", + "nodeType": "YulIdentifier", + "src": "2367:6:12" + }, + "nativeSrc": "2367:16:12", + "nodeType": "YulFunctionCall", + "src": "2367:16:12" + }, + "nativeSrc": "2367:16:12", + "nodeType": "YulExpressionStatement", + "src": "2367:16:12" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "str", + "nativeSrc": "2407:3:12", + "nodeType": "YulIdentifier", + "src": "2407:3:12" + }, + { + "kind": "number", + "nativeSrc": "2412:4:12", + "nodeType": "YulLiteral", + "src": "2412:4:12", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2403:3:12", + "nodeType": "YulIdentifier", + "src": "2403:3:12" + }, + "nativeSrc": "2403:14:12", + "nodeType": "YulFunctionCall", + "src": "2403:14:12" + }, + { + "name": "sstr", + "nativeSrc": "2419:4:12", + "nodeType": "YulIdentifier", + "src": "2419:4:12" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "2396:6:12", + "nodeType": "YulIdentifier", + "src": "2396:6:12" + }, + "nativeSrc": "2396:28:12", + "nodeType": "YulFunctionCall", + "src": "2396:28:12" + }, + "nativeSrc": "2396:28:12", + "nodeType": "YulExpressionStatement", + "src": "2396:28:12" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 1897, + "isOffset": false, + "isSlot": false, + "src": "2379:3:12", + "valueSize": 1 + }, + { + "declaration": 1891, + "isOffset": false, + "isSlot": false, + "src": "2419:4:12", + "valueSize": 1 + }, + { + "declaration": 1903, + "isOffset": false, + "isSlot": false, + "src": "2374:3:12", + "valueSize": 1 + }, + { + "declaration": 1903, + "isOffset": false, + "isSlot": false, + "src": "2407:3:12", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 1909, + "nodeType": "InlineAssembly", + "src": "2328:106:12" + }, + { + "expression": { + "id": 1910, + "name": "str", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1903, + "src": "2450:3:12", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 1895, + "id": 1911, + "nodeType": "Return", + "src": "2443:10:12" + } + ] + }, + "documentation": { + "id": 1888, + "nodeType": "StructuredDocumentation", + "src": "2002:73:12", + "text": " @dev Decode a `ShortString` back to a \"normal\" string." + }, + "id": 1913, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toString", + "nameLocation": "2089:8:12", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1892, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1891, + "mutability": "mutable", + "name": "sstr", + "nameLocation": "2110:4:12", + "nodeType": "VariableDeclaration", + "scope": 1913, + "src": "2098:16:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + }, + "typeName": { + "id": 1890, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 1889, + "name": "ShortString", + "nameLocations": [ + "2098:11:12" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1833, + "src": "2098:11:12" + }, + "referencedDeclaration": 1833, + "src": "2098:11:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "visibility": "internal" + } + ], + "src": "2097:18:12" + }, + "returnParameters": { + "id": 1895, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1894, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1913, + "src": "2139:13:12", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 1893, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2139:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "2138:15:12" + }, + "scope": 2044, + "src": "2080:380:12", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1944, + "nodeType": "Block", + "src": "2602:177:12", + "statements": [ + { + "assignments": [ + 1923 + ], + "declarations": [ + { + "constant": false, + "id": 1923, + "mutability": "mutable", + "name": "result", + "nameLocation": "2620:6:12", + "nodeType": "VariableDeclaration", + "scope": 1944, + "src": "2612:14:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1922, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2612:7:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 1933, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1932, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "arguments": [ + { + "id": 1928, + "name": "sstr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1917, + "src": "2656:4:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + ], + "expression": { + "id": 1926, + "name": "ShortString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1833, + "src": "2637:11:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "type(ShortString)" + } + }, + "id": 1927, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "2649:6:12", + "memberName": "unwrap", + "nodeType": "MemberAccess", + "src": "2637:18:12", + "typeDescriptions": { + "typeIdentifier": "t_function_unwrap_pure$_t_userDefinedValueType$_ShortString_$1833_$returns$_t_bytes32_$", + "typeString": "function (ShortString) pure returns (bytes32)" + } + }, + "id": 1929, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2637:24:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 1925, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2629:7:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 1924, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2629:7:12", + "typeDescriptions": {} + } + }, + "id": 1930, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2629:33:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30784646", + "id": 1931, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2665:4:12", + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "0xFF" + }, + "src": "2629:40:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2612:57:12" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1936, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 1934, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1923, + "src": "2683:6:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30783166", + "id": 1935, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2692:4:12", + "typeDescriptions": { + "typeIdentifier": "t_rational_31_by_1", + "typeString": "int_const 31" + }, + "value": "0x1f" + }, + "src": "2683:13:12", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 1941, + "nodeType": "IfStatement", + "src": "2679:71:12", + "trueBody": { + "id": 1940, + "nodeType": "Block", + "src": "2698:52:12", + "statements": [ + { + "errorCall": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 1937, + "name": "InvalidShortString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1843, + "src": "2719:18:12", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$__$returns$_t_error_$", + "typeString": "function () pure returns (error)" + } + }, + "id": 1938, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2719:20:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 1939, + "nodeType": "RevertStatement", + "src": "2712:27:12" + } + ] + } + }, + { + "expression": { + "id": 1942, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1923, + "src": "2766:6:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 1921, + "id": 1943, + "nodeType": "Return", + "src": "2759:13:12" + } + ] + }, + "documentation": { + "id": 1914, + "nodeType": "StructuredDocumentation", + "src": "2466:61:12", + "text": " @dev Return the length of a `ShortString`." + }, + "id": 1945, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "byteLength", + "nameLocation": "2541:10:12", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1918, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1917, + "mutability": "mutable", + "name": "sstr", + "nameLocation": "2564:4:12", + "nodeType": "VariableDeclaration", + "scope": 1945, + "src": "2552:16:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + }, + "typeName": { + "id": 1916, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 1915, + "name": "ShortString", + "nameLocations": [ + "2552:11:12" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1833, + "src": "2552:11:12" + }, + "referencedDeclaration": 1833, + "src": "2552:11:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "visibility": "internal" + } + ], + "src": "2551:18:12" + }, + "returnParameters": { + "id": 1921, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1920, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1945, + "src": "2593:7:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1919, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2593:7:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2592:9:12" + }, + "scope": 2044, + "src": "2532:247:12", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 1984, + "nodeType": "Block", + "src": "3002:233:12", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1962, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "arguments": [ + { + "id": 1958, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1948, + "src": "3022:5:12", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 1957, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3016:5:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 1956, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3016:5:12", + "typeDescriptions": {} + } + }, + "id": 1959, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3016:12:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1960, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3029:6:12", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "3016:19:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "hexValue": "30783230", + "id": 1961, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3038:4:12", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "0x20" + }, + "src": "3016:26:12", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 1982, + "nodeType": "Block", + "src": "3102:127:12", + "statements": [ + { + "expression": { + "id": 1975, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "expression": { + "arguments": [ + { + "id": 1971, + "name": "store", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1950, + "src": "3142:5:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string storage pointer" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string storage pointer" + } + ], + "expression": { + "id": 1968, + "name": "StorageSlot", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2168, + "src": "3116:11:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_StorageSlot_$2168_$", + "typeString": "type(library StorageSlot)" + } + }, + "id": 1970, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3128:13:12", + "memberName": "getStringSlot", + "nodeType": "MemberAccess", + "referencedDeclaration": 2145, + "src": "3116:25:12", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_storage_ptr_$returns$_t_struct$_StringSlot_$2065_storage_ptr_$", + "typeString": "function (string storage pointer) pure returns (struct StorageSlot.StringSlot storage pointer)" + } + }, + "id": 1972, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3116:32:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_struct$_StringSlot_$2065_storage_ptr", + "typeString": "struct StorageSlot.StringSlot storage pointer" + } + }, + "id": 1973, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberLocation": "3149:5:12", + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": 2064, + "src": "3116:38:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 1974, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1948, + "src": "3157:5:12", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "src": "3116:46:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "id": 1976, + "nodeType": "ExpressionStatement", + "src": "3116:46:12" + }, + { + "expression": { + "arguments": [ + { + "id": 1979, + "name": "FALLBACK_SENTINEL", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1837, + "src": "3200:17:12", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "id": 1977, + "name": "ShortString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1833, + "src": "3183:11:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "type(ShortString)" + } + }, + "id": 1978, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "3195:4:12", + "memberName": "wrap", + "nodeType": "MemberAccess", + "src": "3183:16:12", + "typeDescriptions": { + "typeIdentifier": "t_function_wrap_pure$_t_bytes32_$returns$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "function (bytes32) pure returns (ShortString)" + } + }, + "id": 1980, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3183:35:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "functionReturnParameters": 1955, + "id": 1981, + "nodeType": "Return", + "src": "3176:42:12" + } + ] + }, + "id": 1983, + "nodeType": "IfStatement", + "src": "3012:217:12", + "trueBody": { + "id": 1967, + "nodeType": "Block", + "src": "3044:52:12", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 1964, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1948, + "src": "3079:5:12", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 1963, + "name": "toShortString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1887, + "src": "3065:13:12", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$returns$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "function (string memory) pure returns (ShortString)" + } + }, + "id": 1965, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3065:20:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "functionReturnParameters": 1955, + "id": 1966, + "nodeType": "Return", + "src": "3058:27:12" + } + ] + } + } + ] + }, + "documentation": { + "id": 1946, + "nodeType": "StructuredDocumentation", + "src": "2785:103:12", + "text": " @dev Encode a string into a `ShortString`, or write it to storage if it is too long." + }, + "id": 1985, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toShortStringWithFallback", + "nameLocation": "2902:25:12", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1951, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1948, + "mutability": "mutable", + "name": "value", + "nameLocation": "2942:5:12", + "nodeType": "VariableDeclaration", + "scope": 1985, + "src": "2928:19:12", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 1947, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2928:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1950, + "mutability": "mutable", + "name": "store", + "nameLocation": "2964:5:12", + "nodeType": "VariableDeclaration", + "scope": 1985, + "src": "2949:20:12", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + }, + "typeName": { + "id": 1949, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2949:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "2927:43:12" + }, + "returnParameters": { + "id": 1955, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1954, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 1985, + "src": "2989:11:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + }, + "typeName": { + "id": 1953, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 1952, + "name": "ShortString", + "nameLocations": [ + "2989:11:12" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1833, + "src": "2989:11:12" + }, + "referencedDeclaration": 1833, + "src": "2989:11:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "visibility": "internal" + } + ], + "src": "2988:13:12" + }, + "scope": 2044, + "src": "2893:342:12", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2011, + "nodeType": "Block", + "src": "3485:158:12", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 2001, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 1998, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1989, + "src": "3518:5:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + ], + "expression": { + "id": 1996, + "name": "ShortString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1833, + "src": "3499:11:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "type(ShortString)" + } + }, + "id": 1997, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "3511:6:12", + "memberName": "unwrap", + "nodeType": "MemberAccess", + "src": "3499:18:12", + "typeDescriptions": { + "typeIdentifier": "t_function_unwrap_pure$_t_userDefinedValueType$_ShortString_$1833_$returns$_t_bytes32_$", + "typeString": "function (ShortString) pure returns (bytes32)" + } + }, + "id": 1999, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3499:25:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 2000, + "name": "FALLBACK_SENTINEL", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1837, + "src": "3528:17:12", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "3499:46:12", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 2009, + "nodeType": "Block", + "src": "3600:37:12", + "statements": [ + { + "expression": { + "id": 2007, + "name": "store", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1991, + "src": "3621:5:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string storage pointer" + } + }, + "functionReturnParameters": 1995, + "id": 2008, + "nodeType": "Return", + "src": "3614:12:12" + } + ] + }, + "id": 2010, + "nodeType": "IfStatement", + "src": "3495:142:12", + "trueBody": { + "id": 2006, + "nodeType": "Block", + "src": "3547:47:12", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2003, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1989, + "src": "3577:5:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + ], + "id": 2002, + "name": "toString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1913, + "src": "3568:8:12", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_userDefinedValueType$_ShortString_$1833_$returns$_t_string_memory_ptr_$", + "typeString": "function (ShortString) pure returns (string memory)" + } + }, + "id": 2004, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3568:15:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 1995, + "id": 2005, + "nodeType": "Return", + "src": "3561:22:12" + } + ] + } + } + ] + }, + "documentation": { + "id": 1986, + "nodeType": "StructuredDocumentation", + "src": "3241:130:12", + "text": " @dev Decode a string that was encoded to `ShortString` or written to storage using {toShortStringWithFallback}." + }, + "id": 2012, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toStringWithFallback", + "nameLocation": "3385:20:12", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1992, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1989, + "mutability": "mutable", + "name": "value", + "nameLocation": "3418:5:12", + "nodeType": "VariableDeclaration", + "scope": 2012, + "src": "3406:17:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + }, + "typeName": { + "id": 1988, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 1987, + "name": "ShortString", + "nameLocations": [ + "3406:11:12" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1833, + "src": "3406:11:12" + }, + "referencedDeclaration": 1833, + "src": "3406:11:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 1991, + "mutability": "mutable", + "name": "store", + "nameLocation": "3440:5:12", + "nodeType": "VariableDeclaration", + "scope": 2012, + "src": "3425:20:12", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + }, + "typeName": { + "id": 1990, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "3425:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "3405:41:12" + }, + "returnParameters": { + "id": 1995, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1994, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2012, + "src": "3470:13:12", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 1993, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "3470:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "3469:15:12" + }, + "scope": 2044, + "src": "3376:267:12", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2042, + "nodeType": "Block", + "src": "4133:174:12", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 2028, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 2025, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2016, + "src": "4166:5:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + ], + "expression": { + "id": 2023, + "name": "ShortString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1833, + "src": "4147:11:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "type(ShortString)" + } + }, + "id": 2024, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "4159:6:12", + "memberName": "unwrap", + "nodeType": "MemberAccess", + "src": "4147:18:12", + "typeDescriptions": { + "typeIdentifier": "t_function_unwrap_pure$_t_userDefinedValueType$_ShortString_$1833_$returns$_t_bytes32_$", + "typeString": "function (ShortString) pure returns (bytes32)" + } + }, + "id": 2026, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4147:25:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 2027, + "name": "FALLBACK_SENTINEL", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1837, + "src": "4176:17:12", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "4147:46:12", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 2040, + "nodeType": "Block", + "src": "4250:51:12", + "statements": [ + { + "expression": { + "expression": { + "arguments": [ + { + "id": 2036, + "name": "store", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2018, + "src": "4277:5:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string storage pointer" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string storage pointer" + } + ], + "id": 2035, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4271:5:12", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2034, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4271:5:12", + "typeDescriptions": {} + } + }, + "id": 2037, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4271:12:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes storage pointer" + } + }, + "id": 2038, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4284:6:12", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "4271:19:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 2022, + "id": 2039, + "nodeType": "Return", + "src": "4264:26:12" + } + ] + }, + "id": 2041, + "nodeType": "IfStatement", + "src": "4143:158:12", + "trueBody": { + "id": 2033, + "nodeType": "Block", + "src": "4195:49:12", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2030, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2016, + "src": "4227:5:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + ], + "id": 2029, + "name": "byteLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1945, + "src": "4216:10:12", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_userDefinedValueType$_ShortString_$1833_$returns$_t_uint256_$", + "typeString": "function (ShortString) pure returns (uint256)" + } + }, + "id": 2031, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4216:17:12", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 2022, + "id": 2032, + "nodeType": "Return", + "src": "4209:24:12" + } + ] + } + } + ] + }, + "documentation": { + "id": 2013, + "nodeType": "StructuredDocumentation", + "src": "3649:374:12", + "text": " @dev Return the length of a string that was encoded to `ShortString` or written to storage using\n {toShortStringWithFallback}.\n WARNING: This will return the \"byte length\" of the string. This may not reflect the actual length in terms of\n actual characters as the UTF-8 encoding of a single character can span over multiple bytes." + }, + "id": 2043, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "byteLengthWithFallback", + "nameLocation": "4037:22:12", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2019, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2016, + "mutability": "mutable", + "name": "value", + "nameLocation": "4072:5:12", + "nodeType": "VariableDeclaration", + "scope": 2043, + "src": "4060:17:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + }, + "typeName": { + "id": 2015, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2014, + "name": "ShortString", + "nameLocations": [ + "4060:11:12" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1833, + "src": "4060:11:12" + }, + "referencedDeclaration": 1833, + "src": "4060:11:12", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2018, + "mutability": "mutable", + "name": "store", + "nameLocation": "4094:5:12", + "nodeType": "VariableDeclaration", + "scope": 2043, + "src": "4079:20:12", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2017, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "4079:6:12", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "4059:41:12" + }, + "returnParameters": { + "id": 2022, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2021, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2043, + "src": "4124:7:12", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2020, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4124:7:12", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4123:9:12" + }, + "scope": 2044, + "src": "4028:279:12", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + } + ], + "scope": 2045, + "src": "1255:3054:12", + "usedErrors": [ + 1841, + 1843 + ], + "usedEvents": [] + } + ], + "src": "106:4204:12" + }, + "id": 12 + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/StorageSlot.sol", + "exportedSymbols": { + "StorageSlot": [ + 2168 + ] + }, + "id": 2169, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 2046, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "193:24:13" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "StorageSlot", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 2047, + "nodeType": "StructuredDocumentation", + "src": "219:1187:13", + "text": " @dev Library for reading and writing primitive types to specific storage slots.\n Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n This library helps with reading and writing to such slots without the need for inline assembly.\n The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n Example usage to set ERC-1967 implementation slot:\n ```solidity\n contract ERC1967 {\n // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n function _setImplementation(address newImplementation) internal {\n require(newImplementation.code.length > 0);\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n }\n ```\n TIP: Consider using this library along with {SlotDerivation}." + }, + "fullyImplemented": true, + "id": 2168, + "linearizedBaseContracts": [ + 2168 + ], + "name": "StorageSlot", + "nameLocation": "1415:11:13", + "nodeType": "ContractDefinition", + "nodes": [ + { + "canonicalName": "StorageSlot.AddressSlot", + "id": 2050, + "members": [ + { + "constant": false, + "id": 2049, + "mutability": "mutable", + "name": "value", + "nameLocation": "1470:5:13", + "nodeType": "VariableDeclaration", + "scope": 2050, + "src": "1462:13:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 2048, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1462:7:13", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "name": "AddressSlot", + "nameLocation": "1440:11:13", + "nodeType": "StructDefinition", + "scope": 2168, + "src": "1433:49:13", + "visibility": "public" + }, + { + "canonicalName": "StorageSlot.BooleanSlot", + "id": 2053, + "members": [ + { + "constant": false, + "id": 2052, + "mutability": "mutable", + "name": "value", + "nameLocation": "1522:5:13", + "nodeType": "VariableDeclaration", + "scope": 2053, + "src": "1517:10:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2051, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "1517:4:13", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "name": "BooleanSlot", + "nameLocation": "1495:11:13", + "nodeType": "StructDefinition", + "scope": 2168, + "src": "1488:46:13", + "visibility": "public" + }, + { + "canonicalName": "StorageSlot.Bytes32Slot", + "id": 2056, + "members": [ + { + "constant": false, + "id": 2055, + "mutability": "mutable", + "name": "value", + "nameLocation": "1577:5:13", + "nodeType": "VariableDeclaration", + "scope": 2056, + "src": "1569:13:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2054, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1569:7:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "name": "Bytes32Slot", + "nameLocation": "1547:11:13", + "nodeType": "StructDefinition", + "scope": 2168, + "src": "1540:49:13", + "visibility": "public" + }, + { + "canonicalName": "StorageSlot.Uint256Slot", + "id": 2059, + "members": [ + { + "constant": false, + "id": 2058, + "mutability": "mutable", + "name": "value", + "nameLocation": "1632:5:13", + "nodeType": "VariableDeclaration", + "scope": 2059, + "src": "1624:13:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2057, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1624:7:13", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "name": "Uint256Slot", + "nameLocation": "1602:11:13", + "nodeType": "StructDefinition", + "scope": 2168, + "src": "1595:49:13", + "visibility": "public" + }, + { + "canonicalName": "StorageSlot.Int256Slot", + "id": 2062, + "members": [ + { + "constant": false, + "id": 2061, + "mutability": "mutable", + "name": "value", + "nameLocation": "1685:5:13", + "nodeType": "VariableDeclaration", + "scope": 2062, + "src": "1678:12:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 2060, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1678:6:13", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "name": "Int256Slot", + "nameLocation": "1657:10:13", + "nodeType": "StructDefinition", + "scope": 2168, + "src": "1650:47:13", + "visibility": "public" + }, + { + "canonicalName": "StorageSlot.StringSlot", + "id": 2065, + "members": [ + { + "constant": false, + "id": 2064, + "mutability": "mutable", + "name": "value", + "nameLocation": "1738:5:13", + "nodeType": "VariableDeclaration", + "scope": 2065, + "src": "1731:12:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2063, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1731:6:13", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "name": "StringSlot", + "nameLocation": "1710:10:13", + "nodeType": "StructDefinition", + "scope": 2168, + "src": "1703:47:13", + "visibility": "public" + }, + { + "canonicalName": "StorageSlot.BytesSlot", + "id": 2068, + "members": [ + { + "constant": false, + "id": 2067, + "mutability": "mutable", + "name": "value", + "nameLocation": "1789:5:13", + "nodeType": "VariableDeclaration", + "scope": 2068, + "src": "1783:11:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2066, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1783:5:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "name": "BytesSlot", + "nameLocation": "1763:9:13", + "nodeType": "StructDefinition", + "scope": 2168, + "src": "1756:45:13", + "visibility": "public" + }, + { + "body": { + "id": 2078, + "nodeType": "Block", + "src": "1983:79:13", + "statements": [ + { + "AST": { + "nativeSrc": "2018:38:13", + "nodeType": "YulBlock", + "src": "2018:38:13", + "statements": [ + { + "nativeSrc": "2032:14:13", + "nodeType": "YulAssignment", + "src": "2032:14:13", + "value": { + "name": "slot", + "nativeSrc": "2042:4:13", + "nodeType": "YulIdentifier", + "src": "2042:4:13" + }, + "variableNames": [ + { + "name": "r.slot", + "nativeSrc": "2032:6:13", + "nodeType": "YulIdentifier", + "src": "2032:6:13" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2075, + "isOffset": false, + "isSlot": true, + "src": "2032:6:13", + "suffix": "slot", + "valueSize": 1 + }, + { + "declaration": 2071, + "isOffset": false, + "isSlot": false, + "src": "2042:4:13", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2077, + "nodeType": "InlineAssembly", + "src": "1993:63:13" + } + ] + }, + "documentation": { + "id": 2069, + "nodeType": "StructuredDocumentation", + "src": "1807:87:13", + "text": " @dev Returns an `AddressSlot` with member `value` located at `slot`." + }, + "id": 2079, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getAddressSlot", + "nameLocation": "1908:14:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2072, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2071, + "mutability": "mutable", + "name": "slot", + "nameLocation": "1931:4:13", + "nodeType": "VariableDeclaration", + "scope": 2079, + "src": "1923:12:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2070, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1923:7:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "1922:14:13" + }, + "returnParameters": { + "id": 2076, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2075, + "mutability": "mutable", + "name": "r", + "nameLocation": "1980:1:13", + "nodeType": "VariableDeclaration", + "scope": 2079, + "src": "1960:21:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_AddressSlot_$2050_storage_ptr", + "typeString": "struct StorageSlot.AddressSlot" + }, + "typeName": { + "id": 2074, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2073, + "name": "AddressSlot", + "nameLocations": [ + "1960:11:13" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2050, + "src": "1960:11:13" + }, + "referencedDeclaration": 2050, + "src": "1960:11:13", + "typeDescriptions": { + "typeIdentifier": "t_struct$_AddressSlot_$2050_storage_ptr", + "typeString": "struct StorageSlot.AddressSlot" + } + }, + "visibility": "internal" + } + ], + "src": "1959:23:13" + }, + "scope": 2168, + "src": "1899:163:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2089, + "nodeType": "Block", + "src": "2243:79:13", + "statements": [ + { + "AST": { + "nativeSrc": "2278:38:13", + "nodeType": "YulBlock", + "src": "2278:38:13", + "statements": [ + { + "nativeSrc": "2292:14:13", + "nodeType": "YulAssignment", + "src": "2292:14:13", + "value": { + "name": "slot", + "nativeSrc": "2302:4:13", + "nodeType": "YulIdentifier", + "src": "2302:4:13" + }, + "variableNames": [ + { + "name": "r.slot", + "nativeSrc": "2292:6:13", + "nodeType": "YulIdentifier", + "src": "2292:6:13" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2086, + "isOffset": false, + "isSlot": true, + "src": "2292:6:13", + "suffix": "slot", + "valueSize": 1 + }, + { + "declaration": 2082, + "isOffset": false, + "isSlot": false, + "src": "2302:4:13", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2088, + "nodeType": "InlineAssembly", + "src": "2253:63:13" + } + ] + }, + "documentation": { + "id": 2080, + "nodeType": "StructuredDocumentation", + "src": "2068:86:13", + "text": " @dev Returns a `BooleanSlot` with member `value` located at `slot`." + }, + "id": 2090, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getBooleanSlot", + "nameLocation": "2168:14:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2083, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2082, + "mutability": "mutable", + "name": "slot", + "nameLocation": "2191:4:13", + "nodeType": "VariableDeclaration", + "scope": 2090, + "src": "2183:12:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2081, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2183:7:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "2182:14:13" + }, + "returnParameters": { + "id": 2087, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2086, + "mutability": "mutable", + "name": "r", + "nameLocation": "2240:1:13", + "nodeType": "VariableDeclaration", + "scope": 2090, + "src": "2220:21:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_BooleanSlot_$2053_storage_ptr", + "typeString": "struct StorageSlot.BooleanSlot" + }, + "typeName": { + "id": 2085, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2084, + "name": "BooleanSlot", + "nameLocations": [ + "2220:11:13" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2053, + "src": "2220:11:13" + }, + "referencedDeclaration": 2053, + "src": "2220:11:13", + "typeDescriptions": { + "typeIdentifier": "t_struct$_BooleanSlot_$2053_storage_ptr", + "typeString": "struct StorageSlot.BooleanSlot" + } + }, + "visibility": "internal" + } + ], + "src": "2219:23:13" + }, + "scope": 2168, + "src": "2159:163:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2100, + "nodeType": "Block", + "src": "2503:79:13", + "statements": [ + { + "AST": { + "nativeSrc": "2538:38:13", + "nodeType": "YulBlock", + "src": "2538:38:13", + "statements": [ + { + "nativeSrc": "2552:14:13", + "nodeType": "YulAssignment", + "src": "2552:14:13", + "value": { + "name": "slot", + "nativeSrc": "2562:4:13", + "nodeType": "YulIdentifier", + "src": "2562:4:13" + }, + "variableNames": [ + { + "name": "r.slot", + "nativeSrc": "2552:6:13", + "nodeType": "YulIdentifier", + "src": "2552:6:13" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2097, + "isOffset": false, + "isSlot": true, + "src": "2552:6:13", + "suffix": "slot", + "valueSize": 1 + }, + { + "declaration": 2093, + "isOffset": false, + "isSlot": false, + "src": "2562:4:13", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2099, + "nodeType": "InlineAssembly", + "src": "2513:63:13" + } + ] + }, + "documentation": { + "id": 2091, + "nodeType": "StructuredDocumentation", + "src": "2328:86:13", + "text": " @dev Returns a `Bytes32Slot` with member `value` located at `slot`." + }, + "id": 2101, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getBytes32Slot", + "nameLocation": "2428:14:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2094, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2093, + "mutability": "mutable", + "name": "slot", + "nameLocation": "2451:4:13", + "nodeType": "VariableDeclaration", + "scope": 2101, + "src": "2443:12:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2092, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2443:7:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "2442:14:13" + }, + "returnParameters": { + "id": 2098, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2097, + "mutability": "mutable", + "name": "r", + "nameLocation": "2500:1:13", + "nodeType": "VariableDeclaration", + "scope": 2101, + "src": "2480:21:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Bytes32Slot_$2056_storage_ptr", + "typeString": "struct StorageSlot.Bytes32Slot" + }, + "typeName": { + "id": 2096, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2095, + "name": "Bytes32Slot", + "nameLocations": [ + "2480:11:13" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2056, + "src": "2480:11:13" + }, + "referencedDeclaration": 2056, + "src": "2480:11:13", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Bytes32Slot_$2056_storage_ptr", + "typeString": "struct StorageSlot.Bytes32Slot" + } + }, + "visibility": "internal" + } + ], + "src": "2479:23:13" + }, + "scope": 2168, + "src": "2419:163:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2111, + "nodeType": "Block", + "src": "2763:79:13", + "statements": [ + { + "AST": { + "nativeSrc": "2798:38:13", + "nodeType": "YulBlock", + "src": "2798:38:13", + "statements": [ + { + "nativeSrc": "2812:14:13", + "nodeType": "YulAssignment", + "src": "2812:14:13", + "value": { + "name": "slot", + "nativeSrc": "2822:4:13", + "nodeType": "YulIdentifier", + "src": "2822:4:13" + }, + "variableNames": [ + { + "name": "r.slot", + "nativeSrc": "2812:6:13", + "nodeType": "YulIdentifier", + "src": "2812:6:13" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2108, + "isOffset": false, + "isSlot": true, + "src": "2812:6:13", + "suffix": "slot", + "valueSize": 1 + }, + { + "declaration": 2104, + "isOffset": false, + "isSlot": false, + "src": "2822:4:13", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2110, + "nodeType": "InlineAssembly", + "src": "2773:63:13" + } + ] + }, + "documentation": { + "id": 2102, + "nodeType": "StructuredDocumentation", + "src": "2588:86:13", + "text": " @dev Returns a `Uint256Slot` with member `value` located at `slot`." + }, + "id": 2112, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getUint256Slot", + "nameLocation": "2688:14:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2105, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2104, + "mutability": "mutable", + "name": "slot", + "nameLocation": "2711:4:13", + "nodeType": "VariableDeclaration", + "scope": 2112, + "src": "2703:12:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2103, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2703:7:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "2702:14:13" + }, + "returnParameters": { + "id": 2109, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2108, + "mutability": "mutable", + "name": "r", + "nameLocation": "2760:1:13", + "nodeType": "VariableDeclaration", + "scope": 2112, + "src": "2740:21:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Uint256Slot_$2059_storage_ptr", + "typeString": "struct StorageSlot.Uint256Slot" + }, + "typeName": { + "id": 2107, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2106, + "name": "Uint256Slot", + "nameLocations": [ + "2740:11:13" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2059, + "src": "2740:11:13" + }, + "referencedDeclaration": 2059, + "src": "2740:11:13", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Uint256Slot_$2059_storage_ptr", + "typeString": "struct StorageSlot.Uint256Slot" + } + }, + "visibility": "internal" + } + ], + "src": "2739:23:13" + }, + "scope": 2168, + "src": "2679:163:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2122, + "nodeType": "Block", + "src": "3020:79:13", + "statements": [ + { + "AST": { + "nativeSrc": "3055:38:13", + "nodeType": "YulBlock", + "src": "3055:38:13", + "statements": [ + { + "nativeSrc": "3069:14:13", + "nodeType": "YulAssignment", + "src": "3069:14:13", + "value": { + "name": "slot", + "nativeSrc": "3079:4:13", + "nodeType": "YulIdentifier", + "src": "3079:4:13" + }, + "variableNames": [ + { + "name": "r.slot", + "nativeSrc": "3069:6:13", + "nodeType": "YulIdentifier", + "src": "3069:6:13" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2119, + "isOffset": false, + "isSlot": true, + "src": "3069:6:13", + "suffix": "slot", + "valueSize": 1 + }, + { + "declaration": 2115, + "isOffset": false, + "isSlot": false, + "src": "3079:4:13", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2121, + "nodeType": "InlineAssembly", + "src": "3030:63:13" + } + ] + }, + "documentation": { + "id": 2113, + "nodeType": "StructuredDocumentation", + "src": "2848:85:13", + "text": " @dev Returns a `Int256Slot` with member `value` located at `slot`." + }, + "id": 2123, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getInt256Slot", + "nameLocation": "2947:13:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2116, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2115, + "mutability": "mutable", + "name": "slot", + "nameLocation": "2969:4:13", + "nodeType": "VariableDeclaration", + "scope": 2123, + "src": "2961:12:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2114, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2961:7:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "2960:14:13" + }, + "returnParameters": { + "id": 2120, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2119, + "mutability": "mutable", + "name": "r", + "nameLocation": "3017:1:13", + "nodeType": "VariableDeclaration", + "scope": 2123, + "src": "2998:20:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Int256Slot_$2062_storage_ptr", + "typeString": "struct StorageSlot.Int256Slot" + }, + "typeName": { + "id": 2118, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2117, + "name": "Int256Slot", + "nameLocations": [ + "2998:10:13" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2062, + "src": "2998:10:13" + }, + "referencedDeclaration": 2062, + "src": "2998:10:13", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Int256Slot_$2062_storage_ptr", + "typeString": "struct StorageSlot.Int256Slot" + } + }, + "visibility": "internal" + } + ], + "src": "2997:22:13" + }, + "scope": 2168, + "src": "2938:161:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2133, + "nodeType": "Block", + "src": "3277:79:13", + "statements": [ + { + "AST": { + "nativeSrc": "3312:38:13", + "nodeType": "YulBlock", + "src": "3312:38:13", + "statements": [ + { + "nativeSrc": "3326:14:13", + "nodeType": "YulAssignment", + "src": "3326:14:13", + "value": { + "name": "slot", + "nativeSrc": "3336:4:13", + "nodeType": "YulIdentifier", + "src": "3336:4:13" + }, + "variableNames": [ + { + "name": "r.slot", + "nativeSrc": "3326:6:13", + "nodeType": "YulIdentifier", + "src": "3326:6:13" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2130, + "isOffset": false, + "isSlot": true, + "src": "3326:6:13", + "suffix": "slot", + "valueSize": 1 + }, + { + "declaration": 2126, + "isOffset": false, + "isSlot": false, + "src": "3336:4:13", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2132, + "nodeType": "InlineAssembly", + "src": "3287:63:13" + } + ] + }, + "documentation": { + "id": 2124, + "nodeType": "StructuredDocumentation", + "src": "3105:85:13", + "text": " @dev Returns a `StringSlot` with member `value` located at `slot`." + }, + "id": 2134, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getStringSlot", + "nameLocation": "3204:13:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2127, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2126, + "mutability": "mutable", + "name": "slot", + "nameLocation": "3226:4:13", + "nodeType": "VariableDeclaration", + "scope": 2134, + "src": "3218:12:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2125, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3218:7:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "3217:14:13" + }, + "returnParameters": { + "id": 2131, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2130, + "mutability": "mutable", + "name": "r", + "nameLocation": "3274:1:13", + "nodeType": "VariableDeclaration", + "scope": 2134, + "src": "3255:20:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_StringSlot_$2065_storage_ptr", + "typeString": "struct StorageSlot.StringSlot" + }, + "typeName": { + "id": 2129, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2128, + "name": "StringSlot", + "nameLocations": [ + "3255:10:13" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2065, + "src": "3255:10:13" + }, + "referencedDeclaration": 2065, + "src": "3255:10:13", + "typeDescriptions": { + "typeIdentifier": "t_struct$_StringSlot_$2065_storage_ptr", + "typeString": "struct StorageSlot.StringSlot" + } + }, + "visibility": "internal" + } + ], + "src": "3254:22:13" + }, + "scope": 2168, + "src": "3195:161:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2144, + "nodeType": "Block", + "src": "3558:85:13", + "statements": [ + { + "AST": { + "nativeSrc": "3593:44:13", + "nodeType": "YulBlock", + "src": "3593:44:13", + "statements": [ + { + "nativeSrc": "3607:20:13", + "nodeType": "YulAssignment", + "src": "3607:20:13", + "value": { + "name": "store.slot", + "nativeSrc": "3617:10:13", + "nodeType": "YulIdentifier", + "src": "3617:10:13" + }, + "variableNames": [ + { + "name": "r.slot", + "nativeSrc": "3607:6:13", + "nodeType": "YulIdentifier", + "src": "3607:6:13" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2141, + "isOffset": false, + "isSlot": true, + "src": "3607:6:13", + "suffix": "slot", + "valueSize": 1 + }, + { + "declaration": 2137, + "isOffset": false, + "isSlot": true, + "src": "3617:10:13", + "suffix": "slot", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2143, + "nodeType": "InlineAssembly", + "src": "3568:69:13" + } + ] + }, + "documentation": { + "id": 2135, + "nodeType": "StructuredDocumentation", + "src": "3362:101:13", + "text": " @dev Returns an `StringSlot` representation of the string storage pointer `store`." + }, + "id": 2145, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getStringSlot", + "nameLocation": "3477:13:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2138, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2137, + "mutability": "mutable", + "name": "store", + "nameLocation": "3506:5:13", + "nodeType": "VariableDeclaration", + "scope": 2145, + "src": "3491:20:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2136, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "3491:6:13", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "3490:22:13" + }, + "returnParameters": { + "id": 2142, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2141, + "mutability": "mutable", + "name": "r", + "nameLocation": "3555:1:13", + "nodeType": "VariableDeclaration", + "scope": 2145, + "src": "3536:20:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_StringSlot_$2065_storage_ptr", + "typeString": "struct StorageSlot.StringSlot" + }, + "typeName": { + "id": 2140, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2139, + "name": "StringSlot", + "nameLocations": [ + "3536:10:13" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2065, + "src": "3536:10:13" + }, + "referencedDeclaration": 2065, + "src": "3536:10:13", + "typeDescriptions": { + "typeIdentifier": "t_struct$_StringSlot_$2065_storage_ptr", + "typeString": "struct StorageSlot.StringSlot" + } + }, + "visibility": "internal" + } + ], + "src": "3535:22:13" + }, + "scope": 2168, + "src": "3468:175:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2155, + "nodeType": "Block", + "src": "3818:79:13", + "statements": [ + { + "AST": { + "nativeSrc": "3853:38:13", + "nodeType": "YulBlock", + "src": "3853:38:13", + "statements": [ + { + "nativeSrc": "3867:14:13", + "nodeType": "YulAssignment", + "src": "3867:14:13", + "value": { + "name": "slot", + "nativeSrc": "3877:4:13", + "nodeType": "YulIdentifier", + "src": "3877:4:13" + }, + "variableNames": [ + { + "name": "r.slot", + "nativeSrc": "3867:6:13", + "nodeType": "YulIdentifier", + "src": "3867:6:13" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2152, + "isOffset": false, + "isSlot": true, + "src": "3867:6:13", + "suffix": "slot", + "valueSize": 1 + }, + { + "declaration": 2148, + "isOffset": false, + "isSlot": false, + "src": "3877:4:13", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2154, + "nodeType": "InlineAssembly", + "src": "3828:63:13" + } + ] + }, + "documentation": { + "id": 2146, + "nodeType": "StructuredDocumentation", + "src": "3649:84:13", + "text": " @dev Returns a `BytesSlot` with member `value` located at `slot`." + }, + "id": 2156, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getBytesSlot", + "nameLocation": "3747:12:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2149, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2148, + "mutability": "mutable", + "name": "slot", + "nameLocation": "3768:4:13", + "nodeType": "VariableDeclaration", + "scope": 2156, + "src": "3760:12:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2147, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3760:7:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "3759:14:13" + }, + "returnParameters": { + "id": 2153, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2152, + "mutability": "mutable", + "name": "r", + "nameLocation": "3815:1:13", + "nodeType": "VariableDeclaration", + "scope": 2156, + "src": "3797:19:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_BytesSlot_$2068_storage_ptr", + "typeString": "struct StorageSlot.BytesSlot" + }, + "typeName": { + "id": 2151, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2150, + "name": "BytesSlot", + "nameLocations": [ + "3797:9:13" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2068, + "src": "3797:9:13" + }, + "referencedDeclaration": 2068, + "src": "3797:9:13", + "typeDescriptions": { + "typeIdentifier": "t_struct$_BytesSlot_$2068_storage_ptr", + "typeString": "struct StorageSlot.BytesSlot" + } + }, + "visibility": "internal" + } + ], + "src": "3796:21:13" + }, + "scope": 2168, + "src": "3738:159:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2166, + "nodeType": "Block", + "src": "4094:85:13", + "statements": [ + { + "AST": { + "nativeSrc": "4129:44:13", + "nodeType": "YulBlock", + "src": "4129:44:13", + "statements": [ + { + "nativeSrc": "4143:20:13", + "nodeType": "YulAssignment", + "src": "4143:20:13", + "value": { + "name": "store.slot", + "nativeSrc": "4153:10:13", + "nodeType": "YulIdentifier", + "src": "4153:10:13" + }, + "variableNames": [ + { + "name": "r.slot", + "nativeSrc": "4143:6:13", + "nodeType": "YulIdentifier", + "src": "4143:6:13" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2163, + "isOffset": false, + "isSlot": true, + "src": "4143:6:13", + "suffix": "slot", + "valueSize": 1 + }, + { + "declaration": 2159, + "isOffset": false, + "isSlot": true, + "src": "4153:10:13", + "suffix": "slot", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2165, + "nodeType": "InlineAssembly", + "src": "4104:69:13" + } + ] + }, + "documentation": { + "id": 2157, + "nodeType": "StructuredDocumentation", + "src": "3903:99:13", + "text": " @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`." + }, + "id": 2167, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getBytesSlot", + "nameLocation": "4016:12:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2160, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2159, + "mutability": "mutable", + "name": "store", + "nameLocation": "4043:5:13", + "nodeType": "VariableDeclaration", + "scope": 2167, + "src": "4029:19:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2158, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4029:5:13", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "4028:21:13" + }, + "returnParameters": { + "id": 2164, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2163, + "mutability": "mutable", + "name": "r", + "nameLocation": "4091:1:13", + "nodeType": "VariableDeclaration", + "scope": 2167, + "src": "4073:19:13", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_BytesSlot_$2068_storage_ptr", + "typeString": "struct StorageSlot.BytesSlot" + }, + "typeName": { + "id": 2162, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2161, + "name": "BytesSlot", + "nameLocations": [ + "4073:9:13" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2068, + "src": "4073:9:13" + }, + "referencedDeclaration": 2068, + "src": "4073:9:13", + "typeDescriptions": { + "typeIdentifier": "t_struct$_BytesSlot_$2068_storage_ptr", + "typeString": "struct StorageSlot.BytesSlot" + } + }, + "visibility": "internal" + } + ], + "src": "4072:21:13" + }, + "scope": 2168, + "src": "4007:172:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + } + ], + "scope": 2169, + "src": "1407:2774:13", + "usedErrors": [], + "usedEvents": [] + } + ], + "src": "193:3989:13" + }, + "id": 13 + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/Strings.sol", + "exportedSymbols": { + "Bytes": [ + 1632 + ], + "Math": [ + 6204 + ], + "SafeCast": [ + 7969 + ], + "SignedMath": [ + 8113 + ], + "Strings": [ + 3678 + ] + }, + "id": 3679, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 2170, + "literals": [ + "solidity", + "^", + "0.8", + ".24" + ], + "nodeType": "PragmaDirective", + "src": "101:24:14" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/math/Math.sol", + "file": "./math/Math.sol", + "id": 2172, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3679, + "sourceUnit": 6205, + "src": "127:37:14", + "symbolAliases": [ + { + "foreign": { + "id": 2171, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "135:4:14", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/math/SafeCast.sol", + "file": "./math/SafeCast.sol", + "id": 2174, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3679, + "sourceUnit": 7970, + "src": "165:45:14", + "symbolAliases": [ + { + "foreign": { + "id": 2173, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "173:8:14", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/math/SignedMath.sol", + "file": "./math/SignedMath.sol", + "id": 2176, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3679, + "sourceUnit": 8114, + "src": "211:49:14", + "symbolAliases": [ + { + "foreign": { + "id": 2175, + "name": "SignedMath", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8113, + "src": "219:10:14", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/Bytes.sol", + "file": "./Bytes.sol", + "id": 2178, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3679, + "sourceUnit": 1633, + "src": "261:34:14", + "symbolAliases": [ + { + "foreign": { + "id": 2177, + "name": "Bytes", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1632, + "src": "269:5:14", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "Strings", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 2179, + "nodeType": "StructuredDocumentation", + "src": "297:34:14", + "text": " @dev String operations." + }, + "fullyImplemented": true, + "id": 3678, + "linearizedBaseContracts": [ + 3678 + ], + "name": "Strings", + "nameLocation": "340:7:14", + "nodeType": "ContractDefinition", + "nodes": [ + { + "global": false, + "id": 2181, + "libraryName": { + "id": 2180, + "name": "SafeCast", + "nameLocations": [ + "360:8:14" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 7969, + "src": "360:8:14" + }, + "nodeType": "UsingForDirective", + "src": "354:21:14" + }, + { + "constant": true, + "id": 2184, + "mutability": "constant", + "name": "HEX_DIGITS", + "nameLocation": "406:10:14", + "nodeType": "VariableDeclaration", + "scope": 3678, + "src": "381:56:14", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + }, + "typeName": { + "id": 2182, + "name": "bytes16", + "nodeType": "ElementaryTypeName", + "src": "381:7:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "value": { + "hexValue": "30313233343536373839616263646566", + "id": 2183, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "419:18:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_cb29997ed99ead0db59ce4d12b7d3723198c827273e5796737c926d78019c39f", + "typeString": "literal_string \"0123456789abcdef\"" + }, + "value": "0123456789abcdef" + }, + "visibility": "private" + }, + { + "constant": true, + "id": 2187, + "mutability": "constant", + "name": "ADDRESS_LENGTH", + "nameLocation": "466:14:14", + "nodeType": "VariableDeclaration", + "scope": 3678, + "src": "443:42:14", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 2185, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "443:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "value": { + "hexValue": "3230", + "id": 2186, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "483:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_20_by_1", + "typeString": "int_const 20" + }, + "value": "20" + }, + "visibility": "private" + }, + { + "constant": true, + "id": 2200, + "mutability": "constant", + "name": "SPECIAL_CHARS_LOOKUP", + "nameLocation": "516:20:14", + "nodeType": "VariableDeclaration", + "scope": 3678, + "src": "491:210:14", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2188, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "491:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "commonType": { + "typeIdentifier": "t_rational_4951760157141521121071333375_by_1", + "typeString": "int_const 4951760157141521121071333375" + }, + "id": 2199, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_rational_21474836479_by_1", + "typeString": "int_const 21474836479" + }, + "id": 2194, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "30786666666666666666", + "id": 2189, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "547:10:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_4294967295_by_1", + "typeString": "int_const 4294967295" + }, + "value": "0xffffffff" + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_rational_17179869184_by_1", + "typeString": "int_const 17179869184" + }, + "id": 2192, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 2190, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "649:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "30783232", + "id": 2191, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "654:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_34_by_1", + "typeString": "int_const 34" + }, + "value": "0x22" + }, + "src": "649:9:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_17179869184_by_1", + "typeString": "int_const 17179869184" + } + } + ], + "id": 2193, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "648:11:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_17179869184_by_1", + "typeString": "int_const 17179869184" + } + }, + "src": "547:112:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_21474836479_by_1", + "typeString": "int_const 21474836479" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_rational_4951760157141521099596496896_by_1", + "typeString": "int_const 4951760157141521099596496896" + }, + "id": 2197, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 2195, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "691:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "30783563", + "id": 2196, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "696:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_92_by_1", + "typeString": "int_const 92" + }, + "value": "0x5c" + }, + "src": "691:9:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_4951760157141521099596496896_by_1", + "typeString": "int_const 4951760157141521099596496896" + } + } + ], + "id": 2198, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "690:11:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_4951760157141521099596496896_by_1", + "typeString": "int_const 4951760157141521099596496896" + } + }, + "src": "547:154:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_4951760157141521121071333375_by_1", + "typeString": "int_const 4951760157141521121071333375" + } + }, + "visibility": "private" + }, + { + "documentation": { + "id": 2201, + "nodeType": "StructuredDocumentation", + "src": "721:81:14", + "text": " @dev The `value` string doesn't fit in the specified `length`." + }, + "errorSelector": "e22e27eb", + "id": 2207, + "name": "StringsInsufficientHexLength", + "nameLocation": "813:28:14", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 2206, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2203, + "mutability": "mutable", + "name": "value", + "nameLocation": "850:5:14", + "nodeType": "VariableDeclaration", + "scope": 2207, + "src": "842:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2202, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "842:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2205, + "mutability": "mutable", + "name": "length", + "nameLocation": "865:6:14", + "nodeType": "VariableDeclaration", + "scope": 2207, + "src": "857:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2204, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "857:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "841:31:14" + }, + "src": "807:66:14" + }, + { + "documentation": { + "id": 2208, + "nodeType": "StructuredDocumentation", + "src": "879:108:14", + "text": " @dev The string being parsed contains characters that are not in scope of the given base." + }, + "errorSelector": "94e2737e", + "id": 2210, + "name": "StringsInvalidChar", + "nameLocation": "998:18:14", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 2209, + "nodeType": "ParameterList", + "parameters": [], + "src": "1016:2:14" + }, + "src": "992:27:14" + }, + { + "documentation": { + "id": 2211, + "nodeType": "StructuredDocumentation", + "src": "1025:84:14", + "text": " @dev The string being parsed is not a properly formatted address." + }, + "errorSelector": "1d15ae44", + "id": 2213, + "name": "StringsInvalidAddressFormat", + "nameLocation": "1120:27:14", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 2212, + "nodeType": "ParameterList", + "parameters": [], + "src": "1147:2:14" + }, + "src": "1114:36:14" + }, + { + "body": { + "id": 2260, + "nodeType": "Block", + "src": "1322:563:14", + "statements": [ + { + "id": 2259, + "nodeType": "UncheckedBlock", + "src": "1332:547:14", + "statements": [ + { + "assignments": [ + 2222 + ], + "declarations": [ + { + "constant": false, + "id": 2222, + "mutability": "mutable", + "name": "length", + "nameLocation": "1364:6:14", + "nodeType": "VariableDeclaration", + "scope": 2259, + "src": "1356:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2221, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1356:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2229, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2228, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 2225, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2216, + "src": "1384:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 2223, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "1373:4:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 2224, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "1378:5:14", + "memberName": "log10", + "nodeType": "MemberAccess", + "referencedDeclaration": 6015, + "src": "1373:10:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256) pure returns (uint256)" + } + }, + "id": 2226, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1373:17:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "31", + "id": 2227, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1393:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "1373:21:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1356:38:14" + }, + { + "assignments": [ + 2231 + ], + "declarations": [ + { + "constant": false, + "id": 2231, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "1422:6:14", + "nodeType": "VariableDeclaration", + "scope": 2259, + "src": "1408:20:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2230, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1408:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "id": 2236, + "initialValue": { + "arguments": [ + { + "id": 2234, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2222, + "src": "1442:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2233, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "1431:10:14", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_string_memory_ptr_$", + "typeString": "function (uint256) pure returns (string memory)" + }, + "typeName": { + "id": 2232, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1435:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + } + }, + "id": 2235, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1431:18:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1408:41:14" + }, + { + "assignments": [ + 2238 + ], + "declarations": [ + { + "constant": false, + "id": 2238, + "mutability": "mutable", + "name": "ptr", + "nameLocation": "1471:3:14", + "nodeType": "VariableDeclaration", + "scope": 2259, + "src": "1463:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2237, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1463:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2239, + "nodeType": "VariableDeclarationStatement", + "src": "1463:11:14" + }, + { + "AST": { + "nativeSrc": "1513:69:14", + "nodeType": "YulBlock", + "src": "1513:69:14", + "statements": [ + { + "nativeSrc": "1531:37:14", + "nodeType": "YulAssignment", + "src": "1531:37:14", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "1546:6:14", + "nodeType": "YulIdentifier", + "src": "1546:6:14" + }, + { + "kind": "number", + "nativeSrc": "1554:4:14", + "nodeType": "YulLiteral", + "src": "1554:4:14", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1542:3:14", + "nodeType": "YulIdentifier", + "src": "1542:3:14" + }, + "nativeSrc": "1542:17:14", + "nodeType": "YulFunctionCall", + "src": "1542:17:14" + }, + { + "name": "length", + "nativeSrc": "1561:6:14", + "nodeType": "YulIdentifier", + "src": "1561:6:14" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1538:3:14", + "nodeType": "YulIdentifier", + "src": "1538:3:14" + }, + "nativeSrc": "1538:30:14", + "nodeType": "YulFunctionCall", + "src": "1538:30:14" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "1531:3:14", + "nodeType": "YulIdentifier", + "src": "1531:3:14" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2231, + "isOffset": false, + "isSlot": false, + "src": "1546:6:14", + "valueSize": 1 + }, + { + "declaration": 2222, + "isOffset": false, + "isSlot": false, + "src": "1561:6:14", + "valueSize": 1 + }, + { + "declaration": 2238, + "isOffset": false, + "isSlot": false, + "src": "1531:3:14", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2240, + "nodeType": "InlineAssembly", + "src": "1488:94:14" + }, + { + "body": { + "id": 2255, + "nodeType": "Block", + "src": "1608:234:14", + "statements": [ + { + "expression": { + "id": 2243, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "--", + "prefix": false, + "src": "1626:5:14", + "subExpression": { + "id": 2242, + "name": "ptr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2238, + "src": "1626:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2244, + "nodeType": "ExpressionStatement", + "src": "1626:5:14" + }, + { + "AST": { + "nativeSrc": "1674:86:14", + "nodeType": "YulBlock", + "src": "1674:86:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "1704:3:14", + "nodeType": "YulIdentifier", + "src": "1704:3:14" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nativeSrc": "1718:5:14", + "nodeType": "YulIdentifier", + "src": "1718:5:14" + }, + { + "kind": "number", + "nativeSrc": "1725:2:14", + "nodeType": "YulLiteral", + "src": "1725:2:14", + "type": "", + "value": "10" + } + ], + "functionName": { + "name": "mod", + "nativeSrc": "1714:3:14", + "nodeType": "YulIdentifier", + "src": "1714:3:14" + }, + "nativeSrc": "1714:14:14", + "nodeType": "YulFunctionCall", + "src": "1714:14:14" + }, + { + "name": "HEX_DIGITS", + "nativeSrc": "1730:10:14", + "nodeType": "YulIdentifier", + "src": "1730:10:14" + } + ], + "functionName": { + "name": "byte", + "nativeSrc": "1709:4:14", + "nodeType": "YulIdentifier", + "src": "1709:4:14" + }, + "nativeSrc": "1709:32:14", + "nodeType": "YulFunctionCall", + "src": "1709:32:14" + } + ], + "functionName": { + "name": "mstore8", + "nativeSrc": "1696:7:14", + "nodeType": "YulIdentifier", + "src": "1696:7:14" + }, + "nativeSrc": "1696:46:14", + "nodeType": "YulFunctionCall", + "src": "1696:46:14" + }, + "nativeSrc": "1696:46:14", + "nodeType": "YulExpressionStatement", + "src": "1696:46:14" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2184, + "isOffset": false, + "isSlot": false, + "src": "1730:10:14", + "valueSize": 1 + }, + { + "declaration": 2238, + "isOffset": false, + "isSlot": false, + "src": "1704:3:14", + "valueSize": 1 + }, + { + "declaration": 2216, + "isOffset": false, + "isSlot": false, + "src": "1718:5:14", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2245, + "nodeType": "InlineAssembly", + "src": "1649:111:14" + }, + { + "expression": { + "id": 2248, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 2246, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2216, + "src": "1777:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "/=", + "rightHandSide": { + "hexValue": "3130", + "id": 2247, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1786:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "src": "1777:11:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2249, + "nodeType": "ExpressionStatement", + "src": "1777:11:14" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2252, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2250, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2216, + "src": "1810:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 2251, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1819:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "1810:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2254, + "nodeType": "IfStatement", + "src": "1806:21:14", + "trueBody": { + "id": 2253, + "nodeType": "Break", + "src": "1822:5:14" + } + } + ] + }, + "condition": { + "hexValue": "74727565", + "id": 2241, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1602:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "id": 2256, + "nodeType": "WhileStatement", + "src": "1595:247:14" + }, + { + "expression": { + "id": 2257, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2231, + "src": "1862:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 2220, + "id": 2258, + "nodeType": "Return", + "src": "1855:13:14" + } + ] + } + ] + }, + "documentation": { + "id": 2214, + "nodeType": "StructuredDocumentation", + "src": "1156:90:14", + "text": " @dev Converts a `uint256` to its ASCII `string` decimal representation." + }, + "id": 2261, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toString", + "nameLocation": "1260:8:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2217, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2216, + "mutability": "mutable", + "name": "value", + "nameLocation": "1277:5:14", + "nodeType": "VariableDeclaration", + "scope": 2261, + "src": "1269:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2215, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1269:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1268:15:14" + }, + "returnParameters": { + "id": 2220, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2219, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2261, + "src": "1307:13:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2218, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1307:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "1306:15:14" + }, + "scope": 3678, + "src": "1251:634:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2286, + "nodeType": "Block", + "src": "2061:92:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 2274, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2272, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2264, + "src": "2092:5:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "hexValue": "30", + "id": 2273, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2100:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "2092:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseExpression": { + "hexValue": "", + "id": 2276, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2110:2:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "typeString": "literal_string \"\"" + }, + "value": "" + }, + "id": 2277, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "Conditional", + "src": "2092:20:14", + "trueExpression": { + "hexValue": "2d", + "id": 2275, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2104:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_d3b8281179950f98149eefdb158d0e1acb56f56e8e343aa9fefafa7e36959561", + "typeString": "literal_string \"-\"" + }, + "value": "-" + }, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "arguments": [ + { + "arguments": [ + { + "id": 2281, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2264, + "src": "2138:5:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "expression": { + "id": 2279, + "name": "SignedMath", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8113, + "src": "2123:10:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SignedMath_$8113_$", + "typeString": "type(library SignedMath)" + } + }, + "id": 2280, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2134:3:14", + "memberName": "abs", + "nodeType": "MemberAccess", + "referencedDeclaration": 8112, + "src": "2123:14:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_int256_$returns$_t_uint256_$", + "typeString": "function (int256) pure returns (uint256)" + } + }, + "id": 2282, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2123:21:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2278, + "name": "toString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2261, + "src": "2114:8:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_string_memory_ptr_$", + "typeString": "function (uint256) pure returns (string memory)" + } + }, + "id": 2283, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2114:31:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "expression": { + "id": 2270, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2078:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_string_storage_ptr_$", + "typeString": "type(string storage pointer)" + }, + "typeName": { + "id": 2269, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2078:6:14", + "typeDescriptions": {} + } + }, + "id": 2271, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2085:6:14", + "memberName": "concat", + "nodeType": "MemberAccess", + "src": "2078:13:14", + "typeDescriptions": { + "typeIdentifier": "t_function_stringconcat_pure$__$returns$_t_string_memory_ptr_$", + "typeString": "function () pure returns (string memory)" + } + }, + "id": 2284, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2078:68:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 2268, + "id": 2285, + "nodeType": "Return", + "src": "2071:75:14" + } + ] + }, + "documentation": { + "id": 2262, + "nodeType": "StructuredDocumentation", + "src": "1891:89:14", + "text": " @dev Converts a `int256` to its ASCII `string` decimal representation." + }, + "id": 2287, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toStringSigned", + "nameLocation": "1994:14:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2265, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2264, + "mutability": "mutable", + "name": "value", + "nameLocation": "2016:5:14", + "nodeType": "VariableDeclaration", + "scope": 2287, + "src": "2009:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 2263, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "2009:6:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "2008:14:14" + }, + "returnParameters": { + "id": 2268, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2267, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2287, + "src": "2046:13:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2266, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2046:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "2045:15:14" + }, + "scope": 3678, + "src": "1985:168:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2306, + "nodeType": "Block", + "src": "2332:100:14", + "statements": [ + { + "id": 2305, + "nodeType": "UncheckedBlock", + "src": "2342:84:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2296, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2290, + "src": "2385:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2302, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 2299, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2290, + "src": "2404:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 2297, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "2392:4:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 2298, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2397:6:14", + "memberName": "log256", + "nodeType": "MemberAccess", + "referencedDeclaration": 6126, + "src": "2392:11:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256) pure returns (uint256)" + } + }, + "id": 2300, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2392:18:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "31", + "id": 2301, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2413:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "2392:22:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2295, + "name": "toHexString", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2307, + 2390, + 2410, + 2564 + ], + "referencedDeclaration": 2390, + "src": "2373:11:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_string_memory_ptr_$", + "typeString": "function (uint256,uint256) pure returns (string memory)" + } + }, + "id": 2303, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2373:42:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 2294, + "id": 2304, + "nodeType": "Return", + "src": "2366:49:14" + } + ] + } + ] + }, + "documentation": { + "id": 2288, + "nodeType": "StructuredDocumentation", + "src": "2159:94:14", + "text": " @dev Converts a `uint256` to its ASCII `string` hexadecimal representation." + }, + "id": 2307, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toHexString", + "nameLocation": "2267:11:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2291, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2290, + "mutability": "mutable", + "name": "value", + "nameLocation": "2287:5:14", + "nodeType": "VariableDeclaration", + "scope": 2307, + "src": "2279:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2289, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2279:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2278:15:14" + }, + "returnParameters": { + "id": 2294, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2293, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2307, + "src": "2317:13:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2292, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2317:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "2316:15:14" + }, + "scope": 3678, + "src": "2258:174:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2389, + "nodeType": "Block", + "src": "2645:435:14", + "statements": [ + { + "assignments": [ + 2318 + ], + "declarations": [ + { + "constant": false, + "id": 2318, + "mutability": "mutable", + "name": "localValue", + "nameLocation": "2663:10:14", + "nodeType": "VariableDeclaration", + "scope": 2389, + "src": "2655:18:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2317, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2655:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2320, + "initialValue": { + "id": 2319, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2310, + "src": "2676:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2655:26:14" + }, + { + "assignments": [ + 2322 + ], + "declarations": [ + { + "constant": false, + "id": 2322, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "2704:6:14", + "nodeType": "VariableDeclaration", + "scope": 2389, + "src": "2691:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2321, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2691:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 2331, + "initialValue": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2329, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2327, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 2325, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2723:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 2326, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2312, + "src": "2727:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2723:10:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "32", + "id": 2328, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2736:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "2723:14:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2324, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "2713:9:14", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (uint256) pure returns (bytes memory)" + }, + "typeName": { + "id": 2323, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2717:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + } + }, + "id": 2330, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2713:25:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2691:47:14" + }, + { + "expression": { + "id": 2336, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 2332, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2322, + "src": "2748:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2334, + "indexExpression": { + "hexValue": "30", + "id": 2333, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2755:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2748:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "hexValue": "30", + "id": 2335, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2760:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", + "typeString": "literal_string \"0\"" + }, + "value": "0" + }, + "src": "2748:15:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 2337, + "nodeType": "ExpressionStatement", + "src": "2748:15:14" + }, + { + "expression": { + "id": 2342, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 2338, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2322, + "src": "2773:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2340, + "indexExpression": { + "hexValue": "31", + "id": 2339, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2780:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2773:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "hexValue": "78", + "id": 2341, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2785:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_7521d1cadbcfa91eec65aa16715b94ffc1c9654ba57ea2ef1a2127bca1127a83", + "typeString": "literal_string \"x\"" + }, + "value": "x" + }, + "src": "2773:15:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 2343, + "nodeType": "ExpressionStatement", + "src": "2773:15:14" + }, + { + "body": { + "id": 2372, + "nodeType": "Block", + "src": "2843:95:14", + "statements": [ + { + "expression": { + "id": 2366, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 2358, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2322, + "src": "2857:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2360, + "indexExpression": { + "id": 2359, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2345, + "src": "2864:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2857:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "baseExpression": { + "id": 2361, + "name": "HEX_DIGITS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2184, + "src": "2869:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "id": 2365, + "indexExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2364, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2362, + "name": "localValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2318, + "src": "2880:10:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307866", + "id": 2363, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2893:3:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_15_by_1", + "typeString": "int_const 15" + }, + "value": "0xf" + }, + "src": "2880:16:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2869:28:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "src": "2857:40:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 2367, + "nodeType": "ExpressionStatement", + "src": "2857:40:14" + }, + { + "expression": { + "id": 2370, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 2368, + "name": "localValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2318, + "src": "2911:10:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": ">>=", + "rightHandSide": { + "hexValue": "34", + "id": 2369, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2926:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "2911:16:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2371, + "nodeType": "ExpressionStatement", + "src": "2911:16:14" + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2354, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2352, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2345, + "src": "2831:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "31", + "id": 2353, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2835:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "2831:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2373, + "initializationExpression": { + "assignments": [ + 2345 + ], + "declarations": [ + { + "constant": false, + "id": 2345, + "mutability": "mutable", + "name": "i", + "nameLocation": "2811:1:14", + "nodeType": "VariableDeclaration", + "scope": 2373, + "src": "2803:9:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2344, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2803:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2351, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2350, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2348, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 2346, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2815:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 2347, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2312, + "src": "2819:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2815:10:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "31", + "id": 2349, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2828:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "2815:14:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2803:26:14" + }, + "isSimpleCounterLoop": false, + "loopExpression": { + "expression": { + "id": 2356, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "--", + "prefix": true, + "src": "2838:3:14", + "subExpression": { + "id": 2355, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2345, + "src": "2840:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2357, + "nodeType": "ExpressionStatement", + "src": "2838:3:14" + }, + "nodeType": "ForStatement", + "src": "2798:140:14" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2376, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2374, + "name": "localValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2318, + "src": "2951:10:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "hexValue": "30", + "id": 2375, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2965:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "2951:15:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2383, + "nodeType": "IfStatement", + "src": "2947:96:14", + "trueBody": { + "id": 2382, + "nodeType": "Block", + "src": "2968:75:14", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "id": 2378, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2310, + "src": "3018:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2379, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2312, + "src": "3025:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2377, + "name": "StringsInsufficientHexLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2207, + "src": "2989:28:14", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint256_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint256,uint256) pure returns (error)" + } + }, + "id": 2380, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2989:43:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 2381, + "nodeType": "RevertStatement", + "src": "2982:50:14" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 2386, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2322, + "src": "3066:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 2385, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3059:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_string_storage_ptr_$", + "typeString": "type(string storage pointer)" + }, + "typeName": { + "id": 2384, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "3059:6:14", + "typeDescriptions": {} + } + }, + "id": 2387, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3059:14:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 2316, + "id": 2388, + "nodeType": "Return", + "src": "3052:21:14" + } + ] + }, + "documentation": { + "id": 2308, + "nodeType": "StructuredDocumentation", + "src": "2438:112:14", + "text": " @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length." + }, + "id": 2390, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toHexString", + "nameLocation": "2564:11:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2313, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2310, + "mutability": "mutable", + "name": "value", + "nameLocation": "2584:5:14", + "nodeType": "VariableDeclaration", + "scope": 2390, + "src": "2576:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2309, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2576:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2312, + "mutability": "mutable", + "name": "length", + "nameLocation": "2599:6:14", + "nodeType": "VariableDeclaration", + "scope": 2390, + "src": "2591:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2311, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2591:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2575:31:14" + }, + "returnParameters": { + "id": 2316, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2315, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2390, + "src": "2630:13:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2314, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2630:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "2629:15:14" + }, + "scope": 3678, + "src": "2555:525:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2409, + "nodeType": "Block", + "src": "3312:75:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "id": 2403, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2393, + "src": "3357:4:14", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 2402, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3349:7:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint160_$", + "typeString": "type(uint160)" + }, + "typeName": { + "id": 2401, + "name": "uint160", + "nodeType": "ElementaryTypeName", + "src": "3349:7:14", + "typeDescriptions": {} + } + }, + "id": 2404, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3349:13:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint160", + "typeString": "uint160" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint160", + "typeString": "uint160" + } + ], + "id": 2400, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3341:7:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 2399, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3341:7:14", + "typeDescriptions": {} + } + }, + "id": 2405, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3341:22:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2406, + "name": "ADDRESS_LENGTH", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2187, + "src": "3365:14:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + ], + "id": 2398, + "name": "toHexString", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2307, + 2390, + 2410, + 2564 + ], + "referencedDeclaration": 2390, + "src": "3329:11:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_string_memory_ptr_$", + "typeString": "function (uint256,uint256) pure returns (string memory)" + } + }, + "id": 2407, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3329:51:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 2397, + "id": 2408, + "nodeType": "Return", + "src": "3322:58:14" + } + ] + }, + "documentation": { + "id": 2391, + "nodeType": "StructuredDocumentation", + "src": "3086:148:14", + "text": " @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal\n representation." + }, + "id": 2410, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toHexString", + "nameLocation": "3248:11:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2394, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2393, + "mutability": "mutable", + "name": "addr", + "nameLocation": "3268:4:14", + "nodeType": "VariableDeclaration", + "scope": 2410, + "src": "3260:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 2392, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3260:7:14", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "3259:14:14" + }, + "returnParameters": { + "id": 2397, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2396, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2410, + "src": "3297:13:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2395, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "3297:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "3296:15:14" + }, + "scope": 3678, + "src": "3239:148:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2474, + "nodeType": "Block", + "src": "3644:642:14", + "statements": [ + { + "assignments": [ + 2419 + ], + "declarations": [ + { + "constant": false, + "id": 2419, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "3667:6:14", + "nodeType": "VariableDeclaration", + "scope": 2474, + "src": "3654:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2418, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3654:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 2426, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "id": 2423, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2413, + "src": "3694:4:14", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 2422, + "name": "toHexString", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2307, + 2390, + 2410, + 2564 + ], + "referencedDeclaration": 2410, + "src": "3682:11:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_address_$returns$_t_string_memory_ptr_$", + "typeString": "function (address) pure returns (string memory)" + } + }, + "id": 2424, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3682:17:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2421, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3676:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2420, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3676:5:14", + "typeDescriptions": {} + } + }, + "id": 2425, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3676:24:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3654:46:14" + }, + { + "assignments": [ + 2428 + ], + "declarations": [ + { + "constant": false, + "id": 2428, + "mutability": "mutable", + "name": "hashValue", + "nameLocation": "3793:9:14", + "nodeType": "VariableDeclaration", + "scope": 2474, + "src": "3785:17:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2427, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3785:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2429, + "nodeType": "VariableDeclarationStatement", + "src": "3785:17:14" + }, + { + "AST": { + "nativeSrc": "3837:78:14", + "nodeType": "YulBlock", + "src": "3837:78:14", + "statements": [ + { + "nativeSrc": "3851:54:14", + "nodeType": "YulAssignment", + "src": "3851:54:14", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3868:2:14", + "nodeType": "YulLiteral", + "src": "3868:2:14", + "type": "", + "value": "96" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "3886:6:14", + "nodeType": "YulIdentifier", + "src": "3886:6:14" + }, + { + "kind": "number", + "nativeSrc": "3894:4:14", + "nodeType": "YulLiteral", + "src": "3894:4:14", + "type": "", + "value": "0x22" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3882:3:14", + "nodeType": "YulIdentifier", + "src": "3882:3:14" + }, + "nativeSrc": "3882:17:14", + "nodeType": "YulFunctionCall", + "src": "3882:17:14" + }, + { + "kind": "number", + "nativeSrc": "3901:2:14", + "nodeType": "YulLiteral", + "src": "3901:2:14", + "type": "", + "value": "40" + } + ], + "functionName": { + "name": "keccak256", + "nativeSrc": "3872:9:14", + "nodeType": "YulIdentifier", + "src": "3872:9:14" + }, + "nativeSrc": "3872:32:14", + "nodeType": "YulFunctionCall", + "src": "3872:32:14" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "3864:3:14", + "nodeType": "YulIdentifier", + "src": "3864:3:14" + }, + "nativeSrc": "3864:41:14", + "nodeType": "YulFunctionCall", + "src": "3864:41:14" + }, + "variableNames": [ + { + "name": "hashValue", + "nativeSrc": "3851:9:14", + "nodeType": "YulIdentifier", + "src": "3851:9:14" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 2419, + "isOffset": false, + "isSlot": false, + "src": "3886:6:14", + "valueSize": 1 + }, + { + "declaration": 2428, + "isOffset": false, + "isSlot": false, + "src": "3851:9:14", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 2430, + "nodeType": "InlineAssembly", + "src": "3812:103:14" + }, + { + "body": { + "id": 2467, + "nodeType": "Block", + "src": "3958:291:14", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 2454, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2445, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2443, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2441, + "name": "hashValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2428, + "src": "4064:9:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307866", + "id": 2442, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4076:3:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_15_by_1", + "typeString": "int_const 15" + }, + "value": "0xf" + }, + "src": "4064:15:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "37", + "id": 2444, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4082:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_7_by_1", + "typeString": "int_const 7" + }, + "value": "7" + }, + "src": "4064:19:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 2453, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "baseExpression": { + "id": 2448, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2419, + "src": "4093:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2450, + "indexExpression": { + "id": 2449, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2432, + "src": "4100:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4093:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 2447, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4087:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": { + "id": 2446, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "4087:5:14", + "typeDescriptions": {} + } + }, + "id": 2451, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4087:16:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "3936", + "id": 2452, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4106:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_96_by_1", + "typeString": "int_const 96" + }, + "value": "96" + }, + "src": "4087:21:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "4064:44:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2462, + "nodeType": "IfStatement", + "src": "4060:150:14", + "trueBody": { + "id": 2461, + "nodeType": "Block", + "src": "4110:100:14", + "statements": [ + { + "expression": { + "id": 2459, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 2455, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2419, + "src": "4178:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2457, + "indexExpression": { + "id": 2456, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2432, + "src": "4185:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "4178:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "Assignment", + "operator": "^=", + "rightHandSide": { + "hexValue": "30783230", + "id": 2458, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4191:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "0x20" + }, + "src": "4178:17:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 2460, + "nodeType": "ExpressionStatement", + "src": "4178:17:14" + } + ] + } + }, + { + "expression": { + "id": 2465, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 2463, + "name": "hashValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2428, + "src": "4223:9:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": ">>=", + "rightHandSide": { + "hexValue": "34", + "id": 2464, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4237:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "4223:15:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2466, + "nodeType": "ExpressionStatement", + "src": "4223:15:14" + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2437, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2435, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2432, + "src": "3946:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "31", + "id": 2436, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3950:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "3946:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2468, + "initializationExpression": { + "assignments": [ + 2432 + ], + "declarations": [ + { + "constant": false, + "id": 2432, + "mutability": "mutable", + "name": "i", + "nameLocation": "3938:1:14", + "nodeType": "VariableDeclaration", + "scope": 2468, + "src": "3930:9:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2431, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3930:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2434, + "initialValue": { + "hexValue": "3431", + "id": 2433, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3942:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_41_by_1", + "typeString": "int_const 41" + }, + "value": "41" + }, + "nodeType": "VariableDeclarationStatement", + "src": "3930:14:14" + }, + "isSimpleCounterLoop": false, + "loopExpression": { + "expression": { + "id": 2439, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "--", + "prefix": true, + "src": "3953:3:14", + "subExpression": { + "id": 2438, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2432, + "src": "3955:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2440, + "nodeType": "ExpressionStatement", + "src": "3953:3:14" + }, + "nodeType": "ForStatement", + "src": "3925:324:14" + }, + { + "expression": { + "arguments": [ + { + "id": 2471, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2419, + "src": "4272:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 2470, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4265:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_string_storage_ptr_$", + "typeString": "type(string storage pointer)" + }, + "typeName": { + "id": 2469, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "4265:6:14", + "typeDescriptions": {} + } + }, + "id": 2472, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4265:14:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 2417, + "id": 2473, + "nodeType": "Return", + "src": "4258:21:14" + } + ] + }, + "documentation": { + "id": 2411, + "nodeType": "StructuredDocumentation", + "src": "3393:165:14", + "text": " @dev Converts an `address` with fixed length of 20 bytes to its checksummed ASCII `string` hexadecimal\n representation, according to EIP-55." + }, + "id": 2475, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toChecksumHexString", + "nameLocation": "3572:19:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2414, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2413, + "mutability": "mutable", + "name": "addr", + "nameLocation": "3600:4:14", + "nodeType": "VariableDeclaration", + "scope": 2475, + "src": "3592:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 2412, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3592:7:14", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "3591:14:14" + }, + "returnParameters": { + "id": 2417, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2416, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2475, + "src": "3629:13:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2415, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "3629:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "3628:15:14" + }, + "scope": 3678, + "src": "3563:723:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2563, + "nodeType": "Block", + "src": "4475:424:14", + "statements": [ + { + "id": 2562, + "nodeType": "UncheckedBlock", + "src": "4485:408:14", + "statements": [ + { + "assignments": [ + 2484 + ], + "declarations": [ + { + "constant": false, + "id": 2484, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "4522:6:14", + "nodeType": "VariableDeclaration", + "scope": 2562, + "src": "4509:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2483, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4509:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 2494, + "initialValue": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2492, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2490, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 2487, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4541:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "expression": { + "id": 2488, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2478, + "src": "4545:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2489, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4551:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "4545:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4541:16:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "32", + "id": 2491, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4560:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "4541:20:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2486, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "4531:9:14", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (uint256) pure returns (bytes memory)" + }, + "typeName": { + "id": 2485, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4535:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + } + }, + "id": 2493, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4531:31:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4509:53:14" + }, + { + "expression": { + "id": 2499, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 2495, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2484, + "src": "4576:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2497, + "indexExpression": { + "hexValue": "30", + "id": 2496, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4583:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "4576:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "hexValue": "30", + "id": 2498, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4588:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", + "typeString": "literal_string \"0\"" + }, + "value": "0" + }, + "src": "4576:15:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 2500, + "nodeType": "ExpressionStatement", + "src": "4576:15:14" + }, + { + "expression": { + "id": 2505, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 2501, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2484, + "src": "4605:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2503, + "indexExpression": { + "hexValue": "31", + "id": 2502, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4612:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "4605:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "hexValue": "78", + "id": 2504, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4617:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_7521d1cadbcfa91eec65aa16715b94ffc1c9654ba57ea2ef1a2127bca1127a83", + "typeString": "literal_string \"x\"" + }, + "value": "x" + }, + "src": "4605:15:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 2506, + "nodeType": "ExpressionStatement", + "src": "4605:15:14" + }, + { + "body": { + "id": 2555, + "nodeType": "Block", + "src": "4677:171:14", + "statements": [ + { + "assignments": [ + 2519 + ], + "declarations": [ + { + "constant": false, + "id": 2519, + "mutability": "mutable", + "name": "v", + "nameLocation": "4701:1:14", + "nodeType": "VariableDeclaration", + "scope": 2555, + "src": "4695:7:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 2518, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "4695:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "id": 2526, + "initialValue": { + "arguments": [ + { + "baseExpression": { + "id": 2522, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2478, + "src": "4711:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2524, + "indexExpression": { + "id": 2523, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2508, + "src": "4717:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4711:8:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 2521, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4705:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": { + "id": 2520, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "4705:5:14", + "typeDescriptions": {} + } + }, + "id": 2525, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4705:15:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4695:25:14" + }, + { + "expression": { + "id": 2539, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 2527, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2484, + "src": "4738:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2533, + "indexExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2532, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2530, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 2528, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4745:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 2529, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2508, + "src": "4749:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4745:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "32", + "id": 2531, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4753:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "4745:9:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "4738:17:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "baseExpression": { + "id": 2534, + "name": "HEX_DIGITS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2184, + "src": "4758:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "id": 2538, + "indexExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 2537, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2535, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2519, + "src": "4769:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "34", + "id": 2536, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4774:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "4769:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4758:18:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "src": "4738:38:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 2540, + "nodeType": "ExpressionStatement", + "src": "4738:38:14" + }, + { + "expression": { + "id": 2553, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 2541, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2484, + "src": "4794:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2547, + "indexExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2546, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2544, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 2542, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4801:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 2543, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2508, + "src": "4805:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4801:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "33", + "id": 2545, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4809:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "src": "4801:9:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "4794:17:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "baseExpression": { + "id": 2548, + "name": "HEX_DIGITS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2184, + "src": "4814:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "id": 2552, + "indexExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 2551, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2549, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2519, + "src": "4825:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "307866", + "id": 2550, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4829:3:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_15_by_1", + "typeString": "int_const 15" + }, + "value": "0xf" + }, + "src": "4825:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4814:19:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "src": "4794:39:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 2554, + "nodeType": "ExpressionStatement", + "src": "4794:39:14" + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2514, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2511, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2508, + "src": "4654:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "expression": { + "id": 2512, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2478, + "src": "4658:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2513, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4664:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "4658:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4654:16:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2556, + "initializationExpression": { + "assignments": [ + 2508 + ], + "declarations": [ + { + "constant": false, + "id": 2508, + "mutability": "mutable", + "name": "i", + "nameLocation": "4647:1:14", + "nodeType": "VariableDeclaration", + "scope": 2556, + "src": "4639:9:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2507, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4639:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2510, + "initialValue": { + "hexValue": "30", + "id": 2509, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4651:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "4639:13:14" + }, + "isSimpleCounterLoop": true, + "loopExpression": { + "expression": { + "id": 2516, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": true, + "src": "4672:3:14", + "subExpression": { + "id": 2515, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2508, + "src": "4674:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2517, + "nodeType": "ExpressionStatement", + "src": "4672:3:14" + }, + "nodeType": "ForStatement", + "src": "4634:214:14" + }, + { + "expression": { + "arguments": [ + { + "id": 2559, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2484, + "src": "4875:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 2558, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4868:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_string_storage_ptr_$", + "typeString": "type(string storage pointer)" + }, + "typeName": { + "id": 2557, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "4868:6:14", + "typeDescriptions": {} + } + }, + "id": 2560, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4868:14:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 2482, + "id": 2561, + "nodeType": "Return", + "src": "4861:21:14" + } + ] + } + ] + }, + "documentation": { + "id": 2476, + "nodeType": "StructuredDocumentation", + "src": "4292:99:14", + "text": " @dev Converts a `bytes` buffer to its ASCII `string` hexadecimal representation." + }, + "id": 2564, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toHexString", + "nameLocation": "4405:11:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2479, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2478, + "mutability": "mutable", + "name": "input", + "nameLocation": "4430:5:14", + "nodeType": "VariableDeclaration", + "scope": 2564, + "src": "4417:18:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2477, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4417:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "4416:20:14" + }, + "returnParameters": { + "id": 2482, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2481, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2564, + "src": "4460:13:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2480, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "4460:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "4459:15:14" + }, + "scope": 3678, + "src": "4396:503:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2586, + "nodeType": "Block", + "src": "5054:55:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "id": 2578, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2567, + "src": "5089:1:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2577, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5083:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2576, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5083:5:14", + "typeDescriptions": {} + } + }, + "id": 2579, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5083:8:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "arguments": [ + { + "id": 2582, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2569, + "src": "5099:1:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2581, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5093:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2580, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5093:5:14", + "typeDescriptions": {} + } + }, + "id": 2583, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5093:8:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "id": 2574, + "name": "Bytes", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1632, + "src": "5071:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Bytes_$1632_$", + "typeString": "type(library Bytes)" + } + }, + "id": 2575, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5077:5:14", + "memberName": "equal", + "nodeType": "MemberAccess", + "referencedDeclaration": 1282, + "src": "5071:11:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_bytes_memory_ptr_$returns$_t_bool_$", + "typeString": "function (bytes memory,bytes memory) pure returns (bool)" + } + }, + "id": 2584, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5071:31:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 2573, + "id": 2585, + "nodeType": "Return", + "src": "5064:38:14" + } + ] + }, + "documentation": { + "id": 2565, + "nodeType": "StructuredDocumentation", + "src": "4905:66:14", + "text": " @dev Returns true if the two strings are equal." + }, + "id": 2587, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "equal", + "nameLocation": "4985:5:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2570, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2567, + "mutability": "mutable", + "name": "a", + "nameLocation": "5005:1:14", + "nodeType": "VariableDeclaration", + "scope": 2587, + "src": "4991:15:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2566, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "4991:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2569, + "mutability": "mutable", + "name": "b", + "nameLocation": "5022:1:14", + "nodeType": "VariableDeclaration", + "scope": 2587, + "src": "5008:15:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2568, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "5008:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "4990:34:14" + }, + "returnParameters": { + "id": 2573, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2572, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2587, + "src": "5048:4:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2571, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "5048:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "5047:6:14" + }, + "scope": 3678, + "src": "4976:133:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2605, + "nodeType": "Block", + "src": "5406:64:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2596, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2590, + "src": "5433:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "hexValue": "30", + "id": 2597, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5440:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "expression": { + "arguments": [ + { + "id": 2600, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2590, + "src": "5449:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2599, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5443:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2598, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5443:5:14", + "typeDescriptions": {} + } + }, + "id": 2601, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5443:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2602, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5456:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "5443:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2595, + "name": "parseUint", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2606, + 2637 + ], + "referencedDeclaration": 2637, + "src": "5423:9:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (uint256)" + } + }, + "id": 2603, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5423:40:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 2594, + "id": 2604, + "nodeType": "Return", + "src": "5416:47:14" + } + ] + }, + "documentation": { + "id": 2588, + "nodeType": "StructuredDocumentation", + "src": "5115:214:14", + "text": " @dev Parse a decimal string and returns the value as a `uint256`.\n Requirements:\n - The string must be formatted as `[0-9]*`\n - The result must fit into an `uint256` type" + }, + "id": 2606, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parseUint", + "nameLocation": "5343:9:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2591, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2590, + "mutability": "mutable", + "name": "input", + "nameLocation": "5367:5:14", + "nodeType": "VariableDeclaration", + "scope": 2606, + "src": "5353:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2589, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "5353:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "5352:21:14" + }, + "returnParameters": { + "id": 2594, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2593, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2606, + "src": "5397:7:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2592, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5397:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5396:9:14" + }, + "scope": 3678, + "src": "5334:136:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2636, + "nodeType": "Block", + "src": "5875:153:14", + "statements": [ + { + "assignments": [ + 2619, + 2621 + ], + "declarations": [ + { + "constant": false, + "id": 2619, + "mutability": "mutable", + "name": "success", + "nameLocation": "5891:7:14", + "nodeType": "VariableDeclaration", + "scope": 2636, + "src": "5886:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2618, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "5886:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2621, + "mutability": "mutable", + "name": "value", + "nameLocation": "5908:5:14", + "nodeType": "VariableDeclaration", + "scope": 2636, + "src": "5900:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2620, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5900:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2627, + "initialValue": { + "arguments": [ + { + "id": 2623, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2609, + "src": "5930:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "id": 2624, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2611, + "src": "5937:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2625, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2613, + "src": "5944:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2622, + "name": "tryParseUint", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2658, + 2695 + ], + "referencedDeclaration": 2695, + "src": "5917:12:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 2626, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5917:31:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "5885:63:14" + }, + { + "condition": { + "id": 2629, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "5962:8:14", + "subExpression": { + "id": 2628, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2619, + "src": "5963:7:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2633, + "nodeType": "IfStatement", + "src": "5958:41:14", + "trueBody": { + "errorCall": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 2630, + "name": "StringsInvalidChar", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2210, + "src": "5979:18:14", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$__$returns$_t_error_$", + "typeString": "function () pure returns (error)" + } + }, + "id": 2631, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5979:20:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 2632, + "nodeType": "RevertStatement", + "src": "5972:27:14" + } + }, + { + "expression": { + "id": 2634, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2621, + "src": "6016:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 2617, + "id": 2635, + "nodeType": "Return", + "src": "6009:12:14" + } + ] + }, + "documentation": { + "id": 2607, + "nodeType": "StructuredDocumentation", + "src": "5476:294:14", + "text": " @dev Variant of {parseUint-string} that parses a substring of `input` located between position `begin` (included) and\n `end` (excluded).\n Requirements:\n - The substring must be formatted as `[0-9]*`\n - The result must fit into an `uint256` type" + }, + "id": 2637, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parseUint", + "nameLocation": "5784:9:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2614, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2609, + "mutability": "mutable", + "name": "input", + "nameLocation": "5808:5:14", + "nodeType": "VariableDeclaration", + "scope": 2637, + "src": "5794:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2608, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "5794:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2611, + "mutability": "mutable", + "name": "begin", + "nameLocation": "5823:5:14", + "nodeType": "VariableDeclaration", + "scope": 2637, + "src": "5815:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2610, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5815:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2613, + "mutability": "mutable", + "name": "end", + "nameLocation": "5838:3:14", + "nodeType": "VariableDeclaration", + "scope": 2637, + "src": "5830:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2612, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5830:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5793:49:14" + }, + "returnParameters": { + "id": 2617, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2616, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2637, + "src": "5866:7:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2615, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5866:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5865:9:14" + }, + "scope": 3678, + "src": "5775:253:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2657, + "nodeType": "Block", + "src": "6349:83:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2648, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2640, + "src": "6395:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "hexValue": "30", + "id": 2649, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6402:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "expression": { + "arguments": [ + { + "id": 2652, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2640, + "src": "6411:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2651, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6405:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2650, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "6405:5:14", + "typeDescriptions": {} + } + }, + "id": 2653, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6405:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2654, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6418:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "6405:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2647, + "name": "_tryParseUintUncheckedBounds", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2765, + "src": "6366:28:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 2655, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6366:59:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "functionReturnParameters": 2646, + "id": 2656, + "nodeType": "Return", + "src": "6359:66:14" + } + ] + }, + "documentation": { + "id": 2638, + "nodeType": "StructuredDocumentation", + "src": "6034:215:14", + "text": " @dev Variant of {parseUint-string} that returns false if the parsing fails because of an invalid character.\n NOTE: This function will revert if the result does not fit in a `uint256`." + }, + "id": 2658, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryParseUint", + "nameLocation": "6263:12:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2641, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2640, + "mutability": "mutable", + "name": "input", + "nameLocation": "6290:5:14", + "nodeType": "VariableDeclaration", + "scope": 2658, + "src": "6276:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2639, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "6276:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "6275:21:14" + }, + "returnParameters": { + "id": 2646, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2643, + "mutability": "mutable", + "name": "success", + "nameLocation": "6325:7:14", + "nodeType": "VariableDeclaration", + "scope": 2658, + "src": "6320:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2642, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "6320:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2645, + "mutability": "mutable", + "name": "value", + "nameLocation": "6342:5:14", + "nodeType": "VariableDeclaration", + "scope": 2658, + "src": "6334:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2644, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6334:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "6319:29:14" + }, + "scope": 3678, + "src": "6254:178:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2694, + "nodeType": "Block", + "src": "6834:144:14", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 2682, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2678, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2672, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2665, + "src": "6848:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 2675, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2661, + "src": "6860:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2674, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6854:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2673, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "6854:5:14", + "typeDescriptions": {} + } + }, + "id": 2676, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6854:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2677, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6867:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "6854:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6848:25:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2681, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2679, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2663, + "src": "6877:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "id": 2680, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2665, + "src": "6885:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6877:11:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "6848:40:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2687, + "nodeType": "IfStatement", + "src": "6844:63:14", + "trueBody": { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 2683, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6898:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "hexValue": "30", + "id": 2684, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6905:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "id": 2685, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "6897:10:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$", + "typeString": "tuple(bool,int_const 0)" + } + }, + "functionReturnParameters": 2671, + "id": 2686, + "nodeType": "Return", + "src": "6890:17:14" + } + }, + { + "expression": { + "arguments": [ + { + "id": 2689, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2661, + "src": "6953:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "id": 2690, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2663, + "src": "6960:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2691, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2665, + "src": "6967:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2688, + "name": "_tryParseUintUncheckedBounds", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2765, + "src": "6924:28:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 2692, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6924:47:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "functionReturnParameters": 2671, + "id": 2693, + "nodeType": "Return", + "src": "6917:54:14" + } + ] + }, + "documentation": { + "id": 2659, + "nodeType": "StructuredDocumentation", + "src": "6438:238:14", + "text": " @dev Variant of {parseUint-string-uint256-uint256} that returns false if the parsing fails because of an invalid\n character.\n NOTE: This function will revert if the result does not fit in a `uint256`." + }, + "id": 2695, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryParseUint", + "nameLocation": "6690:12:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2666, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2661, + "mutability": "mutable", + "name": "input", + "nameLocation": "6726:5:14", + "nodeType": "VariableDeclaration", + "scope": 2695, + "src": "6712:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2660, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "6712:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2663, + "mutability": "mutable", + "name": "begin", + "nameLocation": "6749:5:14", + "nodeType": "VariableDeclaration", + "scope": 2695, + "src": "6741:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2662, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6741:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2665, + "mutability": "mutable", + "name": "end", + "nameLocation": "6772:3:14", + "nodeType": "VariableDeclaration", + "scope": 2695, + "src": "6764:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2664, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6764:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "6702:79:14" + }, + "returnParameters": { + "id": 2671, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2668, + "mutability": "mutable", + "name": "success", + "nameLocation": "6810:7:14", + "nodeType": "VariableDeclaration", + "scope": 2695, + "src": "6805:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2667, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "6805:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2670, + "mutability": "mutable", + "name": "value", + "nameLocation": "6827:5:14", + "nodeType": "VariableDeclaration", + "scope": 2695, + "src": "6819:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2669, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6819:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "6804:29:14" + }, + "scope": 3678, + "src": "6681:297:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2764, + "nodeType": "Block", + "src": "7381:347:14", + "statements": [ + { + "assignments": [ + 2710 + ], + "declarations": [ + { + "constant": false, + "id": 2710, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "7404:6:14", + "nodeType": "VariableDeclaration", + "scope": 2764, + "src": "7391:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2709, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "7391:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 2715, + "initialValue": { + "arguments": [ + { + "id": 2713, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2698, + "src": "7419:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2712, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "7413:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2711, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "7413:5:14", + "typeDescriptions": {} + } + }, + "id": 2714, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7413:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "7391:34:14" + }, + { + "assignments": [ + 2717 + ], + "declarations": [ + { + "constant": false, + "id": 2717, + "mutability": "mutable", + "name": "result", + "nameLocation": "7444:6:14", + "nodeType": "VariableDeclaration", + "scope": 2764, + "src": "7436:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2716, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7436:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2719, + "initialValue": { + "hexValue": "30", + "id": 2718, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7453:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "7436:18:14" + }, + { + "body": { + "id": 2758, + "nodeType": "Block", + "src": "7502:189:14", + "statements": [ + { + "assignments": [ + 2731 + ], + "declarations": [ + { + "constant": false, + "id": 2731, + "mutability": "mutable", + "name": "chr", + "nameLocation": "7522:3:14", + "nodeType": "VariableDeclaration", + "scope": 2758, + "src": "7516:9:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 2730, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "7516:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "id": 2741, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "id": 2736, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2710, + "src": "7571:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 2737, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2721, + "src": "7579:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2735, + "name": "_unsafeReadBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3665, + "src": "7548:22:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (bytes memory,uint256) pure returns (bytes32)" + } + }, + "id": 2738, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7548:33:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 2734, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "7541:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 2733, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "7541:6:14", + "typeDescriptions": {} + } + }, + "id": 2739, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7541:41:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 2732, + "name": "_tryParseChr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3445, + "src": "7528:12:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes1_$returns$_t_uint8_$", + "typeString": "function (bytes1) pure returns (uint8)" + } + }, + "id": 2740, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7528:55:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "7516:67:14" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 2744, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2742, + "name": "chr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2731, + "src": "7601:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "39", + "id": 2743, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7607:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_9_by_1", + "typeString": "int_const 9" + }, + "value": "9" + }, + "src": "7601:7:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2749, + "nodeType": "IfStatement", + "src": "7597:30:14", + "trueBody": { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 2745, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7618:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "hexValue": "30", + "id": 2746, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7625:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "id": 2747, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "7617:10:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$", + "typeString": "tuple(bool,int_const 0)" + } + }, + "functionReturnParameters": 2708, + "id": 2748, + "nodeType": "Return", + "src": "7610:17:14" + } + }, + { + "expression": { + "id": 2752, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 2750, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2717, + "src": "7641:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "*=", + "rightHandSide": { + "hexValue": "3130", + "id": 2751, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7651:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "src": "7641:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2753, + "nodeType": "ExpressionStatement", + "src": "7641:12:14" + }, + { + "expression": { + "id": 2756, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 2754, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2717, + "src": "7667:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "id": 2755, + "name": "chr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2731, + "src": "7677:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "src": "7667:13:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2757, + "nodeType": "ExpressionStatement", + "src": "7667:13:14" + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2726, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2724, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2721, + "src": "7488:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 2725, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2702, + "src": "7492:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7488:7:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2759, + "initializationExpression": { + "assignments": [ + 2721 + ], + "declarations": [ + { + "constant": false, + "id": 2721, + "mutability": "mutable", + "name": "i", + "nameLocation": "7477:1:14", + "nodeType": "VariableDeclaration", + "scope": 2759, + "src": "7469:9:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2720, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7469:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2723, + "initialValue": { + "id": 2722, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2700, + "src": "7481:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "7469:17:14" + }, + "isSimpleCounterLoop": true, + "loopExpression": { + "expression": { + "id": 2728, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": true, + "src": "7497:3:14", + "subExpression": { + "id": 2727, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2721, + "src": "7499:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2729, + "nodeType": "ExpressionStatement", + "src": "7497:3:14" + }, + "nodeType": "ForStatement", + "src": "7464:227:14" + }, + { + "expression": { + "components": [ + { + "hexValue": "74727565", + "id": 2760, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7708:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + { + "id": 2761, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2717, + "src": "7714:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 2762, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "7707:14:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "functionReturnParameters": 2708, + "id": 2763, + "nodeType": "Return", + "src": "7700:21:14" + } + ] + }, + "documentation": { + "id": 2696, + "nodeType": "StructuredDocumentation", + "src": "6984:224:14", + "text": " @dev Implementation of {tryParseUint-string-uint256-uint256} that does not check bounds. Caller should make sure that\n `begin <= end <= input.length`. Other inputs would result in undefined behavior." + }, + "id": 2765, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_tryParseUintUncheckedBounds", + "nameLocation": "7222:28:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2703, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2698, + "mutability": "mutable", + "name": "input", + "nameLocation": "7274:5:14", + "nodeType": "VariableDeclaration", + "scope": 2765, + "src": "7260:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2697, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "7260:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2700, + "mutability": "mutable", + "name": "begin", + "nameLocation": "7297:5:14", + "nodeType": "VariableDeclaration", + "scope": 2765, + "src": "7289:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2699, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7289:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2702, + "mutability": "mutable", + "name": "end", + "nameLocation": "7320:3:14", + "nodeType": "VariableDeclaration", + "scope": 2765, + "src": "7312:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2701, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7312:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7250:79:14" + }, + "returnParameters": { + "id": 2708, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2705, + "mutability": "mutable", + "name": "success", + "nameLocation": "7357:7:14", + "nodeType": "VariableDeclaration", + "scope": 2765, + "src": "7352:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2704, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "7352:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2707, + "mutability": "mutable", + "name": "value", + "nameLocation": "7374:5:14", + "nodeType": "VariableDeclaration", + "scope": 2765, + "src": "7366:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2706, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7366:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7351:29:14" + }, + "scope": 3678, + "src": "7213:515:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 2783, + "nodeType": "Block", + "src": "8025:63:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2774, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2768, + "src": "8051:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "hexValue": "30", + "id": 2775, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8058:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "expression": { + "arguments": [ + { + "id": 2778, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2768, + "src": "8067:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2777, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8061:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2776, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "8061:5:14", + "typeDescriptions": {} + } + }, + "id": 2779, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8061:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2780, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "8074:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "8061:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2773, + "name": "parseInt", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2784, + 2815 + ], + "referencedDeclaration": 2815, + "src": "8042:8:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_int256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (int256)" + } + }, + "id": 2781, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8042:39:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "functionReturnParameters": 2772, + "id": 2782, + "nodeType": "Return", + "src": "8035:46:14" + } + ] + }, + "documentation": { + "id": 2766, + "nodeType": "StructuredDocumentation", + "src": "7734:216:14", + "text": " @dev Parse a decimal string and returns the value as a `int256`.\n Requirements:\n - The string must be formatted as `[-+]?[0-9]*`\n - The result must fit in an `int256` type." + }, + "id": 2784, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parseInt", + "nameLocation": "7964:8:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2769, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2768, + "mutability": "mutable", + "name": "input", + "nameLocation": "7987:5:14", + "nodeType": "VariableDeclaration", + "scope": 2784, + "src": "7973:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2767, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "7973:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "7972:21:14" + }, + "returnParameters": { + "id": 2772, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2771, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2784, + "src": "8017:6:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 2770, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "8017:6:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "8016:8:14" + }, + "scope": 3678, + "src": "7955:133:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2814, + "nodeType": "Block", + "src": "8493:151:14", + "statements": [ + { + "assignments": [ + 2797, + 2799 + ], + "declarations": [ + { + "constant": false, + "id": 2797, + "mutability": "mutable", + "name": "success", + "nameLocation": "8509:7:14", + "nodeType": "VariableDeclaration", + "scope": 2814, + "src": "8504:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2796, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "8504:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2799, + "mutability": "mutable", + "name": "value", + "nameLocation": "8525:5:14", + "nodeType": "VariableDeclaration", + "scope": 2814, + "src": "8518:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 2798, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "8518:6:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "id": 2805, + "initialValue": { + "arguments": [ + { + "id": 2801, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2787, + "src": "8546:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "id": 2802, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2789, + "src": "8553:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2803, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2791, + "src": "8560:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2800, + "name": "tryParseInt", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2836, + 2878 + ], + "referencedDeclaration": 2878, + "src": "8534:11:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_int256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,int256)" + } + }, + "id": 2804, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8534:30:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_int256_$", + "typeString": "tuple(bool,int256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8503:61:14" + }, + { + "condition": { + "id": 2807, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "8578:8:14", + "subExpression": { + "id": 2806, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2797, + "src": "8579:7:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2811, + "nodeType": "IfStatement", + "src": "8574:41:14", + "trueBody": { + "errorCall": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 2808, + "name": "StringsInvalidChar", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2210, + "src": "8595:18:14", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$__$returns$_t_error_$", + "typeString": "function () pure returns (error)" + } + }, + "id": 2809, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8595:20:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 2810, + "nodeType": "RevertStatement", + "src": "8588:27:14" + } + }, + { + "expression": { + "id": 2812, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2799, + "src": "8632:5:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "functionReturnParameters": 2795, + "id": 2813, + "nodeType": "Return", + "src": "8625:12:14" + } + ] + }, + "documentation": { + "id": 2785, + "nodeType": "StructuredDocumentation", + "src": "8094:296:14", + "text": " @dev Variant of {parseInt-string} that parses a substring of `input` located between position `begin` (included) and\n `end` (excluded).\n Requirements:\n - The substring must be formatted as `[-+]?[0-9]*`\n - The result must fit in an `int256` type." + }, + "id": 2815, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parseInt", + "nameLocation": "8404:8:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2792, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2787, + "mutability": "mutable", + "name": "input", + "nameLocation": "8427:5:14", + "nodeType": "VariableDeclaration", + "scope": 2815, + "src": "8413:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2786, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "8413:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2789, + "mutability": "mutable", + "name": "begin", + "nameLocation": "8442:5:14", + "nodeType": "VariableDeclaration", + "scope": 2815, + "src": "8434:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2788, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8434:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2791, + "mutability": "mutable", + "name": "end", + "nameLocation": "8457:3:14", + "nodeType": "VariableDeclaration", + "scope": 2815, + "src": "8449:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2790, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8449:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "8412:49:14" + }, + "returnParameters": { + "id": 2795, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2794, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2815, + "src": "8485:6:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 2793, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "8485:6:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "8484:8:14" + }, + "scope": 3678, + "src": "8395:249:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2835, + "nodeType": "Block", + "src": "9035:82:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2826, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2818, + "src": "9080:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "hexValue": "30", + "id": 2827, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9087:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "expression": { + "arguments": [ + { + "id": 2830, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2818, + "src": "9096:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2829, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "9090:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2828, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "9090:5:14", + "typeDescriptions": {} + } + }, + "id": 2831, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9090:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2832, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "9103:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "9090:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2825, + "name": "_tryParseIntUncheckedBounds", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2999, + "src": "9052:27:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_int256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,int256)" + } + }, + "id": 2833, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9052:58:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_int256_$", + "typeString": "tuple(bool,int256)" + } + }, + "functionReturnParameters": 2824, + "id": 2834, + "nodeType": "Return", + "src": "9045:65:14" + } + ] + }, + "documentation": { + "id": 2816, + "nodeType": "StructuredDocumentation", + "src": "8650:287:14", + "text": " @dev Variant of {parseInt-string} that returns false if the parsing fails because of an invalid character or if\n the result does not fit in a `int256`.\n NOTE: This function will revert if the absolute value of the result does not fit in a `uint256`." + }, + "id": 2836, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryParseInt", + "nameLocation": "8951:11:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2819, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2818, + "mutability": "mutable", + "name": "input", + "nameLocation": "8977:5:14", + "nodeType": "VariableDeclaration", + "scope": 2836, + "src": "8963:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2817, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "8963:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "8962:21:14" + }, + "returnParameters": { + "id": 2824, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2821, + "mutability": "mutable", + "name": "success", + "nameLocation": "9012:7:14", + "nodeType": "VariableDeclaration", + "scope": 2836, + "src": "9007:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2820, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "9007:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2823, + "mutability": "mutable", + "name": "value", + "nameLocation": "9028:5:14", + "nodeType": "VariableDeclaration", + "scope": 2836, + "src": "9021:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 2822, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "9021:6:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "9006:28:14" + }, + "scope": 3678, + "src": "8942:175:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "constant": true, + "id": 2841, + "mutability": "constant", + "name": "ABS_MIN_INT256", + "nameLocation": "9148:14:14", + "nodeType": "VariableDeclaration", + "scope": 3678, + "src": "9123:50:14", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2837, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "9123:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "commonType": { + "typeIdentifier": "t_rational_57896044618658097711785492504343953926634992332820282019728792003956564819968_by_1", + "typeString": "int_const 5789...(69 digits omitted)...9968" + }, + "id": 2840, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 2838, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9165:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "323535", + "id": 2839, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9170:3:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "255" + }, + "src": "9165:8:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_57896044618658097711785492504343953926634992332820282019728792003956564819968_by_1", + "typeString": "int_const 5789...(69 digits omitted)...9968" + } + }, + "visibility": "private" + }, + { + "body": { + "id": 2877, + "nodeType": "Block", + "src": "9639:143:14", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 2865, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2861, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2855, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2848, + "src": "9653:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 2858, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2844, + "src": "9665:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2857, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "9659:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2856, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "9659:5:14", + "typeDescriptions": {} + } + }, + "id": 2859, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9659:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2860, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "9672:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "9659:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "9653:25:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2864, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2862, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2846, + "src": "9682:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "id": 2863, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2848, + "src": "9690:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "9682:11:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "9653:40:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2870, + "nodeType": "IfStatement", + "src": "9649:63:14", + "trueBody": { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 2866, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9703:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "hexValue": "30", + "id": 2867, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9710:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "id": 2868, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "9702:10:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$", + "typeString": "tuple(bool,int_const 0)" + } + }, + "functionReturnParameters": 2854, + "id": 2869, + "nodeType": "Return", + "src": "9695:17:14" + } + }, + { + "expression": { + "arguments": [ + { + "id": 2872, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2844, + "src": "9757:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "id": 2873, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2846, + "src": "9764:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2874, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2848, + "src": "9771:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2871, + "name": "_tryParseIntUncheckedBounds", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2999, + "src": "9729:27:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_int256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,int256)" + } + }, + "id": 2875, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9729:46:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_int256_$", + "typeString": "tuple(bool,int256)" + } + }, + "functionReturnParameters": 2854, + "id": 2876, + "nodeType": "Return", + "src": "9722:53:14" + } + ] + }, + "documentation": { + "id": 2842, + "nodeType": "StructuredDocumentation", + "src": "9180:303:14", + "text": " @dev Variant of {parseInt-string-uint256-uint256} that returns false if the parsing fails because of an invalid\n character or if the result does not fit in a `int256`.\n NOTE: This function will revert if the absolute value of the result does not fit in a `uint256`." + }, + "id": 2878, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryParseInt", + "nameLocation": "9497:11:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2849, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2844, + "mutability": "mutable", + "name": "input", + "nameLocation": "9532:5:14", + "nodeType": "VariableDeclaration", + "scope": 2878, + "src": "9518:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2843, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "9518:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2846, + "mutability": "mutable", + "name": "begin", + "nameLocation": "9555:5:14", + "nodeType": "VariableDeclaration", + "scope": 2878, + "src": "9547:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2845, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "9547:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2848, + "mutability": "mutable", + "name": "end", + "nameLocation": "9578:3:14", + "nodeType": "VariableDeclaration", + "scope": 2878, + "src": "9570:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2847, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "9570:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "9508:79:14" + }, + "returnParameters": { + "id": 2854, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2851, + "mutability": "mutable", + "name": "success", + "nameLocation": "9616:7:14", + "nodeType": "VariableDeclaration", + "scope": 2878, + "src": "9611:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2850, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "9611:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2853, + "mutability": "mutable", + "name": "value", + "nameLocation": "9632:5:14", + "nodeType": "VariableDeclaration", + "scope": 2878, + "src": "9625:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 2852, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "9625:6:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "9610:28:14" + }, + "scope": 3678, + "src": "9488:294:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 2998, + "nodeType": "Block", + "src": "10182:812:14", + "statements": [ + { + "assignments": [ + 2893 + ], + "declarations": [ + { + "constant": false, + "id": 2893, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "10205:6:14", + "nodeType": "VariableDeclaration", + "scope": 2998, + "src": "10192:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2892, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "10192:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 2898, + "initialValue": { + "arguments": [ + { + "id": 2896, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2881, + "src": "10220:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 2895, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10214:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 2894, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "10214:5:14", + "typeDescriptions": {} + } + }, + "id": 2897, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10214:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "10192:34:14" + }, + { + "assignments": [ + 2900 + ], + "declarations": [ + { + "constant": false, + "id": 2900, + "mutability": "mutable", + "name": "sign", + "nameLocation": "10290:4:14", + "nodeType": "VariableDeclaration", + "scope": 2998, + "src": "10283:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 2899, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "10283:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + } + ], + "id": 2916, + "initialValue": { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2903, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2901, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2883, + "src": "10297:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 2902, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2885, + "src": "10306:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10297:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseExpression": { + "arguments": [ + { + "arguments": [ + { + "id": 2911, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2893, + "src": "10354:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 2912, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2883, + "src": "10362:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2910, + "name": "_unsafeReadBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3665, + "src": "10331:22:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (bytes memory,uint256) pure returns (bytes32)" + } + }, + "id": 2913, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10331:37:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 2909, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10324:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 2908, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "10324:6:14", + "typeDescriptions": {} + } + }, + "id": 2914, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10324:45:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 2915, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "Conditional", + "src": "10297:72:14", + "trueExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 2906, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10319:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 2905, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10312:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 2904, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "10312:6:14", + "typeDescriptions": {} + } + }, + "id": 2907, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10312:9:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "10283:86:14" + }, + { + "assignments": [ + 2918 + ], + "declarations": [ + { + "constant": false, + "id": 2918, + "mutability": "mutable", + "name": "positiveSign", + "nameLocation": "10455:12:14", + "nodeType": "VariableDeclaration", + "scope": 2998, + "src": "10450:17:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2917, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "10450:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "id": 2925, + "initialValue": { + "commonType": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "id": 2924, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2919, + "name": "sign", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2900, + "src": "10470:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "arguments": [ + { + "hexValue": "2b", + "id": 2922, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10485:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_728b8dbbe730d9acd55e30e768e6a28a04bea0c61b88108287c2c87d79c98bb8", + "typeString": "literal_string \"+\"" + }, + "value": "+" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_728b8dbbe730d9acd55e30e768e6a28a04bea0c61b88108287c2c87d79c98bb8", + "typeString": "literal_string \"+\"" + } + ], + "id": 2921, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10478:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 2920, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "10478:6:14", + "typeDescriptions": {} + } + }, + "id": 2923, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10478:11:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "src": "10470:19:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "10450:39:14" + }, + { + "assignments": [ + 2927 + ], + "declarations": [ + { + "constant": false, + "id": 2927, + "mutability": "mutable", + "name": "negativeSign", + "nameLocation": "10504:12:14", + "nodeType": "VariableDeclaration", + "scope": 2998, + "src": "10499:17:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2926, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "10499:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "id": 2934, + "initialValue": { + "commonType": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "id": 2933, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2928, + "name": "sign", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2900, + "src": "10519:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "arguments": [ + { + "hexValue": "2d", + "id": 2931, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10534:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_d3b8281179950f98149eefdb158d0e1acb56f56e8e343aa9fefafa7e36959561", + "typeString": "literal_string \"-\"" + }, + "value": "-" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_d3b8281179950f98149eefdb158d0e1acb56f56e8e343aa9fefafa7e36959561", + "typeString": "literal_string \"-\"" + } + ], + "id": 2930, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10527:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 2929, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "10527:6:14", + "typeDescriptions": {} + } + }, + "id": 2932, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10527:11:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "src": "10519:19:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "10499:39:14" + }, + { + "assignments": [ + 2936 + ], + "declarations": [ + { + "constant": false, + "id": 2936, + "mutability": "mutable", + "name": "offset", + "nameLocation": "10556:6:14", + "nodeType": "VariableDeclaration", + "scope": 2998, + "src": "10548:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2935, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10548:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2943, + "initialValue": { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 2939, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2937, + "name": "positiveSign", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2918, + "src": "10566:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "id": 2938, + "name": "negativeSign", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2927, + "src": "10582:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "10566:28:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "id": 2940, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "10565:30:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2941, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "10596:6:14", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "10565:37:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$attached_to$_t_bool_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 2942, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10565:39:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "10548:56:14" + }, + { + "assignments": [ + 2945, + 2947 + ], + "declarations": [ + { + "constant": false, + "id": 2945, + "mutability": "mutable", + "name": "absSuccess", + "nameLocation": "10621:10:14", + "nodeType": "VariableDeclaration", + "scope": 2998, + "src": "10616:15:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2944, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "10616:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2947, + "mutability": "mutable", + "name": "absValue", + "nameLocation": "10641:8:14", + "nodeType": "VariableDeclaration", + "scope": 2998, + "src": "10633:16:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2946, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10633:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2955, + "initialValue": { + "arguments": [ + { + "id": 2949, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2881, + "src": "10666:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2952, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2950, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2883, + "src": "10673:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "id": 2951, + "name": "offset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2936, + "src": "10681:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10673:14:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2953, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2885, + "src": "10689:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2948, + "name": "tryParseUint", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2658, + 2695 + ], + "referencedDeclaration": 2695, + "src": "10653:12:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 2954, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10653:40:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "10615:78:14" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 2960, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2956, + "name": "absSuccess", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2945, + "src": "10708:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2959, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2957, + "name": "absValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2947, + "src": "10722:8:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 2958, + "name": "ABS_MIN_INT256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2841, + "src": "10733:14:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10722:25:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "10708:39:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 2982, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 2978, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2976, + "name": "absSuccess", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2945, + "src": "10850:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "id": 2977, + "name": "negativeSign", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2927, + "src": "10864:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "10850:26:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2981, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2979, + "name": "absValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2947, + "src": "10880:8:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 2980, + "name": "ABS_MIN_INT256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2841, + "src": "10892:14:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10880:26:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "10850:56:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 2992, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10978:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "hexValue": "30", + "id": 2993, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10985:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "id": 2994, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "10977:10:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$", + "typeString": "tuple(bool,int_const 0)" + } + }, + "functionReturnParameters": 2891, + "id": 2995, + "nodeType": "Return", + "src": "10970:17:14" + }, + "id": 2996, + "nodeType": "IfStatement", + "src": "10846:141:14", + "trueBody": { + "id": 2991, + "nodeType": "Block", + "src": "10908:56:14", + "statements": [ + { + "expression": { + "components": [ + { + "hexValue": "74727565", + "id": 2983, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10930:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + { + "expression": { + "arguments": [ + { + "id": 2986, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10941:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + }, + "typeName": { + "id": 2985, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "10941:6:14", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + } + ], + "id": 2984, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "10936:4:14", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 2987, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10936:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_int256", + "typeString": "type(int256)" + } + }, + "id": 2988, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "10949:3:14", + "memberName": "min", + "nodeType": "MemberAccess", + "src": "10936:16:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 2989, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "10929:24:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_int256_$", + "typeString": "tuple(bool,int256)" + } + }, + "functionReturnParameters": 2891, + "id": 2990, + "nodeType": "Return", + "src": "10922:31:14" + } + ] + } + }, + "id": 2997, + "nodeType": "IfStatement", + "src": "10704:283:14", + "trueBody": { + "id": 2975, + "nodeType": "Block", + "src": "10749:91:14", + "statements": [ + { + "expression": { + "components": [ + { + "hexValue": "74727565", + "id": 2961, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10771:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + { + "condition": { + "id": 2962, + "name": "negativeSign", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2927, + "src": "10777:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseExpression": { + "arguments": [ + { + "id": 2970, + "name": "absValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2947, + "src": "10819:8:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2969, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10812:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + }, + "typeName": { + "id": 2968, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "10812:6:14", + "typeDescriptions": {} + } + }, + "id": 2971, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10812:16:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "id": 2972, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "Conditional", + "src": "10777:51:14", + "trueExpression": { + "id": 2967, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "-", + "prefix": true, + "src": "10792:17:14", + "subExpression": { + "arguments": [ + { + "id": 2965, + "name": "absValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2947, + "src": "10800:8:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2964, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10793:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + }, + "typeName": { + "id": 2963, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "10793:6:14", + "typeDescriptions": {} + } + }, + "id": 2966, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10793:16:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 2973, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "10770:59:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_int256_$", + "typeString": "tuple(bool,int256)" + } + }, + "functionReturnParameters": 2891, + "id": 2974, + "nodeType": "Return", + "src": "10763:66:14" + } + ] + } + } + ] + }, + "documentation": { + "id": 2879, + "nodeType": "StructuredDocumentation", + "src": "9788:223:14", + "text": " @dev Implementation of {tryParseInt-string-uint256-uint256} that does not check bounds. Caller should make sure that\n `begin <= end <= input.length`. Other inputs would result in undefined behavior." + }, + "id": 2999, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_tryParseIntUncheckedBounds", + "nameLocation": "10025:27:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2886, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2881, + "mutability": "mutable", + "name": "input", + "nameLocation": "10076:5:14", + "nodeType": "VariableDeclaration", + "scope": 2999, + "src": "10062:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 2880, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "10062:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2883, + "mutability": "mutable", + "name": "begin", + "nameLocation": "10099:5:14", + "nodeType": "VariableDeclaration", + "scope": 2999, + "src": "10091:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2882, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10091:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2885, + "mutability": "mutable", + "name": "end", + "nameLocation": "10122:3:14", + "nodeType": "VariableDeclaration", + "scope": 2999, + "src": "10114:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2884, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10114:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "10052:79:14" + }, + "returnParameters": { + "id": 2891, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2888, + "mutability": "mutable", + "name": "success", + "nameLocation": "10159:7:14", + "nodeType": "VariableDeclaration", + "scope": 2999, + "src": "10154:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2887, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "10154:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2890, + "mutability": "mutable", + "name": "value", + "nameLocation": "10175:5:14", + "nodeType": "VariableDeclaration", + "scope": 2999, + "src": "10168:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 2889, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "10168:6:14", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "10153:28:14" + }, + "scope": 3678, + "src": "10016:978:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 3017, + "nodeType": "Block", + "src": "11339:67:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3008, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3002, + "src": "11369:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "hexValue": "30", + "id": 3009, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11376:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "expression": { + "arguments": [ + { + "id": 3012, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3002, + "src": "11385:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 3011, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "11379:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 3010, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "11379:5:14", + "typeDescriptions": {} + } + }, + "id": 3013, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11379:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 3014, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "11392:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "11379:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3007, + "name": "parseHexUint", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3018, + 3049 + ], + "referencedDeclaration": 3049, + "src": "11356:12:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (uint256)" + } + }, + "id": 3015, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11356:43:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 3006, + "id": 3016, + "nodeType": "Return", + "src": "11349:50:14" + } + ] + }, + "documentation": { + "id": 3000, + "nodeType": "StructuredDocumentation", + "src": "11000:259:14", + "text": " @dev Parse a hexadecimal string (with or without \"0x\" prefix), and returns the value as a `uint256`.\n Requirements:\n - The string must be formatted as `(0x)?[0-9a-fA-F]*`\n - The result must fit in an `uint256` type." + }, + "id": 3018, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parseHexUint", + "nameLocation": "11273:12:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3003, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3002, + "mutability": "mutable", + "name": "input", + "nameLocation": "11300:5:14", + "nodeType": "VariableDeclaration", + "scope": 3018, + "src": "11286:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3001, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "11286:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "11285:21:14" + }, + "returnParameters": { + "id": 3006, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3005, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3018, + "src": "11330:7:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3004, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11330:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "11329:9:14" + }, + "scope": 3678, + "src": "11264:142:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3048, + "nodeType": "Block", + "src": "11827:156:14", + "statements": [ + { + "assignments": [ + 3031, + 3033 + ], + "declarations": [ + { + "constant": false, + "id": 3031, + "mutability": "mutable", + "name": "success", + "nameLocation": "11843:7:14", + "nodeType": "VariableDeclaration", + "scope": 3048, + "src": "11838:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3030, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "11838:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3033, + "mutability": "mutable", + "name": "value", + "nameLocation": "11860:5:14", + "nodeType": "VariableDeclaration", + "scope": 3048, + "src": "11852:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3032, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11852:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3039, + "initialValue": { + "arguments": [ + { + "id": 3035, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3021, + "src": "11885:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "id": 3036, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3023, + "src": "11892:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 3037, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3025, + "src": "11899:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3034, + "name": "tryParseHexUint", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3070, + 3107 + ], + "referencedDeclaration": 3107, + "src": "11869:15:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 3038, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11869:34:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "11837:66:14" + }, + { + "condition": { + "id": 3041, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "11917:8:14", + "subExpression": { + "id": 3040, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3031, + "src": "11918:7:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3045, + "nodeType": "IfStatement", + "src": "11913:41:14", + "trueBody": { + "errorCall": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 3042, + "name": "StringsInvalidChar", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2210, + "src": "11934:18:14", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$__$returns$_t_error_$", + "typeString": "function () pure returns (error)" + } + }, + "id": 3043, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11934:20:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 3044, + "nodeType": "RevertStatement", + "src": "11927:27:14" + } + }, + { + "expression": { + "id": 3046, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3033, + "src": "11971:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 3029, + "id": 3047, + "nodeType": "Return", + "src": "11964:12:14" + } + ] + }, + "documentation": { + "id": 3019, + "nodeType": "StructuredDocumentation", + "src": "11412:307:14", + "text": " @dev Variant of {parseHexUint-string} that parses a substring of `input` located between position `begin` (included) and\n `end` (excluded).\n Requirements:\n - The substring must be formatted as `(0x)?[0-9a-fA-F]*`\n - The result must fit in an `uint256` type." + }, + "id": 3049, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parseHexUint", + "nameLocation": "11733:12:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3026, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3021, + "mutability": "mutable", + "name": "input", + "nameLocation": "11760:5:14", + "nodeType": "VariableDeclaration", + "scope": 3049, + "src": "11746:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3020, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "11746:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3023, + "mutability": "mutable", + "name": "begin", + "nameLocation": "11775:5:14", + "nodeType": "VariableDeclaration", + "scope": 3049, + "src": "11767:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3022, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11767:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3025, + "mutability": "mutable", + "name": "end", + "nameLocation": "11790:3:14", + "nodeType": "VariableDeclaration", + "scope": 3049, + "src": "11782:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3024, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11782:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "11745:49:14" + }, + "returnParameters": { + "id": 3029, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3028, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3049, + "src": "11818:7:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3027, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11818:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "11817:9:14" + }, + "scope": 3678, + "src": "11724:259:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3069, + "nodeType": "Block", + "src": "12310:86:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3060, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3052, + "src": "12359:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "hexValue": "30", + "id": 3061, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12366:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "expression": { + "arguments": [ + { + "id": 3064, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3052, + "src": "12375:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 3063, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "12369:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 3062, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "12369:5:14", + "typeDescriptions": {} + } + }, + "id": 3065, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12369:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 3066, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "12382:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "12369:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3059, + "name": "_tryParseHexUintUncheckedBounds", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3210, + "src": "12327:31:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 3067, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12327:62:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "functionReturnParameters": 3058, + "id": 3068, + "nodeType": "Return", + "src": "12320:69:14" + } + ] + }, + "documentation": { + "id": 3050, + "nodeType": "StructuredDocumentation", + "src": "11989:218:14", + "text": " @dev Variant of {parseHexUint-string} that returns false if the parsing fails because of an invalid character.\n NOTE: This function will revert if the result does not fit in a `uint256`." + }, + "id": 3070, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryParseHexUint", + "nameLocation": "12221:15:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3053, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3052, + "mutability": "mutable", + "name": "input", + "nameLocation": "12251:5:14", + "nodeType": "VariableDeclaration", + "scope": 3070, + "src": "12237:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3051, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "12237:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "12236:21:14" + }, + "returnParameters": { + "id": 3058, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3055, + "mutability": "mutable", + "name": "success", + "nameLocation": "12286:7:14", + "nodeType": "VariableDeclaration", + "scope": 3070, + "src": "12281:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3054, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "12281:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3057, + "mutability": "mutable", + "name": "value", + "nameLocation": "12303:5:14", + "nodeType": "VariableDeclaration", + "scope": 3070, + "src": "12295:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3056, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12295:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "12280:29:14" + }, + "scope": 3678, + "src": "12212:184:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3106, + "nodeType": "Block", + "src": "12804:147:14", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 3094, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3090, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3084, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3077, + "src": "12818:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 3087, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3073, + "src": "12830:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 3086, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "12824:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 3085, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "12824:5:14", + "typeDescriptions": {} + } + }, + "id": 3088, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12824:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 3089, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "12837:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "12824:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "12818:25:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3093, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3091, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3075, + "src": "12847:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "id": 3092, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3077, + "src": "12855:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "12847:11:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "12818:40:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3099, + "nodeType": "IfStatement", + "src": "12814:63:14", + "trueBody": { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 3095, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12868:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "hexValue": "30", + "id": 3096, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12875:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "id": 3097, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "12867:10:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$", + "typeString": "tuple(bool,int_const 0)" + } + }, + "functionReturnParameters": 3083, + "id": 3098, + "nodeType": "Return", + "src": "12860:17:14" + } + }, + { + "expression": { + "arguments": [ + { + "id": 3101, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3073, + "src": "12926:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "id": 3102, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3075, + "src": "12933:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 3103, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3077, + "src": "12940:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3100, + "name": "_tryParseHexUintUncheckedBounds", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3210, + "src": "12894:31:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 3104, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12894:50:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "functionReturnParameters": 3083, + "id": 3105, + "nodeType": "Return", + "src": "12887:57:14" + } + ] + }, + "documentation": { + "id": 3071, + "nodeType": "StructuredDocumentation", + "src": "12402:241:14", + "text": " @dev Variant of {parseHexUint-string-uint256-uint256} that returns false if the parsing fails because of an\n invalid character.\n NOTE: This function will revert if the result does not fit in a `uint256`." + }, + "id": 3107, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryParseHexUint", + "nameLocation": "12657:15:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3078, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3073, + "mutability": "mutable", + "name": "input", + "nameLocation": "12696:5:14", + "nodeType": "VariableDeclaration", + "scope": 3107, + "src": "12682:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3072, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "12682:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3075, + "mutability": "mutable", + "name": "begin", + "nameLocation": "12719:5:14", + "nodeType": "VariableDeclaration", + "scope": 3107, + "src": "12711:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3074, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12711:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3077, + "mutability": "mutable", + "name": "end", + "nameLocation": "12742:3:14", + "nodeType": "VariableDeclaration", + "scope": 3107, + "src": "12734:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3076, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12734:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "12672:79:14" + }, + "returnParameters": { + "id": 3083, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3080, + "mutability": "mutable", + "name": "success", + "nameLocation": "12780:7:14", + "nodeType": "VariableDeclaration", + "scope": 3107, + "src": "12775:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3079, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "12775:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3082, + "mutability": "mutable", + "name": "value", + "nameLocation": "12797:5:14", + "nodeType": "VariableDeclaration", + "scope": 3107, + "src": "12789:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3081, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12789:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "12774:29:14" + }, + "scope": 3678, + "src": "12648:303:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3209, + "nodeType": "Block", + "src": "13360:881:14", + "statements": [ + { + "assignments": [ + 3122 + ], + "declarations": [ + { + "constant": false, + "id": 3122, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "13383:6:14", + "nodeType": "VariableDeclaration", + "scope": 3209, + "src": "13370:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 3121, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "13370:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 3127, + "initialValue": { + "arguments": [ + { + "id": 3125, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3110, + "src": "13398:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 3124, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "13392:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 3123, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "13392:5:14", + "typeDescriptions": {} + } + }, + "id": 3126, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13392:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "13370:34:14" + }, + { + "assignments": [ + 3129 + ], + "declarations": [ + { + "constant": false, + "id": 3129, + "mutability": "mutable", + "name": "hasPrefix", + "nameLocation": "13457:9:14", + "nodeType": "VariableDeclaration", + "scope": 3209, + "src": "13452:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3128, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "13452:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "id": 3149, + "initialValue": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 3148, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3134, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3130, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3114, + "src": "13470:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3133, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3131, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3112, + "src": "13476:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "31", + "id": 3132, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13484:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "13476:9:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "13470:15:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "id": 3135, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13469:17:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + }, + "id": 3147, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "arguments": [ + { + "id": 3139, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3122, + "src": "13520:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3140, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3112, + "src": "13528:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3138, + "name": "_unsafeReadBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3665, + "src": "13497:22:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (bytes memory,uint256) pure returns (bytes32)" + } + }, + "id": 3141, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13497:37:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3137, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "13490:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes2_$", + "typeString": "type(bytes2)" + }, + "typeName": { + "id": 3136, + "name": "bytes2", + "nodeType": "ElementaryTypeName", + "src": "13490:6:14", + "typeDescriptions": {} + } + }, + "id": 3142, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13490:45:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "arguments": [ + { + "hexValue": "3078", + "id": 3145, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13546:4:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_39bef1777deb3dfb14f64b9f81ced092c501fee72f90e93d03bb95ee89df9837", + "typeString": "literal_string \"0x\"" + }, + "value": "0x" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_39bef1777deb3dfb14f64b9f81ced092c501fee72f90e93d03bb95ee89df9837", + "typeString": "literal_string \"0x\"" + } + ], + "id": 3144, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "13539:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes2_$", + "typeString": "type(bytes2)" + }, + "typeName": { + "id": 3143, + "name": "bytes2", + "nodeType": "ElementaryTypeName", + "src": "13539:6:14", + "typeDescriptions": {} + } + }, + "id": 3146, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13539:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "src": "13490:61:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "13469:82:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "13452:99:14" + }, + { + "assignments": [ + 3151 + ], + "declarations": [ + { + "constant": false, + "id": 3151, + "mutability": "mutable", + "name": "offset", + "nameLocation": "13640:6:14", + "nodeType": "VariableDeclaration", + "scope": 3209, + "src": "13632:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3150, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13632:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3157, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3156, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "id": 3152, + "name": "hasPrefix", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3129, + "src": "13649:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3153, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "13659:6:14", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "13649:16:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$attached_to$_t_bool_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 3154, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13649:18:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "hexValue": "32", + "id": 3155, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13670:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "13649:22:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "13632:39:14" + }, + { + "assignments": [ + 3159 + ], + "declarations": [ + { + "constant": false, + "id": 3159, + "mutability": "mutable", + "name": "result", + "nameLocation": "13690:6:14", + "nodeType": "VariableDeclaration", + "scope": 3209, + "src": "13682:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3158, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13682:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3161, + "initialValue": { + "hexValue": "30", + "id": 3160, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13699:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "13682:18:14" + }, + { + "body": { + "id": 3203, + "nodeType": "Block", + "src": "13757:447:14", + "statements": [ + { + "assignments": [ + 3175 + ], + "declarations": [ + { + "constant": false, + "id": 3175, + "mutability": "mutable", + "name": "chr", + "nameLocation": "13777:3:14", + "nodeType": "VariableDeclaration", + "scope": 3203, + "src": "13771:9:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 3174, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "13771:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "id": 3185, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "id": 3180, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3122, + "src": "13826:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3181, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3163, + "src": "13834:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3179, + "name": "_unsafeReadBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3665, + "src": "13803:22:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (bytes memory,uint256) pure returns (bytes32)" + } + }, + "id": 3182, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13803:33:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3178, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "13796:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 3177, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "13796:6:14", + "typeDescriptions": {} + } + }, + "id": 3183, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13796:41:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 3176, + "name": "_tryParseChr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3445, + "src": "13783:12:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes1_$returns$_t_uint8_$", + "typeString": "function (bytes1) pure returns (uint8)" + } + }, + "id": 3184, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13783:55:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "13771:67:14" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3188, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3186, + "name": "chr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3175, + "src": "13856:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "3135", + "id": 3187, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13862:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_15_by_1", + "typeString": "int_const 15" + }, + "value": "15" + }, + "src": "13856:8:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3193, + "nodeType": "IfStatement", + "src": "13852:31:14", + "trueBody": { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 3189, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13874:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "hexValue": "30", + "id": 3190, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13881:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "id": 3191, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13873:10:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$", + "typeString": "tuple(bool,int_const 0)" + } + }, + "functionReturnParameters": 3120, + "id": 3192, + "nodeType": "Return", + "src": "13866:17:14" + } + }, + { + "expression": { + "id": 3196, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 3194, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3159, + "src": "13897:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "*=", + "rightHandSide": { + "hexValue": "3136", + "id": 3195, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13907:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "13897:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 3197, + "nodeType": "ExpressionStatement", + "src": "13897:12:14" + }, + { + "id": 3202, + "nodeType": "UncheckedBlock", + "src": "13923:271:14", + "statements": [ + { + "expression": { + "id": 3200, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 3198, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3159, + "src": "14166:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "id": 3199, + "name": "chr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3175, + "src": "14176:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "src": "14166:13:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 3201, + "nodeType": "ExpressionStatement", + "src": "14166:13:14" + } + ] + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3170, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3168, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3163, + "src": "13743:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 3169, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3114, + "src": "13747:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "13743:7:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3204, + "initializationExpression": { + "assignments": [ + 3163 + ], + "declarations": [ + { + "constant": false, + "id": 3163, + "mutability": "mutable", + "name": "i", + "nameLocation": "13723:1:14", + "nodeType": "VariableDeclaration", + "scope": 3204, + "src": "13715:9:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3162, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13715:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3167, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3166, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3164, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3112, + "src": "13727:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "id": 3165, + "name": "offset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3151, + "src": "13735:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "13727:14:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "13715:26:14" + }, + "isSimpleCounterLoop": true, + "loopExpression": { + "expression": { + "id": 3172, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": true, + "src": "13752:3:14", + "subExpression": { + "id": 3171, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3163, + "src": "13754:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 3173, + "nodeType": "ExpressionStatement", + "src": "13752:3:14" + }, + "nodeType": "ForStatement", + "src": "13710:494:14" + }, + { + "expression": { + "components": [ + { + "hexValue": "74727565", + "id": 3205, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14221:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + { + "id": 3206, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3159, + "src": "14227:6:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 3207, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "14220:14:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "functionReturnParameters": 3120, + "id": 3208, + "nodeType": "Return", + "src": "14213:21:14" + } + ] + }, + "documentation": { + "id": 3108, + "nodeType": "StructuredDocumentation", + "src": "12957:227:14", + "text": " @dev Implementation of {tryParseHexUint-string-uint256-uint256} that does not check bounds. Caller should make sure that\n `begin <= end <= input.length`. Other inputs would result in undefined behavior." + }, + "id": 3210, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_tryParseHexUintUncheckedBounds", + "nameLocation": "13198:31:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3115, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3110, + "mutability": "mutable", + "name": "input", + "nameLocation": "13253:5:14", + "nodeType": "VariableDeclaration", + "scope": 3210, + "src": "13239:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3109, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "13239:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3112, + "mutability": "mutable", + "name": "begin", + "nameLocation": "13276:5:14", + "nodeType": "VariableDeclaration", + "scope": 3210, + "src": "13268:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3111, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13268:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3114, + "mutability": "mutable", + "name": "end", + "nameLocation": "13299:3:14", + "nodeType": "VariableDeclaration", + "scope": 3210, + "src": "13291:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3113, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13291:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "13229:79:14" + }, + "returnParameters": { + "id": 3120, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3117, + "mutability": "mutable", + "name": "success", + "nameLocation": "13336:7:14", + "nodeType": "VariableDeclaration", + "scope": 3210, + "src": "13331:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3116, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "13331:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3119, + "mutability": "mutable", + "name": "value", + "nameLocation": "13353:5:14", + "nodeType": "VariableDeclaration", + "scope": 3210, + "src": "13345:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3118, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13345:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "13330:29:14" + }, + "scope": 3678, + "src": "13189:1052:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 3228, + "nodeType": "Block", + "src": "14539:67:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3219, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3213, + "src": "14569:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "hexValue": "30", + "id": 3220, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14576:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "expression": { + "arguments": [ + { + "id": 3223, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3213, + "src": "14585:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 3222, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "14579:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 3221, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "14579:5:14", + "typeDescriptions": {} + } + }, + "id": 3224, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14579:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 3225, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "14592:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "14579:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3218, + "name": "parseAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3229, + 3260 + ], + "referencedDeclaration": 3260, + "src": "14556:12:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_address_$", + "typeString": "function (string memory,uint256,uint256) pure returns (address)" + } + }, + "id": 3226, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14556:43:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 3217, + "id": 3227, + "nodeType": "Return", + "src": "14549:50:14" + } + ] + }, + "documentation": { + "id": 3211, + "nodeType": "StructuredDocumentation", + "src": "14247:212:14", + "text": " @dev Parse a hexadecimal string (with or without \"0x\" prefix), and returns the value as an `address`.\n Requirements:\n - The string must be formatted as `(0x)?[0-9a-fA-F]{40}`" + }, + "id": 3229, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parseAddress", + "nameLocation": "14473:12:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3214, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3213, + "mutability": "mutable", + "name": "input", + "nameLocation": "14500:5:14", + "nodeType": "VariableDeclaration", + "scope": 3229, + "src": "14486:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3212, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "14486:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "14485:21:14" + }, + "returnParameters": { + "id": 3217, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3216, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3229, + "src": "14530:7:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3215, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "14530:7:14", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "14529:9:14" + }, + "scope": 3678, + "src": "14464:142:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3259, + "nodeType": "Block", + "src": "14979:165:14", + "statements": [ + { + "assignments": [ + 3242, + 3244 + ], + "declarations": [ + { + "constant": false, + "id": 3242, + "mutability": "mutable", + "name": "success", + "nameLocation": "14995:7:14", + "nodeType": "VariableDeclaration", + "scope": 3259, + "src": "14990:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3241, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "14990:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3244, + "mutability": "mutable", + "name": "value", + "nameLocation": "15012:5:14", + "nodeType": "VariableDeclaration", + "scope": 3259, + "src": "15004:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3243, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "15004:7:14", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "id": 3250, + "initialValue": { + "arguments": [ + { + "id": 3246, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3232, + "src": "15037:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "id": 3247, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3234, + "src": "15044:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 3248, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3236, + "src": "15051:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3245, + "name": "tryParseAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3281, + 3385 + ], + "referencedDeclaration": 3385, + "src": "15021:15:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_address_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,address)" + } + }, + "id": 3249, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15021:34:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_address_$", + "typeString": "tuple(bool,address)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "14989:66:14" + }, + { + "condition": { + "id": 3252, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "15069:8:14", + "subExpression": { + "id": 3251, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3242, + "src": "15070:7:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3256, + "nodeType": "IfStatement", + "src": "15065:50:14", + "trueBody": { + "errorCall": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 3253, + "name": "StringsInvalidAddressFormat", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2213, + "src": "15086:27:14", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$__$returns$_t_error_$", + "typeString": "function () pure returns (error)" + } + }, + "id": 3254, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15086:29:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 3255, + "nodeType": "RevertStatement", + "src": "15079:36:14" + } + }, + { + "expression": { + "id": 3257, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3244, + "src": "15132:5:14", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 3240, + "id": 3258, + "nodeType": "Return", + "src": "15125:12:14" + } + ] + }, + "documentation": { + "id": 3230, + "nodeType": "StructuredDocumentation", + "src": "14612:259:14", + "text": " @dev Variant of {parseAddress-string} that parses a substring of `input` located between position `begin` (included) and\n `end` (excluded).\n Requirements:\n - The substring must be formatted as `(0x)?[0-9a-fA-F]{40}`" + }, + "id": 3260, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parseAddress", + "nameLocation": "14885:12:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3237, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3232, + "mutability": "mutable", + "name": "input", + "nameLocation": "14912:5:14", + "nodeType": "VariableDeclaration", + "scope": 3260, + "src": "14898:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3231, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "14898:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3234, + "mutability": "mutable", + "name": "begin", + "nameLocation": "14927:5:14", + "nodeType": "VariableDeclaration", + "scope": 3260, + "src": "14919:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3233, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "14919:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3236, + "mutability": "mutable", + "name": "end", + "nameLocation": "14942:3:14", + "nodeType": "VariableDeclaration", + "scope": 3260, + "src": "14934:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3235, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "14934:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "14897:49:14" + }, + "returnParameters": { + "id": 3240, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3239, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3260, + "src": "14970:7:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3238, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "14970:7:14", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "14969:9:14" + }, + "scope": 3678, + "src": "14876:268:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3280, + "nodeType": "Block", + "src": "15451:70:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3271, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3263, + "src": "15484:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "hexValue": "30", + "id": 3272, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "15491:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "expression": { + "arguments": [ + { + "id": 3275, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3263, + "src": "15500:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 3274, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "15494:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 3273, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "15494:5:14", + "typeDescriptions": {} + } + }, + "id": 3276, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15494:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 3277, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "15507:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "15494:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3270, + "name": "tryParseAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3281, + 3385 + ], + "referencedDeclaration": 3385, + "src": "15468:15:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_address_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,address)" + } + }, + "id": 3278, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15468:46:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_address_$", + "typeString": "tuple(bool,address)" + } + }, + "functionReturnParameters": 3269, + "id": 3279, + "nodeType": "Return", + "src": "15461:53:14" + } + ] + }, + "documentation": { + "id": 3261, + "nodeType": "StructuredDocumentation", + "src": "15150:198:14", + "text": " @dev Variant of {parseAddress-string} that returns false if the parsing fails because the input is not a properly\n formatted address. See {parseAddress-string} requirements." + }, + "id": 3281, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryParseAddress", + "nameLocation": "15362:15:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3264, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3263, + "mutability": "mutable", + "name": "input", + "nameLocation": "15392:5:14", + "nodeType": "VariableDeclaration", + "scope": 3281, + "src": "15378:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3262, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "15378:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "15377:21:14" + }, + "returnParameters": { + "id": 3269, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3266, + "mutability": "mutable", + "name": "success", + "nameLocation": "15427:7:14", + "nodeType": "VariableDeclaration", + "scope": 3281, + "src": "15422:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3265, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "15422:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3268, + "mutability": "mutable", + "name": "value", + "nameLocation": "15444:5:14", + "nodeType": "VariableDeclaration", + "scope": 3281, + "src": "15436:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3267, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "15436:7:14", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "15421:29:14" + }, + "scope": 3678, + "src": "15353:168:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3384, + "nodeType": "Block", + "src": "15914:733:14", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 3305, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3301, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3295, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3288, + "src": "15928:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 3298, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3284, + "src": "15940:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 3297, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "15934:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 3296, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "15934:5:14", + "typeDescriptions": {} + } + }, + "id": 3299, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15934:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 3300, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "15947:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "15934:19:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "15928:25:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3304, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3302, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3286, + "src": "15957:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "id": 3303, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3288, + "src": "15965:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "15957:11:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "15928:40:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3313, + "nodeType": "IfStatement", + "src": "15924:72:14", + "trueBody": { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 3306, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "15978:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "arguments": [ + { + "hexValue": "30", + "id": 3309, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "15993:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 3308, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "15985:7:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3307, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "15985:7:14", + "typeDescriptions": {} + } + }, + "id": 3310, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15985:10:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "id": 3311, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "15977:19:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_address_$", + "typeString": "tuple(bool,address)" + } + }, + "functionReturnParameters": 3294, + "id": 3312, + "nodeType": "Return", + "src": "15970:26:14" + } + }, + { + "assignments": [ + 3315 + ], + "declarations": [ + { + "constant": false, + "id": 3315, + "mutability": "mutable", + "name": "hasPrefix", + "nameLocation": "16012:9:14", + "nodeType": "VariableDeclaration", + "scope": 3384, + "src": "16007:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3314, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "16007:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "id": 3338, + "initialValue": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 3337, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3320, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3316, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3288, + "src": "16025:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3319, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3317, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3286, + "src": "16031:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "31", + "id": 3318, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16039:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "16031:9:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "16025:15:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "id": 3321, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "16024:17:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + }, + "id": 3336, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "id": 3327, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3284, + "src": "16081:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 3326, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16075:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 3325, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "16075:5:14", + "typeDescriptions": {} + } + }, + "id": 3328, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16075:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3329, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3286, + "src": "16089:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3324, + "name": "_unsafeReadBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3665, + "src": "16052:22:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (bytes memory,uint256) pure returns (bytes32)" + } + }, + "id": 3330, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16052:43:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3323, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16045:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes2_$", + "typeString": "type(bytes2)" + }, + "typeName": { + "id": 3322, + "name": "bytes2", + "nodeType": "ElementaryTypeName", + "src": "16045:6:14", + "typeDescriptions": {} + } + }, + "id": 3331, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16045:51:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "arguments": [ + { + "hexValue": "3078", + "id": 3334, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16107:4:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_39bef1777deb3dfb14f64b9f81ced092c501fee72f90e93d03bb95ee89df9837", + "typeString": "literal_string \"0x\"" + }, + "value": "0x" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_39bef1777deb3dfb14f64b9f81ced092c501fee72f90e93d03bb95ee89df9837", + "typeString": "literal_string \"0x\"" + } + ], + "id": 3333, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16100:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes2_$", + "typeString": "type(bytes2)" + }, + "typeName": { + "id": 3332, + "name": "bytes2", + "nodeType": "ElementaryTypeName", + "src": "16100:6:14", + "typeDescriptions": {} + } + }, + "id": 3335, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16100:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes2", + "typeString": "bytes2" + } + }, + "src": "16045:67:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "16024:88:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "16007:105:14" + }, + { + "assignments": [ + 3340 + ], + "declarations": [ + { + "constant": false, + "id": 3340, + "mutability": "mutable", + "name": "expectedLength", + "nameLocation": "16201:14:14", + "nodeType": "VariableDeclaration", + "scope": 3384, + "src": "16193:22:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3339, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "16193:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3348, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3347, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3430", + "id": 3341, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16218:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_40_by_1", + "typeString": "int_const 40" + }, + "value": "40" + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3346, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "id": 3342, + "name": "hasPrefix", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3315, + "src": "16223:9:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3343, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "16233:6:14", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "16223:16:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$attached_to$_t_bool_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 3344, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16223:18:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "hexValue": "32", + "id": 3345, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16244:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "16223:22:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "16218:27:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "16193:52:14" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3353, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3351, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3349, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3288, + "src": "16310:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "id": 3350, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3286, + "src": "16316:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "16310:11:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 3352, + "name": "expectedLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3340, + "src": "16325:14:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "16310:29:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 3382, + "nodeType": "Block", + "src": "16590:51:14", + "statements": [ + { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 3375, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16612:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "arguments": [ + { + "hexValue": "30", + "id": 3378, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16627:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 3377, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16619:7:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3376, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "16619:7:14", + "typeDescriptions": {} + } + }, + "id": 3379, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16619:10:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "id": 3380, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "16611:19:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_address_$", + "typeString": "tuple(bool,address)" + } + }, + "functionReturnParameters": 3294, + "id": 3381, + "nodeType": "Return", + "src": "16604:26:14" + } + ] + }, + "id": 3383, + "nodeType": "IfStatement", + "src": "16306:335:14", + "trueBody": { + "id": 3374, + "nodeType": "Block", + "src": "16341:243:14", + "statements": [ + { + "assignments": [ + 3355, + 3357 + ], + "declarations": [ + { + "constant": false, + "id": 3355, + "mutability": "mutable", + "name": "s", + "nameLocation": "16462:1:14", + "nodeType": "VariableDeclaration", + "scope": 3374, + "src": "16457:6:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3354, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "16457:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3357, + "mutability": "mutable", + "name": "v", + "nameLocation": "16473:1:14", + "nodeType": "VariableDeclaration", + "scope": 3374, + "src": "16465:9:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3356, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "16465:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3363, + "initialValue": { + "arguments": [ + { + "id": 3359, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3284, + "src": "16510:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "id": 3360, + "name": "begin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3286, + "src": "16517:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 3361, + "name": "end", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3288, + "src": "16524:3:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3358, + "name": "_tryParseHexUintUncheckedBounds", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3210, + "src": "16478:31:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (string memory,uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 3362, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16478:50:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "16456:72:14" + }, + { + "expression": { + "components": [ + { + "id": 3364, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3355, + "src": "16550:1:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "arguments": [ + { + "arguments": [ + { + "id": 3369, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3357, + "src": "16569:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3368, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16561:7:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint160_$", + "typeString": "type(uint160)" + }, + "typeName": { + "id": 3367, + "name": "uint160", + "nodeType": "ElementaryTypeName", + "src": "16561:7:14", + "typeDescriptions": {} + } + }, + "id": 3370, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16561:10:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint160", + "typeString": "uint160" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint160", + "typeString": "uint160" + } + ], + "id": 3366, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16553:7:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3365, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "16553:7:14", + "typeDescriptions": {} + } + }, + "id": 3371, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16553:19:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "id": 3372, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "16549:24:14", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_address_$", + "typeString": "tuple(bool,address)" + } + }, + "functionReturnParameters": 3294, + "id": 3373, + "nodeType": "Return", + "src": "16542:31:14" + } + ] + } + } + ] + }, + "documentation": { + "id": 3282, + "nodeType": "StructuredDocumentation", + "src": "15527:226:14", + "text": " @dev Variant of {parseAddress-string-uint256-uint256} that returns false if the parsing fails because input is not a properly\n formatted address. See {parseAddress-string-uint256-uint256} requirements." + }, + "id": 3385, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryParseAddress", + "nameLocation": "15767:15:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3289, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3284, + "mutability": "mutable", + "name": "input", + "nameLocation": "15806:5:14", + "nodeType": "VariableDeclaration", + "scope": 3385, + "src": "15792:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3283, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "15792:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3286, + "mutability": "mutable", + "name": "begin", + "nameLocation": "15829:5:14", + "nodeType": "VariableDeclaration", + "scope": 3385, + "src": "15821:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3285, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "15821:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3288, + "mutability": "mutable", + "name": "end", + "nameLocation": "15852:3:14", + "nodeType": "VariableDeclaration", + "scope": 3385, + "src": "15844:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3287, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "15844:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "15782:79:14" + }, + "returnParameters": { + "id": 3294, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3291, + "mutability": "mutable", + "name": "success", + "nameLocation": "15890:7:14", + "nodeType": "VariableDeclaration", + "scope": 3385, + "src": "15885:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3290, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "15885:4:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3293, + "mutability": "mutable", + "name": "value", + "nameLocation": "15907:5:14", + "nodeType": "VariableDeclaration", + "scope": 3385, + "src": "15899:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3292, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "15899:7:14", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "15884:29:14" + }, + "scope": 3678, + "src": "15758:889:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3444, + "nodeType": "Block", + "src": "16716:461:14", + "statements": [ + { + "assignments": [ + 3393 + ], + "declarations": [ + { + "constant": false, + "id": 3393, + "mutability": "mutable", + "name": "value", + "nameLocation": "16732:5:14", + "nodeType": "VariableDeclaration", + "scope": 3444, + "src": "16726:11:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 3392, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "16726:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "id": 3398, + "initialValue": { + "arguments": [ + { + "id": 3396, + "name": "chr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3387, + "src": "16746:3:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 3395, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16740:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": { + "id": 3394, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "16740:5:14", + "typeDescriptions": {} + } + }, + "id": 3397, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16740:10:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "16726:24:14" + }, + { + "id": 3441, + "nodeType": "UncheckedBlock", + "src": "16910:238:14", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 3405, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3401, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3399, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "16938:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "3437", + "id": 3400, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16946:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_47_by_1", + "typeString": "int_const 47" + }, + "value": "47" + }, + "src": "16938:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3404, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3402, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "16952:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "hexValue": "3538", + "id": 3403, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16960:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_58_by_1", + "typeString": "int_const 58" + }, + "value": "58" + }, + "src": "16952:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "16938:24:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 3416, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3412, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3410, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "16998:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "3936", + "id": 3411, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17006:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_96_by_1", + "typeString": "int_const 96" + }, + "value": "96" + }, + "src": "16998:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3415, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3413, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "17012:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "hexValue": "313033", + "id": 3414, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17020:3:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_103_by_1", + "typeString": "int_const 103" + }, + "value": "103" + }, + "src": "17012:11:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "16998:25:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 3427, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3423, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3421, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "17059:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "3634", + "id": 3422, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17067:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "17059:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3426, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3424, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "17073:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "hexValue": "3731", + "id": 3425, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17081:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_71_by_1", + "typeString": "int_const 71" + }, + "value": "71" + }, + "src": "17073:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "17059:24:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "expression": { + "expression": { + "arguments": [ + { + "id": 3434, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "17127:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": { + "id": 3433, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "17127:5:14", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + } + ], + "id": 3432, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "17122:4:14", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 3435, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "17122:11:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint8", + "typeString": "type(uint8)" + } + }, + "id": 3436, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "17134:3:14", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "17122:15:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "functionReturnParameters": 3391, + "id": 3437, + "nodeType": "Return", + "src": "17115:22:14" + }, + "id": 3438, + "nodeType": "IfStatement", + "src": "17055:82:14", + "trueBody": { + "expression": { + "id": 3430, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 3428, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "17085:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "Assignment", + "operator": "-=", + "rightHandSide": { + "hexValue": "3535", + "id": 3429, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17094:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_55_by_1", + "typeString": "int_const 55" + }, + "value": "55" + }, + "src": "17085:11:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "id": 3431, + "nodeType": "ExpressionStatement", + "src": "17085:11:14" + } + }, + "id": 3439, + "nodeType": "IfStatement", + "src": "16994:143:14", + "trueBody": { + "expression": { + "id": 3419, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 3417, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "17025:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "Assignment", + "operator": "-=", + "rightHandSide": { + "hexValue": "3837", + "id": 3418, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17034:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_87_by_1", + "typeString": "int_const 87" + }, + "value": "87" + }, + "src": "17025:11:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "id": 3420, + "nodeType": "ExpressionStatement", + "src": "17025:11:14" + } + }, + "id": 3440, + "nodeType": "IfStatement", + "src": "16934:203:14", + "trueBody": { + "expression": { + "id": 3408, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 3406, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "16964:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "Assignment", + "operator": "-=", + "rightHandSide": { + "hexValue": "3438", + "id": 3407, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16973:2:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_48_by_1", + "typeString": "int_const 48" + }, + "value": "48" + }, + "src": "16964:11:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "id": 3409, + "nodeType": "ExpressionStatement", + "src": "16964:11:14" + } + } + ] + }, + { + "expression": { + "id": 3442, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3393, + "src": "17165:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "functionReturnParameters": 3391, + "id": 3443, + "nodeType": "Return", + "src": "17158:12:14" + } + ] + }, + "id": 3445, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_tryParseChr", + "nameLocation": "16662:12:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3388, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3387, + "mutability": "mutable", + "name": "chr", + "nameLocation": "16682:3:14", + "nodeType": "VariableDeclaration", + "scope": 3445, + "src": "16675:10:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 3386, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "16675:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + } + ], + "src": "16674:12:14" + }, + "returnParameters": { + "id": 3391, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3390, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3445, + "src": "16709:5:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 3389, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "16709:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "src": "16708:7:14" + }, + "scope": 3678, + "src": "16653:524:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 3652, + "nodeType": "Block", + "src": "17984:2333:14", + "statements": [ + { + "assignments": [ + 3454 + ], + "declarations": [ + { + "constant": false, + "id": 3454, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "18007:6:14", + "nodeType": "VariableDeclaration", + "scope": 3652, + "src": "17994:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 3453, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "17994:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 3459, + "initialValue": { + "arguments": [ + { + "id": 3457, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3448, + "src": "18022:5:14", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 3456, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "18016:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 3455, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "18016:5:14", + "typeDescriptions": {} + } + }, + "id": 3458, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18016:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "17994:34:14" + }, + { + "assignments": [ + 3461 + ], + "declarations": [ + { + "constant": false, + "id": 3461, + "mutability": "mutable", + "name": "output", + "nameLocation": "18318:6:14", + "nodeType": "VariableDeclaration", + "scope": 3652, + "src": "18305:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 3460, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "18305:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 3462, + "nodeType": "VariableDeclarationStatement", + "src": "18305:19:14" + }, + { + "AST": { + "nativeSrc": "18359:45:14", + "nodeType": "YulBlock", + "src": "18359:45:14", + "statements": [ + { + "nativeSrc": "18373:21:14", + "nodeType": "YulAssignment", + "src": "18373:21:14", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "18389:4:14", + "nodeType": "YulLiteral", + "src": "18389:4:14", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "18383:5:14", + "nodeType": "YulIdentifier", + "src": "18383:5:14" + }, + "nativeSrc": "18383:11:14", + "nodeType": "YulFunctionCall", + "src": "18383:11:14" + }, + "variableNames": [ + { + "name": "output", + "nativeSrc": "18373:6:14", + "nodeType": "YulIdentifier", + "src": "18373:6:14" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 3461, + "isOffset": false, + "isSlot": false, + "src": "18373:6:14", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 3463, + "nodeType": "InlineAssembly", + "src": "18334:70:14" + }, + { + "assignments": [ + 3465 + ], + "declarations": [ + { + "constant": false, + "id": 3465, + "mutability": "mutable", + "name": "outputLength", + "nameLocation": "18421:12:14", + "nodeType": "VariableDeclaration", + "scope": 3652, + "src": "18413:20:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3464, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "18413:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3467, + "initialValue": { + "hexValue": "30", + "id": 3466, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18436:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "18413:24:14" + }, + { + "body": { + "id": 3644, + "nodeType": "Block", + "src": "18492:1584:14", + "statements": [ + { + "assignments": [ + 3480 + ], + "declarations": [ + { + "constant": false, + "id": 3480, + "mutability": "mutable", + "name": "char", + "nameLocation": "18512:4:14", + "nodeType": "VariableDeclaration", + "scope": 3644, + "src": "18506:10:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 3479, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "18506:5:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "id": 3491, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "id": 3486, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3454, + "src": "18555:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3487, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3469, + "src": "18563:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3485, + "name": "_unsafeReadBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3665, + "src": "18532:22:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (bytes memory,uint256) pure returns (bytes32)" + } + }, + "id": 3488, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18532:33:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3484, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "18525:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 3483, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "18525:6:14", + "typeDescriptions": {} + } + }, + "id": 3489, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18525:41:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 3482, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "18519:5:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": { + "id": 3481, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "18519:5:14", + "typeDescriptions": {} + } + }, + "id": 3490, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18519:48:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "18506:61:14" + }, + { + "condition": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3500, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3497, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3492, + "name": "SPECIAL_CHARS_LOOKUP", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2200, + "src": "18587:20:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3495, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 3493, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18611:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "id": 3494, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "18616:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "src": "18611:9:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 3496, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "18610:11:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "18587:34:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 3498, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "18586:36:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "hexValue": "30", + "id": 3499, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18626:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "18586:41:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "id": 3501, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "18585:43:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 3642, + "nodeType": "Block", + "src": "19972:94:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3633, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "20014:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3635, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "20022:14:14", + "subExpression": { + "id": 3634, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "20022:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [ + { + "id": 3638, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "20045:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + ], + "id": 3637, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "20038:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 3636, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "20038:6:14", + "typeDescriptions": {} + } + }, + "id": 3639, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "20038:12:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 3632, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19990:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3640, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19990:61:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3641, + "nodeType": "ExpressionStatement", + "src": "19990:61:14" + } + ] + }, + "id": 3643, + "nodeType": "IfStatement", + "src": "18581:1485:14", + "trueBody": { + "id": 3631, + "nodeType": "Block", + "src": "18630:1336:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3503, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "18672:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3505, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "18680:14:14", + "subExpression": { + "id": 3504, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "18680:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "5c", + "id": 3506, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18696:4:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_731553fa98541ade8b78284229adfe09a819380dee9244baac20dd1e0aa24095", + "typeString": "literal_string \"\\\"" + }, + "value": "\\" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_731553fa98541ade8b78284229adfe09a819380dee9244baac20dd1e0aa24095", + "typeString": "literal_string \"\\\"" + } + ], + "id": 3502, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "18648:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3507, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18648:53:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3508, + "nodeType": "ExpressionStatement", + "src": "18648:53:14" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3511, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3509, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "18723:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30783038", + "id": 3510, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18731:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "0x08" + }, + "src": "18723:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3521, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3519, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "18816:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30783039", + "id": 3520, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18824:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_9_by_1", + "typeString": "int_const 9" + }, + "value": "0x09" + }, + "src": "18816:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3531, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3529, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "18909:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30783061", + "id": 3530, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18917:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "0x0a" + }, + "src": "18909:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3541, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3539, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "19002:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30783063", + "id": 3540, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19010:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_12_by_1", + "typeString": "int_const 12" + }, + "value": "0x0c" + }, + "src": "19002:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3551, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3549, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "19095:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30783064", + "id": 3550, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19103:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_13_by_1", + "typeString": "int_const 13" + }, + "value": "0x0d" + }, + "src": "19095:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3561, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3559, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "19188:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30783563", + "id": 3560, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19196:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_92_by_1", + "typeString": "int_const 92" + }, + "value": "0x5c" + }, + "src": "19188:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3571, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3569, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "19282:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30783232", + "id": 3570, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19290:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_34_by_1", + "typeString": "int_const 34" + }, + "value": "0x22" + }, + "src": "19282:12:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 3623, + "nodeType": "Block", + "src": "19451:501:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3581, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "19571:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3583, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "19579:14:14", + "subExpression": { + "id": 3582, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "19579:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "75", + "id": 3584, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19595:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_32cefdcd8e794145c9af8dd1f4b1fbd92d6e547ae855553080fc8bd19c4883a0", + "typeString": "literal_string \"u\"" + }, + "value": "u" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_32cefdcd8e794145c9af8dd1f4b1fbd92d6e547ae855553080fc8bd19c4883a0", + "typeString": "literal_string \"u\"" + } + ], + "id": 3580, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19547:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3585, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19547:52:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3586, + "nodeType": "ExpressionStatement", + "src": "19547:52:14" + }, + { + "expression": { + "arguments": [ + { + "id": 3588, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "19645:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3590, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "19653:14:14", + "subExpression": { + "id": 3589, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "19653:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "30", + "id": 3591, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19669:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", + "typeString": "literal_string \"0\"" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", + "typeString": "literal_string \"0\"" + } + ], + "id": 3587, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19621:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3592, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19621:52:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3593, + "nodeType": "ExpressionStatement", + "src": "19621:52:14" + }, + { + "expression": { + "arguments": [ + { + "id": 3595, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "19719:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3597, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "19727:14:14", + "subExpression": { + "id": 3596, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "19727:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "30", + "id": 3598, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19743:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", + "typeString": "literal_string \"0\"" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", + "typeString": "literal_string \"0\"" + } + ], + "id": 3594, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19695:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3599, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19695:52:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3600, + "nodeType": "ExpressionStatement", + "src": "19695:52:14" + }, + { + "expression": { + "arguments": [ + { + "id": 3602, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "19793:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3604, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "19801:14:14", + "subExpression": { + "id": 3603, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "19801:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "baseExpression": { + "id": 3605, + "name": "HEX_DIGITS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2184, + "src": "19817:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "id": 3609, + "indexExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3608, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3606, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "19828:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "34", + "id": 3607, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19836:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "19828:9:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "19817:21:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 3601, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19769:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3610, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19769:70:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3611, + "nodeType": "ExpressionStatement", + "src": "19769:70:14" + }, + { + "expression": { + "arguments": [ + { + "id": 3613, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "19885:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3615, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "19893:14:14", + "subExpression": { + "id": 3614, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "19893:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "baseExpression": { + "id": 3616, + "name": "HEX_DIGITS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2184, + "src": "19909:10:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes16", + "typeString": "bytes16" + } + }, + "id": 3620, + "indexExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 3619, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3617, + "name": "char", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3480, + "src": "19920:4:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30783066", + "id": 3618, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19927:4:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_15_by_1", + "typeString": "int_const 15" + }, + "value": "0x0f" + }, + "src": "19920:11:14", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "19909:23:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 3612, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19861:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3621, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19861:72:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3622, + "nodeType": "ExpressionStatement", + "src": "19861:72:14" + } + ] + }, + "id": 3624, + "nodeType": "IfStatement", + "src": "19278:674:14", + "trueBody": { + "id": 3579, + "nodeType": "Block", + "src": "19296:149:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3573, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "19398:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3575, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "19406:14:14", + "subExpression": { + "id": 3574, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "19406:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "22", + "id": 3576, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19422:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_6e9f33448a4153023cdaf3eb759f1afdc24aba433a3e18b683f8c04a6eaa69f0", + "typeString": "literal_string \"\"\"" + }, + "value": "\"" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_6e9f33448a4153023cdaf3eb759f1afdc24aba433a3e18b683f8c04a6eaa69f0", + "typeString": "literal_string \"\"\"" + } + ], + "id": 3572, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19374:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3577, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19374:52:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3578, + "nodeType": "ExpressionStatement", + "src": "19374:52:14" + } + ] + } + }, + "id": 3625, + "nodeType": "IfStatement", + "src": "19184:768:14", + "trueBody": { + "expression": { + "arguments": [ + { + "id": 3563, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "19226:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3565, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "19234:14:14", + "subExpression": { + "id": 3564, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "19234:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "5c", + "id": 3566, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19250:4:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_731553fa98541ade8b78284229adfe09a819380dee9244baac20dd1e0aa24095", + "typeString": "literal_string \"\\\"" + }, + "value": "\\" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_731553fa98541ade8b78284229adfe09a819380dee9244baac20dd1e0aa24095", + "typeString": "literal_string \"\\\"" + } + ], + "id": 3562, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19202:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3567, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19202:53:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3568, + "nodeType": "ExpressionStatement", + "src": "19202:53:14" + } + }, + "id": 3626, + "nodeType": "IfStatement", + "src": "19091:861:14", + "trueBody": { + "expression": { + "arguments": [ + { + "id": 3553, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "19133:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3555, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "19141:14:14", + "subExpression": { + "id": 3554, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "19141:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "72", + "id": 3556, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19157:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_414f72a4d550cad29f17d9d99a4af64b3776ec5538cd440cef0f03fef2e9e010", + "typeString": "literal_string \"r\"" + }, + "value": "r" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_414f72a4d550cad29f17d9d99a4af64b3776ec5538cd440cef0f03fef2e9e010", + "typeString": "literal_string \"r\"" + } + ], + "id": 3552, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19109:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3557, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19109:52:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3558, + "nodeType": "ExpressionStatement", + "src": "19109:52:14" + } + }, + "id": 3627, + "nodeType": "IfStatement", + "src": "18998:954:14", + "trueBody": { + "expression": { + "arguments": [ + { + "id": 3543, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "19040:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3545, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "19048:14:14", + "subExpression": { + "id": 3544, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "19048:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "66", + "id": 3546, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19064:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_d1e8aeb79500496ef3dc2e57ba746a8315d048b7a664a2bf948db4fa91960483", + "typeString": "literal_string \"f\"" + }, + "value": "f" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_d1e8aeb79500496ef3dc2e57ba746a8315d048b7a664a2bf948db4fa91960483", + "typeString": "literal_string \"f\"" + } + ], + "id": 3542, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "19016:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3547, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19016:52:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3548, + "nodeType": "ExpressionStatement", + "src": "19016:52:14" + } + }, + "id": 3628, + "nodeType": "IfStatement", + "src": "18905:1047:14", + "trueBody": { + "expression": { + "arguments": [ + { + "id": 3533, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "18947:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3535, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "18955:14:14", + "subExpression": { + "id": 3534, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "18955:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "6e", + "id": 3536, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18971:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_4b4ecedb4964a40fe416b16c7bd8b46092040ec42ef0aa69e59f09872f105cf3", + "typeString": "literal_string \"n\"" + }, + "value": "n" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_4b4ecedb4964a40fe416b16c7bd8b46092040ec42ef0aa69e59f09872f105cf3", + "typeString": "literal_string \"n\"" + } + ], + "id": 3532, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "18923:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3537, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18923:52:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3538, + "nodeType": "ExpressionStatement", + "src": "18923:52:14" + } + }, + "id": 3629, + "nodeType": "IfStatement", + "src": "18812:1140:14", + "trueBody": { + "expression": { + "arguments": [ + { + "id": 3523, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "18854:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3525, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "18862:14:14", + "subExpression": { + "id": 3524, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "18862:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "74", + "id": 3526, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18878:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_cac1bb71f0a97c8ac94ca9546b43178a9ad254c7b757ac07433aa6df35cd8089", + "typeString": "literal_string \"t\"" + }, + "value": "t" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_cac1bb71f0a97c8ac94ca9546b43178a9ad254c7b757ac07433aa6df35cd8089", + "typeString": "literal_string \"t\"" + } + ], + "id": 3522, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "18830:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3527, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18830:52:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3528, + "nodeType": "ExpressionStatement", + "src": "18830:52:14" + } + }, + "id": 3630, + "nodeType": "IfStatement", + "src": "18719:1233:14", + "trueBody": { + "expression": { + "arguments": [ + { + "id": 3513, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "18761:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 3515, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "18769:14:14", + "subExpression": { + "id": 3514, + "name": "outputLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3465, + "src": "18769:12:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "62", + "id": 3516, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18785:3:14", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_b5553de315e0edf504d9150af82dafa5c4667fa618ed0a6f19c69b41166c5510", + "typeString": "literal_string \"b\"" + }, + "value": "b" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_stringliteral_b5553de315e0edf504d9150af82dafa5c4667fa618ed0a6f19c69b41166c5510", + "typeString": "literal_string \"b\"" + } + ], + "id": 3512, + "name": "_unsafeWriteBytesOffset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3677, + "src": "18737:23:14", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_uint256_$_t_bytes1_$returns$__$", + "typeString": "function (bytes memory,uint256,bytes1) pure" + } + }, + "id": 3517, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18737:52:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3518, + "nodeType": "ExpressionStatement", + "src": "18737:52:14" + } + } + ] + } + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3475, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3472, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3469, + "src": "18468:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "expression": { + "id": 3473, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3454, + "src": "18472:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 3474, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "18479:6:14", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "18472:13:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "18468:17:14", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3645, + "initializationExpression": { + "assignments": [ + 3469 + ], + "declarations": [ + { + "constant": false, + "id": 3469, + "mutability": "mutable", + "name": "i", + "nameLocation": "18461:1:14", + "nodeType": "VariableDeclaration", + "scope": 3645, + "src": "18453:9:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3468, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "18453:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3471, + "initialValue": { + "hexValue": "30", + "id": 3470, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18465:1:14", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "18453:13:14" + }, + "isSimpleCounterLoop": true, + "loopExpression": { + "expression": { + "id": 3477, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": true, + "src": "18487:3:14", + "subExpression": { + "id": 3476, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3469, + "src": "18489:1:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 3478, + "nodeType": "ExpressionStatement", + "src": "18487:3:14" + }, + "nodeType": "ForStatement", + "src": "18448:1628:14" + }, + { + "AST": { + "nativeSrc": "20164:115:14", + "nodeType": "YulBlock", + "src": "20164:115:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "output", + "nativeSrc": "20185:6:14", + "nodeType": "YulIdentifier", + "src": "20185:6:14" + }, + { + "name": "outputLength", + "nativeSrc": "20193:12:14", + "nodeType": "YulIdentifier", + "src": "20193:12:14" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "20178:6:14", + "nodeType": "YulIdentifier", + "src": "20178:6:14" + }, + "nativeSrc": "20178:28:14", + "nodeType": "YulFunctionCall", + "src": "20178:28:14" + }, + "nativeSrc": "20178:28:14", + "nodeType": "YulExpressionStatement", + "src": "20178:28:14" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "20226:4:14", + "nodeType": "YulLiteral", + "src": "20226:4:14", + "type": "", + "value": "0x40" + }, + { + "arguments": [ + { + "name": "output", + "nativeSrc": "20236:6:14", + "nodeType": "YulIdentifier", + "src": "20236:6:14" + }, + { + "arguments": [ + { + "name": "outputLength", + "nativeSrc": "20248:12:14", + "nodeType": "YulIdentifier", + "src": "20248:12:14" + }, + { + "kind": "number", + "nativeSrc": "20262:4:14", + "nodeType": "YulLiteral", + "src": "20262:4:14", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "20244:3:14", + "nodeType": "YulIdentifier", + "src": "20244:3:14" + }, + "nativeSrc": "20244:23:14", + "nodeType": "YulFunctionCall", + "src": "20244:23:14" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "20232:3:14", + "nodeType": "YulIdentifier", + "src": "20232:3:14" + }, + "nativeSrc": "20232:36:14", + "nodeType": "YulFunctionCall", + "src": "20232:36:14" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "20219:6:14", + "nodeType": "YulIdentifier", + "src": "20219:6:14" + }, + "nativeSrc": "20219:50:14", + "nodeType": "YulFunctionCall", + "src": "20219:50:14" + }, + "nativeSrc": "20219:50:14", + "nodeType": "YulExpressionStatement", + "src": "20219:50:14" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 3461, + "isOffset": false, + "isSlot": false, + "src": "20185:6:14", + "valueSize": 1 + }, + { + "declaration": 3461, + "isOffset": false, + "isSlot": false, + "src": "20236:6:14", + "valueSize": 1 + }, + { + "declaration": 3465, + "isOffset": false, + "isSlot": false, + "src": "20193:12:14", + "valueSize": 1 + }, + { + "declaration": 3465, + "isOffset": false, + "isSlot": false, + "src": "20248:12:14", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 3646, + "nodeType": "InlineAssembly", + "src": "20139:140:14" + }, + { + "expression": { + "arguments": [ + { + "id": 3649, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3461, + "src": "20303:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 3648, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "20296:6:14", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_string_storage_ptr_$", + "typeString": "type(string storage pointer)" + }, + "typeName": { + "id": 3647, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "20296:6:14", + "typeDescriptions": {} + } + }, + "id": 3650, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "20296:14:14", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 3452, + "id": 3651, + "nodeType": "Return", + "src": "20289:21:14" + } + ] + }, + "documentation": { + "id": 3446, + "nodeType": "StructuredDocumentation", + "src": "17183:717:14", + "text": " @dev Escape special characters in JSON strings. This can be useful to prevent JSON injection in NFT metadata.\n WARNING: This function should only be used in double quoted JSON strings. Single quotes are not escaped.\n NOTE: This function escapes backslashes (including those in \\uXXXX sequences) and the characters in ranges\n defined in section 2.5 of RFC-4627 (U+0000 to U+001F, U+0022 and U+005C). All control characters in U+0000\n to U+001F are escaped (\\b, \\t, \\n, \\f, \\r use short form; others use \\u00XX). ECMAScript's `JSON.parse` does\n recover escaped unicode characters that are not in this range, but other tooling may provide different results." + }, + "id": 3653, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "escapeJSON", + "nameLocation": "17914:10:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3449, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3448, + "mutability": "mutable", + "name": "input", + "nameLocation": "17939:5:14", + "nodeType": "VariableDeclaration", + "scope": 3653, + "src": "17925:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3447, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "17925:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "17924:21:14" + }, + "returnParameters": { + "id": 3452, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3451, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3653, + "src": "17969:13:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 3450, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "17969:6:14", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "17968:15:14" + }, + "scope": 3678, + "src": "17905:2412:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3664, + "nodeType": "Block", + "src": "20702:225:14", + "statements": [ + { + "AST": { + "nativeSrc": "20851:70:14", + "nodeType": "YulBlock", + "src": "20851:70:14", + "statements": [ + { + "nativeSrc": "20865:46:14", + "nodeType": "YulAssignment", + "src": "20865:46:14", + "value": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "20888:6:14", + "nodeType": "YulIdentifier", + "src": "20888:6:14" + }, + { + "kind": "number", + "nativeSrc": "20896:4:14", + "nodeType": "YulLiteral", + "src": "20896:4:14", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "20884:3:14", + "nodeType": "YulIdentifier", + "src": "20884:3:14" + }, + "nativeSrc": "20884:17:14", + "nodeType": "YulFunctionCall", + "src": "20884:17:14" + }, + { + "name": "offset", + "nativeSrc": "20903:6:14", + "nodeType": "YulIdentifier", + "src": "20903:6:14" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "20880:3:14", + "nodeType": "YulIdentifier", + "src": "20880:3:14" + }, + "nativeSrc": "20880:30:14", + "nodeType": "YulFunctionCall", + "src": "20880:30:14" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "20874:5:14", + "nodeType": "YulIdentifier", + "src": "20874:5:14" + }, + "nativeSrc": "20874:37:14", + "nodeType": "YulFunctionCall", + "src": "20874:37:14" + }, + "variableNames": [ + { + "name": "value", + "nativeSrc": "20865:5:14", + "nodeType": "YulIdentifier", + "src": "20865:5:14" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 3656, + "isOffset": false, + "isSlot": false, + "src": "20888:6:14", + "valueSize": 1 + }, + { + "declaration": 3658, + "isOffset": false, + "isSlot": false, + "src": "20903:6:14", + "valueSize": 1 + }, + { + "declaration": 3661, + "isOffset": false, + "isSlot": false, + "src": "20865:5:14", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 3663, + "nodeType": "InlineAssembly", + "src": "20826:95:14" + } + ] + }, + "documentation": { + "id": 3654, + "nodeType": "StructuredDocumentation", + "src": "20323:268:14", + "text": " @dev Reads a bytes32 from a bytes array without bounds checking.\n NOTE: making this function internal would mean it could be used with memory unsafe offset, and marking the\n assembly block as such would prevent some optimizations." + }, + "id": 3665, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_unsafeReadBytesOffset", + "nameLocation": "20605:22:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3659, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3656, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "20641:6:14", + "nodeType": "VariableDeclaration", + "scope": 3665, + "src": "20628:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 3655, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "20628:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3658, + "mutability": "mutable", + "name": "offset", + "nameLocation": "20657:6:14", + "nodeType": "VariableDeclaration", + "scope": 3665, + "src": "20649:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3657, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "20649:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "20627:37:14" + }, + "returnParameters": { + "id": 3662, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3661, + "mutability": "mutable", + "name": "value", + "nameLocation": "20695:5:14", + "nodeType": "VariableDeclaration", + "scope": 3665, + "src": "20687:13:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3660, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "20687:7:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "20686:15:14" + }, + "scope": 3678, + "src": "20596:331:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 3676, + "nodeType": "Block", + "src": "21300:235:14", + "statements": [ + { + "AST": { + "nativeSrc": "21449:80:14", + "nodeType": "YulBlock", + "src": "21449:80:14", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "21479:6:14", + "nodeType": "YulIdentifier", + "src": "21479:6:14" + }, + { + "kind": "number", + "nativeSrc": "21487:4:14", + "nodeType": "YulLiteral", + "src": "21487:4:14", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "21475:3:14", + "nodeType": "YulIdentifier", + "src": "21475:3:14" + }, + "nativeSrc": "21475:17:14", + "nodeType": "YulFunctionCall", + "src": "21475:17:14" + }, + { + "name": "offset", + "nativeSrc": "21494:6:14", + "nodeType": "YulIdentifier", + "src": "21494:6:14" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "21471:3:14", + "nodeType": "YulIdentifier", + "src": "21471:3:14" + }, + "nativeSrc": "21471:30:14", + "nodeType": "YulFunctionCall", + "src": "21471:30:14" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "21507:3:14", + "nodeType": "YulLiteral", + "src": "21507:3:14", + "type": "", + "value": "248" + }, + { + "name": "value", + "nativeSrc": "21512:5:14", + "nodeType": "YulIdentifier", + "src": "21512:5:14" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "21503:3:14", + "nodeType": "YulIdentifier", + "src": "21503:3:14" + }, + "nativeSrc": "21503:15:14", + "nodeType": "YulFunctionCall", + "src": "21503:15:14" + } + ], + "functionName": { + "name": "mstore8", + "nativeSrc": "21463:7:14", + "nodeType": "YulIdentifier", + "src": "21463:7:14" + }, + "nativeSrc": "21463:56:14", + "nodeType": "YulFunctionCall", + "src": "21463:56:14" + }, + "nativeSrc": "21463:56:14", + "nodeType": "YulExpressionStatement", + "src": "21463:56:14" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 3668, + "isOffset": false, + "isSlot": false, + "src": "21479:6:14", + "valueSize": 1 + }, + { + "declaration": 3670, + "isOffset": false, + "isSlot": false, + "src": "21494:6:14", + "valueSize": 1 + }, + { + "declaration": 3672, + "isOffset": false, + "isSlot": false, + "src": "21512:5:14", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 3675, + "nodeType": "InlineAssembly", + "src": "21424:105:14" + } + ] + }, + "documentation": { + "id": 3666, + "nodeType": "StructuredDocumentation", + "src": "20933:265:14", + "text": " @dev Write a bytes1 to a bytes array without bounds checking.\n NOTE: making this function internal would mean it could be used with memory unsafe offset, and marking the\n assembly block as such would prevent some optimizations." + }, + "id": 3677, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_unsafeWriteBytesOffset", + "nameLocation": "21212:23:14", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3673, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3668, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "21249:6:14", + "nodeType": "VariableDeclaration", + "scope": 3677, + "src": "21236:19:14", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 3667, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "21236:5:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3670, + "mutability": "mutable", + "name": "offset", + "nameLocation": "21265:6:14", + "nodeType": "VariableDeclaration", + "scope": 3677, + "src": "21257:14:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3669, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "21257:7:14", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3672, + "mutability": "mutable", + "name": "value", + "nameLocation": "21280:5:14", + "nodeType": "VariableDeclaration", + "scope": 3677, + "src": "21273:12:14", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 3671, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "21273:6:14", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + } + ], + "src": "21235:51:14" + }, + "returnParameters": { + "id": 3674, + "nodeType": "ParameterList", + "parameters": [], + "src": "21300:0:14" + }, + "scope": 3678, + "src": "21203:332:14", + "stateMutability": "pure", + "virtual": false, + "visibility": "private" + } + ], + "scope": 3679, + "src": "332:21205:14", + "usedErrors": [ + 2207, + 2210, + 2213 + ], + "usedEvents": [] + } + ], + "src": "101:21437:14" + }, + "id": 14 + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/cryptography/ECDSA.sol", + "exportedSymbols": { + "ECDSA": [ + 4137 + ] + }, + "id": 4138, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 3680, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "112:24:15" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "ECDSA", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 3681, + "nodeType": "StructuredDocumentation", + "src": "138:205:15", + "text": " @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n These functions can be used to verify that a message was signed by the holder\n of the private keys of a given address." + }, + "fullyImplemented": true, + "id": 4137, + "linearizedBaseContracts": [ + 4137 + ], + "name": "ECDSA", + "nameLocation": "352:5:15", + "nodeType": "ContractDefinition", + "nodes": [ + { + "canonicalName": "ECDSA.RecoverError", + "id": 3686, + "members": [ + { + "id": 3682, + "name": "NoError", + "nameLocation": "392:7:15", + "nodeType": "EnumValue", + "src": "392:7:15" + }, + { + "id": 3683, + "name": "InvalidSignature", + "nameLocation": "409:16:15", + "nodeType": "EnumValue", + "src": "409:16:15" + }, + { + "id": 3684, + "name": "InvalidSignatureLength", + "nameLocation": "435:22:15", + "nodeType": "EnumValue", + "src": "435:22:15" + }, + { + "id": 3685, + "name": "InvalidSignatureS", + "nameLocation": "467:17:15", + "nodeType": "EnumValue", + "src": "467:17:15" + } + ], + "name": "RecoverError", + "nameLocation": "369:12:15", + "nodeType": "EnumDefinition", + "src": "364:126:15" + }, + { + "documentation": { + "id": 3687, + "nodeType": "StructuredDocumentation", + "src": "496:49:15", + "text": " @dev The signature is invalid." + }, + "errorSelector": "f645eedf", + "id": 3689, + "name": "ECDSAInvalidSignature", + "nameLocation": "556:21:15", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 3688, + "nodeType": "ParameterList", + "parameters": [], + "src": "577:2:15" + }, + "src": "550:30:15" + }, + { + "documentation": { + "id": 3690, + "nodeType": "StructuredDocumentation", + "src": "586:60:15", + "text": " @dev The signature has an invalid length." + }, + "errorSelector": "fce698f7", + "id": 3694, + "name": "ECDSAInvalidSignatureLength", + "nameLocation": "657:27:15", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 3693, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3692, + "mutability": "mutable", + "name": "length", + "nameLocation": "693:6:15", + "nodeType": "VariableDeclaration", + "scope": 3694, + "src": "685:14:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3691, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "685:7:15", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "684:16:15" + }, + "src": "651:50:15" + }, + { + "documentation": { + "id": 3695, + "nodeType": "StructuredDocumentation", + "src": "707:85:15", + "text": " @dev The signature has an S value that is in the upper half order." + }, + "errorSelector": "d78bce0c", + "id": 3699, + "name": "ECDSAInvalidSignatureS", + "nameLocation": "803:22:15", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 3698, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3697, + "mutability": "mutable", + "name": "s", + "nameLocation": "834:1:15", + "nodeType": "VariableDeclaration", + "scope": 3699, + "src": "826:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3696, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "826:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "825:11:15" + }, + "src": "797:40:15" + }, + { + "body": { + "id": 3751, + "nodeType": "Block", + "src": "2575:622:15", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3717, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 3714, + "name": "signature", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3704, + "src": "2589:9:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 3715, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2599:6:15", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "2589:16:15", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "3635", + "id": 3716, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2609:2:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_65_by_1", + "typeString": "int_const 65" + }, + "value": "65" + }, + "src": "2589:22:15", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 3749, + "nodeType": "Block", + "src": "3083:108:15", + "statements": [ + { + "expression": { + "components": [ + { + "arguments": [ + { + "hexValue": "30", + "id": 3738, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3113:1:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 3737, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3105:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3736, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3105:7:15", + "typeDescriptions": {} + } + }, + "id": 3739, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3105:10:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 3740, + "name": "RecoverError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3686, + "src": "3117:12:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_RecoverError_$3686_$", + "typeString": "type(enum ECDSA.RecoverError)" + } + }, + "id": 3741, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "3130:22:15", + "memberName": "InvalidSignatureLength", + "nodeType": "MemberAccess", + "referencedDeclaration": 3684, + "src": "3117:35:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + { + "arguments": [ + { + "expression": { + "id": 3744, + "name": "signature", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3704, + "src": "3162:9:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 3745, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3172:6:15", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "3162:16:15", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3743, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3154:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes32_$", + "typeString": "type(bytes32)" + }, + "typeName": { + "id": 3742, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3154:7:15", + "typeDescriptions": {} + } + }, + "id": 3746, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3154:25:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 3747, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "3104:76:15", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "functionReturnParameters": 3713, + "id": 3748, + "nodeType": "Return", + "src": "3097:83:15" + } + ] + }, + "id": 3750, + "nodeType": "IfStatement", + "src": "2585:606:15", + "trueBody": { + "id": 3735, + "nodeType": "Block", + "src": "2613:464:15", + "statements": [ + { + "assignments": [ + 3719 + ], + "declarations": [ + { + "constant": false, + "id": 3719, + "mutability": "mutable", + "name": "r", + "nameLocation": "2635:1:15", + "nodeType": "VariableDeclaration", + "scope": 3735, + "src": "2627:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3718, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2627:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 3720, + "nodeType": "VariableDeclarationStatement", + "src": "2627:9:15" + }, + { + "assignments": [ + 3722 + ], + "declarations": [ + { + "constant": false, + "id": 3722, + "mutability": "mutable", + "name": "s", + "nameLocation": "2658:1:15", + "nodeType": "VariableDeclaration", + "scope": 3735, + "src": "2650:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3721, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2650:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 3723, + "nodeType": "VariableDeclarationStatement", + "src": "2650:9:15" + }, + { + "assignments": [ + 3725 + ], + "declarations": [ + { + "constant": false, + "id": 3725, + "mutability": "mutable", + "name": "v", + "nameLocation": "2679:1:15", + "nodeType": "VariableDeclaration", + "scope": 3735, + "src": "2673:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 3724, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "2673:5:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "id": 3726, + "nodeType": "VariableDeclarationStatement", + "src": "2673:7:15" + }, + { + "AST": { + "nativeSrc": "2850:171:15", + "nodeType": "YulBlock", + "src": "2850:171:15", + "statements": [ + { + "nativeSrc": "2868:32:15", + "nodeType": "YulAssignment", + "src": "2868:32:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "signature", + "nativeSrc": "2883:9:15", + "nodeType": "YulIdentifier", + "src": "2883:9:15" + }, + { + "kind": "number", + "nativeSrc": "2894:4:15", + "nodeType": "YulLiteral", + "src": "2894:4:15", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2879:3:15", + "nodeType": "YulIdentifier", + "src": "2879:3:15" + }, + "nativeSrc": "2879:20:15", + "nodeType": "YulFunctionCall", + "src": "2879:20:15" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "2873:5:15", + "nodeType": "YulIdentifier", + "src": "2873:5:15" + }, + "nativeSrc": "2873:27:15", + "nodeType": "YulFunctionCall", + "src": "2873:27:15" + }, + "variableNames": [ + { + "name": "r", + "nativeSrc": "2868:1:15", + "nodeType": "YulIdentifier", + "src": "2868:1:15" + } + ] + }, + { + "nativeSrc": "2917:32:15", + "nodeType": "YulAssignment", + "src": "2917:32:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "signature", + "nativeSrc": "2932:9:15", + "nodeType": "YulIdentifier", + "src": "2932:9:15" + }, + { + "kind": "number", + "nativeSrc": "2943:4:15", + "nodeType": "YulLiteral", + "src": "2943:4:15", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2928:3:15", + "nodeType": "YulIdentifier", + "src": "2928:3:15" + }, + "nativeSrc": "2928:20:15", + "nodeType": "YulFunctionCall", + "src": "2928:20:15" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "2922:5:15", + "nodeType": "YulIdentifier", + "src": "2922:5:15" + }, + "nativeSrc": "2922:27:15", + "nodeType": "YulFunctionCall", + "src": "2922:27:15" + }, + "variableNames": [ + { + "name": "s", + "nativeSrc": "2917:1:15", + "nodeType": "YulIdentifier", + "src": "2917:1:15" + } + ] + }, + { + "nativeSrc": "2966:41:15", + "nodeType": "YulAssignment", + "src": "2966:41:15", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2976:1:15", + "nodeType": "YulLiteral", + "src": "2976:1:15", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "signature", + "nativeSrc": "2989:9:15", + "nodeType": "YulIdentifier", + "src": "2989:9:15" + }, + { + "kind": "number", + "nativeSrc": "3000:4:15", + "nodeType": "YulLiteral", + "src": "3000:4:15", + "type": "", + "value": "0x60" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2985:3:15", + "nodeType": "YulIdentifier", + "src": "2985:3:15" + }, + "nativeSrc": "2985:20:15", + "nodeType": "YulFunctionCall", + "src": "2985:20:15" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "2979:5:15", + "nodeType": "YulIdentifier", + "src": "2979:5:15" + }, + "nativeSrc": "2979:27:15", + "nodeType": "YulFunctionCall", + "src": "2979:27:15" + } + ], + "functionName": { + "name": "byte", + "nativeSrc": "2971:4:15", + "nodeType": "YulIdentifier", + "src": "2971:4:15" + }, + "nativeSrc": "2971:36:15", + "nodeType": "YulFunctionCall", + "src": "2971:36:15" + }, + "variableNames": [ + { + "name": "v", + "nativeSrc": "2966:1:15", + "nodeType": "YulIdentifier", + "src": "2966:1:15" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 3719, + "isOffset": false, + "isSlot": false, + "src": "2868:1:15", + "valueSize": 1 + }, + { + "declaration": 3722, + "isOffset": false, + "isSlot": false, + "src": "2917:1:15", + "valueSize": 1 + }, + { + "declaration": 3704, + "isOffset": false, + "isSlot": false, + "src": "2883:9:15", + "valueSize": 1 + }, + { + "declaration": 3704, + "isOffset": false, + "isSlot": false, + "src": "2932:9:15", + "valueSize": 1 + }, + { + "declaration": 3704, + "isOffset": false, + "isSlot": false, + "src": "2989:9:15", + "valueSize": 1 + }, + { + "declaration": 3725, + "isOffset": false, + "isSlot": false, + "src": "2966:1:15", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 3727, + "nodeType": "InlineAssembly", + "src": "2825:196:15" + }, + { + "expression": { + "arguments": [ + { + "id": 3729, + "name": "hash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3702, + "src": "3052:4:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3730, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3725, + "src": "3058:1:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + { + "id": 3731, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3719, + "src": "3061:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3732, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3722, + "src": "3064:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3728, + "name": "tryRecover", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3752, + 3915, + 4023 + ], + "referencedDeclaration": 4023, + "src": "3041:10:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_uint8_$_t_bytes32_$_t_bytes32_$returns$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "function (bytes32,uint8,bytes32,bytes32) pure returns (address,enum ECDSA.RecoverError,bytes32)" + } + }, + "id": 3733, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3041:25:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "functionReturnParameters": 3713, + "id": 3734, + "nodeType": "Return", + "src": "3034:32:15" + } + ] + } + } + ] + }, + "documentation": { + "id": 3700, + "nodeType": "StructuredDocumentation", + "src": "843:1571:15", + "text": " @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not\n return address(0) without also returning an error description. Errors are documented using an enum (error type)\n and a bytes32 providing additional information about the error.\n If no error is returned, then the address can be used for verification purposes.\n The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:\n this function rejects them by requiring the `s` value to be in the lower\n half order, and the `v` value to be either 27 or 28.\n NOTE: This function only supports 65-byte signatures. ERC-2098 short signatures are rejected. This restriction\n is DEPRECATED and will be removed in v6.0. Developers SHOULD NOT use signatures as unique identifiers; use hash\n invalidation or nonces for replay protection.\n IMPORTANT: `hash` _must_ be the result of a hash operation for the\n verification to be secure: it is possible to craft signatures that\n recover to arbitrary addresses for non-hashed data. A safe way to ensure\n this is by receiving a hash of the original message (which may otherwise\n be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.\n Documentation for signature generation:\n - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]" + }, + "id": 3752, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryRecover", + "nameLocation": "2428:10:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3705, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3702, + "mutability": "mutable", + "name": "hash", + "nameLocation": "2456:4:15", + "nodeType": "VariableDeclaration", + "scope": 3752, + "src": "2448:12:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3701, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2448:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3704, + "mutability": "mutable", + "name": "signature", + "nameLocation": "2483:9:15", + "nodeType": "VariableDeclaration", + "scope": 3752, + "src": "2470:22:15", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 3703, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2470:5:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "2438:60:15" + }, + "returnParameters": { + "id": 3713, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3707, + "mutability": "mutable", + "name": "recovered", + "nameLocation": "2530:9:15", + "nodeType": "VariableDeclaration", + "scope": 3752, + "src": "2522:17:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3706, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2522:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3710, + "mutability": "mutable", + "name": "err", + "nameLocation": "2554:3:15", + "nodeType": "VariableDeclaration", + "scope": 3752, + "src": "2541:16:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "typeName": { + "id": 3709, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 3708, + "name": "RecoverError", + "nameLocations": [ + "2541:12:15" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3686, + "src": "2541:12:15" + }, + "referencedDeclaration": 3686, + "src": "2541:12:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3712, + "mutability": "mutable", + "name": "errArg", + "nameLocation": "2567:6:15", + "nodeType": "VariableDeclaration", + "scope": 3752, + "src": "2559:14:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3711, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2559:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "2521:53:15" + }, + "scope": 4137, + "src": "2419:778:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3804, + "nodeType": "Block", + "src": "3456:716:15", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3770, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 3767, + "name": "signature", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3757, + "src": "3470:9:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + } + }, + "id": 3768, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3480:6:15", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "3470:16:15", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "3635", + "id": 3769, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3490:2:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_65_by_1", + "typeString": "int_const 65" + }, + "value": "65" + }, + "src": "3470:22:15", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 3802, + "nodeType": "Block", + "src": "4058:108:15", + "statements": [ + { + "expression": { + "components": [ + { + "arguments": [ + { + "hexValue": "30", + "id": 3791, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4088:1:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 3790, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4080:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3789, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "4080:7:15", + "typeDescriptions": {} + } + }, + "id": 3792, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4080:10:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 3793, + "name": "RecoverError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3686, + "src": "4092:12:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_RecoverError_$3686_$", + "typeString": "type(enum ECDSA.RecoverError)" + } + }, + "id": 3794, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "4105:22:15", + "memberName": "InvalidSignatureLength", + "nodeType": "MemberAccess", + "referencedDeclaration": 3684, + "src": "4092:35:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + { + "arguments": [ + { + "expression": { + "id": 3797, + "name": "signature", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3757, + "src": "4137:9:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + } + }, + "id": 3798, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4147:6:15", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "4137:16:15", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3796, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4129:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes32_$", + "typeString": "type(bytes32)" + }, + "typeName": { + "id": 3795, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "4129:7:15", + "typeDescriptions": {} + } + }, + "id": 3799, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4129:25:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 3800, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "4079:76:15", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "functionReturnParameters": 3766, + "id": 3801, + "nodeType": "Return", + "src": "4072:83:15" + } + ] + }, + "id": 3803, + "nodeType": "IfStatement", + "src": "3466:700:15", + "trueBody": { + "id": 3788, + "nodeType": "Block", + "src": "3494:558:15", + "statements": [ + { + "assignments": [ + 3772 + ], + "declarations": [ + { + "constant": false, + "id": 3772, + "mutability": "mutable", + "name": "r", + "nameLocation": "3516:1:15", + "nodeType": "VariableDeclaration", + "scope": 3788, + "src": "3508:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3771, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3508:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 3773, + "nodeType": "VariableDeclarationStatement", + "src": "3508:9:15" + }, + { + "assignments": [ + 3775 + ], + "declarations": [ + { + "constant": false, + "id": 3775, + "mutability": "mutable", + "name": "s", + "nameLocation": "3539:1:15", + "nodeType": "VariableDeclaration", + "scope": 3788, + "src": "3531:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3774, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3531:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 3776, + "nodeType": "VariableDeclarationStatement", + "src": "3531:9:15" + }, + { + "assignments": [ + 3778 + ], + "declarations": [ + { + "constant": false, + "id": 3778, + "mutability": "mutable", + "name": "v", + "nameLocation": "3560:1:15", + "nodeType": "VariableDeclaration", + "scope": 3788, + "src": "3554:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 3777, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "3554:5:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "id": 3779, + "nodeType": "VariableDeclarationStatement", + "src": "3554:7:15" + }, + { + "AST": { + "nativeSrc": "3794:202:15", + "nodeType": "YulBlock", + "src": "3794:202:15", + "statements": [ + { + "nativeSrc": "3812:35:15", + "nodeType": "YulAssignment", + "src": "3812:35:15", + "value": { + "arguments": [ + { + "name": "signature.offset", + "nativeSrc": "3830:16:15", + "nodeType": "YulIdentifier", + "src": "3830:16:15" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "3817:12:15", + "nodeType": "YulIdentifier", + "src": "3817:12:15" + }, + "nativeSrc": "3817:30:15", + "nodeType": "YulFunctionCall", + "src": "3817:30:15" + }, + "variableNames": [ + { + "name": "r", + "nativeSrc": "3812:1:15", + "nodeType": "YulIdentifier", + "src": "3812:1:15" + } + ] + }, + { + "nativeSrc": "3864:46:15", + "nodeType": "YulAssignment", + "src": "3864:46:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "signature.offset", + "nativeSrc": "3886:16:15", + "nodeType": "YulIdentifier", + "src": "3886:16:15" + }, + { + "kind": "number", + "nativeSrc": "3904:4:15", + "nodeType": "YulLiteral", + "src": "3904:4:15", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3882:3:15", + "nodeType": "YulIdentifier", + "src": "3882:3:15" + }, + "nativeSrc": "3882:27:15", + "nodeType": "YulFunctionCall", + "src": "3882:27:15" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "3869:12:15", + "nodeType": "YulIdentifier", + "src": "3869:12:15" + }, + "nativeSrc": "3869:41:15", + "nodeType": "YulFunctionCall", + "src": "3869:41:15" + }, + "variableNames": [ + { + "name": "s", + "nativeSrc": "3864:1:15", + "nodeType": "YulIdentifier", + "src": "3864:1:15" + } + ] + }, + { + "nativeSrc": "3927:55:15", + "nodeType": "YulAssignment", + "src": "3927:55:15", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3937:1:15", + "nodeType": "YulLiteral", + "src": "3937:1:15", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "signature.offset", + "nativeSrc": "3957:16:15", + "nodeType": "YulIdentifier", + "src": "3957:16:15" + }, + { + "kind": "number", + "nativeSrc": "3975:4:15", + "nodeType": "YulLiteral", + "src": "3975:4:15", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3953:3:15", + "nodeType": "YulIdentifier", + "src": "3953:3:15" + }, + "nativeSrc": "3953:27:15", + "nodeType": "YulFunctionCall", + "src": "3953:27:15" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "3940:12:15", + "nodeType": "YulIdentifier", + "src": "3940:12:15" + }, + "nativeSrc": "3940:41:15", + "nodeType": "YulFunctionCall", + "src": "3940:41:15" + } + ], + "functionName": { + "name": "byte", + "nativeSrc": "3932:4:15", + "nodeType": "YulIdentifier", + "src": "3932:4:15" + }, + "nativeSrc": "3932:50:15", + "nodeType": "YulFunctionCall", + "src": "3932:50:15" + }, + "variableNames": [ + { + "name": "v", + "nativeSrc": "3927:1:15", + "nodeType": "YulIdentifier", + "src": "3927:1:15" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 3772, + "isOffset": false, + "isSlot": false, + "src": "3812:1:15", + "valueSize": 1 + }, + { + "declaration": 3775, + "isOffset": false, + "isSlot": false, + "src": "3864:1:15", + "valueSize": 1 + }, + { + "declaration": 3757, + "isOffset": true, + "isSlot": false, + "src": "3830:16:15", + "suffix": "offset", + "valueSize": 1 + }, + { + "declaration": 3757, + "isOffset": true, + "isSlot": false, + "src": "3886:16:15", + "suffix": "offset", + "valueSize": 1 + }, + { + "declaration": 3757, + "isOffset": true, + "isSlot": false, + "src": "3957:16:15", + "suffix": "offset", + "valueSize": 1 + }, + { + "declaration": 3778, + "isOffset": false, + "isSlot": false, + "src": "3927:1:15", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 3780, + "nodeType": "InlineAssembly", + "src": "3769:227:15" + }, + { + "expression": { + "arguments": [ + { + "id": 3782, + "name": "hash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3755, + "src": "4027:4:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3783, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3778, + "src": "4033:1:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + { + "id": 3784, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3772, + "src": "4036:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3785, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3775, + "src": "4039:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3781, + "name": "tryRecover", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3752, + 3915, + 4023 + ], + "referencedDeclaration": 4023, + "src": "4016:10:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_uint8_$_t_bytes32_$_t_bytes32_$returns$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "function (bytes32,uint8,bytes32,bytes32) pure returns (address,enum ECDSA.RecoverError,bytes32)" + } + }, + "id": 3786, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4016:25:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "functionReturnParameters": 3766, + "id": 3787, + "nodeType": "Return", + "src": "4009:32:15" + } + ] + } + } + ] + }, + "documentation": { + "id": 3753, + "nodeType": "StructuredDocumentation", + "src": "3203:82:15", + "text": " @dev Variant of {tryRecover} that takes a signature in calldata" + }, + "id": 3805, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryRecoverCalldata", + "nameLocation": "3299:18:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3758, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3755, + "mutability": "mutable", + "name": "hash", + "nameLocation": "3335:4:15", + "nodeType": "VariableDeclaration", + "scope": 3805, + "src": "3327:12:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3754, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3327:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3757, + "mutability": "mutable", + "name": "signature", + "nameLocation": "3364:9:15", + "nodeType": "VariableDeclaration", + "scope": 3805, + "src": "3349:24:15", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 3756, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3349:5:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "3317:62:15" + }, + "returnParameters": { + "id": 3766, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3760, + "mutability": "mutable", + "name": "recovered", + "nameLocation": "3411:9:15", + "nodeType": "VariableDeclaration", + "scope": 3805, + "src": "3403:17:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3759, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3403:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3763, + "mutability": "mutable", + "name": "err", + "nameLocation": "3435:3:15", + "nodeType": "VariableDeclaration", + "scope": 3805, + "src": "3422:16:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "typeName": { + "id": 3762, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 3761, + "name": "RecoverError", + "nameLocations": [ + "3422:12:15" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3686, + "src": "3422:12:15" + }, + "referencedDeclaration": 3686, + "src": "3422:12:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3765, + "mutability": "mutable", + "name": "errArg", + "nameLocation": "3448:6:15", + "nodeType": "VariableDeclaration", + "scope": 3805, + "src": "3440:14:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3764, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3440:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "3402:53:15" + }, + "scope": 4137, + "src": "3290:882:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3834, + "nodeType": "Block", + "src": "5363:168:15", + "statements": [ + { + "assignments": [ + 3816, + 3819, + 3821 + ], + "declarations": [ + { + "constant": false, + "id": 3816, + "mutability": "mutable", + "name": "recovered", + "nameLocation": "5382:9:15", + "nodeType": "VariableDeclaration", + "scope": 3834, + "src": "5374:17:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3815, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5374:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3819, + "mutability": "mutable", + "name": "error", + "nameLocation": "5406:5:15", + "nodeType": "VariableDeclaration", + "scope": 3834, + "src": "5393:18:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "typeName": { + "id": 3818, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 3817, + "name": "RecoverError", + "nameLocations": [ + "5393:12:15" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3686, + "src": "5393:12:15" + }, + "referencedDeclaration": 3686, + "src": "5393:12:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3821, + "mutability": "mutable", + "name": "errorArg", + "nameLocation": "5421:8:15", + "nodeType": "VariableDeclaration", + "scope": 3834, + "src": "5413:16:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3820, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5413:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 3826, + "initialValue": { + "arguments": [ + { + "id": 3823, + "name": "hash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3808, + "src": "5444:4:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3824, + "name": "signature", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3810, + "src": "5450:9:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 3822, + "name": "tryRecover", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3752, + 3915, + 4023 + ], + "referencedDeclaration": 3752, + "src": "5433:10:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_bytes_memory_ptr_$returns$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "function (bytes32,bytes memory) pure returns (address,enum ECDSA.RecoverError,bytes32)" + } + }, + "id": 3825, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5433:27:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "5373:87:15" + }, + { + "expression": { + "arguments": [ + { + "id": 3828, + "name": "error", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3819, + "src": "5482:5:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + { + "id": 3829, + "name": "errorArg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3821, + "src": "5489:8:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3827, + "name": "_throwError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4136, + "src": "5470:11:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_RecoverError_$3686_$_t_bytes32_$returns$__$", + "typeString": "function (enum ECDSA.RecoverError,bytes32) pure" + } + }, + "id": 3830, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5470:28:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3831, + "nodeType": "ExpressionStatement", + "src": "5470:28:15" + }, + { + "expression": { + "id": 3832, + "name": "recovered", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3816, + "src": "5515:9:15", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 3814, + "id": 3833, + "nodeType": "Return", + "src": "5508:16:15" + } + ] + }, + "documentation": { + "id": 3806, + "nodeType": "StructuredDocumentation", + "src": "4178:1093:15", + "text": " @dev Returns the address that signed a hashed message (`hash`) with\n `signature`. This address can then be used for verification purposes.\n The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:\n this function rejects them by requiring the `s` value to be in the lower\n half order, and the `v` value to be either 27 or 28.\n NOTE: This function only supports 65-byte signatures. ERC-2098 short signatures are rejected. This restriction\n is DEPRECATED and will be removed in v6.0. Developers SHOULD NOT use signatures as unique identifiers; use hash\n invalidation or nonces for replay protection.\n IMPORTANT: `hash` _must_ be the result of a hash operation for the\n verification to be secure: it is possible to craft signatures that\n recover to arbitrary addresses for non-hashed data. A safe way to ensure\n this is by receiving a hash of the original message (which may otherwise\n be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it." + }, + "id": 3835, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "recover", + "nameLocation": "5285:7:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3811, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3808, + "mutability": "mutable", + "name": "hash", + "nameLocation": "5301:4:15", + "nodeType": "VariableDeclaration", + "scope": 3835, + "src": "5293:12:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3807, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5293:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3810, + "mutability": "mutable", + "name": "signature", + "nameLocation": "5320:9:15", + "nodeType": "VariableDeclaration", + "scope": 3835, + "src": "5307:22:15", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 3809, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5307:5:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "5292:38:15" + }, + "returnParameters": { + "id": 3814, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3813, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3835, + "src": "5354:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3812, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5354:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "5353:9:15" + }, + "scope": 4137, + "src": "5276:255:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3864, + "nodeType": "Block", + "src": "5718:176:15", + "statements": [ + { + "assignments": [ + 3846, + 3849, + 3851 + ], + "declarations": [ + { + "constant": false, + "id": 3846, + "mutability": "mutable", + "name": "recovered", + "nameLocation": "5737:9:15", + "nodeType": "VariableDeclaration", + "scope": 3864, + "src": "5729:17:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3845, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5729:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3849, + "mutability": "mutable", + "name": "error", + "nameLocation": "5761:5:15", + "nodeType": "VariableDeclaration", + "scope": 3864, + "src": "5748:18:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "typeName": { + "id": 3848, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 3847, + "name": "RecoverError", + "nameLocations": [ + "5748:12:15" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3686, + "src": "5748:12:15" + }, + "referencedDeclaration": 3686, + "src": "5748:12:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3851, + "mutability": "mutable", + "name": "errorArg", + "nameLocation": "5776:8:15", + "nodeType": "VariableDeclaration", + "scope": 3864, + "src": "5768:16:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3850, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5768:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 3856, + "initialValue": { + "arguments": [ + { + "id": 3853, + "name": "hash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3838, + "src": "5807:4:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3854, + "name": "signature", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3840, + "src": "5813:9:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + } + ], + "id": 3852, + "name": "tryRecoverCalldata", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3805, + "src": "5788:18:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_bytes_calldata_ptr_$returns$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "function (bytes32,bytes calldata) pure returns (address,enum ECDSA.RecoverError,bytes32)" + } + }, + "id": 3855, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5788:35:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "5728:95:15" + }, + { + "expression": { + "arguments": [ + { + "id": 3858, + "name": "error", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3849, + "src": "5845:5:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + { + "id": 3859, + "name": "errorArg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3851, + "src": "5852:8:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3857, + "name": "_throwError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4136, + "src": "5833:11:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_RecoverError_$3686_$_t_bytes32_$returns$__$", + "typeString": "function (enum ECDSA.RecoverError,bytes32) pure" + } + }, + "id": 3860, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5833:28:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3861, + "nodeType": "ExpressionStatement", + "src": "5833:28:15" + }, + { + "expression": { + "id": 3862, + "name": "recovered", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3846, + "src": "5878:9:15", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 3844, + "id": 3863, + "nodeType": "Return", + "src": "5871:16:15" + } + ] + }, + "documentation": { + "id": 3836, + "nodeType": "StructuredDocumentation", + "src": "5537:79:15", + "text": " @dev Variant of {recover} that takes a signature in calldata" + }, + "id": 3865, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "recoverCalldata", + "nameLocation": "5630:15:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3841, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3838, + "mutability": "mutable", + "name": "hash", + "nameLocation": "5654:4:15", + "nodeType": "VariableDeclaration", + "scope": 3865, + "src": "5646:12:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3837, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5646:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3840, + "mutability": "mutable", + "name": "signature", + "nameLocation": "5675:9:15", + "nodeType": "VariableDeclaration", + "scope": 3865, + "src": "5660:24:15", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 3839, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5660:5:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "5645:40:15" + }, + "returnParameters": { + "id": 3844, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3843, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3865, + "src": "5709:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3842, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5709:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "5708:9:15" + }, + "scope": 4137, + "src": "5621:273:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3914, + "nodeType": "Block", + "src": "6273:342:15", + "statements": [ + { + "id": 3913, + "nodeType": "UncheckedBlock", + "src": "6283:326:15", + "statements": [ + { + "assignments": [ + 3883 + ], + "declarations": [ + { + "constant": false, + "id": 3883, + "mutability": "mutable", + "name": "s", + "nameLocation": "6315:1:15", + "nodeType": "VariableDeclaration", + "scope": 3913, + "src": "6307:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3882, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6307:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 3890, + "initialValue": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 3889, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3884, + "name": "vs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3872, + "src": "6319:2:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "arguments": [ + { + "hexValue": "307837666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666", + "id": 3887, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6332:66:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_57896044618658097711785492504343953926634992332820282019728792003956564819967_by_1", + "typeString": "int_const 5789...(69 digits omitted)...9967" + }, + "value": "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_57896044618658097711785492504343953926634992332820282019728792003956564819967_by_1", + "typeString": "int_const 5789...(69 digits omitted)...9967" + } + ], + "id": 3886, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6324:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes32_$", + "typeString": "type(bytes32)" + }, + "typeName": { + "id": 3885, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6324:7:15", + "typeDescriptions": {} + } + }, + "id": 3888, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6324:75:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "6319:80:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "6307:92:15" + }, + { + "assignments": [ + 3892 + ], + "declarations": [ + { + "constant": false, + "id": 3892, + "mutability": "mutable", + "name": "v", + "nameLocation": "6516:1:15", + "nodeType": "VariableDeclaration", + "scope": 3913, + "src": "6510:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 3891, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "6510:5:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "id": 3905, + "initialValue": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3903, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3900, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 3897, + "name": "vs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3872, + "src": "6535:2:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3896, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6527:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 3895, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6527:7:15", + "typeDescriptions": {} + } + }, + "id": 3898, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6527:11:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "323535", + "id": 3899, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6542:3:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "255" + }, + "src": "6527:18:15", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 3901, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "6526:20:15", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "3237", + "id": 3902, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6549:2:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_27_by_1", + "typeString": "int_const 27" + }, + "value": "27" + }, + "src": "6526:25:15", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3894, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6520:5:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": { + "id": 3893, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "6520:5:15", + "typeDescriptions": {} + } + }, + "id": 3904, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6520:32:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "6510:42:15" + }, + { + "expression": { + "arguments": [ + { + "id": 3907, + "name": "hash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3868, + "src": "6584:4:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3908, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3892, + "src": "6590:1:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + { + "id": 3909, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3870, + "src": "6593:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3910, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3883, + "src": "6596:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3906, + "name": "tryRecover", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3752, + 3915, + 4023 + ], + "referencedDeclaration": 4023, + "src": "6573:10:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_uint8_$_t_bytes32_$_t_bytes32_$returns$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "function (bytes32,uint8,bytes32,bytes32) pure returns (address,enum ECDSA.RecoverError,bytes32)" + } + }, + "id": 3911, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6573:25:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "functionReturnParameters": 3881, + "id": 3912, + "nodeType": "Return", + "src": "6566:32:15" + } + ] + } + ] + }, + "documentation": { + "id": 3866, + "nodeType": "StructuredDocumentation", + "src": "5900:205:15", + "text": " @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n See https://eips.ethereum.org/EIPS/eip-2098[ERC-2098 short signatures]" + }, + "id": 3915, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryRecover", + "nameLocation": "6119:10:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3873, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3868, + "mutability": "mutable", + "name": "hash", + "nameLocation": "6147:4:15", + "nodeType": "VariableDeclaration", + "scope": 3915, + "src": "6139:12:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3867, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6139:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3870, + "mutability": "mutable", + "name": "r", + "nameLocation": "6169:1:15", + "nodeType": "VariableDeclaration", + "scope": 3915, + "src": "6161:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3869, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6161:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3872, + "mutability": "mutable", + "name": "vs", + "nameLocation": "6188:2:15", + "nodeType": "VariableDeclaration", + "scope": 3915, + "src": "6180:10:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3871, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6180:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "6129:67:15" + }, + "returnParameters": { + "id": 3881, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3875, + "mutability": "mutable", + "name": "recovered", + "nameLocation": "6228:9:15", + "nodeType": "VariableDeclaration", + "scope": 3915, + "src": "6220:17:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3874, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6220:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3878, + "mutability": "mutable", + "name": "err", + "nameLocation": "6252:3:15", + "nodeType": "VariableDeclaration", + "scope": 3915, + "src": "6239:16:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "typeName": { + "id": 3877, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 3876, + "name": "RecoverError", + "nameLocations": [ + "6239:12:15" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3686, + "src": "6239:12:15" + }, + "referencedDeclaration": 3686, + "src": "6239:12:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3880, + "mutability": "mutable", + "name": "errArg", + "nameLocation": "6265:6:15", + "nodeType": "VariableDeclaration", + "scope": 3915, + "src": "6257:14:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3879, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6257:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "6219:53:15" + }, + "scope": 4137, + "src": "6110:505:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 3947, + "nodeType": "Block", + "src": "6829:164:15", + "statements": [ + { + "assignments": [ + 3928, + 3931, + 3933 + ], + "declarations": [ + { + "constant": false, + "id": 3928, + "mutability": "mutable", + "name": "recovered", + "nameLocation": "6848:9:15", + "nodeType": "VariableDeclaration", + "scope": 3947, + "src": "6840:17:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3927, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6840:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3931, + "mutability": "mutable", + "name": "error", + "nameLocation": "6872:5:15", + "nodeType": "VariableDeclaration", + "scope": 3947, + "src": "6859:18:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "typeName": { + "id": 3930, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 3929, + "name": "RecoverError", + "nameLocations": [ + "6859:12:15" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3686, + "src": "6859:12:15" + }, + "referencedDeclaration": 3686, + "src": "6859:12:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3933, + "mutability": "mutable", + "name": "errorArg", + "nameLocation": "6887:8:15", + "nodeType": "VariableDeclaration", + "scope": 3947, + "src": "6879:16:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3932, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6879:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 3939, + "initialValue": { + "arguments": [ + { + "id": 3935, + "name": "hash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3918, + "src": "6910:4:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3936, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3920, + "src": "6916:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3937, + "name": "vs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3922, + "src": "6919:2:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3934, + "name": "tryRecover", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3752, + 3915, + 4023 + ], + "referencedDeclaration": 3915, + "src": "6899:10:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_bytes32_$_t_bytes32_$returns$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "function (bytes32,bytes32,bytes32) pure returns (address,enum ECDSA.RecoverError,bytes32)" + } + }, + "id": 3938, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6899:23:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "6839:83:15" + }, + { + "expression": { + "arguments": [ + { + "id": 3941, + "name": "error", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3931, + "src": "6944:5:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + { + "id": 3942, + "name": "errorArg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3933, + "src": "6951:8:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3940, + "name": "_throwError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4136, + "src": "6932:11:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_RecoverError_$3686_$_t_bytes32_$returns$__$", + "typeString": "function (enum ECDSA.RecoverError,bytes32) pure" + } + }, + "id": 3943, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6932:28:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3944, + "nodeType": "ExpressionStatement", + "src": "6932:28:15" + }, + { + "expression": { + "id": 3945, + "name": "recovered", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3928, + "src": "6977:9:15", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 3926, + "id": 3946, + "nodeType": "Return", + "src": "6970:16:15" + } + ] + }, + "documentation": { + "id": 3916, + "nodeType": "StructuredDocumentation", + "src": "6621:117:15", + "text": " @dev Overload of {ECDSA-recover} that receives the `r` and `vs` short-signature fields separately." + }, + "id": 3948, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "recover", + "nameLocation": "6752:7:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3923, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3918, + "mutability": "mutable", + "name": "hash", + "nameLocation": "6768:4:15", + "nodeType": "VariableDeclaration", + "scope": 3948, + "src": "6760:12:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3917, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6760:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3920, + "mutability": "mutable", + "name": "r", + "nameLocation": "6782:1:15", + "nodeType": "VariableDeclaration", + "scope": 3948, + "src": "6774:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3919, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6774:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3922, + "mutability": "mutable", + "name": "vs", + "nameLocation": "6793:2:15", + "nodeType": "VariableDeclaration", + "scope": 3948, + "src": "6785:10:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3921, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6785:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "6759:37:15" + }, + "returnParameters": { + "id": 3926, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3925, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3948, + "src": "6820:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3924, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6820:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "6819:9:15" + }, + "scope": 4137, + "src": "6743:250:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4022, + "nodeType": "Block", + "src": "7308:1372:15", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3972, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 3969, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3957, + "src": "8204:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3968, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8196:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 3967, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8196:7:15", + "typeDescriptions": {} + } + }, + "id": 3970, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8196:10:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "307837464646464646464646464646464646464646464646464646464646464646463544353736453733353741343530314444464539324634363638314232304130", + "id": 3971, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8209:66:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_57896044618658097711785492504343953926418782139537452191302581570759080747168_by_1", + "typeString": "int_const 5789...(69 digits omitted)...7168" + }, + "value": "0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0" + }, + "src": "8196:79:15", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3983, + "nodeType": "IfStatement", + "src": "8192:164:15", + "trueBody": { + "id": 3982, + "nodeType": "Block", + "src": "8277:79:15", + "statements": [ + { + "expression": { + "components": [ + { + "arguments": [ + { + "hexValue": "30", + "id": 3975, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8307:1:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 3974, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8299:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3973, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "8299:7:15", + "typeDescriptions": {} + } + }, + "id": 3976, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8299:10:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 3977, + "name": "RecoverError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3686, + "src": "8311:12:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_RecoverError_$3686_$", + "typeString": "type(enum ECDSA.RecoverError)" + } + }, + "id": 3978, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "8324:17:15", + "memberName": "InvalidSignatureS", + "nodeType": "MemberAccess", + "referencedDeclaration": 3685, + "src": "8311:30:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + { + "id": 3979, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3957, + "src": "8343:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 3980, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "8298:47:15", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "functionReturnParameters": 3966, + "id": 3981, + "nodeType": "Return", + "src": "8291:54:15" + } + ] + } + }, + { + "assignments": [ + 3985 + ], + "declarations": [ + { + "constant": false, + "id": 3985, + "mutability": "mutable", + "name": "signer", + "nameLocation": "8458:6:15", + "nodeType": "VariableDeclaration", + "scope": 4022, + "src": "8450:14:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3984, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "8450:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "id": 3992, + "initialValue": { + "arguments": [ + { + "id": 3987, + "name": "hash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3951, + "src": "8477:4:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3988, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3953, + "src": "8483:1:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + { + "id": 3989, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3955, + "src": "8486:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3990, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3957, + "src": "8489:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3986, + "name": "ecrecover", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -6, + "src": "8467:9:15", + "typeDescriptions": { + "typeIdentifier": "t_function_ecrecover_pure$_t_bytes32_$_t_uint8_$_t_bytes32_$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32,uint8,bytes32,bytes32) pure returns (address)" + } + }, + "id": 3991, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8467:24:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8450:41:15" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 3998, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3993, + "name": "signer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3985, + "src": "8505:6:15", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 3996, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8523:1:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 3995, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8515:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3994, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "8515:7:15", + "typeDescriptions": {} + } + }, + "id": 3997, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8515:10:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "8505:20:15", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4012, + "nodeType": "IfStatement", + "src": "8501:113:15", + "trueBody": { + "id": 4011, + "nodeType": "Block", + "src": "8527:87:15", + "statements": [ + { + "expression": { + "components": [ + { + "arguments": [ + { + "hexValue": "30", + "id": 4001, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8557:1:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 4000, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8549:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3999, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "8549:7:15", + "typeDescriptions": {} + } + }, + "id": 4002, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8549:10:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 4003, + "name": "RecoverError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3686, + "src": "8561:12:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_RecoverError_$3686_$", + "typeString": "type(enum ECDSA.RecoverError)" + } + }, + "id": 4004, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "8574:16:15", + "memberName": "InvalidSignature", + "nodeType": "MemberAccess", + "referencedDeclaration": 3683, + "src": "8561:29:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + { + "arguments": [ + { + "hexValue": "30", + "id": 4007, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8600:1:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 4006, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8592:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes32_$", + "typeString": "type(bytes32)" + }, + "typeName": { + "id": 4005, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "8592:7:15", + "typeDescriptions": {} + } + }, + "id": 4008, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8592:10:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 4009, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "8548:55:15", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "functionReturnParameters": 3966, + "id": 4010, + "nodeType": "Return", + "src": "8541:62:15" + } + ] + } + }, + { + "expression": { + "components": [ + { + "id": 4013, + "name": "signer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3985, + "src": "8632:6:15", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 4014, + "name": "RecoverError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3686, + "src": "8640:12:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_RecoverError_$3686_$", + "typeString": "type(enum ECDSA.RecoverError)" + } + }, + "id": 4015, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "8653:7:15", + "memberName": "NoError", + "nodeType": "MemberAccess", + "referencedDeclaration": 3682, + "src": "8640:20:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + { + "arguments": [ + { + "hexValue": "30", + "id": 4018, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8670:1:15", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 4017, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8662:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes32_$", + "typeString": "type(bytes32)" + }, + "typeName": { + "id": 4016, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "8662:7:15", + "typeDescriptions": {} + } + }, + "id": 4019, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8662:10:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 4020, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "8631:42:15", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "functionReturnParameters": 3966, + "id": 4021, + "nodeType": "Return", + "src": "8624:49:15" + } + ] + }, + "documentation": { + "id": 3949, + "nodeType": "StructuredDocumentation", + "src": "6999:125:15", + "text": " @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n `r` and `s` signature fields separately." + }, + "id": 4023, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryRecover", + "nameLocation": "7138:10:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3958, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3951, + "mutability": "mutable", + "name": "hash", + "nameLocation": "7166:4:15", + "nodeType": "VariableDeclaration", + "scope": 4023, + "src": "7158:12:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3950, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "7158:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3953, + "mutability": "mutable", + "name": "v", + "nameLocation": "7186:1:15", + "nodeType": "VariableDeclaration", + "scope": 4023, + "src": "7180:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 3952, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "7180:5:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3955, + "mutability": "mutable", + "name": "r", + "nameLocation": "7205:1:15", + "nodeType": "VariableDeclaration", + "scope": 4023, + "src": "7197:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3954, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "7197:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3957, + "mutability": "mutable", + "name": "s", + "nameLocation": "7224:1:15", + "nodeType": "VariableDeclaration", + "scope": 4023, + "src": "7216:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3956, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "7216:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "7148:83:15" + }, + "returnParameters": { + "id": 3966, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3960, + "mutability": "mutable", + "name": "recovered", + "nameLocation": "7263:9:15", + "nodeType": "VariableDeclaration", + "scope": 4023, + "src": "7255:17:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3959, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "7255:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3963, + "mutability": "mutable", + "name": "err", + "nameLocation": "7287:3:15", + "nodeType": "VariableDeclaration", + "scope": 4023, + "src": "7274:16:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "typeName": { + "id": 3962, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 3961, + "name": "RecoverError", + "nameLocations": [ + "7274:12:15" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3686, + "src": "7274:12:15" + }, + "referencedDeclaration": 3686, + "src": "7274:12:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3965, + "mutability": "mutable", + "name": "errArg", + "nameLocation": "7300:6:15", + "nodeType": "VariableDeclaration", + "scope": 4023, + "src": "7292:14:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3964, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "7292:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "7254:53:15" + }, + "scope": 4137, + "src": "7129:1551:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4058, + "nodeType": "Block", + "src": "8907:166:15", + "statements": [ + { + "assignments": [ + 4038, + 4041, + 4043 + ], + "declarations": [ + { + "constant": false, + "id": 4038, + "mutability": "mutable", + "name": "recovered", + "nameLocation": "8926:9:15", + "nodeType": "VariableDeclaration", + "scope": 4058, + "src": "8918:17:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 4037, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "8918:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4041, + "mutability": "mutable", + "name": "error", + "nameLocation": "8950:5:15", + "nodeType": "VariableDeclaration", + "scope": 4058, + "src": "8937:18:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "typeName": { + "id": 4040, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 4039, + "name": "RecoverError", + "nameLocations": [ + "8937:12:15" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3686, + "src": "8937:12:15" + }, + "referencedDeclaration": 3686, + "src": "8937:12:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4043, + "mutability": "mutable", + "name": "errorArg", + "nameLocation": "8965:8:15", + "nodeType": "VariableDeclaration", + "scope": 4058, + "src": "8957:16:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4042, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "8957:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 4050, + "initialValue": { + "arguments": [ + { + "id": 4045, + "name": "hash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4026, + "src": "8988:4:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 4046, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4028, + "src": "8994:1:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + { + "id": 4047, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4030, + "src": "8997:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 4048, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4032, + "src": "9000:1:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 4044, + "name": "tryRecover", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 3752, + 3915, + 4023 + ], + "referencedDeclaration": 4023, + "src": "8977:10:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_uint8_$_t_bytes32_$_t_bytes32_$returns$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "function (bytes32,uint8,bytes32,bytes32) pure returns (address,enum ECDSA.RecoverError,bytes32)" + } + }, + "id": 4049, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8977:25:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_address_$_t_enum$_RecoverError_$3686_$_t_bytes32_$", + "typeString": "tuple(address,enum ECDSA.RecoverError,bytes32)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8917:85:15" + }, + { + "expression": { + "arguments": [ + { + "id": 4052, + "name": "error", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4041, + "src": "9024:5:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + { + "id": 4053, + "name": "errorArg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4043, + "src": "9031:8:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 4051, + "name": "_throwError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4136, + "src": "9012:11:15", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_RecoverError_$3686_$_t_bytes32_$returns$__$", + "typeString": "function (enum ECDSA.RecoverError,bytes32) pure" + } + }, + "id": 4054, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9012:28:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 4055, + "nodeType": "ExpressionStatement", + "src": "9012:28:15" + }, + { + "expression": { + "id": 4056, + "name": "recovered", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4038, + "src": "9057:9:15", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 4036, + "id": 4057, + "nodeType": "Return", + "src": "9050:16:15" + } + ] + }, + "documentation": { + "id": 4024, + "nodeType": "StructuredDocumentation", + "src": "8686:122:15", + "text": " @dev Overload of {ECDSA-recover} that receives the `v`,\n `r` and `s` signature fields separately." + }, + "id": 4059, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "recover", + "nameLocation": "8822:7:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4033, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4026, + "mutability": "mutable", + "name": "hash", + "nameLocation": "8838:4:15", + "nodeType": "VariableDeclaration", + "scope": 4059, + "src": "8830:12:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4025, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "8830:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4028, + "mutability": "mutable", + "name": "v", + "nameLocation": "8850:1:15", + "nodeType": "VariableDeclaration", + "scope": 4059, + "src": "8844:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 4027, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "8844:5:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4030, + "mutability": "mutable", + "name": "r", + "nameLocation": "8861:1:15", + "nodeType": "VariableDeclaration", + "scope": 4059, + "src": "8853:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4029, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "8853:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4032, + "mutability": "mutable", + "name": "s", + "nameLocation": "8872:1:15", + "nodeType": "VariableDeclaration", + "scope": 4059, + "src": "8864:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4031, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "8864:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "8829:45:15" + }, + "returnParameters": { + "id": 4036, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4035, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4059, + "src": "8898:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 4034, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "8898:7:15", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "8897:9:15" + }, + "scope": 4137, + "src": "8813:260:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4072, + "nodeType": "Block", + "src": "9659:793:15", + "statements": [ + { + "AST": { + "nativeSrc": "9694:752:15", + "nodeType": "YulBlock", + "src": "9694:752:15", + "statements": [ + { + "cases": [ + { + "body": { + "nativeSrc": "9847:171:15", + "nodeType": "YulBlock", + "src": "9847:171:15", + "statements": [ + { + "nativeSrc": "9865:32:15", + "nodeType": "YulAssignment", + "src": "9865:32:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "signature", + "nativeSrc": "9880:9:15", + "nodeType": "YulIdentifier", + "src": "9880:9:15" + }, + { + "kind": "number", + "nativeSrc": "9891:4:15", + "nodeType": "YulLiteral", + "src": "9891:4:15", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9876:3:15", + "nodeType": "YulIdentifier", + "src": "9876:3:15" + }, + "nativeSrc": "9876:20:15", + "nodeType": "YulFunctionCall", + "src": "9876:20:15" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "9870:5:15", + "nodeType": "YulIdentifier", + "src": "9870:5:15" + }, + "nativeSrc": "9870:27:15", + "nodeType": "YulFunctionCall", + "src": "9870:27:15" + }, + "variableNames": [ + { + "name": "r", + "nativeSrc": "9865:1:15", + "nodeType": "YulIdentifier", + "src": "9865:1:15" + } + ] + }, + { + "nativeSrc": "9914:32:15", + "nodeType": "YulAssignment", + "src": "9914:32:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "signature", + "nativeSrc": "9929:9:15", + "nodeType": "YulIdentifier", + "src": "9929:9:15" + }, + { + "kind": "number", + "nativeSrc": "9940:4:15", + "nodeType": "YulLiteral", + "src": "9940:4:15", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9925:3:15", + "nodeType": "YulIdentifier", + "src": "9925:3:15" + }, + "nativeSrc": "9925:20:15", + "nodeType": "YulFunctionCall", + "src": "9925:20:15" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "9919:5:15", + "nodeType": "YulIdentifier", + "src": "9919:5:15" + }, + "nativeSrc": "9919:27:15", + "nodeType": "YulFunctionCall", + "src": "9919:27:15" + }, + "variableNames": [ + { + "name": "s", + "nativeSrc": "9914:1:15", + "nodeType": "YulIdentifier", + "src": "9914:1:15" + } + ] + }, + { + "nativeSrc": "9963:41:15", + "nodeType": "YulAssignment", + "src": "9963:41:15", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9973:1:15", + "nodeType": "YulLiteral", + "src": "9973:1:15", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "signature", + "nativeSrc": "9986:9:15", + "nodeType": "YulIdentifier", + "src": "9986:9:15" + }, + { + "kind": "number", + "nativeSrc": "9997:4:15", + "nodeType": "YulLiteral", + "src": "9997:4:15", + "type": "", + "value": "0x60" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9982:3:15", + "nodeType": "YulIdentifier", + "src": "9982:3:15" + }, + "nativeSrc": "9982:20:15", + "nodeType": "YulFunctionCall", + "src": "9982:20:15" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "9976:5:15", + "nodeType": "YulIdentifier", + "src": "9976:5:15" + }, + "nativeSrc": "9976:27:15", + "nodeType": "YulFunctionCall", + "src": "9976:27:15" + } + ], + "functionName": { + "name": "byte", + "nativeSrc": "9968:4:15", + "nodeType": "YulIdentifier", + "src": "9968:4:15" + }, + "nativeSrc": "9968:36:15", + "nodeType": "YulFunctionCall", + "src": "9968:36:15" + }, + "variableNames": [ + { + "name": "v", + "nativeSrc": "9963:1:15", + "nodeType": "YulIdentifier", + "src": "9963:1:15" + } + ] + } + ] + }, + "nativeSrc": "9839:179:15", + "nodeType": "YulCase", + "src": "9839:179:15", + "value": { + "kind": "number", + "nativeSrc": "9844:2:15", + "nodeType": "YulLiteral", + "src": "9844:2:15", + "type": "", + "value": "65" + } + }, + { + "body": { + "nativeSrc": "10125:206:15", + "nodeType": "YulBlock", + "src": "10125:206:15", + "statements": [ + { + "nativeSrc": "10143:37:15", + "nodeType": "YulVariableDeclaration", + "src": "10143:37:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "signature", + "nativeSrc": "10163:9:15", + "nodeType": "YulIdentifier", + "src": "10163:9:15" + }, + { + "kind": "number", + "nativeSrc": "10174:4:15", + "nodeType": "YulLiteral", + "src": "10174:4:15", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10159:3:15", + "nodeType": "YulIdentifier", + "src": "10159:3:15" + }, + "nativeSrc": "10159:20:15", + "nodeType": "YulFunctionCall", + "src": "10159:20:15" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "10153:5:15", + "nodeType": "YulIdentifier", + "src": "10153:5:15" + }, + "nativeSrc": "10153:27:15", + "nodeType": "YulFunctionCall", + "src": "10153:27:15" + }, + "variables": [ + { + "name": "vs", + "nativeSrc": "10147:2:15", + "nodeType": "YulTypedName", + "src": "10147:2:15", + "type": "" + } + ] + }, + { + "nativeSrc": "10197:32:15", + "nodeType": "YulAssignment", + "src": "10197:32:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "signature", + "nativeSrc": "10212:9:15", + "nodeType": "YulIdentifier", + "src": "10212:9:15" + }, + { + "kind": "number", + "nativeSrc": "10223:4:15", + "nodeType": "YulLiteral", + "src": "10223:4:15", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10208:3:15", + "nodeType": "YulIdentifier", + "src": "10208:3:15" + }, + "nativeSrc": "10208:20:15", + "nodeType": "YulFunctionCall", + "src": "10208:20:15" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "10202:5:15", + "nodeType": "YulIdentifier", + "src": "10202:5:15" + }, + "nativeSrc": "10202:27:15", + "nodeType": "YulFunctionCall", + "src": "10202:27:15" + }, + "variableNames": [ + { + "name": "r", + "nativeSrc": "10197:1:15", + "nodeType": "YulIdentifier", + "src": "10197:1:15" + } + ] + }, + { + "nativeSrc": "10246:28:15", + "nodeType": "YulAssignment", + "src": "10246:28:15", + "value": { + "arguments": [ + { + "name": "vs", + "nativeSrc": "10255:2:15", + "nodeType": "YulIdentifier", + "src": "10255:2:15" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10263:1:15", + "nodeType": "YulLiteral", + "src": "10263:1:15", + "type": "", + "value": "1" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10270:1:15", + "nodeType": "YulLiteral", + "src": "10270:1:15", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "10266:3:15", + "nodeType": "YulIdentifier", + "src": "10266:3:15" + }, + "nativeSrc": "10266:6:15", + "nodeType": "YulFunctionCall", + "src": "10266:6:15" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "10259:3:15", + "nodeType": "YulIdentifier", + "src": "10259:3:15" + }, + "nativeSrc": "10259:14:15", + "nodeType": "YulFunctionCall", + "src": "10259:14:15" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "10251:3:15", + "nodeType": "YulIdentifier", + "src": "10251:3:15" + }, + "nativeSrc": "10251:23:15", + "nodeType": "YulFunctionCall", + "src": "10251:23:15" + }, + "variableNames": [ + { + "name": "s", + "nativeSrc": "10246:1:15", + "nodeType": "YulIdentifier", + "src": "10246:1:15" + } + ] + }, + { + "nativeSrc": "10291:26:15", + "nodeType": "YulAssignment", + "src": "10291:26:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10304:3:15", + "nodeType": "YulLiteral", + "src": "10304:3:15", + "type": "", + "value": "255" + }, + { + "name": "vs", + "nativeSrc": "10309:2:15", + "nodeType": "YulIdentifier", + "src": "10309:2:15" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "10300:3:15", + "nodeType": "YulIdentifier", + "src": "10300:3:15" + }, + "nativeSrc": "10300:12:15", + "nodeType": "YulFunctionCall", + "src": "10300:12:15" + }, + { + "kind": "number", + "nativeSrc": "10314:2:15", + "nodeType": "YulLiteral", + "src": "10314:2:15", + "type": "", + "value": "27" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10296:3:15", + "nodeType": "YulIdentifier", + "src": "10296:3:15" + }, + "nativeSrc": "10296:21:15", + "nodeType": "YulFunctionCall", + "src": "10296:21:15" + }, + "variableNames": [ + { + "name": "v", + "nativeSrc": "10291:1:15", + "nodeType": "YulIdentifier", + "src": "10291:1:15" + } + ] + } + ] + }, + "nativeSrc": "10117:214:15", + "nodeType": "YulCase", + "src": "10117:214:15", + "value": { + "kind": "number", + "nativeSrc": "10122:2:15", + "nodeType": "YulLiteral", + "src": "10122:2:15", + "type": "", + "value": "64" + } + }, + { + "body": { + "nativeSrc": "10352:84:15", + "nodeType": "YulBlock", + "src": "10352:84:15", + "statements": [ + { + "nativeSrc": "10370:6:15", + "nodeType": "YulAssignment", + "src": "10370:6:15", + "value": { + "kind": "number", + "nativeSrc": "10375:1:15", + "nodeType": "YulLiteral", + "src": "10375:1:15", + "type": "", + "value": "0" + }, + "variableNames": [ + { + "name": "r", + "nativeSrc": "10370:1:15", + "nodeType": "YulIdentifier", + "src": "10370:1:15" + } + ] + }, + { + "nativeSrc": "10393:6:15", + "nodeType": "YulAssignment", + "src": "10393:6:15", + "value": { + "kind": "number", + "nativeSrc": "10398:1:15", + "nodeType": "YulLiteral", + "src": "10398:1:15", + "type": "", + "value": "0" + }, + "variableNames": [ + { + "name": "s", + "nativeSrc": "10393:1:15", + "nodeType": "YulIdentifier", + "src": "10393:1:15" + } + ] + }, + { + "nativeSrc": "10416:6:15", + "nodeType": "YulAssignment", + "src": "10416:6:15", + "value": { + "kind": "number", + "nativeSrc": "10421:1:15", + "nodeType": "YulLiteral", + "src": "10421:1:15", + "type": "", + "value": "0" + }, + "variableNames": [ + { + "name": "v", + "nativeSrc": "10416:1:15", + "nodeType": "YulIdentifier", + "src": "10416:1:15" + } + ] + } + ] + }, + "nativeSrc": "10344:92:15", + "nodeType": "YulCase", + "src": "10344:92:15", + "value": "default" + } + ], + "expression": { + "arguments": [ + { + "name": "signature", + "nativeSrc": "9763:9:15", + "nodeType": "YulIdentifier", + "src": "9763:9:15" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "9757:5:15", + "nodeType": "YulIdentifier", + "src": "9757:5:15" + }, + "nativeSrc": "9757:16:15", + "nodeType": "YulFunctionCall", + "src": "9757:16:15" + }, + "nativeSrc": "9750:686:15", + "nodeType": "YulSwitch", + "src": "9750:686:15" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4067, + "isOffset": false, + "isSlot": false, + "src": "10197:1:15", + "valueSize": 1 + }, + { + "declaration": 4067, + "isOffset": false, + "isSlot": false, + "src": "10370:1:15", + "valueSize": 1 + }, + { + "declaration": 4067, + "isOffset": false, + "isSlot": false, + "src": "9865:1:15", + "valueSize": 1 + }, + { + "declaration": 4069, + "isOffset": false, + "isSlot": false, + "src": "10246:1:15", + "valueSize": 1 + }, + { + "declaration": 4069, + "isOffset": false, + "isSlot": false, + "src": "10393:1:15", + "valueSize": 1 + }, + { + "declaration": 4069, + "isOffset": false, + "isSlot": false, + "src": "9914:1:15", + "valueSize": 1 + }, + { + "declaration": 4062, + "isOffset": false, + "isSlot": false, + "src": "10163:9:15", + "valueSize": 1 + }, + { + "declaration": 4062, + "isOffset": false, + "isSlot": false, + "src": "10212:9:15", + "valueSize": 1 + }, + { + "declaration": 4062, + "isOffset": false, + "isSlot": false, + "src": "9763:9:15", + "valueSize": 1 + }, + { + "declaration": 4062, + "isOffset": false, + "isSlot": false, + "src": "9880:9:15", + "valueSize": 1 + }, + { + "declaration": 4062, + "isOffset": false, + "isSlot": false, + "src": "9929:9:15", + "valueSize": 1 + }, + { + "declaration": 4062, + "isOffset": false, + "isSlot": false, + "src": "9986:9:15", + "valueSize": 1 + }, + { + "declaration": 4065, + "isOffset": false, + "isSlot": false, + "src": "10291:1:15", + "valueSize": 1 + }, + { + "declaration": 4065, + "isOffset": false, + "isSlot": false, + "src": "10416:1:15", + "valueSize": 1 + }, + { + "declaration": 4065, + "isOffset": false, + "isSlot": false, + "src": "9963:1:15", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4071, + "nodeType": "InlineAssembly", + "src": "9669:777:15" + } + ] + }, + "documentation": { + "id": 4060, + "nodeType": "StructuredDocumentation", + "src": "9079:482:15", + "text": " @dev Parse a signature into its `v`, `r` and `s` components. Supports 65-byte and 64-byte (ERC-2098)\n formats. Returns (0,0,0) for invalid signatures.\n For 64-byte signatures, `v` is automatically normalized to 27 or 28.\n For 65-byte signatures, `v` is returned as-is and MUST already be 27 or 28 for use with ecrecover.\n Consider validating the result before use, or use {tryRecover}/{recover} which perform full validation." + }, + "id": 4073, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parse", + "nameLocation": "9575:5:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4063, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4062, + "mutability": "mutable", + "name": "signature", + "nameLocation": "9594:9:15", + "nodeType": "VariableDeclaration", + "scope": 4073, + "src": "9581:22:15", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 4061, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "9581:5:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "9580:24:15" + }, + "returnParameters": { + "id": 4070, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4065, + "mutability": "mutable", + "name": "v", + "nameLocation": "9634:1:15", + "nodeType": "VariableDeclaration", + "scope": 4073, + "src": "9628:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 4064, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "9628:5:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4067, + "mutability": "mutable", + "name": "r", + "nameLocation": "9645:1:15", + "nodeType": "VariableDeclaration", + "scope": 4073, + "src": "9637:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4066, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "9637:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4069, + "mutability": "mutable", + "name": "s", + "nameLocation": "9656:1:15", + "nodeType": "VariableDeclaration", + "scope": 4073, + "src": "9648:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4068, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "9648:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "9627:31:15" + }, + "scope": 4137, + "src": "9566:886:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4086, + "nodeType": "Block", + "src": "10643:841:15", + "statements": [ + { + "AST": { + "nativeSrc": "10678:800:15", + "nodeType": "YulBlock", + "src": "10678:800:15", + "statements": [ + { + "cases": [ + { + "body": { + "nativeSrc": "10831:202:15", + "nodeType": "YulBlock", + "src": "10831:202:15", + "statements": [ + { + "nativeSrc": "10849:35:15", + "nodeType": "YulAssignment", + "src": "10849:35:15", + "value": { + "arguments": [ + { + "name": "signature.offset", + "nativeSrc": "10867:16:15", + "nodeType": "YulIdentifier", + "src": "10867:16:15" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "10854:12:15", + "nodeType": "YulIdentifier", + "src": "10854:12:15" + }, + "nativeSrc": "10854:30:15", + "nodeType": "YulFunctionCall", + "src": "10854:30:15" + }, + "variableNames": [ + { + "name": "r", + "nativeSrc": "10849:1:15", + "nodeType": "YulIdentifier", + "src": "10849:1:15" + } + ] + }, + { + "nativeSrc": "10901:46:15", + "nodeType": "YulAssignment", + "src": "10901:46:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "signature.offset", + "nativeSrc": "10923:16:15", + "nodeType": "YulIdentifier", + "src": "10923:16:15" + }, + { + "kind": "number", + "nativeSrc": "10941:4:15", + "nodeType": "YulLiteral", + "src": "10941:4:15", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10919:3:15", + "nodeType": "YulIdentifier", + "src": "10919:3:15" + }, + "nativeSrc": "10919:27:15", + "nodeType": "YulFunctionCall", + "src": "10919:27:15" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "10906:12:15", + "nodeType": "YulIdentifier", + "src": "10906:12:15" + }, + "nativeSrc": "10906:41:15", + "nodeType": "YulFunctionCall", + "src": "10906:41:15" + }, + "variableNames": [ + { + "name": "s", + "nativeSrc": "10901:1:15", + "nodeType": "YulIdentifier", + "src": "10901:1:15" + } + ] + }, + { + "nativeSrc": "10964:55:15", + "nodeType": "YulAssignment", + "src": "10964:55:15", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10974:1:15", + "nodeType": "YulLiteral", + "src": "10974:1:15", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "signature.offset", + "nativeSrc": "10994:16:15", + "nodeType": "YulIdentifier", + "src": "10994:16:15" + }, + { + "kind": "number", + "nativeSrc": "11012:4:15", + "nodeType": "YulLiteral", + "src": "11012:4:15", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10990:3:15", + "nodeType": "YulIdentifier", + "src": "10990:3:15" + }, + "nativeSrc": "10990:27:15", + "nodeType": "YulFunctionCall", + "src": "10990:27:15" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "10977:12:15", + "nodeType": "YulIdentifier", + "src": "10977:12:15" + }, + "nativeSrc": "10977:41:15", + "nodeType": "YulFunctionCall", + "src": "10977:41:15" + } + ], + "functionName": { + "name": "byte", + "nativeSrc": "10969:4:15", + "nodeType": "YulIdentifier", + "src": "10969:4:15" + }, + "nativeSrc": "10969:50:15", + "nodeType": "YulFunctionCall", + "src": "10969:50:15" + }, + "variableNames": [ + { + "name": "v", + "nativeSrc": "10964:1:15", + "nodeType": "YulIdentifier", + "src": "10964:1:15" + } + ] + } + ] + }, + "nativeSrc": "10823:210:15", + "nodeType": "YulCase", + "src": "10823:210:15", + "value": { + "kind": "number", + "nativeSrc": "10828:2:15", + "nodeType": "YulLiteral", + "src": "10828:2:15", + "type": "", + "value": "65" + } + }, + { + "body": { + "nativeSrc": "11140:223:15", + "nodeType": "YulBlock", + "src": "11140:223:15", + "statements": [ + { + "nativeSrc": "11158:51:15", + "nodeType": "YulVariableDeclaration", + "src": "11158:51:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "signature.offset", + "nativeSrc": "11185:16:15", + "nodeType": "YulIdentifier", + "src": "11185:16:15" + }, + { + "kind": "number", + "nativeSrc": "11203:4:15", + "nodeType": "YulLiteral", + "src": "11203:4:15", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "11181:3:15", + "nodeType": "YulIdentifier", + "src": "11181:3:15" + }, + "nativeSrc": "11181:27:15", + "nodeType": "YulFunctionCall", + "src": "11181:27:15" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "11168:12:15", + "nodeType": "YulIdentifier", + "src": "11168:12:15" + }, + "nativeSrc": "11168:41:15", + "nodeType": "YulFunctionCall", + "src": "11168:41:15" + }, + "variables": [ + { + "name": "vs", + "nativeSrc": "11162:2:15", + "nodeType": "YulTypedName", + "src": "11162:2:15", + "type": "" + } + ] + }, + { + "nativeSrc": "11226:35:15", + "nodeType": "YulAssignment", + "src": "11226:35:15", + "value": { + "arguments": [ + { + "name": "signature.offset", + "nativeSrc": "11244:16:15", + "nodeType": "YulIdentifier", + "src": "11244:16:15" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "11231:12:15", + "nodeType": "YulIdentifier", + "src": "11231:12:15" + }, + "nativeSrc": "11231:30:15", + "nodeType": "YulFunctionCall", + "src": "11231:30:15" + }, + "variableNames": [ + { + "name": "r", + "nativeSrc": "11226:1:15", + "nodeType": "YulIdentifier", + "src": "11226:1:15" + } + ] + }, + { + "nativeSrc": "11278:28:15", + "nodeType": "YulAssignment", + "src": "11278:28:15", + "value": { + "arguments": [ + { + "name": "vs", + "nativeSrc": "11287:2:15", + "nodeType": "YulIdentifier", + "src": "11287:2:15" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11295:1:15", + "nodeType": "YulLiteral", + "src": "11295:1:15", + "type": "", + "value": "1" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11302:1:15", + "nodeType": "YulLiteral", + "src": "11302:1:15", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "11298:3:15", + "nodeType": "YulIdentifier", + "src": "11298:3:15" + }, + "nativeSrc": "11298:6:15", + "nodeType": "YulFunctionCall", + "src": "11298:6:15" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "11291:3:15", + "nodeType": "YulIdentifier", + "src": "11291:3:15" + }, + "nativeSrc": "11291:14:15", + "nodeType": "YulFunctionCall", + "src": "11291:14:15" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "11283:3:15", + "nodeType": "YulIdentifier", + "src": "11283:3:15" + }, + "nativeSrc": "11283:23:15", + "nodeType": "YulFunctionCall", + "src": "11283:23:15" + }, + "variableNames": [ + { + "name": "s", + "nativeSrc": "11278:1:15", + "nodeType": "YulIdentifier", + "src": "11278:1:15" + } + ] + }, + { + "nativeSrc": "11323:26:15", + "nodeType": "YulAssignment", + "src": "11323:26:15", + "value": { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11336:3:15", + "nodeType": "YulLiteral", + "src": "11336:3:15", + "type": "", + "value": "255" + }, + { + "name": "vs", + "nativeSrc": "11341:2:15", + "nodeType": "YulIdentifier", + "src": "11341:2:15" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "11332:3:15", + "nodeType": "YulIdentifier", + "src": "11332:3:15" + }, + "nativeSrc": "11332:12:15", + "nodeType": "YulFunctionCall", + "src": "11332:12:15" + }, + { + "kind": "number", + "nativeSrc": "11346:2:15", + "nodeType": "YulLiteral", + "src": "11346:2:15", + "type": "", + "value": "27" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "11328:3:15", + "nodeType": "YulIdentifier", + "src": "11328:3:15" + }, + "nativeSrc": "11328:21:15", + "nodeType": "YulFunctionCall", + "src": "11328:21:15" + }, + "variableNames": [ + { + "name": "v", + "nativeSrc": "11323:1:15", + "nodeType": "YulIdentifier", + "src": "11323:1:15" + } + ] + } + ] + }, + "nativeSrc": "11132:231:15", + "nodeType": "YulCase", + "src": "11132:231:15", + "value": { + "kind": "number", + "nativeSrc": "11137:2:15", + "nodeType": "YulLiteral", + "src": "11137:2:15", + "type": "", + "value": "64" + } + }, + { + "body": { + "nativeSrc": "11384:84:15", + "nodeType": "YulBlock", + "src": "11384:84:15", + "statements": [ + { + "nativeSrc": "11402:6:15", + "nodeType": "YulAssignment", + "src": "11402:6:15", + "value": { + "kind": "number", + "nativeSrc": "11407:1:15", + "nodeType": "YulLiteral", + "src": "11407:1:15", + "type": "", + "value": "0" + }, + "variableNames": [ + { + "name": "r", + "nativeSrc": "11402:1:15", + "nodeType": "YulIdentifier", + "src": "11402:1:15" + } + ] + }, + { + "nativeSrc": "11425:6:15", + "nodeType": "YulAssignment", + "src": "11425:6:15", + "value": { + "kind": "number", + "nativeSrc": "11430:1:15", + "nodeType": "YulLiteral", + "src": "11430:1:15", + "type": "", + "value": "0" + }, + "variableNames": [ + { + "name": "s", + "nativeSrc": "11425:1:15", + "nodeType": "YulIdentifier", + "src": "11425:1:15" + } + ] + }, + { + "nativeSrc": "11448:6:15", + "nodeType": "YulAssignment", + "src": "11448:6:15", + "value": { + "kind": "number", + "nativeSrc": "11453:1:15", + "nodeType": "YulLiteral", + "src": "11453:1:15", + "type": "", + "value": "0" + }, + "variableNames": [ + { + "name": "v", + "nativeSrc": "11448:1:15", + "nodeType": "YulIdentifier", + "src": "11448:1:15" + } + ] + } + ] + }, + "nativeSrc": "11376:92:15", + "nodeType": "YulCase", + "src": "11376:92:15", + "value": "default" + } + ], + "expression": { + "name": "signature.length", + "nativeSrc": "10741:16:15", + "nodeType": "YulIdentifier", + "src": "10741:16:15" + }, + "nativeSrc": "10734:734:15", + "nodeType": "YulSwitch", + "src": "10734:734:15" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4081, + "isOffset": false, + "isSlot": false, + "src": "10849:1:15", + "valueSize": 1 + }, + { + "declaration": 4081, + "isOffset": false, + "isSlot": false, + "src": "11226:1:15", + "valueSize": 1 + }, + { + "declaration": 4081, + "isOffset": false, + "isSlot": false, + "src": "11402:1:15", + "valueSize": 1 + }, + { + "declaration": 4083, + "isOffset": false, + "isSlot": false, + "src": "10901:1:15", + "valueSize": 1 + }, + { + "declaration": 4083, + "isOffset": false, + "isSlot": false, + "src": "11278:1:15", + "valueSize": 1 + }, + { + "declaration": 4083, + "isOffset": false, + "isSlot": false, + "src": "11425:1:15", + "valueSize": 1 + }, + { + "declaration": 4076, + "isOffset": false, + "isSlot": false, + "src": "10741:16:15", + "suffix": "length", + "valueSize": 1 + }, + { + "declaration": 4076, + "isOffset": true, + "isSlot": false, + "src": "10867:16:15", + "suffix": "offset", + "valueSize": 1 + }, + { + "declaration": 4076, + "isOffset": true, + "isSlot": false, + "src": "10923:16:15", + "suffix": "offset", + "valueSize": 1 + }, + { + "declaration": 4076, + "isOffset": true, + "isSlot": false, + "src": "10994:16:15", + "suffix": "offset", + "valueSize": 1 + }, + { + "declaration": 4076, + "isOffset": true, + "isSlot": false, + "src": "11185:16:15", + "suffix": "offset", + "valueSize": 1 + }, + { + "declaration": 4076, + "isOffset": true, + "isSlot": false, + "src": "11244:16:15", + "suffix": "offset", + "valueSize": 1 + }, + { + "declaration": 4079, + "isOffset": false, + "isSlot": false, + "src": "10964:1:15", + "valueSize": 1 + }, + { + "declaration": 4079, + "isOffset": false, + "isSlot": false, + "src": "11323:1:15", + "valueSize": 1 + }, + { + "declaration": 4079, + "isOffset": false, + "isSlot": false, + "src": "11448:1:15", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4085, + "nodeType": "InlineAssembly", + "src": "10653:825:15" + } + ] + }, + "documentation": { + "id": 4074, + "nodeType": "StructuredDocumentation", + "src": "10458:77:15", + "text": " @dev Variant of {parse} that takes a signature in calldata" + }, + "id": 4087, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "parseCalldata", + "nameLocation": "10549:13:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4077, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4076, + "mutability": "mutable", + "name": "signature", + "nameLocation": "10578:9:15", + "nodeType": "VariableDeclaration", + "scope": 4087, + "src": "10563:24:15", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 4075, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "10563:5:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "10562:26:15" + }, + "returnParameters": { + "id": 4084, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4079, + "mutability": "mutable", + "name": "v", + "nameLocation": "10618:1:15", + "nodeType": "VariableDeclaration", + "scope": 4087, + "src": "10612:7:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 4078, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "10612:5:15", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4081, + "mutability": "mutable", + "name": "r", + "nameLocation": "10629:1:15", + "nodeType": "VariableDeclaration", + "scope": 4087, + "src": "10621:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4080, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "10621:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4083, + "mutability": "mutable", + "name": "s", + "nameLocation": "10640:1:15", + "nodeType": "VariableDeclaration", + "scope": 4087, + "src": "10632:9:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4082, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "10632:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "10611:31:15" + }, + "scope": 4137, + "src": "10540:944:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4135, + "nodeType": "Block", + "src": "11689:460:15", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "id": 4099, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4096, + "name": "error", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4091, + "src": "11703:5:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "expression": { + "id": 4097, + "name": "RecoverError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3686, + "src": "11712:12:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_RecoverError_$3686_$", + "typeString": "type(enum ECDSA.RecoverError)" + } + }, + "id": 4098, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "11725:7:15", + "memberName": "NoError", + "nodeType": "MemberAccess", + "referencedDeclaration": 3682, + "src": "11712:20:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "src": "11703:29:15", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "id": 4105, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4102, + "name": "error", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4091, + "src": "11799:5:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "expression": { + "id": 4103, + "name": "RecoverError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3686, + "src": "11808:12:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_RecoverError_$3686_$", + "typeString": "type(enum ECDSA.RecoverError)" + } + }, + "id": 4104, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "11821:16:15", + "memberName": "InvalidSignature", + "nodeType": "MemberAccess", + "referencedDeclaration": 3683, + "src": "11808:29:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "src": "11799:38:15", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "id": 4113, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4110, + "name": "error", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4091, + "src": "11904:5:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "expression": { + "id": 4111, + "name": "RecoverError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3686, + "src": "11913:12:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_RecoverError_$3686_$", + "typeString": "type(enum ECDSA.RecoverError)" + } + }, + "id": 4112, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "11926:22:15", + "memberName": "InvalidSignatureLength", + "nodeType": "MemberAccess", + "referencedDeclaration": 3684, + "src": "11913:35:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "src": "11904:44:15", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "condition": { + "commonType": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "id": 4125, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4122, + "name": "error", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4091, + "src": "12038:5:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "expression": { + "id": 4123, + "name": "RecoverError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3686, + "src": "12047:12:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_enum$_RecoverError_$3686_$", + "typeString": "type(enum ECDSA.RecoverError)" + } + }, + "id": 4124, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "12060:17:15", + "memberName": "InvalidSignatureS", + "nodeType": "MemberAccess", + "referencedDeclaration": 3685, + "src": "12047:30:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "src": "12038:39:15", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4131, + "nodeType": "IfStatement", + "src": "12034:109:15", + "trueBody": { + "id": 4130, + "nodeType": "Block", + "src": "12079:64:15", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "id": 4127, + "name": "errorArg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4093, + "src": "12123:8:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 4126, + "name": "ECDSAInvalidSignatureS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3699, + "src": "12100:22:15", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_bytes32_$returns$_t_error_$", + "typeString": "function (bytes32) pure returns (error)" + } + }, + "id": 4128, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12100:32:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 4129, + "nodeType": "RevertStatement", + "src": "12093:39:15" + } + ] + } + }, + "id": 4132, + "nodeType": "IfStatement", + "src": "11900:243:15", + "trueBody": { + "id": 4121, + "nodeType": "Block", + "src": "11950:78:15", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "arguments": [ + { + "id": 4117, + "name": "errorArg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4093, + "src": "12007:8:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 4116, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "11999:7:15", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 4115, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11999:7:15", + "typeDescriptions": {} + } + }, + "id": 4118, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11999:17:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4114, + "name": "ECDSAInvalidSignatureLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3694, + "src": "11971:27:15", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint256) pure returns (error)" + } + }, + "id": 4119, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11971:46:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 4120, + "nodeType": "RevertStatement", + "src": "11964:53:15" + } + ] + } + }, + "id": 4133, + "nodeType": "IfStatement", + "src": "11795:348:15", + "trueBody": { + "id": 4109, + "nodeType": "Block", + "src": "11839:55:15", + "statements": [ + { + "errorCall": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 4106, + "name": "ECDSAInvalidSignature", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3689, + "src": "11860:21:15", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$__$returns$_t_error_$", + "typeString": "function () pure returns (error)" + } + }, + "id": 4107, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11860:23:15", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 4108, + "nodeType": "RevertStatement", + "src": "11853:30:15" + } + ] + } + }, + "id": 4134, + "nodeType": "IfStatement", + "src": "11699:444:15", + "trueBody": { + "id": 4101, + "nodeType": "Block", + "src": "11734:55:15", + "statements": [ + { + "functionReturnParameters": 4095, + "id": 4100, + "nodeType": "Return", + "src": "11748:7:15" + } + ] + } + } + ] + }, + "documentation": { + "id": 4088, + "nodeType": "StructuredDocumentation", + "src": "11490:122:15", + "text": " @dev Optionally reverts with the corresponding custom error according to the `error` argument provided." + }, + "id": 4136, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_throwError", + "nameLocation": "11626:11:15", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4094, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4091, + "mutability": "mutable", + "name": "error", + "nameLocation": "11651:5:15", + "nodeType": "VariableDeclaration", + "scope": 4136, + "src": "11638:18:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + }, + "typeName": { + "id": 4090, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 4089, + "name": "RecoverError", + "nameLocations": [ + "11638:12:15" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 3686, + "src": "11638:12:15" + }, + "referencedDeclaration": 3686, + "src": "11638:12:15", + "typeDescriptions": { + "typeIdentifier": "t_enum$_RecoverError_$3686", + "typeString": "enum ECDSA.RecoverError" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4093, + "mutability": "mutable", + "name": "errorArg", + "nameLocation": "11666:8:15", + "nodeType": "VariableDeclaration", + "scope": 4136, + "src": "11658:16:15", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4092, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "11658:7:15", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "11637:38:15" + }, + "returnParameters": { + "id": 4095, + "nodeType": "ParameterList", + "parameters": [], + "src": "11689:0:15" + }, + "scope": 4137, + "src": "11617:532:15", + "stateMutability": "pure", + "virtual": false, + "visibility": "private" + } + ], + "scope": 4138, + "src": "344:11807:15", + "usedErrors": [ + 3689, + 3694, + 3699 + ], + "usedEvents": [] + } + ], + "src": "112:12040:15" + }, + "id": 15 + }, + "@openzeppelin/contracts/utils/cryptography/EIP712.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/cryptography/EIP712.sol", + "exportedSymbols": { + "EIP712": [ + 4364 + ], + "IERC5267": [ + 262 + ], + "MessageHashUtils": [ + 4535 + ], + "ShortString": [ + 1833 + ], + "ShortStrings": [ + 2044 + ] + }, + "id": 4365, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 4139, + "literals": [ + "solidity", + "^", + "0.8", + ".24" + ], + "nodeType": "PragmaDirective", + "src": "113:24:16" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol", + "file": "./MessageHashUtils.sol", + "id": 4141, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 4365, + "sourceUnit": 4536, + "src": "139:56:16", + "symbolAliases": [ + { + "foreign": { + "id": 4140, + "name": "MessageHashUtils", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4535, + "src": "147:16:16", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/ShortStrings.sol", + "file": "../ShortStrings.sol", + "id": 4144, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 4365, + "sourceUnit": 2045, + "src": "196:62:16", + "symbolAliases": [ + { + "foreign": { + "id": 4142, + "name": "ShortStrings", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2044, + "src": "204:12:16", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + }, + { + "foreign": { + "id": 4143, + "name": "ShortString", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1833, + "src": "218:11:16", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/interfaces/IERC5267.sol", + "file": "../../interfaces/IERC5267.sol", + "id": 4146, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 4365, + "sourceUnit": 263, + "src": "259:55:16", + "symbolAliases": [ + { + "foreign": { + "id": 4145, + "name": "IERC5267", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 262, + "src": "267:8:16", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": true, + "baseContracts": [ + { + "baseName": { + "id": 4148, + "name": "IERC5267", + "nameLocations": [ + "1988:8:16" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 262, + "src": "1988:8:16" + }, + "id": 4149, + "nodeType": "InheritanceSpecifier", + "src": "1988:8:16" + } + ], + "canonicalName": "EIP712", + "contractDependencies": [], + "contractKind": "contract", + "documentation": { + "id": 4147, + "nodeType": "StructuredDocumentation", + "src": "316:1643:16", + "text": " @dev https://eips.ethereum.org/EIPS/eip-712[EIP-712] is a standard for hashing and signing of typed structured data.\n The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose\n encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract\n does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to\n produce the hash of their typed data using a combination of `abi.encode` and `keccak256`.\n This contract implements the EIP-712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n ({_hashTypedDataV4}).\n The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n the chain id to protect against replay attacks on an eventual fork of the chain.\n NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\n separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the\n separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\n @custom:oz-upgrades-unsafe-allow state-variable-immutable" + }, + "fullyImplemented": true, + "id": 4364, + "linearizedBaseContracts": [ + 4364, + 262 + ], + "name": "EIP712", + "nameLocation": "1978:6:16", + "nodeType": "ContractDefinition", + "nodes": [ + { + "global": false, + "id": 4151, + "libraryName": { + "id": 4150, + "name": "ShortStrings", + "nameLocations": [ + "2009:12:16" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 2044, + "src": "2009:12:16" + }, + "nodeType": "UsingForDirective", + "src": "2003:25:16" + }, + { + "constant": true, + "id": 4156, + "mutability": "constant", + "name": "TYPE_HASH", + "nameLocation": "2059:9:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2034:140:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4152, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2034:7:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": { + "arguments": [ + { + "hexValue": "454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429", + "id": 4154, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2089:84:16", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f", + "typeString": "literal_string \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"" + }, + "value": "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f", + "typeString": "literal_string \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"" + } + ], + "id": 4153, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "2079:9:16", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 4155, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2079:95:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "private" + }, + { + "constant": false, + "id": 4158, + "mutability": "immutable", + "name": "_cachedDomainSeparator", + "nameLocation": "2399:22:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2373:48:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4157, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2373:7:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "private" + }, + { + "constant": false, + "id": 4160, + "mutability": "immutable", + "name": "_cachedChainId", + "nameLocation": "2453:14:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2427:40:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4159, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2427:7:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "private" + }, + { + "constant": false, + "id": 4162, + "mutability": "immutable", + "name": "_cachedThis", + "nameLocation": "2499:11:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2473:37:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 4161, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2473:7:16", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "private" + }, + { + "constant": false, + "id": 4164, + "mutability": "immutable", + "name": "_hashedName", + "nameLocation": "2543:11:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2517:37:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4163, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2517:7:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "private" + }, + { + "constant": false, + "id": 4166, + "mutability": "immutable", + "name": "_hashedVersion", + "nameLocation": "2586:14:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2560:40:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4165, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2560:7:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "private" + }, + { + "constant": false, + "id": 4169, + "mutability": "immutable", + "name": "_name", + "nameLocation": "2637:5:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2607:35:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + }, + "typeName": { + "id": 4168, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 4167, + "name": "ShortString", + "nameLocations": [ + "2607:11:16" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1833, + "src": "2607:11:16" + }, + "referencedDeclaration": 1833, + "src": "2607:11:16", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "visibility": "private" + }, + { + "constant": false, + "id": 4172, + "mutability": "immutable", + "name": "_version", + "nameLocation": "2678:8:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2648:38:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + }, + "typeName": { + "id": 4171, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 4170, + "name": "ShortString", + "nameLocations": [ + "2648:11:16" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1833, + "src": "2648:11:16" + }, + "referencedDeclaration": 1833, + "src": "2648:11:16", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "visibility": "private" + }, + { + "constant": false, + "id": 4174, + "mutability": "mutable", + "name": "_nameFallback", + "nameLocation": "2757:13:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2742:28:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string" + }, + "typeName": { + "id": 4173, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2742:6:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "private" + }, + { + "constant": false, + "id": 4176, + "mutability": "mutable", + "name": "_versionFallback", + "nameLocation": "2841:16:16", + "nodeType": "VariableDeclaration", + "scope": 4364, + "src": "2826:31:16", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string" + }, + "typeName": { + "id": 4175, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "2826:6:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "private" + }, + { + "body": { + "id": 4233, + "nodeType": "Block", + "src": "3483:376:16", + "statements": [ + { + "expression": { + "id": 4189, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4184, + "name": "_name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4169, + "src": "3493:5:16", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 4187, + "name": "_nameFallback", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4174, + "src": "3532:13:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + ], + "expression": { + "id": 4185, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4179, + "src": "3501:4:16", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "id": 4186, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3506:25:16", + "memberName": "toShortStringWithFallback", + "nodeType": "MemberAccess", + "referencedDeclaration": 1985, + "src": "3501:30:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_string_memory_ptr_$_t_string_storage_ptr_$returns$_t_userDefinedValueType$_ShortString_$1833_$attached_to$_t_string_memory_ptr_$", + "typeString": "function (string memory,string storage pointer) returns (ShortString)" + } + }, + "id": 4188, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3501:45:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "src": "3493:53:16", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "id": 4190, + "nodeType": "ExpressionStatement", + "src": "3493:53:16" + }, + { + "expression": { + "id": 4196, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4191, + "name": "_version", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4172, + "src": "3556:8:16", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 4194, + "name": "_versionFallback", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4176, + "src": "3601:16:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + ], + "expression": { + "id": 4192, + "name": "version", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4181, + "src": "3567:7:16", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "id": 4193, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3575:25:16", + "memberName": "toShortStringWithFallback", + "nodeType": "MemberAccess", + "referencedDeclaration": 1985, + "src": "3567:33:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_string_memory_ptr_$_t_string_storage_ptr_$returns$_t_userDefinedValueType$_ShortString_$1833_$attached_to$_t_string_memory_ptr_$", + "typeString": "function (string memory,string storage pointer) returns (ShortString)" + } + }, + "id": 4195, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3567:51:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "src": "3556:62:16", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "id": 4197, + "nodeType": "ExpressionStatement", + "src": "3556:62:16" + }, + { + "expression": { + "id": 4205, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4198, + "name": "_hashedName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4164, + "src": "3628:11:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "arguments": [ + { + "id": 4202, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4179, + "src": "3658:4:16", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 4201, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3652:5:16", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 4200, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3652:5:16", + "typeDescriptions": {} + } + }, + "id": 4203, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3652:11:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 4199, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "3642:9:16", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 4204, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3642:22:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "3628:36:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 4206, + "nodeType": "ExpressionStatement", + "src": "3628:36:16" + }, + { + "expression": { + "id": 4214, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4207, + "name": "_hashedVersion", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4166, + "src": "3674:14:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "arguments": [ + { + "id": 4211, + "name": "version", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4181, + "src": "3707:7:16", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 4210, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3701:5:16", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 4209, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3701:5:16", + "typeDescriptions": {} + } + }, + "id": 4212, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3701:14:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 4208, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "3691:9:16", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 4213, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3691:25:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "3674:42:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 4215, + "nodeType": "ExpressionStatement", + "src": "3674:42:16" + }, + { + "expression": { + "id": 4219, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4216, + "name": "_cachedChainId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4160, + "src": "3727:14:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "expression": { + "id": 4217, + "name": "block", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -4, + "src": "3744:5:16", + "typeDescriptions": { + "typeIdentifier": "t_magic_block", + "typeString": "block" + } + }, + "id": 4218, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3750:7:16", + "memberName": "chainid", + "nodeType": "MemberAccess", + "src": "3744:13:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3727:30:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 4220, + "nodeType": "ExpressionStatement", + "src": "3727:30:16" + }, + { + "expression": { + "id": 4224, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4221, + "name": "_cachedDomainSeparator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4158, + "src": "3767:22:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 4222, + "name": "_buildDomainSeparator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4281, + "src": "3792:21:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_bytes32_$", + "typeString": "function () view returns (bytes32)" + } + }, + "id": 4223, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3792:23:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "3767:48:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 4225, + "nodeType": "ExpressionStatement", + "src": "3767:48:16" + }, + { + "expression": { + "id": 4231, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4226, + "name": "_cachedThis", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4162, + "src": "3825:11:16", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 4229, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "3847:4:16", + "typeDescriptions": { + "typeIdentifier": "t_contract$_EIP712_$4364", + "typeString": "contract EIP712" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_EIP712_$4364", + "typeString": "contract EIP712" + } + ], + "id": 4228, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3839:7:16", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 4227, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3839:7:16", + "typeDescriptions": {} + } + }, + "id": 4230, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3839:13:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "3825:27:16", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 4232, + "nodeType": "ExpressionStatement", + "src": "3825:27:16" + } + ] + }, + "documentation": { + "id": 4177, + "nodeType": "StructuredDocumentation", + "src": "2864:559:16", + "text": " @dev Initializes the domain separator and parameter caches.\n The meaning of `name` and `version` is specified in\n https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP-712]:\n - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n - `version`: the current major version of the signing domain.\n NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n contract upgrade]." + }, + "id": 4234, + "implemented": true, + "kind": "constructor", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4182, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4179, + "mutability": "mutable", + "name": "name", + "nameLocation": "3454:4:16", + "nodeType": "VariableDeclaration", + "scope": 4234, + "src": "3440:18:16", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 4178, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "3440:6:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4181, + "mutability": "mutable", + "name": "version", + "nameLocation": "3474:7:16", + "nodeType": "VariableDeclaration", + "scope": 4234, + "src": "3460:21:16", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 4180, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "3460:6:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "3439:43:16" + }, + "returnParameters": { + "id": 4183, + "nodeType": "ParameterList", + "parameters": [], + "src": "3483:0:16" + }, + "scope": 4364, + "src": "3428:431:16", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4259, + "nodeType": "Block", + "src": "4007:200:16", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 4250, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 4245, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 4242, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "4029:4:16", + "typeDescriptions": { + "typeIdentifier": "t_contract$_EIP712_$4364", + "typeString": "contract EIP712" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_EIP712_$4364", + "typeString": "contract EIP712" + } + ], + "id": 4241, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4021:7:16", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 4240, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "4021:7:16", + "typeDescriptions": {} + } + }, + "id": 4243, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4021:13:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 4244, + "name": "_cachedThis", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4162, + "src": "4038:11:16", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "4021:28:16", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4249, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 4246, + "name": "block", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -4, + "src": "4053:5:16", + "typeDescriptions": { + "typeIdentifier": "t_magic_block", + "typeString": "block" + } + }, + "id": 4247, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4059:7:16", + "memberName": "chainid", + "nodeType": "MemberAccess", + "src": "4053:13:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 4248, + "name": "_cachedChainId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4160, + "src": "4070:14:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4053:31:16", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "4021:63:16", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 4257, + "nodeType": "Block", + "src": "4146:55:16", + "statements": [ + { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 4254, + "name": "_buildDomainSeparator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4281, + "src": "4167:21:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_bytes32_$", + "typeString": "function () view returns (bytes32)" + } + }, + "id": 4255, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4167:23:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 4239, + "id": 4256, + "nodeType": "Return", + "src": "4160:30:16" + } + ] + }, + "id": 4258, + "nodeType": "IfStatement", + "src": "4017:184:16", + "trueBody": { + "id": 4253, + "nodeType": "Block", + "src": "4086:54:16", + "statements": [ + { + "expression": { + "id": 4251, + "name": "_cachedDomainSeparator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4158, + "src": "4107:22:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 4239, + "id": 4252, + "nodeType": "Return", + "src": "4100:29:16" + } + ] + } + } + ] + }, + "documentation": { + "id": 4235, + "nodeType": "StructuredDocumentation", + "src": "3865:75:16", + "text": " @dev Returns the domain separator for the current chain." + }, + "id": 4260, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_domainSeparatorV4", + "nameLocation": "3954:18:16", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4236, + "nodeType": "ParameterList", + "parameters": [], + "src": "3972:2:16" + }, + "returnParameters": { + "id": 4239, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4238, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4260, + "src": "3998:7:16", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4237, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3998:7:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "3997:9:16" + }, + "scope": 4364, + "src": "3945:262:16", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4280, + "nodeType": "Block", + "src": "4277:115:16", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "id": 4268, + "name": "TYPE_HASH", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4156, + "src": "4315:9:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 4269, + "name": "_hashedName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4164, + "src": "4326:11:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 4270, + "name": "_hashedVersion", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4166, + "src": "4339:14:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 4271, + "name": "block", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -4, + "src": "4355:5:16", + "typeDescriptions": { + "typeIdentifier": "t_magic_block", + "typeString": "block" + } + }, + "id": 4272, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4361:7:16", + "memberName": "chainid", + "nodeType": "MemberAccess", + "src": "4355:13:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [ + { + "id": 4275, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "4378:4:16", + "typeDescriptions": { + "typeIdentifier": "t_contract$_EIP712_$4364", + "typeString": "contract EIP712" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_EIP712_$4364", + "typeString": "contract EIP712" + } + ], + "id": 4274, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4370:7:16", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 4273, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "4370:7:16", + "typeDescriptions": {} + } + }, + "id": 4276, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4370:13:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "expression": { + "id": 4266, + "name": "abi", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -1, + "src": "4304:3:16", + "typeDescriptions": { + "typeIdentifier": "t_magic_abi", + "typeString": "abi" + } + }, + "id": 4267, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "4308:6:16", + "memberName": "encode", + "nodeType": "MemberAccess", + "src": "4304:10:16", + "typeDescriptions": { + "typeIdentifier": "t_function_abiencode_pure$__$returns$_t_bytes_memory_ptr_$", + "typeString": "function () pure returns (bytes memory)" + } + }, + "id": 4277, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4304:80:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 4265, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "4294:9:16", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 4278, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4294:91:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 4264, + "id": 4279, + "nodeType": "Return", + "src": "4287:98:16" + } + ] + }, + "id": 4281, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_buildDomainSeparator", + "nameLocation": "4222:21:16", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4261, + "nodeType": "ParameterList", + "parameters": [], + "src": "4243:2:16" + }, + "returnParameters": { + "id": 4264, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4263, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4281, + "src": "4268:7:16", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4262, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "4268:7:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "4267:9:16" + }, + "scope": 4364, + "src": "4213:179:16", + "stateMutability": "view", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 4296, + "nodeType": "Block", + "src": "5103:90:16", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 4291, + "name": "_domainSeparatorV4", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4260, + "src": "5153:18:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_bytes32_$", + "typeString": "function () view returns (bytes32)" + } + }, + "id": 4292, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5153:20:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 4293, + "name": "structHash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4284, + "src": "5175:10:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "id": 4289, + "name": "MessageHashUtils", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4535, + "src": "5120:16:16", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_MessageHashUtils_$4535_$", + "typeString": "type(library MessageHashUtils)" + } + }, + "id": 4290, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5137:15:16", + "memberName": "toTypedDataHash", + "nodeType": "MemberAccess", + "referencedDeclaration": 4451, + "src": "5120:32:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_bytes32_$returns$_t_bytes32_$", + "typeString": "function (bytes32,bytes32) pure returns (bytes32)" + } + }, + "id": 4294, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5120:66:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 4288, + "id": 4295, + "nodeType": "Return", + "src": "5113:73:16" + } + ] + }, + "documentation": { + "id": 4282, + "nodeType": "StructuredDocumentation", + "src": "4398:614:16", + "text": " @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n function returns the hash of the fully encoded EIP712 message for this domain.\n This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n ```solidity\n bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n keccak256(\"Mail(address to,string contents)\"),\n mailTo,\n keccak256(bytes(mailContents))\n )));\n address signer = ECDSA.recover(digest, signature);\n ```" + }, + "id": 4297, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_hashTypedDataV4", + "nameLocation": "5026:16:16", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4285, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4284, + "mutability": "mutable", + "name": "structHash", + "nameLocation": "5051:10:16", + "nodeType": "VariableDeclaration", + "scope": 4297, + "src": "5043:18:16", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4283, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5043:7:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "5042:20:16" + }, + "returnParameters": { + "id": 4288, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4287, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4297, + "src": "5094:7:16", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4286, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5094:7:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "5093:9:16" + }, + "scope": 4364, + "src": "5017:176:16", + "stateMutability": "view", + "virtual": true, + "visibility": "internal" + }, + { + "baseFunctions": [ + 261 + ], + "body": { + "id": 4338, + "nodeType": "Block", + "src": "5556:229:16", + "statements": [ + { + "expression": { + "components": [ + { + "hexValue": "0f", + "id": 4316, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "hexString", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5587:7:16", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_3d725c5ee53025f027da36bea8d3af3b6a3e9d2d1542d47c162631de48e66c1c", + "typeString": "literal_string hex\"0f\"" + }, + "value": "\u000f" + }, + { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 4317, + "name": "_EIP712Name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4351, + "src": "5617:11:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_string_memory_ptr_$", + "typeString": "function () view returns (string memory)" + } + }, + "id": 4318, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5617:13:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 4319, + "name": "_EIP712Version", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4363, + "src": "5644:14:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_string_memory_ptr_$", + "typeString": "function () view returns (string memory)" + } + }, + "id": 4320, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5644:16:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + { + "expression": { + "id": 4321, + "name": "block", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -4, + "src": "5674:5:16", + "typeDescriptions": { + "typeIdentifier": "t_magic_block", + "typeString": "block" + } + }, + "id": 4322, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5680:7:16", + "memberName": "chainid", + "nodeType": "MemberAccess", + "src": "5674:13:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [ + { + "id": 4325, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "5709:4:16", + "typeDescriptions": { + "typeIdentifier": "t_contract$_EIP712_$4364", + "typeString": "contract EIP712" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_EIP712_$4364", + "typeString": "contract EIP712" + } + ], + "id": 4324, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5701:7:16", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 4323, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5701:7:16", + "typeDescriptions": {} + } + }, + "id": 4326, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5701:13:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "arguments": [ + { + "hexValue": "30", + "id": 4329, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5736:1:16", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 4328, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5728:7:16", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes32_$", + "typeString": "type(bytes32)" + }, + "typeName": { + "id": 4327, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5728:7:16", + "typeDescriptions": {} + } + }, + "id": 4330, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5728:10:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "arguments": [ + { + "hexValue": "30", + "id": 4334, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5766:1:16", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 4333, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "5752:13:16", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_ptr_$", + "typeString": "function (uint256) pure returns (uint256[] memory)" + }, + "typeName": { + "baseType": { + "id": 4331, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5756:7:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 4332, + "nodeType": "ArrayTypeName", + "src": "5756:9:16", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + } + }, + "id": 4335, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5752:16:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + } + ], + "id": 4336, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "5573:205:16", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_stringliteral_3d725c5ee53025f027da36bea8d3af3b6a3e9d2d1542d47c162631de48e66c1c_$_t_string_memory_ptr_$_t_string_memory_ptr_$_t_uint256_$_t_address_$_t_bytes32_$_t_array$_t_uint256_$dyn_memory_ptr_$", + "typeString": "tuple(literal_string hex\"0f\",string memory,string memory,uint256,address,bytes32,uint256[] memory)" + } + }, + "functionReturnParameters": 4315, + "id": 4337, + "nodeType": "Return", + "src": "5566:212:16" + } + ] + }, + "documentation": { + "id": 4298, + "nodeType": "StructuredDocumentation", + "src": "5199:24:16", + "text": "@inheritdoc IERC5267" + }, + "functionSelector": "84b0196e", + "id": 4339, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "eip712Domain", + "nameLocation": "5237:12:16", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4299, + "nodeType": "ParameterList", + "parameters": [], + "src": "5249:2:16" + }, + "returnParameters": { + "id": 4315, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4301, + "mutability": "mutable", + "name": "fields", + "nameLocation": "5333:6:16", + "nodeType": "VariableDeclaration", + "scope": 4339, + "src": "5326:13:16", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 4300, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "5326:6:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4303, + "mutability": "mutable", + "name": "name", + "nameLocation": "5367:4:16", + "nodeType": "VariableDeclaration", + "scope": 4339, + "src": "5353:18:16", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 4302, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "5353:6:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4305, + "mutability": "mutable", + "name": "version", + "nameLocation": "5399:7:16", + "nodeType": "VariableDeclaration", + "scope": 4339, + "src": "5385:21:16", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 4304, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "5385:6:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4307, + "mutability": "mutable", + "name": "chainId", + "nameLocation": "5428:7:16", + "nodeType": "VariableDeclaration", + "scope": 4339, + "src": "5420:15:16", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4306, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5420:7:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4309, + "mutability": "mutable", + "name": "verifyingContract", + "nameLocation": "5457:17:16", + "nodeType": "VariableDeclaration", + "scope": 4339, + "src": "5449:25:16", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 4308, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5449:7:16", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4311, + "mutability": "mutable", + "name": "salt", + "nameLocation": "5496:4:16", + "nodeType": "VariableDeclaration", + "scope": 4339, + "src": "5488:12:16", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4310, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5488:7:16", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4314, + "mutability": "mutable", + "name": "extensions", + "nameLocation": "5531:10:16", + "nodeType": "VariableDeclaration", + "scope": 4339, + "src": "5514:27:16", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[]" + }, + "typeName": { + "baseType": { + "id": 4312, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5514:7:16", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 4313, + "nodeType": "ArrayTypeName", + "src": "5514:9:16", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "visibility": "internal" + } + ], + "src": "5312:239:16" + }, + "scope": 4364, + "src": "5228:557:16", + "stateMutability": "view", + "virtual": true, + "visibility": "public" + }, + { + "body": { + "id": 4350, + "nodeType": "Block", + "src": "6166:65:16", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 4347, + "name": "_nameFallback", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4174, + "src": "6210:13:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + ], + "expression": { + "id": 4345, + "name": "_name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4169, + "src": "6183:5:16", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "id": 4346, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6189:20:16", + "memberName": "toStringWithFallback", + "nodeType": "MemberAccess", + "referencedDeclaration": 2012, + "src": "6183:26:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_userDefinedValueType$_ShortString_$1833_$_t_string_storage_ptr_$returns$_t_string_memory_ptr_$attached_to$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "function (ShortString,string storage pointer) pure returns (string memory)" + } + }, + "id": 4348, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6183:41:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 4344, + "id": 4349, + "nodeType": "Return", + "src": "6176:48:16" + } + ] + }, + "documentation": { + "id": 4340, + "nodeType": "StructuredDocumentation", + "src": "5791:256:16", + "text": " @dev The name parameter for the EIP712 domain.\n NOTE: By default this function reads _name which is an immutable value.\n It only reads from storage if necessary (in case the value is too large to fit in a ShortString)." + }, + "id": 4351, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_EIP712Name", + "nameLocation": "6114:11:16", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4341, + "nodeType": "ParameterList", + "parameters": [], + "src": "6125:2:16" + }, + "returnParameters": { + "id": 4344, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4343, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4351, + "src": "6151:13:16", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 4342, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "6151:6:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "6150:15:16" + }, + "scope": 4364, + "src": "6105:126:16", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4362, + "nodeType": "Block", + "src": "6621:71:16", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 4359, + "name": "_versionFallback", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4176, + "src": "6668:16:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + ], + "expression": { + "id": 4357, + "name": "_version", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4172, + "src": "6638:8:16", + "typeDescriptions": { + "typeIdentifier": "t_userDefinedValueType$_ShortString_$1833", + "typeString": "ShortString" + } + }, + "id": 4358, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6647:20:16", + "memberName": "toStringWithFallback", + "nodeType": "MemberAccess", + "referencedDeclaration": 2012, + "src": "6638:29:16", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_userDefinedValueType$_ShortString_$1833_$_t_string_storage_ptr_$returns$_t_string_memory_ptr_$attached_to$_t_userDefinedValueType$_ShortString_$1833_$", + "typeString": "function (ShortString,string storage pointer) pure returns (string memory)" + } + }, + "id": 4360, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6638:47:16", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "functionReturnParameters": 4356, + "id": 4361, + "nodeType": "Return", + "src": "6631:54:16" + } + ] + }, + "documentation": { + "id": 4352, + "nodeType": "StructuredDocumentation", + "src": "6237:262:16", + "text": " @dev The version parameter for the EIP712 domain.\n NOTE: By default this function reads _version which is an immutable value.\n It only reads from storage if necessary (in case the value is too large to fit in a ShortString)." + }, + "id": 4363, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_EIP712Version", + "nameLocation": "6566:14:16", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4353, + "nodeType": "ParameterList", + "parameters": [], + "src": "6580:2:16" + }, + "returnParameters": { + "id": 4356, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4355, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4363, + "src": "6606:13:16", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 4354, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "6606:6:16", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "6605:15:16" + }, + "scope": 4364, + "src": "6557:135:16", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + } + ], + "scope": 4365, + "src": "1960:4734:16", + "usedErrors": [ + 1841, + 1843 + ], + "usedEvents": [ + 242 + ] + } + ], + "src": "113:6582:16" + }, + "id": 16 + }, + "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol", + "exportedSymbols": { + "MessageHashUtils": [ + 4535 + ], + "Strings": [ + 3678 + ] + }, + "id": 4536, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 4366, + "literals": [ + "solidity", + "^", + "0.8", + ".24" + ], + "nodeType": "PragmaDirective", + "src": "123:24:17" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/Strings.sol", + "file": "../Strings.sol", + "id": 4368, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 4536, + "sourceUnit": 3679, + "src": "149:39:17", + "symbolAliases": [ + { + "foreign": { + "id": 4367, + "name": "Strings", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3678, + "src": "157:7:17", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "MessageHashUtils", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 4369, + "nodeType": "StructuredDocumentation", + "src": "190:330:17", + "text": " @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.\n The library provides methods for generating a hash of a message that conforms to the\n https://eips.ethereum.org/EIPS/eip-191[ERC-191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]\n specifications." + }, + "fullyImplemented": true, + "id": 4535, + "linearizedBaseContracts": [ + 4535 + ], + "name": "MessageHashUtils", + "nameLocation": "529:16:17", + "nodeType": "ContractDefinition", + "nodes": [ + { + "errorSelector": "db00f904", + "id": 4371, + "name": "ERC5267ExtensionsNotSupported", + "nameLocation": "558:29:17", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 4370, + "nodeType": "ParameterList", + "parameters": [], + "src": "587:2:17" + }, + "src": "552:38:17" + }, + { + "body": { + "id": 4380, + "nodeType": "Block", + "src": "1383:341:17", + "statements": [ + { + "AST": { + "nativeSrc": "1418:300:17", + "nodeType": "YulBlock", + "src": "1418:300:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1439:4:17", + "nodeType": "YulLiteral", + "src": "1439:4:17", + "type": "", + "value": "0x00" + }, + { + "hexValue": "19457468657265756d205369676e6564204d6573736167653a0a3332", + "kind": "string", + "nativeSrc": "1445:34:17", + "nodeType": "YulLiteral", + "src": "1445:34:17", + "type": "", + "value": "\u0019Ethereum Signed Message:\n32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1432:6:17", + "nodeType": "YulIdentifier", + "src": "1432:6:17" + }, + "nativeSrc": "1432:48:17", + "nodeType": "YulFunctionCall", + "src": "1432:48:17" + }, + "nativeSrc": "1432:48:17", + "nodeType": "YulExpressionStatement", + "src": "1432:48:17" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1541:4:17", + "nodeType": "YulLiteral", + "src": "1541:4:17", + "type": "", + "value": "0x1c" + }, + { + "name": "messageHash", + "nativeSrc": "1547:11:17", + "nodeType": "YulIdentifier", + "src": "1547:11:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1534:6:17", + "nodeType": "YulIdentifier", + "src": "1534:6:17" + }, + "nativeSrc": "1534:25:17", + "nodeType": "YulFunctionCall", + "src": "1534:25:17" + }, + "nativeSrc": "1534:25:17", + "nodeType": "YulExpressionStatement", + "src": "1534:25:17" + }, + { + "nativeSrc": "1613:31:17", + "nodeType": "YulAssignment", + "src": "1613:31:17", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1633:4:17", + "nodeType": "YulLiteral", + "src": "1633:4:17", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "1639:4:17", + "nodeType": "YulLiteral", + "src": "1639:4:17", + "type": "", + "value": "0x3c" + } + ], + "functionName": { + "name": "keccak256", + "nativeSrc": "1623:9:17", + "nodeType": "YulIdentifier", + "src": "1623:9:17" + }, + "nativeSrc": "1623:21:17", + "nodeType": "YulFunctionCall", + "src": "1623:21:17" + }, + "variableNames": [ + { + "name": "digest", + "nativeSrc": "1613:6:17", + "nodeType": "YulIdentifier", + "src": "1613:6:17" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4377, + "isOffset": false, + "isSlot": false, + "src": "1613:6:17", + "valueSize": 1 + }, + { + "declaration": 4374, + "isOffset": false, + "isSlot": false, + "src": "1547:11:17", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4379, + "nodeType": "InlineAssembly", + "src": "1393:325:17" + } + ] + }, + "documentation": { + "id": 4372, + "nodeType": "StructuredDocumentation", + "src": "596:690:17", + "text": " @dev Returns the keccak256 digest of an ERC-191 signed data with version\n `0x45` (`personal_sign` messages).\n The digest is calculated by prefixing a bytes32 `messageHash` with\n `\"\\x19Ethereum Signed Message:\\n32\"` and hashing the result. It corresponds with the\n hash signed when using the https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sign[`eth_sign`] JSON-RPC method.\n NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with\n keccak256, although any bytes32 value can be safely used because the final digest will\n be re-hashed.\n See {ECDSA-recover}." + }, + "id": 4381, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toEthSignedMessageHash", + "nameLocation": "1300:22:17", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4375, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4374, + "mutability": "mutable", + "name": "messageHash", + "nameLocation": "1331:11:17", + "nodeType": "VariableDeclaration", + "scope": 4381, + "src": "1323:19:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4373, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1323:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "1322:21:17" + }, + "returnParameters": { + "id": 4378, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4377, + "mutability": "mutable", + "name": "digest", + "nameLocation": "1375:6:17", + "nodeType": "VariableDeclaration", + "scope": 4381, + "src": "1367:14:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4376, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1367:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "1366:16:17" + }, + "scope": 4535, + "src": "1291:433:17", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4406, + "nodeType": "Block", + "src": "2301:143:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "hexValue": "19457468657265756d205369676e6564204d6573736167653a0a", + "id": 4393, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2353:32:17", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_9af2d9c228f6cfddaa6d1e5b94e0bce4ab16bd9a472a2b7fbfd74ebff4c720b4", + "typeString": "literal_string hex\"19457468657265756d205369676e6564204d6573736167653a0a\"" + }, + "value": "\u0019Ethereum Signed Message:\n" + }, + { + "arguments": [ + { + "arguments": [ + { + "expression": { + "id": 4398, + "name": "message", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4384, + "src": "2410:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 4399, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2418:6:17", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "2410:14:17", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 4396, + "name": "Strings", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3678, + "src": "2393:7:17", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Strings_$3678_$", + "typeString": "type(library Strings)" + } + }, + "id": 4397, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2401:8:17", + "memberName": "toString", + "nodeType": "MemberAccess", + "referencedDeclaration": 2261, + "src": "2393:16:17", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_string_memory_ptr_$", + "typeString": "function (uint256) pure returns (string memory)" + } + }, + "id": 4400, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2393:32:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 4395, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2387:5:17", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 4394, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2387:5:17", + "typeDescriptions": {} + } + }, + "id": 4401, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2387:39:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 4402, + "name": "message", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4384, + "src": "2428:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_9af2d9c228f6cfddaa6d1e5b94e0bce4ab16bd9a472a2b7fbfd74ebff4c720b4", + "typeString": "literal_string hex\"19457468657265756d205369676e6564204d6573736167653a0a\"" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "id": 4391, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2340:5:17", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 4390, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2340:5:17", + "typeDescriptions": {} + } + }, + "id": 4392, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2346:6:17", + "memberName": "concat", + "nodeType": "MemberAccess", + "src": "2340:12:17", + "typeDescriptions": { + "typeIdentifier": "t_function_bytesconcat_pure$__$returns$_t_bytes_memory_ptr_$", + "typeString": "function () pure returns (bytes memory)" + } + }, + "id": 4403, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2340:96:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 4389, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "2330:9:17", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 4404, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2330:107:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 4388, + "id": 4405, + "nodeType": "Return", + "src": "2311:126:17" + } + ] + }, + "documentation": { + "id": 4382, + "nodeType": "StructuredDocumentation", + "src": "1730:480:17", + "text": " @dev Returns the keccak256 digest of an ERC-191 signed data with version\n `0x45` (`personal_sign` messages).\n The digest is calculated by prefixing an arbitrary `message` with\n `\"\\x19Ethereum Signed Message:\\n\" + len(message)` and hashing the result. It corresponds with the\n hash signed when using the https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sign[`eth_sign`] JSON-RPC method.\n See {ECDSA-recover}." + }, + "id": 4407, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toEthSignedMessageHash", + "nameLocation": "2224:22:17", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4385, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4384, + "mutability": "mutable", + "name": "message", + "nameLocation": "2260:7:17", + "nodeType": "VariableDeclaration", + "scope": 4407, + "src": "2247:20:17", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 4383, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2247:5:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "2246:22:17" + }, + "returnParameters": { + "id": 4388, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4387, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4407, + "src": "2292:7:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4386, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2292:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "2291:9:17" + }, + "scope": 4535, + "src": "2215:229:17", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4426, + "nodeType": "Block", + "src": "2898:80:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "hexValue": "1900", + "id": 4420, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "hexString", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2942:10:17", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_73fd5d154550a4a103564cb191928cd38898034de1b952dc21b290898b4b697a", + "typeString": "literal_string hex\"1900\"" + }, + "value": "\u0019\u0000" + }, + { + "id": 4421, + "name": "validator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4410, + "src": "2954:9:17", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 4422, + "name": "data", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4412, + "src": "2965:4:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_73fd5d154550a4a103564cb191928cd38898034de1b952dc21b290898b4b697a", + "typeString": "literal_string hex\"1900\"" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "id": 4418, + "name": "abi", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -1, + "src": "2925:3:17", + "typeDescriptions": { + "typeIdentifier": "t_magic_abi", + "typeString": "abi" + } + }, + "id": 4419, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "2929:12:17", + "memberName": "encodePacked", + "nodeType": "MemberAccess", + "src": "2925:16:17", + "typeDescriptions": { + "typeIdentifier": "t_function_abiencodepacked_pure$__$returns$_t_bytes_memory_ptr_$", + "typeString": "function () pure returns (bytes memory)" + } + }, + "id": 4423, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2925:45:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 4417, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "2915:9:17", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 4424, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2915:56:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 4416, + "id": 4425, + "nodeType": "Return", + "src": "2908:63:17" + } + ] + }, + "documentation": { + "id": 4408, + "nodeType": "StructuredDocumentation", + "src": "2450:332:17", + "text": " @dev Returns the keccak256 digest of an ERC-191 signed data with version\n `0x00` (data with intended validator).\n The digest is calculated by prefixing an arbitrary `data` with `\"\\x19\\x00\"` and the intended\n `validator` address. Then hashing the result.\n See {ECDSA-recover}." + }, + "id": 4427, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toDataWithIntendedValidatorHash", + "nameLocation": "2796:31:17", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4413, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4410, + "mutability": "mutable", + "name": "validator", + "nameLocation": "2836:9:17", + "nodeType": "VariableDeclaration", + "scope": 4427, + "src": "2828:17:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 4409, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2828:7:17", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4412, + "mutability": "mutable", + "name": "data", + "nameLocation": "2860:4:17", + "nodeType": "VariableDeclaration", + "scope": 4427, + "src": "2847:17:17", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 4411, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2847:5:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "2827:38:17" + }, + "returnParameters": { + "id": 4416, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4415, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4427, + "src": "2889:7:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4414, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2889:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "2888:9:17" + }, + "scope": 4535, + "src": "2787:191:17", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4438, + "nodeType": "Block", + "src": "3260:216:17", + "statements": [ + { + "AST": { + "nativeSrc": "3295:175:17", + "nodeType": "YulBlock", + "src": "3295:175:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3316:4:17", + "nodeType": "YulLiteral", + "src": "3316:4:17", + "type": "", + "value": "0x00" + }, + { + "hexValue": "1900", + "kind": "string", + "nativeSrc": "3322:10:17", + "nodeType": "YulLiteral", + "src": "3322:10:17", + "type": "", + "value": "\u0019\u0000" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3309:6:17", + "nodeType": "YulIdentifier", + "src": "3309:6:17" + }, + "nativeSrc": "3309:24:17", + "nodeType": "YulFunctionCall", + "src": "3309:24:17" + }, + "nativeSrc": "3309:24:17", + "nodeType": "YulExpressionStatement", + "src": "3309:24:17" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3353:4:17", + "nodeType": "YulLiteral", + "src": "3353:4:17", + "type": "", + "value": "0x02" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3363:2:17", + "nodeType": "YulLiteral", + "src": "3363:2:17", + "type": "", + "value": "96" + }, + { + "name": "validator", + "nativeSrc": "3367:9:17", + "nodeType": "YulIdentifier", + "src": "3367:9:17" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "3359:3:17", + "nodeType": "YulIdentifier", + "src": "3359:3:17" + }, + "nativeSrc": "3359:18:17", + "nodeType": "YulFunctionCall", + "src": "3359:18:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3346:6:17", + "nodeType": "YulIdentifier", + "src": "3346:6:17" + }, + "nativeSrc": "3346:32:17", + "nodeType": "YulFunctionCall", + "src": "3346:32:17" + }, + "nativeSrc": "3346:32:17", + "nodeType": "YulExpressionStatement", + "src": "3346:32:17" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3398:4:17", + "nodeType": "YulLiteral", + "src": "3398:4:17", + "type": "", + "value": "0x16" + }, + { + "name": "messageHash", + "nativeSrc": "3404:11:17", + "nodeType": "YulIdentifier", + "src": "3404:11:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3391:6:17", + "nodeType": "YulIdentifier", + "src": "3391:6:17" + }, + "nativeSrc": "3391:25:17", + "nodeType": "YulFunctionCall", + "src": "3391:25:17" + }, + "nativeSrc": "3391:25:17", + "nodeType": "YulExpressionStatement", + "src": "3391:25:17" + }, + { + "nativeSrc": "3429:31:17", + "nodeType": "YulAssignment", + "src": "3429:31:17", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3449:4:17", + "nodeType": "YulLiteral", + "src": "3449:4:17", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "3455:4:17", + "nodeType": "YulLiteral", + "src": "3455:4:17", + "type": "", + "value": "0x36" + } + ], + "functionName": { + "name": "keccak256", + "nativeSrc": "3439:9:17", + "nodeType": "YulIdentifier", + "src": "3439:9:17" + }, + "nativeSrc": "3439:21:17", + "nodeType": "YulFunctionCall", + "src": "3439:21:17" + }, + "variableNames": [ + { + "name": "digest", + "nativeSrc": "3429:6:17", + "nodeType": "YulIdentifier", + "src": "3429:6:17" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4435, + "isOffset": false, + "isSlot": false, + "src": "3429:6:17", + "valueSize": 1 + }, + { + "declaration": 4432, + "isOffset": false, + "isSlot": false, + "src": "3404:11:17", + "valueSize": 1 + }, + { + "declaration": 4430, + "isOffset": false, + "isSlot": false, + "src": "3367:9:17", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4437, + "nodeType": "InlineAssembly", + "src": "3270:200:17" + } + ] + }, + "documentation": { + "id": 4428, + "nodeType": "StructuredDocumentation", + "src": "2984:129:17", + "text": " @dev Variant of {toDataWithIntendedValidatorHash-address-bytes} optimized for cases where `data` is a bytes32." + }, + "id": 4439, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toDataWithIntendedValidatorHash", + "nameLocation": "3127:31:17", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4433, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4430, + "mutability": "mutable", + "name": "validator", + "nameLocation": "3176:9:17", + "nodeType": "VariableDeclaration", + "scope": 4439, + "src": "3168:17:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 4429, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3168:7:17", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4432, + "mutability": "mutable", + "name": "messageHash", + "nameLocation": "3203:11:17", + "nodeType": "VariableDeclaration", + "scope": 4439, + "src": "3195:19:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4431, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3195:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "3158:62:17" + }, + "returnParameters": { + "id": 4436, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4435, + "mutability": "mutable", + "name": "digest", + "nameLocation": "3252:6:17", + "nodeType": "VariableDeclaration", + "scope": 4439, + "src": "3244:14:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4434, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3244:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "3243:16:17" + }, + "scope": 4535, + "src": "3118:358:17", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4450, + "nodeType": "Block", + "src": "4027:265:17", + "statements": [ + { + "AST": { + "nativeSrc": "4062:224:17", + "nodeType": "YulBlock", + "src": "4062:224:17", + "statements": [ + { + "nativeSrc": "4076:22:17", + "nodeType": "YulVariableDeclaration", + "src": "4076:22:17", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "4093:4:17", + "nodeType": "YulLiteral", + "src": "4093:4:17", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "4087:5:17", + "nodeType": "YulIdentifier", + "src": "4087:5:17" + }, + "nativeSrc": "4087:11:17", + "nodeType": "YulFunctionCall", + "src": "4087:11:17" + }, + "variables": [ + { + "name": "ptr", + "nativeSrc": "4080:3:17", + "nodeType": "YulTypedName", + "src": "4080:3:17", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "4118:3:17", + "nodeType": "YulIdentifier", + "src": "4118:3:17" + }, + { + "hexValue": "1901", + "kind": "string", + "nativeSrc": "4123:10:17", + "nodeType": "YulLiteral", + "src": "4123:10:17", + "type": "", + "value": "\u0019\u0001" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4111:6:17", + "nodeType": "YulIdentifier", + "src": "4111:6:17" + }, + "nativeSrc": "4111:23:17", + "nodeType": "YulFunctionCall", + "src": "4111:23:17" + }, + "nativeSrc": "4111:23:17", + "nodeType": "YulExpressionStatement", + "src": "4111:23:17" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "4158:3:17", + "nodeType": "YulIdentifier", + "src": "4158:3:17" + }, + { + "kind": "number", + "nativeSrc": "4163:4:17", + "nodeType": "YulLiteral", + "src": "4163:4:17", + "type": "", + "value": "0x02" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4154:3:17", + "nodeType": "YulIdentifier", + "src": "4154:3:17" + }, + "nativeSrc": "4154:14:17", + "nodeType": "YulFunctionCall", + "src": "4154:14:17" + }, + { + "name": "domainSeparator", + "nativeSrc": "4170:15:17", + "nodeType": "YulIdentifier", + "src": "4170:15:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4147:6:17", + "nodeType": "YulIdentifier", + "src": "4147:6:17" + }, + "nativeSrc": "4147:39:17", + "nodeType": "YulFunctionCall", + "src": "4147:39:17" + }, + "nativeSrc": "4147:39:17", + "nodeType": "YulExpressionStatement", + "src": "4147:39:17" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "4210:3:17", + "nodeType": "YulIdentifier", + "src": "4210:3:17" + }, + { + "kind": "number", + "nativeSrc": "4215:4:17", + "nodeType": "YulLiteral", + "src": "4215:4:17", + "type": "", + "value": "0x22" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4206:3:17", + "nodeType": "YulIdentifier", + "src": "4206:3:17" + }, + "nativeSrc": "4206:14:17", + "nodeType": "YulFunctionCall", + "src": "4206:14:17" + }, + { + "name": "structHash", + "nativeSrc": "4222:10:17", + "nodeType": "YulIdentifier", + "src": "4222:10:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4199:6:17", + "nodeType": "YulIdentifier", + "src": "4199:6:17" + }, + "nativeSrc": "4199:34:17", + "nodeType": "YulFunctionCall", + "src": "4199:34:17" + }, + "nativeSrc": "4199:34:17", + "nodeType": "YulExpressionStatement", + "src": "4199:34:17" + }, + { + "nativeSrc": "4246:30:17", + "nodeType": "YulAssignment", + "src": "4246:30:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "4266:3:17", + "nodeType": "YulIdentifier", + "src": "4266:3:17" + }, + { + "kind": "number", + "nativeSrc": "4271:4:17", + "nodeType": "YulLiteral", + "src": "4271:4:17", + "type": "", + "value": "0x42" + } + ], + "functionName": { + "name": "keccak256", + "nativeSrc": "4256:9:17", + "nodeType": "YulIdentifier", + "src": "4256:9:17" + }, + "nativeSrc": "4256:20:17", + "nodeType": "YulFunctionCall", + "src": "4256:20:17" + }, + "variableNames": [ + { + "name": "digest", + "nativeSrc": "4246:6:17", + "nodeType": "YulIdentifier", + "src": "4246:6:17" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4447, + "isOffset": false, + "isSlot": false, + "src": "4246:6:17", + "valueSize": 1 + }, + { + "declaration": 4442, + "isOffset": false, + "isSlot": false, + "src": "4170:15:17", + "valueSize": 1 + }, + { + "declaration": 4444, + "isOffset": false, + "isSlot": false, + "src": "4222:10:17", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4449, + "nodeType": "InlineAssembly", + "src": "4037:249:17" + } + ] + }, + "documentation": { + "id": 4440, + "nodeType": "StructuredDocumentation", + "src": "3482:431:17", + "text": " @dev Returns the keccak256 digest of an EIP-712 typed data (ERC-191 version `0x01`).\n The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with\n `\\x19\\x01` and hashing the result. It corresponds to the hash signed by the\n https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.\n See {ECDSA-recover}." + }, + "id": 4451, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toTypedDataHash", + "nameLocation": "3927:15:17", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4445, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4442, + "mutability": "mutable", + "name": "domainSeparator", + "nameLocation": "3951:15:17", + "nodeType": "VariableDeclaration", + "scope": 4451, + "src": "3943:23:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4441, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3943:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4444, + "mutability": "mutable", + "name": "structHash", + "nameLocation": "3976:10:17", + "nodeType": "VariableDeclaration", + "scope": 4451, + "src": "3968:18:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4443, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3968:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "3942:45:17" + }, + "returnParameters": { + "id": 4448, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4447, + "mutability": "mutable", + "name": "digest", + "nameLocation": "4019:6:17", + "nodeType": "VariableDeclaration", + "scope": 4451, + "src": "4011:14:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4446, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "4011:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "4010:16:17" + }, + "scope": 4535, + "src": "3918:374:17", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4488, + "nodeType": "Block", + "src": "5222:256:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 4470, + "name": "fields", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4454, + "src": "5286:6:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + { + "arguments": [ + { + "arguments": [ + { + "id": 4474, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4456, + "src": "5326:4:17", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 4473, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5320:5:17", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 4472, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5320:5:17", + "typeDescriptions": {} + } + }, + "id": 4475, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5320:11:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 4471, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "5310:9:17", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 4476, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5310:22:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "arguments": [ + { + "arguments": [ + { + "id": 4480, + "name": "version", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4458, + "src": "5366:7:17", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 4479, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5360:5:17", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", + "typeString": "type(bytes storage pointer)" + }, + "typeName": { + "id": 4478, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5360:5:17", + "typeDescriptions": {} + } + }, + "id": 4481, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5360:14:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 4477, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "5350:9:17", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 4482, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5350:25:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 4483, + "name": "chainId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4460, + "src": "5393:7:17", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 4484, + "name": "verifyingContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4462, + "src": "5418:17:17", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 4485, + "name": "salt", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4464, + "src": "5453:4:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 4469, + "name": "toDomainSeparator", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4489, + 4515 + ], + "referencedDeclaration": 4515, + "src": "5251:17:17", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes1_$_t_bytes32_$_t_bytes32_$_t_uint256_$_t_address_$_t_bytes32_$returns$_t_bytes32_$", + "typeString": "function (bytes1,bytes32,bytes32,uint256,address,bytes32) pure returns (bytes32)" + } + }, + "id": 4486, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5251:220:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 4468, + "id": 4487, + "nodeType": "Return", + "src": "5232:239:17" + } + ] + }, + "documentation": { + "id": 4452, + "nodeType": "StructuredDocumentation", + "src": "4298:685:17", + "text": " @dev Returns the EIP-712 domain separator constructed from an `eip712Domain`. See {IERC5267-eip712Domain}\n This function dynamically constructs the domain separator based on which fields are present in the\n `fields` parameter. It contains flags that indicate which domain fields are present:\n * Bit 0 (0x01): name\n * Bit 1 (0x02): version\n * Bit 2 (0x04): chainId\n * Bit 3 (0x08): verifyingContract\n * Bit 4 (0x10): salt\n Arguments that correspond to fields which are not present in `fields` are ignored. For example, if `fields` is\n `0x0f` (`0b01111`), then the `salt` parameter is ignored." + }, + "id": 4489, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toDomainSeparator", + "nameLocation": "4997:17:17", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4465, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4454, + "mutability": "mutable", + "name": "fields", + "nameLocation": "5031:6:17", + "nodeType": "VariableDeclaration", + "scope": 4489, + "src": "5024:13:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 4453, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "5024:6:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4456, + "mutability": "mutable", + "name": "name", + "nameLocation": "5061:4:17", + "nodeType": "VariableDeclaration", + "scope": 4489, + "src": "5047:18:17", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 4455, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "5047:6:17", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4458, + "mutability": "mutable", + "name": "version", + "nameLocation": "5089:7:17", + "nodeType": "VariableDeclaration", + "scope": 4489, + "src": "5075:21:17", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 4457, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "5075:6:17", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4460, + "mutability": "mutable", + "name": "chainId", + "nameLocation": "5114:7:17", + "nodeType": "VariableDeclaration", + "scope": 4489, + "src": "5106:15:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4459, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5106:7:17", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4462, + "mutability": "mutable", + "name": "verifyingContract", + "nameLocation": "5139:17:17", + "nodeType": "VariableDeclaration", + "scope": 4489, + "src": "5131:25:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 4461, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5131:7:17", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4464, + "mutability": "mutable", + "name": "salt", + "nameLocation": "5174:4:17", + "nodeType": "VariableDeclaration", + "scope": 4489, + "src": "5166:12:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4463, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5166:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "5014:170:17" + }, + "returnParameters": { + "id": 4468, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4467, + "mutability": "mutable", + "name": "hash", + "nameLocation": "5216:4:17", + "nodeType": "VariableDeclaration", + "scope": 4489, + "src": "5208:12:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4466, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5208:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "5207:14:17" + }, + "scope": 4535, + "src": "4988:490:17", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4514, + "nodeType": "Block", + "src": "5838:1051:17", + "statements": [ + { + "assignments": [ + 4508 + ], + "declarations": [ + { + "constant": false, + "id": 4508, + "mutability": "mutable", + "name": "domainTypeHash", + "nameLocation": "5856:14:17", + "nodeType": "VariableDeclaration", + "scope": 4514, + "src": "5848:22:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4507, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5848:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 4512, + "initialValue": { + "arguments": [ + { + "id": 4510, + "name": "fields", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4492, + "src": "5890:6:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 4509, + "name": "toDomainTypeHash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4534, + "src": "5873:16:17", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes1_$returns$_t_bytes32_$", + "typeString": "function (bytes1) pure returns (bytes32)" + } + }, + "id": 4511, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5873:24:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "5848:49:17" + }, + { + "AST": { + "nativeSrc": "5933:950:17", + "nodeType": "YulBlock", + "src": "5933:950:17", + "statements": [ + { + "nativeSrc": "6008:26:17", + "nodeType": "YulAssignment", + "src": "6008:26:17", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "6022:3:17", + "nodeType": "YulLiteral", + "src": "6022:3:17", + "type": "", + "value": "248" + }, + { + "name": "fields", + "nativeSrc": "6027:6:17", + "nodeType": "YulIdentifier", + "src": "6027:6:17" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "6018:3:17", + "nodeType": "YulIdentifier", + "src": "6018:3:17" + }, + "nativeSrc": "6018:16:17", + "nodeType": "YulFunctionCall", + "src": "6018:16:17" + }, + "variableNames": [ + { + "name": "fields", + "nativeSrc": "6008:6:17", + "nodeType": "YulIdentifier", + "src": "6008:6:17" + } + ] + }, + { + "nativeSrc": "6089:22:17", + "nodeType": "YulVariableDeclaration", + "src": "6089:22:17", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "6106:4:17", + "nodeType": "YulLiteral", + "src": "6106:4:17", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "6100:5:17", + "nodeType": "YulIdentifier", + "src": "6100:5:17" + }, + "nativeSrc": "6100:11:17", + "nodeType": "YulFunctionCall", + "src": "6100:11:17" + }, + "variables": [ + { + "name": "fmp", + "nativeSrc": "6093:3:17", + "nodeType": "YulTypedName", + "src": "6093:3:17", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "6131:3:17", + "nodeType": "YulIdentifier", + "src": "6131:3:17" + }, + { + "name": "domainTypeHash", + "nativeSrc": "6136:14:17", + "nodeType": "YulIdentifier", + "src": "6136:14:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6124:6:17", + "nodeType": "YulIdentifier", + "src": "6124:6:17" + }, + "nativeSrc": "6124:27:17", + "nodeType": "YulFunctionCall", + "src": "6124:27:17" + }, + "nativeSrc": "6124:27:17", + "nodeType": "YulExpressionStatement", + "src": "6124:27:17" + }, + { + "nativeSrc": "6165:25:17", + "nodeType": "YulVariableDeclaration", + "src": "6165:25:17", + "value": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "6180:3:17", + "nodeType": "YulIdentifier", + "src": "6180:3:17" + }, + { + "kind": "number", + "nativeSrc": "6185:4:17", + "nodeType": "YulLiteral", + "src": "6185:4:17", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6176:3:17", + "nodeType": "YulIdentifier", + "src": "6176:3:17" + }, + "nativeSrc": "6176:14:17", + "nodeType": "YulFunctionCall", + "src": "6176:14:17" + }, + "variables": [ + { + "name": "ptr", + "nativeSrc": "6169:3:17", + "nodeType": "YulTypedName", + "src": "6169:3:17", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "6224:91:17", + "nodeType": "YulBlock", + "src": "6224:91:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6249:3:17", + "nodeType": "YulIdentifier", + "src": "6249:3:17" + }, + { + "name": "nameHash", + "nativeSrc": "6254:8:17", + "nodeType": "YulIdentifier", + "src": "6254:8:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6242:6:17", + "nodeType": "YulIdentifier", + "src": "6242:6:17" + }, + "nativeSrc": "6242:21:17", + "nodeType": "YulFunctionCall", + "src": "6242:21:17" + }, + "nativeSrc": "6242:21:17", + "nodeType": "YulExpressionStatement", + "src": "6242:21:17" + }, + { + "nativeSrc": "6280:21:17", + "nodeType": "YulAssignment", + "src": "6280:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6291:3:17", + "nodeType": "YulIdentifier", + "src": "6291:3:17" + }, + { + "kind": "number", + "nativeSrc": "6296:4:17", + "nodeType": "YulLiteral", + "src": "6296:4:17", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6287:3:17", + "nodeType": "YulIdentifier", + "src": "6287:3:17" + }, + "nativeSrc": "6287:14:17", + "nodeType": "YulFunctionCall", + "src": "6287:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "6280:3:17", + "nodeType": "YulIdentifier", + "src": "6280:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "6210:6:17", + "nodeType": "YulIdentifier", + "src": "6210:6:17" + }, + { + "kind": "number", + "nativeSrc": "6218:4:17", + "nodeType": "YulLiteral", + "src": "6218:4:17", + "type": "", + "value": "0x01" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "6206:3:17", + "nodeType": "YulIdentifier", + "src": "6206:3:17" + }, + "nativeSrc": "6206:17:17", + "nodeType": "YulFunctionCall", + "src": "6206:17:17" + }, + "nativeSrc": "6203:112:17", + "nodeType": "YulIf", + "src": "6203:112:17" + }, + { + "body": { + "nativeSrc": "6349:94:17", + "nodeType": "YulBlock", + "src": "6349:94:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6374:3:17", + "nodeType": "YulIdentifier", + "src": "6374:3:17" + }, + { + "name": "versionHash", + "nativeSrc": "6379:11:17", + "nodeType": "YulIdentifier", + "src": "6379:11:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6367:6:17", + "nodeType": "YulIdentifier", + "src": "6367:6:17" + }, + "nativeSrc": "6367:24:17", + "nodeType": "YulFunctionCall", + "src": "6367:24:17" + }, + "nativeSrc": "6367:24:17", + "nodeType": "YulExpressionStatement", + "src": "6367:24:17" + }, + { + "nativeSrc": "6408:21:17", + "nodeType": "YulAssignment", + "src": "6408:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6419:3:17", + "nodeType": "YulIdentifier", + "src": "6419:3:17" + }, + { + "kind": "number", + "nativeSrc": "6424:4:17", + "nodeType": "YulLiteral", + "src": "6424:4:17", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6415:3:17", + "nodeType": "YulIdentifier", + "src": "6415:3:17" + }, + "nativeSrc": "6415:14:17", + "nodeType": "YulFunctionCall", + "src": "6415:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "6408:3:17", + "nodeType": "YulIdentifier", + "src": "6408:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "6335:6:17", + "nodeType": "YulIdentifier", + "src": "6335:6:17" + }, + { + "kind": "number", + "nativeSrc": "6343:4:17", + "nodeType": "YulLiteral", + "src": "6343:4:17", + "type": "", + "value": "0x02" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "6331:3:17", + "nodeType": "YulIdentifier", + "src": "6331:3:17" + }, + "nativeSrc": "6331:17:17", + "nodeType": "YulFunctionCall", + "src": "6331:17:17" + }, + "nativeSrc": "6328:115:17", + "nodeType": "YulIf", + "src": "6328:115:17" + }, + { + "body": { + "nativeSrc": "6477:90:17", + "nodeType": "YulBlock", + "src": "6477:90:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6502:3:17", + "nodeType": "YulIdentifier", + "src": "6502:3:17" + }, + { + "name": "chainId", + "nativeSrc": "6507:7:17", + "nodeType": "YulIdentifier", + "src": "6507:7:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6495:6:17", + "nodeType": "YulIdentifier", + "src": "6495:6:17" + }, + "nativeSrc": "6495:20:17", + "nodeType": "YulFunctionCall", + "src": "6495:20:17" + }, + "nativeSrc": "6495:20:17", + "nodeType": "YulExpressionStatement", + "src": "6495:20:17" + }, + { + "nativeSrc": "6532:21:17", + "nodeType": "YulAssignment", + "src": "6532:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6543:3:17", + "nodeType": "YulIdentifier", + "src": "6543:3:17" + }, + { + "kind": "number", + "nativeSrc": "6548:4:17", + "nodeType": "YulLiteral", + "src": "6548:4:17", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6539:3:17", + "nodeType": "YulIdentifier", + "src": "6539:3:17" + }, + "nativeSrc": "6539:14:17", + "nodeType": "YulFunctionCall", + "src": "6539:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "6532:3:17", + "nodeType": "YulIdentifier", + "src": "6532:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "6463:6:17", + "nodeType": "YulIdentifier", + "src": "6463:6:17" + }, + { + "kind": "number", + "nativeSrc": "6471:4:17", + "nodeType": "YulLiteral", + "src": "6471:4:17", + "type": "", + "value": "0x04" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "6459:3:17", + "nodeType": "YulIdentifier", + "src": "6459:3:17" + }, + "nativeSrc": "6459:17:17", + "nodeType": "YulFunctionCall", + "src": "6459:17:17" + }, + "nativeSrc": "6456:111:17", + "nodeType": "YulIf", + "src": "6456:111:17" + }, + { + "body": { + "nativeSrc": "6601:100:17", + "nodeType": "YulBlock", + "src": "6601:100:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6626:3:17", + "nodeType": "YulIdentifier", + "src": "6626:3:17" + }, + { + "name": "verifyingContract", + "nativeSrc": "6631:17:17", + "nodeType": "YulIdentifier", + "src": "6631:17:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6619:6:17", + "nodeType": "YulIdentifier", + "src": "6619:6:17" + }, + "nativeSrc": "6619:30:17", + "nodeType": "YulFunctionCall", + "src": "6619:30:17" + }, + "nativeSrc": "6619:30:17", + "nodeType": "YulExpressionStatement", + "src": "6619:30:17" + }, + { + "nativeSrc": "6666:21:17", + "nodeType": "YulAssignment", + "src": "6666:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6677:3:17", + "nodeType": "YulIdentifier", + "src": "6677:3:17" + }, + { + "kind": "number", + "nativeSrc": "6682:4:17", + "nodeType": "YulLiteral", + "src": "6682:4:17", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6673:3:17", + "nodeType": "YulIdentifier", + "src": "6673:3:17" + }, + "nativeSrc": "6673:14:17", + "nodeType": "YulFunctionCall", + "src": "6673:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "6666:3:17", + "nodeType": "YulIdentifier", + "src": "6666:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "6587:6:17", + "nodeType": "YulIdentifier", + "src": "6587:6:17" + }, + { + "kind": "number", + "nativeSrc": "6595:4:17", + "nodeType": "YulLiteral", + "src": "6595:4:17", + "type": "", + "value": "0x08" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "6583:3:17", + "nodeType": "YulIdentifier", + "src": "6583:3:17" + }, + "nativeSrc": "6583:17:17", + "nodeType": "YulFunctionCall", + "src": "6583:17:17" + }, + "nativeSrc": "6580:121:17", + "nodeType": "YulIf", + "src": "6580:121:17" + }, + { + "body": { + "nativeSrc": "6735:87:17", + "nodeType": "YulBlock", + "src": "6735:87:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6760:3:17", + "nodeType": "YulIdentifier", + "src": "6760:3:17" + }, + { + "name": "salt", + "nativeSrc": "6765:4:17", + "nodeType": "YulIdentifier", + "src": "6765:4:17" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6753:6:17", + "nodeType": "YulIdentifier", + "src": "6753:6:17" + }, + "nativeSrc": "6753:17:17", + "nodeType": "YulFunctionCall", + "src": "6753:17:17" + }, + "nativeSrc": "6753:17:17", + "nodeType": "YulExpressionStatement", + "src": "6753:17:17" + }, + { + "nativeSrc": "6787:21:17", + "nodeType": "YulAssignment", + "src": "6787:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6798:3:17", + "nodeType": "YulIdentifier", + "src": "6798:3:17" + }, + { + "kind": "number", + "nativeSrc": "6803:4:17", + "nodeType": "YulLiteral", + "src": "6803:4:17", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6794:3:17", + "nodeType": "YulIdentifier", + "src": "6794:3:17" + }, + "nativeSrc": "6794:14:17", + "nodeType": "YulFunctionCall", + "src": "6794:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "6787:3:17", + "nodeType": "YulIdentifier", + "src": "6787:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "6721:6:17", + "nodeType": "YulIdentifier", + "src": "6721:6:17" + }, + { + "kind": "number", + "nativeSrc": "6729:4:17", + "nodeType": "YulLiteral", + "src": "6729:4:17", + "type": "", + "value": "0x10" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "6717:3:17", + "nodeType": "YulIdentifier", + "src": "6717:3:17" + }, + "nativeSrc": "6717:17:17", + "nodeType": "YulFunctionCall", + "src": "6717:17:17" + }, + "nativeSrc": "6714:108:17", + "nodeType": "YulIf", + "src": "6714:108:17" + }, + { + "nativeSrc": "6836:37:17", + "nodeType": "YulAssignment", + "src": "6836:37:17", + "value": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "6854:3:17", + "nodeType": "YulIdentifier", + "src": "6854:3:17" + }, + { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "6863:3:17", + "nodeType": "YulIdentifier", + "src": "6863:3:17" + }, + { + "name": "fmp", + "nativeSrc": "6868:3:17", + "nodeType": "YulIdentifier", + "src": "6868:3:17" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "6859:3:17", + "nodeType": "YulIdentifier", + "src": "6859:3:17" + }, + "nativeSrc": "6859:13:17", + "nodeType": "YulFunctionCall", + "src": "6859:13:17" + } + ], + "functionName": { + "name": "keccak256", + "nativeSrc": "6844:9:17", + "nodeType": "YulIdentifier", + "src": "6844:9:17" + }, + "nativeSrc": "6844:29:17", + "nodeType": "YulFunctionCall", + "src": "6844:29:17" + }, + "variableNames": [ + { + "name": "hash", + "nativeSrc": "6836:4:17", + "nodeType": "YulIdentifier", + "src": "6836:4:17" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4498, + "isOffset": false, + "isSlot": false, + "src": "6507:7:17", + "valueSize": 1 + }, + { + "declaration": 4508, + "isOffset": false, + "isSlot": false, + "src": "6136:14:17", + "valueSize": 1 + }, + { + "declaration": 4492, + "isOffset": false, + "isSlot": false, + "src": "6008:6:17", + "valueSize": 1 + }, + { + "declaration": 4492, + "isOffset": false, + "isSlot": false, + "src": "6027:6:17", + "valueSize": 1 + }, + { + "declaration": 4492, + "isOffset": false, + "isSlot": false, + "src": "6210:6:17", + "valueSize": 1 + }, + { + "declaration": 4492, + "isOffset": false, + "isSlot": false, + "src": "6335:6:17", + "valueSize": 1 + }, + { + "declaration": 4492, + "isOffset": false, + "isSlot": false, + "src": "6463:6:17", + "valueSize": 1 + }, + { + "declaration": 4492, + "isOffset": false, + "isSlot": false, + "src": "6587:6:17", + "valueSize": 1 + }, + { + "declaration": 4492, + "isOffset": false, + "isSlot": false, + "src": "6721:6:17", + "valueSize": 1 + }, + { + "declaration": 4505, + "isOffset": false, + "isSlot": false, + "src": "6836:4:17", + "valueSize": 1 + }, + { + "declaration": 4494, + "isOffset": false, + "isSlot": false, + "src": "6254:8:17", + "valueSize": 1 + }, + { + "declaration": 4502, + "isOffset": false, + "isSlot": false, + "src": "6765:4:17", + "valueSize": 1 + }, + { + "declaration": 4500, + "isOffset": false, + "isSlot": false, + "src": "6631:17:17", + "valueSize": 1 + }, + { + "declaration": 4496, + "isOffset": false, + "isSlot": false, + "src": "6379:11:17", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4513, + "nodeType": "InlineAssembly", + "src": "5908:975:17" + } + ] + }, + "documentation": { + "id": 4490, + "nodeType": "StructuredDocumentation", + "src": "5484:119:17", + "text": "@dev Variant of {toDomainSeparator-bytes1-string-string-uint256-address-bytes32} that uses hashed name and version." + }, + "id": 4515, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toDomainSeparator", + "nameLocation": "5617:17:17", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4503, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4492, + "mutability": "mutable", + "name": "fields", + "nameLocation": "5651:6:17", + "nodeType": "VariableDeclaration", + "scope": 4515, + "src": "5644:13:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 4491, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "5644:6:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4494, + "mutability": "mutable", + "name": "nameHash", + "nameLocation": "5675:8:17", + "nodeType": "VariableDeclaration", + "scope": 4515, + "src": "5667:16:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4493, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5667:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4496, + "mutability": "mutable", + "name": "versionHash", + "nameLocation": "5701:11:17", + "nodeType": "VariableDeclaration", + "scope": 4515, + "src": "5693:19:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4495, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5693:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4498, + "mutability": "mutable", + "name": "chainId", + "nameLocation": "5730:7:17", + "nodeType": "VariableDeclaration", + "scope": 4515, + "src": "5722:15:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4497, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5722:7:17", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4500, + "mutability": "mutable", + "name": "verifyingContract", + "nameLocation": "5755:17:17", + "nodeType": "VariableDeclaration", + "scope": 4515, + "src": "5747:25:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 4499, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5747:7:17", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4502, + "mutability": "mutable", + "name": "salt", + "nameLocation": "5790:4:17", + "nodeType": "VariableDeclaration", + "scope": 4515, + "src": "5782:12:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4501, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5782:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "5634:166:17" + }, + "returnParameters": { + "id": 4506, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4505, + "mutability": "mutable", + "name": "hash", + "nameLocation": "5832:4:17", + "nodeType": "VariableDeclaration", + "scope": 4515, + "src": "5824:12:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4504, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5824:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "5823:14:17" + }, + "scope": 4535, + "src": "5608:1281:17", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4533, + "nodeType": "Block", + "src": "7117:1511:17", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "id": 4527, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "id": 4525, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4523, + "name": "fields", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4518, + "src": "7131:6:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "hexValue": "30783230", + "id": 4524, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7140:4:17", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "0x20" + }, + "src": "7131:13:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30783230", + "id": 4526, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7148:4:17", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "0x20" + }, + "src": "7131:21:17", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4531, + "nodeType": "IfStatement", + "src": "7127:65:17", + "trueBody": { + "errorCall": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 4528, + "name": "ERC5267ExtensionsNotSupported", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4371, + "src": "7161:29:17", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$__$returns$_t_error_$", + "typeString": "function () pure returns (error)" + } + }, + "id": 4529, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7161:31:17", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 4530, + "nodeType": "RevertStatement", + "src": "7154:38:17" + } + }, + { + "AST": { + "nativeSrc": "7228:1394:17", + "nodeType": "YulBlock", + "src": "7228:1394:17", + "statements": [ + { + "nativeSrc": "7303:26:17", + "nodeType": "YulAssignment", + "src": "7303:26:17", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "7317:3:17", + "nodeType": "YulLiteral", + "src": "7317:3:17", + "type": "", + "value": "248" + }, + { + "name": "fields", + "nativeSrc": "7322:6:17", + "nodeType": "YulIdentifier", + "src": "7322:6:17" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "7313:3:17", + "nodeType": "YulIdentifier", + "src": "7313:3:17" + }, + "nativeSrc": "7313:16:17", + "nodeType": "YulFunctionCall", + "src": "7313:16:17" + }, + "variableNames": [ + { + "name": "fields", + "nativeSrc": "7303:6:17", + "nodeType": "YulIdentifier", + "src": "7303:6:17" + } + ] + }, + { + "nativeSrc": "7384:22:17", + "nodeType": "YulVariableDeclaration", + "src": "7384:22:17", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "7401:4:17", + "nodeType": "YulLiteral", + "src": "7401:4:17", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "7395:5:17", + "nodeType": "YulIdentifier", + "src": "7395:5:17" + }, + "nativeSrc": "7395:11:17", + "nodeType": "YulFunctionCall", + "src": "7395:11:17" + }, + "variables": [ + { + "name": "fmp", + "nativeSrc": "7388:3:17", + "nodeType": "YulTypedName", + "src": "7388:3:17", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "7426:3:17", + "nodeType": "YulIdentifier", + "src": "7426:3:17" + }, + { + "hexValue": "454950373132446f6d61696e28", + "kind": "string", + "nativeSrc": "7431:15:17", + "nodeType": "YulLiteral", + "src": "7431:15:17", + "type": "", + "value": "EIP712Domain(" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7419:6:17", + "nodeType": "YulIdentifier", + "src": "7419:6:17" + }, + "nativeSrc": "7419:28:17", + "nodeType": "YulFunctionCall", + "src": "7419:28:17" + }, + "nativeSrc": "7419:28:17", + "nodeType": "YulExpressionStatement", + "src": "7419:28:17" + }, + { + "nativeSrc": "7461:25:17", + "nodeType": "YulVariableDeclaration", + "src": "7461:25:17", + "value": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "7476:3:17", + "nodeType": "YulIdentifier", + "src": "7476:3:17" + }, + { + "kind": "number", + "nativeSrc": "7481:4:17", + "nodeType": "YulLiteral", + "src": "7481:4:17", + "type": "", + "value": "0x0d" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7472:3:17", + "nodeType": "YulIdentifier", + "src": "7472:3:17" + }, + "nativeSrc": "7472:14:17", + "nodeType": "YulFunctionCall", + "src": "7472:14:17" + }, + "variables": [ + { + "name": "ptr", + "nativeSrc": "7465:3:17", + "nodeType": "YulTypedName", + "src": "7465:3:17", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "7546:97:17", + "nodeType": "YulBlock", + "src": "7546:97:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "7571:3:17", + "nodeType": "YulIdentifier", + "src": "7571:3:17" + }, + { + "hexValue": "737472696e67206e616d652c", + "kind": "string", + "nativeSrc": "7576:14:17", + "nodeType": "YulLiteral", + "src": "7576:14:17", + "type": "", + "value": "string name," + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7564:6:17", + "nodeType": "YulIdentifier", + "src": "7564:6:17" + }, + "nativeSrc": "7564:27:17", + "nodeType": "YulFunctionCall", + "src": "7564:27:17" + }, + "nativeSrc": "7564:27:17", + "nodeType": "YulExpressionStatement", + "src": "7564:27:17" + }, + { + "nativeSrc": "7608:21:17", + "nodeType": "YulAssignment", + "src": "7608:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "7619:3:17", + "nodeType": "YulIdentifier", + "src": "7619:3:17" + }, + { + "kind": "number", + "nativeSrc": "7624:4:17", + "nodeType": "YulLiteral", + "src": "7624:4:17", + "type": "", + "value": "0x0c" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7615:3:17", + "nodeType": "YulIdentifier", + "src": "7615:3:17" + }, + "nativeSrc": "7615:14:17", + "nodeType": "YulFunctionCall", + "src": "7615:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "7608:3:17", + "nodeType": "YulIdentifier", + "src": "7608:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "7532:6:17", + "nodeType": "YulIdentifier", + "src": "7532:6:17" + }, + { + "kind": "number", + "nativeSrc": "7540:4:17", + "nodeType": "YulLiteral", + "src": "7540:4:17", + "type": "", + "value": "0x01" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "7528:3:17", + "nodeType": "YulIdentifier", + "src": "7528:3:17" + }, + "nativeSrc": "7528:17:17", + "nodeType": "YulFunctionCall", + "src": "7528:17:17" + }, + "nativeSrc": "7525:118:17", + "nodeType": "YulIf", + "src": "7525:118:17" + }, + { + "body": { + "nativeSrc": "7706:100:17", + "nodeType": "YulBlock", + "src": "7706:100:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "7731:3:17", + "nodeType": "YulIdentifier", + "src": "7731:3:17" + }, + { + "hexValue": "737472696e672076657273696f6e2c", + "kind": "string", + "nativeSrc": "7736:17:17", + "nodeType": "YulLiteral", + "src": "7736:17:17", + "type": "", + "value": "string version," + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7724:6:17", + "nodeType": "YulIdentifier", + "src": "7724:6:17" + }, + "nativeSrc": "7724:30:17", + "nodeType": "YulFunctionCall", + "src": "7724:30:17" + }, + "nativeSrc": "7724:30:17", + "nodeType": "YulExpressionStatement", + "src": "7724:30:17" + }, + { + "nativeSrc": "7771:21:17", + "nodeType": "YulAssignment", + "src": "7771:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "7782:3:17", + "nodeType": "YulIdentifier", + "src": "7782:3:17" + }, + { + "kind": "number", + "nativeSrc": "7787:4:17", + "nodeType": "YulLiteral", + "src": "7787:4:17", + "type": "", + "value": "0x0f" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7778:3:17", + "nodeType": "YulIdentifier", + "src": "7778:3:17" + }, + "nativeSrc": "7778:14:17", + "nodeType": "YulFunctionCall", + "src": "7778:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "7771:3:17", + "nodeType": "YulIdentifier", + "src": "7771:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "7692:6:17", + "nodeType": "YulIdentifier", + "src": "7692:6:17" + }, + { + "kind": "number", + "nativeSrc": "7700:4:17", + "nodeType": "YulLiteral", + "src": "7700:4:17", + "type": "", + "value": "0x02" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "7688:3:17", + "nodeType": "YulIdentifier", + "src": "7688:3:17" + }, + "nativeSrc": "7688:17:17", + "nodeType": "YulFunctionCall", + "src": "7688:17:17" + }, + "nativeSrc": "7685:121:17", + "nodeType": "YulIf", + "src": "7685:121:17" + }, + { + "body": { + "nativeSrc": "7869:101:17", + "nodeType": "YulBlock", + "src": "7869:101:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "7894:3:17", + "nodeType": "YulIdentifier", + "src": "7894:3:17" + }, + { + "hexValue": "75696e7432353620636861696e49642c", + "kind": "string", + "nativeSrc": "7899:18:17", + "nodeType": "YulLiteral", + "src": "7899:18:17", + "type": "", + "value": "uint256 chainId," + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7887:6:17", + "nodeType": "YulIdentifier", + "src": "7887:6:17" + }, + "nativeSrc": "7887:31:17", + "nodeType": "YulFunctionCall", + "src": "7887:31:17" + }, + "nativeSrc": "7887:31:17", + "nodeType": "YulExpressionStatement", + "src": "7887:31:17" + }, + { + "nativeSrc": "7935:21:17", + "nodeType": "YulAssignment", + "src": "7935:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "7946:3:17", + "nodeType": "YulIdentifier", + "src": "7946:3:17" + }, + { + "kind": "number", + "nativeSrc": "7951:4:17", + "nodeType": "YulLiteral", + "src": "7951:4:17", + "type": "", + "value": "0x10" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7942:3:17", + "nodeType": "YulIdentifier", + "src": "7942:3:17" + }, + "nativeSrc": "7942:14:17", + "nodeType": "YulFunctionCall", + "src": "7942:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "7935:3:17", + "nodeType": "YulIdentifier", + "src": "7935:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "7855:6:17", + "nodeType": "YulIdentifier", + "src": "7855:6:17" + }, + { + "kind": "number", + "nativeSrc": "7863:4:17", + "nodeType": "YulLiteral", + "src": "7863:4:17", + "type": "", + "value": "0x04" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "7851:3:17", + "nodeType": "YulIdentifier", + "src": "7851:3:17" + }, + "nativeSrc": "7851:17:17", + "nodeType": "YulFunctionCall", + "src": "7851:17:17" + }, + "nativeSrc": "7848:122:17", + "nodeType": "YulIf", + "src": "7848:122:17" + }, + { + "body": { + "nativeSrc": "8043:111:17", + "nodeType": "YulBlock", + "src": "8043:111:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "8068:3:17", + "nodeType": "YulIdentifier", + "src": "8068:3:17" + }, + { + "hexValue": "6164647265737320766572696679696e67436f6e74726163742c", + "kind": "string", + "nativeSrc": "8073:28:17", + "nodeType": "YulLiteral", + "src": "8073:28:17", + "type": "", + "value": "address verifyingContract," + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8061:6:17", + "nodeType": "YulIdentifier", + "src": "8061:6:17" + }, + "nativeSrc": "8061:41:17", + "nodeType": "YulFunctionCall", + "src": "8061:41:17" + }, + "nativeSrc": "8061:41:17", + "nodeType": "YulExpressionStatement", + "src": "8061:41:17" + }, + { + "nativeSrc": "8119:21:17", + "nodeType": "YulAssignment", + "src": "8119:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "8130:3:17", + "nodeType": "YulIdentifier", + "src": "8130:3:17" + }, + { + "kind": "number", + "nativeSrc": "8135:4:17", + "nodeType": "YulLiteral", + "src": "8135:4:17", + "type": "", + "value": "0x1a" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8126:3:17", + "nodeType": "YulIdentifier", + "src": "8126:3:17" + }, + "nativeSrc": "8126:14:17", + "nodeType": "YulFunctionCall", + "src": "8126:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "8119:3:17", + "nodeType": "YulIdentifier", + "src": "8119:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "8029:6:17", + "nodeType": "YulIdentifier", + "src": "8029:6:17" + }, + { + "kind": "number", + "nativeSrc": "8037:4:17", + "nodeType": "YulLiteral", + "src": "8037:4:17", + "type": "", + "value": "0x08" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "8025:3:17", + "nodeType": "YulIdentifier", + "src": "8025:3:17" + }, + "nativeSrc": "8025:17:17", + "nodeType": "YulFunctionCall", + "src": "8025:17:17" + }, + "nativeSrc": "8022:132:17", + "nodeType": "YulIf", + "src": "8022:132:17" + }, + { + "body": { + "nativeSrc": "8214:98:17", + "nodeType": "YulBlock", + "src": "8214:98:17", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "8239:3:17", + "nodeType": "YulIdentifier", + "src": "8239:3:17" + }, + { + "hexValue": "627974657333322073616c742c", + "kind": "string", + "nativeSrc": "8244:15:17", + "nodeType": "YulLiteral", + "src": "8244:15:17", + "type": "", + "value": "bytes32 salt," + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8232:6:17", + "nodeType": "YulIdentifier", + "src": "8232:6:17" + }, + "nativeSrc": "8232:28:17", + "nodeType": "YulFunctionCall", + "src": "8232:28:17" + }, + "nativeSrc": "8232:28:17", + "nodeType": "YulExpressionStatement", + "src": "8232:28:17" + }, + { + "nativeSrc": "8277:21:17", + "nodeType": "YulAssignment", + "src": "8277:21:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "8288:3:17", + "nodeType": "YulIdentifier", + "src": "8288:3:17" + }, + { + "kind": "number", + "nativeSrc": "8293:4:17", + "nodeType": "YulLiteral", + "src": "8293:4:17", + "type": "", + "value": "0x0d" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8284:3:17", + "nodeType": "YulIdentifier", + "src": "8284:3:17" + }, + "nativeSrc": "8284:14:17", + "nodeType": "YulFunctionCall", + "src": "8284:14:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "8277:3:17", + "nodeType": "YulIdentifier", + "src": "8277:3:17" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "fields", + "nativeSrc": "8200:6:17", + "nodeType": "YulIdentifier", + "src": "8200:6:17" + }, + { + "kind": "number", + "nativeSrc": "8208:4:17", + "nodeType": "YulLiteral", + "src": "8208:4:17", + "type": "", + "value": "0x10" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "8196:3:17", + "nodeType": "YulIdentifier", + "src": "8196:3:17" + }, + "nativeSrc": "8196:17:17", + "nodeType": "YulFunctionCall", + "src": "8196:17:17" + }, + "nativeSrc": "8193:119:17", + "nodeType": "YulIf", + "src": "8193:119:17" + }, + { + "nativeSrc": "8391:50:17", + "nodeType": "YulAssignment", + "src": "8391:50:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "8402:3:17", + "nodeType": "YulIdentifier", + "src": "8402:3:17" + }, + { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "fields", + "nativeSrc": "8425:6:17", + "nodeType": "YulIdentifier", + "src": "8425:6:17" + }, + { + "kind": "number", + "nativeSrc": "8433:4:17", + "nodeType": "YulLiteral", + "src": "8433:4:17", + "type": "", + "value": "0x1f" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "8421:3:17", + "nodeType": "YulIdentifier", + "src": "8421:3:17" + }, + "nativeSrc": "8421:17:17", + "nodeType": "YulFunctionCall", + "src": "8421:17:17" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "8414:6:17", + "nodeType": "YulIdentifier", + "src": "8414:6:17" + }, + "nativeSrc": "8414:25:17", + "nodeType": "YulFunctionCall", + "src": "8414:25:17" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "8407:6:17", + "nodeType": "YulIdentifier", + "src": "8407:6:17" + }, + "nativeSrc": "8407:33:17", + "nodeType": "YulFunctionCall", + "src": "8407:33:17" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "8398:3:17", + "nodeType": "YulIdentifier", + "src": "8398:3:17" + }, + "nativeSrc": "8398:43:17", + "nodeType": "YulFunctionCall", + "src": "8398:43:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "8391:3:17", + "nodeType": "YulIdentifier", + "src": "8391:3:17" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "8499:3:17", + "nodeType": "YulIdentifier", + "src": "8499:3:17" + }, + { + "kind": "number", + "nativeSrc": "8504:4:17", + "nodeType": "YulLiteral", + "src": "8504:4:17", + "type": "", + "value": "0x29" + } + ], + "functionName": { + "name": "mstore8", + "nativeSrc": "8491:7:17", + "nodeType": "YulIdentifier", + "src": "8491:7:17" + }, + "nativeSrc": "8491:18:17", + "nodeType": "YulFunctionCall", + "src": "8491:18:17" + }, + "nativeSrc": "8491:18:17", + "nodeType": "YulExpressionStatement", + "src": "8491:18:17" + }, + { + "nativeSrc": "8543:18:17", + "nodeType": "YulAssignment", + "src": "8543:18:17", + "value": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "8554:3:17", + "nodeType": "YulIdentifier", + "src": "8554:3:17" + }, + { + "kind": "number", + "nativeSrc": "8559:1:17", + "nodeType": "YulLiteral", + "src": "8559:1:17", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8550:3:17", + "nodeType": "YulIdentifier", + "src": "8550:3:17" + }, + "nativeSrc": "8550:11:17", + "nodeType": "YulFunctionCall", + "src": "8550:11:17" + }, + "variableNames": [ + { + "name": "ptr", + "nativeSrc": "8543:3:17", + "nodeType": "YulIdentifier", + "src": "8543:3:17" + } + ] + }, + { + "nativeSrc": "8575:37:17", + "nodeType": "YulAssignment", + "src": "8575:37:17", + "value": { + "arguments": [ + { + "name": "fmp", + "nativeSrc": "8593:3:17", + "nodeType": "YulIdentifier", + "src": "8593:3:17" + }, + { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "8602:3:17", + "nodeType": "YulIdentifier", + "src": "8602:3:17" + }, + { + "name": "fmp", + "nativeSrc": "8607:3:17", + "nodeType": "YulIdentifier", + "src": "8607:3:17" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "8598:3:17", + "nodeType": "YulIdentifier", + "src": "8598:3:17" + }, + "nativeSrc": "8598:13:17", + "nodeType": "YulFunctionCall", + "src": "8598:13:17" + } + ], + "functionName": { + "name": "keccak256", + "nativeSrc": "8583:9:17", + "nodeType": "YulIdentifier", + "src": "8583:9:17" + }, + "nativeSrc": "8583:29:17", + "nodeType": "YulFunctionCall", + "src": "8583:29:17" + }, + "variableNames": [ + { + "name": "hash", + "nativeSrc": "8575:4:17", + "nodeType": "YulIdentifier", + "src": "8575:4:17" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4518, + "isOffset": false, + "isSlot": false, + "src": "7303:6:17", + "valueSize": 1 + }, + { + "declaration": 4518, + "isOffset": false, + "isSlot": false, + "src": "7322:6:17", + "valueSize": 1 + }, + { + "declaration": 4518, + "isOffset": false, + "isSlot": false, + "src": "7532:6:17", + "valueSize": 1 + }, + { + "declaration": 4518, + "isOffset": false, + "isSlot": false, + "src": "7692:6:17", + "valueSize": 1 + }, + { + "declaration": 4518, + "isOffset": false, + "isSlot": false, + "src": "7855:6:17", + "valueSize": 1 + }, + { + "declaration": 4518, + "isOffset": false, + "isSlot": false, + "src": "8029:6:17", + "valueSize": 1 + }, + { + "declaration": 4518, + "isOffset": false, + "isSlot": false, + "src": "8200:6:17", + "valueSize": 1 + }, + { + "declaration": 4518, + "isOffset": false, + "isSlot": false, + "src": "8425:6:17", + "valueSize": 1 + }, + { + "declaration": 4521, + "isOffset": false, + "isSlot": false, + "src": "8575:4:17", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4532, + "nodeType": "InlineAssembly", + "src": "7203:1419:17" + } + ] + }, + "documentation": { + "id": 4516, + "nodeType": "StructuredDocumentation", + "src": "6895:139:17", + "text": "@dev Builds an EIP-712 domain type hash depending on the `fields` provided, following https://eips.ethereum.org/EIPS/eip-5267[ERC-5267]" + }, + "id": 4534, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toDomainTypeHash", + "nameLocation": "7048:16:17", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4519, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4518, + "mutability": "mutable", + "name": "fields", + "nameLocation": "7072:6:17", + "nodeType": "VariableDeclaration", + "scope": 4534, + "src": "7065:13:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + "typeName": { + "id": 4517, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "7065:6:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "visibility": "internal" + } + ], + "src": "7064:15:17" + }, + "returnParameters": { + "id": 4522, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4521, + "mutability": "mutable", + "name": "hash", + "nameLocation": "7111:4:17", + "nodeType": "VariableDeclaration", + "scope": 4534, + "src": "7103:12:17", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 4520, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "7103:7:17", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "7102:14:17" + }, + "scope": 4535, + "src": "7039:1589:17", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + } + ], + "scope": 4536, + "src": "521:8109:17", + "usedErrors": [ + 4371 + ], + "usedEvents": [] + } + ], + "src": "123:8508:17" + }, + "id": 17 + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/introspection/IERC165.sol", + "exportedSymbols": { + "IERC165": [ + 4547 + ] + }, + "id": 4548, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 4537, + "literals": [ + "solidity", + ">=", + "0.4", + ".16" + ], + "nodeType": "PragmaDirective", + "src": "115:25:18" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "IERC165", + "contractDependencies": [], + "contractKind": "interface", + "documentation": { + "id": 4538, + "nodeType": "StructuredDocumentation", + "src": "142:280:18", + "text": " @dev Interface of the ERC-165 standard, as defined in the\n https://eips.ethereum.org/EIPS/eip-165[ERC].\n Implementers can declare support of contract interfaces, which can then be\n queried by others ({ERC165Checker}).\n For an implementation, see {ERC165}." + }, + "fullyImplemented": false, + "id": 4547, + "linearizedBaseContracts": [ + 4547 + ], + "name": "IERC165", + "nameLocation": "433:7:18", + "nodeType": "ContractDefinition", + "nodes": [ + { + "documentation": { + "id": 4539, + "nodeType": "StructuredDocumentation", + "src": "447:340:18", + "text": " @dev Returns true if this contract implements the interface defined by\n `interfaceId`. See the corresponding\n https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n to learn more about how these ids are created.\n This function call must use less than 30 000 gas." + }, + "functionSelector": "01ffc9a7", + "id": 4546, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "supportsInterface", + "nameLocation": "801:17:18", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4542, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4541, + "mutability": "mutable", + "name": "interfaceId", + "nameLocation": "826:11:18", + "nodeType": "VariableDeclaration", + "scope": 4546, + "src": "819:18:18", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "typeName": { + "id": 4540, + "name": "bytes4", + "nodeType": "ElementaryTypeName", + "src": "819:6:18", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "visibility": "internal" + } + ], + "src": "818:20:18" + }, + "returnParameters": { + "id": 4545, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4544, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4546, + "src": "862:4:18", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 4543, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "862:4:18", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "861:6:18" + }, + "scope": 4547, + "src": "792:76:18", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + } + ], + "scope": 4548, + "src": "423:447:18", + "usedErrors": [], + "usedEvents": [] + } + ], + "src": "115:756:18" + }, + "id": 18 + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/math/Math.sol", + "exportedSymbols": { + "Math": [ + 6204 + ], + "Panic": [ + 1714 + ], + "SafeCast": [ + 7969 + ] + }, + "id": 6205, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 4549, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "103:24:19" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/Panic.sol", + "file": "../Panic.sol", + "id": 4551, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 6205, + "sourceUnit": 1715, + "src": "129:35:19", + "symbolAliases": [ + { + "foreign": { + "id": 4550, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "137:5:19", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/math/SafeCast.sol", + "file": "./SafeCast.sol", + "id": 4553, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 6205, + "sourceUnit": 7970, + "src": "165:40:19", + "symbolAliases": [ + { + "foreign": { + "id": 4552, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "173:8:19", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "Math", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 4554, + "nodeType": "StructuredDocumentation", + "src": "207:73:19", + "text": " @dev Standard math utilities missing in the Solidity language." + }, + "fullyImplemented": true, + "id": 6204, + "linearizedBaseContracts": [ + 6204 + ], + "name": "Math", + "nameLocation": "289:4:19", + "nodeType": "ContractDefinition", + "nodes": [ + { + "canonicalName": "Math.Rounding", + "id": 4559, + "members": [ + { + "id": 4555, + "name": "Floor", + "nameLocation": "324:5:19", + "nodeType": "EnumValue", + "src": "324:5:19" + }, + { + "id": 4556, + "name": "Ceil", + "nameLocation": "367:4:19", + "nodeType": "EnumValue", + "src": "367:4:19" + }, + { + "id": 4557, + "name": "Trunc", + "nameLocation": "409:5:19", + "nodeType": "EnumValue", + "src": "409:5:19" + }, + { + "id": 4558, + "name": "Expand", + "nameLocation": "439:6:19", + "nodeType": "EnumValue", + "src": "439:6:19" + } + ], + "name": "Rounding", + "nameLocation": "305:8:19", + "nodeType": "EnumDefinition", + "src": "300:169:19" + }, + { + "body": { + "id": 4572, + "nodeType": "Block", + "src": "731:112:19", + "statements": [ + { + "AST": { + "nativeSrc": "766:71:19", + "nodeType": "YulBlock", + "src": "766:71:19", + "statements": [ + { + "nativeSrc": "780:16:19", + "nodeType": "YulAssignment", + "src": "780:16:19", + "value": { + "arguments": [ + { + "name": "a", + "nativeSrc": "791:1:19", + "nodeType": "YulIdentifier", + "src": "791:1:19" + }, + { + "name": "b", + "nativeSrc": "794:1:19", + "nodeType": "YulIdentifier", + "src": "794:1:19" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "787:3:19", + "nodeType": "YulIdentifier", + "src": "787:3:19" + }, + "nativeSrc": "787:9:19", + "nodeType": "YulFunctionCall", + "src": "787:9:19" + }, + "variableNames": [ + { + "name": "low", + "nativeSrc": "780:3:19", + "nodeType": "YulIdentifier", + "src": "780:3:19" + } + ] + }, + { + "nativeSrc": "809:18:19", + "nodeType": "YulAssignment", + "src": "809:18:19", + "value": { + "arguments": [ + { + "name": "low", + "nativeSrc": "820:3:19", + "nodeType": "YulIdentifier", + "src": "820:3:19" + }, + { + "name": "a", + "nativeSrc": "825:1:19", + "nodeType": "YulIdentifier", + "src": "825:1:19" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "817:2:19", + "nodeType": "YulIdentifier", + "src": "817:2:19" + }, + "nativeSrc": "817:10:19", + "nodeType": "YulFunctionCall", + "src": "817:10:19" + }, + "variableNames": [ + { + "name": "high", + "nativeSrc": "809:4:19", + "nodeType": "YulIdentifier", + "src": "809:4:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4562, + "isOffset": false, + "isSlot": false, + "src": "791:1:19", + "valueSize": 1 + }, + { + "declaration": 4562, + "isOffset": false, + "isSlot": false, + "src": "825:1:19", + "valueSize": 1 + }, + { + "declaration": 4564, + "isOffset": false, + "isSlot": false, + "src": "794:1:19", + "valueSize": 1 + }, + { + "declaration": 4567, + "isOffset": false, + "isSlot": false, + "src": "809:4:19", + "valueSize": 1 + }, + { + "declaration": 4569, + "isOffset": false, + "isSlot": false, + "src": "780:3:19", + "valueSize": 1 + }, + { + "declaration": 4569, + "isOffset": false, + "isSlot": false, + "src": "820:3:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4571, + "nodeType": "InlineAssembly", + "src": "741:96:19" + } + ] + }, + "documentation": { + "id": 4560, + "nodeType": "StructuredDocumentation", + "src": "475:163:19", + "text": " @dev Return the 512-bit addition of two uint256.\n The result is stored in two 256 variables such that sum = high * 2²⁵⁶ + low." + }, + "id": 4573, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "add512", + "nameLocation": "652:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4565, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4562, + "mutability": "mutable", + "name": "a", + "nameLocation": "667:1:19", + "nodeType": "VariableDeclaration", + "scope": 4573, + "src": "659:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4561, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "659:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4564, + "mutability": "mutable", + "name": "b", + "nameLocation": "678:1:19", + "nodeType": "VariableDeclaration", + "scope": 4573, + "src": "670:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4563, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "670:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "658:22:19" + }, + "returnParameters": { + "id": 4570, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4567, + "mutability": "mutable", + "name": "high", + "nameLocation": "712:4:19", + "nodeType": "VariableDeclaration", + "scope": 4573, + "src": "704:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4566, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "704:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4569, + "mutability": "mutable", + "name": "low", + "nameLocation": "726:3:19", + "nodeType": "VariableDeclaration", + "scope": 4573, + "src": "718:11:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4568, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "718:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "703:27:19" + }, + "scope": 6204, + "src": "643:200:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4586, + "nodeType": "Block", + "src": "1115:462:19", + "statements": [ + { + "AST": { + "nativeSrc": "1437:134:19", + "nodeType": "YulBlock", + "src": "1437:134:19", + "statements": [ + { + "nativeSrc": "1451:30:19", + "nodeType": "YulVariableDeclaration", + "src": "1451:30:19", + "value": { + "arguments": [ + { + "name": "a", + "nativeSrc": "1468:1:19", + "nodeType": "YulIdentifier", + "src": "1468:1:19" + }, + { + "name": "b", + "nativeSrc": "1471:1:19", + "nodeType": "YulIdentifier", + "src": "1471:1:19" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1478:1:19", + "nodeType": "YulLiteral", + "src": "1478:1:19", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "1474:3:19", + "nodeType": "YulIdentifier", + "src": "1474:3:19" + }, + "nativeSrc": "1474:6:19", + "nodeType": "YulFunctionCall", + "src": "1474:6:19" + } + ], + "functionName": { + "name": "mulmod", + "nativeSrc": "1461:6:19", + "nodeType": "YulIdentifier", + "src": "1461:6:19" + }, + "nativeSrc": "1461:20:19", + "nodeType": "YulFunctionCall", + "src": "1461:20:19" + }, + "variables": [ + { + "name": "mm", + "nativeSrc": "1455:2:19", + "nodeType": "YulTypedName", + "src": "1455:2:19", + "type": "" + } + ] + }, + { + "nativeSrc": "1494:16:19", + "nodeType": "YulAssignment", + "src": "1494:16:19", + "value": { + "arguments": [ + { + "name": "a", + "nativeSrc": "1505:1:19", + "nodeType": "YulIdentifier", + "src": "1505:1:19" + }, + { + "name": "b", + "nativeSrc": "1508:1:19", + "nodeType": "YulIdentifier", + "src": "1508:1:19" + } + ], + "functionName": { + "name": "mul", + "nativeSrc": "1501:3:19", + "nodeType": "YulIdentifier", + "src": "1501:3:19" + }, + "nativeSrc": "1501:9:19", + "nodeType": "YulFunctionCall", + "src": "1501:9:19" + }, + "variableNames": [ + { + "name": "low", + "nativeSrc": "1494:3:19", + "nodeType": "YulIdentifier", + "src": "1494:3:19" + } + ] + }, + { + "nativeSrc": "1523:38:19", + "nodeType": "YulAssignment", + "src": "1523:38:19", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "mm", + "nativeSrc": "1539:2:19", + "nodeType": "YulIdentifier", + "src": "1539:2:19" + }, + { + "name": "low", + "nativeSrc": "1543:3:19", + "nodeType": "YulIdentifier", + "src": "1543:3:19" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "1535:3:19", + "nodeType": "YulIdentifier", + "src": "1535:3:19" + }, + "nativeSrc": "1535:12:19", + "nodeType": "YulFunctionCall", + "src": "1535:12:19" + }, + { + "arguments": [ + { + "name": "mm", + "nativeSrc": "1552:2:19", + "nodeType": "YulIdentifier", + "src": "1552:2:19" + }, + { + "name": "low", + "nativeSrc": "1556:3:19", + "nodeType": "YulIdentifier", + "src": "1556:3:19" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "1549:2:19", + "nodeType": "YulIdentifier", + "src": "1549:2:19" + }, + "nativeSrc": "1549:11:19", + "nodeType": "YulFunctionCall", + "src": "1549:11:19" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "1531:3:19", + "nodeType": "YulIdentifier", + "src": "1531:3:19" + }, + "nativeSrc": "1531:30:19", + "nodeType": "YulFunctionCall", + "src": "1531:30:19" + }, + "variableNames": [ + { + "name": "high", + "nativeSrc": "1523:4:19", + "nodeType": "YulIdentifier", + "src": "1523:4:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4576, + "isOffset": false, + "isSlot": false, + "src": "1468:1:19", + "valueSize": 1 + }, + { + "declaration": 4576, + "isOffset": false, + "isSlot": false, + "src": "1505:1:19", + "valueSize": 1 + }, + { + "declaration": 4578, + "isOffset": false, + "isSlot": false, + "src": "1471:1:19", + "valueSize": 1 + }, + { + "declaration": 4578, + "isOffset": false, + "isSlot": false, + "src": "1508:1:19", + "valueSize": 1 + }, + { + "declaration": 4581, + "isOffset": false, + "isSlot": false, + "src": "1523:4:19", + "valueSize": 1 + }, + { + "declaration": 4583, + "isOffset": false, + "isSlot": false, + "src": "1494:3:19", + "valueSize": 1 + }, + { + "declaration": 4583, + "isOffset": false, + "isSlot": false, + "src": "1543:3:19", + "valueSize": 1 + }, + { + "declaration": 4583, + "isOffset": false, + "isSlot": false, + "src": "1556:3:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4585, + "nodeType": "InlineAssembly", + "src": "1412:159:19" + } + ] + }, + "documentation": { + "id": 4574, + "nodeType": "StructuredDocumentation", + "src": "849:173:19", + "text": " @dev Return the 512-bit multiplication of two uint256.\n The result is stored in two 256 variables such that product = high * 2²⁵⁶ + low." + }, + "id": 4587, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "mul512", + "nameLocation": "1036:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4579, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4576, + "mutability": "mutable", + "name": "a", + "nameLocation": "1051:1:19", + "nodeType": "VariableDeclaration", + "scope": 4587, + "src": "1043:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4575, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1043:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4578, + "mutability": "mutable", + "name": "b", + "nameLocation": "1062:1:19", + "nodeType": "VariableDeclaration", + "scope": 4587, + "src": "1054:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4577, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1054:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1042:22:19" + }, + "returnParameters": { + "id": 4584, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4581, + "mutability": "mutable", + "name": "high", + "nameLocation": "1096:4:19", + "nodeType": "VariableDeclaration", + "scope": 4587, + "src": "1088:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4580, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1088:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4583, + "mutability": "mutable", + "name": "low", + "nameLocation": "1110:3:19", + "nodeType": "VariableDeclaration", + "scope": 4587, + "src": "1102:11:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4582, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1102:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1087:27:19" + }, + "scope": 6204, + "src": "1027:550:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4621, + "nodeType": "Block", + "src": "1784:149:19", + "statements": [ + { + "id": 4620, + "nodeType": "UncheckedBlock", + "src": "1794:133:19", + "statements": [ + { + "assignments": [ + 4600 + ], + "declarations": [ + { + "constant": false, + "id": 4600, + "mutability": "mutable", + "name": "c", + "nameLocation": "1826:1:19", + "nodeType": "VariableDeclaration", + "scope": 4620, + "src": "1818:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4599, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1818:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 4604, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4603, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4601, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4590, + "src": "1830:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "id": 4602, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4592, + "src": "1834:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1830:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1818:17:19" + }, + { + "expression": { + "id": 4609, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4605, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4595, + "src": "1849:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4608, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4606, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4600, + "src": "1859:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "id": 4607, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4590, + "src": "1864:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1859:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "1849:16:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4610, + "nodeType": "ExpressionStatement", + "src": "1849:16:19" + }, + { + "expression": { + "id": 4618, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4611, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4597, + "src": "1879:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4617, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4612, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4600, + "src": "1888:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "arguments": [ + { + "id": 4615, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4595, + "src": "1908:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 4613, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "1892:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 4614, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "1901:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "1892:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 4616, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1892:24:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1888:28:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1879:37:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 4619, + "nodeType": "ExpressionStatement", + "src": "1879:37:19" + } + ] + } + ] + }, + "documentation": { + "id": 4588, + "nodeType": "StructuredDocumentation", + "src": "1583:105:19", + "text": " @dev Returns the addition of two unsigned integers, with a success flag (no overflow)." + }, + "id": 4622, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryAdd", + "nameLocation": "1702:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4593, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4590, + "mutability": "mutable", + "name": "a", + "nameLocation": "1717:1:19", + "nodeType": "VariableDeclaration", + "scope": 4622, + "src": "1709:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4589, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1709:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4592, + "mutability": "mutable", + "name": "b", + "nameLocation": "1728:1:19", + "nodeType": "VariableDeclaration", + "scope": 4622, + "src": "1720:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4591, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1720:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1708:22:19" + }, + "returnParameters": { + "id": 4598, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4595, + "mutability": "mutable", + "name": "success", + "nameLocation": "1759:7:19", + "nodeType": "VariableDeclaration", + "scope": 4622, + "src": "1754:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 4594, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "1754:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4597, + "mutability": "mutable", + "name": "result", + "nameLocation": "1776:6:19", + "nodeType": "VariableDeclaration", + "scope": 4622, + "src": "1768:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4596, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1768:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1753:30:19" + }, + "scope": 6204, + "src": "1693:240:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4656, + "nodeType": "Block", + "src": "2143:149:19", + "statements": [ + { + "id": 4655, + "nodeType": "UncheckedBlock", + "src": "2153:133:19", + "statements": [ + { + "assignments": [ + 4635 + ], + "declarations": [ + { + "constant": false, + "id": 4635, + "mutability": "mutable", + "name": "c", + "nameLocation": "2185:1:19", + "nodeType": "VariableDeclaration", + "scope": 4655, + "src": "2177:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4634, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2177:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 4639, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4638, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4636, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4625, + "src": "2189:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "id": 4637, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4627, + "src": "2193:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2189:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2177:17:19" + }, + { + "expression": { + "id": 4644, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4640, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4630, + "src": "2208:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4643, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4641, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4635, + "src": "2218:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<=", + "rightExpression": { + "id": 4642, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4625, + "src": "2223:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2218:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "2208:16:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4645, + "nodeType": "ExpressionStatement", + "src": "2208:16:19" + }, + { + "expression": { + "id": 4653, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4646, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4632, + "src": "2238:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4652, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4647, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4635, + "src": "2247:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "arguments": [ + { + "id": 4650, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4630, + "src": "2267:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 4648, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "2251:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 4649, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2260:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "2251:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 4651, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2251:24:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2247:28:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2238:37:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 4654, + "nodeType": "ExpressionStatement", + "src": "2238:37:19" + } + ] + } + ] + }, + "documentation": { + "id": 4623, + "nodeType": "StructuredDocumentation", + "src": "1939:108:19", + "text": " @dev Returns the subtraction of two unsigned integers, with a success flag (no overflow)." + }, + "id": 4657, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "trySub", + "nameLocation": "2061:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4628, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4625, + "mutability": "mutable", + "name": "a", + "nameLocation": "2076:1:19", + "nodeType": "VariableDeclaration", + "scope": 4657, + "src": "2068:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4624, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2068:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4627, + "mutability": "mutable", + "name": "b", + "nameLocation": "2087:1:19", + "nodeType": "VariableDeclaration", + "scope": 4657, + "src": "2079:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4626, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2079:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2067:22:19" + }, + "returnParameters": { + "id": 4633, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4630, + "mutability": "mutable", + "name": "success", + "nameLocation": "2118:7:19", + "nodeType": "VariableDeclaration", + "scope": 4657, + "src": "2113:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 4629, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "2113:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4632, + "mutability": "mutable", + "name": "result", + "nameLocation": "2135:6:19", + "nodeType": "VariableDeclaration", + "scope": 4657, + "src": "2127:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4631, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2127:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2112:30:19" + }, + "scope": 6204, + "src": "2052:240:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4686, + "nodeType": "Block", + "src": "2505:391:19", + "statements": [ + { + "id": 4685, + "nodeType": "UncheckedBlock", + "src": "2515:375:19", + "statements": [ + { + "assignments": [ + 4670 + ], + "declarations": [ + { + "constant": false, + "id": 4670, + "mutability": "mutable", + "name": "c", + "nameLocation": "2547:1:19", + "nodeType": "VariableDeclaration", + "scope": 4685, + "src": "2539:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4669, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2539:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 4674, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4673, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4671, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4660, + "src": "2551:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 4672, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4662, + "src": "2555:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2551:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2539:17:19" + }, + { + "AST": { + "nativeSrc": "2595:188:19", + "nodeType": "YulBlock", + "src": "2595:188:19", + "statements": [ + { + "nativeSrc": "2727:42:19", + "nodeType": "YulAssignment", + "src": "2727:42:19", + "value": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "c", + "nativeSrc": "2748:1:19", + "nodeType": "YulIdentifier", + "src": "2748:1:19" + }, + { + "name": "a", + "nativeSrc": "2751:1:19", + "nodeType": "YulIdentifier", + "src": "2751:1:19" + } + ], + "functionName": { + "name": "div", + "nativeSrc": "2744:3:19", + "nodeType": "YulIdentifier", + "src": "2744:3:19" + }, + "nativeSrc": "2744:9:19", + "nodeType": "YulFunctionCall", + "src": "2744:9:19" + }, + { + "name": "b", + "nativeSrc": "2755:1:19", + "nodeType": "YulIdentifier", + "src": "2755:1:19" + } + ], + "functionName": { + "name": "eq", + "nativeSrc": "2741:2:19", + "nodeType": "YulIdentifier", + "src": "2741:2:19" + }, + "nativeSrc": "2741:16:19", + "nodeType": "YulFunctionCall", + "src": "2741:16:19" + }, + { + "arguments": [ + { + "name": "a", + "nativeSrc": "2766:1:19", + "nodeType": "YulIdentifier", + "src": "2766:1:19" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "2759:6:19", + "nodeType": "YulIdentifier", + "src": "2759:6:19" + }, + "nativeSrc": "2759:9:19", + "nodeType": "YulFunctionCall", + "src": "2759:9:19" + } + ], + "functionName": { + "name": "or", + "nativeSrc": "2738:2:19", + "nodeType": "YulIdentifier", + "src": "2738:2:19" + }, + "nativeSrc": "2738:31:19", + "nodeType": "YulFunctionCall", + "src": "2738:31:19" + }, + "variableNames": [ + { + "name": "success", + "nativeSrc": "2727:7:19", + "nodeType": "YulIdentifier", + "src": "2727:7:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4660, + "isOffset": false, + "isSlot": false, + "src": "2751:1:19", + "valueSize": 1 + }, + { + "declaration": 4660, + "isOffset": false, + "isSlot": false, + "src": "2766:1:19", + "valueSize": 1 + }, + { + "declaration": 4662, + "isOffset": false, + "isSlot": false, + "src": "2755:1:19", + "valueSize": 1 + }, + { + "declaration": 4670, + "isOffset": false, + "isSlot": false, + "src": "2748:1:19", + "valueSize": 1 + }, + { + "declaration": 4665, + "isOffset": false, + "isSlot": false, + "src": "2727:7:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4675, + "nodeType": "InlineAssembly", + "src": "2570:213:19" + }, + { + "expression": { + "id": 4683, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4676, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4667, + "src": "2842:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4682, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4677, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4670, + "src": "2851:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "arguments": [ + { + "id": 4680, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4665, + "src": "2871:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 4678, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "2855:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 4679, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2864:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "2855:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 4681, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2855:24:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2851:28:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2842:37:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 4684, + "nodeType": "ExpressionStatement", + "src": "2842:37:19" + } + ] + } + ] + }, + "documentation": { + "id": 4658, + "nodeType": "StructuredDocumentation", + "src": "2298:111:19", + "text": " @dev Returns the multiplication of two unsigned integers, with a success flag (no overflow)." + }, + "id": 4687, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryMul", + "nameLocation": "2423:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4663, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4660, + "mutability": "mutable", + "name": "a", + "nameLocation": "2438:1:19", + "nodeType": "VariableDeclaration", + "scope": 4687, + "src": "2430:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4659, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2430:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4662, + "mutability": "mutable", + "name": "b", + "nameLocation": "2449:1:19", + "nodeType": "VariableDeclaration", + "scope": 4687, + "src": "2441:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4661, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2441:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2429:22:19" + }, + "returnParameters": { + "id": 4668, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4665, + "mutability": "mutable", + "name": "success", + "nameLocation": "2480:7:19", + "nodeType": "VariableDeclaration", + "scope": 4687, + "src": "2475:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 4664, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "2475:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4667, + "mutability": "mutable", + "name": "result", + "nameLocation": "2497:6:19", + "nodeType": "VariableDeclaration", + "scope": 4687, + "src": "2489:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4666, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2489:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2474:30:19" + }, + "scope": 6204, + "src": "2414:482:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4707, + "nodeType": "Block", + "src": "3111:231:19", + "statements": [ + { + "id": 4706, + "nodeType": "UncheckedBlock", + "src": "3121:215:19", + "statements": [ + { + "expression": { + "id": 4703, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4699, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4695, + "src": "3145:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4702, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4700, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4692, + "src": "3155:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 4701, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3159:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "3155:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "3145:15:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4704, + "nodeType": "ExpressionStatement", + "src": "3145:15:19" + }, + { + "AST": { + "nativeSrc": "3199:127:19", + "nodeType": "YulBlock", + "src": "3199:127:19", + "statements": [ + { + "nativeSrc": "3293:19:19", + "nodeType": "YulAssignment", + "src": "3293:19:19", + "value": { + "arguments": [ + { + "name": "a", + "nativeSrc": "3307:1:19", + "nodeType": "YulIdentifier", + "src": "3307:1:19" + }, + { + "name": "b", + "nativeSrc": "3310:1:19", + "nodeType": "YulIdentifier", + "src": "3310:1:19" + } + ], + "functionName": { + "name": "div", + "nativeSrc": "3303:3:19", + "nodeType": "YulIdentifier", + "src": "3303:3:19" + }, + "nativeSrc": "3303:9:19", + "nodeType": "YulFunctionCall", + "src": "3303:9:19" + }, + "variableNames": [ + { + "name": "result", + "nativeSrc": "3293:6:19", + "nodeType": "YulIdentifier", + "src": "3293:6:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4690, + "isOffset": false, + "isSlot": false, + "src": "3307:1:19", + "valueSize": 1 + }, + { + "declaration": 4692, + "isOffset": false, + "isSlot": false, + "src": "3310:1:19", + "valueSize": 1 + }, + { + "declaration": 4697, + "isOffset": false, + "isSlot": false, + "src": "3293:6:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4705, + "nodeType": "InlineAssembly", + "src": "3174:152:19" + } + ] + } + ] + }, + "documentation": { + "id": 4688, + "nodeType": "StructuredDocumentation", + "src": "2902:113:19", + "text": " @dev Returns the division of two unsigned integers, with a success flag (no division by zero)." + }, + "id": 4708, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryDiv", + "nameLocation": "3029:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4693, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4690, + "mutability": "mutable", + "name": "a", + "nameLocation": "3044:1:19", + "nodeType": "VariableDeclaration", + "scope": 4708, + "src": "3036:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4689, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3036:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4692, + "mutability": "mutable", + "name": "b", + "nameLocation": "3055:1:19", + "nodeType": "VariableDeclaration", + "scope": 4708, + "src": "3047:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4691, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3047:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3035:22:19" + }, + "returnParameters": { + "id": 4698, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4695, + "mutability": "mutable", + "name": "success", + "nameLocation": "3086:7:19", + "nodeType": "VariableDeclaration", + "scope": 4708, + "src": "3081:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 4694, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "3081:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4697, + "mutability": "mutable", + "name": "result", + "nameLocation": "3103:6:19", + "nodeType": "VariableDeclaration", + "scope": 4708, + "src": "3095:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4696, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3095:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3080:30:19" + }, + "scope": 6204, + "src": "3020:322:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4728, + "nodeType": "Block", + "src": "3567:231:19", + "statements": [ + { + "id": 4727, + "nodeType": "UncheckedBlock", + "src": "3577:215:19", + "statements": [ + { + "expression": { + "id": 4724, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 4720, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4716, + "src": "3601:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4723, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4721, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4713, + "src": "3611:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 4722, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3615:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "3611:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "3601:15:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4725, + "nodeType": "ExpressionStatement", + "src": "3601:15:19" + }, + { + "AST": { + "nativeSrc": "3655:127:19", + "nodeType": "YulBlock", + "src": "3655:127:19", + "statements": [ + { + "nativeSrc": "3749:19:19", + "nodeType": "YulAssignment", + "src": "3749:19:19", + "value": { + "arguments": [ + { + "name": "a", + "nativeSrc": "3763:1:19", + "nodeType": "YulIdentifier", + "src": "3763:1:19" + }, + { + "name": "b", + "nativeSrc": "3766:1:19", + "nodeType": "YulIdentifier", + "src": "3766:1:19" + } + ], + "functionName": { + "name": "mod", + "nativeSrc": "3759:3:19", + "nodeType": "YulIdentifier", + "src": "3759:3:19" + }, + "nativeSrc": "3759:9:19", + "nodeType": "YulFunctionCall", + "src": "3759:9:19" + }, + "variableNames": [ + { + "name": "result", + "nativeSrc": "3749:6:19", + "nodeType": "YulIdentifier", + "src": "3749:6:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4711, + "isOffset": false, + "isSlot": false, + "src": "3763:1:19", + "valueSize": 1 + }, + { + "declaration": 4713, + "isOffset": false, + "isSlot": false, + "src": "3766:1:19", + "valueSize": 1 + }, + { + "declaration": 4718, + "isOffset": false, + "isSlot": false, + "src": "3749:6:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4726, + "nodeType": "InlineAssembly", + "src": "3630:152:19" + } + ] + } + ] + }, + "documentation": { + "id": 4709, + "nodeType": "StructuredDocumentation", + "src": "3348:123:19", + "text": " @dev Returns the remainder of dividing two unsigned integers, with a success flag (no division by zero)." + }, + "id": 4729, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryMod", + "nameLocation": "3485:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4714, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4711, + "mutability": "mutable", + "name": "a", + "nameLocation": "3500:1:19", + "nodeType": "VariableDeclaration", + "scope": 4729, + "src": "3492:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4710, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3492:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4713, + "mutability": "mutable", + "name": "b", + "nameLocation": "3511:1:19", + "nodeType": "VariableDeclaration", + "scope": 4729, + "src": "3503:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4712, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3503:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3491:22:19" + }, + "returnParameters": { + "id": 4719, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4716, + "mutability": "mutable", + "name": "success", + "nameLocation": "3542:7:19", + "nodeType": "VariableDeclaration", + "scope": 4729, + "src": "3537:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 4715, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "3537:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4718, + "mutability": "mutable", + "name": "result", + "nameLocation": "3559:6:19", + "nodeType": "VariableDeclaration", + "scope": 4729, + "src": "3551:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4717, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3551:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3536:30:19" + }, + "scope": 6204, + "src": "3476:322:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4758, + "nodeType": "Block", + "src": "3989:122:19", + "statements": [ + { + "assignments": [ + 4740, + 4742 + ], + "declarations": [ + { + "constant": false, + "id": 4740, + "mutability": "mutable", + "name": "success", + "nameLocation": "4005:7:19", + "nodeType": "VariableDeclaration", + "scope": 4758, + "src": "4000:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 4739, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "4000:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4742, + "mutability": "mutable", + "name": "result", + "nameLocation": "4022:6:19", + "nodeType": "VariableDeclaration", + "scope": 4758, + "src": "4014:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4741, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4014:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 4747, + "initialValue": { + "arguments": [ + { + "id": 4744, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4732, + "src": "4039:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 4745, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4734, + "src": "4042:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4743, + "name": "tryAdd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4622, + "src": "4032:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 4746, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4032:12:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3999:45:19" + }, + { + "expression": { + "arguments": [ + { + "id": 4749, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4740, + "src": "4069:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "id": 4750, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4742, + "src": "4078:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "arguments": [ + { + "id": 4753, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4091:7:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 4752, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4091:7:19", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + } + ], + "id": 4751, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "4086:4:19", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 4754, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4086:13:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint256", + "typeString": "type(uint256)" + } + }, + "id": 4755, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "4100:3:19", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "4086:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4748, + "name": "ternary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4836, + "src": "4061:7:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bool,uint256,uint256) pure returns (uint256)" + } + }, + "id": 4756, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4061:43:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4738, + "id": 4757, + "nodeType": "Return", + "src": "4054:50:19" + } + ] + }, + "documentation": { + "id": 4730, + "nodeType": "StructuredDocumentation", + "src": "3804:103:19", + "text": " @dev Unsigned saturating addition, bounds to `2²⁵⁶ - 1` instead of overflowing." + }, + "id": 4759, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "saturatingAdd", + "nameLocation": "3921:13:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4735, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4732, + "mutability": "mutable", + "name": "a", + "nameLocation": "3943:1:19", + "nodeType": "VariableDeclaration", + "scope": 4759, + "src": "3935:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4731, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3935:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4734, + "mutability": "mutable", + "name": "b", + "nameLocation": "3954:1:19", + "nodeType": "VariableDeclaration", + "scope": 4759, + "src": "3946:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4733, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3946:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3934:22:19" + }, + "returnParameters": { + "id": 4738, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4737, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4759, + "src": "3980:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4736, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3980:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3979:9:19" + }, + "scope": 6204, + "src": "3912:199:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4778, + "nodeType": "Block", + "src": "4294:73:19", + "statements": [ + { + "assignments": [ + null, + 4770 + ], + "declarations": [ + null, + { + "constant": false, + "id": 4770, + "mutability": "mutable", + "name": "result", + "nameLocation": "4315:6:19", + "nodeType": "VariableDeclaration", + "scope": 4778, + "src": "4307:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4769, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4307:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 4775, + "initialValue": { + "arguments": [ + { + "id": 4772, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4762, + "src": "4332:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 4773, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4764, + "src": "4335:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4771, + "name": "trySub", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4657, + "src": "4325:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 4774, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4325:12:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4304:33:19" + }, + { + "expression": { + "id": 4776, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4770, + "src": "4354:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4768, + "id": 4777, + "nodeType": "Return", + "src": "4347:13:19" + } + ] + }, + "documentation": { + "id": 4760, + "nodeType": "StructuredDocumentation", + "src": "4117:95:19", + "text": " @dev Unsigned saturating subtraction, bounds to zero instead of overflowing." + }, + "id": 4779, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "saturatingSub", + "nameLocation": "4226:13:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4765, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4762, + "mutability": "mutable", + "name": "a", + "nameLocation": "4248:1:19", + "nodeType": "VariableDeclaration", + "scope": 4779, + "src": "4240:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4761, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4240:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4764, + "mutability": "mutable", + "name": "b", + "nameLocation": "4259:1:19", + "nodeType": "VariableDeclaration", + "scope": 4779, + "src": "4251:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4763, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4251:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4239:22:19" + }, + "returnParameters": { + "id": 4768, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4767, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4779, + "src": "4285:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4766, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4285:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4284:9:19" + }, + "scope": 6204, + "src": "4217:150:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4808, + "nodeType": "Block", + "src": "4564:122:19", + "statements": [ + { + "assignments": [ + 4790, + 4792 + ], + "declarations": [ + { + "constant": false, + "id": 4790, + "mutability": "mutable", + "name": "success", + "nameLocation": "4580:7:19", + "nodeType": "VariableDeclaration", + "scope": 4808, + "src": "4575:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 4789, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "4575:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4792, + "mutability": "mutable", + "name": "result", + "nameLocation": "4597:6:19", + "nodeType": "VariableDeclaration", + "scope": 4808, + "src": "4589:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4791, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4589:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 4797, + "initialValue": { + "arguments": [ + { + "id": 4794, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4782, + "src": "4614:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 4795, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4784, + "src": "4617:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4793, + "name": "tryMul", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4687, + "src": "4607:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (bool,uint256)" + } + }, + "id": 4796, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4607:12:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4574:45:19" + }, + { + "expression": { + "arguments": [ + { + "id": 4799, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4790, + "src": "4644:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "id": 4800, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4792, + "src": "4653:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "arguments": [ + { + "id": 4803, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4666:7:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 4802, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4666:7:19", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + } + ], + "id": 4801, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "4661:4:19", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 4804, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4661:13:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint256", + "typeString": "type(uint256)" + } + }, + "id": 4805, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "4675:3:19", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "4661:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4798, + "name": "ternary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4836, + "src": "4636:7:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bool,uint256,uint256) pure returns (uint256)" + } + }, + "id": 4806, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4636:43:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4788, + "id": 4807, + "nodeType": "Return", + "src": "4629:50:19" + } + ] + }, + "documentation": { + "id": 4780, + "nodeType": "StructuredDocumentation", + "src": "4373:109:19", + "text": " @dev Unsigned saturating multiplication, bounds to `2²⁵⁶ - 1` instead of overflowing." + }, + "id": 4809, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "saturatingMul", + "nameLocation": "4496:13:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4785, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4782, + "mutability": "mutable", + "name": "a", + "nameLocation": "4518:1:19", + "nodeType": "VariableDeclaration", + "scope": 4809, + "src": "4510:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4781, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4510:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4784, + "mutability": "mutable", + "name": "b", + "nameLocation": "4529:1:19", + "nodeType": "VariableDeclaration", + "scope": 4809, + "src": "4521:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4783, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4521:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4509:22:19" + }, + "returnParameters": { + "id": 4788, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4787, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4809, + "src": "4555:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4786, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4555:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4554:9:19" + }, + "scope": 6204, + "src": "4487:199:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4835, + "nodeType": "Block", + "src": "5174:207:19", + "statements": [ + { + "id": 4834, + "nodeType": "UncheckedBlock", + "src": "5184:191:19", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4832, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4821, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4816, + "src": "5322:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "^", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4830, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4824, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4822, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4814, + "src": "5328:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "^", + "rightExpression": { + "id": 4823, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4816, + "src": "5332:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5328:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 4825, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "5327:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "arguments": [ + { + "id": 4828, + "name": "condition", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4812, + "src": "5353:9:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 4826, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "5337:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 4827, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "5346:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "5337:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 4829, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5337:26:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5327:36:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 4831, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "5326:38:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5322:42:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4820, + "id": 4833, + "nodeType": "Return", + "src": "5315:49:19" + } + ] + } + ] + }, + "documentation": { + "id": 4810, + "nodeType": "StructuredDocumentation", + "src": "4692:390:19", + "text": " @dev Branchless ternary evaluation for `condition ? a : b`. Gas costs are constant.\n IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.\n However, the compiler may optimize Solidity ternary operations (i.e. `condition ? a : b`) to only compute\n one branch when needed, making this function more expensive." + }, + "id": 4836, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ternary", + "nameLocation": "5096:7:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4817, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4812, + "mutability": "mutable", + "name": "condition", + "nameLocation": "5109:9:19", + "nodeType": "VariableDeclaration", + "scope": 4836, + "src": "5104:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 4811, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "5104:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4814, + "mutability": "mutable", + "name": "a", + "nameLocation": "5128:1:19", + "nodeType": "VariableDeclaration", + "scope": 4836, + "src": "5120:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4813, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5120:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4816, + "mutability": "mutable", + "name": "b", + "nameLocation": "5139:1:19", + "nodeType": "VariableDeclaration", + "scope": 4836, + "src": "5131:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4815, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5131:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5103:38:19" + }, + "returnParameters": { + "id": 4820, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4819, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4836, + "src": "5165:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4818, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5165:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5164:9:19" + }, + "scope": 6204, + "src": "5087:294:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4854, + "nodeType": "Block", + "src": "5518:44:19", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4849, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4847, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4839, + "src": "5543:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "id": 4848, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4841, + "src": "5547:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5543:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "id": 4850, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4839, + "src": "5550:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 4851, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4841, + "src": "5553:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4846, + "name": "ternary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4836, + "src": "5535:7:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bool,uint256,uint256) pure returns (uint256)" + } + }, + "id": 4852, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5535:20:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4845, + "id": 4853, + "nodeType": "Return", + "src": "5528:27:19" + } + ] + }, + "documentation": { + "id": 4837, + "nodeType": "StructuredDocumentation", + "src": "5387:59:19", + "text": " @dev Returns the largest of two numbers." + }, + "id": 4855, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "max", + "nameLocation": "5460:3:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4842, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4839, + "mutability": "mutable", + "name": "a", + "nameLocation": "5472:1:19", + "nodeType": "VariableDeclaration", + "scope": 4855, + "src": "5464:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4838, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5464:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4841, + "mutability": "mutable", + "name": "b", + "nameLocation": "5483:1:19", + "nodeType": "VariableDeclaration", + "scope": 4855, + "src": "5475:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4840, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5475:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5463:22:19" + }, + "returnParameters": { + "id": 4845, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4844, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4855, + "src": "5509:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4843, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5509:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5508:9:19" + }, + "scope": 6204, + "src": "5451:111:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4873, + "nodeType": "Block", + "src": "5700:44:19", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4868, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4866, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4858, + "src": "5725:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 4867, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4860, + "src": "5729:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5725:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "id": 4869, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4858, + "src": "5732:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 4870, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4860, + "src": "5735:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4865, + "name": "ternary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4836, + "src": "5717:7:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bool,uint256,uint256) pure returns (uint256)" + } + }, + "id": 4871, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5717:20:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4864, + "id": 4872, + "nodeType": "Return", + "src": "5710:27:19" + } + ] + }, + "documentation": { + "id": 4856, + "nodeType": "StructuredDocumentation", + "src": "5568:60:19", + "text": " @dev Returns the smallest of two numbers." + }, + "id": 4874, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "min", + "nameLocation": "5642:3:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4861, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4858, + "mutability": "mutable", + "name": "a", + "nameLocation": "5654:1:19", + "nodeType": "VariableDeclaration", + "scope": 4874, + "src": "5646:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4857, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5646:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4860, + "mutability": "mutable", + "name": "b", + "nameLocation": "5665:1:19", + "nodeType": "VariableDeclaration", + "scope": 4874, + "src": "5657:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4859, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5657:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5645:22:19" + }, + "returnParameters": { + "id": 4864, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4863, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4874, + "src": "5691:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4862, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5691:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5690:9:19" + }, + "scope": 6204, + "src": "5633:111:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4897, + "nodeType": "Block", + "src": "5928:120:19", + "statements": [ + { + "id": 4896, + "nodeType": "UncheckedBlock", + "src": "5938:104:19", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4894, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4886, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4884, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4877, + "src": "6011:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "id": 4885, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4879, + "src": "6015:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6011:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 4887, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "6010:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4893, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4890, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4888, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4877, + "src": "6021:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "^", + "rightExpression": { + "id": 4889, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4879, + "src": "6025:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6021:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 4891, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "6020:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "hexValue": "32", + "id": 4892, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6030:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "6020:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6010:21:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4883, + "id": 4895, + "nodeType": "Return", + "src": "6003:28:19" + } + ] + } + ] + }, + "documentation": { + "id": 4875, + "nodeType": "StructuredDocumentation", + "src": "5750:102:19", + "text": " @dev Returns the average of two numbers. The result is rounded towards\n zero." + }, + "id": 4898, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "average", + "nameLocation": "5866:7:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4880, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4877, + "mutability": "mutable", + "name": "a", + "nameLocation": "5882:1:19", + "nodeType": "VariableDeclaration", + "scope": 4898, + "src": "5874:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4876, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5874:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4879, + "mutability": "mutable", + "name": "b", + "nameLocation": "5893:1:19", + "nodeType": "VariableDeclaration", + "scope": 4898, + "src": "5885:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4878, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5885:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5873:22:19" + }, + "returnParameters": { + "id": 4883, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4882, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4898, + "src": "5919:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4881, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5919:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5918:9:19" + }, + "scope": 6204, + "src": "5857:191:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 4938, + "nodeType": "Block", + "src": "6340:633:19", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4910, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4908, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4903, + "src": "6354:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 4909, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6359:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "6354:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4919, + "nodeType": "IfStatement", + "src": "6350:150:19", + "trueBody": { + "id": 4918, + "nodeType": "Block", + "src": "6362:138:19", + "statements": [ + { + "expression": { + "arguments": [ + { + "expression": { + "id": 4914, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "6466:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 4915, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "6472:16:19", + "memberName": "DIVISION_BY_ZERO", + "nodeType": "MemberAccess", + "referencedDeclaration": 1681, + "src": "6466:22:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 4911, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "6454:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 4913, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6460:5:19", + "memberName": "panic", + "nodeType": "MemberAccess", + "referencedDeclaration": 1713, + "src": "6454:11:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$__$", + "typeString": "function (uint256) pure" + } + }, + "id": 4916, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6454:35:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 4917, + "nodeType": "ExpressionStatement", + "src": "6454:35:19" + } + ] + } + }, + { + "id": 4937, + "nodeType": "UncheckedBlock", + "src": "6883:84:19", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4935, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4924, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4922, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4901, + "src": "6930:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 4923, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6934:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "6930:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 4920, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "6914:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 4921, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6923:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "6914:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 4925, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6914:22:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4933, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4931, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4928, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4926, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4901, + "src": "6941:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "hexValue": "31", + "id": 4927, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6945:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "6941:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 4929, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "6940:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 4930, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4903, + "src": "6950:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6940:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "31", + "id": 4932, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6954:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "6940:15:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 4934, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "6939:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6914:42:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4907, + "id": 4936, + "nodeType": "Return", + "src": "6907:49:19" + } + ] + } + ] + }, + "documentation": { + "id": 4899, + "nodeType": "StructuredDocumentation", + "src": "6054:210:19", + "text": " @dev Returns the ceiling of the division of two numbers.\n This differs from standard division with `/` in that it rounds towards infinity instead\n of rounding towards zero." + }, + "id": 4939, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ceilDiv", + "nameLocation": "6278:7:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4904, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4901, + "mutability": "mutable", + "name": "a", + "nameLocation": "6294:1:19", + "nodeType": "VariableDeclaration", + "scope": 4939, + "src": "6286:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4900, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6286:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4903, + "mutability": "mutable", + "name": "b", + "nameLocation": "6305:1:19", + "nodeType": "VariableDeclaration", + "scope": 4939, + "src": "6297:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4902, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6297:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "6285:22:19" + }, + "returnParameters": { + "id": 4907, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4906, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 4939, + "src": "6331:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4905, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6331:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "6330:9:19" + }, + "scope": 6204, + "src": "6269:704:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5074, + "nodeType": "Block", + "src": "7394:3585:19", + "statements": [ + { + "id": 5073, + "nodeType": "UncheckedBlock", + "src": "7404:3569:19", + "statements": [ + { + "assignments": [ + 4952, + 4954 + ], + "declarations": [ + { + "constant": false, + "id": 4952, + "mutability": "mutable", + "name": "high", + "nameLocation": "7437:4:19", + "nodeType": "VariableDeclaration", + "scope": 5073, + "src": "7429:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4951, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7429:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4954, + "mutability": "mutable", + "name": "low", + "nameLocation": "7451:3:19", + "nodeType": "VariableDeclaration", + "scope": 5073, + "src": "7443:11:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4953, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7443:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 4959, + "initialValue": { + "arguments": [ + { + "id": 4956, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4942, + "src": "7465:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 4957, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4944, + "src": "7468:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4955, + "name": "mul512", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4587, + "src": "7458:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256,uint256)" + } + }, + "id": 4958, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7458:12:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "7428:42:19" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4962, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4960, + "name": "high", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4952, + "src": "7552:4:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 4961, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7560:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "7552:9:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4968, + "nodeType": "IfStatement", + "src": "7548:365:19", + "trueBody": { + "id": 4967, + "nodeType": "Block", + "src": "7563:350:19", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4965, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4963, + "name": "low", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4954, + "src": "7881:3:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 4964, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "7887:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7881:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4950, + "id": 4966, + "nodeType": "Return", + "src": "7874:24:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4971, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4969, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "8023:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<=", + "rightExpression": { + "id": 4970, + "name": "high", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4952, + "src": "8038:4:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8023:19:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 4987, + "nodeType": "IfStatement", + "src": "8019:142:19", + "trueBody": { + "id": 4986, + "nodeType": "Block", + "src": "8044:117:19", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4978, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4976, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "8082:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 4977, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8097:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "8082:16:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "expression": { + "id": 4979, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "8100:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 4980, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "8106:16:19", + "memberName": "DIVISION_BY_ZERO", + "nodeType": "MemberAccess", + "referencedDeclaration": 1681, + "src": "8100:22:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 4981, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "8124:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 4982, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "8130:14:19", + "memberName": "UNDER_OVERFLOW", + "nodeType": "MemberAccess", + "referencedDeclaration": 1677, + "src": "8124:20:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 4975, + "name": "ternary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4836, + "src": "8074:7:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bool,uint256,uint256) pure returns (uint256)" + } + }, + "id": 4983, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8074:71:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 4972, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "8062:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 4974, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "8068:5:19", + "memberName": "panic", + "nodeType": "MemberAccess", + "referencedDeclaration": 1713, + "src": "8062:11:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$__$", + "typeString": "function (uint256) pure" + } + }, + "id": 4984, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8062:84:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 4985, + "nodeType": "ExpressionStatement", + "src": "8062:84:19" + } + ] + } + }, + { + "assignments": [ + 4989 + ], + "declarations": [ + { + "constant": false, + "id": 4989, + "mutability": "mutable", + "name": "remainder", + "nameLocation": "8421:9:19", + "nodeType": "VariableDeclaration", + "scope": 5073, + "src": "8413:17:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4988, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8413:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 4990, + "nodeType": "VariableDeclarationStatement", + "src": "8413:17:19" + }, + { + "AST": { + "nativeSrc": "8469:283:19", + "nodeType": "YulBlock", + "src": "8469:283:19", + "statements": [ + { + "nativeSrc": "8538:38:19", + "nodeType": "YulAssignment", + "src": "8538:38:19", + "value": { + "arguments": [ + { + "name": "x", + "nativeSrc": "8558:1:19", + "nodeType": "YulIdentifier", + "src": "8558:1:19" + }, + { + "name": "y", + "nativeSrc": "8561:1:19", + "nodeType": "YulIdentifier", + "src": "8561:1:19" + }, + { + "name": "denominator", + "nativeSrc": "8564:11:19", + "nodeType": "YulIdentifier", + "src": "8564:11:19" + } + ], + "functionName": { + "name": "mulmod", + "nativeSrc": "8551:6:19", + "nodeType": "YulIdentifier", + "src": "8551:6:19" + }, + "nativeSrc": "8551:25:19", + "nodeType": "YulFunctionCall", + "src": "8551:25:19" + }, + "variableNames": [ + { + "name": "remainder", + "nativeSrc": "8538:9:19", + "nodeType": "YulIdentifier", + "src": "8538:9:19" + } + ] + }, + { + "nativeSrc": "8658:37:19", + "nodeType": "YulAssignment", + "src": "8658:37:19", + "value": { + "arguments": [ + { + "name": "high", + "nativeSrc": "8670:4:19", + "nodeType": "YulIdentifier", + "src": "8670:4:19" + }, + { + "arguments": [ + { + "name": "remainder", + "nativeSrc": "8679:9:19", + "nodeType": "YulIdentifier", + "src": "8679:9:19" + }, + { + "name": "low", + "nativeSrc": "8690:3:19", + "nodeType": "YulIdentifier", + "src": "8690:3:19" + } + ], + "functionName": { + "name": "gt", + "nativeSrc": "8676:2:19", + "nodeType": "YulIdentifier", + "src": "8676:2:19" + }, + "nativeSrc": "8676:18:19", + "nodeType": "YulFunctionCall", + "src": "8676:18:19" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "8666:3:19", + "nodeType": "YulIdentifier", + "src": "8666:3:19" + }, + "nativeSrc": "8666:29:19", + "nodeType": "YulFunctionCall", + "src": "8666:29:19" + }, + "variableNames": [ + { + "name": "high", + "nativeSrc": "8658:4:19", + "nodeType": "YulIdentifier", + "src": "8658:4:19" + } + ] + }, + { + "nativeSrc": "8712:26:19", + "nodeType": "YulAssignment", + "src": "8712:26:19", + "value": { + "arguments": [ + { + "name": "low", + "nativeSrc": "8723:3:19", + "nodeType": "YulIdentifier", + "src": "8723:3:19" + }, + { + "name": "remainder", + "nativeSrc": "8728:9:19", + "nodeType": "YulIdentifier", + "src": "8728:9:19" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "8719:3:19", + "nodeType": "YulIdentifier", + "src": "8719:3:19" + }, + "nativeSrc": "8719:19:19", + "nodeType": "YulFunctionCall", + "src": "8719:19:19" + }, + "variableNames": [ + { + "name": "low", + "nativeSrc": "8712:3:19", + "nodeType": "YulIdentifier", + "src": "8712:3:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4946, + "isOffset": false, + "isSlot": false, + "src": "8564:11:19", + "valueSize": 1 + }, + { + "declaration": 4952, + "isOffset": false, + "isSlot": false, + "src": "8658:4:19", + "valueSize": 1 + }, + { + "declaration": 4952, + "isOffset": false, + "isSlot": false, + "src": "8670:4:19", + "valueSize": 1 + }, + { + "declaration": 4954, + "isOffset": false, + "isSlot": false, + "src": "8690:3:19", + "valueSize": 1 + }, + { + "declaration": 4954, + "isOffset": false, + "isSlot": false, + "src": "8712:3:19", + "valueSize": 1 + }, + { + "declaration": 4954, + "isOffset": false, + "isSlot": false, + "src": "8723:3:19", + "valueSize": 1 + }, + { + "declaration": 4989, + "isOffset": false, + "isSlot": false, + "src": "8538:9:19", + "valueSize": 1 + }, + { + "declaration": 4989, + "isOffset": false, + "isSlot": false, + "src": "8679:9:19", + "valueSize": 1 + }, + { + "declaration": 4989, + "isOffset": false, + "isSlot": false, + "src": "8728:9:19", + "valueSize": 1 + }, + { + "declaration": 4942, + "isOffset": false, + "isSlot": false, + "src": "8558:1:19", + "valueSize": 1 + }, + { + "declaration": 4944, + "isOffset": false, + "isSlot": false, + "src": "8561:1:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 4991, + "nodeType": "InlineAssembly", + "src": "8444:308:19" + }, + { + "assignments": [ + 4993 + ], + "declarations": [ + { + "constant": false, + "id": 4993, + "mutability": "mutable", + "name": "twos", + "nameLocation": "8964:4:19", + "nodeType": "VariableDeclaration", + "scope": 5073, + "src": "8956:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4992, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8956:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5000, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4999, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 4994, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "8971:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 4997, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "30", + "id": 4995, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8986:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "id": 4996, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "8990:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8986:15:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 4998, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "8985:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8971:31:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8956:46:19" + }, + { + "AST": { + "nativeSrc": "9041:359:19", + "nodeType": "YulBlock", + "src": "9041:359:19", + "statements": [ + { + "nativeSrc": "9106:37:19", + "nodeType": "YulAssignment", + "src": "9106:37:19", + "value": { + "arguments": [ + { + "name": "denominator", + "nativeSrc": "9125:11:19", + "nodeType": "YulIdentifier", + "src": "9125:11:19" + }, + { + "name": "twos", + "nativeSrc": "9138:4:19", + "nodeType": "YulIdentifier", + "src": "9138:4:19" + } + ], + "functionName": { + "name": "div", + "nativeSrc": "9121:3:19", + "nodeType": "YulIdentifier", + "src": "9121:3:19" + }, + "nativeSrc": "9121:22:19", + "nodeType": "YulFunctionCall", + "src": "9121:22:19" + }, + "variableNames": [ + { + "name": "denominator", + "nativeSrc": "9106:11:19", + "nodeType": "YulIdentifier", + "src": "9106:11:19" + } + ] + }, + { + "nativeSrc": "9207:21:19", + "nodeType": "YulAssignment", + "src": "9207:21:19", + "value": { + "arguments": [ + { + "name": "low", + "nativeSrc": "9218:3:19", + "nodeType": "YulIdentifier", + "src": "9218:3:19" + }, + { + "name": "twos", + "nativeSrc": "9223:4:19", + "nodeType": "YulIdentifier", + "src": "9223:4:19" + } + ], + "functionName": { + "name": "div", + "nativeSrc": "9214:3:19", + "nodeType": "YulIdentifier", + "src": "9214:3:19" + }, + "nativeSrc": "9214:14:19", + "nodeType": "YulFunctionCall", + "src": "9214:14:19" + }, + "variableNames": [ + { + "name": "low", + "nativeSrc": "9207:3:19", + "nodeType": "YulIdentifier", + "src": "9207:3:19" + } + ] + }, + { + "nativeSrc": "9347:39:19", + "nodeType": "YulAssignment", + "src": "9347:39:19", + "value": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9367:1:19", + "nodeType": "YulLiteral", + "src": "9367:1:19", + "type": "", + "value": "0" + }, + { + "name": "twos", + "nativeSrc": "9370:4:19", + "nodeType": "YulIdentifier", + "src": "9370:4:19" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "9363:3:19", + "nodeType": "YulIdentifier", + "src": "9363:3:19" + }, + "nativeSrc": "9363:12:19", + "nodeType": "YulFunctionCall", + "src": "9363:12:19" + }, + { + "name": "twos", + "nativeSrc": "9377:4:19", + "nodeType": "YulIdentifier", + "src": "9377:4:19" + } + ], + "functionName": { + "name": "div", + "nativeSrc": "9359:3:19", + "nodeType": "YulIdentifier", + "src": "9359:3:19" + }, + "nativeSrc": "9359:23:19", + "nodeType": "YulFunctionCall", + "src": "9359:23:19" + }, + { + "kind": "number", + "nativeSrc": "9384:1:19", + "nodeType": "YulLiteral", + "src": "9384:1:19", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9355:3:19", + "nodeType": "YulIdentifier", + "src": "9355:3:19" + }, + "nativeSrc": "9355:31:19", + "nodeType": "YulFunctionCall", + "src": "9355:31:19" + }, + "variableNames": [ + { + "name": "twos", + "nativeSrc": "9347:4:19", + "nodeType": "YulIdentifier", + "src": "9347:4:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 4946, + "isOffset": false, + "isSlot": false, + "src": "9106:11:19", + "valueSize": 1 + }, + { + "declaration": 4946, + "isOffset": false, + "isSlot": false, + "src": "9125:11:19", + "valueSize": 1 + }, + { + "declaration": 4954, + "isOffset": false, + "isSlot": false, + "src": "9207:3:19", + "valueSize": 1 + }, + { + "declaration": 4954, + "isOffset": false, + "isSlot": false, + "src": "9218:3:19", + "valueSize": 1 + }, + { + "declaration": 4993, + "isOffset": false, + "isSlot": false, + "src": "9138:4:19", + "valueSize": 1 + }, + { + "declaration": 4993, + "isOffset": false, + "isSlot": false, + "src": "9223:4:19", + "valueSize": 1 + }, + { + "declaration": 4993, + "isOffset": false, + "isSlot": false, + "src": "9347:4:19", + "valueSize": 1 + }, + { + "declaration": 4993, + "isOffset": false, + "isSlot": false, + "src": "9370:4:19", + "valueSize": 1 + }, + { + "declaration": 4993, + "isOffset": false, + "isSlot": false, + "src": "9377:4:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 5001, + "nodeType": "InlineAssembly", + "src": "9016:384:19" + }, + { + "expression": { + "id": 5006, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5002, + "name": "low", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4954, + "src": "9463:3:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "|=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5005, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5003, + "name": "high", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4952, + "src": "9470:4:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5004, + "name": "twos", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4993, + "src": "9477:4:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "9470:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "9463:18:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5007, + "nodeType": "ExpressionStatement", + "src": "9463:18:19" + }, + { + "assignments": [ + 5009 + ], + "declarations": [ + { + "constant": false, + "id": 5009, + "mutability": "mutable", + "name": "inverse", + "nameLocation": "9824:7:19", + "nodeType": "VariableDeclaration", + "scope": 5073, + "src": "9816:15:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5008, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "9816:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5016, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5015, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5012, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "33", + "id": 5010, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9835:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5011, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "9839:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "9835:15:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5013, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "9834:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "^", + "rightExpression": { + "hexValue": "32", + "id": 5014, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9854:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "9834:21:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "9816:39:19" + }, + { + "expression": { + "id": 5023, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5017, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10072:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "*=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5022, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 5018, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10083:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5021, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5019, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "10087:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5020, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10101:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10087:21:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10083:25:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10072:36:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5024, + "nodeType": "ExpressionStatement", + "src": "10072:36:19" + }, + { + "expression": { + "id": 5031, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5025, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10142:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "*=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5030, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 5026, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10153:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5029, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5027, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "10157:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5028, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10171:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10157:21:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10153:25:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10142:36:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5032, + "nodeType": "ExpressionStatement", + "src": "10142:36:19" + }, + { + "expression": { + "id": 5039, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5033, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10214:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "*=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5038, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 5034, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10225:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5037, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5035, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "10229:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5036, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10243:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10229:21:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10225:25:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10214:36:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5040, + "nodeType": "ExpressionStatement", + "src": "10214:36:19" + }, + { + "expression": { + "id": 5047, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5041, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10285:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "*=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5046, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 5042, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10296:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5045, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5043, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "10300:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5044, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10314:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10300:21:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10296:25:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10285:36:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5048, + "nodeType": "ExpressionStatement", + "src": "10285:36:19" + }, + { + "expression": { + "id": 5055, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5049, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10358:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "*=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5054, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 5050, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10369:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5053, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5051, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "10373:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5052, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10387:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10373:21:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10369:25:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10358:36:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5056, + "nodeType": "ExpressionStatement", + "src": "10358:36:19" + }, + { + "expression": { + "id": 5063, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5057, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10432:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "*=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5062, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "32", + "id": 5058, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10443:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5061, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5059, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4946, + "src": "10447:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5060, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10461:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10447:21:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10443:25:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10432:36:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5064, + "nodeType": "ExpressionStatement", + "src": "10432:36:19" + }, + { + "expression": { + "id": 5069, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5065, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4949, + "src": "10913:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5068, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5066, + "name": "low", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4954, + "src": "10922:3:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5067, + "name": "inverse", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5009, + "src": "10928:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10922:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10913:22:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5070, + "nodeType": "ExpressionStatement", + "src": "10913:22:19" + }, + { + "expression": { + "id": 5071, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4949, + "src": "10956:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 4950, + "id": 5072, + "nodeType": "Return", + "src": "10949:13:19" + } + ] + } + ] + }, + "documentation": { + "id": 4940, + "nodeType": "StructuredDocumentation", + "src": "6979:312:19", + "text": " @dev Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or\n denominator == 0.\n Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by\n Uniswap Labs also under MIT license." + }, + "id": 5075, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "mulDiv", + "nameLocation": "7305:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 4947, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4942, + "mutability": "mutable", + "name": "x", + "nameLocation": "7320:1:19", + "nodeType": "VariableDeclaration", + "scope": 5075, + "src": "7312:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4941, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7312:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4944, + "mutability": "mutable", + "name": "y", + "nameLocation": "7331:1:19", + "nodeType": "VariableDeclaration", + "scope": 5075, + "src": "7323:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4943, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7323:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 4946, + "mutability": "mutable", + "name": "denominator", + "nameLocation": "7342:11:19", + "nodeType": "VariableDeclaration", + "scope": 5075, + "src": "7334:19:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4945, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7334:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7311:43:19" + }, + "returnParameters": { + "id": 4950, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 4949, + "mutability": "mutable", + "name": "result", + "nameLocation": "7386:6:19", + "nodeType": "VariableDeclaration", + "scope": 5075, + "src": "7378:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4948, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7378:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7377:16:19" + }, + "scope": 6204, + "src": "7296:3683:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5111, + "nodeType": "Block", + "src": "11218:128:19", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5109, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 5091, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5078, + "src": "11242:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5092, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5080, + "src": "11245:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5093, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5082, + "src": "11248:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5090, + "name": "mulDiv", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 5075, + 5112 + ], + "referencedDeclaration": 5075, + "src": "11235:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 5094, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11235:25:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 5107, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 5098, + "name": "rounding", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5085, + "src": "11296:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + ], + "id": 5097, + "name": "unsignedRoundsUp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6182, + "src": "11279:16:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_Rounding_$4559_$returns$_t_bool_$", + "typeString": "function (enum Math.Rounding) pure returns (bool)" + } + }, + "id": 5099, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11279:26:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5106, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 5101, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5078, + "src": "11316:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5102, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5080, + "src": "11319:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5103, + "name": "denominator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5082, + "src": "11322:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5100, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -16, + "src": "11309:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 5104, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11309:25:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 5105, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11337:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "11309:29:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "11279:59:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5095, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "11263:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5096, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "11272:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "11263:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5108, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11263:76:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "11235:104:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5089, + "id": 5110, + "nodeType": "Return", + "src": "11228:111:19" + } + ] + }, + "documentation": { + "id": 5076, + "nodeType": "StructuredDocumentation", + "src": "10985:118:19", + "text": " @dev Calculates x * y / denominator with full precision, following the selected rounding direction." + }, + "id": 5112, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "mulDiv", + "nameLocation": "11117:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5086, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5078, + "mutability": "mutable", + "name": "x", + "nameLocation": "11132:1:19", + "nodeType": "VariableDeclaration", + "scope": 5112, + "src": "11124:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5077, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11124:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5080, + "mutability": "mutable", + "name": "y", + "nameLocation": "11143:1:19", + "nodeType": "VariableDeclaration", + "scope": 5112, + "src": "11135:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5079, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11135:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5082, + "mutability": "mutable", + "name": "denominator", + "nameLocation": "11154:11:19", + "nodeType": "VariableDeclaration", + "scope": 5112, + "src": "11146:19:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5081, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11146:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5085, + "mutability": "mutable", + "name": "rounding", + "nameLocation": "11176:8:19", + "nodeType": "VariableDeclaration", + "scope": 5112, + "src": "11167:17:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + }, + "typeName": { + "id": 5084, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 5083, + "name": "Rounding", + "nameLocations": [ + "11167:8:19" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4559, + "src": "11167:8:19" + }, + "referencedDeclaration": 4559, + "src": "11167:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + }, + "visibility": "internal" + } + ], + "src": "11123:62:19" + }, + "returnParameters": { + "id": 5089, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5088, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5112, + "src": "11209:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5087, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11209:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "11208:9:19" + }, + "scope": 6204, + "src": "11108:238:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5161, + "nodeType": "Block", + "src": "11554:245:19", + "statements": [ + { + "id": 5160, + "nodeType": "UncheckedBlock", + "src": "11564:229:19", + "statements": [ + { + "assignments": [ + 5125, + 5127 + ], + "declarations": [ + { + "constant": false, + "id": 5125, + "mutability": "mutable", + "name": "high", + "nameLocation": "11597:4:19", + "nodeType": "VariableDeclaration", + "scope": 5160, + "src": "11589:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5124, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11589:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5127, + "mutability": "mutable", + "name": "low", + "nameLocation": "11611:3:19", + "nodeType": "VariableDeclaration", + "scope": 5160, + "src": "11603:11:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5126, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11603:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5132, + "initialValue": { + "arguments": [ + { + "id": 5129, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5115, + "src": "11625:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5130, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5117, + "src": "11628:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5128, + "name": "mul512", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4587, + "src": "11618:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256,uint256)" + } + }, + "id": 5131, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11618:12:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "11588:42:19" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5137, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5133, + "name": "high", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5125, + "src": "11648:4:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5136, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5134, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11656:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "id": 5135, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5119, + "src": "11661:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "src": "11656:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "11648:14:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5146, + "nodeType": "IfStatement", + "src": "11644:86:19", + "trueBody": { + "id": 5145, + "nodeType": "Block", + "src": "11664:66:19", + "statements": [ + { + "expression": { + "arguments": [ + { + "expression": { + "id": 5141, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "11694:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 5142, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "11700:14:19", + "memberName": "UNDER_OVERFLOW", + "nodeType": "MemberAccess", + "referencedDeclaration": 1677, + "src": "11694:20:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 5138, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "11682:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 5140, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "11688:5:19", + "memberName": "panic", + "nodeType": "MemberAccess", + "referencedDeclaration": 1713, + "src": "11682:11:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$__$", + "typeString": "function (uint256) pure" + } + }, + "id": 5143, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11682:33:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 5144, + "nodeType": "ExpressionStatement", + "src": "11682:33:19" + } + ] + } + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5158, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5152, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5147, + "name": "high", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5125, + "src": "11751:4:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint16", + "typeString": "uint16" + }, + "id": 5150, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "323536", + "id": 5148, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11760:3:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_256_by_1", + "typeString": "int_const 256" + }, + "value": "256" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "id": 5149, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5119, + "src": "11766:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "src": "11760:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint16", + "typeString": "uint16" + } + } + ], + "id": 5151, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11759:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint16", + "typeString": "uint16" + } + }, + "src": "11751:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5153, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11750:19:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5156, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5154, + "name": "low", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5127, + "src": "11773:3:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 5155, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5119, + "src": "11780:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "src": "11773:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5157, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11772:10:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "11750:32:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5123, + "id": 5159, + "nodeType": "Return", + "src": "11743:39:19" + } + ] + } + ] + }, + "documentation": { + "id": 5113, + "nodeType": "StructuredDocumentation", + "src": "11352:111:19", + "text": " @dev Calculates floor(x * y >> n) with full precision. Throws if result overflows a uint256." + }, + "id": 5162, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "mulShr", + "nameLocation": "11477:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5120, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5115, + "mutability": "mutable", + "name": "x", + "nameLocation": "11492:1:19", + "nodeType": "VariableDeclaration", + "scope": 5162, + "src": "11484:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5114, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11484:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5117, + "mutability": "mutable", + "name": "y", + "nameLocation": "11503:1:19", + "nodeType": "VariableDeclaration", + "scope": 5162, + "src": "11495:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5116, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11495:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5119, + "mutability": "mutable", + "name": "n", + "nameLocation": "11512:1:19", + "nodeType": "VariableDeclaration", + "scope": 5162, + "src": "11506:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 5118, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "11506:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "src": "11483:31:19" + }, + "returnParameters": { + "id": 5123, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5122, + "mutability": "mutable", + "name": "result", + "nameLocation": "11546:6:19", + "nodeType": "VariableDeclaration", + "scope": 5162, + "src": "11538:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5121, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11538:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "11537:16:19" + }, + "scope": 6204, + "src": "11468:331:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5200, + "nodeType": "Block", + "src": "12017:113:19", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5198, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 5178, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5165, + "src": "12041:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5179, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5167, + "src": "12044:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5180, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5169, + "src": "12047:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + ], + "id": 5177, + "name": "mulShr", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 5162, + 5201 + ], + "referencedDeclaration": 5162, + "src": "12034:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint8_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint8) pure returns (uint256)" + } + }, + "id": 5181, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12034:15:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 5196, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 5185, + "name": "rounding", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5172, + "src": "12085:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + ], + "id": 5184, + "name": "unsignedRoundsUp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6182, + "src": "12068:16:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_Rounding_$4559_$returns$_t_bool_$", + "typeString": "function (enum Math.Rounding) pure returns (bool)" + } + }, + "id": 5186, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12068:26:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5195, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 5188, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5165, + "src": "12105:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5189, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5167, + "src": "12108:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5192, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5190, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12111:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "id": 5191, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5169, + "src": "12116:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "src": "12111:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5187, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -16, + "src": "12098:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 5193, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12098:20:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 5194, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12121:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "12098:24:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "12068:54:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5182, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "12052:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5183, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "12061:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "12052:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5197, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12052:71:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "12034:89:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5176, + "id": 5199, + "nodeType": "Return", + "src": "12027:96:19" + } + ] + }, + "documentation": { + "id": 5163, + "nodeType": "StructuredDocumentation", + "src": "11805:109:19", + "text": " @dev Calculates x * y >> n with full precision, following the selected rounding direction." + }, + "id": 5201, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "mulShr", + "nameLocation": "11928:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5173, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5165, + "mutability": "mutable", + "name": "x", + "nameLocation": "11943:1:19", + "nodeType": "VariableDeclaration", + "scope": 5201, + "src": "11935:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5164, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11935:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5167, + "mutability": "mutable", + "name": "y", + "nameLocation": "11954:1:19", + "nodeType": "VariableDeclaration", + "scope": 5201, + "src": "11946:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5166, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11946:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5169, + "mutability": "mutable", + "name": "n", + "nameLocation": "11963:1:19", + "nodeType": "VariableDeclaration", + "scope": 5201, + "src": "11957:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 5168, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "11957:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5172, + "mutability": "mutable", + "name": "rounding", + "nameLocation": "11975:8:19", + "nodeType": "VariableDeclaration", + "scope": 5201, + "src": "11966:17:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + }, + "typeName": { + "id": 5171, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 5170, + "name": "Rounding", + "nameLocations": [ + "11966:8:19" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4559, + "src": "11966:8:19" + }, + "referencedDeclaration": 4559, + "src": "11966:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + }, + "visibility": "internal" + } + ], + "src": "11934:50:19" + }, + "returnParameters": { + "id": 5176, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5175, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5201, + "src": "12008:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5174, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12008:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "12007:9:19" + }, + "scope": 6204, + "src": "11919:211:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5297, + "nodeType": "Block", + "src": "12764:1849:19", + "statements": [ + { + "id": 5296, + "nodeType": "UncheckedBlock", + "src": "12774:1833:19", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5213, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5211, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5206, + "src": "12802:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 5212, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12807:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "12802:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5216, + "nodeType": "IfStatement", + "src": "12798:20:19", + "trueBody": { + "expression": { + "hexValue": "30", + "id": 5214, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12817:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "functionReturnParameters": 5210, + "id": 5215, + "nodeType": "Return", + "src": "12810:8:19" + } + }, + { + "assignments": [ + 5218 + ], + "declarations": [ + { + "constant": false, + "id": 5218, + "mutability": "mutable", + "name": "remainder", + "nameLocation": "13297:9:19", + "nodeType": "VariableDeclaration", + "scope": 5296, + "src": "13289:17:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5217, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13289:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5222, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5221, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5219, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5204, + "src": "13309:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { + "id": 5220, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5206, + "src": "13313:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "13309:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "13289:25:19" + }, + { + "assignments": [ + 5224 + ], + "declarations": [ + { + "constant": false, + "id": 5224, + "mutability": "mutable", + "name": "gcd", + "nameLocation": "13336:3:19", + "nodeType": "VariableDeclaration", + "scope": 5296, + "src": "13328:11:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5223, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13328:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5226, + "initialValue": { + "id": 5225, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5206, + "src": "13342:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "13328:15:19" + }, + { + "assignments": [ + 5228 + ], + "declarations": [ + { + "constant": false, + "id": 5228, + "mutability": "mutable", + "name": "x", + "nameLocation": "13486:1:19", + "nodeType": "VariableDeclaration", + "scope": 5296, + "src": "13479:8:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 5227, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "13479:6:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "id": 5230, + "initialValue": { + "hexValue": "30", + "id": 5229, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13490:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "13479:12:19" + }, + { + "assignments": [ + 5232 + ], + "declarations": [ + { + "constant": false, + "id": 5232, + "mutability": "mutable", + "name": "y", + "nameLocation": "13512:1:19", + "nodeType": "VariableDeclaration", + "scope": 5296, + "src": "13505:8:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 5231, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "13505:6:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "id": 5234, + "initialValue": { + "hexValue": "31", + "id": 5233, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13516:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "VariableDeclarationStatement", + "src": "13505:12:19" + }, + { + "body": { + "id": 5271, + "nodeType": "Block", + "src": "13555:882:19", + "statements": [ + { + "assignments": [ + 5239 + ], + "declarations": [ + { + "constant": false, + "id": 5239, + "mutability": "mutable", + "name": "quotient", + "nameLocation": "13581:8:19", + "nodeType": "VariableDeclaration", + "scope": 5271, + "src": "13573:16:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5238, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13573:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5243, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5242, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5240, + "name": "gcd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5224, + "src": "13592:3:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 5241, + "name": "remainder", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5218, + "src": "13598:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "13592:15:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "13573:34:19" + }, + { + "expression": { + "id": 5254, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "components": [ + { + "id": 5244, + "name": "gcd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5224, + "src": "13627:3:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5245, + "name": "remainder", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5218, + "src": "13632:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5246, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "13626:16:19", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "components": [ + { + "id": 5247, + "name": "remainder", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5218, + "src": "13732:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5252, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5248, + "name": "gcd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5224, + "src": "13977:3:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5251, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5249, + "name": "remainder", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5218, + "src": "13983:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5250, + "name": "quotient", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5239, + "src": "13995:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "13983:20:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "13977:26:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5253, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "13645:376:19", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "13626:395:19", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 5255, + "nodeType": "ExpressionStatement", + "src": "13626:395:19" + }, + { + "expression": { + "id": 5269, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "components": [ + { + "id": 5256, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5228, + "src": "14041:1:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + { + "id": 5257, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5232, + "src": "14044:1:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 5258, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "14040:6:19", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_int256_$_t_int256_$", + "typeString": "tuple(int256,int256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "components": [ + { + "id": 5259, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5232, + "src": "14126:1:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 5267, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5260, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5228, + "src": "14380:1:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 5266, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5261, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5232, + "src": "14384:1:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "arguments": [ + { + "id": 5264, + "name": "quotient", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5239, + "src": "14395:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5263, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "14388:6:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + }, + "typeName": { + "id": 5262, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "14388:6:19", + "typeDescriptions": {} + } + }, + "id": 5265, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14388:16:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "14384:20:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "14380:24:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 5268, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "14049:373:19", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_int256_$_t_int256_$", + "typeString": "tuple(int256,int256)" + } + }, + "src": "14040:382:19", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 5270, + "nodeType": "ExpressionStatement", + "src": "14040:382:19" + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5237, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5235, + "name": "remainder", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5218, + "src": "13539:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "hexValue": "30", + "id": 5236, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13552:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "13539:14:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5272, + "nodeType": "WhileStatement", + "src": "13532:905:19" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5275, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5273, + "name": "gcd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5224, + "src": "14455:3:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "hexValue": "31", + "id": 5274, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14462:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "14455:8:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5278, + "nodeType": "IfStatement", + "src": "14451:22:19", + "trueBody": { + "expression": { + "hexValue": "30", + "id": 5276, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14472:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "functionReturnParameters": 5210, + "id": 5277, + "nodeType": "Return", + "src": "14465:8:19" + } + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 5282, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5280, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5228, + "src": "14524:1:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "hexValue": "30", + "id": 5281, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14528:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "14524:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5289, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5283, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5206, + "src": "14531:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "arguments": [ + { + "id": 5287, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "-", + "prefix": true, + "src": "14543:2:19", + "subExpression": { + "id": 5286, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5228, + "src": "14544:1:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 5285, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "14535:7:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 5284, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "14535:7:19", + "typeDescriptions": {} + } + }, + "id": 5288, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14535:11:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "14531:15:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [ + { + "id": 5292, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5228, + "src": "14556:1:19", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 5291, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "14548:7:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 5290, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "14548:7:19", + "typeDescriptions": {} + } + }, + "id": 5293, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14548:10:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5279, + "name": "ternary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4836, + "src": "14516:7:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bool,uint256,uint256) pure returns (uint256)" + } + }, + "id": 5294, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14516:43:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5210, + "id": 5295, + "nodeType": "Return", + "src": "14509:50:19" + } + ] + } + ] + }, + "documentation": { + "id": 5202, + "nodeType": "StructuredDocumentation", + "src": "12136:553:19", + "text": " @dev Calculate the modular multiplicative inverse of a number in Z/nZ.\n If n is a prime, then Z/nZ is a field. In that case all elements are inversible, except 0.\n If n is not a prime, then Z/nZ is not a field, and some elements might not be inversible.\n If the input value is not inversible, 0 is returned.\n NOTE: If you know for sure that n is (big) a prime, it may be cheaper to use Fermat's little theorem and get the\n inverse using `Math.modExp(a, n - 2, n)`. See {invModPrime}." + }, + "id": 5298, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "invMod", + "nameLocation": "12703:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5207, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5204, + "mutability": "mutable", + "name": "a", + "nameLocation": "12718:1:19", + "nodeType": "VariableDeclaration", + "scope": 5298, + "src": "12710:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5203, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12710:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5206, + "mutability": "mutable", + "name": "n", + "nameLocation": "12729:1:19", + "nodeType": "VariableDeclaration", + "scope": 5298, + "src": "12721:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5205, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12721:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "12709:22:19" + }, + "returnParameters": { + "id": 5210, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5209, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5298, + "src": "12755:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5208, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12755:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "12754:9:19" + }, + "scope": 6204, + "src": "12694:1919:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5318, + "nodeType": "Block", + "src": "15213:82:19", + "statements": [ + { + "id": 5317, + "nodeType": "UncheckedBlock", + "src": "15223:66:19", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 5310, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5301, + "src": "15266:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5313, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5311, + "name": "p", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5303, + "src": "15269:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "hexValue": "32", + "id": 5312, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "15273:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "15269:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5314, + "name": "p", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5303, + "src": "15276:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 5308, + "name": "Math", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6204, + "src": "15254:4:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Math_$6204_$", + "typeString": "type(library Math)" + } + }, + "id": 5309, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "15259:6:19", + "memberName": "modExp", + "nodeType": "MemberAccess", + "referencedDeclaration": 5355, + "src": "15254:11:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) view returns (uint256)" + } + }, + "id": 5315, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15254:24:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5307, + "id": 5316, + "nodeType": "Return", + "src": "15247:31:19" + } + ] + } + ] + }, + "documentation": { + "id": 5299, + "nodeType": "StructuredDocumentation", + "src": "14619:514:19", + "text": " @dev Variant of {invMod}. More efficient, but only works if `p` is known to be a prime greater than `2`.\n From https://en.wikipedia.org/wiki/Fermat%27s_little_theorem[Fermat's little theorem], we know that if p is\n prime, then `a**(p-1) ≡ 1 mod p`. As a consequence, we have `a * a**(p-2) ≡ 1 mod p`, which means that\n `a**(p-2)` is the modular multiplicative inverse of a in Fp.\n NOTE: this function does NOT check that `p` is a prime greater than `2`." + }, + "id": 5319, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "invModPrime", + "nameLocation": "15147:11:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5304, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5301, + "mutability": "mutable", + "name": "a", + "nameLocation": "15167:1:19", + "nodeType": "VariableDeclaration", + "scope": 5319, + "src": "15159:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5300, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "15159:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5303, + "mutability": "mutable", + "name": "p", + "nameLocation": "15178:1:19", + "nodeType": "VariableDeclaration", + "scope": 5319, + "src": "15170:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5302, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "15170:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "15158:22:19" + }, + "returnParameters": { + "id": 5307, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5306, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5319, + "src": "15204:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5305, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "15204:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "15203:9:19" + }, + "scope": 6204, + "src": "15138:157:19", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5354, + "nodeType": "Block", + "src": "16065:174:19", + "statements": [ + { + "assignments": [ + 5332, + 5334 + ], + "declarations": [ + { + "constant": false, + "id": 5332, + "mutability": "mutable", + "name": "success", + "nameLocation": "16081:7:19", + "nodeType": "VariableDeclaration", + "scope": 5354, + "src": "16076:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 5331, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "16076:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5334, + "mutability": "mutable", + "name": "result", + "nameLocation": "16098:6:19", + "nodeType": "VariableDeclaration", + "scope": 5354, + "src": "16090:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5333, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "16090:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5340, + "initialValue": { + "arguments": [ + { + "id": 5336, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5322, + "src": "16118:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5337, + "name": "e", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5324, + "src": "16121:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5338, + "name": "m", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5326, + "src": "16124:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5335, + "name": "tryModExp", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 5379, + 5461 + ], + "referencedDeclaration": 5379, + "src": "16108:9:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) view returns (bool,uint256)" + } + }, + "id": 5339, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16108:18:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "16075:51:19" + }, + { + "condition": { + "id": 5342, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "16140:8:19", + "subExpression": { + "id": 5341, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5332, + "src": "16141:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5351, + "nodeType": "IfStatement", + "src": "16136:74:19", + "trueBody": { + "id": 5350, + "nodeType": "Block", + "src": "16150:60:19", + "statements": [ + { + "expression": { + "arguments": [ + { + "expression": { + "id": 5346, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "16176:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 5347, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "16182:16:19", + "memberName": "DIVISION_BY_ZERO", + "nodeType": "MemberAccess", + "referencedDeclaration": 1681, + "src": "16176:22:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 5343, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "16164:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 5345, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "16170:5:19", + "memberName": "panic", + "nodeType": "MemberAccess", + "referencedDeclaration": 1713, + "src": "16164:11:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$__$", + "typeString": "function (uint256) pure" + } + }, + "id": 5348, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16164:35:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 5349, + "nodeType": "ExpressionStatement", + "src": "16164:35:19" + } + ] + } + }, + { + "expression": { + "id": 5352, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5334, + "src": "16226:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5330, + "id": 5353, + "nodeType": "Return", + "src": "16219:13:19" + } + ] + }, + "documentation": { + "id": 5320, + "nodeType": "StructuredDocumentation", + "src": "15301:678:19", + "text": " @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m)\n Requirements:\n - modulus can't be zero\n - underlying staticcall to precompile must succeed\n IMPORTANT: The result is only valid if the underlying call succeeds. When using this function, make\n sure the chain you're using it on supports the precompiled contract for modular exponentiation\n at address 0x05 as specified in https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise,\n the underlying function will succeed given the lack of a revert, but the result may be incorrectly\n interpreted as 0." + }, + "id": 5355, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "modExp", + "nameLocation": "15993:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5327, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5322, + "mutability": "mutable", + "name": "b", + "nameLocation": "16008:1:19", + "nodeType": "VariableDeclaration", + "scope": 5355, + "src": "16000:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5321, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "16000:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5324, + "mutability": "mutable", + "name": "e", + "nameLocation": "16019:1:19", + "nodeType": "VariableDeclaration", + "scope": 5355, + "src": "16011:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5323, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "16011:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5326, + "mutability": "mutable", + "name": "m", + "nameLocation": "16030:1:19", + "nodeType": "VariableDeclaration", + "scope": 5355, + "src": "16022:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5325, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "16022:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "15999:33:19" + }, + "returnParameters": { + "id": 5330, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5329, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5355, + "src": "16056:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5328, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "16056:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "16055:9:19" + }, + "scope": 6204, + "src": "15984:255:19", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5378, + "nodeType": "Block", + "src": "17093:1493:19", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5371, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5369, + "name": "m", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5362, + "src": "17107:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 5370, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17112:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "17107:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5376, + "nodeType": "IfStatement", + "src": "17103:29:19", + "trueBody": { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 5372, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17123:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "hexValue": "30", + "id": 5373, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17130:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "id": 5374, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "17122:10:19", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_rational_0_by_1_$", + "typeString": "tuple(bool,int_const 0)" + } + }, + "functionReturnParameters": 5368, + "id": 5375, + "nodeType": "Return", + "src": "17115:17:19" + } + }, + { + "AST": { + "nativeSrc": "17167:1413:19", + "nodeType": "YulBlock", + "src": "17167:1413:19", + "statements": [ + { + "nativeSrc": "17181:22:19", + "nodeType": "YulVariableDeclaration", + "src": "17181:22:19", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "17198:4:19", + "nodeType": "YulLiteral", + "src": "17198:4:19", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "17192:5:19", + "nodeType": "YulIdentifier", + "src": "17192:5:19" + }, + "nativeSrc": "17192:11:19", + "nodeType": "YulFunctionCall", + "src": "17192:11:19" + }, + "variables": [ + { + "name": "ptr", + "nativeSrc": "17185:3:19", + "nodeType": "YulTypedName", + "src": "17185:3:19", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "18111:3:19", + "nodeType": "YulIdentifier", + "src": "18111:3:19" + }, + { + "kind": "number", + "nativeSrc": "18116:4:19", + "nodeType": "YulLiteral", + "src": "18116:4:19", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "18104:6:19", + "nodeType": "YulIdentifier", + "src": "18104:6:19" + }, + "nativeSrc": "18104:17:19", + "nodeType": "YulFunctionCall", + "src": "18104:17:19" + }, + "nativeSrc": "18104:17:19", + "nodeType": "YulExpressionStatement", + "src": "18104:17:19" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "18145:3:19", + "nodeType": "YulIdentifier", + "src": "18145:3:19" + }, + { + "kind": "number", + "nativeSrc": "18150:4:19", + "nodeType": "YulLiteral", + "src": "18150:4:19", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "18141:3:19", + "nodeType": "YulIdentifier", + "src": "18141:3:19" + }, + "nativeSrc": "18141:14:19", + "nodeType": "YulFunctionCall", + "src": "18141:14:19" + }, + { + "kind": "number", + "nativeSrc": "18157:4:19", + "nodeType": "YulLiteral", + "src": "18157:4:19", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "18134:6:19", + "nodeType": "YulIdentifier", + "src": "18134:6:19" + }, + "nativeSrc": "18134:28:19", + "nodeType": "YulFunctionCall", + "src": "18134:28:19" + }, + "nativeSrc": "18134:28:19", + "nodeType": "YulExpressionStatement", + "src": "18134:28:19" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "18186:3:19", + "nodeType": "YulIdentifier", + "src": "18186:3:19" + }, + { + "kind": "number", + "nativeSrc": "18191:4:19", + "nodeType": "YulLiteral", + "src": "18191:4:19", + "type": "", + "value": "0x40" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "18182:3:19", + "nodeType": "YulIdentifier", + "src": "18182:3:19" + }, + "nativeSrc": "18182:14:19", + "nodeType": "YulFunctionCall", + "src": "18182:14:19" + }, + { + "kind": "number", + "nativeSrc": "18198:4:19", + "nodeType": "YulLiteral", + "src": "18198:4:19", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "18175:6:19", + "nodeType": "YulIdentifier", + "src": "18175:6:19" + }, + "nativeSrc": "18175:28:19", + "nodeType": "YulFunctionCall", + "src": "18175:28:19" + }, + "nativeSrc": "18175:28:19", + "nodeType": "YulExpressionStatement", + "src": "18175:28:19" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "18227:3:19", + "nodeType": "YulIdentifier", + "src": "18227:3:19" + }, + { + "kind": "number", + "nativeSrc": "18232:4:19", + "nodeType": "YulLiteral", + "src": "18232:4:19", + "type": "", + "value": "0x60" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "18223:3:19", + "nodeType": "YulIdentifier", + "src": "18223:3:19" + }, + "nativeSrc": "18223:14:19", + "nodeType": "YulFunctionCall", + "src": "18223:14:19" + }, + { + "name": "b", + "nativeSrc": "18239:1:19", + "nodeType": "YulIdentifier", + "src": "18239:1:19" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "18216:6:19", + "nodeType": "YulIdentifier", + "src": "18216:6:19" + }, + "nativeSrc": "18216:25:19", + "nodeType": "YulFunctionCall", + "src": "18216:25:19" + }, + "nativeSrc": "18216:25:19", + "nodeType": "YulExpressionStatement", + "src": "18216:25:19" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "18265:3:19", + "nodeType": "YulIdentifier", + "src": "18265:3:19" + }, + { + "kind": "number", + "nativeSrc": "18270:4:19", + "nodeType": "YulLiteral", + "src": "18270:4:19", + "type": "", + "value": "0x80" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "18261:3:19", + "nodeType": "YulIdentifier", + "src": "18261:3:19" + }, + "nativeSrc": "18261:14:19", + "nodeType": "YulFunctionCall", + "src": "18261:14:19" + }, + { + "name": "e", + "nativeSrc": "18277:1:19", + "nodeType": "YulIdentifier", + "src": "18277:1:19" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "18254:6:19", + "nodeType": "YulIdentifier", + "src": "18254:6:19" + }, + "nativeSrc": "18254:25:19", + "nodeType": "YulFunctionCall", + "src": "18254:25:19" + }, + "nativeSrc": "18254:25:19", + "nodeType": "YulExpressionStatement", + "src": "18254:25:19" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "ptr", + "nativeSrc": "18303:3:19", + "nodeType": "YulIdentifier", + "src": "18303:3:19" + }, + { + "kind": "number", + "nativeSrc": "18308:4:19", + "nodeType": "YulLiteral", + "src": "18308:4:19", + "type": "", + "value": "0xa0" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "18299:3:19", + "nodeType": "YulIdentifier", + "src": "18299:3:19" + }, + "nativeSrc": "18299:14:19", + "nodeType": "YulFunctionCall", + "src": "18299:14:19" + }, + { + "name": "m", + "nativeSrc": "18315:1:19", + "nodeType": "YulIdentifier", + "src": "18315:1:19" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "18292:6:19", + "nodeType": "YulIdentifier", + "src": "18292:6:19" + }, + "nativeSrc": "18292:25:19", + "nodeType": "YulFunctionCall", + "src": "18292:25:19" + }, + "nativeSrc": "18292:25:19", + "nodeType": "YulExpressionStatement", + "src": "18292:25:19" + }, + { + "nativeSrc": "18479:57:19", + "nodeType": "YulAssignment", + "src": "18479:57:19", + "value": { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "gas", + "nativeSrc": "18501:3:19", + "nodeType": "YulIdentifier", + "src": "18501:3:19" + }, + "nativeSrc": "18501:5:19", + "nodeType": "YulFunctionCall", + "src": "18501:5:19" + }, + { + "kind": "number", + "nativeSrc": "18508:4:19", + "nodeType": "YulLiteral", + "src": "18508:4:19", + "type": "", + "value": "0x05" + }, + { + "name": "ptr", + "nativeSrc": "18514:3:19", + "nodeType": "YulIdentifier", + "src": "18514:3:19" + }, + { + "kind": "number", + "nativeSrc": "18519:4:19", + "nodeType": "YulLiteral", + "src": "18519:4:19", + "type": "", + "value": "0xc0" + }, + { + "kind": "number", + "nativeSrc": "18525:4:19", + "nodeType": "YulLiteral", + "src": "18525:4:19", + "type": "", + "value": "0x00" + }, + { + "kind": "number", + "nativeSrc": "18531:4:19", + "nodeType": "YulLiteral", + "src": "18531:4:19", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "staticcall", + "nativeSrc": "18490:10:19", + "nodeType": "YulIdentifier", + "src": "18490:10:19" + }, + "nativeSrc": "18490:46:19", + "nodeType": "YulFunctionCall", + "src": "18490:46:19" + }, + "variableNames": [ + { + "name": "success", + "nativeSrc": "18479:7:19", + "nodeType": "YulIdentifier", + "src": "18479:7:19" + } + ] + }, + { + "nativeSrc": "18549:21:19", + "nodeType": "YulAssignment", + "src": "18549:21:19", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "18565:4:19", + "nodeType": "YulLiteral", + "src": "18565:4:19", + "type": "", + "value": "0x00" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "18559:5:19", + "nodeType": "YulIdentifier", + "src": "18559:5:19" + }, + "nativeSrc": "18559:11:19", + "nodeType": "YulFunctionCall", + "src": "18559:11:19" + }, + "variableNames": [ + { + "name": "result", + "nativeSrc": "18549:6:19", + "nodeType": "YulIdentifier", + "src": "18549:6:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 5358, + "isOffset": false, + "isSlot": false, + "src": "18239:1:19", + "valueSize": 1 + }, + { + "declaration": 5360, + "isOffset": false, + "isSlot": false, + "src": "18277:1:19", + "valueSize": 1 + }, + { + "declaration": 5362, + "isOffset": false, + "isSlot": false, + "src": "18315:1:19", + "valueSize": 1 + }, + { + "declaration": 5367, + "isOffset": false, + "isSlot": false, + "src": "18549:6:19", + "valueSize": 1 + }, + { + "declaration": 5365, + "isOffset": false, + "isSlot": false, + "src": "18479:7:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 5377, + "nodeType": "InlineAssembly", + "src": "17142:1438:19" + } + ] + }, + "documentation": { + "id": 5356, + "nodeType": "StructuredDocumentation", + "src": "16245:738:19", + "text": " @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m).\n It includes a success flag indicating if the operation succeeded. Operation will be marked as failed if trying\n to operate modulo 0 or if the underlying precompile reverted.\n IMPORTANT: The result is only valid if the success flag is true. When using this function, make sure the chain\n you're using it on supports the precompiled contract for modular exponentiation at address 0x05 as specified in\n https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, the underlying function will succeed given the lack\n of a revert, but the result may be incorrectly interpreted as 0." + }, + "id": 5379, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryModExp", + "nameLocation": "16997:9:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5363, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5358, + "mutability": "mutable", + "name": "b", + "nameLocation": "17015:1:19", + "nodeType": "VariableDeclaration", + "scope": 5379, + "src": "17007:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5357, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "17007:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5360, + "mutability": "mutable", + "name": "e", + "nameLocation": "17026:1:19", + "nodeType": "VariableDeclaration", + "scope": 5379, + "src": "17018:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5359, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "17018:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5362, + "mutability": "mutable", + "name": "m", + "nameLocation": "17037:1:19", + "nodeType": "VariableDeclaration", + "scope": 5379, + "src": "17029:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5361, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "17029:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "17006:33:19" + }, + "returnParameters": { + "id": 5368, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5365, + "mutability": "mutable", + "name": "success", + "nameLocation": "17068:7:19", + "nodeType": "VariableDeclaration", + "scope": 5379, + "src": "17063:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 5364, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "17063:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5367, + "mutability": "mutable", + "name": "result", + "nameLocation": "17085:6:19", + "nodeType": "VariableDeclaration", + "scope": 5379, + "src": "17077:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5366, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "17077:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "17062:30:19" + }, + "scope": 6204, + "src": "16988:1598:19", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5414, + "nodeType": "Block", + "src": "18783:179:19", + "statements": [ + { + "assignments": [ + 5392, + 5394 + ], + "declarations": [ + { + "constant": false, + "id": 5392, + "mutability": "mutable", + "name": "success", + "nameLocation": "18799:7:19", + "nodeType": "VariableDeclaration", + "scope": 5414, + "src": "18794:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 5391, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "18794:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5394, + "mutability": "mutable", + "name": "result", + "nameLocation": "18821:6:19", + "nodeType": "VariableDeclaration", + "scope": 5414, + "src": "18808:19:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5393, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "18808:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "id": 5400, + "initialValue": { + "arguments": [ + { + "id": 5396, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5382, + "src": "18841:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 5397, + "name": "e", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5384, + "src": "18844:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 5398, + "name": "m", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5386, + "src": "18847:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 5395, + "name": "tryModExp", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 5379, + 5461 + ], + "referencedDeclaration": 5461, + "src": "18831:9:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes_memory_ptr_$_t_bytes_memory_ptr_$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$", + "typeString": "function (bytes memory,bytes memory,bytes memory) view returns (bool,bytes memory)" + } + }, + "id": 5399, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18831:18:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$", + "typeString": "tuple(bool,bytes memory)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "18793:56:19" + }, + { + "condition": { + "id": 5402, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "18863:8:19", + "subExpression": { + "id": 5401, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5392, + "src": "18864:7:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5411, + "nodeType": "IfStatement", + "src": "18859:74:19", + "trueBody": { + "id": 5410, + "nodeType": "Block", + "src": "18873:60:19", + "statements": [ + { + "expression": { + "arguments": [ + { + "expression": { + "id": 5406, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "18899:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 5407, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "18905:16:19", + "memberName": "DIVISION_BY_ZERO", + "nodeType": "MemberAccess", + "referencedDeclaration": 1681, + "src": "18899:22:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 5403, + "name": "Panic", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1714, + "src": "18887:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Panic_$1714_$", + "typeString": "type(library Panic)" + } + }, + "id": 5405, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "18893:5:19", + "memberName": "panic", + "nodeType": "MemberAccess", + "referencedDeclaration": 1713, + "src": "18887:11:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$__$", + "typeString": "function (uint256) pure" + } + }, + "id": 5408, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18887:35:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 5409, + "nodeType": "ExpressionStatement", + "src": "18887:35:19" + } + ] + } + }, + { + "expression": { + "id": 5412, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5394, + "src": "18949:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "functionReturnParameters": 5390, + "id": 5413, + "nodeType": "Return", + "src": "18942:13:19" + } + ] + }, + "documentation": { + "id": 5380, + "nodeType": "StructuredDocumentation", + "src": "18592:85:19", + "text": " @dev Variant of {modExp} that supports inputs of arbitrary length." + }, + "id": 5415, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "modExp", + "nameLocation": "18691:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5387, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5382, + "mutability": "mutable", + "name": "b", + "nameLocation": "18711:1:19", + "nodeType": "VariableDeclaration", + "scope": 5415, + "src": "18698:14:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5381, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "18698:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5384, + "mutability": "mutable", + "name": "e", + "nameLocation": "18727:1:19", + "nodeType": "VariableDeclaration", + "scope": 5415, + "src": "18714:14:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5383, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "18714:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5386, + "mutability": "mutable", + "name": "m", + "nameLocation": "18743:1:19", + "nodeType": "VariableDeclaration", + "scope": 5415, + "src": "18730:14:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5385, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "18730:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "18697:48:19" + }, + "returnParameters": { + "id": 5390, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5389, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5415, + "src": "18769:12:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5388, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "18769:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "18768:14:19" + }, + "scope": 6204, + "src": "18682:280:19", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5460, + "nodeType": "Block", + "src": "19216:771:19", + "statements": [ + { + "condition": { + "arguments": [ + { + "id": 5430, + "name": "m", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5422, + "src": "19241:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 5429, + "name": "_zeroBytes", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5508, + "src": "19230:10:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$returns$_t_bool_$", + "typeString": "function (bytes memory) pure returns (bool)" + } + }, + "id": 5431, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19230:13:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5439, + "nodeType": "IfStatement", + "src": "19226:47:19", + "trueBody": { + "expression": { + "components": [ + { + "hexValue": "66616c7365", + "id": 5432, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19253:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + { + "arguments": [ + { + "hexValue": "30", + "id": 5435, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19270:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 5434, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "19260:9:19", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (uint256) pure returns (bytes memory)" + }, + "typeName": { + "id": 5433, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "19264:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + } + }, + "id": 5436, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19260:12:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "id": 5437, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "19252:21:19", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$", + "typeString": "tuple(bool,bytes memory)" + } + }, + "functionReturnParameters": 5428, + "id": 5438, + "nodeType": "Return", + "src": "19245:28:19" + } + }, + { + "assignments": [ + 5441 + ], + "declarations": [ + { + "constant": false, + "id": 5441, + "mutability": "mutable", + "name": "mLen", + "nameLocation": "19292:4:19", + "nodeType": "VariableDeclaration", + "scope": 5460, + "src": "19284:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5440, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "19284:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5444, + "initialValue": { + "expression": { + "id": 5442, + "name": "m", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5422, + "src": "19299:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 5443, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "19301:6:19", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "19299:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "19284:23:19" + }, + { + "expression": { + "id": 5457, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5445, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5427, + "src": "19389:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "expression": { + "id": 5448, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5418, + "src": "19415:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 5449, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "19417:6:19", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "19415:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 5450, + "name": "e", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5420, + "src": "19425:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 5451, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "19427:6:19", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "19425:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5452, + "name": "mLen", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5441, + "src": "19435:4:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 5453, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5418, + "src": "19441:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 5454, + "name": "e", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5420, + "src": "19444:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 5455, + "name": "m", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5422, + "src": "19447:1:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "id": 5446, + "name": "abi", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -1, + "src": "19398:3:19", + "typeDescriptions": { + "typeIdentifier": "t_magic_abi", + "typeString": "abi" + } + }, + "id": 5447, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "19402:12:19", + "memberName": "encodePacked", + "nodeType": "MemberAccess", + "src": "19398:16:19", + "typeDescriptions": { + "typeIdentifier": "t_function_abiencodepacked_pure$__$returns$_t_bytes_memory_ptr_$", + "typeString": "function () pure returns (bytes memory)" + } + }, + "id": 5456, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19398:51:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "src": "19389:60:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 5458, + "nodeType": "ExpressionStatement", + "src": "19389:60:19" + }, + { + "AST": { + "nativeSrc": "19485:496:19", + "nodeType": "YulBlock", + "src": "19485:496:19", + "statements": [ + { + "nativeSrc": "19499:32:19", + "nodeType": "YulVariableDeclaration", + "src": "19499:32:19", + "value": { + "arguments": [ + { + "name": "result", + "nativeSrc": "19518:6:19", + "nodeType": "YulIdentifier", + "src": "19518:6:19" + }, + { + "kind": "number", + "nativeSrc": "19526:4:19", + "nodeType": "YulLiteral", + "src": "19526:4:19", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "19514:3:19", + "nodeType": "YulIdentifier", + "src": "19514:3:19" + }, + "nativeSrc": "19514:17:19", + "nodeType": "YulFunctionCall", + "src": "19514:17:19" + }, + "variables": [ + { + "name": "dataPtr", + "nativeSrc": "19503:7:19", + "nodeType": "YulTypedName", + "src": "19503:7:19", + "type": "" + } + ] + }, + { + "nativeSrc": "19621:73:19", + "nodeType": "YulAssignment", + "src": "19621:73:19", + "value": { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "gas", + "nativeSrc": "19643:3:19", + "nodeType": "YulIdentifier", + "src": "19643:3:19" + }, + "nativeSrc": "19643:5:19", + "nodeType": "YulFunctionCall", + "src": "19643:5:19" + }, + { + "kind": "number", + "nativeSrc": "19650:4:19", + "nodeType": "YulLiteral", + "src": "19650:4:19", + "type": "", + "value": "0x05" + }, + { + "name": "dataPtr", + "nativeSrc": "19656:7:19", + "nodeType": "YulIdentifier", + "src": "19656:7:19" + }, + { + "arguments": [ + { + "name": "result", + "nativeSrc": "19671:6:19", + "nodeType": "YulIdentifier", + "src": "19671:6:19" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "19665:5:19", + "nodeType": "YulIdentifier", + "src": "19665:5:19" + }, + "nativeSrc": "19665:13:19", + "nodeType": "YulFunctionCall", + "src": "19665:13:19" + }, + { + "name": "dataPtr", + "nativeSrc": "19680:7:19", + "nodeType": "YulIdentifier", + "src": "19680:7:19" + }, + { + "name": "mLen", + "nativeSrc": "19689:4:19", + "nodeType": "YulIdentifier", + "src": "19689:4:19" + } + ], + "functionName": { + "name": "staticcall", + "nativeSrc": "19632:10:19", + "nodeType": "YulIdentifier", + "src": "19632:10:19" + }, + "nativeSrc": "19632:62:19", + "nodeType": "YulFunctionCall", + "src": "19632:62:19" + }, + "variableNames": [ + { + "name": "success", + "nativeSrc": "19621:7:19", + "nodeType": "YulIdentifier", + "src": "19621:7:19" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "result", + "nativeSrc": "19850:6:19", + "nodeType": "YulIdentifier", + "src": "19850:6:19" + }, + { + "name": "mLen", + "nativeSrc": "19858:4:19", + "nodeType": "YulIdentifier", + "src": "19858:4:19" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "19843:6:19", + "nodeType": "YulIdentifier", + "src": "19843:6:19" + }, + "nativeSrc": "19843:20:19", + "nodeType": "YulFunctionCall", + "src": "19843:20:19" + }, + "nativeSrc": "19843:20:19", + "nodeType": "YulExpressionStatement", + "src": "19843:20:19" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "19946:4:19", + "nodeType": "YulLiteral", + "src": "19946:4:19", + "type": "", + "value": "0x40" + }, + { + "arguments": [ + { + "name": "dataPtr", + "nativeSrc": "19956:7:19", + "nodeType": "YulIdentifier", + "src": "19956:7:19" + }, + { + "name": "mLen", + "nativeSrc": "19965:4:19", + "nodeType": "YulIdentifier", + "src": "19965:4:19" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "19952:3:19", + "nodeType": "YulIdentifier", + "src": "19952:3:19" + }, + "nativeSrc": "19952:18:19", + "nodeType": "YulFunctionCall", + "src": "19952:18:19" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "19939:6:19", + "nodeType": "YulIdentifier", + "src": "19939:6:19" + }, + "nativeSrc": "19939:32:19", + "nodeType": "YulFunctionCall", + "src": "19939:32:19" + }, + "nativeSrc": "19939:32:19", + "nodeType": "YulExpressionStatement", + "src": "19939:32:19" + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 5441, + "isOffset": false, + "isSlot": false, + "src": "19689:4:19", + "valueSize": 1 + }, + { + "declaration": 5441, + "isOffset": false, + "isSlot": false, + "src": "19858:4:19", + "valueSize": 1 + }, + { + "declaration": 5441, + "isOffset": false, + "isSlot": false, + "src": "19965:4:19", + "valueSize": 1 + }, + { + "declaration": 5427, + "isOffset": false, + "isSlot": false, + "src": "19518:6:19", + "valueSize": 1 + }, + { + "declaration": 5427, + "isOffset": false, + "isSlot": false, + "src": "19671:6:19", + "valueSize": 1 + }, + { + "declaration": 5427, + "isOffset": false, + "isSlot": false, + "src": "19850:6:19", + "valueSize": 1 + }, + { + "declaration": 5425, + "isOffset": false, + "isSlot": false, + "src": "19621:7:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 5459, + "nodeType": "InlineAssembly", + "src": "19460:521:19" + } + ] + }, + "documentation": { + "id": 5416, + "nodeType": "StructuredDocumentation", + "src": "18968:88:19", + "text": " @dev Variant of {tryModExp} that supports inputs of arbitrary length." + }, + "id": 5461, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "tryModExp", + "nameLocation": "19070:9:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5423, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5418, + "mutability": "mutable", + "name": "b", + "nameLocation": "19102:1:19", + "nodeType": "VariableDeclaration", + "scope": 5461, + "src": "19089:14:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5417, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "19089:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5420, + "mutability": "mutable", + "name": "e", + "nameLocation": "19126:1:19", + "nodeType": "VariableDeclaration", + "scope": 5461, + "src": "19113:14:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5419, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "19113:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5422, + "mutability": "mutable", + "name": "m", + "nameLocation": "19150:1:19", + "nodeType": "VariableDeclaration", + "scope": 5461, + "src": "19137:14:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5421, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "19137:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "19079:78:19" + }, + "returnParameters": { + "id": 5428, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5425, + "mutability": "mutable", + "name": "success", + "nameLocation": "19186:7:19", + "nodeType": "VariableDeclaration", + "scope": 5461, + "src": "19181:12:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 5424, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "19181:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5427, + "mutability": "mutable", + "name": "result", + "nameLocation": "19208:6:19", + "nodeType": "VariableDeclaration", + "scope": 5461, + "src": "19195:19:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5426, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "19195:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "19180:35:19" + }, + "scope": 6204, + "src": "19061:926:19", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5507, + "nodeType": "Block", + "src": "20139:417:19", + "statements": [ + { + "assignments": [ + 5470 + ], + "declarations": [ + { + "constant": false, + "id": 5470, + "mutability": "mutable", + "name": "chunk", + "nameLocation": "20157:5:19", + "nodeType": "VariableDeclaration", + "scope": 5507, + "src": "20149:13:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5469, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "20149:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5471, + "nodeType": "VariableDeclarationStatement", + "src": "20149:13:19" + }, + { + "body": { + "id": 5503, + "nodeType": "Block", + "src": "20222:307:19", + "statements": [ + { + "AST": { + "nativeSrc": "20324:73:19", + "nodeType": "YulBlock", + "src": "20324:73:19", + "statements": [ + { + "nativeSrc": "20342:41:19", + "nodeType": "YulAssignment", + "src": "20342:41:19", + "value": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "buffer", + "nativeSrc": "20365:6:19", + "nodeType": "YulIdentifier", + "src": "20365:6:19" + }, + { + "kind": "number", + "nativeSrc": "20373:4:19", + "nodeType": "YulLiteral", + "src": "20373:4:19", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "20361:3:19", + "nodeType": "YulIdentifier", + "src": "20361:3:19" + }, + "nativeSrc": "20361:17:19", + "nodeType": "YulFunctionCall", + "src": "20361:17:19" + }, + { + "name": "i", + "nativeSrc": "20380:1:19", + "nodeType": "YulIdentifier", + "src": "20380:1:19" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "20357:3:19", + "nodeType": "YulIdentifier", + "src": "20357:3:19" + }, + "nativeSrc": "20357:25:19", + "nodeType": "YulFunctionCall", + "src": "20357:25:19" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "20351:5:19", + "nodeType": "YulIdentifier", + "src": "20351:5:19" + }, + "nativeSrc": "20351:32:19", + "nodeType": "YulFunctionCall", + "src": "20351:32:19" + }, + "variableNames": [ + { + "name": "chunk", + "nativeSrc": "20342:5:19", + "nodeType": "YulIdentifier", + "src": "20342:5:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 5464, + "isOffset": false, + "isSlot": false, + "src": "20365:6:19", + "valueSize": 1 + }, + { + "declaration": 5470, + "isOffset": false, + "isSlot": false, + "src": "20342:5:19", + "valueSize": 1 + }, + { + "declaration": 5473, + "isOffset": false, + "isSlot": false, + "src": "20380:1:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 5484, + "nodeType": "InlineAssembly", + "src": "20299:98:19" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5498, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5496, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5485, + "name": "chunk", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5470, + "src": "20414:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5494, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "38", + "id": 5486, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "20424:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5490, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5488, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5473, + "src": "20442:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "30783230", + "id": 5489, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "20446:4:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "0x20" + }, + "src": "20442:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 5491, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5464, + "src": "20452:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 5492, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "20459:6:19", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "20452:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5487, + "name": "saturatingSub", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4779, + "src": "20428:13:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 5493, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "20428:38:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "20424:42:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5495, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "20423:44:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "20414:53:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "hexValue": "30", + "id": 5497, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "20471:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "20414:58:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5502, + "nodeType": "IfStatement", + "src": "20410:109:19", + "trueBody": { + "id": 5501, + "nodeType": "Block", + "src": "20474:45:19", + "statements": [ + { + "expression": { + "hexValue": "66616c7365", + "id": 5499, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "20499:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + "functionReturnParameters": 5468, + "id": 5500, + "nodeType": "Return", + "src": "20492:12:19" + } + ] + } + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5479, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5476, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5473, + "src": "20192:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "expression": { + "id": 5477, + "name": "buffer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5464, + "src": "20196:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 5478, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "20203:6:19", + "memberName": "length", + "nodeType": "MemberAccess", + "src": "20196:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "20192:17:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5504, + "initializationExpression": { + "assignments": [ + 5473 + ], + "declarations": [ + { + "constant": false, + "id": 5473, + "mutability": "mutable", + "name": "i", + "nameLocation": "20185:1:19", + "nodeType": "VariableDeclaration", + "scope": 5504, + "src": "20177:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5472, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "20177:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5475, + "initialValue": { + "hexValue": "30", + "id": 5474, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "20189:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "20177:13:19" + }, + "isSimpleCounterLoop": false, + "loopExpression": { + "expression": { + "id": 5482, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5480, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5473, + "src": "20211:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "hexValue": "30783230", + "id": 5481, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "20216:4:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "0x20" + }, + "src": "20211:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5483, + "nodeType": "ExpressionStatement", + "src": "20211:9:19" + }, + "nodeType": "ForStatement", + "src": "20172:357:19" + }, + { + "expression": { + "hexValue": "74727565", + "id": 5505, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "20545:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "functionReturnParameters": 5468, + "id": 5506, + "nodeType": "Return", + "src": "20538:11:19" + } + ] + }, + "documentation": { + "id": 5462, + "nodeType": "StructuredDocumentation", + "src": "19993:72:19", + "text": " @dev Returns whether the provided byte array is zero." + }, + "id": 5508, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_zeroBytes", + "nameLocation": "20079:10:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5465, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5464, + "mutability": "mutable", + "name": "buffer", + "nameLocation": "20103:6:19", + "nodeType": "VariableDeclaration", + "scope": 5508, + "src": "20090:19:19", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 5463, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "20090:5:19", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "20089:21:19" + }, + "returnParameters": { + "id": 5468, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5467, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5508, + "src": "20133:4:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 5466, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "20133:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "20132:6:19" + }, + "scope": 6204, + "src": "20070:486:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 5726, + "nodeType": "Block", + "src": "20916:5124:19", + "statements": [ + { + "id": 5725, + "nodeType": "UncheckedBlock", + "src": "20926:5108:19", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5518, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5516, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "21020:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<=", + "rightExpression": { + "hexValue": "31", + "id": 5517, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "21025:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "21020:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5522, + "nodeType": "IfStatement", + "src": "21016:53:19", + "trueBody": { + "id": 5521, + "nodeType": "Block", + "src": "21028:41:19", + "statements": [ + { + "expression": { + "id": 5519, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "21053:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5515, + "id": 5520, + "nodeType": "Return", + "src": "21046:8:19" + } + ] + } + }, + { + "assignments": [ + 5524 + ], + "declarations": [ + { + "constant": false, + "id": 5524, + "mutability": "mutable", + "name": "aa", + "nameLocation": "22004:2:19", + "nodeType": "VariableDeclaration", + "scope": 5725, + "src": "21996:10:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5523, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "21996:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5526, + "initialValue": { + "id": 5525, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "22009:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "21996:14:19" + }, + { + "assignments": [ + 5528 + ], + "declarations": [ + { + "constant": false, + "id": 5528, + "mutability": "mutable", + "name": "xn", + "nameLocation": "22032:2:19", + "nodeType": "VariableDeclaration", + "scope": 5725, + "src": "22024:10:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5527, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "22024:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5530, + "initialValue": { + "hexValue": "31", + "id": 5529, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22037:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "VariableDeclarationStatement", + "src": "22024:14:19" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5536, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5531, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22057:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_rational_340282366920938463463374607431768211456_by_1", + "typeString": "int_const 3402...(31 digits omitted)...1456" + }, + "id": 5534, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5532, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22064:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "313238", + "id": 5533, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22069:3:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_128_by_1", + "typeString": "int_const 128" + }, + "value": "128" + }, + "src": "22064:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_340282366920938463463374607431768211456_by_1", + "typeString": "int_const 3402...(31 digits omitted)...1456" + } + } + ], + "id": 5535, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "22063:10:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_340282366920938463463374607431768211456_by_1", + "typeString": "int_const 3402...(31 digits omitted)...1456" + } + }, + "src": "22057:16:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5546, + "nodeType": "IfStatement", + "src": "22053:92:19", + "trueBody": { + "id": 5545, + "nodeType": "Block", + "src": "22075:70:19", + "statements": [ + { + "expression": { + "id": 5539, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5537, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22093:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": ">>=", + "rightHandSide": { + "hexValue": "313238", + "id": 5538, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22100:3:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_128_by_1", + "typeString": "int_const 128" + }, + "value": "128" + }, + "src": "22093:10:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5540, + "nodeType": "ExpressionStatement", + "src": "22093:10:19" + }, + { + "expression": { + "id": 5543, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5541, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "22121:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "<<=", + "rightHandSide": { + "hexValue": "3634", + "id": 5542, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22128:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "22121:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5544, + "nodeType": "ExpressionStatement", + "src": "22121:9:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5552, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5547, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22162:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_rational_18446744073709551616_by_1", + "typeString": "int_const 18446744073709551616" + }, + "id": 5550, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5548, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22169:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3634", + "id": 5549, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22174:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "22169:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_18446744073709551616_by_1", + "typeString": "int_const 18446744073709551616" + } + } + ], + "id": 5551, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "22168:9:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_18446744073709551616_by_1", + "typeString": "int_const 18446744073709551616" + } + }, + "src": "22162:15:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5562, + "nodeType": "IfStatement", + "src": "22158:90:19", + "trueBody": { + "id": 5561, + "nodeType": "Block", + "src": "22179:69:19", + "statements": [ + { + "expression": { + "id": 5555, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5553, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22197:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": ">>=", + "rightHandSide": { + "hexValue": "3634", + "id": 5554, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22204:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "22197:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5556, + "nodeType": "ExpressionStatement", + "src": "22197:9:19" + }, + { + "expression": { + "id": 5559, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5557, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "22224:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "<<=", + "rightHandSide": { + "hexValue": "3332", + "id": 5558, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22231:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "22224:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5560, + "nodeType": "ExpressionStatement", + "src": "22224:9:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5568, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5563, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22265:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_rational_4294967296_by_1", + "typeString": "int_const 4294967296" + }, + "id": 5566, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5564, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22272:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3332", + "id": 5565, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22277:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "22272:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4294967296_by_1", + "typeString": "int_const 4294967296" + } + } + ], + "id": 5567, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "22271:9:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4294967296_by_1", + "typeString": "int_const 4294967296" + } + }, + "src": "22265:15:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5578, + "nodeType": "IfStatement", + "src": "22261:90:19", + "trueBody": { + "id": 5577, + "nodeType": "Block", + "src": "22282:69:19", + "statements": [ + { + "expression": { + "id": 5571, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5569, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22300:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": ">>=", + "rightHandSide": { + "hexValue": "3332", + "id": 5570, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22307:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "22300:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5572, + "nodeType": "ExpressionStatement", + "src": "22300:9:19" + }, + { + "expression": { + "id": 5575, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5573, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "22327:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "<<=", + "rightHandSide": { + "hexValue": "3136", + "id": 5574, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22334:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "22327:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5576, + "nodeType": "ExpressionStatement", + "src": "22327:9:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5584, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5579, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22368:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_rational_65536_by_1", + "typeString": "int_const 65536" + }, + "id": 5582, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5580, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22375:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "3136", + "id": 5581, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22380:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "22375:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_65536_by_1", + "typeString": "int_const 65536" + } + } + ], + "id": 5583, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "22374:9:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_65536_by_1", + "typeString": "int_const 65536" + } + }, + "src": "22368:15:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5594, + "nodeType": "IfStatement", + "src": "22364:89:19", + "trueBody": { + "id": 5593, + "nodeType": "Block", + "src": "22385:68:19", + "statements": [ + { + "expression": { + "id": 5587, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5585, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22403:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": ">>=", + "rightHandSide": { + "hexValue": "3136", + "id": 5586, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22410:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "22403:9:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5588, + "nodeType": "ExpressionStatement", + "src": "22403:9:19" + }, + { + "expression": { + "id": 5591, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5589, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "22430:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "<<=", + "rightHandSide": { + "hexValue": "38", + "id": 5590, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22437:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "22430:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5592, + "nodeType": "ExpressionStatement", + "src": "22430:8:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5600, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5595, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22470:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_rational_256_by_1", + "typeString": "int_const 256" + }, + "id": 5598, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5596, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22477:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "38", + "id": 5597, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22482:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "22477:6:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_256_by_1", + "typeString": "int_const 256" + } + } + ], + "id": 5599, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "22476:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_256_by_1", + "typeString": "int_const 256" + } + }, + "src": "22470:14:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5610, + "nodeType": "IfStatement", + "src": "22466:87:19", + "trueBody": { + "id": 5609, + "nodeType": "Block", + "src": "22486:67:19", + "statements": [ + { + "expression": { + "id": 5603, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5601, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22504:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": ">>=", + "rightHandSide": { + "hexValue": "38", + "id": 5602, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22511:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "22504:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5604, + "nodeType": "ExpressionStatement", + "src": "22504:8:19" + }, + { + "expression": { + "id": 5607, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5605, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "22530:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "<<=", + "rightHandSide": { + "hexValue": "34", + "id": 5606, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22537:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "22530:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5608, + "nodeType": "ExpressionStatement", + "src": "22530:8:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5616, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5611, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22570:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "id": 5614, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5612, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22577:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "34", + "id": 5613, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22582:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "22577:6:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + } + } + ], + "id": 5615, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "22576:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + } + }, + "src": "22570:14:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5626, + "nodeType": "IfStatement", + "src": "22566:87:19", + "trueBody": { + "id": 5625, + "nodeType": "Block", + "src": "22586:67:19", + "statements": [ + { + "expression": { + "id": 5619, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5617, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22604:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": ">>=", + "rightHandSide": { + "hexValue": "34", + "id": 5618, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22611:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "22604:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5620, + "nodeType": "ExpressionStatement", + "src": "22604:8:19" + }, + { + "expression": { + "id": 5623, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5621, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "22630:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "<<=", + "rightHandSide": { + "hexValue": "32", + "id": 5622, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22637:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "22630:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5624, + "nodeType": "ExpressionStatement", + "src": "22630:8:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5632, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5627, + "name": "aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5524, + "src": "22670:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "id": 5630, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5628, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22677:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "32", + "id": 5629, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22682:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "22677:6:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + } + } + ], + "id": 5631, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "22676:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + } + }, + "src": "22670:14:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5638, + "nodeType": "IfStatement", + "src": "22666:61:19", + "trueBody": { + "id": 5637, + "nodeType": "Block", + "src": "22686:41:19", + "statements": [ + { + "expression": { + "id": 5635, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5633, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "22704:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "<<=", + "rightHandSide": { + "hexValue": "31", + "id": 5634, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22711:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "22704:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5636, + "nodeType": "ExpressionStatement", + "src": "22704:8:19" + } + ] + } + }, + { + "expression": { + "id": 5646, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5639, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "23147:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5645, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5642, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "33", + "id": 5640, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "23153:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5641, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "23157:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "23153:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5643, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "23152:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "31", + "id": 5644, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "23164:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "23152:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "23147:18:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5647, + "nodeType": "ExpressionStatement", + "src": "23147:18:19" + }, + { + "expression": { + "id": 5657, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5648, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25052:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5656, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5653, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5649, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25058:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5652, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5650, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "25063:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 5651, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25067:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25063:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25058:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5654, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "25057:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "31", + "id": 5655, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "25074:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "25057:18:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25052:23:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5658, + "nodeType": "ExpressionStatement", + "src": "25052:23:19" + }, + { + "expression": { + "id": 5668, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5659, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25161:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5667, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5664, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5660, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25167:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5663, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5661, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "25172:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 5662, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25176:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25172:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25167:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5665, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "25166:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "31", + "id": 5666, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "25183:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "25166:18:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25161:23:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5669, + "nodeType": "ExpressionStatement", + "src": "25161:23:19" + }, + { + "expression": { + "id": 5679, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5670, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25272:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5678, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5675, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5671, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25278:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5674, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5672, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "25283:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 5673, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25287:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25283:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25278:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5676, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "25277:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "31", + "id": 5677, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "25294:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "25277:18:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25272:23:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5680, + "nodeType": "ExpressionStatement", + "src": "25272:23:19" + }, + { + "expression": { + "id": 5690, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5681, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25381:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5689, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5686, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5682, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25387:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5685, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5683, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "25392:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 5684, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25396:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25392:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25387:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5687, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "25386:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "31", + "id": 5688, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "25403:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "25386:18:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25381:23:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5691, + "nodeType": "ExpressionStatement", + "src": "25381:23:19" + }, + { + "expression": { + "id": 5701, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5692, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25491:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5700, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5697, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5693, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25497:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5696, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5694, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "25502:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 5695, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25506:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25502:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25497:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5698, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "25496:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "31", + "id": 5699, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "25513:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "25496:18:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25491:23:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5702, + "nodeType": "ExpressionStatement", + "src": "25491:23:19" + }, + { + "expression": { + "id": 5712, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5703, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25601:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5711, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5708, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5704, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25607:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5707, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5705, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "25612:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 5706, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25616:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25612:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25607:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5709, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "25606:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "31", + "id": 5710, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "25623:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "25606:18:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25601:23:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5713, + "nodeType": "ExpressionStatement", + "src": "25601:23:19" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5723, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5714, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "25990:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5721, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5717, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "26011:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5720, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5718, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5511, + "src": "26016:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "id": 5719, + "name": "xn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5528, + "src": "26020:2:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26016:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26011:11:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5715, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "25995:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5716, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "26004:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "25995:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5722, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "25995:28:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "25990:33:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5515, + "id": 5724, + "nodeType": "Return", + "src": "25983:40:19" + } + ] + } + ] + }, + "documentation": { + "id": 5509, + "nodeType": "StructuredDocumentation", + "src": "20562:292:19", + "text": " @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded\n towards zero.\n This method is based on Newton's method for computing square roots; the algorithm is restricted to only\n using integer operations." + }, + "id": 5727, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "sqrt", + "nameLocation": "20868:4:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5512, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5511, + "mutability": "mutable", + "name": "a", + "nameLocation": "20881:1:19", + "nodeType": "VariableDeclaration", + "scope": 5727, + "src": "20873:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5510, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "20873:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "20872:11:19" + }, + "returnParameters": { + "id": 5515, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5514, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5727, + "src": "20907:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5513, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "20907:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "20906:9:19" + }, + "scope": 6204, + "src": "20859:5181:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5760, + "nodeType": "Block", + "src": "26213:171:19", + "statements": [ + { + "id": 5759, + "nodeType": "UncheckedBlock", + "src": "26223:155:19", + "statements": [ + { + "assignments": [ + 5739 + ], + "declarations": [ + { + "constant": false, + "id": 5739, + "mutability": "mutable", + "name": "result", + "nameLocation": "26255:6:19", + "nodeType": "VariableDeclaration", + "scope": 5759, + "src": "26247:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5738, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "26247:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5743, + "initialValue": { + "arguments": [ + { + "id": 5741, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5730, + "src": "26269:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5740, + "name": "sqrt", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 5727, + 5761 + ], + "referencedDeclaration": 5727, + "src": "26264:4:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256) pure returns (uint256)" + } + }, + "id": 5742, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "26264:7:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "26247:24:19" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5757, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5744, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5739, + "src": "26292:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 5755, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 5748, + "name": "rounding", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5733, + "src": "26334:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + ], + "id": 5747, + "name": "unsignedRoundsUp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6182, + "src": "26317:16:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_Rounding_$4559_$returns$_t_bool_$", + "typeString": "function (enum Math.Rounding) pure returns (bool)" + } + }, + "id": 5749, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "26317:26:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5754, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5752, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5750, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5739, + "src": "26347:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "id": 5751, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5739, + "src": "26356:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26347:15:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 5753, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5730, + "src": "26365:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26347:19:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "26317:49:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5745, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "26301:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5746, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "26310:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "26301:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5756, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "26301:66:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26292:75:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5737, + "id": 5758, + "nodeType": "Return", + "src": "26285:82:19" + } + ] + } + ] + }, + "documentation": { + "id": 5728, + "nodeType": "StructuredDocumentation", + "src": "26046:86:19", + "text": " @dev Calculates sqrt(a), following the selected rounding direction." + }, + "id": 5761, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "sqrt", + "nameLocation": "26146:4:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5734, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5730, + "mutability": "mutable", + "name": "a", + "nameLocation": "26159:1:19", + "nodeType": "VariableDeclaration", + "scope": 5761, + "src": "26151:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5729, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "26151:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5733, + "mutability": "mutable", + "name": "rounding", + "nameLocation": "26171:8:19", + "nodeType": "VariableDeclaration", + "scope": 5761, + "src": "26162:17:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + }, + "typeName": { + "id": 5732, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 5731, + "name": "Rounding", + "nameLocations": [ + "26162:8:19" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4559, + "src": "26162:8:19" + }, + "referencedDeclaration": 4559, + "src": "26162:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + }, + "visibility": "internal" + } + ], + "src": "26150:30:19" + }, + "returnParameters": { + "id": 5737, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5736, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5761, + "src": "26204:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5735, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "26204:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "26203:9:19" + }, + "scope": 6204, + "src": "26137:247:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5851, + "nodeType": "Block", + "src": "26573:2359:19", + "statements": [ + { + "expression": { + "id": 5778, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5769, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "26655:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5777, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5774, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5772, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5764, + "src": "26675:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30786666666666666666666666666666666666666666666666666666666666666666", + "id": 5773, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "26679:34:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_340282366920938463463374607431768211455_by_1", + "typeString": "int_const 3402...(31 digits omitted)...1455" + }, + "value": "0xffffffffffffffffffffffffffffffff" + }, + "src": "26675:38:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5770, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "26659:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5771, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "26668:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "26659:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5775, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "26659:55:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "37", + "id": 5776, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "26718:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_7_by_1", + "typeString": "int_const 7" + }, + "value": "7" + }, + "src": "26659:60:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26655:64:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5779, + "nodeType": "ExpressionStatement", + "src": "26655:64:19" + }, + { + "expression": { + "id": 5792, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5780, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "26795:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "|=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5791, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5788, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5785, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5783, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5764, + "src": "26817:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 5784, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "26822:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26817:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5786, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "26816:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "307866666666666666666666666666666666", + "id": 5787, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "26827:18:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_18446744073709551615_by_1", + "typeString": "int_const 18446744073709551615" + }, + "value": "0xffffffffffffffff" + }, + "src": "26816:29:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5781, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "26800:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5782, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "26809:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "26800:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5789, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "26800:46:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "36", + "id": 5790, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "26850:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_6_by_1", + "typeString": "int_const 6" + }, + "value": "6" + }, + "src": "26800:51:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26795:56:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5793, + "nodeType": "ExpressionStatement", + "src": "26795:56:19" + }, + { + "expression": { + "id": 5806, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5794, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "26926:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "|=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5805, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5802, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5799, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5797, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5764, + "src": "26948:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 5798, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "26953:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26948:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5800, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "26947:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30786666666666666666", + "id": 5801, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "26958:10:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4294967295_by_1", + "typeString": "int_const 4294967295" + }, + "value": "0xffffffff" + }, + "src": "26947:21:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5795, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "26931:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5796, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "26940:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "26931:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5803, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "26931:38:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "35", + "id": 5804, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "26973:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_5_by_1", + "typeString": "int_const 5" + }, + "value": "5" + }, + "src": "26931:43:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "26926:48:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5807, + "nodeType": "ExpressionStatement", + "src": "26926:48:19" + }, + { + "expression": { + "id": 5820, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5808, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "27049:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "|=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5819, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5816, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5813, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5811, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5764, + "src": "27071:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 5812, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "27076:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "27071:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5814, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "27070:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "307866666666", + "id": 5815, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "27081:6:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_65535_by_1", + "typeString": "int_const 65535" + }, + "value": "0xffff" + }, + "src": "27070:17:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5809, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "27054:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5810, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "27063:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "27054:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5817, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "27054:34:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "34", + "id": 5818, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "27092:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "27054:39:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "27049:44:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5821, + "nodeType": "ExpressionStatement", + "src": "27049:44:19" + }, + { + "expression": { + "id": 5834, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5822, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "27166:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "|=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5833, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5830, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5827, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5825, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5764, + "src": "27188:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 5826, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "27193:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "27188:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5828, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "27187:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30786666", + "id": 5829, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "27198:4:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "0xff" + }, + "src": "27187:15:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5823, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "27171:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5824, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "27180:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "27171:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5831, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "27171:32:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "33", + "id": 5832, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "27207:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "src": "27171:37:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "27166:42:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5835, + "nodeType": "ExpressionStatement", + "src": "27166:42:19" + }, + { + "expression": { + "id": 5848, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5836, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "27280:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "|=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5847, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5844, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5841, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5839, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5764, + "src": "27302:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 5840, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5767, + "src": "27307:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "27302:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 5842, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "27301:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "307866", + "id": 5843, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "27312:3:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_15_by_1", + "typeString": "int_const 15" + }, + "value": "0xf" + }, + "src": "27301:14:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5837, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "27285:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5838, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "27294:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "27285:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5845, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "27285:31:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "32", + "id": 5846, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "27320:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "27285:36:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "27280:41:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5849, + "nodeType": "ExpressionStatement", + "src": "27280:41:19" + }, + { + "AST": { + "nativeSrc": "28807:119:19", + "nodeType": "YulBlock", + "src": "28807:119:19", + "statements": [ + { + "nativeSrc": "28821:95:19", + "nodeType": "YulAssignment", + "src": "28821:95:19", + "value": { + "arguments": [ + { + "name": "r", + "nativeSrc": "28829:1:19", + "nodeType": "YulIdentifier", + "src": "28829:1:19" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "r", + "nativeSrc": "28841:1:19", + "nodeType": "YulIdentifier", + "src": "28841:1:19" + }, + { + "name": "x", + "nativeSrc": "28844:1:19", + "nodeType": "YulIdentifier", + "src": "28844:1:19" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "28837:3:19", + "nodeType": "YulIdentifier", + "src": "28837:3:19" + }, + "nativeSrc": "28837:9:19", + "nodeType": "YulFunctionCall", + "src": "28837:9:19" + }, + { + "kind": "number", + "nativeSrc": "28848:66:19", + "nodeType": "YulLiteral", + "src": "28848:66:19", + "type": "", + "value": "0x0000010102020202030303030303030300000000000000000000000000000000" + } + ], + "functionName": { + "name": "byte", + "nativeSrc": "28832:4:19", + "nodeType": "YulIdentifier", + "src": "28832:4:19" + }, + "nativeSrc": "28832:83:19", + "nodeType": "YulFunctionCall", + "src": "28832:83:19" + } + ], + "functionName": { + "name": "or", + "nativeSrc": "28826:2:19", + "nodeType": "YulIdentifier", + "src": "28826:2:19" + }, + "nativeSrc": "28826:90:19", + "nodeType": "YulFunctionCall", + "src": "28826:90:19" + }, + "variableNames": [ + { + "name": "r", + "nativeSrc": "28821:1:19", + "nodeType": "YulIdentifier", + "src": "28821:1:19" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 5767, + "isOffset": false, + "isSlot": false, + "src": "28821:1:19", + "valueSize": 1 + }, + { + "declaration": 5767, + "isOffset": false, + "isSlot": false, + "src": "28829:1:19", + "valueSize": 1 + }, + { + "declaration": 5767, + "isOffset": false, + "isSlot": false, + "src": "28841:1:19", + "valueSize": 1 + }, + { + "declaration": 5764, + "isOffset": false, + "isSlot": false, + "src": "28844:1:19", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 5850, + "nodeType": "InlineAssembly", + "src": "28782:144:19" + } + ] + }, + "documentation": { + "id": 5762, + "nodeType": "StructuredDocumentation", + "src": "26390:119:19", + "text": " @dev Return the log in base 2 of a positive value rounded towards zero.\n Returns 0 if given 0." + }, + "id": 5852, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "log2", + "nameLocation": "26523:4:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5765, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5764, + "mutability": "mutable", + "name": "x", + "nameLocation": "26536:1:19", + "nodeType": "VariableDeclaration", + "scope": 5852, + "src": "26528:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5763, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "26528:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "26527:11:19" + }, + "returnParameters": { + "id": 5768, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5767, + "mutability": "mutable", + "name": "r", + "nameLocation": "26570:1:19", + "nodeType": "VariableDeclaration", + "scope": 5852, + "src": "26562:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5766, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "26562:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "26561:11:19" + }, + "scope": 6204, + "src": "26514:2418:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 5885, + "nodeType": "Block", + "src": "29165:175:19", + "statements": [ + { + "id": 5884, + "nodeType": "UncheckedBlock", + "src": "29175:159:19", + "statements": [ + { + "assignments": [ + 5864 + ], + "declarations": [ + { + "constant": false, + "id": 5864, + "mutability": "mutable", + "name": "result", + "nameLocation": "29207:6:19", + "nodeType": "VariableDeclaration", + "scope": 5884, + "src": "29199:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5863, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "29199:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5868, + "initialValue": { + "arguments": [ + { + "id": 5866, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5855, + "src": "29221:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 5865, + "name": "log2", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 5852, + 5886 + ], + "referencedDeclaration": 5852, + "src": "29216:4:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256) pure returns (uint256)" + } + }, + "id": 5867, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "29216:11:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "29199:28:19" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5882, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5869, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5864, + "src": "29248:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 5880, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 5873, + "name": "rounding", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5858, + "src": "29290:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + ], + "id": 5872, + "name": "unsignedRoundsUp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6182, + "src": "29273:16:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_Rounding_$4559_$returns$_t_bool_$", + "typeString": "function (enum Math.Rounding) pure returns (bool)" + } + }, + "id": 5874, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "29273:26:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5879, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5877, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 5875, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29303:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "id": 5876, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5864, + "src": "29308:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "29303:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 5878, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5855, + "src": "29317:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "29303:19:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "29273:49:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 5870, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "29257:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 5871, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "29266:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "29257:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 5881, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "29257:66:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "29248:75:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5862, + "id": 5883, + "nodeType": "Return", + "src": "29241:82:19" + } + ] + } + ] + }, + "documentation": { + "id": 5853, + "nodeType": "StructuredDocumentation", + "src": "28938:142:19", + "text": " @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n Returns 0 if given 0." + }, + "id": 5886, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "log2", + "nameLocation": "29094:4:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5859, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5855, + "mutability": "mutable", + "name": "value", + "nameLocation": "29107:5:19", + "nodeType": "VariableDeclaration", + "scope": 5886, + "src": "29099:13:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5854, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "29099:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5858, + "mutability": "mutable", + "name": "rounding", + "nameLocation": "29123:8:19", + "nodeType": "VariableDeclaration", + "scope": 5886, + "src": "29114:17:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + }, + "typeName": { + "id": 5857, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 5856, + "name": "Rounding", + "nameLocations": [ + "29114:8:19" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4559, + "src": "29114:8:19" + }, + "referencedDeclaration": 4559, + "src": "29114:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + }, + "visibility": "internal" + } + ], + "src": "29098:34:19" + }, + "returnParameters": { + "id": 5862, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5861, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 5886, + "src": "29156:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5860, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "29156:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "29155:9:19" + }, + "scope": 6204, + "src": "29085:255:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6014, + "nodeType": "Block", + "src": "29533:854:19", + "statements": [ + { + "assignments": [ + 5895 + ], + "declarations": [ + { + "constant": false, + "id": 5895, + "mutability": "mutable", + "name": "result", + "nameLocation": "29551:6:19", + "nodeType": "VariableDeclaration", + "scope": 6014, + "src": "29543:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5894, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "29543:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 5897, + "initialValue": { + "hexValue": "30", + "id": 5896, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29560:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "29543:18:19" + }, + { + "id": 6011, + "nodeType": "UncheckedBlock", + "src": "29571:787:19", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5902, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5898, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "29599:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_rational_10000000000000000000000000000000000000000000000000000000000000000_by_1", + "typeString": "int_const 1000...(57 digits omitted)...0000" + }, + "id": 5901, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5899, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29608:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "3634", + "id": 5900, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29614:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "29608:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10000000000000000000000000000000000000000000000000000000000000000_by_1", + "typeString": "int_const 1000...(57 digits omitted)...0000" + } + }, + "src": "29599:17:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5914, + "nodeType": "IfStatement", + "src": "29595:103:19", + "trueBody": { + "id": 5913, + "nodeType": "Block", + "src": "29618:80:19", + "statements": [ + { + "expression": { + "id": 5907, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5903, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "29636:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "/=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_rational_10000000000000000000000000000000000000000000000000000000000000000_by_1", + "typeString": "int_const 1000...(57 digits omitted)...0000" + }, + "id": 5906, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5904, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29645:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "3634", + "id": 5905, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29651:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "29645:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10000000000000000000000000000000000000000000000000000000000000000_by_1", + "typeString": "int_const 1000...(57 digits omitted)...0000" + } + }, + "src": "29636:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5908, + "nodeType": "ExpressionStatement", + "src": "29636:17:19" + }, + { + "expression": { + "id": 5911, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5909, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5895, + "src": "29671:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "hexValue": "3634", + "id": 5910, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29681:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + "src": "29671:12:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5912, + "nodeType": "ExpressionStatement", + "src": "29671:12:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5919, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5915, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "29715:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_rational_100000000000000000000000000000000_by_1", + "typeString": "int_const 1000...(25 digits omitted)...0000" + }, + "id": 5918, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5916, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29724:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "3332", + "id": 5917, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29730:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "29724:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_100000000000000000000000000000000_by_1", + "typeString": "int_const 1000...(25 digits omitted)...0000" + } + }, + "src": "29715:17:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5931, + "nodeType": "IfStatement", + "src": "29711:103:19", + "trueBody": { + "id": 5930, + "nodeType": "Block", + "src": "29734:80:19", + "statements": [ + { + "expression": { + "id": 5924, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5920, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "29752:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "/=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_rational_100000000000000000000000000000000_by_1", + "typeString": "int_const 1000...(25 digits omitted)...0000" + }, + "id": 5923, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5921, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29761:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "3332", + "id": 5922, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29767:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "29761:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_100000000000000000000000000000000_by_1", + "typeString": "int_const 1000...(25 digits omitted)...0000" + } + }, + "src": "29752:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5925, + "nodeType": "ExpressionStatement", + "src": "29752:17:19" + }, + { + "expression": { + "id": 5928, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5926, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5895, + "src": "29787:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "hexValue": "3332", + "id": 5927, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29797:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "29787:12:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5929, + "nodeType": "ExpressionStatement", + "src": "29787:12:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5936, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5932, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "29831:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_rational_10000000000000000_by_1", + "typeString": "int_const 10000000000000000" + }, + "id": 5935, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5933, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29840:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "3136", + "id": 5934, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29846:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "29840:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10000000000000000_by_1", + "typeString": "int_const 10000000000000000" + } + }, + "src": "29831:17:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5948, + "nodeType": "IfStatement", + "src": "29827:103:19", + "trueBody": { + "id": 5947, + "nodeType": "Block", + "src": "29850:80:19", + "statements": [ + { + "expression": { + "id": 5941, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5937, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "29868:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "/=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_rational_10000000000000000_by_1", + "typeString": "int_const 10000000000000000" + }, + "id": 5940, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5938, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29877:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "3136", + "id": 5939, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29883:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "29877:8:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10000000000000000_by_1", + "typeString": "int_const 10000000000000000" + } + }, + "src": "29868:17:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5942, + "nodeType": "ExpressionStatement", + "src": "29868:17:19" + }, + { + "expression": { + "id": 5945, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5943, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5895, + "src": "29903:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "hexValue": "3136", + "id": 5944, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29913:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + "src": "29903:12:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5946, + "nodeType": "ExpressionStatement", + "src": "29903:12:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5953, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5949, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "29947:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_rational_100000000_by_1", + "typeString": "int_const 100000000" + }, + "id": 5952, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5950, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29956:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "38", + "id": 5951, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29962:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "29956:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_100000000_by_1", + "typeString": "int_const 100000000" + } + }, + "src": "29947:16:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5965, + "nodeType": "IfStatement", + "src": "29943:100:19", + "trueBody": { + "id": 5964, + "nodeType": "Block", + "src": "29965:78:19", + "statements": [ + { + "expression": { + "id": 5958, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5954, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "29983:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "/=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_rational_100000000_by_1", + "typeString": "int_const 100000000" + }, + "id": 5957, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5955, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29992:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "38", + "id": 5956, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29998:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "29992:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_100000000_by_1", + "typeString": "int_const 100000000" + } + }, + "src": "29983:16:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5959, + "nodeType": "ExpressionStatement", + "src": "29983:16:19" + }, + { + "expression": { + "id": 5962, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5960, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5895, + "src": "30017:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "hexValue": "38", + "id": 5961, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30027:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "src": "30017:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5963, + "nodeType": "ExpressionStatement", + "src": "30017:11:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5970, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5966, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "30060:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_rational_10000_by_1", + "typeString": "int_const 10000" + }, + "id": 5969, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5967, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30069:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "34", + "id": 5968, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30075:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "30069:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10000_by_1", + "typeString": "int_const 10000" + } + }, + "src": "30060:16:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5982, + "nodeType": "IfStatement", + "src": "30056:100:19", + "trueBody": { + "id": 5981, + "nodeType": "Block", + "src": "30078:78:19", + "statements": [ + { + "expression": { + "id": 5975, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5971, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "30096:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "/=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_rational_10000_by_1", + "typeString": "int_const 10000" + }, + "id": 5974, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5972, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30105:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "34", + "id": 5973, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30111:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "30105:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10000_by_1", + "typeString": "int_const 10000" + } + }, + "src": "30096:16:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5976, + "nodeType": "ExpressionStatement", + "src": "30096:16:19" + }, + { + "expression": { + "id": 5979, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5977, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5895, + "src": "30130:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "hexValue": "34", + "id": 5978, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30140:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "30130:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5980, + "nodeType": "ExpressionStatement", + "src": "30130:11:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 5987, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 5983, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "30173:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_rational_100_by_1", + "typeString": "int_const 100" + }, + "id": 5986, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5984, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30182:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "32", + "id": 5985, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30188:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "30182:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_100_by_1", + "typeString": "int_const 100" + } + }, + "src": "30173:16:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 5999, + "nodeType": "IfStatement", + "src": "30169:100:19", + "trueBody": { + "id": 5998, + "nodeType": "Block", + "src": "30191:78:19", + "statements": [ + { + "expression": { + "id": 5992, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5988, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "30209:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "/=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_rational_100_by_1", + "typeString": "int_const 100" + }, + "id": 5991, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 5989, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30218:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "32", + "id": 5990, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30224:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "30218:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_100_by_1", + "typeString": "int_const 100" + } + }, + "src": "30209:16:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5993, + "nodeType": "ExpressionStatement", + "src": "30209:16:19" + }, + { + "expression": { + "id": 5996, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 5994, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5895, + "src": "30243:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "hexValue": "32", + "id": 5995, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30253:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "30243:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 5997, + "nodeType": "ExpressionStatement", + "src": "30243:11:19" + } + ] + } + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6004, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6000, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5889, + "src": "30286:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "id": 6003, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 6001, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30295:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "hexValue": "31", + "id": 6002, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30301:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "30295:7:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + } + }, + "src": "30286:16:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6010, + "nodeType": "IfStatement", + "src": "30282:66:19", + "trueBody": { + "id": 6009, + "nodeType": "Block", + "src": "30304:44:19", + "statements": [ + { + "expression": { + "id": 6007, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 6005, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5895, + "src": "30322:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "hexValue": "31", + "id": 6006, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30332:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "30322:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 6008, + "nodeType": "ExpressionStatement", + "src": "30322:11:19" + } + ] + } + } + ] + }, + { + "expression": { + "id": 6012, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5895, + "src": "30374:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 5893, + "id": 6013, + "nodeType": "Return", + "src": "30367:13:19" + } + ] + }, + "documentation": { + "id": 5887, + "nodeType": "StructuredDocumentation", + "src": "29346:120:19", + "text": " @dev Return the log in base 10 of a positive value rounded towards zero.\n Returns 0 if given 0." + }, + "id": 6015, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "log10", + "nameLocation": "29480:5:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 5890, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5889, + "mutability": "mutable", + "name": "value", + "nameLocation": "29494:5:19", + "nodeType": "VariableDeclaration", + "scope": 6015, + "src": "29486:13:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5888, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "29486:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "29485:15:19" + }, + "returnParameters": { + "id": 5893, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5892, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6015, + "src": "29524:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 5891, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "29524:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "29523:9:19" + }, + "scope": 6204, + "src": "29471:916:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6048, + "nodeType": "Block", + "src": "30622:177:19", + "statements": [ + { + "id": 6047, + "nodeType": "UncheckedBlock", + "src": "30632:161:19", + "statements": [ + { + "assignments": [ + 6027 + ], + "declarations": [ + { + "constant": false, + "id": 6027, + "mutability": "mutable", + "name": "result", + "nameLocation": "30664:6:19", + "nodeType": "VariableDeclaration", + "scope": 6047, + "src": "30656:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6026, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "30656:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 6031, + "initialValue": { + "arguments": [ + { + "id": 6029, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6018, + "src": "30679:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6028, + "name": "log10", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 6015, + 6049 + ], + "referencedDeclaration": 6015, + "src": "30673:5:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256) pure returns (uint256)" + } + }, + "id": 6030, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "30673:12:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "30656:29:19" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6045, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6032, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6027, + "src": "30706:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 6043, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 6036, + "name": "rounding", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6021, + "src": "30748:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + ], + "id": 6035, + "name": "unsignedRoundsUp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6182, + "src": "30731:16:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_Rounding_$4559_$returns$_t_bool_$", + "typeString": "function (enum Math.Rounding) pure returns (bool)" + } + }, + "id": 6037, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "30731:26:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6042, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6040, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "3130", + "id": 6038, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30761:2:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "id": 6039, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6027, + "src": "30767:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "30761:12:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 6041, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6018, + "src": "30776:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "30761:20:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "30731:50:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 6033, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "30715:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 6034, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "30724:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "30715:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 6044, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "30715:67:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "30706:76:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 6025, + "id": 6046, + "nodeType": "Return", + "src": "30699:83:19" + } + ] + } + ] + }, + "documentation": { + "id": 6016, + "nodeType": "StructuredDocumentation", + "src": "30393:143:19", + "text": " @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n Returns 0 if given 0." + }, + "id": 6049, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "log10", + "nameLocation": "30550:5:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6022, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6018, + "mutability": "mutable", + "name": "value", + "nameLocation": "30564:5:19", + "nodeType": "VariableDeclaration", + "scope": 6049, + "src": "30556:13:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6017, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "30556:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 6021, + "mutability": "mutable", + "name": "rounding", + "nameLocation": "30580:8:19", + "nodeType": "VariableDeclaration", + "scope": 6049, + "src": "30571:17:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + }, + "typeName": { + "id": 6020, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 6019, + "name": "Rounding", + "nameLocations": [ + "30571:8:19" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4559, + "src": "30571:8:19" + }, + "referencedDeclaration": 4559, + "src": "30571:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + }, + "visibility": "internal" + } + ], + "src": "30555:34:19" + }, + "returnParameters": { + "id": 6025, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6024, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6049, + "src": "30613:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6023, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "30613:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "30612:9:19" + }, + "scope": 6204, + "src": "30541:258:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6125, + "nodeType": "Block", + "src": "31117:675:19", + "statements": [ + { + "expression": { + "id": 6066, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 6057, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6055, + "src": "31199:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6065, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6062, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6060, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6052, + "src": "31219:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30786666666666666666666666666666666666666666666666666666666666666666", + "id": 6061, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31223:34:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_340282366920938463463374607431768211455_by_1", + "typeString": "int_const 3402...(31 digits omitted)...1455" + }, + "value": "0xffffffffffffffffffffffffffffffff" + }, + "src": "31219:38:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 6058, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "31203:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 6059, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "31212:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "31203:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 6063, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "31203:55:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "37", + "id": 6064, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31262:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_7_by_1", + "typeString": "int_const 7" + }, + "value": "7" + }, + "src": "31203:60:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "31199:64:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 6067, + "nodeType": "ExpressionStatement", + "src": "31199:64:19" + }, + { + "expression": { + "id": 6080, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 6068, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6055, + "src": "31339:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "|=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6079, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6076, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6073, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6071, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6052, + "src": "31361:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 6072, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6055, + "src": "31366:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "31361:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 6074, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "31360:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "307866666666666666666666666666666666", + "id": 6075, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31371:18:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_18446744073709551615_by_1", + "typeString": "int_const 18446744073709551615" + }, + "value": "0xffffffffffffffff" + }, + "src": "31360:29:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 6069, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "31344:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 6070, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "31353:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "31344:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 6077, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "31344:46:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "36", + "id": 6078, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31394:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_6_by_1", + "typeString": "int_const 6" + }, + "value": "6" + }, + "src": "31344:51:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "31339:56:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 6081, + "nodeType": "ExpressionStatement", + "src": "31339:56:19" + }, + { + "expression": { + "id": 6094, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 6082, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6055, + "src": "31470:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "|=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6093, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6090, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6087, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6085, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6052, + "src": "31492:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 6086, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6055, + "src": "31497:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "31492:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 6088, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "31491:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30786666666666666666", + "id": 6089, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31502:10:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4294967295_by_1", + "typeString": "int_const 4294967295" + }, + "value": "0xffffffff" + }, + "src": "31491:21:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 6083, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "31475:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 6084, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "31484:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "31475:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 6091, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "31475:38:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "35", + "id": 6092, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31517:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_5_by_1", + "typeString": "int_const 5" + }, + "value": "5" + }, + "src": "31475:43:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "31470:48:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 6095, + "nodeType": "ExpressionStatement", + "src": "31470:48:19" + }, + { + "expression": { + "id": 6108, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 6096, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6055, + "src": "31593:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "|=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6107, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6104, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6101, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6099, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6052, + "src": "31615:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 6100, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6055, + "src": "31620:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "31615:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 6102, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "31614:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "307866666666", + "id": 6103, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31625:6:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_65535_by_1", + "typeString": "int_const 65535" + }, + "value": "0xffff" + }, + "src": "31614:17:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 6097, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "31598:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 6098, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "31607:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "31598:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 6105, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "31598:34:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "34", + "id": 6106, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31636:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "31598:39:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "31593:44:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 6109, + "nodeType": "ExpressionStatement", + "src": "31593:44:19" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6123, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6112, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6110, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6055, + "src": "31743:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "33", + "id": 6111, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31748:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "src": "31743:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 6113, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "31742:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "|", + "rightExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6121, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6118, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6116, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6052, + "src": "31770:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "id": 6117, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6055, + "src": "31775:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "31770:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 6119, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "31769:8:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30786666", + "id": 6120, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31780:4:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "0xff" + }, + "src": "31769:15:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 6114, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "31753:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 6115, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "31762:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "31753:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 6122, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "31753:32:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "31742:43:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 6056, + "id": 6124, + "nodeType": "Return", + "src": "31735:50:19" + } + ] + }, + "documentation": { + "id": 6050, + "nodeType": "StructuredDocumentation", + "src": "30805:246:19", + "text": " @dev Return the log in base 256 of a positive value rounded towards zero.\n Returns 0 if given 0.\n Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string." + }, + "id": 6126, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "log256", + "nameLocation": "31065:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6053, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6052, + "mutability": "mutable", + "name": "x", + "nameLocation": "31080:1:19", + "nodeType": "VariableDeclaration", + "scope": 6126, + "src": "31072:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6051, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "31072:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "31071:11:19" + }, + "returnParameters": { + "id": 6056, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6055, + "mutability": "mutable", + "name": "r", + "nameLocation": "31114:1:19", + "nodeType": "VariableDeclaration", + "scope": 6126, + "src": "31106:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6054, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "31106:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "31105:11:19" + }, + "scope": 6204, + "src": "31056:736:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6162, + "nodeType": "Block", + "src": "32029:184:19", + "statements": [ + { + "id": 6161, + "nodeType": "UncheckedBlock", + "src": "32039:168:19", + "statements": [ + { + "assignments": [ + 6138 + ], + "declarations": [ + { + "constant": false, + "id": 6138, + "mutability": "mutable", + "name": "result", + "nameLocation": "32071:6:19", + "nodeType": "VariableDeclaration", + "scope": 6161, + "src": "32063:14:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6137, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "32063:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 6142, + "initialValue": { + "arguments": [ + { + "id": 6140, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6129, + "src": "32087:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6139, + "name": "log256", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 6126, + 6163 + ], + "referencedDeclaration": 6126, + "src": "32080:6:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256) pure returns (uint256)" + } + }, + "id": 6141, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "32080:13:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "32063:30:19" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6159, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6143, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6138, + "src": "32114:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 6157, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 6147, + "name": "rounding", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6132, + "src": "32156:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + ], + "id": 6146, + "name": "unsignedRoundsUp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6182, + "src": "32139:16:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_enum$_Rounding_$4559_$returns$_t_bool_$", + "typeString": "function (enum Math.Rounding) pure returns (bool)" + } + }, + "id": 6148, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "32139:26:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6156, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6154, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "31", + "id": 6149, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "32169:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6152, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6150, + "name": "result", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6138, + "src": "32175:6:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<<", + "rightExpression": { + "hexValue": "33", + "id": 6151, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "32185:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "src": "32175:11:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 6153, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "32174:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "32169:18:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 6155, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6129, + "src": "32190:5:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "32169:26:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "32139:56:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 6144, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "32123:8:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 6145, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "32132:6:19", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "32123:15:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 6158, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "32123:73:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "32114:82:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 6136, + "id": 6160, + "nodeType": "Return", + "src": "32107:89:19" + } + ] + } + ] + }, + "documentation": { + "id": 6127, + "nodeType": "StructuredDocumentation", + "src": "31798:144:19", + "text": " @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n Returns 0 if given 0." + }, + "id": 6163, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "log256", + "nameLocation": "31956:6:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6133, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6129, + "mutability": "mutable", + "name": "value", + "nameLocation": "31971:5:19", + "nodeType": "VariableDeclaration", + "scope": 6163, + "src": "31963:13:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6128, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "31963:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 6132, + "mutability": "mutable", + "name": "rounding", + "nameLocation": "31987:8:19", + "nodeType": "VariableDeclaration", + "scope": 6163, + "src": "31978:17:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + }, + "typeName": { + "id": 6131, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 6130, + "name": "Rounding", + "nameLocations": [ + "31978:8:19" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4559, + "src": "31978:8:19" + }, + "referencedDeclaration": 4559, + "src": "31978:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + }, + "visibility": "internal" + } + ], + "src": "31962:34:19" + }, + "returnParameters": { + "id": 6136, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6135, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6163, + "src": "32020:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6134, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "32020:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "32019:9:19" + }, + "scope": 6204, + "src": "31947:266:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6181, + "nodeType": "Block", + "src": "32411:48:19", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 6179, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 6177, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 6174, + "name": "rounding", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6167, + "src": "32434:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + ], + "id": 6173, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "32428:5:19", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": { + "id": 6172, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "32428:5:19", + "typeDescriptions": {} + } + }, + "id": 6175, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "32428:15:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { + "hexValue": "32", + "id": 6176, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "32446:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "32428:19:19", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "31", + "id": 6178, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "32451:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "32428:24:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 6171, + "id": 6180, + "nodeType": "Return", + "src": "32421:31:19" + } + ] + }, + "documentation": { + "id": 6164, + "nodeType": "StructuredDocumentation", + "src": "32219:113:19", + "text": " @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers." + }, + "id": 6182, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "unsignedRoundsUp", + "nameLocation": "32346:16:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6168, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6167, + "mutability": "mutable", + "name": "rounding", + "nameLocation": "32372:8:19", + "nodeType": "VariableDeclaration", + "scope": 6182, + "src": "32363:17:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + }, + "typeName": { + "id": 6166, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 6165, + "name": "Rounding", + "nameLocations": [ + "32363:8:19" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4559, + "src": "32363:8:19" + }, + "referencedDeclaration": 4559, + "src": "32363:8:19", + "typeDescriptions": { + "typeIdentifier": "t_enum$_Rounding_$4559", + "typeString": "enum Math.Rounding" + } + }, + "visibility": "internal" + } + ], + "src": "32362:19:19" + }, + "returnParameters": { + "id": 6171, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6170, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6182, + "src": "32405:4:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 6169, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "32405:4:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "32404:6:19" + }, + "scope": 6204, + "src": "32337:122:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6202, + "nodeType": "Block", + "src": "32602:59:19", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6193, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6191, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6185, + "src": "32627:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "30", + "id": 6192, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "32632:1:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "32627:6:19", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "323536", + "id": 6194, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "32635:3:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_256_by_1", + "typeString": "int_const 256" + }, + "value": "256" + }, + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6199, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "hexValue": "323535", + "id": 6195, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "32640:3:19", + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "255" + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "arguments": [ + { + "id": 6197, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6185, + "src": "32651:1:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6196, + "name": "log2", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 5852, + 5886 + ], + "referencedDeclaration": 5852, + "src": "32646:4:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256) pure returns (uint256)" + } + }, + "id": 6198, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "32646:7:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "32640:13:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_rational_256_by_1", + "typeString": "int_const 256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6190, + "name": "ternary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4836, + "src": "32619:7:19", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bool,uint256,uint256) pure returns (uint256)" + } + }, + "id": 6200, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "32619:35:19", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 6189, + "id": 6201, + "nodeType": "Return", + "src": "32612:42:19" + } + ] + }, + "documentation": { + "id": 6183, + "nodeType": "StructuredDocumentation", + "src": "32465:76:19", + "text": " @dev Counts the number of leading zero bits in a uint256." + }, + "id": 6203, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "clz", + "nameLocation": "32555:3:19", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6186, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6185, + "mutability": "mutable", + "name": "x", + "nameLocation": "32567:1:19", + "nodeType": "VariableDeclaration", + "scope": 6203, + "src": "32559:9:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6184, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "32559:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "32558:11:19" + }, + "returnParameters": { + "id": 6189, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6188, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6203, + "src": "32593:7:19", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6187, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "32593:7:19", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "32592:9:19" + }, + "scope": 6204, + "src": "32546:115:19", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + } + ], + "scope": 6205, + "src": "281:32382:19", + "usedErrors": [], + "usedEvents": [] + } + ], + "src": "103:32561:19" + }, + "id": 19 + }, + "@openzeppelin/contracts/utils/math/SafeCast.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/math/SafeCast.sol", + "exportedSymbols": { + "SafeCast": [ + 7969 + ] + }, + "id": 7970, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 6206, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "192:24:20" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "SafeCast", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 6207, + "nodeType": "StructuredDocumentation", + "src": "218:550:20", + "text": " @dev Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow\n checks.\n Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n easily result in undesired exploitation or bugs, since developers usually\n assume that overflows raise errors. `SafeCast` restores this intuition by\n reverting the transaction when such an operation overflows.\n Using this library instead of the unchecked operations eliminates an entire\n class of bugs, so it's recommended to use it always." + }, + "fullyImplemented": true, + "id": 7969, + "linearizedBaseContracts": [ + 7969 + ], + "name": "SafeCast", + "nameLocation": "777:8:20", + "nodeType": "ContractDefinition", + "nodes": [ + { + "documentation": { + "id": 6208, + "nodeType": "StructuredDocumentation", + "src": "792:67:20", + "text": " @dev Value doesn't fit in a uint of `bits` size." + }, + "errorSelector": "6dfcc650", + "id": 6214, + "name": "SafeCastOverflowedUintDowncast", + "nameLocation": "870:30:20", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 6213, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6210, + "mutability": "mutable", + "name": "bits", + "nameLocation": "907:4:20", + "nodeType": "VariableDeclaration", + "scope": 6214, + "src": "901:10:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 6209, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "901:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 6212, + "mutability": "mutable", + "name": "value", + "nameLocation": "921:5:20", + "nodeType": "VariableDeclaration", + "scope": 6214, + "src": "913:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6211, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "913:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "900:27:20" + }, + "src": "864:64:20" + }, + { + "documentation": { + "id": 6215, + "nodeType": "StructuredDocumentation", + "src": "934:74:20", + "text": " @dev An int value doesn't fit in a uint of `bits` size." + }, + "errorSelector": "a8ce4432", + "id": 6219, + "name": "SafeCastOverflowedIntToUint", + "nameLocation": "1019:27:20", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 6218, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6217, + "mutability": "mutable", + "name": "value", + "nameLocation": "1054:5:20", + "nodeType": "VariableDeclaration", + "scope": 6219, + "src": "1047:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 6216, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1047:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "1046:14:20" + }, + "src": "1013:48:20" + }, + { + "documentation": { + "id": 6220, + "nodeType": "StructuredDocumentation", + "src": "1067:67:20", + "text": " @dev Value doesn't fit in an int of `bits` size." + }, + "errorSelector": "327269a7", + "id": 6226, + "name": "SafeCastOverflowedIntDowncast", + "nameLocation": "1145:29:20", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 6225, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6222, + "mutability": "mutable", + "name": "bits", + "nameLocation": "1181:4:20", + "nodeType": "VariableDeclaration", + "scope": 6226, + "src": "1175:10:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 6221, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "1175:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 6224, + "mutability": "mutable", + "name": "value", + "nameLocation": "1194:5:20", + "nodeType": "VariableDeclaration", + "scope": 6226, + "src": "1187:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 6223, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1187:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "1174:26:20" + }, + "src": "1139:62:20" + }, + { + "documentation": { + "id": 6227, + "nodeType": "StructuredDocumentation", + "src": "1207:74:20", + "text": " @dev A uint value doesn't fit in an int of `bits` size." + }, + "errorSelector": "24775e06", + "id": 6231, + "name": "SafeCastOverflowedUintToInt", + "nameLocation": "1292:27:20", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 6230, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6229, + "mutability": "mutable", + "name": "value", + "nameLocation": "1328:5:20", + "nodeType": "VariableDeclaration", + "scope": 6231, + "src": "1320:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6228, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1320:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1319:15:20" + }, + "src": "1286:49:20" + }, + { + "body": { + "id": 6258, + "nodeType": "Block", + "src": "1692:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6245, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6239, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6234, + "src": "1706:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6242, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1719:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint248_$", + "typeString": "type(uint248)" + }, + "typeName": { + "id": 6241, + "name": "uint248", + "nodeType": "ElementaryTypeName", + "src": "1719:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint248_$", + "typeString": "type(uint248)" + } + ], + "id": 6240, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "1714:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6243, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1714:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint248", + "typeString": "type(uint248)" + } + }, + "id": 6244, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "1728:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "1714:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint248", + "typeString": "uint248" + } + }, + "src": "1706:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6252, + "nodeType": "IfStatement", + "src": "1702:105:20", + "trueBody": { + "id": 6251, + "nodeType": "Block", + "src": "1733:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323438", + "id": 6247, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1785:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_248_by_1", + "typeString": "int_const 248" + }, + "value": "248" + }, + { + "id": 6248, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6234, + "src": "1790:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_248_by_1", + "typeString": "int_const 248" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6246, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "1754:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6249, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1754:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6250, + "nodeType": "RevertStatement", + "src": "1747:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6255, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6234, + "src": "1831:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6254, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1823:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint248_$", + "typeString": "type(uint248)" + }, + "typeName": { + "id": 6253, + "name": "uint248", + "nodeType": "ElementaryTypeName", + "src": "1823:7:20", + "typeDescriptions": {} + } + }, + "id": 6256, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1823:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint248", + "typeString": "uint248" + } + }, + "functionReturnParameters": 6238, + "id": 6257, + "nodeType": "Return", + "src": "1816:21:20" + } + ] + }, + "documentation": { + "id": 6232, + "nodeType": "StructuredDocumentation", + "src": "1341:280:20", + "text": " @dev Returns the downcasted uint248 from uint256, reverting on\n overflow (when the input is greater than largest uint248).\n Counterpart to Solidity's `uint248` operator.\n Requirements:\n - input must fit into 248 bits" + }, + "id": 6259, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint248", + "nameLocation": "1635:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6235, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6234, + "mutability": "mutable", + "name": "value", + "nameLocation": "1653:5:20", + "nodeType": "VariableDeclaration", + "scope": 6259, + "src": "1645:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6233, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1645:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1644:15:20" + }, + "returnParameters": { + "id": 6238, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6237, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6259, + "src": "1683:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint248", + "typeString": "uint248" + }, + "typeName": { + "id": 6236, + "name": "uint248", + "nodeType": "ElementaryTypeName", + "src": "1683:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint248", + "typeString": "uint248" + } + }, + "visibility": "internal" + } + ], + "src": "1682:9:20" + }, + "scope": 7969, + "src": "1626:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6286, + "nodeType": "Block", + "src": "2201:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6273, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6267, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6262, + "src": "2215:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6270, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2228:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint240_$", + "typeString": "type(uint240)" + }, + "typeName": { + "id": 6269, + "name": "uint240", + "nodeType": "ElementaryTypeName", + "src": "2228:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint240_$", + "typeString": "type(uint240)" + } + ], + "id": 6268, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "2223:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6271, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2223:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint240", + "typeString": "type(uint240)" + } + }, + "id": 6272, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "2237:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "2223:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint240", + "typeString": "uint240" + } + }, + "src": "2215:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6280, + "nodeType": "IfStatement", + "src": "2211:105:20", + "trueBody": { + "id": 6279, + "nodeType": "Block", + "src": "2242:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323430", + "id": 6275, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2294:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_240_by_1", + "typeString": "int_const 240" + }, + "value": "240" + }, + { + "id": 6276, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6262, + "src": "2299:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_240_by_1", + "typeString": "int_const 240" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6274, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "2263:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6277, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2263:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6278, + "nodeType": "RevertStatement", + "src": "2256:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6283, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6262, + "src": "2340:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6282, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2332:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint240_$", + "typeString": "type(uint240)" + }, + "typeName": { + "id": 6281, + "name": "uint240", + "nodeType": "ElementaryTypeName", + "src": "2332:7:20", + "typeDescriptions": {} + } + }, + "id": 6284, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2332:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint240", + "typeString": "uint240" + } + }, + "functionReturnParameters": 6266, + "id": 6285, + "nodeType": "Return", + "src": "2325:21:20" + } + ] + }, + "documentation": { + "id": 6260, + "nodeType": "StructuredDocumentation", + "src": "1850:280:20", + "text": " @dev Returns the downcasted uint240 from uint256, reverting on\n overflow (when the input is greater than largest uint240).\n Counterpart to Solidity's `uint240` operator.\n Requirements:\n - input must fit into 240 bits" + }, + "id": 6287, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint240", + "nameLocation": "2144:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6263, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6262, + "mutability": "mutable", + "name": "value", + "nameLocation": "2162:5:20", + "nodeType": "VariableDeclaration", + "scope": 6287, + "src": "2154:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6261, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2154:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2153:15:20" + }, + "returnParameters": { + "id": 6266, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6265, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6287, + "src": "2192:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint240", + "typeString": "uint240" + }, + "typeName": { + "id": 6264, + "name": "uint240", + "nodeType": "ElementaryTypeName", + "src": "2192:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint240", + "typeString": "uint240" + } + }, + "visibility": "internal" + } + ], + "src": "2191:9:20" + }, + "scope": 7969, + "src": "2135:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6314, + "nodeType": "Block", + "src": "2710:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6301, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6295, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6290, + "src": "2724:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6298, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2737:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint232_$", + "typeString": "type(uint232)" + }, + "typeName": { + "id": 6297, + "name": "uint232", + "nodeType": "ElementaryTypeName", + "src": "2737:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint232_$", + "typeString": "type(uint232)" + } + ], + "id": 6296, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "2732:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6299, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2732:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint232", + "typeString": "type(uint232)" + } + }, + "id": 6300, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "2746:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "2732:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint232", + "typeString": "uint232" + } + }, + "src": "2724:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6308, + "nodeType": "IfStatement", + "src": "2720:105:20", + "trueBody": { + "id": 6307, + "nodeType": "Block", + "src": "2751:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323332", + "id": 6303, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2803:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_232_by_1", + "typeString": "int_const 232" + }, + "value": "232" + }, + { + "id": 6304, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6290, + "src": "2808:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_232_by_1", + "typeString": "int_const 232" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6302, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "2772:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6305, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2772:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6306, + "nodeType": "RevertStatement", + "src": "2765:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6311, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6290, + "src": "2849:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6310, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2841:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint232_$", + "typeString": "type(uint232)" + }, + "typeName": { + "id": 6309, + "name": "uint232", + "nodeType": "ElementaryTypeName", + "src": "2841:7:20", + "typeDescriptions": {} + } + }, + "id": 6312, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2841:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint232", + "typeString": "uint232" + } + }, + "functionReturnParameters": 6294, + "id": 6313, + "nodeType": "Return", + "src": "2834:21:20" + } + ] + }, + "documentation": { + "id": 6288, + "nodeType": "StructuredDocumentation", + "src": "2359:280:20", + "text": " @dev Returns the downcasted uint232 from uint256, reverting on\n overflow (when the input is greater than largest uint232).\n Counterpart to Solidity's `uint232` operator.\n Requirements:\n - input must fit into 232 bits" + }, + "id": 6315, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint232", + "nameLocation": "2653:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6291, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6290, + "mutability": "mutable", + "name": "value", + "nameLocation": "2671:5:20", + "nodeType": "VariableDeclaration", + "scope": 6315, + "src": "2663:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6289, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2663:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2662:15:20" + }, + "returnParameters": { + "id": 6294, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6293, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6315, + "src": "2701:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint232", + "typeString": "uint232" + }, + "typeName": { + "id": 6292, + "name": "uint232", + "nodeType": "ElementaryTypeName", + "src": "2701:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint232", + "typeString": "uint232" + } + }, + "visibility": "internal" + } + ], + "src": "2700:9:20" + }, + "scope": 7969, + "src": "2644:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6342, + "nodeType": "Block", + "src": "3219:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6329, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6323, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6318, + "src": "3233:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6326, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3246:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint224_$", + "typeString": "type(uint224)" + }, + "typeName": { + "id": 6325, + "name": "uint224", + "nodeType": "ElementaryTypeName", + "src": "3246:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint224_$", + "typeString": "type(uint224)" + } + ], + "id": 6324, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "3241:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6327, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3241:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint224", + "typeString": "type(uint224)" + } + }, + "id": 6328, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "3255:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "3241:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint224", + "typeString": "uint224" + } + }, + "src": "3233:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6336, + "nodeType": "IfStatement", + "src": "3229:105:20", + "trueBody": { + "id": 6335, + "nodeType": "Block", + "src": "3260:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323234", + "id": 6331, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3312:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_224_by_1", + "typeString": "int_const 224" + }, + "value": "224" + }, + { + "id": 6332, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6318, + "src": "3317:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_224_by_1", + "typeString": "int_const 224" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6330, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "3281:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6333, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3281:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6334, + "nodeType": "RevertStatement", + "src": "3274:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6339, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6318, + "src": "3358:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6338, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3350:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint224_$", + "typeString": "type(uint224)" + }, + "typeName": { + "id": 6337, + "name": "uint224", + "nodeType": "ElementaryTypeName", + "src": "3350:7:20", + "typeDescriptions": {} + } + }, + "id": 6340, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3350:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint224", + "typeString": "uint224" + } + }, + "functionReturnParameters": 6322, + "id": 6341, + "nodeType": "Return", + "src": "3343:21:20" + } + ] + }, + "documentation": { + "id": 6316, + "nodeType": "StructuredDocumentation", + "src": "2868:280:20", + "text": " @dev Returns the downcasted uint224 from uint256, reverting on\n overflow (when the input is greater than largest uint224).\n Counterpart to Solidity's `uint224` operator.\n Requirements:\n - input must fit into 224 bits" + }, + "id": 6343, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint224", + "nameLocation": "3162:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6319, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6318, + "mutability": "mutable", + "name": "value", + "nameLocation": "3180:5:20", + "nodeType": "VariableDeclaration", + "scope": 6343, + "src": "3172:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6317, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3172:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3171:15:20" + }, + "returnParameters": { + "id": 6322, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6321, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6343, + "src": "3210:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint224", + "typeString": "uint224" + }, + "typeName": { + "id": 6320, + "name": "uint224", + "nodeType": "ElementaryTypeName", + "src": "3210:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint224", + "typeString": "uint224" + } + }, + "visibility": "internal" + } + ], + "src": "3209:9:20" + }, + "scope": 7969, + "src": "3153:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6370, + "nodeType": "Block", + "src": "3728:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6357, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6351, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6346, + "src": "3742:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6354, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3755:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint216_$", + "typeString": "type(uint216)" + }, + "typeName": { + "id": 6353, + "name": "uint216", + "nodeType": "ElementaryTypeName", + "src": "3755:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint216_$", + "typeString": "type(uint216)" + } + ], + "id": 6352, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "3750:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6355, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3750:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint216", + "typeString": "type(uint216)" + } + }, + "id": 6356, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "3764:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "3750:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint216", + "typeString": "uint216" + } + }, + "src": "3742:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6364, + "nodeType": "IfStatement", + "src": "3738:105:20", + "trueBody": { + "id": 6363, + "nodeType": "Block", + "src": "3769:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323136", + "id": 6359, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3821:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_216_by_1", + "typeString": "int_const 216" + }, + "value": "216" + }, + { + "id": 6360, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6346, + "src": "3826:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_216_by_1", + "typeString": "int_const 216" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6358, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "3790:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6361, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3790:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6362, + "nodeType": "RevertStatement", + "src": "3783:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6367, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6346, + "src": "3867:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6366, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3859:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint216_$", + "typeString": "type(uint216)" + }, + "typeName": { + "id": 6365, + "name": "uint216", + "nodeType": "ElementaryTypeName", + "src": "3859:7:20", + "typeDescriptions": {} + } + }, + "id": 6368, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3859:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint216", + "typeString": "uint216" + } + }, + "functionReturnParameters": 6350, + "id": 6369, + "nodeType": "Return", + "src": "3852:21:20" + } + ] + }, + "documentation": { + "id": 6344, + "nodeType": "StructuredDocumentation", + "src": "3377:280:20", + "text": " @dev Returns the downcasted uint216 from uint256, reverting on\n overflow (when the input is greater than largest uint216).\n Counterpart to Solidity's `uint216` operator.\n Requirements:\n - input must fit into 216 bits" + }, + "id": 6371, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint216", + "nameLocation": "3671:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6347, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6346, + "mutability": "mutable", + "name": "value", + "nameLocation": "3689:5:20", + "nodeType": "VariableDeclaration", + "scope": 6371, + "src": "3681:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6345, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3681:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3680:15:20" + }, + "returnParameters": { + "id": 6350, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6349, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6371, + "src": "3719:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint216", + "typeString": "uint216" + }, + "typeName": { + "id": 6348, + "name": "uint216", + "nodeType": "ElementaryTypeName", + "src": "3719:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint216", + "typeString": "uint216" + } + }, + "visibility": "internal" + } + ], + "src": "3718:9:20" + }, + "scope": 7969, + "src": "3662:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6398, + "nodeType": "Block", + "src": "4237:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6385, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6379, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6374, + "src": "4251:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6382, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4264:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint208_$", + "typeString": "type(uint208)" + }, + "typeName": { + "id": 6381, + "name": "uint208", + "nodeType": "ElementaryTypeName", + "src": "4264:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint208_$", + "typeString": "type(uint208)" + } + ], + "id": 6380, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "4259:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6383, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4259:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint208", + "typeString": "type(uint208)" + } + }, + "id": 6384, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "4273:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "4259:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint208", + "typeString": "uint208" + } + }, + "src": "4251:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6392, + "nodeType": "IfStatement", + "src": "4247:105:20", + "trueBody": { + "id": 6391, + "nodeType": "Block", + "src": "4278:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323038", + "id": 6387, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4330:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_208_by_1", + "typeString": "int_const 208" + }, + "value": "208" + }, + { + "id": 6388, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6374, + "src": "4335:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_208_by_1", + "typeString": "int_const 208" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6386, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "4299:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6389, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4299:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6390, + "nodeType": "RevertStatement", + "src": "4292:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6395, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6374, + "src": "4376:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6394, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4368:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint208_$", + "typeString": "type(uint208)" + }, + "typeName": { + "id": 6393, + "name": "uint208", + "nodeType": "ElementaryTypeName", + "src": "4368:7:20", + "typeDescriptions": {} + } + }, + "id": 6396, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4368:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint208", + "typeString": "uint208" + } + }, + "functionReturnParameters": 6378, + "id": 6397, + "nodeType": "Return", + "src": "4361:21:20" + } + ] + }, + "documentation": { + "id": 6372, + "nodeType": "StructuredDocumentation", + "src": "3886:280:20", + "text": " @dev Returns the downcasted uint208 from uint256, reverting on\n overflow (when the input is greater than largest uint208).\n Counterpart to Solidity's `uint208` operator.\n Requirements:\n - input must fit into 208 bits" + }, + "id": 6399, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint208", + "nameLocation": "4180:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6375, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6374, + "mutability": "mutable", + "name": "value", + "nameLocation": "4198:5:20", + "nodeType": "VariableDeclaration", + "scope": 6399, + "src": "4190:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6373, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4190:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4189:15:20" + }, + "returnParameters": { + "id": 6378, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6377, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6399, + "src": "4228:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint208", + "typeString": "uint208" + }, + "typeName": { + "id": 6376, + "name": "uint208", + "nodeType": "ElementaryTypeName", + "src": "4228:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint208", + "typeString": "uint208" + } + }, + "visibility": "internal" + } + ], + "src": "4227:9:20" + }, + "scope": 7969, + "src": "4171:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6426, + "nodeType": "Block", + "src": "4746:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6413, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6407, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6402, + "src": "4760:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6410, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4773:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint200_$", + "typeString": "type(uint200)" + }, + "typeName": { + "id": 6409, + "name": "uint200", + "nodeType": "ElementaryTypeName", + "src": "4773:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint200_$", + "typeString": "type(uint200)" + } + ], + "id": 6408, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "4768:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6411, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4768:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint200", + "typeString": "type(uint200)" + } + }, + "id": 6412, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "4782:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "4768:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint200", + "typeString": "uint200" + } + }, + "src": "4760:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6420, + "nodeType": "IfStatement", + "src": "4756:105:20", + "trueBody": { + "id": 6419, + "nodeType": "Block", + "src": "4787:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323030", + "id": 6415, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4839:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_200_by_1", + "typeString": "int_const 200" + }, + "value": "200" + }, + { + "id": 6416, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6402, + "src": "4844:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_200_by_1", + "typeString": "int_const 200" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6414, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "4808:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6417, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4808:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6418, + "nodeType": "RevertStatement", + "src": "4801:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6423, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6402, + "src": "4885:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6422, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "4877:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint200_$", + "typeString": "type(uint200)" + }, + "typeName": { + "id": 6421, + "name": "uint200", + "nodeType": "ElementaryTypeName", + "src": "4877:7:20", + "typeDescriptions": {} + } + }, + "id": 6424, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4877:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint200", + "typeString": "uint200" + } + }, + "functionReturnParameters": 6406, + "id": 6425, + "nodeType": "Return", + "src": "4870:21:20" + } + ] + }, + "documentation": { + "id": 6400, + "nodeType": "StructuredDocumentation", + "src": "4395:280:20", + "text": " @dev Returns the downcasted uint200 from uint256, reverting on\n overflow (when the input is greater than largest uint200).\n Counterpart to Solidity's `uint200` operator.\n Requirements:\n - input must fit into 200 bits" + }, + "id": 6427, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint200", + "nameLocation": "4689:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6403, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6402, + "mutability": "mutable", + "name": "value", + "nameLocation": "4707:5:20", + "nodeType": "VariableDeclaration", + "scope": 6427, + "src": "4699:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6401, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4699:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4698:15:20" + }, + "returnParameters": { + "id": 6406, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6405, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6427, + "src": "4737:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint200", + "typeString": "uint200" + }, + "typeName": { + "id": 6404, + "name": "uint200", + "nodeType": "ElementaryTypeName", + "src": "4737:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint200", + "typeString": "uint200" + } + }, + "visibility": "internal" + } + ], + "src": "4736:9:20" + }, + "scope": 7969, + "src": "4680:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6454, + "nodeType": "Block", + "src": "5255:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6441, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6435, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6430, + "src": "5269:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6438, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5282:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint192_$", + "typeString": "type(uint192)" + }, + "typeName": { + "id": 6437, + "name": "uint192", + "nodeType": "ElementaryTypeName", + "src": "5282:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint192_$", + "typeString": "type(uint192)" + } + ], + "id": 6436, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "5277:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6439, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5277:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint192", + "typeString": "type(uint192)" + } + }, + "id": 6440, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "5291:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "5277:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint192", + "typeString": "uint192" + } + }, + "src": "5269:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6448, + "nodeType": "IfStatement", + "src": "5265:105:20", + "trueBody": { + "id": 6447, + "nodeType": "Block", + "src": "5296:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313932", + "id": 6443, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5348:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_192_by_1", + "typeString": "int_const 192" + }, + "value": "192" + }, + { + "id": 6444, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6430, + "src": "5353:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_192_by_1", + "typeString": "int_const 192" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6442, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "5317:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6445, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5317:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6446, + "nodeType": "RevertStatement", + "src": "5310:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6451, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6430, + "src": "5394:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6450, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5386:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint192_$", + "typeString": "type(uint192)" + }, + "typeName": { + "id": 6449, + "name": "uint192", + "nodeType": "ElementaryTypeName", + "src": "5386:7:20", + "typeDescriptions": {} + } + }, + "id": 6452, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5386:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint192", + "typeString": "uint192" + } + }, + "functionReturnParameters": 6434, + "id": 6453, + "nodeType": "Return", + "src": "5379:21:20" + } + ] + }, + "documentation": { + "id": 6428, + "nodeType": "StructuredDocumentation", + "src": "4904:280:20", + "text": " @dev Returns the downcasted uint192 from uint256, reverting on\n overflow (when the input is greater than largest uint192).\n Counterpart to Solidity's `uint192` operator.\n Requirements:\n - input must fit into 192 bits" + }, + "id": 6455, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint192", + "nameLocation": "5198:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6431, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6430, + "mutability": "mutable", + "name": "value", + "nameLocation": "5216:5:20", + "nodeType": "VariableDeclaration", + "scope": 6455, + "src": "5208:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6429, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5208:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5207:15:20" + }, + "returnParameters": { + "id": 6434, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6433, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6455, + "src": "5246:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint192", + "typeString": "uint192" + }, + "typeName": { + "id": 6432, + "name": "uint192", + "nodeType": "ElementaryTypeName", + "src": "5246:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint192", + "typeString": "uint192" + } + }, + "visibility": "internal" + } + ], + "src": "5245:9:20" + }, + "scope": 7969, + "src": "5189:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6482, + "nodeType": "Block", + "src": "5764:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6469, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6463, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6458, + "src": "5778:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6466, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5791:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint184_$", + "typeString": "type(uint184)" + }, + "typeName": { + "id": 6465, + "name": "uint184", + "nodeType": "ElementaryTypeName", + "src": "5791:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint184_$", + "typeString": "type(uint184)" + } + ], + "id": 6464, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "5786:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6467, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5786:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint184", + "typeString": "type(uint184)" + } + }, + "id": 6468, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "5800:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "5786:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint184", + "typeString": "uint184" + } + }, + "src": "5778:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6476, + "nodeType": "IfStatement", + "src": "5774:105:20", + "trueBody": { + "id": 6475, + "nodeType": "Block", + "src": "5805:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313834", + "id": 6471, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5857:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_184_by_1", + "typeString": "int_const 184" + }, + "value": "184" + }, + { + "id": 6472, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6458, + "src": "5862:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_184_by_1", + "typeString": "int_const 184" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6470, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "5826:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6473, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5826:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6474, + "nodeType": "RevertStatement", + "src": "5819:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6479, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6458, + "src": "5903:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6478, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "5895:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint184_$", + "typeString": "type(uint184)" + }, + "typeName": { + "id": 6477, + "name": "uint184", + "nodeType": "ElementaryTypeName", + "src": "5895:7:20", + "typeDescriptions": {} + } + }, + "id": 6480, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5895:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint184", + "typeString": "uint184" + } + }, + "functionReturnParameters": 6462, + "id": 6481, + "nodeType": "Return", + "src": "5888:21:20" + } + ] + }, + "documentation": { + "id": 6456, + "nodeType": "StructuredDocumentation", + "src": "5413:280:20", + "text": " @dev Returns the downcasted uint184 from uint256, reverting on\n overflow (when the input is greater than largest uint184).\n Counterpart to Solidity's `uint184` operator.\n Requirements:\n - input must fit into 184 bits" + }, + "id": 6483, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint184", + "nameLocation": "5707:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6459, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6458, + "mutability": "mutable", + "name": "value", + "nameLocation": "5725:5:20", + "nodeType": "VariableDeclaration", + "scope": 6483, + "src": "5717:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6457, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5717:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5716:15:20" + }, + "returnParameters": { + "id": 6462, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6461, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6483, + "src": "5755:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint184", + "typeString": "uint184" + }, + "typeName": { + "id": 6460, + "name": "uint184", + "nodeType": "ElementaryTypeName", + "src": "5755:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint184", + "typeString": "uint184" + } + }, + "visibility": "internal" + } + ], + "src": "5754:9:20" + }, + "scope": 7969, + "src": "5698:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6510, + "nodeType": "Block", + "src": "6273:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6497, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6491, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6486, + "src": "6287:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6494, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6300:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint176_$", + "typeString": "type(uint176)" + }, + "typeName": { + "id": 6493, + "name": "uint176", + "nodeType": "ElementaryTypeName", + "src": "6300:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint176_$", + "typeString": "type(uint176)" + } + ], + "id": 6492, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "6295:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6495, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6295:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint176", + "typeString": "type(uint176)" + } + }, + "id": 6496, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "6309:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "6295:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint176", + "typeString": "uint176" + } + }, + "src": "6287:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6504, + "nodeType": "IfStatement", + "src": "6283:105:20", + "trueBody": { + "id": 6503, + "nodeType": "Block", + "src": "6314:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313736", + "id": 6499, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6366:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_176_by_1", + "typeString": "int_const 176" + }, + "value": "176" + }, + { + "id": 6500, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6486, + "src": "6371:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_176_by_1", + "typeString": "int_const 176" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6498, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "6335:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6501, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6335:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6502, + "nodeType": "RevertStatement", + "src": "6328:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6507, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6486, + "src": "6412:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6506, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6404:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint176_$", + "typeString": "type(uint176)" + }, + "typeName": { + "id": 6505, + "name": "uint176", + "nodeType": "ElementaryTypeName", + "src": "6404:7:20", + "typeDescriptions": {} + } + }, + "id": 6508, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6404:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint176", + "typeString": "uint176" + } + }, + "functionReturnParameters": 6490, + "id": 6509, + "nodeType": "Return", + "src": "6397:21:20" + } + ] + }, + "documentation": { + "id": 6484, + "nodeType": "StructuredDocumentation", + "src": "5922:280:20", + "text": " @dev Returns the downcasted uint176 from uint256, reverting on\n overflow (when the input is greater than largest uint176).\n Counterpart to Solidity's `uint176` operator.\n Requirements:\n - input must fit into 176 bits" + }, + "id": 6511, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint176", + "nameLocation": "6216:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6487, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6486, + "mutability": "mutable", + "name": "value", + "nameLocation": "6234:5:20", + "nodeType": "VariableDeclaration", + "scope": 6511, + "src": "6226:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6485, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6226:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "6225:15:20" + }, + "returnParameters": { + "id": 6490, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6489, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6511, + "src": "6264:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint176", + "typeString": "uint176" + }, + "typeName": { + "id": 6488, + "name": "uint176", + "nodeType": "ElementaryTypeName", + "src": "6264:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint176", + "typeString": "uint176" + } + }, + "visibility": "internal" + } + ], + "src": "6263:9:20" + }, + "scope": 7969, + "src": "6207:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6538, + "nodeType": "Block", + "src": "6782:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6525, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6519, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6514, + "src": "6796:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6522, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6809:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint168_$", + "typeString": "type(uint168)" + }, + "typeName": { + "id": 6521, + "name": "uint168", + "nodeType": "ElementaryTypeName", + "src": "6809:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint168_$", + "typeString": "type(uint168)" + } + ], + "id": 6520, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "6804:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6523, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6804:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint168", + "typeString": "type(uint168)" + } + }, + "id": 6524, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "6818:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "6804:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint168", + "typeString": "uint168" + } + }, + "src": "6796:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6532, + "nodeType": "IfStatement", + "src": "6792:105:20", + "trueBody": { + "id": 6531, + "nodeType": "Block", + "src": "6823:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313638", + "id": 6527, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6875:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_168_by_1", + "typeString": "int_const 168" + }, + "value": "168" + }, + { + "id": 6528, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6514, + "src": "6880:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_168_by_1", + "typeString": "int_const 168" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6526, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "6844:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6529, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6844:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6530, + "nodeType": "RevertStatement", + "src": "6837:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6535, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6514, + "src": "6921:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6534, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6913:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint168_$", + "typeString": "type(uint168)" + }, + "typeName": { + "id": 6533, + "name": "uint168", + "nodeType": "ElementaryTypeName", + "src": "6913:7:20", + "typeDescriptions": {} + } + }, + "id": 6536, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6913:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint168", + "typeString": "uint168" + } + }, + "functionReturnParameters": 6518, + "id": 6537, + "nodeType": "Return", + "src": "6906:21:20" + } + ] + }, + "documentation": { + "id": 6512, + "nodeType": "StructuredDocumentation", + "src": "6431:280:20", + "text": " @dev Returns the downcasted uint168 from uint256, reverting on\n overflow (when the input is greater than largest uint168).\n Counterpart to Solidity's `uint168` operator.\n Requirements:\n - input must fit into 168 bits" + }, + "id": 6539, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint168", + "nameLocation": "6725:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6515, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6514, + "mutability": "mutable", + "name": "value", + "nameLocation": "6743:5:20", + "nodeType": "VariableDeclaration", + "scope": 6539, + "src": "6735:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6513, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6735:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "6734:15:20" + }, + "returnParameters": { + "id": 6518, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6517, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6539, + "src": "6773:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint168", + "typeString": "uint168" + }, + "typeName": { + "id": 6516, + "name": "uint168", + "nodeType": "ElementaryTypeName", + "src": "6773:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint168", + "typeString": "uint168" + } + }, + "visibility": "internal" + } + ], + "src": "6772:9:20" + }, + "scope": 7969, + "src": "6716:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6566, + "nodeType": "Block", + "src": "7291:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6553, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6547, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6542, + "src": "7305:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6550, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "7318:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint160_$", + "typeString": "type(uint160)" + }, + "typeName": { + "id": 6549, + "name": "uint160", + "nodeType": "ElementaryTypeName", + "src": "7318:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint160_$", + "typeString": "type(uint160)" + } + ], + "id": 6548, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "7313:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6551, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7313:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint160", + "typeString": "type(uint160)" + } + }, + "id": 6552, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "7327:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "7313:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint160", + "typeString": "uint160" + } + }, + "src": "7305:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6560, + "nodeType": "IfStatement", + "src": "7301:105:20", + "trueBody": { + "id": 6559, + "nodeType": "Block", + "src": "7332:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313630", + "id": 6555, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7384:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_160_by_1", + "typeString": "int_const 160" + }, + "value": "160" + }, + { + "id": 6556, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6542, + "src": "7389:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_160_by_1", + "typeString": "int_const 160" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6554, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "7353:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6557, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7353:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6558, + "nodeType": "RevertStatement", + "src": "7346:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6563, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6542, + "src": "7430:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6562, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "7422:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint160_$", + "typeString": "type(uint160)" + }, + "typeName": { + "id": 6561, + "name": "uint160", + "nodeType": "ElementaryTypeName", + "src": "7422:7:20", + "typeDescriptions": {} + } + }, + "id": 6564, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7422:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint160", + "typeString": "uint160" + } + }, + "functionReturnParameters": 6546, + "id": 6565, + "nodeType": "Return", + "src": "7415:21:20" + } + ] + }, + "documentation": { + "id": 6540, + "nodeType": "StructuredDocumentation", + "src": "6940:280:20", + "text": " @dev Returns the downcasted uint160 from uint256, reverting on\n overflow (when the input is greater than largest uint160).\n Counterpart to Solidity's `uint160` operator.\n Requirements:\n - input must fit into 160 bits" + }, + "id": 6567, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint160", + "nameLocation": "7234:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6543, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6542, + "mutability": "mutable", + "name": "value", + "nameLocation": "7252:5:20", + "nodeType": "VariableDeclaration", + "scope": 6567, + "src": "7244:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6541, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7244:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7243:15:20" + }, + "returnParameters": { + "id": 6546, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6545, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6567, + "src": "7282:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint160", + "typeString": "uint160" + }, + "typeName": { + "id": 6544, + "name": "uint160", + "nodeType": "ElementaryTypeName", + "src": "7282:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint160", + "typeString": "uint160" + } + }, + "visibility": "internal" + } + ], + "src": "7281:9:20" + }, + "scope": 7969, + "src": "7225:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6594, + "nodeType": "Block", + "src": "7800:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6581, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6575, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6570, + "src": "7814:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6578, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "7827:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint152_$", + "typeString": "type(uint152)" + }, + "typeName": { + "id": 6577, + "name": "uint152", + "nodeType": "ElementaryTypeName", + "src": "7827:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint152_$", + "typeString": "type(uint152)" + } + ], + "id": 6576, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "7822:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6579, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7822:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint152", + "typeString": "type(uint152)" + } + }, + "id": 6580, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "7836:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "7822:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint152", + "typeString": "uint152" + } + }, + "src": "7814:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6588, + "nodeType": "IfStatement", + "src": "7810:105:20", + "trueBody": { + "id": 6587, + "nodeType": "Block", + "src": "7841:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313532", + "id": 6583, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7893:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_152_by_1", + "typeString": "int_const 152" + }, + "value": "152" + }, + { + "id": 6584, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6570, + "src": "7898:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_152_by_1", + "typeString": "int_const 152" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6582, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "7862:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6585, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7862:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6586, + "nodeType": "RevertStatement", + "src": "7855:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6591, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6570, + "src": "7939:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6590, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "7931:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint152_$", + "typeString": "type(uint152)" + }, + "typeName": { + "id": 6589, + "name": "uint152", + "nodeType": "ElementaryTypeName", + "src": "7931:7:20", + "typeDescriptions": {} + } + }, + "id": 6592, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7931:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint152", + "typeString": "uint152" + } + }, + "functionReturnParameters": 6574, + "id": 6593, + "nodeType": "Return", + "src": "7924:21:20" + } + ] + }, + "documentation": { + "id": 6568, + "nodeType": "StructuredDocumentation", + "src": "7449:280:20", + "text": " @dev Returns the downcasted uint152 from uint256, reverting on\n overflow (when the input is greater than largest uint152).\n Counterpart to Solidity's `uint152` operator.\n Requirements:\n - input must fit into 152 bits" + }, + "id": 6595, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint152", + "nameLocation": "7743:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6571, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6570, + "mutability": "mutable", + "name": "value", + "nameLocation": "7761:5:20", + "nodeType": "VariableDeclaration", + "scope": 6595, + "src": "7753:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6569, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7753:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7752:15:20" + }, + "returnParameters": { + "id": 6574, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6573, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6595, + "src": "7791:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint152", + "typeString": "uint152" + }, + "typeName": { + "id": 6572, + "name": "uint152", + "nodeType": "ElementaryTypeName", + "src": "7791:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint152", + "typeString": "uint152" + } + }, + "visibility": "internal" + } + ], + "src": "7790:9:20" + }, + "scope": 7969, + "src": "7734:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6622, + "nodeType": "Block", + "src": "8309:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6609, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6603, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6598, + "src": "8323:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6606, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8336:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint144_$", + "typeString": "type(uint144)" + }, + "typeName": { + "id": 6605, + "name": "uint144", + "nodeType": "ElementaryTypeName", + "src": "8336:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint144_$", + "typeString": "type(uint144)" + } + ], + "id": 6604, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "8331:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6607, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8331:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint144", + "typeString": "type(uint144)" + } + }, + "id": 6608, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "8345:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "8331:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint144", + "typeString": "uint144" + } + }, + "src": "8323:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6616, + "nodeType": "IfStatement", + "src": "8319:105:20", + "trueBody": { + "id": 6615, + "nodeType": "Block", + "src": "8350:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313434", + "id": 6611, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8402:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_144_by_1", + "typeString": "int_const 144" + }, + "value": "144" + }, + { + "id": 6612, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6598, + "src": "8407:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_144_by_1", + "typeString": "int_const 144" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6610, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "8371:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6613, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8371:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6614, + "nodeType": "RevertStatement", + "src": "8364:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6619, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6598, + "src": "8448:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6618, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8440:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint144_$", + "typeString": "type(uint144)" + }, + "typeName": { + "id": 6617, + "name": "uint144", + "nodeType": "ElementaryTypeName", + "src": "8440:7:20", + "typeDescriptions": {} + } + }, + "id": 6620, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8440:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint144", + "typeString": "uint144" + } + }, + "functionReturnParameters": 6602, + "id": 6621, + "nodeType": "Return", + "src": "8433:21:20" + } + ] + }, + "documentation": { + "id": 6596, + "nodeType": "StructuredDocumentation", + "src": "7958:280:20", + "text": " @dev Returns the downcasted uint144 from uint256, reverting on\n overflow (when the input is greater than largest uint144).\n Counterpart to Solidity's `uint144` operator.\n Requirements:\n - input must fit into 144 bits" + }, + "id": 6623, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint144", + "nameLocation": "8252:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6599, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6598, + "mutability": "mutable", + "name": "value", + "nameLocation": "8270:5:20", + "nodeType": "VariableDeclaration", + "scope": 6623, + "src": "8262:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6597, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8262:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "8261:15:20" + }, + "returnParameters": { + "id": 6602, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6601, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6623, + "src": "8300:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint144", + "typeString": "uint144" + }, + "typeName": { + "id": 6600, + "name": "uint144", + "nodeType": "ElementaryTypeName", + "src": "8300:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint144", + "typeString": "uint144" + } + }, + "visibility": "internal" + } + ], + "src": "8299:9:20" + }, + "scope": 7969, + "src": "8243:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6650, + "nodeType": "Block", + "src": "8818:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6637, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6631, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6626, + "src": "8832:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6634, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8845:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint136_$", + "typeString": "type(uint136)" + }, + "typeName": { + "id": 6633, + "name": "uint136", + "nodeType": "ElementaryTypeName", + "src": "8845:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint136_$", + "typeString": "type(uint136)" + } + ], + "id": 6632, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "8840:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6635, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8840:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint136", + "typeString": "type(uint136)" + } + }, + "id": 6636, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "8854:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "8840:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint136", + "typeString": "uint136" + } + }, + "src": "8832:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6644, + "nodeType": "IfStatement", + "src": "8828:105:20", + "trueBody": { + "id": 6643, + "nodeType": "Block", + "src": "8859:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313336", + "id": 6639, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8911:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_136_by_1", + "typeString": "int_const 136" + }, + "value": "136" + }, + { + "id": 6640, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6626, + "src": "8916:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_136_by_1", + "typeString": "int_const 136" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6638, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "8880:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6641, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8880:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6642, + "nodeType": "RevertStatement", + "src": "8873:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6647, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6626, + "src": "8957:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6646, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "8949:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint136_$", + "typeString": "type(uint136)" + }, + "typeName": { + "id": 6645, + "name": "uint136", + "nodeType": "ElementaryTypeName", + "src": "8949:7:20", + "typeDescriptions": {} + } + }, + "id": 6648, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "8949:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint136", + "typeString": "uint136" + } + }, + "functionReturnParameters": 6630, + "id": 6649, + "nodeType": "Return", + "src": "8942:21:20" + } + ] + }, + "documentation": { + "id": 6624, + "nodeType": "StructuredDocumentation", + "src": "8467:280:20", + "text": " @dev Returns the downcasted uint136 from uint256, reverting on\n overflow (when the input is greater than largest uint136).\n Counterpart to Solidity's `uint136` operator.\n Requirements:\n - input must fit into 136 bits" + }, + "id": 6651, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint136", + "nameLocation": "8761:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6627, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6626, + "mutability": "mutable", + "name": "value", + "nameLocation": "8779:5:20", + "nodeType": "VariableDeclaration", + "scope": 6651, + "src": "8771:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6625, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8771:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "8770:15:20" + }, + "returnParameters": { + "id": 6630, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6629, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6651, + "src": "8809:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint136", + "typeString": "uint136" + }, + "typeName": { + "id": 6628, + "name": "uint136", + "nodeType": "ElementaryTypeName", + "src": "8809:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint136", + "typeString": "uint136" + } + }, + "visibility": "internal" + } + ], + "src": "8808:9:20" + }, + "scope": 7969, + "src": "8752:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6678, + "nodeType": "Block", + "src": "9327:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6665, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6659, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6654, + "src": "9341:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6662, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "9354:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint128_$", + "typeString": "type(uint128)" + }, + "typeName": { + "id": 6661, + "name": "uint128", + "nodeType": "ElementaryTypeName", + "src": "9354:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint128_$", + "typeString": "type(uint128)" + } + ], + "id": 6660, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "9349:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6663, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9349:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint128", + "typeString": "type(uint128)" + } + }, + "id": 6664, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "9363:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "9349:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint128", + "typeString": "uint128" + } + }, + "src": "9341:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6672, + "nodeType": "IfStatement", + "src": "9337:105:20", + "trueBody": { + "id": 6671, + "nodeType": "Block", + "src": "9368:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313238", + "id": 6667, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9420:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_128_by_1", + "typeString": "int_const 128" + }, + "value": "128" + }, + { + "id": 6668, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6654, + "src": "9425:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_128_by_1", + "typeString": "int_const 128" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6666, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "9389:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6669, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9389:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6670, + "nodeType": "RevertStatement", + "src": "9382:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6675, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6654, + "src": "9466:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6674, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "9458:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint128_$", + "typeString": "type(uint128)" + }, + "typeName": { + "id": 6673, + "name": "uint128", + "nodeType": "ElementaryTypeName", + "src": "9458:7:20", + "typeDescriptions": {} + } + }, + "id": 6676, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9458:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint128", + "typeString": "uint128" + } + }, + "functionReturnParameters": 6658, + "id": 6677, + "nodeType": "Return", + "src": "9451:21:20" + } + ] + }, + "documentation": { + "id": 6652, + "nodeType": "StructuredDocumentation", + "src": "8976:280:20", + "text": " @dev Returns the downcasted uint128 from uint256, reverting on\n overflow (when the input is greater than largest uint128).\n Counterpart to Solidity's `uint128` operator.\n Requirements:\n - input must fit into 128 bits" + }, + "id": 6679, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint128", + "nameLocation": "9270:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6655, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6654, + "mutability": "mutable", + "name": "value", + "nameLocation": "9288:5:20", + "nodeType": "VariableDeclaration", + "scope": 6679, + "src": "9280:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6653, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "9280:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "9279:15:20" + }, + "returnParameters": { + "id": 6658, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6657, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6679, + "src": "9318:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint128", + "typeString": "uint128" + }, + "typeName": { + "id": 6656, + "name": "uint128", + "nodeType": "ElementaryTypeName", + "src": "9318:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint128", + "typeString": "uint128" + } + }, + "visibility": "internal" + } + ], + "src": "9317:9:20" + }, + "scope": 7969, + "src": "9261:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6706, + "nodeType": "Block", + "src": "9836:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6693, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6687, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6682, + "src": "9850:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6690, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "9863:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint120_$", + "typeString": "type(uint120)" + }, + "typeName": { + "id": 6689, + "name": "uint120", + "nodeType": "ElementaryTypeName", + "src": "9863:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint120_$", + "typeString": "type(uint120)" + } + ], + "id": 6688, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "9858:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6691, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9858:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint120", + "typeString": "type(uint120)" + } + }, + "id": 6692, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "9872:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "9858:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint120", + "typeString": "uint120" + } + }, + "src": "9850:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6700, + "nodeType": "IfStatement", + "src": "9846:105:20", + "trueBody": { + "id": 6699, + "nodeType": "Block", + "src": "9877:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313230", + "id": 6695, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9929:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_120_by_1", + "typeString": "int_const 120" + }, + "value": "120" + }, + { + "id": 6696, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6682, + "src": "9934:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_120_by_1", + "typeString": "int_const 120" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6694, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "9898:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6697, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9898:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6698, + "nodeType": "RevertStatement", + "src": "9891:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6703, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6682, + "src": "9975:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6702, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "9967:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint120_$", + "typeString": "type(uint120)" + }, + "typeName": { + "id": 6701, + "name": "uint120", + "nodeType": "ElementaryTypeName", + "src": "9967:7:20", + "typeDescriptions": {} + } + }, + "id": 6704, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "9967:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint120", + "typeString": "uint120" + } + }, + "functionReturnParameters": 6686, + "id": 6705, + "nodeType": "Return", + "src": "9960:21:20" + } + ] + }, + "documentation": { + "id": 6680, + "nodeType": "StructuredDocumentation", + "src": "9485:280:20", + "text": " @dev Returns the downcasted uint120 from uint256, reverting on\n overflow (when the input is greater than largest uint120).\n Counterpart to Solidity's `uint120` operator.\n Requirements:\n - input must fit into 120 bits" + }, + "id": 6707, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint120", + "nameLocation": "9779:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6683, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6682, + "mutability": "mutable", + "name": "value", + "nameLocation": "9797:5:20", + "nodeType": "VariableDeclaration", + "scope": 6707, + "src": "9789:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6681, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "9789:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "9788:15:20" + }, + "returnParameters": { + "id": 6686, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6685, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6707, + "src": "9827:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint120", + "typeString": "uint120" + }, + "typeName": { + "id": 6684, + "name": "uint120", + "nodeType": "ElementaryTypeName", + "src": "9827:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint120", + "typeString": "uint120" + } + }, + "visibility": "internal" + } + ], + "src": "9826:9:20" + }, + "scope": 7969, + "src": "9770:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6734, + "nodeType": "Block", + "src": "10345:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6721, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6715, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6710, + "src": "10359:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6718, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10372:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint112_$", + "typeString": "type(uint112)" + }, + "typeName": { + "id": 6717, + "name": "uint112", + "nodeType": "ElementaryTypeName", + "src": "10372:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint112_$", + "typeString": "type(uint112)" + } + ], + "id": 6716, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "10367:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6719, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10367:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint112", + "typeString": "type(uint112)" + } + }, + "id": 6720, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "10381:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "10367:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint112", + "typeString": "uint112" + } + }, + "src": "10359:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6728, + "nodeType": "IfStatement", + "src": "10355:105:20", + "trueBody": { + "id": 6727, + "nodeType": "Block", + "src": "10386:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313132", + "id": 6723, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10438:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_112_by_1", + "typeString": "int_const 112" + }, + "value": "112" + }, + { + "id": 6724, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6710, + "src": "10443:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_112_by_1", + "typeString": "int_const 112" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6722, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "10407:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6725, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10407:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6726, + "nodeType": "RevertStatement", + "src": "10400:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6731, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6710, + "src": "10484:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6730, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10476:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint112_$", + "typeString": "type(uint112)" + }, + "typeName": { + "id": 6729, + "name": "uint112", + "nodeType": "ElementaryTypeName", + "src": "10476:7:20", + "typeDescriptions": {} + } + }, + "id": 6732, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10476:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint112", + "typeString": "uint112" + } + }, + "functionReturnParameters": 6714, + "id": 6733, + "nodeType": "Return", + "src": "10469:21:20" + } + ] + }, + "documentation": { + "id": 6708, + "nodeType": "StructuredDocumentation", + "src": "9994:280:20", + "text": " @dev Returns the downcasted uint112 from uint256, reverting on\n overflow (when the input is greater than largest uint112).\n Counterpart to Solidity's `uint112` operator.\n Requirements:\n - input must fit into 112 bits" + }, + "id": 6735, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint112", + "nameLocation": "10288:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6711, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6710, + "mutability": "mutable", + "name": "value", + "nameLocation": "10306:5:20", + "nodeType": "VariableDeclaration", + "scope": 6735, + "src": "10298:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6709, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10298:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "10297:15:20" + }, + "returnParameters": { + "id": 6714, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6713, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6735, + "src": "10336:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint112", + "typeString": "uint112" + }, + "typeName": { + "id": 6712, + "name": "uint112", + "nodeType": "ElementaryTypeName", + "src": "10336:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint112", + "typeString": "uint112" + } + }, + "visibility": "internal" + } + ], + "src": "10335:9:20" + }, + "scope": 7969, + "src": "10279:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6762, + "nodeType": "Block", + "src": "10854:152:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6749, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6743, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6738, + "src": "10868:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6746, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10881:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint104_$", + "typeString": "type(uint104)" + }, + "typeName": { + "id": 6745, + "name": "uint104", + "nodeType": "ElementaryTypeName", + "src": "10881:7:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint104_$", + "typeString": "type(uint104)" + } + ], + "id": 6744, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "10876:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6747, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10876:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint104", + "typeString": "type(uint104)" + } + }, + "id": 6748, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "10890:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "10876:17:20", + "typeDescriptions": { + "typeIdentifier": "t_uint104", + "typeString": "uint104" + } + }, + "src": "10868:25:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6756, + "nodeType": "IfStatement", + "src": "10864:105:20", + "trueBody": { + "id": 6755, + "nodeType": "Block", + "src": "10895:74:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313034", + "id": 6751, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10947:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_104_by_1", + "typeString": "int_const 104" + }, + "value": "104" + }, + { + "id": 6752, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6738, + "src": "10952:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_104_by_1", + "typeString": "int_const 104" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6750, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "10916:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6753, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10916:42:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6754, + "nodeType": "RevertStatement", + "src": "10909:49:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6759, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6738, + "src": "10993:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6758, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "10985:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint104_$", + "typeString": "type(uint104)" + }, + "typeName": { + "id": 6757, + "name": "uint104", + "nodeType": "ElementaryTypeName", + "src": "10985:7:20", + "typeDescriptions": {} + } + }, + "id": 6760, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "10985:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint104", + "typeString": "uint104" + } + }, + "functionReturnParameters": 6742, + "id": 6761, + "nodeType": "Return", + "src": "10978:21:20" + } + ] + }, + "documentation": { + "id": 6736, + "nodeType": "StructuredDocumentation", + "src": "10503:280:20", + "text": " @dev Returns the downcasted uint104 from uint256, reverting on\n overflow (when the input is greater than largest uint104).\n Counterpart to Solidity's `uint104` operator.\n Requirements:\n - input must fit into 104 bits" + }, + "id": 6763, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint104", + "nameLocation": "10797:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6739, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6738, + "mutability": "mutable", + "name": "value", + "nameLocation": "10815:5:20", + "nodeType": "VariableDeclaration", + "scope": 6763, + "src": "10807:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6737, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10807:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "10806:15:20" + }, + "returnParameters": { + "id": 6742, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6741, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6763, + "src": "10845:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint104", + "typeString": "uint104" + }, + "typeName": { + "id": 6740, + "name": "uint104", + "nodeType": "ElementaryTypeName", + "src": "10845:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint104", + "typeString": "uint104" + } + }, + "visibility": "internal" + } + ], + "src": "10844:9:20" + }, + "scope": 7969, + "src": "10788:218:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6790, + "nodeType": "Block", + "src": "11357:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6777, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6771, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6766, + "src": "11371:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6774, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "11384:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint96_$", + "typeString": "type(uint96)" + }, + "typeName": { + "id": 6773, + "name": "uint96", + "nodeType": "ElementaryTypeName", + "src": "11384:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint96_$", + "typeString": "type(uint96)" + } + ], + "id": 6772, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "11379:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6775, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11379:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint96", + "typeString": "type(uint96)" + } + }, + "id": 6776, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "11392:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "11379:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint96", + "typeString": "uint96" + } + }, + "src": "11371:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6784, + "nodeType": "IfStatement", + "src": "11367:103:20", + "trueBody": { + "id": 6783, + "nodeType": "Block", + "src": "11397:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3936", + "id": 6779, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11449:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_96_by_1", + "typeString": "int_const 96" + }, + "value": "96" + }, + { + "id": 6780, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6766, + "src": "11453:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_96_by_1", + "typeString": "int_const 96" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6778, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "11418:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6781, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11418:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6782, + "nodeType": "RevertStatement", + "src": "11411:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6787, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6766, + "src": "11493:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6786, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "11486:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint96_$", + "typeString": "type(uint96)" + }, + "typeName": { + "id": 6785, + "name": "uint96", + "nodeType": "ElementaryTypeName", + "src": "11486:6:20", + "typeDescriptions": {} + } + }, + "id": 6788, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11486:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint96", + "typeString": "uint96" + } + }, + "functionReturnParameters": 6770, + "id": 6789, + "nodeType": "Return", + "src": "11479:20:20" + } + ] + }, + "documentation": { + "id": 6764, + "nodeType": "StructuredDocumentation", + "src": "11012:276:20", + "text": " @dev Returns the downcasted uint96 from uint256, reverting on\n overflow (when the input is greater than largest uint96).\n Counterpart to Solidity's `uint96` operator.\n Requirements:\n - input must fit into 96 bits" + }, + "id": 6791, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint96", + "nameLocation": "11302:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6767, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6766, + "mutability": "mutable", + "name": "value", + "nameLocation": "11319:5:20", + "nodeType": "VariableDeclaration", + "scope": 6791, + "src": "11311:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6765, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11311:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "11310:15:20" + }, + "returnParameters": { + "id": 6770, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6769, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6791, + "src": "11349:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint96", + "typeString": "uint96" + }, + "typeName": { + "id": 6768, + "name": "uint96", + "nodeType": "ElementaryTypeName", + "src": "11349:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint96", + "typeString": "uint96" + } + }, + "visibility": "internal" + } + ], + "src": "11348:8:20" + }, + "scope": 7969, + "src": "11293:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6818, + "nodeType": "Block", + "src": "11857:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6805, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6799, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6794, + "src": "11871:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6802, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "11884:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint88_$", + "typeString": "type(uint88)" + }, + "typeName": { + "id": 6801, + "name": "uint88", + "nodeType": "ElementaryTypeName", + "src": "11884:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint88_$", + "typeString": "type(uint88)" + } + ], + "id": 6800, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "11879:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6803, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11879:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint88", + "typeString": "type(uint88)" + } + }, + "id": 6804, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "11892:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "11879:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint88", + "typeString": "uint88" + } + }, + "src": "11871:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6812, + "nodeType": "IfStatement", + "src": "11867:103:20", + "trueBody": { + "id": 6811, + "nodeType": "Block", + "src": "11897:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3838", + "id": 6807, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11949:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_88_by_1", + "typeString": "int_const 88" + }, + "value": "88" + }, + { + "id": 6808, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6794, + "src": "11953:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_88_by_1", + "typeString": "int_const 88" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6806, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "11918:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6809, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11918:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6810, + "nodeType": "RevertStatement", + "src": "11911:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6815, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6794, + "src": "11993:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6814, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "11986:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint88_$", + "typeString": "type(uint88)" + }, + "typeName": { + "id": 6813, + "name": "uint88", + "nodeType": "ElementaryTypeName", + "src": "11986:6:20", + "typeDescriptions": {} + } + }, + "id": 6816, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "11986:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint88", + "typeString": "uint88" + } + }, + "functionReturnParameters": 6798, + "id": 6817, + "nodeType": "Return", + "src": "11979:20:20" + } + ] + }, + "documentation": { + "id": 6792, + "nodeType": "StructuredDocumentation", + "src": "11512:276:20", + "text": " @dev Returns the downcasted uint88 from uint256, reverting on\n overflow (when the input is greater than largest uint88).\n Counterpart to Solidity's `uint88` operator.\n Requirements:\n - input must fit into 88 bits" + }, + "id": 6819, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint88", + "nameLocation": "11802:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6795, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6794, + "mutability": "mutable", + "name": "value", + "nameLocation": "11819:5:20", + "nodeType": "VariableDeclaration", + "scope": 6819, + "src": "11811:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6793, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "11811:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "11810:15:20" + }, + "returnParameters": { + "id": 6798, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6797, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6819, + "src": "11849:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint88", + "typeString": "uint88" + }, + "typeName": { + "id": 6796, + "name": "uint88", + "nodeType": "ElementaryTypeName", + "src": "11849:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint88", + "typeString": "uint88" + } + }, + "visibility": "internal" + } + ], + "src": "11848:8:20" + }, + "scope": 7969, + "src": "11793:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6846, + "nodeType": "Block", + "src": "12357:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6833, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6827, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6822, + "src": "12371:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6830, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "12384:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint80_$", + "typeString": "type(uint80)" + }, + "typeName": { + "id": 6829, + "name": "uint80", + "nodeType": "ElementaryTypeName", + "src": "12384:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint80_$", + "typeString": "type(uint80)" + } + ], + "id": 6828, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "12379:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6831, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12379:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint80", + "typeString": "type(uint80)" + } + }, + "id": 6832, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "12392:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "12379:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint80", + "typeString": "uint80" + } + }, + "src": "12371:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6840, + "nodeType": "IfStatement", + "src": "12367:103:20", + "trueBody": { + "id": 6839, + "nodeType": "Block", + "src": "12397:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3830", + "id": 6835, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12449:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_80_by_1", + "typeString": "int_const 80" + }, + "value": "80" + }, + { + "id": 6836, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6822, + "src": "12453:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_80_by_1", + "typeString": "int_const 80" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6834, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "12418:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6837, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12418:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6838, + "nodeType": "RevertStatement", + "src": "12411:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6843, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6822, + "src": "12493:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6842, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "12486:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint80_$", + "typeString": "type(uint80)" + }, + "typeName": { + "id": 6841, + "name": "uint80", + "nodeType": "ElementaryTypeName", + "src": "12486:6:20", + "typeDescriptions": {} + } + }, + "id": 6844, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12486:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint80", + "typeString": "uint80" + } + }, + "functionReturnParameters": 6826, + "id": 6845, + "nodeType": "Return", + "src": "12479:20:20" + } + ] + }, + "documentation": { + "id": 6820, + "nodeType": "StructuredDocumentation", + "src": "12012:276:20", + "text": " @dev Returns the downcasted uint80 from uint256, reverting on\n overflow (when the input is greater than largest uint80).\n Counterpart to Solidity's `uint80` operator.\n Requirements:\n - input must fit into 80 bits" + }, + "id": 6847, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint80", + "nameLocation": "12302:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6823, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6822, + "mutability": "mutable", + "name": "value", + "nameLocation": "12319:5:20", + "nodeType": "VariableDeclaration", + "scope": 6847, + "src": "12311:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6821, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12311:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "12310:15:20" + }, + "returnParameters": { + "id": 6826, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6825, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6847, + "src": "12349:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint80", + "typeString": "uint80" + }, + "typeName": { + "id": 6824, + "name": "uint80", + "nodeType": "ElementaryTypeName", + "src": "12349:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint80", + "typeString": "uint80" + } + }, + "visibility": "internal" + } + ], + "src": "12348:8:20" + }, + "scope": 7969, + "src": "12293:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6874, + "nodeType": "Block", + "src": "12857:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6861, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6855, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6850, + "src": "12871:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6858, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "12884:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint72_$", + "typeString": "type(uint72)" + }, + "typeName": { + "id": 6857, + "name": "uint72", + "nodeType": "ElementaryTypeName", + "src": "12884:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint72_$", + "typeString": "type(uint72)" + } + ], + "id": 6856, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "12879:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6859, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12879:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint72", + "typeString": "type(uint72)" + } + }, + "id": 6860, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "12892:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "12879:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint72", + "typeString": "uint72" + } + }, + "src": "12871:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6868, + "nodeType": "IfStatement", + "src": "12867:103:20", + "trueBody": { + "id": 6867, + "nodeType": "Block", + "src": "12897:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3732", + "id": 6863, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "12949:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_72_by_1", + "typeString": "int_const 72" + }, + "value": "72" + }, + { + "id": 6864, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6850, + "src": "12953:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_72_by_1", + "typeString": "int_const 72" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6862, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "12918:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6865, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12918:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6866, + "nodeType": "RevertStatement", + "src": "12911:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6871, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6850, + "src": "12993:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6870, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "12986:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint72_$", + "typeString": "type(uint72)" + }, + "typeName": { + "id": 6869, + "name": "uint72", + "nodeType": "ElementaryTypeName", + "src": "12986:6:20", + "typeDescriptions": {} + } + }, + "id": 6872, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "12986:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint72", + "typeString": "uint72" + } + }, + "functionReturnParameters": 6854, + "id": 6873, + "nodeType": "Return", + "src": "12979:20:20" + } + ] + }, + "documentation": { + "id": 6848, + "nodeType": "StructuredDocumentation", + "src": "12512:276:20", + "text": " @dev Returns the downcasted uint72 from uint256, reverting on\n overflow (when the input is greater than largest uint72).\n Counterpart to Solidity's `uint72` operator.\n Requirements:\n - input must fit into 72 bits" + }, + "id": 6875, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint72", + "nameLocation": "12802:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6851, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6850, + "mutability": "mutable", + "name": "value", + "nameLocation": "12819:5:20", + "nodeType": "VariableDeclaration", + "scope": 6875, + "src": "12811:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6849, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "12811:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "12810:15:20" + }, + "returnParameters": { + "id": 6854, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6853, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6875, + "src": "12849:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint72", + "typeString": "uint72" + }, + "typeName": { + "id": 6852, + "name": "uint72", + "nodeType": "ElementaryTypeName", + "src": "12849:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint72", + "typeString": "uint72" + } + }, + "visibility": "internal" + } + ], + "src": "12848:8:20" + }, + "scope": 7969, + "src": "12793:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6902, + "nodeType": "Block", + "src": "13357:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6889, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6883, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6878, + "src": "13371:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6886, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "13384:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint64_$", + "typeString": "type(uint64)" + }, + "typeName": { + "id": 6885, + "name": "uint64", + "nodeType": "ElementaryTypeName", + "src": "13384:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint64_$", + "typeString": "type(uint64)" + } + ], + "id": 6884, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "13379:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6887, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13379:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint64", + "typeString": "type(uint64)" + } + }, + "id": 6888, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "13392:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "13379:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint64", + "typeString": "uint64" + } + }, + "src": "13371:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6896, + "nodeType": "IfStatement", + "src": "13367:103:20", + "trueBody": { + "id": 6895, + "nodeType": "Block", + "src": "13397:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3634", + "id": 6891, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13449:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + { + "id": 6892, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6878, + "src": "13453:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6890, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "13418:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6893, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13418:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6894, + "nodeType": "RevertStatement", + "src": "13411:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6899, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6878, + "src": "13493:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6898, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "13486:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint64_$", + "typeString": "type(uint64)" + }, + "typeName": { + "id": 6897, + "name": "uint64", + "nodeType": "ElementaryTypeName", + "src": "13486:6:20", + "typeDescriptions": {} + } + }, + "id": 6900, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13486:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint64", + "typeString": "uint64" + } + }, + "functionReturnParameters": 6882, + "id": 6901, + "nodeType": "Return", + "src": "13479:20:20" + } + ] + }, + "documentation": { + "id": 6876, + "nodeType": "StructuredDocumentation", + "src": "13012:276:20", + "text": " @dev Returns the downcasted uint64 from uint256, reverting on\n overflow (when the input is greater than largest uint64).\n Counterpart to Solidity's `uint64` operator.\n Requirements:\n - input must fit into 64 bits" + }, + "id": 6903, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint64", + "nameLocation": "13302:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6879, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6878, + "mutability": "mutable", + "name": "value", + "nameLocation": "13319:5:20", + "nodeType": "VariableDeclaration", + "scope": 6903, + "src": "13311:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6877, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13311:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "13310:15:20" + }, + "returnParameters": { + "id": 6882, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6881, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6903, + "src": "13349:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint64", + "typeString": "uint64" + }, + "typeName": { + "id": 6880, + "name": "uint64", + "nodeType": "ElementaryTypeName", + "src": "13349:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint64", + "typeString": "uint64" + } + }, + "visibility": "internal" + } + ], + "src": "13348:8:20" + }, + "scope": 7969, + "src": "13293:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6930, + "nodeType": "Block", + "src": "13857:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6917, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6911, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6906, + "src": "13871:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6914, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "13884:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint56_$", + "typeString": "type(uint56)" + }, + "typeName": { + "id": 6913, + "name": "uint56", + "nodeType": "ElementaryTypeName", + "src": "13884:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint56_$", + "typeString": "type(uint56)" + } + ], + "id": 6912, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "13879:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6915, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13879:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint56", + "typeString": "type(uint56)" + } + }, + "id": 6916, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "13892:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "13879:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint56", + "typeString": "uint56" + } + }, + "src": "13871:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6924, + "nodeType": "IfStatement", + "src": "13867:103:20", + "trueBody": { + "id": 6923, + "nodeType": "Block", + "src": "13897:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3536", + "id": 6919, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "13949:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_56_by_1", + "typeString": "int_const 56" + }, + "value": "56" + }, + { + "id": 6920, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6906, + "src": "13953:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_56_by_1", + "typeString": "int_const 56" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6918, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "13918:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6921, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13918:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6922, + "nodeType": "RevertStatement", + "src": "13911:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6927, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6906, + "src": "13993:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6926, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "13986:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint56_$", + "typeString": "type(uint56)" + }, + "typeName": { + "id": 6925, + "name": "uint56", + "nodeType": "ElementaryTypeName", + "src": "13986:6:20", + "typeDescriptions": {} + } + }, + "id": 6928, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "13986:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint56", + "typeString": "uint56" + } + }, + "functionReturnParameters": 6910, + "id": 6929, + "nodeType": "Return", + "src": "13979:20:20" + } + ] + }, + "documentation": { + "id": 6904, + "nodeType": "StructuredDocumentation", + "src": "13512:276:20", + "text": " @dev Returns the downcasted uint56 from uint256, reverting on\n overflow (when the input is greater than largest uint56).\n Counterpart to Solidity's `uint56` operator.\n Requirements:\n - input must fit into 56 bits" + }, + "id": 6931, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint56", + "nameLocation": "13802:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6907, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6906, + "mutability": "mutable", + "name": "value", + "nameLocation": "13819:5:20", + "nodeType": "VariableDeclaration", + "scope": 6931, + "src": "13811:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6905, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "13811:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "13810:15:20" + }, + "returnParameters": { + "id": 6910, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6909, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6931, + "src": "13849:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint56", + "typeString": "uint56" + }, + "typeName": { + "id": 6908, + "name": "uint56", + "nodeType": "ElementaryTypeName", + "src": "13849:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint56", + "typeString": "uint56" + } + }, + "visibility": "internal" + } + ], + "src": "13848:8:20" + }, + "scope": 7969, + "src": "13793:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6958, + "nodeType": "Block", + "src": "14357:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6945, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6939, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6934, + "src": "14371:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6942, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "14384:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint48_$", + "typeString": "type(uint48)" + }, + "typeName": { + "id": 6941, + "name": "uint48", + "nodeType": "ElementaryTypeName", + "src": "14384:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint48_$", + "typeString": "type(uint48)" + } + ], + "id": 6940, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "14379:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6943, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14379:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint48", + "typeString": "type(uint48)" + } + }, + "id": 6944, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "14392:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "14379:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint48", + "typeString": "uint48" + } + }, + "src": "14371:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6952, + "nodeType": "IfStatement", + "src": "14367:103:20", + "trueBody": { + "id": 6951, + "nodeType": "Block", + "src": "14397:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3438", + "id": 6947, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14449:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_48_by_1", + "typeString": "int_const 48" + }, + "value": "48" + }, + { + "id": 6948, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6934, + "src": "14453:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_48_by_1", + "typeString": "int_const 48" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6946, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "14418:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6949, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14418:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6950, + "nodeType": "RevertStatement", + "src": "14411:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6955, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6934, + "src": "14493:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6954, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "14486:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint48_$", + "typeString": "type(uint48)" + }, + "typeName": { + "id": 6953, + "name": "uint48", + "nodeType": "ElementaryTypeName", + "src": "14486:6:20", + "typeDescriptions": {} + } + }, + "id": 6956, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14486:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint48", + "typeString": "uint48" + } + }, + "functionReturnParameters": 6938, + "id": 6957, + "nodeType": "Return", + "src": "14479:20:20" + } + ] + }, + "documentation": { + "id": 6932, + "nodeType": "StructuredDocumentation", + "src": "14012:276:20", + "text": " @dev Returns the downcasted uint48 from uint256, reverting on\n overflow (when the input is greater than largest uint48).\n Counterpart to Solidity's `uint48` operator.\n Requirements:\n - input must fit into 48 bits" + }, + "id": 6959, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint48", + "nameLocation": "14302:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6935, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6934, + "mutability": "mutable", + "name": "value", + "nameLocation": "14319:5:20", + "nodeType": "VariableDeclaration", + "scope": 6959, + "src": "14311:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6933, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "14311:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "14310:15:20" + }, + "returnParameters": { + "id": 6938, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6937, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6959, + "src": "14349:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint48", + "typeString": "uint48" + }, + "typeName": { + "id": 6936, + "name": "uint48", + "nodeType": "ElementaryTypeName", + "src": "14349:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint48", + "typeString": "uint48" + } + }, + "visibility": "internal" + } + ], + "src": "14348:8:20" + }, + "scope": 7969, + "src": "14293:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 6986, + "nodeType": "Block", + "src": "14857:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 6973, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6967, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6962, + "src": "14871:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6970, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "14884:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint40_$", + "typeString": "type(uint40)" + }, + "typeName": { + "id": 6969, + "name": "uint40", + "nodeType": "ElementaryTypeName", + "src": "14884:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint40_$", + "typeString": "type(uint40)" + } + ], + "id": 6968, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "14879:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6971, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14879:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint40", + "typeString": "type(uint40)" + } + }, + "id": 6972, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "14892:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "14879:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint40", + "typeString": "uint40" + } + }, + "src": "14871:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 6980, + "nodeType": "IfStatement", + "src": "14867:103:20", + "trueBody": { + "id": 6979, + "nodeType": "Block", + "src": "14897:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3430", + "id": 6975, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "14949:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_40_by_1", + "typeString": "int_const 40" + }, + "value": "40" + }, + { + "id": 6976, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6962, + "src": "14953:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_40_by_1", + "typeString": "int_const 40" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6974, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "14918:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 6977, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14918:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 6978, + "nodeType": "RevertStatement", + "src": "14911:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 6983, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6962, + "src": "14993:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 6982, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "14986:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint40_$", + "typeString": "type(uint40)" + }, + "typeName": { + "id": 6981, + "name": "uint40", + "nodeType": "ElementaryTypeName", + "src": "14986:6:20", + "typeDescriptions": {} + } + }, + "id": 6984, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "14986:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint40", + "typeString": "uint40" + } + }, + "functionReturnParameters": 6966, + "id": 6985, + "nodeType": "Return", + "src": "14979:20:20" + } + ] + }, + "documentation": { + "id": 6960, + "nodeType": "StructuredDocumentation", + "src": "14512:276:20", + "text": " @dev Returns the downcasted uint40 from uint256, reverting on\n overflow (when the input is greater than largest uint40).\n Counterpart to Solidity's `uint40` operator.\n Requirements:\n - input must fit into 40 bits" + }, + "id": 6987, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint40", + "nameLocation": "14802:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6963, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6962, + "mutability": "mutable", + "name": "value", + "nameLocation": "14819:5:20", + "nodeType": "VariableDeclaration", + "scope": 6987, + "src": "14811:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6961, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "14811:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "14810:15:20" + }, + "returnParameters": { + "id": 6966, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6965, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 6987, + "src": "14849:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint40", + "typeString": "uint40" + }, + "typeName": { + "id": 6964, + "name": "uint40", + "nodeType": "ElementaryTypeName", + "src": "14849:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint40", + "typeString": "uint40" + } + }, + "visibility": "internal" + } + ], + "src": "14848:8:20" + }, + "scope": 7969, + "src": "14793:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7014, + "nodeType": "Block", + "src": "15357:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 7001, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 6995, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6990, + "src": "15371:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 6998, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "15384:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint32_$", + "typeString": "type(uint32)" + }, + "typeName": { + "id": 6997, + "name": "uint32", + "nodeType": "ElementaryTypeName", + "src": "15384:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint32_$", + "typeString": "type(uint32)" + } + ], + "id": 6996, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "15379:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 6999, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15379:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint32", + "typeString": "type(uint32)" + } + }, + "id": 7000, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "15392:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "15379:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint32", + "typeString": "uint32" + } + }, + "src": "15371:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7008, + "nodeType": "IfStatement", + "src": "15367:103:20", + "trueBody": { + "id": 7007, + "nodeType": "Block", + "src": "15397:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3332", + "id": 7003, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "15449:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + { + "id": 7004, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6990, + "src": "15453:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7002, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "15418:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 7005, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15418:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7006, + "nodeType": "RevertStatement", + "src": "15411:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 7011, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6990, + "src": "15493:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7010, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "15486:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint32_$", + "typeString": "type(uint32)" + }, + "typeName": { + "id": 7009, + "name": "uint32", + "nodeType": "ElementaryTypeName", + "src": "15486:6:20", + "typeDescriptions": {} + } + }, + "id": 7012, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15486:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint32", + "typeString": "uint32" + } + }, + "functionReturnParameters": 6994, + "id": 7013, + "nodeType": "Return", + "src": "15479:20:20" + } + ] + }, + "documentation": { + "id": 6988, + "nodeType": "StructuredDocumentation", + "src": "15012:276:20", + "text": " @dev Returns the downcasted uint32 from uint256, reverting on\n overflow (when the input is greater than largest uint32).\n Counterpart to Solidity's `uint32` operator.\n Requirements:\n - input must fit into 32 bits" + }, + "id": 7015, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint32", + "nameLocation": "15302:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 6991, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6990, + "mutability": "mutable", + "name": "value", + "nameLocation": "15319:5:20", + "nodeType": "VariableDeclaration", + "scope": 7015, + "src": "15311:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6989, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "15311:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "15310:15:20" + }, + "returnParameters": { + "id": 6994, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 6993, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 7015, + "src": "15349:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint32", + "typeString": "uint32" + }, + "typeName": { + "id": 6992, + "name": "uint32", + "nodeType": "ElementaryTypeName", + "src": "15349:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint32", + "typeString": "uint32" + } + }, + "visibility": "internal" + } + ], + "src": "15348:8:20" + }, + "scope": 7969, + "src": "15293:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7042, + "nodeType": "Block", + "src": "15857:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 7029, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7023, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7018, + "src": "15871:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 7026, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "15884:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint24_$", + "typeString": "type(uint24)" + }, + "typeName": { + "id": 7025, + "name": "uint24", + "nodeType": "ElementaryTypeName", + "src": "15884:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint24_$", + "typeString": "type(uint24)" + } + ], + "id": 7024, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "15879:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 7027, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15879:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint24", + "typeString": "type(uint24)" + } + }, + "id": 7028, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "15892:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "15879:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint24", + "typeString": "uint24" + } + }, + "src": "15871:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7036, + "nodeType": "IfStatement", + "src": "15867:103:20", + "trueBody": { + "id": 7035, + "nodeType": "Block", + "src": "15897:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3234", + "id": 7031, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "15949:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_24_by_1", + "typeString": "int_const 24" + }, + "value": "24" + }, + { + "id": 7032, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7018, + "src": "15953:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_24_by_1", + "typeString": "int_const 24" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7030, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "15918:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 7033, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15918:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7034, + "nodeType": "RevertStatement", + "src": "15911:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 7039, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7018, + "src": "15993:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7038, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "15986:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint24_$", + "typeString": "type(uint24)" + }, + "typeName": { + "id": 7037, + "name": "uint24", + "nodeType": "ElementaryTypeName", + "src": "15986:6:20", + "typeDescriptions": {} + } + }, + "id": 7040, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "15986:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint24", + "typeString": "uint24" + } + }, + "functionReturnParameters": 7022, + "id": 7041, + "nodeType": "Return", + "src": "15979:20:20" + } + ] + }, + "documentation": { + "id": 7016, + "nodeType": "StructuredDocumentation", + "src": "15512:276:20", + "text": " @dev Returns the downcasted uint24 from uint256, reverting on\n overflow (when the input is greater than largest uint24).\n Counterpart to Solidity's `uint24` operator.\n Requirements:\n - input must fit into 24 bits" + }, + "id": 7043, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint24", + "nameLocation": "15802:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7019, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7018, + "mutability": "mutable", + "name": "value", + "nameLocation": "15819:5:20", + "nodeType": "VariableDeclaration", + "scope": 7043, + "src": "15811:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 7017, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "15811:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "15810:15:20" + }, + "returnParameters": { + "id": 7022, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7021, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 7043, + "src": "15849:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint24", + "typeString": "uint24" + }, + "typeName": { + "id": 7020, + "name": "uint24", + "nodeType": "ElementaryTypeName", + "src": "15849:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint24", + "typeString": "uint24" + } + }, + "visibility": "internal" + } + ], + "src": "15848:8:20" + }, + "scope": 7969, + "src": "15793:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7070, + "nodeType": "Block", + "src": "16357:149:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 7057, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7051, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7046, + "src": "16371:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 7054, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16384:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint16_$", + "typeString": "type(uint16)" + }, + "typeName": { + "id": 7053, + "name": "uint16", + "nodeType": "ElementaryTypeName", + "src": "16384:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint16_$", + "typeString": "type(uint16)" + } + ], + "id": 7052, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "16379:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 7055, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16379:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint16", + "typeString": "type(uint16)" + } + }, + "id": 7056, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "16392:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "16379:16:20", + "typeDescriptions": { + "typeIdentifier": "t_uint16", + "typeString": "uint16" + } + }, + "src": "16371:24:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7064, + "nodeType": "IfStatement", + "src": "16367:103:20", + "trueBody": { + "id": 7063, + "nodeType": "Block", + "src": "16397:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3136", + "id": 7059, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16449:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + { + "id": 7060, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7046, + "src": "16453:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7058, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "16418:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 7061, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16418:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7062, + "nodeType": "RevertStatement", + "src": "16411:48:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 7067, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7046, + "src": "16493:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7066, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16486:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint16_$", + "typeString": "type(uint16)" + }, + "typeName": { + "id": 7065, + "name": "uint16", + "nodeType": "ElementaryTypeName", + "src": "16486:6:20", + "typeDescriptions": {} + } + }, + "id": 7068, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16486:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint16", + "typeString": "uint16" + } + }, + "functionReturnParameters": 7050, + "id": 7069, + "nodeType": "Return", + "src": "16479:20:20" + } + ] + }, + "documentation": { + "id": 7044, + "nodeType": "StructuredDocumentation", + "src": "16012:276:20", + "text": " @dev Returns the downcasted uint16 from uint256, reverting on\n overflow (when the input is greater than largest uint16).\n Counterpart to Solidity's `uint16` operator.\n Requirements:\n - input must fit into 16 bits" + }, + "id": 7071, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint16", + "nameLocation": "16302:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7047, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7046, + "mutability": "mutable", + "name": "value", + "nameLocation": "16319:5:20", + "nodeType": "VariableDeclaration", + "scope": 7071, + "src": "16311:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 7045, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "16311:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "16310:15:20" + }, + "returnParameters": { + "id": 7050, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7049, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 7071, + "src": "16349:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint16", + "typeString": "uint16" + }, + "typeName": { + "id": 7048, + "name": "uint16", + "nodeType": "ElementaryTypeName", + "src": "16349:6:20", + "typeDescriptions": { + "typeIdentifier": "t_uint16", + "typeString": "uint16" + } + }, + "visibility": "internal" + } + ], + "src": "16348:8:20" + }, + "scope": 7969, + "src": "16293:213:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7098, + "nodeType": "Block", + "src": "16851:146:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 7085, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7079, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7074, + "src": "16865:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 7082, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16878:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": { + "id": 7081, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "16878:5:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + } + ], + "id": 7080, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "16873:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 7083, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16873:11:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_uint8", + "typeString": "type(uint8)" + } + }, + "id": 7084, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "16885:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "16873:15:20", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "src": "16865:23:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7092, + "nodeType": "IfStatement", + "src": "16861:101:20", + "trueBody": { + "id": 7091, + "nodeType": "Block", + "src": "16890:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "38", + "id": 7087, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "16942:1:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + { + "id": 7088, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7074, + "src": "16945:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7086, + "name": "SafeCastOverflowedUintDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6214, + "src": "16911:30:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint8,uint256) pure returns (error)" + } + }, + "id": 7089, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16911:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7090, + "nodeType": "RevertStatement", + "src": "16904:47:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 7095, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7074, + "src": "16984:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7094, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "16978:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": { + "id": 7093, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "16978:5:20", + "typeDescriptions": {} + } + }, + "id": 7096, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "16978:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "functionReturnParameters": 7078, + "id": 7097, + "nodeType": "Return", + "src": "16971:19:20" + } + ] + }, + "documentation": { + "id": 7072, + "nodeType": "StructuredDocumentation", + "src": "16512:272:20", + "text": " @dev Returns the downcasted uint8 from uint256, reverting on\n overflow (when the input is greater than largest uint8).\n Counterpart to Solidity's `uint8` operator.\n Requirements:\n - input must fit into 8 bits" + }, + "id": 7099, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint8", + "nameLocation": "16798:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7075, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7074, + "mutability": "mutable", + "name": "value", + "nameLocation": "16814:5:20", + "nodeType": "VariableDeclaration", + "scope": 7099, + "src": "16806:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 7073, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "16806:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "16805:15:20" + }, + "returnParameters": { + "id": 7078, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7077, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 7099, + "src": "16844:5:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 7076, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "16844:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "src": "16843:7:20" + }, + "scope": 7969, + "src": "16789:208:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7121, + "nodeType": "Block", + "src": "17233:128:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7109, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7107, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7102, + "src": "17247:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "hexValue": "30", + "id": 7108, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17255:1:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "17247:9:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7115, + "nodeType": "IfStatement", + "src": "17243:81:20", + "trueBody": { + "id": 7114, + "nodeType": "Block", + "src": "17258:66:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "id": 7111, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7102, + "src": "17307:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7110, + "name": "SafeCastOverflowedIntToUint", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6219, + "src": "17279:27:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_int256_$returns$_t_error_$", + "typeString": "function (int256) pure returns (error)" + } + }, + "id": 7112, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "17279:34:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7113, + "nodeType": "RevertStatement", + "src": "17272:41:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 7118, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7102, + "src": "17348:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7117, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "17340:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 7116, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "17340:7:20", + "typeDescriptions": {} + } + }, + "id": 7119, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "17340:14:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 7106, + "id": 7120, + "nodeType": "Return", + "src": "17333:21:20" + } + ] + }, + "documentation": { + "id": 7100, + "nodeType": "StructuredDocumentation", + "src": "17003:160:20", + "text": " @dev Converts a signed int256 into an unsigned uint256.\n Requirements:\n - input must be greater than or equal to 0." + }, + "id": 7122, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint256", + "nameLocation": "17177:9:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7103, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7102, + "mutability": "mutable", + "name": "value", + "nameLocation": "17194:5:20", + "nodeType": "VariableDeclaration", + "scope": 7122, + "src": "17187:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7101, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "17187:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "17186:14:20" + }, + "returnParameters": { + "id": 7106, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7105, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 7122, + "src": "17224:7:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 7104, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "17224:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "17223:9:20" + }, + "scope": 7969, + "src": "17168:193:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7147, + "nodeType": "Block", + "src": "17758:150:20", + "statements": [ + { + "expression": { + "id": 7135, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7130, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7128, + "src": "17768:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int248", + "typeString": "int248" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7133, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7125, + "src": "17788:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7132, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "17781:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int248_$", + "typeString": "type(int248)" + }, + "typeName": { + "id": 7131, + "name": "int248", + "nodeType": "ElementaryTypeName", + "src": "17781:6:20", + "typeDescriptions": {} + } + }, + "id": 7134, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "17781:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int248", + "typeString": "int248" + } + }, + "src": "17768:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int248", + "typeString": "int248" + } + }, + "id": 7136, + "nodeType": "ExpressionStatement", + "src": "17768:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7139, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7137, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7128, + "src": "17808:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int248", + "typeString": "int248" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7138, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7125, + "src": "17822:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "17808:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7146, + "nodeType": "IfStatement", + "src": "17804:98:20", + "trueBody": { + "id": 7145, + "nodeType": "Block", + "src": "17829:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323438", + "id": 7141, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "17880:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_248_by_1", + "typeString": "int_const 248" + }, + "value": "248" + }, + { + "id": 7142, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7125, + "src": "17885:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_248_by_1", + "typeString": "int_const 248" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7140, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "17850:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7143, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "17850:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7144, + "nodeType": "RevertStatement", + "src": "17843:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7123, + "nodeType": "StructuredDocumentation", + "src": "17367:312:20", + "text": " @dev Returns the downcasted int248 from int256, reverting on\n overflow (when the input is less than smallest int248 or\n greater than largest int248).\n Counterpart to Solidity's `int248` operator.\n Requirements:\n - input must fit into 248 bits" + }, + "id": 7148, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt248", + "nameLocation": "17693:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7126, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7125, + "mutability": "mutable", + "name": "value", + "nameLocation": "17709:5:20", + "nodeType": "VariableDeclaration", + "scope": 7148, + "src": "17702:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7124, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "17702:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "17701:14:20" + }, + "returnParameters": { + "id": 7129, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7128, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "17746:10:20", + "nodeType": "VariableDeclaration", + "scope": 7148, + "src": "17739:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int248", + "typeString": "int248" + }, + "typeName": { + "id": 7127, + "name": "int248", + "nodeType": "ElementaryTypeName", + "src": "17739:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int248", + "typeString": "int248" + } + }, + "visibility": "internal" + } + ], + "src": "17738:19:20" + }, + "scope": 7969, + "src": "17684:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7173, + "nodeType": "Block", + "src": "18305:150:20", + "statements": [ + { + "expression": { + "id": 7161, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7156, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7154, + "src": "18315:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int240", + "typeString": "int240" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7159, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7151, + "src": "18335:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7158, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "18328:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int240_$", + "typeString": "type(int240)" + }, + "typeName": { + "id": 7157, + "name": "int240", + "nodeType": "ElementaryTypeName", + "src": "18328:6:20", + "typeDescriptions": {} + } + }, + "id": 7160, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18328:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int240", + "typeString": "int240" + } + }, + "src": "18315:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int240", + "typeString": "int240" + } + }, + "id": 7162, + "nodeType": "ExpressionStatement", + "src": "18315:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7165, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7163, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7154, + "src": "18355:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int240", + "typeString": "int240" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7164, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7151, + "src": "18369:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "18355:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7172, + "nodeType": "IfStatement", + "src": "18351:98:20", + "trueBody": { + "id": 7171, + "nodeType": "Block", + "src": "18376:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323430", + "id": 7167, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18427:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_240_by_1", + "typeString": "int_const 240" + }, + "value": "240" + }, + { + "id": 7168, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7151, + "src": "18432:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_240_by_1", + "typeString": "int_const 240" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7166, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "18397:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7169, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18397:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7170, + "nodeType": "RevertStatement", + "src": "18390:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7149, + "nodeType": "StructuredDocumentation", + "src": "17914:312:20", + "text": " @dev Returns the downcasted int240 from int256, reverting on\n overflow (when the input is less than smallest int240 or\n greater than largest int240).\n Counterpart to Solidity's `int240` operator.\n Requirements:\n - input must fit into 240 bits" + }, + "id": 7174, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt240", + "nameLocation": "18240:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7152, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7151, + "mutability": "mutable", + "name": "value", + "nameLocation": "18256:5:20", + "nodeType": "VariableDeclaration", + "scope": 7174, + "src": "18249:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7150, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "18249:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "18248:14:20" + }, + "returnParameters": { + "id": 7155, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7154, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "18293:10:20", + "nodeType": "VariableDeclaration", + "scope": 7174, + "src": "18286:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int240", + "typeString": "int240" + }, + "typeName": { + "id": 7153, + "name": "int240", + "nodeType": "ElementaryTypeName", + "src": "18286:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int240", + "typeString": "int240" + } + }, + "visibility": "internal" + } + ], + "src": "18285:19:20" + }, + "scope": 7969, + "src": "18231:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7199, + "nodeType": "Block", + "src": "18852:150:20", + "statements": [ + { + "expression": { + "id": 7187, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7182, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7180, + "src": "18862:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int232", + "typeString": "int232" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7185, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7177, + "src": "18882:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7184, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "18875:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int232_$", + "typeString": "type(int232)" + }, + "typeName": { + "id": 7183, + "name": "int232", + "nodeType": "ElementaryTypeName", + "src": "18875:6:20", + "typeDescriptions": {} + } + }, + "id": 7186, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18875:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int232", + "typeString": "int232" + } + }, + "src": "18862:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int232", + "typeString": "int232" + } + }, + "id": 7188, + "nodeType": "ExpressionStatement", + "src": "18862:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7191, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7189, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7180, + "src": "18902:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int232", + "typeString": "int232" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7190, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7177, + "src": "18916:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "18902:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7198, + "nodeType": "IfStatement", + "src": "18898:98:20", + "trueBody": { + "id": 7197, + "nodeType": "Block", + "src": "18923:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323332", + "id": 7193, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "18974:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_232_by_1", + "typeString": "int_const 232" + }, + "value": "232" + }, + { + "id": 7194, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7177, + "src": "18979:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_232_by_1", + "typeString": "int_const 232" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7192, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "18944:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7195, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "18944:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7196, + "nodeType": "RevertStatement", + "src": "18937:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7175, + "nodeType": "StructuredDocumentation", + "src": "18461:312:20", + "text": " @dev Returns the downcasted int232 from int256, reverting on\n overflow (when the input is less than smallest int232 or\n greater than largest int232).\n Counterpart to Solidity's `int232` operator.\n Requirements:\n - input must fit into 232 bits" + }, + "id": 7200, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt232", + "nameLocation": "18787:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7178, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7177, + "mutability": "mutable", + "name": "value", + "nameLocation": "18803:5:20", + "nodeType": "VariableDeclaration", + "scope": 7200, + "src": "18796:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7176, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "18796:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "18795:14:20" + }, + "returnParameters": { + "id": 7181, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7180, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "18840:10:20", + "nodeType": "VariableDeclaration", + "scope": 7200, + "src": "18833:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int232", + "typeString": "int232" + }, + "typeName": { + "id": 7179, + "name": "int232", + "nodeType": "ElementaryTypeName", + "src": "18833:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int232", + "typeString": "int232" + } + }, + "visibility": "internal" + } + ], + "src": "18832:19:20" + }, + "scope": 7969, + "src": "18778:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7225, + "nodeType": "Block", + "src": "19399:150:20", + "statements": [ + { + "expression": { + "id": 7213, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7208, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7206, + "src": "19409:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int224", + "typeString": "int224" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7211, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7203, + "src": "19429:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7210, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "19422:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int224_$", + "typeString": "type(int224)" + }, + "typeName": { + "id": 7209, + "name": "int224", + "nodeType": "ElementaryTypeName", + "src": "19422:6:20", + "typeDescriptions": {} + } + }, + "id": 7212, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19422:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int224", + "typeString": "int224" + } + }, + "src": "19409:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int224", + "typeString": "int224" + } + }, + "id": 7214, + "nodeType": "ExpressionStatement", + "src": "19409:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7217, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7215, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7206, + "src": "19449:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int224", + "typeString": "int224" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7216, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7203, + "src": "19463:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "19449:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7224, + "nodeType": "IfStatement", + "src": "19445:98:20", + "trueBody": { + "id": 7223, + "nodeType": "Block", + "src": "19470:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323234", + "id": 7219, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "19521:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_224_by_1", + "typeString": "int_const 224" + }, + "value": "224" + }, + { + "id": 7220, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7203, + "src": "19526:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_224_by_1", + "typeString": "int_const 224" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7218, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "19491:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7221, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19491:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7222, + "nodeType": "RevertStatement", + "src": "19484:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7201, + "nodeType": "StructuredDocumentation", + "src": "19008:312:20", + "text": " @dev Returns the downcasted int224 from int256, reverting on\n overflow (when the input is less than smallest int224 or\n greater than largest int224).\n Counterpart to Solidity's `int224` operator.\n Requirements:\n - input must fit into 224 bits" + }, + "id": 7226, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt224", + "nameLocation": "19334:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7204, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7203, + "mutability": "mutable", + "name": "value", + "nameLocation": "19350:5:20", + "nodeType": "VariableDeclaration", + "scope": 7226, + "src": "19343:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7202, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "19343:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "19342:14:20" + }, + "returnParameters": { + "id": 7207, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7206, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "19387:10:20", + "nodeType": "VariableDeclaration", + "scope": 7226, + "src": "19380:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int224", + "typeString": "int224" + }, + "typeName": { + "id": 7205, + "name": "int224", + "nodeType": "ElementaryTypeName", + "src": "19380:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int224", + "typeString": "int224" + } + }, + "visibility": "internal" + } + ], + "src": "19379:19:20" + }, + "scope": 7969, + "src": "19325:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7251, + "nodeType": "Block", + "src": "19946:150:20", + "statements": [ + { + "expression": { + "id": 7239, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7234, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7232, + "src": "19956:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int216", + "typeString": "int216" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7237, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7229, + "src": "19976:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7236, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "19969:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int216_$", + "typeString": "type(int216)" + }, + "typeName": { + "id": 7235, + "name": "int216", + "nodeType": "ElementaryTypeName", + "src": "19969:6:20", + "typeDescriptions": {} + } + }, + "id": 7238, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "19969:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int216", + "typeString": "int216" + } + }, + "src": "19956:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int216", + "typeString": "int216" + } + }, + "id": 7240, + "nodeType": "ExpressionStatement", + "src": "19956:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7243, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7241, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7232, + "src": "19996:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int216", + "typeString": "int216" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7242, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7229, + "src": "20010:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "19996:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7250, + "nodeType": "IfStatement", + "src": "19992:98:20", + "trueBody": { + "id": 7249, + "nodeType": "Block", + "src": "20017:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323136", + "id": 7245, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "20068:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_216_by_1", + "typeString": "int_const 216" + }, + "value": "216" + }, + { + "id": 7246, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7229, + "src": "20073:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_216_by_1", + "typeString": "int_const 216" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7244, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "20038:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7247, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "20038:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7248, + "nodeType": "RevertStatement", + "src": "20031:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7227, + "nodeType": "StructuredDocumentation", + "src": "19555:312:20", + "text": " @dev Returns the downcasted int216 from int256, reverting on\n overflow (when the input is less than smallest int216 or\n greater than largest int216).\n Counterpart to Solidity's `int216` operator.\n Requirements:\n - input must fit into 216 bits" + }, + "id": 7252, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt216", + "nameLocation": "19881:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7230, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7229, + "mutability": "mutable", + "name": "value", + "nameLocation": "19897:5:20", + "nodeType": "VariableDeclaration", + "scope": 7252, + "src": "19890:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7228, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "19890:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "19889:14:20" + }, + "returnParameters": { + "id": 7233, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7232, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "19934:10:20", + "nodeType": "VariableDeclaration", + "scope": 7252, + "src": "19927:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int216", + "typeString": "int216" + }, + "typeName": { + "id": 7231, + "name": "int216", + "nodeType": "ElementaryTypeName", + "src": "19927:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int216", + "typeString": "int216" + } + }, + "visibility": "internal" + } + ], + "src": "19926:19:20" + }, + "scope": 7969, + "src": "19872:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7277, + "nodeType": "Block", + "src": "20493:150:20", + "statements": [ + { + "expression": { + "id": 7265, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7260, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7258, + "src": "20503:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int208", + "typeString": "int208" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7263, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7255, + "src": "20523:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7262, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "20516:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int208_$", + "typeString": "type(int208)" + }, + "typeName": { + "id": 7261, + "name": "int208", + "nodeType": "ElementaryTypeName", + "src": "20516:6:20", + "typeDescriptions": {} + } + }, + "id": 7264, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "20516:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int208", + "typeString": "int208" + } + }, + "src": "20503:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int208", + "typeString": "int208" + } + }, + "id": 7266, + "nodeType": "ExpressionStatement", + "src": "20503:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7269, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7267, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7258, + "src": "20543:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int208", + "typeString": "int208" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7268, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7255, + "src": "20557:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "20543:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7276, + "nodeType": "IfStatement", + "src": "20539:98:20", + "trueBody": { + "id": 7275, + "nodeType": "Block", + "src": "20564:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323038", + "id": 7271, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "20615:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_208_by_1", + "typeString": "int_const 208" + }, + "value": "208" + }, + { + "id": 7272, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7255, + "src": "20620:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_208_by_1", + "typeString": "int_const 208" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7270, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "20585:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7273, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "20585:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7274, + "nodeType": "RevertStatement", + "src": "20578:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7253, + "nodeType": "StructuredDocumentation", + "src": "20102:312:20", + "text": " @dev Returns the downcasted int208 from int256, reverting on\n overflow (when the input is less than smallest int208 or\n greater than largest int208).\n Counterpart to Solidity's `int208` operator.\n Requirements:\n - input must fit into 208 bits" + }, + "id": 7278, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt208", + "nameLocation": "20428:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7256, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7255, + "mutability": "mutable", + "name": "value", + "nameLocation": "20444:5:20", + "nodeType": "VariableDeclaration", + "scope": 7278, + "src": "20437:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7254, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "20437:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "20436:14:20" + }, + "returnParameters": { + "id": 7259, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7258, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "20481:10:20", + "nodeType": "VariableDeclaration", + "scope": 7278, + "src": "20474:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int208", + "typeString": "int208" + }, + "typeName": { + "id": 7257, + "name": "int208", + "nodeType": "ElementaryTypeName", + "src": "20474:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int208", + "typeString": "int208" + } + }, + "visibility": "internal" + } + ], + "src": "20473:19:20" + }, + "scope": 7969, + "src": "20419:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7303, + "nodeType": "Block", + "src": "21040:150:20", + "statements": [ + { + "expression": { + "id": 7291, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7286, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7284, + "src": "21050:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int200", + "typeString": "int200" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7289, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7281, + "src": "21070:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7288, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "21063:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int200_$", + "typeString": "type(int200)" + }, + "typeName": { + "id": 7287, + "name": "int200", + "nodeType": "ElementaryTypeName", + "src": "21063:6:20", + "typeDescriptions": {} + } + }, + "id": 7290, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "21063:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int200", + "typeString": "int200" + } + }, + "src": "21050:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int200", + "typeString": "int200" + } + }, + "id": 7292, + "nodeType": "ExpressionStatement", + "src": "21050:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7295, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7293, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7284, + "src": "21090:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int200", + "typeString": "int200" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7294, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7281, + "src": "21104:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "21090:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7302, + "nodeType": "IfStatement", + "src": "21086:98:20", + "trueBody": { + "id": 7301, + "nodeType": "Block", + "src": "21111:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "323030", + "id": 7297, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "21162:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_200_by_1", + "typeString": "int_const 200" + }, + "value": "200" + }, + { + "id": 7298, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7281, + "src": "21167:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_200_by_1", + "typeString": "int_const 200" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7296, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "21132:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7299, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "21132:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7300, + "nodeType": "RevertStatement", + "src": "21125:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7279, + "nodeType": "StructuredDocumentation", + "src": "20649:312:20", + "text": " @dev Returns the downcasted int200 from int256, reverting on\n overflow (when the input is less than smallest int200 or\n greater than largest int200).\n Counterpart to Solidity's `int200` operator.\n Requirements:\n - input must fit into 200 bits" + }, + "id": 7304, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt200", + "nameLocation": "20975:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7282, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7281, + "mutability": "mutable", + "name": "value", + "nameLocation": "20991:5:20", + "nodeType": "VariableDeclaration", + "scope": 7304, + "src": "20984:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7280, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "20984:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "20983:14:20" + }, + "returnParameters": { + "id": 7285, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7284, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "21028:10:20", + "nodeType": "VariableDeclaration", + "scope": 7304, + "src": "21021:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int200", + "typeString": "int200" + }, + "typeName": { + "id": 7283, + "name": "int200", + "nodeType": "ElementaryTypeName", + "src": "21021:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int200", + "typeString": "int200" + } + }, + "visibility": "internal" + } + ], + "src": "21020:19:20" + }, + "scope": 7969, + "src": "20966:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7329, + "nodeType": "Block", + "src": "21587:150:20", + "statements": [ + { + "expression": { + "id": 7317, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7312, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7310, + "src": "21597:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int192", + "typeString": "int192" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7315, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7307, + "src": "21617:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7314, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "21610:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int192_$", + "typeString": "type(int192)" + }, + "typeName": { + "id": 7313, + "name": "int192", + "nodeType": "ElementaryTypeName", + "src": "21610:6:20", + "typeDescriptions": {} + } + }, + "id": 7316, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "21610:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int192", + "typeString": "int192" + } + }, + "src": "21597:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int192", + "typeString": "int192" + } + }, + "id": 7318, + "nodeType": "ExpressionStatement", + "src": "21597:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7321, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7319, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7310, + "src": "21637:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int192", + "typeString": "int192" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7320, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7307, + "src": "21651:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "21637:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7328, + "nodeType": "IfStatement", + "src": "21633:98:20", + "trueBody": { + "id": 7327, + "nodeType": "Block", + "src": "21658:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313932", + "id": 7323, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "21709:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_192_by_1", + "typeString": "int_const 192" + }, + "value": "192" + }, + { + "id": 7324, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7307, + "src": "21714:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_192_by_1", + "typeString": "int_const 192" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7322, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "21679:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7325, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "21679:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7326, + "nodeType": "RevertStatement", + "src": "21672:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7305, + "nodeType": "StructuredDocumentation", + "src": "21196:312:20", + "text": " @dev Returns the downcasted int192 from int256, reverting on\n overflow (when the input is less than smallest int192 or\n greater than largest int192).\n Counterpart to Solidity's `int192` operator.\n Requirements:\n - input must fit into 192 bits" + }, + "id": 7330, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt192", + "nameLocation": "21522:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7308, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7307, + "mutability": "mutable", + "name": "value", + "nameLocation": "21538:5:20", + "nodeType": "VariableDeclaration", + "scope": 7330, + "src": "21531:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7306, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "21531:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "21530:14:20" + }, + "returnParameters": { + "id": 7311, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7310, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "21575:10:20", + "nodeType": "VariableDeclaration", + "scope": 7330, + "src": "21568:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int192", + "typeString": "int192" + }, + "typeName": { + "id": 7309, + "name": "int192", + "nodeType": "ElementaryTypeName", + "src": "21568:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int192", + "typeString": "int192" + } + }, + "visibility": "internal" + } + ], + "src": "21567:19:20" + }, + "scope": 7969, + "src": "21513:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7355, + "nodeType": "Block", + "src": "22134:150:20", + "statements": [ + { + "expression": { + "id": 7343, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7338, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7336, + "src": "22144:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int184", + "typeString": "int184" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7341, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7333, + "src": "22164:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7340, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "22157:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int184_$", + "typeString": "type(int184)" + }, + "typeName": { + "id": 7339, + "name": "int184", + "nodeType": "ElementaryTypeName", + "src": "22157:6:20", + "typeDescriptions": {} + } + }, + "id": 7342, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "22157:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int184", + "typeString": "int184" + } + }, + "src": "22144:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int184", + "typeString": "int184" + } + }, + "id": 7344, + "nodeType": "ExpressionStatement", + "src": "22144:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7347, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7345, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7336, + "src": "22184:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int184", + "typeString": "int184" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7346, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7333, + "src": "22198:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "22184:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7354, + "nodeType": "IfStatement", + "src": "22180:98:20", + "trueBody": { + "id": 7353, + "nodeType": "Block", + "src": "22205:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313834", + "id": 7349, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22256:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_184_by_1", + "typeString": "int_const 184" + }, + "value": "184" + }, + { + "id": 7350, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7333, + "src": "22261:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_184_by_1", + "typeString": "int_const 184" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7348, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "22226:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7351, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "22226:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7352, + "nodeType": "RevertStatement", + "src": "22219:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7331, + "nodeType": "StructuredDocumentation", + "src": "21743:312:20", + "text": " @dev Returns the downcasted int184 from int256, reverting on\n overflow (when the input is less than smallest int184 or\n greater than largest int184).\n Counterpart to Solidity's `int184` operator.\n Requirements:\n - input must fit into 184 bits" + }, + "id": 7356, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt184", + "nameLocation": "22069:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7334, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7333, + "mutability": "mutable", + "name": "value", + "nameLocation": "22085:5:20", + "nodeType": "VariableDeclaration", + "scope": 7356, + "src": "22078:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7332, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "22078:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "22077:14:20" + }, + "returnParameters": { + "id": 7337, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7336, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "22122:10:20", + "nodeType": "VariableDeclaration", + "scope": 7356, + "src": "22115:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int184", + "typeString": "int184" + }, + "typeName": { + "id": 7335, + "name": "int184", + "nodeType": "ElementaryTypeName", + "src": "22115:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int184", + "typeString": "int184" + } + }, + "visibility": "internal" + } + ], + "src": "22114:19:20" + }, + "scope": 7969, + "src": "22060:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7381, + "nodeType": "Block", + "src": "22681:150:20", + "statements": [ + { + "expression": { + "id": 7369, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7364, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7362, + "src": "22691:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int176", + "typeString": "int176" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7367, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7359, + "src": "22711:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7366, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "22704:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int176_$", + "typeString": "type(int176)" + }, + "typeName": { + "id": 7365, + "name": "int176", + "nodeType": "ElementaryTypeName", + "src": "22704:6:20", + "typeDescriptions": {} + } + }, + "id": 7368, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "22704:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int176", + "typeString": "int176" + } + }, + "src": "22691:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int176", + "typeString": "int176" + } + }, + "id": 7370, + "nodeType": "ExpressionStatement", + "src": "22691:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7373, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7371, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7362, + "src": "22731:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int176", + "typeString": "int176" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7372, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7359, + "src": "22745:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "22731:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7380, + "nodeType": "IfStatement", + "src": "22727:98:20", + "trueBody": { + "id": 7379, + "nodeType": "Block", + "src": "22752:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313736", + "id": 7375, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "22803:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_176_by_1", + "typeString": "int_const 176" + }, + "value": "176" + }, + { + "id": 7376, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7359, + "src": "22808:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_176_by_1", + "typeString": "int_const 176" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7374, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "22773:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7377, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "22773:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7378, + "nodeType": "RevertStatement", + "src": "22766:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7357, + "nodeType": "StructuredDocumentation", + "src": "22290:312:20", + "text": " @dev Returns the downcasted int176 from int256, reverting on\n overflow (when the input is less than smallest int176 or\n greater than largest int176).\n Counterpart to Solidity's `int176` operator.\n Requirements:\n - input must fit into 176 bits" + }, + "id": 7382, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt176", + "nameLocation": "22616:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7360, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7359, + "mutability": "mutable", + "name": "value", + "nameLocation": "22632:5:20", + "nodeType": "VariableDeclaration", + "scope": 7382, + "src": "22625:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7358, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "22625:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "22624:14:20" + }, + "returnParameters": { + "id": 7363, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7362, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "22669:10:20", + "nodeType": "VariableDeclaration", + "scope": 7382, + "src": "22662:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int176", + "typeString": "int176" + }, + "typeName": { + "id": 7361, + "name": "int176", + "nodeType": "ElementaryTypeName", + "src": "22662:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int176", + "typeString": "int176" + } + }, + "visibility": "internal" + } + ], + "src": "22661:19:20" + }, + "scope": 7969, + "src": "22607:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7407, + "nodeType": "Block", + "src": "23228:150:20", + "statements": [ + { + "expression": { + "id": 7395, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7390, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7388, + "src": "23238:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int168", + "typeString": "int168" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7393, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7385, + "src": "23258:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7392, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "23251:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int168_$", + "typeString": "type(int168)" + }, + "typeName": { + "id": 7391, + "name": "int168", + "nodeType": "ElementaryTypeName", + "src": "23251:6:20", + "typeDescriptions": {} + } + }, + "id": 7394, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "23251:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int168", + "typeString": "int168" + } + }, + "src": "23238:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int168", + "typeString": "int168" + } + }, + "id": 7396, + "nodeType": "ExpressionStatement", + "src": "23238:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7399, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7397, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7388, + "src": "23278:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int168", + "typeString": "int168" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7398, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7385, + "src": "23292:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "23278:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7406, + "nodeType": "IfStatement", + "src": "23274:98:20", + "trueBody": { + "id": 7405, + "nodeType": "Block", + "src": "23299:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313638", + "id": 7401, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "23350:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_168_by_1", + "typeString": "int_const 168" + }, + "value": "168" + }, + { + "id": 7402, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7385, + "src": "23355:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_168_by_1", + "typeString": "int_const 168" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7400, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "23320:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7403, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "23320:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7404, + "nodeType": "RevertStatement", + "src": "23313:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7383, + "nodeType": "StructuredDocumentation", + "src": "22837:312:20", + "text": " @dev Returns the downcasted int168 from int256, reverting on\n overflow (when the input is less than smallest int168 or\n greater than largest int168).\n Counterpart to Solidity's `int168` operator.\n Requirements:\n - input must fit into 168 bits" + }, + "id": 7408, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt168", + "nameLocation": "23163:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7386, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7385, + "mutability": "mutable", + "name": "value", + "nameLocation": "23179:5:20", + "nodeType": "VariableDeclaration", + "scope": 7408, + "src": "23172:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7384, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "23172:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "23171:14:20" + }, + "returnParameters": { + "id": 7389, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7388, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "23216:10:20", + "nodeType": "VariableDeclaration", + "scope": 7408, + "src": "23209:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int168", + "typeString": "int168" + }, + "typeName": { + "id": 7387, + "name": "int168", + "nodeType": "ElementaryTypeName", + "src": "23209:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int168", + "typeString": "int168" + } + }, + "visibility": "internal" + } + ], + "src": "23208:19:20" + }, + "scope": 7969, + "src": "23154:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7433, + "nodeType": "Block", + "src": "23775:150:20", + "statements": [ + { + "expression": { + "id": 7421, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7416, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7414, + "src": "23785:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int160", + "typeString": "int160" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7419, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7411, + "src": "23805:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7418, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "23798:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int160_$", + "typeString": "type(int160)" + }, + "typeName": { + "id": 7417, + "name": "int160", + "nodeType": "ElementaryTypeName", + "src": "23798:6:20", + "typeDescriptions": {} + } + }, + "id": 7420, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "23798:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int160", + "typeString": "int160" + } + }, + "src": "23785:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int160", + "typeString": "int160" + } + }, + "id": 7422, + "nodeType": "ExpressionStatement", + "src": "23785:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7425, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7423, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7414, + "src": "23825:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int160", + "typeString": "int160" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7424, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7411, + "src": "23839:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "23825:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7432, + "nodeType": "IfStatement", + "src": "23821:98:20", + "trueBody": { + "id": 7431, + "nodeType": "Block", + "src": "23846:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313630", + "id": 7427, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "23897:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_160_by_1", + "typeString": "int_const 160" + }, + "value": "160" + }, + { + "id": 7428, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7411, + "src": "23902:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_160_by_1", + "typeString": "int_const 160" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7426, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "23867:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7429, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "23867:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7430, + "nodeType": "RevertStatement", + "src": "23860:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7409, + "nodeType": "StructuredDocumentation", + "src": "23384:312:20", + "text": " @dev Returns the downcasted int160 from int256, reverting on\n overflow (when the input is less than smallest int160 or\n greater than largest int160).\n Counterpart to Solidity's `int160` operator.\n Requirements:\n - input must fit into 160 bits" + }, + "id": 7434, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt160", + "nameLocation": "23710:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7412, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7411, + "mutability": "mutable", + "name": "value", + "nameLocation": "23726:5:20", + "nodeType": "VariableDeclaration", + "scope": 7434, + "src": "23719:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7410, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "23719:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "23718:14:20" + }, + "returnParameters": { + "id": 7415, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7414, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "23763:10:20", + "nodeType": "VariableDeclaration", + "scope": 7434, + "src": "23756:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int160", + "typeString": "int160" + }, + "typeName": { + "id": 7413, + "name": "int160", + "nodeType": "ElementaryTypeName", + "src": "23756:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int160", + "typeString": "int160" + } + }, + "visibility": "internal" + } + ], + "src": "23755:19:20" + }, + "scope": 7969, + "src": "23701:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7459, + "nodeType": "Block", + "src": "24322:150:20", + "statements": [ + { + "expression": { + "id": 7447, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7442, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7440, + "src": "24332:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int152", + "typeString": "int152" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7445, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7437, + "src": "24352:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7444, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "24345:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int152_$", + "typeString": "type(int152)" + }, + "typeName": { + "id": 7443, + "name": "int152", + "nodeType": "ElementaryTypeName", + "src": "24345:6:20", + "typeDescriptions": {} + } + }, + "id": 7446, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "24345:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int152", + "typeString": "int152" + } + }, + "src": "24332:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int152", + "typeString": "int152" + } + }, + "id": 7448, + "nodeType": "ExpressionStatement", + "src": "24332:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7451, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7449, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7440, + "src": "24372:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int152", + "typeString": "int152" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7450, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7437, + "src": "24386:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "24372:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7458, + "nodeType": "IfStatement", + "src": "24368:98:20", + "trueBody": { + "id": 7457, + "nodeType": "Block", + "src": "24393:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313532", + "id": 7453, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "24444:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_152_by_1", + "typeString": "int_const 152" + }, + "value": "152" + }, + { + "id": 7454, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7437, + "src": "24449:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_152_by_1", + "typeString": "int_const 152" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7452, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "24414:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7455, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "24414:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7456, + "nodeType": "RevertStatement", + "src": "24407:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7435, + "nodeType": "StructuredDocumentation", + "src": "23931:312:20", + "text": " @dev Returns the downcasted int152 from int256, reverting on\n overflow (when the input is less than smallest int152 or\n greater than largest int152).\n Counterpart to Solidity's `int152` operator.\n Requirements:\n - input must fit into 152 bits" + }, + "id": 7460, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt152", + "nameLocation": "24257:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7438, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7437, + "mutability": "mutable", + "name": "value", + "nameLocation": "24273:5:20", + "nodeType": "VariableDeclaration", + "scope": 7460, + "src": "24266:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7436, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "24266:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "24265:14:20" + }, + "returnParameters": { + "id": 7441, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7440, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "24310:10:20", + "nodeType": "VariableDeclaration", + "scope": 7460, + "src": "24303:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int152", + "typeString": "int152" + }, + "typeName": { + "id": 7439, + "name": "int152", + "nodeType": "ElementaryTypeName", + "src": "24303:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int152", + "typeString": "int152" + } + }, + "visibility": "internal" + } + ], + "src": "24302:19:20" + }, + "scope": 7969, + "src": "24248:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7485, + "nodeType": "Block", + "src": "24869:150:20", + "statements": [ + { + "expression": { + "id": 7473, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7468, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7466, + "src": "24879:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int144", + "typeString": "int144" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7471, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7463, + "src": "24899:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7470, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "24892:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int144_$", + "typeString": "type(int144)" + }, + "typeName": { + "id": 7469, + "name": "int144", + "nodeType": "ElementaryTypeName", + "src": "24892:6:20", + "typeDescriptions": {} + } + }, + "id": 7472, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "24892:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int144", + "typeString": "int144" + } + }, + "src": "24879:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int144", + "typeString": "int144" + } + }, + "id": 7474, + "nodeType": "ExpressionStatement", + "src": "24879:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7477, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7475, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7466, + "src": "24919:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int144", + "typeString": "int144" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7476, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7463, + "src": "24933:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "24919:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7484, + "nodeType": "IfStatement", + "src": "24915:98:20", + "trueBody": { + "id": 7483, + "nodeType": "Block", + "src": "24940:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313434", + "id": 7479, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "24991:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_144_by_1", + "typeString": "int_const 144" + }, + "value": "144" + }, + { + "id": 7480, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7463, + "src": "24996:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_144_by_1", + "typeString": "int_const 144" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7478, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "24961:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7481, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "24961:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7482, + "nodeType": "RevertStatement", + "src": "24954:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7461, + "nodeType": "StructuredDocumentation", + "src": "24478:312:20", + "text": " @dev Returns the downcasted int144 from int256, reverting on\n overflow (when the input is less than smallest int144 or\n greater than largest int144).\n Counterpart to Solidity's `int144` operator.\n Requirements:\n - input must fit into 144 bits" + }, + "id": 7486, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt144", + "nameLocation": "24804:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7464, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7463, + "mutability": "mutable", + "name": "value", + "nameLocation": "24820:5:20", + "nodeType": "VariableDeclaration", + "scope": 7486, + "src": "24813:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7462, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "24813:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "24812:14:20" + }, + "returnParameters": { + "id": 7467, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7466, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "24857:10:20", + "nodeType": "VariableDeclaration", + "scope": 7486, + "src": "24850:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int144", + "typeString": "int144" + }, + "typeName": { + "id": 7465, + "name": "int144", + "nodeType": "ElementaryTypeName", + "src": "24850:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int144", + "typeString": "int144" + } + }, + "visibility": "internal" + } + ], + "src": "24849:19:20" + }, + "scope": 7969, + "src": "24795:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7511, + "nodeType": "Block", + "src": "25416:150:20", + "statements": [ + { + "expression": { + "id": 7499, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7494, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7492, + "src": "25426:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int136", + "typeString": "int136" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7497, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7489, + "src": "25446:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7496, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "25439:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int136_$", + "typeString": "type(int136)" + }, + "typeName": { + "id": 7495, + "name": "int136", + "nodeType": "ElementaryTypeName", + "src": "25439:6:20", + "typeDescriptions": {} + } + }, + "id": 7498, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "25439:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int136", + "typeString": "int136" + } + }, + "src": "25426:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int136", + "typeString": "int136" + } + }, + "id": 7500, + "nodeType": "ExpressionStatement", + "src": "25426:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7503, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7501, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7492, + "src": "25466:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int136", + "typeString": "int136" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7502, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7489, + "src": "25480:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "25466:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7510, + "nodeType": "IfStatement", + "src": "25462:98:20", + "trueBody": { + "id": 7509, + "nodeType": "Block", + "src": "25487:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313336", + "id": 7505, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "25538:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_136_by_1", + "typeString": "int_const 136" + }, + "value": "136" + }, + { + "id": 7506, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7489, + "src": "25543:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_136_by_1", + "typeString": "int_const 136" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7504, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "25508:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7507, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "25508:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7508, + "nodeType": "RevertStatement", + "src": "25501:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7487, + "nodeType": "StructuredDocumentation", + "src": "25025:312:20", + "text": " @dev Returns the downcasted int136 from int256, reverting on\n overflow (when the input is less than smallest int136 or\n greater than largest int136).\n Counterpart to Solidity's `int136` operator.\n Requirements:\n - input must fit into 136 bits" + }, + "id": 7512, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt136", + "nameLocation": "25351:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7490, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7489, + "mutability": "mutable", + "name": "value", + "nameLocation": "25367:5:20", + "nodeType": "VariableDeclaration", + "scope": 7512, + "src": "25360:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7488, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "25360:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "25359:14:20" + }, + "returnParameters": { + "id": 7493, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7492, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "25404:10:20", + "nodeType": "VariableDeclaration", + "scope": 7512, + "src": "25397:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int136", + "typeString": "int136" + }, + "typeName": { + "id": 7491, + "name": "int136", + "nodeType": "ElementaryTypeName", + "src": "25397:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int136", + "typeString": "int136" + } + }, + "visibility": "internal" + } + ], + "src": "25396:19:20" + }, + "scope": 7969, + "src": "25342:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7537, + "nodeType": "Block", + "src": "25963:150:20", + "statements": [ + { + "expression": { + "id": 7525, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7520, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7518, + "src": "25973:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int128", + "typeString": "int128" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7523, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7515, + "src": "25993:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7522, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "25986:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int128_$", + "typeString": "type(int128)" + }, + "typeName": { + "id": 7521, + "name": "int128", + "nodeType": "ElementaryTypeName", + "src": "25986:6:20", + "typeDescriptions": {} + } + }, + "id": 7524, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "25986:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int128", + "typeString": "int128" + } + }, + "src": "25973:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int128", + "typeString": "int128" + } + }, + "id": 7526, + "nodeType": "ExpressionStatement", + "src": "25973:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7529, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7527, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7518, + "src": "26013:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int128", + "typeString": "int128" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7528, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7515, + "src": "26027:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "26013:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7536, + "nodeType": "IfStatement", + "src": "26009:98:20", + "trueBody": { + "id": 7535, + "nodeType": "Block", + "src": "26034:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313238", + "id": 7531, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "26085:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_128_by_1", + "typeString": "int_const 128" + }, + "value": "128" + }, + { + "id": 7532, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7515, + "src": "26090:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_128_by_1", + "typeString": "int_const 128" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7530, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "26055:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7533, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "26055:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7534, + "nodeType": "RevertStatement", + "src": "26048:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7513, + "nodeType": "StructuredDocumentation", + "src": "25572:312:20", + "text": " @dev Returns the downcasted int128 from int256, reverting on\n overflow (when the input is less than smallest int128 or\n greater than largest int128).\n Counterpart to Solidity's `int128` operator.\n Requirements:\n - input must fit into 128 bits" + }, + "id": 7538, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt128", + "nameLocation": "25898:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7516, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7515, + "mutability": "mutable", + "name": "value", + "nameLocation": "25914:5:20", + "nodeType": "VariableDeclaration", + "scope": 7538, + "src": "25907:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7514, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "25907:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "25906:14:20" + }, + "returnParameters": { + "id": 7519, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7518, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "25951:10:20", + "nodeType": "VariableDeclaration", + "scope": 7538, + "src": "25944:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int128", + "typeString": "int128" + }, + "typeName": { + "id": 7517, + "name": "int128", + "nodeType": "ElementaryTypeName", + "src": "25944:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int128", + "typeString": "int128" + } + }, + "visibility": "internal" + } + ], + "src": "25943:19:20" + }, + "scope": 7969, + "src": "25889:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7563, + "nodeType": "Block", + "src": "26510:150:20", + "statements": [ + { + "expression": { + "id": 7551, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7546, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7544, + "src": "26520:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int120", + "typeString": "int120" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7549, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7541, + "src": "26540:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7548, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "26533:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int120_$", + "typeString": "type(int120)" + }, + "typeName": { + "id": 7547, + "name": "int120", + "nodeType": "ElementaryTypeName", + "src": "26533:6:20", + "typeDescriptions": {} + } + }, + "id": 7550, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "26533:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int120", + "typeString": "int120" + } + }, + "src": "26520:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int120", + "typeString": "int120" + } + }, + "id": 7552, + "nodeType": "ExpressionStatement", + "src": "26520:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7555, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7553, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7544, + "src": "26560:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int120", + "typeString": "int120" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7554, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7541, + "src": "26574:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "26560:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7562, + "nodeType": "IfStatement", + "src": "26556:98:20", + "trueBody": { + "id": 7561, + "nodeType": "Block", + "src": "26581:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313230", + "id": 7557, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "26632:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_120_by_1", + "typeString": "int_const 120" + }, + "value": "120" + }, + { + "id": 7558, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7541, + "src": "26637:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_120_by_1", + "typeString": "int_const 120" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7556, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "26602:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7559, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "26602:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7560, + "nodeType": "RevertStatement", + "src": "26595:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7539, + "nodeType": "StructuredDocumentation", + "src": "26119:312:20", + "text": " @dev Returns the downcasted int120 from int256, reverting on\n overflow (when the input is less than smallest int120 or\n greater than largest int120).\n Counterpart to Solidity's `int120` operator.\n Requirements:\n - input must fit into 120 bits" + }, + "id": 7564, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt120", + "nameLocation": "26445:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7542, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7541, + "mutability": "mutable", + "name": "value", + "nameLocation": "26461:5:20", + "nodeType": "VariableDeclaration", + "scope": 7564, + "src": "26454:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7540, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "26454:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "26453:14:20" + }, + "returnParameters": { + "id": 7545, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7544, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "26498:10:20", + "nodeType": "VariableDeclaration", + "scope": 7564, + "src": "26491:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int120", + "typeString": "int120" + }, + "typeName": { + "id": 7543, + "name": "int120", + "nodeType": "ElementaryTypeName", + "src": "26491:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int120", + "typeString": "int120" + } + }, + "visibility": "internal" + } + ], + "src": "26490:19:20" + }, + "scope": 7969, + "src": "26436:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7589, + "nodeType": "Block", + "src": "27057:150:20", + "statements": [ + { + "expression": { + "id": 7577, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7572, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7570, + "src": "27067:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int112", + "typeString": "int112" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7575, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7567, + "src": "27087:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7574, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "27080:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int112_$", + "typeString": "type(int112)" + }, + "typeName": { + "id": 7573, + "name": "int112", + "nodeType": "ElementaryTypeName", + "src": "27080:6:20", + "typeDescriptions": {} + } + }, + "id": 7576, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "27080:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int112", + "typeString": "int112" + } + }, + "src": "27067:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int112", + "typeString": "int112" + } + }, + "id": 7578, + "nodeType": "ExpressionStatement", + "src": "27067:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7581, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7579, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7570, + "src": "27107:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int112", + "typeString": "int112" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7580, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7567, + "src": "27121:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "27107:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7588, + "nodeType": "IfStatement", + "src": "27103:98:20", + "trueBody": { + "id": 7587, + "nodeType": "Block", + "src": "27128:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313132", + "id": 7583, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "27179:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_112_by_1", + "typeString": "int_const 112" + }, + "value": "112" + }, + { + "id": 7584, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7567, + "src": "27184:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_112_by_1", + "typeString": "int_const 112" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7582, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "27149:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7585, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "27149:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7586, + "nodeType": "RevertStatement", + "src": "27142:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7565, + "nodeType": "StructuredDocumentation", + "src": "26666:312:20", + "text": " @dev Returns the downcasted int112 from int256, reverting on\n overflow (when the input is less than smallest int112 or\n greater than largest int112).\n Counterpart to Solidity's `int112` operator.\n Requirements:\n - input must fit into 112 bits" + }, + "id": 7590, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt112", + "nameLocation": "26992:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7568, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7567, + "mutability": "mutable", + "name": "value", + "nameLocation": "27008:5:20", + "nodeType": "VariableDeclaration", + "scope": 7590, + "src": "27001:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7566, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "27001:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "27000:14:20" + }, + "returnParameters": { + "id": 7571, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7570, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "27045:10:20", + "nodeType": "VariableDeclaration", + "scope": 7590, + "src": "27038:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int112", + "typeString": "int112" + }, + "typeName": { + "id": 7569, + "name": "int112", + "nodeType": "ElementaryTypeName", + "src": "27038:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int112", + "typeString": "int112" + } + }, + "visibility": "internal" + } + ], + "src": "27037:19:20" + }, + "scope": 7969, + "src": "26983:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7615, + "nodeType": "Block", + "src": "27604:150:20", + "statements": [ + { + "expression": { + "id": 7603, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7598, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7596, + "src": "27614:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int104", + "typeString": "int104" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7601, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7593, + "src": "27634:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7600, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "27627:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int104_$", + "typeString": "type(int104)" + }, + "typeName": { + "id": 7599, + "name": "int104", + "nodeType": "ElementaryTypeName", + "src": "27627:6:20", + "typeDescriptions": {} + } + }, + "id": 7602, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "27627:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int104", + "typeString": "int104" + } + }, + "src": "27614:26:20", + "typeDescriptions": { + "typeIdentifier": "t_int104", + "typeString": "int104" + } + }, + "id": 7604, + "nodeType": "ExpressionStatement", + "src": "27614:26:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7607, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7605, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7596, + "src": "27654:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int104", + "typeString": "int104" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7606, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7593, + "src": "27668:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "27654:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7614, + "nodeType": "IfStatement", + "src": "27650:98:20", + "trueBody": { + "id": 7613, + "nodeType": "Block", + "src": "27675:73:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "313034", + "id": 7609, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "27726:3:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_104_by_1", + "typeString": "int_const 104" + }, + "value": "104" + }, + { + "id": 7610, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7593, + "src": "27731:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_104_by_1", + "typeString": "int_const 104" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7608, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "27696:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7611, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "27696:41:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7612, + "nodeType": "RevertStatement", + "src": "27689:48:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7591, + "nodeType": "StructuredDocumentation", + "src": "27213:312:20", + "text": " @dev Returns the downcasted int104 from int256, reverting on\n overflow (when the input is less than smallest int104 or\n greater than largest int104).\n Counterpart to Solidity's `int104` operator.\n Requirements:\n - input must fit into 104 bits" + }, + "id": 7616, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt104", + "nameLocation": "27539:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7594, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7593, + "mutability": "mutable", + "name": "value", + "nameLocation": "27555:5:20", + "nodeType": "VariableDeclaration", + "scope": 7616, + "src": "27548:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7592, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "27548:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "27547:14:20" + }, + "returnParameters": { + "id": 7597, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7596, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "27592:10:20", + "nodeType": "VariableDeclaration", + "scope": 7616, + "src": "27585:17:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int104", + "typeString": "int104" + }, + "typeName": { + "id": 7595, + "name": "int104", + "nodeType": "ElementaryTypeName", + "src": "27585:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int104", + "typeString": "int104" + } + }, + "visibility": "internal" + } + ], + "src": "27584:19:20" + }, + "scope": 7969, + "src": "27530:224:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7641, + "nodeType": "Block", + "src": "28144:148:20", + "statements": [ + { + "expression": { + "id": 7629, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7624, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7622, + "src": "28154:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int96", + "typeString": "int96" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7627, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7619, + "src": "28173:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7626, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "28167:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int96_$", + "typeString": "type(int96)" + }, + "typeName": { + "id": 7625, + "name": "int96", + "nodeType": "ElementaryTypeName", + "src": "28167:5:20", + "typeDescriptions": {} + } + }, + "id": 7628, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "28167:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int96", + "typeString": "int96" + } + }, + "src": "28154:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int96", + "typeString": "int96" + } + }, + "id": 7630, + "nodeType": "ExpressionStatement", + "src": "28154:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7633, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7631, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7622, + "src": "28193:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int96", + "typeString": "int96" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7632, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7619, + "src": "28207:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "28193:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7640, + "nodeType": "IfStatement", + "src": "28189:97:20", + "trueBody": { + "id": 7639, + "nodeType": "Block", + "src": "28214:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3936", + "id": 7635, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "28265:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_96_by_1", + "typeString": "int_const 96" + }, + "value": "96" + }, + { + "id": 7636, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7619, + "src": "28269:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_96_by_1", + "typeString": "int_const 96" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7634, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "28235:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7637, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "28235:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7638, + "nodeType": "RevertStatement", + "src": "28228:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7617, + "nodeType": "StructuredDocumentation", + "src": "27760:307:20", + "text": " @dev Returns the downcasted int96 from int256, reverting on\n overflow (when the input is less than smallest int96 or\n greater than largest int96).\n Counterpart to Solidity's `int96` operator.\n Requirements:\n - input must fit into 96 bits" + }, + "id": 7642, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt96", + "nameLocation": "28081:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7620, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7619, + "mutability": "mutable", + "name": "value", + "nameLocation": "28096:5:20", + "nodeType": "VariableDeclaration", + "scope": 7642, + "src": "28089:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7618, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "28089:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "28088:14:20" + }, + "returnParameters": { + "id": 7623, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7622, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "28132:10:20", + "nodeType": "VariableDeclaration", + "scope": 7642, + "src": "28126:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int96", + "typeString": "int96" + }, + "typeName": { + "id": 7621, + "name": "int96", + "nodeType": "ElementaryTypeName", + "src": "28126:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int96", + "typeString": "int96" + } + }, + "visibility": "internal" + } + ], + "src": "28125:18:20" + }, + "scope": 7969, + "src": "28072:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7667, + "nodeType": "Block", + "src": "28682:148:20", + "statements": [ + { + "expression": { + "id": 7655, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7650, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7648, + "src": "28692:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int88", + "typeString": "int88" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7653, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7645, + "src": "28711:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7652, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "28705:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int88_$", + "typeString": "type(int88)" + }, + "typeName": { + "id": 7651, + "name": "int88", + "nodeType": "ElementaryTypeName", + "src": "28705:5:20", + "typeDescriptions": {} + } + }, + "id": 7654, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "28705:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int88", + "typeString": "int88" + } + }, + "src": "28692:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int88", + "typeString": "int88" + } + }, + "id": 7656, + "nodeType": "ExpressionStatement", + "src": "28692:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7659, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7657, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7648, + "src": "28731:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int88", + "typeString": "int88" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7658, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7645, + "src": "28745:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "28731:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7666, + "nodeType": "IfStatement", + "src": "28727:97:20", + "trueBody": { + "id": 7665, + "nodeType": "Block", + "src": "28752:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3838", + "id": 7661, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "28803:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_88_by_1", + "typeString": "int_const 88" + }, + "value": "88" + }, + { + "id": 7662, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7645, + "src": "28807:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_88_by_1", + "typeString": "int_const 88" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7660, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "28773:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7663, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "28773:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7664, + "nodeType": "RevertStatement", + "src": "28766:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7643, + "nodeType": "StructuredDocumentation", + "src": "28298:307:20", + "text": " @dev Returns the downcasted int88 from int256, reverting on\n overflow (when the input is less than smallest int88 or\n greater than largest int88).\n Counterpart to Solidity's `int88` operator.\n Requirements:\n - input must fit into 88 bits" + }, + "id": 7668, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt88", + "nameLocation": "28619:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7646, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7645, + "mutability": "mutable", + "name": "value", + "nameLocation": "28634:5:20", + "nodeType": "VariableDeclaration", + "scope": 7668, + "src": "28627:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7644, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "28627:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "28626:14:20" + }, + "returnParameters": { + "id": 7649, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7648, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "28670:10:20", + "nodeType": "VariableDeclaration", + "scope": 7668, + "src": "28664:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int88", + "typeString": "int88" + }, + "typeName": { + "id": 7647, + "name": "int88", + "nodeType": "ElementaryTypeName", + "src": "28664:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int88", + "typeString": "int88" + } + }, + "visibility": "internal" + } + ], + "src": "28663:18:20" + }, + "scope": 7969, + "src": "28610:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7693, + "nodeType": "Block", + "src": "29220:148:20", + "statements": [ + { + "expression": { + "id": 7681, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7676, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7674, + "src": "29230:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int80", + "typeString": "int80" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7679, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7671, + "src": "29249:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7678, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "29243:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int80_$", + "typeString": "type(int80)" + }, + "typeName": { + "id": 7677, + "name": "int80", + "nodeType": "ElementaryTypeName", + "src": "29243:5:20", + "typeDescriptions": {} + } + }, + "id": 7680, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "29243:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int80", + "typeString": "int80" + } + }, + "src": "29230:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int80", + "typeString": "int80" + } + }, + "id": 7682, + "nodeType": "ExpressionStatement", + "src": "29230:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7685, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7683, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7674, + "src": "29269:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int80", + "typeString": "int80" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7684, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7671, + "src": "29283:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "29269:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7692, + "nodeType": "IfStatement", + "src": "29265:97:20", + "trueBody": { + "id": 7691, + "nodeType": "Block", + "src": "29290:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3830", + "id": 7687, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29341:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_80_by_1", + "typeString": "int_const 80" + }, + "value": "80" + }, + { + "id": 7688, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7671, + "src": "29345:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_80_by_1", + "typeString": "int_const 80" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7686, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "29311:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7689, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "29311:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7690, + "nodeType": "RevertStatement", + "src": "29304:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7669, + "nodeType": "StructuredDocumentation", + "src": "28836:307:20", + "text": " @dev Returns the downcasted int80 from int256, reverting on\n overflow (when the input is less than smallest int80 or\n greater than largest int80).\n Counterpart to Solidity's `int80` operator.\n Requirements:\n - input must fit into 80 bits" + }, + "id": 7694, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt80", + "nameLocation": "29157:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7672, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7671, + "mutability": "mutable", + "name": "value", + "nameLocation": "29172:5:20", + "nodeType": "VariableDeclaration", + "scope": 7694, + "src": "29165:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7670, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "29165:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "29164:14:20" + }, + "returnParameters": { + "id": 7675, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7674, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "29208:10:20", + "nodeType": "VariableDeclaration", + "scope": 7694, + "src": "29202:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int80", + "typeString": "int80" + }, + "typeName": { + "id": 7673, + "name": "int80", + "nodeType": "ElementaryTypeName", + "src": "29202:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int80", + "typeString": "int80" + } + }, + "visibility": "internal" + } + ], + "src": "29201:18:20" + }, + "scope": 7969, + "src": "29148:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7719, + "nodeType": "Block", + "src": "29758:148:20", + "statements": [ + { + "expression": { + "id": 7707, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7702, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7700, + "src": "29768:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int72", + "typeString": "int72" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7705, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7697, + "src": "29787:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7704, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "29781:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int72_$", + "typeString": "type(int72)" + }, + "typeName": { + "id": 7703, + "name": "int72", + "nodeType": "ElementaryTypeName", + "src": "29781:5:20", + "typeDescriptions": {} + } + }, + "id": 7706, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "29781:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int72", + "typeString": "int72" + } + }, + "src": "29768:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int72", + "typeString": "int72" + } + }, + "id": 7708, + "nodeType": "ExpressionStatement", + "src": "29768:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7711, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7709, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7700, + "src": "29807:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int72", + "typeString": "int72" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7710, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7697, + "src": "29821:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "29807:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7718, + "nodeType": "IfStatement", + "src": "29803:97:20", + "trueBody": { + "id": 7717, + "nodeType": "Block", + "src": "29828:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3732", + "id": 7713, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "29879:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_72_by_1", + "typeString": "int_const 72" + }, + "value": "72" + }, + { + "id": 7714, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7697, + "src": "29883:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_72_by_1", + "typeString": "int_const 72" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7712, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "29849:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7715, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "29849:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7716, + "nodeType": "RevertStatement", + "src": "29842:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7695, + "nodeType": "StructuredDocumentation", + "src": "29374:307:20", + "text": " @dev Returns the downcasted int72 from int256, reverting on\n overflow (when the input is less than smallest int72 or\n greater than largest int72).\n Counterpart to Solidity's `int72` operator.\n Requirements:\n - input must fit into 72 bits" + }, + "id": 7720, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt72", + "nameLocation": "29695:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7698, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7697, + "mutability": "mutable", + "name": "value", + "nameLocation": "29710:5:20", + "nodeType": "VariableDeclaration", + "scope": 7720, + "src": "29703:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7696, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "29703:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "29702:14:20" + }, + "returnParameters": { + "id": 7701, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7700, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "29746:10:20", + "nodeType": "VariableDeclaration", + "scope": 7720, + "src": "29740:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int72", + "typeString": "int72" + }, + "typeName": { + "id": 7699, + "name": "int72", + "nodeType": "ElementaryTypeName", + "src": "29740:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int72", + "typeString": "int72" + } + }, + "visibility": "internal" + } + ], + "src": "29739:18:20" + }, + "scope": 7969, + "src": "29686:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7745, + "nodeType": "Block", + "src": "30296:148:20", + "statements": [ + { + "expression": { + "id": 7733, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7728, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7726, + "src": "30306:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int64", + "typeString": "int64" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7731, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7723, + "src": "30325:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7730, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "30319:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int64_$", + "typeString": "type(int64)" + }, + "typeName": { + "id": 7729, + "name": "int64", + "nodeType": "ElementaryTypeName", + "src": "30319:5:20", + "typeDescriptions": {} + } + }, + "id": 7732, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "30319:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int64", + "typeString": "int64" + } + }, + "src": "30306:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int64", + "typeString": "int64" + } + }, + "id": 7734, + "nodeType": "ExpressionStatement", + "src": "30306:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7737, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7735, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7726, + "src": "30345:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int64", + "typeString": "int64" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7736, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7723, + "src": "30359:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "30345:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7744, + "nodeType": "IfStatement", + "src": "30341:97:20", + "trueBody": { + "id": 7743, + "nodeType": "Block", + "src": "30366:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3634", + "id": 7739, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30417:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + "value": "64" + }, + { + "id": 7740, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7723, + "src": "30421:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_64_by_1", + "typeString": "int_const 64" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7738, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "30387:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7741, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "30387:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7742, + "nodeType": "RevertStatement", + "src": "30380:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7721, + "nodeType": "StructuredDocumentation", + "src": "29912:307:20", + "text": " @dev Returns the downcasted int64 from int256, reverting on\n overflow (when the input is less than smallest int64 or\n greater than largest int64).\n Counterpart to Solidity's `int64` operator.\n Requirements:\n - input must fit into 64 bits" + }, + "id": 7746, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt64", + "nameLocation": "30233:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7724, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7723, + "mutability": "mutable", + "name": "value", + "nameLocation": "30248:5:20", + "nodeType": "VariableDeclaration", + "scope": 7746, + "src": "30241:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7722, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "30241:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "30240:14:20" + }, + "returnParameters": { + "id": 7727, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7726, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "30284:10:20", + "nodeType": "VariableDeclaration", + "scope": 7746, + "src": "30278:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int64", + "typeString": "int64" + }, + "typeName": { + "id": 7725, + "name": "int64", + "nodeType": "ElementaryTypeName", + "src": "30278:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int64", + "typeString": "int64" + } + }, + "visibility": "internal" + } + ], + "src": "30277:18:20" + }, + "scope": 7969, + "src": "30224:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7771, + "nodeType": "Block", + "src": "30834:148:20", + "statements": [ + { + "expression": { + "id": 7759, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7754, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7752, + "src": "30844:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int56", + "typeString": "int56" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7757, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7749, + "src": "30863:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7756, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "30857:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int56_$", + "typeString": "type(int56)" + }, + "typeName": { + "id": 7755, + "name": "int56", + "nodeType": "ElementaryTypeName", + "src": "30857:5:20", + "typeDescriptions": {} + } + }, + "id": 7758, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "30857:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int56", + "typeString": "int56" + } + }, + "src": "30844:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int56", + "typeString": "int56" + } + }, + "id": 7760, + "nodeType": "ExpressionStatement", + "src": "30844:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7763, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7761, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7752, + "src": "30883:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int56", + "typeString": "int56" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7762, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7749, + "src": "30897:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "30883:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7770, + "nodeType": "IfStatement", + "src": "30879:97:20", + "trueBody": { + "id": 7769, + "nodeType": "Block", + "src": "30904:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3536", + "id": 7765, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "30955:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_56_by_1", + "typeString": "int_const 56" + }, + "value": "56" + }, + { + "id": 7766, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7749, + "src": "30959:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_56_by_1", + "typeString": "int_const 56" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7764, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "30925:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7767, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "30925:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7768, + "nodeType": "RevertStatement", + "src": "30918:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7747, + "nodeType": "StructuredDocumentation", + "src": "30450:307:20", + "text": " @dev Returns the downcasted int56 from int256, reverting on\n overflow (when the input is less than smallest int56 or\n greater than largest int56).\n Counterpart to Solidity's `int56` operator.\n Requirements:\n - input must fit into 56 bits" + }, + "id": 7772, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt56", + "nameLocation": "30771:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7750, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7749, + "mutability": "mutable", + "name": "value", + "nameLocation": "30786:5:20", + "nodeType": "VariableDeclaration", + "scope": 7772, + "src": "30779:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7748, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "30779:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "30778:14:20" + }, + "returnParameters": { + "id": 7753, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7752, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "30822:10:20", + "nodeType": "VariableDeclaration", + "scope": 7772, + "src": "30816:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int56", + "typeString": "int56" + }, + "typeName": { + "id": 7751, + "name": "int56", + "nodeType": "ElementaryTypeName", + "src": "30816:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int56", + "typeString": "int56" + } + }, + "visibility": "internal" + } + ], + "src": "30815:18:20" + }, + "scope": 7969, + "src": "30762:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7797, + "nodeType": "Block", + "src": "31372:148:20", + "statements": [ + { + "expression": { + "id": 7785, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7780, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7778, + "src": "31382:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int48", + "typeString": "int48" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7783, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7775, + "src": "31401:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7782, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "31395:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int48_$", + "typeString": "type(int48)" + }, + "typeName": { + "id": 7781, + "name": "int48", + "nodeType": "ElementaryTypeName", + "src": "31395:5:20", + "typeDescriptions": {} + } + }, + "id": 7784, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "31395:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int48", + "typeString": "int48" + } + }, + "src": "31382:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int48", + "typeString": "int48" + } + }, + "id": 7786, + "nodeType": "ExpressionStatement", + "src": "31382:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7789, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7787, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7778, + "src": "31421:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int48", + "typeString": "int48" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7788, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7775, + "src": "31435:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "31421:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7796, + "nodeType": "IfStatement", + "src": "31417:97:20", + "trueBody": { + "id": 7795, + "nodeType": "Block", + "src": "31442:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3438", + "id": 7791, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "31493:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_48_by_1", + "typeString": "int_const 48" + }, + "value": "48" + }, + { + "id": 7792, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7775, + "src": "31497:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_48_by_1", + "typeString": "int_const 48" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7790, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "31463:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7793, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "31463:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7794, + "nodeType": "RevertStatement", + "src": "31456:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7773, + "nodeType": "StructuredDocumentation", + "src": "30988:307:20", + "text": " @dev Returns the downcasted int48 from int256, reverting on\n overflow (when the input is less than smallest int48 or\n greater than largest int48).\n Counterpart to Solidity's `int48` operator.\n Requirements:\n - input must fit into 48 bits" + }, + "id": 7798, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt48", + "nameLocation": "31309:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7776, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7775, + "mutability": "mutable", + "name": "value", + "nameLocation": "31324:5:20", + "nodeType": "VariableDeclaration", + "scope": 7798, + "src": "31317:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7774, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "31317:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "31316:14:20" + }, + "returnParameters": { + "id": 7779, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7778, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "31360:10:20", + "nodeType": "VariableDeclaration", + "scope": 7798, + "src": "31354:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int48", + "typeString": "int48" + }, + "typeName": { + "id": 7777, + "name": "int48", + "nodeType": "ElementaryTypeName", + "src": "31354:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int48", + "typeString": "int48" + } + }, + "visibility": "internal" + } + ], + "src": "31353:18:20" + }, + "scope": 7969, + "src": "31300:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7823, + "nodeType": "Block", + "src": "31910:148:20", + "statements": [ + { + "expression": { + "id": 7811, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7806, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7804, + "src": "31920:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int40", + "typeString": "int40" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7809, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7801, + "src": "31939:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7808, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "31933:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int40_$", + "typeString": "type(int40)" + }, + "typeName": { + "id": 7807, + "name": "int40", + "nodeType": "ElementaryTypeName", + "src": "31933:5:20", + "typeDescriptions": {} + } + }, + "id": 7810, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "31933:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int40", + "typeString": "int40" + } + }, + "src": "31920:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int40", + "typeString": "int40" + } + }, + "id": 7812, + "nodeType": "ExpressionStatement", + "src": "31920:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7815, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7813, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7804, + "src": "31959:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int40", + "typeString": "int40" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7814, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7801, + "src": "31973:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "31959:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7822, + "nodeType": "IfStatement", + "src": "31955:97:20", + "trueBody": { + "id": 7821, + "nodeType": "Block", + "src": "31980:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3430", + "id": 7817, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "32031:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_40_by_1", + "typeString": "int_const 40" + }, + "value": "40" + }, + { + "id": 7818, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7801, + "src": "32035:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_40_by_1", + "typeString": "int_const 40" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7816, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "32001:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7819, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "32001:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7820, + "nodeType": "RevertStatement", + "src": "31994:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7799, + "nodeType": "StructuredDocumentation", + "src": "31526:307:20", + "text": " @dev Returns the downcasted int40 from int256, reverting on\n overflow (when the input is less than smallest int40 or\n greater than largest int40).\n Counterpart to Solidity's `int40` operator.\n Requirements:\n - input must fit into 40 bits" + }, + "id": 7824, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt40", + "nameLocation": "31847:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7802, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7801, + "mutability": "mutable", + "name": "value", + "nameLocation": "31862:5:20", + "nodeType": "VariableDeclaration", + "scope": 7824, + "src": "31855:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7800, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "31855:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "31854:14:20" + }, + "returnParameters": { + "id": 7805, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7804, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "31898:10:20", + "nodeType": "VariableDeclaration", + "scope": 7824, + "src": "31892:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int40", + "typeString": "int40" + }, + "typeName": { + "id": 7803, + "name": "int40", + "nodeType": "ElementaryTypeName", + "src": "31892:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int40", + "typeString": "int40" + } + }, + "visibility": "internal" + } + ], + "src": "31891:18:20" + }, + "scope": 7969, + "src": "31838:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7849, + "nodeType": "Block", + "src": "32448:148:20", + "statements": [ + { + "expression": { + "id": 7837, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7832, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7830, + "src": "32458:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int32", + "typeString": "int32" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7835, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7827, + "src": "32477:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7834, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "32471:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int32_$", + "typeString": "type(int32)" + }, + "typeName": { + "id": 7833, + "name": "int32", + "nodeType": "ElementaryTypeName", + "src": "32471:5:20", + "typeDescriptions": {} + } + }, + "id": 7836, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "32471:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int32", + "typeString": "int32" + } + }, + "src": "32458:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int32", + "typeString": "int32" + } + }, + "id": 7838, + "nodeType": "ExpressionStatement", + "src": "32458:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7841, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7839, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7830, + "src": "32497:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int32", + "typeString": "int32" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7840, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7827, + "src": "32511:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "32497:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7848, + "nodeType": "IfStatement", + "src": "32493:97:20", + "trueBody": { + "id": 7847, + "nodeType": "Block", + "src": "32518:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3332", + "id": 7843, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "32569:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + { + "id": 7844, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7827, + "src": "32573:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7842, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "32539:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7845, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "32539:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7846, + "nodeType": "RevertStatement", + "src": "32532:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7825, + "nodeType": "StructuredDocumentation", + "src": "32064:307:20", + "text": " @dev Returns the downcasted int32 from int256, reverting on\n overflow (when the input is less than smallest int32 or\n greater than largest int32).\n Counterpart to Solidity's `int32` operator.\n Requirements:\n - input must fit into 32 bits" + }, + "id": 7850, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt32", + "nameLocation": "32385:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7828, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7827, + "mutability": "mutable", + "name": "value", + "nameLocation": "32400:5:20", + "nodeType": "VariableDeclaration", + "scope": 7850, + "src": "32393:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7826, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "32393:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "32392:14:20" + }, + "returnParameters": { + "id": 7831, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7830, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "32436:10:20", + "nodeType": "VariableDeclaration", + "scope": 7850, + "src": "32430:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int32", + "typeString": "int32" + }, + "typeName": { + "id": 7829, + "name": "int32", + "nodeType": "ElementaryTypeName", + "src": "32430:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int32", + "typeString": "int32" + } + }, + "visibility": "internal" + } + ], + "src": "32429:18:20" + }, + "scope": 7969, + "src": "32376:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7875, + "nodeType": "Block", + "src": "32986:148:20", + "statements": [ + { + "expression": { + "id": 7863, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7858, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7856, + "src": "32996:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int24", + "typeString": "int24" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7861, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7853, + "src": "33015:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7860, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "33009:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int24_$", + "typeString": "type(int24)" + }, + "typeName": { + "id": 7859, + "name": "int24", + "nodeType": "ElementaryTypeName", + "src": "33009:5:20", + "typeDescriptions": {} + } + }, + "id": 7862, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "33009:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int24", + "typeString": "int24" + } + }, + "src": "32996:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int24", + "typeString": "int24" + } + }, + "id": 7864, + "nodeType": "ExpressionStatement", + "src": "32996:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7867, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7865, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7856, + "src": "33035:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int24", + "typeString": "int24" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7866, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7853, + "src": "33049:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "33035:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7874, + "nodeType": "IfStatement", + "src": "33031:97:20", + "trueBody": { + "id": 7873, + "nodeType": "Block", + "src": "33056:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3234", + "id": 7869, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "33107:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_24_by_1", + "typeString": "int_const 24" + }, + "value": "24" + }, + { + "id": 7870, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7853, + "src": "33111:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_24_by_1", + "typeString": "int_const 24" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7868, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "33077:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7871, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "33077:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7872, + "nodeType": "RevertStatement", + "src": "33070:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7851, + "nodeType": "StructuredDocumentation", + "src": "32602:307:20", + "text": " @dev Returns the downcasted int24 from int256, reverting on\n overflow (when the input is less than smallest int24 or\n greater than largest int24).\n Counterpart to Solidity's `int24` operator.\n Requirements:\n - input must fit into 24 bits" + }, + "id": 7876, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt24", + "nameLocation": "32923:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7854, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7853, + "mutability": "mutable", + "name": "value", + "nameLocation": "32938:5:20", + "nodeType": "VariableDeclaration", + "scope": 7876, + "src": "32931:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7852, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "32931:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "32930:14:20" + }, + "returnParameters": { + "id": 7857, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7856, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "32974:10:20", + "nodeType": "VariableDeclaration", + "scope": 7876, + "src": "32968:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int24", + "typeString": "int24" + }, + "typeName": { + "id": 7855, + "name": "int24", + "nodeType": "ElementaryTypeName", + "src": "32968:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int24", + "typeString": "int24" + } + }, + "visibility": "internal" + } + ], + "src": "32967:18:20" + }, + "scope": 7969, + "src": "32914:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7901, + "nodeType": "Block", + "src": "33524:148:20", + "statements": [ + { + "expression": { + "id": 7889, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7884, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7882, + "src": "33534:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int16", + "typeString": "int16" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7887, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7879, + "src": "33553:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7886, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "33547:5:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int16_$", + "typeString": "type(int16)" + }, + "typeName": { + "id": 7885, + "name": "int16", + "nodeType": "ElementaryTypeName", + "src": "33547:5:20", + "typeDescriptions": {} + } + }, + "id": 7888, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "33547:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int16", + "typeString": "int16" + } + }, + "src": "33534:25:20", + "typeDescriptions": { + "typeIdentifier": "t_int16", + "typeString": "int16" + } + }, + "id": 7890, + "nodeType": "ExpressionStatement", + "src": "33534:25:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7893, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7891, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7882, + "src": "33573:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int16", + "typeString": "int16" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7892, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7879, + "src": "33587:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "33573:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7900, + "nodeType": "IfStatement", + "src": "33569:97:20", + "trueBody": { + "id": 7899, + "nodeType": "Block", + "src": "33594:72:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "3136", + "id": 7895, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "33645:2:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + "value": "16" + }, + { + "id": 7896, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7879, + "src": "33649:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_16_by_1", + "typeString": "int_const 16" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7894, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "33615:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7897, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "33615:40:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7898, + "nodeType": "RevertStatement", + "src": "33608:47:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7877, + "nodeType": "StructuredDocumentation", + "src": "33140:307:20", + "text": " @dev Returns the downcasted int16 from int256, reverting on\n overflow (when the input is less than smallest int16 or\n greater than largest int16).\n Counterpart to Solidity's `int16` operator.\n Requirements:\n - input must fit into 16 bits" + }, + "id": 7902, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt16", + "nameLocation": "33461:7:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7880, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7879, + "mutability": "mutable", + "name": "value", + "nameLocation": "33476:5:20", + "nodeType": "VariableDeclaration", + "scope": 7902, + "src": "33469:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7878, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "33469:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "33468:14:20" + }, + "returnParameters": { + "id": 7883, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7882, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "33512:10:20", + "nodeType": "VariableDeclaration", + "scope": 7902, + "src": "33506:16:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int16", + "typeString": "int16" + }, + "typeName": { + "id": 7881, + "name": "int16", + "nodeType": "ElementaryTypeName", + "src": "33506:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int16", + "typeString": "int16" + } + }, + "visibility": "internal" + } + ], + "src": "33505:18:20" + }, + "scope": 7969, + "src": "33452:220:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7927, + "nodeType": "Block", + "src": "34055:146:20", + "statements": [ + { + "expression": { + "id": 7915, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 7910, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7908, + "src": "34065:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int8", + "typeString": "int8" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 7913, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7905, + "src": "34083:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7912, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "34078:4:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int8_$", + "typeString": "type(int8)" + }, + "typeName": { + "id": 7911, + "name": "int8", + "nodeType": "ElementaryTypeName", + "src": "34078:4:20", + "typeDescriptions": {} + } + }, + "id": 7914, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "34078:11:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int8", + "typeString": "int8" + } + }, + "src": "34065:24:20", + "typeDescriptions": { + "typeIdentifier": "t_int8", + "typeString": "int8" + } + }, + "id": 7916, + "nodeType": "ExpressionStatement", + "src": "34065:24:20" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7919, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7917, + "name": "downcasted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7908, + "src": "34103:10:20", + "typeDescriptions": { + "typeIdentifier": "t_int8", + "typeString": "int8" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 7918, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7905, + "src": "34117:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "34103:19:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7926, + "nodeType": "IfStatement", + "src": "34099:96:20", + "trueBody": { + "id": 7925, + "nodeType": "Block", + "src": "34124:71:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "hexValue": "38", + "id": 7921, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "34175:1:20", + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + { + "id": 7922, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7905, + "src": "34178:5:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7920, + "name": "SafeCastOverflowedIntDowncast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6226, + "src": "34145:29:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint8_$_t_int256_$returns$_t_error_$", + "typeString": "function (uint8,int256) pure returns (error)" + } + }, + "id": 7923, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "34145:39:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7924, + "nodeType": "RevertStatement", + "src": "34138:46:20" + } + ] + } + } + ] + }, + "documentation": { + "id": 7903, + "nodeType": "StructuredDocumentation", + "src": "33678:302:20", + "text": " @dev Returns the downcasted int8 from int256, reverting on\n overflow (when the input is less than smallest int8 or\n greater than largest int8).\n Counterpart to Solidity's `int8` operator.\n Requirements:\n - input must fit into 8 bits" + }, + "id": 7928, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt8", + "nameLocation": "33994:6:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7906, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7905, + "mutability": "mutable", + "name": "value", + "nameLocation": "34008:5:20", + "nodeType": "VariableDeclaration", + "scope": 7928, + "src": "34001:12:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7904, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "34001:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "34000:14:20" + }, + "returnParameters": { + "id": 7909, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7908, + "mutability": "mutable", + "name": "downcasted", + "nameLocation": "34043:10:20", + "nodeType": "VariableDeclaration", + "scope": 7928, + "src": "34038:15:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int8", + "typeString": "int8" + }, + "typeName": { + "id": 7907, + "name": "int8", + "nodeType": "ElementaryTypeName", + "src": "34038:4:20", + "typeDescriptions": { + "typeIdentifier": "t_int8", + "typeString": "int8" + } + }, + "visibility": "internal" + } + ], + "src": "34037:17:20" + }, + "scope": 7969, + "src": "33985:216:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7957, + "nodeType": "Block", + "src": "34441:250:20", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 7945, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7936, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7931, + "src": "34554:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "arguments": [ + { + "expression": { + "arguments": [ + { + "id": 7941, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "34575:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + }, + "typeName": { + "id": 7940, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "34575:6:20", + "typeDescriptions": {} + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + } + ], + "id": 7939, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "34570:4:20", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 7942, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "34570:12:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_int256", + "typeString": "type(int256)" + } + }, + "id": 7943, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "34583:3:20", + "memberName": "max", + "nodeType": "MemberAccess", + "src": "34570:16:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 7938, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "34562:7:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 7937, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "34562:7:20", + "typeDescriptions": {} + } + }, + "id": 7944, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "34562:25:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "34554:33:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 7951, + "nodeType": "IfStatement", + "src": "34550:105:20", + "trueBody": { + "id": 7950, + "nodeType": "Block", + "src": "34589:66:20", + "statements": [ + { + "errorCall": { + "arguments": [ + { + "id": 7947, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7931, + "src": "34638:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7946, + "name": "SafeCastOverflowedUintToInt", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6231, + "src": "34610:27:20", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_uint256_$returns$_t_error_$", + "typeString": "function (uint256) pure returns (error)" + } + }, + "id": 7948, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "34610:34:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_error", + "typeString": "error" + } + }, + "id": 7949, + "nodeType": "RevertStatement", + "src": "34603:41:20" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 7954, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7931, + "src": "34678:5:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7953, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "34671:6:20", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + }, + "typeName": { + "id": 7952, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "34671:6:20", + "typeDescriptions": {} + } + }, + "id": 7955, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "34671:13:20", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "functionReturnParameters": 7935, + "id": 7956, + "nodeType": "Return", + "src": "34664:20:20" + } + ] + }, + "documentation": { + "id": 7929, + "nodeType": "StructuredDocumentation", + "src": "34207:165:20", + "text": " @dev Converts an unsigned uint256 into a signed int256.\n Requirements:\n - input must be less than or equal to maxInt256." + }, + "id": 7958, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toInt256", + "nameLocation": "34386:8:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7932, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7931, + "mutability": "mutable", + "name": "value", + "nameLocation": "34403:5:20", + "nodeType": "VariableDeclaration", + "scope": 7958, + "src": "34395:13:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 7930, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "34395:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "34394:15:20" + }, + "returnParameters": { + "id": 7935, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7934, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 7958, + "src": "34433:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7933, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "34433:6:20", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "34432:8:20" + }, + "scope": 7969, + "src": "34377:314:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 7967, + "nodeType": "Block", + "src": "34850:87:20", + "statements": [ + { + "AST": { + "nativeSrc": "34885:46:20", + "nodeType": "YulBlock", + "src": "34885:46:20", + "statements": [ + { + "nativeSrc": "34899:22:20", + "nodeType": "YulAssignment", + "src": "34899:22:20", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "b", + "nativeSrc": "34918:1:20", + "nodeType": "YulIdentifier", + "src": "34918:1:20" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "34911:6:20", + "nodeType": "YulIdentifier", + "src": "34911:6:20" + }, + "nativeSrc": "34911:9:20", + "nodeType": "YulFunctionCall", + "src": "34911:9:20" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "34904:6:20", + "nodeType": "YulIdentifier", + "src": "34904:6:20" + }, + "nativeSrc": "34904:17:20", + "nodeType": "YulFunctionCall", + "src": "34904:17:20" + }, + "variableNames": [ + { + "name": "u", + "nativeSrc": "34899:1:20", + "nodeType": "YulIdentifier", + "src": "34899:1:20" + } + ] + } + ] + }, + "evmVersion": "cancun", + "externalReferences": [ + { + "declaration": 7961, + "isOffset": false, + "isSlot": false, + "src": "34918:1:20", + "valueSize": 1 + }, + { + "declaration": 7964, + "isOffset": false, + "isSlot": false, + "src": "34899:1:20", + "valueSize": 1 + } + ], + "flags": [ + "memory-safe" + ], + "id": 7966, + "nodeType": "InlineAssembly", + "src": "34860:71:20" + } + ] + }, + "documentation": { + "id": 7959, + "nodeType": "StructuredDocumentation", + "src": "34697:90:20", + "text": " @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump." + }, + "id": 7968, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toUint", + "nameLocation": "34801:6:20", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7962, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7961, + "mutability": "mutable", + "name": "b", + "nameLocation": "34813:1:20", + "nodeType": "VariableDeclaration", + "scope": 7968, + "src": "34808:6:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 7960, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "34808:4:20", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "34807:8:20" + }, + "returnParameters": { + "id": 7965, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7964, + "mutability": "mutable", + "name": "u", + "nameLocation": "34847:1:20", + "nodeType": "VariableDeclaration", + "scope": 7968, + "src": "34839:9:20", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 7963, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "34839:7:20", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "34838:11:20" + }, + "scope": 7969, + "src": "34792:145:20", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + } + ], + "scope": 7970, + "src": "769:34170:20", + "usedErrors": [ + 6214, + 6219, + 6226, + 6231 + ], + "usedEvents": [] + } + ], + "src": "192:34748:20" + }, + "id": 20 + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "ast": { + "absolutePath": "@openzeppelin/contracts/utils/math/SignedMath.sol", + "exportedSymbols": { + "SafeCast": [ + 7969 + ], + "SignedMath": [ + 8113 + ] + }, + "id": 8114, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 7971, + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ], + "nodeType": "PragmaDirective", + "src": "109:24:21" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/math/SafeCast.sol", + "file": "./SafeCast.sol", + "id": 7973, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 8114, + "sourceUnit": 7970, + "src": "135:40:21", + "symbolAliases": [ + { + "foreign": { + "id": 7972, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "143:8:21", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "SignedMath", + "contractDependencies": [], + "contractKind": "library", + "documentation": { + "id": 7974, + "nodeType": "StructuredDocumentation", + "src": "177:80:21", + "text": " @dev Standard signed math utilities missing in the Solidity language." + }, + "fullyImplemented": true, + "id": 8113, + "linearizedBaseContracts": [ + 8113 + ], + "name": "SignedMath", + "nameLocation": "266:10:21", + "nodeType": "ContractDefinition", + "nodes": [ + { + "body": { + "id": 8003, + "nodeType": "Block", + "src": "746:215:21", + "statements": [ + { + "id": 8002, + "nodeType": "UncheckedBlock", + "src": "756:199:21", + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8000, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7986, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7981, + "src": "894:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "^", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7998, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 7989, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 7987, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7979, + "src": "900:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "^", + "rightExpression": { + "id": 7988, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7981, + "src": "904:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "900:5:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 7990, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "899:7:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "arguments": [ + { + "arguments": [ + { + "id": 7995, + "name": "condition", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7977, + "src": "932:9:21", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "expression": { + "id": 7993, + "name": "SafeCast", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 7969, + "src": "916:8:21", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_SafeCast_$7969_$", + "typeString": "type(library SafeCast)" + } + }, + "id": 7994, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "925:6:21", + "memberName": "toUint", + "nodeType": "MemberAccess", + "referencedDeclaration": 7968, + "src": "916:15:21", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$returns$_t_uint256_$", + "typeString": "function (bool) pure returns (uint256)" + } + }, + "id": 7996, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "916:26:21", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 7992, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "909:6:21", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + }, + "typeName": { + "id": 7991, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "909:6:21", + "typeDescriptions": {} + } + }, + "id": 7997, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "909:34:21", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "899:44:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 7999, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "898:46:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "894:50:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "functionReturnParameters": 7985, + "id": 8001, + "nodeType": "Return", + "src": "887:57:21" + } + ] + } + ] + }, + "documentation": { + "id": 7975, + "nodeType": "StructuredDocumentation", + "src": "283:374:21", + "text": " @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant.\n IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.\n However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute\n one branch when needed, making this function more expensive." + }, + "id": 8004, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ternary", + "nameLocation": "671:7:21", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 7982, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7977, + "mutability": "mutable", + "name": "condition", + "nameLocation": "684:9:21", + "nodeType": "VariableDeclaration", + "scope": 8004, + "src": "679:14:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 7976, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "679:4:21", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 7979, + "mutability": "mutable", + "name": "a", + "nameLocation": "702:1:21", + "nodeType": "VariableDeclaration", + "scope": 8004, + "src": "695:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7978, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "695:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 7981, + "mutability": "mutable", + "name": "b", + "nameLocation": "712:1:21", + "nodeType": "VariableDeclaration", + "scope": 8004, + "src": "705:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7980, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "705:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "678:36:21" + }, + "returnParameters": { + "id": 7985, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 7984, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 8004, + "src": "738:6:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 7983, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "738:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "737:8:21" + }, + "scope": 8113, + "src": "662:299:21", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 8022, + "nodeType": "Block", + "src": "1102:44:21", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8017, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8015, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8007, + "src": "1127:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "id": 8016, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8009, + "src": "1131:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "1127:5:21", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "id": 8018, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8007, + "src": "1134:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + { + "id": 8019, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8009, + "src": "1137:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 8014, + "name": "ternary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8004, + "src": "1119:7:21", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$_t_int256_$_t_int256_$returns$_t_int256_$", + "typeString": "function (bool,int256,int256) pure returns (int256)" + } + }, + "id": 8020, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1119:20:21", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "functionReturnParameters": 8013, + "id": 8021, + "nodeType": "Return", + "src": "1112:27:21" + } + ] + }, + "documentation": { + "id": 8005, + "nodeType": "StructuredDocumentation", + "src": "967:66:21", + "text": " @dev Returns the largest of two signed numbers." + }, + "id": 8023, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "max", + "nameLocation": "1047:3:21", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8010, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8007, + "mutability": "mutable", + "name": "a", + "nameLocation": "1058:1:21", + "nodeType": "VariableDeclaration", + "scope": 8023, + "src": "1051:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8006, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1051:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8009, + "mutability": "mutable", + "name": "b", + "nameLocation": "1068:1:21", + "nodeType": "VariableDeclaration", + "scope": 8023, + "src": "1061:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8008, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1061:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "1050:20:21" + }, + "returnParameters": { + "id": 8013, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8012, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 8023, + "src": "1094:6:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8011, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1094:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "1093:8:21" + }, + "scope": 8113, + "src": "1038:108:21", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 8041, + "nodeType": "Block", + "src": "1288:44:21", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8036, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8034, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8026, + "src": "1313:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 8035, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8028, + "src": "1317:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "1313:5:21", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "id": 8037, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8026, + "src": "1320:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + { + "id": 8038, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8028, + "src": "1323:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 8033, + "name": "ternary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8004, + "src": "1305:7:21", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bool_$_t_int256_$_t_int256_$returns$_t_int256_$", + "typeString": "function (bool,int256,int256) pure returns (int256)" + } + }, + "id": 8039, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1305:20:21", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "functionReturnParameters": 8032, + "id": 8040, + "nodeType": "Return", + "src": "1298:27:21" + } + ] + }, + "documentation": { + "id": 8024, + "nodeType": "StructuredDocumentation", + "src": "1152:67:21", + "text": " @dev Returns the smallest of two signed numbers." + }, + "id": 8042, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "min", + "nameLocation": "1233:3:21", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8029, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8026, + "mutability": "mutable", + "name": "a", + "nameLocation": "1244:1:21", + "nodeType": "VariableDeclaration", + "scope": 8042, + "src": "1237:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8025, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1237:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8028, + "mutability": "mutable", + "name": "b", + "nameLocation": "1254:1:21", + "nodeType": "VariableDeclaration", + "scope": 8042, + "src": "1247:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8027, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1247:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "1236:20:21" + }, + "returnParameters": { + "id": 8032, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8031, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 8042, + "src": "1280:6:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8030, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1280:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "1279:8:21" + }, + "scope": 8113, + "src": "1224:108:21", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 8085, + "nodeType": "Block", + "src": "1537:162:21", + "statements": [ + { + "assignments": [ + 8053 + ], + "declarations": [ + { + "constant": false, + "id": 8053, + "mutability": "mutable", + "name": "x", + "nameLocation": "1606:1:21", + "nodeType": "VariableDeclaration", + "scope": 8085, + "src": "1599:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8052, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1599:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "id": 8066, + "initialValue": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8065, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8056, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8054, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8045, + "src": "1611:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "id": 8055, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8047, + "src": "1615:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "1611:5:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 8057, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1610:7:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8063, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8060, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8058, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8045, + "src": "1622:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "^", + "rightExpression": { + "id": 8059, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8047, + "src": "1626:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "1622:5:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 8061, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1621:7:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "31", + "id": 8062, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1632:1:21", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "1621:12:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 8064, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1620:14:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "1610:24:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1599:35:21" + }, + { + "expression": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8083, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8067, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8053, + "src": "1651:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8081, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 8075, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 8072, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8053, + "src": "1671:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 8071, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1663:7:21", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 8070, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1663:7:21", + "typeDescriptions": {} + } + }, + "id": 8073, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1663:10:21", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "323535", + "id": 8074, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1677:3:21", + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "255" + }, + "src": "1663:17:21", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 8069, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1656:6:21", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_int256_$", + "typeString": "type(int256)" + }, + "typeName": { + "id": 8068, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1656:6:21", + "typeDescriptions": {} + } + }, + "id": 8076, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1656:25:21", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8079, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8077, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8045, + "src": "1685:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "^", + "rightExpression": { + "id": 8078, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8047, + "src": "1689:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "1685:5:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 8080, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1684:7:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "1656:35:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 8082, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1655:37:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "1651:41:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "functionReturnParameters": 8051, + "id": 8084, + "nodeType": "Return", + "src": "1644:48:21" + } + ] + }, + "documentation": { + "id": 8043, + "nodeType": "StructuredDocumentation", + "src": "1338:126:21", + "text": " @dev Returns the average of two signed numbers without overflow.\n The result is rounded towards zero." + }, + "id": 8086, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "average", + "nameLocation": "1478:7:21", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8048, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8045, + "mutability": "mutable", + "name": "a", + "nameLocation": "1493:1:21", + "nodeType": "VariableDeclaration", + "scope": 8086, + "src": "1486:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8044, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1486:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8047, + "mutability": "mutable", + "name": "b", + "nameLocation": "1503:1:21", + "nodeType": "VariableDeclaration", + "scope": 8086, + "src": "1496:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8046, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1496:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "1485:20:21" + }, + "returnParameters": { + "id": 8051, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8050, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 8086, + "src": "1529:6:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8049, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1529:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "1528:8:21" + }, + "scope": 8113, + "src": "1469:230:21", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 8111, + "nodeType": "Block", + "src": "1843:767:21", + "statements": [ + { + "id": 8110, + "nodeType": "UncheckedBlock", + "src": "1853:751:21", + "statements": [ + { + "assignments": [ + 8095 + ], + "declarations": [ + { + "constant": false, + "id": 8095, + "mutability": "mutable", + "name": "mask", + "nameLocation": "2424:4:21", + "nodeType": "VariableDeclaration", + "scope": 8110, + "src": "2417:11:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8094, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "2417:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "id": 8099, + "initialValue": { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8098, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8096, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8089, + "src": "2431:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">>", + "rightExpression": { + "hexValue": "323535", + "id": 8097, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2436:3:21", + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "255" + }, + "src": "2431:8:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2417:22:21" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8107, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "components": [ + { + "commonType": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "id": 8104, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8102, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8089, + "src": "2576:1:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "id": 8103, + "name": "mask", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8095, + "src": "2580:4:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "2576:8:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "id": 8105, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "2575:10:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "nodeType": "BinaryOperation", + "operator": "^", + "rightExpression": { + "id": 8106, + "name": "mask", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8095, + "src": "2588:4:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "src": "2575:17:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + ], + "id": 8101, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2567:7:21", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 8100, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2567:7:21", + "typeDescriptions": {} + } + }, + "id": 8108, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2567:26:21", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 8093, + "id": 8109, + "nodeType": "Return", + "src": "2560:33:21" + } + ] + } + ] + }, + "documentation": { + "id": 8087, + "nodeType": "StructuredDocumentation", + "src": "1705:78:21", + "text": " @dev Returns the absolute unsigned value of a signed value." + }, + "id": 8112, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "abs", + "nameLocation": "1797:3:21", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8090, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8089, + "mutability": "mutable", + "name": "n", + "nameLocation": "1808:1:21", + "nodeType": "VariableDeclaration", + "scope": 8112, + "src": "1801:8:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + }, + "typeName": { + "id": 8088, + "name": "int256", + "nodeType": "ElementaryTypeName", + "src": "1801:6:21", + "typeDescriptions": { + "typeIdentifier": "t_int256", + "typeString": "int256" + } + }, + "visibility": "internal" + } + ], + "src": "1800:10:21" + }, + "returnParameters": { + "id": 8093, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8092, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 8112, + "src": "1834:7:21", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8091, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1834:7:21", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1833:9:21" + }, + "scope": 8113, + "src": "1788:822:21", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + } + ], + "scope": 8114, + "src": "258:2354:21", + "usedErrors": [], + "usedEvents": [] + } + ], + "src": "109:2504:21" + }, + "id": 21 + }, + "contracts/TokenRelayer.sol": { + "ast": { + "absolutePath": "contracts/TokenRelayer.sol", + "exportedSymbols": { + "ECDSA": [ + 4137 + ], + "EIP712": [ + 4364 + ], + "IERC20": [ + 340 + ], + "IERC20Permit": [ + 376 + ], + "Ownable": [ + 147 + ], + "ReentrancyGuard": [ + 1827 + ], + "SafeERC20": [ + 831 + ], + "TokenRelayer": [ + 8603 + ] + }, + "id": 8604, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 8115, + "literals": [ + "solidity", + "^", + "0.8", + ".28" + ], + "nodeType": "PragmaDirective", + "src": "32:24:22" + }, + { + "absolutePath": "@openzeppelin/contracts/access/Ownable.sol", + "file": "@openzeppelin/contracts/access/Ownable.sol", + "id": 8117, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 8604, + "sourceUnit": 148, + "src": "58:67:22", + "symbolAliases": [ + { + "foreign": { + "id": 8116, + "name": "Ownable", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 147, + "src": "66:7:22", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/token/ERC20/IERC20.sol", + "file": "@openzeppelin/contracts/token/ERC20/IERC20.sol", + "id": 8119, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 8604, + "sourceUnit": 341, + "src": "126:70:22", + "symbolAliases": [ + { + "foreign": { + "id": 8118, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "134:6:22", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol", + "file": "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol", + "id": 8121, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 8604, + "sourceUnit": 377, + "src": "197:93:22", + "symbolAliases": [ + { + "foreign": { + "id": 8120, + "name": "IERC20Permit", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 376, + "src": "205:12:22", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol", + "file": "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol", + "id": 8123, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 8604, + "sourceUnit": 832, + "src": "291:82:22", + "symbolAliases": [ + { + "foreign": { + "id": 8122, + "name": "SafeERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "299:9:22", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/ReentrancyGuard.sol", + "file": "@openzeppelin/contracts/utils/ReentrancyGuard.sol", + "id": 8125, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 8604, + "sourceUnit": 1828, + "src": "374:82:22", + "symbolAliases": [ + { + "foreign": { + "id": 8124, + "name": "ReentrancyGuard", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1827, + "src": "382:15:22", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/cryptography/ECDSA.sol", + "file": "@openzeppelin/contracts/utils/cryptography/ECDSA.sol", + "id": 8127, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 8604, + "sourceUnit": 4138, + "src": "457:75:22", + "symbolAliases": [ + { + "foreign": { + "id": 8126, + "name": "ECDSA", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4137, + "src": "465:5:22", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "@openzeppelin/contracts/utils/cryptography/EIP712.sol", + "file": "@openzeppelin/contracts/utils/cryptography/EIP712.sol", + "id": 8129, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 8604, + "sourceUnit": 4365, + "src": "533:77:22", + "symbolAliases": [ + { + "foreign": { + "id": 8128, + "name": "EIP712", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4364, + "src": "541:6:22", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [ + { + "baseName": { + "id": 8131, + "name": "Ownable", + "nameLocations": [ + "1183:7:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 147, + "src": "1183:7:22" + }, + "id": 8132, + "nodeType": "InheritanceSpecifier", + "src": "1183:7:22" + }, + { + "baseName": { + "id": 8133, + "name": "ReentrancyGuard", + "nameLocations": [ + "1192:15:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1827, + "src": "1192:15:22" + }, + "id": 8134, + "nodeType": "InheritanceSpecifier", + "src": "1192:15:22" + }, + { + "baseName": { + "id": 8135, + "name": "EIP712", + "nameLocations": [ + "1209:6:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4364, + "src": "1209:6:22" + }, + "id": 8136, + "nodeType": "InheritanceSpecifier", + "src": "1209:6:22" + } + ], + "canonicalName": "TokenRelayer", + "contractDependencies": [], + "contractKind": "contract", + "documentation": { + "id": 8130, + "nodeType": "StructuredDocumentation", + "src": "612:545:22", + "text": " @title TokenRelayer\n @notice A relayer contract that accepts ERC20 permit signatures and executes\n arbitrary calls to a destination contract, both authorized via signature.\n \n Flow:\n 1. User signs a permit allowing the relayer to spend their tokens\n 2. User signs a payload (e.g., transfer from relayer to another user)\n 3. Relayer:\n a. Executes permit to approve the tokens\n b. Transfers tokens from user to relayer (via transferFrom)\n c. Forwards the payload call (transfer from relayer to another user)" + }, + "fullyImplemented": true, + "id": 8603, + "linearizedBaseContracts": [ + 8603, + 4364, + 262, + 1827, + 147, + 1662 + ], + "name": "TokenRelayer", + "nameLocation": "1167:12:22", + "nodeType": "ContractDefinition", + "nodes": [ + { + "global": false, + "id": 8140, + "libraryName": { + "id": 8137, + "name": "SafeERC20", + "nameLocations": [ + "1228:9:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 831, + "src": "1228:9:22" + }, + "nodeType": "UsingForDirective", + "src": "1222:27:22", + "typeName": { + "id": 8139, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 8138, + "name": "IERC20", + "nameLocations": [ + "1242:6:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 340, + "src": "1242:6:22" + }, + "referencedDeclaration": 340, + "src": "1242:6:22", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + } + }, + { + "constant": true, + "id": 8145, + "mutability": "constant", + "name": "_TYPE_HASH_PAYLOAD", + "nameLocation": "1335:18:22", + "nodeType": "VariableDeclaration", + "scope": 8603, + "src": "1310:202:22", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8141, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1310:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": { + "arguments": [ + { + "hexValue": "5061796c6f616428616464726573732064657374696e6174696f6e2c61646472657373206f776e65722c6164647265737320746f6b656e2c75696e743235362076616c75652c627974657320646174612c75696e743235362065746856616c75652c75696e74323536206e6f6e63652c75696e7432353620646561646c696e6529", + "id": 8143, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1375:131:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_f0543e2024fd0ae16ccb842686c2733758ec65acfd69fb599c05b286f8db8844", + "typeString": "literal_string \"Payload(address destination,address owner,address token,uint256 value,bytes data,uint256 ethValue,uint256 nonce,uint256 deadline)\"" + }, + "value": "Payload(address destination,address owner,address token,uint256 value,bytes data,uint256 ethValue,uint256 nonce,uint256 deadline)" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_f0543e2024fd0ae16ccb842686c2733758ec65acfd69fb599c05b286f8db8844", + "typeString": "literal_string \"Payload(address destination,address owner,address token,uint256 value,bytes data,uint256 ethValue,uint256 nonce,uint256 deadline)\"" + } + ], + "id": 8142, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "1356:9:22", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 8144, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1356:156:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "private" + }, + { + "constant": false, + "functionSelector": "75bd6863", + "id": 8147, + "mutability": "immutable", + "name": "destinationContract", + "nameLocation": "1544:19:22", + "nodeType": "VariableDeclaration", + "scope": 8603, + "src": "1519:44:22", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8146, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1519:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "public" + }, + { + "constant": false, + "functionSelector": "d850124e", + "id": 8153, + "mutability": "mutable", + "name": "usedPayloadNonces", + "nameLocation": "1622:17:22", + "nodeType": "VariableDeclaration", + "scope": 8603, + "src": "1570:69:22", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_uint256_$_t_bool_$_$", + "typeString": "mapping(address => mapping(uint256 => bool))" + }, + "typeName": { + "id": 8152, + "keyName": "", + "keyNameLocation": "-1:-1:-1", + "keyType": { + "id": 8148, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1578:7:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Mapping", + "src": "1570:44:22", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_uint256_$_t_bool_$_$", + "typeString": "mapping(address => mapping(uint256 => bool))" + }, + "valueName": "", + "valueNameLocation": "-1:-1:-1", + "valueType": { + "id": 8151, + "keyName": "", + "keyNameLocation": "-1:-1:-1", + "keyType": { + "id": 8149, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1597:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Mapping", + "src": "1589:24:22", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_bool_$", + "typeString": "mapping(uint256 => bool)" + }, + "valueName": "", + "valueNameLocation": "-1:-1:-1", + "valueType": { + "id": 8150, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "1608:4:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + } + }, + "visibility": "public" + }, + { + "canonicalName": "TokenRelayer.ExecuteParams", + "id": 8182, + "members": [ + { + "constant": false, + "id": 8155, + "mutability": "mutable", + "name": "token", + "nameLocation": "1768:5:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1760:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8154, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1760:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8157, + "mutability": "mutable", + "name": "owner", + "nameLocation": "1791:5:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1783:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8156, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1783:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8159, + "mutability": "mutable", + "name": "value", + "nameLocation": "1814:5:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1806:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8158, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1806:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8161, + "mutability": "mutable", + "name": "deadline", + "nameLocation": "1837:8:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1829:16:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8160, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1829:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8163, + "mutability": "mutable", + "name": "permitV", + "nameLocation": "1861:7:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1855:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 8162, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "1855:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8165, + "mutability": "mutable", + "name": "permitR", + "nameLocation": "1886:7:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1878:15:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8164, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1878:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8167, + "mutability": "mutable", + "name": "permitS", + "nameLocation": "1911:7:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1903:15:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8166, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1903:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8169, + "mutability": "mutable", + "name": "payloadData", + "nameLocation": "1934:11:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1928:17:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 8168, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1928:5:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8171, + "mutability": "mutable", + "name": "payloadValue", + "nameLocation": "1963:12:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1955:20:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8170, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1955:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8173, + "mutability": "mutable", + "name": "payloadNonce", + "nameLocation": "1993:12:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "1985:20:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8172, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1985:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8175, + "mutability": "mutable", + "name": "payloadDeadline", + "nameLocation": "2023:15:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "2015:23:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8174, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2015:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8177, + "mutability": "mutable", + "name": "payloadV", + "nameLocation": "2054:8:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "2048:14:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 8176, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "2048:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8179, + "mutability": "mutable", + "name": "payloadR", + "nameLocation": "2080:8:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "2072:16:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8178, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2072:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8181, + "mutability": "mutable", + "name": "payloadS", + "nameLocation": "2106:8:22", + "nodeType": "VariableDeclaration", + "scope": 8182, + "src": "2098:16:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8180, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2098:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "name": "ExecuteParams", + "nameLocation": "1736:13:22", + "nodeType": "StructDefinition", + "scope": 8603, + "src": "1729:392:22", + "visibility": "public" + }, + { + "anonymous": false, + "eventSelector": "78129a649632642d8e9f346c85d9efb70d32d50a36774c4585491a9228bbd350", + "id": 8190, + "name": "RelayerExecuted", + "nameLocation": "2133:15:22", + "nodeType": "EventDefinition", + "parameters": { + "id": 8189, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8184, + "indexed": true, + "mutability": "mutable", + "name": "signer", + "nameLocation": "2174:6:22", + "nodeType": "VariableDeclaration", + "scope": 8190, + "src": "2158:22:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8183, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2158:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8186, + "indexed": true, + "mutability": "mutable", + "name": "token", + "nameLocation": "2206:5:22", + "nodeType": "VariableDeclaration", + "scope": 8190, + "src": "2190:21:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8185, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2190:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8188, + "indexed": false, + "mutability": "mutable", + "name": "amount", + "nameLocation": "2229:6:22", + "nodeType": "VariableDeclaration", + "scope": 8190, + "src": "2221:14:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8187, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2221:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2148:93:22" + }, + "src": "2127:115:22" + }, + { + "anonymous": false, + "eventSelector": "a0524ee0fd8662d6c046d199da2a6d3dc49445182cec055873a5bb9c2843c8e0", + "id": 8198, + "name": "TokenWithdrawn", + "nameLocation": "2294:14:22", + "nodeType": "EventDefinition", + "parameters": { + "id": 8197, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8192, + "indexed": true, + "mutability": "mutable", + "name": "token", + "nameLocation": "2325:5:22", + "nodeType": "VariableDeclaration", + "scope": 8198, + "src": "2309:21:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8191, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2309:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8194, + "indexed": false, + "mutability": "mutable", + "name": "amount", + "nameLocation": "2340:6:22", + "nodeType": "VariableDeclaration", + "scope": 8198, + "src": "2332:14:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8193, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2332:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8196, + "indexed": true, + "mutability": "mutable", + "name": "to", + "nameLocation": "2364:2:22", + "nodeType": "VariableDeclaration", + "scope": 8198, + "src": "2348:18:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8195, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2348:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "2308:59:22" + }, + "src": "2288:80:22" + }, + { + "anonymous": false, + "eventSelector": "6148672a948a12b8e0bf92a9338349b9ac890fad62a234abaf0a4da99f62cfcc", + "id": 8204, + "name": "ETHWithdrawn", + "nameLocation": "2379:12:22", + "nodeType": "EventDefinition", + "parameters": { + "id": 8203, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8200, + "indexed": false, + "mutability": "mutable", + "name": "amount", + "nameLocation": "2400:6:22", + "nodeType": "VariableDeclaration", + "scope": 8204, + "src": "2392:14:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8199, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2392:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8202, + "indexed": true, + "mutability": "mutable", + "name": "to", + "nameLocation": "2424:2:22", + "nodeType": "VariableDeclaration", + "scope": 8204, + "src": "2408:18:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8201, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2408:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "2391:36:22" + }, + "src": "2373:55:22" + }, + { + "body": { + "id": 8231, + "nodeType": "Block", + "src": "2614:135:22", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 8223, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8218, + "name": "_destinationContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8206, + "src": "2632:20:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 8221, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2664:1:22", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 8220, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2656:7:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 8219, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2656:7:22", + "typeDescriptions": {} + } + }, + "id": 8222, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2656:10:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "2632:34:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "496e76616c69642064657374696e6174696f6e", + "id": 8224, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2668:21:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_480a3d2cf1e4838d740f40eac57f23eb6facc0baaf1a65a7b61df6a5a00ed368", + "typeString": "literal_string \"Invalid destination\"" + }, + "value": "Invalid destination" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_480a3d2cf1e4838d740f40eac57f23eb6facc0baaf1a65a7b61df6a5a00ed368", + "typeString": "literal_string \"Invalid destination\"" + } + ], + "id": 8217, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "2624:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8225, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2624:66:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8226, + "nodeType": "ExpressionStatement", + "src": "2624:66:22" + }, + { + "expression": { + "id": 8229, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 8227, + "name": "destinationContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8147, + "src": "2700:19:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 8228, + "name": "_destinationContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8206, + "src": "2722:20:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "2700:42:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 8230, + "nodeType": "ExpressionStatement", + "src": "2700:42:22" + } + ] + }, + "id": 8232, + "implemented": true, + "kind": "constructor", + "modifiers": [ + { + "arguments": [ + { + "expression": { + "id": 8209, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -15, + "src": "2562:3:22", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 8210, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2566:6:22", + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "2562:10:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "id": 8211, + "kind": "baseConstructorSpecifier", + "modifierName": { + "id": 8208, + "name": "Ownable", + "nameLocations": [ + "2554:7:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 147, + "src": "2554:7:22" + }, + "nodeType": "ModifierInvocation", + "src": "2554:19:22" + }, + { + "arguments": [ + { + "hexValue": "546f6b656e52656c61796572", + "id": 8213, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2589:14:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_142b4a499251a4eacaab3f10318ce24bd0fa67fa5375e1dfcd0a44e62c5b47a4", + "typeString": "literal_string \"TokenRelayer\"" + }, + "value": "TokenRelayer" + }, + { + "hexValue": "31", + "id": 8214, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2605:3:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_c89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6", + "typeString": "literal_string \"1\"" + }, + "value": "1" + } + ], + "id": 8215, + "kind": "baseConstructorSpecifier", + "modifierName": { + "id": 8212, + "name": "EIP712", + "nameLocations": [ + "2582:6:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 4364, + "src": "2582:6:22" + }, + "nodeType": "ModifierInvocation", + "src": "2582:27:22" + } + ], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8207, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8206, + "mutability": "mutable", + "name": "_destinationContract", + "nameLocation": "2524:20:22", + "nodeType": "VariableDeclaration", + "scope": 8232, + "src": "2516:28:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8205, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2516:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "2515:30:22" + }, + "returnParameters": { + "id": 8216, + "nodeType": "ParameterList", + "parameters": [], + "src": "2614:0:22" + }, + "scope": 8603, + "src": "2504:245:22", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 8235, + "nodeType": "Block", + "src": "2852:2:22", + "statements": [] + }, + "id": 8236, + "implemented": true, + "kind": "receive", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8233, + "nodeType": "ParameterList", + "parameters": [], + "src": "2832:2:22" + }, + "returnParameters": { + "id": 8234, + "nodeType": "ParameterList", + "parameters": [], + "src": "2852:0:22" + }, + "scope": 8603, + "src": "2825:29:22", + "stateMutability": "payable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 8401, + "nodeType": "Block", + "src": "3073:1918:22", + "statements": [ + { + "assignments": [ + 8245 + ], + "declarations": [ + { + "constant": false, + "id": 8245, + "mutability": "mutable", + "name": "owner", + "nameLocation": "3091:5:22", + "nodeType": "VariableDeclaration", + "scope": 8401, + "src": "3083:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8244, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3083:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "id": 8248, + "initialValue": { + "expression": { + "id": 8246, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3099:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8247, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3106:5:22", + "memberName": "owner", + "nodeType": "MemberAccess", + "referencedDeclaration": 8157, + "src": "3099:12:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3083:28:22" + }, + { + "assignments": [ + 8250 + ], + "declarations": [ + { + "constant": false, + "id": 8250, + "mutability": "mutable", + "name": "nonce", + "nameLocation": "3129:5:22", + "nodeType": "VariableDeclaration", + "scope": 8401, + "src": "3121:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8249, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3121:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 8253, + "initialValue": { + "expression": { + "id": 8251, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3137:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8252, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3144:12:22", + "memberName": "payloadNonce", + "nodeType": "MemberAccess", + "referencedDeclaration": 8173, + "src": "3137:19:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3121:35:22" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 8260, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 8255, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8245, + "src": "3201:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 8258, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3218:1:22", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 8257, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3210:7:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 8256, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3210:7:22", + "typeDescriptions": {} + } + }, + "id": 8259, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3210:10:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "3201:19:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "496e76616c6964206f776e6572", + "id": 8261, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3222:15:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_110461b12e459dc76e692e7a47f9621cf45c7d48020c3c7b2066107cdf1f52ae", + "typeString": "literal_string \"Invalid owner\"" + }, + "value": "Invalid owner" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_110461b12e459dc76e692e7a47f9621cf45c7d48020c3c7b2066107cdf1f52ae", + "typeString": "literal_string \"Invalid owner\"" + } + ], + "id": 8254, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "3193:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8262, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3193:45:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8263, + "nodeType": "ExpressionStatement", + "src": "3193:45:22" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 8271, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 8265, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3256:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8266, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3263:5:22", + "memberName": "token", + "nodeType": "MemberAccess", + "referencedDeclaration": 8155, + "src": "3256:12:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 8269, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3280:1:22", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 8268, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3272:7:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 8267, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3272:7:22", + "typeDescriptions": {} + } + }, + "id": 8270, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3272:10:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "3256:26:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "496e76616c696420746f6b656e", + "id": 8272, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3284:15:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_5e70ebd1d4072d337a7fabaa7bda70fa2633d6e3f89d5cb725a16b10d07e54c6", + "typeString": "literal_string \"Invalid token\"" + }, + "value": "Invalid token" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_5e70ebd1d4072d337a7fabaa7bda70fa2633d6e3f89d5cb725a16b10d07e54c6", + "typeString": "literal_string \"Invalid token\"" + } + ], + "id": 8264, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "3248:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8273, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3248:52:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8274, + "nodeType": "ExpressionStatement", + "src": "3248:52:22" + }, + { + "expression": { + "arguments": [ + { + "id": 8281, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "3318:32:22", + "subExpression": { + "baseExpression": { + "baseExpression": { + "id": 8276, + "name": "usedPayloadNonces", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8153, + "src": "3319:17:22", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_uint256_$_t_bool_$_$", + "typeString": "mapping(address => mapping(uint256 => bool))" + } + }, + "id": 8278, + "indexExpression": { + "id": 8277, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8245, + "src": "3337:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "3319:24:22", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_bool_$", + "typeString": "mapping(uint256 => bool)" + } + }, + "id": 8280, + "indexExpression": { + "id": 8279, + "name": "nonce", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8250, + "src": "3344:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "3319:31:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "4e6f6e63652075736564", + "id": 8282, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3352:12:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_15d72127d094a30af360ead73641c61eda3d745ce4d04d12675a5e9a899f8b21", + "typeString": "literal_string \"Nonce used\"" + }, + "value": "Nonce used" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_15d72127d094a30af360ead73641c61eda3d745ce4d04d12675a5e9a899f8b21", + "typeString": "literal_string \"Nonce used\"" + } + ], + "id": 8275, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "3310:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8283, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3310:55:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8284, + "nodeType": "ExpressionStatement", + "src": "3310:55:22" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 8290, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 8286, + "name": "block", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -4, + "src": "3383:5:22", + "typeDescriptions": { + "typeIdentifier": "t_magic_block", + "typeString": "block" + } + }, + "id": 8287, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3389:9:22", + "memberName": "timestamp", + "nodeType": "MemberAccess", + "src": "3383:15:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<=", + "rightExpression": { + "expression": { + "id": 8288, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3402:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8289, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3409:15:22", + "memberName": "payloadDeadline", + "nodeType": "MemberAccess", + "referencedDeclaration": 8175, + "src": "3402:22:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3383:41:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "5061796c6f61642065787069726564", + "id": 8291, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3426:17:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_27859e47e6c2167c8e8d38addfca16b9afb9d8e9750b6a1e67c29196d4d99fae", + "typeString": "literal_string \"Payload expired\"" + }, + "value": "Payload expired" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_27859e47e6c2167c8e8d38addfca16b9afb9d8e9750b6a1e67c29196d4d99fae", + "typeString": "literal_string \"Payload expired\"" + } + ], + "id": 8285, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "3375:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8292, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3375:69:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8293, + "nodeType": "ExpressionStatement", + "src": "3375:69:22" + }, + { + "assignments": [ + 8295 + ], + "declarations": [ + { + "constant": false, + "id": 8295, + "mutability": "mutable", + "name": "digest", + "nameLocation": "3531:6:22", + "nodeType": "VariableDeclaration", + "scope": 8401, + "src": "3523:14:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8294, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3523:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 8310, + "initialValue": { + "arguments": [ + { + "id": 8297, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8245, + "src": "3568:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 8298, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3587:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8299, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3594:5:22", + "memberName": "token", + "nodeType": "MemberAccess", + "referencedDeclaration": 8155, + "src": "3587:12:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 8300, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3613:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8301, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3620:5:22", + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": 8159, + "src": "3613:12:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 8302, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3639:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8303, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3646:11:22", + "memberName": "payloadData", + "nodeType": "MemberAccess", + "referencedDeclaration": 8169, + "src": "3639:18:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + } + }, + { + "expression": { + "id": 8304, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3671:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8305, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3678:12:22", + "memberName": "payloadValue", + "nodeType": "MemberAccess", + "referencedDeclaration": 8171, + "src": "3671:19:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 8306, + "name": "nonce", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8250, + "src": "3704:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 8307, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3723:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8308, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3730:15:22", + "memberName": "payloadDeadline", + "nodeType": "MemberAccess", + "referencedDeclaration": 8175, + "src": "3723:22:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 8296, + "name": "_computeDigest", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8441, + "src": "3540:14:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_address_$_t_address_$_t_uint256_$_t_bytes_memory_ptr_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_bytes32_$", + "typeString": "function (address,address,uint256,bytes memory,uint256,uint256,uint256) view returns (bytes32)" + } + }, + "id": 8309, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3540:215:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3523:232:22" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 8323, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 8314, + "name": "digest", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8295, + "src": "3864:6:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 8315, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3872:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8316, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3879:8:22", + "memberName": "payloadV", + "nodeType": "MemberAccess", + "referencedDeclaration": 8177, + "src": "3872:15:22", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + { + "expression": { + "id": 8317, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3889:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8318, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3896:8:22", + "memberName": "payloadR", + "nodeType": "MemberAccess", + "referencedDeclaration": 8179, + "src": "3889:15:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 8319, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3906:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8320, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3913:8:22", + "memberName": "payloadS", + "nodeType": "MemberAccess", + "referencedDeclaration": 8181, + "src": "3906:15:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "id": 8312, + "name": "ECDSA", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4137, + "src": "3850:5:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_ECDSA_$4137_$", + "typeString": "type(library ECDSA)" + } + }, + "id": 8313, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3856:7:22", + "memberName": "recover", + "nodeType": "MemberAccess", + "referencedDeclaration": 4059, + "src": "3850:13:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$_t_uint8_$_t_bytes32_$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32,uint8,bytes32,bytes32) pure returns (address)" + } + }, + "id": 8321, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3850:72:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 8322, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8245, + "src": "3926:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "3850:81:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "496e76616c696420736967", + "id": 8324, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3933:13:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_31734eed34fab74fa1579246aaad104a344891a284044483c0c5a792a9f83a72", + "typeString": "literal_string \"Invalid sig\"" + }, + "value": "Invalid sig" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_31734eed34fab74fa1579246aaad104a344891a284044483c0c5a792a9f83a72", + "typeString": "literal_string \"Invalid sig\"" + } + ], + "id": 8311, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "3842:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8325, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3842:105:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8326, + "nodeType": "ExpressionStatement", + "src": "3842:105:22" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 8332, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 8328, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -15, + "src": "3966:3:22", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 8329, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3970:5:22", + "memberName": "value", + "nodeType": "MemberAccess", + "src": "3966:9:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "expression": { + "id": 8330, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "3979:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8331, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3986:12:22", + "memberName": "payloadValue", + "nodeType": "MemberAccess", + "referencedDeclaration": 8171, + "src": "3979:19:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3966:32:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "496e636f7272656374204554482076616c75652070726f7669646564", + "id": 8333, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4000:30:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_a793dc5bde52ab2d5349f1208a34905b1d68ab9298f549a2e514542cba0a8c76", + "typeString": "literal_string \"Incorrect ETH value provided\"" + }, + "value": "Incorrect ETH value provided" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_a793dc5bde52ab2d5349f1208a34905b1d68ab9298f549a2e514542cba0a8c76", + "typeString": "literal_string \"Incorrect ETH value provided\"" + } + ], + "id": 8327, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "3958:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8334, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3958:73:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8335, + "nodeType": "ExpressionStatement", + "src": "3958:73:22" + }, + { + "expression": { + "id": 8342, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "baseExpression": { + "id": 8336, + "name": "usedPayloadNonces", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8153, + "src": "4158:17:22", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_uint256_$_t_bool_$_$", + "typeString": "mapping(address => mapping(uint256 => bool))" + } + }, + "id": 8339, + "indexExpression": { + "id": 8337, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8245, + "src": "4176:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4158:24:22", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_bool_$", + "typeString": "mapping(uint256 => bool)" + } + }, + "id": 8340, + "indexExpression": { + "id": 8338, + "name": "nonce", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8250, + "src": "4183:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "4158:31:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "hexValue": "74727565", + "id": 8341, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4192:4:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "src": "4158:38:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 8343, + "nodeType": "ExpressionStatement", + "src": "4158:38:22" + }, + { + "expression": { + "arguments": [ + { + "expression": { + "id": 8345, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4342:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8346, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4349:5:22", + "memberName": "token", + "nodeType": "MemberAccess", + "referencedDeclaration": 8155, + "src": "4342:12:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 8347, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8245, + "src": "4368:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 8348, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4387:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8349, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4394:5:22", + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": 8159, + "src": "4387:12:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 8350, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4413:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8351, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4420:8:22", + "memberName": "deadline", + "nodeType": "MemberAccess", + "referencedDeclaration": 8161, + "src": "4413:15:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 8352, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4442:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8353, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4449:7:22", + "memberName": "permitV", + "nodeType": "MemberAccess", + "referencedDeclaration": 8163, + "src": "4442:14:22", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + { + "expression": { + "id": 8354, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4470:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8355, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4477:7:22", + "memberName": "permitR", + "nodeType": "MemberAccess", + "referencedDeclaration": 8165, + "src": "4470:14:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 8356, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4498:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8357, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4505:7:22", + "memberName": "permitS", + "nodeType": "MemberAccess", + "referencedDeclaration": 8167, + "src": "4498:14:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 8344, + "name": "_executePermitAndTransfer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8508, + "src": "4303:25:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_address_$_t_uint256_$_t_uint256_$_t_uint8_$_t_bytes32_$_t_bytes32_$returns$__$", + "typeString": "function (address,address,uint256,uint256,uint8,bytes32,bytes32)" + } + }, + "id": 8358, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4303:219:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8359, + "nodeType": "ExpressionStatement", + "src": "4303:219:22" + }, + { + "expression": { + "arguments": [ + { + "id": 8365, + "name": "destinationContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8147, + "src": "4626:19:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 8366, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4647:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8367, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4654:5:22", + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": 8159, + "src": "4647:12:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [ + { + "expression": { + "id": 8361, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4599:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8362, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4606:5:22", + "memberName": "token", + "nodeType": "MemberAccess", + "referencedDeclaration": 8155, + "src": "4599:12:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 8360, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "4592:6:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$340_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 8363, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4592:20:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "id": 8364, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4613:12:22", + "memberName": "forceApprove", + "nodeType": "MemberAccess", + "referencedDeclaration": 626, + "src": "4592:33:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$returns$__$attached_to$_t_contract$_IERC20_$340_$", + "typeString": "function (contract IERC20,address,uint256)" + } + }, + "id": 8368, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4592:68:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8369, + "nodeType": "ExpressionStatement", + "src": "4592:68:22" + }, + { + "assignments": [ + 8371 + ], + "declarations": [ + { + "constant": false, + "id": 8371, + "mutability": "mutable", + "name": "callSuccess", + "nameLocation": "4676:11:22", + "nodeType": "VariableDeclaration", + "scope": 8401, + "src": "4671:16:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 8370, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "4671:4:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "id": 8378, + "initialValue": { + "arguments": [ + { + "expression": { + "id": 8373, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4703:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8374, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4710:11:22", + "memberName": "payloadData", + "nodeType": "MemberAccess", + "referencedDeclaration": 8169, + "src": "4703:18:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + } + }, + { + "expression": { + "id": 8375, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -15, + "src": "4723:3:22", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 8376, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4727:5:22", + "memberName": "value", + "nodeType": "MemberAccess", + "src": "4723:9:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_calldata_ptr", + "typeString": "bytes calldata" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 8372, + "name": "_forwardCall", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8529, + "src": "4690:12:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes_memory_ptr_$_t_uint256_$returns$_t_bool_$", + "typeString": "function (bytes memory,uint256) returns (bool)" + } + }, + "id": 8377, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4690:43:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4671:62:22" + }, + { + "expression": { + "arguments": [ + { + "id": 8380, + "name": "callSuccess", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8371, + "src": "4751:11:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "43616c6c206661696c6564", + "id": 8381, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4764:13:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_066ad49a0ed9e5d6a9f3c20fca13a038f0a5d629f0aaf09d634ae2a7c232ac2b", + "typeString": "literal_string \"Call failed\"" + }, + "value": "Call failed" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_066ad49a0ed9e5d6a9f3c20fca13a038f0a5d629f0aaf09d634ae2a7c232ac2b", + "typeString": "literal_string \"Call failed\"" + } + ], + "id": 8379, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "4743:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8382, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4743:35:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8383, + "nodeType": "ExpressionStatement", + "src": "4743:35:22" + }, + { + "expression": { + "arguments": [ + { + "id": 8389, + "name": "destinationContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8147, + "src": "4895:19:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "hexValue": "30", + "id": 8390, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4916:1:22", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "expression": { + "arguments": [ + { + "expression": { + "id": 8385, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4868:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8386, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4875:5:22", + "memberName": "token", + "nodeType": "MemberAccess", + "referencedDeclaration": 8155, + "src": "4868:12:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 8384, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "4861:6:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$340_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 8387, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4861:20:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "id": 8388, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4882:12:22", + "memberName": "forceApprove", + "nodeType": "MemberAccess", + "referencedDeclaration": 626, + "src": "4861:33:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$returns$__$attached_to$_t_contract$_IERC20_$340_$", + "typeString": "function (contract IERC20,address,uint256)" + } + }, + "id": 8391, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4861:57:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8392, + "nodeType": "ExpressionStatement", + "src": "4861:57:22" + }, + { + "eventCall": { + "arguments": [ + { + "id": 8394, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8245, + "src": "4950:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 8395, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4957:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8396, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4964:5:22", + "memberName": "token", + "nodeType": "MemberAccess", + "referencedDeclaration": 8155, + "src": "4957:12:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "expression": { + "id": 8397, + "name": "params", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8239, + "src": "4971:6:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams calldata" + } + }, + "id": 8398, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "4978:5:22", + "memberName": "value", + "nodeType": "MemberAccess", + "referencedDeclaration": 8159, + "src": "4971:12:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 8393, + "name": "RelayerExecuted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8190, + "src": "4934:15:22", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$__$", + "typeString": "function (address,address,uint256)" + } + }, + "id": 8399, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "4934:50:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8400, + "nodeType": "EmitStatement", + "src": "4929:55:22" + } + ] + }, + "functionSelector": "2af83bfe", + "id": 8402, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 8242, + "kind": "modifierInvocation", + "modifierName": { + "id": 8241, + "name": "nonReentrant", + "nameLocations": [ + "3060:12:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 1757, + "src": "3060:12:22" + }, + "nodeType": "ModifierInvocation", + "src": "3060:12:22" + } + ], + "name": "execute", + "nameLocation": "3004:7:22", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8240, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8239, + "mutability": "mutable", + "name": "params", + "nameLocation": "3035:6:22", + "nodeType": "VariableDeclaration", + "scope": 8402, + "src": "3012:29:22", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_calldata_ptr", + "typeString": "struct TokenRelayer.ExecuteParams" + }, + "typeName": { + "id": 8238, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 8237, + "name": "ExecuteParams", + "nameLocations": [ + "3012:13:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 8182, + "src": "3012:13:22" + }, + "referencedDeclaration": 8182, + "src": "3012:13:22", + "typeDescriptions": { + "typeIdentifier": "t_struct$_ExecuteParams_$8182_storage_ptr", + "typeString": "struct TokenRelayer.ExecuteParams" + } + }, + "visibility": "internal" + } + ], + "src": "3011:31:22" + }, + "returnParameters": { + "id": 8243, + "nodeType": "ParameterList", + "parameters": [], + "src": "3073:0:22" + }, + "scope": 8603, + "src": "2995:1996:22", + "stateMutability": "payable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 8440, + "nodeType": "Block", + "src": "5285:400:22", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "id": 8425, + "name": "_TYPE_HASH_PAYLOAD", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8145, + "src": "5370:18:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 8426, + "name": "destinationContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8147, + "src": "5406:19:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 8427, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8404, + "src": "5494:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 8428, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8406, + "src": "5517:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 8429, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8408, + "src": "5540:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [ + { + "id": 8431, + "name": "data", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8410, + "src": "5573:4:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 8430, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "5563:9:22", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 8432, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5563:15:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 8433, + "name": "ethValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8412, + "src": "5596:8:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 8434, + "name": "nonce", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8414, + "src": "5622:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 8435, + "name": "deadline", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8416, + "src": "5645:8:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 8423, + "name": "abi", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -1, + "src": "5342:3:22", + "typeDescriptions": { + "typeIdentifier": "t_magic_abi", + "typeString": "abi" + } + }, + "id": 8424, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "5346:6:22", + "memberName": "encode", + "nodeType": "MemberAccess", + "src": "5342:10:22", + "typeDescriptions": { + "typeIdentifier": "t_function_abiencode_pure$__$returns$_t_bytes_memory_ptr_$", + "typeString": "function () pure returns (bytes memory)" + } + }, + "id": 8436, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5342:325:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 8422, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "5332:9:22", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 8437, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5332:336:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 8421, + "name": "_hashTypedDataV4", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4297, + "src": "5302:16:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_bytes32_$", + "typeString": "function (bytes32) view returns (bytes32)" + } + }, + "id": 8438, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "5302:376:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "functionReturnParameters": 8420, + "id": 8439, + "nodeType": "Return", + "src": "5295:383:22" + } + ] + }, + "id": 8441, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_computeDigest", + "nameLocation": "5062:14:22", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8417, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8404, + "mutability": "mutable", + "name": "owner", + "nameLocation": "5094:5:22", + "nodeType": "VariableDeclaration", + "scope": 8441, + "src": "5086:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8403, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5086:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8406, + "mutability": "mutable", + "name": "token", + "nameLocation": "5117:5:22", + "nodeType": "VariableDeclaration", + "scope": 8441, + "src": "5109:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8405, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5109:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8408, + "mutability": "mutable", + "name": "value", + "nameLocation": "5140:5:22", + "nodeType": "VariableDeclaration", + "scope": 8441, + "src": "5132:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8407, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5132:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8410, + "mutability": "mutable", + "name": "data", + "nameLocation": "5168:4:22", + "nodeType": "VariableDeclaration", + "scope": 8441, + "src": "5155:17:22", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 8409, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5155:5:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8412, + "mutability": "mutable", + "name": "ethValue", + "nameLocation": "5190:8:22", + "nodeType": "VariableDeclaration", + "scope": 8441, + "src": "5182:16:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8411, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5182:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8414, + "mutability": "mutable", + "name": "nonce", + "nameLocation": "5216:5:22", + "nodeType": "VariableDeclaration", + "scope": 8441, + "src": "5208:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8413, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5208:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8416, + "mutability": "mutable", + "name": "deadline", + "nameLocation": "5239:8:22", + "nodeType": "VariableDeclaration", + "scope": 8441, + "src": "5231:16:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8415, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5231:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5076:177:22" + }, + "returnParameters": { + "id": 8420, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8419, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 8441, + "src": "5276:7:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8418, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5276:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "5275:9:22" + }, + "scope": 8603, + "src": "5053:632:22", + "stateMutability": "view", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 8507, + "nodeType": "Block", + "src": "6141:577:22", + "statements": [ + { + "clauses": [ + { + "block": { + "id": 8474, + "nodeType": "Block", + "src": "6291:43:22", + "statements": [] + }, + "errorName": "", + "id": 8475, + "nodeType": "TryCatchClause", + "src": "6291:43:22" + }, + { + "block": { + "id": 8492, + "nodeType": "Block", + "src": "6341:246:22", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 8488, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 8481, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8446, + "src": "6472:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "arguments": [ + { + "id": 8484, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "6487:4:22", + "typeDescriptions": { + "typeIdentifier": "t_contract$_TokenRelayer_$8603", + "typeString": "contract TokenRelayer" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_TokenRelayer_$8603", + "typeString": "contract TokenRelayer" + } + ], + "id": 8483, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6479:7:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 8482, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6479:7:22", + "typeDescriptions": {} + } + }, + "id": 8485, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6479:13:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "expression": { + "arguments": [ + { + "id": 8478, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8444, + "src": "6455:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 8477, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "6448:6:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$340_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 8479, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6448:13:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "id": 8480, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6462:9:22", + "memberName": "allowance", + "nodeType": "MemberAccess", + "referencedDeclaration": 317, + "src": "6448:23:22", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_address_$_t_address_$returns$_t_uint256_$", + "typeString": "function (address,address) view external returns (uint256)" + } + }, + "id": 8486, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6448:45:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "id": 8487, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8448, + "src": "6497:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6448:54:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "5065726d6974206661696c656420616e6420696e73756666696369656e7420616c6c6f77616e6365", + "id": 8489, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6520:42:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_0acc7f0c8df1a6717d2b423ae4591ac135687015764ac37dd4cf0150a9322b15", + "typeString": "literal_string \"Permit failed and insufficient allowance\"" + }, + "value": "Permit failed and insufficient allowance" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_0acc7f0c8df1a6717d2b423ae4591ac135687015764ac37dd4cf0150a9322b15", + "typeString": "literal_string \"Permit failed and insufficient allowance\"" + } + ], + "id": 8476, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "6423:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8490, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6423:153:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8491, + "nodeType": "ExpressionStatement", + "src": "6423:153:22" + } + ] + }, + "errorName": "", + "id": 8493, + "nodeType": "TryCatchClause", + "src": "6335:252:22" + } + ], + "externalCall": { + "arguments": [ + { + "id": 8463, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8446, + "src": "6243:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "arguments": [ + { + "id": 8466, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "6258:4:22", + "typeDescriptions": { + "typeIdentifier": "t_contract$_TokenRelayer_$8603", + "typeString": "contract TokenRelayer" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_TokenRelayer_$8603", + "typeString": "contract TokenRelayer" + } + ], + "id": 8465, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6250:7:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 8464, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6250:7:22", + "typeDescriptions": {} + } + }, + "id": 8467, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6250:13:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 8468, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8448, + "src": "6265:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 8469, + "name": "deadline", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8450, + "src": "6272:8:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 8470, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8452, + "src": "6282:1:22", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + { + "id": 8471, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8454, + "src": "6285:1:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 8472, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8456, + "src": "6288:1:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "arguments": [ + { + "id": 8460, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8444, + "src": "6229:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 8459, + "name": "IERC20Permit", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 376, + "src": "6216:12:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20Permit_$376_$", + "typeString": "type(contract IERC20Permit)" + } + }, + "id": 8461, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6216:19:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20Permit_$376", + "typeString": "contract IERC20Permit" + } + }, + "id": 8462, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6236:6:22", + "memberName": "permit", + "nodeType": "MemberAccess", + "referencedDeclaration": 361, + "src": "6216:26:22", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_address_$_t_uint256_$_t_uint256_$_t_uint8_$_t_bytes32_$_t_bytes32_$returns$__$", + "typeString": "function (address,address,uint256,uint256,uint8,bytes32,bytes32) external" + } + }, + "id": 8473, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6216:74:22", + "tryCall": true, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8494, + "nodeType": "TryStatement", + "src": "6212:375:22" + }, + { + "expression": { + "arguments": [ + { + "id": 8499, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8446, + "src": "6683:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "arguments": [ + { + "id": 8502, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "6698:4:22", + "typeDescriptions": { + "typeIdentifier": "t_contract$_TokenRelayer_$8603", + "typeString": "contract TokenRelayer" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_TokenRelayer_$8603", + "typeString": "contract TokenRelayer" + } + ], + "id": 8501, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6690:7:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 8500, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6690:7:22", + "typeDescriptions": {} + } + }, + "id": 8503, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6690:13:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 8504, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8448, + "src": "6705:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [ + { + "id": 8496, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8444, + "src": "6659:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 8495, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "6652:6:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$340_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 8497, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6652:13:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "id": 8498, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6666:16:22", + "memberName": "safeTransferFrom", + "nodeType": "MemberAccess", + "referencedDeclaration": 456, + "src": "6652:30:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_address_$_t_uint256_$returns$__$attached_to$_t_contract$_IERC20_$340_$", + "typeString": "function (contract IERC20,address,address,uint256)" + } + }, + "id": 8505, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6652:59:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8506, + "nodeType": "ExpressionStatement", + "src": "6652:59:22" + } + ] + }, + "documentation": { + "id": 8442, + "nodeType": "StructuredDocumentation", + "src": "5691:245:22", + "text": " @dev Execute permit approval and then transfer tokens from owner to self (relayer).\n Permit is wrapped in try-catch: if it was front-run, we check\n that the allowance is already sufficient before proceeding." + }, + "id": 8508, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_executePermitAndTransfer", + "nameLocation": "5950:25:22", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8457, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8444, + "mutability": "mutable", + "name": "token", + "nameLocation": "5993:5:22", + "nodeType": "VariableDeclaration", + "scope": 8508, + "src": "5985:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8443, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5985:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8446, + "mutability": "mutable", + "name": "owner", + "nameLocation": "6016:5:22", + "nodeType": "VariableDeclaration", + "scope": 8508, + "src": "6008:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8445, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6008:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8448, + "mutability": "mutable", + "name": "value", + "nameLocation": "6039:5:22", + "nodeType": "VariableDeclaration", + "scope": 8508, + "src": "6031:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8447, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6031:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8450, + "mutability": "mutable", + "name": "deadline", + "nameLocation": "6062:8:22", + "nodeType": "VariableDeclaration", + "scope": 8508, + "src": "6054:16:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8449, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6054:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8452, + "mutability": "mutable", + "name": "v", + "nameLocation": "6086:1:22", + "nodeType": "VariableDeclaration", + "scope": 8508, + "src": "6080:7:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 8451, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "6080:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8454, + "mutability": "mutable", + "name": "r", + "nameLocation": "6105:1:22", + "nodeType": "VariableDeclaration", + "scope": 8508, + "src": "6097:9:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8453, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6097:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8456, + "mutability": "mutable", + "name": "s", + "nameLocation": "6124:1:22", + "nodeType": "VariableDeclaration", + "scope": 8508, + "src": "6116:9:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8455, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6116:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "5975:156:22" + }, + "returnParameters": { + "id": 8458, + "nodeType": "ParameterList", + "parameters": [], + "src": "6141:0:22" + }, + "scope": 8603, + "src": "5941:777:22", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 8528, + "nodeType": "Block", + "src": "6804:104:22", + "statements": [ + { + "assignments": [ + 8518, + null + ], + "declarations": [ + { + "constant": false, + "id": 8518, + "mutability": "mutable", + "name": "success", + "nameLocation": "6820:7:22", + "nodeType": "VariableDeclaration", + "scope": 8528, + "src": "6815:12:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 8517, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "6815:4:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + null + ], + "id": 8525, + "initialValue": { + "arguments": [ + { + "id": 8523, + "name": "data", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8510, + "src": "6872:4:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "id": 8519, + "name": "destinationContract", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8147, + "src": "6833:19:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 8520, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "6853:4:22", + "memberName": "call", + "nodeType": "MemberAccess", + "src": "6833:24:22", + "typeDescriptions": { + "typeIdentifier": "t_function_barecall_payable$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$", + "typeString": "function (bytes memory) payable returns (bool,bytes memory)" + } + }, + "id": 8522, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "names": [ + "value" + ], + "nodeType": "FunctionCallOptions", + "options": [ + { + "id": 8521, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8512, + "src": "6865:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "src": "6833:38:22", + "typeDescriptions": { + "typeIdentifier": "t_function_barecall_payable$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$value", + "typeString": "function (bytes memory) payable returns (bool,bytes memory)" + } + }, + "id": 8524, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "6833:44:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$", + "typeString": "tuple(bool,bytes memory)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "6814:63:22" + }, + { + "expression": { + "id": 8526, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8518, + "src": "6894:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 8516, + "id": 8527, + "nodeType": "Return", + "src": "6887:14:22" + } + ] + }, + "id": 8529, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_forwardCall", + "nameLocation": "6733:12:22", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8513, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8510, + "mutability": "mutable", + "name": "data", + "nameLocation": "6759:4:22", + "nodeType": "VariableDeclaration", + "scope": 8529, + "src": "6746:17:22", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 8509, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "6746:5:22", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8512, + "mutability": "mutable", + "name": "value", + "nameLocation": "6773:5:22", + "nodeType": "VariableDeclaration", + "scope": 8529, + "src": "6765:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8511, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6765:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "6745:34:22" + }, + "returnParameters": { + "id": 8516, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8515, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 8529, + "src": "6798:4:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 8514, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "6798:4:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "6797:6:22" + }, + "scope": 8603, + "src": "6724:184:22", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 8555, + "nodeType": "Block", + "src": "7309:113:22", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 8543, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 67, + "src": "7346:5:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", + "typeString": "function () view returns (address)" + } + }, + "id": 8544, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7346:7:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 8545, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8534, + "src": "7355:6:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [ + { + "id": 8540, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8532, + "src": "7326:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 8539, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 340, + "src": "7319:6:22", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$340_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 8541, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7319:13:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$340", + "typeString": "contract IERC20" + } + }, + "id": 8542, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7333:12:22", + "memberName": "safeTransfer", + "nodeType": "MemberAccess", + "referencedDeclaration": 425, + "src": "7319:26:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$340_$_t_address_$_t_uint256_$returns$__$attached_to$_t_contract$_IERC20_$340_$", + "typeString": "function (contract IERC20,address,uint256)" + } + }, + "id": 8546, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7319:43:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8547, + "nodeType": "ExpressionStatement", + "src": "7319:43:22" + }, + { + "eventCall": { + "arguments": [ + { + "id": 8549, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8532, + "src": "7392:5:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 8550, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8534, + "src": "7399:6:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 8551, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 67, + "src": "7407:5:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", + "typeString": "function () view returns (address)" + } + }, + "id": 8552, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7407:7:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 8548, + "name": "TokenWithdrawn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8198, + "src": "7377:14:22", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_uint256_$_t_address_$returns$__$", + "typeString": "function (address,uint256,address)" + } + }, + "id": 8553, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7377:38:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8554, + "nodeType": "EmitStatement", + "src": "7372:43:22" + } + ] + }, + "documentation": { + "id": 8530, + "nodeType": "StructuredDocumentation", + "src": "6914:217:22", + "text": " @notice Allows the owner to recover any ERC20 tokens held by this contract.\n @param token The ERC20 token contract address.\n @param amount The amount of tokens to transfer to the owner." + }, + "functionSelector": "9e281a98", + "id": 8556, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 8537, + "kind": "modifierInvocation", + "modifierName": { + "id": 8536, + "name": "onlyOwner", + "nameLocations": [ + "7299:9:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 58, + "src": "7299:9:22" + }, + "nodeType": "ModifierInvocation", + "src": "7299:9:22" + } + ], + "name": "withdrawToken", + "nameLocation": "7245:13:22", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8535, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8532, + "mutability": "mutable", + "name": "token", + "nameLocation": "7267:5:22", + "nodeType": "VariableDeclaration", + "scope": 8556, + "src": "7259:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8531, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "7259:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8534, + "mutability": "mutable", + "name": "amount", + "nameLocation": "7282:6:22", + "nodeType": "VariableDeclaration", + "scope": 8556, + "src": "7274:14:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8533, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7274:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7258:31:22" + }, + "returnParameters": { + "id": 8538, + "nodeType": "ParameterList", + "parameters": [], + "src": "7309:0:22" + }, + "scope": 8603, + "src": "7236:186:22", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 8585, + "nodeType": "Block", + "src": "7675:160:22", + "statements": [ + { + "assignments": [ + 8565, + null + ], + "declarations": [ + { + "constant": false, + "id": 8565, + "mutability": "mutable", + "name": "success", + "nameLocation": "7691:7:22", + "nodeType": "VariableDeclaration", + "scope": 8585, + "src": "7686:12:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 8564, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "7686:4:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + null + ], + "id": 8573, + "initialValue": { + "arguments": [ + { + "hexValue": "", + "id": 8571, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7732:2:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "typeString": "literal_string \"\"" + }, + "value": "" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "typeString": "literal_string \"\"" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "typeString": "literal_string \"\"" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 8566, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 67, + "src": "7704:5:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", + "typeString": "function () view returns (address)" + } + }, + "id": 8567, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7704:7:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 8568, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "7712:4:22", + "memberName": "call", + "nodeType": "MemberAccess", + "src": "7704:12:22", + "typeDescriptions": { + "typeIdentifier": "t_function_barecall_payable$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$", + "typeString": "function (bytes memory) payable returns (bool,bytes memory)" + } + }, + "id": 8570, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "names": [ + "value" + ], + "nodeType": "FunctionCallOptions", + "options": [ + { + "id": 8569, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8559, + "src": "7724:6:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "src": "7704:27:22", + "typeDescriptions": { + "typeIdentifier": "t_function_barecall_payable$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$value", + "typeString": "function (bytes memory) payable returns (bool,bytes memory)" + } + }, + "id": 8572, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7704:31:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$", + "typeString": "tuple(bool,bytes memory)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "7685:50:22" + }, + { + "expression": { + "arguments": [ + { + "id": 8575, + "name": "success", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8565, + "src": "7753:7:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "455448207472616e73666572206661696c6564", + "id": 8576, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7762:21:22", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_c7c2be2f1b63a3793f6e2d447ce95ba2239687186a7fd6b5268a969dcdb42dcd", + "typeString": "literal_string \"ETH transfer failed\"" + }, + "value": "ETH transfer failed" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_c7c2be2f1b63a3793f6e2d447ce95ba2239687186a7fd6b5268a969dcdb42dcd", + "typeString": "literal_string \"ETH transfer failed\"" + } + ], + "id": 8574, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "7745:7:22", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 8577, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7745:39:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8578, + "nodeType": "ExpressionStatement", + "src": "7745:39:22" + }, + { + "eventCall": { + "arguments": [ + { + "id": 8580, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8559, + "src": "7812:6:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 8581, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 67, + "src": "7820:5:22", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_address_$", + "typeString": "function () view returns (address)" + } + }, + "id": 8582, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7820:7:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 8579, + "name": "ETHWithdrawn", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8204, + "src": "7799:12:22", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_uint256_$_t_address_$returns$__$", + "typeString": "function (uint256,address)" + } + }, + "id": 8583, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "7799:29:22", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 8584, + "nodeType": "EmitStatement", + "src": "7794:34:22" + } + ] + }, + "documentation": { + "id": 8557, + "nodeType": "StructuredDocumentation", + "src": "7428:157:22", + "text": " @notice Allows the owner to recover any native ETH held by this contract.\n @param amount The amount of ETH to transfer to the owner." + }, + "functionSelector": "f14210a6", + "id": 8586, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 8562, + "kind": "modifierInvocation", + "modifierName": { + "id": 8561, + "name": "onlyOwner", + "nameLocations": [ + "7665:9:22" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 58, + "src": "7665:9:22" + }, + "nodeType": "ModifierInvocation", + "src": "7665:9:22" + } + ], + "name": "withdrawETH", + "nameLocation": "7628:11:22", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8560, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8559, + "mutability": "mutable", + "name": "amount", + "nameLocation": "7648:6:22", + "nodeType": "VariableDeclaration", + "scope": 8586, + "src": "7640:14:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8558, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7640:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7639:16:22" + }, + "returnParameters": { + "id": 8563, + "nodeType": "ParameterList", + "parameters": [], + "src": "7675:0:22" + }, + "scope": 8603, + "src": "7619:216:22", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 8601, + "nodeType": "Block", + "src": "7997:56:22", + "statements": [ + { + "expression": { + "baseExpression": { + "baseExpression": { + "id": 8595, + "name": "usedPayloadNonces", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8153, + "src": "8014:17:22", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_mapping$_t_uint256_$_t_bool_$_$", + "typeString": "mapping(address => mapping(uint256 => bool))" + } + }, + "id": 8597, + "indexExpression": { + "id": 8596, + "name": "signer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8588, + "src": "8032:6:22", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8014:25:22", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_uint256_$_t_bool_$", + "typeString": "mapping(uint256 => bool)" + } + }, + "id": 8599, + "indexExpression": { + "id": 8598, + "name": "nonce", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8590, + "src": "8040:5:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8014:32:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 8594, + "id": 8600, + "nodeType": "Return", + "src": "8007:39:22" + } + ] + }, + "functionSelector": "dcb79457", + "id": 8602, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "isExecutionCompleted", + "nameLocation": "7916:20:22", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 8591, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8588, + "mutability": "mutable", + "name": "signer", + "nameLocation": "7945:6:22", + "nodeType": "VariableDeclaration", + "scope": 8602, + "src": "7937:14:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 8587, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "7937:7:22", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 8590, + "mutability": "mutable", + "name": "nonce", + "nameLocation": "7961:5:22", + "nodeType": "VariableDeclaration", + "scope": 8602, + "src": "7953:13:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 8589, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7953:7:22", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7936:31:22" + }, + "returnParameters": { + "id": 8594, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 8593, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 8602, + "src": "7991:4:22", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 8592, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "7991:4:22", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "7990:6:22" + }, + "scope": 8603, + "src": "7907:146:22", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + } + ], + "scope": 8604, + "src": "1158:6897:22", + "usedErrors": [ + 13, + 18, + 388, + 1734, + 1841, + 1843, + 3689, + 3694, + 3699 + ], + "usedEvents": [ + 24, + 242, + 8190, + 8198, + 8204 + ] + } + ], + "src": "32:8024:22" + }, + "id": 22 + } + }, + "contracts": { + "@openzeppelin/contracts/access/Ownable.sol": { + "Ownable": { + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnableInvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "OwnableUnauthorizedAccount", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "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" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "methodIdentifiers": { + "owner()": "8da5cb5b", + "renounceOwnership()": "715018a6", + "transferOwnership(address)": "f2fde38b" + } + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"OwnableInvalidOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"OwnableUnauthorizedAccount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"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\"}],\"devdoc\":{\"details\":\"Contract module which provides a basic access control mechanism, where there is an account (an owner) that can be granted exclusive access to specific functions. The initial owner is set to the address provided by the deployer. This can later be changed with {transferOwnership}. This module is used through inheritance. It will make available the modifier `onlyOwner`, which can be applied to your functions to restrict their use to the owner.\",\"errors\":{\"OwnableInvalidOwner(address)\":[{\"details\":\"The owner is not a valid owner account. (eg. `address(0)`)\"}],\"OwnableUnauthorizedAccount(address)\":[{\"details\":\"The caller account is not authorized to perform an operation.\"}]},\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the contract setting the address provided by the deployer as the initial owner.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"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\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/access/Ownable.sol\":\"Ownable\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"keccak256\":\"0xff6d0bb2e285473e5311d9d3caacb525ae3538a80758c10649a4d61029b017bb\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8ed324d3920bb545059d66ab97d43e43ee85fd3bd52e03e401f020afb0b120f6\",\"dweb:/ipfs/QmfEckWLmZkDDcoWrkEvMWhms66xwTLff9DDhegYpvHo1a\"]},\"@openzeppelin/contracts/utils/Context.sol\":{\"keccak256\":\"0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6a708e8a5bdb1011c2c381c9a5cfd8a9a956d7d0a9dc1bd8bcdaf52f76ef2f12\",\"dweb:/ipfs/Qmax9WHBnVsZP46ZxEMNRQpLQnrdE4dK8LehML1Py8FowF\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/interfaces/IERC1363.sol": { + "IERC1363": { + "abi": [ + { + "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": 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": "value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "approveAndCall", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "approveAndCall", + "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": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "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": "value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "transferAndCall", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "transferAndCall", + "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": "value", + "type": "uint256" + } + ], + "name": "transferFrom", + "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": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "transferFromAndCall", + "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": "value", + "type": "uint256" + } + ], + "name": "transferFromAndCall", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "methodIdentifiers": { + "allowance(address,address)": "dd62ed3e", + "approve(address,uint256)": "095ea7b3", + "approveAndCall(address,uint256)": "3177029f", + "approveAndCall(address,uint256,bytes)": "cae9ca51", + "balanceOf(address)": "70a08231", + "supportsInterface(bytes4)": "01ffc9a7", + "totalSupply()": "18160ddd", + "transfer(address,uint256)": "a9059cbb", + "transferAndCall(address,uint256)": "1296ee62", + "transferAndCall(address,uint256,bytes)": "4000aea0", + "transferFrom(address,address,uint256)": "23b872dd", + "transferFromAndCall(address,address,uint256)": "d8fbe994", + "transferFromAndCall(address,address,uint256,bytes)": "c1d34b89" + } + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"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\":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\":\"value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"approveAndCall\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"approveAndCall\",\"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\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"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\":\"value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"transferAndCall\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"transferAndCall\",\"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\":\"value\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"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\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"transferFromAndCall\",\"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\":\"value\",\"type\":\"uint256\"}],\"name\":\"transferFromAndCall\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363]. Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.\",\"events\":{\"Approval(address,address,uint256)\":{\"details\":\"Emitted when the allowance of a `spender` for an `owner` is set by a call to {approve}. `value` is the new allowance.\"},\"Transfer(address,address,uint256)\":{\"details\":\"Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero.\"}},\"kind\":\"dev\",\"methods\":{\"allowance(address,address)\":{\"details\":\"Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called.\"},\"approve(address,uint256)\":{\"details\":\"Sets a `value` amount of tokens as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {Approval} event.\"},\"approveAndCall(address,uint256)\":{\"details\":\"Sets a `value` amount of tokens as the allowance of `spender` over the caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\",\"params\":{\"spender\":\"The address which will spend the funds.\",\"value\":\"The amount of tokens to be spent.\"},\"returns\":{\"_0\":\"A boolean value indicating whether the operation succeeded unless throwing.\"}},\"approveAndCall(address,uint256,bytes)\":{\"details\":\"Sets a `value` amount of tokens as the allowance of `spender` over the caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\",\"params\":{\"data\":\"Additional data with no specified format, sent in call to `spender`.\",\"spender\":\"The address which will spend the funds.\",\"value\":\"The amount of tokens to be spent.\"},\"returns\":{\"_0\":\"A boolean value indicating whether the operation succeeded unless throwing.\"}},\"balanceOf(address)\":{\"details\":\"Returns the value of tokens owned by `account`.\"},\"supportsInterface(bytes4)\":{\"details\":\"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section] to learn more about how these ids are created. This function call must use less than 30 000 gas.\"},\"totalSupply()\":{\"details\":\"Returns the value of tokens in existence.\"},\"transfer(address,uint256)\":{\"details\":\"Moves a `value` amount of tokens from the caller's account to `to`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.\"},\"transferAndCall(address,uint256)\":{\"details\":\"Moves a `value` amount of tokens from the caller's account to `to` and then calls {IERC1363Receiver-onTransferReceived} on `to`.\",\"params\":{\"to\":\"The address which you want to transfer to.\",\"value\":\"The amount of tokens to be transferred.\"},\"returns\":{\"_0\":\"A boolean value indicating whether the operation succeeded unless throwing.\"}},\"transferAndCall(address,uint256,bytes)\":{\"details\":\"Moves a `value` amount of tokens from the caller's account to `to` and then calls {IERC1363Receiver-onTransferReceived} on `to`.\",\"params\":{\"data\":\"Additional data with no specified format, sent in call to `to`.\",\"to\":\"The address which you want to transfer to.\",\"value\":\"The amount of tokens to be transferred.\"},\"returns\":{\"_0\":\"A boolean value indicating whether the operation succeeded unless throwing.\"}},\"transferFrom(address,address,uint256)\":{\"details\":\"Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism. `value` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.\"},\"transferFromAndCall(address,address,uint256)\":{\"details\":\"Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism and then calls {IERC1363Receiver-onTransferReceived} on `to`.\",\"params\":{\"from\":\"The address which you want to send tokens from.\",\"to\":\"The address which you want to transfer to.\",\"value\":\"The amount of tokens to be transferred.\"},\"returns\":{\"_0\":\"A boolean value indicating whether the operation succeeded unless throwing.\"}},\"transferFromAndCall(address,address,uint256,bytes)\":{\"details\":\"Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism and then calls {IERC1363Receiver-onTransferReceived} on `to`.\",\"params\":{\"data\":\"Additional data with no specified format, sent in call to `to`.\",\"from\":\"The address which you want to send tokens from.\",\"to\":\"The address which you want to transfer to.\",\"value\":\"The amount of tokens to be transferred.\"},\"returns\":{\"_0\":\"A boolean value indicating whether the operation succeeded unless throwing.\"}}},\"title\":\"IERC1363\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/interfaces/IERC1363.sol\":\"IERC1363\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/IERC1363.sol\":{\"keccak256\":\"0xd5ea07362ab630a6a3dee4285a74cf2377044ca2e4be472755ad64d7c5d4b69d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://da5e832b40fc5c3145d3781e2e5fa60ac2052c9d08af7e300dc8ab80c4343100\",\"dweb:/ipfs/QmTzf7N5ZUdh5raqtzbM11yexiUoLC9z3Ws632MCuycq1d\"]},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"keccak256\":\"0x0afcb7e740d1537b252cb2676f600465ce6938398569f09ba1b9ca240dde2dfc\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1c299900ac4ec268d4570ecef0d697a3013cd11a6eb74e295ee3fbc945056037\",\"dweb:/ipfs/Qmab9owJoxcA7vJT5XNayCMaUR1qxqj1NDzzisduwaJMcZ\"]},\"@openzeppelin/contracts/interfaces/IERC20.sol\":{\"keccak256\":\"0x1a6221315ce0307746c2c4827c125d821ee796c74a676787762f4778671d4f44\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1bb2332a7ee26dd0b0de9b7fe266749f54820c99ab6a3bcb6f7e6b751d47ee2d\",\"dweb:/ipfs/QmcRWpaBeCYkhy68PR3B4AgD7asuQk7PwkWxrvJbZcikLF\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x74ed01eb66b923d0d0cfe3be84604ac04b76482a55f9dd655e1ef4d367f95bc2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5282825a626cfe924e504274b864a652b0023591fa66f06a067b25b51ba9b303\",\"dweb:/ipfs/QmeCfPykghhMc81VJTrHTC7sF6CRvaA1FXVq2pJhwYp1dV\"]},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x8891738ffe910f0cf2da09566928589bf5d63f4524dd734fd9cedbac3274dd5c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://971f954442df5c2ef5b5ebf1eb245d7105d9fbacc7386ee5c796df1d45b21617\",\"dweb:/ipfs/QmadRjHbkicwqwwh61raUEapaVEtaLMcYbQZWs9gUkgj3u\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/interfaces/IERC5267.sol": { + "IERC5267": { + "abi": [ + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "methodIdentifiers": { + "eip712Domain()": "84b0196e" + } + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[],\"name\":\"EIP712DomainChanged\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"eip712Domain\",\"outputs\":[{\"internalType\":\"bytes1\",\"name\":\"fields\",\"type\":\"bytes1\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"verifyingContract\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"extensions\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"EIP712DomainChanged()\":{\"details\":\"MAY be emitted to signal that the domain could have changed.\"}},\"kind\":\"dev\",\"methods\":{\"eip712Domain()\":{\"details\":\"returns the fields and values that describe the domain separator used by this contract for EIP-712 signature.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/interfaces/IERC5267.sol\":\"IERC5267\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/IERC5267.sol\":{\"keccak256\":\"0xfb223a85dd0b2175cfbbaa325a744e2cd74ecd17c3df2b77b0722f991d2725ee\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://84bf1dea0589ec49c8d15d559cc6d86ee493048a89b2d4adb60fbe705a3d89ae\",\"dweb:/ipfs/Qmd56n556d529wk2pRMhYhm5nhMDhviwereodDikjs68w1\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "IERC20": { + "abi": [ + { + "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": 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": "value", + "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": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "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": "value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "methodIdentifiers": { + "allowance(address,address)": "dd62ed3e", + "approve(address,uint256)": "095ea7b3", + "balanceOf(address)": "70a08231", + "totalSupply()": "18160ddd", + "transfer(address,uint256)": "a9059cbb", + "transferFrom(address,address,uint256)": "23b872dd" + } + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"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\":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\":\"value\",\"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\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"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\":\"value\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Interface of the ERC-20 standard as defined in the ERC.\",\"events\":{\"Approval(address,address,uint256)\":{\"details\":\"Emitted when the allowance of a `spender` for an `owner` is set by a call to {approve}. `value` is the new allowance.\"},\"Transfer(address,address,uint256)\":{\"details\":\"Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero.\"}},\"kind\":\"dev\",\"methods\":{\"allowance(address,address)\":{\"details\":\"Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called.\"},\"approve(address,uint256)\":{\"details\":\"Sets a `value` amount of tokens as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {Approval} event.\"},\"balanceOf(address)\":{\"details\":\"Returns the value of tokens owned by `account`.\"},\"totalSupply()\":{\"details\":\"Returns the value of tokens in existence.\"},\"transfer(address,uint256)\":{\"details\":\"Moves a `value` amount of tokens from the caller's account to `to`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism. `value` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":\"IERC20\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x74ed01eb66b923d0d0cfe3be84604ac04b76482a55f9dd655e1ef4d367f95bc2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5282825a626cfe924e504274b864a652b0023591fa66f06a067b25b51ba9b303\",\"dweb:/ipfs/QmeCfPykghhMc81VJTrHTC7sF6CRvaA1FXVq2pJhwYp1dV\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": { + "IERC20Permit": { + "abi": [ + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "methodIdentifiers": { + "DOMAIN_SEPARATOR()": "3644e515", + "nonces(address)": "7ecebe00", + "permit(address,address,uint256,uint256,uint8,bytes32,bytes32)": "d505accf" + } + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"DOMAIN_SEPARATOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"nonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"permit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Interface of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in https://eips.ethereum.org/EIPS/eip-2612[ERC-2612]. Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't need to send a transaction, and thus is not required to hold Ether at all. ==== Security Considerations There are two important considerations concerning the use of `permit`. The first is that a valid permit signature expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be considered as an intention to spend the allowance in any specific way. The second is that because permits have built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be generally recommended is: ```solidity function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} doThing(..., value); } function doThing(..., uint256 value) public { token.safeTransferFrom(msg.sender, address(this), value); ... } ``` Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also {SafeERC20-safeTransferFrom}). Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so contracts should have entry points that don't rely on permit.\",\"kind\":\"dev\",\"methods\":{\"DOMAIN_SEPARATOR()\":{\"details\":\"Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\"},\"nonces(address)\":{\"details\":\"Returns the current nonce for `owner`. This value must be included whenever a signature is generated for {permit}. Every successful call to {permit} increases ``owner``'s nonce by one. This prevents a signature from being used multiple times.\"},\"permit(address,address,uint256,uint256,uint8,bytes32,bytes32)\":{\"details\":\"Sets `value` as the allowance of `spender` over ``owner``'s tokens, given ``owner``'s signed approval. IMPORTANT: The same issues {IERC20-approve} has related to transaction ordering also applies here. Emits an {Approval} event. Requirements: - `spender` cannot be the zero address. - `deadline` must be a timestamp in the future. - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` over the EIP712-formatted function arguments. - the signature must use ``owner``'s current nonce (see {nonces}). For more information on the signature format, see the https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP section]. CAUTION: See Security Considerations above.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\":\"IERC20Permit\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\":{\"keccak256\":\"0x53befc41288eaa87edcd3a7be7e8475a32e44c6a29f9bf52fae789781301d9ff\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a1d7fab53c4ceaf42391b83d9b36d7e9cc524a8da125cffdcd32c56560f9d1c9\",\"dweb:/ipfs/QmaRZdVhQdqNXofeimibkBG65q9GVcXVZEGpycwwX3znC6\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "SafeERC20": { + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "currentAllowance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestedDecrease", + "type": "uint256" + } + ], + "name": "SafeERC20FailedDecreaseAllowance", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "SafeERC20FailedOperation", + "type": "error" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212205c28a953d80cbde5965c90d7d69e4200c2946ffa7d85a8c75c36f5291a6d6e6464736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 TLOAD 0x28 0xA9 MSTORE8 0xD8 0xC 0xBD 0xE5 SWAP7 TLOAD SWAP1 0xD7 0xD6 SWAP15 TIMESTAMP STOP 0xC2 SWAP5 PUSH16 0xFA7D85A8C75C36F5291A6D6E6464736F PUSH13 0x634300081C0033000000000000 ", + "sourceMap": "698:12615:7:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;698:12615:7;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212205c28a953d80cbde5965c90d7d69e4200c2946ffa7d85a8c75c36f5291a6d6e6464736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 TLOAD 0x28 0xA9 MSTORE8 0xD8 0xC 0xBD 0xE5 SWAP7 TLOAD SWAP1 0xD7 0xD6 SWAP15 TIMESTAMP STOP 0xC2 SWAP5 PUSH16 0xFA7D85A8C75C36F5291A6D6E6464736F PUSH13 0x634300081C0033000000000000 ", + "sourceMap": "698:12615:7:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"currentAllowance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestedDecrease\",\"type\":\"uint256\"}],\"name\":\"SafeERC20FailedDecreaseAllowance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"SafeERC20FailedOperation\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"Wrappers around ERC-20 operations that throw on failure (when the token contract returns false). Tokens that return no value (and instead revert or throw on failure) are also supported, non-reverting calls are assumed to be successful. To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\",\"errors\":{\"SafeERC20FailedDecreaseAllowance(address,uint256,uint256)\":[{\"details\":\"Indicates a failed `decreaseAllowance` request.\"}],\"SafeERC20FailedOperation(address)\":[{\"details\":\"An operation with an ERC-20 token failed.\"}]},\"kind\":\"dev\",\"methods\":{},\"title\":\"SafeERC20\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":\"SafeERC20\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/IERC1363.sol\":{\"keccak256\":\"0xd5ea07362ab630a6a3dee4285a74cf2377044ca2e4be472755ad64d7c5d4b69d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://da5e832b40fc5c3145d3781e2e5fa60ac2052c9d08af7e300dc8ab80c4343100\",\"dweb:/ipfs/QmTzf7N5ZUdh5raqtzbM11yexiUoLC9z3Ws632MCuycq1d\"]},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"keccak256\":\"0x0afcb7e740d1537b252cb2676f600465ce6938398569f09ba1b9ca240dde2dfc\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1c299900ac4ec268d4570ecef0d697a3013cd11a6eb74e295ee3fbc945056037\",\"dweb:/ipfs/Qmab9owJoxcA7vJT5XNayCMaUR1qxqj1NDzzisduwaJMcZ\"]},\"@openzeppelin/contracts/interfaces/IERC20.sol\":{\"keccak256\":\"0x1a6221315ce0307746c2c4827c125d821ee796c74a676787762f4778671d4f44\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1bb2332a7ee26dd0b0de9b7fe266749f54820c99ab6a3bcb6f7e6b751d47ee2d\",\"dweb:/ipfs/QmcRWpaBeCYkhy68PR3B4AgD7asuQk7PwkWxrvJbZcikLF\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x74ed01eb66b923d0d0cfe3be84604ac04b76482a55f9dd655e1ef4d367f95bc2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5282825a626cfe924e504274b864a652b0023591fa66f06a067b25b51ba9b303\",\"dweb:/ipfs/QmeCfPykghhMc81VJTrHTC7sF6CRvaA1FXVq2pJhwYp1dV\"]},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"keccak256\":\"0x304d732678032a9781ae85c8f204c8fba3d3a5e31c02616964e75cfdc5049098\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://299ced486011781dc98f638059678323c03079fefae1482abaa2135b22fa92d0\",\"dweb:/ipfs/QmbZNbcPTBxNvwChavN2kkZZs7xHhYL7mv51KrxMhsMs3j\"]},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x8891738ffe910f0cf2da09566928589bf5d63f4524dd734fd9cedbac3274dd5c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://971f954442df5c2ef5b5ebf1eb245d7105d9fbacc7386ee5c796df1d45b21617\",\"dweb:/ipfs/QmadRjHbkicwqwwh61raUEapaVEtaLMcYbQZWs9gUkgj3u\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/Bytes.sol": { + "Bytes": { + "abi": [], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea2646970667358221220072fadf3f16461513580a2d3f78bb66cb36505b035a64cbbe629d90098ae436d64736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 SMOD 0x2F 0xAD RETURN CALL PUSH5 0x61513580A2 0xD3 0xF7 DUP12 0xB6 PUSH13 0xB36505B035A64CBBE629D90098 0xAE NUMBER PUSH14 0x64736F6C634300081C0033000000 ", + "sourceMap": "198:14538:8:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;198:14538:8;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea2646970667358221220072fadf3f16461513580a2d3f78bb66cb36505b035a64cbbe629d90098ae436d64736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 SMOD 0x2F 0xAD RETURN CALL PUSH5 0x61513580A2 0xD3 0xF7 DUP12 0xB6 PUSH13 0xB36505B035A64CBBE629D90098 0xAE NUMBER PUSH14 0x64736F6C634300081C0033000000 ", + "sourceMap": "198:14538:8:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Bytes operations.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/Bytes.sol\":\"Bytes\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Bytes.sol\":{\"keccak256\":\"0xf80e4b96b6849936ea0fabd76cf81b13d7276295fddb1e1c07afb3ddf650b0ac\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6430007255ac11c6e9c4331a418f3af52ff66fbbae959f645301d025b20aeb08\",\"dweb:/ipfs/QmQE5fjmBBRw9ndnzJuC2uskYss1gbaR7JdazoCf1FGoBj\"]},\"@openzeppelin/contracts/utils/Panic.sol\":{\"keccak256\":\"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c6a5ff4f9fd8649b7ee20800b7fa387d3465bd77cf20c2d1068cd5c98e1ed57a\",\"dweb:/ipfs/QmVSaVJf9FXFhdYEYeCEfjMVHrxDh5qL4CGkxdMWpQCrqG\"]},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"keccak256\":\"0x59973a93b1f983f94e10529f46ca46544a9fec2b5f56fb1390bbe9e0dc79f857\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c55ef8f0b9719790c2ae6f81d80a59ffb89f2f0abe6bc065585bd79edce058c5\",\"dweb:/ipfs/QmNNmCbX9NjPXKqHJN8R1WC2rNeZSQrPZLd6FF6AKLyH5Y\"]},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"keccak256\":\"0xc8cae21c9ae4a46e5162ff9bf5b351d6fa6a6eba72d515f3bc1bdfeda7fdf083\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce830ebcf28e31643caba318996db3763c36d52cd0f23798ba83c135355d45e9\",\"dweb:/ipfs/QmdGPcvptHN7UBCbUYBbRX3hiRVRFLRwno8b4uga6uFNif\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/Context.sol": { + "Context": { + "abi": [], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Provides information about the current execution context, including the sender of the transaction and its data. While these are generally available via msg.sender and msg.data, they should not be accessed in such a direct manner, since when dealing with meta-transactions the account sending and paying for execution may not be the actual sender (as far as an application is concerned). This contract is only required for intermediate, library-like contracts.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/Context.sol\":\"Context\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Context.sol\":{\"keccak256\":\"0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6a708e8a5bdb1011c2c381c9a5cfd8a9a956d7d0a9dc1bd8bcdaf52f76ef2f12\",\"dweb:/ipfs/Qmax9WHBnVsZP46ZxEMNRQpLQnrdE4dK8LehML1Py8FowF\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/Panic.sol": { + "Panic": { + "abi": [], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea2646970667358221220cca8e34ba4a10a3072e457ee409c3e14973552ffad66786674cea596605f229764736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xCC 0xA8 0xE3 0x4B LOG4 LOG1 EXP ADDRESS PUSH19 0xE457EE409C3E14973552FFAD66786674CEA596 PUSH1 0x5F 0x22 SWAP8 PUSH5 0x736F6C6343 STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "657:1315:10:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;657:1315:10;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea2646970667358221220cca8e34ba4a10a3072e457ee409c3e14973552ffad66786674cea596605f229764736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xCC 0xA8 0xE3 0x4B LOG4 LOG1 EXP ADDRESS PUSH19 0xE457EE409C3E14973552FFAD66786674CEA596 PUSH1 0x5F 0x22 SWAP8 PUSH5 0x736F6C6343 STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "657:1315:10:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Helper library for emitting standardized panic codes. ```solidity contract Example { using Panic for uint256; // Use any of the declared internal constants function foo() { Panic.GENERIC.panic(); } // Alternatively function foo() { Panic.panic(Panic.GENERIC); } } ``` Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil]. _Available since v5.1._\",\"kind\":\"dev\",\"methods\":{},\"stateVariables\":{\"ARRAY_OUT_OF_BOUNDS\":{\"details\":\"array out of bounds access\"},\"ASSERT\":{\"details\":\"used by the assert() builtin\"},\"DIVISION_BY_ZERO\":{\"details\":\"division or modulo by zero\"},\"EMPTY_ARRAY_POP\":{\"details\":\"empty array pop\"},\"ENUM_CONVERSION_ERROR\":{\"details\":\"enum conversion error\"},\"GENERIC\":{\"details\":\"generic / unspecified error\"},\"INVALID_INTERNAL_FUNCTION\":{\"details\":\"calling invalid internal function\"},\"RESOURCE_ERROR\":{\"details\":\"resource error (too large allocation or too large array)\"},\"STORAGE_ENCODING_ERROR\":{\"details\":\"invalid encoding in storage\"},\"UNDER_OVERFLOW\":{\"details\":\"arithmetic underflow or overflow\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/Panic.sol\":\"Panic\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Panic.sol\":{\"keccak256\":\"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c6a5ff4f9fd8649b7ee20800b7fa387d3465bd77cf20c2d1068cd5c98e1ed57a\",\"dweb:/ipfs/QmVSaVJf9FXFhdYEYeCEfjMVHrxDh5qL4CGkxdMWpQCrqG\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/ReentrancyGuard.sol": { + "ReentrancyGuard": { + "abi": [ + { + "inputs": [], + "name": "ReentrancyGuardReentrantCall", + "type": "error" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"ReentrancyGuardReentrantCall\",\"type\":\"error\"}],\"devdoc\":{\"custom:stateless\":\"\",\"details\":\"Contract module that helps prevent reentrant calls to a function. Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier available, which can be applied to functions to make sure there are no nested (reentrant) calls to them. Note that because there is a single `nonReentrant` guard, functions marked as `nonReentrant` may not call one another. This can be worked around by making those functions `private`, and then adding `external` `nonReentrant` entry points to them. TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at, consider using {ReentrancyGuardTransient} instead. TIP: If you would like to learn more about reentrancy and alternative ways to protect against it, check out our blog post https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. IMPORTANT: Deprecated. This storage-based reentrancy guard will be removed and replaced by the {ReentrancyGuardTransient} variant in v6.0.\",\"errors\":{\"ReentrancyGuardReentrantCall()\":[{\"details\":\"Unauthorized reentrant call.\"}]},\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/ReentrancyGuard.sol\":\"ReentrancyGuard\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/ReentrancyGuard.sol\":{\"keccak256\":\"0xa516cbf1c7d15d3517c2d668601ce016c54395bf5171918a14e2686977465f53\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1e1d079e8edfb58efd23a311e315a4807b01b5d1cf153f8fa2d0608b9dec3e99\",\"dweb:/ipfs/QmTBExeX2SDTkn5xbk5ssbYSx7VqRp9H4Ux1CY4uQM4b9N\"]},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"keccak256\":\"0xcf74f855663ce2ae00ed8352666b7935f6cddea2932fdf2c3ecd30a9b1cd0e97\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9f660b1f351b757dfe01438e59888f31f33ded3afcf5cb5b0d9bf9aa6f320a8b\",\"dweb:/ipfs/QmarDJ5hZEgBtCmmrVzEZWjub9769eD686jmzb2XpSU1cM\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/ShortStrings.sol": { + "ShortStrings": { + "abi": [ + { + "inputs": [], + "name": "InvalidShortString", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "str", + "type": "string" + } + ], + "name": "StringTooLong", + "type": "error" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212205331629f8f9bf0cbfbabc3d9173056cd00dba4e3cc0330036bc4382e2359a42464736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 MSTORE8 BALANCE PUSH3 0x9F8F9B CREATE 0xCB 0xFB 0xAB 0xC3 0xD9 OR ADDRESS JUMP 0xCD STOP 0xDB LOG4 0xE3 0xCC SUB ADDRESS SUB PUSH12 0xC4382E2359A42464736F6C63 NUMBER STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "1255:3054:12:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;1255:3054:12;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212205331629f8f9bf0cbfbabc3d9173056cd00dba4e3cc0330036bc4382e2359a42464736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 MSTORE8 BALANCE PUSH3 0x9F8F9B CREATE 0xCB 0xFB 0xAB 0xC3 0xD9 OR ADDRESS JUMP 0xCD STOP 0xDB LOG4 0xE3 0xCC SUB ADDRESS SUB PUSH12 0xC4382E2359A42464736F6C63 NUMBER STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "1255:3054:12:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"InvalidShortString\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"str\",\"type\":\"string\"}],\"name\":\"StringTooLong\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"This library provides functions to convert short memory strings into a `ShortString` type that can be used as an immutable variable. Strings of arbitrary length can be optimized using this library if they are short enough (up to 31 bytes) by packing them with their length (1 byte) in a single EVM word (32 bytes). Additionally, a fallback mechanism can be used for every other case. Usage example: ```solidity contract Named { using ShortStrings for *; ShortString private immutable _name; string private _nameFallback; constructor(string memory contractName) { _name = contractName.toShortStringWithFallback(_nameFallback); } function name() external view returns (string memory) { return _name.toStringWithFallback(_nameFallback); } } ```\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/ShortStrings.sol\":\"ShortStrings\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/ShortStrings.sol\":{\"keccak256\":\"0x0768b3bdb701fe4994b3be932ca8635551dfebe04c645f77500322741bebf57c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a2059f9ca8d3c11c49ca49fc9c5fb070f18cc85d12a7688e45322ed0e2a1cb99\",\"dweb:/ipfs/QmS2gwX51RAvSw4tYbjHccY2CKbh2uvDzqHLAFXdsddgia\"]},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"keccak256\":\"0xcf74f855663ce2ae00ed8352666b7935f6cddea2932fdf2c3ecd30a9b1cd0e97\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9f660b1f351b757dfe01438e59888f31f33ded3afcf5cb5b0d9bf9aa6f320a8b\",\"dweb:/ipfs/QmarDJ5hZEgBtCmmrVzEZWjub9769eD686jmzb2XpSU1cM\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "StorageSlot": { + "abi": [], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212202e11909616c8a357ae57cd11f3e744f7b7de3a3174b44a2b6467fa9904f2585764736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0x2E GT SWAP1 SWAP7 AND 0xC8 LOG3 JUMPI 0xAE JUMPI 0xCD GT RETURN 0xE7 PREVRANDAO 0xF7 0xB7 0xDE GASPRICE BALANCE PUSH21 0xB44A2B6467FA9904F2585764736F6C634300081C00 CALLER ", + "sourceMap": "1407:2774:13:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;1407:2774:13;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212202e11909616c8a357ae57cd11f3e744f7b7de3a3174b44a2b6467fa9904f2585764736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0x2E GT SWAP1 SWAP7 AND 0xC8 LOG3 JUMPI 0xAE JUMPI 0xCD GT RETURN 0xE7 PREVRANDAO 0xF7 0xB7 0xDE GASPRICE BALANCE PUSH21 0xB44A2B6467FA9904F2585764736F6C634300081C00 CALLER ", + "sourceMap": "1407:2774:13:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Library for reading and writing primitive types to specific storage slots. Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. This library helps with reading and writing to such slots without the need for inline assembly. The functions in this library return Slot structs that contain a `value` member that can be used to read or write. Example usage to set ERC-1967 implementation slot: ```solidity contract ERC1967 { // Define the slot. Alternatively, use the SlotDerivation library to derive the slot. bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; function _getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; } function _setImplementation(address newImplementation) internal { require(newImplementation.code.length > 0); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } } ``` TIP: Consider using this library along with {SlotDerivation}.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/StorageSlot.sol\":\"StorageSlot\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"keccak256\":\"0xcf74f855663ce2ae00ed8352666b7935f6cddea2932fdf2c3ecd30a9b1cd0e97\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9f660b1f351b757dfe01438e59888f31f33ded3afcf5cb5b0d9bf9aa6f320a8b\",\"dweb:/ipfs/QmarDJ5hZEgBtCmmrVzEZWjub9769eD686jmzb2XpSU1cM\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "Strings": { + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "length", + "type": "uint256" + } + ], + "name": "StringsInsufficientHexLength", + "type": "error" + }, + { + "inputs": [], + "name": "StringsInvalidAddressFormat", + "type": "error" + }, + { + "inputs": [], + "name": "StringsInvalidChar", + "type": "error" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea2646970667358221220172eadb738f4060c9567e763c4ffa1f0bf958b6bde49f20427622bab52603b4264736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 OR 0x2E 0xAD 0xB7 CODESIZE DELEGATECALL MOD 0xC SWAP6 PUSH8 0xE763C4FFA1F0BF95 DUP12 PUSH12 0xDE49F20427622BAB52603B42 PUSH5 0x736F6C6343 STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "332:21205:14:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;332:21205:14;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea2646970667358221220172eadb738f4060c9567e763c4ffa1f0bf958b6bde49f20427622bab52603b4264736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 OR 0x2E 0xAD 0xB7 CODESIZE DELEGATECALL MOD 0xC SWAP6 PUSH8 0xE763C4FFA1F0BF95 DUP12 PUSH12 0xDE49F20427622BAB52603B42 PUSH5 0x736F6C6343 STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "332:21205:14:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"length\",\"type\":\"uint256\"}],\"name\":\"StringsInsufficientHexLength\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StringsInvalidAddressFormat\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StringsInvalidChar\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"String operations.\",\"errors\":{\"StringsInsufficientHexLength(uint256,uint256)\":[{\"details\":\"The `value` string doesn't fit in the specified `length`.\"}],\"StringsInvalidAddressFormat()\":[{\"details\":\"The string being parsed is not a properly formatted address.\"}],\"StringsInvalidChar()\":[{\"details\":\"The string being parsed contains characters that are not in scope of the given base.\"}]},\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/Strings.sol\":\"Strings\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Bytes.sol\":{\"keccak256\":\"0xf80e4b96b6849936ea0fabd76cf81b13d7276295fddb1e1c07afb3ddf650b0ac\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6430007255ac11c6e9c4331a418f3af52ff66fbbae959f645301d025b20aeb08\",\"dweb:/ipfs/QmQE5fjmBBRw9ndnzJuC2uskYss1gbaR7JdazoCf1FGoBj\"]},\"@openzeppelin/contracts/utils/Panic.sol\":{\"keccak256\":\"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c6a5ff4f9fd8649b7ee20800b7fa387d3465bd77cf20c2d1068cd5c98e1ed57a\",\"dweb:/ipfs/QmVSaVJf9FXFhdYEYeCEfjMVHrxDh5qL4CGkxdMWpQCrqG\"]},\"@openzeppelin/contracts/utils/Strings.sol\":{\"keccak256\":\"0x1fdc2de9585ab0f1c417f02a873a2b6343cd64bb7ffec6b00ffa11a4a158d9e8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1ab223a3d969c6cd7610049431dd42740960c477e45878f5d8b54411f7a32bdc\",\"dweb:/ipfs/QmWumhjvhpKcwx3vDPQninsNVTc3BGvqaihkQakFkQYpaS\"]},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"keccak256\":\"0x59973a93b1f983f94e10529f46ca46544a9fec2b5f56fb1390bbe9e0dc79f857\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c55ef8f0b9719790c2ae6f81d80a59ffb89f2f0abe6bc065585bd79edce058c5\",\"dweb:/ipfs/QmNNmCbX9NjPXKqHJN8R1WC2rNeZSQrPZLd6FF6AKLyH5Y\"]},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"keccak256\":\"0xc8cae21c9ae4a46e5162ff9bf5b351d6fa6a6eba72d515f3bc1bdfeda7fdf083\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce830ebcf28e31643caba318996db3763c36d52cd0f23798ba83c135355d45e9\",\"dweb:/ipfs/QmdGPcvptHN7UBCbUYBbRX3hiRVRFLRwno8b4uga6uFNif\"]},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"keccak256\":\"0xb1970fac7b64e6c09611e6691791e848d5e3fe410fa5899e7df2e0afd77a99e3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://db5fbb3dddd8b7047465b62575d96231ba8a2774d37fb4737fbf23340fabbb03\",\"dweb:/ipfs/QmVUSvooZKEdEdap619tcJjTLcAuH6QBdZqAzWwnAXZAWJ\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "ECDSA": { + "abi": [ + { + "inputs": [], + "name": "ECDSAInvalidSignature", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "length", + "type": "uint256" + } + ], + "name": "ECDSAInvalidSignatureLength", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "ECDSAInvalidSignatureS", + "type": "error" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea2646970667358221220861fc53c54256420d26202ed953c1a6a70251bfd2cbefbfb0e98c93d2669cfb464736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 DUP7 0x1F 0xC5 EXTCODECOPY SLOAD 0x25 PUSH5 0x20D26202ED SWAP6 EXTCODECOPY BYTE PUSH11 0x70251BFD2CBEFBFB0E98C9 RETURNDATASIZE 0x26 PUSH10 0xCFB464736F6C63430008 SHR STOP CALLER ", + "sourceMap": "344:11807:15:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;344:11807:15;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea2646970667358221220861fc53c54256420d26202ed953c1a6a70251bfd2cbefbfb0e98c93d2669cfb464736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 DUP7 0x1F 0xC5 EXTCODECOPY SLOAD 0x25 PUSH5 0x20D26202ED SWAP6 EXTCODECOPY BYTE PUSH11 0x70251BFD2CBEFBFB0E98C9 RETURNDATASIZE 0x26 PUSH10 0xCFB464736F6C63430008 SHR STOP CALLER ", + "sourceMap": "344:11807:15:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"ECDSAInvalidSignature\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"length\",\"type\":\"uint256\"}],\"name\":\"ECDSAInvalidSignatureLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"ECDSAInvalidSignatureS\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"Elliptic Curve Digital Signature Algorithm (ECDSA) operations. These functions can be used to verify that a message was signed by the holder of the private keys of a given address.\",\"errors\":{\"ECDSAInvalidSignature()\":[{\"details\":\"The signature is invalid.\"}],\"ECDSAInvalidSignatureLength(uint256)\":[{\"details\":\"The signature has an invalid length.\"}],\"ECDSAInvalidSignatureS(bytes32)\":[{\"details\":\"The signature has an S value that is in the upper half order.\"}]},\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":\"ECDSA\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"keccak256\":\"0xbeb5cad8aaabe0d35d2ec1a8414d91e81e5a8ca679add4cf57e2f33476861f40\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ebb272a5ee2da4e8bd5551334e0ce8dce4e9c56a04570d6bf046d260fab3116a\",\"dweb:/ipfs/QmNw6RyM769qcqFocDq6HJMG2WiEnQbvizpRaUXsACHho2\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/cryptography/EIP712.sol": { + "EIP712": { + "abi": [ + { + "inputs": [], + "name": "InvalidShortString", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "str", + "type": "string" + } + ], + "name": "StringTooLong", + "type": "error" + }, + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "methodIdentifiers": { + "eip712Domain()": "84b0196e" + } + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"InvalidShortString\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"str\",\"type\":\"string\"}],\"name\":\"StringTooLong\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"EIP712DomainChanged\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"eip712Domain\",\"outputs\":[{\"internalType\":\"bytes1\",\"name\":\"fields\",\"type\":\"bytes1\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"verifyingContract\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"extensions\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"custom:oz-upgrades-unsafe-allow\":\"state-variable-immutable\",\"details\":\"https://eips.ethereum.org/EIPS/eip-712[EIP-712] is a standard for hashing and signing of typed structured data. The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to produce the hash of their typed data using a combination of `abi.encode` and `keccak256`. This contract implements the EIP-712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA ({_hashTypedDataV4}). The implementation of the domain separator was designed to be as efficient as possible while still properly updating the chain id to protect against replay attacks on an eventual fork of the chain. NOTE: This contract implements the version of the encoding known as \\\"v4\\\", as implemented by the JSON RPC method https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\",\"events\":{\"EIP712DomainChanged()\":{\"details\":\"MAY be emitted to signal that the domain could have changed.\"}},\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Initializes the domain separator and parameter caches. The meaning of `name` and `version` is specified in https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP-712]: - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. - `version`: the current major version of the signing domain. NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart contract upgrade].\"},\"eip712Domain()\":{\"details\":\"returns the fields and values that describe the domain separator used by this contract for EIP-712 signature.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/cryptography/EIP712.sol\":\"EIP712\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/IERC5267.sol\":{\"keccak256\":\"0xfb223a85dd0b2175cfbbaa325a744e2cd74ecd17c3df2b77b0722f991d2725ee\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://84bf1dea0589ec49c8d15d559cc6d86ee493048a89b2d4adb60fbe705a3d89ae\",\"dweb:/ipfs/Qmd56n556d529wk2pRMhYhm5nhMDhviwereodDikjs68w1\"]},\"@openzeppelin/contracts/utils/Bytes.sol\":{\"keccak256\":\"0xf80e4b96b6849936ea0fabd76cf81b13d7276295fddb1e1c07afb3ddf650b0ac\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6430007255ac11c6e9c4331a418f3af52ff66fbbae959f645301d025b20aeb08\",\"dweb:/ipfs/QmQE5fjmBBRw9ndnzJuC2uskYss1gbaR7JdazoCf1FGoBj\"]},\"@openzeppelin/contracts/utils/Panic.sol\":{\"keccak256\":\"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c6a5ff4f9fd8649b7ee20800b7fa387d3465bd77cf20c2d1068cd5c98e1ed57a\",\"dweb:/ipfs/QmVSaVJf9FXFhdYEYeCEfjMVHrxDh5qL4CGkxdMWpQCrqG\"]},\"@openzeppelin/contracts/utils/ShortStrings.sol\":{\"keccak256\":\"0x0768b3bdb701fe4994b3be932ca8635551dfebe04c645f77500322741bebf57c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a2059f9ca8d3c11c49ca49fc9c5fb070f18cc85d12a7688e45322ed0e2a1cb99\",\"dweb:/ipfs/QmS2gwX51RAvSw4tYbjHccY2CKbh2uvDzqHLAFXdsddgia\"]},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"keccak256\":\"0xcf74f855663ce2ae00ed8352666b7935f6cddea2932fdf2c3ecd30a9b1cd0e97\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9f660b1f351b757dfe01438e59888f31f33ded3afcf5cb5b0d9bf9aa6f320a8b\",\"dweb:/ipfs/QmarDJ5hZEgBtCmmrVzEZWjub9769eD686jmzb2XpSU1cM\"]},\"@openzeppelin/contracts/utils/Strings.sol\":{\"keccak256\":\"0x1fdc2de9585ab0f1c417f02a873a2b6343cd64bb7ffec6b00ffa11a4a158d9e8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1ab223a3d969c6cd7610049431dd42740960c477e45878f5d8b54411f7a32bdc\",\"dweb:/ipfs/QmWumhjvhpKcwx3vDPQninsNVTc3BGvqaihkQakFkQYpaS\"]},\"@openzeppelin/contracts/utils/cryptography/EIP712.sol\":{\"keccak256\":\"0x8440117ea216b97a7bad690a67449fd372c840d073c8375822667e14702782b4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ebb6645995b8290d0b9121825e2533e4e28977b2c6befee76e15e58f0feb61d4\",\"dweb:/ipfs/QmVR72j6kL5R2txuihieDev1FeTi4KWJS1Z6ABbwL3Qtph\"]},\"@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol\":{\"keccak256\":\"0x6d8579873b9650426bfbd2a754092d1725049ca05e4e3c8c2c82dd9f3453129d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1fa3127a8968d55096d37124a9e212013af112affa5e30b84a1d22263c31576c\",\"dweb:/ipfs/QmetxaVcn5Q6nkpF9yXzaxPQ7d3rgrhV13sTH9BgiuzGJL\"]},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"keccak256\":\"0x59973a93b1f983f94e10529f46ca46544a9fec2b5f56fb1390bbe9e0dc79f857\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c55ef8f0b9719790c2ae6f81d80a59ffb89f2f0abe6bc065585bd79edce058c5\",\"dweb:/ipfs/QmNNmCbX9NjPXKqHJN8R1WC2rNeZSQrPZLd6FF6AKLyH5Y\"]},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"keccak256\":\"0xc8cae21c9ae4a46e5162ff9bf5b351d6fa6a6eba72d515f3bc1bdfeda7fdf083\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce830ebcf28e31643caba318996db3763c36d52cd0f23798ba83c135355d45e9\",\"dweb:/ipfs/QmdGPcvptHN7UBCbUYBbRX3hiRVRFLRwno8b4uga6uFNif\"]},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"keccak256\":\"0xb1970fac7b64e6c09611e6691791e848d5e3fe410fa5899e7df2e0afd77a99e3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://db5fbb3dddd8b7047465b62575d96231ba8a2774d37fb4737fbf23340fabbb03\",\"dweb:/ipfs/QmVUSvooZKEdEdap619tcJjTLcAuH6QBdZqAzWwnAXZAWJ\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol": { + "MessageHashUtils": { + "abi": [ + { + "inputs": [], + "name": "ERC5267ExtensionsNotSupported", + "type": "error" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212206131ed8ee4dbbce47bcc4c6f88c9616eec0a3b2c76e6ecedd23ff36dd351a5da64736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 PUSH2 0x31ED DUP15 0xE4 0xDB 0xBC 0xE4 PUSH28 0xCC4C6F88C9616EEC0A3B2C76E6ECEDD23FF36DD351A5DA64736F6C63 NUMBER STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "521:8109:17:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;521:8109:17;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212206131ed8ee4dbbce47bcc4c6f88c9616eec0a3b2c76e6ecedd23ff36dd351a5da64736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 PUSH2 0x31ED DUP15 0xE4 0xDB 0xBC 0xE4 PUSH28 0xCC4C6F88C9616EEC0A3B2C76E6ECEDD23FF36DD351A5DA64736F6C63 NUMBER STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "521:8109:17:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"ERC5267ExtensionsNotSupported\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing. The library provides methods for generating a hash of a message that conforms to the https://eips.ethereum.org/EIPS/eip-191[ERC-191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712] specifications.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol\":\"MessageHashUtils\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Bytes.sol\":{\"keccak256\":\"0xf80e4b96b6849936ea0fabd76cf81b13d7276295fddb1e1c07afb3ddf650b0ac\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6430007255ac11c6e9c4331a418f3af52ff66fbbae959f645301d025b20aeb08\",\"dweb:/ipfs/QmQE5fjmBBRw9ndnzJuC2uskYss1gbaR7JdazoCf1FGoBj\"]},\"@openzeppelin/contracts/utils/Panic.sol\":{\"keccak256\":\"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c6a5ff4f9fd8649b7ee20800b7fa387d3465bd77cf20c2d1068cd5c98e1ed57a\",\"dweb:/ipfs/QmVSaVJf9FXFhdYEYeCEfjMVHrxDh5qL4CGkxdMWpQCrqG\"]},\"@openzeppelin/contracts/utils/Strings.sol\":{\"keccak256\":\"0x1fdc2de9585ab0f1c417f02a873a2b6343cd64bb7ffec6b00ffa11a4a158d9e8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1ab223a3d969c6cd7610049431dd42740960c477e45878f5d8b54411f7a32bdc\",\"dweb:/ipfs/QmWumhjvhpKcwx3vDPQninsNVTc3BGvqaihkQakFkQYpaS\"]},\"@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol\":{\"keccak256\":\"0x6d8579873b9650426bfbd2a754092d1725049ca05e4e3c8c2c82dd9f3453129d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1fa3127a8968d55096d37124a9e212013af112affa5e30b84a1d22263c31576c\",\"dweb:/ipfs/QmetxaVcn5Q6nkpF9yXzaxPQ7d3rgrhV13sTH9BgiuzGJL\"]},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"keccak256\":\"0x59973a93b1f983f94e10529f46ca46544a9fec2b5f56fb1390bbe9e0dc79f857\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c55ef8f0b9719790c2ae6f81d80a59ffb89f2f0abe6bc065585bd79edce058c5\",\"dweb:/ipfs/QmNNmCbX9NjPXKqHJN8R1WC2rNeZSQrPZLd6FF6AKLyH5Y\"]},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"keccak256\":\"0xc8cae21c9ae4a46e5162ff9bf5b351d6fa6a6eba72d515f3bc1bdfeda7fdf083\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce830ebcf28e31643caba318996db3763c36d52cd0f23798ba83c135355d45e9\",\"dweb:/ipfs/QmdGPcvptHN7UBCbUYBbRX3hiRVRFLRwno8b4uga6uFNif\"]},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"keccak256\":\"0xb1970fac7b64e6c09611e6691791e848d5e3fe410fa5899e7df2e0afd77a99e3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://db5fbb3dddd8b7047465b62575d96231ba8a2774d37fb4737fbf23340fabbb03\",\"dweb:/ipfs/QmVUSvooZKEdEdap619tcJjTLcAuH6QBdZqAzWwnAXZAWJ\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "IERC165": { + "abi": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "", + "opcodes": "", + "sourceMap": "" + }, + "methodIdentifiers": { + "supportsInterface(bytes4)": "01ffc9a7" + } + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Interface of the ERC-165 standard, as defined in the https://eips.ethereum.org/EIPS/eip-165[ERC]. Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}.\",\"kind\":\"dev\",\"methods\":{\"supportsInterface(bytes4)\":{\"details\":\"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section] to learn more about how these ids are created. This function call must use less than 30 000 gas.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":\"IERC165\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x8891738ffe910f0cf2da09566928589bf5d63f4524dd734fd9cedbac3274dd5c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://971f954442df5c2ef5b5ebf1eb245d7105d9fbacc7386ee5c796df1d45b21617\",\"dweb:/ipfs/QmadRjHbkicwqwwh61raUEapaVEtaLMcYbQZWs9gUkgj3u\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "Math": { + "abi": [], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea264697066735822122091005e0c663891cd7c55899184f368372b30b74607e9cbbb4e1eb5ac7371189564736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 SWAP2 STOP MCOPY 0xC PUSH7 0x3891CD7C558991 DUP5 RETURN PUSH9 0x372B30B74607E9CBBB 0x4E 0x1E 0xB5 0xAC PUSH20 0x71189564736F6C634300081C0033000000000000 ", + "sourceMap": "281:32382:19:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;281:32382:19;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea264697066735822122091005e0c663891cd7c55899184f368372b30b74607e9cbbb4e1eb5ac7371189564736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 SWAP2 STOP MCOPY 0xC PUSH7 0x3891CD7C558991 DUP5 RETURN PUSH9 0x372B30B74607E9CBBB 0x4E 0x1E 0xB5 0xAC PUSH20 0x71189564736F6C634300081C0033000000000000 ", + "sourceMap": "281:32382:19:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Standard math utilities missing in the Solidity language.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/math/Math.sol\":\"Math\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Panic.sol\":{\"keccak256\":\"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c6a5ff4f9fd8649b7ee20800b7fa387d3465bd77cf20c2d1068cd5c98e1ed57a\",\"dweb:/ipfs/QmVSaVJf9FXFhdYEYeCEfjMVHrxDh5qL4CGkxdMWpQCrqG\"]},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"keccak256\":\"0x59973a93b1f983f94e10529f46ca46544a9fec2b5f56fb1390bbe9e0dc79f857\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c55ef8f0b9719790c2ae6f81d80a59ffb89f2f0abe6bc065585bd79edce058c5\",\"dweb:/ipfs/QmNNmCbX9NjPXKqHJN8R1WC2rNeZSQrPZLd6FF6AKLyH5Y\"]},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"keccak256\":\"0xc8cae21c9ae4a46e5162ff9bf5b351d6fa6a6eba72d515f3bc1bdfeda7fdf083\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce830ebcf28e31643caba318996db3763c36d52cd0f23798ba83c135355d45e9\",\"dweb:/ipfs/QmdGPcvptHN7UBCbUYBbRX3hiRVRFLRwno8b4uga6uFNif\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/math/SafeCast.sol": { + "SafeCast": { + "abi": [ + { + "inputs": [ + { + "internalType": "uint8", + "name": "bits", + "type": "uint8" + }, + { + "internalType": "int256", + "name": "value", + "type": "int256" + } + ], + "name": "SafeCastOverflowedIntDowncast", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "int256", + "name": "value", + "type": "int256" + } + ], + "name": "SafeCastOverflowedIntToUint", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "bits", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "SafeCastOverflowedUintDowncast", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "SafeCastOverflowedUintToInt", + "type": "error" + } + ], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212206e23643c396df695b2797f650857ef0eb0576e47d97a4599ed83883f99aad72664736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 PUSH15 0x23643C396DF695B2797F650857EF0E 0xB0 JUMPI PUSH15 0x47D97A4599ED83883F99AAD7266473 PUSH16 0x6C634300081C00330000000000000000 ", + "sourceMap": "769:34170:20:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;769:34170:20;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212206e23643c396df695b2797f650857ef0eb0576e47d97a4599ed83883f99aad72664736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 PUSH15 0x23643C396DF695B2797F650857EF0E 0xB0 JUMPI PUSH15 0x47D97A4599ED83883F99AAD7266473 PUSH16 0x6C634300081C00330000000000000000 ", + "sourceMap": "769:34170:20:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"bits\",\"type\":\"uint8\"},{\"internalType\":\"int256\",\"name\":\"value\",\"type\":\"int256\"}],\"name\":\"SafeCastOverflowedIntDowncast\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"int256\",\"name\":\"value\",\"type\":\"int256\"}],\"name\":\"SafeCastOverflowedIntToUint\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"bits\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"SafeCastOverflowedUintDowncast\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"SafeCastOverflowedUintToInt\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow checks. Downcasting from uint256/int256 in Solidity does not revert on overflow. This can easily result in undesired exploitation or bugs, since developers usually assume that overflows raise errors. `SafeCast` restores this intuition by reverting the transaction when such an operation overflows. Using this library instead of the unchecked operations eliminates an entire class of bugs, so it's recommended to use it always.\",\"errors\":{\"SafeCastOverflowedIntDowncast(uint8,int256)\":[{\"details\":\"Value doesn't fit in an int of `bits` size.\"}],\"SafeCastOverflowedIntToUint(int256)\":[{\"details\":\"An int value doesn't fit in a uint of `bits` size.\"}],\"SafeCastOverflowedUintDowncast(uint8,uint256)\":[{\"details\":\"Value doesn't fit in a uint of `bits` size.\"}],\"SafeCastOverflowedUintToInt(uint256)\":[{\"details\":\"A uint value doesn't fit in an int of `bits` size.\"}]},\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/math/SafeCast.sol\":\"SafeCast\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"keccak256\":\"0xc8cae21c9ae4a46e5162ff9bf5b351d6fa6a6eba72d515f3bc1bdfeda7fdf083\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce830ebcf28e31643caba318996db3763c36d52cd0f23798ba83c135355d45e9\",\"dweb:/ipfs/QmdGPcvptHN7UBCbUYBbRX3hiRVRFLRwno8b4uga6uFNif\"]}},\"version\":1}" + } + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "SignedMath": { + "abi": [], + "evm": { + "bytecode": { + "functionDebugData": {}, + "generatedSources": [], + "linkReferences": {}, + "object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212202c4428eb6666cae863602bfb74d48242f67136c2baeeed29a59362a5e64d7e8564736f6c634300081c0033", + "opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0x2C PREVRANDAO 0x28 0xEB PUSH7 0x66CAE863602BFB PUSH21 0xD48242F67136C2BAEEED29A59362A5E64D7E856473 PUSH16 0x6C634300081C00330000000000000000 ", + "sourceMap": "258:2354:21:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;258:2354:21;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": {}, + "generatedSources": [], + "immutableReferences": {}, + "linkReferences": {}, + "object": "730000000000000000000000000000000000000000301460806040525f5ffdfea26469706673582212202c4428eb6666cae863602bfb74d48242f67136c2baeeed29a59362a5e64d7e8564736f6c634300081c0033", + "opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 PUSH0 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0x2C PREVRANDAO 0x28 0xEB PUSH7 0x66CAE863602BFB PUSH21 0xD48242F67136C2BAEEED29A59362A5E64D7E856473 PUSH16 0x6C634300081C00330000000000000000 ", + "sourceMap": "258:2354:21:-:0;;;;;;;;" + }, + "methodIdentifiers": {} + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Standard signed math utilities missing in the Solidity language.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/math/SignedMath.sol\":\"SignedMath\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"keccak256\":\"0xc8cae21c9ae4a46e5162ff9bf5b351d6fa6a6eba72d515f3bc1bdfeda7fdf083\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce830ebcf28e31643caba318996db3763c36d52cd0f23798ba83c135355d45e9\",\"dweb:/ipfs/QmdGPcvptHN7UBCbUYBbRX3hiRVRFLRwno8b4uga6uFNif\"]},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"keccak256\":\"0xb1970fac7b64e6c09611e6691791e848d5e3fe410fa5899e7df2e0afd77a99e3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://db5fbb3dddd8b7047465b62575d96231ba8a2774d37fb4737fbf23340fabbb03\",\"dweb:/ipfs/QmVUSvooZKEdEdap619tcJjTLcAuH6QBdZqAzWwnAXZAWJ\"]}},\"version\":1}" + } + }, + "contracts/TokenRelayer.sol": { + "TokenRelayer": { + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_destinationContract", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "ECDSAInvalidSignature", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "length", + "type": "uint256" + } + ], + "name": "ECDSAInvalidSignatureLength", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "ECDSAInvalidSignatureS", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidShortString", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnableInvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "OwnableUnauthorizedAccount", + "type": "error" + }, + { + "inputs": [], + "name": "ReentrancyGuardReentrantCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "SafeERC20FailedOperation", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "str", + "type": "string" + } + ], + "name": "StringTooLong", + "type": "error" + }, + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "ETHWithdrawn", + "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": true, + "internalType": "address", + "name": "signer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "RelayerExecuted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "TokenWithdrawn", + "type": "event" + }, + { + "inputs": [], + "name": "destinationContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "permitV", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "permitR", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "permitS", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "payloadData", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "payloadValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "payloadNonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "payloadDeadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "payloadV", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "payloadR", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "payloadS", + "type": "bytes32" + } + ], + "internalType": "struct TokenRelayer.ExecuteParams", + "name": "params", + "type": "tuple" + } + ], + "name": "execute", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "signer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + } + ], + "name": "isExecutionCompleted", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "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": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "usedPayloadNonces", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdrawETH", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdrawToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "evm": { + "bytecode": { + "functionDebugData": { + "@_1746": { + "entryPoint": null, + "id": 1746, + "parameterSlots": 0, + "returnSlots": 0 + }, + "@_4234": { + "entryPoint": null, + "id": 4234, + "parameterSlots": 2, + "returnSlots": 0 + }, + "@_50": { + "entryPoint": null, + "id": 50, + "parameterSlots": 1, + "returnSlots": 0 + }, + "@_8232": { + "entryPoint": null, + "id": 8232, + "parameterSlots": 1, + "returnSlots": 0 + }, + "@_buildDomainSeparator_4281": { + "entryPoint": null, + "id": 4281, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@_reentrancyGuardStorageSlot_1826": { + "entryPoint": null, + "id": 1826, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@_transferOwnership_146": { + "entryPoint": 470, + "id": 146, + "parameterSlots": 1, + "returnSlots": 0 + }, + "@getStringSlot_2145": { + "entryPoint": null, + "id": 2145, + "parameterSlots": 1, + "returnSlots": 1 + }, + "@getUint256Slot_2112": { + "entryPoint": null, + "id": 2112, + "parameterSlots": 1, + "returnSlots": 1 + }, + "@toShortStringWithFallback_1985": { + "entryPoint": 549, + "id": 1985, + "parameterSlots": 2, + "returnSlots": 1 + }, + "@toShortString_1887": { + "entryPoint": 599, + "id": 1887, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_decode_tuple_t_address_fromMemory": { + "entryPoint": 660, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_tuple_t_address__to_t_address__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_tuple_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__to_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 6, + "returnSlots": 1 + }, + "abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": 1043, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_480a3d2cf1e4838d740f40eac57f23eb6facc0baaf1a65a7b61df6a5a00ed368__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "array_dataslot_string_storage": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "clean_up_bytearray_end_slots_string_storage": { + "entryPoint": 781, + "id": null, + "parameterSlots": 3, + "returnSlots": 0 + }, + "convert_bytes_to_fixedbytes_from_t_bytes_memory_ptr_to_t_bytes32": { + "entryPoint": 1096, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "copy_byte_array_to_storage_from_t_string_memory_ptr_to_t_string_storage": { + "entryPoint": 857, + "id": null, + "parameterSlots": 2, + "returnSlots": 0 + }, + "extract_byte_array_length": { + "entryPoint": 725, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "extract_used_part_and_set_length_of_short_byte_array": { + "entryPoint": null, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "panic_error_0x41": { + "entryPoint": 705, + "id": null, + "parameterSlots": 0, + "returnSlots": 0 + } + }, + "generatedSources": [ + { + "ast": { + "nativeSrc": "0:4722:23", + "nodeType": "YulBlock", + "src": "0:4722:23", + "statements": [ + { + "nativeSrc": "6:3:23", + "nodeType": "YulBlock", + "src": "6:3:23", + "statements": [] + }, + { + "body": { + "nativeSrc": "95:209:23", + "nodeType": "YulBlock", + "src": "95:209:23", + "statements": [ + { + "body": { + "nativeSrc": "141:16:23", + "nodeType": "YulBlock", + "src": "141:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "150:1:23", + "nodeType": "YulLiteral", + "src": "150:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "153:1:23", + "nodeType": "YulLiteral", + "src": "153:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "143:6:23", + "nodeType": "YulIdentifier", + "src": "143:6:23" + }, + "nativeSrc": "143:12:23", + "nodeType": "YulFunctionCall", + "src": "143:12:23" + }, + "nativeSrc": "143:12:23", + "nodeType": "YulExpressionStatement", + "src": "143:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nativeSrc": "116:7:23", + "nodeType": "YulIdentifier", + "src": "116:7:23" + }, + { + "name": "headStart", + "nativeSrc": "125:9:23", + "nodeType": "YulIdentifier", + "src": "125:9:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "112:3:23", + "nodeType": "YulIdentifier", + "src": "112:3:23" + }, + "nativeSrc": "112:23:23", + "nodeType": "YulFunctionCall", + "src": "112:23:23" + }, + { + "kind": "number", + "nativeSrc": "137:2:23", + "nodeType": "YulLiteral", + "src": "137:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nativeSrc": "108:3:23", + "nodeType": "YulIdentifier", + "src": "108:3:23" + }, + "nativeSrc": "108:32:23", + "nodeType": "YulFunctionCall", + "src": "108:32:23" + }, + "nativeSrc": "105:52:23", + "nodeType": "YulIf", + "src": "105:52:23" + }, + { + "nativeSrc": "166:29:23", + "nodeType": "YulVariableDeclaration", + "src": "166:29:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "185:9:23", + "nodeType": "YulIdentifier", + "src": "185:9:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "179:5:23", + "nodeType": "YulIdentifier", + "src": "179:5:23" + }, + "nativeSrc": "179:16:23", + "nodeType": "YulFunctionCall", + "src": "179:16:23" + }, + "variables": [ + { + "name": "value", + "nativeSrc": "170:5:23", + "nodeType": "YulTypedName", + "src": "170:5:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "258:16:23", + "nodeType": "YulBlock", + "src": "258:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "267:1:23", + "nodeType": "YulLiteral", + "src": "267:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "270:1:23", + "nodeType": "YulLiteral", + "src": "270:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "260:6:23", + "nodeType": "YulIdentifier", + "src": "260:6:23" + }, + "nativeSrc": "260:12:23", + "nodeType": "YulFunctionCall", + "src": "260:12:23" + }, + "nativeSrc": "260:12:23", + "nodeType": "YulExpressionStatement", + "src": "260:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nativeSrc": "217:5:23", + "nodeType": "YulIdentifier", + "src": "217:5:23" + }, + { + "arguments": [ + { + "name": "value", + "nativeSrc": "228:5:23", + "nodeType": "YulIdentifier", + "src": "228:5:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "243:3:23", + "nodeType": "YulLiteral", + "src": "243:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "248:1:23", + "nodeType": "YulLiteral", + "src": "248:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "239:3:23", + "nodeType": "YulIdentifier", + "src": "239:3:23" + }, + "nativeSrc": "239:11:23", + "nodeType": "YulFunctionCall", + "src": "239:11:23" + }, + { + "kind": "number", + "nativeSrc": "252:1:23", + "nodeType": "YulLiteral", + "src": "252:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "235:3:23", + "nodeType": "YulIdentifier", + "src": "235:3:23" + }, + "nativeSrc": "235:19:23", + "nodeType": "YulFunctionCall", + "src": "235:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "224:3:23", + "nodeType": "YulIdentifier", + "src": "224:3:23" + }, + "nativeSrc": "224:31:23", + "nodeType": "YulFunctionCall", + "src": "224:31:23" + } + ], + "functionName": { + "name": "eq", + "nativeSrc": "214:2:23", + "nodeType": "YulIdentifier", + "src": "214:2:23" + }, + "nativeSrc": "214:42:23", + "nodeType": "YulFunctionCall", + "src": "214:42:23" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "207:6:23", + "nodeType": "YulIdentifier", + "src": "207:6:23" + }, + "nativeSrc": "207:50:23", + "nodeType": "YulFunctionCall", + "src": "207:50:23" + }, + "nativeSrc": "204:70:23", + "nodeType": "YulIf", + "src": "204:70:23" + }, + { + "nativeSrc": "283:15:23", + "nodeType": "YulAssignment", + "src": "283:15:23", + "value": { + "name": "value", + "nativeSrc": "293:5:23", + "nodeType": "YulIdentifier", + "src": "293:5:23" + }, + "variableNames": [ + { + "name": "value0", + "nativeSrc": "283:6:23", + "nodeType": "YulIdentifier", + "src": "283:6:23" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_address_fromMemory", + "nativeSrc": "14:290:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "61:9:23", + "nodeType": "YulTypedName", + "src": "61:9:23", + "type": "" + }, + { + "name": "dataEnd", + "nativeSrc": "72:7:23", + "nodeType": "YulTypedName", + "src": "72:7:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nativeSrc": "84:6:23", + "nodeType": "YulTypedName", + "src": "84:6:23", + "type": "" + } + ], + "src": "14:290:23" + }, + { + "body": { + "nativeSrc": "410:102:23", + "nodeType": "YulBlock", + "src": "410:102:23", + "statements": [ + { + "nativeSrc": "420:26:23", + "nodeType": "YulAssignment", + "src": "420:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "432:9:23", + "nodeType": "YulIdentifier", + "src": "432:9:23" + }, + { + "kind": "number", + "nativeSrc": "443:2:23", + "nodeType": "YulLiteral", + "src": "443:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "428:3:23", + "nodeType": "YulIdentifier", + "src": "428:3:23" + }, + "nativeSrc": "428:18:23", + "nodeType": "YulFunctionCall", + "src": "428:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "420:4:23", + "nodeType": "YulIdentifier", + "src": "420:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "462:9:23", + "nodeType": "YulIdentifier", + "src": "462:9:23" + }, + { + "arguments": [ + { + "name": "value0", + "nativeSrc": "477:6:23", + "nodeType": "YulIdentifier", + "src": "477:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "493:3:23", + "nodeType": "YulLiteral", + "src": "493:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "498:1:23", + "nodeType": "YulLiteral", + "src": "498:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "489:3:23", + "nodeType": "YulIdentifier", + "src": "489:3:23" + }, + "nativeSrc": "489:11:23", + "nodeType": "YulFunctionCall", + "src": "489:11:23" + }, + { + "kind": "number", + "nativeSrc": "502:1:23", + "nodeType": "YulLiteral", + "src": "502:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "485:3:23", + "nodeType": "YulIdentifier", + "src": "485:3:23" + }, + "nativeSrc": "485:19:23", + "nodeType": "YulFunctionCall", + "src": "485:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "473:3:23", + "nodeType": "YulIdentifier", + "src": "473:3:23" + }, + "nativeSrc": "473:32:23", + "nodeType": "YulFunctionCall", + "src": "473:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "455:6:23", + "nodeType": "YulIdentifier", + "src": "455:6:23" + }, + "nativeSrc": "455:51:23", + "nodeType": "YulFunctionCall", + "src": "455:51:23" + }, + "nativeSrc": "455:51:23", + "nodeType": "YulExpressionStatement", + "src": "455:51:23" + } + ] + }, + "name": "abi_encode_tuple_t_address__to_t_address__fromStack_reversed", + "nativeSrc": "309:203:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "379:9:23", + "nodeType": "YulTypedName", + "src": "379:9:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "390:6:23", + "nodeType": "YulTypedName", + "src": "390:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "401:4:23", + "nodeType": "YulTypedName", + "src": "401:4:23", + "type": "" + } + ], + "src": "309:203:23" + }, + { + "body": { + "nativeSrc": "691:169:23", + "nodeType": "YulBlock", + "src": "691:169:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "708:9:23", + "nodeType": "YulIdentifier", + "src": "708:9:23" + }, + { + "kind": "number", + "nativeSrc": "719:2:23", + "nodeType": "YulLiteral", + "src": "719:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "701:6:23", + "nodeType": "YulIdentifier", + "src": "701:6:23" + }, + "nativeSrc": "701:21:23", + "nodeType": "YulFunctionCall", + "src": "701:21:23" + }, + "nativeSrc": "701:21:23", + "nodeType": "YulExpressionStatement", + "src": "701:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "742:9:23", + "nodeType": "YulIdentifier", + "src": "742:9:23" + }, + { + "kind": "number", + "nativeSrc": "753:2:23", + "nodeType": "YulLiteral", + "src": "753:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "738:3:23", + "nodeType": "YulIdentifier", + "src": "738:3:23" + }, + "nativeSrc": "738:18:23", + "nodeType": "YulFunctionCall", + "src": "738:18:23" + }, + { + "kind": "number", + "nativeSrc": "758:2:23", + "nodeType": "YulLiteral", + "src": "758:2:23", + "type": "", + "value": "19" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "731:6:23", + "nodeType": "YulIdentifier", + "src": "731:6:23" + }, + "nativeSrc": "731:30:23", + "nodeType": "YulFunctionCall", + "src": "731:30:23" + }, + "nativeSrc": "731:30:23", + "nodeType": "YulExpressionStatement", + "src": "731:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "781:9:23", + "nodeType": "YulIdentifier", + "src": "781:9:23" + }, + { + "kind": "number", + "nativeSrc": "792:2:23", + "nodeType": "YulLiteral", + "src": "792:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "777:3:23", + "nodeType": "YulIdentifier", + "src": "777:3:23" + }, + "nativeSrc": "777:18:23", + "nodeType": "YulFunctionCall", + "src": "777:18:23" + }, + { + "hexValue": "496e76616c69642064657374696e6174696f6e", + "kind": "string", + "nativeSrc": "797:21:23", + "nodeType": "YulLiteral", + "src": "797:21:23", + "type": "", + "value": "Invalid destination" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "770:6:23", + "nodeType": "YulIdentifier", + "src": "770:6:23" + }, + "nativeSrc": "770:49:23", + "nodeType": "YulFunctionCall", + "src": "770:49:23" + }, + "nativeSrc": "770:49:23", + "nodeType": "YulExpressionStatement", + "src": "770:49:23" + }, + { + "nativeSrc": "828:26:23", + "nodeType": "YulAssignment", + "src": "828:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "840:9:23", + "nodeType": "YulIdentifier", + "src": "840:9:23" + }, + { + "kind": "number", + "nativeSrc": "851:2:23", + "nodeType": "YulLiteral", + "src": "851:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "836:3:23", + "nodeType": "YulIdentifier", + "src": "836:3:23" + }, + "nativeSrc": "836:18:23", + "nodeType": "YulFunctionCall", + "src": "836:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "828:4:23", + "nodeType": "YulIdentifier", + "src": "828:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_480a3d2cf1e4838d740f40eac57f23eb6facc0baaf1a65a7b61df6a5a00ed368__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "517:343:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "668:9:23", + "nodeType": "YulTypedName", + "src": "668:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "682:4:23", + "nodeType": "YulTypedName", + "src": "682:4:23", + "type": "" + } + ], + "src": "517:343:23" + }, + { + "body": { + "nativeSrc": "897:95:23", + "nodeType": "YulBlock", + "src": "897:95:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "914:1:23", + "nodeType": "YulLiteral", + "src": "914:1:23", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "921:3:23", + "nodeType": "YulLiteral", + "src": "921:3:23", + "type": "", + "value": "224" + }, + { + "kind": "number", + "nativeSrc": "926:10:23", + "nodeType": "YulLiteral", + "src": "926:10:23", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "917:3:23", + "nodeType": "YulIdentifier", + "src": "917:3:23" + }, + "nativeSrc": "917:20:23", + "nodeType": "YulFunctionCall", + "src": "917:20:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "907:6:23", + "nodeType": "YulIdentifier", + "src": "907:6:23" + }, + "nativeSrc": "907:31:23", + "nodeType": "YulFunctionCall", + "src": "907:31:23" + }, + "nativeSrc": "907:31:23", + "nodeType": "YulExpressionStatement", + "src": "907:31:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "954:1:23", + "nodeType": "YulLiteral", + "src": "954:1:23", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nativeSrc": "957:4:23", + "nodeType": "YulLiteral", + "src": "957:4:23", + "type": "", + "value": "0x41" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "947:6:23", + "nodeType": "YulIdentifier", + "src": "947:6:23" + }, + "nativeSrc": "947:15:23", + "nodeType": "YulFunctionCall", + "src": "947:15:23" + }, + "nativeSrc": "947:15:23", + "nodeType": "YulExpressionStatement", + "src": "947:15:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "978:1:23", + "nodeType": "YulLiteral", + "src": "978:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "981:4:23", + "nodeType": "YulLiteral", + "src": "981:4:23", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "971:6:23", + "nodeType": "YulIdentifier", + "src": "971:6:23" + }, + "nativeSrc": "971:15:23", + "nodeType": "YulFunctionCall", + "src": "971:15:23" + }, + "nativeSrc": "971:15:23", + "nodeType": "YulExpressionStatement", + "src": "971:15:23" + } + ] + }, + "name": "panic_error_0x41", + "nativeSrc": "865:127:23", + "nodeType": "YulFunctionDefinition", + "src": "865:127:23" + }, + { + "body": { + "nativeSrc": "1052:325:23", + "nodeType": "YulBlock", + "src": "1052:325:23", + "statements": [ + { + "nativeSrc": "1062:22:23", + "nodeType": "YulAssignment", + "src": "1062:22:23", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1076:1:23", + "nodeType": "YulLiteral", + "src": "1076:1:23", + "type": "", + "value": "1" + }, + { + "name": "data", + "nativeSrc": "1079:4:23", + "nodeType": "YulIdentifier", + "src": "1079:4:23" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "1072:3:23", + "nodeType": "YulIdentifier", + "src": "1072:3:23" + }, + "nativeSrc": "1072:12:23", + "nodeType": "YulFunctionCall", + "src": "1072:12:23" + }, + "variableNames": [ + { + "name": "length", + "nativeSrc": "1062:6:23", + "nodeType": "YulIdentifier", + "src": "1062:6:23" + } + ] + }, + { + "nativeSrc": "1093:38:23", + "nodeType": "YulVariableDeclaration", + "src": "1093:38:23", + "value": { + "arguments": [ + { + "name": "data", + "nativeSrc": "1123:4:23", + "nodeType": "YulIdentifier", + "src": "1123:4:23" + }, + { + "kind": "number", + "nativeSrc": "1129:1:23", + "nodeType": "YulLiteral", + "src": "1129:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "1119:3:23", + "nodeType": "YulIdentifier", + "src": "1119:3:23" + }, + "nativeSrc": "1119:12:23", + "nodeType": "YulFunctionCall", + "src": "1119:12:23" + }, + "variables": [ + { + "name": "outOfPlaceEncoding", + "nativeSrc": "1097:18:23", + "nodeType": "YulTypedName", + "src": "1097:18:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "1170:31:23", + "nodeType": "YulBlock", + "src": "1170:31:23", + "statements": [ + { + "nativeSrc": "1172:27:23", + "nodeType": "YulAssignment", + "src": "1172:27:23", + "value": { + "arguments": [ + { + "name": "length", + "nativeSrc": "1186:6:23", + "nodeType": "YulIdentifier", + "src": "1186:6:23" + }, + { + "kind": "number", + "nativeSrc": "1194:4:23", + "nodeType": "YulLiteral", + "src": "1194:4:23", + "type": "", + "value": "0x7f" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "1182:3:23", + "nodeType": "YulIdentifier", + "src": "1182:3:23" + }, + "nativeSrc": "1182:17:23", + "nodeType": "YulFunctionCall", + "src": "1182:17:23" + }, + "variableNames": [ + { + "name": "length", + "nativeSrc": "1172:6:23", + "nodeType": "YulIdentifier", + "src": "1172:6:23" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nativeSrc": "1150:18:23", + "nodeType": "YulIdentifier", + "src": "1150:18:23" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "1143:6:23", + "nodeType": "YulIdentifier", + "src": "1143:6:23" + }, + "nativeSrc": "1143:26:23", + "nodeType": "YulFunctionCall", + "src": "1143:26:23" + }, + "nativeSrc": "1140:61:23", + "nodeType": "YulIf", + "src": "1140:61:23" + }, + { + "body": { + "nativeSrc": "1260:111:23", + "nodeType": "YulBlock", + "src": "1260:111:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1281:1:23", + "nodeType": "YulLiteral", + "src": "1281:1:23", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1288:3:23", + "nodeType": "YulLiteral", + "src": "1288:3:23", + "type": "", + "value": "224" + }, + { + "kind": "number", + "nativeSrc": "1293:10:23", + "nodeType": "YulLiteral", + "src": "1293:10:23", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "1284:3:23", + "nodeType": "YulIdentifier", + "src": "1284:3:23" + }, + "nativeSrc": "1284:20:23", + "nodeType": "YulFunctionCall", + "src": "1284:20:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1274:6:23", + "nodeType": "YulIdentifier", + "src": "1274:6:23" + }, + "nativeSrc": "1274:31:23", + "nodeType": "YulFunctionCall", + "src": "1274:31:23" + }, + "nativeSrc": "1274:31:23", + "nodeType": "YulExpressionStatement", + "src": "1274:31:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1325:1:23", + "nodeType": "YulLiteral", + "src": "1325:1:23", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nativeSrc": "1328:4:23", + "nodeType": "YulLiteral", + "src": "1328:4:23", + "type": "", + "value": "0x22" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1318:6:23", + "nodeType": "YulIdentifier", + "src": "1318:6:23" + }, + "nativeSrc": "1318:15:23", + "nodeType": "YulFunctionCall", + "src": "1318:15:23" + }, + "nativeSrc": "1318:15:23", + "nodeType": "YulExpressionStatement", + "src": "1318:15:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1353:1:23", + "nodeType": "YulLiteral", + "src": "1353:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "1356:4:23", + "nodeType": "YulLiteral", + "src": "1356:4:23", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "1346:6:23", + "nodeType": "YulIdentifier", + "src": "1346:6:23" + }, + "nativeSrc": "1346:15:23", + "nodeType": "YulFunctionCall", + "src": "1346:15:23" + }, + "nativeSrc": "1346:15:23", + "nodeType": "YulExpressionStatement", + "src": "1346:15:23" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nativeSrc": "1216:18:23", + "nodeType": "YulIdentifier", + "src": "1216:18:23" + }, + { + "arguments": [ + { + "name": "length", + "nativeSrc": "1239:6:23", + "nodeType": "YulIdentifier", + "src": "1239:6:23" + }, + { + "kind": "number", + "nativeSrc": "1247:2:23", + "nodeType": "YulLiteral", + "src": "1247:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "1236:2:23", + "nodeType": "YulIdentifier", + "src": "1236:2:23" + }, + "nativeSrc": "1236:14:23", + "nodeType": "YulFunctionCall", + "src": "1236:14:23" + } + ], + "functionName": { + "name": "eq", + "nativeSrc": "1213:2:23", + "nodeType": "YulIdentifier", + "src": "1213:2:23" + }, + "nativeSrc": "1213:38:23", + "nodeType": "YulFunctionCall", + "src": "1213:38:23" + }, + "nativeSrc": "1210:161:23", + "nodeType": "YulIf", + "src": "1210:161:23" + } + ] + }, + "name": "extract_byte_array_length", + "nativeSrc": "997:380:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "data", + "nativeSrc": "1032:4:23", + "nodeType": "YulTypedName", + "src": "1032:4:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "length", + "nativeSrc": "1041:6:23", + "nodeType": "YulTypedName", + "src": "1041:6:23", + "type": "" + } + ], + "src": "997:380:23" + }, + { + "body": { + "nativeSrc": "1438:65:23", + "nodeType": "YulBlock", + "src": "1438:65:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1455:1:23", + "nodeType": "YulLiteral", + "src": "1455:1:23", + "type": "", + "value": "0" + }, + { + "name": "ptr", + "nativeSrc": "1458:3:23", + "nodeType": "YulIdentifier", + "src": "1458:3:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1448:6:23", + "nodeType": "YulIdentifier", + "src": "1448:6:23" + }, + "nativeSrc": "1448:14:23", + "nodeType": "YulFunctionCall", + "src": "1448:14:23" + }, + "nativeSrc": "1448:14:23", + "nodeType": "YulExpressionStatement", + "src": "1448:14:23" + }, + { + "nativeSrc": "1471:26:23", + "nodeType": "YulAssignment", + "src": "1471:26:23", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1489:1:23", + "nodeType": "YulLiteral", + "src": "1489:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "1492:4:23", + "nodeType": "YulLiteral", + "src": "1492:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "keccak256", + "nativeSrc": "1479:9:23", + "nodeType": "YulIdentifier", + "src": "1479:9:23" + }, + "nativeSrc": "1479:18:23", + "nodeType": "YulFunctionCall", + "src": "1479:18:23" + }, + "variableNames": [ + { + "name": "data", + "nativeSrc": "1471:4:23", + "nodeType": "YulIdentifier", + "src": "1471:4:23" + } + ] + } + ] + }, + "name": "array_dataslot_string_storage", + "nativeSrc": "1382:121:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "ptr", + "nativeSrc": "1421:3:23", + "nodeType": "YulTypedName", + "src": "1421:3:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "data", + "nativeSrc": "1429:4:23", + "nodeType": "YulTypedName", + "src": "1429:4:23", + "type": "" + } + ], + "src": "1382:121:23" + }, + { + "body": { + "nativeSrc": "1589:437:23", + "nodeType": "YulBlock", + "src": "1589:437:23", + "statements": [ + { + "body": { + "nativeSrc": "1622:398:23", + "nodeType": "YulBlock", + "src": "1622:398:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1643:1:23", + "nodeType": "YulLiteral", + "src": "1643:1:23", + "type": "", + "value": "0" + }, + { + "name": "array", + "nativeSrc": "1646:5:23", + "nodeType": "YulIdentifier", + "src": "1646:5:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1636:6:23", + "nodeType": "YulIdentifier", + "src": "1636:6:23" + }, + "nativeSrc": "1636:16:23", + "nodeType": "YulFunctionCall", + "src": "1636:16:23" + }, + "nativeSrc": "1636:16:23", + "nodeType": "YulExpressionStatement", + "src": "1636:16:23" + }, + { + "nativeSrc": "1665:30:23", + "nodeType": "YulVariableDeclaration", + "src": "1665:30:23", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1687:1:23", + "nodeType": "YulLiteral", + "src": "1687:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "1690:4:23", + "nodeType": "YulLiteral", + "src": "1690:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "keccak256", + "nativeSrc": "1677:9:23", + "nodeType": "YulIdentifier", + "src": "1677:9:23" + }, + "nativeSrc": "1677:18:23", + "nodeType": "YulFunctionCall", + "src": "1677:18:23" + }, + "variables": [ + { + "name": "data", + "nativeSrc": "1669:4:23", + "nodeType": "YulTypedName", + "src": "1669:4:23", + "type": "" + } + ] + }, + { + "nativeSrc": "1708:57:23", + "nodeType": "YulVariableDeclaration", + "src": "1708:57:23", + "value": { + "arguments": [ + { + "name": "data", + "nativeSrc": "1731:4:23", + "nodeType": "YulIdentifier", + "src": "1731:4:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1741:1:23", + "nodeType": "YulLiteral", + "src": "1741:1:23", + "type": "", + "value": "5" + }, + { + "arguments": [ + { + "name": "startIndex", + "nativeSrc": "1748:10:23", + "nodeType": "YulIdentifier", + "src": "1748:10:23" + }, + { + "kind": "number", + "nativeSrc": "1760:2:23", + "nodeType": "YulLiteral", + "src": "1760:2:23", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1744:3:23", + "nodeType": "YulIdentifier", + "src": "1744:3:23" + }, + "nativeSrc": "1744:19:23", + "nodeType": "YulFunctionCall", + "src": "1744:19:23" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "1737:3:23", + "nodeType": "YulIdentifier", + "src": "1737:3:23" + }, + "nativeSrc": "1737:27:23", + "nodeType": "YulFunctionCall", + "src": "1737:27:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1727:3:23", + "nodeType": "YulIdentifier", + "src": "1727:3:23" + }, + "nativeSrc": "1727:38:23", + "nodeType": "YulFunctionCall", + "src": "1727:38:23" + }, + "variables": [ + { + "name": "deleteStart", + "nativeSrc": "1712:11:23", + "nodeType": "YulTypedName", + "src": "1712:11:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "1802:23:23", + "nodeType": "YulBlock", + "src": "1802:23:23", + "statements": [ + { + "nativeSrc": "1804:19:23", + "nodeType": "YulAssignment", + "src": "1804:19:23", + "value": { + "name": "data", + "nativeSrc": "1819:4:23", + "nodeType": "YulIdentifier", + "src": "1819:4:23" + }, + "variableNames": [ + { + "name": "deleteStart", + "nativeSrc": "1804:11:23", + "nodeType": "YulIdentifier", + "src": "1804:11:23" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "startIndex", + "nativeSrc": "1784:10:23", + "nodeType": "YulIdentifier", + "src": "1784:10:23" + }, + { + "kind": "number", + "nativeSrc": "1796:4:23", + "nodeType": "YulLiteral", + "src": "1796:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "1781:2:23", + "nodeType": "YulIdentifier", + "src": "1781:2:23" + }, + "nativeSrc": "1781:20:23", + "nodeType": "YulFunctionCall", + "src": "1781:20:23" + }, + "nativeSrc": "1778:47:23", + "nodeType": "YulIf", + "src": "1778:47:23" + }, + { + "nativeSrc": "1838:41:23", + "nodeType": "YulVariableDeclaration", + "src": "1838:41:23", + "value": { + "arguments": [ + { + "name": "data", + "nativeSrc": "1852:4:23", + "nodeType": "YulIdentifier", + "src": "1852:4:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1862:1:23", + "nodeType": "YulLiteral", + "src": "1862:1:23", + "type": "", + "value": "5" + }, + { + "arguments": [ + { + "name": "len", + "nativeSrc": "1869:3:23", + "nodeType": "YulIdentifier", + "src": "1869:3:23" + }, + { + "kind": "number", + "nativeSrc": "1874:2:23", + "nodeType": "YulLiteral", + "src": "1874:2:23", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1865:3:23", + "nodeType": "YulIdentifier", + "src": "1865:3:23" + }, + "nativeSrc": "1865:12:23", + "nodeType": "YulFunctionCall", + "src": "1865:12:23" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "1858:3:23", + "nodeType": "YulIdentifier", + "src": "1858:3:23" + }, + "nativeSrc": "1858:20:23", + "nodeType": "YulFunctionCall", + "src": "1858:20:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1848:3:23", + "nodeType": "YulIdentifier", + "src": "1848:3:23" + }, + "nativeSrc": "1848:31:23", + "nodeType": "YulFunctionCall", + "src": "1848:31:23" + }, + "variables": [ + { + "name": "_1", + "nativeSrc": "1842:2:23", + "nodeType": "YulTypedName", + "src": "1842:2:23", + "type": "" + } + ] + }, + { + "nativeSrc": "1892:24:23", + "nodeType": "YulVariableDeclaration", + "src": "1892:24:23", + "value": { + "name": "deleteStart", + "nativeSrc": "1905:11:23", + "nodeType": "YulIdentifier", + "src": "1905:11:23" + }, + "variables": [ + { + "name": "start", + "nativeSrc": "1896:5:23", + "nodeType": "YulTypedName", + "src": "1896:5:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "1990:20:23", + "nodeType": "YulBlock", + "src": "1990:20:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "start", + "nativeSrc": "1999:5:23", + "nodeType": "YulIdentifier", + "src": "1999:5:23" + }, + { + "kind": "number", + "nativeSrc": "2006:1:23", + "nodeType": "YulLiteral", + "src": "2006:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "sstore", + "nativeSrc": "1992:6:23", + "nodeType": "YulIdentifier", + "src": "1992:6:23" + }, + "nativeSrc": "1992:16:23", + "nodeType": "YulFunctionCall", + "src": "1992:16:23" + }, + "nativeSrc": "1992:16:23", + "nodeType": "YulExpressionStatement", + "src": "1992:16:23" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "start", + "nativeSrc": "1940:5:23", + "nodeType": "YulIdentifier", + "src": "1940:5:23" + }, + { + "name": "_1", + "nativeSrc": "1947:2:23", + "nodeType": "YulIdentifier", + "src": "1947:2:23" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "1937:2:23", + "nodeType": "YulIdentifier", + "src": "1937:2:23" + }, + "nativeSrc": "1937:13:23", + "nodeType": "YulFunctionCall", + "src": "1937:13:23" + }, + "nativeSrc": "1929:81:23", + "nodeType": "YulForLoop", + "post": { + "nativeSrc": "1951:26:23", + "nodeType": "YulBlock", + "src": "1951:26:23", + "statements": [ + { + "nativeSrc": "1953:22:23", + "nodeType": "YulAssignment", + "src": "1953:22:23", + "value": { + "arguments": [ + { + "name": "start", + "nativeSrc": "1966:5:23", + "nodeType": "YulIdentifier", + "src": "1966:5:23" + }, + { + "kind": "number", + "nativeSrc": "1973:1:23", + "nodeType": "YulLiteral", + "src": "1973:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1962:3:23", + "nodeType": "YulIdentifier", + "src": "1962:3:23" + }, + "nativeSrc": "1962:13:23", + "nodeType": "YulFunctionCall", + "src": "1962:13:23" + }, + "variableNames": [ + { + "name": "start", + "nativeSrc": "1953:5:23", + "nodeType": "YulIdentifier", + "src": "1953:5:23" + } + ] + } + ] + }, + "pre": { + "nativeSrc": "1933:3:23", + "nodeType": "YulBlock", + "src": "1933:3:23", + "statements": [] + }, + "src": "1929:81:23" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "len", + "nativeSrc": "1605:3:23", + "nodeType": "YulIdentifier", + "src": "1605:3:23" + }, + { + "kind": "number", + "nativeSrc": "1610:2:23", + "nodeType": "YulLiteral", + "src": "1610:2:23", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "gt", + "nativeSrc": "1602:2:23", + "nodeType": "YulIdentifier", + "src": "1602:2:23" + }, + "nativeSrc": "1602:11:23", + "nodeType": "YulFunctionCall", + "src": "1602:11:23" + }, + "nativeSrc": "1599:421:23", + "nodeType": "YulIf", + "src": "1599:421:23" + } + ] + }, + "name": "clean_up_bytearray_end_slots_string_storage", + "nativeSrc": "1508:518:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "array", + "nativeSrc": "1561:5:23", + "nodeType": "YulTypedName", + "src": "1561:5:23", + "type": "" + }, + { + "name": "len", + "nativeSrc": "1568:3:23", + "nodeType": "YulTypedName", + "src": "1568:3:23", + "type": "" + }, + { + "name": "startIndex", + "nativeSrc": "1573:10:23", + "nodeType": "YulTypedName", + "src": "1573:10:23", + "type": "" + } + ], + "src": "1508:518:23" + }, + { + "body": { + "nativeSrc": "2116:81:23", + "nodeType": "YulBlock", + "src": "2116:81:23", + "statements": [ + { + "nativeSrc": "2126:65:23", + "nodeType": "YulAssignment", + "src": "2126:65:23", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "data", + "nativeSrc": "2141:4:23", + "nodeType": "YulIdentifier", + "src": "2141:4:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2159:1:23", + "nodeType": "YulLiteral", + "src": "2159:1:23", + "type": "", + "value": "3" + }, + { + "name": "len", + "nativeSrc": "2162:3:23", + "nodeType": "YulIdentifier", + "src": "2162:3:23" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "2155:3:23", + "nodeType": "YulIdentifier", + "src": "2155:3:23" + }, + "nativeSrc": "2155:11:23", + "nodeType": "YulFunctionCall", + "src": "2155:11:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2172:1:23", + "nodeType": "YulLiteral", + "src": "2172:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "2168:3:23", + "nodeType": "YulIdentifier", + "src": "2168:3:23" + }, + "nativeSrc": "2168:6:23", + "nodeType": "YulFunctionCall", + "src": "2168:6:23" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "2151:3:23", + "nodeType": "YulIdentifier", + "src": "2151:3:23" + }, + "nativeSrc": "2151:24:23", + "nodeType": "YulFunctionCall", + "src": "2151:24:23" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "2147:3:23", + "nodeType": "YulIdentifier", + "src": "2147:3:23" + }, + "nativeSrc": "2147:29:23", + "nodeType": "YulFunctionCall", + "src": "2147:29:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "2137:3:23", + "nodeType": "YulIdentifier", + "src": "2137:3:23" + }, + "nativeSrc": "2137:40:23", + "nodeType": "YulFunctionCall", + "src": "2137:40:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2183:1:23", + "nodeType": "YulLiteral", + "src": "2183:1:23", + "type": "", + "value": "1" + }, + { + "name": "len", + "nativeSrc": "2186:3:23", + "nodeType": "YulIdentifier", + "src": "2186:3:23" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "2179:3:23", + "nodeType": "YulIdentifier", + "src": "2179:3:23" + }, + "nativeSrc": "2179:11:23", + "nodeType": "YulFunctionCall", + "src": "2179:11:23" + } + ], + "functionName": { + "name": "or", + "nativeSrc": "2134:2:23", + "nodeType": "YulIdentifier", + "src": "2134:2:23" + }, + "nativeSrc": "2134:57:23", + "nodeType": "YulFunctionCall", + "src": "2134:57:23" + }, + "variableNames": [ + { + "name": "used", + "nativeSrc": "2126:4:23", + "nodeType": "YulIdentifier", + "src": "2126:4:23" + } + ] + } + ] + }, + "name": "extract_used_part_and_set_length_of_short_byte_array", + "nativeSrc": "2031:166:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "data", + "nativeSrc": "2093:4:23", + "nodeType": "YulTypedName", + "src": "2093:4:23", + "type": "" + }, + { + "name": "len", + "nativeSrc": "2099:3:23", + "nodeType": "YulTypedName", + "src": "2099:3:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "used", + "nativeSrc": "2107:4:23", + "nodeType": "YulTypedName", + "src": "2107:4:23", + "type": "" + } + ], + "src": "2031:166:23" + }, + { + "body": { + "nativeSrc": "2298:1203:23", + "nodeType": "YulBlock", + "src": "2298:1203:23", + "statements": [ + { + "nativeSrc": "2308:24:23", + "nodeType": "YulVariableDeclaration", + "src": "2308:24:23", + "value": { + "arguments": [ + { + "name": "src", + "nativeSrc": "2328:3:23", + "nodeType": "YulIdentifier", + "src": "2328:3:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "2322:5:23", + "nodeType": "YulIdentifier", + "src": "2322:5:23" + }, + "nativeSrc": "2322:10:23", + "nodeType": "YulFunctionCall", + "src": "2322:10:23" + }, + "variables": [ + { + "name": "newLen", + "nativeSrc": "2312:6:23", + "nodeType": "YulTypedName", + "src": "2312:6:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "2375:22:23", + "nodeType": "YulBlock", + "src": "2375:22:23", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x41", + "nativeSrc": "2377:16:23", + "nodeType": "YulIdentifier", + "src": "2377:16:23" + }, + "nativeSrc": "2377:18:23", + "nodeType": "YulFunctionCall", + "src": "2377:18:23" + }, + "nativeSrc": "2377:18:23", + "nodeType": "YulExpressionStatement", + "src": "2377:18:23" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "newLen", + "nativeSrc": "2347:6:23", + "nodeType": "YulIdentifier", + "src": "2347:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2363:2:23", + "nodeType": "YulLiteral", + "src": "2363:2:23", + "type": "", + "value": "64" + }, + { + "kind": "number", + "nativeSrc": "2367:1:23", + "nodeType": "YulLiteral", + "src": "2367:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "2359:3:23", + "nodeType": "YulIdentifier", + "src": "2359:3:23" + }, + "nativeSrc": "2359:10:23", + "nodeType": "YulFunctionCall", + "src": "2359:10:23" + }, + { + "kind": "number", + "nativeSrc": "2371:1:23", + "nodeType": "YulLiteral", + "src": "2371:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "2355:3:23", + "nodeType": "YulIdentifier", + "src": "2355:3:23" + }, + "nativeSrc": "2355:18:23", + "nodeType": "YulFunctionCall", + "src": "2355:18:23" + } + ], + "functionName": { + "name": "gt", + "nativeSrc": "2344:2:23", + "nodeType": "YulIdentifier", + "src": "2344:2:23" + }, + "nativeSrc": "2344:30:23", + "nodeType": "YulFunctionCall", + "src": "2344:30:23" + }, + "nativeSrc": "2341:56:23", + "nodeType": "YulIf", + "src": "2341:56:23" + }, + { + "expression": { + "arguments": [ + { + "name": "slot", + "nativeSrc": "2450:4:23", + "nodeType": "YulIdentifier", + "src": "2450:4:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "slot", + "nativeSrc": "2488:4:23", + "nodeType": "YulIdentifier", + "src": "2488:4:23" + } + ], + "functionName": { + "name": "sload", + "nativeSrc": "2482:5:23", + "nodeType": "YulIdentifier", + "src": "2482:5:23" + }, + "nativeSrc": "2482:11:23", + "nodeType": "YulFunctionCall", + "src": "2482:11:23" + } + ], + "functionName": { + "name": "extract_byte_array_length", + "nativeSrc": "2456:25:23", + "nodeType": "YulIdentifier", + "src": "2456:25:23" + }, + "nativeSrc": "2456:38:23", + "nodeType": "YulFunctionCall", + "src": "2456:38:23" + }, + { + "name": "newLen", + "nativeSrc": "2496:6:23", + "nodeType": "YulIdentifier", + "src": "2496:6:23" + } + ], + "functionName": { + "name": "clean_up_bytearray_end_slots_string_storage", + "nativeSrc": "2406:43:23", + "nodeType": "YulIdentifier", + "src": "2406:43:23" + }, + "nativeSrc": "2406:97:23", + "nodeType": "YulFunctionCall", + "src": "2406:97:23" + }, + "nativeSrc": "2406:97:23", + "nodeType": "YulExpressionStatement", + "src": "2406:97:23" + }, + { + "nativeSrc": "2512:18:23", + "nodeType": "YulVariableDeclaration", + "src": "2512:18:23", + "value": { + "kind": "number", + "nativeSrc": "2529:1:23", + "nodeType": "YulLiteral", + "src": "2529:1:23", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "srcOffset", + "nativeSrc": "2516:9:23", + "nodeType": "YulTypedName", + "src": "2516:9:23", + "type": "" + } + ] + }, + { + "nativeSrc": "2539:17:23", + "nodeType": "YulAssignment", + "src": "2539:17:23", + "value": { + "kind": "number", + "nativeSrc": "2552:4:23", + "nodeType": "YulLiteral", + "src": "2552:4:23", + "type": "", + "value": "0x20" + }, + "variableNames": [ + { + "name": "srcOffset", + "nativeSrc": "2539:9:23", + "nodeType": "YulIdentifier", + "src": "2539:9:23" + } + ] + }, + { + "cases": [ + { + "body": { + "nativeSrc": "2602:642:23", + "nodeType": "YulBlock", + "src": "2602:642:23", + "statements": [ + { + "nativeSrc": "2616:35:23", + "nodeType": "YulVariableDeclaration", + "src": "2616:35:23", + "value": { + "arguments": [ + { + "name": "newLen", + "nativeSrc": "2635:6:23", + "nodeType": "YulIdentifier", + "src": "2635:6:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2647:2:23", + "nodeType": "YulLiteral", + "src": "2647:2:23", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "2643:3:23", + "nodeType": "YulIdentifier", + "src": "2643:3:23" + }, + "nativeSrc": "2643:7:23", + "nodeType": "YulFunctionCall", + "src": "2643:7:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "2631:3:23", + "nodeType": "YulIdentifier", + "src": "2631:3:23" + }, + "nativeSrc": "2631:20:23", + "nodeType": "YulFunctionCall", + "src": "2631:20:23" + }, + "variables": [ + { + "name": "loopEnd", + "nativeSrc": "2620:7:23", + "nodeType": "YulTypedName", + "src": "2620:7:23", + "type": "" + } + ] + }, + { + "nativeSrc": "2664:49:23", + "nodeType": "YulVariableDeclaration", + "src": "2664:49:23", + "value": { + "arguments": [ + { + "name": "slot", + "nativeSrc": "2708:4:23", + "nodeType": "YulIdentifier", + "src": "2708:4:23" + } + ], + "functionName": { + "name": "array_dataslot_string_storage", + "nativeSrc": "2678:29:23", + "nodeType": "YulIdentifier", + "src": "2678:29:23" + }, + "nativeSrc": "2678:35:23", + "nodeType": "YulFunctionCall", + "src": "2678:35:23" + }, + "variables": [ + { + "name": "dstPtr", + "nativeSrc": "2668:6:23", + "nodeType": "YulTypedName", + "src": "2668:6:23", + "type": "" + } + ] + }, + { + "nativeSrc": "2726:10:23", + "nodeType": "YulVariableDeclaration", + "src": "2726:10:23", + "value": { + "kind": "number", + "nativeSrc": "2735:1:23", + "nodeType": "YulLiteral", + "src": "2735:1:23", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "i", + "nativeSrc": "2730:1:23", + "nodeType": "YulTypedName", + "src": "2730:1:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "2806:165:23", + "nodeType": "YulBlock", + "src": "2806:165:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "dstPtr", + "nativeSrc": "2831:6:23", + "nodeType": "YulIdentifier", + "src": "2831:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "src", + "nativeSrc": "2849:3:23", + "nodeType": "YulIdentifier", + "src": "2849:3:23" + }, + { + "name": "srcOffset", + "nativeSrc": "2854:9:23", + "nodeType": "YulIdentifier", + "src": "2854:9:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2845:3:23", + "nodeType": "YulIdentifier", + "src": "2845:3:23" + }, + "nativeSrc": "2845:19:23", + "nodeType": "YulFunctionCall", + "src": "2845:19:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "2839:5:23", + "nodeType": "YulIdentifier", + "src": "2839:5:23" + }, + "nativeSrc": "2839:26:23", + "nodeType": "YulFunctionCall", + "src": "2839:26:23" + } + ], + "functionName": { + "name": "sstore", + "nativeSrc": "2824:6:23", + "nodeType": "YulIdentifier", + "src": "2824:6:23" + }, + "nativeSrc": "2824:42:23", + "nodeType": "YulFunctionCall", + "src": "2824:42:23" + }, + "nativeSrc": "2824:42:23", + "nodeType": "YulExpressionStatement", + "src": "2824:42:23" + }, + { + "nativeSrc": "2883:24:23", + "nodeType": "YulAssignment", + "src": "2883:24:23", + "value": { + "arguments": [ + { + "name": "dstPtr", + "nativeSrc": "2897:6:23", + "nodeType": "YulIdentifier", + "src": "2897:6:23" + }, + { + "kind": "number", + "nativeSrc": "2905:1:23", + "nodeType": "YulLiteral", + "src": "2905:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2893:3:23", + "nodeType": "YulIdentifier", + "src": "2893:3:23" + }, + "nativeSrc": "2893:14:23", + "nodeType": "YulFunctionCall", + "src": "2893:14:23" + }, + "variableNames": [ + { + "name": "dstPtr", + "nativeSrc": "2883:6:23", + "nodeType": "YulIdentifier", + "src": "2883:6:23" + } + ] + }, + { + "nativeSrc": "2924:33:23", + "nodeType": "YulAssignment", + "src": "2924:33:23", + "value": { + "arguments": [ + { + "name": "srcOffset", + "nativeSrc": "2941:9:23", + "nodeType": "YulIdentifier", + "src": "2941:9:23" + }, + { + "kind": "number", + "nativeSrc": "2952:4:23", + "nodeType": "YulLiteral", + "src": "2952:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2937:3:23", + "nodeType": "YulIdentifier", + "src": "2937:3:23" + }, + "nativeSrc": "2937:20:23", + "nodeType": "YulFunctionCall", + "src": "2937:20:23" + }, + "variableNames": [ + { + "name": "srcOffset", + "nativeSrc": "2924:9:23", + "nodeType": "YulIdentifier", + "src": "2924:9:23" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "i", + "nativeSrc": "2760:1:23", + "nodeType": "YulIdentifier", + "src": "2760:1:23" + }, + { + "name": "loopEnd", + "nativeSrc": "2763:7:23", + "nodeType": "YulIdentifier", + "src": "2763:7:23" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "2757:2:23", + "nodeType": "YulIdentifier", + "src": "2757:2:23" + }, + "nativeSrc": "2757:14:23", + "nodeType": "YulFunctionCall", + "src": "2757:14:23" + }, + "nativeSrc": "2749:222:23", + "nodeType": "YulForLoop", + "post": { + "nativeSrc": "2772:21:23", + "nodeType": "YulBlock", + "src": "2772:21:23", + "statements": [ + { + "nativeSrc": "2774:17:23", + "nodeType": "YulAssignment", + "src": "2774:17:23", + "value": { + "arguments": [ + { + "name": "i", + "nativeSrc": "2783:1:23", + "nodeType": "YulIdentifier", + "src": "2783:1:23" + }, + { + "kind": "number", + "nativeSrc": "2786:4:23", + "nodeType": "YulLiteral", + "src": "2786:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2779:3:23", + "nodeType": "YulIdentifier", + "src": "2779:3:23" + }, + "nativeSrc": "2779:12:23", + "nodeType": "YulFunctionCall", + "src": "2779:12:23" + }, + "variableNames": [ + { + "name": "i", + "nativeSrc": "2774:1:23", + "nodeType": "YulIdentifier", + "src": "2774:1:23" + } + ] + } + ] + }, + "pre": { + "nativeSrc": "2753:3:23", + "nodeType": "YulBlock", + "src": "2753:3:23", + "statements": [] + }, + "src": "2749:222:23" + }, + { + "body": { + "nativeSrc": "3019:166:23", + "nodeType": "YulBlock", + "src": "3019:166:23", + "statements": [ + { + "nativeSrc": "3037:43:23", + "nodeType": "YulVariableDeclaration", + "src": "3037:43:23", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "src", + "nativeSrc": "3064:3:23", + "nodeType": "YulIdentifier", + "src": "3064:3:23" + }, + { + "name": "srcOffset", + "nativeSrc": "3069:9:23", + "nodeType": "YulIdentifier", + "src": "3069:9:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3060:3:23", + "nodeType": "YulIdentifier", + "src": "3060:3:23" + }, + "nativeSrc": "3060:19:23", + "nodeType": "YulFunctionCall", + "src": "3060:19:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "3054:5:23", + "nodeType": "YulIdentifier", + "src": "3054:5:23" + }, + "nativeSrc": "3054:26:23", + "nodeType": "YulFunctionCall", + "src": "3054:26:23" + }, + "variables": [ + { + "name": "lastValue", + "nativeSrc": "3041:9:23", + "nodeType": "YulTypedName", + "src": "3041:9:23", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "dstPtr", + "nativeSrc": "3104:6:23", + "nodeType": "YulIdentifier", + "src": "3104:6:23" + }, + { + "arguments": [ + { + "name": "lastValue", + "nativeSrc": "3116:9:23", + "nodeType": "YulIdentifier", + "src": "3116:9:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3143:1:23", + "nodeType": "YulLiteral", + "src": "3143:1:23", + "type": "", + "value": "3" + }, + { + "name": "newLen", + "nativeSrc": "3146:6:23", + "nodeType": "YulIdentifier", + "src": "3146:6:23" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "3139:3:23", + "nodeType": "YulIdentifier", + "src": "3139:3:23" + }, + "nativeSrc": "3139:14:23", + "nodeType": "YulFunctionCall", + "src": "3139:14:23" + }, + { + "kind": "number", + "nativeSrc": "3155:3:23", + "nodeType": "YulLiteral", + "src": "3155:3:23", + "type": "", + "value": "248" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "3135:3:23", + "nodeType": "YulIdentifier", + "src": "3135:3:23" + }, + "nativeSrc": "3135:24:23", + "nodeType": "YulFunctionCall", + "src": "3135:24:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3165:1:23", + "nodeType": "YulLiteral", + "src": "3165:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "3161:3:23", + "nodeType": "YulIdentifier", + "src": "3161:3:23" + }, + "nativeSrc": "3161:6:23", + "nodeType": "YulFunctionCall", + "src": "3161:6:23" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "3131:3:23", + "nodeType": "YulIdentifier", + "src": "3131:3:23" + }, + "nativeSrc": "3131:37:23", + "nodeType": "YulFunctionCall", + "src": "3131:37:23" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "3127:3:23", + "nodeType": "YulIdentifier", + "src": "3127:3:23" + }, + "nativeSrc": "3127:42:23", + "nodeType": "YulFunctionCall", + "src": "3127:42:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "3112:3:23", + "nodeType": "YulIdentifier", + "src": "3112:3:23" + }, + "nativeSrc": "3112:58:23", + "nodeType": "YulFunctionCall", + "src": "3112:58:23" + } + ], + "functionName": { + "name": "sstore", + "nativeSrc": "3097:6:23", + "nodeType": "YulIdentifier", + "src": "3097:6:23" + }, + "nativeSrc": "3097:74:23", + "nodeType": "YulFunctionCall", + "src": "3097:74:23" + }, + "nativeSrc": "3097:74:23", + "nodeType": "YulExpressionStatement", + "src": "3097:74:23" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "loopEnd", + "nativeSrc": "2990:7:23", + "nodeType": "YulIdentifier", + "src": "2990:7:23" + }, + { + "name": "newLen", + "nativeSrc": "2999:6:23", + "nodeType": "YulIdentifier", + "src": "2999:6:23" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "2987:2:23", + "nodeType": "YulIdentifier", + "src": "2987:2:23" + }, + "nativeSrc": "2987:19:23", + "nodeType": "YulFunctionCall", + "src": "2987:19:23" + }, + "nativeSrc": "2984:201:23", + "nodeType": "YulIf", + "src": "2984:201:23" + }, + { + "expression": { + "arguments": [ + { + "name": "slot", + "nativeSrc": "3205:4:23", + "nodeType": "YulIdentifier", + "src": "3205:4:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3219:1:23", + "nodeType": "YulLiteral", + "src": "3219:1:23", + "type": "", + "value": "1" + }, + { + "name": "newLen", + "nativeSrc": "3222:6:23", + "nodeType": "YulIdentifier", + "src": "3222:6:23" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "3215:3:23", + "nodeType": "YulIdentifier", + "src": "3215:3:23" + }, + "nativeSrc": "3215:14:23", + "nodeType": "YulFunctionCall", + "src": "3215:14:23" + }, + { + "kind": "number", + "nativeSrc": "3231:1:23", + "nodeType": "YulLiteral", + "src": "3231:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3211:3:23", + "nodeType": "YulIdentifier", + "src": "3211:3:23" + }, + "nativeSrc": "3211:22:23", + "nodeType": "YulFunctionCall", + "src": "3211:22:23" + } + ], + "functionName": { + "name": "sstore", + "nativeSrc": "3198:6:23", + "nodeType": "YulIdentifier", + "src": "3198:6:23" + }, + "nativeSrc": "3198:36:23", + "nodeType": "YulFunctionCall", + "src": "3198:36:23" + }, + "nativeSrc": "3198:36:23", + "nodeType": "YulExpressionStatement", + "src": "3198:36:23" + } + ] + }, + "nativeSrc": "2595:649:23", + "nodeType": "YulCase", + "src": "2595:649:23", + "value": { + "kind": "number", + "nativeSrc": "2600:1:23", + "nodeType": "YulLiteral", + "src": "2600:1:23", + "type": "", + "value": "1" + } + }, + { + "body": { + "nativeSrc": "3261:234:23", + "nodeType": "YulBlock", + "src": "3261:234:23", + "statements": [ + { + "nativeSrc": "3275:14:23", + "nodeType": "YulVariableDeclaration", + "src": "3275:14:23", + "value": { + "kind": "number", + "nativeSrc": "3288:1:23", + "nodeType": "YulLiteral", + "src": "3288:1:23", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "value", + "nativeSrc": "3279:5:23", + "nodeType": "YulTypedName", + "src": "3279:5:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "3324:67:23", + "nodeType": "YulBlock", + "src": "3324:67:23", + "statements": [ + { + "nativeSrc": "3342:35:23", + "nodeType": "YulAssignment", + "src": "3342:35:23", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "src", + "nativeSrc": "3361:3:23", + "nodeType": "YulIdentifier", + "src": "3361:3:23" + }, + { + "name": "srcOffset", + "nativeSrc": "3366:9:23", + "nodeType": "YulIdentifier", + "src": "3366:9:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3357:3:23", + "nodeType": "YulIdentifier", + "src": "3357:3:23" + }, + "nativeSrc": "3357:19:23", + "nodeType": "YulFunctionCall", + "src": "3357:19:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "3351:5:23", + "nodeType": "YulIdentifier", + "src": "3351:5:23" + }, + "nativeSrc": "3351:26:23", + "nodeType": "YulFunctionCall", + "src": "3351:26:23" + }, + "variableNames": [ + { + "name": "value", + "nativeSrc": "3342:5:23", + "nodeType": "YulIdentifier", + "src": "3342:5:23" + } + ] + } + ] + }, + "condition": { + "name": "newLen", + "nativeSrc": "3305:6:23", + "nodeType": "YulIdentifier", + "src": "3305:6:23" + }, + "nativeSrc": "3302:89:23", + "nodeType": "YulIf", + "src": "3302:89:23" + }, + { + "expression": { + "arguments": [ + { + "name": "slot", + "nativeSrc": "3411:4:23", + "nodeType": "YulIdentifier", + "src": "3411:4:23" + }, + { + "arguments": [ + { + "name": "value", + "nativeSrc": "3470:5:23", + "nodeType": "YulIdentifier", + "src": "3470:5:23" + }, + { + "name": "newLen", + "nativeSrc": "3477:6:23", + "nodeType": "YulIdentifier", + "src": "3477:6:23" + } + ], + "functionName": { + "name": "extract_used_part_and_set_length_of_short_byte_array", + "nativeSrc": "3417:52:23", + "nodeType": "YulIdentifier", + "src": "3417:52:23" + }, + "nativeSrc": "3417:67:23", + "nodeType": "YulFunctionCall", + "src": "3417:67:23" + } + ], + "functionName": { + "name": "sstore", + "nativeSrc": "3404:6:23", + "nodeType": "YulIdentifier", + "src": "3404:6:23" + }, + "nativeSrc": "3404:81:23", + "nodeType": "YulFunctionCall", + "src": "3404:81:23" + }, + "nativeSrc": "3404:81:23", + "nodeType": "YulExpressionStatement", + "src": "3404:81:23" + } + ] + }, + "nativeSrc": "3253:242:23", + "nodeType": "YulCase", + "src": "3253:242:23", + "value": "default" + } + ], + "expression": { + "arguments": [ + { + "name": "newLen", + "nativeSrc": "2575:6:23", + "nodeType": "YulIdentifier", + "src": "2575:6:23" + }, + { + "kind": "number", + "nativeSrc": "2583:2:23", + "nodeType": "YulLiteral", + "src": "2583:2:23", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "gt", + "nativeSrc": "2572:2:23", + "nodeType": "YulIdentifier", + "src": "2572:2:23" + }, + "nativeSrc": "2572:14:23", + "nodeType": "YulFunctionCall", + "src": "2572:14:23" + }, + "nativeSrc": "2565:930:23", + "nodeType": "YulSwitch", + "src": "2565:930:23" + } + ] + }, + "name": "copy_byte_array_to_storage_from_t_string_memory_ptr_to_t_string_storage", + "nativeSrc": "2202:1299:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "slot", + "nativeSrc": "2283:4:23", + "nodeType": "YulTypedName", + "src": "2283:4:23", + "type": "" + }, + { + "name": "src", + "nativeSrc": "2289:3:23", + "nodeType": "YulTypedName", + "src": "2289:3:23", + "type": "" + } + ], + "src": "2202:1299:23" + }, + { + "body": { + "nativeSrc": "3719:276:23", + "nodeType": "YulBlock", + "src": "3719:276:23", + "statements": [ + { + "nativeSrc": "3729:27:23", + "nodeType": "YulAssignment", + "src": "3729:27:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3741:9:23", + "nodeType": "YulIdentifier", + "src": "3741:9:23" + }, + { + "kind": "number", + "nativeSrc": "3752:3:23", + "nodeType": "YulLiteral", + "src": "3752:3:23", + "type": "", + "value": "160" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3737:3:23", + "nodeType": "YulIdentifier", + "src": "3737:3:23" + }, + "nativeSrc": "3737:19:23", + "nodeType": "YulFunctionCall", + "src": "3737:19:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "3729:4:23", + "nodeType": "YulIdentifier", + "src": "3729:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3772:9:23", + "nodeType": "YulIdentifier", + "src": "3772:9:23" + }, + { + "name": "value0", + "nativeSrc": "3783:6:23", + "nodeType": "YulIdentifier", + "src": "3783:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3765:6:23", + "nodeType": "YulIdentifier", + "src": "3765:6:23" + }, + "nativeSrc": "3765:25:23", + "nodeType": "YulFunctionCall", + "src": "3765:25:23" + }, + "nativeSrc": "3765:25:23", + "nodeType": "YulExpressionStatement", + "src": "3765:25:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3810:9:23", + "nodeType": "YulIdentifier", + "src": "3810:9:23" + }, + { + "kind": "number", + "nativeSrc": "3821:2:23", + "nodeType": "YulLiteral", + "src": "3821:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3806:3:23", + "nodeType": "YulIdentifier", + "src": "3806:3:23" + }, + "nativeSrc": "3806:18:23", + "nodeType": "YulFunctionCall", + "src": "3806:18:23" + }, + { + "name": "value1", + "nativeSrc": "3826:6:23", + "nodeType": "YulIdentifier", + "src": "3826:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3799:6:23", + "nodeType": "YulIdentifier", + "src": "3799:6:23" + }, + "nativeSrc": "3799:34:23", + "nodeType": "YulFunctionCall", + "src": "3799:34:23" + }, + "nativeSrc": "3799:34:23", + "nodeType": "YulExpressionStatement", + "src": "3799:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3853:9:23", + "nodeType": "YulIdentifier", + "src": "3853:9:23" + }, + { + "kind": "number", + "nativeSrc": "3864:2:23", + "nodeType": "YulLiteral", + "src": "3864:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3849:3:23", + "nodeType": "YulIdentifier", + "src": "3849:3:23" + }, + "nativeSrc": "3849:18:23", + "nodeType": "YulFunctionCall", + "src": "3849:18:23" + }, + { + "name": "value2", + "nativeSrc": "3869:6:23", + "nodeType": "YulIdentifier", + "src": "3869:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3842:6:23", + "nodeType": "YulIdentifier", + "src": "3842:6:23" + }, + "nativeSrc": "3842:34:23", + "nodeType": "YulFunctionCall", + "src": "3842:34:23" + }, + "nativeSrc": "3842:34:23", + "nodeType": "YulExpressionStatement", + "src": "3842:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3896:9:23", + "nodeType": "YulIdentifier", + "src": "3896:9:23" + }, + { + "kind": "number", + "nativeSrc": "3907:2:23", + "nodeType": "YulLiteral", + "src": "3907:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3892:3:23", + "nodeType": "YulIdentifier", + "src": "3892:3:23" + }, + "nativeSrc": "3892:18:23", + "nodeType": "YulFunctionCall", + "src": "3892:18:23" + }, + { + "name": "value3", + "nativeSrc": "3912:6:23", + "nodeType": "YulIdentifier", + "src": "3912:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3885:6:23", + "nodeType": "YulIdentifier", + "src": "3885:6:23" + }, + "nativeSrc": "3885:34:23", + "nodeType": "YulFunctionCall", + "src": "3885:34:23" + }, + "nativeSrc": "3885:34:23", + "nodeType": "YulExpressionStatement", + "src": "3885:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3939:9:23", + "nodeType": "YulIdentifier", + "src": "3939:9:23" + }, + { + "kind": "number", + "nativeSrc": "3950:3:23", + "nodeType": "YulLiteral", + "src": "3950:3:23", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3935:3:23", + "nodeType": "YulIdentifier", + "src": "3935:3:23" + }, + "nativeSrc": "3935:19:23", + "nodeType": "YulFunctionCall", + "src": "3935:19:23" + }, + { + "arguments": [ + { + "name": "value4", + "nativeSrc": "3960:6:23", + "nodeType": "YulIdentifier", + "src": "3960:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3976:3:23", + "nodeType": "YulLiteral", + "src": "3976:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "3981:1:23", + "nodeType": "YulLiteral", + "src": "3981:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "3972:3:23", + "nodeType": "YulIdentifier", + "src": "3972:3:23" + }, + "nativeSrc": "3972:11:23", + "nodeType": "YulFunctionCall", + "src": "3972:11:23" + }, + { + "kind": "number", + "nativeSrc": "3985:1:23", + "nodeType": "YulLiteral", + "src": "3985:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "3968:3:23", + "nodeType": "YulIdentifier", + "src": "3968:3:23" + }, + "nativeSrc": "3968:19:23", + "nodeType": "YulFunctionCall", + "src": "3968:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "3956:3:23", + "nodeType": "YulIdentifier", + "src": "3956:3:23" + }, + "nativeSrc": "3956:32:23", + "nodeType": "YulFunctionCall", + "src": "3956:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3928:6:23", + "nodeType": "YulIdentifier", + "src": "3928:6:23" + }, + "nativeSrc": "3928:61:23", + "nodeType": "YulFunctionCall", + "src": "3928:61:23" + }, + "nativeSrc": "3928:61:23", + "nodeType": "YulExpressionStatement", + "src": "3928:61:23" + } + ] + }, + "name": "abi_encode_tuple_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__to_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__fromStack_reversed", + "nativeSrc": "3506:489:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "3656:9:23", + "nodeType": "YulTypedName", + "src": "3656:9:23", + "type": "" + }, + { + "name": "value4", + "nativeSrc": "3667:6:23", + "nodeType": "YulTypedName", + "src": "3667:6:23", + "type": "" + }, + { + "name": "value3", + "nativeSrc": "3675:6:23", + "nodeType": "YulTypedName", + "src": "3675:6:23", + "type": "" + }, + { + "name": "value2", + "nativeSrc": "3683:6:23", + "nodeType": "YulTypedName", + "src": "3683:6:23", + "type": "" + }, + { + "name": "value1", + "nativeSrc": "3691:6:23", + "nodeType": "YulTypedName", + "src": "3691:6:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "3699:6:23", + "nodeType": "YulTypedName", + "src": "3699:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "3710:4:23", + "nodeType": "YulTypedName", + "src": "3710:4:23", + "type": "" + } + ], + "src": "3506:489:23" + }, + { + "body": { + "nativeSrc": "4121:297:23", + "nodeType": "YulBlock", + "src": "4121:297:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4138:9:23", + "nodeType": "YulIdentifier", + "src": "4138:9:23" + }, + { + "kind": "number", + "nativeSrc": "4149:2:23", + "nodeType": "YulLiteral", + "src": "4149:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4131:6:23", + "nodeType": "YulIdentifier", + "src": "4131:6:23" + }, + "nativeSrc": "4131:21:23", + "nodeType": "YulFunctionCall", + "src": "4131:21:23" + }, + "nativeSrc": "4131:21:23", + "nodeType": "YulExpressionStatement", + "src": "4131:21:23" + }, + { + "nativeSrc": "4161:27:23", + "nodeType": "YulVariableDeclaration", + "src": "4161:27:23", + "value": { + "arguments": [ + { + "name": "value0", + "nativeSrc": "4181:6:23", + "nodeType": "YulIdentifier", + "src": "4181:6:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "4175:5:23", + "nodeType": "YulIdentifier", + "src": "4175:5:23" + }, + "nativeSrc": "4175:13:23", + "nodeType": "YulFunctionCall", + "src": "4175:13:23" + }, + "variables": [ + { + "name": "length", + "nativeSrc": "4165:6:23", + "nodeType": "YulTypedName", + "src": "4165:6:23", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4208:9:23", + "nodeType": "YulIdentifier", + "src": "4208:9:23" + }, + { + "kind": "number", + "nativeSrc": "4219:2:23", + "nodeType": "YulLiteral", + "src": "4219:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4204:3:23", + "nodeType": "YulIdentifier", + "src": "4204:3:23" + }, + "nativeSrc": "4204:18:23", + "nodeType": "YulFunctionCall", + "src": "4204:18:23" + }, + { + "name": "length", + "nativeSrc": "4224:6:23", + "nodeType": "YulIdentifier", + "src": "4224:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4197:6:23", + "nodeType": "YulIdentifier", + "src": "4197:6:23" + }, + "nativeSrc": "4197:34:23", + "nodeType": "YulFunctionCall", + "src": "4197:34:23" + }, + "nativeSrc": "4197:34:23", + "nodeType": "YulExpressionStatement", + "src": "4197:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4250:9:23", + "nodeType": "YulIdentifier", + "src": "4250:9:23" + }, + { + "kind": "number", + "nativeSrc": "4261:2:23", + "nodeType": "YulLiteral", + "src": "4261:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4246:3:23", + "nodeType": "YulIdentifier", + "src": "4246:3:23" + }, + "nativeSrc": "4246:18:23", + "nodeType": "YulFunctionCall", + "src": "4246:18:23" + }, + { + "arguments": [ + { + "name": "value0", + "nativeSrc": "4270:6:23", + "nodeType": "YulIdentifier", + "src": "4270:6:23" + }, + { + "kind": "number", + "nativeSrc": "4278:2:23", + "nodeType": "YulLiteral", + "src": "4278:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4266:3:23", + "nodeType": "YulIdentifier", + "src": "4266:3:23" + }, + "nativeSrc": "4266:15:23", + "nodeType": "YulFunctionCall", + "src": "4266:15:23" + }, + { + "name": "length", + "nativeSrc": "4283:6:23", + "nodeType": "YulIdentifier", + "src": "4283:6:23" + } + ], + "functionName": { + "name": "mcopy", + "nativeSrc": "4240:5:23", + "nodeType": "YulIdentifier", + "src": "4240:5:23" + }, + "nativeSrc": "4240:50:23", + "nodeType": "YulFunctionCall", + "src": "4240:50:23" + }, + "nativeSrc": "4240:50:23", + "nodeType": "YulExpressionStatement", + "src": "4240:50:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4314:9:23", + "nodeType": "YulIdentifier", + "src": "4314:9:23" + }, + { + "name": "length", + "nativeSrc": "4325:6:23", + "nodeType": "YulIdentifier", + "src": "4325:6:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4310:3:23", + "nodeType": "YulIdentifier", + "src": "4310:3:23" + }, + "nativeSrc": "4310:22:23", + "nodeType": "YulFunctionCall", + "src": "4310:22:23" + }, + { + "kind": "number", + "nativeSrc": "4334:2:23", + "nodeType": "YulLiteral", + "src": "4334:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4306:3:23", + "nodeType": "YulIdentifier", + "src": "4306:3:23" + }, + "nativeSrc": "4306:31:23", + "nodeType": "YulFunctionCall", + "src": "4306:31:23" + }, + { + "kind": "number", + "nativeSrc": "4339:1:23", + "nodeType": "YulLiteral", + "src": "4339:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4299:6:23", + "nodeType": "YulIdentifier", + "src": "4299:6:23" + }, + "nativeSrc": "4299:42:23", + "nodeType": "YulFunctionCall", + "src": "4299:42:23" + }, + "nativeSrc": "4299:42:23", + "nodeType": "YulExpressionStatement", + "src": "4299:42:23" + }, + { + "nativeSrc": "4350:62:23", + "nodeType": "YulAssignment", + "src": "4350:62:23", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4366:9:23", + "nodeType": "YulIdentifier", + "src": "4366:9:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "length", + "nativeSrc": "4385:6:23", + "nodeType": "YulIdentifier", + "src": "4385:6:23" + }, + { + "kind": "number", + "nativeSrc": "4393:2:23", + "nodeType": "YulLiteral", + "src": "4393:2:23", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4381:3:23", + "nodeType": "YulIdentifier", + "src": "4381:3:23" + }, + "nativeSrc": "4381:15:23", + "nodeType": "YulFunctionCall", + "src": "4381:15:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "4402:2:23", + "nodeType": "YulLiteral", + "src": "4402:2:23", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "4398:3:23", + "nodeType": "YulIdentifier", + "src": "4398:3:23" + }, + "nativeSrc": "4398:7:23", + "nodeType": "YulFunctionCall", + "src": "4398:7:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "4377:3:23", + "nodeType": "YulIdentifier", + "src": "4377:3:23" + }, + "nativeSrc": "4377:29:23", + "nodeType": "YulFunctionCall", + "src": "4377:29:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4362:3:23", + "nodeType": "YulIdentifier", + "src": "4362:3:23" + }, + "nativeSrc": "4362:45:23", + "nodeType": "YulFunctionCall", + "src": "4362:45:23" + }, + { + "kind": "number", + "nativeSrc": "4409:2:23", + "nodeType": "YulLiteral", + "src": "4409:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4358:3:23", + "nodeType": "YulIdentifier", + "src": "4358:3:23" + }, + "nativeSrc": "4358:54:23", + "nodeType": "YulFunctionCall", + "src": "4358:54:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "4350:4:23", + "nodeType": "YulIdentifier", + "src": "4350:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "4000:418:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "4090:9:23", + "nodeType": "YulTypedName", + "src": "4090:9:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "4101:6:23", + "nodeType": "YulTypedName", + "src": "4101:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "4112:4:23", + "nodeType": "YulTypedName", + "src": "4112:4:23", + "type": "" + } + ], + "src": "4000:418:23" + }, + { + "body": { + "nativeSrc": "4517:203:23", + "nodeType": "YulBlock", + "src": "4517:203:23", + "statements": [ + { + "nativeSrc": "4527:26:23", + "nodeType": "YulVariableDeclaration", + "src": "4527:26:23", + "value": { + "arguments": [ + { + "name": "array", + "nativeSrc": "4547:5:23", + "nodeType": "YulIdentifier", + "src": "4547:5:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "4541:5:23", + "nodeType": "YulIdentifier", + "src": "4541:5:23" + }, + "nativeSrc": "4541:12:23", + "nodeType": "YulFunctionCall", + "src": "4541:12:23" + }, + "variables": [ + { + "name": "length", + "nativeSrc": "4531:6:23", + "nodeType": "YulTypedName", + "src": "4531:6:23", + "type": "" + } + ] + }, + { + "nativeSrc": "4562:32:23", + "nodeType": "YulAssignment", + "src": "4562:32:23", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "array", + "nativeSrc": "4581:5:23", + "nodeType": "YulIdentifier", + "src": "4581:5:23" + }, + { + "kind": "number", + "nativeSrc": "4588:4:23", + "nodeType": "YulLiteral", + "src": "4588:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4577:3:23", + "nodeType": "YulIdentifier", + "src": "4577:3:23" + }, + "nativeSrc": "4577:16:23", + "nodeType": "YulFunctionCall", + "src": "4577:16:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "4571:5:23", + "nodeType": "YulIdentifier", + "src": "4571:5:23" + }, + "nativeSrc": "4571:23:23", + "nodeType": "YulFunctionCall", + "src": "4571:23:23" + }, + "variableNames": [ + { + "name": "value", + "nativeSrc": "4562:5:23", + "nodeType": "YulIdentifier", + "src": "4562:5:23" + } + ] + }, + { + "body": { + "nativeSrc": "4631:83:23", + "nodeType": "YulBlock", + "src": "4631:83:23", + "statements": [ + { + "nativeSrc": "4645:59:23", + "nodeType": "YulAssignment", + "src": "4645:59:23", + "value": { + "arguments": [ + { + "name": "value", + "nativeSrc": "4658:5:23", + "nodeType": "YulIdentifier", + "src": "4658:5:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "4673:1:23", + "nodeType": "YulLiteral", + "src": "4673:1:23", + "type": "", + "value": "3" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "4680:4:23", + "nodeType": "YulLiteral", + "src": "4680:4:23", + "type": "", + "value": "0x20" + }, + { + "name": "length", + "nativeSrc": "4686:6:23", + "nodeType": "YulIdentifier", + "src": "4686:6:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "4676:3:23", + "nodeType": "YulIdentifier", + "src": "4676:3:23" + }, + "nativeSrc": "4676:17:23", + "nodeType": "YulFunctionCall", + "src": "4676:17:23" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "4669:3:23", + "nodeType": "YulIdentifier", + "src": "4669:3:23" + }, + "nativeSrc": "4669:25:23", + "nodeType": "YulFunctionCall", + "src": "4669:25:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "4700:1:23", + "nodeType": "YulLiteral", + "src": "4700:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "4696:3:23", + "nodeType": "YulIdentifier", + "src": "4696:3:23" + }, + "nativeSrc": "4696:6:23", + "nodeType": "YulFunctionCall", + "src": "4696:6:23" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "4665:3:23", + "nodeType": "YulIdentifier", + "src": "4665:3:23" + }, + "nativeSrc": "4665:38:23", + "nodeType": "YulFunctionCall", + "src": "4665:38:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "4654:3:23", + "nodeType": "YulIdentifier", + "src": "4654:3:23" + }, + "nativeSrc": "4654:50:23", + "nodeType": "YulFunctionCall", + "src": "4654:50:23" + }, + "variableNames": [ + { + "name": "value", + "nativeSrc": "4645:5:23", + "nodeType": "YulIdentifier", + "src": "4645:5:23" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "length", + "nativeSrc": "4609:6:23", + "nodeType": "YulIdentifier", + "src": "4609:6:23" + }, + { + "kind": "number", + "nativeSrc": "4617:4:23", + "nodeType": "YulLiteral", + "src": "4617:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "4606:2:23", + "nodeType": "YulIdentifier", + "src": "4606:2:23" + }, + "nativeSrc": "4606:16:23", + "nodeType": "YulFunctionCall", + "src": "4606:16:23" + }, + "nativeSrc": "4603:111:23", + "nodeType": "YulIf", + "src": "4603:111:23" + } + ] + }, + "name": "convert_bytes_to_fixedbytes_from_t_bytes_memory_ptr_to_t_bytes32", + "nativeSrc": "4423:297:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "array", + "nativeSrc": "4497:5:23", + "nodeType": "YulTypedName", + "src": "4497:5:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value", + "nativeSrc": "4507:5:23", + "nodeType": "YulTypedName", + "src": "4507:5:23", + "type": "" + } + ], + "src": "4423:297:23" + } + ] + }, + "contents": "{\n { }\n function abi_decode_tuple_t_address_fromMemory(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n let value := mload(headStart)\n if iszero(eq(value, and(value, sub(shl(160, 1), 1)))) { revert(0, 0) }\n value0 := value\n }\n function abi_encode_tuple_t_address__to_t_address__fromStack_reversed(headStart, value0) -> tail\n {\n tail := add(headStart, 32)\n mstore(headStart, and(value0, sub(shl(160, 1), 1)))\n }\n function abi_encode_tuple_t_stringliteral_480a3d2cf1e4838d740f40eac57f23eb6facc0baaf1a65a7b61df6a5a00ed368__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 19)\n mstore(add(headStart, 64), \"Invalid destination\")\n tail := add(headStart, 96)\n }\n function panic_error_0x41()\n {\n mstore(0, shl(224, 0x4e487b71))\n mstore(4, 0x41)\n revert(0, 0x24)\n }\n function extract_byte_array_length(data) -> length\n {\n length := shr(1, data)\n let outOfPlaceEncoding := and(data, 1)\n if iszero(outOfPlaceEncoding) { length := and(length, 0x7f) }\n if eq(outOfPlaceEncoding, lt(length, 32))\n {\n mstore(0, shl(224, 0x4e487b71))\n mstore(4, 0x22)\n revert(0, 0x24)\n }\n }\n function array_dataslot_string_storage(ptr) -> data\n {\n mstore(0, ptr)\n data := keccak256(0, 0x20)\n }\n function clean_up_bytearray_end_slots_string_storage(array, len, startIndex)\n {\n if gt(len, 31)\n {\n mstore(0, array)\n let data := keccak256(0, 0x20)\n let deleteStart := add(data, shr(5, add(startIndex, 31)))\n if lt(startIndex, 0x20) { deleteStart := data }\n let _1 := add(data, shr(5, add(len, 31)))\n let start := deleteStart\n for { } lt(start, _1) { start := add(start, 1) }\n { sstore(start, 0) }\n }\n }\n function extract_used_part_and_set_length_of_short_byte_array(data, len) -> used\n {\n used := or(and(data, not(shr(shl(3, len), not(0)))), shl(1, len))\n }\n function copy_byte_array_to_storage_from_t_string_memory_ptr_to_t_string_storage(slot, src)\n {\n let newLen := mload(src)\n if gt(newLen, sub(shl(64, 1), 1)) { panic_error_0x41() }\n clean_up_bytearray_end_slots_string_storage(slot, extract_byte_array_length(sload(slot)), newLen)\n let srcOffset := 0\n srcOffset := 0x20\n switch gt(newLen, 31)\n case 1 {\n let loopEnd := and(newLen, not(31))\n let dstPtr := array_dataslot_string_storage(slot)\n let i := 0\n for { } lt(i, loopEnd) { i := add(i, 0x20) }\n {\n sstore(dstPtr, mload(add(src, srcOffset)))\n dstPtr := add(dstPtr, 1)\n srcOffset := add(srcOffset, 0x20)\n }\n if lt(loopEnd, newLen)\n {\n let lastValue := mload(add(src, srcOffset))\n sstore(dstPtr, and(lastValue, not(shr(and(shl(3, newLen), 248), not(0)))))\n }\n sstore(slot, add(shl(1, newLen), 1))\n }\n default {\n let value := 0\n if newLen\n {\n value := mload(add(src, srcOffset))\n }\n sstore(slot, extract_used_part_and_set_length_of_short_byte_array(value, newLen))\n }\n }\n function abi_encode_tuple_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__to_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__fromStack_reversed(headStart, value4, value3, value2, value1, value0) -> tail\n {\n tail := add(headStart, 160)\n mstore(headStart, value0)\n mstore(add(headStart, 32), value1)\n mstore(add(headStart, 64), value2)\n mstore(add(headStart, 96), value3)\n mstore(add(headStart, 128), and(value4, sub(shl(160, 1), 1)))\n }\n function abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed(headStart, value0) -> tail\n {\n mstore(headStart, 32)\n let length := mload(value0)\n mstore(add(headStart, 32), length)\n mcopy(add(headStart, 64), add(value0, 32), length)\n mstore(add(add(headStart, length), 64), 0)\n tail := add(add(headStart, and(add(length, 31), not(31))), 64)\n }\n function convert_bytes_to_fixedbytes_from_t_bytes_memory_ptr_to_t_bytes32(array) -> value\n {\n let length := mload(array)\n value := mload(add(array, 0x20))\n if lt(length, 0x20)\n {\n value := and(value, shl(shl(3, sub(0x20, length)), not(0)))\n }\n }\n}", + "id": 23, + "language": "Yul", + "name": "#utility.yul" + } + ], + "linkReferences": {}, + "object": "610180604052348015610010575f5ffd5b50604051611a4d380380611a4d83398101604081905261002f91610294565b604080518082018252600c81526b2a37b5b2b72932b630bcb2b960a11b602080830191909152825180840190935260018352603160f81b9083015290338061009157604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b61009a816101d6565b5060017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00556100ca826001610225565b610120526100d9816002610225565b61014052815160208084019190912060e052815190820120610100524660a05261016560e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b60805250503060c0526001600160a01b0381166101c45760405162461bcd60e51b815260206004820152601360248201527f496e76616c69642064657374696e6174696f6e000000000000000000000000006044820152606401610088565b6001600160a01b03166101605261046b565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f6020835110156102405761023983610257565b9050610251565b8161024b8482610359565b5060ff90505b92915050565b5f5f829050601f81511115610281578260405163305a27a960e01b81526004016100889190610413565b805161028c82610448565b179392505050565b5f602082840312156102a4575f5ffd5b81516001600160a01b03811681146102ba575f5ffd5b9392505050565b634e487b7160e01b5f52604160045260245ffd5b600181811c908216806102e957607f821691505b60208210810361030757634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111561035457805f5260205f20601f840160051c810160208510156103325750805b601f840160051c820191505b81811015610351575f815560010161033e565b50505b505050565b81516001600160401b03811115610372576103726102c1565b6103868161038084546102d5565b8461030d565b6020601f8211600181146103b8575f83156103a15750848201515b5f19600385901b1c1916600184901b178455610351565b5f84815260208120601f198516915b828110156103e757878501518255602094850194600190920191016103c7565b508482101561040457868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b80516020808301519190811015610307575f1960209190910360031b1b16919050565b60805160a05160c05160e0516101005161012051610140516101605161156c6104e15f395f818160d701528181610525015281816105f4015281816109500152610bf801525f610d2d01525f610cfb01525f6111bc01525f61119401525f6110ef01525f61111901525f611143015261156c5ff3fe608060405260043610610092575f3560e01c80639e281a98116100575780639e281a9814610159578063d850124e14610178578063dcb79457146101c1578063f14210a6146101e0578063f2fde38b146101ff575f5ffd5b80632af83bfe1461009d578063715018a6146100b257806375bd6863146100c657806384b0196e146101165780638da5cb5b1461013d575f5ffd5b3661009957005b5f5ffd5b6100b06100ab3660046112dd565b61021e565b005b3480156100bd575f5ffd5b506100b06106ae565b3480156100d1575f5ffd5b506100f97f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b348015610121575f5ffd5b5061012a6106c1565b60405161010d979695949392919061134a565b348015610148575f5ffd5b505f546001600160a01b03166100f9565b348015610164575f5ffd5b506100b06101733660046113fb565b610703565b348015610183575f5ffd5b506101b16101923660046113fb565b600360209081525f928352604080842090915290825290205460ff1681565b604051901515815260200161010d565b3480156101cc575f5ffd5b506101b16101db3660046113fb565b61078b565b3480156101eb575f5ffd5b506100b06101fa366004611423565b6107b8565b34801561020a575f5ffd5b506100b061021936600461143a565b6108a7565b6102266108e1565b5f610237604083016020840161143a565b90506101208201356001600160a01b03821661028a5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21037bbb732b960991b60448201526064015b60405180910390fd5b5f610298602085018561143a565b6001600160a01b0316036102de5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2103a37b5b2b760991b6044820152606401610281565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff161561033e5760405162461bcd60e51b815260206004820152600a602482015269139bdb98d9481d5cd95960b21b6044820152606401610281565b8261014001354211156103855760405162461bcd60e51b815260206004820152600f60248201526e14185e5b1bd85908195e1c1a5c9959608a1b6044820152606401610281565b5f6103ee83610397602087018761143a565b60408701356103a960e0890189611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250505050610100890135876101408b013561090f565b90506001600160a01b038316610421826104106101808801610160890161149d565b876101800135886101a001356109db565b6001600160a01b0316146104655760405162461bcd60e51b815260206004820152600b60248201526a496e76616c69642073696760a81b6044820152606401610281565b83610100013534146104b95760405162461bcd60e51b815260206004820152601c60248201527f496e636f7272656374204554482076616c75652070726f7669646564000000006044820152606401610281565b6001600160a01b0383165f9081526003602090815260408083208584528252909120805460ff19166001179055610520906104f69086018661143a565b846040870135606088013561051160a08a0160808b0161149d565b8960a001358a60c00135610a07565b6105667f00000000000000000000000000000000000000000000000000000000000000006040860135610556602088018861143a565b6001600160a01b03169190610b75565b5f6105b261057760e0870187611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250349250610bf4915050565b9050806105ef5760405162461bcd60e51b815260206004820152600b60248201526a10d85b1b0819985a5b195960aa1b6044820152606401610281565b6106217f00000000000000000000000000000000000000000000000000000000000000005f610556602089018961143a565b61062e602086018661143a565b6001600160a01b0316846001600160a01b03167f78129a649632642d8e9f346c85d9efb70d32d50a36774c4585491a9228bbd350876040013560405161067691815260200190565b60405180910390a3505050506106ab60017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b50565b6106b6610c79565b6106bf5f610ca5565b565b5f6060805f5f5f60606106d2610cf4565b6106da610d26565b604080515f80825260208201909252600f60f81b9b939a50919850469750309650945092509050565b61070b610c79565b61073061071f5f546001600160a01b031690565b6001600160a01b0384169083610d53565b5f546001600160a01b03166001600160a01b0316826001600160a01b03167fa0524ee0fd8662d6c046d199da2a6d3dc49445182cec055873a5bb9c2843c8e08360405161077f91815260200190565b60405180910390a35050565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff165b92915050565b6107c0610c79565b5f80546040516001600160a01b039091169083908381818185875af1925050503d805f811461080a576040519150601f19603f3d011682016040523d82523d5f602084013e61080f565b606091505b50509050806108565760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610281565b5f546001600160a01b03166001600160a01b03167f6148672a948a12b8e0bf92a9338349b9ac890fad62a234abaf0a4da99f62cfcc8360405161089b91815260200190565b60405180910390a25050565b6108af610c79565b6001600160a01b0381166108d857604051631e4fbdf760e01b81525f6004820152602401610281565b6106ab81610ca5565b6108e9610d60565b60027f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b8351602080860191909120604080517ff0543e2024fd0ae16ccb842686c2733758ec65acfd69fb599c05b286f8db8844938101939093526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691840191909152808a1660608401528816608083015260a0820187905260c082015260e08101849052610100810183905261012081018290525f906109cf906101400160405160208183030381529060405280519060200120610da2565b98975050505050505050565b5f5f5f5f6109eb88888888610dce565b9250925092506109fb8282610e96565b50909695505050505050565b60405163d505accf60e01b81526001600160a01b038781166004830152306024830152604482018790526064820186905260ff8516608483015260a4820184905260c4820183905288169063d505accf9060e4015f604051808303815f87803b158015610a72575f5ffd5b505af1925050508015610a83575060015b610b5757604051636eb1769f60e11b81526001600160a01b03878116600483015230602483015286919089169063dd62ed3e90604401602060405180830381865afa158015610ad4573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610af891906114bd565b1015610b575760405162461bcd60e51b815260206004820152602860248201527f5065726d6974206661696c656420616e6420696e73756666696369656e7420616044820152676c6c6f77616e636560c01b6064820152608401610281565b610b6c6001600160a01b038816873088610f52565b50505050505050565b610b818383835f610f8e565b610bef57610b9283835f6001610f8e565b610bba57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b610bc78383836001610f8e565b610bef57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b505050565b5f5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168385604051610c2f91906114d4565b5f6040518083038185875af1925050503d805f8114610c69576040519150601f19603f3d011682016040523d82523d5f602084013e610c6e565b606091505b509095945050505050565b5f546001600160a01b031633146106bf5760405163118cdaa760e01b8152336004820152602401610281565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006001610ff0565b905090565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006002610ff0565b610bc78383836001611099565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00546002036106bf57604051633ee5aeb560e01b815260040160405180910390fd5b5f6107b2610dae6110e3565b8360405161190160f01b8152600281019290925260228201526042902090565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115610e0757505f91506003905082610e8c565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015610e58573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b038116610e8357505f925060019150829050610e8c565b92505f91508190505b9450945094915050565b5f826003811115610ea957610ea96114ea565b03610eb2575050565b6001826003811115610ec657610ec66114ea565b03610ee45760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115610ef857610ef86114ea565b03610f195760405163fce698f760e01b815260048101829052602401610281565b6003826003811115610f2d57610f2d6114ea565b03610f4e576040516335e2f38360e21b815260048101829052602401610281565b5050565b610f6084848484600161120c565b610f8857604051635274afe760e01b81526001600160a01b0385166004820152602401610281565b50505050565b60405163095ea7b360e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f873b113d1516831692505b60405250949350505050565b606060ff831461100a5761100383611279565b90506107b2565b818054611016906114fe565b80601f0160208091040260200160405190810160405280929190818152602001828054611042906114fe565b801561108d5780601f106110645761010080835404028352916020019161108d565b820191905f5260205f20905b81548152906001019060200180831161107057829003601f168201915b505050505090506107b2565b60405163a9059cbb60e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561113b57507f000000000000000000000000000000000000000000000000000000000000000046145b1561116557507f000000000000000000000000000000000000000000000000000000000000000090565b610d21604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b6040516323b872dd60e01b5f8181526001600160a01b038781166004528616602452604485905291602083606481808c5af1925060015f5114831661126857838315161561125c573d5f823e3d81fd5b5f883b113d1516831692505b604052505f60605295945050505050565b60605f611285836112b6565b6040805160208082528183019092529192505f91906020820181803683375050509182525060208101929092525090565b5f60ff8216601f8111156107b257604051632cd44ac360e21b815260040160405180910390fd5b5f602082840312156112ed575f5ffd5b813567ffffffffffffffff811115611303575f5ffd5b82016101c08185031215611315575f5ffd5b9392505050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b60ff60f81b8816815260e060208201525f61136860e083018961131c565b828103604084015261137a818961131c565b606084018890526001600160a01b038716608085015260a0840186905283810360c0850152845180825260208087019350909101905f5b818110156113cf5783518352602093840193909201916001016113b1565b50909b9a5050505050505050505050565b80356001600160a01b03811681146113f6575f5ffd5b919050565b5f5f6040838503121561140c575f5ffd5b611415836113e0565b946020939093013593505050565b5f60208284031215611433575f5ffd5b5035919050565b5f6020828403121561144a575f5ffd5b611315826113e0565b5f5f8335601e19843603018112611468575f5ffd5b83018035915067ffffffffffffffff821115611482575f5ffd5b602001915036819003821315611496575f5ffd5b9250929050565b5f602082840312156114ad575f5ffd5b813560ff81168114611315575f5ffd5b5f602082840312156114cd575f5ffd5b5051919050565b5f82518060208501845e5f920191825250919050565b634e487b7160e01b5f52602160045260245ffd5b600181811c9082168061151257607f821691505b60208210810361153057634e487b7160e01b5f52602260045260245ffd5b5091905056fea26469706673582212209c34db2f6f83af136a5340cce7fe8ef554ea8eb633656fbf9bff3bd731aec40f64736f6c634300081c0033", + "opcodes": "PUSH2 0x180 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH2 0x1A4D CODESIZE SUB DUP1 PUSH2 0x1A4D DUP4 CODECOPY DUP2 ADD PUSH1 0x40 DUP2 SWAP1 MSTORE PUSH2 0x2F SWAP2 PUSH2 0x294 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD DUP3 MSTORE PUSH1 0xC DUP2 MSTORE PUSH12 0x2A37B5B2B72932B630BCB2B9 PUSH1 0xA1 SHL PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP3 MLOAD DUP1 DUP5 ADD SWAP1 SWAP4 MSTORE PUSH1 0x1 DUP4 MSTORE PUSH1 0x31 PUSH1 0xF8 SHL SWAP1 DUP4 ADD MSTORE SWAP1 CALLER DUP1 PUSH2 0x91 JUMPI PUSH1 0x40 MLOAD PUSH4 0x1E4FBDF7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH0 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0x9A DUP2 PUSH2 0x1D6 JUMP JUMPDEST POP PUSH1 0x1 PUSH32 0x9B779B17422D0DF92223018B32B4D1FA46E071723D6817E2486D003BECC55F00 SSTORE PUSH2 0xCA DUP3 PUSH1 0x1 PUSH2 0x225 JUMP JUMPDEST PUSH2 0x120 MSTORE PUSH2 0xD9 DUP2 PUSH1 0x2 PUSH2 0x225 JUMP JUMPDEST PUSH2 0x140 MSTORE DUP2 MLOAD PUSH1 0x20 DUP1 DUP5 ADD SWAP2 SWAP1 SWAP2 KECCAK256 PUSH1 0xE0 MSTORE DUP2 MLOAD SWAP1 DUP3 ADD KECCAK256 PUSH2 0x100 MSTORE CHAINID PUSH1 0xA0 MSTORE PUSH2 0x165 PUSH1 0xE0 MLOAD PUSH2 0x100 MLOAD PUSH1 0x40 DUP1 MLOAD PUSH32 0x8B73C3C69BB8FE3D512ECC4CF759CC79239F7B179B0FFACAA9A75D522B39400F PUSH1 0x20 DUP3 ADD MSTORE SWAP1 DUP2 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x60 DUP3 ADD MSTORE CHAINID PUSH1 0x80 DUP3 ADD MSTORE ADDRESS PUSH1 0xA0 DUP3 ADD MSTORE PUSH0 SWAP1 PUSH1 0xC0 ADD PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 DUP4 SUB SUB DUP2 MSTORE SWAP1 PUSH1 0x40 MSTORE DUP1 MLOAD SWAP1 PUSH1 0x20 ADD KECCAK256 SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x80 MSTORE POP POP ADDRESS PUSH1 0xC0 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND PUSH2 0x1C4 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x496E76616C69642064657374696E6174696F6E00000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x88 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH2 0x160 MSTORE PUSH2 0x46B JUMP JUMPDEST PUSH0 DUP1 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP4 DUP2 AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB NOT DUP4 AND DUP2 OR DUP5 SSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP3 AND SWAP3 DUP4 SWAP2 PUSH32 0x8BE0079C531659141344CD1FD0A4F28419497F9722A3DAAFE3B4186F6B6457E0 SWAP2 SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP4 MLOAD LT ISZERO PUSH2 0x240 JUMPI PUSH2 0x239 DUP4 PUSH2 0x257 JUMP JUMPDEST SWAP1 POP PUSH2 0x251 JUMP JUMPDEST DUP2 PUSH2 0x24B DUP5 DUP3 PUSH2 0x359 JUMP JUMPDEST POP PUSH1 0xFF SWAP1 POP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH0 PUSH0 DUP3 SWAP1 POP PUSH1 0x1F DUP2 MLOAD GT ISZERO PUSH2 0x281 JUMPI DUP3 PUSH1 0x40 MLOAD PUSH4 0x305A27A9 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x88 SWAP2 SWAP1 PUSH2 0x413 JUMP JUMPDEST DUP1 MLOAD PUSH2 0x28C DUP3 PUSH2 0x448 JUMP JUMPDEST OR SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x2A4 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP2 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND DUP2 EQ PUSH2 0x2BA JUMPI PUSH0 PUSH0 REVERT JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x41 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST PUSH1 0x1 DUP2 DUP2 SHR SWAP1 DUP3 AND DUP1 PUSH2 0x2E9 JUMPI PUSH1 0x7F DUP3 AND SWAP2 POP JUMPDEST PUSH1 0x20 DUP3 LT DUP2 SUB PUSH2 0x307 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x22 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x1F DUP3 GT ISZERO PUSH2 0x354 JUMPI DUP1 PUSH0 MSTORE PUSH1 0x20 PUSH0 KECCAK256 PUSH1 0x1F DUP5 ADD PUSH1 0x5 SHR DUP2 ADD PUSH1 0x20 DUP6 LT ISZERO PUSH2 0x332 JUMPI POP DUP1 JUMPDEST PUSH1 0x1F DUP5 ADD PUSH1 0x5 SHR DUP3 ADD SWAP2 POP JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x351 JUMPI PUSH0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0x33E JUMP JUMPDEST POP POP JUMPDEST POP POP POP JUMP JUMPDEST DUP2 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0x40 SHL SUB DUP2 GT ISZERO PUSH2 0x372 JUMPI PUSH2 0x372 PUSH2 0x2C1 JUMP JUMPDEST PUSH2 0x386 DUP2 PUSH2 0x380 DUP5 SLOAD PUSH2 0x2D5 JUMP JUMPDEST DUP5 PUSH2 0x30D JUMP JUMPDEST PUSH1 0x20 PUSH1 0x1F DUP3 GT PUSH1 0x1 DUP2 EQ PUSH2 0x3B8 JUMPI PUSH0 DUP4 ISZERO PUSH2 0x3A1 JUMPI POP DUP5 DUP3 ADD MLOAD JUMPDEST PUSH0 NOT PUSH1 0x3 DUP6 SWAP1 SHL SHR NOT AND PUSH1 0x1 DUP5 SWAP1 SHL OR DUP5 SSTORE PUSH2 0x351 JUMP JUMPDEST PUSH0 DUP5 DUP2 MSTORE PUSH1 0x20 DUP2 KECCAK256 PUSH1 0x1F NOT DUP6 AND SWAP2 JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0x3E7 JUMPI DUP8 DUP6 ADD MLOAD DUP3 SSTORE PUSH1 0x20 SWAP5 DUP6 ADD SWAP5 PUSH1 0x1 SWAP1 SWAP3 ADD SWAP2 ADD PUSH2 0x3C7 JUMP JUMPDEST POP DUP5 DUP3 LT ISZERO PUSH2 0x404 JUMPI DUP7 DUP5 ADD MLOAD PUSH0 NOT PUSH1 0x3 DUP8 SWAP1 SHL PUSH1 0xF8 AND SHR NOT AND DUP2 SSTORE JUMPDEST POP POP POP POP PUSH1 0x1 SWAP1 DUP2 SHL ADD SWAP1 SSTORE POP JUMP JUMPDEST PUSH1 0x20 DUP2 MSTORE PUSH0 DUP3 MLOAD DUP1 PUSH1 0x20 DUP5 ADD MSTORE DUP1 PUSH1 0x20 DUP6 ADD PUSH1 0x40 DUP6 ADD MCOPY PUSH0 PUSH1 0x40 DUP3 DUP6 ADD ADD MSTORE PUSH1 0x40 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND DUP5 ADD ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST DUP1 MLOAD PUSH1 0x20 DUP1 DUP4 ADD MLOAD SWAP2 SWAP1 DUP2 LT ISZERO PUSH2 0x307 JUMPI PUSH0 NOT PUSH1 0x20 SWAP2 SWAP1 SWAP2 SUB PUSH1 0x3 SHL SHL AND SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x80 MLOAD PUSH1 0xA0 MLOAD PUSH1 0xC0 MLOAD PUSH1 0xE0 MLOAD PUSH2 0x100 MLOAD PUSH2 0x120 MLOAD PUSH2 0x140 MLOAD PUSH2 0x160 MLOAD PUSH2 0x156C PUSH2 0x4E1 PUSH0 CODECOPY PUSH0 DUP2 DUP2 PUSH1 0xD7 ADD MSTORE DUP2 DUP2 PUSH2 0x525 ADD MSTORE DUP2 DUP2 PUSH2 0x5F4 ADD MSTORE DUP2 DUP2 PUSH2 0x950 ADD MSTORE PUSH2 0xBF8 ADD MSTORE PUSH0 PUSH2 0xD2D ADD MSTORE PUSH0 PUSH2 0xCFB ADD MSTORE PUSH0 PUSH2 0x11BC ADD MSTORE PUSH0 PUSH2 0x1194 ADD MSTORE PUSH0 PUSH2 0x10EF ADD MSTORE PUSH0 PUSH2 0x1119 ADD MSTORE PUSH0 PUSH2 0x1143 ADD MSTORE PUSH2 0x156C PUSH0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x92 JUMPI PUSH0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x9E281A98 GT PUSH2 0x57 JUMPI DUP1 PUSH4 0x9E281A98 EQ PUSH2 0x159 JUMPI DUP1 PUSH4 0xD850124E EQ PUSH2 0x178 JUMPI DUP1 PUSH4 0xDCB79457 EQ PUSH2 0x1C1 JUMPI DUP1 PUSH4 0xF14210A6 EQ PUSH2 0x1E0 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x1FF JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP1 PUSH4 0x2AF83BFE EQ PUSH2 0x9D JUMPI DUP1 PUSH4 0x715018A6 EQ PUSH2 0xB2 JUMPI DUP1 PUSH4 0x75BD6863 EQ PUSH2 0xC6 JUMPI DUP1 PUSH4 0x84B0196E EQ PUSH2 0x116 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x13D JUMPI PUSH0 PUSH0 REVERT JUMPDEST CALLDATASIZE PUSH2 0x99 JUMPI STOP JUMPDEST PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0xB0 PUSH2 0xAB CALLDATASIZE PUSH1 0x4 PUSH2 0x12DD JUMP JUMPDEST PUSH2 0x21E JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xBD JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xB0 PUSH2 0x6AE JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xD1 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xF9 PUSH32 0x0 DUP2 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP2 AND DUP2 MSTORE PUSH1 0x20 ADD JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x121 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x12A PUSH2 0x6C1 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x10D SWAP8 SWAP7 SWAP6 SWAP5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x134A JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x148 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH2 0xF9 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x164 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xB0 PUSH2 0x173 CALLDATASIZE PUSH1 0x4 PUSH2 0x13FB JUMP JUMPDEST PUSH2 0x703 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x183 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x1B1 PUSH2 0x192 CALLDATASIZE PUSH1 0x4 PUSH2 0x13FB JUMP JUMPDEST PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x40 MLOAD SWAP1 ISZERO ISZERO DUP2 MSTORE PUSH1 0x20 ADD PUSH2 0x10D JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1CC JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x1B1 PUSH2 0x1DB CALLDATASIZE PUSH1 0x4 PUSH2 0x13FB JUMP JUMPDEST PUSH2 0x78B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1EB JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xB0 PUSH2 0x1FA CALLDATASIZE PUSH1 0x4 PUSH2 0x1423 JUMP JUMPDEST PUSH2 0x7B8 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x20A JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xB0 PUSH2 0x219 CALLDATASIZE PUSH1 0x4 PUSH2 0x143A JUMP JUMPDEST PUSH2 0x8A7 JUMP JUMPDEST PUSH2 0x226 PUSH2 0x8E1 JUMP JUMPDEST PUSH0 PUSH2 0x237 PUSH1 0x40 DUP4 ADD PUSH1 0x20 DUP5 ADD PUSH2 0x143A JUMP JUMPDEST SWAP1 POP PUSH2 0x120 DUP3 ADD CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP3 AND PUSH2 0x28A JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xD PUSH1 0x24 DUP3 ADD MSTORE PUSH13 0x24B73B30B634B21037BBB732B9 PUSH1 0x99 SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH0 PUSH2 0x298 PUSH1 0x20 DUP6 ADD DUP6 PUSH2 0x143A JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND SUB PUSH2 0x2DE JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xD PUSH1 0x24 DUP3 ADD MSTORE PUSH13 0x24B73B30B634B2103A37B5B2B7 PUSH1 0x99 SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP3 AND PUSH0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP5 DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x33E JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xA PUSH1 0x24 DUP3 ADD MSTORE PUSH10 0x139BDB98D9481D5CD959 PUSH1 0xB2 SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST DUP3 PUSH2 0x140 ADD CALLDATALOAD TIMESTAMP GT ISZERO PUSH2 0x385 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xF PUSH1 0x24 DUP3 ADD MSTORE PUSH15 0x14185E5B1BD85908195E1C1A5C9959 PUSH1 0x8A SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH0 PUSH2 0x3EE DUP4 PUSH2 0x397 PUSH1 0x20 DUP8 ADD DUP8 PUSH2 0x143A JUMP JUMPDEST PUSH1 0x40 DUP8 ADD CALLDATALOAD PUSH2 0x3A9 PUSH1 0xE0 DUP10 ADD DUP10 PUSH2 0x1453 JUMP JUMPDEST DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY PUSH0 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP POP POP POP PUSH2 0x100 DUP10 ADD CALLDATALOAD DUP8 PUSH2 0x140 DUP12 ADD CALLDATALOAD PUSH2 0x90F JUMP JUMPDEST SWAP1 POP PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP4 AND PUSH2 0x421 DUP3 PUSH2 0x410 PUSH2 0x180 DUP9 ADD PUSH2 0x160 DUP10 ADD PUSH2 0x149D JUMP JUMPDEST DUP8 PUSH2 0x180 ADD CALLDATALOAD DUP9 PUSH2 0x1A0 ADD CALLDATALOAD PUSH2 0x9DB JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND EQ PUSH2 0x465 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xB PUSH1 0x24 DUP3 ADD MSTORE PUSH11 0x496E76616C696420736967 PUSH1 0xA8 SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST DUP4 PUSH2 0x100 ADD CALLDATALOAD CALLVALUE EQ PUSH2 0x4B9 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1C PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x496E636F7272656374204554482076616C75652070726F766964656400000000 PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP4 AND PUSH0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP6 DUP5 MSTORE DUP3 MSTORE SWAP1 SWAP2 KECCAK256 DUP1 SLOAD PUSH1 0xFF NOT AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0x520 SWAP1 PUSH2 0x4F6 SWAP1 DUP7 ADD DUP7 PUSH2 0x143A JUMP JUMPDEST DUP5 PUSH1 0x40 DUP8 ADD CALLDATALOAD PUSH1 0x60 DUP9 ADD CALLDATALOAD PUSH2 0x511 PUSH1 0xA0 DUP11 ADD PUSH1 0x80 DUP12 ADD PUSH2 0x149D JUMP JUMPDEST DUP10 PUSH1 0xA0 ADD CALLDATALOAD DUP11 PUSH1 0xC0 ADD CALLDATALOAD PUSH2 0xA07 JUMP JUMPDEST PUSH2 0x566 PUSH32 0x0 PUSH1 0x40 DUP7 ADD CALLDATALOAD PUSH2 0x556 PUSH1 0x20 DUP9 ADD DUP9 PUSH2 0x143A JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND SWAP2 SWAP1 PUSH2 0xB75 JUMP JUMPDEST PUSH0 PUSH2 0x5B2 PUSH2 0x577 PUSH1 0xE0 DUP8 ADD DUP8 PUSH2 0x1453 JUMP JUMPDEST DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY PUSH0 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP CALLVALUE SWAP3 POP PUSH2 0xBF4 SWAP2 POP POP JUMP JUMPDEST SWAP1 POP DUP1 PUSH2 0x5EF JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xB PUSH1 0x24 DUP3 ADD MSTORE PUSH11 0x10D85B1B0819985A5B1959 PUSH1 0xAA SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH2 0x621 PUSH32 0x0 PUSH0 PUSH2 0x556 PUSH1 0x20 DUP10 ADD DUP10 PUSH2 0x143A JUMP JUMPDEST PUSH2 0x62E PUSH1 0x20 DUP7 ADD DUP7 PUSH2 0x143A JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP5 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH32 0x78129A649632642D8E9F346C85D9EFB70D32D50A36774C4585491A9228BBD350 DUP8 PUSH1 0x40 ADD CALLDATALOAD PUSH1 0x40 MLOAD PUSH2 0x676 SWAP2 DUP2 MSTORE PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP POP POP PUSH2 0x6AB PUSH1 0x1 PUSH32 0x9B779B17422D0DF92223018B32B4D1FA46E071723D6817E2486D003BECC55F00 SSTORE JUMP JUMPDEST POP JUMP JUMPDEST PUSH2 0x6B6 PUSH2 0xC79 JUMP JUMPDEST PUSH2 0x6BF PUSH0 PUSH2 0xCA5 JUMP JUMPDEST JUMP JUMPDEST PUSH0 PUSH1 0x60 DUP1 PUSH0 PUSH0 PUSH0 PUSH1 0x60 PUSH2 0x6D2 PUSH2 0xCF4 JUMP JUMPDEST PUSH2 0x6DA PUSH2 0xD26 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH0 DUP1 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 SWAP3 MSTORE PUSH1 0xF PUSH1 0xF8 SHL SWAP12 SWAP4 SWAP11 POP SWAP2 SWAP9 POP CHAINID SWAP8 POP ADDRESS SWAP7 POP SWAP5 POP SWAP3 POP SWAP1 POP JUMP JUMPDEST PUSH2 0x70B PUSH2 0xC79 JUMP JUMPDEST PUSH2 0x730 PUSH2 0x71F PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND SWAP1 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP5 AND SWAP1 DUP4 PUSH2 0xD53 JUMP JUMPDEST PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP3 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH32 0xA0524EE0FD8662D6C046D199DA2A6D3DC49445182CEC055873A5BB9C2843C8E0 DUP4 PUSH1 0x40 MLOAD PUSH2 0x77F SWAP2 DUP2 MSTORE PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP3 AND PUSH0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP5 DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x7C0 PUSH2 0xC79 JUMP JUMPDEST PUSH0 DUP1 SLOAD PUSH1 0x40 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP2 AND SWAP1 DUP4 SWAP1 DUP4 DUP2 DUP2 DUP2 DUP6 DUP8 GAS CALL SWAP3 POP POP POP RETURNDATASIZE DUP1 PUSH0 DUP2 EQ PUSH2 0x80A JUMPI PUSH1 0x40 MLOAD SWAP2 POP PUSH1 0x1F NOT PUSH1 0x3F RETURNDATASIZE ADD AND DUP3 ADD PUSH1 0x40 MSTORE RETURNDATASIZE DUP3 MSTORE RETURNDATASIZE PUSH0 PUSH1 0x20 DUP5 ADD RETURNDATACOPY PUSH2 0x80F JUMP JUMPDEST PUSH1 0x60 SWAP2 POP JUMPDEST POP POP SWAP1 POP DUP1 PUSH2 0x856 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH19 0x115512081D1C985B9CD9995C8819985A5B1959 PUSH1 0x6A SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH32 0x6148672A948A12B8E0BF92A9338349B9AC890FAD62A234ABAF0A4DA99F62CFCC DUP4 PUSH1 0x40 MLOAD PUSH2 0x89B SWAP2 DUP2 MSTORE PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 POP POP JUMP JUMPDEST PUSH2 0x8AF PUSH2 0xC79 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND PUSH2 0x8D8 JUMPI PUSH1 0x40 MLOAD PUSH4 0x1E4FBDF7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH0 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST PUSH2 0x6AB DUP2 PUSH2 0xCA5 JUMP JUMPDEST PUSH2 0x8E9 PUSH2 0xD60 JUMP JUMPDEST PUSH1 0x2 PUSH32 0x9B779B17422D0DF92223018B32B4D1FA46E071723D6817E2486D003BECC55F00 SSTORE JUMP JUMPDEST DUP4 MLOAD PUSH1 0x20 DUP1 DUP7 ADD SWAP2 SWAP1 SWAP2 KECCAK256 PUSH1 0x40 DUP1 MLOAD PUSH32 0xF0543E2024FD0AE16CCB842686C2733758EC65ACFD69FB599C05B286F8DB8844 SWAP4 DUP2 ADD SWAP4 SWAP1 SWAP4 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB PUSH32 0x0 DUP2 AND SWAP2 DUP5 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP1 DUP11 AND PUSH1 0x60 DUP5 ADD MSTORE DUP9 AND PUSH1 0x80 DUP4 ADD MSTORE PUSH1 0xA0 DUP3 ADD DUP8 SWAP1 MSTORE PUSH1 0xC0 DUP3 ADD MSTORE PUSH1 0xE0 DUP2 ADD DUP5 SWAP1 MSTORE PUSH2 0x100 DUP2 ADD DUP4 SWAP1 MSTORE PUSH2 0x120 DUP2 ADD DUP3 SWAP1 MSTORE PUSH0 SWAP1 PUSH2 0x9CF SWAP1 PUSH2 0x140 ADD PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 DUP4 SUB SUB DUP2 MSTORE SWAP1 PUSH1 0x40 MSTORE DUP1 MLOAD SWAP1 PUSH1 0x20 ADD KECCAK256 PUSH2 0xDA2 JUMP JUMPDEST SWAP9 SWAP8 POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH0 PUSH0 PUSH0 PUSH0 PUSH2 0x9EB DUP9 DUP9 DUP9 DUP9 PUSH2 0xDCE JUMP JUMPDEST SWAP3 POP SWAP3 POP SWAP3 POP PUSH2 0x9FB DUP3 DUP3 PUSH2 0xE96 JUMP JUMPDEST POP SWAP1 SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH4 0xD505ACCF PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP8 DUP2 AND PUSH1 0x4 DUP4 ADD MSTORE ADDRESS PUSH1 0x24 DUP4 ADD MSTORE PUSH1 0x44 DUP3 ADD DUP8 SWAP1 MSTORE PUSH1 0x64 DUP3 ADD DUP7 SWAP1 MSTORE PUSH1 0xFF DUP6 AND PUSH1 0x84 DUP4 ADD MSTORE PUSH1 0xA4 DUP3 ADD DUP5 SWAP1 MSTORE PUSH1 0xC4 DUP3 ADD DUP4 SWAP1 MSTORE DUP9 AND SWAP1 PUSH4 0xD505ACCF SWAP1 PUSH1 0xE4 ADD PUSH0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0xA72 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP GAS CALL SWAP3 POP POP POP DUP1 ISZERO PUSH2 0xA83 JUMPI POP PUSH1 0x1 JUMPDEST PUSH2 0xB57 JUMPI PUSH1 0x40 MLOAD PUSH4 0x6EB1769F PUSH1 0xE1 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP8 DUP2 AND PUSH1 0x4 DUP4 ADD MSTORE ADDRESS PUSH1 0x24 DUP4 ADD MSTORE DUP7 SWAP2 SWAP1 DUP10 AND SWAP1 PUSH4 0xDD62ED3E SWAP1 PUSH1 0x44 ADD PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP7 GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0xAD4 JUMPI RETURNDATASIZE PUSH0 PUSH0 RETURNDATACOPY RETURNDATASIZE PUSH0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0xAF8 SWAP2 SWAP1 PUSH2 0x14BD JUMP JUMPDEST LT ISZERO PUSH2 0xB57 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x28 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5065726D6974206661696C656420616E6420696E73756666696369656E742061 PUSH1 0x44 DUP3 ADD MSTORE PUSH8 0x6C6C6F77616E6365 PUSH1 0xC0 SHL PUSH1 0x64 DUP3 ADD MSTORE PUSH1 0x84 ADD PUSH2 0x281 JUMP JUMPDEST PUSH2 0xB6C PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP9 AND DUP8 ADDRESS DUP9 PUSH2 0xF52 JUMP JUMPDEST POP POP POP POP POP POP POP JUMP JUMPDEST PUSH2 0xB81 DUP4 DUP4 DUP4 PUSH0 PUSH2 0xF8E JUMP JUMPDEST PUSH2 0xBEF JUMPI PUSH2 0xB92 DUP4 DUP4 PUSH0 PUSH1 0x1 PUSH2 0xF8E JUMP JUMPDEST PUSH2 0xBBA JUMPI PUSH1 0x40 MLOAD PUSH4 0x5274AFE7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP5 AND PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST PUSH2 0xBC7 DUP4 DUP4 DUP4 PUSH1 0x1 PUSH2 0xF8E JUMP JUMPDEST PUSH2 0xBEF JUMPI PUSH1 0x40 MLOAD PUSH4 0x5274AFE7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP5 AND PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST POP POP POP JUMP JUMPDEST PUSH0 PUSH0 PUSH32 0x0 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP4 DUP6 PUSH1 0x40 MLOAD PUSH2 0xC2F SWAP2 SWAP1 PUSH2 0x14D4 JUMP JUMPDEST PUSH0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 DUP8 GAS CALL SWAP3 POP POP POP RETURNDATASIZE DUP1 PUSH0 DUP2 EQ PUSH2 0xC69 JUMPI PUSH1 0x40 MLOAD SWAP2 POP PUSH1 0x1F NOT PUSH1 0x3F RETURNDATASIZE ADD AND DUP3 ADD PUSH1 0x40 MSTORE RETURNDATASIZE DUP3 MSTORE RETURNDATASIZE PUSH0 PUSH1 0x20 DUP5 ADD RETURNDATACOPY PUSH2 0xC6E JUMP JUMPDEST PUSH1 0x60 SWAP2 POP JUMPDEST POP SWAP1 SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND CALLER EQ PUSH2 0x6BF JUMPI PUSH1 0x40 MLOAD PUSH4 0x118CDAA7 PUSH1 0xE0 SHL DUP2 MSTORE CALLER PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST PUSH0 DUP1 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP4 DUP2 AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB NOT DUP4 AND DUP2 OR DUP5 SSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP3 AND SWAP3 DUP4 SWAP2 PUSH32 0x8BE0079C531659141344CD1FD0A4F28419497F9722A3DAAFE3B4186F6B6457E0 SWAP2 SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x60 PUSH2 0xD21 PUSH32 0x0 PUSH1 0x1 PUSH2 0xFF0 JUMP JUMPDEST SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x60 PUSH2 0xD21 PUSH32 0x0 PUSH1 0x2 PUSH2 0xFF0 JUMP JUMPDEST PUSH2 0xBC7 DUP4 DUP4 DUP4 PUSH1 0x1 PUSH2 0x1099 JUMP JUMPDEST PUSH32 0x9B779B17422D0DF92223018B32B4D1FA46E071723D6817E2486D003BECC55F00 SLOAD PUSH1 0x2 SUB PUSH2 0x6BF JUMPI PUSH1 0x40 MLOAD PUSH4 0x3EE5AEB5 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH0 PUSH2 0x7B2 PUSH2 0xDAE PUSH2 0x10E3 JUMP JUMPDEST DUP4 PUSH1 0x40 MLOAD PUSH2 0x1901 PUSH1 0xF0 SHL DUP2 MSTORE PUSH1 0x2 DUP2 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x22 DUP3 ADD MSTORE PUSH1 0x42 SWAP1 KECCAK256 SWAP1 JUMP JUMPDEST PUSH0 DUP1 DUP1 PUSH32 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0 DUP5 GT ISZERO PUSH2 0xE07 JUMPI POP PUSH0 SWAP2 POP PUSH1 0x3 SWAP1 POP DUP3 PUSH2 0xE8C JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH0 DUP1 DUP3 MSTORE PUSH1 0x20 DUP3 ADD DUP1 DUP5 MSTORE DUP11 SWAP1 MSTORE PUSH1 0xFF DUP10 AND SWAP3 DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x60 DUP2 ADD DUP8 SWAP1 MSTORE PUSH1 0x80 DUP2 ADD DUP7 SWAP1 MSTORE PUSH1 0x1 SWAP1 PUSH1 0xA0 ADD PUSH1 0x20 PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 SUB SWAP1 DUP1 DUP5 SUB SWAP1 DUP6 GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0xE58 JUMPI RETURNDATASIZE PUSH0 PUSH0 RETURNDATACOPY RETURNDATASIZE PUSH0 REVERT JUMPDEST POP POP PUSH1 0x40 MLOAD PUSH1 0x1F NOT ADD MLOAD SWAP2 POP POP PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND PUSH2 0xE83 JUMPI POP PUSH0 SWAP3 POP PUSH1 0x1 SWAP2 POP DUP3 SWAP1 POP PUSH2 0xE8C JUMP JUMPDEST SWAP3 POP PUSH0 SWAP2 POP DUP2 SWAP1 POP JUMPDEST SWAP5 POP SWAP5 POP SWAP5 SWAP2 POP POP JUMP JUMPDEST PUSH0 DUP3 PUSH1 0x3 DUP2 GT ISZERO PUSH2 0xEA9 JUMPI PUSH2 0xEA9 PUSH2 0x14EA JUMP JUMPDEST SUB PUSH2 0xEB2 JUMPI POP POP JUMP JUMPDEST PUSH1 0x1 DUP3 PUSH1 0x3 DUP2 GT ISZERO PUSH2 0xEC6 JUMPI PUSH2 0xEC6 PUSH2 0x14EA JUMP JUMPDEST SUB PUSH2 0xEE4 JUMPI PUSH1 0x40 MLOAD PUSH4 0xF645EEDF PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x2 DUP3 PUSH1 0x3 DUP2 GT ISZERO PUSH2 0xEF8 JUMPI PUSH2 0xEF8 PUSH2 0x14EA JUMP JUMPDEST SUB PUSH2 0xF19 JUMPI PUSH1 0x40 MLOAD PUSH4 0xFCE698F7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 DUP2 ADD DUP3 SWAP1 MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST PUSH1 0x3 DUP3 PUSH1 0x3 DUP2 GT ISZERO PUSH2 0xF2D JUMPI PUSH2 0xF2D PUSH2 0x14EA JUMP JUMPDEST SUB PUSH2 0xF4E JUMPI PUSH1 0x40 MLOAD PUSH4 0x35E2F383 PUSH1 0xE2 SHL DUP2 MSTORE PUSH1 0x4 DUP2 ADD DUP3 SWAP1 MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST POP POP JUMP JUMPDEST PUSH2 0xF60 DUP5 DUP5 DUP5 DUP5 PUSH1 0x1 PUSH2 0x120C JUMP JUMPDEST PUSH2 0xF88 JUMPI PUSH1 0x40 MLOAD PUSH4 0x5274AFE7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP6 AND PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH4 0x95EA7B3 PUSH1 0xE0 SHL PUSH0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP7 AND PUSH1 0x4 MSTORE PUSH1 0x24 DUP6 SWAP1 MSTORE SWAP2 PUSH1 0x20 DUP4 PUSH1 0x44 DUP2 DUP1 DUP12 GAS CALL SWAP3 POP PUSH1 0x1 PUSH0 MLOAD EQ DUP4 AND PUSH2 0xFE4 JUMPI DUP4 DUP4 ISZERO AND ISZERO PUSH2 0xFD8 JUMPI RETURNDATASIZE PUSH0 DUP3 RETURNDATACOPY RETURNDATASIZE DUP2 REVERT JUMPDEST PUSH0 DUP8 EXTCODESIZE GT RETURNDATASIZE ISZERO AND DUP4 AND SWAP3 POP JUMPDEST PUSH1 0x40 MSTORE POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x60 PUSH1 0xFF DUP4 EQ PUSH2 0x100A JUMPI PUSH2 0x1003 DUP4 PUSH2 0x1279 JUMP JUMPDEST SWAP1 POP PUSH2 0x7B2 JUMP JUMPDEST DUP2 DUP1 SLOAD PUSH2 0x1016 SWAP1 PUSH2 0x14FE JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0x1042 SWAP1 PUSH2 0x14FE JUMP JUMPDEST DUP1 ISZERO PUSH2 0x108D JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x1064 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x108D JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH0 MSTORE PUSH1 0x20 PUSH0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x1070 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP PUSH2 0x7B2 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH4 0xA9059CBB PUSH1 0xE0 SHL PUSH0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP7 AND PUSH1 0x4 MSTORE PUSH1 0x24 DUP6 SWAP1 MSTORE SWAP2 PUSH1 0x20 DUP4 PUSH1 0x44 DUP2 DUP1 DUP12 GAS CALL SWAP3 POP PUSH1 0x1 PUSH0 MLOAD EQ DUP4 AND PUSH2 0xFE4 JUMPI DUP4 DUP4 ISZERO AND ISZERO PUSH2 0xFD8 JUMPI RETURNDATASIZE PUSH0 DUP3 RETURNDATACOPY RETURNDATASIZE DUP2 REVERT JUMPDEST PUSH0 ADDRESS PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB PUSH32 0x0 AND EQ DUP1 ISZERO PUSH2 0x113B JUMPI POP PUSH32 0x0 CHAINID EQ JUMPDEST ISZERO PUSH2 0x1165 JUMPI POP PUSH32 0x0 SWAP1 JUMP JUMPDEST PUSH2 0xD21 PUSH1 0x40 DUP1 MLOAD PUSH32 0x8B73C3C69BB8FE3D512ECC4CF759CC79239F7B179B0FFACAA9A75D522B39400F PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x0 SWAP2 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH32 0x0 PUSH1 0x60 DUP3 ADD MSTORE CHAINID PUSH1 0x80 DUP3 ADD MSTORE ADDRESS PUSH1 0xA0 DUP3 ADD MSTORE PUSH0 SWAP1 PUSH1 0xC0 ADD PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 DUP4 SUB SUB DUP2 MSTORE SWAP1 PUSH1 0x40 MSTORE DUP1 MLOAD SWAP1 PUSH1 0x20 ADD KECCAK256 SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH4 0x23B872DD PUSH1 0xE0 SHL PUSH0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP8 DUP2 AND PUSH1 0x4 MSTORE DUP7 AND PUSH1 0x24 MSTORE PUSH1 0x44 DUP6 SWAP1 MSTORE SWAP2 PUSH1 0x20 DUP4 PUSH1 0x64 DUP2 DUP1 DUP13 GAS CALL SWAP3 POP PUSH1 0x1 PUSH0 MLOAD EQ DUP4 AND PUSH2 0x1268 JUMPI DUP4 DUP4 ISZERO AND ISZERO PUSH2 0x125C JUMPI RETURNDATASIZE PUSH0 DUP3 RETURNDATACOPY RETURNDATASIZE DUP2 REVERT JUMPDEST PUSH0 DUP9 EXTCODESIZE GT RETURNDATASIZE ISZERO AND DUP4 AND SWAP3 POP JUMPDEST PUSH1 0x40 MSTORE POP PUSH0 PUSH1 0x60 MSTORE SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x60 PUSH0 PUSH2 0x1285 DUP4 PUSH2 0x12B6 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 DUP4 ADD SWAP1 SWAP3 MSTORE SWAP2 SWAP3 POP PUSH0 SWAP2 SWAP1 PUSH1 0x20 DUP3 ADD DUP2 DUP1 CALLDATASIZE DUP4 CALLDATACOPY POP POP POP SWAP2 DUP3 MSTORE POP PUSH1 0x20 DUP2 ADD SWAP3 SWAP1 SWAP3 MSTORE POP SWAP1 JUMP JUMPDEST PUSH0 PUSH1 0xFF DUP3 AND PUSH1 0x1F DUP2 GT ISZERO PUSH2 0x7B2 JUMPI PUSH1 0x40 MLOAD PUSH4 0x2CD44AC3 PUSH1 0xE2 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x12ED JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1303 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP3 ADD PUSH2 0x1C0 DUP2 DUP6 SUB SLT ISZERO PUSH2 0x1315 JUMPI PUSH0 PUSH0 REVERT JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH0 DUP2 MLOAD DUP1 DUP5 MSTORE DUP1 PUSH1 0x20 DUP5 ADD PUSH1 0x20 DUP7 ADD MCOPY PUSH0 PUSH1 0x20 DUP3 DUP7 ADD ADD MSTORE PUSH1 0x20 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND DUP6 ADD ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0xFF PUSH1 0xF8 SHL DUP9 AND DUP2 MSTORE PUSH1 0xE0 PUSH1 0x20 DUP3 ADD MSTORE PUSH0 PUSH2 0x1368 PUSH1 0xE0 DUP4 ADD DUP10 PUSH2 0x131C JUMP JUMPDEST DUP3 DUP2 SUB PUSH1 0x40 DUP5 ADD MSTORE PUSH2 0x137A DUP2 DUP10 PUSH2 0x131C JUMP JUMPDEST PUSH1 0x60 DUP5 ADD DUP9 SWAP1 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP8 AND PUSH1 0x80 DUP6 ADD MSTORE PUSH1 0xA0 DUP5 ADD DUP7 SWAP1 MSTORE DUP4 DUP2 SUB PUSH1 0xC0 DUP6 ADD MSTORE DUP5 MLOAD DUP1 DUP3 MSTORE PUSH1 0x20 DUP1 DUP8 ADD SWAP4 POP SWAP1 SWAP2 ADD SWAP1 PUSH0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x13CF JUMPI DUP4 MLOAD DUP4 MSTORE PUSH1 0x20 SWAP4 DUP5 ADD SWAP4 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x1 ADD PUSH2 0x13B1 JUMP JUMPDEST POP SWAP1 SWAP12 SWAP11 POP POP POP POP POP POP POP POP POP POP POP JUMP JUMPDEST DUP1 CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND DUP2 EQ PUSH2 0x13F6 JUMPI PUSH0 PUSH0 REVERT JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH0 PUSH0 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x140C JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x1415 DUP4 PUSH2 0x13E0 JUMP JUMPDEST SWAP5 PUSH1 0x20 SWAP4 SWAP1 SWAP4 ADD CALLDATALOAD SWAP4 POP POP POP JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x1433 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP CALLDATALOAD SWAP2 SWAP1 POP JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x144A JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x1315 DUP3 PUSH2 0x13E0 JUMP JUMPDEST PUSH0 PUSH0 DUP4 CALLDATALOAD PUSH1 0x1E NOT DUP5 CALLDATASIZE SUB ADD DUP2 SLT PUSH2 0x1468 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP4 ADD DUP1 CALLDATALOAD SWAP2 POP PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x1482 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH1 0x20 ADD SWAP2 POP CALLDATASIZE DUP2 SWAP1 SUB DUP3 SGT ISZERO PUSH2 0x1496 JUMPI PUSH0 PUSH0 REVERT JUMPDEST SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x14AD JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH1 0xFF DUP2 AND DUP2 EQ PUSH2 0x1315 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x14CD JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP MLOAD SWAP2 SWAP1 POP JUMP JUMPDEST PUSH0 DUP3 MLOAD DUP1 PUSH1 0x20 DUP6 ADD DUP5 MCOPY PUSH0 SWAP3 ADD SWAP2 DUP3 MSTORE POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x21 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST PUSH1 0x1 DUP2 DUP2 SHR SWAP1 DUP3 AND DUP1 PUSH2 0x1512 JUMPI PUSH1 0x7F DUP3 AND SWAP2 POP JUMPDEST PUSH1 0x20 DUP3 LT DUP2 SUB PUSH2 0x1530 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x22 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST POP SWAP2 SWAP1 POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 SWAP13 CALLVALUE 0xDB 0x2F PUSH16 0x83AF136A5340CCE7FE8EF554EA8EB633 PUSH6 0x6FBF9BFF3BD7 BALANCE 0xAE 0xC4 0xF PUSH5 0x736F6C6343 STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "1158:6897:22:-:0;;;2504:245;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;3428:431:16;;;;;;;;;;;-1:-1:-1;;;3428:431:16;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;3428:431:16;;;;;2562:10:22;;1269:95:0;;1322:31;;-1:-1:-1;;;1322:31:0;;1350:1;1322:31;;;455:51:23;428:18;;1322:31:0;;;;;;;;1269:95;1373:32;1392:12;1373:18;:32::i;:::-;-1:-1:-1;2365:1:11;1505:66;2539;3501:45:16;:4;3532:13;3501:30;:45::i;:::-;3493:53;;3567:51;:7;3601:16;3567:33;:51::i;:::-;3556:62;;3642:22;;;;;;;;;;3628:36;;3691:25;;;;;;3674:42;;3744:13;3727:30;;3792:23;4326:11;;4339:14;;4304:80;;;2079:95;4304:80;;;3765:25:23;3806:18;;;3799:34;;;;3849:18;;;3842:34;4355:13:16;3892:18:23;;;3885:34;4378:4:16;3935:19:23;;;3928:61;4268:7:16;;3737:19:23;;4304:80:16;;;;;;;;;;;;4294:91;;;;;;4287:98;;4213:179;;3792:23;3767:48;;-1:-1:-1;;3847:4:16;3825:27;;-1:-1:-1;;;;;2632:34:22;::::2;2624:66;;;::::0;-1:-1:-1;;;2624:66:22;;719:2:23;2624:66:22::2;::::0;::::2;701:21:23::0;758:2;738:18;;;731:30;797:21;777:18;;;770:49;836:18;;2624:66:22::2;517:343:23::0;2624:66:22::2;-1:-1:-1::0;;;;;2700:42:22::2;;::::0;1158:6897;;2912:187:0;2985:16;3004:6;;-1:-1:-1;;;;;3020:17:0;;;-1:-1:-1;;;;;;3020:17:0;;;;;;3052:40;;3004:6;;;;;;;3052:40;;2985:16;3052:40;2975:124;2912:187;:::o;2893:342:12:-;2989:11;3038:4;3022:5;3016:19;:26;3012:217;;;3065:20;3079:5;3065:13;:20::i;:::-;3058:27;;;;3012:217;3142:5;3116:46;3157:5;3142;3116:46;:::i;:::-;-1:-1:-1;1390:66:12;;-1:-1:-1;3012:217:12;2893:342;;;;:::o;1708:288::-;1773:11;1796:17;1822:3;1796:30;;1854:4;1840;:11;:18;1836:74;;;1895:3;1881:18;;-1:-1:-1;;;1881:18:12;;;;;;;;:::i;1836:74::-;1976:11;;1959:13;1976:4;1959:13;:::i;:::-;1951:36;;1708:288;-1:-1:-1;;;1708:288:12:o;14:290:23:-;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:23;;214:42;;204:70;;270:1;267;260:12;204:70;293:5;14:290;-1:-1:-1;;;14:290:23:o;865:127::-;926:10;921:3;917:20;914:1;907:31;957:4;954:1;947:15;981:4;978:1;971:15;997:380;1076:1;1072:12;;;;1119;;;1140:61;;1194:4;1186:6;1182:17;1172:27;;1140:61;1247:2;1239:6;1236:14;1216:18;1213:38;1210:161;;1293:10;1288:3;1284:20;1281:1;1274:31;1328:4;1325:1;1318:15;1356:4;1353:1;1346:15;1210:161;;997:380;;;:::o;1508:518::-;1610:2;1605:3;1602:11;1599:421;;;1646:5;1643:1;1636:16;1690:4;1687:1;1677:18;1760:2;1748:10;1744:19;1741:1;1737:27;1731:4;1727:38;1796:4;1784:10;1781:20;1778:47;;;-1:-1:-1;1819:4:23;1778:47;1874:2;1869:3;1865:12;1862:1;1858:20;1852:4;1848:31;1838:41;;1929:81;1947:2;1940:5;1937:13;1929:81;;;2006:1;1992:16;;1973:1;1962:13;1929:81;;;1933:3;;1599:421;1508:518;;;:::o;2202:1299::-;2322:10;;-1:-1:-1;;;;;2344:30:23;;2341:56;;;2377:18;;:::i;:::-;2406:97;2496:6;2456:38;2488:4;2482:11;2456:38;:::i;:::-;2450:4;2406:97;:::i;:::-;2552:4;2583:2;2572:14;;2600:1;2595:649;;;;3288:1;3305:6;3302:89;;;-1:-1:-1;3357:19:23;;;3351:26;3302:89;-1:-1:-1;;2159:1:23;2155:11;;;2151:24;2147:29;2137:40;2183:1;2179:11;;;2134:57;3404:81;;2565:930;;2595:649;1455:1;1448:14;;;1492:4;1479:18;;-1:-1:-1;;2631:20:23;;;2749:222;2763:7;2760:1;2757:14;2749:222;;;2845:19;;;2839:26;2824:42;;2952:4;2937:20;;;;2905:1;2893:14;;;;2779:12;2749:222;;;2753:3;2999:6;2990:7;2987:19;2984:201;;;3060:19;;;3054:26;-1:-1:-1;;3143:1:23;3139:14;;;3155:3;3135:24;3131:37;3127:42;3112:58;3097:74;;2984:201;-1:-1:-1;;;;3231:1:23;3215:14;;;3211:22;3198:36;;-1:-1:-1;2202:1299:23:o;4000:418::-;4149:2;4138:9;4131:21;4112:4;4181:6;4175:13;4224:6;4219:2;4208:9;4204:18;4197:34;4283:6;4278:2;4270:6;4266:15;4261:2;4250:9;4246:18;4240:50;4339:1;4334:2;4325:6;4314:9;4310:22;4306:31;4299:42;4409:2;4402;4398:7;4393:2;4385:6;4381:15;4377:29;4366:9;4362:45;4358:54;4350:62;;;4000:418;;;;:::o;4423:297::-;4541:12;;4588:4;4577:16;;;4571:23;;4541:12;4606:16;;4603:111;;;-1:-1:-1;;4680:4:23;4676:17;;;;4673:1;4669:25;4665:38;4654:50;;4423:297;-1:-1:-1;4423:297:23:o;:::-;1158:6897:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;" + }, + "deployedBytecode": { + "functionDebugData": { + "@_8236": { + "entryPoint": null, + "id": 8236, + "parameterSlots": 0, + "returnSlots": 0 + }, + "@_EIP712Name_4351": { + "entryPoint": 3316, + "id": 4351, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@_EIP712Version_4363": { + "entryPoint": 3366, + "id": 4363, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@_buildDomainSeparator_4281": { + "entryPoint": null, + "id": 4281, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@_checkOwner_84": { + "entryPoint": 3193, + "id": 84, + "parameterSlots": 0, + "returnSlots": 0 + }, + "@_computeDigest_8441": { + "entryPoint": 2319, + "id": 8441, + "parameterSlots": 7, + "returnSlots": 1 + }, + "@_domainSeparatorV4_4260": { + "entryPoint": 4323, + "id": 4260, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@_executePermitAndTransfer_8508": { + "entryPoint": 2567, + "id": 8508, + "parameterSlots": 7, + "returnSlots": 0 + }, + "@_forwardCall_8529": { + "entryPoint": 3060, + "id": 8529, + "parameterSlots": 2, + "returnSlots": 1 + }, + "@_hashTypedDataV4_4297": { + "entryPoint": 3490, + "id": 4297, + "parameterSlots": 1, + "returnSlots": 1 + }, + "@_msgSender_1644": { + "entryPoint": null, + "id": 1644, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@_nonReentrantAfter_1803": { + "entryPoint": null, + "id": 1803, + "parameterSlots": 0, + "returnSlots": 0 + }, + "@_nonReentrantBeforeView_1776": { + "entryPoint": 3424, + "id": 1776, + "parameterSlots": 0, + "returnSlots": 0 + }, + "@_nonReentrantBefore_1791": { + "entryPoint": 2273, + "id": 1791, + "parameterSlots": 0, + "returnSlots": 0 + }, + "@_reentrancyGuardEntered_1818": { + "entryPoint": null, + "id": 1818, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@_reentrancyGuardStorageSlot_1826": { + "entryPoint": null, + "id": 1826, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@_safeApprove_830": { + "entryPoint": 3982, + "id": 830, + "parameterSlots": 4, + "returnSlots": 1 + }, + "@_safeTransferFrom_807": { + "entryPoint": 4620, + "id": 807, + "parameterSlots": 5, + "returnSlots": 1 + }, + "@_safeTransfer_782": { + "entryPoint": 4249, + "id": 782, + "parameterSlots": 4, + "returnSlots": 1 + }, + "@_throwError_4136": { + "entryPoint": 3734, + "id": 4136, + "parameterSlots": 2, + "returnSlots": 0 + }, + "@_transferOwnership_146": { + "entryPoint": 3237, + "id": 146, + "parameterSlots": 1, + "returnSlots": 0 + }, + "@byteLength_1945": { + "entryPoint": 4790, + "id": 1945, + "parameterSlots": 1, + "returnSlots": 1 + }, + "@destinationContract_8147": { + "entryPoint": null, + "id": 8147, + "parameterSlots": 0, + "returnSlots": 0 + }, + "@eip712Domain_4339": { + "entryPoint": 1729, + "id": 4339, + "parameterSlots": 0, + "returnSlots": 7 + }, + "@execute_8402": { + "entryPoint": 542, + "id": 8402, + "parameterSlots": 1, + "returnSlots": 0 + }, + "@forceApprove_626": { + "entryPoint": 2933, + "id": 626, + "parameterSlots": 3, + "returnSlots": 0 + }, + "@getUint256Slot_2112": { + "entryPoint": null, + "id": 2112, + "parameterSlots": 1, + "returnSlots": 1 + }, + "@isExecutionCompleted_8602": { + "entryPoint": 1931, + "id": 8602, + "parameterSlots": 2, + "returnSlots": 1 + }, + "@owner_67": { + "entryPoint": null, + "id": 67, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@recover_4059": { + "entryPoint": 2523, + "id": 4059, + "parameterSlots": 4, + "returnSlots": 1 + }, + "@renounceOwnership_98": { + "entryPoint": 1710, + "id": 98, + "parameterSlots": 0, + "returnSlots": 0 + }, + "@safeTransferFrom_456": { + "entryPoint": 3922, + "id": 456, + "parameterSlots": 4, + "returnSlots": 0 + }, + "@safeTransfer_425": { + "entryPoint": 3411, + "id": 425, + "parameterSlots": 3, + "returnSlots": 0 + }, + "@toStringWithFallback_2012": { + "entryPoint": 4080, + "id": 2012, + "parameterSlots": 2, + "returnSlots": 1 + }, + "@toString_1913": { + "entryPoint": 4729, + "id": 1913, + "parameterSlots": 1, + "returnSlots": 1 + }, + "@toTypedDataHash_4451": { + "entryPoint": null, + "id": 4451, + "parameterSlots": 2, + "returnSlots": 1 + }, + "@transferOwnership_126": { + "entryPoint": 2215, + "id": 126, + "parameterSlots": 1, + "returnSlots": 0 + }, + "@tryRecover_4023": { + "entryPoint": 3534, + "id": 4023, + "parameterSlots": 4, + "returnSlots": 3 + }, + "@usedPayloadNonces_8153": { + "entryPoint": null, + "id": 8153, + "parameterSlots": 0, + "returnSlots": 0 + }, + "@withdrawETH_8586": { + "entryPoint": 1976, + "id": 8586, + "parameterSlots": 1, + "returnSlots": 0 + }, + "@withdrawToken_8556": { + "entryPoint": 1795, + "id": 8556, + "parameterSlots": 2, + "returnSlots": 0 + }, + "abi_decode_address": { + "entryPoint": 5088, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_decode_tuple_t_address": { + "entryPoint": 5178, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_decode_tuple_t_addresst_uint256": { + "entryPoint": 5115, + "id": null, + "parameterSlots": 2, + "returnSlots": 2 + }, + "abi_decode_tuple_t_struct$_ExecuteParams_$8182_calldata_ptr": { + "entryPoint": 4829, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_decode_tuple_t_uint256": { + "entryPoint": 5155, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_decode_tuple_t_uint256_fromMemory": { + "entryPoint": 5309, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_decode_tuple_t_uint8": { + "entryPoint": 5277, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_string": { + "entryPoint": 4892, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_tuple_packed_t_bytes_memory_ptr__to_t_bytes_memory_ptr__nonPadded_inplace_fromStack_reversed": { + "entryPoint": 5332, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_tuple_packed_t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470__to_t_bytes_memory_ptr__nonPadded_inplace_fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_address__to_t_address__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_tuple_t_address_t_address__to_t_address_t_address__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 3, + "returnSlots": 1 + }, + "abi_encode_tuple_t_address_t_address_t_uint256_t_uint256_t_uint8_t_bytes32_t_bytes32__to_t_address_t_address_t_uint256_t_uint256_t_uint8_t_bytes32_t_bytes32__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 8, + "returnSlots": 1 + }, + "abi_encode_tuple_t_bool__to_t_bool__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_tuple_t_bytes1_t_string_memory_ptr_t_string_memory_ptr_t_uint256_t_address_t_bytes32_t_array$_t_uint256_$dyn_memory_ptr__to_t_bytes1_t_string_memory_ptr_t_string_memory_ptr_t_uint256_t_address_t_bytes32_t_array$_t_uint256_$dyn_memory_ptr__fromStack_reversed": { + "entryPoint": 4938, + "id": null, + "parameterSlots": 8, + "returnSlots": 1 + }, + "abi_encode_tuple_t_bytes32__to_t_bytes32__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_tuple_t_bytes32_t_address_t_address_t_address_t_uint256_t_bytes32_t_uint256_t_uint256_t_uint256__to_t_bytes32_t_address_t_address_t_address_t_uint256_t_bytes32_t_uint256_t_uint256_t_uint256__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 10, + "returnSlots": 1 + }, + "abi_encode_tuple_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__to_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 6, + "returnSlots": 1 + }, + "abi_encode_tuple_t_bytes32_t_uint8_t_bytes32_t_bytes32__to_t_bytes32_t_uint8_t_bytes32_t_bytes32__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 5, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_066ad49a0ed9e5d6a9f3c20fca13a038f0a5d629f0aaf09d634ae2a7c232ac2b__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_0acc7f0c8df1a6717d2b423ae4591ac135687015764ac37dd4cf0150a9322b15__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_110461b12e459dc76e692e7a47f9621cf45c7d48020c3c7b2066107cdf1f52ae__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_15d72127d094a30af360ead73641c61eda3d745ce4d04d12675a5e9a899f8b21__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_27859e47e6c2167c8e8d38addfca16b9afb9d8e9750b6a1e67c29196d4d99fae__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_31734eed34fab74fa1579246aaad104a344891a284044483c0c5a792a9f83a72__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_5e70ebd1d4072d337a7fabaa7bda70fa2633d6e3f89d5cb725a16b10d07e54c6__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_a793dc5bde52ab2d5349f1208a34905b1d68ab9298f549a2e514542cba0a8c76__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_c7c2be2f1b63a3793f6e2d447ce95ba2239687186a7fd6b5268a969dcdb42dcd__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed": { + "entryPoint": null, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "access_calldata_tail_t_bytes_calldata_ptr": { + "entryPoint": 5203, + "id": null, + "parameterSlots": 2, + "returnSlots": 2 + }, + "extract_byte_array_length": { + "entryPoint": 5374, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "panic_error_0x21": { + "entryPoint": 5354, + "id": null, + "parameterSlots": 0, + "returnSlots": 0 + }, + "panic_error_0x41": { + "entryPoint": null, + "id": null, + "parameterSlots": 0, + "returnSlots": 0 + } + }, + "generatedSources": [ + { + "ast": { + "nativeSrc": "0:11637:23", + "nodeType": "YulBlock", + "src": "0:11637:23", + "statements": [ + { + "nativeSrc": "6:3:23", + "nodeType": "YulBlock", + "src": "6:3:23", + "statements": [] + }, + { + "body": { + "nativeSrc": "117:290:23", + "nodeType": "YulBlock", + "src": "117:290:23", + "statements": [ + { + "body": { + "nativeSrc": "163:16:23", + "nodeType": "YulBlock", + "src": "163:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "172:1:23", + "nodeType": "YulLiteral", + "src": "172:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "175:1:23", + "nodeType": "YulLiteral", + "src": "175:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "165:6:23", + "nodeType": "YulIdentifier", + "src": "165:6:23" + }, + "nativeSrc": "165:12:23", + "nodeType": "YulFunctionCall", + "src": "165:12:23" + }, + "nativeSrc": "165:12:23", + "nodeType": "YulExpressionStatement", + "src": "165:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nativeSrc": "138:7:23", + "nodeType": "YulIdentifier", + "src": "138:7:23" + }, + { + "name": "headStart", + "nativeSrc": "147:9:23", + "nodeType": "YulIdentifier", + "src": "147:9:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "134:3:23", + "nodeType": "YulIdentifier", + "src": "134:3:23" + }, + "nativeSrc": "134:23:23", + "nodeType": "YulFunctionCall", + "src": "134:23:23" + }, + { + "kind": "number", + "nativeSrc": "159:2:23", + "nodeType": "YulLiteral", + "src": "159:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nativeSrc": "130:3:23", + "nodeType": "YulIdentifier", + "src": "130:3:23" + }, + "nativeSrc": "130:32:23", + "nodeType": "YulFunctionCall", + "src": "130:32:23" + }, + "nativeSrc": "127:52:23", + "nodeType": "YulIf", + "src": "127:52:23" + }, + { + "nativeSrc": "188:37:23", + "nodeType": "YulVariableDeclaration", + "src": "188:37:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "215:9:23", + "nodeType": "YulIdentifier", + "src": "215:9:23" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "202:12:23", + "nodeType": "YulIdentifier", + "src": "202:12:23" + }, + "nativeSrc": "202:23:23", + "nodeType": "YulFunctionCall", + "src": "202:23:23" + }, + "variables": [ + { + "name": "offset", + "nativeSrc": "192:6:23", + "nodeType": "YulTypedName", + "src": "192:6:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "268:16:23", + "nodeType": "YulBlock", + "src": "268:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "277:1:23", + "nodeType": "YulLiteral", + "src": "277:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "280:1:23", + "nodeType": "YulLiteral", + "src": "280:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "270:6:23", + "nodeType": "YulIdentifier", + "src": "270:6:23" + }, + "nativeSrc": "270:12:23", + "nodeType": "YulFunctionCall", + "src": "270:12:23" + }, + "nativeSrc": "270:12:23", + "nodeType": "YulExpressionStatement", + "src": "270:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "offset", + "nativeSrc": "240:6:23", + "nodeType": "YulIdentifier", + "src": "240:6:23" + }, + { + "kind": "number", + "nativeSrc": "248:18:23", + "nodeType": "YulLiteral", + "src": "248:18:23", + "type": "", + "value": "0xffffffffffffffff" + } + ], + "functionName": { + "name": "gt", + "nativeSrc": "237:2:23", + "nodeType": "YulIdentifier", + "src": "237:2:23" + }, + "nativeSrc": "237:30:23", + "nodeType": "YulFunctionCall", + "src": "237:30:23" + }, + "nativeSrc": "234:50:23", + "nodeType": "YulIf", + "src": "234:50:23" + }, + { + "nativeSrc": "293:32:23", + "nodeType": "YulVariableDeclaration", + "src": "293:32:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "307:9:23", + "nodeType": "YulIdentifier", + "src": "307:9:23" + }, + { + "name": "offset", + "nativeSrc": "318:6:23", + "nodeType": "YulIdentifier", + "src": "318:6:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "303:3:23", + "nodeType": "YulIdentifier", + "src": "303:3:23" + }, + "nativeSrc": "303:22:23", + "nodeType": "YulFunctionCall", + "src": "303:22:23" + }, + "variables": [ + { + "name": "_1", + "nativeSrc": "297:2:23", + "nodeType": "YulTypedName", + "src": "297:2:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "364:16:23", + "nodeType": "YulBlock", + "src": "364:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "373:1:23", + "nodeType": "YulLiteral", + "src": "373:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "376:1:23", + "nodeType": "YulLiteral", + "src": "376:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "366:6:23", + "nodeType": "YulIdentifier", + "src": "366:6:23" + }, + "nativeSrc": "366:12:23", + "nodeType": "YulFunctionCall", + "src": "366:12:23" + }, + "nativeSrc": "366:12:23", + "nodeType": "YulExpressionStatement", + "src": "366:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nativeSrc": "345:7:23", + "nodeType": "YulIdentifier", + "src": "345:7:23" + }, + { + "name": "_1", + "nativeSrc": "354:2:23", + "nodeType": "YulIdentifier", + "src": "354:2:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "341:3:23", + "nodeType": "YulIdentifier", + "src": "341:3:23" + }, + "nativeSrc": "341:16:23", + "nodeType": "YulFunctionCall", + "src": "341:16:23" + }, + { + "kind": "number", + "nativeSrc": "359:3:23", + "nodeType": "YulLiteral", + "src": "359:3:23", + "type": "", + "value": "448" + } + ], + "functionName": { + "name": "slt", + "nativeSrc": "337:3:23", + "nodeType": "YulIdentifier", + "src": "337:3:23" + }, + "nativeSrc": "337:26:23", + "nodeType": "YulFunctionCall", + "src": "337:26:23" + }, + "nativeSrc": "334:46:23", + "nodeType": "YulIf", + "src": "334:46:23" + }, + { + "nativeSrc": "389:12:23", + "nodeType": "YulAssignment", + "src": "389:12:23", + "value": { + "name": "_1", + "nativeSrc": "399:2:23", + "nodeType": "YulIdentifier", + "src": "399:2:23" + }, + "variableNames": [ + { + "name": "value0", + "nativeSrc": "389:6:23", + "nodeType": "YulIdentifier", + "src": "389:6:23" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_struct$_ExecuteParams_$8182_calldata_ptr", + "nativeSrc": "14:393:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "83:9:23", + "nodeType": "YulTypedName", + "src": "83:9:23", + "type": "" + }, + { + "name": "dataEnd", + "nativeSrc": "94:7:23", + "nodeType": "YulTypedName", + "src": "94:7:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nativeSrc": "106:6:23", + "nodeType": "YulTypedName", + "src": "106:6:23", + "type": "" + } + ], + "src": "14:393:23" + }, + { + "body": { + "nativeSrc": "513:102:23", + "nodeType": "YulBlock", + "src": "513:102:23", + "statements": [ + { + "nativeSrc": "523:26:23", + "nodeType": "YulAssignment", + "src": "523:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "535:9:23", + "nodeType": "YulIdentifier", + "src": "535:9:23" + }, + { + "kind": "number", + "nativeSrc": "546:2:23", + "nodeType": "YulLiteral", + "src": "546:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "531:3:23", + "nodeType": "YulIdentifier", + "src": "531:3:23" + }, + "nativeSrc": "531:18:23", + "nodeType": "YulFunctionCall", + "src": "531:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "523:4:23", + "nodeType": "YulIdentifier", + "src": "523:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "565:9:23", + "nodeType": "YulIdentifier", + "src": "565:9:23" + }, + { + "arguments": [ + { + "name": "value0", + "nativeSrc": "580:6:23", + "nodeType": "YulIdentifier", + "src": "580:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "596:3:23", + "nodeType": "YulLiteral", + "src": "596:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "601:1:23", + "nodeType": "YulLiteral", + "src": "601:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "592:3:23", + "nodeType": "YulIdentifier", + "src": "592:3:23" + }, + "nativeSrc": "592:11:23", + "nodeType": "YulFunctionCall", + "src": "592:11:23" + }, + { + "kind": "number", + "nativeSrc": "605:1:23", + "nodeType": "YulLiteral", + "src": "605:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "588:3:23", + "nodeType": "YulIdentifier", + "src": "588:3:23" + }, + "nativeSrc": "588:19:23", + "nodeType": "YulFunctionCall", + "src": "588:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "576:3:23", + "nodeType": "YulIdentifier", + "src": "576:3:23" + }, + "nativeSrc": "576:32:23", + "nodeType": "YulFunctionCall", + "src": "576:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "558:6:23", + "nodeType": "YulIdentifier", + "src": "558:6:23" + }, + "nativeSrc": "558:51:23", + "nodeType": "YulFunctionCall", + "src": "558:51:23" + }, + "nativeSrc": "558:51:23", + "nodeType": "YulExpressionStatement", + "src": "558:51:23" + } + ] + }, + "name": "abi_encode_tuple_t_address__to_t_address__fromStack_reversed", + "nativeSrc": "412:203:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "482:9:23", + "nodeType": "YulTypedName", + "src": "482:9:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "493:6:23", + "nodeType": "YulTypedName", + "src": "493:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "504:4:23", + "nodeType": "YulTypedName", + "src": "504:4:23", + "type": "" + } + ], + "src": "412:203:23" + }, + { + "body": { + "nativeSrc": "670:239:23", + "nodeType": "YulBlock", + "src": "670:239:23", + "statements": [ + { + "nativeSrc": "680:26:23", + "nodeType": "YulVariableDeclaration", + "src": "680:26:23", + "value": { + "arguments": [ + { + "name": "value", + "nativeSrc": "700:5:23", + "nodeType": "YulIdentifier", + "src": "700:5:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "694:5:23", + "nodeType": "YulIdentifier", + "src": "694:5:23" + }, + "nativeSrc": "694:12:23", + "nodeType": "YulFunctionCall", + "src": "694:12:23" + }, + "variables": [ + { + "name": "length", + "nativeSrc": "684:6:23", + "nodeType": "YulTypedName", + "src": "684:6:23", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "pos", + "nativeSrc": "722:3:23", + "nodeType": "YulIdentifier", + "src": "722:3:23" + }, + { + "name": "length", + "nativeSrc": "727:6:23", + "nodeType": "YulIdentifier", + "src": "727:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "715:6:23", + "nodeType": "YulIdentifier", + "src": "715:6:23" + }, + "nativeSrc": "715:19:23", + "nodeType": "YulFunctionCall", + "src": "715:19:23" + }, + "nativeSrc": "715:19:23", + "nodeType": "YulExpressionStatement", + "src": "715:19:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "pos", + "nativeSrc": "753:3:23", + "nodeType": "YulIdentifier", + "src": "753:3:23" + }, + { + "kind": "number", + "nativeSrc": "758:4:23", + "nodeType": "YulLiteral", + "src": "758:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "749:3:23", + "nodeType": "YulIdentifier", + "src": "749:3:23" + }, + "nativeSrc": "749:14:23", + "nodeType": "YulFunctionCall", + "src": "749:14:23" + }, + { + "arguments": [ + { + "name": "value", + "nativeSrc": "769:5:23", + "nodeType": "YulIdentifier", + "src": "769:5:23" + }, + { + "kind": "number", + "nativeSrc": "776:4:23", + "nodeType": "YulLiteral", + "src": "776:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "765:3:23", + "nodeType": "YulIdentifier", + "src": "765:3:23" + }, + "nativeSrc": "765:16:23", + "nodeType": "YulFunctionCall", + "src": "765:16:23" + }, + { + "name": "length", + "nativeSrc": "783:6:23", + "nodeType": "YulIdentifier", + "src": "783:6:23" + } + ], + "functionName": { + "name": "mcopy", + "nativeSrc": "743:5:23", + "nodeType": "YulIdentifier", + "src": "743:5:23" + }, + "nativeSrc": "743:47:23", + "nodeType": "YulFunctionCall", + "src": "743:47:23" + }, + "nativeSrc": "743:47:23", + "nodeType": "YulExpressionStatement", + "src": "743:47:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "pos", + "nativeSrc": "814:3:23", + "nodeType": "YulIdentifier", + "src": "814:3:23" + }, + { + "name": "length", + "nativeSrc": "819:6:23", + "nodeType": "YulIdentifier", + "src": "819:6:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "810:3:23", + "nodeType": "YulIdentifier", + "src": "810:3:23" + }, + "nativeSrc": "810:16:23", + "nodeType": "YulFunctionCall", + "src": "810:16:23" + }, + { + "kind": "number", + "nativeSrc": "828:4:23", + "nodeType": "YulLiteral", + "src": "828:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "806:3:23", + "nodeType": "YulIdentifier", + "src": "806:3:23" + }, + "nativeSrc": "806:27:23", + "nodeType": "YulFunctionCall", + "src": "806:27:23" + }, + { + "kind": "number", + "nativeSrc": "835:1:23", + "nodeType": "YulLiteral", + "src": "835:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "799:6:23", + "nodeType": "YulIdentifier", + "src": "799:6:23" + }, + "nativeSrc": "799:38:23", + "nodeType": "YulFunctionCall", + "src": "799:38:23" + }, + "nativeSrc": "799:38:23", + "nodeType": "YulExpressionStatement", + "src": "799:38:23" + }, + { + "nativeSrc": "846:57:23", + "nodeType": "YulAssignment", + "src": "846:57:23", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "pos", + "nativeSrc": "861:3:23", + "nodeType": "YulIdentifier", + "src": "861:3:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "length", + "nativeSrc": "874:6:23", + "nodeType": "YulIdentifier", + "src": "874:6:23" + }, + { + "kind": "number", + "nativeSrc": "882:2:23", + "nodeType": "YulLiteral", + "src": "882:2:23", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "870:3:23", + "nodeType": "YulIdentifier", + "src": "870:3:23" + }, + "nativeSrc": "870:15:23", + "nodeType": "YulFunctionCall", + "src": "870:15:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "891:2:23", + "nodeType": "YulLiteral", + "src": "891:2:23", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "887:3:23", + "nodeType": "YulIdentifier", + "src": "887:3:23" + }, + "nativeSrc": "887:7:23", + "nodeType": "YulFunctionCall", + "src": "887:7:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "866:3:23", + "nodeType": "YulIdentifier", + "src": "866:3:23" + }, + "nativeSrc": "866:29:23", + "nodeType": "YulFunctionCall", + "src": "866:29:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "857:3:23", + "nodeType": "YulIdentifier", + "src": "857:3:23" + }, + "nativeSrc": "857:39:23", + "nodeType": "YulFunctionCall", + "src": "857:39:23" + }, + { + "kind": "number", + "nativeSrc": "898:4:23", + "nodeType": "YulLiteral", + "src": "898:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "853:3:23", + "nodeType": "YulIdentifier", + "src": "853:3:23" + }, + "nativeSrc": "853:50:23", + "nodeType": "YulFunctionCall", + "src": "853:50:23" + }, + "variableNames": [ + { + "name": "end", + "nativeSrc": "846:3:23", + "nodeType": "YulIdentifier", + "src": "846:3:23" + } + ] + } + ] + }, + "name": "abi_encode_string", + "nativeSrc": "620:289:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nativeSrc": "647:5:23", + "nodeType": "YulTypedName", + "src": "647:5:23", + "type": "" + }, + { + "name": "pos", + "nativeSrc": "654:3:23", + "nodeType": "YulTypedName", + "src": "654:3:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nativeSrc": "662:3:23", + "nodeType": "YulTypedName", + "src": "662:3:23", + "type": "" + } + ], + "src": "620:289:23" + }, + { + "body": { + "nativeSrc": "1271:881:23", + "nodeType": "YulBlock", + "src": "1271:881:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "1288:9:23", + "nodeType": "YulIdentifier", + "src": "1288:9:23" + }, + { + "arguments": [ + { + "name": "value0", + "nativeSrc": "1303:6:23", + "nodeType": "YulIdentifier", + "src": "1303:6:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1315:3:23", + "nodeType": "YulLiteral", + "src": "1315:3:23", + "type": "", + "value": "248" + }, + { + "kind": "number", + "nativeSrc": "1320:3:23", + "nodeType": "YulLiteral", + "src": "1320:3:23", + "type": "", + "value": "255" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "1311:3:23", + "nodeType": "YulIdentifier", + "src": "1311:3:23" + }, + "nativeSrc": "1311:13:23", + "nodeType": "YulFunctionCall", + "src": "1311:13:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "1299:3:23", + "nodeType": "YulIdentifier", + "src": "1299:3:23" + }, + "nativeSrc": "1299:26:23", + "nodeType": "YulFunctionCall", + "src": "1299:26:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1281:6:23", + "nodeType": "YulIdentifier", + "src": "1281:6:23" + }, + "nativeSrc": "1281:45:23", + "nodeType": "YulFunctionCall", + "src": "1281:45:23" + }, + "nativeSrc": "1281:45:23", + "nodeType": "YulExpressionStatement", + "src": "1281:45:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "1346:9:23", + "nodeType": "YulIdentifier", + "src": "1346:9:23" + }, + { + "kind": "number", + "nativeSrc": "1357:2:23", + "nodeType": "YulLiteral", + "src": "1357:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1342:3:23", + "nodeType": "YulIdentifier", + "src": "1342:3:23" + }, + "nativeSrc": "1342:18:23", + "nodeType": "YulFunctionCall", + "src": "1342:18:23" + }, + { + "kind": "number", + "nativeSrc": "1362:3:23", + "nodeType": "YulLiteral", + "src": "1362:3:23", + "type": "", + "value": "224" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1335:6:23", + "nodeType": "YulIdentifier", + "src": "1335:6:23" + }, + "nativeSrc": "1335:31:23", + "nodeType": "YulFunctionCall", + "src": "1335:31:23" + }, + "nativeSrc": "1335:31:23", + "nodeType": "YulExpressionStatement", + "src": "1335:31:23" + }, + { + "nativeSrc": "1375:60:23", + "nodeType": "YulVariableDeclaration", + "src": "1375:60:23", + "value": { + "arguments": [ + { + "name": "value1", + "nativeSrc": "1407:6:23", + "nodeType": "YulIdentifier", + "src": "1407:6:23" + }, + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "1419:9:23", + "nodeType": "YulIdentifier", + "src": "1419:9:23" + }, + { + "kind": "number", + "nativeSrc": "1430:3:23", + "nodeType": "YulLiteral", + "src": "1430:3:23", + "type": "", + "value": "224" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1415:3:23", + "nodeType": "YulIdentifier", + "src": "1415:3:23" + }, + "nativeSrc": "1415:19:23", + "nodeType": "YulFunctionCall", + "src": "1415:19:23" + } + ], + "functionName": { + "name": "abi_encode_string", + "nativeSrc": "1389:17:23", + "nodeType": "YulIdentifier", + "src": "1389:17:23" + }, + "nativeSrc": "1389:46:23", + "nodeType": "YulFunctionCall", + "src": "1389:46:23" + }, + "variables": [ + { + "name": "tail_1", + "nativeSrc": "1379:6:23", + "nodeType": "YulTypedName", + "src": "1379:6:23", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "1455:9:23", + "nodeType": "YulIdentifier", + "src": "1455:9:23" + }, + { + "kind": "number", + "nativeSrc": "1466:2:23", + "nodeType": "YulLiteral", + "src": "1466:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1451:3:23", + "nodeType": "YulIdentifier", + "src": "1451:3:23" + }, + "nativeSrc": "1451:18:23", + "nodeType": "YulFunctionCall", + "src": "1451:18:23" + }, + { + "arguments": [ + { + "name": "tail_1", + "nativeSrc": "1475:6:23", + "nodeType": "YulIdentifier", + "src": "1475:6:23" + }, + { + "name": "headStart", + "nativeSrc": "1483:9:23", + "nodeType": "YulIdentifier", + "src": "1483:9:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "1471:3:23", + "nodeType": "YulIdentifier", + "src": "1471:3:23" + }, + "nativeSrc": "1471:22:23", + "nodeType": "YulFunctionCall", + "src": "1471:22:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1444:6:23", + "nodeType": "YulIdentifier", + "src": "1444:6:23" + }, + "nativeSrc": "1444:50:23", + "nodeType": "YulFunctionCall", + "src": "1444:50:23" + }, + "nativeSrc": "1444:50:23", + "nodeType": "YulExpressionStatement", + "src": "1444:50:23" + }, + { + "nativeSrc": "1503:47:23", + "nodeType": "YulVariableDeclaration", + "src": "1503:47:23", + "value": { + "arguments": [ + { + "name": "value2", + "nativeSrc": "1535:6:23", + "nodeType": "YulIdentifier", + "src": "1535:6:23" + }, + { + "name": "tail_1", + "nativeSrc": "1543:6:23", + "nodeType": "YulIdentifier", + "src": "1543:6:23" + } + ], + "functionName": { + "name": "abi_encode_string", + "nativeSrc": "1517:17:23", + "nodeType": "YulIdentifier", + "src": "1517:17:23" + }, + "nativeSrc": "1517:33:23", + "nodeType": "YulFunctionCall", + "src": "1517:33:23" + }, + "variables": [ + { + "name": "tail_2", + "nativeSrc": "1507:6:23", + "nodeType": "YulTypedName", + "src": "1507:6:23", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "1570:9:23", + "nodeType": "YulIdentifier", + "src": "1570:9:23" + }, + { + "kind": "number", + "nativeSrc": "1581:2:23", + "nodeType": "YulLiteral", + "src": "1581:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1566:3:23", + "nodeType": "YulIdentifier", + "src": "1566:3:23" + }, + "nativeSrc": "1566:18:23", + "nodeType": "YulFunctionCall", + "src": "1566:18:23" + }, + { + "name": "value3", + "nativeSrc": "1586:6:23", + "nodeType": "YulIdentifier", + "src": "1586:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1559:6:23", + "nodeType": "YulIdentifier", + "src": "1559:6:23" + }, + "nativeSrc": "1559:34:23", + "nodeType": "YulFunctionCall", + "src": "1559:34:23" + }, + "nativeSrc": "1559:34:23", + "nodeType": "YulExpressionStatement", + "src": "1559:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "1613:9:23", + "nodeType": "YulIdentifier", + "src": "1613:9:23" + }, + { + "kind": "number", + "nativeSrc": "1624:3:23", + "nodeType": "YulLiteral", + "src": "1624:3:23", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1609:3:23", + "nodeType": "YulIdentifier", + "src": "1609:3:23" + }, + "nativeSrc": "1609:19:23", + "nodeType": "YulFunctionCall", + "src": "1609:19:23" + }, + { + "arguments": [ + { + "name": "value4", + "nativeSrc": "1634:6:23", + "nodeType": "YulIdentifier", + "src": "1634:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "1650:3:23", + "nodeType": "YulLiteral", + "src": "1650:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "1655:1:23", + "nodeType": "YulLiteral", + "src": "1655:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "1646:3:23", + "nodeType": "YulIdentifier", + "src": "1646:3:23" + }, + "nativeSrc": "1646:11:23", + "nodeType": "YulFunctionCall", + "src": "1646:11:23" + }, + { + "kind": "number", + "nativeSrc": "1659:1:23", + "nodeType": "YulLiteral", + "src": "1659:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "1642:3:23", + "nodeType": "YulIdentifier", + "src": "1642:3:23" + }, + "nativeSrc": "1642:19:23", + "nodeType": "YulFunctionCall", + "src": "1642:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "1630:3:23", + "nodeType": "YulIdentifier", + "src": "1630:3:23" + }, + "nativeSrc": "1630:32:23", + "nodeType": "YulFunctionCall", + "src": "1630:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1602:6:23", + "nodeType": "YulIdentifier", + "src": "1602:6:23" + }, + "nativeSrc": "1602:61:23", + "nodeType": "YulFunctionCall", + "src": "1602:61:23" + }, + "nativeSrc": "1602:61:23", + "nodeType": "YulExpressionStatement", + "src": "1602:61:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "1683:9:23", + "nodeType": "YulIdentifier", + "src": "1683:9:23" + }, + { + "kind": "number", + "nativeSrc": "1694:3:23", + "nodeType": "YulLiteral", + "src": "1694:3:23", + "type": "", + "value": "160" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1679:3:23", + "nodeType": "YulIdentifier", + "src": "1679:3:23" + }, + "nativeSrc": "1679:19:23", + "nodeType": "YulFunctionCall", + "src": "1679:19:23" + }, + { + "name": "value5", + "nativeSrc": "1700:6:23", + "nodeType": "YulIdentifier", + "src": "1700:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1672:6:23", + "nodeType": "YulIdentifier", + "src": "1672:6:23" + }, + "nativeSrc": "1672:35:23", + "nodeType": "YulFunctionCall", + "src": "1672:35:23" + }, + "nativeSrc": "1672:35:23", + "nodeType": "YulExpressionStatement", + "src": "1672:35:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "1727:9:23", + "nodeType": "YulIdentifier", + "src": "1727:9:23" + }, + { + "kind": "number", + "nativeSrc": "1738:3:23", + "nodeType": "YulLiteral", + "src": "1738:3:23", + "type": "", + "value": "192" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1723:3:23", + "nodeType": "YulIdentifier", + "src": "1723:3:23" + }, + "nativeSrc": "1723:19:23", + "nodeType": "YulFunctionCall", + "src": "1723:19:23" + }, + { + "arguments": [ + { + "name": "tail_2", + "nativeSrc": "1748:6:23", + "nodeType": "YulIdentifier", + "src": "1748:6:23" + }, + { + "name": "headStart", + "nativeSrc": "1756:9:23", + "nodeType": "YulIdentifier", + "src": "1756:9:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "1744:3:23", + "nodeType": "YulIdentifier", + "src": "1744:3:23" + }, + "nativeSrc": "1744:22:23", + "nodeType": "YulFunctionCall", + "src": "1744:22:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1716:6:23", + "nodeType": "YulIdentifier", + "src": "1716:6:23" + }, + "nativeSrc": "1716:51:23", + "nodeType": "YulFunctionCall", + "src": "1716:51:23" + }, + "nativeSrc": "1716:51:23", + "nodeType": "YulExpressionStatement", + "src": "1716:51:23" + }, + { + "nativeSrc": "1776:17:23", + "nodeType": "YulVariableDeclaration", + "src": "1776:17:23", + "value": { + "name": "tail_2", + "nativeSrc": "1787:6:23", + "nodeType": "YulIdentifier", + "src": "1787:6:23" + }, + "variables": [ + { + "name": "pos", + "nativeSrc": "1780:3:23", + "nodeType": "YulTypedName", + "src": "1780:3:23", + "type": "" + } + ] + }, + { + "nativeSrc": "1802:27:23", + "nodeType": "YulVariableDeclaration", + "src": "1802:27:23", + "value": { + "arguments": [ + { + "name": "value6", + "nativeSrc": "1822:6:23", + "nodeType": "YulIdentifier", + "src": "1822:6:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "1816:5:23", + "nodeType": "YulIdentifier", + "src": "1816:5:23" + }, + "nativeSrc": "1816:13:23", + "nodeType": "YulFunctionCall", + "src": "1816:13:23" + }, + "variables": [ + { + "name": "length", + "nativeSrc": "1806:6:23", + "nodeType": "YulTypedName", + "src": "1806:6:23", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "tail_2", + "nativeSrc": "1845:6:23", + "nodeType": "YulIdentifier", + "src": "1845:6:23" + }, + { + "name": "length", + "nativeSrc": "1853:6:23", + "nodeType": "YulIdentifier", + "src": "1853:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "1838:6:23", + "nodeType": "YulIdentifier", + "src": "1838:6:23" + }, + "nativeSrc": "1838:22:23", + "nodeType": "YulFunctionCall", + "src": "1838:22:23" + }, + "nativeSrc": "1838:22:23", + "nodeType": "YulExpressionStatement", + "src": "1838:22:23" + }, + { + "nativeSrc": "1869:22:23", + "nodeType": "YulAssignment", + "src": "1869:22:23", + "value": { + "arguments": [ + { + "name": "tail_2", + "nativeSrc": "1880:6:23", + "nodeType": "YulIdentifier", + "src": "1880:6:23" + }, + { + "kind": "number", + "nativeSrc": "1888:2:23", + "nodeType": "YulLiteral", + "src": "1888:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1876:3:23", + "nodeType": "YulIdentifier", + "src": "1876:3:23" + }, + "nativeSrc": "1876:15:23", + "nodeType": "YulFunctionCall", + "src": "1876:15:23" + }, + "variableNames": [ + { + "name": "pos", + "nativeSrc": "1869:3:23", + "nodeType": "YulIdentifier", + "src": "1869:3:23" + } + ] + }, + { + "nativeSrc": "1900:29:23", + "nodeType": "YulVariableDeclaration", + "src": "1900:29:23", + "value": { + "arguments": [ + { + "name": "value6", + "nativeSrc": "1918:6:23", + "nodeType": "YulIdentifier", + "src": "1918:6:23" + }, + { + "kind": "number", + "nativeSrc": "1926:2:23", + "nodeType": "YulLiteral", + "src": "1926:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1914:3:23", + "nodeType": "YulIdentifier", + "src": "1914:3:23" + }, + "nativeSrc": "1914:15:23", + "nodeType": "YulFunctionCall", + "src": "1914:15:23" + }, + "variables": [ + { + "name": "srcPtr", + "nativeSrc": "1904:6:23", + "nodeType": "YulTypedName", + "src": "1904:6:23", + "type": "" + } + ] + }, + { + "nativeSrc": "1938:10:23", + "nodeType": "YulVariableDeclaration", + "src": "1938:10:23", + "value": { + "kind": "number", + "nativeSrc": "1947:1:23", + "nodeType": "YulLiteral", + "src": "1947:1:23", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "i", + "nativeSrc": "1942:1:23", + "nodeType": "YulTypedName", + "src": "1942:1:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "2006:120:23", + "nodeType": "YulBlock", + "src": "2006:120:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "pos", + "nativeSrc": "2027:3:23", + "nodeType": "YulIdentifier", + "src": "2027:3:23" + }, + { + "arguments": [ + { + "name": "srcPtr", + "nativeSrc": "2038:6:23", + "nodeType": "YulIdentifier", + "src": "2038:6:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "2032:5:23", + "nodeType": "YulIdentifier", + "src": "2032:5:23" + }, + "nativeSrc": "2032:13:23", + "nodeType": "YulFunctionCall", + "src": "2032:13:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "2020:6:23", + "nodeType": "YulIdentifier", + "src": "2020:6:23" + }, + "nativeSrc": "2020:26:23", + "nodeType": "YulFunctionCall", + "src": "2020:26:23" + }, + "nativeSrc": "2020:26:23", + "nodeType": "YulExpressionStatement", + "src": "2020:26:23" + }, + { + "nativeSrc": "2059:19:23", + "nodeType": "YulAssignment", + "src": "2059:19:23", + "value": { + "arguments": [ + { + "name": "pos", + "nativeSrc": "2070:3:23", + "nodeType": "YulIdentifier", + "src": "2070:3:23" + }, + { + "kind": "number", + "nativeSrc": "2075:2:23", + "nodeType": "YulLiteral", + "src": "2075:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2066:3:23", + "nodeType": "YulIdentifier", + "src": "2066:3:23" + }, + "nativeSrc": "2066:12:23", + "nodeType": "YulFunctionCall", + "src": "2066:12:23" + }, + "variableNames": [ + { + "name": "pos", + "nativeSrc": "2059:3:23", + "nodeType": "YulIdentifier", + "src": "2059:3:23" + } + ] + }, + { + "nativeSrc": "2091:25:23", + "nodeType": "YulAssignment", + "src": "2091:25:23", + "value": { + "arguments": [ + { + "name": "srcPtr", + "nativeSrc": "2105:6:23", + "nodeType": "YulIdentifier", + "src": "2105:6:23" + }, + { + "kind": "number", + "nativeSrc": "2113:2:23", + "nodeType": "YulLiteral", + "src": "2113:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2101:3:23", + "nodeType": "YulIdentifier", + "src": "2101:3:23" + }, + "nativeSrc": "2101:15:23", + "nodeType": "YulFunctionCall", + "src": "2101:15:23" + }, + "variableNames": [ + { + "name": "srcPtr", + "nativeSrc": "2091:6:23", + "nodeType": "YulIdentifier", + "src": "2091:6:23" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "i", + "nativeSrc": "1968:1:23", + "nodeType": "YulIdentifier", + "src": "1968:1:23" + }, + { + "name": "length", + "nativeSrc": "1971:6:23", + "nodeType": "YulIdentifier", + "src": "1971:6:23" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "1965:2:23", + "nodeType": "YulIdentifier", + "src": "1965:2:23" + }, + "nativeSrc": "1965:13:23", + "nodeType": "YulFunctionCall", + "src": "1965:13:23" + }, + "nativeSrc": "1957:169:23", + "nodeType": "YulForLoop", + "post": { + "nativeSrc": "1979:18:23", + "nodeType": "YulBlock", + "src": "1979:18:23", + "statements": [ + { + "nativeSrc": "1981:14:23", + "nodeType": "YulAssignment", + "src": "1981:14:23", + "value": { + "arguments": [ + { + "name": "i", + "nativeSrc": "1990:1:23", + "nodeType": "YulIdentifier", + "src": "1990:1:23" + }, + { + "kind": "number", + "nativeSrc": "1993:1:23", + "nodeType": "YulLiteral", + "src": "1993:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "1986:3:23", + "nodeType": "YulIdentifier", + "src": "1986:3:23" + }, + "nativeSrc": "1986:9:23", + "nodeType": "YulFunctionCall", + "src": "1986:9:23" + }, + "variableNames": [ + { + "name": "i", + "nativeSrc": "1981:1:23", + "nodeType": "YulIdentifier", + "src": "1981:1:23" + } + ] + } + ] + }, + "pre": { + "nativeSrc": "1961:3:23", + "nodeType": "YulBlock", + "src": "1961:3:23", + "statements": [] + }, + "src": "1957:169:23" + }, + { + "nativeSrc": "2135:11:23", + "nodeType": "YulAssignment", + "src": "2135:11:23", + "value": { + "name": "pos", + "nativeSrc": "2143:3:23", + "nodeType": "YulIdentifier", + "src": "2143:3:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "2135:4:23", + "nodeType": "YulIdentifier", + "src": "2135:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_bytes1_t_string_memory_ptr_t_string_memory_ptr_t_uint256_t_address_t_bytes32_t_array$_t_uint256_$dyn_memory_ptr__to_t_bytes1_t_string_memory_ptr_t_string_memory_ptr_t_uint256_t_address_t_bytes32_t_array$_t_uint256_$dyn_memory_ptr__fromStack_reversed", + "nativeSrc": "914:1238:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "1192:9:23", + "nodeType": "YulTypedName", + "src": "1192:9:23", + "type": "" + }, + { + "name": "value6", + "nativeSrc": "1203:6:23", + "nodeType": "YulTypedName", + "src": "1203:6:23", + "type": "" + }, + { + "name": "value5", + "nativeSrc": "1211:6:23", + "nodeType": "YulTypedName", + "src": "1211:6:23", + "type": "" + }, + { + "name": "value4", + "nativeSrc": "1219:6:23", + "nodeType": "YulTypedName", + "src": "1219:6:23", + "type": "" + }, + { + "name": "value3", + "nativeSrc": "1227:6:23", + "nodeType": "YulTypedName", + "src": "1227:6:23", + "type": "" + }, + { + "name": "value2", + "nativeSrc": "1235:6:23", + "nodeType": "YulTypedName", + "src": "1235:6:23", + "type": "" + }, + { + "name": "value1", + "nativeSrc": "1243:6:23", + "nodeType": "YulTypedName", + "src": "1243:6:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "1251:6:23", + "nodeType": "YulTypedName", + "src": "1251:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "1262:4:23", + "nodeType": "YulTypedName", + "src": "1262:4:23", + "type": "" + } + ], + "src": "914:1238:23" + }, + { + "body": { + "nativeSrc": "2206:124:23", + "nodeType": "YulBlock", + "src": "2206:124:23", + "statements": [ + { + "nativeSrc": "2216:29:23", + "nodeType": "YulAssignment", + "src": "2216:29:23", + "value": { + "arguments": [ + { + "name": "offset", + "nativeSrc": "2238:6:23", + "nodeType": "YulIdentifier", + "src": "2238:6:23" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "2225:12:23", + "nodeType": "YulIdentifier", + "src": "2225:12:23" + }, + "nativeSrc": "2225:20:23", + "nodeType": "YulFunctionCall", + "src": "2225:20:23" + }, + "variableNames": [ + { + "name": "value", + "nativeSrc": "2216:5:23", + "nodeType": "YulIdentifier", + "src": "2216:5:23" + } + ] + }, + { + "body": { + "nativeSrc": "2308:16:23", + "nodeType": "YulBlock", + "src": "2308:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2317:1:23", + "nodeType": "YulLiteral", + "src": "2317:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "2320:1:23", + "nodeType": "YulLiteral", + "src": "2320:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "2310:6:23", + "nodeType": "YulIdentifier", + "src": "2310:6:23" + }, + "nativeSrc": "2310:12:23", + "nodeType": "YulFunctionCall", + "src": "2310:12:23" + }, + "nativeSrc": "2310:12:23", + "nodeType": "YulExpressionStatement", + "src": "2310:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nativeSrc": "2267:5:23", + "nodeType": "YulIdentifier", + "src": "2267:5:23" + }, + { + "arguments": [ + { + "name": "value", + "nativeSrc": "2278:5:23", + "nodeType": "YulIdentifier", + "src": "2278:5:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2293:3:23", + "nodeType": "YulLiteral", + "src": "2293:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "2298:1:23", + "nodeType": "YulLiteral", + "src": "2298:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "2289:3:23", + "nodeType": "YulIdentifier", + "src": "2289:3:23" + }, + "nativeSrc": "2289:11:23", + "nodeType": "YulFunctionCall", + "src": "2289:11:23" + }, + { + "kind": "number", + "nativeSrc": "2302:1:23", + "nodeType": "YulLiteral", + "src": "2302:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "2285:3:23", + "nodeType": "YulIdentifier", + "src": "2285:3:23" + }, + "nativeSrc": "2285:19:23", + "nodeType": "YulFunctionCall", + "src": "2285:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "2274:3:23", + "nodeType": "YulIdentifier", + "src": "2274:3:23" + }, + "nativeSrc": "2274:31:23", + "nodeType": "YulFunctionCall", + "src": "2274:31:23" + } + ], + "functionName": { + "name": "eq", + "nativeSrc": "2264:2:23", + "nodeType": "YulIdentifier", + "src": "2264:2:23" + }, + "nativeSrc": "2264:42:23", + "nodeType": "YulFunctionCall", + "src": "2264:42:23" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "2257:6:23", + "nodeType": "YulIdentifier", + "src": "2257:6:23" + }, + "nativeSrc": "2257:50:23", + "nodeType": "YulFunctionCall", + "src": "2257:50:23" + }, + "nativeSrc": "2254:70:23", + "nodeType": "YulIf", + "src": "2254:70:23" + } + ] + }, + "name": "abi_decode_address", + "nativeSrc": "2157:173:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "offset", + "nativeSrc": "2185:6:23", + "nodeType": "YulTypedName", + "src": "2185:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value", + "nativeSrc": "2196:5:23", + "nodeType": "YulTypedName", + "src": "2196:5:23", + "type": "" + } + ], + "src": "2157:173:23" + }, + { + "body": { + "nativeSrc": "2422:213:23", + "nodeType": "YulBlock", + "src": "2422:213:23", + "statements": [ + { + "body": { + "nativeSrc": "2468:16:23", + "nodeType": "YulBlock", + "src": "2468:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2477:1:23", + "nodeType": "YulLiteral", + "src": "2477:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "2480:1:23", + "nodeType": "YulLiteral", + "src": "2480:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "2470:6:23", + "nodeType": "YulIdentifier", + "src": "2470:6:23" + }, + "nativeSrc": "2470:12:23", + "nodeType": "YulFunctionCall", + "src": "2470:12:23" + }, + "nativeSrc": "2470:12:23", + "nodeType": "YulExpressionStatement", + "src": "2470:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nativeSrc": "2443:7:23", + "nodeType": "YulIdentifier", + "src": "2443:7:23" + }, + { + "name": "headStart", + "nativeSrc": "2452:9:23", + "nodeType": "YulIdentifier", + "src": "2452:9:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "2439:3:23", + "nodeType": "YulIdentifier", + "src": "2439:3:23" + }, + "nativeSrc": "2439:23:23", + "nodeType": "YulFunctionCall", + "src": "2439:23:23" + }, + { + "kind": "number", + "nativeSrc": "2464:2:23", + "nodeType": "YulLiteral", + "src": "2464:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "slt", + "nativeSrc": "2435:3:23", + "nodeType": "YulIdentifier", + "src": "2435:3:23" + }, + "nativeSrc": "2435:32:23", + "nodeType": "YulFunctionCall", + "src": "2435:32:23" + }, + "nativeSrc": "2432:52:23", + "nodeType": "YulIf", + "src": "2432:52:23" + }, + { + "nativeSrc": "2493:39:23", + "nodeType": "YulAssignment", + "src": "2493:39:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "2522:9:23", + "nodeType": "YulIdentifier", + "src": "2522:9:23" + } + ], + "functionName": { + "name": "abi_decode_address", + "nativeSrc": "2503:18:23", + "nodeType": "YulIdentifier", + "src": "2503:18:23" + }, + "nativeSrc": "2503:29:23", + "nodeType": "YulFunctionCall", + "src": "2503:29:23" + }, + "variableNames": [ + { + "name": "value0", + "nativeSrc": "2493:6:23", + "nodeType": "YulIdentifier", + "src": "2493:6:23" + } + ] + }, + { + "nativeSrc": "2541:14:23", + "nodeType": "YulVariableDeclaration", + "src": "2541:14:23", + "value": { + "kind": "number", + "nativeSrc": "2554:1:23", + "nodeType": "YulLiteral", + "src": "2554:1:23", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "value", + "nativeSrc": "2545:5:23", + "nodeType": "YulTypedName", + "src": "2545:5:23", + "type": "" + } + ] + }, + { + "nativeSrc": "2564:41:23", + "nodeType": "YulAssignment", + "src": "2564:41:23", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "2590:9:23", + "nodeType": "YulIdentifier", + "src": "2590:9:23" + }, + { + "kind": "number", + "nativeSrc": "2601:2:23", + "nodeType": "YulLiteral", + "src": "2601:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2586:3:23", + "nodeType": "YulIdentifier", + "src": "2586:3:23" + }, + "nativeSrc": "2586:18:23", + "nodeType": "YulFunctionCall", + "src": "2586:18:23" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "2573:12:23", + "nodeType": "YulIdentifier", + "src": "2573:12:23" + }, + "nativeSrc": "2573:32:23", + "nodeType": "YulFunctionCall", + "src": "2573:32:23" + }, + "variableNames": [ + { + "name": "value", + "nativeSrc": "2564:5:23", + "nodeType": "YulIdentifier", + "src": "2564:5:23" + } + ] + }, + { + "nativeSrc": "2614:15:23", + "nodeType": "YulAssignment", + "src": "2614:15:23", + "value": { + "name": "value", + "nativeSrc": "2624:5:23", + "nodeType": "YulIdentifier", + "src": "2624:5:23" + }, + "variableNames": [ + { + "name": "value1", + "nativeSrc": "2614:6:23", + "nodeType": "YulIdentifier", + "src": "2614:6:23" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_addresst_uint256", + "nativeSrc": "2335:300:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "2380:9:23", + "nodeType": "YulTypedName", + "src": "2380:9:23", + "type": "" + }, + { + "name": "dataEnd", + "nativeSrc": "2391:7:23", + "nodeType": "YulTypedName", + "src": "2391:7:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nativeSrc": "2403:6:23", + "nodeType": "YulTypedName", + "src": "2403:6:23", + "type": "" + }, + { + "name": "value1", + "nativeSrc": "2411:6:23", + "nodeType": "YulTypedName", + "src": "2411:6:23", + "type": "" + } + ], + "src": "2335:300:23" + }, + { + "body": { + "nativeSrc": "2735:92:23", + "nodeType": "YulBlock", + "src": "2735:92:23", + "statements": [ + { + "nativeSrc": "2745:26:23", + "nodeType": "YulAssignment", + "src": "2745:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "2757:9:23", + "nodeType": "YulIdentifier", + "src": "2757:9:23" + }, + { + "kind": "number", + "nativeSrc": "2768:2:23", + "nodeType": "YulLiteral", + "src": "2768:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "2753:3:23", + "nodeType": "YulIdentifier", + "src": "2753:3:23" + }, + "nativeSrc": "2753:18:23", + "nodeType": "YulFunctionCall", + "src": "2753:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "2745:4:23", + "nodeType": "YulIdentifier", + "src": "2745:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "2787:9:23", + "nodeType": "YulIdentifier", + "src": "2787:9:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "value0", + "nativeSrc": "2812:6:23", + "nodeType": "YulIdentifier", + "src": "2812:6:23" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "2805:6:23", + "nodeType": "YulIdentifier", + "src": "2805:6:23" + }, + "nativeSrc": "2805:14:23", + "nodeType": "YulFunctionCall", + "src": "2805:14:23" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "2798:6:23", + "nodeType": "YulIdentifier", + "src": "2798:6:23" + }, + "nativeSrc": "2798:22:23", + "nodeType": "YulFunctionCall", + "src": "2798:22:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "2780:6:23", + "nodeType": "YulIdentifier", + "src": "2780:6:23" + }, + "nativeSrc": "2780:41:23", + "nodeType": "YulFunctionCall", + "src": "2780:41:23" + }, + "nativeSrc": "2780:41:23", + "nodeType": "YulExpressionStatement", + "src": "2780:41:23" + } + ] + }, + "name": "abi_encode_tuple_t_bool__to_t_bool__fromStack_reversed", + "nativeSrc": "2640:187:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "2704:9:23", + "nodeType": "YulTypedName", + "src": "2704:9:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "2715:6:23", + "nodeType": "YulTypedName", + "src": "2715:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "2726:4:23", + "nodeType": "YulTypedName", + "src": "2726:4:23", + "type": "" + } + ], + "src": "2640:187:23" + }, + { + "body": { + "nativeSrc": "2902:156:23", + "nodeType": "YulBlock", + "src": "2902:156:23", + "statements": [ + { + "body": { + "nativeSrc": "2948:16:23", + "nodeType": "YulBlock", + "src": "2948:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "2957:1:23", + "nodeType": "YulLiteral", + "src": "2957:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "2960:1:23", + "nodeType": "YulLiteral", + "src": "2960:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "2950:6:23", + "nodeType": "YulIdentifier", + "src": "2950:6:23" + }, + "nativeSrc": "2950:12:23", + "nodeType": "YulFunctionCall", + "src": "2950:12:23" + }, + "nativeSrc": "2950:12:23", + "nodeType": "YulExpressionStatement", + "src": "2950:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nativeSrc": "2923:7:23", + "nodeType": "YulIdentifier", + "src": "2923:7:23" + }, + { + "name": "headStart", + "nativeSrc": "2932:9:23", + "nodeType": "YulIdentifier", + "src": "2932:9:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "2919:3:23", + "nodeType": "YulIdentifier", + "src": "2919:3:23" + }, + "nativeSrc": "2919:23:23", + "nodeType": "YulFunctionCall", + "src": "2919:23:23" + }, + { + "kind": "number", + "nativeSrc": "2944:2:23", + "nodeType": "YulLiteral", + "src": "2944:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nativeSrc": "2915:3:23", + "nodeType": "YulIdentifier", + "src": "2915:3:23" + }, + "nativeSrc": "2915:32:23", + "nodeType": "YulFunctionCall", + "src": "2915:32:23" + }, + "nativeSrc": "2912:52:23", + "nodeType": "YulIf", + "src": "2912:52:23" + }, + { + "nativeSrc": "2973:14:23", + "nodeType": "YulVariableDeclaration", + "src": "2973:14:23", + "value": { + "kind": "number", + "nativeSrc": "2986:1:23", + "nodeType": "YulLiteral", + "src": "2986:1:23", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "value", + "nativeSrc": "2977:5:23", + "nodeType": "YulTypedName", + "src": "2977:5:23", + "type": "" + } + ] + }, + { + "nativeSrc": "2996:32:23", + "nodeType": "YulAssignment", + "src": "2996:32:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3018:9:23", + "nodeType": "YulIdentifier", + "src": "3018:9:23" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "3005:12:23", + "nodeType": "YulIdentifier", + "src": "3005:12:23" + }, + "nativeSrc": "3005:23:23", + "nodeType": "YulFunctionCall", + "src": "3005:23:23" + }, + "variableNames": [ + { + "name": "value", + "nativeSrc": "2996:5:23", + "nodeType": "YulIdentifier", + "src": "2996:5:23" + } + ] + }, + { + "nativeSrc": "3037:15:23", + "nodeType": "YulAssignment", + "src": "3037:15:23", + "value": { + "name": "value", + "nativeSrc": "3047:5:23", + "nodeType": "YulIdentifier", + "src": "3047:5:23" + }, + "variableNames": [ + { + "name": "value0", + "nativeSrc": "3037:6:23", + "nodeType": "YulIdentifier", + "src": "3037:6:23" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_uint256", + "nativeSrc": "2832:226:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "2868:9:23", + "nodeType": "YulTypedName", + "src": "2868:9:23", + "type": "" + }, + { + "name": "dataEnd", + "nativeSrc": "2879:7:23", + "nodeType": "YulTypedName", + "src": "2879:7:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nativeSrc": "2891:6:23", + "nodeType": "YulTypedName", + "src": "2891:6:23", + "type": "" + } + ], + "src": "2832:226:23" + }, + { + "body": { + "nativeSrc": "3133:116:23", + "nodeType": "YulBlock", + "src": "3133:116:23", + "statements": [ + { + "body": { + "nativeSrc": "3179:16:23", + "nodeType": "YulBlock", + "src": "3179:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "3188:1:23", + "nodeType": "YulLiteral", + "src": "3188:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "3191:1:23", + "nodeType": "YulLiteral", + "src": "3191:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "3181:6:23", + "nodeType": "YulIdentifier", + "src": "3181:6:23" + }, + "nativeSrc": "3181:12:23", + "nodeType": "YulFunctionCall", + "src": "3181:12:23" + }, + "nativeSrc": "3181:12:23", + "nodeType": "YulExpressionStatement", + "src": "3181:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nativeSrc": "3154:7:23", + "nodeType": "YulIdentifier", + "src": "3154:7:23" + }, + { + "name": "headStart", + "nativeSrc": "3163:9:23", + "nodeType": "YulIdentifier", + "src": "3163:9:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "3150:3:23", + "nodeType": "YulIdentifier", + "src": "3150:3:23" + }, + "nativeSrc": "3150:23:23", + "nodeType": "YulFunctionCall", + "src": "3150:23:23" + }, + { + "kind": "number", + "nativeSrc": "3175:2:23", + "nodeType": "YulLiteral", + "src": "3175:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nativeSrc": "3146:3:23", + "nodeType": "YulIdentifier", + "src": "3146:3:23" + }, + "nativeSrc": "3146:32:23", + "nodeType": "YulFunctionCall", + "src": "3146:32:23" + }, + "nativeSrc": "3143:52:23", + "nodeType": "YulIf", + "src": "3143:52:23" + }, + { + "nativeSrc": "3204:39:23", + "nodeType": "YulAssignment", + "src": "3204:39:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3233:9:23", + "nodeType": "YulIdentifier", + "src": "3233:9:23" + } + ], + "functionName": { + "name": "abi_decode_address", + "nativeSrc": "3214:18:23", + "nodeType": "YulIdentifier", + "src": "3214:18:23" + }, + "nativeSrc": "3214:29:23", + "nodeType": "YulFunctionCall", + "src": "3214:29:23" + }, + "variableNames": [ + { + "name": "value0", + "nativeSrc": "3204:6:23", + "nodeType": "YulIdentifier", + "src": "3204:6:23" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_address", + "nativeSrc": "3063:186:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "3099:9:23", + "nodeType": "YulTypedName", + "src": "3099:9:23", + "type": "" + }, + { + "name": "dataEnd", + "nativeSrc": "3110:7:23", + "nodeType": "YulTypedName", + "src": "3110:7:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nativeSrc": "3122:6:23", + "nodeType": "YulTypedName", + "src": "3122:6:23", + "type": "" + } + ], + "src": "3063:186:23" + }, + { + "body": { + "nativeSrc": "3428:163:23", + "nodeType": "YulBlock", + "src": "3428:163:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3445:9:23", + "nodeType": "YulIdentifier", + "src": "3445:9:23" + }, + { + "kind": "number", + "nativeSrc": "3456:2:23", + "nodeType": "YulLiteral", + "src": "3456:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3438:6:23", + "nodeType": "YulIdentifier", + "src": "3438:6:23" + }, + "nativeSrc": "3438:21:23", + "nodeType": "YulFunctionCall", + "src": "3438:21:23" + }, + "nativeSrc": "3438:21:23", + "nodeType": "YulExpressionStatement", + "src": "3438:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3479:9:23", + "nodeType": "YulIdentifier", + "src": "3479:9:23" + }, + { + "kind": "number", + "nativeSrc": "3490:2:23", + "nodeType": "YulLiteral", + "src": "3490:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3475:3:23", + "nodeType": "YulIdentifier", + "src": "3475:3:23" + }, + "nativeSrc": "3475:18:23", + "nodeType": "YulFunctionCall", + "src": "3475:18:23" + }, + { + "kind": "number", + "nativeSrc": "3495:2:23", + "nodeType": "YulLiteral", + "src": "3495:2:23", + "type": "", + "value": "13" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3468:6:23", + "nodeType": "YulIdentifier", + "src": "3468:6:23" + }, + "nativeSrc": "3468:30:23", + "nodeType": "YulFunctionCall", + "src": "3468:30:23" + }, + "nativeSrc": "3468:30:23", + "nodeType": "YulExpressionStatement", + "src": "3468:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3518:9:23", + "nodeType": "YulIdentifier", + "src": "3518:9:23" + }, + { + "kind": "number", + "nativeSrc": "3529:2:23", + "nodeType": "YulLiteral", + "src": "3529:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3514:3:23", + "nodeType": "YulIdentifier", + "src": "3514:3:23" + }, + "nativeSrc": "3514:18:23", + "nodeType": "YulFunctionCall", + "src": "3514:18:23" + }, + { + "hexValue": "496e76616c6964206f776e6572", + "kind": "string", + "nativeSrc": "3534:15:23", + "nodeType": "YulLiteral", + "src": "3534:15:23", + "type": "", + "value": "Invalid owner" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3507:6:23", + "nodeType": "YulIdentifier", + "src": "3507:6:23" + }, + "nativeSrc": "3507:43:23", + "nodeType": "YulFunctionCall", + "src": "3507:43:23" + }, + "nativeSrc": "3507:43:23", + "nodeType": "YulExpressionStatement", + "src": "3507:43:23" + }, + { + "nativeSrc": "3559:26:23", + "nodeType": "YulAssignment", + "src": "3559:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3571:9:23", + "nodeType": "YulIdentifier", + "src": "3571:9:23" + }, + { + "kind": "number", + "nativeSrc": "3582:2:23", + "nodeType": "YulLiteral", + "src": "3582:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3567:3:23", + "nodeType": "YulIdentifier", + "src": "3567:3:23" + }, + "nativeSrc": "3567:18:23", + "nodeType": "YulFunctionCall", + "src": "3567:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "3559:4:23", + "nodeType": "YulIdentifier", + "src": "3559:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_110461b12e459dc76e692e7a47f9621cf45c7d48020c3c7b2066107cdf1f52ae__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "3254:337:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "3405:9:23", + "nodeType": "YulTypedName", + "src": "3405:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "3419:4:23", + "nodeType": "YulTypedName", + "src": "3419:4:23", + "type": "" + } + ], + "src": "3254:337:23" + }, + { + "body": { + "nativeSrc": "3770:163:23", + "nodeType": "YulBlock", + "src": "3770:163:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3787:9:23", + "nodeType": "YulIdentifier", + "src": "3787:9:23" + }, + { + "kind": "number", + "nativeSrc": "3798:2:23", + "nodeType": "YulLiteral", + "src": "3798:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3780:6:23", + "nodeType": "YulIdentifier", + "src": "3780:6:23" + }, + "nativeSrc": "3780:21:23", + "nodeType": "YulFunctionCall", + "src": "3780:21:23" + }, + "nativeSrc": "3780:21:23", + "nodeType": "YulExpressionStatement", + "src": "3780:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3821:9:23", + "nodeType": "YulIdentifier", + "src": "3821:9:23" + }, + { + "kind": "number", + "nativeSrc": "3832:2:23", + "nodeType": "YulLiteral", + "src": "3832:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3817:3:23", + "nodeType": "YulIdentifier", + "src": "3817:3:23" + }, + "nativeSrc": "3817:18:23", + "nodeType": "YulFunctionCall", + "src": "3817:18:23" + }, + { + "kind": "number", + "nativeSrc": "3837:2:23", + "nodeType": "YulLiteral", + "src": "3837:2:23", + "type": "", + "value": "13" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3810:6:23", + "nodeType": "YulIdentifier", + "src": "3810:6:23" + }, + "nativeSrc": "3810:30:23", + "nodeType": "YulFunctionCall", + "src": "3810:30:23" + }, + "nativeSrc": "3810:30:23", + "nodeType": "YulExpressionStatement", + "src": "3810:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3860:9:23", + "nodeType": "YulIdentifier", + "src": "3860:9:23" + }, + { + "kind": "number", + "nativeSrc": "3871:2:23", + "nodeType": "YulLiteral", + "src": "3871:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3856:3:23", + "nodeType": "YulIdentifier", + "src": "3856:3:23" + }, + "nativeSrc": "3856:18:23", + "nodeType": "YulFunctionCall", + "src": "3856:18:23" + }, + { + "hexValue": "496e76616c696420746f6b656e", + "kind": "string", + "nativeSrc": "3876:15:23", + "nodeType": "YulLiteral", + "src": "3876:15:23", + "type": "", + "value": "Invalid token" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "3849:6:23", + "nodeType": "YulIdentifier", + "src": "3849:6:23" + }, + "nativeSrc": "3849:43:23", + "nodeType": "YulFunctionCall", + "src": "3849:43:23" + }, + "nativeSrc": "3849:43:23", + "nodeType": "YulExpressionStatement", + "src": "3849:43:23" + }, + { + "nativeSrc": "3901:26:23", + "nodeType": "YulAssignment", + "src": "3901:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "3913:9:23", + "nodeType": "YulIdentifier", + "src": "3913:9:23" + }, + { + "kind": "number", + "nativeSrc": "3924:2:23", + "nodeType": "YulLiteral", + "src": "3924:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "3909:3:23", + "nodeType": "YulIdentifier", + "src": "3909:3:23" + }, + "nativeSrc": "3909:18:23", + "nodeType": "YulFunctionCall", + "src": "3909:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "3901:4:23", + "nodeType": "YulIdentifier", + "src": "3901:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_5e70ebd1d4072d337a7fabaa7bda70fa2633d6e3f89d5cb725a16b10d07e54c6__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "3596:337:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "3747:9:23", + "nodeType": "YulTypedName", + "src": "3747:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "3761:4:23", + "nodeType": "YulTypedName", + "src": "3761:4:23", + "type": "" + } + ], + "src": "3596:337:23" + }, + { + "body": { + "nativeSrc": "4112:160:23", + "nodeType": "YulBlock", + "src": "4112:160:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4129:9:23", + "nodeType": "YulIdentifier", + "src": "4129:9:23" + }, + { + "kind": "number", + "nativeSrc": "4140:2:23", + "nodeType": "YulLiteral", + "src": "4140:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4122:6:23", + "nodeType": "YulIdentifier", + "src": "4122:6:23" + }, + "nativeSrc": "4122:21:23", + "nodeType": "YulFunctionCall", + "src": "4122:21:23" + }, + "nativeSrc": "4122:21:23", + "nodeType": "YulExpressionStatement", + "src": "4122:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4163:9:23", + "nodeType": "YulIdentifier", + "src": "4163:9:23" + }, + { + "kind": "number", + "nativeSrc": "4174:2:23", + "nodeType": "YulLiteral", + "src": "4174:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4159:3:23", + "nodeType": "YulIdentifier", + "src": "4159:3:23" + }, + "nativeSrc": "4159:18:23", + "nodeType": "YulFunctionCall", + "src": "4159:18:23" + }, + { + "kind": "number", + "nativeSrc": "4179:2:23", + "nodeType": "YulLiteral", + "src": "4179:2:23", + "type": "", + "value": "10" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4152:6:23", + "nodeType": "YulIdentifier", + "src": "4152:6:23" + }, + "nativeSrc": "4152:30:23", + "nodeType": "YulFunctionCall", + "src": "4152:30:23" + }, + "nativeSrc": "4152:30:23", + "nodeType": "YulExpressionStatement", + "src": "4152:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4202:9:23", + "nodeType": "YulIdentifier", + "src": "4202:9:23" + }, + { + "kind": "number", + "nativeSrc": "4213:2:23", + "nodeType": "YulLiteral", + "src": "4213:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4198:3:23", + "nodeType": "YulIdentifier", + "src": "4198:3:23" + }, + "nativeSrc": "4198:18:23", + "nodeType": "YulFunctionCall", + "src": "4198:18:23" + }, + { + "hexValue": "4e6f6e63652075736564", + "kind": "string", + "nativeSrc": "4218:12:23", + "nodeType": "YulLiteral", + "src": "4218:12:23", + "type": "", + "value": "Nonce used" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4191:6:23", + "nodeType": "YulIdentifier", + "src": "4191:6:23" + }, + "nativeSrc": "4191:40:23", + "nodeType": "YulFunctionCall", + "src": "4191:40:23" + }, + "nativeSrc": "4191:40:23", + "nodeType": "YulExpressionStatement", + "src": "4191:40:23" + }, + { + "nativeSrc": "4240:26:23", + "nodeType": "YulAssignment", + "src": "4240:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4252:9:23", + "nodeType": "YulIdentifier", + "src": "4252:9:23" + }, + { + "kind": "number", + "nativeSrc": "4263:2:23", + "nodeType": "YulLiteral", + "src": "4263:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4248:3:23", + "nodeType": "YulIdentifier", + "src": "4248:3:23" + }, + "nativeSrc": "4248:18:23", + "nodeType": "YulFunctionCall", + "src": "4248:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "4240:4:23", + "nodeType": "YulIdentifier", + "src": "4240:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_15d72127d094a30af360ead73641c61eda3d745ce4d04d12675a5e9a899f8b21__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "3938:334:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "4089:9:23", + "nodeType": "YulTypedName", + "src": "4089:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "4103:4:23", + "nodeType": "YulTypedName", + "src": "4103:4:23", + "type": "" + } + ], + "src": "3938:334:23" + }, + { + "body": { + "nativeSrc": "4451:165:23", + "nodeType": "YulBlock", + "src": "4451:165:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4468:9:23", + "nodeType": "YulIdentifier", + "src": "4468:9:23" + }, + { + "kind": "number", + "nativeSrc": "4479:2:23", + "nodeType": "YulLiteral", + "src": "4479:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4461:6:23", + "nodeType": "YulIdentifier", + "src": "4461:6:23" + }, + "nativeSrc": "4461:21:23", + "nodeType": "YulFunctionCall", + "src": "4461:21:23" + }, + "nativeSrc": "4461:21:23", + "nodeType": "YulExpressionStatement", + "src": "4461:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4502:9:23", + "nodeType": "YulIdentifier", + "src": "4502:9:23" + }, + { + "kind": "number", + "nativeSrc": "4513:2:23", + "nodeType": "YulLiteral", + "src": "4513:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4498:3:23", + "nodeType": "YulIdentifier", + "src": "4498:3:23" + }, + "nativeSrc": "4498:18:23", + "nodeType": "YulFunctionCall", + "src": "4498:18:23" + }, + { + "kind": "number", + "nativeSrc": "4518:2:23", + "nodeType": "YulLiteral", + "src": "4518:2:23", + "type": "", + "value": "15" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4491:6:23", + "nodeType": "YulIdentifier", + "src": "4491:6:23" + }, + "nativeSrc": "4491:30:23", + "nodeType": "YulFunctionCall", + "src": "4491:30:23" + }, + "nativeSrc": "4491:30:23", + "nodeType": "YulExpressionStatement", + "src": "4491:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4541:9:23", + "nodeType": "YulIdentifier", + "src": "4541:9:23" + }, + { + "kind": "number", + "nativeSrc": "4552:2:23", + "nodeType": "YulLiteral", + "src": "4552:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4537:3:23", + "nodeType": "YulIdentifier", + "src": "4537:3:23" + }, + "nativeSrc": "4537:18:23", + "nodeType": "YulFunctionCall", + "src": "4537:18:23" + }, + { + "hexValue": "5061796c6f61642065787069726564", + "kind": "string", + "nativeSrc": "4557:17:23", + "nodeType": "YulLiteral", + "src": "4557:17:23", + "type": "", + "value": "Payload expired" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "4530:6:23", + "nodeType": "YulIdentifier", + "src": "4530:6:23" + }, + "nativeSrc": "4530:45:23", + "nodeType": "YulFunctionCall", + "src": "4530:45:23" + }, + "nativeSrc": "4530:45:23", + "nodeType": "YulExpressionStatement", + "src": "4530:45:23" + }, + { + "nativeSrc": "4584:26:23", + "nodeType": "YulAssignment", + "src": "4584:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "4596:9:23", + "nodeType": "YulIdentifier", + "src": "4596:9:23" + }, + { + "kind": "number", + "nativeSrc": "4607:2:23", + "nodeType": "YulLiteral", + "src": "4607:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4592:3:23", + "nodeType": "YulIdentifier", + "src": "4592:3:23" + }, + "nativeSrc": "4592:18:23", + "nodeType": "YulFunctionCall", + "src": "4592:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "4584:4:23", + "nodeType": "YulIdentifier", + "src": "4584:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_27859e47e6c2167c8e8d38addfca16b9afb9d8e9750b6a1e67c29196d4d99fae__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "4277:339:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "4428:9:23", + "nodeType": "YulTypedName", + "src": "4428:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "4442:4:23", + "nodeType": "YulTypedName", + "src": "4442:4:23", + "type": "" + } + ], + "src": "4277:339:23" + }, + { + "body": { + "nativeSrc": "4715:427:23", + "nodeType": "YulBlock", + "src": "4715:427:23", + "statements": [ + { + "nativeSrc": "4725:51:23", + "nodeType": "YulVariableDeclaration", + "src": "4725:51:23", + "value": { + "arguments": [ + { + "name": "ptr_to_tail", + "nativeSrc": "4764:11:23", + "nodeType": "YulIdentifier", + "src": "4764:11:23" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "4751:12:23", + "nodeType": "YulIdentifier", + "src": "4751:12:23" + }, + "nativeSrc": "4751:25:23", + "nodeType": "YulFunctionCall", + "src": "4751:25:23" + }, + "variables": [ + { + "name": "rel_offset_of_tail", + "nativeSrc": "4729:18:23", + "nodeType": "YulTypedName", + "src": "4729:18:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "4865:16:23", + "nodeType": "YulBlock", + "src": "4865:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "4874:1:23", + "nodeType": "YulLiteral", + "src": "4874:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "4877:1:23", + "nodeType": "YulLiteral", + "src": "4877:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "4867:6:23", + "nodeType": "YulIdentifier", + "src": "4867:6:23" + }, + "nativeSrc": "4867:12:23", + "nodeType": "YulFunctionCall", + "src": "4867:12:23" + }, + "nativeSrc": "4867:12:23", + "nodeType": "YulExpressionStatement", + "src": "4867:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "rel_offset_of_tail", + "nativeSrc": "4799:18:23", + "nodeType": "YulIdentifier", + "src": "4799:18:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "calldatasize", + "nativeSrc": "4827:12:23", + "nodeType": "YulIdentifier", + "src": "4827:12:23" + }, + "nativeSrc": "4827:14:23", + "nodeType": "YulFunctionCall", + "src": "4827:14:23" + }, + { + "name": "base_ref", + "nativeSrc": "4843:8:23", + "nodeType": "YulIdentifier", + "src": "4843:8:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "4823:3:23", + "nodeType": "YulIdentifier", + "src": "4823:3:23" + }, + "nativeSrc": "4823:29:23", + "nodeType": "YulFunctionCall", + "src": "4823:29:23" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "4858:2:23", + "nodeType": "YulLiteral", + "src": "4858:2:23", + "type": "", + "value": "30" + } + ], + "functionName": { + "name": "not", + "nativeSrc": "4854:3:23", + "nodeType": "YulIdentifier", + "src": "4854:3:23" + }, + "nativeSrc": "4854:7:23", + "nodeType": "YulFunctionCall", + "src": "4854:7:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4819:3:23", + "nodeType": "YulIdentifier", + "src": "4819:3:23" + }, + "nativeSrc": "4819:43:23", + "nodeType": "YulFunctionCall", + "src": "4819:43:23" + } + ], + "functionName": { + "name": "slt", + "nativeSrc": "4795:3:23", + "nodeType": "YulIdentifier", + "src": "4795:3:23" + }, + "nativeSrc": "4795:68:23", + "nodeType": "YulFunctionCall", + "src": "4795:68:23" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "4788:6:23", + "nodeType": "YulIdentifier", + "src": "4788:6:23" + }, + "nativeSrc": "4788:76:23", + "nodeType": "YulFunctionCall", + "src": "4788:76:23" + }, + "nativeSrc": "4785:96:23", + "nodeType": "YulIf", + "src": "4785:96:23" + }, + { + "nativeSrc": "4890:47:23", + "nodeType": "YulVariableDeclaration", + "src": "4890:47:23", + "value": { + "arguments": [ + { + "name": "base_ref", + "nativeSrc": "4908:8:23", + "nodeType": "YulIdentifier", + "src": "4908:8:23" + }, + { + "name": "rel_offset_of_tail", + "nativeSrc": "4918:18:23", + "nodeType": "YulIdentifier", + "src": "4918:18:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "4904:3:23", + "nodeType": "YulIdentifier", + "src": "4904:3:23" + }, + "nativeSrc": "4904:33:23", + "nodeType": "YulFunctionCall", + "src": "4904:33:23" + }, + "variables": [ + { + "name": "addr_1", + "nativeSrc": "4894:6:23", + "nodeType": "YulTypedName", + "src": "4894:6:23", + "type": "" + } + ] + }, + { + "nativeSrc": "4946:30:23", + "nodeType": "YulAssignment", + "src": "4946:30:23", + "value": { + "arguments": [ + { + "name": "addr_1", + "nativeSrc": "4969:6:23", + "nodeType": "YulIdentifier", + "src": "4969:6:23" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "4956:12:23", + "nodeType": "YulIdentifier", + "src": "4956:12:23" + }, + "nativeSrc": "4956:20:23", + "nodeType": "YulFunctionCall", + "src": "4956:20:23" + }, + "variableNames": [ + { + "name": "length", + "nativeSrc": "4946:6:23", + "nodeType": "YulIdentifier", + "src": "4946:6:23" + } + ] + }, + { + "body": { + "nativeSrc": "5019:16:23", + "nodeType": "YulBlock", + "src": "5019:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "5028:1:23", + "nodeType": "YulLiteral", + "src": "5028:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "5031:1:23", + "nodeType": "YulLiteral", + "src": "5031:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "5021:6:23", + "nodeType": "YulIdentifier", + "src": "5021:6:23" + }, + "nativeSrc": "5021:12:23", + "nodeType": "YulFunctionCall", + "src": "5021:12:23" + }, + "nativeSrc": "5021:12:23", + "nodeType": "YulExpressionStatement", + "src": "5021:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "length", + "nativeSrc": "4991:6:23", + "nodeType": "YulIdentifier", + "src": "4991:6:23" + }, + { + "kind": "number", + "nativeSrc": "4999:18:23", + "nodeType": "YulLiteral", + "src": "4999:18:23", + "type": "", + "value": "0xffffffffffffffff" + } + ], + "functionName": { + "name": "gt", + "nativeSrc": "4988:2:23", + "nodeType": "YulIdentifier", + "src": "4988:2:23" + }, + "nativeSrc": "4988:30:23", + "nodeType": "YulFunctionCall", + "src": "4988:30:23" + }, + "nativeSrc": "4985:50:23", + "nodeType": "YulIf", + "src": "4985:50:23" + }, + { + "nativeSrc": "5044:25:23", + "nodeType": "YulAssignment", + "src": "5044:25:23", + "value": { + "arguments": [ + { + "name": "addr_1", + "nativeSrc": "5056:6:23", + "nodeType": "YulIdentifier", + "src": "5056:6:23" + }, + { + "kind": "number", + "nativeSrc": "5064:4:23", + "nodeType": "YulLiteral", + "src": "5064:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "5052:3:23", + "nodeType": "YulIdentifier", + "src": "5052:3:23" + }, + "nativeSrc": "5052:17:23", + "nodeType": "YulFunctionCall", + "src": "5052:17:23" + }, + "variableNames": [ + { + "name": "addr", + "nativeSrc": "5044:4:23", + "nodeType": "YulIdentifier", + "src": "5044:4:23" + } + ] + }, + { + "body": { + "nativeSrc": "5120:16:23", + "nodeType": "YulBlock", + "src": "5120:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "5129:1:23", + "nodeType": "YulLiteral", + "src": "5129:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "5132:1:23", + "nodeType": "YulLiteral", + "src": "5132:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "5122:6:23", + "nodeType": "YulIdentifier", + "src": "5122:6:23" + }, + "nativeSrc": "5122:12:23", + "nodeType": "YulFunctionCall", + "src": "5122:12:23" + }, + "nativeSrc": "5122:12:23", + "nodeType": "YulExpressionStatement", + "src": "5122:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "addr", + "nativeSrc": "5085:4:23", + "nodeType": "YulIdentifier", + "src": "5085:4:23" + }, + { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "calldatasize", + "nativeSrc": "5095:12:23", + "nodeType": "YulIdentifier", + "src": "5095:12:23" + }, + "nativeSrc": "5095:14:23", + "nodeType": "YulFunctionCall", + "src": "5095:14:23" + }, + { + "name": "length", + "nativeSrc": "5111:6:23", + "nodeType": "YulIdentifier", + "src": "5111:6:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "5091:3:23", + "nodeType": "YulIdentifier", + "src": "5091:3:23" + }, + "nativeSrc": "5091:27:23", + "nodeType": "YulFunctionCall", + "src": "5091:27:23" + } + ], + "functionName": { + "name": "sgt", + "nativeSrc": "5081:3:23", + "nodeType": "YulIdentifier", + "src": "5081:3:23" + }, + "nativeSrc": "5081:38:23", + "nodeType": "YulFunctionCall", + "src": "5081:38:23" + }, + "nativeSrc": "5078:58:23", + "nodeType": "YulIf", + "src": "5078:58:23" + } + ] + }, + "name": "access_calldata_tail_t_bytes_calldata_ptr", + "nativeSrc": "4621:521:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "base_ref", + "nativeSrc": "4672:8:23", + "nodeType": "YulTypedName", + "src": "4672:8:23", + "type": "" + }, + { + "name": "ptr_to_tail", + "nativeSrc": "4682:11:23", + "nodeType": "YulTypedName", + "src": "4682:11:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "addr", + "nativeSrc": "4698:4:23", + "nodeType": "YulTypedName", + "src": "4698:4:23", + "type": "" + }, + { + "name": "length", + "nativeSrc": "4704:6:23", + "nodeType": "YulTypedName", + "src": "4704:6:23", + "type": "" + } + ], + "src": "4621:521:23" + }, + { + "body": { + "nativeSrc": "5215:201:23", + "nodeType": "YulBlock", + "src": "5215:201:23", + "statements": [ + { + "body": { + "nativeSrc": "5261:16:23", + "nodeType": "YulBlock", + "src": "5261:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "5270:1:23", + "nodeType": "YulLiteral", + "src": "5270:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "5273:1:23", + "nodeType": "YulLiteral", + "src": "5273:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "5263:6:23", + "nodeType": "YulIdentifier", + "src": "5263:6:23" + }, + "nativeSrc": "5263:12:23", + "nodeType": "YulFunctionCall", + "src": "5263:12:23" + }, + "nativeSrc": "5263:12:23", + "nodeType": "YulExpressionStatement", + "src": "5263:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nativeSrc": "5236:7:23", + "nodeType": "YulIdentifier", + "src": "5236:7:23" + }, + { + "name": "headStart", + "nativeSrc": "5245:9:23", + "nodeType": "YulIdentifier", + "src": "5245:9:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "5232:3:23", + "nodeType": "YulIdentifier", + "src": "5232:3:23" + }, + "nativeSrc": "5232:23:23", + "nodeType": "YulFunctionCall", + "src": "5232:23:23" + }, + { + "kind": "number", + "nativeSrc": "5257:2:23", + "nodeType": "YulLiteral", + "src": "5257:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nativeSrc": "5228:3:23", + "nodeType": "YulIdentifier", + "src": "5228:3:23" + }, + "nativeSrc": "5228:32:23", + "nodeType": "YulFunctionCall", + "src": "5228:32:23" + }, + "nativeSrc": "5225:52:23", + "nodeType": "YulIf", + "src": "5225:52:23" + }, + { + "nativeSrc": "5286:36:23", + "nodeType": "YulVariableDeclaration", + "src": "5286:36:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "5312:9:23", + "nodeType": "YulIdentifier", + "src": "5312:9:23" + } + ], + "functionName": { + "name": "calldataload", + "nativeSrc": "5299:12:23", + "nodeType": "YulIdentifier", + "src": "5299:12:23" + }, + "nativeSrc": "5299:23:23", + "nodeType": "YulFunctionCall", + "src": "5299:23:23" + }, + "variables": [ + { + "name": "value", + "nativeSrc": "5290:5:23", + "nodeType": "YulTypedName", + "src": "5290:5:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "5370:16:23", + "nodeType": "YulBlock", + "src": "5370:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "5379:1:23", + "nodeType": "YulLiteral", + "src": "5379:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "5382:1:23", + "nodeType": "YulLiteral", + "src": "5382:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "5372:6:23", + "nodeType": "YulIdentifier", + "src": "5372:6:23" + }, + "nativeSrc": "5372:12:23", + "nodeType": "YulFunctionCall", + "src": "5372:12:23" + }, + "nativeSrc": "5372:12:23", + "nodeType": "YulExpressionStatement", + "src": "5372:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nativeSrc": "5344:5:23", + "nodeType": "YulIdentifier", + "src": "5344:5:23" + }, + { + "arguments": [ + { + "name": "value", + "nativeSrc": "5355:5:23", + "nodeType": "YulIdentifier", + "src": "5355:5:23" + }, + { + "kind": "number", + "nativeSrc": "5362:4:23", + "nodeType": "YulLiteral", + "src": "5362:4:23", + "type": "", + "value": "0xff" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "5351:3:23", + "nodeType": "YulIdentifier", + "src": "5351:3:23" + }, + "nativeSrc": "5351:16:23", + "nodeType": "YulFunctionCall", + "src": "5351:16:23" + } + ], + "functionName": { + "name": "eq", + "nativeSrc": "5341:2:23", + "nodeType": "YulIdentifier", + "src": "5341:2:23" + }, + "nativeSrc": "5341:27:23", + "nodeType": "YulFunctionCall", + "src": "5341:27:23" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "5334:6:23", + "nodeType": "YulIdentifier", + "src": "5334:6:23" + }, + "nativeSrc": "5334:35:23", + "nodeType": "YulFunctionCall", + "src": "5334:35:23" + }, + "nativeSrc": "5331:55:23", + "nodeType": "YulIf", + "src": "5331:55:23" + }, + { + "nativeSrc": "5395:15:23", + "nodeType": "YulAssignment", + "src": "5395:15:23", + "value": { + "name": "value", + "nativeSrc": "5405:5:23", + "nodeType": "YulIdentifier", + "src": "5405:5:23" + }, + "variableNames": [ + { + "name": "value0", + "nativeSrc": "5395:6:23", + "nodeType": "YulIdentifier", + "src": "5395:6:23" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_uint8", + "nativeSrc": "5147:269:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "5181:9:23", + "nodeType": "YulTypedName", + "src": "5181:9:23", + "type": "" + }, + { + "name": "dataEnd", + "nativeSrc": "5192:7:23", + "nodeType": "YulTypedName", + "src": "5192:7:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nativeSrc": "5204:6:23", + "nodeType": "YulTypedName", + "src": "5204:6:23", + "type": "" + } + ], + "src": "5147:269:23" + }, + { + "body": { + "nativeSrc": "5595:161:23", + "nodeType": "YulBlock", + "src": "5595:161:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "5612:9:23", + "nodeType": "YulIdentifier", + "src": "5612:9:23" + }, + { + "kind": "number", + "nativeSrc": "5623:2:23", + "nodeType": "YulLiteral", + "src": "5623:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "5605:6:23", + "nodeType": "YulIdentifier", + "src": "5605:6:23" + }, + "nativeSrc": "5605:21:23", + "nodeType": "YulFunctionCall", + "src": "5605:21:23" + }, + "nativeSrc": "5605:21:23", + "nodeType": "YulExpressionStatement", + "src": "5605:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "5646:9:23", + "nodeType": "YulIdentifier", + "src": "5646:9:23" + }, + { + "kind": "number", + "nativeSrc": "5657:2:23", + "nodeType": "YulLiteral", + "src": "5657:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "5642:3:23", + "nodeType": "YulIdentifier", + "src": "5642:3:23" + }, + "nativeSrc": "5642:18:23", + "nodeType": "YulFunctionCall", + "src": "5642:18:23" + }, + { + "kind": "number", + "nativeSrc": "5662:2:23", + "nodeType": "YulLiteral", + "src": "5662:2:23", + "type": "", + "value": "11" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "5635:6:23", + "nodeType": "YulIdentifier", + "src": "5635:6:23" + }, + "nativeSrc": "5635:30:23", + "nodeType": "YulFunctionCall", + "src": "5635:30:23" + }, + "nativeSrc": "5635:30:23", + "nodeType": "YulExpressionStatement", + "src": "5635:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "5685:9:23", + "nodeType": "YulIdentifier", + "src": "5685:9:23" + }, + { + "kind": "number", + "nativeSrc": "5696:2:23", + "nodeType": "YulLiteral", + "src": "5696:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "5681:3:23", + "nodeType": "YulIdentifier", + "src": "5681:3:23" + }, + "nativeSrc": "5681:18:23", + "nodeType": "YulFunctionCall", + "src": "5681:18:23" + }, + { + "hexValue": "496e76616c696420736967", + "kind": "string", + "nativeSrc": "5701:13:23", + "nodeType": "YulLiteral", + "src": "5701:13:23", + "type": "", + "value": "Invalid sig" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "5674:6:23", + "nodeType": "YulIdentifier", + "src": "5674:6:23" + }, + "nativeSrc": "5674:41:23", + "nodeType": "YulFunctionCall", + "src": "5674:41:23" + }, + "nativeSrc": "5674:41:23", + "nodeType": "YulExpressionStatement", + "src": "5674:41:23" + }, + { + "nativeSrc": "5724:26:23", + "nodeType": "YulAssignment", + "src": "5724:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "5736:9:23", + "nodeType": "YulIdentifier", + "src": "5736:9:23" + }, + { + "kind": "number", + "nativeSrc": "5747:2:23", + "nodeType": "YulLiteral", + "src": "5747:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "5732:3:23", + "nodeType": "YulIdentifier", + "src": "5732:3:23" + }, + "nativeSrc": "5732:18:23", + "nodeType": "YulFunctionCall", + "src": "5732:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "5724:4:23", + "nodeType": "YulIdentifier", + "src": "5724:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_31734eed34fab74fa1579246aaad104a344891a284044483c0c5a792a9f83a72__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "5421:335:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "5572:9:23", + "nodeType": "YulTypedName", + "src": "5572:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "5586:4:23", + "nodeType": "YulTypedName", + "src": "5586:4:23", + "type": "" + } + ], + "src": "5421:335:23" + }, + { + "body": { + "nativeSrc": "5935:178:23", + "nodeType": "YulBlock", + "src": "5935:178:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "5952:9:23", + "nodeType": "YulIdentifier", + "src": "5952:9:23" + }, + { + "kind": "number", + "nativeSrc": "5963:2:23", + "nodeType": "YulLiteral", + "src": "5963:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "5945:6:23", + "nodeType": "YulIdentifier", + "src": "5945:6:23" + }, + "nativeSrc": "5945:21:23", + "nodeType": "YulFunctionCall", + "src": "5945:21:23" + }, + "nativeSrc": "5945:21:23", + "nodeType": "YulExpressionStatement", + "src": "5945:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "5986:9:23", + "nodeType": "YulIdentifier", + "src": "5986:9:23" + }, + { + "kind": "number", + "nativeSrc": "5997:2:23", + "nodeType": "YulLiteral", + "src": "5997:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "5982:3:23", + "nodeType": "YulIdentifier", + "src": "5982:3:23" + }, + "nativeSrc": "5982:18:23", + "nodeType": "YulFunctionCall", + "src": "5982:18:23" + }, + { + "kind": "number", + "nativeSrc": "6002:2:23", + "nodeType": "YulLiteral", + "src": "6002:2:23", + "type": "", + "value": "28" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "5975:6:23", + "nodeType": "YulIdentifier", + "src": "5975:6:23" + }, + "nativeSrc": "5975:30:23", + "nodeType": "YulFunctionCall", + "src": "5975:30:23" + }, + "nativeSrc": "5975:30:23", + "nodeType": "YulExpressionStatement", + "src": "5975:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "6025:9:23", + "nodeType": "YulIdentifier", + "src": "6025:9:23" + }, + { + "kind": "number", + "nativeSrc": "6036:2:23", + "nodeType": "YulLiteral", + "src": "6036:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6021:3:23", + "nodeType": "YulIdentifier", + "src": "6021:3:23" + }, + "nativeSrc": "6021:18:23", + "nodeType": "YulFunctionCall", + "src": "6021:18:23" + }, + { + "hexValue": "496e636f7272656374204554482076616c75652070726f7669646564", + "kind": "string", + "nativeSrc": "6041:30:23", + "nodeType": "YulLiteral", + "src": "6041:30:23", + "type": "", + "value": "Incorrect ETH value provided" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6014:6:23", + "nodeType": "YulIdentifier", + "src": "6014:6:23" + }, + "nativeSrc": "6014:58:23", + "nodeType": "YulFunctionCall", + "src": "6014:58:23" + }, + "nativeSrc": "6014:58:23", + "nodeType": "YulExpressionStatement", + "src": "6014:58:23" + }, + { + "nativeSrc": "6081:26:23", + "nodeType": "YulAssignment", + "src": "6081:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "6093:9:23", + "nodeType": "YulIdentifier", + "src": "6093:9:23" + }, + { + "kind": "number", + "nativeSrc": "6104:2:23", + "nodeType": "YulLiteral", + "src": "6104:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6089:3:23", + "nodeType": "YulIdentifier", + "src": "6089:3:23" + }, + "nativeSrc": "6089:18:23", + "nodeType": "YulFunctionCall", + "src": "6089:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "6081:4:23", + "nodeType": "YulIdentifier", + "src": "6081:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_a793dc5bde52ab2d5349f1208a34905b1d68ab9298f549a2e514542cba0a8c76__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "5761:352:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "5912:9:23", + "nodeType": "YulTypedName", + "src": "5912:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "5926:4:23", + "nodeType": "YulTypedName", + "src": "5926:4:23", + "type": "" + } + ], + "src": "5761:352:23" + }, + { + "body": { + "nativeSrc": "6292:161:23", + "nodeType": "YulBlock", + "src": "6292:161:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "6309:9:23", + "nodeType": "YulIdentifier", + "src": "6309:9:23" + }, + { + "kind": "number", + "nativeSrc": "6320:2:23", + "nodeType": "YulLiteral", + "src": "6320:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6302:6:23", + "nodeType": "YulIdentifier", + "src": "6302:6:23" + }, + "nativeSrc": "6302:21:23", + "nodeType": "YulFunctionCall", + "src": "6302:21:23" + }, + "nativeSrc": "6302:21:23", + "nodeType": "YulExpressionStatement", + "src": "6302:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "6343:9:23", + "nodeType": "YulIdentifier", + "src": "6343:9:23" + }, + { + "kind": "number", + "nativeSrc": "6354:2:23", + "nodeType": "YulLiteral", + "src": "6354:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6339:3:23", + "nodeType": "YulIdentifier", + "src": "6339:3:23" + }, + "nativeSrc": "6339:18:23", + "nodeType": "YulFunctionCall", + "src": "6339:18:23" + }, + { + "kind": "number", + "nativeSrc": "6359:2:23", + "nodeType": "YulLiteral", + "src": "6359:2:23", + "type": "", + "value": "11" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6332:6:23", + "nodeType": "YulIdentifier", + "src": "6332:6:23" + }, + "nativeSrc": "6332:30:23", + "nodeType": "YulFunctionCall", + "src": "6332:30:23" + }, + "nativeSrc": "6332:30:23", + "nodeType": "YulExpressionStatement", + "src": "6332:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "6382:9:23", + "nodeType": "YulIdentifier", + "src": "6382:9:23" + }, + { + "kind": "number", + "nativeSrc": "6393:2:23", + "nodeType": "YulLiteral", + "src": "6393:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6378:3:23", + "nodeType": "YulIdentifier", + "src": "6378:3:23" + }, + "nativeSrc": "6378:18:23", + "nodeType": "YulFunctionCall", + "src": "6378:18:23" + }, + { + "hexValue": "43616c6c206661696c6564", + "kind": "string", + "nativeSrc": "6398:13:23", + "nodeType": "YulLiteral", + "src": "6398:13:23", + "type": "", + "value": "Call failed" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6371:6:23", + "nodeType": "YulIdentifier", + "src": "6371:6:23" + }, + "nativeSrc": "6371:41:23", + "nodeType": "YulFunctionCall", + "src": "6371:41:23" + }, + "nativeSrc": "6371:41:23", + "nodeType": "YulExpressionStatement", + "src": "6371:41:23" + }, + { + "nativeSrc": "6421:26:23", + "nodeType": "YulAssignment", + "src": "6421:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "6433:9:23", + "nodeType": "YulIdentifier", + "src": "6433:9:23" + }, + { + "kind": "number", + "nativeSrc": "6444:2:23", + "nodeType": "YulLiteral", + "src": "6444:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6429:3:23", + "nodeType": "YulIdentifier", + "src": "6429:3:23" + }, + "nativeSrc": "6429:18:23", + "nodeType": "YulFunctionCall", + "src": "6429:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "6421:4:23", + "nodeType": "YulIdentifier", + "src": "6421:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_066ad49a0ed9e5d6a9f3c20fca13a038f0a5d629f0aaf09d634ae2a7c232ac2b__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "6118:335:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "6269:9:23", + "nodeType": "YulTypedName", + "src": "6269:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "6283:4:23", + "nodeType": "YulTypedName", + "src": "6283:4:23", + "type": "" + } + ], + "src": "6118:335:23" + }, + { + "body": { + "nativeSrc": "6559:76:23", + "nodeType": "YulBlock", + "src": "6559:76:23", + "statements": [ + { + "nativeSrc": "6569:26:23", + "nodeType": "YulAssignment", + "src": "6569:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "6581:9:23", + "nodeType": "YulIdentifier", + "src": "6581:9:23" + }, + { + "kind": "number", + "nativeSrc": "6592:2:23", + "nodeType": "YulLiteral", + "src": "6592:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "6577:3:23", + "nodeType": "YulIdentifier", + "src": "6577:3:23" + }, + "nativeSrc": "6577:18:23", + "nodeType": "YulFunctionCall", + "src": "6577:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "6569:4:23", + "nodeType": "YulIdentifier", + "src": "6569:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "6611:9:23", + "nodeType": "YulIdentifier", + "src": "6611:9:23" + }, + { + "name": "value0", + "nativeSrc": "6622:6:23", + "nodeType": "YulIdentifier", + "src": "6622:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6604:6:23", + "nodeType": "YulIdentifier", + "src": "6604:6:23" + }, + "nativeSrc": "6604:25:23", + "nodeType": "YulFunctionCall", + "src": "6604:25:23" + }, + "nativeSrc": "6604:25:23", + "nodeType": "YulExpressionStatement", + "src": "6604:25:23" + } + ] + }, + "name": "abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed", + "nativeSrc": "6458:177:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "6528:9:23", + "nodeType": "YulTypedName", + "src": "6528:9:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "6539:6:23", + "nodeType": "YulTypedName", + "src": "6539:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "6550:4:23", + "nodeType": "YulTypedName", + "src": "6550:4:23", + "type": "" + } + ], + "src": "6458:177:23" + }, + { + "body": { + "nativeSrc": "6672:95:23", + "nodeType": "YulBlock", + "src": "6672:95:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "6689:1:23", + "nodeType": "YulLiteral", + "src": "6689:1:23", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "6696:3:23", + "nodeType": "YulLiteral", + "src": "6696:3:23", + "type": "", + "value": "224" + }, + { + "kind": "number", + "nativeSrc": "6701:10:23", + "nodeType": "YulLiteral", + "src": "6701:10:23", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "6692:3:23", + "nodeType": "YulIdentifier", + "src": "6692:3:23" + }, + "nativeSrc": "6692:20:23", + "nodeType": "YulFunctionCall", + "src": "6692:20:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6682:6:23", + "nodeType": "YulIdentifier", + "src": "6682:6:23" + }, + "nativeSrc": "6682:31:23", + "nodeType": "YulFunctionCall", + "src": "6682:31:23" + }, + "nativeSrc": "6682:31:23", + "nodeType": "YulExpressionStatement", + "src": "6682:31:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "6729:1:23", + "nodeType": "YulLiteral", + "src": "6729:1:23", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nativeSrc": "6732:4:23", + "nodeType": "YulLiteral", + "src": "6732:4:23", + "type": "", + "value": "0x41" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "6722:6:23", + "nodeType": "YulIdentifier", + "src": "6722:6:23" + }, + "nativeSrc": "6722:15:23", + "nodeType": "YulFunctionCall", + "src": "6722:15:23" + }, + "nativeSrc": "6722:15:23", + "nodeType": "YulExpressionStatement", + "src": "6722:15:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "6753:1:23", + "nodeType": "YulLiteral", + "src": "6753:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "6756:4:23", + "nodeType": "YulLiteral", + "src": "6756:4:23", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "6746:6:23", + "nodeType": "YulIdentifier", + "src": "6746:6:23" + }, + "nativeSrc": "6746:15:23", + "nodeType": "YulFunctionCall", + "src": "6746:15:23" + }, + "nativeSrc": "6746:15:23", + "nodeType": "YulExpressionStatement", + "src": "6746:15:23" + } + ] + }, + "name": "panic_error_0x41", + "nativeSrc": "6640:127:23", + "nodeType": "YulFunctionDefinition", + "src": "6640:127:23" + }, + { + "body": { + "nativeSrc": "6963:14:23", + "nodeType": "YulBlock", + "src": "6963:14:23", + "statements": [ + { + "nativeSrc": "6965:10:23", + "nodeType": "YulAssignment", + "src": "6965:10:23", + "value": { + "name": "pos", + "nativeSrc": "6972:3:23", + "nodeType": "YulIdentifier", + "src": "6972:3:23" + }, + "variableNames": [ + { + "name": "end", + "nativeSrc": "6965:3:23", + "nodeType": "YulIdentifier", + "src": "6965:3:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_packed_t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470__to_t_bytes_memory_ptr__nonPadded_inplace_fromStack_reversed", + "nativeSrc": "6772:205:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "pos", + "nativeSrc": "6947:3:23", + "nodeType": "YulTypedName", + "src": "6947:3:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nativeSrc": "6955:3:23", + "nodeType": "YulTypedName", + "src": "6955:3:23", + "type": "" + } + ], + "src": "6772:205:23" + }, + { + "body": { + "nativeSrc": "7156:169:23", + "nodeType": "YulBlock", + "src": "7156:169:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7173:9:23", + "nodeType": "YulIdentifier", + "src": "7173:9:23" + }, + { + "kind": "number", + "nativeSrc": "7184:2:23", + "nodeType": "YulLiteral", + "src": "7184:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7166:6:23", + "nodeType": "YulIdentifier", + "src": "7166:6:23" + }, + "nativeSrc": "7166:21:23", + "nodeType": "YulFunctionCall", + "src": "7166:21:23" + }, + "nativeSrc": "7166:21:23", + "nodeType": "YulExpressionStatement", + "src": "7166:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7207:9:23", + "nodeType": "YulIdentifier", + "src": "7207:9:23" + }, + { + "kind": "number", + "nativeSrc": "7218:2:23", + "nodeType": "YulLiteral", + "src": "7218:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7203:3:23", + "nodeType": "YulIdentifier", + "src": "7203:3:23" + }, + "nativeSrc": "7203:18:23", + "nodeType": "YulFunctionCall", + "src": "7203:18:23" + }, + { + "kind": "number", + "nativeSrc": "7223:2:23", + "nodeType": "YulLiteral", + "src": "7223:2:23", + "type": "", + "value": "19" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7196:6:23", + "nodeType": "YulIdentifier", + "src": "7196:6:23" + }, + "nativeSrc": "7196:30:23", + "nodeType": "YulFunctionCall", + "src": "7196:30:23" + }, + "nativeSrc": "7196:30:23", + "nodeType": "YulExpressionStatement", + "src": "7196:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7246:9:23", + "nodeType": "YulIdentifier", + "src": "7246:9:23" + }, + { + "kind": "number", + "nativeSrc": "7257:2:23", + "nodeType": "YulLiteral", + "src": "7257:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7242:3:23", + "nodeType": "YulIdentifier", + "src": "7242:3:23" + }, + "nativeSrc": "7242:18:23", + "nodeType": "YulFunctionCall", + "src": "7242:18:23" + }, + { + "hexValue": "455448207472616e73666572206661696c6564", + "kind": "string", + "nativeSrc": "7262:21:23", + "nodeType": "YulLiteral", + "src": "7262:21:23", + "type": "", + "value": "ETH transfer failed" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7235:6:23", + "nodeType": "YulIdentifier", + "src": "7235:6:23" + }, + "nativeSrc": "7235:49:23", + "nodeType": "YulFunctionCall", + "src": "7235:49:23" + }, + "nativeSrc": "7235:49:23", + "nodeType": "YulExpressionStatement", + "src": "7235:49:23" + }, + { + "nativeSrc": "7293:26:23", + "nodeType": "YulAssignment", + "src": "7293:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7305:9:23", + "nodeType": "YulIdentifier", + "src": "7305:9:23" + }, + { + "kind": "number", + "nativeSrc": "7316:2:23", + "nodeType": "YulLiteral", + "src": "7316:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7301:3:23", + "nodeType": "YulIdentifier", + "src": "7301:3:23" + }, + "nativeSrc": "7301:18:23", + "nodeType": "YulFunctionCall", + "src": "7301:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "7293:4:23", + "nodeType": "YulIdentifier", + "src": "7293:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_c7c2be2f1b63a3793f6e2d447ce95ba2239687186a7fd6b5268a969dcdb42dcd__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "6982:343:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "7133:9:23", + "nodeType": "YulTypedName", + "src": "7133:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "7147:4:23", + "nodeType": "YulTypedName", + "src": "7147:4:23", + "type": "" + } + ], + "src": "6982:343:23" + }, + { + "body": { + "nativeSrc": "7655:504:23", + "nodeType": "YulBlock", + "src": "7655:504:23", + "statements": [ + { + "nativeSrc": "7665:27:23", + "nodeType": "YulAssignment", + "src": "7665:27:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7677:9:23", + "nodeType": "YulIdentifier", + "src": "7677:9:23" + }, + { + "kind": "number", + "nativeSrc": "7688:3:23", + "nodeType": "YulLiteral", + "src": "7688:3:23", + "type": "", + "value": "288" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7673:3:23", + "nodeType": "YulIdentifier", + "src": "7673:3:23" + }, + "nativeSrc": "7673:19:23", + "nodeType": "YulFunctionCall", + "src": "7673:19:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "7665:4:23", + "nodeType": "YulIdentifier", + "src": "7665:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7708:9:23", + "nodeType": "YulIdentifier", + "src": "7708:9:23" + }, + { + "name": "value0", + "nativeSrc": "7719:6:23", + "nodeType": "YulIdentifier", + "src": "7719:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7701:6:23", + "nodeType": "YulIdentifier", + "src": "7701:6:23" + }, + "nativeSrc": "7701:25:23", + "nodeType": "YulFunctionCall", + "src": "7701:25:23" + }, + "nativeSrc": "7701:25:23", + "nodeType": "YulExpressionStatement", + "src": "7701:25:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7746:9:23", + "nodeType": "YulIdentifier", + "src": "7746:9:23" + }, + { + "kind": "number", + "nativeSrc": "7757:2:23", + "nodeType": "YulLiteral", + "src": "7757:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7742:3:23", + "nodeType": "YulIdentifier", + "src": "7742:3:23" + }, + "nativeSrc": "7742:18:23", + "nodeType": "YulFunctionCall", + "src": "7742:18:23" + }, + { + "arguments": [ + { + "name": "value1", + "nativeSrc": "7766:6:23", + "nodeType": "YulIdentifier", + "src": "7766:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "7782:3:23", + "nodeType": "YulLiteral", + "src": "7782:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "7787:1:23", + "nodeType": "YulLiteral", + "src": "7787:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "7778:3:23", + "nodeType": "YulIdentifier", + "src": "7778:3:23" + }, + "nativeSrc": "7778:11:23", + "nodeType": "YulFunctionCall", + "src": "7778:11:23" + }, + { + "kind": "number", + "nativeSrc": "7791:1:23", + "nodeType": "YulLiteral", + "src": "7791:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "7774:3:23", + "nodeType": "YulIdentifier", + "src": "7774:3:23" + }, + "nativeSrc": "7774:19:23", + "nodeType": "YulFunctionCall", + "src": "7774:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "7762:3:23", + "nodeType": "YulIdentifier", + "src": "7762:3:23" + }, + "nativeSrc": "7762:32:23", + "nodeType": "YulFunctionCall", + "src": "7762:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7735:6:23", + "nodeType": "YulIdentifier", + "src": "7735:6:23" + }, + "nativeSrc": "7735:60:23", + "nodeType": "YulFunctionCall", + "src": "7735:60:23" + }, + "nativeSrc": "7735:60:23", + "nodeType": "YulExpressionStatement", + "src": "7735:60:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7815:9:23", + "nodeType": "YulIdentifier", + "src": "7815:9:23" + }, + { + "kind": "number", + "nativeSrc": "7826:2:23", + "nodeType": "YulLiteral", + "src": "7826:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7811:3:23", + "nodeType": "YulIdentifier", + "src": "7811:3:23" + }, + "nativeSrc": "7811:18:23", + "nodeType": "YulFunctionCall", + "src": "7811:18:23" + }, + { + "arguments": [ + { + "name": "value2", + "nativeSrc": "7835:6:23", + "nodeType": "YulIdentifier", + "src": "7835:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "7851:3:23", + "nodeType": "YulLiteral", + "src": "7851:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "7856:1:23", + "nodeType": "YulLiteral", + "src": "7856:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "7847:3:23", + "nodeType": "YulIdentifier", + "src": "7847:3:23" + }, + "nativeSrc": "7847:11:23", + "nodeType": "YulFunctionCall", + "src": "7847:11:23" + }, + { + "kind": "number", + "nativeSrc": "7860:1:23", + "nodeType": "YulLiteral", + "src": "7860:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "7843:3:23", + "nodeType": "YulIdentifier", + "src": "7843:3:23" + }, + "nativeSrc": "7843:19:23", + "nodeType": "YulFunctionCall", + "src": "7843:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "7831:3:23", + "nodeType": "YulIdentifier", + "src": "7831:3:23" + }, + "nativeSrc": "7831:32:23", + "nodeType": "YulFunctionCall", + "src": "7831:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7804:6:23", + "nodeType": "YulIdentifier", + "src": "7804:6:23" + }, + "nativeSrc": "7804:60:23", + "nodeType": "YulFunctionCall", + "src": "7804:60:23" + }, + "nativeSrc": "7804:60:23", + "nodeType": "YulExpressionStatement", + "src": "7804:60:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7884:9:23", + "nodeType": "YulIdentifier", + "src": "7884:9:23" + }, + { + "kind": "number", + "nativeSrc": "7895:2:23", + "nodeType": "YulLiteral", + "src": "7895:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7880:3:23", + "nodeType": "YulIdentifier", + "src": "7880:3:23" + }, + "nativeSrc": "7880:18:23", + "nodeType": "YulFunctionCall", + "src": "7880:18:23" + }, + { + "arguments": [ + { + "name": "value3", + "nativeSrc": "7904:6:23", + "nodeType": "YulIdentifier", + "src": "7904:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "7920:3:23", + "nodeType": "YulLiteral", + "src": "7920:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "7925:1:23", + "nodeType": "YulLiteral", + "src": "7925:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "7916:3:23", + "nodeType": "YulIdentifier", + "src": "7916:3:23" + }, + "nativeSrc": "7916:11:23", + "nodeType": "YulFunctionCall", + "src": "7916:11:23" + }, + { + "kind": "number", + "nativeSrc": "7929:1:23", + "nodeType": "YulLiteral", + "src": "7929:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "7912:3:23", + "nodeType": "YulIdentifier", + "src": "7912:3:23" + }, + "nativeSrc": "7912:19:23", + "nodeType": "YulFunctionCall", + "src": "7912:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "7900:3:23", + "nodeType": "YulIdentifier", + "src": "7900:3:23" + }, + "nativeSrc": "7900:32:23", + "nodeType": "YulFunctionCall", + "src": "7900:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7873:6:23", + "nodeType": "YulIdentifier", + "src": "7873:6:23" + }, + "nativeSrc": "7873:60:23", + "nodeType": "YulFunctionCall", + "src": "7873:60:23" + }, + "nativeSrc": "7873:60:23", + "nodeType": "YulExpressionStatement", + "src": "7873:60:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7953:9:23", + "nodeType": "YulIdentifier", + "src": "7953:9:23" + }, + { + "kind": "number", + "nativeSrc": "7964:3:23", + "nodeType": "YulLiteral", + "src": "7964:3:23", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7949:3:23", + "nodeType": "YulIdentifier", + "src": "7949:3:23" + }, + "nativeSrc": "7949:19:23", + "nodeType": "YulFunctionCall", + "src": "7949:19:23" + }, + { + "name": "value4", + "nativeSrc": "7970:6:23", + "nodeType": "YulIdentifier", + "src": "7970:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7942:6:23", + "nodeType": "YulIdentifier", + "src": "7942:6:23" + }, + "nativeSrc": "7942:35:23", + "nodeType": "YulFunctionCall", + "src": "7942:35:23" + }, + "nativeSrc": "7942:35:23", + "nodeType": "YulExpressionStatement", + "src": "7942:35:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "7997:9:23", + "nodeType": "YulIdentifier", + "src": "7997:9:23" + }, + { + "kind": "number", + "nativeSrc": "8008:3:23", + "nodeType": "YulLiteral", + "src": "8008:3:23", + "type": "", + "value": "160" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "7993:3:23", + "nodeType": "YulIdentifier", + "src": "7993:3:23" + }, + "nativeSrc": "7993:19:23", + "nodeType": "YulFunctionCall", + "src": "7993:19:23" + }, + { + "name": "value5", + "nativeSrc": "8014:6:23", + "nodeType": "YulIdentifier", + "src": "8014:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "7986:6:23", + "nodeType": "YulIdentifier", + "src": "7986:6:23" + }, + "nativeSrc": "7986:35:23", + "nodeType": "YulFunctionCall", + "src": "7986:35:23" + }, + "nativeSrc": "7986:35:23", + "nodeType": "YulExpressionStatement", + "src": "7986:35:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8041:9:23", + "nodeType": "YulIdentifier", + "src": "8041:9:23" + }, + { + "kind": "number", + "nativeSrc": "8052:3:23", + "nodeType": "YulLiteral", + "src": "8052:3:23", + "type": "", + "value": "192" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8037:3:23", + "nodeType": "YulIdentifier", + "src": "8037:3:23" + }, + "nativeSrc": "8037:19:23", + "nodeType": "YulFunctionCall", + "src": "8037:19:23" + }, + { + "name": "value6", + "nativeSrc": "8058:6:23", + "nodeType": "YulIdentifier", + "src": "8058:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8030:6:23", + "nodeType": "YulIdentifier", + "src": "8030:6:23" + }, + "nativeSrc": "8030:35:23", + "nodeType": "YulFunctionCall", + "src": "8030:35:23" + }, + "nativeSrc": "8030:35:23", + "nodeType": "YulExpressionStatement", + "src": "8030:35:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8085:9:23", + "nodeType": "YulIdentifier", + "src": "8085:9:23" + }, + { + "kind": "number", + "nativeSrc": "8096:3:23", + "nodeType": "YulLiteral", + "src": "8096:3:23", + "type": "", + "value": "224" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8081:3:23", + "nodeType": "YulIdentifier", + "src": "8081:3:23" + }, + "nativeSrc": "8081:19:23", + "nodeType": "YulFunctionCall", + "src": "8081:19:23" + }, + { + "name": "value7", + "nativeSrc": "8102:6:23", + "nodeType": "YulIdentifier", + "src": "8102:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8074:6:23", + "nodeType": "YulIdentifier", + "src": "8074:6:23" + }, + "nativeSrc": "8074:35:23", + "nodeType": "YulFunctionCall", + "src": "8074:35:23" + }, + "nativeSrc": "8074:35:23", + "nodeType": "YulExpressionStatement", + "src": "8074:35:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8129:9:23", + "nodeType": "YulIdentifier", + "src": "8129:9:23" + }, + { + "kind": "number", + "nativeSrc": "8140:3:23", + "nodeType": "YulLiteral", + "src": "8140:3:23", + "type": "", + "value": "256" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8125:3:23", + "nodeType": "YulIdentifier", + "src": "8125:3:23" + }, + "nativeSrc": "8125:19:23", + "nodeType": "YulFunctionCall", + "src": "8125:19:23" + }, + { + "name": "value8", + "nativeSrc": "8146:6:23", + "nodeType": "YulIdentifier", + "src": "8146:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8118:6:23", + "nodeType": "YulIdentifier", + "src": "8118:6:23" + }, + "nativeSrc": "8118:35:23", + "nodeType": "YulFunctionCall", + "src": "8118:35:23" + }, + "nativeSrc": "8118:35:23", + "nodeType": "YulExpressionStatement", + "src": "8118:35:23" + } + ] + }, + "name": "abi_encode_tuple_t_bytes32_t_address_t_address_t_address_t_uint256_t_bytes32_t_uint256_t_uint256_t_uint256__to_t_bytes32_t_address_t_address_t_address_t_uint256_t_bytes32_t_uint256_t_uint256_t_uint256__fromStack_reversed", + "nativeSrc": "7330:829:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "7560:9:23", + "nodeType": "YulTypedName", + "src": "7560:9:23", + "type": "" + }, + { + "name": "value8", + "nativeSrc": "7571:6:23", + "nodeType": "YulTypedName", + "src": "7571:6:23", + "type": "" + }, + { + "name": "value7", + "nativeSrc": "7579:6:23", + "nodeType": "YulTypedName", + "src": "7579:6:23", + "type": "" + }, + { + "name": "value6", + "nativeSrc": "7587:6:23", + "nodeType": "YulTypedName", + "src": "7587:6:23", + "type": "" + }, + { + "name": "value5", + "nativeSrc": "7595:6:23", + "nodeType": "YulTypedName", + "src": "7595:6:23", + "type": "" + }, + { + "name": "value4", + "nativeSrc": "7603:6:23", + "nodeType": "YulTypedName", + "src": "7603:6:23", + "type": "" + }, + { + "name": "value3", + "nativeSrc": "7611:6:23", + "nodeType": "YulTypedName", + "src": "7611:6:23", + "type": "" + }, + { + "name": "value2", + "nativeSrc": "7619:6:23", + "nodeType": "YulTypedName", + "src": "7619:6:23", + "type": "" + }, + { + "name": "value1", + "nativeSrc": "7627:6:23", + "nodeType": "YulTypedName", + "src": "7627:6:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "7635:6:23", + "nodeType": "YulTypedName", + "src": "7635:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "7646:4:23", + "nodeType": "YulTypedName", + "src": "7646:4:23", + "type": "" + } + ], + "src": "7330:829:23" + }, + { + "body": { + "nativeSrc": "8429:401:23", + "nodeType": "YulBlock", + "src": "8429:401:23", + "statements": [ + { + "nativeSrc": "8439:27:23", + "nodeType": "YulAssignment", + "src": "8439:27:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8451:9:23", + "nodeType": "YulIdentifier", + "src": "8451:9:23" + }, + { + "kind": "number", + "nativeSrc": "8462:3:23", + "nodeType": "YulLiteral", + "src": "8462:3:23", + "type": "", + "value": "224" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8447:3:23", + "nodeType": "YulIdentifier", + "src": "8447:3:23" + }, + "nativeSrc": "8447:19:23", + "nodeType": "YulFunctionCall", + "src": "8447:19:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "8439:4:23", + "nodeType": "YulIdentifier", + "src": "8439:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8482:9:23", + "nodeType": "YulIdentifier", + "src": "8482:9:23" + }, + { + "arguments": [ + { + "name": "value0", + "nativeSrc": "8497:6:23", + "nodeType": "YulIdentifier", + "src": "8497:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "8513:3:23", + "nodeType": "YulLiteral", + "src": "8513:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "8518:1:23", + "nodeType": "YulLiteral", + "src": "8518:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "8509:3:23", + "nodeType": "YulIdentifier", + "src": "8509:3:23" + }, + "nativeSrc": "8509:11:23", + "nodeType": "YulFunctionCall", + "src": "8509:11:23" + }, + { + "kind": "number", + "nativeSrc": "8522:1:23", + "nodeType": "YulLiteral", + "src": "8522:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "8505:3:23", + "nodeType": "YulIdentifier", + "src": "8505:3:23" + }, + "nativeSrc": "8505:19:23", + "nodeType": "YulFunctionCall", + "src": "8505:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "8493:3:23", + "nodeType": "YulIdentifier", + "src": "8493:3:23" + }, + "nativeSrc": "8493:32:23", + "nodeType": "YulFunctionCall", + "src": "8493:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8475:6:23", + "nodeType": "YulIdentifier", + "src": "8475:6:23" + }, + "nativeSrc": "8475:51:23", + "nodeType": "YulFunctionCall", + "src": "8475:51:23" + }, + "nativeSrc": "8475:51:23", + "nodeType": "YulExpressionStatement", + "src": "8475:51:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8546:9:23", + "nodeType": "YulIdentifier", + "src": "8546:9:23" + }, + { + "kind": "number", + "nativeSrc": "8557:2:23", + "nodeType": "YulLiteral", + "src": "8557:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8542:3:23", + "nodeType": "YulIdentifier", + "src": "8542:3:23" + }, + "nativeSrc": "8542:18:23", + "nodeType": "YulFunctionCall", + "src": "8542:18:23" + }, + { + "arguments": [ + { + "name": "value1", + "nativeSrc": "8566:6:23", + "nodeType": "YulIdentifier", + "src": "8566:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "8582:3:23", + "nodeType": "YulLiteral", + "src": "8582:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "8587:1:23", + "nodeType": "YulLiteral", + "src": "8587:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "8578:3:23", + "nodeType": "YulIdentifier", + "src": "8578:3:23" + }, + "nativeSrc": "8578:11:23", + "nodeType": "YulFunctionCall", + "src": "8578:11:23" + }, + { + "kind": "number", + "nativeSrc": "8591:1:23", + "nodeType": "YulLiteral", + "src": "8591:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "8574:3:23", + "nodeType": "YulIdentifier", + "src": "8574:3:23" + }, + "nativeSrc": "8574:19:23", + "nodeType": "YulFunctionCall", + "src": "8574:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "8562:3:23", + "nodeType": "YulIdentifier", + "src": "8562:3:23" + }, + "nativeSrc": "8562:32:23", + "nodeType": "YulFunctionCall", + "src": "8562:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8535:6:23", + "nodeType": "YulIdentifier", + "src": "8535:6:23" + }, + "nativeSrc": "8535:60:23", + "nodeType": "YulFunctionCall", + "src": "8535:60:23" + }, + "nativeSrc": "8535:60:23", + "nodeType": "YulExpressionStatement", + "src": "8535:60:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8615:9:23", + "nodeType": "YulIdentifier", + "src": "8615:9:23" + }, + { + "kind": "number", + "nativeSrc": "8626:2:23", + "nodeType": "YulLiteral", + "src": "8626:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8611:3:23", + "nodeType": "YulIdentifier", + "src": "8611:3:23" + }, + "nativeSrc": "8611:18:23", + "nodeType": "YulFunctionCall", + "src": "8611:18:23" + }, + { + "name": "value2", + "nativeSrc": "8631:6:23", + "nodeType": "YulIdentifier", + "src": "8631:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8604:6:23", + "nodeType": "YulIdentifier", + "src": "8604:6:23" + }, + "nativeSrc": "8604:34:23", + "nodeType": "YulFunctionCall", + "src": "8604:34:23" + }, + "nativeSrc": "8604:34:23", + "nodeType": "YulExpressionStatement", + "src": "8604:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8658:9:23", + "nodeType": "YulIdentifier", + "src": "8658:9:23" + }, + { + "kind": "number", + "nativeSrc": "8669:2:23", + "nodeType": "YulLiteral", + "src": "8669:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8654:3:23", + "nodeType": "YulIdentifier", + "src": "8654:3:23" + }, + "nativeSrc": "8654:18:23", + "nodeType": "YulFunctionCall", + "src": "8654:18:23" + }, + { + "name": "value3", + "nativeSrc": "8674:6:23", + "nodeType": "YulIdentifier", + "src": "8674:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8647:6:23", + "nodeType": "YulIdentifier", + "src": "8647:6:23" + }, + "nativeSrc": "8647:34:23", + "nodeType": "YulFunctionCall", + "src": "8647:34:23" + }, + "nativeSrc": "8647:34:23", + "nodeType": "YulExpressionStatement", + "src": "8647:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8701:9:23", + "nodeType": "YulIdentifier", + "src": "8701:9:23" + }, + { + "kind": "number", + "nativeSrc": "8712:3:23", + "nodeType": "YulLiteral", + "src": "8712:3:23", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8697:3:23", + "nodeType": "YulIdentifier", + "src": "8697:3:23" + }, + "nativeSrc": "8697:19:23", + "nodeType": "YulFunctionCall", + "src": "8697:19:23" + }, + { + "arguments": [ + { + "name": "value4", + "nativeSrc": "8722:6:23", + "nodeType": "YulIdentifier", + "src": "8722:6:23" + }, + { + "kind": "number", + "nativeSrc": "8730:4:23", + "nodeType": "YulLiteral", + "src": "8730:4:23", + "type": "", + "value": "0xff" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "8718:3:23", + "nodeType": "YulIdentifier", + "src": "8718:3:23" + }, + "nativeSrc": "8718:17:23", + "nodeType": "YulFunctionCall", + "src": "8718:17:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8690:6:23", + "nodeType": "YulIdentifier", + "src": "8690:6:23" + }, + "nativeSrc": "8690:46:23", + "nodeType": "YulFunctionCall", + "src": "8690:46:23" + }, + "nativeSrc": "8690:46:23", + "nodeType": "YulExpressionStatement", + "src": "8690:46:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8756:9:23", + "nodeType": "YulIdentifier", + "src": "8756:9:23" + }, + { + "kind": "number", + "nativeSrc": "8767:3:23", + "nodeType": "YulLiteral", + "src": "8767:3:23", + "type": "", + "value": "160" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8752:3:23", + "nodeType": "YulIdentifier", + "src": "8752:3:23" + }, + "nativeSrc": "8752:19:23", + "nodeType": "YulFunctionCall", + "src": "8752:19:23" + }, + { + "name": "value5", + "nativeSrc": "8773:6:23", + "nodeType": "YulIdentifier", + "src": "8773:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8745:6:23", + "nodeType": "YulIdentifier", + "src": "8745:6:23" + }, + "nativeSrc": "8745:35:23", + "nodeType": "YulFunctionCall", + "src": "8745:35:23" + }, + "nativeSrc": "8745:35:23", + "nodeType": "YulExpressionStatement", + "src": "8745:35:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8800:9:23", + "nodeType": "YulIdentifier", + "src": "8800:9:23" + }, + { + "kind": "number", + "nativeSrc": "8811:3:23", + "nodeType": "YulLiteral", + "src": "8811:3:23", + "type": "", + "value": "192" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8796:3:23", + "nodeType": "YulIdentifier", + "src": "8796:3:23" + }, + "nativeSrc": "8796:19:23", + "nodeType": "YulFunctionCall", + "src": "8796:19:23" + }, + { + "name": "value6", + "nativeSrc": "8817:6:23", + "nodeType": "YulIdentifier", + "src": "8817:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "8789:6:23", + "nodeType": "YulIdentifier", + "src": "8789:6:23" + }, + "nativeSrc": "8789:35:23", + "nodeType": "YulFunctionCall", + "src": "8789:35:23" + }, + "nativeSrc": "8789:35:23", + "nodeType": "YulExpressionStatement", + "src": "8789:35:23" + } + ] + }, + "name": "abi_encode_tuple_t_address_t_address_t_uint256_t_uint256_t_uint8_t_bytes32_t_bytes32__to_t_address_t_address_t_uint256_t_uint256_t_uint8_t_bytes32_t_bytes32__fromStack_reversed", + "nativeSrc": "8164:666:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "8350:9:23", + "nodeType": "YulTypedName", + "src": "8350:9:23", + "type": "" + }, + { + "name": "value6", + "nativeSrc": "8361:6:23", + "nodeType": "YulTypedName", + "src": "8361:6:23", + "type": "" + }, + { + "name": "value5", + "nativeSrc": "8369:6:23", + "nodeType": "YulTypedName", + "src": "8369:6:23", + "type": "" + }, + { + "name": "value4", + "nativeSrc": "8377:6:23", + "nodeType": "YulTypedName", + "src": "8377:6:23", + "type": "" + }, + { + "name": "value3", + "nativeSrc": "8385:6:23", + "nodeType": "YulTypedName", + "src": "8385:6:23", + "type": "" + }, + { + "name": "value2", + "nativeSrc": "8393:6:23", + "nodeType": "YulTypedName", + "src": "8393:6:23", + "type": "" + }, + { + "name": "value1", + "nativeSrc": "8401:6:23", + "nodeType": "YulTypedName", + "src": "8401:6:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "8409:6:23", + "nodeType": "YulTypedName", + "src": "8409:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "8420:4:23", + "nodeType": "YulTypedName", + "src": "8420:4:23", + "type": "" + } + ], + "src": "8164:666:23" + }, + { + "body": { + "nativeSrc": "8964:171:23", + "nodeType": "YulBlock", + "src": "8964:171:23", + "statements": [ + { + "nativeSrc": "8974:26:23", + "nodeType": "YulAssignment", + "src": "8974:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "8986:9:23", + "nodeType": "YulIdentifier", + "src": "8986:9:23" + }, + { + "kind": "number", + "nativeSrc": "8997:2:23", + "nodeType": "YulLiteral", + "src": "8997:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "8982:3:23", + "nodeType": "YulIdentifier", + "src": "8982:3:23" + }, + "nativeSrc": "8982:18:23", + "nodeType": "YulFunctionCall", + "src": "8982:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "8974:4:23", + "nodeType": "YulIdentifier", + "src": "8974:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "9016:9:23", + "nodeType": "YulIdentifier", + "src": "9016:9:23" + }, + { + "arguments": [ + { + "name": "value0", + "nativeSrc": "9031:6:23", + "nodeType": "YulIdentifier", + "src": "9031:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9047:3:23", + "nodeType": "YulLiteral", + "src": "9047:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "9052:1:23", + "nodeType": "YulLiteral", + "src": "9052:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "9043:3:23", + "nodeType": "YulIdentifier", + "src": "9043:3:23" + }, + "nativeSrc": "9043:11:23", + "nodeType": "YulFunctionCall", + "src": "9043:11:23" + }, + { + "kind": "number", + "nativeSrc": "9056:1:23", + "nodeType": "YulLiteral", + "src": "9056:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "9039:3:23", + "nodeType": "YulIdentifier", + "src": "9039:3:23" + }, + "nativeSrc": "9039:19:23", + "nodeType": "YulFunctionCall", + "src": "9039:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "9027:3:23", + "nodeType": "YulIdentifier", + "src": "9027:3:23" + }, + "nativeSrc": "9027:32:23", + "nodeType": "YulFunctionCall", + "src": "9027:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "9009:6:23", + "nodeType": "YulIdentifier", + "src": "9009:6:23" + }, + "nativeSrc": "9009:51:23", + "nodeType": "YulFunctionCall", + "src": "9009:51:23" + }, + "nativeSrc": "9009:51:23", + "nodeType": "YulExpressionStatement", + "src": "9009:51:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "9080:9:23", + "nodeType": "YulIdentifier", + "src": "9080:9:23" + }, + { + "kind": "number", + "nativeSrc": "9091:2:23", + "nodeType": "YulLiteral", + "src": "9091:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9076:3:23", + "nodeType": "YulIdentifier", + "src": "9076:3:23" + }, + "nativeSrc": "9076:18:23", + "nodeType": "YulFunctionCall", + "src": "9076:18:23" + }, + { + "arguments": [ + { + "name": "value1", + "nativeSrc": "9100:6:23", + "nodeType": "YulIdentifier", + "src": "9100:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9116:3:23", + "nodeType": "YulLiteral", + "src": "9116:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "9121:1:23", + "nodeType": "YulLiteral", + "src": "9121:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "9112:3:23", + "nodeType": "YulIdentifier", + "src": "9112:3:23" + }, + "nativeSrc": "9112:11:23", + "nodeType": "YulFunctionCall", + "src": "9112:11:23" + }, + { + "kind": "number", + "nativeSrc": "9125:1:23", + "nodeType": "YulLiteral", + "src": "9125:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "9108:3:23", + "nodeType": "YulIdentifier", + "src": "9108:3:23" + }, + "nativeSrc": "9108:19:23", + "nodeType": "YulFunctionCall", + "src": "9108:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "9096:3:23", + "nodeType": "YulIdentifier", + "src": "9096:3:23" + }, + "nativeSrc": "9096:32:23", + "nodeType": "YulFunctionCall", + "src": "9096:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "9069:6:23", + "nodeType": "YulIdentifier", + "src": "9069:6:23" + }, + "nativeSrc": "9069:60:23", + "nodeType": "YulFunctionCall", + "src": "9069:60:23" + }, + "nativeSrc": "9069:60:23", + "nodeType": "YulExpressionStatement", + "src": "9069:60:23" + } + ] + }, + "name": "abi_encode_tuple_t_address_t_address__to_t_address_t_address__fromStack_reversed", + "nativeSrc": "8835:300:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "8925:9:23", + "nodeType": "YulTypedName", + "src": "8925:9:23", + "type": "" + }, + { + "name": "value1", + "nativeSrc": "8936:6:23", + "nodeType": "YulTypedName", + "src": "8936:6:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "8944:6:23", + "nodeType": "YulTypedName", + "src": "8944:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "8955:4:23", + "nodeType": "YulTypedName", + "src": "8955:4:23", + "type": "" + } + ], + "src": "8835:300:23" + }, + { + "body": { + "nativeSrc": "9221:103:23", + "nodeType": "YulBlock", + "src": "9221:103:23", + "statements": [ + { + "body": { + "nativeSrc": "9267:16:23", + "nodeType": "YulBlock", + "src": "9267:16:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "9276:1:23", + "nodeType": "YulLiteral", + "src": "9276:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "9279:1:23", + "nodeType": "YulLiteral", + "src": "9279:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "9269:6:23", + "nodeType": "YulIdentifier", + "src": "9269:6:23" + }, + "nativeSrc": "9269:12:23", + "nodeType": "YulFunctionCall", + "src": "9269:12:23" + }, + "nativeSrc": "9269:12:23", + "nodeType": "YulExpressionStatement", + "src": "9269:12:23" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nativeSrc": "9242:7:23", + "nodeType": "YulIdentifier", + "src": "9242:7:23" + }, + { + "name": "headStart", + "nativeSrc": "9251:9:23", + "nodeType": "YulIdentifier", + "src": "9251:9:23" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "9238:3:23", + "nodeType": "YulIdentifier", + "src": "9238:3:23" + }, + "nativeSrc": "9238:23:23", + "nodeType": "YulFunctionCall", + "src": "9238:23:23" + }, + { + "kind": "number", + "nativeSrc": "9263:2:23", + "nodeType": "YulLiteral", + "src": "9263:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nativeSrc": "9234:3:23", + "nodeType": "YulIdentifier", + "src": "9234:3:23" + }, + "nativeSrc": "9234:32:23", + "nodeType": "YulFunctionCall", + "src": "9234:32:23" + }, + "nativeSrc": "9231:52:23", + "nodeType": "YulIf", + "src": "9231:52:23" + }, + { + "nativeSrc": "9292:26:23", + "nodeType": "YulAssignment", + "src": "9292:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "9308:9:23", + "nodeType": "YulIdentifier", + "src": "9308:9:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "9302:5:23", + "nodeType": "YulIdentifier", + "src": "9302:5:23" + }, + "nativeSrc": "9302:16:23", + "nodeType": "YulFunctionCall", + "src": "9302:16:23" + }, + "variableNames": [ + { + "name": "value0", + "nativeSrc": "9292:6:23", + "nodeType": "YulIdentifier", + "src": "9292:6:23" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_uint256_fromMemory", + "nativeSrc": "9140:184:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "9187:9:23", + "nodeType": "YulTypedName", + "src": "9187:9:23", + "type": "" + }, + { + "name": "dataEnd", + "nativeSrc": "9198:7:23", + "nodeType": "YulTypedName", + "src": "9198:7:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nativeSrc": "9210:6:23", + "nodeType": "YulTypedName", + "src": "9210:6:23", + "type": "" + } + ], + "src": "9140:184:23" + }, + { + "body": { + "nativeSrc": "9503:230:23", + "nodeType": "YulBlock", + "src": "9503:230:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "9520:9:23", + "nodeType": "YulIdentifier", + "src": "9520:9:23" + }, + { + "kind": "number", + "nativeSrc": "9531:2:23", + "nodeType": "YulLiteral", + "src": "9531:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "9513:6:23", + "nodeType": "YulIdentifier", + "src": "9513:6:23" + }, + "nativeSrc": "9513:21:23", + "nodeType": "YulFunctionCall", + "src": "9513:21:23" + }, + "nativeSrc": "9513:21:23", + "nodeType": "YulExpressionStatement", + "src": "9513:21:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "9554:9:23", + "nodeType": "YulIdentifier", + "src": "9554:9:23" + }, + { + "kind": "number", + "nativeSrc": "9565:2:23", + "nodeType": "YulLiteral", + "src": "9565:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9550:3:23", + "nodeType": "YulIdentifier", + "src": "9550:3:23" + }, + "nativeSrc": "9550:18:23", + "nodeType": "YulFunctionCall", + "src": "9550:18:23" + }, + { + "kind": "number", + "nativeSrc": "9570:2:23", + "nodeType": "YulLiteral", + "src": "9570:2:23", + "type": "", + "value": "40" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "9543:6:23", + "nodeType": "YulIdentifier", + "src": "9543:6:23" + }, + "nativeSrc": "9543:30:23", + "nodeType": "YulFunctionCall", + "src": "9543:30:23" + }, + "nativeSrc": "9543:30:23", + "nodeType": "YulExpressionStatement", + "src": "9543:30:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "9593:9:23", + "nodeType": "YulIdentifier", + "src": "9593:9:23" + }, + { + "kind": "number", + "nativeSrc": "9604:2:23", + "nodeType": "YulLiteral", + "src": "9604:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9589:3:23", + "nodeType": "YulIdentifier", + "src": "9589:3:23" + }, + "nativeSrc": "9589:18:23", + "nodeType": "YulFunctionCall", + "src": "9589:18:23" + }, + { + "hexValue": "5065726d6974206661696c656420616e6420696e73756666696369656e742061", + "kind": "string", + "nativeSrc": "9609:34:23", + "nodeType": "YulLiteral", + "src": "9609:34:23", + "type": "", + "value": "Permit failed and insufficient a" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "9582:6:23", + "nodeType": "YulIdentifier", + "src": "9582:6:23" + }, + "nativeSrc": "9582:62:23", + "nodeType": "YulFunctionCall", + "src": "9582:62:23" + }, + "nativeSrc": "9582:62:23", + "nodeType": "YulExpressionStatement", + "src": "9582:62:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "9664:9:23", + "nodeType": "YulIdentifier", + "src": "9664:9:23" + }, + { + "kind": "number", + "nativeSrc": "9675:2:23", + "nodeType": "YulLiteral", + "src": "9675:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9660:3:23", + "nodeType": "YulIdentifier", + "src": "9660:3:23" + }, + "nativeSrc": "9660:18:23", + "nodeType": "YulFunctionCall", + "src": "9660:18:23" + }, + { + "hexValue": "6c6c6f77616e6365", + "kind": "string", + "nativeSrc": "9680:10:23", + "nodeType": "YulLiteral", + "src": "9680:10:23", + "type": "", + "value": "llowance" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "9653:6:23", + "nodeType": "YulIdentifier", + "src": "9653:6:23" + }, + "nativeSrc": "9653:38:23", + "nodeType": "YulFunctionCall", + "src": "9653:38:23" + }, + "nativeSrc": "9653:38:23", + "nodeType": "YulExpressionStatement", + "src": "9653:38:23" + }, + { + "nativeSrc": "9700:27:23", + "nodeType": "YulAssignment", + "src": "9700:27:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "9712:9:23", + "nodeType": "YulIdentifier", + "src": "9712:9:23" + }, + { + "kind": "number", + "nativeSrc": "9723:3:23", + "nodeType": "YulLiteral", + "src": "9723:3:23", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9708:3:23", + "nodeType": "YulIdentifier", + "src": "9708:3:23" + }, + "nativeSrc": "9708:19:23", + "nodeType": "YulFunctionCall", + "src": "9708:19:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "9700:4:23", + "nodeType": "YulIdentifier", + "src": "9700:4:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_0acc7f0c8df1a6717d2b423ae4591ac135687015764ac37dd4cf0150a9322b15__to_t_string_memory_ptr__fromStack_reversed", + "nativeSrc": "9329:404:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "9480:9:23", + "nodeType": "YulTypedName", + "src": "9480:9:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "9494:4:23", + "nodeType": "YulTypedName", + "src": "9494:4:23", + "type": "" + } + ], + "src": "9329:404:23" + }, + { + "body": { + "nativeSrc": "9875:164:23", + "nodeType": "YulBlock", + "src": "9875:164:23", + "statements": [ + { + "nativeSrc": "9885:27:23", + "nodeType": "YulVariableDeclaration", + "src": "9885:27:23", + "value": { + "arguments": [ + { + "name": "value0", + "nativeSrc": "9905:6:23", + "nodeType": "YulIdentifier", + "src": "9905:6:23" + } + ], + "functionName": { + "name": "mload", + "nativeSrc": "9899:5:23", + "nodeType": "YulIdentifier", + "src": "9899:5:23" + }, + "nativeSrc": "9899:13:23", + "nodeType": "YulFunctionCall", + "src": "9899:13:23" + }, + "variables": [ + { + "name": "length", + "nativeSrc": "9889:6:23", + "nodeType": "YulTypedName", + "src": "9889:6:23", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "pos", + "nativeSrc": "9927:3:23", + "nodeType": "YulIdentifier", + "src": "9927:3:23" + }, + { + "arguments": [ + { + "name": "value0", + "nativeSrc": "9936:6:23", + "nodeType": "YulIdentifier", + "src": "9936:6:23" + }, + { + "kind": "number", + "nativeSrc": "9944:4:23", + "nodeType": "YulLiteral", + "src": "9944:4:23", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9932:3:23", + "nodeType": "YulIdentifier", + "src": "9932:3:23" + }, + "nativeSrc": "9932:17:23", + "nodeType": "YulFunctionCall", + "src": "9932:17:23" + }, + { + "name": "length", + "nativeSrc": "9951:6:23", + "nodeType": "YulIdentifier", + "src": "9951:6:23" + } + ], + "functionName": { + "name": "mcopy", + "nativeSrc": "9921:5:23", + "nodeType": "YulIdentifier", + "src": "9921:5:23" + }, + "nativeSrc": "9921:37:23", + "nodeType": "YulFunctionCall", + "src": "9921:37:23" + }, + "nativeSrc": "9921:37:23", + "nodeType": "YulExpressionStatement", + "src": "9921:37:23" + }, + { + "nativeSrc": "9967:26:23", + "nodeType": "YulVariableDeclaration", + "src": "9967:26:23", + "value": { + "arguments": [ + { + "name": "pos", + "nativeSrc": "9981:3:23", + "nodeType": "YulIdentifier", + "src": "9981:3:23" + }, + { + "name": "length", + "nativeSrc": "9986:6:23", + "nodeType": "YulIdentifier", + "src": "9986:6:23" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "9977:3:23", + "nodeType": "YulIdentifier", + "src": "9977:3:23" + }, + "nativeSrc": "9977:16:23", + "nodeType": "YulFunctionCall", + "src": "9977:16:23" + }, + "variables": [ + { + "name": "_1", + "nativeSrc": "9971:2:23", + "nodeType": "YulTypedName", + "src": "9971:2:23", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "_1", + "nativeSrc": "10009:2:23", + "nodeType": "YulIdentifier", + "src": "10009:2:23" + }, + { + "kind": "number", + "nativeSrc": "10013:1:23", + "nodeType": "YulLiteral", + "src": "10013:1:23", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10002:6:23", + "nodeType": "YulIdentifier", + "src": "10002:6:23" + }, + "nativeSrc": "10002:13:23", + "nodeType": "YulFunctionCall", + "src": "10002:13:23" + }, + "nativeSrc": "10002:13:23", + "nodeType": "YulExpressionStatement", + "src": "10002:13:23" + }, + { + "nativeSrc": "10024:9:23", + "nodeType": "YulAssignment", + "src": "10024:9:23", + "value": { + "name": "_1", + "nativeSrc": "10031:2:23", + "nodeType": "YulIdentifier", + "src": "10031:2:23" + }, + "variableNames": [ + { + "name": "end", + "nativeSrc": "10024:3:23", + "nodeType": "YulIdentifier", + "src": "10024:3:23" + } + ] + } + ] + }, + "name": "abi_encode_tuple_packed_t_bytes_memory_ptr__to_t_bytes_memory_ptr__nonPadded_inplace_fromStack_reversed", + "nativeSrc": "9738:301:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "pos", + "nativeSrc": "9851:3:23", + "nodeType": "YulTypedName", + "src": "9851:3:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "9856:6:23", + "nodeType": "YulTypedName", + "src": "9856:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nativeSrc": "9867:3:23", + "nodeType": "YulTypedName", + "src": "9867:3:23", + "type": "" + } + ], + "src": "9738:301:23" + }, + { + "body": { + "nativeSrc": "10225:217:23", + "nodeType": "YulBlock", + "src": "10225:217:23", + "statements": [ + { + "nativeSrc": "10235:27:23", + "nodeType": "YulAssignment", + "src": "10235:27:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "10247:9:23", + "nodeType": "YulIdentifier", + "src": "10247:9:23" + }, + { + "kind": "number", + "nativeSrc": "10258:3:23", + "nodeType": "YulLiteral", + "src": "10258:3:23", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10243:3:23", + "nodeType": "YulIdentifier", + "src": "10243:3:23" + }, + "nativeSrc": "10243:19:23", + "nodeType": "YulFunctionCall", + "src": "10243:19:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "10235:4:23", + "nodeType": "YulIdentifier", + "src": "10235:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "10278:9:23", + "nodeType": "YulIdentifier", + "src": "10278:9:23" + }, + { + "name": "value0", + "nativeSrc": "10289:6:23", + "nodeType": "YulIdentifier", + "src": "10289:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10271:6:23", + "nodeType": "YulIdentifier", + "src": "10271:6:23" + }, + "nativeSrc": "10271:25:23", + "nodeType": "YulFunctionCall", + "src": "10271:25:23" + }, + "nativeSrc": "10271:25:23", + "nodeType": "YulExpressionStatement", + "src": "10271:25:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "10316:9:23", + "nodeType": "YulIdentifier", + "src": "10316:9:23" + }, + { + "kind": "number", + "nativeSrc": "10327:2:23", + "nodeType": "YulLiteral", + "src": "10327:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10312:3:23", + "nodeType": "YulIdentifier", + "src": "10312:3:23" + }, + "nativeSrc": "10312:18:23", + "nodeType": "YulFunctionCall", + "src": "10312:18:23" + }, + { + "arguments": [ + { + "name": "value1", + "nativeSrc": "10336:6:23", + "nodeType": "YulIdentifier", + "src": "10336:6:23" + }, + { + "kind": "number", + "nativeSrc": "10344:4:23", + "nodeType": "YulLiteral", + "src": "10344:4:23", + "type": "", + "value": "0xff" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "10332:3:23", + "nodeType": "YulIdentifier", + "src": "10332:3:23" + }, + "nativeSrc": "10332:17:23", + "nodeType": "YulFunctionCall", + "src": "10332:17:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10305:6:23", + "nodeType": "YulIdentifier", + "src": "10305:6:23" + }, + "nativeSrc": "10305:45:23", + "nodeType": "YulFunctionCall", + "src": "10305:45:23" + }, + "nativeSrc": "10305:45:23", + "nodeType": "YulExpressionStatement", + "src": "10305:45:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "10370:9:23", + "nodeType": "YulIdentifier", + "src": "10370:9:23" + }, + { + "kind": "number", + "nativeSrc": "10381:2:23", + "nodeType": "YulLiteral", + "src": "10381:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10366:3:23", + "nodeType": "YulIdentifier", + "src": "10366:3:23" + }, + "nativeSrc": "10366:18:23", + "nodeType": "YulFunctionCall", + "src": "10366:18:23" + }, + { + "name": "value2", + "nativeSrc": "10386:6:23", + "nodeType": "YulIdentifier", + "src": "10386:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10359:6:23", + "nodeType": "YulIdentifier", + "src": "10359:6:23" + }, + "nativeSrc": "10359:34:23", + "nodeType": "YulFunctionCall", + "src": "10359:34:23" + }, + "nativeSrc": "10359:34:23", + "nodeType": "YulExpressionStatement", + "src": "10359:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "10413:9:23", + "nodeType": "YulIdentifier", + "src": "10413:9:23" + }, + { + "kind": "number", + "nativeSrc": "10424:2:23", + "nodeType": "YulLiteral", + "src": "10424:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10409:3:23", + "nodeType": "YulIdentifier", + "src": "10409:3:23" + }, + "nativeSrc": "10409:18:23", + "nodeType": "YulFunctionCall", + "src": "10409:18:23" + }, + { + "name": "value3", + "nativeSrc": "10429:6:23", + "nodeType": "YulIdentifier", + "src": "10429:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10402:6:23", + "nodeType": "YulIdentifier", + "src": "10402:6:23" + }, + "nativeSrc": "10402:34:23", + "nodeType": "YulFunctionCall", + "src": "10402:34:23" + }, + "nativeSrc": "10402:34:23", + "nodeType": "YulExpressionStatement", + "src": "10402:34:23" + } + ] + }, + "name": "abi_encode_tuple_t_bytes32_t_uint8_t_bytes32_t_bytes32__to_t_bytes32_t_uint8_t_bytes32_t_bytes32__fromStack_reversed", + "nativeSrc": "10044:398:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "10170:9:23", + "nodeType": "YulTypedName", + "src": "10170:9:23", + "type": "" + }, + { + "name": "value3", + "nativeSrc": "10181:6:23", + "nodeType": "YulTypedName", + "src": "10181:6:23", + "type": "" + }, + { + "name": "value2", + "nativeSrc": "10189:6:23", + "nodeType": "YulTypedName", + "src": "10189:6:23", + "type": "" + }, + { + "name": "value1", + "nativeSrc": "10197:6:23", + "nodeType": "YulTypedName", + "src": "10197:6:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "10205:6:23", + "nodeType": "YulTypedName", + "src": "10205:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "10216:4:23", + "nodeType": "YulTypedName", + "src": "10216:4:23", + "type": "" + } + ], + "src": "10044:398:23" + }, + { + "body": { + "nativeSrc": "10479:95:23", + "nodeType": "YulBlock", + "src": "10479:95:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10496:1:23", + "nodeType": "YulLiteral", + "src": "10496:1:23", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10503:3:23", + "nodeType": "YulLiteral", + "src": "10503:3:23", + "type": "", + "value": "224" + }, + { + "kind": "number", + "nativeSrc": "10508:10:23", + "nodeType": "YulLiteral", + "src": "10508:10:23", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "10499:3:23", + "nodeType": "YulIdentifier", + "src": "10499:3:23" + }, + "nativeSrc": "10499:20:23", + "nodeType": "YulFunctionCall", + "src": "10499:20:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10489:6:23", + "nodeType": "YulIdentifier", + "src": "10489:6:23" + }, + "nativeSrc": "10489:31:23", + "nodeType": "YulFunctionCall", + "src": "10489:31:23" + }, + "nativeSrc": "10489:31:23", + "nodeType": "YulExpressionStatement", + "src": "10489:31:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10536:1:23", + "nodeType": "YulLiteral", + "src": "10536:1:23", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nativeSrc": "10539:4:23", + "nodeType": "YulLiteral", + "src": "10539:4:23", + "type": "", + "value": "0x21" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10529:6:23", + "nodeType": "YulIdentifier", + "src": "10529:6:23" + }, + "nativeSrc": "10529:15:23", + "nodeType": "YulFunctionCall", + "src": "10529:15:23" + }, + "nativeSrc": "10529:15:23", + "nodeType": "YulExpressionStatement", + "src": "10529:15:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10560:1:23", + "nodeType": "YulLiteral", + "src": "10560:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "10563:4:23", + "nodeType": "YulLiteral", + "src": "10563:4:23", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "10553:6:23", + "nodeType": "YulIdentifier", + "src": "10553:6:23" + }, + "nativeSrc": "10553:15:23", + "nodeType": "YulFunctionCall", + "src": "10553:15:23" + }, + "nativeSrc": "10553:15:23", + "nodeType": "YulExpressionStatement", + "src": "10553:15:23" + } + ] + }, + "name": "panic_error_0x21", + "nativeSrc": "10447:127:23", + "nodeType": "YulFunctionDefinition", + "src": "10447:127:23" + }, + { + "body": { + "nativeSrc": "10680:76:23", + "nodeType": "YulBlock", + "src": "10680:76:23", + "statements": [ + { + "nativeSrc": "10690:26:23", + "nodeType": "YulAssignment", + "src": "10690:26:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "10702:9:23", + "nodeType": "YulIdentifier", + "src": "10702:9:23" + }, + { + "kind": "number", + "nativeSrc": "10713:2:23", + "nodeType": "YulLiteral", + "src": "10713:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "10698:3:23", + "nodeType": "YulIdentifier", + "src": "10698:3:23" + }, + "nativeSrc": "10698:18:23", + "nodeType": "YulFunctionCall", + "src": "10698:18:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "10690:4:23", + "nodeType": "YulIdentifier", + "src": "10690:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "10732:9:23", + "nodeType": "YulIdentifier", + "src": "10732:9:23" + }, + { + "name": "value0", + "nativeSrc": "10743:6:23", + "nodeType": "YulIdentifier", + "src": "10743:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "10725:6:23", + "nodeType": "YulIdentifier", + "src": "10725:6:23" + }, + "nativeSrc": "10725:25:23", + "nodeType": "YulFunctionCall", + "src": "10725:25:23" + }, + "nativeSrc": "10725:25:23", + "nodeType": "YulExpressionStatement", + "src": "10725:25:23" + } + ] + }, + "name": "abi_encode_tuple_t_bytes32__to_t_bytes32__fromStack_reversed", + "nativeSrc": "10579:177:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "10649:9:23", + "nodeType": "YulTypedName", + "src": "10649:9:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "10660:6:23", + "nodeType": "YulTypedName", + "src": "10660:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "10671:4:23", + "nodeType": "YulTypedName", + "src": "10671:4:23", + "type": "" + } + ], + "src": "10579:177:23" + }, + { + "body": { + "nativeSrc": "10816:325:23", + "nodeType": "YulBlock", + "src": "10816:325:23", + "statements": [ + { + "nativeSrc": "10826:22:23", + "nodeType": "YulAssignment", + "src": "10826:22:23", + "value": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "10840:1:23", + "nodeType": "YulLiteral", + "src": "10840:1:23", + "type": "", + "value": "1" + }, + { + "name": "data", + "nativeSrc": "10843:4:23", + "nodeType": "YulIdentifier", + "src": "10843:4:23" + } + ], + "functionName": { + "name": "shr", + "nativeSrc": "10836:3:23", + "nodeType": "YulIdentifier", + "src": "10836:3:23" + }, + "nativeSrc": "10836:12:23", + "nodeType": "YulFunctionCall", + "src": "10836:12:23" + }, + "variableNames": [ + { + "name": "length", + "nativeSrc": "10826:6:23", + "nodeType": "YulIdentifier", + "src": "10826:6:23" + } + ] + }, + { + "nativeSrc": "10857:38:23", + "nodeType": "YulVariableDeclaration", + "src": "10857:38:23", + "value": { + "arguments": [ + { + "name": "data", + "nativeSrc": "10887:4:23", + "nodeType": "YulIdentifier", + "src": "10887:4:23" + }, + { + "kind": "number", + "nativeSrc": "10893:1:23", + "nodeType": "YulLiteral", + "src": "10893:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "10883:3:23", + "nodeType": "YulIdentifier", + "src": "10883:3:23" + }, + "nativeSrc": "10883:12:23", + "nodeType": "YulFunctionCall", + "src": "10883:12:23" + }, + "variables": [ + { + "name": "outOfPlaceEncoding", + "nativeSrc": "10861:18:23", + "nodeType": "YulTypedName", + "src": "10861:18:23", + "type": "" + } + ] + }, + { + "body": { + "nativeSrc": "10934:31:23", + "nodeType": "YulBlock", + "src": "10934:31:23", + "statements": [ + { + "nativeSrc": "10936:27:23", + "nodeType": "YulAssignment", + "src": "10936:27:23", + "value": { + "arguments": [ + { + "name": "length", + "nativeSrc": "10950:6:23", + "nodeType": "YulIdentifier", + "src": "10950:6:23" + }, + { + "kind": "number", + "nativeSrc": "10958:4:23", + "nodeType": "YulLiteral", + "src": "10958:4:23", + "type": "", + "value": "0x7f" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "10946:3:23", + "nodeType": "YulIdentifier", + "src": "10946:3:23" + }, + "nativeSrc": "10946:17:23", + "nodeType": "YulFunctionCall", + "src": "10946:17:23" + }, + "variableNames": [ + { + "name": "length", + "nativeSrc": "10936:6:23", + "nodeType": "YulIdentifier", + "src": "10936:6:23" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nativeSrc": "10914:18:23", + "nodeType": "YulIdentifier", + "src": "10914:18:23" + } + ], + "functionName": { + "name": "iszero", + "nativeSrc": "10907:6:23", + "nodeType": "YulIdentifier", + "src": "10907:6:23" + }, + "nativeSrc": "10907:26:23", + "nodeType": "YulFunctionCall", + "src": "10907:26:23" + }, + "nativeSrc": "10904:61:23", + "nodeType": "YulIf", + "src": "10904:61:23" + }, + { + "body": { + "nativeSrc": "11024:111:23", + "nodeType": "YulBlock", + "src": "11024:111:23", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11045:1:23", + "nodeType": "YulLiteral", + "src": "11045:1:23", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11052:3:23", + "nodeType": "YulLiteral", + "src": "11052:3:23", + "type": "", + "value": "224" + }, + { + "kind": "number", + "nativeSrc": "11057:10:23", + "nodeType": "YulLiteral", + "src": "11057:10:23", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "11048:3:23", + "nodeType": "YulIdentifier", + "src": "11048:3:23" + }, + "nativeSrc": "11048:20:23", + "nodeType": "YulFunctionCall", + "src": "11048:20:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "11038:6:23", + "nodeType": "YulIdentifier", + "src": "11038:6:23" + }, + "nativeSrc": "11038:31:23", + "nodeType": "YulFunctionCall", + "src": "11038:31:23" + }, + "nativeSrc": "11038:31:23", + "nodeType": "YulExpressionStatement", + "src": "11038:31:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11089:1:23", + "nodeType": "YulLiteral", + "src": "11089:1:23", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nativeSrc": "11092:4:23", + "nodeType": "YulLiteral", + "src": "11092:4:23", + "type": "", + "value": "0x22" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "11082:6:23", + "nodeType": "YulIdentifier", + "src": "11082:6:23" + }, + "nativeSrc": "11082:15:23", + "nodeType": "YulFunctionCall", + "src": "11082:15:23" + }, + "nativeSrc": "11082:15:23", + "nodeType": "YulExpressionStatement", + "src": "11082:15:23" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11117:1:23", + "nodeType": "YulLiteral", + "src": "11117:1:23", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "11120:4:23", + "nodeType": "YulLiteral", + "src": "11120:4:23", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nativeSrc": "11110:6:23", + "nodeType": "YulIdentifier", + "src": "11110:6:23" + }, + "nativeSrc": "11110:15:23", + "nodeType": "YulFunctionCall", + "src": "11110:15:23" + }, + "nativeSrc": "11110:15:23", + "nodeType": "YulExpressionStatement", + "src": "11110:15:23" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nativeSrc": "10980:18:23", + "nodeType": "YulIdentifier", + "src": "10980:18:23" + }, + { + "arguments": [ + { + "name": "length", + "nativeSrc": "11003:6:23", + "nodeType": "YulIdentifier", + "src": "11003:6:23" + }, + { + "kind": "number", + "nativeSrc": "11011:2:23", + "nodeType": "YulLiteral", + "src": "11011:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "lt", + "nativeSrc": "11000:2:23", + "nodeType": "YulIdentifier", + "src": "11000:2:23" + }, + "nativeSrc": "11000:14:23", + "nodeType": "YulFunctionCall", + "src": "11000:14:23" + } + ], + "functionName": { + "name": "eq", + "nativeSrc": "10977:2:23", + "nodeType": "YulIdentifier", + "src": "10977:2:23" + }, + "nativeSrc": "10977:38:23", + "nodeType": "YulFunctionCall", + "src": "10977:38:23" + }, + "nativeSrc": "10974:161:23", + "nodeType": "YulIf", + "src": "10974:161:23" + } + ] + }, + "name": "extract_byte_array_length", + "nativeSrc": "10761:380:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "data", + "nativeSrc": "10796:4:23", + "nodeType": "YulTypedName", + "src": "10796:4:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "length", + "nativeSrc": "10805:6:23", + "nodeType": "YulTypedName", + "src": "10805:6:23", + "type": "" + } + ], + "src": "10761:380:23" + }, + { + "body": { + "nativeSrc": "11359:276:23", + "nodeType": "YulBlock", + "src": "11359:276:23", + "statements": [ + { + "nativeSrc": "11369:27:23", + "nodeType": "YulAssignment", + "src": "11369:27:23", + "value": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "11381:9:23", + "nodeType": "YulIdentifier", + "src": "11381:9:23" + }, + { + "kind": "number", + "nativeSrc": "11392:3:23", + "nodeType": "YulLiteral", + "src": "11392:3:23", + "type": "", + "value": "160" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "11377:3:23", + "nodeType": "YulIdentifier", + "src": "11377:3:23" + }, + "nativeSrc": "11377:19:23", + "nodeType": "YulFunctionCall", + "src": "11377:19:23" + }, + "variableNames": [ + { + "name": "tail", + "nativeSrc": "11369:4:23", + "nodeType": "YulIdentifier", + "src": "11369:4:23" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "11412:9:23", + "nodeType": "YulIdentifier", + "src": "11412:9:23" + }, + { + "name": "value0", + "nativeSrc": "11423:6:23", + "nodeType": "YulIdentifier", + "src": "11423:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "11405:6:23", + "nodeType": "YulIdentifier", + "src": "11405:6:23" + }, + "nativeSrc": "11405:25:23", + "nodeType": "YulFunctionCall", + "src": "11405:25:23" + }, + "nativeSrc": "11405:25:23", + "nodeType": "YulExpressionStatement", + "src": "11405:25:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "11450:9:23", + "nodeType": "YulIdentifier", + "src": "11450:9:23" + }, + { + "kind": "number", + "nativeSrc": "11461:2:23", + "nodeType": "YulLiteral", + "src": "11461:2:23", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "11446:3:23", + "nodeType": "YulIdentifier", + "src": "11446:3:23" + }, + "nativeSrc": "11446:18:23", + "nodeType": "YulFunctionCall", + "src": "11446:18:23" + }, + { + "name": "value1", + "nativeSrc": "11466:6:23", + "nodeType": "YulIdentifier", + "src": "11466:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "11439:6:23", + "nodeType": "YulIdentifier", + "src": "11439:6:23" + }, + "nativeSrc": "11439:34:23", + "nodeType": "YulFunctionCall", + "src": "11439:34:23" + }, + "nativeSrc": "11439:34:23", + "nodeType": "YulExpressionStatement", + "src": "11439:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "11493:9:23", + "nodeType": "YulIdentifier", + "src": "11493:9:23" + }, + { + "kind": "number", + "nativeSrc": "11504:2:23", + "nodeType": "YulLiteral", + "src": "11504:2:23", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "11489:3:23", + "nodeType": "YulIdentifier", + "src": "11489:3:23" + }, + "nativeSrc": "11489:18:23", + "nodeType": "YulFunctionCall", + "src": "11489:18:23" + }, + { + "name": "value2", + "nativeSrc": "11509:6:23", + "nodeType": "YulIdentifier", + "src": "11509:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "11482:6:23", + "nodeType": "YulIdentifier", + "src": "11482:6:23" + }, + "nativeSrc": "11482:34:23", + "nodeType": "YulFunctionCall", + "src": "11482:34:23" + }, + "nativeSrc": "11482:34:23", + "nodeType": "YulExpressionStatement", + "src": "11482:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "11536:9:23", + "nodeType": "YulIdentifier", + "src": "11536:9:23" + }, + { + "kind": "number", + "nativeSrc": "11547:2:23", + "nodeType": "YulLiteral", + "src": "11547:2:23", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "11532:3:23", + "nodeType": "YulIdentifier", + "src": "11532:3:23" + }, + "nativeSrc": "11532:18:23", + "nodeType": "YulFunctionCall", + "src": "11532:18:23" + }, + { + "name": "value3", + "nativeSrc": "11552:6:23", + "nodeType": "YulIdentifier", + "src": "11552:6:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "11525:6:23", + "nodeType": "YulIdentifier", + "src": "11525:6:23" + }, + "nativeSrc": "11525:34:23", + "nodeType": "YulFunctionCall", + "src": "11525:34:23" + }, + "nativeSrc": "11525:34:23", + "nodeType": "YulExpressionStatement", + "src": "11525:34:23" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nativeSrc": "11579:9:23", + "nodeType": "YulIdentifier", + "src": "11579:9:23" + }, + { + "kind": "number", + "nativeSrc": "11590:3:23", + "nodeType": "YulLiteral", + "src": "11590:3:23", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nativeSrc": "11575:3:23", + "nodeType": "YulIdentifier", + "src": "11575:3:23" + }, + "nativeSrc": "11575:19:23", + "nodeType": "YulFunctionCall", + "src": "11575:19:23" + }, + { + "arguments": [ + { + "name": "value4", + "nativeSrc": "11600:6:23", + "nodeType": "YulIdentifier", + "src": "11600:6:23" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nativeSrc": "11616:3:23", + "nodeType": "YulLiteral", + "src": "11616:3:23", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nativeSrc": "11621:1:23", + "nodeType": "YulLiteral", + "src": "11621:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nativeSrc": "11612:3:23", + "nodeType": "YulIdentifier", + "src": "11612:3:23" + }, + "nativeSrc": "11612:11:23", + "nodeType": "YulFunctionCall", + "src": "11612:11:23" + }, + { + "kind": "number", + "nativeSrc": "11625:1:23", + "nodeType": "YulLiteral", + "src": "11625:1:23", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nativeSrc": "11608:3:23", + "nodeType": "YulIdentifier", + "src": "11608:3:23" + }, + "nativeSrc": "11608:19:23", + "nodeType": "YulFunctionCall", + "src": "11608:19:23" + } + ], + "functionName": { + "name": "and", + "nativeSrc": "11596:3:23", + "nodeType": "YulIdentifier", + "src": "11596:3:23" + }, + "nativeSrc": "11596:32:23", + "nodeType": "YulFunctionCall", + "src": "11596:32:23" + } + ], + "functionName": { + "name": "mstore", + "nativeSrc": "11568:6:23", + "nodeType": "YulIdentifier", + "src": "11568:6:23" + }, + "nativeSrc": "11568:61:23", + "nodeType": "YulFunctionCall", + "src": "11568:61:23" + }, + "nativeSrc": "11568:61:23", + "nodeType": "YulExpressionStatement", + "src": "11568:61:23" + } + ] + }, + "name": "abi_encode_tuple_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__to_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__fromStack_reversed", + "nativeSrc": "11146:489:23", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nativeSrc": "11296:9:23", + "nodeType": "YulTypedName", + "src": "11296:9:23", + "type": "" + }, + { + "name": "value4", + "nativeSrc": "11307:6:23", + "nodeType": "YulTypedName", + "src": "11307:6:23", + "type": "" + }, + { + "name": "value3", + "nativeSrc": "11315:6:23", + "nodeType": "YulTypedName", + "src": "11315:6:23", + "type": "" + }, + { + "name": "value2", + "nativeSrc": "11323:6:23", + "nodeType": "YulTypedName", + "src": "11323:6:23", + "type": "" + }, + { + "name": "value1", + "nativeSrc": "11331:6:23", + "nodeType": "YulTypedName", + "src": "11331:6:23", + "type": "" + }, + { + "name": "value0", + "nativeSrc": "11339:6:23", + "nodeType": "YulTypedName", + "src": "11339:6:23", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nativeSrc": "11350:4:23", + "nodeType": "YulTypedName", + "src": "11350:4:23", + "type": "" + } + ], + "src": "11146:489:23" + } + ] + }, + "contents": "{\n { }\n function abi_decode_tuple_t_struct$_ExecuteParams_$8182_calldata_ptr(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n let offset := calldataload(headStart)\n if gt(offset, 0xffffffffffffffff) { revert(0, 0) }\n let _1 := add(headStart, offset)\n if slt(sub(dataEnd, _1), 448) { revert(0, 0) }\n value0 := _1\n }\n function abi_encode_tuple_t_address__to_t_address__fromStack_reversed(headStart, value0) -> tail\n {\n tail := add(headStart, 32)\n mstore(headStart, and(value0, sub(shl(160, 1), 1)))\n }\n function abi_encode_string(value, pos) -> end\n {\n let length := mload(value)\n mstore(pos, length)\n mcopy(add(pos, 0x20), add(value, 0x20), length)\n mstore(add(add(pos, length), 0x20), 0)\n end := add(add(pos, and(add(length, 31), not(31))), 0x20)\n }\n function abi_encode_tuple_t_bytes1_t_string_memory_ptr_t_string_memory_ptr_t_uint256_t_address_t_bytes32_t_array$_t_uint256_$dyn_memory_ptr__to_t_bytes1_t_string_memory_ptr_t_string_memory_ptr_t_uint256_t_address_t_bytes32_t_array$_t_uint256_$dyn_memory_ptr__fromStack_reversed(headStart, value6, value5, value4, value3, value2, value1, value0) -> tail\n {\n mstore(headStart, and(value0, shl(248, 255)))\n mstore(add(headStart, 32), 224)\n let tail_1 := abi_encode_string(value1, add(headStart, 224))\n mstore(add(headStart, 64), sub(tail_1, headStart))\n let tail_2 := abi_encode_string(value2, tail_1)\n mstore(add(headStart, 96), value3)\n mstore(add(headStart, 128), and(value4, sub(shl(160, 1), 1)))\n mstore(add(headStart, 160), value5)\n mstore(add(headStart, 192), sub(tail_2, headStart))\n let pos := tail_2\n let length := mload(value6)\n mstore(tail_2, length)\n pos := add(tail_2, 32)\n let srcPtr := add(value6, 32)\n let i := 0\n for { } lt(i, length) { i := add(i, 1) }\n {\n mstore(pos, mload(srcPtr))\n pos := add(pos, 32)\n srcPtr := add(srcPtr, 32)\n }\n tail := pos\n }\n function abi_decode_address(offset) -> value\n {\n value := calldataload(offset)\n if iszero(eq(value, and(value, sub(shl(160, 1), 1)))) { revert(0, 0) }\n }\n function abi_decode_tuple_t_addresst_uint256(headStart, dataEnd) -> value0, value1\n {\n if slt(sub(dataEnd, headStart), 64) { revert(0, 0) }\n value0 := abi_decode_address(headStart)\n let value := 0\n value := calldataload(add(headStart, 32))\n value1 := value\n }\n function abi_encode_tuple_t_bool__to_t_bool__fromStack_reversed(headStart, value0) -> tail\n {\n tail := add(headStart, 32)\n mstore(headStart, iszero(iszero(value0)))\n }\n function abi_decode_tuple_t_uint256(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n let value := 0\n value := calldataload(headStart)\n value0 := value\n }\n function abi_decode_tuple_t_address(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n value0 := abi_decode_address(headStart)\n }\n function abi_encode_tuple_t_stringliteral_110461b12e459dc76e692e7a47f9621cf45c7d48020c3c7b2066107cdf1f52ae__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 13)\n mstore(add(headStart, 64), \"Invalid owner\")\n tail := add(headStart, 96)\n }\n function abi_encode_tuple_t_stringliteral_5e70ebd1d4072d337a7fabaa7bda70fa2633d6e3f89d5cb725a16b10d07e54c6__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 13)\n mstore(add(headStart, 64), \"Invalid token\")\n tail := add(headStart, 96)\n }\n function abi_encode_tuple_t_stringliteral_15d72127d094a30af360ead73641c61eda3d745ce4d04d12675a5e9a899f8b21__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 10)\n mstore(add(headStart, 64), \"Nonce used\")\n tail := add(headStart, 96)\n }\n function abi_encode_tuple_t_stringliteral_27859e47e6c2167c8e8d38addfca16b9afb9d8e9750b6a1e67c29196d4d99fae__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 15)\n mstore(add(headStart, 64), \"Payload expired\")\n tail := add(headStart, 96)\n }\n function access_calldata_tail_t_bytes_calldata_ptr(base_ref, ptr_to_tail) -> addr, length\n {\n let rel_offset_of_tail := calldataload(ptr_to_tail)\n if iszero(slt(rel_offset_of_tail, add(sub(calldatasize(), base_ref), not(30)))) { revert(0, 0) }\n let addr_1 := add(base_ref, rel_offset_of_tail)\n length := calldataload(addr_1)\n if gt(length, 0xffffffffffffffff) { revert(0, 0) }\n addr := add(addr_1, 0x20)\n if sgt(addr, sub(calldatasize(), length)) { revert(0, 0) }\n }\n function abi_decode_tuple_t_uint8(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n let value := calldataload(headStart)\n if iszero(eq(value, and(value, 0xff))) { revert(0, 0) }\n value0 := value\n }\n function abi_encode_tuple_t_stringliteral_31734eed34fab74fa1579246aaad104a344891a284044483c0c5a792a9f83a72__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 11)\n mstore(add(headStart, 64), \"Invalid sig\")\n tail := add(headStart, 96)\n }\n function abi_encode_tuple_t_stringliteral_a793dc5bde52ab2d5349f1208a34905b1d68ab9298f549a2e514542cba0a8c76__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 28)\n mstore(add(headStart, 64), \"Incorrect ETH value provided\")\n tail := add(headStart, 96)\n }\n function abi_encode_tuple_t_stringliteral_066ad49a0ed9e5d6a9f3c20fca13a038f0a5d629f0aaf09d634ae2a7c232ac2b__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 11)\n mstore(add(headStart, 64), \"Call failed\")\n tail := add(headStart, 96)\n }\n function abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed(headStart, value0) -> tail\n {\n tail := add(headStart, 32)\n mstore(headStart, value0)\n }\n function panic_error_0x41()\n {\n mstore(0, shl(224, 0x4e487b71))\n mstore(4, 0x41)\n revert(0, 0x24)\n }\n function abi_encode_tuple_packed_t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470__to_t_bytes_memory_ptr__nonPadded_inplace_fromStack_reversed(pos) -> end\n { end := pos }\n function abi_encode_tuple_t_stringliteral_c7c2be2f1b63a3793f6e2d447ce95ba2239687186a7fd6b5268a969dcdb42dcd__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 19)\n mstore(add(headStart, 64), \"ETH transfer failed\")\n tail := add(headStart, 96)\n }\n function abi_encode_tuple_t_bytes32_t_address_t_address_t_address_t_uint256_t_bytes32_t_uint256_t_uint256_t_uint256__to_t_bytes32_t_address_t_address_t_address_t_uint256_t_bytes32_t_uint256_t_uint256_t_uint256__fromStack_reversed(headStart, value8, value7, value6, value5, value4, value3, value2, value1, value0) -> tail\n {\n tail := add(headStart, 288)\n mstore(headStart, value0)\n mstore(add(headStart, 32), and(value1, sub(shl(160, 1), 1)))\n mstore(add(headStart, 64), and(value2, sub(shl(160, 1), 1)))\n mstore(add(headStart, 96), and(value3, sub(shl(160, 1), 1)))\n mstore(add(headStart, 128), value4)\n mstore(add(headStart, 160), value5)\n mstore(add(headStart, 192), value6)\n mstore(add(headStart, 224), value7)\n mstore(add(headStart, 256), value8)\n }\n function abi_encode_tuple_t_address_t_address_t_uint256_t_uint256_t_uint8_t_bytes32_t_bytes32__to_t_address_t_address_t_uint256_t_uint256_t_uint8_t_bytes32_t_bytes32__fromStack_reversed(headStart, value6, value5, value4, value3, value2, value1, value0) -> tail\n {\n tail := add(headStart, 224)\n mstore(headStart, and(value0, sub(shl(160, 1), 1)))\n mstore(add(headStart, 32), and(value1, sub(shl(160, 1), 1)))\n mstore(add(headStart, 64), value2)\n mstore(add(headStart, 96), value3)\n mstore(add(headStart, 128), and(value4, 0xff))\n mstore(add(headStart, 160), value5)\n mstore(add(headStart, 192), value6)\n }\n function abi_encode_tuple_t_address_t_address__to_t_address_t_address__fromStack_reversed(headStart, value1, value0) -> tail\n {\n tail := add(headStart, 64)\n mstore(headStart, and(value0, sub(shl(160, 1), 1)))\n mstore(add(headStart, 32), and(value1, sub(shl(160, 1), 1)))\n }\n function abi_decode_tuple_t_uint256_fromMemory(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n value0 := mload(headStart)\n }\n function abi_encode_tuple_t_stringliteral_0acc7f0c8df1a6717d2b423ae4591ac135687015764ac37dd4cf0150a9322b15__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 40)\n mstore(add(headStart, 64), \"Permit failed and insufficient a\")\n mstore(add(headStart, 96), \"llowance\")\n tail := add(headStart, 128)\n }\n function abi_encode_tuple_packed_t_bytes_memory_ptr__to_t_bytes_memory_ptr__nonPadded_inplace_fromStack_reversed(pos, value0) -> end\n {\n let length := mload(value0)\n mcopy(pos, add(value0, 0x20), length)\n let _1 := add(pos, length)\n mstore(_1, 0)\n end := _1\n }\n function abi_encode_tuple_t_bytes32_t_uint8_t_bytes32_t_bytes32__to_t_bytes32_t_uint8_t_bytes32_t_bytes32__fromStack_reversed(headStart, value3, value2, value1, value0) -> tail\n {\n tail := add(headStart, 128)\n mstore(headStart, value0)\n mstore(add(headStart, 32), and(value1, 0xff))\n mstore(add(headStart, 64), value2)\n mstore(add(headStart, 96), value3)\n }\n function panic_error_0x21()\n {\n mstore(0, shl(224, 0x4e487b71))\n mstore(4, 0x21)\n revert(0, 0x24)\n }\n function abi_encode_tuple_t_bytes32__to_t_bytes32__fromStack_reversed(headStart, value0) -> tail\n {\n tail := add(headStart, 32)\n mstore(headStart, value0)\n }\n function extract_byte_array_length(data) -> length\n {\n length := shr(1, data)\n let outOfPlaceEncoding := and(data, 1)\n if iszero(outOfPlaceEncoding) { length := and(length, 0x7f) }\n if eq(outOfPlaceEncoding, lt(length, 32))\n {\n mstore(0, shl(224, 0x4e487b71))\n mstore(4, 0x22)\n revert(0, 0x24)\n }\n }\n function abi_encode_tuple_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__to_t_bytes32_t_bytes32_t_bytes32_t_uint256_t_address__fromStack_reversed(headStart, value4, value3, value2, value1, value0) -> tail\n {\n tail := add(headStart, 160)\n mstore(headStart, value0)\n mstore(add(headStart, 32), value1)\n mstore(add(headStart, 64), value2)\n mstore(add(headStart, 96), value3)\n mstore(add(headStart, 128), and(value4, sub(shl(160, 1), 1)))\n }\n}", + "id": 23, + "language": "Yul", + "name": "#utility.yul" + } + ], + "immutableReferences": { + "4158": [ + { + "length": 32, + "start": 4419 + } + ], + "4160": [ + { + "length": 32, + "start": 4377 + } + ], + "4162": [ + { + "length": 32, + "start": 4335 + } + ], + "4164": [ + { + "length": 32, + "start": 4500 + } + ], + "4166": [ + { + "length": 32, + "start": 4540 + } + ], + "4169": [ + { + "length": 32, + "start": 3323 + } + ], + "4172": [ + { + "length": 32, + "start": 3373 + } + ], + "8147": [ + { + "length": 32, + "start": 215 + }, + { + "length": 32, + "start": 1317 + }, + { + "length": 32, + "start": 1524 + }, + { + "length": 32, + "start": 2384 + }, + { + "length": 32, + "start": 3064 + } + ] + }, + "linkReferences": {}, + "object": "608060405260043610610092575f3560e01c80639e281a98116100575780639e281a9814610159578063d850124e14610178578063dcb79457146101c1578063f14210a6146101e0578063f2fde38b146101ff575f5ffd5b80632af83bfe1461009d578063715018a6146100b257806375bd6863146100c657806384b0196e146101165780638da5cb5b1461013d575f5ffd5b3661009957005b5f5ffd5b6100b06100ab3660046112dd565b61021e565b005b3480156100bd575f5ffd5b506100b06106ae565b3480156100d1575f5ffd5b506100f97f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b348015610121575f5ffd5b5061012a6106c1565b60405161010d979695949392919061134a565b348015610148575f5ffd5b505f546001600160a01b03166100f9565b348015610164575f5ffd5b506100b06101733660046113fb565b610703565b348015610183575f5ffd5b506101b16101923660046113fb565b600360209081525f928352604080842090915290825290205460ff1681565b604051901515815260200161010d565b3480156101cc575f5ffd5b506101b16101db3660046113fb565b61078b565b3480156101eb575f5ffd5b506100b06101fa366004611423565b6107b8565b34801561020a575f5ffd5b506100b061021936600461143a565b6108a7565b6102266108e1565b5f610237604083016020840161143a565b90506101208201356001600160a01b03821661028a5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21037bbb732b960991b60448201526064015b60405180910390fd5b5f610298602085018561143a565b6001600160a01b0316036102de5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2103a37b5b2b760991b6044820152606401610281565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff161561033e5760405162461bcd60e51b815260206004820152600a602482015269139bdb98d9481d5cd95960b21b6044820152606401610281565b8261014001354211156103855760405162461bcd60e51b815260206004820152600f60248201526e14185e5b1bd85908195e1c1a5c9959608a1b6044820152606401610281565b5f6103ee83610397602087018761143a565b60408701356103a960e0890189611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250505050610100890135876101408b013561090f565b90506001600160a01b038316610421826104106101808801610160890161149d565b876101800135886101a001356109db565b6001600160a01b0316146104655760405162461bcd60e51b815260206004820152600b60248201526a496e76616c69642073696760a81b6044820152606401610281565b83610100013534146104b95760405162461bcd60e51b815260206004820152601c60248201527f496e636f7272656374204554482076616c75652070726f7669646564000000006044820152606401610281565b6001600160a01b0383165f9081526003602090815260408083208584528252909120805460ff19166001179055610520906104f69086018661143a565b846040870135606088013561051160a08a0160808b0161149d565b8960a001358a60c00135610a07565b6105667f00000000000000000000000000000000000000000000000000000000000000006040860135610556602088018861143a565b6001600160a01b03169190610b75565b5f6105b261057760e0870187611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250349250610bf4915050565b9050806105ef5760405162461bcd60e51b815260206004820152600b60248201526a10d85b1b0819985a5b195960aa1b6044820152606401610281565b6106217f00000000000000000000000000000000000000000000000000000000000000005f610556602089018961143a565b61062e602086018661143a565b6001600160a01b0316846001600160a01b03167f78129a649632642d8e9f346c85d9efb70d32d50a36774c4585491a9228bbd350876040013560405161067691815260200190565b60405180910390a3505050506106ab60017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b50565b6106b6610c79565b6106bf5f610ca5565b565b5f6060805f5f5f60606106d2610cf4565b6106da610d26565b604080515f80825260208201909252600f60f81b9b939a50919850469750309650945092509050565b61070b610c79565b61073061071f5f546001600160a01b031690565b6001600160a01b0384169083610d53565b5f546001600160a01b03166001600160a01b0316826001600160a01b03167fa0524ee0fd8662d6c046d199da2a6d3dc49445182cec055873a5bb9c2843c8e08360405161077f91815260200190565b60405180910390a35050565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff165b92915050565b6107c0610c79565b5f80546040516001600160a01b039091169083908381818185875af1925050503d805f811461080a576040519150601f19603f3d011682016040523d82523d5f602084013e61080f565b606091505b50509050806108565760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610281565b5f546001600160a01b03166001600160a01b03167f6148672a948a12b8e0bf92a9338349b9ac890fad62a234abaf0a4da99f62cfcc8360405161089b91815260200190565b60405180910390a25050565b6108af610c79565b6001600160a01b0381166108d857604051631e4fbdf760e01b81525f6004820152602401610281565b6106ab81610ca5565b6108e9610d60565b60027f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b8351602080860191909120604080517ff0543e2024fd0ae16ccb842686c2733758ec65acfd69fb599c05b286f8db8844938101939093526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691840191909152808a1660608401528816608083015260a0820187905260c082015260e08101849052610100810183905261012081018290525f906109cf906101400160405160208183030381529060405280519060200120610da2565b98975050505050505050565b5f5f5f5f6109eb88888888610dce565b9250925092506109fb8282610e96565b50909695505050505050565b60405163d505accf60e01b81526001600160a01b038781166004830152306024830152604482018790526064820186905260ff8516608483015260a4820184905260c4820183905288169063d505accf9060e4015f604051808303815f87803b158015610a72575f5ffd5b505af1925050508015610a83575060015b610b5757604051636eb1769f60e11b81526001600160a01b03878116600483015230602483015286919089169063dd62ed3e90604401602060405180830381865afa158015610ad4573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610af891906114bd565b1015610b575760405162461bcd60e51b815260206004820152602860248201527f5065726d6974206661696c656420616e6420696e73756666696369656e7420616044820152676c6c6f77616e636560c01b6064820152608401610281565b610b6c6001600160a01b038816873088610f52565b50505050505050565b610b818383835f610f8e565b610bef57610b9283835f6001610f8e565b610bba57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b610bc78383836001610f8e565b610bef57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b505050565b5f5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168385604051610c2f91906114d4565b5f6040518083038185875af1925050503d805f8114610c69576040519150601f19603f3d011682016040523d82523d5f602084013e610c6e565b606091505b509095945050505050565b5f546001600160a01b031633146106bf5760405163118cdaa760e01b8152336004820152602401610281565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006001610ff0565b905090565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006002610ff0565b610bc78383836001611099565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00546002036106bf57604051633ee5aeb560e01b815260040160405180910390fd5b5f6107b2610dae6110e3565b8360405161190160f01b8152600281019290925260228201526042902090565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115610e0757505f91506003905082610e8c565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015610e58573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b038116610e8357505f925060019150829050610e8c565b92505f91508190505b9450945094915050565b5f826003811115610ea957610ea96114ea565b03610eb2575050565b6001826003811115610ec657610ec66114ea565b03610ee45760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115610ef857610ef86114ea565b03610f195760405163fce698f760e01b815260048101829052602401610281565b6003826003811115610f2d57610f2d6114ea565b03610f4e576040516335e2f38360e21b815260048101829052602401610281565b5050565b610f6084848484600161120c565b610f8857604051635274afe760e01b81526001600160a01b0385166004820152602401610281565b50505050565b60405163095ea7b360e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f873b113d1516831692505b60405250949350505050565b606060ff831461100a5761100383611279565b90506107b2565b818054611016906114fe565b80601f0160208091040260200160405190810160405280929190818152602001828054611042906114fe565b801561108d5780601f106110645761010080835404028352916020019161108d565b820191905f5260205f20905b81548152906001019060200180831161107057829003601f168201915b505050505090506107b2565b60405163a9059cbb60e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561113b57507f000000000000000000000000000000000000000000000000000000000000000046145b1561116557507f000000000000000000000000000000000000000000000000000000000000000090565b610d21604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b6040516323b872dd60e01b5f8181526001600160a01b038781166004528616602452604485905291602083606481808c5af1925060015f5114831661126857838315161561125c573d5f823e3d81fd5b5f883b113d1516831692505b604052505f60605295945050505050565b60605f611285836112b6565b6040805160208082528183019092529192505f91906020820181803683375050509182525060208101929092525090565b5f60ff8216601f8111156107b257604051632cd44ac360e21b815260040160405180910390fd5b5f602082840312156112ed575f5ffd5b813567ffffffffffffffff811115611303575f5ffd5b82016101c08185031215611315575f5ffd5b9392505050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b60ff60f81b8816815260e060208201525f61136860e083018961131c565b828103604084015261137a818961131c565b606084018890526001600160a01b038716608085015260a0840186905283810360c0850152845180825260208087019350909101905f5b818110156113cf5783518352602093840193909201916001016113b1565b50909b9a5050505050505050505050565b80356001600160a01b03811681146113f6575f5ffd5b919050565b5f5f6040838503121561140c575f5ffd5b611415836113e0565b946020939093013593505050565b5f60208284031215611433575f5ffd5b5035919050565b5f6020828403121561144a575f5ffd5b611315826113e0565b5f5f8335601e19843603018112611468575f5ffd5b83018035915067ffffffffffffffff821115611482575f5ffd5b602001915036819003821315611496575f5ffd5b9250929050565b5f602082840312156114ad575f5ffd5b813560ff81168114611315575f5ffd5b5f602082840312156114cd575f5ffd5b5051919050565b5f82518060208501845e5f920191825250919050565b634e487b7160e01b5f52602160045260245ffd5b600181811c9082168061151257607f821691505b60208210810361153057634e487b7160e01b5f52602260045260245ffd5b5091905056fea26469706673582212209c34db2f6f83af136a5340cce7fe8ef554ea8eb633656fbf9bff3bd731aec40f64736f6c634300081c0033", + "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x92 JUMPI PUSH0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x9E281A98 GT PUSH2 0x57 JUMPI DUP1 PUSH4 0x9E281A98 EQ PUSH2 0x159 JUMPI DUP1 PUSH4 0xD850124E EQ PUSH2 0x178 JUMPI DUP1 PUSH4 0xDCB79457 EQ PUSH2 0x1C1 JUMPI DUP1 PUSH4 0xF14210A6 EQ PUSH2 0x1E0 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x1FF JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP1 PUSH4 0x2AF83BFE EQ PUSH2 0x9D JUMPI DUP1 PUSH4 0x715018A6 EQ PUSH2 0xB2 JUMPI DUP1 PUSH4 0x75BD6863 EQ PUSH2 0xC6 JUMPI DUP1 PUSH4 0x84B0196E EQ PUSH2 0x116 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x13D JUMPI PUSH0 PUSH0 REVERT JUMPDEST CALLDATASIZE PUSH2 0x99 JUMPI STOP JUMPDEST PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0xB0 PUSH2 0xAB CALLDATASIZE PUSH1 0x4 PUSH2 0x12DD JUMP JUMPDEST PUSH2 0x21E JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xBD JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xB0 PUSH2 0x6AE JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xD1 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xF9 PUSH32 0x0 DUP2 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP2 AND DUP2 MSTORE PUSH1 0x20 ADD JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x121 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x12A PUSH2 0x6C1 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x10D SWAP8 SWAP7 SWAP6 SWAP5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x134A JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x148 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH2 0xF9 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x164 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xB0 PUSH2 0x173 CALLDATASIZE PUSH1 0x4 PUSH2 0x13FB JUMP JUMPDEST PUSH2 0x703 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x183 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x1B1 PUSH2 0x192 CALLDATASIZE PUSH1 0x4 PUSH2 0x13FB JUMP JUMPDEST PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x40 MLOAD SWAP1 ISZERO ISZERO DUP2 MSTORE PUSH1 0x20 ADD PUSH2 0x10D JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1CC JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0x1B1 PUSH2 0x1DB CALLDATASIZE PUSH1 0x4 PUSH2 0x13FB JUMP JUMPDEST PUSH2 0x78B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1EB JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xB0 PUSH2 0x1FA CALLDATASIZE PUSH1 0x4 PUSH2 0x1423 JUMP JUMPDEST PUSH2 0x7B8 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x20A JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP PUSH2 0xB0 PUSH2 0x219 CALLDATASIZE PUSH1 0x4 PUSH2 0x143A JUMP JUMPDEST PUSH2 0x8A7 JUMP JUMPDEST PUSH2 0x226 PUSH2 0x8E1 JUMP JUMPDEST PUSH0 PUSH2 0x237 PUSH1 0x40 DUP4 ADD PUSH1 0x20 DUP5 ADD PUSH2 0x143A JUMP JUMPDEST SWAP1 POP PUSH2 0x120 DUP3 ADD CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP3 AND PUSH2 0x28A JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xD PUSH1 0x24 DUP3 ADD MSTORE PUSH13 0x24B73B30B634B21037BBB732B9 PUSH1 0x99 SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH0 PUSH2 0x298 PUSH1 0x20 DUP6 ADD DUP6 PUSH2 0x143A JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND SUB PUSH2 0x2DE JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xD PUSH1 0x24 DUP3 ADD MSTORE PUSH13 0x24B73B30B634B2103A37B5B2B7 PUSH1 0x99 SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP3 AND PUSH0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP5 DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x33E JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xA PUSH1 0x24 DUP3 ADD MSTORE PUSH10 0x139BDB98D9481D5CD959 PUSH1 0xB2 SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST DUP3 PUSH2 0x140 ADD CALLDATALOAD TIMESTAMP GT ISZERO PUSH2 0x385 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xF PUSH1 0x24 DUP3 ADD MSTORE PUSH15 0x14185E5B1BD85908195E1C1A5C9959 PUSH1 0x8A SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH0 PUSH2 0x3EE DUP4 PUSH2 0x397 PUSH1 0x20 DUP8 ADD DUP8 PUSH2 0x143A JUMP JUMPDEST PUSH1 0x40 DUP8 ADD CALLDATALOAD PUSH2 0x3A9 PUSH1 0xE0 DUP10 ADD DUP10 PUSH2 0x1453 JUMP JUMPDEST DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY PUSH0 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP POP POP POP PUSH2 0x100 DUP10 ADD CALLDATALOAD DUP8 PUSH2 0x140 DUP12 ADD CALLDATALOAD PUSH2 0x90F JUMP JUMPDEST SWAP1 POP PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP4 AND PUSH2 0x421 DUP3 PUSH2 0x410 PUSH2 0x180 DUP9 ADD PUSH2 0x160 DUP10 ADD PUSH2 0x149D JUMP JUMPDEST DUP8 PUSH2 0x180 ADD CALLDATALOAD DUP9 PUSH2 0x1A0 ADD CALLDATALOAD PUSH2 0x9DB JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND EQ PUSH2 0x465 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xB PUSH1 0x24 DUP3 ADD MSTORE PUSH11 0x496E76616C696420736967 PUSH1 0xA8 SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST DUP4 PUSH2 0x100 ADD CALLDATALOAD CALLVALUE EQ PUSH2 0x4B9 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1C PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x496E636F7272656374204554482076616C75652070726F766964656400000000 PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP4 AND PUSH0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP6 DUP5 MSTORE DUP3 MSTORE SWAP1 SWAP2 KECCAK256 DUP1 SLOAD PUSH1 0xFF NOT AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0x520 SWAP1 PUSH2 0x4F6 SWAP1 DUP7 ADD DUP7 PUSH2 0x143A JUMP JUMPDEST DUP5 PUSH1 0x40 DUP8 ADD CALLDATALOAD PUSH1 0x60 DUP9 ADD CALLDATALOAD PUSH2 0x511 PUSH1 0xA0 DUP11 ADD PUSH1 0x80 DUP12 ADD PUSH2 0x149D JUMP JUMPDEST DUP10 PUSH1 0xA0 ADD CALLDATALOAD DUP11 PUSH1 0xC0 ADD CALLDATALOAD PUSH2 0xA07 JUMP JUMPDEST PUSH2 0x566 PUSH32 0x0 PUSH1 0x40 DUP7 ADD CALLDATALOAD PUSH2 0x556 PUSH1 0x20 DUP9 ADD DUP9 PUSH2 0x143A JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND SWAP2 SWAP1 PUSH2 0xB75 JUMP JUMPDEST PUSH0 PUSH2 0x5B2 PUSH2 0x577 PUSH1 0xE0 DUP8 ADD DUP8 PUSH2 0x1453 JUMP JUMPDEST DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY PUSH0 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP CALLVALUE SWAP3 POP PUSH2 0xBF4 SWAP2 POP POP JUMP JUMPDEST SWAP1 POP DUP1 PUSH2 0x5EF JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xB PUSH1 0x24 DUP3 ADD MSTORE PUSH11 0x10D85B1B0819985A5B1959 PUSH1 0xAA SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH2 0x621 PUSH32 0x0 PUSH0 PUSH2 0x556 PUSH1 0x20 DUP10 ADD DUP10 PUSH2 0x143A JUMP JUMPDEST PUSH2 0x62E PUSH1 0x20 DUP7 ADD DUP7 PUSH2 0x143A JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP5 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH32 0x78129A649632642D8E9F346C85D9EFB70D32D50A36774C4585491A9228BBD350 DUP8 PUSH1 0x40 ADD CALLDATALOAD PUSH1 0x40 MLOAD PUSH2 0x676 SWAP2 DUP2 MSTORE PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP POP POP PUSH2 0x6AB PUSH1 0x1 PUSH32 0x9B779B17422D0DF92223018B32B4D1FA46E071723D6817E2486D003BECC55F00 SSTORE JUMP JUMPDEST POP JUMP JUMPDEST PUSH2 0x6B6 PUSH2 0xC79 JUMP JUMPDEST PUSH2 0x6BF PUSH0 PUSH2 0xCA5 JUMP JUMPDEST JUMP JUMPDEST PUSH0 PUSH1 0x60 DUP1 PUSH0 PUSH0 PUSH0 PUSH1 0x60 PUSH2 0x6D2 PUSH2 0xCF4 JUMP JUMPDEST PUSH2 0x6DA PUSH2 0xD26 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH0 DUP1 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 SWAP3 MSTORE PUSH1 0xF PUSH1 0xF8 SHL SWAP12 SWAP4 SWAP11 POP SWAP2 SWAP9 POP CHAINID SWAP8 POP ADDRESS SWAP7 POP SWAP5 POP SWAP3 POP SWAP1 POP JUMP JUMPDEST PUSH2 0x70B PUSH2 0xC79 JUMP JUMPDEST PUSH2 0x730 PUSH2 0x71F PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND SWAP1 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP5 AND SWAP1 DUP4 PUSH2 0xD53 JUMP JUMPDEST PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP3 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH32 0xA0524EE0FD8662D6C046D199DA2A6D3DC49445182CEC055873A5BB9C2843C8E0 DUP4 PUSH1 0x40 MLOAD PUSH2 0x77F SWAP2 DUP2 MSTORE PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP3 AND PUSH0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP5 DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x7C0 PUSH2 0xC79 JUMP JUMPDEST PUSH0 DUP1 SLOAD PUSH1 0x40 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB SWAP1 SWAP2 AND SWAP1 DUP4 SWAP1 DUP4 DUP2 DUP2 DUP2 DUP6 DUP8 GAS CALL SWAP3 POP POP POP RETURNDATASIZE DUP1 PUSH0 DUP2 EQ PUSH2 0x80A JUMPI PUSH1 0x40 MLOAD SWAP2 POP PUSH1 0x1F NOT PUSH1 0x3F RETURNDATASIZE ADD AND DUP3 ADD PUSH1 0x40 MSTORE RETURNDATASIZE DUP3 MSTORE RETURNDATASIZE PUSH0 PUSH1 0x20 DUP5 ADD RETURNDATACOPY PUSH2 0x80F JUMP JUMPDEST PUSH1 0x60 SWAP2 POP JUMPDEST POP POP SWAP1 POP DUP1 PUSH2 0x856 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH19 0x115512081D1C985B9CD9995C8819985A5B1959 PUSH1 0x6A SHL PUSH1 0x44 DUP3 ADD MSTORE PUSH1 0x64 ADD PUSH2 0x281 JUMP JUMPDEST PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND PUSH32 0x6148672A948A12B8E0BF92A9338349B9AC890FAD62A234ABAF0A4DA99F62CFCC DUP4 PUSH1 0x40 MLOAD PUSH2 0x89B SWAP2 DUP2 MSTORE PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 POP POP JUMP JUMPDEST PUSH2 0x8AF PUSH2 0xC79 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND PUSH2 0x8D8 JUMPI PUSH1 0x40 MLOAD PUSH4 0x1E4FBDF7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH0 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST PUSH2 0x6AB DUP2 PUSH2 0xCA5 JUMP JUMPDEST PUSH2 0x8E9 PUSH2 0xD60 JUMP JUMPDEST PUSH1 0x2 PUSH32 0x9B779B17422D0DF92223018B32B4D1FA46E071723D6817E2486D003BECC55F00 SSTORE JUMP JUMPDEST DUP4 MLOAD PUSH1 0x20 DUP1 DUP7 ADD SWAP2 SWAP1 SWAP2 KECCAK256 PUSH1 0x40 DUP1 MLOAD PUSH32 0xF0543E2024FD0AE16CCB842686C2733758EC65ACFD69FB599C05B286F8DB8844 SWAP4 DUP2 ADD SWAP4 SWAP1 SWAP4 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB PUSH32 0x0 DUP2 AND SWAP2 DUP5 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP1 DUP11 AND PUSH1 0x60 DUP5 ADD MSTORE DUP9 AND PUSH1 0x80 DUP4 ADD MSTORE PUSH1 0xA0 DUP3 ADD DUP8 SWAP1 MSTORE PUSH1 0xC0 DUP3 ADD MSTORE PUSH1 0xE0 DUP2 ADD DUP5 SWAP1 MSTORE PUSH2 0x100 DUP2 ADD DUP4 SWAP1 MSTORE PUSH2 0x120 DUP2 ADD DUP3 SWAP1 MSTORE PUSH0 SWAP1 PUSH2 0x9CF SWAP1 PUSH2 0x140 ADD PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 DUP4 SUB SUB DUP2 MSTORE SWAP1 PUSH1 0x40 MSTORE DUP1 MLOAD SWAP1 PUSH1 0x20 ADD KECCAK256 PUSH2 0xDA2 JUMP JUMPDEST SWAP9 SWAP8 POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH0 PUSH0 PUSH0 PUSH0 PUSH2 0x9EB DUP9 DUP9 DUP9 DUP9 PUSH2 0xDCE JUMP JUMPDEST SWAP3 POP SWAP3 POP SWAP3 POP PUSH2 0x9FB DUP3 DUP3 PUSH2 0xE96 JUMP JUMPDEST POP SWAP1 SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH4 0xD505ACCF PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP8 DUP2 AND PUSH1 0x4 DUP4 ADD MSTORE ADDRESS PUSH1 0x24 DUP4 ADD MSTORE PUSH1 0x44 DUP3 ADD DUP8 SWAP1 MSTORE PUSH1 0x64 DUP3 ADD DUP7 SWAP1 MSTORE PUSH1 0xFF DUP6 AND PUSH1 0x84 DUP4 ADD MSTORE PUSH1 0xA4 DUP3 ADD DUP5 SWAP1 MSTORE PUSH1 0xC4 DUP3 ADD DUP4 SWAP1 MSTORE DUP9 AND SWAP1 PUSH4 0xD505ACCF SWAP1 PUSH1 0xE4 ADD PUSH0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0xA72 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP GAS CALL SWAP3 POP POP POP DUP1 ISZERO PUSH2 0xA83 JUMPI POP PUSH1 0x1 JUMPDEST PUSH2 0xB57 JUMPI PUSH1 0x40 MLOAD PUSH4 0x6EB1769F PUSH1 0xE1 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP8 DUP2 AND PUSH1 0x4 DUP4 ADD MSTORE ADDRESS PUSH1 0x24 DUP4 ADD MSTORE DUP7 SWAP2 SWAP1 DUP10 AND SWAP1 PUSH4 0xDD62ED3E SWAP1 PUSH1 0x44 ADD PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP7 GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0xAD4 JUMPI RETURNDATASIZE PUSH0 PUSH0 RETURNDATACOPY RETURNDATASIZE PUSH0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0xAF8 SWAP2 SWAP1 PUSH2 0x14BD JUMP JUMPDEST LT ISZERO PUSH2 0xB57 JUMPI PUSH1 0x40 MLOAD PUSH3 0x461BCD PUSH1 0xE5 SHL DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x28 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5065726D6974206661696C656420616E6420696E73756666696369656E742061 PUSH1 0x44 DUP3 ADD MSTORE PUSH8 0x6C6C6F77616E6365 PUSH1 0xC0 SHL PUSH1 0x64 DUP3 ADD MSTORE PUSH1 0x84 ADD PUSH2 0x281 JUMP JUMPDEST PUSH2 0xB6C PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP9 AND DUP8 ADDRESS DUP9 PUSH2 0xF52 JUMP JUMPDEST POP POP POP POP POP POP POP JUMP JUMPDEST PUSH2 0xB81 DUP4 DUP4 DUP4 PUSH0 PUSH2 0xF8E JUMP JUMPDEST PUSH2 0xBEF JUMPI PUSH2 0xB92 DUP4 DUP4 PUSH0 PUSH1 0x1 PUSH2 0xF8E JUMP JUMPDEST PUSH2 0xBBA JUMPI PUSH1 0x40 MLOAD PUSH4 0x5274AFE7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP5 AND PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST PUSH2 0xBC7 DUP4 DUP4 DUP4 PUSH1 0x1 PUSH2 0xF8E JUMP JUMPDEST PUSH2 0xBEF JUMPI PUSH1 0x40 MLOAD PUSH4 0x5274AFE7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP5 AND PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST POP POP POP JUMP JUMPDEST PUSH0 PUSH0 PUSH32 0x0 PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND DUP4 DUP6 PUSH1 0x40 MLOAD PUSH2 0xC2F SWAP2 SWAP1 PUSH2 0x14D4 JUMP JUMPDEST PUSH0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 DUP8 GAS CALL SWAP3 POP POP POP RETURNDATASIZE DUP1 PUSH0 DUP2 EQ PUSH2 0xC69 JUMPI PUSH1 0x40 MLOAD SWAP2 POP PUSH1 0x1F NOT PUSH1 0x3F RETURNDATASIZE ADD AND DUP3 ADD PUSH1 0x40 MSTORE RETURNDATASIZE DUP3 MSTORE RETURNDATASIZE PUSH0 PUSH1 0x20 DUP5 ADD RETURNDATACOPY PUSH2 0xC6E JUMP JUMPDEST PUSH1 0x60 SWAP2 POP JUMPDEST POP SWAP1 SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH0 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB AND CALLER EQ PUSH2 0x6BF JUMPI PUSH1 0x40 MLOAD PUSH4 0x118CDAA7 PUSH1 0xE0 SHL DUP2 MSTORE CALLER PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST PUSH0 DUP1 SLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP4 DUP2 AND PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB NOT DUP4 AND DUP2 OR DUP5 SSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP3 AND SWAP3 DUP4 SWAP2 PUSH32 0x8BE0079C531659141344CD1FD0A4F28419497F9722A3DAAFE3B4186F6B6457E0 SWAP2 SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x60 PUSH2 0xD21 PUSH32 0x0 PUSH1 0x1 PUSH2 0xFF0 JUMP JUMPDEST SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x60 PUSH2 0xD21 PUSH32 0x0 PUSH1 0x2 PUSH2 0xFF0 JUMP JUMPDEST PUSH2 0xBC7 DUP4 DUP4 DUP4 PUSH1 0x1 PUSH2 0x1099 JUMP JUMPDEST PUSH32 0x9B779B17422D0DF92223018B32B4D1FA46E071723D6817E2486D003BECC55F00 SLOAD PUSH1 0x2 SUB PUSH2 0x6BF JUMPI PUSH1 0x40 MLOAD PUSH4 0x3EE5AEB5 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH0 PUSH2 0x7B2 PUSH2 0xDAE PUSH2 0x10E3 JUMP JUMPDEST DUP4 PUSH1 0x40 MLOAD PUSH2 0x1901 PUSH1 0xF0 SHL DUP2 MSTORE PUSH1 0x2 DUP2 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x22 DUP3 ADD MSTORE PUSH1 0x42 SWAP1 KECCAK256 SWAP1 JUMP JUMPDEST PUSH0 DUP1 DUP1 PUSH32 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0 DUP5 GT ISZERO PUSH2 0xE07 JUMPI POP PUSH0 SWAP2 POP PUSH1 0x3 SWAP1 POP DUP3 PUSH2 0xE8C JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH0 DUP1 DUP3 MSTORE PUSH1 0x20 DUP3 ADD DUP1 DUP5 MSTORE DUP11 SWAP1 MSTORE PUSH1 0xFF DUP10 AND SWAP3 DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x60 DUP2 ADD DUP8 SWAP1 MSTORE PUSH1 0x80 DUP2 ADD DUP7 SWAP1 MSTORE PUSH1 0x1 SWAP1 PUSH1 0xA0 ADD PUSH1 0x20 PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 SUB SWAP1 DUP1 DUP5 SUB SWAP1 DUP6 GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0xE58 JUMPI RETURNDATASIZE PUSH0 PUSH0 RETURNDATACOPY RETURNDATASIZE PUSH0 REVERT JUMPDEST POP POP PUSH1 0x40 MLOAD PUSH1 0x1F NOT ADD MLOAD SWAP2 POP POP PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND PUSH2 0xE83 JUMPI POP PUSH0 SWAP3 POP PUSH1 0x1 SWAP2 POP DUP3 SWAP1 POP PUSH2 0xE8C JUMP JUMPDEST SWAP3 POP PUSH0 SWAP2 POP DUP2 SWAP1 POP JUMPDEST SWAP5 POP SWAP5 POP SWAP5 SWAP2 POP POP JUMP JUMPDEST PUSH0 DUP3 PUSH1 0x3 DUP2 GT ISZERO PUSH2 0xEA9 JUMPI PUSH2 0xEA9 PUSH2 0x14EA JUMP JUMPDEST SUB PUSH2 0xEB2 JUMPI POP POP JUMP JUMPDEST PUSH1 0x1 DUP3 PUSH1 0x3 DUP2 GT ISZERO PUSH2 0xEC6 JUMPI PUSH2 0xEC6 PUSH2 0x14EA JUMP JUMPDEST SUB PUSH2 0xEE4 JUMPI PUSH1 0x40 MLOAD PUSH4 0xF645EEDF PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x2 DUP3 PUSH1 0x3 DUP2 GT ISZERO PUSH2 0xEF8 JUMPI PUSH2 0xEF8 PUSH2 0x14EA JUMP JUMPDEST SUB PUSH2 0xF19 JUMPI PUSH1 0x40 MLOAD PUSH4 0xFCE698F7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 DUP2 ADD DUP3 SWAP1 MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST PUSH1 0x3 DUP3 PUSH1 0x3 DUP2 GT ISZERO PUSH2 0xF2D JUMPI PUSH2 0xF2D PUSH2 0x14EA JUMP JUMPDEST SUB PUSH2 0xF4E JUMPI PUSH1 0x40 MLOAD PUSH4 0x35E2F383 PUSH1 0xE2 SHL DUP2 MSTORE PUSH1 0x4 DUP2 ADD DUP3 SWAP1 MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST POP POP JUMP JUMPDEST PUSH2 0xF60 DUP5 DUP5 DUP5 DUP5 PUSH1 0x1 PUSH2 0x120C JUMP JUMPDEST PUSH2 0xF88 JUMPI PUSH1 0x40 MLOAD PUSH4 0x5274AFE7 PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP6 AND PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x24 ADD PUSH2 0x281 JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH4 0x95EA7B3 PUSH1 0xE0 SHL PUSH0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP7 AND PUSH1 0x4 MSTORE PUSH1 0x24 DUP6 SWAP1 MSTORE SWAP2 PUSH1 0x20 DUP4 PUSH1 0x44 DUP2 DUP1 DUP12 GAS CALL SWAP3 POP PUSH1 0x1 PUSH0 MLOAD EQ DUP4 AND PUSH2 0xFE4 JUMPI DUP4 DUP4 ISZERO AND ISZERO PUSH2 0xFD8 JUMPI RETURNDATASIZE PUSH0 DUP3 RETURNDATACOPY RETURNDATASIZE DUP2 REVERT JUMPDEST PUSH0 DUP8 EXTCODESIZE GT RETURNDATASIZE ISZERO AND DUP4 AND SWAP3 POP JUMPDEST PUSH1 0x40 MSTORE POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x60 PUSH1 0xFF DUP4 EQ PUSH2 0x100A JUMPI PUSH2 0x1003 DUP4 PUSH2 0x1279 JUMP JUMPDEST SWAP1 POP PUSH2 0x7B2 JUMP JUMPDEST DUP2 DUP1 SLOAD PUSH2 0x1016 SWAP1 PUSH2 0x14FE JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0x1042 SWAP1 PUSH2 0x14FE JUMP JUMPDEST DUP1 ISZERO PUSH2 0x108D JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x1064 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x108D JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH0 MSTORE PUSH1 0x20 PUSH0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x1070 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP PUSH2 0x7B2 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH4 0xA9059CBB PUSH1 0xE0 SHL PUSH0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP7 AND PUSH1 0x4 MSTORE PUSH1 0x24 DUP6 SWAP1 MSTORE SWAP2 PUSH1 0x20 DUP4 PUSH1 0x44 DUP2 DUP1 DUP12 GAS CALL SWAP3 POP PUSH1 0x1 PUSH0 MLOAD EQ DUP4 AND PUSH2 0xFE4 JUMPI DUP4 DUP4 ISZERO AND ISZERO PUSH2 0xFD8 JUMPI RETURNDATASIZE PUSH0 DUP3 RETURNDATACOPY RETURNDATASIZE DUP2 REVERT JUMPDEST PUSH0 ADDRESS PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB PUSH32 0x0 AND EQ DUP1 ISZERO PUSH2 0x113B JUMPI POP PUSH32 0x0 CHAINID EQ JUMPDEST ISZERO PUSH2 0x1165 JUMPI POP PUSH32 0x0 SWAP1 JUMP JUMPDEST PUSH2 0xD21 PUSH1 0x40 DUP1 MLOAD PUSH32 0x8B73C3C69BB8FE3D512ECC4CF759CC79239F7B179B0FFACAA9A75D522B39400F PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x0 SWAP2 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH32 0x0 PUSH1 0x60 DUP3 ADD MSTORE CHAINID PUSH1 0x80 DUP3 ADD MSTORE ADDRESS PUSH1 0xA0 DUP3 ADD MSTORE PUSH0 SWAP1 PUSH1 0xC0 ADD PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 DUP4 SUB SUB DUP2 MSTORE SWAP1 PUSH1 0x40 MSTORE DUP1 MLOAD SWAP1 PUSH1 0x20 ADD KECCAK256 SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH4 0x23B872DD PUSH1 0xE0 SHL PUSH0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP8 DUP2 AND PUSH1 0x4 MSTORE DUP7 AND PUSH1 0x24 MSTORE PUSH1 0x44 DUP6 SWAP1 MSTORE SWAP2 PUSH1 0x20 DUP4 PUSH1 0x64 DUP2 DUP1 DUP13 GAS CALL SWAP3 POP PUSH1 0x1 PUSH0 MLOAD EQ DUP4 AND PUSH2 0x1268 JUMPI DUP4 DUP4 ISZERO AND ISZERO PUSH2 0x125C JUMPI RETURNDATASIZE PUSH0 DUP3 RETURNDATACOPY RETURNDATASIZE DUP2 REVERT JUMPDEST PUSH0 DUP9 EXTCODESIZE GT RETURNDATASIZE ISZERO AND DUP4 AND SWAP3 POP JUMPDEST PUSH1 0x40 MSTORE POP PUSH0 PUSH1 0x60 MSTORE SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x60 PUSH0 PUSH2 0x1285 DUP4 PUSH2 0x12B6 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 DUP4 ADD SWAP1 SWAP3 MSTORE SWAP2 SWAP3 POP PUSH0 SWAP2 SWAP1 PUSH1 0x20 DUP3 ADD DUP2 DUP1 CALLDATASIZE DUP4 CALLDATACOPY POP POP POP SWAP2 DUP3 MSTORE POP PUSH1 0x20 DUP2 ADD SWAP3 SWAP1 SWAP3 MSTORE POP SWAP1 JUMP JUMPDEST PUSH0 PUSH1 0xFF DUP3 AND PUSH1 0x1F DUP2 GT ISZERO PUSH2 0x7B2 JUMPI PUSH1 0x40 MLOAD PUSH4 0x2CD44AC3 PUSH1 0xE2 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x12ED JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1303 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP3 ADD PUSH2 0x1C0 DUP2 DUP6 SUB SLT ISZERO PUSH2 0x1315 JUMPI PUSH0 PUSH0 REVERT JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH0 DUP2 MLOAD DUP1 DUP5 MSTORE DUP1 PUSH1 0x20 DUP5 ADD PUSH1 0x20 DUP7 ADD MCOPY PUSH0 PUSH1 0x20 DUP3 DUP7 ADD ADD MSTORE PUSH1 0x20 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND DUP6 ADD ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0xFF PUSH1 0xF8 SHL DUP9 AND DUP2 MSTORE PUSH1 0xE0 PUSH1 0x20 DUP3 ADD MSTORE PUSH0 PUSH2 0x1368 PUSH1 0xE0 DUP4 ADD DUP10 PUSH2 0x131C JUMP JUMPDEST DUP3 DUP2 SUB PUSH1 0x40 DUP5 ADD MSTORE PUSH2 0x137A DUP2 DUP10 PUSH2 0x131C JUMP JUMPDEST PUSH1 0x60 DUP5 ADD DUP9 SWAP1 MSTORE PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP8 AND PUSH1 0x80 DUP6 ADD MSTORE PUSH1 0xA0 DUP5 ADD DUP7 SWAP1 MSTORE DUP4 DUP2 SUB PUSH1 0xC0 DUP6 ADD MSTORE DUP5 MLOAD DUP1 DUP3 MSTORE PUSH1 0x20 DUP1 DUP8 ADD SWAP4 POP SWAP1 SWAP2 ADD SWAP1 PUSH0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x13CF JUMPI DUP4 MLOAD DUP4 MSTORE PUSH1 0x20 SWAP4 DUP5 ADD SWAP4 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x1 ADD PUSH2 0x13B1 JUMP JUMPDEST POP SWAP1 SWAP12 SWAP11 POP POP POP POP POP POP POP POP POP POP POP JUMP JUMPDEST DUP1 CALLDATALOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND DUP2 EQ PUSH2 0x13F6 JUMPI PUSH0 PUSH0 REVERT JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH0 PUSH0 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x140C JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x1415 DUP4 PUSH2 0x13E0 JUMP JUMPDEST SWAP5 PUSH1 0x20 SWAP4 SWAP1 SWAP4 ADD CALLDATALOAD SWAP4 POP POP POP JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x1433 JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP CALLDATALOAD SWAP2 SWAP1 POP JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x144A JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH2 0x1315 DUP3 PUSH2 0x13E0 JUMP JUMPDEST PUSH0 PUSH0 DUP4 CALLDATALOAD PUSH1 0x1E NOT DUP5 CALLDATASIZE SUB ADD DUP2 SLT PUSH2 0x1468 JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP4 ADD DUP1 CALLDATALOAD SWAP2 POP PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x1482 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH1 0x20 ADD SWAP2 POP CALLDATASIZE DUP2 SWAP1 SUB DUP3 SGT ISZERO PUSH2 0x1496 JUMPI PUSH0 PUSH0 REVERT JUMPDEST SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x14AD JUMPI PUSH0 PUSH0 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH1 0xFF DUP2 AND DUP2 EQ PUSH2 0x1315 JUMPI PUSH0 PUSH0 REVERT JUMPDEST PUSH0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x14CD JUMPI PUSH0 PUSH0 REVERT JUMPDEST POP MLOAD SWAP2 SWAP1 POP JUMP JUMPDEST PUSH0 DUP3 MLOAD DUP1 PUSH1 0x20 DUP6 ADD DUP5 MCOPY PUSH0 SWAP3 ADD SWAP2 DUP3 MSTORE POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x21 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST PUSH1 0x1 DUP2 DUP2 SHR SWAP1 DUP3 AND DUP1 PUSH2 0x1512 JUMPI PUSH1 0x7F DUP3 AND SWAP2 POP JUMPDEST PUSH1 0x20 DUP3 LT DUP2 SUB PUSH2 0x1530 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH1 0x22 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST POP SWAP2 SWAP1 POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 SWAP13 CALLVALUE 0xDB 0x2F PUSH16 0x83AF136A5340CCE7FE8EF554EA8EB633 PUSH6 0x6FBF9BFF3BD7 BALANCE 0xAE 0xC4 0xF PUSH5 0x736F6C6343 STOP ADDMOD SHR STOP CALLER ", + "sourceMap": "1158:6897:22:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2995:1996;;;;;;:::i;:::-;;:::i;:::-;;2293:101:0;;;;;;;;;;;;;:::i;1519:44:22:-;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;576:32:23;;;558:51;;546:2;531:18;1519:44:22;;;;;;;;5228:557:16;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;:::i;1638:85:0:-;;;;;;;;;;-1:-1:-1;1684:7:0;1710:6;-1:-1:-1;;;;;1710:6:0;1638:85;;7236:186:22;;;;;;;;;;-1:-1:-1;7236:186:22;;;;;:::i;:::-;;:::i;1570:69::-;;;;;;;;;;-1:-1:-1;1570:69:22;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2805:14:23;;2798:22;2780:41;;2768:2;2753:18;1570:69:22;2640:187:23;7907:146:22;;;;;;;;;;-1:-1:-1;7907:146:22;;;;;:::i;:::-;;:::i;7619:216::-;;;;;;;;;;-1:-1:-1;7619:216:22;;;;;:::i;:::-;;:::i;2543:215:0:-;;;;;;;;;;-1:-1:-1;2543:215:0;;;;;:::i;:::-;;:::i;2995:1996:22:-;3023:21:11;:19;:21::i;:::-;3083:13:22::1;3099:12;::::0;;;::::1;::::0;::::1;;:::i;:::-;3083:28:::0;-1:-1:-1;3137:19:22::1;::::0;::::1;;-1:-1:-1::0;;;;;3201:19:22;::::1;3193:45;;;::::0;-1:-1:-1;;;3193:45:22;;3456:2:23;3193:45:22::1;::::0;::::1;3438:21:23::0;3495:2;3475:18;;;3468:30;-1:-1:-1;;;3514:18:23;;;3507:43;3567:18;;3193:45:22::1;;;;;;;;;3280:1;3256:12;;::::0;::::1;:6:::0;:12:::1;:::i;:::-;-1:-1:-1::0;;;;;3256:26:22::1;::::0;3248:52:::1;;;::::0;-1:-1:-1;;;3248:52:22;;3798:2:23;3248:52:22::1;::::0;::::1;3780:21:23::0;3837:2;3817:18;;;3810:30;-1:-1:-1;;;3856:18:23;;;3849:43;3909:18;;3248:52:22::1;3596:337:23::0;3248:52:22::1;-1:-1:-1::0;;;;;3319:24:22;::::1;;::::0;;;:17:::1;:24;::::0;;;;;;;:31;;;;;;;;;::::1;;3318:32;3310:55;;;::::0;-1:-1:-1;;;3310:55:22;;4140:2:23;3310:55:22::1;::::0;::::1;4122:21:23::0;4179:2;4159:18;;;4152:30;-1:-1:-1;;;4198:18:23;;;4191:40;4248:18;;3310:55:22::1;3938:334:23::0;3310:55:22::1;3402:6;:22;;;3383:15;:41;;3375:69;;;::::0;-1:-1:-1;;;3375:69:22;;4479:2:23;3375:69:22::1;::::0;::::1;4461:21:23::0;4518:2;4498:18;;;4491:30;-1:-1:-1;;;4537:18:23;;;4530:45;4592:18;;3375:69:22::1;4277:339:23::0;3375:69:22::1;3523:14;3540:215;3568:5:::0;3587:12:::1;;::::0;::::1;:6:::0;:12:::1;:::i;:::-;3613;::::0;::::1;;3639:18;;::::0;::::1;3613:6:::0;3639:18:::1;:::i;:::-;3540:215;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;::::0;;;;-1:-1:-1;;;;3671:19:22::1;::::0;::::1;;3704:5:::0;3723:22:::1;::::0;::::1;;3540:14;:215::i;:::-;3523:232:::0;-1:-1:-1;;;;;;3850:81:22;::::1;:72;3523:232:::0;3872:15:::1;::::0;;;::::1;::::0;::::1;;:::i;:::-;3889:6;:15;;;3906:6;:15;;;3850:13;:72::i;:::-;-1:-1:-1::0;;;;;3850:81:22::1;;3842:105;;;::::0;-1:-1:-1;;;3842:105:22;;5623:2:23;3842:105:22::1;::::0;::::1;5605:21:23::0;5662:2;5642:18;;;5635:30;-1:-1:-1;;;5681:18:23;;;5674:41;5732:18;;3842:105:22::1;5421:335:23::0;3842:105:22::1;3979:6;:19;;;3966:9;:32;3958:73;;;::::0;-1:-1:-1;;;3958:73:22;;5963:2:23;3958:73:22::1;::::0;::::1;5945:21:23::0;6002:2;5982:18;;;5975:30;6041;6021:18;;;6014:58;6089:18;;3958:73:22::1;5761:352:23::0;3958:73:22::1;-1:-1:-1::0;;;;;4158:24:22;::::1;;::::0;;;:17:::1;:24;::::0;;;;;;;:31;;;;;;;;:38;;-1:-1:-1;;4158:38:22::1;4192:4;4158:38;::::0;;4303:219:::1;::::0;4342:12:::1;::::0;;::::1;:6:::0;:12:::1;:::i;:::-;4368:5:::0;4387:12:::1;::::0;::::1;;4413:15;::::0;::::1;;4442:14;::::0;;;::::1;::::0;::::1;;:::i;:::-;4470:6;:14;;;4498:6;:14;;;4303:25;:219::i;:::-;4592:68;4626:19;4647:12;::::0;::::1;;4599;;::::0;::::1;4647:6:::0;4599:12:::1;:::i;:::-;-1:-1:-1::0;;;;;4592:33:22::1;::::0;:68;:33:::1;:68::i;:::-;4671:16;4690:43;4703:18;;::::0;::::1;:6:::0;:18:::1;:::i;:::-;4690:43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;::::0;;;;-1:-1:-1;4723:9:22::1;::::0;-1:-1:-1;4690:12:22::1;::::0;-1:-1:-1;;4690:43:22:i:1;:::-;4671:62;;4751:11;4743:35;;;::::0;-1:-1:-1;;;4743:35:22;;6320:2:23;4743:35:22::1;::::0;::::1;6302:21:23::0;6359:2;6339:18;;;6332:30;-1:-1:-1;;;6378:18:23;;;6371:41;6429:18;;4743:35:22::1;6118:335:23::0;4743:35:22::1;4861:57;4895:19;4916:1;4868:12;;::::0;::::1;:6:::0;:12:::1;:::i;4861:57::-;4957:12;;::::0;::::1;:6:::0;:12:::1;:::i;:::-;-1:-1:-1::0;;;;;4934:50:22::1;4950:5;-1:-1:-1::0;;;;;4934:50:22::1;;4971:6;:12;;;4934:50;;;;6604:25:23::0;;6592:2;6577:18;;6458:177;4934:50:22::1;;;;;;;;3073:1918;;;;3065:20:11::0;2365:1;1505:66;3972:62;3749:292;3065:20;2995:1996:22;:::o;2293:101:0:-;1531:13;:11;:13::i;:::-;2357:30:::1;2384:1;2357:18;:30::i;:::-;2293:101::o:0;5228:557:16:-;5326:13;5353:18;5385:21;5420:15;5449:25;5488:12;5514:27;5617:13;:11;:13::i;:::-;5644:16;:14;:16::i;:::-;5752;;;5736:1;5752:16;;;;;;;;;-1:-1:-1;;;5566:212:16;;;-1:-1:-1;5566:212:16;;-1:-1:-1;5674:13:16;;-1:-1:-1;5709:4:16;;-1:-1:-1;5736:1:16;-1:-1:-1;5752:16:16;-1:-1:-1;5566:212:16;-1:-1:-1;5228:557:16:o;7236:186:22:-;1531:13:0;:11;:13::i;:::-;7319:43:22::1;7346:7;1684::0::0;1710:6;-1:-1:-1;;;;;1710:6:0;;1638:85;7346:7:22::1;-1:-1:-1::0;;;;;7319:26:22;::::1;::::0;7355:6;7319:26:::1;:43::i;:::-;1684:7:0::0;1710:6;-1:-1:-1;;;;;1710:6:0;-1:-1:-1;;;;;7377:38:22::1;7392:5;-1:-1:-1::0;;;;;7377:38:22::1;;7399:6;7377:38;;;;6604:25:23::0;;6592:2;6577:18;;6458:177;7377:38:22::1;;;;;;;;7236:186:::0;;:::o;7907:146::-;-1:-1:-1;;;;;8014:25:22;;7991:4;8014:25;;;:17;:25;;;;;;;;:32;;;;;;;;;;;7907:146;;;;;:::o;7619:216::-;1531:13:0;:11;:13::i;:::-;7686:12:22::1;1710:6:0::0;;7704:31:22::1;::::0;-1:-1:-1;;;;;1710:6:0;;;;7724::22;;7686:12;7704:31;7686:12;7704:31;7724:6;1710::0;7704:31:22::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7685:50;;;7753:7;7745:39;;;::::0;-1:-1:-1;;;7745:39:22;;7184:2:23;7745:39:22::1;::::0;::::1;7166:21:23::0;7223:2;7203:18;;;7196:30;-1:-1:-1;;;7242:18:23;;;7235:49;7301:18;;7745:39:22::1;6982:343:23::0;7745:39:22::1;1684:7:0::0;1710:6;-1:-1:-1;;;;;1710:6:0;-1:-1:-1;;;;;7799:29:22::1;;7812:6;7799:29;;;;6604:25:23::0;;6592:2;6577:18;;6458:177;7799:29:22::1;;;;;;;;7675:160;7619:216:::0;:::o;2543:215:0:-;1531:13;:11;:13::i;:::-;-1:-1:-1;;;;;2627:22:0;::::1;2623:91;;2672:31;::::0;-1:-1:-1;;;2672:31:0;;2700:1:::1;2672:31;::::0;::::1;558:51:23::0;531:18;;2672:31:0::1;412:203:23::0;2623:91:0::1;2723:28;2742:8;2723:18;:28::i;3749:292:11:-:0;3872:25;:23;:25::i;:::-;2407:1;1505:66;3972:62;3749:292::o;5053:632:22:-;5563:15;;;;;;;;;;5342:325;;;1356:156;5342:325;;;7701:25:23;;;;-1:-1:-1;;;;;5406:19:22;7762:32:23;;7742:18;;;7735:60;;;;7831:32;;;7811:18;;;7804:60;7900:32;;7880:18;;;7873:60;7949:19;;;7942:35;;;7993:19;;;7986:35;8037:19;;;8030:35;;;8081:19;;;8074:35;;;8125:19;;;8118:35;;;5276:7:22;;5302:376;;7673:19:23;;5342:325:22;;;;;;;;;;;;5332:336;;;;;;5302:16;:376::i;:::-;5295:383;5053:632;-1:-1:-1;;;;;;;;5053:632:22:o;8813:260:15:-;8898:7;8918:17;8937:18;8957:16;8977:25;8988:4;8994:1;8997;9000;8977:10;:25::i;:::-;8917:85;;;;;;9012:28;9024:5;9031:8;9012:11;:28::i;:::-;-1:-1:-1;9057:9:15;;8813:260;-1:-1:-1;;;;;;8813:260:15:o;5941:777:22:-;6216:74;;-1:-1:-1;;;6216:74:22;;-1:-1:-1;;;;;8493:32:23;;;6216:74:22;;;8475:51:23;6258:4:22;8542:18:23;;;8535:60;8611:18;;;8604:34;;;8654:18;;;8647:34;;;8730:4;8718:17;;8697:19;;;8690:46;8752:19;;;8745:35;;;8796:19;;;8789:35;;;6216:26:22;;;;;8447:19:23;;6216:74:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6212:375;;6448:45;;-1:-1:-1;;;6448:45:22;;-1:-1:-1;;;;;9027:32:23;;;6448:45:22;;;9009:51:23;6487:4:22;9076:18:23;;;9069:60;6497:5:22;;6448:23;;;;;;8982:18:23;;6448:45:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:54;;6423:153;;;;-1:-1:-1;;;6423:153:22;;9531:2:23;6423:153:22;;;9513:21:23;9570:2;9550:18;;;9543:30;9609:34;9589:18;;;9582:62;-1:-1:-1;;;9660:18:23;;;9653:38;9708:19;;6423:153:22;9329:404:23;6423:153:22;6652:59;-1:-1:-1;;;;;6652:30:22;;6683:5;6698:4;6705:5;6652:30;:59::i;:::-;5941:777;;;;;;;:::o;5098:367:7:-;5190:42;5203:5;5210:7;5219:5;5226;5190:12;:42::i;:::-;5185:274;;5253:37;5266:5;5273:7;5282:1;5285:4;5253:12;:37::i;:::-;5248:91;;5299:40;;-1:-1:-1;;;5299:40:7;;-1:-1:-1;;;;;576:32:23;;5299:40:7;;;558:51:23;531:18;;5299:40:7;412:203:23;5248:91:7;5358:41;5371:5;5378:7;5387:5;5394:4;5358:12;:41::i;:::-;5353:95;;5408:40;;-1:-1:-1;;;5408:40:7;;-1:-1:-1;;;;;576:32:23;;5408:40:7;;;558:51:23;531:18;;5408:40:7;412:203:23;5353:95:7;5098:367;;;:::o;6724:184:22:-;6798:4;6815:12;6833:19;-1:-1:-1;;;;;6833:24:22;6865:5;6872:4;6833:44;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;6814:63:22;;6724:184;-1:-1:-1;;;;;6724:184:22:o;1796:162:0:-;1684:7;1710:6;-1:-1:-1;;;;;1710:6:0;735:10:9;1855:23:0;1851:101;;1901:40;;-1:-1:-1;;;1901:40:0;;735:10:9;1901:40:0;;;558:51:23;531:18;;1901:40:0;412:203:23;2912:187:0;2985:16;3004:6;;-1:-1:-1;;;;;3020:17:0;;;-1:-1:-1;;;;;;3020:17:0;;;;;;3052:40;;3004:6;;;;;;;3052:40;;2985:16;3052:40;2975:124;2912:187;:::o;6105:126:16:-;6151:13;6183:41;:5;6210:13;6183:26;:41::i;:::-;6176:48;;6105:126;:::o;6557:135::-;6606:13;6638:47;:8;6668:16;6638:29;:47::i;1219:204:7:-;1306:37;1320:5;1327:2;1331:5;1338:4;1306:13;:37::i;3586:157:11:-;1505:66;4560:52;2407:1;4560:63;3644:93;;3696:30;;-1:-1:-1;;;3696:30:11;;;;;;;;;;;5017:176:16;5094:7;5120:66;5153:20;:18;:20::i;:::-;5175:10;4093:4:17;4087:11;-1:-1:-1;;;4111:23:17;;4163:4;4154:14;;4147:39;;;;4215:4;4206:14;;4199:34;4271:4;4256:20;;;3918:374;7129:1551:15;7255:17;;;8209:66;8196:79;;8192:164;;;-1:-1:-1;8307:1:15;;-1:-1:-1;8311:30:15;;-1:-1:-1;8343:1:15;8291:54;;8192:164;8467:24;;;8450:14;8467:24;;;;;;;;;10271:25:23;;;10344:4;10332:17;;10312:18;;;10305:45;;;;10366:18;;;10359:34;;;10409:18;;;10402:34;;;8467:24:15;;10243:19:23;;8467:24:15;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;8467:24:15;;-1:-1:-1;;8467:24:15;;;-1:-1:-1;;;;;;;8505:20:15;;8501:113;;-1:-1:-1;8557:1:15;;-1:-1:-1;8561:29:15;;-1:-1:-1;8557:1:15;;-1:-1:-1;8541:62:15;;8501:113;8632:6;-1:-1:-1;8640:20:15;;-1:-1:-1;8640:20:15;;-1:-1:-1;7129:1551:15;;;;;;;;;:::o;11617:532::-;11712:20;11703:5;:29;;;;;;;;:::i;:::-;;11699:444;;11617:532;;:::o;11699:444::-;11808:29;11799:5;:38;;;;;;;;:::i;:::-;;11795:348;;11860:23;;-1:-1:-1;;;11860:23:15;;;;;;;;;;;11795:348;11913:35;11904:5;:44;;;;;;;;:::i;:::-;;11900:243;;11971:46;;-1:-1:-1;;;11971:46:15;;;;;6604:25:23;;;6577:18;;11971:46:15;6458:177:23;11900:243:15;12047:30;12038:5;:39;;;;;;;;:::i;:::-;;12034:109;;12100:32;;-1:-1:-1;;;12100:32:15;;;;;6604:25:23;;;6577:18;;12100:32:15;6458:177:23;12034:109:15;11617:532;;:::o;1662:232:7:-;1767:47;1785:5;1792:4;1798:2;1802:5;1809:4;1767:17;:47::i;:::-;1762:126;;1837:40;;-1:-1:-1;;;1837:40:7;;-1:-1:-1;;;;;576:32:23;;1837:40:7;;;558:51:23;531:18;;1837:40:7;412:203:23;1762:126:7;1662:232;;;;:::o;12059:1252::-;12289:4;12283:11;-1:-1:-1;;;12157:12:7;12307:22;;;-1:-1:-1;;;;;12355:29:7;;12349:4;12342:43;12405:4;12398:19;;;12157:12;12481:4;12157:12;12469:4;12157:12;;12453:5;12446;12441:45;12430:56;;12698:1;12691:4;12685:11;12682:18;12673:7;12669:32;12659:606;;12830:6;12820:7;12813:15;12809:28;12806:165;;;12886:16;12880:4;12875:3;12860:43;12936:16;12931:3;12924:29;12806:165;13247:1;13239:5;13227:18;13224:25;13205:16;13198:24;13194:56;13185:7;13181:70;13170:81;;12659:606;13285:4;13278:17;-1:-1:-1;12059:1252:7;;-1:-1:-1;;;;12059:1252:7:o;3376:267:12:-;3470:13;1390:66;3499:46;;3495:142;;3568:15;3577:5;3568:8;:15::i;:::-;3561:22;;;;3495:142;3621:5;3614:12;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8373:1244:7;8600:4;8594:11;-1:-1:-1;;;8467:12:7;8618:22;;;-1:-1:-1;;;;;8666:24:7;;8660:4;8653:38;8711:4;8704:19;;;8467:12;8787:4;8467:12;8775:4;8467:12;;8759:5;8752;8747:45;8736:56;;9004:1;8997:4;8991:11;8988:18;8979:7;8975:32;8965:606;;9136:6;9126:7;9119:15;9115:28;9112:165;;;9192:16;9186:4;9181:3;9166:43;9242:16;9237:3;9230:29;3945:262:16;3998:7;4029:4;-1:-1:-1;;;;;4038:11:16;4021:28;;:63;;;;;4070:14;4053:13;:31;4021:63;4017:184;;;-1:-1:-1;4107:22:16;;3945:262::o;4017:184::-;4167:23;4304:80;;;2079:95;4304:80;;;11405:25:23;4326:11:16;11446:18:23;;;11439:34;;;;4339:14:16;11489:18:23;;;11482:34;4355:13:16;11532:18:23;;;11525:34;4378:4:16;11575:19:23;;;11568:61;4268:7:16;;11377:19:23;;4304:80:16;;;;;;;;;;;;4294:91;;;;;;4287:98;;4213:179;;10165:1393:7;10460:4;10454:11;-1:-1:-1;;;10323:12:7;10478:22;;;-1:-1:-1;;;;;10526:26:7;;;10520:4;10513:40;10579:24;;10573:4;10566:38;10624:4;10617:19;;;10323:12;10700:4;10323:12;10688:4;10323:12;;10672:5;10665;10660:45;10649:56;;10917:1;10910:4;10904:11;10901:18;10892:7;10888:32;10878:606;;11049:6;11039:7;11032:15;11028:28;11025:165;;;11105:16;11099:4;11094:3;11079:43;11155:16;11150:3;11143:29;11025:165;11466:1;11458:5;11446:18;11443:25;11424:16;11417:24;11413:56;11404:7;11400:70;11389:81;;10878:606;11504:4;11497:17;-1:-1:-1;11540:1:7;11534:4;11527:15;10165:1393;;-1:-1:-1;;;;;10165:1393:7:o;2080:380:12:-;2139:13;2164:11;2178:16;2189:4;2178:10;:16::i;:::-;2302;;;2313:4;2302:16;;;;;;;;;2164:30;;-1:-1:-1;2282:17:12;;2302:16;;;;;;;;;-1:-1:-1;;;2367:16:12;;;-1:-1:-1;2412:4:12;2403:14;;2396:28;;;;-1:-1:-1;2367:16:12;2080:380::o;2532:247::-;2593:7;2665:4;2629:40;;2692:4;2683:13;;2679:71;;;2719:20;;-1:-1:-1;;;2719:20:12;;;;;;;;;;;14:393:23;106:6;159:2;147:9;138:7;134:23;130:32;127:52;;;175:1;172;165:12;127:52;215:9;202:23;248:18;240:6;237:30;234:50;;;280:1;277;270:12;234:50;303:22;;359:3;341:16;;;337:26;334:46;;;376:1;373;366:12;334:46;399:2;14:393;-1:-1:-1;;;14:393:23:o;620:289::-;662:3;700:5;694:12;727:6;722:3;715:19;783:6;776:4;769:5;765:16;758:4;753:3;749:14;743:47;835:1;828:4;819:6;814:3;810:16;806:27;799:38;898:4;891:2;887:7;882:2;874:6;870:15;866:29;861:3;857:39;853:50;846:57;;;620:289;;;;:::o;914:1238::-;1320:3;1315;1311:13;1303:6;1299:26;1288:9;1281:45;1362:3;1357:2;1346:9;1342:18;1335:31;1262:4;1389:46;1430:3;1419:9;1415:19;1407:6;1389:46;:::i;:::-;1483:9;1475:6;1471:22;1466:2;1455:9;1451:18;1444:50;1517:33;1543:6;1535;1517:33;:::i;:::-;1581:2;1566:18;;1559:34;;;-1:-1:-1;;;;;1630:32:23;;1624:3;1609:19;;1602:61;1650:3;1679:19;;1672:35;;;1744:22;;;1738:3;1723:19;;1716:51;1816:13;;1838:22;;;1888:2;1914:15;;;;-1:-1:-1;1876:15:23;;;;-1:-1:-1;1957:169:23;1971:6;1968:1;1965:13;1957:169;;;2032:13;;2020:26;;2075:2;2101:15;;;;2066:12;;;;1993:1;1986:9;1957:169;;;-1:-1:-1;2143:3:23;;914:1238;-1:-1:-1;;;;;;;;;;;914:1238:23:o;2157:173::-;2225:20;;-1:-1:-1;;;;;2274:31:23;;2264:42;;2254:70;;2320:1;2317;2310:12;2254:70;2157:173;;;:::o;2335:300::-;2403:6;2411;2464:2;2452:9;2443:7;2439:23;2435:32;2432:52;;;2480:1;2477;2470:12;2432:52;2503:29;2522:9;2503:29;:::i;:::-;2493:39;2601:2;2586:18;;;;2573:32;;-1:-1:-1;;;2335:300:23:o;2832:226::-;2891:6;2944:2;2932:9;2923:7;2919:23;2915:32;2912:52;;;2960:1;2957;2950:12;2912:52;-1:-1:-1;3005:23:23;;2832:226;-1:-1:-1;2832:226:23:o;3063:186::-;3122:6;3175:2;3163:9;3154:7;3150:23;3146:32;3143:52;;;3191:1;3188;3181:12;3143:52;3214:29;3233:9;3214:29;:::i;4621:521::-;4698:4;4704:6;4764:11;4751:25;4858:2;4854:7;4843:8;4827:14;4823:29;4819:43;4799:18;4795:68;4785:96;;4877:1;4874;4867:12;4785:96;4904:33;;4956:20;;;-1:-1:-1;4999:18:23;4988:30;;4985:50;;;5031:1;5028;5021:12;4985:50;5064:4;5052:17;;-1:-1:-1;5095:14:23;5091:27;;;5081:38;;5078:58;;;5132:1;5129;5122:12;5078:58;4621:521;;;;;:::o;5147:269::-;5204:6;5257:2;5245:9;5236:7;5232:23;5228:32;5225:52;;;5273:1;5270;5263:12;5225:52;5312:9;5299:23;5362:4;5355:5;5351:16;5344:5;5341:27;5331:55;;5382:1;5379;5372:12;9140:184;9210:6;9263:2;9251:9;9242:7;9238:23;9234:32;9231:52;;;9279:1;9276;9269:12;9231:52;-1:-1:-1;9302:16:23;;9140:184;-1:-1:-1;9140:184:23:o;9738:301::-;9867:3;9905:6;9899:13;9951:6;9944:4;9936:6;9932:17;9927:3;9921:37;10013:1;9977:16;;10002:13;;;-1:-1:-1;9977:16:23;9738:301;-1:-1:-1;9738:301:23:o;10447:127::-;10508:10;10503:3;10499:20;10496:1;10489:31;10539:4;10536:1;10529:15;10563:4;10560:1;10553:15;10761:380;10840:1;10836:12;;;;10883;;;10904:61;;10958:4;10950:6;10946:17;10936:27;;10904:61;11011:2;11003:6;11000:14;10980:18;10977:38;10974:161;;11057:10;11052:3;11048:20;11045:1;11038:31;11092:4;11089:1;11082:15;11120:4;11117:1;11110:15;10974:161;;10761:380;;;:::o" + }, + "methodIdentifiers": { + "destinationContract()": "75bd6863", + "eip712Domain()": "84b0196e", + "execute((address,address,uint256,uint256,uint8,bytes32,bytes32,bytes,uint256,uint256,uint256,uint8,bytes32,bytes32))": "2af83bfe", + "isExecutionCompleted(address,uint256)": "dcb79457", + "owner()": "8da5cb5b", + "renounceOwnership()": "715018a6", + "transferOwnership(address)": "f2fde38b", + "usedPayloadNonces(address,uint256)": "d850124e", + "withdrawETH(uint256)": "f14210a6", + "withdrawToken(address,uint256)": "9e281a98" + } + }, + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_destinationContract\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ECDSAInvalidSignature\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"length\",\"type\":\"uint256\"}],\"name\":\"ECDSAInvalidSignatureLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"ECDSAInvalidSignatureS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidShortString\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"OwnableInvalidOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"OwnableUnauthorizedAccount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ReentrancyGuardReentrantCall\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"SafeERC20FailedOperation\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"str\",\"type\":\"string\"}],\"name\":\"StringTooLong\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"EIP712DomainChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"ETHWithdrawn\",\"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\":true,\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RelayerExecuted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"TokenWithdrawn\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"destinationContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"eip712Domain\",\"outputs\":[{\"internalType\":\"bytes1\",\"name\":\"fields\",\"type\":\"bytes1\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"verifyingContract\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"extensions\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"permitV\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"permitR\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"permitS\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"payloadData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"payloadValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"payloadNonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"payloadDeadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"payloadV\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"payloadR\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"payloadS\",\"type\":\"bytes32\"}],\"internalType\":\"struct TokenRelayer.ExecuteParams\",\"name\":\"params\",\"type\":\"tuple\"}],\"name\":\"execute\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"name\":\"isExecutionCompleted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"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\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"usedPayloadNonces\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdrawETH\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdrawToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"errors\":{\"ECDSAInvalidSignature()\":[{\"details\":\"The signature is invalid.\"}],\"ECDSAInvalidSignatureLength(uint256)\":[{\"details\":\"The signature has an invalid length.\"}],\"ECDSAInvalidSignatureS(bytes32)\":[{\"details\":\"The signature has an S value that is in the upper half order.\"}],\"OwnableInvalidOwner(address)\":[{\"details\":\"The owner is not a valid owner account. (eg. `address(0)`)\"}],\"OwnableUnauthorizedAccount(address)\":[{\"details\":\"The caller account is not authorized to perform an operation.\"}],\"ReentrancyGuardReentrantCall()\":[{\"details\":\"Unauthorized reentrant call.\"}],\"SafeERC20FailedOperation(address)\":[{\"details\":\"An operation with an ERC-20 token failed.\"}]},\"events\":{\"EIP712DomainChanged()\":{\"details\":\"MAY be emitted to signal that the domain could have changed.\"}},\"kind\":\"dev\",\"methods\":{\"eip712Domain()\":{\"details\":\"returns the fields and values that describe the domain separator used by this contract for EIP-712 signature.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"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.\"},\"withdrawETH(uint256)\":{\"params\":{\"amount\":\"The amount of ETH to transfer to the owner.\"}},\"withdrawToken(address,uint256)\":{\"params\":{\"amount\":\"The amount of tokens to transfer to the owner.\",\"token\":\"The ERC20 token contract address.\"}}},\"title\":\"TokenRelayer\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"withdrawETH(uint256)\":{\"notice\":\"Allows the owner to recover any native ETH held by this contract.\"},\"withdrawToken(address,uint256)\":{\"notice\":\"Allows the owner to recover any ERC20 tokens held by this contract.\"}},\"notice\":\"A relayer contract that accepts ERC20 permit signatures and executes arbitrary calls to a destination contract, both authorized via signature. Flow: 1. User signs a permit allowing the relayer to spend their tokens 2. User signs a payload (e.g., transfer from relayer to another user) 3. Relayer: a. Executes permit to approve the tokens b. Transfers tokens from user to relayer (via transferFrom) c. Forwards the payload call (transfer from relayer to another user)\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/TokenRelayer.sol\":\"TokenRelayer\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"keccak256\":\"0xff6d0bb2e285473e5311d9d3caacb525ae3538a80758c10649a4d61029b017bb\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8ed324d3920bb545059d66ab97d43e43ee85fd3bd52e03e401f020afb0b120f6\",\"dweb:/ipfs/QmfEckWLmZkDDcoWrkEvMWhms66xwTLff9DDhegYpvHo1a\"]},\"@openzeppelin/contracts/interfaces/IERC1363.sol\":{\"keccak256\":\"0xd5ea07362ab630a6a3dee4285a74cf2377044ca2e4be472755ad64d7c5d4b69d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://da5e832b40fc5c3145d3781e2e5fa60ac2052c9d08af7e300dc8ab80c4343100\",\"dweb:/ipfs/QmTzf7N5ZUdh5raqtzbM11yexiUoLC9z3Ws632MCuycq1d\"]},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"keccak256\":\"0x0afcb7e740d1537b252cb2676f600465ce6938398569f09ba1b9ca240dde2dfc\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1c299900ac4ec268d4570ecef0d697a3013cd11a6eb74e295ee3fbc945056037\",\"dweb:/ipfs/Qmab9owJoxcA7vJT5XNayCMaUR1qxqj1NDzzisduwaJMcZ\"]},\"@openzeppelin/contracts/interfaces/IERC20.sol\":{\"keccak256\":\"0x1a6221315ce0307746c2c4827c125d821ee796c74a676787762f4778671d4f44\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1bb2332a7ee26dd0b0de9b7fe266749f54820c99ab6a3bcb6f7e6b751d47ee2d\",\"dweb:/ipfs/QmcRWpaBeCYkhy68PR3B4AgD7asuQk7PwkWxrvJbZcikLF\"]},\"@openzeppelin/contracts/interfaces/IERC5267.sol\":{\"keccak256\":\"0xfb223a85dd0b2175cfbbaa325a744e2cd74ecd17c3df2b77b0722f991d2725ee\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://84bf1dea0589ec49c8d15d559cc6d86ee493048a89b2d4adb60fbe705a3d89ae\",\"dweb:/ipfs/Qmd56n556d529wk2pRMhYhm5nhMDhviwereodDikjs68w1\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x74ed01eb66b923d0d0cfe3be84604ac04b76482a55f9dd655e1ef4d367f95bc2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5282825a626cfe924e504274b864a652b0023591fa66f06a067b25b51ba9b303\",\"dweb:/ipfs/QmeCfPykghhMc81VJTrHTC7sF6CRvaA1FXVq2pJhwYp1dV\"]},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\":{\"keccak256\":\"0x53befc41288eaa87edcd3a7be7e8475a32e44c6a29f9bf52fae789781301d9ff\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a1d7fab53c4ceaf42391b83d9b36d7e9cc524a8da125cffdcd32c56560f9d1c9\",\"dweb:/ipfs/QmaRZdVhQdqNXofeimibkBG65q9GVcXVZEGpycwwX3znC6\"]},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"keccak256\":\"0x304d732678032a9781ae85c8f204c8fba3d3a5e31c02616964e75cfdc5049098\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://299ced486011781dc98f638059678323c03079fefae1482abaa2135b22fa92d0\",\"dweb:/ipfs/QmbZNbcPTBxNvwChavN2kkZZs7xHhYL7mv51KrxMhsMs3j\"]},\"@openzeppelin/contracts/utils/Bytes.sol\":{\"keccak256\":\"0xf80e4b96b6849936ea0fabd76cf81b13d7276295fddb1e1c07afb3ddf650b0ac\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6430007255ac11c6e9c4331a418f3af52ff66fbbae959f645301d025b20aeb08\",\"dweb:/ipfs/QmQE5fjmBBRw9ndnzJuC2uskYss1gbaR7JdazoCf1FGoBj\"]},\"@openzeppelin/contracts/utils/Context.sol\":{\"keccak256\":\"0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6a708e8a5bdb1011c2c381c9a5cfd8a9a956d7d0a9dc1bd8bcdaf52f76ef2f12\",\"dweb:/ipfs/Qmax9WHBnVsZP46ZxEMNRQpLQnrdE4dK8LehML1Py8FowF\"]},\"@openzeppelin/contracts/utils/Panic.sol\":{\"keccak256\":\"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c6a5ff4f9fd8649b7ee20800b7fa387d3465bd77cf20c2d1068cd5c98e1ed57a\",\"dweb:/ipfs/QmVSaVJf9FXFhdYEYeCEfjMVHrxDh5qL4CGkxdMWpQCrqG\"]},\"@openzeppelin/contracts/utils/ReentrancyGuard.sol\":{\"keccak256\":\"0xa516cbf1c7d15d3517c2d668601ce016c54395bf5171918a14e2686977465f53\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1e1d079e8edfb58efd23a311e315a4807b01b5d1cf153f8fa2d0608b9dec3e99\",\"dweb:/ipfs/QmTBExeX2SDTkn5xbk5ssbYSx7VqRp9H4Ux1CY4uQM4b9N\"]},\"@openzeppelin/contracts/utils/ShortStrings.sol\":{\"keccak256\":\"0x0768b3bdb701fe4994b3be932ca8635551dfebe04c645f77500322741bebf57c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a2059f9ca8d3c11c49ca49fc9c5fb070f18cc85d12a7688e45322ed0e2a1cb99\",\"dweb:/ipfs/QmS2gwX51RAvSw4tYbjHccY2CKbh2uvDzqHLAFXdsddgia\"]},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"keccak256\":\"0xcf74f855663ce2ae00ed8352666b7935f6cddea2932fdf2c3ecd30a9b1cd0e97\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9f660b1f351b757dfe01438e59888f31f33ded3afcf5cb5b0d9bf9aa6f320a8b\",\"dweb:/ipfs/QmarDJ5hZEgBtCmmrVzEZWjub9769eD686jmzb2XpSU1cM\"]},\"@openzeppelin/contracts/utils/Strings.sol\":{\"keccak256\":\"0x1fdc2de9585ab0f1c417f02a873a2b6343cd64bb7ffec6b00ffa11a4a158d9e8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1ab223a3d969c6cd7610049431dd42740960c477e45878f5d8b54411f7a32bdc\",\"dweb:/ipfs/QmWumhjvhpKcwx3vDPQninsNVTc3BGvqaihkQakFkQYpaS\"]},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"keccak256\":\"0xbeb5cad8aaabe0d35d2ec1a8414d91e81e5a8ca679add4cf57e2f33476861f40\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ebb272a5ee2da4e8bd5551334e0ce8dce4e9c56a04570d6bf046d260fab3116a\",\"dweb:/ipfs/QmNw6RyM769qcqFocDq6HJMG2WiEnQbvizpRaUXsACHho2\"]},\"@openzeppelin/contracts/utils/cryptography/EIP712.sol\":{\"keccak256\":\"0x8440117ea216b97a7bad690a67449fd372c840d073c8375822667e14702782b4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ebb6645995b8290d0b9121825e2533e4e28977b2c6befee76e15e58f0feb61d4\",\"dweb:/ipfs/QmVR72j6kL5R2txuihieDev1FeTi4KWJS1Z6ABbwL3Qtph\"]},\"@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol\":{\"keccak256\":\"0x6d8579873b9650426bfbd2a754092d1725049ca05e4e3c8c2c82dd9f3453129d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1fa3127a8968d55096d37124a9e212013af112affa5e30b84a1d22263c31576c\",\"dweb:/ipfs/QmetxaVcn5Q6nkpF9yXzaxPQ7d3rgrhV13sTH9BgiuzGJL\"]},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x8891738ffe910f0cf2da09566928589bf5d63f4524dd734fd9cedbac3274dd5c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://971f954442df5c2ef5b5ebf1eb245d7105d9fbacc7386ee5c796df1d45b21617\",\"dweb:/ipfs/QmadRjHbkicwqwwh61raUEapaVEtaLMcYbQZWs9gUkgj3u\"]},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"keccak256\":\"0x59973a93b1f983f94e10529f46ca46544a9fec2b5f56fb1390bbe9e0dc79f857\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c55ef8f0b9719790c2ae6f81d80a59ffb89f2f0abe6bc065585bd79edce058c5\",\"dweb:/ipfs/QmNNmCbX9NjPXKqHJN8R1WC2rNeZSQrPZLd6FF6AKLyH5Y\"]},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"keccak256\":\"0xc8cae21c9ae4a46e5162ff9bf5b351d6fa6a6eba72d515f3bc1bdfeda7fdf083\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce830ebcf28e31643caba318996db3763c36d52cd0f23798ba83c135355d45e9\",\"dweb:/ipfs/QmdGPcvptHN7UBCbUYBbRX3hiRVRFLRwno8b4uga6uFNif\"]},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"keccak256\":\"0xb1970fac7b64e6c09611e6691791e848d5e3fe410fa5899e7df2e0afd77a99e3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://db5fbb3dddd8b7047465b62575d96231ba8a2774d37fb4737fbf23340fabbb03\",\"dweb:/ipfs/QmVUSvooZKEdEdap619tcJjTLcAuH6QBdZqAzWwnAXZAWJ\"]},\"contracts/TokenRelayer.sol\":{\"keccak256\":\"0xa26c2b15e35622e16d260cc4de183ff686e24494dd64b25ef444068239a8eee4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f7e63a4f9e7b5f70ee521378c3009982c70603b25526a6dcc516a4761dfb3d2d\",\"dweb:/ipfs/QmSNc84AJ2RXBPx9rHrJkyPwAbgcqBdQUQ76cJV9qYWMTF\"]}},\"version\":1}" + } + } + } + } +} \ No newline at end of file diff --git a/contracts/relayer/ignition/deployments/chain-56/deployed_addresses.json b/contracts/relayer/ignition/deployments/chain-56/deployed_addresses.json new file mode 100644 index 000000000..610635451 --- /dev/null +++ b/contracts/relayer/ignition/deployments/chain-56/deployed_addresses.json @@ -0,0 +1,3 @@ +{ + "TokenRelayer#TokenRelayer": "0x2d657ac14088fED401b58FEd377988ed3F875220" +} diff --git a/contracts/relayer/ignition/deployments/chain-56/journal.jsonl b/contracts/relayer/ignition/deployments/chain-56/journal.jsonl new file mode 100644 index 000000000..c045dff41 --- /dev/null +++ b/contracts/relayer/ignition/deployments/chain-56/journal.jsonl @@ -0,0 +1,8 @@ + +{"chainId":56,"type":"DEPLOYMENT_INITIALIZE"} +{"artifactId":"TokenRelayer#TokenRelayer","constructorArgs":["0xce16F69375520ab01377ce7B88f5BA8C48F8D666"],"contractName":"TokenRelayer","dependencies":[],"from":"0xec733ccc573cbb46211876149e1830c58c6133e2","futureId":"TokenRelayer#TokenRelayer","futureType":"NAMED_ARTIFACT_CONTRACT_DEPLOYMENT","libraries":{},"strategy":"basic","strategyConfig":{},"type":"DEPLOYMENT_EXECUTION_STATE_INITIALIZE","value":{"_kind":"bigint","value":"0"}} +{"futureId":"TokenRelayer#TokenRelayer","networkInteraction":{"data":"0x610180604052348015610010575f5ffd5b50604051611a4d380380611a4d83398101604081905261002f91610294565b604080518082018252600c81526b2a37b5b2b72932b630bcb2b960a11b602080830191909152825180840190935260018352603160f81b9083015290338061009157604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b61009a816101d6565b5060017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00556100ca826001610225565b610120526100d9816002610225565b61014052815160208084019190912060e052815190820120610100524660a05261016560e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b60805250503060c0526001600160a01b0381166101c45760405162461bcd60e51b815260206004820152601360248201527f496e76616c69642064657374696e6174696f6e000000000000000000000000006044820152606401610088565b6001600160a01b03166101605261046b565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f6020835110156102405761023983610257565b9050610251565b8161024b8482610359565b5060ff90505b92915050565b5f5f829050601f81511115610281578260405163305a27a960e01b81526004016100889190610413565b805161028c82610448565b179392505050565b5f602082840312156102a4575f5ffd5b81516001600160a01b03811681146102ba575f5ffd5b9392505050565b634e487b7160e01b5f52604160045260245ffd5b600181811c908216806102e957607f821691505b60208210810361030757634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111561035457805f5260205f20601f840160051c810160208510156103325750805b601f840160051c820191505b81811015610351575f815560010161033e565b50505b505050565b81516001600160401b03811115610372576103726102c1565b6103868161038084546102d5565b8461030d565b6020601f8211600181146103b8575f83156103a15750848201515b5f19600385901b1c1916600184901b178455610351565b5f84815260208120601f198516915b828110156103e757878501518255602094850194600190920191016103c7565b508482101561040457868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b80516020808301519190811015610307575f1960209190910360031b1b16919050565b60805160a05160c05160e0516101005161012051610140516101605161156c6104e15f395f818160d701528181610525015281816105f4015281816109500152610bf801525f610d2d01525f610cfb01525f6111bc01525f61119401525f6110ef01525f61111901525f611143015261156c5ff3fe608060405260043610610092575f3560e01c80639e281a98116100575780639e281a9814610159578063d850124e14610178578063dcb79457146101c1578063f14210a6146101e0578063f2fde38b146101ff575f5ffd5b80632af83bfe1461009d578063715018a6146100b257806375bd6863146100c657806384b0196e146101165780638da5cb5b1461013d575f5ffd5b3661009957005b5f5ffd5b6100b06100ab3660046112dd565b61021e565b005b3480156100bd575f5ffd5b506100b06106ae565b3480156100d1575f5ffd5b506100f97f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b348015610121575f5ffd5b5061012a6106c1565b60405161010d979695949392919061134a565b348015610148575f5ffd5b505f546001600160a01b03166100f9565b348015610164575f5ffd5b506100b06101733660046113fb565b610703565b348015610183575f5ffd5b506101b16101923660046113fb565b600360209081525f928352604080842090915290825290205460ff1681565b604051901515815260200161010d565b3480156101cc575f5ffd5b506101b16101db3660046113fb565b61078b565b3480156101eb575f5ffd5b506100b06101fa366004611423565b6107b8565b34801561020a575f5ffd5b506100b061021936600461143a565b6108a7565b6102266108e1565b5f610237604083016020840161143a565b90506101208201356001600160a01b03821661028a5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21037bbb732b960991b60448201526064015b60405180910390fd5b5f610298602085018561143a565b6001600160a01b0316036102de5760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2103a37b5b2b760991b6044820152606401610281565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff161561033e5760405162461bcd60e51b815260206004820152600a602482015269139bdb98d9481d5cd95960b21b6044820152606401610281565b8261014001354211156103855760405162461bcd60e51b815260206004820152600f60248201526e14185e5b1bd85908195e1c1a5c9959608a1b6044820152606401610281565b5f6103ee83610397602087018761143a565b60408701356103a960e0890189611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250505050610100890135876101408b013561090f565b90506001600160a01b038316610421826104106101808801610160890161149d565b876101800135886101a001356109db565b6001600160a01b0316146104655760405162461bcd60e51b815260206004820152600b60248201526a496e76616c69642073696760a81b6044820152606401610281565b83610100013534146104b95760405162461bcd60e51b815260206004820152601c60248201527f496e636f7272656374204554482076616c75652070726f7669646564000000006044820152606401610281565b6001600160a01b0383165f9081526003602090815260408083208584528252909120805460ff19166001179055610520906104f69086018661143a565b846040870135606088013561051160a08a0160808b0161149d565b8960a001358a60c00135610a07565b6105667f00000000000000000000000000000000000000000000000000000000000000006040860135610556602088018861143a565b6001600160a01b03169190610b75565b5f6105b261057760e0870187611453565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250349250610bf4915050565b9050806105ef5760405162461bcd60e51b815260206004820152600b60248201526a10d85b1b0819985a5b195960aa1b6044820152606401610281565b6106217f00000000000000000000000000000000000000000000000000000000000000005f610556602089018961143a565b61062e602086018661143a565b6001600160a01b0316846001600160a01b03167f78129a649632642d8e9f346c85d9efb70d32d50a36774c4585491a9228bbd350876040013560405161067691815260200190565b60405180910390a3505050506106ab60017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b50565b6106b6610c79565b6106bf5f610ca5565b565b5f6060805f5f5f60606106d2610cf4565b6106da610d26565b604080515f80825260208201909252600f60f81b9b939a50919850469750309650945092509050565b61070b610c79565b61073061071f5f546001600160a01b031690565b6001600160a01b0384169083610d53565b5f546001600160a01b03166001600160a01b0316826001600160a01b03167fa0524ee0fd8662d6c046d199da2a6d3dc49445182cec055873a5bb9c2843c8e08360405161077f91815260200190565b60405180910390a35050565b6001600160a01b0382165f90815260036020908152604080832084845290915290205460ff165b92915050565b6107c0610c79565b5f80546040516001600160a01b039091169083908381818185875af1925050503d805f811461080a576040519150601f19603f3d011682016040523d82523d5f602084013e61080f565b606091505b50509050806108565760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610281565b5f546001600160a01b03166001600160a01b03167f6148672a948a12b8e0bf92a9338349b9ac890fad62a234abaf0a4da99f62cfcc8360405161089b91815260200190565b60405180910390a25050565b6108af610c79565b6001600160a01b0381166108d857604051631e4fbdf760e01b81525f6004820152602401610281565b6106ab81610ca5565b6108e9610d60565b60027f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0055565b8351602080860191909120604080517ff0543e2024fd0ae16ccb842686c2733758ec65acfd69fb599c05b286f8db8844938101939093526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691840191909152808a1660608401528816608083015260a0820187905260c082015260e08101849052610100810183905261012081018290525f906109cf906101400160405160208183030381529060405280519060200120610da2565b98975050505050505050565b5f5f5f5f6109eb88888888610dce565b9250925092506109fb8282610e96565b50909695505050505050565b60405163d505accf60e01b81526001600160a01b038781166004830152306024830152604482018790526064820186905260ff8516608483015260a4820184905260c4820183905288169063d505accf9060e4015f604051808303815f87803b158015610a72575f5ffd5b505af1925050508015610a83575060015b610b5757604051636eb1769f60e11b81526001600160a01b03878116600483015230602483015286919089169063dd62ed3e90604401602060405180830381865afa158015610ad4573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610af891906114bd565b1015610b575760405162461bcd60e51b815260206004820152602860248201527f5065726d6974206661696c656420616e6420696e73756666696369656e7420616044820152676c6c6f77616e636560c01b6064820152608401610281565b610b6c6001600160a01b038816873088610f52565b50505050505050565b610b818383835f610f8e565b610bef57610b9283835f6001610f8e565b610bba57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b610bc78383836001610f8e565b610bef57604051635274afe760e01b81526001600160a01b0384166004820152602401610281565b505050565b5f5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168385604051610c2f91906114d4565b5f6040518083038185875af1925050503d805f8114610c69576040519150601f19603f3d011682016040523d82523d5f602084013e610c6e565b606091505b509095945050505050565b5f546001600160a01b031633146106bf5760405163118cdaa760e01b8152336004820152602401610281565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006001610ff0565b905090565b6060610d217f00000000000000000000000000000000000000000000000000000000000000006002610ff0565b610bc78383836001611099565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00546002036106bf57604051633ee5aeb560e01b815260040160405180910390fd5b5f6107b2610dae6110e3565b8360405161190160f01b8152600281019290925260228201526042902090565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115610e0757505f91506003905082610e8c565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015610e58573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b038116610e8357505f925060019150829050610e8c565b92505f91508190505b9450945094915050565b5f826003811115610ea957610ea96114ea565b03610eb2575050565b6001826003811115610ec657610ec66114ea565b03610ee45760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115610ef857610ef86114ea565b03610f195760405163fce698f760e01b815260048101829052602401610281565b6003826003811115610f2d57610f2d6114ea565b03610f4e576040516335e2f38360e21b815260048101829052602401610281565b5050565b610f6084848484600161120c565b610f8857604051635274afe760e01b81526001600160a01b0385166004820152602401610281565b50505050565b60405163095ea7b360e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f873b113d1516831692505b60405250949350505050565b606060ff831461100a5761100383611279565b90506107b2565b818054611016906114fe565b80601f0160208091040260200160405190810160405280929190818152602001828054611042906114fe565b801561108d5780601f106110645761010080835404028352916020019161108d565b820191905f5260205f20905b81548152906001019060200180831161107057829003601f168201915b505050505090506107b2565b60405163a9059cbb60e01b5f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316610fe4578383151615610fd8573d5f823e3d81fd5b5f306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561113b57507f000000000000000000000000000000000000000000000000000000000000000046145b1561116557507f000000000000000000000000000000000000000000000000000000000000000090565b610d21604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b6040516323b872dd60e01b5f8181526001600160a01b038781166004528616602452604485905291602083606481808c5af1925060015f5114831661126857838315161561125c573d5f823e3d81fd5b5f883b113d1516831692505b604052505f60605295945050505050565b60605f611285836112b6565b6040805160208082528183019092529192505f91906020820181803683375050509182525060208101929092525090565b5f60ff8216601f8111156107b257604051632cd44ac360e21b815260040160405180910390fd5b5f602082840312156112ed575f5ffd5b813567ffffffffffffffff811115611303575f5ffd5b82016101c08185031215611315575f5ffd5b9392505050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b60ff60f81b8816815260e060208201525f61136860e083018961131c565b828103604084015261137a818961131c565b606084018890526001600160a01b038716608085015260a0840186905283810360c0850152845180825260208087019350909101905f5b818110156113cf5783518352602093840193909201916001016113b1565b50909b9a5050505050505050505050565b80356001600160a01b03811681146113f6575f5ffd5b919050565b5f5f6040838503121561140c575f5ffd5b611415836113e0565b946020939093013593505050565b5f60208284031215611433575f5ffd5b5035919050565b5f6020828403121561144a575f5ffd5b611315826113e0565b5f5f8335601e19843603018112611468575f5ffd5b83018035915067ffffffffffffffff821115611482575f5ffd5b602001915036819003821315611496575f5ffd5b9250929050565b5f602082840312156114ad575f5ffd5b813560ff81168114611315575f5ffd5b5f602082840312156114cd575f5ffd5b5051919050565b5f82518060208501845e5f920191825250919050565b634e487b7160e01b5f52602160045260245ffd5b600181811c9082168061151257607f821691505b60208210810361153057634e487b7160e01b5f52602260045260245ffd5b5091905056fea26469706673582212209c34db2f6f83af136a5340cce7fe8ef554ea8eb633656fbf9bff3bd731aec40f64736f6c634300081c0033000000000000000000000000ce16f69375520ab01377ce7b88f5ba8c48f8d666","id":1,"type":"ONCHAIN_INTERACTION","value":{"_kind":"bigint","value":"0"}},"type":"NETWORK_INTERACTION_REQUEST"} +{"futureId":"TokenRelayer#TokenRelayer","networkInteractionId":1,"nonce":7,"type":"TRANSACTION_PREPARE_SEND"} +{"futureId":"TokenRelayer#TokenRelayer","networkInteractionId":1,"nonce":7,"transaction":{"fees":{"maxFeePerGas":{"_kind":"bigint","value":"50000000"},"maxPriorityFeePerGas":{"_kind":"bigint","value":"50000000"}},"hash":"0xaf531425831d1f2ff7ec7a9575afcf9ad772047f66b9d8bd690cae4471076a80"},"type":"TRANSACTION_SEND"} +{"futureId":"TokenRelayer#TokenRelayer","hash":"0xaf531425831d1f2ff7ec7a9575afcf9ad772047f66b9d8bd690cae4471076a80","networkInteractionId":1,"receipt":{"blockHash":"0x33f4c7c23e9ae9a36802033f90dc09d223a1bd2d41b6ea29e4f648d6301f37e8","blockNumber":100989203,"contractAddress":"0x2d657ac14088fED401b58FEd377988ed3F875220","logs":[{"address":"0x2d657ac14088fED401b58FEd377988ed3F875220","data":"0x","logIndex":299,"topics":["0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000ec733ccc573cbb46211876149e1830c58c6133e2"]}],"status":"SUCCESS"},"type":"TRANSACTION_CONFIRM"} +{"futureId":"TokenRelayer#TokenRelayer","result":{"address":"0x2d657ac14088fED401b58FEd377988ed3F875220","type":"SUCCESS"},"type":"DEPLOYMENT_EXECUTION_STATE_COMPLETE"} \ No newline at end of file diff --git a/contracts/relayer/package.json b/contracts/relayer/package.json index 07a232ceb..5981ec161 100644 --- a/contracts/relayer/package.json +++ b/contracts/relayer/package.json @@ -19,9 +19,12 @@ "scripts": { "compile": "hardhat compile", "deploy:amoy": "hardhat ignition deploy ignition/modules/Relayer.ts --network amoy", + "deploy:arbitrum": "hardhat ignition deploy ignition/modules/Relayer.ts --network arbitrum", + "deploy:avalanche": "hardhat ignition deploy ignition/modules/Relayer.ts --network avalanche", "deploy:base": "hardhat ignition deploy ignition/modules/Relayer.ts --network base", + "deploy:bsc": "hardhat ignition deploy ignition/modules/Relayer.ts --network bsc", + "deploy:ethereum": "hardhat ignition deploy ignition/modules/Relayer.ts --network ethereum", "deploy:polygon": "hardhat ignition deploy ignition/modules/Relayer.ts --network polygon", - "deploy:arbitrum": "hardhat ignition deploy ignition/modules/Relayer.ts --network arbitrum", "node": "hardhat node", "test": "hardhat test", "test:local": "hardhat run test/local-flow.ts --network hardhat" diff --git a/docs/api/apidog/page-manifest.json b/docs/api/apidog/page-manifest.json index fbd63cee7..c9bac3280 100644 --- a/docs/api/apidog/page-manifest.json +++ b/docs/api/apidog/page-manifest.json @@ -107,6 +107,12 @@ "slug": "ai-agent-integration", "source": "docs/api/pages/12-ai-agent-integration.md", "title": "AI Agent Integration" + }, + { + "order": 13, + "slug": "kyb-deep-link", + "source": "docs/api/pages/13-kyb-deep-link.md", + "title": "KYB Deep Link" } ], "publicDocsUrl": "https://api-docs.vortexfinance.co/" diff --git a/docs/api/openapi/vortex.openapi.d.ts b/docs/api/openapi/vortex.openapi.d.ts index 7b089ed5f..221eb3747 100644 --- a/docs/api/openapi/vortex.openapi.d.ts +++ b/docs/api/openapi/vortex.openapi.d.ts @@ -196,12 +196,21 @@ export interface paths { }; requestBody?: never; responses: { + /** @description RSA-PSS public key in PEM format. */ 200: { headers: { [name: string]: unknown; }; content: { - "application/json": Record; + /** + * @example { + * "publicKey": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...replace-with-actual-key...\n-----END PUBLIC KEY-----\n" + * } + */ + "application/json": { + /** @description RSA-PSS 2048-bit public key in PEM format. Use this key to verify webhook signatures with RSA-PSS / SHA-256. */ + publicKey: string; + }; }; }; }; @@ -547,8 +556,16 @@ export interface paths { get?: never; put?: never; /** - * Generating widget URL (for existing quote) - * @description You can call this endpoint to get a widget URL ready with a quote you provide. You need to pass the `quoteId` parameter to the body, and optionally supply the `callbackUrl`, `walletAddressLocked` and `externalSessionId`. The quote will not automatically refresh and if it expires, the user needs to close the window and start over. + * Create widget session + * @description Creates a hosted Vortex Widget session and returns the URL to open for the user. + * + * This single endpoint supports two mutually exclusive request shapes: + * + * - **Fixed quote** (`GetWidgetUrlLocked`) — pass a `quoteId` you created via `POST /v1/quotes`. The widget uses that exact quote and does not refresh it. If the quote expires before the user finishes, they must close the window and start over. + * + * - **Auto-refresh** (`GetWidgetUrlRefresh`) — pass the route parameters (`network`, `rampType`, `inputAmount`, plus `fiat` / `cryptoLocked` / `paymentMethod` as relevant for the direction). The widget creates and refreshes quotes on demand for the user. + * + * Use the example switcher below to see the request shape for each mode. `externalSessionId` is required in both modes and is echoed back in webhook payloads. */ post: { parameters: { @@ -557,30 +574,60 @@ export interface paths { path?: never; cookie?: never; }; - requestBody?: { + requestBody: { content: { - /** - * @example { - * "callbackUrl": "https://www.example.com/", - * "externalSessionId": "my-session-id", - * "quoteId": "my-quote-id", - * "walletAddressLocked": "0x00000000000000000000000000000000" - * } - */ - "application/json": components["schemas"]["GetWidgetUrlLocked"]; + "application/json": components["schemas"]["GetWidgetUrlLocked"] | components["schemas"]["GetWidgetUrlRefresh"]; }; }; responses: { + /** @description Returned when a fixed-quote session was created. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + /** + * @example { + * "url": "https://widget.vortexfinance.co/?externalSessionId=my-session-id"eId=quote_01HXY..." + * } + */ + "application/json": { + /** @description The widget URL to open for the user. */ + url: string; + }; + }; + }; + /** @description Returned when an auto-refresh session was created. */ 201: { headers: { [name: string]: unknown; }; content: { + /** + * @example { + * "url": "https://widget.vortexfinance.co/?externalSessionId=my-session-id&rampType=BUY&network=polygon&inputAmount=150&fiat=BRL&cryptoLocked=USDC&paymentMethod=pix" + * } + */ "application/json": { + /** @description The widget URL to open for the user. */ url: string; }; }; }; + /** @description Missing required fields, or `quoteId` not provided for fixed-quote mode and route fields not provided for auto-refresh mode. */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Quote not found or expired (fixed-quote mode only). */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; }; }; delete?: never; @@ -1012,6 +1059,8 @@ export interface components { inputAmount: string; /** @description The currency type for the input amount. */ inputCurrency: components["schemas"]["RampCurrency"]; + /** @description Optional whitelist of networks to evaluate when searching for the best quote. If omitted or empty, all eligible networks for the corridor are considered. */ + networks?: components["schemas"]["Networks"][]; /** @description The desired currency type for the output amount. */ outputCurrency: components["schemas"]["RampCurrency"]; /** @description Your partner ID, if available. */ @@ -1095,8 +1144,16 @@ export interface components { validateLivenessToken?: string; }; ErrorResponse: { + /** @description HTTP status code returned by the API error handler. */ + code?: number; + /** @description Validation error details, when the request fails schema or input validation. */ + errors?: Record[]; /** @description A human-readable error message. */ message?: string; + /** @description HTTP status code included by selected provider-style error responses. */ + statusCode?: number; + /** @description Provider-style error category, when available. */ + type?: string; }; /** @enum {string} */ FiatToken: "EUR" | "ARS" | "BRL"; @@ -1172,15 +1229,15 @@ export interface components { /** @description The widget will redirect to this callbackUrl after the user successfully created the transaction. */ callbackUrl?: string; countryCode?: components["schemas"]["CountryCode"]; - cryptoLocked: components["schemas"]["OnChainToken"]; + cryptoLocked?: components["schemas"]["OnChainToken"]; /** @description A unique identifier for yourself to keep track of the widget session. Returned in the responses of webhooks, if registered. */ externalSessionId: string; - fiat: components["schemas"]["FiatToken"]; + fiat?: components["schemas"]["FiatToken"]; inputAmount: string; network: components["schemas"]["Networks"]; /** @description The identifier of a partner. */ partnerId?: string; - paymentMethod: components["schemas"]["PaymentMethod"]; + paymentMethod?: components["schemas"]["PaymentMethod"]; rampType: components["schemas"]["RampDirection"]; /** @description Pass this parameter if you want to lock the wallet address for the user. It will not be editable in the widget. */ walletAddressLocked?: string; @@ -1349,6 +1406,7 @@ export interface components { | "subsidizePreSwap" | "subsidizePostSwap" | "brlaTeleport" + | "onHoldForComplianceCheck" | "brlaPayoutOnMoonbeam" | "failed"; RampProcess: { @@ -2052,28 +2110,23 @@ export interface operations { /** * @description Bad Request. Possible reasons: * - Missing required fields (rampType, from, to, inputAmount, inputCurrency, outputCurrency) - * - Invalid ramp type (must be "on" or "off") + * - Invalid ramp type (must be "BUY" or "SELL") */ 400: { headers: { [name: string]: unknown; }; content: { - "application/json": Record; + "application/json": components["schemas"]["ErrorResponse"]; }; }; - /** @description Internal Server Error. */ + /** @description Internal Server Error. Low-liquidity route failures use this status with a safe user-facing message; unexpected internal failures remain masked. */ 500: { headers: { [name: string]: unknown; }; content: { - /** - * @example { - * "message": "An unexpected error occurred." - * } - */ - "application/json": Record; + "application/json": components["schemas"]["ErrorResponse"]; }; }; }; @@ -2147,23 +2200,23 @@ export interface operations { /** * @description Bad Request. Possible reasons: * - Missing required fields (rampType, from, to, inputAmount, inputCurrency, outputCurrency) - * - Invalid ramp type (must be "on" or "off") + * - Invalid ramp type (must be "BUY" or "SELL") */ 400: { headers: { [name: string]: unknown; }; content: { - "application/json": Record; + "application/json": components["schemas"]["ErrorResponse"]; }; }; - /** @description Internal Server Error. */ + /** @description Internal Server Error. Low-liquidity route failures use this status with a safe user-facing message when every eligible route cannot serve the requested amount; unexpected internal failures remain masked. */ 500: { headers: { [name: string]: unknown; }; content: { - "application/json": Record; + "application/json": components["schemas"]["ErrorResponse"]; }; }; }; diff --git a/docs/api/openapi/vortex.openapi.json b/docs/api/openapi/vortex.openapi.json index cf591bbe0..3f86cd18c 100644 --- a/docs/api/openapi/vortex.openapi.json +++ b/docs/api/openapi/vortex.openapi.json @@ -196,6 +196,13 @@ "$ref": "#/components/schemas/RampCurrency", "description": "The currency type for the input amount." }, + "networks": { + "description": "Optional whitelist of networks to evaluate when searching for the best quote. If omitted or empty, all eligible networks for the corridor are considered.", + "items": { + "$ref": "#/components/schemas/Networks" + }, + "type": "array" + }, "outputCurrency": { "$ref": "#/components/schemas/RampCurrency", "description": "The desired currency type for the output amount." @@ -292,6 +299,10 @@ "phone": { "type": "string" }, + "quoteId": { + "description": "Optional. The quote that triggered onboarding. Omit it for the quote-less KYB deep link (`?kyb` / `?kybLocked` widget entry), where business verification starts before any quote exists. Stored only as onboarding provenance; it is not an authorization input.", + "type": ["string", "null"] + }, "startDate": { "description": "Date must be in format YYYY-MMM-DD.", "format": "date", @@ -355,9 +366,28 @@ }, "ErrorResponse": { "properties": { + "code": { + "description": "HTTP status code returned by the API error handler.", + "type": "integer" + }, + "errors": { + "description": "Validation error details, when the request fails schema or input validation.", + "items": { + "type": "object" + }, + "type": "array" + }, "message": { "description": "A human-readable error message.", "type": "string" + }, + "statusCode": { + "description": "HTTP status code included by selected provider-style error responses.", + "type": "integer" + }, + "type": { + "description": "Provider-style error category, when available.", + "type": "string" } }, "type": "object" @@ -857,6 +887,7 @@ "subsidizePreSwap", "subsidizePostSwap", "brlaTeleport", + "onHoldForComplianceCheck", "brlaPayoutOnMoonbeam", "failed" ], @@ -1236,7 +1267,7 @@ "/v1/brla/createSubaccount": { "post": { "deprecated": false, - "description": "`companyName`, `startDate` and `cnpj` are only required when taxIdType is `CNPJ`\n\n**Auth:** uses `optionalAuth` \u2014 accepts a Supabase Bearer token if present but does not require one.", + "description": "`companyName`, `startDate` and `cnpj` are only required when taxIdType is `CNPJ`\n\n`quoteId` is optional: pass it in the normal ramp flow, or omit it for the quote-less KYB deep link where business verification starts before any quote exists.\n\n**Auth:** uses `optionalAuth` \u2014 accepts a Supabase Bearer token if present but does not require one.", "operationId": "createSubaccount", "parameters": [], "requestBody": { @@ -1951,32 +1982,43 @@ "3": { "summary": "Example of invalid ramp type error", "value": { - "message": "Invalid ramp type, must be \"on\" or \"off\"" + "message": "Invalid ramp type, must be \"BUY\" or \"SELL\"" } } }, "schema": { - "properties": {}, - "type": "object" + "$ref": "#/components/schemas/ErrorResponse" } } }, - "description": "Bad Request. Possible reasons:\n- Missing required fields (rampType, from, to, inputAmount, inputCurrency, outputCurrency)\n- Invalid ramp type (must be \"on\" or \"off\")", + "description": "Bad Request. Possible reasons:\n- Missing required fields (rampType, from, to, inputAmount, inputCurrency, outputCurrency)\n- Invalid ramp type (must be \"BUY\" or \"SELL\")", "headers": {} }, "500": { "content": { "application/json": { - "example": { - "message": "An unexpected error occurred." + "examples": { + "internal": { + "summary": "Unexpected internal failure", + "value": { + "code": 500, + "message": "Internal server error" + } + }, + "lowLiquidity": { + "summary": "Low-liquidity route failure", + "value": { + "code": 500, + "message": "This route is temporarily unavailable due to low liquidity. Please try a smaller amount or check back soon." + } + } }, "schema": { - "properties": {}, - "type": "object" + "$ref": "#/components/schemas/ErrorResponse" } } }, - "description": "Internal Server Error.", + "description": "Internal Server Error. Low-liquidity route failures use this status with a safe user-facing message; unexpected internal failures remain masked.", "headers": {} } }, @@ -2070,7 +2112,7 @@ "3": { "summary": "Example of invalid ramp type error", "value": { - "message": "Invalid ramp type, must be \"on\" or \"off\"" + "message": "Invalid ramp type, must be \"BUY\" or \"SELL\"" } }, "4": { @@ -2182,24 +2224,31 @@ "content": { "application/json": { "schema": { - "properties": {}, - "type": "object" + "$ref": "#/components/schemas/ErrorResponse" } } }, - "description": "Bad Request. Possible reasons:\n- Missing required fields (rampType, from, to, inputAmount, inputCurrency, outputCurrency)\n- Invalid ramp type (must be \"on\" or \"off\")", + "description": "Bad Request. Possible reasons:\n- Missing required fields (rampType, from, to, inputAmount, inputCurrency, outputCurrency)\n- Invalid ramp type (must be \"BUY\" or \"SELL\")", "headers": {} }, "500": { "content": { "application/json": { + "examples": { + "lowLiquidity": { + "summary": "Low-liquidity route failure", + "value": { + "code": 500, + "message": "This route is temporarily unavailable due to low liquidity. Please try a smaller amount or check back soon." + } + } + }, "schema": { - "properties": {}, - "type": "object" + "$ref": "#/components/schemas/ErrorResponse" } } }, - "description": "Internal Server Error.", + "description": "Internal Server Error. Low-liquidity route failures use this status with a safe user-facing message when every eligible route cannot serve the requested amount; unexpected internal failures remain masked.", "headers": {} } }, diff --git a/docs/api/pages/06-quotes-and-pricing.md b/docs/api/pages/06-quotes-and-pricing.md index e17d0f726..5bbac3f3b 100644 --- a/docs/api/pages/06-quotes-and-pricing.md +++ b/docs/api/pages/06-quotes-and-pricing.md @@ -70,6 +70,32 @@ POST /v1/quotes/best Same request body as `POST /v1/quotes`, except `to` (for buys) or `from` (for sells) may be omitted; Vortex evaluates eligible routes and returns a single quote optimized for the input amount. The response shape matches `POST /v1/quotes`. +To restrict the search to a subset of chains (for example when you only support a fixed set of destination networks), pass an optional `networks` array of network identifiers. When omitted or empty, Vortex evaluates all eligible networks for the corridor; when provided, the search is intersected with the whitelist and a `400` is returned if the intersection is empty or if any entry is not a known network identifier. + +```json +{ + "rampType": "BUY", + "from": "pix", + "inputAmount": "100", + "inputCurrency": "BRL", + "outputCurrency": "USDC", + "networks": ["base", "polygon"] +} +``` + +## Quote Error Handling + +Expected route-availability failures are returned as `500` responses with a user-facing message. The HTTP status reflects that the route exists but current pool or route liquidity cannot serve the requested amount. Clients should treat this as a user-correctable liquidity failure and ask the user to try a smaller amount or check back soon. Both `POST /v1/quotes` and `POST /v1/quotes/best` can return: + +```json +{ + "code": 500, + "message": "This route is temporarily unavailable due to low liquidity. Please try a smaller amount or check back soon." +} +``` + +For `POST /v1/quotes/best`, this low-liquidity response is returned when every eligible candidate route fails because of liquidity. Unexpected provider or calculation errors remain internal failures and should be retried or escalated with the response request ID if they persist. + ## Quote Expiry Quotes are immutable and short-lived. If the user takes too long to confirm, or if you delay before calling `POST /v1/ramp/register`, the quote expires and the register call rejects it. Catch the expiry error, create a fresh quote, and re-prompt the user before registering. diff --git a/docs/api/pages/13-kyb-deep-link.md b/docs/api/pages/13-kyb-deep-link.md new file mode 100644 index 000000000..73abfa4df --- /dev/null +++ b/docs/api/pages/13-kyb-deep-link.md @@ -0,0 +1,67 @@ +# KYB Deep Link + +The KYB deep link takes a business user straight into KYB (Know Your Business) verification from a single widget URL — **no quote required**. Use it when you want a partner's users to complete business verification ahead of, or independently from, any ramp. + +It is a variant of the [hosted widget](https://api-docs.vortexfinance.co/widget-integration): instead of `POST /v1/session/create`, you link the user directly to the widget with a KYB query parameter. + +## Flow + +``` +?kyb / ?kybLocked → email + OTP sign-in → region selector → provider KYB → "KYB Completed" screen +``` + +- **Brazil** routes to Avenia KYB. The user enters the company name and CNPJ together on the company form, then completes Avenia's hosted company and representative verification. +- **Mexico / Colombia / USA** route to the Alfredpay business KYB form (the business customer type is preselected). +- Europe is intentionally excluded — it is individual KYC only and requires a connected wallet, so it cannot complete a quote-less KYB deep link. + +After verification the user lands on a **KYB Completed** screen. *Continue* returns them to the standard quote form with the session still authenticated and the deep-link parameters stripped from the URL. + +## URL Parameters + +Append one of these to the widget URL (e.g. `https://widget.vortexfinance.co/en/widget?kyb`): + +| URL | Behavior | +|---|---| +| `?kyb` | KYB mode; the region selector is shown. | +| `?kyb=BR` \| `MX` \| `CO` \| `US` | Selector shown with the region preselected. The user can still change it. | +| `?kybLocked=BR` \| `MX` \| `CO` \| `US` | Selector skipped, region pinned, back navigation into the selector disabled. | +| `?kybLocked=BR` (specifically) | Additionally defaults the widget locale to `pt-BR`. An explicit locale in the path still wins (e.g. `/en/widget?kybLocked=BR` stays English). | +| unknown or empty region code (e.g. `?kybLocked=ZZ`, `?kybLocked`) | Degrades gracefully to the open selector; the region is **not** treated as locked. | + +Query keys are case-sensitive: use `kyb` and `kybLocked` exactly. Region codes are case-insensitive. + +## Attribution + +`externalSessionId`, `partnerId`, and `apiKey` are forwarded in KYB mode exactly as in the quoted widget flow, so partner and session attribution work the same way: + +``` +https://widget.vortexfinance.co/en/widget?kybLocked=BR&externalSessionId=my-session-id&partnerId=my-partner&apiKey=pk_live_... +``` + +Pass your partner public key (`pk_live_*` / `pk_test_*`) as `apiKey` for attribution. `externalSessionId` is your own opaque identifier and is echoed back in [webhook payloads](https://api-docs.vortexfinance.co/webhooks). + +## Embedding + +The KYB deep link is a normal widget URL, so the same embed options apply: + +```html + +``` + +```js +window.open( + "https://widget.vortexfinance.co/en/widget?kybLocked=BR&externalSessionId=my-session-id", + "vortex-kyb", + "width=480,height=760" +); +``` + +## Underlying KYB Onboarding + +For Brazil, the deep link drives `POST /v1/brla/createSubaccount` **without** a `quoteId` — the subaccount is created from the company name and CNPJ collected on the form, and the optional quote association is simply omitted. See [BRL / KYC Notes](https://api-docs.vortexfinance.co/brl-kyc-notes) for how BRLA onboarding relates to the ramp flow. + +--- diff --git a/docs/features/mykobo-eur-offramp.md b/docs/features/mykobo-eur-offramp.md new file mode 100644 index 000000000..86d8ec244 --- /dev/null +++ b/docs/features/mykobo-eur-offramp.md @@ -0,0 +1,247 @@ +# Mykobo EUR Offramp Integration Plan + +**Status**: In progress — backend ramping flow +**Owner**: this session +**Stellar EUR offramp**: untouched for now; removed in a later session after Mykobo is verified + +--- + +## Goal + +Replace the EUR offramp leg that currently runs through Stellar anchors (Spacewalk redeem → Stellar payment) with a new EVM-only flow that: + +1. Starts on any `supportsRamp: true` EVM chain (Polygon, Ethereum, BSC, Arbitrum, Base, Avalanche — **not** AssetHub, Hydration, or any substrate chain) +2. Uses Squidrouter (permit-based, AlfredPay-style) to deliver Circle USDC onto a Base EVM ephemeral account +3. Swaps USDC → EURC on Base Nabla DEX +4. Forwards EURC to Mykobo's receivables wallet (returned by their intent API) +5. Mykobo pays the user in EUR via SEPA + +KYC / profile creation is a **separate session**. This session focuses on ramping flow + quote engine only. + +--- + +## Mykobo API (https://api-dev.mykobo.app/docs/) + +### Base URLs +- Prod: `https://api.mykobo.app/v1` +- Dev: `https://api-dev.mykobo.app/v1` + +### Auth +Bearer token. Acquire via `POST /v1/auth/token` with `{access_key, secret_key}` → `{subject_id, token, refresh_token}`. Refresh via `POST /v1/auth/refresh`. Token TTL is unspecified in docs → lazy refresh on 401. + +### Required scopes (all on one token) +- `transaction:read` — list/get transactions, fees +- `transaction:write` — create intents +- `user:write` — create/get profiles (later session, but we'll request the scope now) + +### Endpoints we use in this session + +| Endpoint | Method | Purpose | +|---|---|---| +| `/v1/auth/token` | POST | Acquire bearer + refresh | +| `/v1/auth/refresh` | POST | Refresh bearer | +| `/v1/transactions/intent` | POST | Create `WITHDRAW` intent → returns `instructions.address` (Mykobo's receivables wallet) and `transaction.id` | +| `/v1/transactions/{id}` | GET | Poll status until `COMPLETED` (or fail states) | +| `/v1/fees` | GET `?value=X&kind=withdraw&client_domain=Y` | Returns fee in EURC (already correct currency) | + +### Endpoints used in later session (KYC) +- `POST /v1/profiles` (multipart, KYC docs) +- `GET /v1/profiles?email=` (lookup profile by email) + +### Critical Mykobo semantics + +- **Intent body fields**: `transaction_type="WITHDRAW"`, `wallet_address` (ephemeral 0x), `email_address` (persistent identity — auto-binds new ephemeral on each ramp), `value`, `currency="EURC"`, `ip_address`, optional `client_domain`. +- **WITHDRAW response** contains `instructions.address` = the **destination address we must send EURC to** (Mykobo's receivables wallet). It is **not** the user's IBAN. The user's IBAN is on their KYC'd profile; Mykobo pays out from their side. +- **Profile resolution errors**: + - `404 profile_not_found` — surface as registration error + - `403 kyc_required` — surface with `kyc_status` field to route to KYC flow + - `409 wallet_email_mismatch` — should not happen in our flow because Mykobo auto-binds on first use; if it does, surface +- **Fees**: returns `{total, asset: "EURC", details: [...]}`. When `client_domain` is set, fees come back in EURC for both deposit and withdraw kinds. + +--- + +## Locked Design Decisions + +| Decision | Choice | Reason | +|---|---|---| +| Source chains | All EVM chains with `supportsRamp: true` | Matches AlfredPay model | +| USDC → EURC swap venue | Nabla EURC pool on Base (`NABLA_ROUTER_BASE_EURC` / `NABLA_QUOTER_BASE_EURC`, selected via `getNablaBasePool()`) | Dedicated EURC<>USDC pool, separate from the BRLA<>USDC pool used by BRL flows | +| `wallet_address` on Mykobo intent | Ephemeral 0x | Mykobo auto-binds email→ephemeral; identity is email-based | +| When to create intent | At ramp **registration** (`prepareEvmToMykoboOfframpTransactions`) | Lets us presign the final EURC transfer to Mykobo's receivables address (BRL-EVM style) | +| Email source | Frontend reads the Supabase-authenticated user's email and passes it as the `email` query param to `GET /v1/mykobo/profiles`; backend cross-checks the param against `req.userEmail` and queries Mykobo by email via `MykoboApiService.getProfileByEmail` | Aligns with Supabase-auth profile model; avoids leaking wallet→profile linkage | +| Identity persistence | JSONB only on `RampState.state` (no new `MykoboCustomer` table yet) | "No over-engineering" rule; KYC session can normalize later | +| Mykobo client style | Singleton class mirroring `BrlaApiService` | Repo convention; easy mocking | +| Token strategy | Single shared bearer with all 3 scopes, lazy init, 401→refresh→re-acquire | Simplest robust model; matches docs | +| Fee currency | Returned as EURC directly from Mykobo (no conversion) | Confirmed by user with live API output | +| Anchor record | New migration file `0XX-mykobo-anchor.ts` inserting `mykobo_eurc` | Migrations are append-only | +| Permit pattern (cross-chain) | Reuse AlfredPay's `squidRouterPermitExecute` phase + `TokenRelayer.execute()` | TokenRelayer at `0xC9ECD03c89349B3EAe4613c7091c6c3029413785` (Polygon); for EUR offramp, Squidrouter brings funds onto **Base** ephemeral. If source chain doesn't support permit, fall back to `squidRouterApprove + squidRouterSwap` (same as AlfredPay no-permit fallback) | +| Stellar code | **Do not touch** in this session | Remove after Mykobo flow verified end-to-end | + +--- + +## Phase Sequence (EUR-EVM Offramp via Mykobo on Base) + +Mirror of BRL-EVM (`evm-to-brl-base.ts`) with USDC→EURC and Mykobo payout. + +``` +[User wallet, source EVM chain] + squidRouterApprove (nonce 0, source chain) — user approves squid router for input token + squidRouterSwap (nonce 1, source chain) — user swaps via squid → USDC lands on Base ephemeral + ─ OR (when permit supported) ─ + squidRouterPermitExecute — executor calls TokenRelayer.execute(permit + payload) + ─ OR (when permit NOT supported AND same chain) ─ + squidRouterNoPermitTransfer — direct transfer to ephemeral (Base only) + +[Backend executor / Base ephemeral] + fundEphemeral — backend sends ETH for gas + distributeFees (nonce 0, Base) — USDC fee slice to fee wallet + nablaApprove (nonce 1, Base) — approve Nabla router for USDC + nablaSwap (nonce 2, Base) — USDC → EURC on Base Nabla + mykoboPayoutOnBase (nonce 3, Base) — EURC transfer to Mykobo receivables address + → backend polls GET /v1/transactions/{id} until COMPLETED + complete + +[Cleanup — post-process worker] + baseCleanupUsdc (nonce 4, Base) — approve funding account to sweep residual USDC + baseCleanupEurc (nonce 5, Base) [NEW] — approve funding account to sweep residual EURC + baseCleanupAxlUsdc (nonce 6, Base) — approve funding account to sweep axlUSDC slippage +``` + +**Special case**: if user is already on Base with USDC, skip the squidrouter leg entirely (same shortcut as BRL-EVM line 73). + +--- + +## Quote Engine Pipeline + +New strategy `offrampToSepaEvmStrategy`, mirrors `offrampToPixEvmStrategy`: + +``` +[StageKey.Initialize] OffRampFromEvmInitializeEngine(Networks.Base) [squid quote → Base USDC] +[StageKey.NablaSwap] OffRampSwapEngineEvm(EvmToken.EURC) [USDC → EURC on Base Nabla] +[StageKey.Fee] OffRampFeeMykoboEngine [NEW] [GET /v1/fees → EURC fee] +[StageKey.Discount] OffRampDiscountEngine +[StageKey.MergeSubsidy] OffRampMergeSubsidyEvmEngine +[StageKey.Finalize] OffRampFinalizeEngine +``` + +Route resolver dispatch (in `route-resolver.ts`): + +```ts +case "sepa": + return ctx.from !== Networks.AssetHub + ? offrampToSepaEvmStrategy // EVM source → Mykobo + : offrampToStellarStrategy; // substrate source → Stellar (unchanged) +``` + +This preserves the Stellar EUR path for AssetHub sources (we'll remove it in a later session). + +--- + +## File Inventory + +### New files (8) + +1. `packages/shared/src/services/mykobo/types.ts` — request/response types +2. `packages/shared/src/services/mykobo/mykoboApiService.ts` — singleton HTTP client +3. `packages/shared/src/services/mykobo/index.ts` — re-exports +4. `apps/api/src/api/services/transactions/offramp/routes/evm-to-mykobo.ts` — presigned tx builder +5. `apps/api/src/api/services/phases/handlers/mykobo-payout-handler.ts` — payout handler +6. `apps/api/src/api/services/quote/engines/fee/offramp-mykobo.ts` — fee engine +7. `apps/api/src/api/services/quote/routes/strategies/offramp-to-sepa-evm.strategy.ts` — strategy +8. `apps/api/src/database/migrations/0XX-mykobo-anchor.ts` — anchor seed migration + +### Modified files (~12) + +1. `packages/shared/src/tokens/types/evm.ts` — add `EURC = "EURC"` to `EvmToken` +2. `packages/shared/src/tokens/evm/config.ts` — EURC entry for `Networks.Base` (`0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42`, 6 decimals); optionally `BaseSepolia` +3. `packages/shared/src/constants/constants.ts` or `apps/api/src/constants/vars.ts` — add `MYKOBO_BASE_URL`, `MYKOBO_ACCESS_KEY`, `MYKOBO_SECRET_KEY`, `MYKOBO_CLIENT_DOMAIN` env vars +4. `apps/api/src/api/services/phases/meta-state-types.ts` — add `mykoboEmail`, `mykoboTransactionId`, `mykoboReceivablesAddress`, `mykoboPayoutTxHash`, `mykoboTransactionReference` +5. `apps/api/src/api/controllers/ramp.controller.ts` + `apps/api/src/api/services/ramp/ramp.service.ts` — accept optional `email` on `POST /v1/ramp/register`; thread to `prepareOfframpTransactions` +6. `apps/api/src/api/services/transactions/offramp/index.ts` — add dispatch branch for EUR EVM +7. `apps/api/src/api/services/ramp/ramp-transaction-preparation.ts` — add `OfframpMykobo` discriminator (next to `OfframpBrl`) +8. `apps/api/src/api/services/phases/handlers/fund-ephemeral-handler.ts` — extend `getRequiresBaseEphemeralAddress()` for EUR offramp +9. `apps/api/src/api/services/phases/register-handlers.ts` — register `MykoboPayoutOnBasePhaseHandler` +10. `apps/api/src/database/seeders/phase-metadata.seeder.ts` (or equivalent) — register `mykoboPayoutOnBase` and `baseCleanupEurc` phases + valid transitions +11. `apps/api/src/api/services/quote/routes/route-resolver.ts` — add EVM-source branch for `sepa` case +12. `apps/api/src/api/services/quote/core/quote-fees.ts` — use `mykobo_eurc` anchor identifier when `to=sepa` and source is EVM +13. `apps/api/src/api/services/phases/post-process/base-chain-post-process-handler.ts` — add `baseCleanupEurc` to cleanup sweep + +### Touch validation +- `apps/api/src/api/services/transactions/onramp/common/validation.ts:122` — currently enforces `inputCurrency === FiatToken.EURC` for onramp. **Onramp path is unaffected**; we're only adding offramp. Do not touch. +- `apps/api/src/api/services/transactions/offramp/index.ts:33` — currently `outputCurrency === FiatToken.EURC && moneriumAuthToken` routes to Monerium. Our new branch is `outputCurrency === FiatToken.EURC && isEvmSource && !moneriumAuthToken → Mykobo`. Monerium path stays as fallback for clients that still pass `moneriumAuthToken`. + +--- + +## State Metadata Fields (new on `StateMetadata`) + +```ts +mykoboEmail?: string; // persistent identity passed by frontend +mykoboTransactionId?: string; // UUID returned by POST /v1/transactions/intent (for polling) +mykoboTransactionReference?: string; // human reference from intent response +mykoboReceivablesAddress?: `0x${string}`; // instructions.address from intent (the destination of mykoboPayoutOnBase) +mykoboPayoutTxHash?: `0x${string}`; // on-chain hash of the EURC transfer (recovery support) +``` + +--- + +## Anchor record + +Insert into `Anchor` table: + +```ts +{ + identifier: "mykobo_eurc", + name: "Mykobo (EUR via Base)", + // ... whatever other fields the model requires (TBD by reading model) +} +``` + +`OffRampFeeMykoboEngine` will look it up via the same path as `offramp-avenia` does for `avenia` anchor. + +--- + +## Env Vars (new) + +| Var | Required | Default | Purpose | +|---|---|---|---| +| `MYKOBO_BASE_URL` | yes | — | `https://api-dev.mykobo.app/v1` (dev) or `https://api.mykobo.app/v1` (prod) | +| `MYKOBO_ACCESS_KEY` | yes | — | from Mykobo dashboard | +| `MYKOBO_SECRET_KEY` | yes | — | from Mykobo dashboard | +| `MYKOBO_CLIENT_DOMAIN` | no | (Mykobo defaults to `.mykobo.app`) | client domain for fee scope (e.g. `satoshipay.io`) | + +--- + +## Existing infrastructure reused (no changes needed) + +- ✅ `Networks.Base` configured with `supportsRamp: true` +- ✅ `NABLA_ROUTER_BASE_EURC` + `NABLA_QUOTER_BASE_EURC` constants (EURC pool) and `getNablaBasePool()` selector +- ✅ `calculateNablaSwapOutputEvm()` quote-time helper +- ✅ `addNablaSwapTransactionsOnBase()` tx builder +- ✅ `getEvmFundingAccount(Networks.Base)` for ephemeral derivation +- ✅ `FundEphemeralPhaseHandler.fundEvmEphemeralAccount(state, Networks.Base)` (needs `getRequiresBaseEphemeralAddress` extension) +- ✅ `BaseChainPostProcessHandler` cleanup sweep +- ✅ `createOfframpSquidrouterTransactionsToEvm()` for cross-chain bridge +- ✅ `SquidrouterPermitExecuteHandler` for permit + TokenRelayer +- ✅ `prepareBaseCleanupApproval()` for cleanup approvals +- ✅ `addEvmFeeDistributionTransaction()` for distributing protocol fees + +--- + +## Out of scope for this session + +- KYC / profile creation (`POST /v1/profiles`) — separate session +- Frontend changes +- SDK changes +- Removing Stellar EUR code — explicitly deferred to avoid merge conflicts during build-out +- ARS offramp (still goes through Stellar; Mykobo doesn't replace it) + +--- + +## Verification at end of session + +1. `bun build:shared` +2. `bun typecheck` clean +3. `bun lint:fix` clean +4. Manual: can a quote request with `from=Base, inputCurrency=USDC, to=sepa, outputCurrency=EUR` produce a quote routed through `offrampToSepaEvmStrategy`? +5. Manual: does `POST /v1/ramp/register` accept `email` and call Mykobo intent API? +6. Integration test with Mykobo dev credentials (deferred to a follow-up — needs credential setup). diff --git a/docs/security-spec/00-system-overview/architecture.md b/docs/security-spec/00-system-overview/architecture.md index a4384a42f..1af5b1112 100644 --- a/docs/security-spec/00-system-overview/architecture.md +++ b/docs/security-spec/00-system-overview/architecture.md @@ -2,7 +2,7 @@ ## What This Does -Vortex is a cross-border payment gateway built on the Pendulum blockchain. It converts between fiat currencies (BRL, EUR, ARS) and crypto assets across multiple chains (Pendulum, Moonbeam, Stellar, AssetHub, Hydration, Polygon). The system is a Bun monorepo with four main components: +Vortex is a cross-border payment gateway built on the Pendulum blockchain. It converts between fiat currencies (BRL, EUR, ARS) and crypto assets across multiple chains (Pendulum, Moonbeam, Stellar, AssetHub, Hydration, Polygon, Base). The system is a Bun monorepo with four main components: - **API** (`apps/api`) — Express backend handling ramp orchestration, quote generation, auth, and external service integration - **Frontend** (`apps/frontend`) — React SPA for end-user flows @@ -36,7 +36,7 @@ Vortex is a cross-border payment gateway built on the Pendulum blockchain. It co │ ┌────▼────┐ ┌────▼────┐ ┌───▼──────┐ ┌──▼──────────────┐ │ │ │Postgres │ │Supabase │ │Chains │ │External APIs │ │ │ │(DB) │ │(Auth) │ │(RPC) │ │(BRLA/Avenia, │ │ -│ └─────────┘ └─────────┘ │Pendulum │ │ Monerium, │ │ +│ └─────────┘ └─────────┘ │Pendulum │ │ Mykobo, │ │ │ │Moonbeam │ │ Alfredpay, │ │ │ │Stellar │ │ Squid, Stellar) │ │ │ │AssetHub │ └─────────────────┘ │ @@ -63,7 +63,7 @@ Vortex is a cross-border payment gateway built on the Pendulum blockchain. It co 2. **Trust boundaries MUST be enforced at the middleware layer** — auth checks happen before controller logic, never inside controllers. 3. **The API server MUST NOT hold user private keys** — ephemeral keys are generated client-side (SDK/frontend). The server only receives addresses, never secrets. 4. **Server-held secrets (funding keys, executor keys) MUST only be used for platform operations** — funding ephemeral accounts, executing subsidization, signing webhooks. Never for user-initiated transactions on behalf of the user's own assets. -5. **All external service calls (BRLA, Monerium, Alfredpay, chain RPCs) MUST be treated as untrusted** — responses must be validated, timeouts enforced, and failures handled without corrupting ramp state. +5. **All external service calls (BRLA, Mykobo, Alfredpay, chain RPCs) MUST be treated as untrusted** — responses must be validated, timeouts enforced, and failures handled without corrupting ramp state. 6. **Database state MUST be the single source of truth for ramp progress** — in-memory state is transient and may be lost on restart. 7. **No single component compromise should grant access to all user funds** — the system should limit blast radius through key separation and least-privilege access. 8. **All inter-chain transfers MUST be verified on both source and destination** — sending a transfer is not sufficient; the system must confirm receipt before advancing phases. @@ -75,18 +75,18 @@ Vortex is a cross-border payment gateway built on the Pendulum blockchain. It co | **Unauthorized ramp initiation** | Attacker starts ramps without valid auth, draining liquidity | Auth middleware on all ramp endpoints; quote binding to authenticated session | | **Server compromise** | Attacker gains access to API server, extracts env vars | Key separation (different keys per chain), rotation procedures, minimal secrets in memory | | **Stale RPC data** | Chain RPC returns outdated balances, causing incorrect subsidization | Verify balances at point of use, not cached; cross-check with on-chain finality | -| **External API manipulation** | BRLA/Monerium returns manipulated amounts | Validate external responses against quoted amounts; bound acceptable variance | +| **External API manipulation** | BRLA/Mykobo/Alfredpay returns manipulated amounts | Validate external responses against quoted amounts; bound acceptable variance | | **Database tampering** | Attacker with DB access modifies ramp state to skip phases | Phase transition validation in code (not just DB constraints); audit logging of all state changes | | **Cross-chain message failure** | XCM transfer succeeds on source but fails on destination | Phase handlers wait for destination confirmation before advancing; timeout + retry logic | | **Rebalancer key theft** | Rebalancer's chain keys compromised | Rebalancer uses dedicated keys separate from main API; limited balances; monitoring for unexpected transfers | ## Audit Checklist -- [x] Every route in `apps/api/src/api/routes/v1/` has appropriate auth middleware applied — **PASS: F-013 resolved. Legacy fundEphemeral/execute-xcm/subsidize endpoints removed. `/v1/ramp/*` and `/v1/ramp/quotes(/best)` enforce `requirePartnerOrUserAuth()` with per-principal ownership guards. `/v1/brla/*`, `/v1/maintenance/*`, `/v1/webhook/*` use `requireAuth`/`adminAuth`/`apiKeyAuth` respectively.** +- [x] Every route in `apps/api/src/api/routes/v1/` has appropriate auth middleware applied — **PASS: F-013 resolved. Legacy fundEphemeral/execute-xcm/subsidize endpoints removed. `/v1/ramp/*` and `/v1/ramp/quotes(/best)` enforce `requirePartnerOrUserAuth()` with per-principal ownership guards. `/v1/brla/*`, `/v1/mykobo/profiles` (F-068 resolved), `/v1/maintenance/*`, `/v1/webhook/*` use `requireAuth`/`adminAuth`/`apiKeyAuth` respectively.** - [FAIL] No controller directly accesses `process.env` for secrets — all go through `config/vars.ts` — **F-016: `PENDULUM_FUNDING_SEED` accessed directly in `pendulum.service.ts`; also `SLACK_WEB_HOOK_TOKEN`, `COINGECKO_API_KEY`** - [x] Ephemeral key secrets never appear in API request/response payloads or logs - [x] Phase processor always reads fresh state from DB before executing a phase (no stale cache) -- [FAIL] All external API calls have timeout configuration — **F-014: Most `fetch()` calls lack timeout/AbortController (Monerium, price feeds, Subscan, etc.)** +- [FAIL] All external API calls have timeout configuration — **F-014: Most `fetch()` calls lack timeout/AbortController (Mykobo, price feeds, Subscan, etc.)** - [PARTIAL] Error responses never leak internal state, stack traces, or secret material — **F-015: Stack traces stripped in prod, but raw `err.message` leaks in some paths** - [N/A] Database connection uses TLS in production — **F-017: Not configured in Sequelize options; relies on server-side enforcement** - [x] Rate limiting is applied at the network edge before auth middleware diff --git a/docs/security-spec/01-auth/admin-auth.md b/docs/security-spec/01-auth/admin-auth.md index 9729b221e..ec30bfc49 100644 --- a/docs/security-spec/01-auth/admin-auth.md +++ b/docs/security-spec/01-auth/admin-auth.md @@ -2,7 +2,7 @@ ## What This Does -Admin authentication protects internal/operational endpoints (partner management, system configuration, diagnostics). It uses a single shared secret (`ADMIN_SECRET` env var) compared via Bearer token. +Admin authentication protects internal/operational endpoints that can mutate system state or manage partners. It uses a single shared secret (`ADMIN_SECRET` env var) compared via Bearer token. Read-only access to client observability endpoints uses a separate `METRICS_DASHBOARD_SECRET` so a metrics token compromise does not grant broader admin access. The flow: 1. Admin includes `Authorization: Bearer ` header diff --git a/docs/security-spec/01-auth/supabase-otp.md b/docs/security-spec/01-auth/supabase-otp.md index 1765dcc49..5a6a03752 100644 --- a/docs/security-spec/01-auth/supabase-otp.md +++ b/docs/security-spec/01-auth/supabase-otp.md @@ -39,7 +39,7 @@ Two middleware variants exist: ## Audit Checklist -- [x] `requireAuth` is applied to all endpoints that mutate ramp state, access user data, or perform privileged operations — **PASS: F-013 resolved. `/v1/ramp/*` endpoints now use `requirePartnerOrUserAuth()` (sk_ partner key OR Supabase Bearer) with ownership guards; `/v1/brla/*` uses `requireAuth`; admin and webhook routes use `adminAuth`/`apiKeyAuth`.** +- [x] `requireAuth` is applied to all endpoints that mutate ramp state, access user data, or perform privileged operations — **PASS: F-013 resolved. `/v1/ramp/*` endpoints now use `requirePartnerOrUserAuth()` (sk_ partner key OR Supabase Bearer) with ownership guards; `/v1/brla/*` uses `requireAuth`; `/v1/mykobo/profiles` (GET + POST) uses `requireAuth` (F-068 resolved); admin and webhook routes use `adminAuth`/`apiKeyAuth`.** - [x] `optionalAuth` is only used on endpoints where unauthenticated access is intentionally allowed (e.g., public quote lookup) — **PASS** - [x] `SupabaseAuthService.verifyToken()` uses the service role key, not the anon key — **FAIL: Uses anon-key client (F-018). Functionally correct but deviates from spec.** - [x] The `Bearer ` prefix check uses `startsWith("Bearer ")` with the trailing space (not just `"Bearer"`) — **PASS** diff --git a/docs/security-spec/02-signing-keys/ephemeral-accounts.md b/docs/security-spec/02-signing-keys/ephemeral-accounts.md index 989a713e1..a96f09b49 100644 --- a/docs/security-spec/02-signing-keys/ephemeral-accounts.md +++ b/docs/security-spec/02-signing-keys/ephemeral-accounts.md @@ -12,6 +12,10 @@ Ephemeral accounts are temporary blockchain accounts created per ramp operation. The SDK optionally stores ephemeral keys to a local JSON file (`ephemerals_{rampId}.json`) via the `storeEphemeralKeys` config option (defaults to `true`). +The frontend stores a backup of all ephemeral keypairs in `localStorage["rampEphemerals"]` as a `Record`, keyed by ramp ID. This is persisted by the `PersistenceEffect` in `apps/frontend/src/contexts/rampState.tsx` and is **not** cleared when the ramp context resets (unlike the main `rampState` localStorage item). The purpose is a user-side failsafe: if a ramp fails mid-flow and the main state is wiped, the ephemeral secret keys remain recoverable from this separate localStorage entry. + +Frontend and SDK Substrate RPC clients are initialized lazily. Creating/importing frontend API services, mounting the Polkadot node provider, constructing the SDK, or entering ramp registration MUST NOT open Pendulum, Moonbeam, Hydration, or AssetHub websocket connections by default. A Substrate RPC may be opened only when the active UI component explicitly asks for that node, or after ramp registration returns unsigned transactions that actually require Substrate-format signing on that network. For example, an EUR→Base EURC Mykobo on-ramp should not initialize Moonbeam solely because the frontend imports `services/api` or because the generic register actor runs. + ## Security Invariants 1. **Ephemeral private keys MUST be generated client-side** — The API MUST never generate, receive, store, or have access to ephemeral private keys. Only addresses (`accountMetas`) are sent to the API. @@ -22,6 +26,9 @@ The SDK optionally stores ephemeral keys to a local JSON file (`ephemerals_{ramp 6. **Stellar ephemeral funding MUST use a bounded starting balance** — The `STELLAR_EPHEMERAL_STARTING_BALANCE_UNITS` constant defines the XLM sent to new ephemerals. This should be the minimum needed for operations (trustlines + transaction fees), not more. 7. **The API MUST NOT assume the ephemeral address belongs to an honest user** — An attacker could register a ramp with an address they don't control or an address that's a contract (on EVM). Phase handlers must account for this. 8. **Pre-signed transactions MUST be bound to the specific ephemeral address** — Transactions generated by the API for client signing must include the ephemeral address as the source/signer, not a wildcard. +9. **Ephemeral addresses MUST be proven fresh on every chain the platform supports, at ramp registration time** — Before building any transactions, the API MUST verify on-chain that each submitted ephemeral address has zero nonce / zero balance / does not exist (chain-appropriate definition) on every supported chain of its type — not only the chains the specific ramp route will use. Checking the full supported set (rather than a route-derived subset) prevents a future phase-handler addition from silently reopening the freshness gap. Freshness checks MUST fail closed: any RPC error rejects the registration. Reused ephemerals cause mid-ramp halt because the server assumes a clean nonce and (for Stellar) creates the account from scratch. +10. **Frontend `rampEphemerals` localStorage backup MUST be local-only** — The `rampEphemerals` localStorage item stores ephemeral secret keys as plaintext in the browser. It MUST NOT be transmitted to any server, included in analytics, or accessible to third-party scripts. This backup exists solely as a user-side failsafe for debugging failed ramps. +11. **Client-side Substrate APIs MUST be opened only on demand** — The frontend register actor and SDK signing path MUST inspect the returned unsigned transactions before requesting Pendulum/Moonbeam/Hydration APIs. EVM-format transactions on Moonbeam-compatible chains must use EVM signing clients and MUST NOT force `ApiPromise` initialization. Legacy frontend service singletons MUST NOT create websocket connections in constructors or module-level exports. ## Threat Vectors & Mitigations @@ -33,6 +40,9 @@ The SDK optionally stores ephemeral keys to a local JSON file (`ephemerals_{ramp | **Funding account drain** | Attacker creates many ramps to drain the Stellar funding account's XLM balance | Rate limiting on ramp creation; monitoring funding account balance; bounded starting balance | | **Orphaned ephemerals** | Ramp fails mid-way, leaving funded ephemeral accounts unclaimed | Stellar 2-of-2 multisig allows the funding account to reclaim funds; Substrate/EVM ephemerals can be swept by the key holder | | **Malicious ephemeral address (contract)** | On EVM, attacker provides a smart contract address as ephemeral, which could behave unexpectedly when receiving tokens | Validate that EVM ephemeral addresses are externally-owned accounts (EOAs), not contracts, before sending funds | +| **Reused / non-fresh ephemeral** | Client (buggy SDK, attacker, or replay) submits an ephemeral address that already has on-chain history — non-zero nonce on Substrate/EVM, or an existing Stellar account. The server builds transactions assuming nonce 0 / no account, so mid-ramp execution halts with nonce-mismatch or "account already exists" errors after subsidies/funding have been spent. | **MITIGATED (F-072)**: `validateEphemeralAccountsFresh()` runs in `registerRamp` immediately after format validation. For each ephemeral type the client provides, it queries every supported chain of that type (Substrate: pendulum, hydration, assethub; EVM: all configured EVM networks including Moonbeam; Stellar) and rejects the registration if any check finds non-zero nonce / non-zero free balance / pre-existing Stellar account. Fail-closed on RPC errors. | +| **XSS access to `rampEphemerals` localStorage** | An XSS vulnerability could read `localStorage["rampEphemerals"]` to steal ephemeral secret keys for in-flight ramps. Unlike `rampState` (which is wiped on reset), `rampEphemerals` persists across ramp resets, widening the attack window. | The entry is plaintext in localStorage with no additional encryption. Mitigation relies on the same XSS defenses that protect auth tokens and other localStorage secrets (CSP, input sanitization, no `eval`). The `rampEphemerals` map accumulates entries over time — users or support should clear it after debugging. `removeRampEphemeral(rampId)` is exported for targeted cleanup. | +| **Unneeded Substrate RPC initialization** | A route that does not use a Substrate network (for example EUR→Base EURC) imports a frontend service barrel or enters registration and accidentally opens Moonbeam/Pendulum websockets, creating timeout noise and coupling route availability to unrelated RPC health. | Frontend service wrappers defer `createApiComponents(...)` until `getApi()` is called. The register actor requests Pendulum/Moonbeam/Hydration APIs only after filtering returned `ephemeralTxs`, and only for networks whose transaction format requires Substrate signing. Normal EVM transaction signing does not request a Moonbeam `ApiPromise`. | ## Audit Checklist @@ -46,3 +56,7 @@ The SDK optionally stores ephemeral keys to a local JSON file (`ephemerals_{ramp - [x] Each call to `generateEphemerals()` produces fresh, unique keypairs — no memoization or caching — ✅ PASS - [x] Unsigned transactions returned to the client are bound to the specific ephemeral addresses provided during registration — ✅ PASS - [ ] The API does not trust that an ephemeral address is an EOA on EVM — verify if contract address detection is needed — 🟡 PARTIAL (no check, but low self-harm risk) +- [x] **F-072**: Each submitted ephemeral address is verified fresh on every supported chain of its type at `registerRamp` — `validateEphemeralAccountsFresh()` in `apps/api/src/api/services/ramp/ephemeral-freshness.ts`, invoked after `normalizeAndValidateSigningAccounts`. Substrate (pendulum, hydration, assethub): `nonce === 0 && free === 0`. EVM (all configured EVM networks): `nonce === 0`. Stellar: account must not exist on Horizon. The supported-network lists `SUPPORTED_SUBSTRATE_NETWORKS` and `SUPPORTED_EVM_NETWORKS` MUST be updated whenever the platform adds a new chain an ephemeral can ever sign on. Fail-closed on RPC errors (`SERVICE_UNAVAILABLE`). — ✅ PASS +- [x] Frontend `rampEphemerals` localStorage backup writes only from the `PersistenceEffect` in `rampState.tsx` — no network calls, no third-party access — ✅ PASS +- [x] `rampEphemerals` entries are keyed by ramp ID and accumulate across ramp resets — `removeRampEphemeral()` is exported for cleanup — ✅ PASS +- [x] Frontend/SDK Substrate RPC initialization is lazy and transaction-demand driven — `apps/frontend/src/machines/actors/register.actor.ts` requests Pendulum/Moonbeam/Hydration APIs only for returned `ephemeralTxs` that need those networks; `packages/sdk/src/services/NetworkManager.ts` initializes each API through async getters; `apps/frontend/src/services/api/{moonbeam,pendulum}.service.ts` no longer opens websockets at module import time. — ✅ PASS diff --git a/docs/security-spec/03-ramp-engine/discount-mechanism.md b/docs/security-spec/03-ramp-engine/discount-mechanism.md index 5e786f09b..36a507982 100644 --- a/docs/security-spec/03-ramp-engine/discount-mechanism.md +++ b/docs/security-spec/03-ramp-engine/discount-mechanism.md @@ -6,15 +6,15 @@ The discount stage decides whether the platform tops up a swap result so the use For each quote, the discount engine: -1. Resolves an `ActivePartner` row (the request's `partnerId`, or the system default `vortex`). +1. Resolves an `ActivePartner` row for pricing. The source can be an explicit partner-owned request, a validated public-key partner, a profile assignment's ramp-specific partner ID, or the system default `vortex`. 2. Reads two partner-scoped parameters: - `targetDiscount` — the discount to advertise. A positive `targetDiscount` means the user receives **more** than the oracle implies (e.g. `targetDiscount=0.005` means the rate offered is 0.5% better than the oracle rate). - `maxSubsidy` — a fractional cap on the subsidy as a share of expected output. -3. Reads dynamic state `partnerDiscountState[partner.id]`, which holds a `difference` value that drifts up while no quote is consumed and back down once a quote is consumed, bounded by `[minDynamicDifference, maxDynamicDifference]`. +3. Reads dynamic state `partnerDiscountState[partner.id]`, keyed by the pricing partner, which holds a `difference` value that drifts up while no quote is consumed and back down once a quote is consumed, bounded by `[minDynamicDifference, maxDynamicDifference]`. 4. Calculates `expectedOutput = inputAmount × oraclePrice × (1 + targetDiscount + adjustedDifference)`. For offramps the oracle price is inverted first. 5. Calculates `actualOutput` as what the user would receive without subsidy (Nabla output minus post-swap fees on onramp, anchor fee added back on offramp). 6. Calculates `idealSubsidy = max(0, expectedOutput − actualOutput)` and `actualSubsidy = min(idealSubsidy, maxSubsidy × expectedOutput)` (only when `targetDiscount > 0`). -7. Writes a `ctx.subsidy` record consumed by downstream merge-subsidy and finalize stages and ultimately by the subsidy phase handlers. +7. Writes a `ctx.subsidy` record consumed by downstream merge-subsidy and finalize stages and ultimately by the subsidy phase handlers. On EVM post-swap routes this record represents the discount-derived subsidy component only; the runtime handler may additionally cover actual-vs-quoted swap-output discrepancy, which is capped separately. The engine is wired by strategy configuration. Of the 10 route strategies in `apps/api/src/api/services/quote/routes/strategies/`, 9 register a discount engine and 1 does **not**: `onramp-monerium-to-evm`. On that single route, no subsidy is computed regardless of partner configuration. @@ -30,13 +30,15 @@ For onramps to EVM destinations other than AssetHub, the engine also probes Squi 1. **Subsidy amount MUST be bounded by `maxSubsidy × expectedOutput`** — when `maxSubsidy > 0`, `calculateSubsidyAmount` clamps the shortfall to `expectedOutput × maxSubsidy`; for higher caps, the full shortfall is paid. The cap MUST always be enforced from the partner row, never from the request. 2. **Discount parameters MUST come from the database**, never from the API request. The engine reads `targetDiscount`, `maxSubsidy`, `minDynamicDifference`, `maxDynamicDifference` from a Sequelize `Partner` row. No request field overrides them. 3. **Dynamic-difference clamping MUST hold both ends.** `getAdjustedDifference` enforces `≤ maxDynamicDifference`; `handleQuoteConsumptionForDiscountState` enforces `≥ minDynamicDifference`. A partner with no caps configured behaves as if both caps were `0` (no dynamic adjustment). -4. **The default partner row (`name = "vortex"`) MUST exist and MUST be `isActive`.** `resolveDiscountPartner` falls back to it when the request supplies no partner or the partner row is inactive. Without an active default, discount computation produces a `null` partner and `targetDiscount=0`, silently disabling subsidies platform-wide. +4. **The default partner row (`name = "vortex"`) MUST exist and MUST be `isActive`.** Discount partner resolution falls back to it when no non-default pricing partner applies or the referenced pricing partner row is inactive. Without an active default, discount computation produces a `null` partner and `targetDiscount=0`, silently disabling subsidies platform-wide. 5. **`targetDiscount` MUST be expressed as a fractional rate (not basis points).** It is added directly to `1` in `calculateExpectedOutput`: `effectivePrice × (1 + targetDiscount + adjustedDifference)`. A value of `0.005` means 0.5%. 6. **Subsidy MUST NOT bypass fee collection.** For onramps, `actualOutput = nablaOutput − (network + vortex + partnerMarkup)`. The subsidy then covers the shortfall against `expectedOutput` *after* those fees, so fees still flow to fee accounts. 7. **For offramps, the anchor fee MUST be added back to `expectedOutput`** before computing the shortfall (`adjustedExpectedOutputDecimal = oracleExpected + anchorFeeInBrl`). Otherwise the user would receive `expectedOutput − anchorFee`, which is short of the advertised rate by the anchor's cut. 8. **Subsidy amounts written to `ctx.subsidy` MUST be deterministic for a given input.** With `targetDiscount=0` the actual subsidy is forced to zero (`actualSubsidyAmountDecimal = Big(0)`), even when `idealSubsidy > 0`. This is the contract the merge-subsidy and subsidy phase handlers rely on. -9. **The dynamic difference MUST NOT be incremented within `discountStateTimeoutMinutes` of the last quote** — `getAdjustedDifference` only adds `deltaD` when `isWithinStateTimeout` is **false**. Otherwise repeated quotes from the same partner would inflate the difference faster than intended. -10. **Squid Router probe failures MUST fall back to a 1:1 assumption, never block the quote.** Both `getSquidRouterUSDCConversionRate` and `getSquidRouterAxlUSDCConversionRate` return `null` on error and the engine proceeds with `adjustedExpectedOutputDecimal = oracleExpectedOutputDecimal`. A network failure on the probe MUST NOT cause the entire quote stage to throw. +9. **Discount subsidy MUST remain distinct from runtime swap discrepancy subsidy.** `ctx.subsidy.subsidyAmountInOutputTokenRaw` is the quote-time discount component, bounded by partner `maxSubsidy`. On EVM `subsidizePostSwap`, any actual-vs-quoted swap-output discrepancy is calculated against the live post-swap balance and capped by env-configured `MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION`; the discount component is capped separately by env-configured `MAX_EVM_POST_SWAP_DISCOUNT_SUBSIDY_QUOTE_FRACTION`. Both runtime fractions default to `0.05`. +10. **EVM off-ramp Nabla minimums MUST use AMM-only output, not subsidy-merged output.** EVM Nabla quote producers write the AMM-only result to `nablaSwapEvm.ammOutputAmount*`. On Base EVM offramps, `MergeSubsidy` may then merge the quote-time discount subsidy into `nablaSwapEvm.outputAmount*` so downstream payout/finalization targets reflect the subsidized amount. The on-chain Nabla swap minimums MUST be derived from the preserved AMM-only amount (`ammOutputAmountRaw`, falling back to `outputAmountRaw` only for legacy quotes without the snapshot), otherwise the minimum can exceed what the AMM can deliver and cause deterministic swap reverts. +11. **The dynamic difference MUST NOT be incremented within `discountStateTimeoutMinutes` of the last quote** — `getAdjustedDifference` only adds `deltaD` when `isWithinStateTimeout` is **false**. Otherwise repeated quotes from the same partner would inflate the difference faster than intended. +12. **Squid Router probe failures MUST fall back to a 1:1 assumption, never block the quote.** Both `getSquidRouterUSDCConversionRate` and `getSquidRouterAxlUSDCConversionRate` return `null` on error and the engine proceeds with `adjustedExpectedOutputDecimal = oracleExpectedOutputDecimal`. A network failure on the probe MUST NOT cause the entire quote stage to throw. ## Threat Vectors & Mitigations @@ -44,15 +46,16 @@ For onramps to EVM destinations other than AssetHub, the engine also probes Squi |---|---|---| | **Subsidy drain via partner row manipulation** | An attacker (or compromised admin endpoint) sets `targetDiscount` or `maxSubsidy` to large values on a partner row, causing the platform to over-subsidize every quote routed through that partner. | Admin endpoints that mutate `Partner` rows MUST be protected by `adminAuth`. Operational monitoring SHOULD alert on `cumulative subsidy per partner per day > threshold`. The `maxSubsidy` field is a hard per-quote ceiling; an organization-level cap is not currently enforced in code. | | **Quote bursting against dynamic difference** | A client issues many quotes in rapid succession to consume `partnerDiscountState.difference` down to `minDynamicDifference`, then waits for it to drift back up before placing a real ramp at a better rate. | `handleQuoteConsumptionForDiscountState` decreases `difference` by `deltaD` on each *consumed* quote (clamped at `minDynamicDifference`); `getAdjustedDifference` only increases it when `isWithinStateTimeout` is false. Rate limiting at the API layer is the primary defense; the discount state itself only provides eventual mean-reversion. | +| **Owner/pricing partner drift** | A profile-assigned quote is user-owned (`partner_id = NULL`) but priced by a partner row. If discount state follows quote ownership instead of pricing attribution, dynamic adjustment is applied to no partner or the wrong partner. | Quote persistence records `pricing_partner_id`; ramp registration consumes dynamic discount state using `pricing_partner_id ?? partner_id`, so state follows the partner whose pricing was used. | | **State loss on process restart re-grants discount** | The `partnerDiscountState` map lives in process memory (`apps/api/src/api/services/quote/engines/discount/helpers.ts:15`). A restart resets every partner's `difference` to `0` and `lastQuoteTimestamp` to `null`, effectively forgiving any in-progress quote consumption. | **Operational risk only — accepted for now.** Until the state is persisted to PostgreSQL, restarts will reset partner positions. Operators MUST treat planned restarts during high-volume periods as a known subsidy leakage vector. | | **Multi-replica state divergence** | Running the API behind multiple replicas with no sticky routing causes each replica to maintain its own `partnerDiscountState`. The total subsidy paid can exceed the intended cap because each replica enforces its own ceiling independently. | **OPEN (F-DISC-01).** The current deployment topology MUST run a single replica, or the discount state MUST be persisted/centralised (e.g. Redis or a `partner_discount_state` table with row-level locking) before horizontal scaling. | | **Side-effect on read (cache-poisoning analogue)** | `getAdjustedDifference` mutates `partnerDiscountState` whenever it's called (`partnerDiscountState.set` on lines 106, 111, 120). If a quote pipeline retries the discount stage, the dynamic difference is incremented twice for one logical quote, charging the platform more than intended. | **OPEN (F-DISC-02).** `getAdjustedDifference` MUST be split into a pure reader and an explicit `recordQuoteIssued()` mutator, invoked once per quote at a well-defined point. As long as the discount engine is called exactly once per quote (the current stage pipeline guarantees this), the practical impact is bounded. | | **Misleading `[CAPPED]` log on zero-discount partners** | `formatPartnerNote` appends `[CAPPED]` whenever `actualSubsidy < idealSubsidy`. When `targetDiscount=0`, line 79 of `offramp.ts` (and 211 of `onramp.ts`) force `actualSubsidy=0`, but `idealSubsidy` can still be positive whenever Nabla undershoots the oracle. Operators reading logs may interpret a flood of `[CAPPED]` notes as `maxSubsidy` exhaustion when the real reason is `targetDiscount=0`. | **OPEN (F-DISC-03).** `formatPartnerNote` SHOULD distinguish "no discount configured" (`targetDiscount=0`) from "discount configured but cap hit" (`targetDiscount>0 && actual 0` (otherwise `actualSubsidy = 0`). Provider quote TTL (30 seconds) limits the timing window; quote refresh at start (`refreshAlfredpayOnrampQuoteIfMatching`) only re-binds when the new provider quote is byte-identical on `toAmount` and `fee`. | | **AlfredPay offramp inverted-rate misconfiguration** | If the oracle returns a non-positive rate for `outputCurrency -> ALFREDPAY_ONCHAIN_CURRENCY`, dividing by it would yield `+∞` or NaN, corrupting downstream `expectedOutput` and subsidy math. | `OffRampAlfredpayDiscountEngine` throws when `effectiveRate ≤ 0`. The partner engine (`OfframpTransactionAlfredpayEngine`) has a symmetric `effectiveRate.gt(0)` guard with a fallback that uses `evmToEvm.outputAmountDecimal`. | +| **Subsidy on a discount-less route** | A partner with positive `targetDiscount` requests a quote on one of the discount-less routes (`offramp-evm-to-alfredpay`, `onramp-alfredpay-to-evm`, and the Mykobo EUR on/off-ramp routes which run end-to-end on Base without a Pendulum hop); they receive the bare Nabla rate and no subsidy, contradicting their partner configuration. | **Accepted product behavior.** These routes have no Pendulum-side Nabla swap that the discount engine is designed to subsidize (Alfredpay flows use direct stablecoin transfers; Mykobo flows swap on Nabla-on-Base, which is outside the Substrate-Nabla discount path). Operators SHOULD ensure partner-facing documentation makes the route-level discount applicability explicit. | ## Audit Checklist @@ -60,12 +63,15 @@ For onramps to EVM destinations other than AssetHub, the engine also probes Squi - [x] `OffRampDiscountEngine` only fires for `RampDirection.SELL`; `OnRampDiscountEngine` only fires for `RampDirection.BUY`. **PASS** — `offramp.ts:10`, `onramp.ts:18`. - [x] Discount parameters (`targetDiscount`, `maxSubsidy`, `minDynamicDifference`, `maxDynamicDifference`) are read exclusively from the `Partner` Sequelize model and never accepted from request fields. **PASS** — `resolveDiscountPartner` uses `Partner.findOne`; no request field is read. - [x] Subsidy cap `maxSubsidy × expectedOutput` is enforced in `calculateSubsidyAmount` (`helpers.ts:152-167`). **PASS**. +- [x] EVM post-swap runtime cap logic treats discount subsidy separately from swap discrepancy subsidy. **PASS** — the discount component comes from `ctx.subsidy.subsidyAmountInOutputTokenRaw`; the live discrepancy component is computed from the post-swap balance and quoted actual output. Each component must pass its own env-configured runtime cap before transfer. +- [x] Base EVM off-ramp Nabla swap minimums use the AMM-only output when quote-time subsidy was merged. **PASS** — EVM Nabla quote producers write `nablaSwapEvm.ammOutputAmountRaw`, `OffRampMergeSubsidyEvmEngine` leaves that AMM-only value untouched while merging subsidy into `outputAmountRaw`, and `addNablaSwapTransactionsOnBase` derives soft/hard minimums from `ammOutputAmountRaw ?? outputAmountRaw`. - [x] `targetDiscount=0` forces `actualSubsidyAmountDecimal = Big(0)` in both engines. **PASS** — `offramp.ts:76-79`, `onramp.ts:209-212`. - [x] Offramp `expectedOutput` adds back the anchor fee (`adjustedExpectedOutputDecimal = oracleExpectedOutput + anchorFeeInBrl`). **PASS** — `offramp.ts:50-51`. - [x] Onramp `actualOutput` subtracts post-swap fees (`network + vortex + partnerMarkup`). **PASS** — `onramp.ts:198-199`. - [x] Squid probe failures return `null` and the engine falls back to `adjustedExpected = oracleExpected`. **PASS** — `onramp.ts:88-93`, `148-153`, `185-192`. - [x] Squid probe short-circuits to `1` when the destination is Base USDC same-token same-chain. **PASS** — `onramp.ts:123-125`. -- [x] `resolveDiscountPartner` falls back to `name = "vortex"` only when the requested partner is missing or inactive. **PASS** — `helpers.ts:44-62`. An audit MUST verify a database seed exists that creates an active `vortex` partner row for every supported `rampType`. +- [x] `resolveDiscountPartner` falls back to `name = "vortex"` only when no active pricing partner applies. **PASS** — `helpers.ts:44-62`. An audit MUST verify a database seed exists that creates an active `vortex` partner row for every supported `rampType`. +- [x] Consumed quote dynamic state uses the pricing partner rather than only the quote owner. **PASS** — ramp registration resolves `pricing_partner_id ?? partner_id` before calling `handleQuoteConsumptionForDiscountState`. - [x] Dynamic difference is bounded by `partner.minDynamicDifference` and `partner.maxDynamicDifference` (defaulting to `0` when null). **PASS** — `helpers.ts:103, 119, 144, 147`. - [x] `deltaD` is derived from `config.quote.deltaDBasisPoints / 10000`, server-side only. **PASS** — `helpers.ts:17-19`. - [x] `isWithinStateTimeout` gates the increment branch in `getAdjustedDifference`. **PASS** — `helpers.ts:115-125`. diff --git a/docs/security-spec/03-ramp-engine/ephemeral-accounts.md b/docs/security-spec/03-ramp-engine/ephemeral-accounts.md index 9954dbb2b..20e982479 100644 --- a/docs/security-spec/03-ramp-engine/ephemeral-accounts.md +++ b/docs/security-spec/03-ramp-engine/ephemeral-accounts.md @@ -10,12 +10,12 @@ The cleanup process runs as a background worker (`cleanup.worker.ts`) on a 5-min Ephemeral accounts may be created on: - **Stellar** — For Spacewalk bridge operations and direct Stellar payments -- **Pendulum** — For Nabla swaps (Substrate-side), Spacewalk redeems, XCM transfers -- **Moonbeam** — For legacy EVM operations (EUR Monerium → Moonbeam path), SquidRouter swaps, XCM to/from Pendulum -- **Polygon** — For Monerium EURe operations +- **Pendulum** — For Nabla swaps (Substrate-side), Spacewalk redeems, XCM transfers. **Not created** for BRL (BRLA) or EUR (Mykobo) Base-EVM corridors: `getRequiresPendulumEphemeralAddress` returns `false` when the input or output token is BRL or EURC, and registration skips Pendulum ephemeral creation + funding for those corridors. Only the Pendulum-routed corridors (Stellar/ARS, AssetHub, Hydration) still allocate a Pendulum ephemeral. +- **Moonbeam** — For legacy EVM operations (historical Monerium EUR → Moonbeam path is removed; still used for ARS-Stellar off-ramp's Moonbeam→Pendulum XCM hop, Alfredpay permit acquisition, and SquidRouter swaps), XCM to/from Pendulum +- **Polygon** — (Legacy) For Monerium EURe operations; no active corridor uses Polygon anymore but the post-process handler remains for safety on any still-in-flight legacy ramps - **AssetHub** — For XCM transfers to/from Pendulum and Hydration - **Hydration** — For Hydration DEX swaps and XCM transfers -- **Base** — Hub for all BRL on/off-ramp flows. Hosts BRLA mint/burn (via Avenia), Nabla-on-EVM swap (USDC↔BRLA), and EVM fee distribution via Multicall3. +- **Base** — Hub for all BRL **and EUR** on/off-ramp flows. Hosts BRLA mint/burn (via Avenia), Mykobo EUR settlement (EURC on Base), Nabla-on-EVM swap (USDC↔BRLA, USDC↔EURC), and EVM fee distribution via Multicall3. ### Cleanup Architecture @@ -24,11 +24,11 @@ Post-process handlers registered in `apps/api/src/api/services/phases/post-proce - **StellarPostProcessHandler** — Submits the `stellarCleanup` XDR to merge the Stellar ephemeral account back to the funding account. - **PendulumPostProcessHandler** — Submits the `pendulumCleanup` extrinsic to sweep Pendulum ephemeral tokens. - **MoonbeamPostProcessHandler** — Waits 3 hours for SquidRouter refunds to land, then submits `moonbeamCleanup` to sweep Moonbeam ephemeral tokens. -- **PolygonPostProcessHandler** — On Monerium-onramp BUY ramps with a `polygonCleanup` presigned tx, broadcasts the user's pre-signed `approve` and then runs `transferFrom(ephemeral, fundingAccount, balance)` from the funding key to sweep residual ERC-20 tokens. Skipped when ephemeral balance is zero. +- **PolygonPostProcessHandler** — (Legacy Monerium support) On Monerium-onramp BUY ramps with a `polygonCleanup` presigned tx, broadcasts the user's pre-signed `approve` and then runs `transferFrom(ephemeral, fundingAccount, balance)` from the funding key to sweep residual ERC-20 tokens. Skipped when ephemeral balance is zero. **No active corridor produces new Polygon ephemerals; this handler exists for in-flight legacy ramps and can be retired once Monerium ramps are fully drained.** - **HydrationPostProcessHandler** — On BUY ramps with a `hydrationCleanup` presigned extrinsic, submits the cleanup extrinsic. - **AssetHubPostProcessHandler** — Registered but inert. `shouldProcess` returns `false` unconditionally; `process` returns `[true, null]`. No on-chain action is performed. Effectively a placeholder for future AssetHub cleanup. -A post-process handler is registered for **Base** (`BaseChainPostProcessHandler`). After a BRL ramp completes, it sweeps any residual BRLA and USDC dust from the Base ephemeral to the funding account via the standard `approve(funding, MAX_UINT256)` + `transferFrom(ephemeral, funding, balance)` pattern (presigned by the ephemeral; `transferFrom` broadcast by the funding key). Per-token balance checks skip the sweep when the balance is zero. ETH gas dust on the ephemeral is not swept (accepted residual; gas is funded just-in-time and rarely accumulates meaningfully). +A post-process handler is registered for **Base** (`BaseChainPostProcessHandler`). After a Base-routed ramp completes (BRL via BRLA or EUR via Mykobo), it sweeps residual BRLA, EURC, USDC, and AxlUSDC dust from the Base ephemeral to the funding account via the standard `approve(funding, MAX_UINT256)` + `transferFrom(ephemeral, funding, balance)` pattern (presigned by the ephemeral; `transferFrom` broadcast by the funding key). Per-token balance checks skip the sweep when the balance is zero. ETH gas dust on the ephemeral is not swept (accepted residual; gas is funded just-in-time and rarely accumulates meaningfully). The cleanup worker (`cleanup.worker.ts`) selects ramps where `currentPhase ∈ {"complete", "failed", "timedOut"}` and cleanup is not yet completed, processing up to 5 ramps per cycle on a 5-minute cron. There is no longer a SEPA exclusion (the historical `from: { [Op.ne]: "sepa" }` filter has been removed). @@ -65,7 +65,7 @@ The cleanup worker (`cleanup.worker.ts`) selects ramps where `currentPhase ∈ { - [x] PolygonPostProcessHandler broadcasts the user-presigned `approve` and runs `transferFrom(ephemeral, fundingAccount, balance)` from `getEvmFundingAccount(Polygon)` — verified (`polygon-post-process-handler.ts:36-83`) - [x] HydrationPostProcessHandler submits `hydrationCleanup` extrinsic from ramp state — verified - [ ] **AssetHubPostProcessHandler is a no-op stub** (`shouldProcess` always returns `false`). Either implement an AssetHub cleanup or remove the handler from the registry. -- [ ] **No Base post-process handler**. Add a `BasePostProcessHandler` (chain) that sweeps residual USDC/BRLA on Base ephemerals to the funding account, mirroring the Polygon `approve + transferFrom` pattern, when custody requirements allow. +- [x] **Base post-process handler implemented** (`BaseChainPostProcessHandler`). Sweeps residual BRLA/USDC/EURC/AxlUSDC on Base ephemerals to the funding account via presigned `approve` + funding-key `transferFrom`. ETH gas dust is not swept (accepted residual). - [x] Cleanup worker runs every 5 minutes via `node-cron` — verified - [x] Cleanup worker processes at most 5 ramps per cycle — verified - [x] Cleanup worker marks ramps as cleaned (`postProcessDone: true` via `postCompleteState.cleanup.cleanupCompleted`) to prevent re-processing — verified diff --git a/docs/security-spec/03-ramp-engine/fee-integrity.md b/docs/security-spec/03-ramp-engine/fee-integrity.md index e78108cbb..55acd47cf 100644 --- a/docs/security-spec/03-ramp-engine/fee-integrity.md +++ b/docs/security-spec/03-ramp-engine/fee-integrity.md @@ -26,7 +26,7 @@ This means the fees shown to the user (from the database system) may differ from Two parallel implementations live in `apps/api/src/api/services/transactions/common/feeDistribution.ts`: 1. **Substrate (Pendulum)** — Single batch extrinsic that transfers each fee component to the corresponding partner address read from `Partner.payout_address_substrate`. -2. **EVM (Base)** — `Multicall3.aggregate3` batch (`MULTICALL3_ADDRESS = 0xcA11bde05977b3631167028862bE2a173976CA11`) executes one ERC-20 transfer per fee recipient atomically. Recipient addresses come from `Partner.payout_address_evm`. The handler pre-checks the active `vortex` partner row has a non-NULL `payout_address_evm` and aborts the phase otherwise; partner-markup recipients fall through silently when the quote partner's `payout_address_evm` is NULL. +2. **EVM (Base)** — `Multicall3.aggregate3` batch (`MULTICALL3_ADDRESS = 0xcA11bde05977b3631167028862bE2a173976CA11`) executes one ERC-20 transfer per fee recipient atomically. Recipient addresses come from `Partner.payout_address_evm`. The handler pre-checks the active `vortex` partner row has a non-NULL `payout_address_evm` and aborts the phase otherwise; partner-markup recipients resolve through the quote's pricing partner (`pricing_partner_id ?? partner_id`) and fall through with a warning when that partner's `payout_address_evm` is NULL. The `distribute-fees-handler.ts` chooses the correct path at runtime based on the ephemeral network (Pendulum vs. Base). For EVM, the handler pre-checks that the ephemeral has sufficient ERC-20 balance via `checkEvmBalanceForToken` with a 60-second poll timeout (`FEE_BALANCE_POLL_TIMEOUT_MS`). @@ -45,8 +45,9 @@ The `distribute-fees-handler.ts` chooses the correct path at runtime based on th 6. **Anchor fees MUST be accounted for in the quoted amount** — When BRLA or Stellar anchors deduct their fee, the system's quoted output must have already factored this in. The user should receive exactly the quoted net amount. 7. **Subsidization MUST NOT bypass fee collection** — When the platform subsidizes a shortfall (swap returned less than quoted), the subsidization covers the difference AFTER fees, not before. The platform should not subsidize to offset its own fees. 8. **Fee distribution (`distributeFees` phase) MUST transfer exact calculated amounts** — The amounts sent to vortex, network, and partner fee accounts must match the fee breakdown calculated during quoting. -9. **Rounding MUST be consistent and favor the platform** — On-ramp fees are rounded to 6 decimal places (round half up). Off-ramp fees are rounded to 2 decimal places (round half down). Rounding mode should never create a scenario where the user receives more than entitled. -10. **Fee configuration changes MUST NOT affect in-flight ramps** — Once a quote is created with specific fees, those fees are locked. Changing fee configuration should only apply to new quotes. +9. **Partner markup distribution MUST use pricing attribution** — When `pricing_partner_id` is present, partner markup payout MUST use that partner row instead of relying only on the quote owner `partner_id`; `partner_id` is only the backward-compatible fallback. +10. **Rounding MUST be consistent and favor the platform** — On-ramp fees are rounded to 6 decimal places (round half up). Off-ramp fees are rounded to 2 decimal places (round half down). Rounding mode should never create a scenario where the user receives more than entitled. +11. **Fee configuration changes MUST NOT affect in-flight ramps** — Once a quote is created with specific fees, those fees are locked. Changing fee configuration should only apply to new quotes. ## Threat Vectors & Mitigations @@ -58,6 +59,7 @@ The `distribute-fees-handler.ts` chooses the correct path at runtime based on th | **Fee parameter injection** | Attacker passes custom fee rates in the API request | Fee rates come exclusively from `getAnyFiatTokenDetails()` (token config) or database; never from request body | | **Subsidization drain** | Attacker manipulates conditions so the platform always subsidizes the maximum amount | Slippage bounds limit subsidization; monitoring for excessive subsidization; circuit breaker on total subsidization per period | | **Partner markup theft** | Partner sets unreasonably high markup to extract value | Partner markup bounds should be enforced; review partner configuration for reasonable limits | +| **Profile-priced markup not paid** | A profile-assigned quote is user-owned (`partner_id = NULL`) but has partner markup from custom pricing; fee distribution looks only at `partner_id` and drops the partner payout. | Fee distribution resolves the payout partner from `pricing_partner_id ?? partner_id`, so profile-assigned pricing still pays the partner whose rate was used. | ## Audit Checklist @@ -72,7 +74,9 @@ The `distribute-fees-handler.ts` chooses the correct path at runtime based on th - [x] Fee configuration from token configs (`shared/src/tokens/*/config.ts`) matches what's intended for each currency. **PASS** — token configs reviewed; basis points and fixed components present for all supported tokens. - [x] Rounding modes: on-ramp uses `round(6, 0)` (round half up to 6 decimals), off-ramp uses `round(2, 1)` (round half down to 2 decimals). **PASS** — verified rounding modes in both helper functions. - [x] `distributeFees` phase distributes exactly the amounts from the fee breakdown — no recalculation. **PASS** — fee distribution uses stored breakdown values. +- [x] Partner markup payout uses the pricing partner when present. **PASS** — fee distribution resolves payout from `pricing_partner_id ?? partner_id`, preserving profile-assigned quote payouts while keeping older partner-owned quotes compatible. - [x] Anchor fee deduction by external services (BRLA, Stellar) is pre-accounted in the quoted amount. **PASS** — anchor fees factored into quote calculation. +- [ ] Mykobo anchor fee in the quote MUST match the tier Mykobo actually charges. The fee tier is selected by `MYKOBO_CLIENT_DOMAIN`; an unset env var silently degrades to Mykobo's default tier (~5x worse), causing `defaultDepositFee` / `defaultWithdrawFee` and on-chain settlement to diverge. See `07-operations/secret-management.md` (invariant 9) and `05-integrations/mykobo.md` (invariant 20). - [x] Fee changes in token config or database don't retroactively affect already-created quotes. **PASS** — quotes store immutable fee snapshots at creation time. - [x] **FINDING F-061 (MEDIUM)**: Verify quote finalization enforces maximum amount limits. **PASS (FIXED)** — added `validateAmountLimits(..., "max", ...)` calls in both `OnRampFinalizeEngine.validate()` and `OffRampFinalizeEngine.validate()`. - [x] **FINDING F-067 (MEDIUM)**: Verify `calculateFeeComponent()` cannot produce negative fee values. **PASS (FIXED)** — added `if (feeComponent.lt(0)) { feeComponent = new Big(0); }` floor check to clamp negative results to zero. diff --git a/docs/security-spec/03-ramp-engine/profile-partner-pricing.md b/docs/security-spec/03-ramp-engine/profile-partner-pricing.md new file mode 100644 index 000000000..e918ae3ee --- /dev/null +++ b/docs/security-spec/03-ramp-engine/profile-partner-pricing.md @@ -0,0 +1,74 @@ +# Profile Partner Pricing + +## What This Does + +Profile partner pricing lets an authenticated first-party user receive the custom quote behavior of a partner without exposing partner API credentials in the frontend. An administrator assigns a Supabase profile to a partner name, and the backend resolves that name once into stable ramp-specific partner IDs. When that user creates a quote with a valid Supabase Bearer token, the backend reads the active assignment and applies `buy_partner_id` or `sell_partner_id` for the requested ramp type. + +This feature is intentionally different from partner API-key authentication: + +1. Partner API clients remain authenticated by `X-API-Key: sk_*` and may create partner-owned quotes. +2. Frontend users remain authenticated by `Authorization: Bearer ` and may create user-owned quotes. +3. A profile assignment grants pricing eligibility only. It does not grant partner ownership, API access, webhook permissions, or the ability to act as the partner. + +The intended data model separates two concepts that were historically collapsed into `quote_tickets.partner_id`: + +- `partner_id` remains the partner owner of a quote for API-key integrations. +- `pricing_partner_id` records which partner rate configuration was used for quote pricing, fee calculation, subsidy calculation, fee distribution, and dynamic discount state. + +`profile_partner_assignments.partner_name` is a display/audit snapshot only. Runtime pricing resolution MUST use the assignment's stored `buy_partner_id` / `sell_partner_id` foreign keys, so partner renames or duplicate partner names cannot silently change an existing profile assignment. + +For profile-assigned frontend quotes, `quote_tickets.user_id` is set to the authenticated profile, `quote_tickets.partner_id` stays `NULL`, and `quote_tickets.pricing_partner_id` is set to the resolved partner row. This lets the user consume their own quote through the existing Supabase ownership path while still preserving which partner pricing was applied. + +## Security Invariants + +1. **Profile assignments MUST be server-side only** - The client MUST NOT be able to choose its assigned partner by passing a request body field, URL parameter, or local storage value. The backend resolves assignments only from the authenticated `req.userId`. +2. **Profile assignments MUST NOT authenticate partner ownership** - A Supabase profile assigned to a partner MUST NOT populate `req.authenticatedPartner`, MUST NOT satisfy `enforcePartnerAuth()`, and MUST NOT access partner-owned quotes or ramps. +3. **Explicit partner API-key integrations MUST keep their existing behavior** - Requests that include `partnerId` still require a matching partner secret key. Existing SDK/API clients using partner keys must continue to create partner-owned quotes. +4. **Partner pricing source precedence MUST be deterministic** - Explicit `partnerId` has highest precedence, then validated public API key partner name, then profile assignment, then default `"vortex"` pricing. +5. **Profile-assigned quotes MUST be user-owned** - A quote priced through a profile assignment MUST persist `user_id = req.userId` and `partner_id = NULL`. Register/update/start/status access for the resulting ramp is authorized through the Supabase user path. +6. **The pricing partner MUST be persisted separately** - Any quote that applies non-default partner pricing MUST persist `pricing_partner_id` so downstream fee distribution and dynamic discount state use the same partner row that quote calculation used. +7. **Inactive or expired assignments MUST be ignored** - The assignment resolver must require `is_active = true` and either `expires_at IS NULL` or `expires_at > now()`. +8. **Assignment partner IDs MUST be stable and ramp-specific** - Assignment creation may accept a logical partner name for admin convenience, but it MUST persist resolved `buy_partner_id` and/or `sell_partner_id` values and quote resolution MUST use those IDs, not a fresh name lookup. +9. **Ambiguous partner-name assignments MUST be rejected** - If assignment creation finds multiple active partner rows with the same name for the same ramp type, the API MUST fail instead of choosing an arbitrary partner row. +10. **Invalid assignments MUST fail closed to default pricing** - If an assignment points to no active partner row for the requested ramp type, quote creation proceeds without that partner's pricing instead of accepting untrusted client input or fabricating a partner. +11. **Admin active-list semantics MUST match quote-time semantics** - Default assignment listing MUST exclude rows that are inactive or expired; historical listing may include them only when explicitly requested. +12. **Fee distribution MUST use the pricing partner, not only the owner partner** - Partner markup payout uses `pricing_partner_id` when present, with `partner_id` as a backward-compatible fallback for older quotes. +13. **Dynamic discount state MUST use the pricing partner** - Quote consumption adjusts the dynamic discount state for the partner whose pricing was used, not for the quote owner. +14. **Assignment administration MUST require admin auth** - Create, list, and revoke assignment endpoints MUST be protected by `adminAuth`; partner API keys and Supabase user tokens MUST NOT manage assignments. +15. **Assignment replacement MUST be atomic per profile** - Creating a new active assignment MUST deactivate the previous active row and insert the replacement in one database transaction. The transaction MUST lock the profile row so concurrent admin writes for the same user serialize, and any residual active-assignment unique-index conflict MUST fail with a retryable `409`. + +## Threat Vectors & Mitigations + +| Threat | Attack Scenario | Mitigation | +|---|---|---| +| **User spoofs partner discount** | A frontend user passes another partner's `partnerId` in the quote request body to claim better rates. | Existing `enforcePartnerAuth()` rejects `partnerId` unless a matching `sk_*` is present. Profile assignment resolution ignores client-supplied partner fields. | +| **Assigned user becomes partner principal** | A profile assigned to a partner tries to read or mutate partner-owned quotes, ramps, webhooks, or history. | Assignment affects quote pricing only. It does not set `req.authenticatedPartner`; ownership guards still separate user-owned and partner-owned resources. | +| **Broken API-client compatibility** | Splitting pricing and owner fields accidentally makes SDK quotes user-owned or anonymous. | Existing partner-key and public-key request paths continue to populate `partner_id` as before. The new user-owned behavior is only used for server-resolved profile assignments. | +| **Dropped partner markup payout** | A profile-assigned quote computes a partner markup but downstream fee distribution looks only at `quote.partnerId`, sees `NULL`, and skips partner payout. | Fee distribution resolves payout from `pricing_partner_id ?? partner_id`. | +| **Dynamic state drift for the wrong principal** | A profile-assigned quote is consumed but dynamic discount state is decremented for no partner or the wrong partner. | Ramp registration resolves the partner from `pricing_partner_id ?? partner_id` before calling `handleQuoteConsumptionForDiscountState`. | +| **Stale assignment remains usable** | A profile's temporary partner entitlement expires but quote creation still applies custom rates. | Resolver filters out assignments with `expires_at <= now()`. | +| **Assignment changes after partner rename** | A partner row is renamed after assignment creation, and future quotes unexpectedly lose or change pricing. | Assignments persist ramp-specific partner IDs; `partner_name` is display/audit only. | +| **Ambiguous same-name partner row** | Two active BUY partner rows share `name = Acme`, so a name lookup could choose the wrong pricing/payout configuration. | Assignment creation rejects same-name ambiguity per ramp type instead of storing a nondeterministic assignment. | +| **Assignment to missing ramp-type config** | A profile is assigned to partner `Acme`, but `partners` has only a BUY row and the user requests SELL. | The assignment has no `sell_partner_id`; resolver falls back to default pricing for SELL. | +| **Expired assignment shown as active** | Admin tooling lists an expired row as active, leading support to assume custom rates still apply. | Default list filtering uses the same active + unexpired predicate as quote resolution; `includeInactive=true` is the historical view. | +| **Unauthorized assignment management** | A partner or normal frontend user assigns themselves or another profile to a discounted partner. | Assignment management routes live under `/v1/admin/profile-partner-assignments` and require `adminAuth`. | +| **Partial assignment replacement** | Admin assignment creation deactivates the current row and then fails before inserting the replacement, leaving the profile with no active pricing assignment. Concurrent creates can also race against the active-user partial unique index. | Replacement runs in one transaction after locking the profile row. Rollback preserves the prior active assignment, and residual unique-index conflicts return `409 ASSIGNMENT_CONFLICT` so the admin can retry. | + +## Audit Checklist + +- [x] `profile_partner_assignments` exists with `user_id`, display/audit `partner_name`, ramp-specific `buy_partner_id` / `sell_partner_id`, `is_active`, optional `expires_at`, timestamps, and indexes for active user lookups. +- [x] Admin assignment endpoints are protected by `adminAuth` and reject non-admin credentials. +- [x] Admin assignment creation rejects ambiguous same-name active partner rows for the same ramp type. +- [x] Default admin assignment listing excludes expired rows; `includeInactive=true` is required for historical rows. +- [x] Admin assignment replacement deactivates the old active row and creates the new row in one transaction after taking a row lock for the target profile. +- [x] Active-assignment unique-index collisions return `409 ASSIGNMENT_CONFLICT` instead of a generic server error. +- [x] Quote creation resolves profile assignments only from `req.userId`; unauthenticated quotes never use profile assignment pricing. +- [x] Profile assignment quote resolution uses stored `buy_partner_id` / `sell_partner_id`, not a fresh runtime `partner_name` lookup. +- [x] `POST /v1/quotes` and `POST /v1/quotes/best` still reject explicit `partnerId` without matching secret-key authentication. +- [x] Profile-assigned quotes persist `user_id` and `pricing_partner_id`, while leaving `partner_id` `NULL`. +- [x] Existing partner API-key and public-key quote paths preserve their previous `partner_id` behavior. +- [x] Fee distribution uses `pricing_partner_id ?? partner_id` for partner markup payout. +- [x] Ramp registration updates discount state using `pricing_partner_id ?? partner_id`. +- [x] User ownership checks continue to authorize profile-assigned quotes through `user_id`. +- [x] Partner ownership checks continue to authorize API-client quotes through `partner_id`. +- [x] Tests cover assigned user quote ownership, ramp-specific partner-ID resolution, quote persistence of `pricing_partner_id`, expired list filtering, and the non-regression path for partner-owned quotes. diff --git a/docs/security-spec/03-ramp-engine/quote-lifecycle.md b/docs/security-spec/03-ramp-engine/quote-lifecycle.md index ea8c10717..e89e9ac12 100644 --- a/docs/security-spec/03-ramp-engine/quote-lifecycle.md +++ b/docs/security-spec/03-ramp-engine/quote-lifecycle.md @@ -4,7 +4,8 @@ Quotes are the entry point for every ramp. A quote calculates the expected output amount for a given input, factoring in exchange rates, fees, and dynamic pricing adjustments. The lifecycle: -1. **Creation** — Client requests a quote via `POST /v1/quotes` with input currency, output currency, amount, and ramp direction (on/off). The API calculates fees, fetches live exchange rates (Nabla DEX, price providers), applies the dynamic pricing adjustment, and returns a `QuoteResponse` including the expected output amount, fee breakdown, and a quote ID. +1. **Creation** — Client requests a quote via `POST /v1/quotes` with input currency, output currency, amount, and ramp direction (`BUY` for on-ramp or `SELL` for off-ramp). If an active maintenance window exists, the backend rejects quote creation with `503 Service Unavailable`, `Retry-After`, and downtime start/end metadata before fetching rates or writing a quote. Otherwise, the API calculates fees, fetches live exchange rates (Nabla DEX, price providers), applies the dynamic pricing adjustment, and returns a `QuoteResponse` including the expected output amount, fee breakdown, and a quote ID. + - If live route/pool liquidity cannot serve the quote at the requested amount, the API returns a user-facing `500` quote error (`This route is temporarily unavailable due to low liquidity. Please try a smaller amount or check back soon.`). Clients should treat it as a user-correctable liquidity failure and ask for a smaller amount or to check back soon. This applies to Nabla pool coverage failures, Squid route low-liquidity responses, and `/v1/quotes/best` when every candidate route fails for liquidity. Unexpected provider or calculation failures still follow the global production error policy and are masked as internal errors. 2. **Expiry** — Quotes expire **10 minutes** after creation (hardcoded in `QuoteTicket.create()` and the model default: `new Date(Date.now() + 10 * 60 * 1000)`). After expiry, the quote cannot be used to start a ramp. Note: this is a separate timeout from `discountStateTimeoutMinutes` (see Dynamic Pricing below). 3. **Binding** — When a ramp is registered (`POST /v1/ramp/register`), it binds to a specific quote ID. The quote's amounts become the committed values for the ramp. 4. **Consumption** — A quote can only be bound to one ramp. Once consumed, it cannot be reused. @@ -38,7 +39,7 @@ The system maintains an **in-memory** `Map 0`. @@ -47,38 +48,46 @@ The system maintains an **in-memory** `Map 0`** — If a partner has no target discount configured, the subsidy amount is always `0`, regardless of the shortfall. +11. **Quote output precision MUST match the final settlement token** — For EVM onramps whose final output comes from Squid, the stored `quote.outputAmount` must retain the destination token's precision, not a fixed source-token precision. This includes BRL/EURC Base→EVM routes and routed Alfredpay USD/MXN/COP Polygon→EVM routes. Direct same-chain same-token passthrough keeps the minted/source token's precision. +12. **Quote creation MUST honor active maintenance windows server-side** — `POST /v1/quotes` and `POST /v1/quotes/best` must reject during active maintenance before quote calculation/persistence, including enough downtime metadata for direct API clients to retry after the window. +13. **Quote ownership MUST stay separate from pricing attribution** — Profile-assigned quotes MUST remain user-owned (`user_id = req.userId`, `partner_id = NULL`) while storing the applied partner pricing row in `pricing_partner_id`. ## Threat Vectors & Mitigations | Threat | Attack Scenario | Mitigation | |---|---|---| -| **Stale quote exploitation** | Attacker creates a quote when rates are favorable, waits for rates to move against the platform, then registers a ramp at the old rate | Quote expiry (10 minutes hardcoded); platform subsidizes the difference but bounds it via subsidy cap (`maxSubsidy`) | +| **Stale quote exploitation** | Attacker creates a quote when rates are favorable, waits for rates to move against the platform, then registers a ramp at the old rate | Quote expiry (10 minutes hardcoded); quote-time discount subsidy is bounded by partner `maxSubsidy`, and EVM post-swap runtime subsidy components are bounded by their own env-configured caps before funds move. | | **Quote replay** | Attacker uses the same favorable quote ID for multiple ramps | One-time consumption: quote status is set to `"consumed"` on ramp registration; second attempt is rejected (`quote.status !== "pending"`) | | **Quote manipulation** | Attacker modifies quote amounts in transit or in database | Quotes stored server-side; amounts calculated server-side from authoritative sources; client cannot override amounts | | **Price oracle manipulation** | Attacker manipulates the DEX price before requesting a quote to get an artificially favorable rate | Use TWAP or multi-source pricing; bound acceptable deviation from reference rates; monitor for unusual quote patterns | | **Dynamic pricing farming** | Attacker rapidly requests quotes without consuming them to push `difference` toward `maxDynamicDifference`, then consumes at the best possible rate | Each quote request within the timeout window does NOT change the difference — only quotes **after** the timeout increase it. So the attacker would need to wait `discountStateTimeoutMinutes` between each step increase. With default `deltaD = 0.00003` and a 10-minute timeout, farming is slow. However, the `maxDynamicDifference` cap is the hard limit. | | **⚠️ In-memory state loss** | Server restart resets all partner discount states to `difference = 0`. Partners lose their accumulated rate adjustments. | **NO MITIGATION.** State is in-memory only. After restart, all partners start fresh. This could cause abrupt rate changes if a partner had a significant accumulated difference. | -| **Subsidization abuse** | Attacker creates quotes during high volatility, forcing the platform to cover large subsidization amounts | Subsidy capped by `maxSubsidy` per partner; dynamic pricing adjusts rates over time; `maxDynamicDifference` bounds the maximum rate improvement | -| **Unauthorized quote consumption** | Attacker binds someone else's quote to their own ramp | Quotes carrying an owner (`partnerId` or `userId`) are bound to that owner; ownership is verified at ramp registration via `assertQuoteOwnership`. Fully-anonymous quotes (no `partnerId` and no `userId`) are intentionally consumable by any caller — they cannot leak privileged data because they were created without a principal in the first place. | +| **Subsidization abuse** | Attacker creates quotes during high volatility, forcing the platform to cover large subsidization amounts | Quote-time discount subsidy is capped by `maxSubsidy` per partner; EVM runtime top-ups are separately bounded by the pre/post-swap cap fractions; dynamic pricing adjusts rates over time; `maxDynamicDifference` bounds the maximum rate improvement | +| **Unauthorized quote consumption** | Attacker binds someone else's quote to their own ramp | Quotes carrying an owner (`partner_id` or `user_id`) are bound to that owner; ownership is verified at ramp registration via `assertQuoteOwnership`. `pricing_partner_id` is not an ownership credential. Fully-anonymous quotes (no `partner_id` and no `user_id`) are intentionally consumable by any caller — they cannot leak privileged data because they were created without a principal in the first place. | +| **Pricing partner treated as owner** | A profile-assigned user receives partner pricing, then tries to access partner-owned quotes or ramps. | Profile assignments populate `pricing_partner_id` only; `partner_id` stays `NULL`, so ownership guards continue to authorize through the Supabase `user_id` path. | | **Negative `minDynamicDifference`** | If `minDynamicDifference` is set to a large negative value in the partner DB record, consuming quotes could push the rate below the base `targetDiscount`, potentially making the effective discount negative (user receives less than the oracle rate) | DB constraint: `minDynamicDifference` defaults to `0`. However, there is no DB-level CHECK constraint preventing negative values. If set manually, the clamping logic would allow `difference` to go negative. | | **Concurrent quote and consumption** | Two simultaneous requests — one quoting, one consuming — for the same partner could read stale `difference` values from the in-memory Map | JavaScript's single-threaded event loop prevents true concurrency for synchronous Map operations. However, the `async` functions in `compute()` could interleave if there are `await` points between reading and writing the Map. In practice, the read and write of `partnerDiscountState` in `getAdjustedDifference` are synchronous, so this is safe within a single process. | +| **Quote-output precision loss** | A quote targets an 18-decimal destination token but stores only 6 decimal places. The user-visible amount looks close, but final raw transfer construction under-delivers by the truncated dust amount. | Finalize EVM onramp quotes with destination token decimals when the final amount comes from Squid; tests should cover 6-decimal source → 18-decimal destination routes. | +| **Direct API quote creation during planned downtime** | A partner bypasses the UI maintenance banner and requests quotes directly while operators expect Vortex services to be unavailable. | Quote creation routes run the backend maintenance guard and return `503` with `Retry-After`, `maintenance_start`, and `maintenance_end` before any quote is persisted. | ## Audit Checklist @@ -94,10 +103,13 @@ The refresh policy is intentionally strict (byte-identical `toAmount` and `fee` - [x] Exchange rates used in quote calculation come from live on-chain sources (Nabla, Squid), not stale caches. **PASS** — verified: rates fetched from Nabla DEX and SquidRouter API at quote time. - [x] Quote response does not include internal implementation details (e.g., the `adjustedDifference` or `adjustedTargetDiscount` values). **PASS** — verified: response includes only user-facing fields (amounts, fees, expiry). - [x] Quote amounts (input, output, fees) are immutable once stored — no UPDATE endpoint modifies them. **PASS** — no quote mutation endpoints exist. +- [x] EVM onramp output precision follows destination token decimals where the quote output comes from Squid. **PASS** — BRL/EURC Base→EVM and routed Alfredpay USD/MXN/COP Polygon→EVM finalization preserve destination token precision before downstream raw transfer construction. Direct same-chain same-token passthrough remains at minted/source-token precision. - [PARTIAL] Authentication is enforced on quote creation (verify which auth mechanisms protect `POST /v1/ramp/quotes`). **PARTIAL** — quote creation is accessible via API key auth or Supabase auth; the endpoint is optional-auth by design (public quotes allowed for some partners). - [PARTIAL] Quote ownership is verified at ramp registration — the user/partner creating the ramp must match the quote creator. **PARTIAL** — no strict user-to-quote binding; mitigated by UUID unpredictability and 10-minute expiry. +- [x] Profile-assigned quote pricing persists `pricing_partner_id` without granting partner ownership. **PASS** — profile-assigned quotes store `user_id`, leave `partner_id` `NULL`, and authorize through the user ownership path. - [x] Subsidy is only calculated when `targetDiscount > 0` — partners with no discount get `0` subsidy regardless of shortfall. **PASS** — verified in `calculateSubsidyAmount()`. - [x] `calculateSubsidyAmount` correctly caps at `maxSubsidy × expectedOutput` — verify the multiplication is the right semantic (fraction of expected, not absolute). **PASS** — confirmed: `maxSubsidy` is a fraction (0-1) multiplied by `expectedOutput`. -- [x] The `resolveDiscountPartner` fallback to the `"vortex"` default partner is intentional — verify the default partner exists and has appropriate discount/subsidy settings. **PASS** — fallback to "vortex" partner confirmed in code. +- [x] The `resolveDiscountPartner` fallback to the `"vortex"` default partner is intentional — verify the default partner exists and has appropriate discount/subsidy settings. **PASS** — fallback to "vortex" partner confirmed in code when no active pricing partner applies. - [N/A] Monitoring exists for quotes with unusually high subsidization requirements. **N/A** — no monitoring infrastructure audited. - [x] **FINDING F-059 (HIGH)**: Verify `registerRamp` acquires `SELECT FOR UPDATE` lock on the quote, checks `consumeQuote` affected rows, and has a unique constraint on `rampState.quoteId` to prevent double-binding. **PASS (FIXED)** — lock added, affected rows checked, unique constraint migration `026` created. +- [x] Verify active maintenance windows block `POST /v1/quotes` and `POST /v1/quotes/best` server-side with client-actionable downtime metadata. diff --git a/docs/security-spec/03-ramp-engine/ramp-phase-flows.md b/docs/security-spec/03-ramp-engine/ramp-phase-flows.md index 99abccf84..6f43a4489 100644 --- a/docs/security-spec/03-ramp-engine/ramp-phase-flows.md +++ b/docs/security-spec/03-ramp-engine/ramp-phase-flows.md @@ -13,11 +13,20 @@ There are 29+ phase handlers in `apps/api/src/api/services/phases/handlers/`. Th ### Major Ramp Corridors -**EUR Off-ramp (Stellar-based):** User's crypto → Pendulum (Nabla swap) → Stellar (Spacewalk bridge) → Stellar anchor (SEPA payout) -- Phases: `initial` → `subsidizePreSwap` → `nablaApprove` → `nablaSwap` → `subsidizePostSwap` → `spacewalkRedeem` → `stellarPayment` → `distributeFees` → `complete` - -**EUR On-ramp (Monerium SEPA):** SEPA payment → Monerium mints EURe on Polygon → SquidRouter to Moonbeam → XCM to Pendulum → Nabla swap → destination chain -- Phases: `initial` → `moneriumOnrampMint` (poll) → `moneriumOnrampSelfTransfer` → `squidRouterApprove` → `squidRouterSwap` → `moonbeamToPendulumXcm` → `nablaApprove` → `nablaSwap` → ... → `complete` +**EUR Off-ramp (Mykobo on Base):** User's crypto on source EVM → Squid bridge to Base USDC (user-signed, client-side) → Nabla-on-Base swap (USDC→EURC) → Mykobo SEPA payout +- Runtime backend phases: `initial` → `fundEphemeral` → `distributeFees` (on Base, USDC) → `subsidizePreSwap` → `nablaApprove` → `nablaSwap` → `subsidizePostSwap` → `mykoboPayoutOnBase` → `complete` +- The Squid bridge from the source EVM chain to Base is executed by the user's wallet (presigned `squidRouterApprove` + `squidRouterSwap` are submitted client-side). Skip-Squid case: source = Base USDC. +- Note: `distributeFees` runs **before** `nablaSwap` on offramp because fees are denominated in USDC and must be deducted before swapping to EURC. Mirrors the BRL-on-Base off-ramp. +- **Removed:** the previous Stellar-based EUR off-ramp (Pendulum → Spacewalk → Stellar anchor) is no longer active. See `stellar-anchors.md`. + +**EUR On-ramp (Mykobo SEPA on Base):** SEPA payment → Mykobo settles EURC on the Base ephemeral → Nabla-on-Base swap (EURC→USDC) → optional Squid → user destination +- Runtime backend phases: `initial` → `mykoboOnrampDeposit` (poll Base RPC, 24h outer / 5min inner) → `fundEphemeral` → `subsidizePreSwap` → `nablaApprove` → `nablaSwap` → `distributeFees` → `subsidizePostSwap` → `squidRouterSwap` → `destinationTransfer` → `complete` +- Note: like BRL on-ramp, `fundEphemeral` provides ETH gas to the Base ephemeral before swap/approve/squid txs. `mykoboOnrampDeposit` transitions to `fundEphemeral` (`mykobo-onramp-deposit-handler.ts`), which selects `subsidizePreSwap` next for the `BUY && inputCurrency === EURC` branch (`fund-ephemeral-handler.ts`). +- Skip-Squid case (destination = Base USDC): the `squidRouterSwap` handler short-circuits directly to `destinationTransfer`. +- Cross-chain case (destination ≠ Base USDC): `squidRouterSwap` → `squidRouterPay` → `finalSettlementSubsidy` → `destinationTransfer` for supported EVM destinations. +- **Degenerate EUR→EURC-on-Base case:** `isEurToEurcBaseDirect` short-circuits the entire pipeline to a single `destinationTransfer` (no Nabla, no Squid, no `finalSettlementSubsidy`, no cleanup), because Mykobo already settles EURC on the Base ephemeral and the generic path would otherwise swap EURC→USDC→EURC for itself. See `05-integrations/mykobo.md`. +- Base ephemeral cleanup (`baseCleanupUsdc`, `baseCleanupEurc`, `baseCleanupAxlUsdc`) is performed out-of-flow by `BaseChainPostProcessHandler` after `complete`. +- **Removed:** the previous Monerium EUR on-ramp (EURe on Polygon → Squid → Moonbeam → XCM → Pendulum) is no longer active. See `monerium.md`. **BRL Off-ramp (Avenia/BRLA on Base):** User's crypto on source EVM → Squid bridge to Base USDC (user-signed, client-side) → Nabla-on-Base swap (USDC→BRLA) → Avenia PIX payout - Runtime backend phases: `initial` → `fundEphemeral` → `distributeFees` (on Base, USDC) → `subsidizePreSwap` → `nablaApprove` → `nablaSwap` → `subsidizePostSwap` → `brlaPayoutOnBase` → `complete` @@ -25,127 +34,120 @@ There are 29+ phase handlers in `apps/api/src/api/services/phases/handlers/`. Th - **Temporary disablement:** AssetHub→BRL quotes are currently not returned by the quote engine. The active BRL off-ramp corridor is source EVM → Base → PIX only; any legacy AssetHub→BRL route code should be treated as unreachable until the corridor is re-enabled. - Note: `distributeFees` runs **before** `nablaSwap` on offramp because fees are denominated in USDC and must be deducted before swapping to BRLA. - Naming: `nablaApprove`, `nablaSwap`, `distributeFees`, `subsidizePreSwap`, and `subsidizePostSwap` are polymorphic runtime phases that dispatch to the EVM (Base) branch when the ephemeral involved is on Base (BRL input or output corridor) and to the Substrate (Pendulum) branch otherwise. +- The EVM `subsidizePostSwap` branch may fund two bounded components in one transfer: the actual-vs-quoted Nabla output discrepancy and the quote-time discount subsidy. The discrepancy component uses `MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION`; the discount component uses `MAX_EVM_POST_SWAP_DISCOUNT_SUBSIDY_QUOTE_FRACTION`. **BRL On-ramp (Avenia/BRLA on Base):** PIX payment → Avenia mints BRLA on Base ephemeral → Nabla-on-Base swap (BRLA→USDC) → optional Squid → user destination - Runtime backend phases: `initial` → `brlaOnrampMint` (poll Base RPC, 30min outer / 5min inner) → `fundEphemeral` → `subsidizePreSwap` → `nablaApprove` → `nablaSwap` → `distributeFees` → `subsidizePostSwap` → `squidRouterSwap` → `destinationTransfer` → `complete` - Skip-Squid case (destination = Base USDC): the `squidRouterSwap` handler short-circuits directly to `destinationTransfer`. - Cross-chain case (destination ≠ Base USDC): `squidRouterSwap` → `squidRouterPay` → `finalSettlementSubsidy` → `destinationTransfer` for supported EVM destinations. **BRL→AssetHub quotes are temporarily disabled** and should not enter this phase chain. +- Amount precision: the Squid quote output is stored as the final EVM destination amount. `evmToEvm.inputAmountRaw` remains Base USDC raw and drives the Squid source-chain swap, while `evmToEvm.outputAmountRaw` and `quote.outputAmount` must use the destination token's raw/decimal precision before `destinationTransfer` is built. +- **Degenerate BRL→BRLA-on-Base case:** `isBrlToBrlaBaseDirect` short-circuits the entire pipeline to a single `destinationTransfer` (no Nabla, no `distributeFees`, no Squid, no `finalSettlementSubsidy`, no cleanup), because Avenia already mints BRLA on the Base ephemeral and the generic path would otherwise swap BRLA→USDC→BRLA for itself. Mirrors the EUR→EURC-on-Base bypass. See `05-integrations/brla.md`. - Base ephemeral cleanup (`baseCleanupUsdc`, `baseCleanupBrla`) is performed out-of-flow by a separate sweeper after `complete`; cleanup approvals are presigned but not part of the runtime nextPhase chain. **Alfredpay corridors:** Similar structure with `alfredpayOfframpTransfer` / `alfredpayOnrampMint` replacing the fiat provider phases. +- **Degenerate Polygon same-token onramp case:** Alfredpay mints `ALFREDPAY_EVM_TOKEN` (USDT) on Polygon. When the user requests that same token on Polygon (`quote.metadata.request.to === Networks.Polygon` **and** `quote.outputCurrency === ALFREDPAY_EVM_TOKEN`), the `squidRouterSwap` handler short-circuits to `finalSettlementSubsidy` with no swap. Any **other** Polygon output (e.g. USDC) still runs the real USDT→output swap — `quote.metadata.request.to` is the destination network, not the output token, so the short-circuit MUST also check `outputCurrency`. See `05-integrations/alfredpay.md`. +- **Amount precision on routed Alfredpay onramps:** when Alfredpay mints on Polygon and the user requests a different EVM output token, the routed Squid output is the final settlement amount. `evmToEvm.inputAmountRaw` remains the Polygon source-token raw amount, while `evmToEvm.outputAmountRaw` and `quote.outputAmount` MUST use the final destination token's raw/decimal precision. The direct Polygon same-token case remains at the minted token's precision. +- **Alfredpay offramp always runs `finalSettlementSubsidy`:** The `FinalSettlementSubsidyHandler` direct-transfer skip explicitly excludes `SELL && isAlfredpayToken(outputCurrency)`. This ensures the Polygon ephemeral is always subsidized to the expected amount before `alfredpayOfframpTransfer`, regardless of the `isDirectTransfer` flag. +- **`fund-ephemeral-handler` direct-transfer skip excludes Alfredpay offramps:** The `nextPhaseSelector` in `fund-ephemeral-handler.ts` skips to `destinationTransfer` for any ramp with `isDirectTransfer === true` **except** `SELL && isAlfredpayToken(outputCurrency)`. This preserves the existing skip for all other corridors while ensuring Alfredpay offramps proceed through `finalSettlementSubsidy` → `alfredpayOfframpTransfer`. **Cross-chain delivery (post-swap):** After the Nabla swap, tokens are routed to their final destination: -- From Pendulum to Stellar: `spacewalkRedeem` → `stellarPayment` +- ~~From Pendulum to Stellar (ARS-only since EUR was migrated to Mykobo): `spacewalkRedeem` → `stellarPayment`~~ — **REMOVED.** The Stellar/Spacewalk backend infrastructure was removed in commits `f89554d46` and `82761ba91`. `spacewalkRedeemHandler` and `stellarPaymentHandler` are no longer registered in `register-handlers.ts`. See `stellar-anchors.md`. - From Pendulum to Moonbeam: `pendulumToMoonbeamXcm` - From Pendulum to AssetHub: `pendulumToAssethubXcm` - From Pendulum to Hydration: `pendulumToHydrationXcm` → `hydrationToAssethubXcm` (if needed) -- From Base to supported EVM destinations (BRL onramp): `squidRouterApprove` → `squidRouterSwap` → `squidRouterPay` → optional `backupSquidRouter*` on destination → `destinationTransfer` +- From Base to supported EVM destinations (BRL and EUR onramps): `squidRouterApprove` → `squidRouterSwap` → `squidRouterPay` → optional `backupSquidRouter*` on destination → `destinationTransfer` - Trivial case (Base→Base USDC): direct `destinationTransfer` only (Squid skipped) +**History/status terminal transaction link:** The API's V2 final transaction hash/link must point to the terminal user-facing on-chain delivery phase, not to intermediate bridge/swap phases such as `squidRouterSwap`. For EVM onramps this is `destinationTransferTxHash`; for AssetHub onramps it is `pendulumToAssethubXcmHash` or `hydrationToAssethubXcmHash`; for active offramps it is the corridor terminal payout hash (`brlaPayoutTxHash`, `mykoboPayoutTxHash`, or `alfredpayOfframpTransferTxHash`). Post-complete cleanup sweeps are not user-facing delivery and must not be exposed as the final transaction. + ### Phase Transition Diagrams The following diagrams show the phase transitions for all on-ramp and off-ramp corridors as registered in `register-handlers.ts` and assembled by the route builders in `apps/api/src/api/services/transactions/{on,off}ramp/routes/`. Diamond nodes denote conditional branches resolved at route-build time (not runtime phase transitions). #### On-Ramp Phase Flow +The BRL (BRLA) and EUR (Mykobo) on-ramp corridors share the entire post-fiat phase chain on Base, including `fundEphemeral`. Only the initial fiat-watch phase differs (`brlaOnrampMint` vs `mykoboOnrampDeposit`). + ```mermaid graph TD Start([Start On-Ramp]) --> Init[initial] Init --> Provider{Fiat provider?} - %% --- Monerium EUR on Polygon --- - Provider -->|Monerium EUR| MonMint[moneriumOnrampMint] - MonMint --> MonFund[fundEphemeral] - MonFund --> MonSelf[moneriumOnrampSelfTransfer] - MonSelf --> MonSquidApprove[squidRouterApprove] - MonSquidApprove --> MonSquidSwap[squidRouterSwap] - MonSquidSwap --> MonDest{Destination?} - MonDest -->|EVM| FinalSubsidy[finalSettlementSubsidy] - MonDest -->|AssetHub / Hydration| MonToPendulum[moonbeamToPendulumXcm] - MonToPendulum --> SubPre[subsidizePreSwap] - - %% --- BRL via Avenia/BRLA on Base --- - Provider -->|BRLA BRL on Base| BrlaMint[brlaOnrampMint - poll Base RPC] - BrlaMint --> BrlaFund[fundEphemeral] - BrlaFund --> BrlaSubPreEvm[subsidizePreSwap] - BrlaSubPreEvm --> BrlaApproveEvm["nablaApprove (EVM branch)"] - BrlaApproveEvm --> BrlaSwapEvm["nablaSwap (EVM branch)"] - BrlaSwapEvm --> BrlaDistEvm["distributeFees (EVM branch)"] - BrlaDistEvm --> BrlaSubPostEvm[subsidizePostSwap] - BrlaSubPostEvm --> BrlaSquidSwap[squidRouterSwap] - BrlaSquidSwap --> BrlaDest{Destination = Base USDC?} - BrlaDest -->|Yes - short-circuit| DestTransfer[destinationTransfer] - BrlaDest -->|No - supported EVM only| BrlaSquidPay[squidRouterPay] - %% BRL -> AssetHub is temporarily disabled at quote eligibility. - BrlaSquidPay --> BrlaFinalSubsidy[finalSettlementSubsidy] - BrlaFinalSubsidy --> BrlaBackup{Backup bridge needed?} - BrlaBackup -->|Yes| BrlaBackupSquid[backupSquidRouter*] - BrlaBackup -->|No| DestTransfer - BrlaBackupSquid --> DestTransfer - - %% --- Alfredpay --- + %% --- Per-corridor fiat-watch entry phases --- + Provider -->|BRLA BRL on Base| BrlaMint[brlaOnrampMint - poll Base RPC, 30min/5min] + Provider -->|Mykobo EUR on Base| MykMint[mykoboOnrampDeposit - poll Base RPC, 24h/5min] Provider -->|Alfredpay| AfMint[alfredpayOnrampMint] + + %% --- Both BRL and EUR fund the Base ephemeral with ETH gas before swap --- + BrlaMint --> BrlaFund[fundEphemeral] + MykMint --> MykFund[fundEphemeral] + BrlaFund --> SubPreEvm + MykFund --> SubPreEvm + + %% --- Shared Base-EVM swap chain (BRL + EUR) --- + SubPreEvm["subsidizePreSwap (EVM branch)"] --> ApproveEvm["nablaApprove (EVM branch)"] + ApproveEvm --> SwapEvm["nablaSwap (EVM branch, fiat-stable to USDC)"] + SwapEvm --> DistEvm["distributeFees (EVM branch)"] + DistEvm --> SubPostEvm["subsidizePostSwap (EVM branch)"] + SubPostEvm --> SquidSwap[squidRouterSwap] + + %% --- Destination routing (shared) --- + SquidSwap --> Dest{Destination = Base USDC?} + Dest -->|Yes - short-circuit| DestTransfer[destinationTransfer] + Dest -->|No - supported EVM| SquidPay[squidRouterPay] + SquidPay --> FinalSubsidy[finalSettlementSubsidy] + FinalSubsidy --> Backup{Backup bridge needed?} + Backup -->|Yes| BackupSquid[backupSquidRouter*] + Backup -->|No| DestTransfer + BackupSquid --> DestTransfer + + %% --- Alfredpay branch: squidRouterSwap handler short-circuits to destinationTransfer --- + %% (squid-router-phase-handler.ts:72 detects isAlfredpayOnramp and skips squidRouterPay + finalSettlementSubsidy) AfMint --> AfFund[fundEphemeral] AfFund --> AfSquidSwap[squidRouterSwap] - AfSquidSwap --> AfSquidPay[squidRouterPay] - AfSquidPay --> FinalSubsidy - - %% --- Common Pendulum swap path (Monerium AssetHub / Hydration) --- - SubPre --> NablaApprove[nablaApprove] - NablaApprove --> NablaSwap[nablaSwap] - NablaSwap --> SubPost[subsidizePostSwap] - SubPost --> Dist[distributeFees] - Dist --> AhRoute{Output token?} - AhRoute -->|USDC| ToAh[pendulumToAssethubXcm] - AhRoute -->|DOT / USDT| ToHydra[pendulumToHydrationXcm] - ToHydra --> HydraSwap[hydrationSwap] - HydraSwap --> HydraToAh[hydrationToAssethubXcm] - - %% --- Final settlement (EVM via Squid) --- - FinalSubsidy --> DestTransfer + AfSquidSwap -.short-circuit.-> DestTransfer %% --- Terminal --- DestTransfer --> Complete([complete]) - ToAh --> Complete - HydraToAh --> Complete ``` +> Notes: +> - **EUR onramp funds the ephemeral.** `mykoboOnrampDeposit` transitions to `fundEphemeral` (`mykobo-onramp-deposit-handler.ts`), which then transitions to `subsidizePreSwap` (`fund-ephemeral-handler.ts` `BUY && inputCurrency === EURC` branch). This matches BRL onramp behavior and ensures the Base ephemeral has ETH gas for `nablaApprove`/`nablaSwap`/squid txs. +> - **EUR/BRL onramps skip Pendulum funding.** `getRequiresPendulumEphemeralAddress` returns `false` for EURC and BRL inputs, so the registration flow never creates or funds a Pendulum ephemeral for these corridors. All movement is Base-EVM only. See `ephemeral-accounts.md`. +> - **SquidRouter RPC selection is sourced from `bridgeMeta.fromNetwork`, not the input currency.** `squid-router-phase-handler.ts` computes the source network from `bridgeMeta.fromNetwork` (set at registration time by the route builder) and passes it to `getClient(network)` for both approve and swap calls. The earlier heuristic that selected the RPC from `inputCurrency` was removed because EUR-onramp presigned transactions both carry `network: Networks.Base` (`mykobo-to-evm.ts`), which would have triggered a wrong-chain signer error on cross-chain destinations (e.g., `invalid chain id for signer: have 8453 want 137` for EUR → Polygon USDT). +> - **Alfredpay onramp short-circuits.** `squid-router-phase-handler.ts:72` detects `isAlfredpayOnramp` and transitions directly to `destinationTransfer`, skipping `squidRouterPay` and `finalSettlementSubsidy`. +> - The Pendulum-side on-ramp swap chain (`subsidizePreSwap` → `nablaApprove` → `nablaSwap` → `subsidizePostSwap` → `distributeFees` → `pendulumToAssethubXcm` / `pendulumToHydrationXcm` → `hydrationSwap` → `hydrationToAssethubXcm`) was used by the legacy Monerium-EUR-via-Pendulum corridor and by `avenia-to-assethub` BRL→AssetHub. Both corridors are **inactive**: Monerium was replaced by Mykobo-on-Base, and BRL↔AssetHub is temporarily disabled at quote eligibility. The Substrate-branch on-ramp handlers remain registered but are not reached by any active route. + #### Off-Ramp Phase Flow +The BRL (BRLA) and EUR (Mykobo) off-ramp corridors share the entire chain from `fundEphemeral` through `subsidizePostSwap`. Only the terminal payout phase differs (`brlaPayoutOnBase` vs `mykoboPayoutOnBase`). + ```mermaid graph TD Start([Start Off-Ramp]) --> Init[initial] Init --> Corridor{Output fiat?} - %% --- BRL via Avenia/BRLA on Base --- + %% --- Shared Base entry: BRL + EUR --- %% The user-signed Squid bridge (source EVM -> Base USDC) is submitted client-side - %% before the backend runtime starts; squidRouterPay is a no-op for SELL. - %% AssetHub -> BRL is temporarily disabled at quote eligibility. - Corridor -->|BRL on Base| BrlFund[fundEphemeral] - BrlFund --> BrlDistEvm["distributeFees (EVM branch)"] - BrlDistEvm --> BrlSubPreEvm[subsidizePreSwap] - BrlSubPreEvm --> BrlApproveEvm["nablaApprove (EVM branch)"] - BrlApproveEvm --> BrlSwapEvm["nablaSwap (EVM branch, USDC to BRLA)"] - BrlSwapEvm --> BrlSubPostEvm[subsidizePostSwap] - BrlSubPostEvm --> BrlPayout[brlaPayoutOnBase] + %% before the backend runtime starts. AssetHub -> BRL is temporarily disabled at quote eligibility. + Corridor -->|BRL or EUR on Base| BaseFund[fundEphemeral] + BaseFund --> BaseDistEvm["distributeFees (EVM branch)"] + BaseDistEvm --> BaseSubPreEvm["subsidizePreSwap (EVM branch)"] + BaseSubPreEvm --> BaseApproveEvm["nablaApprove (EVM branch)"] + BaseApproveEvm --> BaseSwapEvm["nablaSwap (EVM branch, USDC to BRLA or USDC to EURC)"] + BaseSwapEvm --> BaseSubPostEvm["subsidizePostSwap (EVM branch)"] + BaseSubPostEvm --> Payout{Output fiat?} + + %% --- Per-corridor terminal payout phase --- + Payout -->|BRL| BrlPayout[brlaPayoutOnBase] + Payout -->|EUR| MykPayout[mykoboPayoutOnBase] BrlPayout --> Complete([complete]) - Complete -.post-process.-> BaseCleanup[BaseChainPostProcessHandler
sweeps BRLA + USDC] - - %% --- Stellar-anchored fiat (EUR / ARS) --- - Corridor -->|EUR / ARS via Stellar| StellarStart{Source chain?} - StellarStart -->|EVM| MoonToPendulum[moonbeamToPendulumXcm] - StellarStart -->|AssetHub| AhDist[distributeFees] - MoonToPendulum --> EvmDist[distributeFees] - EvmDist --> SubPre[subsidizePreSwap] - AhDist --> SubPre - SubPre --> NablaApprove[nablaApprove] - NablaApprove --> NablaSwap[nablaSwap - input to wrapped EURC] - NablaSwap --> SubPost[subsidizePostSwap] - SubPost --> Spacewalk[spacewalkRedeem] - Spacewalk --> StellarPay[stellarPayment] - StellarPay --> Complete - - %% --- Alfredpay --- + MykPayout --> Complete + + %% --- Base post-process cleanup (after complete, out-of-flow) --- + Complete -.post-process.-> BaseCleanup[BaseChainPostProcessHandler
sweeps BRLA + USDC + EURC + AxlUSDC] + + %% --- Alfredpay (Polygon, different chain) --- Corridor -->|Alfredpay| AfPermit[squidRouterPermitExecute] AfPermit --> AfFund[fundEphemeral] AfFund --> AfFinalSubsidy[finalSettlementSubsidy] @@ -153,7 +155,12 @@ graph TD AfTransfer --> Complete ``` -> Note: `pendulumCleanup` and any chain-specific post-process handlers (`PolygonPostProcessHandler`, `HydrationPostProcessHandler`, `BaseChainPostProcessHandler`) execute after `complete` via the post-process subsystem, not as in-flow phases. See `ephemeral-accounts.md`. +> Notes: +> - The ARS-via-Stellar off-ramp is **REMOVED.** Backend infrastructure was removed in commits `f89554d46` and `82761ba91`. `spacewalkRedeemHandler` and `stellarPaymentHandler` are no longer registered. See `stellar-anchors.md`. +> - `BaseChainPostProcessHandler` sweeps **all four** Base tokens regardless of corridor (`base-chain-post-process-handler.ts:9`: `BASE_CLEANUP_PHASES = ["baseCleanupBrla", "baseCleanupUsdc", "baseCleanupEurc", "baseCleanupAxlUsdc"]`). Per-corridor route builders only presign the subset they need. +> - `pendulumCleanup` and other chain-specific post-process handlers (`PolygonPostProcessHandler`, `HydrationPostProcessHandler`) execute after `complete` via the post-process subsystem, not as in-flow phases. See `ephemeral-accounts.md`. +> - **Alfredpay offramp `finalSettlementSubsidy` is mandatory.** The direct-transfer short-circuit in `FinalSettlementSubsidyHandler` explicitly excludes Alfredpay SELL ramps, so the subsidy always runs regardless of `isDirectTransfer`. +> - **`fund-ephemeral-handler` direct-transfer skip excludes Alfredpay offramps.** The `nextPhaseSelector` skips to `destinationTransfer` for any ramp with `isDirectTransfer === true` **except** when `state.type === SELL && isAlfredpayToken(outputCurrency)`. This preserves existing skip behavior for all non-Alfredpay corridors while ensuring Alfredpay offramps proceed through `finalSettlementSubsidy` → `alfredpayOfframpTransfer`. ### Phase Handler Categories @@ -164,7 +171,7 @@ graph TD | **DEX Swap (Substrate)** | `nabla-approve-handler` (Substrate branch), `nabla-swap-handler` (Substrate branch), `hydration-swap-handler` | Ephemeral → DEX contract → ephemeral | | **DEX Swap (EVM)** | `nabla-approve-handler` (EVM branch), `nabla-swap-handler` (EVM branch) | Base ephemeral → Nabla-on-Base contract → Base ephemeral | | **Bridge / XCM** | `moonbeam-to-pendulum-handler`, `moonbeam-to-pendulum-xcm-handler`, `pendulum-to-moonbeam-xcm-handler`, `pendulum-to-assethub-phase-handler`, `pendulum-to-hydration-xcm-phase-handler`, `hydration-to-assethub-xcm-phase-handler`, `spacewalk-redeem-handler` | Source chain ephemeral → destination chain ephemeral | -| **Fiat provider** | `stellar-payment-handler`, `brla-payout-base-handler` (Base), `brla-onramp-mint-handler` (polls Base BRLA arrival), `monerium-onramp-mint-handler`, `monerium-onramp-self-transfer-handler`, `alfredpay-offramp-transfer-handler`, `alfredpay-onramp-mint-handler` | Ephemeral ↔ provider | +| **Fiat provider** | `stellar-payment-handler`, `brla-payout-base-handler` (Base), `brla-onramp-mint-handler` (polls Base BRLA arrival), `mykobo-payout-handler` (Base EURC payout), `mykobo-onramp-deposit-handler` (polls Base EURC arrival), `alfredpay-offramp-transfer-handler`, `alfredpay-onramp-mint-handler` | Ephemeral ↔ provider | | **SquidRouter** | `squid-router-phase-handler`, `squid-router-pay-phase-handler`, `squidrouter-permit-execution-handler` (incl. no-permit fallback) | Ephemeral/executor → SquidRouter → destination | | **Fee distribution** | `distribute-fees-handler` (Substrate Pendulum + EVM Multicall3 on Base) | Ephemeral → platform fee collection address(es) | | **Lifecycle** | `initial-phase-handler`, `destination-transfer-handler` | Setup and final delivery | @@ -172,23 +179,31 @@ graph TD ## Security Invariants 1. **Phase ordering MUST match the expected corridor flow** — Each corridor has a fixed phase sequence. The phase processor MUST NOT allow out-of-order transitions. The phase handler's return value determines the next phase, and it MUST match the expected sequence for the ramp's corridor. -2. **Subsidy amounts MUST be bounded** — Every subsidization handler (`subsidizePreSwap`, `subsidizePostSwap`, `fundEphemeral`, `finalSettlementSubsidy`) must enforce a maximum USD-equivalent cap to prevent draining the funding account on a single ramp. +2. **Subsidy amounts MUST be bounded** — Every subsidization handler (`subsidizePreSwap`, `subsidizePostSwap`, `fundEphemeral`, `finalSettlementSubsidy`) must enforce a maximum USD-equivalent cap to prevent draining the funding account on a single ramp. EVM pre/post-swap cap fractions are loaded from environment configuration and default to `0.05`. EVM `subsidizePostSwap` must not treat the top-up as one undifferentiated bucket: the actual-vs-quoted swap-output discrepancy and the discount-derived subsidy must each pass their own configured cap before any transfer is submitted. 3. **Presigned transactions MUST be used in the correct phase** — `getPresignedTransaction(state, phase)` retrieves the transaction for a specific phase. A phase handler MUST NOT access presigned transactions for a different phase. 4. **Token amounts at each phase MUST be traceable to the original quote** — The quote defines input/output amounts. Each phase should operate on amounts derived from the quote, not from untrusted runtime state. 5. **Cross-chain transfers MUST wait for finalization before advancing** — XCM and bridge transfers must confirm the source chain has finalized the send before the destination chain phase begins. Non-finalized transfers can be reverted by chain reorganization. 6. **Fee distribution MUST happen after all user-facing phases complete** — The `distributeFees` phase occurs near the end of the flow. Deducting fees before the user receives their funds risks the ramp failing after fees are taken. 7. **Each phase handler MUST be idempotent or have re-execution guards** — If the phase processor retries a phase (due to timeout or recoverable error), the handler must not double-execute (double-swap, double-transfer, double-fund). Nonce checks and balance pre-checks serve this purpose. +8. **SquidRouter RPC selection MUST be driven by `bridgeMeta.fromNetwork`** — `squid-router-phase-handler.ts` resolves the network via `bridgeMeta.fromNetwork` (set at registration by the route builder) and passes it to `getClient(network)` for both approve and swap calls. Selecting the RPC from `inputCurrency` would mis-route EUR onramps whose presigned txs carry `network: Networks.Base` to non-Base chains (causing `invalid chain id for signer: have X want Y` errors on cross-chain destinations). +9. **On same-chain destinations, `destinationTransfer` MUST be the first executable nonce after the broadcast SquidRouter txs — no nonce gap** — When the SquidRouter source chain equals the destination chain (e.g., EUR → Base EURC, BRL → Base USDC, Alfredpay Polygon-internal), the ephemeral shares ONE nonce sequence for `squidRouterApprove` → `squidRouterSwap` → `destinationTransfer`. The runtime broadcasts these in order, so `destinationTransfer` MUST carry the nonce immediately following `squidRouterSwap`. Two failure modes must both be avoided: (a) **collision** — reusing a nonce already consumed by an earlier tx; (b) **gap** — signing `destinationTransfer` with a nonce *above* the next live nonce, which the chain rejects as "nonce too high" so the tx never mines and user funds strand on the ephemeral (root cause of the EUR→Base 0-delivery incident: `destinationTransfer` was signed after the post-`complete` cleanup approvals — and, originally, after handler-less backup re-swap txs — leaving a 1–2 nonce gap). The route builders therefore place `destinationTransfer` directly after `squidRouterSwap`, then append the post-`complete` cleanup approvals, and OMIT the backup re-swap txs on the same-chain branch (those have no registered handler — F-054 — and on a shared sequence would only widen the gap). Enforced in `mykobo-to-evm.ts`, `alfredpay-to-evm.ts`, and `avenia-to-evm-base.ts`. +10. **`destinationTransfer` MUST fail fast on a detectable nonce gap rather than retry-and-strand** — `destination-transfer-handler.ts` reads the ephemeral's live nonce (`getTransactionCount`, `blockTag: "pending"`) and compares it to the presigned `destinationTransfer` nonce before broadcasting. If the presigned nonce is *ahead* of the live nonce the transfer can never mine, so the handler raises an `UnrecoverablePhaseError` for manual review instead of looping until the retry budget silently exhausts (which previously stranded funds with no terminal signal). Using `"pending"` rather than `"latest"` ensures the check accounts for mempool transactions — a prior ephemeral tx still in the mempool would otherwise lower the observed nonce and falsely flag a gap. The live-nonce read is best-effort: an RPC failure or a malformed presigned transaction logs a warning and falls through to the normal balance-poll path, so a transient RPC outage or an unparseable tx cannot wedge the happy path. +11. **Base EVM `nablaSwap` MUST be dry-run before broadcast** — `nabla-swap-handler.ts` must simulate the exact presigned raw swap transaction with `eth_call` from the Base ephemeral account before calling `sendRawTransaction`. The dry-run MUST use the decoded transaction's actual recipient, calldata, value, gas, and fee fields, and should use `blockTag: "pending"` so liquidity-sensitive failures are checked against the freshest available Base state. If the simulation reverts (for example `SP:quoteSwapInto:EXCEEDS_MAX_COVERAGE_RATIO`), the handler MUST fail before submitting the transaction so the ephemeral does not spend gas on a predictably reverting swap. ## Threat Vectors & Mitigations | Threat | Attack Scenario | Mitigation | |---|---|---| | **Phase skip / injection** | Attacker with DB access modifies `currentPhase` to skip subsidization or jump to `complete`. | Phase transitions are controlled by handler return values, not external input. DB access is a prerequisite (see `state-machine.md`, Threat: "Phase skip attack"). No DB-level constraints on valid transitions exist. | -| **Subsidy drain** | A crafted ramp triggers multiple subsidization phases, each at the maximum allowed amount, draining the funding account. | Per-ramp subsidy caps (`MAX_FINAL_SETTLEMENT_SUBSIDY_USD`, balance pre-checks in pre/post-swap handlers). No aggregate cross-ramp cap exists — many concurrent ramps could still drain funds. | +| **Subsidy drain** | A crafted ramp triggers multiple subsidization phases, each at the maximum allowed amount, draining the funding account. | Per-ramp subsidy caps (`MAX_FINAL_SETTLEMENT_SUBSIDY_USD`, balance pre-checks in pre/post-swap handlers). EVM pre/post-swap caps are env-configured quote-relative fractions, and EVM post-swap subsidy is split into discrepancy and discount components with independent caps. No aggregate cross-ramp cap exists — many concurrent ramps could still drain funds. | | **Double-execution on retry** | Phase processor retries after timeout. Handler re-executes a swap or transfer that already completed. Funds are consumed twice. | Nonce guards in Spacewalk and Hydration handlers detect prior execution. Other handlers rely on transaction nonce uniqueness at the chain level. Not all handlers have explicit re-execution guards. | | **Stale presigned transaction** | Client registers a ramp, waits for market movement, then starts the ramp with presigned transactions based on the old quote. | `RAMP_START_EXPIRATION_TIME_SECONDS` limits the window between registration and start. Quote expiry (10 minutes) limits how old the amounts can be. | +| **Direct API ramp mutation during planned downtime** | A partner bypasses the UI maintenance state and calls register/update/start while operators expect Vortex services to be paused. | Ramp mutation routes run the backend maintenance guard and return `503` with `Retry-After`, `maintenance_start`, and `maintenance_end` before registration, presigned transaction updates, or phase processing begins. | | **Cross-chain race condition** | XCM transfer submitted but not finalized. Next phase on destination chain reads a zero balance. | Most XCM handlers use `waitForFinalization=true`. Exception: Hydration skips finalization (F-009, deferred). | | **Fee distribution failure** | `distributeFees` fails, but ramp is already marked `complete`. Platform loses fee revenue. | `distributeFees` is a phase — if it fails, the ramp enters retry, not `complete`. However, if the ramp fails after user delivery but before fee distribution, fees may be lost. | +| **Wrong-chain signer on SquidRouter** | RPC selected from `inputCurrency` heuristic instead of `bridgeMeta.fromNetwork`; EUR-onramp presigned txs (`network: Networks.Base`) submitted on Polygon RPC → `invalid chain id for signer` and the ramp stalls in `squidRouterSwap`. | `squid-router-phase-handler.ts` reads `bridgeMeta.fromNetwork` (set by the route builder) and routes both approve+swap to that chain's client. Heuristic removed. | +| **Same-chain destination nonce gap (0-delivery)** | SquidRouter source chain == destination chain (e.g. EUR → Base EURC). `destinationTransfer` is signed *after* the post-`complete` cleanup approvals (and handler-less backup re-swap txs), leaving its nonce above the live ephemeral nonce. The chain rejects it as "nonce too high"; it never mines, the ramp retries until the budget exhausts, and user funds strand on the ephemeral with no terminal signal. | Route builders (`mykobo-to-evm.ts`, `alfredpay-to-evm.ts`, `avenia-to-evm-base.ts`) place `destinationTransfer` at the first nonce after `squidRouterSwap`, append cleanups afterward, and omit the same-chain backup re-swap txs. `destination-transfer-handler.ts` additionally fails fast (`UnrecoverablePhaseError`) when the presigned nonce is detected ahead of the live nonce. | +| **Predictable EVM Nabla swap revert** | Base Nabla pool liquidity or coverage-ratio constraints make the presigned swap impossible before it is broadcast. Without preflight, the ephemeral submits a transaction that reverts on-chain, wastes gas, and only fails after receipt polling. | The EVM branch of `nabla-swap-handler.ts` runs `eth_call` on the exact decoded presigned raw transaction from the ephemeral account with `blockTag: "pending"`. A simulation revert aborts before `sendRawTransaction`, preserving the revert reason in the phase error log. | ## Audit Checklist @@ -207,8 +222,16 @@ graph TD - [EXISTING FINDING] **F-054**: Backup presigned transactions (`backupSquidRouterApprove`, `backupSquidRouterSwap`, `backupApprove`) have no registered phase handlers — dead code or missing implementation. - [ ] No aggregate cross-ramp subsidy rate limiting — many concurrent ramps could drain funding account - [x] Active BRL corridors are end-to-end on Base — no Moonbeam/Pendulum/XCM involvement. **PASS** — `register-handlers.ts` does not register any `brlaPayoutOnMoonbeam` phase; active BRL quotes are limited to the Base/EVM route builders (`evm-to-brl-base.ts` and `avenia-to-evm-base.ts`). BRL↔AssetHub is temporarily disabled at quote eligibility. +- [x] Active EUR corridors are end-to-end on Base — no Pendulum/Spacewalk/Stellar involvement for EUR. **PASS** — `register-handlers.ts` registers `mykoboOnrampDeposit` and `mykoboPayoutOnBase`. EUR off-ramp uses `evm-to-mykobo.ts`; EUR on-ramp uses `mykobo-to-evm.ts`. Stellar-EUR off-ramp and Monerium-EUR on-ramp are removed. See `05-integrations/mykobo.md`. +- [x] On the EUR/Base corridor, `distributeFees` is positioned **before** `nablaSwap` on offramp (USDC fees deducted pre-EUR-swap) and **after** `nablaSwap` on onramp (USDC fees deducted post-EUR→USDC swap). **PASS** — verified in `evm-to-mykobo.ts` and `mykobo-to-evm.ts`, mirroring the BRL/Base structure. - [x] On the BRL/Base corridor, `distributeFees` is positioned **before** `nablaSwap` on offramp (USDC fees deducted pre-BRL-swap) and **after** `nablaSwap` on onramp (USDC fees deducted post-BRL→USDC swap). **PASS** — verified in `evm-to-brl-base.ts` and `avenia-to-evm-base.ts`. -- [x] EVM subsidy phases enforce a USD-equivalent cap. **PASS** — `MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION="0.05"` clamps subsidy to ≤5% of the quote's input/output amount in the EVM branches of `subsidize-pre-swap-handler.ts` and `subsidize-post-swap-handler.ts` (F-NEW-02 resolved). Over-cap cases are intentionally recoverable retries: no transfer is submitted, and the ramp waits for operator intervention instead of moving to `failed`. +- [x] EVM subsidy phases enforce USD-equivalent caps. **PASS** — `MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION` defaults to `0.05` and clamps pre-swap subsidy plus the post-swap actual-vs-quoted swap-output discrepancy component. `MAX_EVM_POST_SWAP_DISCOUNT_SUBSIDY_QUOTE_FRACTION` defaults to `0.05` and separately clamps the post-swap discount-derived component. Both values are env-overridable. Over-cap cases are intentionally recoverable retries: no transfer is submitted, and the ramp waits for operator intervention instead of moving to `failed`. - [x] BRL on-ramp `backupApprove` allowance is bounded (no `maxUint256`). **PASS** — `avenia-to-evm-base.ts` `backupApprove` is set to `inputAmountRawFinalBridge × 1.05` (F-NEW-03 resolved). - [x] EVM ephemeral cleanup coverage. **PASS** — **Polygon** (`PolygonPostProcessHandler`), **Hydration** (`HydrationPostProcessHandler`), and **Base** (`BaseChainPostProcessHandler`, sweeping both BRLA and USDC) are registered and active. **AssetHub** handler is registered but a no-op stub (`shouldProcess` always returns `false`). ETH gas dust on EVM ephemerals is not swept (intentional). F-NEW-05 resolved. See `ephemeral-accounts.md` for the full cleanup architecture. - [x] Subsidy phase handlers extend the recoverable-retry budget. **PASS** — `subsidize-pre-swap-handler.ts` and `subsidize-post-swap-handler.ts` declare `getMaxRetries(): 200`, overriding the global `MAX_RETRIES = 8` in `phase-processor.ts`. Recoverable-exhausted ramps in subsidy phases wait (no `failed` transition) until a human tops up the funding account or cancels the ramp. +- [x] `squid-router-phase-handler.ts` resolves the source network from `bridgeMeta.fromNetwork` (not from `inputCurrency`); both `squidRouterApprove` and `squidRouterSwap` use the same `getClient(network)`. +- [x] On same-chain destinations (source == destination, e.g. EUR → Base EURC), `destinationTransfer` is placed at the first nonce **immediately after** `squidRouterSwap` (no gap), cleanups are appended after it, and the handler-less backup re-swap txs are omitted — verified in `mykobo-to-evm.ts`, `alfredpay-to-evm.ts`, `avenia-to-evm-base.ts`. Prevents the "nonce too high" 0-delivery strand. +- [x] `destination-transfer-handler.ts` fails fast on a nonce gap. **PASS** — before broadcasting it compares the presigned `destinationTransfer` nonce against the live ephemeral nonce (`getTransactionCount`, `blockTag: "pending"`) and throws `UnrecoverablePhaseError` if the presigned nonce is ahead, instead of retrying until the budget exhausts. The live-nonce read is best-effort (RPC failure warns and falls through), so a transient RPC outage cannot wedge the happy path. +- [x] EUR (Mykobo) and BRL (BRLA) onramps/offramps do NOT require a Pendulum ephemeral. `getRequiresPendulumEphemeralAddress` returns `false` for EURC and BRL inputs; registration skips Pendulum funding for these corridors. +- [x] Active maintenance windows block `POST /v1/ramp/register`, `POST /v1/ramp/update`, and `POST /v1/ramp/start` before ramp state mutation or phase processing. +- [x] Base EVM `nablaSwap` dry-runs the exact presigned swap before broadcast. **PASS** — `nabla-swap-handler.ts` decodes the serialized transaction with `parseTransaction`, calls Base `eth_call` from the ephemeral sender using the decoded transaction fields and `blockTag: "pending"`, and only then calls `sendRawTransaction` if the call succeeds. diff --git a/docs/security-spec/03-ramp-engine/transaction-validation.md b/docs/security-spec/03-ramp-engine/transaction-validation.md index eec318032..5bfc50323 100644 --- a/docs/security-spec/03-ramp-engine/transaction-validation.md +++ b/docs/security-spec/03-ramp-engine/transaction-validation.md @@ -23,7 +23,7 @@ Several phases are broadcast from the user's wallet, not from an ephemeral key, User-wallet phases: -- `moneriumOnrampMint` — User wallet authorizes Monerium mint. +- `moneriumOnrampMint` — (Deprecated; Monerium is removed — see `05-integrations/monerium.md`. Validation logic retained for any in-flight legacy ramps.) User wallet authorizes Monerium mint. - `squidRouterApprove` / `squidRouterSwap` — SELL direction only (BUY direction is ephemeral-signed). - `squidRouterNoPermitTransfer` — Direct ERC-20 transfer from user wallet (when source ERC-20 lacks EIP-2612 permit and direction is direct-transfer). - `squidRouterNoPermitApprove` — User wallet approves Squid spender. @@ -49,6 +49,7 @@ The two layers together guarantee that the client cannot (a) sneak a malicious p 7. **`areAllTxsIncluded` is only an inclusion guard** — It may remain metadata-only (`phase + network + nonce + signer`) if each submitted non-skipped transaction is content-bound in `validatePresignedTxs` against the unsigned transaction selected with the same identity keys. 8. **No chain type or transaction format may be silently skipped during validation** — If a new chain or transaction format is added, the validator must either handle it or reject it. Silent pass-through (`return` without validation) is forbidden. 9. **Validation MUST occur before any presigned transaction is persisted or executed** — The `updateRamp` and `startRamp` flows must reject invalid transactions before merging them into ramp state. +10. **Ephemeral addresses submitted at `registerRamp` MUST be proven fresh on every supported chain of their type before transactions are built** — Address format validation is insufficient. For each ephemeral type the client submits, the server MUST query every supported chain of that type (not only the chains the specific ramp route will use) and reject the registration if any check finds non-zero nonce, non-zero free balance, or (for Stellar) an account that already exists on-chain. Checking the full supported set prevents future phase-handler additions from silently reopening the freshness gap. Fail-closed on RPC errors. Without this, the server builds presigned transactions with assumed-fresh nonces, and execution halts mid-ramp on the first chain where the assumption breaks. ## Threat Vectors & Mitigations @@ -63,6 +64,7 @@ The two layers together guarantee that the client cannot (a) sneak a malicious p | **Transaction data substitution via metadata matching** | Client submits transactions with correct phase/network/nonce/signer metadata but different txData content. | **MITIGATED (F-043)**: `validatePresignedTxs` resolves the matching unsigned transaction by the same identity keys and performs content validation before `areAllTxsIncluded` is used as the final inclusion guard. | | **EVM contract target or execution-parameter substitution** | Client signs a raw EVM transaction to an attacker-controlled contract, or signs the expected transaction with gas/fee parameters too low to execute reliably. | **MITIGATED (F-050)**: Raw signed EVM transactions are recovered and compared to the server-issued unsigned `to`, `data`, `value`, and `nonce`; gas limit and fee caps must be at least the server-issued values, and contract-creation transactions are rejected. | | **New phase/format added without validation** | A developer adds a new phase and the validator silently treats it as EVM because the phase type falls through to a default. | **MITIGATED (F-047)**: `getTransactionTypeForPhase` now throws for unknown phases instead of defaulting to EVM. | +| **Non-fresh ephemeral submitted at registration** | Client submits an ephemeral address that already has on-chain history (non-zero nonce on Substrate/EVM, or an existing Stellar account). Backend builds presigned transactions assuming nonce 0; execution halts mid-ramp on the first signed broadcast after subsidies/funding have already been committed. | **MITIGATED (F-072)**: `registerRamp` invokes `validateEphemeralAccountsFresh()` after `normalizeAndValidateSigningAccounts`. For each ephemeral type the client provides, it checks every supported chain of that type (Substrate: pendulum, hydration, assethub; EVM: all configured EVM networks including Moonbeam; Stellar). Substrate: requires `nonce === 0 && free === 0`. EVM: requires `nonce === 0`. Stellar: account must not exist on Horizon. Fail-closed on RPC errors. | ## Audit Checklist @@ -75,7 +77,7 @@ The two layers together guarantee that the client cannot (a) sneak a malicious p - [x] **F-047**: `getTransactionTypeForPhase` throws on unknown phases instead of defaulting to EVM. - [x] **F-048**: Stellar payment validation requires exactly one operation. - [x] **F-049**: `stellarCleanup` no longer falls through with only parse/signature checks; it validates transaction source and an expected cleanup operation count range. -- [x] **F-050**: EVM validation checks raw transaction `to`, `data`, `value`, `nonce`, signer, chain ID, gas limit, and fee caps against the server-issued unsigned transaction; contract creation is rejected. +- [x] **F-050**: EVM validation checks raw transaction `to`, `data`, `value`, `nonce`, signer, chain ID, gas limit, and fee caps against the server-issued unsigned transaction; contract creation is rejected. Native-token destination transfers (where viem's `parseTransaction` returns `data: undefined`) are normalized: both sides of the calldata equality check coerce empty/undefined calldata to `"0x"` so legitimate native transfers are not rejected (`apps/api/src/api/services/transactions/validation.ts:126`). - [x] `validatePresignedTxs` is called in both `updateRamp` and `startRamp` — dual validation confirmed - [x] `validateAllPresignedTransactionsSigned` checks every expected transaction has a corresponding signed entry - [x] EVM raw transaction validation (`validateEvmTransaction`) checks `from`, `chainId`, `nonce`, `to`, `data`, `value`, gas limit, and fee caps against expected signer, chain, and server-issued unsigned payload @@ -97,3 +99,4 @@ The two layers together guarantee that the client cannot (a) sneak a malicious p - [x] **Chainless EVM tx rejection**: `verifySignedEvmTransaction` rejects raw txs whose decoded `chainId` is `undefined` (pre-EIP-155 legacy txs), closing a cross-chain replay bypass that existed even when `sandboxEnabled` was false. - [x] **Backup re-verification**: `meta.additionalTxs` must contain exactly the expected backup set, and every backup is re-run through the primary's validator (EVM signer + nonce + content; Substrate signer + call-equality via `method.toHex()`; Stellar signer + per-phase shape), so a malicious client cannot register ignored extras or backups that encode a different call or signer than the primary tx. - [x] **`updateRamp` subset submissions**: `validatePresignedTxs` accepts `{ requireComplete: false }` for partial submissions but still rejects extra/unknown txs and still applies full per-tx content validation; `requireComplete` defaults to `true` for `startRamp`. +- [x] **F-072**: `registerRamp` proves each submitted ephemeral fresh on every supported chain of its type before building transactions. `validateEphemeralAccountsFresh()` (`apps/api/src/api/services/ramp/ephemeral-freshness.ts`) is invoked after `normalizeAndValidateSigningAccounts`. The supported-network lists (`SUPPORTED_SUBSTRATE_NETWORKS`: pendulum, hydration, assethub; `SUPPORTED_EVM_NETWORKS`: all configured EVM networks including Moonbeam) MUST be kept in sync with any chain an ephemeral may ever sign on. Substrate `nonce === 0 && free === 0`; EVM `nonce === 0`; Stellar account must not exist. RPC errors fail closed with `SERVICE_UNAVAILABLE`. diff --git a/docs/security-spec/05-integrations/alfredpay.md b/docs/security-spec/05-integrations/alfredpay.md index 96c472d4c..79d79d96e 100644 --- a/docs/security-spec/05-integrations/alfredpay.md +++ b/docs/security-spec/05-integrations/alfredpay.md @@ -2,33 +2,36 @@ ## What This Does -Alfredpay is a fiat payment provider supporting on-ramp and off-ramp operations across multiple currencies and countries. It is used for ramps where BRLA and Monerium do not cover the target market (e.g. ARS, MXN, COP, USD via ACH). +Alfredpay is a fiat payment provider supporting on-ramp and off-ramp operations across multiple currencies and countries. It is used for ramps where BRLA and Mykobo do not cover the target market (e.g. ARS, MXN, COP, USD via ACH). **Provider type:** Both (on-ramp and off-ramp) **Fiat currencies:** Multiple (varies by country, validated via `AlfredPayCountry` enum) -**Chains involved:** Polygon (Alfredpay-side, USDC), EVM destinations via SquidRouter (Polygon → Base/other) +**Chains involved:** Polygon (Alfredpay-side, USDT / `ALFREDPAY_EVM_TOKEN`), EVM destinations via SquidRouter (Polygon → Base/other) **Customer types:** Individual (KYC) and Business (KYB) — selected via `AlfredpayCustomerType`. The controller maps Alfredpay's KYB status to the platform's `AlfredPayStatus` via `mapKybStatus`; KYC is handled by `mapKycStatus`. Branch in `alfredpay.controller.ts` on `AlfredpayCustomerType.BUSINESS`. **Phase handlers:** -- `alfredpay-onramp-mint-handler.ts` — On-ramp: waits for Alfredpay payment confirmation and credits USDC to the ephemeral on Polygon. -- `alfredpay-offramp-transfer-handler.ts` — Off-ramp: transfers USDC to Alfredpay's settlement address for fiat payout. Recovers from expired upstream quotes by re-quoting at execute time (see [Quote Lifecycle — AlfredPay Provider Quote TTL](../03-ramp-engine/quote-lifecycle.md)). -- `subsidize-pre-swap-handler.ts` — Subsidy: tops up the ephemeral's USDC balance on Polygon to the discount-engine's `targetOutputAmountRaw` before the next stage. Uses `getEvmSubsidyConfig` to pick the Alfredpay-specific funding account and token (`ALFREDPAY_EVM_TOKEN`). -- `squid-router-phase-handler.ts` — Cross-chain bridge for non-Polygon EVM destinations. Same-chain same-token routes short-circuit via `isSameChainSameTokenPassthrough` (no SquidRouter call when source and destination are both Polygon USDC). +- `alfredpay-onramp-mint-handler.ts` — On-ramp: waits for Alfredpay payment confirmation and credits the Alfredpay on-chain token (`ALFREDPAY_EVM_TOKEN`) to the ephemeral on Polygon. +- `alfredpay-offramp-transfer-handler.ts` — Off-ramp: transfers the Alfredpay on-chain token to Alfredpay's settlement address for fiat payout. Recovers from expired upstream quotes by re-quoting at execute time (see [Quote Lifecycle — AlfredPay Provider Quote TTL](../03-ramp-engine/quote-lifecycle.md)). +- `subsidize-pre-swap-handler.ts` — Subsidy: tops up the ephemeral's Alfredpay on-chain token balance on Polygon to the discount-engine's `targetOutputAmountRaw` before the next stage. Uses `getEvmSubsidyConfig` to pick the Alfredpay-specific funding account and token (`ALFREDPAY_EVM_TOKEN`). +- `squid-router-phase-handler.ts` — Cross-chain bridge for non-Polygon EVM destinations. Same-chain same-token routes short-circuit via `isSameChainSameTokenPassthrough` (no SquidRouter call when source and destination are both Polygon `ALFREDPAY_EVM_TOKEN`). **On-ramp flow:** 1. Quote stage emits `ctx.alfredpayOnramp` with provider `quoteId` (30s upstream TTL) and `ctx.subsidy` with the discount-engine target. 2. User initiates on-ramp → receives Alfredpay payment instructions. 3. User makes fiat payment. -4. `alfredpayOnrampMint` phase: confirms Alfredpay payment, credits USDC to the ephemeral on Polygon. If the provider quote is degraded or expired and the discount engine's `expectedOutput` exceeds the provider's, the phase emits `alfredOnrampMintFallback` to record the substitution. -5. `subsidizePreSwap` phase: tops up ephemeral USDC balance to the subsidy target (Polygon, `ALFREDPAY_EVM_TOKEN`). -6. `squidRouterSwap` phase: bridges USDC to the destination EVM chain. For same-chain same-token (Polygon USDC → Polygon USDC), the passthrough shortcut sends the funds directly without invoking SquidRouter. +4. `alfredpayOnrampMint` phase: confirms Alfredpay payment, credits the Alfredpay on-chain token to the ephemeral on Polygon. If the provider quote is degraded or expired and the discount engine's `expectedOutput` exceeds the provider's, the phase emits `alfredOnrampMintFallback` to record the substitution. +5. `subsidizePreSwap` phase: tops up the ephemeral's Alfredpay on-chain token balance to the subsidy target (Polygon, `ALFREDPAY_EVM_TOKEN`). +6. `squidRouterSwap` phase: routes the Polygon Alfredpay token to the destination EVM chain/token. For same-chain same-token (Polygon `ALFREDPAY_EVM_TOKEN` → Polygon `ALFREDPAY_EVM_TOKEN`), the passthrough shortcut sends the funds directly without invoking SquidRouter. 7. `destinationTransfer` → `polygonCleanup` → `complete`. +For routed Alfredpay onramps (any non-passthrough output), the final quote output is the Squid destination-token amount. `quote.outputAmount` MUST be stored with the destination token's decimals, and `evmToEvm.outputAmountRaw` MUST preserve Squid's destination-token raw output. The Polygon-minted Alfredpay token remains the Squid source amount; the spec must not treat Polygon source-token decimals as final settlement precision. + **Off-ramp flow:** -1. Quote stage emits `ctx.alfredpayOfframp` with provider `quoteId` and the AlfredPay fiat order is created during `prepareOfframpEvmToAlfredpay...` (see `transactions/offramp/routes/evm-to-alfredpay.ts:229`). The order is authoritative from prep time; `processAlfredpayOfframpStart` only re-validates state before phase execution. -2. `squidRouterPermitExecute` or `squidRouterNoPermitTransfer/Approve/Swap` phase: executes the user-signed permit (or the no-permit equivalent) and lands USDC on Polygon. -3. `alfredpayOfframpTransfer` phase: transfers USDC to Alfredpay's settlement address for fiat payout. If Alfredpay rejects the stored `quoteId` as expired, the handler requests a fresh provider quote at execute time and re-attempts (`alfredpayOfframpTransferFallback` phase records the re-attempt). -4. `polygonCleanupAxlUsdc` → `complete`. +1. Quote stage emits `ctx.alfredpayOfframp` with provider `quoteId` and the AlfredPay fiat order is created during `prepareOfframpEvmToAlfredpay...` (see `transactions/offramp/routes/evm-to-alfredpay.ts:229`). At prep time, if the quote carries `metadata.alfredpayOfframp`, the service calls `refreshAlfredpayOfframpQuoteIfMatching` to swap in a fresh provider `quoteId` (strict: `toAmount` and `fee` must be identical; drift throws an `INTERNAL_SERVER_ERROR`). The order is authoritative from prep time; `processAlfredpayOfframpStart` only re-validates state before phase execution. +2. `squidRouterPermitExecute` or `squidRouterNoPermitTransfer/Approve/Swap` phase: executes the user-signed permit (or the no-permit equivalent) and lands the Alfredpay on-chain token on Polygon. +3. `finalSettlementSubsidy` phase: always runs for Alfredpay offramps — the direct-transfer skip in `FinalSettlementSubsidyHandler` explicitly excludes `SELL && isAlfredpayToken(outputCurrency)` so the subsidy top-up is never bypassed. +4. `alfredpayOfframpTransfer` phase: transfers the Alfredpay on-chain token to Alfredpay's settlement address for fiat payout. If Alfredpay rejects the stored `quoteId` as expired, the handler requests a fresh provider quote at execute time and re-attempts (`alfredpayOfframpTransferFallback` phase records the re-attempt). +5. `polygonCleanupAxlUsdc` → `complete`. **Request validation:** Alfredpay middleware (`alfredpay.middleware.ts`) validates the `country` parameter against the `AlfredPayCountry` enum for all Alfredpay-related requests. @@ -45,6 +48,10 @@ Alfredpay is a fiat payment provider supporting on-ramp and off-ramp operations 9. **Off-ramp expired-quote recovery MUST re-create the AlfredPay order, not the Vortex quote** — `alfredpay-offramp-transfer-handler.ts` re-quotes against the provider and re-issues `createOfframp` against the same Vortex quote; it MUST NOT mutate the Vortex `QuoteTicket`. 10. **KYB and KYC status mapping MUST be branched by `AlfredpayCustomerType`** — Business customers use `mapKybStatus`; individuals use `mapKycStatus`. Treating one as the other would allow incomplete due-diligence states to pass as `Success`. 11. **Polygon passthrough MUST preserve amount integrity** — The same-chain same-token shortcut in `squid-router-phase-handler.ts` MUST round down (`toFixed(0, 0)`) and MUST use `evmToEvm.inputAmountRaw` as the source-of-truth amount (matching the subsidy target). +12. **The Polygon swap short-circuit MUST be gated on the output token, not on the destination network alone** — Alfredpay mints `ALFREDPAY_EVM_TOKEN` (USDT) directly on Polygon, so the `squidRouterSwap` handler short-circuits straight to `finalSettlementSubsidy` (no swap) only when `quote.metadata.request.to === Networks.Polygon` **and** `quote.outputCurrency === ALFREDPAY_EVM_TOKEN`. `quote.metadata.request.to` is the destination *network*, not the output token; gating on the network alone would mis-deliver — a user requesting any other Polygon output (e.g. USDC) would silently receive the minted USDT instead of their swapped asset. The quote engine (`onramp-polygon-to-evm-alfredpay.ts`) mirrors this: it emits `skipRouteCalculation: true` only for the same-token (`outputCurrency === ALFREDPAY_EVM_TOKEN`) case and otherwise produces a real USDT→output swap. +13. **Offramp quote refresh at prep time MUST be strict and transactional** — `refreshAlfredpayOfframpQuoteIfMatching` (called during `prepareOfframpNonBrlTransactions`) re-fetches a provider quote and compares `toAmount` and `fee`. Any drift throws `INTERNAL_SERVER_ERROR`, aborting ramp registration. The quote metadata update (new `quoteId` + `expirationDate`) runs within the registration transaction, so a partial update cannot persist. +14. **`finalSettlementSubsidy` MUST NOT be skipped for Alfredpay offramps** — The `FinalSettlementSubsidyHandler` direct-transfer skip explicitly excludes `SELL && isAlfredpayToken(outputCurrency)`. This ensures the ephemeral on Polygon is always topped up to the expected amount before `alfredpayOfframpTransfer`, preventing under-funded settlements. +15. **Routed Alfredpay onramp quote output precision MUST match the destination token** — For Alfredpay USD/MXN/COP onramps that route through Squid, `quote.outputAmount` MUST preserve the final destination token's decimal precision, and `evmToEvm.outputAmountRaw` MUST represent the destination token's raw units. The Polygon-minted Alfredpay token is only the Squid source-side input. Direct Polygon same-token passthrough remains at the minted token's 6-decimal precision. ## Threat Vectors & Mitigations @@ -58,7 +65,11 @@ Alfredpay is a fiat payment provider supporting on-ramp and off-ramp operations | **Multi-country regulatory complexity** | Different countries have different KYC/AML requirements | Country-specific validation at Alfredpay level; KYB vs KYC mapping branched by `AlfredpayCustomerType` | | **Provider quote-quote-fall fallback abuse** | Attacker times provider quote drift between Vortex quote and ramp start to maximise the discount-engine fallback subsidy | Provider quote TTL is ~30s; `refreshAlfredpayOnrampQuoteIfMatching` only re-binds on byte-identical `toAmount`/`fee`; otherwise the fallback path is bounded by `maxSubsidy × expectedOutput` and only fires when `targetDiscount > 0` | | **Expired provider quote on offramp transfer** | Provider rejects the stored `quoteId` at transfer time, blocking settlement | `alfredpay-offramp-transfer-handler.ts` re-quotes at execute time and emits `alfredpayOfframpTransferFallback`; the Vortex `QuoteTicket` is untouched | +| **Offramp quote drift at prep time** | Market moves between quote creation and ramp registration; the refreshed Alfredpay offramp quote has different `toAmount`/`fee` | `refreshAlfredpayOfframpQuoteIfMatching` compares `toAmount` and `fee` exactly; any drift throws `INTERNAL_SERVER_ERROR`, aborting registration. The user must re-quote. | +| **Alfredpay offramp skipping subsidy via direct-transfer flag** | An Alfredpay offramp ramp with `isDirectTransfer === true` skips `finalSettlementSubsidy`, under-funding the settlement | `FinalSettlementSubsidyHandler` explicitly excludes `SELL && isAlfredpayToken(outputCurrency)` from the direct-transfer skip; subsidy always runs for Alfredpay offramps | | **Polygon passthrough rounding** | Same-chain same-token shortcut rounds the bridge output incorrectly, leaking dust or under-funding the destination | `toFixed(0, 0)` round-down in the squid-router finalize; downstream subsidy ensures the destination receives the quoted amount | +| **Polygon wrong-token delivery** | A user on-ramps via Alfredpay and requests a non-USDT Polygon output (e.g. USDC); the handler skips the swap on destination-network alone and transfers the minted USDT, delivering the wrong asset | The `squidRouterSwap` short-circuit is gated on `quote.outputCurrency === ALFREDPAY_EVM_TOKEN` (not just `quote.metadata.request.to === Networks.Polygon`); non-USDT Polygon outputs run the real USDT→output swap. Matched in the quote engine's `skipRouteCalculation` branch. | +| **Routed destination precision loss** | A USD/MXN/COP Alfredpay onramp mints a 6-decimal Polygon source token, routes to an 18-decimal destination token, and stores the final quote output with source precision. The final amount is truncated before destination-transfer expectations are calculated. | Finalize routed Alfredpay EVM quotes with the destination token's decimals when `evmToEvm` metadata exists; keep direct Polygon same-token passthrough at minted-token precision. | ## Audit Checklist @@ -77,5 +88,9 @@ Alfredpay is a fiat payment provider supporting on-ramp and off-ramp operations - [x] Offramp fallback emits `alfredpayOfframpTransferFallback` for expired-quote recovery; phase is registered as an EVM phase in `transactions/validation.ts:250`. **PASS**. - [x] KYB vs KYC status mapping is branched by `AlfredpayCustomerType.BUSINESS` in `alfredpay.controller.ts`. **PASS** — `mapKybStatus` for business, `mapKycStatus` for individual. - [x] Polygon same-chain same-token passthrough uses `isSameChainSameTokenPassthrough` shortcut, rounds down (`toFixed(0, 0)`), and uses `evmToEvm.inputAmountRaw` as the source amount. **PASS** — `squid-router-phase-handler.ts` + `squidrouter/index.ts` finalize. +- [x] Alfredpay Polygon onramp swap short-circuit is gated on `quote.outputCurrency === ALFREDPAY_EVM_TOKEN`, not on `quote.metadata.request.to === Networks.Polygon` alone. **PASS** — `squid-router-phase-handler.ts` checks both; `onramp-polygon-to-evm-alfredpay.ts` only sets `skipRouteCalculation` for the same-token case. Prevents a non-USDT Polygon output (e.g. USDC) from being delivered as the minted USDT. - [x] `refreshAlfredpayOnrampQuoteIfMatching` only re-binds the provider `quoteId` when `toAmount` and `fee` match byte-identically. **PASS** — `ramp.service.ts:1480-1491`. +- [x] `refreshAlfredpayOfframpQuoteIfMatching` re-fetches a fresh provider quote at prep time, compares `toAmount` and `fee` exactly, and throws on drift. Quote metadata update (new `quoteId` + `expirationDate`) runs within the registration transaction. **PASS** — `ramp.service.ts`. +- [x] `FinalSettlementSubsidyHandler` does NOT skip subsidy for Alfredpay offramps (`SELL && isAlfredpayToken`). **PASS** — explicit exclusion in the direct-transfer skip condition. - [x] AlfredPay offramp order is created at prep time (`evm-to-alfredpay.ts:229`); `processAlfredpayOfframpStart` is a defensive validation-only no-op. **PASS** — verified. +- [x] Routed Alfredpay onramp quote output precision follows destination token decimals when `evmToEvm` metadata exists; direct Polygon same-token passthrough remains at minted-token precision. **PASS** — verified in `finalize/onramp.ts`. diff --git a/docs/security-spec/05-integrations/brla.md b/docs/security-spec/05-integrations/brla.md index c2dbabd76..991c2de9d 100644 --- a/docs/security-spec/05-integrations/brla.md +++ b/docs/security-spec/05-integrations/brla.md @@ -22,6 +22,12 @@ BRLA is the Brazilian Real stablecoin used for BRL on/off-ramp operations, acces 5. `subsidizePostSwap` (if needed) → `distributeFees` (Multicall3 batch on Base, see `fee-integrity.md`). 6. If destination is Base + USDC → direct `destinationTransfer` (Squid skipped — see `squid-router.md`). Otherwise → `squidRouterApprove` / `squidRouterSwap` → bridge to user's supported destination EVM chain → optional fallback `backupSquidRouter*` swap on the destination chain → `destinationTransfer`. BRL→AssetHub is temporarily disabled at quote eligibility and should not reach registration. +For non-Base EVM destinations, the final quote output is the Squid destination-token amount. `quote.outputAmount` MUST be stored with the destination token's decimals (for example, 18 decimals for BSC USDT) because `avenia-to-evm-base.ts` derives the final `destinationTransfer` raw amount by multiplying the stored quote output by the destination token decimals. Truncating all BRL on-ramp outputs to 6 decimals would create tiny but real under-delivery for 18-decimal destination tokens and would make `evmToEvm.outputAmountRaw` disagree with the destination-token raw amount returned by Squid. + +#### Degenerate BRL→BRLA-on-Base route (direct bypass) + +When the user on-ramps BRL and asks for **BRLA delivered on Base** (input BRL, output BRLA, network Base), the generic pipeline would pointlessly swap BRLA→USDC on Nabla and then bridge/swap USDC→BRLA back to itself — burning two swaps of slippage and fees, and inviting the over-subsidy race documented in `06-cross-chain/fund-routing.md`. Avenia already mints BRLA directly on the Base ephemeral, so the route builder detects this case via `isBrlToBrlaBaseDirect(quote.inputCurrency, quote.outputCurrency, quote.network)` (`api/services/quote/utils.ts`) and emits a **single** `destinationTransfer` of the quoted output amount straight from the ephemeral to the user — no `nablaApprove`/`nablaSwap`, no `distributeFees`, no `squidRouter*`, no `finalSettlementSubsidy`, no Base cleanup. `stateMeta.isDirectTransfer = true` is set so the downstream `squidRouterSwap` and `finalSettlementSubsidy` handlers also short-circuit defensively if ever reached (`avenia-to-evm-base.ts`). The destination-transfer nonce is `0` (the ephemeral has signed nothing else on this corridor). This mirrors the EUR→EURC-on-Base bypass (`mykobo.md`). + ### Off-ramp flow (User EVM → Base USDC → BRLA → PIX) 1. User signs Squid permit / no-permit fallback / direct transfer (depending on source chain) → tokens arrive on Base ephemeral as USDC. @@ -36,7 +42,9 @@ BRLA is the Brazilian Real stablecoin used for BRL on/off-ramp operations, acces ### Subaccount model -Avenia requires a subaccount per user, identified by tax ID (CPF). The system creates/manages subaccounts during ramp registration and maps them via the `TaxId` model (`taxIdRecord.subAccountId`). +Avenia requires a subaccount per user, identified by tax ID (CPF for individuals, CNPJ for businesses). The system creates/manages subaccounts during ramp registration and maps them via the `TaxId` model (`taxIdRecord.subAccountId`). + +`POST /v1/brla/createSubaccount` accepts an **optional** `quoteId`. In the normal ramp flow it is the quote that triggered onboarding; in the **quote-less KYB deep link** (`?kyb` / `?kybLocked` widget entry, where business verification starts before any quote exists) it is omitted. The controller stores it as the nullable `TaxId.initialQuoteId` — a provenance field only. It is never used as an authorization input, so its absence does not weaken any access check: the ownership guard (below) and `optionalAuth` user context gate subaccount creation independently of whether a quote is present. ### The three-amount model (off-ramp) @@ -65,6 +73,8 @@ The invariant `transferAmount ≥ payoutAmount` must hold (transfer covers payou 11. **Recovery on resumed on-chain transfer MUST detect existing tx hashes** — If `brlaPayoutTxHash` is in state, the handler waits for that receipt rather than re-broadcasting (prevents double on-chain BRLA transfer). 12. **PIX deposit details (QR code) MUST be generated server-side** — Returned via API response only after presigned transactions are validated, never client-modifiable. 13. **BRL↔AssetHub MUST stay disabled while the Base BRL rail is active-only** — The quote engine should return no quote for BRL→AssetHub or AssetHub→BRL, preventing users from registering legacy Moonbeam/Pendulum BRL routes. +14. **The BRL→BRLA-on-Base on-ramp MUST take the direct-transfer bypass** — When `inputCurrency === BRL`, `outputCurrency === BRLA`, and `network === Base`, `isBrlToBrlaBaseDirect` MUST short-circuit the route to a single `destinationTransfer` from the ephemeral to the user, with `stateMeta.isDirectTransfer = true`. The Nabla swap, `distributeFees`, SquidRouter, `finalSettlementSubsidy`, and Base cleanup phases MUST NOT run — routing BRLA through USDC and back would burn double-swap slippage/fees against the user and expose the over-subsidy race (`06-cross-chain/fund-routing.md`). The `squidRouterSwap` and `finalSettlementSubsidy` handlers MUST also honor `isDirectTransfer`/`isBrlToBrlaBaseDirect` defensively and skip to `destinationTransfer` if reached. +15. **BRL→EVM quote output precision MUST match the destination token** — For supported EVM destinations, `quote.outputAmount` MUST preserve the destination token's decimal precision, and `evmToEvm.outputAmountRaw` MUST represent the destination token's raw units. The Squid bridge input remains Base USDC raw (`evmToEvm.inputAmountRaw`), but final delivery uses destination-token decimals. ## Threat Vectors & Mitigations @@ -78,8 +88,10 @@ The invariant `transferAmount ≥ payoutAmount` must hold (transfer covers payou | **Amount manipulation between quote and payout** | Attacker modifies the payout amount between quote and execution | `quote.outputAmount` read from DB at execution time; quote is immutable post-creation. | | **Avenia service outage** | Avenia API is unreachable mid-ramp | `RecoverablePhaseError` → phase processor retries; off-ramp fails to payout but BRLA is held on the Avenia subaccount, not lost. | | **Subaccount data leak** | Avenia subaccount details exposed via API | Only `subAccountId`, EVM wallet address, and balances are stored locally; no PII beyond CPF (which is itself a regulatory requirement). | -| **Underdelivery from Nabla** | Nabla swap returns less BRLA than quoted, balance poll times out, ramp stuck | Balance-poll timeout (5min) fails the phase as recoverable; `subsidizePostSwap` (EVM branch) tops up shortfalls subject to the quote-relative EVM subsidy cap documented in `fund-routing.md`. | +| **Underdelivery from Nabla** | Nabla swap returns less BRLA than quoted, balance poll times out, ramp stuck | Balance-poll timeout (5min) fails the phase as recoverable; `subsidizePostSwap` (EVM branch) tops up eligible shortfalls subject to the env-configured split quote-relative EVM subsidy caps documented in `fund-routing.md`. The actual-vs-quoted swap discrepancy uses `MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION`; the discount component uses `MAX_EVM_POST_SWAP_DISCOUNT_SUBSIDY_QUOTE_FRACTION`. Both default to `0.05`. | | **Disabled AssetHub corridor accidentally re-enabled** | Legacy BRL↔AssetHub route files are selected and a user registers a route that the Base BRL rail no longer supports | Quote eligibility must return no quote for BRL→AssetHub and AssetHub→BRL. Treat any successful quote for those corridors as a regression until the corridor is intentionally re-enabled. | +| **BRL→BRLA-Base self-swap drain** | The generic pipeline swaps the user's already-minted BRLA to USDC and back, charging two swaps of slippage/fees and triggering `finalSettlementSubsidy` against bridge-less dust (over-subsidy + strand) | `isBrlToBrlaBaseDirect` collapses the corridor to a single `destinationTransfer` with `isDirectTransfer = true`; Nabla/distributeFees/Squid/finalSettlementSubsidy/cleanup are skipped at both route-build and handler level. | +| **Destination-token decimal under-delivery** | A BRL on-ramp targets an 18-decimal token such as BSC USDT, but the quote output is truncated to 6 decimals before `destinationTransfer` raw amount construction. | On-ramp finalization uses destination-token decimals for BRL EVM outputs; Squid metadata preserves destination raw output from `route.estimate.toAmount`. | ## Audit Checklist @@ -101,8 +113,11 @@ The invariant `transferAmount ≥ payoutAmount` must hold (transfer covers payou - [x] PIX deposit details released to user only after presign validation. **PASS** — gated by `ephemeralPresignChecksPass` (see `transaction-validation.md`). - [PARTIAL] Avenia interactions logged for reconciliation (amounts, not credentials). **PARTIAL** — info logs include amounts; no formal reconciliation log with structured fields. - [x] **FINDING F-064 (MEDIUM)**: BRLA KYC callback endpoint requires authentication. **PASS (FIXED)** — `/kyc/record-attempt` uses `requireAuth`. +- [x] BRL→BRLA-on-Base on-ramps (`isBrlToBrlaBaseDirect`) emit a single `destinationTransfer` with `isDirectTransfer = true` — no Nabla swap, `distributeFees`, SquidRouter, `finalSettlementSubsidy`, or Base cleanup phases. **PASS** — `avenia-to-evm-base.ts` early direct branch (single tx at nonce 0). +- [x] `squidRouterSwap` and `finalSettlementSubsidy` honor `isDirectTransfer` / `isBrlToBrlaBaseDirect` and short-circuit to `destinationTransfer` if ever reached on a direct route. **PASS** — `squid-router-phase-handler.ts`, `final-settlement-subsidy.ts`. +- [x] BRL→EVM destination-token precision preserved. **PASS** — `OnRampFinalizeEngine` stores BRL/EVM `quote.outputAmount` using destination token decimals, and `BaseSquidRouterEngine` preserves Squid's destination raw output in `evmToEvm.outputAmountRaw`. ## Remediation Notes - **Hardcoded BRL offramp validation amount:** Resolved in the remediation pass; BRL offramp validation now derives the pre-anchor amount from quote metadata instead of a literal placeholder. -- **EVM subsidy USD cap:** Resolved for the Base EVM subsidy handlers via `MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION`. Over-cap cases are intentionally recoverable retries: no subsidy transfer is submitted, and the ramp remains waiting for operator action rather than becoming unrecoverably failed. +- **EVM subsidy USD caps:** Resolved for the Base EVM subsidy handlers via env-configured quote-relative cap fractions. `MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION` and `MAX_EVM_POST_SWAP_DISCOUNT_SUBSIDY_QUOTE_FRACTION` both default to `0.05` and can be overridden through environment variables. Over-cap cases are intentionally recoverable retries: no subsidy transfer is submitted, and the ramp remains waiting for operator action rather than becoming unrecoverably failed. diff --git a/docs/security-spec/05-integrations/monerium.md b/docs/security-spec/05-integrations/monerium.md index 5b298866f..c07ecc34d 100644 --- a/docs/security-spec/05-integrations/monerium.md +++ b/docs/security-spec/05-integrations/monerium.md @@ -1,7 +1,11 @@ # Monerium Integration +> **⚠️ DEPRECATED / REMOVED.** Monerium is no longer used for EUR on-ramps. EUR on-ramp has been migrated to **Mykobo on Base** (see `mykobo.md`). The `moneriumOnrampMint` and `moneriumOnrampSelfTransfer` phase handlers, the Polygon Monerium EURe path, and the Polygon ephemeral cleanup for SEPA ramps are **no longer reached by any active corridor**. This file is retained for historical context and audit traceability of past Monerium-related findings; new ramps do not flow through Monerium. Active EUR architecture: `05-integrations/mykobo.md`. + ## What This Does +(Historical — Monerium is removed. See top-of-file deprecation banner and `mykobo.md`.) + Monerium is a European e-money institution that issues EURe (Monerium EUR) tokens. Vortex uses Monerium for EUR on-ramp operations via SEPA bank transfers. **Provider type:** On-ramp only diff --git a/docs/security-spec/05-integrations/mykobo.md b/docs/security-spec/05-integrations/mykobo.md new file mode 100644 index 000000000..886540cc0 --- /dev/null +++ b/docs/security-spec/05-integrations/mykobo.md @@ -0,0 +1,143 @@ +# Mykobo Integration + +## What This Does + +Mykobo is the EUR fiat anchor used by Vortex for EUR on/off-ramp operations on **Base (Ethereum L2)**. Mykobo settles SEPA bank transfers into / out of EURC (Circle's EUR stablecoin, ERC-20) on Base. There is no Stellar, Pendulum, or Moonbeam involvement for EUR liquidity: all EUR flow now happens on Base, mirroring the BRLA-on-Base architecture. + +Mykobo replaces two earlier EUR rails: + +- The **Stellar SEP-24 EUR off-ramp** (Mykobo anchor reached via Spacewalk) — removed for EUR. See `stellar-anchors.md` for the deprecation note. +- The **Monerium EUR on-ramp** (Monerium EURe minted on Moonbeam) — removed. See `monerium.md` for the deprecation note. + +**Provider type:** Both (on-ramp and off-ramp) +**Fiat currency:** EUR (Euro, SEPA) +**Chain involved:** Base (EURC is an ERC-20 on Base; USDC on Base is the Nabla swap counter-asset) +**Phase handlers:** +- `mykobo-onramp-deposit-handler.ts` — On-ramp: After the user's SEPA transfer is received, Mykobo settles EURC on Base to the user's Base ephemeral; the handler polls the Base RPC until the expected balance arrives. +- `mykobo-payout-handler.ts` — Off-ramp: Sends a presigned ERC-20 EURC transfer from the Base ephemeral to the Mykobo-controlled `receivables` address, then polls Mykobo's transaction status until `COMPLETED`. + +**API surface:** Mykobo HTTP API client `MykoboApiService` (`packages/shared/src/services/mykobo/mykoboApiService.ts`). Singleton. +**API auth method:** Access key + secret key exchanged for a short-lived bearer token via `POST /auth/token`; refresh token via `POST /auth/refresh`. Cached in-process; re-acquired on `401`. Credentials sourced from `MYKOBO_ACCESS_KEY`, `MYKOBO_SECRET_KEY`, `MYKOBO_BASE_URL`, `MYKOBO_CLIENT_DOMAIN` env vars. + +**`MYKOBO_CLIENT_DOMAIN` operational note:** The client domain is sent as `client_domain` on every Mykobo API call (`MykoboApiService`). It identifies the Vortex deployment to Mykobo and determines the **fee tier** applied to that deployment's intents. When unset, Mykobo falls back to its default tier (observed: ~0.31 EUR fixed deposit fee vs. ~0.06 EUR for the negotiated Vortex tier on `satoshipay.io`). Because the constant is loaded via `getEnvVar` with no default, a missing value silently degrades fees rather than failing fast — operators MUST verify it is set at deploy time. + +### On-ramp flow (EUR SEPA → Base EURC → Nabla swap → user EVM destination) + +1. At ramp registration (`prepareMykoboOnrampTransactions` in `ramp.service.ts`), Vortex calls Mykobo `POST /transactions/intent` with `transaction_type=DEPOSIT`, `currency=EURC`, the user's email + IP, the **Base ephemeral address** as `wallet_address`, and `value` as the EUR amount floored to **2 decimal places** (Mykobo silently truncates any extra precision; see invariant below). Mykobo returns IBAN payment instructions (IBAN, bank account name, transaction reference). +2. IBAN instructions are returned to the user **only after** presigned-transaction validation passes (see `transaction-validation.md`). +3. User makes the SEPA bank transfer to Mykobo's IBAN with the returned reference. +4. `mykoboOnrampDeposit`: handler polls the Base RPC for EURC arrival at `evmEphemeralAddress`. + - **Outer timeout** (`PAYMENT_TIMEOUT_MS`): **24 hours**, matching SEPA business-day cutoffs. + - **Inner balance-arrival timeout** (`EVM_BALANCE_CHECK_TIMEOUT_MS`): 5 minutes per `checkEvmBalancePeriodically` invocation. Inner timeouts throw `RecoverablePhaseError` and the phase processor re-enters the handler until the outer 24h cap is reached. + - **Recovery shortcut**: if the ephemeral already holds ≥ 95% of `quote.metadata.mykoboMint.outputAmountRaw` EURC (`EPHEMERAL_FUNDED_TOLERANCE_FACTOR = 0.95`), the handler skips the wait. The 5% tolerance absorbs fee variance between quote-creation time and SEPA settlement time. + - On outer-timeout expiry, the ramp transitions to `failed` (the user did not pay). +5. `fundEphemeral` (Base ETH gas top-up; same as BRL onramp) → `subsidizePreSwap` (if needed) → `nablaApprove` → `nablaSwap`: Nabla DEX **on Base** swaps EURC → USDC. +6. `subsidizePostSwap` (if needed) → `distributeFees` (Multicall3 batch on Base, see `fee-integrity.md`). The EVM post-swap branch uses the split subsidy caps documented in `fund-routing.md`: swap-output discrepancy and discount subsidy are bounded separately before any transfer is submitted. +7. If destination is Base + USDC → direct `destinationTransfer` (Squid skipped — see `squid-router.md`). Otherwise → `squidRouterApprove` / `squidRouterSwap` → bridge to user's destination EVM chain → optional `backupSquidRouter*` fallback → `destinationTransfer`. + +#### Degenerate EUR→EURC-on-Base route (direct bypass) + +When the user on-ramps EUR and asks for **EURC delivered on Base** (input EURC, output EURC, network Base), the generic pipeline would pointlessly swap EURC→USDC on Nabla and then bridge/swap USDC→EURC back to itself — burning two swaps of slippage and fees, and inviting the over-subsidy race documented in `06-cross-chain/fund-routing.md`. Mykobo already settles EURC directly on the Base ephemeral, so the route builder detects this case via `isEurToEurcBaseDirect(quote.inputCurrency, quote.outputCurrency, quote.network)` (`api/services/quote/utils.ts`) and emits a **single** `destinationTransfer` of the quoted output amount straight from the ephemeral to the user — no `nablaApprove`/`nablaSwap`, no `squidRouter*`, no `finalSettlementSubsidy`, no Base cleanup. `stateMeta.isDirectTransfer = true` is set so the downstream `finalSettlementSubsidy` handler also short-circuits defensively if ever reached (`mykobo-to-evm.ts`). The quote engine produces the matching single-phase plan, and the destination-transfer nonce is `0` (the ephemeral has signed nothing else on this corridor). + +### Off-ramp flow (User EVM → Base USDC → Base EURC → SEPA payout) + +1. User signs Squid permit / no-permit fallback / direct transfer → tokens arrive on Base ephemeral as USDC. If the source is already Base USDC, Squid is skipped. +2. At registration (`prepareEvmToMykoboOfframpTransactions`), Vortex calls Mykobo `POST /transactions/intent` with `transaction_type=WITHDRAW`, `currency=EURC`, the Base ephemeral as `wallet_address`, and `value` set to `quote.metadata.nablaSwapEvm.outputAmount` floored to **2 decimal places** via `Big.toFixed(2, 0)` (Mykobo silently truncates anything beyond 2 dp; intent value, on-chain transfer amount, and Mykobo's accounting MUST agree on the same floored figure). Mykobo returns withdraw instructions including the **`receivables` Base address** (the EVM address that Mykobo monitors for incoming EURC). The Mykobo transaction id and reference are stored in `state.state.mykoboTransactionId` / `mykoboTransactionReference`. +3. `distributeFees` runs **before** Nabla swap so partner/vortex fees are taken in USDC (consistent with the BRLA-on-Base flow; see `fee-integrity.md`). +4. `subsidizePreSwap` → `nablaApprove` → `nablaSwap`: Nabla DEX on Base swaps USDC → EURC. +5. `mykoboPayoutOnBase`: + 1. Sends the presigned ERC-20 EURC transfer of the **2dp-floored** Mykobo intent value (`mykoboFlooredValue × 10^ERC20_EURC_BASE_DECIMALS`) from the ephemeral to the Mykobo `receivables` address. The transfer amount is fixed at registration time and **MUST equal the Mykobo intent `value`** so on-chain credit and Mykobo accounting agree. The sub-cent EURC remainder between `nablaSwapEvm.outputAmountRaw` and the floored transfer amount stays on the ephemeral and is swept by `baseCleanupEurc` in step 6. + 2. On retry, if `mykoboPayoutTxHash` is already in state, the handler waits for that receipt instead of re-broadcasting. If the prior tx reverted, it re-sends the same presigned tx (EVM nonce uniqueness still prevents double-spend). + 3. After the on-chain transfer is confirmed, the handler polls Mykobo `GET /transactions/{id}` every **5s for up to 10 minutes**, looking for `MykoboTransactionStatus.COMPLETED`. `FAILED`, `CANCELLED`, or `EXPIRED` raise an **unrecoverable** error. Polling-error timeouts raise an unrecoverable error if the last polling attempt errored, otherwise a recoverable error. +6. `baseCleanupUsdc` / `baseCleanupEurc` / `baseCleanupAxlUsdc`: sweep dust from the Base ephemeral back to the Base funding account. `baseCleanupEurc` is load-bearing here — it claims the sub-cent EURC remainder left behind by the 2dp floor in step 5.1. + +### Profile / KYC flow + +Mykobo profiles are user records keyed by the user's email address. They carry KYC fields and are required before Mykobo will accept SEPA deposits / WITHDRAW intents for that user. + +- `GET /v1/mykobo/profiles?email=...&memo=...` — Vortex backend proxies `MykoboApiService.getProfileByEmail`. Used by the frontend to detect whether the authenticated user already has a profile. The `email` query parameter MUST match the Supabase-authenticated user's email (`req.userEmail`); mismatched values are rejected at the controller boundary. +- `POST /v1/mykobo/profiles` — Vortex backend proxies `MykoboApiService.createProfile` with multipart form-data (ID document, source-of-funds document, demographics). + +The Mykobo KYC widget on the frontend (`MykoboKycFlow`) drives the user through profile creation. The ramp state machine treats Mykobo KYC as a **pre-ramp gate**: the `Deciding` step in the ramp XState machine checks profile presence and routes to the Mykobo KYC flow before allowing ramp registration. + +### Why no `mykoboMint` phase + +Unlike Monerium (`moneriumOnrampMint` + `moneriumOnrampSelfTransfer`), Vortex does **not** call any Mykobo API to trigger minting. Mykobo's SEPA→EURC settlement is initiated by the user's bank transfer and is observed entirely on-chain via the Base EURC balance of the ephemeral. The handler is therefore a pure balance-poller; there is no Vortex-controlled minting step that can fail mid-flight. + +## Security Invariants + +1. **Mykobo API credentials MUST be stored as environment variables** — `MYKOBO_ACCESS_KEY`, `MYKOBO_SECRET_KEY`, `MYKOBO_BASE_URL`, and `MYKOBO_CLIENT_DOMAIN` are loaded via `packages/shared` config. Never hardcoded, never in the database. +2. **The Mykobo bearer token MUST never appear in logs or error messages** — `MykoboApiError` captures status + body but not the request headers; review log redaction for any context that includes `Authorization`. +3. **SEPA payment confirmation MUST come from on-chain EURC arrival, not from user input** — `mykoboOnrampDeposit` polls the Base RPC for the ephemeral's EURC balance; it never accepts a "user claims paid" signal. +4. **The on-chain EURC transfer amount (off-ramp) MUST equal the Mykobo intent `value` floored to 2 decimal places** — Computed in `evm-to-mykobo.ts` as `Big(quote.metadata.nablaSwapEvm.outputAmount).toFixed(2, 0)` and converted to raw via `× 10^ERC20_EURC_BASE_DECIMALS`. The presigned `mykoboPayoutOnBase` tx, the Mykobo intent `value`, and the Mykobo `receivables` credit MUST all reference the same floored figure. The sub-cent EURC remainder is intentionally left on the ephemeral for `baseCleanupEurc`. The Mykobo anchor fee was already factored into `quote.outputAmount` at quote-creation time. +5. **The Mykobo `receivables` address MUST come from the Mykobo intent response, not from any client-supplied field** — `mykoboReceivablesAddress` is read from `intent.instructions.address` server-side and stored in `stateMeta`. The user has no way to redirect the off-ramp transfer. +6. **The Mykobo `transaction_type` MUST match the ramp direction** — `DEPOSIT` for on-ramp intents, `WITHDRAW` for off-ramp intents. A mismatch is rejected by Mykobo, but Vortex must not allow client-controlled selection of the type. +7. **The on-ramp intent's `wallet_address` MUST be the Base ephemeral, not the user's destination address** — EURC is settled to the ephemeral so the Nabla swap pipeline can run. Using the user's destination address would bypass the swap and fee distribution. +8. **The off-ramp intent's `wallet_address` MUST be the Base ephemeral** — Mykobo correlates the incoming EURC transfer by the sender wallet; using any other address breaks the WITHDRAW settlement. +9. **SEPA payment details (IBAN, reference) MUST be generated server-side** — Returned by Mykobo's intent response, surfaced to the user only after presigned-transaction validation succeeds. Never client-modifiable. +10. **`mykoboOnrampDeposit` MUST bound its wait** — The 24h `PAYMENT_TIMEOUT_MS` prevents indefinite ramp parking. After 24h with no EURC arrival, the ramp transitions to `failed`. +11. **The 5% pre-funding tolerance MUST only apply to recovery, not to live settlements** — The recovery shortcut compares against 95% of `mykoboMint.outputAmountRaw` to avoid missing an already-funded ephemeral on a rerun. Live `checkEvmBalancePeriodically` still requires the full `expectedAmountRaw`. +12. **`mykoboPayoutOnBase` MUST not advance until both the on-chain transfer is confirmed and Mykobo reports `COMPLETED`** — Confirming only the on-chain side would mark the ramp complete while Mykobo could still reject the deposit. +13. **`MykoboTransactionStatus` of `FAILED` / `CANCELLED` / `EXPIRED` MUST be treated as unrecoverable** — The handler throws via `createUnrecoverableError` so the ramp transitions to a failed state instead of looping. +14. **Recovery on resumed `mykoboPayoutOnBase` MUST detect existing tx hashes** — If `mykoboPayoutTxHash` is in state, the handler waits for that receipt rather than blindly re-broadcasting. If the prior tx reverted, the same presigned tx is re-broadcast — EVM nonce uniqueness prevents double-spend of the ephemeral's EURC. +15. **Mykobo KYC profile creation MUST be gated by Vortex auth** — The `/v1/mykobo/profiles` endpoints require a Supabase OTP session (see `01-auth/supabase-otp.md`); anonymous profile creation is rejected. +16. **Mykobo KYC documents MUST NOT be stored by Vortex** — The frontend submits ID and source-of-funds files directly to the backend, which forwards them to Mykobo as multipart form-data without persisting. No Mykobo profile fields are stored in Vortex's database beyond the email→profile linkage used to look up profile state. +17. **Mykobo HTTP responses MUST be validated** — `MykoboApiService.request` checks `response.ok`, raises `MykoboApiError` with status + body on failure, and re-acquires the token on `401` exactly once before re-throwing. `MykoboApiError` MUST be caught and translated to `RecoverablePhaseError` (transient) or `UnrecoverablePhaseError` (terminal status) at the handler boundary. +18. **Mykobo bearer-token refresh MUST be safe under concurrent requests** — `MykoboApiService.tokenPromise` debounces concurrent `acquireToken` calls so multiple in-flight requests share a single token acquisition. Token refresh is single-use per cached token; on refresh failure the service falls back to re-acquiring with the access/secret keys. +19. **The Mykobo base URL normalization MUST enforce a `/v1` suffix** — `MykoboApiService` trims trailing slashes and appends `/v1` unless the configured `MYKOBO_BASE_URL` already ends in `/v`. This prevents accidental cross-version calls if an operator sets `MYKOBO_BASE_URL` to a root domain. +20. **`MYKOBO_CLIENT_DOMAIN` MUST be set in every deployment** — The constant is sent as `client_domain` on every Mykobo API call and selects the negotiated fee tier. Because it is loaded via `getEnvVar` with no default, a missing value silently falls back to Mykobo's default tier (worse fees, observed ~5x higher). Deploy-time checks MUST treat an unset `MYKOBO_CLIENT_DOMAIN` as a hard failure. +21. **Mykobo intent `value` MUST be floored to 2 decimal places** — Mykobo silently truncates anything beyond 2 dp, which would otherwise cause the on-chain transfer amount and the Mykobo-credited amount to diverge. Both the on-ramp `DEPOSIT` intent and the off-ramp `WITHDRAW` intent MUST send a 2dp-floored `value`, and the off-ramp on-chain transfer MUST be derived from that same floored value (not from the unrounded Nabla output). The sub-cent EURC remainder on the ephemeral MUST be swept by `baseCleanupEurc`. +22. **The EUR→EURC-on-Base on-ramp MUST take the direct-transfer bypass** — When `inputCurrency === EURC`, `outputCurrency === EURC`, and `network === Base`, `isEurToEurcBaseDirect` MUST short-circuit the route to a single `destinationTransfer` from the ephemeral to the user, with `stateMeta.isDirectTransfer = true`. The Nabla swap, SquidRouter, `finalSettlementSubsidy`, and Base cleanup phases MUST NOT run — routing EURC through USDC and back would burn double-swap slippage/fees against the user and expose the over-subsidy race (`06-cross-chain/fund-routing.md`). The `finalSettlementSubsidy` handler MUST also honor `isDirectTransfer`/`isEurToEurcBaseDirect` defensively and skip to `destinationTransfer` if reached. + +## Threat Vectors & Mitigations + +| Threat | Attack Scenario | Mitigation | +|---|---|---| +| **SEPA payment spoofing (on-ramp)** | User claims to have paid without making the SEPA transfer | `mykoboOnrampDeposit` polls the Base RPC for actual EURC arrival; never trusts user signals. | +| **Wrong reference on SEPA** | User sends SEPA with wrong reference, causing misattribution at Mykobo | Reference is generated by Mykobo per intent and shown to the user verbatim; Mykobo correlates by reference at its end. If misattributed, Mykobo will not settle and the 24h timeout fails the ramp. | +| **Off-ramp receivables redirection** | Attacker tries to redirect the EURC payout to a wallet they control | `mykoboReceivablesAddress` is sourced from Mykobo's intent response and baked into the presigned tx at registration time. No client-supplied field reaches the presigned tx target. | +| **Off-ramp amount manipulation** | Attacker modifies the EURC payout amount between quote and execution | Transfer amount is `quote.metadata.nablaSwapEvm.outputAmountRaw`, fixed in the presigned tx at registration. `quote` is immutable post-creation. | +| **Mykobo bearer token compromise** | Bearer token captured in transit or from logs | HTTPS enforced; token never logged; cached in-process only; rotated on `401`. Rotate access/secret keys via Mykobo dashboard on suspected leak. | +| **Mykobo access/secret-key compromise** | Env-var leak exposes long-lived credentials | Keys live in environment only (see `07-operations/secret-management.md`); rotate via Mykobo dashboard; monitor Mykobo dashboard for unauthorized intents. | +| **Mykobo API unavailability** | Mykobo is down during off-ramp polling or on-ramp settlement | Off-ramp `mykoboPayoutOnBase`: polling errors continue retrying up to the 10-minute window; on poll-timeout the handler throws `RecoverablePhaseError` (or unrecoverable if last attempt errored). On-ramp `mykoboOnrampDeposit`: inner balance-check timeouts are recoverable; only the outer 24h cap fails the ramp. | +| **Double on-chain EURC transfer (off-ramp)** | Crash between sending the EURC transfer and storing the hash | Handler waits for receipt before persisting `mykoboPayoutTxHash`. On retry, if no hash is stored, the same presigned tx is re-broadcast — EVM nonce uniqueness on the ephemeral prevents double-spend. | +| **Double Mykobo payout completion** | Bug causes the handler to advance to `complete` before Mykobo `COMPLETED` | Handler awaits `pollMykoboUntilCompleted` before `transitionToNextPhase("complete")`. Any non-`COMPLETED` terminal status raises unrecoverable. | +| **Mykobo terminal status (FAILED / CANCELLED / EXPIRED) mishandled** | Handler retries indefinitely on a permanently failed Mykobo transaction | `createUnrecoverableError` is thrown for those three statuses; ramp transitions to failed instead of looping. | +| **Long-lived on-ramp DOS** | Attacker creates many on-ramps to occupy ephemeral accounts for 24h | Per-user concurrent ramp limit (cross-cutting; see `07-operations/api-surface.md` rate limiting). Ephemerals are user-funded so blast radius is bounded. | +| **TLS downgrade / MITM** | Attacker intercepts Mykobo API calls | HTTPS-only base URL; bearer-token auth depends on TLS; refuse any non-HTTPS `MYKOBO_BASE_URL` configuration at deploy time. | +| **Profile-doc PII leak** | KYC document or PII surfaces in Vortex storage or logs | Documents are streamed through to Mykobo as multipart form-data without persistence; no PII fields stored locally beyond the email→profile-existence linkage. | +| **Cross-version Mykobo API drift** | Operator misconfigures `MYKOBO_BASE_URL` to a root domain, hitting an unintended version | `MykoboApiService` enforces a `/v` suffix; misconfiguration fails fast on the first auth call. | +| **`MYKOBO_CLIENT_DOMAIN` unset → wrong fee tier** | Operator forgets to set `MYKOBO_CLIENT_DOMAIN`; Mykobo silently applies its default tier (~5x worse fees) and quotes/distributions drift from reality | Deploy-time check fails fast if the env var is missing; alarms on observed Mykobo fees exceeding `defaultDepositFee` / `defaultWithdrawFee` (see `07-operations/secret-management.md`). | +| **Intent-value precision drift** | EURC payout amount carries >2 dp; Mykobo silently truncates and credits less than the on-chain transfer, leaving the user short | Both `DEPOSIT` and `WITHDRAW` intents send `Big.toFixed(2, 0)`-floored `value`; the off-ramp on-chain EURC transfer is derived from the same floored value; sub-cent dust is swept by `baseCleanupEurc`. | +| **EUR→EURC-Base self-swap drain** | The generic pipeline swaps the user's already-settled EURC to USDC and back, charging two swaps of slippage/fees and triggering `finalSettlementSubsidy` against bridge-less dust (over-subsidy + strand) | `isEurToEurcBaseDirect` collapses the corridor to a single `destinationTransfer` with `isDirectTransfer = true`; Nabla/Squid/finalSettlementSubsidy/cleanup are skipped at both route-build and handler level. | +| **Underdelivery from Nabla-on-Base** | Nabla swap returns less USDC/EURC than quoted and the ramp reaches `subsidizePostSwap`. | `subsidizePostSwap` (EVM branch) tops up eligible shortfalls subject to split caps: actual-vs-quoted swap discrepancy uses `MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION`; discount subsidy uses `MAX_EVM_POST_SWAP_DISCOUNT_SUBSIDY_QUOTE_FRACTION`. Over-cap cases are recoverable waits with no transfer submitted. | + +## Audit Checklist + +- [ ] Mykobo API credentials loaded from environment variables (not hardcoded, not in database) +- [ ] `MYKOBO_BASE_URL` is HTTPS and resolves to a `/v`-suffixed Mykobo endpoint +- [ ] `mykoboOnrampDeposit` polls Base RPC for EURC arrival before advancing +- [ ] 24h outer payment timeout enforced; on expiry the ramp transitions to `failed` +- [ ] 5% recovery tolerance applied only to the pre-funded shortcut, not to live polling +- [ ] On-ramp intent `wallet_address` is the Base ephemeral (not the user destination address) +- [ ] Off-ramp intent `wallet_address` is the Base ephemeral +- [ ] Off-ramp `mykoboReceivablesAddress` comes from `intent.instructions.address` (server-side) +- [ ] Off-ramp EURC transfer amount equals the 2dp-floored Mykobo intent `value` (derived via `Big.toFixed(2, 0)`), not the raw `nablaSwapEvm.outputAmountRaw` +- [ ] Both on-ramp `DEPOSIT` and off-ramp `WITHDRAW` Mykobo intents send `value` floored to 2 decimal places +- [ ] `MYKOBO_CLIENT_DOMAIN` is set in every environment (deploy-time check); missing value is a hard failure +- [ ] `mykoboPayoutOnBase` advances to `complete` only after both on-chain confirmation and Mykobo `COMPLETED` +- [ ] `FAILED` / `CANCELLED` / `EXPIRED` Mykobo statuses raise unrecoverable errors +- [ ] Recovery: `mykoboPayoutTxHash` short-circuits on-chain transfer re-broadcast (waits for receipt; re-sends only if prior tx reverted) +- [ ] Mykobo HTTP responses are validated (`response.ok`, status, body) +- [ ] `MykoboApiError` is caught at the handler boundary and mapped to recoverable / unrecoverable +- [ ] Bearer-token refresh is debounced (no thundering-herd on `401`) +- [ ] Bearer token, access key, and secret key do not appear in logs or error messages +- [ ] IBAN payment details surfaced to the user only after presigned-transaction validation passes +- [ ] `/v1/mykobo/profiles` endpoints require Supabase OTP auth (anonymous requests rejected) +- [ ] Mykobo KYC documents are not persisted by Vortex; only the email→profile linkage is stored +- [ ] `GET /v1/mykobo/profiles` rejects requests whose `email` query parameter does not match `req.userEmail` (case-insensitive) +- [ ] HTTPS enforced for all Mykobo API calls +- [ ] Timeout / `AbortController` configured for Mykobo HTTP client (cross-cutting; tracked as F-014 across providers) +- [ ] No Mykobo API call is invoked from a phase handler without an explicit recoverable/unrecoverable mapping +- [ ] EUR→EURC-on-Base on-ramps (`isEurToEurcBaseDirect`) emit a single `destinationTransfer` with `isDirectTransfer = true` — no Nabla swap, SquidRouter, `finalSettlementSubsidy`, or Base cleanup phases +- [ ] `finalSettlementSubsidy` honors `isDirectTransfer` / `isEurToEurcBaseDirect` and short-circuits to `destinationTransfer` if ever reached on a direct route diff --git a/docs/security-spec/05-integrations/squid-router.md b/docs/security-spec/05-integrations/squid-router.md index 9d2892c72..c5abb76db 100644 --- a/docs/security-spec/05-integrations/squid-router.md +++ b/docs/security-spec/05-integrations/squid-router.md @@ -5,9 +5,13 @@ Squid Router is a cross-chain swap/routing protocol built on Axelar's General Message Passing (GMP). Vortex uses it for: - **BRL on-ramp**: Base USDC → user's destination EVM chain (any token). - **BRL off-ramp**: User's source EVM chain → Base USDC. -- **EUR on-ramp (Monerium)**: Polygon EURe → Moonbeam. +- **EUR on-ramp (Mykobo on Base)**: Base USDC → user's destination EVM chain (after EURC→USDC Nabla swap). +- **EUR off-ramp (Mykobo on Base)**: User's source EVM chain → Base USDC (client-side user-signed). +- **Alfredpay on-ramp**: Polygon Alfredpay token → user's destination EVM chain/token, except for Polygon same-token passthrough. - **Off-ramp permit acquisition (Alfredpay)**: User EVM → Moonbeam via `TokenRelayer.execute()` with EIP-2612 permit. +> **Removed:** the previous Monerium-EUR Squid usage (Polygon EURe → Moonbeam) is no longer active; Monerium is deprecated (see `monerium.md`). + It handles cross-chain swap execution, Axelar bridge status monitoring, and gas subsidization on the destination chain. **Provider type:** Cross-chain router @@ -26,6 +30,8 @@ It handles cross-chain swap execution, Axelar bridge status monitoring, and gas 5. Optional `backupSquidRouterApprove` / `backupSquidRouterSwap` on the destination chain if the bridged token (axlUSDC / USDC) needs further conversion to the user's requested output token. **F-054: these `backup*` presigned txs have no registered phase handler.** 6. `destinationTransfer` to the user. +For quote metadata, Squid's `route.estimate.toAmount` is already denominated in the **destination token's raw units**. The bridge metadata (`evmToEvm.outputAmountRaw`, `moonbeamToEvm.outputAmountRaw`, etc.) MUST preserve that raw value directly instead of rebuilding it from the human-readable decimal amount with source-token decimals. This matters for routes like Base USDC (6 decimals) → BSC USDT (18 decimals), where using the source decimals would under-scale the metadata by 12 decimal places. The same invariant applies to routed Alfredpay onramps: even when the Squid source is the Polygon-minted Alfredpay token, `route.estimate.toAmount` remains authoritative for the destination token's raw units and `quote.outputAmount` must retain destination-token precision. + ### Off-ramp flow (user EVM source → Base USDC) 1. User signs one of three paths (depending on source ERC-20 capabilities and direction): @@ -55,6 +61,7 @@ When the BRL on-ramp's destination is **Base + USDC**, the Nabla swap output is 10. **No-permit fallback MUST NOT advance to `fundEphemeral` until BOTH approve and swap (or the direct transfer) have confirmed** — Sequential `waitForUserHash` calls in `executeNoPermitFallback` enforce this. 11. **Transaction hashes MUST be persisted to state before waiting** — `squidRouterApproveHash`, `squidRouterSwapHash`, `squidRouterPayTxHash`, `squidRouterPermitExecutionHash`, `squidRouterNoPermitApproveHash`, `squidRouterNoPermitSwapHash`, `squidRouterNoPermitTransferHash` all enable crash recovery. 12. **Skip-Squid path MUST NOT lose destination validation** — Quote engine `validate()` runs regardless of `skipRouteCalculation`; `destinationTransfer` is the only on-chain step that fires. +13. **Squid output raw metadata MUST use destination-token raw units** — `route.estimate.toAmount` is the authoritative destination raw output; `evmToEvm.outputAmountRaw` MUST NOT be recomputed with the source token's decimals. For same-chain same-token passthrough, `inputAmountRaw` is also the destination raw amount and is safe to mirror. Routed Alfredpay onramps follow the same rule; only direct Polygon same-token passthrough keeps the minted source-token precision. ## Threat Vectors & Mitigations @@ -71,6 +78,7 @@ When the BRL on-ramp's destination is **Base + USDC**, the Nabla swap output is | **No-permit fallback hash spoofing** | User reports tx hash → backend calls `waitForTransactionReceipt(hash)`. Hash is verified against actual chain state, not trusted blindly. The worst the user can do is report a hash that doesn't exist (handler errors recoverably) or a hash for a different transaction (receipt's `to`/`value` are not currently re-checked — see open question below). | | **No-permit allowance window attack** | The `squidRouterNoPermitApprove` grants Squid an allowance from the user's wallet; if the swap hash never confirms, the allowance lingers. The user wallet, not Vortex, retains the risk. UX should remind the user to revoke unused allowances; backend cannot revoke on the user's behalf. | | **Skip-Squid trivial-case manipulation** | The skip path triggers only when destination is Base+USDC, validated server-side by the quote engine before any presigned tx is generated. Attacker cannot force the skip path on non-Base/non-USDC routes. | +| **Destination decimal under-scaling** | A quote route bridges from a 6-decimal source token to an 18-decimal destination token (for example Base USDC → BSC USDT), but metadata reconstructs the destination raw output using source decimals. Displayed decimals look correct while raw metadata is under-scaled. | Preserve Squid's `route.estimate.toAmount` directly as destination-token raw metadata, and persist `quote.outputAmount` with destination-token precision before building the final transfer. | **⚠️ FINDING F-CARRIED**: In `squid-router-phase-handler.ts` line 147, `getPublicClient()` defaults to Moonbeam if `inputCurrency` doesn't match any known case and logs "This is a bug." Same handler also catches errors and silently defaults to Moonbeam (line 151-152). This fallback could cause transactions to be submitted to the wrong network. @@ -92,6 +100,7 @@ When the BRL on-ramp's destination is **Base + USDC**, the Nabla swap output is - [x] **FINDING F-063 (MEDIUM)**: SquidRouter slippage rejection (>2.5%) enforced. **PASS (FIXED)**. - [x] **No-permit fallback receipt validation**: `waitForUserHash` verifies receipt `from`, receipt `to`, and transaction `input` against the expected user address and presigned EVM transaction payload before advancing. - [x] **Skip-Squid trivial path**: emits passthrough bridge meta in `BaseSquidRouterEngine` and short-circuits discount/fee engines. Destination address validated by quote engine `validate()`. **PASS** — no security checks bypassed. +- [x] **Destination-token raw output metadata**: `evmToEvm.outputAmountRaw` preserves Squid's `route.estimate.toAmount` in destination raw units, including routed Alfredpay onramps. **PASS** — prevents Base/Polygon 6-decimal source → BSC USDT-style 18-decimal destination under-scaling. - [x] **Squid 429 rate-limit retry**: exponential backoff. **PASS — verify backoff cap.** - [x] **Arrival timeout**: `waitUntilTrue` accepts a timeout argument. **PASS** — verify all callers pass a finite value. - [EXISTING FINDING F-054]: `backupSquidRouterApprove`/`backupSquidRouterSwap`/`backupApprove` presigned txs have no registered phase handler. Either dead code or missing implementation. diff --git a/docs/security-spec/05-integrations/stellar-anchors.md b/docs/security-spec/05-integrations/stellar-anchors.md index c7009dcbb..808020bb8 100644 --- a/docs/security-spec/05-integrations/stellar-anchors.md +++ b/docs/security-spec/05-integrations/stellar-anchors.md @@ -1,17 +1,19 @@ # Stellar Anchors Integration +> **⚠️ FULLY DEPRECATED.** The Stellar-anchored off-ramp path (Spacewalk + Stellar payment) is no longer an active corridor. EUR has migrated to **Mykobo on Base** (see `mykobo.md`) and ARS has been removed entirely. The `spacewalkRedeem` and `stellarPayment` phase handlers are **not registered** in `register-handlers.ts`; presigned-transaction builders for these flows have been removed. This document is retained for historical reference and to document the security model of the prior implementation. **Do not treat any flow below as currently reachable.** + ## What This Does -Stellar anchors are used for off-ramp flows that terminate on the Stellar network — specifically EUR (EURC) and ARS off-ramps. The flow bridges assets from Pendulum to Stellar via the Spacewalk bridge, then makes a Stellar payment from the ephemeral account to the user's off-ramp destination. +Stellar anchors were historically used for off-ramp flows that terminated on the Stellar network (EUR via wrapped EURC; ARS via the Anclap anchor). Both corridors are now removed. The historical flow bridged assets from Pendulum to Stellar via the Spacewalk bridge, then made a Stellar payment from the ephemeral account to the user's off-ramp destination. -**Provider type:** Off-ramp -**Fiat currencies:** EUR (via EURC on Stellar), ARS +**Provider type:** Off-ramp (deprecated) +**Fiat currencies:** None active. EUR migrated to Mykobo on Base; ARS removed. **Chains involved:** Pendulum (Nabla swap output) → Stellar (via Spacewalk bridge) → Stellar anchor -**Phase handlers:** -- `spacewalk-redeem-handler.ts` — Submits a Spacewalk redeem request on Pendulum, then waits up to 10 minutes for tokens to arrive on the ephemeral Stellar account -- `stellar-payment-handler.ts` — Submits the presigned Stellar payment transaction to Horizon, sending tokens from the ephemeral to the user's destination +**Phase handlers (no longer registered):** +- `spacewalk-redeem-handler.ts` — Submitted a Spacewalk redeem request on Pendulum, then waited up to 10 minutes for tokens to arrive on the ephemeral Stellar account +- `stellar-payment-handler.ts` — Submitted the presigned Stellar payment transaction to Horizon, sending tokens from the ephemeral to the user's destination -**Flow (off-ramp):** +**Flow (off-ramp, historical):** 1. After Nabla swap on Pendulum, the output token (e.g., wrapped EURC) is held by the substrate ephemeral account 2. `spacewalkRedeem` phase: Calls a Spacewalk vault to redeem Pendulum-wrapped tokens for native Stellar tokens. The redeem extrinsic is presigned and submitted from the substrate ephemeral. The handler polls the Stellar ephemeral account balance until tokens arrive (1s polling, 10min timeout). 3. `stellarPayment` phase: Submits the presigned XDR transaction to Horizon. This transaction moves tokens from the Stellar ephemeral account to the user's Stellar address (the anchor's deposit address). diff --git a/docs/security-spec/06-cross-chain/bridge-security.md b/docs/security-spec/06-cross-chain/bridge-security.md index c2c2a5271..53aced9d1 100644 --- a/docs/security-spec/06-cross-chain/bridge-security.md +++ b/docs/security-spec/06-cross-chain/bridge-security.md @@ -2,7 +2,7 @@ ## What This Does -Spacewalk is the bridge between the **Pendulum** parachain and the **Stellar** network. It enables off-ramp flows that terminate on Stellar (EUR via EURC, ARS) by converting Pendulum-wrapped Stellar tokens back to native Stellar tokens. +Spacewalk is the bridge between the **Pendulum** parachain and the **Stellar** network. It enables off-ramp flows that terminate on Stellar (ARS today; EUR was migrated to Mykobo on Base — see `05-integrations/mykobo.md`) by converting Pendulum-wrapped Stellar tokens back to native Stellar tokens. The bridge operates through a **vault-based model**: independent vault operators lock collateral on Pendulum and process redeem requests. When a user (or ephemeral account) wants to redeem Pendulum-wrapped tokens for their Stellar originals, a vault is selected, the wrapped tokens are burned on Pendulum, and the vault releases the native tokens on Stellar. diff --git a/docs/security-spec/06-cross-chain/fund-routing.md b/docs/security-spec/06-cross-chain/fund-routing.md index 5f7956027..d3d7f0db2 100644 --- a/docs/security-spec/06-cross-chain/fund-routing.md +++ b/docs/security-spec/06-cross-chain/fund-routing.md @@ -12,7 +12,7 @@ There are now **five** subsidization-related phase handlers and one settlement p - `final-settlement-subsidy.ts` — Tops up an EVM ephemeral by SquidRouter-swapping native → ERC-20 (legacy / cross-chain settlement). Has a USD cap (`MAX_FINAL_SETTLEMENT_SUBSIDY_USD`). - `destination-transfer-handler.ts` — Sends the presigned EVM transfer from the ephemeral to the user's destination address -**Phase handlers (EVM):** The Substrate handlers above are polymorphic: `subsidize-pre-swap-handler.ts` and `subsidize-post-swap-handler.ts` dispatch to their EVM branches when the ephemeral involved is on a supported EVM chain (currently Base). The EVM branches top the ephemeral up before/after `nablaSwap` (EVM branch) and enforce the quote-relative USD cap `MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION`. +**Phase handlers (EVM):** The Substrate handlers above are polymorphic: `subsidize-pre-swap-handler.ts` and `subsidize-post-swap-handler.ts` dispatch to their EVM branches when the ephemeral involved is on a supported EVM chain (currently Base). The EVM pre-swap branch tops the ephemeral up before `nablaSwap` and enforces the quote-relative cap fraction from `MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION` (default `0.05`). The EVM post-swap branch splits the required top-up into a swap-discrepancy component and a discount component: `MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION` applies to the actual-vs-quoted swap-output discrepancy, while `MAX_EVM_POST_SWAP_DISCOUNT_SUBSIDY_QUOTE_FRACTION` (default `0.05`) caps the discount-derived top-up separately. **How subsidization works:** 1. Read the ephemeral account's current balance @@ -41,7 +41,9 @@ The current code resolves this through `EVM_FUNDING_PRIVATE_KEY` and the `getEvm 6. **Destination transfer MUST verify balance before submission** — The handler checks that the ephemeral has sufficient balance for the transfer. If insufficient, the phase fails rather than submitting a transaction that would revert. 7. **Post-swap subsidization next-phase routing MUST be deterministic** — `subsidize-post-swap-handler.ts` contains branching logic that selects the next phase based on ramp direction (on/off), destination chain, and output token. This routing must be consistent with the flow defined at ramp creation. 8. **No subsidization handler MUST proceed if the funding account has insufficient balance** — If the funding account cannot cover the subsidy, the handler should fail with a recoverable error, not silently skip the top-up. -9. **EVM subsidy caps MUST stop transfers without forcing manual phase repair** — If an EVM pre/post-swap subsidy exceeds the quote-relative cap, the handler must not submit a transfer. The cap breach is intentionally recoverable so operators can investigate, top up, or cancel the ramp without repairing an unrecoverably failed phase. +9. **EVM subsidy caps MUST stop transfers without forcing manual phase repair** — If an EVM pre-swap subsidy exceeds its configured quote-relative cap, the handler must not submit a transfer. For EVM post-swap subsidy, the handler must split the top-up into (a) actual-vs-quoted swap-output discrepancy and (b) discount-derived subsidy, then enforce each component's configured cap independently before submitting a single transfer. Both post-swap cap fractions are env-overridable and default to `0.05`. A cap breach is intentionally recoverable so operators can investigate, top up, or cancel the ramp without repairing an unrecoverably failed phase. +10. **`finalSettlementSubsidy` MUST subsidize the gap to *actual bridge delivery*, not to the ephemeral's total balance** — The subsidy is `expectedAmountRaw - delivered`, where `delivered = actualBalance - preSettlementBalance` and `preSettlementBalance` is the destination-token balance snapshotted right after the `squidRouterSwap` confirms (before `squidRouterPay`). Computing the subsidy from total balance is unsafe: leftover Nabla-swap dust in the destination token would make the handler return early and over-subsidize before the Squid bridge output has landed. To avoid racing the bridge, the balance poll waits for ≥90% of `expectedAmountRaw` to arrive (the 90% floor absorbs bridge slippage while still confirming the bridge actually delivered) rather than returning on any non-zero balance. (Incident: a EUR→EURC Base ramp was over-funded ~29.36 EURC and stranded ~59 EURC because the pre-fix handler returned on dust and subtracted total balance.) +11. **Degenerate same-token settlement routes MUST skip `finalSettlementSubsidy` entirely** — When the ramp is a direct transfer (`state.state.isDirectTransfer === true`), a EUR→EURC-on-Base route (`isEurToEurcBaseDirect`), or a BRL→BRLA-on-Base route (`isBrlToBrlaBaseDirect`), the handler short-circuits to `destinationTransfer` without subsidizing. There is no Squid bridge to settle, so any subsidy computation would be against a balance the funder never needs to top up. ## Threat Vectors & Mitigations @@ -55,6 +57,7 @@ The current code resolves this through `EVM_FUNDING_PRIVATE_KEY` and the `getEvm | **Destination transfer replay** — The presigned EVM transaction is somehow submitted multiple times | EVM nonce prevents replay. Each transaction is valid for exactly one nonce value. | | **Balance check race condition in destination transfer** — Balance changes between the check and the transaction submission | Possible but unlikely for ephemeral accounts (no other senders). If balance drops between check and submission, the EVM transaction reverts (no fund loss, just a failed phase that retries). | | **Post-swap routing logic inconsistency** — The next-phase selection in `subsidize-post-swap-handler.ts` routes to a phase that doesn't match the ramp's intended flow | Routing logic uses `direction`, `toChain`, and `outputTokenType` from ramp state. A mismatch would cause the ramp to enter an unexpected phase. Since phases are handler-specific, executing the wrong phase could fail or produce incorrect results. | +| **Final settlement over-subsidy race** — `finalSettlementSubsidy` returns as soon as *any* destination-token balance appears (e.g. Nabla-swap dust) and computes `subsidy = expected − totalBalance` before the Squid bridge output lands. The funder then tops up the full expected amount on top of the later bridge delivery, double-paying the ephemeral and stranding the excess. | **Mitigated.** The handler now snapshots `preSettlementBalance` after `squidRouterSwap` confirms, waits for ≥90% of `expectedAmountRaw` to arrive, and subsidizes only `expected − (actualBalance − preSettlementBalance)`. Direct-transfer / EUR→EURC-Base routes skip the phase outright. Regression-test this: the failure mode silently over-pays from the funding key. | ## Audit Checklist @@ -63,7 +66,7 @@ The current code resolves this through `EVM_FUNDING_PRIVATE_KEY` and the `getEvm - [x] Verify `subsidize-post-swap-handler.ts` calculates subsidy the same way — no off-by-one, no rounding errors. **PASS** — same calculation pattern confirmed. - [x] Verify both pre/post swap handlers skip subsidization when `currentBalance >= expectedAmount` (no negative transfers). **PASS** — skip condition verified in both handlers. - [x] Verify `getFundingAccount()` derives the keypair from `PENDULUM_FUNDING_SEED` and this seed is not reused for other purposes. **PASS** — seed used only for funding account derivation. -- [FAIL] Verify `MOONBEAM_FUNDING_PRIVATE_KEY` is used only for EVM subsidization, not other Moonbeam operations. **FAIL F-029** — `MOONBEAM_FUNDING_PRIVATE_KEY` equals `MOONBEAM_EXECUTOR_PRIVATE_KEY`; same key used for funding, executor, Monerium, and SquidRouter operations. With the BRL-on-Base flow this key is now also used for ephemeral subsidization on Base, BRLA payouts on Base, and EVM fee distribution on Base — a single private key compromise drains funds across Moonbeam, Base, Polygon, and any other EVM chain in scope, including the dedicated BRLA payout path. +- [FAIL] Verify `MOONBEAM_FUNDING_PRIVATE_KEY` is used only for EVM subsidization, not other Moonbeam operations. **FAIL F-029** — `MOONBEAM_FUNDING_PRIVATE_KEY` equals `MOONBEAM_EXECUTOR_PRIVATE_KEY`; same key used for funding, executor, legacy Monerium signing, Mykobo-related Base operations, and SquidRouter operations. With the BRL-on-Base and EUR-on-Base (Mykobo) flows this key is now also used for ephemeral subsidization on Base, BRLA + Mykobo EURC payouts on Base, and EVM fee distribution on Base — a single private key compromise drains funds across Moonbeam, Base, Polygon, and any other EVM chain in scope, including the dedicated BRLA and Mykobo payout paths. - [x] Verify `destination-transfer-handler.ts` checks ephemeral balance before submitting the presigned transaction. **PASS** — balance check before submission confirmed. - [x] Verify the presigned destination transfer is submitted as-is — no server-side modification of recipient or amount. **PASS** — presigned transaction submitted unmodified. - [PARTIAL] Verify `final-settlement-subsidy.ts` SquidRouter swap: check that the swap input amount is bounded and that the swap output is verified against expectations. **PARTIAL** — input amount is capped (F-001 fixed); no output verification against expectations. @@ -73,5 +76,7 @@ The current code resolves this through `EVM_FUNDING_PRIVATE_KEY` and the `getEvm - [N/A] Check whether there is any monitoring or alerting on funding account balance depletion. **N/A** — no monitoring infrastructure audited. - [x] Verify `MAX_FINAL_SETTLEMENT_SUBSIDY_USD` value is reasonable for the expected settlement amounts (check the constant's actual value). **PASS** — value reviewed and reasonable for expected settlement sizes. - [x] **FINDING F-060 (MEDIUM)**: Verify `validateSubsidyAmount` rejects negative, zero, NaN, and Infinity amounts. **PASS (FIXED)** — added try/catch around `Big()` construction to reject non-numeric strings, and `lte(0)` guard to reject zero and negative values. -- [x] **EVM subsidy handlers (`subsidize-pre-swap-evm-handler.ts`, `subsidize-post-swap-evm-handler.ts`) enforce a USD cap** via `MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION`; over-cap subsidies throw `RecoverablePhaseError` before any transfer is submitted, leaving the ramp waiting for operator action instead of moving to `failed`. +- [x] **EVM subsidy handlers (`subsidize-pre-swap-evm-handler.ts`, `subsidize-post-swap-evm-handler.ts`) enforce env-configured USD caps**. Pre-swap subsidy uses `MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION` (default `0.05`). Post-swap subsidy uses split caps: `MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION` for actual-vs-quoted swap-output discrepancy and `MAX_EVM_POST_SWAP_DISCOUNT_SUBSIDY_QUOTE_FRACTION` (default `0.05`) for the discount-derived component. Over-cap subsidies throw `RecoverablePhaseError` before any transfer is submitted, leaving the ramp waiting for operator action instead of moving to `failed`. - [x] **`MOONBEAM_FUNDING_PRIVATE_KEY` rename/refactor**: EVM funding now uses the `EVM_FUNDING_PRIVATE_KEY` / `getEvmFundingAccount(network)` path, with the old env name retained only as backward-compatible fallback. +- [x] **`finalSettlementSubsidy` subsidizes against actual bridge delivery, not total balance.** **PASS** — snapshots `preSettlementBalance` after `squidRouterSwap` confirms (`squid-router-phase-handler.ts`, stored in `meta-state-types.ts`), waits for ≥90% of `expectedAmountRaw`, and computes `subsidy = expected − (actualBalance − preSettlementBalance)`. Prevents the dust-triggered over-subsidy race that stranded ~59 EURC. +- [x] **`finalSettlementSubsidy` short-circuits degenerate same-token routes.** **PASS** — returns to `destinationTransfer` when `state.state.isDirectTransfer === true`, `isEurToEurcBaseDirect(...)`, or `isBrlToBrlaBaseDirect(...)`, so no subsidy is computed for routes that have no Squid bridge to settle. diff --git a/docs/security-spec/07-operations/api-surface.md b/docs/security-spec/07-operations/api-surface.md index 4d5803621..7f2667b9d 100644 --- a/docs/security-spec/07-operations/api-surface.md +++ b/docs/security-spec/07-operations/api-surface.md @@ -8,7 +8,7 @@ This spec covers the external-facing attack surface of the Vortex API (`apps/api - CORS: Explicit origin whitelist — `app.vortexfinance.co`, `metrics.vortexfinance.co`, staging Netlify, `localhost` (dev only) - Rate limiting: 100 requests per minute per IP (global, all endpoints) - Helmet: Standard HTTP security headers -- Body parser: JSON with **50MB limit** +- Body parser: JSON with **20MB limit** - Cookie parser: Enabled (for Supabase auth tokens) **Input validation** (`middlewares/validators.ts`): @@ -22,25 +22,38 @@ This spec covers the external-facing attack surface of the Vortex API (`apps/api - 404 handler for unmatched routes - Error responses include an `errors` array with validation details -**Route structure:** 27 route files under `api/routes/v1/`, each mounting controllers with appropriate auth middleware. +**Request correlation and client observability** (`api/observability/`): +- Incoming requests receive or propagate a non-secret request ID. +- The API returns `X-Request-ID` so clients can include it in support/debug reports. +- Partner-facing quote/ramp/auth outcomes are recorded as sanitized operational events; see `07-operations/client-observability.md`. + +**Maintenance-window enforcement** (`middlewares/maintenanceGuard.ts`): +- Active maintenance windows are sourced from the `maintenance_schedules` table via `MaintenanceService`. +- During an active window, mutable quote/ramp operations return HTTP `503 Service Unavailable` before controller/service work starts. +- Rejections include `Retry-After`, `Cache-Control: no-store`, and downtime metadata (`maintenance_start`, `maintenance_end`, affected operations) in the error payload so direct API clients can pause and retry after the window. + +**Route structure:** 27 TypeScript route files under `api/routes/v1/` including `index.ts`, each mounting controllers with appropriate auth middleware. ## Security Invariants 1. **CORS MUST only allow explicit origins** — The whitelist is defined in `express.ts`. No wildcard (`*`) origins. No dynamic origin reflection (echoing back the `Origin` header). 2. **Rate limiting MUST be enforced on all endpoints** — 100 req/min per IP applies globally via `express-rate-limit`. No endpoint should bypass this. -3. **Body size MUST be bounded** — The JSON body parser has a limit. **⚠️ FINDING: The limit is 50MB (`"50mb"`), which is excessively large for a JSON API.** A typical API allows 1-10MB. 50MB enables memory exhaustion attacks. +3. **Body size MUST be bounded** — The JSON body parser has a limit. **⚠️ FINDING: The limit is 20MB (`"20mb"`), which is still large for a JSON API.** A typical API allows 1-10MB. 20MB still enables avoidable memory pressure. 4. **All user input MUST be validated before reaching controllers** — Validators run as middleware before the controller function. Missing validation on an endpoint means raw user input reaches business logic. 5. **Error responses MUST NOT leak internal details in production** — Stack traces are stripped when `NODE_ENV !== "development"`. Error messages should be generic. The `errors` array should contain only user-facing validation messages. 6. **404 responses MUST be returned for unmatched routes** — The 404 handler prevents Express from returning default HTML error pages that could reveal framework information. 7. **Helmet MUST be enabled** — Adds `X-Frame-Options`, `X-Content-Type-Options`, `Strict-Transport-Security`, and other security headers. 8. **Input validation MUST cover all mutable endpoints** — Every POST/PUT/PATCH/DELETE endpoint should have a validator middleware. GET endpoints with query parameters should also validate. 9. **No endpoint MUST accept and process fields not explicitly validated** — Hand-written validators check specific fields but don't reject unknown fields. Extra fields pass through to controllers, which could lead to mass assignment or unexpected behavior. +10. **Request IDs MUST be correlation-only** — Request IDs may be accepted from clients or generated by the API, but they must not grant access, alter authorization, or be treated as trusted identity. +11. **API observability MUST NOT change request outcomes** — Client event persistence/logging must be best-effort and must not change controller response bodies, status codes, or ramp/quote state. +12. **Maintenance windows MUST be backend-enforced on mutable ramp entrypoints** — `POST /v1/quotes`, `POST /v1/quotes/best`, `POST /v1/ramp/register`, `POST /v1/ramp/update`, and `POST /v1/ramp/start` must reject during active maintenance with `503`, `Retry-After`, and explicit downtime start/end metadata. UI disabling is not sufficient because partners may call the API directly. ## Threat Vectors & Mitigations | Threat | Mitigation | |---|---| -| **⚠️ Memory exhaustion via large request body** — Attacker sends a 50MB JSON payload repeatedly to exhaust server memory | Rate limiting (100 req/min) provides some protection, but 100 requests × 50MB = 5GB of memory pressure per minute per IP. **The 50MB limit should be reduced to 1-10MB.** | +| **⚠️ Memory exhaustion via large request body** — Attacker sends a 20MB JSON payload repeatedly to exhaust server memory | Rate limiting (100 req/min) provides some protection, but 100 requests × 20MB = 2GB of memory pressure per minute per IP. **The 20MB limit should be reduced to 1-10MB.** | | **CORS bypass** — Attacker's site makes cross-origin requests to the API | Explicit origin whitelist prevents this. However, the whitelist includes `staging--pendulum-pay.netlify.app` — if the staging site is compromised or has XSS, it becomes a CORS-allowed origin in production. | | **Rate limit bypass via IP rotation** — Attacker uses multiple IPs to exceed per-IP rate limits | No mitigation beyond the per-IP limit. No account-based rate limiting, no endpoint-specific limits, no progressive penalties. High-value endpoints (ramp creation, quote generation) get the same limit as read-only endpoints. | | **Input validation bypass** — Validator doesn't check a field that the controller uses | Hand-written validators are prone to omissions. No schema library enforces completeness. New fields added to controllers may not get corresponding validators. | @@ -49,10 +62,12 @@ This spec covers the external-facing attack surface of the Vortex API (`apps/api | **Staging CORS origin in production** — `staging--pendulum-pay.netlify.app` is in the CORS whitelist | If the staging site has an XSS vulnerability, an attacker could use it to make authenticated cross-origin requests to the production API. Staging origins should ideally be removed from production CORS config. | | **No per-endpoint rate limiting** — Sensitive endpoints (ramp creation, admin operations) have the same rate limit as public read endpoints | An attacker can create 100 ramps per minute per IP. For endpoints that trigger expensive operations (XCM, SquidRouter), this could amplify costs. | | **Cookie-based auth without CSRF protection** — Cookie parser is enabled for Supabase auth tokens | If auth tokens are stored in cookies (not just headers), cross-site requests from CORS-allowed origins could carry auth cookies automatically. Verify whether CSRF tokens or `SameSite` cookie attributes are used. | +| **Observability side effects** — Event persistence failure breaks a partner-facing API call | Observability helpers must catch persistence/logging errors and run best-effort only. See `client-observability.md`. | +| **Direct API bypass of UI maintenance mode** — Partner SDK or custom API clients ignore the frontend and continue creating quotes or mutating ramps during planned downtime | Mutable quote/ramp routes run the maintenance guard server-side and fail closed with `503 Service Unavailable`, `Retry-After`, and the active window's start/end timestamps. | ## Audit Checklist -- [FAIL] **⚠️ FINDING F-035**: `bodyParser.json({ limit: "50mb" })` — verify this limit is intentional. Recommend reducing to 1-10MB for a JSON API. **FAIL F-035** — 50MB limit is excessive; enables memory exhaustion attacks. +- [FAIL] **⚠️ FINDING F-035**: `bodyParser.json({ limit: "20mb" })` — verify this limit is intentional. Recommend reducing to 1-10MB for a JSON API. **FAIL F-035** — 20MB limit remains high for a JSON API. - [FAIL] **FINDING F-036**: `staging--pendulum-pay.netlify.app` is in the production CORS whitelist — verify this is intentional and assess the risk of staging-site compromise. **FAIL F-036** — staging origin always in CORS whitelist regardless of `NODE_ENV`. - [PARTIAL] **FINDING**: All validators are hand-written (no Zod/Joi) — verify every mutable endpoint has a corresponding validator middleware. **PARTIAL F-037** — hand-written validators exist but multiple sensitive endpoints lack authentication/validation entirely. - [x] Verify CORS does not use wildcard (`*`) or dynamic origin reflection — check `express.ts` for `origin: true` or callback patterns. **PASS** — explicit origin whitelist used; no wildcard or dynamic reflection. @@ -61,10 +76,13 @@ This spec covers the external-facing attack surface of the Vortex API (`apps/api - [N/A] Verify `NODE_ENV` is set to `"production"` in production — stack traces are only stripped when not in development mode. **N/A** — requires deployment configuration inspection. - [x] Verify error responses do not include internal error types, database error codes, or SQL fragments. **PASS** — error handler wraps errors in generic `APIError` format. - [x] Verify the `errors` array in `APIError` contains only user-facing messages, not internal field names or database column names. **PASS** — error messages are user-facing validation messages. -- [PARTIAL] Map all 27 route files and verify each has appropriate auth middleware (Supabase, API key, admin, or public). **PARTIAL F-037** — multiple sensitive endpoints lack authentication: `/ramp/update`, `/ramp/start`, `/pendulum/fundEphemeral`, `/moonbeam/execute-xcm`, `/maintenance/schedules/:id/active`, `/webhook`. +- [x] Map all 28 TypeScript route files and verify each has appropriate auth middleware (Supabase, API key, admin, metrics dashboard, or public). **PASS** — F-013 resolved (legacy `/pendulum/fundEphemeral`, `/moonbeam/execute-xcm`, `/subsidize/*` endpoints removed); `/v1/ramp/*` and `/v1/ramp/quotes(/best)` use `requirePartnerOrUserAuth()` with ownership guards; `/v1/brla/*` uses `requireAuth`; `/v1/mykobo/profiles` (GET + POST) use `requireAuth` (F-068 resolved); `/v1/maintenance/*`, `/v1/admin/partners/:partnerName/api-keys`, and `/v1/admin/profile-partner-assignments` use `adminAuth`; `/v1/admin/api-client-events` uses `metricsDashboardAuth`; `/v1/webhook/*` uses `apiKeyAuth`. - [x] Verify no route accidentally uses `publicKeyAuth` (public key only, no secret key) for operations that should require `apiKeyAuth` (secret key). **PASS** — auth middleware usage reviewed per route. - [N/A] Verify controllers do not pass raw `req.body` to database operations — check for Sequelize `.create(req.body)` or `.update(req.body)` patterns. **N/A** — deferred; requires comprehensive Sequelize usage audit. - [x] Verify no endpoint returns `process.env`, server config, or internal paths in responses. **PASS** — no endpoint exposes internal configuration. - [PARTIAL] Check whether Supabase auth cookies use `SameSite=Strict` or `SameSite=Lax` — and whether CSRF tokens are required for state-changing operations. **PARTIAL** — cookie parser enabled but cookie attributes not explicitly configured for `SameSite`. - [x] Verify the 404 handler does not reveal Express version or framework information. **PASS** — custom 404 handler returns generic JSON error. - [x] Check all 27 route files for endpoints that accept file uploads — verify file size limits and type validation if present. **PASS** — no file upload endpoints found. +- [ ] Verify request ID middleware runs before routes and returns `X-Request-ID` without using request IDs for authorization. +- [ ] Verify partner-facing API observability writes are best-effort and cannot alter response status, response body, or quote/ramp state. +- [x] Verify active maintenance windows are enforced by the backend on quote creation and ramp register/update/start, not only by frontend UI state. diff --git a/docs/security-spec/07-operations/client-observability.md b/docs/security-spec/07-operations/client-observability.md new file mode 100644 index 000000000..a3afb9f61 --- /dev/null +++ b/docs/security-spec/07-operations/client-observability.md @@ -0,0 +1,57 @@ +# Client Observability + +## What This Does + +Backend client observability records sanitized operational events for partner-facing API activity. It is designed to help operators identify when one API client or partner integration is having problems without changing quote, ramp, authentication, or phase-processing behavior. + +The observed surface includes: + +- API key, public key, dual-auth, and ownership failures. +- Quote create, best-quote create, and quote retrieval. +- Ramp register, update, start, status, and error-log retrieval. +- Request correlation through `X-Request-ID` / `X-Correlation-ID` and response `X-Request-ID`. + +Events are persisted in `api_client_events` and structured logs are emitted through the existing backend logger. The event table is an operational telemetry store, not a source of truth for ramp state. Ramp execution failures remain in `RampState.errorLogs`; client observability events are request-level records used for alerting and incident investigation. + +Internal operators can inspect these events through `GET /v1/admin/api-client-events`, which is protected by the dedicated `Authorization: Bearer ` middleware. `METRICS_DASHBOARD_SECRET` must be different from `ADMIN_SECRET` to reduce blast radius. + +## Security Invariants + +1. **Observability MUST NOT affect API behavior** — Event persistence, structured logging, and metric hooks must be best-effort. Failures in the observability layer must not change response bodies, HTTP statuses, ramp state, quote state, or retry behavior. +2. **Events MUST be sanitized before persistence** — Only approved scalar fields may be stored. Failure events may include allowlisted request-derived scalar summaries in `metadata` (for example method, templated path shapes, selected quote/ramp IDs, selected quote inputs, query flags, array counts, and object-presence flags). Raw request bodies, raw headers, concrete path identifiers, nested metadata objects, and sensitive keys must be dropped before inserting `api_client_events` rows. +3. **Secrets MUST NOT be logged or persisted** — `X-API-Key`, bearer tokens, secret API keys, provider credentials, private keys, seeds, ephemeral private material, and signed transaction payloads must not appear in logs or observability events. +4. **Sensitive user/payment data MUST NOT be logged or persisted** — Tax IDs, PIX destinations, QR codes, KYC data, bank details, and raw payment credentials must be excluded from observability metadata. +5. **Request correlation MUST be non-secret** — `requestId`, `quoteId`, and `rampId` may be stored for debugging, but they must not be used as high-cardinality metric labels. They are correlation identifiers, not authentication material. +6. **Partner attribution MUST use safe identifiers** — Events may store `partnerId`, `partnerName`, and short API key prefixes capped at 16 characters. Full secret keys and raw auth headers are forbidden. `partnerName` is a display/audit label only; it must not be treated as an authorization credential or runtime pricing key. +7. **Operational metrics MUST remain low-cardinality** — Future metric exporters must group by bounded labels such as operation, partner, status, HTTP status, and error type. They must not label by user ID, wallet address, request ID, quote ID, ramp ID, tax ID, PIX key, or free-form request values. +8. **Event persistence SHOULD have automated retention before production operational use** — Raw operational events are useful for investigation but must not be retained indefinitely without aggregation or cleanup. The backend retention worker keeps the current UTC calendar day plus the previous six full UTC calendar days and removes older `api_client_events` rows on startup and daily. +9. **Client observability access MUST go through metrics-dashboard-authenticated backend APIs** — Internal consumers must call protected backend endpoints and must not ship database credentials, Supabase service-role keys, Metabase embed secrets, or other server-only credentials to client-side code. + +## Threat Vectors & Mitigations + +| Threat | Mitigation | +|---|---| +| **Observability database leak** — An attacker gains read access to `api_client_events` | Store only minimal sanitized event fields and allowlisted request summaries. Do not persist secrets, raw request bodies, tax IDs, PIX data, KYC data, or private key material. Treat the table as operationally sensitive even after redaction. | +| **API key/header capture** — Instrumentation accidentally records `X-API-Key`, bearer tokens, or raw headers | Use an allowlist-shaped event schema and denylist sensitive metadata keys before persistence. Store only short 16-character API key prefixes when explicitly safe. | +| **PII leakage through metadata** — Client-provided `additionalData` or error messages include tax IDs, PIX keys, or bank details | Do not persist nested metadata objects. Keep metadata scalar-only and sanitized. Pass only allowlisted request-derived fields to observability helpers; use counts or presence flags for arrays/objects such as presigned transactions, signing accounts, and `additionalData`. Truncate error messages and prefer stable `errorType` categories. | +| **Business flow disruption** — Database/logging outage causes quote/ramp requests to fail | Observability writes are fire-and-forget/best-effort and catch their own errors. The request path must proceed exactly as it would without observability. | +| **Missing correlation during incidents** — Operators cannot connect a partner report to backend logs | Generate or propagate `requestId` for all requests and return it via `X-Request-ID`. Persist request IDs alongside quote/ramp IDs when available. | +| **Misread partner attribution** — Operators interpret a display `partnerName` as proof of partner ownership or pricing authority. | Observability labels are non-authoritative. Authorization comes from `partner_id`/`user_id` ownership checks, and pricing attribution comes from quote-time `pricing_partner_id` when present. | +| **High-cardinality metric explosion** — Future observability metrics use ramp IDs or user IDs as labels | Keep high-cardinality identifiers in logs/event rows only. Export aggregate metrics using bounded labels. | +| **Unbounded telemetry retention** — Raw event rows grow indefinitely | Use the backend retention worker to delete `api_client_events` older than the 7-day UTC calendar retention window. The cleanup runs on startup and daily, uses advisory locking, and deletes in bounded batches. | +| **Internal metrics client exposure** — An internal metrics consumer is reachable by outsiders | Require the dedicated backend metrics dashboard bearer token for all event data. Do not rely on obscurity of client URLs. | +| **BI embed secret leak** — A future Metabase embed is generated in client-side code | Generate signed embed URLs only from the backend. Do not place Metabase signing secrets in publicly exposed environment variables. | + +## Audit Checklist + +- [ ] Verify `requestContext` assigns `requestId` and `requestStartedAt` before request logging and route handling. +- [ ] Verify `X-Request-ID` is returned on API responses and incoming `X-Request-ID` / `X-Correlation-ID` values are treated only as correlation IDs. +- [ ] Verify `api_client_events` stores only the approved fields: operation, status, HTTP status, error type/message, safe partner attribution, quote/ramp IDs, duration, and sanitized metadata. +- [ ] Verify partner attribution fields in events are used only for debugging/display, not authorization, pricing, or payout decisions. +- [ ] Verify event persistence helpers catch their own errors and cannot throw into controller or middleware responses. +- [ ] Verify auth, quote, and ramp request instrumentation does not alter existing response bodies or HTTP status codes. +- [ ] Verify failure-event metadata contains only allowlisted scalar request summaries and no `X-API-Key`, bearer tokens, raw headers, raw request bodies, tax IDs, PIX destinations, QR codes, KYC data, private keys, seeds, ephemeral secrets, or signed transaction payloads. +- [ ] Verify error messages are truncated and alerts/consumers use stable `errorType` categories rather than raw messages. +- [ ] Verify future metric exporters do not use request ID, quote ID, ramp ID, user ID, wallet address, tax ID, or PIX key as metric labels. +- [ ] Verify `GET /v1/admin/api-client-events` uses `metricsDashboardAuth` and returns only sanitized event fields. +- [ ] Verify the API client events retention worker runs on backend startup and daily, and deletes `api_client_events` older than the 7-day UTC calendar retention window in bounded batches. diff --git a/docs/security-spec/07-operations/rebalancer.md b/docs/security-spec/07-operations/rebalancer.md index ec6e5a955..5e0883a49 100644 --- a/docs/security-spec/07-operations/rebalancer.md +++ b/docs/security-spec/07-operations/rebalancer.md @@ -2,18 +2,50 @@ ## What This Does -The rebalancer is a standalone service (`apps/rebalancer/`) that monitors token coverage ratios on Pendulum and automatically moves liquidity across chains when ratios fall below threshold. Its primary function is ensuring the platform has sufficient tokens on Pendulum to service ramp operations without manual intervention. +The rebalancer is a standalone service (`apps/rebalancer/`) that monitors token coverage ratios and automatically moves liquidity across chains when ratios indicate a pool imbalance. Its primary function is ensuring the platform has sufficient tokens to service ramp operations without manual intervention. -**Current implementation:** One rebalancing path — BRLA ↔ axlUSDC, an 8-step cross-chain process that moves value from one stablecoin pool to another. +The default Base rebalancer is cost-aware. A coverage-ratio breach makes a fresh cron run eligible for evaluation, but execution still depends on the configured urgency band and projected round-trip cost. Mild and moderate imbalances can be skipped when route quotes are unfavorable; severe imbalances tolerate higher configured cost. `REBALANCING_HARD_MAX_COST_BPS` remains a hard projected-cost cap in every mode. `REBALANCING_DAILY_BRIDGE_LIMIT_USD` caps non-profitable fresh Base runs, but a quote that projects profit may bypass the daily cap while still being recorded in history after completion. + +**Current implementation:** Three rebalancing paths: + +1. **BRLA ↔ axlUSDC (legacy, Pendulum)** — 8-step cross-chain process on Pendulum/Moonbeam/Polygon. Activated via `--legacy` flag. +2. **USDC → BRLA → USDC (Base)** — Default high-coverage flow. Multi-step process on Base with route optimization across SquidRouter, Avenia, and optional main Nabla. +3. **BRLA → USDC correction (Base)** — Default low-coverage flow. Base-only two-swap process that uses main Nabla for USDC→BRLA and the BRLA pool for BRLA→USDC. **Architecture:** -- `index.ts` — Entry point: checks coverage ratios, triggers rebalancing if any ratio falls below 25% (`COVERAGE_RATIO_THRESHOLD`) -- `rebalance/brla-to-axlusdc/index.ts` — Orchestrator: manages an 8-step state machine with persistence and resumability -- `rebalance/brla-to-axlusdc/steps.ts` — Individual step implementations (swaps, XCMs, API calls) -- `services/stateManager.ts` — State persistence via Supabase Storage (JSON file, not database) +- `index.ts` — Entry point: parses CLI args (`--legacy`, `--restart`, `--route=`, amount), checks coverage ratios, selects flow +- `rebalance/brla-to-axlusdc/index.ts` — Legacy orchestrator: 8-step state machine on Pendulum +- `rebalance/brla-to-axlusdc/steps.ts` — Legacy step implementations +- `rebalance/usdc-brla-usdc-base/index.ts` — Base high-coverage orchestrator: multi-step state machine with route branching +- `rebalance/usdc-brla-usdc-base/steps.ts` — Base high-coverage step implementations (Nabla swaps, Avenia transfers, SquidRouter, rate comparison) +- `rebalance/brla-to-usdc-base/index.ts` — Base low-coverage orchestrator: main Nabla + BRLA-pool two-swap correction +- `rebalance/brla-to-usdc-base/steps.ts` — Base low-coverage step implementations +- `services/stateManager.ts` — Generic `StateManager` base class + flow-specific managers (`BrlaToAxlUsdcStateManager`, `UsdcBaseStateManager`, `BrlaToUsdcBaseStateManager`) +- `services/indexer/index.ts` — Nabla coverage ratio queries (Pendulum via GraphQL, Base via on-chain reads) - `utils/config.ts` — Configuration and secret loading +- `utils/nonce.ts` — `NonceManager` for sequential EVM transaction nonces +- `utils/transactions.ts` — Transaction confirmation helpers + +**CLI interface:** +``` +bun run start [amount] [--legacy] [--restart] [--route=squidrouter|avenia|nabla-main] +``` +- No flag → Base flow (default) +- `--legacy` → Pendulum flow +- `--restart` → Force fresh state, ignore in-progress rebalance +- `--route=squidrouter|avenia|nabla-main` → Constrain the high-coverage return route; the route is still quoted and cost-gated before execution + +**Cost policy controls:** +- `REBALANCING_POLICY_MODE=auto|dry-run|off|always` — `auto` applies urgency-band cost gating; `dry-run` quotes and logs the decision without state writes or fund movement; `off` skips fresh Base rebalances; `always` bypasses per-band cost gating but still respects `REBALANCING_HARD_MAX_COST_BPS`. The daily bridge limit still blocks non-profitable quotes in every executing mode, but projected-profitable quotes may bypass it. +- `REBALANCING_MODERATE_DEVIATION_BPS` / `REBALANCING_SEVERE_DEVIATION_BPS` — classify coverage deviation beyond the trigger bound into mild, moderate, or severe bands. +- `REBALANCING_MAX_COST_BPS_MILD` / `REBALANCING_MAX_COST_BPS_MODERATE` / `REBALANCING_MAX_COST_BPS_SEVERE` — maximum projected round-trip cost per urgency band. +- `REBALANCING_HARD_MAX_COST_BPS` — final projected-cost ceiling enforced even in `always` mode. -**Rebalancing flow (BRLA → axlUSDC):** +--- + +### Flow 1: BRLA → axlUSDC (Legacy, Pendulum) + +**Rebalancing flow:** 1. Swap axlUSDC → BRLA on Pendulum (Nabla DEX) 2. XCM BRLA from Pendulum → Moonbeam 3. Call BRLA API to swap BRLA → USDC (off-chain settlement via BRLA provider) @@ -23,45 +55,193 @@ The rebalancer is a standalone service (`apps/rebalancer/`) that monitors token 7. Verify arrival on Pendulum 8. Clean up state -**Key secrets:** Three separate chain private keys: `PENDULUM_ACCOUNT_SECRET`, `MOONBEAM_ACCOUNT_SECRET`, `POLYGON_ACCOUNT_SECRET`. These are **distinct from the API service keys** — the rebalancer operates its own accounts. +**Key secrets:** `PENDULUM_ACCOUNT_SECRET` (sr25519), `EVM_ACCOUNT_SECRET` (mnemonic for Moonbeam and Polygon). These are **distinct from the API service keys** — the rebalancer operates its own accounts. + +--- + +### Flow 2: USDC → BRLA → USDC (Base, default high-coverage flow) + +**Trigger condition:** Base Nabla BRLA pool coverage ratio > `1 + REBALANCING_THRESHOLD_USDC_TO_BRLA` (default upper bound `1.01`). Falls back to `REBALANCING_THRESHOLD` when the route-specific threshold is unset. This makes the flow eligible for evaluation; cost policy may still skip fresh execution. + +**Daily bridge limit:** Total requested USDC amount recorded by Base-flow history per calendar day (UTC), including the amount about to be rebalanced, must not exceed `REBALANCING_DAILY_BRIDGE_LIMIT_USD` (default 10,000) unless the selected quote projects a profit. Profit is inferred from projected output USDC greater than input USDC, which also yields negative projected cost bps. The limit decision is checked against both `UsdcBaseStateManager` and `BrlaToUsdcBaseStateManager` history after quote/cost-policy evaluation and before any fresh Base state write or transaction. Completed profitable runs still write normal history entries, so they remain visible in daily accounting. + +**Urgency-band policy:** Before any state write or transaction, the flow quotes the expected round-trip USDC output. Projected cost is `(input USDC - projected output USDC) / input USDC` in basis points. `auto` mode executes only when the projected cost is within the configured limit for the current coverage-deviation band. `dry-run` logs the same decision but never starts a rebalance. `off` skips without quoting. `always` can execute above the band limit, but not above `REBALANCING_HARD_MAX_COST_BPS`; the daily bridge limit still applies unless the quote projects profit. + +**Rebalancing flow (linear phase):** +1. Check initial USDC balance on Base (sufficient for requested amount) +2. Nabla approve + swap: USDC → BRLA on Base +3. Transfer BRLA to Avenia business account on Base (ERC-20 transfer) +4. Wait for BRLA delta to appear on Avenia internal balance (polling, 10-min timeout) + +**Rate comparison phase:** +5. Compare rates between SquidRouter, Avenia, and optional main Nabla for BRLA → USDC conversion + - If `--route=` is specified, execution is constrained to that route and the policy still requires a quote for that route before any swap + - Main Nabla route is available only when both `MAIN_NABLA_ROUTER` and `MAIN_NABLA_QUOTER` are set + - If every enabled route quote fails, aborts + - If one fails, uses the other + - The selected quote feeds both route selection and the cost-policy gate before the first Nabla swap + +**Route A: main Nabla (BRLA → USDC on Base, direct):** +6a. Main Nabla approve + swap: BRLA → USDC on Base +7a. Verify final USDC balance on Base + +**Route B: Avenia (BRLA → USDC on Base, direct):** +6b. Transfer BRLA to Avenia business account on Base if not already transferred +7b. Create Avenia swap ticket (BRLA → USDC, output on Base) +8b. Poll ticket status until PAID (5-min timeout) +9b. Wait for USDC delta arrival on Base (balance polling, 30-min timeout) + +**Route C: SquidRouter (BRLA on Polygon → USDC on Base, cross-chain):** +6c. Transfer BRLA to Avenia business account on Base if not already transferred +7c. Request Avenia to transfer BRLA from internal balance to Polygon +8c. Poll ticket status until PAID (5-min timeout) +9c. Wait for BRLA delta arrival on Polygon (balance polling, 10-min timeout) +10c. SquidRouter approve + swap: BRLA on Polygon → USDC on Base +11c. Wait for Axelar cross-chain execution (30-min timeout) +12c. Wait for USDC delta arrival on Base (balance polling, 30-min timeout) + +**Verification:** +12. Verify final USDC balance on Base +13. Record history entry (amount, cost, cost-relative, timestamps) +14. Send Slack notification with route, amount, and cost metrics + +**Fallback:** If Avenia ticket creation fails during Route A, the flow falls back to Route B (SquidRouter). + +**Key secrets:** `EVM_ACCOUNT_SECRET` (single BIP-39 mnemonic, derives accounts for Base + Polygon). `PENDULUM_ACCOUNT_SECRET` not required for this flow. + +--- + +### Flow 3: BRLA → USDC correction (Base, default low-coverage flow) + +**Trigger condition:** Base Nabla BRLA pool coverage ratio < `1 - REBALANCING_THRESHOLD_BRLA_TO_USDC` (default lower bound `0.99`). Falls back to `REBALANCING_THRESHOLD` when the route-specific threshold is unset. This makes the flow eligible for evaluation; cost policy may still skip fresh execution. + +**Daily bridge limit:** Uses the same Base-flow daily limit and projected-profit bypass described above. Completed runs record history in `rebalancer_state_brla_to_usdc_base.json`. + +**Urgency-band policy:** Uses the same Base policy controls as the high-coverage flow. Before any state write or transaction, the rebalancer pre-quotes the main Nabla USDC→BRLA leg and the BRLA-pool BRLA→USDC leg, then applies the band-specific projected-cost threshold. + +**Rebalancing flow:** +1. Check initial USDC balance on Base +2. Main Nabla swap: USDC → BRLA on Base +3. BRLA pool swap: BRLA → USDC on Base +4. Verify final USDC balance on Base +5. Record history entry and send Slack notification + +**Key secrets:** `EVM_ACCOUNT_SECRET` for Base transactions. `PENDULUM_ACCOUNT_SECRET` is not required. ## Security Invariants -1. **Coverage ratio check MUST precede rebalancing** — The rebalancer only triggers when a token's coverage ratio falls below `COVERAGE_RATIO_THRESHOLD` (default 0.25 / 25%). It must never rebalance preemptively or based on stale data. -2. **State persistence MUST survive process restarts** — The `stateManager` writes state to Supabase Storage as a JSON file. On restart, the rebalancer reads this file and resumes from the last completed step. -3. **Each step MUST be idempotent or guarded against re-execution** — If the process crashes mid-step and resumes, re-executing a completed step must not cause double-swaps, double-XCMs, or double-settlements. -4. **Rebalancer private keys MUST be isolated from API service keys** — The three chain keys are used only for rebalancer operations. Compromise of rebalancer keys should not affect API ramp operations, and vice versa. +### Shared (both flows) + +1. **Coverage ratio check MUST precede rebalancing** — The rebalancer only considers a fresh run when a flow-specific coverage threshold is crossed. Legacy flow uses Pendulum indexer data and triggers when BRLA is over-covered while USDC.axl is not; the default Base flow uses on-chain Nabla contract reads and becomes eligible above `1 + REBALANCING_THRESHOLD_USDC_TO_BRLA` or below `1 - REBALANCING_THRESHOLD_BRLA_TO_USDC`. For Base flows, threshold crossing is necessary but not sufficient: cost policy can still skip execution. +2. **State persistence MUST survive process restarts** — Each flow has its own Supabase Storage JSON file (`rebalancer_state.json` for legacy, `rebalancer_state_usdc_base.json` for Base high-coverage, `rebalancer_state_brla_to_usdc_base.json` for Base low-coverage). On restart, the rebalancer reads the file and resumes from the last completed phase. +3. **Each phase MUST be idempotent or guarded against re-execution** — If the process crashes mid-phase and resumes, re-executing a completed phase must not cause double-swaps, double-transfers, or double-settlements. Transaction hashes and pre-action balance baselines are stored in state to detect already-completed phases and verify per-run deltas. +4. **Rebalancer private keys MUST be isolated from API service keys** — The rebalancer keys operate separate accounts. Compromise of rebalancer keys should not affect API ramp operations, and vice versa. 5. **BRLA business account address MUST be verified** — `brlaBusinessAccountAddress` has a hardcoded default (`0xDF5Fb34B90e5FDF612372dA0c774A516bF5F08b2`). If this address is wrong, funds are sent to the wrong recipient with no recovery. -6. **Slippage MUST be bounded** — The Nabla swap step uses a 5% slippage tolerance (hardcoded). Excessive slippage could result in significant value loss per rebalance. -7. **SquidRouter gas pricing MUST not overpay excessively** — `gasMultiplier * 5n` is applied to `maxFeePerGas` for SquidRouter transactions. This aggressive multiplier ensures inclusion but could result in significant gas overpayment. -8. **Concurrent rebalancer executions MUST NOT corrupt state** — If two rebalancer instances run simultaneously, both would read the same state file and potentially execute the same steps in parallel. +6. **Concurrent rebalancer executions MUST NOT corrupt state** — If two rebalancer instances run simultaneously, both would read the same state file and potentially execute the same phases in parallel. Supabase Storage has no file locking or atomic compare-and-swap. +7. **Policy modes MUST be fail-safe** — `off` performs no fresh Base rebalancing; `dry-run` performs read-only quote/evaluation/logging with no state writes, tickets, approvals, swaps, transfers, or history entries; `always` bypasses per-band cost gating only, not `REBALANCING_HARD_MAX_COST_BPS`. The daily bridge limit still blocks non-profitable quotes in every executing mode, while projected-profitable quotes may bypass it. + +### Legacy flow (BRLA ↔ axlUSDC) invariants + +8. **Slippage MUST be bounded** — The Nabla swap step uses a 5% slippage tolerance (hardcoded). Excessive slippage could result in significant value loss per rebalance. +9. **SquidRouter gas pricing MUST not overpay excessively** — `gasMultiplier * 5n` is applied to `maxFeePerGas` for SquidRouter transactions. This aggressive multiplier ensures inclusion but could result in significant gas overpayment. +10. **Axelar polling MUST have a timeout** — **F-034 (legacy):** The legacy flow's Axelar polling loop (`while (!isExecuted)`) has no timeout — it will poll indefinitely if Axelar never reports success. This is a known deficiency in the legacy flow; the Base flow fixes it with a 30-minute timeout. + +### Base flow invariants + +11. **Daily bridge limit MUST be enforced except for projected-profit quotes** — Total requested USDC amount recorded by Base-flow histories per calendar day (UTC), including the amount about to be rebalanced, must not exceed `REBALANCING_DAILY_BRIDGE_LIMIT_USD` for non-profitable fresh Base runs. The limit decision must run after quote/cost-policy evaluation and before fresh state writes or transactions. Projected-profitable quotes may bypass the cap, but completed profitable runs must still be recorded in history. +12. **Cost policy MUST run before fresh-run side effects** — For Base flows, route/two-leg quotes and the cost-policy decision must happen before `startNewRebalance`, approvals, swaps, transfers, ticket creation, or history writes. Resumed runs continue the already-started state and do not recompute a fresh skip decision. +13. **Severity bands MUST be monotonic** — Moderate deviation must be less than or equal to severe deviation. Mild cost tolerance must be less than or equal to moderate, moderate less than or equal to severe, and severe less than or equal to `REBALANCING_HARD_MAX_COST_BPS`. +14. **Mild/moderate imbalances MUST be skippable when cost exceeds tolerance** — In `auto` mode, fresh Base rebalances must skip when projected round-trip cost exceeds the configured limit for the current band. +15. **Severe imbalances MAY use higher tolerance but MUST NOT bypass hard cost caps** — Severe band can permit higher projected cost, but it cannot bypass `REBALANCING_HARD_MAX_COST_BPS`, balance checks, slippage limits, or phase safety checks. It also cannot bypass the daily bridge limit unless the selected quote projects profit. +16. **Route comparison MUST handle provider failures gracefully** — If every enabled return route quote fails, the high-coverage flow MUST abort (not proceed with zero information). If some routes fail, the best available route is used. If `--route=` is specified, that route is still quoted and cost-gated before execution. +17. **Avenia fallback to SquidRouter MUST be atomic in state** — If Avenia ticket creation fails, the flow sets `winningRoute = "squidrouter"` and `currentPhase = AveniaTransferToPolygon` in a single `saveState()` call. A crash between the failure and the save could leave the flow in an inconsistent state. +18. **NonceManager MUST be re-initialized on resume** — The `NonceManager` is created fresh at the start of each execution from `getTransactionCount()`. On resume, it must not reuse stale nonces from a previous execution. +19. **Axelar cross-chain execution MUST have a timeout** — SquidRouter's Axelar polling has a 30-minute timeout. If Axelar does not confirm execution within this window, the flow MUST throw (not poll indefinitely). This resolves F-034 for the Base flow. +20. **Balance arrival checks MUST be delta-based** — The Base high-coverage flow persists pre-action balances before each arrival-producing operation and waits for `starting balance + expected delta` rather than checking absolute hot-wallet/provider balances. BRLA and Base USDC arrival checks allow a 99.8% tolerance to account for rounding, route deductions, and minor quote shortfalls without sweeping unrelated leftover balances into the current run. The actual received Base USDC delta is persisted before advancing to final verification. +21. **`EVM_ACCOUNT_SECRET` derives the same address on all EVM chains** — A single BIP-39 mnemonic is used for Base, Polygon, and Moonbeam. This means compromise of this one secret drains the rebalancer on ALL EVM chains. `PENDULUM_ACCOUNT_SECRET` is separate and legacy-only. +22. **Terminal Avenia ticket failures MUST abort immediately** — `checkTicketStatusPaid` treats `FAILED` as terminal and throws immediately instead of retrying until timeout. ## Threat Vectors & Mitigations +### Shared threats + +| Threat | Mitigation | +|---|---| +| **⚠️ State file corruption from concurrent execution** — Two rebalancer instances read the same JSON file from Supabase Storage, both decide to rebalance, both execute phases simultaneously | **NO MITIGATION.** Supabase Storage has no file locking, no atomic compare-and-swap, no conditional writes. If the rebalancer is deployed as multiple instances or triggered concurrently, state corruption and double-execution are possible. | +| **Rebalancer key compromise** — Attacker obtains the rebalancer private key(s) | Full drain of the rebalancer's accounts on all affected chains. `EVM_ACCOUNT_SECRET` is one mnemonic for Base, Polygon, and Moonbeam; `PENDULUM_ACCOUNT_SECRET` is separate and only needed for legacy Pendulum operations. The API service accounts are separate, so ramp operations are not directly affected (but liquidity would be depleted). | +| **Hardcoded business account address** — `brlaBusinessAccountAddress` default is wrong or points to an attacker-controlled address | Funds would be sent to the wrong address. The address should be verified against BRLA's official documentation and set via environment variable, not hardcoded. | +| **State file deletion or corruption** — Supabase Storage file is deleted or corrupted manually | The rebalancer would lose track of in-progress operations. Phases that already executed (swaps, transfers) would not be resumed, and the rebalancer would start fresh. This could leave funds stranded mid-flow. | +| **Stale coverage ratio** — The coverage ratio is checked once at startup, but by the time the multi-step rebalance completes, the ratio may have changed significantly | No re-check between phases. The rebalance amount is calculated upfront. If conditions change during the multi-step process, the rebalance may be unnecessary or insufficient. | + +### Legacy flow threats + | Threat | Mitigation | |---|---| -| **⚠️ State file corruption from concurrent execution** — Two rebalancer instances read the same JSON file from Supabase Storage, both decide to rebalance, both execute steps simultaneously | **NO MITIGATION.** Supabase Storage has no file locking, no atomic compare-and-swap, no conditional writes. If the rebalancer is deployed as multiple instances or triggered concurrently, state corruption and double-execution are possible. | -| **Rebalancer key compromise** — Attacker obtains one or more of the three chain private keys | Full drain of the rebalancer's accounts on the compromised chain(s). These are pooled accounts holding liquidity. No rate limiting at the chain level. The API service accounts are separate, so ramp operations are not directly affected (but liquidity would be depleted). | | **BRLA API manipulation** — The BRLA API returns a manipulated exchange rate for the BRLA→USDC swap | The rebalancer trusts the BRLA API response. No independent price verification is performed. A manipulated rate could result in receiving far less USDC than the BRLA value. | | **SquidRouter route manipulation** — SquidRouter API returns a malicious route for the USDC→axlUSDC swap | Same trust issue as with the BRLA API. The rebalancer trusts the route. No output verification against expected amounts. | -| **Hardcoded business account address** — `brlaBusinessAccountAddress` default is wrong or points to an attacker-controlled address | Funds would be sent to the wrong address. The address should be verified against BRLA's official documentation and set via environment variable, not hardcoded. | | **5% slippage exploitation** — An attacker manipulates the Nabla DEX pool to extract up to 5% per rebalance via sandwich attacks | 5% slippage tolerance is generous. For large rebalancing amounts, this could be significant. No MEV protection on Pendulum (though parachain MEV is less prevalent than Ethereum). | -| **State file deletion or corruption** — Supabase Storage file is deleted or corrupted manually | The rebalancer would lose track of in-progress operations. Steps that already executed (swaps, XCMs) would not be resumed, and the rebalancer would start fresh. This could leave funds stranded mid-flow. | -| **Stale coverage ratio** — The coverage ratio is checked once at startup, but by the time the 8-step rebalance completes, the ratio may have changed significantly | No re-check between steps. The rebalance amount is calculated upfront. If conditions change during the multi-step process, the rebalance may be unnecessary or insufficient. | +| **Infinite Axelar polling (F-034)** — Legacy flow's Axelar polling has no timeout; if Axelar never reports success, the process hangs indefinitely | **NO MITIGATION in legacy flow.** The process will hang until manually killed or the OS reclaims resources. The Base flow resolves this with a 30-minute timeout. | + +### Base flow threats + +| Threat | Mitigation | +|---|---| +| **Route comparison manipulation** — Avenia, SquidRouter, and optional main Nabla quotes are fetched and compared; an attacker could manipulate one provider's rate to force another route | The rebalancer trusts provider quotes without independent verification. However, since all high-coverage routes end with USDC on Base, the worst case is choosing a slightly worse rate, not direct fund loss. The `slippage: 4` parameter on SquidRouter provides some buffer. | +| **Avenia ticket creation failure mid-flow** — Avenia API fails after the flow committed to the Avenia route | **Mitigated.** The flow catches ticket creation errors and falls back to SquidRouter by setting `winningRoute = "squidrouter"` and saving state. Avenia tickets that return `FAILED` after creation are terminal and abort immediately. | +| **Daily bridge limit bypass** — History entries are stored in Supabase Storage; an attacker who can modify the storage could clear history to bypass the daily limit. Separately, projected-profitable quotes intentionally bypass the daily cap. | **Weak mitigation.** The limit is enforced client-side by reading history from Supabase and adding the current requested amount before starting. The intentional profit bypass requires a quote with projected output greater than input and still writes history on completion. An attacker with Supabase access could also drain funds directly, so malicious history tampering is a secondary concern. | +| **Cost-threshold misconfiguration** — Cost thresholds set too low can cause chronic under-rebalancing; thresholds set too high can cause repeated expensive rebalancing | Defaults are conservative and env parsing fails fast for non-monotonic values. Operators should first use `REBALANCING_POLICY_MODE=dry-run` to observe decisions before enabling tighter or looser production thresholds. | +| **Always-mode misuse** — Operator leaves `REBALANCING_POLICY_MODE=always` enabled and accepts expensive routes repeatedly | `always` still respects `REBALANCING_HARD_MAX_COST_BPS` and the daily bridge limit for non-profitable quotes. Decision logs include band, projected cost, allowed cost, daily-limit decision, and reason so misuse is observable. | +| **Dry-run/off mode drift** — Cron appears healthy but liquidity is not actually moving | `dry-run` and `off` log explicit skip reasons. External monitoring must distinguish successful dry-run/off exits from real completed rebalances. | +| **Quote-cost manipulation near thresholds** — Provider quotes near a configured boundary can nudge execution or skipping | Cost policy uses the best/forced quoted route before any side effect. Hard max-cost cap limits catastrophic execution, but provider quote trust remains a known risk. | +| **NonceManager stale nonce** — If the process crashes after sending a transaction but before saving the nonce, the resumed execution could reuse the same nonce | **Mitigated.** `NonceManager` is re-initialized from `getTransactionCount()` on each execution. The stored transaction hashes in state also prevent re-execution of already-completed phases. | +| **`EVM_ACCOUNT_SECRET` single-key blast radius** — One mnemonic controls all EVM chain accounts for the rebalancer | Compromise of this one secret drains rebalancer funds on Base, Polygon, and Moonbeam. The separate `PENDULUM_ACCOUNT_SECRET` limits Pendulum blast radius to the legacy flow. This is a deliberate simplification accepted for operational convenience. | +| **SquidRouter cross-chain timeout** — Axelar cross-chain execution could take longer than 30 minutes during network congestion | The rebalancer throws on timeout, leaving the BRLA-to-USDC swap incomplete on Polygon. Funds would be stuck as BRLA on Polygon until manual intervention or the next rebalance attempt resumes from the `SquidRouterApproveAndSwap` phase. | +| **Absolute balance false positives** — Hot wallets/provider accounts can contain leftovers from previous runs, so absolute balance checks could pass before the current run's funds arrive | **Mitigated for Base flow.** The flow stores pre-action baselines and waits for deltas on Avenia BRLA, Polygon BRLA, and Base USDC arrivals. | +| **BRLA balance tolerance (99.8%)** — BRLA delta checks accept 99.8% of expected amount as sufficient | If Avenia deducts a fee > 0.2%, the flow will not proceed and will time out. The tolerance prevents rounding dust from blocking valid arrivals while rejecting meaningful shortfalls. | ## Audit Checklist +### Shared + - [x] **FINDING**: State stored as JSON file in Supabase Storage — no locking, no atomic updates. Verify whether concurrent rebalancer instances are possible in the deployment configuration. **PASS (confirmed limitation)** — rebalancer is a one-shot CLI process (`process.exit(0/1)`); concurrency depends entirely on deployment scheduling (cron). No in-code concurrency guard. - [PARTIAL] **FINDING**: `brlaBusinessAccountAddress` has hardcoded default `0xDF5Fb34B90e5FDF612372dA0c774A516bF5F08b2` — verify this is the correct BRLA business account and that it's set via environment variable in production. **PARTIAL** — address is overridable via env var but has hardcoded default; correctness of default requires external verification. +- [x] Verify Supabase Storage write errors are handled — what happens if state cannot be persisted after a phase completes? **PASS** — errors propagate and cause process exit; no silent data loss. +- [PARTIAL] Verify the rebalancer has monitoring/alerting for: failed phases, insufficient balances, stuck state. **PARTIAL** — `process.exit(1)` on failure provides signal for external monitoring, but no built-in alerting. Slack notifications on completion provide some visibility. +- [x] Verify no rebalancer secrets are logged (check all error handlers and debug logging). **PASS** — no secret logging found. +- [x] Check whether the rebalancer runs on a schedule (cron) or is triggered manually — determines concurrency risk. **PASS** — one-shot CLI process; concurrency controlled by external scheduler. +- [x] Verify the `StateManager` handles missing or corrupted state files gracefully (fresh start vs crash). **PASS** — missing state treated as fresh start; `upsert: true` for writes; invalid JSON treated as missing with console warning. + +### Legacy flow (BRLA ↔ axlUSDC) + - [x] **FINDING**: 5% slippage tolerance hardcoded in Nabla swap — verify this is acceptable for expected rebalancing amounts. **PASS (confirmed limitation)** — 5% is generous but acceptable for the current rebalancing volumes; documented as known risk. - [x] **FINDING**: `gasMultiplier * 5n` applied to `maxFeePerGas` — verify this doesn't cause excessive gas overpayment in production. **PASS (confirmed limitation)** — aggressive multiplier ensures inclusion; overpayment risk accepted for reliability. -- [x] Verify `COVERAGE_RATIO_THRESHOLD` default (0.25) is appropriate for the expected token volumes. **PASS** — 25% threshold reasonable for current volumes. -- [x] Verify the three rebalancer private keys (`PENDULUM_ACCOUNT_SECRET`, `MOONBEAM_ACCOUNT_SECRET`, `POLYGON_ACCOUNT_SECRET`) are distinct from all API service keys. **PASS** — separate env vars and accounts confirmed. +- [x] Verify legacy coverage trigger is appropriate for the expected token volumes. **PASS** — legacy flow still checks BRLA over-coverage while USDC.axl is not over-covered before starting. +- [x] Verify the rebalancer private keys are distinct from all API service keys. **PASS** — separate env vars and accounts confirmed. - [PARTIAL] Verify step idempotency: can each of the 8 steps be safely re-executed after a crash? Check for nonce guards, balance checks, or transaction hash verification. **PARTIAL F-033** — steps 2, 3, 5, 6, 7 are NOT idempotent; crash between step execution and `saveState()` causes double-spend risk. - [PARTIAL] Verify the BRLA→USDC swap (step 3) validates the received USDC amount against expectations. **PARTIAL** — BRLA API response is trusted; no independent amount verification. - [FAIL] Verify the SquidRouter swap (step 5) validates the received axlUSDC amount against expectations. **FAIL F-034** — no output amount validation AND Axelar status polling has no timeout; infinite loop risk if Axelar never reports success. -- [x] Verify Supabase Storage write errors are handled — what happens if state cannot be persisted after a step completes? **PASS** — errors propagate and cause process exit; no silent data loss. -- [PARTIAL] Verify the rebalancer has monitoring/alerting for: failed steps, insufficient balances, stuck state. **PARTIAL** — `process.exit(1)` on failure provides signal for external monitoring, but no built-in alerting. -- [x] Verify no rebalancer secrets are logged (check all error handlers and debug logging). **PASS** — no secret logging found. -- [x] Check whether the rebalancer runs on a schedule (cron) or is triggered manually — determines concurrency risk. **PASS** — one-shot CLI process; concurrency controlled by external scheduler. -- [x] Verify the `stateManager` handles missing or corrupted state files gracefully (fresh start vs crash). **PASS** — missing state treated as fresh start; `upsert: true` for writes. + +### Base flows + +- [x] **FINDING**: Axelar polling has 30-minute timeout — resolves F-034 for Base flow. **PASS** — `axelarTimeout = 30 * 60 * 1000` enforced in `squidRouterApproveAndSwap()`. +- [x] **FINDING**: Daily bridge limit check — `REBALANCING_DAILY_BRIDGE_LIMIT_USD` (default 10,000) enforced against both Base-flow histories plus the current requested amount. **PASS** — checked after quote/cost-policy evaluation and before fresh Base side effects. Non-profitable quotes are blocked over the cap; projected-profitable quotes may bypass and are still recorded in history after completion. +- [x] **FINDING**: Avenia fallback to SquidRouter — if Avenia ticket creation fails, flow falls back to SquidRouter route. **PASS** — error caught, `winningRoute` updated, state saved atomically. +- [x] **FINDING**: `EVM_ACCOUNT_SECRET` single mnemonic for all EVM chains — broad EVM blast radius across Base, Polygon, and Moonbeam. **PASS (accepted)** — deliberate simplification; documented in invariants. +- [x] Verify route comparison handles partial failures — what happens if one provider's quote fails? **PASS** — if every enabled route fails, throws; otherwise uses the best available route. If `--route=` is specified, only fetches that quote. +- [x] Verify NonceManager re-initialization on resume — does it fetch fresh nonce from chain? **PASS** — `NonceManager.create()` calls `getTransactionCount()` on each execution. +- [x] Verify BRLA balance arrival tolerance (99.8%) is appropriate. **PASS** — accounts for rounding and minor fee deductions; 0.2% tolerance is tight enough to reject significant shortfalls. +- [x] Verify `checkTicketStatusPaid` has a timeout and treats FAILED as terminal. **PASS** — 5-minute timeout with 5-second poll interval; FAILED tickets throw immediately. +- [x] Verify `waitForBrlaOnAvenia` has a timeout. **PASS** — 10-minute timeout with 5-second poll interval. +- [x] Verify `waitUsdcOnBase` has a timeout. **PASS** — 30-minute timeout via `checkEvmBalancePeriodically`. +- [x] Verify `waitBrlaOnPolygon` has a timeout. **PASS** — 10-minute timeout via `checkEvmBalancePeriodically`. +- [PARTIAL] Verify the Nabla swap validates output amount against expectations. **PARTIAL** — uses `AMM_MINIMUM_OUTPUT_HARD_MARGIN` (5%) for slippage protection via `quoteSwapExactTokensForTokens`, but post-swap balance is verified by comparing pre/post BRLA balance (not against the quote). A sandwich attack could extract up to 5%. +- [x] Verify the `usdcBasePhaseOrder` overlap (`AveniaTransferToPolygon` and `AveniaSwapToUsdcBase` both at order 6; both wait phases at order 7) cannot cause incorrect phase transitions. **PASS** — routes are mutually exclusive, guarded by `if (state.winningRoute === "avenia")` / `if (state.winningRoute === "squidrouter")` checks. +- [x] Verify Base flow arrival checks are delta-based. **PASS** — Avenia BRLA, Polygon BRLA, Avenia USDC-on-Base, and SquidRouter USDC-on-Base waits all use persisted pre-action baselines plus expected deltas. Base USDC waits use the default 99.8% tolerance and persist the actual received delta before final verification. +- [x] Verify Nabla swap resume cannot lose the received BRLA amount. **PASS** — pre-swap BRLA baseline and swap hash are persisted; resume computes output from the persisted baseline or reuses already recorded output. +- [x] Verify Base low-coverage flow state/history is isolated from the high-coverage flow. **PASS** — `BrlaToUsdcBaseStateManager` uses `rebalancer_state_brla_to_usdc_base.json` while sharing the daily limit calculation. +- [x] Verify mild/moderate expensive rebalances are skipped in `auto` mode. **PASS** — projected cost is compared against the configured band threshold before any fresh Base state write or transaction. +- [x] Verify severe imbalances can execute at a higher configured cost while still respecting hard caps. **PASS** — severe uses `REBALANCING_MAX_COST_BPS_SEVERE`, bounded by `REBALANCING_HARD_MAX_COST_BPS`. +- [x] Verify `off` mode performs no fresh Base execution. **PASS** — policy returns a skip decision before quotes, state writes, balances, approvals, swaps, transfers, or tickets. +- [x] Verify `dry-run` mode performs no approvals/swaps/transfers/history mutations. **PASS** — policy quotes and logs the decision, then exits before state creation. +- [x] Verify `always` mode still enforces non-profitable daily bridge limit and hard max-cost cap. **PASS** — daily limit is checked after quote/cost-policy evaluation so profitable quotes can bypass; policy rejects cost above `REBALANCING_HARD_MAX_COST_BPS` in every mode. +- [x] Verify skipped decisions are observable. **PASS** — logs include direction, band, projected cost bps, allowed bps, input, projected output, projected cost, and reason. diff --git a/docs/security-spec/07-operations/secret-management.md b/docs/security-spec/07-operations/secret-management.md index 7f45d1a15..ded1e1e03 100644 --- a/docs/security-spec/07-operations/secret-management.md +++ b/docs/security-spec/07-operations/secret-management.md @@ -18,10 +18,14 @@ This spec catalogs every secret, its purpose, its blast radius if compromised, a | `MOONBEAM_FUNDING_PRIVATE_KEY` | EVM subsidization transfers across all EVM chains in scope (Moonbeam, Base, Polygon, etc.); BRLA payouts on Base; EVM fee distribution on Base | Drain of EVM funding pool on every supported EVM chain — including BRLA payout path on Base | | `CLIENT_DOMAIN_SECRET` | SEP-10 domain signing for Stellar anchors | Impersonation of Vortex in Stellar anchor authentication | | `ADMIN_SECRET` | Admin endpoint bearer token | Full admin access — can modify ramps, trigger operations | +| `METRICS_DASHBOARD_SECRET` | Read-only observability API bearer token | Read-only access to sanitized API client event data | | `WEBHOOK_PRIVATE_KEY` | RSA key for webhook signatures | Forge webhook signatures — could trick consumers into accepting fake events. **If missing, ephemeral RSA keys are generated at startup (non-persistent across restarts).** | | `SUPABASE_SERVICE_KEY` | Supabase admin access (bypasses RLS) | Full database read/write — all ramp data, user data, keys | | `SUPABASE_ANON_KEY` | Supabase public access (subject to RLS) | Limited by RLS policies — lower blast radius than service key | | `DB_PASSWORD` | Direct PostgreSQL access | Full database read/write — bypasses Supabase entirely | +| `MYKOBO_ACCESS_KEY` / `MYKOBO_SECRET_KEY` | Mykobo API authentication (HMAC-style; exchanged for bearer token) | Forge Mykobo SEPA payout requests on Base — could redirect EUR off-ramp payouts; also enables submission of arbitrary KYC profiles under the Vortex client domain | +| `MYKOBO_BASE_URL` | Mykobo API endpoint (`/v1` suffix normalized by client) | Not a secret; misconfiguration could route requests to an attacker-controlled host if env is tampered with | +| `MYKOBO_CLIENT_DOMAIN` | Vortex's registered client identifier with Mykobo; sent as `client_domain` on every Mykobo API call and selects the negotiated fee tier | Not a secret. **Operationally critical:** loaded via `getEnvVar` with no default — if unset, Mykobo silently falls back to its default fee tier (~5x higher than the negotiated rate, observed: ~0.31 EUR vs ~0.06 EUR fixed deposit fee). Quote engine fee defaults (`defaultDepositFee` / `defaultWithdrawFee`) will not match what Mykobo actually charges, corrupting fee accounting. Treat as required in production. | | `ALCHEMYPAY_APP_ID` / `ALCHEMYPAY_SECRET_KEY` | AlchemyPay price provider | Access to AlchemyPay API — price manipulation, data access | | `TRANSAK_API_KEY` | Transak price provider | Access to Transak API | | `MOONPAY_API_KEY` | MoonPay price provider | Access to MoonPay API | @@ -31,9 +35,8 @@ This spec catalogs every secret, its purpose, its blast radius if compromised, a | Secret | Purpose | Blast Radius | |---|---|---| -| `PENDULUM_ACCOUNT_SECRET` | Rebalancer's Pendulum account | Drain of rebalancer Pendulum funds | -| `MOONBEAM_ACCOUNT_SECRET` | Rebalancer's Moonbeam account | Drain of rebalancer Moonbeam funds | -| `POLYGON_ACCOUNT_SECRET` | Rebalancer's Polygon account | Drain of rebalancer Polygon funds | +| `EVM_ACCOUNT_SECRET` | Single BIP-39 mnemonic for all EVM chains (Base, Polygon, Moonbeam). Used by both Base and legacy flows. | Drain of rebalancer funds on ALL EVM chains — Base, Polygon, and Moonbeam. Single point of failure for all EVM-based rebalancing. | +| `PENDULUM_ACCOUNT_SECRET` | Rebalancer's Pendulum account (sr25519 seed). Only required for legacy flow (`--legacy` flag). | Drain of rebalancer Pendulum funds. Not needed for the default Base flow. | ### Shared @@ -47,10 +50,12 @@ This spec catalogs every secret, its purpose, its blast radius if compromised, a 2. **Secrets MUST NOT appear in logs** — Error handlers, debug logging, and request/response logging must not include secret values, private keys, or seeds. 3. **`WEBHOOK_PRIVATE_KEY` MUST be set in production** — If missing, `CryptoService` generates an ephemeral RSA keypair at startup. This key is non-persistent: webhook signatures generated before a restart cannot be verified after a restart, and vice versa. Consumers would see signature validation failures. 4. **`ADMIN_SECRET` MUST be a high-entropy value** — Used as a bearer token for admin endpoints. Compared via `safeCompare()` which has a known timing leak on length (see `01-auth/admin-auth.md`). -5. **Rebalancer keys MUST be isolated from API service keys** — The three rebalancer chain keys operate separate accounts from the API's funding keys. Compromise of one set should not grant access to the other. +5. **Rebalancer keys MUST be isolated from API service keys** — The rebalancer's `EVM_ACCOUNT_SECRET` mnemonic and legacy `PENDULUM_ACCOUNT_SECRET` operate separate accounts from the API's funding keys. Compromise of one set should not grant access to the other. 6. **`SUPABASE_SERVICE_KEY` MUST NOT be exposed to clients** — This key bypasses Row Level Security. It must only be used server-side. 7. **Database credentials (`DB_*`) MUST NOT be accessible from the public internet** — Direct PostgreSQL access should be restricted to the application server's network. 8. **No secret MUST be passed as a URL query parameter** — Query parameters are logged by proxies, CDNs, and web servers. Secrets must only travel in headers or request bodies. +9. **`MYKOBO_CLIENT_DOMAIN` MUST be set in production** — Not a secret, but operationally critical: when unset, Mykobo silently applies its default fee tier (~5x worse than the negotiated rate). Quote-engine fee defaults will then diverge from what Mykobo actually charges. Deployment automation MUST treat a missing `MYKOBO_CLIENT_DOMAIN` as a hard failure rather than letting it fall through to default-tier fees. +10. **Observability MUST follow the same no-secret rule as logs** — API client events, request correlation logs, metrics, and observability data must not contain full API keys, bearer tokens, provider credentials, private keys, seeds, raw request headers, or raw request bodies. Sanitized request summaries may be stored only when they are allowlisted, scalar, and stripped of secrets or sensitive payment/user data. See `07-operations/client-observability.md`. ## Threat Vectors & Mitigations @@ -63,6 +68,7 @@ This spec catalogs every secret, its purpose, its blast radius if compromised, a | **Lateral movement from price provider keys** — Compromise of AlchemyPay/Transak/MoonPay keys | Limited blast radius — these keys access price data, not funds. However, an attacker could manipulate prices shown to users (if the provider API allows it) or access transaction data. | | **Google Sheets credentials** — Access to fee logging spreadsheet | Could expose fee data and ramp metadata. Could manipulate fee records. Lower severity than financial keys but still a data leak. | | **`SUPABASE_SERVICE_KEY` used for all database operations** — No principle of least privilege | The service key bypasses all RLS. If any code path leaks this key, the attacker has unrestricted database access. A more secure approach would use the anon key with RLS for read operations and the service key only for privileged writes. | +| **Observability event leak** — Operational telemetry captures secret values or payment/KYC data | Client observability uses a sanitized event schema, 16-character key prefixes only, allowlisted scalar request summaries, scalar metadata filtering, and explicit exclusion of raw headers/bodies, tax IDs, PIX data, KYC data, and private material. | ## Audit Checklist @@ -81,3 +87,4 @@ This spec catalogs every secret, its purpose, its blast radius if compromised, a - [x] Check whether `GOOGLE_PRIVATE_KEY` contains newlines that might be mis-parsed — a common issue with PEM keys in env vars. **PASS** — PEM key handling present; standard env var parsing. - [x] Map the full blast radius: if the API server is compromised, list every account, service, and database that becomes accessible. **PASS (comprehensive)** — full blast radius documented in the Secret Inventory table above. - [x] **FINDING F-062 (MEDIUM)**: Verify SDK does not log API keys or secrets to console. **PASS (FIXED)** — removed `console.log("Creating quote with request:", request)` from `ApiService.ts` that was leaking the full request object including API key. +- [ ] Verify API client event persistence stores only 16-character key prefixes and never stores full `X-API-Key`, bearer tokens, raw auth headers, or request bodies. diff --git a/docs/security-spec/AUDIT-RESULTS.md b/docs/security-spec/AUDIT-RESULTS.md index 227de93da..6c0684f67 100644 --- a/docs/security-spec/AUDIT-RESULTS.md +++ b/docs/security-spec/AUDIT-RESULTS.md @@ -29,7 +29,7 @@ Clients send `signingAccounts` (addresses only). No private keys in request/resp Fresh `RampState.findByPk(rampId)` on every `processRamp()` call. Lock mechanism prevents concurrent modification (though non-atomic — F-003). #### 5. `[FAIL]` All external API calls have timeout configuration -Most external `fetch()` calls (Monerium, BRLA, CoinGecko, Moonpay, Transak, AlchemyPay, Slack, Subscan) lack `AbortController`/timeout. Only `webhook-delivery.service.ts` has a 30s timeout. → [F-014](FINDINGS.md) +Most external `fetch()` calls (Mykobo, BRLA, CoinGecko, Moonpay, Transak, AlchemyPay, Slack, Subscan) lack `AbortController`/timeout. Only `webhook-delivery.service.ts` has a 30s timeout. → [F-014](FINDINGS.md) #### 6. `[PARTIAL]` Error responses never leak internal state, stack traces, or secret material Stack traces stripped in production. However, raw `err.message` from internal errors passed to API responses in some paths. → [F-015](FINDINGS.md) @@ -627,9 +627,11 @@ No new findings. All 12 prior findings verified fixed. OZ caret range is a minor --- -### 5.2 Monerium Integration +### 5.2 Monerium Integration (DEPRECATED — replaced by Mykobo) -**Spec:** `05-integrations/monerium.md` +**Spec:** `05-integrations/monerium.md` (deprecated; see `05-integrations/mykobo.md` for the active EUR rail) + +> Monerium is no longer used. Active EUR on/off-ramp goes through Mykobo on Base. The checks below describe the historical Monerium audit state and are retained for traceability of F-023 / F-024 lineage. | # | Check | Result | |---|---|---| @@ -648,6 +650,38 @@ No new findings. All 12 prior findings verified fixed. OZ caret range is a minor --- +### 5.2b Mykobo Integration (ACTIVE EUR RAIL) + +**Spec:** `05-integrations/mykobo.md` + +Mykobo replaces Monerium for EUR on-ramp and Stellar/EURC for EUR off-ramp. Both directions now flow on Base, mirroring the BRLA-on-Base architecture. + +| # | Check | Result | +|---|---|---| +| 1 | Mykobo access/secret keys + base URL from env vars | ✅ PASS — loaded via `packages/shared` config; `MykoboApiService` throws on missing config | +| 2 | `MYKOBO_BASE_URL` HTTPS and `/v` enforced | ✅ PASS — F-070 fixed: `assertSecureMykoboBaseUrl` enforces HTTPS at construction (localhost permitted in non-production) | +| 3 | On-ramp `mykoboOnrampDeposit` polls Base RPC for EURC arrival | ✅ PASS — `checkEvmBalancePeriodically` against `evmEphemeralAddress` until `mykoboMint.outputAmountRaw` arrives | +| 4 | 24h outer payment timeout; on expiry → `failed` | ✅ PASS — `PAYMENT_TIMEOUT_MS = 24h`, transition to `failed` enforced in handler | +| 5 | 5% recovery tolerance scoped to pre-funded shortcut only | ✅ PASS — `EPHEMERAL_FUNDED_TOLERANCE_FACTOR=0.95` applies only to `ephemeralAlreadyFunded` pre-check; live polling uses full `expectedAmountRaw` | +| 6 | On-ramp intent `wallet_address` = Base ephemeral (not user destination) | ✅ PASS — `prepareMykoboOnrampTransactions` passes `evmEphemeralEntry.address` | +| 7 | Off-ramp intent `wallet_address` = Base ephemeral | ✅ PASS — `prepareEvmToMykoboOfframpTransactions` passes `evmEphemeralEntry.address` | +| 8 | Off-ramp `receivables` address sourced server-side from intent response | ✅ PASS — `mykoboReceivablesAddress = intent.instructions.address` | +| 9 | Off-ramp EURC transfer amount equals `nablaSwapEvm.outputAmountRaw` | ✅ PASS — encoded into the `mykoboPayoutOnBase` presigned tx at registration time | +| 10 | `mykoboPayoutOnBase` advances to `complete` only after on-chain + Mykobo `COMPLETED` | ✅ PASS — `sendMykoboPayoutTransaction` waits for receipt; `pollMykoboUntilCompleted` blocks on `COMPLETED` | +| 11 | `FAILED` / `CANCELLED` / `EXPIRED` → unrecoverable error | ✅ PASS — `createUnrecoverableError` for all three terminal statuses | +| 12 | Recovery: `mykoboPayoutTxHash` short-circuits re-broadcast | ✅ PASS — waits for prior receipt; re-sends only if prior tx reverted | +| 13 | `MykoboApiError` mapped to recoverable/unrecoverable at handler boundary | ✅ PASS — payout handler wraps send failures in `createRecoverableError`; status terminal → unrecoverable | +| 14 | Bearer-token refresh debounced (no thundering-herd on 401) | ✅ PASS — F-071 fixed: `authFailurePromise` debounce added to `handleAuthFailure`, mirroring `tokenPromise` pattern | +| 15 | Token / access / secret keys absent from logs | ⚠️ PARTIAL — `MykoboApiError.body` may carry raw response bodies into logs; no explicit redaction | +| 16 | IBAN payment details surfaced only after presigned-tx validation | ✅ PASS — `ibanPaymentData` returned from `prepareRampTransactions` only after `validatePresignedTxs` succeeds upstream | +| 17 | `/v1/mykobo/profiles` endpoints require Supabase OTP auth | ✅ PASS — F-068 fixed: `requireAuth` added to both GET and POST routes | +| 18 | Mykobo KYC documents not persisted by Vortex | ✅ PASS — multipart form-data streamed through to Mykobo; no local persistence of files or PII beyond the email→profile linkage | +| 19 | HTTPS enforced for all Mykobo API calls | ✅ PASS — F-070 fixed: `assertSecureMykoboBaseUrl` rejects non-HTTPS schemes at construction (localhost permitted in non-production) | +| 20 | Timeout / AbortController on Mykobo HTTP client | 🔴 FAIL — F-014 (cross-cutting; Mykobo `fetch` calls lack explicit `AbortController`, same gap as BRLA/Monerium/CoinGecko/etc.) | +| 21 | Phase handlers never call Mykobo API without explicit recoverable/unrecoverable mapping | ✅ PASS — `mykobo-payout-handler.ts` catches `PhaseError` directly and wraps non-PhaseError exceptions | + +--- + ### 5.3 Alfredpay Integration **Spec:** `05-integrations/alfredpay.md` @@ -713,11 +747,15 @@ No new findings. All 12 prior findings verified fixed. OZ caret range is a minor | ID | Severity | Finding | Module | |---|---|---|---| -| F-023 | 🟡 Medium | Monerium SEPA timeout (30min) may be too short for SEPA settlement | Monerium | -| F-024 | 🟡 Medium | No concurrent SEPA ramp limit per user | Monerium | +| F-023 | ⚪ Superseded | (Historical) Monerium 30-min SEPA timeout — Monerium removed; Mykobo uses 24h | Monerium → Mykobo | +| F-024 | 🟡 Medium | No concurrent SEPA ramp limit per user (now applies to Mykobo) | Mykobo | | F-025 | 🔵 Low | `HORIZON_URL` import inconsistency between modules | Stellar | | F-026 | 🔵 Low | `@ts-ignore` on `.nonce.toNumber()` hides potential API incompatibility | Stellar | | F-027 | 🟡 Medium | `squidRouterPermitExecutionValue` used as `msg.value` without validation | Squid Router | +| F-068 | 🔴 Critical | Mykobo `/v1/mykobo/profiles` GET/POST have no `requireAuth` — anonymous KYC ingestion | Mykobo | +| F-069 | 🟠 High | EUR off-ramp `fundEphemeral.nextPhaseSelector` falls through to `moonbeamToPendulum` (latent stuck-phase bug) | Mykobo / Ramp Engine | +| F-070 | 🟡 Medium | `MYKOBO_BASE_URL` accepts any URL scheme — no HTTPS enforcement | Mykobo | +| F-071 | 🔵 Low | `MykoboApiService.handleAuthFailure` is not debounced — concurrent-401 thundering herd | Mykobo | --- @@ -819,7 +857,7 @@ Hardcoded `0.95` multiplier. Reasonable for default small amounts ($1 USD). Aggressive but ensures inclusion on Polygon. Gas is typically cheap. #### 5. `[PASS]` Coverage ratio threshold -`1 + 0.25` threshold. Configurable via env var. Only rebalances when genuine surplus/deficit. +Default Base flow uses asymmetric bounds around 1.0: `1 - REBALANCING_THRESHOLD_BRLA_TO_USDC` for the low-coverage correction and `1 + REBALANCING_THRESHOLD_USDC_TO_BRLA` for the high-coverage flow. Both route-specific thresholds fall back to `REBALANCING_THRESHOLD` and default to `0.01`. #### 6. `[PASS]` Rebalancer keys distinct from API keys Different env var names. Actual isolation is operational. @@ -828,10 +866,10 @@ Different env var names. Actual isolation is operational. Steps 2, 3, 5, 6, 7 have crash windows between execution and `saveState()` causing double-spend on re-execution. No tx hash guards or nonce guards. → [F-033](FINDINGS.md) #### 8. `[PARTIAL]` BRLA→USDC swap amount validation -Verifies USDC arrives on-chain but doesn't compare arrived amount to quoted amount. +Legacy BRLA→USDC trusts the BRLA API response. Base high-coverage routes use provider quotes and delta-based arrival checks; Base low-coverage is a Base-only two-swap loop with final balance verification. #### 9. `[FAIL]` SquidRouter swap amount validation -Never validates received amount matches estimate. Axelar polling has no timeout (infinite loop risk). → [F-034](FINDINGS.md) +Legacy SquidRouter never validates received amount matches estimate and its Axelar polling has no timeout (infinite loop risk). The Base SquidRouter route has a 30-minute Axelar timeout and delta-based Base USDC arrival check. → [F-034](FINDINGS.md) #### 10. `[PASS]` Storage write errors handled Errors thrown and propagated. Process exits with code 1. @@ -1034,7 +1072,7 @@ Full security audit covering all 8 modules (00–07) across 23 specification fil | 02 — Signing Keys | Ephemeral Accounts, Server-Side Signing | 23 | | 03 — Ramp Engine | State Machine, Quote Lifecycle, Fee Integrity | 39 | | 04 — Smart Contracts | Token Relayer | 18 | -| 05 — Integrations | BRLA, Monerium, Alfredpay, Stellar Anchors, Squid Router | 60 | +| 05 — Integrations | BRLA, Mykobo (active EUR), Monerium (deprecated), Alfredpay, Stellar Anchors, Squid Router | 60 | | 06 — Cross-chain | XCM Transfers, Bridge Security, Fund Routing | 40 | | 07 — Operations | Rebalancer, Secret Management, API Surface | 44 | | **Total** | **22 sub-modules** | **~266 checklist items** | @@ -1043,11 +1081,13 @@ Full security audit covering all 8 modules (00–07) across 23 specification fil | Severity | Fixed | Accepted | Deferred | Open | Total | |---|---|---|---|---|---| -| 🔴 Critical | 5 | 0 | 0 | 0 | 5 | -| 🟠 High | 11 | 3 | 3 | 0 | 17 | -| 🟡 Medium | 25 | 3 | 6 | 0 | 34 | -| 🔵 Low / ⚪ Info | 8 | 3 | 0 | 0 | 11 | -| **Total** | **49** | **9** | **9** | **0** | **67** | +| 🔴 Critical | 6 | 0 | 0 | 0 | 6 | +| 🟠 High | 12 | 3 | 3 | 0 | 18 | +| 🟡 Medium | 26 | 3 | 6 | 0 | 35 | +| 🔵 Low / ⚪ Info | 9 | 3 | 0 | 0 | 12 | +| **Total** | **53** | **9** | **9** | **0** | **71** | + +Findings F-068 through F-071 from the Mykobo integration audit (2026-05-22) were resolved in the same audit cycle; see `FINDINGS.md` Phase 5 section for full descriptions and resolutions. A companion fix wired `fundEphemeral` into the EUR (Mykobo) onramp flow — the EUR ephemeral on Base previously had no source of native ETH, which would have caused `nablaApprove`/`nablaSwap`/squid txs to fail with insufficient gas had any Mykobo onramp progressed past deposit. ### Recommended Remediation Order @@ -1064,7 +1104,7 @@ Full security audit covering all 8 modules (00–07) across 23 specification fil **Week 3 — Integration Hardening:** 8. Add output amount validation to SquidRouter swaps (F-027, F-030, F-034) -9. Add Monerium webhook signature verification (F-024) +9. Add concurrent SEPA ramp limit per user (F-024, now applies to Mykobo flows) 10. Add pre-balance checks to subsidy handlers (F-032) **Month 2 — Architectural Improvements:** @@ -1073,6 +1113,12 @@ Full security audit covering all 8 modules (00–07) across 23 specification fil 13. Add structured audit logging (F-015) 14. Implement proper admin auth (F-020) +**Mykobo Integration Audit (2026-05-22) — Open:** +15. ✅ Done — Added `requireAuth` to `/v1/mykobo/profiles` GET/POST (F-068, Critical). The GET endpoint now identifies profiles by the authenticated user's email (`req.userEmail`) via `MykoboApiService.getProfileByEmail`, and rejects requests whose `email` query parameter does not match the authenticated user. POST profile creation continues to bind `wallet_address` to the user's ephemeral, so no separate wallet-ownership check is required there. +16. ✅ Done — Added explicit EURC SELL branch to `fund-ephemeral-handler.nextPhaseSelector` returning `distributeFees`; also added the missing EURC BUY branch returning `subsidizePreSwap` and wired `fundEphemeral` into the Mykobo onramp flow via `mykobo-onramp-deposit-handler` and `getRequiresBaseEphemeralAddress` (F-069, High) +17. ✅ Done — Enforced HTTPS scheme on `MYKOBO_BASE_URL` at `MykoboApiService` construction via `assertSecureMykoboBaseUrl` (F-070, Medium) +18. ✅ Done — Debounced `MykoboApiService.handleAuthFailure` with `authFailurePromise` mirroring `getToken`'s `tokenPromise` (F-071, Low) + ### Files Reference - **Specifications:** `docs/security-spec/` (23 spec files — see `README.md` for index) diff --git a/docs/security-spec/FINDINGS.md b/docs/security-spec/FINDINGS.md index 420f510e8..aeabb201c 100644 --- a/docs/security-spec/FINDINGS.md +++ b/docs/security-spec/FINDINGS.md @@ -1,18 +1,18 @@ # Audit Findings Tracker -> **Generated:** 2026-04-02 | **Last Updated:** 2026-05-12 | **Status:** F-001 through F-067: 49 fixed, 9 accepted risk, 9 deferred, 0 open. Additional discount-mechanism findings F-DISC-01 through F-DISC-05 remain open in `03-ramp-engine/discount-mechanism.md` and are not included in the counts below. +> **Generated:** 2026-04-02 | **Last Updated:** 2026-05-22 | **Status:** F-001 through F-067: 49 fixed, 9 accepted risk, 9 deferred, 0 open. F-068 through F-071 raised by the Mykobo integration audit: 4 open. F-072 raised by the ephemeral-account lifecycle review: 1 fixed. Additional discount-mechanism findings F-DISC-01 through F-DISC-05 remain open in `03-ramp-engine/discount-mechanism.md` and are not included in the counts below. -This file consolidates all security findings from the Vortex platform audit. Findings were discovered across four phases: specification writing (F-001 through F-012), code-vs-spec audit across all 8 modules (F-013 through F-037), transaction validation / ephemeral account / phase flow audit (F-038 through F-058), and fresh security audit pass (F-059 through F-067). +This file consolidates all security findings from the Vortex platform audit. Findings were discovered across six phases: specification writing (F-001 through F-012), code-vs-spec audit across all 8 modules (F-013 through F-037), transaction validation / ephemeral account / phase flow audit (F-038 through F-058), fresh security audit pass (F-059 through F-067), Mykobo integration audit (F-068 through F-071), and ephemeral-account lifecycle review (F-072). ## Summary | Severity | Fixed | Accepted | Deferred | Open | Total | |---|---|---|---|---|---| -| 🔴 Critical | 5 | 0 | 0 | 0 | 5 | -| 🟠 High | 11 | 3 | 3 | 0 | 17 | -| 🟡 Medium | 25 | 3 | 6 | 0 | 34 | -| 🔵 Low / ⚪ Info | 8 | 3 | 0 | 0 | 11 | -| **Total** | **49** | **9** | **9** | **0** | **67** | +| 🔴 Critical | 5 | 0 | 0 | 1 | 6 | +| 🟠 High | 11 | 3 | 3 | 1 | 18 | +| 🟡 Medium | 25 | 3 | 6 | 1 | 35 | +| 🔵 Low / ⚪ Info | 8 | 3 | 0 | 1 | 12 | +| **Total** | **49** | **9** | **9** | **4** | **71** | > **Fixed** = code change implemented and verified. **Accepted** = CTO reviewed and accepted risk, no code change. **Deferred** = requires architectural work, separate app changes, or future investigation. **Open** = newly identified, awaiting fix or CTO decision. @@ -222,7 +222,7 @@ A malicious client could sign a Stellar payment for 0.0001 XLM to their own addr | **Found** | Code audit, iteration 2 | | **Impact** | A hanging external service can block the caller indefinitely. For phase handlers, this stalls ramp processing. For price feeds, this stalls quote generation. | -**Description:** Of 16+ `fetch()` calls to external services, only `webhook-delivery.service.ts` uses `AbortController` with a timeout. All others (Monerium, CoinGecko, Moonpay, Transak, AlchemyPay, Subscan, Slack, ramp helpers) make HTTP requests without any timeout or `AbortSignal`. +**Description:** Of 16+ `fetch()` calls to external services, only `webhook-delivery.service.ts` uses `AbortController` with a timeout. All others (Mykobo, BRLA, CoinGecko, Moonpay, Transak, AlchemyPay, Subscan, Slack, ramp helpers) make HTTP requests without any timeout or `AbortSignal`. The historical Monerium `fetch` calls had the same gap and have been carried forward into the Mykobo client. **Fix:** Add `AbortController` with appropriate timeouts (e.g., 10-30s) to all external `fetch()` calls. Consider a shared utility function like `fetchWithTimeout(url, options, timeoutMs)`. @@ -654,39 +654,37 @@ The backup nonce is set to `0` (or `polygonAccountNonce` for Polygon), meaning t --- -### F-023: Monerium SEPA Timeout May Be Too Short +### F-023: Monerium SEPA Timeout May Be Too Short (SUPERSEDED) | Field | Value | |---|---| -| **Location** | `apps/api/src/api/services/phases/handlers/monerium-onramp-mint-handler.ts` | -| **Spec** | `05-integrations/monerium.md` | -| **Status** | 🟡 **DEFERRED** — needs runtime testing to validate | +| **Location** | `apps/api/src/api/services/phases/handlers/monerium-onramp-mint-handler.ts` (legacy) | +| **Spec** | `05-integrations/monerium.md` (deprecated) → see `05-integrations/mykobo.md` | +| **Status** | ⚪ **SUPERSEDED** — Monerium is removed; EUR on-ramp now uses Mykobo on Base with a 24h outer payment timeout | | **Found** | Code audit, iteration 2, Module 05 | -| **Impact** | Legitimate SEPA on-ramp payments could be marked as failed if Monerium takes longer than 30 minutes to mint EURe after SEPA settlement. | +| **Impact** | (Historical) Legitimate SEPA on-ramp payments could be marked as failed if Monerium took longer than 30 minutes to mint EURe after SEPA settlement. | -**Description:** The `monerium-onramp-mint-handler.ts` uses `PAYMENT_TIMEOUT_MS` (30 minutes) to wait for EURe token arrival on Polygon. SEPA transfers take 1-3 business days to settle. The 30-minute timeout may be too short if Monerium's processing itself takes time after SEPA arrives. +**Description:** The legacy `monerium-onramp-mint-handler.ts` used `PAYMENT_TIMEOUT_MS` (30 minutes) to wait for EURe token arrival on Polygon. SEPA transfers take 1-3 business days to settle. -**CTO Clarification (2026-04-02):** The timer starts at ramp creation — NOT after Monerium confirms SEPA settlement. The flow works because the ramp isn't created until the SEPA transfer is expected to have already settled and Monerium is expected to mint EURe imminently. However, if Monerium processing is delayed beyond 30 minutes after the ramp is created, the ramp will fail even if the payment was legitimate. - -**Fix:** Verify that the 30-minute window is sufficient for the expected Monerium processing time after SEPA settlement. If not, extend the timeout or implement a webhook-based flow where Monerium notifies completion rather than polling. +**Resolution:** The EUR on-ramp has been migrated to Mykobo (`mykobo-onramp-deposit-handler.ts`) which uses a **24-hour `PAYMENT_TIMEOUT_MS`** with a 5-minute inner balance-check timeout that surfaces as a recoverable error. This matches SEPA business-day cutoffs and removes the original 30-minute tightness. The legacy 30-minute window is no longer reached by any active corridor. --- -### F-024: No Concurrent SEPA Ramp Limit Per User +### F-024: No Concurrent SEPA Ramp Limit Per User (CARRIED FORWARD TO MYKOBO) | Field | Value | |---|---| | **Location** | Ramp creation flow (no per-user limit enforcement) | -| **Spec** | `05-integrations/monerium.md` | -| **Status** | 🟡 **DEFERRED** — requires new DB queries and ramp creation changes | +| **Spec** | `05-integrations/mykobo.md` (formerly `monerium.md`) | +| **Status** | 🟡 **DEFERRED — STILL APPLIES** — requires new DB queries and ramp creation changes; same risk now applies to Mykobo SEPA flows | | **Found** | Code audit, iteration 2, Module 05 | -| **Impact** | Resource exhaustion — an attacker could create many SEPA-based ramps without paying, tying up system resources (polling, state tracking, phase processing). | +| **Impact** | Resource exhaustion — an attacker could create many SEPA-based ramps without paying, tying up system resources (polling, state tracking, phase processing). With Mykobo's 24h outer timeout the exposure window per pending ramp is **larger** than under the previous 30-minute Monerium window. | -**Description:** No per-user concurrent ramp limit is enforced for Monerium SEPA flows. A user can create unlimited pending SEPA ramps. Each ramp consumes: (1) a database row with state tracking, (2) periodic phase processing cycles (polling for token arrival), (3) a slot in the phase processor queue. The 30-minute timeout per ramp partially mitigates this (each ramp auto-fails after 30 min), but during those 30 minutes the system is actively polling for each ramp. +**Description:** No per-user concurrent ramp limit is enforced for Mykobo SEPA on-ramp flows (previously: Monerium). A user can create unlimited pending SEPA ramps. Each ramp consumes: (1) a database row with state tracking, (2) periodic phase processing cycles (polling for EURC arrival on Base), (3) a slot in the phase processor queue. With Mykobo's 24h timeout, each unpaid ramp now stays active for up to 24 hours rather than 30 minutes. **CTO Clarification (2026-04-02):** Yes, add a per-user limit on concurrent pending SEPA ramps. Suggested max: 3. -**Fix:** Add a per-user limit on concurrent pending ramps (e.g., max 3 pending SEPA ramps per user). Enforce at ramp creation time. +**Fix:** Add a per-user limit on concurrent pending ramps (e.g., max 3 pending SEPA Mykobo ramps per user). Enforce at ramp creation time. The original Monerium-specific recommendation now applies to the Mykobo handler. --- @@ -1455,6 +1453,218 @@ If a database partner record has `markupValue = -0.01` and `markupType = "relati --- +## Phase 5: Mykobo Integration Audit (F-068 — F-071) + +Findings raised during the Mykobo-on-Base EUR rail audit. See `05-integrations/mykobo.md` and `03-ramp-engine/ramp-phase-flows.md`. + +--- + +### F-068: Mykobo KYC Profile Endpoints Have No Authentication + +| Field | Value | +|---|---| +| **Severity** | 🔴 **Critical** | +| **Location** | `apps/api/src/api/routes/v1/mykobo.route.ts` (lines 14-15); parent mount at `apps/api/src/api/routes/v1/index.ts` (line 150) | +| **Spec** | `05-integrations/mykobo.md` (Invariant 15), `01-auth/supabase-otp.md` | +| **Status** | ✅ **FIXED** (2026-05-22) | +| **Found** | Mykobo integration audit, 2026-05-22 | +| **Impact** | Anonymous callers can enumerate KYC profiles and submit arbitrary KYC documents (ID, source-of-funds, demographics) tied to any wallet address. This bypasses the spec's "Supabase OTP required" invariant, enables KYC-document submission floods against the Mykobo upstream, and allows attackers to associate attacker-controlled documents with arbitrary identities. | +| **Resolution** | `requireAuth` added to both `/v1/mykobo/profiles` GET and POST routes, mirroring the `alfredpay.route.ts` pattern. The GET endpoint now identifies profiles by the authenticated user's email (`req.userEmail`) via `MykoboApiService.getProfileByEmail`, and rejects requests whose `email` query parameter does not match the authenticated user's email. POST profile creation still ties `wallet_address` to the user's ephemeral, so no separate wallet-ownership check is needed there. Supabase OTP gating plus the email/`req.userEmail` match closes the anonymous-flood and oracle vectors. | + +**Description:** `mykobo.route.ts` mounts two endpoints with **no authentication middleware**: + +```typescript +router.route("/profiles").get(mykoboController.getProfileController); +router.route("/profiles").post(profileUpload, mykoboController.createProfileController); +``` + +The parent mount in `routes/v1/index.ts:150` (`router.use("/mykobo", mykoboRoute)`) does not wrap with `requireAuth` either. Compare against the sibling `alfredpay.route.ts`, which applies `requireAuth` on every user-facing endpoint. + +Spec `mykobo.md` invariant 15 requires: *"Mykobo KYC profile creation MUST be gated by Vortex auth — The `/v1/mykobo/profiles` endpoints require a Supabase OTP session; anonymous profile creation is rejected."* The code violates this invariant. + +The `GET /profiles?email=...&memo=...` endpoint is an email-keyed KYC profile-existence oracle. The `POST /profiles` endpoint accepts multipart form-data (ID document, utility bill, selfie) and forwards it to Mykobo — anonymous callers can submit forged KYC documents linked to arbitrary identities. + +**Fix:** Add `requireAuth` middleware to both routes (mirroring `alfredpay.route.ts`): + +```typescript +router.route("/profiles").get(requireAuth, mykoboController.getProfileController); +router.route("/profiles").post(requireAuth, profileUpload, mykoboController.createProfileController); +``` + +After adding auth, also verify that the `email` query parameter on GET matches the authenticated user's email (`req.userEmail`), to prevent an authenticated user from enumerating other users' KYC profile existence. + +--- + +### F-069: EUR Off-Ramp `fundEphemeral` Falls Through to Non-Existent Next Phase + +| Field | Value | +|---|---| +| **Severity** | 🟠 **High** | +| **Location** | `apps/api/src/api/services/phases/handlers/fund-ephemeral-handler.ts` (`nextPhaseSelector`, lines 230-250) | +| **Spec** | `03-ramp-engine/ramp-phase-flows.md`, `05-integrations/mykobo.md` | +| **Status** | ✅ **FIXED** (2026-05-22) | +| **Found** | Mykobo integration audit, 2026-05-22 | +| **Impact** | If a EUR off-ramp ever transitions through `fundEphemeral`, `nextPhaseSelector` returns `"moonbeamToPendulum"` — a phase that has no role in the Base-only EUR off-ramp routing (`evm-to-mykobo.ts`). The phase processor would attempt to execute a handler with no presigned transaction registered for this corridor, putting the ramp into a stuck/failed state mid-flow. | +| **Resolution** | Explicit `SELL && outputCurrency === EURC → "distributeFees"` branch added to `nextPhaseSelector`. Additionally, while fixing the latent bug, also added the **active** missing branch `BUY && inputCurrency === EURC → "subsidizePreSwap"` to wire `fundEphemeral` into the Mykobo onramp flow (see the EUR onramp `fundEphemeral` companion fix below). | + +**Description:** `nextPhaseSelector` enumerates the SELL-direction branches: + +```typescript +if (state.type === RampDirection.SELL && state.from === Networks.AssetHub) { + return "distributeFees"; +} else if (state.type === RampDirection.SELL && isAlfredpayToken(quote.outputCurrency as FiatToken)) { + return "finalSettlementSubsidy"; +} else if (state.type === RampDirection.SELL && quote.outputCurrency === FiatToken.BRL) { + return "distributeFees"; +} else { + return "moonbeamToPendulum"; // Via contract.subsidizePreSwap +} +``` + +There is no branch for `outputCurrency === FiatToken.EURC`. The BRL off-ramp uses `distributeFees` as the next phase after `fundEphemeral`; EUR off-ramps need the same routing (the Mykobo Base off-ramp presigned-tx order in `evm-to-mykobo.ts` is `distributeFees(0) → nablaApprove(1) → nablaSwap(2) → mykoboPayoutOnBase(3) → cleanup(4-6)`), but instead they fall through to the `else` branch and target `moonbeamToPendulum`. + +**Why this isn't currently surfaced:** The active EUR off-ramp dispatch path (`initial-phase-handler.ts`) does not currently route EUR through `fundEphemeral`. The bug is latent. However, any future routing change, recovery flow, or replay that reaches `fundEphemeral` with `outputCurrency === FiatToken.EURC` will hit the stuck-phase scenario. The integration tests don't catch it because they only exercise `registerRamp`, not `startRamp` through this path. + +**Fix:** Add an explicit EURC branch mirroring the BRL behavior: + +```typescript +} else if (state.type === RampDirection.SELL && quote.outputCurrency === FiatToken.EURC) { + return "distributeFees"; +} +``` + +Also consider replacing the default `else → "moonbeamToPendulum"` with an unrecoverable error for unrecognized SELL combinations, so future corridor additions fail loudly instead of silently falling through. + +--- + +### F-070: `MYKOBO_BASE_URL` Accepts Any Scheme — No HTTPS Enforcement + +| Field | Value | +|---|---| +| **Severity** | 🟡 **Medium** | +| **Location** | `packages/shared/src/services/mykobo/mykoboApiService.ts` (constructor, lines 47-53) | +| **Spec** | `05-integrations/mykobo.md` (Invariant: HTTPS enforced for all Mykobo API calls) | +| **Status** | ✅ **FIXED** (2026-05-22) | +| **Found** | Mykobo integration audit, 2026-05-22 | +| **Impact** | A misconfigured `MYKOBO_BASE_URL` (e.g., `http://...` instead of `https://...`) will silently transmit bearer tokens, KYC document references, and IBAN payment instructions over cleartext. There is no startup or runtime check that rejects non-HTTPS base URLs. | +| **Resolution** | `assertSecureMykoboBaseUrl` helper added; called from constructor. Throws on any non-HTTPS scheme. Exception: when `NODE_ENV !== "production"`, `http://localhost` and `http://127.0.0.1` are permitted for local development. | + +**Description:** The `MykoboApiService` constructor performs only path-shape normalization on the base URL: + +```typescript +if (!MYKOBO_BASE_URL) { + throw new Error("MYKOBO_BASE_URL not defined"); +} +const trimmedBase = MYKOBO_BASE_URL.replace(/\/$/, ""); +this.baseUrl = /\/v\d+$/.test(trimmedBase) ? trimmedBase : `${trimmedBase}/v1`; +``` + +No `new URL(...).protocol === "https:"` check. An operator with shell access to env vars (or a misconfigured deployment) could set `MYKOBO_BASE_URL=http://mykobo.example` and the service would silently use cleartext for all `/auth/token`, `/auth/refresh`, intent creation, and payout polling calls. This contradicts the audit-results PASS for "HTTPS enforced" (currently marked PASS for Mykobo on the strength of constructor normalization alone, which does not in fact enforce HTTPS). + +**Fix:** Add an explicit scheme check at construction time: + +```typescript +const parsed = new URL(trimmedBase); +if (parsed.protocol !== "https:" && process.env.NODE_ENV === "production") { + throw new Error("MYKOBO_BASE_URL must use HTTPS in production"); +} +``` + +For local development, allow `http://localhost` via an explicit allowlist. Also document the requirement in `.env.example`. + +--- + +### F-071: Concurrent-401 Race in `MykoboApiService.handleAuthFailure` + +| Field | Value | +|---|---| +| **Severity** | 🔵 **Low** | +| **Location** | `packages/shared/src/services/mykobo/mykoboApiService.ts` (`handleAuthFailure`, lines 109-122; `getToken`, lines 96-107) | +| **Spec** | `05-integrations/mykobo.md` (Invariant 14: Bearer-token refresh debounced) | +| **Status** | ✅ **FIXED** (2026-05-22) | +| **Found** | Mykobo integration audit, 2026-05-22 | +| **Impact** | Under concurrent load, multiple in-flight requests that each receive HTTP 401 will each independently call `handleAuthFailure()`, causing concurrent `refresh` / `acquireToken` calls to Mykobo. This is a "thundering herd" mini-race: it does not corrupt state, but it can produce redundant token rotations, brief windows where `this.cachedToken` is overwritten by a stale value, and unnecessary Mykobo `/auth/refresh` traffic that can itself trip Mykobo-side rate limiting. | +| **Resolution** | `authFailurePromise` debounce added, mirroring the existing `tokenPromise` pattern in `getToken`. Concurrent 401s now share a single in-flight refresh/re-acquire; the actual logic moved to `doHandleAuthFailure`. | + +**Description:** The happy-path token acquisition in `getToken()` is correctly debounced via `this.tokenPromise`: + +```typescript +if (!this.tokenPromise) { + this.tokenPromise = this.acquireToken().finally(() => { + this.tokenPromise = undefined; + }); +} +this.cachedToken = await this.tokenPromise; +``` + +But the 401-recovery path in `handleAuthFailure()` has no equivalent guard: + +```typescript +private async handleAuthFailure(): Promise { + if (this.cachedToken) { + try { + const refreshed = await this.refreshAccessToken(this.cachedToken.refreshToken); + this.cachedToken = refreshed; + return refreshed.token; + } catch (error) { + logger.current.warn("Mykobo refresh failed; re-acquiring token", error); + } + } + const reAcquired = await this.acquireToken(); + this.cachedToken = reAcquired; + return reAcquired.token; +} +``` + +If two requests race and both receive 401, they both enter `handleAuthFailure()` and both fire `refreshAccessToken` (or `acquireToken`) concurrently. Each then independently assigns to `this.cachedToken`, so the second write clobbers the first. The first caller may receive a token that is immediately replaced. + +**Mitigating factor:** The Mykobo handlers run inside the phase processor, which is single-threaded per ramp; the practical concurrency surface today is small (e.g., poll loops overlapping with `getProfile` calls from the HTTP layer). But the spec invariant ("Bearer-token refresh debounced — no thundering-herd on 401") is currently held only on the cold-start path. + +**Fix:** Apply the same `tokenPromise` debounce pattern to `handleAuthFailure`: + +```typescript +private authFailurePromise: Promise | undefined; + +private async handleAuthFailure(): Promise { + if (!this.authFailurePromise) { + this.authFailurePromise = this.doHandleAuthFailure().finally(() => { + this.authFailurePromise = undefined; + }); + } + return this.authFailurePromise; +} +``` + +Move the existing body of `handleAuthFailure` into `doHandleAuthFailure`. + +--- + +### F-072: Ephemeral Account Freshness Not Validated at Ramp Registration + +| Field | Value | +|---|---| +| **Severity** | 🟡 **Medium** | +| **Location** | `apps/api/src/api/services/ramp/ramp.service.ts` (`registerRamp` → `normalizeAndValidateSigningAccounts`, lines 141-216) | +| **Spec** | `02-signing-keys/ephemeral-accounts.md`, `03-ramp-engine/transaction-validation.md` | +| **Status** | ✅ **FIXED** | +| **Found** | Fresh audit pass, ephemeral lifecycle review | +| **Impact** | An API client could submit an ephemeral address that has already been used on one or more route-relevant chains (non-zero nonce, existing balance, or pre-existing Stellar account). The backend would build presigned transactions assuming nonce 0 / fresh account; mid-ramp execution would then halt with nonce mismatches, "account already exists" errors, or unexpected leftover balances, leaving subsidies/funding spent and ramps stuck. | + +**Description:** `normalizeAndValidateSigningAccounts` only validated the *format* of each provided ephemeral address (StrKey, SS58, EVM `isAddress`). It did not verify that the addresses were actually fresh on the chains the ramp would touch. Because the SDK generates ephemerals client-side and the API trusts whatever address is submitted, a buggy or malicious client could replay an old ephemeral address. Stellar is especially sensitive: the server's first action is to *create* the Stellar account on-chain with a 2-of-2 multisig and starting balance — if the account already exists, that creation operation fails and the ramp cannot proceed. + +**Fix:** Added `validateEphemeralAccountsFresh()` (`apps/api/src/api/services/ramp/ephemeral-freshness.ts`), invoked in `registerRamp` immediately after `normalizeAndValidateSigningAccounts`. The validator: + +1. **Checks every supported chain of each submitted ephemeral type unconditionally** — rather than deriving a route-relevant subset from the quote. Supported sets: Substrate = `[pendulum, hydration, assethub]`; EVM = all configured EVM networks including Moonbeam (`SUPPORTED_EVM_NETWORKS`); Stellar = single Horizon check. This is intentionally wider than strictly required so that a future phase-handler addition cannot silently reopen the freshness gap by routing through a chain not covered by a route-derived mapping. +2. **Substrate**: queries `system.account(address)` on each supported chain; requires `nonce === 0` AND `free === 0`. +3. **EVM**: queries `getTransactionCount(address)` on each supported chain; requires `nonce === 0`. +4. **Stellar**: calls `loadAccountWithRetry(address)` against Horizon; requires the account to **not exist** (the server creates and funds it during the ramp). +5. **Fail-closed**: any RPC error rejects the registration with `SERVICE_UNAVAILABLE` rather than allowing freshness to be presumed. +6. Scope: `registerRamp` only. `updateRamp` does not re-check, since the ephemeral identity is bound to ramp state at registration time. + +If the platform adds a new chain an ephemeral can ever sign on, `SUPPORTED_SUBSTRATE_NETWORKS` / `SUPPORTED_EVM_NETWORKS` MUST be updated, otherwise the freshness check leaves that chain unverified. + +--- + ## Additional Observations (Not Findings) These are design observations noted during spec writing that may warrant review but aren't direct vulnerabilities: diff --git a/docs/security-spec/PUBLIC-RELEASE-READINESS.md b/docs/security-spec/PUBLIC-RELEASE-READINESS.md index 24bd27977..296c65ed1 100644 --- a/docs/security-spec/PUBLIC-RELEASE-READINESS.md +++ b/docs/security-spec/PUBLIC-RELEASE-READINESS.md @@ -94,8 +94,10 @@ Fifteen environment variables are read by `apps/api/src` but not documented in ` ``` EVM_FUNDING_PRIVATE_KEY -MONERIUM_CLIENT_ID_APP -MONERIUM_CLIENT_SECRET +MYKOBO_ACCESS_KEY +MYKOBO_SECRET_KEY +MYKOBO_BASE_URL +MYKOBO_CLIENT_DOMAIN ALCHEMY_API_KEY SLACK_USER_ID SLACK_WEB_HOOK_TOKEN diff --git a/docs/security-spec/README.md b/docs/security-spec/README.md index 43457f6b8..4a8ff3d14 100644 --- a/docs/security-spec/README.md +++ b/docs/security-spec/README.md @@ -28,22 +28,25 @@ This directory contains the security specification for the Vortex cross-border p | Quote Lifecycle | `03-ramp-engine/quote-lifecycle.md` | Creation, expiry, binding to ramp | | Fee Integrity | `03-ramp-engine/fee-integrity.md` | Fee calculation, dual-system discrepancy | | Discount Mechanism | `03-ramp-engine/discount-mechanism.md` | Partner discounts, subsidies, dynamic adjustment | +| Profile Partner Pricing | `03-ramp-engine/profile-partner-pricing.md` | Supabase profile assignments to ramp-specific partner pricing IDs | | Transaction Validation | `03-ramp-engine/transaction-validation.md` | Presigned tx verification, content validation, signing model | | Ephemeral Account Lifecycle | `03-ramp-engine/ephemeral-accounts.md` | Funding, cleanup, stuck fund prevention | | Ramp Phase Flows | `03-ramp-engine/ramp-phase-flows.md` | Per-corridor token flow, phase handler map, subsidy bounds | | Token Relayer | `04-smart-contracts/token-relayer.md` | EIP-712, permit, known findings | | Integration Template | `05-integrations/_template.md` | Template for new provider specs | | BRLA | `05-integrations/brla.md` | BRLA anchor for BRL on/off-ramp | -| Monerium | `05-integrations/monerium.md` | Monerium EUR on-ramp | +| Mykobo | `05-integrations/mykobo.md` | Mykobo EUR on/off-ramp on Base (active EUR rail) | +| Monerium | `05-integrations/monerium.md` | (Deprecated) Monerium EUR on-ramp — replaced by Mykobo | | Alfredpay | `05-integrations/alfredpay.md` | Alfredpay on/off-ramp | -| Stellar Anchors | `05-integrations/stellar-anchors.md` | SEP-24, Spacewalk, Stellar payment | +| Stellar Anchors | `05-integrations/stellar-anchors.md` | SEP-24, Spacewalk, Stellar payment (fully deprecated; EUR migrated to Mykobo, ARS removed) | | Squid Router | `05-integrations/squid-router.md` | Cross-chain EVM routing | | XCM Transfers | `06-cross-chain/xcm-transfers.md` | Pendulum↔Moonbeam↔AssetHub↔Hydration | | Bridge Security | `06-cross-chain/bridge-security.md` | Spacewalk bridge trust model | | Fund Routing | `06-cross-chain/fund-routing.md` | Subsidization, fee distribution, amount integrity | -| Rebalancer | `07-operations/rebalancer.md` | Automated liquidity management | +| Rebalancer | `07-operations/rebalancer.md` | Automated liquidity management — BRLA↔axlUSDC (legacy, Pendulum), cost/profit-aware USDC→BRLA→USDC (Base high-coverage), and cost/profit-aware BRLA→USDC correction (Base low-coverage) | | Secret Management | `07-operations/secret-management.md` | Env vars, rotation, blast radius | | API Surface | `07-operations/api-surface.md` | Rate limiting, CORS, input validation, error handling | +| Client Observability | `07-operations/client-observability.md` | Request IDs, sanitized API client events, operational monitoring | ## Per-File Format @@ -65,10 +68,16 @@ Every spec file uses exactly four sections: | **Spacewalk** | Bridge between Pendulum and Stellar | | **XCM** | Cross-Consensus Messaging — the cross-chain transfer protocol between Polkadot parachains | | **BRLA** | Brazilian Real stablecoin anchor (BRL on/off-ramp) | -| **Monerium** | EUR stablecoin issuer (EUR on-ramp via SEPA) | +| **Mykobo** | EUR fiat anchor for SEPA on/off-ramp on Base (settles EURC on Base) | +| **Monerium** | (Deprecated) EUR stablecoin issuer; previously used for EUR on-ramp via SEPA. Replaced by Mykobo. | | **Alfredpay** | Fiat payment provider supporting multiple currencies | | **Squid Router** | Cross-chain swap/routing protocol for EVM chains | +| **Axelar** | Cross-chain messaging protocol used by SquidRouter for EVM-to-EVM bridging | +| **Avenia** | BRLA's internal settlement platform; handles BRLA transfers, swaps, and PIX payouts | | **Subsidization** | When the platform tops up an ephemeral account to ensure the user receives the quoted amount | | **pk\_/sk\_** | Public key / Secret key prefixes for the dual API key system | | **PIX** | Brazilian instant payment system | | **SEPA** | Single Euro Payments Area — European bank transfer system | +| **Coverage ratio** | Reserve ÷ liabilities for a Nabla swap pool; ratio > 1 means the pool is over-collateralized and triggers rebalancing | +| **Request ID** | Non-secret correlation identifier generated or propagated by the API for log/event debugging | +| **Client event** | Sanitized operational record of a partner-facing API request outcome | diff --git a/docs/security-spec/SPEC-DELTA-2026-05.md b/docs/security-spec/SPEC-DELTA-2026-05.md index d8dcdfcbe..192da7631 100644 --- a/docs/security-spec/SPEC-DELTA-2026-05.md +++ b/docs/security-spec/SPEC-DELTA-2026-05.md @@ -169,7 +169,7 @@ These are findings **the user has confirmed direction on** during the spec rewri **Issue:** The BRL on-ramp runtime phase chain transitioned `fundEphemeral → nablaApprove` directly, skipping `subsidizePreSwap`. The handler was registered and wired downstream (`subsidizePreSwap → nablaApprove`), but no upstream handler returned `"subsidizePreSwap"` as its next phase for BRL onramps. The symmetric `subsidizePostSwap` phase was reached normally via `nablaSwap`'s nextPhase logic, producing an asymmetric flow where pre-swap subsidization was unreachable. -**Risk:** If the Avenia BRLA mint underdelivers (e.g. anchor fee not pre-deducted, transient rounding, or mint amount slightly below `inputAmountForSwapRaw`), the on-ramp would fail at `nablaSwap` with insufficient input balance instead of being topped up by the funding key (capped at 5% of `outputAmount` via `MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION`). User funds remained on the Base ephemeral until manual recovery. +**Risk:** If the Avenia BRLA mint underdelivers (e.g. anchor fee not pre-deducted, transient rounding, or mint amount slightly below `inputAmountForSwapRaw`), the on-ramp would fail at `nablaSwap` with insufficient input balance instead of being topped up by the funding key (capped by the configured EVM subsidy fraction for that handler; default `0.05`). User funds remained on the Base ephemeral until manual recovery. **Resolution:** Changed the BRL onramp branch of `FundEphemeralHandler.nextPhaseSelector` to return `"subsidizePreSwap"`. The phase chain is now `fundEphemeral → subsidizePreSwap → nablaApprove → nablaSwap → ...`, symmetric with the BRL off-ramp pre-swap subsidization path. @@ -266,7 +266,7 @@ Priority order for the next audit/dev cycle, based on severity × likelihood. Re | # | Finding | Status | |---|---|---| -| 1 | **F-NEW-02** (HIGH if cap matters in practice) — Add EVM subsidy USD cap. Mirror F-001 fix. | RESOLVED — `MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION="0.05"` enforced in pre/post-swap EVM handlers; over-cap cases are recoverable waits with no transfer submitted. | +| 1 | **F-NEW-02** (HIGH if cap matters in practice) — Add EVM subsidy USD cap. Mirror F-001 fix. | RESOLVED — env-configured EVM subsidy cap fractions are enforced in the pre/post-swap EVM handlers. `MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION` defaults to `0.05`; post-swap discount-derived subsidy is capped separately via `MAX_EVM_POST_SWAP_DISCOUNT_SUBSIDY_QUOTE_FRACTION`, also defaulting to `0.05`. Over-cap cases are recoverable waits with no transfer submitted. | | 2 | **F-NEW-01** (HIGH) — Replace hardcoded `validateBRLOfframp` amount. | RESOLVED — `validateBRLOfframpMetadata(quote)` reads `quote.metadata.pendulumToMoonbeamXcm.outputAmountRaw`. Dead `evm-to-brl.ts` route deleted. | | 3 | **F-NEW-06b** (MEDIUM) — Surface or fail-fast on partner `payout_address_evm` NULL (silent markup loss). | RESOLVED — quote-time rejection (`APIError 400`) when partner has markup AND `payout_address_evm` NULL on EVM-payout routes; runtime WARN if it slips through. | | 4 | **F-NEW-04** (MEDIUM) — Harden no-permit fallback receipt validation. | RESOLVED — `waitForUserHash` now verifies receipt `to` and tx `input` against the presigned `EvmTransactionData`. | @@ -276,7 +276,7 @@ Priority order for the next audit/dev cycle, based on severity × likelihood. Re | 8 | **F-NEW-03** (LOW) — Tighten `backupApprove` allowance from `maxUint256` to a calculated bound. | RESOLVED — `avenia-to-evm-base.ts` `backupApprove` now uses `inputAmountRawFinalBridge × 1.05`. | | 9 | **F-NEW-08** — Investigate skip-Squid passthrough divergence. | NO BUG — same-chain same-token passthrough has no Squid fee; `networkFeeUSD="0"` and 1:1 rate are correct. | | 10 | **F-NEW-09** — Investigate BRLA payout recovery branches. | NO BUG — once `payOutTicketId` exists, BRLA acknowledged the EVM payout; on-chain receipt is no longer authoritative. | -| 11 | **F-NEW-10** — Avenia anchor-fee assumption in three-amount model. | NO BUG — `OffRampMergeSubsidyEvmEngine` adds the projected subsidy into `nablaSwapEvm.outputAmountRaw`, and `OffRampFinalizeEngine` then sets `quote.outputAmount = nablaSwapEvm.outputAmountDecimal − anchorFee`. The relationship `nablaSwapEvm.outputAmountRaw ≥ quote.outputAmount × 10^brlaDecimals` is therefore tautological at quote-build time. The actual safety net is the EVM branch of `subsidize-post-swap-handler.ts`, which tops the ephemeral up to `nablaSwapEvm.outputAmountRaw` at runtime (capped by F-NEW-02's 5% USD subsidy bound). No build-time assertion needed. | +| 11 | **F-NEW-10** — Avenia anchor-fee assumption in three-amount model. | NO BUG — `OffRampMergeSubsidyEvmEngine` adds the projected subsidy into `nablaSwapEvm.outputAmountRaw`, and `OffRampFinalizeEngine` then sets `quote.outputAmount = nablaSwapEvm.outputAmountDecimal − anchorFee`. The relationship `nablaSwapEvm.outputAmountRaw ≥ quote.outputAmount × 10^brlaDecimals` is therefore tautological at quote-build time. The actual safety net is the EVM branch of `subsidize-post-swap-handler.ts`, which tops the ephemeral up to `nablaSwapEvm.outputAmountRaw` at runtime using env-configured split caps for swap discrepancy and discount subsidy. No build-time assertion needed. | | 12 | **F-NEW-05** — Add Base ephemeral cleanup. | RESOLVED — `BaseChainPostProcessHandler` sweeps BRLA and USDC residuals after `currentPhase === "complete"` via presigned `approve` + funding-key `transferFrom`. Wired into both `evm-to-brl-base.ts` (offramp) and `avenia-to-evm-base.ts` (onramp). New phase keys `baseCleanupBrla` and `baseCleanupUsdc`. ETH gas dust on EVM ephemerals remains unswept (intentional). | | 13 | **F-013** — Multiple security-sensitive endpoints have no authentication. | RESOLVED — dual-track auth wired across all `/v1/ramp/*` and `/v1/ramp/quotes(/best)` endpoints. Each request carrying credentials must present **either** `X-API-Key: sk_*` (partner SDK) **or** `Authorization: Bearer ` (Supabase frontend); invalid credentials are always rejected. Per-principal ownership guards (`assertRampOwnership`, `assertQuoteOwnership`) prevent cross-tenant access: partners are scoped via `RampState.quoteId → QuoteTicket.partnerId`, Supabase users via `RampState.userId`. Anonymous access is permitted only on register/update/start/status/errors and only when the underlying resource is fully anonymous (no partner, no user owner); `getRampHistory` always requires credentials. `enforcePartnerAuth()` is active on `/quotes` and `/quotes/best`, closing the partner-spoofing vector. | diff --git a/package.json b/package.json index 542b0c67e..31e58c5a7 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "@polkadot/types-known": "^16.4.6", "@polkadot/util": "^13.5.6", "@polkadot/util-crypto": "^13.5.6", - "@scure/bip39": "2.0.1", + "@scure/bip39": "^2.2.0", "@storybook/react": "^9.1.16", "@supabase/supabase-js": "^2.80.0", "@types/big.js": "^6.0.2", @@ -46,8 +46,7 @@ "dependencies": { "big.js": "^7.0.1", "husky": "^9.1.7", - "lint-staged": "^16.1.0", - "numora-react": "^3.0.3" + "lint-staged": "^16.1.0" }, "devDependencies": { "@biomejs/biome": "2.0.0", @@ -85,6 +84,7 @@ "@polkadot/types-known": "^16.4.6", "@polkadot/util": "^13.5.6", "@polkadot/util-crypto": "^13.5.6", + "@wagmi/connectors": "6.2.0", "adm-zip": "0.5.2", "axios": "^1.15.0", "big.js": "^7.0.1", @@ -107,7 +107,7 @@ "build:sdk": "bun run --cwd packages/sdk build", "build:shared": "bun run --cwd packages/shared build", "compile:contracts:relayer": "bun run --cwd contracts/relayer compile", - "dev": "concurrently -n 'shared,backend,frontend' -c '#ffa500,#007755,#2f6da3' 'cd packages/shared && bun run dev' 'cd apps/api && bun dev' 'cd apps/frontend && bun dev'", + "dev": "bun run --cwd packages/shared dev & bun run --cwd apps/api dev & bun run --cwd apps/frontend dev & wait", "dev:backend": "bun run --cwd apps/api dev", "dev:contracts:relayer": "bun run --cwd contracts/relayer node", "dev:frontend": "bun run --cwd apps/frontend dev", diff --git a/packages/sdk/README.md b/packages/sdk/README.md index cf37ffe4e..343f9cd22 100644 --- a/packages/sdk/README.md +++ b/packages/sdk/README.md @@ -70,8 +70,8 @@ const quote = await sdk.createQuote({ const { rampProcess } = await sdk.registerRamp(quote, { destinationAddress: "0x1234567890123456789012345678901234567890", - fiatAccountId: "", walletAddress: "0x1234567890123456789012345678901234567890" + // fiatAccountId is optional for onramp — the backend only requires destinationAddress. }); // Inspect off-chain fiat payment instructions before starting. @@ -107,7 +107,7 @@ const updated = await sdk.updateRamp(quote, rampProcess.id, { const startedRamp = await sdk.startRamp(updated.id); ``` -> `fiatAccountId` is opaque to the SDK. Consumers create or look up the user's Alfredpay fiat account out-of-band (via the Vortex backend) and pass the ID in. +> `fiatAccountId` is opaque to the SDK. It is required for offramp and optional for onramp. Consumers create or look up the user's Alfredpay fiat account out-of-band (via the Vortex backend) and pass the ID in. ## Core Features - **Ephemerals abstracted**: No need to keep track of the ephemeral accounts used in the ramp process. If `storeEphemeralKeys` is enabled, keys are stored in a JSON file in Node.js. @@ -143,6 +143,31 @@ Submits route-specific transaction hashes after off-chain steps complete. Used f ##### `startRamp(rampId: string): Promise` Starts a registered ramp process. +## Error Handling + +### Ephemeral Account Freshness + +`registerRamp` will throw `EphemeralNotFreshError` if the SDK-generated ephemeral address already has on-chain history (non-zero nonce or balance on Substrate/EVM, or a pre-existing account on Stellar) on any chain the ramp route uses. This should not happen during normal operation because the SDK generates fresh keypairs on every call, but it can occur on environments where ephemeral storage is reused across processes or if the same keys are imported elsewhere. + +`EphemeralFreshnessCheckError` (HTTP 503) is thrown when the backend cannot reach an RPC endpoint to verify freshness. This is a transient failure. + +Both errors are recoverable by simply re-invoking `registerRamp` — the SDK generates new ephemerals on every call: + +```typescript +import { EphemeralNotFreshError, EphemeralFreshnessCheckError } from "@vortexfi/sdk"; + +try { + const { rampProcess } = await sdk.registerRamp(quote, additionalData); +} catch (err) { + if (err instanceof EphemeralNotFreshError || err instanceof EphemeralFreshnessCheckError) { + // The SDK regenerates ephemerals on every call - retry once. + const { rampProcess } = await sdk.registerRamp(quote, additionalData); + } else { + throw err; + } +} +``` + ## Configuration ```typescript diff --git a/packages/sdk/src/VortexSdk.ts b/packages/sdk/src/VortexSdk.ts index 4d5a08ad9..04dc8a865 100644 --- a/packages/sdk/src/VortexSdk.ts +++ b/packages/sdk/src/VortexSdk.ts @@ -3,10 +3,15 @@ import { CreateQuoteRequest, createMoonbeamEphemeral, createPendulumEphemeral, - createStellarEphemeral, EphemeralAccount, EphemeralAccountType, + GetRampStatusResponse, isAlfredpayToken, + isEvmTransactionData, + isSignedTypedData, + isSignedTypedDataArray, + Networks, + PresignedTx, QuoteResponse, RampDirection, RampProcess, @@ -74,7 +79,7 @@ export class VortexSdk { return this.apiService.getQuote(quoteId); } - async getRampStatus(rampId: string): Promise { + async getRampStatus(rampId: string): Promise { return this.apiService.getRampStatus(rampId); } @@ -203,16 +208,9 @@ export class VortexSdk { const ephemerals: { [key in EphemeralAccountType]?: EphemeralAccount } = {}; const accountMetas: AccountMeta[] = []; - const stellarEphemeral = createStellarEphemeral(); const substrateEphemeral = await createPendulumEphemeral(); const evmEphemeral = createMoonbeamEphemeral(); - accountMetas.push({ - address: stellarEphemeral.address, - type: EphemeralAccountType.Stellar - }); - ephemerals[EphemeralAccountType.Stellar] = stellarEphemeral; - accountMetas.push({ address: substrateEphemeral.address, type: EphemeralAccountType.Substrate @@ -231,20 +229,27 @@ export class VortexSdk { private async signTransactions( unsignedTxs: UnsignedTx[], ephemerals: { - stellarEphemeral?: EphemeralAccount; substrateEphemeral?: EphemeralAccount; evmEphemeral?: EphemeralAccount; } - ): Promise { + ): Promise { await this.ensureInitialized(); try { const signedTxs = await signUnsignedTransactions( unsignedTxs, ephemerals, - this.networkManager.getPendulumApi() as any, // TODO fix typing - this.networkManager.getMoonbeamApi() as any, - this.networkManager.getHydrationApi() as any, + unsignedTxs.some(tx => tx.network === Networks.Pendulum) ? await this.networkManager.getPendulumApi() : undefined, + unsignedTxs.some( + tx => + tx.network === Networks.Moonbeam && + !isEvmTransactionData(tx.txData) && + !isSignedTypedData(tx.txData) && + !isSignedTypedDataArray(tx.txData) + ) + ? await this.networkManager.getMoonbeamApi() + : undefined, + unsignedTxs.some(tx => tx.network === Networks.Hydration) ? await this.networkManager.getHydrationApi() : undefined, this.networkManager.getAlchemyApiKey() ); diff --git a/packages/sdk/src/errors.ts b/packages/sdk/src/errors.ts index 0e6bfd525..f5ab44427 100644 --- a/packages/sdk/src/errors.ts +++ b/packages/sdk/src/errors.ts @@ -65,6 +65,32 @@ export class InvalidAdditionalDataError extends RegisterRampError { } } +export type EphemeralChain = "Substrate" | "EVM" | "Stellar"; + +export class EphemeralNotFreshError extends RegisterRampError { + public readonly chain: EphemeralChain; + public readonly ephemeralAddress: string; + + constructor(message: string, chain: EphemeralChain, ephemeralAddress: string, status = 400) { + super(message, status); + this.name = "EphemeralNotFreshError"; + this.chain = chain; + this.ephemeralAddress = ephemeralAddress; + } +} + +export class EphemeralFreshnessCheckError extends RegisterRampError { + public readonly chain: EphemeralChain; + public readonly ephemeralAddress: string; + + constructor(message: string, chain: EphemeralChain, ephemeralAddress: string) { + super(message, 503); + this.name = "EphemeralFreshnessCheckError"; + this.chain = chain; + this.ephemeralAddress = ephemeralAddress; + } +} + // BRL Onramp specific errors export class BrlOnrampError extends RegisterRampError { constructor(message: string, status = 400) { @@ -147,7 +173,7 @@ export class AlfredpayOnrampError extends RegisterRampError { export class MissingAlfredpayOnrampParametersError extends AlfredpayOnrampError { constructor() { - super("Parameters destinationAddress and fiatAccountId are required for Alfredpay onramp", 400); + super("Parameter destinationAddress is required for Alfredpay onramp", 400); this.name = "MissingAlfredpayOnrampParametersError"; } } @@ -368,6 +394,19 @@ export function parseAPIError(response: any): VortexSdkError { const network = errorMessage.match(/"([^"]+)"/)?.[1] || "unknown"; return new InvalidNetworkError(network); } + + const freshnessMatch = errorMessage.match(/^(Substrate|EVM|Stellar) ephemeral (\S+) (?:is not fresh|already exists)/); + if (freshnessMatch) { + return new EphemeralNotFreshError(errorMessage, freshnessMatch[1] as EphemeralChain, freshnessMatch[2]); + } + const freshnessCheckMatch = errorMessage.match(/^Could not verify freshness of (Substrate|EVM|Stellar) ephemeral (\S+)/); + if (freshnessCheckMatch) { + return new EphemeralFreshnessCheckError(errorMessage, freshnessCheckMatch[1] as EphemeralChain, freshnessCheckMatch[2]); + } + const missingEphemeralMatch = errorMessage.match(/^(Substrate|EVM|Stellar) ephemeral address is required/); + if (missingEphemeralMatch) { + return new EphemeralNotFreshError(errorMessage, missingEphemeralMatch[1] as EphemeralChain, ""); + } if (errorMessage === "Parameters destinationAddress and taxId are required for onramp") { return new MissingBrlParametersError(); } diff --git a/packages/sdk/src/handlers/AlfredpayHandler.ts b/packages/sdk/src/handlers/AlfredpayHandler.ts index 1febfb44c..df31d19e6 100644 --- a/packages/sdk/src/handlers/AlfredpayHandler.ts +++ b/packages/sdk/src/handlers/AlfredpayHandler.ts @@ -27,7 +27,6 @@ export class AlfredpayHandler implements RampHandler { private signTransactions: ( unsignedTxs: UnsignedTx[], ephemerals: { - stellarEphemeral?: EphemeralAccount; substrateEphemeral?: EphemeralAccount; evmEphemeral?: EphemeralAccount; } @@ -43,7 +42,6 @@ export class AlfredpayHandler implements RampHandler { signTransactions: ( unsignedTxs: UnsignedTx[], ephemerals: { - stellarEphemeral?: EphemeralAccount; substrateEphemeral?: EphemeralAccount; evmEphemeral?: EphemeralAccount; } @@ -56,7 +54,7 @@ export class AlfredpayHandler implements RampHandler { } async registerAlfredpayOnramp(quoteId: string, additionalData: AlfredpayOnrampAdditionalData): Promise { - if (!additionalData.destinationAddress || !additionalData.fiatAccountId) { + if (!additionalData.destinationAddress) { throw new MissingAlfredpayOnrampParametersError(); } @@ -79,7 +77,6 @@ export class AlfredpayHandler implements RampHandler { const signedTxs = await this.signTransactions(rampProcess.unsignedTxs || [], { evmEphemeral: ephemerals.EVM, - stellarEphemeral: ephemerals.Stellar, substrateEphemeral: ephemerals.Substrate }); @@ -115,7 +112,6 @@ export class AlfredpayHandler implements RampHandler { const signedTxs = await this.signTransactions(rampProcess.unsignedTxs || [], { evmEphemeral: ephemerals.EVM, - stellarEphemeral: ephemerals.Stellar, substrateEphemeral: ephemerals.Substrate }); diff --git a/packages/sdk/src/handlers/BrlHandler.ts b/packages/sdk/src/handlers/BrlHandler.ts index 87ac6f397..981a1d8b9 100644 --- a/packages/sdk/src/handlers/BrlHandler.ts +++ b/packages/sdk/src/handlers/BrlHandler.ts @@ -28,7 +28,6 @@ export class BrlHandler implements RampHandler { private signTransactions: ( unsignedTxs: UnsignedTx[], ephemerals: { - stellarEphemeral?: EphemeralAccount; substrateEphemeral?: EphemeralAccount; evmEphemeral?: EphemeralAccount; } @@ -44,7 +43,6 @@ export class BrlHandler implements RampHandler { signTransactions: ( unsignedTxs: UnsignedTx[], ephemerals: { - stellarEphemeral?: EphemeralAccount; substrateEphemeral?: EphemeralAccount; evmEphemeral?: EphemeralAccount; } @@ -81,7 +79,6 @@ export class BrlHandler implements RampHandler { const signedTxs = await this.signTransactions(rampProcess.unsignedTxs || [], { evmEphemeral: ephemerals.EVM, - stellarEphemeral: ephemerals.Stellar, substrateEphemeral: ephemerals.Substrate }); @@ -124,7 +121,6 @@ export class BrlHandler implements RampHandler { const signedTxs = await this.signTransactions(rampProcess.unsignedTxs || [], { evmEphemeral: ephemerals.EVM, - stellarEphemeral: ephemerals.Stellar, substrateEphemeral: ephemerals.Substrate }); diff --git a/packages/sdk/src/services/ApiService.ts b/packages/sdk/src/services/ApiService.ts index 52e374741..49d2ac5fc 100644 --- a/packages/sdk/src/services/ApiService.ts +++ b/packages/sdk/src/services/ApiService.ts @@ -1,8 +1,8 @@ import type { CreateQuoteRequest, + GetRampStatusResponse, QuoteResponse, RampDirection, - RampProcess, RegisterRampRequest, RegisterRampResponse, StartRampRequest, @@ -77,14 +77,14 @@ export class ApiService { return handleAPIResponse(response, "/v1/ramp/start"); } - async getRampStatus(rampId: string): Promise { + async getRampStatus(rampId: string): Promise { const url = new URL(`${this.apiBaseUrl}/v1/ramp/${rampId}`); const response = await fetch(url.toString(), { headers: this.buildHeaders(), method: "GET" }); - return handleAPIResponse(response, `/v1/ramp/status?id=${rampId}`); + return handleAPIResponse(response, `/v1/ramp/status?id=${rampId}`); } async getBrlKycStatus(taxId: string): Promise { diff --git a/packages/sdk/src/services/NetworkManager.ts b/packages/sdk/src/services/NetworkManager.ts index f28e0bbb8..09dd56efc 100644 --- a/packages/sdk/src/services/NetworkManager.ts +++ b/packages/sdk/src/services/NetworkManager.ts @@ -1,6 +1,5 @@ import { ApiPromise, WsProvider } from "@polkadot/api"; import { Networks } from "@vortexfi/shared"; -import { APINotInitializedError } from "../errors"; import type { NetworkConfig, VortexSdkConfig } from "../types"; const DEFAULT_NETWORKS: NetworkConfig[] = [ @@ -18,7 +17,7 @@ const DEFAULT_NETWORKS: NetworkConfig[] = [ }, { name: "hydration", - wsUrl: "wss://rpc.hydradx.cloud" + wsUrl: "wss://hydration.ibp.network" } ]; @@ -26,62 +25,97 @@ export class NetworkManager { private pendulumApi?: ApiPromise; private moonbeamApi?: ApiPromise; private hydrationApi?: ApiPromise; - private initializationPromise: Promise; + private pendulumApiPromise?: Promise; + private moonbeamApiPromise?: Promise; + private hydrationApiPromise?: Promise; - constructor(private readonly config: VortexSdkConfig) { - this.initializationPromise = this.initializeApis(); - } + constructor(private readonly config: VortexSdkConfig) {} async waitForInitialization(): Promise { - await this.initializationPromise; + return; } - getPendulumApi(): ApiPromise { - if (!this.pendulumApi) { - throw new APINotInitializedError("Pendulum"); + async getPendulumApi(): Promise { + if (this.pendulumApi) { + return this.pendulumApi; + } + + if (!this.pendulumApiPromise) { + this.pendulumApiPromise = this.initializeApi(Networks.Pendulum) + .then(api => { + this.pendulumApi = api; + return api; + }) + .catch(error => { + this.pendulumApiPromise = undefined; + throw error; + }); } - return this.pendulumApi; + + return this.pendulumApiPromise; } - getMoonbeamApi(): ApiPromise { - if (!this.moonbeamApi) { - throw new APINotInitializedError("Moonbeam"); + async getMoonbeamApi(): Promise { + if (this.moonbeamApi) { + return this.moonbeamApi; } - return this.moonbeamApi; + + if (!this.moonbeamApiPromise) { + this.moonbeamApiPromise = this.initializeApi(Networks.Moonbeam) + .then(api => { + this.moonbeamApi = api; + return api; + }) + .catch(error => { + this.moonbeamApiPromise = undefined; + throw error; + }); + } + + return this.moonbeamApiPromise; } - getHydrationApi(): ApiPromise { - if (!this.hydrationApi) { - throw new APINotInitializedError("Moonbeam"); + async getHydrationApi(): Promise { + if (this.hydrationApi) { + return this.hydrationApi; } - return this.hydrationApi; + if (!this.hydrationApiPromise) { + this.hydrationApiPromise = this.initializeApi(Networks.Hydration) + .then(api => { + this.hydrationApi = api; + return api; + }) + .catch(error => { + this.hydrationApiPromise = undefined; + throw error; + }); + } + + return this.hydrationApiPromise; } getAlchemyApiKey(): string | undefined { return "9nk8Nf7Eaz_4smCzIcPUk"; } - private async initializeApis(): Promise { - const _autoReconnect = this.config.autoReconnect ?? true; - - const pendulumWsUrl = this.config.pendulumWsUrl || DEFAULT_NETWORKS.find(n => n.name === Networks.Pendulum)?.wsUrl; - const moonbeamWsUrl = this.config.moonbeamWsUrl || DEFAULT_NETWORKS.find(n => n.name === Networks.Moonbeam)?.wsUrl; - const hydrationWsUrl = this.config.hydrationWsUrl || DEFAULT_NETWORKS.find(n => n.name === Networks.Hydration)?.wsUrl; - - if (!pendulumWsUrl || !moonbeamWsUrl || !hydrationWsUrl) { - throw new Error("Pendulum, Moonbeam and Hydration WebSocket URLs must be provided or configured."); + private async initializeApi(network: Networks.Pendulum | Networks.Moonbeam | Networks.Hydration): Promise { + const wsUrl = this.getWsUrl(network); + if (!wsUrl) { + throw new Error(`${network} WebSocket URL must be provided or configured.`); } - const pendulumProvider = new WsProvider(pendulumWsUrl, 2_500, {}, 60_000, 102400, 10 * 60_000); - this.pendulumApi = await ApiPromise.create({ provider: pendulumProvider }); - - const moonbeamProvider = new WsProvider(moonbeamWsUrl, 2_500, {}, 60_000, 102400, 10 * 60_000); - this.moonbeamApi = await ApiPromise.create({ provider: moonbeamProvider }); - - const hydrationProvider = new WsProvider(hydrationWsUrl, 2_500, {}, 60_000, 102400, 10 * 60_000); - this.hydrationApi = await ApiPromise.create({ provider: hydrationProvider }); + const provider = new WsProvider(wsUrl, 2_500, {}, 60_000, 102400, 10 * 60_000); + const api = await ApiPromise.create({ provider }); + await api.isReady; + return api; + } - await Promise.all([this.pendulumApi.isReady, this.moonbeamApi.isReady, this.hydrationApi.isReady]); + private getWsUrl(network: Networks.Pendulum | Networks.Moonbeam | Networks.Hydration): string | undefined { + if (network === Networks.Pendulum) + return this.config.pendulumWsUrl || DEFAULT_NETWORKS.find(n => n.name === network)?.wsUrl; + if (network === Networks.Moonbeam) + return this.config.moonbeamWsUrl || DEFAULT_NETWORKS.find(n => n.name === network)?.wsUrl; + return this.config.hydrationWsUrl || DEFAULT_NETWORKS.find(n => n.name === network)?.wsUrl; } } diff --git a/packages/sdk/src/types.ts b/packages/sdk/src/types.ts index 7a76b5682..1b261b33d 100644 --- a/packages/sdk/src/types.ts +++ b/packages/sdk/src/types.ts @@ -34,7 +34,7 @@ export type AnyQuote = | EurOfframpQuote | AlfredpayOfframpQuote; -export type AlfredpayCurrency = FiatToken.USD | FiatToken.MXN | FiatToken.COP; +export type AlfredpayCurrency = FiatToken.USD | FiatToken.MXN | FiatToken.COP | FiatToken.ARS; export type BrlOnrampQuote = QuoteResponse & { rampType: RampDirection.BUY; @@ -66,18 +66,22 @@ export type AlfredpayOfframpQuote = QuoteResponse & { outputCurrency: AlfredpayCurrency; }; -export type ExtendedQuoteResponse = T extends { rampType: RampDirection.BUY; from: "pix" } - ? BrlOnrampQuote - : T extends { rampType: RampDirection.BUY; from: "sepa" } - ? EurOnrampQuote - : T extends { rampType: RampDirection.BUY; inputCurrency: AlfredpayCurrency } - ? AlfredpayOnrampQuote - : T extends { rampType: RampDirection.SELL; to: "pix" } - ? BrlOfframpQuote - : T extends { rampType: RampDirection.SELL; to: "sepa" } - ? EurOfframpQuote - : T extends { rampType: RampDirection.SELL; outputCurrency: AlfredpayCurrency } - ? AlfredpayOfframpQuote +// Alfredpay branches are checked before the pix/sepa branches to mirror the runtime routing in VortexSdk.registerRamp(). +export type ExtendedQuoteResponse = T extends { + rampType: RampDirection.BUY; + inputCurrency: AlfredpayCurrency; +} + ? AlfredpayOnrampQuote + : T extends { rampType: RampDirection.BUY; from: "pix" } + ? BrlOnrampQuote + : T extends { rampType: RampDirection.BUY; from: "sepa" } + ? EurOnrampQuote + : T extends { rampType: RampDirection.SELL; outputCurrency: AlfredpayCurrency } + ? AlfredpayOfframpQuote + : T extends { rampType: RampDirection.SELL; to: "pix" } + ? BrlOfframpQuote + : T extends { rampType: RampDirection.SELL; to: "sepa" } + ? EurOfframpQuote : AnyQuote; export type AnyAdditionalData = @@ -113,7 +117,7 @@ export interface EurOnrampAdditionalData { export interface AlfredpayOnrampAdditionalData { destinationAddress: string; - fiatAccountId: string; + fiatAccountId?: string; walletAddress?: string; sessionId?: string; } @@ -182,7 +186,6 @@ export interface RampState { rampId: string; quoteId: string; ephemerals: { - stellarEphemeral?: EphemeralAccount; substrateEphemeral?: EphemeralAccount; evmEphemeral?: EphemeralAccount; }; diff --git a/packages/sdk/test/alfredpayHandler.test.ts b/packages/sdk/test/alfredpayHandler.test.ts index 4f7783980..f39874e77 100644 --- a/packages/sdk/test/alfredpayHandler.test.ts +++ b/packages/sdk/test/alfredpayHandler.test.ts @@ -40,13 +40,11 @@ function setup(overrides: { unsignedTxs?: any[]; currentPhase?: string } = {}) { const generateEphemerals = async () => ({ accountMetas: [ - { address: "GSTELLAR", type: "Stellar" }, { address: "5SUBSTRATE", type: "Substrate" }, { address: "0xEVM", type: "EVM" } ], ephemerals: { EVM: { address: "0xEVM", secret: "s" }, - Stellar: { address: "GSTELLAR", secret: "s" }, Substrate: { address: "5SUBSTRATE", secret: "s" } } }); @@ -61,14 +59,14 @@ function setup(overrides: { unsignedTxs?: any[]; currentPhase?: string } = {}) { } describe("isAlfredpayToken routing", () => { - test("USD/MXN/COP route to Alfredpay", () => { - for (const t of [FiatToken.USD, FiatToken.MXN, FiatToken.COP]) { + test("USD/MXN/COP/ARS route to Alfredpay", () => { + for (const t of [FiatToken.USD, FiatToken.MXN, FiatToken.COP, FiatToken.ARS]) { expect(isAlfredpayToken(t)).toBe(true); } }); - test("BRL/EURC/ARS do not route to Alfredpay", () => { - for (const t of [FiatToken.BRL, FiatToken.EURC, FiatToken.ARS]) { + test("BRL/EURC do not route to Alfredpay", () => { + for (const t of [FiatToken.BRL, FiatToken.EURC]) { expect(isAlfredpayToken(t)).toBe(false); } }); @@ -91,7 +89,7 @@ describe("AlfredpayHandler onramp", () => { expect(reg.quoteId).toBe("quote_1"); expect(reg.additionalData.destinationAddress).toBe(WALLET); expect(reg.additionalData.fiatAccountId).toBe(FIAT_ACCOUNT); - expect(reg.signingAccounts).toHaveLength(3); + expect(reg.signingAccounts).toHaveLength(2); const upd = calls.find(c => c.method === "updateRamp")!.payload; expect(upd.presignedTxs).toHaveLength(1); @@ -105,11 +103,15 @@ describe("AlfredpayHandler onramp", () => { ).rejects.toBeInstanceOf(MissingAlfredpayOnrampParametersError); }); - test("throws when fiatAccountId missing", async () => { - const { handler } = setup(); - await expect( - handler.registerAlfredpayOnramp("q", { destinationAddress: WALLET, fiatAccountId: "" } as any) - ).rejects.toBeInstanceOf(MissingAlfredpayOnrampParametersError); + test("registers without fiatAccountId (backend only requires destinationAddress for onramp)", async () => { + const { calls, handler } = setup(); + + const result = await handler.registerAlfredpayOnramp("quote_1", { destinationAddress: WALLET }); + + expect(result.id).toBe("ramp_1"); + const reg = calls.find(c => c.method === "registerRamp")!.payload; + expect(reg.additionalData.destinationAddress).toBe(WALLET); + expect(reg.additionalData.fiatAccountId).toBeUndefined(); }); }); diff --git a/packages/shared/package.json b/packages/shared/package.json index fe6e2687b..759123877 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -56,7 +56,7 @@ }, "scripts": { "build": "rm -rf ./dist && bun build ./src/index.ts --outdir ./dist/node --target=node && bun build ./src/index.ts --outdir ./dist/browser --target=browser && tsc -p tsconfig.json --emitDeclarationOnly --outDir dist", - "dev": "bun build ./src/index.ts --outdir ./dist/node --target=node --watch & bun build ./src/index.ts --outdir ./dist/browser --target=browser --watch", + "dev": "bun build ./src/index.ts --outdir ./dist/node --target=node & bun build ./src/index.ts --outdir ./dist/browser --target=browser", "format": "prettier . --write", "prepublishOnly": "bun run build" }, diff --git a/packages/shared/src/constants.ts b/packages/shared/src/constants.ts index 13289f3b7..5f2231413 100644 --- a/packages/shared/src/constants.ts +++ b/packages/shared/src/constants.ts @@ -16,3 +16,10 @@ export const ALCHEMY_API_KEY = getEnvVar("ALCHEMY_API_KEY"); export const ALFREDPAY_BASE_URL = getEnvVar("ALFREDPAY_BASE_URL") || "https://penny-api-restricted-dev.alfredpay.io"; export const ALFREDPAY_API_KEY = getEnvVar("ALFREDPAY_API_KEY"); export const ALFREDPAY_API_SECRET = getEnvVar("ALFREDPAY_API_SECRET"); + +export const MYKOBO_BASE_URL = + getEnvVar("MYKOBO_BASE_URL") || (SANDBOX_ENABLED ? "https://api-dev.mykobo.app" : "https://api.mykobo.app"); +export const MYKOBO_ACCESS_KEY = getEnvVar("MYKOBO_ACCESS_KEY"); +export const MYKOBO_SECRET_KEY = getEnvVar("MYKOBO_SECRET_KEY"); +// Optional. Mykobo defaults the fee scope to `.mykobo.app` when omitted. +export const MYKOBO_CLIENT_DOMAIN = getEnvVar("MYKOBO_CLIENT_DOMAIN"); diff --git a/packages/shared/src/endpoints/brla.endpoints.ts b/packages/shared/src/endpoints/brla.endpoints.ts index 90865118a..fa7b1d0cd 100644 --- a/packages/shared/src/endpoints/brla.endpoints.ts +++ b/packages/shared/src/endpoints/brla.endpoints.ts @@ -102,7 +102,8 @@ export interface BrlaCreateSubaccountRequest { accountType: AveniaAccountType; name: string; taxId: string; - quoteId: string; + // Optional: the KYB deep link creates a subaccount without a quote. The backend stores it as a nullable initialQuoteId. + quoteId?: string; sessionId?: string; } diff --git a/packages/shared/src/endpoints/index.ts b/packages/shared/src/endpoints/index.ts index e5c3b52ca..565f0e6ad 100644 --- a/packages/shared/src/endpoints/index.ts +++ b/packages/shared/src/endpoints/index.ts @@ -3,7 +3,6 @@ export * from "./alfredpay.endpoints"; export * from "./brla.endpoints"; export * from "./contact.endpoints"; export * from "./email.endpoints"; -export * from "./monerium"; export * from "./moonbeam.endpoints"; export * from "./payment-methods.endpoints"; export * from "./pendulum.endpoints"; @@ -13,7 +12,6 @@ export * from "./ramp.endpoints"; export * from "./rating.endpoints"; export * from "./session"; export * from "./siwe.endpoints"; -export * from "./stellar.endpoints"; export * from "./storage.endpoints"; export * from "./subsidize.endpoints"; export * from "./supported-countries.endpoints"; diff --git a/packages/shared/src/endpoints/monerium.ts b/packages/shared/src/endpoints/monerium.ts deleted file mode 100644 index 6ce57eaec..000000000 --- a/packages/shared/src/endpoints/monerium.ts +++ /dev/null @@ -1,95 +0,0 @@ -export enum MoneriumAddressStatus { - REQUESTED = "requested", - APPROVED = "approved" -} - -export interface MoneriumAddress { - address: string; - profile: string; - chains: string[]; - status: MoneriumAddressStatus; -} - -export interface MoneriumResponse { - addresses: MoneriumAddress[]; - total: number; -} - -export interface FetchIbansParams { - authToken: string; - profileId: string; -} - -export interface FetchProfileParams extends FetchIbansParams { - profileId: string; -} - -export interface IbanData { - iban: string; - bic: string; - profile: string; - address: string; - chain: string; - name: string; -} - -export interface IbanDataResponse { - ibans: IbanData[]; -} - -export interface MoneriumTokenResponse { - access_token: string; - token_type: string; - expires_in: number; - scope: string; -} - -export interface MoneriumUserProfile { - id: string; - kind: string; - name: string; - state: string; -} - -export interface BeneficiaryDetails { - name: string; - iban: string; - bic: string; - amount: string; -} - -export type AddressExistsResponse = MoneriumAddress; - -export interface AuthContextProfile { - id: string; - name: string; - state: string; - kind: string; -} - -export interface AuthContext { - defaultProfile: string; - profiles: AuthContextProfile[]; -} - -export enum MoneriumErrors { - USER_MINT_ADDRESS_NOT_FOUND = "User mint address not found", - USER_MINT_ADDRESS_IS_NOT_READY = "User mint address is not ready yet" -} - -// TODO: Move these types to a more generic file if they are used outside of Monerium endpoints -export type Signature = { v: number; r: `0x${string}`; s: `0x${string}`; deadline: number }; - -export interface PermitSignatureContext { - owner: `0x${string}`; - spender: `0x${string}`; - valueRaw: string; - nonce: string; - deadline: string; - tokenAddress: `0x${string}`; - tokenName: string; - tokenVersion: string; - chainId: number; -} - -export type PermitSignature = Signature & { context?: PermitSignatureContext }; diff --git a/packages/shared/src/endpoints/quote.endpoints.ts b/packages/shared/src/endpoints/quote.endpoints.ts index 19a28c404..a5367bdae 100644 --- a/packages/shared/src/endpoints/quote.endpoints.ts +++ b/packages/shared/src/endpoints/quote.endpoints.ts @@ -40,6 +40,7 @@ export interface CreateBestQuoteRequest { api?: boolean; // Optional flag to indicate API usage paymentMethod?: PaymentMethod; countryCode?: string; + networks?: Networks[]; // Optional whitelist of networks to evaluate; if omitted, all eligible networks are tried } export interface QuoteResponse { @@ -91,6 +92,7 @@ export enum QuoteError { MissingToField = "SELL rampType requires 'to' parameter", MissingFromField = "BUY rampType requires 'from' parameter", + InvalidNetworks = "Invalid 'networks' value: must be an array of valid network identifiers", // Quote lookup errors QuoteNotFound = "Quote not found", @@ -100,9 +102,11 @@ export enum QuoteError { InputAmountForSwapMustBeGreaterThanZero = "Input amount for swap must be greater than 0", InputAmountTooLow = "Input amount too low. Please try a larger amount.", InputAmountTooLowToCoverCalculatedFees = "Input amount too low to cover calculated fees.", - LowLiquidity = "Low liquidity for this route. Please try a smaller amount.", + LowLiquidity = "This route is temporarily unavailable due to low liquidity. Please try a smaller amount or check back soon.", BelowLowerLimitSell = "Output amount below minimum SELL limit of", BelowLowerLimitBuy = "Input amount below minimum BUY limit of", + AboveUpperLimitSell = "Output amount exceeds maximum SELL limit of", + AboveUpperLimitBuy = "Input amount exceeds maximum BUY limit of", // Availability errors UnsupportedCurrency = "Currency not supported", diff --git a/packages/shared/src/endpoints/ramp.endpoints.ts b/packages/shared/src/endpoints/ramp.endpoints.ts index 9c1b71336..ab4a9ecbb 100644 --- a/packages/shared/src/endpoints/ramp.endpoints.ts +++ b/packages/shared/src/endpoints/ramp.endpoints.ts @@ -4,22 +4,19 @@ import { EvmAddress, Networks, PaymentMethod, - PermitSignature, RampCurrency, - RampDirection, - Signature + RampDirection } from "../index"; import { TransactionStatus } from "./webhook.endpoints"; +export type Signature = { v: number; r: `0x${string}`; s: `0x${string}`; deadline: number }; + export type RampPhase = | "initial" - | "moneriumOnrampSelfTransfer" - | "moneriumOnrampMint" | "squidRouterPermitExecute" | "squidRouterNoPermitTransfer" | "squidRouterNoPermitApprove" | "squidRouterNoPermitSwap" - | "stellarCreateAccount" | "squidRouterApprove" | "squidRouterSwap" | "squidRouterPay" @@ -35,8 +32,6 @@ export type RampPhase = | "pendulumToHydrationXcm" | "assethubToPendulum" | "pendulumToAssethubXcm" - | "spacewalkRedeem" - | "stellarPayment" | "subsidizePreSwap" | "subsidizePostSwap" | "distributeFees" @@ -45,7 +40,10 @@ export type RampPhase = | "alfredpayOfframpTransfer" | "alfredpayOfframpTransferFallback" | "brlaOnrampMint" + | "onHoldForComplianceCheck" | "brlaPayoutOnBase" + | "mykoboOnrampDeposit" + | "mykoboPayoutOnBase" | "baseTransfer" | "failed" | "timedOut" @@ -59,17 +57,16 @@ export type RampPhase = export type CleanupPhase = | "moonbeamCleanup" | "pendulumCleanup" - | "stellarCleanup" | "polygonCleanup" | "polygonCleanupAxlUsdc" | "hydrationCleanup" | "assetHubCleanup" | "baseCleanupUsdc" | "baseCleanupBrla" + | "baseCleanupEurc" | "baseCleanupAxlUsdc"; export enum EphemeralAccountType { - Stellar = "Stellar", Substrate = "Substrate", EVM = "EVM" } @@ -133,7 +130,7 @@ export function isSignedTypedData( export function isSignedTypedDataArray( data: string | EvmTransactionData | SignedTypedData | SignedTypedData[] ): data is SignedTypedData[] { - return Array.isArray(data) && data.length > 0 && data.every(item => isSignedTypedData(item as any)); + return Array.isArray(data) && data.length > 0 && data.every(item => isSignedTypedData(item as unknown as SignedTypedData)); } export interface UnsignedTx { @@ -162,13 +159,14 @@ export interface PaymentData { amount: string; memo: string; memoType: "text" | "hash" | "id"; - anchorTargetAccount: string; // The account of the Stellar anchor where the payment is sent } export interface IbanPaymentData { receiverName: string; iban: string; bic: string; + /** Optional payment reference (e.g. Mykobo deposit SCOR). Caller should include it in the SEPA transfer. */ + reference?: string; } export interface RegisterRampRequest { @@ -179,13 +177,13 @@ export interface RegisterRampRequest { fiatAccountId?: string; // For determine the correct payment method for AlfredPay flows walletAddress?: string; destinationAddress?: string; - moneriumWalletAddress?: string; paymentData?: PaymentData; pixDestination?: string; receiverTaxId?: string; taxId?: string; - moneriumAuthToken?: string | null; // Monerium authentication code for Monerium offramps. sessionId?: string; + email?: string; // Required for Mykobo EUR ramps (binds ramp to anchor profile) + ipAddress?: string; // Required for Mykobo EUR ramps (user IP for fraud checks; auto-filled from req.ip if omitted) [key: string]: unknown; }; } @@ -209,8 +207,6 @@ export interface UpdateRampRequest { squidRouterNoPermitApproveHash?: string; squidRouterNoPermitSwapHash?: string; assethubToPendulumHash?: string; - moneriumOfframpSignature?: string; // Required to trigger Monerium offramp - moneriumOnrampPermit?: PermitSignature; [key: string]: unknown; }; } diff --git a/packages/shared/src/endpoints/stellar.endpoints.ts b/packages/shared/src/endpoints/stellar.endpoints.ts deleted file mode 100644 index bc943a45d..000000000 --- a/packages/shared/src/endpoints/stellar.endpoints.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { FiatToken } from "../index"; - -// POST /stellar/create -export interface CreateStellarTransactionRequest { - accountId: string; - maxTime: number; - assetCode: string; - baseFee: string; -} - -export interface CreateStellarTransactionResponse { - signature: string; - sequence: string; - public: string; -} - -// POST /stellar/sep10 -export interface SignSep10ChallengeRequest { - challengeXDR: string; - outToken: FiatToken; - clientPublicKey: string; - derivedMemo?: string; -} - -export interface SignSep10ChallengeResponse { - masterClientSignature: string; - masterClientPublic: string; - clientSignature: string; - clientPublic: string; -} - -// GET /stellar/sep10 -export interface GetSep10MasterPKResponse { - masterSep10Public: string; -} - -export interface StellarErrorResponse { - error: string; - details?: string; -} diff --git a/packages/shared/src/endpoints/storage.endpoints.ts b/packages/shared/src/endpoints/storage.endpoints.ts index 5320a5196..419a3f452 100644 --- a/packages/shared/src/endpoints/storage.endpoints.ts +++ b/packages/shared/src/endpoints/storage.endpoints.ts @@ -1,7 +1,5 @@ // Flow types for storage export enum OfframpHandlerType { - EVM_TO_STELLAR = "evm-to-stellar", - ASSETHUB_TO_STELLAR = "assethub-to-stellar", EVM_TO_BRLA = "evm-to-brla", ASSETHUB_TO_BRLA = "assethub-to-brla" } @@ -26,23 +24,6 @@ export interface StorageRequestBase { outputTokenType: string; } -// Specific fields for each flow type -export interface EvmToStellarStorageRequest extends StorageRequestBase { - flowType: OfframpHandlerType.EVM_TO_STELLAR; - offramperAddress: string; - squidRouterReceiverId: string; - squidRouterReceiverHash: string; -} - -export interface AssethubToStellarStorageRequest extends StorageRequestBase { - flowType: OfframpHandlerType.ASSETHUB_TO_STELLAR; - offramperAddress: string; - stellarEphemeralPublicKey: string; - spacewalkRedeemTx: string; - stellarOfframpTx: string; - stellarCleanupTx: string; -} - export interface EvmToBrlaStorageRequest extends StorageRequestBase { flowType: OfframpHandlerType.EVM_TO_BRLA; offramperAddress: string; @@ -73,8 +54,6 @@ export interface BrlaToAssethubStorageRequest extends StorageRequestBase { // Union type for all storage requests export type StoreDataRequest = - | EvmToStellarStorageRequest - | AssethubToStellarStorageRequest | EvmToBrlaStorageRequest | AssethubToBrlaStorageRequest | BrlaToEvmStorageRequest diff --git a/packages/shared/src/helpers/conversions.ts b/packages/shared/src/helpers/conversions.ts index 0a341c36e..f0a664017 100644 --- a/packages/shared/src/helpers/conversions.ts +++ b/packages/shared/src/helpers/conversions.ts @@ -2,13 +2,8 @@ import { ApiPromise, Keyring } from "@polkadot/api"; import { SubmittableExtrinsic } from "@polkadot/api/types"; import { Extrinsic } from "@polkadot/types/interfaces"; import { ISubmittableResult } from "@polkadot/types/types"; -import { StrKey } from "stellar-sdk"; import logger from "../logger"; -export function stellarHexToPublic(hexString: string) { - return StrKey.encodeEd25519PublicKey(hexToBuffer(hexString)); -} - export function hexToBuffer(hexString: string) { if (hexString.length % 2 !== 0) { throw new Error("The provided hex string has an odd length. It must have an even length."); diff --git a/packages/shared/src/helpers/ephemerals.ts b/packages/shared/src/helpers/ephemerals.ts index f96f070ef..23d01aa4f 100644 --- a/packages/shared/src/helpers/ephemerals.ts +++ b/packages/shared/src/helpers/ephemerals.ts @@ -2,7 +2,6 @@ import { Keyring } from "@polkadot/api"; import { u8aToHex } from "@polkadot/util"; import { cryptoWaitReady, hdEthereum, mnemonicGenerate } from "@polkadot/util-crypto"; import { mnemonicToSeedSync } from "@scure/bip39"; -import { Keypair } from "stellar-sdk"; import { EphemeralAccount } from "../index"; export function deriveEvmPrivateKeyFromMnemonic(mnemonic: string): Uint8Array { @@ -32,10 +31,3 @@ export async function createPendulumEphemeral(): Promise { return { address: ephemeralAccountKeypair.address, secret: seedPhrase }; } - -export function createStellarEphemeral(): EphemeralAccount { - const ephemeralKeys = Keypair.random(); - const address = ephemeralKeys.publicKey(); - - return { address, secret: ephemeralKeys.secret() }; -} diff --git a/packages/shared/src/helpers/networks.ts b/packages/shared/src/helpers/networks.ts index 4b8aed162..55f70230a 100644 --- a/packages/shared/src/helpers/networks.ts +++ b/packages/shared/src/helpers/networks.ts @@ -15,7 +15,6 @@ export enum Networks { Polygon = "polygon", Moonbeam = "moonbeam", Pendulum = "pendulum", - Stellar = "stellar", PolygonAmoy = "polygonAmoy", BaseSepolia = "base-sepolia" } @@ -44,12 +43,11 @@ export function getNetworkFromDestination(destination: DestinationType): Network return undefined; } -// For the AssetHub/Pendulum/Stellar network, we use a chain ID of -x. This is not a valid chain ID -// but we just use it to differentiate between the EVM and Polkadot/Stellar accounts. +// For the AssetHub/Pendulum networks, we use a chain ID of -x. This is not a valid chain ID +// but we just use it to differentiate between the EVM and Polkadot accounts. export const ASSETHUB_CHAIN_ID = -1; export const PENDULUM_CHAIN_ID = -2; export const HYDRATION_CHAIN_ID = -3; -export const STELLAR_CHAIN_ID = -99; interface NetworkMetadata { id: number; @@ -136,12 +134,6 @@ const NETWORK_METADATA: Record = { id: PENDULUM_CHAIN_ID, isEVM: false, supportsRamp: false - }, - [Networks.Stellar]: { - displayName: "Stellar", - id: STELLAR_CHAIN_ID, - isEVM: false, - supportsRamp: false } }; diff --git a/packages/shared/src/helpers/parseNumbers.ts b/packages/shared/src/helpers/parseNumbers.ts index 60f23ff68..6bc693f6f 100644 --- a/packages/shared/src/helpers/parseNumbers.ts +++ b/packages/shared/src/helpers/parseNumbers.ts @@ -5,10 +5,6 @@ import Big from "big.js"; export const ChainDecimals = 12; export const USDC_DECIMALS = 6; -// These are the decimals used by the Stellar network -// We actually up-scale the amounts on Stellar now to match the expected decimals of the other tokens. -export const StellarDecimals = ChainDecimals; - // These are the decimals used by the FixedU128 type export const FixedU128Decimals = 18; @@ -35,17 +31,6 @@ export const decimalToCustom = (value: Big | number | string, decimals: number) return bigIntValue.mul(multiplier); }; -export const decimalToStellarNative = (value: Big | number | string) => { - let bigIntValue; - try { - bigIntValue = new Big(value); - } catch (_error) { - bigIntValue = new Big(0); - } - const multiplier = new Big(10).pow(StellarDecimals); - return bigIntValue.mul(multiplier); -}; - export const fixedPointToDecimal = (value: Big | number | string) => { const bigIntValue = new Big(value); const divisor = new Big(10).pow(FixedU128Decimals); @@ -70,13 +55,6 @@ export const nativeToDecimal = (value: Big | number | string | u128 | UInt, deci return bigIntValue.div(divisor); }; -export const nativeStellarToDecimal = (value: Big | number | string) => { - const bigIntValue = new Big(value); - const divisor = new Big(10).pow(StellarDecimals); - - return bigIntValue.div(divisor); -}; - export const toBigNumber = (value: Big | number | string, decimals: number) => { if (typeof value === "string" || value instanceof u128) { // Replace the unnecessary ',' with '' to prevent BigNumber from throwing an error diff --git a/packages/shared/src/helpers/signUnsigned.ts b/packages/shared/src/helpers/signUnsigned.ts index cc1536489..229e276f1 100644 --- a/packages/shared/src/helpers/signUnsigned.ts +++ b/packages/shared/src/helpers/signUnsigned.ts @@ -2,7 +2,6 @@ import { ApiPromise, Keyring } from "@polkadot/api"; import { AddressOrPair } from "@polkadot/api/types"; import { hexToU8a } from "@polkadot/util"; import { cryptoWaitReady } from "@polkadot/util-crypto"; -import { Keypair, Networks as StellarNetworks, Transaction } from "stellar-sdk"; import { createWalletClient, fallback, http, WalletClient } from "viem"; import { privateKeyToAccount } from "viem/accounts"; import { arbitrum, avalanche, base, bsc, mainnet, moonbeam, polygon, polygonAmoy } from "viem/chains"; @@ -15,7 +14,6 @@ import { Networks, NUMBER_OF_PRESIGNED_TXS, PresignedTx, - SANDBOX_ENABLED, UnsignedTx } from "../index"; import logger from "../logger"; @@ -41,37 +39,6 @@ export function addAdditionalTransactionsToMeta(primaryTx: PresignedTx, multiSig }; } -/** - * Signs multiple Stellar transactions with increasing sequence numbers - */ -async function signMultipleStellarTransactions( - tx: UnsignedTx, - keypair: Keypair, - networkPassphrase: string -): Promise { - const transaction = new Transaction(tx.txData as string, networkPassphrase); - transaction.sign(keypair); - - const primarySignedTxData = transaction.toEnvelope().toXDR().toString("base64"); - - const signedTx: PresignedTx = { - ...tx, - txData: primarySignedTxData - }; - // iterate objects of array meta - for (const key in signedTx.meta.additionalTxs) { - if (!key.includes(tx.phase)) continue; - - const extraTransactionUnsigned = signedTx.meta.additionalTxs[key].txData; - const extraTransaction = new Transaction(extraTransactionUnsigned as string, networkPassphrase); - extraTransaction.sign(keypair); - - const extraTransactionSigned = extraTransaction.toEnvelope().toXDR().toString("base64"); - signedTx.meta.additionalTxs[key].txData = extraTransactionSigned; - } - return signedTx; -} - /** * Signs multiple Substrate transactions with increasing nonces */ @@ -225,13 +192,12 @@ async function signMultipleEvmTransactions( export async function signUnsignedTransactions( unsignedTxs: UnsignedTx[], ephemerals: { - stellarEphemeral?: EphemeralAccount; substrateEphemeral?: EphemeralAccount; evmEphemeral?: EphemeralAccount; }, - pendulumApi: ApiPromise, - moonbeamApi: ApiPromise, - hydrationApi: ApiPromise, + pendulumApi?: ApiPromise, + moonbeamApi?: ApiPromise, + hydrationApi?: ApiPromise, alchemyApiKey?: string ): Promise { // Wait for initialization of crypto libraries @@ -247,35 +213,18 @@ export async function signUnsignedTransactions( const hydrationTxs = unsignedTxs.filter(tx => tx.network === Networks.Hydration); const destinationNetworkTxs = unsignedTxs.filter( tx => - tx.phase === "destinationTransfer" || - tx.phase === "backupSquidRouterApprove" || - tx.phase === "backupSquidRouterSwap" || - tx.phase === "backupApprove" + (tx.phase === "destinationTransfer" || + tx.phase === "backupSquidRouterApprove" || + tx.phase === "backupSquidRouterSwap" || + tx.phase === "backupApprove") && + tx.network !== Networks.Polygon && + tx.network !== Networks.PolygonAmoy && + tx.network !== Networks.Base ); try { - const stellarTxs = unsignedTxs.filter(tx => tx.network === "stellar").sort((a, b) => a.nonce - b.nonce); const pendulumTxs = unsignedTxs.filter(tx => tx.network === "pendulum"); - // Process Stellar transactions first in sequence order - if (stellarTxs.length > 0) { - if (!ephemerals.stellarEphemeral) { - throw new Error("Missing Stellar ephemeral account"); - } - - const keypair = Keypair.fromSecret(ephemerals.stellarEphemeral.secret); - - for (const tx of stellarTxs) { - if (isEvmTransactionData(tx.txData) || isSignedTypedData(tx.txData)) { - throw new Error("Invalid Stellar transaction data format"); - } - - const networkPassphrase = SANDBOX_ENABLED ? StellarNetworks.TESTNET : StellarNetworks.PUBLIC; - const txWithMeta = await signMultipleStellarTransactions(tx, keypair, networkPassphrase); - signedTxs.push(txWithMeta); - } - } - for (const tx of hydrationTxs) { if (!ephemerals.substrateEphemeral) { throw new Error("Missing Substrate ephemeral account"); @@ -337,6 +286,10 @@ export async function signUnsignedTransactions( signedTxs.push(txWithMeta); } else if (!isSignedTypedData(tx.txData) && !isSignedTypedDataArray(tx.txData)) { + if (!moonbeamApi) { + throw new Error("Moonbeam API is required for signing Substrate-format Moonbeam transactions"); + } + // Handle Moonbeam Substrate transactions const keyring = new Keyring({ type: "ethereum" }); const privateKey = ephemerals.evmEphemeral.secret as `0x${string}`; diff --git a/packages/shared/src/services/alfredpay/alfredpayApiService.ts b/packages/shared/src/services/alfredpay/alfredpayApiService.ts index 97074f09f..26f7157bc 100644 --- a/packages/shared/src/services/alfredpay/alfredpayApiService.ts +++ b/packages/shared/src/services/alfredpay/alfredpayApiService.ts @@ -109,8 +109,13 @@ export class AlfredpayApiService { try { const parsed = JSON.parse(errorText); if (parsed.errorCode === 111426 && parsed.errorMetadata) { - const { minQuantity, fromCurrency } = parsed.errorMetadata; - throw new AlfredpayTradeLimitError(minQuantity, fromCurrency); + const { minQuantity, maxQuantity, fromCurrency } = parsed.errorMetadata; + logger.current.warn( + `Alfredpay trade limit hit: minQuantity=${minQuantity} maxQuantity=${maxQuantity} fromCurrency=${fromCurrency}` + ); + throw maxQuantity !== undefined + ? AlfredpayTradeLimitError.above(maxQuantity, fromCurrency) + : AlfredpayTradeLimitError.below(minQuantity, fromCurrency); } } catch (parseError) { if (parseError instanceof AlfredpayTradeLimitError) { @@ -260,10 +265,15 @@ export class AlfredpayApiService { data: SubmitKycInformationRequest ): Promise { const path = `/api/v1/third-party-service/penny/customers/${customerId}/kyc`; - const kycSubmission: Record = { ...data, nationalities: [data.country] }; + const kycSubmission: Record = { ...data }; + if (!kycSubmission.nationalities) kycSubmission.nationalities = [data.country]; if (!data.typeDocument) delete kycSubmission.typeDocument; if (!data.typeDocumentCol) delete kycSubmission.typeDocumentCol; + delete kycSubmission.typeDocumentAr; // Currently not required, (typeDocument throws an error on Alfredpay side) if (!data.phoneNumber) delete kycSubmission.phoneNumber; + if (!data.cuit) delete kycSubmission.cuit; + if (data.pep !== false && !data.pep) delete kycSubmission.pep; + if (!data.countryCode) delete kycSubmission.countryCode; return (await this.executeRequest(path, "POST", { kycSubmission })) as SubmitKycInformationResponse; } @@ -274,7 +284,7 @@ export class AlfredpayApiService { file: Blob ): Promise { const formData = new FormData(); - formData.append("rawBody", file); + formData.append("fileBody", file); formData.append("fileType", fileType); const url = `${ALFREDPAY_BASE_URL}/api/v1/third-party-service/penny/customers/${customerId}/kyc/${submissionId}/files`; diff --git a/packages/shared/src/services/alfredpay/types.ts b/packages/shared/src/services/alfredpay/types.ts index 3b0b02d88..4730485fc 100644 --- a/packages/shared/src/services/alfredpay/types.ts +++ b/packages/shared/src/services/alfredpay/types.ts @@ -353,7 +353,12 @@ export interface AlfredpayFiatAccount extends AlfredpayFiatAccountFields { export type ListAlfredpayFiatAccountsResponse = AlfredpayFiatAccount[]; -const ALFREDPAY_FIAT_TOKEN_SET: ReadonlySet = new Set([FiatToken.USD, FiatToken.MXN, FiatToken.COP]); +const ALFREDPAY_FIAT_TOKEN_SET: ReadonlySet = new Set([ + FiatToken.USD, + FiatToken.MXN, + FiatToken.COP, + FiatToken.ARS +]); export const isAlfredpayToken = (token: RampCurrency): token is FiatToken => ALFREDPAY_FIAT_TOKEN_SET.has(token); @@ -376,15 +381,25 @@ export interface GetAllConfigsResponse { } export class AlfredpayTradeLimitError extends Error { - readonly minQuantity: string; + readonly kind: "above" | "below"; + readonly quantity: string; readonly fromCurrency: string; - constructor(minQuantity: string, fromCurrency: string) { - super(`Trade below minimum: ${minQuantity} ${fromCurrency}`); + private constructor(kind: "above" | "below", quantity: string, fromCurrency: string) { + super(`Trade ${kind === "below" ? "below minimum" : "above maximum"}: ${quantity} ${fromCurrency}`); this.name = "AlfredpayTradeLimitError"; - this.minQuantity = minQuantity; + this.kind = kind; + this.quantity = quantity; this.fromCurrency = fromCurrency; } + + static below(minQuantity: string, fromCurrency: string): AlfredpayTradeLimitError { + return new AlfredpayTradeLimitError("below", minQuantity, fromCurrency); + } + + static above(maxQuantity: string, fromCurrency: string): AlfredpayTradeLimitError { + return new AlfredpayTradeLimitError("above", maxQuantity, fromCurrency); + } } // MXN KYC form submission types @@ -412,7 +427,12 @@ export interface SubmitKycInformationRequest { dni: string; typeDocument?: string; typeDocumentCol?: AlfredpayColombiaDocumentType; - phoneNumber?: string; // Colombia + typeDocumentAr?: AlfredpayArgentinaDocumentType; + phoneNumber?: string; // Colombia, Argentina + countryCode?: string; // Argentina + nationalities?: string[]; // Argentina + pep?: boolean; // Argentina + cuit?: string; // Argentina, mandatory 11 digits } export interface SubmitKycInformationResponse { @@ -421,7 +441,12 @@ export interface SubmitKycInformationResponse { export enum AlfredpayKycFileType { FRONT = "National ID Front", - BACK = "National ID Back" + BACK = "National ID Back", + SELFIE = "Selfie" +} + +export enum AlfredpayArgentinaDocumentType { + DNI = "DNI" } // KYB form submission types diff --git a/packages/shared/src/services/brla/brlaApiService.ts b/packages/shared/src/services/brla/brlaApiService.ts index 72a4333a6..ef8837170 100644 --- a/packages/shared/src/services/brla/brlaApiService.ts +++ b/packages/shared/src/services/brla/brlaApiService.ts @@ -283,7 +283,7 @@ export class BrlaApiService { inputPaymentMethod: AveniaPaymentMethod.INTERNAL, // Fixed. We know it comes from the our balance inputThirdParty: String(false), outputCurrency: quoteParams.outputCurrency, - outputPaymentMethod: AveniaPaymentMethod.POLYGON, + outputPaymentMethod: quoteParams.outputPaymentMethod ?? AveniaPaymentMethod.POLYGON, outputThirdParty: String(false) // Fixed. We know it goes to our Moonbeam account. }).toString(); const cacheKey = `onchainSwap:${query}`; @@ -395,7 +395,9 @@ export class BrlaApiService { const aveniaTicketsQueryResponse = await this.sendRequest(Endpoint.Tickets, "GET", query, undefined); if ("tickets" in aveniaTicketsQueryResponse) { - return aveniaTicketsQueryResponse.tickets.filter((ticket): ticket is AveniaPayinTicket => "brlPixInputInfo" in ticket); + return aveniaTicketsQueryResponse.tickets.filter( + (ticket): ticket is AveniaPayinTicket => "brlPixInputInfo" in ticket || "brazilianFiatSenderInfo" in ticket + ); } throw new Error("Invalid response from Avenia API for getAveniaPayinTickets"); } diff --git a/packages/shared/src/services/brla/types.ts b/packages/shared/src/services/brla/types.ts index 42d3d2ee8..51e7bc32a 100644 --- a/packages/shared/src/services/brla/types.ts +++ b/packages/shared/src/services/brla/types.ts @@ -98,9 +98,11 @@ export interface OnchainSwapQuoteParams { inputCurrency: BrlaCurrency; inputAmount: string; outputCurrency: BrlaCurrency; + outputPaymentMethod?: AveniaPaymentMethod; } export enum AveniaTicketStatus { + ON_HOLD = "ON-HOLD", PENDING = "PENDING", PAID = "PAID", FAILED = "FAILED" @@ -219,8 +221,10 @@ export interface AveniaPayoutTicket extends BaseTicket { export interface AveniaPayinTicket extends BaseTicket { brazilianFiatSenderInfo: { - id: string; - ticketId: string; + id?: string; + ticketId?: string; + referenceLabel?: string; + additionalData?: string; name: string; taxId: string; bankCode: string; @@ -237,7 +241,7 @@ export interface AveniaPayinTicket extends BaseTicket { walletMemo: string; txHash: string; }; - brlPixInputInfo: { + brlPixInputInfo?: { id: string; ticketId: string; referenceLabel: string; diff --git a/packages/shared/src/services/evm/clientManager.test.ts b/packages/shared/src/services/evm/clientManager.test.ts index 86479862c..69c027090 100644 --- a/packages/shared/src/services/evm/clientManager.test.ts +++ b/packages/shared/src/services/evm/clientManager.test.ts @@ -1,6 +1,6 @@ -import { describe, expect, it } from "bun:test"; -import { Networks } from "../../helpers"; -import { EvmClientManager, redactRpcUrlForLogs, sanitizeRpcErrorMessage } from "./clientManager"; +import {describe, expect, it} from "bun:test"; +import {Networks} from "../../helpers"; +import {EvmClientManager, redactRpcUrlForLogs, sanitizeRpcErrorMessage} from "./clientManager"; describe("redactRpcUrlForLogs", () => { it("redacts provider API keys from RPC URLs", () => { @@ -29,3 +29,38 @@ describe("EvmClientManager RPC cache keys", () => { expect(defaultRpcClient).not.toBe(explicitRpcClient); }); }); + +describe("EvmClientManager read contract retries", () => { + it("does not retry deterministic Nabla coverage-ratio reverts", async () => { + const manager = EvmClientManager.getInstance(); + const managerWithMockedClient = manager as EvmClientManager & { getClient: EvmClientManager["getClient"] }; + const originalGetClient = managerWithMockedClient.getClient; + let attempts = 0; + + managerWithMockedClient.getClient = (() => + ({ + readContract: async () => { + attempts += 1; + throw new Error("execution reverted: SP:quoteSwapInto:EXCEEDS_MAX_COVERAGE_RATIO"); + } + }) as unknown as ReturnType) as EvmClientManager["getClient"]; + + try { + await expect( + manager.readContractWithRetry( + Networks.Base, + { + abi: [], + address: "0x2A7989993335b31A3133CDA93bc1a095e7b178Ff", + functionName: "quoteSwapExactTokensForTokens" + }, + 3, + 0 + ) + ).rejects.toThrow("EXCEEDS_MAX_COVERAGE_RATIO"); + expect(attempts).toBe(1); + } finally { + managerWithMockedClient.getClient = originalGetClient; + } + }); +}); diff --git a/packages/shared/src/services/evm/clientManager.ts b/packages/shared/src/services/evm/clientManager.ts index 6313197b7..9018bbcc1 100644 --- a/packages/shared/src/services/evm/clientManager.ts +++ b/packages/shared/src/services/evm/clientManager.ts @@ -10,6 +10,7 @@ export interface EvmNetworkConfig { } const VIEM_DEFAULT_TRANSPORT_CACHE_KEY = ""; +const NON_RETRYABLE_READ_CONTRACT_REVERTS = ["EXCEEDS_MAX_COVERAGE_RATIO"]; export function redactRpcUrlForLogs(rpcUrl: string): string { if (!rpcUrl) { @@ -51,6 +52,10 @@ function createRpcTransport(network: EvmNetworkConfig, rpcUrl?: string): Transpo return targetRpcUrl === "" ? http() : http(targetRpcUrl); } +function isNonRetryableReadContractError(error: Error): boolean { + return NON_RETRYABLE_READ_CONTRACT_REVERTS.some(revertReason => error.message.includes(revertReason)); +} + function getEvmNetworks(apiKey?: string): EvmNetworkConfig[] { // Note on defining RPC URLs: '' is equal to viem's default RPC for that chain: http(). return [ @@ -161,7 +166,8 @@ export class EvmClientManager { operation: (rpcUrl: string) => Promise, operationName: string, maxRetries = 3, - initialDelayMs = 1000 + initialDelayMs = 1000, + shouldRetry: (error: Error) => boolean = () => true ): Promise { const network = this.getNetworkConfig(networkName); const rpcUrls = network.rpcUrls; @@ -187,6 +193,12 @@ export class EvmClientManager { `${operationName} attempt ${attempt + 1}/${maxRetries + 1} failed on ${networkName} with RPC ${redactRpcUrlForLogs(rpcUrl)}: ${sanitizeRpcErrorMessage(lastError.message)}` ); + if (!shouldRetry(lastError)) { + throw new Error(`${operationName} failed on ${networkName}: ${sanitizeRpcErrorMessage(lastError.message)}`, { + cause: lastError + }); + } + if (attempt < maxRetries) { const delayMs = initialDelayMs * Math.pow(2, attempt); // Exponential backoff await new Promise(resolve => setTimeout(resolve, delayMs)); @@ -327,7 +339,8 @@ export class EvmClientManager { }, "read contract", maxRetries, - initialDelayMs + initialDelayMs, + error => !isNonRetryableReadContractError(error) ); } diff --git a/packages/shared/src/services/index.ts b/packages/shared/src/services/index.ts index e3eb64dca..17c170987 100644 --- a/packages/shared/src/services/index.ts +++ b/packages/shared/src/services/index.ts @@ -2,6 +2,7 @@ export * from "../contracts"; export * from "./alfredpay"; export * from "./brla"; export * from "./evm"; +export * from "./mykobo"; export * from "./nabla"; export * from "./pendulum"; export * from "./slack.service"; diff --git a/packages/shared/src/services/mykobo/index.ts b/packages/shared/src/services/mykobo/index.ts new file mode 100644 index 000000000..ae4e66566 --- /dev/null +++ b/packages/shared/src/services/mykobo/index.ts @@ -0,0 +1,2 @@ +export * from "./mykoboApiService"; +export * from "./types"; diff --git a/packages/shared/src/services/mykobo/mykoboApiService.ts b/packages/shared/src/services/mykobo/mykoboApiService.ts new file mode 100644 index 000000000..7e780c52c --- /dev/null +++ b/packages/shared/src/services/mykobo/mykoboApiService.ts @@ -0,0 +1,284 @@ +import { MYKOBO_ACCESS_KEY, MYKOBO_BASE_URL, MYKOBO_CLIENT_DOMAIN, MYKOBO_SECRET_KEY } from "../.."; +import { isProduction } from "../../helpers/environment"; +import logger from "../../logger"; +import { + MykoboAuthTokenResponse, + MykoboCreateIntentRequest, + MykoboCreateIntentResponse, + MykoboFeeKind, + MykoboFeeResponse, + MykoboGetProfileResponse, + MykoboGetTransactionResponse, + MykoboLookupFeesParams +} from "./types"; + +export class MykoboApiError extends Error { + public readonly status: number; + public readonly body: unknown; + + constructor(status: number, body: unknown, message: string) { + super(message); + this.name = "MykoboApiError"; + this.status = status; + this.body = body; + } +} + +interface CachedToken { + token: string; + refreshToken: string; +} + +export class MykoboApiService { + private static instance: MykoboApiService; + + private readonly accessKey: string; + private readonly secretKey: string; + private readonly baseUrl: string; + private readonly clientDomain?: string; + + private cachedToken: CachedToken | undefined; + + private tokenPromise: Promise | undefined; + + private authFailurePromise: Promise | undefined; + + private constructor() { + if (!MYKOBO_ACCESS_KEY || !MYKOBO_SECRET_KEY) { + throw new Error("MYKOBO_ACCESS_KEY or MYKOBO_SECRET_KEY not defined"); + } + if (!MYKOBO_BASE_URL) { + throw new Error("MYKOBO_BASE_URL not defined"); + } + this.accessKey = MYKOBO_ACCESS_KEY; + this.secretKey = MYKOBO_SECRET_KEY; + const trimmedBase = MYKOBO_BASE_URL.replace(/\/$/, ""); + assertSecureMykoboBaseUrl(trimmedBase); + this.baseUrl = /\/v\d+$/.test(trimmedBase) ? trimmedBase : `${trimmedBase}/v1`; + this.clientDomain = MYKOBO_CLIENT_DOMAIN || undefined; + } + + public static getInstance(): MykoboApiService { + if (!MykoboApiService.instance) { + MykoboApiService.instance = new MykoboApiService(); + } + return MykoboApiService.instance; + } + + public getClientDomain(): string | undefined { + return this.clientDomain; + } + + private async acquireToken(): Promise { + const response = await fetch(`${this.baseUrl}/auth/token`, { + body: JSON.stringify({ access_key: this.accessKey, secret_key: this.secretKey }), + headers: { Accept: "application/json", "Content-Type": "application/json" }, + method: "POST" + }); + if (!response.ok) { + const body = await safeReadBody(response); + throw new MykoboApiError(response.status, body, `Mykobo /auth/token failed: ${response.status}`); + } + const parsed = (await response.json()) as MykoboAuthTokenResponse; + return { refreshToken: parsed.refresh_token, token: parsed.token }; + } + + private async refreshAccessToken(refreshToken: string): Promise { + const response = await fetch(`${this.baseUrl}/auth/refresh`, { + body: JSON.stringify({ refresh_token: refreshToken }), + headers: { Accept: "application/json", "Content-Type": "application/json" }, + method: "POST" + }); + if (!response.ok) { + const body = await safeReadBody(response); + throw new MykoboApiError(response.status, body, `Mykobo /auth/refresh failed: ${response.status}`); + } + const parsed = (await response.json()) as MykoboAuthTokenResponse; + return { refreshToken: parsed.refresh_token, token: parsed.token }; + } + + private async getToken(): Promise { + if (this.cachedToken) { + return this.cachedToken.token; + } + if (!this.tokenPromise) { + this.tokenPromise = this.acquireToken().finally(() => { + this.tokenPromise = undefined; + }); + } + this.cachedToken = await this.tokenPromise; + return this.cachedToken.token; + } + + private async handleAuthFailure(): Promise { + if (!this.authFailurePromise) { + this.authFailurePromise = this.doHandleAuthFailure().finally(() => { + this.authFailurePromise = undefined; + }); + } + return this.authFailurePromise; + } + + private async doHandleAuthFailure(): Promise { + if (this.cachedToken) { + try { + const refreshed = await this.refreshAccessToken(this.cachedToken.refreshToken); + this.cachedToken = refreshed; + return refreshed.token; + } catch (error) { + logger.current.warn("Mykobo refresh failed; re-acquiring token", error); + } + } + const reAcquired = await this.acquireToken(); + this.cachedToken = reAcquired; + return reAcquired.token; + } + + private async request( + method: "GET" | "POST", + path: string, + options: { query?: Record; body?: unknown } = {} + ): Promise { + const url = this.buildUrl(path, options.query); + const body = options.body !== undefined ? JSON.stringify(options.body) : undefined; + let token = await this.getToken(); + let response = await fetch(url, { + body, + headers: this.buildHeaders(token, body !== undefined), + method + }); + + if (response.status === 401) { + token = await this.handleAuthFailure(); + response = await fetch(url, { + body, + headers: this.buildHeaders(token, body !== undefined), + method + }); + } + + if (!response.ok) { + const errorBody = await safeReadBody(response); + throw new MykoboApiError(response.status, errorBody, `Mykobo ${method} ${path} failed: ${response.status}`); + } + + if (response.status === 204) { + return undefined as T; + } + return (await response.json()) as T; + } + + private buildUrl(path: string, query?: Record): string { + const base = `${this.baseUrl}${path.startsWith("/") ? path : `/${path}`}`; + if (!query) return base; + const params = new URLSearchParams(); + for (const [key, value] of Object.entries(query)) { + if (value !== undefined && value !== "") params.append(key, value); + } + const queryString = params.toString(); + return queryString ? `${base}?${queryString}` : base; + } + + private buildHeaders(token: string, hasBody: boolean): Record { + const headers: Record = { + Accept: "application/json", + Authorization: `Bearer ${token}` + }; + if (hasBody) headers["Content-Type"] = "application/json"; + return headers; + } + + public async createTransactionIntent(request: MykoboCreateIntentRequest): Promise { + const body: MykoboCreateIntentRequest = { + ...request, + client_domain: request.client_domain ?? this.clientDomain + }; + return this.request("POST", "/transactions/intent", { body }); + } + + public async getTransaction(transactionId: string): Promise { + return this.request("GET", `/transactions/${transactionId}`); + } + + public async lookupFees(params: MykoboLookupFeesParams): Promise { + return this.request("GET", "/fees", { + query: { + client_domain: params.client_domain ?? this.clientDomain, + kind: params.kind, + value: params.value + } + }); + } + + public async getProfileByWalletAddress(walletAddress: string, memo?: string): Promise { + return this.request("GET", "/profiles", { + query: { address: walletAddress, memo } + }); + } + + public async getProfileByEmail(email: string, memo?: string): Promise { + return this.request("GET", "/profiles", { + query: { email, memo } + }); + } + + public async createProfile(formData: FormData): Promise { + const url = this.buildUrl("/profiles"); + let token = await this.getToken(); + let response = await fetch(url, { + body: formData, + headers: { Accept: "application/json", Authorization: `Bearer ${token}` }, + method: "POST" + }); + + if (response.status === 401) { + token = await this.handleAuthFailure(); + response = await fetch(url, { + body: formData, + headers: { Accept: "application/json", Authorization: `Bearer ${token}` }, + method: "POST" + }); + } + + if (!response.ok) { + const errorBody = await safeReadBody(response); + throw new MykoboApiError(response.status, errorBody, `Mykobo POST /profiles failed: ${response.status}`); + } + + return (await response.json()) as MykoboGetProfileResponse; + } + + public defaultWithdrawFee(value: string): Promise { + return this.lookupFees({ kind: MykoboFeeKind.WITHDRAW, value }); + } + + public defaultDepositFee(value: string): Promise { + return this.lookupFees({ kind: MykoboFeeKind.DEPOSIT, value }); + } +} + +async function safeReadBody(response: Response): Promise { + try { + return await response.clone().json(); + } catch { + try { + return await response.text(); + } catch { + return undefined; + } + } +} + +function assertSecureMykoboBaseUrl(rawUrl: string): void { + let parsed: URL; + try { + parsed = new URL(rawUrl); + } catch { + throw new Error(`MYKOBO_BASE_URL is not a valid URL: ${rawUrl}`); + } + if (parsed.protocol === "https:") return; + if (parsed.protocol === "http:" && !isProduction() && (parsed.hostname === "localhost" || parsed.hostname === "127.0.0.1")) { + return; + } + throw new Error(`MYKOBO_BASE_URL must use https:// (got ${parsed.protocol}//${parsed.hostname})`); +} diff --git a/packages/shared/src/services/mykobo/types.ts b/packages/shared/src/services/mykobo/types.ts new file mode 100644 index 000000000..dcdc49c45 --- /dev/null +++ b/packages/shared/src/services/mykobo/types.ts @@ -0,0 +1,169 @@ +export enum MykoboTransactionType { + DEPOSIT = "DEPOSIT", + WITHDRAW = "WITHDRAW" +} + +export enum MykoboCurrency { + EURC = "EURC", + USDC = "USDC" +} + +export enum MykoboNetwork { + STELLAR = "STELLAR", + SOLANA = "SOLANA", + ETHEREUM = "ETHEREUM", + BASE = "BASE" +} + +export enum MykoboFeeKind { + DEPOSIT = "deposit", + WITHDRAW = "withdraw" +} + +export enum MykoboTransactionStatus { + PENDING_PAYER = "PENDING_PAYER", + PENDING_PAYEE = "PENDING_PAYEE", + COMPLETED = "COMPLETED", + FAILED = "FAILED", + CANCELLED = "CANCELLED", + EXPIRED = "EXPIRED" +} + +export enum MykoboCustomerStatus { + CONSULTED = "CONSULTED", // checked Mykobo but no profile/review exists yet + PENDING = "PENDING", + APPROVED = "APPROVED", + REJECTED = "REJECTED" +} + +export enum MykoboCustomerType { + INDIVIDUAL = "INDIVIDUAL", + BUSINESS = "BUSINESS" +} + +export function mapMykoboReviewStatus(reviewStatus: string | null | undefined): MykoboCustomerStatus { + switch ((reviewStatus ?? "").toLowerCase()) { + case "approved": + return MykoboCustomerStatus.APPROVED; + case "pending": + return MykoboCustomerStatus.PENDING; + case "rejected": + return MykoboCustomerStatus.REJECTED; + default: + return MykoboCustomerStatus.CONSULTED; + } +} + +export interface MykoboAuthTokenRequest { + access_key: string; + secret_key: string; +} + +export interface MykoboAuthTokenResponse { + subject_id: string; + token: string; + refresh_token: string; +} + +export interface MykoboRefreshTokenRequest { + refresh_token: string; +} + +export interface MykoboCreateIntentRequest { + transaction_type: MykoboTransactionType; + wallet_address: string; + email_address: string; + value: string; + currency: MykoboCurrency; + ip_address: string; + memo?: string; + client_domain?: string; +} + +export interface MykoboTransaction { + id: string; + reference: string; + transaction_type: MykoboTransactionType; + status: MykoboTransactionStatus | string; + incoming_currency?: string; + outgoing_currency?: string; + value: string; + fee: string; + wallet_address: string; + network: MykoboNetwork | string; + tx_hash: string | null; + created_at: string; + updated_at: string; +} + +export interface MykoboDepositInstructions { + bank_account_name: string; + iban: string; +} + +export interface MykoboWithdrawInstructions { + address: string; +} + +export type MykoboTransactionInstructions = MykoboDepositInstructions | MykoboWithdrawInstructions; + +export interface MykoboCreateIntentResponse { + transaction: MykoboTransaction; + instructions?: MykoboTransactionInstructions; +} + +export interface MykoboGetTransactionResponse { + transaction: MykoboTransaction; + instructions?: MykoboTransactionInstructions; +} + +export interface MykoboFeeDetail { + amount: string; + description: string; + name: string; +} + +export interface MykoboFeeResponse { + total: string; + asset?: string; + percentage?: string; + details?: MykoboFeeDetail[]; +} + +export interface MykoboLookupFeesParams { + value: string; + kind: MykoboFeeKind; + client_domain?: string; +} + +export interface MykoboProfileKycStatus { + received_at: string | null; + review_status: string; +} + +export interface MykoboProfile { + first_name: string; + last_name: string; + email_address: string; + bank_account_number: string; + kyc_status: MykoboProfileKycStatus; + created_at: string; +} + +export interface MykoboGetProfileResponse { + profile: MykoboProfile; +} + +export interface MykoboErrorResponse { + error: string; + fields?: Record; + kyc_status?: MykoboProfileKycStatus | string; + email_address?: string; + service?: string; +} + +export function isWithdrawInstructions( + instructions: MykoboTransactionInstructions | undefined +): instructions is MykoboWithdrawInstructions { + return Boolean(instructions && "address" in instructions); +} diff --git a/packages/shared/src/services/nabla/transactions/index.ts b/packages/shared/src/services/nabla/transactions/index.ts index b88de3a93..9f41cc091 100644 --- a/packages/shared/src/services/nabla/transactions/index.ts +++ b/packages/shared/src/services/nabla/transactions/index.ts @@ -9,7 +9,6 @@ import { Networks, PendulumTokenDetails } from "../../../index"; -import { NABLA_ROUTER_BASE } from "../../../tokens/constants/misc"; import { prepareNablaApproveTransaction } from "./approve"; import { prepareNablaSwapTransaction } from "./swap"; @@ -66,7 +65,8 @@ export async function createNablaTransactionsForOnrampOnEVM( inputTokenAddress: `0x${string}`, outputTokenAddress: `0x${string}`, nablaHardMinimumOutputRaw: string, - deadlineMinutes: number + deadlineMinutes: number, + routerAddress: `0x${string}` ) { if (ephemeral.type !== "EVM") { throw new Error(`Can't create Nabla EVM transactions for ${ephemeral.type}`); @@ -91,7 +91,7 @@ export async function createNablaTransactionsForOnrampOnEVM( type: "function" } ], - args: [NABLA_ROUTER_BASE, BigInt(amountRaw)], + args: [routerAddress, BigInt(amountRaw)], functionName: "approve" }); @@ -145,7 +145,7 @@ export async function createNablaTransactionsForOnrampOnEVM( gas: "500000", // Higher gas limit for swap maxFeePerGas: swapMaxFee.toString(), maxPriorityFeePerGas: swapMaxPriority.toString(), - to: NABLA_ROUTER_BASE, + to: routerAddress, value: "0" }; diff --git a/packages/shared/src/services/pendulum/apiManager.ts b/packages/shared/src/services/pendulum/apiManager.ts index 000d740b6..23e2b6ca6 100644 --- a/packages/shared/src/services/pendulum/apiManager.ts +++ b/packages/shared/src/services/pendulum/apiManager.ts @@ -2,6 +2,7 @@ import { ApiPromise, WsProvider } from "@polkadot/api"; import { SubmittableExtrinsic } from "@polkadot/api/submittable/types"; import { KeyringPair } from "@polkadot/keyring/types"; import { ISubmittableResult } from "@polkadot/types/types"; +import { getEnvVar } from "../../helpers/environment"; import logger from "../../logger"; export type SubstrateApiNetwork = "assethub" | "pendulum" | "moonbeam" | "hydration" | "paseo"; @@ -11,7 +12,7 @@ export interface NetworkConfig { wsUrls: string[]; } -const NETWORKS: NetworkConfig[] = [ +const DEFAULT_NETWORKS: NetworkConfig[] = [ { name: "assethub", wsUrls: ["wss://dot-rpc.stakeworld.io/assethub"] @@ -34,6 +35,31 @@ const NETWORKS: NetworkConfig[] = [ } ]; +const NETWORK_RPC_ENV_KEYS: Partial> = { + assethub: "ASSETHUB_WSS", + hydration: "HYDRATION_WSS", + moonbeam: "MOONBEAM_WSS" +}; + +function parseWsUrls(value: string): string[] { + return value + .split(",") + .map(url => url.trim()) + .filter(Boolean); +} + +export function getConfiguredNetworks(): NetworkConfig[] { + return DEFAULT_NETWORKS.map(network => { + const envKey = NETWORK_RPC_ENV_KEYS[network.name]; + const configuredWsUrls = envKey ? parseWsUrls(getEnvVar(envKey)) : []; + + return { + ...network, + wsUrls: configuredWsUrls.length > 0 ? configuredWsUrls : network.wsUrls + }; + }); +} + export type API = { api: ApiPromise; ss58Format: number; @@ -58,7 +84,7 @@ export class ApiManager { private usedRpcIndices: Map> = new Map(); private constructor() { - this.networks = NETWORKS; + this.networks = getConfiguredNetworks(); // Initialize nonce maps for each network this.networks.forEach(network => { @@ -75,7 +101,6 @@ export class ApiManager { } public async populateApi(networkName: SubstrateApiNetwork, wsUrlIndex?: number): Promise { - const network = this.getNetworkConfig(networkName); const index = wsUrlIndex ?? 0; const instanceKey = this.generateInstanceKey(networkName, index); const existingInstance = this.apiInstances.get(instanceKey); @@ -126,16 +151,18 @@ export class ApiManager { */ public async getApiWithShuffling(networkName: SubstrateApiNetwork, uuid?: string): Promise { const network = this.getNetworkConfig(networkName); - const usedIndices = uuid ? this.usedRpcIndices.get(uuid) || new Set() : null; + const usedIndices = uuid ? (this.usedRpcIndices.get(uuid) ?? new Set()) : undefined; // Get available indices: all if no UUID, unused ones if UUID provided const availableIndices = uuid - ? network.wsUrls.map((_, index) => index).filter(index => !usedIndices!.has(index)) + ? network.wsUrls.map((_, index) => index).filter(index => !usedIndices?.has(index)) : network.wsUrls.map((_, index) => index); // If no available indices any more, reset the used indices for this UUID and throw if (availableIndices.length === 0) { - this.usedRpcIndices.delete(uuid!); // uuid is guaranteed to be defined here. + if (uuid) { + this.usedRpcIndices.delete(uuid); + } throw new Error(`All RPC endpoints have been used for network ${networkName} with UUID ${uuid}`); } @@ -146,7 +173,7 @@ export class ApiManager { if (!this.usedRpcIndices.has(uuid)) { this.usedRpcIndices.set(uuid, new Set()); } - this.usedRpcIndices.get(uuid)!.add(randomIndex); + this.usedRpcIndices.get(uuid)?.add(randomIndex); } const instanceKey = this.generateInstanceKey(networkName, randomIndex); diff --git a/packages/shared/src/services/squidrouter/onramp.ts b/packages/shared/src/services/squidrouter/onramp.ts index bbdfb2637..aad24dc3c 100644 --- a/packages/shared/src/services/squidrouter/onramp.ts +++ b/packages/shared/src/services/squidrouter/onramp.ts @@ -3,9 +3,7 @@ import { decodeAddress } from "@polkadot/util-crypto"; import { AXL_USDC_MOONBEAM, createRandomString, - createRouteParamsWithMoonbeamPostHook, createSquidRouterHash, - ERC20_EURE_POLYGON_V1, EvmClientManager, EvmNetworks, EvmTransactionData, @@ -179,52 +177,6 @@ export async function createOnrampSquidrouterTransactionsFromBaseToEvm( } // Onramp from Polygon directly to any token on any EVM chain. -export async function createOnrampSquidrouterTransactionsFromPolygonToMoonbeamWithPendulumPosthook( - params: Omit -): Promise { - const evmClientManager = EvmClientManager.getInstance(); - const polygonClient = evmClientManager.getClient(Networks.Polygon); - const fromNetwork = Networks.Polygon; - - const squidRouterReceiverId = createRandomString(32); - const pendulumEphemeralAccountHex = u8aToHex(decodeAddress(params.destinationAddress)); - const squidRouterPayload = encodePayload(pendulumEphemeralAccountHex); - const squidRouterReceiverHash = createSquidRouterHash(squidRouterReceiverId, squidRouterPayload); - const { receivingContractAddress } = getSquidRouterConfig(fromNetwork); - - const routeParams = createRouteParamsWithMoonbeamPostHook({ - ...params, - amount: params.rawAmount, - fromNetwork, - receivingContractAddress, - squidRouterReceiverHash - }); - - try { - const routeResult = await getRoute(routeParams); - const { route } = routeResult.data; - - const { approveData, swapData, squidRouterQuoteId } = await createTransactionDataFromRoute({ - inputTokenErc20Address: ERC20_EURE_POLYGON_V1, - publicClient: polygonClient, - rawAmount: params.rawAmount, - route, - swapValue: computeSwapValueWithSafetyMargin(route.transactionRequest.value) - }); - - return { - approveData, - route, - squidRouterQuoteId, - squidRouterReceiverHash, - squidRouterReceiverId, - swapData - }; - } catch (e) { - throw new Error(`Error getting route: ${JSON.stringify(routeParams)}. Error: ${e}`); - } -} - export async function createOnrampSquidrouterTransactionsOnDestinationChain( params: OnrampSquidrouterParamsOnDestinationChain ): Promise { diff --git a/packages/shared/src/substrateEvents/eventListener.ts b/packages/shared/src/substrateEvents/eventListener.ts index 4618a5dd0..751b86c0f 100644 --- a/packages/shared/src/substrateEvents/eventListener.ts +++ b/packages/shared/src/substrateEvents/eventListener.ts @@ -1,7 +1,7 @@ import { ApiPromise } from "@polkadot/api"; import { EventRecord } from "@polkadot/types/interfaces"; import logger from "../logger"; -import { parseEventRedeemExecution, parseEventXcmSent } from "./eventParsers"; +import { parseEventXcmSent } from "./xcmParsers"; interface IPendingEvent { id: string; @@ -11,7 +11,6 @@ interface IPendingEvent { export class EventListener { static eventListeners = new Map(); - pendingRedeemEvents: IPendingEvent[] = []; pendingXcmSentEvents: IPendingEvent[] = []; api: ApiPromise | undefined = undefined; private unsubscribeHandle: (() => void) | null = null; @@ -39,39 +38,11 @@ export class EventListener { this.unsubscribeHandle = ((await this.api?.query.system.events((events: EventRecord[]) => { events.forEach((event: EventRecord) => { - this.processEvents(event, this.pendingRedeemEvents); this.processEvents(event, this.pendingXcmSentEvents); }); })) as unknown as () => void) || null; } - waitForRedeemExecuteEvent(redeemId: string, maxWaitingTimeMs: number) { - const filter = (event: EventRecord) => { - if (event.event.section === "redeem" && event.event.method === "ExecuteRedeem") { - const eventParsed = parseEventRedeemExecution({ event: event.event }); - if (eventParsed.redeemId === redeemId) { - return eventParsed; - } - } - return null; - }; - - return new Promise((resolve, reject) => { - const timeout = setTimeout(() => { - reject(new Error(`Max waiting time exceeded for Redeem Execution with id: ${redeemId}`)); - }, maxWaitingTimeMs); - - this.pendingRedeemEvents.push({ - filter, - id: redeemId, - resolve: event => { - clearTimeout(timeout); - resolve(event); - } - }); - }); - } - waitForXcmSentEvent(originAddress: string, maxWaitingTimeMs: number) { const filter = (event: EventRecord) => { if (event.event.section === "polkadotXcm" && event.event.method === "Sent") { @@ -111,17 +82,7 @@ export class EventListener { } async checkForMissedEvents() { - const freshApiPromise = this.api; - if (!freshApiPromise || !freshApiPromise.isConnected) return; - - this.pendingRedeemEvents.forEach(pendingEvent => { - const redeemId = pendingEvent.id; - freshApiPromise.query.redeem.redeemRequests(redeemId).then(redeem => { - if (redeem) { - pendingEvent.resolve(redeem); - } - }); - }); + // No-op: redeem/spacewalk event recovery removed with Stellar/Spacewalk deprecation. } unsubscribe() { @@ -130,7 +91,6 @@ export class EventListener { this.unsubscribeHandle = null; } - this.pendingRedeemEvents = []; this.pendingXcmSentEvents = []; if (this.api) { diff --git a/packages/shared/src/substrateEvents/eventParsers.ts b/packages/shared/src/substrateEvents/eventParsers.ts deleted file mode 100644 index 1f6378b48..000000000 --- a/packages/shared/src/substrateEvents/eventParsers.ts +++ /dev/null @@ -1,168 +0,0 @@ -import { Event } from "@polkadot/types/interfaces"; -import { encodeAddress } from "@polkadot/util-crypto"; -import Big from "big.js"; - -import { hexToString, stellarHexToPublic } from "../helpers/conversions"; - -export type SpacewalkRedeemRequestEvent = ReturnType; -export type XcmSentEvent = ReturnType; -export type XTokensEvent = ReturnType; - -export type TokenTransferEvent = ReturnType; - -export function parseEventRedeemRequest({ event }: { event: Event }) { - const rawEventData = JSON.parse(event.data.toString()); - const mappedData = { - amount: parseInt(rawEventData[3].toString(), 10), - asset: extractStellarAssetInfo(rawEventData[4]), - fee: parseInt(rawEventData[5].toString(), 10), - premium: parseInt(rawEventData[6].toString(), 10), - redeemer: rawEventData[1].toString(), - redeemId: rawEventData[0].toString(), - stellarAddress: stellarHexToPublic(rawEventData[7].toString()), - transferFee: parseInt(rawEventData[8].toString(), 10), - vaultId: { - accountId: rawEventData[2].accountId.toString(), - currencies: { - collateral: { - XCM: parseInt(rawEventData[2].currencies.collateral.xcm.toString(), 10) - }, - wrapped: extractStellarAssetInfo(rawEventData[2].currencies.wrapped) - } - } - }; - return mappedData; -} - -export function parseEventRedeemExecution({ event }: { event: Event }) { - const rawEventData = JSON.parse(event.data.toString()); - const mappedData = { - amount: parseInt(rawEventData[3].toString(), 10), - asset: extractStellarAssetInfo(rawEventData[4]), - fee: parseInt(rawEventData[5].toString(), 10), - redeemer: rawEventData[1].toString(), - redeemId: rawEventData[0].toString(), - transferFee: parseInt(rawEventData[6].toString(), 10), - vaultId: { - accountId: rawEventData[2].accountId.toString(), - currencies: { - collateral: { - XCM: parseInt(rawEventData[2].currencies.collateral.xcm.toString(), 10) - }, - wrapped: extractStellarAssetInfo(rawEventData[2].currencies.wrapped) - } - } - }; - return mappedData; -} - -export function parseEventXcmSent({ event }: { event: Event }) { - const rawEventData = JSON.parse(event.data.toString()); - const mappedData = { - originAddress: encodeAddress(rawEventData[0].interior.x1[0].accountId32.id.toString()) - }; - return mappedData; -} - -export function parseEventMoonbeamXcmSent({ event }: { event: Event }) { - const rawEventData = JSON.parse(event.data.toString()); - - const mappedData = { - originAddress: rawEventData[0].interior.x1[0].accountKey20.key - }; - return mappedData; -} - -export function parseEventXTokens({ event }: { event: Event }) { - const rawEventData = JSON.parse(event.data.toString()); - const mappedData = { - sender: rawEventData[0].toString() - }; - return mappedData; -} - -type StellarAssetData = { - stellar: - | { - stellarNative: string; - } - | { - alphaNum4: { - code: string; - issuer: string; - }; - } - | { - alphaNum12: { - code: string; - issuer: string; - }; - }; -}; - -function extractStellarAssetInfo(data: StellarAssetData) { - if ("stellarNative" in data.stellar) { - return { - Stellar: "StellarNative" - }; - } else if ("alphaNum4" in data.stellar) { - return { - Stellar: { - AlphaNum4: { - code: hexToString(data.stellar.alphaNum4.code.toString()), - issuer: stellarHexToPublic(data.stellar.alphaNum4.issuer.toString()) - } - } - }; - } else if ("alphaNum12" in data.stellar) { - return { - Stellar: { - AlphaNum12: { - code: hexToString(data.stellar.alphaNum12.code.toString()), - issuer: stellarHexToPublic(data.stellar.alphaNum12.issuer.toString()) - } - } - }; - } else { - throw new Error("Invalid Stellar type"); - } -} - -export function parseTokenDepositEvent({ event }: { event: Event }) { - const rawEventData = JSON.parse(event.data.toString()); - const mappedData = { - amountRaw: new Big(rawEventData[2].toString()) as Big, - currencyId: rawEventData[0], - to: rawEventData[1].toString() as string - }; - return mappedData; -} - -// Both functions used to compare betweem CurrencyId's -// where {XCM: x} == {xcm: x} -function normalizeObjectKeys(obj: Record): Record { - return Object.keys(obj).reduce((acc: Record, key) => { - acc[key.toLowerCase()] = obj[key]; - return acc; - }, {}); -} - -export function compareObjects(obj1: Record, obj2: Record): boolean { - const normalizedObj1 = normalizeObjectKeys(obj1); - const normalizedObj2 = normalizeObjectKeys(obj2); - - const keys1 = Object.keys(normalizedObj1); - const keys2 = Object.keys(normalizedObj2); - - if (keys1.length !== keys2.length) { - return false; - } - - for (const key of keys1) { - if (normalizedObj1[key] !== normalizedObj2[key]) { - return false; - } - } - - return true; -} diff --git a/packages/shared/src/substrateEvents/index.ts b/packages/shared/src/substrateEvents/index.ts index 21332f4d9..705a1b18f 100644 --- a/packages/shared/src/substrateEvents/index.ts +++ b/packages/shared/src/substrateEvents/index.ts @@ -1,2 +1,2 @@ export * from "./eventListener"; -export * from "./eventParsers"; +export * from "./xcmParsers"; diff --git a/packages/shared/src/substrateEvents/xcmParsers.ts b/packages/shared/src/substrateEvents/xcmParsers.ts new file mode 100644 index 000000000..4b8a6c469 --- /dev/null +++ b/packages/shared/src/substrateEvents/xcmParsers.ts @@ -0,0 +1,30 @@ +import { Event } from "@polkadot/types/interfaces"; +import { encodeAddress } from "@polkadot/util-crypto"; + +export type XcmSentEvent = ReturnType; +export type XTokensEvent = ReturnType; + +export function parseEventXcmSent({ event }: { event: Event }) { + const rawEventData = event.data.toJSON() as any[]; + const mappedData = { + originAddress: encodeAddress(rawEventData[0].interior.x1[0].accountId32.id.toString()) + }; + return mappedData; +} + +export function parseEventMoonbeamXcmSent({ event }: { event: Event }) { + const rawEventData = event.data.toJSON() as any[]; + + const mappedData = { + originAddress: rawEventData[0].interior.x1[0].accountKey20.key + }; + return mappedData; +} + +export function parseEventXTokens({ event }: { event: Event }) { + const rawEventData = event.data.toJSON() as any[]; + const mappedData = { + sender: rawEventData[0].toString() + }; + return mappedData; +} diff --git a/packages/shared/src/tokens/constants/misc.ts b/packages/shared/src/tokens/constants/misc.ts index 66aeb6dfa..6d9f7eaad 100644 --- a/packages/shared/src/tokens/constants/misc.ts +++ b/packages/shared/src/tokens/constants/misc.ts @@ -5,15 +5,44 @@ import { AlfredpayOnChainCurrency } from "../../services/alfredpay/types"; import { EvmToken } from "../types/evm"; -export const HORIZON_URL = "https://horizon.stellar.org"; -export const STELLAR_EPHEMERAL_STARTING_BALANCE_UNITS = "2.5"; // Amount to send to the new stellar ephemeral account created export const PENDULUM_WSS = "wss://rpc-pendulum.prd.pendulumchain.tech"; export const ASSETHUB_WSS = "wss://dot-rpc.stakeworld.io/assethub"; export const MOONBEAM_WSS = "wss://wss.api.moonbeam.network"; export const WALLETCONNECT_ASSETHUB_ID = "polkadot:68d56f15f85d3136970ec16946040bc1"; export const NABLA_ROUTER = "6gAVVw13mQgzzKk4yEwScMmWiCNyMAunXFJUZonbgKrym81N"; // AssetHub USDC instance -export const NABLA_ROUTER_BASE: `0x${string}` = "0x8EF01C38e3261901e382A66bEbFa35E8B96c750C"; -export const NABLA_QUOTER_BASE: `0x${string}` = "0x2A7989993335b31A3133CDA93bc1a095e7b178Ff"; + +// Nabla on Base has two pool instances. Pools are addressed by their router+quoter pair. +// BRLA pool: handles BRLA<>USDC swaps (BRL on/off-ramp flows). +// EURC pool: handles EURC<>USDC swaps (Mykobo EUR on/off-ramp flows). +export const NABLA_ROUTER_BASE_BRLA: `0x${string}` = "0x8EF01C38e3261901e382A66bEbFa35E8B96c750C"; +export const NABLA_QUOTER_BASE_BRLA: `0x${string}` = "0x2A7989993335b31A3133CDA93bc1a095e7b178Ff"; +export const NABLA_ROUTER_BASE_EURC: `0x${string}` = "0x58E5Cb2dA15f01CB8FAefef202aa25238efCBdcf"; +export const NABLA_QUOTER_BASE_EURC: `0x${string}` = "0x94C2F795358170a92271bF2490a56135E3fBA58A"; + +/** + * Selects the Nabla pool (router + quoter) on Base for a given Base ERC20 token pair. + * The token pair determines the pool unambiguously: any pair involving EURC uses the EURC pool; + * any pair involving BRLA uses the BRLA pool. USDC appears in both pools. + * + * Throws if the pair is not supported by either pool (caller bug — token pair was not validated upstream). + */ +export function getNablaBasePool( + inputTokenAddress: `0x${string}`, + outputTokenAddress: `0x${string}` +): { router: `0x${string}`; quoter: `0x${string}` } { + const lcInput = inputTokenAddress.toLowerCase(); + const lcOutput = outputTokenAddress.toLowerCase(); + const lcEurc = ERC20_EURC_BASE.toLowerCase(); + const lcBrla = ERC20_BRLA_BASE.toLowerCase(); + + if (lcInput === lcEurc || lcOutput === lcEurc) { + return { quoter: NABLA_QUOTER_BASE_EURC, router: NABLA_ROUTER_BASE_EURC }; + } + if (lcInput === lcBrla || lcOutput === lcBrla) { + return { quoter: NABLA_QUOTER_BASE_BRLA, router: NABLA_ROUTER_BASE_BRLA }; + } + throw new Error(`getNablaBasePool: no Nabla pool on Base supports the pair ${inputTokenAddress} -> ${outputTokenAddress}`); +} export const SPACEWALK_REDEEM_SAFETY_MARGIN = 0.05; export const AMM_MINIMUM_OUTPUT_SOFT_MARGIN = 0.02; @@ -22,20 +51,19 @@ export const AMM_MINIMUM_OUTPUT_HARD_MARGIN = 0.05; export const TRANSFER_WAITING_TIME_SECONDS = 6000; export const DEFAULT_LOGIN_EXPIRATION_TIME_HOURS = 7 * 24; -// Constants relevant for the Monerium ramps -export const ERC20_EURE_POLYGON_V1: `0x${string}` = "0x18ec0A6E18E5bc3784fDd3a3634b31245ab704F6"; // EUR.e on Polygon export const ERC20_USDC_POLYGON: `0x${string}` = "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359"; // USDC on Polygon export const ERC20_USDT_POLYGON: `0x${string}` = "0xc2132d05d31c914a87c6611c10748aeb04b58e8f"; // USDT on Polygon -// We are currently using both V1 and V2 addresses for EUR.e on Polygon, as Squidrouter uses V1 (presumably, due to pools). -// V2 is used for the permit - transferFrom flow. -// The token balances are synced between both contracts. -export const ERC20_EURE_POLYGON_V2: `0x${string}` = "0xE0aEa583266584DafBB3f9C3211d5588c73fEa8d"; // EUR.e on Polygon V2 -export const ERC20_EURE_POLYGON_TOKEN_NAME = "Monerium EURe"; -export const ERC20_EURE_POLYGON_DECIMALS = 18; // EUR.e on Polygon has 18 decimals export const ERC20_USDC_POLYGON_DECIMALS = 6; // USDC on Polygon has 6 decimals export const ERC20_USDT_POLYGON_DECIMALS = 6; // USDT on Polygon has 6 decimals +export const ERC20_EURC_BASE: `0x${string}` = "0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42"; +export const ERC20_EURC_BASE_TOKEN_NAME = "EURC"; +export const ERC20_EURC_BASE_DECIMALS = 6; +export const ERC20_BRLA_BASE: `0x${string}` = "0xfCB34c47f850f452C15EA1B84d51231C38A61783"; +export const BASE_CHAIN_ID = 8453; +export const BASE_SEPOLIA_CHAIN_ID = 84532; + // ── AlfredPay on-chain token configuration ────────────────────────────────── // Change these constants to switch the stablecoin used in all AlfredPay flows. export const ALFREDPAY_ONCHAIN_CURRENCY = AlfredpayOnChainCurrency.USDT; diff --git a/packages/shared/src/tokens/evm/config.ts b/packages/shared/src/tokens/evm/config.ts index f2ea1c83a..3b6631e53 100644 --- a/packages/shared/src/tokens/evm/config.ts +++ b/packages/shared/src/tokens/evm/config.ts @@ -3,6 +3,7 @@ */ import { EvmNetworks, Networks } from "../../helpers"; +import { ERC20_EURC_BASE, ERC20_EURC_BASE_DECIMALS } from "../constants/misc"; import { PENDULUM_USDC_AXL } from "../pendulum/config"; import { TokenType } from "../types/base"; import { EvmToken, EvmTokenDetails } from "../types/evm"; @@ -216,6 +217,15 @@ export const evmTokenConfig: Record> = { + [FiatToken.EURC]: { + assetSymbol: "EURC", + decimals: 6, + fiat: { + assetIcon: "eur", + name: "Euro", + symbol: "EUR" + }, + maxBuyAmountRaw: "10000000000", + maxSellAmountRaw: "10000000000", + minBuyAmountRaw: "1000000", + minSellAmountRaw: "25000000", + type: TokenType.Fiat + }, [FiatToken.USD]: { alfredpayLimits: USD_LIMITS, assetSymbol: "USD", @@ -128,5 +165,20 @@ export const freeTokenConfig: Partial> = minBuyAmountRaw: "3500000", minSellAmountRaw: "1000000", type: TokenType.Fiat + }, + [FiatToken.ARS]: { + alfredpayLimits: ARS_LIMITS, + assetSymbol: "ARS", + decimals: 2, + fiat: { + assetIcon: "ars", + name: "Argentine Peso", + symbol: "ARS" + }, + maxBuyAmountRaw: "13700000000", + maxSellAmountRaw: "300000000000", + minBuyAmountRaw: "100000", + minSellAmountRaw: "650000", + type: TokenType.Fiat } }; diff --git a/packages/shared/src/tokens/index.ts b/packages/shared/src/tokens/index.ts index addec39cb..d6cb2515d 100644 --- a/packages/shared/src/tokens/index.ts +++ b/packages/shared/src/tokens/index.ts @@ -13,7 +13,6 @@ export * from "./evm/dynamicEvmTokens"; export * from "./freeTokens/config"; export * from "./moonbeam/config"; export * from "./pendulum/config"; -export * from "./stellar/config"; // TokenConfig export * from "./tokenConfig"; export * from "./types/assethub"; @@ -22,7 +21,6 @@ export * from "./types/base"; export * from "./types/evm"; export * from "./types/moonbeam"; export * from "./types/pendulum"; -export * from "./types/stellar"; export * from "./utils/helpers"; export * from "./utils/normalization"; // Utils diff --git a/packages/shared/src/tokens/stellar/config.ts b/packages/shared/src/tokens/stellar/config.ts deleted file mode 100644 index c174e6726..000000000 --- a/packages/shared/src/tokens/stellar/config.ts +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Stellar token configuration - */ - -import { getTomlFileUrl } from "../tokenConfig"; -import { FiatToken, TokenType } from "../types/base"; -import { StellarTokenDetails } from "../types/stellar"; - -export const stellarTokenConfig: Partial> = { - [FiatToken.EURC]: { - anchorHomepageUrl: "https://mykobo.co", - assetSymbol: "EURC", - decimals: 12, - fiat: { - assetIcon: "eur", - name: "Euro", - symbol: "EUR" - }, - maxBuyAmountRaw: "10000000000000000", - maxSellAmountRaw: "10000000000000000", - minBuyAmountRaw: "1000000000000", - minSellAmountRaw: "25000000000000", - pendulumRepresentative: { - assetSymbol: "EURC", - currency: FiatToken.EURC, - currencyId: { - Stellar: { - AlphaNum4: { - code: "0x45555243", - issuer: "0xcf4f5a26e2090bb3adcf02c7a9d73dbfe6659cc690461475b86437fa49c71136" - } - } - }, - decimals: 12, - erc20WrapperAddress: "6eNUvRWCKE3kejoyrJTXiSM7NxtWi37eRXTnKhGKPsJevAj5" - }, - stellarAsset: { - code: { - hex: "0x45555243", - string: "EURC" - }, - issuer: { - hex: "0xcf4f5a26e2090bb3adcf02c7a9d73dbfe6659cc690461475b86437fa49c71136", - stellarEncoding: "GDHU6WRG4IEQXM5NZ4BMPKOXHW76MZM4Y2IEMFDVXBSDP6SJY4ITNPP2" - } - }, - supportsClientDomain: true, - tomlFileUrl: getTomlFileUrl("EURC"), - type: TokenType.Stellar, - usesMemo: false, - vaultAccountId: "6dgJM1ijyHFEfzUokJ1AHq3z3R3Z8ouc8B5SL9YjMRUaLsjh" - }, - [FiatToken.ARS]: { - anchorHomepageUrl: "https://home.anclap.com", - assetSymbol: "ARS", - decimals: 12, - fiat: { - assetIcon: "ars", - name: "Argentine Peso", - symbol: "ARS" - }, - maxBuyAmountRaw: "500000000000000000", - maxSellAmountRaw: "500000000000000000", - minBuyAmountRaw: "11000000000000", - minSellAmountRaw: "11000000000000", - pendulumRepresentative: { - assetSymbol: "ARS", - currency: FiatToken.ARS, - currencyId: { - Stellar: { - AlphaNum4: { - code: "0x41525300", - issuer: "0xb04f8bff207a0b001aec7b7659a8d106e54e659cdf9533528f468e079628fba1" - } - } - }, - decimals: 12, - erc20WrapperAddress: "6f7VMG1ERxpZMvFE2CbdWb7phxDgnoXrdornbV3CCd51nFsj" - }, - stellarAsset: { - code: { - hex: "0x41525300", - string: "ARS" - }, - issuer: { - hex: "0xb04f8bff207a0b001aec7b7659a8d106e54e659cdf9533528f468e079628fba1", - stellarEncoding: "GCYE7C77EB5AWAA25R5XMWNI2EDOKTTFTTPZKM2SR5DI4B4WFD52DARS" - } - }, // 11 ARS - supportsClientDomain: true, // 500000 ARS - tomlFileUrl: getTomlFileUrl("ARS"), // 2% - type: TokenType.Stellar, // 10 ARS - usesMemo: true, - vaultAccountId: "6bE2vjpLRkRNoVDqDtzokxE34QdSJC2fz7c87R9yCVFFDNWs" - } -}; diff --git a/packages/shared/src/tokens/tokenConfig.ts b/packages/shared/src/tokens/tokenConfig.ts index b548f73dc..850181f85 100644 --- a/packages/shared/src/tokens/tokenConfig.ts +++ b/packages/shared/src/tokens/tokenConfig.ts @@ -1,26 +1,4 @@ -// TODO we may now de-duplicate this and use StellarTokenDetails from token configs. - -import { isSandboxEnabled } from "../helpers/environment"; - -export interface StellarTokenConfig { - assetCode: string; - assetIssuer: string; - clientDomainEnabled: boolean; - homeDomain: string; - maximumSubsidyAmountRaw: string; - memoEnabled: boolean; - minWithdrawalAmount: string; - pendulumCurrencyId: { - Stellar: { - AlphaNum4: { - code: string; - issuer: string; - }; - }; - }; - tomlFileUrl: string; - vaultAccountId: string; -} +// TODO we may now de-duplicate this and use token details from token configs. export interface XCMTokenConfig { decimals: number; @@ -30,82 +8,23 @@ export interface XCMTokenConfig { export type MoonbeamTokenConfig = XCMTokenConfig; -export function isStellarTokenConfig(config: StellarTokenConfig | XCMTokenConfig): config is StellarTokenConfig { - return ( - "assetCode" in config && - "assetIssuer" in config && - "clientDomainEnabled" in config && - "homeDomain" in config && - "maximumSubsidyAmountRaw" in config && - "memoEnabled" in config && - "minWithdrawalAmount" in config && - "pendulumCurrencyId" in config && - "tomlFileUrl" in config && - "vaultAccountId" in config - ); -} - -export function isXCMTokenConfig(config: StellarTokenConfig | XCMTokenConfig): config is XCMTokenConfig { +export function isXCMTokenConfig(config: XCMTokenConfig): config is XCMTokenConfig { return "decimals" in config && "maximumSubsidyAmountRaw" in config && "pendulumCurrencyId" in config; } export type TokenConfig = { - ARS: StellarTokenConfig; - EURC: StellarTokenConfig; BRL: MoonbeamTokenConfig; USDC: XCMTokenConfig; GLMR: XCMTokenConfig; "USDC.AXL": XCMTokenConfig; }; -const EURC: StellarTokenConfig = { - assetCode: "EURC", - assetIssuer: "GDHU6WRG4IEQXM5NZ4BMPKOXHW76MZM4Y2IEMFDVXBSDP6SJY4ITNPP2", - clientDomainEnabled: true, - homeDomain: getHomeDomain("EURC"), - maximumSubsidyAmountRaw: "15000000000000", - memoEnabled: false, // 15 units - minWithdrawalAmount: "25000000000000", - pendulumCurrencyId: { - Stellar: { - AlphaNum4: { - code: "0x45555243", - issuer: "0xcf4f5a26e2090bb3adcf02c7a9d73dbfe6659cc690461475b86437fa49c71136" - } - } - }, - tomlFileUrl: getTomlFileUrl("EURC"), - vaultAccountId: "6bsD97dS8ZyomMmp1DLCnCtx25oABtf19dypQKdZe6FBQXSm" -}; - -const ARS: StellarTokenConfig = { - assetCode: "ARS", - assetIssuer: "GCYE7C77EB5AWAA25R5XMWNI2EDOKTTFTTPZKM2SR5DI4B4WFD52DARS", - clientDomainEnabled: true, - homeDomain: "api.anclap.com", - maximumSubsidyAmountRaw: "6000000000000000", // 11 ARS. Anchor minimum limit. - memoEnabled: true, // Defined by us: 6000 unit ~ 6 USD @ Jan/2025 - minWithdrawalAmount: "11000000000000", - pendulumCurrencyId: { - Stellar: { - AlphaNum4: { - code: "0x41525300", - issuer: "0xb04f8bff207a0b001aec7b7659a8d106e54e659cdf9533528f468e079628fba1" - } - } - }, - tomlFileUrl: getTomlFileUrl("ARS"), - vaultAccountId: "6bE2vjpLRkRNoVDqDtzokxE34QdSJC2fz7c87R9yCVFFDNWs" -}; - export const TOKEN_CONFIG: TokenConfig = { - ARS, BRL: { decimals: 18, maximumSubsidyAmountRaw: "86000000000000000000", // 86 units = 15 usd @ Mar/2025 pendulumCurrencyId: { XCM: 13 } }, - EURC, GLMR: { decimals: 18, maximumSubsidyAmountRaw: "0", // This definition is not used to subsidize swaps. @@ -123,13 +42,10 @@ export const TOKEN_CONFIG: TokenConfig = { } }; -export function getTokenConfigByAssetCode( - config: TokenConfig, - assetCode: string -): StellarTokenConfig | XCMTokenConfig | undefined { +export function getTokenConfigByAssetCode(config: TokenConfig, assetCode: string): XCMTokenConfig | undefined { for (const key in config) { const token = config[key as keyof TokenConfig]; - if ("assetCode" in token && token.assetCode === assetCode) { + if (key === assetCode) { return token; } } @@ -139,27 +55,3 @@ export function getTokenConfigByAssetCode( export function getPaddedAssetCode(assetCode: string): string { return assetCode.padEnd(4, "\0"); } - -export function getHomeDomain(assetCode: string): string { - switch (assetCode) { - case "EURC": - return isSandboxEnabled() ? "dev.stellar.mykobo.co" : "stellar.mykobo.co"; - case "ARS": - return "api.anclap.com"; - default: - throw new Error(`Home domain not configured for asset: ${assetCode}`); - } -} - -export function getTomlFileUrl(assetCode: string): string { - switch (assetCode) { - case "EURC": - return isSandboxEnabled() - ? "https://dev.stellar.mykobo.co/.well-known/stellar.toml" - : "https://stellar.mykobo.co/.well-known/stellar.toml"; - case "ARS": - return "https://api.anclap.com/.well-known/stellar.toml"; - default: - throw new Error(`TOML file URL not configured for asset: ${assetCode}`); - } -} diff --git a/packages/shared/src/tokens/types/base.ts b/packages/shared/src/tokens/types/base.ts index 126e20322..8f10b03a6 100644 --- a/packages/shared/src/tokens/types/base.ts +++ b/packages/shared/src/tokens/types/base.ts @@ -3,7 +3,6 @@ import { EvmToken } from "./evm"; export enum TokenType { Evm = "evm", AssetHub = "assethub", - Stellar = "stellar", Moonbeam = "moonbeam", Fiat = "fiat" } @@ -31,7 +30,7 @@ export type NablaToken = OnChainToken; // Combines fiat currencies with tokens in one type export type RampCurrency = FiatToken | OnChainToken; -export type PendulumCurrencyId = { Stellar: { AlphaNum4: { code: string; issuer: string } } } | { XCM: number }; +export type PendulumCurrencyId = { XCM: number }; export interface BaseTokenDetails { type: TokenType; diff --git a/packages/shared/src/tokens/types/evm.ts b/packages/shared/src/tokens/types/evm.ts index e0f2fda4a..9218ca8b6 100644 --- a/packages/shared/src/tokens/types/evm.ts +++ b/packages/shared/src/tokens/types/evm.ts @@ -12,7 +12,8 @@ export enum EvmToken { USDT = "USDT", USDCE = "USDC.E", ETH = "ETH", - BRLA = "BRLA" + BRLA = "BRLA", + EURC = "EURC" } export enum UsdLikeEvmToken { diff --git a/packages/shared/src/tokens/types/stellar.ts b/packages/shared/src/tokens/types/stellar.ts deleted file mode 100644 index ca683e122..000000000 --- a/packages/shared/src/tokens/types/stellar.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Stellar token types - */ - -import { PendulumTokenDetails } from "../types/pendulum"; -import { BaseFiatTokenDetails, BaseTokenDetails, TokenType } from "./base"; - -export interface StellarTokenDetails extends BaseTokenDetails, BaseFiatTokenDetails { - type: TokenType.Stellar; - stellarAsset: { - code: { - hex: string; - string: string; // Stellar (3 or 4 letter) representation - }; - issuer: { - hex: string; - stellarEncoding: string; - }; - }; - vaultAccountId: string; - supportsClientDomain: boolean; - anchorHomepageUrl: string; - tomlFileUrl: string; - usesMemo: boolean; - pendulumRepresentative: PendulumTokenDetails; -} diff --git a/packages/shared/src/tokens/utils/helpers.test.ts b/packages/shared/src/tokens/utils/helpers.test.ts deleted file mode 100644 index e9ad191a7..000000000 --- a/packages/shared/src/tokens/utils/helpers.test.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { describe, expect, it } from "bun:test"; -import { Networks } from "../../helpers"; -import { - ERC20_EURE_POLYGON_DECIMALS, - ERC20_EURE_POLYGON_TOKEN_NAME, - ERC20_EURE_POLYGON_V1, - ERC20_EURE_POLYGON_V2 -} from "../constants/misc"; -import { evmTokenConfig } from "../evm/config"; -import { EvmToken } from "../types/evm"; -import { getEvmTokenDetailsByAddress } from "./helpers"; - -describe("getEvmTokenDetailsByAddress", () => { - it("resolves configured EVM tokens by contract address", () => { - const polygonUsdc = evmTokenConfig[Networks.Polygon][EvmToken.USDC]; - expect(polygonUsdc).toBeDefined(); - if (!polygonUsdc) { - throw new Error("Polygon USDC test fixture is missing"); - } - - const tokenDetails = getEvmTokenDetailsByAddress(Networks.Polygon, polygonUsdc.erc20AddressSourceChain); - - expect(tokenDetails).toEqual(polygonUsdc); - }); - - it("resolves Monerium EUR.e Polygon contracts by address", () => { - for (const tokenAddress of [ERC20_EURE_POLYGON_V1, ERC20_EURE_POLYGON_V2]) { - const tokenDetails = getEvmTokenDetailsByAddress(Networks.Polygon, tokenAddress); - - expect(tokenDetails?.assetSymbol).toBe(ERC20_EURE_POLYGON_TOKEN_NAME); - expect(tokenDetails?.decimals).toBe(ERC20_EURE_POLYGON_DECIMALS); - expect(tokenDetails?.erc20AddressSourceChain).toBe(tokenAddress); - expect(tokenDetails?.network).toBe(Networks.Polygon); - } - }); -}); diff --git a/packages/shared/src/tokens/utils/helpers.ts b/packages/shared/src/tokens/utils/helpers.ts index 202e2759d..8cf75c120 100644 --- a/packages/shared/src/tokens/utils/helpers.ts +++ b/packages/shared/src/tokens/utils/helpers.ts @@ -5,28 +5,17 @@ import { EvmNetworks, isNetworkEVM, Networks } from "../../helpers"; import logger from "../../logger"; import { assetHubTokenConfig } from "../assethub/config"; -import { - ERC20_EURE_POLYGON_DECIMALS, - ERC20_EURE_POLYGON_TOKEN_NAME, - ERC20_EURE_POLYGON_V1, - ERC20_EURE_POLYGON_V2 -} from "../constants/misc"; import { evmTokenConfig } from "../evm/config"; import { getEvmTokenConfig } from "../evm/dynamicEvmTokens"; import { freeTokenConfig } from "../freeTokens/config"; import { moonbeamTokenConfig } from "../moonbeam/config"; -import { PENDULUM_USDC_AXL } from "../pendulum/config"; -import { stellarTokenConfig } from "../stellar/config"; import { AssetHubToken, FiatToken, OnChainToken, OnChainTokenSymbol, RampCurrency, TokenType } from "../types/base"; import { EvmToken, EvmTokenDetails } from "../types/evm"; import { MoonbeamTokenDetails } from "../types/moonbeam"; import { PendulumTokenDetails } from "../types/pendulum"; -import { StellarTokenDetails } from "../types/stellar"; import { normalizeTokenSymbol } from "./normalization"; import { FiatTokenDetails, OnChainTokenDetails } from "./typeGuards"; -const MONERIUM_EURE_POLYGON_ADDRESSES = new Set([ERC20_EURE_POLYGON_V1.toLowerCase(), ERC20_EURE_POLYGON_V2.toLowerCase()]); - /** * Get token details for a specific network and token */ @@ -56,40 +45,6 @@ export function getOnChainTokenDetails( } } -/** - * Resolve an EVM token by contract address on a specific network. - */ -export function getEvmTokenDetailsByAddress( - network: EvmNetworks, - tokenAddress: `0x${string}`, - dynamicEvmTokenConfig?: Record>> -): EvmTokenDetails | undefined { - const normalizedTokenAddress = tokenAddress.toLowerCase(); - const configToUse = dynamicEvmTokenConfig ?? getEvmTokenConfig(); - - const configuredToken = Object.values(configToUse[network] ?? {}).find( - (token): token is EvmTokenDetails => - token !== undefined && token.erc20AddressSourceChain.toLowerCase() === normalizedTokenAddress - ); - if (configuredToken) { - return configuredToken; - } - - if (network === Networks.Polygon && MONERIUM_EURE_POLYGON_ADDRESSES.has(normalizedTokenAddress)) { - return { - assetSymbol: ERC20_EURE_POLYGON_TOKEN_NAME, - decimals: ERC20_EURE_POLYGON_DECIMALS, - erc20AddressSourceChain: tokenAddress, - isNative: false, - network: Networks.Polygon, - pendulumRepresentative: PENDULUM_USDC_AXL, - type: TokenType.Evm - }; - } - - return undefined; -} - /** * Get token details for a specific network and token, with fallback to default */ @@ -128,18 +83,6 @@ export function getOnChainTokenDetailsOrDefault( } } -/** - * Get Stellar token details for a specific fiat token - */ -export function getTokenDetailsSpacewalk(fiatToken: FiatToken): StellarTokenDetails { - const maybeOutputTokenDetails = stellarTokenConfig[fiatToken]; - - if (maybeOutputTokenDetails) { - return maybeOutputTokenDetails; - } - throw new Error(`Invalid fiat token type: ${fiatToken}. Token type is not Stellar.`); -} - /** * Get Moonbeam token details for a specific fiat token */ @@ -153,12 +96,12 @@ export function getAnyFiatTokenDetailsMoonbeam(fiatToken: FiatToken): MoonbeamTo } /** - * Get any fiat token details (Stellar or Moonbeam) + * Get any fiat token details (Moonbeam or free token) */ export function getAnyFiatTokenDetails(fiatToken: FiatToken): FiatTokenDetails { - const tokenDetails = stellarTokenConfig[fiatToken] || moonbeamTokenConfig[fiatToken] || freeTokenConfig[fiatToken]; + const tokenDetails = moonbeamTokenConfig[fiatToken] || freeTokenConfig[fiatToken]; if (!tokenDetails) { - throw new Error(`Invalid fiat token type: ${fiatToken}. Token type is not Stellar or Moonbeam.`); + throw new Error(`Invalid fiat token type: ${fiatToken}. Token is not found in Moonbeam or free token configs.`); } return tokenDetails; } diff --git a/packages/shared/src/tokens/utils/typeGuards.ts b/packages/shared/src/tokens/utils/typeGuards.ts index 3f316fdc6..ed75e69e5 100644 --- a/packages/shared/src/tokens/utils/typeGuards.ts +++ b/packages/shared/src/tokens/utils/typeGuards.ts @@ -6,16 +6,10 @@ import { AssetHubTokenDetails } from "../types/assethub"; import { AssetHubToken, FiatCurrencyDetails, FiatToken, OnChainToken, TokenType } from "../types/base"; import { EvmToken, EvmTokenDetails } from "../types/evm"; import { MoonbeamTokenDetails } from "../types/moonbeam"; -import { StellarTokenDetails } from "../types/stellar"; import { normalizeTokenSymbol } from "./normalization"; -export type TokenDetails = - | EvmTokenDetails - | AssetHubTokenDetails - | StellarTokenDetails - | MoonbeamTokenDetails - | FiatCurrencyDetails; +export type TokenDetails = EvmTokenDetails | AssetHubTokenDetails | MoonbeamTokenDetails | FiatCurrencyDetails; export type OnChainTokenDetails = EvmTokenDetails | AssetHubTokenDetails; -export type FiatTokenDetails = StellarTokenDetails | MoonbeamTokenDetails | FiatCurrencyDetails; +export type FiatTokenDetails = MoonbeamTokenDetails | FiatCurrencyDetails; export type OnChainTokenDetailsWithBalance = OnChainTokenDetails & { balance: string; @@ -36,13 +30,6 @@ export function isAssetHubTokenDetails(token: TokenDetails): token is AssetHubTo return token.type === TokenType.AssetHub; } -/** - * Type guard for Stellar tokens - */ -export function isStellarTokenDetails(token: TokenDetails): token is StellarTokenDetails { - return token.type === TokenType.Stellar; -} - /** * Type guard for Moonbeam tokens */ @@ -65,21 +52,14 @@ export function isOnChainTokenDetails(token: TokenDetails): token is OnChainToke * Type guard for fiat tokens */ export function isFiatTokenDetails(token: TokenDetails): token is FiatTokenDetails { - return isStellarTokenDetails(token) || isMoonbeamTokenDetails(token) || isFiatCurrencyDetails(token); -} - -/** - * Type guard for Stellar output token details - */ -export function isStellarOutputTokenDetails(tokenDetails: Partial): tokenDetails is StellarTokenDetails { - return tokenDetails.type === TokenType.Stellar; + return isMoonbeamTokenDetails(token) || isFiatCurrencyDetails(token); } /** * Type guard for Moonbeam output token details */ export function isMoonbeamOutputTokenDetails( - outputTokenDetails: StellarTokenDetails | MoonbeamTokenDetails + outputTokenDetails: MoonbeamTokenDetails ): outputTokenDetails is MoonbeamTokenDetails { return outputTokenDetails.type === TokenType.Moonbeam; } From 6b5fa3c0e06a5f5fc958f1d01490dcbb584191c7 Mon Sep 17 00:00:00 2001 From: Kacper Szarkiewicz Date: Thu, 18 Jun 2026 14:46:25 +0200 Subject: [PATCH 010/176] fix types ordering divergence --- packages/sdk/src/types.ts | 49 ++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/packages/sdk/src/types.ts b/packages/sdk/src/types.ts index 1b261b33d..8c02862f6 100644 --- a/packages/sdk/src/types.ts +++ b/packages/sdk/src/types.ts @@ -92,18 +92,19 @@ export type AnyAdditionalData = | EurOnrampAdditionalData | AlfredpayOnrampAdditionalData; -export type RegisterRampAdditionalData = Q extends BrlOnrampQuote - ? BrlOnrampAdditionalData - : Q extends EurOnrampQuote - ? EurOnrampAdditionalData - : Q extends AlfredpayOnrampQuote - ? AlfredpayOnrampAdditionalData - : Q extends BrlOfframpQuote - ? BrlOfframpAdditionalData - : Q extends EurOfframpQuote - ? EurOfframpAdditionalData - : Q extends AlfredpayOfframpQuote - ? AlfredpayOfframpAdditionalData +// Branch order mirrors ExtendedQuoteResponse (Alfredpay first per direction). Keys are mutually exclusive, so order is cosmetic here. +export type RegisterRampAdditionalData = Q extends AlfredpayOnrampQuote + ? AlfredpayOnrampAdditionalData + : Q extends BrlOnrampQuote + ? BrlOnrampAdditionalData + : Q extends EurOnrampQuote + ? EurOnrampAdditionalData + : Q extends AlfredpayOfframpQuote + ? AlfredpayOfframpAdditionalData + : Q extends BrlOfframpQuote + ? BrlOfframpAdditionalData + : Q extends EurOfframpQuote + ? EurOfframpAdditionalData : AnyAdditionalData; export interface BrlOnrampAdditionalData { @@ -146,18 +147,18 @@ export type AnyUpdateAdditionalData = | EurOfframpUpdateAdditionalData | AlfredpayOfframpUpdateAdditionalData; -export type UpdateRampAdditionalData = Q extends BrlOnrampQuote - ? never // No additional data required from the user for this type of ramp. - : Q extends EurOnrampQuote - ? EurOnrampUpdateAdditionalData - : Q extends AlfredpayOnrampQuote - ? never // Alfredpay onramp settles fiat off-chain; no user transactions to update. - : Q extends BrlOfframpQuote - ? BrlOfframpUpdateAdditionalData - : Q extends EurOfframpQuote - ? EurOfframpUpdateAdditionalData - : Q extends AlfredpayOfframpQuote - ? AlfredpayOfframpUpdateAdditionalData +export type UpdateRampAdditionalData = Q extends AlfredpayOnrampQuote + ? never // Alfredpay onramp settles fiat off-chain; no user transactions to update. + : Q extends BrlOnrampQuote + ? never // No additional data required from the user for this type of ramp. + : Q extends EurOnrampQuote + ? EurOnrampUpdateAdditionalData + : Q extends AlfredpayOfframpQuote + ? AlfredpayOfframpUpdateAdditionalData + : Q extends BrlOfframpQuote + ? BrlOfframpUpdateAdditionalData + : Q extends EurOfframpQuote + ? EurOfframpUpdateAdditionalData : AnyUpdateAdditionalData; export interface EurOnrampUpdateAdditionalData { From 54f558dd19d3b59a67194d719ebfc69a522af338 Mon Sep 17 00:00:00 2001 From: Kacper Szarkiewicz Date: Thu, 18 Jun 2026 14:50:45 +0200 Subject: [PATCH 011/176] chore(api): remove unused EVM_ADDRESS_REGEX from mykobo-eur-onramp test --- .../api/services/phases/mykobo-eur-onramp.integration.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts b/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts index c8aa982b8..ccfa475bb 100644 --- a/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts +++ b/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts @@ -66,7 +66,6 @@ const TEST_EMAIL = "mail@test.com"; const TEST_IP_ADDRESS = "203.0.113.42"; const filePath = path.join(__dirname, "lastRampStateMykoboEurOnramp.json"); -const EVM_ADDRESS_REGEX = /^0x[a-fA-F0-9]{40}$/; const IBAN_REGEX = /^[A-Z]{2}[0-9A-Z]{2}[0-9A-Z]{4,30}$/; interface TestSigningAccounts { From 0ce09a4c71f94adcb9bf8a40bf0cd2fb32b2c395 Mon Sep 17 00:00:00 2001 From: Kacper Szarkiewicz Date: Thu, 18 Jun 2026 16:11:14 +0200 Subject: [PATCH 012/176] fix(sdk): type AlfredpayHandler signTransactions as PresignedTx[] --- packages/sdk/src/handlers/AlfredpayHandler.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/sdk/src/handlers/AlfredpayHandler.ts b/packages/sdk/src/handlers/AlfredpayHandler.ts index df31d19e6..860ad9be5 100644 --- a/packages/sdk/src/handlers/AlfredpayHandler.ts +++ b/packages/sdk/src/handlers/AlfredpayHandler.ts @@ -2,6 +2,7 @@ import { AccountMeta, EphemeralAccount, EphemeralAccountType, + PresignedTx, RampProcess, RegisterRampRequest, UnsignedTx, @@ -30,7 +31,7 @@ export class AlfredpayHandler implements RampHandler { substrateEphemeral?: EphemeralAccount; evmEphemeral?: EphemeralAccount; } - ) => Promise; + ) => Promise; constructor( apiService: ApiService, @@ -45,7 +46,7 @@ export class AlfredpayHandler implements RampHandler { substrateEphemeral?: EphemeralAccount; evmEphemeral?: EphemeralAccount; } - ) => Promise + ) => Promise ) { this.apiService = apiService; this.context = context; From 16aa52930e2dd901d3f2dad6660409531851313a Mon Sep 17 00:00:00 2001 From: Kacper Szarkiewicz Date: Mon, 22 Jun 2026 11:41:16 +0200 Subject: [PATCH 013/176] fix(api): prevent same-chain offramp/onramp over-subsidy in finalSettlementSubsidy --- .../final-settlement-subsidy.helpers.test.ts | 35 ++++++++++ .../final-settlement-subsidy.helpers.ts | 20 ++++++ .../handlers/final-settlement-subsidy.ts | 14 +++- .../handlers/squid-router-phase-handler.ts | 69 +++++++++++-------- 4 files changed, 107 insertions(+), 31 deletions(-) create mode 100644 apps/api/src/api/services/phases/handlers/final-settlement-subsidy.helpers.test.ts create mode 100644 apps/api/src/api/services/phases/handlers/final-settlement-subsidy.helpers.ts diff --git a/apps/api/src/api/services/phases/handlers/final-settlement-subsidy.helpers.test.ts b/apps/api/src/api/services/phases/handlers/final-settlement-subsidy.helpers.test.ts new file mode 100644 index 000000000..ff88870de --- /dev/null +++ b/apps/api/src/api/services/phases/handlers/final-settlement-subsidy.helpers.test.ts @@ -0,0 +1,35 @@ +import { describe, expect, it } from "bun:test"; +import Big from "big.js"; +import { computeSubsidyRaw } from "./final-settlement-subsidy.helpers"; + +describe("computeSubsidyRaw", () => { + it("clamps to the on-chain shortfall when a same-chain synchronous swap already delivered the output", () => { + // delivered reads 0 because the post-swap snapshot captured the synchronously-swapped USDC, + // but the ephemeral already holds ~expected. Without the clamp this would subsidize the full output. + const expected = new Big("11463276"); + const delivered = new Big("0"); + const actualBalance = new Big("11463243"); + expect(computeSubsidyRaw(expected, delivered, actualBalance).toString()).toBe("33"); + }); + + it("subsidizes the genuine shortfall for an under-delivering cross-chain bridge", () => { + const expected = new Big("1000000"); + const delivered = new Big("950000"); + const actualBalance = new Big("950000"); + expect(computeSubsidyRaw(expected, delivered, actualBalance).toString()).toBe("50000"); + }); + + it("returns <= 0 (no subsidy) when the ephemeral already meets the expected amount", () => { + const expected = new Big("1000000"); + const delivered = new Big("1000000"); + const actualBalance = new Big("1000000"); + expect(computeSubsidyRaw(expected, delivered, actualBalance).lte(0)).toBe(true); + }); + + it("never exceeds the on-chain shortfall even when delivered is understated", () => { + const expected = new Big("1000000"); + const delivered = new Big("0"); + const actualBalance = new Big("800000"); + expect(computeSubsidyRaw(expected, delivered, actualBalance).toString()).toBe("200000"); + }); +}); diff --git a/apps/api/src/api/services/phases/handlers/final-settlement-subsidy.helpers.ts b/apps/api/src/api/services/phases/handlers/final-settlement-subsidy.helpers.ts new file mode 100644 index 000000000..f0279d871 --- /dev/null +++ b/apps/api/src/api/services/phases/handlers/final-settlement-subsidy.helpers.ts @@ -0,0 +1,20 @@ +import Big from "big.js"; + +/** + * How much output token must be subsidized into the ephemeral so it can settle `expectedAmountRaw`. + * + * Primary figure: `expected - delivered`, where `delivered` is measured against the pre-swap + * `preSettlementBalance` snapshot taken in the squidRouter phase. + * + * Clamp: never more than the true on-chain shortfall `expected - actualBalance`. The ephemeral + * already holds `actualBalance`, so it can never need more than that to reach `expected`. This + * guards against a mis-timed snapshot (e.g. a same-chain synchronous swap whose output was already + * captured in `preSettlementBalance`, making `delivered` read ~0) from funding a second full output. + * + * May return a value <= 0, meaning no subsidy is needed. + */ +export function computeSubsidyRaw(expectedAmountRaw: Big, delivered: Big, actualBalance: Big): Big { + const deliveredBased = expectedAmountRaw.minus(delivered); + const onChainShortfall = expectedAmountRaw.minus(actualBalance); + return deliveredBased.gt(onChainShortfall) ? onChainShortfall : deliveredBased; +} diff --git a/apps/api/src/api/services/phases/handlers/final-settlement-subsidy.ts b/apps/api/src/api/services/phases/handlers/final-settlement-subsidy.ts index 8ebe2b380..82f0fbe26 100644 --- a/apps/api/src/api/services/phases/handlers/final-settlement-subsidy.ts +++ b/apps/api/src/api/services/phases/handlers/final-settlement-subsidy.ts @@ -31,6 +31,7 @@ import { priceFeedService } from "../../priceFeed.service"; import { isFiatToOwnStablecoinBaseDirect } from "../../quote/utils"; import { BasePhaseHandler } from "../base-phase-handler"; import { getEvmFundingAccount } from "../evm-funding"; +import { computeSubsidyRaw } from "./final-settlement-subsidy.helpers"; const BALANCE_POLLING_TIME_MS = 5000; const EVM_BALANCE_CHECK_TIMEOUT_MS = 3 * 60 * 1000; // 3 minutes @@ -178,11 +179,22 @@ export class FinalSettlementSubsidyHandler extends BasePhaseHandler { }); logger.debug(`FinalSettlementSubsidyHandler: Funding account balance=${actualBalanceFundingAccount.toString()}`); - const subsidyAmountRaw = expectedAmountRaw.minus(delivered); + // Clamped to the true on-chain shortfall — see computeSubsidyRaw. This bounds any over-subsidy + // from a mis-timed preSettlementBalance snapshot (e.g. same-chain synchronous swaps). + const deliveredBasedSubsidy = expectedAmountRaw.minus(delivered); + const subsidyAmountRaw = computeSubsidyRaw(expectedAmountRaw, delivered, actualBalance); logger.debug( `FinalSettlementSubsidyHandler: subsidyAmountRaw=${subsidyAmountRaw.toString()} (expected=${expectedAmountRaw.toString()} - delivered=${delivered.toString()}, actualBalance=${actualBalance.toString()}, preSettlementBalance=${preBalance.toString()})` ); + if (subsidyAmountRaw.lt(deliveredBasedSubsidy)) { + logger.warn( + `FinalSettlementSubsidyHandler: Clamped subsidy ${deliveredBasedSubsidy.toString()} -> ${subsidyAmountRaw.toString()} ` + + `(actualBalance=${actualBalance.toString()}, expected=${expectedAmountRaw.toString()}, delivered=${delivered.toString()}). ` + + "delivered-calc disagrees with chain balance." + ); + } + if (subsidyAmountRaw.lte(0)) { logger.info( `FinalSettlementSubsidyHandler: Delivered amount (${delivered.toString()}) meets expected amount with actualBalance=${actualBalance.toString()} and preSettlementBalance=${preBalance.toString()}. No subsidy needed.` diff --git a/apps/api/src/api/services/phases/handlers/squid-router-phase-handler.ts b/apps/api/src/api/services/phases/handlers/squid-router-phase-handler.ts index a36b98fd0..6ea360d34 100644 --- a/apps/api/src/api/services/phases/handlers/squid-router-phase-handler.ts +++ b/apps/api/src/api/services/phases/handlers/squid-router-phase-handler.ts @@ -29,6 +29,40 @@ export class SquidRouterPhaseHandler extends BasePhaseHandler { return EvmClientManager.getInstance().getClient(network); } + /** + * Snapshot the ephemeral's destination-token balance BEFORE the swap. finalSettlementSubsidy + * computes delivered = balanceNow - preSettlementBalance, so this must be the pre-delivery + * baseline. Same-chain swaps deliver the output synchronously within the swap tx, so a post-swap + * snapshot would already include the delivered funds and net `delivered` to ~0 (over-subsidy). + * Idempotent: only snapshots on first entry so a retry after the swap cannot overwrite it. + */ + private async snapshotPreSettlementBalance(state: RampState, quote: QuoteTicket, evmEphemeralAddress: string): Promise { + if (state.state.preSettlementBalance !== undefined) { + return; + } + + let preSettlementBalance = "0"; + try { + const destinationNetwork = quote.network as EvmNetworks; + const outTokenDetails = getOnChainTokenDetails(quote.network, quote.outputCurrency); + if (!outTokenDetails || !isEvmTokenDetails(outTokenDetails)) { + throw new Error(`Could not resolve destination token details for ${quote.outputCurrency} on ${destinationNetwork}`); + } + preSettlementBalance = ( + await getEvmBalance({ + chain: destinationNetwork, + ownerAddress: evmEphemeralAddress as `0x${string}`, + tokenDetails: outTokenDetails + }) + ).toString(); + } catch (error) { + logger.warn( + `SquidRouterPhaseHandler: Failed to snapshot pre-settlement balance for ramp ${state.id}; storing 0. Error: ${error}` + ); + } + await state.update({ state: { ...state.state, preSettlementBalance } }); + } + /** * Get the phase name */ @@ -126,6 +160,9 @@ export class SquidRouterPhaseHandler extends BasePhaseHandler { ); } + // Snapshot the destination-token balance BEFORE the swap (see snapshotPreSettlementBalance). + await this.snapshotPreSettlementBalance(state, quote, evmEphemeralAddress); + // Get the presigned transactions for this phase const approveTransaction = this.getPresignedTransaction(state, "squidRouterApprove"); const swapTransaction = this.getPresignedTransaction(state, "squidRouterSwap"); @@ -166,7 +203,7 @@ export class SquidRouterPhaseHandler extends BasePhaseHandler { logger.info(`Swap transaction executed with hash: ${swapHash}`); // Update the state with the transaction hashes - let updatedState = await state.update({ + const updatedState = await state.update({ state: { ...state.state, squidRouterSwapHash: swapHash @@ -177,35 +214,7 @@ export class SquidRouterPhaseHandler extends BasePhaseHandler { await this.waitForTransactionConfirmation(sourceNetwork, swapHash); logger.info(`Swap transaction confirmed: ${swapHash}`); - let preSettlementBalance = "0"; - try { - const destinationNetwork = quote.network as EvmNetworks; - const outTokenDetails = getOnChainTokenDetails(quote.network, quote.outputCurrency); - - if (!outTokenDetails || !isEvmTokenDetails(outTokenDetails)) { - throw new Error(`Could not resolve destination token details for ${quote.outputCurrency} on ${destinationNetwork}`); - } - - preSettlementBalance = ( - await getEvmBalance({ - chain: destinationNetwork, - ownerAddress: state.state.evmEphemeralAddress as `0x${string}`, - tokenDetails: outTokenDetails - }) - ).toString(); - } catch (error) { - logger.warn( - `SquidRouterPhaseHandler: Failed to snapshot pre-settlement balance for ramp ${state.id}; storing 0. Error: ${error}` - ); - } - - updatedState = await updatedState.update({ - state: { - ...updatedState.state, - preSettlementBalance - } - }); - + // preSettlementBalance was captured before the swap (see above); do not re-snapshot here. // Transition to the next phase return this.transitionToNextPhase(updatedState, "squidRouterPay"); } catch (error) { From a647227f85c77879fad6e7dc5975b651b0fc3b6e Mon Sep 17 00:00:00 2001 From: Kacper Szarkiewicz Date: Mon, 22 Jun 2026 11:41:28 +0200 Subject: [PATCH 014/176] =?UTF-8?q?feat(sdk):=20complete=20Alfredpay=20off?= =?UTF-8?q?ramp=20=E2=80=94=20user-signature=20submission=20+=20EIP-712=20?= =?UTF-8?q?helpers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sdk/examples/exampleAlfredpayMexico.ts | 213 ++++++++++++++++++ packages/sdk/src/VortexSdk.ts | 55 +++++ packages/sdk/src/eip712.ts | 77 +++++++ packages/sdk/test/eip712.test.ts | 98 ++++++++ 4 files changed, 443 insertions(+) create mode 100644 packages/sdk/examples/exampleAlfredpayMexico.ts create mode 100644 packages/sdk/src/eip712.ts create mode 100644 packages/sdk/test/eip712.test.ts diff --git a/packages/sdk/examples/exampleAlfredpayMexico.ts b/packages/sdk/examples/exampleAlfredpayMexico.ts new file mode 100644 index 000000000..1ad4efaea --- /dev/null +++ b/packages/sdk/examples/exampleAlfredpayMexico.ts @@ -0,0 +1,213 @@ +// @ts-nocheck + +// Manual end-to-end example for the Mexico (MXN) Alfredpay flow, both directions. +// MXN settles via SPEI (EPaymentMethod.SPEI). Mirrors the README Alfredpay sections +// Real SDK contract: createQuote -> registerRamp -> (onramp: startRamp) / +// (offramp: sign user txs via submitUserSignature/submitUserTxHash) -> startRamp. +// +// Requires a running backend (default http://localhost:3000) with Alfredpay enabled. +// Replace the placeholder addresses / fiatAccountId before running. +// +// Run: +// cd packages/sdk +// bun run examples/exampleAlfredpayMexico.ts onramp +// bun run examples/exampleAlfredpayMexico.ts offramp # default + +import * as fs from "fs"; +import * as readline from "readline"; +import { privateKeyToAccount } from "viem/accounts"; +import { CreateQuoteRequest, EPaymentMethod, EvmToken, FiatToken, Networks, QuoteResponse, RampDirection } from "../src/index"; +import { VortexSdkConfig } from "../src/types"; +import { VortexSdk } from "../src/VortexSdk"; + +// Optional: sign offramp permits locally (viem) with a throwaway wallet that holds the test USDC. +// viem derives the EIP712Domain canonically, so its signatures match the backend's ethers +// verifyTypedData exactly. If unset, you sign in your own wallet and paste the signature. +const OFFRAMP_WALLET_PRIVATE_KEY = process.env.OFFRAMP_WALLET_PRIVATE_KEY as `0x${string}` | undefined; +const OFFRAMP_WALLET_ADDRESS = OFFRAMP_WALLET_PRIVATE_KEY + ? privateKeyToAccount(OFFRAMP_WALLET_PRIVATE_KEY).address + : "0xYOUR_WALLET_ADDRESS"; +const DESTINATION_ADDRESS = "0xYOUR_WALLET_ADDRESS"; +const WALLET_ADDRESS = "0xYOUR_WALLET_ADDRESS"; +const FIAT_ACCOUNT_ID = "00000000-0000-0000-0000-000000000000"; + +function askQuestion(query: string): Promise { + const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); + return new Promise(resolve => { + rl.question(query, (ans: string) => { + rl.close(); + resolve(ans.trim()); + }); + }); +} + +function buildSdk(): VortexSdk { + const config: VortexSdkConfig = { + apiBaseUrl: "http://localhost:3000", + autoReconnect: true, + publicKey: "pk_live_REPLACE_ME", + storeEphemeralKeys: true + }; + return new VortexSdk(config); +} + +function logQuote(quote: QuoteResponse): void { + console.log("✅ Quote created:"); + console.log(` Quote ID: ${quote.id}`); + console.log(` Input: ${quote.inputAmount} ${quote.inputCurrency}`); + console.log(` Output: ${quote.outputAmount} ${quote.outputCurrency}`); + console.log(` Total Fee: ${quote.totalFeeFiat} ${quote.feeCurrency}`); + console.log(` Expires at: ${quote.expiresAt}\n`); +} + +// USDT on Polygon — the token Alfredpay mints; what you deposit to the ephemeral to simulate the fiat pay-in. +const USDT_POLYGON_ADDRESS = "0xc2132d05d31c914a87c6611c10748aeb04b58e8f"; // 6 decimals + +// The SDK writes ephemeral keys to ./ephemerals_.json (storeEphemeralKeys: true). +function readEphemeralEvmAddress(rampId: string): string | undefined { + try { + const items = JSON.parse(fs.readFileSync(`ephemerals_${rampId}.json`, "utf-8")); + return items.find((i: { type: string; address: string }) => i.type === "EVM")?.address; + } catch { + return undefined; + } +} + +// Onramp: MXN -> USDC. User pays SPEI instructions; crypto lands at destinationAddress. +// No user-signed transactions; fiatAccountId is NOT required for onramp. +async function runMexicoOnramp(sdk: VortexSdk): Promise { + console.log("📝 Step 1: Creating quote for MXN onramp (MXN -> USDC via SPEI)..."); + const quoteRequest: CreateQuoteRequest = { + from: EPaymentMethod.SPEI, + inputAmount: "201", + inputCurrency: FiatToken.MXN, + network: Networks.Polygon, + outputCurrency: EvmToken.USDC, + rampType: RampDirection.BUY, + to: Networks.Polygon + }; + + const quote = await sdk.createQuote(quoteRequest); + logQuote(quote); + + console.log("📝 Step 2: Registering onramp (destinationAddress only — fiatAccountId optional)..."); + const { rampProcess } = await sdk.registerRamp(quote, { + destinationAddress: DESTINATION_ADDRESS, + walletAddress: WALLET_ADDRESS + }); + console.log(`✅ Onramp registered. Ramp ID: ${rampProcess.id}`); + + console.log("📝 Step 3: Starting onramp..."); + const startedRamp = await sdk.startRamp(rampProcess.id); + + // To complete the onramp WITHOUT paying fiat, deposit USDT to the ephemeral so the + // alfredpayOnrampMint balance check passes (it trusts the on-chain balance as ground truth). + const ephemeralEvmAddress = readEphemeralEvmAddress(rampProcess.id); + console.log("\n🏦 To complete the onramp, deposit USDT on POLYGON to the ephemeral address:"); + console.log(` • Send USDT to: ${ephemeralEvmAddress ?? ``}`); + console.log(` • USDT token (Polygon): ${USDT_POLYGON_ADDRESS} (6 decimals)`); + console.log(` • Amount: a little more than ${quote.outputAmount} USDC-equivalent in USDT`); + console.log(" (exact raw amount is in the backend 'AlfredpayOnrampMintHandler: Waiting for ...' log)"); + + if (startedRamp.achPaymentData) { + console.log("\n(SPEI fiat instructions, not needed for the deposit-to-ephemeral test):"); + console.log(startedRamp.achPaymentData); + } +} + +// Offramp: USDC -> MXN. SDK returns user-side EVM transactions to sign; push the +// resulting hashes back via updateRamp, then start. fiatAccountId is REQUIRED here. +async function runMexicoOfframp(sdk: VortexSdk): Promise { + console.log("📝 Step 1: Creating quote for MXN offramp (USDC -> MXN via SPEI)..."); + const quoteRequest: CreateQuoteRequest = { + from: Networks.Polygon, + inputAmount: "10", + inputCurrency: EvmToken.USDC, + network: Networks.Polygon, + outputCurrency: FiatToken.MXN, + rampType: RampDirection.SELL, + to: EPaymentMethod.SPEI + }; + + const quote = await sdk.createQuote(quoteRequest); + logQuote(quote); + + console.log("📝 Step 2: Registering offramp (fiatAccountId + walletAddress required)..."); + const { rampProcess, unsignedTransactions } = await sdk.registerRamp(quote, { + fiatAccountId: FIAT_ACCOUNT_ID, + walletAddress: OFFRAMP_WALLET_ADDRESS + }); + console.log(`✅ Offramp registered. Ramp ID: ${rampProcess.id}`); + + // Handle each user transaction with the SDK's helpers (no EIP-712 reconstruction needed here). + const localAccount = OFFRAMP_WALLET_PRIVATE_KEY ? privateKeyToAccount(OFFRAMP_WALLET_PRIVATE_KEY) : undefined; + + for (const tx of unsignedTransactions) { + if (sdk.getUserTransactionType(tx) === "evm-typed-data") { + // A typed-data tx may carry several payloads (e.g. permit + relayer payload). Sign each in order. + const payloads = sdk.getTypedDataToSign(tx); // wagmi / viem signTypedData-ready + const v4Payloads = sdk.getTypedDataToSign(tx, { includeDomainType: true }); // eth_signTypedData_v4-ready + const signatures: string[] = []; + + for (let i = 0; i < payloads.length; i++) { + if (localAccount) { + signatures.push(await localAccount.signTypedData(payloads[i])); + console.log( + ` [${i + 1}/${payloads.length}] ${payloads[i].primaryType} signed locally by ${localAccount.address}` + ); + } else { + console.log( + `\n----- sign payload ${i + 1}/${payloads.length}: ${payloads[i].primaryType} (account ${tx.signer}) -----` + ); + console.log(JSON.stringify(v4Payloads[i], null, 2)); + signatures.push(await askQuestion(`➡️ Signature for ${payloads[i].primaryType}: `)); + } + } + + console.log(`📝 Submitting ${signatures.length} signature(s) for ${tx.phase}...`); + await sdk.submitUserSignature(rampProcess.id, tx, signatures); + console.log(`✅ Submitted signature(s) for ${tx.phase}.`); + } else { + // Broadcast path: user sends the EVM tx from their wallet, then pushes the hash back. + const evmTx = sdk.getTransactionToBroadcast(tx); + console.log(`\n🛑 Broadcast ${tx.phase} from your wallet: to=${evmTx.to} value=${evmTx.value} data=${evmTx.data}`); + const hash = await askQuestion(`➡️ Tx hash for ${tx.phase}: `); + await sdk.submitUserTxHash(rampProcess.id, tx, hash); + console.log(`✅ Submitted hash for ${tx.phase}.`); + } + } + + console.log("📝 Step 4: Starting offramp..."); + await sdk.startRamp(rampProcess.id); + console.log("✅ Offramp started."); +} + +async function main(): Promise { + const direction = (process.argv[2] ?? "offramp").toLowerCase(); + console.log(`Starting Mexico (MXN) Alfredpay ${direction} example...\n`); + + const sdk = buildSdk(); + + if (direction === "onramp") { + await runMexicoOnramp(sdk); + } else if (direction === "offramp") { + await runMexicoOfframp(sdk); + } else { + throw new Error(`Unknown direction "${direction}". Use "onramp" or "offramp".`); + } +} + +if (require.main === module) { + main() + .then(() => { + console.log("\n✨ Example execution completed"); + process.exit(0); + }) + .catch(error => { + console.error("\n💥 Example execution failed:", error); + if (error instanceof Error) { + console.error("Error message:", error.message); + } + process.exit(1); + }); +} diff --git a/packages/sdk/src/VortexSdk.ts b/packages/sdk/src/VortexSdk.ts index 04dc8a865..286e438e0 100644 --- a/packages/sdk/src/VortexSdk.ts +++ b/packages/sdk/src/VortexSdk.ts @@ -5,6 +5,7 @@ import { createPendulumEphemeral, EphemeralAccount, EphemeralAccountType, + EvmTransactionData, GetRampStatusResponse, isAlfredpayToken, isEvmTransactionData, @@ -15,9 +16,11 @@ import { QuoteResponse, RampDirection, RampProcess, + SignedTypedData, signUnsignedTransactions, UnsignedTx } from "@vortexfi/shared"; +import { attachSignatures, typedDataToSign, userTransactionType } from "./eip712"; import { TransactionSigningError } from "./errors"; import { AlfredpayHandler } from "./handlers/AlfredpayHandler"; import { BrlHandler } from "./handlers/BrlHandler"; @@ -172,6 +175,58 @@ export class VortexSdk { return this.brlHandler.startBrlRamp(rampId); } + /** + * Submit a user signature for an EIP-712 typed-data transaction (e.g. an offramp permit) returned + * by registerRamp in `unsignedTransactions`. The user's wallet signs the typed data off-chain + * (e.g. eth_signTypedData_v4 / wagmi signTypedData); pass the resulting 65-byte hex signature here. + * The signature is attached to the transaction and submitted to Vortex. + */ + async submitUserSignature(rampId: string, tx: UnsignedTx, signatures: string | string[]): Promise { + const sigList = Array.isArray(signatures) ? signatures : [signatures]; + const signedTxData = attachSignatures(tx, sigList); + return this.apiService.updateRamp({ additionalData: {}, presignedTxs: [{ ...tx, txData: signedTxData }], rampId }); + } + + /** + * Classify a user transaction returned in `unsignedTransactions`: + * - "evm-typed-data": sign it (e.g. an offramp permit) and submit via submitUserSignature. + * - "evm-transaction": broadcast it from the user wallet and submit the hash via submitUserTxHash. + */ + getUserTransactionType(tx: UnsignedTx): "evm-typed-data" | "evm-transaction" { + return userTransactionType(tx); + } + + /** + * Return the EIP-712 payload(s) to sign for a typed-data user transaction. A single transaction + * may carry more than one payload (e.g. a permit + a relayer payload) — sign each, in order, and + * pass the signatures to submitUserSignature in the same order. + * + * Default output is ready for wagmi / viem `signTypedData` (they derive EIP712Domain themselves). + * Pass { includeDomainType: true } to also emit the EIP712Domain type entry, as required by the + * low-level `eth_signTypedData_v4` JSON-RPC call. + */ + getTypedDataToSign(tx: UnsignedTx, options: { includeDomainType?: boolean } = {}): SignedTypedData[] { + return typedDataToSign(tx, options); + } + + /** + * Return the EVM transaction to broadcast for an "evm-transaction" user transaction. + */ + getTransactionToBroadcast(tx: UnsignedTx): EvmTransactionData { + if (this.getUserTransactionType(tx) !== "evm-transaction") { + throw new Error(`getTransactionToBroadcast: phase ${tx.phase} is not a broadcastable EVM transaction.`); + } + return tx.txData as EvmTransactionData; + } + + /** + * Submit the hash of a user-broadcast EVM transaction (e.g. squidRouter approve/swap) to Vortex. + * The hash is recorded against the transaction's phase (e.g. `squidRouterApproveHash`). + */ + async submitUserTxHash(rampId: string, tx: UnsignedTx, hash: string): Promise { + return this.apiService.updateRamp({ additionalData: { [`${tx.phase}Hash`]: hash }, presignedTxs: [], rampId }); + } + public async storeEphemerals( ephemerals: { [key in EphemeralAccountType]?: EphemeralAccount }, rampId: string diff --git a/packages/sdk/src/eip712.ts b/packages/sdk/src/eip712.ts new file mode 100644 index 000000000..913e3221a --- /dev/null +++ b/packages/sdk/src/eip712.ts @@ -0,0 +1,77 @@ +import type { SignedTypedData, UnsignedTx } from "@vortexfi/shared"; + +export const EIP712_DOMAIN_FIELD_TYPES: Record = { + chainId: "uint256", + name: "string", + salt: "bytes32", + verifyingContract: "address", + version: "string" +}; + +// Canonical EIP712Domain field order (ethers/viem use this). Required when emitting a payload for +// the low-level eth_signTypedData_v4 JSON-RPC call, which needs the EIP712Domain type spelled out. +// A non-canonical order produces a different domain hash and breaks signature recovery. +export const EIP712_DOMAIN_FIELD_ORDER = ["name", "version", "chainId", "verifyingContract", "salt"]; + +export function isTypedDataItem(item: unknown): item is SignedTypedData { + return typeof item === "object" && item !== null && "primaryType" in item; +} + +export function userTransactionType(tx: UnsignedTx): "evm-typed-data" | "evm-transaction" { + const first = Array.isArray(tx.txData) ? tx.txData[0] : tx.txData; + return isTypedDataItem(first) ? "evm-typed-data" : "evm-transaction"; +} + +export function typedDataToSign(tx: UnsignedTx, options: { includeDomainType?: boolean } = {}): SignedTypedData[] { + const items = (Array.isArray(tx.txData) ? tx.txData : [tx.txData]).filter(isTypedDataItem); + if (!options.includeDomainType) { + return items; + } + return items.map(item => ({ + ...item, + types: { + EIP712Domain: EIP712_DOMAIN_FIELD_ORDER.filter(field => field in item.domain).map(field => ({ + name: field, + type: EIP712_DOMAIN_FIELD_TYPES[field] + })), + ...item.types + } + })); +} + +/** + * Attach user signatures to the typed-data payload(s) of a transaction, producing the signed + * txData to submit. A transaction may carry several payloads (e.g. permit + relayer payload); + * `signatures` must line up one-to-one, in order. + */ +export function attachSignatures(tx: UnsignedTx, signatures: string[]): SignedTypedData[] { + const items = typedDataToSign(tx); + if (items.length === 0) { + throw new Error(`attachSignatures: phase ${tx.phase} has no typed-data payloads to sign.`); + } + if (signatures.length !== items.length) { + throw new Error(`attachSignatures: phase ${tx.phase} expects ${items.length} signature(s), got ${signatures.length}.`); + } + return items.map((item, i) => { + const { v, r, s } = splitSignature(signatures[i]); + const deadline = Number((item.message as Record).deadline ?? 0); + return { ...item, signature: { deadline, r, s, v } }; + }); +} + +// Split a 65-byte hex signature (eth_signTypedData_v4 / personal_sign output) into {v, r, s}. +export function splitSignature(signature: string): { v: number; r: `0x${string}`; s: `0x${string}` } { + // Tolerate pasted values wrapped in quotes / whitespace. + const cleaned = signature.trim().replace(/^['"]+|['"]+$/g, ""); + const hex = cleaned.startsWith("0x") ? cleaned.slice(2) : cleaned; + if (hex.length !== 130) { + throw new Error(`Invalid signature: expected a 65-byte hex string, got ${cleaned.length} chars.`); + } + const r = `0x${hex.slice(0, 64)}` as `0x${string}`; + const s = `0x${hex.slice(64, 128)}` as `0x${string}`; + let v = Number.parseInt(hex.slice(128, 130), 16); + if (v < 27) { + v += 27; + } + return { r, s, v }; +} diff --git a/packages/sdk/test/eip712.test.ts b/packages/sdk/test/eip712.test.ts new file mode 100644 index 000000000..9adc0e1b2 --- /dev/null +++ b/packages/sdk/test/eip712.test.ts @@ -0,0 +1,98 @@ +import { describe, expect, it } from "bun:test"; +import { attachSignatures, splitSignature, typedDataToSign, userTransactionType } from "../src/eip712"; + +const tx = (txData: unknown) => ({ meta: {}, network: "polygon", nonce: 0, phase: "squidRouterPermitExecute", signer: "0xabc", txData }) as never; + +const saltPermit = { + // domain key order is intentionally non-canonical (as Polygon USDC returns it) + domain: { name: "USD Coin", salt: "0x0000000000000000000000000000000000000000000000000000000000000089", verifyingContract: "0xc2", version: "2" }, + message: { deadline: "1700000000", nonce: "0", owner: "0xabc", spender: "0xdef", value: "10" }, + primaryType: "Permit", + types: { Permit: [{ name: "owner", type: "address" }] } +}; + +describe("userTransactionType", () => { + it("classifies a single typed-data payload", () => { + expect(userTransactionType(tx(saltPermit))).toBe("evm-typed-data"); + }); + it("classifies an array of typed-data payloads", () => { + expect(userTransactionType(tx([saltPermit, saltPermit]))).toBe("evm-typed-data"); + }); + it("classifies a raw EVM transaction (object)", () => { + expect(userTransactionType(tx({ data: "0x", to: "0x1", value: "0" }))).toBe("evm-transaction"); + }); + it("classifies a raw EVM transaction (string)", () => { + expect(userTransactionType(tx("0xdeadbeef"))).toBe("evm-transaction"); + }); +}); + +describe("typedDataToSign", () => { + it("returns raw payloads for wagmi/viem (no EIP712Domain) by default", () => { + const [payload] = typedDataToSign(tx(saltPermit)); + expect("EIP712Domain" in payload.types).toBe(false); + }); + + it("returns every payload in a multi-payload tx", () => { + expect(typedDataToSign(tx([saltPermit, saltPermit]))).toHaveLength(2); + }); + + it("emits EIP712Domain in CANONICAL order for eth_signTypedData_v4 (not domain key order)", () => { + const [payload] = typedDataToSign(tx(saltPermit), { includeDomainType: true }); + // Domain object order is name, salt, verifyingContract, version — but ethers/viem require + // name, version, verifyingContract, salt. A wrong order broke signature recovery in testing. + expect((payload.types.EIP712Domain as { name: string }[]).map(f => f.name)).toEqual([ + "name", + "version", + "verifyingContract", + "salt" + ]); + }); + + it("includes chainId (and omits salt) for a standard domain", () => { + const standard = { ...saltPermit, domain: { chainId: 137, name: "X", verifyingContract: "0x1", version: "1" } }; + const [payload] = typedDataToSign(tx(standard), { includeDomainType: true }); + expect((payload.types.EIP712Domain as { name: string }[]).map(f => f.name)).toEqual([ + "name", + "version", + "chainId", + "verifyingContract" + ]); + }); +}); + +describe("attachSignatures", () => { + const sig = `0x${"a".repeat(64)}${"b".repeat(64)}1b`; + + it("attaches a {v,r,s,deadline} signature to each payload", () => { + const [signed] = attachSignatures(tx(saltPermit), [sig]); + expect(signed.signature).toEqual({ deadline: 1700000000, r: `0x${"a".repeat(64)}`, s: `0x${"b".repeat(64)}`, v: 27 }); + }); + + it("signs every payload of a multi-payload tx", () => { + expect(attachSignatures(tx([saltPermit, saltPermit]), [sig, sig])).toHaveLength(2); + }); + + it("throws when the signature count does not match the payload count", () => { + expect(() => attachSignatures(tx([saltPermit, saltPermit]), [sig])).toThrow(); + }); + + it("throws when the transaction has no typed-data payloads", () => { + expect(() => attachSignatures(tx({ data: "0x", to: "0x1", value: "0" }), [sig])).toThrow(); + }); +}); + +describe("splitSignature", () => { + const sig = `0x${"a".repeat(64)}${"b".repeat(64)}1b`; + it("splits a 65-byte hex signature into v/r/s", () => { + expect(splitSignature(sig)).toEqual({ r: `0x${"a".repeat(64)}`, s: `0x${"b".repeat(64)}`, v: 27 }); + }); + it("tolerates surrounding quotes and whitespace", () => { + expect(splitSignature(` '${sig}' `)).toEqual({ r: `0x${"a".repeat(64)}`, s: `0x${"b".repeat(64)}`, v: 27 }); + }); + it("normalizes v from 0/1 to 27/28", () => { + expect(splitSignature(`0x${"a".repeat(64)}${"b".repeat(64)}00`).v).toBe(27); + }); + it("rejects a wrong-length signature", () => { + expect(() => splitSignature("0x1234")).toThrow(); + }); +}); From e7296aa5c0ad8f1f66987e2218793b801db2651f Mon Sep 17 00:00:00 2001 From: Kacper Szarkiewicz Date: Mon, 22 Jun 2026 11:47:32 +0200 Subject: [PATCH 015/176] remove console.logs --- .../sdk/examples/exampleAlfredpayMexico.ts | 213 ------------------ 1 file changed, 213 deletions(-) delete mode 100644 packages/sdk/examples/exampleAlfredpayMexico.ts diff --git a/packages/sdk/examples/exampleAlfredpayMexico.ts b/packages/sdk/examples/exampleAlfredpayMexico.ts deleted file mode 100644 index 1ad4efaea..000000000 --- a/packages/sdk/examples/exampleAlfredpayMexico.ts +++ /dev/null @@ -1,213 +0,0 @@ -// @ts-nocheck - -// Manual end-to-end example for the Mexico (MXN) Alfredpay flow, both directions. -// MXN settles via SPEI (EPaymentMethod.SPEI). Mirrors the README Alfredpay sections -// Real SDK contract: createQuote -> registerRamp -> (onramp: startRamp) / -// (offramp: sign user txs via submitUserSignature/submitUserTxHash) -> startRamp. -// -// Requires a running backend (default http://localhost:3000) with Alfredpay enabled. -// Replace the placeholder addresses / fiatAccountId before running. -// -// Run: -// cd packages/sdk -// bun run examples/exampleAlfredpayMexico.ts onramp -// bun run examples/exampleAlfredpayMexico.ts offramp # default - -import * as fs from "fs"; -import * as readline from "readline"; -import { privateKeyToAccount } from "viem/accounts"; -import { CreateQuoteRequest, EPaymentMethod, EvmToken, FiatToken, Networks, QuoteResponse, RampDirection } from "../src/index"; -import { VortexSdkConfig } from "../src/types"; -import { VortexSdk } from "../src/VortexSdk"; - -// Optional: sign offramp permits locally (viem) with a throwaway wallet that holds the test USDC. -// viem derives the EIP712Domain canonically, so its signatures match the backend's ethers -// verifyTypedData exactly. If unset, you sign in your own wallet and paste the signature. -const OFFRAMP_WALLET_PRIVATE_KEY = process.env.OFFRAMP_WALLET_PRIVATE_KEY as `0x${string}` | undefined; -const OFFRAMP_WALLET_ADDRESS = OFFRAMP_WALLET_PRIVATE_KEY - ? privateKeyToAccount(OFFRAMP_WALLET_PRIVATE_KEY).address - : "0xYOUR_WALLET_ADDRESS"; -const DESTINATION_ADDRESS = "0xYOUR_WALLET_ADDRESS"; -const WALLET_ADDRESS = "0xYOUR_WALLET_ADDRESS"; -const FIAT_ACCOUNT_ID = "00000000-0000-0000-0000-000000000000"; - -function askQuestion(query: string): Promise { - const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); - return new Promise(resolve => { - rl.question(query, (ans: string) => { - rl.close(); - resolve(ans.trim()); - }); - }); -} - -function buildSdk(): VortexSdk { - const config: VortexSdkConfig = { - apiBaseUrl: "http://localhost:3000", - autoReconnect: true, - publicKey: "pk_live_REPLACE_ME", - storeEphemeralKeys: true - }; - return new VortexSdk(config); -} - -function logQuote(quote: QuoteResponse): void { - console.log("✅ Quote created:"); - console.log(` Quote ID: ${quote.id}`); - console.log(` Input: ${quote.inputAmount} ${quote.inputCurrency}`); - console.log(` Output: ${quote.outputAmount} ${quote.outputCurrency}`); - console.log(` Total Fee: ${quote.totalFeeFiat} ${quote.feeCurrency}`); - console.log(` Expires at: ${quote.expiresAt}\n`); -} - -// USDT on Polygon — the token Alfredpay mints; what you deposit to the ephemeral to simulate the fiat pay-in. -const USDT_POLYGON_ADDRESS = "0xc2132d05d31c914a87c6611c10748aeb04b58e8f"; // 6 decimals - -// The SDK writes ephemeral keys to ./ephemerals_.json (storeEphemeralKeys: true). -function readEphemeralEvmAddress(rampId: string): string | undefined { - try { - const items = JSON.parse(fs.readFileSync(`ephemerals_${rampId}.json`, "utf-8")); - return items.find((i: { type: string; address: string }) => i.type === "EVM")?.address; - } catch { - return undefined; - } -} - -// Onramp: MXN -> USDC. User pays SPEI instructions; crypto lands at destinationAddress. -// No user-signed transactions; fiatAccountId is NOT required for onramp. -async function runMexicoOnramp(sdk: VortexSdk): Promise { - console.log("📝 Step 1: Creating quote for MXN onramp (MXN -> USDC via SPEI)..."); - const quoteRequest: CreateQuoteRequest = { - from: EPaymentMethod.SPEI, - inputAmount: "201", - inputCurrency: FiatToken.MXN, - network: Networks.Polygon, - outputCurrency: EvmToken.USDC, - rampType: RampDirection.BUY, - to: Networks.Polygon - }; - - const quote = await sdk.createQuote(quoteRequest); - logQuote(quote); - - console.log("📝 Step 2: Registering onramp (destinationAddress only — fiatAccountId optional)..."); - const { rampProcess } = await sdk.registerRamp(quote, { - destinationAddress: DESTINATION_ADDRESS, - walletAddress: WALLET_ADDRESS - }); - console.log(`✅ Onramp registered. Ramp ID: ${rampProcess.id}`); - - console.log("📝 Step 3: Starting onramp..."); - const startedRamp = await sdk.startRamp(rampProcess.id); - - // To complete the onramp WITHOUT paying fiat, deposit USDT to the ephemeral so the - // alfredpayOnrampMint balance check passes (it trusts the on-chain balance as ground truth). - const ephemeralEvmAddress = readEphemeralEvmAddress(rampProcess.id); - console.log("\n🏦 To complete the onramp, deposit USDT on POLYGON to the ephemeral address:"); - console.log(` • Send USDT to: ${ephemeralEvmAddress ?? ``}`); - console.log(` • USDT token (Polygon): ${USDT_POLYGON_ADDRESS} (6 decimals)`); - console.log(` • Amount: a little more than ${quote.outputAmount} USDC-equivalent in USDT`); - console.log(" (exact raw amount is in the backend 'AlfredpayOnrampMintHandler: Waiting for ...' log)"); - - if (startedRamp.achPaymentData) { - console.log("\n(SPEI fiat instructions, not needed for the deposit-to-ephemeral test):"); - console.log(startedRamp.achPaymentData); - } -} - -// Offramp: USDC -> MXN. SDK returns user-side EVM transactions to sign; push the -// resulting hashes back via updateRamp, then start. fiatAccountId is REQUIRED here. -async function runMexicoOfframp(sdk: VortexSdk): Promise { - console.log("📝 Step 1: Creating quote for MXN offramp (USDC -> MXN via SPEI)..."); - const quoteRequest: CreateQuoteRequest = { - from: Networks.Polygon, - inputAmount: "10", - inputCurrency: EvmToken.USDC, - network: Networks.Polygon, - outputCurrency: FiatToken.MXN, - rampType: RampDirection.SELL, - to: EPaymentMethod.SPEI - }; - - const quote = await sdk.createQuote(quoteRequest); - logQuote(quote); - - console.log("📝 Step 2: Registering offramp (fiatAccountId + walletAddress required)..."); - const { rampProcess, unsignedTransactions } = await sdk.registerRamp(quote, { - fiatAccountId: FIAT_ACCOUNT_ID, - walletAddress: OFFRAMP_WALLET_ADDRESS - }); - console.log(`✅ Offramp registered. Ramp ID: ${rampProcess.id}`); - - // Handle each user transaction with the SDK's helpers (no EIP-712 reconstruction needed here). - const localAccount = OFFRAMP_WALLET_PRIVATE_KEY ? privateKeyToAccount(OFFRAMP_WALLET_PRIVATE_KEY) : undefined; - - for (const tx of unsignedTransactions) { - if (sdk.getUserTransactionType(tx) === "evm-typed-data") { - // A typed-data tx may carry several payloads (e.g. permit + relayer payload). Sign each in order. - const payloads = sdk.getTypedDataToSign(tx); // wagmi / viem signTypedData-ready - const v4Payloads = sdk.getTypedDataToSign(tx, { includeDomainType: true }); // eth_signTypedData_v4-ready - const signatures: string[] = []; - - for (let i = 0; i < payloads.length; i++) { - if (localAccount) { - signatures.push(await localAccount.signTypedData(payloads[i])); - console.log( - ` [${i + 1}/${payloads.length}] ${payloads[i].primaryType} signed locally by ${localAccount.address}` - ); - } else { - console.log( - `\n----- sign payload ${i + 1}/${payloads.length}: ${payloads[i].primaryType} (account ${tx.signer}) -----` - ); - console.log(JSON.stringify(v4Payloads[i], null, 2)); - signatures.push(await askQuestion(`➡️ Signature for ${payloads[i].primaryType}: `)); - } - } - - console.log(`📝 Submitting ${signatures.length} signature(s) for ${tx.phase}...`); - await sdk.submitUserSignature(rampProcess.id, tx, signatures); - console.log(`✅ Submitted signature(s) for ${tx.phase}.`); - } else { - // Broadcast path: user sends the EVM tx from their wallet, then pushes the hash back. - const evmTx = sdk.getTransactionToBroadcast(tx); - console.log(`\n🛑 Broadcast ${tx.phase} from your wallet: to=${evmTx.to} value=${evmTx.value} data=${evmTx.data}`); - const hash = await askQuestion(`➡️ Tx hash for ${tx.phase}: `); - await sdk.submitUserTxHash(rampProcess.id, tx, hash); - console.log(`✅ Submitted hash for ${tx.phase}.`); - } - } - - console.log("📝 Step 4: Starting offramp..."); - await sdk.startRamp(rampProcess.id); - console.log("✅ Offramp started."); -} - -async function main(): Promise { - const direction = (process.argv[2] ?? "offramp").toLowerCase(); - console.log(`Starting Mexico (MXN) Alfredpay ${direction} example...\n`); - - const sdk = buildSdk(); - - if (direction === "onramp") { - await runMexicoOnramp(sdk); - } else if (direction === "offramp") { - await runMexicoOfframp(sdk); - } else { - throw new Error(`Unknown direction "${direction}". Use "onramp" or "offramp".`); - } -} - -if (require.main === module) { - main() - .then(() => { - console.log("\n✨ Example execution completed"); - process.exit(0); - }) - .catch(error => { - console.error("\n💥 Example execution failed:", error); - if (error instanceof Error) { - console.error("Error message:", error.message); - } - process.exit(1); - }); -} From 4450c422fab817f345e5c1e2de0f0f10b07f8fe6 Mon Sep 17 00:00:00 2001 From: Kacper Szarkiewicz Date: Mon, 22 Jun 2026 14:55:57 +0200 Subject: [PATCH 016/176] add exampleAlfredpayMexico to sdk --- .../sdk/examples/exampleAlfredpayMexico.ts | 213 ++++++++++++++++++ 1 file changed, 213 insertions(+) create mode 100644 packages/sdk/examples/exampleAlfredpayMexico.ts diff --git a/packages/sdk/examples/exampleAlfredpayMexico.ts b/packages/sdk/examples/exampleAlfredpayMexico.ts new file mode 100644 index 000000000..4545bb2aa --- /dev/null +++ b/packages/sdk/examples/exampleAlfredpayMexico.ts @@ -0,0 +1,213 @@ +// @ts-nocheck + +// Manual end-to-end example for the Mexico (MXN) Alfredpay flow, both directions. +// MXN settles via SPEI (EPaymentMethod.SPEI). Mirrors the README Alfredpay sections +// Real SDK contract: createQuote -> registerRamp -> (onramp: startRamp) / +// (offramp: sign user txs via submitUserSignature/submitUserTxHash) -> startRamp. +// +// Requires a running backend (default http://localhost:3000) with Alfredpay enabled. +// Replace the placeholder addresses / fiatAccountId before running. +// +// Run: +// cd packages/sdk +// bun run examples/exampleAlfredpayMexico.ts onramp +// bun run examples/exampleAlfredpayMexico.ts offramp # default + +import * as fs from "fs"; +import * as readline from "readline"; +import { privateKeyToAccount } from "viem/accounts"; +import { CreateQuoteRequest, EPaymentMethod, EvmToken, FiatToken, Networks, QuoteResponse, RampDirection } from "../src/index"; +import { VortexSdkConfig } from "../src/types"; +import { VortexSdk } from "../src/VortexSdk"; + +// Optional: sign offramp permits locally (viem) with a throwaway wallet that holds the test USDC. +// viem derives the EIP712Domain canonically, so its signatures match the backend's ethers +// verifyTypedData exactly. If unset, you sign in your own wallet and paste the signature. +const OFFRAMP_WALLET_PRIVATE_KEY = process.env.OFFRAMP_WALLET_PRIVATE_KEY as `0x${string}` | undefined; +const OFFRAMP_WALLET_ADDRESS = OFFRAMP_WALLET_PRIVATE_KEY + ? privateKeyToAccount(OFFRAMP_WALLET_PRIVATE_KEY).address + : "0xYOUR_WALLET_ADDRESS"; +const DESTINATION_ADDRESS = "0xYOUR_WALLET_ADDRESS"; +const WALLET_ADDRESS = "0xYOUR_WALLET_ADDRESS"; +const FIAT_ACCOUNT_ID = "00000000-0000-0000-0000-000000000000"; + +function askQuestion(query: string): Promise { + const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); + return new Promise(resolve => { + rl.question(query, (ans: string) => { + rl.close(); + resolve(ans.trim()); + }); + }); +} + +function buildSdk(): VortexSdk { + const config: VortexSdkConfig = { + apiBaseUrl: "", + autoReconnect: true, + publicKey: "", + storeEphemeralKeys: true + }; + return new VortexSdk(config); +} + +function logQuote(quote: QuoteResponse): void { + console.log("✅ Quote created:"); + console.log(` Quote ID: ${quote.id}`); + console.log(` Input: ${quote.inputAmount} ${quote.inputCurrency}`); + console.log(` Output: ${quote.outputAmount} ${quote.outputCurrency}`); + console.log(` Total Fee: ${quote.totalFeeFiat} ${quote.feeCurrency}`); + console.log(` Expires at: ${quote.expiresAt}\n`); +} + +// USDT on Polygon — the token Alfredpay mints; what you deposit to the ephemeral to simulate the fiat pay-in. +const USDT_POLYGON_ADDRESS = "0xc2132d05d31c914a87c6611c10748aeb04b58e8f"; // 6 decimals + +// The SDK writes ephemeral keys to ./ephemerals_.json (storeEphemeralKeys: true). +function readEphemeralEvmAddress(rampId: string): string | undefined { + try { + const items = JSON.parse(fs.readFileSync(`ephemerals_${rampId}.json`, "utf-8")); + return items.find((i: { type: string; address: string }) => i.type === "EVM")?.address; + } catch { + return undefined; + } +} + +// Onramp: MXN -> USDC. User pays SPEI instructions; crypto lands at destinationAddress. +// No user-signed transactions; fiatAccountId is NOT required for onramp. +async function runMexicoOnramp(sdk: VortexSdk): Promise { + console.log("📝 Step 1: Creating quote for MXN onramp (MXN -> USDC via SPEI)..."); + const quoteRequest: CreateQuoteRequest = { + from: EPaymentMethod.SPEI, + inputAmount: "201", + inputCurrency: FiatToken.MXN, + network: Networks.Polygon, + outputCurrency: EvmToken.USDC, + rampType: RampDirection.BUY, + to: Networks.Polygon + }; + + const quote = await sdk.createQuote(quoteRequest); + logQuote(quote); + + console.log("📝 Step 2: Registering onramp (destinationAddress only — fiatAccountId optional)..."); + const { rampProcess } = await sdk.registerRamp(quote, { + destinationAddress: DESTINATION_ADDRESS, + walletAddress: WALLET_ADDRESS + }); + console.log(`✅ Onramp registered. Ramp ID: ${rampProcess.id}`); + + console.log("📝 Step 3: Starting onramp..."); + const startedRamp = await sdk.startRamp(rampProcess.id); + + // To complete the onramp WITHOUT paying fiat, deposit USDT to the ephemeral so the + // alfredpayOnrampMint balance check passes (it trusts the on-chain balance as ground truth). + const ephemeralEvmAddress = readEphemeralEvmAddress(rampProcess.id); + console.log("\n🏦 To complete the onramp, deposit USDT on POLYGON to the ephemeral address:"); + console.log(` • Send USDT to: ${ephemeralEvmAddress ?? ``}`); + console.log(` • USDT token (Polygon): ${USDT_POLYGON_ADDRESS} (6 decimals)`); + console.log(` • Amount: a little more than ${quote.outputAmount} USDC-equivalent in USDT`); + console.log(" (exact raw amount is in the backend 'AlfredpayOnrampMintHandler: Waiting for ...' log)"); + + if (startedRamp.achPaymentData) { + console.log("\n(SPEI fiat instructions, not needed for the deposit-to-ephemeral test):"); + console.log(startedRamp.achPaymentData); + } +} + +// Offramp: USDC -> MXN. SDK returns user-side EVM transactions to sign; push the +// resulting hashes back via updateRamp, then start. fiatAccountId is REQUIRED here. +async function runMexicoOfframp(sdk: VortexSdk): Promise { + console.log("📝 Step 1: Creating quote for MXN offramp (USDC -> MXN via SPEI)..."); + const quoteRequest: CreateQuoteRequest = { + from: Networks.Polygon, + inputAmount: "10", + inputCurrency: EvmToken.USDC, + network: Networks.Polygon, + outputCurrency: FiatToken.MXN, + rampType: RampDirection.SELL, + to: EPaymentMethod.SPEI + }; + + const quote = await sdk.createQuote(quoteRequest); + logQuote(quote); + + console.log("📝 Step 2: Registering offramp (fiatAccountId + walletAddress required)..."); + const { rampProcess, unsignedTransactions } = await sdk.registerRamp(quote, { + fiatAccountId: FIAT_ACCOUNT_ID, + walletAddress: OFFRAMP_WALLET_ADDRESS + }); + console.log(`✅ Offramp registered. Ramp ID: ${rampProcess.id}`); + + // Handle each user transaction with the SDK's helpers (no EIP-712 reconstruction needed here). + const localAccount = OFFRAMP_WALLET_PRIVATE_KEY ? privateKeyToAccount(OFFRAMP_WALLET_PRIVATE_KEY) : undefined; + + for (const tx of unsignedTransactions) { + if (sdk.getUserTransactionType(tx) === "evm-typed-data") { + // A typed-data tx may carry several payloads (e.g. permit + relayer payload). Sign each in order. + const payloads = sdk.getTypedDataToSign(tx); // wagmi / viem signTypedData-ready + const v4Payloads = sdk.getTypedDataToSign(tx, { includeDomainType: true }); // eth_signTypedData_v4-ready + const signatures: string[] = []; + + for (let i = 0; i < payloads.length; i++) { + if (localAccount) { + signatures.push(await localAccount.signTypedData(payloads[i])); + console.log( + ` [${i + 1}/${payloads.length}] ${payloads[i].primaryType} signed locally by ${localAccount.address}` + ); + } else { + console.log( + `\n----- sign payload ${i + 1}/${payloads.length}: ${payloads[i].primaryType} (account ${tx.signer}) -----` + ); + console.log(JSON.stringify(v4Payloads[i], null, 2)); + signatures.push(await askQuestion(`➡️ Signature for ${payloads[i].primaryType}: `)); + } + } + + console.log(`📝 Submitting ${signatures.length} signature(s) for ${tx.phase}...`); + await sdk.submitUserSignature(rampProcess.id, tx, signatures); + console.log(`✅ Submitted signature(s) for ${tx.phase}.`); + } else { + // Broadcast path: user sends the EVM tx from their wallet, then pushes the hash back. + const evmTx = sdk.getTransactionToBroadcast(tx); + console.log(`\n🛑 Broadcast ${tx.phase} from your wallet: to=${evmTx.to} value=${evmTx.value} data=${evmTx.data}`); + const hash = await askQuestion(`➡️ Tx hash for ${tx.phase}: `); + await sdk.submitUserTxHash(rampProcess.id, tx, hash); + console.log(`✅ Submitted hash for ${tx.phase}.`); + } + } + + console.log("📝 Step 4: Starting offramp..."); + await sdk.startRamp(rampProcess.id); + console.log("✅ Offramp started."); +} + +async function main(): Promise { + const direction = (process.argv[2] ?? "offramp").toLowerCase(); + console.log(`Starting Mexico (MXN) Alfredpay ${direction} example...\n`); + + const sdk = buildSdk(); + + if (direction === "onramp") { + await runMexicoOnramp(sdk); + } else if (direction === "offramp") { + await runMexicoOfframp(sdk); + } else { + throw new Error(`Unknown direction "${direction}". Use "onramp" or "offramp".`); + } +} + +if (require.main === module) { + main() + .then(() => { + console.log("\n✨ Example execution completed"); + process.exit(0); + }) + .catch(error => { + console.error("\n💥 Example execution failed:", error); + if (error instanceof Error) { + console.error("Error message:", error.message); + } + process.exit(1); + }); +} From 6c56c30d18f32fbca390311789e856729dac7e92 Mon Sep 17 00:00:00 2001 From: Kacper Szarkiewicz Date: Mon, 22 Jun 2026 15:29:57 +0200 Subject: [PATCH 017/176] update the sdk integration docs --- docs/api/pages/02-quick-start-with-the-sdk.md | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/docs/api/pages/02-quick-start-with-the-sdk.md b/docs/api/pages/02-quick-start-with-the-sdk.md index 9b9f796e9..aa09144d1 100644 --- a/docs/api/pages/02-quick-start-with-the-sdk.md +++ b/docs/api/pages/02-quick-start-with-the-sdk.md @@ -108,6 +108,90 @@ const started = await sdk.startRamp(rampProcess.id); Validate every field before signing: `chainId`, `verifyingContract`, `value`, `to`, and `data` must match what your application requested. Never sign payloads blindly. +## MXN Onramp (Buy) + +MXN settles via SPEI through. The user pays fiat off-chain; crypto is delivered to `destinationAddress` on the quoted network. + +```js +import { EPaymentMethod } from "@vortexfi/sdk"; + +const quote = await sdk.createQuote({ + rampType: RampDirection.BUY, + from: EPaymentMethod.SPEI, + to: Networks.Polygon, + network: Networks.Polygon, + inputAmount: "201", // 201 MXN + inputCurrency: FiatToken.MXN, + outputCurrency: EvmToken.USDC +}); + +const { rampProcess } = await sdk.registerRamp(quote, { + destinationAddress: "0x1234567890123456789012345678901234567890", + walletAddress: "0x1234567890123456789012345678901234567890" + // fiatAccountId is optional for onramp +}); + +const started = await sdk.startRamp(rampProcess.id); + +// Show the user how to pay via SPEI +console.log(started.achPaymentData); +``` + +No user-signed on-chain transactions are required for onramp. The SDK signs ephemeral transactions during `registerRamp`. + +## MXN Offramp (Sell) + +Selling crypto for MXN requires the user to sign one or more on-chain transactions with their own wallet. The SDK returns those transactions in `unsignedTransactions`. + +```js +const quote = await sdk.createQuote({ + rampType: RampDirection.SELL, + from: Networks.Polygon, + to: EPaymentMethod.SPEI, + network: Networks.Polygon, + inputAmount: "10", // 10 USDC + inputCurrency: EvmToken.USDC, + outputCurrency: FiatToken.MXN +}); + +const { rampProcess, unsignedTransactions } = await sdk.registerRamp(quote, { + fiatAccountId: "00000000-0000-0000-0000-000000000000", // user's fiat account + walletAddress: "0xUSER..." +}); +``` + +`fiatAccountId` is opaque to the SDK. Create or look up the user's fiat account out-of-band and pass the ID here. It is required for offramp and optional for onramp. + +### Signing MXN Offramp User Transactions + +Use the SDK helpers to classify, sign, and submit each entry in `unsignedTransactions`: + +```js +import { signTypedData, sendTransaction } from "@wagmi/core"; + +for (const tx of unsignedTransactions) { + if (sdk.getUserTransactionType(tx) === "evm-typed-data") { + // A single tx may carry several typed-data payloads (e.g. permit + relayer). Sign each in order. + const payloads = sdk.getTypedDataToSign(tx); // wagmi / viem signTypedData-ready + const signatures = []; + + for (const payload of payloads) { + signatures.push(await signTypedData(wagmiConfig, payload)); + } + + await sdk.submitUserSignature(rampProcess.id, tx, signatures); + } else { + const evmTx = sdk.getTransactionToBroadcast(tx); + const hash = await sendTransaction(wagmiConfig, evmTx); + await sdk.submitUserTxHash(rampProcess.id, tx, hash); + } +} + +await sdk.startRamp(rampProcess.id); +``` + +For wallets that call `eth_signTypedData_v4` directly, pass `{ includeDomainType: true }` to `getTypedDataToSign`. + ## Tracking Status Poll for user-facing screens, use webhooks for back-office reconciliation: From 288680e62c15562b5673abe48bdac84e8fbd4bb0 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 22 Jun 2026 17:39:44 +0200 Subject: [PATCH 018/176] Classify unsupported SDK user transactions --- packages/sdk/src/VortexSdk.ts | 9 ++++---- packages/sdk/src/eip712.ts | 37 ++++++++++++++++++++++++++------ packages/sdk/src/index.ts | 1 + packages/sdk/test/eip712.test.ts | 28 +++++++++++++++++++++--- 4 files changed, 61 insertions(+), 14 deletions(-) diff --git a/packages/sdk/src/VortexSdk.ts b/packages/sdk/src/VortexSdk.ts index 286e438e0..0ff411080 100644 --- a/packages/sdk/src/VortexSdk.ts +++ b/packages/sdk/src/VortexSdk.ts @@ -20,7 +20,7 @@ import { signUnsignedTransactions, UnsignedTx } from "@vortexfi/shared"; -import { attachSignatures, typedDataToSign, userTransactionType } from "./eip712"; +import { attachSignatures, typedDataToSign, type UserTransactionType, userTransactionType } from "./eip712"; import { TransactionSigningError } from "./errors"; import { AlfredpayHandler } from "./handlers/AlfredpayHandler"; import { BrlHandler } from "./handlers/BrlHandler"; @@ -191,8 +191,9 @@ export class VortexSdk { * Classify a user transaction returned in `unsignedTransactions`: * - "evm-typed-data": sign it (e.g. an offramp permit) and submit via submitUserSignature. * - "evm-transaction": broadcast it from the user wallet and submit the hash via submitUserTxHash. + * - "unsupported": the SDK cannot broadcast this transaction type; handle it with a network-specific wallet flow. */ - getUserTransactionType(tx: UnsignedTx): "evm-typed-data" | "evm-transaction" { + getUserTransactionType(tx: UnsignedTx): UserTransactionType { return userTransactionType(tx); } @@ -213,10 +214,10 @@ export class VortexSdk { * Return the EVM transaction to broadcast for an "evm-transaction" user transaction. */ getTransactionToBroadcast(tx: UnsignedTx): EvmTransactionData { - if (this.getUserTransactionType(tx) !== "evm-transaction") { + if (!isEvmTransactionData(tx.txData)) { throw new Error(`getTransactionToBroadcast: phase ${tx.phase} is not a broadcastable EVM transaction.`); } - return tx.txData as EvmTransactionData; + return tx.txData; } /** diff --git a/packages/sdk/src/eip712.ts b/packages/sdk/src/eip712.ts index 913e3221a..0745ce40f 100644 --- a/packages/sdk/src/eip712.ts +++ b/packages/sdk/src/eip712.ts @@ -1,4 +1,12 @@ -import type { SignedTypedData, UnsignedTx } from "@vortexfi/shared"; +import { + isEvmTransactionData, + isSignedTypedData, + isSignedTypedDataArray, + type SignedTypedData, + type UnsignedTx +} from "@vortexfi/shared"; + +export type UserTransactionType = "evm-typed-data" | "evm-transaction" | "unsupported"; export const EIP712_DOMAIN_FIELD_TYPES: Record = { chainId: "uint256", @@ -14,12 +22,27 @@ export const EIP712_DOMAIN_FIELD_TYPES: Record = { export const EIP712_DOMAIN_FIELD_ORDER = ["name", "version", "chainId", "verifyingContract", "salt"]; export function isTypedDataItem(item: unknown): item is SignedTypedData { - return typeof item === "object" && item !== null && "primaryType" in item; + return ( + typeof item === "object" && + item !== null && + !Array.isArray(item) && + "domain" in item && + "types" in item && + "primaryType" in item && + "message" in item + ); } -export function userTransactionType(tx: UnsignedTx): "evm-typed-data" | "evm-transaction" { - const first = Array.isArray(tx.txData) ? tx.txData[0] : tx.txData; - return isTypedDataItem(first) ? "evm-typed-data" : "evm-transaction"; +export function userTransactionType(tx: UnsignedTx): UserTransactionType { + if (isSignedTypedData(tx.txData) || isSignedTypedDataArray(tx.txData)) { + return "evm-typed-data"; + } + + if (isEvmTransactionData(tx.txData)) { + return "evm-transaction"; + } + + return "unsupported"; } export function typedDataToSign(tx: UnsignedTx, options: { includeDomainType?: boolean } = {}): SignedTypedData[] { @@ -30,11 +53,11 @@ export function typedDataToSign(tx: UnsignedTx, options: { includeDomainType?: b return items.map(item => ({ ...item, types: { + ...item.types, EIP712Domain: EIP712_DOMAIN_FIELD_ORDER.filter(field => field in item.domain).map(field => ({ name: field, type: EIP712_DOMAIN_FIELD_TYPES[field] - })), - ...item.types + })) } })); } diff --git a/packages/sdk/src/index.ts b/packages/sdk/src/index.ts index 1f4875c15..d74a75045 100644 --- a/packages/sdk/src/index.ts +++ b/packages/sdk/src/index.ts @@ -1,3 +1,4 @@ +export type { UserTransactionType } from "./eip712"; export * from "./errors"; export * from "./types"; export { VortexSdk } from "./VortexSdk"; diff --git a/packages/sdk/test/eip712.test.ts b/packages/sdk/test/eip712.test.ts index 9adc0e1b2..18360c3a5 100644 --- a/packages/sdk/test/eip712.test.ts +++ b/packages/sdk/test/eip712.test.ts @@ -19,10 +19,10 @@ describe("userTransactionType", () => { expect(userTransactionType(tx([saltPermit, saltPermit]))).toBe("evm-typed-data"); }); it("classifies a raw EVM transaction (object)", () => { - expect(userTransactionType(tx({ data: "0x", to: "0x1", value: "0" }))).toBe("evm-transaction"); + expect(userTransactionType(tx({ data: "0x", gas: "21000", to: "0x1", value: "0" }))).toBe("evm-transaction"); }); - it("classifies a raw EVM transaction (string)", () => { - expect(userTransactionType(tx("0xdeadbeef"))).toBe("evm-transaction"); + it("does not classify Substrate hex strings as EVM transactions", () => { + expect(userTransactionType(tx("0xdeadbeef"))).toBe("unsupported"); }); }); @@ -58,6 +58,28 @@ describe("typedDataToSign", () => { "verifyingContract" ]); }); + + it("overrides a non-canonical existing EIP712Domain entry", () => { + const withDomainType = { + ...saltPermit, + types: { + EIP712Domain: [ + { name: "salt", type: "bytes32" }, + { name: "name", type: "string" } + ], + Permit: [{ name: "owner", type: "address" }] + } + }; + + const [payload] = typedDataToSign(tx(withDomainType), { includeDomainType: true }); + + expect((payload.types.EIP712Domain as { name: string }[]).map(f => f.name)).toEqual([ + "name", + "version", + "verifyingContract", + "salt" + ]); + }); }); describe("attachSignatures", () => { From b95d3de8159194157466e173c809ec773189b607 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 22 Jun 2026 17:40:55 +0200 Subject: [PATCH 019/176] Align SDK quote discriminants with payment enums --- packages/sdk/src/types.ts | 16 +- packages/sdk/test/alfredpayHandler.test.ts | 169 +++++++++++++++------ 2 files changed, 127 insertions(+), 58 deletions(-) diff --git a/packages/sdk/src/types.ts b/packages/sdk/src/types.ts index 8c02862f6..1ac5c06e1 100644 --- a/packages/sdk/src/types.ts +++ b/packages/sdk/src/types.ts @@ -38,12 +38,12 @@ export type AlfredpayCurrency = FiatToken.USD | FiatToken.MXN | FiatToken.COP | export type BrlOnrampQuote = QuoteResponse & { rampType: RampDirection.BUY; - from: "pix"; + from: EPaymentMethod.PIX; }; export type EurOnrampQuote = QuoteResponse & { rampType: RampDirection.BUY; - from: "sepa"; + from: EPaymentMethod.SEPA; }; export type AlfredpayOnrampQuote = QuoteResponse & { @@ -53,12 +53,12 @@ export type AlfredpayOnrampQuote = QuoteResponse & { export type BrlOfframpQuote = QuoteResponse & { rampType: RampDirection.SELL; - to: "pix"; + to: EPaymentMethod.PIX; }; export type EurOfframpQuote = QuoteResponse & { rampType: RampDirection.SELL; - to: "sepa"; + to: EPaymentMethod.SEPA; }; export type AlfredpayOfframpQuote = QuoteResponse & { @@ -72,15 +72,15 @@ export type ExtendedQuoteResponse = T extends { inputCurrency: AlfredpayCurrency; } ? AlfredpayOnrampQuote - : T extends { rampType: RampDirection.BUY; from: "pix" } + : T extends { rampType: RampDirection.BUY; from: EPaymentMethod.PIX } ? BrlOnrampQuote - : T extends { rampType: RampDirection.BUY; from: "sepa" } + : T extends { rampType: RampDirection.BUY; from: EPaymentMethod.SEPA } ? EurOnrampQuote : T extends { rampType: RampDirection.SELL; outputCurrency: AlfredpayCurrency } ? AlfredpayOfframpQuote - : T extends { rampType: RampDirection.SELL; to: "pix" } + : T extends { rampType: RampDirection.SELL; to: EPaymentMethod.PIX } ? BrlOfframpQuote - : T extends { rampType: RampDirection.SELL; to: "sepa" } + : T extends { rampType: RampDirection.SELL; to: EPaymentMethod.SEPA } ? EurOfframpQuote : AnyQuote; diff --git a/packages/sdk/test/alfredpayHandler.test.ts b/packages/sdk/test/alfredpayHandler.test.ts index f39874e77..ccef2a0ae 100644 --- a/packages/sdk/test/alfredpayHandler.test.ts +++ b/packages/sdk/test/alfredpayHandler.test.ts @@ -1,47 +1,119 @@ -// Regression coverage for the Alfredpay (USD / MXN / COP) on/off-ramp flows. +// Regression coverage for the Alfredpay (USD / MXN / COP / ARS) on/off-ramp flows. // Exercises the real AlfredpayHandler against an in-memory backend (no network, // RPC, KYC, or on-chain funds) to lock in routing, request payloads, and call // ordering. Run: cd packages/sdk && bun test import { describe, expect, test } from "bun:test"; -import { FiatToken, isAlfredpayToken } from "@vortexfi/shared"; +import { + EPaymentMethod, + EphemeralAccountType, + FiatToken, + GetRampStatusResponse, + isAlfredpayToken, + Networks, + PresignedTx, + RampDirection, + RampProcess, + RegisterRampRequest, + UpdateRampRequest, + UnsignedTx +} from "@vortexfi/shared"; import { MissingAlfredpayOfframpParametersError, MissingAlfredpayOnrampParametersError } from "../src/errors"; import { AlfredpayHandler } from "../src/handlers/AlfredpayHandler"; +import { ApiService } from "../src/services/ApiService"; +import type { VortexSdkContext } from "../src/types"; const WALLET = "0x1234567890123456789012345678901234567890"; const FIAT_ACCOUNT = "fa_demo"; -type Call = { method: string; payload: any }; +type Call = { method: string; payload: unknown }; + +const makeUnsignedTx = (phase: UnsignedTx["phase"], signer: string): UnsignedTx => ({ + meta: {}, + network: Networks.Polygon, + nonce: 0, + phase, + signer, + txData: { + data: "0x", + gas: "21000", + to: "0x0000000000000000000000000000000000000001", + value: "0" + } +}); + +const makeRampProcess = ( + id: string, + currentPhase: RampProcess["currentPhase"], + unsignedTxs: UnsignedTx[] +): RampProcess => ({ + createdAt: "2026-01-01T00:00:00.000Z", + currentPhase, + from: EPaymentMethod.ACH, + id, + inputAmount: "100", + inputCurrency: FiatToken.USD, + outputAmount: "10", + outputCurrency: "USDC", + paymentMethod: EPaymentMethod.ACH, + quoteId: "quote_1", + to: Networks.Polygon, + type: RampDirection.BUY, + unsignedTxs, + updatedAt: "2026-01-01T00:00:00.000Z" +}); + +const makeRampStatus = ( + id: string, + currentPhase: RampProcess["currentPhase"], + unsignedTxs: UnsignedTx[] +): GetRampStatusResponse => ({ + ...makeRampProcess(id, currentPhase, unsignedTxs), + anchorFeeFiat: "0", + anchorFeeUsd: "0", + feeCurrency: FiatToken.USD, + networkFeeFiat: "0", + networkFeeUsd: "0", + partnerFeeFiat: "0", + partnerFeeUsd: "0", + processingFeeFiat: "0", + processingFeeUsd: "0", + totalFeeFiat: "0", + totalFeeUsd: "0", + vortexFeeFiat: "0", + vortexFeeUsd: "0" +}); -function setup(overrides: { unsignedTxs?: any[]; currentPhase?: string } = {}) { +const payloadFor = (calls: Call[], method: string): T => calls.find(call => call.method === method)!.payload as T; + +function setup(overrides: { unsignedTxs?: UnsignedTx[]; currentPhase?: RampProcess["currentPhase"] } = {}) { const calls: Call[] = []; const unsignedTxs = overrides.unsignedTxs ?? []; - const apiService = { - getRampStatus: async (id: string) => { - calls.push({ method: "getRampStatus", payload: id }); - return { currentPhase: overrides.currentPhase ?? "initial", id, unsignedTxs }; - }, - registerRamp: async (req: any) => { - calls.push({ method: "registerRamp", payload: req }); - return { currentPhase: "initial", id: "ramp_1", unsignedTxs }; - }, - updateRamp: async (req: any) => { - calls.push({ method: "updateRamp", payload: req }); - return { currentPhase: "initial", id: req.rampId, unsignedTxs }; - } + const apiService = new ApiService("http://localhost:3000"); + apiService.getRampStatus = async (id: string) => { + calls.push({ method: "getRampStatus", payload: id }); + return makeRampStatus(id, overrides.currentPhase ?? "initial", unsignedTxs); + }; + apiService.registerRamp = async (req: RegisterRampRequest) => { + calls.push({ method: "registerRamp", payload: req }); + return makeRampProcess("ramp_1", "initial", unsignedTxs); + }; + apiService.updateRamp = async (req: UpdateRampRequest) => { + calls.push({ method: "updateRamp", payload: req }); + return makeRampProcess(req.rampId, "initial", unsignedTxs); }; - const context = { - storeEphemerals: async (...args: any[]) => { + const context: VortexSdkContext = { + storeEphemerals: async (...args) => { calls.push({ method: "storeEphemerals", payload: args }); } }; const generateEphemerals = async () => ({ accountMetas: [ - { address: "5SUBSTRATE", type: "Substrate" }, - { address: "0xEVM", type: "EVM" } + { address: "5SUBSTRATE", type: EphemeralAccountType.Substrate }, + { address: "0xEVM", type: EphemeralAccountType.EVM } ], ephemerals: { EVM: { address: "0xEVM", secret: "s" }, @@ -49,12 +121,12 @@ function setup(overrides: { unsignedTxs?: any[]; currentPhase?: string } = {}) { } }); - const signTransactions = async (txs: any[]) => { + const signTransactions = async (txs: UnsignedTx[]): Promise => { calls.push({ method: "signTransactions", payload: txs }); - return txs.map((_t, i) => ({ id: `presigned_${i}` })); + return txs.map((t, i) => ({ ...t, txData: `presigned_${i}` })); }; - const handler = new AlfredpayHandler(apiService as any, context as any, generateEphemerals as any, signTransactions as any); + const handler = new AlfredpayHandler(apiService, context, generateEphemerals, signTransactions); return { calls, handler }; } @@ -74,7 +146,7 @@ describe("isAlfredpayToken routing", () => { describe("AlfredpayHandler onramp", () => { test("registers, stores ephemerals, signs, then updates", async () => { - const { calls, handler } = setup({ unsignedTxs: [{ phase: "fundEphemeral", signer: "5SUBSTRATE" }] }); + const { calls, handler } = setup({ unsignedTxs: [makeUnsignedTx("fundEphemeral", "5SUBSTRATE")] }); const result = await handler.registerAlfredpayOnramp("quote_1", { destinationAddress: WALLET, @@ -85,22 +157,21 @@ describe("AlfredpayHandler onramp", () => { expect(result.id).toBe("ramp_1"); expect(calls.map(c => c.method)).toEqual(["registerRamp", "storeEphemerals", "signTransactions", "updateRamp"]); - const reg = calls.find(c => c.method === "registerRamp")!.payload; + const reg = payloadFor(calls, "registerRamp"); expect(reg.quoteId).toBe("quote_1"); - expect(reg.additionalData.destinationAddress).toBe(WALLET); - expect(reg.additionalData.fiatAccountId).toBe(FIAT_ACCOUNT); + expect(reg.additionalData).toMatchObject({ destinationAddress: WALLET, fiatAccountId: FIAT_ACCOUNT }); expect(reg.signingAccounts).toHaveLength(2); - const upd = calls.find(c => c.method === "updateRamp")!.payload; + const upd = payloadFor(calls, "updateRamp"); expect(upd.presignedTxs).toHaveLength(1); expect(upd.additionalData).toEqual({}); }); test("throws when destinationAddress missing", async () => { const { handler } = setup(); - await expect( - handler.registerAlfredpayOnramp("q", { destinationAddress: "", fiatAccountId: FIAT_ACCOUNT } as any) - ).rejects.toBeInstanceOf(MissingAlfredpayOnrampParametersError); + await expect(handler.registerAlfredpayOnramp("q", { destinationAddress: "", fiatAccountId: FIAT_ACCOUNT })).rejects.toBeInstanceOf( + MissingAlfredpayOnrampParametersError + ); }); test("registers without fiatAccountId (backend only requires destinationAddress for onramp)", async () => { @@ -109,39 +180,38 @@ describe("AlfredpayHandler onramp", () => { const result = await handler.registerAlfredpayOnramp("quote_1", { destinationAddress: WALLET }); expect(result.id).toBe("ramp_1"); - const reg = calls.find(c => c.method === "registerRamp")!.payload; - expect(reg.additionalData.destinationAddress).toBe(WALLET); - expect(reg.additionalData.fiatAccountId).toBeUndefined(); + const reg = payloadFor(calls, "registerRamp"); + expect(reg.additionalData).toMatchObject({ destinationAddress: WALLET }); + expect(reg.additionalData?.fiatAccountId).toBeUndefined(); }); }); describe("AlfredpayHandler offramp", () => { test("registers with fiatAccountId + walletAddress (no destinationAddress)", async () => { - const { calls, handler } = setup({ unsignedTxs: [{ phase: "squidRouterApprove", signer: WALLET }] }); + const { calls, handler } = setup({ unsignedTxs: [makeUnsignedTx("squidRouterApprove", WALLET)] }); const result = await handler.registerAlfredpayOfframp("quote_2", { fiatAccountId: FIAT_ACCOUNT, walletAddress: WALLET }); expect(result.id).toBe("ramp_1"); expect(calls.map(c => c.method)).toEqual(["registerRamp", "storeEphemerals", "signTransactions", "updateRamp"]); - const reg = calls.find(c => c.method === "registerRamp")!.payload; - expect(reg.additionalData.fiatAccountId).toBe(FIAT_ACCOUNT); - expect(reg.additionalData.walletAddress).toBe(WALLET); - expect(reg.additionalData.destinationAddress).toBeUndefined(); + const reg = payloadFor(calls, "registerRamp"); + expect(reg.additionalData).toMatchObject({ fiatAccountId: FIAT_ACCOUNT, walletAddress: WALLET }); + expect(reg.additionalData?.destinationAddress).toBeUndefined(); }); test("throws when fiatAccountId missing", async () => { const { handler } = setup(); - await expect( - handler.registerAlfredpayOfframp("q", { fiatAccountId: "", walletAddress: WALLET } as any) - ).rejects.toBeInstanceOf(MissingAlfredpayOfframpParametersError); + await expect(handler.registerAlfredpayOfframp("q", { fiatAccountId: "", walletAddress: WALLET })).rejects.toBeInstanceOf( + MissingAlfredpayOfframpParametersError + ); }); test("throws when walletAddress missing", async () => { const { handler } = setup(); - await expect( - handler.registerAlfredpayOfframp("q", { fiatAccountId: FIAT_ACCOUNT, walletAddress: "" } as any) - ).rejects.toBeInstanceOf(MissingAlfredpayOfframpParametersError); + await expect(handler.registerAlfredpayOfframp("q", { fiatAccountId: FIAT_ACCOUNT, walletAddress: "" })).rejects.toBeInstanceOf( + MissingAlfredpayOfframpParametersError + ); }); }); @@ -152,14 +222,13 @@ describe("AlfredpayHandler offramp update", () => { await handler.updateAlfredpayOfframp("ramp_1", { squidRouterApproveHash: "0xA", squidRouterSwapHash: "0xS" }); expect(calls.map(c => c.method)).toEqual(["getRampStatus", "updateRamp"]); - const upd = calls.find(c => c.method === "updateRamp")!.payload; - expect(upd.additionalData.squidRouterApproveHash).toBe("0xA"); - expect(upd.additionalData.squidRouterSwapHash).toBe("0xS"); + const upd = payloadFor(calls, "updateRamp"); + expect(upd.additionalData).toMatchObject({ squidRouterApproveHash: "0xA", squidRouterSwapHash: "0xS" }); expect(upd.presignedTxs).toHaveLength(0); }); test("throws when ramp is not on the initial phase", async () => { - const { handler } = setup({ currentPhase: "started" }); + const { handler } = setup({ currentPhase: "fundEphemeral" }); await expect(handler.updateAlfredpayOfframp("ramp_1", {})).rejects.toThrow(/initial phase/); }); }); From b3f9ff6b302020ad4711634e205c48ce9094e9cb Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 22 Jun 2026 17:41:34 +0200 Subject: [PATCH 020/176] Type-check SDK ramp examples --- packages/sdk/examples/exampleAlfredpayMexico.ts | 12 +++++++----- packages/sdk/examples/exampleBrlOfframp.ts | 8 +++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/sdk/examples/exampleAlfredpayMexico.ts b/packages/sdk/examples/exampleAlfredpayMexico.ts index 4545bb2aa..606a3f9d8 100644 --- a/packages/sdk/examples/exampleAlfredpayMexico.ts +++ b/packages/sdk/examples/exampleAlfredpayMexico.ts @@ -1,5 +1,3 @@ -// @ts-nocheck - // Manual end-to-end example for the Mexico (MXN) Alfredpay flow, both directions. // MXN settles via SPEI (EPaymentMethod.SPEI). Mirrors the README Alfredpay sections // Real SDK contract: createQuote -> registerRamp -> (onramp: startRamp) / @@ -143,7 +141,9 @@ async function runMexicoOfframp(sdk: VortexSdk): Promise { const localAccount = OFFRAMP_WALLET_PRIVATE_KEY ? privateKeyToAccount(OFFRAMP_WALLET_PRIVATE_KEY) : undefined; for (const tx of unsignedTransactions) { - if (sdk.getUserTransactionType(tx) === "evm-typed-data") { + const txType = sdk.getUserTransactionType(tx); + + if (txType === "evm-typed-data") { // A typed-data tx may carry several payloads (e.g. permit + relayer payload). Sign each in order. const payloads = sdk.getTypedDataToSign(tx); // wagmi / viem signTypedData-ready const v4Payloads = sdk.getTypedDataToSign(tx, { includeDomainType: true }); // eth_signTypedData_v4-ready @@ -151,7 +151,7 @@ async function runMexicoOfframp(sdk: VortexSdk): Promise { for (let i = 0; i < payloads.length; i++) { if (localAccount) { - signatures.push(await localAccount.signTypedData(payloads[i])); + signatures.push(await localAccount.signTypedData(payloads[i] as Parameters[0])); console.log( ` [${i + 1}/${payloads.length}] ${payloads[i].primaryType} signed locally by ${localAccount.address}` ); @@ -167,13 +167,15 @@ async function runMexicoOfframp(sdk: VortexSdk): Promise { console.log(`📝 Submitting ${signatures.length} signature(s) for ${tx.phase}...`); await sdk.submitUserSignature(rampProcess.id, tx, signatures); console.log(`✅ Submitted signature(s) for ${tx.phase}.`); - } else { + } else if (txType === "evm-transaction") { // Broadcast path: user sends the EVM tx from their wallet, then pushes the hash back. const evmTx = sdk.getTransactionToBroadcast(tx); console.log(`\n🛑 Broadcast ${tx.phase} from your wallet: to=${evmTx.to} value=${evmTx.value} data=${evmTx.data}`); const hash = await askQuestion(`➡️ Tx hash for ${tx.phase}: `); await sdk.submitUserTxHash(rampProcess.id, tx, hash); console.log(`✅ Submitted hash for ${tx.phase}.`); + } else { + throw new Error(`Unsupported user transaction for phase ${tx.phase} on ${tx.network}`); } } diff --git a/packages/sdk/examples/exampleBrlOfframp.ts b/packages/sdk/examples/exampleBrlOfframp.ts index 7c2ec213c..9ac15c6c5 100644 --- a/packages/sdk/examples/exampleBrlOfframp.ts +++ b/packages/sdk/examples/exampleBrlOfframp.ts @@ -1,7 +1,5 @@ -// @ts-nocheck - import * as readline from "readline"; -import { EvmToken, EvmTransactionData, FiatToken, Networks, RampDirection } from "../src/index"; +import { EPaymentMethod, EvmToken, FiatToken, Networks, RampDirection } from "../src/index"; import { VortexSdkConfig } from "../src/types"; import { VortexSdk } from "../src/VortexSdk"; @@ -48,7 +46,7 @@ async function runBrlOfframpExample() { network: Networks.Polygon, outputCurrency: FiatToken.BRL, rampType: RampDirection.SELL, - to: "pix" as const + to: EPaymentMethod.PIX }; const quote = await sdk.createQuote(quoteRequest); @@ -74,7 +72,7 @@ async function runBrlOfframpExample() { // The unsignedTransactions object will always return the transactions the user must sign and broadcast, please check the docs for more information https://api-docs.vortexfinance.co/vortex-sdk-1289458m0. console.log(" Unsigned transactions:"); unsignedTransactions.forEach(tx => { - const { to, data, value } = tx.txData as EvmTransactionData; + const { to, data, value } = sdk.getTransactionToBroadcast(tx); console.log(` - ${tx.phase}: Send to ${to} data ${data} with value ${value}`); }); console.log(""); From 5ce48b7e7f39229c38d7bb5a5478d9cd6106a84a Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 22 Jun 2026 17:42:04 +0200 Subject: [PATCH 021/176] Document SDK user transaction helpers --- docs/api/pages/02-quick-start-with-the-sdk.md | 46 +++++++++++------ packages/sdk/README.md | 50 +++++++++++++++---- 2 files changed, 71 insertions(+), 25 deletions(-) diff --git a/docs/api/pages/02-quick-start-with-the-sdk.md b/docs/api/pages/02-quick-start-with-the-sdk.md index aa09144d1..3bd1efa69 100644 --- a/docs/api/pages/02-quick-start-with-the-sdk.md +++ b/docs/api/pages/02-quick-start-with-the-sdk.md @@ -76,13 +76,14 @@ const quote = await sdk.createQuote({ outputCurrency: FiatToken.BRL }); -const { rampProcess, userTransactions } = await sdk.registerRamp(quote, { - userAddress: "0xUSER...", - pixKey: "user@example.com", - taxId: "12345678900" +const { rampProcess, unsignedTransactions } = await sdk.registerRamp(quote, { + pixDestination: "user@example.com", + receiverTaxId: "12345678900", + taxId: "12345678900", + walletAddress: "0xUSER..." }); -// userTransactions contains the transactions the SDK could not sign on the +// unsignedTransactions contains the transactions the SDK could not sign on the // user's behalf. Route them to the user's wallet (see below). ``` @@ -93,13 +94,24 @@ The user-owned transactions are EVM typed-data payloads. With wagmi: ```js import { signTypedData, sendTransaction } from "@wagmi/core"; -for (const tx of userTransactions) { - if (tx.type === "evm-typed-data") { - const signature = await signTypedData(wagmiConfig, tx.payload); - await sdk.submitUserSignature(rampProcess.id, tx.id, signature); - } else if (tx.type === "evm-transaction") { - const hash = await sendTransaction(wagmiConfig, tx.payload); - await sdk.submitUserTxHash(rampProcess.id, tx.id, hash); +for (const tx of unsignedTransactions) { + const txType = sdk.getUserTransactionType(tx); + + if (txType === "evm-typed-data") { + const payloads = sdk.getTypedDataToSign(tx); + const signatures = []; + + for (const payload of payloads) { + signatures.push(await signTypedData(wagmiConfig, payload)); + } + + await sdk.submitUserSignature(rampProcess.id, tx, signatures); + } else if (txType === "evm-transaction") { + const evmTx = sdk.getTransactionToBroadcast(tx); + const hash = await sendTransaction(wagmiConfig, evmTx); + await sdk.submitUserTxHash(rampProcess.id, tx, hash); + } else { + throw new Error(`Unsupported user transaction for phase ${tx.phase} on ${tx.network}`); } } @@ -110,7 +122,7 @@ Validate every field before signing: `chainId`, `verifyingContract`, `value`, `t ## MXN Onramp (Buy) -MXN settles via SPEI through. The user pays fiat off-chain; crypto is delivered to `destinationAddress` on the quoted network. +MXN settles via SPEI through Alfredpay. The user pays fiat off-chain; crypto is delivered to `destinationAddress` on the quoted network. ```js import { EPaymentMethod } from "@vortexfi/sdk"; @@ -170,7 +182,9 @@ Use the SDK helpers to classify, sign, and submit each entry in `unsignedTransac import { signTypedData, sendTransaction } from "@wagmi/core"; for (const tx of unsignedTransactions) { - if (sdk.getUserTransactionType(tx) === "evm-typed-data") { + const txType = sdk.getUserTransactionType(tx); + + if (txType === "evm-typed-data") { // A single tx may carry several typed-data payloads (e.g. permit + relayer). Sign each in order. const payloads = sdk.getTypedDataToSign(tx); // wagmi / viem signTypedData-ready const signatures = []; @@ -180,10 +194,12 @@ for (const tx of unsignedTransactions) { } await sdk.submitUserSignature(rampProcess.id, tx, signatures); - } else { + } else if (txType === "evm-transaction") { const evmTx = sdk.getTransactionToBroadcast(tx); const hash = await sendTransaction(wagmiConfig, evmTx); await sdk.submitUserTxHash(rampProcess.id, tx, hash); + } else { + throw new Error(`Unsupported user transaction for phase ${tx.phase} on ${tx.network}`); } } diff --git a/packages/sdk/README.md b/packages/sdk/README.md index 343f9cd22..36217fc1b 100644 --- a/packages/sdk/README.md +++ b/packages/sdk/README.md @@ -51,7 +51,7 @@ console.log("Please do the pix transfer using the following code: ", depositQrCo const startedRamp = await sdk.startRamp(rampProcess.id); ``` -### Alfredpay (USD / MXN / COP) onramp +### Alfredpay (USD / MXN / COP / ARS) onramp ```typescript import { VortexSdk, FiatToken, EvmToken, EPaymentMethod, Networks, RampDirection } from "@vortexfi/sdk"; @@ -79,7 +79,7 @@ const startedRamp = await sdk.startRamp(rampProcess.id); console.log("Pay via:", startedRamp.achPaymentData); ``` -### Alfredpay (USD / MXN / COP) offramp +### Alfredpay (USD / MXN / COP / ARS) offramp ```typescript const quote = await sdk.createQuote({ @@ -97,14 +97,29 @@ const { rampProcess, unsignedTransactions } = await sdk.registerRamp(quote, { walletAddress: "0x1234567890123456789012345678901234567890" }); -// Sign and submit the user-side EVM transactions (squidRouter approve/swap, etc.) -// then push the resulting hashes back to Vortex: -const updated = await sdk.updateRamp(quote, rampProcess.id, { - squidRouterApproveHash: "0x...", - squidRouterSwapHash: "0x..." -}); +// Sign and submit each user-side transaction before starting the ramp. +for (const tx of unsignedTransactions) { + const txType = sdk.getUserTransactionType(tx); + + if (txType === "evm-typed-data") { + const payloads = sdk.getTypedDataToSign(tx); + const signatures = []; + + for (const payload of payloads) { + signatures.push(await walletClient.signTypedData(payload)); + } + + await sdk.submitUserSignature(rampProcess.id, tx, signatures); + } else if (txType === "evm-transaction") { + const evmTx = sdk.getTransactionToBroadcast(tx); + const hash = await walletClient.sendTransaction(evmTx); + await sdk.submitUserTxHash(rampProcess.id, tx, hash); + } else { + throw new Error(`Unsupported user transaction for phase ${tx.phase} on ${tx.network}`); + } +} -const startedRamp = await sdk.startRamp(updated.id); +const startedRamp = await sdk.startRamp(rampProcess.id); ``` > `fiatAccountId` is opaque to the SDK. It is required for offramp and optional for onramp. Consumers create or look up the user's Alfredpay fiat account out-of-band (via the Vortex backend) and pass the ID in. @@ -135,7 +150,7 @@ Retrieves an existing quote by ID. Gets the current status of a ramp process. ##### `registerRamp(quote: Q, additionalData: RegisterRampAdditionalData): Promise<{ rampProcess: RampProcess; unsignedTransactions: UnsignedTx[] }>` -Registers a new ramp process. Creates fresh ephemeral accounts on Stellar, Pendulum, and Moonbeam, submits the quote and ephemeral addresses to the API, then signs and submits the returned unsigned transactions. Returns the ramp process and the list of unsigned transactions returned by the API for the caller's reference. +Registers a new ramp process. Creates fresh Substrate and EVM ephemeral accounts, submits the quote and ephemeral addresses to the API, then signs and submits the returned ephemeral-owned transactions. Returns the ramp process and the user-owned `unsignedTransactions` that the caller must sign or broadcast. ##### `updateRamp(quote: Q, rampId: string, additionalUpdateData: UpdateRampAdditionalData): Promise` Submits route-specific transaction hashes after off-chain steps complete. Used for sell flows. Buy flows do not require a separate update call. @@ -143,6 +158,21 @@ Submits route-specific transaction hashes after off-chain steps complete. Used f ##### `startRamp(rampId: string): Promise` Starts a registered ramp process. +##### `getUserTransactionType(tx: UnsignedTx): "evm-typed-data" | "evm-transaction" | "unsupported"` +Classifies a user-owned transaction returned by `registerRamp`. Unsupported transactions require a network-specific wallet flow outside the SDK helpers. + +##### `getTypedDataToSign(tx: UnsignedTx, options?: { includeDomainType?: boolean }): SignedTypedData[]` +Returns the EIP-712 payloads to sign for an `"evm-typed-data"` transaction. Sign every payload in order and submit the signatures with `submitUserSignature`. + +##### `submitUserSignature(rampId: string, tx: UnsignedTx, signatures: string | string[]): Promise` +Attaches user EIP-712 signatures to the original unsigned transaction and submits them to Vortex. + +##### `getTransactionToBroadcast(tx: UnsignedTx): EvmTransactionData` +Returns the EVM transaction data for an `"evm-transaction"` transaction. Throws for typed-data or unsupported transaction shapes. + +##### `submitUserTxHash(rampId: string, tx: UnsignedTx, hash: string): Promise` +Submits the on-chain transaction hash for a user-broadcast EVM transaction. + ## Error Handling ### Ephemeral Account Freshness From dd5443a7162f52e5c20f6a1f14dede1789a61119 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 22 Jun 2026 17:42:45 +0200 Subject: [PATCH 022/176] Document Alfredpay ARS support --- apps/api/src/api/services/transactions/offramp/index.ts | 2 +- docs/Alfredpay.md | 7 ++++--- docs/api/pages/01-overview.md | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/api/src/api/services/transactions/offramp/index.ts b/apps/api/src/api/services/transactions/offramp/index.ts index 1e48a6878..1c84dd087 100644 --- a/apps/api/src/api/services/transactions/offramp/index.ts +++ b/apps/api/src/api/services/transactions/offramp/index.ts @@ -36,7 +36,7 @@ export async function prepareOfframpTransactions(params: OfframpTransactionParam } return prepareEvmToMykoboOfframpTransactions(params); } else if (isAlfredpayToken(quote.outputCurrency as FiatToken)) { - // Alfredpay offramp (USD, MXN, COP) + // Alfredpay offramp (USD, MXN, COP, ARS) return prepareEvmToAlfredpayOfframpTransactions(params); } diff --git a/docs/Alfredpay.md b/docs/Alfredpay.md index 4bc27c9bb..b4977b38a 100644 --- a/docs/Alfredpay.md +++ b/docs/Alfredpay.md @@ -1,6 +1,6 @@ -# Alfredpay Onramp Flow — USD, MXN, COP +# Alfredpay Onramp Flow — USD, MXN, COP, ARS -Alfredpay is a fiat-to-crypto (onramp) and crypto-to-fiat (offramp) payment provider integrated into Vortex. It supports three fiat currencies: **USD** (USA), **MXN** (Mexico), **COP** (Colombia). All three route through the same backend transaction phases; KYC/KYB onboarding differs per country. +Alfredpay is a fiat-to-crypto (onramp) and crypto-to-fiat (offramp) payment provider integrated into Vortex. It supports **USD** (USA), **MXN** (Mexico), **COP** (Colombia), and **ARS** (Argentina). These currencies route through the same backend transaction phases; KYC/KYB onboarding differs per country. --- @@ -11,8 +11,9 @@ Alfredpay is a fiat-to-crypto (onramp) and crypto-to-fiat (offramp) payment prov | USD | US | iFrame redirect (Persona) | | MXN | MX | API form + ID document upload | | COP | CO | API form + ID document upload | +| ARS | AR | API form + ID document upload | -`isAlfredpayToken` in `packages/shared/src/services/alfredpay/types.ts` gates all three tokens into the Alfredpay path. +`isAlfredpayToken` in `packages/shared/src/services/alfredpay/types.ts` gates these fiat tokens into the Alfredpay path. --- diff --git a/docs/api/pages/01-overview.md b/docs/api/pages/01-overview.md index ab2f6d9cb..56097e020 100644 --- a/docs/api/pages/01-overview.md +++ b/docs/api/pages/01-overview.md @@ -6,7 +6,7 @@ These docs are written for partner developers integrating Vortex into a backend, ## Supported Corridors -The current SDK release is centered on **BRL/PIX** for both buy (onramp) and sell (offramp) flows. EUR onramp endpoints exist on the API surface but the SDK throws `"Euro onramp handler not implemented yet"`; SEPA buy flows are not production-ready today. Other fiat currencies are exposed through reference data endpoints and are added incrementally. +The current SDK release supports BRL/PIX flows and Alfredpay corridors for USD, MXN, COP, and ARS where enabled by country and route configuration. EUR onramp endpoints exist on the API surface but the SDK throws `"Euro onramp handler not implemented yet"`; SEPA buy flows are not production-ready today. Other fiat currencies are exposed through reference data endpoints and are added incrementally. For crypto, Vortex supports USDC and USDT across the listed EVM networks plus USDC on AssetHub. Stablecoin pegs and routes are subject to liquidity on the Nabla AMM and the wider Pendulum/Hydration corridor. From 5ae4580d030a48a4f2f944027a83b92ddb564833 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 22 Jun 2026 17:44:03 +0200 Subject: [PATCH 023/176] Update final settlement subsidy spec --- docs/security-spec/06-cross-chain/fund-routing.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/security-spec/06-cross-chain/fund-routing.md b/docs/security-spec/06-cross-chain/fund-routing.md index d3d7f0db2..e3f8e5e5f 100644 --- a/docs/security-spec/06-cross-chain/fund-routing.md +++ b/docs/security-spec/06-cross-chain/fund-routing.md @@ -42,7 +42,7 @@ The current code resolves this through `EVM_FUNDING_PRIVATE_KEY` and the `getEvm 7. **Post-swap subsidization next-phase routing MUST be deterministic** — `subsidize-post-swap-handler.ts` contains branching logic that selects the next phase based on ramp direction (on/off), destination chain, and output token. This routing must be consistent with the flow defined at ramp creation. 8. **No subsidization handler MUST proceed if the funding account has insufficient balance** — If the funding account cannot cover the subsidy, the handler should fail with a recoverable error, not silently skip the top-up. 9. **EVM subsidy caps MUST stop transfers without forcing manual phase repair** — If an EVM pre-swap subsidy exceeds its configured quote-relative cap, the handler must not submit a transfer. For EVM post-swap subsidy, the handler must split the top-up into (a) actual-vs-quoted swap-output discrepancy and (b) discount-derived subsidy, then enforce each component's configured cap independently before submitting a single transfer. Both post-swap cap fractions are env-overridable and default to `0.05`. A cap breach is intentionally recoverable so operators can investigate, top up, or cancel the ramp without repairing an unrecoverably failed phase. -10. **`finalSettlementSubsidy` MUST subsidize the gap to *actual bridge delivery*, not to the ephemeral's total balance** — The subsidy is `expectedAmountRaw - delivered`, where `delivered = actualBalance - preSettlementBalance` and `preSettlementBalance` is the destination-token balance snapshotted right after the `squidRouterSwap` confirms (before `squidRouterPay`). Computing the subsidy from total balance is unsafe: leftover Nabla-swap dust in the destination token would make the handler return early and over-subsidize before the Squid bridge output has landed. To avoid racing the bridge, the balance poll waits for ≥90% of `expectedAmountRaw` to arrive (the 90% floor absorbs bridge slippage while still confirming the bridge actually delivered) rather than returning on any non-zero balance. (Incident: a EUR→EURC Base ramp was over-funded ~29.36 EURC and stranded ~59 EURC because the pre-fix handler returned on dust and subtracted total balance.) +10. **`finalSettlementSubsidy` MUST subsidize the gap to *actual bridge delivery*, not to the ephemeral's total balance** — The subsidy is `expectedAmountRaw - delivered`, where `delivered = actualBalance - preSettlementBalance` and `preSettlementBalance` is the destination-token balance snapshotted before `squidRouterSwap` is broadcast. The snapshot is written only once, so a retry after a same-chain synchronous swap cannot overwrite the true pre-delivery baseline with a post-delivery balance. Computing the subsidy from total balance is unsafe: leftover Nabla-swap dust in the destination token would make the handler return early and over-subsidize before the Squid bridge output has landed. To avoid racing the bridge, the balance poll waits for ≥90% of `expectedAmountRaw` to arrive (the 90% floor absorbs bridge slippage while still confirming the bridge actually delivered) rather than returning on any non-zero balance. The final subsidy is additionally clamped to `expectedAmountRaw - actualBalance`, so a bad or stale baseline cannot top up more than the on-chain shortfall. (Incident: a EUR→EURC Base ramp was over-funded ~29.36 EURC and stranded ~59 EURC because the pre-fix handler returned on dust and subtracted total balance.) 11. **Degenerate same-token settlement routes MUST skip `finalSettlementSubsidy` entirely** — When the ramp is a direct transfer (`state.state.isDirectTransfer === true`), a EUR→EURC-on-Base route (`isEurToEurcBaseDirect`), or a BRL→BRLA-on-Base route (`isBrlToBrlaBaseDirect`), the handler short-circuits to `destinationTransfer` without subsidizing. There is no Squid bridge to settle, so any subsidy computation would be against a balance the funder never needs to top up. ## Threat Vectors & Mitigations @@ -57,7 +57,7 @@ The current code resolves this through `EVM_FUNDING_PRIVATE_KEY` and the `getEvm | **Destination transfer replay** — The presigned EVM transaction is somehow submitted multiple times | EVM nonce prevents replay. Each transaction is valid for exactly one nonce value. | | **Balance check race condition in destination transfer** — Balance changes between the check and the transaction submission | Possible but unlikely for ephemeral accounts (no other senders). If balance drops between check and submission, the EVM transaction reverts (no fund loss, just a failed phase that retries). | | **Post-swap routing logic inconsistency** — The next-phase selection in `subsidize-post-swap-handler.ts` routes to a phase that doesn't match the ramp's intended flow | Routing logic uses `direction`, `toChain`, and `outputTokenType` from ramp state. A mismatch would cause the ramp to enter an unexpected phase. Since phases are handler-specific, executing the wrong phase could fail or produce incorrect results. | -| **Final settlement over-subsidy race** — `finalSettlementSubsidy` returns as soon as *any* destination-token balance appears (e.g. Nabla-swap dust) and computes `subsidy = expected − totalBalance` before the Squid bridge output lands. The funder then tops up the full expected amount on top of the later bridge delivery, double-paying the ephemeral and stranding the excess. | **Mitigated.** The handler now snapshots `preSettlementBalance` after `squidRouterSwap` confirms, waits for ≥90% of `expectedAmountRaw` to arrive, and subsidizes only `expected − (actualBalance − preSettlementBalance)`. Direct-transfer / EUR→EURC-Base routes skip the phase outright. Regression-test this: the failure mode silently over-pays from the funding key. | +| **Final settlement over-subsidy race** — `finalSettlementSubsidy` returns as soon as *any* destination-token balance appears (e.g. Nabla-swap dust) and computes `subsidy = expected − totalBalance` before the Squid bridge output lands. The funder then tops up the full expected amount on top of the later bridge delivery, double-paying the ephemeral and stranding the excess. | **Mitigated.** The handler snapshots `preSettlementBalance` before `squidRouterSwap` is broadcast, never overwrites that baseline on retry, waits for ≥90% of `expectedAmountRaw` to arrive, subsidizes only `expected − (actualBalance − preSettlementBalance)`, and clamps the transfer to the on-chain shortfall. Direct-transfer / EUR→EURC-Base routes skip the phase outright. Regression-test this: the failure mode silently over-pays from the funding key. | ## Audit Checklist @@ -78,5 +78,5 @@ The current code resolves this through `EVM_FUNDING_PRIVATE_KEY` and the `getEvm - [x] **FINDING F-060 (MEDIUM)**: Verify `validateSubsidyAmount` rejects negative, zero, NaN, and Infinity amounts. **PASS (FIXED)** — added try/catch around `Big()` construction to reject non-numeric strings, and `lte(0)` guard to reject zero and negative values. - [x] **EVM subsidy handlers (`subsidize-pre-swap-evm-handler.ts`, `subsidize-post-swap-evm-handler.ts`) enforce env-configured USD caps**. Pre-swap subsidy uses `MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION` (default `0.05`). Post-swap subsidy uses split caps: `MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION` for actual-vs-quoted swap-output discrepancy and `MAX_EVM_POST_SWAP_DISCOUNT_SUBSIDY_QUOTE_FRACTION` (default `0.05`) for the discount-derived component. Over-cap subsidies throw `RecoverablePhaseError` before any transfer is submitted, leaving the ramp waiting for operator action instead of moving to `failed`. - [x] **`MOONBEAM_FUNDING_PRIVATE_KEY` rename/refactor**: EVM funding now uses the `EVM_FUNDING_PRIVATE_KEY` / `getEvmFundingAccount(network)` path, with the old env name retained only as backward-compatible fallback. -- [x] **`finalSettlementSubsidy` subsidizes against actual bridge delivery, not total balance.** **PASS** — snapshots `preSettlementBalance` after `squidRouterSwap` confirms (`squid-router-phase-handler.ts`, stored in `meta-state-types.ts`), waits for ≥90% of `expectedAmountRaw`, and computes `subsidy = expected − (actualBalance − preSettlementBalance)`. Prevents the dust-triggered over-subsidy race that stranded ~59 EURC. +- [x] **`finalSettlementSubsidy` subsidizes against actual bridge delivery, not total balance.** **PASS** — snapshots `preSettlementBalance` before broadcasting `squidRouterSwap` (`squid-router-phase-handler.ts`, stored in `meta-state-types.ts`), does not overwrite it on retry, waits for ≥90% of `expectedAmountRaw`, computes `subsidy = expected − (actualBalance − preSettlementBalance)`, and clamps the result to the on-chain shortfall. Prevents both the dust-triggered over-subsidy race and same-chain post-delivery baseline overwrite. - [x] **`finalSettlementSubsidy` short-circuits degenerate same-token routes.** **PASS** — returns to `destinationTransfer` when `state.state.isDirectTransfer === true`, `isEurToEurcBaseDirect(...)`, or `isBrlToBrlaBaseDirect(...)`, so no subsidy is computed for routes that have no Squid bridge to settle. From a04cfd1467fded8720dc7dc14d92f41477c29251 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 22 Jun 2026 17:44:31 +0200 Subject: [PATCH 024/176] Align Alfredpay route security specs --- docs/security-spec/03-ramp-engine/quote-lifecycle.md | 4 ++-- docs/security-spec/03-ramp-engine/ramp-phase-flows.md | 7 +++---- docs/security-spec/05-integrations/alfredpay.md | 4 ++-- docs/security-spec/05-integrations/squid-router.md | 8 ++++---- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/docs/security-spec/03-ramp-engine/quote-lifecycle.md b/docs/security-spec/03-ramp-engine/quote-lifecycle.md index e89e9ac12..5473b1c52 100644 --- a/docs/security-spec/03-ramp-engine/quote-lifecycle.md +++ b/docs/security-spec/03-ramp-engine/quote-lifecycle.md @@ -67,7 +67,7 @@ The refresh policy is intentionally strict (byte-identical `toAmount` and `fee` 8. **Dynamic pricing state MUST NOT be externally modifiable** — The `partnerDiscountState` Map is in-memory and module-private. No API endpoint should expose or allow modification of discount state. 9. **Exchange rates MUST be sourced from authoritative on-chain data** — Swap rates should come from the actual DEX (Nabla) or routing protocol (Squid), not from stale caches or third-party price feeds that could be manipulated. 10. **Subsidy MUST only be applied when `targetDiscount > 0`** — If a partner has no target discount configured, the subsidy amount is always `0`, regardless of the shortfall. -11. **Quote output precision MUST match the final settlement token** — For EVM onramps whose final output comes from Squid, the stored `quote.outputAmount` must retain the destination token's precision, not a fixed source-token precision. This includes BRL/EURC Base→EVM routes and routed Alfredpay USD/MXN/COP Polygon→EVM routes. Direct same-chain same-token passthrough keeps the minted/source token's precision. +11. **Quote output precision MUST match the final settlement token** — For EVM onramps whose final output comes from Squid, the stored `quote.outputAmount` must retain the destination token's precision, not a fixed source-token precision. This includes BRL/EURC Base→EVM routes and routed Alfredpay USD/MXN/COP/ARS Polygon→EVM routes. Direct same-chain same-token passthrough keeps the minted/source token's precision. 12. **Quote creation MUST honor active maintenance windows server-side** — `POST /v1/quotes` and `POST /v1/quotes/best` must reject during active maintenance before quote calculation/persistence, including enough downtime metadata for direct API clients to retry after the window. 13. **Quote ownership MUST stay separate from pricing attribution** — Profile-assigned quotes MUST remain user-owned (`user_id = req.userId`, `partner_id = NULL`) while storing the applied partner pricing row in `pricing_partner_id`. @@ -103,7 +103,7 @@ The refresh policy is intentionally strict (byte-identical `toAmount` and `fee` - [x] Exchange rates used in quote calculation come from live on-chain sources (Nabla, Squid), not stale caches. **PASS** — verified: rates fetched from Nabla DEX and SquidRouter API at quote time. - [x] Quote response does not include internal implementation details (e.g., the `adjustedDifference` or `adjustedTargetDiscount` values). **PASS** — verified: response includes only user-facing fields (amounts, fees, expiry). - [x] Quote amounts (input, output, fees) are immutable once stored — no UPDATE endpoint modifies them. **PASS** — no quote mutation endpoints exist. -- [x] EVM onramp output precision follows destination token decimals where the quote output comes from Squid. **PASS** — BRL/EURC Base→EVM and routed Alfredpay USD/MXN/COP Polygon→EVM finalization preserve destination token precision before downstream raw transfer construction. Direct same-chain same-token passthrough remains at minted/source-token precision. +- [x] EVM onramp output precision follows destination token decimals where the quote output comes from Squid. **PASS** — BRL/EURC Base→EVM and routed Alfredpay USD/MXN/COP/ARS Polygon→EVM finalization preserve destination token precision before downstream raw transfer construction. Direct same-chain same-token passthrough remains at minted/source-token precision. - [PARTIAL] Authentication is enforced on quote creation (verify which auth mechanisms protect `POST /v1/ramp/quotes`). **PARTIAL** — quote creation is accessible via API key auth or Supabase auth; the endpoint is optional-auth by design (public quotes allowed for some partners). - [PARTIAL] Quote ownership is verified at ramp registration — the user/partner creating the ramp must match the quote creator. **PARTIAL** — no strict user-to-quote binding; mitigated by UUID unpredictability and 10-minute expiry. - [x] Profile-assigned quote pricing persists `pricing_partner_id` without granting partner ownership. **PASS** — profile-assigned quotes store `user_id`, leave `partner_id` `NULL`, and authorize through the user ownership path. diff --git a/docs/security-spec/03-ramp-engine/ramp-phase-flows.md b/docs/security-spec/03-ramp-engine/ramp-phase-flows.md index 6f43a4489..4ce4823f9 100644 --- a/docs/security-spec/03-ramp-engine/ramp-phase-flows.md +++ b/docs/security-spec/03-ramp-engine/ramp-phase-flows.md @@ -101,11 +101,10 @@ graph TD Backup -->|No| DestTransfer BackupSquid --> DestTransfer - %% --- Alfredpay branch: squidRouterSwap handler short-circuits to destinationTransfer --- - %% (squid-router-phase-handler.ts:72 detects isAlfredpayOnramp and skips squidRouterPay + finalSettlementSubsidy) + %% --- Alfredpay branch: direct-token Polygon case short-circuits the swap, then final settlement subsidy runs before destinationTransfer --- AfMint --> AfFund[fundEphemeral] AfFund --> AfSquidSwap[squidRouterSwap] - AfSquidSwap -.short-circuit.-> DestTransfer + AfSquidSwap -.direct-token short-circuit.-> FinalSubsidy %% --- Terminal --- DestTransfer --> Complete([complete]) @@ -115,7 +114,7 @@ graph TD > - **EUR onramp funds the ephemeral.** `mykoboOnrampDeposit` transitions to `fundEphemeral` (`mykobo-onramp-deposit-handler.ts`), which then transitions to `subsidizePreSwap` (`fund-ephemeral-handler.ts` `BUY && inputCurrency === EURC` branch). This matches BRL onramp behavior and ensures the Base ephemeral has ETH gas for `nablaApprove`/`nablaSwap`/squid txs. > - **EUR/BRL onramps skip Pendulum funding.** `getRequiresPendulumEphemeralAddress` returns `false` for EURC and BRL inputs, so the registration flow never creates or funds a Pendulum ephemeral for these corridors. All movement is Base-EVM only. See `ephemeral-accounts.md`. > - **SquidRouter RPC selection is sourced from `bridgeMeta.fromNetwork`, not the input currency.** `squid-router-phase-handler.ts` computes the source network from `bridgeMeta.fromNetwork` (set at registration time by the route builder) and passes it to `getClient(network)` for both approve and swap calls. The earlier heuristic that selected the RPC from `inputCurrency` was removed because EUR-onramp presigned transactions both carry `network: Networks.Base` (`mykobo-to-evm.ts`), which would have triggered a wrong-chain signer error on cross-chain destinations (e.g., `invalid chain id for signer: have 8453 want 137` for EUR → Polygon USDT). -> - **Alfredpay onramp short-circuits.** `squid-router-phase-handler.ts:72` detects `isAlfredpayOnramp` and transitions directly to `destinationTransfer`, skipping `squidRouterPay` and `finalSettlementSubsidy`. +> - **Alfredpay direct-token onramp short-circuits only the Squid swap.** When Alfredpay mints `ALFREDPAY_EVM_TOKEN` on Polygon and the requested output is that same token on Polygon, `squid-router-phase-handler.ts` transitions to `finalSettlementSubsidy`, then `destinationTransfer`. Other Alfredpay EVM outputs still use the routed Squid path. > - The Pendulum-side on-ramp swap chain (`subsidizePreSwap` → `nablaApprove` → `nablaSwap` → `subsidizePostSwap` → `distributeFees` → `pendulumToAssethubXcm` / `pendulumToHydrationXcm` → `hydrationSwap` → `hydrationToAssethubXcm`) was used by the legacy Monerium-EUR-via-Pendulum corridor and by `avenia-to-assethub` BRL→AssetHub. Both corridors are **inactive**: Monerium was replaced by Mykobo-on-Base, and BRL↔AssetHub is temporarily disabled at quote eligibility. The Substrate-branch on-ramp handlers remain registered but are not reached by any active route. #### Off-Ramp Phase Flow diff --git a/docs/security-spec/05-integrations/alfredpay.md b/docs/security-spec/05-integrations/alfredpay.md index 79d79d96e..52cebafa8 100644 --- a/docs/security-spec/05-integrations/alfredpay.md +++ b/docs/security-spec/05-integrations/alfredpay.md @@ -51,7 +51,7 @@ For routed Alfredpay onramps (any non-passthrough output), the final quote outpu 12. **The Polygon swap short-circuit MUST be gated on the output token, not on the destination network alone** — Alfredpay mints `ALFREDPAY_EVM_TOKEN` (USDT) directly on Polygon, so the `squidRouterSwap` handler short-circuits straight to `finalSettlementSubsidy` (no swap) only when `quote.metadata.request.to === Networks.Polygon` **and** `quote.outputCurrency === ALFREDPAY_EVM_TOKEN`. `quote.metadata.request.to` is the destination *network*, not the output token; gating on the network alone would mis-deliver — a user requesting any other Polygon output (e.g. USDC) would silently receive the minted USDT instead of their swapped asset. The quote engine (`onramp-polygon-to-evm-alfredpay.ts`) mirrors this: it emits `skipRouteCalculation: true` only for the same-token (`outputCurrency === ALFREDPAY_EVM_TOKEN`) case and otherwise produces a real USDT→output swap. 13. **Offramp quote refresh at prep time MUST be strict and transactional** — `refreshAlfredpayOfframpQuoteIfMatching` (called during `prepareOfframpNonBrlTransactions`) re-fetches a provider quote and compares `toAmount` and `fee`. Any drift throws `INTERNAL_SERVER_ERROR`, aborting ramp registration. The quote metadata update (new `quoteId` + `expirationDate`) runs within the registration transaction, so a partial update cannot persist. 14. **`finalSettlementSubsidy` MUST NOT be skipped for Alfredpay offramps** — The `FinalSettlementSubsidyHandler` direct-transfer skip explicitly excludes `SELL && isAlfredpayToken(outputCurrency)`. This ensures the ephemeral on Polygon is always topped up to the expected amount before `alfredpayOfframpTransfer`, preventing under-funded settlements. -15. **Routed Alfredpay onramp quote output precision MUST match the destination token** — For Alfredpay USD/MXN/COP onramps that route through Squid, `quote.outputAmount` MUST preserve the final destination token's decimal precision, and `evmToEvm.outputAmountRaw` MUST represent the destination token's raw units. The Polygon-minted Alfredpay token is only the Squid source-side input. Direct Polygon same-token passthrough remains at the minted token's 6-decimal precision. +15. **Routed Alfredpay onramp quote output precision MUST match the destination token** — For Alfredpay USD/MXN/COP/ARS onramps that route through Squid, `quote.outputAmount` MUST preserve the final destination token's decimal precision, and `evmToEvm.outputAmountRaw` MUST represent the destination token's raw units. The Polygon-minted Alfredpay token is only the Squid source-side input. Direct Polygon same-token passthrough remains at the minted token's 6-decimal precision. ## Threat Vectors & Mitigations @@ -69,7 +69,7 @@ For routed Alfredpay onramps (any non-passthrough output), the final quote outpu | **Alfredpay offramp skipping subsidy via direct-transfer flag** | An Alfredpay offramp ramp with `isDirectTransfer === true` skips `finalSettlementSubsidy`, under-funding the settlement | `FinalSettlementSubsidyHandler` explicitly excludes `SELL && isAlfredpayToken(outputCurrency)` from the direct-transfer skip; subsidy always runs for Alfredpay offramps | | **Polygon passthrough rounding** | Same-chain same-token shortcut rounds the bridge output incorrectly, leaking dust or under-funding the destination | `toFixed(0, 0)` round-down in the squid-router finalize; downstream subsidy ensures the destination receives the quoted amount | | **Polygon wrong-token delivery** | A user on-ramps via Alfredpay and requests a non-USDT Polygon output (e.g. USDC); the handler skips the swap on destination-network alone and transfers the minted USDT, delivering the wrong asset | The `squidRouterSwap` short-circuit is gated on `quote.outputCurrency === ALFREDPAY_EVM_TOKEN` (not just `quote.metadata.request.to === Networks.Polygon`); non-USDT Polygon outputs run the real USDT→output swap. Matched in the quote engine's `skipRouteCalculation` branch. | -| **Routed destination precision loss** | A USD/MXN/COP Alfredpay onramp mints a 6-decimal Polygon source token, routes to an 18-decimal destination token, and stores the final quote output with source precision. The final amount is truncated before destination-transfer expectations are calculated. | Finalize routed Alfredpay EVM quotes with the destination token's decimals when `evmToEvm` metadata exists; keep direct Polygon same-token passthrough at minted-token precision. | +| **Routed destination precision loss** | A USD/MXN/COP/ARS Alfredpay onramp mints a 6-decimal Polygon source token, routes to an 18-decimal destination token, and stores the final quote output with source precision. The final amount is truncated before destination-transfer expectations are calculated. | Finalize routed Alfredpay EVM quotes with the destination token's decimals when `evmToEvm` metadata exists; keep direct Polygon same-token passthrough at minted-token precision. | ## Audit Checklist diff --git a/docs/security-spec/05-integrations/squid-router.md b/docs/security-spec/05-integrations/squid-router.md index c5abb76db..00a0e03a2 100644 --- a/docs/security-spec/05-integrations/squid-router.md +++ b/docs/security-spec/05-integrations/squid-router.md @@ -8,7 +8,7 @@ Squid Router is a cross-chain swap/routing protocol built on Axelar's General Me - **EUR on-ramp (Mykobo on Base)**: Base USDC → user's destination EVM chain (after EURC→USDC Nabla swap). - **EUR off-ramp (Mykobo on Base)**: User's source EVM chain → Base USDC (client-side user-signed). - **Alfredpay on-ramp**: Polygon Alfredpay token → user's destination EVM chain/token, except for Polygon same-token passthrough. -- **Off-ramp permit acquisition (Alfredpay)**: User EVM → Moonbeam via `TokenRelayer.execute()` with EIP-2612 permit. +- **Off-ramp permit acquisition (Alfredpay)**: User source EVM → Polygon via the source-chain `TokenRelayer.execute()` with EIP-2612 permit. > **Removed:** the previous Monerium-EUR Squid usage (Polygon EURe → Moonbeam) is no longer active; Monerium is deprecated (see `monerium.md`). @@ -35,7 +35,7 @@ For quote metadata, Squid's `route.estimate.toAmount` is already denominated in ### Off-ramp flow (user EVM source → Base USDC) 1. User signs one of three paths (depending on source ERC-20 capabilities and direction): - - **Permit path**: EIP-2612 permit + payload typed data → `squidRouterPermitExecute` → `TokenRelayer.execute()` pulls funds, approves Squid, calls swap atomically. Gas paid by `MOONBEAM_EXECUTOR_PRIVATE_KEY`. + - **Permit path**: EIP-2612 permit + payload typed data → `squidRouterPermitExecute` → source-chain `TokenRelayer.execute()` pulls funds, approves Squid, calls swap atomically. Gas is paid by the configured executor key through a wallet client for `fromNetwork`. - **No-permit fallback** (`isNoPermitFallback=true`): user's own wallet broadcasts `squidRouterNoPermitApprove` + `squidRouterNoPermitSwap` (or `squidRouterNoPermitTransferHash` for direct-transfer subcase). Frontend reports the resulting tx hashes back via `UpdateRampRequest.additionalData`. Backend awaits receipts via `waitForUserHash`. **No presigned-tx validation runs for these phases** — they are user-submitted (see `transaction-validation.md`). - **Direct transfer** (`isDirectTransfer=true`): same-chain same-token, user wallet submits a direct ERC-20 transfer to the Base ephemeral. 2. `squidRouterPay`: monitors Axelar GMP for arrival on Base. @@ -56,7 +56,7 @@ When the BRL on-ramp's destination is **Base + USDC**, the Nabla swap output is 5. **Squid API rate-limit responses MUST be retried with backoff** — 429 responses are retried with exponential backoff before failing the phase. Other errors propagate directly. 6. **Axelar gas funding MUST use `addNativeGas` on the correct chain** — The funding source/chain is selected based on the route, not from request input. 7. **Permit execution MUST verify both permit and payload signatures** — `squidRouterPermitExecute` extracts v/r/s from both `permitTypedData` and `payloadTypedData`; both must be valid `SignedTypedData`. -8. **`MOONBEAM_EXECUTOR_PRIVATE_KEY` is the relayer caller** — Funds gas only; MUST NOT hold user funds. +8. **The configured executor key is the relayer caller on the source EVM network** — It funds gas only; MUST NOT hold user funds. 9. **No-permit fallback MUST verify on-chain receipt for every reported user hash** — `waitForUserHash` calls `waitForTransactionReceipt`; non-success status throws `RecoverablePhaseError`. The user-reported hash itself is trusted (no signature verification — the receipt confirms it succeeded, which is sufficient because the user controls the source funds either way). 10. **No-permit fallback MUST NOT advance to `fundEphemeral` until BOTH approve and swap (or the direct transfer) have confirmed** — Sequential `waitForUserHash` calls in `executeNoPermitFallback` enforce this. 11. **Transaction hashes MUST be persisted to state before waiting** — `squidRouterApproveHash`, `squidRouterSwapHash`, `squidRouterPayTxHash`, `squidRouterPermitExecutionHash`, `squidRouterNoPermitApproveHash`, `squidRouterNoPermitSwapHash`, `squidRouterNoPermitTransferHash` all enable crash recovery. @@ -75,7 +75,7 @@ When the BRL on-ramp's destination is **Base + USDC**, the Nabla swap output is | **Squid Router API manipulation (fake "success")** | Balance check runs in parallel; even if Squid reports premature success, tokens must actually arrive. | | **Squid rate limit (429)** | Exponential backoff retry; other errors fail fast. | | **Transaction not found during confirmation** | Exponential backoff retry (5s → 10s → 20s → 30s cap), up to 4 attempts. | -| **No-permit fallback hash spoofing** | User reports tx hash → backend calls `waitForTransactionReceipt(hash)`. Hash is verified against actual chain state, not trusted blindly. The worst the user can do is report a hash that doesn't exist (handler errors recoverably) or a hash for a different transaction (receipt's `to`/`value` are not currently re-checked — see open question below). | +| **No-permit fallback hash spoofing** | User reports tx hash → backend calls `waitForTransactionReceipt(hash)` and verifies the receipt `from`, receipt `to`, and transaction calldata against the expected presigned user-wallet transaction. A missing hash or mismatched transaction fails before the phase advances. | | **No-permit allowance window attack** | The `squidRouterNoPermitApprove` grants Squid an allowance from the user's wallet; if the swap hash never confirms, the allowance lingers. The user wallet, not Vortex, retains the risk. UX should remind the user to revoke unused allowances; backend cannot revoke on the user's behalf. | | **Skip-Squid trivial-case manipulation** | The skip path triggers only when destination is Base+USDC, validated server-side by the quote engine before any presigned tx is generated. Attacker cannot force the skip path on non-Base/non-USDC routes. | | **Destination decimal under-scaling** | A quote route bridges from a 6-decimal source token to an 18-decimal destination token (for example Base USDC → BSC USDT), but metadata reconstructs the destination raw output using source decimals. Displayed decimals look correct while raw metadata is under-scaled. | Preserve Squid's `route.estimate.toAmount` directly as destination-token raw metadata, and persist `quote.outputAmount` with destination-token precision before building the final transfer. | From 86ab5054fc85f1c8eb3d52388c82873e11a9a1be Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 22 Jun 2026 17:45:16 +0200 Subject: [PATCH 025/176] Refresh deprecated chain lifecycle specs --- docs/security-spec/03-ramp-engine/ephemeral-accounts.md | 8 ++++---- docs/security-spec/06-cross-chain/bridge-security.md | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/security-spec/03-ramp-engine/ephemeral-accounts.md b/docs/security-spec/03-ramp-engine/ephemeral-accounts.md index 20e982479..a88e54d61 100644 --- a/docs/security-spec/03-ramp-engine/ephemeral-accounts.md +++ b/docs/security-spec/03-ramp-engine/ephemeral-accounts.md @@ -10,9 +10,9 @@ The cleanup process runs as a background worker (`cleanup.worker.ts`) on a 5-min Ephemeral accounts may be created on: - **Stellar** — For Spacewalk bridge operations and direct Stellar payments -- **Pendulum** — For Nabla swaps (Substrate-side), Spacewalk redeems, XCM transfers. **Not created** for BRL (BRLA) or EUR (Mykobo) Base-EVM corridors: `getRequiresPendulumEphemeralAddress` returns `false` when the input or output token is BRL or EURC, and registration skips Pendulum ephemeral creation + funding for those corridors. Only the Pendulum-routed corridors (Stellar/ARS, AssetHub, Hydration) still allocate a Pendulum ephemeral. -- **Moonbeam** — For legacy EVM operations (historical Monerium EUR → Moonbeam path is removed; still used for ARS-Stellar off-ramp's Moonbeam→Pendulum XCM hop, Alfredpay permit acquisition, and SquidRouter swaps), XCM to/from Pendulum -- **Polygon** — (Legacy) For Monerium EURe operations; no active corridor uses Polygon anymore but the post-process handler remains for safety on any still-in-flight legacy ramps +- **Pendulum** — For Nabla swaps (Substrate-side) and XCM transfers. **Not created** for BRL (BRLA), EUR (Mykobo), or Alfredpay Polygon/EVM corridors: `getRequiresPendulumEphemeralAddress` returns `false` when the route does not need Substrate-side movement, and registration skips Pendulum ephemeral creation + funding for those corridors. Only Pendulum-routed AssetHub/Hydration corridors allocate a Pendulum ephemeral. +- **Moonbeam** — For legacy EVM operations and XCM to/from Pendulum. Historical Monerium EUR → Moonbeam and ARS-via-Stellar paths are removed; current Alfredpay and Base EVM corridors should use their route source network rather than assuming Moonbeam. +- **Polygon** — Active for Alfredpay onramps/offramps. Alfredpay mints and receives `ALFREDPAY_EVM_TOKEN` on Polygon, and the Polygon post-process handler sweeps residual ERC-20 tokens after completion. - **AssetHub** — For XCM transfers to/from Pendulum and Hydration - **Hydration** — For Hydration DEX swaps and XCM transfers - **Base** — Hub for all BRL **and EUR** on/off-ramp flows. Hosts BRLA mint/burn (via Avenia), Mykobo EUR settlement (EURC on Base), Nabla-on-EVM swap (USDC↔BRLA, USDC↔EURC), and EVM fee distribution via Multicall3. @@ -24,7 +24,7 @@ Post-process handlers registered in `apps/api/src/api/services/phases/post-proce - **StellarPostProcessHandler** — Submits the `stellarCleanup` XDR to merge the Stellar ephemeral account back to the funding account. - **PendulumPostProcessHandler** — Submits the `pendulumCleanup` extrinsic to sweep Pendulum ephemeral tokens. - **MoonbeamPostProcessHandler** — Waits 3 hours for SquidRouter refunds to land, then submits `moonbeamCleanup` to sweep Moonbeam ephemeral tokens. -- **PolygonPostProcessHandler** — (Legacy Monerium support) On Monerium-onramp BUY ramps with a `polygonCleanup` presigned tx, broadcasts the user's pre-signed `approve` and then runs `transferFrom(ephemeral, fundingAccount, balance)` from the funding key to sweep residual ERC-20 tokens. Skipped when ephemeral balance is zero. **No active corridor produces new Polygon ephemerals; this handler exists for in-flight legacy ramps and can be retired once Monerium ramps are fully drained.** +- **PolygonPostProcessHandler** — On Polygon-routed ramps with a `polygonCleanup` presigned tx, broadcasts the user's pre-signed `approve` and then runs `transferFrom(ephemeral, fundingAccount, balance)` from the funding key to sweep residual ERC-20 tokens. Skipped when ephemeral balance is zero. This is active for Alfredpay corridors and also protects any still-in-flight legacy Polygon ramps. - **HydrationPostProcessHandler** — On BUY ramps with a `hydrationCleanup` presigned extrinsic, submits the cleanup extrinsic. - **AssetHubPostProcessHandler** — Registered but inert. `shouldProcess` returns `false` unconditionally; `process` returns `[true, null]`. No on-chain action is performed. Effectively a placeholder for future AssetHub cleanup. diff --git a/docs/security-spec/06-cross-chain/bridge-security.md b/docs/security-spec/06-cross-chain/bridge-security.md index 53aced9d1..4527c7b25 100644 --- a/docs/security-spec/06-cross-chain/bridge-security.md +++ b/docs/security-spec/06-cross-chain/bridge-security.md @@ -1,8 +1,10 @@ # Bridge Security — Spacewalk +> **⚠️ FULLY DEPRECATED.** The Spacewalk/Stellar bridge path is no longer an active Vortex corridor. EUR has migrated to Mykobo on Base, and ARS now routes through Alfredpay where supported. `spacewalkRedeemHandler` and `stellarPaymentHandler` are not registered in the active phase registry. This page is retained as historical documentation for the prior bridge model; do not treat it as reachable production behavior. + ## What This Does -Spacewalk is the bridge between the **Pendulum** parachain and the **Stellar** network. It enables off-ramp flows that terminate on Stellar (ARS today; EUR was migrated to Mykobo on Base — see `05-integrations/mykobo.md`) by converting Pendulum-wrapped Stellar tokens back to native Stellar tokens. +Spacewalk is the bridge between the **Pendulum** parachain and the **Stellar** network. Historically, it enabled off-ramp flows that terminated on Stellar by converting Pendulum-wrapped Stellar tokens back to native Stellar tokens. Those corridors are now removed from the active Vortex phase registry. The bridge operates through a **vault-based model**: independent vault operators lock collateral on Pendulum and process redeem requests. When a user (or ephemeral account) wants to redeem Pendulum-wrapped tokens for their Stellar originals, a vault is selected, the wrapped tokens are burned on Pendulum, and the vault releases the native tokens on Stellar. From 0b93dd82d0b93ce400ebe61953123f748ed688c7 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Tue, 23 Jun 2026 11:03:18 +0200 Subject: [PATCH 026/176] Address PR review feedback --- .../sdk/examples/exampleAlfredpayMexico.ts | 2 +- packages/sdk/src/eip712.ts | 20 +++++++++++++++++-- packages/sdk/src/handlers/AlfredpayHandler.ts | 4 +--- packages/sdk/test/alfredpayHandler.test.ts | 16 +++++++-------- packages/sdk/test/eip712.test.ts | 17 +++++++++++++--- 5 files changed, 42 insertions(+), 17 deletions(-) diff --git a/packages/sdk/examples/exampleAlfredpayMexico.ts b/packages/sdk/examples/exampleAlfredpayMexico.ts index 606a3f9d8..4e81c101f 100644 --- a/packages/sdk/examples/exampleAlfredpayMexico.ts +++ b/packages/sdk/examples/exampleAlfredpayMexico.ts @@ -199,7 +199,7 @@ async function main(): Promise { } } -if (require.main === module) { +if (import.meta.main) { main() .then(() => { console.log("\n✨ Example execution completed"); diff --git a/packages/sdk/src/eip712.ts b/packages/sdk/src/eip712.ts index 0745ce40f..98427b0f1 100644 --- a/packages/sdk/src/eip712.ts +++ b/packages/sdk/src/eip712.ts @@ -62,6 +62,22 @@ export function typedDataToSign(tx: UnsignedTx, options: { includeDomainType?: b })); } +function typedDataDeadline(item: SignedTypedData, phase: string): number { + const deadline = item.message.deadline; + if (deadline === undefined || deadline === null) { + throw new Error(`attachSignatures: phase ${phase} typed-data payload is missing a deadline.`); + } + + const numericDeadline = Number(deadline); + if (!Number.isFinite(numericDeadline) || !Number.isInteger(numericDeadline) || numericDeadline <= 0) { + throw new Error( + `attachSignatures: phase ${phase} typed-data deadline must be a positive integer, got ${String(deadline)}.` + ); + } + + return numericDeadline; +} + /** * Attach user signatures to the typed-data payload(s) of a transaction, producing the signed * txData to submit. A transaction may carry several payloads (e.g. permit + relayer payload); @@ -77,7 +93,7 @@ export function attachSignatures(tx: UnsignedTx, signatures: string[]): SignedTy } return items.map((item, i) => { const { v, r, s } = splitSignature(signatures[i]); - const deadline = Number((item.message as Record).deadline ?? 0); + const deadline = typedDataDeadline(item, tx.phase); return { ...item, signature: { deadline, r, s, v } }; }); } @@ -88,7 +104,7 @@ export function splitSignature(signature: string): { v: number; r: `0x${string}` const cleaned = signature.trim().replace(/^['"]+|['"]+$/g, ""); const hex = cleaned.startsWith("0x") ? cleaned.slice(2) : cleaned; if (hex.length !== 130) { - throw new Error(`Invalid signature: expected a 65-byte hex string, got ${cleaned.length} chars.`); + throw new Error(`Invalid signature: expected a 65-byte hex string, got ${hex.length} hex chars.`); } const r = `0x${hex.slice(0, 64)}` as `0x${string}`; const s = `0x${hex.slice(64, 128)}` as `0x${string}`; diff --git a/packages/sdk/src/handlers/AlfredpayHandler.ts b/packages/sdk/src/handlers/AlfredpayHandler.ts index 860ad9be5..e7bb70e12 100644 --- a/packages/sdk/src/handlers/AlfredpayHandler.ts +++ b/packages/sdk/src/handlers/AlfredpayHandler.ts @@ -128,9 +128,7 @@ export class AlfredpayHandler implements RampHandler { async updateAlfredpayOfframp(rampId: string, additionalData: AlfredpayOfframpUpdateAdditionalData): Promise { const rampProcess = await this.apiService.getRampStatus(rampId); if (rampProcess.currentPhase !== "initial") { - throw new Error( - `Invalid ramp id. Ramp must be on initial phase to be updated. Current phase: ${rampProcess.currentPhase}` - ); + throw new Error(`Ramp cannot be updated in its current phase. Expected initial phase, got: ${rampProcess.currentPhase}`); } const updateRequest: UpdateRampRequest = { diff --git a/packages/sdk/test/alfredpayHandler.test.ts b/packages/sdk/test/alfredpayHandler.test.ts index ccef2a0ae..f9e0b3aca 100644 --- a/packages/sdk/test/alfredpayHandler.test.ts +++ b/packages/sdk/test/alfredpayHandler.test.ts @@ -3,7 +3,7 @@ // RPC, KYC, or on-chain funds) to lock in routing, request payloads, and call // ordering. Run: cd packages/sdk && bun test -import { describe, expect, test } from "bun:test"; +import {describe, expect, test} from "bun:test"; import { EPaymentMethod, EphemeralAccountType, @@ -15,13 +15,13 @@ import { RampDirection, RampProcess, RegisterRampRequest, - UpdateRampRequest, - UnsignedTx + UnsignedTx, + UpdateRampRequest } from "@vortexfi/shared"; -import { MissingAlfredpayOfframpParametersError, MissingAlfredpayOnrampParametersError } from "../src/errors"; -import { AlfredpayHandler } from "../src/handlers/AlfredpayHandler"; -import { ApiService } from "../src/services/ApiService"; -import type { VortexSdkContext } from "../src/types"; +import {MissingAlfredpayOfframpParametersError, MissingAlfredpayOnrampParametersError} from "../src/errors"; +import {AlfredpayHandler} from "../src/handlers/AlfredpayHandler"; +import {ApiService} from "../src/services/ApiService"; +import type {VortexSdkContext} from "../src/types"; const WALLET = "0x1234567890123456789012345678901234567890"; const FIAT_ACCOUNT = "fa_demo"; @@ -229,6 +229,6 @@ describe("AlfredpayHandler offramp update", () => { test("throws when ramp is not on the initial phase", async () => { const { handler } = setup({ currentPhase: "fundEphemeral" }); - await expect(handler.updateAlfredpayOfframp("ramp_1", {})).rejects.toThrow(/initial phase/); + await expect(handler.updateAlfredpayOfframp("ramp_1", {})).rejects.toThrow(/current phase/); }); }); diff --git a/packages/sdk/test/eip712.test.ts b/packages/sdk/test/eip712.test.ts index 18360c3a5..0ecaaa772 100644 --- a/packages/sdk/test/eip712.test.ts +++ b/packages/sdk/test/eip712.test.ts @@ -1,5 +1,5 @@ -import { describe, expect, it } from "bun:test"; -import { attachSignatures, splitSignature, typedDataToSign, userTransactionType } from "../src/eip712"; +import {describe, expect, it} from "bun:test"; +import {attachSignatures, splitSignature, typedDataToSign, userTransactionType} from "../src/eip712"; const tx = (txData: unknown) => ({ meta: {}, network: "polygon", nonce: 0, phase: "squidRouterPermitExecute", signer: "0xabc", txData }) as never; @@ -101,6 +101,17 @@ describe("attachSignatures", () => { it("throws when the transaction has no typed-data payloads", () => { expect(() => attachSignatures(tx({ data: "0x", to: "0x1", value: "0" }), [sig])).toThrow(); }); + + it("throws when a typed-data payload has no deadline", () => { + const { deadline: _deadline, ...messageWithoutDeadline } = saltPermit.message; + expect(() => attachSignatures(tx({ ...saltPermit, message: messageWithoutDeadline }), [sig])).toThrow(/missing a deadline/); + }); + + it("throws when a typed-data payload deadline is not numeric", () => { + expect(() => attachSignatures(tx({ ...saltPermit, message: { ...saltPermit.message, deadline: "soon" } }), [sig])).toThrow( + /positive integer/ + ); + }); }); describe("splitSignature", () => { @@ -115,6 +126,6 @@ describe("splitSignature", () => { expect(splitSignature(`0x${"a".repeat(64)}${"b".repeat(64)}00`).v).toBe(27); }); it("rejects a wrong-length signature", () => { - expect(() => splitSignature("0x1234")).toThrow(); + expect(() => splitSignature("0x1234")).toThrow(/got 4 hex chars/); }); }); From 4540c75efc7e1afefdcc688cec280983948dd0db Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Tue, 23 Jun 2026 12:08:43 +0200 Subject: [PATCH 027/176] Refactor user transaction handling in SDK to streamline signing and broadcasting --- docs/api/pages/02-quick-start-with-the-sdk.md | 55 ++++------------ packages/sdk/README.md | 29 +++------ .../sdk/examples/exampleAlfredpayMexico.ts | 63 ++++++++----------- packages/sdk/src/VortexSdk.ts | 50 +++++++++++++++ packages/sdk/src/eip712.ts | 8 ++- packages/sdk/src/types.ts | 24 +++++-- packages/sdk/test/eip712.test.ts | 57 +++++++++++++++++ 7 files changed, 180 insertions(+), 106 deletions(-) diff --git a/docs/api/pages/02-quick-start-with-the-sdk.md b/docs/api/pages/02-quick-start-with-the-sdk.md index 3bd1efa69..e69b7794b 100644 --- a/docs/api/pages/02-quick-start-with-the-sdk.md +++ b/docs/api/pages/02-quick-start-with-the-sdk.md @@ -89,31 +89,15 @@ const { rampProcess, unsignedTransactions } = await sdk.registerRamp(quote, { ### Signing The User Transaction With Wagmi -The user-owned transactions are EVM typed-data payloads. With wagmi: +The user-owned transactions are EVM typed-data payloads or EVM transactions. Keep wallet prompts in your application and let the SDK handle classification and submission: ```js import { signTypedData, sendTransaction } from "@wagmi/core"; -for (const tx of unsignedTransactions) { - const txType = sdk.getUserTransactionType(tx); - - if (txType === "evm-typed-data") { - const payloads = sdk.getTypedDataToSign(tx); - const signatures = []; - - for (const payload of payloads) { - signatures.push(await signTypedData(wagmiConfig, payload)); - } - - await sdk.submitUserSignature(rampProcess.id, tx, signatures); - } else if (txType === "evm-transaction") { - const evmTx = sdk.getTransactionToBroadcast(tx); - const hash = await sendTransaction(wagmiConfig, evmTx); - await sdk.submitUserTxHash(rampProcess.id, tx, hash); - } else { - throw new Error(`Unsupported user transaction for phase ${tx.phase} on ${tx.network}`); - } -} +await sdk.submitUserTransactions(rampProcess.id, unsignedTransactions, { + signTypedData: payload => signTypedData(wagmiConfig, payload), + sendTransaction: tx => sendTransaction(wagmiConfig, tx) +}); const started = await sdk.startRamp(rampProcess.id); ``` @@ -176,37 +160,20 @@ const { rampProcess, unsignedTransactions } = await sdk.registerRamp(quote, { ### Signing MXN Offramp User Transactions -Use the SDK helpers to classify, sign, and submit each entry in `unsignedTransactions`: +Use the SDK helper to classify, sign, broadcast, and submit each entry in `unsignedTransactions`: ```js import { signTypedData, sendTransaction } from "@wagmi/core"; -for (const tx of unsignedTransactions) { - const txType = sdk.getUserTransactionType(tx); - - if (txType === "evm-typed-data") { - // A single tx may carry several typed-data payloads (e.g. permit + relayer). Sign each in order. - const payloads = sdk.getTypedDataToSign(tx); // wagmi / viem signTypedData-ready - const signatures = []; - - for (const payload of payloads) { - signatures.push(await signTypedData(wagmiConfig, payload)); - } - - await sdk.submitUserSignature(rampProcess.id, tx, signatures); - } else if (txType === "evm-transaction") { - const evmTx = sdk.getTransactionToBroadcast(tx); - const hash = await sendTransaction(wagmiConfig, evmTx); - await sdk.submitUserTxHash(rampProcess.id, tx, hash); - } else { - throw new Error(`Unsupported user transaction for phase ${tx.phase} on ${tx.network}`); - } -} +await sdk.submitUserTransactions(rampProcess.id, unsignedTransactions, { + signTypedData: payload => signTypedData(wagmiConfig, payload), + sendTransaction: tx => sendTransaction(wagmiConfig, tx) +}); await sdk.startRamp(rampProcess.id); ``` -For wallets that call `eth_signTypedData_v4` directly, pass `{ includeDomainType: true }` to `getTypedDataToSign`. +For wallets that call `eth_signTypedData_v4` directly, set `includeDomainType: true` on `submitUserTransactions` or pass `{ includeDomainType: true }` to `getTypedDataToSign` when using the lower-level helpers. ## Tracking Status diff --git a/packages/sdk/README.md b/packages/sdk/README.md index 36217fc1b..abdf8f852 100644 --- a/packages/sdk/README.md +++ b/packages/sdk/README.md @@ -97,27 +97,11 @@ const { rampProcess, unsignedTransactions } = await sdk.registerRamp(quote, { walletAddress: "0x1234567890123456789012345678901234567890" }); -// Sign and submit each user-side transaction before starting the ramp. -for (const tx of unsignedTransactions) { - const txType = sdk.getUserTransactionType(tx); - - if (txType === "evm-typed-data") { - const payloads = sdk.getTypedDataToSign(tx); - const signatures = []; - - for (const payload of payloads) { - signatures.push(await walletClient.signTypedData(payload)); - } - - await sdk.submitUserSignature(rampProcess.id, tx, signatures); - } else if (txType === "evm-transaction") { - const evmTx = sdk.getTransactionToBroadcast(tx); - const hash = await walletClient.sendTransaction(evmTx); - await sdk.submitUserTxHash(rampProcess.id, tx, hash); - } else { - throw new Error(`Unsupported user transaction for phase ${tx.phase} on ${tx.network}`); - } -} +// Sign or broadcast each user-side transaction before starting the ramp. +await sdk.submitUserTransactions(rampProcess.id, unsignedTransactions, { + signTypedData: payload => walletClient.signTypedData(payload), + sendTransaction: tx => walletClient.sendTransaction(tx) +}); const startedRamp = await sdk.startRamp(rampProcess.id); ``` @@ -173,6 +157,9 @@ Returns the EVM transaction data for an `"evm-transaction"` transaction. Throws ##### `submitUserTxHash(rampId: string, tx: UnsignedTx, hash: string): Promise` Submits the on-chain transaction hash for a user-broadcast EVM transaction. +##### `submitUserTransactions(rampId: string, unsignedTransactions: UnsignedTx[], handlers: SubmitUserTransactionsHandlers): Promise` +Processes every user-owned transaction returned by `registerRamp`. The SDK classifies each entry, calls your `signTypedData` or `sendTransaction` callback, and submits the resulting signatures or hashes back to Vortex. Wallet prompts stay under your application's control; the SDK never receives a wallet object or private key. + ## Error Handling ### Ephemeral Account Freshness diff --git a/packages/sdk/examples/exampleAlfredpayMexico.ts b/packages/sdk/examples/exampleAlfredpayMexico.ts index 4e81c101f..c54d2f923 100644 --- a/packages/sdk/examples/exampleAlfredpayMexico.ts +++ b/packages/sdk/examples/exampleAlfredpayMexico.ts @@ -137,47 +137,38 @@ async function runMexicoOfframp(sdk: VortexSdk): Promise { }); console.log(`✅ Offramp registered. Ramp ID: ${rampProcess.id}`); - // Handle each user transaction with the SDK's helpers (no EIP-712 reconstruction needed here). const localAccount = OFFRAMP_WALLET_PRIVATE_KEY ? privateKeyToAccount(OFFRAMP_WALLET_PRIVATE_KEY) : undefined; - for (const tx of unsignedTransactions) { - const txType = sdk.getUserTransactionType(tx); - - if (txType === "evm-typed-data") { - // A typed-data tx may carry several payloads (e.g. permit + relayer payload). Sign each in order. - const payloads = sdk.getTypedDataToSign(tx); // wagmi / viem signTypedData-ready - const v4Payloads = sdk.getTypedDataToSign(tx, { includeDomainType: true }); // eth_signTypedData_v4-ready - const signatures: string[] = []; - - for (let i = 0; i < payloads.length; i++) { - if (localAccount) { - signatures.push(await localAccount.signTypedData(payloads[i] as Parameters[0])); - console.log( - ` [${i + 1}/${payloads.length}] ${payloads[i].primaryType} signed locally by ${localAccount.address}` - ); - } else { - console.log( - `\n----- sign payload ${i + 1}/${payloads.length}: ${payloads[i].primaryType} (account ${tx.signer}) -----` - ); - console.log(JSON.stringify(v4Payloads[i], null, 2)); - signatures.push(await askQuestion(`➡️ Signature for ${payloads[i].primaryType}: `)); - } + await sdk.submitUserTransactions(rampProcess.id, unsignedTransactions, { + sendTransaction: async (evmTx, { unsignedTransaction }) => { + console.log( + `\n🛑 Broadcast ${unsignedTransaction.phase} from your wallet: to=${evmTx.to} value=${evmTx.value} data=${evmTx.data}` + ); + const hash = await askQuestion(`➡️ Tx hash for ${unsignedTransaction.phase}: `); + console.log(`✅ Received hash for ${unsignedTransaction.phase}.`); + return hash; + }, + signTypedData: async (payload, { payloadCount, payloadIndex, unsignedTransaction }) => { + if (localAccount) { + const signature = await localAccount.signTypedData(payload as Parameters[0]); + console.log( + ` [${payloadIndex + 1}/${payloadCount}] ${payload.primaryType} signed locally by ${localAccount.address}` + ); + return signature; } - console.log(`📝 Submitting ${signatures.length} signature(s) for ${tx.phase}...`); - await sdk.submitUserSignature(rampProcess.id, tx, signatures); - console.log(`✅ Submitted signature(s) for ${tx.phase}.`); - } else if (txType === "evm-transaction") { - // Broadcast path: user sends the EVM tx from their wallet, then pushes the hash back. - const evmTx = sdk.getTransactionToBroadcast(tx); - console.log(`\n🛑 Broadcast ${tx.phase} from your wallet: to=${evmTx.to} value=${evmTx.value} data=${evmTx.data}`); - const hash = await askQuestion(`➡️ Tx hash for ${tx.phase}: `); - await sdk.submitUserTxHash(rampProcess.id, tx, hash); - console.log(`✅ Submitted hash for ${tx.phase}.`); - } else { - throw new Error(`Unsupported user transaction for phase ${tx.phase} on ${tx.network}`); + const [v4Payload] = sdk + .getTypedDataToSign(unsignedTransaction, { includeDomainType: true }) + .slice(payloadIndex, payloadIndex + 1); + console.log( + `\n----- sign payload ${payloadIndex + 1}/${payloadCount}: ${payload.primaryType} (account ${unsignedTransaction.signer}) -----` + ); + console.log(JSON.stringify(v4Payload, null, 2)); + const signature = await askQuestion(`➡️ Signature for ${payload.primaryType}: `); + console.log(`✅ Received signature for ${unsignedTransaction.phase}.`); + return signature; } - } + }); console.log("📝 Step 4: Starting offramp..."); await sdk.startRamp(rampProcess.id); diff --git a/packages/sdk/src/VortexSdk.ts b/packages/sdk/src/VortexSdk.ts index 0ff411080..071ec60b1 100644 --- a/packages/sdk/src/VortexSdk.ts +++ b/packages/sdk/src/VortexSdk.ts @@ -36,6 +36,7 @@ import type { BrlOnrampAdditionalData, ExtendedQuoteResponse, RegisterRampAdditionalData, + SubmitUserTransactionsHandlers, UpdateRampAdditionalData, VortexSdkConfig } from "./types"; @@ -228,6 +229,55 @@ export class VortexSdk { return this.apiService.updateRamp({ additionalData: { [`${tx.phase}Hash`]: hash }, presignedTxs: [], rampId }); } + /** + * Process all user-owned transactions returned by registerRamp. The SDK classifies each entry, + * asks the caller's wallet callbacks to sign or broadcast it, then submits the result to Vortex. + */ + async submitUserTransactions( + rampId: string, + unsignedTransactions: UnsignedTx[], + handlers: SubmitUserTransactionsHandlers + ): Promise { + let rampProcess: RampProcess | undefined; + + for (const tx of unsignedTransactions) { + const txType = this.getUserTransactionType(tx); + + if (txType === "evm-typed-data") { + if (!handlers.signTypedData) { + throw new Error(`submitUserTransactions: signTypedData handler is required for phase ${tx.phase}.`); + } + + const payloads = this.getTypedDataToSign(tx, { includeDomainType: handlers.includeDomainType }); + const signatures: string[] = []; + + for (let payloadIndex = 0; payloadIndex < payloads.length; payloadIndex++) { + signatures.push( + await handlers.signTypedData(payloads[payloadIndex], { + payloadCount: payloads.length, + payloadIndex, + unsignedTransaction: tx + }) + ); + } + + rampProcess = await this.submitUserSignature(rampId, tx, signatures); + } else if (txType === "evm-transaction") { + if (!handlers.sendTransaction) { + throw new Error(`submitUserTransactions: sendTransaction handler is required for phase ${tx.phase}.`); + } + + const transaction = this.getTransactionToBroadcast(tx); + const hash = await handlers.sendTransaction(transaction, { unsignedTransaction: tx }); + rampProcess = await this.submitUserTxHash(rampId, tx, hash); + } else { + throw new Error(`Unsupported user transaction for phase ${tx.phase} on ${tx.network}`); + } + } + + return rampProcess ?? this.getRampStatus(rampId); + } + public async storeEphemerals( ephemerals: { [key in EphemeralAccountType]?: EphemeralAccount }, rampId: string diff --git a/packages/sdk/src/eip712.ts b/packages/sdk/src/eip712.ts index 98427b0f1..6ed3d1b5a 100644 --- a/packages/sdk/src/eip712.ts +++ b/packages/sdk/src/eip712.ts @@ -106,11 +106,17 @@ export function splitSignature(signature: string): { v: number; r: `0x${string}` if (hex.length !== 130) { throw new Error(`Invalid signature: expected a 65-byte hex string, got ${hex.length} hex chars.`); } + if (!/^[0-9a-fA-F]+$/.test(hex)) { + throw new Error("Invalid signature: signature must contain only hex characters."); + } const r = `0x${hex.slice(0, 64)}` as `0x${string}`; const s = `0x${hex.slice(64, 128)}` as `0x${string}`; let v = Number.parseInt(hex.slice(128, 130), 16); - if (v < 27) { + if (v === 0 || v === 1) { v += 27; } + if (v !== 27 && v !== 28) { + throw new Error(`Invalid signature: v must be 0, 1, 27, or 28, got ${v}.`); + } return { r, s, v }; } diff --git a/packages/sdk/src/types.ts b/packages/sdk/src/types.ts index 1ac5c06e1..afc80f2b2 100644 --- a/packages/sdk/src/types.ts +++ b/packages/sdk/src/types.ts @@ -1,6 +1,6 @@ // Types re-exported used to create quotes. -import type { CreateQuoteRequest, EvmTransactionData, PaymentMethod, QuoteResponse } from "@vortexfi/shared"; +import type { CreateQuoteRequest, EvmTransactionData, PaymentMethod, QuoteResponse, SignedTypedData } from "@vortexfi/shared"; import { EPaymentMethod, EphemeralAccount, @@ -15,15 +15,15 @@ import { } from "@vortexfi/shared"; export { + CreateQuoteRequest, EPaymentMethod, + EvmTransactionData, EvmToken, FiatToken, Networks, - RampDirection, PaymentMethod, QuoteResponse, - CreateQuoteRequest, - EvmTransactionData + RampDirection }; export type AnyQuote = @@ -194,6 +194,22 @@ export interface RampState { unsignedTxs: UnsignedTx[]; } +export interface UserTypedDataSigningContext { + unsignedTransaction: UnsignedTx; + payloadIndex: number; + payloadCount: number; +} + +export interface UserEvmTransactionContext { + unsignedTransaction: UnsignedTx; +} + +export interface SubmitUserTransactionsHandlers { + includeDomainType?: boolean; + signTypedData?: (payload: SignedTypedData, context: UserTypedDataSigningContext) => Promise; + sendTransaction?: (transaction: EvmTransactionData, context: UserEvmTransactionContext) => Promise; +} + export interface NetworkConfig { name: string; wsUrl: string; diff --git a/packages/sdk/test/eip712.test.ts b/packages/sdk/test/eip712.test.ts index 0ecaaa772..d5db8e428 100644 --- a/packages/sdk/test/eip712.test.ts +++ b/packages/sdk/test/eip712.test.ts @@ -1,5 +1,7 @@ import {describe, expect, it} from "bun:test"; +import type {RampProcess} from "@vortexfi/shared"; import {attachSignatures, splitSignature, typedDataToSign, userTransactionType} from "../src/eip712"; +import {VortexSdk} from "../src/VortexSdk"; const tx = (txData: unknown) => ({ meta: {}, network: "polygon", nonce: 0, phase: "squidRouterPermitExecute", signer: "0xabc", txData }) as never; @@ -128,4 +130,59 @@ describe("splitSignature", () => { it("rejects a wrong-length signature", () => { expect(() => splitSignature("0x1234")).toThrow(/got 4 hex chars/); }); + it("rejects non-hex signature bytes", () => { + expect(() => splitSignature(`0x${"a".repeat(64)}${"b".repeat(64)}zz`)).toThrow(/only hex characters/); + }); + it("rejects unsupported v values", () => { + expect(() => splitSignature(`0x${"a".repeat(64)}${"b".repeat(64)}02`)).toThrow(/v must be/); + }); +}); + +describe("submitUserTransactions", () => { + function sdkWithCapturedUpdates(updates: unknown[]): VortexSdk { + const sdk = Object.create(VortexSdk.prototype) as VortexSdk; + Object.defineProperty(sdk, "apiService", { + value: { + getRampStatus: async () => ({ id: "ramp-1" }) as RampProcess, + updateRamp: async (request: unknown) => { + updates.push(request); + return { id: "ramp-1" } as RampProcess; + } + } + }); + return sdk; + } + + it("signs typed-data payloads in order and submits the signed tx data", async () => { + const updates: unknown[] = []; + const sdk = sdkWithCapturedUpdates(updates); + const sig = `0x${"a".repeat(64)}${"b".repeat(64)}1b`; + + await sdk.submitUserTransactions("ramp-1", [tx([saltPermit, saltPermit])], { + signTypedData: async (payload, context) => { + expect(payload.primaryType).toBe("Permit"); + expect(context.payloadIndex).toBeLessThan(context.payloadCount); + return sig; + } + }); + + const [request] = updates as Array<{ presignedTxs: Array<{ txData: Array<{ signature: { v: number } }> }> }>; + expect(request.presignedTxs[0].txData).toHaveLength(2); + expect(request.presignedTxs[0].txData[0].signature.v).toBe(27); + }); + + it("broadcasts EVM transactions and submits the resulting phase hash", async () => { + const updates: unknown[] = []; + const sdk = sdkWithCapturedUpdates(updates); + + await sdk.submitUserTransactions("ramp-1", [tx({ data: "0x1234", to: "0x1", value: "0" })], { + sendTransaction: async transaction => { + expect(transaction.data).toBe("0x1234"); + return "0xhash"; + } + }); + + const [request] = updates as Array<{ additionalData: Record }>; + expect(request.additionalData.squidRouterPermitExecuteHash).toBe("0xhash"); + }); }); From fbc885d7f768681c9f0b4eed077373f75ca8a077 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Tue, 23 Jun 2026 18:48:43 +0200 Subject: [PATCH 028/176] Address code review findings --- packages/sdk/src/VortexSdk.ts | 12 +++++++++++- packages/sdk/src/eip712.ts | 18 +++++------------- packages/sdk/src/errors.ts | 9 ++++++--- packages/sdk/src/types.ts | 1 + 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/packages/sdk/src/VortexSdk.ts b/packages/sdk/src/VortexSdk.ts index 071ec60b1..7f643252c 100644 --- a/packages/sdk/src/VortexSdk.ts +++ b/packages/sdk/src/VortexSdk.ts @@ -183,6 +183,11 @@ export class VortexSdk { * The signature is attached to the transaction and submitted to Vortex. */ async submitUserSignature(rampId: string, tx: UnsignedTx, signatures: string | string[]): Promise { + if (userTransactionType(tx) !== "evm-typed-data") { + throw new Error( + `submitUserSignature: phase ${tx.phase} is not a typed-data transaction; use submitUserTxHash for evm-transaction types.` + ); + } const sigList = Array.isArray(signatures) ? signatures : [signatures]; const signedTxData = attachSignatures(tx, sigList); return this.apiService.updateRamp({ additionalData: {}, presignedTxs: [{ ...tx, txData: signedTxData }], rampId }); @@ -271,7 +276,12 @@ export class VortexSdk { const hash = await handlers.sendTransaction(transaction, { unsignedTransaction: tx }); rampProcess = await this.submitUserTxHash(rampId, tx, hash); } else { - throw new Error(`Unsupported user transaction for phase ${tx.phase} on ${tx.network}`); + if (!handlers.handleUnsupported) { + throw new Error( + `submitUserTransactions: no handler provided for unsupported transaction type at phase ${tx.phase} on ${tx.network}.` + ); + } + await handlers.handleUnsupported(tx); } } diff --git a/packages/sdk/src/eip712.ts b/packages/sdk/src/eip712.ts index 6ed3d1b5a..618c1c2ad 100644 --- a/packages/sdk/src/eip712.ts +++ b/packages/sdk/src/eip712.ts @@ -1,4 +1,5 @@ import { + type EvmTransactionData, isEvmTransactionData, isSignedTypedData, isSignedTypedDataArray, @@ -21,18 +22,6 @@ export const EIP712_DOMAIN_FIELD_TYPES: Record = { // A non-canonical order produces a different domain hash and breaks signature recovery. export const EIP712_DOMAIN_FIELD_ORDER = ["name", "version", "chainId", "verifyingContract", "salt"]; -export function isTypedDataItem(item: unknown): item is SignedTypedData { - return ( - typeof item === "object" && - item !== null && - !Array.isArray(item) && - "domain" in item && - "types" in item && - "primaryType" in item && - "message" in item - ); -} - export function userTransactionType(tx: UnsignedTx): UserTransactionType { if (isSignedTypedData(tx.txData) || isSignedTypedDataArray(tx.txData)) { return "evm-typed-data"; @@ -46,7 +35,10 @@ export function userTransactionType(tx: UnsignedTx): UserTransactionType { } export function typedDataToSign(tx: UnsignedTx, options: { includeDomainType?: boolean } = {}): SignedTypedData[] { - const items = (Array.isArray(tx.txData) ? tx.txData : [tx.txData]).filter(isTypedDataItem); + const txDataArray = Array.isArray(tx.txData) ? tx.txData : [tx.txData]; + const items = txDataArray.filter((item): item is SignedTypedData => + isSignedTypedData(item as string | EvmTransactionData | SignedTypedData | SignedTypedData[]) + ); if (!options.includeDomainType) { return items; } diff --git a/packages/sdk/src/errors.ts b/packages/sdk/src/errors.ts index 51fc921b0..aa43777ad 100644 --- a/packages/sdk/src/errors.ts +++ b/packages/sdk/src/errors.ts @@ -187,8 +187,8 @@ export class AlfredpayOfframpError extends RegisterRampError { } export class MissingAlfredpayOfframpParametersError extends AlfredpayOfframpError { - constructor() { - super("Parameters fiatAccountId and walletAddress are required for Alfredpay offramp", 400); + constructor(message = "Parameters fiatAccountId and walletAddress are required for Alfredpay offramp") { + super(message, 400); this.name = "MissingAlfredpayOfframpParametersError"; } } @@ -435,7 +435,10 @@ export function parseAPIError(response: unknown): VortexSdkError { return new MissingAlfredpayOnrampParametersError(); } if (errorMessage === "fiatAccountId is required for Alfredpay offramp") { - return new MissingAlfredpayOfframpParametersError(); + return new MissingAlfredpayOfframpParametersError(errorMessage); + } + if (errorMessage === "User address must be provided for offramping.") { + return new MissingAlfredpayOfframpParametersError(errorMessage); } if (errorMessage === "Parameters moneriumAuthToken and destinationAddress are required for Monerium onramp") { return new MissingMoneriumOnrampParametersError(); diff --git a/packages/sdk/src/types.ts b/packages/sdk/src/types.ts index afc80f2b2..6e014a9fc 100644 --- a/packages/sdk/src/types.ts +++ b/packages/sdk/src/types.ts @@ -208,6 +208,7 @@ export interface SubmitUserTransactionsHandlers { includeDomainType?: boolean; signTypedData?: (payload: SignedTypedData, context: UserTypedDataSigningContext) => Promise; sendTransaction?: (transaction: EvmTransactionData, context: UserEvmTransactionContext) => Promise; + handleUnsupported?: (tx: UnsignedTx) => Promise; } export interface NetworkConfig { From f94a5391aecc355652665dc27c1dfd85cd9cceac Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Tue, 23 Jun 2026 18:52:04 +0200 Subject: [PATCH 029/176] Small refactor of startRamp call --- packages/sdk/src/VortexSdk.ts | 2 +- packages/sdk/src/handlers/BrlHandler.ts | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/sdk/src/VortexSdk.ts b/packages/sdk/src/VortexSdk.ts index 7f643252c..48cf894a6 100644 --- a/packages/sdk/src/VortexSdk.ts +++ b/packages/sdk/src/VortexSdk.ts @@ -173,7 +173,7 @@ export class VortexSdk { } async startRamp(rampId: string): Promise { - return this.brlHandler.startBrlRamp(rampId); + return this.apiService.startRamp({ rampId }); } /** diff --git a/packages/sdk/src/handlers/BrlHandler.ts b/packages/sdk/src/handlers/BrlHandler.ts index 117a9f990..7595a6098 100644 --- a/packages/sdk/src/handlers/BrlHandler.ts +++ b/packages/sdk/src/handlers/BrlHandler.ts @@ -158,11 +158,6 @@ export class BrlHandler implements RampHandler { return updatedRampProcess; } - async startBrlRamp(rampId: string): Promise { - const startRequest = { rampId }; - return this.apiService.startRamp(startRequest); - } - private async validateBrlKyc(taxId: string): Promise { if (!taxId) { throw new BrlKycStatusError("Tax ID is required", 400); From b581ef237aafbc5023df6a595f18009b931175bf Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Tue, 23 Jun 2026 19:08:36 +0200 Subject: [PATCH 030/176] Improve error handling for AlfredPay endpoints --- .../api/src/api/services/ramp/ramp.service.ts | 10 +++++- .../onramp/routes/alfredpay-to-evm.ts | 12 +++++-- .../05-integrations/alfredpay.md | 5 ++- packages/sdk/README.md | 10 ++++-- packages/sdk/src/errors.ts | 35 +++++++++++++++++-- packages/sdk/src/types.ts | 13 ++----- packages/sdk/test/errors.test.ts | 30 ++++++++++++++++ 7 files changed, 96 insertions(+), 19 deletions(-) create mode 100644 packages/sdk/test/errors.test.ts diff --git a/apps/api/src/api/services/ramp/ramp.service.ts b/apps/api/src/api/services/ramp/ramp.service.ts index 6bfe6c654..55eef021f 100644 --- a/apps/api/src/api/services/ramp/ramp.service.ts +++ b/apps/api/src/api/services/ramp/ramp.service.ts @@ -1101,11 +1101,19 @@ export class RampService extends BaseRampService { }); } + if (!userId) { + throw new APIError({ + message: + "Alfredpay onramp requires a completed Alfredpay KYC profile. Partner API-key-only registration is not supported for this flow yet because no partner user-to-Alfredpay-customer mapping exists.", + status: httpStatus.UNAUTHORIZED + }); + } + const { unsignedTxs, stateMeta } = await prepareOnrampTransactions({ destinationAddress: additionalData.destinationAddress, quote, signingAccounts: normalizedSigningAccounts, - userId: userId as string + userId }); return { stateMeta: stateMeta as Partial, unsignedTxs }; diff --git a/apps/api/src/api/services/transactions/onramp/routes/alfredpay-to-evm.ts b/apps/api/src/api/services/transactions/onramp/routes/alfredpay-to-evm.ts index 5ea5e071b..9d36b96ba 100644 --- a/apps/api/src/api/services/transactions/onramp/routes/alfredpay-to-evm.ts +++ b/apps/api/src/api/services/transactions/onramp/routes/alfredpay-to-evm.ts @@ -20,8 +20,10 @@ import { Networks, UnsignedTx } from "@vortexfi/shared"; +import httpStatus from "http-status"; import { isAddress } from "viem"; import AlfredPayCustomer from "../../../../../models/alfredPayCustomer.model"; +import { APIError } from "../../../../errors/api-error"; import { getEvmFundingAccount } from "../../../phases/evm-funding"; import { StateMetadata } from "../../../phases/meta-state-types"; import { encodeEvmTransactionData } from "../../index"; @@ -99,11 +101,17 @@ export async function prepareAlfredpayToEvmOnrampTransactions({ }); if (!customer) { - throw new Error(`Alfredpay customer not found for userId ${userId}`); + throw new APIError({ + message: `No completed Alfredpay KYC profile found for ${quote.inputCurrency}. Complete Alfredpay KYC before registering this onramp.`, + status: httpStatus.BAD_REQUEST + }); } if (customer.status !== AlfredPayStatus.Success) { - throw new Error(`Alfredpay customer status is ${customer.status}, expected Success. Proceed first with KYC.`); + throw new APIError({ + message: `Alfredpay KYC status is ${customer.status}. Complete Alfredpay KYC before registering this onramp.`, + status: httpStatus.BAD_REQUEST + }); } // Setup state metadata diff --git a/docs/security-spec/05-integrations/alfredpay.md b/docs/security-spec/05-integrations/alfredpay.md index 52cebafa8..3aeb7ae0c 100644 --- a/docs/security-spec/05-integrations/alfredpay.md +++ b/docs/security-spec/05-integrations/alfredpay.md @@ -17,7 +17,7 @@ Alfredpay is a fiat payment provider supporting on-ramp and off-ramp operations **On-ramp flow:** 1. Quote stage emits `ctx.alfredpayOnramp` with provider `quoteId` (30s upstream TTL) and `ctx.subsidy` with the discount-engine target. -2. User initiates on-ramp → receives Alfredpay payment instructions. +2. API-key-authenticated integration initiates on-ramp for a user with completed Alfredpay KYC → receives Alfredpay payment instructions. 3. User makes fiat payment. 4. `alfredpayOnrampMint` phase: confirms Alfredpay payment, credits the Alfredpay on-chain token to the ephemeral on Polygon. If the provider quote is degraded or expired and the discount engine's `expectedOutput` exceeds the provider's, the phase emits `alfredOnrampMintFallback` to record the substitution. 5. `subsidizePreSwap` phase: tops up the ephemeral's Alfredpay on-chain token balance to the subsidy target (Polygon, `ALFREDPAY_EVM_TOKEN`). @@ -52,6 +52,7 @@ For routed Alfredpay onramps (any non-passthrough output), the final quote outpu 13. **Offramp quote refresh at prep time MUST be strict and transactional** — `refreshAlfredpayOfframpQuoteIfMatching` (called during `prepareOfframpNonBrlTransactions`) re-fetches a provider quote and compares `toAmount` and `fee`. Any drift throws `INTERNAL_SERVER_ERROR`, aborting ramp registration. The quote metadata update (new `quoteId` + `expirationDate`) runs within the registration transaction, so a partial update cannot persist. 14. **`finalSettlementSubsidy` MUST NOT be skipped for Alfredpay offramps** — The `FinalSettlementSubsidyHandler` direct-transfer skip explicitly excludes `SELL && isAlfredpayToken(outputCurrency)`. This ensures the ephemeral on Polygon is always topped up to the expected amount before `alfredpayOfframpTransfer`, preventing under-funded settlements. 15. **Routed Alfredpay onramp quote output precision MUST match the destination token** — For Alfredpay USD/MXN/COP/ARS onramps that route through Squid, `quote.outputAmount` MUST preserve the final destination token's decimal precision, and `evmToEvm.outputAmountRaw` MUST represent the destination token's raw units. The Polygon-minted Alfredpay token is only the Squid source-side input. Direct Polygon same-token passthrough remains at the minted token's 6-decimal precision. +16. **Alfredpay ramp registration MUST bind to a completed KYC/KYB customer** — Registration MUST reject Alfredpay onramps before customer lookup when no completed Alfredpay customer context is available, and MUST reject customer records whose Alfredpay status is not `Success`. This prevents ramps from reaching provider/customer queries with undefined `user_id` and ensures payment instructions are only issued for verified Alfredpay customers. SDK/server integrations authenticate with partner API keys (`pk_*`/`sk_*`); Supabase Bearer tokens are frontend/user-session auth. ## Threat Vectors & Mitigations @@ -70,6 +71,7 @@ For routed Alfredpay onramps (any non-passthrough output), the final quote outpu | **Polygon passthrough rounding** | Same-chain same-token shortcut rounds the bridge output incorrectly, leaking dust or under-funding the destination | `toFixed(0, 0)` round-down in the squid-router finalize; downstream subsidy ensures the destination receives the quoted amount | | **Polygon wrong-token delivery** | A user on-ramps via Alfredpay and requests a non-USDT Polygon output (e.g. USDC); the handler skips the swap on destination-network alone and transfers the minted USDT, delivering the wrong asset | The `squidRouterSwap` short-circuit is gated on `quote.outputCurrency === ALFREDPAY_EVM_TOKEN` (not just `quote.metadata.request.to === Networks.Polygon`); non-USDT Polygon outputs run the real USDT→output swap. Matched in the quote engine's `skipRouteCalculation` branch. | | **Routed destination precision loss** | A USD/MXN/COP/ARS Alfredpay onramp mints a 6-decimal Polygon source token, routes to an 18-decimal destination token, and stores the final quote output with source precision. The final amount is truncated before destination-transfer expectations are calculated. | Finalize routed Alfredpay EVM quotes with the destination token's decimals when `evmToEvm` metadata exists; keep direct Polygon same-token passthrough at minted-token precision. | +| **Anonymous Alfredpay registration** | An SDK caller registers an Alfredpay onramp without a completed KYC customer context, causing undefined `user_id` customer lookups or issuing instructions without KYC context | Alfredpay onramp registration fails with a public auth/KYC error unless a `Success` Alfredpay customer record is available. SDK/server callers authenticate with partner API keys. | ## Audit Checklist @@ -94,3 +96,4 @@ For routed Alfredpay onramps (any non-passthrough output), the final quote outpu - [x] `FinalSettlementSubsidyHandler` does NOT skip subsidy for Alfredpay offramps (`SELL && isAlfredpayToken`). **PASS** — explicit exclusion in the direct-transfer skip condition. - [x] AlfredPay offramp order is created at prep time (`evm-to-alfredpay.ts:229`); `processAlfredpayOfframpStart` is a defensive validation-only no-op. **PASS** — verified. - [x] Routed Alfredpay onramp quote output precision follows destination token decimals when `evmToEvm` metadata exists; direct Polygon same-token passthrough remains at minted-token precision. **PASS** — verified in `finalize/onramp.ts`. +- [x] Alfredpay onramp registration rejects missing customer context before customer lookup and requires a `Success` Alfredpay customer status. **PASS** — `ramp.service.ts` checks for the current user-backed customer context; `alfredpay-to-evm.ts` rejects missing/non-success customer records. diff --git a/packages/sdk/README.md b/packages/sdk/README.md index abdf8f852..d74d83609 100644 --- a/packages/sdk/README.md +++ b/packages/sdk/README.md @@ -56,7 +56,11 @@ const startedRamp = await sdk.startRamp(rampProcess.id); ```typescript import { VortexSdk, FiatToken, EvmToken, EPaymentMethod, Networks, RampDirection } from "@vortexfi/sdk"; -const sdk = new VortexSdk({ apiBaseUrl: "http://localhost:3000" }); +const sdk = new VortexSdk({ + apiBaseUrl: "http://localhost:3000", + publicKey: process.env.VORTEX_PUBLIC_KEY, + secretKey: process.env.VORTEX_SECRET_KEY +}); const quote = await sdk.createQuote({ from: EPaymentMethod.ACH, // USD and COP settle via ACH; MXN uses EPaymentMethod.SPEI @@ -71,7 +75,7 @@ const quote = await sdk.createQuote({ const { rampProcess } = await sdk.registerRamp(quote, { destinationAddress: "0x1234567890123456789012345678901234567890", walletAddress: "0x1234567890123456789012345678901234567890" - // fiatAccountId is optional for onramp — the backend only requires destinationAddress. + // fiatAccountId is optional for onramp. }); // Inspect off-chain fiat payment instructions before starting. @@ -79,6 +83,8 @@ const startedRamp = await sdk.startRamp(rampProcess.id); console.log("Pay via:", startedRamp.achPaymentData); ``` +SDK/server integrations should authenticate with `publicKey` + `secretKey`, not a Supabase Bearer token. The current backend still needs a completed Alfredpay KYC customer context for this flow; partner-key-only registration will fail with `AlfredpayOnrampKycRequiredError` until a partner user-to-Alfredpay-customer mapping is supported. + ### Alfredpay (USD / MXN / COP / ARS) offramp ```typescript diff --git a/packages/sdk/src/errors.ts b/packages/sdk/src/errors.ts index aa43777ad..a6382ecbe 100644 --- a/packages/sdk/src/errors.ts +++ b/packages/sdk/src/errors.ts @@ -178,6 +178,29 @@ export class MissingAlfredpayOnrampParametersError extends AlfredpayOnrampError } } +export class AlfredpayOnrampKycRequiredError extends AlfredpayOnrampError { + constructor(message: string, status = 400) { + super(message, status); + this.name = "AlfredpayOnrampKycRequiredError"; + } +} + +function extractErrorStatus(response: Record): number { + for (const key of ["status", "statusCode", "code"]) { + const value = response[key]; + if (typeof value === "number") { + return value; + } + } + + const nestedError = response.error; + if (nestedError && typeof nestedError === "object") { + return extractErrorStatus(nestedError as Record); + } + + return 500; +} + // Alfredpay Offramp specific errors export class AlfredpayOfframpError extends RegisterRampError { constructor(message: string, status = 400) { @@ -375,8 +398,8 @@ function extractErrorMessage(value: unknown): string | undefined { */ export function parseAPIError(response: unknown): VortexSdkError { if (response && typeof response === "object") { - const { message, error, status, errors } = response as Record; - const normalizedStatus = typeof status === "number" ? status : 500; + const { message, error, errors } = response as Record; + const normalizedStatus = extractErrorStatus(response as Record); const errorMessage = extractErrorMessage(message) ?? extractErrorMessage(error); if (errorMessage) { @@ -434,6 +457,14 @@ export function parseAPIError(response: unknown): VortexSdkError { if (errorMessage === "Parameter destinationAddress is required for Alfredpay onramp") { return new MissingAlfredpayOnrampParametersError(); } + if ( + errorMessage === + "Alfredpay onramp requires a completed Alfredpay KYC profile. Partner API-key-only registration is not supported for this flow yet because no partner user-to-Alfredpay-customer mapping exists." || + errorMessage.startsWith("No completed Alfredpay KYC profile found") || + errorMessage.startsWith("Alfredpay KYC status is") + ) { + return new AlfredpayOnrampKycRequiredError(errorMessage, normalizedStatus); + } if (errorMessage === "fiatAccountId is required for Alfredpay offramp") { return new MissingAlfredpayOfframpParametersError(errorMessage); } diff --git a/packages/sdk/src/types.ts b/packages/sdk/src/types.ts index 6e014a9fc..9c242081e 100644 --- a/packages/sdk/src/types.ts +++ b/packages/sdk/src/types.ts @@ -14,17 +14,8 @@ import { UnsignedTx } from "@vortexfi/shared"; -export { - CreateQuoteRequest, - EPaymentMethod, - EvmTransactionData, - EvmToken, - FiatToken, - Networks, - PaymentMethod, - QuoteResponse, - RampDirection -}; +export type { CreateQuoteRequest, EvmTransactionData, PaymentMethod, QuoteResponse }; +export { EPaymentMethod, EvmToken, FiatToken, Networks, RampDirection }; export type AnyQuote = | BrlOnrampQuote diff --git a/packages/sdk/test/errors.test.ts b/packages/sdk/test/errors.test.ts new file mode 100644 index 000000000..6321c268d --- /dev/null +++ b/packages/sdk/test/errors.test.ts @@ -0,0 +1,30 @@ +import {describe, expect, test} from "bun:test"; +import {AlfredpayOnrampKycRequiredError, parseAPIError, VortexSdkError} from "../src/errors"; + +describe("parseAPIError", () => { + test("uses API error code when status is omitted", () => { + const error = parseAPIError({ code: 401, message: "Authentication required" }); + + expect(error).toBeInstanceOf(VortexSdkError); + expect(error.status).toBe(401); + expect(error.message).toBe("Authentication required"); + }); + + test("uses nested API error status", () => { + const error = parseAPIError({ error: { message: "Invalid or expired Bearer token.", status: 401 } }); + + expect(error.status).toBe(401); + expect(error.message).toBe("Invalid or expired Bearer token."); + }); + + test("maps Alfredpay onramp auth and KYC errors", () => { + const error = parseAPIError({ + code: 401, + message: + "Alfredpay onramp requires a completed Alfredpay KYC profile. Partner API-key-only registration is not supported for this flow yet because no partner user-to-Alfredpay-customer mapping exists." + }); + + expect(error).toBeInstanceOf(AlfredpayOnrampKycRequiredError); + expect(error.status).toBe(401); + }); +}); From cda52ea53b68d0049db201543e3fa999c57e8bc4 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Wed, 24 Jun 2026 19:20:57 +0200 Subject: [PATCH 031/176] Address PR review feedback --- .../squid-router-phase-handler.test.ts | 50 +++++++++++++++---- .../handlers/squid-router-phase-handler.ts | 21 +++----- packages/sdk/src/handlers/AlfredpayHandler.ts | 19 ++++++- packages/sdk/src/types.ts | 6 +-- 4 files changed, 68 insertions(+), 28 deletions(-) diff --git a/apps/api/src/api/services/phases/handlers/squid-router-phase-handler.test.ts b/apps/api/src/api/services/phases/handlers/squid-router-phase-handler.test.ts index 386a2dc95..dc6a88ada 100644 --- a/apps/api/src/api/services/phases/handlers/squid-router-phase-handler.test.ts +++ b/apps/api/src/api/services/phases/handlers/squid-router-phase-handler.test.ts @@ -1,5 +1,5 @@ // eslint-disable-next-line import/no-unresolved -import { beforeEach, describe, expect, it, mock } from "bun:test"; +import {beforeEach, describe, expect, it, mock} from "bun:test"; import Big from "big.js"; const Networks = { @@ -8,6 +8,8 @@ const Networks = { Polygon: "polygon" } as const; +const EvmNetworks = Networks; + const EvmToken = { USDC: "USDC" } as const; @@ -23,6 +25,10 @@ const RampDirection = { SELL: "SELL" } as const; +const RampPhase = { + squidRouterSwap: "squidRouterSwap" +} as const; + const EVM_EPHEMERAL_ADDRESS = "0x1111111111111111111111111111111111111111"; const EURE_POLYGON_ADDRESS = "0x18ec0A6E18E5bc3784fDd3a3634b31245ab704F6"; const USDC_BASE_ADDRESS = "0x3333333333333333333333333333333333333333"; @@ -43,13 +49,15 @@ const sendRawTransaction = mock(async ({ serializedTransaction }: { serializedTr const waitForTransactionReceipt = mock(async () => ({ status: "success" })); const getTransactionCount = mock(async () => 0); const checkEvmBalanceForToken = mock(async () => Big(1000)); -const getEvmTokenDetailsByAddress = mock((network: string, tokenAddress: `0x${string}`) => ({ +const getEvmBalance = mock(async () => Big(0)); +const getOnChainTokenDetails = mock((network: string, token: string) => ({ assetSymbol: "Monerium EURe", decimals: 18, - erc20AddressSourceChain: tokenAddress, + erc20AddressSourceChain: token, isNative: false, network })); +const isEvmTokenDetails = mock(() => true); mock.module("@vortexfi/shared", () => ({ checkEvmBalanceForToken, @@ -62,9 +70,20 @@ mock.module("@vortexfi/shared", () => ({ }) }) }, + ALFREDPAY_EVM_TOKEN: "USDT", + EvmNetworks, EvmToken, + EvmTokenDetails: {}, + evmTokenConfig: { + [Networks.Polygon]: { + EURC: { + erc20AddressSourceChain: EURE_POLYGON_ADDRESS + } + } + }, FiatToken, - getEvmTokenDetailsByAddress, + getEvmBalance, + getOnChainTokenDetails, getNetworkFromDestination: (destination: string) => Object.values(Networks).includes(destination as (typeof Networks)[keyof typeof Networks]) ? destination : undefined, getNetworkId: (network: string) => { @@ -74,8 +93,10 @@ mock.module("@vortexfi/shared", () => ({ return undefined; }, isAlfredpayToken: () => false, + isEvmTokenDetails, Networks, - RampDirection + RampDirection, + RampPhase })); mock.module("../../ramp/ramp.service", () => ({ @@ -90,6 +111,7 @@ const { SquidRouterPhaseHandler } = await import("./squid-router-phase-handler") let quote: { inputCurrency: string; metadata: Record; + network: string; outputCurrency: string; to: string; }; @@ -146,7 +168,9 @@ describe("SquidRouterPhaseHandler", () => { waitForTransactionReceipt.mockClear(); getTransactionCount.mockClear(); checkEvmBalanceForToken.mockClear(); - getEvmTokenDetailsByAddress.mockClear(); + getEvmBalance.mockClear(); + getOnChainTokenDetails.mockClear(); + isEvmTokenDetails.mockClear(); }); it("submits Squid approve and swap for Monerium EUR onramp to Base USDC", async () => { @@ -164,6 +188,7 @@ describe("SquidRouterPhaseHandler", () => { outputAmountRaw: "1000" } }, + network: Networks.Polygon, outputCurrency: EvmToken.USDC, to: Networks.Base }; @@ -172,9 +197,15 @@ describe("SquidRouterPhaseHandler", () => { const updatedState = await handler.execute(makeState()); expect(sendRawTransaction).toHaveBeenCalledTimes(2); - expect(getEvmTokenDetailsByAddress).toHaveBeenCalledWith(Networks.Polygon, EURE_POLYGON_ADDRESS); + expect(getOnChainTokenDetails).toHaveBeenCalledWith(Networks.Polygon, EvmToken.USDC); + expect(getEvmBalance).toHaveBeenCalledTimes(1); expect(sendRawTransaction.mock.calls[0][0]).toEqual({ serializedTransaction: APPROVE_TX }); expect(sendRawTransaction.mock.calls[1][0]).toEqual({ serializedTransaction: SWAP_TX }); + expect(updatedState.state).toMatchObject({ + preSettlementBalance: "0", + squidRouterApproveHash: APPROVE_HASH, + squidRouterSwapHash: SWAP_HASH + }); expect(updatedState.currentPhase).toBe("squidRouterPay"); }); @@ -193,6 +224,7 @@ describe("SquidRouterPhaseHandler", () => { toToken: USDC_BASE_ADDRESS } }, + network: Networks.Base, outputCurrency: EvmToken.USDC, to: Networks.Base }; @@ -205,7 +237,7 @@ describe("SquidRouterPhaseHandler", () => { ); expect(sendRawTransaction).not.toHaveBeenCalled(); - expect(getEvmTokenDetailsByAddress).not.toHaveBeenCalled(); - expect(updatedState.currentPhase).toBe("destinationTransfer"); + expect(getOnChainTokenDetails).not.toHaveBeenCalled(); + expect(updatedState.currentPhase).toBe("finalSettlementSubsidy"); }); }); diff --git a/apps/api/src/api/services/phases/handlers/squid-router-phase-handler.ts b/apps/api/src/api/services/phases/handlers/squid-router-phase-handler.ts index 6ea360d34..39c2635b5 100644 --- a/apps/api/src/api/services/phases/handlers/squid-router-phase-handler.ts +++ b/apps/api/src/api/services/phases/handlers/squid-router-phase-handler.ts @@ -60,7 +60,8 @@ export class SquidRouterPhaseHandler extends BasePhaseHandler { `SquidRouterPhaseHandler: Failed to snapshot pre-settlement balance for ramp ${state.id}; storing 0. Error: ${error}` ); } - await state.update({ state: { ...state.state, preSettlementBalance } }); + state.state = { ...state.state, preSettlementBalance }; + await state.update({ state: state.state }); } /** @@ -186,12 +187,8 @@ export class SquidRouterPhaseHandler extends BasePhaseHandler { logger.info(`Approve transaction executed with hash: ${approveHash}`); // Update the state with the approve hash immediately after sending the transaction - await state.update({ - state: { - ...state.state, - squidRouterApproveHash: approveHash - } - }); + state.state = { ...state.state, squidRouterApproveHash: approveHash }; + await state.update({ state: state.state }); } // Wait for the approve transaction to be confirmed @@ -203,12 +200,8 @@ export class SquidRouterPhaseHandler extends BasePhaseHandler { logger.info(`Swap transaction executed with hash: ${swapHash}`); // Update the state with the transaction hashes - const updatedState = await state.update({ - state: { - ...state.state, - squidRouterSwapHash: swapHash - } - }); + state.state = { ...state.state, squidRouterSwapHash: swapHash }; + await state.update({ state: state.state }); // Wait for the swap transaction to be confirmed await this.waitForTransactionConfirmation(sourceNetwork, swapHash); @@ -216,7 +209,7 @@ export class SquidRouterPhaseHandler extends BasePhaseHandler { // preSettlementBalance was captured before the swap (see above); do not re-snapshot here. // Transition to the next phase - return this.transitionToNextPhase(updatedState, "squidRouterPay"); + return this.transitionToNextPhase(state, "squidRouterPay"); } catch (error) { logger.error(`Error in squidRouter phase for ramp ${state.id}:`, error); throw error; diff --git a/packages/sdk/src/handlers/AlfredpayHandler.ts b/packages/sdk/src/handlers/AlfredpayHandler.ts index e7bb70e12..479a5744b 100644 --- a/packages/sdk/src/handlers/AlfredpayHandler.ts +++ b/packages/sdk/src/handlers/AlfredpayHandler.ts @@ -54,6 +54,19 @@ export class AlfredpayHandler implements RampHandler { this.signTransactions = signTransactions; } + private getEphemeralTransactions( + unsignedTxs: UnsignedTx[], + ephemerals: { [key in EphemeralAccountType]?: EphemeralAccount } + ): UnsignedTx[] { + const ephemeralSigners = new Set( + [ephemerals.EVM?.address, ephemerals.Substrate?.address] + .filter((address): address is string => Boolean(address)) + .map(address => address.toLowerCase()) + ); + + return unsignedTxs.filter(tx => ephemeralSigners.has(tx.signer.toLowerCase())); + } + async registerAlfredpayOnramp(quoteId: string, additionalData: AlfredpayOnrampAdditionalData): Promise { if (!additionalData.destinationAddress) { throw new MissingAlfredpayOnrampParametersError(); @@ -76,7 +89,8 @@ export class AlfredpayHandler implements RampHandler { await this.context.storeEphemerals(ephemerals, rampProcess.id); - const signedTxs = await this.signTransactions(rampProcess.unsignedTxs || [], { + const ephemeralTxs = this.getEphemeralTransactions(rampProcess.unsignedTxs || [], ephemerals); + const signedTxs = await this.signTransactions(ephemeralTxs, { evmEphemeral: ephemerals.EVM, substrateEphemeral: ephemerals.Substrate }); @@ -111,7 +125,8 @@ export class AlfredpayHandler implements RampHandler { await this.context.storeEphemerals(ephemerals, rampProcess.id); - const signedTxs = await this.signTransactions(rampProcess.unsignedTxs || [], { + const ephemeralTxs = this.getEphemeralTransactions(rampProcess.unsignedTxs || [], ephemerals); + const signedTxs = await this.signTransactions(ephemeralTxs, { evmEphemeral: ephemerals.EVM, substrateEphemeral: ephemerals.Substrate }); diff --git a/packages/sdk/src/types.ts b/packages/sdk/src/types.ts index 9c242081e..2f1bbd579 100644 --- a/packages/sdk/src/types.ts +++ b/packages/sdk/src/types.ts @@ -165,9 +165,9 @@ export interface OfframpUpdateAdditionalData { } // BRL, EUR, and Alfredpay offramps all push back the same on-chain tx hashes. -export type BrlOfframpUpdateAdditionalData = OfframpUpdateAdditionalData; -export type EurOfframpUpdateAdditionalData = OfframpUpdateAdditionalData; -export type AlfredpayOfframpUpdateAdditionalData = OfframpUpdateAdditionalData; +export interface BrlOfframpUpdateAdditionalData extends OfframpUpdateAdditionalData {} +export interface EurOfframpUpdateAdditionalData extends OfframpUpdateAdditionalData {} +export interface AlfredpayOfframpUpdateAdditionalData extends OfframpUpdateAdditionalData {} export interface BrlKycResponse { evmAddress: string; From 4c991f71f8f6820932743166e81bb92da2cb0067 Mon Sep 17 00:00:00 2001 From: Gianfranco Date: Thu, 25 Jun 2026 09:34:03 -0300 Subject: [PATCH 032/176] add userId to apikey model --- .../migrations/034-add-user-id-to-api-keys.ts | 29 +++++++++++++++++++ apps/api/src/models/apiKey.model.ts | 24 ++++++++++++++- apps/api/src/models/index.ts | 4 +++ 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 apps/api/src/database/migrations/034-add-user-id-to-api-keys.ts diff --git a/apps/api/src/database/migrations/034-add-user-id-to-api-keys.ts b/apps/api/src/database/migrations/034-add-user-id-to-api-keys.ts new file mode 100644 index 000000000..bf3799740 --- /dev/null +++ b/apps/api/src/database/migrations/034-add-user-id-to-api-keys.ts @@ -0,0 +1,29 @@ +import { DataTypes, QueryInterface } from "sequelize"; + +export async function up(queryInterface: QueryInterface): Promise { + await queryInterface.addColumn("api_keys", "user_id", { + allowNull: true, + field: "user_id", + onDelete: "SET NULL", + onUpdate: "CASCADE", + references: { + key: "id", + model: "profiles" + }, + type: DataTypes.UUID + }); + + await queryInterface.addIndex("api_keys", ["user_id"], { + name: "idx_api_keys_user_id" + }); + + await queryInterface.addIndex("api_keys", ["user_id", "is_active"], { + name: "idx_api_keys_active_user_lookup" + }); +} + +export async function down(queryInterface: QueryInterface): Promise { + await queryInterface.removeIndex("api_keys", "idx_api_keys_active_user_lookup"); + await queryInterface.removeIndex("api_keys", "idx_api_keys_user_id"); + await queryInterface.removeColumn("api_keys", "user_id"); +} diff --git a/apps/api/src/models/apiKey.model.ts b/apps/api/src/models/apiKey.model.ts index f4404ad0e..c08e4a3c3 100644 --- a/apps/api/src/models/apiKey.model.ts +++ b/apps/api/src/models/apiKey.model.ts @@ -14,6 +14,7 @@ export interface ApiKeyAttributes { lastUsedAt: Date | null; expiresAt: Date | null; isActive: boolean; + userId: string | null; createdAt: Date; updatedAt: Date; } @@ -21,7 +22,7 @@ export interface ApiKeyAttributes { // Define the attributes that can be set during creation type ApiKeyCreationAttributes = Optional< ApiKeyAttributes, - "id" | "keyType" | "name" | "lastUsedAt" | "expiresAt" | "createdAt" | "updatedAt" + "id" | "keyType" | "name" | "lastUsedAt" | "expiresAt" | "userId" | "createdAt" | "updatedAt" >; // Define the ApiKey model @@ -46,6 +47,8 @@ class ApiKey extends Model implement declare isActive: boolean; + declare userId: string | null; + declare createdAt: Date; declare updatedAt: Date; @@ -121,6 +124,17 @@ ApiKey.init( defaultValue: DataTypes.NOW, field: "updated_at", type: DataTypes.DATE + }, + userId: { + allowNull: true, + field: "user_id", + onDelete: "SET NULL", + onUpdate: "CASCADE", + references: { + key: "id", + model: "profiles" + }, + type: DataTypes.UUID } }, { @@ -145,6 +159,14 @@ ApiKey.init( fields: ["is_active"], name: "idx_api_keys_active" }, + { + fields: ["user_id"], + name: "idx_api_keys_user_id" + }, + { + fields: ["user_id", "is_active"], + name: "idx_api_keys_active_user_lookup" + }, { fields: ["is_active", "key_prefix", "key_type"], name: "idx_api_keys_active_prefix_type", diff --git a/apps/api/src/models/index.ts b/apps/api/src/models/index.ts index 847719dc8..f869815ae 100644 --- a/apps/api/src/models/index.ts +++ b/apps/api/src/models/index.ts @@ -51,6 +51,10 @@ ProfilePartnerAssignment.belongsTo(Partner, { as: "sellPartner", foreignKey: "se Partner.hasMany(ProfilePartnerAssignment, { as: "buyProfileAssignments", foreignKey: "buyPartnerId" }); Partner.hasMany(ProfilePartnerAssignment, { as: "sellProfileAssignments", foreignKey: "sellPartnerId" }); +// API key ↔ user binding +User.hasMany(ApiKey, { as: "apiKeys", foreignKey: "userId" }); +ApiKey.belongsTo(User, { as: "user", foreignKey: "userId" }); + // Initialize models const models = { AlfredPayCustomer, From daacf184e0fafb93d5503acf66d697f57c004647 Mon Sep 17 00:00:00 2001 From: Gianfranco Date: Thu, 25 Jun 2026 11:01:53 -0300 Subject: [PATCH 033/176] use api-key to derive user and partern id --- .../src/api/controllers/brla.controller.ts | 124 +++++++++++++----- .../src/api/controllers/quote.controller.ts | 11 +- .../src/api/controllers/ramp.controller.ts | 10 +- .../src/api/middlewares/apiKeyAuth.helpers.ts | 13 ++ apps/api/src/api/middlewares/apiKeyAuth.ts | 4 +- apps/api/src/api/middlewares/dualAuth.ts | 4 +- apps/api/src/api/middlewares/effectiveUser.ts | 47 +++++++ apps/api/src/api/middlewares/ownershipAuth.ts | 37 +++++- apps/api/src/api/middlewares/publicKeyAuth.ts | 2 +- apps/api/src/api/routes/v1/brla.route.ts | 9 +- apps/api/src/api/services/avena-account.ts | 71 ++++++++++ .../api/services/quote/alfredpay-customer.ts | 68 ++++++++++ .../transactions/offramp/common/types.ts | 2 +- .../transactions/offramp/common/validation.ts | 6 +- .../offramp/routes/evm-to-alfredpay.ts | 55 ++++---- .../onramp/routes/alfredpay-to-evm.ts | 36 +---- docs/security-spec/01-auth/api-keys.md | 18 +++ 17 files changed, 394 insertions(+), 123 deletions(-) create mode 100644 apps/api/src/api/middlewares/effectiveUser.ts create mode 100644 apps/api/src/api/services/avena-account.ts create mode 100644 apps/api/src/api/services/quote/alfredpay-customer.ts diff --git a/apps/api/src/api/controllers/brla.controller.ts b/apps/api/src/api/controllers/brla.controller.ts index 189f0cf35..2d2e0e06e 100644 --- a/apps/api/src/api/controllers/brla.controller.ts +++ b/apps/api/src/api/controllers/brla.controller.ts @@ -37,6 +37,8 @@ import { Op } from "sequelize"; import logger from "../../config/logger"; import TaxId, { TaxIdInternalStatus } from "../../models/taxId.model"; import { APIError } from "../errors/api-error"; +import { getEffectiveUserId } from "../middlewares/effectiveUser"; +import { resolveAveniaAccountForUser } from "../services/avena-account"; // Helper functions for TaxId updates @@ -148,32 +150,48 @@ export const getAveniaUser = async ( ): Promise => { try { const { taxId } = req.query; + const effectiveUserId = getEffectiveUserId(req); - if (!taxId) { - res.status(httpStatus.BAD_REQUEST).json({ error: "Missing taxId query parameters" }); + if (!effectiveUserId) { + res.status(httpStatus.BAD_REQUEST).json({ + error: "Missing or invalid authentication." + }); return; } const brlaApiService = BrlaApiService.getInstance(); - const taxIdRecord = await TaxId.findOne({ - where: { - internalStatus: { - [Op.ne]: TaxIdInternalStatus.Consulted - }, - taxId: normalizeTaxId(taxId) + let taxIdRecord: TaxId | null; + + if (taxId) { + const normalized = normalizeTaxId(taxId); + taxIdRecord = await TaxId.findOne({ + where: { + internalStatus: { [Op.ne]: TaxIdInternalStatus.Consulted }, + taxId: normalized + } + }); + + if (!taxIdRecord) { + res.status(httpStatus.NOT_FOUND).json({ error: "Subaccount not found" }); + return; } - }); - if (!taxIdRecord) { - res.status(httpStatus.NOT_FOUND).json({ error: "Subaccount not found" }); - return; - } - // When the caller authenticated as a Supabase user, only the owning user may read this taxId. - // Partner SDK callers (no req.userId) are intentionally exempt: they authenticate via API key - // and may need to look up any taxId for their integration flow. - if (req.userId && taxIdRecord.userId !== req.userId) { - res.status(httpStatus.FORBIDDEN).json({ error: "Forbidden" }); - return; + // TaxId must be owned by the effective user. + if (taxIdRecord.userId !== effectiveUserId) { + res.status(httpStatus.FORBIDDEN).json({ error: "Forbidden" }); + return; + } + } else { + try { + const resolved = await resolveAveniaAccountForUser(effectiveUserId); + taxIdRecord = resolved.taxIdRecord; + } catch (error) { + if (error instanceof APIError) { + res.status(error.status ?? httpStatus.BAD_REQUEST).json({ error: error.message }); + return; + } + throw error; + } } const accountInfo = await brlaApiService.subaccountInfo(taxIdRecord.subAccountId); @@ -209,6 +227,7 @@ export const recordInitialKycAttempt = async ( ): Promise => { try { const { taxId, quoteId, sessionId } = req.body; + const effectiveUserId = getEffectiveUserId(req); if (!taxId) { res.status(httpStatus.BAD_REQUEST).json({ error: "Missing taxId query parameters" }); @@ -237,7 +256,7 @@ export const recordInitialKycAttempt = async ( internalStatus: TaxIdInternalStatus.Consulted, subAccountId: "", taxId, - userId: req.userId ?? null + userId: effectiveUserId ?? null }); } } @@ -255,25 +274,50 @@ export const getAveniaUserRemainingLimit = async ( ): Promise => { try { const { taxId, direction } = req.query; + const effectiveUserId = getEffectiveUserId(req); - if (!taxId || !direction) { - res.status(httpStatus.BAD_REQUEST).json({ error: "Missing taxId or direction query parameter" }); + if (!direction) { + res.status(httpStatus.BAD_REQUEST).json({ error: "Missing direction query parameter" }); return; } - const taxIdRecord = await TaxId.findByPk(normalizeTaxId(taxId)); - if (!taxIdRecord) { - throw new APIError({ - message: "Ramp disabled", - status: httpStatus.BAD_REQUEST + if (!effectiveUserId) { + res.status(httpStatus.BAD_REQUEST).json({ + error: "This endpoint requires authentication." }); + return; } - const brlaApiService = BrlaApiService.getInstance(); - if (!taxIdRecord) { - res.status(httpStatus.NOT_FOUND).json({ error: "Subaccount not found" }); - return; + let taxIdRecord: TaxId | null; + if (taxId) { + taxIdRecord = await TaxId.findByPk(normalizeTaxId(taxId)); + if (!taxIdRecord) { + throw new APIError({ + message: "Ramp disabled", + status: httpStatus.BAD_REQUEST + }); + } + + // TaxId must be owned by the effective user. The legacy partner-key + // exemption that allowed reading any taxId has been removed. + if (taxIdRecord.userId !== effectiveUserId) { + res.status(httpStatus.FORBIDDEN).json({ error: "Forbidden" }); + return; + } + } else { + try { + const resolved = await resolveAveniaAccountForUser(effectiveUserId); + taxIdRecord = resolved.taxIdRecord; + } catch (error) { + if (error instanceof APIError) { + res.status(error.status ?? httpStatus.BAD_REQUEST).json({ error: error.message }); + return; + } + throw error; + } } + + const brlaApiService = BrlaApiService.getInstance(); const limitsData = await brlaApiService.getSubaccountUsedLimit(taxIdRecord.subAccountId); if (!limitsData || !limitsData.limitInfo || !limitsData.limitInfo.limits) { @@ -316,6 +360,16 @@ export const createSubaccount = async ( ): Promise => { try { const { name, taxId, accountType: requestAccountType, quoteId, sessionId } = req.body; + const effectiveUserId = getEffectiveUserId(req); + + // Reject callers that do not resolve to a user (anonymous requests + // or unlinked secret keys) so the resulting TaxId is always owned by a real profile. + if (!effectiveUserId) { + res.status(httpStatus.BAD_REQUEST).json({ + error: "This endpoint requires authentication." + }); + return; + } const isCnpj = isValidCnpj(taxId); @@ -328,7 +382,7 @@ export const createSubaccount = async ( // on every conflict and to prevent account-takeover via subAccountId overwrite. const existingTaxId = await TaxId.findByPk(normalizedTaxId); if (existingTaxId && existingTaxId.internalStatus !== TaxIdInternalStatus.Consulted) { - const ownedByAnotherUser = existingTaxId.userId !== null && existingTaxId.userId !== (req.userId ?? null); + const ownedByAnotherUser = existingTaxId.userId !== null && existingTaxId.userId !== effectiveUserId; if (ownedByAnotherUser) { res.status(httpStatus.CONFLICT).json({ error: "A subaccount already exists for this taxId" @@ -336,8 +390,8 @@ export const createSubaccount = async ( return; } // Allow authenticated users to claim anonymous records by updating userId - if (existingTaxId.userId === null && req.userId) { - await existingTaxId.update({ userId: req.userId }); + if (existingTaxId.userId === null) { + await existingTaxId.update({ userId: effectiveUserId }); } } @@ -363,7 +417,7 @@ export const createSubaccount = async ( requestedDate: new Date(), subAccountId: id, taxId: normalizedTaxId, - userId: req.userId ?? null + userId: effectiveUserId }); } diff --git a/apps/api/src/api/controllers/quote.controller.ts b/apps/api/src/api/controllers/quote.controller.ts index 471f36b85..b17c06fc2 100644 --- a/apps/api/src/api/controllers/quote.controller.ts +++ b/apps/api/src/api/controllers/quote.controller.ts @@ -11,6 +11,7 @@ import { NextFunction, Request, Response } from "express"; import httpStatus from "http-status"; import logger from "../../config/logger"; import { APIError } from "../errors/api-error"; +import { getEffectiveUserId } from "../middlewares/effectiveUser"; import { buildApiClientRequestMetadata, getSafeApiKeyPrefix, @@ -44,6 +45,7 @@ export const createQuote = async ( // Get apiKey from body or from validated public key middleware const publicApiKey = apiKey || req.validatedPublicKey?.apiKey; const publicKeyPartnerName = req.validatedPublicKey?.partnerName; + const effectiveUserId = getEffectiveUserId(req); // Create quote with public key and partner name for discount application const quote = await quoteService.createQuote({ @@ -57,7 +59,7 @@ export const createQuote = async ( partnerName: publicKeyPartnerName, rampType, to, - userId: req.userId + userId: effectiveUserId }); observeApiClientEvent({ @@ -73,7 +75,7 @@ export const createQuote = async ( rampType, requestId: req.requestId, status: "success", - userId: req.userId || null + userId: effectiveUserId || null }); res.status(httpStatus.CREATED).json(quote); @@ -107,6 +109,7 @@ export const createBestQuote = async ( // Get apiKey from body or from validated public key middleware const publicApiKey = apiKey || req.validatedPublicKey?.apiKey; const publicKeyPartnerName = req.validatedPublicKey?.partnerName; + const effectiveUserId = getEffectiveUserId(req); // Create best quote by querying all eligible networks const quote = await quoteService.createBestQuote({ @@ -121,7 +124,7 @@ export const createBestQuote = async ( partnerName: publicKeyPartnerName, rampType, to, - userId: req.userId + userId: effectiveUserId }); observeApiClientEvent({ @@ -137,7 +140,7 @@ export const createBestQuote = async ( rampType, requestId: req.requestId, status: "success", - userId: req.userId || null + userId: effectiveUserId || null }); res.status(httpStatus.CREATED).json(quote); diff --git a/apps/api/src/api/controllers/ramp.controller.ts b/apps/api/src/api/controllers/ramp.controller.ts index 71c7be684..95cf087c9 100644 --- a/apps/api/src/api/controllers/ramp.controller.ts +++ b/apps/api/src/api/controllers/ramp.controller.ts @@ -16,6 +16,7 @@ import httpStatus from "http-status"; import logger from "../../config/logger"; import { APIError } from "../errors/api-error"; import { enrichAdditionalDataWithClientIp } from "../helpers/clientIp"; +import { getEffectiveUserId } from "../middlewares/effectiveUser"; import { assertQuoteOwnership, assertRampOwnership } from "../middlewares/ownershipAuth"; import { buildApiClientRequestMetadata, observeApiClientEvent } from "../observability/apiClientEvent.service"; import { classifyApiClientError, getErrorMessage } from "../observability/errorClassifier"; @@ -43,11 +44,13 @@ export const registerRamp = async (req: Request, res: Response, nex const enrichedAdditionalData = await enrichAdditionalDataWithClientIp(additionalData, req); + const effectiveUserId = getEffectiveUserId(req); + const ramp = await rampService.registerRamp({ additionalData: enrichedAdditionalData, quoteId, signingAccounts, - userId: req.userId + userId: effectiveUserId }); observeRampSuccess(req, "ramp_register", httpStatus.CREATED, { @@ -257,10 +260,11 @@ export const getRampHistory = async ( }); } + const effectiveUserId = getEffectiveUserId(req); const owner = req.authenticatedPartner ? { partnerId: req.authenticatedPartner.id } - : req.userId - ? { userId: req.userId } + : effectiveUserId + ? { userId: effectiveUserId } : null; if (!owner) { throw new APIError({ message: "Authentication required", status: httpStatus.UNAUTHORIZED }); diff --git a/apps/api/src/api/middlewares/apiKeyAuth.helpers.ts b/apps/api/src/api/middlewares/apiKeyAuth.helpers.ts index 9a2416c3d..b268c3b4b 100644 --- a/apps/api/src/api/middlewares/apiKeyAuth.helpers.ts +++ b/apps/api/src/api/middlewares/apiKeyAuth.helpers.ts @@ -7,6 +7,17 @@ import Partner from "../../models/partner.model"; export interface AuthenticatedPartner { id: string; name: string; + /** + * Database id of the API key that authenticated the request. + * Used by ownership and effective-user helpers for diagnostics. + */ + apiKeyId?: string; + /** + * User id (profiles.id) bound to the API key via `api_keys.user_id`. + * Populated for secret keys that have been linked to a user; null/undefined + * for unlinked secret keys. Public API keys never populate this. + */ + apiKeyUserId?: string | null; } /** @@ -162,6 +173,8 @@ export async function validateSecretApiKey(apiKey: string): Promise`), but the helpers only ever +// touch `userId` / `apiKeyUserId` / `authenticatedPartner` fields. Treating +// the argument as `Pick` keeps the +// call sites type-clean without forcing every consumer to widen the request +// type. +type RequestLike = Pick; + +/** + * Returns the effective user identity for a request. + * + * Order of preference: Supabase-authenticated user (`req.userId`) first, then the + * nullable `api_keys.user_id` resolved during secret API-key validation + * (`req.apiKeyUserId`). Returns `undefined` for fully anonymous requests. + * + */ +export function getEffectiveUserId(req: RequestLike): string | undefined { + return req.userId ?? req.apiKeyUserId; +} + +/** + * Attach an `apiKeyUserId` to a request from a secret API key validation result. + * Intended for the auth middlewares (`apiKeyAuth`, `dualAuth`) that call + * `validateSecretApiKey`. Public API keys do not populate this field. + */ +export function setApiKeyUserId(req: Request, userId: string | null | undefined): void { + if (userId) { + req.apiKeyUserId = userId; + } +} + +export type EffectiveUserRequest = Request; +export type EffectiveUserMiddleware = (req: Request, res: Response, next: NextFunction) => void; diff --git a/apps/api/src/api/middlewares/ownershipAuth.ts b/apps/api/src/api/middlewares/ownershipAuth.ts index 1d84bbfe4..e5273ab2d 100644 --- a/apps/api/src/api/middlewares/ownershipAuth.ts +++ b/apps/api/src/api/middlewares/ownershipAuth.ts @@ -9,6 +9,7 @@ import type { AuthenticatedPartner } from "./apiKeyAuth.helpers"; interface OwnershipRequest { authenticatedPartner?: AuthenticatedPartner; + apiKeyUserId?: string; body?: unknown; method?: string; params?: unknown; @@ -31,6 +32,10 @@ async function ownsPartnerRecord(authenticatedPartner: AuthenticatedPartner, par return partnerId === authenticatedPartner.id || quotePartner.name === authenticatedPartner.name; } +function effectiveRequestUserId(req: OwnershipRequest): string | undefined { + return req.userId ?? req.apiKeyUserId; +} + /** * Verify the authenticated principal owns the ramp identified by req.params.id * or req.body.rampId. Partner principals must match the quote's partnerId; @@ -56,11 +61,22 @@ export async function assertRampOwnership(req: OwnershipRequest, rampId: string) status: httpStatus.FORBIDDEN }); } + // Enforce user consistency on the underlying + // quote so one partner key cannot operate on a different linked user's + // provider-backed ramp. + if (req.apiKeyUserId && quote.userId && quote.userId !== req.apiKeyUserId) { + recordOwnershipFailure(req, httpStatus.FORBIDDEN, "ownership_denied", { quoteId: ramp.quoteId, rampId }); + throw new APIError({ + message: "Authenticated API key user does not own this ramp", + status: httpStatus.FORBIDDEN + }); + } return; } - if (req.userId) { - if (ramp.userId !== req.userId) { + const userId = effectiveRequestUserId(req); + if (userId) { + if (ramp.userId !== null && ramp.userId !== userId) { recordOwnershipFailure(req, httpStatus.FORBIDDEN, "ownership_denied", { quoteId: ramp.quoteId, rampId }); throw new APIError({ message: "Authenticated user does not own this ramp", @@ -106,10 +122,21 @@ export async function assertQuoteOwnership(req: OwnershipRequest, quoteId: strin status: httpStatus.FORBIDDEN }); } + // Enforce user consistency on the quote so one + // partner key cannot operate on a different linked user's provider-bound + // quote. + if (req.apiKeyUserId && quote.userId && quote.userId !== req.apiKeyUserId) { + recordOwnershipFailure(req, httpStatus.FORBIDDEN, "ownership_denied", { quoteId }); + throw new APIError({ + message: "Authenticated API key user does not own this quote", + status: httpStatus.FORBIDDEN + }); + } return; } - if (req.userId) { + const userId = effectiveRequestUserId(req); + if (userId) { if (quote.partnerId !== null) { recordOwnershipFailure(req, httpStatus.FORBIDDEN, "ownership_denied", { quoteId }); throw new APIError({ @@ -117,7 +144,7 @@ export async function assertQuoteOwnership(req: OwnershipRequest, quoteId: strin status: httpStatus.FORBIDDEN }); } - if (quote.userId !== null && quote.userId !== req.userId) { + if (quote.userId !== null && quote.userId !== userId) { recordOwnershipFailure(req, httpStatus.FORBIDDEN, "ownership_denied", { quoteId }); throw new APIError({ message: "Authenticated user does not own this quote", @@ -155,6 +182,6 @@ function recordOwnershipFailure( partnerName: req.authenticatedPartner?.name || null, requestId: req.requestId, status: "failure", - userId: req.userId || null + userId: effectiveRequestUserId(req) || null }); } diff --git a/apps/api/src/api/middlewares/publicKeyAuth.ts b/apps/api/src/api/middlewares/publicKeyAuth.ts index 9b66e542b..599e2b583 100644 --- a/apps/api/src/api/middlewares/publicKeyAuth.ts +++ b/apps/api/src/api/middlewares/publicKeyAuth.ts @@ -101,6 +101,6 @@ function recordPublicKeyFailure(req: Request, httpStatus: number, apiKeyPrefix: operation: "auth_public_key", requestId: req.requestId, status: "failure", - userId: req.userId || null + userId: req.userId || req.apiKeyUserId || null }); } diff --git a/apps/api/src/api/routes/v1/brla.route.ts b/apps/api/src/api/routes/v1/brla.route.ts index 115d185f5..db0bc4c2b 100644 --- a/apps/api/src/api/routes/v1/brla.route.ts +++ b/apps/api/src/api/routes/v1/brla.route.ts @@ -1,6 +1,6 @@ import { RequestHandler, Router } from "express"; import * as brlaController from "../../controllers/brla.controller"; -import { optionalPartnerOrUserAuth } from "../../middlewares/dualAuth"; +import { optionalPartnerOrUserAuth, requirePartnerOrUserAuth } from "../../middlewares/dualAuth"; import { optionalAuth, requireAuth } from "../../middlewares/supabaseAuth"; import { validateStartKyc2, validateSubaccountCreation } from "../../middlewares/validators"; @@ -12,8 +12,7 @@ const router: Router = Router({ mergeParams: true }); // // /getUser, /getUserRemainingLimit, and /validatePixKey use optionalPartnerOrUserAuth so that SDK // clients without API keys can drive a BRL ramp pre-flight against fully-anonymous quotes. The -// controllers themselves apply ownership scoping when req.userId is set; anonymous callers see -// the same data surface a partner X-API-Key caller would (taxId is the lookup key in both cases). +// controllers themselves apply ownership scoping using `getEffectiveUserId`; router.get("/getUser", optionalPartnerOrUserAuth(), brlaController.getAveniaUser as unknown as RequestHandler); router.get( @@ -28,7 +27,9 @@ router.get("/getSelfieLivenessUrl", requireAuth, brlaController.getSelfieLivenes router.get("/validatePixKey", optionalPartnerOrUserAuth(), brlaController.validatePixKey as unknown as RequestHandler); -router.route("/createSubaccount").post(validateSubaccountCreation, optionalAuth, brlaController.createSubaccount); +router + .route("/createSubaccount") + .post(validateSubaccountCreation, requirePartnerOrUserAuth(), brlaController.createSubaccount as unknown as RequestHandler); router.route("/getUploadUrls").post(validateStartKyc2, requireAuth, brlaController.getUploadUrls); diff --git a/apps/api/src/api/services/avena-account.ts b/apps/api/src/api/services/avena-account.ts new file mode 100644 index 000000000..ecd650731 --- /dev/null +++ b/apps/api/src/api/services/avena-account.ts @@ -0,0 +1,71 @@ +import { AveniaAccountType, normalizeTaxId } from "@vortexfi/shared"; +import httpStatus from "http-status"; +import TaxId, { TaxIdInternalStatus } from "../../models/taxId.model"; +import { APIError } from "../errors/api-error"; + +export interface ResolvedAveniaAccount { + taxId: string; + subAccountId: string; + accountType: AveniaAccountType; + taxIdRecord: TaxId; +} + +/** + * Resolve the canonical Avenia account for a user. Subaccounts in `Consulted`/`Requested` states + * are not considered ramp-execution ready; they are reserved for KYC flows. + */ +export async function resolveAveniaAccountForUser(userId: string): Promise { + const candidates = await TaxId.findAll({ + where: { + internalStatus: TaxIdInternalStatus.Accepted, + userId + } + }); + + if (candidates.length === 0) { + throw new APIError({ + message: "No completed Avenia profile found for this API key user.", + status: httpStatus.BAD_REQUEST + }); + } + + if (candidates.length > 1) { + throw new APIError({ + message: `Multiple completed Avenia profiles found for this API key user (${candidates.length}). Account selection is not yet supported.`, + status: httpStatus.BAD_REQUEST + }); + } + + const taxIdRecord = candidates[0]; + if (!taxIdRecord.subAccountId) { + throw new APIError({ + message: "Avenia subaccount is not yet provisioned for this user.", + status: httpStatus.BAD_REQUEST + }); + } + + return { + accountType: taxIdRecord.accountType, + subAccountId: taxIdRecord.subAccountId, + taxId: normalizeTaxId(taxIdRecord.taxId), + taxIdRecord + }; +} + +/** + * Mirrors `resolveAveniaAccountForUser` but allows the request to provide an + * optional override taxId; if provided, it MUST match the derived one or + * registration is rejected. + */ +export async function resolveAveniaAccountForRamp(userId: string, providedTaxId?: string): Promise { + const resolved = await resolveAveniaAccountForUser(userId); + + if (providedTaxId && normalizeTaxId(providedTaxId) !== resolved.taxId) { + throw new APIError({ + message: "Provided taxId does not match the Avenia profile bound to the authenticated user.", + status: httpStatus.BAD_REQUEST + }); + } + + return resolved; +} diff --git a/apps/api/src/api/services/quote/alfredpay-customer.ts b/apps/api/src/api/services/quote/alfredpay-customer.ts new file mode 100644 index 000000000..c500db862 --- /dev/null +++ b/apps/api/src/api/services/quote/alfredpay-customer.ts @@ -0,0 +1,68 @@ +import { AlfredPayCountry, AlfredPayStatus, FiatToken, isAlfredpayToken } from "@vortexfi/shared"; +import httpStatus from "http-status"; +import AlfredPayCustomer from "../../../models/alfredPayCustomer.model"; +import { APIError } from "../../errors/api-error"; + +const fiatToCountry: Partial> = { + [FiatToken.USD]: AlfredPayCountry.US, + [FiatToken.MXN]: AlfredPayCountry.MX, + [FiatToken.COP]: AlfredPayCountry.CO, + [FiatToken.ARS]: AlfredPayCountry.AR +}; + +/** + * Sentinel `quoteId` value used by the Alfredpay quote engines when the quote + * was created without an authenticated user (anonymous quote). Real Alfredpay + * quote creation requires a KYC-completed customer id, so anonymous quotes + * cannot mint a real upstream `quoteId` here. + */ +export const ANONYMOUS_ALFREDPAY_QUOTE_ID = "__anonymous_alfredpay_quote__"; + +export function isAnonymousAlfredpayQuoteId(quoteId: string | undefined | null): boolean { + return quoteId === ANONYMOUS_ALFREDPAY_QUOTE_ID; +} + +/** + * Resolve the AlfredPay customer id for a given fiat currency + user. The + * fiat side of the request determines the country; the user must own a + * KYC-completed (`Success`) customer row. + * + * Ramp-register / start enforce a non-empty `userId` for provider-backed + * flows (Alfredpay, Avenia/BRL). + */ +export async function resolveAlfredpayCustomerId(fiatCurrency: string, userId: string): Promise { + if (!isAlfredpayToken(fiatCurrency as FiatToken)) { + throw new APIError({ + message: `Unsupported Alfredpay currency: ${fiatCurrency}`, + status: httpStatus.BAD_REQUEST + }); + } + + const country = fiatToCountry[fiatCurrency as FiatToken]; + if (!country) { + throw new APIError({ + message: `Unsupported Alfredpay currency: ${fiatCurrency}`, + status: httpStatus.BAD_REQUEST + }); + } + + const customer = await AlfredPayCustomer.findOne({ + where: { country, userId } + }); + + if (!customer) { + throw new APIError({ + message: `No completed Alfredpay KYC profile found for ${fiatCurrency}. Complete Alfredpay KYC before requesting a quote.`, + status: httpStatus.BAD_REQUEST + }); + } + + if (customer.status !== AlfredPayStatus.Success) { + throw new APIError({ + message: `Alfredpay KYC status is ${customer.status}. Complete Alfredpay KYC before requesting a quote.`, + status: httpStatus.BAD_REQUEST + }); + } + + return customer.alfredPayId; +} diff --git a/apps/api/src/api/services/transactions/offramp/common/types.ts b/apps/api/src/api/services/transactions/offramp/common/types.ts index 6b51bfdbe..03405fb8c 100644 --- a/apps/api/src/api/services/transactions/offramp/common/types.ts +++ b/apps/api/src/api/services/transactions/offramp/common/types.ts @@ -9,7 +9,7 @@ export interface OfframpTransactionParams { taxId?: string; receiverTaxId?: string; brlaEvmAddress?: string; - userId?: string; + userId: string; fiatAccountId?: string; email?: string; destinationAddress?: string; diff --git a/apps/api/src/api/services/transactions/offramp/common/validation.ts b/apps/api/src/api/services/transactions/offramp/common/validation.ts index ebc9aeb8d..c6a11b7dd 100644 --- a/apps/api/src/api/services/transactions/offramp/common/validation.ts +++ b/apps/api/src/api/services/transactions/offramp/common/validation.ts @@ -57,7 +57,7 @@ export function validateOfframpQuote( } /** - * Validates BRL offramp requirements + * Validates BRL offramp requirements. * @param quote The quote ticket * @param params Offramp parameters * @returns Validated parameters @@ -79,13 +79,13 @@ export function validateBRLOfframp( const { brlaEvmAddress, pixDestination, taxId, receiverTaxId } = params; if (!brlaEvmAddress || !pixDestination || !taxId || !receiverTaxId) { - throw new Error("brlaEvmAddress, pixDestination, receiverTaxId and taxId parameters must be provided for offramp to BRL"); + throw new Error("brlaEvmAddress, pixDestination, receiverTaxId and taxId must be derived for offramp to BRL"); } return { brlaEvmAddress, pixDestination, - receiverTaxId, + receiverTaxId: normalizeTaxId(receiverTaxId), taxId: normalizeTaxId(taxId) }; } diff --git a/apps/api/src/api/services/transactions/offramp/routes/evm-to-alfredpay.ts b/apps/api/src/api/services/transactions/offramp/routes/evm-to-alfredpay.ts index 42be242b2..1824aadbb 100644 --- a/apps/api/src/api/services/transactions/offramp/routes/evm-to-alfredpay.ts +++ b/apps/api/src/api/services/transactions/offramp/routes/evm-to-alfredpay.ts @@ -1,8 +1,6 @@ import { ALFREDPAY_ERC20_TOKEN, ALFREDPAY_ONCHAIN_CURRENCY, - AlfredPayCountry, - AlfredPayStatus, AlfredpayApiService, AlfredpayChain, AlfredpayFiatCurrency, @@ -13,7 +11,6 @@ import { EvmTokenDetails, EvmTransactionData, evmTokenConfig, - FiatToken, getNetworkFromDestination, getNetworkId, getOnChainTokenDetails, @@ -25,6 +22,7 @@ import { UnsignedTx } from "@vortexfi/shared"; import Big from "big.js"; +import httpStatus from "http-status"; import { ContractFunctionExecutionError, encodeAbiParameters, @@ -38,9 +36,10 @@ import { import { privateKeyToAccount } from "viem/accounts"; import { config } from "../../../../../config/vars"; import erc20ABI from "../../../../../contracts/ERC20"; -import AlfredPayCustomer from "../../../../../models/alfredPayCustomer.model"; +import { APIError } from "../../../../errors/api-error"; import { getEvmFundingAccount } from "../../../phases/evm-funding"; import { StateMetadata } from "../../../phases/meta-state-types"; +import { resolveAlfredpayCustomerId } from "../../../quote/alfredpay-customer"; import { encodeEvmTransactionData } from "../../index"; import { addOnrampDestinationChainTransactions } from "../../onramp/common/transactions"; import { preparePolygonCleanupApproval } from "../../polygon/cleanup"; @@ -198,43 +197,35 @@ export async function prepareEvmToAlfredpayOfframpTransactions({ throw new Error(`Unsupported source network ${fromNetwork} for EVM to Alfredpay type offramp`); } - const fiatToCountry: Partial> = { - [FiatToken.USD]: AlfredPayCountry.US, - [FiatToken.MXN]: AlfredPayCountry.MX, - [FiatToken.COP]: AlfredPayCountry.CO, - [FiatToken.ARS]: AlfredPayCountry.AR - }; - const customerCountry = fiatToCountry[quote.outputCurrency as FiatToken]; - if (!customerCountry) { - throw new Error(`Unsupported Alfredpay output currency: ${quote.outputCurrency}`); - } - - const customer = await AlfredPayCustomer.findOne({ - where: { country: customerCountry, userId } - }); - - if (!customer) { - throw new Error(`Alfredpay customer not found for userId ${userId}`); - } - - if (customer.status !== AlfredPayStatus.Success) { - throw new Error(`Alfredpay customer status is ${customer.status}, expected Success. Proceed first with KYC.`); + if (!userId) { + throw new APIError({ + message: "Alfredpay offramp requires an API key linked to a user or Supabase user authentication.", + status: httpStatus.BAD_REQUEST + }); } if (!fiatAccountId) { - throw new Error("fiatAccountId is required for Alfredpay offramp"); + throw new APIError({ + message: "fiatAccountId is required for Alfredpay offramp", + status: httpStatus.BAD_REQUEST + }); } + const alfredPayId = await resolveAlfredpayCustomerId(quote.outputCurrency, userId); + const alfredpayQuoteId = quote.metadata.alfredpayOfframp?.quoteId; if (!alfredpayQuoteId) { - throw new Error("Missing alfredpayOfframp.quoteId in quote metadata"); + throw new APIError({ + message: "Missing alfredpayOfframp.quoteId in quote metadata", + status: httpStatus.BAD_REQUEST + }); } const alfredpayService = AlfredpayApiService.getInstance(); const offrampOrder = await alfredpayService.createOfframp({ amount: quote.metadata.alfredpayOfframp.inputAmountDecimal.toString(), chain: AlfredpayChain.MATIC, - customerId: customer.alfredPayId, + customerId: alfredPayId, fiatAccountId, fromCurrency: ALFREDPAY_ONCHAIN_CURRENCY, originAddress: evmEphemeralEntry.address, @@ -321,7 +312,7 @@ export async function prepareEvmToAlfredpayOfframpTransactions({ stateMeta = { ...stateMeta, alfredpayTransactionId: offrampOrder.transactionId, - alfredpayUserId: customer.alfredPayId, + alfredpayUserId: alfredPayId, evmEphemeralAddress: evmEphemeralEntry.address, fiatAccountId, isDirectTransfer: true, @@ -412,7 +403,7 @@ export async function prepareEvmToAlfredpayOfframpTransactions({ stateMeta = { ...stateMeta, alfredpayTransactionId: offrampOrder.transactionId, - alfredpayUserId: customer.alfredPayId, + alfredpayUserId: alfredPayId, evmEphemeralAddress: evmEphemeralEntry.address, fiatAccountId, squidRouterPermitExecutionValue: bridgeResult.swapData.value, @@ -445,7 +436,7 @@ export async function prepareEvmToAlfredpayOfframpTransactions({ stateMeta = { ...stateMeta, alfredpayTransactionId: offrampOrder.transactionId, - alfredpayUserId: customer.alfredPayId, + alfredpayUserId: alfredPayId, evmEphemeralAddress: evmEphemeralEntry.address, fiatAccountId, isDirectTransfer: true, @@ -487,7 +478,7 @@ export async function prepareEvmToAlfredpayOfframpTransactions({ stateMeta = { ...stateMeta, alfredpayTransactionId: offrampOrder.transactionId, - alfredpayUserId: customer.alfredPayId, + alfredpayUserId: alfredPayId, evmEphemeralAddress: evmEphemeralEntry.address, fiatAccountId, isNoPermitFallback: true, diff --git a/apps/api/src/api/services/transactions/onramp/routes/alfredpay-to-evm.ts b/apps/api/src/api/services/transactions/onramp/routes/alfredpay-to-evm.ts index 9d36b96ba..97372e6c0 100644 --- a/apps/api/src/api/services/transactions/onramp/routes/alfredpay-to-evm.ts +++ b/apps/api/src/api/services/transactions/onramp/routes/alfredpay-to-evm.ts @@ -1,7 +1,5 @@ import { ALFREDPAY_ERC20_TOKEN, - AlfredPayCountry, - AlfredPayStatus, createOnrampSquidrouterTransactionsFromPolygonToEvm, createOnrampSquidrouterTransactionsOnDestinationChain, ERC20_USDC_POLYGON, @@ -10,7 +8,6 @@ import { EvmTokenDetails, EvmTransactionData, evmTokenConfig, - FiatToken, getNetworkFromDestination, getOnChainTokenDetails, getOnChainTokenDetailsOrDefault, @@ -22,10 +19,10 @@ import { } from "@vortexfi/shared"; import httpStatus from "http-status"; import { isAddress } from "viem"; -import AlfredPayCustomer from "../../../../../models/alfredPayCustomer.model"; import { APIError } from "../../../../errors/api-error"; import { getEvmFundingAccount } from "../../../phases/evm-funding"; import { StateMetadata } from "../../../phases/meta-state-types"; +import { resolveAlfredpayCustomerId } from "../../../quote/alfredpay-customer"; import { encodeEvmTransactionData } from "../../index"; import { preparePolygonCleanupApproval } from "../../polygon/cleanup"; import { addDestinationChainApprovalTransaction, addOnrampDestinationChainTransactions } from "../common/transactions"; @@ -85,38 +82,11 @@ export async function prepareAlfredpayToEvmOnrampTransactions({ throw new Error(`Output token details not found for ${quote.outputCurrency} on network ${toNetwork}`); } - const fiatToCountry: Partial> = { - [FiatToken.USD]: AlfredPayCountry.US, - [FiatToken.MXN]: AlfredPayCountry.MX, - [FiatToken.COP]: AlfredPayCountry.CO, - [FiatToken.ARS]: AlfredPayCountry.AR - }; - const customerCountry = fiatToCountry[quote.inputCurrency as FiatToken]; - if (!customerCountry) { - throw new Error(`Unsupported Alfredpay input currency: ${quote.inputCurrency}`); - } - - const customer = await AlfredPayCustomer.findOne({ - where: { country: customerCountry, userId } - }); - - if (!customer) { - throw new APIError({ - message: `No completed Alfredpay KYC profile found for ${quote.inputCurrency}. Complete Alfredpay KYC before registering this onramp.`, - status: httpStatus.BAD_REQUEST - }); - } - - if (customer.status !== AlfredPayStatus.Success) { - throw new APIError({ - message: `Alfredpay KYC status is ${customer.status}. Complete Alfredpay KYC before registering this onramp.`, - status: httpStatus.BAD_REQUEST - }); - } + const alfredPayId = await resolveAlfredpayCustomerId(quote.inputCurrency, userId); // Setup state metadata stateMeta = { - alfredpayUserId: customer.alfredPayId, + alfredpayUserId: alfredPayId, destinationAddress, evmEphemeralAddress: evmEphemeralEntry.address }; diff --git a/docs/security-spec/01-auth/api-keys.md b/docs/security-spec/01-auth/api-keys.md index a41b85ad6..9aea3212f 100644 --- a/docs/security-spec/01-auth/api-keys.md +++ b/docs/security-spec/01-auth/api-keys.md @@ -14,6 +14,10 @@ Three middleware components: - **`validatePublicKey()`** — Validates public keys from query params or body. For tracking only, not authentication. - **`enforcePartnerAuth()`** — When `partnerId` is in the request body, enforces that the request is authenticated and the partner matches. +### Optional user binding (`api_keys.user_id`) + +A nullable `user_id` column on `api_keys` (FK to `profiles.id`, `ON DELETE SET NULL`) lets an admin bind a secret key to a specific profile. The binding is propagated to the request as `req.apiKeyUserId` (set by `setApiKeyUserId` in the auth middleware). Controllers and services derive the **effective user id** with `getEffectiveUserId(req)`, which prefers `req.userId` (Supabase) and falls back to `req.apiKeyUserId`. Public keys never populate `req.apiKeyUserId`. Use of the effective user is required for provider-backed quote creation, ramp registration on Avenia/BRL or Alfredpay corridors, and the BRLA pre-flight endpoints. + ## Security Invariants 1. **Secret keys MUST be transmitted via the `X-API-Key` header only** — Never in query parameters, request body, or URL path. The middleware reads exclusively from `req.headers["x-api-key"]`. @@ -26,6 +30,9 @@ Three middleware components: 8. **`enforcePartnerAuth` MUST block unauthenticated requests when `partnerId` is present** — If a request includes `partnerId` but has no authenticated partner, it MUST be rejected with 403. 9. **`lastUsedAt` updates MUST be fire-and-forget** — The `keyRecord.update({ lastUsedAt })` call is intentionally not awaited, with errors caught and logged. This MUST NOT block or fail the auth flow. 10. **Key generation MUST use cryptographically secure randomness** — `crypto.randomBytes(32)` is the source. Base64 encoding with character stripping is used to produce the 32-char alphanumeric portion. +11. **Secret keys MAY carry a nullable `api_keys.user_id` to identify a delegated user context** — The binding is consumed by the `apiKeyUserId` request field and is the only path for partner secret keys to provide a non-Supabase user identity. Public keys never carry or surface a user binding. +12. **`ON DELETE SET NULL` for `api_keys.user_id` is intentional** — Deleting a profile must not silently revoke partner keys; partner keys are operational assets and binding loss is a soft-state change. +13. **Provider-backed quote and ramp operations MUST be rejected when no effective user is present** — Alfredpay and Avenia/BRL flows return `400 Invalid quote: this route requires an API key linked to a user or Supabase user authentication.` before any upstream provider call. Unlinked secret keys are not a valid identity for these corridors. ## Threat Vectors & Mitigations @@ -37,6 +44,9 @@ Three middleware components: | **Partner impersonation** | Attacker uses one partner's API key with another partner's `partnerId` | `enforcePartnerAuth` compares authenticated partner name against requested partner name; rejects mismatches with 403 | | **Stale/revoked key usage** | Partner's key is deactivated but still being used | `isActive` flag checked on every validation; expired keys rejected by `expiresAt` check | | **Key hash enumeration** | Attacker with DB read access tries to use key hashes | bcrypt hashes are one-way; raw keys cannot be recovered from hashes | +| **Unlinked key creating provider resources anonymously** | Partner uses a generic (unbound) sk\_ key to mint an Alfredpay/Avenia estimate quote, then registers it with a linked secret key or Supabase session to claim the resulting real provider quote | Quote creation is anonymous-eligible (the Alfredpay engines short-circuit on no effective user and store a sentinel `ANONYMOUS_ALFREDPAY_QUOTE_ID`). `RampService.registerRamp` rejects with `403` when `isProviderBackedRampKind(quote) && quote.userId == null && request.userId != null`, so the anonymous estimate cannot be claimed by an authenticated caller. Alfredpay engines resolve the customer via `api_keys.user_id -> alfredpay_customers.user_id` whenever an effective user is present. | +| **One linked key operating on another user's quote/ramp** | Partner with a valid linked key targets a different linked user's provider-bound quote | `assertQuoteOwnership`/`assertRampOwnership` enforce `quote.userId === req.apiKeyUserId` when a linked key is in scope. The `RampService.registerRamp` cross-user check rejects the same scenario at registration time with `403`. | +| **Anonymous subaccount creation DoS** | Unauthenticated caller hits `POST /v1/brla/createSubaccount` to spawn stranded Avenia subaccounts | The route now requires `requirePartnerOrUserAuth()`; controllers require an effective user id before calling the Avenia API. | ## Audit Checklist @@ -52,3 +62,11 @@ Three middleware components: - [x] Partner name comparison is case-sensitive and exact (no normalization that could be exploited) — **PASS** - [x] No endpoint accepts secret keys from query parameters or request body — **PASS** - [x] Error responses from key validation use distinct error codes (`API_KEY_REQUIRED`, `INVALID_SECRET_KEY`, `INVALID_API_KEY`, `PARTNER_MISMATCH`) without revealing which step failed for valid key formats — **PARTIAL: `PARTNER_MISMATCH` leaks authenticated partner name in response details** +- [x] `api_keys.user_id` migration (`034-add-user-id-to-api-keys`) added with `ON DELETE SET NULL`, `idx_api_keys_user_id`, and `idx_api_keys_active_user_lookup`. — **PASS** +- [x] `validateSecretApiKey` returns `apiKeyId` and `apiKeyUserId` on the `AuthenticatedPartner` value. — **PASS** +- [x] `apiKeyAuth` and `dualAuth` populate `req.apiKeyUserId` from the validated secret key. Public keys do not populate the field. — **PASS** +- [x] `getEffectiveUserId` returns `req.userId ?? req.apiKeyUserId`. — **PASS** +- [x] Provider-backed quote creation is anonymous-eligible: Alfredpay engines short-circuit on no effective user and store `ANONYMOUS_ALFREDPAY_QUOTE_ID`; Avenia engines call upstream providers regardless of identity. — **PASS** +- [x] `RampService.registerRamp` rejects provider-backed ramps without an effective user with `400 Invalid quote`. — **PASS** +- [x] `RampService.registerRamp` rejects anonymous provider-backed quotes from being claimed by an authenticated caller with `403` (`isProviderBackedRampKind(quote) && quote.userId == null && request.userId != null`). — **PASS** +- [x] `assertQuoteOwnership` and `assertRampOwnership` reject linked-key callers who try to operate on a different linked user's quote/ramp. — **PASS** From 4ed742fe4aec4930658da692122413626e849a03 Mon Sep 17 00:00:00 2001 From: Gianfranco Date: Thu, 25 Jun 2026 11:08:17 -0300 Subject: [PATCH 034/176] add apiKey auth tests --- .../admin/partnerApiKeys.controller.ts | 50 ++++++++++++-- apps/api/src/api/middlewares/dualAuth.test.ts | 66 +++++++++++++++++++ .../src/api/middlewares/effectiveUser.test.ts | 52 +++++++++++++++ 3 files changed, 161 insertions(+), 7 deletions(-) create mode 100644 apps/api/src/api/middlewares/effectiveUser.test.ts diff --git a/apps/api/src/api/controllers/admin/partnerApiKeys.controller.ts b/apps/api/src/api/controllers/admin/partnerApiKeys.controller.ts index 075273ef1..35ce23c4c 100644 --- a/apps/api/src/api/controllers/admin/partnerApiKeys.controller.ts +++ b/apps/api/src/api/controllers/admin/partnerApiKeys.controller.ts @@ -4,6 +4,7 @@ import logger from "../../../config/logger"; import { config } from "../../../config/vars"; import ApiKey from "../../../models/apiKey.model"; import Partner from "../../../models/partner.model"; +import User from "../../../models/user.model"; import { generateApiKey, getKeyPrefix, hashApiKey } from "../../middlewares/apiKeyAuth.helpers"; /** @@ -13,7 +14,7 @@ import { generateApiKey, getKeyPrefix, hashApiKey } from "../../middlewares/apiK export async function createApiKey(req: Request<{ partnerName: string }>, res: Response): Promise { try { const partnerName = req.params.partnerName; - const { name, expiresAt } = req.body; + const { name, expiresAt, userId } = req.body; // Verify at least one partner with this name exists and is active const partners = await Partner.findAll({ @@ -34,6 +35,34 @@ export async function createApiKey(req: Request<{ partnerName: string }>, res: R return; } + // Optionally bind the new key pair to a profile (api_keys.user_id). + // The user must already exist; null is the default for partner-only keys. + let resolvedUserId: string | null = null; + if (userId !== undefined && userId !== null && userId !== "") { + if (typeof userId !== "string") { + res.status(httpStatus.BAD_REQUEST).json({ + error: { + code: "INVALID_USER_ID", + message: "userId must be a string", + status: httpStatus.BAD_REQUEST + } + }); + return; + } + const user = await User.findByPk(userId); + if (!user) { + res.status(httpStatus.NOT_FOUND).json({ + error: { + code: "USER_NOT_FOUND", + message: "Profile was not found", + status: httpStatus.NOT_FOUND + } + }); + return; + } + resolvedUserId = user.id; + } + // Determine environment const environment = config.sandboxEnabled ? "test" : "live"; @@ -57,7 +86,8 @@ export async function createApiKey(req: Request<{ partnerName: string }>, res: R keyType: "public", keyValue: publicKey, name: name ? `${name} (Public)` : "Public Key", - partnerName + partnerName, + userId: resolvedUserId }); // Create secret key record @@ -69,7 +99,8 @@ export async function createApiKey(req: Request<{ partnerName: string }>, res: R keyType: "secret", keyValue: null, name: name ? `${name} (Secret)` : "Secret Key", - partnerName + partnerName, + userId: resolvedUserId }); // Return both keys (secret shown only once!) @@ -84,15 +115,18 @@ export async function createApiKey(req: Request<{ partnerName: string }>, res: R key: publicKey, // Can be shown anytime (it's public) keyPrefix: publicKeyRecord.keyPrefix, name: publicKeyRecord.name, - type: "public" + type: "public", + userId: publicKeyRecord.userId }, secretKey: { id: secretKeyRecord.id, key: secretKey, // Shown only once! keyPrefix: secretKeyRecord.keyPrefix, name: secretKeyRecord.name, - type: "secret" - } + type: "secret", + userId: secretKeyRecord.userId + }, + userId: resolvedUserId }); } catch (error) { logger.error("Error creating API keys:", error); @@ -141,6 +175,7 @@ export async function listApiKeys(req: Request<{ partnerName: string }>, res: Re "lastUsedAt", "expiresAt", "isActive", + "userId", "createdAt", "updatedAt" ], @@ -159,7 +194,8 @@ export async function listApiKeys(req: Request<{ partnerName: string }>, res: Re lastUsedAt: key.lastUsedAt, name: key.name, type: key.keyType, - updatedAt: key.updatedAt + updatedAt: key.updatedAt, + userId: key.userId })), partnerCount: partners.length, partnerName diff --git a/apps/api/src/api/middlewares/dualAuth.test.ts b/apps/api/src/api/middlewares/dualAuth.test.ts index 41a40fcd0..24f109265 100644 --- a/apps/api/src/api/middlewares/dualAuth.test.ts +++ b/apps/api/src/api/middlewares/dualAuth.test.ts @@ -95,6 +95,72 @@ describe("assertQuoteOwnership", () => { await expect(assertQuoteOwnership({}, "quote-1")).rejects.toThrow("Authentication required"); }); + + it("rejects a linked API key from operating on another linked user's provider-bound quote", async () => { + QuoteTicket.findByPk = mock(async () => ({ + partnerId: "quote-partner-id", + userId: "victim-user" + })) as typeof QuoteTicket.findByPk; + Partner.findByPk = mock(async () => ({ + id: "quote-partner-id", + isActive: true, + name: "Partner" + })) as typeof Partner.findByPk; + + await expect( + assertQuoteOwnership( + { + apiKeyUserId: "attacker-user", + authenticatedPartner: {id: "api-key-partner-id", name: "Partner"} + }, + "quote-1" + ) + ).rejects.toThrow("Authenticated API key user does not own this quote"); + }); + + it("allows a linked API key to operate on its own user's provider-bound quote", async () => { + QuoteTicket.findByPk = mock(async () => ({ + partnerId: "quote-partner-id", + userId: "user-1" + })) as typeof QuoteTicket.findByPk; + Partner.findByPk = mock(async () => ({ + id: "quote-partner-id", + isActive: true, + name: "Partner" + })) as typeof Partner.findByPk; + + await expect( + assertQuoteOwnership( + { + apiKeyUserId: "user-1", + authenticatedPartner: {id: "api-key-partner-id", name: "Partner"} + }, + "quote-1" + ) + ).resolves.toBeUndefined(); + }); + + it("allows an unlinked partner key to operate on a partner-owned anonymous-user quote", async () => { + QuoteTicket.findByPk = mock(async () => ({ + partnerId: "quote-partner-id", + userId: null + })) as typeof QuoteTicket.findByPk; + Partner.findByPk = mock(async () => ({ + id: "quote-partner-id", + isActive: true, + name: "Partner" + })) as typeof Partner.findByPk; + + await expect( + assertQuoteOwnership( + { + apiKeyUserId: undefined, + authenticatedPartner: {id: "api-key-partner-id", name: "Partner"} + }, + "quote-1" + ) + ).resolves.toBeUndefined(); + }); }); describe("assertRampOwnership", () => { diff --git a/apps/api/src/api/middlewares/effectiveUser.test.ts b/apps/api/src/api/middlewares/effectiveUser.test.ts new file mode 100644 index 000000000..fc666eb86 --- /dev/null +++ b/apps/api/src/api/middlewares/effectiveUser.test.ts @@ -0,0 +1,52 @@ +import {describe, expect, it} from "bun:test"; +import {getEffectiveUserId, setApiKeyUserId} from "./effectiveUser"; + +function fakeReq({userId, apiKeyUserId}: {userId?: string; apiKeyUserId?: string} = {}): { + userId?: string; + apiKeyUserId?: string; +} { + const req: {userId?: string; apiKeyUserId?: string} = {}; + if (userId !== undefined) { + req.userId = userId; + } + if (apiKeyUserId !== undefined) { + req.apiKeyUserId = apiKeyUserId; + } + return req; +} + +describe("getEffectiveUserId", () => { + it("prefers req.userId (Supabase) over req.apiKeyUserId", () => { + expect(getEffectiveUserId(fakeReq({userId: "supabase-user", apiKeyUserId: "key-user"}))).toBe( + "supabase-user" + ); + }); + + it("falls back to req.apiKeyUserId when no Supabase user", () => { + expect(getEffectiveUserId(fakeReq({apiKeyUserId: "key-user"}))).toBe("key-user"); + }); + + it("returns undefined when no identity is present", () => { + expect(getEffectiveUserId(fakeReq())).toBeUndefined(); + }); +}); + +describe("setApiKeyUserId", () => { + it("sets req.apiKeyUserId from a non-empty string", () => { + const req: {userId?: string; apiKeyUserId?: string} = {}; + setApiKeyUserId(req as never, "key-user"); + expect(req.apiKeyUserId).toBe("key-user"); + }); + + it("does not set req.apiKeyUserId when value is null", () => { + const req: {userId?: string; apiKeyUserId?: string} = {}; + setApiKeyUserId(req as never, null); + expect(req.apiKeyUserId).toBeUndefined(); + }); + + it("does not set req.apiKeyUserId when value is undefined", () => { + const req: {userId?: string; apiKeyUserId?: string} = {}; + setApiKeyUserId(req as never, undefined); + expect(req.apiKeyUserId).toBeUndefined(); + }); +}); From c5d74ec5950fedabaaf836f1a5c4157eb341ba50 Mon Sep 17 00:00:00 2001 From: Gianfranco Date: Thu, 25 Jun 2026 11:25:44 -0300 Subject: [PATCH 035/176] modify sdk for auth based tadId derivation --- packages/sdk/src/handlers/BrlHandler.ts | 35 ++++++------------- packages/sdk/src/services/ApiService.ts | 12 ++++--- packages/sdk/src/types.ts | 24 +++++++++++-- .../shared/src/endpoints/ramp.endpoints.ts | 12 +++++++ 4 files changed, 51 insertions(+), 32 deletions(-) diff --git a/packages/sdk/src/handlers/BrlHandler.ts b/packages/sdk/src/handlers/BrlHandler.ts index 7595a6098..7dd008bd3 100644 --- a/packages/sdk/src/handlers/BrlHandler.ts +++ b/packages/sdk/src/handlers/BrlHandler.ts @@ -56,19 +56,17 @@ export class BrlHandler implements RampHandler { } async registerBrlOnramp(quoteId: string, additionalData: BrlOnrampAdditionalData): Promise { - if (!additionalData.taxId) { - throw new Error("Tax ID is required for BRL onramp"); - } + // taxId is now derived server-side from the bound user + const taxId = additionalData.taxId ?? ""; - await this.validateBrlKyc(additionalData.taxId); - await this.assertWithinBrlLimit(additionalData.taxId, quoteId, RampDirection.BUY); + await this.assertWithinBrlLimit(taxId, quoteId, RampDirection.BUY); const { ephemerals, accountMetas } = await this.generateEphemerals(); const registerRequest: RegisterRampRequest = { additionalData: { destinationAddress: additionalData.destinationAddress, - taxId: additionalData.taxId + taxId: taxId || undefined }, quoteId, signingAccounts: accountMetas @@ -95,21 +93,19 @@ export class BrlHandler implements RampHandler { } async registerBrlOfframp(quoteId: string, additionalData: BrlOfframpAdditionalData): Promise { - if (!additionalData.taxId) { - throw new Error("Tax ID is required for BRL offramps"); - } + const taxId = additionalData.taxId ?? ""; + const receiverTaxId = additionalData.receiverTaxId ?? taxId; - await this.validateBrlKyc(additionalData.taxId); await this.assertValidPixKey(additionalData.pixDestination); - await this.assertWithinBrlLimit(additionalData.taxId, quoteId, RampDirection.SELL); + await this.assertWithinBrlLimit(taxId, quoteId, RampDirection.SELL); const { ephemerals, accountMetas } = await this.generateEphemerals(); const registerRequest: RegisterRampRequest = { additionalData: { pixDestination: additionalData.pixDestination, - receiverTaxId: additionalData.receiverTaxId, - taxId: additionalData.taxId, + receiverTaxId: receiverTaxId || undefined, + taxId: taxId || undefined, walletAddress: additionalData.walletAddress }, quoteId, @@ -158,17 +154,6 @@ export class BrlHandler implements RampHandler { return updatedRampProcess; } - private async validateBrlKyc(taxId: string): Promise { - if (!taxId) { - throw new BrlKycStatusError("Tax ID is required", 400); - } - - const kycStatus = await this.apiService.getBrlKycStatus(taxId); - if (kycStatus.kycLevel < 1) { - throw new Error(`Insufficient KYC level. Current: ${kycStatus.kycLevel}`); - } - } - private async assertValidPixKey(pixKey: string): Promise { let result: { valid: boolean }; try { @@ -206,7 +191,7 @@ export class BrlHandler implements RampHandler { } let remainingLimit: number; try { - ({ remainingLimit } = await this.apiService.getBrlRemainingLimit(taxId, direction)); + ({ remainingLimit } = await this.apiService.getBrlRemainingLimit(taxId || undefined, direction)); } catch (error) { // The backend returns 404 "Limits not found" for KYC-approved users whose // BRLA subaccount has not yet been initialized for limits. Treat this as diff --git a/packages/sdk/src/services/ApiService.ts b/packages/sdk/src/services/ApiService.ts index 49d2ac5fc..40d43dd42 100644 --- a/packages/sdk/src/services/ApiService.ts +++ b/packages/sdk/src/services/ApiService.ts @@ -87,9 +87,11 @@ export class ApiService { return handleAPIResponse(response, `/v1/ramp/status?id=${rampId}`); } - async getBrlKycStatus(taxId: string): Promise { + async getBrlKycStatus(taxId?: string): Promise { const url = new URL(`${this.apiBaseUrl}/v1/brla/getUser`); - url.searchParams.append("taxId", taxId); + if (taxId) { + url.searchParams.append("taxId", taxId); + } const response = await fetch(url.toString(), { headers: this.buildHeaders(), @@ -99,9 +101,11 @@ export class ApiService { return handleAPIResponse(response, "/v1/brla/getUser"); } - async getBrlRemainingLimit(taxId: string, direction: RampDirection): Promise<{ remainingLimit: number }> { + async getBrlRemainingLimit(taxId: string | undefined, direction: RampDirection): Promise<{ remainingLimit: number }> { const url = new URL(`${this.apiBaseUrl}/v1/brla/getUserRemainingLimit`); - url.searchParams.append("taxId", taxId); + if (taxId) { + url.searchParams.append("taxId", taxId); + } url.searchParams.append("direction", direction); const response = await fetch(url.toString(), { diff --git a/packages/sdk/src/types.ts b/packages/sdk/src/types.ts index 2f1bbd579..b6ee99cf8 100644 --- a/packages/sdk/src/types.ts +++ b/packages/sdk/src/types.ts @@ -100,7 +100,13 @@ export type RegisterRampAdditionalData = Q extends Alfr export interface BrlOnrampAdditionalData { destinationAddress: string; - taxId: string; + /** + * @deprecated The BRL subaccount is now derived server-side from + * `api_keys.user_id -> tax_ids.user_id`. The SDK still accepts the field + * for one release of backward compatibility, but the server rejects + * mismatches against the derived taxId. + */ + taxId?: string; } export interface EurOnrampAdditionalData { @@ -116,9 +122,21 @@ export interface AlfredpayOnrampAdditionalData { export interface BrlOfframpAdditionalData { pixDestination: string; - receiverTaxId: string; - taxId: string; walletAddress: string; + /** + * @deprecated The BRL subaccount is now derived server-side from + * `api_keys.user_id -> tax_ids.user_id`. The SDK still accepts the field + * for one release of backward compatibility, but the server rejects + * mismatches against the derived taxId. + */ + receiverTaxId?: string; + /** + * @deprecated The BRL subaccount is now derived server-side from + * `api_keys.user_id -> tax_ids.user_id`. The SDK still accepts the field + * for one release of backward compatibility, but the server rejects + * mismatches against the derived taxId. + */ + taxId?: string; } export interface EurOfframpAdditionalData { diff --git a/packages/shared/src/endpoints/ramp.endpoints.ts b/packages/shared/src/endpoints/ramp.endpoints.ts index ab4a9ecbb..5ea803a85 100644 --- a/packages/shared/src/endpoints/ramp.endpoints.ts +++ b/packages/shared/src/endpoints/ramp.endpoints.ts @@ -179,7 +179,19 @@ export interface RegisterRampRequest { destinationAddress?: string; paymentData?: PaymentData; pixDestination?: string; + /** + * @deprecated Derived server-side from `api_keys.user_id -> tax_ids.user_id` + * for linked secret-key callers and Supabase-authenticated callers. The + * server accepts a value for one release of backward compatibility, but + * mismatches against the derived taxId are rejected. + */ receiverTaxId?: string; + /** + * @deprecated Derived server-side from `api_keys.user_id -> tax_ids.user_id` + * for linked secret-key callers and Supabase-authenticated callers. The + * server accepts a value for one release of backward compatibility, but + * mismatches against the derived taxId are rejected. + */ taxId?: string; sessionId?: string; email?: string; // Required for Mykobo EUR ramps (binds ramp to anchor profile) From c0d42e1f4c7568104ab6e4c0a1808b3b937e4bd7 Mon Sep 17 00:00:00 2001 From: Gianfranco Date: Thu, 25 Jun 2026 12:57:01 -0300 Subject: [PATCH 036/176] use derived userId on register, alfredpay endpoints --- .../api/services/quote/alfredpay-customer.ts | 3 +- .../api/src/api/services/ramp/ramp.service.ts | 118 +++++++++++++----- .../03-ramp-engine/quote-lifecycle.md | 7 +- .../05-integrations/alfredpay.md | 4 +- docs/security-spec/05-integrations/brla.md | 6 + .../07-operations/api-surface.md | 1 + packages/sdk/src/types.ts | 6 - .../shared/src/endpoints/ramp.endpoints.ts | 6 - 8 files changed, 100 insertions(+), 51 deletions(-) diff --git a/apps/api/src/api/services/quote/alfredpay-customer.ts b/apps/api/src/api/services/quote/alfredpay-customer.ts index c500db862..1f802d168 100644 --- a/apps/api/src/api/services/quote/alfredpay-customer.ts +++ b/apps/api/src/api/services/quote/alfredpay-customer.ts @@ -27,8 +27,7 @@ export function isAnonymousAlfredpayQuoteId(quoteId: string | undefined | null): * fiat side of the request determines the country; the user must own a * KYC-completed (`Success`) customer row. * - * Ramp-register / start enforce a non-empty `userId` for provider-backed - * flows (Alfredpay, Avenia/BRL). + * Ramp-register / start enforce a non-empty `userId` for every corridor. */ export async function resolveAlfredpayCustomerId(fiatCurrency: string, userId: string): Promise { if (!isAlfredpayToken(fiatCurrency as FiatToken)) { diff --git a/apps/api/src/api/services/ramp/ramp.service.ts b/apps/api/src/api/services/ramp/ramp.service.ts index 55eef021f..f220c8c73 100644 --- a/apps/api/src/api/services/ramp/ramp.service.ts +++ b/apps/api/src/api/services/ramp/ramp.service.ts @@ -52,10 +52,12 @@ import RampState, { RampStateAttributes } from "../../../models/rampState.model" import TaxId from "../../../models/taxId.model"; import { APIError } from "../../errors/api-error"; import { ActivePartner, handleQuoteConsumptionForDiscountState } from "../../services/quote/engines/discount/helpers"; +import { resolveAveniaAccountForUser } from "../avena-account"; import { syncMykoboCustomerKyc } from "../mykobo/mykobo-customer.service"; import { StateMetadata } from "../phases/meta-state-types"; import phaseProcessor from "../phases/phase-processor"; import { PriceFeedService } from "../priceFeed.service"; +import { resolveAlfredpayCustomerId } from "../quote/alfredpay-customer"; import { prepareOfframpTransactions } from "../transactions/offramp"; import { prepareOnrampTransactions } from "../transactions/onramp"; import { AveniaOnrampTransactionParams } from "../transactions/onramp/common/types"; @@ -199,6 +201,29 @@ export class RampService extends BaseRampService { }); } + if (request.userId && quote.userId && request.userId !== quote.userId) { + throw new APIError({ + message: "Authenticated user does not own this provider-bound quote.", + status: httpStatus.FORBIDDEN + }); + } + + if (quote.userId == null && request.userId != null) { + throw new APIError({ + message: "This anonymous quote cannot be registered by an authenticated caller.", + status: httpStatus.FORBIDDEN + }); + } + + const effectiveUserId = request.userId || quote.userId || undefined; + + if (!effectiveUserId) { + throw new APIError({ + message: "Invalid quote: this route requires an API key linked to a user or Supabase user authentication.", + status: httpStatus.BAD_REQUEST + }); + } + const { normalizedSigningAccounts, ephemerals } = normalizeAndValidateSigningAccounts(signingAccounts); await validateEphemeralAccountsFresh(ephemerals); @@ -209,7 +234,7 @@ export class RampService extends BaseRampService { additionalData, signingAccounts, transaction, - request.userId // will be undefined if not logged in. registerRamp is optional. + effectiveUserId ); const [affectedRows] = await this.consumeQuote(quote.id, transaction); @@ -253,7 +278,7 @@ export class RampService extends BaseRampService { to: quote.to, type: quote.rampType, unsignedTxs, - userId: request.userId || quote.userId + userId: effectiveUserId }, transaction ); @@ -997,16 +1022,31 @@ export class RampService extends BaseRampService { private async prepareOfframpBrlTransactions( quote: QuoteTicket, normalizedSigningAccounts: AccountMeta[], - additionalData: RegisterRampRequest["additionalData"] + additionalData: RegisterRampRequest["additionalData"], + userId: string ): Promise<{ unsignedTxs: UnsignedTx[]; stateMeta: Partial; depositQrCode?: string }> { - if (!additionalData || !additionalData.pixDestination || !additionalData.taxId || !additionalData.receiverTaxId) { - throw new Error("receiverTaxId, pixDestination and taxId parameters must be provided for offramp to BRL"); + if (!additionalData || !additionalData.pixDestination) { + throw new APIError({ + message: "pixDestination is required for offramp to BRL", + status: httpStatus.BAD_REQUEST + }); + } + + const aveniaAccount = await resolveAveniaAccountForUser(userId); + const derivedTaxId = aveniaAccount.taxId; + const derivedReceiverTaxId = normalizeTaxId(additionalData.receiverTaxId || derivedTaxId); + + if (additionalData.taxId && normalizeTaxId(additionalData.taxId) !== derivedTaxId) { + throw new APIError({ + message: "Provided taxId does not match the Avenia profile bound to the authenticated user.", + status: httpStatus.BAD_REQUEST + }); } const subaccount = await this.validateBrlaOfframpRequest( - additionalData.taxId, + derivedTaxId, additionalData.pixDestination, - additionalData.receiverTaxId, + derivedReceiverTaxId, quote.outputAmount ); @@ -1014,10 +1054,11 @@ export class RampService extends BaseRampService { brlaEvmAddress: subaccount.wallets.evm, pixDestination: additionalData.pixDestination, quote, - receiverTaxId: additionalData.receiverTaxId, + receiverTaxId: derivedReceiverTaxId, signingAccounts: normalizedSigningAccounts, - taxId: additionalData.taxId, - userAddress: additionalData.walletAddress + taxId: derivedTaxId, + userAddress: additionalData.walletAddress, + userId }); return { depositQrCode: subaccount.brCode, stateMeta, unsignedTxs }; @@ -1028,12 +1069,18 @@ export class RampService extends BaseRampService { normalizedSigningAccounts: AccountMeta[], additionalData: RegisterRampRequest["additionalData"], transaction: Transaction, - userId?: string + userId: string ): Promise<{ unsignedTxs: UnsignedTx[]; stateMeta: Partial }> { // We refresh the quote. It will be used in the transaction creation process, right after this. if (isAlfredpayToken(quote.outputCurrency as FiatToken) && quote.metadata.alfredpayOfframp) { const toCurrency = quote.outputCurrency as unknown as AlfredpayFiatCurrency; - await this.refreshAlfredpayOfframpQuoteIfMatching(quote, quote.metadata.alfredpayOfframp, toCurrency, transaction); + await this.refreshAlfredpayOfframpQuoteIfMatching( + quote, + quote.metadata.alfredpayOfframp, + toCurrency, + userId, + transaction + ); } const { unsignedTxs, stateMeta } = await prepareOfframpTransactions({ @@ -1054,11 +1101,12 @@ export class RampService extends BaseRampService { quote: QuoteTicket, normalizedSigningAccounts: AccountMeta[], additionalData: RegisterRampRequest["additionalData"], - signingAccounts: AccountMeta[] + signingAccounts: AccountMeta[], + userId: string ): Promise<{ unsignedTxs: UnsignedTx[]; stateMeta: Partial; depositQrCode: string; aveniaTicketId: string }> { - if (!additionalData || additionalData.destinationAddress === undefined || additionalData.taxId === undefined) { + if (!additionalData || !additionalData.destinationAddress) { throw new APIError({ - message: "Parameters destinationAddress and taxId are required for onramp", + message: "Parameter destinationAddress is required for onramp", status: httpStatus.BAD_REQUEST }); } @@ -1071,13 +1119,16 @@ export class RampService extends BaseRampService { }); } - const { brCode, aveniaTicketId } = await this.validateBrlaOnrampRequest(additionalData.taxId, quote, quote.inputAmount); + const aveniaAccount = await resolveAveniaAccountForUser(userId); + const derivedTaxId = aveniaAccount.taxId; + + const { brCode, aveniaTicketId } = await this.validateBrlaOnrampRequest(derivedTaxId, quote, quote.inputAmount); const params: AveniaOnrampTransactionParams = { destinationAddress: additionalData.destinationAddress, quote, signingAccounts: normalizedSigningAccounts, - taxId: additionalData.taxId + taxId: derivedTaxId }; const { unsignedTxs, stateMeta } = await prepareOnrampTransactions(params); @@ -1089,7 +1140,7 @@ export class RampService extends BaseRampService { quote: QuoteTicket, normalizedSigningAccounts: AccountMeta[], additionalData: RegisterRampRequest["additionalData"], - userId?: string + userId: string ): Promise<{ unsignedTxs: UnsignedTx[]; stateMeta: Partial; @@ -1101,13 +1152,7 @@ export class RampService extends BaseRampService { }); } - if (!userId) { - throw new APIError({ - message: - "Alfredpay onramp requires a completed Alfredpay KYC profile. Partner API-key-only registration is not supported for this flow yet because no partner user-to-Alfredpay-customer mapping exists.", - status: httpStatus.UNAUTHORIZED - }); - } + await resolveAlfredpayCustomerId(quote.inputCurrency, userId); const { unsignedTxs, stateMeta } = await prepareOnrampTransactions({ destinationAddress: additionalData.destinationAddress, @@ -1123,7 +1168,7 @@ export class RampService extends BaseRampService { quote: QuoteTicket, normalizedSigningAccounts: AccountMeta[], additionalData: RegisterRampRequest["additionalData"], - userId?: string + userId: string ): Promise<{ unsignedTxs: UnsignedTx[]; stateMeta: Partial; @@ -1179,9 +1224,7 @@ export class RampService extends BaseRampService { reference: intent.transaction.reference }; - if (userId) { - await syncMykoboCustomerKyc(userId, additionalData.email); - } + await syncMykoboCustomerKyc(userId, additionalData.email); return { ibanPaymentData, stateMeta: stateMeta as Partial, unsignedTxs }; } @@ -1192,7 +1235,7 @@ export class RampService extends BaseRampService { additionalData: RegisterRampRequest["additionalData"], signingAccounts: AccountMeta[], transaction: Transaction, - userId?: string + userId: string ): Promise<{ unsignedTxs: UnsignedTx[]; stateMeta: Partial; @@ -1202,7 +1245,7 @@ export class RampService extends BaseRampService { }> { switch (selectRampTransactionPreparationKind(quote, additionalData)) { case RampTransactionPreparationKind.OfframpBrl: - return this.prepareOfframpBrlTransactions(quote, normalizedSigningAccounts, additionalData); + return this.prepareOfframpBrlTransactions(quote, normalizedSigningAccounts, additionalData, userId); case RampTransactionPreparationKind.OfframpNonBrl: return this.prepareOfframpNonBrlTransactions(quote, normalizedSigningAccounts, additionalData, transaction, userId); @@ -1214,7 +1257,7 @@ export class RampService extends BaseRampService { return this.prepareAlfredpayOnrampTransactions(quote, normalizedSigningAccounts, additionalData, userId); case RampTransactionPreparationKind.OnrampAvenia: - return this.prepareAveniaOnrampTransactions(quote, normalizedSigningAccounts, additionalData, signingAccounts); + return this.prepareAveniaOnrampTransactions(quote, normalizedSigningAccounts, additionalData, signingAccounts, userId); } } @@ -1378,6 +1421,7 @@ export class RampService extends BaseRampService { quote, originalAlfredpayMint, fromCurrency, + rampState.userId, transaction ); @@ -1412,11 +1456,14 @@ export class RampService extends BaseRampService { quote: QuoteTicket, originalAlfredpayMint: NonNullable, fromCurrency: AlfredpayFiatCurrency, + userId: string, transaction: Transaction ): Promise { const alfredpayService = AlfredpayApiService.getInstance(); const originalQuoteId = originalAlfredpayMint.quoteId; + const customerId = await resolveAlfredpayCustomerId(fromCurrency, userId); + try { const freshQuote = await alfredpayService.createOnrampQuote({ chain: AlfredpayChain.MATIC, @@ -1424,7 +1471,7 @@ export class RampService extends BaseRampService { fromCurrency, metadata: { businessId: "vortex", - customerId: quote.userId || "unknown" + customerId }, paymentMethodType: AlfredpayPaymentMethodType.BANK, toCurrency: ALFREDPAY_ONCHAIN_CURRENCY @@ -1479,16 +1526,19 @@ export class RampService extends BaseRampService { quote: QuoteTicket, originalAlfredpayOfframp: NonNullable, toCurrency: AlfredpayFiatCurrency, + userId: string, transaction: Transaction ): Promise { const alfredpayService = AlfredpayApiService.getInstance(); const originalQuoteId = originalAlfredpayOfframp.quoteId; + const customerId = await resolveAlfredpayCustomerId(toCurrency, userId); + const freshQuote = await alfredpayService.createOfframpQuote({ chain: AlfredpayChain.MATIC, fromAmount: originalAlfredpayOfframp.inputAmountDecimal.toString(), fromCurrency: ALFREDPAY_ONCHAIN_CURRENCY, - metadata: { businessId: "vortex", customerId: quote.userId || "unknown" }, + metadata: { businessId: "vortex", customerId }, paymentMethodType: AlfredpayPaymentMethodType.BANK, toCurrency } satisfies CreateAlfredpayOfframpQuoteRequest); diff --git a/docs/security-spec/03-ramp-engine/quote-lifecycle.md b/docs/security-spec/03-ramp-engine/quote-lifecycle.md index 5473b1c52..4f1cd3e2b 100644 --- a/docs/security-spec/03-ramp-engine/quote-lifecycle.md +++ b/docs/security-spec/03-ramp-engine/quote-lifecycle.md @@ -70,6 +70,9 @@ The refresh policy is intentionally strict (byte-identical `toAmount` and `fee` 11. **Quote output precision MUST match the final settlement token** — For EVM onramps whose final output comes from Squid, the stored `quote.outputAmount` must retain the destination token's precision, not a fixed source-token precision. This includes BRL/EURC Base→EVM routes and routed Alfredpay USD/MXN/COP/ARS Polygon→EVM routes. Direct same-chain same-token passthrough keeps the minted/source token's precision. 12. **Quote creation MUST honor active maintenance windows server-side** — `POST /v1/quotes` and `POST /v1/quotes/best` must reject during active maintenance before quote calculation/persistence, including enough downtime metadata for direct API clients to retry after the window. 13. **Quote ownership MUST stay separate from pricing attribution** — Profile-assigned quotes MUST remain user-owned (`user_id = req.userId`, `partner_id = NULL`) while storing the applied partner pricing row in `pricing_partner_id`. +14. **Provider-backed quote creation MUST NOT call upstream providers with placeholder user identity** — Alfredpay and Avenia/BRL corridors must not create upstream provider quotes with `customerId: "unknown"`. Quote-time engines short-circuit the Alfredpay call when no effective user is present, populate `ctx.alfredpayMint` / `ctx.alfredpayOfframp` with oracle-rate-based estimates and a sentinel `quoteId` (`ANONYMOUS_ALFREDPAY_QUOTE_ID`), and surface the estimate to the caller. The fresh Alfredpay quote is then created and persisted at register time once the user is authenticated, so the final ramp state always carries a real provider `quoteId`. Crypto-only/internal corridors remain anonymous. **Register/start remains blocked for all corridors** (not just provider-backed) without an effective user via the universal `RampService.registerRamp` check. +15. **Provider-backed ramp registration MUST derive the sender's tax ID / Alfredpay customer from the effective user, not from request body** — BRL/Avenia tax ID and Alfredpay `alfredPayId` are resolved server-side via `api_keys.user_id -> tax_ids.user_id` and `api_keys.user_id -> alfredpay_customers.user_id` respectively. Client-supplied `additionalData.taxId` is accepted only for backward compatibility and MUST match the derived sender value or the request is rejected with `400`. The `receiverTaxId` (where it differs from the sender — e.g. third-party PIX recipient) is supplied by the client and is allowed to differ from the derived sender tax ID; it is validated downstream against the PIX key owner by `validateBrlaOfframpRequest` / `validateMaskedNumber`. The `RampService.registerRamp` quote/user consistency check ensures the caller cannot register a provider-backed quote using a different user context. +16. **Quote registration MUST use the same principal at quote and register time** — An anonymous quote (one with `quote.userId = null`, produced by the short-circuit path in inv. 14) cannot be claimed by an authenticated caller. `RampService.registerRamp` rejects with `403` when `quote.userId == null && request.userId != null`. The register principal must obtain a new quote with their identity (Supabase session or linked secret API key) so `quote.userId` is bound at quote time. Combined with the universal userId requirement (inv. 14), anonymous quotes are effectively unregistrable for all corridors. ## Threat Vectors & Mitigations @@ -82,7 +85,7 @@ The refresh policy is intentionally strict (byte-identical `toAmount` and `fee` | **Dynamic pricing farming** | Attacker rapidly requests quotes without consuming them to push `difference` toward `maxDynamicDifference`, then consumes at the best possible rate | Each quote request within the timeout window does NOT change the difference — only quotes **after** the timeout increase it. So the attacker would need to wait `discountStateTimeoutMinutes` between each step increase. With default `deltaD = 0.00003` and a 10-minute timeout, farming is slow. However, the `maxDynamicDifference` cap is the hard limit. | | **⚠️ In-memory state loss** | Server restart resets all partner discount states to `difference = 0`. Partners lose their accumulated rate adjustments. | **NO MITIGATION.** State is in-memory only. After restart, all partners start fresh. This could cause abrupt rate changes if a partner had a significant accumulated difference. | | **Subsidization abuse** | Attacker creates quotes during high volatility, forcing the platform to cover large subsidization amounts | Quote-time discount subsidy is capped by `maxSubsidy` per partner; EVM runtime top-ups are separately bounded by the pre/post-swap cap fractions; dynamic pricing adjusts rates over time; `maxDynamicDifference` bounds the maximum rate improvement | -| **Unauthorized quote consumption** | Attacker binds someone else's quote to their own ramp | Quotes carrying an owner (`partner_id` or `user_id`) are bound to that owner; ownership is verified at ramp registration via `assertQuoteOwnership`. `pricing_partner_id` is not an ownership credential. Fully-anonymous quotes (no `partner_id` and no `user_id`) are intentionally consumable by any caller — they cannot leak privileged data because they were created without a principal in the first place. | +| **Unauthorized quote consumption** | Attacker binds someone else's quote to their own ramp | Quotes carrying an owner (`partner_id` or `user_id`) are bound to that owner; ownership is verified at ramp registration via `assertQuoteOwnership`. `pricing_partner_id` is not an ownership credential. `RampService.registerRamp` requires an effective user for **all** corridors and rejects anonymous quotes from being claimed by an authenticated caller (inv. 16), so an attacker cannot bind an anonymous quote to a user who did not create it. Fully-anonymous quotes (no `partner_id` and no `user_id`) are effectively unregistrable. | | **Pricing partner treated as owner** | A profile-assigned user receives partner pricing, then tries to access partner-owned quotes or ramps. | Profile assignments populate `pricing_partner_id` only; `partner_id` stays `NULL`, so ownership guards continue to authorize through the Supabase `user_id` path. | | **Negative `minDynamicDifference`** | If `minDynamicDifference` is set to a large negative value in the partner DB record, consuming quotes could push the rate below the base `targetDiscount`, potentially making the effective discount negative (user receives less than the oracle rate) | DB constraint: `minDynamicDifference` defaults to `0`. However, there is no DB-level CHECK constraint preventing negative values. If set manually, the clamping logic would allow `difference` to go negative. | | **Concurrent quote and consumption** | Two simultaneous requests — one quoting, one consuming — for the same partner could read stale `difference` values from the in-memory Map | JavaScript's single-threaded event loop prevents true concurrency for synchronous Map operations. However, the `async` functions in `compute()` could interleave if there are `await` points between reading and writing the Map. In practice, the read and write of `partnerDiscountState` in `getAdjustedDifference` are synchronous, so this is safe within a single process. | @@ -104,7 +107,7 @@ The refresh policy is intentionally strict (byte-identical `toAmount` and `fee` - [x] Quote response does not include internal implementation details (e.g., the `adjustedDifference` or `adjustedTargetDiscount` values). **PASS** — verified: response includes only user-facing fields (amounts, fees, expiry). - [x] Quote amounts (input, output, fees) are immutable once stored — no UPDATE endpoint modifies them. **PASS** — no quote mutation endpoints exist. - [x] EVM onramp output precision follows destination token decimals where the quote output comes from Squid. **PASS** — BRL/EURC Base→EVM and routed Alfredpay USD/MXN/COP/ARS Polygon→EVM finalization preserve destination token precision before downstream raw transfer construction. Direct same-chain same-token passthrough remains at minted/source-token precision. -- [PARTIAL] Authentication is enforced on quote creation (verify which auth mechanisms protect `POST /v1/ramp/quotes`). **PARTIAL** — quote creation is accessible via API key auth or Supabase auth; the endpoint is optional-auth by design (public quotes allowed for some partners). +- [PARTIAL] Authentication is enforced on quote creation (verify which auth mechanisms protect `POST /v1/ramp/quotes`). **PARTIAL** — quote creation is accessible via API key auth or Supabase auth; the endpoint is optional-auth by design (public quotes allowed for all corridors including Alfredpay/BRL; register/start require an effective user for all corridors). - [PARTIAL] Quote ownership is verified at ramp registration — the user/partner creating the ramp must match the quote creator. **PARTIAL** — no strict user-to-quote binding; mitigated by UUID unpredictability and 10-minute expiry. - [x] Profile-assigned quote pricing persists `pricing_partner_id` without granting partner ownership. **PASS** — profile-assigned quotes store `user_id`, leave `partner_id` `NULL`, and authorize through the user ownership path. - [x] Subsidy is only calculated when `targetDiscount > 0` — partners with no discount get `0` subsidy regardless of shortfall. **PASS** — verified in `calculateSubsidyAmount()`. diff --git a/docs/security-spec/05-integrations/alfredpay.md b/docs/security-spec/05-integrations/alfredpay.md index 3aeb7ae0c..8af4207ac 100644 --- a/docs/security-spec/05-integrations/alfredpay.md +++ b/docs/security-spec/05-integrations/alfredpay.md @@ -53,6 +53,7 @@ For routed Alfredpay onramps (any non-passthrough output), the final quote outpu 14. **`finalSettlementSubsidy` MUST NOT be skipped for Alfredpay offramps** — The `FinalSettlementSubsidyHandler` direct-transfer skip explicitly excludes `SELL && isAlfredpayToken(outputCurrency)`. This ensures the ephemeral on Polygon is always topped up to the expected amount before `alfredpayOfframpTransfer`, preventing under-funded settlements. 15. **Routed Alfredpay onramp quote output precision MUST match the destination token** — For Alfredpay USD/MXN/COP/ARS onramps that route through Squid, `quote.outputAmount` MUST preserve the final destination token's decimal precision, and `evmToEvm.outputAmountRaw` MUST represent the destination token's raw units. The Polygon-minted Alfredpay token is only the Squid source-side input. Direct Polygon same-token passthrough remains at the minted token's 6-decimal precision. 16. **Alfredpay ramp registration MUST bind to a completed KYC/KYB customer** — Registration MUST reject Alfredpay onramps before customer lookup when no completed Alfredpay customer context is available, and MUST reject customer records whose Alfredpay status is not `Success`. This prevents ramps from reaching provider/customer queries with undefined `user_id` and ensures payment instructions are only issued for verified Alfredpay customers. SDK/server integrations authenticate with partner API keys (`pk_*`/`sk_*`); Supabase Bearer tokens are frontend/user-session auth. +17. **Alfredpay quote creation and ramp registration MUST derive the customer id from the effective user, not `req.userId || "unknown"`** — The on-ramp initialize engine, the off-ramp partner engine, the off-ramp transaction route, and the off-ramp transfer recovery path all resolve `alfredPayId` via `resolveAlfredpayCustomerId(fiatCurrency, effectiveUserId)`. Public keys and unlinked secret keys cannot register Alfredpay ramps; the ramp-register user-consistency check rejects them with `400 Invalid quote` before any upstream provider call. **Anonymous quote creation is allowed for fully unauthenticated callers** (no Supabase session and no API key): when `getEffectiveUserId(req)` is empty the Alfredpay engines skip the upstream call, populate `ctx.alfredpayMint` / `ctx.alfredpayOfframp` with an oracle-rate-based estimate and the sentinel `quoteId` (`ANONYMOUS_ALFREDPAY_QUOTE_ID`), and surface the estimate to the caller. **An anonymous Alfredpay quote cannot be registered by an authenticated caller** — `RampService.registerRamp` rejects with `403 This anonymous provider-backed quote cannot be registered by an authenticated caller. Re-quote with the same principal to bind ownership.` when `quote.userId == null && request.userId != null`. The register principal must obtain a new quote with their identity (Supabase session or linked secret API key) so `quote.userId` is bound at quote time. The `persistFreshAlfredpayOnrampQuote` / `persistFreshAlfredpayOfframpQuote` helpers exist as a defensive measure for the (now unreachable) anonymous-placeholder branch; under the new gate, every registered ramp carries a real provider `quoteId` and `customerId`. ## Threat Vectors & Mitigations @@ -71,7 +72,8 @@ For routed Alfredpay onramps (any non-passthrough output), the final quote outpu | **Polygon passthrough rounding** | Same-chain same-token shortcut rounds the bridge output incorrectly, leaking dust or under-funding the destination | `toFixed(0, 0)` round-down in the squid-router finalize; downstream subsidy ensures the destination receives the quoted amount | | **Polygon wrong-token delivery** | A user on-ramps via Alfredpay and requests a non-USDT Polygon output (e.g. USDC); the handler skips the swap on destination-network alone and transfers the minted USDT, delivering the wrong asset | The `squidRouterSwap` short-circuit is gated on `quote.outputCurrency === ALFREDPAY_EVM_TOKEN` (not just `quote.metadata.request.to === Networks.Polygon`); non-USDT Polygon outputs run the real USDT→output swap. Matched in the quote engine's `skipRouteCalculation` branch. | | **Routed destination precision loss** | A USD/MXN/COP/ARS Alfredpay onramp mints a 6-decimal Polygon source token, routes to an 18-decimal destination token, and stores the final quote output with source precision. The final amount is truncated before destination-transfer expectations are calculated. | Finalize routed Alfredpay EVM quotes with the destination token's decimals when `evmToEvm` metadata exists; keep direct Polygon same-token passthrough at minted-token precision. | -| **Anonymous Alfredpay registration** | An SDK caller registers an Alfredpay onramp without a completed KYC customer context, causing undefined `user_id` customer lookups or issuing instructions without KYC context | Alfredpay onramp registration fails with a public auth/KYC error unless a `Success` Alfredpay customer record is available. SDK/server callers authenticate with partner API keys. | +| **Anonymous Alfredpay registration** | An SDK caller registers an Alfredpay onramp without a completed KYC customer context, causing undefined `user_id` customer lookups or issuing instructions without KYC context | Alfredpay onramp registration fails with a public auth/KYC error unless a `Success` Alfredpay customer record is available. SDK/server callers authenticate with partner API keys. Anonymous quote creation is intentionally allowed and returns an estimate; the real Alfredpay quote is only created at register time. An anonymous Alfredpay quote cannot be claimed by an authenticated caller — `RampService.registerRamp` rejects with `403` so an unauthenticated estimate cannot be bound to an unrelated user. | +| **Claiming an anonymous Alfredpay estimate at register time** | Attacker mints an anonymous Alfredpay quote, then presents a Supabase token (or a different user's linked secret API key) at register time to bind the resulting real Alfredpay quote to themselves | `RampService.registerRamp` rejects with `403` when `isProviderBackedRampKind(quote) && quote.userId == null && request.userId != null` (inv. 17). The register principal must re-quote with their identity so `quote.userId` is bound at quote time. | ## Audit Checklist diff --git a/docs/security-spec/05-integrations/brla.md b/docs/security-spec/05-integrations/brla.md index 991c2de9d..a8e64bc59 100644 --- a/docs/security-spec/05-integrations/brla.md +++ b/docs/security-spec/05-integrations/brla.md @@ -75,6 +75,10 @@ The invariant `transferAmount ≥ payoutAmount` must hold (transfer covers payou 13. **BRL↔AssetHub MUST stay disabled while the Base BRL rail is active-only** — The quote engine should return no quote for BRL→AssetHub or AssetHub→BRL, preventing users from registering legacy Moonbeam/Pendulum BRL routes. 14. **The BRL→BRLA-on-Base on-ramp MUST take the direct-transfer bypass** — When `inputCurrency === BRL`, `outputCurrency === BRLA`, and `network === Base`, `isBrlToBrlaBaseDirect` MUST short-circuit the route to a single `destinationTransfer` from the ephemeral to the user, with `stateMeta.isDirectTransfer = true`. The Nabla swap, `distributeFees`, SquidRouter, `finalSettlementSubsidy`, and Base cleanup phases MUST NOT run — routing BRLA through USDC and back would burn double-swap slippage/fees against the user and expose the over-subsidy race (`06-cross-chain/fund-routing.md`). The `squidRouterSwap` and `finalSettlementSubsidy` handlers MUST also honor `isDirectTransfer`/`isBrlToBrlaBaseDirect` defensively and skip to `destinationTransfer` if reached. 15. **BRL→EVM quote output precision MUST match the destination token** — For supported EVM destinations, `quote.outputAmount` MUST preserve the destination token's decimal precision, and `evmToEvm.outputAmountRaw` MUST represent the destination token's raw units. The Squid bridge input remains Base USDC raw (`evmToEvm.inputAmountRaw`), but final delivery uses destination-token decimals. +16. **BRL register paths MUST derive tax ID / subaccount from the effective user** — `RampService.prepareOfframpBrlTransactions` and `RampService.prepareAveniaOnrampTransactions` resolve the Avenia account via `resolveAveniaAccountForUser(userId)` and call `validateBrlaOnrampRequest(derivedTaxId, ...)` / `validateBrlaOfframpRequest(derivedTaxId, ...)`. Client-supplied `additionalData.taxId` and `additionalData.receiverTaxId` are accepted only when they match the derived value; mismatches return `400`. +17. **`/v1/brla/getUser` and `/v1/brla/getUserRemainingLimit` MUST scope reads to the effective user** — When a `taxId` query is provided, the `TaxId` row MUST be owned by `getEffectiveUserId(req)`. When `taxId` is omitted, the endpoint derives the user's Avenia account via the resolver and returns `400` for zero or multiple KYC-completed matches. The legacy partner-key exemption that allowed reading any taxId has been removed; bare partner keys (no `api_keys.user_id` binding) and fully anonymous callers are rejected with `400`. +18. **`/v1/brla/createSubaccount` MUST require an authenticated principal** — The route now uses `requirePartnerOrUserAuth()` and the controller requires an effective user. Bare partner keys and anonymous callers receive `400`; the Avenia API is not called and no `TaxId` row is created. This closes the anonymous subaccount creation DoS surface. +19. **BRL quote creation MUST remain anonymous-eligible while register/start remain user-gated** — `POST /v1/quotes` and `POST /v1/quotes/best` accept BRL corridors from anonymous callers and partner-key callers (with or without a `userId` binding). The Avenia `createPayInQuote` calls used by the BRL engines do not require a user-bound principal. The actual Avenia subaccount/taxId resolution still happens server-side at register time via `resolveAveniaAccountForUser(effectiveUserId)`, and `RampService.registerRamp` rejects provider-backed ramps without an effective user with `400 Invalid quote`. **An anonymous BRL quote cannot be registered by an authenticated caller** — `RampService.registerRamp` rejects with `403` when `isProviderBackedRampKind(quote) && quote.userId == null && request.userId != null` (the same gate that covers Alfredpay), so an unauthenticated BRL estimate cannot be claimed by an unrelated user. ## Threat Vectors & Mitigations @@ -91,6 +95,8 @@ The invariant `transferAmount ≥ payoutAmount` must hold (transfer covers payou | **Underdelivery from Nabla** | Nabla swap returns less BRLA than quoted, balance poll times out, ramp stuck | Balance-poll timeout (5min) fails the phase as recoverable; `subsidizePostSwap` (EVM branch) tops up eligible shortfalls subject to the env-configured split quote-relative EVM subsidy caps documented in `fund-routing.md`. The actual-vs-quoted swap discrepancy uses `MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION`; the discount component uses `MAX_EVM_POST_SWAP_DISCOUNT_SUBSIDY_QUOTE_FRACTION`. Both default to `0.05`. | | **Disabled AssetHub corridor accidentally re-enabled** | Legacy BRL↔AssetHub route files are selected and a user registers a route that the Base BRL rail no longer supports | Quote eligibility must return no quote for BRL→AssetHub and AssetHub→BRL. Treat any successful quote for those corridors as a regression until the corridor is intentionally re-enabled. | | **BRL→BRLA-Base self-swap drain** | The generic pipeline swaps the user's already-minted BRLA to USDC and back, charging two swaps of slippage/fees and triggering `finalSettlementSubsidy` against bridge-less dust (over-subsidy + strand) | `isBrlToBrlaBaseDirect` collapses the corridor to a single `destinationTransfer` with `isDirectTransfer = true`; Nabla/distributeFees/Squid/finalSettlementSubsidy/cleanup are skipped at both route-build and handler level. | +| **Anonymous BRL register on someone else's subaccount** | An anonymous SDK caller (no Supabase session, no linked secret key) uses an anonymous BRL quote to register a ramp on top of another user's Avenia subaccount via the quoteId guess | `RampService.registerRamp` rejects provider-backed ramps without an effective user with `400 Invalid quote`; an attacker cannot bind a BRL ramp to a subaccount they do not own. | +| **Claiming an anonymous BRL estimate at register time** | Attacker mints an anonymous BRL quote, then presents a Supabase token (or a different user's linked secret API key) at register time to bind the resulting ramp to a different user's `TaxId` | `RampService.registerRamp` rejects with `403` when `isProviderBackedRampKind(quote) && quote.userId == null && request.userId != null` (inv. 19). The register principal must re-quote with their identity so `quote.userId` is bound at quote time. | | **Destination-token decimal under-delivery** | A BRL on-ramp targets an 18-decimal token such as BSC USDT, but the quote output is truncated to 6 decimals before `destinationTransfer` raw amount construction. | On-ramp finalization uses destination-token decimals for BRL EVM outputs; Squid metadata preserves destination raw output from `route.estimate.toAmount`. | ## Audit Checklist diff --git a/docs/security-spec/07-operations/api-surface.md b/docs/security-spec/07-operations/api-surface.md index 7f2667b9d..f9cbadc85 100644 --- a/docs/security-spec/07-operations/api-surface.md +++ b/docs/security-spec/07-operations/api-surface.md @@ -48,6 +48,7 @@ This spec covers the external-facing attack surface of the Vortex API (`apps/api 10. **Request IDs MUST be correlation-only** — Request IDs may be accepted from clients or generated by the API, but they must not grant access, alter authorization, or be treated as trusted identity. 11. **API observability MUST NOT change request outcomes** — Client event persistence/logging must be best-effort and must not change controller response bodies, status codes, or ramp/quote state. 12. **Maintenance windows MUST be backend-enforced on mutable ramp entrypoints** — `POST /v1/quotes`, `POST /v1/quotes/best`, `POST /v1/ramp/register`, `POST /v1/ramp/update`, and `POST /v1/ramp/start` must reject during active maintenance with `503`, `Retry-After`, and explicit downtime start/end metadata. UI disabling is not sufficient because partners may call the API directly. +13. **Provider-backed ramp endpoints MUST reject callers without an effective user, and provider-backed quotes MUST use the same principal at quote and register time** — Alfredpay and Avenia/BRL flows derive their provider customer/subaccount from `api_keys.user_id -> profiles.id -> alfredpay_customers.user_id` / `tax_ids.user_id`. Quote creation is anonymous-eligible (Alfredpay engines short-circuit on no effective user and store `ANONYMOUS_ALFREDPAY_QUOTE_ID`; Avenia engines call upstream providers regardless of identity). Ramp registration runs two gates before any provider call: (a) the provider-backed kind check rejects callers without an effective user with `400 Invalid quote`, and (b) the same-principal check rejects anonymous provider-backed quotes being claimed by an authenticated caller with `403 This anonymous provider-backed quote cannot be registered by an authenticated caller. Re-quote with the same principal to bind ownership.`. Unlinked secret keys and fully anonymous callers are blocked at register time; callers wishing to register a previously-anonymous provider-backed quote must re-quote with their identity. ## Threat Vectors & Mitigations diff --git a/packages/sdk/src/types.ts b/packages/sdk/src/types.ts index b6ee99cf8..5d18a8523 100644 --- a/packages/sdk/src/types.ts +++ b/packages/sdk/src/types.ts @@ -123,12 +123,6 @@ export interface AlfredpayOnrampAdditionalData { export interface BrlOfframpAdditionalData { pixDestination: string; walletAddress: string; - /** - * @deprecated The BRL subaccount is now derived server-side from - * `api_keys.user_id -> tax_ids.user_id`. The SDK still accepts the field - * for one release of backward compatibility, but the server rejects - * mismatches against the derived taxId. - */ receiverTaxId?: string; /** * @deprecated The BRL subaccount is now derived server-side from diff --git a/packages/shared/src/endpoints/ramp.endpoints.ts b/packages/shared/src/endpoints/ramp.endpoints.ts index 5ea803a85..8394fae52 100644 --- a/packages/shared/src/endpoints/ramp.endpoints.ts +++ b/packages/shared/src/endpoints/ramp.endpoints.ts @@ -179,12 +179,6 @@ export interface RegisterRampRequest { destinationAddress?: string; paymentData?: PaymentData; pixDestination?: string; - /** - * @deprecated Derived server-side from `api_keys.user_id -> tax_ids.user_id` - * for linked secret-key callers and Supabase-authenticated callers. The - * server accepts a value for one release of backward compatibility, but - * mismatches against the derived taxId are rejected. - */ receiverTaxId?: string; /** * @deprecated Derived server-side from `api_keys.user_id -> tax_ids.user_id` From 9c1e56ea300ebe994359b9c6204fc58f6c89ae82 Mon Sep 17 00:00:00 2001 From: Gianfranco Date: Thu, 25 Jun 2026 13:19:38 -0300 Subject: [PATCH 037/176] modify mykobo register unit tests --- .../services/phases/mykobo-eur-offramp.integration.test.ts | 4 +++- .../api/services/phases/mykobo-eur-onramp.integration.test.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts b/apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts index ad97c5de7..d31c3db2f 100644 --- a/apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts +++ b/apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts @@ -63,6 +63,7 @@ const EVM_DESTINATION_ADDRESS = "0x7ba99e99bc669b3508aff9cc0a898e869459f877"; const TEST_INPUT_AMOUNT = "35"; const TEST_EMAIL = "mail@test.com"; const TEST_IP_ADDRESS = "203.0.113.42"; +const TEST_USER_ID = "00000000-0000-0000-0000-000000000001"; const filePath = path.join(__dirname, "lastRampStateMykoboEur.json"); const EVM_ADDRESS_REGEX = /^0x[a-fA-F0-9]{40}$/; @@ -291,7 +292,8 @@ describe("Mykobo EUR offramp contract test (real sandbox, no on-chain submission const registered = await rampService.registerRamp({ additionalData, quoteId: quote.id, - signingAccounts: testSigningAccountsMeta + signingAccounts: testSigningAccountsMeta, + userId: TEST_USER_ID }); if (!registered.unsignedTxs) { diff --git a/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts b/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts index ccfa475bb..2bd58ec83 100644 --- a/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts +++ b/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts @@ -64,6 +64,7 @@ const EVM_DESTINATION_ADDRESS = "0x7ba99e99bc669b3508aff9cc0a898e869459f877"; const TEST_INPUT_AMOUNT = "35"; const TEST_EMAIL = "mail@test.com"; const TEST_IP_ADDRESS = "203.0.113.42"; +const TEST_USER_ID = "00000000-0000-0000-0000-000000000001"; const filePath = path.join(__dirname, "lastRampStateMykoboEurOnramp.json"); const IBAN_REGEX = /^[A-Z]{2}[0-9A-Z]{2}[0-9A-Z]{4,30}$/; @@ -292,7 +293,8 @@ describe("Mykobo EUR onramp contract test (real sandbox, no on-chain submission) const registered = await rampService.registerRamp({ additionalData, quoteId: quote.id, - signingAccounts: testSigningAccountsMeta + signingAccounts: testSigningAccountsMeta, + userId: TEST_USER_ID }); if (!registered.unsignedTxs) { From fd042deae7b248f1fa8bd32bbfca4f9a2dc2d50c Mon Sep 17 00:00:00 2001 From: Gianfranco Date: Thu, 25 Jun 2026 15:43:55 -0300 Subject: [PATCH 038/176] add api-key endpoints for users --- .../api/controllers/userApiKeys.controller.ts | 214 ++++++++++++++++++ .../middlewares/apiKeyAuth.helpers.test.ts | 117 ++++++++++ .../src/api/middlewares/apiKeyAuth.helpers.ts | 73 ++++-- apps/api/src/api/middlewares/apiKeyAuth.ts | 22 +- apps/api/src/api/middlewares/dualAuth.ts | 10 +- apps/api/src/api/middlewares/publicKeyAuth.ts | 8 +- apps/api/src/api/routes/v1/api-keys.route.ts | 27 +++ apps/api/src/api/routes/v1/index.ts | 11 + .../035-make-api-key-partner-name-nullable.ts | 17 ++ apps/api/src/models/apiKey.model.ts | 8 +- docs/security-spec/01-auth/api-keys.md | 29 ++- 11 files changed, 489 insertions(+), 47 deletions(-) create mode 100644 apps/api/src/api/controllers/userApiKeys.controller.ts create mode 100644 apps/api/src/api/middlewares/apiKeyAuth.helpers.test.ts create mode 100644 apps/api/src/api/routes/v1/api-keys.route.ts create mode 100644 apps/api/src/database/migrations/035-make-api-key-partner-name-nullable.ts diff --git a/apps/api/src/api/controllers/userApiKeys.controller.ts b/apps/api/src/api/controllers/userApiKeys.controller.ts new file mode 100644 index 000000000..8a5c3d535 --- /dev/null +++ b/apps/api/src/api/controllers/userApiKeys.controller.ts @@ -0,0 +1,214 @@ +import { Request, Response } from "express"; +import httpStatus from "http-status"; +import logger from "../../config/logger"; +import { config } from "../../config/vars"; +import ApiKey from "../../models/apiKey.model"; +import { generateApiKey, getKeyPrefix, hashApiKey } from "../middlewares/apiKeyAuth.helpers"; + +interface CreateApiKeyBody { + expiresAt?: string; + name?: string; +} + +export async function createUserApiKey(req: Request, res: Response): Promise { + const userId = req.userId; + if (!userId) { + res.status(httpStatus.UNAUTHORIZED).json({ + error: { + code: "AUTHENTICATION_REQUIRED", + message: "Authentication required to create API keys", + status: httpStatus.UNAUTHORIZED + } + }); + return; + } + + const { name, expiresAt } = (req.body ?? {}) as CreateApiKeyBody; + + try { + const environment = config.sandboxEnabled ? "test" : "live"; + + const publicKey = generateApiKey("public", environment); + const publicKeyPrefix = getKeyPrefix(publicKey); + + const secretKey = generateApiKey("secret", environment); + const secretKeyHash = await hashApiKey(secretKey); + const secretKeyPrefix = getKeyPrefix(secretKey); + + const expirationDate = expiresAt ? new Date(expiresAt) : new Date(Date.now() + 365 * 24 * 60 * 60 * 1000); // Default to 1 year from now + + if (expiresAt && Number.isNaN(expirationDate.getTime())) { + res.status(httpStatus.BAD_REQUEST).json({ + error: { + code: "INVALID_EXPIRES_AT", + message: "expiresAt must be a valid ISO-8601 date", + status: httpStatus.BAD_REQUEST + } + }); + return; + } + + const publicKeyRecord = await ApiKey.create({ + expiresAt: expirationDate, + isActive: true, + keyHash: null, + keyPrefix: publicKeyPrefix, + keyType: "public", + keyValue: publicKey, + name: name ? `${name} (Public)` : "Public Key", + partnerName: null, + userId + }); + + const secretKeyRecord = await ApiKey.create({ + expiresAt: expirationDate, + isActive: true, + keyHash: secretKeyHash, + keyPrefix: secretKeyPrefix, + keyType: "secret", + keyValue: null, + name: name ? `${name} (Secret)` : "Secret Key", + partnerName: null, + userId + }); + + res.status(httpStatus.CREATED).json({ + createdAt: publicKeyRecord.createdAt, + expiresAt: expirationDate, + isActive: true, + publicKey: { + id: publicKeyRecord.id, + key: publicKey, + keyPrefix: publicKeyRecord.keyPrefix, + name: publicKeyRecord.name, + type: "public" + }, + secretKey: { + id: secretKeyRecord.id, + key: secretKey, + keyPrefix: secretKeyRecord.keyPrefix, + name: secretKeyRecord.name, + type: "secret" + } + }); + } catch (error) { + logger.error("Error creating user API keys:", error); + res.status(httpStatus.INTERNAL_SERVER_ERROR).json({ + error: { + code: "INTERNAL_SERVER_ERROR", + message: "Failed to create API keys", + status: httpStatus.INTERNAL_SERVER_ERROR + } + }); + } +} + +export async function listUserApiKeys(req: Request, res: Response): Promise { + const userId = req.userId; + if (!userId) { + res.status(httpStatus.UNAUTHORIZED).json({ + error: { + code: "AUTHENTICATION_REQUIRED", + message: "Authentication required to list API keys", + status: httpStatus.UNAUTHORIZED + } + }); + return; + } + + try { + const apiKeys = await ApiKey.findAll({ + attributes: [ + "id", + "keyType", + "keyPrefix", + "keyValue", + "name", + "lastUsedAt", + "expiresAt", + "isActive", + "createdAt", + "updatedAt" + ], + order: [["createdAt", "DESC"]], + where: { isActive: true, userId } + }); + + res.status(httpStatus.OK).json({ + apiKeys: apiKeys.map(key => ({ + createdAt: key.createdAt, + expiresAt: key.expiresAt, + id: key.id, + isActive: key.isActive, + key: key.keyType === "public" ? key.keyValue : undefined, + keyPrefix: key.keyPrefix, + lastUsedAt: key.lastUsedAt, + name: key.name, + type: key.keyType, + updatedAt: key.updatedAt + })) + }); + } catch (error) { + logger.error("Error listing user API keys:", error); + res.status(httpStatus.INTERNAL_SERVER_ERROR).json({ + error: { + code: "INTERNAL_SERVER_ERROR", + message: "Failed to list API keys", + status: httpStatus.INTERNAL_SERVER_ERROR + } + }); + } +} + +export async function revokeUserApiKey(req: Request<{ keyId: string }>, res: Response): Promise { + const userId = req.userId; + if (!userId) { + res.status(httpStatus.UNAUTHORIZED).json({ + error: { + code: "AUTHENTICATION_REQUIRED", + message: "Authentication required to revoke API keys", + status: httpStatus.UNAUTHORIZED + } + }); + return; + } + + const keyId = req.params.keyId; + if (!keyId) { + res.status(httpStatus.BAD_REQUEST).json({ + error: { + code: "KEY_ID_REQUIRED", + message: "keyId path parameter is required", + status: httpStatus.BAD_REQUEST + } + }); + return; + } + + try { + const apiKey = await ApiKey.findOne({ where: { id: keyId, isActive: true, userId } }); + + if (!apiKey) { + res.status(httpStatus.NOT_FOUND).json({ + error: { + code: "API_KEY_NOT_FOUND", + message: "API key not found or not owned by the authenticated user", + status: httpStatus.NOT_FOUND + } + }); + return; + } + + await apiKey.update({ isActive: false }); + res.status(httpStatus.NO_CONTENT).send(); + } catch (error) { + logger.error("Error revoking user API key:", error); + res.status(httpStatus.INTERNAL_SERVER_ERROR).json({ + error: { + code: "INTERNAL_SERVER_ERROR", + message: "Failed to revoke API key", + status: httpStatus.INTERNAL_SERVER_ERROR + } + }); + } +} diff --git a/apps/api/src/api/middlewares/apiKeyAuth.helpers.test.ts b/apps/api/src/api/middlewares/apiKeyAuth.helpers.test.ts new file mode 100644 index 000000000..65273ca4f --- /dev/null +++ b/apps/api/src/api/middlewares/apiKeyAuth.helpers.test.ts @@ -0,0 +1,117 @@ +import {afterEach, describe, expect, it, mock} from "bun:test"; +import bcrypt from "bcrypt"; +import crypto from "crypto"; +import Partner from "../../models/partner.model"; +import ApiKey from "../../models/apiKey.model"; +import { + AuthenticatedPartner, + generateApiKey, + getKeyPrefix, + hashApiKey, + validateSecretApiKey +} from "./apiKeyAuth.helpers"; + +const originalApiKeyFindAll = ApiKey.findAll; +const originalApiKeyFindOne = ApiKey.findOne; +const originalPartnerFindOne = Partner.findOne; + +function createSecretKeyRecord({ + userId = null, + partnerName = "TestPartner" +}: { userId?: string | null; partnerName?: string | null } = {}): ApiKey & { raw: string } { + const secret = generateApiKey("secret", "test"); + const secretHash = bcrypt.hashSync(secret, 4); + return Object.assign(new ApiKey(), { + id: crypto.randomUUID(), + isActive: true, + keyHash: secretHash, + keyPrefix: getKeyPrefix(secret), + keyType: "secret" as const, + partnerName, + raw: secret, + userId + }); +} + +describe("validateSecretApiKey - apiKeyUserId propagation", () => { + afterEach(() => { + ApiKey.findAll = originalApiKeyFindAll; + ApiKey.findOne = originalApiKeyFindOne; + Partner.findOne = originalPartnerFindOne; + }); + + it("returns apiKeyId and apiKeyUserId with a partner for partner-scoped keys", async () => { + const key = createSecretKeyRecord({userId: "user-bound", partnerName: "TestPartner"}); + ApiKey.findAll = mock( + async () => [key as unknown as ApiKey] + ) as typeof ApiKey.findAll; + Partner.findOne = mock( + async () => ({id: "partner-id", isActive: true, name: "TestPartner"}) + ) as typeof Partner.findOne; + + const result = await validateSecretApiKey(key.raw); + expect(result).not.toBeNull(); + expect(result?.apiKeyId).toBe(key.id); + expect(result?.apiKeyUserId).toBe("user-bound"); + expect(result?.partner).not.toBeNull(); + expect((result?.partner as AuthenticatedPartner).name).toBe("TestPartner"); + expect((result?.partner as AuthenticatedPartner).id).toBe("partner-id"); + }); + + it("returns apiKeyUserId = null for an unlinked partner-scoped key", async () => { + const key = createSecretKeyRecord({userId: null, partnerName: "TestPartner"}); + ApiKey.findAll = mock( + async () => [key as unknown as ApiKey] + ) as typeof ApiKey.findAll; + Partner.findOne = mock( + async () => ({id: "partner-id", isActive: true, name: "TestPartner"}) + ) as typeof Partner.findOne; + + const result = await validateSecretApiKey(key.raw); + expect(result).not.toBeNull(); + expect(result?.apiKeyUserId).toBeNull(); + expect(result?.partner).not.toBeNull(); + }); + + it("returns partner=null for a user-scoped key (no partnerName, userId set)", async () => { + const key = createSecretKeyRecord({userId: "user-scoped", partnerName: null}); + ApiKey.findAll = mock( + async () => [key as unknown as ApiKey] + ) as typeof ApiKey.findAll; + Partner.findOne = mock( + async () => ({id: "partner-id", isActive: true, name: "TestPartner"}) + ) as typeof Partner.findOne; + + const result = await validateSecretApiKey(key.raw); + expect(result).not.toBeNull(); + expect(result?.apiKeyId).toBe(key.id); + expect(result?.apiKeyUserId).toBe("user-scoped"); + expect(result?.partner).toBeNull(); + expect(Partner.findOne).toHaveBeenCalledTimes(0); + }); + + it("returns null for a key with no partnerName and no userId (unusable)", async () => { + const key = createSecretKeyRecord({userId: null, partnerName: null}); + ApiKey.findAll = mock( + async () => [key as unknown as ApiKey] + ) as typeof ApiKey.findAll; + + const result = await validateSecretApiKey(key.raw); + expect(result).toBeNull(); + }); + + it("returns null when no matching key exists", async () => { + ApiKey.findAll = mock(async () => []) as typeof ApiKey.findAll; + const result = await validateSecretApiKey("sk_test_no_such_key_xxxxxxxxxxxxxxxx"); + expect(result).toBeNull(); + }); +}); + +describe("hashApiKey + getKeyPrefix consistency", () => { + it("produces a hash that validates against the original secret", async () => { + const secret = generateApiKey("secret", "test"); + const hash = await hashApiKey(secret); + expect(await bcrypt.compare(secret, hash)).toBe(true); + expect(getKeyPrefix(secret)).toBe(secret.substring(0, 8)); + }); +}); \ No newline at end of file diff --git a/apps/api/src/api/middlewares/apiKeyAuth.helpers.ts b/apps/api/src/api/middlewares/apiKeyAuth.helpers.ts index b268c3b4b..d799bf97b 100644 --- a/apps/api/src/api/middlewares/apiKeyAuth.helpers.ts +++ b/apps/api/src/api/middlewares/apiKeyAuth.helpers.ts @@ -7,17 +7,26 @@ import Partner from "../../models/partner.model"; export interface AuthenticatedPartner { id: string; name: string; - /** - * Database id of the API key that authenticated the request. - * Used by ownership and effective-user helpers for diagnostics. - */ - apiKeyId?: string; - /** - * User id (profiles.id) bound to the API key via `api_keys.user_id`. - * Populated for secret keys that have been linked to a user; null/undefined - * for unlinked secret keys. Public API keys never populate this. - */ - apiKeyUserId?: string | null; +} + +/** + * Validation result for a secret API key. `partner` may be null for user-scoped + * keys (created via the self-serve API key endpoints) which may have no + * `partner_name` binding; in that case the request authenticates purely as + * the linked user via `apiKeyUserId`. + */ +export interface ValidatedSecretKey { + apiKeyId: string; + apiKeyUserId: string | null; + partner: AuthenticatedPartner | null; +} + +/** + * Validation result for a public API key. `partnerName` may be null for + * user-scoped public keys (no partner binding). + */ +export interface ValidatedPublicKey { + partnerName: string | null; } /** @@ -87,9 +96,9 @@ export function getKeyPrefix(key: string): string { /** * Validate public API key (simple lookup, no hashing) * @param apiKey - The public API key to validate - * @returns Promise resolving to partner name or null if invalid + * @returns Promise resolving to validation result, or null if the key is invalid/expired/inactive */ -export async function validatePublicApiKey(apiKey: string): Promise { +export async function validatePublicApiKey(apiKey: string): Promise { try { const keyRecord = await ApiKey.findOne({ where: { @@ -113,7 +122,7 @@ export async function validatePublicApiKey(apiKey: string): Promise { +export async function validateSecretApiKey(apiKey: string): Promise { try { // Extract prefix for quick lookup const prefix = getKeyPrefix(apiKey); @@ -154,7 +163,27 @@ export async function validateSecretApiKey(apiKey: string): Promise { + logger.error("Failed to update lastUsedAt for secret key:", err); + }); + + return { + apiKeyId: keyRecord.id, + apiKeyUserId: keyRecord.userId, + partner: null + }; + } + + // Partner-scoped keys: find any active partner with this name const partner = await Partner.findOne({ where: { isActive: true, @@ -175,8 +204,10 @@ export async function validateSecretApiKey(apiKey: string): Promise { +export async function validateApiKey(apiKey: string): Promise { const keyType = getKeyType(apiKey); if (keyType === "secret") { diff --git a/apps/api/src/api/middlewares/apiKeyAuth.ts b/apps/api/src/api/middlewares/apiKeyAuth.ts index e879f1144..34da068ae 100644 --- a/apps/api/src/api/middlewares/apiKeyAuth.ts +++ b/apps/api/src/api/middlewares/apiKeyAuth.ts @@ -79,9 +79,9 @@ export function apiKeyAuth(options: ApiKeyAuthOptions = {}) { } // Find and validate API key - const partner = await validateApiKey(apiKey); + const result = await validateApiKey(apiKey); - if (!partner) { + if (!result) { recordAuthFailure(req, 401, "auth_invalid_api_key", getSafeApiKeyPrefix(apiKey, ["sk_"])); return res.status(401).json({ error: { @@ -92,9 +92,13 @@ export function apiKeyAuth(options: ApiKeyAuthOptions = {}) { }); } - // Attach authenticated partner to request - req.authenticatedPartner = partner; - setApiKeyUserId(req, partner.apiKeyUserId); + const partner = result.partner; + + // Attach authenticated partner to request (null for user-scoped keys, leaving the field unset). + if (partner) { + req.authenticatedPartner = partner; + } + setApiKeyUserId(req, result.apiKeyUserId); // If validatePartnerMatch enabled, check payload partnerId if (options.validatePartnerMatch && req.body?.partnerId) { @@ -110,7 +114,7 @@ export function apiKeyAuth(options: ApiKeyAuthOptions = {}) { const requestedPartner = await Partner.findByPk(partnerIdOrName); if (!requestedPartner) { - recordAuthFailure(req, 404, "auth_partner_not_found", getSafeApiKeyPrefix(apiKey, ["sk_"]), partner); + recordAuthFailure(req, 404, "auth_partner_not_found", getSafeApiKeyPrefix(apiKey, ["sk_"]), partner ?? undefined); return res.status(404).json({ error: { code: "PARTNER_NOT_FOUND", @@ -127,13 +131,13 @@ export function apiKeyAuth(options: ApiKeyAuthOptions = {}) { } // Compare partner names since one API key works for all partners with same name - if (requestedPartnerName !== partner.name) { - recordAuthFailure(req, 403, "auth_partner_mismatch", getSafeApiKeyPrefix(apiKey, ["sk_"]), partner); + if (!partner || requestedPartnerName !== partner.name) { + recordAuthFailure(req, 403, "auth_partner_mismatch", getSafeApiKeyPrefix(apiKey, ["sk_"]), partner ?? undefined); return res.status(403).json({ error: { code: "PARTNER_MISMATCH", details: { - authenticatedPartnerName: partner.name, + authenticatedPartnerName: partner?.name ?? null, requestedPartnerName: requestedPartnerName }, message: "The authenticated partner name does not match the requested partner's name", diff --git a/apps/api/src/api/middlewares/dualAuth.ts b/apps/api/src/api/middlewares/dualAuth.ts index 3ec42ffa5..aafb78e3e 100644 --- a/apps/api/src/api/middlewares/dualAuth.ts +++ b/apps/api/src/api/middlewares/dualAuth.ts @@ -52,8 +52,8 @@ function dualAuthHandler({ requireCredentials }: { requireCredentials: boolean } }); } - const partner = await validateSecretApiKey(apiKey); - if (!partner) { + const result = await validateSecretApiKey(apiKey); + if (!result) { recordDualAuthFailure(req, 401, "auth_invalid_api_key", getSafeApiKeyPrefix(apiKey, ["sk_"])); return res.status(401).json({ error: { @@ -64,8 +64,10 @@ function dualAuthHandler({ requireCredentials }: { requireCredentials: boolean } }); } - req.authenticatedPartner = partner; - setApiKeyUserId(req, partner.apiKeyUserId); + if (result.partner) { + req.authenticatedPartner = result.partner; + } + setApiKeyUserId(req, result.apiKeyUserId); return next(); } diff --git a/apps/api/src/api/middlewares/publicKeyAuth.ts b/apps/api/src/api/middlewares/publicKeyAuth.ts index 599e2b583..4dbae016e 100644 --- a/apps/api/src/api/middlewares/publicKeyAuth.ts +++ b/apps/api/src/api/middlewares/publicKeyAuth.ts @@ -15,7 +15,7 @@ declare global { interface Request { validatedPublicKey?: { apiKey: string; - partnerName: string; + partnerName: string | null; }; } } @@ -64,9 +64,9 @@ export function validatePublicKey() { } // Validate the public key exists and is active - const partnerName = await validatePublicApiKey(apiKey); + const result = await validatePublicApiKey(apiKey); - if (!partnerName) { + if (!result) { recordPublicKeyFailure(req, 401, getSafeApiKeyPrefix(apiKey)); return res.status(401).json({ error: { @@ -80,7 +80,7 @@ export function validatePublicKey() { // Attach validated public key info to request req.validatedPublicKey = { apiKey, - partnerName + partnerName: result.partnerName }; next(); diff --git a/apps/api/src/api/routes/v1/api-keys.route.ts b/apps/api/src/api/routes/v1/api-keys.route.ts new file mode 100644 index 000000000..bf6d92c90 --- /dev/null +++ b/apps/api/src/api/routes/v1/api-keys.route.ts @@ -0,0 +1,27 @@ +import { Request, Response, Router } from "express"; +import { createUserApiKey, listUserApiKeys, revokeUserApiKey } from "../../controllers/userApiKeys.controller"; +import { requireAuth } from "../../middlewares/supabaseAuth"; + +const router: Router = Router({ mergeParams: true }); + +router.use(requireAuth); + +/** + * POST /v1/api-keys + * Create a new public + secret API key pair bound to the authenticated Supabase user. + */ +router.post("/", createUserApiKey as unknown as (req: Request, res: Response) => void); + +/** + * GET /v1/api-keys + * List the authenticated user's active API keys. + */ +router.get("/", listUserApiKeys as unknown as (req: Request, res: Response) => void); + +/** + * DELETE /v1/api-keys/:keyId + * Revoke (soft delete) one of the authenticated user's API keys. + */ +router.delete("/:keyId", revokeUserApiKey as unknown as (req: Request<{ keyId: string }>, res: Response) => void); + +export default router; diff --git a/apps/api/src/api/routes/v1/index.ts b/apps/api/src/api/routes/v1/index.ts index 88c3203bc..2d5c50d17 100644 --- a/apps/api/src/api/routes/v1/index.ts +++ b/apps/api/src/api/routes/v1/index.ts @@ -5,6 +5,7 @@ import apiClientEventsRoutes from "./admin/api-client-events.route"; import partnerApiKeysRoutes from "./admin/partner-api-keys.route"; import profilePartnerAssignmentsRoutes from "./admin/profile-partner-assignments.route"; import alfredpayRoutes from "./alfredpay.route"; +import apiKeysRoutes from "./api-keys.route"; import authRoutes from "./auth.route"; import brlaRoutes from "./brla.route"; import contactRoutes from "./contact.route"; @@ -167,6 +168,16 @@ router.use("/public-key", publicKeyRoutes); */ router.use("/metrics", metricsRoutes); +/** + * Self-serve API key management for authenticated Supabase users. + * Keys created here are user-scoped (no partner binding) and authenticate + * via the X-API-Key header on quote/ramp endpoints as the linked user. + * POST /v1/api-keys + * GET /v1/api-keys + * DELETE /v1/api-keys/:keyId + */ +router.use("/api-keys", apiKeysRoutes); + /** * Admin routes for partner API key management * Uses partner name (not ID) to manage keys for all partner configurations diff --git a/apps/api/src/database/migrations/035-make-api-key-partner-name-nullable.ts b/apps/api/src/database/migrations/035-make-api-key-partner-name-nullable.ts new file mode 100644 index 000000000..b070498f7 --- /dev/null +++ b/apps/api/src/database/migrations/035-make-api-key-partner-name-nullable.ts @@ -0,0 +1,17 @@ +import { DataTypes, QueryInterface } from "sequelize"; + +export async function up(queryInterface: QueryInterface): Promise { + await queryInterface.changeColumn("api_keys", "partner_name", { + allowNull: true, + field: "partner_name", + type: DataTypes.STRING(100) + }); +} + +export async function down(queryInterface: QueryInterface): Promise { + await queryInterface.changeColumn("api_keys", "partner_name", { + allowNull: false, + field: "partner_name", + type: DataTypes.STRING(100) + }); +} diff --git a/apps/api/src/models/apiKey.model.ts b/apps/api/src/models/apiKey.model.ts index c08e4a3c3..b59ac1a3e 100644 --- a/apps/api/src/models/apiKey.model.ts +++ b/apps/api/src/models/apiKey.model.ts @@ -5,7 +5,7 @@ import type Partner from "./partner.model"; // Define the attributes of the ApiKey model export interface ApiKeyAttributes { id: string; - partnerName: string; + partnerName: string | null; keyType: "public" | "secret"; keyHash: string | null; keyValue: string | null; @@ -22,14 +22,14 @@ export interface ApiKeyAttributes { // Define the attributes that can be set during creation type ApiKeyCreationAttributes = Optional< ApiKeyAttributes, - "id" | "keyType" | "name" | "lastUsedAt" | "expiresAt" | "userId" | "createdAt" | "updatedAt" + "id" | "keyType" | "name" | "lastUsedAt" | "expiresAt" | "partnerName" | "userId" | "createdAt" | "updatedAt" >; // Define the ApiKey model class ApiKey extends Model implements ApiKeyAttributes { declare id: string; - declare partnerName: string; + declare partnerName: string | null; declare keyType: "public" | "secret"; @@ -115,7 +115,7 @@ ApiKey.init( type: DataTypes.STRING(100) }, partnerName: { - allowNull: false, + allowNull: true, field: "partner_name", type: DataTypes.STRING(100) }, diff --git a/docs/security-spec/01-auth/api-keys.md b/docs/security-spec/01-auth/api-keys.md index 9aea3212f..7e9854ee8 100644 --- a/docs/security-spec/01-auth/api-keys.md +++ b/docs/security-spec/01-auth/api-keys.md @@ -18,6 +18,18 @@ Three middleware components: A nullable `user_id` column on `api_keys` (FK to `profiles.id`, `ON DELETE SET NULL`) lets an admin bind a secret key to a specific profile. The binding is propagated to the request as `req.apiKeyUserId` (set by `setApiKeyUserId` in the auth middleware). Controllers and services derive the **effective user id** with `getEffectiveUserId(req)`, which prefers `req.userId` (Supabase) and falls back to `req.apiKeyUserId`. Public keys never populate `req.apiKeyUserId`. Use of the effective user is required for provider-backed quote creation, ramp registration on Avenia/BRL or Alfredpay corridors, and the BRLA pre-flight endpoints. +### User-scoped keys (`api_keys.partner_name` nullable) + +`api_keys.partner_name` is nullable (migration `035-make-api-key-partner-name-nullable`). A key with `partner_name = NULL` is a **user-scoped key**: it authenticates purely as the linked `user_id` and never resolves to an `AuthenticatedPartner`. The self-serve endpoints under `POST/GET/DELETE /v1/api-keys` (guarded by `requireAuth`) let any Supabase-authenticated user mint a public + secret pair bound to their own `req.userId` with `partner_name = NULL`. The admin endpoints under `/v1/admin/partners/:partnerName/api-keys` continue to require an active `Partner` row matching `partner_name`. + +### Self-serve API key endpoints + +`/v1/api-keys` is guarded by `requireAuth` (Supabase Bearer). The flow for a headless integrator is: +1. `POST /v1/auth/request-otp` with `{ email }` — Supabase sends a one-time code. +2. `POST /v1/auth/verify-otp` with `{ email, token }` — returns `{ access_token, refresh_token, user_id }`. +3. `POST /v1/api-keys` with `Authorization: Bearer ` — creates a `pk_*`/`sk_*` pair bound to `user_id`, with `partner_name = NULL`. The secret key is returned once. +4. Use `X-API-Key: ` on quote/ramp endpoints. The request authenticates as the linked user (no partner attribution, no partner discount — defaults to the `vortex` partner fee configuration). + ## Security Invariants 1. **Secret keys MUST be transmitted via the `X-API-Key` header only** — Never in query parameters, request body, or URL path. The middleware reads exclusively from `req.headers["x-api-key"]`. @@ -33,6 +45,9 @@ A nullable `user_id` column on `api_keys` (FK to `profiles.id`, `ON DELETE SET N 11. **Secret keys MAY carry a nullable `api_keys.user_id` to identify a delegated user context** — The binding is consumed by the `apiKeyUserId` request field and is the only path for partner secret keys to provide a non-Supabase user identity. Public keys never carry or surface a user binding. 12. **`ON DELETE SET NULL` for `api_keys.user_id` is intentional** — Deleting a profile must not silently revoke partner keys; partner keys are operational assets and binding loss is a soft-state change. 13. **Provider-backed quote and ramp operations MUST be rejected when no effective user is present** — Alfredpay and Avenia/BRL flows return `400 Invalid quote: this route requires an API key linked to a user or Supabase user authentication.` before any upstream provider call. Unlinked secret keys are not a valid identity for these corridors. +14. **`api_keys.partner_name` is nullable; a NULL `partner_name` marks a user-scoped key** — `validateSecretApiKey` skips the `Partner` lookup entirely for keys with `partner_name = NULL` and `user_id` set, returning `{ partner: null, apiKeyUserId }`. The middleware leaves `req.authenticatedPartner` unset, so the request authenticates purely as the linked user. A secret key with neither `partner_name` nor `user_id` is unusable and rejected as invalid. +15. **User-scoped keys MUST interpolate no partner pricing** — When `req.authenticatedPartner` is unset, `resolveQuotePartner` finds no partner (`source: "none"`), and `calculatePartnerAndVortexFees` falls through to the default `vortex` Partner fee rows. User-scoped keys never receive partner-specific discounts. +16. **`POST/GET/DELETE /v1/api-keys` MUST require a Supabase user (`requireAuth`)** — The endpoints bind the created keys to `req.userId`; partner keys (with `partner_name`) remain admin-only under `/v1/admin/partners/:partnerName/api-keys` (`adminAuth`). ## Threat Vectors & Mitigations @@ -44,7 +59,7 @@ A nullable `user_id` column on `api_keys` (FK to `profiles.id`, `ON DELETE SET N | **Partner impersonation** | Attacker uses one partner's API key with another partner's `partnerId` | `enforcePartnerAuth` compares authenticated partner name against requested partner name; rejects mismatches with 403 | | **Stale/revoked key usage** | Partner's key is deactivated but still being used | `isActive` flag checked on every validation; expired keys rejected by `expiresAt` check | | **Key hash enumeration** | Attacker with DB read access tries to use key hashes | bcrypt hashes are one-way; raw keys cannot be recovered from hashes | -| **Unlinked key creating provider resources anonymously** | Partner uses a generic (unbound) sk\_ key to mint an Alfredpay/Avenia estimate quote, then registers it with a linked secret key or Supabase session to claim the resulting real provider quote | Quote creation is anonymous-eligible (the Alfredpay engines short-circuit on no effective user and store a sentinel `ANONYMOUS_ALFREDPAY_QUOTE_ID`). `RampService.registerRamp` rejects with `403` when `isProviderBackedRampKind(quote) && quote.userId == null && request.userId != null`, so the anonymous estimate cannot be claimed by an authenticated caller. Alfredpay engines resolve the customer via `api_keys.user_id -> alfredpay_customers.user_id` whenever an effective user is present. | +| **Unlinked key creating provider resources anonymously** | Partner uses a generic (unbound) sk\_ key to mint an Alfredpay/Avenia estimate quote, then registers it with a linked secret key or Supabase session to claim the resulting real provider quote | Quote creation is anonymous-eligible (the Alfredpay engines short-circuit on no effective user and store a sentinel `ANONYMOUS_ALFREDPAY_QUOTE_ID`). `RampService.registerRamp` rejects with `403` when `quote.userId == null && request.userId != null`, so the anonymous estimate cannot be claimed by an authenticated caller. Alfredpay engines resolve the customer via `api_keys.user_id -> alfredpay_customers.user_id` whenever an effective user is present. | | **One linked key operating on another user's quote/ramp** | Partner with a valid linked key targets a different linked user's provider-bound quote | `assertQuoteOwnership`/`assertRampOwnership` enforce `quote.userId === req.apiKeyUserId` when a linked key is in scope. The `RampService.registerRamp` cross-user check rejects the same scenario at registration time with `403`. | | **Anonymous subaccount creation DoS** | Unauthenticated caller hits `POST /v1/brla/createSubaccount` to spawn stranded Avenia subaccounts | The route now requires `requirePartnerOrUserAuth()`; controllers require an effective user id before calling the Avenia API. | @@ -63,10 +78,14 @@ A nullable `user_id` column on `api_keys` (FK to `profiles.id`, `ON DELETE SET N - [x] No endpoint accepts secret keys from query parameters or request body — **PASS** - [x] Error responses from key validation use distinct error codes (`API_KEY_REQUIRED`, `INVALID_SECRET_KEY`, `INVALID_API_KEY`, `PARTNER_MISMATCH`) without revealing which step failed for valid key formats — **PARTIAL: `PARTNER_MISMATCH` leaks authenticated partner name in response details** - [x] `api_keys.user_id` migration (`034-add-user-id-to-api-keys`) added with `ON DELETE SET NULL`, `idx_api_keys_user_id`, and `idx_api_keys_active_user_lookup`. — **PASS** -- [x] `validateSecretApiKey` returns `apiKeyId` and `apiKeyUserId` on the `AuthenticatedPartner` value. — **PASS** -- [x] `apiKeyAuth` and `dualAuth` populate `req.apiKeyUserId` from the validated secret key. Public keys do not populate the field. — **PASS** +- [x] `api_keys.partner_name` is nullable (migration `035-make-api-key-partner-name-nullable`); user-scoped keys have `partner_name = NULL` and authenticate purely as `user_id`. — **PASS** +- [x] `validateSecretApiKey` returns a `ValidatedSecretKey` wrapper `{ apiKeyId, apiKeyUserId, partner: AuthenticatedPartner | null }`; `partner` is null for user-scoped keys. — **PASS** +- [x] `validatePublicApiKey` returns a `ValidatedPublicKey` wrapper `{ partnerName: string | null }`; `partnerName` is null for user-scoped public keys. — **PASS** +- [x] `apiKeyAuth` and `dualAuth` populate `req.apiKeyUserId` from the validated secret key; `req.authenticatedPartner` is left unset for user-scoped keys. Public keys do not populate `req.apiKeyUserId`. — **PASS** - [x] `getEffectiveUserId` returns `req.userId ?? req.apiKeyUserId`. — **PASS** +- [x] User-scoped keys interpolate no partner pricing (`resolveQuotePartner` returns `source: "none"`, fee engine falls through to default `vortex` Partner rows). — **PASS** +- [x] `POST/GET/DELETE /v1/api-keys` require `requireAuth` (Supabase Bearer); bind created keys to `req.userId` with `partner_name = NULL`. Admin partner-key endpoints still require `adminAuth`. — **PASS** - [x] Provider-backed quote creation is anonymous-eligible: Alfredpay engines short-circuit on no effective user and store `ANONYMOUS_ALFREDPAY_QUOTE_ID`; Avenia engines call upstream providers regardless of identity. — **PASS** -- [x] `RampService.registerRamp` rejects provider-backed ramps without an effective user with `400 Invalid quote`. — **PASS** -- [x] `RampService.registerRamp` rejects anonymous provider-backed quotes from being claimed by an authenticated caller with `403` (`isProviderBackedRampKind(quote) && quote.userId == null && request.userId != null`). — **PASS** +- [x] `RampService.registerRamp` rejects ramps without an effective user with `400 Invalid quote`. — **PASS** +- [x] `RampService.registerRamp` rejects anonymous quotes from being claimed by an authenticated caller with `403` (`quote.userId == null && request.userId != null`). — **PASS** - [x] `assertQuoteOwnership` and `assertRampOwnership` reject linked-key callers who try to operate on a different linked user's quote/ramp. — **PASS** From f9eabc55779838c279d1237934b70e8e23ea43dd Mon Sep 17 00:00:00 2001 From: Gianfranco Date: Fri, 26 Jun 2026 12:11:28 -0300 Subject: [PATCH 039/176] adjust alfredpay quote engine for customer-derived id --- .../services/quote/engines/initialize/onramp-alfredpay.ts | 8 +++++--- .../services/quote/engines/partners/offramp-alfredpay.ts | 7 +++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/apps/api/src/api/services/quote/engines/initialize/onramp-alfredpay.ts b/apps/api/src/api/services/quote/engines/initialize/onramp-alfredpay.ts index d1b20d5be..b694a4459 100644 --- a/apps/api/src/api/services/quote/engines/initialize/onramp-alfredpay.ts +++ b/apps/api/src/api/services/quote/engines/initialize/onramp-alfredpay.ts @@ -10,6 +10,7 @@ import { RampDirection } from "@vortexfi/shared"; import Big from "big.js"; +import { resolveAlfredpayCustomerId } from "../../alfredpay-customer"; import { QuoteContext } from "../../core/types"; import { BaseInitializeEngine } from "./index"; @@ -24,16 +25,17 @@ export class OnRampInitializeAlfredpayEngine extends BaseInitializeEngine { const usdTokenDecimals = ALFREDPAY_ERC20_DECIMALS; const inputAmountDecimal = new Big(req.inputAmount); - const alfredpayService = AlfredpayApiService.getInstance(); + const customerId = req.userId ? await resolveAlfredpayCustomerId(req.inputCurrency, req.userId) : "unknown"; + const quoteRequest: CreateAlfredpayOnrampQuoteRequest = { chain: AlfredpayChain.MATIC, fromAmount: inputAmountDecimal.toString(), fromCurrency: req.inputCurrency as unknown as AlfredpayFiatCurrency, metadata: { businessId: "vortex", - customerId: req.userId || "unknown" + customerId }, // Mints hardcoded to Polygon. paymentMethodType: AlfredpayPaymentMethodType.BANK, toCurrency: ALFREDPAY_ONCHAIN_CURRENCY @@ -61,7 +63,7 @@ export class OnRampInitializeAlfredpayEngine extends BaseInitializeEngine { }; ctx.addNote?.( - `Initialized: ${inputAmountDecimal.toString()} ${req.inputCurrency} -> ${toAmount.toString()} ${req.outputCurrency}` + `Initialized: ${inputAmountDecimal.toString()} ${req.inputCurrency} -> ${toAmount.toString()} ${req.outputCurrency} (alfredpayCustomerId=${customerId})` ); } } diff --git a/apps/api/src/api/services/quote/engines/partners/offramp-alfredpay.ts b/apps/api/src/api/services/quote/engines/partners/offramp-alfredpay.ts index c28de518d..dc8f15c2a 100644 --- a/apps/api/src/api/services/quote/engines/partners/offramp-alfredpay.ts +++ b/apps/api/src/api/services/quote/engines/partners/offramp-alfredpay.ts @@ -12,6 +12,7 @@ import { } from "@vortexfi/shared"; import Big from "big.js"; import { priceFeedService } from "../../../priceFeed.service"; +import { resolveAlfredpayCustomerId } from "../../alfredpay-customer"; import { QuoteContext } from "../../core/types"; import { BaseInitializeEngine } from "./../initialize/index"; @@ -45,6 +46,8 @@ export class OfframpTransactionAlfredpayEngine extends BaseInitializeEngine { ? ctx.subsidy.targetOutputAmountDecimal.div(effectiveRate).round(ALFREDPAY_ERC20_DECIMALS, Big.roundDown) : ctx.evmToEvm.outputAmountDecimal.minus(deductibleFee).round(ALFREDPAY_ERC20_DECIMALS, Big.roundDown); + const customerId = req.userId ? await resolveAlfredpayCustomerId(req.outputCurrency, req.userId) : "unknown"; + const alfredpayService = AlfredpayApiService.getInstance(); const quoteRequest: CreateAlfredpayOfframpQuoteRequest = { chain: AlfredpayChain.MATIC, @@ -52,7 +55,7 @@ export class OfframpTransactionAlfredpayEngine extends BaseInitializeEngine { fromCurrency: ALFREDPAY_ONCHAIN_CURRENCY, metadata: { businessId: "vortex", - customerId: req.userId || "unknown" + customerId }, paymentMethodType: AlfredpayPaymentMethodType.BANK, toCurrency: req.outputCurrency as unknown as AlfredpayFiatCurrency @@ -78,7 +81,7 @@ export class OfframpTransactionAlfredpayEngine extends BaseInitializeEngine { }; ctx.addNote?.( - `OfframpTransactionAlfredpayEngine: ${inputAmountDecimal.toString()} ${ALFREDPAY_ONCHAIN_CURRENCY} -> ${toAmount.toString()} ${req.outputCurrency} (fee ${alfredpayFee.toString()}, rate ${effectiveRate.toString()})` + `OfframpTransactionAlfredpayEngine: ${inputAmountDecimal.toString()} ${ALFREDPAY_ONCHAIN_CURRENCY} -> ${toAmount.toString()} ${req.outputCurrency} (fee ${alfredpayFee.toString()}, rate ${effectiveRate.toString()}, alfredpayCustomerId=${customerId})` ); } } From d6ee74adbdb313bc145a5b0462ba8087da36f8d2 Mon Sep 17 00:00:00 2001 From: Gianfranco Date: Fri, 26 Jun 2026 14:36:46 -0300 Subject: [PATCH 040/176] add script to sdk for api-key creation --- .../sdk/scripts/login-and-create-api-key.ts | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 packages/sdk/scripts/login-and-create-api-key.ts diff --git a/packages/sdk/scripts/login-and-create-api-key.ts b/packages/sdk/scripts/login-and-create-api-key.ts new file mode 100644 index 000000000..b0f3083cd --- /dev/null +++ b/packages/sdk/scripts/login-and-create-api-key.ts @@ -0,0 +1,127 @@ +// Headless api-key provisioning for authenticated SDK testing. +// +// Flow (all REST, no SDK): +// 1. POST /v1/auth/request-otp { email } -> Supabase emails a one-time code +// 2. (prompt) read the 6-digit code from the inbox +// 3. POST /v1/auth/verify-otp { email, token } -> { access_token, refresh_token, user_id } +// 4. POST /v1/api-keys { Authorization: Bearer ... } -> { publicKey, secretKey } (sk_* returned ONCE) +// 5. persist keys to .api-key.json for the next script +// +// The minted pair is user-scoped (partner_name = NULL): the X-API-Key header authenticates +// as the linked user on quote/ramp endpoints, with default `vortex` partner pricing. +// +// Run: +// cd packages/sdk +// bun run scripts/login-and-create-api-key.ts +// +// Env overrides: +// API_BASE_URL default http://localhost:3000 +// API_KEY_NAME default sdk-test +// API_KEY_OUTFILE default .api-key.json + +import * as fs from "fs"; +import * as readline from "readline"; + +const API_BASE_URL = process.env.API_BASE_URL ?? "http://localhost:3000"; +const TEST_USER_EMAIL = process.env.TEST_USER_EMAIL ?? "test@email.io"; +const API_KEY_NAME = process.env.API_KEY_NAME ?? "sdk-test"; +const API_KEY_OUTFILE = process.env.API_KEY_OUTFILE ?? ".api-key.json"; + +interface ApiKeyResponse { + createdAt: string; + expiresAt: string; + isActive: boolean; + publicKey: { id: string; key: string; keyPrefix: string; name: string; type: "public" }; + secretKey: { id: string; key: string; keyPrefix: string; name: string; type: "secret" }; +} + +interface VerifyOtpResponse { + access_token: string; + refresh_token: string; + success: boolean; + user_id: string; +} + +function askQuestion(query: string): Promise { + const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); + return new Promise(resolve => { + rl.question(query, (ans: string) => { + rl.close(); + resolve(ans.trim()); + }); + }); +} + +async function postJson(path: string, body: unknown, bearer?: string): Promise { + const headers: Record = { "Content-Type": "application/json" }; + if (bearer) headers.Authorization = `Bearer ${bearer}`; + const response = await fetch(`${API_BASE_URL}/v1${path}`, { + body: JSON.stringify(body), + headers, + method: "POST" + }); + const text = await response.text(); + if (!response.ok) { + throw new Error(`${response.status} ${path}: ${text}`); + } + return JSON.parse(text) as T; +} + +async function requestOtp(email: string): Promise { + console.log(`📨 Requesting OTP for ${email} ...`); + const data = await postJson<{ message: string; success: boolean }>("/auth/request-otp", { email }); + console.log(` ${data.message}`); +} + +async function verifyOtp(email: string, token: string): Promise { + return postJson("/auth/verify-otp", { email, token }); +} + +async function createApiKey(accessToken: string, name: string): Promise { + return postJson("/api-keys", { name }, accessToken); +} + +async function main(): Promise { + console.log(`API base URL: ${API_BASE_URL}`); + console.log(`Test user: ${TEST_USER_EMAIL}\n`); + + await requestOtp(TEST_USER_EMAIL); + + const token = await askQuestion("➡️ Enter the OTP code from the email: "); + if (!token) throw new Error("No OTP code provided."); + + console.log("\n🔒 Verifying OTP ..."); + const auth = await verifyOtp(TEST_USER_EMAIL, token); + console.log(` user_id: ${auth.user_id}`); + + console.log(`\n🗝️ Creating user-scoped api-key "${API_KEY_NAME}" ...`); + const keyPair = await createApiKey(auth.access_token, API_KEY_NAME); + console.log(" publicKey:", keyPair.publicKey.key); + console.log(" secretKey:", keyPair.secretKey.key, " (shown once)"); + + const out = { + apiUrl: API_BASE_URL, + createdAt: keyPair.createdAt, + expiresAt: keyPair.expiresAt, + name: API_KEY_NAME, + publicKey: keyPair.publicKey.key, + publicKeyId: keyPair.publicKey.id, + secretKey: keyPair.secretKey.key, + secretKeyId: keyPair.secretKey.id, + userId: auth.user_id + }; + fs.writeFileSync(API_KEY_OUTFILE, JSON.stringify(out, null, 2)); + console.log(`\n💾 Wrote ${API_KEY_OUTFILE} (consumed by test-authenticated-quote.ts)`); +} + +if (import.meta.main) { + main() + .then(() => { + console.log("\n✨ Done"); + process.exit(0); + }) + .catch(error => { + console.error("\n💥 Failed:", error instanceof Error ? error.message : error); + process.exit(1); + }); +} From 52fe471730019368baa130deedf3f92a92f51779 Mon Sep 17 00:00:00 2001 From: Gianfranco Date: Fri, 26 Jun 2026 14:37:06 -0300 Subject: [PATCH 041/176] edit SKILL, gitignore --- .agents/skills/vortex-integration/SKILL.md | 2 +- packages/sdk/.gitignore | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.agents/skills/vortex-integration/SKILL.md b/.agents/skills/vortex-integration/SKILL.md index 17df141d8..cb71f976e 100644 --- a/.agents/skills/vortex-integration/SKILL.md +++ b/.agents/skills/vortex-integration/SKILL.md @@ -503,7 +503,7 @@ try { ## Current corridor reality (May 2026) - **BRL via PIX**: onramp and offramp both live. - **EUR via SEPA**: SDK types exist (`EurOnrampQuote`, `EurOfframpQuote`) but handlers throw `"Euro onramp/offramp handler not implemented yet"` at runtime. Treat as `planned`. -- **ARS via CBU**: offramp only. +- **ARS via CBU**: supported via the AlfredPay corridor; route resolver determines availability per-combination. - **USD / MXN / COP via ACH / SPEI / WIRE**: supported via the AlfredPay corridor; route resolver determines availability per-combination. ## Common failures diff --git a/packages/sdk/.gitignore b/packages/sdk/.gitignore index f3299315d..879616b86 100644 --- a/packages/sdk/.gitignore +++ b/packages/sdk/.gitignore @@ -22,6 +22,10 @@ report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json .env.production.local .env.local +# api-key artifacts (secrets) +.api-key.json +ephemerals_*.json + # caches .eslintcache .cache From b8ff2322842d10578fa1995efee61b29be1314d9 Mon Sep 17 00:00:00 2001 From: Gianfranco Date: Fri, 26 Jun 2026 16:37:45 -0300 Subject: [PATCH 042/176] add EUR feature to SDK --- packages/sdk/examples/exampleEurOfframp.ts | 113 ++++++++++++++ packages/sdk/examples/exampleEurOnramp.ts | 87 +++++++++++ packages/sdk/src/VortexSdk.ts | 23 ++- packages/sdk/src/errors.ts | 36 ++++- packages/sdk/src/handlers/MykoboHandler.ts | 168 +++++++++++++++++++++ packages/sdk/src/types.ts | 18 +-- 6 files changed, 429 insertions(+), 16 deletions(-) create mode 100644 packages/sdk/examples/exampleEurOfframp.ts create mode 100644 packages/sdk/examples/exampleEurOnramp.ts create mode 100644 packages/sdk/src/handlers/MykoboHandler.ts diff --git a/packages/sdk/examples/exampleEurOfframp.ts b/packages/sdk/examples/exampleEurOfframp.ts new file mode 100644 index 000000000..bdd2a1b1c --- /dev/null +++ b/packages/sdk/examples/exampleEurOfframp.ts @@ -0,0 +1,113 @@ +import * as readline from "readline"; +import { EPaymentMethod, EvmToken, FiatToken, Networks, RampDirection } from "../src/index"; +import { VortexSdkConfig } from "../src/types"; +import { VortexSdk } from "../src/VortexSdk"; + +async function runEurOfframpExample() { + const askQuestion = (query: string): Promise => { + const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout + }); + + return new Promise(resolve => { + rl.question(query, (ans: string) => { + rl.close(); + resolve(ans.trim()); + }); + }); + }; + + try { + console.log("Starting EUR Offramp Example...\n"); + + console.log("📝 Step 1: Initializing VortexSdk..."); + const config: VortexSdkConfig = { + apiBaseUrl: "http://localhost:3000", + autoReconnect: true, + publicKey: "pk_live_REPLACEME", + secretKey: "sk_live_REPLACEME", + storeEphemeralKeys: true + }; + + const sdk = new VortexSdk(config); + console.log("✅ VortexSdk initialized successfully\n"); + + console.log("📝 Step 2: Creating quote for EUR offramp (USDC on Polygon -> EUR via SEPA)..."); + const quoteRequest = { + from: Networks.Polygon, + inputAmount: "100", + inputCurrency: EvmToken.USDC, + network: Networks.Polygon, + outputCurrency: FiatToken.EURC, + rampType: RampDirection.SELL, + to: EPaymentMethod.SEPA + }; + + const quote = await sdk.createQuote(quoteRequest); + console.log("✅ Quote created successfully:"); + console.log(` Quote ID: ${quote.id}`); + console.log(` Input: ${quote.inputAmount} ${quote.inputCurrency}`); + console.log(` Output: ${quote.outputAmount} ${quote.outputCurrency}`); + console.log(` Total Fee: ${quote.totalFeeFiat} ${quote.feeCurrency}`); + console.log(` Expires at: ${quote.expiresAt}\n`); + + const eurOfframpData = { + destinationAddress: "0x1234567890123456789012345678901234567890", + email: "user@example.com", + ipAddress: "203.0.113.1", + walletAddress: "0x1234567890123456789012345678901234567890" + }; + + console.log("📝 Step 3: Registering EUR offramp..."); + const { rampProcess, unsignedTransactions } = await sdk.registerRamp(quote, eurOfframpData); + + console.log("✅ EUR Offramp registered successfully:"); + console.log(` Ramp ID: ${rampProcess.id}`); + + console.log(" Unsigned transactions:"); + unsignedTransactions.forEach(tx => { + const txType = sdk.getUserTransactionType(tx); + console.log(` - ${tx.phase} (${txType}): signer ${tx.signer} on ${tx.network}`); + }); + console.log(""); + + console.log( + "\n🛑 Complete the token payment on-chain now. Execute the transactions shown above (squidRouterApprove and squidRouterSwap), and save the corresponding transaction hashes." + ); + + const squidRouterApproveHash = await askQuestion("➡️ Enter the Squid Router Approve Hash: "); + const squidRouterSwapHash = await askQuestion("➡️ Enter the Squid Router Swap Hash: "); + + console.log("\n📝 Step 4: Updating EUR offramp..."); + const transactionHashes = { + squidRouterApproveHash, + squidRouterSwapHash + }; + + await sdk.updateRamp(quote, rampProcess.id, transactionHashes); + console.log("✅ EUR Offramp updated successfully."); + + console.log("\n📝 Step 5: Starting EUR offramp..."); + await sdk.startRamp(rampProcess.id); + console.log("✅ EUR Offramp started successfully."); + } catch (error) { + console.error("❌ Error in EUR Offramp Example:", error); + if (error instanceof Error) { + console.error("Error message:", error.message); + } + process.exit(1); + } +} + +if (require.main === module) { + runEurOfframpExample() + .then(() => { + console.log("\n✨ Example execution completed"); + process.exit(0); + }) + .catch(error => { + console.error("\n💥 Example execution failed:", error); + process.exit(1); + }); +} diff --git a/packages/sdk/examples/exampleEurOnramp.ts b/packages/sdk/examples/exampleEurOnramp.ts new file mode 100644 index 000000000..339971494 --- /dev/null +++ b/packages/sdk/examples/exampleEurOnramp.ts @@ -0,0 +1,87 @@ +import { CreateQuoteRequest, EPaymentMethod, EvmToken, FiatToken, Networks, QuoteResponse, RampDirection } from "../src/index"; +import { VortexSdkConfig } from "../src/types"; +import { VortexSdk } from "../src/VortexSdk"; + +async function runEurOnrampExample() { + try { + console.log("Starting EUR Onramp Example...\n"); + + console.log("📝 Step 1: Initializing VortexSdk..."); + const config: VortexSdkConfig = { + apiBaseUrl: "http://localhost:3000", + autoReconnect: true, + publicKey: "pk_live_REPLACEME", + secretKey: "sk_live_REPLACEME", + storeEphemeralKeys: true + }; + + const sdk = new VortexSdk(config); + console.log("✅ VortexSdk initialized successfully\n"); + + console.log("📝 Step 2: Creating quote for EUR onramp (EUR via SEPA -> USDC on Base)..."); + const quoteRequest: CreateQuoteRequest = { + from: EPaymentMethod.SEPA, + inputAmount: "100", + inputCurrency: FiatToken.EURC, + network: Networks.Base, + outputCurrency: EvmToken.USDC, + rampType: RampDirection.BUY, + to: Networks.Base + }; + + const quote = (await sdk.createQuote(quoteRequest)) as QuoteResponse; + console.log("✅ Quote created successfully:"); + console.log(` Quote ID: ${quote.id}`); + console.log(` Input: ${quote.inputAmount} ${quote.inputCurrency}`); + console.log(` Output: ${quote.outputAmount} ${quote.outputCurrency}`); + console.log(` Total Fee: ${quote.totalFeeFiat} ${quote.feeCurrency}`); + console.log(` Expires at: ${quote.expiresAt}\n`); + + const eurOnrampData = { + destinationAddress: "0x1234567890123456789012345678901234567890", + email: "user@example.com", + ipAddress: "203.0.113.1" + }; + + console.log("📝 Step 3: Registering EUR onramp..."); + const { rampProcess } = await sdk.registerRamp(quote, eurOnrampData); + + console.log("✅ EUR Onramp registered successfully:"); + console.log(` Ramp ID: ${rampProcess.id}`); + + // IBAN payment instructions are returned in rampProcess.ibanPaymentData after registration. + // The user must complete the SEPA transfer before starting the ramp. + if (rampProcess.ibanPaymentData) { + console.log(" IBAN Payment Instructions:"); + console.log(` IBAN: ${rampProcess.ibanPaymentData.iban}`); + console.log(` Receiver: ${rampProcess.ibanPaymentData.receiverName}`); + console.log(` Reference: ${rampProcess.ibanPaymentData.reference}`); + } + + // Step 4: Start the ramp AFTER making the SEPA payment + console.log("\n📝 Step 4: Starting EUR onramp (ensure SEPA payment is completed first)..."); + await sdk.startRamp(rampProcess.id); + console.log("✅ EUR Onramp started."); + } catch (error) { + console.error("❌ Error in EUR Onramp Example:", error); + + if (error instanceof Error) { + console.error("Error message:", error.message); + console.error("Error stack:", error.stack); + } + + process.exit(1); + } +} + +if (require.main === module) { + runEurOnrampExample() + .then(() => { + console.log("\n✨ Example execution completed"); + process.exit(0); + }) + .catch(error => { + console.error("\n💥 Example execution failed:", error); + process.exit(1); + }); +} diff --git a/packages/sdk/src/VortexSdk.ts b/packages/sdk/src/VortexSdk.ts index 48cf894a6..818e02a85 100644 --- a/packages/sdk/src/VortexSdk.ts +++ b/packages/sdk/src/VortexSdk.ts @@ -24,6 +24,7 @@ import { attachSignatures, typedDataToSign, type UserTransactionType, userTransa import { TransactionSigningError } from "./errors"; import { AlfredpayHandler } from "./handlers/AlfredpayHandler"; import { BrlHandler } from "./handlers/BrlHandler"; +import { MykoboHandler } from "./handlers/MykoboHandler"; import { ApiService } from "./services/ApiService"; import { NetworkManager } from "./services/NetworkManager"; import { storeEphemeralKeys } from "./storage"; @@ -34,6 +35,9 @@ import type { BrlOfframpAdditionalData, BrlOfframpUpdateAdditionalData, BrlOnrampAdditionalData, + EurOfframpAdditionalData, + EurOfframpUpdateAdditionalData, + EurOnrampAdditionalData, ExtendedQuoteResponse, RegisterRampAdditionalData, SubmitUserTransactionsHandlers, @@ -47,6 +51,7 @@ export class VortexSdk { private networkManager: NetworkManager; private brlHandler: BrlHandler; private alfredpayHandler: AlfredpayHandler; + private mykoboHandler: MykoboHandler; private initializationPromise: Promise; private storeEphemeralKeys: boolean; @@ -70,6 +75,13 @@ export class VortexSdk { this.signTransactions.bind(this) ); + this.mykoboHandler = new MykoboHandler( + this.apiService, + this, + this.generateEphemerals.bind(this), + this.signTransactions.bind(this) + ); + this.initializationPromise = this.networkManager.waitForInitialization(); } @@ -118,7 +130,8 @@ export class VortexSdk { rampProcess = await this.brlHandler.registerBrlOnramp(quote.id, additionalData as BrlOnrampAdditionalData); unsignedTransactions = []; } else if (quote.from === "sepa") { - throw new Error("Euro onramp handler not implemented yet"); + rampProcess = await this.mykoboHandler.registerMykoboOnramp(quote.id, additionalData as EurOnrampAdditionalData); + unsignedTransactions = []; } else { throw new Error(`Unsupported onramp from: ${quote.from}`); } @@ -132,7 +145,9 @@ export class VortexSdk { const userAddress = (additionalData as BrlOfframpAdditionalData).walletAddress; unsignedTransactions = await this.getUserTransactions(rampProcess, userAddress); } else if (quote.to === "sepa") { - throw new Error("Euro offramp handler not implemented yet"); + rampProcess = await this.mykoboHandler.registerMykoboOfframp(quote.id, additionalData as EurOfframpAdditionalData); + const userAddress = (additionalData as EurOfframpAdditionalData).walletAddress; + unsignedTransactions = await this.getUserTransactions(rampProcess, userAddress); } else { throw new Error(`Unsupported offramp to: ${quote.to}`); } @@ -154,7 +169,7 @@ export class VortexSdk { } else if (quote.from === "pix") { throw new Error("Brl onramp does not require any further data"); } else if (quote.from === "sepa") { - throw new Error("Euro onramp handler not implemented yet"); + throw new Error("Euro onramp does not require any further data"); } } else if (quote.rampType === RampDirection.SELL) { if (isAlfredpayToken(quote.outputCurrency)) { @@ -165,7 +180,7 @@ export class VortexSdk { } else if (quote.to === "pix") { return this.brlHandler.updateBrlOfframp(rampId, additionalUpdateData as BrlOfframpUpdateAdditionalData); } else if (quote.to === "sepa") { - throw new Error("Euro offramp handler not implemented yet"); + return this.mykoboHandler.updateMykoboOfframp(rampId, additionalUpdateData as EurOfframpUpdateAdditionalData); } } diff --git a/packages/sdk/src/errors.ts b/packages/sdk/src/errors.ts index a6382ecbe..ef52ff42e 100644 --- a/packages/sdk/src/errors.ts +++ b/packages/sdk/src/errors.ts @@ -216,7 +216,7 @@ export class MissingAlfredpayOfframpParametersError extends AlfredpayOfframpErro } } -// Monerium specific errors +// Monerium specific errors (deprecated — replaced by Mykobo) export class MoneriumError extends RegisterRampError { constructor(message: string, status = 400) { super(message, status); @@ -238,6 +238,28 @@ export class MissingMoneriumOfframpParametersError extends MoneriumError { } } +// Mykobo EUR specific errors +export class MykoboError extends RegisterRampError { + constructor(message: string, status = 400) { + super(message, status); + this.name = "MykoboError"; + } +} + +export class MissingMykoboOnrampParametersError extends MykoboError { + constructor() { + super("Parameters destinationAddress, email and ipAddress are required for Mykobo EUR onramp", 400); + this.name = "MissingMykoboOnrampParametersError"; + } +} + +export class MissingMykoboOfframpParametersError extends MykoboError { + constructor() { + super("Parameters walletAddress, email, ipAddress and destinationAddress are required for Mykobo EUR offramp", 400); + this.name = "MissingMykoboOfframpParametersError"; + } +} + /** * Update Ramp Error Types */ @@ -477,6 +499,18 @@ export function parseAPIError(response: unknown): VortexSdkError { if (errorMessage === "Parameters walletAddress and moneriumAuthToken is required for Monerium onramp") { return new MissingMoneriumOfframpParametersError(); } + if (errorMessage === "Parameters destinationAddress, email and ipAddress are required for Mykobo EUR onramp") { + return new MissingMykoboOnrampParametersError(); + } + if (errorMessage === "email must be provided for Mykobo (EUR) offramp") { + return new MissingMykoboOfframpParametersError(); + } + if (errorMessage === "ipAddress must be provided for Mykobo (EUR) offramp") { + return new MissingMykoboOfframpParametersError(); + } + if (errorMessage === "destinationAddress (user receiving wallet) must be provided for Mykobo offramp") { + return new MissingMykoboOfframpParametersError(); + } if (errorMessage === "Ramp not found") { return new RampNotFoundError(); diff --git a/packages/sdk/src/handlers/MykoboHandler.ts b/packages/sdk/src/handlers/MykoboHandler.ts new file mode 100644 index 000000000..7812f4d37 --- /dev/null +++ b/packages/sdk/src/handlers/MykoboHandler.ts @@ -0,0 +1,168 @@ +import { + AccountMeta, + EphemeralAccount, + EphemeralAccountType, + PresignedTx, + RampProcess, + RegisterRampRequest, + UnsignedTx, + UpdateRampRequest +} from "@vortexfi/shared"; +import { MissingMykoboOfframpParametersError, MissingMykoboOnrampParametersError } from "../errors"; +import type { ApiService } from "../services/ApiService"; +import type { + EurOfframpAdditionalData, + EurOfframpUpdateAdditionalData, + EurOnrampAdditionalData, + RampHandler, + VortexSdkContext +} from "../types"; + +export class MykoboHandler implements RampHandler { + private apiService: ApiService; + private context: VortexSdkContext; + private generateEphemerals: () => Promise<{ + ephemerals: { [key in EphemeralAccountType]?: EphemeralAccount }; + accountMetas: AccountMeta[]; + }>; + private signTransactions: ( + unsignedTxs: UnsignedTx[], + ephemerals: { + substrateEphemeral?: EphemeralAccount; + evmEphemeral?: EphemeralAccount; + } + ) => Promise; + + constructor( + apiService: ApiService, + context: VortexSdkContext, + generateEphemerals: () => Promise<{ + ephemerals: { [key in EphemeralAccountType]?: EphemeralAccount }; + accountMetas: AccountMeta[]; + }>, + signTransactions: ( + unsignedTxs: UnsignedTx[], + ephemerals: { + substrateEphemeral?: EphemeralAccount; + evmEphemeral?: EphemeralAccount; + } + ) => Promise + ) { + this.apiService = apiService; + this.context = context; + this.generateEphemerals = generateEphemerals; + this.signTransactions = signTransactions; + } + + private getEphemeralTransactions( + unsignedTxs: UnsignedTx[], + ephemerals: { [key in EphemeralAccountType]?: EphemeralAccount } + ): UnsignedTx[] { + const ephemeralSigners = new Set( + [ephemerals.EVM?.address, ephemerals.Substrate?.address] + .filter((address): address is string => Boolean(address)) + .map(address => address.toLowerCase()) + ); + + return unsignedTxs.filter(tx => ephemeralSigners.has(tx.signer.toLowerCase())); + } + + async registerMykoboOnramp(quoteId: string, additionalData: EurOnrampAdditionalData): Promise { + if (!additionalData.destinationAddress || !additionalData.email || !additionalData.ipAddress) { + throw new MissingMykoboOnrampParametersError(); + } + + const { ephemerals, accountMetas } = await this.generateEphemerals(); + + const registerRequest: RegisterRampRequest = { + additionalData: { + destinationAddress: additionalData.destinationAddress, + email: additionalData.email, + ipAddress: additionalData.ipAddress + }, + quoteId, + signingAccounts: accountMetas + }; + + const rampProcess = await this.apiService.registerRamp(registerRequest); + + await this.context.storeEphemerals(ephemerals, rampProcess.id); + + const ephemeralTxs = this.getEphemeralTransactions(rampProcess.unsignedTxs || [], ephemerals); + const signedTxs = await this.signTransactions(ephemeralTxs, { + evmEphemeral: ephemerals.EVM, + substrateEphemeral: ephemerals.Substrate + }); + + const updateRequest: UpdateRampRequest = { + additionalData: {}, + presignedTxs: signedTxs, + rampId: rampProcess.id + }; + + return this.apiService.updateRamp(updateRequest); + } + + async registerMykoboOfframp(quoteId: string, additionalData: EurOfframpAdditionalData): Promise { + if ( + !additionalData.walletAddress || + !additionalData.email || + !additionalData.ipAddress || + !additionalData.destinationAddress + ) { + throw new MissingMykoboOfframpParametersError(); + } + + const { ephemerals, accountMetas } = await this.generateEphemerals(); + + const registerRequest: RegisterRampRequest = { + additionalData: { + destinationAddress: additionalData.destinationAddress, + email: additionalData.email, + ipAddress: additionalData.ipAddress, + walletAddress: additionalData.walletAddress + }, + quoteId, + signingAccounts: accountMetas + }; + + const rampProcess = await this.apiService.registerRamp(registerRequest); + + await this.context.storeEphemerals(ephemerals, rampProcess.id); + + const ephemeralTxs = this.getEphemeralTransactions(rampProcess.unsignedTxs || [], ephemerals); + const signedTxs = await this.signTransactions(ephemeralTxs, { + evmEphemeral: ephemerals.EVM, + substrateEphemeral: ephemerals.Substrate + }); + + const updateRequest: UpdateRampRequest = { + additionalData: {}, + presignedTxs: signedTxs, + rampId: rampProcess.id + }; + + return this.apiService.updateRamp(updateRequest); + } + + async updateMykoboOfframp(rampId: string, additionalData: EurOfframpUpdateAdditionalData): Promise { + const rampProcess = await this.apiService.getRampStatus(rampId); + if (rampProcess.currentPhase !== "initial") { + throw new Error( + `Invalid ramp id. Ramp must be on initial phase to be updated. Current phase: ${rampProcess.currentPhase}` + ); + } + + const updateRequest: UpdateRampRequest = { + additionalData: { + assethubToPendulumHash: additionalData.assethubToPendulumHash, + squidRouterApproveHash: additionalData.squidRouterApproveHash, + squidRouterSwapHash: additionalData.squidRouterSwapHash + }, + presignedTxs: [], + rampId: rampProcess.id + }; + + return this.apiService.updateRamp(updateRequest); + } +} diff --git a/packages/sdk/src/types.ts b/packages/sdk/src/types.ts index 5d18a8523..1bef65096 100644 --- a/packages/sdk/src/types.ts +++ b/packages/sdk/src/types.ts @@ -8,7 +8,6 @@ import { EvmToken, FiatToken, Networks, - PaymentData, RampDirection, RampPhase, UnsignedTx @@ -110,7 +109,9 @@ export interface BrlOnrampAdditionalData { } export interface EurOnrampAdditionalData { - moneriumAuthToken: string; + destinationAddress: string; + email: string; + ipAddress: string; } export interface AlfredpayOnrampAdditionalData { @@ -134,7 +135,9 @@ export interface BrlOfframpAdditionalData { } export interface EurOfframpAdditionalData { - paymentData: PaymentData; + destinationAddress: string; + email: string; + ipAddress: string; walletAddress: string; } @@ -145,7 +148,6 @@ export interface AlfredpayOfframpAdditionalData { } export type AnyUpdateAdditionalData = - | EurOnrampUpdateAdditionalData | BrlOfframpUpdateAdditionalData | EurOfframpUpdateAdditionalData | AlfredpayOfframpUpdateAdditionalData; @@ -155,7 +157,7 @@ export type UpdateRampAdditionalData = Q extends Alfred : Q extends BrlOnrampQuote ? never // No additional data required from the user for this type of ramp. : Q extends EurOnrampQuote - ? EurOnrampUpdateAdditionalData + ? never // No additional data required from the user for EUR onramp. : Q extends AlfredpayOfframpQuote ? AlfredpayOfframpUpdateAdditionalData : Q extends BrlOfframpQuote @@ -164,12 +166,6 @@ export type UpdateRampAdditionalData = Q extends Alfred ? EurOfframpUpdateAdditionalData : AnyUpdateAdditionalData; -export interface EurOnrampUpdateAdditionalData { - squidRouterApproveHash: string; - squidRouterSwapHash: string; - moneriumOfframpSignature: string; -} - export interface OfframpUpdateAdditionalData { squidRouterApproveHash?: string; squidRouterSwapHash?: string; From 50ff6c6bf8ae126a0b8093b4cb5d3e4026083ab5 Mon Sep 17 00:00:00 2001 From: Gianfranco Date: Fri, 26 Jun 2026 16:48:40 -0300 Subject: [PATCH 043/176] refactor api-key scripts --- packages/sdk/scripts/create-api-key.ts | 87 ++++++++++++++++++++ packages/sdk/scripts/delete-api-key.ts | 105 +++++++++++++++++++++++++ packages/sdk/scripts/fetch-api-keys.ts | 90 +++++++++++++++++++++ packages/sdk/scripts/login.ts | 97 +++++++++++++++++++++++ 4 files changed, 379 insertions(+) create mode 100644 packages/sdk/scripts/create-api-key.ts create mode 100644 packages/sdk/scripts/delete-api-key.ts create mode 100644 packages/sdk/scripts/fetch-api-keys.ts create mode 100644 packages/sdk/scripts/login.ts diff --git a/packages/sdk/scripts/create-api-key.ts b/packages/sdk/scripts/create-api-key.ts new file mode 100644 index 000000000..233c20e43 --- /dev/null +++ b/packages/sdk/scripts/create-api-key.ts @@ -0,0 +1,87 @@ +// Create a new public + secret API key pair (POST /v1/api-keys). +// Requires a valid auth token from scripts/login.ts. +// +// Run: +// cd packages/sdk +// bun run scripts/create-api-key.ts +// +// Env overrides: +// API_BASE_URL default http://localhost:3000 +// AUTH_TOKEN_FILE default .auth-token.json +// API_KEY_NAME default sdk-test +// API_KEY_OUTFILE default .api-key.json + +import * as fs from "fs"; + +const API_BASE_URL = process.env.API_BASE_URL ?? "http://localhost:3000"; +const AUTH_TOKEN_FILE = process.env.AUTH_TOKEN_FILE ?? ".auth-token.json"; +const API_KEY_NAME = process.env.API_KEY_NAME ?? "sdk-test"; +const API_KEY_OUTFILE = process.env.API_KEY_OUTFILE ?? ".api-key.json"; + +interface AuthToken { + accessToken: string; + userId: string; +} + +interface ApiKeyResponse { + createdAt: string; + expiresAt: string; + isActive: boolean; + publicKey: { id: string; key: string; keyPrefix: string; name: string; type: "public" }; + secretKey: { id: string; key: string; keyPrefix: string; name: string; type: "secret" }; +} + +function loadAuthToken(): AuthToken { + if (!fs.existsSync(AUTH_TOKEN_FILE)) { + throw new Error(`No ${AUTH_TOKEN_FILE} found. Run scripts/login.ts first.`); + } + return JSON.parse(fs.readFileSync(AUTH_TOKEN_FILE, "utf-8")) as AuthToken; +} + +async function main(): Promise { + const auth = loadAuthToken(); + + console.log(`🗝️ Creating api-key "${API_KEY_NAME}" ...`); + const response = await fetch(`${API_BASE_URL}/v1/api-keys`, { + body: JSON.stringify({ name: API_KEY_NAME }), + headers: { + Authorization: `Bearer ${auth.accessToken}`, + "Content-Type": "application/json" + }, + method: "POST" + }); + const text = await response.text(); + if (!response.ok) { + throw new Error(`${response.status} /v1/api-keys: ${text}`); + } + const keyPair = JSON.parse(text) as ApiKeyResponse; + + console.log(" publicKey:", keyPair.publicKey.key); + console.log(" secretKey:", keyPair.secretKey.key, " (shown once)"); + + const out = { + apiUrl: API_BASE_URL, + createdAt: keyPair.createdAt, + expiresAt: keyPair.expiresAt, + name: API_KEY_NAME, + publicKey: keyPair.publicKey.key, + publicKeyId: keyPair.publicKey.id, + secretKey: keyPair.secretKey.key, + secretKeyId: keyPair.secretKey.id, + userId: auth.userId + }; + fs.writeFileSync(API_KEY_OUTFILE, JSON.stringify(out, null, 2)); + console.log(`\n💾 Wrote ${API_KEY_OUTFILE}`); +} + +if (import.meta.main) { + main() + .then(() => { + console.log("\n✨ Done"); + process.exit(0); + }) + .catch(error => { + console.error("\n💥 Failed:", error instanceof Error ? error.message : error); + process.exit(1); + }); +} diff --git a/packages/sdk/scripts/delete-api-key.ts b/packages/sdk/scripts/delete-api-key.ts new file mode 100644 index 000000000..c95c3228d --- /dev/null +++ b/packages/sdk/scripts/delete-api-key.ts @@ -0,0 +1,105 @@ +// Delete (revoke) a user API key (DELETE /v1/api-keys/:keyId). +// Requires a valid auth token from scripts/login.ts. +// +// Run: +// cd packages/sdk +// bun run scripts/delete-api-key.ts +// +// Env overrides: +// API_BASE_URL default http://localhost:3000 +// AUTH_TOKEN_FILE default .auth-token.json + +import * as fs from "fs"; +import * as readline from "readline"; + +const API_BASE_URL = process.env.API_BASE_URL ?? "http://localhost:3000"; +const AUTH_TOKEN_FILE = process.env.AUTH_TOKEN_FILE ?? ".auth-token.json"; + +interface AuthToken { + accessToken: string; +} + +interface ApiKeyEntry { + id: string; + key?: string; + name: string; + type: "public" | "secret"; +} + +interface ListApiKeysResponse { + apiKeys: ApiKeyEntry[]; +} + +function askQuestion(query: string): Promise { + const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); + return new Promise(resolve => { + rl.question(query, (ans: string) => { + rl.close(); + resolve(ans.trim()); + }); + }); +} + +function loadAuthToken(): AuthToken { + if (!fs.existsSync(AUTH_TOKEN_FILE)) { + throw new Error(`No ${AUTH_TOKEN_FILE} found. Run scripts/login.ts first.`); + } + return JSON.parse(fs.readFileSync(AUTH_TOKEN_FILE, "utf-8")) as AuthToken; +} + +async function main(): Promise { + const auth = loadAuthToken(); + + console.log("📋 Fetching API keys ..."); + const response = await fetch(`${API_BASE_URL}/v1/api-keys`, { + headers: { Authorization: `Bearer ${auth.accessToken}` } + }); + const text = await response.text(); + if (!response.ok) { + throw new Error(`${response.status} /v1/api-keys: ${text}`); + } + const data = JSON.parse(text) as ListApiKeysResponse; + + if (data.apiKeys.length === 0) { + console.log("No active API keys to delete."); + return; + } + + console.log("\nActive keys:\n"); + data.apiKeys.forEach((key, i) => { + const typeLabel = key.type === "public" ? "PUBLIC" : "SECRET"; + const displayKey = key.key ?? "(hidden)"; + console.log(` ${i + 1}. [${key.id}] ${typeLabel} ${key.name} — ${displayKey}`); + }); + + const choice = await askQuestion(`\n➡️ Enter the number (1-${data.apiKeys.length}) of the key to delete: `); + const index = Number.parseInt(choice, 10) - 1; + if (Number.isNaN(index) || index < 0 || index >= data.apiKeys.length) { + throw new Error(`Invalid selection: "${choice}"`); + } + + const selected = data.apiKeys[index]; + console.log(`\n🗑️ Revoking key: ${selected.id} (${selected.type} — ${selected.name})`); + + const deleteResponse = await fetch(`${API_BASE_URL}/v1/api-keys/${selected.id}`, { + headers: { Authorization: `Bearer ${auth.accessToken}` }, + method: "DELETE" + }); + if (!deleteResponse.ok) { + const errText = await deleteResponse.text(); + throw new Error(`${deleteResponse.status} /v1/api-keys/${selected.id}: ${errText}`); + } + console.log("✅ Key revoked."); +} + +if (import.meta.main) { + main() + .then(() => { + console.log("\n✨ Done"); + process.exit(0); + }) + .catch(error => { + console.error("\n💥 Failed:", error instanceof Error ? error.message : error); + process.exit(1); + }); +} diff --git a/packages/sdk/scripts/fetch-api-keys.ts b/packages/sdk/scripts/fetch-api-keys.ts new file mode 100644 index 000000000..df987b3a0 --- /dev/null +++ b/packages/sdk/scripts/fetch-api-keys.ts @@ -0,0 +1,90 @@ +// List active user API keys (GET /v1/api-keys). +// Requires a valid auth token from scripts/login.ts. +// +// Run: +// cd packages/sdk +// bun run scripts/fetch-api-keys.ts +// +// Env overrides: +// API_BASE_URL default http://localhost:3000 +// AUTH_TOKEN_FILE default .auth-token.json + +import * as fs from "fs"; + +const API_BASE_URL = process.env.API_BASE_URL ?? "http://localhost:3000"; +const AUTH_TOKEN_FILE = process.env.AUTH_TOKEN_FILE ?? ".auth-token.json"; + +interface AuthToken { + accessToken: string; +} + +interface ApiKeyEntry { + createdAt: string; + expiresAt: string; + id: string; + isActive: boolean; + key?: string; + keyPrefix: string; + lastUsedAt: string | null; + name: string; + type: "public" | "secret"; + updatedAt: string; +} + +interface ListApiKeysResponse { + apiKeys: ApiKeyEntry[]; +} + +function loadAuthToken(): AuthToken { + if (!fs.existsSync(AUTH_TOKEN_FILE)) { + throw new Error(`No ${AUTH_TOKEN_FILE} found. Run scripts/login.ts first.`); + } + return JSON.parse(fs.readFileSync(AUTH_TOKEN_FILE, "utf-8")) as AuthToken; +} + +async function main(): Promise { + const auth = loadAuthToken(); + + console.log("📋 Fetching API keys ..."); + const response = await fetch(`${API_BASE_URL}/v1/api-keys`, { + headers: { Authorization: `Bearer ${auth.accessToken}` } + }); + const text = await response.text(); + if (!response.ok) { + throw new Error(`${response.status} /v1/api-keys: ${text}`); + } + const data = JSON.parse(text) as ListApiKeysResponse; + + if (data.apiKeys.length === 0) { + console.log("No active API keys found."); + return; + } + + console.log(`\n${data.apiKeys.length} active key(s):\n`); + for (const key of data.apiKeys) { + const typeLabel = key.type === "public" ? "PUBLIC (pk_*)" : "SECRET (sk_*)"; + const displayKey = key.key ?? "(only shown at creation)"; + console.log(` ${key.id}`); + console.log(` Type: ${typeLabel}`); + console.log(` Name: ${key.name}`); + console.log(` Prefix: ${key.keyPrefix}`); + console.log(` Key: ${displayKey}`); + console.log(` Created: ${key.createdAt}`); + console.log(` Expires: ${key.expiresAt}`); + console.log(` Last used: ${key.lastUsedAt ?? "never"}`); + console.log(` Active: ${key.isActive}`); + console.log(); + } +} + +if (import.meta.main) { + main() + .then(() => { + console.log("✨ Done"); + process.exit(0); + }) + .catch(error => { + console.error("\n💥 Failed:", error instanceof Error ? error.message : error); + process.exit(1); + }); +} diff --git a/packages/sdk/scripts/login.ts b/packages/sdk/scripts/login.ts new file mode 100644 index 000000000..6a2bb29ed --- /dev/null +++ b/packages/sdk/scripts/login.ts @@ -0,0 +1,97 @@ +// Standalone OTP login — saves auth token for reuse by other scripts. +// +// Flow: +// 1. POST /v1/auth/request-otp { email } +// 2. (prompt) read the 6-digit code from the inbox +// 3. POST /v1/auth/verify-otp { email, token } -> { access_token, refresh_token, user_id } +// 4. persist to .auth-token.json +// +// Run: +// cd packages/sdk +// bun run scripts/login.ts +// +// Env overrides: +// API_BASE_URL default http://localhost:3000 +// TEST_USER_EMAIL default test@email.io +// AUTH_TOKEN_FILE default .auth-token.json + +import * as fs from "fs"; +import * as readline from "readline"; + +const API_BASE_URL = process.env.API_BASE_URL ?? "http://localhost:3000"; +const TEST_USER_EMAIL = process.env.TEST_USER_EMAIL ?? "test@email.io"; +const AUTH_TOKEN_FILE = process.env.AUTH_TOKEN_FILE ?? ".auth-token.json"; + +interface VerifyOtpResponse { + access_token: string; + refresh_token: string; + success: boolean; + user_id: string; +} + +interface AuthToken { + accessToken: string; + apiUrl: string; + refreshToken: string; + userId: string; +} + +function askQuestion(query: string): Promise { + const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); + return new Promise(resolve => { + rl.question(query, (ans: string) => { + rl.close(); + resolve(ans.trim()); + }); + }); +} + +async function postJson(path: string, body: unknown): Promise { + const response = await fetch(`${API_BASE_URL}/v1${path}`, { + body: JSON.stringify(body), + headers: { "Content-Type": "application/json" }, + method: "POST" + }); + const text = await response.text(); + if (!response.ok) { + throw new Error(`${response.status} ${path}: ${text}`); + } + return JSON.parse(text) as T; +} + +async function main(): Promise { + console.log(`API base URL: ${API_BASE_URL}`); + console.log(`User: ${TEST_USER_EMAIL}\n`); + + console.log("📨 Requesting OTP ..."); + const data = await postJson<{ message: string; success: boolean }>("/auth/request-otp", { email: TEST_USER_EMAIL }); + console.log(` ${data.message}`); + + const otp = await askQuestion("➡️ Enter the OTP code from the email: "); + if (!otp) throw new Error("No OTP code provided."); + + console.log("\n🔒 Verifying OTP ..."); + const auth = await postJson("/auth/verify-otp", { email: TEST_USER_EMAIL, token: otp }); + console.log(` user_id: ${auth.user_id}`); + + const out: AuthToken = { + accessToken: auth.access_token, + apiUrl: API_BASE_URL, + refreshToken: auth.refresh_token, + userId: auth.user_id + }; + fs.writeFileSync(AUTH_TOKEN_FILE, JSON.stringify(out, null, 2)); + console.log(`\n💾 Wrote ${AUTH_TOKEN_FILE}`); +} + +if (import.meta.main) { + main() + .then(() => { + console.log("\n✨ Done"); + process.exit(0); + }) + .catch(error => { + console.error("\n💥 Failed:", error instanceof Error ? error.message : error); + process.exit(1); + }); +} From 196747a2b6d1c1ac6117f8632a58924641c6a167 Mon Sep 17 00:00:00 2001 From: Gianfranco Date: Fri, 26 Jun 2026 17:00:11 -0300 Subject: [PATCH 044/176] delete both pk and sk together --- .../api/controllers/userApiKeys.controller.ts | 57 +++++++++++++++++-- apps/api/src/api/routes/v1/api-keys.route.ts | 4 +- packages/sdk/scripts/delete-api-key.ts | 43 ++++++++++++-- 3 files changed, 93 insertions(+), 11 deletions(-) diff --git a/apps/api/src/api/controllers/userApiKeys.controller.ts b/apps/api/src/api/controllers/userApiKeys.controller.ts index 8a5c3d535..aa04682cf 100644 --- a/apps/api/src/api/controllers/userApiKeys.controller.ts +++ b/apps/api/src/api/controllers/userApiKeys.controller.ts @@ -160,6 +160,10 @@ export async function listUserApiKeys(req: Request, res: Response): Promise, res: Response): Promise { const userId = req.userId; if (!userId) { @@ -185,10 +189,11 @@ export async function revokeUserApiKey(req: Request<{ keyId: string }>, res: Res return; } - try { - const apiKey = await ApiKey.findOne({ where: { id: keyId, isActive: true, userId } }); + const { publicKeyId } = req.body ?? {}; - if (!apiKey) { + try { + const primaryKey = await ApiKey.findOne({ where: { id: keyId, isActive: true, userId } }); + if (!primaryKey) { res.status(httpStatus.NOT_FOUND).json({ error: { code: "API_KEY_NOT_FOUND", @@ -199,7 +204,51 @@ export async function revokeUserApiKey(req: Request<{ keyId: string }>, res: Res return; } - await apiKey.update({ isActive: false }); + if (!publicKeyId) { + await primaryKey.update({ isActive: false }); + res.status(httpStatus.NO_CONTENT).send(); + return; + } + + const pairedKey = await ApiKey.findOne({ where: { id: publicKeyId, isActive: true, userId } }); + if (!pairedKey) { + res.status(httpStatus.NOT_FOUND).json({ + error: { + code: "PAIRED_PUBLIC_KEY_NOT_FOUND", + message: "Paired public key not found or not owned by the authenticated user", + status: httpStatus.NOT_FOUND + } + }); + return; + } + + const types = new Set([primaryKey.keyType, pairedKey.keyType]); + if (!types.has("public") || !types.has("secret")) { + res.status(httpStatus.BAD_REQUEST).json({ + error: { + code: "INVALID_KEY_PAIR", + message: + "Both keys must be of different types (one public, one secret). A single key can be deleted without publicKeyId.", + status: httpStatus.BAD_REQUEST + } + }); + return; + } + + const baseName = stripSuffix(primaryKey.name ?? ""); + const pairedBaseName = stripSuffix(pairedKey.name ?? ""); + if (primaryKey.name && pairedKey.name && baseName !== pairedBaseName) { + res.status(httpStatus.BAD_REQUEST).json({ + error: { + code: "KEY_PAIR_MISMATCH", + message: `Key names do not match: "${primaryKey.name}" and "${pairedKey.name}" appear to be from different pairs`, + status: httpStatus.BAD_REQUEST + } + }); + return; + } + + await Promise.all([primaryKey.update({ isActive: false }), pairedKey.update({ isActive: false })]); res.status(httpStatus.NO_CONTENT).send(); } catch (error) { logger.error("Error revoking user API key:", error); diff --git a/apps/api/src/api/routes/v1/api-keys.route.ts b/apps/api/src/api/routes/v1/api-keys.route.ts index bf6d92c90..28de949a8 100644 --- a/apps/api/src/api/routes/v1/api-keys.route.ts +++ b/apps/api/src/api/routes/v1/api-keys.route.ts @@ -20,7 +20,9 @@ router.get("/", listUserApiKeys as unknown as (req: Request, res: Response) => v /** * DELETE /v1/api-keys/:keyId - * Revoke (soft delete) one of the authenticated user's API keys. + * Revoke (soft delete) one or both keys of a pair. + * Body: { publicKeyId?: string } — if provided, both keys of the pair are revoked together. + * The public+secret keys must be opposite types and share the same base name. */ router.delete("/:keyId", revokeUserApiKey as unknown as (req: Request<{ keyId: string }>, res: Response) => void); diff --git a/packages/sdk/scripts/delete-api-key.ts b/packages/sdk/scripts/delete-api-key.ts index c95c3228d..85e1f3784 100644 --- a/packages/sdk/scripts/delete-api-key.ts +++ b/packages/sdk/scripts/delete-api-key.ts @@ -1,6 +1,9 @@ -// Delete (revoke) a user API key (DELETE /v1/api-keys/:keyId). +// Delete (revoke) a user API key pair (DELETE /v1/api-keys/:keyId). // Requires a valid auth token from scripts/login.ts. // +// Select a key; if its paired counterpart (same base name, opposite type) exists, +// the script asks whether to delete both together. +// // Run: // cd packages/sdk // bun run scripts/delete-api-key.ts @@ -30,6 +33,10 @@ interface ListApiKeysResponse { apiKeys: ApiKeyEntry[]; } +function stripSuffix(name: string): string { + return name.replace(/\s*\((Public|Secret)\)$/, ""); +} + function askQuestion(query: string): Promise { const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); return new Promise(resolve => { @@ -79,17 +86,41 @@ async function main(): Promise { } const selected = data.apiKeys[index]; - console.log(`\n🗑️ Revoking key: ${selected.id} (${selected.type} — ${selected.name})`); + const baseName = stripSuffix(selected.name); + const paired = data.apiKeys.find(k => k.id !== selected.id && k.type !== selected.type && stripSuffix(k.name) === baseName); + + let publicKeyId: string | undefined; + let keyId = selected.id; + + if (paired) { + const typeLabel = paired.type === "public" ? "PUBLIC" : "SECRET"; + console.log(`\n🔗 Found paired ${typeLabel} key: ${paired.id} (${paired.name})`); + + const deleteBoth = await askQuestion("➡️ Delete both as a pair? (y/N): "); + if (deleteBoth.toLowerCase() === "y") { + publicKeyId = selected.type === "secret" ? paired.id : selected.id; + keyId = selected.type === "secret" ? selected.id : paired.id; + console.log(`\n🗑️ Revoking key pair: ${keyId} + ${publicKeyId}`); + } + } + + if (!publicKeyId) { + console.log(`\n🗑️ Revoking key: ${selected.id} (${selected.type} — ${selected.name})`); + } - const deleteResponse = await fetch(`${API_BASE_URL}/v1/api-keys/${selected.id}`, { - headers: { Authorization: `Bearer ${auth.accessToken}` }, + const deleteResponse = await fetch(`${API_BASE_URL}/v1/api-keys/${keyId}`, { + body: publicKeyId ? JSON.stringify({ publicKeyId }) : undefined, + headers: { + ...(publicKeyId ? { "Content-Type": "application/json" } : {}), + Authorization: `Bearer ${auth.accessToken}` + }, method: "DELETE" }); if (!deleteResponse.ok) { const errText = await deleteResponse.text(); - throw new Error(`${deleteResponse.status} /v1/api-keys/${selected.id}: ${errText}`); + throw new Error(`${deleteResponse.status} /v1/api-keys/${keyId}: ${errText}`); } - console.log("✅ Key revoked."); + console.log(publicKeyId ? "✅ Key pair revoked." : "✅ Key revoked."); } if (import.meta.main) { From bfa7e1c3c1f010d25828573e2dc8d3d86e4ca995 Mon Sep 17 00:00:00 2001 From: Gianfranco Date: Mon, 29 Jun 2026 11:41:33 -0300 Subject: [PATCH 045/176] add endpoint to list fiat accounts ids on SDK, test offramp --- .../src/api/controllers/alfredpay.controller.ts | 15 ++++++++++++--- apps/api/src/api/routes/v1/alfredpay.route.ts | 16 ++++++++++++---- docs/security-spec/05-integrations/alfredpay.md | 2 ++ packages/sdk/src/VortexSdk.ts | 6 ++++++ packages/sdk/src/services/ApiService.ts | 14 ++++++++++++++ packages/sdk/src/types.ts | 15 ++++++++++++--- 6 files changed, 58 insertions(+), 10 deletions(-) diff --git a/apps/api/src/api/controllers/alfredpay.controller.ts b/apps/api/src/api/controllers/alfredpay.controller.ts index 9ec108ff5..4dc902c3e 100644 --- a/apps/api/src/api/controllers/alfredpay.controller.ts +++ b/apps/api/src/api/controllers/alfredpay.controller.ts @@ -24,6 +24,7 @@ import { import { Request, Response } from "express"; import logger from "../../config/logger"; import AlfredPayCustomer from "../../models/alfredPayCustomer.model"; +import { getEffectiveUserId } from "../middlewares/effectiveUser"; export class AlfredpayController { private static getRequiredUserId(req: Request): string { @@ -34,6 +35,14 @@ export class AlfredpayController { return req.userId; } + private static getFiatAccountUserId(req: Request): string { + const userId = getEffectiveUserId(req); + if (!userId) { + throw new Error("Authenticated user id not available"); + } + return userId; + } + private static getErrorMessage(error: unknown): string { return error instanceof Error ? error.message : String(error); } @@ -788,7 +797,7 @@ export class AlfredpayController { documentNumber, isExternal = false } = req.body as AlfredpayAddFiatAccountRequest; - const userId = AlfredpayController.getRequiredUserId(req); + const userId = AlfredpayController.getFiatAccountUserId(req); const alfredPayCustomer = await AlfredPayCustomer.findOne({ order: [["updatedAt", "DESC"]], @@ -874,7 +883,7 @@ export class AlfredpayController { static async listFiatAccounts(req: Request, res: Response) { try { const { country } = req.query as { country: string }; - const userId = AlfredpayController.getRequiredUserId(req); + const userId = AlfredpayController.getFiatAccountUserId(req); const alfredPayCustomer = await AlfredPayCustomer.findOne({ order: [["updatedAt", "DESC"]], @@ -899,7 +908,7 @@ export class AlfredpayController { try { const { fiatAccountId } = req.params as { fiatAccountId: string }; const { country } = req.query as { country: string }; - const userId = AlfredpayController.getRequiredUserId(req); + const userId = AlfredpayController.getFiatAccountUserId(req); const alfredPayCustomer = await AlfredPayCustomer.findOne({ order: [["updatedAt", "DESC"]], diff --git a/apps/api/src/api/routes/v1/alfredpay.route.ts b/apps/api/src/api/routes/v1/alfredpay.route.ts index 862fc869f..5ff0abb55 100644 --- a/apps/api/src/api/routes/v1/alfredpay.route.ts +++ b/apps/api/src/api/routes/v1/alfredpay.route.ts @@ -2,6 +2,7 @@ import { Router } from "express"; import multer from "multer"; import { AlfredpayController } from "../../controllers/alfredpay.controller"; import { validateResultCountry } from "../../middlewares/alfredpay.middleware"; +import { requirePartnerOrUserAuth } from "../../middlewares/dualAuth"; import { requireAuth } from "../../middlewares/supabaseAuth"; import { validateKycSubmission } from "../../middlewares/validators"; @@ -42,9 +43,16 @@ router.post( ); router.post("/sendKybSubmission", requireAuth, validateResultCountry, AlfredpayController.sendKybSubmission); -// Fiat accounts (USD + MXN) -router.post("/fiatAccounts", requireAuth, validateResultCountry, AlfredpayController.addFiatAccount); -router.get("/fiatAccounts", requireAuth, validateResultCountry, AlfredpayController.listFiatAccounts); -router.delete("/fiatAccounts/:fiatAccountId", requireAuth, validateResultCountry, AlfredpayController.deleteFiatAccount); +// Fiat accounts (USD + MXN) — accept user-scoped secret API keys (sk_*) or Supabase Bearer +// via requirePartnerOrUserAuth, so SDK/server integrations can manage fiat accounts without +// a Supabase session. +router.post("/fiatAccounts", requirePartnerOrUserAuth(), validateResultCountry, AlfredpayController.addFiatAccount); +router.get("/fiatAccounts", requirePartnerOrUserAuth(), validateResultCountry, AlfredpayController.listFiatAccounts); +router.delete( + "/fiatAccounts/:fiatAccountId", + requirePartnerOrUserAuth(), + validateResultCountry, + AlfredpayController.deleteFiatAccount +); export default router; diff --git a/docs/security-spec/05-integrations/alfredpay.md b/docs/security-spec/05-integrations/alfredpay.md index 8af4207ac..293075f27 100644 --- a/docs/security-spec/05-integrations/alfredpay.md +++ b/docs/security-spec/05-integrations/alfredpay.md @@ -35,6 +35,8 @@ For routed Alfredpay onramps (any non-passthrough output), the final quote outpu **Request validation:** Alfredpay middleware (`alfredpay.middleware.ts`) validates the `country` parameter against the `AlfredPayCountry` enum for all Alfredpay-related requests. +**Fiat account routes:** `POST/GET/DELETE /v1/alfredpay/fiatAccounts` accept either a Supabase Bearer token (frontend/user-session) or a user-scoped secret API key (SDK/server integration) via `requirePartnerOrUserAuth()`. The controller resolves the operating user via `getEffectiveUserId(req)` so that `AlfredPayCustomer.findOne({ where: { userId, country } })` returns the linked customer regardless of which credential was presented. The remaining Alfredpay routes (KYC/KYB/customer creation/status) continue to require a Supabase Bearer session via `requireAuth` because KYC/KYB submission is a browser-mediated flow. + ## Security Invariants 1. **Alfredpay API credentials MUST be stored as environment variables** — Never hardcoded or in database. diff --git a/packages/sdk/src/VortexSdk.ts b/packages/sdk/src/VortexSdk.ts index 818e02a85..cec8f841a 100644 --- a/packages/sdk/src/VortexSdk.ts +++ b/packages/sdk/src/VortexSdk.ts @@ -1,5 +1,7 @@ import { AccountMeta, + AlfredPayCountry, + AlfredpayFiatAccount, CreateQuoteRequest, createMoonbeamEphemeral, createPendulumEphemeral, @@ -95,6 +97,10 @@ export class VortexSdk { return this.apiService.getQuote(quoteId); } + async listAlfredpayFiatAccounts(country: AlfredPayCountry): Promise { + return this.apiService.listAlfredpayFiatAccounts(country); + } + async getRampStatus(rampId: string): Promise { return this.apiService.getRampStatus(rampId); } diff --git a/packages/sdk/src/services/ApiService.ts b/packages/sdk/src/services/ApiService.ts index 40d43dd42..ff4ac8b58 100644 --- a/packages/sdk/src/services/ApiService.ts +++ b/packages/sdk/src/services/ApiService.ts @@ -1,4 +1,6 @@ import type { + AlfredPayCountry, + AlfredpayFiatAccount, CreateQuoteRequest, GetRampStatusResponse, QuoteResponse, @@ -127,4 +129,16 @@ export class ApiService { return handleAPIResponse<{ valid: boolean }>(response, "/v1/brla/validatePixKey"); } + + async listAlfredpayFiatAccounts(country: AlfredPayCountry): Promise { + const url = new URL(`${this.apiBaseUrl}/v1/alfredpay/fiatAccounts`); + url.searchParams.append("country", country); + + const response = await fetch(url.toString(), { + headers: this.buildHeaders(), + method: "GET" + }); + + return handleAPIResponse(response, `/v1/alfredpay/fiatAccounts?country=${country}`); + } } diff --git a/packages/sdk/src/types.ts b/packages/sdk/src/types.ts index 1bef65096..34e152b41 100644 --- a/packages/sdk/src/types.ts +++ b/packages/sdk/src/types.ts @@ -1,7 +1,16 @@ // Types re-exported used to create quotes. -import type { CreateQuoteRequest, EvmTransactionData, PaymentMethod, QuoteResponse, SignedTypedData } from "@vortexfi/shared"; +import type { + AlfredpayFiatAccount, + CreateQuoteRequest, + EvmTransactionData, + PaymentMethod, + QuoteResponse, + SignedTypedData +} from "@vortexfi/shared"; import { + AlfredPayCountry, + AlfredpayFiatAccountType, EPaymentMethod, EphemeralAccount, EphemeralAccountType, @@ -13,8 +22,8 @@ import { UnsignedTx } from "@vortexfi/shared"; -export type { CreateQuoteRequest, EvmTransactionData, PaymentMethod, QuoteResponse }; -export { EPaymentMethod, EvmToken, FiatToken, Networks, RampDirection }; +export type { AlfredpayFiatAccount, CreateQuoteRequest, EvmTransactionData, PaymentMethod, QuoteResponse }; +export { AlfredPayCountry, AlfredpayFiatAccountType, EPaymentMethod, EvmToken, FiatToken, Networks, RampDirection }; export type AnyQuote = | BrlOnrampQuote From 1638271088a39451602412de2afdad6c71310200 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 29 Jun 2026 17:24:35 +0200 Subject: [PATCH 046/176] fix(api): require user context for Alfredpay flows --- .../controllers/alfredpay.controller.test.ts | 47 +++++++++ .../api/controllers/alfredpay.controller.ts | 23 +++-- .../userApiKeys.controller.test.ts | 72 ++++++++++++++ .../api/controllers/userApiKeys.controller.ts | 16 ++- apps/api/src/api/routes/v1/ramp.route.ts | 2 +- .../api/services/quote/alfredpay-customer.ts | 20 ++-- .../quote/engines/alfredpay-auth.test.ts | 99 +++++++++++++++++++ .../engines/initialize/onramp-alfredpay.ts | 5 +- .../engines/partners/offramp-alfredpay.ts | 5 +- 9 files changed, 264 insertions(+), 25 deletions(-) create mode 100644 apps/api/src/api/controllers/alfredpay.controller.test.ts create mode 100644 apps/api/src/api/controllers/userApiKeys.controller.test.ts create mode 100644 apps/api/src/api/services/quote/engines/alfredpay-auth.test.ts diff --git a/apps/api/src/api/controllers/alfredpay.controller.test.ts b/apps/api/src/api/controllers/alfredpay.controller.test.ts new file mode 100644 index 000000000..be53c0690 --- /dev/null +++ b/apps/api/src/api/controllers/alfredpay.controller.test.ts @@ -0,0 +1,47 @@ +import { afterEach, describe, expect, it, mock } from "bun:test"; +import httpStatus from "http-status"; +import logger from "../../config/logger"; +import { AlfredpayController } from "./alfredpay.controller"; + +function createResponse() { + const res = { + body: undefined as unknown, + json: mock((body: unknown) => { + res.body = body; + return res; + }), + status: mock((statusCode: number) => { + res.statusCode = statusCode; + return res; + }), + statusCode: Number(httpStatus.OK) + }; + + return res; +} + +describe("Alfredpay fiat account endpoints", () => { + const originalLoggerError = logger.error; + + afterEach(() => { + logger.error = originalLoggerError; + }); + + it("returns a user-binding error for valid secret keys that are not linked to a user", async () => { + logger.error = mock(() => logger) as typeof logger.error; + + const res = createResponse(); + await AlfredpayController.listFiatAccounts( + { + authenticatedPartner: { id: "partner-1", name: "Partner" }, + query: { country: "MX" } + } as never, + res as never + ); + + expect(res.statusCode).toBe(httpStatus.BAD_REQUEST); + expect(res.body).toEqual({ + error: "This endpoint requires an API key linked to a user or Supabase user authentication." + }); + }); +}); diff --git a/apps/api/src/api/controllers/alfredpay.controller.ts b/apps/api/src/api/controllers/alfredpay.controller.ts index 4dc902c3e..6ea82acd0 100644 --- a/apps/api/src/api/controllers/alfredpay.controller.ts +++ b/apps/api/src/api/controllers/alfredpay.controller.ts @@ -22,9 +22,11 @@ import { SubmitKycInformationRequest } from "@vortexfi/shared"; import { Request, Response } from "express"; +import httpStatus from "http-status"; import logger from "../../config/logger"; import AlfredPayCustomer from "../../models/alfredPayCustomer.model"; import { getEffectiveUserId } from "../middlewares/effectiveUser"; +import { ALFREDPAY_EFFECTIVE_USER_REQUIRED_MESSAGE } from "../services/quote/alfredpay-customer"; export class AlfredpayController { private static getRequiredUserId(req: Request): string { @@ -38,11 +40,21 @@ export class AlfredpayController { private static getFiatAccountUserId(req: Request): string { const userId = getEffectiveUserId(req); if (!userId) { - throw new Error("Authenticated user id not available"); + throw new Error(ALFREDPAY_EFFECTIVE_USER_REQUIRED_MESSAGE); } return userId; } + private static handleFiatAccountError(operation: string, error: unknown, res: Response) { + logger.error(`Error ${operation} fiat account:`, error); + if (error instanceof Error && error.message === ALFREDPAY_EFFECTIVE_USER_REQUIRED_MESSAGE) { + return res.status(httpStatus.BAD_REQUEST).json({ + error: "This endpoint requires an API key linked to a user or Supabase user authentication." + }); + } + return res.status(httpStatus.INTERNAL_SERVER_ERROR).json({ error: "Internal server error" }); + } + private static getErrorMessage(error: unknown): string { return error instanceof Error ? error.message : String(error); } @@ -875,8 +887,7 @@ export class AlfredpayController { res.json(result); } catch (error) { - logger.error("Error adding fiat account:", error); - res.status(500).json({ error: "Internal server error" }); + AlfredpayController.handleFiatAccountError("adding", error, res); } } @@ -899,8 +910,7 @@ export class AlfredpayController { res.json(accounts); } catch (error) { - logger.error("Error listing fiat accounts:", error); - res.status(500).json({ error: "Internal server error" }); + AlfredpayController.handleFiatAccountError("listing", error, res); } } @@ -924,8 +934,7 @@ export class AlfredpayController { res.status(204).send(); } catch (error) { - logger.error("Error deleting fiat account:", error); - res.status(500).json({ error: "Internal server error" }); + AlfredpayController.handleFiatAccountError("deleting", error, res); } } } diff --git a/apps/api/src/api/controllers/userApiKeys.controller.test.ts b/apps/api/src/api/controllers/userApiKeys.controller.test.ts new file mode 100644 index 000000000..f6838683c --- /dev/null +++ b/apps/api/src/api/controllers/userApiKeys.controller.test.ts @@ -0,0 +1,72 @@ +import { afterEach, describe, expect, it, mock } from "bun:test"; +import httpStatus from "http-status"; +import ApiKey from "../../models/apiKey.model"; +import { revokeUserApiKey } from "./userApiKeys.controller"; + +function createResponse() { + const res = { + body: undefined as unknown, + send: mock(() => res), + statusCode: Number(httpStatus.OK), + json: mock((body: unknown) => { + res.body = body; + return res; + }), + status: mock((statusCode: number) => { + res.statusCode = statusCode; + return res; + }) + }; + + return res; +} + +describe("revokeUserApiKey", () => { + const originalFindOne = ApiKey.findOne; + + afterEach(() => { + ApiKey.findOne = originalFindOne; + }); + + it("revokes default-named public and secret keys as one pair", async () => { + const updates: Array<{ id: string; changes: unknown }> = []; + const secretKey = { + id: "secret-key-id", + keyType: "secret", + name: "Secret Key", + update: mock(async (changes: unknown) => { + updates.push({ changes, id: "secret-key-id" }); + }) + }; + const publicKey = { + id: "public-key-id", + keyType: "public", + name: "Public Key", + update: mock(async (changes: unknown) => { + updates.push({ changes, id: "public-key-id" }); + }) + }; + + ApiKey.findOne = mock(async ({ where }: { where: { id: string } }) => { + if (where.id === "secret-key-id") return secretKey; + if (where.id === "public-key-id") return publicKey; + return null; + }) as unknown as typeof ApiKey.findOne; + + const res = createResponse(); + await revokeUserApiKey( + { + body: { publicKeyId: "public-key-id" }, + params: { keyId: "secret-key-id" }, + userId: "user-1" + } as never, + res as never + ); + + expect(res.statusCode).toBe(httpStatus.NO_CONTENT); + expect(updates).toEqual([ + { changes: { isActive: false }, id: "secret-key-id" }, + { changes: { isActive: false }, id: "public-key-id" } + ]); + }); +}); diff --git a/apps/api/src/api/controllers/userApiKeys.controller.ts b/apps/api/src/api/controllers/userApiKeys.controller.ts index aa04682cf..c7a4338b8 100644 --- a/apps/api/src/api/controllers/userApiKeys.controller.ts +++ b/apps/api/src/api/controllers/userApiKeys.controller.ts @@ -55,7 +55,7 @@ export async function createUserApiKey(req: Request, res: Response): Promise, res: Response): Promise { const userId = req.userId; if (!userId) { @@ -235,8 +243,8 @@ export async function revokeUserApiKey(req: Request<{ keyId: string }>, res: Res return; } - const baseName = stripSuffix(primaryKey.name ?? ""); - const pairedBaseName = stripSuffix(pairedKey.name ?? ""); + const baseName = keyPairBaseName(primaryKey.name ?? ""); + const pairedBaseName = keyPairBaseName(pairedKey.name ?? ""); if (primaryKey.name && pairedKey.name && baseName !== pairedBaseName) { res.status(httpStatus.BAD_REQUEST).json({ error: { diff --git a/apps/api/src/api/routes/v1/ramp.route.ts b/apps/api/src/api/routes/v1/ramp.route.ts index aa8e589b3..3d73aaeef 100644 --- a/apps/api/src/api/routes/v1/ramp.route.ts +++ b/apps/api/src/api/routes/v1/ramp.route.ts @@ -34,7 +34,7 @@ const router = Router(); router.post( "/register", rejectDuringActiveMaintenance("ramp_register"), - optionalPartnerOrUserAuth(), + requirePartnerOrUserAuth(), rampController.registerRamp as unknown as RequestHandler ); diff --git a/apps/api/src/api/services/quote/alfredpay-customer.ts b/apps/api/src/api/services/quote/alfredpay-customer.ts index 1f802d168..79be75f1e 100644 --- a/apps/api/src/api/services/quote/alfredpay-customer.ts +++ b/apps/api/src/api/services/quote/alfredpay-customer.ts @@ -10,16 +10,18 @@ const fiatToCountry: Partial> = { [FiatToken.ARS]: AlfredPayCountry.AR }; -/** - * Sentinel `quoteId` value used by the Alfredpay quote engines when the quote - * was created without an authenticated user (anonymous quote). Real Alfredpay - * quote creation requires a KYC-completed customer id, so anonymous quotes - * cannot mint a real upstream `quoteId` here. - */ -export const ANONYMOUS_ALFREDPAY_QUOTE_ID = "__anonymous_alfredpay_quote__"; +export const ALFREDPAY_EFFECTIVE_USER_REQUIRED_MESSAGE = + "Alfredpay quote creation requires an API key linked to a user or Supabase user authentication."; + +export function requireAlfredpayEffectiveUserId(userId: string | undefined | null): string { + if (!userId) { + throw new APIError({ + message: ALFREDPAY_EFFECTIVE_USER_REQUIRED_MESSAGE, + status: httpStatus.BAD_REQUEST + }); + } -export function isAnonymousAlfredpayQuoteId(quoteId: string | undefined | null): boolean { - return quoteId === ANONYMOUS_ALFREDPAY_QUOTE_ID; + return userId; } /** diff --git a/apps/api/src/api/services/quote/engines/alfredpay-auth.test.ts b/apps/api/src/api/services/quote/engines/alfredpay-auth.test.ts new file mode 100644 index 000000000..dec13f134 --- /dev/null +++ b/apps/api/src/api/services/quote/engines/alfredpay-auth.test.ts @@ -0,0 +1,99 @@ +import { + AlfredpayApiService, + EPaymentMethod, + EvmToken, + FiatToken, + Networks, + RampDirection +} from "@vortexfi/shared"; +import Big from "big.js"; +import { afterEach, describe, expect, it, mock } from "bun:test"; +import { priceFeedService } from "../../priceFeed.service"; +import { createQuoteContext } from "../core/quote-context"; +import { OnRampInitializeAlfredpayEngine } from "./initialize/onramp-alfredpay"; +import { OfframpTransactionAlfredpayEngine } from "./partners/offramp-alfredpay"; + +describe("Alfredpay quote auth", () => { + const originalGetInstance = AlfredpayApiService.getInstance; + const originalConvertCurrency = priceFeedService.convertCurrency; + + afterEach(() => { + AlfredpayApiService.getInstance = originalGetInstance; + priceFeedService.convertCurrency = originalConvertCurrency; + }); + + it("rejects anonymous Alfredpay onramp quotes before calling Alfredpay", async () => { + AlfredpayApiService.getInstance = mock(() => { + throw new Error("Alfredpay upstream should not be called"); + }) as typeof AlfredpayApiService.getInstance; + + const ctx = createQuoteContext({ + partner: null, + request: { + from: EPaymentMethod.ACH, + inputAmount: "100", + inputCurrency: FiatToken.USD, + network: Networks.Polygon, + outputCurrency: EvmToken.USDC, + rampType: RampDirection.BUY, + to: Networks.Polygon + }, + targetFeeFiatCurrency: FiatToken.USD + }); + + await expect(new OnRampInitializeAlfredpayEngine().execute(ctx)).rejects.toThrow( + "Alfredpay quote creation requires an API key linked to a user or Supabase user authentication." + ); + }); + + it("rejects anonymous Alfredpay off-ramp quotes before calling Alfredpay", async () => { + priceFeedService.convertCurrency = mock(async () => "20") as typeof priceFeedService.convertCurrency; + AlfredpayApiService.getInstance = mock(() => { + throw new Error("Alfredpay upstream should not be called"); + }) as typeof AlfredpayApiService.getInstance; + + const ctx = createQuoteContext({ + partner: null, + request: { + from: Networks.Polygon, + inputAmount: "10", + inputCurrency: EvmToken.USDC, + network: Networks.Polygon, + outputCurrency: FiatToken.MXN, + rampType: RampDirection.SELL, + to: EPaymentMethod.SPEI + }, + targetFeeFiatCurrency: FiatToken.MXN + }); + ctx.evmToEvm = { + fromNetwork: Networks.Polygon, + fromToken: "0x0000000000000000000000000000000000000001", + inputAmountDecimal: new Big("10"), + inputAmountRaw: "10000000", + networkFeeUSD: "0", + outputAmountDecimal: new Big("10"), + outputAmountRaw: "10000000", + toNetwork: Networks.Polygon, + toToken: "0x0000000000000000000000000000000000000002" + }; + ctx.subsidy = { + actualOutputAmountDecimal: new Big("10"), + actualOutputAmountRaw: "10000000", + applied: false, + expectedOutputAmountDecimal: new Big("10"), + expectedOutputAmountRaw: "10000000", + idealSubsidyAmountInOutputTokenDecimal: new Big("0"), + idealSubsidyAmountInOutputTokenRaw: "0", + partnerId: null, + subsidyAmountInOutputTokenDecimal: new Big("0"), + subsidyAmountInOutputTokenRaw: "0", + subsidyRate: new Big("0"), + targetOutputAmountDecimal: new Big("10"), + targetOutputAmountRaw: "10000000" + }; + + await expect(new OfframpTransactionAlfredpayEngine().execute(ctx)).rejects.toThrow( + "Alfredpay quote creation requires an API key linked to a user or Supabase user authentication." + ); + }); +}); diff --git a/apps/api/src/api/services/quote/engines/initialize/onramp-alfredpay.ts b/apps/api/src/api/services/quote/engines/initialize/onramp-alfredpay.ts index b694a4459..18bc8d4f8 100644 --- a/apps/api/src/api/services/quote/engines/initialize/onramp-alfredpay.ts +++ b/apps/api/src/api/services/quote/engines/initialize/onramp-alfredpay.ts @@ -10,7 +10,7 @@ import { RampDirection } from "@vortexfi/shared"; import Big from "big.js"; -import { resolveAlfredpayCustomerId } from "../../alfredpay-customer"; +import { requireAlfredpayEffectiveUserId, resolveAlfredpayCustomerId } from "../../alfredpay-customer"; import { QuoteContext } from "../../core/types"; import { BaseInitializeEngine } from "./index"; @@ -22,12 +22,13 @@ export class OnRampInitializeAlfredpayEngine extends BaseInitializeEngine { protected async executeInternal(ctx: QuoteContext): Promise { const req = ctx.request; + const effectiveUserId = requireAlfredpayEffectiveUserId(req.userId); const usdTokenDecimals = ALFREDPAY_ERC20_DECIMALS; const inputAmountDecimal = new Big(req.inputAmount); const alfredpayService = AlfredpayApiService.getInstance(); - const customerId = req.userId ? await resolveAlfredpayCustomerId(req.inputCurrency, req.userId) : "unknown"; + const customerId = await resolveAlfredpayCustomerId(req.inputCurrency, effectiveUserId); const quoteRequest: CreateAlfredpayOnrampQuoteRequest = { chain: AlfredpayChain.MATIC, diff --git a/apps/api/src/api/services/quote/engines/partners/offramp-alfredpay.ts b/apps/api/src/api/services/quote/engines/partners/offramp-alfredpay.ts index dc8f15c2a..edf7e26bb 100644 --- a/apps/api/src/api/services/quote/engines/partners/offramp-alfredpay.ts +++ b/apps/api/src/api/services/quote/engines/partners/offramp-alfredpay.ts @@ -12,7 +12,7 @@ import { } from "@vortexfi/shared"; import Big from "big.js"; import { priceFeedService } from "../../../priceFeed.service"; -import { resolveAlfredpayCustomerId } from "../../alfredpay-customer"; +import { requireAlfredpayEffectiveUserId, resolveAlfredpayCustomerId } from "../../alfredpay-customer"; import { QuoteContext } from "../../core/types"; import { BaseInitializeEngine } from "./../initialize/index"; @@ -24,6 +24,7 @@ export class OfframpTransactionAlfredpayEngine extends BaseInitializeEngine { protected async executeInternal(ctx: QuoteContext): Promise { const req = ctx.request; + const effectiveUserId = requireAlfredpayEffectiveUserId(req.userId); if (!ctx.evmToEvm) { throw new Error("OfframpTransactionAlfredpayEngine: No evmToEvm quote"); @@ -46,7 +47,7 @@ export class OfframpTransactionAlfredpayEngine extends BaseInitializeEngine { ? ctx.subsidy.targetOutputAmountDecimal.div(effectiveRate).round(ALFREDPAY_ERC20_DECIMALS, Big.roundDown) : ctx.evmToEvm.outputAmountDecimal.minus(deductibleFee).round(ALFREDPAY_ERC20_DECIMALS, Big.roundDown); - const customerId = req.userId ? await resolveAlfredpayCustomerId(req.outputCurrency, req.userId) : "unknown"; + const customerId = await resolveAlfredpayCustomerId(req.outputCurrency, effectiveUserId); const alfredpayService = AlfredpayApiService.getInstance(); const quoteRequest: CreateAlfredpayOfframpQuoteRequest = { From 7f71247d3e0ed23f426ea3445955005884ac37cf Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 29 Jun 2026 17:24:57 +0200 Subject: [PATCH 047/176] docs(security): align API key auth specs --- docs/security-spec/01-auth/api-keys.md | 12 ++++++------ docs/security-spec/03-ramp-engine/quote-lifecycle.md | 5 ++++- docs/security-spec/05-integrations/alfredpay.md | 7 ++++--- docs/security-spec/05-integrations/brla.md | 4 ++-- docs/security-spec/07-operations/api-surface.md | 2 +- docs/security-spec/SPEC-DELTA-2026-05.md | 10 +++++----- 6 files changed, 22 insertions(+), 18 deletions(-) diff --git a/docs/security-spec/01-auth/api-keys.md b/docs/security-spec/01-auth/api-keys.md index 7e9854ee8..1fb3ac884 100644 --- a/docs/security-spec/01-auth/api-keys.md +++ b/docs/security-spec/01-auth/api-keys.md @@ -16,7 +16,7 @@ Three middleware components: ### Optional user binding (`api_keys.user_id`) -A nullable `user_id` column on `api_keys` (FK to `profiles.id`, `ON DELETE SET NULL`) lets an admin bind a secret key to a specific profile. The binding is propagated to the request as `req.apiKeyUserId` (set by `setApiKeyUserId` in the auth middleware). Controllers and services derive the **effective user id** with `getEffectiveUserId(req)`, which prefers `req.userId` (Supabase) and falls back to `req.apiKeyUserId`. Public keys never populate `req.apiKeyUserId`. Use of the effective user is required for provider-backed quote creation, ramp registration on Avenia/BRL or Alfredpay corridors, and the BRLA pre-flight endpoints. +A nullable `user_id` column on `api_keys` (FK to `profiles.id`, `ON DELETE SET NULL`) lets an admin bind a secret key to a specific profile. The binding is propagated to the request as `req.apiKeyUserId` (set by `setApiKeyUserId` in the auth middleware). Controllers and services derive the **effective user id** with `getEffectiveUserId(req)`, which prefers `req.userId` (Supabase) and falls back to `req.apiKeyUserId`. Public keys never populate `req.apiKeyUserId`. Use of the effective user is required for Alfredpay quote creation, ramp registration on Avenia/BRL or Alfredpay corridors, Alfredpay fiat-account management, and the BRLA pre-flight endpoints. ### User-scoped keys (`api_keys.partner_name` nullable) @@ -44,7 +44,7 @@ A nullable `user_id` column on `api_keys` (FK to `profiles.id`, `ON DELETE SET N 10. **Key generation MUST use cryptographically secure randomness** — `crypto.randomBytes(32)` is the source. Base64 encoding with character stripping is used to produce the 32-char alphanumeric portion. 11. **Secret keys MAY carry a nullable `api_keys.user_id` to identify a delegated user context** — The binding is consumed by the `apiKeyUserId` request field and is the only path for partner secret keys to provide a non-Supabase user identity. Public keys never carry or surface a user binding. 12. **`ON DELETE SET NULL` for `api_keys.user_id` is intentional** — Deleting a profile must not silently revoke partner keys; partner keys are operational assets and binding loss is a soft-state change. -13. **Provider-backed quote and ramp operations MUST be rejected when no effective user is present** — Alfredpay and Avenia/BRL flows return `400 Invalid quote: this route requires an API key linked to a user or Supabase user authentication.` before any upstream provider call. Unlinked secret keys are not a valid identity for these corridors. +13. **Alfredpay quote creation and all ramp registration MUST be rejected when no effective user is present** — Alfredpay quote engines return `400 Alfredpay quote creation requires an API key linked to a user or Supabase user authentication.` before any upstream Alfredpay quote call. `POST /v1/ramp/register` requires a Supabase user or linked secret key and `RampService.registerRamp` also rejects missing effective users with `400 Invalid quote: this route requires an API key linked to a user or Supabase user authentication.`. BRL quote creation remains anonymous-eligible, but BRL ramp registration is user-gated because the Avenia subaccount is derived from the effective user. Unlinked secret keys are not a valid identity for these corridors. 14. **`api_keys.partner_name` is nullable; a NULL `partner_name` marks a user-scoped key** — `validateSecretApiKey` skips the `Partner` lookup entirely for keys with `partner_name = NULL` and `user_id` set, returning `{ partner: null, apiKeyUserId }`. The middleware leaves `req.authenticatedPartner` unset, so the request authenticates purely as the linked user. A secret key with neither `partner_name` nor `user_id` is unusable and rejected as invalid. 15. **User-scoped keys MUST interpolate no partner pricing** — When `req.authenticatedPartner` is unset, `resolveQuotePartner` finds no partner (`source: "none"`), and `calculatePartnerAndVortexFees` falls through to the default `vortex` Partner fee rows. User-scoped keys never receive partner-specific discounts. 16. **`POST/GET/DELETE /v1/api-keys` MUST require a Supabase user (`requireAuth`)** — The endpoints bind the created keys to `req.userId`; partner keys (with `partner_name`) remain admin-only under `/v1/admin/partners/:partnerName/api-keys` (`adminAuth`). @@ -59,13 +59,13 @@ A nullable `user_id` column on `api_keys` (FK to `profiles.id`, `ON DELETE SET N | **Partner impersonation** | Attacker uses one partner's API key with another partner's `partnerId` | `enforcePartnerAuth` compares authenticated partner name against requested partner name; rejects mismatches with 403 | | **Stale/revoked key usage** | Partner's key is deactivated but still being used | `isActive` flag checked on every validation; expired keys rejected by `expiresAt` check | | **Key hash enumeration** | Attacker with DB read access tries to use key hashes | bcrypt hashes are one-way; raw keys cannot be recovered from hashes | -| **Unlinked key creating provider resources anonymously** | Partner uses a generic (unbound) sk\_ key to mint an Alfredpay/Avenia estimate quote, then registers it with a linked secret key or Supabase session to claim the resulting real provider quote | Quote creation is anonymous-eligible (the Alfredpay engines short-circuit on no effective user and store a sentinel `ANONYMOUS_ALFREDPAY_QUOTE_ID`). `RampService.registerRamp` rejects with `403` when `quote.userId == null && request.userId != null`, so the anonymous estimate cannot be claimed by an authenticated caller. Alfredpay engines resolve the customer via `api_keys.user_id -> alfredpay_customers.user_id` whenever an effective user is present. | +| **Unlinked key creating provider resources anonymously** | Partner uses a generic (unbound) sk\_ key to mint provider-side resources, then registers with a linked secret key or Supabase session to claim them | Alfredpay quote engines reject before any upstream provider call unless an effective user exists and resolves to a completed Alfredpay customer. BRL quote creation can remain an anonymous estimate, but `POST /v1/ramp/register` requires credentials and `RampService.registerRamp` rejects missing effective users or authenticated attempts to claim a quote created without `quote.userId`. | | **One linked key operating on another user's quote/ramp** | Partner with a valid linked key targets a different linked user's provider-bound quote | `assertQuoteOwnership`/`assertRampOwnership` enforce `quote.userId === req.apiKeyUserId` when a linked key is in scope. The `RampService.registerRamp` cross-user check rejects the same scenario at registration time with `403`. | | **Anonymous subaccount creation DoS** | Unauthenticated caller hits `POST /v1/brla/createSubaccount` to spawn stranded Avenia subaccounts | The route now requires `requirePartnerOrUserAuth()`; controllers require an effective user id before calling the Avenia API. | ## Audit Checklist -- [x] All endpoints requiring partner auth use `apiKeyAuth({ required: true })` or `enforcePartnerAuth()` — **PASS: `enforcePartnerAuth()` is now active on `POST /v1/ramp/quotes` and `POST /v1/ramp/quotes/best`. Ramp endpoints additionally enforce sk_ OR Supabase via `requirePartnerOrUserAuth()` (history) or `optionalPartnerOrUserAuth()` (register/update/start/status/errors). Anonymous access is permitted on the optional set only when the underlying quote/ramp is fully anonymous (no partner, no user owner).** +- [x] All endpoints requiring partner auth use `apiKeyAuth({ required: true })` or `enforcePartnerAuth()` — **PASS: `enforcePartnerAuth()` is active on `POST /v1/ramp/quotes` and `POST /v1/ramp/quotes/best`. `POST /v1/ramp/register` now requires sk_ OR Supabase via `requirePartnerOrUserAuth()`. Update/start/status/errors still use `optionalPartnerOrUserAuth()` so legacy fully-anonymous ramps can be inspected or advanced only when ownership checks allow it.** - [x] Secret key validation (`validateSecretApiKey`) always uses bcrypt comparison, never plaintext comparison — **PASS** - [x] Public key validation (`validatePublicApiKey`) stores keys in plaintext (by design for lookup) but never returns auth credentials — **PASS** - [x] `getKeyType()` correctly identifies `pk_` as public, `sk_` as secret, and anything else as `null` — **PASS** @@ -85,7 +85,7 @@ A nullable `user_id` column on `api_keys` (FK to `profiles.id`, `ON DELETE SET N - [x] `getEffectiveUserId` returns `req.userId ?? req.apiKeyUserId`. — **PASS** - [x] User-scoped keys interpolate no partner pricing (`resolveQuotePartner` returns `source: "none"`, fee engine falls through to default `vortex` Partner rows). — **PASS** - [x] `POST/GET/DELETE /v1/api-keys` require `requireAuth` (Supabase Bearer); bind created keys to `req.userId` with `partner_name = NULL`. Admin partner-key endpoints still require `adminAuth`. — **PASS** -- [x] Provider-backed quote creation is anonymous-eligible: Alfredpay engines short-circuit on no effective user and store `ANONYMOUS_ALFREDPAY_QUOTE_ID`; Avenia engines call upstream providers regardless of identity. — **PASS** -- [x] `RampService.registerRamp` rejects ramps without an effective user with `400 Invalid quote`. — **PASS** +- [x] Alfredpay quote creation rejects missing effective users before calling Alfredpay; BRL quote creation remains anonymous-eligible because Avenia quotes do not require user-bound provider identity. — **PASS** +- [x] `POST /v1/ramp/register` and `RampService.registerRamp` reject ramp registration without an effective user with `401` at the route or `400 Invalid quote` at the service boundary. — **PASS** - [x] `RampService.registerRamp` rejects anonymous quotes from being claimed by an authenticated caller with `403` (`quote.userId == null && request.userId != null`). — **PASS** - [x] `assertQuoteOwnership` and `assertRampOwnership` reject linked-key callers who try to operate on a different linked user's quote/ramp. — **PASS** diff --git a/docs/security-spec/03-ramp-engine/quote-lifecycle.md b/docs/security-spec/03-ramp-engine/quote-lifecycle.md index 802354c5e..fd9bf5141 100644 --- a/docs/security-spec/03-ramp-engine/quote-lifecycle.md +++ b/docs/security-spec/03-ramp-engine/quote-lifecycle.md @@ -74,6 +74,9 @@ The refresh policy is intentionally strict (byte-identical `toAmount` and `fee` 15. **Provider-backed quote creation MUST NOT call upstream providers with placeholder user identity** — Alfredpay and Avenia/BRL corridors must not create upstream provider quotes with `customerId: "unknown"`. Quote-time engines short-circuit the Alfredpay call when no effective user is present, populate `ctx.alfredpayMint` / `ctx.alfredpayOfframp` with oracle-rate-based estimates and a sentinel `quoteId` (`ANONYMOUS_ALFREDPAY_QUOTE_ID`), and surface the estimate to the caller. The fresh Alfredpay quote is then created and persisted at register time once the user is authenticated, so the final ramp state always carries a real provider `quoteId`. Crypto-only/internal corridors remain anonymous. **Register/start remains blocked for all corridors** (not just provider-backed) without an effective user via the universal `RampService.registerRamp` check. 16. **Provider-backed ramp registration MUST derive the sender's tax ID / Alfredpay customer from the effective user, not from request body** — BRL/Avenia tax ID and Alfredpay `alfredPayId` are resolved server-side via `api_keys.user_id -> tax_ids.user_id` and `api_keys.user_id -> alfredpay_customers.user_id` respectively. Client-supplied `additionalData.taxId` is accepted only for backward compatibility and MUST match the derived sender value or the request is rejected with `400`. The `receiverTaxId` (where it differs from the sender — e.g. third-party PIX recipient) is supplied by the client and is allowed to differ from the derived sender tax ID; it is validated downstream against the PIX key owner by `validateBrlaOfframpRequest` / `validateMaskedNumber`. The `RampService.registerRamp` quote/user consistency check ensures the caller cannot register a provider-backed quote using a different user context. 17. **Quote registration MUST use the same principal at quote and register time** — An anonymous quote (one with `quote.userId = null`, produced by the short-circuit path in inv. 14) cannot be claimed by an authenticated caller. `RampService.registerRamp` rejects with `403` when `quote.userId == null && request.userId != null`. The register principal must obtain a new quote with their identity (Supabase session or linked secret API key) so `quote.userId` is bound at quote time. Combined with the universal userId requirement (inv. 14), anonymous quotes are effectively unregistrable for all corridors. +14. **Alfredpay quote creation MUST NOT call upstream providers with placeholder user identity** — Alfredpay corridors reject when no effective user is present and must never create upstream provider quotes with `customerId: "unknown"`. BRL/Avenia quote creation remains anonymous-eligible because Avenia quotes do not require a user-bound provider identity. **Register/start remains blocked for all corridors** without an effective user via route-level auth and the universal `RampService.registerRamp` check. +15. **Provider-backed ramp registration MUST derive the sender's tax ID / Alfredpay customer from the effective user, not from request body** — BRL/Avenia tax ID and Alfredpay `alfredPayId` are resolved server-side via `api_keys.user_id -> tax_ids.user_id` and `api_keys.user_id -> alfredpay_customers.user_id` respectively. Client-supplied `additionalData.taxId` is accepted only for backward compatibility and MUST match the derived sender value or the request is rejected with `400`. The `receiverTaxId` (where it differs from the sender — e.g. third-party PIX recipient) is supplied by the client and is allowed to differ from the derived sender tax ID; it is validated downstream against the PIX key owner by `validateBrlaOfframpRequest` / `validateMaskedNumber`. The `RampService.registerRamp` quote/user consistency check ensures the caller cannot register a provider-backed quote using a different user context. +16. **Quote registration MUST use the same principal at quote and register time** — An anonymous quote (one with `quote.userId = null`, e.g. a BRL quote estimate created without credentials) cannot be claimed by an authenticated caller. `RampService.registerRamp` rejects with `403` when `quote.userId == null && request.userId != null`. The register principal must obtain a new quote with their identity (Supabase session or linked secret API key) so `quote.userId` is bound at quote time. Combined with the universal userId requirement (inv. 14), anonymous quotes are effectively unregistrable for all corridors. ## Threat Vectors & Mitigations @@ -108,7 +111,7 @@ The refresh policy is intentionally strict (byte-identical `toAmount` and `fee` - [x] Quote response does not include internal implementation details (e.g., the `adjustedDifference` or `adjustedTargetDiscount` values). **PASS** — verified: response includes only user-facing fields (amounts, fees, expiry). - [x] Quote amounts (input, output, fees) are immutable once stored — no UPDATE endpoint modifies them. **PASS** — no quote mutation endpoints exist. - [x] EVM onramp output precision follows destination token decimals where the quote output comes from Squid. **PASS** — BRL/EURC Base→EVM and routed Alfredpay USD/MXN/COP/ARS Polygon→EVM finalization preserve destination token precision before downstream raw transfer construction. Direct same-chain same-token passthrough remains at minted/source-token precision. -- [PARTIAL] Authentication is enforced on quote creation (verify which auth mechanisms protect `POST /v1/ramp/quotes`). **PARTIAL** — quote creation is accessible via API key auth or Supabase auth; the endpoint is optional-auth by design (public quotes allowed for all corridors including Alfredpay/BRL; register/start require an effective user for all corridors). +- [PARTIAL] Authentication is enforced on quote creation (verify which auth mechanisms protect `POST /v1/ramp/quotes`). **PARTIAL** — quote creation is optional-auth by design for corridors that support public estimates (for example BRL). Alfredpay quote creation is user-gated inside the quote engines because upstream Alfredpay requires a real customer context; register/start require an effective user for all corridors. - [PARTIAL] Quote ownership is verified at ramp registration — the user/partner creating the ramp must match the quote creator. **PARTIAL** — no strict user-to-quote binding; mitigated by UUID unpredictability and 10-minute expiry. - [x] Profile-assigned quote pricing persists `pricing_partner_id` without granting partner ownership. **PASS** — profile-assigned quotes store `user_id`, leave `partner_id` `NULL`, and authorize through the user ownership path. - [x] Subsidy is only calculated when `targetDiscount > 0` — partners with no discount get `0` subsidy regardless of shortfall. **PASS** — verified in `calculateSubsidyAmount()`. diff --git a/docs/security-spec/05-integrations/alfredpay.md b/docs/security-spec/05-integrations/alfredpay.md index 293075f27..ca091cc1e 100644 --- a/docs/security-spec/05-integrations/alfredpay.md +++ b/docs/security-spec/05-integrations/alfredpay.md @@ -55,7 +55,7 @@ For routed Alfredpay onramps (any non-passthrough output), the final quote outpu 14. **`finalSettlementSubsidy` MUST NOT be skipped for Alfredpay offramps** — The `FinalSettlementSubsidyHandler` direct-transfer skip explicitly excludes `SELL && isAlfredpayToken(outputCurrency)`. This ensures the ephemeral on Polygon is always topped up to the expected amount before `alfredpayOfframpTransfer`, preventing under-funded settlements. 15. **Routed Alfredpay onramp quote output precision MUST match the destination token** — For Alfredpay USD/MXN/COP/ARS onramps that route through Squid, `quote.outputAmount` MUST preserve the final destination token's decimal precision, and `evmToEvm.outputAmountRaw` MUST represent the destination token's raw units. The Polygon-minted Alfredpay token is only the Squid source-side input. Direct Polygon same-token passthrough remains at the minted token's 6-decimal precision. 16. **Alfredpay ramp registration MUST bind to a completed KYC/KYB customer** — Registration MUST reject Alfredpay onramps before customer lookup when no completed Alfredpay customer context is available, and MUST reject customer records whose Alfredpay status is not `Success`. This prevents ramps from reaching provider/customer queries with undefined `user_id` and ensures payment instructions are only issued for verified Alfredpay customers. SDK/server integrations authenticate with partner API keys (`pk_*`/`sk_*`); Supabase Bearer tokens are frontend/user-session auth. -17. **Alfredpay quote creation and ramp registration MUST derive the customer id from the effective user, not `req.userId || "unknown"`** — The on-ramp initialize engine, the off-ramp partner engine, the off-ramp transaction route, and the off-ramp transfer recovery path all resolve `alfredPayId` via `resolveAlfredpayCustomerId(fiatCurrency, effectiveUserId)`. Public keys and unlinked secret keys cannot register Alfredpay ramps; the ramp-register user-consistency check rejects them with `400 Invalid quote` before any upstream provider call. **Anonymous quote creation is allowed for fully unauthenticated callers** (no Supabase session and no API key): when `getEffectiveUserId(req)` is empty the Alfredpay engines skip the upstream call, populate `ctx.alfredpayMint` / `ctx.alfredpayOfframp` with an oracle-rate-based estimate and the sentinel `quoteId` (`ANONYMOUS_ALFREDPAY_QUOTE_ID`), and surface the estimate to the caller. **An anonymous Alfredpay quote cannot be registered by an authenticated caller** — `RampService.registerRamp` rejects with `403 This anonymous provider-backed quote cannot be registered by an authenticated caller. Re-quote with the same principal to bind ownership.` when `quote.userId == null && request.userId != null`. The register principal must obtain a new quote with their identity (Supabase session or linked secret API key) so `quote.userId` is bound at quote time. The `persistFreshAlfredpayOnrampQuote` / `persistFreshAlfredpayOfframpQuote` helpers exist as a defensive measure for the (now unreachable) anonymous-placeholder branch; under the new gate, every registered ramp carries a real provider `quoteId` and `customerId`. +17. **Alfredpay quote creation and ramp registration MUST derive the customer id from the effective user, not `req.userId || "unknown"`** — The on-ramp initialize engine, the off-ramp partner engine, the off-ramp transaction route, and the off-ramp transfer recovery path all resolve `alfredPayId` via `resolveAlfredpayCustomerId(fiatCurrency, effectiveUserId)`. If no effective user is present, Alfredpay quote creation returns `400 Alfredpay quote creation requires an API key linked to a user or Supabase user authentication.` before any upstream Alfredpay call. Public keys and unlinked secret keys cannot create or register Alfredpay ramps. Under this gate, every registered Alfredpay ramp carries a real provider `quoteId` and `customerId` tied to the quote/register principal. ## Threat Vectors & Mitigations @@ -74,8 +74,8 @@ For routed Alfredpay onramps (any non-passthrough output), the final quote outpu | **Polygon passthrough rounding** | Same-chain same-token shortcut rounds the bridge output incorrectly, leaking dust or under-funding the destination | `toFixed(0, 0)` round-down in the squid-router finalize; downstream subsidy ensures the destination receives the quoted amount | | **Polygon wrong-token delivery** | A user on-ramps via Alfredpay and requests a non-USDT Polygon output (e.g. USDC); the handler skips the swap on destination-network alone and transfers the minted USDT, delivering the wrong asset | The `squidRouterSwap` short-circuit is gated on `quote.outputCurrency === ALFREDPAY_EVM_TOKEN` (not just `quote.metadata.request.to === Networks.Polygon`); non-USDT Polygon outputs run the real USDT→output swap. Matched in the quote engine's `skipRouteCalculation` branch. | | **Routed destination precision loss** | A USD/MXN/COP/ARS Alfredpay onramp mints a 6-decimal Polygon source token, routes to an 18-decimal destination token, and stores the final quote output with source precision. The final amount is truncated before destination-transfer expectations are calculated. | Finalize routed Alfredpay EVM quotes with the destination token's decimals when `evmToEvm` metadata exists; keep direct Polygon same-token passthrough at minted-token precision. | -| **Anonymous Alfredpay registration** | An SDK caller registers an Alfredpay onramp without a completed KYC customer context, causing undefined `user_id` customer lookups or issuing instructions without KYC context | Alfredpay onramp registration fails with a public auth/KYC error unless a `Success` Alfredpay customer record is available. SDK/server callers authenticate with partner API keys. Anonymous quote creation is intentionally allowed and returns an estimate; the real Alfredpay quote is only created at register time. An anonymous Alfredpay quote cannot be claimed by an authenticated caller — `RampService.registerRamp` rejects with `403` so an unauthenticated estimate cannot be bound to an unrelated user. | -| **Claiming an anonymous Alfredpay estimate at register time** | Attacker mints an anonymous Alfredpay quote, then presents a Supabase token (or a different user's linked secret API key) at register time to bind the resulting real Alfredpay quote to themselves | `RampService.registerRamp` rejects with `403` when `isProviderBackedRampKind(quote) && quote.userId == null && request.userId != null` (inv. 17). The register principal must re-quote with their identity so `quote.userId` is bound at quote time. | +| **Anonymous Alfredpay quote/resource creation** | An SDK caller requests an Alfredpay quote without a linked user, causing upstream quote resources to be created with placeholder customer identity | Alfredpay quote engines require an effective user before calling Alfredpay. Missing or unlinked credentials fail with `400`; no `customerId: "unknown"` provider call is made. | +| **Claiming an Alfredpay quote with a different user** | Attacker creates a quote under one linked user, then presents another Supabase token or linked secret key at register time | `RampService.registerRamp` rejects cross-user quote registration with `403`; Alfredpay customer lookup is performed from the effective user at quote and register time. | ## Audit Checklist @@ -101,3 +101,4 @@ For routed Alfredpay onramps (any non-passthrough output), the final quote outpu - [x] AlfredPay offramp order is created at prep time (`evm-to-alfredpay.ts:229`); `processAlfredpayOfframpStart` is a defensive validation-only no-op. **PASS** — verified. - [x] Routed Alfredpay onramp quote output precision follows destination token decimals when `evmToEvm` metadata exists; direct Polygon same-token passthrough remains at minted-token precision. **PASS** — verified in `finalize/onramp.ts`. - [x] Alfredpay onramp registration rejects missing customer context before customer lookup and requires a `Success` Alfredpay customer status. **PASS** — `ramp.service.ts` checks for the current user-backed customer context; `alfredpay-to-evm.ts` rejects missing/non-success customer records. +- [x] Alfredpay quote engines reject missing effective users before `AlfredpayApiService.createOnrampQuote` / `createOfframpQuote`; no provider quote is created with placeholder customer identity. **PASS**. diff --git a/docs/security-spec/05-integrations/brla.md b/docs/security-spec/05-integrations/brla.md index 00e00e3a6..4aa4fc652 100644 --- a/docs/security-spec/05-integrations/brla.md +++ b/docs/security-spec/05-integrations/brla.md @@ -78,7 +78,7 @@ The invariant `transferAmount ≥ payoutAmount` must hold (transfer covers payou 16. **BRL register paths MUST derive tax ID / subaccount from the effective user** — `RampService.prepareOfframpBrlTransactions` and `RampService.prepareAveniaOnrampTransactions` resolve the Avenia account via `resolveAveniaAccountForUser(userId)` and call `validateBrlaOnrampRequest(derivedTaxId, ...)` / `validateBrlaOfframpRequest(derivedTaxId, ...)`. Client-supplied `additionalData.taxId` and `additionalData.receiverTaxId` are accepted only when they match the derived value; mismatches return `400`. 17. **`/v1/brla/getUser` and `/v1/brla/getUserRemainingLimit` MUST scope reads to the effective user** — When a `taxId` query is provided, the `TaxId` row MUST be owned by `getEffectiveUserId(req)`. When `taxId` is omitted, the endpoint derives the user's Avenia account via the resolver and returns `400` for zero or multiple KYC-completed matches. The legacy partner-key exemption that allowed reading any taxId has been removed; bare partner keys (no `api_keys.user_id` binding) and fully anonymous callers are rejected with `400`. 18. **`/v1/brla/createSubaccount` MUST require an authenticated principal** — The route now uses `requirePartnerOrUserAuth()` and the controller requires an effective user. Bare partner keys and anonymous callers receive `400`; the Avenia API is not called and no `TaxId` row is created. This closes the anonymous subaccount creation DoS surface. -19. **BRL quote creation MUST remain anonymous-eligible while register/start remain user-gated** — `POST /v1/quotes` and `POST /v1/quotes/best` accept BRL corridors from anonymous callers and partner-key callers (with or without a `userId` binding). The Avenia `createPayInQuote` calls used by the BRL engines do not require a user-bound principal. The actual Avenia subaccount/taxId resolution still happens server-side at register time via `resolveAveniaAccountForUser(effectiveUserId)`, and `RampService.registerRamp` rejects provider-backed ramps without an effective user with `400 Invalid quote`. **An anonymous BRL quote cannot be registered by an authenticated caller** — `RampService.registerRamp` rejects with `403` when `isProviderBackedRampKind(quote) && quote.userId == null && request.userId != null` (the same gate that covers Alfredpay), so an unauthenticated BRL estimate cannot be claimed by an unrelated user. +19. **BRL quote creation MUST remain anonymous-eligible while register/start remain user-gated** — `POST /v1/quotes` and `POST /v1/quotes/best` accept BRL corridors from anonymous callers and partner-key callers (with or without a `userId` binding). The Avenia `createPayInQuote` calls used by the BRL engines do not require a user-bound principal. The actual Avenia subaccount/taxId resolution still happens server-side at register time via `resolveAveniaAccountForUser(effectiveUserId)`. `POST /v1/ramp/register` requires Supabase or secret-key credentials, and `RampService.registerRamp` rejects provider-backed ramps without an effective user with `400 Invalid quote`. **An anonymous BRL quote cannot be registered by an authenticated caller** — `RampService.registerRamp` rejects with `403` when `quote.userId == null && request.userId != null`, so an unauthenticated BRL estimate cannot be claimed by an unrelated user. ## Threat Vectors & Mitigations @@ -96,7 +96,7 @@ The invariant `transferAmount ≥ payoutAmount` must hold (transfer covers payou | **Disabled AssetHub corridor accidentally re-enabled** | Legacy BRL↔AssetHub route files are selected and a user registers a route that the Base BRL rail no longer supports | Quote eligibility must return no quote for BRL→AssetHub and AssetHub→BRL. Treat any successful quote for those corridors as a regression until the corridor is intentionally re-enabled. | | **BRL→BRLA-Base self-swap drain** | The generic pipeline swaps the user's already-minted BRLA to USDC and back, charging two swaps of slippage/fees and triggering `finalSettlementSubsidy` against bridge-less dust (over-subsidy + strand) | `isBrlToBrlaBaseDirect` collapses the corridor to a single `destinationTransfer` with `isDirectTransfer = true`; Nabla/distributeFees/Squid/finalSettlementSubsidy/cleanup are skipped at both route-build and handler level. | | **Anonymous BRL register on someone else's subaccount** | An anonymous SDK caller (no Supabase session, no linked secret key) uses an anonymous BRL quote to register a ramp on top of another user's Avenia subaccount via the quoteId guess | `RampService.registerRamp` rejects provider-backed ramps without an effective user with `400 Invalid quote`; an attacker cannot bind a BRL ramp to a subaccount they do not own. | -| **Claiming an anonymous BRL estimate at register time** | Attacker mints an anonymous BRL quote, then presents a Supabase token (or a different user's linked secret API key) at register time to bind the resulting ramp to a different user's `TaxId` | `RampService.registerRamp` rejects with `403` when `isProviderBackedRampKind(quote) && quote.userId == null && request.userId != null` (inv. 19). The register principal must re-quote with their identity so `quote.userId` is bound at quote time. | +| **Claiming an anonymous BRL estimate at register time** | Attacker mints an anonymous BRL quote, then presents a Supabase token (or a different user's linked secret API key) at register time to bind the resulting ramp to a different user's `TaxId` | `RampService.registerRamp` rejects with `403` when `quote.userId == null && request.userId != null` (inv. 19). The register principal must re-quote with their identity so `quote.userId` is bound at quote time. | | **Destination-token decimal under-delivery** | A BRL on-ramp targets an 18-decimal token such as BSC USDT, but the quote output is truncated to 6 decimals before `destinationTransfer` raw amount construction. | On-ramp finalization uses destination-token decimals for BRL EVM outputs; Squid metadata preserves destination raw output from `route.estimate.toAmount`. | ## Audit Checklist diff --git a/docs/security-spec/07-operations/api-surface.md b/docs/security-spec/07-operations/api-surface.md index f9cbadc85..eb391eae7 100644 --- a/docs/security-spec/07-operations/api-surface.md +++ b/docs/security-spec/07-operations/api-surface.md @@ -48,7 +48,7 @@ This spec covers the external-facing attack surface of the Vortex API (`apps/api 10. **Request IDs MUST be correlation-only** — Request IDs may be accepted from clients or generated by the API, but they must not grant access, alter authorization, or be treated as trusted identity. 11. **API observability MUST NOT change request outcomes** — Client event persistence/logging must be best-effort and must not change controller response bodies, status codes, or ramp/quote state. 12. **Maintenance windows MUST be backend-enforced on mutable ramp entrypoints** — `POST /v1/quotes`, `POST /v1/quotes/best`, `POST /v1/ramp/register`, `POST /v1/ramp/update`, and `POST /v1/ramp/start` must reject during active maintenance with `503`, `Retry-After`, and explicit downtime start/end metadata. UI disabling is not sufficient because partners may call the API directly. -13. **Provider-backed ramp endpoints MUST reject callers without an effective user, and provider-backed quotes MUST use the same principal at quote and register time** — Alfredpay and Avenia/BRL flows derive their provider customer/subaccount from `api_keys.user_id -> profiles.id -> alfredpay_customers.user_id` / `tax_ids.user_id`. Quote creation is anonymous-eligible (Alfredpay engines short-circuit on no effective user and store `ANONYMOUS_ALFREDPAY_QUOTE_ID`; Avenia engines call upstream providers regardless of identity). Ramp registration runs two gates before any provider call: (a) the provider-backed kind check rejects callers without an effective user with `400 Invalid quote`, and (b) the same-principal check rejects anonymous provider-backed quotes being claimed by an authenticated caller with `403 This anonymous provider-backed quote cannot be registered by an authenticated caller. Re-quote with the same principal to bind ownership.`. Unlinked secret keys and fully anonymous callers are blocked at register time; callers wishing to register a previously-anonymous provider-backed quote must re-quote with their identity. +13. **Provider-backed ramp endpoints MUST reject callers without an effective user, and provider-backed quotes MUST use the same principal at quote and register time** — Alfredpay and Avenia/BRL flows derive their provider customer/subaccount from `api_keys.user_id -> profiles.id -> alfredpay_customers.user_id` / `tax_ids.user_id`. Alfredpay quote creation requires an effective user and rejects before any upstream provider quote call when the principal is missing or unlinked. BRL quote creation remains anonymous-eligible because Avenia quote creation does not require user-bound identity, but `POST /v1/ramp/register` requires Supabase or secret-key credentials and `RampService.registerRamp` rejects missing effective users with `400 Invalid quote`. The same-principal check rejects authenticated attempts to claim quotes created without `quote.userId` with `403`. ## Threat Vectors & Mitigations diff --git a/docs/security-spec/SPEC-DELTA-2026-05.md b/docs/security-spec/SPEC-DELTA-2026-05.md index 192da7631..fe1a09b3d 100644 --- a/docs/security-spec/SPEC-DELTA-2026-05.md +++ b/docs/security-spec/SPEC-DELTA-2026-05.md @@ -278,19 +278,19 @@ Priority order for the next audit/dev cycle, based on severity × likelihood. Re | 10 | **F-NEW-09** — Investigate BRLA payout recovery branches. | NO BUG — once `payOutTicketId` exists, BRLA acknowledged the EVM payout; on-chain receipt is no longer authoritative. | | 11 | **F-NEW-10** — Avenia anchor-fee assumption in three-amount model. | NO BUG — `OffRampMergeSubsidyEvmEngine` adds the projected subsidy into `nablaSwapEvm.outputAmountRaw`, and `OffRampFinalizeEngine` then sets `quote.outputAmount = nablaSwapEvm.outputAmountDecimal − anchorFee`. The relationship `nablaSwapEvm.outputAmountRaw ≥ quote.outputAmount × 10^brlaDecimals` is therefore tautological at quote-build time. The actual safety net is the EVM branch of `subsidize-post-swap-handler.ts`, which tops the ephemeral up to `nablaSwapEvm.outputAmountRaw` at runtime using env-configured split caps for swap discrepancy and discount subsidy. No build-time assertion needed. | | 12 | **F-NEW-05** — Add Base ephemeral cleanup. | RESOLVED — `BaseChainPostProcessHandler` sweeps BRLA and USDC residuals after `currentPhase === "complete"` via presigned `approve` + funding-key `transferFrom`. Wired into both `evm-to-brl-base.ts` (offramp) and `avenia-to-evm-base.ts` (onramp). New phase keys `baseCleanupBrla` and `baseCleanupUsdc`. ETH gas dust on EVM ephemerals remains unswept (intentional). | -| 13 | **F-013** — Multiple security-sensitive endpoints have no authentication. | RESOLVED — dual-track auth wired across all `/v1/ramp/*` and `/v1/ramp/quotes(/best)` endpoints. Each request carrying credentials must present **either** `X-API-Key: sk_*` (partner SDK) **or** `Authorization: Bearer ` (Supabase frontend); invalid credentials are always rejected. Per-principal ownership guards (`assertRampOwnership`, `assertQuoteOwnership`) prevent cross-tenant access: partners are scoped via `RampState.quoteId → QuoteTicket.partnerId`, Supabase users via `RampState.userId`. Anonymous access is permitted only on register/update/start/status/errors and only when the underlying resource is fully anonymous (no partner, no user owner); `getRampHistory` always requires credentials. `enforcePartnerAuth()` is active on `/quotes` and `/quotes/best`, closing the partner-spoofing vector. | +| 13 | **F-013** — Multiple security-sensitive endpoints have no authentication. | RESOLVED — dual-track auth wired across all `/v1/ramp/*` and `/v1/ramp/quotes(/best)` endpoints. Each request carrying credentials must present **either** `X-API-Key: sk_*` (partner SDK) **or** `Authorization: Bearer ` (Supabase frontend); invalid credentials are always rejected. Per-principal ownership guards (`assertRampOwnership`, `assertQuoteOwnership`) prevent cross-tenant access: partners are scoped via `RampState.quoteId → QuoteTicket.partnerId`, Supabase users via `RampState.userId`. `POST /v1/ramp/register` and `GET /v1/ramp/history/:walletAddress` always require credentials; update/start/status/errors keep optional auth only for legacy fully-anonymous ramps whose ownership checks allow access. `enforcePartnerAuth()` is active on `/quotes` and `/quotes/best`, closing the partner-spoofing vector. | --- ## 6. Auth Posture (Post-Delta) -The dual-track auth model — partner SDK key OR Supabase user session — is the canonical model going forward. Anonymous access is permitted **only** on register/update/start/status/errors endpoints, and **only** when the underlying quote/ramp is itself fully anonymous (no `partnerId` and no `userId`). Owned resources always require matching credentials. +The dual-track auth model — partner SDK key OR Supabase user session — is the canonical model going forward. `POST /v1/ramp/register` now requires credentials because ramp creation derives provider identity from the effective user. Anonymous access is permitted only on update/start/status/errors endpoints, and only when the underlying ramp is itself fully anonymous (no `partnerId` and no `userId`). Owned resources always require matching credentials. | Endpoint | Auth | Owner check | |---|---|---| | `POST /v1/ramp/quotes` | `apiKeyAuth({required: false})` + `enforcePartnerAuth()` | Partner key, if present, must match `partnerId` in body | | `POST /v1/ramp/quotes/best` | `apiKeyAuth({required: false})` + `enforcePartnerAuth()` | Same as above | -| `POST /v1/ramp/register` | `optionalPartnerOrUserAuth()` | `assertQuoteOwnership(req, quoteId)` — anonymous caller allowed iff quote has `partnerId === null AND userId === null` | +| `POST /v1/ramp/register` | `requirePartnerOrUserAuth()` | `assertQuoteOwnership(req, quoteId)` + service effective-user check; anonymous quotes must be re-quoted with the registering principal | | `POST /v1/ramp/update` | `optionalPartnerOrUserAuth()` | `assertRampOwnership(req, rampId)` — anonymous caller allowed iff ramp has `userId === null` AND its quote has `partnerId === null` | | `POST /v1/ramp/start` | `optionalPartnerOrUserAuth()` | `assertRampOwnership(req, rampId)` — same condition as update | | `GET /v1/ramp/:id` | `optionalPartnerOrUserAuth()` | `assertRampOwnership(req, id)` — same condition as update | @@ -300,6 +300,6 @@ The dual-track auth model — partner SDK key OR Supabase user session — is th | `/v1/maintenance/*` | `adminAuth` | n/a | | `/v1/webhook/*` | `apiKeyAuth` | Partner ownership | -`optionalPartnerOrUserAuth()` accepts a request with no credentials, but a request that *presents* invalid credentials (malformed `X-API-Key` or expired/forged Bearer) is still rejected with 401. The downstream ownership checks then decide whether the resource is reachable: anonymous callers are admitted only for fully-anonymous quotes/ramps. This preserves the principle that owned resources are never reachable without matching credentials, while allowing API clients without keys (or first-time users without a Supabase session) to drive a ramp end-to-end. +`optionalPartnerOrUserAuth()` accepts a request with no credentials, but a request that *presents* invalid credentials (malformed `X-API-Key` or expired/forged Bearer) is still rejected with 401. The downstream ownership checks then decide whether the resource is reachable: anonymous callers are admitted only for legacy fully-anonymous ramps on the optional endpoints. Ramp registration itself is credential-gated. -Frontend uses `Authorization: Bearer` (Supabase). SDK partners use `X-API-Key: sk_*`. SDK clients without keys may operate against fully-anonymous quotes (no partner-rate benefits). Both authenticated principals grant equal access subject to per-principal ownership scoping. +Frontend uses `Authorization: Bearer` (Supabase). SDK partners use `X-API-Key: sk_*`. SDK clients without keys may request anonymous quote estimates only on corridors that explicitly support them, but must authenticate before registering a ramp. Both authenticated principals grant equal access subject to per-principal ownership scoping. From 618184d7b8c2612d5717c0d2aacca41bbf5f55bd Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 29 Jun 2026 17:51:22 +0200 Subject: [PATCH 048/176] refactor(api): dedupe effective-user resolution in ownership checks Reuse getEffectiveUserId in ownershipAuth instead of a local duplicate, and document why a ramp with userId === null is reachable by an authenticated principal (it is fully anonymous and already reachable by anonymous callers, so this is not an escalation). --- apps/api/src/api/middlewares/ownershipAuth.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/api/src/api/middlewares/ownershipAuth.ts b/apps/api/src/api/middlewares/ownershipAuth.ts index e5273ab2d..826ede689 100644 --- a/apps/api/src/api/middlewares/ownershipAuth.ts +++ b/apps/api/src/api/middlewares/ownershipAuth.ts @@ -6,6 +6,7 @@ import { APIError } from "../errors/api-error"; import { buildApiClientRequestMetadata, observeApiClientEvent } from "../observability/apiClientEvent.service"; import { getRequestDurationMs } from "../observability/requestContext"; import type { AuthenticatedPartner } from "./apiKeyAuth.helpers"; +import { getEffectiveUserId } from "./effectiveUser"; interface OwnershipRequest { authenticatedPartner?: AuthenticatedPartner; @@ -32,10 +33,6 @@ async function ownsPartnerRecord(authenticatedPartner: AuthenticatedPartner, par return partnerId === authenticatedPartner.id || quotePartner.name === authenticatedPartner.name; } -function effectiveRequestUserId(req: OwnershipRequest): string | undefined { - return req.userId ?? req.apiKeyUserId; -} - /** * Verify the authenticated principal owns the ramp identified by req.params.id * or req.body.rampId. Partner principals must match the quote's partnerId; @@ -74,8 +71,11 @@ export async function assertRampOwnership(req: OwnershipRequest, rampId: string) return; } - const userId = effectiveRequestUserId(req); + const userId = getEffectiveUserId(req); if (userId) { + // A ramp with `userId === null` is fully anonymous: it carries no privileged owner and is + // already reachable by unauthenticated callers below, so an authenticated principal driving it + // is not an escalation. Only reject when the ramp is owned by a *different* user. if (ramp.userId !== null && ramp.userId !== userId) { recordOwnershipFailure(req, httpStatus.FORBIDDEN, "ownership_denied", { quoteId: ramp.quoteId, rampId }); throw new APIError({ @@ -135,7 +135,7 @@ export async function assertQuoteOwnership(req: OwnershipRequest, quoteId: strin return; } - const userId = effectiveRequestUserId(req); + const userId = getEffectiveUserId(req); if (userId) { if (quote.partnerId !== null) { recordOwnershipFailure(req, httpStatus.FORBIDDEN, "ownership_denied", { quoteId }); @@ -182,6 +182,6 @@ function recordOwnershipFailure( partnerName: req.authenticatedPartner?.name || null, requestId: req.requestId, status: "failure", - userId: effectiveRequestUserId(req) || null + userId: getEffectiveUserId(req) || null }); } From 0a9838532762f98f826f4adfefa46eba3969642b Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 29 Jun 2026 17:51:31 +0200 Subject: [PATCH 049/176] fix(api): stop leaking Alfredpay customerId into quote notes The on/off-ramp Alfredpay quote engines appended the resolved Alfredpay customer id to ctx.addNote(...). Quote notes are an internal/diagnostic surface; the provider-side customer identifier should not ride along in them. The id is still passed to the upstream quote request metadata as before. --- .../api/services/quote/engines/initialize/onramp-alfredpay.ts | 2 +- .../api/services/quote/engines/partners/offramp-alfredpay.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/api/src/api/services/quote/engines/initialize/onramp-alfredpay.ts b/apps/api/src/api/services/quote/engines/initialize/onramp-alfredpay.ts index 18bc8d4f8..7d58e1f51 100644 --- a/apps/api/src/api/services/quote/engines/initialize/onramp-alfredpay.ts +++ b/apps/api/src/api/services/quote/engines/initialize/onramp-alfredpay.ts @@ -64,7 +64,7 @@ export class OnRampInitializeAlfredpayEngine extends BaseInitializeEngine { }; ctx.addNote?.( - `Initialized: ${inputAmountDecimal.toString()} ${req.inputCurrency} -> ${toAmount.toString()} ${req.outputCurrency} (alfredpayCustomerId=${customerId})` + `Initialized: ${inputAmountDecimal.toString()} ${req.inputCurrency} -> ${toAmount.toString()} ${req.outputCurrency}` ); } } diff --git a/apps/api/src/api/services/quote/engines/partners/offramp-alfredpay.ts b/apps/api/src/api/services/quote/engines/partners/offramp-alfredpay.ts index edf7e26bb..7d4b2edc7 100644 --- a/apps/api/src/api/services/quote/engines/partners/offramp-alfredpay.ts +++ b/apps/api/src/api/services/quote/engines/partners/offramp-alfredpay.ts @@ -82,7 +82,7 @@ export class OfframpTransactionAlfredpayEngine extends BaseInitializeEngine { }; ctx.addNote?.( - `OfframpTransactionAlfredpayEngine: ${inputAmountDecimal.toString()} ${ALFREDPAY_ONCHAIN_CURRENCY} -> ${toAmount.toString()} ${req.outputCurrency} (fee ${alfredpayFee.toString()}, rate ${effectiveRate.toString()}, alfredpayCustomerId=${customerId})` + `OfframpTransactionAlfredpayEngine: ${inputAmountDecimal.toString()} ${ALFREDPAY_ONCHAIN_CURRENCY} -> ${toAmount.toString()} ${req.outputCurrency} (fee ${alfredpayFee.toString()}, rate ${effectiveRate.toString()})` ); } } From 1523d83400fe0866217f9811c5606b0375e32507 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 29 Jun 2026 17:51:39 +0200 Subject: [PATCH 050/176] refactor(api): rename revoke pair param to pairedKeyId The DELETE /v1/api-keys/:keyId body param was named publicKeyId, but the controller accepts either half of the pair (it enforces one public + one secret). Rename to pairedKeyId for accuracy and keep publicKeyId as a backward-compatible alias. Update the route doc, the delete-api-key SDK script, and add a test asserting both the new param and the legacy alias. --- .../userApiKeys.controller.test.ts | 35 ++++++++++++++++--- .../api/controllers/userApiKeys.controller.ts | 13 ++++--- apps/api/src/api/routes/v1/api-keys.route.ts | 5 +-- packages/sdk/scripts/delete-api-key.ts | 14 ++++---- 4 files changed, 48 insertions(+), 19 deletions(-) diff --git a/apps/api/src/api/controllers/userApiKeys.controller.test.ts b/apps/api/src/api/controllers/userApiKeys.controller.test.ts index f6838683c..1c83da17e 100644 --- a/apps/api/src/api/controllers/userApiKeys.controller.test.ts +++ b/apps/api/src/api/controllers/userApiKeys.controller.test.ts @@ -28,7 +28,7 @@ describe("revokeUserApiKey", () => { ApiKey.findOne = originalFindOne; }); - it("revokes default-named public and secret keys as one pair", async () => { + function stubKeyPair() { const updates: Array<{ id: string; changes: unknown }> = []; const secretKey = { id: "secret-key-id", @@ -53,6 +53,34 @@ describe("revokeUserApiKey", () => { return null; }) as unknown as typeof ApiKey.findOne; + return updates; + } + + const expectedPairUpdates = [ + { changes: { isActive: false }, id: "secret-key-id" }, + { changes: { isActive: false }, id: "public-key-id" } + ]; + + it("revokes default-named public and secret keys as one pair via pairedKeyId", async () => { + const updates = stubKeyPair(); + + const res = createResponse(); + await revokeUserApiKey( + { + body: { pairedKeyId: "public-key-id" }, + params: { keyId: "secret-key-id" }, + userId: "user-1" + } as never, + res as never + ); + + expect(res.statusCode).toBe(httpStatus.NO_CONTENT); + expect(updates).toEqual(expectedPairUpdates); + }); + + it("still accepts the legacy publicKeyId alias", async () => { + const updates = stubKeyPair(); + const res = createResponse(); await revokeUserApiKey( { @@ -64,9 +92,6 @@ describe("revokeUserApiKey", () => { ); expect(res.statusCode).toBe(httpStatus.NO_CONTENT); - expect(updates).toEqual([ - { changes: { isActive: false }, id: "secret-key-id" }, - { changes: { isActive: false }, id: "public-key-id" } - ]); + expect(updates).toEqual(expectedPairUpdates); }); }); diff --git a/apps/api/src/api/controllers/userApiKeys.controller.ts b/apps/api/src/api/controllers/userApiKeys.controller.ts index c7a4338b8..7b109e0f5 100644 --- a/apps/api/src/api/controllers/userApiKeys.controller.ts +++ b/apps/api/src/api/controllers/userApiKeys.controller.ts @@ -197,7 +197,10 @@ export async function revokeUserApiKey(req: Request<{ keyId: string }>, res: Res return; } - const { publicKeyId } = req.body ?? {}; + // The paired key may be either the public or secret half — the type check below enforces the + // pair is one of each. Accept the legacy `publicKeyId` alias for backward compatibility. + const { pairedKeyId, publicKeyId } = req.body ?? {}; + const otherKeyId = pairedKeyId ?? publicKeyId; try { const primaryKey = await ApiKey.findOne({ where: { id: keyId, isActive: true, userId } }); @@ -212,18 +215,18 @@ export async function revokeUserApiKey(req: Request<{ keyId: string }>, res: Res return; } - if (!publicKeyId) { + if (!otherKeyId) { await primaryKey.update({ isActive: false }); res.status(httpStatus.NO_CONTENT).send(); return; } - const pairedKey = await ApiKey.findOne({ where: { id: publicKeyId, isActive: true, userId } }); + const pairedKey = await ApiKey.findOne({ where: { id: otherKeyId, isActive: true, userId } }); if (!pairedKey) { res.status(httpStatus.NOT_FOUND).json({ error: { code: "PAIRED_PUBLIC_KEY_NOT_FOUND", - message: "Paired public key not found or not owned by the authenticated user", + message: "Paired key not found or not owned by the authenticated user", status: httpStatus.NOT_FOUND } }); @@ -236,7 +239,7 @@ export async function revokeUserApiKey(req: Request<{ keyId: string }>, res: Res error: { code: "INVALID_KEY_PAIR", message: - "Both keys must be of different types (one public, one secret). A single key can be deleted without publicKeyId.", + "Both keys must be of different types (one public, one secret). A single key can be deleted without pairedKeyId.", status: httpStatus.BAD_REQUEST } }); diff --git a/apps/api/src/api/routes/v1/api-keys.route.ts b/apps/api/src/api/routes/v1/api-keys.route.ts index 28de949a8..7cc2458e1 100644 --- a/apps/api/src/api/routes/v1/api-keys.route.ts +++ b/apps/api/src/api/routes/v1/api-keys.route.ts @@ -21,8 +21,9 @@ router.get("/", listUserApiKeys as unknown as (req: Request, res: Response) => v /** * DELETE /v1/api-keys/:keyId * Revoke (soft delete) one or both keys of a pair. - * Body: { publicKeyId?: string } — if provided, both keys of the pair are revoked together. - * The public+secret keys must be opposite types and share the same base name. + * Body: { pairedKeyId?: string } — if provided, both keys of the pair are revoked together + * (the legacy `publicKeyId` alias is still accepted). The two keys must be opposite types + * (one public, one secret) and share the same base name. */ router.delete("/:keyId", revokeUserApiKey as unknown as (req: Request<{ keyId: string }>, res: Response) => void); diff --git a/packages/sdk/scripts/delete-api-key.ts b/packages/sdk/scripts/delete-api-key.ts index 85e1f3784..2833bbeff 100644 --- a/packages/sdk/scripts/delete-api-key.ts +++ b/packages/sdk/scripts/delete-api-key.ts @@ -89,7 +89,7 @@ async function main(): Promise { const baseName = stripSuffix(selected.name); const paired = data.apiKeys.find(k => k.id !== selected.id && k.type !== selected.type && stripSuffix(k.name) === baseName); - let publicKeyId: string | undefined; + let pairedKeyId: string | undefined; let keyId = selected.id; if (paired) { @@ -98,20 +98,20 @@ async function main(): Promise { const deleteBoth = await askQuestion("➡️ Delete both as a pair? (y/N): "); if (deleteBoth.toLowerCase() === "y") { - publicKeyId = selected.type === "secret" ? paired.id : selected.id; + pairedKeyId = selected.type === "secret" ? paired.id : selected.id; keyId = selected.type === "secret" ? selected.id : paired.id; - console.log(`\n🗑️ Revoking key pair: ${keyId} + ${publicKeyId}`); + console.log(`\n🗑️ Revoking key pair: ${keyId} + ${pairedKeyId}`); } } - if (!publicKeyId) { + if (!pairedKeyId) { console.log(`\n🗑️ Revoking key: ${selected.id} (${selected.type} — ${selected.name})`); } const deleteResponse = await fetch(`${API_BASE_URL}/v1/api-keys/${keyId}`, { - body: publicKeyId ? JSON.stringify({ publicKeyId }) : undefined, + body: pairedKeyId ? JSON.stringify({ pairedKeyId }) : undefined, headers: { - ...(publicKeyId ? { "Content-Type": "application/json" } : {}), + ...(pairedKeyId ? { "Content-Type": "application/json" } : {}), Authorization: `Bearer ${auth.accessToken}` }, method: "DELETE" @@ -120,7 +120,7 @@ async function main(): Promise { const errText = await deleteResponse.text(); throw new Error(`${deleteResponse.status} /v1/api-keys/${keyId}: ${errText}`); } - console.log(publicKeyId ? "✅ Key pair revoked." : "✅ Key revoked."); + console.log(pairedKeyId ? "✅ Key pair revoked." : "✅ Key revoked."); } if (import.meta.main) { From 20f20dbcd559b6e9c984f7b897823b675e6ba608 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 29 Jun 2026 17:51:51 +0200 Subject: [PATCH 051/176] test(api): lock in registerRamp user-gating guards Cover the three rejection paths at the top of RampService.registerRamp: authenticated caller claiming an anonymous quote (403), user registering a quote owned by another user (403), and registration with no effective user such as an unlinked partner key (400). --- .../ramp/ramp.service.register-auth.test.ts | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 apps/api/src/api/services/ramp/ramp.service.register-auth.test.ts diff --git a/apps/api/src/api/services/ramp/ramp.service.register-auth.test.ts b/apps/api/src/api/services/ramp/ramp.service.register-auth.test.ts new file mode 100644 index 000000000..7d7e581d1 --- /dev/null +++ b/apps/api/src/api/services/ramp/ramp.service.register-auth.test.ts @@ -0,0 +1,62 @@ +import { afterEach, describe, expect, it, mock } from "bun:test"; +import httpStatus from "http-status"; +import type { Transaction } from "sequelize"; +import { config } from "../../../config/vars"; +import QuoteTicket from "../../../models/quoteTicket.model"; +import { APIError } from "../../errors/api-error"; +import { RampService } from "./ramp.service"; + +// Locks in the user-gating guards at the top of RampService.registerRamp. See +// docs/architecture/user-gated-ramp-registration.md. The guards run before any DB write or +// signing-account validation, so overriding withTransaction (to skip the real DB) and mocking +// QuoteTicket.findByPk is enough to drive them. +class TestRampService extends RampService { + protected async withTransaction(callback: (transaction: Transaction) => Promise): Promise { + return callback({} as Transaction); + } +} + +function stubQuote(overrides: { userId: string | null }): void { + QuoteTicket.findByPk = mock(async () => ({ + expiresAt: new Date(Date.now() + 10 * 60 * 1000), + flowVariant: config.flowVariant, + id: "quote-1", + status: "pending", + userId: overrides.userId + })) as unknown as typeof QuoteTicket.findByPk; +} + +async function expectRegisterError(userId: string | undefined, expectedStatus: number): Promise { + const service = new TestRampService(); + try { + await service.registerRamp({ additionalData: {}, quoteId: "quote-1", signingAccounts: [], userId } as never); + throw new Error("registerRamp did not reject"); + } catch (error) { + expect(error).toBeInstanceOf(APIError); + expect((error as APIError).status).toBe(expectedStatus); + return error as APIError; + } +} + +describe("RampService.registerRamp user gating", () => { + const originalFindByPk = QuoteTicket.findByPk; + + afterEach(() => { + QuoteTicket.findByPk = originalFindByPk; + }); + + it("rejects an authenticated caller claiming an anonymous quote with 403", async () => { + stubQuote({ userId: null }); + await expectRegisterError("user-a", httpStatus.FORBIDDEN); + }); + + it("rejects a user registering a quote owned by a different user with 403", async () => { + stubQuote({ userId: "user-b" }); + await expectRegisterError("user-a", httpStatus.FORBIDDEN); + }); + + it("rejects registration with no effective user (e.g. unlinked partner key) with 400", async () => { + stubQuote({ userId: null }); + await expectRegisterError(undefined, httpStatus.BAD_REQUEST); + }); +}); From d799b041bf28ef42c54ec1f0fca79f7e967e083a Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 29 Jun 2026 17:51:58 +0200 Subject: [PATCH 052/176] docs(security): record user-gated registration decision Add an ADR documenting the deliberate split between anonymous-eligible quote creation and user-gated ramp registration (including the breaking change for unlinked partner keys and the one-profile-per-key identity model). Update the stale quote-lifecycle audit line that still described ramp registration as having no strict user-to-quote binding; the registerRamp guards now enforce it. --- .../user-gated-ramp-registration.md | 85 +++++++++++++++++++ .../03-ramp-engine/quote-lifecycle.md | 2 +- 2 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 docs/architecture/user-gated-ramp-registration.md diff --git a/docs/architecture/user-gated-ramp-registration.md b/docs/architecture/user-gated-ramp-registration.md new file mode 100644 index 000000000..b5a08c540 --- /dev/null +++ b/docs/architecture/user-gated-ramp-registration.md @@ -0,0 +1,85 @@ +# ADR: User-Gated Ramp Registration (Anonymous Quotes, Authenticated Ramps) + +Last updated: 2026-06-29 + +Status: Accepted + +Related: [`api-key-authentication-complete.md`](./api-key-authentication-complete.md), +[`supabase-auth.md`](./supabase-auth.md), +security spec [`01-auth/api-keys.md`](../security-spec/01-auth/api-keys.md), +[`03-ramp-engine/quote-lifecycle.md`](../security-spec/03-ramp-engine/quote-lifecycle.md) + +## Context + +Every Vortex corridor settles through a regulated fiat provider — Avenia/BRLA (BRL), +Mykobo (EUR), or Alfredpay (USD/MXN/COP/ARS). Each provider requires a real, KYC-completed +customer to mint or pay out. Historically the API accepted provider identity (e.g. +`additionalData.taxId`, or `customerId: req.userId || "unknown"`) directly from the request +body and allowed ramp registration with only a partner API key. That let a caller: + +- Register a ramp on top of an arbitrary `taxId` / customer they did not own. +- Create upstream provider resources with a placeholder (`"unknown"`) customer identity. +- Drive provider-backed flows with no link to a verified profile. + +At the same time, we want unauthenticated clients to be able to fetch a **quote** so they +can preview rates before signing up with Vortex. + +## Decision + +Split the trust boundary between quoting and ramping: + +1. **Quotes stay anonymous-eligible.** `POST /v1/quotes` and `/quotes/best` accept anonymous + callers (and partner keys with or without a user binding) for corridors that support public + estimates (e.g. BRL/Avenia). Alfredpay quote creation is the exception: it is user-gated in + the quote engine because the upstream provider call requires a real customer context — no + `customerId: "unknown"` call is ever made. + +2. **Ramp registration requires an effective user, for every corridor.** `RampService.registerRamp` + derives an **effective user** (`req.userId` from Supabase, else `api_keys.user_id` from a linked + secret key) and rejects when none is present: + - `400 Invalid quote` when no effective user can be resolved. + - `403` when an authenticated caller tries to claim an anonymous quote (`quote.userId == null && request.userId != null`). + - `403` when a linked user tries to register a quote owned by a different user. + +3. **Provider identity is derived server-side, never trusted from the body.** The sender `taxId` + (Avenia) and `alfredPayId` (Alfredpay) are resolved from the effective user's KYC records + (`resolveAveniaAccountForUser`, `resolveAlfredpayCustomerId`). A client-supplied `taxId` is + accepted only when it matches the derived value; mismatches return `400`. (The PIX + `receiverTaxId`, which may legitimately differ from the sender, stays client-supplied and is + validated downstream against the PIX key owner.) + +## Identity model + +A secret API key now has two independent, nullable axes: + +| `partner_name` | `user_id` | Meaning | +|---|---|---| +| set | null | Partner key, no bound user. **Can quote, cannot register** (no effective user). | +| set | set | Partner key bound to one profile. Quotes with partner pricing; registers ramps for that one user. | +| null | set | User-scoped key (self-serve `/v1/api-keys`). Registers ramps for that user; **no** partner pricing (defaults to the `vortex` fee rows). | +| null | null | Unusable; rejected as invalid. | + +A single key binds to **at most one** profile. A partner serving many end users therefore either +(a) has each end user authenticate via Supabase, (b) has each end user mint their own user-scoped +key via the self-serve endpoint, or (c) provisions one partner-bound key per user through the admin +endpoint. There is intentionally no "one partner key acts for any user" path. + +## Consequences + +- **Breaking change for unlinked partner-key integrations.** A partner key with `user_id = NULL` + can no longer register ramps. Existing production keys must be bound to a profile (admin + `POST /v1/admin/partners/:partnerName/api-keys` accepts an optional `userId`) or callers must + switch to per-user authentication. This requires partner communication ahead of deploy. +- **Anonymous rate discovery is preserved**, which keeps the pre-signup funnel working. +- **Provider fraud surface shrinks**: no arbitrary `taxId`, no `"unknown"` customer, no claiming + another user's quote/subaccount. +- `ON DELETE SET NULL` on `api_keys.user_id` is deliberate: deleting a profile must not silently + revoke a partner's operational keys; the binding is soft state. + +## Alternatives considered + +- **Per-corridor gating** (only provider-backed corridors require a user). Rejected: every active + corridor is provider-backed, so a global check in `registerRamp` is simpler and removes the risk + of a future corridor forgetting the guard. If a non-provider corridor is ever added, revisit. +- **Trusting body-supplied provider identity with an ownership check.** Rejected: deriving from the + authenticated profile is strictly safer and removes an entire class of IDOR. diff --git a/docs/security-spec/03-ramp-engine/quote-lifecycle.md b/docs/security-spec/03-ramp-engine/quote-lifecycle.md index fd9bf5141..facf8eb0b 100644 --- a/docs/security-spec/03-ramp-engine/quote-lifecycle.md +++ b/docs/security-spec/03-ramp-engine/quote-lifecycle.md @@ -112,7 +112,7 @@ The refresh policy is intentionally strict (byte-identical `toAmount` and `fee` - [x] Quote amounts (input, output, fees) are immutable once stored — no UPDATE endpoint modifies them. **PASS** — no quote mutation endpoints exist. - [x] EVM onramp output precision follows destination token decimals where the quote output comes from Squid. **PASS** — BRL/EURC Base→EVM and routed Alfredpay USD/MXN/COP/ARS Polygon→EVM finalization preserve destination token precision before downstream raw transfer construction. Direct same-chain same-token passthrough remains at minted/source-token precision. - [PARTIAL] Authentication is enforced on quote creation (verify which auth mechanisms protect `POST /v1/ramp/quotes`). **PARTIAL** — quote creation is optional-auth by design for corridors that support public estimates (for example BRL). Alfredpay quote creation is user-gated inside the quote engines because upstream Alfredpay requires a real customer context; register/start require an effective user for all corridors. -- [PARTIAL] Quote ownership is verified at ramp registration — the user/partner creating the ramp must match the quote creator. **PARTIAL** — no strict user-to-quote binding; mitigated by UUID unpredictability and 10-minute expiry. +- [x] Quote ownership is verified at ramp registration — the user/partner creating the ramp must match the quote creator. **PASS** — `assertQuoteOwnership` scopes by partner/user, and `RampService.registerRamp` additionally (a) rejects a linked user registering a quote owned by a different user with `403`, (b) rejects an authenticated caller claiming an anonymous (`quote.userId == null`) quote with `403`, and (c) requires an effective user for every corridor (inv. 14/16). UUID unpredictability and the 10-minute expiry remain as defense in depth. - [x] Profile-assigned quote pricing persists `pricing_partner_id` without granting partner ownership. **PASS** — profile-assigned quotes store `user_id`, leave `partner_id` `NULL`, and authorize through the user ownership path. - [x] Subsidy is only calculated when `targetDiscount > 0` — partners with no discount get `0` subsidy regardless of shortfall. **PASS** — verified in `calculateSubsidyAmount()`. - [x] `calculateSubsidyAmount` correctly caps at `maxSubsidy × expectedOutput` — verify the multiplication is the right semantic (fraction of expected, not absolute). **PASS** — confirmed: `maxSubsidy` is a fraction (0-1) multiplied by `expectedOutput`. From c9368105e5cad84ae43317514252e76c8bc7dfcd Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 29 Jun 2026 18:25:58 +0200 Subject: [PATCH 053/176] fix(api): derive Mykobo (EUR) identity from the effective user and gate on KYC Bring the EUR/Mykobo corridor to parity with BRL (Avenia) and Alfredpay. EUR registration previously trusted a client-supplied additionalData.email for both the Mykobo intent and the KYC mirror, with no check that the email belonged to the authenticated user and no KYC-completion gate. Add resolveMykoboCustomerForUser(userId, providedEmail?), which derives the Mykobo email from the user's profile (profiles.email is unique, keyed by userId, so it works for Supabase sessions and user-scoped secret keys alike), accepts a client-supplied email only when it matches, and requires the Mykobo customer to be APPROVED before any provider intent is created. Wire it into the on-ramp (prepareMykoboOnrampTransactions) and off-ramp (evm-to-mykobo) paths, replacing the body-trusted email and the non-blocking trailing syncMykoboCustomerKyc. Add a unit test for the resolver gate and stub it in the two Mykobo sandbox contract tests, which now focus purely on the intent/transaction path. --- .../mykobo/mykobo-customer.service.test.ts | 65 +++++++++++++++++++ .../mykobo/mykobo-customer.service.ts | 49 ++++++++++++++ .../mykobo-eur-offramp.integration.test.ts | 9 +++ .../mykobo-eur-onramp.integration.test.ts | 9 +++ .../api/src/api/services/ramp/ramp.service.ts | 16 +++-- .../offramp/routes/evm-to-mykobo.ts | 20 ++---- 6 files changed, 147 insertions(+), 21 deletions(-) create mode 100644 apps/api/src/api/services/mykobo/mykobo-customer.service.test.ts diff --git a/apps/api/src/api/services/mykobo/mykobo-customer.service.test.ts b/apps/api/src/api/services/mykobo/mykobo-customer.service.test.ts new file mode 100644 index 000000000..1349de708 --- /dev/null +++ b/apps/api/src/api/services/mykobo/mykobo-customer.service.test.ts @@ -0,0 +1,65 @@ +import { afterEach, describe, expect, it, mock } from "bun:test"; +import { MykoboApiService, MykoboCustomerStatus } from "@vortexfi/shared"; +import MykoboCustomer from "../../../models/mykoboCustomer.model"; +import User from "../../../models/user.model"; +import { APIError } from "../../errors/api-error"; +import { resolveMykoboCustomerForUser } from "./mykobo-customer.service"; + +const PROFILE_EMAIL = "user@example.com"; + +function stub({ profileEmail, reviewStatus }: { profileEmail: string | null; reviewStatus: string }) { + User.findByPk = mock(async () => + profileEmail ? { email: profileEmail, id: "user-1" } : null + ) as unknown as typeof User.findByPk; + + const customer = { + status: MykoboCustomerStatus.CONSULTED, + update: mock(async (changes: { status: MykoboCustomerStatus }) => { + customer.status = changes.status; + }) + }; + MykoboCustomer.findOne = mock(async () => customer) as unknown as typeof MykoboCustomer.findOne; + + MykoboApiService.getInstance = mock(() => ({ + getProfileByEmail: async () => ({ + profile: { email_address: profileEmail, kyc_status: { review_status: reviewStatus } } + }) + })) as unknown as typeof MykoboApiService.getInstance; + + return customer; +} + +describe("resolveMykoboCustomerForUser", () => { + const originals = { + customerFindOne: MykoboCustomer.findOne, + getInstance: MykoboApiService.getInstance, + userFindByPk: User.findByPk + }; + + afterEach(() => { + User.findByPk = originals.userFindByPk; + MykoboCustomer.findOne = originals.customerFindOne; + MykoboApiService.getInstance = originals.getInstance; + }); + + it("derives the email from the profile and returns it when Mykobo KYC is approved", async () => { + stub({ profileEmail: PROFILE_EMAIL, reviewStatus: "approved" }); + const result = await resolveMykoboCustomerForUser("user-1"); + expect(result.email).toBe(PROFILE_EMAIL); + }); + + it("rejects a provided email that does not match the profile", async () => { + stub({ profileEmail: PROFILE_EMAIL, reviewStatus: "approved" }); + await expect(resolveMykoboCustomerForUser("user-1", "someone-else@example.com")).rejects.toBeInstanceOf(APIError); + }); + + it("rejects when no profile exists for the user", async () => { + stub({ profileEmail: null, reviewStatus: "approved" }); + await expect(resolveMykoboCustomerForUser("user-1")).rejects.toBeInstanceOf(APIError); + }); + + it("rejects when Mykobo KYC is not approved", async () => { + stub({ profileEmail: PROFILE_EMAIL, reviewStatus: "pending" }); + await expect(resolveMykoboCustomerForUser("user-1")).rejects.toBeInstanceOf(APIError); + }); +}); diff --git a/apps/api/src/api/services/mykobo/mykobo-customer.service.ts b/apps/api/src/api/services/mykobo/mykobo-customer.service.ts index 767570fa0..3cced82cd 100644 --- a/apps/api/src/api/services/mykobo/mykobo-customer.service.ts +++ b/apps/api/src/api/services/mykobo/mykobo-customer.service.ts @@ -1,6 +1,9 @@ import { MykoboApiError, MykoboApiService, MykoboCustomerStatus, MykoboProfile, mapMykoboReviewStatus } from "@vortexfi/shared"; +import httpStatus from "http-status"; import logger from "../../../config/logger"; import MykoboCustomer from "../../../models/mykoboCustomer.model"; +import User from "../../../models/user.model"; +import { APIError } from "../../errors/api-error"; interface UpsertArgs { userId: string; @@ -28,6 +31,52 @@ export async function upsertMykoboCustomerFromProfile(userId: string, email: str }); } +export interface ResolvedMykoboCustomer { + email: string; +} + +/** + * Resolve the Mykobo identity for an EUR ramp from the authenticated user's profile, and require an + * approved Mykobo KYC status. The Mykobo email is the user's profile email (`profiles.email` is + * unique and keyed by `userId`); it is never taken from the request body. A client-supplied email + * is accepted only as a redundant check and MUST match the derived value. + * + * Mirrors `resolveAveniaAccountForUser` (BRL) and `resolveAlfredpayCustomerId` (Alfredpay): the + * sender identity is derived server-side and the corridor's KYC-completion status is enforced + * before any provider intent is created. + */ +export async function resolveMykoboCustomerForUser(userId: string, providedEmail?: string): Promise { + const user = await User.findByPk(userId); + if (!user) { + throw new APIError({ + message: "No profile found for this user; cannot resolve the Mykobo customer.", + status: httpStatus.BAD_REQUEST + }); + } + + const email = user.email; + + if (providedEmail && providedEmail.trim().toLowerCase() !== email.trim().toLowerCase()) { + throw new APIError({ + message: "Provided email does not match the profile bound to the authenticated user.", + status: httpStatus.BAD_REQUEST + }); + } + + // Refresh the KYC mirror from the live Mykobo profile, then gate on an approved customer. + await syncMykoboCustomerKyc(userId, email); + + const customer = await MykoboCustomer.findOne({ where: { userId } }); + if (!customer || customer.status !== MykoboCustomerStatus.APPROVED) { + throw new APIError({ + message: "Mykobo KYC is not approved for this user. Complete Mykobo KYC before requesting an EUR ramp.", + status: httpStatus.BAD_REQUEST + }); + } + + return { email }; +} + export async function syncMykoboCustomerKyc(userId: string, email: string): Promise { try { const { profile } = await MykoboApiService.getInstance().getProfileByEmail(email); diff --git a/apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts b/apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts index d31c3db2f..196c1227c 100644 --- a/apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts +++ b/apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts @@ -28,6 +28,15 @@ mock.module("../quote/core/nabla", () => { } }; }); + +// The Mykobo email is now derived from the user's profile and gated on an APPROVED Mykobo customer +// (resolveMykoboCustomerForUser). This contract test focuses on the Mykobo intent/transaction path, +// so stub the resolver to return the test email instead of standing up profile + KYC-mirror rows. +mock.module("../mykobo/mykobo-customer.service", () => ({ + resolveMykoboCustomerForUser: async () => ({ email: "mail@test.com" }), + syncMykoboCustomerKyc: async () => {}, + upsertMykoboCustomerFromProfile: async () => {} +})); import { AccountMeta, BrlaApiService, diff --git a/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts b/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts index 2bd58ec83..aa240a19c 100644 --- a/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts +++ b/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts @@ -28,6 +28,15 @@ mock.module("../quote/core/nabla", () => { } }; }); + +// The Mykobo email is now derived from the user's profile and gated on an APPROVED Mykobo customer +// (resolveMykoboCustomerForUser). This contract test focuses on the Mykobo intent/transaction path, +// so stub the resolver to return the test email instead of standing up profile + KYC-mirror rows. +mock.module("../mykobo/mykobo-customer.service", () => ({ + resolveMykoboCustomerForUser: async () => ({ email: "mail@test.com" }), + syncMykoboCustomerKyc: async () => {}, + upsertMykoboCustomerFromProfile: async () => {} +})); import { AccountMeta, BrlaApiService, diff --git a/apps/api/src/api/services/ramp/ramp.service.ts b/apps/api/src/api/services/ramp/ramp.service.ts index f942a49f2..ce23300ec 100644 --- a/apps/api/src/api/services/ramp/ramp.service.ts +++ b/apps/api/src/api/services/ramp/ramp.service.ts @@ -53,7 +53,7 @@ import TaxId from "../../../models/taxId.model"; import { APIError } from "../../errors/api-error"; import { ActivePartner, handleQuoteConsumptionForDiscountState } from "../../services/quote/engines/discount/helpers"; import { resolveAveniaAccountForUser } from "../avena-account"; -import { syncMykoboCustomerKyc } from "../mykobo/mykobo-customer.service"; +import { resolveMykoboCustomerForUser } from "../mykobo/mykobo-customer.service"; import { StateMetadata } from "../phases/meta-state-types"; import phaseProcessor from "../phases/phase-processor"; import { PriceFeedService } from "../priceFeed.service"; @@ -1181,13 +1181,17 @@ export class RampService extends BaseRampService { stateMeta: Partial; ibanPaymentData?: IbanPaymentData; }> { - if (!additionalData?.destinationAddress || !additionalData?.email || !additionalData?.ipAddress) { + if (!additionalData?.destinationAddress || !additionalData?.ipAddress) { throw new APIError({ - message: "Parameters destinationAddress, email and ipAddress are required for Mykobo EUR onramp", + message: "Parameters destinationAddress and ipAddress are required for Mykobo EUR onramp", status: httpStatus.BAD_REQUEST }); } + // The Mykobo email is derived from the effective user's profile (and KYC must be approved); + // a client-supplied email is accepted only if it matches. See resolveMykoboCustomerForUser. + const { email } = await resolveMykoboCustomerForUser(userId, additionalData.email); + const evmEphemeralEntry = normalizedSigningAccounts.find(account => account.type === "EVM"); if (!evmEphemeralEntry) { throw new APIError({ @@ -1199,7 +1203,7 @@ export class RampService extends BaseRampService { const mykobo = MykoboApiService.getInstance(); const intent = await mykobo.createTransactionIntent({ currency: MykoboCurrency.EURC, - email_address: additionalData.email, + email_address: email, ip_address: additionalData.ipAddress, transaction_type: MykoboTransactionType.DEPOSIT, value: new Big(quote.inputAmount).toFixed(2, 0), @@ -1217,7 +1221,7 @@ export class RampService extends BaseRampService { const { unsignedTxs, stateMeta } = await prepareMykoboToEvmOnrampTransactions({ destinationAddress: additionalData.destinationAddress, ipAddress: additionalData.ipAddress, - mykoboEmail: additionalData.email, + mykoboEmail: email, mykoboTransactionId: intent.transaction.id, mykoboTransactionReference: intent.transaction.reference, quote, @@ -1231,8 +1235,6 @@ export class RampService extends BaseRampService { reference: intent.transaction.reference }; - await syncMykoboCustomerKyc(userId, additionalData.email); - return { ibanPaymentData, stateMeta: stateMeta as Partial, unsignedTxs }; } diff --git a/apps/api/src/api/services/transactions/offramp/routes/evm-to-mykobo.ts b/apps/api/src/api/services/transactions/offramp/routes/evm-to-mykobo.ts index f47e2c3a8..cbb766b93 100644 --- a/apps/api/src/api/services/transactions/offramp/routes/evm-to-mykobo.ts +++ b/apps/api/src/api/services/transactions/offramp/routes/evm-to-mykobo.ts @@ -17,7 +17,7 @@ import httpStatus from "http-status"; import { encodeFunctionData } from "viem"; import erc20ABI from "../../../../../contracts/ERC20"; import { APIError } from "../../../../errors/api-error"; -import { syncMykoboCustomerKyc } from "../../../mykobo/mykobo-customer.service"; +import { resolveMykoboCustomerForUser } from "../../../mykobo/mykobo-customer.service"; import { getEvmFundingAccount } from "../../../phases/evm-funding"; import { StateMetadata } from "../../../phases/meta-state-types"; import { encodeEvmTransactionData } from "../.."; @@ -46,13 +46,9 @@ export async function prepareEvmToMykoboOfframpTransactions({ throw new Error("EVM ephemeral account not found for EVM to Mykobo offramp"); } - if (!email) { - throw new APIError({ - isPublic: true, - message: "email must be provided for Mykobo (EUR) offramp", - status: httpStatus.BAD_REQUEST - }); - } + // The Mykobo email is derived from the effective user's profile (and KYC must be approved); + // a client-supplied email is accepted only if it matches. See resolveMykoboCustomerForUser. + const { email: mykoboEmail } = await resolveMykoboCustomerForUser(userId, email); if (!ipAddress) { throw new APIError({ @@ -116,7 +112,7 @@ export async function prepareEvmToMykoboOfframpTransactions({ const mykobo = MykoboApiService.getInstance(); const intent = await mykobo.createTransactionIntent({ currency: MykoboCurrency.EURC, - email_address: email, + email_address: mykoboEmail, ip_address: ipAddress, transaction_type: MykoboTransactionType.WITHDRAW, value: mykoboFlooredValue, @@ -239,16 +235,12 @@ export async function prepareEvmToMykoboOfframpTransactions({ ...stateMeta, destinationAddress, evmEphemeralAddress: evmEphemeralEntry.address, - mykoboEmail: email, + mykoboEmail, mykoboReceivablesAddress, mykoboTransactionId, mykoboTransactionReference, walletAddress: userAddress }; - if (userId) { - await syncMykoboCustomerKyc(userId, email); - } - return { stateMeta, unsignedTxs }; } From ebedf2274258d1eb86a727c3d456412c1b6a2a74 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 29 Jun 2026 18:26:09 +0200 Subject: [PATCH 054/176] docs(security): document EUR identity-derivation parity for Mykobo Add Mykobo invariant 23 (derive email from the effective user's profile, match any client-supplied email, require APPROVED KYC before issuing payment instructions), two threat-vector rows (cross-user EUR identity via body email; unverified EUR ramp / KYC bypass), and an audit-checklist item. Generalize quote-lifecycle invariant 15 to cover the Mykobo email alongside the BRL tax ID and Alfredpay customer id. --- docs/security-spec/03-ramp-engine/quote-lifecycle.md | 2 +- docs/security-spec/05-integrations/mykobo.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/security-spec/03-ramp-engine/quote-lifecycle.md b/docs/security-spec/03-ramp-engine/quote-lifecycle.md index facf8eb0b..63d741a4b 100644 --- a/docs/security-spec/03-ramp-engine/quote-lifecycle.md +++ b/docs/security-spec/03-ramp-engine/quote-lifecycle.md @@ -75,7 +75,7 @@ The refresh policy is intentionally strict (byte-identical `toAmount` and `fee` 16. **Provider-backed ramp registration MUST derive the sender's tax ID / Alfredpay customer from the effective user, not from request body** — BRL/Avenia tax ID and Alfredpay `alfredPayId` are resolved server-side via `api_keys.user_id -> tax_ids.user_id` and `api_keys.user_id -> alfredpay_customers.user_id` respectively. Client-supplied `additionalData.taxId` is accepted only for backward compatibility and MUST match the derived sender value or the request is rejected with `400`. The `receiverTaxId` (where it differs from the sender — e.g. third-party PIX recipient) is supplied by the client and is allowed to differ from the derived sender tax ID; it is validated downstream against the PIX key owner by `validateBrlaOfframpRequest` / `validateMaskedNumber`. The `RampService.registerRamp` quote/user consistency check ensures the caller cannot register a provider-backed quote using a different user context. 17. **Quote registration MUST use the same principal at quote and register time** — An anonymous quote (one with `quote.userId = null`, produced by the short-circuit path in inv. 14) cannot be claimed by an authenticated caller. `RampService.registerRamp` rejects with `403` when `quote.userId == null && request.userId != null`. The register principal must obtain a new quote with their identity (Supabase session or linked secret API key) so `quote.userId` is bound at quote time. Combined with the universal userId requirement (inv. 14), anonymous quotes are effectively unregistrable for all corridors. 14. **Alfredpay quote creation MUST NOT call upstream providers with placeholder user identity** — Alfredpay corridors reject when no effective user is present and must never create upstream provider quotes with `customerId: "unknown"`. BRL/Avenia quote creation remains anonymous-eligible because Avenia quotes do not require a user-bound provider identity. **Register/start remains blocked for all corridors** without an effective user via route-level auth and the universal `RampService.registerRamp` check. -15. **Provider-backed ramp registration MUST derive the sender's tax ID / Alfredpay customer from the effective user, not from request body** — BRL/Avenia tax ID and Alfredpay `alfredPayId` are resolved server-side via `api_keys.user_id -> tax_ids.user_id` and `api_keys.user_id -> alfredpay_customers.user_id` respectively. Client-supplied `additionalData.taxId` is accepted only for backward compatibility and MUST match the derived sender value or the request is rejected with `400`. The `receiverTaxId` (where it differs from the sender — e.g. third-party PIX recipient) is supplied by the client and is allowed to differ from the derived sender tax ID; it is validated downstream against the PIX key owner by `validateBrlaOfframpRequest` / `validateMaskedNumber`. The `RampService.registerRamp` quote/user consistency check ensures the caller cannot register a provider-backed quote using a different user context. +15. **Provider-backed ramp registration MUST derive the sender's provider identity from the effective user, not from request body** — BRL/Avenia tax ID, Alfredpay `alfredPayId`, and the Mykobo (EUR) `email` are resolved server-side from the effective user: `api_keys.user_id -> tax_ids.user_id` (`resolveAveniaAccountForUser`), `api_keys.user_id -> alfredpay_customers.user_id` (`resolveAlfredpayCustomerId`), and `api_keys.user_id -> profiles.email` (`resolveMykoboCustomerForUser`) respectively. The corresponding client-supplied field (`additionalData.taxId` / `additionalData.email`) is accepted only for backward compatibility and MUST match the derived sender value or the request is rejected with `400`. Each resolver also enforces the corridor's KYC-completion status (Avenia `Accepted`, Alfredpay `Success`, Mykobo `APPROVED`). The `receiverTaxId` (where it differs from the sender — e.g. third-party PIX recipient) is supplied by the client and is allowed to differ from the derived sender tax ID; it is validated downstream against the PIX key owner by `validateBrlaOfframpRequest` / `validateMaskedNumber`. The `RampService.registerRamp` quote/user consistency check ensures the caller cannot register a provider-backed quote using a different user context. 16. **Quote registration MUST use the same principal at quote and register time** — An anonymous quote (one with `quote.userId = null`, e.g. a BRL quote estimate created without credentials) cannot be claimed by an authenticated caller. `RampService.registerRamp` rejects with `403` when `quote.userId == null && request.userId != null`. The register principal must obtain a new quote with their identity (Supabase session or linked secret API key) so `quote.userId` is bound at quote time. Combined with the universal userId requirement (inv. 14), anonymous quotes are effectively unregistrable for all corridors. ## Threat Vectors & Mitigations diff --git a/docs/security-spec/05-integrations/mykobo.md b/docs/security-spec/05-integrations/mykobo.md index 886540cc0..d0d443f99 100644 --- a/docs/security-spec/05-integrations/mykobo.md +++ b/docs/security-spec/05-integrations/mykobo.md @@ -88,6 +88,7 @@ Unlike Monerium (`moneriumOnrampMint` + `moneriumOnrampSelfTransfer`), Vortex do 20. **`MYKOBO_CLIENT_DOMAIN` MUST be set in every deployment** — The constant is sent as `client_domain` on every Mykobo API call and selects the negotiated fee tier. Because it is loaded via `getEnvVar` with no default, a missing value silently falls back to Mykobo's default tier (worse fees, observed ~5x higher). Deploy-time checks MUST treat an unset `MYKOBO_CLIENT_DOMAIN` as a hard failure. 21. **Mykobo intent `value` MUST be floored to 2 decimal places** — Mykobo silently truncates anything beyond 2 dp, which would otherwise cause the on-chain transfer amount and the Mykobo-credited amount to diverge. Both the on-ramp `DEPOSIT` intent and the off-ramp `WITHDRAW` intent MUST send a 2dp-floored `value`, and the off-ramp on-chain transfer MUST be derived from that same floored value (not from the unrounded Nabla output). The sub-cent EURC remainder on the ephemeral MUST be swept by `baseCleanupEurc`. 22. **The EUR→EURC-on-Base on-ramp MUST take the direct-transfer bypass** — When `inputCurrency === EURC`, `outputCurrency === EURC`, and `network === Base`, `isEurToEurcBaseDirect` MUST short-circuit the route to a single `destinationTransfer` from the ephemeral to the user, with `stateMeta.isDirectTransfer = true`. The Nabla swap, SquidRouter, `finalSettlementSubsidy`, and Base cleanup phases MUST NOT run — routing EURC through USDC and back would burn double-swap slippage/fees against the user and expose the over-subsidy race (`06-cross-chain/fund-routing.md`). The `finalSettlementSubsidy` handler MUST also honor `isDirectTransfer`/`isEurToEurcBaseDirect` defensively and skip to `destinationTransfer` if reached. +23. **EUR ramp registration MUST derive the Mykobo email from the effective user and require approved Mykobo KYC** — Both the on-ramp (`prepareMykoboOnrampTransactions`) and off-ramp (`evm-to-mykobo.ts`) resolve the Mykobo `email_address` via `resolveMykoboCustomerForUser(userId, providedEmail?)`, which (a) reads the canonical email from the effective user's profile (`profiles.email` is unique and keyed by `userId`, so this works for both Supabase sessions and user-scoped secret keys), (b) accepts a client-supplied `additionalData.email` only when it matches the derived value and rejects mismatches with `400`, and (c) refreshes the Mykobo KYC mirror from the live profile and rejects with `400` unless the resulting `MykoboCustomer.status === APPROVED`. The client-supplied email is never passed to Mykobo directly, and the provider intent is created only after the gate passes. This mirrors the BRL/Avenia (`resolveAveniaAccountForUser`) and Alfredpay (`resolveAlfredpayCustomerId`) derivation+KYC pattern. Combined with the universal register-time effective-user requirement (`01-auth/api-keys.md` inv. 13), EUR ramps cannot be registered anonymously or with an unlinked key, and one user cannot drive a ramp against another user's Mykobo identity. ## Threat Vectors & Mitigations @@ -106,6 +107,8 @@ Unlike Monerium (`moneriumOnrampMint` + `moneriumOnrampSelfTransfer`), Vortex do | **Long-lived on-ramp DOS** | Attacker creates many on-ramps to occupy ephemeral accounts for 24h | Per-user concurrent ramp limit (cross-cutting; see `07-operations/api-surface.md` rate limiting). Ephemerals are user-funded so blast radius is bounded. | | **TLS downgrade / MITM** | Attacker intercepts Mykobo API calls | HTTPS-only base URL; bearer-token auth depends on TLS; refuse any non-HTTPS `MYKOBO_BASE_URL` configuration at deploy time. | | **Profile-doc PII leak** | KYC document or PII surfaces in Vortex storage or logs | Documents are streamed through to Mykobo as multipart form-data without persistence; no PII fields stored locally beyond the email→profile-existence linkage. | +| **Cross-user EUR identity via client-supplied email** | An authenticated user passes another user's KYC'd Mykobo email in `additionalData.email` at register time to ramp against that identity | `resolveMykoboCustomerForUser` ignores the body email as a source of truth: it derives the email from the caller's own `profiles.email` and only accepts a provided email if it matches. A non-matching email is rejected with `400`, so the body email cannot select a different Mykobo customer. | +| **Unverified EUR ramp / KYC bypass** | A registered-but-not-KYC'd profile (or one whose Mykobo review is pending/rejected) registers an EUR ramp and receives SEPA payment instructions | Registration refreshes the Mykobo KYC mirror live and rejects with `400` unless `MykoboCustomer.status === APPROVED`; the Mykobo intent is created only after the gate passes. | | **Cross-version Mykobo API drift** | Operator misconfigures `MYKOBO_BASE_URL` to a root domain, hitting an unintended version | `MykoboApiService` enforces a `/v` suffix; misconfiguration fails fast on the first auth call. | | **`MYKOBO_CLIENT_DOMAIN` unset → wrong fee tier** | Operator forgets to set `MYKOBO_CLIENT_DOMAIN`; Mykobo silently applies its default tier (~5x worse fees) and quotes/distributions drift from reality | Deploy-time check fails fast if the env var is missing; alarms on observed Mykobo fees exceeding `defaultDepositFee` / `defaultWithdrawFee` (see `07-operations/secret-management.md`). | | **Intent-value precision drift** | EURC payout amount carries >2 dp; Mykobo silently truncates and credits less than the on-chain transfer, leaving the user short | Both `DEPOSIT` and `WITHDRAW` intents send `Big.toFixed(2, 0)`-floored `value`; the off-ramp on-chain EURC transfer is derived from the same floored value; sub-cent dust is swept by `baseCleanupEurc`. | @@ -119,6 +122,7 @@ Unlike Monerium (`moneriumOnrampMint` + `moneriumOnrampSelfTransfer`), Vortex do - [ ] `mykoboOnrampDeposit` polls Base RPC for EURC arrival before advancing - [ ] 24h outer payment timeout enforced; on expiry the ramp transitions to `failed` - [ ] 5% recovery tolerance applied only to the pre-funded shortcut, not to live polling +- [ ] EUR register (on-ramp and off-ramp) derives the Mykobo email from `profiles.email` via `resolveMykoboCustomerForUser`, rejects a non-matching client-supplied email with `400`, and requires `MykoboCustomer.status === APPROVED` before creating the Mykobo intent - [ ] On-ramp intent `wallet_address` is the Base ephemeral (not the user destination address) - [ ] Off-ramp intent `wallet_address` is the Base ephemeral - [ ] Off-ramp `mykoboReceivablesAddress` comes from `intent.instructions.address` (server-side) From 2359c2f9eeb257fd812cda238e76ac3a6e663156 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 29 Jun 2026 18:42:22 +0200 Subject: [PATCH 055/176] docs(security): fix merge-mangled quote-lifecycle invariants MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The staging merge left two competing copies of the provider-identity invariants (numbered 14–17 then 14–16 again). The incoming variant described an Alfredpay "anonymous estimate + ANONYMOUS_ALFREDPAY_QUOTE_ID" flow that does not exist in the code — the engines hard-reject via requireAlfredpayEffectiveUserId. Drop the stale trio, keep the code-accurate invariants (Alfredpay quote-creation reject; provider-identity derivation incl. Mykobo email; same-principal rule), renumber to 15/16/17, and fix the dangling cross-references in the invariant, threat-vector, and audit-checklist sections. --- .../security-spec/03-ramp-engine/quote-lifecycle.md | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/docs/security-spec/03-ramp-engine/quote-lifecycle.md b/docs/security-spec/03-ramp-engine/quote-lifecycle.md index 63d741a4b..0052a3af8 100644 --- a/docs/security-spec/03-ramp-engine/quote-lifecycle.md +++ b/docs/security-spec/03-ramp-engine/quote-lifecycle.md @@ -71,12 +71,9 @@ The refresh policy is intentionally strict (byte-identical `toAmount` and `fee` 12. **Quote creation MUST honor active maintenance windows server-side** — `POST /v1/quotes` and `POST /v1/quotes/best` must reject during active maintenance before quote calculation/persistence, including enough downtime metadata for direct API clients to retry after the window. 13. **Quote ownership MUST stay separate from pricing attribution** — Profile-assigned quotes MUST remain user-owned (`user_id = req.userId`, `partner_id = NULL`) while storing the applied partner pricing row in `pricing_partner_id`. 14. **Displayed discount MUST be a snapshot, not a live recomputation** — Public `QuoteResponse` discount fields MUST come from quote metadata captured at creation time. `GET /v1/quotes/:id` and ramp status responses MUST NOT recompute discount display amounts from live FX rates because quote economics are immutable after creation. -15. **Provider-backed quote creation MUST NOT call upstream providers with placeholder user identity** — Alfredpay and Avenia/BRL corridors must not create upstream provider quotes with `customerId: "unknown"`. Quote-time engines short-circuit the Alfredpay call when no effective user is present, populate `ctx.alfredpayMint` / `ctx.alfredpayOfframp` with oracle-rate-based estimates and a sentinel `quoteId` (`ANONYMOUS_ALFREDPAY_QUOTE_ID`), and surface the estimate to the caller. The fresh Alfredpay quote is then created and persisted at register time once the user is authenticated, so the final ramp state always carries a real provider `quoteId`. Crypto-only/internal corridors remain anonymous. **Register/start remains blocked for all corridors** (not just provider-backed) without an effective user via the universal `RampService.registerRamp` check. -16. **Provider-backed ramp registration MUST derive the sender's tax ID / Alfredpay customer from the effective user, not from request body** — BRL/Avenia tax ID and Alfredpay `alfredPayId` are resolved server-side via `api_keys.user_id -> tax_ids.user_id` and `api_keys.user_id -> alfredpay_customers.user_id` respectively. Client-supplied `additionalData.taxId` is accepted only for backward compatibility and MUST match the derived sender value or the request is rejected with `400`. The `receiverTaxId` (where it differs from the sender — e.g. third-party PIX recipient) is supplied by the client and is allowed to differ from the derived sender tax ID; it is validated downstream against the PIX key owner by `validateBrlaOfframpRequest` / `validateMaskedNumber`. The `RampService.registerRamp` quote/user consistency check ensures the caller cannot register a provider-backed quote using a different user context. -17. **Quote registration MUST use the same principal at quote and register time** — An anonymous quote (one with `quote.userId = null`, produced by the short-circuit path in inv. 14) cannot be claimed by an authenticated caller. `RampService.registerRamp` rejects with `403` when `quote.userId == null && request.userId != null`. The register principal must obtain a new quote with their identity (Supabase session or linked secret API key) so `quote.userId` is bound at quote time. Combined with the universal userId requirement (inv. 14), anonymous quotes are effectively unregistrable for all corridors. -14. **Alfredpay quote creation MUST NOT call upstream providers with placeholder user identity** — Alfredpay corridors reject when no effective user is present and must never create upstream provider quotes with `customerId: "unknown"`. BRL/Avenia quote creation remains anonymous-eligible because Avenia quotes do not require a user-bound provider identity. **Register/start remains blocked for all corridors** without an effective user via route-level auth and the universal `RampService.registerRamp` check. -15. **Provider-backed ramp registration MUST derive the sender's provider identity from the effective user, not from request body** — BRL/Avenia tax ID, Alfredpay `alfredPayId`, and the Mykobo (EUR) `email` are resolved server-side from the effective user: `api_keys.user_id -> tax_ids.user_id` (`resolveAveniaAccountForUser`), `api_keys.user_id -> alfredpay_customers.user_id` (`resolveAlfredpayCustomerId`), and `api_keys.user_id -> profiles.email` (`resolveMykoboCustomerForUser`) respectively. The corresponding client-supplied field (`additionalData.taxId` / `additionalData.email`) is accepted only for backward compatibility and MUST match the derived sender value or the request is rejected with `400`. Each resolver also enforces the corridor's KYC-completion status (Avenia `Accepted`, Alfredpay `Success`, Mykobo `APPROVED`). The `receiverTaxId` (where it differs from the sender — e.g. third-party PIX recipient) is supplied by the client and is allowed to differ from the derived sender tax ID; it is validated downstream against the PIX key owner by `validateBrlaOfframpRequest` / `validateMaskedNumber`. The `RampService.registerRamp` quote/user consistency check ensures the caller cannot register a provider-backed quote using a different user context. -16. **Quote registration MUST use the same principal at quote and register time** — An anonymous quote (one with `quote.userId = null`, e.g. a BRL quote estimate created without credentials) cannot be claimed by an authenticated caller. `RampService.registerRamp` rejects with `403` when `quote.userId == null && request.userId != null`. The register principal must obtain a new quote with their identity (Supabase session or linked secret API key) so `quote.userId` is bound at quote time. Combined with the universal userId requirement (inv. 14), anonymous quotes are effectively unregistrable for all corridors. +15. **Alfredpay quote creation MUST NOT call upstream providers with placeholder user identity** — Alfredpay corridors reject when no effective user is present and must never create upstream provider quotes with `customerId: "unknown"`. BRL/Avenia quote creation remains anonymous-eligible because Avenia quotes do not require a user-bound provider identity. **Register/start remains blocked for all corridors** without an effective user via route-level auth and the universal `RampService.registerRamp` check. +16. **Provider-backed ramp registration MUST derive the sender's provider identity from the effective user, not from request body** — BRL/Avenia tax ID, Alfredpay `alfredPayId`, and the Mykobo (EUR) `email` are resolved server-side from the effective user: `api_keys.user_id -> tax_ids.user_id` (`resolveAveniaAccountForUser`), `api_keys.user_id -> alfredpay_customers.user_id` (`resolveAlfredpayCustomerId`), and `api_keys.user_id -> profiles.email` (`resolveMykoboCustomerForUser`) respectively. The corresponding client-supplied field (`additionalData.taxId` / `additionalData.email`) is accepted only for backward compatibility and MUST match the derived sender value or the request is rejected with `400`. Each resolver also enforces the corridor's KYC-completion status (Avenia `Accepted`, Alfredpay `Success`, Mykobo `APPROVED`). The `receiverTaxId` (where it differs from the sender — e.g. third-party PIX recipient) is supplied by the client and is allowed to differ from the derived sender tax ID; it is validated downstream against the PIX key owner by `validateBrlaOfframpRequest` / `validateMaskedNumber`. The `RampService.registerRamp` quote/user consistency check ensures the caller cannot register a provider-backed quote using a different user context. +17. **Quote registration MUST use the same principal at quote and register time** — An anonymous quote (one with `quote.userId = null`, e.g. a BRL quote estimate created without credentials) cannot be claimed by an authenticated caller. `RampService.registerRamp` rejects with `403` when `quote.userId == null && request.userId != null`. The register principal must obtain a new quote with their identity (Supabase session or linked secret API key) so `quote.userId` is bound at quote time. Combined with the universal effective-user requirement (inv. 15), anonymous quotes are effectively unregistrable for all corridors. ## Threat Vectors & Mitigations @@ -89,7 +86,7 @@ The refresh policy is intentionally strict (byte-identical `toAmount` and `fee` | **Dynamic pricing farming** | Attacker rapidly requests quotes without consuming them to push `difference` toward `maxDynamicDifference`, then consumes at the best possible rate | Each quote request within the timeout window does NOT change the difference — only quotes **after** the timeout increase it. So the attacker would need to wait `discountStateTimeoutMinutes` between each step increase. With default `deltaD = 0.00003` and a 10-minute timeout, farming is slow. However, the `maxDynamicDifference` cap is the hard limit. | | **⚠️ In-memory state loss** | Server restart resets all partner discount states to `difference = 0`. Partners lose their accumulated rate adjustments. | **NO MITIGATION.** State is in-memory only. After restart, all partners start fresh. This could cause abrupt rate changes if a partner had a significant accumulated difference. | | **Subsidization abuse** | Attacker creates quotes during high volatility, forcing the platform to cover large subsidization amounts | Quote-time discount subsidy is capped by `maxSubsidy` per partner; EVM runtime top-ups are separately bounded by the pre/post-swap cap fractions; dynamic pricing adjusts rates over time; `maxDynamicDifference` bounds the maximum rate improvement | -| **Unauthorized quote consumption** | Attacker binds someone else's quote to their own ramp | Quotes carrying an owner (`partner_id` or `user_id`) are bound to that owner; ownership is verified at ramp registration via `assertQuoteOwnership`. `pricing_partner_id` is not an ownership credential. `RampService.registerRamp` requires an effective user for **all** corridors and rejects anonymous quotes from being claimed by an authenticated caller (inv. 16), so an attacker cannot bind an anonymous quote to a user who did not create it. Fully-anonymous quotes (no `partner_id` and no `user_id`) are effectively unregistrable. | +| **Unauthorized quote consumption** | Attacker binds someone else's quote to their own ramp | Quotes carrying an owner (`partner_id` or `user_id`) are bound to that owner; ownership is verified at ramp registration via `assertQuoteOwnership`. `pricing_partner_id` is not an ownership credential. `RampService.registerRamp` requires an effective user for **all** corridors and rejects anonymous quotes from being claimed by an authenticated caller (inv. 17), so an attacker cannot bind an anonymous quote to a user who did not create it. Fully-anonymous quotes (no `partner_id` and no `user_id`) are effectively unregistrable. | | **Pricing partner treated as owner** | A profile-assigned user receives partner pricing, then tries to access partner-owned quotes or ramps. | Profile assignments populate `pricing_partner_id` only; `partner_id` stays `NULL`, so ownership guards continue to authorize through the Supabase `user_id` path. | | **Negative `minDynamicDifference`** | If `minDynamicDifference` is set to a large negative value in the partner DB record, consuming quotes could push the rate below the base `targetDiscount`, potentially making the effective discount negative (user receives less than the oracle rate) | DB constraint: `minDynamicDifference` defaults to `0`. However, there is no DB-level CHECK constraint preventing negative values. If set manually, the clamping logic would allow `difference` to go negative. | | **Concurrent quote and consumption** | Two simultaneous requests — one quoting, one consuming — for the same partner could read stale `difference` values from the in-memory Map | JavaScript's single-threaded event loop prevents true concurrency for synchronous Map operations. However, the `async` functions in `compute()` could interleave if there are `await` points between reading and writing the Map. In practice, the read and write of `partnerDiscountState` in `getAdjustedDifference` are synchronous, so this is safe within a single process. | @@ -112,7 +109,7 @@ The refresh policy is intentionally strict (byte-identical `toAmount` and `fee` - [x] Quote amounts (input, output, fees) are immutable once stored — no UPDATE endpoint modifies them. **PASS** — no quote mutation endpoints exist. - [x] EVM onramp output precision follows destination token decimals where the quote output comes from Squid. **PASS** — BRL/EURC Base→EVM and routed Alfredpay USD/MXN/COP/ARS Polygon→EVM finalization preserve destination token precision before downstream raw transfer construction. Direct same-chain same-token passthrough remains at minted/source-token precision. - [PARTIAL] Authentication is enforced on quote creation (verify which auth mechanisms protect `POST /v1/ramp/quotes`). **PARTIAL** — quote creation is optional-auth by design for corridors that support public estimates (for example BRL). Alfredpay quote creation is user-gated inside the quote engines because upstream Alfredpay requires a real customer context; register/start require an effective user for all corridors. -- [x] Quote ownership is verified at ramp registration — the user/partner creating the ramp must match the quote creator. **PASS** — `assertQuoteOwnership` scopes by partner/user, and `RampService.registerRamp` additionally (a) rejects a linked user registering a quote owned by a different user with `403`, (b) rejects an authenticated caller claiming an anonymous (`quote.userId == null`) quote with `403`, and (c) requires an effective user for every corridor (inv. 14/16). UUID unpredictability and the 10-minute expiry remain as defense in depth. +- [x] Quote ownership is verified at ramp registration — the user/partner creating the ramp must match the quote creator. **PASS** — `assertQuoteOwnership` scopes by partner/user, and `RampService.registerRamp` additionally (a) rejects a linked user registering a quote owned by a different user with `403`, (b) rejects an authenticated caller claiming an anonymous (`quote.userId == null`) quote with `403`, and (c) requires an effective user for every corridor (inv. 15–17). UUID unpredictability and the 10-minute expiry remain as defense in depth. - [x] Profile-assigned quote pricing persists `pricing_partner_id` without granting partner ownership. **PASS** — profile-assigned quotes store `user_id`, leave `partner_id` `NULL`, and authorize through the user ownership path. - [x] Subsidy is only calculated when `targetDiscount > 0` — partners with no discount get `0` subsidy regardless of shortfall. **PASS** — verified in `calculateSubsidyAmount()`. - [x] `calculateSubsidyAmount` correctly caps at `maxSubsidy × expectedOutput` — verify the multiplication is the right semantic (fraction of expected, not absolute). **PASS** — confirmed: `maxSubsidy` is a fraction (0-1) multiplied by `expectedOutput`. From 46e0b63c40b1d1b9097fdf5a4a4dfcc7f412cd6e Mon Sep 17 00:00:00 2001 From: Kacper Szarkiewicz Date: Wed, 1 Jul 2026 15:21:12 +0200 Subject: [PATCH 056/176] include sk_key in mexico ramps --- docs/api/pages/02-quick-start-with-the-sdk.md | 4 ++++ packages/sdk/README.md | 4 +++- packages/sdk/examples/exampleAlfredpayMexico.ts | 13 ++++++++++--- packages/sdk/src/VortexSdk.ts | 8 ++++++++ 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/docs/api/pages/02-quick-start-with-the-sdk.md b/docs/api/pages/02-quick-start-with-the-sdk.md index e69b7794b..d73c5e673 100644 --- a/docs/api/pages/02-quick-start-with-the-sdk.md +++ b/docs/api/pages/02-quick-start-with-the-sdk.md @@ -135,6 +135,10 @@ console.log(started.achPaymentData); No user-signed on-chain transactions are required for onramp. The SDK signs ephemeral transactions during `registerRamp`. +Alfredpay (MXN) requires the user to be onboarded first. Authenticate the SDK with that user's own **user-linked** `secretKey` (the `sk_*` key created by that user), and the same user must have completed Alfredpay MXN KYC. The key and the KYC record belong to the same account, so a quote created with that key resolves to the user's Alfredpay customer automatically. A `publicKey`-only request, or a partner-scoped `sk_*` with no user, is rejected. + +Partner `sk_*` keys cannot drive Alfredpay KYC, and the SDK cannot mint keys or run KYC — onboard the user through the Vortex app or Widget first, then use their `sk_*` key (shown only once, at creation). This applies to both MXN onramp and offramp below. + ## MXN Offramp (Sell) Selling crypto for MXN requires the user to sign one or more on-chain transactions with their own wallet. The SDK returns those transactions in `unsignedTransactions`. diff --git a/packages/sdk/README.md b/packages/sdk/README.md index d74d83609..50cff644d 100644 --- a/packages/sdk/README.md +++ b/packages/sdk/README.md @@ -83,7 +83,9 @@ const startedRamp = await sdk.startRamp(rampProcess.id); console.log("Pay via:", startedRamp.achPaymentData); ``` -SDK/server integrations should authenticate with `publicKey` + `secretKey`, not a Supabase Bearer token. The current backend still needs a completed Alfredpay KYC customer context for this flow; partner-key-only registration will fail with `AlfredpayOnrampKycRequiredError` until a partner user-to-Alfredpay-customer mapping is supported. +Alfredpay requires the user to be onboarded first. Authenticate the SDK with that user's own **user-linked** `secretKey` (the `sk_*` key created by that user), not a `publicKey` alone, a partner-scoped key, or a Supabase Bearer token. The same user must have completed Alfredpay KYC for the country — the key and the KYC record belong to the same account, so a quote created with that key resolves to the user's Alfredpay customer automatically. + +> The SDK cannot mint keys or run KYC. Onboard the user through the Vortex app or Widget first, then use their `sk_*` key (shown only once, at creation) with the SDK. ### Alfredpay (USD / MXN / COP / ARS) offramp diff --git a/packages/sdk/examples/exampleAlfredpayMexico.ts b/packages/sdk/examples/exampleAlfredpayMexico.ts index c54d2f923..73559e77a 100644 --- a/packages/sdk/examples/exampleAlfredpayMexico.ts +++ b/packages/sdk/examples/exampleAlfredpayMexico.ts @@ -4,7 +4,12 @@ // (offramp: sign user txs via submitUserSignature/submitUserTxHash) -> startRamp. // // Requires a running backend (default http://localhost:3000) with Alfredpay enabled. -// Replace the placeholder addresses / fiatAccountId before running. +// +// Prerequisites: authenticate with the user's own user-linked secretKey (their sk_* key), and that +// same user must have completed Alfredpay MXN KYC. Onboard the user through the Vortex app first; +// the SDK cannot mint keys or run KYC. Offramp also needs that user's FIAT_ACCOUNT_ID below. +// +// Env: VORTEX_API_URL, VORTEX_PUBLIC_KEY, VORTEX_SECRET_KEY (user-linked), OFFRAMP_WALLET_PRIVATE_KEY. // // Run: // cd packages/sdk @@ -41,9 +46,11 @@ function askQuestion(query: string): Promise { function buildSdk(): VortexSdk { const config: VortexSdkConfig = { - apiBaseUrl: "", + apiBaseUrl: process.env.VORTEX_API_URL ?? "http://localhost:3000", autoReconnect: true, - publicKey: "", + publicKey: process.env.VORTEX_PUBLIC_KEY ?? "", + // Must be the user's user-linked sk_* key, not a partner-only key. + secretKey: process.env.VORTEX_SECRET_KEY ?? "", storeEphemeralKeys: true }; return new VortexSdk(config); diff --git a/packages/sdk/src/VortexSdk.ts b/packages/sdk/src/VortexSdk.ts index cec8f841a..abc131b01 100644 --- a/packages/sdk/src/VortexSdk.ts +++ b/packages/sdk/src/VortexSdk.ts @@ -50,6 +50,7 @@ import type { export class VortexSdk { private apiService: ApiService; private publicKey: string | undefined; + private secretKey: string | undefined; private networkManager: NetworkManager; private brlHandler: BrlHandler; private alfredpayHandler: AlfredpayHandler; @@ -62,6 +63,7 @@ export class VortexSdk { this.networkManager = new NetworkManager(config); this.storeEphemeralKeys = config.storeEphemeralKeys ?? true; this.publicKey = config.publicKey; + this.secretKey = config.secretKey; this.brlHandler = new BrlHandler( this.apiService, @@ -88,6 +90,12 @@ export class VortexSdk { } async createQuote(request: T): Promise> { + if ((isAlfredpayToken(request.inputCurrency) || isAlfredpayToken(request.outputCurrency)) && !this.secretKey) { + throw new Error( + "Alfredpay ramps require the user's user-linked secretKey (sk_*) in VortexSdkConfig. Onboard the user and complete KYC via the Vortex app first." + ); + } + const apiRequest = { ...request, api: true, apiKey: this.publicKey }; const baseQuote = await this.apiService.createQuote(apiRequest); return baseQuote as ExtendedQuoteResponse; From f850bfc3a935c2f83525b71bf7961e199db4c317 Mon Sep 17 00:00:00 2001 From: Kacper Szarkiewicz Date: Wed, 1 Jul 2026 16:17:51 +0200 Subject: [PATCH 057/176] fix(sdk,api): address PR review comments (drop vestigial Stellar; remove unused imports) --- .../transactions/onramp/routes/alfredpay-to-evm.ts | 2 -- packages/sdk/src/errors.ts | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/apps/api/src/api/services/transactions/onramp/routes/alfredpay-to-evm.ts b/apps/api/src/api/services/transactions/onramp/routes/alfredpay-to-evm.ts index 97372e6c0..1709fa0e8 100644 --- a/apps/api/src/api/services/transactions/onramp/routes/alfredpay-to-evm.ts +++ b/apps/api/src/api/services/transactions/onramp/routes/alfredpay-to-evm.ts @@ -17,9 +17,7 @@ import { Networks, UnsignedTx } from "@vortexfi/shared"; -import httpStatus from "http-status"; import { isAddress } from "viem"; -import { APIError } from "../../../../errors/api-error"; import { getEvmFundingAccount } from "../../../phases/evm-funding"; import { StateMetadata } from "../../../phases/meta-state-types"; import { resolveAlfredpayCustomerId } from "../../../quote/alfredpay-customer"; diff --git a/packages/sdk/src/errors.ts b/packages/sdk/src/errors.ts index ef52ff42e..677c43bc4 100644 --- a/packages/sdk/src/errors.ts +++ b/packages/sdk/src/errors.ts @@ -65,7 +65,7 @@ export class InvalidAdditionalDataError extends RegisterRampError { } } -export type EphemeralChain = "Substrate" | "EVM" | "Stellar"; +export type EphemeralChain = "Substrate" | "EVM"; export class EphemeralNotFreshError extends RegisterRampError { public readonly chain: EphemeralChain; @@ -440,15 +440,15 @@ export function parseAPIError(response: unknown): VortexSdkError { return new InvalidNetworkError(network); } - const freshnessMatch = errorMessage.match(/^(Substrate|EVM|Stellar) ephemeral (\S+) (?:is not fresh|already exists)/); + const freshnessMatch = errorMessage.match(/^(Substrate|EVM) ephemeral (\S+) (?:is not fresh|already exists)/); if (freshnessMatch) { return new EphemeralNotFreshError(errorMessage, freshnessMatch[1] as EphemeralChain, freshnessMatch[2]); } - const freshnessCheckMatch = errorMessage.match(/^Could not verify freshness of (Substrate|EVM|Stellar) ephemeral (\S+)/); + const freshnessCheckMatch = errorMessage.match(/^Could not verify freshness of (Substrate|EVM) ephemeral (\S+)/); if (freshnessCheckMatch) { return new EphemeralFreshnessCheckError(errorMessage, freshnessCheckMatch[1] as EphemeralChain, freshnessCheckMatch[2]); } - const missingEphemeralMatch = errorMessage.match(/^(Substrate|EVM|Stellar) ephemeral address is required/); + const missingEphemeralMatch = errorMessage.match(/^(Substrate|EVM) ephemeral address is required/); if (missingEphemeralMatch) { return new EphemeralNotFreshError(errorMessage, missingEphemeralMatch[1] as EphemeralChain, ""); } From 67039974903901736ef53120ddc6913af88a28a6 Mon Sep 17 00:00:00 2001 From: Kacper Szarkiewicz Date: Thu, 2 Jul 2026 16:01:38 +0200 Subject: [PATCH 058/176] fix refresh auth token --- apps/frontend/src/config/supabase.ts | 8 +- apps/frontend/src/contexts/rampState.tsx | 59 ++++++++++++ apps/frontend/src/hooks/useAuthTokens.ts | 6 -- apps/frontend/src/machines/ramp.actors.ts | 10 ++- apps/frontend/src/services/api/api-client.ts | 52 ++++++++--- apps/frontend/src/services/auth.ts | 94 +++++++++++++------- docs/security-spec/01-auth/supabase-otp.md | 3 + 7 files changed, 172 insertions(+), 60 deletions(-) diff --git a/apps/frontend/src/config/supabase.ts b/apps/frontend/src/config/supabase.ts index 7bfa762c6..609691faf 100644 --- a/apps/frontend/src/config/supabase.ts +++ b/apps/frontend/src/config/supabase.ts @@ -9,8 +9,10 @@ if (!supabaseUrl || !supabaseAnonKey) { export const supabase = createClient(supabaseUrl, supabaseAnonKey, { auth: { - autoRefreshToken: true, - detectSessionInUrl: true, - persistSession: true + // The app owns token storage and refresh (backend /auth/refresh + a single scheduler). + // Keep the client passive so it doesn't run a competing background refresh. + autoRefreshToken: false, + detectSessionInUrl: false, + persistSession: false } }); diff --git a/apps/frontend/src/contexts/rampState.tsx b/apps/frontend/src/contexts/rampState.tsx index 871441332..3e1c048dc 100644 --- a/apps/frontend/src/contexts/rampState.tsx +++ b/apps/frontend/src/contexts/rampState.tsx @@ -12,11 +12,14 @@ import { SelectedAveniaData, SelectedMykoboData } from "../machines/types"; +import { AuthService } from "../services/auth"; import { RampExecutionInput } from "../types/phases"; const RAMP_STATE_STORAGE_KEY = "rampState"; const RAMP_EPHEMERALS_STORAGE_KEY = "rampEphemerals"; const MAX_RAMP_EPHEMERALS = 50; +const TOKEN_REFRESH_SKEW_MS = 60 * 1000; // refresh 60s before expiry +const TOKEN_REFRESH_RETRY_MS = 30 * 1000; // retry after a transient failure type RampEphemeralEntry = { substrateEphemeral: EphemeralAccount; @@ -136,10 +139,66 @@ const PersistenceEffect = () => { return null; }; +// Single app-wide token refresher: schedules a refresh just before the access token's real +// expiry (decoded from the JWT), reschedules off each new token, and retries transient +// failures without dropping the session. +const TokenRefreshEffect = () => { + const rampActor = useRampActor(); + const isAuthenticated = useSelector(rampActor, state => state?.context.isAuthenticated ?? false); + + useEffect(() => { + if (!isAuthenticated) { + return; + } + + let cancelled = false; + let timer: ReturnType | undefined; + + const scheduleNext = () => { + const expiryMs = AuthService.getAccessTokenExpiryMs(); + if (expiryMs === null) { + return; + } + const delay = Math.max(expiryMs - Date.now() - TOKEN_REFRESH_SKEW_MS, 0); + timer = setTimeout(async () => { + if (cancelled) return; + try { + const refreshed = await AuthService.refreshAccessToken(); + if (cancelled) return; + if (refreshed) { + // refreshAccessToken() has already persisted the new token, so this reads the fresh expiry. + scheduleNext(); + } else { + // Refresh token confirmed invalid: the session is over. + rampActor.send({ type: "LOGOUT" }); + } + } catch { + // Transient failure: retry soon without touching the session. + if (!cancelled) { + timer = setTimeout(scheduleNext, TOKEN_REFRESH_RETRY_MS); + } + } + }, delay); + }; + + scheduleNext(); + + return () => { + cancelled = true; + if (timer) { + clearTimeout(timer); + } + }; + }, [isAuthenticated, rampActor]); + + return null; +}; + export const PersistentRampStateProvider: React.FC = ({ children }) => { return ( + {children} ); diff --git a/apps/frontend/src/hooks/useAuthTokens.ts b/apps/frontend/src/hooks/useAuthTokens.ts index f09b8db23..17831fe66 100644 --- a/apps/frontend/src/hooks/useAuthTokens.ts +++ b/apps/frontend/src/hooks/useAuthTokens.ts @@ -49,12 +49,6 @@ export function useAuthTokens(actorRef: ActorRefFrom) { } }, [actorRef]); - // Setup auto-refresh on mount - useEffect(() => { - const cleanup = AuthService.setupAutoRefresh(); - return cleanup; - }, []); - // Restore session from localStorage on mount useEffect(() => { // Only restore once on initial mount to avoid infinite loops diff --git a/apps/frontend/src/machines/ramp.actors.ts b/apps/frontend/src/machines/ramp.actors.ts index e22c3e2a4..c60acf166 100644 --- a/apps/frontend/src/machines/ramp.actors.ts +++ b/apps/frontend/src/machines/ramp.actors.ts @@ -78,12 +78,14 @@ export async function checkAndRefreshTokenActor() { if (refreshedTokens) { return { success: true, tokens: refreshedTokens }; } + // A null result means the refresh token is confirmed invalid: the session is dead. + AuthService.clearTokens(); + return { success: false, tokens: null }; } catch { - // If refreshing fails, continue to the shared cleanup path below. + // Transient refresh failure (network/5xx): keep the session rather than forcing a + // logout. Proceed with the current tokens; request-level 401 retry will recover later. + return { success: true, tokens }; } - - AuthService.clearTokens(); - return { success: false, tokens: null }; } export async function loadQuoteActor({ input }: { input: { quoteId: string } }) { diff --git a/apps/frontend/src/services/api/api-client.ts b/apps/frontend/src/services/api/api-client.ts index 66f9c66a1..2755074fa 100644 --- a/apps/frontend/src/services/api/api-client.ts +++ b/apps/frontend/src/services/api/api-client.ts @@ -1,5 +1,21 @@ import { SIGNING_SERVICE_URL } from "../../constants/constants"; -import { AuthService } from "../auth"; +import { AuthService, type AuthTokens } from "../auth"; + +// Single-flight token refresh: concurrent 401s share one refresh instead of each firing +// their own (which would race the refresh-token rotation and fail). +let refreshPromise: Promise | null = null; + +function refreshTokenOnce(): Promise { + if (!refreshPromise) { + refreshPromise = AuthService.refreshAccessToken() + // A transient refresh failure shouldn't reject every waiting request; treat as "no new token". + .catch(() => null) + .finally(() => { + refreshPromise = null; + }); + } + return refreshPromise; +} export class ApiError extends Error { status: number; @@ -26,8 +42,6 @@ async function apiFetch( signal?: AbortSignal; } = {} ): Promise { - const tokens = AuthService.getTokens(); - const url = new URL(`${SIGNING_SERVICE_URL}/v1${path}`, window.location.origin); if (options.params) { for (const [key, value] of Object.entries(options.params)) { @@ -36,17 +50,29 @@ async function apiFetch( } const isFormData = options.data instanceof FormData; + const body = isFormData ? (options.data as FormData) : options.data !== undefined ? JSON.stringify(options.data) : undefined; - const response = await fetch(url.toString(), { - body: isFormData ? (options.data as FormData) : options.data !== undefined ? JSON.stringify(options.data) : undefined, - headers: { - ...(tokens?.accessToken ? { Authorization: `Bearer ${tokens.accessToken}` } : {}), - ...(!isFormData ? { "Content-Type": "application/json" } : {}), - ...options.headers - }, - method, - signal: options.signal ? AbortSignal.any([options.signal, AbortSignal.timeout(30000)]) : AbortSignal.timeout(30000) - }); + const doFetch = (accessToken: string | undefined) => + fetch(url.toString(), { + body, + headers: { + ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}), + ...(!isFormData ? { "Content-Type": "application/json" } : {}), + ...options.headers + }, + method, + signal: options.signal ? AbortSignal.any([options.signal, AbortSignal.timeout(30000)]) : AbortSignal.timeout(30000) + }); + + const initialTokens = AuthService.getTokens(); + let response = await doFetch(initialTokens?.accessToken); + + if (response.status === 401 && initialTokens?.accessToken) { + const refreshed = await refreshTokenOnce(); + if (refreshed?.accessToken) { + response = await doFetch(refreshed.accessToken); + } + } if (!response.ok) { const errorData = (await response.json().catch(() => ({}))) as { error?: string; message?: string }; diff --git a/apps/frontend/src/services/auth.ts b/apps/frontend/src/services/auth.ts index cfd4f89fc..2eb9e5258 100644 --- a/apps/frontend/src/services/auth.ts +++ b/apps/frontend/src/services/auth.ts @@ -1,4 +1,5 @@ import { supabase } from "../config/supabase"; +import { SIGNING_SERVICE_URL } from "../constants/constants"; export interface AuthTokens { accessToken: string; @@ -60,7 +61,36 @@ export class AuthService { * Check if user is authenticated */ static isAuthenticated(): boolean { - return this.getTokens() !== null; + const tokens = this.getTokens(); + if (!tokens) { + return false; + } + const expiryMs = this.getAccessTokenExpiryMs(); + return expiryMs === null || expiryMs > Date.now(); + } + + /** + * Returns the access token expiry as epoch milliseconds, or null if it can't be decoded. + */ + static getAccessTokenExpiryMs(): number | null { + const tokens = this.getTokens(); + if (!tokens) { + return null; + } + return this.decodeJwtExpiryMs(tokens.accessToken); + } + + private static decodeJwtExpiryMs(token: string): number | null { + try { + const payload = token.split(".")[1]; + if (!payload) { + return null; + } + const decoded = JSON.parse(atob(payload.replace(/-/g, "+").replace(/_/g, "/"))) as { exp?: number }; + return typeof decoded.exp === "number" ? decoded.exp * 1000 : null; + } catch { + return null; + } } /** @@ -89,7 +119,12 @@ export class AuthService { } /** - * Refresh access token + * Refresh the access token via the backend `/auth/refresh` endpoint. + * + * Returns the new tokens on success, or `null` when the refresh token is confirmed + * invalid/revoked (a 401 from the backend) — in which case the session is cleared. + * Transient failures (network errors, timeouts, 5xx) throw so callers can retry + * without destroying a still-valid session. */ static async refreshAccessToken(): Promise { const tokens = this.getTokens(); @@ -97,45 +132,36 @@ export class AuthService { return null; } - try { - const { data, error } = await supabase.auth.refreshSession({ - refresh_token: tokens.refreshToken - }); - - if (error || !data.session || !data.user) { - this.clearTokens(); - return null; - } + const response = await fetch(`${SIGNING_SERVICE_URL}/v1/auth/refresh`, { + body: JSON.stringify({ refresh_token: tokens.refreshToken }), + headers: { "Content-Type": "application/json" }, + method: "POST", + signal: AbortSignal.timeout(30000) + }); - const newTokens: AuthTokens = { - accessToken: data.session.access_token, - refreshToken: data.session.refresh_token, - userEmail: data.user.email, - userId: data.user.id - }; - - this.storeTokens(newTokens); - return newTokens; - } catch (error) { - console.error("Token refresh failed:", error); + // A 401 means the refresh token itself is invalid/revoked: the session is dead. + if (response.status === 401) { this.clearTokens(); return null; } - } - /** - * Setup auto-refresh (refresh 5 minutes before expiry) - */ - static setupAutoRefresh(): () => void { - const REFRESH_INTERVAL = 55 * 60 * 1000; // 55 minutes + // Any other non-OK status is transient — keep the session and let the caller retry. + if (!response.ok) { + throw new Error(`Token refresh failed with status ${response.status}`); + } - const intervalId = setInterval(async () => { - if (this.isAuthenticated()) { - await this.refreshAccessToken(); - } - }, REFRESH_INTERVAL); + const data = (await response.json()) as { access_token: string; refresh_token: string }; + + // The refresh endpoint does not return identity; it is unchanged across a refresh. + const newTokens: AuthTokens = { + accessToken: data.access_token, + refreshToken: data.refresh_token, + userEmail: tokens.userEmail, + userId: tokens.userId + }; - return () => clearInterval(intervalId); + this.storeTokens(newTokens); + return newTokens; } /** diff --git a/docs/security-spec/01-auth/supabase-otp.md b/docs/security-spec/01-auth/supabase-otp.md index 5a6a03752..7c10ae469 100644 --- a/docs/security-spec/01-auth/supabase-otp.md +++ b/docs/security-spec/01-auth/supabase-otp.md @@ -10,6 +10,7 @@ The flow: 3. Supabase verifies OTP and issues a JWT access token 4. Frontend includes JWT in `Authorization: Bearer ` header on API requests 5. API middleware (`supabaseAuth.ts`) verifies the JWT via `SupabaseAuthService.verifyToken()` and attaches `userId` to the request +6. Access tokens are short-lived. The frontend refreshes them via `POST /v1/auth/refresh` (`SupabaseAuthService.refreshToken()` → Supabase `refreshSession`), scheduled just before expiry and also triggered on a `401` (single-flight refresh + one retry). The frontend never calls Supabase `refreshSession` directly with the anon key. Two middleware variants exist: - **`requireAuth`** — Returns 401 if token is missing or invalid. Used on protected endpoints. @@ -25,6 +26,7 @@ Two middleware variants exist: 6. **Auth errors MUST NOT leak token content** — Error responses must use generic messages ("Invalid or expired token"). Tokens must be truncated in logs (as implemented: first 15 + last 4 chars). 7. **Supabase configuration MUST be present** — If `SUPABASE_URL`, `SUPABASE_ANON_KEY`, or `SUPABASE_SERVICE_KEY` are empty/missing, the auth system is non-functional. The service should fail to start rather than silently accept all tokens. 8. **JWT expiry MUST be enforced** — Supabase tokens have a configurable expiry. The verification MUST reject expired tokens, not just validate the signature. +9. **Session teardown MUST happen only on confirmed-invalid refresh** — The frontend clears the stored session (and forces re-login) only when `/v1/auth/refresh` returns `401` (refresh token invalid/revoked). Transient failures (network errors, 5xx, timeouts) MUST NOT clear the session; they are retried while the existing session is preserved. ## Threat Vectors & Mitigations @@ -48,4 +50,5 @@ Two middleware variants exist: - [x] `optionalAuth` truncates tokens in warning logs (first 15 + last 4 characters) — **PASS** - [x] `SUPABASE_URL`, `SUPABASE_ANON_KEY`, and `SUPABASE_SERVICE_KEY` are validated at startup — empty strings are treated as missing — **FAIL: All default to "" with no startup validation (F-019)** - [x] Token expiry is enforced by the verification call (not just signature validity) — **PASS** +- [x] Frontend refresh goes through `/v1/auth/refresh` (not the anon-key client) and clears the session only on a `401`, retrying transient failures — **PASS** - [x] No endpoint that should require auth is using `optionalAuth` as a shortcut — **PARTIAL: BRLA KYC endpoints use optionalAuth but create user-specific resources** From 38884ab39bc399947f10ca9a62d533b467e22e9e Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Thu, 2 Jul 2026 17:52:17 +0200 Subject: [PATCH 059/176] Implement resetFailedNablaSwapOnResume function and related tests for handling stale and failed transactions --- .../usdc-brla-usdc-base/steps.test.ts | 80 +++++++++++++++++++ .../rebalance/usdc-brla-usdc-base/steps.ts | 40 ++++++++++ 2 files changed, 120 insertions(+) diff --git a/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/steps.test.ts b/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/steps.test.ts index ad8ce851d..3882885c8 100644 --- a/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/steps.test.ts +++ b/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/steps.test.ts @@ -4,10 +4,90 @@ import { ensurePolygonBrlaAvailableForSquidSwap, recoverAveniaPolygonTransferFromBalance, recoverSquidUsdcOutputFromBaseBalance, + resetFailedNablaSwapOnResume, resetFailedSquidRouterSwapOnResume } from "./steps.ts"; describe("USDC Base SquidRouter steps", () => { + test("clears a persisted Nabla swap when the Base receipt failed", async () => { + const state = createUsdcBaseRebalanceState("1000000000", UsdcBaseRebalancePhase.NablaApprove); + state.nablaSwapHash = "0xfailed"; + + const savedStates: Array<{ nablaSwapHash: string | null }> = []; + const stateManager = { + saveState: async () => { + savedStates.push({ nablaSwapHash: state.nablaSwapHash }); + } + }; + const publicClient = { + getTransactionReceipt: async () => ({ status: "reverted" as const }) + }; + + await expect(resetFailedNablaSwapOnResume("0xfailed", state, stateManager, publicClient)).resolves.toBe(true); + expect(state.nablaSwapHash).toBeNull(); + expect(savedStates).toEqual([{ nablaSwapHash: null }]); + }); + + test("keeps a persisted Nabla swap when the Base receipt succeeded", async () => { + const state = createUsdcBaseRebalanceState("1000000000", UsdcBaseRebalancePhase.NablaApprove); + state.nablaSwapHash = "0xsuccess"; + + const stateManager = { + saveState: async () => { + throw new Error("successful receipts should not rewrite state"); + } + }; + const publicClient = { + getTransactionReceipt: async () => ({ status: "success" as const }) + }; + + await expect(resetFailedNablaSwapOnResume("0xsuccess", state, stateManager, publicClient)).resolves.toBe(false); + expect(state.nablaSwapHash).toBe("0xsuccess"); + }); + + test("clears a stale persisted Nabla swap when the Base receipt is missing", async () => { + const state = createUsdcBaseRebalanceState("1000000000", UsdcBaseRebalancePhase.NablaApprove); + state.nablaSwapHash = "0xmissing"; + state.updatedTime = new Date(Date.now() - 16 * 60_000).toISOString(); + + const savedStates: Array<{ nablaSwapHash: string | null }> = []; + const stateManager = { + saveState: async () => { + savedStates.push({ nablaSwapHash: state.nablaSwapHash }); + } + }; + const publicClient = { + getTransactionReceipt: async () => { + throw new Error("Transaction not found"); + } + }; + + await expect(resetFailedNablaSwapOnResume("0xmissing", state, stateManager, publicClient)).resolves.toBe(true); + expect(state.nablaSwapHash).toBeNull(); + expect(savedStates).toEqual([{ nablaSwapHash: null }]); + }); + + test("keeps a fresh persisted Nabla swap when the Base receipt is temporarily missing", async () => { + const state = createUsdcBaseRebalanceState("1000000000", UsdcBaseRebalancePhase.NablaApprove); + state.nablaSwapHash = "0xmissing"; + + const stateManager = { + saveState: async () => { + throw new Error("fresh missing receipts should not rewrite state"); + } + }; + const publicClient = { + getTransactionReceipt: async () => { + throw new Error("Transaction not found"); + } + }; + + await expect(resetFailedNablaSwapOnResume("0xmissing", state, stateManager, publicClient)).rejects.toThrow( + "Transaction not found" + ); + expect(state.nablaSwapHash).toBe("0xmissing"); + }); + test("clears a persisted SquidRouter swap when the Polygon receipt failed", async () => { const state = createUsdcBaseRebalanceState("1000000000", UsdcBaseRebalancePhase.SquidRouterApproveAndSwap); state.squidRouterSwapHash = "0xfailed"; diff --git a/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/steps.ts b/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/steps.ts index fe318a8bf..3e4ce04ef 100644 --- a/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/steps.ts +++ b/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/steps.ts @@ -29,6 +29,14 @@ export const USDC_BASE: `0x${string}` = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02 export const BRLA_POLYGON: `0x${string}` = brlaMoonbeamTokenDetails.polygonErc20Address as `0x${string}`; const NABLA_SWAP_DEADLINE_MINUTES = 60 * 24 * 7; const AMM_MINIMUM_OUTPUT_HARD_MARGIN = 0.05; +const STALE_PERSISTED_TX_MINUTES = 15; + +function isPersistedTransactionStale(updatedTime: string): boolean { + const updatedAt = Date.parse(updatedTime); + if (Number.isNaN(updatedAt)) return false; + + return Date.now() - updatedAt > STALE_PERSISTED_TX_MINUTES * 60_000; +} function buildRecoveredBrlaOutput(brlaReceivedRaw: bigint) { const brlaAmountRaw = brlaReceivedRaw.toString(); @@ -203,6 +211,10 @@ export async function nablaApproveAndSwapOnBase( let approveHash = state.nablaApproveHash; let swapHash = state.nablaSwapHash; + if (swapHash && (await resetFailedNablaSwapOnResume(swapHash, state, stateManager, publicClient))) { + swapHash = null; + } + if (!swapHash) { const evmClientManager = EvmClientManager.getInstance(); const quoteAbi = [ @@ -340,6 +352,34 @@ export async function nablaApproveAndSwapOnBase( }; } +export async function resetFailedNablaSwapOnResume( + swapHash: string, + state: UsdcBaseRebalanceState, + stateManager: Pick, + publicClient: Pick +): Promise { + let receipt: Awaited>; + try { + receipt = await publicClient.getTransactionReceipt({ + hash: swapHash as `0x${string}` + }); + } catch (error) { + if (!isPersistedTransactionStale(state.updatedTime)) throw error; + + console.warn(`Persisted Nabla swap tx ${swapHash} was not found after ${STALE_PERSISTED_TX_MINUTES} minutes. Retrying.`); + state.nablaSwapHash = null; + await stateManager.saveState(state); + return true; + } + + if (receipt.status === "success") return false; + + console.warn(`Persisted Nabla swap tx ${swapHash} failed on Base. Retrying with a fresh quote and swap.`); + state.nablaSwapHash = null; + await stateManager.saveState(state); + return true; +} + export async function transferBrlaToAveniaOnBase( brlaAmountRaw: string, baseNonce: NonceManager, From 723d2344566166a2c1cc04f8f735633628b968fc Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Thu, 2 Jul 2026 18:13:40 +0200 Subject: [PATCH 060/176] Add support for configurable profitable USDC to BRLA amount and implement selection logic --- apps/rebalancer/.env.example | 2 + apps/rebalancer/README.md | 3 + apps/rebalancer/src/index.ts | 64 +++++++++++++++++-- .../usdc-brla-usdc-base/amountPolicy.test.ts | 25 ++++++++ .../usdc-brla-usdc-base/amountPolicy.ts | 17 +++++ .../rebalance/usdc-brla-usdc-base/steps.ts | 8 ++- apps/rebalancer/src/utils/config.test.ts | 21 ++++++ apps/rebalancer/src/utils/config.ts | 3 + .../security-spec/07-operations/rebalancer.md | 24 +++---- 9 files changed, 147 insertions(+), 20 deletions(-) create mode 100644 apps/rebalancer/src/rebalance/usdc-brla-usdc-base/amountPolicy.test.ts create mode 100644 apps/rebalancer/src/rebalance/usdc-brla-usdc-base/amountPolicy.ts diff --git a/apps/rebalancer/.env.example b/apps/rebalancer/.env.example index 617565554..e714449cb 100644 --- a/apps/rebalancer/.env.example +++ b/apps/rebalancer/.env.example @@ -11,6 +11,8 @@ BRLA_LOGIN_PASSWORD=your_password_here SLACK_WEB_HOOK_TOKEN=your_slack_webhook_token_here REBALANCING_USD_TO_BRL_AMOUNT=100 +# Larger USDC amount used for USDC→BRLA→USDC when the standard amount is projected profitable. +REBALANCING_PROFITABLE_USD_TO_BRL_AMOUNT=200 SUPABASE_URL=your_supabase_url_here SUPABASE_SERVICE_KEY=your_supabase_service_key_here diff --git a/apps/rebalancer/README.md b/apps/rebalancer/README.md index e74981273..ac699f628 100644 --- a/apps/rebalancer/README.md +++ b/apps/rebalancer/README.md @@ -21,6 +21,9 @@ PENDULUM_ACCOUNT_SECRET=xxx For Base rebalancing, the in-range opportunistic USDC→BRLA→USDC trigger is controlled by `REBALANCING_OPPORTUNISTIC_USDC_TO_BRLA_MAX_COST_BPS` and defaults to `10` bps when unset. +USDC→BRLA→USDC runs use `REBALANCING_USD_TO_BRL_AMOUNT` by default. If that standard amount is projected +profitable, the rebalancer evaluates `REBALANCING_PROFITABLE_USD_TO_BRL_AMOUNT` with fresh quotes and uses it only if +the larger amount is also projected profitable. When unset, it defaults to the standard amount. `REBALANCING_DAILY_BRIDGE_LIMIT_USD` caps paid Base rebalances only: projected-profitable current runs bypass the cap, but all completed Base runs are recorded in history and count toward later paid-run limit checks. diff --git a/apps/rebalancer/src/index.ts b/apps/rebalancer/src/index.ts index b3ab979b7..b1f0c9720 100644 --- a/apps/rebalancer/src/index.ts +++ b/apps/rebalancer/src/index.ts @@ -6,6 +6,7 @@ import { checkInitialPendulumBalance } from "./rebalance/brla-to-axlusdc/steps.t import { rebalanceBrlaToUsdcBase } from "./rebalance/brla-to-usdc-base"; import { quoteBrlaToUsdcBaseRebalance } from "./rebalance/brla-to-usdc-base/steps.ts"; import { rebalanceUsdcBrlaUsdcBase } from "./rebalance/usdc-brla-usdc-base"; +import { selectUsdcToBrlaAmount } from "./rebalance/usdc-brla-usdc-base/amountPolicy.ts"; import { evaluatePaidRunDailyLimit, sumTodayBridgedUsdRaw } from "./rebalance/usdc-brla-usdc-base/dailyLimit.ts"; import { type DailyBridgeLimitDecision, @@ -276,11 +277,60 @@ async function executeUsdcToBrlaRebalance( return true; } +function toUsdcRaw(amountUsdc: string): string { + return multiplyByPowerOfTen(new Big(amountUsdc), 6).toFixed(0, 0); +} + +async function selectUsdcToBrlaPolicyAmount(coverageDeviationBps: number): Promise<{ + amountUsdcRaw: string; + policyDecision: Awaited>; +}> { + const config = getConfig(); + const standardAmountSelection = selectUsdcToBrlaAmount( + config.rebalancingUsdToBrlAmount, + config.rebalancingProfitableUsdToBrlAmount, + false, + manualAmount + ); + const standardAmountRaw = toUsdcRaw(standardAmountSelection.amountUsdc); + const standardPolicyDecision = await evaluateUsdcToBrlaPolicy(standardAmountRaw, coverageDeviationBps); + + const profitableAmountSelection = selectUsdcToBrlaAmount( + config.rebalancingUsdToBrlAmount, + config.rebalancingProfitableUsdToBrlAmount, + standardPolicyDecision.profitable, + manualAmount + ); + + if (profitableAmountSelection.reason !== "profitable") { + return { amountUsdcRaw: standardAmountRaw, policyDecision: standardPolicyDecision }; + } + + const profitableAmountRaw = toUsdcRaw(profitableAmountSelection.amountUsdc); + if (profitableAmountRaw === standardAmountRaw) { + return { amountUsdcRaw: standardAmountRaw, policyDecision: standardPolicyDecision }; + } + + console.log( + `Standard USDC->BRLA rebalance amount ${standardAmountSelection.amountUsdc} USDC is projected profitable. ` + + `Evaluating profitable amount ${profitableAmountSelection.amountUsdc} USDC.` + ); + + const profitablePolicyDecision = await evaluateUsdcToBrlaPolicy(profitableAmountRaw, coverageDeviationBps); + if (!profitablePolicyDecision.profitable) { + console.log( + `Configured profitable amount ${profitableAmountSelection.amountUsdc} USDC is not projected profitable. ` + + `Using standard amount ${standardAmountSelection.amountUsdc} USDC.` + ); + return { amountUsdcRaw: standardAmountRaw, policyDecision: standardPolicyDecision }; + } + + return { amountUsdcRaw: profitableAmountRaw, policyDecision: profitablePolicyDecision }; +} + async function tryOpportunisticUsdcToBrla(): Promise { const config = getConfig(); - const amountUsdc = manualAmount || config.rebalancingUsdToBrlAmount; - const amountUsdcRaw = multiplyByPowerOfTen(new Big(amountUsdc), 6).toFixed(0, 0); - const policyDecision = await evaluateUsdcToBrlaPolicy(amountUsdcRaw, 0); + const { amountUsdcRaw, policyDecision } = await selectUsdcToBrlaPolicyAmount(0); const opportunisticMaxCostBps = config.rebalancingCostPolicy.opportunisticUsdcToBrlaMaxCostBps; if (!policyDecision.shouldExecute) return false; @@ -329,17 +379,17 @@ async function evaluateBrlaToUsdcPolicy( async function runUsdcToBrla(coverageDeviationBps: number) { const config = getConfig(); - const amountUsdc = manualAmount || config.rebalancingUsdToBrlAmount; - const amountUsdcRaw = multiplyByPowerOfTen(new Big(amountUsdc), 6).toFixed(0, 0); + const amountUsdcRaw = toUsdcRaw(manualAmount || config.rebalancingUsdToBrlAmount); const stateManager = new UsdcBaseStateManager(); const state = await stateManager.getState(); const isResuming = !forceRestart && state && state.currentPhase !== UsdcBaseRebalancePhase.Idle; if (!isResuming) { - const policyDecision = await evaluateUsdcToBrlaPolicy(amountUsdcRaw, coverageDeviationBps); + const selectedAmount = await selectUsdcToBrlaPolicyAmount(coverageDeviationBps); + const policyDecision = selectedAmount.policyDecision; if (!policyDecision.shouldExecute) return; - await executeUsdcToBrlaRebalance(amountUsdcRaw, coverageDeviationBps, policyDecision); + await executeUsdcToBrlaRebalance(selectedAmount.amountUsdcRaw, coverageDeviationBps, policyDecision); return; } diff --git a/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/amountPolicy.test.ts b/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/amountPolicy.test.ts new file mode 100644 index 000000000..814b03fe4 --- /dev/null +++ b/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/amountPolicy.test.ts @@ -0,0 +1,25 @@ +import {describe, expect, test} from "bun:test"; +import {selectUsdcToBrlaAmount} from "./amountPolicy.ts"; + +describe("USDC to BRLA amount policy", () => { + test("uses the standard amount when the projection is not profitable", () => { + expect(selectUsdcToBrlaAmount("1000", "2000", false, null)).toEqual({ + amountUsdc: "1000", + reason: "standard" + }); + }); + + test("uses the profitable amount when the standard projection is profitable", () => { + expect(selectUsdcToBrlaAmount("1000", "2000", true, null)).toEqual({ + amountUsdc: "2000", + reason: "profitable" + }); + }); + + test("keeps manual amounts explicit", () => { + expect(selectUsdcToBrlaAmount("1000", "2000", true, "750")).toEqual({ + amountUsdc: "750", + reason: "manual" + }); + }); +}); diff --git a/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/amountPolicy.ts b/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/amountPolicy.ts new file mode 100644 index 000000000..29e596ec8 --- /dev/null +++ b/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/amountPolicy.ts @@ -0,0 +1,17 @@ +export interface UsdcToBrlaAmountSelection { + amountUsdc: string; + reason: "manual" | "standard" | "profitable"; +} + +export function selectUsdcToBrlaAmount( + standardAmount: string, + profitableAmount: string, + isProjectedProfitable: boolean, + manualAmount: string | null +): UsdcToBrlaAmountSelection { + if (manualAmount) return { amountUsdc: manualAmount, reason: "manual" }; + + if (isProjectedProfitable) return { amountUsdc: profitableAmount, reason: "profitable" }; + + return { amountUsdc: standardAmount, reason: "standard" }; +} diff --git a/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/steps.ts b/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/steps.ts index 3e4ce04ef..9a9a504ff 100644 --- a/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/steps.ts +++ b/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/steps.ts @@ -31,6 +31,10 @@ const NABLA_SWAP_DEADLINE_MINUTES = 60 * 24 * 7; const AMM_MINIMUM_OUTPUT_HARD_MARGIN = 0.05; const STALE_PERSISTED_TX_MINUTES = 15; +interface TransactionReceiptStatusReader { + getTransactionReceipt(args: { hash: `0x${string}` }): Promise<{ status: "success" | "reverted" }>; +} + function isPersistedTransactionStale(updatedTime: string): boolean { const updatedAt = Date.parse(updatedTime); if (Number.isNaN(updatedAt)) return false; @@ -356,9 +360,9 @@ export async function resetFailedNablaSwapOnResume( swapHash: string, state: UsdcBaseRebalanceState, stateManager: Pick, - publicClient: Pick + publicClient: TransactionReceiptStatusReader ): Promise { - let receipt: Awaited>; + let receipt: { status: "success" | "reverted" }; try { receipt = await publicClient.getTransactionReceipt({ hash: swapHash as `0x${string}` diff --git a/apps/rebalancer/src/utils/config.test.ts b/apps/rebalancer/src/utils/config.test.ts index 92f68739f..d17151cf5 100644 --- a/apps/rebalancer/src/utils/config.test.ts +++ b/apps/rebalancer/src/utils/config.test.ts @@ -1,11 +1,15 @@ import {afterEach, beforeEach, describe, expect, test} from "bun:test"; import { + getConfig, getRebalancingCostPolicyConfig, parseRebalancingDailyBridgeLimitUsd, parseRebalancingPolicyMode } from "./config.ts"; const policyEnvVars = [ + "EVM_ACCOUNT_SECRET", + "REBALANCING_USD_TO_BRL_AMOUNT", + "REBALANCING_PROFITABLE_USD_TO_BRL_AMOUNT", "REBALANCING_POLICY_MODE", "REBALANCING_MODERATE_DEVIATION_BPS", "REBALANCING_SEVERE_DEVIATION_BPS", @@ -128,3 +132,20 @@ describe("getRebalancingCostPolicyConfig", () => { delete process.env.REBALANCING_MAX_COST_BPS_MODERATE; }); }); + +describe("getConfig", () => { + test("defaults the profitable USDC to BRLA amount to the standard amount", () => { + process.env.EVM_ACCOUNT_SECRET = "test test test test test test test test test test test junk"; + process.env.REBALANCING_USD_TO_BRL_AMOUNT = "1000"; + + expect(getConfig().rebalancingProfitableUsdToBrlAmount).toBe("1000"); + }); + + test("allows configuring a larger profitable USDC to BRLA amount", () => { + process.env.EVM_ACCOUNT_SECRET = "test test test test test test test test test test test junk"; + process.env.REBALANCING_USD_TO_BRL_AMOUNT = "1000"; + process.env.REBALANCING_PROFITABLE_USD_TO_BRL_AMOUNT = "2000"; + + expect(getConfig().rebalancingProfitableUsdToBrlAmount).toBe("2000"); + }); +}); diff --git a/apps/rebalancer/src/utils/config.ts b/apps/rebalancer/src/utils/config.ts index 803efe915..7a5fb1aef 100644 --- a/apps/rebalancer/src/utils/config.ts +++ b/apps/rebalancer/src/utils/config.ts @@ -105,6 +105,9 @@ export function getConfig() { rebalancingBrlToUsdMinBalance: process.env.REBALANCING_BRL_TO_USD_MIN_BALANCE || undefined, rebalancingCostPolicy: getRebalancingCostPolicyConfig(), rebalancingDailyBridgeLimitUsd: parseRebalancingDailyBridgeLimitUsd(), + /// The larger USDC amount to use for USDC→BRLA→USDC runs when the standard amount is projected profitable. + rebalancingProfitableUsdToBrlAmount: + process.env.REBALANCING_PROFITABLE_USD_TO_BRL_AMOUNT || process.env.REBALANCING_USD_TO_BRL_AMOUNT || "1", /// The threshold above and below the optimal coverage ratio at which the rebalancing will be triggered. rebalancingThreshold: Number(process.env.REBALANCING_THRESHOLD) || 0.01, diff --git a/docs/security-spec/07-operations/rebalancer.md b/docs/security-spec/07-operations/rebalancer.md index 60eb00431..649cf8f91 100644 --- a/docs/security-spec/07-operations/rebalancer.md +++ b/docs/security-spec/07-operations/rebalancer.md @@ -4,7 +4,7 @@ The rebalancer is a standalone service (`apps/rebalancer/`) that monitors token coverage ratios and automatically moves liquidity across chains when ratios indicate a pool imbalance. Its primary function is ensuring the platform has sufficient tokens to service ramp operations without manual intervention. -The default Base rebalancer is cost-aware. A coverage-ratio breach makes a fresh cron run eligible for evaluation, but execution still depends on the configured urgency band and projected round-trip cost. Mild and moderate imbalances can be skipped when route quotes are unfavorable; severe imbalances tolerate higher configured cost. When coverage is already inside the configured bounds, the USDC → BRLA → USDC flow may still run opportunistically, but only if its projected route cost is below `REBALANCING_OPPORTUNISTIC_USDC_TO_BRLA_MAX_COST_BPS` (default 10 bps). `REBALANCING_HARD_MAX_COST_BPS` remains a hard projected-cost cap in every mode. `REBALANCING_DAILY_BRIDGE_LIMIT_USD` caps non-profitable fresh Base runs, but a quote that projects profit may bypass the daily cap while still being recorded in history after completion. +The default Base rebalancer is cost-aware. A coverage-ratio breach makes a fresh cron run eligible for evaluation, but execution still depends on the configured urgency band and projected round-trip cost. Mild and moderate imbalances can be skipped when route quotes are unfavorable; severe imbalances tolerate higher configured cost. When coverage is already inside the configured bounds, the USDC → BRLA → USDC flow may still run opportunistically, but only if its projected route cost is below `REBALANCING_OPPORTUNISTIC_USDC_TO_BRLA_MAX_COST_BPS` (default 10 bps). `REBALANCING_HARD_MAX_COST_BPS` remains a hard projected-cost cap in every mode. `REBALANCING_DAILY_BRIDGE_LIMIT_USD` caps non-profitable fresh Base runs, but a quote that projects profit may bypass the daily cap while still being recorded in history after completion. If the standard USDC → BRLA → USDC amount is projected profitable, the flow can evaluate a separately configured profitable amount and execute that larger amount only when its own fresh quote also projects profit. **Current implementation:** Three rebalancing paths: @@ -41,6 +41,7 @@ bun run start [amount] [--legacy] [--restart] [--route=squidrouter|avenia|nabla- - `REBALANCING_MAX_COST_BPS_MILD` / `REBALANCING_MAX_COST_BPS_MODERATE` / `REBALANCING_MAX_COST_BPS_SEVERE` — maximum projected round-trip cost per urgency band. - `REBALANCING_HARD_MAX_COST_BPS` — final projected-cost ceiling enforced even in `always` mode. - `REBALANCING_OPPORTUNISTIC_USDC_TO_BRLA_MAX_COST_BPS` — maximum projected route cost for in-range opportunistic USDC → BRLA → USDC execution (default 10 bps). +- `REBALANCING_USD_TO_BRL_AMOUNT` / `REBALANCING_PROFITABLE_USD_TO_BRL_AMOUNT` — standard and projected-profitable USDC → BRLA → USDC sizing. The profitable amount defaults to the standard amount when unset and is only used after a fresh quote for that larger size still projects profit. --- @@ -66,7 +67,7 @@ bun run start [amount] [--legacy] [--restart] [--route=squidrouter|avenia|nabla- **Daily bridge limit:** Total requested USDC amount recorded by Base-flow history per calendar day (UTC), including the amount about to be rebalanced, must not exceed `REBALANCING_DAILY_BRIDGE_LIMIT_USD` (default 10,000) for paid current runs. Profit is inferred from projected output USDC greater than input USDC, which also yields negative projected cost bps. Projected-profitable current runs bypass the cap entirely. For paid runs, the limit decision is checked against both `UsdcBaseStateManager` and `BrlaToUsdcBaseStateManager` history after quote/cost-policy evaluation and before any fresh Base state write or transaction. Completed profitable runs still write normal history entries, so they remain visible in later paid-run daily accounting. -**Urgency-band policy:** Before any state write or transaction, the flow quotes the expected round-trip USDC output. Projected cost is `(input USDC - projected output USDC) / input USDC` in basis points. `auto` mode executes only when the projected cost is within the configured limit for the current coverage-deviation band. `dry-run` logs the same decision but never starts a rebalance. `off` skips without quoting. `always` can execute above the band limit, but not above `REBALANCING_HARD_MAX_COST_BPS`; the daily bridge limit still applies unless the quote projects profit. +**Urgency-band policy:** Before any state write or transaction, the flow quotes the expected round-trip USDC output. Projected cost is `(input USDC - projected output USDC) / input USDC` in basis points. `auto` mode executes only when the projected cost is within the configured limit for the current coverage-deviation band. `dry-run` logs the same decision but never starts a rebalance. `off` skips without quoting. `always` can execute above the band limit, but not above `REBALANCING_HARD_MAX_COST_BPS`; the daily bridge limit still applies unless the quote projects profit. When the standard amount projects profit, the profitable amount is re-quoted separately; stale standard-amount quotes must not be reused for larger execution. **Rebalancing flow:** 1. Check initial USDC balance on Base (sufficient for requested amount) @@ -154,15 +155,16 @@ bun run start [amount] [--legacy] [--restart] [--route=squidrouter|avenia|nabla- 14. **Mild/moderate imbalances MUST be skippable when cost exceeds tolerance** — In `auto` mode, fresh Base rebalances must skip when projected round-trip cost exceeds the configured limit for the current band. 15. **Opportunistic in-range rebalances MUST stay below the configured projected-cost cap** — When coverage is already inside `[lowerBound, upperBound]`, only USDC → BRLA → USDC may run opportunistically. It must use the normal cost-policy quote, daily-limit/profit decision, Base USDC balance check, route selection, hard max-cost cap, and state machine; it must skip when projected route cost is greater than or equal to `REBALANCING_OPPORTUNISTIC_USDC_TO_BRLA_MAX_COST_BPS` (default 10 bps). If an opportunistic Avenia route later falls back to SquidRouter, the preflight SquidRouter quote must independently satisfy the normal cost policy, the configured opportunistic cap, and the profitable-quote requirement when the original current quote skipped the daily bridge limit because it was projected profitable. 16. **Severe imbalances MAY use higher tolerance but MUST NOT bypass hard cost caps** — Severe band can permit higher projected cost, but it cannot bypass `REBALANCING_HARD_MAX_COST_BPS`, balance checks, slippage limits, or phase safety checks. It also cannot bypass the daily bridge limit unless the selected quote projects profit. -17. **Route comparison MUST handle provider failures gracefully** — If every enabled return route quote fails, the high-coverage flow MUST abort (not proceed with zero information). If some routes fail, the best available route is used. If `--route=` is specified, that route is still quoted and cost-gated before execution. -18. **Avenia fallback to SquidRouter MUST be atomic in state** — If Avenia ticket creation fails, the flow sets `winningRoute = "squidrouter"` and `currentPhase = AveniaTransferToPolygon` in a single `saveState()` call. A crash between the failure and the save could leave the flow in an inconsistent state. -19. **NonceManager MUST be re-initialized on resume** — The `NonceManager` is created fresh at the start of each execution from `getTransactionCount()`. On resume, it must not reuse stale nonces from a previous execution. -20. **Axelar cross-chain execution MUST have a timeout** — SquidRouter's Axelar polling has a 30-minute timeout. If Axelar does not confirm execution within this window, the flow MUST throw (not poll indefinitely). This resolves F-034 for the Base flow. -21. **SquidRouter source transactions MUST be receipt-gated before Axelar polling** — On resume, a persisted Polygon SquidRouter swap hash must be checked on Polygon before Axelar polling starts. Before retrying a failed or missing SquidRouter swap, the flow must first check whether the expected Base USDC delta already arrived from the previous attempt. If not recovered and the source receipt failed, the stale hash/quote must be cleared and the flow must request a fresh SquidRouter route instead of waiting for an Axelar execution that can never occur. -22. **Balance arrival checks MUST be delta-based** — The Base high-coverage flow persists pre-action balances before each arrival-producing operation and waits for `starting balance + expected delta` rather than checking absolute hot-wallet/provider balances. Avenia BRLA arrival checks allow a 95% tolerance for provider-side deductions, while Base/Polygon on-chain arrival checks use the default 99.8% tolerance for rounding, route deductions, and minor quote shortfalls without sweeping unrelated leftover balances into the current run. The actual received Base USDC delta is persisted before advancing to final verification. -23. **SquidRouter swaps MUST require available Polygon BRLA before submission** — Before requesting and submitting a fresh SquidRouter Polygon BRLA → Base USDC swap, the flow must verify the Polygon account still holds at least the BRLA amount selected for the swap. If the balance is insufficient and Base USDC recovery does not prove completion, the flow MUST throw instead of submitting an inevitably failing transaction. -24. **`EVM_ACCOUNT_SECRET` derives the same address on all EVM chains** — A single BIP-39 mnemonic is used for Base, Polygon, and Moonbeam. This means compromise of this one secret drains the rebalancer on ALL EVM chains. `PENDULUM_ACCOUNT_SECRET` is separate and legacy-only. -25. **Terminal Avenia ticket failures MUST NOT poll indefinitely** — `checkTicketStatusPaid` treats `FAILED` as terminal and throws immediately instead of retrying until timeout. `PARTIAL-FAILED` is surfaced as a retryable ticket-specific status so the SquidRouter BRLA-to-Polygon branch can reconcile partial arrival and create a replacement ticket only for the remaining amount. +17. **Profitable-size execution MUST use matching fresh quotes** — The high-coverage flow may switch from `REBALANCING_USD_TO_BRL_AMOUNT` to `REBALANCING_PROFITABLE_USD_TO_BRL_AMOUNT` only after the standard amount projects profit and the profitable amount's own quote also projects profit. Manual CLI amounts bypass this automatic up-sizing. +18. **Route comparison MUST handle provider failures gracefully** — If every enabled return route quote fails, the high-coverage flow MUST abort (not proceed with zero information). If some routes fail, the best available route is used. If `--route=` is specified, that route is still quoted and cost-gated before execution. +19. **Avenia fallback to SquidRouter MUST be atomic in state** — If Avenia ticket creation fails, the flow sets `winningRoute = "squidrouter"` and `currentPhase = AveniaTransferToPolygon` in a single `saveState()` call. A crash between the failure and the save could leave the flow in an inconsistent state. +20. **NonceManager MUST be re-initialized on resume** — The `NonceManager` is created fresh at the start of each execution from `getTransactionCount()`. On resume, it must not reuse stale nonces from a previous execution. +21. **Axelar cross-chain execution MUST have a timeout** — SquidRouter's Axelar polling has a 30-minute timeout. If Axelar does not confirm execution within this window, the flow MUST throw (not poll indefinitely). This resolves F-034 for the Base flow. +22. **SquidRouter source transactions MUST be receipt-gated before Axelar polling** — On resume, a persisted Polygon SquidRouter swap hash must be checked on Polygon before Axelar polling starts. Before retrying a failed or missing SquidRouter swap, the flow must first check whether the expected Base USDC delta already arrived from the previous attempt. If not recovered and the source receipt failed, the stale hash/quote must be cleared and the flow must request a fresh SquidRouter route instead of waiting for an Axelar execution that can never occur. +23. **Balance arrival checks MUST be delta-based** — The Base high-coverage flow persists pre-action balances before each arrival-producing operation and waits for `starting balance + expected delta` rather than checking absolute hot-wallet/provider balances. Avenia BRLA arrival checks allow a 95% tolerance for provider-side deductions, while Base/Polygon on-chain arrival checks use the default 99.8% tolerance for rounding, route deductions, and minor quote shortfalls without sweeping unrelated leftover balances into the current run. The actual received Base USDC delta is persisted before advancing to final verification. +24. **SquidRouter swaps MUST require available Polygon BRLA before submission** — Before requesting and submitting a fresh SquidRouter Polygon BRLA → Base USDC swap, the flow must verify the Polygon account still holds at least the BRLA amount selected for the swap. If the balance is insufficient and Base USDC recovery does not prove completion, the flow MUST throw instead of submitting an inevitably failing transaction. +25. **`EVM_ACCOUNT_SECRET` derives the same address on all EVM chains** — A single BIP-39 mnemonic is used for Base, Polygon, and Moonbeam. This means compromise of this one secret drains the rebalancer on ALL EVM chains. `PENDULUM_ACCOUNT_SECRET` is separate and legacy-only. +26. **Terminal Avenia ticket failures MUST NOT poll indefinitely** — `checkTicketStatusPaid` treats `FAILED` as terminal and throws immediately instead of retrying until timeout. `PARTIAL-FAILED` is surfaced as a retryable ticket-specific status so the SquidRouter BRLA-to-Polygon branch can reconcile partial arrival and create a replacement ticket only for the remaining amount. ## Threat Vectors & Mitigations From 7fd85015d65fc3808b7bce0261fd5b0d1b54ea91 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Thu, 2 Jul 2026 19:14:45 +0200 Subject: [PATCH 061/176] fix(api,sdk): restore anonymous Alfredpay quote creation via sentinel tracking customer id User-gating Alfredpay quote creation broke the web-app funnel twice over: the swap form requests quotes anonymously for USD/MXN/COP/ARS (all enabled), and even logged-in users without completed Alfredpay KYC could not quote - yet the app's KYC flow only starts after a quote is confirmed, so first-time users could never onboard (chicken-and-egg). Gating quotes is also unnecessary for security: Alfredpay quote requests carry the customerId only inside the free-form tracking 'metadata' object (staging has always sent "unknown" there for anonymous users); the validated top-level customerId exists only on order creation. Orders are created exclusively at ramp registration, which stays strictly KYC-gated via resolveAlfredpayCustomerId. Quote engines now use the non-throwing resolveAlfredpayQuoteCustomerId: the user's real customer id when a KYC-completed customer resolves (keeps provider-side attribution), the "anonymous" sentinel otherwise. The SDK mirrors this split: createQuote no longer requires a secretKey (anonymous rate discovery), while registerRamp fails fast without one since every corridor now requires a user-linked key at registration. --- .../api/services/quote/alfredpay-customer.ts | 44 ++++++++++++---- .../quote/engines/alfredpay-auth.test.ts | 51 ++++++++++++++----- .../engines/initialize/onramp-alfredpay.ts | 7 +-- .../engines/partners/offramp-alfredpay.ts | 7 +-- docs/api/pages/02-quick-start-with-the-sdk.md | 2 +- .../05-integrations/alfredpay.md | 6 +-- packages/sdk/README.md | 2 +- packages/sdk/src/VortexSdk.ts | 14 ++--- 8 files changed, 92 insertions(+), 41 deletions(-) diff --git a/apps/api/src/api/services/quote/alfredpay-customer.ts b/apps/api/src/api/services/quote/alfredpay-customer.ts index 79be75f1e..9767d3b3d 100644 --- a/apps/api/src/api/services/quote/alfredpay-customer.ts +++ b/apps/api/src/api/services/quote/alfredpay-customer.ts @@ -11,17 +11,40 @@ const fiatToCountry: Partial> = { }; export const ALFREDPAY_EFFECTIVE_USER_REQUIRED_MESSAGE = - "Alfredpay quote creation requires an API key linked to a user or Supabase user authentication."; + "This endpoint requires an API key linked to a user or Supabase user authentication."; -export function requireAlfredpayEffectiveUserId(userId: string | undefined | null): string { +/** + * Sentinel customer id used in the tracking-only `metadata.customerId` field of Alfredpay + * *quote* requests when no KYC-completed customer can be resolved (anonymous rate discovery). + * Alfredpay only validates the top-level `customerId` on order creation, which always goes + * through the strict `resolveAlfredpayCustomerId`. + */ +export const ALFREDPAY_ANONYMOUS_CUSTOMER_ID = "anonymous"; + +/** + * Best-effort customer id for Alfredpay *quote* metadata. Returns the user's KYC-completed + * customer id when resolvable, otherwise the anonymous sentinel. Never throws for a missing + * user or missing/incomplete KYC — quotes stay anonymous-eligible; registration enforces KYC. + */ +export async function resolveAlfredpayQuoteCustomerId(fiatCurrency: string, userId: string | undefined): Promise { if (!userId) { - throw new APIError({ - message: ALFREDPAY_EFFECTIVE_USER_REQUIRED_MESSAGE, - status: httpStatus.BAD_REQUEST - }); + return ALFREDPAY_ANONYMOUS_CUSTOMER_ID; } - return userId; + const country = fiatToCountry[fiatCurrency as FiatToken]; + if (!country) { + return ALFREDPAY_ANONYMOUS_CUSTOMER_ID; + } + + const customer = await AlfredPayCustomer.findOne({ + where: { country, userId } + }); + + if (!customer || customer.status !== AlfredPayStatus.Success) { + return ALFREDPAY_ANONYMOUS_CUSTOMER_ID; + } + + return customer.alfredPayId; } /** @@ -29,7 +52,8 @@ export function requireAlfredpayEffectiveUserId(userId: string | undefined | nul * fiat side of the request determines the country; the user must own a * KYC-completed (`Success`) customer row. * - * Ramp-register / start enforce a non-empty `userId` for every corridor. + * Used on the register/start paths, which enforce a non-empty `userId` for + * every corridor. Quote creation uses `resolveAlfredpayQuoteCustomerId` instead. */ export async function resolveAlfredpayCustomerId(fiatCurrency: string, userId: string): Promise { if (!isAlfredpayToken(fiatCurrency as FiatToken)) { @@ -53,14 +77,14 @@ export async function resolveAlfredpayCustomerId(fiatCurrency: string, userId: s if (!customer) { throw new APIError({ - message: `No completed Alfredpay KYC profile found for ${fiatCurrency}. Complete Alfredpay KYC before requesting a quote.`, + message: `No completed Alfredpay KYC profile found for ${fiatCurrency}. Complete Alfredpay KYC before registering a ramp.`, status: httpStatus.BAD_REQUEST }); } if (customer.status !== AlfredPayStatus.Success) { throw new APIError({ - message: `Alfredpay KYC status is ${customer.status}. Complete Alfredpay KYC before requesting a quote.`, + message: `Alfredpay KYC status is ${customer.status}. Complete Alfredpay KYC before registering a ramp.`, status: httpStatus.BAD_REQUEST }); } diff --git a/apps/api/src/api/services/quote/engines/alfredpay-auth.test.ts b/apps/api/src/api/services/quote/engines/alfredpay-auth.test.ts index dec13f134..df309dfdd 100644 --- a/apps/api/src/api/services/quote/engines/alfredpay-auth.test.ts +++ b/apps/api/src/api/services/quote/engines/alfredpay-auth.test.ts @@ -1,5 +1,7 @@ import { AlfredpayApiService, + CreateAlfredpayOfframpQuoteRequest, + CreateAlfredpayOnrampQuoteRequest, EPaymentMethod, EvmToken, FiatToken, @@ -8,11 +10,22 @@ import { } from "@vortexfi/shared"; import Big from "big.js"; import { afterEach, describe, expect, it, mock } from "bun:test"; +import { ALFREDPAY_ANONYMOUS_CUSTOMER_ID } from "../alfredpay-customer"; import { priceFeedService } from "../../priceFeed.service"; import { createQuoteContext } from "../core/quote-context"; import { OnRampInitializeAlfredpayEngine } from "./initialize/onramp-alfredpay"; import { OfframpTransactionAlfredpayEngine } from "./partners/offramp-alfredpay"; +function stubAlfredpayQuote() { + return { + expiration: new Date(Date.now() + 5 * 60 * 1000).toISOString(), + fees: [], + fromAmount: "100", + quoteId: "alfredpay-quote-1", + toAmount: "99" + }; +} + describe("Alfredpay quote auth", () => { const originalGetInstance = AlfredpayApiService.getInstance; const originalConvertCurrency = priceFeedService.convertCurrency; @@ -22,10 +35,14 @@ describe("Alfredpay quote auth", () => { priceFeedService.convertCurrency = originalConvertCurrency; }); - it("rejects anonymous Alfredpay onramp quotes before calling Alfredpay", async () => { - AlfredpayApiService.getInstance = mock(() => { - throw new Error("Alfredpay upstream should not be called"); - }) as typeof AlfredpayApiService.getInstance; + it("serves anonymous Alfredpay onramp quotes with the sentinel customer id in metadata", async () => { + let capturedRequest: CreateAlfredpayOnrampQuoteRequest | undefined; + AlfredpayApiService.getInstance = mock(() => ({ + createOnrampQuote: async (request: CreateAlfredpayOnrampQuoteRequest) => { + capturedRequest = request; + return stubAlfredpayQuote(); + } + })) as unknown as typeof AlfredpayApiService.getInstance; const ctx = createQuoteContext({ partner: null, @@ -41,16 +58,21 @@ describe("Alfredpay quote auth", () => { targetFeeFiatCurrency: FiatToken.USD }); - await expect(new OnRampInitializeAlfredpayEngine().execute(ctx)).rejects.toThrow( - "Alfredpay quote creation requires an API key linked to a user or Supabase user authentication." - ); + await new OnRampInitializeAlfredpayEngine().execute(ctx); + + expect(capturedRequest?.metadata.customerId).toBe(ALFREDPAY_ANONYMOUS_CUSTOMER_ID); + expect(ctx.alfredpayMint?.quoteId).toBe("alfredpay-quote-1"); }); - it("rejects anonymous Alfredpay off-ramp quotes before calling Alfredpay", async () => { + it("serves anonymous Alfredpay off-ramp quotes with the sentinel customer id in metadata", async () => { priceFeedService.convertCurrency = mock(async () => "20") as typeof priceFeedService.convertCurrency; - AlfredpayApiService.getInstance = mock(() => { - throw new Error("Alfredpay upstream should not be called"); - }) as typeof AlfredpayApiService.getInstance; + let capturedRequest: CreateAlfredpayOfframpQuoteRequest | undefined; + AlfredpayApiService.getInstance = mock(() => ({ + createOfframpQuote: async (request: CreateAlfredpayOfframpQuoteRequest) => { + capturedRequest = request; + return stubAlfredpayQuote(); + } + })) as unknown as typeof AlfredpayApiService.getInstance; const ctx = createQuoteContext({ partner: null, @@ -92,8 +114,9 @@ describe("Alfredpay quote auth", () => { targetOutputAmountRaw: "10000000" }; - await expect(new OfframpTransactionAlfredpayEngine().execute(ctx)).rejects.toThrow( - "Alfredpay quote creation requires an API key linked to a user or Supabase user authentication." - ); + await new OfframpTransactionAlfredpayEngine().execute(ctx); + + expect(capturedRequest?.metadata.customerId).toBe(ALFREDPAY_ANONYMOUS_CUSTOMER_ID); + expect(ctx.alfredpayOfframp?.quoteId).toBe("alfredpay-quote-1"); }); }); diff --git a/apps/api/src/api/services/quote/engines/initialize/onramp-alfredpay.ts b/apps/api/src/api/services/quote/engines/initialize/onramp-alfredpay.ts index 7d58e1f51..3481c3348 100644 --- a/apps/api/src/api/services/quote/engines/initialize/onramp-alfredpay.ts +++ b/apps/api/src/api/services/quote/engines/initialize/onramp-alfredpay.ts @@ -10,7 +10,7 @@ import { RampDirection } from "@vortexfi/shared"; import Big from "big.js"; -import { requireAlfredpayEffectiveUserId, resolveAlfredpayCustomerId } from "../../alfredpay-customer"; +import { resolveAlfredpayQuoteCustomerId } from "../../alfredpay-customer"; import { QuoteContext } from "../../core/types"; import { BaseInitializeEngine } from "./index"; @@ -22,13 +22,14 @@ export class OnRampInitializeAlfredpayEngine extends BaseInitializeEngine { protected async executeInternal(ctx: QuoteContext): Promise { const req = ctx.request; - const effectiveUserId = requireAlfredpayEffectiveUserId(req.userId); const usdTokenDecimals = ALFREDPAY_ERC20_DECIMALS; const inputAmountDecimal = new Big(req.inputAmount); const alfredpayService = AlfredpayApiService.getInstance(); - const customerId = await resolveAlfredpayCustomerId(req.inputCurrency, effectiveUserId); + // Quotes stay anonymous-eligible: metadata.customerId is tracking-only on Alfredpay quote + // requests. KYC is enforced at ramp registration via resolveAlfredpayCustomerId. + const customerId = await resolveAlfredpayQuoteCustomerId(req.inputCurrency, req.userId); const quoteRequest: CreateAlfredpayOnrampQuoteRequest = { chain: AlfredpayChain.MATIC, diff --git a/apps/api/src/api/services/quote/engines/partners/offramp-alfredpay.ts b/apps/api/src/api/services/quote/engines/partners/offramp-alfredpay.ts index 7d4b2edc7..07fa95034 100644 --- a/apps/api/src/api/services/quote/engines/partners/offramp-alfredpay.ts +++ b/apps/api/src/api/services/quote/engines/partners/offramp-alfredpay.ts @@ -12,7 +12,7 @@ import { } from "@vortexfi/shared"; import Big from "big.js"; import { priceFeedService } from "../../../priceFeed.service"; -import { requireAlfredpayEffectiveUserId, resolveAlfredpayCustomerId } from "../../alfredpay-customer"; +import { resolveAlfredpayQuoteCustomerId } from "../../alfredpay-customer"; import { QuoteContext } from "../../core/types"; import { BaseInitializeEngine } from "./../initialize/index"; @@ -24,7 +24,6 @@ export class OfframpTransactionAlfredpayEngine extends BaseInitializeEngine { protected async executeInternal(ctx: QuoteContext): Promise { const req = ctx.request; - const effectiveUserId = requireAlfredpayEffectiveUserId(req.userId); if (!ctx.evmToEvm) { throw new Error("OfframpTransactionAlfredpayEngine: No evmToEvm quote"); @@ -47,7 +46,9 @@ export class OfframpTransactionAlfredpayEngine extends BaseInitializeEngine { ? ctx.subsidy.targetOutputAmountDecimal.div(effectiveRate).round(ALFREDPAY_ERC20_DECIMALS, Big.roundDown) : ctx.evmToEvm.outputAmountDecimal.minus(deductibleFee).round(ALFREDPAY_ERC20_DECIMALS, Big.roundDown); - const customerId = await resolveAlfredpayCustomerId(req.outputCurrency, effectiveUserId); + // Quotes stay anonymous-eligible: metadata.customerId is tracking-only on Alfredpay quote + // requests. KYC is enforced at ramp registration via resolveAlfredpayCustomerId. + const customerId = await resolveAlfredpayQuoteCustomerId(req.outputCurrency, req.userId); const alfredpayService = AlfredpayApiService.getInstance(); const quoteRequest: CreateAlfredpayOfframpQuoteRequest = { diff --git a/docs/api/pages/02-quick-start-with-the-sdk.md b/docs/api/pages/02-quick-start-with-the-sdk.md index d73c5e673..fc69cf203 100644 --- a/docs/api/pages/02-quick-start-with-the-sdk.md +++ b/docs/api/pages/02-quick-start-with-the-sdk.md @@ -135,7 +135,7 @@ console.log(started.achPaymentData); No user-signed on-chain transactions are required for onramp. The SDK signs ephemeral transactions during `registerRamp`. -Alfredpay (MXN) requires the user to be onboarded first. Authenticate the SDK with that user's own **user-linked** `secretKey` (the `sk_*` key created by that user), and the same user must have completed Alfredpay MXN KYC. The key and the KYC record belong to the same account, so a quote created with that key resolves to the user's Alfredpay customer automatically. A `publicKey`-only request, or a partner-scoped `sk_*` with no user, is rejected. +Quotes can be requested without any key (anonymous rate discovery). Registering the ramp requires the user to be onboarded first: authenticate the SDK with that user's own **user-linked** `secretKey` (the `sk_*` key created by that user), and the same user must have completed Alfredpay MXN KYC. The key and the KYC record belong to the same account, so registration resolves to the user's Alfredpay customer automatically. A `publicKey`-only registration, or a partner-scoped `sk_*` with no user, is rejected. Partner `sk_*` keys cannot drive Alfredpay KYC, and the SDK cannot mint keys or run KYC — onboard the user through the Vortex app or Widget first, then use their `sk_*` key (shown only once, at creation). This applies to both MXN onramp and offramp below. diff --git a/docs/security-spec/05-integrations/alfredpay.md b/docs/security-spec/05-integrations/alfredpay.md index ca091cc1e..054b32c52 100644 --- a/docs/security-spec/05-integrations/alfredpay.md +++ b/docs/security-spec/05-integrations/alfredpay.md @@ -55,7 +55,7 @@ For routed Alfredpay onramps (any non-passthrough output), the final quote outpu 14. **`finalSettlementSubsidy` MUST NOT be skipped for Alfredpay offramps** — The `FinalSettlementSubsidyHandler` direct-transfer skip explicitly excludes `SELL && isAlfredpayToken(outputCurrency)`. This ensures the ephemeral on Polygon is always topped up to the expected amount before `alfredpayOfframpTransfer`, preventing under-funded settlements. 15. **Routed Alfredpay onramp quote output precision MUST match the destination token** — For Alfredpay USD/MXN/COP/ARS onramps that route through Squid, `quote.outputAmount` MUST preserve the final destination token's decimal precision, and `evmToEvm.outputAmountRaw` MUST represent the destination token's raw units. The Polygon-minted Alfredpay token is only the Squid source-side input. Direct Polygon same-token passthrough remains at the minted token's 6-decimal precision. 16. **Alfredpay ramp registration MUST bind to a completed KYC/KYB customer** — Registration MUST reject Alfredpay onramps before customer lookup when no completed Alfredpay customer context is available, and MUST reject customer records whose Alfredpay status is not `Success`. This prevents ramps from reaching provider/customer queries with undefined `user_id` and ensures payment instructions are only issued for verified Alfredpay customers. SDK/server integrations authenticate with partner API keys (`pk_*`/`sk_*`); Supabase Bearer tokens are frontend/user-session auth. -17. **Alfredpay quote creation and ramp registration MUST derive the customer id from the effective user, not `req.userId || "unknown"`** — The on-ramp initialize engine, the off-ramp partner engine, the off-ramp transaction route, and the off-ramp transfer recovery path all resolve `alfredPayId` via `resolveAlfredpayCustomerId(fiatCurrency, effectiveUserId)`. If no effective user is present, Alfredpay quote creation returns `400 Alfredpay quote creation requires an API key linked to a user or Supabase user authentication.` before any upstream Alfredpay call. Public keys and unlinked secret keys cannot create or register Alfredpay ramps. Under this gate, every registered Alfredpay ramp carries a real provider `quoteId` and `customerId` tied to the quote/register principal. +17. **Alfredpay ramp registration MUST derive the customer id from the effective user; quotes carry only tracking metadata** — The off-ramp transaction route, the on-ramp route, the register-time quote refresh, and the off-ramp transfer recovery path all resolve `alfredPayId` via the strict, KYC-gated `resolveAlfredpayCustomerId(fiatCurrency, effectiveUserId)`. Quote creation is anonymous-eligible: the on-ramp initialize engine and off-ramp partner engine use `resolveAlfredpayQuoteCustomerId`, which fills the *tracking-only* quote `metadata.customerId` with the caller's real customer id when a KYC-completed customer resolves, and the `"anonymous"` sentinel otherwise. Alfredpay validates the top-level `customerId` only on order creation, so no provider *order* ever carries a placeholder identity. Public keys and unlinked secret keys can quote but cannot register Alfredpay ramps. ## Threat Vectors & Mitigations @@ -74,7 +74,7 @@ For routed Alfredpay onramps (any non-passthrough output), the final quote outpu | **Polygon passthrough rounding** | Same-chain same-token shortcut rounds the bridge output incorrectly, leaking dust or under-funding the destination | `toFixed(0, 0)` round-down in the squid-router finalize; downstream subsidy ensures the destination receives the quoted amount | | **Polygon wrong-token delivery** | A user on-ramps via Alfredpay and requests a non-USDT Polygon output (e.g. USDC); the handler skips the swap on destination-network alone and transfers the minted USDT, delivering the wrong asset | The `squidRouterSwap` short-circuit is gated on `quote.outputCurrency === ALFREDPAY_EVM_TOKEN` (not just `quote.metadata.request.to === Networks.Polygon`); non-USDT Polygon outputs run the real USDT→output swap. Matched in the quote engine's `skipRouteCalculation` branch. | | **Routed destination precision loss** | A USD/MXN/COP/ARS Alfredpay onramp mints a 6-decimal Polygon source token, routes to an 18-decimal destination token, and stores the final quote output with source precision. The final amount is truncated before destination-transfer expectations are calculated. | Finalize routed Alfredpay EVM quotes with the destination token's decimals when `evmToEvm` metadata exists; keep direct Polygon same-token passthrough at minted-token precision. | -| **Anonymous Alfredpay quote/resource creation** | An SDK caller requests an Alfredpay quote without a linked user, causing upstream quote resources to be created with placeholder customer identity | Alfredpay quote engines require an effective user before calling Alfredpay. Missing or unlinked credentials fail with `400`; no `customerId: "unknown"` provider call is made. | +| **Anonymous Alfredpay quote/resource creation** | An SDK caller requests an Alfredpay quote without a linked user, hoping to create provider-side resources with placeholder customer identity | Alfredpay quotes are rate estimates: the customer id appears only in tracking-only quote `metadata` (`"anonymous"` sentinel for non-KYC'd callers). Provider *orders* — the only calls that create customer-bound resources — are created at registration, which requires an effective user with a `Success` Alfredpay customer via `resolveAlfredpayCustomerId`. | | **Claiming an Alfredpay quote with a different user** | Attacker creates a quote under one linked user, then presents another Supabase token or linked secret key at register time | `RampService.registerRamp` rejects cross-user quote registration with `403`; Alfredpay customer lookup is performed from the effective user at quote and register time. | ## Audit Checklist @@ -101,4 +101,4 @@ For routed Alfredpay onramps (any non-passthrough output), the final quote outpu - [x] AlfredPay offramp order is created at prep time (`evm-to-alfredpay.ts:229`); `processAlfredpayOfframpStart` is a defensive validation-only no-op. **PASS** — verified. - [x] Routed Alfredpay onramp quote output precision follows destination token decimals when `evmToEvm` metadata exists; direct Polygon same-token passthrough remains at minted-token precision. **PASS** — verified in `finalize/onramp.ts`. - [x] Alfredpay onramp registration rejects missing customer context before customer lookup and requires a `Success` Alfredpay customer status. **PASS** — `ramp.service.ts` checks for the current user-backed customer context; `alfredpay-to-evm.ts` rejects missing/non-success customer records. -- [x] Alfredpay quote engines reject missing effective users before `AlfredpayApiService.createOnrampQuote` / `createOfframpQuote`; no provider quote is created with placeholder customer identity. **PASS**. +- [x] Alfredpay quote engines resolve the tracking-only `metadata.customerId` via `resolveAlfredpayQuoteCustomerId` (real id for KYC-completed users, `"anonymous"` sentinel otherwise); provider *orders* always resolve via the strict `resolveAlfredpayCustomerId`. **PASS**. diff --git a/packages/sdk/README.md b/packages/sdk/README.md index 50cff644d..174aaae8b 100644 --- a/packages/sdk/README.md +++ b/packages/sdk/README.md @@ -83,7 +83,7 @@ const startedRamp = await sdk.startRamp(rampProcess.id); console.log("Pay via:", startedRamp.achPaymentData); ``` -Alfredpay requires the user to be onboarded first. Authenticate the SDK with that user's own **user-linked** `secretKey` (the `sk_*` key created by that user), not a `publicKey` alone, a partner-scoped key, or a Supabase Bearer token. The same user must have completed Alfredpay KYC for the country — the key and the KYC record belong to the same account, so a quote created with that key resolves to the user's Alfredpay customer automatically. +Quotes can be requested without any key (anonymous rate discovery). Registering the ramp requires the user to be onboarded first: authenticate the SDK with that user's own **user-linked** `secretKey` (the `sk_*` key created by that user), not a `publicKey` alone, a partner-scoped key, or a Supabase Bearer token. The same user must have completed Alfredpay KYC for the country — the key and the KYC record belong to the same account, so registration resolves to the user's Alfredpay customer automatically. > The SDK cannot mint keys or run KYC. Onboard the user through the Vortex app or Widget first, then use their `sk_*` key (shown only once, at creation) with the SDK. diff --git a/packages/sdk/src/VortexSdk.ts b/packages/sdk/src/VortexSdk.ts index abc131b01..9a4643d7a 100644 --- a/packages/sdk/src/VortexSdk.ts +++ b/packages/sdk/src/VortexSdk.ts @@ -90,12 +90,8 @@ export class VortexSdk { } async createQuote(request: T): Promise> { - if ((isAlfredpayToken(request.inputCurrency) || isAlfredpayToken(request.outputCurrency)) && !this.secretKey) { - throw new Error( - "Alfredpay ramps require the user's user-linked secretKey (sk_*) in VortexSdkConfig. Onboard the user and complete KYC via the Vortex app first." - ); - } - + // Quotes are anonymous-eligible for every corridor (rate discovery); the user-linked + // secretKey is only required at registerRamp. const apiRequest = { ...request, api: true, apiKey: this.publicKey }; const baseQuote = await this.apiService.createQuote(apiRequest); return baseQuote as ExtendedQuoteResponse; @@ -128,6 +124,12 @@ export class VortexSdk { rampProcess: RampProcess; unsignedTransactions: UnsignedTx[]; }> { + if (!this.secretKey) { + throw new Error( + "Ramp registration requires a user-linked secretKey (sk_*) in VortexSdkConfig. Onboard the user and complete KYC via the Vortex app first." + ); + } + await this.ensureInitialized(); let rampProcess: RampProcess; From a2614c1f09cccbc77cea31960dda584db3bbf9ca Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Thu, 2 Jul 2026 19:15:12 +0200 Subject: [PATCH 062/176] fix(api): let authenticated callers claim anonymous quotes at ramp registration The 403 guard ('anonymous quote cannot be registered by an authenticated caller') made anonymous quotes unregistrable by anyone, breaking the normal web-app funnel: the frontend creates the quote before login and only re-creates it when less than 60% of its 10-minute lifetime remains, so any user completing login+KYC within ~4 minutes registered the original anonymous quote and got a hard 403. quoteLocked widget flows never refresh and failed deterministically. Claiming an anonymous quote is not an escalation: it carries no owner, and provider identity (taxId / alfredPayId / Mykobo email) is always derived from the claimer's own KYC records, never from the quote or request body. The guards that matter remain: 403 when the quote belongs to a *different* user, 400 when no effective user resolves. Updates the ADR and security spec to document the claiming semantics and the registration policy of this fix series. --- .../ramp/ramp.service.register-auth.test.ts | 14 ++++++- .../api/src/api/services/ramp/ramp.service.ts | 10 ++--- .../user-gated-ramp-registration.md | 38 ++++++++++++------- .../03-ramp-engine/quote-lifecycle.md | 8 ++-- .../07-operations/api-surface.md | 2 +- docs/security-spec/SPEC-DELTA-2026-05.md | 4 +- 6 files changed, 46 insertions(+), 30 deletions(-) diff --git a/apps/api/src/api/services/ramp/ramp.service.register-auth.test.ts b/apps/api/src/api/services/ramp/ramp.service.register-auth.test.ts index 7d7e581d1..1601ab4b3 100644 --- a/apps/api/src/api/services/ramp/ramp.service.register-auth.test.ts +++ b/apps/api/src/api/services/ramp/ramp.service.register-auth.test.ts @@ -45,9 +45,19 @@ describe("RampService.registerRamp user gating", () => { QuoteTicket.findByPk = originalFindByPk; }); - it("rejects an authenticated caller claiming an anonymous quote with 403", async () => { + it("lets an authenticated caller claim an anonymous quote (passes the user-gating guards)", async () => { stubQuote({ userId: null }); - await expectRegisterError("user-a", httpStatus.FORBIDDEN); + const service = new TestRampService(); + try { + await service.registerRamp({ additionalData: {}, quoteId: "quote-1", signingAccounts: [], userId: "user-a" } as never); + throw new Error("registerRamp did not reject"); + } catch (error) { + // The stubbed quote has no currencies/signing accounts, so registration fails later + // (missing destinationAddress) — but it must get past the gating guards. + expect(error).toBeInstanceOf(APIError); + expect((error as APIError).status).not.toBe(httpStatus.FORBIDDEN); + expect((error as APIError).message).not.toContain("Invalid quote"); + } }); it("rejects a user registering a quote owned by a different user with 403", async () => { diff --git a/apps/api/src/api/services/ramp/ramp.service.ts b/apps/api/src/api/services/ramp/ramp.service.ts index 944d5466c..f214b465e 100644 --- a/apps/api/src/api/services/ramp/ramp.service.ts +++ b/apps/api/src/api/services/ramp/ramp.service.ts @@ -208,13 +208,9 @@ export class RampService extends BaseRampService { }); } - if (quote.userId == null && request.userId != null) { - throw new APIError({ - message: "This anonymous quote cannot be registered by an authenticated caller.", - status: httpStatus.FORBIDDEN - }); - } - + // An anonymous quote (userId == null) carries no owner, so an authenticated caller + // claiming it is not an escalation — this is the normal web-app funnel (quote before + // login, register after). Provider identity is still derived from the effective user. const effectiveUserId = request.userId || quote.userId || undefined; if (!effectiveUserId) { diff --git a/docs/architecture/user-gated-ramp-registration.md b/docs/architecture/user-gated-ramp-registration.md index b5a08c540..ab3ffa9b1 100644 --- a/docs/architecture/user-gated-ramp-registration.md +++ b/docs/architecture/user-gated-ramp-registration.md @@ -1,6 +1,6 @@ # ADR: User-Gated Ramp Registration (Anonymous Quotes, Authenticated Ramps) -Last updated: 2026-06-29 +Last updated: 2026-07-02 Status: Accepted @@ -28,25 +28,29 @@ can preview rates before signing up with Vortex. Split the trust boundary between quoting and ramping: -1. **Quotes stay anonymous-eligible.** `POST /v1/quotes` and `/quotes/best` accept anonymous - callers (and partner keys with or without a user binding) for corridors that support public - estimates (e.g. BRL/Avenia). Alfredpay quote creation is the exception: it is user-gated in - the quote engine because the upstream provider call requires a real customer context — no - `customerId: "unknown"` call is ever made. +1. **Quotes stay anonymous-eligible, for every corridor.** `POST /v1/quotes` and `/quotes/best` + accept anonymous callers (and partner keys with or without a user binding). For Alfredpay + corridors the `customerId` sent on *quote* requests lives in the tracking-only `metadata` + object — Alfredpay validates the top-level `customerId` only on order creation. Anonymous + or non-KYC'd callers get the sentinel `"anonymous"` in quote metadata + (`resolveAlfredpayQuoteCustomerId`); KYC-completed users get their real customer id. This + keeps the web-app funnel working (quote before login, KYC after quote confirm). 2. **Ramp registration requires an effective user, for every corridor.** `RampService.registerRamp` derives an **effective user** (`req.userId` from Supabase, else `api_keys.user_id` from a linked secret key) and rejects when none is present: - `400 Invalid quote` when no effective user can be resolved. - - `403` when an authenticated caller tries to claim an anonymous quote (`quote.userId == null && request.userId != null`). - `403` when a linked user tries to register a quote owned by a different user. + - An **anonymous quote may be claimed** by any authenticated caller: it carries no owner, so + claiming is not an escalation, and provider identity is still derived from the claimer's + own KYC records. This is the normal web-app flow (anonymous quote → login → register). 3. **Provider identity is derived server-side, never trusted from the body.** The sender `taxId` (Avenia) and `alfredPayId` (Alfredpay) are resolved from the effective user's KYC records - (`resolveAveniaAccountForUser`, `resolveAlfredpayCustomerId`). A client-supplied `taxId` is - accepted only when it matches the derived value; mismatches return `400`. (The PIX - `receiverTaxId`, which may legitimately differ from the sender, stays client-supplied and is - validated downstream against the PIX key owner.) + (`resolveAveniaAccountForRamp`, `resolveAlfredpayCustomerId`). A client-supplied `taxId` is + accepted only when it matches the derived value (enforced on both the BRL onramp and offramp + paths); mismatches return `400`. (The PIX `receiverTaxId`, which may legitimately differ from + the sender, stays client-supplied and is validated downstream against the PIX key owner.) ## Identity model @@ -70,9 +74,15 @@ endpoint. There is intentionally no "one partner key acts for any user" path. can no longer register ramps. Existing production keys must be bound to a profile (admin `POST /v1/admin/partners/:partnerName/api-keys` accepts an optional `userId`) or callers must switch to per-user authentication. This requires partner communication ahead of deploy. -- **Anonymous rate discovery is preserved**, which keeps the pre-signup funnel working. -- **Provider fraud surface shrinks**: no arbitrary `taxId`, no `"unknown"` customer, no claiming - another user's quote/subaccount. +- **Anonymous rate discovery is preserved for all corridors**, which keeps the pre-signup funnel + working (including the web app's anonymous quote form for Alfredpay currencies). +- **Provider fraud surface shrinks**: no arbitrary `taxId`, no placeholder customer on order + creation, no claiming another user's quote/subaccount. (The `"anonymous"` sentinel appears + only in tracking metadata on quote requests, never on orders.) +- **Self-serve key creation is capped** (`MAX_ACTIVE_KEYS_PER_USER` in + `userApiKeys.controller.ts`): secret-key validation bcrypt-compares against every active key + sharing the constant 8-char prefix, so unbounded key creation would degrade auth latency + system-wide. - `ON DELETE SET NULL` on `api_keys.user_id` is deliberate: deleting a profile must not silently revoke a partner's operational keys; the binding is soft state. diff --git a/docs/security-spec/03-ramp-engine/quote-lifecycle.md b/docs/security-spec/03-ramp-engine/quote-lifecycle.md index 0052a3af8..a7a2ce535 100644 --- a/docs/security-spec/03-ramp-engine/quote-lifecycle.md +++ b/docs/security-spec/03-ramp-engine/quote-lifecycle.md @@ -71,9 +71,9 @@ The refresh policy is intentionally strict (byte-identical `toAmount` and `fee` 12. **Quote creation MUST honor active maintenance windows server-side** — `POST /v1/quotes` and `POST /v1/quotes/best` must reject during active maintenance before quote calculation/persistence, including enough downtime metadata for direct API clients to retry after the window. 13. **Quote ownership MUST stay separate from pricing attribution** — Profile-assigned quotes MUST remain user-owned (`user_id = req.userId`, `partner_id = NULL`) while storing the applied partner pricing row in `pricing_partner_id`. 14. **Displayed discount MUST be a snapshot, not a live recomputation** — Public `QuoteResponse` discount fields MUST come from quote metadata captured at creation time. `GET /v1/quotes/:id` and ramp status responses MUST NOT recompute discount display amounts from live FX rates because quote economics are immutable after creation. -15. **Alfredpay quote creation MUST NOT call upstream providers with placeholder user identity** — Alfredpay corridors reject when no effective user is present and must never create upstream provider quotes with `customerId: "unknown"`. BRL/Avenia quote creation remains anonymous-eligible because Avenia quotes do not require a user-bound provider identity. **Register/start remains blocked for all corridors** without an effective user via route-level auth and the universal `RampService.registerRamp` check. -16. **Provider-backed ramp registration MUST derive the sender's provider identity from the effective user, not from request body** — BRL/Avenia tax ID, Alfredpay `alfredPayId`, and the Mykobo (EUR) `email` are resolved server-side from the effective user: `api_keys.user_id -> tax_ids.user_id` (`resolveAveniaAccountForUser`), `api_keys.user_id -> alfredpay_customers.user_id` (`resolveAlfredpayCustomerId`), and `api_keys.user_id -> profiles.email` (`resolveMykoboCustomerForUser`) respectively. The corresponding client-supplied field (`additionalData.taxId` / `additionalData.email`) is accepted only for backward compatibility and MUST match the derived sender value or the request is rejected with `400`. Each resolver also enforces the corridor's KYC-completion status (Avenia `Accepted`, Alfredpay `Success`, Mykobo `APPROVED`). The `receiverTaxId` (where it differs from the sender — e.g. third-party PIX recipient) is supplied by the client and is allowed to differ from the derived sender tax ID; it is validated downstream against the PIX key owner by `validateBrlaOfframpRequest` / `validateMaskedNumber`. The `RampService.registerRamp` quote/user consistency check ensures the caller cannot register a provider-backed quote using a different user context. -17. **Quote registration MUST use the same principal at quote and register time** — An anonymous quote (one with `quote.userId = null`, e.g. a BRL quote estimate created without credentials) cannot be claimed by an authenticated caller. `RampService.registerRamp` rejects with `403` when `quote.userId == null && request.userId != null`. The register principal must obtain a new quote with their identity (Supabase session or linked secret API key) so `quote.userId` is bound at quote time. Combined with the universal effective-user requirement (inv. 15), anonymous quotes are effectively unregistrable for all corridors. +15. **Quote creation is anonymous-eligible for every corridor; provider *orders* MUST NOT carry placeholder identity** — Alfredpay quote requests carry the customer id only in the tracking-only `metadata` object; `resolveAlfredpayQuoteCustomerId` fills in the caller's real customer id when a KYC-completed customer resolves, and the `"anonymous"` sentinel otherwise. Alfredpay *order* creation (at register/start) always goes through the strict, KYC-gated `resolveAlfredpayCustomerId` and never uses a placeholder. BRL/Avenia quote creation remains anonymous-eligible because Avenia quotes do not require a user-bound provider identity. **Register/start remains blocked for all corridors** without an effective user via route-level auth and the universal `RampService.registerRamp` check. +16. **Provider-backed ramp registration MUST derive the sender's provider identity from the effective user, not from request body** — BRL/Avenia tax ID, Alfredpay `alfredPayId`, and the Mykobo (EUR) `email` are resolved server-side from the effective user: `api_keys.user_id -> tax_ids.user_id` (`resolveAveniaAccountForRamp`), `api_keys.user_id -> alfredpay_customers.user_id` (`resolveAlfredpayCustomerId`), and `api_keys.user_id -> profiles.email` (`resolveMykoboCustomerForUser`) respectively. The corresponding client-supplied field (`additionalData.taxId` / `additionalData.email`) is accepted only for backward compatibility and MUST match the derived sender value or the request is rejected with `400`. Each resolver also enforces the corridor's KYC-completion status (Avenia `Accepted`, Alfredpay `Success`, Mykobo `APPROVED`). The `receiverTaxId` (where it differs from the sender — e.g. third-party PIX recipient) is supplied by the client and is allowed to differ from the derived sender tax ID; it is validated downstream against the PIX key owner by `validateBrlaOfframpRequest` / `validateMaskedNumber`. The `RampService.registerRamp` quote/user consistency check ensures the caller cannot register a provider-backed quote using a different user context. +17. **User-owned quotes MUST only be registered by their owner; anonymous quotes MAY be claimed** — `RampService.registerRamp` rejects with `403` when `quote.userId` is set and differs from the authenticated caller. An anonymous quote (`quote.userId = null`) carries no owner and MAY be claimed by any authenticated caller — this is the normal web-app funnel (quote before login, register after). Claiming grants no access to anyone else's resources because provider identity is always derived from the claimer's own KYC records (inv. 16), never from the quote or the request body. ## Threat Vectors & Mitigations @@ -86,7 +86,7 @@ The refresh policy is intentionally strict (byte-identical `toAmount` and `fee` | **Dynamic pricing farming** | Attacker rapidly requests quotes without consuming them to push `difference` toward `maxDynamicDifference`, then consumes at the best possible rate | Each quote request within the timeout window does NOT change the difference — only quotes **after** the timeout increase it. So the attacker would need to wait `discountStateTimeoutMinutes` between each step increase. With default `deltaD = 0.00003` and a 10-minute timeout, farming is slow. However, the `maxDynamicDifference` cap is the hard limit. | | **⚠️ In-memory state loss** | Server restart resets all partner discount states to `difference = 0`. Partners lose their accumulated rate adjustments. | **NO MITIGATION.** State is in-memory only. After restart, all partners start fresh. This could cause abrupt rate changes if a partner had a significant accumulated difference. | | **Subsidization abuse** | Attacker creates quotes during high volatility, forcing the platform to cover large subsidization amounts | Quote-time discount subsidy is capped by `maxSubsidy` per partner; EVM runtime top-ups are separately bounded by the pre/post-swap cap fractions; dynamic pricing adjusts rates over time; `maxDynamicDifference` bounds the maximum rate improvement | -| **Unauthorized quote consumption** | Attacker binds someone else's quote to their own ramp | Quotes carrying an owner (`partner_id` or `user_id`) are bound to that owner; ownership is verified at ramp registration via `assertQuoteOwnership`. `pricing_partner_id` is not an ownership credential. `RampService.registerRamp` requires an effective user for **all** corridors and rejects anonymous quotes from being claimed by an authenticated caller (inv. 17), so an attacker cannot bind an anonymous quote to a user who did not create it. Fully-anonymous quotes (no `partner_id` and no `user_id`) are effectively unregistrable. | +| **Unauthorized quote consumption** | Attacker binds someone else's quote to their own ramp | Quotes carrying an owner (`partner_id` or `user_id`) are bound to that owner; ownership is verified at ramp registration via `assertQuoteOwnership` and the `registerRamp` cross-user check (inv. 17). `pricing_partner_id` is not an ownership credential. Anonymous quotes carry no owner and are claimable, but claiming one only consumes a rate estimate — provider identity and funds routing derive from the claimer's own KYC records, so nothing belonging to another user can be reached. | | **Pricing partner treated as owner** | A profile-assigned user receives partner pricing, then tries to access partner-owned quotes or ramps. | Profile assignments populate `pricing_partner_id` only; `partner_id` stays `NULL`, so ownership guards continue to authorize through the Supabase `user_id` path. | | **Negative `minDynamicDifference`** | If `minDynamicDifference` is set to a large negative value in the partner DB record, consuming quotes could push the rate below the base `targetDiscount`, potentially making the effective discount negative (user receives less than the oracle rate) | DB constraint: `minDynamicDifference` defaults to `0`. However, there is no DB-level CHECK constraint preventing negative values. If set manually, the clamping logic would allow `difference` to go negative. | | **Concurrent quote and consumption** | Two simultaneous requests — one quoting, one consuming — for the same partner could read stale `difference` values from the in-memory Map | JavaScript's single-threaded event loop prevents true concurrency for synchronous Map operations. However, the `async` functions in `compute()` could interleave if there are `await` points between reading and writing the Map. In practice, the read and write of `partnerDiscountState` in `getAdjustedDifference` are synchronous, so this is safe within a single process. | diff --git a/docs/security-spec/07-operations/api-surface.md b/docs/security-spec/07-operations/api-surface.md index eb391eae7..92616f636 100644 --- a/docs/security-spec/07-operations/api-surface.md +++ b/docs/security-spec/07-operations/api-surface.md @@ -48,7 +48,7 @@ This spec covers the external-facing attack surface of the Vortex API (`apps/api 10. **Request IDs MUST be correlation-only** — Request IDs may be accepted from clients or generated by the API, but they must not grant access, alter authorization, or be treated as trusted identity. 11. **API observability MUST NOT change request outcomes** — Client event persistence/logging must be best-effort and must not change controller response bodies, status codes, or ramp/quote state. 12. **Maintenance windows MUST be backend-enforced on mutable ramp entrypoints** — `POST /v1/quotes`, `POST /v1/quotes/best`, `POST /v1/ramp/register`, `POST /v1/ramp/update`, and `POST /v1/ramp/start` must reject during active maintenance with `503`, `Retry-After`, and explicit downtime start/end metadata. UI disabling is not sufficient because partners may call the API directly. -13. **Provider-backed ramp endpoints MUST reject callers without an effective user, and provider-backed quotes MUST use the same principal at quote and register time** — Alfredpay and Avenia/BRL flows derive their provider customer/subaccount from `api_keys.user_id -> profiles.id -> alfredpay_customers.user_id` / `tax_ids.user_id`. Alfredpay quote creation requires an effective user and rejects before any upstream provider quote call when the principal is missing or unlinked. BRL quote creation remains anonymous-eligible because Avenia quote creation does not require user-bound identity, but `POST /v1/ramp/register` requires Supabase or secret-key credentials and `RampService.registerRamp` rejects missing effective users with `400 Invalid quote`. The same-principal check rejects authenticated attempts to claim quotes created without `quote.userId` with `403`. +13. **Provider-backed ramp endpoints MUST reject callers without an effective user** — Alfredpay and Avenia/BRL flows derive their provider customer/subaccount from `api_keys.user_id -> profiles.id -> alfredpay_customers.user_id` / `tax_ids.user_id`. Quote creation is anonymous-eligible on every corridor (Alfredpay quotes carry only a tracking-metadata customer id — the `"anonymous"` sentinel for non-KYC'd callers), but `POST /v1/ramp/register` requires Supabase or secret-key credentials and `RampService.registerRamp` rejects missing effective users with `400 Invalid quote`. Quotes owned by a *different* user are rejected with `403`; anonymous quotes (no owner) may be claimed, with provider identity always derived from the claimer's own KYC records. ## Threat Vectors & Mitigations diff --git a/docs/security-spec/SPEC-DELTA-2026-05.md b/docs/security-spec/SPEC-DELTA-2026-05.md index fe1a09b3d..f41673284 100644 --- a/docs/security-spec/SPEC-DELTA-2026-05.md +++ b/docs/security-spec/SPEC-DELTA-2026-05.md @@ -290,7 +290,7 @@ The dual-track auth model — partner SDK key OR Supabase user session — is th |---|---|---| | `POST /v1/ramp/quotes` | `apiKeyAuth({required: false})` + `enforcePartnerAuth()` | Partner key, if present, must match `partnerId` in body | | `POST /v1/ramp/quotes/best` | `apiKeyAuth({required: false})` + `enforcePartnerAuth()` | Same as above | -| `POST /v1/ramp/register` | `requirePartnerOrUserAuth()` | `assertQuoteOwnership(req, quoteId)` + service effective-user check; anonymous quotes must be re-quoted with the registering principal | +| `POST /v1/ramp/register` | `requirePartnerOrUserAuth()` | `assertQuoteOwnership(req, quoteId)` + service effective-user check; anonymous quotes may be claimed by the registering principal (provider identity derives from the claimer's KYC records) | | `POST /v1/ramp/update` | `optionalPartnerOrUserAuth()` | `assertRampOwnership(req, rampId)` — anonymous caller allowed iff ramp has `userId === null` AND its quote has `partnerId === null` | | `POST /v1/ramp/start` | `optionalPartnerOrUserAuth()` | `assertRampOwnership(req, rampId)` — same condition as update | | `GET /v1/ramp/:id` | `optionalPartnerOrUserAuth()` | `assertRampOwnership(req, id)` — same condition as update | @@ -302,4 +302,4 @@ The dual-track auth model — partner SDK key OR Supabase user session — is th `optionalPartnerOrUserAuth()` accepts a request with no credentials, but a request that *presents* invalid credentials (malformed `X-API-Key` or expired/forged Bearer) is still rejected with 401. The downstream ownership checks then decide whether the resource is reachable: anonymous callers are admitted only for legacy fully-anonymous ramps on the optional endpoints. Ramp registration itself is credential-gated. -Frontend uses `Authorization: Bearer` (Supabase). SDK partners use `X-API-Key: sk_*`. SDK clients without keys may request anonymous quote estimates only on corridors that explicitly support them, but must authenticate before registering a ramp. Both authenticated principals grant equal access subject to per-principal ownership scoping. +Frontend uses `Authorization: Bearer` (Supabase). SDK partners use `X-API-Key: sk_*`. SDK clients without keys may request anonymous quote estimates on every corridor (Alfredpay quotes carry only a tracking-metadata customer id), but must authenticate before registering a ramp. Both authenticated principals grant equal access subject to per-principal ownership scoping. From 7bb7f0eea2162a6908d06aa68c737e7fa0a1b6fb Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Thu, 2 Jul 2026 19:15:27 +0200 Subject: [PATCH 063/176] refactor(api): enforce taxId match on BRL onramp via shared resolveAveniaAccountForRamp resolveAveniaAccountForRamp was dead code: prepareOfframpBrlTransactions re-implemented its derive-then-compare logic inline, and the onramp path silently ignored a client-supplied additionalData.taxId altogether. That contradicted the documented deprecation contract ('mismatches against the derived taxId are rejected') and left the two BRL register paths behaving differently for no reason. Both paths now go through resolveAveniaAccountForRamp(userId, taxId), so a provided taxId that does not match the Avenia profile bound to the authenticated user is rejected with 400 on onramp and offramp alike. Also renames avena-account.ts -> avenia-account.ts (the provider is Avenia) and aligns the BRLA security spec with the actual enforcement. --- apps/api/src/api/controllers/brla.controller.ts | 2 +- .../{avena-account.ts => avenia-account.ts} | 0 apps/api/src/api/services/ramp/ramp.service.ts | 13 +++---------- docs/security-spec/05-integrations/brla.md | 4 ++-- 4 files changed, 6 insertions(+), 13 deletions(-) rename apps/api/src/api/services/{avena-account.ts => avenia-account.ts} (100%) diff --git a/apps/api/src/api/controllers/brla.controller.ts b/apps/api/src/api/controllers/brla.controller.ts index 2d2e0e06e..c52f8d607 100644 --- a/apps/api/src/api/controllers/brla.controller.ts +++ b/apps/api/src/api/controllers/brla.controller.ts @@ -38,7 +38,7 @@ import logger from "../../config/logger"; import TaxId, { TaxIdInternalStatus } from "../../models/taxId.model"; import { APIError } from "../errors/api-error"; import { getEffectiveUserId } from "../middlewares/effectiveUser"; -import { resolveAveniaAccountForUser } from "../services/avena-account"; +import { resolveAveniaAccountForUser } from "../services/avenia-account"; // Helper functions for TaxId updates diff --git a/apps/api/src/api/services/avena-account.ts b/apps/api/src/api/services/avenia-account.ts similarity index 100% rename from apps/api/src/api/services/avena-account.ts rename to apps/api/src/api/services/avenia-account.ts diff --git a/apps/api/src/api/services/ramp/ramp.service.ts b/apps/api/src/api/services/ramp/ramp.service.ts index f214b465e..3947a5a69 100644 --- a/apps/api/src/api/services/ramp/ramp.service.ts +++ b/apps/api/src/api/services/ramp/ramp.service.ts @@ -52,7 +52,7 @@ import RampState, { RampStateAttributes } from "../../../models/rampState.model" import TaxId from "../../../models/taxId.model"; import { APIError } from "../../errors/api-error"; import { ActivePartner, handleQuoteConsumptionForDiscountState } from "../../services/quote/engines/discount/helpers"; -import { resolveAveniaAccountForUser } from "../avena-account"; +import { resolveAveniaAccountForRamp } from "../avenia-account"; import { resolveMykoboCustomerForUser } from "../mykobo/mykobo-customer.service"; import { StateMetadata } from "../phases/meta-state-types"; import phaseProcessor from "../phases/phase-processor"; @@ -1042,17 +1042,10 @@ export class RampService extends BaseRampService { }); } - const aveniaAccount = await resolveAveniaAccountForUser(userId); + const aveniaAccount = await resolveAveniaAccountForRamp(userId, additionalData.taxId); const derivedTaxId = aveniaAccount.taxId; const derivedReceiverTaxId = normalizeTaxId(additionalData.receiverTaxId || derivedTaxId); - if (additionalData.taxId && normalizeTaxId(additionalData.taxId) !== derivedTaxId) { - throw new APIError({ - message: "Provided taxId does not match the Avenia profile bound to the authenticated user.", - status: httpStatus.BAD_REQUEST - }); - } - const subaccount = await this.validateBrlaOfframpRequest( derivedTaxId, additionalData.pixDestination, @@ -1129,7 +1122,7 @@ export class RampService extends BaseRampService { }); } - const aveniaAccount = await resolveAveniaAccountForUser(userId); + const aveniaAccount = await resolveAveniaAccountForRamp(userId, additionalData.taxId); const derivedTaxId = aveniaAccount.taxId; const { brCode, aveniaTicketId } = await this.validateBrlaOnrampRequest(derivedTaxId, quote, quote.inputAmount); diff --git a/docs/security-spec/05-integrations/brla.md b/docs/security-spec/05-integrations/brla.md index 4aa4fc652..6637f8c4e 100644 --- a/docs/security-spec/05-integrations/brla.md +++ b/docs/security-spec/05-integrations/brla.md @@ -75,10 +75,10 @@ The invariant `transferAmount ≥ payoutAmount` must hold (transfer covers payou 13. **BRL↔AssetHub MUST stay disabled while the Base BRL rail is active-only** — The quote engine should return no quote for BRL→AssetHub or AssetHub→BRL, preventing users from registering legacy Moonbeam/Pendulum BRL routes. 14. **The BRL→BRLA-on-Base on-ramp MUST take the direct-transfer bypass** — When `inputCurrency === BRL`, `outputCurrency === BRLA`, and `network === Base`, `isBrlToBrlaBaseDirect` MUST short-circuit the route to a single `destinationTransfer` from the ephemeral to the user, with `stateMeta.isDirectTransfer = true`. The Nabla swap, `distributeFees`, SquidRouter, `finalSettlementSubsidy`, and Base cleanup phases MUST NOT run — routing BRLA through USDC and back would burn double-swap slippage/fees against the user and expose the over-subsidy race (`06-cross-chain/fund-routing.md`). The `squidRouterSwap` and `finalSettlementSubsidy` handlers MUST also honor `isDirectTransfer`/`isBrlToBrlaBaseDirect` defensively and skip to `destinationTransfer` if reached. 15. **BRL→EVM quote output precision MUST match the destination token** — For supported EVM destinations, `quote.outputAmount` MUST preserve the destination token's decimal precision, and `evmToEvm.outputAmountRaw` MUST represent the destination token's raw units. The Squid bridge input remains Base USDC raw (`evmToEvm.inputAmountRaw`), but final delivery uses destination-token decimals. -16. **BRL register paths MUST derive tax ID / subaccount from the effective user** — `RampService.prepareOfframpBrlTransactions` and `RampService.prepareAveniaOnrampTransactions` resolve the Avenia account via `resolveAveniaAccountForUser(userId)` and call `validateBrlaOnrampRequest(derivedTaxId, ...)` / `validateBrlaOfframpRequest(derivedTaxId, ...)`. Client-supplied `additionalData.taxId` and `additionalData.receiverTaxId` are accepted only when they match the derived value; mismatches return `400`. +16. **BRL register paths MUST derive tax ID / subaccount from the effective user** — `RampService.prepareOfframpBrlTransactions` and `RampService.prepareAveniaOnrampTransactions` resolve the Avenia account via `resolveAveniaAccountForRamp(userId, additionalData.taxId)` and call `validateBrlaOnrampRequest(derivedTaxId, ...)` / `validateBrlaOfframpRequest(derivedTaxId, ...)`. A client-supplied `additionalData.taxId` is accepted only when it matches the derived value (enforced identically on the onramp and offramp paths); mismatches return `400`. `additionalData.receiverTaxId` may legitimately differ from the sender and is validated downstream against the PIX key owner. 17. **`/v1/brla/getUser` and `/v1/brla/getUserRemainingLimit` MUST scope reads to the effective user** — When a `taxId` query is provided, the `TaxId` row MUST be owned by `getEffectiveUserId(req)`. When `taxId` is omitted, the endpoint derives the user's Avenia account via the resolver and returns `400` for zero or multiple KYC-completed matches. The legacy partner-key exemption that allowed reading any taxId has been removed; bare partner keys (no `api_keys.user_id` binding) and fully anonymous callers are rejected with `400`. 18. **`/v1/brla/createSubaccount` MUST require an authenticated principal** — The route now uses `requirePartnerOrUserAuth()` and the controller requires an effective user. Bare partner keys and anonymous callers receive `400`; the Avenia API is not called and no `TaxId` row is created. This closes the anonymous subaccount creation DoS surface. -19. **BRL quote creation MUST remain anonymous-eligible while register/start remain user-gated** — `POST /v1/quotes` and `POST /v1/quotes/best` accept BRL corridors from anonymous callers and partner-key callers (with or without a `userId` binding). The Avenia `createPayInQuote` calls used by the BRL engines do not require a user-bound principal. The actual Avenia subaccount/taxId resolution still happens server-side at register time via `resolveAveniaAccountForUser(effectiveUserId)`. `POST /v1/ramp/register` requires Supabase or secret-key credentials, and `RampService.registerRamp` rejects provider-backed ramps without an effective user with `400 Invalid quote`. **An anonymous BRL quote cannot be registered by an authenticated caller** — `RampService.registerRamp` rejects with `403` when `quote.userId == null && request.userId != null`, so an unauthenticated BRL estimate cannot be claimed by an unrelated user. +19. **BRL quote creation MUST remain anonymous-eligible while register/start remain user-gated** — `POST /v1/quotes` and `POST /v1/quotes/best` accept BRL corridors from anonymous callers and partner-key callers (with or without a `userId` binding). The Avenia `createPayInQuote` calls used by the BRL engines do not require a user-bound principal. The actual Avenia subaccount/taxId resolution still happens server-side at register time via `resolveAveniaAccountForRamp(effectiveUserId, additionalData.taxId)`. `POST /v1/ramp/register` requires Supabase or secret-key credentials, and `RampService.registerRamp` rejects provider-backed ramps without an effective user with `400 Invalid quote`. **An anonymous BRL quote may be claimed by an authenticated caller** (the normal web-app funnel: quote before login, register after) — claiming is not an escalation because the anonymous quote carries no owner and the Avenia identity is derived from the claimer's own KYC records, never from the quote or request body. ## Threat Vectors & Mitigations From f92232a54b3de6b804b1aa455ed24a3d71f84ad9 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Thu, 2 Jul 2026 19:15:47 +0200 Subject: [PATCH 064/176] fix(api): cap self-serve API keys per user and create pairs atomically Secret-key validation narrows by keyPrefix (first 8 chars), but that prefix is the constant sk_live_/sk_test_ for every secret key, so every auth request bcrypt-compares (cost 10) against ALL active secret keys in the environment. The self-serve POST /v1/api-keys endpoint made that scan user-growable: any OTP-signup user could mint unlimited pairs and degrade auth latency for the whole system. createUserApiKey now rejects with 409 once a user holds MAX_ACTIVE_KEYS_PER_USER (10) active keys (revocation frees slots), caps expiresAt at 2 years, and creates the public/secret pair inside a single transaction so a failed second insert cannot leave an orphaned half. The api-keys security spec previously claimed the prefix lookup 'bounds the cost of bcrypt comparisons' - corrected to describe the real linear-scan behavior, the new cap, and the O(1)-lookup key-format change worth making later. --- .../userApiKeys.controller.test.ts | 20 ++++- .../api/controllers/userApiKeys.controller.ts | 85 ++++++++++++++----- docs/security-spec/01-auth/api-keys.md | 13 +-- 3 files changed, 91 insertions(+), 27 deletions(-) diff --git a/apps/api/src/api/controllers/userApiKeys.controller.test.ts b/apps/api/src/api/controllers/userApiKeys.controller.test.ts index 1c83da17e..4269157f0 100644 --- a/apps/api/src/api/controllers/userApiKeys.controller.test.ts +++ b/apps/api/src/api/controllers/userApiKeys.controller.test.ts @@ -1,7 +1,7 @@ import { afterEach, describe, expect, it, mock } from "bun:test"; import httpStatus from "http-status"; import ApiKey from "../../models/apiKey.model"; -import { revokeUserApiKey } from "./userApiKeys.controller"; +import { createUserApiKey, MAX_ACTIVE_KEYS_PER_USER, revokeUserApiKey } from "./userApiKeys.controller"; function createResponse() { const res = { @@ -21,6 +21,24 @@ function createResponse() { return res; } +describe("createUserApiKey", () => { + const originalCount = ApiKey.count; + + afterEach(() => { + ApiKey.count = originalCount; + }); + + it("rejects creation with 409 when the per-user active key cap is reached", async () => { + ApiKey.count = mock(async () => MAX_ACTIVE_KEYS_PER_USER) as unknown as typeof ApiKey.count; + + const res = createResponse(); + await createUserApiKey({ body: {}, userId: "user-1" } as never, res as never); + + expect(res.statusCode).toBe(httpStatus.CONFLICT); + expect((res.body as { error: { code: string } }).error.code).toBe("API_KEY_LIMIT_REACHED"); + }); +}); + describe("revokeUserApiKey", () => { const originalFindOne = ApiKey.findOne; diff --git a/apps/api/src/api/controllers/userApiKeys.controller.ts b/apps/api/src/api/controllers/userApiKeys.controller.ts index 7b109e0f5..7b6d1fae8 100644 --- a/apps/api/src/api/controllers/userApiKeys.controller.ts +++ b/apps/api/src/api/controllers/userApiKeys.controller.ts @@ -1,5 +1,6 @@ import { Request, Response } from "express"; import httpStatus from "http-status"; +import sequelize from "../../config/database"; import logger from "../../config/logger"; import { config } from "../../config/vars"; import ApiKey from "../../models/apiKey.model"; @@ -10,6 +11,14 @@ interface CreateApiKeyBody { name?: string; } +// Secret-key validation bcrypt-compares against every active key sharing the constant +// 8-char prefix (e.g. "sk_live_"), so the total number of active keys directly bounds +// auth latency. Cap what a single user can mint. +export const MAX_ACTIVE_KEYS_PER_USER = 10; + +// Keys must expire; cap client-supplied expiry at 2 years (default is 1 year). +const MAX_EXPIRY_MS = 2 * 365 * 24 * 60 * 60 * 1000; + export async function createUserApiKey(req: Request, res: Response): Promise { const userId = req.userId; if (!userId) { @@ -28,6 +37,18 @@ export async function createUserApiKey(req: Request, res: Response): Promise MAX_ACTIVE_KEYS_PER_USER) { + res.status(httpStatus.CONFLICT).json({ + error: { + code: "API_KEY_LIMIT_REACHED", + message: `Active API key limit reached (${MAX_ACTIVE_KEYS_PER_USER} keys). Revoke unused keys before creating new ones.`, + status: httpStatus.CONFLICT + } + }); + return; + } + const publicKey = generateApiKey("public", environment); const publicKeyPrefix = getKeyPrefix(publicKey); @@ -48,28 +69,50 @@ export async function createUserApiKey(req: Request, res: Response): Promise Date.now() + MAX_EXPIRY_MS) { + res.status(httpStatus.BAD_REQUEST).json({ + error: { + code: "INVALID_EXPIRES_AT", + message: "expiresAt must be at most 2 years from now", + status: httpStatus.BAD_REQUEST + } + }); + return; + } - const secretKeyRecord = await ApiKey.create({ - expiresAt: expirationDate, - isActive: true, - keyHash: secretKeyHash, - keyPrefix: secretKeyPrefix, - keyType: "secret", - keyValue: null, - name: `${name || "API Key"} (Secret)`, - partnerName: null, - userId + // Create the pair atomically so a failure cannot leave an orphaned half. + const { publicKeyRecord, secretKeyRecord } = await sequelize.transaction(async transaction => { + const createdPublicKey = await ApiKey.create( + { + expiresAt: expirationDate, + isActive: true, + keyHash: null, + keyPrefix: publicKeyPrefix, + keyType: "public", + keyValue: publicKey, + name: `${name || "API Key"} (Public)`, + partnerName: null, + userId + }, + { transaction } + ); + + const createdSecretKey = await ApiKey.create( + { + expiresAt: expirationDate, + isActive: true, + keyHash: secretKeyHash, + keyPrefix: secretKeyPrefix, + keyType: "secret", + keyValue: null, + name: `${name || "API Key"} (Secret)`, + partnerName: null, + userId + }, + { transaction } + ); + + return { publicKeyRecord: createdPublicKey, secretKeyRecord: createdSecretKey }; }); res.status(httpStatus.CREATED).json({ diff --git a/docs/security-spec/01-auth/api-keys.md b/docs/security-spec/01-auth/api-keys.md index 1fb3ac884..86797ae4d 100644 --- a/docs/security-spec/01-auth/api-keys.md +++ b/docs/security-spec/01-auth/api-keys.md @@ -38,16 +38,17 @@ A nullable `user_id` column on `api_keys` (FK to `profiles.id`, `ON DELETE SET N 4. **Key format validation MUST precede database lookup** — Both `isValidSecretKeyFormat()` and `isValidApiKeyFormat()` use regex to reject malformed keys before any DB query, preventing injection and unnecessary load. 5. **Partner matching MUST compare names, not IDs** — When `validatePartnerMatch` is enabled, the middleware compares partner names (since one API key can work for multiple partner records with the same name). Both UUID and string name formats for `partnerId` are supported. 6. **Expired keys MUST be rejected** — Both public and secret key validation check `expiresAt` against the current time. Expired keys are treated as invalid. -7. **Key lookup MUST use prefix indexing** — Secret key validation first narrows by `keyPrefix` (first 8 chars), then iterates with bcrypt comparison. This bounds the cost of bcrypt comparisons. +7. **Key lookup narrows by prefix, but the prefix does NOT bound the scan** — Secret key validation narrows by `keyPrefix` (first 8 chars) and then iterates with bcrypt comparison. Since the first 8 chars are the constant `sk_live_`/`sk_test_` for every secret key, the scan covers **all** active secret keys in that environment; auth latency grows linearly with the number of active secret keys. This is why self-serve key creation is capped (see invariant 17). A future format change embedding a random key-id in the key string would restore O(1) lookup. 8. **`enforcePartnerAuth` MUST block unauthenticated requests when `partnerId` is present** — If a request includes `partnerId` but has no authenticated partner, it MUST be rejected with 403. 9. **`lastUsedAt` updates MUST be fire-and-forget** — The `keyRecord.update({ lastUsedAt })` call is intentionally not awaited, with errors caught and logged. This MUST NOT block or fail the auth flow. 10. **Key generation MUST use cryptographically secure randomness** — `crypto.randomBytes(32)` is the source. Base64 encoding with character stripping is used to produce the 32-char alphanumeric portion. 11. **Secret keys MAY carry a nullable `api_keys.user_id` to identify a delegated user context** — The binding is consumed by the `apiKeyUserId` request field and is the only path for partner secret keys to provide a non-Supabase user identity. Public keys never carry or surface a user binding. 12. **`ON DELETE SET NULL` for `api_keys.user_id` is intentional** — Deleting a profile must not silently revoke partner keys; partner keys are operational assets and binding loss is a soft-state change. -13. **Alfredpay quote creation and all ramp registration MUST be rejected when no effective user is present** — Alfredpay quote engines return `400 Alfredpay quote creation requires an API key linked to a user or Supabase user authentication.` before any upstream Alfredpay quote call. `POST /v1/ramp/register` requires a Supabase user or linked secret key and `RampService.registerRamp` also rejects missing effective users with `400 Invalid quote: this route requires an API key linked to a user or Supabase user authentication.`. BRL quote creation remains anonymous-eligible, but BRL ramp registration is user-gated because the Avenia subaccount is derived from the effective user. Unlinked secret keys are not a valid identity for these corridors. +13. **All ramp registration MUST be rejected when no effective user is present** — `POST /v1/ramp/register` requires a Supabase user or linked secret key and `RampService.registerRamp` rejects missing effective users with `400 Invalid quote: this route requires an API key linked to a user or Supabase user authentication.`. Quote creation remains anonymous-eligible for every corridor: Alfredpay quote engines use `resolveAlfredpayQuoteCustomerId`, which puts the sentinel `"anonymous"` (or the caller's real customer id when KYC-completed) into the tracking-only quote `metadata`; the KYC-gated `resolveAlfredpayCustomerId` runs at registration before any Alfredpay *order* is created. An anonymous quote (`quote.userId = NULL`) may be claimed at registration by any authenticated caller — it carries no owner, and provider identity is derived from the claimer's own KYC records. Unlinked secret keys are not a valid identity for registration. 14. **`api_keys.partner_name` is nullable; a NULL `partner_name` marks a user-scoped key** — `validateSecretApiKey` skips the `Partner` lookup entirely for keys with `partner_name = NULL` and `user_id` set, returning `{ partner: null, apiKeyUserId }`. The middleware leaves `req.authenticatedPartner` unset, so the request authenticates purely as the linked user. A secret key with neither `partner_name` nor `user_id` is unusable and rejected as invalid. 15. **User-scoped keys MUST interpolate no partner pricing** — When `req.authenticatedPartner` is unset, `resolveQuotePartner` finds no partner (`source: "none"`), and `calculatePartnerAndVortexFees` falls through to the default `vortex` Partner fee rows. User-scoped keys never receive partner-specific discounts. 16. **`POST/GET/DELETE /v1/api-keys` MUST require a Supabase user (`requireAuth`)** — The endpoints bind the created keys to `req.userId`; partner keys (with `partner_name`) remain admin-only under `/v1/admin/partners/:partnerName/api-keys` (`adminAuth`). +17. **Self-serve key creation MUST be capped per user** — `createUserApiKey` rejects with `409 API_KEY_LIMIT_REACHED` when the user already has `MAX_ACTIVE_KEYS_PER_USER` (10) active keys, and rejects `expiresAt` values more than 2 years out. Because of the linear bcrypt scan (invariant 7), an unbounded self-serve endpoint would let any user degrade auth latency for the whole system. The key pair is created in a single DB transaction so a failure cannot leave an orphaned half. ## Threat Vectors & Mitigations @@ -59,7 +60,8 @@ A nullable `user_id` column on `api_keys` (FK to `profiles.id`, `ON DELETE SET N | **Partner impersonation** | Attacker uses one partner's API key with another partner's `partnerId` | `enforcePartnerAuth` compares authenticated partner name against requested partner name; rejects mismatches with 403 | | **Stale/revoked key usage** | Partner's key is deactivated but still being used | `isActive` flag checked on every validation; expired keys rejected by `expiresAt` check | | **Key hash enumeration** | Attacker with DB read access tries to use key hashes | bcrypt hashes are one-way; raw keys cannot be recovered from hashes | -| **Unlinked key creating provider resources anonymously** | Partner uses a generic (unbound) sk\_ key to mint provider-side resources, then registers with a linked secret key or Supabase session to claim them | Alfredpay quote engines reject before any upstream provider call unless an effective user exists and resolves to a completed Alfredpay customer. BRL quote creation can remain an anonymous estimate, but `POST /v1/ramp/register` requires credentials and `RampService.registerRamp` rejects missing effective users or authenticated attempts to claim a quote created without `quote.userId`. | +| **Unlinked key creating provider resources anonymously** | Partner uses a generic (unbound) sk\_ key to mint provider-side resources, then registers with a linked secret key or Supabase session to claim them | Quotes are estimates and carry no provider resources beyond a tracking-metadata customer id (`"anonymous"` sentinel for non-KYC'd callers). All provider *orders* are created at registration, where `POST /v1/ramp/register` requires credentials, `RampService.registerRamp` rejects missing effective users, and provider identity is derived from the registering user's own KYC records — so claiming an anonymous quote yields no access to anyone else's resources. | +| **Self-serve key flooding (auth DoS)** | A user mints thousands of key pairs via `POST /v1/api-keys`, inflating the bcrypt scan for every secret-key auth | Per-user cap of `MAX_ACTIVE_KEYS_PER_USER` (10) active keys enforced with `409`; revocation frees slots. | | **One linked key operating on another user's quote/ramp** | Partner with a valid linked key targets a different linked user's provider-bound quote | `assertQuoteOwnership`/`assertRampOwnership` enforce `quote.userId === req.apiKeyUserId` when a linked key is in scope. The `RampService.registerRamp` cross-user check rejects the same scenario at registration time with `403`. | | **Anonymous subaccount creation DoS** | Unauthenticated caller hits `POST /v1/brla/createSubaccount` to spawn stranded Avenia subaccounts | The route now requires `requirePartnerOrUserAuth()`; controllers require an effective user id before calling the Avenia API. | @@ -85,7 +87,8 @@ A nullable `user_id` column on `api_keys` (FK to `profiles.id`, `ON DELETE SET N - [x] `getEffectiveUserId` returns `req.userId ?? req.apiKeyUserId`. — **PASS** - [x] User-scoped keys interpolate no partner pricing (`resolveQuotePartner` returns `source: "none"`, fee engine falls through to default `vortex` Partner rows). — **PASS** - [x] `POST/GET/DELETE /v1/api-keys` require `requireAuth` (Supabase Bearer); bind created keys to `req.userId` with `partner_name = NULL`. Admin partner-key endpoints still require `adminAuth`. — **PASS** -- [x] Alfredpay quote creation rejects missing effective users before calling Alfredpay; BRL quote creation remains anonymous-eligible because Avenia quotes do not require user-bound provider identity. — **PASS** +- [x] Quote creation is anonymous-eligible for every corridor; Alfredpay quote engines use the sentinel `"anonymous"` in tracking-only quote metadata for non-KYC'd callers (`resolveAlfredpayQuoteCustomerId`), and provider orders always resolve via the strict `resolveAlfredpayCustomerId`. — **PASS** - [x] `POST /v1/ramp/register` and `RampService.registerRamp` reject ramp registration without an effective user with `401` at the route or `400 Invalid quote` at the service boundary. — **PASS** -- [x] `RampService.registerRamp` rejects anonymous quotes from being claimed by an authenticated caller with `403` (`quote.userId == null && request.userId != null`). — **PASS** +- [x] `RampService.registerRamp` rejects registration of a quote owned by a *different* user with `403`; anonymous quotes (no owner) may be claimed by any authenticated caller, with provider identity derived from the claimer's own KYC records. — **PASS** +- [x] `createUserApiKey` enforces `MAX_ACTIVE_KEYS_PER_USER` (10) with `409`, caps `expiresAt` at 2 years, and creates the key pair in a single transaction. — **PASS** - [x] `assertQuoteOwnership` and `assertRampOwnership` reject linked-key callers who try to operate on a different linked user's quote/ramp. — **PASS** From 0426312568b19913f20812494d6f2115e4bf35bc Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Thu, 2 Jul 2026 19:16:01 +0200 Subject: [PATCH 065/176] fix(frontend): skip BRL limit pre-check for unauthenticated users /brla/getUser and /brla/getUserRemainingLimit now require an effective user, but usePreRampCheck fires on the Confirm click - which happens before the ramp machine routes to login (CheckAuth). For a logged-out visitor the pre-check therefore hit a 400, rampWithinLimits returned false, and every BRL submission was blocked. The pre-check is only a UX nicety (an early limit warning); the backend enforces limits authoritatively at ramp registration. Skip it when no auth token is present and let the flow continue to login/KYC. --- apps/frontend/src/services/initialChecks.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/frontend/src/services/initialChecks.ts b/apps/frontend/src/services/initialChecks.ts index 3bedea44b..48d592122 100644 --- a/apps/frontend/src/services/initialChecks.ts +++ b/apps/frontend/src/services/initialChecks.ts @@ -5,6 +5,7 @@ import { useToastMessage } from "../helpers/notifications"; import { useRampDirection } from "../stores/rampDirectionStore"; import { RampExecutionInput } from "../types/phases"; import { BrlaService } from "./api"; +import { AuthService } from "./auth"; function useRampAmountWithinAllowedLimits() { const { t } = useTranslation(); @@ -13,6 +14,13 @@ function useRampAmountWithinAllowedLimits() { return useCallback( async (amountUnits: string, taxId: string): Promise => { + // /brla/getUser and /brla/getUserRemainingLimit require an authenticated (effective) user. + // The Confirm click can happen before login, so skip the pre-flight here — the backend + // enforces limits authoritatively at ramp registration. + if (!AuthService.isAuthenticated()) { + return true; + } + try { const subaccount = await BrlaService.getUser(taxId); // This check passes if subaccount is not created, or if identity status is not confirmed From 40f55e5977bd35bee4ffcf6ab2edb9546492e3d0 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Thu, 2 Jul 2026 19:16:19 +0200 Subject: [PATCH 066/176] fix(sdk): update Mykobo error mappings to the derived-email server messages The server no longer emits 'email must be provided for Mykobo (EUR) offramp' (the email is now derived from the effective user's profile), and the onramp parameter message dropped 'email' - so parseAPIError matched dead strings and returned generic VortexSdkError for the new KYC-gate responses. Remove the dead mappings, match the current onramp message, and map the three resolveMykoboCustomerForUser rejections (KYC not approved, email mismatch, missing profile) to a typed MykoboKycRequiredError so callers can branch on it the same way they can for Alfredpay. --- packages/sdk/src/errors.ts | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/packages/sdk/src/errors.ts b/packages/sdk/src/errors.ts index 677c43bc4..994c0dee8 100644 --- a/packages/sdk/src/errors.ts +++ b/packages/sdk/src/errors.ts @@ -260,6 +260,17 @@ export class MissingMykoboOfframpParametersError extends MykoboError { } } +/** + * The effective user's Mykobo KYC is missing/not approved, or the supplied email does not + * match the profile bound to the authenticated user. Complete Mykobo KYC before EUR ramps. + */ +export class MykoboKycRequiredError extends MykoboError { + constructor(message: string, status = 400) { + super(message, status); + this.name = "MykoboKycRequiredError"; + } +} + /** * Update Ramp Error Types */ @@ -499,18 +510,22 @@ export function parseAPIError(response: unknown): VortexSdkError { if (errorMessage === "Parameters walletAddress and moneriumAuthToken is required for Monerium onramp") { return new MissingMoneriumOfframpParametersError(); } - if (errorMessage === "Parameters destinationAddress, email and ipAddress are required for Mykobo EUR onramp") { + if (errorMessage === "Parameters destinationAddress and ipAddress are required for Mykobo EUR onramp") { return new MissingMykoboOnrampParametersError(); } - if (errorMessage === "email must be provided for Mykobo (EUR) offramp") { - return new MissingMykoboOfframpParametersError(); - } if (errorMessage === "ipAddress must be provided for Mykobo (EUR) offramp") { return new MissingMykoboOfframpParametersError(); } if (errorMessage === "destinationAddress (user receiving wallet) must be provided for Mykobo offramp") { return new MissingMykoboOfframpParametersError(); } + if ( + errorMessage.startsWith("Mykobo KYC is not approved for this user") || + errorMessage === "Provided email does not match the profile bound to the authenticated user." || + errorMessage === "No profile found for this user; cannot resolve the Mykobo customer." + ) { + return new MykoboKycRequiredError(errorMessage, normalizedStatus); + } if (errorMessage === "Ramp not found") { return new RampNotFoundError(); From 419b18bf3d7d8e994ae3a4bde0b26d17fa6d07f2 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Thu, 2 Jul 2026 19:16:20 +0200 Subject: [PATCH 067/176] test(api): repair tests left failing by the user-gating behavior changes Two test files were not updated when this branch changed the behavior they cover, so they failed on the branch even before the follow-up fixes: - brla.controller.test.ts still asserted the pre-branch contract (taxId required, unlinked partner keys allowed to read any taxId, anonymous-owned subaccount records rejected with 409). Rewritten for the effective-user model: anonymous and unlinked-partner lookups get 400, user-linked keys read their own taxId, and authenticated callers claim anonymous subaccount records instead of conflicting. - ramp.service.get-ramp-status.test.ts hardcoded flowVariant 'monerium', so getRampStatus returned null (and every assertion failed) on any machine with FLOW_VARIANT=mykobo. Use config.flowVariant like the register-auth test does, making the test environment-independent. --- .../api/controllers/brla.controller.test.ts | 32 +++++++++++++++---- .../ramp/ramp.service.get-ramp-status.test.ts | 3 +- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/apps/api/src/api/controllers/brla.controller.test.ts b/apps/api/src/api/controllers/brla.controller.test.ts index 3f88a8a3b..4c35783a3 100644 --- a/apps/api/src/api/controllers/brla.controller.test.ts +++ b/apps/api/src/api/controllers/brla.controller.test.ts @@ -60,7 +60,7 @@ describe("getAveniaUser", () => { subAccountId: "subaccount-1" }; - it("returns 400 when taxId is missing", async () => { + it("returns 400 when no effective user is present (anonymous caller)", async () => { mockConfirmedAveniaUser(); const res = createResponse(); @@ -72,10 +72,10 @@ describe("getAveniaUser", () => { ); expect(res.statusCode).toBe(httpStatus.BAD_REQUEST); - expect(res.body).toEqual({ error: "Missing taxId query parameters" }); + expect(res.body).toEqual({ error: "Missing or invalid authentication." }); }); - it("allows partner API key lookups without quoteId", async () => { + it("rejects unlinked partner API key lookups (no effective user)", async () => { mockConfirmedAveniaUser(); const res = createResponse(); @@ -87,6 +87,23 @@ describe("getAveniaUser", () => { res as any ); + expect(res.statusCode).toBe(httpStatus.BAD_REQUEST); + expect(res.body).toEqual({ error: "Missing or invalid authentication." }); + }); + + it("allows user-linked API key lookups for the key user's own taxId", async () => { + mockConfirmedAveniaUser("user-1"); + + const res = createResponse(); + await getAveniaUser( + { + apiKeyUserId: "user-1", + authenticatedPartner: { id: "partner-1", name: "Partner" }, + query: { taxId: "08786985906" } + } as any, + res as any + ); + expect(res.statusCode).toBe(httpStatus.OK); expect(res.body).toEqual(expectedConfirmedBody); }); @@ -181,11 +198,13 @@ describe("createSubaccount", () => { expect(createAveniaSubaccountMock).not.toHaveBeenCalled(); }); - it("rejects when an authenticated caller targets an anonymously-owned existing subaccount", async () => { + it("lets an authenticated caller claim an anonymously-owned existing subaccount record", async () => { mockBrlaApi(); createAveniaSubaccountMock.mockClear(); + const updateMock = mock(async () => undefined); TaxId.findByPk = mock(async () => ({ internalStatus: TaxIdInternalStatus.Requested, + update: updateMock, userId: null })) as typeof TaxId.findByPk; @@ -198,8 +217,9 @@ describe("createSubaccount", () => { res as any ); - expect(res.statusCode).toBe(httpStatus.CONFLICT); - expect(createAveniaSubaccountMock).not.toHaveBeenCalled(); + expect(res.statusCode).toBe(httpStatus.OK); + expect(updateMock).toHaveBeenCalledWith({ userId: "some-user" }); + expect(createAveniaSubaccountMock).toHaveBeenCalled(); }); it("allows an authenticated user to (re)create their own subaccount", async () => { diff --git a/apps/api/src/api/services/ramp/ramp.service.get-ramp-status.test.ts b/apps/api/src/api/services/ramp/ramp.service.get-ramp-status.test.ts index 1d142a102..49e7c422a 100644 --- a/apps/api/src/api/services/ramp/ramp.service.get-ramp-status.test.ts +++ b/apps/api/src/api/services/ramp/ramp.service.get-ramp-status.test.ts @@ -1,5 +1,6 @@ import { describe, expect, it, mock } from "bun:test"; import { EPaymentMethod, FiatToken, Networks, RampDirection, RampPhase } from "@vortexfi/shared"; +import { config } from "../../../config/vars"; import QuoteTicket from "../../../models/quoteTicket.model"; import RampState from "../../../models/rampState.model"; import { StateMetadata } from "../phases/meta-state-types"; @@ -51,7 +52,7 @@ function makeRampState(onHold: boolean, currentPhase: RampPhase = "brlaOnrampMin createdAt, currentPhase, errorLogs: [], - flowVariant: "monerium", + flowVariant: config.flowVariant, from: EPaymentMethod.PIX, id: "ramp-1", paymentMethod: EPaymentMethod.PIX, From 694cf96b787d4248d3d80cfab50c0228e6feda9f Mon Sep 17 00:00:00 2001 From: Gianfranco Date: Thu, 2 Jul 2026 17:14:47 -0300 Subject: [PATCH 068/176] improve taxId missmatch error handling --- apps/api/src/api/controllers/brla.controller.ts | 2 +- apps/api/src/api/services/avenia-account.ts | 2 +- packages/sdk/src/errors.ts | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/api/src/api/controllers/brla.controller.ts b/apps/api/src/api/controllers/brla.controller.ts index c52f8d607..144c1e3e6 100644 --- a/apps/api/src/api/controllers/brla.controller.ts +++ b/apps/api/src/api/controllers/brla.controller.ts @@ -293,7 +293,7 @@ export const getAveniaUserRemainingLimit = async ( taxIdRecord = await TaxId.findByPk(normalizeTaxId(taxId)); if (!taxIdRecord) { throw new APIError({ - message: "Ramp disabled", + message: "taxId does not match existing records", status: httpStatus.BAD_REQUEST }); } diff --git a/apps/api/src/api/services/avenia-account.ts b/apps/api/src/api/services/avenia-account.ts index ecd650731..491120817 100644 --- a/apps/api/src/api/services/avenia-account.ts +++ b/apps/api/src/api/services/avenia-account.ts @@ -62,7 +62,7 @@ export async function resolveAveniaAccountForRamp(userId: string, providedTaxId? if (providedTaxId && normalizeTaxId(providedTaxId) !== resolved.taxId) { throw new APIError({ - message: "Provided taxId does not match the Avenia profile bound to the authenticated user.", + message: "taxId does not match existing records", status: httpStatus.BAD_REQUEST }); } diff --git a/packages/sdk/src/errors.ts b/packages/sdk/src/errors.ts index 994c0dee8..a73b8f79b 100644 --- a/packages/sdk/src/errors.ts +++ b/packages/sdk/src/errors.ts @@ -185,7 +185,7 @@ export class AlfredpayOnrampKycRequiredError extends AlfredpayOnrampError { } } -function extractErrorStatus(response: Record): number { +function extractErrorStatus(response: Record): number | undefined { for (const key of ["status", "statusCode", "code"]) { const value = response[key]; if (typeof value === "number") { @@ -198,7 +198,7 @@ function extractErrorStatus(response: Record): number { return extractErrorStatus(nestedError as Record); } - return 500; + return undefined; } // Alfredpay Offramp specific errors @@ -429,10 +429,10 @@ function extractErrorMessage(value: unknown): string | undefined { /** * Error parsing utilities */ -export function parseAPIError(response: unknown): VortexSdkError { +export function parseAPIError(response: unknown, fallbackStatus?: number): VortexSdkError { if (response && typeof response === "object") { const { message, error, errors } = response as Record; - const normalizedStatus = extractErrorStatus(response as Record); + const normalizedStatus = extractErrorStatus(response as Record) ?? fallbackStatus ?? 500; const errorMessage = extractErrorMessage(message) ?? extractErrorMessage(error); if (errorMessage) { @@ -561,7 +561,7 @@ export async function handleAPIResponse(response: Response, endpoint: string) throw new APIResponseError(endpoint, response.status, response.statusText); } - throw parseAPIError(errorData); + throw parseAPIError(errorData, response.status); } try { From 92a6254036c8a51f4a087eeeb905905eb99161e4 Mon Sep 17 00:00:00 2001 From: Gianfranco Date: Thu, 2 Jul 2026 19:14:52 -0300 Subject: [PATCH 069/176] restore broken tests after merge --- .../mykobo-eur-offramp.integration.test.ts | 99 +++++++++++----- .../mykobo-eur-onramp.integration.test.ts | 106 +++++++++++++----- 2 files changed, 148 insertions(+), 57 deletions(-) diff --git a/apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts b/apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts index 3303f1d2f..cb94384d7 100644 --- a/apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts +++ b/apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts @@ -1,8 +1,33 @@ -import {describe, expect, it, mock} from "bun:test"; +import { describe, expect, it, mock } from "bun:test"; import fs from "node:fs"; import path from "node:path"; -import {Keyring} from "@polkadot/api"; -import {mnemonicGenerate} from "@polkadot/util-crypto"; +import Big from "big.js"; +import { Keyring } from "@polkadot/api"; +import { mnemonicGenerate } from "@polkadot/util-crypto"; + +// Mock the EVM Nabla swap quote function before importing QuoteService so the +// quote engine does not hit Base RPC for the (currently illiquid) USDC<->EURC pool. +mock.module("../quote/core/nabla", () => { + return { + calculateNablaSwapOutputEvm: async (request: { + inputAmountForSwap: string; + inputTokenDetails: { decimals: number }; + outputTokenDetails: { decimals: number }; + }) => { + console.log("[MOCK] calculateNablaSwapOutputEvm called with", request.inputAmountForSwap); + const decimalOut = new Big(request.inputAmountForSwap).times("0.92"); + const rawOut = decimalOut.times(new Big(10).pow(request.outputTokenDetails.decimals)).toFixed(0, 0); + return { + effectiveExchangeRate: "0.92", + nablaOutputAmountDecimal: decimalOut, + nablaOutputAmountRaw: rawOut + }; + }, + calculateNablaSwapOutput: async () => { + throw new Error("calculateNablaSwapOutput should not be called in EVM-only test"); + } + }; +}); // The Mykobo email is now derived from the user's profile and gated on an APPROVED Mykobo customer // (resolveMykoboCustomerForUser). This contract test focuses on the Mykobo intent/transaction path, @@ -33,12 +58,14 @@ import { RampDirection, RegisterRampRequest } from "@vortexfi/shared"; -import { Transaction, UpdateOptions } from "sequelize"; +import { UpdateOptions } from "sequelize"; import QuoteTicket, { QuoteTicketAttributes, QuoteTicketCreationAttributes } from "../../../models/quoteTicket.model"; import RampState, { RampStateAttributes, RampStateCreationAttributes } from "../../../models/rampState.model"; import RampRecoveryWorker from "../../workers/ramp-recovery.worker"; import { QuoteService } from "../quote"; import { RampService } from "../ramp/ramp.service"; +import registerPhaseHandlers from "./register-handlers"; +import { StateMetadata } from "./meta-state-types"; const EVM_TESTING_ADDRESS = "0x30a300612ab372CC73e53ffE87fB73d62Ed68Da3"; const EVM_DESTINATION_ADDRESS = "0x7ba99e99bc669b3508aff9cc0a898e869459f877"; @@ -248,35 +275,21 @@ describe("Mykobo EUR offramp contract test (real sandbox, no on-chain submission expect(Number(quoteTicket.metadata.nablaSwapEvm?.outputAmountDecimal)).toBeGreaterThan(0); }); - it("rejects Base USDC->EUR offramp registration while EUR ramps are disabled", async () => { - const rampService = new RampService() as RampService & { - withTransaction: (callback: (transaction: Transaction) => Promise) => Promise; - }; - rampService.withTransaction = async callback => callback({} as Transaction); - - quoteTicket = { - apiKey: null, - countryCode: null, - createdAt: new Date(), - expiresAt: new Date(Date.now() + 10 * 60 * 1000), - flowVariant: config.flowVariant, + it("registers a Base+USDC ramp and prepares the Mykobo phase set (no squid, no broadcast)", async () => { + const rampService = new RampService(); + const quoteService = new QuoteService(); + + registerPhaseHandlers(); + + const quote = await quoteService.createQuote({ from: Networks.Base as DestinationType, - id: "test-disabled-eur-offramp-quote-id", inputAmount: TEST_INPUT_AMOUNT, inputCurrency: EvmToken.USDC, - metadata: {}, network: Networks.Base, - outputAmount: "32.20", outputCurrency: FiatToken.EURC, - partnerId: null, - paymentMethod: EPaymentMethod.SEPA, - pricingPartnerId: null, rampType: RampDirection.SELL, - status: "pending", - to: EPaymentMethod.SEPA as DestinationType, - updatedAt: new Date(), - userId: null - } as QuoteTicket; + to: EPaymentMethod.SEPA as DestinationType + }); const additionalData: RegisterRampRequest["additionalData"] = { destinationAddress: EVM_DESTINATION_ADDRESS, @@ -295,5 +308,35 @@ describe("Mykobo EUR offramp contract test (real sandbox, no on-chain submission if (!registered.unsignedTxs) { throw new Error("Expected registerRamp to return unsigned transactions"); } + + const phases = registered.unsignedTxs.map(tx => tx.phase); + console.log("Prepared phases:", phases); + + expect(phases).not.toContain("squidRouterApprove"); + expect(phases).not.toContain("squidRouterSwap"); + expect(phases).toContain("nablaApprove"); + expect(phases).toContain("nablaSwap"); + expect(phases).toContain("mykoboPayoutOnBase"); + expect(phases).toContain("baseCleanupUsdc"); + expect(phases).toContain("baseCleanupEurc"); + expect(phases).toContain("baseCleanupAxlUsdc"); + + const state = rampState.state as StateMetadata; + expect(state.mykoboEmail).toBe(TEST_EMAIL); + expect(state.mykoboTransactionId).toBeTruthy(); + expect(state.mykoboReceivablesAddress).toMatch(EVM_ADDRESS_REGEX); + expect(state.mykoboTransactionReference).toBeTruthy(); + expect(state.evmEphemeralAddress).toBe(testSigningAccounts.EVM.address); + console.log("StateMeta (Mykobo fields):", { + mykoboEmail: state.mykoboEmail, + mykoboReceivablesAddress: state.mykoboReceivablesAddress, + mykoboTransactionId: state.mykoboTransactionId, + mykoboTransactionReference: state.mykoboTransactionReference + }); + + const payoutTx = registered.unsignedTxs.find(tx => tx.phase === "mykoboPayoutOnBase"); + expect(payoutTx).toBeDefined(); + expect(payoutTx?.signer).toBe(testSigningAccounts.EVM.address); + expect(payoutTx?.network).toBe(Networks.Base); }); -}); +}); \ No newline at end of file diff --git a/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts b/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts index 99bcd6263..02888b0cc 100644 --- a/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts +++ b/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts @@ -1,9 +1,33 @@ -import {describe, expect, it, mock} from "bun:test"; +import { describe, expect, it, mock } from "bun:test"; import fs from "node:fs"; import path from "node:path"; -import {Keyring} from "@polkadot/api"; -import {mnemonicGenerate} from "@polkadot/util-crypto"; - +import Big from "big.js"; +import { Keyring } from "@polkadot/api"; +import { mnemonicGenerate } from "@polkadot/util-crypto"; + +// Mock the EVM Nabla swap quote function before importing QuoteService so the +// quote engine does not hit Base RPC for the (currently illiquid) EURC<->USDC pool. +mock.module("../quote/core/nabla", () => { + return { + calculateNablaSwapOutputEvm: async (request: { + inputAmountForSwap: string; + inputTokenDetails: { decimals: number }; + outputTokenDetails: { decimals: number }; + }) => { + console.log("[MOCK] calculateNablaSwapOutputEvm called with", request.inputAmountForSwap); + const decimalOut = new Big(request.inputAmountForSwap).times("1.05"); + const rawOut = decimalOut.times(new Big(10).pow(request.outputTokenDetails.decimals)).toFixed(0, 0); + return { + effectiveExchangeRate: "1.05", + nablaOutputAmountDecimal: decimalOut, + nablaOutputAmountRaw: rawOut + }; + }, + calculateNablaSwapOutput: async () => { + throw new Error("calculateNablaSwapOutput should not be called in EVM-only test"); + } + }; +}); // The Mykobo email is now derived from the user's profile and gated on an APPROVED Mykobo customer // (resolveMykoboCustomerForUser). This contract test focuses on the Mykobo intent/transaction path, @@ -22,6 +46,7 @@ import { EphemeralAccountType, EvmToken, FiatToken, + IbanPaymentData, MYKOBO_ACCESS_KEY, MYKOBO_BASE_URL, MYKOBO_SECRET_KEY, @@ -34,12 +59,14 @@ import { RampDirection, RegisterRampRequest } from "@vortexfi/shared"; -import { Transaction, UpdateOptions } from "sequelize"; +import { UpdateOptions } from "sequelize"; import QuoteTicket, { QuoteTicketAttributes, QuoteTicketCreationAttributes } from "../../../models/quoteTicket.model"; import RampState, { RampStateAttributes, RampStateCreationAttributes } from "../../../models/rampState.model"; import RampRecoveryWorker from "../../workers/ramp-recovery.worker"; import { QuoteService } from "../quote"; import { RampService } from "../ramp/ramp.service"; +import registerPhaseHandlers from "./register-handlers"; +import { StateMetadata } from "./meta-state-types"; const EVM_TESTING_ADDRESS = "0x30a300612ab372CC73e53ffE87fB73d62Ed68Da3"; const EVM_DESTINATION_ADDRESS = "0x7ba99e99bc669b3508aff9cc0a898e869459f877"; @@ -249,35 +276,21 @@ describe("Mykobo EUR onramp contract test (real sandbox, no on-chain submission) expect(Number(quoteTicket.metadata.mykoboMint?.outputAmountRaw)).toBeGreaterThan(0); }); - it("rejects EUR->Base USDC onramp registration while EUR ramps are disabled", async () => { - const rampService = new RampService() as RampService & { - withTransaction: (callback: (transaction: Transaction) => Promise) => Promise; - }; - rampService.withTransaction = async callback => callback({} as Transaction); - - quoteTicket = { - apiKey: null, - countryCode: null, - createdAt: new Date(), - expiresAt: new Date(Date.now() + 10 * 60 * 1000), - flowVariant: config.flowVariant, + it("registers a EUR->Base USDC onramp and prepares the Mykobo phase set (no squid, no broadcast)", async () => { + const rampService = new RampService(); + const quoteService = new QuoteService(); + + registerPhaseHandlers(); + + const quote = await quoteService.createQuote({ from: EPaymentMethod.SEPA as DestinationType, - id: "test-disabled-eur-onramp-quote-id", inputAmount: TEST_INPUT_AMOUNT, inputCurrency: FiatToken.EURC, - metadata: {}, network: Networks.Base, - outputAmount: "36.75", outputCurrency: EvmToken.USDC, - partnerId: null, - paymentMethod: EPaymentMethod.SEPA, - pricingPartnerId: null, rampType: RampDirection.BUY, - status: "pending", - to: Networks.Base as DestinationType, - updatedAt: new Date(), - userId: null - } as QuoteTicket; + to: Networks.Base as DestinationType + }); const additionalData: RegisterRampRequest["additionalData"] = { destinationAddress: EVM_DESTINATION_ADDRESS, @@ -296,5 +309,40 @@ describe("Mykobo EUR onramp contract test (real sandbox, no on-chain submission) if (!registered.unsignedTxs) { throw new Error("Expected registerRamp to return unsigned transactions"); } + + const phases = registered.unsignedTxs.map(tx => tx.phase); + console.log("Prepared phases:", phases); + + expect(phases).not.toContain("squidRouterApprove"); + expect(phases).not.toContain("squidRouterSwap"); + expect(phases).toContain("nablaApprove"); + expect(phases).toContain("nablaSwap"); + expect(phases).toContain("destinationTransfer"); + expect(phases).toContain("baseCleanupEurc"); + expect(phases).toContain("baseCleanupUsdc"); + + const state = rampState.state as StateMetadata; + expect(state.mykoboEmail).toBe(TEST_EMAIL); + expect(state.mykoboTransactionId).toBeTruthy(); + expect(state.mykoboTransactionReference).toBeTruthy(); + expect(state.evmEphemeralAddress).toBe(testSigningAccounts.EVM.address); + + const ibanPaymentData = (rampState.state as StateMetadata & { ibanPaymentData?: IbanPaymentData }).ibanPaymentData; + expect(ibanPaymentData).toBeDefined(); + expect(ibanPaymentData?.iban).toMatch(IBAN_REGEX); + expect(ibanPaymentData?.receiverName).toBeTruthy(); + expect(ibanPaymentData?.reference).toBe(state.mykoboTransactionReference); + + console.log("StateMeta (Mykobo fields):", { + ibanPaymentData, + mykoboEmail: state.mykoboEmail, + mykoboTransactionId: state.mykoboTransactionId, + mykoboTransactionReference: state.mykoboTransactionReference + }); + + const destinationTx = registered.unsignedTxs.find(tx => tx.phase === "destinationTransfer"); + expect(destinationTx).toBeDefined(); + expect(destinationTx?.signer).toBe(testSigningAccounts.EVM.address); + expect(destinationTx?.network).toBe(Networks.Base); }); -}); +}); \ No newline at end of file From 379e51b951bc462839d7f1253dd20039819a1158 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Fri, 3 Jul 2026 10:47:44 +0200 Subject: [PATCH 070/176] Add evaluated USDC to BRLA amount selection logic and related tests --- apps/rebalancer/.env.example | 2 +- apps/rebalancer/README.md | 7 ++-- apps/rebalancer/src/index.ts | 28 +++++++-------- .../usdc-brla-usdc-base/amountPolicy.test.ts | 34 +++++++++++++++++-- .../usdc-brla-usdc-base/amountPolicy.ts | 21 ++++++++++-- apps/rebalancer/src/utils/config.ts | 2 +- .../security-spec/07-operations/rebalancer.md | 8 ++--- 7 files changed, 75 insertions(+), 27 deletions(-) diff --git a/apps/rebalancer/.env.example b/apps/rebalancer/.env.example index e714449cb..9c79b66f1 100644 --- a/apps/rebalancer/.env.example +++ b/apps/rebalancer/.env.example @@ -11,7 +11,7 @@ BRLA_LOGIN_PASSWORD=your_password_here SLACK_WEB_HOOK_TOKEN=your_slack_webhook_token_here REBALANCING_USD_TO_BRL_AMOUNT=100 -# Larger USDC amount used for USDC→BRLA→USDC when the standard amount is projected profitable. +# Larger USDC amount evaluated for USDC→BRLA→USDC and used when that larger quote is projected profitable. REBALANCING_PROFITABLE_USD_TO_BRL_AMOUNT=200 SUPABASE_URL=your_supabase_url_here diff --git a/apps/rebalancer/README.md b/apps/rebalancer/README.md index ac699f628..d03276c98 100644 --- a/apps/rebalancer/README.md +++ b/apps/rebalancer/README.md @@ -21,9 +21,10 @@ PENDULUM_ACCOUNT_SECRET=xxx For Base rebalancing, the in-range opportunistic USDC→BRLA→USDC trigger is controlled by `REBALANCING_OPPORTUNISTIC_USDC_TO_BRLA_MAX_COST_BPS` and defaults to `10` bps when unset. -USDC→BRLA→USDC runs use `REBALANCING_USD_TO_BRL_AMOUNT` by default. If that standard amount is projected -profitable, the rebalancer evaluates `REBALANCING_PROFITABLE_USD_TO_BRL_AMOUNT` with fresh quotes and uses it only if -the larger amount is also projected profitable. When unset, it defaults to the standard amount. +USDC→BRLA→USDC runs quote `REBALANCING_USD_TO_BRL_AMOUNT` by default. When +`REBALANCING_PROFITABLE_USD_TO_BRL_AMOUNT` is set to a different value, the rebalancer also evaluates that larger +amount with fresh quotes and uses it only if the larger amount is projected profitable. When unset, it defaults to the +standard amount. `REBALANCING_DAILY_BRIDGE_LIMIT_USD` caps paid Base rebalances only: projected-profitable current runs bypass the cap, but all completed Base runs are recorded in history and count toward later paid-run limit checks. diff --git a/apps/rebalancer/src/index.ts b/apps/rebalancer/src/index.ts index b1f0c9720..d1dd301e8 100644 --- a/apps/rebalancer/src/index.ts +++ b/apps/rebalancer/src/index.ts @@ -6,7 +6,7 @@ import { checkInitialPendulumBalance } from "./rebalance/brla-to-axlusdc/steps.t import { rebalanceBrlaToUsdcBase } from "./rebalance/brla-to-usdc-base"; import { quoteBrlaToUsdcBaseRebalance } from "./rebalance/brla-to-usdc-base/steps.ts"; import { rebalanceUsdcBrlaUsdcBase } from "./rebalance/usdc-brla-usdc-base"; -import { selectUsdcToBrlaAmount } from "./rebalance/usdc-brla-usdc-base/amountPolicy.ts"; +import { selectEvaluatedUsdcToBrlaAmount, selectUsdcToBrlaAmount } from "./rebalance/usdc-brla-usdc-base/amountPolicy.ts"; import { evaluatePaidRunDailyLimit, sumTodayBridgedUsdRaw } from "./rebalance/usdc-brla-usdc-base/dailyLimit.ts"; import { type DailyBridgeLimitDecision, @@ -295,31 +295,31 @@ async function selectUsdcToBrlaPolicyAmount(coverageDeviationBps: number): Promi const standardAmountRaw = toUsdcRaw(standardAmountSelection.amountUsdc); const standardPolicyDecision = await evaluateUsdcToBrlaPolicy(standardAmountRaw, coverageDeviationBps); - const profitableAmountSelection = selectUsdcToBrlaAmount( - config.rebalancingUsdToBrlAmount, - config.rebalancingProfitableUsdToBrlAmount, - standardPolicyDecision.profitable, - manualAmount - ); - - if (profitableAmountSelection.reason !== "profitable") { + if (standardAmountSelection.reason === "manual") { return { amountUsdcRaw: standardAmountRaw, policyDecision: standardPolicyDecision }; } - const profitableAmountRaw = toUsdcRaw(profitableAmountSelection.amountUsdc); + const profitableAmountRaw = toUsdcRaw(config.rebalancingProfitableUsdToBrlAmount); if (profitableAmountRaw === standardAmountRaw) { return { amountUsdcRaw: standardAmountRaw, policyDecision: standardPolicyDecision }; } console.log( - `Standard USDC->BRLA rebalance amount ${standardAmountSelection.amountUsdc} USDC is projected profitable. ` + - `Evaluating profitable amount ${profitableAmountSelection.amountUsdc} USDC.` + `Evaluating USDC->BRLA rebalance amounts independently: standard ${standardAmountSelection.amountUsdc} USDC, ` + + `profitable ${config.rebalancingProfitableUsdToBrlAmount} USDC.` ); const profitablePolicyDecision = await evaluateUsdcToBrlaPolicy(profitableAmountRaw, coverageDeviationBps); - if (!profitablePolicyDecision.profitable) { + + const selectedAmount = selectEvaluatedUsdcToBrlaAmount( + { amountUsdc: standardAmountSelection.amountUsdc, projectedProfitable: standardPolicyDecision.profitable }, + { amountUsdc: config.rebalancingProfitableUsdToBrlAmount, projectedProfitable: profitablePolicyDecision.profitable }, + manualAmount + ); + + if (selectedAmount.reason !== "profitable") { console.log( - `Configured profitable amount ${profitableAmountSelection.amountUsdc} USDC is not projected profitable. ` + + `Configured profitable amount ${config.rebalancingProfitableUsdToBrlAmount} USDC is not projected profitable. ` + `Using standard amount ${standardAmountSelection.amountUsdc} USDC.` ); return { amountUsdcRaw: standardAmountRaw, policyDecision: standardPolicyDecision }; diff --git a/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/amountPolicy.test.ts b/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/amountPolicy.test.ts index 814b03fe4..0e2a3e5c8 100644 --- a/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/amountPolicy.test.ts +++ b/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/amountPolicy.test.ts @@ -1,5 +1,5 @@ import {describe, expect, test} from "bun:test"; -import {selectUsdcToBrlaAmount} from "./amountPolicy.ts"; +import {selectEvaluatedUsdcToBrlaAmount, selectUsdcToBrlaAmount} from "./amountPolicy.ts"; describe("USDC to BRLA amount policy", () => { test("uses the standard amount when the projection is not profitable", () => { @@ -9,7 +9,7 @@ describe("USDC to BRLA amount policy", () => { }); }); - test("uses the profitable amount when the standard projection is profitable", () => { + test("uses the profitable amount when the profitable amount projection is profitable", () => { expect(selectUsdcToBrlaAmount("1000", "2000", true, null)).toEqual({ amountUsdc: "2000", reason: "profitable" @@ -22,4 +22,34 @@ describe("USDC to BRLA amount policy", () => { reason: "manual" }); }); + + test("selects the larger evaluated amount even when the standard amount is not profitable", () => { + expect( + selectEvaluatedUsdcToBrlaAmount( + { amountUsdc: "1000", projectedProfitable: false }, + { amountUsdc: "2000", projectedProfitable: true }, + null + ) + ).toEqual({ amountUsdc: "2000", reason: "profitable" }); + }); + + test("falls back to the standard evaluated amount when the larger amount is not profitable", () => { + expect( + selectEvaluatedUsdcToBrlaAmount( + { amountUsdc: "1000", projectedProfitable: true }, + { amountUsdc: "2000", projectedProfitable: false }, + null + ) + ).toEqual({ amountUsdc: "1000", reason: "standard" }); + }); + + test("keeps manual amounts explicit after evaluating both configured amounts", () => { + expect( + selectEvaluatedUsdcToBrlaAmount( + { amountUsdc: "1000", projectedProfitable: false }, + { amountUsdc: "2000", projectedProfitable: true }, + "750" + ) + ).toEqual({ amountUsdc: "750", reason: "manual" }); + }); }); diff --git a/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/amountPolicy.ts b/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/amountPolicy.ts index 29e596ec8..2803fc02e 100644 --- a/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/amountPolicy.ts +++ b/apps/rebalancer/src/rebalance/usdc-brla-usdc-base/amountPolicy.ts @@ -3,15 +3,32 @@ export interface UsdcToBrlaAmountSelection { reason: "manual" | "standard" | "profitable"; } +export interface EvaluatedUsdcToBrlaAmount { + amountUsdc: string; + projectedProfitable: boolean; +} + export function selectUsdcToBrlaAmount( standardAmount: string, profitableAmount: string, - isProjectedProfitable: boolean, + isProfitableAmountProjectedProfitable: boolean, manualAmount: string | null ): UsdcToBrlaAmountSelection { if (manualAmount) return { amountUsdc: manualAmount, reason: "manual" }; - if (isProjectedProfitable) return { amountUsdc: profitableAmount, reason: "profitable" }; + if (isProfitableAmountProjectedProfitable) return { amountUsdc: profitableAmount, reason: "profitable" }; return { amountUsdc: standardAmount, reason: "standard" }; } + +export function selectEvaluatedUsdcToBrlaAmount( + standard: EvaluatedUsdcToBrlaAmount, + profitable: EvaluatedUsdcToBrlaAmount, + manualAmount: string | null +): UsdcToBrlaAmountSelection { + if (manualAmount) return { amountUsdc: manualAmount, reason: "manual" }; + + if (profitable.projectedProfitable) return { amountUsdc: profitable.amountUsdc, reason: "profitable" }; + + return { amountUsdc: standard.amountUsdc, reason: "standard" }; +} diff --git a/apps/rebalancer/src/utils/config.ts b/apps/rebalancer/src/utils/config.ts index 7a5fb1aef..32fb80822 100644 --- a/apps/rebalancer/src/utils/config.ts +++ b/apps/rebalancer/src/utils/config.ts @@ -105,7 +105,7 @@ export function getConfig() { rebalancingBrlToUsdMinBalance: process.env.REBALANCING_BRL_TO_USD_MIN_BALANCE || undefined, rebalancingCostPolicy: getRebalancingCostPolicyConfig(), rebalancingDailyBridgeLimitUsd: parseRebalancingDailyBridgeLimitUsd(), - /// The larger USDC amount to use for USDC→BRLA→USDC runs when the standard amount is projected profitable. + /// The larger USDC amount to evaluate for USDC→BRLA→USDC runs and use when that larger amount is projected profitable. rebalancingProfitableUsdToBrlAmount: process.env.REBALANCING_PROFITABLE_USD_TO_BRL_AMOUNT || process.env.REBALANCING_USD_TO_BRL_AMOUNT || "1", diff --git a/docs/security-spec/07-operations/rebalancer.md b/docs/security-spec/07-operations/rebalancer.md index 649cf8f91..9706dc948 100644 --- a/docs/security-spec/07-operations/rebalancer.md +++ b/docs/security-spec/07-operations/rebalancer.md @@ -4,7 +4,7 @@ The rebalancer is a standalone service (`apps/rebalancer/`) that monitors token coverage ratios and automatically moves liquidity across chains when ratios indicate a pool imbalance. Its primary function is ensuring the platform has sufficient tokens to service ramp operations without manual intervention. -The default Base rebalancer is cost-aware. A coverage-ratio breach makes a fresh cron run eligible for evaluation, but execution still depends on the configured urgency band and projected round-trip cost. Mild and moderate imbalances can be skipped when route quotes are unfavorable; severe imbalances tolerate higher configured cost. When coverage is already inside the configured bounds, the USDC → BRLA → USDC flow may still run opportunistically, but only if its projected route cost is below `REBALANCING_OPPORTUNISTIC_USDC_TO_BRLA_MAX_COST_BPS` (default 10 bps). `REBALANCING_HARD_MAX_COST_BPS` remains a hard projected-cost cap in every mode. `REBALANCING_DAILY_BRIDGE_LIMIT_USD` caps non-profitable fresh Base runs, but a quote that projects profit may bypass the daily cap while still being recorded in history after completion. If the standard USDC → BRLA → USDC amount is projected profitable, the flow can evaluate a separately configured profitable amount and execute that larger amount only when its own fresh quote also projects profit. +The default Base rebalancer is cost-aware. A coverage-ratio breach makes a fresh cron run eligible for evaluation, but execution still depends on the configured urgency band and projected round-trip cost. Mild and moderate imbalances can be skipped when route quotes are unfavorable; severe imbalances tolerate higher configured cost. When coverage is already inside the configured bounds, the USDC → BRLA → USDC flow may still run opportunistically, but only if its projected route cost is below `REBALANCING_OPPORTUNISTIC_USDC_TO_BRLA_MAX_COST_BPS` (default 10 bps). `REBALANCING_HARD_MAX_COST_BPS` remains a hard projected-cost cap in every mode. `REBALANCING_DAILY_BRIDGE_LIMIT_USD` caps non-profitable fresh Base runs, but a quote that projects profit may bypass the daily cap while still being recorded in history after completion. When a separate profitable USDC → BRLA → USDC amount is configured, the flow evaluates that larger amount with its own fresh quotes and executes it only when that larger quote projects profit. **Current implementation:** Three rebalancing paths: @@ -41,7 +41,7 @@ bun run start [amount] [--legacy] [--restart] [--route=squidrouter|avenia|nabla- - `REBALANCING_MAX_COST_BPS_MILD` / `REBALANCING_MAX_COST_BPS_MODERATE` / `REBALANCING_MAX_COST_BPS_SEVERE` — maximum projected round-trip cost per urgency band. - `REBALANCING_HARD_MAX_COST_BPS` — final projected-cost ceiling enforced even in `always` mode. - `REBALANCING_OPPORTUNISTIC_USDC_TO_BRLA_MAX_COST_BPS` — maximum projected route cost for in-range opportunistic USDC → BRLA → USDC execution (default 10 bps). -- `REBALANCING_USD_TO_BRL_AMOUNT` / `REBALANCING_PROFITABLE_USD_TO_BRL_AMOUNT` — standard and projected-profitable USDC → BRLA → USDC sizing. The profitable amount defaults to the standard amount when unset and is only used after a fresh quote for that larger size still projects profit. +- `REBALANCING_USD_TO_BRL_AMOUNT` / `REBALANCING_PROFITABLE_USD_TO_BRL_AMOUNT` — standard and projected-profitable USDC → BRLA → USDC sizing. The profitable amount defaults to the standard amount when unset and is used only when a fresh quote for that larger size projects profit. --- @@ -67,7 +67,7 @@ bun run start [amount] [--legacy] [--restart] [--route=squidrouter|avenia|nabla- **Daily bridge limit:** Total requested USDC amount recorded by Base-flow history per calendar day (UTC), including the amount about to be rebalanced, must not exceed `REBALANCING_DAILY_BRIDGE_LIMIT_USD` (default 10,000) for paid current runs. Profit is inferred from projected output USDC greater than input USDC, which also yields negative projected cost bps. Projected-profitable current runs bypass the cap entirely. For paid runs, the limit decision is checked against both `UsdcBaseStateManager` and `BrlaToUsdcBaseStateManager` history after quote/cost-policy evaluation and before any fresh Base state write or transaction. Completed profitable runs still write normal history entries, so they remain visible in later paid-run daily accounting. -**Urgency-band policy:** Before any state write or transaction, the flow quotes the expected round-trip USDC output. Projected cost is `(input USDC - projected output USDC) / input USDC` in basis points. `auto` mode executes only when the projected cost is within the configured limit for the current coverage-deviation band. `dry-run` logs the same decision but never starts a rebalance. `off` skips without quoting. `always` can execute above the band limit, but not above `REBALANCING_HARD_MAX_COST_BPS`; the daily bridge limit still applies unless the quote projects profit. When the standard amount projects profit, the profitable amount is re-quoted separately; stale standard-amount quotes must not be reused for larger execution. +**Urgency-band policy:** Before any state write or transaction, the flow quotes the expected round-trip USDC output. Projected cost is `(input USDC - projected output USDC) / input USDC` in basis points. `auto` mode executes only when the projected cost is within the configured limit for the current coverage-deviation band. `dry-run` logs the same decision but never starts a rebalance. `off` skips without quoting. `always` can execute above the band limit, but not above `REBALANCING_HARD_MAX_COST_BPS`; the daily bridge limit still applies unless the quote projects profit. Standard and profitable configured amounts are quoted independently when they differ; stale standard-amount quotes must not be reused for larger execution. **Rebalancing flow:** 1. Check initial USDC balance on Base (sufficient for requested amount) @@ -155,7 +155,7 @@ bun run start [amount] [--legacy] [--restart] [--route=squidrouter|avenia|nabla- 14. **Mild/moderate imbalances MUST be skippable when cost exceeds tolerance** — In `auto` mode, fresh Base rebalances must skip when projected round-trip cost exceeds the configured limit for the current band. 15. **Opportunistic in-range rebalances MUST stay below the configured projected-cost cap** — When coverage is already inside `[lowerBound, upperBound]`, only USDC → BRLA → USDC may run opportunistically. It must use the normal cost-policy quote, daily-limit/profit decision, Base USDC balance check, route selection, hard max-cost cap, and state machine; it must skip when projected route cost is greater than or equal to `REBALANCING_OPPORTUNISTIC_USDC_TO_BRLA_MAX_COST_BPS` (default 10 bps). If an opportunistic Avenia route later falls back to SquidRouter, the preflight SquidRouter quote must independently satisfy the normal cost policy, the configured opportunistic cap, and the profitable-quote requirement when the original current quote skipped the daily bridge limit because it was projected profitable. 16. **Severe imbalances MAY use higher tolerance but MUST NOT bypass hard cost caps** — Severe band can permit higher projected cost, but it cannot bypass `REBALANCING_HARD_MAX_COST_BPS`, balance checks, slippage limits, or phase safety checks. It also cannot bypass the daily bridge limit unless the selected quote projects profit. -17. **Profitable-size execution MUST use matching fresh quotes** — The high-coverage flow may switch from `REBALANCING_USD_TO_BRL_AMOUNT` to `REBALANCING_PROFITABLE_USD_TO_BRL_AMOUNT` only after the standard amount projects profit and the profitable amount's own quote also projects profit. Manual CLI amounts bypass this automatic up-sizing. +17. **Profitable-size execution MUST use matching fresh quotes** — The high-coverage flow may switch from `REBALANCING_USD_TO_BRL_AMOUNT` to `REBALANCING_PROFITABLE_USD_TO_BRL_AMOUNT` only after the profitable amount's own quote projects profit. It must not infer larger-size profitability, route selection, or daily-limit bypass from the standard amount's quote. Manual CLI amounts bypass this automatic up-sizing. 18. **Route comparison MUST handle provider failures gracefully** — If every enabled return route quote fails, the high-coverage flow MUST abort (not proceed with zero information). If some routes fail, the best available route is used. If `--route=` is specified, that route is still quoted and cost-gated before execution. 19. **Avenia fallback to SquidRouter MUST be atomic in state** — If Avenia ticket creation fails, the flow sets `winningRoute = "squidrouter"` and `currentPhase = AveniaTransferToPolygon` in a single `saveState()` call. A crash between the failure and the save could leave the flow in an inconsistent state. 20. **NonceManager MUST be re-initialized on resume** — The `NonceManager` is created fresh at the start of each execution from `getTransactionCount()`. On resume, it must not reuse stale nonces from a previous execution. From ddda5143595bb5764c670555b0e5e35dec9db096 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Fri, 3 Jul 2026 10:59:35 +0200 Subject: [PATCH 071/176] fix(auth): re-pad base64url before decoding JWT expiry atob can throw on unpadded base64url payloads; convert to base64 and re-pad so access-token expiry decoding is reliable. Addresses PR #1240 review feedback. --- apps/frontend/src/services/auth.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/frontend/src/services/auth.ts b/apps/frontend/src/services/auth.ts index 2eb9e5258..145135db4 100644 --- a/apps/frontend/src/services/auth.ts +++ b/apps/frontend/src/services/auth.ts @@ -86,7 +86,10 @@ export class AuthService { if (!payload) { return null; } - const decoded = JSON.parse(atob(payload.replace(/-/g, "+").replace(/_/g, "/"))) as { exp?: number }; + // JWT segments are base64url and usually unpadded; convert to base64 and re-pad before decoding. + const base64 = payload.replace(/-/g, "+").replace(/_/g, "/"); + const padded = base64.padEnd(base64.length + ((4 - (base64.length % 4)) % 4), "="); + const decoded = JSON.parse(atob(padded)) as { exp?: number }; return typeof decoded.exp === "number" ? decoded.exp * 1000 : null; } catch { return null; From c773bc18b118c7f9af1f85bd98e8c8715f393c2e Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Fri, 3 Jul 2026 10:59:45 +0200 Subject: [PATCH 072/176] fix(auth): keep token refresh loop alive when expiry is undecodable If getAccessTokenExpiryMs() returns null the scheduler previously exited without rescheduling, permanently disabling the app-root refresh loop. Retry after a short delay so a later decodable token re-establishes it. Addresses PR #1240 review feedback. --- apps/frontend/src/contexts/rampState.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/frontend/src/contexts/rampState.tsx b/apps/frontend/src/contexts/rampState.tsx index 3e1c048dc..566ef1fcd 100644 --- a/apps/frontend/src/contexts/rampState.tsx +++ b/apps/frontend/src/contexts/rampState.tsx @@ -156,10 +156,13 @@ const TokenRefreshEffect = () => { const scheduleNext = () => { const expiryMs = AuthService.getAccessTokenExpiryMs(); + // If the expiry can't be decoded, don't kill the loop permanently — retry shortly so a + // later (decodable) token re-establishes the schedule. + const delay = expiryMs === null ? TOKEN_REFRESH_RETRY_MS : Math.max(expiryMs - Date.now() - TOKEN_REFRESH_SKEW_MS, 0); if (expiryMs === null) { + timer = setTimeout(scheduleNext, delay); return; } - const delay = Math.max(expiryMs - Date.now() - TOKEN_REFRESH_SKEW_MS, 0); timer = setTimeout(async () => { if (cancelled) return; try { From 2ddd5c0ef2148a43211cbc7e1bb0ab6ec357e8c4 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Fri, 3 Jul 2026 10:59:53 +0200 Subject: [PATCH 073/176] refactor(auth): drop redundant session teardown in refresh actor refreshAccessToken() already clears the stored session on a confirmed 401, so clearing again in checkAndRefreshTokenActor duplicated the teardown. Keep session-teardown ownership in one place. Addresses PR #1240 review feedback. --- apps/frontend/src/machines/ramp.actors.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/frontend/src/machines/ramp.actors.ts b/apps/frontend/src/machines/ramp.actors.ts index c60acf166..e50e6f601 100644 --- a/apps/frontend/src/machines/ramp.actors.ts +++ b/apps/frontend/src/machines/ramp.actors.ts @@ -78,8 +78,8 @@ export async function checkAndRefreshTokenActor() { if (refreshedTokens) { return { success: true, tokens: refreshedTokens }; } - // A null result means the refresh token is confirmed invalid: the session is dead. - AuthService.clearTokens(); + // A null result means the refresh token was confirmed invalid; refreshAccessToken() + // has already cleared the stored session, so we just report failure here. return { success: false, tokens: null }; } catch { // Transient refresh failure (network/5xx): keep the session rather than forcing a From 45a42ed764ab5536b1ea620b2a38401cc63780c4 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Fri, 3 Jul 2026 11:05:26 +0200 Subject: [PATCH 074/176] fix(auth): return 503 not 401 for transient refresh failures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /v1/auth/refresh previously caught every error and returned 401, so a Supabase outage or 5xx looked identical to a revoked refresh token and forced users to log out — defeating the frontend's fail-open design. Classify the Supabase error: a definite 4xx auth error means the refresh token is invalid (401); retryable-fetch/5xx/transport errors and any unexpected error return 503 so the frontend keeps the session and retries. Update the security spec's invariant, flow, and audit item. Addresses the transient-failure gap in PR #1240. --- .../src/api/controllers/auth.controller.ts | 15 ++++++++-- apps/api/src/api/services/auth/index.ts | 2 +- .../src/api/services/auth/supabase.service.ts | 30 +++++++++++++++++-- docs/security-spec/01-auth/supabase-otp.md | 5 ++-- 4 files changed, 43 insertions(+), 9 deletions(-) diff --git a/apps/api/src/api/controllers/auth.controller.ts b/apps/api/src/api/controllers/auth.controller.ts index 64e6f6c01..b3ab0de36 100644 --- a/apps/api/src/api/controllers/auth.controller.ts +++ b/apps/api/src/api/controllers/auth.controller.ts @@ -1,7 +1,7 @@ import { Request, Response } from "express"; import logger from "../../config/logger"; import User from "../../models/user.model"; -import { SupabaseAuthService } from "../services/auth"; +import { RefreshTokenError, SupabaseAuthService } from "../services/auth"; export class AuthController { /** @@ -124,9 +124,18 @@ export class AuthController { success: true }); } catch (error) { + // Only a confirmed-invalid refresh token yields a 401 (which the frontend treats as a + // definitive logout). Transient failures — and anything unexpected — return 503 so the + // frontend keeps the session and retries instead of forcing re-login. + if (error instanceof RefreshTokenError && !error.transient) { + return res.status(401).json({ + error: "Invalid refresh token" + }); + } + logger.error("Error in refreshToken:", error); - return res.status(401).json({ - error: "Invalid refresh token" + return res.status(503).json({ + error: "Auth service temporarily unavailable" }); } } diff --git a/apps/api/src/api/services/auth/index.ts b/apps/api/src/api/services/auth/index.ts index 5f6ff90ae..91db21e5e 100644 --- a/apps/api/src/api/services/auth/index.ts +++ b/apps/api/src/api/services/auth/index.ts @@ -1 +1 @@ -export { SupabaseAuthService } from "./supabase.service"; +export { RefreshTokenError, SupabaseAuthService } from "./supabase.service"; diff --git a/apps/api/src/api/services/auth/supabase.service.ts b/apps/api/src/api/services/auth/supabase.service.ts index 66e0d5710..747806ce1 100644 --- a/apps/api/src/api/services/auth/supabase.service.ts +++ b/apps/api/src/api/services/auth/supabase.service.ts @@ -1,7 +1,22 @@ -import type { User } from "@supabase/supabase-js"; +import { isAuthRetryableFetchError, type User } from "@supabase/supabase-js"; import logger from "../../../config/logger"; import { supabase, supabaseAdmin } from "../../../config/supabase"; +/** + * Thrown by `refreshToken` to distinguish a confirmed-invalid refresh token (the session is + * over) from a transient failure (Supabase unreachable / 5xx). Callers must only end the + * session on `transient === false`; transient failures are retryable. + */ +export class RefreshTokenError extends Error { + constructor( + message: string, + readonly transient: boolean + ) { + super(message); + this.name = this.constructor.name; + } +} + // Supported BCP 47 locale values and their canonical forms. // The Supabase email templates branch on `.Data.locale` using these values. const LOCALE_MAP: Record = { @@ -170,8 +185,17 @@ export class SupabaseAuthService { refresh_token: refreshToken }); - if (error || !data.session) { - throw new Error("Failed to refresh token"); + if (error) { + // Network/transport failures and upstream 5xx are transient: the refresh token may still + // be valid, so callers must retry rather than tear down the session. Only a definite 4xx + // auth error means the refresh token itself is invalid/revoked. + const status = error.status ?? 0; + const transient = isAuthRetryableFetchError(error) || status === 0 || status >= 500; + throw new RefreshTokenError(error.message, transient); + } + + if (!data.session) { + throw new RefreshTokenError("No session returned from refresh", false); } return { diff --git a/docs/security-spec/01-auth/supabase-otp.md b/docs/security-spec/01-auth/supabase-otp.md index 7c10ae469..62888870a 100644 --- a/docs/security-spec/01-auth/supabase-otp.md +++ b/docs/security-spec/01-auth/supabase-otp.md @@ -10,7 +10,7 @@ The flow: 3. Supabase verifies OTP and issues a JWT access token 4. Frontend includes JWT in `Authorization: Bearer ` header on API requests 5. API middleware (`supabaseAuth.ts`) verifies the JWT via `SupabaseAuthService.verifyToken()` and attaches `userId` to the request -6. Access tokens are short-lived. The frontend refreshes them via `POST /v1/auth/refresh` (`SupabaseAuthService.refreshToken()` → Supabase `refreshSession`), scheduled just before expiry and also triggered on a `401` (single-flight refresh + one retry). The frontend never calls Supabase `refreshSession` directly with the anon key. +6. Access tokens are short-lived. The frontend refreshes them via `POST /v1/auth/refresh` (`SupabaseAuthService.refreshToken()` → Supabase `refreshSession`), scheduled just before expiry and also triggered on a `401` (single-flight refresh + one retry). The frontend never calls Supabase `refreshSession` directly with the anon key. The endpoint returns `401` **only** when the refresh token is confirmed invalid/revoked; transient upstream failures (Supabase unreachable / 5xx) return `503` so the frontend keeps the session and retries. Two middleware variants exist: - **`requireAuth`** — Returns 401 if token is missing or invalid. Used on protected endpoints. @@ -26,7 +26,7 @@ Two middleware variants exist: 6. **Auth errors MUST NOT leak token content** — Error responses must use generic messages ("Invalid or expired token"). Tokens must be truncated in logs (as implemented: first 15 + last 4 chars). 7. **Supabase configuration MUST be present** — If `SUPABASE_URL`, `SUPABASE_ANON_KEY`, or `SUPABASE_SERVICE_KEY` are empty/missing, the auth system is non-functional. The service should fail to start rather than silently accept all tokens. 8. **JWT expiry MUST be enforced** — Supabase tokens have a configurable expiry. The verification MUST reject expired tokens, not just validate the signature. -9. **Session teardown MUST happen only on confirmed-invalid refresh** — The frontend clears the stored session (and forces re-login) only when `/v1/auth/refresh` returns `401` (refresh token invalid/revoked). Transient failures (network errors, 5xx, timeouts) MUST NOT clear the session; they are retried while the existing session is preserved. +9. **Session teardown MUST happen only on confirmed-invalid refresh** — The frontend clears the stored session (and forces re-login) only when `/v1/auth/refresh` returns `401` (refresh token invalid/revoked). Transient failures (network errors, 5xx, timeouts) MUST NOT clear the session; they are retried while the existing session is preserved. The backend enforces this contract: `/v1/auth/refresh` returns `401` only for a definite invalid-token error from Supabase and returns `503` for transient/transport failures (and any unexpected error), so a Supabase outage cannot masquerade as an invalid token and log users out. ## Threat Vectors & Mitigations @@ -51,4 +51,5 @@ Two middleware variants exist: - [x] `SUPABASE_URL`, `SUPABASE_ANON_KEY`, and `SUPABASE_SERVICE_KEY` are validated at startup — empty strings are treated as missing — **FAIL: All default to "" with no startup validation (F-019)** - [x] Token expiry is enforced by the verification call (not just signature validity) — **PASS** - [x] Frontend refresh goes through `/v1/auth/refresh` (not the anon-key client) and clears the session only on a `401`, retrying transient failures — **PASS** +- [x] `/v1/auth/refresh` returns `401` only for a confirmed-invalid refresh token and `503` for transient/unexpected failures (so an outage cannot force logout) — **PASS** - [x] No endpoint that should require auth is using `optionalAuth` as a shortcut — **PARTIAL: BRLA KYC endpoints use optionalAuth but create user-specific resources** From d39c674c7052ac8fd6fbe410ba35bef271070005 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Fri, 3 Jul 2026 11:12:57 +0200 Subject: [PATCH 075/176] Adjust alfredpay limit amounts to correct values --- .../shared/src/tokens/freeTokens/config.ts | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/shared/src/tokens/freeTokens/config.ts b/packages/shared/src/tokens/freeTokens/config.ts index 9838b146b..52c6fbdd9 100644 --- a/packages/shared/src/tokens/freeTokens/config.ts +++ b/packages/shared/src/tokens/freeTokens/config.ts @@ -48,12 +48,12 @@ const MXN_LIMITS: AlfredpayLimitsTable = { }, onramp: { USDC: { - BUSINESS: { maxRaw: "8699689121", minRaw: "20000" }, - INDIVIDUAL: { maxRaw: "8699689121", minRaw: "20000" } + BUSINESS: { maxRaw: "8699689121", minRaw: "15000" }, + INDIVIDUAL: { maxRaw: "8699689121", minRaw: "15000" } }, USDT: { - BUSINESS: { maxRaw: "8695217304", minRaw: "20000" }, - INDIVIDUAL: { maxRaw: "8695217304", minRaw: "20000" } + BUSINESS: { maxRaw: "8695217304", minRaw: "150000" }, + INDIVIDUAL: { maxRaw: "8695217304", minRaw: "150000" } } } }; @@ -71,12 +71,12 @@ const COP_LIMITS: AlfredpayLimitsTable = { }, onramp: { USDC: { - BUSINESS: { maxRaw: "110596799945", minRaw: "3500000" }, - INDIVIDUAL: { maxRaw: "36865599982", minRaw: "3500000" } + BUSINESS: { maxRaw: "110596799945", minRaw: "3300000" }, + INDIVIDUAL: { maxRaw: "36865599982", minRaw: "3300000" } }, USDT: { - BUSINESS: { maxRaw: "110596799945", minRaw: "3500000" }, - INDIVIDUAL: { maxRaw: "36865599982", minRaw: "3500000" } + BUSINESS: { maxRaw: "110596799945", minRaw: "3300000" }, + INDIVIDUAL: { maxRaw: "36865599982", minRaw: "3300000" } } } }; @@ -147,7 +147,7 @@ export const freeTokenConfig: Partial> = }, maxBuyAmountRaw: "8695217304", maxSellAmountRaw: "5000000000000", - minBuyAmountRaw: "20000", + minBuyAmountRaw: "15000", minSellAmountRaw: "1000000", type: TokenType.Fiat }, @@ -162,7 +162,7 @@ export const freeTokenConfig: Partial> = }, maxBuyAmountRaw: "36865599982", maxSellAmountRaw: "100000000000", - minBuyAmountRaw: "3500000", + minBuyAmountRaw: "3300000", minSellAmountRaw: "1000000", type: TokenType.Fiat }, From d6e5bfc865076bdaf4c3f4f9b94b113a92f17d6e Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Fri, 3 Jul 2026 11:16:36 +0200 Subject: [PATCH 076/176] Address PR review: encode manual/standard invariants explicitly in amount selection --- apps/rebalancer/src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/rebalancer/src/index.ts b/apps/rebalancer/src/index.ts index d1dd301e8..cbed460b2 100644 --- a/apps/rebalancer/src/index.ts +++ b/apps/rebalancer/src/index.ts @@ -288,7 +288,7 @@ async function selectUsdcToBrlaPolicyAmount(coverageDeviationBps: number): Promi const config = getConfig(); const standardAmountSelection = selectUsdcToBrlaAmount( config.rebalancingUsdToBrlAmount, - config.rebalancingProfitableUsdToBrlAmount, + config.rebalancingUsdToBrlAmount, false, manualAmount ); @@ -314,7 +314,7 @@ async function selectUsdcToBrlaPolicyAmount(coverageDeviationBps: number): Promi const selectedAmount = selectEvaluatedUsdcToBrlaAmount( { amountUsdc: standardAmountSelection.amountUsdc, projectedProfitable: standardPolicyDecision.profitable }, { amountUsdc: config.rebalancingProfitableUsdToBrlAmount, projectedProfitable: profitablePolicyDecision.profitable }, - manualAmount + null ); if (selectedAmount.reason !== "profitable") { From 456df0954bcc1d31dda93a2c792d5c4ee3ce591f Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Fri, 3 Jul 2026 11:24:04 +0200 Subject: [PATCH 077/176] fix(auth): avoid redundant token read and post-unmount refresh timer - isAuthenticated() decodes expiry from the token already in scope instead of reading localStorage a second time via getAccessTokenExpiryMs(). - Guard scheduleNext() on the cancelled flag so a refresh callback that is already running at unmount can't schedule a new timer after cleanup. Addresses PR #1240 review feedback (review 4624527032). --- apps/frontend/src/contexts/rampState.tsx | 1 + apps/frontend/src/services/auth.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/frontend/src/contexts/rampState.tsx b/apps/frontend/src/contexts/rampState.tsx index 566ef1fcd..e1f818737 100644 --- a/apps/frontend/src/contexts/rampState.tsx +++ b/apps/frontend/src/contexts/rampState.tsx @@ -155,6 +155,7 @@ const TokenRefreshEffect = () => { let timer: ReturnType | undefined; const scheduleNext = () => { + if (cancelled) return; const expiryMs = AuthService.getAccessTokenExpiryMs(); // If the expiry can't be decoded, don't kill the loop permanently — retry shortly so a // later (decodable) token re-establishes the schedule. diff --git a/apps/frontend/src/services/auth.ts b/apps/frontend/src/services/auth.ts index 145135db4..be56b6309 100644 --- a/apps/frontend/src/services/auth.ts +++ b/apps/frontend/src/services/auth.ts @@ -65,7 +65,7 @@ export class AuthService { if (!tokens) { return false; } - const expiryMs = this.getAccessTokenExpiryMs(); + const expiryMs = this.decodeJwtExpiryMs(tokens.accessToken); return expiryMs === null || expiryMs > Date.now(); } From 9fecb8f9576397d856c9bc219e16fbf1a56b7bd7 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Fri, 3 Jul 2026 11:39:21 +0200 Subject: [PATCH 078/176] fix(frontend): strip endpoint prefix from user-facing API error messages Move the 'METHOD /path (status):' prefix from ApiError.message to error.name so it still groups errors by endpoint in Sentry without leaking into error text shown to users (e.g. the quote card). --- apps/frontend/src/services/api/api-client.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/frontend/src/services/api/api-client.ts b/apps/frontend/src/services/api/api-client.ts index 2755074fa..1b95442db 100644 --- a/apps/frontend/src/services/api/api-client.ts +++ b/apps/frontend/src/services/api/api-client.ts @@ -78,8 +78,11 @@ async function apiFetch( const errorData = (await response.json().catch(() => ({}))) as { error?: string; message?: string }; console.error("API Error:", errorData); const serverMessage = errorData.error ?? errorData.message ?? response.statusText; - // Prefix with method/status/path so Sentry groups by endpoint instead of one generic bucket. - throw new ApiError(response.status, errorData, `${method.toUpperCase()} ${path} (${response.status}): ${serverMessage}`); + // Keep the message clean for the user; the endpoint/status prefix lives on `name` so Sentry + // still groups by endpoint without leaking "POST /path (500):" into user-facing error text. + const error = new ApiError(response.status, errorData, serverMessage); + error.name = `ApiError ${method.toUpperCase()} ${path} (${response.status})`; + throw error; } if (response.status === 204) return undefined as T; From ba2f422ad0af4615af37a2808a364a4ab73ec9af Mon Sep 17 00:00:00 2001 From: Kacper Szarkiewicz Date: Fri, 3 Jul 2026 11:50:37 +0200 Subject: [PATCH 079/176] add sentry-user-recognition logic --- .agents/skills/sentry-vortex/SKILL.md | 1 + apps/frontend/src/helpers/sentry.ts | 4 ++-- apps/frontend/src/main.tsx | 8 ++++++++ apps/frontend/src/services/api/api-client.ts | 7 ++++++- apps/frontend/src/services/auth.ts | 5 +++++ 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.agents/skills/sentry-vortex/SKILL.md b/.agents/skills/sentry-vortex/SKILL.md index c99f1a9ff..bd8942fe1 100644 --- a/.agents/skills/sentry-vortex/SKILL.md +++ b/.agents/skills/sentry-vortex/SKILL.md @@ -42,6 +42,7 @@ Check each rule. Report a finding only when violated. - `ignoreErrors` covers wallet user-rejections, `ResizeObserver` loops, extension-context errors, `AbortError`. **IMPORTANT**: keep `TimeoutError` reportable — a timeout can mean a slow backend. - `beforeSend` drops expected client 4xx (`401/403/404/409/429`); `400/422` and all `5xx` are kept. - No PII in query params, tags, contexts, or messages — `beforeSend` strips query strings, but new code must not route PII somewhere it can't reach. +- **User context**: `Sentry.setUser` is set/cleared only in `AuthService` (plus a startup seed in `main.tsx`) and carries the **pseudonymous Supabase id only** (`{ id: userId }`) — **NEVER** email, wallet, or IP. New auth code must keep this invariant. ## Generate Report diff --git a/apps/frontend/src/helpers/sentry.ts b/apps/frontend/src/helpers/sentry.ts index 5f72aa172..c9a0a8072 100644 --- a/apps/frontend/src/helpers/sentry.ts +++ b/apps/frontend/src/helpers/sentry.ts @@ -41,8 +41,8 @@ function hasDomain(error: unknown): error is DomainError { // Tag events by business domain (when the originating error carries one), drop expected // client errors, and strip PII from URLs before the event leaves the browser. -export function sentryBeforeSend(event: ErrorEvent, hint: EventHint): ErrorEvent | null { - const original = hint.originalException; +export function sentryBeforeSend(event: ErrorEvent, hint?: EventHint): ErrorEvent | null { + const original = hint?.originalException; // Don't report expected client errors (auth/rate-limit/not-found) — user-driven, not bugs. if (isApiError(original) && EXPECTED_CLIENT_STATUSES.has(original.status)) { diff --git a/apps/frontend/src/main.tsx b/apps/frontend/src/main.tsx index 09be9723c..b1833fd99 100644 --- a/apps/frontend/src/main.tsx +++ b/apps/frontend/src/main.tsx @@ -17,6 +17,7 @@ import { config } from "./config"; import { PolkadotNodeProvider } from "./contexts/polkadotNode"; import { PolkadotWalletStateProvider } from "./contexts/polkadotWallet"; import { SENTRY_DENY_URLS, SENTRY_IGNORE_ERRORS, sentryBeforeSend } from "./helpers/sentry"; +import { AuthService } from "./services/auth"; import { initializeEvmTokens } from "./services/tokens"; import { wagmiConfig } from "./wagmiConfig"; import "./helpers/googleTranslate"; @@ -79,6 +80,13 @@ if (sentryDsn) { tracePropagationTargets: [window.location.origin], tracesSampleRate: config.isProd ? 0.2 : 1.0 }); + + // On a page reload the session is restored from localStorage without calling storeTokens, so + // seed the Sentry user here too (pseudonymous id only). Runtime login/logout keeps it in sync. + const restoredUserId = AuthService.getUserId(); + if (restoredUserId) { + Sentry.setUser({ id: restoredUserId }); + } } const root = document.getElementById("app"); diff --git a/apps/frontend/src/services/api/api-client.ts b/apps/frontend/src/services/api/api-client.ts index 2b8e5023b..7a58fecd9 100644 --- a/apps/frontend/src/services/api/api-client.ts +++ b/apps/frontend/src/services/api/api-client.ts @@ -39,10 +39,15 @@ export function isApiError(error: unknown): error is ApiError { // so Sentry groups errors by endpoint instead of creating one issue per id. Also keeps // addresses out of issue titles. function normalizePath(path: string): string { - return path + // Split off any query string first so the last path segment is followed by end-of-string + // (the `(?=\/|$)` lookaheads wouldn't match a segment trailed by "?"), and so query params — + // which can carry ids/addresses — never reach the error message or Sentry issue title. + const [rawPath, query] = path.split("?"); + const normalized = rawPath .replace(/\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}(?=\/|$)/g, "/:id") .replace(/\/\d+(?=\/|$)/g, "/:id") .replace(/\/[A-Za-z0-9]{20,}(?=\/|$)/g, "/:id"); + return query === undefined ? normalized : `${normalized}?[Filtered]`; } const DOMAIN_BY_SEGMENT: Record = { diff --git a/apps/frontend/src/services/auth.ts b/apps/frontend/src/services/auth.ts index cfd4f89fc..2093134a1 100644 --- a/apps/frontend/src/services/auth.ts +++ b/apps/frontend/src/services/auth.ts @@ -1,3 +1,4 @@ +import * as Sentry from "@sentry/react"; import { supabase } from "../config/supabase"; export interface AuthTokens { @@ -28,6 +29,9 @@ export class AuthService { if (tokens.userEmail) { localStorage.setItem(this.USER_EMAIL_KEY, tokens.userEmail); } + // Attach the pseudonymous Supabase user id for issue-impact counts. Deliberately no email/IP + // so Sentry can count affected users without storing PII. + Sentry.setUser({ id: tokens.userId }); } /** @@ -54,6 +58,7 @@ export class AuthService { localStorage.removeItem(this.REFRESH_TOKEN_KEY); localStorage.removeItem(this.USER_ID_KEY); localStorage.removeItem(this.USER_EMAIL_KEY); + Sentry.setUser(null); } /** From 25ce739c0b092ff6aa6b34463d3ce5a429be6c3d Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Fri, 3 Jul 2026 17:12:15 +0200 Subject: [PATCH 080/176] fix(frontend): report 409 ramp conflicts and scrub query from Sentry domain tag - Drop 409 from EXPECTED_CLIENT_STATUSES so genuine ramp money-flow conflicts ("Quote already consumed", "Ramp is not in a state that allows updates") reach Sentry; keep 429 as expected rate-limit noise. - Strip any query string in getApiDomain before deriving the segment so inlined params can't leak into the domain tag. --- apps/frontend/src/helpers/sentry.ts | 4 +++- apps/frontend/src/services/api/api-client.ts | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/frontend/src/helpers/sentry.ts b/apps/frontend/src/helpers/sentry.ts index c9a0a8072..8620eb6f6 100644 --- a/apps/frontend/src/helpers/sentry.ts +++ b/apps/frontend/src/helpers/sentry.ts @@ -33,7 +33,9 @@ function stripQueryString(url: string): string { // Client errors that are user-driven or expected (auth, rate-limit, not-found) rather than bugs. // 400/422 are kept — they usually mean we sent a bad request, which is worth reporting. -const EXPECTED_CLIENT_STATUSES = new Set([401, 403, 404, 409, 429]); +// 409 is kept too: ramp conflicts ("Quote already consumed", "Ramp is not in a state that allows +// updates") are genuine money-flow failures that captureActorError intentionally reports. +const EXPECTED_CLIENT_STATUSES = new Set([401, 403, 404, 429]); function hasDomain(error: unknown): error is DomainError { return typeof error === "object" && error !== null && typeof (error as DomainError).domain === "string"; diff --git a/apps/frontend/src/services/api/api-client.ts b/apps/frontend/src/services/api/api-client.ts index 7a58fecd9..333ea5b39 100644 --- a/apps/frontend/src/services/api/api-client.ts +++ b/apps/frontend/src/services/api/api-client.ts @@ -61,10 +61,12 @@ const DOMAIN_BY_SEGMENT: Record = { }; // Map an endpoint path to a business domain for Sentry tagging. Unmapped endpoints fall -// through to their raw path segment. +// through to their raw path segment. Strip any query string first so params (which can carry +// ids/addresses) never leak into the domain tag when a caller inlines them in the path. function getApiDomain(path: string): string { - if (path.toLowerCase().includes("kyb")) return SentryDomain.Kyb; - const segment = path.split("/").filter(Boolean)[0]?.toLowerCase() ?? "api"; + const pathWithoutQuery = path.split("?")[0]; + if (pathWithoutQuery.toLowerCase().includes("kyb")) return SentryDomain.Kyb; + const segment = pathWithoutQuery.split("/").filter(Boolean)[0]?.toLowerCase() ?? "api"; return DOMAIN_BY_SEGMENT[segment] ?? segment; } From 4248e2b7c99fe1bbb7f9fb18064497c94731204e Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Fri, 3 Jul 2026 17:40:52 +0200 Subject: [PATCH 081/176] Rewrite example scripts to pass values from env vars --- .gitignore | 4 +- packages/sdk/.env.example | 44 ++++++ packages/sdk/examples/exampleBrlOfframp.ts | 22 ++- packages/sdk/examples/exampleBrlOnramp.ts | 18 ++- packages/sdk/examples/exampleEurOfframp.ts | 22 ++- packages/sdk/examples/exampleEurOnramp.ts | 20 ++- packages/sdk/examples/exampleMxnOfframp.ts | 156 +++++++++++++++++++++ packages/sdk/examples/exampleMxnOnramp.ts | 126 +++++++++++++++++ 8 files changed, 385 insertions(+), 27 deletions(-) create mode 100644 packages/sdk/.env.example create mode 100644 packages/sdk/examples/exampleMxnOfframp.ts create mode 100644 packages/sdk/examples/exampleMxnOnramp.ts diff --git a/.gitignore b/.gitignore index a97f19a87..d62be3bc9 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,7 @@ dist-ssr *.local # Environment files (any package, any name) -**/.env +packages/sdk/.env **/.env.local **/.env.*.local **/.env.development @@ -58,4 +58,4 @@ CLAUDE.local.md contracts/*/artifacts contracts/*/cache -.mcp.json \ No newline at end of file +.mcp.json diff --git a/packages/sdk/.env.example b/packages/sdk/.env.example new file mode 100644 index 000000000..b910d5ac1 --- /dev/null +++ b/packages/sdk/.env.example @@ -0,0 +1,44 @@ +# Copy this file to `.env` (in packages/sdk) and fill in your own values. +# `bun run scripts/*.ts` and `bun run examples/*.ts` auto-load it — no code edits needed. +# `.env` is gitignored; `.env.example` is committed as the template. +# +# Vars marked (required) have no default: the example throws on startup if they are unset, +# rather than silently using a placeholder. Vars marked (default: ...) may be left unset. + +# ── Backend / credentials (all examples) ──────────────────────────────────── +# Backend base URL. (default: http://localhost:3000) +VORTEX_API_URL=http://localhost:3000 +# API key pair from `bun run scripts/login-and-create-api-key.ts` (see .api-key.json). (required) +# For Alfredpay (MXN) flows this MUST be a user-linked sk_* key, not a partner-only key. +VORTEX_PUBLIC_KEY= +VORTEX_SECRET_KEY= + +# ── Wallet / destination (all examples) ───────────────────────────────────── +# Where crypto lands (onramp) and the connected wallet used for offramp registration. (required) +DESTINATION_ADDRESS= +WALLET_ADDRESS= + +# ── EUR examples (SEPA) ───────────────────────────────────────────────────── +USER_EMAIL=user@example.com # (default: user@example.com) +USER_IP_ADDRESS=203.0.113.1 # (default: 203.0.113.1) + +# ── BRL examples (PIX) ────────────────────────────────────────────────────── +BRL_TAX_ID= # (required for BRL onramp + offramp) +BRL_RECEIVER_TAX_ID= # (required for BRL offramp) +BRL_PIX_DESTINATION= # (required for BRL offramp) + +# ── MXN offramp (Alfredpay / SPEI) ────────────────────────────────────────── +# Throwaway wallet holding the test USDC; used to sign offramp permits locally with viem. +# Leave unset to sign in your own wallet and paste signatures at the prompt — but then +# WALLET_ADDRESS (above) must be the address you sign with. (optional) +OFFRAMP_WALLET_PRIVATE_KEY= +# The user's Alfredpay fiat account id. (required for MXN offramp) +FIAT_ACCOUNT_ID= + +# ── API-key provisioning scripts (scripts/*.ts) ───────────────────────────── +# Note: the scripts read API_BASE_URL (not VORTEX_API_URL). +API_BASE_URL=http://localhost:3000 +# Email of the user to log in as — for Alfredpay use the user who completed MXN KYC. +TEST_USER_EMAIL=test@email.io +API_KEY_NAME=sdk-test +API_KEY_OUTFILE=.api-key.json diff --git a/packages/sdk/examples/exampleBrlOfframp.ts b/packages/sdk/examples/exampleBrlOfframp.ts index 9ac15c6c5..3b026026b 100644 --- a/packages/sdk/examples/exampleBrlOfframp.ts +++ b/packages/sdk/examples/exampleBrlOfframp.ts @@ -3,6 +3,14 @@ import { EPaymentMethod, EvmToken, FiatToken, Networks, RampDirection } from ".. import { VortexSdkConfig } from "../src/types"; import { VortexSdk } from "../src/VortexSdk"; +function requireEnv(name: string): string { + const value = process.env[name]; + if (!value) { + throw new Error(`Missing required env var: ${name}. Copy .env.example to .env and set it.`); + } + return value; +} + async function runBrlOfframpExample() { const askQuestion = (query: string): Promise => { const rl = readline.createInterface({ @@ -23,13 +31,13 @@ async function runBrlOfframpExample() { console.log("📝 Step 1: Initializing VortexSdk..."); const config: VortexSdkConfig = { - apiBaseUrl: "http://localhost:3000", + apiBaseUrl: process.env.VORTEX_API_URL ?? "http://localhost:3000", autoReconnect: true, // Optional: provide custom WebSocket URLs moonbeamWsUrl: undefined, pendulumWsUrl: undefined, // 'wss://custom-moonbeam-rpc.com', - publicKey: "pk_live_REPLACEME", // 'wss://custom-pendulum-rpc.com', - secretKey: "sk_live_REPLACEME", // default is `true` + publicKey: requireEnv("VORTEX_PUBLIC_KEY"), // 'wss://custom-pendulum-rpc.com', + secretKey: requireEnv("VORTEX_SECRET_KEY"), // default is `true` // Optional: store ephemeral keys for debug storeEphemeralKeys: true // default is `true` }; @@ -58,10 +66,10 @@ async function runBrlOfframpExample() { console.log(` Expires at: ${quote.expiresAt}\n`); const brlOfframpData = { - pixDestination: "157.492.981-08", - receiverTaxId: "157.492.981-08", - taxId: "157.492.981-08", - walletAddress: "0x1234567890123456789012345678901234567890" + pixDestination: requireEnv("BRL_PIX_DESTINATION"), + receiverTaxId: requireEnv("BRL_RECEIVER_TAX_ID"), + taxId: requireEnv("BRL_TAX_ID"), + walletAddress: requireEnv("WALLET_ADDRESS") }; const { rampProcess, unsignedTransactions } = await sdk.registerRamp(quote, brlOfframpData); diff --git a/packages/sdk/examples/exampleBrlOnramp.ts b/packages/sdk/examples/exampleBrlOnramp.ts index da815795a..40f56067d 100644 --- a/packages/sdk/examples/exampleBrlOnramp.ts +++ b/packages/sdk/examples/exampleBrlOnramp.ts @@ -2,19 +2,27 @@ import { CreateQuoteRequest, EPaymentMethod, EvmToken, FiatToken, Networks, Quot import { VortexSdkConfig } from "../src/types"; import { VortexSdk } from "../src/VortexSdk"; +function requireEnv(name: string): string { + const value = process.env[name]; + if (!value) { + throw new Error(`Missing required env var: ${name}. Copy .env.example to .env and set it.`); + } + return value; +} + async function runBrlOnrampExample() { try { console.log("Starting BRL Onramp Example...\n"); console.log("📝 Step 1: Initializing VortexSdk..."); const config: VortexSdkConfig = { - apiBaseUrl: "http://localhost:3000", + apiBaseUrl: process.env.VORTEX_API_URL ?? "http://localhost:3000", autoReconnect: true, // Optional: provide custom WebSocket URLs moonbeamWsUrl: undefined, pendulumWsUrl: undefined, // 'wss://custom-moonbeam-rpc.com', - publicKey: "pk_live_REPLACEME", // 'wss://custom-pendulum-rpc.com', - secretKey: "sk_live_REPLACEME", // default is `true` + publicKey: requireEnv("VORTEX_PUBLIC_KEY"), // 'wss://custom-pendulum-rpc.com', + secretKey: requireEnv("VORTEX_SECRET_KEY"), // default is `true` // Optional: store ephemeral keys for later use storeEphemeralKeys: true // default is `true` }; @@ -45,8 +53,8 @@ async function runBrlOnrampExample() { console.log(` Expires at: ${quote.expiresAt}\n`); const brlOnrampData = { - destinationAddress: "0x1234567890123456789012345678901234567890", - taxId: "123.456.789-00" + destinationAddress: requireEnv("DESTINATION_ADDRESS"), + taxId: requireEnv("BRL_TAX_ID") }; const { rampProcess } = await sdk.registerRamp(quote, brlOnrampData); diff --git a/packages/sdk/examples/exampleEurOfframp.ts b/packages/sdk/examples/exampleEurOfframp.ts index bdd2a1b1c..b15ca705a 100644 --- a/packages/sdk/examples/exampleEurOfframp.ts +++ b/packages/sdk/examples/exampleEurOfframp.ts @@ -3,6 +3,14 @@ import { EPaymentMethod, EvmToken, FiatToken, Networks, RampDirection } from ".. import { VortexSdkConfig } from "../src/types"; import { VortexSdk } from "../src/VortexSdk"; +function requireEnv(name: string): string { + const value = process.env[name]; + if (!value) { + throw new Error(`Missing required env var: ${name}. Copy .env.example to .env and set it.`); + } + return value; +} + async function runEurOfframpExample() { const askQuestion = (query: string): Promise => { const rl = readline.createInterface({ @@ -23,10 +31,10 @@ async function runEurOfframpExample() { console.log("📝 Step 1: Initializing VortexSdk..."); const config: VortexSdkConfig = { - apiBaseUrl: "http://localhost:3000", + apiBaseUrl: process.env.VORTEX_API_URL ?? "http://localhost:3000", autoReconnect: true, - publicKey: "pk_live_REPLACEME", - secretKey: "sk_live_REPLACEME", + publicKey: requireEnv("VORTEX_PUBLIC_KEY"), + secretKey: requireEnv("VORTEX_SECRET_KEY"), storeEphemeralKeys: true }; @@ -53,10 +61,10 @@ async function runEurOfframpExample() { console.log(` Expires at: ${quote.expiresAt}\n`); const eurOfframpData = { - destinationAddress: "0x1234567890123456789012345678901234567890", - email: "user@example.com", - ipAddress: "203.0.113.1", - walletAddress: "0x1234567890123456789012345678901234567890" + destinationAddress: requireEnv("DESTINATION_ADDRESS"), + email: process.env.USER_EMAIL ?? "user@example.com", + ipAddress: process.env.USER_IP_ADDRESS ?? "203.0.113.1", + walletAddress: requireEnv("WALLET_ADDRESS") }; console.log("📝 Step 3: Registering EUR offramp..."); diff --git a/packages/sdk/examples/exampleEurOnramp.ts b/packages/sdk/examples/exampleEurOnramp.ts index 339971494..9cd89e1de 100644 --- a/packages/sdk/examples/exampleEurOnramp.ts +++ b/packages/sdk/examples/exampleEurOnramp.ts @@ -2,16 +2,24 @@ import { CreateQuoteRequest, EPaymentMethod, EvmToken, FiatToken, Networks, Quot import { VortexSdkConfig } from "../src/types"; import { VortexSdk } from "../src/VortexSdk"; +function requireEnv(name: string): string { + const value = process.env[name]; + if (!value) { + throw new Error(`Missing required env var: ${name}. Copy .env.example to .env and set it.`); + } + return value; +} + async function runEurOnrampExample() { try { console.log("Starting EUR Onramp Example...\n"); console.log("📝 Step 1: Initializing VortexSdk..."); const config: VortexSdkConfig = { - apiBaseUrl: "http://localhost:3000", + apiBaseUrl: process.env.VORTEX_API_URL ?? "http://localhost:3000", autoReconnect: true, - publicKey: "pk_live_REPLACEME", - secretKey: "sk_live_REPLACEME", + publicKey: requireEnv("VORTEX_PUBLIC_KEY"), + secretKey: requireEnv("VORTEX_SECRET_KEY"), storeEphemeralKeys: true }; @@ -38,9 +46,9 @@ async function runEurOnrampExample() { console.log(` Expires at: ${quote.expiresAt}\n`); const eurOnrampData = { - destinationAddress: "0x1234567890123456789012345678901234567890", - email: "user@example.com", - ipAddress: "203.0.113.1" + destinationAddress: requireEnv("DESTINATION_ADDRESS"), + email: process.env.USER_EMAIL ?? "user@example.com", + ipAddress: process.env.USER_IP_ADDRESS ?? "203.0.113.1" }; console.log("📝 Step 3: Registering EUR onramp..."); diff --git a/packages/sdk/examples/exampleMxnOfframp.ts b/packages/sdk/examples/exampleMxnOfframp.ts new file mode 100644 index 000000000..6d6494b6d --- /dev/null +++ b/packages/sdk/examples/exampleMxnOfframp.ts @@ -0,0 +1,156 @@ +// Manual end-to-end example for the Mexico (MXN) Alfredpay offramp. MXN settles via SPEI +// (EPaymentMethod.SPEI). Offramp: USDC -> MXN. The SDK returns user-side EVM transactions to +// sign; push the resulting hashes/signatures back via submitUserTransactions, then start. +// fiatAccountId is REQUIRED here. +// +// Requires a running backend (default http://localhost:3000) with Alfredpay enabled. +// +// Prerequisites: authenticate with the user's own user-linked secretKey (their sk_* key), and +// that same user must have completed Alfredpay MXN KYC. Onboard the user through the Vortex app +// first; the SDK cannot mint keys or run KYC. Also needs that user's FIAT_ACCOUNT_ID below. +// +// Config is read from packages/sdk/.env (bun auto-loads it). See .env.example. +// Env: VORTEX_API_URL, VORTEX_PUBLIC_KEY, VORTEX_SECRET_KEY (user-linked), +// OFFRAMP_WALLET_PRIVATE_KEY, FIAT_ACCOUNT_ID. +// +// Run: +// cd packages/sdk +// bun run examples/exampleMxnOfframp.ts + +import * as readline from "readline"; +import { privateKeyToAccount } from "viem/accounts"; +import { CreateQuoteRequest, EPaymentMethod, EvmToken, FiatToken, Networks, QuoteResponse, RampDirection } from "../src/index"; +import { VortexSdkConfig } from "../src/types"; +import { VortexSdk } from "../src/VortexSdk"; + +function requireEnv(name: string): string { + const value = process.env[name]; + if (!value) { + throw new Error(`Missing required env var: ${name}. Copy .env.example to .env and set it.`); + } + return value; +} + +// Optional: sign offramp permits locally (viem) with a throwaway wallet that holds the test USDC. +// viem derives the EIP712Domain canonically, so its signatures match the backend's ethers +// verifyTypedData exactly. If unset, you sign in your own wallet and paste the signature — but then +// WALLET_ADDRESS must be set to the address you'll sign with. +const OFFRAMP_WALLET_PRIVATE_KEY = process.env.OFFRAMP_WALLET_PRIVATE_KEY as `0x${string}` | undefined; +const OFFRAMP_WALLET_ADDRESS = OFFRAMP_WALLET_PRIVATE_KEY + ? privateKeyToAccount(OFFRAMP_WALLET_PRIVATE_KEY).address + : requireEnv("WALLET_ADDRESS"); +const FIAT_ACCOUNT_ID = requireEnv("FIAT_ACCOUNT_ID"); + +async function runMxnOfframpExample() { + const askQuestion = (query: string): Promise => { + const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout + }); + + return new Promise(resolve => { + rl.question(query, (ans: string) => { + rl.close(); + resolve(ans.trim()); + }); + }); + }; + + try { + console.log("Starting MXN Offramp Example...\n"); + + console.log("📝 Step 1: Initializing VortexSdk..."); + const config: VortexSdkConfig = { + apiBaseUrl: process.env.VORTEX_API_URL ?? "http://localhost:3000", + autoReconnect: true, + publicKey: requireEnv("VORTEX_PUBLIC_KEY"), + // Must be the user's user-linked sk_* key, not a partner-only key. + secretKey: requireEnv("VORTEX_SECRET_KEY"), + storeEphemeralKeys: true + }; + + const sdk = new VortexSdk(config); + console.log("✅ VortexSdk initialized successfully\n"); + + console.log("📝 Step 2: Creating quote for MXN offramp (USDC -> MXN via SPEI)..."); + const quoteRequest: CreateQuoteRequest = { + from: Networks.Polygon, + inputAmount: "10", + inputCurrency: EvmToken.USDC, + network: Networks.Polygon, + outputCurrency: FiatToken.MXN, + rampType: RampDirection.SELL, + to: EPaymentMethod.SPEI + }; + + const quote = (await sdk.createQuote(quoteRequest)) as QuoteResponse; + console.log("✅ Quote created successfully:"); + console.log(` Quote ID: ${quote.id}`); + console.log(` Input: ${quote.inputAmount} ${quote.inputCurrency}`); + console.log(` Output: ${quote.outputAmount} ${quote.outputCurrency}`); + console.log(` Total Fee: ${quote.totalFeeFiat} ${quote.feeCurrency}`); + console.log(` Expires at: ${quote.expiresAt}\n`); + + console.log("📝 Step 3: Registering offramp (fiatAccountId + walletAddress required)..."); + const { rampProcess, unsignedTransactions } = await sdk.registerRamp(quote, { + fiatAccountId: FIAT_ACCOUNT_ID, + walletAddress: OFFRAMP_WALLET_ADDRESS + }); + console.log(`✅ MXN Offramp registered successfully. Ramp ID: ${rampProcess.id}`); + + const localAccount = OFFRAMP_WALLET_PRIVATE_KEY ? privateKeyToAccount(OFFRAMP_WALLET_PRIVATE_KEY) : undefined; + + await sdk.submitUserTransactions(rampProcess.id, unsignedTransactions, { + sendTransaction: async (evmTx, { unsignedTransaction }) => { + console.log( + `\n🛑 Broadcast ${unsignedTransaction.phase} from your wallet: to=${evmTx.to} value=${evmTx.value} data=${evmTx.data}` + ); + const hash = await askQuestion(`➡️ Tx hash for ${unsignedTransaction.phase}: `); + console.log(`✅ Received hash for ${unsignedTransaction.phase}.`); + return hash; + }, + signTypedData: async (payload, { payloadCount, payloadIndex, unsignedTransaction }) => { + if (localAccount) { + const signature = await localAccount.signTypedData(payload as Parameters[0]); + console.log( + ` [${payloadIndex + 1}/${payloadCount}] ${payload.primaryType} signed locally by ${localAccount.address}` + ); + return signature; + } + + const [v4Payload] = sdk + .getTypedDataToSign(unsignedTransaction, { includeDomainType: true }) + .slice(payloadIndex, payloadIndex + 1); + console.log( + `\n----- sign payload ${payloadIndex + 1}/${payloadCount}: ${payload.primaryType} (account ${unsignedTransaction.signer}) -----` + ); + console.log(JSON.stringify(v4Payload, null, 2)); + const signature = await askQuestion(`➡️ Signature for ${payload.primaryType}: `); + console.log(`✅ Received signature for ${unsignedTransaction.phase}.`); + return signature; + } + }); + + console.log("📝 Step 4: Starting offramp..."); + await sdk.startRamp(rampProcess.id); + console.log("✅ MXN Offramp started successfully."); + } catch (error) { + console.error("❌ Error in MXN Offramp Example:", error); + if (error instanceof Error) { + console.error("Error message:", error.message); + } + process.exit(1); + } +} + +if (require.main === module) { + runMxnOfframpExample() + .then(() => { + console.log("\n✨ Example execution completed"); + process.exit(0); + }) + .catch(error => { + console.error("\n💥 Example execution failed:", error); + process.exit(1); + }); +} diff --git a/packages/sdk/examples/exampleMxnOnramp.ts b/packages/sdk/examples/exampleMxnOnramp.ts new file mode 100644 index 000000000..ce2fcf880 --- /dev/null +++ b/packages/sdk/examples/exampleMxnOnramp.ts @@ -0,0 +1,126 @@ +// Manual end-to-end example for the Mexico (MXN) Alfredpay onramp. MXN settles via SPEI +// (EPaymentMethod.SPEI). Onramp: MXN -> USDC. The user pays the SPEI instructions; crypto +// lands at destinationAddress. No user-signed transactions; fiatAccountId is NOT required. +// +// Requires a running backend (default http://localhost:3000) with Alfredpay enabled. +// +// Prerequisites: authenticate with the user's own user-linked secretKey (their sk_* key), and +// that same user must have completed Alfredpay MXN KYC. Onboard the user through the Vortex app +// first; the SDK cannot mint keys or run KYC. +// +// Config is read from packages/sdk/.env (bun auto-loads it). See .env.example. +// Env: VORTEX_API_URL, VORTEX_PUBLIC_KEY, VORTEX_SECRET_KEY (user-linked), +// DESTINATION_ADDRESS, WALLET_ADDRESS. +// +// Run: +// cd packages/sdk +// bun run examples/exampleMxnOnramp.ts + +import * as fs from "fs"; +import { CreateQuoteRequest, EPaymentMethod, EvmToken, FiatToken, Networks, QuoteResponse, RampDirection } from "../src/index"; +import { VortexSdkConfig } from "../src/types"; +import { VortexSdk } from "../src/VortexSdk"; + +function requireEnv(name: string): string { + const value = process.env[name]; + if (!value) { + throw new Error(`Missing required env var: ${name}. Copy .env.example to .env and set it.`); + } + return value; +} + +const DESTINATION_ADDRESS = requireEnv("DESTINATION_ADDRESS"); +const WALLET_ADDRESS = requireEnv("WALLET_ADDRESS"); + +// USDT on Polygon — the token Alfredpay mints; what you deposit to the ephemeral to simulate the fiat pay-in. +const USDT_POLYGON_ADDRESS = "0xc2132d05d31c914a87c6611c10748aeb04b58e8f"; // 6 decimals + +// The SDK writes ephemeral keys to ./ephemerals_.json (storeEphemeralKeys: true). +function readEphemeralEvmAddress(rampId: string): string | undefined { + try { + const items = JSON.parse(fs.readFileSync(`ephemerals_${rampId}.json`, "utf-8")); + return items.find((i: { type: string; address: string }) => i.type === "EVM")?.address; + } catch { + return undefined; + } +} + +async function runMxnOnrampExample() { + try { + console.log("Starting MXN Onramp Example...\n"); + + console.log("📝 Step 1: Initializing VortexSdk..."); + const config: VortexSdkConfig = { + apiBaseUrl: process.env.VORTEX_API_URL ?? "http://localhost:3000", + autoReconnect: true, + publicKey: requireEnv("VORTEX_PUBLIC_KEY"), + // Must be the user's user-linked sk_* key, not a partner-only key. + secretKey: requireEnv("VORTEX_SECRET_KEY"), + storeEphemeralKeys: true + }; + + const sdk = new VortexSdk(config); + console.log("✅ VortexSdk initialized successfully\n"); + + console.log("📝 Step 2: Creating quote for MXN onramp (MXN -> USDC via SPEI)..."); + const quoteRequest: CreateQuoteRequest = { + from: EPaymentMethod.SPEI, + inputAmount: "201", + inputCurrency: FiatToken.MXN, + network: Networks.Polygon, + outputCurrency: EvmToken.USDC, + rampType: RampDirection.BUY, + to: Networks.Polygon + }; + + const quote = (await sdk.createQuote(quoteRequest)) as QuoteResponse; + console.log("✅ Quote created successfully:"); + console.log(` Quote ID: ${quote.id}`); + console.log(` Input: ${quote.inputAmount} ${quote.inputCurrency}`); + console.log(` Output: ${quote.outputAmount} ${quote.outputCurrency}`); + console.log(` Total Fee: ${quote.totalFeeFiat} ${quote.feeCurrency}`); + console.log(` Expires at: ${quote.expiresAt}\n`); + + console.log("📝 Step 3: Registering onramp (destinationAddress only — fiatAccountId optional)..."); + const { rampProcess } = await sdk.registerRamp(quote, { + destinationAddress: DESTINATION_ADDRESS, + walletAddress: WALLET_ADDRESS + }); + console.log(`✅ MXN Onramp registered successfully. Ramp ID: ${rampProcess.id}`); + + console.log("📝 Step 4: Starting onramp..."); + const startedRamp = await sdk.startRamp(rampProcess.id); + + // To complete the onramp WITHOUT paying fiat, deposit USDT to the ephemeral so the + // alfredpayOnrampMint balance check passes (it trusts the on-chain balance as ground truth). + const ephemeralEvmAddress = readEphemeralEvmAddress(rampProcess.id); + console.log("\n🏦 To complete the onramp, deposit USDT on POLYGON to the ephemeral address:"); + console.log(` • Send USDT to: ${ephemeralEvmAddress ?? ``}`); + console.log(` • USDT token (Polygon): ${USDT_POLYGON_ADDRESS} (6 decimals)`); + console.log(` • Amount: a little more than ${quote.outputAmount} USDC-equivalent in USDT`); + console.log(" (exact raw amount is in the backend 'AlfredpayOnrampMintHandler: Waiting for ...' log)"); + + if (startedRamp.achPaymentData) { + console.log("\n(SPEI fiat instructions, not needed for the deposit-to-ephemeral test):"); + console.log(startedRamp.achPaymentData); + } + } catch (error) { + console.error("❌ Error in MXN Onramp Example:", error); + if (error instanceof Error) { + console.error("Error message:", error.message); + } + process.exit(1); + } +} + +if (require.main === module) { + runMxnOnrampExample() + .then(() => { + console.log("\n✨ Example execution completed"); + process.exit(0); + }) + .catch(error => { + console.error("\n💥 Example execution failed:", error); + process.exit(1); + }); +} From c54f4f51f1410eda05f1e2f3eb3e1a551d2ecf81 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Fri, 3 Jul 2026 19:23:30 +0200 Subject: [PATCH 082/176] feat(sdk): implement pre-flight balance check for offramps and add InsufficientBalanceError --- .../05-integrations/squid-router.md | 5 ++ packages/sdk/src/VortexSdk.ts | 5 ++ packages/sdk/src/errors.ts | 10 +++ packages/sdk/src/preflight.ts | 62 +++++++++++++++++++ 4 files changed, 82 insertions(+) create mode 100644 packages/sdk/src/preflight.ts diff --git a/docs/security-spec/05-integrations/squid-router.md b/docs/security-spec/05-integrations/squid-router.md index 00a0e03a2..af31a5841 100644 --- a/docs/security-spec/05-integrations/squid-router.md +++ b/docs/security-spec/05-integrations/squid-router.md @@ -62,6 +62,8 @@ When the BRL on-ramp's destination is **Base + USDC**, the Nabla swap output is 11. **Transaction hashes MUST be persisted to state before waiting** — `squidRouterApproveHash`, `squidRouterSwapHash`, `squidRouterPayTxHash`, `squidRouterPermitExecutionHash`, `squidRouterNoPermitApproveHash`, `squidRouterNoPermitSwapHash`, `squidRouterNoPermitTransferHash` all enable crash recovery. 12. **Skip-Squid path MUST NOT lose destination validation** — Quote engine `validate()` runs regardless of `skipRouteCalculation`; `destinationTransfer` is the only on-chain step that fires. 13. **Squid output raw metadata MUST use destination-token raw units** — `route.estimate.toAmount` is the authoritative destination raw output; `evmToEvm.outputAmountRaw` MUST NOT be recomputed with the source token's decimals. For same-chain same-token passthrough, `inputAmountRaw` is also the destination raw amount and is safe to mirror. Routed Alfredpay onramps follow the same rule; only direct Polygon same-token passthrough keeps the minted source-token precision. +14. **Permit execution MUST confirm the owner's token balance before spending the single-use permit** — An EIP-2612 permit is single-use: the token increments the owner's nonce on the first successful `permit()`, so executing against an unfunded owner burns the permit and strands the ramp. `assertOwnerHasBalance` in `squidrouter-permit-execution-handler.ts` reads `balanceOf(owner)` on both the direct-transfer and relayer paths and throws a **recoverable** error when the owner cannot cover `value`, giving the owner ~10 minutes (`getMaxRetries()=20` at the 30s cadence) to fund the wallet. On the direct-transfer path, retries additionally skip `permit()` when the standing allowance already covers `value`, so an already-consumed permit is never replayed. +15. **The SDK pre-checks the source wallet balance before registering any offramp** — `assertSufficientOfframpBalance` (called from `VortexSdk.registerRamp` for every SELL corridor) reads the input token balance of `walletAddress` on the source EVM chain and rejects registration with `InsufficientBalanceError` when it does not cover `inputAmount`. This is client-side defense-in-depth against reverting user transactions / unexecutable permits: it is best-effort (RPC failure or unknown token skips the check, AssetHub sources are not checked) and MUST NOT be relied on in place of invariant 14 or backend-side validation. ## Threat Vectors & Mitigations @@ -71,6 +73,7 @@ When the BRL on-ramp's destination is **Base + USDC**, the Nabla swap output is | **Gas overpayment to Axelar** | `calculateGasFeeInUnits()` uses Axelar's reported base fee + estimated gas × source gas price × multiplier. Result verified non-negative. | | **Double-spend of approve/swap** | Approve hash persisted immediately; on re-entry handler skips to swap if hash exists. EVM nonce prevents on-chain double-spend in any case. | | **Permit replay** | Each permit has a nonce + deadline; TokenRelayer validates on-chain. | +| **Unfunded owner burns the single-use permit** | User signs the permit before funding the wallet (or drains it after signing); executing `permit()` would consume the nonce with no recoverable transfer. Backend checks `balanceOf(owner) >= value` before touching the permit and retries recoverably (~10 min window); SDK additionally refuses to register an offramp when the wallet balance does not cover `inputAmount`. | | **Executor key compromise** | Attacker can call `execute()` with their own signatures but cannot steal in-flight user funds — the key only pays gas. Blast radius: gas balance drain. | | **Squid Router API manipulation (fake "success")** | Balance check runs in parallel; even if Squid reports premature success, tokens must actually arrive. | | **Squid rate limit (429)** | Exponential backoff retry; other errors fail fast. | @@ -91,6 +94,8 @@ When the BRL on-ramp's destination is **Base + USDC**, the Nabla swap output is - [PARTIAL] Verify `MOONBEAM_FUNDING_PRIVATE_KEY` (gas funding) and `MOONBEAM_EXECUTOR_PRIVATE_KEY` (relayer calls) are distinct keys. **PARTIAL** — distinct env vars, but operationally `MOONBEAM_FUNDING_PRIVATE_KEY` is reused on **Base** for subsidization and the `backupApprove` funding spender. The name no longer reflects its scope; rename to `EVM_FUNDING_PRIVATE_KEY` and expose via a per-network getter (see `06-cross-chain/fund-routing.md`). - [PARTIAL] `getPublicClient()` Moonbeam fallback (line 147). **PARTIAL** — known buggy fallback; logs "This is a bug" but defaults to Moonbeam. - [x] `isSignedTypedDataArray` validation in `squidrouter-permit-execution-handler.ts` correct. **PASS** +- [x] **Owner balance guard before permit execution**: `assertOwnerHasBalance` runs on both the direct-transfer and relayer paths before `permit()` / `TokenRelayer.execute()`; insufficient balance raises a recoverable error (retry window via `getMaxRetries()=20`), and the direct-transfer path skips `permit()` when the standing allowance already covers `value`. **PASS** +- [x] **SDK offramp balance pre-flight**: `assertSufficientOfframpBalance` in `packages/sdk/src/preflight.ts` is invoked from `VortexSdk.registerRamp` for every SELL corridor and throws `InsufficientBalanceError` when the source wallet cannot cover `inputAmount`; RPC failures skip permissively. **PASS** — client-side only, backend guards remain authoritative. - [x] `RELAYER_ADDRESS` matches deployed TokenRelayer on the correct network. **PASS** - [x] `EVM_BALANCE_CHECK_TIMEOUT_MS` (15 minutes) appropriate for Axelar GMP. **PASS** - [x] `DEFAULT_SQUIDROUTER_GAS_ESTIMATE` (1,600,000) reasonable upper bound. **PASS** diff --git a/packages/sdk/src/VortexSdk.ts b/packages/sdk/src/VortexSdk.ts index 9a4643d7a..afd7fc69d 100644 --- a/packages/sdk/src/VortexSdk.ts +++ b/packages/sdk/src/VortexSdk.ts @@ -27,6 +27,7 @@ import { TransactionSigningError } from "./errors"; import { AlfredpayHandler } from "./handlers/AlfredpayHandler"; import { BrlHandler } from "./handlers/BrlHandler"; import { MykoboHandler } from "./handlers/MykoboHandler"; +import { assertSufficientOfframpBalance } from "./preflight"; import { ApiService } from "./services/ApiService"; import { NetworkManager } from "./services/NetworkManager"; import { storeEphemeralKeys } from "./storage"; @@ -152,6 +153,10 @@ export class VortexSdk { throw new Error(`Unsupported onramp from: ${quote.from}`); } } else if (quote.rampType === RampDirection.SELL) { + // Every offramp corridor moves quote.inputAmount out of the user's wallet on-chain. Check + // the balance up front so we never register a ramp whose user transactions can only revert + // (or request a single-use permit the backend cannot execute). + await assertSufficientOfframpBalance(quote, (additionalData as { walletAddress?: string }).walletAddress); if (isAlfredpayToken(quote.outputCurrency)) { const offrampData = additionalData as AlfredpayOfframpAdditionalData; rampProcess = await this.alfredpayHandler.registerAlfredpayOfframp(quote.id, offrampData); diff --git a/packages/sdk/src/errors.ts b/packages/sdk/src/errors.ts index a73b8f79b..6f210296f 100644 --- a/packages/sdk/src/errors.ts +++ b/packages/sdk/src/errors.ts @@ -65,6 +65,16 @@ export class InvalidAdditionalDataError extends RegisterRampError { } } +export class InsufficientBalanceError extends RegisterRampError { + constructor(requiredAmount: string, currency: string, network: string, walletAddress: string) { + super( + `Wallet ${walletAddress} holds less than the required ${requiredAmount} ${currency} on ${network} for this offramp`, + 400 + ); + this.name = "InsufficientBalanceError"; + } +} + export type EphemeralChain = "Substrate" | "EVM"; export class EphemeralNotFreshError extends RegisterRampError { diff --git a/packages/sdk/src/preflight.ts b/packages/sdk/src/preflight.ts new file mode 100644 index 000000000..587509b21 --- /dev/null +++ b/packages/sdk/src/preflight.ts @@ -0,0 +1,62 @@ +import { + EvmClientManager, + getOnChainTokenDetails, + isEvmTokenDetails, + isNetworkEVM, + multiplyByPowerOfTen, + QuoteResponse +} from "@vortexfi/shared"; +import { erc20Abi } from "viem"; +import { InsufficientBalanceError } from "./errors"; + +/** + * Pre-flight guard for offramps: verify the user's source wallet holds the quoted input amount + * before the ramp is registered. Every offramp corridor moves `inputAmount` of `inputCurrency` + * out of that wallet on-chain (squidRouter approve/swap, a direct no-permit transfer, or an + * EIP-2612 permit the backend executes), so registering without funds only produces user + * transactions that revert — or hands the backend a single-use permit it cannot execute. + * + * Best-effort by design: an unknown token or an RPC failure skips the check instead of blocking + * registration, because the backend re-validates balances authoritatively before moving funds. + * Native gas is not checked here — the permit path needs none, and gas costs for the no-permit + * path are unknown at registration time. + */ +export async function assertSufficientOfframpBalance(quote: QuoteResponse, walletAddress: string | undefined): Promise { + if (!walletAddress) { + // A missing walletAddress is reported by the corridor handler's own parameter validation. + return; + } + + const network = quote.network; + if (!isNetworkEVM(network)) { + // AssetHub offramps are funded by a user extrinsic submitted outside the SDK; no pre-check. + return; + } + + let requiredRaw: bigint; + let balance: bigint; + try { + const tokenDetails = getOnChainTokenDetails(network, quote.inputCurrency); + if (!tokenDetails || !isEvmTokenDetails(tokenDetails)) { + return; + } + + requiredRaw = BigInt(multiplyByPowerOfTen(quote.inputAmount, tokenDetails.decimals).toFixed(0, 0)); + + const evmClientManager = EvmClientManager.getInstance(); + balance = tokenDetails.isNative + ? await evmClientManager.getBalanceWithRetry(network, walletAddress as `0x${string}`) + : await evmClientManager.readContractWithRetry(network, { + abi: erc20Abi, + address: tokenDetails.erc20AddressSourceChain, + args: [walletAddress as `0x${string}`], + functionName: "balanceOf" + }); + } catch { + return; + } + + if (balance < requiredRaw) { + throw new InsufficientBalanceError(quote.inputAmount, quote.inputCurrency, network, walletAddress); + } +} From 7aaa22ca381509a94d8ffda20aba3d782979359c Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Fri, 3 Jul 2026 19:27:53 +0200 Subject: [PATCH 083/176] Slightly adjust examples --- packages/sdk/examples/exampleAlfredpayMexico.ts | 17 +++++++++++++---- packages/sdk/examples/exampleBrlOnramp.ts | 3 +-- packages/sdk/examples/exampleMxnOnramp.ts | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/packages/sdk/examples/exampleAlfredpayMexico.ts b/packages/sdk/examples/exampleAlfredpayMexico.ts index 73559e77a..68962d24c 100644 --- a/packages/sdk/examples/exampleAlfredpayMexico.ts +++ b/packages/sdk/examples/exampleAlfredpayMexico.ts @@ -30,9 +30,11 @@ const OFFRAMP_WALLET_PRIVATE_KEY = process.env.OFFRAMP_WALLET_PRIVATE_KEY as `0x const OFFRAMP_WALLET_ADDRESS = OFFRAMP_WALLET_PRIVATE_KEY ? privateKeyToAccount(OFFRAMP_WALLET_PRIVATE_KEY).address : "0xYOUR_WALLET_ADDRESS"; -const DESTINATION_ADDRESS = "0xYOUR_WALLET_ADDRESS"; -const WALLET_ADDRESS = "0xYOUR_WALLET_ADDRESS"; -const FIAT_ACCOUNT_ID = "00000000-0000-0000-0000-000000000000"; +const DESTINATION_ADDRESS = "0x69183DDa3112c5F45201c579A26f605e60ba5741"; +const WALLET_ADDRESS = "0x69183DDa3112c5F45201c579A26f605e60ba5741"; +const FIAT_ACCOUNT_ID = "c7be4dbd-5bac-448e-8f98-12601d5fa590"; +const VORTEX_PUBLIC_KEY = process.env.VORTEX_PUBLIC_KEY; +const VORTEX_SECRET_KEY = process.env.VORTEX_SECRET_KEY; function askQuestion(query: string): Promise { const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); @@ -46,7 +48,8 @@ function askQuestion(query: string): Promise { function buildSdk(): VortexSdk { const config: VortexSdkConfig = { - apiBaseUrl: process.env.VORTEX_API_URL ?? "http://localhost:3000", + // apiBaseUrl: "api.vortexfinance.co", + apiBaseUrl: "http://localhost:3000", autoReconnect: true, publicKey: process.env.VORTEX_PUBLIC_KEY ?? "", // Must be the user's user-linked sk_* key, not a partner-only key. @@ -80,7 +83,13 @@ function readEphemeralEvmAddress(rampId: string): string | undefined { // Onramp: MXN -> USDC. User pays SPEI instructions; crypto lands at destinationAddress. // No user-signed transactions; fiatAccountId is NOT required for onramp. +// SDK/API clients should authenticate with VORTEX_PUBLIC_KEY/VORTEX_SECRET_KEY. +// Note: the current backend still needs a completed Alfredpay KYC customer context for registration. async function runMexicoOnramp(sdk: VortexSdk): Promise { + if (!VORTEX_PUBLIC_KEY || !VORTEX_SECRET_KEY) { + throw new Error("VORTEX_PUBLIC_KEY and VORTEX_SECRET_KEY are required for SDK API-client examples."); + } + console.log("📝 Step 1: Creating quote for MXN onramp (MXN -> USDC via SPEI)..."); const quoteRequest: CreateQuoteRequest = { from: EPaymentMethod.SPEI, diff --git a/packages/sdk/examples/exampleBrlOnramp.ts b/packages/sdk/examples/exampleBrlOnramp.ts index 40f56067d..855329803 100644 --- a/packages/sdk/examples/exampleBrlOnramp.ts +++ b/packages/sdk/examples/exampleBrlOnramp.ts @@ -35,13 +35,12 @@ async function runBrlOnrampExample() { console.log("📝 Step 2: Creating quote for BRL onramp..."); const quoteRequest: CreateQuoteRequest = { from: EPaymentMethod.PIX, - inputAmount: "100", + inputAmount: "5", inputCurrency: FiatToken.BRL, network: Networks.Polygon, outputCurrency: EvmToken.USDC, rampType: RampDirection.BUY, to: Networks.Polygon - //partnerId: "example-partner" }; const quote = (await sdk.createQuote(quoteRequest)) as QuoteResponse; diff --git a/packages/sdk/examples/exampleMxnOnramp.ts b/packages/sdk/examples/exampleMxnOnramp.ts index ce2fcf880..14712c9c3 100644 --- a/packages/sdk/examples/exampleMxnOnramp.ts +++ b/packages/sdk/examples/exampleMxnOnramp.ts @@ -65,7 +65,7 @@ async function runMxnOnrampExample() { console.log("📝 Step 2: Creating quote for MXN onramp (MXN -> USDC via SPEI)..."); const quoteRequest: CreateQuoteRequest = { from: EPaymentMethod.SPEI, - inputAmount: "201", + inputAmount: "150", inputCurrency: FiatToken.MXN, network: Networks.Polygon, outputCurrency: EvmToken.USDC, From 07a5799a8d6b141021823a6cb43ee3cedad6fe3d Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Fri, 3 Jul 2026 19:28:10 +0200 Subject: [PATCH 084/176] feat(sdk): add balance check before permit execution to prevent failures --- .../squidrouter-permit-execution-handler.ts | 74 +++++++++++++++++-- 1 file changed, 66 insertions(+), 8 deletions(-) diff --git a/apps/api/src/api/services/phases/handlers/squidrouter-permit-execution-handler.ts b/apps/api/src/api/services/phases/handlers/squidrouter-permit-execution-handler.ts index 96f951d06..89ccc2ba1 100644 --- a/apps/api/src/api/services/phases/handlers/squidrouter-permit-execution-handler.ts +++ b/apps/api/src/api/services/phases/handlers/squidrouter-permit-execution-handler.ts @@ -7,6 +7,7 @@ import { RampPhase, SignedTypedData } from "@vortexfi/shared"; +import { erc20Abi } from "viem"; import { privateKeyToAccount } from "viem/accounts"; import logger from "../../../../config/logger"; import { config } from "../../../../config/vars"; @@ -76,6 +77,42 @@ export class SquidrouterPermitExecuteHandler extends BasePhaseHandler { return "squidRouterPermitExecute"; } + // Give the owner time to fund the wallet before the single-use permit is spent (see + // assertOwnerHasBalance). At the processor's 30s retry cadence this is ~10 minutes. + public getMaxRetries(): number { + return 20; + } + + // A signed EIP-2612 permit is single-use: the token increments the owner's nonce on the first + // successful permit() call, so the stored signature cannot be replayed ("INVALID-PERMIT"). + // Confirm the owner holds `value` before touching the permit; if not, throw a recoverable error + // so the phase retries (waiting for funds) instead of burning the permit on a doomed attempt. + // If the permit was already consumed on an earlier attempt, its allowance persists and the + // direct-transfer path skips permit() on retry (see executeDirectTransfer). + private async assertOwnerHasBalance( + fromNetwork: EvmNetworks, + token: `0x${string}`, + owner: `0x${string}`, + value: bigint + ): Promise { + const publicClient = this.evmClientManager.getClient(fromNetwork); + const balance = await publicClient.readContract({ + abi: erc20Abi, + address: token, + args: [owner], + functionName: "balanceOf" + }); + + if (balance < value) { + throw this.createRecoverableError( + `Owner ${owner} has insufficient ${token} balance for permit execution: has ${balance}, needs ${value}. ` + + "Waiting for funds before sending the single-use permit." + ); + } + + logger.info(`Owner ${owner} balance ${balance} covers required ${value} for permit execution`); + } + private getExecutorClients(fromNetwork: EvmNetworks) { const executorAccount = privateKeyToAccount(config.secrets.moonbeamExecutorPrivateKey as `0x${string}`); return { @@ -171,17 +208,35 @@ export class SquidrouterPermitExecuteHandler extends BasePhaseHandler { const { walletClient, publicClient } = this.getExecutorClients(fromNetwork); - const permitHash = await walletClient.writeContract({ - abi: permitAbi, + // Guard the single-use permit: bail out (recoverably) if the owner cannot cover the transfer. + await this.assertOwnerHasBalance(fromNetwork, token, owner, value); + + // permit() and transferFrom() are separate transactions, so a failed transfer leaves the + // allowance from an already-consumed permit standing. Only send permit() if that allowance + // is not already in place — this makes retries idempotent: once the permit landed, every + // retry goes straight to transferFrom instead of replaying the spent (now invalid) permit. + const allowance = await publicClient.readContract({ + abi: erc20Abi, address: token, - args: [owner, spender, value, deadline, permitSig.v, permitSig.r, permitSig.s], - functionName: "permit" + args: [owner, spender], + functionName: "allowance" }); - logger.info(`Direct transfer permit tx sent: ${permitHash}`); - const permitReceipt = await publicClient.waitForTransactionReceipt({ hash: permitHash }); - if (!permitReceipt || permitReceipt.status !== "success") { - throw this.createRecoverableError(`Direct transfer permit tx failed: ${permitHash}`); + if (allowance >= value) { + logger.info(`Existing allowance ${allowance} covers required ${value}, skipping permit for ramp ${state.id}`); + } else { + const permitHash = await walletClient.writeContract({ + abi: permitAbi, + address: token, + args: [owner, spender, value, deadline, permitSig.v, permitSig.r, permitSig.s], + functionName: "permit" + }); + logger.info(`Direct transfer permit tx sent: ${permitHash}`); + + const permitReceipt = await publicClient.waitForTransactionReceipt({ hash: permitHash }); + if (!permitReceipt || permitReceipt.status !== "success") { + throw this.createRecoverableError(`Direct transfer permit tx failed: ${permitHash}`); + } } const transferHash = await walletClient.writeContract({ @@ -219,6 +274,9 @@ export class SquidrouterPermitExecuteHandler extends BasePhaseHandler { const { walletClient } = this.getExecutorClients(fromNetwork); + // Guard the single-use permit: bail out (recoverably) if the owner cannot cover the transfer. + await this.assertOwnerHasBalance(fromNetwork, token, owner, value); + const hash = await walletClient.writeContract({ abi: tokenRelayerAbi, address: getRelayerAddress(fromNetwork), From 22641b957de8c1efdcd7ce5f3fae6a8eaaeb353a Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Fri, 3 Jul 2026 19:38:54 +0200 Subject: [PATCH 085/176] Add preflight balance checks to some handlers --- .../alfredpay-offramp-transfer-handler.ts | 15 ++++ .../handlers/brla-payout-base-handler.ts | 12 +++ .../api/services/phases/handlers/helpers.ts | 74 ++++++++++++++++++- .../phases/handlers/mykobo-payout-handler.ts | 12 +++ .../03-ramp-engine/ramp-phase-flows.md | 3 + .../05-integrations/alfredpay.md | 1 + docs/security-spec/05-integrations/brla.md | 1 + docs/security-spec/05-integrations/mykobo.md | 1 + 8 files changed, 118 insertions(+), 1 deletion(-) diff --git a/apps/api/src/api/services/phases/handlers/alfredpay-offramp-transfer-handler.ts b/apps/api/src/api/services/phases/handlers/alfredpay-offramp-transfer-handler.ts index d4ef4dcc1..1673a60f8 100644 --- a/apps/api/src/api/services/phases/handlers/alfredpay-offramp-transfer-handler.ts +++ b/apps/api/src/api/services/phases/handlers/alfredpay-offramp-transfer-handler.ts @@ -14,6 +14,7 @@ import logger from "../../../../config/logger"; import RampState from "../../../../models/rampState.model"; import { BasePhaseHandler } from "../base-phase-handler"; import { StateMetadata } from "../meta-state-types"; +import { ensurePresignedTransferFunded } from "./helpers"; const ALFREDPAY_POLL_INTERVAL_MS = 30000; const ALFREDPAY_OFFRAMP_TIMEOUT_MS = 10 * 60 * 1000; // 10 minutes @@ -76,6 +77,20 @@ export class AlfredpayOfframpTransferHandler extends BasePhaseHandler { const { txData: offrampTransfer } = this.getPresignedTransaction(state, "alfredpayOfframpTransfer"); + // The presigned transfer is single-use (fixed nonce, consumed even on revert); confirm the + // ephemeral can cover it before broadcasting. + try { + await ensurePresignedTransferFunded( + offrampTransfer as `0x${string}`, + Networks.Polygon as EvmNetworks, + this.getPhaseName() + ); + } catch (error) { + throw this.createRecoverableError( + `AlfredpayOfframpTransferHandler: ephemeral balance does not cover the presigned final transfer: ${error instanceof Error ? error.message : String(error)}` + ); + } + const txHash = await evmClientManager.sendRawTransactionWithRetry( Networks.Polygon as EvmNetworks, offrampTransfer as `0x${string}` diff --git a/apps/api/src/api/services/phases/handlers/brla-payout-base-handler.ts b/apps/api/src/api/services/phases/handlers/brla-payout-base-handler.ts index c5ad18fea..24a2905f9 100644 --- a/apps/api/src/api/services/phases/handlers/brla-payout-base-handler.ts +++ b/apps/api/src/api/services/phases/handlers/brla-payout-base-handler.ts @@ -15,6 +15,7 @@ import TaxId from "../../../../models/taxId.model"; import { PhaseError } from "../../../errors/phase-error"; import { BasePhaseHandler } from "../base-phase-handler"; import { StateMetadata } from "../meta-state-types"; +import { ensurePresignedTransferFunded } from "./helpers"; function getErrorMessage(error: unknown): string { return error instanceof Error ? error.message : String(error); @@ -192,6 +193,16 @@ export class BrlaPayoutOnBasePhaseHandler extends BasePhaseHandler { logger.info(`BrlaPayoutOnBasePhaseHandler: Existing transaction ${brlaPayoutTxHash} succeeded.`); } } else { + // The presigned payout is single-use (fixed nonce, consumed even on revert); confirm the + // ephemeral can cover it before broadcasting. + try { + await ensurePresignedTransferFunded(brlaPayoutTx as `0x${string}`, Networks.Base, this.getPhaseName()); + } catch (error) { + throw this.createRecoverableError( + `BrlaPayoutOnBasePhaseHandler: ephemeral balance does not cover the presigned payout: ${getErrorMessage(error)}` + ); + } + txHash = (await evmClientManager.sendRawTransactionWithRetry( Networks.Base, brlaPayoutTx as `0x${string}` @@ -213,6 +224,7 @@ export class BrlaPayoutOnBasePhaseHandler extends BasePhaseHandler { }); } } catch (error) { + if (error instanceof PhaseError) throw error; logger.error("BrlaPayoutOnBasePhaseHandler: Failed to send BRLA payout transaction.", error); throw this.createRecoverableError("Failed to send BRLA payout transaction"); } diff --git a/apps/api/src/api/services/phases/handlers/helpers.ts b/apps/api/src/api/services/phases/handlers/helpers.ts index f745eed0d..6575e364b 100644 --- a/apps/api/src/api/services/phases/handlers/helpers.ts +++ b/apps/api/src/api/services/phases/handlers/helpers.ts @@ -1,6 +1,15 @@ -import { API, EvmClientManager, EvmNetworks, Networks as VortexNetworks } from "@vortexfi/shared"; +import { + API, + checkEvmBalancePeriodically, + checkEvmNativeBalancePeriodically, + EvmClientManager, + EvmNetworks, + Networks as VortexNetworks +} from "@vortexfi/shared"; import Big from "big.js"; +import { decodeFunctionData, erc20Abi, parseTransaction, recoverTransactionAddress, type TransactionSerialized } from "viem"; import { base, polygon } from "viem/chains"; +import logger from "../../../../config/logger"; import { BASE_EPHEMERAL_STARTING_BALANCE_UNITS, GLMR_FUNDING_AMOUNT_RAW, @@ -89,3 +98,66 @@ export async function isDestinationEvmEphemeralFunded( return Big(balance.toString()).gte(fundingAmountRaw); } + +const PRESIGNED_TRANSFER_BALANCE_POLL_MS = 5000; +const PRESIGNED_TRANSFER_BALANCE_TIMEOUT_MS = 3 * 60 * 1000; + +/** + * Guard for broadcasting a presigned single-use transfer: a revert still consumes the fixed + * nonce, after which the presigned payload can never be re-broadcast and the funds strand on + * the ephemeral. Decode sender, token and amount from the signed raw transaction and poll until + * the sender's balance covers the transfer, so a short-funded ephemeral surfaces as a phase + * error instead of a burned nonce. Decode failures are logged and skipped — this guard must + * never block a well-formed broadcast path. + * + * Rejects with a BalanceCheckError when the balance does not cover the transfer within the + * timeout (or the balance read fails); callers wrap that in a recoverable phase error. + */ +export async function ensurePresignedTransferFunded(rawTx: `0x${string}`, network: EvmNetworks, phase: string): Promise { + let sender: `0x${string}`; + let tokenAddress: `0x${string}` | undefined; + let amountRaw: bigint; + + try { + const decoded = parseTransaction(rawTx); + sender = (await recoverTransactionAddress({ serializedTransaction: rawTx as TransactionSerialized })) as `0x${string}`; + + if (!decoded.data || decoded.data === "0x") { + amountRaw = decoded.value ?? 0n; + } else { + const { functionName, args } = decodeFunctionData({ abi: erc20Abi, data: decoded.data }); + if (functionName !== "transfer" || !decoded.to) { + // Not a plain transfer; there is no single balance requirement to assert here. + return; + } + tokenAddress = decoded.to as `0x${string}`; + amountRaw = args[1]; + } + } catch (error) { + logger.warn(`${phase}: could not decode presigned transfer for balance pre-check - ${(error as Error).message}`); + return; + } + + if (amountRaw <= 0n) { + return; + } + + if (tokenAddress) { + await checkEvmBalancePeriodically( + tokenAddress, + sender, + amountRaw.toString(), + PRESIGNED_TRANSFER_BALANCE_POLL_MS, + PRESIGNED_TRANSFER_BALANCE_TIMEOUT_MS, + network + ); + } else { + await checkEvmNativeBalancePeriodically( + sender, + amountRaw.toString(), + PRESIGNED_TRANSFER_BALANCE_POLL_MS, + PRESIGNED_TRANSFER_BALANCE_TIMEOUT_MS, + network + ); + } +} diff --git a/apps/api/src/api/services/phases/handlers/mykobo-payout-handler.ts b/apps/api/src/api/services/phases/handlers/mykobo-payout-handler.ts index ad07596eb..a37710ec6 100644 --- a/apps/api/src/api/services/phases/handlers/mykobo-payout-handler.ts +++ b/apps/api/src/api/services/phases/handlers/mykobo-payout-handler.ts @@ -4,6 +4,7 @@ import RampState from "../../../../models/rampState.model"; import { PhaseError } from "../../../errors/phase-error"; import { BasePhaseHandler } from "../base-phase-handler"; import { StateMetadata } from "../meta-state-types"; +import { ensurePresignedTransferFunded } from "./helpers"; const POLL_INTERVAL_MS = 5_000; const POLL_TIMEOUT_MS = 10 * 60 * 1000; @@ -46,6 +47,16 @@ export class MykoboPayoutOnBasePhaseHandler extends BasePhaseHandler { logger.warn(`MykoboPayoutOnBasePhaseHandler: Existing tx ${mykoboPayoutTxHash} failed. Re-sending.`); } + // The presigned payout is single-use (fixed nonce, consumed even on revert); confirm the + // ephemeral can cover it before broadcasting. + try { + await ensurePresignedTransferFunded(payoutTx as `0x${string}`, Networks.Base, this.getPhaseName()); + } catch (error) { + throw this.createRecoverableError( + `MykoboPayoutOnBasePhaseHandler: ephemeral balance does not cover the presigned payout: ${error instanceof Error ? error.message : String(error)}` + ); + } + const txHash = (await evmClientManager.sendRawTransactionWithRetry( Networks.Base, payoutTx as `0x${string}` @@ -65,6 +76,7 @@ export class MykoboPayoutOnBasePhaseHandler extends BasePhaseHandler { }); logger.info(`MykoboPayoutOnBasePhaseHandler: Transaction ${txHash} confirmed.`); } catch (error) { + if (error instanceof PhaseError) throw error; logger.error("MykoboPayoutOnBasePhaseHandler: Failed to send Mykobo payout tx.", error); throw this.createRecoverableError("Failed to send Mykobo payout transaction"); } diff --git a/docs/security-spec/03-ramp-engine/ramp-phase-flows.md b/docs/security-spec/03-ramp-engine/ramp-phase-flows.md index 4ce4823f9..8e142d155 100644 --- a/docs/security-spec/03-ramp-engine/ramp-phase-flows.md +++ b/docs/security-spec/03-ramp-engine/ramp-phase-flows.md @@ -188,6 +188,7 @@ graph TD 9. **On same-chain destinations, `destinationTransfer` MUST be the first executable nonce after the broadcast SquidRouter txs — no nonce gap** — When the SquidRouter source chain equals the destination chain (e.g., EUR → Base EURC, BRL → Base USDC, Alfredpay Polygon-internal), the ephemeral shares ONE nonce sequence for `squidRouterApprove` → `squidRouterSwap` → `destinationTransfer`. The runtime broadcasts these in order, so `destinationTransfer` MUST carry the nonce immediately following `squidRouterSwap`. Two failure modes must both be avoided: (a) **collision** — reusing a nonce already consumed by an earlier tx; (b) **gap** — signing `destinationTransfer` with a nonce *above* the next live nonce, which the chain rejects as "nonce too high" so the tx never mines and user funds strand on the ephemeral (root cause of the EUR→Base 0-delivery incident: `destinationTransfer` was signed after the post-`complete` cleanup approvals — and, originally, after handler-less backup re-swap txs — leaving a 1–2 nonce gap). The route builders therefore place `destinationTransfer` directly after `squidRouterSwap`, then append the post-`complete` cleanup approvals, and OMIT the backup re-swap txs on the same-chain branch (those have no registered handler — F-054 — and on a shared sequence would only widen the gap). Enforced in `mykobo-to-evm.ts`, `alfredpay-to-evm.ts`, and `avenia-to-evm-base.ts`. 10. **`destinationTransfer` MUST fail fast on a detectable nonce gap rather than retry-and-strand** — `destination-transfer-handler.ts` reads the ephemeral's live nonce (`getTransactionCount`, `blockTag: "pending"`) and compares it to the presigned `destinationTransfer` nonce before broadcasting. If the presigned nonce is *ahead* of the live nonce the transfer can never mine, so the handler raises an `UnrecoverablePhaseError` for manual review instead of looping until the retry budget silently exhausts (which previously stranded funds with no terminal signal). Using `"pending"` rather than `"latest"` ensures the check accounts for mempool transactions — a prior ephemeral tx still in the mempool would otherwise lower the observed nonce and falsely flag a gap. The live-nonce read is best-effort: an RPC failure or a malformed presigned transaction logs a warning and falls through to the normal balance-poll path, so a transient RPC outage or an unparseable tx cannot wedge the happy path. 11. **Base EVM `nablaSwap` MUST be dry-run before broadcast** — `nabla-swap-handler.ts` must simulate the exact presigned raw swap transaction with `eth_call` from the Base ephemeral account before calling `sendRawTransaction`. The dry-run MUST use the decoded transaction's actual recipient, calldata, value, gas, and fee fields, and should use `blockTag: "pending"` so liquidity-sensitive failures are checked against the freshest available Base state. If the simulation reverts (for example `SP:quoteSwapInto:EXCEEDS_MAX_COVERAGE_RATIO`), the handler MUST fail before submitting the transaction so the ephemeral does not spend gas on a predictably reverting swap. +12. **Presigned payout transfers MUST be balance-checked before broadcast** — `alfredpayOfframpTransfer`, `mykoboPayoutOnBase`, and `brlaPayoutOnBase` broadcast presigned ephemeral transfers for a fixed amount decided at registration time. A revert consumes the presigned nonce, after which the payload can never be re-broadcast and funds strand on the ephemeral. `ensurePresignedTransferFunded` (`handlers/helpers.ts`) recovers the sender from the signed raw transaction, decodes token and amount from the `transfer` calldata (or native value), and polls (5s interval, 3-minute timeout) until the sender's balance covers the transfer; on timeout the handler raises a **recoverable** error so the phase retries instead of burning the nonce. The guard is best-effort on decode: an unparseable or non-`transfer` payload logs a warning and falls through to the broadcast (same posture as the `destinationTransfer` nonce guard), so a malformed guard cannot wedge the happy path. ## Threat Vectors & Mitigations @@ -203,6 +204,7 @@ graph TD | **Wrong-chain signer on SquidRouter** | RPC selected from `inputCurrency` heuristic instead of `bridgeMeta.fromNetwork`; EUR-onramp presigned txs (`network: Networks.Base`) submitted on Polygon RPC → `invalid chain id for signer` and the ramp stalls in `squidRouterSwap`. | `squid-router-phase-handler.ts` reads `bridgeMeta.fromNetwork` (set by the route builder) and routes both approve+swap to that chain's client. Heuristic removed. | | **Same-chain destination nonce gap (0-delivery)** | SquidRouter source chain == destination chain (e.g. EUR → Base EURC). `destinationTransfer` is signed *after* the post-`complete` cleanup approvals (and handler-less backup re-swap txs), leaving its nonce above the live ephemeral nonce. The chain rejects it as "nonce too high"; it never mines, the ramp retries until the budget exhausts, and user funds strand on the ephemeral with no terminal signal. | Route builders (`mykobo-to-evm.ts`, `alfredpay-to-evm.ts`, `avenia-to-evm-base.ts`) place `destinationTransfer` at the first nonce after `squidRouterSwap`, append cleanups afterward, and omit the same-chain backup re-swap txs. `destination-transfer-handler.ts` additionally fails fast (`UnrecoverablePhaseError`) when the presigned nonce is detected ahead of the live nonce. | | **Predictable EVM Nabla swap revert** | Base Nabla pool liquidity or coverage-ratio constraints make the presigned swap impossible before it is broadcast. Without preflight, the ephemeral submits a transaction that reverts on-chain, wastes gas, and only fails after receipt polling. | The EVM branch of `nabla-swap-handler.ts` runs `eth_call` on the exact decoded presigned raw transaction from the ephemeral account with `blockTag: "pending"`. A simulation revert aborts before `sendRawTransaction`, preserving the revert reason in the phase error log. | +| **Short-funded ephemeral burns a presigned payout nonce** | The provider settles slightly less than quoted, or a subsidy is capped/skipped, so the ephemeral holds less than the presigned payout amount. Broadcasting anyway reverts, consumes the fixed nonce, and the presigned transfer can never be re-broadcast — funds strand on the ephemeral with only manual recovery. | `alfredpayOfframpTransfer`, `mykoboPayoutOnBase`, and `brlaPayoutOnBase` call `ensurePresignedTransferFunded` before their first broadcast: sender/token/amount are decoded from the signed raw tx and the sender balance is polled (3-minute timeout) before `sendRawTransaction`; a shortfall raises a recoverable error so the nonce is never spent on a doomed transfer. | ## Audit Checklist @@ -217,6 +219,7 @@ graph TD - [x] Moonbeam handler refreshes gas estimate per retry attempt (F-028, fixed) - [x] `post-swap-handler` has explicit default rejection for unrecognized routing combinations (F-031, fixed) - [x] `distributeFees` is a non-terminal phase — failure triggers retry, not silent skip +- [x] `alfredpayOfframpTransfer`, `mykoboPayoutOnBase`, and `brlaPayoutOnBase` run `ensurePresignedTransferFunded` before the first broadcast of their presigned single-use transfer — sender recovered from the signature, token/amount decoded from calldata, balance polled with a 3-minute timeout, shortfall raised as a recoverable error. Decode failures warn and fall through (best-effort). - [EXISTING FINDING] **F-053**: Five phase handlers lack idempotency guards — `stellar-payment-handler`, `pendulum-to-assethub-phase-handler`, `pendulum-to-hydration-xcm-phase-handler`, `hydration-swap-handler`, `nabla-swap-handler` can double-execute on retry. - [EXISTING FINDING] **F-054**: Backup presigned transactions (`backupSquidRouterApprove`, `backupSquidRouterSwap`, `backupApprove`) have no registered phase handlers — dead code or missing implementation. - [ ] No aggregate cross-ramp subsidy rate limiting — many concurrent ramps could drain funding account diff --git a/docs/security-spec/05-integrations/alfredpay.md b/docs/security-spec/05-integrations/alfredpay.md index 054b32c52..1e210b9d0 100644 --- a/docs/security-spec/05-integrations/alfredpay.md +++ b/docs/security-spec/05-integrations/alfredpay.md @@ -56,6 +56,7 @@ For routed Alfredpay onramps (any non-passthrough output), the final quote outpu 15. **Routed Alfredpay onramp quote output precision MUST match the destination token** — For Alfredpay USD/MXN/COP/ARS onramps that route through Squid, `quote.outputAmount` MUST preserve the final destination token's decimal precision, and `evmToEvm.outputAmountRaw` MUST represent the destination token's raw units. The Polygon-minted Alfredpay token is only the Squid source-side input. Direct Polygon same-token passthrough remains at the minted token's 6-decimal precision. 16. **Alfredpay ramp registration MUST bind to a completed KYC/KYB customer** — Registration MUST reject Alfredpay onramps before customer lookup when no completed Alfredpay customer context is available, and MUST reject customer records whose Alfredpay status is not `Success`. This prevents ramps from reaching provider/customer queries with undefined `user_id` and ensures payment instructions are only issued for verified Alfredpay customers. SDK/server integrations authenticate with partner API keys (`pk_*`/`sk_*`); Supabase Bearer tokens are frontend/user-session auth. 17. **Alfredpay ramp registration MUST derive the customer id from the effective user; quotes carry only tracking metadata** — The off-ramp transaction route, the on-ramp route, the register-time quote refresh, and the off-ramp transfer recovery path all resolve `alfredPayId` via the strict, KYC-gated `resolveAlfredpayCustomerId(fiatCurrency, effectiveUserId)`. Quote creation is anonymous-eligible: the on-ramp initialize engine and off-ramp partner engine use `resolveAlfredpayQuoteCustomerId`, which fills the *tracking-only* quote `metadata.customerId` with the caller's real customer id when a KYC-completed customer resolves, and the `"anonymous"` sentinel otherwise. Alfredpay validates the top-level `customerId` only on order creation, so no provider *order* ever carries a placeholder identity. Public keys and unlinked secret keys can quote but cannot register Alfredpay ramps. +18. **`alfredpayOfframpTransfer` MUST verify the ephemeral's token balance before the first broadcast of the presigned transfer** — The presigned final transfer is single-use (its nonce is consumed even on revert), so the handler calls `ensurePresignedTransferFunded` before `sendRawTransaction`: sender/token/amount are decoded from the signed raw tx and the Polygon ephemeral balance is polled (3-minute timeout); a shortfall raises a recoverable error instead of burning the nonce. This complements invariant 14 (`finalSettlementSubsidy` ordering) by also catching capped/failed subsidies. See `03-ramp-engine/ramp-phase-flows.md` invariant 12. ## Threat Vectors & Mitigations diff --git a/docs/security-spec/05-integrations/brla.md b/docs/security-spec/05-integrations/brla.md index 6637f8c4e..f5b5dd0d8 100644 --- a/docs/security-spec/05-integrations/brla.md +++ b/docs/security-spec/05-integrations/brla.md @@ -79,6 +79,7 @@ The invariant `transferAmount ≥ payoutAmount` must hold (transfer covers payou 17. **`/v1/brla/getUser` and `/v1/brla/getUserRemainingLimit` MUST scope reads to the effective user** — When a `taxId` query is provided, the `TaxId` row MUST be owned by `getEffectiveUserId(req)`. When `taxId` is omitted, the endpoint derives the user's Avenia account via the resolver and returns `400` for zero or multiple KYC-completed matches. The legacy partner-key exemption that allowed reading any taxId has been removed; bare partner keys (no `api_keys.user_id` binding) and fully anonymous callers are rejected with `400`. 18. **`/v1/brla/createSubaccount` MUST require an authenticated principal** — The route now uses `requirePartnerOrUserAuth()` and the controller requires an effective user. Bare partner keys and anonymous callers receive `400`; the Avenia API is not called and no `TaxId` row is created. This closes the anonymous subaccount creation DoS surface. 19. **BRL quote creation MUST remain anonymous-eligible while register/start remain user-gated** — `POST /v1/quotes` and `POST /v1/quotes/best` accept BRL corridors from anonymous callers and partner-key callers (with or without a `userId` binding). The Avenia `createPayInQuote` calls used by the BRL engines do not require a user-bound principal. The actual Avenia subaccount/taxId resolution still happens server-side at register time via `resolveAveniaAccountForRamp(effectiveUserId, additionalData.taxId)`. `POST /v1/ramp/register` requires Supabase or secret-key credentials, and `RampService.registerRamp` rejects provider-backed ramps without an effective user with `400 Invalid quote`. **An anonymous BRL quote may be claimed by an authenticated caller** (the normal web-app funnel: quote before login, register after) — claiming is not an escalation because the anonymous quote carries no owner and the Avenia identity is derived from the claimer's own KYC records, never from the quote or request body. +20. **`brlaPayoutOnBase` MUST verify the ephemeral's BRLA balance before the first broadcast of the presigned transfer** — The presigned payout is single-use (its nonce is consumed even on revert), so the handler calls `ensurePresignedTransferFunded` before `sendRawTransaction`: sender/token/amount are decoded from the signed raw tx and the ephemeral balance is polled (3-minute timeout); a shortfall raises a recoverable error instead of burning the nonce. The Avenia-side balance poll (invariant 4) runs after this on-chain transfer and does not replace it. See `03-ramp-engine/ramp-phase-flows.md` invariant 12. ## Threat Vectors & Mitigations diff --git a/docs/security-spec/05-integrations/mykobo.md b/docs/security-spec/05-integrations/mykobo.md index 32b48be6c..70fe946e6 100644 --- a/docs/security-spec/05-integrations/mykobo.md +++ b/docs/security-spec/05-integrations/mykobo.md @@ -92,6 +92,7 @@ Unlike Monerium (`moneriumOnrampMint` + `moneriumOnrampSelfTransfer`), Vortex do 22. **The EUR→EURC-on-Base on-ramp MUST take the direct-transfer bypass** — When `inputCurrency === EURC`, `outputCurrency === EURC`, and `network === Base`, `isEurToEurcBaseDirect` MUST short-circuit the route to a single `destinationTransfer` from the ephemeral to the user, with `stateMeta.isDirectTransfer = true`. The Nabla swap, SquidRouter, `finalSettlementSubsidy`, and Base cleanup phases MUST NOT run — routing EURC through USDC and back would burn double-swap slippage/fees against the user and expose the over-subsidy race (`06-cross-chain/fund-routing.md`). The `finalSettlementSubsidy` handler MUST also honor `isDirectTransfer`/`isEurToEurcBaseDirect` defensively and skip to `destinationTransfer` if reached. 23. **EUR ramp registration MUST derive the Mykobo email from the effective user and require approved Mykobo KYC** — Both the on-ramp (`prepareMykoboOnrampTransactions`) and off-ramp (`evm-to-mykobo.ts`) resolve the Mykobo `email_address` via `resolveMykoboCustomerForUser(userId, providedEmail?)`, which (a) reads the canonical email from the effective user's profile (`profiles.email` is unique and keyed by `userId`, so this works for both Supabase sessions and user-scoped secret keys), (b) accepts a client-supplied `additionalData.email` only when it matches the derived value and rejects mismatches with `400`, and (c) refreshes the Mykobo KYC mirror from the live profile and rejects with `400` unless the resulting `MykoboCustomer.status === APPROVED`. The client-supplied email is never passed to Mykobo directly, and the provider intent is created only after the gate passes. This mirrors the BRL/Avenia (`resolveAveniaAccountForUser`) and Alfredpay (`resolveAlfredpayCustomerId`) derivation+KYC pattern. Combined with the universal register-time effective-user requirement (`01-auth/api-keys.md` inv. 13), EUR ramps cannot be registered anonymously or with an unlinked key, and one user cannot drive a ramp against another user's Mykobo identity. 23. **Disabled EUR registration MUST fail before provider side effects** — While EUR ramps are disabled, `registerRamp` MUST reject any quote with `inputCurrency === FiatToken.EURC` or `outputCurrency === FiatToken.EURC` using `503 SERVICE_UNAVAILABLE` before Mykobo intent creation, presigned transaction preparation, quote consumption, or ramp-state creation. +24. **`mykoboPayoutOnBase` MUST verify the ephemeral's EURC balance before the first broadcast** — The presigned payout is single-use (its nonce is consumed even on revert), so the handler calls `ensurePresignedTransferFunded` before `sendRawTransaction`: sender/token/amount are decoded from the signed raw tx and the ephemeral balance is polled (3-minute timeout); a shortfall raises a recoverable error instead of burning the nonce. See `03-ramp-engine/ramp-phase-flows.md` invariant 12. ## Threat Vectors & Mitigations From 0e2ea4d42420f3d966942f1157547259abac4cb1 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Fri, 3 Jul 2026 19:49:46 +0200 Subject: [PATCH 086/176] Update package versions --- bun.lock | 4 ++-- packages/sdk/package.json | 4 ++-- packages/shared/package.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bun.lock b/bun.lock index 6eaa48629..98df570c2 100644 --- a/bun.lock +++ b/bun.lock @@ -258,7 +258,7 @@ }, "packages/sdk": { "name": "@vortexfi/sdk", - "version": "0.6.0", + "version": "0.7.0", "dependencies": { "@vortexfi/shared": "workspace:*", }, @@ -274,7 +274,7 @@ }, "packages/shared": { "name": "@vortexfi/shared", - "version": "0.1.2", + "version": "0.2.0", "dependencies": { "@paraspell/sdk-pjs": "^11.8.5", "@pendulum-chain/api-solang": "catalog:", diff --git a/packages/sdk/package.json b/packages/sdk/package.json index e18c2109e..74fbe023d 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "dependencies": { - "@vortexfi/shared": "=0.1.2" + "@vortexfi/shared": "=0.2.0" }, "devDependencies": { "@types/bun": "^1.3.1", @@ -51,5 +51,5 @@ }, "type": "module", "types": "./dist/index.d.ts", - "version": "0.6.0" + "version": "0.7.0" } diff --git a/packages/shared/package.json b/packages/shared/package.json index 759123877..a2fe414a1 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -61,5 +61,5 @@ "prepublishOnly": "bun run build" }, "types": "./dist/index.d.ts", - "version": "0.1.2" + "version": "0.2.0" } From 1415440e69d56db9ea48b1d2ee5bfbf751b5f277 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Fri, 3 Jul 2026 19:54:47 +0200 Subject: [PATCH 087/176] Remove obsolete exampleAlfredpayMexico.ts --- .../sdk/examples/exampleAlfredpayMexico.ts | 222 ------------------ 1 file changed, 222 deletions(-) delete mode 100644 packages/sdk/examples/exampleAlfredpayMexico.ts diff --git a/packages/sdk/examples/exampleAlfredpayMexico.ts b/packages/sdk/examples/exampleAlfredpayMexico.ts deleted file mode 100644 index 68962d24c..000000000 --- a/packages/sdk/examples/exampleAlfredpayMexico.ts +++ /dev/null @@ -1,222 +0,0 @@ -// Manual end-to-end example for the Mexico (MXN) Alfredpay flow, both directions. -// MXN settles via SPEI (EPaymentMethod.SPEI). Mirrors the README Alfredpay sections -// Real SDK contract: createQuote -> registerRamp -> (onramp: startRamp) / -// (offramp: sign user txs via submitUserSignature/submitUserTxHash) -> startRamp. -// -// Requires a running backend (default http://localhost:3000) with Alfredpay enabled. -// -// Prerequisites: authenticate with the user's own user-linked secretKey (their sk_* key), and that -// same user must have completed Alfredpay MXN KYC. Onboard the user through the Vortex app first; -// the SDK cannot mint keys or run KYC. Offramp also needs that user's FIAT_ACCOUNT_ID below. -// -// Env: VORTEX_API_URL, VORTEX_PUBLIC_KEY, VORTEX_SECRET_KEY (user-linked), OFFRAMP_WALLET_PRIVATE_KEY. -// -// Run: -// cd packages/sdk -// bun run examples/exampleAlfredpayMexico.ts onramp -// bun run examples/exampleAlfredpayMexico.ts offramp # default - -import * as fs from "fs"; -import * as readline from "readline"; -import { privateKeyToAccount } from "viem/accounts"; -import { CreateQuoteRequest, EPaymentMethod, EvmToken, FiatToken, Networks, QuoteResponse, RampDirection } from "../src/index"; -import { VortexSdkConfig } from "../src/types"; -import { VortexSdk } from "../src/VortexSdk"; - -// Optional: sign offramp permits locally (viem) with a throwaway wallet that holds the test USDC. -// viem derives the EIP712Domain canonically, so its signatures match the backend's ethers -// verifyTypedData exactly. If unset, you sign in your own wallet and paste the signature. -const OFFRAMP_WALLET_PRIVATE_KEY = process.env.OFFRAMP_WALLET_PRIVATE_KEY as `0x${string}` | undefined; -const OFFRAMP_WALLET_ADDRESS = OFFRAMP_WALLET_PRIVATE_KEY - ? privateKeyToAccount(OFFRAMP_WALLET_PRIVATE_KEY).address - : "0xYOUR_WALLET_ADDRESS"; -const DESTINATION_ADDRESS = "0x69183DDa3112c5F45201c579A26f605e60ba5741"; -const WALLET_ADDRESS = "0x69183DDa3112c5F45201c579A26f605e60ba5741"; -const FIAT_ACCOUNT_ID = "c7be4dbd-5bac-448e-8f98-12601d5fa590"; -const VORTEX_PUBLIC_KEY = process.env.VORTEX_PUBLIC_KEY; -const VORTEX_SECRET_KEY = process.env.VORTEX_SECRET_KEY; - -function askQuestion(query: string): Promise { - const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); - return new Promise(resolve => { - rl.question(query, (ans: string) => { - rl.close(); - resolve(ans.trim()); - }); - }); -} - -function buildSdk(): VortexSdk { - const config: VortexSdkConfig = { - // apiBaseUrl: "api.vortexfinance.co", - apiBaseUrl: "http://localhost:3000", - autoReconnect: true, - publicKey: process.env.VORTEX_PUBLIC_KEY ?? "", - // Must be the user's user-linked sk_* key, not a partner-only key. - secretKey: process.env.VORTEX_SECRET_KEY ?? "", - storeEphemeralKeys: true - }; - return new VortexSdk(config); -} - -function logQuote(quote: QuoteResponse): void { - console.log("✅ Quote created:"); - console.log(` Quote ID: ${quote.id}`); - console.log(` Input: ${quote.inputAmount} ${quote.inputCurrency}`); - console.log(` Output: ${quote.outputAmount} ${quote.outputCurrency}`); - console.log(` Total Fee: ${quote.totalFeeFiat} ${quote.feeCurrency}`); - console.log(` Expires at: ${quote.expiresAt}\n`); -} - -// USDT on Polygon — the token Alfredpay mints; what you deposit to the ephemeral to simulate the fiat pay-in. -const USDT_POLYGON_ADDRESS = "0xc2132d05d31c914a87c6611c10748aeb04b58e8f"; // 6 decimals - -// The SDK writes ephemeral keys to ./ephemerals_.json (storeEphemeralKeys: true). -function readEphemeralEvmAddress(rampId: string): string | undefined { - try { - const items = JSON.parse(fs.readFileSync(`ephemerals_${rampId}.json`, "utf-8")); - return items.find((i: { type: string; address: string }) => i.type === "EVM")?.address; - } catch { - return undefined; - } -} - -// Onramp: MXN -> USDC. User pays SPEI instructions; crypto lands at destinationAddress. -// No user-signed transactions; fiatAccountId is NOT required for onramp. -// SDK/API clients should authenticate with VORTEX_PUBLIC_KEY/VORTEX_SECRET_KEY. -// Note: the current backend still needs a completed Alfredpay KYC customer context for registration. -async function runMexicoOnramp(sdk: VortexSdk): Promise { - if (!VORTEX_PUBLIC_KEY || !VORTEX_SECRET_KEY) { - throw new Error("VORTEX_PUBLIC_KEY and VORTEX_SECRET_KEY are required for SDK API-client examples."); - } - - console.log("📝 Step 1: Creating quote for MXN onramp (MXN -> USDC via SPEI)..."); - const quoteRequest: CreateQuoteRequest = { - from: EPaymentMethod.SPEI, - inputAmount: "201", - inputCurrency: FiatToken.MXN, - network: Networks.Polygon, - outputCurrency: EvmToken.USDC, - rampType: RampDirection.BUY, - to: Networks.Polygon - }; - - const quote = await sdk.createQuote(quoteRequest); - logQuote(quote); - - console.log("📝 Step 2: Registering onramp (destinationAddress only — fiatAccountId optional)..."); - const { rampProcess } = await sdk.registerRamp(quote, { - destinationAddress: DESTINATION_ADDRESS, - walletAddress: WALLET_ADDRESS - }); - console.log(`✅ Onramp registered. Ramp ID: ${rampProcess.id}`); - - console.log("📝 Step 3: Starting onramp..."); - const startedRamp = await sdk.startRamp(rampProcess.id); - - // To complete the onramp WITHOUT paying fiat, deposit USDT to the ephemeral so the - // alfredpayOnrampMint balance check passes (it trusts the on-chain balance as ground truth). - const ephemeralEvmAddress = readEphemeralEvmAddress(rampProcess.id); - console.log("\n🏦 To complete the onramp, deposit USDT on POLYGON to the ephemeral address:"); - console.log(` • Send USDT to: ${ephemeralEvmAddress ?? ``}`); - console.log(` • USDT token (Polygon): ${USDT_POLYGON_ADDRESS} (6 decimals)`); - console.log(` • Amount: a little more than ${quote.outputAmount} USDC-equivalent in USDT`); - console.log(" (exact raw amount is in the backend 'AlfredpayOnrampMintHandler: Waiting for ...' log)"); - - if (startedRamp.achPaymentData) { - console.log("\n(SPEI fiat instructions, not needed for the deposit-to-ephemeral test):"); - console.log(startedRamp.achPaymentData); - } -} - -// Offramp: USDC -> MXN. SDK returns user-side EVM transactions to sign; push the -// resulting hashes back via updateRamp, then start. fiatAccountId is REQUIRED here. -async function runMexicoOfframp(sdk: VortexSdk): Promise { - console.log("📝 Step 1: Creating quote for MXN offramp (USDC -> MXN via SPEI)..."); - const quoteRequest: CreateQuoteRequest = { - from: Networks.Polygon, - inputAmount: "10", - inputCurrency: EvmToken.USDC, - network: Networks.Polygon, - outputCurrency: FiatToken.MXN, - rampType: RampDirection.SELL, - to: EPaymentMethod.SPEI - }; - - const quote = await sdk.createQuote(quoteRequest); - logQuote(quote); - - console.log("📝 Step 2: Registering offramp (fiatAccountId + walletAddress required)..."); - const { rampProcess, unsignedTransactions } = await sdk.registerRamp(quote, { - fiatAccountId: FIAT_ACCOUNT_ID, - walletAddress: OFFRAMP_WALLET_ADDRESS - }); - console.log(`✅ Offramp registered. Ramp ID: ${rampProcess.id}`); - - const localAccount = OFFRAMP_WALLET_PRIVATE_KEY ? privateKeyToAccount(OFFRAMP_WALLET_PRIVATE_KEY) : undefined; - - await sdk.submitUserTransactions(rampProcess.id, unsignedTransactions, { - sendTransaction: async (evmTx, { unsignedTransaction }) => { - console.log( - `\n🛑 Broadcast ${unsignedTransaction.phase} from your wallet: to=${evmTx.to} value=${evmTx.value} data=${evmTx.data}` - ); - const hash = await askQuestion(`➡️ Tx hash for ${unsignedTransaction.phase}: `); - console.log(`✅ Received hash for ${unsignedTransaction.phase}.`); - return hash; - }, - signTypedData: async (payload, { payloadCount, payloadIndex, unsignedTransaction }) => { - if (localAccount) { - const signature = await localAccount.signTypedData(payload as Parameters[0]); - console.log( - ` [${payloadIndex + 1}/${payloadCount}] ${payload.primaryType} signed locally by ${localAccount.address}` - ); - return signature; - } - - const [v4Payload] = sdk - .getTypedDataToSign(unsignedTransaction, { includeDomainType: true }) - .slice(payloadIndex, payloadIndex + 1); - console.log( - `\n----- sign payload ${payloadIndex + 1}/${payloadCount}: ${payload.primaryType} (account ${unsignedTransaction.signer}) -----` - ); - console.log(JSON.stringify(v4Payload, null, 2)); - const signature = await askQuestion(`➡️ Signature for ${payload.primaryType}: `); - console.log(`✅ Received signature for ${unsignedTransaction.phase}.`); - return signature; - } - }); - - console.log("📝 Step 4: Starting offramp..."); - await sdk.startRamp(rampProcess.id); - console.log("✅ Offramp started."); -} - -async function main(): Promise { - const direction = (process.argv[2] ?? "offramp").toLowerCase(); - console.log(`Starting Mexico (MXN) Alfredpay ${direction} example...\n`); - - const sdk = buildSdk(); - - if (direction === "onramp") { - await runMexicoOnramp(sdk); - } else if (direction === "offramp") { - await runMexicoOfframp(sdk); - } else { - throw new Error(`Unknown direction "${direction}". Use "onramp" or "offramp".`); - } -} - -if (import.meta.main) { - main() - .then(() => { - console.log("\n✨ Example execution completed"); - process.exit(0); - }) - .catch(error => { - console.error("\n💥 Example execution failed:", error); - if (error instanceof Error) { - console.error("Error message:", error.message); - } - process.exit(1); - }); -} From 5ca4d3e7e61fb758f746c8e83a6707fd87da4934 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 09:40:57 +0200 Subject: [PATCH 088/176] fix(rebalancer): stop retrying deterministic reverts, stagger squidrouter quotes Nabla quote reads only skipped retries for the single hardcoded EXCEEDS_MAX_COVERAGE_RATIO revert string; any other on-chain revert was retried 3x with backoff even though a revert is deterministic for a given block state and retrying against another RPC can't change it. Now any "execution reverted" error is treated as non-retryable. Also add a 1.5s stagger between the standard and profitable-amount USDC->BRLA route comparisons, since each fires its own Squidrouter quote request and back-to-back calls were hitting Squidrouter's per-address rate limit ("Too many quote requests for this address"). --- apps/rebalancer/src/index.ts | 9 +++++++++ packages/shared/src/services/evm/clientManager.ts | 6 ++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/apps/rebalancer/src/index.ts b/apps/rebalancer/src/index.ts index cbed460b2..5ad243391 100644 --- a/apps/rebalancer/src/index.ts +++ b/apps/rebalancer/src/index.ts @@ -281,6 +281,14 @@ function toUsdcRaw(amountUsdc: string): string { return multiplyByPowerOfTen(new Big(amountUsdc), 6).toFixed(0, 0); } +// Squidrouter's per-address rate limit is tight enough that two route quotes fired back-to-back +// (standard then profitable amount) can trigger "Too many quote requests for this address". +const SQUIDROUTER_QUOTE_STAGGER_MS = 1500; + +function sleep(ms: number): Promise { + return new Promise(resolve => setTimeout(resolve, ms)); +} + async function selectUsdcToBrlaPolicyAmount(coverageDeviationBps: number): Promise<{ amountUsdcRaw: string; policyDecision: Awaited>; @@ -309,6 +317,7 @@ async function selectUsdcToBrlaPolicyAmount(coverageDeviationBps: number): Promi `profitable ${config.rebalancingProfitableUsdToBrlAmount} USDC.` ); + await sleep(SQUIDROUTER_QUOTE_STAGGER_MS); const profitablePolicyDecision = await evaluateUsdcToBrlaPolicy(profitableAmountRaw, coverageDeviationBps); const selectedAmount = selectEvaluatedUsdcToBrlaAmount( diff --git a/packages/shared/src/services/evm/clientManager.ts b/packages/shared/src/services/evm/clientManager.ts index 46fed69b9..ec63b3374 100644 --- a/packages/shared/src/services/evm/clientManager.ts +++ b/packages/shared/src/services/evm/clientManager.ts @@ -10,7 +10,9 @@ export interface EvmNetworkConfig { } const VIEM_DEFAULT_TRANSPORT_CACHE_KEY = ""; -const NON_RETRYABLE_READ_CONTRACT_REVERTS = ["EXCEEDS_MAX_COVERAGE_RATIO"]; +// Any on-chain revert is deterministic for a given block state: retrying against a different RPC +// node will not change the outcome, so retrying just wastes calls and delays failure reporting. +const NON_RETRYABLE_READ_CONTRACT_ERROR_PATTERNS = [/execution reverted/i]; export function redactRpcUrlForLogs(rpcUrl: string): string { if (!rpcUrl) { @@ -53,7 +55,7 @@ function createRpcTransport(network: EvmNetworkConfig, rpcUrl?: string): Transpo } function isNonRetryableReadContractError(error: Error): boolean { - return NON_RETRYABLE_READ_CONTRACT_REVERTS.some(revertReason => error.message.includes(revertReason)); + return NON_RETRYABLE_READ_CONTRACT_ERROR_PATTERNS.some(pattern => pattern.test(error.message)); } function getEvmNetworks(apiKey?: string): EvmNetworkConfig[] { From 8109dd95aca0dff5d792228d3266dfea2902ce14 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 09:56:06 +0200 Subject: [PATCH 089/176] Add testing strategy document --- docs/testing-strategy.md | 124 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 docs/testing-strategy.md diff --git a/docs/testing-strategy.md b/docs/testing-strategy.md new file mode 100644 index 000000000..0593088f7 --- /dev/null +++ b/docs/testing-strategy.md @@ -0,0 +1,124 @@ +# Testing Strategy + +This document describes the test suite architecture for Vortex: what each layer covers, the +infrastructure it runs on, and where to add tests when you change something. It was introduced +together with the shared test harness (`apps/api/src/test-utils`) — see "How to extend" below. + +## Goals + +1. **Catch regressions before manual testing does.** Critical paths (quote → register → ramp + execution → payout) are covered by automated tests that run on every PR. +2. **Easy to extend.** Adding a corridor, phase, or endpoint means writing a scenario on top of + existing factories and fakes — not hand-rolling a new mock setup. +3. **Hermetic by default.** The PR suite needs no secrets, no chain access, and no third-party + sandboxes. Anything that touches the network is opt-in (`RUN_LIVE_TESTS=1`) and never blocks CI. + +## Test layers + +| Layer | What | Where | Runner | +|---|---|---|---| +| 1. Unit | Pure logic: helpers, token configs, quote/fee golden tests, SDK handlers | each package, next to source | `bun test` (Vitest for frontend) | +| 2. API integration | Real Express + real Postgres + fake external world, driven over HTTP | `apps/api/src/tests/` | `bun test` | +| 3. Corridor scenarios | Phase processor end-to-end per corridor against the fake world | `apps/api/src/tests/corridors/` | `bun test` | +| 4. SDK contract | Real SDK against the real API in-process | `packages/sdk/test/contract/` | `bun test` | +| 5. Frontend | XState machine tests, component tests (RTL + MSW + mock wagmi) | `apps/frontend/src` | Vitest | +| 6. E2E | Few critical Playwright journeys with a mock wallet | `apps/frontend/e2e/` | Playwright (non-blocking) | + +### The invariants the suite protects + +Derived from `docs/security-spec/` — these must never regress, and each has dedicated tests: + +- A quote is consumed **exactly once**, atomically with ramp registration; it expires after its TTL. +- Fees are fixed at quote creation (`metadata.fees`) and identical at registration time; no + client-supplied fee is accepted. +- Subsidy caps are enforced (pre-swap, post-swap, `MAX_FINAL_SETTLEMENT_SUBSIDY_USD`) — a breach + throws instead of paying out (finding F-001). +- Ownership guards: a partner only sees its own quotes/ramps; a user only their own (F-068 class). +- Phase processor: max-retry exhaustion transitions to `failed` (F-004), locks are released on + terminal states, only `currentPhase`/`phaseHistory` are updated by the processor. +- Presigned transaction and ephemeral address validation (F-021, F-038 class). +- External swap/route outputs are validated against expectations before funds move (F-030). + +When a new security finding is fixed, add a regression test in the same PR and reference the +finding ID in the test name. + +## Infrastructure + +### The fake external world (`apps/api/src/test-utils/`) + +All external boundaries are stubbed at the existing service seams — the singletons the production +code already goes through: + +- **Anchors/APIs**: `BrlaApiService` (Avenia), `MykoboApiService`, Alfredpay, SquidRouter, + price feeds. Each fake is configurable per test: succeed with given amounts, return malformed + data, time out, or fail N times then succeed (for retry testing). +- **Chains**: faked at the `EvmClientManager` and Pendulum `apiManager` seams with an in-memory + balance ledger. Phase handlers genuinely poll balances and observe transfers; tests script the + ledger ("EURC arrives on the ephemeral after the 2nd poll"). +- **Clock**: quote expiry and timeout logic accept an injected clock in tests. + +Decision: we deliberately do **not** run Anvil/fork-based EVM tests in CI. Fork mode depends on an +upstream RPC (flaky public endpoints or a paid key as a CI secret). If calldata-level fidelity ever +becomes a problem, add a non-blocking nightly Anvil job — do not put it in the PR path. + +### Database + +API integration tests run against a real Postgres (Docker locally, service container in CI), +migrated with the production Umzug migrations and truncated between tests. Sequelize is **not** +mocked in integration tests — transactionality (quote consumption, processing locks) is part of +what we test. Unit tests may still mock models where the DB is incidental. + +### Factories + +`apps/api/src/test-utils/factories/` builds `Partner`, `ApiKey`, `QuoteTicket`, `RampState` +(per corridor/phase), and presigned-tx fixtures. Never hand-write these objects or copy JSON +snapshots into tests; extend the factory instead. + +### Live tests + +Tests that hit real RPCs or sandboxes (e.g. XCM dry-runs in `packages/shared`) are gated behind +`RUN_LIVE_TESTS=1` via `describe.skipIf`. They are for local debugging and optional nightly runs, +never PR-blocking. + +## CI + +- **PR-blocking** (`ci.yml`): build, Biome, typecheck, then unit + integration tests for every + workspace. Postgres is provided as a GitHub Actions service container. +- **Non-blocking / nightly**: Playwright E2E journeys and any live smoke tests. Failures alert; + they don't block merges. +- No coverage-percentage gate for now. Coverage may be reported for visibility; ratchets can come + later once the suite is trusted. + +## How to extend + +- **New endpoint / route change** → add or update an HTTP-level test in `apps/api/src/tests/`. + If it's auth-protected, add it to the auth-matrix test. +- **New corridor or phase** → add a scenario in `apps/api/src/tests/corridors/` using the + factories and fake world. Cover: happy path, one transient failure + recovery, one unrecoverable + failure → `failed`. +- **New external integration** → add a fake for it in `test-utils/fakes/` with the standard + configurable behaviors (success / malformed / timeout / fail-then-succeed). +- **SDK-visible API change** → the SDK contract tests in `packages/sdk/test/contract/` must pass + unchanged, or the change is breaking and needs an SDK release note. +- **New frontend flow** → machine test first (transitions incl. rejection/error paths), component + test if there's meaningful rendering logic, E2E only if it's a top-level critical journey. +- **Quote/fee logic change** → the golden quote tests will diff; update the snapshots consciously + and mention the fee impact in the PR description. + +## Commands + +```bash +# Everything hermetic (what CI runs) +bun test:unit # all workspaces' unit tests +bun test:integration # API integration + corridor + contract tests (needs Docker or DATABASE_URL) + +# Individual workspaces +cd apps/api && bun test +cd apps/frontend && bunx vitest run +cd apps/frontend && bunx playwright test # E2E, local/nightly + +# Opt-in live tests (real RPCs) +RUN_LIVE_TESTS=1 bun test --cwd packages/shared +``` + +(Scripts are defined in the root `package.json`; see there for the authoritative list.) From 1f053520c29ec0503f191cbca313734394eeea68 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 10:19:10 +0200 Subject: [PATCH 090/176] Gate live/network tests behind RUN_LIVE_TESTS The four phase-processor integration tests hit real sandboxes (Mykobo, BRLA) and the two XCM dry-run tests hit live chain RPCs. They now skip by default and run only with RUN_LIVE_TESTS=1, so the default suite is hermetic and CI-safe. --- .../services/phases/mykobo-eur-offramp.integration.test.ts | 4 +++- .../api/services/phases/mykobo-eur-onramp.integration.test.ts | 4 +++- .../phases/phase-processor.onramp.integration.test.ts | 4 +++- .../phases/phase-processor.recovery.integration.test.ts | 4 +++- packages/shared/src/services/xcm/assethubToMoonbeam.test.ts | 3 ++- packages/shared/src/services/xcm/moonbeamToAssethub.test.ts | 3 ++- 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts b/apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts index cb94384d7..8da7715a7 100644 --- a/apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts +++ b/apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts @@ -189,7 +189,9 @@ RampRecoveryWorker.prototype.start = mock(async (): Promise => { // worker disabled in test }); -describe("Mykobo EUR offramp contract test (real sandbox, no on-chain submission)", () => { +// Live test: hits the real Mykobo sandbox and needs MYKOBO_ACCESS_KEY/MYKOBO_SECRET_KEY. +// Opt-in via RUN_LIVE_TESTS=1 (see docs/testing-strategy.md). +describe.skipIf(!process.env.RUN_LIVE_TESTS)("Mykobo EUR offramp contract test (real sandbox, no on-chain submission)", () => { it("requires Mykobo sandbox credentials in the environment", () => { if (!MYKOBO_ACCESS_KEY || !MYKOBO_SECRET_KEY) { throw new Error("MYKOBO_ACCESS_KEY and MYKOBO_SECRET_KEY must be set to run this test"); diff --git a/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts b/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts index 02888b0cc..b6eec54fc 100644 --- a/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts +++ b/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts @@ -190,7 +190,9 @@ RampRecoveryWorker.prototype.start = mock(async (): Promise => { // worker disabled in test }); -describe("Mykobo EUR onramp contract test (real sandbox, no on-chain submission)", () => { +// Live test: hits the real Mykobo sandbox and needs MYKOBO_ACCESS_KEY/MYKOBO_SECRET_KEY. +// Opt-in via RUN_LIVE_TESTS=1 (see docs/testing-strategy.md). +describe.skipIf(!process.env.RUN_LIVE_TESTS)("Mykobo EUR onramp contract test (real sandbox, no on-chain submission)", () => { it("requires Mykobo sandbox credentials in the environment", () => { if (!MYKOBO_ACCESS_KEY || !MYKOBO_SECRET_KEY) { throw new Error("MYKOBO_ACCESS_KEY and MYKOBO_SECRET_KEY must be set to run this test"); diff --git a/apps/api/src/api/services/phases/phase-processor.onramp.integration.test.ts b/apps/api/src/api/services/phases/phase-processor.onramp.integration.test.ts index ed24757d1..67e7a8d75 100644 --- a/apps/api/src/api/services/phases/phase-processor.onramp.integration.test.ts +++ b/apps/api/src/api/services/phases/phase-processor.onramp.integration.test.ts @@ -161,7 +161,9 @@ mock.module("../brla/helpers", () => { }; }); -describe("Onramp PhaseProcessor Integration Test", () => { +// Live test: drives real chain/anchor interactions and needs TAX_ID plus funded accounts. +// Opt-in via RUN_LIVE_TESTS=1 (see docs/testing-strategy.md). +describe.skipIf(!process.env.RUN_LIVE_TESTS)("Onramp PhaseProcessor Integration Test", () => { it("should process an onramp (pix -> evm) through multiple phases until completion", async () => { try { const _processor = new PhaseProcessor(); diff --git a/apps/api/src/api/services/phases/phase-processor.recovery.integration.test.ts b/apps/api/src/api/services/phases/phase-processor.recovery.integration.test.ts index 0d7c6b77c..19014a5c6 100644 --- a/apps/api/src/api/services/phases/phase-processor.recovery.integration.test.ts +++ b/apps/api/src/api/services/phases/phase-processor.recovery.integration.test.ts @@ -81,7 +81,9 @@ RampState.create = mock(async (data: RampStateCreationAttributes) => { return rampState; }) as typeof RampState.create; -describe("Restart PhaseProcessor Integration Test", () => { +// Live test: replays a persisted failed ramp state against real services. +// Opt-in via RUN_LIVE_TESTS=1 (see docs/testing-strategy.md). +describe.skipIf(!process.env.RUN_LIVE_TESTS)("Restart PhaseProcessor Integration Test", () => { it("should re-start an offramp (evm -> sepa) through multiple phases until completion", async () => { try { const processor = new PhaseProcessor(); diff --git a/packages/shared/src/services/xcm/assethubToMoonbeam.test.ts b/packages/shared/src/services/xcm/assethubToMoonbeam.test.ts index b0e66f01a..7ac1caa94 100644 --- a/packages/shared/src/services/xcm/assethubToMoonbeam.test.ts +++ b/packages/shared/src/services/xcm/assethubToMoonbeam.test.ts @@ -2,7 +2,8 @@ import {test} from "bun:test"; import {dryRunExtrinsic,} from "../../index"; import {createAssethubToMoonbeamTransferWithSwapOnHydration} from "./assethubToMoonbeam"; -test("dry-run assethub to moonbeam with swap on hydration", async () => { +// Hits live AssetHub/Hydration RPCs; opt-in only (see docs/testing-strategy.md). +test.skipIf(!process.env.RUN_LIVE_TESTS)("dry-run assethub to moonbeam with swap on hydration", async () => { // Hardcoded values for testing purposes const rawAmount = "1000000"; const assetAccountKey = "0xFFfffffF7D2B0B761Af01Ca8e25242976ac0aD7D"; // xcUSDC diff --git a/packages/shared/src/services/xcm/moonbeamToAssethub.test.ts b/packages/shared/src/services/xcm/moonbeamToAssethub.test.ts index cbcfb351a..138b66a7f 100644 --- a/packages/shared/src/services/xcm/moonbeamToAssethub.test.ts +++ b/packages/shared/src/services/xcm/moonbeamToAssethub.test.ts @@ -1,7 +1,8 @@ import {test} from "bun:test"; import {createMoonbeamToAssethubTransferWithSwapOnHydration, dryRunExtrinsic,} from "../../index" -test("dry-run moonbeam to assethub with swap on hydration", async () => { +// Hits live Moonbeam/Hydration RPCs; opt-in only (see docs/testing-strategy.md). +test.skipIf(!process.env.RUN_LIVE_TESTS)("dry-run moonbeam to assethub with swap on hydration", async () => { // Hardcoded values for testing purposes const receiverAddress = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"; // Example address const rawAmount = "1000000"; From 10b855fd51be3047a546582ebf11467e028ba7a1 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 10:20:26 +0200 Subject: [PATCH 091/176] Add hermetic API test harness - test-utils/preload.ts (via bunfig.toml): points tests at a dedicated Postgres, neutralizes real credentials from .env, speeds up phase retries - test-utils/db.ts: migration-based schema setup + table truncation against the vortex_test database (bun test:db:start) - test-utils/factories.ts: persisted User/Partner/ApiKey/QuoteTicket/ RampState builders - test-utils/fake-world: typed in-memory fakes for EvmClientManager, Mykobo, BRLA/Avenia, Alfredpay and priceFeedService, plus a global fetch guard that fails any un-faked external HTTP call - test-utils/test-app.ts: boots the real Express app in-process on an ephemeral port (no workers/chain clients) - phase-processor: default retry delay overridable via env for tests --- apps/api/bunfig.toml | 2 + apps/api/package.json | 4 +- apps/api/scripts/test-db.sh | 37 ++++ .../api/services/phases/phase-processor.ts | 4 +- apps/api/src/test-utils/db.ts | 51 +++++ apps/api/src/test-utils/factories.ts | 139 ++++++++++++ .../src/test-utils/fake-world/fake-anchors.ts | 205 +++++++++++++++++ .../api/src/test-utils/fake-world/fake-evm.ts | 207 ++++++++++++++++++ .../src/test-utils/fake-world/fake-prices.ts | 80 +++++++ .../src/test-utils/fake-world/fetch-guard.ts | 39 ++++ apps/api/src/test-utils/fake-world/index.ts | 64 ++++++ apps/api/src/test-utils/preload.ts | 54 +++++ apps/api/src/test-utils/test-app.ts | 40 ++++ apps/api/src/tests/harness.smoke.test.ts | 60 +++++ 14 files changed, 984 insertions(+), 2 deletions(-) create mode 100644 apps/api/bunfig.toml create mode 100755 apps/api/scripts/test-db.sh create mode 100644 apps/api/src/test-utils/db.ts create mode 100644 apps/api/src/test-utils/factories.ts create mode 100644 apps/api/src/test-utils/fake-world/fake-anchors.ts create mode 100644 apps/api/src/test-utils/fake-world/fake-evm.ts create mode 100644 apps/api/src/test-utils/fake-world/fake-prices.ts create mode 100644 apps/api/src/test-utils/fake-world/fetch-guard.ts create mode 100644 apps/api/src/test-utils/fake-world/index.ts create mode 100644 apps/api/src/test-utils/preload.ts create mode 100644 apps/api/src/test-utils/test-app.ts create mode 100644 apps/api/src/tests/harness.smoke.test.ts diff --git a/apps/api/bunfig.toml b/apps/api/bunfig.toml new file mode 100644 index 000000000..f422b2a8a --- /dev/null +++ b/apps/api/bunfig.toml @@ -0,0 +1,2 @@ +[test] +preload = ["./src/test-utils/preload.ts"] diff --git a/apps/api/package.json b/apps/api/package.json index efe344e22..b41f30d2d 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -95,7 +95,9 @@ "seed:phase-metadata": "bun -r @swc-node/register src/database/seeders/phase-metadata.ts", "serve": "bun dist/index.js", "start": "bun run build && bun run serve", - "test": "bun test" + "test": "bun test", + "test:db:start": "./scripts/test-db.sh start", + "test:db:stop": "./scripts/test-db.sh stop" }, "version": "1.0.0" } diff --git a/apps/api/scripts/test-db.sh b/apps/api/scripts/test-db.sh new file mode 100755 index 000000000..0d5aedaa0 --- /dev/null +++ b/apps/api/scripts/test-db.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +# Manages the dedicated Postgres container for integration tests. +set -euo pipefail + +CONTAINER=vortex-test-db +PORT="${TEST_DB_PORT:-54329}" + +case "${1:-start}" in + start) + if docker ps -a --format '{{.Names}}' | grep -q "^${CONTAINER}$"; then + docker start "$CONTAINER" >/dev/null + else + docker run -d --name "$CONTAINER" \ + -e POSTGRES_PASSWORD=postgres \ + -e POSTGRES_DB=vortex_test \ + -p "${PORT}:5432" \ + postgres:16-alpine >/dev/null + fi + for _ in $(seq 1 30); do + if docker exec "$CONTAINER" pg_isready -U postgres >/dev/null 2>&1; then + echo "test db ready on port ${PORT}" + exit 0 + fi + sleep 1 + done + echo "test db failed to become ready" >&2 + exit 1 + ;; + stop) + docker rm -f "$CONTAINER" >/dev/null + echo "test db removed" + ;; + *) + echo "usage: $0 [start|stop]" >&2 + exit 1 + ;; +esac diff --git a/apps/api/src/api/services/phases/phase-processor.ts b/apps/api/src/api/services/phases/phase-processor.ts index fad4828e0..e09717f08 100644 --- a/apps/api/src/api/services/phases/phase-processor.ts +++ b/apps/api/src/api/services/phases/phase-processor.ts @@ -15,6 +15,8 @@ export class PhaseProcessor { private retriesMap = new Map(); private readonly MAX_RETRIES = 8; private readonly MAX_EXECUTION_TIME_MS = 10 * 60 * 1000; // 10 minutes + // Overridable so tests don't wait 30s between recoverable-error retries. + private readonly DEFAULT_RETRY_DELAY_MS = parseInt(process.env.PHASE_PROCESSOR_RETRY_DELAY_MS || "30000", 10); private lockedRamps = new Set(); /** @@ -245,7 +247,7 @@ export class PhaseProcessor { if (currentRetries < maxRetries) { const nextRetry = currentRetries + 1; this.retriesMap.set(errorUpdatedState.id, nextRetry); - const delayMs = minimumWaitSeconds ? minimumWaitSeconds * 1000 : 30 * 1000; + const delayMs = minimumWaitSeconds ? minimumWaitSeconds * 1000 : this.DEFAULT_RETRY_DELAY_MS; logger.info(`Scheduling retry ${nextRetry}/${maxRetries} for ramp ${errorUpdatedState.id} in ${delayMs}ms`); await new Promise(resolve => setTimeout(resolve, delayMs)); diff --git a/apps/api/src/test-utils/db.ts b/apps/api/src/test-utils/db.ts new file mode 100644 index 000000000..6b4ea60b9 --- /dev/null +++ b/apps/api/src/test-utils/db.ts @@ -0,0 +1,51 @@ +import sequelize from "../config/database"; +import { runMigrations } from "../database/migrator"; +// Importing the models index registers every model and association on the sequelize instance. +import "../models"; + +let initialized = false; + +/** + * Connects to the dedicated test database and brings it to the latest migration. + * Idempotent; call from beforeAll in any integration test. + */ +export async function setupTestDatabase(): Promise { + if (initialized) { + return; + } + + const dbName = sequelize.getDatabaseName(); + if (!dbName.includes("test")) { + throw new Error( + `Refusing to run integration tests against database '${dbName}'. ` + + "The test preload should have pointed DB_NAME at 'vortex_test' — check src/test-utils/preload.ts." + ); + } + + try { + await sequelize.authenticate(); + } catch (error) { + throw new Error( + `Could not connect to the test database at ${sequelize.config.host}:${sequelize.config.port}. ` + + "Start it with `bun test:db:start` (from apps/api). " + + `Original error: ${error instanceof Error ? error.message : error}` + ); + } + + await runMigrations(); + initialized = true; +} + +/** + * Empties all application tables between tests while keeping the schema and + * migration bookkeeping intact. + */ +export async function truncateAllTables(): Promise { + const tables = Object.values(sequelize.models) + // Umzug's SequelizeStorage registers SequelizeMeta as a model; wiping it + // would make every migration re-run on the next setup. + .filter(model => model.name !== "SequelizeMeta") + .map(model => `"${model.getTableName()}"`) + .join(", "); + await sequelize.query(`TRUNCATE ${tables} RESTART IDENTITY CASCADE`); +} diff --git a/apps/api/src/test-utils/factories.ts b/apps/api/src/test-utils/factories.ts new file mode 100644 index 000000000..a5ced4ee0 --- /dev/null +++ b/apps/api/src/test-utils/factories.ts @@ -0,0 +1,139 @@ +import { + type DestinationType, + EPaymentMethod, + EvmToken, + FiatToken, + Networks, + RampDirection, + type UnsignedTx +} from "@vortexfi/shared"; +import { generateApiKey, getKeyPrefix, hashApiKey } from "../api/middlewares/apiKeyAuth.helpers"; +import type { StateMetadata } from "../api/services/phases/meta-state-types"; +import type { QuoteTicketMetadata } from "../api/services/quote/core/types"; +import { config } from "../config/vars"; +import ApiKey from "../models/apiKey.model"; +import Partner from "../models/partner.model"; +import QuoteTicket, { type QuoteTicketAttributes } from "../models/quoteTicket.model"; +import RampState, { type RampStateAttributes } from "../models/rampState.model"; +import User from "../models/user.model"; + +let sequence = 0; +function nextSeq(): number { + return ++sequence; +} + +export async function createTestUser(overrides: Partial<{ id: string; email: string }> = {}): Promise { + const seq = nextSeq(); + return User.create({ + email: overrides.email ?? `test-user-${seq}@example.com`, + id: overrides.id ?? crypto.randomUUID() + }); +} + +export async function createTestPartner(overrides: Partial[0]> = {}): Promise { + const seq = nextSeq(); + return Partner.create({ + displayName: `Test Partner ${seq}`, + isActive: true, + logoUrl: null, + markupCurrency: FiatToken.EURC, + markupType: "none", + markupValue: 0, + maxDynamicDifference: 0, + maxSubsidy: 0, + minDynamicDifference: 0, + name: `test-partner-${seq}`, + payoutAddressEvm: null, + payoutAddressSubstrate: null, + rampType: RampDirection.BUY, + targetDiscount: 0, + vortexFeeType: "none", + vortexFeeValue: 0, + ...overrides + }); +} + +/** + * Creates a secret API key for a partner (or a user-scoped key when userId is given) + * and returns both the DB record and the plaintext key for use in request headers. + */ +export async function createTestApiKey( + options: { partnerName?: string; userId?: string } = {} +): Promise<{ record: ApiKey; plaintextKey: string }> { + const plaintextKey = generateApiKey("secret", "test"); + const record = await ApiKey.create({ + expiresAt: null, + isActive: true, + keyHash: await hashApiKey(plaintextKey), + keyPrefix: getKeyPrefix(plaintextKey), + keyType: "secret", + keyValue: null, + lastUsedAt: null, + name: "test key", + partnerName: options.partnerName ?? null, + userId: options.userId ?? null + }); + return { plaintextKey, record }; +} + +/** + * A pending EUR→USDC-on-Base onramp quote by default; override anything. + * Metadata is intentionally minimal — pass a realistic `metadata` override for + * tests that exercise ramp registration. + */ +export async function createTestQuote(overrides: Partial = {}): Promise { + return QuoteTicket.create({ + apiKey: null, + countryCode: null, + expiresAt: new Date(Date.now() + 10 * 60 * 1000), + flowVariant: config.flowVariant, + from: EPaymentMethod.SEPA as DestinationType, + inputAmount: "100", + inputCurrency: FiatToken.EURC, + metadata: (overrides.metadata ?? {}) as QuoteTicketMetadata, + network: Networks.Base, + outputAmount: "105", + outputCurrency: EvmToken.USDC, + partnerId: null, + paymentMethod: EPaymentMethod.SEPA, + pricingPartnerId: null, + rampType: RampDirection.BUY, + status: "pending", + to: Networks.Base as DestinationType, + userId: null, + ...overrides + }); +} + +const DEFAULT_UNSIGNED_TX: UnsignedTx = { + network: Networks.Base, + nonce: 0, + phase: "destinationTransfer", + signer: "0x30a300612ab372CC73e53ffE87fB73d62Ed68Da3", + txData: "0x" +} as UnsignedTx; + +/** + * A ramp state in its initial phase, linked to a fresh quote unless quoteId is given. + */ +export async function createTestRampState(overrides: Partial = {}): Promise { + const quoteId = overrides.quoteId ?? (await createTestQuote()).id; + return RampState.create({ + currentPhase: "initial", + errorLogs: [], + flowVariant: config.flowVariant, + from: EPaymentMethod.SEPA as DestinationType, + paymentMethod: EPaymentMethod.SEPA, + phaseHistory: [], + postCompleteState: { cleanup: { cleanupAt: null, cleanupCompleted: false, errors: null } }, + presignedTxs: null, + processingLock: { locked: false, lockedAt: null }, + state: (overrides.state ?? {}) as StateMetadata, + to: Networks.Base, + type: RampDirection.BUY, + unsignedTxs: [DEFAULT_UNSIGNED_TX], + userId: null, + ...overrides, + quoteId + }); +} diff --git a/apps/api/src/test-utils/fake-world/fake-anchors.ts b/apps/api/src/test-utils/fake-world/fake-anchors.ts new file mode 100644 index 000000000..5605d3473 --- /dev/null +++ b/apps/api/src/test-utils/fake-world/fake-anchors.ts @@ -0,0 +1,205 @@ +import { + AlfredpayApiService, + BrlaApiService, + MykoboApiService, + type MykoboCreateIntentRequest, + type MykoboCreateIntentResponse, + type MykoboFeeResponse, + type MykoboGetTransactionResponse, + type MykoboTransaction, + MykoboTransactionStatus +} from "@vortexfi/shared"; + +function unimplementedProxy(impl: object, label: string): T { + return new Proxy(impl, { + get: (obj, prop) => { + if (prop in obj) { + return (obj as Record)[prop]; + } + if (prop === "then") { + return undefined; + } + throw new Error(`${label}.${String(prop)} is not implemented — extend src/test-utils/fake-world/fake-anchors.ts.`); + } + }) as T; +} + +/** + * Fake Mykobo anchor. Creates deterministic transactions/intents in memory; + * fees and per-call failures are scripted through the public fields. + */ +export class FakeMykobo { + depositFeeTotal = "1.00"; + withdrawFeeTotal = "1.00"; + /** When set, the next createTransactionIntent call rejects with this error. */ + failNextIntent: Error | null = null; + + readonly intents: MykoboCreateIntentRequest[] = []; + readonly transactions = new Map(); + private counter = 0; + + setTransactionStatus(id: string, status: MykoboTransactionStatus): void { + const transaction = this.transactions.get(id); + if (!transaction) { + throw new Error(`FakeMykobo: unknown transaction ${id}`); + } + transaction.status = status; + } + + private readonly impl = { + createTransactionIntent: async (request: MykoboCreateIntentRequest): Promise => { + if (this.failNextIntent) { + const error = this.failNextIntent; + this.failNextIntent = null; + throw error; + } + this.intents.push(request); + this.counter += 1; + const transaction: MykoboTransaction = { + created_at: new Date().toISOString(), + fee: this.depositFeeTotal, + id: `mykobo-tx-${this.counter}`, + incoming_currency: "EUR", + network: "BASE", + outgoing_currency: "EURC", + reference: `TESTREF${this.counter}`, + status: MykoboTransactionStatus.PENDING_PAYER, + transaction_type: request.transaction_type, + tx_hash: null, + updated_at: new Date().toISOString(), + value: request.value, + wallet_address: request.wallet_address + }; + this.transactions.set(transaction.id, transaction); + return { + instructions: { bank_account_name: "Vortex Test Account", iban: "DE89370400440532013000" }, + transaction + }; + }, + defaultDepositFee: async (): Promise => ({ total: this.depositFeeTotal }), + defaultWithdrawFee: async (): Promise => ({ total: this.withdrawFeeTotal }), + getTransaction: async (transactionId: string): Promise => { + const transaction = this.transactions.get(transactionId); + if (!transaction) { + throw new Error(`FakeMykobo: unknown transaction ${transactionId}`); + } + return { transaction }; + }, + lookupFees: async (): Promise => ({ total: this.depositFeeTotal }) + }; + + asService(): MykoboApiService { + return unimplementedProxy(this.impl, "FakeMykobo"); + } +} + +/** + * Fake BRLA/Avenia anchor with an in-memory subaccount and generous limits. + * Quote responses apply a flat, scriptable BRL/USD-style rate. + */ +export class FakeBrla { + /** outputAmount = inputAmount * payInRate for pay-in quotes. */ + payInRate = 1; + payOutRate = 1; + subaccountId = "test-subaccount-id"; + subaccountEvmWallet = "0x7ba99e99bc669b3508aff9cc0a898e869459f877"; + readonly pixInputTickets: Array<{ id: string; brCode: string }> = []; + readonly pixOutputTickets: Array<{ id: string }> = []; + private counter = 0; + + private readonly impl = { + createPayInQuote: async (quoteParams: { inputAmount: string }) => ({ + appliedFees: [], + basePrice: "1", + inputAmount: quoteParams.inputAmount, + inputCurrency: "BRL", + inputPaymentMethod: "PIX", + outputAmount: (Number(quoteParams.inputAmount) * this.payInRate).toString(), + quoteToken: `payin-quote-token-${++this.counter}` + }), + createPayOutQuote: async (quoteParams: { outputAmount: string }) => ({ + appliedFees: [], + basePrice: "1", + inputAmount: (Number(quoteParams.outputAmount) / this.payOutRate).toString(), + inputCurrency: "BRLA", + inputPaymentMethod: "INTERNAL", + outputAmount: quoteParams.outputAmount, + quoteToken: `payout-quote-token-${++this.counter}` + }), + createPixInputTicket: async () => { + const ticket = { + brCode: `brcode-${++this.counter}`, + expiration: new Date(Date.now() + 3600_000), + id: `pix-in-${this.counter}` + }; + this.pixInputTickets.push(ticket); + return ticket; + }, + createPixOutputTicket: async () => { + const ticket = { id: `pix-out-${++this.counter}` }; + this.pixOutputTickets.push(ticket); + return ticket; + }, + getSubaccountUsedLimit: async () => ({ + limitInfo: { + limitBurn: "10000000", + limitMint: "10000000", + usedLimit: "0" + } + }), + subaccountInfo: async () => ({ + accountInfo: {}, + brCode: "test-brcode", + createdAt: new Date().toISOString(), + id: this.subaccountId, + pixKey: "test-pix-key", + wallets: [{ chain: "EVM", id: "wallet-1", walletAddress: this.subaccountEvmWallet }] + }), + validatePixKey: async () => ({ bankName: "Test Bank", name: "Test Receiver", taxId: "12345678900" }) + }; + + asService(): BrlaApiService { + return unimplementedProxy(this.impl, "FakeBrla"); + } +} + +/** Fake Alfredpay anchor; extend as Alfredpay corridors gain test coverage. */ +export class FakeAlfredpay { + private readonly impl = {}; + + asService(): AlfredpayApiService { + return unimplementedProxy(this.impl, "FakeAlfredpay"); + } +} + +export function installFakeAnchors(): { + fakeMykobo: FakeMykobo; + fakeBrla: FakeBrla; + fakeAlfredpay: FakeAlfredpay; + restore: () => void; +} { + const originals = { + alfredpay: AlfredpayApiService.getInstance, + brla: BrlaApiService.getInstance, + mykobo: MykoboApiService.getInstance + }; + + const fakeMykobo = new FakeMykobo(); + const fakeBrla = new FakeBrla(); + const fakeAlfredpay = new FakeAlfredpay(); + + MykoboApiService.getInstance = () => fakeMykobo.asService(); + BrlaApiService.getInstance = () => fakeBrla.asService(); + AlfredpayApiService.getInstance = () => fakeAlfredpay.asService(); + + return { + fakeAlfredpay, + fakeBrla, + fakeMykobo, + restore: () => { + MykoboApiService.getInstance = originals.mykobo; + BrlaApiService.getInstance = originals.brla; + AlfredpayApiService.getInstance = originals.alfredpay; + } + }; +} diff --git a/apps/api/src/test-utils/fake-world/fake-evm.ts b/apps/api/src/test-utils/fake-world/fake-evm.ts new file mode 100644 index 000000000..def5fa60c --- /dev/null +++ b/apps/api/src/test-utils/fake-world/fake-evm.ts @@ -0,0 +1,207 @@ +import { EvmClientManager, type EvmNetworks } from "@vortexfi/shared"; + +export interface RecordedEvmTx { + network: string; + from?: string; + to?: string; + data?: string; + value?: bigint; + serialized?: string; + hash: `0x${string}`; +} + +interface ReadContractParams { + abi: readonly unknown[]; + address: `0x${string}`; + functionName: string; + args?: readonly unknown[]; +} + +const CHAIN_IDS: Record = { + arbitrum: 42161, + avalanche: 43114, + base: 8453, + "base-sepolia": 84532, + bsc: 56, + ethereum: 1, + moonbeam: 1284, + polygon: 137, + polygonAmoy: 80002 +}; + +const MAX_UINT256 = 2n ** 256n - 1n; + +/** + * In-memory EVM world standing in for EvmClientManager. Balances are a simple + * ledger keyed by network/token/holder; transactions are recorded, assigned a + * deterministic hash, and confirmed instantly. Behavior that a test cares + * about (swap rates, transfer effects, failures) is scripted via the public + * hooks. + */ +export class FakeEvm { + private balances = new Map(); + private nonces = new Map(); + private txCounter = 0; + readonly sentTransactions: RecordedEvmTx[] = []; + + /** Called for every recorded transaction; use it to apply balance effects. */ + onTransaction?: (tx: RecordedEvmTx) => void; + /** First chance to answer any readContract call; return undefined to fall through to defaults. */ + onReadContract?: (network: string, params: ReadContractParams) => unknown; + /** Nabla router getAmountOut. Default: same-decimals 1:1.05. */ + onGetAmountOut: (network: string, routerAddress: string, amountIn: bigint) => bigint = (_n, _r, amountIn) => + (amountIn * 105n) / 100n; + /** Reverts the next `failNextSends` transaction submissions with the given error. */ + failNextSends = 0; + sendFailureMessage = "FakeEvm: scripted transaction failure"; + + private key(network: string, token: string, holder: string): string { + return `${network}:${token.toLowerCase()}:${holder.toLowerCase()}`; + } + + setErc20Balance(network: string, token: string, holder: string, amount: bigint): void { + this.balances.set(this.key(network, token, holder), amount); + } + + erc20Balance(network: string, token: string, holder: string): bigint { + return this.balances.get(this.key(network, token, holder)) ?? 0n; + } + + setNativeBalance(network: string, holder: string, amount: bigint): void { + this.balances.set(this.key(network, "native", holder), amount); + } + + nativeBalance(network: string, holder: string): bigint { + return this.balances.get(this.key(network, "native", holder)) ?? 0n; + } + + private nextHash(): `0x${string}` { + this.txCounter += 1; + return `0x${this.txCounter.toString(16).padStart(64, "0")}` as `0x${string}`; + } + + private recordTransaction(tx: Omit): `0x${string}` { + if (this.failNextSends > 0) { + this.failNextSends -= 1; + throw new Error(this.sendFailureMessage); + } + const recorded = { ...tx, hash: this.nextHash() }; + this.sentTransactions.push(recorded); + this.onTransaction?.(recorded); + return recorded.hash; + } + + private readContract(network: string, params: ReadContractParams): unknown { + const custom = this.onReadContract?.(network, params); + if (custom !== undefined) { + return custom; + } + switch (params.functionName) { + case "balanceOf": + return this.erc20Balance(network, params.address, params.args?.[0] as string); + case "allowance": + return MAX_UINT256; + case "getAmountOut": + return this.onGetAmountOut(network, params.address, params.args?.[0] as bigint); + default: + throw new Error( + `FakeEvm: readContract '${params.functionName}' on ${network} is not implemented — ` + + "script it via fakeEvm.onReadContract in the test." + ); + } + } + + private makeUnimplementedProxy(target: Record, label: string): unknown { + return new Proxy(target, { + get: (obj, prop) => { + if (prop in obj) { + return obj[prop as string]; + } + if (prop === "then") { + return undefined; + } + throw new Error(`FakeEvm: ${label}.${String(prop)} is not implemented — extend src/test-utils/fake-world/fake-evm.ts.`); + } + }); + } + + // --- EvmClientManager surface used by the API --- + + getClient(networkName: EvmNetworks): unknown { + const network = networkName as string; + const receipt = (hash: `0x${string}`) => ({ + blockNumber: 1n, + logs: [], + status: "success" as const, + transactionHash: hash + }); + return this.makeUnimplementedProxy( + { + chain: { id: CHAIN_IDS[network] ?? 0, name: network }, + estimateFeesPerGas: async () => ({ maxFeePerGas: 1_000_000_000n, maxPriorityFeePerGas: 1_000_000_000n }), + estimateGas: async () => 21_000n, + getBalance: async ({ address }: { address: string }) => this.nativeBalance(network, address), + getGasPrice: async () => 1_000_000_000n, + getTransactionCount: async ({ address }: { address: string }) => this.nonces.get(`${network}:${address}`) ?? 0, + getTransactionReceipt: async ({ hash }: { hash: `0x${string}` }) => receipt(hash), + readContract: async (params: ReadContractParams) => this.readContract(network, params), + sendRawTransaction: async ({ serializedTransaction }: { serializedTransaction: string }) => + this.recordTransaction({ network, serialized: serializedTransaction }), + waitForTransactionReceipt: async ({ hash }: { hash: `0x${string}` }) => receipt(hash) + }, + `PublicClient(${network})` + ); + } + + getWalletClient(networkName: EvmNetworks, account: { address: string }): unknown { + const network = networkName as string; + return this.makeUnimplementedProxy( + { + account, + sendTransaction: async (params: { to?: string; data?: string; value?: bigint }) => + this.recordTransaction({ data: params.data, from: account.address, network, to: params.to, value: params.value }), + writeContract: async (params: { address: string; functionName: string }) => + this.recordTransaction({ data: params.functionName, from: account.address, network, to: params.address }) + }, + `WalletClient(${network})` + ); + } + + async readContractWithRetry(networkName: EvmNetworks, contractParams: ReadContractParams): Promise { + return this.readContract(networkName as string, contractParams) as T; + } + + async getBalanceWithRetry(networkName: EvmNetworks, address: `0x${string}`): Promise { + return this.nativeBalance(networkName as string, address); + } + + async sendRawTransactionWithRetry(networkName: EvmNetworks, serializedTransaction: `0x${string}`): Promise { + return this.recordTransaction({ network: networkName as string, serialized: serializedTransaction }); + } + + async sendTransactionWithBlindRetry( + networkName: EvmNetworks, + account: { address: string }, + transactionParams: { data?: `0x${string}`; to: `0x${string}`; value?: bigint } + ): Promise<`0x${string}`> { + return this.recordTransaction({ + data: transactionParams.data, + from: account.address, + network: networkName as string, + to: transactionParams.to, + value: transactionParams.value + }); + } +} + +export function installFakeEvm(): { fakeEvm: FakeEvm; restore: () => void } { + const original = EvmClientManager.getInstance; + const fakeEvm = new FakeEvm(); + EvmClientManager.getInstance = () => fakeEvm as unknown as EvmClientManager; + return { + fakeEvm, + restore: () => { + EvmClientManager.getInstance = original; + } + }; +} diff --git a/apps/api/src/test-utils/fake-world/fake-prices.ts b/apps/api/src/test-utils/fake-world/fake-prices.ts new file mode 100644 index 000000000..1e34caf32 --- /dev/null +++ b/apps/api/src/test-utils/fake-world/fake-prices.ts @@ -0,0 +1,80 @@ +import type { RampCurrency } from "@vortexfi/shared"; +import Big from "big.js"; +import { priceFeedService } from "../../api/services/priceFeed.service"; + +/** + * Deterministic price world. Patches the exported priceFeedService instance + * (the object every caller imports) rather than the class. Unknown lookups + * throw so a test never computes fees from an accidental default. + */ +export class FakePrices { + /** CoinGecko-style token id → USD price. */ + cryptoUsd: Record = { + "usd-coin": 1 + }; + /** Fiat/RampCurrency code (lowercased) → units of that currency per 1 USD. */ + perUsd: Record = { + ars: 1000, + brl: 5, + cop: 4000, + eur: 0.9, + mxn: 17, + usd: 1, + usdc: 1, + "usdc.e": 1, + usdt: 1 + }; + + getCryptoUsd(tokenId: string): number { + const price = this.cryptoUsd[tokenId]; + if (price === undefined) { + throw new Error(`FakePrices: no USD price for token id '${tokenId}' — set fakePrices.cryptoUsd['${tokenId}'].`); + } + return price; + } + + getPerUsd(currency: string): number { + const rate = this.perUsd[currency.toLowerCase()]; + if (rate === undefined) { + throw new Error(`FakePrices: no per-USD rate for '${currency}' — set fakePrices.perUsd['${currency.toLowerCase()}'].`); + } + return rate; + } +} + +type PatchedMethods = "getCryptoPrice" | "getUsdToFiatExchangeRate" | "convertCurrency" | "getOnchainOraclePrice"; + +export function installFakePrices(): { fakePrices: FakePrices; restore: () => void } { + const fakePrices = new FakePrices(); + const originals: Partial> = { + convertCurrency: priceFeedService.convertCurrency, + getCryptoPrice: priceFeedService.getCryptoPrice, + getOnchainOraclePrice: priceFeedService.getOnchainOraclePrice, + getUsdToFiatExchangeRate: priceFeedService.getUsdToFiatExchangeRate + }; + + priceFeedService.getCryptoPrice = async (tokenId: string) => fakePrices.getCryptoUsd(tokenId); + priceFeedService.getUsdToFiatExchangeRate = async (toCurrency: RampCurrency) => fakePrices.getPerUsd(toCurrency as string); + priceFeedService.convertCurrency = async ( + amount: string, + fromCurrency: RampCurrency, + toCurrency: RampCurrency, + decimals?: number | null + ) => { + const usd = new Big(amount).div(fakePrices.getPerUsd(fromCurrency as string)); + const converted = usd.times(fakePrices.getPerUsd(toCurrency as string)); + return decimals != null ? converted.toFixed(decimals, 0) : converted.toString(); + }; + priceFeedService.getOnchainOraclePrice = async (currency: RampCurrency) => ({ + lastUpdateTimestamp: Date.now(), + name: currency as string, + price: new Big(1).div(fakePrices.getPerUsd(currency as string)) + }); + + return { + fakePrices, + restore: () => { + Object.assign(priceFeedService, originals); + } + }; +} diff --git a/apps/api/src/test-utils/fake-world/fetch-guard.ts b/apps/api/src/test-utils/fake-world/fetch-guard.ts new file mode 100644 index 000000000..ba431afc5 --- /dev/null +++ b/apps/api/src/test-utils/fake-world/fetch-guard.ts @@ -0,0 +1,39 @@ +/** + * Replaces global fetch with a guard that only allows loopback traffic + * (the in-process test app). Any other HTTP call is a hermeticity violation + * and fails with a descriptive error instead of silently reaching a real + * service. + */ +let originalFetch: typeof fetch | null = null; + +const LOOPBACK_PATTERN = /^https?:\/\/(127\.0\.0\.1|localhost|\[::1\])(:|\/|$)/; + +export function installFetchGuard(): void { + if (originalFetch) { + return; + } + const realFetch = globalThis.fetch; + originalFetch = realFetch; + + const guard = ((input: Parameters[0], init?: Parameters[1]) => { + const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url; + if (!/^https?:\/\//.test(url) || LOOPBACK_PATTERN.test(url)) { + return realFetch(input, init); + } + return Promise.reject( + new Error( + `Hermetic test violation: attempted external HTTP call to ${url}. ` + + "Extend the fakes in src/test-utils/fake-world instead of letting code reach the network." + ) + ); + }) as typeof fetch; + + globalThis.fetch = Object.assign(guard, realFetch); +} + +export function uninstallFetchGuard(): void { + if (originalFetch) { + globalThis.fetch = originalFetch; + originalFetch = null; + } +} diff --git a/apps/api/src/test-utils/fake-world/index.ts b/apps/api/src/test-utils/fake-world/index.ts new file mode 100644 index 000000000..ff1209758 --- /dev/null +++ b/apps/api/src/test-utils/fake-world/index.ts @@ -0,0 +1,64 @@ +import { ApiManager } from "@vortexfi/shared"; +import { type FakeAlfredpay, type FakeBrla, type FakeMykobo, installFakeAnchors } from "./fake-anchors"; +import { type FakeEvm, installFakeEvm } from "./fake-evm"; +import { type FakePrices, installFakePrices } from "./fake-prices"; +import { installFetchGuard, uninstallFetchGuard } from "./fetch-guard"; + +export type { FakeAlfredpay, FakeBrla, FakeEvm, FakeMykobo, FakePrices }; +export { installFetchGuard, uninstallFetchGuard }; + +export interface FakeWorld { + evm: FakeEvm; + mykobo: FakeMykobo; + brla: FakeBrla; + alfredpay: FakeAlfredpay; + prices: FakePrices; + restore: () => void; +} + +/** + * Replaces every external boundary of the API with deterministic in-memory + * fakes and installs the fetch guard so nothing can slip through to a real + * service. Call once in beforeAll and restore() in afterAll — bun runs all + * test files in one process, so leaked patches bleed into other files. + */ +export function installFakeWorld(): FakeWorld { + installFetchGuard(); + const { fakeEvm, restore: restoreEvm } = installFakeEvm(); + const { fakeAlfredpay, fakeBrla, fakeMykobo, restore: restoreAnchors } = installFakeAnchors(); + const { fakePrices, restore: restorePrices } = installFakePrices(); + + // Substrate/Pendulum flows are not faked yet; fail loudly if a code path + // unexpectedly needs them so the gap is explicit rather than a hang. + const originalGetApiManager = ApiManager.getInstance; + ApiManager.getInstance = () => + new Proxy( + {}, + { + get: (_obj, prop) => { + if (prop === "then") { + return undefined; + } + throw new Error( + `FakeWorld: ApiManager.${String(prop)} was called but Substrate chains are not faked yet — ` + + "extend src/test-utils/fake-world if this flow must be covered hermetically." + ); + } + } + ) as unknown as ApiManager; + + return { + alfredpay: fakeAlfredpay, + brla: fakeBrla, + evm: fakeEvm, + mykobo: fakeMykobo, + prices: fakePrices, + restore: () => { + ApiManager.getInstance = originalGetApiManager; + restorePrices(); + restoreAnchors(); + restoreEvm(); + uninstallFetchGuard(); + } + }; +} diff --git a/apps/api/src/test-utils/preload.ts b/apps/api/src/test-utils/preload.ts new file mode 100644 index 000000000..deecdc5b5 --- /dev/null +++ b/apps/api/src/test-utils/preload.ts @@ -0,0 +1,54 @@ +/** + * Test environment safety net, loaded before every test file via bunfig.toml. + * + * Hermetic by default: points the database at the dedicated test instance and + * replaces any real integration credentials (which bun auto-loads from .env) + * with sentinel values so no test can accidentally reach a real external + * service. Live tests opt out with RUN_LIVE_TESTS=1 and keep the real env. + */ +if (!process.env.RUN_LIVE_TESTS) { + process.env.NODE_ENV = "test"; + process.env.DEPLOYMENT_ENV = "test"; + process.env.FLOW_VARIANT = process.env.FLOW_VARIANT || "mykobo"; + + // Dedicated test database (started via `bun test:db:start`), never the dev database. + process.env.DB_HOST = process.env.TEST_DB_HOST || "localhost"; + process.env.DB_PORT = process.env.TEST_DB_PORT || "54329"; + process.env.DB_NAME = process.env.TEST_DB_NAME || "vortex_test"; + process.env.DB_USERNAME = process.env.TEST_DB_USERNAME || "postgres"; + process.env.DB_PASSWORD = process.env.TEST_DB_PASSWORD || "postgres"; + + // Neutralize integration credentials/endpoints. The .invalid TLD is reserved + // (RFC 2606), so any un-faked call fails fast instead of hitting production. + process.env.MYKOBO_BASE_URL = "http://mykobo.invalid"; + process.env.MYKOBO_ACCESS_KEY = "test-mykobo-access-key"; + process.env.MYKOBO_SECRET_KEY = "test-mykobo-secret-key"; + process.env.BRLA_BASE_URL = "http://brla.invalid"; + process.env.BRLA_API_KEY = "test-brla-api-key"; + process.env.BRLA_PRIVATE_KEY = ""; + process.env.ALFREDPAY_BASE_URL = "http://alfredpay.invalid"; + process.env.ALFREDPAY_API_KEY = "test-alfredpay-api-key"; + process.env.ALFREDPAY_API_SECRET = "test-alfredpay-api-secret"; + process.env.COINGECKO_API_URL = "http://coingecko.invalid"; + process.env.COINGECKO_API_KEY = ""; + process.env.ALCHEMY_API_KEY = ""; + process.env.SUPABASE_URL = "http://supabase.invalid"; + process.env.SUPABASE_ANON_KEY = "test-anon-key"; + process.env.SUPABASE_SERVICE_KEY = "test-service-key"; + process.env.ADMIN_SECRET = "test-admin-secret"; + process.env.METRICS_DASHBOARD_SECRET = "test-metrics-secret"; + + // Dummy signing keys (well-known dev keys, no real funds) so code that + // derives accounts works without ever using the operator's real seeds. + process.env.MOONBEAM_EXECUTOR_PRIVATE_KEY = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"; + process.env.EVM_FUNDING_PRIVATE_KEY = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"; + process.env.PENDULUM_FUNDING_SEED = "bottom drive obey lake curtain smoke basket hold race lonely fit walk"; + process.env.FUNDING_SECRET = ""; + process.env.CLIENT_DOMAIN_SECRET = ""; + + // Keep rate limiting out of the way of HTTP-level tests. + process.env.RATE_LIMIT_MAX_REQUESTS = "100000"; + + // Fast retries so recoverable-error scenarios don't wait 30s per attempt. + process.env.PHASE_PROCESSOR_RETRY_DELAY_MS = "25"; +} diff --git a/apps/api/src/test-utils/test-app.ts b/apps/api/src/test-utils/test-app.ts new file mode 100644 index 000000000..fa4df8843 --- /dev/null +++ b/apps/api/src/test-utils/test-app.ts @@ -0,0 +1,40 @@ +import type { Server } from "node:http"; + +export interface TestApp { + baseUrl: string; + /** fetch against the in-process API, e.g. api.request("/v1/status") */ + request(path: string, init?: RequestInit): Promise; + close(): Promise; +} + +/** + * Boots the real Express app in-process on an ephemeral port. + * + * Deliberately does NOT run src/index.ts: no background workers, no chain + * clients, no crypto-service init. Phase handlers are registered so ramp + * routes work. Call AFTER installing fakes so module singletons resolve to + * the fake world. + */ +export async function startTestApp(): Promise { + const { default: app } = await import("../config/express"); + const { default: registerPhaseHandlers } = await import("../api/services/phases/register-handlers"); + registerPhaseHandlers(); + + const server: Server = await new Promise(resolve => { + const s = app.listen(0, "127.0.0.1", () => resolve(s)); + }); + const address = server.address(); + if (address === null || typeof address === "string") { + throw new Error("Test server did not bind to a port"); + } + const baseUrl = `http://127.0.0.1:${address.port}`; + + return { + baseUrl, + close: () => + new Promise((resolve, reject) => { + server.close(error => (error ? reject(error) : resolve())); + }), + request: (path, init) => fetch(`${baseUrl}${path}`, init) + }; +} diff --git a/apps/api/src/tests/harness.smoke.test.ts b/apps/api/src/tests/harness.smoke.test.ts new file mode 100644 index 000000000..857baec01 --- /dev/null +++ b/apps/api/src/tests/harness.smoke.test.ts @@ -0,0 +1,60 @@ +import { afterAll, beforeAll, describe, expect, it } from "bun:test"; +import { installFakeWorld, type FakeWorld } from "../test-utils/fake-world"; +import { setupTestDatabase, truncateAllTables } from "../test-utils/db"; +import { createTestApiKey, createTestPartner, createTestQuote, createTestRampState, createTestUser } from "../test-utils/factories"; +import { startTestApp, type TestApp } from "../test-utils/test-app"; + +describe("test harness smoke test", () => { + let world: FakeWorld; + let app: TestApp; + + beforeAll(async () => { + world = installFakeWorld(); + await setupTestDatabase(); + await truncateAllTables(); + app = await startTestApp(); + }); + + afterAll(async () => { + await app?.close(); + world?.restore(); + }); + + it("boots the real Express app and serves a public endpoint", async () => { + const response = await app.request("/v1/supported-fiat-currencies"); + expect(response.status).toBe(200); + }); + + it("persists factory-built entities against the migrated schema", async () => { + const user = await createTestUser(); + const partner = await createTestPartner(); + const { record, plaintextKey } = await createTestApiKey({ partnerName: partner.name }); + const quote = await createTestQuote({ userId: user.id }); + const ramp = await createTestRampState({ quoteId: quote.id, userId: user.id }); + + expect(user.id).toBeTruthy(); + expect(record.keyPrefix).toBe(plaintextKey.slice(0, 8)); + expect(quote.status).toBe("pending"); + expect(ramp.currentPhase).toBe("initial"); + }); + + it("blocks un-faked external HTTP calls", async () => { + await expect(fetch("https://example.com")).rejects.toThrow(/Hermetic test violation/); + }); + + it("answers EVM balance reads from the in-memory ledger", async () => { + const { EvmClientManager, Networks } = await import("@vortexfi/shared"); + const holder = "0x30a300612ab372CC73e53ffE87fB73d62Ed68Da3"; + const token = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"; + world.evm.setErc20Balance(Networks.Base, token, holder, 123n); + + const manager = EvmClientManager.getInstance(); + const balance = await manager.readContractWithRetry(Networks.Base, { + abi: [], + address: token, + args: [holder], + functionName: "balanceOf" + }); + expect(balance).toBe(123n); + }); +}); From 34cc26932f1b22da5ad13ad50c5d92c0a841eef0 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 10:32:47 +0200 Subject: [PATCH 092/176] Add HTTP-level auth, ownership and quote-consumption invariant tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Covers the security-spec invariants over the real Express app + Postgres: - credential matrix on /v1/ramp/register (missing/invalid/revoked/expired keys, invalid bearer tokens) - ramp status ownership (owner/stranger/anonymous/partner-key access) - quote lifecycle guards (expiry, prior consumption, foreign-user quotes, EUR kill-switch, flow-variant mismatch) - admin vs metrics-dashboard secrets on admin routes - BRL onramp quote → register runs fully hermetically, and two concurrent registrations of one quote yield exactly one ramp (atomic consumption) Harness additions: fake Supabase token verifier, fake SquidRouter getRoute (module mock), TaxId factory, vortex partner seed, default quote fees. --- apps/api/src/test-utils/db.ts | 10 + apps/api/src/test-utils/factories.ts | 46 +++- .../src/test-utils/fake-world/fake-anchors.ts | 15 +- .../src/test-utils/fake-world/fake-auth.ts | 30 +++ .../src/test-utils/fake-world/fake-prices.ts | 3 + .../test-utils/fake-world/fake-squidrouter.ts | 55 ++++ apps/api/src/test-utils/fake-world/index.ts | 9 +- apps/api/src/tests/auth.invariants.test.ts | 246 ++++++++++++++++++ .../quote-consumption.invariants.test.ts | 134 ++++++++++ apps/api/src/tests/zzz-leak-probe.test.ts | 14 + 10 files changed, 554 insertions(+), 8 deletions(-) create mode 100644 apps/api/src/test-utils/fake-world/fake-auth.ts create mode 100644 apps/api/src/test-utils/fake-world/fake-squidrouter.ts create mode 100644 apps/api/src/tests/auth.invariants.test.ts create mode 100644 apps/api/src/tests/quote-consumption.invariants.test.ts create mode 100644 apps/api/src/tests/zzz-leak-probe.test.ts diff --git a/apps/api/src/test-utils/db.ts b/apps/api/src/test-utils/db.ts index 6b4ea60b9..e74cdf278 100644 --- a/apps/api/src/test-utils/db.ts +++ b/apps/api/src/test-utils/db.ts @@ -36,6 +36,16 @@ export async function setupTestDatabase(): Promise { initialized = true; } +/** + * Standard between-test reset: empty all tables, then re-seed the baseline + * configuration rows (vortex fee partners) the application expects. + */ +export async function resetTestDatabase(): Promise { + await truncateAllTables(); + const { seedVortexPartners } = await import("./factories"); + await seedVortexPartners(); +} + /** * Empties all application tables between tests while keeping the schema and * migration bookkeeping intact. diff --git a/apps/api/src/test-utils/factories.ts b/apps/api/src/test-utils/factories.ts index a5ced4ee0..5a3cf2ee0 100644 --- a/apps/api/src/test-utils/factories.ts +++ b/apps/api/src/test-utils/factories.ts @@ -1,4 +1,5 @@ import { + AveniaAccountType, type DestinationType, EPaymentMethod, EvmToken, @@ -15,6 +16,7 @@ import ApiKey from "../models/apiKey.model"; import Partner from "../models/partner.model"; import QuoteTicket, { type QuoteTicketAttributes } from "../models/quoteTicket.model"; import RampState, { type RampStateAttributes } from "../models/rampState.model"; +import TaxId, { TaxIdInternalStatus } from "../models/taxId.model"; import User from "../models/user.model"; let sequence = 0; @@ -76,10 +78,18 @@ export async function createTestApiKey( return { plaintextKey, record }; } +/** Minimal complete fee structure so status/fee readers work; override per test. */ +export function defaultQuoteFees(currency: FiatToken = FiatToken.EURC): NonNullable { + return { + displayFiat: { anchor: "1", currency, network: "0", partnerMarkup: "0", total: "1", vortex: "0" }, + usd: { anchor: "1", network: "0", partnerMarkup: "0", total: "1", vortex: "0" } + }; +} + /** * A pending EUR→USDC-on-Base onramp quote by default; override anything. - * Metadata is intentionally minimal — pass a realistic `metadata` override for - * tests that exercise ramp registration. + * Metadata carries a minimal fee structure — pass a realistic `metadata` + * override for tests that exercise ramp registration. */ export async function createTestQuote(overrides: Partial = {}): Promise { return QuoteTicket.create({ @@ -90,7 +100,7 @@ export async function createTestQuote(overrides: Partial from: EPaymentMethod.SEPA as DestinationType, inputAmount: "100", inputCurrency: FiatToken.EURC, - metadata: (overrides.metadata ?? {}) as QuoteTicketMetadata, + metadata: { fees: defaultQuoteFees(), ...(overrides.metadata ?? {}) } as QuoteTicketMetadata, network: Networks.Base, outputAmount: "105", outputCurrency: EvmToken.USDC, @@ -105,6 +115,36 @@ export async function createTestQuote(overrides: Partial }); } +/** + * Baseline configuration the quote pipeline expects in every environment: + * the "vortex" partner rows carrying the default platform fee (zero here; + * tests that assert fee math override via createTestPartner). + */ +export async function seedVortexPartners(): Promise { + for (const rampType of [RampDirection.BUY, RampDirection.SELL]) { + await createTestPartner({ displayName: "Vortex", name: "vortex", rampType }); + } +} + +/** An Avenia-KYC'd tax id linked to a user, as required by BRL ramp registration. */ +export async function createTestTaxId(userId: string, overrides: Partial<{ taxId: string; subAccountId: string }> = {}) { + const seq = nextSeq(); + return TaxId.create({ + accountType: AveniaAccountType.INDIVIDUAL, + finalQuoteId: null, + finalSessionId: null, + finalTimestamp: null, + initialQuoteId: null, + initialSessionId: null, + internalStatus: TaxIdInternalStatus.Accepted, + kycAttempt: null, + requestedDate: new Date(), + subAccountId: overrides.subAccountId ?? "test-subaccount-id", + taxId: overrides.taxId ?? `1234567890${seq}`, + userId + }); +} + const DEFAULT_UNSIGNED_TX: UnsignedTx = { network: Networks.Base, nonce: 0, diff --git a/apps/api/src/test-utils/fake-world/fake-anchors.ts b/apps/api/src/test-utils/fake-world/fake-anchors.ts index 5605d3473..0ccfe3d06 100644 --- a/apps/api/src/test-utils/fake-world/fake-anchors.ts +++ b/apps/api/src/test-utils/fake-world/fake-anchors.ts @@ -142,9 +142,18 @@ export class FakeBrla { }, getSubaccountUsedLimit: async () => ({ limitInfo: { - limitBurn: "10000000", - limitMint: "10000000", - usedLimit: "0" + blocked: false, + createdAt: new Date().toISOString(), + limits: [ + { + currency: "BRL", + maxChainIn: "10000000", + maxChainOut: "10000000", + maxFiatIn: "10000000", + maxFiatOut: "10000000", + usedLimit: { usedChainIn: "0", usedChainOut: "0", usedFiatIn: "0", usedFiatOut: "0" } + } + ] } }), subaccountInfo: async () => ({ diff --git a/apps/api/src/test-utils/fake-world/fake-auth.ts b/apps/api/src/test-utils/fake-world/fake-auth.ts new file mode 100644 index 000000000..54541a1cc --- /dev/null +++ b/apps/api/src/test-utils/fake-world/fake-auth.ts @@ -0,0 +1,30 @@ +import { SupabaseAuthService } from "../../api/services/auth"; + +const TOKEN_PREFIX = "test-user:"; + +/** Returns a Bearer token the fake verifier accepts for the given user id. */ +export function testUserToken(userId: string, email = "user@example.com"): string { + return `${TOKEN_PREFIX}${userId}:${email}`; +} + +/** + * Replaces Supabase token verification with a local parser: tokens minted by + * testUserToken() are valid, everything else is rejected. No Supabase calls. + */ +export function installFakeSupabaseAuth(): { restore: () => void } { + const original = SupabaseAuthService.verifyToken; + + SupabaseAuthService.verifyToken = async (accessToken: string) => { + if (!accessToken.startsWith(TOKEN_PREFIX)) { + return { valid: false }; + } + const [userId, email] = accessToken.slice(TOKEN_PREFIX.length).split(":"); + return { email, user_id: userId, valid: true }; + }; + + return { + restore: () => { + SupabaseAuthService.verifyToken = original; + } + }; +} diff --git a/apps/api/src/test-utils/fake-world/fake-prices.ts b/apps/api/src/test-utils/fake-world/fake-prices.ts index 1e34caf32..299e69bc9 100644 --- a/apps/api/src/test-utils/fake-world/fake-prices.ts +++ b/apps/api/src/test-utils/fake-world/fake-prices.ts @@ -10,6 +10,9 @@ import { priceFeedService } from "../../api/services/priceFeed.service"; export class FakePrices { /** CoinGecko-style token id → USD price. */ cryptoUsd: Record = { + ethereum: 2500, + moonbeam: 0.08, + "polygon-ecosystem-token": 0.5, "usd-coin": 1 }; /** Fiat/RampCurrency code (lowercased) → units of that currency per 1 USD. */ diff --git a/apps/api/src/test-utils/fake-world/fake-squidrouter.ts b/apps/api/src/test-utils/fake-world/fake-squidrouter.ts new file mode 100644 index 000000000..40450627b --- /dev/null +++ b/apps/api/src/test-utils/fake-world/fake-squidrouter.ts @@ -0,0 +1,55 @@ +import { mock } from "bun:test"; +import type { RouteParams } from "@vortexfi/shared"; +import * as shared from "@vortexfi/shared"; + +/** + * Fake SquidRouter route source. getRoute is a plain function export of + * @vortexfi/shared (not a singleton), so it is replaced via mock.module with + * the rest of the package passed through untouched. + */ +export class FakeSquidRouter { + /** Native value attached to the route tx (wei); drives the derived network fee. */ + transactionValueWei = "1000000000000000"; + /** Raw destination amount for a requested route. Default: 1:1 with the input. */ + computeToAmount: (params: RouteParams) => string = params => params.fromAmount; + toTokenDecimals = 18; + failNextRoute: Error | null = null; + readonly requestedRoutes: RouteParams[] = []; + + async getRoute(params: RouteParams) { + if (this.failNextRoute) { + const error = this.failNextRoute; + this.failNextRoute = null; + throw error; + } + this.requestedRoutes.push(params); + return { + data: { + route: { + estimate: { + toAmount: this.computeToAmount(params), + toToken: { decimals: this.toTokenDecimals } + }, + transactionRequest: { value: this.transactionValueWei } + } + }, + requestId: "fake-squid-request" + }; + } +} + +export function installFakeSquidRouter(): { fakeSquidRouter: FakeSquidRouter; restore: () => void } { + const fakeSquidRouter = new FakeSquidRouter(); + + mock.module("@vortexfi/shared", () => ({ + ...shared, + getRoute: (params: RouteParams) => fakeSquidRouter.getRoute(params) + })); + + return { + fakeSquidRouter, + restore: () => { + mock.module("@vortexfi/shared", () => ({ ...shared })); + } + }; +} diff --git a/apps/api/src/test-utils/fake-world/index.ts b/apps/api/src/test-utils/fake-world/index.ts index ff1209758..8b7920b6e 100644 --- a/apps/api/src/test-utils/fake-world/index.ts +++ b/apps/api/src/test-utils/fake-world/index.ts @@ -2,9 +2,10 @@ import { ApiManager } from "@vortexfi/shared"; import { type FakeAlfredpay, type FakeBrla, type FakeMykobo, installFakeAnchors } from "./fake-anchors"; import { type FakeEvm, installFakeEvm } from "./fake-evm"; import { type FakePrices, installFakePrices } from "./fake-prices"; +import { type FakeSquidRouter, installFakeSquidRouter } from "./fake-squidrouter"; import { installFetchGuard, uninstallFetchGuard } from "./fetch-guard"; -export type { FakeAlfredpay, FakeBrla, FakeEvm, FakeMykobo, FakePrices }; +export type { FakeAlfredpay, FakeBrla, FakeEvm, FakeMykobo, FakePrices, FakeSquidRouter }; export { installFetchGuard, uninstallFetchGuard }; export interface FakeWorld { @@ -13,6 +14,7 @@ export interface FakeWorld { brla: FakeBrla; alfredpay: FakeAlfredpay; prices: FakePrices; + squidRouter: FakeSquidRouter; restore: () => void; } @@ -27,6 +29,7 @@ export function installFakeWorld(): FakeWorld { const { fakeEvm, restore: restoreEvm } = installFakeEvm(); const { fakeAlfredpay, fakeBrla, fakeMykobo, restore: restoreAnchors } = installFakeAnchors(); const { fakePrices, restore: restorePrices } = installFakePrices(); + const { fakeSquidRouter, restore: restoreSquidRouter } = installFakeSquidRouter(); // Substrate/Pendulum flows are not faked yet; fail loudly if a code path // unexpectedly needs them so the gap is explicit rather than a hang. @@ -55,10 +58,12 @@ export function installFakeWorld(): FakeWorld { prices: fakePrices, restore: () => { ApiManager.getInstance = originalGetApiManager; + restoreSquidRouter(); restorePrices(); restoreAnchors(); restoreEvm(); uninstallFetchGuard(); - } + }, + squidRouter: fakeSquidRouter }; } diff --git a/apps/api/src/tests/auth.invariants.test.ts b/apps/api/src/tests/auth.invariants.test.ts new file mode 100644 index 000000000..1fe483a4c --- /dev/null +++ b/apps/api/src/tests/auth.invariants.test.ts @@ -0,0 +1,246 @@ +import { afterAll, beforeAll, beforeEach, describe, expect, it } from "bun:test"; +import { FiatToken, RampDirection } from "@vortexfi/shared"; +import { installFakeWorld, type FakeWorld } from "../test-utils/fake-world"; +import { installFakeSupabaseAuth, testUserToken } from "../test-utils/fake-world/fake-auth"; +import { setupTestDatabase, truncateAllTables } from "../test-utils/db"; +import { createTestApiKey, createTestPartner, createTestQuote, createTestRampState, createTestUser } from "../test-utils/factories"; +import { startTestApp, type TestApp } from "../test-utils/test-app"; + +/** + * HTTP-level auth and ownership invariants, derived from + * docs/security-spec/01-auth and 03-ramp-engine. Every test drives the real + * Express app against the real (test) database. + */ +describe("auth and ownership invariants", () => { + let world: FakeWorld; + let auth: { restore: () => void }; + let app: TestApp; + + const SIGNING_ACCOUNTS = [{ address: "0x30a300612ab372CC73e53ffE87fB73d62Ed68Da3", type: "EVM" }]; + + const register = (body: object, headers: Record = {}) => + app.request("/v1/ramp/register", { + body: JSON.stringify(body), + headers: { "Content-Type": "application/json", ...headers }, + method: "POST" + }); + + beforeAll(async () => { + world = installFakeWorld(); + auth = installFakeSupabaseAuth(); + await setupTestDatabase(); + app = await startTestApp(); + }); + + afterAll(async () => { + await app?.close(); + auth?.restore(); + world?.restore(); + }); + + beforeEach(async () => { + await truncateAllTables(); + }); + + describe("POST /v1/ramp/register credential checks", () => { + const body = { quoteId: crypto.randomUUID(), signingAccounts: SIGNING_ACCOUNTS }; + + it("rejects requests without credentials", async () => { + const response = await register(body); + expect(response.status).toBe(401); + }); + + it("rejects an invalid bearer token", async () => { + const response = await register(body, { Authorization: "Bearer not-a-real-token" }); + expect(response.status).toBe(401); + }); + + it("rejects a malformed API key", async () => { + const response = await register(body, { "X-API-Key": "sk_garbage" }); + expect(response.status).toBe(401); + const payload = (await response.json()) as { error: { code: string } }; + expect(payload.error.code).toBe("INVALID_SECRET_KEY"); + }); + + it("rejects a well-formed but unknown API key", async () => { + const response = await register(body, { + "X-API-Key": "sk_test_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }); + expect(response.status).toBe(401); + const payload = (await response.json()) as { error: { code: string } }; + expect(payload.error.code).toBe("INVALID_API_KEY"); + }); + + it("rejects a revoked API key", async () => { + const user = await createTestUser(); + const { record, plaintextKey } = await createTestApiKey({ userId: user.id }); + await record.update({ isActive: false }); + + const response = await register(body, { "X-API-Key": plaintextKey }); + expect(response.status).toBe(401); + }); + + it("rejects an expired API key", async () => { + const user = await createTestUser(); + const { record, plaintextKey } = await createTestApiKey({ userId: user.id }); + await record.update({ expiresAt: new Date(Date.now() - 1000) }); + + const response = await register(body, { "X-API-Key": plaintextKey }); + expect(response.status).toBe(401); + }); + + it("lets a valid user token past auth (404 for unknown quote, not 401)", async () => { + const user = await createTestUser(); + const response = await register(body, { Authorization: `Bearer ${testUserToken(user.id)}` }); + expect(response.status).toBe(404); + }); + + it("lets a valid partner API key past auth (404 for unknown quote, not 401)", async () => { + const user = await createTestUser(); + const { plaintextKey } = await createTestApiKey({ userId: user.id }); + const response = await register(body, { "X-API-Key": plaintextKey }); + expect(response.status).toBe(404); + }); + }); + + describe("GET /v1/ramp/:id ownership", () => { + it("serves the owner and denies other users and anonymous callers", async () => { + const owner = await createTestUser(); + const stranger = await createTestUser(); + const quote = await createTestQuote({ userId: owner.id }); + const ramp = await createTestRampState({ quoteId: quote.id, userId: owner.id }); + + const asOwner = await app.request(`/v1/ramp/${ramp.id}`, { + headers: { Authorization: `Bearer ${testUserToken(owner.id)}` } + }); + expect(asOwner.status).toBe(200); + + const asStranger = await app.request(`/v1/ramp/${ramp.id}`, { + headers: { Authorization: `Bearer ${testUserToken(stranger.id)}` } + }); + expect(asStranger.status).toBe(403); + + const asAnonymous = await app.request(`/v1/ramp/${ramp.id}`); + expect(asAnonymous.status).toBe(401); + }); + + it("serves fully anonymous ramps to anonymous callers", async () => { + const quote = await createTestQuote(); + const ramp = await createTestRampState({ quoteId: quote.id }); + + const response = await app.request(`/v1/ramp/${ramp.id}`); + expect(response.status).toBe(200); + }); + + it("denies a partner key that does not own the ramp's quote", async () => { + const owningPartner = await createTestPartner(); + const otherPartner = await createTestPartner(); + const { plaintextKey: otherKey } = await createTestApiKey({ partnerName: otherPartner.name }); + const { plaintextKey: owningKey } = await createTestApiKey({ partnerName: owningPartner.name }); + + const quote = await createTestQuote({ partnerId: owningPartner.id }); + const ramp = await createTestRampState({ quoteId: quote.id }); + + const asOther = await app.request(`/v1/ramp/${ramp.id}`, { headers: { "X-API-Key": otherKey } }); + expect(asOther.status).toBe(403); + + const asOwner = await app.request(`/v1/ramp/${ramp.id}`, { headers: { "X-API-Key": owningKey } }); + expect(asOwner.status).toBe(200); + }); + }); + + describe("quote lifecycle guards on registration", () => { + it("rejects an expired quote", async () => { + const user = await createTestUser(); + const quote = await createTestQuote({ expiresAt: new Date(Date.now() - 1000), userId: user.id }); + + const response = await register( + { quoteId: quote.id, signingAccounts: SIGNING_ACCOUNTS }, + { Authorization: `Bearer ${testUserToken(user.id)}` } + ); + expect(response.status).toBe(400); + expect(await response.text()).toContain("expired"); + }); + + it("rejects an already-consumed quote", async () => { + const user = await createTestUser(); + const quote = await createTestQuote({ status: "consumed", userId: user.id }); + + const response = await register( + { quoteId: quote.id, signingAccounts: SIGNING_ACCOUNTS }, + { Authorization: `Bearer ${testUserToken(user.id)}` } + ); + expect(response.status).toBe(400); + expect(await response.text()).toContain("consumed"); + }); + + it("rejects registration by a user who does not own the quote", async () => { + const owner = await createTestUser(); + const stranger = await createTestUser(); + const quote = await createTestQuote({ userId: owner.id }); + + const response = await register( + { quoteId: quote.id, signingAccounts: SIGNING_ACCOUNTS }, + { Authorization: `Bearer ${testUserToken(stranger.id)}` } + ); + expect(response.status).toBe(403); + }); + + it("rejects EUR ramps while the EUR kill-switch is active", async () => { + // Current production behavior (ramp.service.ts): EURC quotes cannot be + // registered. Remove/adjust this test when EUR ramps are re-enabled. + const user = await createTestUser(); + const quote = await createTestQuote({ inputCurrency: FiatToken.EURC, userId: user.id }); + + const response = await register( + { quoteId: quote.id, signingAccounts: SIGNING_ACCOUNTS }, + { Authorization: `Bearer ${testUserToken(user.id)}` } + ); + expect(response.status).toBe(503); + }); + + it("rejects registration of a quote from the other flow variant", async () => { + const user = await createTestUser(); + const quote = await createTestQuote({ + flowVariant: "monerium", + inputCurrency: FiatToken.BRL, + rampType: RampDirection.BUY, + userId: user.id + }); + + const response = await register( + { quoteId: quote.id, signingAccounts: SIGNING_ACCOUNTS }, + { Authorization: `Bearer ${testUserToken(user.id)}` } + ); + expect(response.status).toBeGreaterThanOrEqual(400); + }); + }); + + describe("admin authentication", () => { + it("guards partner API key admin routes with the admin secret", async () => { + const partner = await createTestPartner(); + const path = `/v1/admin/partners/${partner.name}/api-keys`; + + const noAuth = await app.request(path); + expect(noAuth.status).toBe(401); + + const wrongSecret = await app.request(path, { headers: { Authorization: "Bearer wrong-secret" } }); + expect(wrongSecret.status).toBe(403); + + const correctSecret = await app.request(path, { headers: { Authorization: "Bearer test-admin-secret" } }); + expect(correctSecret.status).toBe(200); + }); + + it("guards api-client-events with the metrics dashboard secret", async () => { + const wrongSecret = await app.request("/v1/admin/api-client-events", { + headers: { Authorization: "Bearer test-admin-secret" } + }); + expect(wrongSecret.status).toBe(403); + + const correctSecret = await app.request("/v1/admin/api-client-events", { + headers: { Authorization: "Bearer test-metrics-secret" } + }); + expect(correctSecret.status).toBe(200); + }); + }); +}); diff --git a/apps/api/src/tests/quote-consumption.invariants.test.ts b/apps/api/src/tests/quote-consumption.invariants.test.ts new file mode 100644 index 000000000..efd978e3a --- /dev/null +++ b/apps/api/src/tests/quote-consumption.invariants.test.ts @@ -0,0 +1,134 @@ +import { afterAll, beforeAll, beforeEach, describe, expect, it } from "bun:test"; +import { EvmToken, FiatToken, Networks, RampDirection } from "@vortexfi/shared"; +import QuoteTicket from "../models/quoteTicket.model"; +import RampState from "../models/rampState.model"; +import { installFakeWorld, type FakeWorld } from "../test-utils/fake-world"; +import { installFakeSupabaseAuth, testUserToken } from "../test-utils/fake-world/fake-auth"; +import { resetTestDatabase, setupTestDatabase } from "../test-utils/db"; +import { createTestTaxId, createTestUser } from "../test-utils/factories"; +import { startTestApp, type TestApp } from "../test-utils/test-app"; + +/** + * Quote consumption invariants (docs/security-spec/03-ramp-engine/ + * quote-lifecycle.md): a quote is consumed exactly once, atomically with ramp + * registration. Exercised over the real HTTP API on the BRL→BRLA-on-Base + * direct corridor — the full quote pipeline and registration flow run against + * the fake external world. + */ +describe("quote consumption invariants (BRL onramp)", () => { + let world: FakeWorld; + let auth: { restore: () => void }; + let app: TestApp; + + const DESTINATION = "0x7ba99e99bc669b3508aff9cc0a898e869459f877"; + const EPHEMERAL = "0x30a300612ab372CC73e53ffE87fB73d62Ed68Da3"; + const TAX_ID = "12345678901"; + + beforeAll(async () => { + world = installFakeWorld(); + auth = installFakeSupabaseAuth(); + await setupTestDatabase(); + app = await startTestApp(); + }); + + afterAll(async () => { + await app?.close(); + auth?.restore(); + world?.restore(); + }); + + beforeEach(async () => { + await resetTestDatabase(); + }); + + async function createQuoteViaApi(): Promise<{ id: string; outputAmount: string; fee: unknown }> { + const response = await app.request("/v1/quotes", { + body: JSON.stringify({ + from: "pix", + inputAmount: "100", + inputCurrency: FiatToken.BRL, + network: Networks.Base, + outputCurrency: EvmToken.BRLA, + rampType: RampDirection.BUY, + to: Networks.Base + }), + headers: { "Content-Type": "application/json" }, + method: "POST" + }); + expect(response.status).toBe(201); + return (await response.json()) as { id: string; outputAmount: string; fee: unknown }; + } + + async function registerViaApi(quoteId: string, userId: string): Promise { + return app.request("/v1/ramp/register", { + body: JSON.stringify({ + additionalData: { destinationAddress: DESTINATION, taxId: TAX_ID }, + quoteId, + signingAccounts: [{ address: EPHEMERAL, type: "EVM" }] + }), + headers: { + Authorization: `Bearer ${testUserToken(userId)}`, + "Content-Type": "application/json" + }, + method: "POST" + }); + } + + it("serves a BRL onramp quote hermetically through the full quote pipeline", async () => { + const quote = await createQuoteViaApi(); + expect(quote.id).toBeTruthy(); + expect(Number(quote.outputAmount)).toBeGreaterThan(0); + + const persisted = await QuoteTicket.findByPk(quote.id); + expect(persisted?.status).toBe("pending"); + expect(persisted?.metadata.fees?.usd).toBeDefined(); + expect(persisted?.metadata.fees?.displayFiat).toBeDefined(); + }); + + it("registers a ramp and consumes the quote exactly once", async () => { + const user = await createTestUser(); + await createTestTaxId(user.id, { taxId: TAX_ID }); + const quote = await createQuoteViaApi(); + + const response = await registerViaApi(quote.id, user.id); + expect(response.status).toBe(201); + + const ramp = (await response.json()) as { id: string; unsignedTxs: Array<{ phase: string }> }; + expect(ramp.unsignedTxs.map(tx => tx.phase)).toContain("destinationTransfer"); + + const consumedQuote = await QuoteTicket.findByPk(quote.id); + expect(consumedQuote?.status).toBe("consumed"); + + const rampState = await RampState.findByPk(ramp.id); + expect(rampState?.quoteId).toBe(quote.id); + expect(rampState?.state.depositQrCode).toBeTruthy(); + }); + + it("allows exactly one of two concurrent registrations of the same quote", async () => { + const user = await createTestUser(); + await createTestTaxId(user.id, { taxId: TAX_ID }); + const quote = await createQuoteViaApi(); + + const [first, second] = await Promise.all([registerViaApi(quote.id, user.id), registerViaApi(quote.id, user.id)]); + + const statuses = [first.status, second.status].sort(); + expect(statuses[0]).toBe(201); + expect(statuses[1]).toBeGreaterThanOrEqual(400); + + const ramps = await RampState.findAll({ where: { quoteId: quote.id } }); + expect(ramps.length).toBe(1); + }); + + it("rejects a second registration after the quote is consumed", async () => { + const user = await createTestUser(); + await createTestTaxId(user.id, { taxId: TAX_ID }); + const quote = await createQuoteViaApi(); + + const first = await registerViaApi(quote.id, user.id); + expect(first.status).toBe(201); + + const second = await registerViaApi(quote.id, user.id); + expect(second.status).toBe(400); + expect(await second.text()).toContain("consumed"); + }); +}); diff --git a/apps/api/src/tests/zzz-leak-probe.test.ts b/apps/api/src/tests/zzz-leak-probe.test.ts new file mode 100644 index 000000000..847fc1622 --- /dev/null +++ b/apps/api/src/tests/zzz-leak-probe.test.ts @@ -0,0 +1,14 @@ +import { describe, expect, it } from "bun:test"; +import QuoteTicket from "../models/quoteTicket.model"; + +describe("leak probe", () => { + it("checks whether QuoteTicket.findByPk was leaked from another test file", async () => { + const fn = QuoteTicket.findByPk as unknown as { mock?: unknown }; + console.log("PROBE: findByPk is bun mock?", fn.mock !== undefined); + if (fn.mock !== undefined) { + const result = await (QuoteTicket.findByPk as unknown as (id: string) => Promise)("nonexistent-quote-id"); + console.log("PROBE: findByPk('nonexistent-quote-id') returned:", JSON.stringify(result)); + } + expect(true).toBe(true); + }); +}); From a12f4a0e4f09c5a4051c11011d85fdc5f896f6ac Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 10:44:37 +0200 Subject: [PATCH 093/176] Add XState machine tests for ramp and KYC flows 62 tests covering ramp.machine plus the Alfredpay/Avenia/Mykobo KYC machines in isolation (createActor + provided fake actors, no React): happy paths, auth/OTP flows, signing rejection, KYC failure branches, context updates and emitted toast events. Adds an explicit vitest.config.ts (node env, src/**/*.test.ts(x)) so test runs no longer load the full Vite build pipeline. Suspected machine bugs found while testing are documented via NOTE comments in the tests (e.g. brlaKyc FormFilling.GO_BACK targeting DocumentUpload from the initial state; alfredpayKyc CheckingStatus business guard missing AR). --- .../src/machines/alfredpayKyc.machine.test.ts | 433 ++++++++++++++ .../src/machines/brlaKyc.machine.test.ts | 345 +++++++++++ .../src/machines/mykoboKyc.machine.test.ts | 210 +++++++ .../src/machines/ramp.machine.test.ts | 538 ++++++++++++++++++ apps/frontend/vitest.config.ts | 11 + 5 files changed, 1537 insertions(+) create mode 100644 apps/frontend/src/machines/alfredpayKyc.machine.test.ts create mode 100644 apps/frontend/src/machines/brlaKyc.machine.test.ts create mode 100644 apps/frontend/src/machines/mykoboKyc.machine.test.ts create mode 100644 apps/frontend/src/machines/ramp.machine.test.ts create mode 100644 apps/frontend/vitest.config.ts diff --git a/apps/frontend/src/machines/alfredpayKyc.machine.test.ts b/apps/frontend/src/machines/alfredpayKyc.machine.test.ts new file mode 100644 index 000000000..4fc0d6e46 --- /dev/null +++ b/apps/frontend/src/machines/alfredpayKyc.machine.test.ts @@ -0,0 +1,433 @@ +import { afterEach, describe, expect, it, vi } from "vitest"; +import { createActor, fromPromise, waitFor } from "xstate"; + +// The real module instantiates a Supabase client at import time, which fails in a node test environment. +vi.mock("../services/auth", () => ({ + AuthService: { + getTokens: vi.fn(), + refreshAccessToken: vi.fn(), + storeTokens: vi.fn() + } +})); + +import { + AlfredPayStatus, + AlfredpayCreateCustomerResponse, + AlfredpayGetKycRedirectLinkResponse, + AlfredpayGetKycStatusResponse, + AlfredpayKybCustomerAndBusiness, + AlfredpayStatusResponse, + SubmitKybInformationResponse, + SubmitKycInformationResponse +} from "@vortexfi/shared"; +import { + AlfredpayKycFormData, + AlfredpayKycMachineErrorType, + alfredpayKycMachine, + KybBusinessFiles, + KybFormData, + MxnKycFiles +} from "./alfredpayKyc.machine"; +import { AlfredpayKycContext } from "./kyc.states"; +import { initialRampContext } from "./ramp.context"; + +function deferred() { + let resolve!: (value: T) => void; + let reject!: (error: unknown) => void; + const promise = new Promise((res, rej) => { + resolve = res; + reject = rej; + }); + return { promise, reject, resolve }; +} + +// XState actor logic is invariant in its output type, so fakes must declare the exact output of the real actor. +type SubmitFilesInput = AlfredpayKycContext & { mxnFormData?: AlfredpayKycFormData; mxnFiles?: MxnKycFiles }; +type KybFilesInput = AlfredpayKycContext & { kybBusinessFiles?: KybBusinessFiles }; + +const notifyActor = () => fromPromise<{ success: boolean }, AlfredpayKycContext>(async () => ({ success: true })); + +const statusOf = (status: AlfredPayStatus) => ({ status }) as AlfredpayStatusResponse; +const kycStatusOf = (status: AlfredPayStatus, lastFailure?: string) => + ({ lastFailure, status }) as AlfredpayGetKycStatusResponse; + +const baseInput: AlfredpayKycContext = { + ...initialRampContext, + country: "US" +}; + +const kycLink: AlfredpayGetKycRedirectLinkResponse = { + submissionId: "link-sub-1", + verification_url: "https://verify.alfred.example" +}; + +const mxnFormData = { firstName: "Frida" } as unknown as AlfredpayKycFormData; +const mxnFiles = { back: {} as File, front: {} as File } as MxnKycFiles; +const kybFormData = { businessName: "ACME" } as unknown as KybFormData; +const kybBusinessFiles = { + articlesIncorporation: {} as File, + docBack: {} as File, + docFront: {} as File, + proofAddress: {} as File, + taxIdDocument: {} as File +} as KybBusinessFiles; + +function createTestActor( + actors: Parameters[0]["actors"], + input: AlfredpayKycContext = baseInput +) { + return createActor(alfredpayKycMachine.provide({ actors }), { input }); +} + +afterEach(() => { + vi.unstubAllGlobals(); +}); + +describe("alfredpayKycMachine", () => { + describe("CheckingStatus routing", () => { + it("finishes immediately when the status is already Success", async () => { + const actor = createTestActor({ + checkStatus: fromPromise(async () => statusOf(AlfredPayStatus.Success)) + }); + actor.start(); + + await waitFor(actor, s => s.status === "done"); + expect(actor.getSnapshot().value).toBe("Done"); + expect(actor.getSnapshot().output?.error).toBeUndefined(); + }); + + it("polls a Verifying status through to VerificationDone and Done", async () => { + const poll = deferred(); + const actor = createTestActor({ + checkStatus: fromPromise(async () => statusOf(AlfredPayStatus.Verifying)), + pollStatus: fromPromise(() => poll.promise) + }); + actor.start(); + + await waitFor(actor, s => s.matches("PollingStatus")); + + poll.resolve(kycStatusOf(AlfredPayStatus.Success)); + await waitFor(actor, s => s.matches("VerificationDone")); + + actor.send({ type: "CONFIRM_SUCCESS" }); + expect(actor.getSnapshot().value).toBe("Done"); + expect(actor.getSnapshot().status).toBe("done"); + }); + + it("a Failed status lands in FailureKyc and USER_CANCEL finishes with the error", async () => { + const actor = createTestActor({ + checkStatus: fromPromise(async () => statusOf(AlfredPayStatus.Failed)) + }); + actor.start(); + + await waitFor(actor, s => s.matches("FailureKyc")); + expect(actor.getSnapshot().context.error?.message).toBe("KYC Failed"); + expect(actor.getSnapshot().context.error?.type).toBe(AlfredpayKycMachineErrorType.UnknownError); + + actor.send({ type: "USER_CANCEL" }); + const snapshot = actor.getSnapshot(); + expect(snapshot.value).toBe("Done"); + expect(snapshot.output?.error?.message).toBe("KYC Failed"); + }); + + it("USER_RETRY from FailureKyc retries and returns to the link flow for iFrame countries", async () => { + const actor = createTestActor({ + checkStatus: fromPromise(async () => statusOf(AlfredPayStatus.Failed)), + getKycLink: fromPromise(() => new Promise(() => {})), + retryKyc: fromPromise(async () => kycLink) + }); + actor.start(); + await waitFor(actor, s => s.matches("FailureKyc")); + + actor.send({ type: "USER_RETRY" }); + expect(actor.getSnapshot().value).toBe("Retrying"); + await waitFor(actor, s => s.matches("GettingKycLink")); + }); + + it("a 404 (no customer) routes to CustomerDefinition where the customer type can be toggled", async () => { + const actor = createTestActor({ + checkStatus: fromPromise(async () => { + throw new Error("Request failed with status 404"); + }), + createCustomer: fromPromise(async () => ({}) as AlfredpayCreateCustomerResponse), + getKycLink: fromPromise(() => new Promise(() => {})) + }); + actor.start(); + + await waitFor(actor, s => s.matches("CustomerDefinition")); + + actor.send({ type: "TOGGLE_BUSINESS" }); + expect(actor.getSnapshot().context.business).toBe(true); + actor.send({ type: "TOGGLE_BUSINESS" }); + expect(actor.getSnapshot().context.business).toBe(false); + + actor.send({ type: "USER_ACCEPT" }); + expect(actor.getSnapshot().value).toBe("CreatingCustomer"); + // Country US is an iFrame country, so a fresh customer goes to the redirect-link flow. + await waitFor(actor, s => s.matches("GettingKycLink")); + }); + + it("a non-404 status check error lands in Failure and RETRY_PROCESS re-runs the check", async () => { + let calls = 0; + const actor = createTestActor({ + checkStatus: fromPromise(() => { + calls += 1; + if (calls === 1) return Promise.reject(new Error("service unavailable")); + return new Promise(() => {}); + }) + }); + actor.start(); + + await waitFor(actor, s => s.matches("Failure")); + expect(actor.getSnapshot().context.error?.message).toBe("service unavailable"); + + actor.send({ type: "RETRY_PROCESS" }); + expect(actor.getSnapshot().value).toBe("CheckingStatus"); + expect(calls).toBe(2); + }); + + it("CANCEL_PROCESS from Failure finishes the machine with the error in the output", async () => { + const actor = createTestActor({ + checkStatus: fromPromise(async () => { + throw new Error("service unavailable"); + }) + }); + actor.start(); + await waitFor(actor, s => s.matches("Failure")); + + actor.send({ type: "CANCEL_PROCESS" }); + expect(actor.getSnapshot().value).toBe("Done"); + expect(actor.getSnapshot().output?.error?.message).toBe("service unavailable"); + }); + }); + + describe("iFrame link flow (US)", () => { + it("gets a link, opens it, and reports a failed verification with the lastFailure message", async () => { + const openSpy = vi.fn(); + vi.stubGlobal("window", { open: openSpy }); + + const poll = deferred(); + const actor = createTestActor({ + checkStatus: fromPromise(async () => statusOf(AlfredPayStatus.Consulted)), + getKycLink: fromPromise(async () => kycLink), + notifyFinished: notifyActor(), + notifyOpened: notifyActor(), + pollStatus: fromPromise(() => poll.promise), + waitForValidation: fromPromise(() => new Promise(() => {})) + }); + actor.start(); + + await waitFor(actor, s => s.matches("LinkReady")); + expect(actor.getSnapshot().context.submissionId).toBe("link-sub-1"); + expect(actor.getSnapshot().context.verificationUrl).toBe("https://verify.alfred.example"); + + actor.send({ type: "OPEN_LINK" }); + expect(openSpy).toHaveBeenCalledWith("https://verify.alfred.example", "_blank"); + + await waitFor(actor, s => s.matches("FillingKyc")); + + actor.send({ type: "COMPLETED_FILLING" }); + expect(actor.getSnapshot().value).toBe("FinishingFilling"); + await waitFor(actor, s => s.matches("PollingStatus")); + + poll.resolve(kycStatusOf(AlfredPayStatus.Failed, "Document expired")); + await waitFor(actor, s => s.matches("FailureKyc")); + expect(actor.getSnapshot().context.error?.message).toBe("Document expired"); + }); + + it("background validation completing moves FillingKyc to PollingStatus without user action", async () => { + vi.stubGlobal("window", { open: vi.fn() }); + const validation = deferred(); + const actor = createTestActor({ + checkStatus: fromPromise(async () => statusOf(AlfredPayStatus.Consulted)), + getKycLink: fromPromise(async () => kycLink), + notifyOpened: notifyActor(), + pollStatus: fromPromise(() => new Promise(() => {})), + waitForValidation: fromPromise(() => validation.promise) + }); + actor.start(); + + await waitFor(actor, s => s.matches("LinkReady")); + actor.send({ type: "OPEN_LINK" }); + await waitFor(actor, s => s.matches("FillingKyc")); + + validation.resolve(kycStatusOf(AlfredPayStatus.Verifying)); + await waitFor(actor, s => s.matches("PollingStatus")); + }); + + it("moves to Failure when fetching the KYC link fails", async () => { + const actor = createTestActor({ + checkStatus: fromPromise(async () => statusOf(AlfredPayStatus.Consulted)), + getKycLink: fromPromise(async () => { + throw new Error("link service down"); + }) + }); + actor.start(); + + await waitFor(actor, s => s.matches("Failure")); + expect(actor.getSnapshot().context.error?.message).toBe("Failed to get KYC link"); + }); + }); + + describe("API-based KYC form flow (MX)", () => { + const mxInput: AlfredpayKycContext = { ...baseInput, country: "MX" }; + + it("submits the form, uploads documents, and sends the submission through to polling", async () => { + const poll = deferred(); + const actor = createTestActor( + { + checkStatus: fromPromise(async () => statusOf(AlfredPayStatus.Consulted)), + pollStatus: fromPromise(() => poll.promise), + sendSubmission: fromPromise(async () => undefined), + submitFiles: fromPromise(async () => undefined), + submitKycInfo: fromPromise(async () => ({ submissionId: "kyc-sub-9" }) as SubmitKycInformationResponse) + }, + mxInput + ); + actor.start(); + + await waitFor(actor, s => s.matches("FillingKycForm")); + + actor.send({ data: mxnFormData, type: "SUBMIT_FORM" }); + expect(actor.getSnapshot().value).toBe("SubmittingKycInfo"); + expect(actor.getSnapshot().context.mxnFormData).toEqual(mxnFormData); + + await waitFor(actor, s => s.matches("UploadingDocuments")); + expect(actor.getSnapshot().context.submissionId).toBe("kyc-sub-9"); + + actor.send({ files: mxnFiles, type: "SUBMIT_FILES" }); + expect(actor.getSnapshot().value).toBe("SubmittingFiles"); + expect(actor.getSnapshot().context.mxnFiles).toBe(mxnFiles); + + await waitFor(actor, s => s.matches("PollingStatus")); + + poll.resolve(kycStatusOf(AlfredPayStatus.Success)); + await waitFor(actor, s => s.matches("VerificationDone")); + }); + + it("skips re-submitting KYC info when a submissionId already exists", async () => { + const actor = createTestActor( + { + checkStatus: fromPromise(async () => statusOf(AlfredPayStatus.Consulted)) + }, + { ...mxInput, submissionId: "existing-sub" } + ); + actor.start(); + + await waitFor(actor, s => s.matches("FillingKycForm")); + actor.send({ data: mxnFormData, type: "SUBMIT_FORM" }); + expect(actor.getSnapshot().value).toBe("UploadingDocuments"); + }); + + it("a failed document upload returns to UploadingDocuments with the error", async () => { + const actor = createTestActor( + { + checkStatus: fromPromise(async () => statusOf(AlfredPayStatus.Consulted)), + submitFiles: fromPromise(async () => { + throw new Error("upload failed"); + }), + submitKycInfo: fromPromise(async () => ({ submissionId: "kyc-sub-9" }) as SubmitKycInformationResponse) + }, + mxInput + ); + actor.start(); + + await waitFor(actor, s => s.matches("FillingKycForm")); + actor.send({ data: mxnFormData, type: "SUBMIT_FORM" }); + await waitFor(actor, s => s.matches("UploadingDocuments")); + + actor.send({ files: mxnFiles, type: "SUBMIT_FILES" }); + await waitFor(actor, s => s.matches("UploadingDocuments") && s.context.error !== undefined); + expect(actor.getSnapshot().context.error?.message).toBe("upload failed"); + }); + }); + + describe("KYB flow (MX business)", () => { + const kybInput: AlfredpayKycContext = { ...baseInput, business: true, country: "MX" }; + + it("submits KYB info, uploads documents, and sends the submission through to polling", async () => { + const actor = createTestActor( + { + checkStatus: fromPromise(async () => statusOf(AlfredPayStatus.Consulted)), + findKybCustomerAndBusiness: fromPromise( + async () => [{ relatedPersons: [{ idRelatedPerson: "rp-1" }] }] as unknown as AlfredpayKybCustomerAndBusiness[] + ), + pollStatus: fromPromise(() => new Promise(() => {})), + sendKybSubmissionActor: fromPromise(async () => undefined), + submitKybBusinessFiles: fromPromise(async () => undefined), + submitKybInfo: fromPromise(async () => ({ submissionId: "kyb-sub-1" }) as SubmitKybInformationResponse), + submitKybRelatedPersonBundleFiles: fromPromise(async () => undefined) + }, + kybInput + ); + actor.start(); + + await waitFor(actor, s => s.matches("FillingKybForm")); + + actor.send({ data: kybFormData, type: "SUBMIT_KYB_FORM" }); + expect(actor.getSnapshot().value).toBe("SubmittingKybInfo"); + expect(actor.getSnapshot().context.kybFormData).toEqual(kybFormData); + + await waitFor(actor, s => s.matches("UploadingKybBusinessDocs")); + expect(actor.getSnapshot().context.submissionId).toBe("kyb-sub-1"); + + actor.send({ files: kybBusinessFiles, type: "SUBMIT_KYB_BUSINESS_FILES" }); + await waitFor(actor, s => s.matches("PollingStatus")); + expect(actor.getSnapshot().context.kybRelatedPersonIds).toEqual(["rp-1"]); + }); + + it("fails when the KYB submission response has no submission id", async () => { + const actor = createTestActor( + { + checkStatus: fromPromise(async () => statusOf(AlfredPayStatus.Consulted)), + submitKybInfo: fromPromise(async () => ({ submissionId: "" }) as SubmitKybInformationResponse) + }, + kybInput + ); + actor.start(); + + await waitFor(actor, s => s.matches("FillingKybForm")); + actor.send({ data: kybFormData, type: "SUBMIT_KYB_FORM" }); + + await waitFor(actor, s => s.matches("Failure")); + expect(actor.getSnapshot().context.error?.message).toContain("did not return a submission ID"); + }); + + it("fails when no related person ids can be extracted", async () => { + const actor = createTestActor( + { + checkStatus: fromPromise(async () => statusOf(AlfredPayStatus.Consulted)), + findKybCustomerAndBusiness: fromPromise(async () => [] as AlfredpayKybCustomerAndBusiness[]), + submitKybBusinessFiles: fromPromise(async () => undefined), + submitKybInfo: fromPromise(async () => ({ submissionId: "kyb-sub-1" }) as SubmitKybInformationResponse) + }, + kybInput + ); + actor.start(); + + await waitFor(actor, s => s.matches("FillingKybForm")); + actor.send({ data: kybFormData, type: "SUBMIT_KYB_FORM" }); + await waitFor(actor, s => s.matches("UploadingKybBusinessDocs")); + actor.send({ files: kybBusinessFiles, type: "SUBMIT_KYB_BUSINESS_FILES" }); + + await waitFor(actor, s => s.matches("Failure")); + expect(actor.getSnapshot().context.error?.message).toContain("did not return relatedPersons[].idRelatedPerson"); + }); + + // NOTE: documents current behavior — for country AR with business=true, CheckingStatus routes to the + // *individual* KYC form (FillingKycForm) because its business guard only covers MX/CO + // (alfredpayKyc.machine.ts:388), while CreatingCustomer and Retrying include AR in their business + // guards (alfredpayKyc.machine.ts:434, :674). This inconsistency looks unintended. + it("AR business customers are routed to the individual KYC form from CheckingStatus", async () => { + const actor = createTestActor( + { + checkStatus: fromPromise(async () => statusOf(AlfredPayStatus.Consulted)) + }, + { ...baseInput, business: true, country: "AR" } + ); + actor.start(); + + await waitFor(actor, s => s.matches("FillingKycForm")); + }); + }); +}); diff --git a/apps/frontend/src/machines/brlaKyc.machine.test.ts b/apps/frontend/src/machines/brlaKyc.machine.test.ts new file mode 100644 index 000000000..0bf7007ee --- /dev/null +++ b/apps/frontend/src/machines/brlaKyc.machine.test.ts @@ -0,0 +1,345 @@ +import { describe, expect, it, vi } from "vitest"; +import { createActor, fromPromise, waitFor } from "xstate"; + +// The real module instantiates a Supabase client at import time, which fails in a node test environment. +vi.mock("../services/auth", () => ({ + AuthService: { + getTokens: vi.fn(), + refreshAccessToken: vi.fn(), + storeTokens: vi.fn() + } +})); + +import { BrlaGetKycStatusResponse, KycFailureReason } from "@vortexfi/shared"; +import { KYCFormData } from "../hooks/brla/useKYCForm"; +import { KybLevel1Response } from "../services/api"; +import { KycStatus, KycSubmissionRejectedError } from "../services/signingService"; +import { VerifyStatusActorOutput } from "./actors/brla/verifyLevel1Status.actor"; +import { AveniaKycMachineErrorType, aveniaKycMachine, UploadIds } from "./brlaKyc.machine"; +import { AveniaKycContext } from "./kyc.states"; +import { initialRampContext } from "./ramp.context"; +import { RampContext } from "./types"; + +function deferred() { + let resolve!: (value: T) => void; + let reject!: (error: unknown) => void; + const promise = new Promise((res, rej) => { + resolve = res; + reject = rej; + }); + return { promise, reject, resolve }; +} + +// Must match the exact output type of the real createSubaccountActor (actor logic is invariant in its output). +type SubaccountOutput = { + subAccountId: string; + maybeKycAttemptStatus?: BrlaGetKycStatusResponse; + isCompany: boolean; + kybUrls?: KybLevel1Response; +}; + +const baseInput: RampContext = { + ...initialRampContext, + connectedWalletAddress: "0x1111111111111111111111111111111111111111", + quoteId: "quote-1" +}; + +const formData = { taxId: "12345678900" } as KYCFormData; +const uploadIds: UploadIds = { + livenessUrl: "https://liveness.example", + uploadedDocumentId: "doc-1", + uploadedSelfieId: "selfie-1" +}; + +function createTestActor(actors: Parameters[0]["actors"]) { + return createActor(aveniaKycMachine.provide({ actors }), { input: baseInput }); +} + +function subaccountActorWith(output: SubaccountOutput) { + return fromPromise(async () => output); +} + +describe("aveniaKycMachine", () => { + it("walks the individual happy path from form filling to Finish", async () => { + const subaccount = deferred(); + const submit = deferred(); + const verify = deferred(); + const actor = createTestActor({ + createSubaccountActor: fromPromise(() => subaccount.promise), + submitActor: fromPromise(() => submit.promise), + verifyStatusActor: fromPromise(() => verify.promise) + }); + actor.start(); + + expect(actor.getSnapshot().value).toBe("FormFilling"); + + actor.send({ formData, type: "FORM_SUBMIT" }); + expect(actor.getSnapshot().value).toBe("SubaccountSetup"); + expect(actor.getSnapshot().context.taxId).toBe("12345678900"); + expect(actor.getSnapshot().context.kycFormData).toEqual(formData); + + subaccount.resolve({ isCompany: false, subAccountId: "sub-1" }); + await waitFor(actor, s => s.matches("DocumentUpload")); + expect(actor.getSnapshot().context.subAccountId).toBe("sub-1"); + expect(actor.getSnapshot().context.isCompany).toBe(false); + + actor.send({ documentsId: uploadIds, type: "DOCUMENTS_SUBMIT" }); + expect(actor.getSnapshot().value).toBe("LivenessCheck"); + expect(actor.getSnapshot().context.documentUploadIds).toEqual(uploadIds); + + // LIVENESS_DONE is guarded: it must be ignored until the liveness check was actually opened. + actor.send({ type: "LIVENESS_DONE" }); + expect(actor.getSnapshot().value).toBe("LivenessCheck"); + + actor.send({ type: "LIVENESS_OPENED" }); + expect(actor.getSnapshot().context.livenessCheckOpened).toBe(true); + actor.send({ type: "LIVENESS_DONE" }); + expect(actor.getSnapshot().value).toBe("Submit"); + expect(actor.getSnapshot().context.kycStatus).toBe(KycStatus.PENDING); + // Exiting LivenessCheck resets the opened flag. + expect(actor.getSnapshot().context.livenessCheckOpened).toBe(false); + + submit.resolve(undefined); + await waitFor(actor, s => s.matches("Verifying")); + + verify.resolve({ type: "APPROVED" }); + await waitFor(actor, s => s.matches("Success")); + expect(actor.getSnapshot().context.kycStatus).toBe(KycStatus.APPROVED); + + actor.send({ type: "CLOSE_SUCCESS_MODAL" }); + const snapshot = actor.getSnapshot(); + expect(snapshot.value).toBe("Finish"); + expect(snapshot.status).toBe("done"); + expect(snapshot.output?.kycStatus).toBe(KycStatus.APPROVED); + expect(snapshot.output?.error).toBeUndefined(); + }); + + it("routes companies with KYB URLs into the KYB flow and through its steps", async () => { + const actor = createTestActor({ + createSubaccountActor: subaccountActorWith({ + isCompany: true, + kybUrls: { + attemptId: "attempt-1", + authorizedRepresentativeUrl: "https://rep.example", + basicCompanyDataUrl: "https://company.example" + }, + subAccountId: "sub-2" + }) + }); + actor.start(); + actor.send({ formData: { taxId: "12345678000199" } as KYCFormData, type: "FORM_SUBMIT" }); + + await waitFor(actor, s => s.matches({ KYBFlow: "CompanyVerification" })); + let context = actor.getSnapshot().context; + expect(context.kybStep).toBe("company"); + expect(context.kybAttemptId).toBe("attempt-1"); + expect(context.kybUrls).toEqual({ + authorizedRepresentativeUrl: "https://rep.example", + basicCompanyDataUrl: "https://company.example" + }); + + actor.send({ type: "COMPANY_VERIFICATION_STARTED" }); + expect(actor.getSnapshot().context.companyVerificationStarted).toBe(true); + + actor.send({ type: "KYB_COMPANY_DONE" }); + expect(actor.getSnapshot().value).toEqual({ KYBFlow: "RepresentativeVerification" }); + expect(actor.getSnapshot().context.kybStep).toBe("representative"); + + actor.send({ type: "KYB_COMPANY_BACK" }); + expect(actor.getSnapshot().value).toEqual({ KYBFlow: "CompanyVerification" }); + actor.send({ type: "KYB_COMPANY_DONE" }); + + actor.send({ type: "REPRESENTATIVE_VERIFICATION_STARTED" }); + expect(actor.getSnapshot().context.representativeVerificationStarted).toBe(true); + + actor.send({ type: "KYB_REPRESENTATIVE_DONE" }); + context = actor.getSnapshot().context; + expect(actor.getSnapshot().value).toEqual({ KYBFlow: "StatusVerification" }); + expect(context.kybStep).toBe("verification"); + expect(context.kycStatus).toBe(KycStatus.PENDING); + + actor.send({ type: "KYB_COMPLETE" }); + expect(actor.getSnapshot().value).toBe("Success"); + }); + + it("resumes into Verifying when a KYC attempt is already in progress", async () => { + const actor = createTestActor({ + createSubaccountActor: subaccountActorWith({ + isCompany: false, + maybeKycAttemptStatus: { status: "PROCESSING" } as unknown as BrlaGetKycStatusResponse, + subAccountId: "sub-3" + }), + verifyStatusActor: fromPromise(() => new Promise(() => {})) + }); + actor.start(); + actor.send({ formData, type: "FORM_SUBMIT" }); + + await waitFor(actor, s => s.matches("Verifying")); + expect(actor.getSnapshot().context.kycStatus).toBe(KycStatus.PENDING); + }); + + it("subaccount creation failure lands in Failure and RETRY returns to the form", async () => { + const actor = createTestActor({ + createSubaccountActor: fromPromise(async () => { + throw new Error("subaccount failed"); + }) + }); + actor.start(); + actor.send({ formData, type: "FORM_SUBMIT" }); + + await waitFor(actor, s => s.matches("Failure")); + expect(actor.getSnapshot().context.error?.type).toBe(AveniaKycMachineErrorType.UnknownError); + expect(actor.getSnapshot().context.error?.message).toBe("subaccount failed"); + + actor.send({ type: "RETRY" }); + expect(actor.getSnapshot().value).toBe("FormFilling"); + }); + + it("cancelling from Failure finishes with a UserCancelled error output", async () => { + const actor = createTestActor({ + createSubaccountActor: fromPromise(async () => { + throw new Error("subaccount failed"); + }) + }); + actor.start(); + actor.send({ formData, type: "FORM_SUBMIT" }); + await waitFor(actor, s => s.matches("Failure")); + + actor.send({ type: "CANCEL_RETRY" }); + const snapshot = actor.getSnapshot(); + expect(snapshot.value).toBe("Finish"); + expect(snapshot.status).toBe("done"); + expect(snapshot.output?.error?.type).toBe(AveniaKycMachineErrorType.UserCancelled); + }); + + it("a rejected submission moves to Rejected with the reject reason", async () => { + const actor = createTestActor({ + createSubaccountActor: subaccountActorWith({ isCompany: false, subAccountId: "sub-1" }), + submitActor: fromPromise(async () => { + throw new KycSubmissionRejectedError("document unreadable"); + }) + }); + actor.start(); + actor.send({ formData, type: "FORM_SUBMIT" }); + await waitFor(actor, s => s.matches("DocumentUpload")); + actor.send({ documentsId: uploadIds, type: "DOCUMENTS_SUBMIT" }); + actor.send({ type: "LIVENESS_OPENED" }); + actor.send({ type: "LIVENESS_DONE" }); + + await waitFor(actor, s => s.matches("Rejected")); + expect(actor.getSnapshot().context.kycStatus).toBe(KycStatus.REJECTED); + expect(actor.getSnapshot().context.rejectReason).toBe("document unreadable"); + + actor.send({ type: "RETRY" }); + expect(actor.getSnapshot().value).toBe("FormFilling"); + }); + + it("a generic submission error moves to Failure", async () => { + const actor = createTestActor({ + createSubaccountActor: subaccountActorWith({ isCompany: false, subAccountId: "sub-1" }), + submitActor: fromPromise(async () => { + throw new Error("network error"); + }) + }); + actor.start(); + actor.send({ formData, type: "FORM_SUBMIT" }); + await waitFor(actor, s => s.matches("DocumentUpload")); + actor.send({ documentsId: uploadIds, type: "DOCUMENTS_SUBMIT" }); + actor.send({ type: "LIVENESS_OPENED" }); + actor.send({ type: "LIVENESS_DONE" }); + + await waitFor(actor, s => s.matches("Failure")); + expect(actor.getSnapshot().context.error?.message).toBe("network error"); + }); + + it("a rejected verification result moves to Rejected with the failure reason", async () => { + const actor = createTestActor({ + createSubaccountActor: subaccountActorWith({ isCompany: false, subAccountId: "sub-1" }), + submitActor: fromPromise(async () => undefined), + verifyStatusActor: fromPromise(async (): Promise => { + return { reason: KycFailureReason.FACE, type: "REJECTED" }; + }) + }); + actor.start(); + actor.send({ formData, type: "FORM_SUBMIT" }); + await waitFor(actor, s => s.matches("DocumentUpload")); + actor.send({ documentsId: uploadIds, type: "DOCUMENTS_SUBMIT" }); + actor.send({ type: "LIVENESS_OPENED" }); + actor.send({ type: "LIVENESS_DONE" }); + + await waitFor(actor, s => s.matches("Rejected")); + expect(actor.getSnapshot().context.kycStatus).toBe(KycStatus.REJECTED); + expect(actor.getSnapshot().context.rejectReason).toBe(KycFailureReason.FACE); + }); + + it("a verification polling error moves to Failure", async () => { + const actor = createTestActor({ + createSubaccountActor: subaccountActorWith({ isCompany: false, subAccountId: "sub-1" }), + submitActor: fromPromise(async () => undefined), + verifyStatusActor: fromPromise(async (): Promise => { + throw new Error("Failed to fetch KYC status after 10 attempts."); + }) + }); + actor.start(); + actor.send({ formData, type: "FORM_SUBMIT" }); + await waitFor(actor, s => s.matches("DocumentUpload")); + actor.send({ documentsId: uploadIds, type: "DOCUMENTS_SUBMIT" }); + actor.send({ type: "LIVENESS_OPENED" }); + actor.send({ type: "LIVENESS_DONE" }); + + await waitFor(actor, s => s.matches("Failure")); + expect(actor.getSnapshot().context.error?.message).toBe("Failed to fetch KYC status after 10 attempts."); + }); + + it("refreshes the liveness URL and merges it into the stored upload ids", async () => { + const refresh = deferred<{ livenessUrl: string; uploadedSelfieId: string }>(); + const actor = createTestActor({ + createSubaccountActor: subaccountActorWith({ isCompany: false, subAccountId: "sub-1" }), + refreshLivenessUrlActor: fromPromise(() => refresh.promise) + }); + actor.start(); + actor.send({ formData, type: "FORM_SUBMIT" }); + await waitFor(actor, s => s.matches("DocumentUpload")); + actor.send({ documentsId: uploadIds, type: "DOCUMENTS_SUBMIT" }); + + actor.send({ type: "REFRESH_LIVENESS_URL" }); + expect(actor.getSnapshot().value).toBe("RefreshingLivenessUrl"); + + refresh.resolve({ livenessUrl: "https://liveness.example/new", uploadedSelfieId: "selfie-2" }); + await waitFor(actor, s => s.matches("LivenessCheck")); + expect(actor.getSnapshot().context.documentUploadIds).toEqual({ + livenessUrl: "https://liveness.example/new", + uploadedDocumentId: "doc-1", + uploadedSelfieId: "selfie-2" + }); + }); + + it("returns to LivenessCheck unchanged when refreshing the liveness URL fails", async () => { + const actor = createTestActor({ + createSubaccountActor: subaccountActorWith({ isCompany: false, subAccountId: "sub-1" }), + refreshLivenessUrlActor: fromPromise(async (): Promise<{ livenessUrl: string; uploadedSelfieId: string }> => { + throw new Error("refresh failed"); + }) + }); + actor.start(); + actor.send({ formData, type: "FORM_SUBMIT" }); + await waitFor(actor, s => s.matches("DocumentUpload")); + actor.send({ documentsId: uploadIds, type: "DOCUMENTS_SUBMIT" }); + + actor.send({ type: "REFRESH_LIVENESS_URL" }); + await waitFor(actor, s => s.matches("LivenessCheck")); + expect(actor.getSnapshot().context.documentUploadIds).toEqual(uploadIds); + }); + + // NOTE: documents current behavior — GO_BACK from the *initial* FormFilling state jumps forward to + // DocumentUpload even though the user never created a subaccount. This looks unintended: the + // transition presumably exists for returning from DocumentUpload, but it is reachable straight + // from the initial state too (brlaKyc.machine.ts, FormFilling.on.GO_BACK). + it("GO_BACK from the initial FormFilling state moves to DocumentUpload", () => { + const actor = createTestActor({}); + actor.start(); + + actor.send({ type: "GO_BACK" }); + expect(actor.getSnapshot().value).toBe("DocumentUpload"); + }); +}); diff --git a/apps/frontend/src/machines/mykoboKyc.machine.test.ts b/apps/frontend/src/machines/mykoboKyc.machine.test.ts new file mode 100644 index 000000000..3241dffda --- /dev/null +++ b/apps/frontend/src/machines/mykoboKyc.machine.test.ts @@ -0,0 +1,210 @@ +import { describe, expect, it, vi } from "vitest"; +import { assign, createActor, fromPromise, setup, waitFor } from "xstate"; + +// The real module instantiates a Supabase client at import time, which fails in a node test environment. +vi.mock("../services/auth", () => ({ + AuthService: { + getTokens: vi.fn(), + refreshAccessToken: vi.fn(), + storeTokens: vi.fn() + } +})); + +import { MykoboProfile } from "../services/api/mykobo.service"; +import { MykoboKycContext } from "./kyc.states"; +import { MykoboKycFiles, MykoboKycFormData, MykoboKycMachineErrorType, mykoboKycMachine } from "./mykoboKyc.machine"; +import { initialRampContext } from "./ramp.context"; + +function deferred() { + let resolve!: (value: T) => void; + let reject!: (error: unknown) => void; + const promise = new Promise((res, rej) => { + resolve = res; + reject = rej; + }); + return { promise, reject, resolve }; +} + +const neverResolves = () => fromPromise(() => new Promise(() => {})); + +const baseInput: MykoboKycContext = { + ...initialRampContext, + connectedWalletAddress: "0x1111111111111111111111111111111111111111", + userEmail: "user@example.com" +}; + +const approvedProfile = { kycStatus: { receivedAt: null, reviewStatus: "approved" } } as MykoboProfile; +const pendingProfile = { kycStatus: { receivedAt: null, reviewStatus: "pending" } } as MykoboProfile; + +const formData = { firstName: "Ada", lastName: "Lovelace" } as MykoboKycFormData; +const files = { face: {} as File, front: {} as File, utilityBill: {} as File } as MykoboKycFiles; + +type PollResult = { status: "approved" } | { status: "rejected" }; + +// XState actor logic is invariant in its output type, so fakes must declare the exact output of the real actor. +const profileActor = (result: MykoboProfile | null) => fromPromise(async () => result); + +function createTestActor(actors: Parameters[0]["actors"]) { + return createActor(mykoboKycMachine.provide({ actors }), { input: baseInput }); +} + +describe("mykoboKycMachine", () => { + it("walks the happy path from form filling to Done", async () => { + const check = deferred(); + const submit = deferred(); + const poll = deferred(); + const actor = createTestActor({ + checkExistingProfile: fromPromise(() => check.promise), + pollProfileStatus: fromPromise(() => poll.promise), + submitProfile: fromPromise(() => submit.promise) + }); + actor.start(); + + expect(actor.getSnapshot().value).toBe("CheckingProfile"); + + check.resolve(null); + await waitFor(actor, s => s.matches("FormFilling")); + + actor.send({ files, formData, type: "SubmitKycForm" }); + expect(actor.getSnapshot().value).toBe("Submitting"); + expect(actor.getSnapshot().context.formData).toEqual(formData); + expect(actor.getSnapshot().context.files).toBe(files); + + submit.resolve(pendingProfile); + await waitFor(actor, s => s.matches("Verifying")); + + poll.resolve({ status: "approved" }); + await waitFor(actor, s => s.matches("VerificationDone")); + expect(actor.getSnapshot().context.profileApproved).toBe(true); + + actor.send({ type: "CONFIRM_SUCCESS" }); + const snapshot = actor.getSnapshot(); + expect(snapshot.value).toBe("Done"); + expect(snapshot.status).toBe("done"); + expect(snapshot.output).toEqual({ error: undefined, profileApproved: true }); + }); + + it("skips straight to Done when the profile is already approved", async () => { + const actor = createTestActor({ + checkExistingProfile: profileActor(approvedProfile) + }); + actor.start(); + + await waitFor(actor, s => s.status === "done"); + expect(actor.getSnapshot().value).toBe("Done"); + expect(actor.getSnapshot().output).toEqual({ error: undefined, profileApproved: true }); + }); + + it("resumes verification when a profile is still pending", async () => { + const actor = createTestActor({ + checkExistingProfile: profileActor(pendingProfile), + pollProfileStatus: neverResolves() + }); + actor.start(); + + await waitFor(actor, s => s.matches("Verifying")); + expect(actor.getSnapshot().context.profileApproved).toBeUndefined(); + }); + + it("moves to Failure when the profile check fails", async () => { + const actor = createTestActor({ + checkExistingProfile: fromPromise(async () => { + throw new Error("network down"); + }) + }); + actor.start(); + + await waitFor(actor, s => s.matches("Failure")); + const snapshot = actor.getSnapshot(); + // Failure is intentionally non-final: the parent dismisses it via RESET_RAMP. + expect(snapshot.status).toBe("active"); + expect(snapshot.context.error?.type).toBe(MykoboKycMachineErrorType.UnknownError); + expect(snapshot.context.error?.message).toBe("Failed to check Mykobo profile"); + }); + + it("cancelling the form finishes with a UserRejected error", async () => { + const actor = createTestActor({ + checkExistingProfile: profileActor(null) + }); + actor.start(); + await waitFor(actor, s => s.matches("FormFilling")); + + actor.send({ type: "CANCEL" }); + const snapshot = actor.getSnapshot(); + expect(snapshot.value).toBe("Cancelled"); + expect(snapshot.status).toBe("done"); + expect(snapshot.output?.error?.type).toBe(MykoboKycMachineErrorType.UserRejected); + }); + + it("moves to Failure when profile submission fails", async () => { + const actor = createTestActor({ + checkExistingProfile: profileActor(null), + submitProfile: fromPromise(async () => { + throw new Error("500"); + }) + }); + actor.start(); + await waitFor(actor, s => s.matches("FormFilling")); + + actor.send({ files, formData, type: "SubmitKycForm" }); + await waitFor(actor, s => s.matches("Failure")); + expect(actor.getSnapshot().context.error?.message).toBe("Failed to submit Mykobo profile"); + }); + + it("moves to Rejected with a KycRejected error when the review is rejected", async () => { + const actor = createTestActor({ + checkExistingProfile: profileActor(pendingProfile), + pollProfileStatus: fromPromise(async () => ({ status: "rejected" })) + }); + actor.start(); + + await waitFor(actor, s => s.matches("Rejected")); + const snapshot = actor.getSnapshot(); + // Rejected is intentionally non-final so the rejection screen stays rendered. + expect(snapshot.status).toBe("active"); + expect(snapshot.context.error?.type).toBe(MykoboKycMachineErrorType.KycRejected); + expect(snapshot.context.profileApproved).toBeUndefined(); + }); + + it("moves to Failure when polling errors out (e.g. timeout)", async () => { + const actor = createTestActor({ + checkExistingProfile: profileActor(pendingProfile), + pollProfileStatus: fromPromise(async () => { + throw new Error("KYC polling timed out"); + }) + }); + actor.start(); + + await waitFor(actor, s => s.matches("Failure")); + expect(actor.getSnapshot().context.error?.message).toBe("KYC verification failed"); + }); + + it("forwards SIGNING_UPDATE events to the parent machine", async () => { + const childMachine = mykoboKycMachine.provide({ + actors: { checkExistingProfile: neverResolves() } + }); + const parentMachine = setup({ + actors: { mykoboKyc: childMachine }, + types: { + context: {} as { received: unknown[] }, + events: {} as { type: "SIGNING_UPDATE"; phase: string | undefined; current?: number; max?: number } + } + }).createMachine({ + context: { received: [] }, + invoke: { id: "mykoboKyc", input: baseInput, src: "mykoboKyc" }, + on: { + SIGNING_UPDATE: { + actions: assign({ received: ({ context, event }) => [...context.received, event] }) + } + } + }); + + const parent = createActor(parentMachine); + parent.start(); + const child = parent.getSnapshot().children.mykoboKyc; + expect(child).toBeDefined(); + + child?.send({ current: 1, max: 3, phase: "started", type: "SIGNING_UPDATE" }); + expect(parent.getSnapshot().context.received).toEqual([{ current: 1, max: 3, phase: "started", type: "SIGNING_UPDATE" }]); + }); +}); diff --git a/apps/frontend/src/machines/ramp.machine.test.ts b/apps/frontend/src/machines/ramp.machine.test.ts new file mode 100644 index 000000000..6e5ba499b --- /dev/null +++ b/apps/frontend/src/machines/ramp.machine.test.ts @@ -0,0 +1,538 @@ +import { beforeEach, describe, expect, it, vi } from "vitest"; +import { AnyActorRef, createActor, fromCallback, fromPromise, setup, waitFor } from "xstate"; + +// The real module instantiates a Supabase client at import time, which fails in a node test environment. +vi.mock("../services/auth", () => ({ + AuthService: { + getTokens: vi.fn(), + refreshAccessToken: vi.fn(), + storeTokens: vi.fn() + } +})); + +import { FiatToken, QuoteResponse, RampDirection, RampProcess } from "@vortexfi/shared"; +import { ToastMessage } from "../helpers/notifications"; +import { CheckEmailResponse, VerifyOTPResponse } from "../services/api/auth.api"; +import { AuthService, type AuthTokens } from "../services/auth"; +import { RampExecutionInput } from "../types/phases"; +import { SignRampError, SignRampErrorType } from "./actors/sign.actor"; +import { aveniaKycMachine } from "./brlaKyc.machine"; +import { MykoboKycMachineError, MykoboKycMachineErrorType, mykoboKycMachine } from "./mykoboKyc.machine"; +import { RampContext, RampMachineEvents, RampState } from "./types"; +import { rampMachine } from "./ramp.machine"; + +function deferred() { + let resolve!: (value: T) => void; + let reject!: (error: unknown) => void; + const promise = new Promise((res, rej) => { + resolve = res; + reject = rej; + }); + return { promise, reject, resolve }; +} + +const quote = { + createdAt: new Date().toISOString(), + expiresAt: new Date(Date.now() + 10 * 60 * 1000).toISOString(), + id: "quote-1", + inputAmount: "100", + outputAmount: "95", + rampType: RampDirection.SELL +} as unknown as QuoteResponse; + +const makeExecutionInput = (fiatToken: FiatToken): RampExecutionInput => + ({ + fiatToken, + quote, + sourceOrDestinationAddress: "0x2222222222222222222222222222222222222222" + }) as unknown as RampExecutionInput; + +const rampState = { + quote, + ramp: { id: "ramp-1", unsignedTxs: [] }, + requiredUserActionsCompleted: false, + signedTransactions: [] +} as unknown as RampState; + +const authedTokens: AuthTokens = { accessToken: "at", refreshToken: "rt", userEmail: "user@example.com", userId: "user-1" }; + +// The fakes must declare the exact output types of the real actors (actor logic is invariant in its output). +type CheckTokenOutput = { success: boolean; tokens: null } | { success: boolean; tokens: AuthTokens }; +type LoadQuoteOutput = { isExpired: boolean; quote: QuoteResponse }; +type ValidateKycOutput = { kycNeeded: boolean; brlaEvmAddress?: string }; + +type ProvideArg = Parameters[0]; + +function buildImplementations(actors?: ProvideArg["actors"], actions?: ProvideArg["actions"]): ProvideArg { + return { + actions: { + // The real action waits 30 seconds; never useful in unit tests. + refreshQuoteActionWithDelay: () => {}, + // The real action touches window.location. + urlCleanerWithCallbackAction: () => {}, + ...actions + }, + actors: { + checkAndRefreshToken: fromPromise(async (): Promise => ({ success: true, tokens: authedTokens })), + checkEmail: fromPromise(async (): Promise => ({ action: "signin", exists: true })), + loadQuote: fromPromise(async (): Promise => ({ isExpired: false, quote })), + quoteRefresher: fromCallback(() => undefined), + registerRamp: fromPromise(async () => rampState), + requestOTP: fromPromise(async (): Promise<{ success: boolean }> => ({ success: true })), + signTransactions: fromPromise(async () => rampState), + startRamp: fromPromise(async () => ({ id: "ramp-1" }) as unknown as RampProcess), + urlCleaner: fromPromise(async (): Promise => undefined), + validateKyc: fromPromise(async (): Promise => ({ kycNeeded: false })), + verifyOTP: fromPromise( + async (): Promise => ({ accessToken: "at", refreshToken: "rt", success: true, userId: "user-1" }) + ), + ...actors + } + }; +} + +function createRampActor(actors?: ProvideArg["actors"], actions?: ProvideArg["actions"]) { + return createActor(rampMachine.provide(buildImplementations(actors, actions))); +} + +/** Minimal final child machine standing in for the Mykobo KYC machine. It finishes on FINISH. */ +function stubMykoboMachine(output: { profileApproved?: boolean; error?: MykoboKycMachineError }) { + return setup({}).createMachine({ + initial: "Waiting", + output: () => output, + states: { Done: { type: "final" }, Waiting: { on: { FINISH: "Done" } } } + }) as unknown as typeof mykoboKycMachine; +} + +/** Minimal child machine standing in for the Avenia KYC machine that completes immediately without error. */ +const stubAveniaMachine = setup({}).createMachine({ + initial: "Done", + output: () => ({}), + states: { Done: { type: "final" } } +}) as unknown as typeof aveniaKycMachine; + +async function goToQuoteReady(actor: ReturnType) { + actor.send({ lock: false, quoteId: "quote-1", type: "SET_QUOTE" }); + await waitFor(actor, s => s.matches("QuoteReady")); +} + +async function confirmRamp(actor: ReturnType, fiatToken = FiatToken.EURC, direction = RampDirection.SELL) { + actor.send({ + input: { chainId: 1, executionInput: makeExecutionInput(fiatToken), rampDirection: direction }, + type: "CONFIRM" + }); +} + +beforeEach(() => { + vi.clearAllMocks(); +}); + +describe("rampMachine", () => { + describe("quote loading and auth", () => { + it("starts in Idle with the initial context", () => { + const actor = createRampActor(); + actor.start(); + expect(actor.getSnapshot().value).toBe("Idle"); + expect(actor.getSnapshot().context.isAuthenticated).toBe(false); + expect(actor.getSnapshot().context.quote).toBeUndefined(); + }); + + it("loads a quote and lands in QuoteReady when the session is valid", async () => { + const load = deferred<{ isExpired: boolean; quote: QuoteResponse }>(); + const actor = createRampActor({ loadQuote: fromPromise(() => load.promise) }); + actor.start(); + + actor.send({ lock: true, quoteId: "quote-1", type: "SET_QUOTE" }); + expect(actor.getSnapshot().value).toBe("LoadingQuote"); + expect(actor.getSnapshot().context.quoteId).toBe("quote-1"); + expect(actor.getSnapshot().context.quoteLocked).toBe(true); + + load.resolve({ isExpired: false, quote }); + await waitFor(actor, s => s.matches("QuoteReady")); + + const context = actor.getSnapshot().context; + expect(context.quote).toEqual(quote); + expect(context.isAuthenticated).toBe(true); + expect(context.userEmail).toBe("user@example.com"); + expect(context.userId).toBe("user-1"); + // PostAuthRouting clears the routing target on exit. + expect(context.postAuthTarget).toBeUndefined(); + }); + + it("returns to Idle with an expired-quote flag when loading the quote fails", async () => { + const actor = createRampActor({ + loadQuote: fromPromise(async (): Promise => { + throw new Error("quote not found"); + }) + }); + actor.start(); + + actor.send({ lock: false, quoteId: "missing", type: "SET_QUOTE" }); + await waitFor(actor, s => s.matches("Idle")); + expect(actor.getSnapshot().context.isQuoteExpired).toBe(true); + expect(actor.getSnapshot().context.quote).toBeUndefined(); + }); + + it("walks the email/OTP login flow and stores the tokens", async () => { + const actor = createRampActor({ + checkAndRefreshToken: fromPromise(async (): Promise => ({ success: false, tokens: null })) + }); + actor.start(); + + actor.send({ lock: false, quoteId: "quote-1", type: "SET_QUOTE" }); + await waitFor(actor, s => s.matches("EnterEmail")); + + actor.send({ email: "new@user.com", type: "ENTER_EMAIL" }); + expect(actor.getSnapshot().value).toBe("CheckingEmail"); + expect(actor.getSnapshot().context.userEmail).toBe("new@user.com"); + + await waitFor(actor, s => s.matches("EnterOTP")); + + actor.send({ code: "123456", type: "VERIFY_OTP" }); + expect(actor.getSnapshot().value).toBe("VerifyingOTP"); + + await waitFor(actor, s => s.matches("QuoteReady")); + expect(actor.getSnapshot().context.isAuthenticated).toBe(true); + expect(actor.getSnapshot().context.userId).toBe("user-1"); + expect(AuthService.storeTokens).toHaveBeenCalledWith({ + accessToken: "at", + refreshToken: "rt", + userEmail: "new@user.com", + userId: "user-1" + }); + }); + + it("an invalid OTP returns to EnterOTP with an error message", async () => { + const actor = createRampActor({ + checkAndRefreshToken: fromPromise(async (): Promise => ({ success: false, tokens: null })), + verifyOTP: fromPromise(async (): Promise => { + throw new Error("invalid code"); + }) + }); + actor.start(); + actor.send({ lock: false, quoteId: "quote-1", type: "SET_QUOTE" }); + await waitFor(actor, s => s.matches("EnterEmail")); + actor.send({ email: "new@user.com", type: "ENTER_EMAIL" }); + await waitFor(actor, s => s.matches("EnterOTP")); + + actor.send({ code: "000000", type: "VERIFY_OTP" }); + await waitFor(actor, s => s.matches("EnterOTP") && s.context.errorMessage !== undefined); + expect(actor.getSnapshot().context.errorMessage).toBe("Invalid OTP code. Please try again."); + }); + + it("a failed OTP request returns to EnterEmail with an error message", async () => { + const actor = createRampActor({ + checkAndRefreshToken: fromPromise(async (): Promise => ({ success: false, tokens: null })), + requestOTP: fromPromise(async (): Promise<{ success: boolean }> => { + throw new Error("mail service down"); + }) + }); + actor.start(); + actor.send({ lock: false, quoteId: "quote-1", type: "SET_QUOTE" }); + await waitFor(actor, s => s.matches("EnterEmail")); + + actor.send({ email: "new@user.com", type: "ENTER_EMAIL" }); + await waitFor(actor, s => s.matches("EnterEmail") && s.context.errorMessage !== undefined); + expect(actor.getSnapshot().context.errorMessage).toBe("Failed to send OTP. Please try again."); + }); + + it("a failed email check returns to EnterEmail with an error message", async () => { + const actor = createRampActor({ + checkAndRefreshToken: fromPromise(async (): Promise => ({ success: false, tokens: null })), + checkEmail: fromPromise(async (): Promise => { + throw new Error("email check down"); + }) + }); + actor.start(); + actor.send({ lock: false, quoteId: "quote-1", type: "SET_QUOTE" }); + await waitFor(actor, s => s.matches("EnterEmail")); + + actor.send({ email: "new@user.com", type: "ENTER_EMAIL" }); + await waitFor(actor, s => s.matches("EnterEmail") && s.context.errorMessage !== undefined); + expect(actor.getSnapshot().context.errorMessage).toBe("Failed to check email. Please try again."); + }); + }); + + describe("ramp execution", () => { + it("runs a SELL ramp from CONFIRM through signing to RampFollowUp", async () => { + const register = deferred(); + const sign = deferred(); + const actor = createRampActor({ + registerRamp: fromPromise(() => register.promise), + signTransactions: fromPromise(() => sign.promise) + }); + actor.start(); + await goToQuoteReady(actor); + + await confirmRamp(actor); + expect(actor.getSnapshot().value).toBe("RampRequested"); + expect(actor.getSnapshot().context.chainId).toBe(1); + expect(actor.getSnapshot().context.rampDirection).toBe(RampDirection.SELL); + + // NOTE: with kycNeeded=false and a non-BRL token, no RampRequested.onDone branch matches, so the + // machine intentionally stays in RampRequested until the user confirms the summary modal. + await new Promise(resolve => setTimeout(resolve, 0)); + expect(actor.getSnapshot().value).toBe("RampRequested"); + + actor.send({ type: "SummaryConfirm" }); + expect(actor.getSnapshot().value).toBe("RegisterRamp"); + expect(actor.getSnapshot().context.quoteLocked).toBe(true); + + register.resolve(rampState); + await waitFor(actor, s => s.matches("UpdateRamp")); + expect(actor.getSnapshot().context.rampState).toEqual(rampState); + + sign.resolve(rampState); + await waitFor(actor, s => s.matches("RampFollowUp")); + + actor.send({ type: "FINISH_OFFRAMPING" }); + await waitFor(actor, s => s.matches("Idle")); + expect(actor.getSnapshot().context.quote).toBeUndefined(); + }); + + it("a BUY ramp stays in UpdateRamp after signing until the payment is confirmed", async () => { + const signedState = { ...rampState, signedTransactions: [{}] } as unknown as RampState; + const actor = createRampActor({ + signTransactions: fromPromise(async () => signedState) + }); + actor.start(); + await goToQuoteReady(actor); + await confirmRamp(actor, FiatToken.EURC, RampDirection.BUY); + actor.send({ type: "SummaryConfirm" }); + + await waitFor(actor, s => s.matches("UpdateRamp") && s.context.rampState?.signedTransactions.length === 1); + expect(actor.getSnapshot().value).toBe("UpdateRamp"); + + actor.send({ type: "PAYMENT_CONFIRMED" }); + expect(actor.getSnapshot().context.rampPaymentConfirmed).toBe(true); + await waitFor(actor, s => s.matches("RampFollowUp")); + }); + + it("a user-rejected signature emits a toast and resets the ramp", async () => { + const actor = createRampActor({ + signTransactions: fromPromise(async (): Promise => { + throw new SignRampError("User rejected", SignRampErrorType.UserRejected); + }) + }); + const toasts: ToastMessage[] = []; + actor.on("SHOW_ERROR_TOAST", event => toasts.push(event.message)); + actor.start(); + await goToQuoteReady(actor); + await confirmRamp(actor); + actor.send({ type: "SummaryConfirm" }); + + await waitFor(actor, s => s.matches("Idle")); + expect(toasts).toEqual([ToastMessage.SIGNING_REJECTED]); + expect(actor.getSnapshot().context.quote).toBeUndefined(); + expect(actor.getSnapshot().context.errorMessage).toBeUndefined(); + }); + + it("a generic signing failure lands in Error with the message and can be reset", async () => { + const actor = createRampActor({ + signTransactions: fromPromise(async (): Promise => { + throw new Error("insufficient funds for gas"); + }) + }); + actor.start(); + await goToQuoteReady(actor); + await confirmRamp(actor); + actor.send({ type: "SummaryConfirm" }); + + await waitFor(actor, s => s.matches("Error")); + const context = actor.getSnapshot().context; + expect(context.errorMessage).toBe("insufficient funds for gas"); + expect(context.rampSigningPhase).toBeUndefined(); + + actor.send({ type: "RESET_RAMP" }); + await waitFor(actor, s => s.matches("Idle")); + expect(actor.getSnapshot().context.quote).toBeUndefined(); + }); + + it("a registration failure lands in Error with the message", async () => { + const actor = createRampActor({ + registerRamp: fromPromise(async (): Promise => { + throw new Error("registration failed"); + }) + }); + actor.start(); + await goToQuoteReady(actor); + await confirmRamp(actor); + actor.send({ type: "SummaryConfirm" }); + + await waitFor(actor, s => s.matches("Error")); + expect(actor.getSnapshot().context.errorMessage).toBe("registration failed"); + }); + + it("a KYC validation failure returns to Idle", async () => { + const actor = createRampActor({ + validateKyc: fromPromise(async (): Promise => { + throw new Error("validation error"); + }) + }); + actor.start(); + await goToQuoteReady(actor); + await confirmRamp(actor); + + await waitFor(actor, s => s.matches("Idle")); + }); + + it("redirects to the callback URL after starting a ramp and returns to Idle after the delay", async () => { + vi.useFakeTimers(); + try { + const callbackAction = vi.fn(); + const actor = createRampActor(undefined, { urlCleanerWithCallbackAction: callbackAction }); + actor.start(); + + actor.send({ callbackUrl: "https://partner.example/callback", type: "SET_QUOTE_PARAMS" }); + await goToQuoteReady(actor); + await confirmRamp(actor); + actor.send({ type: "SummaryConfirm" }); + + await waitFor(actor, s => s.matches("RedirectCallback")); + + vi.advanceTimersByTime(5000); + expect(actor.getSnapshot().value).toBe("Idle"); + expect(callbackAction).toHaveBeenCalledTimes(1); + } finally { + vi.useRealTimers(); + } + }); + }); + + describe("KYC routing", () => { + it("routes EURC ramps with kycNeeded to the Mykobo child and advances to KycComplete on approval", async () => { + const actor = createRampActor({ + mykoboKyc: stubMykoboMachine({ profileApproved: true }), + validateKyc: fromPromise(async (): Promise => ({ kycNeeded: true })) + }); + actor.start(); + await goToQuoteReady(actor); + await confirmRamp(actor); + + await waitFor(actor, s => s.matches({ KYC: "Mykobo" })); + + (actor.getSnapshot().children.mykoboKyc as AnyActorRef).send({ type: "FINISH" }); + await waitFor(actor, s => s.matches("KycComplete")); + }); + + it("returns to QuoteReady when the user cancels Mykobo KYC", async () => { + const actor = createRampActor({ + mykoboKyc: stubMykoboMachine({ + error: new MykoboKycMachineError("Cancelled by the user", MykoboKycMachineErrorType.UserRejected) + }), + validateKyc: fromPromise(async (): Promise => ({ kycNeeded: true })) + }); + actor.start(); + await goToQuoteReady(actor); + await confirmRamp(actor); + await waitFor(actor, s => s.matches({ KYC: "Mykobo" })); + + (actor.getSnapshot().children.mykoboKyc as AnyActorRef).send({ type: "FINISH" }); + await waitFor(actor, s => s.matches("QuoteReady")); + }); + + it("a KYC rejection resets the ramp but keeps the failure message", async () => { + const actor = createRampActor({ + mykoboKyc: stubMykoboMachine({ + error: new MykoboKycMachineError("KYC was rejected", MykoboKycMachineErrorType.KycRejected) + }), + validateKyc: fromPromise(async (): Promise => ({ kycNeeded: true })) + }); + actor.start(); + await goToQuoteReady(actor); + await confirmRamp(actor); + await waitFor(actor, s => s.matches({ KYC: "Mykobo" })); + + (actor.getSnapshot().children.mykoboKyc as AnyActorRef).send({ type: "FINISH" }); + // KycFailure immediately resets; the reset preserves initializeFailedMessage for the UI. + await waitFor(actor, s => s.matches("Idle")); + expect(actor.getSnapshot().context.initializeFailedMessage).toBe("KYC was rejected"); + }); + + it("BRL ramps with a valid KYC go straight to KycComplete", async () => { + const actor = createRampActor({ + validateKyc: fromPromise(async (): Promise => ({ kycNeeded: false })) + }); + actor.start(); + await goToQuoteReady(actor); + await confirmRamp(actor, FiatToken.BRL); + + await waitFor(actor, s => s.matches("KycComplete")); + }); + + it("PROCEED_TO_REGISTRATION from KycComplete stores the fiat account and registers directly when authenticated", async () => { + const actor = createRampActor({ + registerRamp: fromPromise(() => new Promise(() => {})), + validateKyc: fromPromise(async (): Promise => ({ kycNeeded: false })) + }); + actor.start(); + await goToQuoteReady(actor); + await confirmRamp(actor, FiatToken.BRL); + await waitFor(actor, s => s.matches("KycComplete")); + + actor.send({ selectedFiatAccountId: "fiat-account-1", type: "PROCEED_TO_REGISTRATION" }); + expect(actor.getSnapshot().value).toBe("RegisterRamp"); + expect(actor.getSnapshot().context.executionInput?.selectedFiatAccountId).toBe("fiat-account-1"); + }); + + it("completes the quote-less KYB deep link via SelectRegion and lands in KybLinkComplete", async () => { + const actor = createRampActor({ aveniaKyc: stubAveniaMachine }); + actor.start(); + + actor.send({ type: "START_KYB_LINK" }); + await waitFor(actor, s => s.matches("SelectRegion")); + expect(actor.getSnapshot().context.kybLink).toEqual({ fiatToken: undefined, regionLocked: false }); + + actor.send({ fiatToken: FiatToken.BRL, type: "SELECT_REGION" }); + await waitFor(actor, s => s.matches("KybLinkComplete")); + }); + }); + + describe("global events", () => { + it("updates the connected wallet address from anywhere", () => { + const actor = createRampActor(); + actor.start(); + actor.send({ address: "0x3333333333333333333333333333333333333333", type: "SET_ADDRESS" }); + expect(actor.getSnapshot().context.connectedWalletAddress).toBe("0x3333333333333333333333333333333333333333"); + }); + + it("EXPIRE_QUOTE marks the quote expired unless the quote is locked", async () => { + const actor = createRampActor(); + actor.start(); + actor.send({ type: "EXPIRE_QUOTE" }); + expect(actor.getSnapshot().context.isQuoteExpired).toBe(true); + + const lockedActor = createRampActor(); + lockedActor.start(); + lockedActor.send({ lock: true, quoteId: "quote-1", type: "SET_QUOTE" }); + await waitFor(lockedActor, s => s.matches("QuoteReady")); + lockedActor.send({ type: "EXPIRE_QUOTE" }); + expect(lockedActor.getSnapshot().context.isQuoteExpired).toBe(false); + }); + + it("LOGOUT clears the session and moves to EnterEmail", async () => { + const actor = createRampActor(); + actor.start(); + await goToQuoteReady(actor); + expect(actor.getSnapshot().context.isAuthenticated).toBe(true); + + actor.send({ type: "LOGOUT" }); + expect(actor.getSnapshot().value).toBe("EnterEmail"); + expect(actor.getSnapshot().context.isAuthenticated).toBe(false); + expect(actor.getSnapshot().context.userEmail).toBeUndefined(); + }); + + it("SIGNING_UPDATE keeps previous progress values when the event omits them", () => { + const actor = createRampActor(); + actor.start(); + + actor.send({ current: 1, max: 4, phase: "started", type: "SIGNING_UPDATE" }); + actor.send({ phase: "signed", type: "SIGNING_UPDATE" }); + + const context = actor.getSnapshot().context; + expect(context.rampSigningPhase).toBe("signed"); + expect(context.rampSigningPhaseCurrent).toBe(1); + expect(context.rampSigningPhaseMax).toBe(4); + }); + }); +}); diff --git a/apps/frontend/vitest.config.ts b/apps/frontend/vitest.config.ts new file mode 100644 index 000000000..347586e52 --- /dev/null +++ b/apps/frontend/vitest.config.ts @@ -0,0 +1,11 @@ +import { defineConfig } from "vitest/config"; + +// Dedicated Vitest config so test runs don't load the full Vite build pipeline +// (tanstack router codegen, Sentry upload plugin, tailwind) from vite.config.ts. +export default defineConfig({ + test: { + environment: "node", + globals: false, + include: ["src/**/*.test.ts", "src/**/*.test.tsx"] + } +}); From 5a2b18db334ba92f58a5d1fe7c66f806a4e67694 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 10:45:28 +0200 Subject: [PATCH 094/176] Run all test suites in CI with a Postgres service container Adds a test job to ci.yml (shared, sdk, rebalancer, api, frontend) with postgres:16 on port 54329 matching the local test-db default, plus root package.json test:* scripts and updated strategy doc commands. --- .github/workflows/ci.yml | 50 ++++++++++++++++++++++++++++++++++++++++ docs/testing-strategy.md | 20 +++++++++------- package.json | 8 +++++++ 3 files changed, 70 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 77d24ba5b..ccb40d6dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,3 +39,53 @@ jobs: - name: ✏️ Typecheck run: bun run typecheck + + test: + name: Running tests + runs-on: ubuntu-latest + env: + CI: true + + services: + postgres: + image: postgres:16-alpine + env: + POSTGRES_PASSWORD: postgres + POSTGRES_DB: vortex_test + ports: + - 54329:5432 + options: >- + --health-cmd pg_isready + --health-interval 5s + --health-timeout 5s + --health-retries 10 + + steps: + - name: 🛒 Checkout code + uses: actions/checkout@v3 + + - name: 🧩 Setup Bun + uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 + with: + bun-version: 1.3.1 + + - name: 🧩 Install dependencies + run: bun install --frozen-lockfile + + - name: 🔨 Build shared package + run: bun run build:shared + + - name: 🧪 Shared tests + run: bun run test:shared + + - name: 🧪 SDK tests + run: bun run test:sdk + + - name: 🧪 Rebalancer tests + run: bun run test:rebalancer + + - name: 🧪 API tests (unit + integration) + run: bun run test:api + + - name: 🧪 Frontend tests + run: bun run test:frontend diff --git a/docs/testing-strategy.md b/docs/testing-strategy.md index 0593088f7..708834d29 100644 --- a/docs/testing-strategy.md +++ b/docs/testing-strategy.md @@ -108,17 +108,21 @@ never PR-blocking. ## Commands ```bash +# One-time per machine: dedicated test Postgres (Docker, port 54329) +bun test:db:start # bun test:db:stop to remove it + # Everything hermetic (what CI runs) -bun test:unit # all workspaces' unit tests -bun test:integration # API integration + corridor + contract tests (needs Docker or DATABASE_URL) +bun test # shared + sdk + rebalancer + api + frontend # Individual workspaces -cd apps/api && bun test -cd apps/frontend && bunx vitest run -cd apps/frontend && bunx playwright test # E2E, local/nightly - -# Opt-in live tests (real RPCs) -RUN_LIVE_TESTS=1 bun test --cwd packages/shared +bun test:api # unit + integration (needs the test db) +bun test:frontend +bun test:shared +bun test:rebalancer +bun test:sdk + +# Opt-in live tests (real RPCs / sandboxes; needs credentials in .env) +cd apps/api && RUN_LIVE_TESTS=1 bun test src/api/services/phases/ ``` (Scripts are defined in the root `package.json`; see there for the authoritative list.) diff --git a/package.json b/package.json index 31e58c5a7..8d8ec8fcc 100644 --- a/package.json +++ b/package.json @@ -121,7 +121,15 @@ "prepare": "husky", "serve:backend": "bun run --cwd apps/api serve", "serve:frontend": "bun run --cwd apps/frontend preview", + "test": "bun run test:shared && bun run test:sdk && bun run test:rebalancer && bun run test:api && bun run test:frontend", + "test:api": "cd apps/api && bun test", "test:contracts:relayer": "bun run --cwd contracts/relayer test", + "test:db:start": "bun run --cwd apps/api test:db:start", + "test:db:stop": "bun run --cwd apps/api test:db:stop", + "test:frontend": "cd apps/frontend && bunx vitest run", + "test:rebalancer": "cd apps/rebalancer && bun test", + "test:sdk": "bun run --cwd packages/sdk test", + "test:shared": "cd packages/shared && bun test", "typecheck": "bunx tsc", "verify": "biome check --no-errors-on-unmatched" }, From 8e79b33c196641df0ec6543624d07138a1a2080d Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 10:50:07 +0200 Subject: [PATCH 095/176] Stop live-test module patches from leaking into other test files bun runs every test file of a package in one process, so the module-level RampState/QuoteTicket/BrlaApiService monkeypatching and mock.module calls in the live integration tests executed even when their describes were skipped, poisoning all later test files (detected by aaa-leak-probe). The patching now only happens under RUN_LIVE_TESTS=1. --- .../services/phases/mykobo-eur-offramp.integration.test.ts | 7 +++++++ .../services/phases/mykobo-eur-onramp.integration.test.ts | 7 +++++++ .../phases/phase-processor.onramp.integration.test.ts | 5 +++++ .../phases/phase-processor.recovery.integration.test.ts | 6 ++++++ 4 files changed, 25 insertions(+) diff --git a/apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts b/apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts index 8da7715a7..d1fb54090 100644 --- a/apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts +++ b/apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts @@ -5,8 +5,11 @@ import Big from "big.js"; import { Keyring } from "@polkadot/api"; import { mnemonicGenerate } from "@polkadot/util-crypto"; +// Module-level patching only when the live suite is enabled — bun runs all +// test files in one process, so unconditional patches leak into other files. // Mock the EVM Nabla swap quote function before importing QuoteService so the // quote engine does not hit Base RPC for the (currently illiquid) USDC<->EURC pool. +if (process.env.RUN_LIVE_TESTS) mock.module("../quote/core/nabla", () => { return { calculateNablaSwapOutputEvm: async (request: { @@ -32,6 +35,7 @@ mock.module("../quote/core/nabla", () => { // The Mykobo email is now derived from the user's profile and gated on an APPROVED Mykobo customer // (resolveMykoboCustomerForUser). This contract test focuses on the Mykobo intent/transaction path, // so stub the resolver to return the test email instead of standing up profile + KYC-mirror rows. +if (process.env.RUN_LIVE_TESTS) mock.module("../mykobo/mykobo-customer.service", () => ({ resolveMykoboCustomerForUser: async () => ({ email: "mail@test.com" }), syncMykoboCustomerKyc: async () => {}, @@ -113,6 +117,8 @@ let quoteTicket: QuoteTicket; type RampStateUpdateData = Partial; type QuoteTicketUpdateData = Partial; +// Guarded for the same leak reason as the mock.module calls above. +if (process.env.RUN_LIVE_TESTS) { RampState.update = mock(async function (updateData: RampStateUpdateData) { rampState = { ...rampState, ...updateData, updatedAt: new Date() } as RampState; fs.writeFileSync(filePath, JSON.stringify(rampState, null, 2)); @@ -188,6 +194,7 @@ BrlaApiService.getInstance = mock(() => mockBrlaApiService as unknown as BrlaApi RampRecoveryWorker.prototype.start = mock(async (): Promise => { // worker disabled in test }); +} // Live test: hits the real Mykobo sandbox and needs MYKOBO_ACCESS_KEY/MYKOBO_SECRET_KEY. // Opt-in via RUN_LIVE_TESTS=1 (see docs/testing-strategy.md). diff --git a/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts b/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts index b6eec54fc..388abe233 100644 --- a/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts +++ b/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts @@ -5,8 +5,11 @@ import Big from "big.js"; import { Keyring } from "@polkadot/api"; import { mnemonicGenerate } from "@polkadot/util-crypto"; +// Module-level patching only when the live suite is enabled — bun runs all +// test files in one process, so unconditional patches leak into other files. // Mock the EVM Nabla swap quote function before importing QuoteService so the // quote engine does not hit Base RPC for the (currently illiquid) EURC<->USDC pool. +if (process.env.RUN_LIVE_TESTS) mock.module("../quote/core/nabla", () => { return { calculateNablaSwapOutputEvm: async (request: { @@ -32,6 +35,7 @@ mock.module("../quote/core/nabla", () => { // The Mykobo email is now derived from the user's profile and gated on an APPROVED Mykobo customer // (resolveMykoboCustomerForUser). This contract test focuses on the Mykobo intent/transaction path, // so stub the resolver to return the test email instead of standing up profile + KYC-mirror rows. +if (process.env.RUN_LIVE_TESTS) mock.module("../mykobo/mykobo-customer.service", () => ({ resolveMykoboCustomerForUser: async () => ({ email: "mail@test.com" }), syncMykoboCustomerKyc: async () => {}, @@ -114,6 +118,8 @@ let quoteTicket: QuoteTicket; type RampStateUpdateData = Partial; type QuoteTicketUpdateData = Partial; +// Guarded for the same leak reason as the mock.module calls above. +if (process.env.RUN_LIVE_TESTS) { RampState.update = mock(async function (updateData: RampStateUpdateData) { rampState = { ...rampState, ...updateData, updatedAt: new Date() } as RampState; fs.writeFileSync(filePath, JSON.stringify(rampState, null, 2)); @@ -189,6 +195,7 @@ BrlaApiService.getInstance = mock(() => mockBrlaApiService as unknown as BrlaApi RampRecoveryWorker.prototype.start = mock(async (): Promise => { // worker disabled in test }); +} // Live test: hits the real Mykobo sandbox and needs MYKOBO_ACCESS_KEY/MYKOBO_SECRET_KEY. // Opt-in via RUN_LIVE_TESTS=1 (see docs/testing-strategy.md). diff --git a/apps/api/src/api/services/phases/phase-processor.onramp.integration.test.ts b/apps/api/src/api/services/phases/phase-processor.onramp.integration.test.ts index 67e7a8d75..3fbd4947a 100644 --- a/apps/api/src/api/services/phases/phase-processor.onramp.integration.test.ts +++ b/apps/api/src/api/services/phases/phase-processor.onramp.integration.test.ts @@ -98,6 +98,10 @@ console.log("Test Signing Accounts:", testSigningAccountsMeta); let rampState: RampState; let quoteTicket: QuoteTicket; +// bun runs every test file of this package in one process: module-level +// patching would leak into unrelated test files, so it only happens when the +// live suite is actually enabled. +if (process.env.RUN_LIVE_TESTS) { RampState.update = mock(async function (updateData: any, _options?: any) { // Merge the update into the current instance. rampState = { ...rampState, ...updateData, updatedAt: new Date() }; @@ -160,6 +164,7 @@ mock.module("../brla/helpers", () => { verifyReferenceLabel: mockVerifyReferenceLabel }; }); +} // Live test: drives real chain/anchor interactions and needs TAX_ID plus funded accounts. // Opt-in via RUN_LIVE_TESTS=1 (see docs/testing-strategy.md). diff --git a/apps/api/src/api/services/phases/phase-processor.recovery.integration.test.ts b/apps/api/src/api/services/phases/phase-processor.recovery.integration.test.ts index 19014a5c6..1f26156b0 100644 --- a/apps/api/src/api/services/phases/phase-processor.recovery.integration.test.ts +++ b/apps/api/src/api/services/phases/phase-processor.recovery.integration.test.ts @@ -10,7 +10,10 @@ const RAMP_STATE_RECOVERY = { // ... }; +// Module-level patching only when the live suite is enabled — bun runs all +// test files in one process, so unconditional patches leak into other files. // Mock the RampRecoveryWorker +if (process.env.RUN_LIVE_TESTS) mock.module("../../workers/ramp-recovery.worker", () => ({ default: class MockRampRecoveryWorker { start = mock(() => { @@ -43,6 +46,8 @@ beforeAll(() => { } as unknown as RampState; }); +// Guarded for the same leak reason as the mock.module call above. +if (process.env.RUN_LIVE_TESTS) { // Mock RampState.update - static method returns [affectedCount, affectedRows] RampState.update = mock(async function (updateData: RampStateUpdateData, _options?: unknown) { rampState = { ...rampState, ...updateData } as unknown as RampState; @@ -80,6 +85,7 @@ RampState.create = mock(async (data: RampStateCreationAttributes) => { } as unknown as RampState; return rampState; }) as typeof RampState.create; +} // Live test: replays a persisted failed ramp state against real services. // Opt-in via RUN_LIVE_TESTS=1 (see docs/testing-strategy.md). From d84f48b48d01c40ebc26b45ea7fd6fc3200ba5c6 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 10:51:58 +0200 Subject: [PATCH 096/176] Add BRL onramp corridor scenario tests through the real PhaseProcessor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Four scenarios on the pix→BRLA-on-Base direct corridor, registered via the real HTTP API with viem-signed presigned transactions: - happy path: initial→brlaOnrampMint→fundEphemeral→destinationTransfer→ complete, exact phase history, lock released, ledger balances correct - transient broadcast failure recovers via retry (errorLogs recorded) - security regression: presigned tx to a wrong recipient is rejected unrecoverably (zero broadcasts, ramp failed) - concurrent processRamp acquires the lock exactly once Fake-world extensions: FakeBrla account balances/payin tickets/pix-out hook, inert Pendulum getApi node (fundEphemeral resolves it even on EVM-only corridors), fake chain nativeCurrency. Also removes a stray probe file that slipped into an earlier commit. Production observations recorded by these tests: transient Avenia balance errors are classified unrecoverable (only timeouts retry), and the processor's stale-instance errorLogs write can clobber the handler's appended entry. --- .../src/test-utils/fake-world/fake-anchors.ts | 12 +- .../api/src/test-utils/fake-world/fake-evm.ts | 2 +- apps/api/src/test-utils/fake-world/index.ts | 20 ++ .../corridors/brl-onramp.scenario.test.ts | 306 ++++++++++++++++++ apps/api/src/tests/zzz-leak-probe.test.ts | 14 - 5 files changed, 338 insertions(+), 16 deletions(-) create mode 100644 apps/api/src/tests/corridors/brl-onramp.scenario.test.ts delete mode 100644 apps/api/src/tests/zzz-leak-probe.test.ts diff --git a/apps/api/src/test-utils/fake-world/fake-anchors.ts b/apps/api/src/test-utils/fake-world/fake-anchors.ts index 0ccfe3d06..9e0872f2a 100644 --- a/apps/api/src/test-utils/fake-world/fake-anchors.ts +++ b/apps/api/src/test-utils/fake-world/fake-anchors.ts @@ -1,5 +1,6 @@ import { AlfredpayApiService, + AveniaTicketStatus, BrlaApiService, MykoboApiService, type MykoboCreateIntentRequest, @@ -103,6 +104,12 @@ export class FakeBrla { payOutRate = 1; subaccountId = "test-subaccount-id"; subaccountEvmWallet = "0x7ba99e99bc669b3508aff9cc0a898e869459f877"; + /** Internal Avenia subaccount balances served by getAccountBalance; script per test. */ + accountBalances = { BRLA: 0, USDC: 0, USDM: 0, USDT: 0 }; + /** Status reported for every pay-in ticket by getAveniaPayinTickets. */ + payinTicketStatus: AveniaTicketStatus = AveniaTicketStatus.PAID; + /** Called after createPixOutputTicket succeeds; use it to apply the on-chain mint effect. */ + onPixOutputTicket?: (ticket: { id: string; walletAddress?: string }) => void; readonly pixInputTickets: Array<{ id: string; brCode: string }> = []; readonly pixOutputTickets: Array<{ id: string }> = []; private counter = 0; @@ -135,11 +142,14 @@ export class FakeBrla { this.pixInputTickets.push(ticket); return ticket; }, - createPixOutputTicket: async () => { + createPixOutputTicket: async (payload?: { ticketBlockchainOutput?: { walletAddress?: string } }) => { const ticket = { id: `pix-out-${++this.counter}` }; this.pixOutputTickets.push(ticket); + this.onPixOutputTicket?.({ id: ticket.id, walletAddress: payload?.ticketBlockchainOutput?.walletAddress }); return ticket; }, + getAccountBalance: async () => ({ balances: { ...this.accountBalances } }), + getAveniaPayinTickets: async () => this.pixInputTickets.map(ticket => ({ id: ticket.id, status: this.payinTicketStatus })), getSubaccountUsedLimit: async () => ({ limitInfo: { blocked: false, diff --git a/apps/api/src/test-utils/fake-world/fake-evm.ts b/apps/api/src/test-utils/fake-world/fake-evm.ts index def5fa60c..68dd5d27c 100644 --- a/apps/api/src/test-utils/fake-world/fake-evm.ts +++ b/apps/api/src/test-utils/fake-world/fake-evm.ts @@ -137,7 +137,7 @@ export class FakeEvm { }); return this.makeUnimplementedProxy( { - chain: { id: CHAIN_IDS[network] ?? 0, name: network }, + chain: { id: CHAIN_IDS[network] ?? 0, name: network, nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" } }, estimateFeesPerGas: async () => ({ maxFeePerGas: 1_000_000_000n, maxPriorityFeePerGas: 1_000_000_000n }), estimateGas: async () => 21_000n, getBalance: async ({ address }: { address: string }) => this.nativeBalance(network, address), diff --git a/apps/api/src/test-utils/fake-world/index.ts b/apps/api/src/test-utils/fake-world/index.ts index 8b7920b6e..1503d5175 100644 --- a/apps/api/src/test-utils/fake-world/index.ts +++ b/apps/api/src/test-utils/fake-world/index.ts @@ -33,6 +33,9 @@ export function installFakeWorld(): FakeWorld { // Substrate/Pendulum flows are not faked yet; fail loudly if a code path // unexpectedly needs them so the gap is explicit rather than a hang. + // Exception: getApi succeeds and returns an inert node, because handlers like + // fundEphemeral resolve the Pendulum API unconditionally even on corridors + // that never touch Substrate — only actual USE of the node should fail. const originalGetApiManager = ApiManager.getInstance; ApiManager.getInstance = () => new Proxy( @@ -42,6 +45,23 @@ export function installFakeWorld(): FakeWorld { if (prop === "then") { return undefined; } + if (prop === "getApi") { + return async () => + new Proxy( + {}, + { + get: (_node, nodeProp) => { + if (nodeProp === "then") { + return undefined; + } + throw new Error( + `FakeWorld: Substrate node .${String(nodeProp)} was used but Substrate chains are not faked yet — ` + + "extend src/test-utils/fake-world if this flow must be covered hermetically." + ); + } + } + ); + } throw new Error( `FakeWorld: ApiManager.${String(prop)} was called but Substrate chains are not faked yet — ` + "extend src/test-utils/fake-world if this flow must be covered hermetically." diff --git a/apps/api/src/tests/corridors/brl-onramp.scenario.test.ts b/apps/api/src/tests/corridors/brl-onramp.scenario.test.ts new file mode 100644 index 000000000..39f3f9351 --- /dev/null +++ b/apps/api/src/tests/corridors/brl-onramp.scenario.test.ts @@ -0,0 +1,306 @@ +import { afterAll, beforeAll, beforeEach, describe, expect, it } from "bun:test"; +import { EvmToken, evmTokenConfig, FiatToken, Networks, RampDirection, type RampPhase } from "@vortexfi/shared"; +import { decodeFunctionData, encodeFunctionData, erc20Abi, parseTransaction, parseUnits } from "viem"; +import { generatePrivateKey, privateKeyToAccount, type PrivateKeyAccount } from "viem/accounts"; +import phaseProcessor from "../../api/services/phases/phase-processor"; +import QuoteTicket from "../../models/quoteTicket.model"; +import RampState from "../../models/rampState.model"; +import Subsidy from "../../models/subsidy.model"; +import { resetTestDatabase, setupTestDatabase } from "../../test-utils/db"; +import { createTestTaxId, createTestUser } from "../../test-utils/factories"; +import { type FakeWorld, installFakeWorld } from "../../test-utils/fake-world"; +import { installFakeSupabaseAuth, testUserToken } from "../../test-utils/fake-world/fake-auth"; +import { startTestApp, type TestApp } from "../../test-utils/test-app"; + +function requireBrlaOnBase() { + const details = evmTokenConfig[Networks.Base][EvmToken.BRLA]; + if (!details) { + throw new Error("BRLA token config missing for Base"); + } + return details; +} +const brlaTokenDetails = requireBrlaOnBase(); +const BRLA_ON_BASE = brlaTokenDetails.erc20AddressSourceChain as `0x${string}`; + +const TAX_ID = "12345678901"; +const HAPPY_PATH_PHASES: RampPhase[] = ["initial", "brlaOnrampMint", "fundEphemeral", "destinationTransfer", "complete"]; + +interface CorridorSetup { + rampId: string; + quoteId: string; + /** Raw (18-decimal) BRLA amount the presigned transfer pays out. */ + amountRaw: bigint; + signedTransfer: `0x${string}`; + ephemeral: PrivateKeyAccount; + destination: `0x${string}`; +} + +/** + * Corridor scenario tests for the BRL onramp direct path (pix → BRLA on Base): + * quote and registration go through the real HTTP API, then the REAL + * PhaseProcessor drives initial → brlaOnrampMint → fundEphemeral → + * destinationTransfer → complete against the fake external world. + */ +describe("BRL onramp direct corridor (pix → BRLA on Base)", () => { + let world: FakeWorld; + let auth: { restore: () => void }; + let app: TestApp; + + beforeAll(async () => { + world = installFakeWorld(); + auth = installFakeSupabaseAuth(); + await setupTestDatabase(); + app = await startTestApp(); + }); + + afterAll(async () => { + await app?.close(); + auth?.restore(); + world?.restore(); + }); + + beforeEach(async () => { + await resetTestDatabase(); + world.evm.failNextSends = 0; + world.evm.onTransaction = undefined; + world.brla.onPixOutputTicket = undefined; + world.brla.accountBalances = { BRLA: 0, USDC: 0, USDM: 0, USDT: 0 }; + }); + + async function createQuoteViaApi(): Promise<{ id: string; outputAmount: string }> { + const response = await app.request("/v1/quotes", { + body: JSON.stringify({ + from: "pix", + inputAmount: "100", + inputCurrency: FiatToken.BRL, + network: Networks.Base, + outputCurrency: EvmToken.BRLA, + rampType: RampDirection.BUY, + to: Networks.Base + }), + headers: { "Content-Type": "application/json" }, + method: "POST" + }); + expect(response.status).toBe(201); + return (await response.json()) as { id: string; outputAmount: string }; + } + + async function registerViaApi( + quoteId: string, + userId: string, + ephemeral: PrivateKeyAccount, + destination: `0x${string}` + ): Promise<{ id: string }> { + const response = await app.request("/v1/ramp/register", { + body: JSON.stringify({ + additionalData: { destinationAddress: destination, taxId: TAX_ID }, + quoteId, + signingAccounts: [{ address: ephemeral.address, type: "EVM" }] + }), + headers: { + Authorization: `Bearer ${testUserToken(userId)}`, + "Content-Type": "application/json" + }, + method: "POST" + }); + expect(response.status).toBe(201); + return (await response.json()) as { id: string }; + } + + /** + * Creates quote + registration through the HTTP API with a fresh ephemeral + * key pair (fresh addresses keep the in-memory EVM ledger isolated between + * tests), then stores a REAL signed ERC-20 transfer as the presigned + * destinationTransfer. Pass a recipient to sign a transfer that pays someone + * other than the registered destination. + */ + async function setUpRegisteredRamp(options: { recipient?: `0x${string}` } = {}): Promise { + const ephemeral = privateKeyToAccount(generatePrivateKey()); + const destination = privateKeyToAccount(generatePrivateKey()).address; + + const user = await createTestUser(); + await createTestTaxId(user.id, { taxId: TAX_ID }); + const quote = await createQuoteViaApi(); + const ramp = await registerViaApi(quote.id, user.id, ephemeral, destination); + + const amountRaw = parseUnits(quote.outputAmount, brlaTokenDetails.decimals); + const signedTransfer = await ephemeral.signTransaction({ + chainId: 8453, + data: encodeFunctionData({ + abi: erc20Abi, + args: [options.recipient ?? destination, amountRaw], + functionName: "transfer" + }), + gas: 100_000n, + maxFeePerGas: 1_000_000_000n, + maxPriorityFeePerGas: 1_000_000_000n, + nonce: 0, + to: BRLA_ON_BASE, + type: "eip1559" + }); + + const rampState = await RampState.findByPk(ramp.id); + if (!rampState) { + throw new Error("Ramp state not found after registration"); + } + await rampState.update({ + presignedTxs: [ + { + meta: {}, + network: Networks.Base, + nonce: 0, + phase: "destinationTransfer", + signer: ephemeral.address, + txData: signedTransfer + } + ] + }); + + return { amountRaw, destination, ephemeral, quoteId: quote.id, rampId: ramp.id, signedTransfer }; + } + + /** + * Scripts the fake world so every polling loop in the corridor succeeds on + * its first (immediate) check: + * - the Avenia subaccount already holds the minted BRL, + * - the ephemeral already has Base gas, so fundEphemeral sends nothing, + * - the Avenia→Base transfer ticket credits the ephemeral's BRLA instantly, + * - submitted raw ERC-20 transfers are applied to the in-memory ledger. + */ + function scriptHappyWorld(setup: CorridorSetup): void { + world.brla.accountBalances.BRLA = 1_000_000; + world.evm.setNativeBalance(Networks.Base, setup.ephemeral.address, parseUnits("0.001", 18)); + world.brla.onPixOutputTicket = ({ walletAddress }) => { + if (walletAddress) { + world.evm.setErc20Balance(Networks.Base, BRLA_ON_BASE, walletAddress, parseUnits("1000000", 18)); + } + }; + world.evm.onTransaction = tx => { + if (!tx.serialized) { + return; + } + const parsed = parseTransaction(tx.serialized as `0x${string}`); + if (!parsed.to || !parsed.data) { + return; + } + const { functionName, args } = decodeFunctionData({ abi: erc20Abi, data: parsed.data }); + if (functionName !== "transfer") { + return; + } + const [recipient, amount] = args as [`0x${string}`, bigint]; + world.evm.setErc20Balance( + tx.network, + parsed.to, + recipient, + world.evm.erc20Balance(tx.network, parsed.to, recipient) + amount + ); + }; + } + + function submissionsOf(signedTransfer: `0x${string}`): number { + return world.evm.sentTransactions.filter(tx => tx.serialized === signedTransfer).length; + } + + it( + "happy path: processes initial → brlaOnrampMint → fundEphemeral → destinationTransfer → complete", + async () => { + const setup = await setUpRegisteredRamp(); + scriptHappyWorld(setup); + const pixOutBefore = world.brla.pixOutputTickets.length; + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("complete"); + expect(final?.phaseHistory.map(entry => entry.phase)).toEqual(HAPPY_PATH_PHASES); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + expect(final?.state.destinationTransferTxHash).toBeTruthy(); + + // Quote stays consumed; no subsidy is expected on the direct corridor. + const quote = await QuoteTicket.findByPk(setup.quoteId); + expect(quote?.status).toBe("consumed"); + expect(await Subsidy.count()).toBe(0); + + // The full Avenia mint flow ran (recovery shortcut not taken) and the + // destination received exactly the quoted BRLA per the fake ledger. + expect(world.brla.pixOutputTickets.length).toBe(pixOutBefore + 1); + expect(submissionsOf(setup.signedTransfer)).toBe(1); + expect(world.evm.erc20Balance(Networks.Base, BRLA_ON_BASE, setup.destination)).toBe(setup.amountRaw); + }, + 30000 + ); + + it( + "transient failure: retries a failed destinationTransfer broadcast (recoverable) and still completes", + async () => { + const setup = await setUpRegisteredRamp(); + scriptHappyWorld(setup); + world.evm.failNextSends = 1; + world.evm.sendFailureMessage = "FakeEvm: scripted RPC outage"; + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("complete"); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + + // The scripted outage was recorded as a recoverable destinationTransfer error... + const outageLogs = final?.errorLogs.filter(log => log.error.includes("scripted RPC outage")) ?? []; + expect(outageLogs.length).toBeGreaterThanOrEqual(1); + expect(outageLogs.every(log => log.phase === "destinationTransfer")).toBe(true); + expect(outageLogs.some(log => log.recoverable === true)).toBe(true); + + // ...and the transfer was broadcast exactly once (first attempt never hit the chain). + expect(submissionsOf(setup.signedTransfer)).toBe(1); + expect(world.evm.erc20Balance(Networks.Base, BRLA_ON_BASE, setup.destination)).toBe(setup.amountRaw); + }, + 30000 + ); + + it( + "security regression: presigned transfer paying the wrong recipient fails the ramp unrecoverably", + async () => { + const wrongRecipient = privateKeyToAccount(generatePrivateKey()).address; + const setup = await setUpRegisteredRamp({ recipient: wrongRecipient }); + scriptHappyWorld(setup); + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("failed"); + expect(final?.phaseHistory.map(entry => entry.phase)).not.toContain("complete"); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + expect(final?.errorLogs.some(log => log.error.includes("recipient mismatch"))).toBe(true); + + // The mismatching transfer must never reach the chain, and nobody gets paid. + expect(submissionsOf(setup.signedTransfer)).toBe(0); + expect(world.evm.erc20Balance(Networks.Base, BRLA_ON_BASE, wrongRecipient)).toBe(0n); + expect(world.evm.erc20Balance(Networks.Base, BRLA_ON_BASE, setup.destination)).toBe(0n); + + const quote = await QuoteTicket.findByPk(setup.quoteId); + expect(quote?.status).toBe("consumed"); + }, + 30000 + ); + + it( + "lock behavior: concurrent processRamp calls execute each phase exactly once", + async () => { + const setup = await setUpRegisteredRamp(); + scriptHappyWorld(setup); + const pixOutBefore = world.brla.pixOutputTickets.length; + + await Promise.all([phaseProcessor.processRamp(setup.rampId), phaseProcessor.processRamp(setup.rampId)]); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("complete"); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + // No duplicated phase execution: one mint ticket, one broadcast, one payout, a single clean history. + expect(final?.phaseHistory.map(entry => entry.phase)).toEqual(HAPPY_PATH_PHASES); + expect(world.brla.pixOutputTickets.length).toBe(pixOutBefore + 1); + expect(submissionsOf(setup.signedTransfer)).toBe(1); + expect(world.evm.erc20Balance(Networks.Base, BRLA_ON_BASE, setup.destination)).toBe(setup.amountRaw); + }, + 30000 + ); +}); diff --git a/apps/api/src/tests/zzz-leak-probe.test.ts b/apps/api/src/tests/zzz-leak-probe.test.ts deleted file mode 100644 index 847fc1622..000000000 --- a/apps/api/src/tests/zzz-leak-probe.test.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { describe, expect, it } from "bun:test"; -import QuoteTicket from "../models/quoteTicket.model"; - -describe("leak probe", () => { - it("checks whether QuoteTicket.findByPk was leaked from another test file", async () => { - const fn = QuoteTicket.findByPk as unknown as { mock?: unknown }; - console.log("PROBE: findByPk is bun mock?", fn.mock !== undefined); - if (fn.mock !== undefined) { - const result = await (QuoteTicket.findByPk as unknown as (id: string) => Promise)("nonexistent-quote-id"); - console.log("PROBE: findByPk('nonexistent-quote-id') returned:", JSON.stringify(result)); - } - expect(true).toBe(true); - }); -}); From be7ff3fc14e0a4b0143060ef027718565ea8c1ba Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 18:59:43 +0200 Subject: [PATCH 097/176] Add component-test infrastructure and first RTL+MSW component test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Testing Library + jsdom (pinned to 26.x — jsdom 29 fails to load under bun's module layout) + MSW server wired via vitest setupFiles, with shared fixtures and an i18n test bootstrap under src/test/. First component test covers the Avenia KYC eligibility fields. Further quote-form and progress-page component tests remain to be added on this foundation. --- apps/frontend/package.json | 6 + .../AveniaKycEligibilityFields.test.tsx | 140 +++++++++++++ apps/frontend/src/test/fakeRampActor.ts | 56 +++++ apps/frontend/src/test/fixtures.ts | 51 +++++ apps/frontend/src/test/i18n.ts | 18 ++ apps/frontend/src/test/msw-server.ts | 8 + apps/frontend/src/test/setup.ts | 15 ++ apps/frontend/vitest.config.ts | 3 +- bun.lock | 196 +++++++++++++++--- 9 files changed, 465 insertions(+), 28 deletions(-) create mode 100644 apps/frontend/src/components/Avenia/AveniaKycEligibilityFields/AveniaKycEligibilityFields.test.tsx create mode 100644 apps/frontend/src/test/fakeRampActor.ts create mode 100644 apps/frontend/src/test/fixtures.ts create mode 100644 apps/frontend/src/test/i18n.ts create mode 100644 apps/frontend/src/test/msw-server.ts create mode 100644 apps/frontend/src/test/setup.ts diff --git a/apps/frontend/package.json b/apps/frontend/package.json index 3711431ac..b0cf9558a 100644 --- a/apps/frontend/package.json +++ b/apps/frontend/package.json @@ -87,6 +87,10 @@ "@storybook/react-vite": "^9.1.4", "@tanstack/react-query-devtools": "^5.91.1", "@tanstack/router-plugin": "^1.136.8", + "@testing-library/dom": "^10.4.1", + "@testing-library/jest-dom": "^6.9.1", + "@testing-library/react": "^16.3.2", + "@testing-library/user-event": "^14.6.1", "@types/big.js": "catalog:", "@types/bn.js": "^5", "@types/node": "catalog:", @@ -102,7 +106,9 @@ "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-storybook": "^9.1.4", "husky": ">=6", + "jsdom": "26", "lint-staged": ">=10", + "msw": "^2.14.6", "prettier": "catalog:", "storybook": "^9.1.4", "ts-node": "^10.9.1", diff --git a/apps/frontend/src/components/Avenia/AveniaKycEligibilityFields/AveniaKycEligibilityFields.test.tsx b/apps/frontend/src/components/Avenia/AveniaKycEligibilityFields/AveniaKycEligibilityFields.test.tsx new file mode 100644 index 000000000..d15e3a058 --- /dev/null +++ b/apps/frontend/src/components/Avenia/AveniaKycEligibilityFields/AveniaKycEligibilityFields.test.tsx @@ -0,0 +1,140 @@ +// @vitest-environment jsdom +import { render, screen, waitFor } from "@testing-library/react"; +import userEvent from "@testing-library/user-event"; +import { FiatToken, Networks, RampDirection } from "@vortexfi/shared"; +import { FormProvider } from "react-hook-form"; +import { beforeEach, describe, expect, it, vi } from "vitest"; +import { RampFormValues } from "../../../hooks/ramp/schema"; +import { useRampForm } from "../../../hooks/ramp/useRampForm"; +import { useQuoteStore } from "../../../stores/quote/useQuoteStore"; +import { useRampDirectionStore } from "../../../stores/rampDirectionStore"; +import { buildQuoteResponse } from "../../../test/fixtures"; +import "../../../test/i18n"; +import { AveniaKycEligibilityFields } from "./index"; + +const VALID_CPF = "529.982.247-25"; +const VALID_EVM_ADDRESS = "0x1111111111111111111111111111111111111111"; + +function Harness({ onValid }: { onValid: (values: RampFormValues) => void }) { + const { form } = useRampForm({ fiatToken: FiatToken.BRL }); + + return ( + +
+ + + +
+ ); +} + +describe("AveniaKycEligibilityFields (BRL details form)", () => { + beforeEach(() => { + localStorage.clear(); + useQuoteStore.setState({ quote: undefined }); + useRampDirectionStore.setState({ activeDirection: RampDirection.SELL }); + }); + + describe("offramp (SELL)", () => { + it("renders CPF/CNPJ and Pix key fields", () => { + render(); + + expect(screen.getByLabelText("CPF or CNPJ")).toBeInTheDocument(); + expect(screen.getByLabelText("Pix key")).toBeInTheDocument(); + }); + + it("shows required errors and does not submit when both fields are empty", async () => { + const onValid = vi.fn(); + const user = userEvent.setup(); + render(); + + await user.click(screen.getByRole("button", { name: "Confirm" })); + + expect(await screen.findByText("CPF or CNPJ is required when transferring BRL")).toBeInTheDocument(); + expect(screen.getByText("PIX key is required when transferring BRL")).toBeInTheDocument(); + expect(onValid).not.toHaveBeenCalled(); + }); + + it("rejects a malformed CPF", async () => { + const onValid = vi.fn(); + const user = userEvent.setup(); + render(); + + await user.type(screen.getByLabelText("CPF or CNPJ"), "12345"); + await user.type(screen.getByLabelText("Pix key"), "user@example.com"); + await user.click(screen.getByRole("button", { name: "Confirm" })); + + expect(await screen.findByText("Invalid CPF or CNPJ format")).toBeInTheDocument(); + expect(onValid).not.toHaveBeenCalled(); + }); + + it("rejects a Pix key that matches no valid format", async () => { + const onValid = vi.fn(); + const user = userEvent.setup(); + render(); + + await user.type(screen.getByLabelText("CPF or CNPJ"), VALID_CPF); + await user.type(screen.getByLabelText("Pix key"), "not-a-pix-key"); + await user.click(screen.getByRole("button", { name: "Confirm" })); + + expect(await screen.findByText("PIX key does not match any of the valid formats")).toBeInTheDocument(); + expect(onValid).not.toHaveBeenCalled(); + }); + + it("submits with a valid CPF and an email Pix key", async () => { + const onValid = vi.fn(); + const user = userEvent.setup(); + render(); + + await user.type(screen.getByLabelText("CPF or CNPJ"), VALID_CPF); + await user.type(screen.getByLabelText("Pix key"), "user@example.com"); + await user.click(screen.getByRole("button", { name: "Confirm" })); + + await waitFor(() => expect(onValid).toHaveBeenCalledTimes(1)); + expect(onValid.mock.calls[0][0]).toMatchObject({ + fiatToken: FiatToken.BRL, + pixId: "user@example.com", + taxId: VALID_CPF + }); + }); + }); + + describe("onramp (BUY)", () => { + beforeEach(() => { + useRampDirectionStore.setState({ activeDirection: RampDirection.BUY }); + // An EVM-destination BUY quote makes the schema require a valid EVM wallet address. + useQuoteStore.setState({ quote: buildQuoteResponse({ rampType: RampDirection.BUY, to: Networks.Base }) }); + }); + + it("renders a wallet address field instead of the Pix key and rejects invalid EVM addresses", async () => { + const onValid = vi.fn(); + const user = userEvent.setup(); + render(); + + expect(screen.queryByLabelText("Pix key")).not.toBeInTheDocument(); + + await user.type(screen.getByLabelText("CPF or CNPJ"), VALID_CPF); + await user.type(screen.getByLabelText("Wallet Address"), "0x123-not-an-address"); + await user.click(screen.getByRole("button", { name: "Confirm" })); + + expect(await screen.findByText("Invalid EVM wallet address")).toBeInTheDocument(); + expect(onValid).not.toHaveBeenCalled(); + }); + + it("submits with a valid CPF and EVM wallet address", async () => { + const onValid = vi.fn(); + const user = userEvent.setup(); + render(); + + await user.type(screen.getByLabelText("CPF or CNPJ"), VALID_CPF); + await user.type(screen.getByLabelText("Wallet Address"), VALID_EVM_ADDRESS); + await user.click(screen.getByRole("button", { name: "Confirm" })); + + await waitFor(() => expect(onValid).toHaveBeenCalledTimes(1)); + expect(onValid.mock.calls[0][0]).toMatchObject({ + taxId: VALID_CPF, + walletAddress: VALID_EVM_ADDRESS + }); + }); + }); +}); diff --git a/apps/frontend/src/test/fakeRampActor.ts b/apps/frontend/src/test/fakeRampActor.ts new file mode 100644 index 000000000..fff2414aa --- /dev/null +++ b/apps/frontend/src/test/fakeRampActor.ts @@ -0,0 +1,56 @@ +import { RampState } from "../types/phases"; + +interface FakeRampContext { + initializeFailedMessage?: string; + isSep24Redo?: boolean; + rampState?: RampState; + walletLocked?: string; +} + +interface FakeSnapshot { + context: FakeRampContext; +} + +type Listener = (snapshot: FakeSnapshot) => void; + +export interface FakeRampActor { + events: Array<{ type: string } & Record>; + getSnapshot: () => FakeSnapshot; + send: (event: { type: string } & Record) => void; + setRampState: (rampState: RampState | undefined) => void; + subscribe: (listener: Listener) => { unsubscribe: () => void }; +} + +// Minimal stand-in for the ramp machine actor: stable snapshot identity until a +// change occurs (required by useSyncExternalStore-based `useSelector`), records +// every sent event, and applies SET_RAMP_STATE like the real machine does. +export function createFakeRampActor(initialRampState?: RampState): FakeRampActor { + let snapshot: FakeSnapshot = { context: { rampState: initialRampState } }; + const listeners = new Set(); + const events: FakeRampActor["events"] = []; + + const update = (context: FakeRampContext) => { + snapshot = { context }; + for (const listener of listeners) { + listener(snapshot); + } + }; + + return { + events, + getSnapshot: () => snapshot, + send: event => { + events.push(event); + if (event.type === "SET_RAMP_STATE") { + update({ ...snapshot.context, rampState: event.rampState as RampState }); + } + }, + setRampState: rampState => { + update({ ...snapshot.context, rampState }); + }, + subscribe: listener => { + listeners.add(listener); + return { unsubscribe: () => listeners.delete(listener) }; + } + }; +} diff --git a/apps/frontend/src/test/fixtures.ts b/apps/frontend/src/test/fixtures.ts new file mode 100644 index 000000000..0adc8101b --- /dev/null +++ b/apps/frontend/src/test/fixtures.ts @@ -0,0 +1,51 @@ +import { EPaymentMethod, Networks, QuoteResponse, RampCurrency, RampDirection, RampPhase, RampProcess } from "@vortexfi/shared"; + +export function buildQuoteResponse(overrides: Partial = {}): QuoteResponse { + return { + anchorFeeFiat: "0.5", + anchorFeeUsd: "0.1", + createdAt: new Date("2026-07-05T10:00:00Z"), + expiresAt: new Date("2026-07-05T10:10:00Z"), + feeCurrency: "BRL" as RampCurrency, + from: EPaymentMethod.PIX, + id: "quote-1", + inputAmount: "150", + inputCurrency: "BRL" as RampCurrency, + network: Networks.Base, + networkFeeFiat: "0.2", + networkFeeUsd: "0.04", + outputAmount: "25.5", + outputCurrency: "USDC" as RampCurrency, + partnerFeeFiat: "0", + partnerFeeUsd: "0", + paymentMethod: EPaymentMethod.PIX, + processingFeeFiat: "0.5", + processingFeeUsd: "0.1", + rampType: RampDirection.BUY, + to: Networks.Base, + totalFeeFiat: "0.7", + totalFeeUsd: "0.14", + vortexFeeFiat: "0", + vortexFeeUsd: "0", + ...overrides + }; +} + +export function buildRampProcess(currentPhase: RampPhase, overrides: Partial = {}): RampProcess { + return { + createdAt: new Date().toISOString(), + currentPhase, + from: EPaymentMethod.PIX, + id: "ramp-123", + inputAmount: "150", + inputCurrency: "BRL", + outputAmount: "25.5", + outputCurrency: "USDC", + paymentMethod: EPaymentMethod.PIX, + quoteId: "quote-1", + to: Networks.Base, + type: RampDirection.BUY, + updatedAt: new Date().toISOString(), + ...overrides + }; +} diff --git a/apps/frontend/src/test/i18n.ts b/apps/frontend/src/test/i18n.ts new file mode 100644 index 000000000..869127a9a --- /dev/null +++ b/apps/frontend/src/test/i18n.ts @@ -0,0 +1,18 @@ +import i18n from "i18next"; +import { initReactI18next } from "react-i18next"; +import enTranslations from "../translations/en.json"; + +// Mirrors the production init in src/main.tsx, restricted to English. +if (!i18n.isInitialized) { + i18n.use(initReactI18next).init({ + fallbackLng: "en", + lng: "en", + resources: { + en: { + translation: enTranslations + } + } + }); +} + +export default i18n; diff --git a/apps/frontend/src/test/msw-server.ts b/apps/frontend/src/test/msw-server.ts new file mode 100644 index 000000000..07e228c5d --- /dev/null +++ b/apps/frontend/src/test/msw-server.ts @@ -0,0 +1,8 @@ +import { setupServer } from "msw/node"; + +// Shared MSW server. Tests register handlers per-test via `server.use(...)`; +// handlers are reset after each test in src/test/setup.ts. +export const server = setupServer(); + +// Matches SIGNING_SERVICE_URL ("http://localhost:3000") + the "/v1" prefix used by api-client. +export const API_BASE_URL = "http://localhost:3000/v1"; diff --git a/apps/frontend/src/test/setup.ts b/apps/frontend/src/test/setup.ts new file mode 100644 index 000000000..f5fcd7a11 --- /dev/null +++ b/apps/frontend/src/test/setup.ts @@ -0,0 +1,15 @@ +import "@testing-library/jest-dom/vitest"; +import { cleanup } from "@testing-library/react"; +import { afterAll, afterEach, beforeAll } from "vitest"; +import { server } from "./msw-server"; + +// "bypass" keeps pre-existing node-environment tests untouched: any request they make +// behaves exactly as before this setup file existed. +beforeAll(() => server.listen({ onUnhandledRequest: "bypass" })); + +afterEach(() => { + server.resetHandlers(); + cleanup(); +}); + +afterAll(() => server.close()); diff --git a/apps/frontend/vitest.config.ts b/apps/frontend/vitest.config.ts index 347586e52..77d878021 100644 --- a/apps/frontend/vitest.config.ts +++ b/apps/frontend/vitest.config.ts @@ -6,6 +6,7 @@ export default defineConfig({ test: { environment: "node", globals: false, - include: ["src/**/*.test.ts", "src/**/*.test.tsx"] + include: ["src/**/*.test.ts", "src/**/*.test.tsx"], + setupFiles: ["./src/test/setup.ts"] } }); diff --git a/bun.lock b/bun.lock index 98df570c2..9d9ff7bd8 100644 --- a/bun.lock +++ b/bun.lock @@ -189,6 +189,10 @@ "@storybook/react-vite": "^9.1.4", "@tanstack/react-query-devtools": "^5.91.1", "@tanstack/router-plugin": "^1.136.8", + "@testing-library/dom": "^10.4.1", + "@testing-library/jest-dom": "^6.9.1", + "@testing-library/react": "^16.3.2", + "@testing-library/user-event": "^14.6.1", "@types/big.js": "catalog:", "@types/bn.js": "^5", "@types/node": "catalog:", @@ -204,7 +208,9 @@ "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-storybook": "^9.1.4", "husky": ">=6", + "jsdom": "26", "lint-staged": ">=10", + "msw": "^2.14.6", "prettier": "catalog:", "storybook": "^9.1.4", "ts-node": "^10.9.1", @@ -396,6 +402,8 @@ "@ardatan/relay-compiler": ["@ardatan/relay-compiler@13.0.1", "", { "dependencies": { "@babel/runtime": "^7.29.2", "immutable": "^5.1.5", "invariant": "^2.2.4" }, "peerDependencies": { "graphql": "*" } }, "sha512-afG3YPwuSA0E5foouZusz5GlXKs74dObv4cuWyLyfKsYFj2r7oGRNB28v18HvwuLSQtQFCi+DpIe0TZkgQDYyg=="], + "@asamuzakjp/css-color": ["@asamuzakjp/css-color@3.2.0", "", { "dependencies": { "@csstools/css-calc": "^2.1.3", "@csstools/css-color-parser": "^3.0.9", "@csstools/css-parser-algorithms": "^3.0.4", "@csstools/css-tokenizer": "^3.0.3", "lru-cache": "^10.4.3" } }, "sha512-K1A6z8tS3XsmCMM86xoWdn7Fkdn9m6RSVtocUrJYIwZnFVkng/PvkEoWtOWmP+Scc6saYWHWZYbndEEXxl24jw=="], + "@aws-crypto/crc32": ["@aws-crypto/crc32@5.2.0", "", { "dependencies": { "@aws-crypto/util": "^5.2.0", "@aws-sdk/types": "^3.222.0", "tslib": "^2.6.2" } }, "sha512-nLbCWqQNgUiwwtFsen1AdzAtvuLRsQS8rYgMuxCrdKf9kOssamGLuPwyTY9wyYblNr9+1XM8v6zoDTPPSIeANg=="], "@aws-crypto/sha256-browser": ["@aws-crypto/sha256-browser@5.2.0", "", { "dependencies": { "@aws-crypto/sha256-js": "^5.2.0", "@aws-crypto/supports-web-crypto": "^5.2.0", "@aws-crypto/util": "^5.2.0", "@aws-sdk/types": "^3.222.0", "@aws-sdk/util-locate-window": "^3.0.0", "@smithy/util-utf8": "^2.0.0", "tslib": "^2.6.2" } }, "sha512-AXfN/lGotSQwu6HNcEsIASo7kWXZ5HYWvfOmSNKDsEqC4OashTp8alTmaz+F7TC2L083SFv5RdB+qU3Vs1kZqw=="], @@ -670,6 +678,16 @@ "@cspotcode/source-map-support": ["@cspotcode/source-map-support@0.8.1", "", { "dependencies": { "@jridgewell/trace-mapping": "0.3.9" } }, "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw=="], + "@csstools/color-helpers": ["@csstools/color-helpers@5.1.0", "", {}, "sha512-S11EXWJyy0Mz5SYvRmY8nJYTFFd1LCNV+7cXyAgQtOOuzb4EsgfqDufL+9esx72/eLhsRdGZwaldu/h+E4t4BA=="], + + "@csstools/css-calc": ["@csstools/css-calc@2.1.4", "", { "peerDependencies": { "@csstools/css-parser-algorithms": "^3.0.5", "@csstools/css-tokenizer": "^3.0.4" } }, "sha512-3N8oaj+0juUw/1H3YwmDDJXCgTB1gKU6Hc/bB502u9zR0q2vd786XJH9QfrKIEgFlZmhZiq6epXl4rHqhzsIgQ=="], + + "@csstools/css-color-parser": ["@csstools/css-color-parser@3.1.0", "", { "dependencies": { "@csstools/color-helpers": "^5.1.0", "@csstools/css-calc": "^2.1.4" }, "peerDependencies": { "@csstools/css-parser-algorithms": "^3.0.5", "@csstools/css-tokenizer": "^3.0.4" } }, "sha512-nbtKwh3a6xNVIp/VRuXV64yTKnb1IjTAEEh3irzS+HkKjAOYLTGNb9pmVNntZ8iVBHcWDA2Dof0QtPgFI1BaTA=="], + + "@csstools/css-parser-algorithms": ["@csstools/css-parser-algorithms@3.0.5", "", { "peerDependencies": { "@csstools/css-tokenizer": "^3.0.4" } }, "sha512-DaDeUkXZKjdGhgYaHNJTV9pV7Y9B3b644jCLs9Upc3VeNGg6LWARAT6O+Q+/COo+2gg/bM5rhpMAtf70WqfBdQ=="], + + "@csstools/css-tokenizer": ["@csstools/css-tokenizer@3.0.4", "", {}, "sha512-Vd/9EVDiu6PPJt9yAh6roZP6El1xHrdvIVGjyBsHR0RYwNHgL7FJPyIIW4fANJNG6FtyZfvlRPpFI4ZM/lubvw=="], + "@dabh/diagnostics": ["@dabh/diagnostics@2.0.8", "", { "dependencies": { "@so-ric/colorspace": "^1.1.6", "enabled": "2.0.x", "kuler": "^2.0.0" } }, "sha512-R4MSXTVnuMzGD7bzHdW2ZhhdPC/igELENcq5IjEverBvq5hn1SXCWcsi6eSsdWP0/Ur+SItRRjAktmdoX/8R/Q=="], "@ecies/ciphers": ["@ecies/ciphers@0.2.6", "", { "peerDependencies": { "@noble/ciphers": "^1.0.0" } }, "sha512-patgsRPKGkhhoBjETV4XxD0En4ui5fbX0hzayqI3M8tvNMGUoUvmyYAIWwlxBc1KX5cturfqByYdj5bYGRpN9g=="], @@ -934,8 +952,18 @@ "@humanwhocodes/object-schema": ["@humanwhocodes/object-schema@2.0.3", "", {}, "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA=="], + "@inquirer/ansi": ["@inquirer/ansi@2.0.7", "", {}, "sha512-3eTuUO1vH2cZm2ZKHeQxnOqlTi9EfZDGgIe3BL3I4u+rJHocr9Fz86M4fjYABPvFnQG/gGK551HqDiIcETwU6Q=="], + + "@inquirer/confirm": ["@inquirer/confirm@6.1.1", "", { "dependencies": { "@inquirer/core": "^11.2.1", "@inquirer/type": "^4.0.7" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-eb8DBZcz/2qHWQda4rk2JiQk5h9QV/cVHi1yjt0f69WFZMRFn0sJTye3EAP8icut8UDMjQPsaH5KbcOogefrFQ=="], + + "@inquirer/core": ["@inquirer/core@11.2.1", "", { "dependencies": { "@inquirer/ansi": "^2.0.7", "@inquirer/figures": "^2.0.7", "@inquirer/type": "^4.0.7", "cli-width": "^4.1.0", "fast-wrap-ansi": "^0.2.0", "mute-stream": "^3.0.0", "signal-exit": "^4.1.0" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-Qd6GJT1yVyrZZCfN8W2qKF5ApmqryXRhRKCuip8h01x2w/esJQ2XIYc6f9abMIHgKQdBfFTSOdbHRLAhuM09UA=="], + "@inquirer/external-editor": ["@inquirer/external-editor@1.0.3", "", { "dependencies": { "chardet": "^2.1.1", "iconv-lite": "^0.7.0" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-RWbSrDiYmO4LbejWY7ttpxczuwQyZLBUyygsA9Nsv95hpzUWwnNTVQmAq3xuh7vNwCp07UTmE5i11XAEExx4RA=="], + "@inquirer/figures": ["@inquirer/figures@2.0.7", "", {}, "sha512-aJ8TBPOGB6f/2qziPfElISTCEd5XOYTFckA2SGjhNmiKzfK/u4ot3v0DUzGVdUnKjN10EqnnEPck36BkyfLnJw=="], + + "@inquirer/type": ["@inquirer/type@4.0.7", "", { "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-t28inv14nMQ1PhKpsJPY+kEs/c00qzeCOS2gTNRyTjG5d6qsVA2fItxW4hkvGZ5lvanGLdtCzVIx5dwdRpN1+g=="], + "@isaacs/cliui": ["@isaacs/cliui@8.0.2", "", { "dependencies": { "string-width": "^5.1.2", "string-width-cjs": "npm:string-width@^4.2.0", "strip-ansi": "^7.0.1", "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", "wrap-ansi": "^8.1.0", "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" } }, "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA=="], "@isaacs/fs-minipass": ["@isaacs/fs-minipass@4.0.1", "", { "dependencies": { "minipass": "^7.0.4" } }, "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w=="], @@ -1008,6 +1036,8 @@ "@msgpack/msgpack": ["@msgpack/msgpack@3.1.3", "", {}, "sha512-47XIizs9XZXvuJgoaJUIE2lFoID8ugvc0jzSHP+Ptfk8nTbnR8g788wv48N03Kx0UkAv559HWRQ3yzOgzlRNUA=="], + "@mswjs/interceptors": ["@mswjs/interceptors@0.41.9", "", { "dependencies": { "@open-draft/deferred-promise": "^2.2.0", "@open-draft/logger": "^0.3.0", "@open-draft/until": "^2.0.0", "is-node-process": "^1.2.0", "outvariant": "^1.4.3", "strict-event-emitter": "^0.5.1" } }, "sha512-VVPPgHyQ6ShqnrmDWuxjmUIsO9gWyOZFmuOfLd9LfBGQJwZfy0gvv9pbHSJuoFNIYC7ZDX9aoFwowjcdSC4E8w=="], + "@napi-rs/nice": ["@napi-rs/nice@1.1.1", "", { "optionalDependencies": { "@napi-rs/nice-android-arm-eabi": "1.1.1", "@napi-rs/nice-android-arm64": "1.1.1", "@napi-rs/nice-darwin-arm64": "1.1.1", "@napi-rs/nice-darwin-x64": "1.1.1", "@napi-rs/nice-freebsd-x64": "1.1.1", "@napi-rs/nice-linux-arm-gnueabihf": "1.1.1", "@napi-rs/nice-linux-arm64-gnu": "1.1.1", "@napi-rs/nice-linux-arm64-musl": "1.1.1", "@napi-rs/nice-linux-ppc64-gnu": "1.1.1", "@napi-rs/nice-linux-riscv64-gnu": "1.1.1", "@napi-rs/nice-linux-s390x-gnu": "1.1.1", "@napi-rs/nice-linux-x64-gnu": "1.1.1", "@napi-rs/nice-linux-x64-musl": "1.1.1", "@napi-rs/nice-openharmony-arm64": "1.1.1", "@napi-rs/nice-win32-arm64-msvc": "1.1.1", "@napi-rs/nice-win32-ia32-msvc": "1.1.1", "@napi-rs/nice-win32-x64-msvc": "1.1.1" } }, "sha512-xJIPs+bYuc9ASBl+cvGsKbGrJmS6fAKaSZCnT0lhahT5rhA2VVy9/EcIgd2JhtEuFOJNx7UHNn/qiTPTY4nrQw=="], "@napi-rs/nice-android-arm-eabi": ["@napi-rs/nice-android-arm-eabi@1.1.1", "", { "os": "android", "cpu": "arm" }, "sha512-kjirL3N6TnRPv5iuHw36wnucNqXAO46dzK9oPb0wj076R5Xm8PfUVA9nAFB5ZNMmfJQJVKACAPd/Z2KYMppthw=="], @@ -1114,6 +1144,12 @@ "@one-ini/wasm": ["@one-ini/wasm@0.1.1", "", {}, "sha512-XuySG1E38YScSJoMlqovLru4KTUNSjgVTIjyh7qMX6aNN5HY5Ct5LhRJdxO79JtTzKfzV/bnWpz+zquYrISsvw=="], + "@open-draft/deferred-promise": ["@open-draft/deferred-promise@3.0.0", "", {}, "sha512-XW375UK8/9SqUVNVa6M0yEy8+iTi4QN5VZ7aZuRFQmy76LRwI9wy5F4YIBU6T+eTe2/DNDo8tqu8RHlwLHM6RA=="], + + "@open-draft/logger": ["@open-draft/logger@0.3.0", "", { "dependencies": { "is-node-process": "^1.2.0", "outvariant": "^1.4.0" } }, "sha512-X2g45fzhxH238HKO4xbSr7+wBS8Fvw6ixhTDuvLd5mqh6bJJCFAPwU9mPDxbcrRtfxv4u5IHCEH77BmxvXmmxQ=="], + + "@open-draft/until": ["@open-draft/until@2.1.0", "", {}, "sha512-U69T3ItWHvLwGg5eJ0n3I62nWuE6ilHlmz7zM0npLBRvPRd7e6NYmg54vvRtP5mZG7kZqZCFVdsTWo7BPtBujg=="], + "@open-web3/api-mobx": ["@open-web3/api-mobx@1.1.4", "", { "dependencies": { "mobx": "^5.15.7", "mobx-utils": "^5.6.2" }, "peerDependencies": { "@polkadot/api": ">6.3.1" } }, "sha512-MheCFMiGp08i5ukMB8Dai6sNYEpX6UkuCobGIOZzON4K/Yj4mp9jUjzxZ24SCTtGLRwhI3qtUv3AyL06neObnw=="], "@open-web3/orml-api-derive": ["@open-web3/orml-api-derive@1.1.4", "", { "dependencies": { "memoizee": "^0.4.15", "rxjs": "^7.2.0" }, "peerDependencies": { "@polkadot/api": ">6.3.1" } }, "sha512-h8FgrNtA0+PvM1bPu3cJpaMTCGj0pyRbMid2M8XOq1PtQH216Z2CAtrilpQhQIgthJFcfmfirZ+80uG/faWirA=="], @@ -1838,6 +1874,8 @@ "@testing-library/jest-dom": ["@testing-library/jest-dom@6.9.1", "", { "dependencies": { "@adobe/css-tools": "^4.4.0", "aria-query": "^5.0.0", "css.escape": "^1.5.1", "dom-accessibility-api": "^0.6.3", "picocolors": "^1.1.1", "redent": "^3.0.0" } }, "sha512-zIcONa+hVtVSSep9UT3jZ5rizo2BsxgyDYU7WFD5eICBE7no3881HGeb/QkGfsJs6JTkY1aQhT7rIPC7e+0nnA=="], + "@testing-library/react": ["@testing-library/react@16.3.2", "", { "dependencies": { "@babel/runtime": "^7.12.5" }, "peerDependencies": { "@testing-library/dom": "^10.0.0", "@types/react": "^18.0.0 || ^19.0.0", "@types/react-dom": "^18.0.0 || ^19.0.0", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-XU5/SytQM+ykqMnAnvB2umaJNIOsLF3PVv//1Ew4CTcpz0/BRyy/af40qqrt7SjKpDdT1saBMc42CUok5gaw+g=="], + "@testing-library/user-event": ["@testing-library/user-event@14.6.1", "", { "peerDependencies": { "@testing-library/dom": ">=7.21.4" } }, "sha512-vq7fv0rnt+QTXgPxr5Hjc210p6YKq2kmdziLgnsZGgLJ9e6VAShx1pACLuRjd/AS/sr7phAR58OIIpf0LlmQNw=="], "@thi.ng/api": ["@thi.ng/api@8.12.25", "", {}, "sha512-5Xixty2r+t6LNixnKpVBICz6R7SINaG2KnUG/CVJ2cuiQhih0RztldItEFYk4aRUFthRibhsG2Ie5ULS7qr9Kg=="], @@ -1996,6 +2034,10 @@ "@types/serve-static": ["@types/serve-static@2.2.0", "", { "dependencies": { "@types/http-errors": "*", "@types/node": "*" } }, "sha512-8mam4H1NHLtu7nmtalF7eyBH14QyOASmcxHhSfEoRyr0nP/YdoesEtU+uSRvMe96TW/HPTtkoKqQLl53N7UXMQ=="], + "@types/set-cookie-parser": ["@types/set-cookie-parser@2.4.10", "", { "dependencies": { "@types/node": "*" } }, "sha512-GGmQVGpQWUe5qglJozEjZV/5dyxbOOZ0LHe/lqyWssB88Y4svNfst0uqBVscdDeIKl5Jy5+aPSvy7mI9tYRguw=="], + + "@types/statuses": ["@types/statuses@2.0.6", "", {}, "sha512-xMAgYwceFhRA2zY+XbEA7mxYbA093wdiW8Vu6gZPGWy9cmOyU9XesH1tNcEWsKFd5Vzrqx5T3D38PWx1FIIXkA=="], + "@types/triple-beam": ["@types/triple-beam@1.3.5", "", {}, "sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw=="], "@types/trusted-types": ["@types/trusted-types@2.0.7", "", {}, "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw=="], @@ -2160,7 +2202,7 @@ "aes-js": ["aes-js@4.0.0-beta.5", "", {}, "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q=="], - "agent-base": ["agent-base@6.0.2", "", { "dependencies": { "debug": "4" } }, "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ=="], + "agent-base": ["agent-base@7.1.4", "", {}, "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ=="], "aggregate-error": ["aggregate-error@3.1.0", "", { "dependencies": { "clean-stack": "^2.0.0", "indent-string": "^4.0.0" } }, "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA=="], @@ -2202,7 +2244,7 @@ "aria-hidden": ["aria-hidden@1.2.6", "", { "dependencies": { "tslib": "^2.0.0" } }, "sha512-ik3ZgC9dY/lYVVM++OISsaYDeg1tb0VtP5uL3ouh1koGOaUMDPpbFIei4JkFimWUFPn90sbMNMXQAIVOlnYKJA=="], - "aria-query": ["aria-query@5.3.2", "", {}, "sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw=="], + "aria-query": ["aria-query@5.3.0", "", { "dependencies": { "dequal": "^2.0.3" } }, "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A=="], "array-back": ["array-back@3.1.0", "", {}, "sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q=="], @@ -2564,6 +2606,8 @@ "css.escape": ["css.escape@1.5.1", "", {}, "sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg=="], + "cssstyle": ["cssstyle@4.6.0", "", { "dependencies": { "@asamuzakjp/css-color": "^3.2.0", "rrweb-cssom": "^0.8.0" } }, "sha512-2z+rWdzbbSZv6/rhtvzvqeZQHrBaqgogqt85sqFNbabZOuFbCVFb8kPeEtZjiKkbrm395irpNKiYeFeLiQnFPg=="], + "csstype": ["csstype@3.2.3", "", {}, "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ=="], "d": ["d@1.0.2", "", { "dependencies": { "es5-ext": "^0.10.64", "type": "^2.7.2" } }, "sha512-MOqHvMWF9/9MX6nza0KgvFH4HpMU0EF5uUDXqX/BtxtU8NfB0QzRtJ8Oe/6SuS4kbhyzVJwjd97EA4PKrzJ8bw=="], @@ -2572,6 +2616,8 @@ "data-uri-to-buffer": ["data-uri-to-buffer@4.0.1", "", {}, "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A=="], + "data-urls": ["data-urls@5.0.0", "", { "dependencies": { "whatwg-mimetype": "^4.0.0", "whatwg-url": "^14.0.0" } }, "sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg=="], + "data-view-buffer": ["data-view-buffer@1.0.2", "", { "dependencies": { "call-bound": "^1.0.3", "es-errors": "^1.3.0", "is-data-view": "^1.0.2" } }, "sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ=="], "data-view-byte-length": ["data-view-byte-length@1.0.2", "", { "dependencies": { "call-bound": "^1.0.3", "es-errors": "^1.3.0", "is-data-view": "^1.0.2" } }, "sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ=="], @@ -2592,6 +2638,8 @@ "decamelize": ["decamelize@4.0.0", "", {}, "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ=="], + "decimal.js": ["decimal.js@10.6.0", "", {}, "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg=="], + "decode-uri-component": ["decode-uri-component@0.2.2", "", {}, "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ=="], "decompress-response": ["decompress-response@6.0.0", "", { "dependencies": { "mimic-response": "^3.1.0" } }, "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ=="], @@ -2652,7 +2700,7 @@ "doctrine": ["doctrine@3.0.0", "", { "dependencies": { "esutils": "^2.0.2" } }, "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w=="], - "dom-accessibility-api": ["dom-accessibility-api@0.6.3", "", {}, "sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w=="], + "dom-accessibility-api": ["dom-accessibility-api@0.5.16", "", {}, "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg=="], "domain-browser": ["domain-browser@4.22.0", "", {}, "sha512-IGBwjF7tNk3cwypFNH/7bfzBcgSCbaMOD3GsaY1AU/JRrnHnYgEM0+9kQt52iZxjNsjBtJYtao146V+f8jFZNw=="], @@ -2702,6 +2750,8 @@ "enquirer": ["enquirer@2.4.1", "", { "dependencies": { "ansi-colors": "^4.1.1", "strip-ansi": "^6.0.1" } }, "sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ=="], + "entities": ["entities@6.0.1", "", {}, "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g=="], + "env-paths": ["env-paths@2.2.1", "", {}, "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A=="], "environment": ["environment@1.1.0", "", {}, "sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q=="], @@ -2846,8 +2896,14 @@ "fast-safe-stringify": ["fast-safe-stringify@2.1.1", "", {}, "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA=="], + "fast-string-truncated-width": ["fast-string-truncated-width@3.0.3", "", {}, "sha512-0jjjIEL6+0jag3l2XWWizO64/aZVtpiGE3t0Zgqxv0DPuxiMjvB3M24fCyhZUO4KomJQPj3LTSUnDP3GpdwC0g=="], + + "fast-string-width": ["fast-string-width@3.0.2", "", { "dependencies": { "fast-string-truncated-width": "^3.0.2" } }, "sha512-gX8LrtNEI5hq8DVUfRQMbr5lpaS4nMIWV+7XEbXk2b8kiQIizgnlr12B4dA3ZEx3308ze0O4Q1R+cHts8kyUJg=="], + "fast-uri": ["fast-uri@3.1.2", "", {}, "sha512-rVjf7ArG3LTk+FS6Yw81V1DLuZl1bRbNrev6Tmd/9RaroeeRRJhAt7jg/6YFxbvAQXUCavSoZhPPj6oOx+5KjQ=="], + "fast-wrap-ansi": ["fast-wrap-ansi@0.2.2", "", { "dependencies": { "fast-string-width": "^3.0.2" } }, "sha512-7F2Fl+TjRSenLqlU3UjSH0iyqopqoZIu7eZVpEirP2g1GtWa2G/ecEmBdgz31+Mxr+ELclgg6sokpSFIQiZ02Q=="], + "fast-xml-builder": ["fast-xml-builder@1.2.0", "", { "dependencies": { "path-expression-matcher": "^1.5.0", "xml-naming": "^0.1.0" } }, "sha512-00aAWieqff+ZJhsXA4g1g7M8k+7AYoMUUHF+/zFb5U6Uv/P0Vl4QZo84/IcufzYalLuEj9928bXN9PbbFzMF0Q=="], "fast-xml-parser": ["fast-xml-parser@5.7.3", "", { "dependencies": { "@nodable/entities": "^2.1.0", "fast-xml-builder": "^1.1.7", "path-expression-matcher": "^1.5.0", "strnum": "^2.2.3" }, "bin": { "fxparser": "src/cli/cli.js" } }, "sha512-C0AaNuC+mscy6vrAQKAc/rMq+zAPHodfHGZu4sGVehvAQt/JLG1O5zEcYcXSY5zSqr4YVgxsB+pHXTq0i7eDlg=="], @@ -3034,6 +3090,8 @@ "header-case": ["header-case@2.0.4", "", { "dependencies": { "capital-case": "^1.0.4", "tslib": "^2.0.3" } }, "sha512-H/vuk5TEEVZwrR0lp2zed9OCo1uAILMlx0JEMgC26rzyJJ3N1v6XkwHHXJQdR2doSjcGPM6OKPYoJgf0plJ11Q=="], + "headers-polyfill": ["headers-polyfill@5.0.1", "", { "dependencies": { "@types/set-cookie-parser": "^2.4.10", "set-cookie-parser": "^3.0.1" } }, "sha512-1TJ6Fih/b8h5TIcv+1+Hw0PDQWJTKDKzFZzcKOiW1wJza3XoAQlkCuXLbymPYB8+ZQyw8mHvdw560e8zVFIWyA=="], + "heap": ["heap@0.2.7", "", {}, "sha512-2bsegYkkHO+h/9MGbn6KWcE45cHZgPANo5LXF7EvWdT0yT2EguSVO1nDgU5c8+ZOPwp2vMNa7YFsJhVcDR9Sdg=="], "helmet": ["helmet@4.6.0", "", {}, "sha512-HVqALKZlR95ROkrnesdhbbZJFi/rIVSoNq6f3jA/9u6MIbTsPh3xZwihjeI5+DO/2sOV6HMHooXcEOuwskHpTg=="], @@ -3046,6 +3104,8 @@ "hono": ["hono@4.12.23", "", {}, "sha512-eIaZ9qDgu7XV0pxOCrg7/WhnQ6Ivm22UcxhXx/A3dcbqbbYgBEkc6e/J/s7j2tS96zoB0S9VBdLwQNCWwUo4LA=="], + "html-encoding-sniffer": ["html-encoding-sniffer@4.0.0", "", { "dependencies": { "whatwg-encoding": "^3.1.1" } }, "sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ=="], + "html-parse-stringify": ["html-parse-stringify@3.0.1", "", { "dependencies": { "void-elements": "3.1.0" } }, "sha512-KknJ50kTInJ7qIScF3jeaFRpMpE8/lfiTdzf/twXyPBLAGrLRTmkz3AdTnKeh40X8k9L2fdYwEp/42WGXIRGcg=="], "http-basic": ["http-basic@8.1.3", "", { "dependencies": { "caseless": "^0.12.0", "concat-stream": "^1.6.2", "http-response-object": "^3.0.1", "parse-cache-control": "^1.0.1" } }, "sha512-/EcDMwJZh3mABI2NhGfHOGOeOZITqfkEO4p/xK+l3NpyncIHUQBoMvCSF/b5GqvKtySC2srL/GGG3+EtlqlmCw=="], @@ -3064,7 +3124,7 @@ "https-browserify": ["https-browserify@1.0.0", "", {}, "sha512-J+FkSdyD+0mA0N+81tMotaRMfSL9SGi+xpD3T6YApKsc3bGSXJlfXri3VyFOeYkfLRQisDk1W+jIFFKBeUBbBg=="], - "https-proxy-agent": ["https-proxy-agent@5.0.1", "", { "dependencies": { "agent-base": "6", "debug": "4" } }, "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA=="], + "https-proxy-agent": ["https-proxy-agent@7.0.6", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "4" } }, "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw=="], "human-signals": ["human-signals@2.1.0", "", {}, "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw=="], @@ -3176,6 +3236,8 @@ "is-negative-zero": ["is-negative-zero@2.0.3", "", {}, "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw=="], + "is-node-process": ["is-node-process@1.2.0", "", {}, "sha512-Vg4o6/fqPxIjtxgUH5QLJhwZ7gW5diGCVlXpuUfELC62CuxM1iHcRe51f2W1FDy04Ai4KJkagKjx3XaqyfRKXw=="], + "is-number": ["is-number@7.0.0", "", {}, "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng=="], "is-number-object": ["is-number-object@1.1.1", "", { "dependencies": { "call-bound": "^1.0.3", "has-tostringtag": "^1.0.2" } }, "sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw=="], @@ -3184,6 +3246,8 @@ "is-plain-obj": ["is-plain-obj@2.1.0", "", {}, "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA=="], + "is-potential-custom-element-name": ["is-potential-custom-element-name@1.0.1", "", {}, "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ=="], + "is-promise": ["is-promise@4.0.0", "", {}, "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ=="], "is-regex": ["is-regex@1.2.1", "", { "dependencies": { "call-bound": "^1.0.2", "gopd": "^1.2.0", "has-tostringtag": "^1.0.2", "hasown": "^2.0.2" } }, "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g=="], @@ -3256,6 +3320,8 @@ "js-yaml": ["js-yaml@4.1.1", "", { "dependencies": { "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA=="], + "jsdom": ["jsdom@26.1.0", "", { "dependencies": { "cssstyle": "^4.2.1", "data-urls": "^5.0.0", "decimal.js": "^10.5.0", "html-encoding-sniffer": "^4.0.0", "http-proxy-agent": "^7.0.2", "https-proxy-agent": "^7.0.6", "is-potential-custom-element-name": "^1.0.1", "nwsapi": "^2.2.16", "parse5": "^7.2.1", "rrweb-cssom": "^0.8.0", "saxes": "^6.0.0", "symbol-tree": "^3.2.4", "tough-cookie": "^5.1.1", "w3c-xmlserializer": "^5.0.0", "webidl-conversions": "^7.0.0", "whatwg-encoding": "^3.1.1", "whatwg-mimetype": "^4.0.0", "whatwg-url": "^14.1.1", "ws": "^8.18.0", "xml-name-validator": "^5.0.0" }, "peerDependencies": { "canvas": "^3.0.0" }, "optionalPeers": ["canvas"] }, "sha512-Cvc9WUhxSMEo4McES3P7oK3QaXldCfNWp7pl2NNeiIFlCoLr3kfq9kb1fxftiwk1FLV7CvpvDfonxtzUDeSOPg=="], + "jsesc": ["jsesc@3.1.0", "", { "bin": { "jsesc": "bin/jsesc" } }, "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA=="], "json-bigint": ["json-bigint@1.0.0", "", { "dependencies": { "bignumber.js": "^9.0.0" } }, "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ=="], @@ -3500,6 +3566,8 @@ "ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="], + "msw": ["msw@2.14.6", "", { "dependencies": { "@inquirer/confirm": "^6.0.11", "@mswjs/interceptors": "^0.41.3", "@open-draft/deferred-promise": "^3.0.0", "@types/statuses": "^2.0.6", "cookie": "^1.1.1", "graphql": "^16.13.2", "headers-polyfill": "^5.0.1", "is-node-process": "^1.2.0", "outvariant": "^1.4.3", "path-to-regexp": "^6.3.0", "picocolors": "^1.1.1", "rettime": "^0.11.11", "statuses": "^2.0.2", "strict-event-emitter": "^0.5.1", "tough-cookie": "^6.0.1", "type-fest": "^5.5.0", "until-async": "^3.0.2", "yargs": "^17.7.2" }, "peerDependencies": { "typescript": ">= 4.8.x" }, "optionalPeers": ["typescript"], "bin": { "msw": "cli/index.js" } }, "sha512-ALe+N10S72cyx94cMcy3Zs4HhXCj35sgeAL4c+WTvKi0zWnbd8/h0lcFqv0mb2P+aSgAdD7p9HzvA0DiUPxsyg=="], + "multer": ["multer@2.1.1", "", { "dependencies": { "append-field": "^1.0.0", "busboy": "^1.6.0", "concat-stream": "^2.0.0", "type-is": "^1.6.18" } }, "sha512-mo+QTzKlx8R7E5ylSXxWzGoXoZbOsRMpyitcht8By2KHvMbf3tjwosZ/Mu/XYU6UuJ3VZnODIrak5ZrPiPyB6A=="], "multiformats": ["multiformats@9.9.0", "", {}, "sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg=="], @@ -3570,6 +3638,8 @@ "numora-react": ["numora-react@4.0.0", "", { "peerDependencies": { "numora": ">=4.0.0", "react": ">=17.0.0", "react-dom": ">=17.0.0" }, "optionalPeers": ["react-dom"] }, "sha512-lAN32AIfEfCOofgfpvCib157Psv+2egG48pmDzJnFtnVxnleu8C5AwIWyyyPXzxsY8f4ZyC3X1BKwHnlfXSv8w=="], + "nwsapi": ["nwsapi@2.2.24", "", {}, "sha512-7YRhZ3jS45LwmSCT4b2sVFHt/WuovaktDU07QrtOBY2PXskss5a9jfmR9jptyumwXST+rFjrmppMY1KT/yn35A=="], + "obj-multiplex": ["obj-multiplex@1.0.0", "", { "dependencies": { "end-of-stream": "^1.4.0", "once": "^1.4.0", "readable-stream": "^2.3.3" } }, "sha512-0GNJAOsHoBHeNTvl5Vt6IWnpUEcc3uSRxzBri7EDyIcMgYvnY2JL2qdeV5zTMjWQX5OHcD5amcW2HFfDh0gjIA=="], "object-assign": ["object-assign@4.1.1", "", {}, "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg=="], @@ -3618,6 +3688,8 @@ "os-browserify": ["os-browserify@0.3.0", "", {}, "sha512-gjcpUc3clBf9+210TRaDWbf+rZZZEshZ+DlXMRCeAjp0xhTrnQsKHypIy1J3d5hKdUzj69t708EHtU8P6bUn0A=="], + "outvariant": ["outvariant@1.4.3", "", {}, "sha512-+Sl2UErvtsoajRDKCE5/dBz4DIvHXQQnAxtQTF04OJxY0+DyZXSo5P5Bb7XYWOh81syohlYL24hbDwxedPUJCA=="], + "own-keys": ["own-keys@1.0.1", "", { "dependencies": { "get-intrinsic": "^1.2.6", "object-keys": "^1.1.1", "safe-push-apply": "^1.0.0" } }, "sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg=="], "ox": ["ox@0.14.25", "", { "dependencies": { "@adraffy/ens-normalize": "^1.11.0", "@noble/ciphers": "^1.3.0", "@noble/curves": "1.9.1", "@noble/hashes": "^1.8.0", "@scure/bip32": "^1.7.0", "@scure/bip39": "^1.6.0", "abitype": "^1.2.3", "eventemitter3": "5.0.1" }, "peerDependencies": { "typescript": ">=5.4.0" }, "optionalPeers": ["typescript"] }, "sha512-8DoibKtxE8yw63Y2jjMhlbjaURev6WCx4QR4MWLusl2/qIaeTzMJMBIYIDl1KOF45+8H1Ur6eLTdPlUoO8PlRw=="], @@ -3654,6 +3726,8 @@ "parse-json": ["parse-json@5.2.0", "", { "dependencies": { "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", "json-parse-even-better-errors": "^2.3.0", "lines-and-columns": "^1.1.6" } }, "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg=="], + "parse5": ["parse5@7.3.0", "", { "dependencies": { "entities": "^6.0.0" } }, "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw=="], + "parseurl": ["parseurl@1.3.3", "", {}, "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="], "pascal-case": ["pascal-case@3.1.2", "", { "dependencies": { "no-case": "^3.0.4", "tslib": "^2.0.3" } }, "sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g=="], @@ -3832,7 +3906,7 @@ "react-i18next": ["react-i18next@15.7.4", "", { "dependencies": { "@babel/runtime": "^7.27.6", "html-parse-stringify": "^3.0.1" }, "peerDependencies": { "i18next": ">= 23.4.0", "react": ">= 16.8.0", "typescript": "^5" }, "optionalPeers": ["typescript"] }, "sha512-nyU8iKNrI5uDJch0z9+Y5XEr34b0wkyYj3Rp+tfbahxtlswxSCjcUL9H0nqXo9IR3/t5Y5PKIA3fx3MfUyR9Xw=="], - "react-is": ["react-is@16.13.1", "", {}, "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="], + "react-is": ["react-is@17.0.2", "", {}, "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w=="], "react-refresh": ["react-refresh@0.17.0", "", {}, "sha512-z6F7K9bV85EfseRCp2bzrpyQ0Gkw1uLoCel9XBVWPg/TjRj94SkJzUTGfOa4bs7iJvBWtQG0Wq7wnI0syw3EBQ=="], @@ -3904,6 +3978,8 @@ "retry-as-promised": ["retry-as-promised@7.1.1", "", {}, "sha512-hMD7odLOt3LkTjcif8aRZqi/hybjpLNgSk5oF5FCowfCjok6LukpN2bDX7R5wDmbgBQFn7YoBxSagmtXHaJYJw=="], + "rettime": ["rettime@0.11.11", "", {}, "sha512-ILJRqVWBCTlg9r42fFgwVZx1gnFAcQF8mRoMkbgQfIrjEDf9nbBFDFx00oloOa+Q869FUtaYDXZvEfnecQSCoQ=="], + "reusify": ["reusify@1.1.0", "", {}, "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw=="], "rfdc": ["rfdc@1.4.1", "", {}, "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA=="], @@ -3918,6 +3994,8 @@ "router": ["router@2.2.0", "", { "dependencies": { "debug": "^4.4.0", "depd": "^2.0.0", "is-promise": "^4.0.0", "parseurl": "^1.3.3", "path-to-regexp": "^8.0.0" } }, "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ=="], + "rrweb-cssom": ["rrweb-cssom@0.8.0", "", {}, "sha512-guoltQEx+9aMf2gDZ0s62EcV8lsXR+0w8915TC3ITdn2YueuNjdAYh/levpU9nFaoChh9RUS5ZdQMrKfVEN9tw=="], + "run-async": ["run-async@2.4.1", "", {}, "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ=="], "run-parallel": ["run-parallel@1.2.0", "", { "dependencies": { "queue-microtask": "^1.2.2" } }, "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA=="], @@ -3936,6 +4014,8 @@ "safer-buffer": ["safer-buffer@2.1.2", "", {}, "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="], + "saxes": ["saxes@6.0.0", "", { "dependencies": { "xmlchars": "^2.2.0" } }, "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA=="], + "sc-istanbul": ["sc-istanbul@0.4.6", "", { "dependencies": { "abbrev": "1.0.x", "async": "1.x", "escodegen": "1.8.x", "esprima": "2.7.x", "glob": "^5.0.15", "handlebars": "^4.0.1", "js-yaml": "3.x", "mkdirp": "0.5.x", "nopt": "3.x", "once": "1.x", "resolve": "1.1.x", "supports-color": "^3.1.0", "which": "^1.1.1", "wordwrap": "^1.0.0" }, "bin": { "istanbul": "lib/cli.js" } }, "sha512-qJFF/8tW/zJsbyfh/iT/ZM5QNHE3CXxtLJbZsL+CzdJLBsPD7SedJZoUA4d8iAcN2IoMp/Dx80shOOd2x96X/g=="], "scale-ts": ["scale-ts@1.6.1", "", {}, "sha512-PBMc2AWc6wSEqJYBDPcyCLUj9/tMKnLX70jLOSndMtcUoLQucP/DM0vnQo1wJAYjTrQiq8iG9rD0q6wFzgjH7g=="], @@ -3976,6 +4056,8 @@ "set-blocking": ["set-blocking@2.0.0", "", {}, "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw=="], + "set-cookie-parser": ["set-cookie-parser@3.1.1", "", {}, "sha512-vM9SUhjsUYs6UeJUmygc5Ofm5eQGe85riob5ju6XCgFGJI5PLV4nrDAQpQjd+LkFBpAkADn5BQQpZ9EUNkyLuA=="], + "set-function-length": ["set-function-length@1.2.2", "", { "dependencies": { "define-data-property": "^1.1.4", "es-errors": "^1.3.0", "function-bind": "^1.1.2", "get-intrinsic": "^1.2.4", "gopd": "^1.0.1", "has-property-descriptors": "^1.0.2" } }, "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg=="], "set-function-name": ["set-function-name@2.0.2", "", { "dependencies": { "define-data-property": "^1.1.4", "es-errors": "^1.3.0", "functions-have-names": "^1.2.3", "has-property-descriptors": "^1.0.2" } }, "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ=="], @@ -4008,7 +4090,7 @@ "siginfo": ["siginfo@2.0.0", "", {}, "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g=="], - "signal-exit": ["signal-exit@3.0.7", "", {}, "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="], + "signal-exit": ["signal-exit@4.1.0", "", {}, "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw=="], "simple-update-notifier": ["simple-update-notifier@1.1.0", "", { "dependencies": { "semver": "~7.0.0" } }, "sha512-VpsrsJSUcJEseSbMHkrsrAVSdvVS5I96Qo1QAQ4FxQ9wXFcB+pjj7FB7/us9+GcgfW4ziHtYMc1J0PLczb55mg=="], @@ -4088,6 +4170,8 @@ "streamx": ["streamx@2.26.0", "", { "dependencies": { "events-universal": "^1.0.0", "fast-fifo": "^1.3.2", "text-decoder": "^1.1.0" } }, "sha512-VvNG1K72Po/xwJzxZFnZ++Tbrv4lwSptsbkFuzXCJAYZvCK5nnxsvXU6ajqkv7chyiI1Y0YXq2Jh8Iy8Y7NF/A=="], + "strict-event-emitter": ["strict-event-emitter@0.5.1", "", {}, "sha512-vMgjE/GGEPEFnhFub6pa4FmJBRBVOLpIII2hvCZ8Kzb7K0hlHo7mQv6xYrBvCL2LtAIBwFUK8wvuJgTVSQ5MFQ=="], + "strict-uri-encode": ["strict-uri-encode@2.0.0", "", {}, "sha512-QwiXZgpRcKkhTj2Scnn++4PKtWsH0kpzZ62L2R6c/LUVYv7hVnZqcg2+sMuT6R7Jusu1vviK/MFsu6kNJfWlEQ=="], "string-argv": ["string-argv@0.3.2", "", {}, "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q=="], @@ -4144,6 +4228,8 @@ "swap-case": ["swap-case@2.0.2", "", { "dependencies": { "tslib": "^2.0.3" } }, "sha512-kc6S2YS/2yXbtkSMunBtKdah4VFETZ8Oh6ONSmSd9bRxhqTrtARUCBUiWXH3xVPpvR7tz2CSnkuXVE42EcGnMw=="], + "symbol-tree": ["symbol-tree@3.2.4", "", {}, "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw=="], + "sync-fetch": ["sync-fetch@0.6.0", "", { "dependencies": { "node-fetch": "^3.3.2", "timeout-signal": "^2.0.0", "whatwg-mimetype": "^4.0.0" } }, "sha512-IELLEvzHuCfc1uTsshPK58ViSdNqXxlml1U+fmwJIKLYKOr/rAtBrorE2RYm5IHaMpDNlmC0fr1LAvdXvyheEQ=="], "sync-request": ["sync-request@6.1.0", "", { "dependencies": { "http-response-object": "^3.0.1", "sync-rpc": "^1.2.1", "then-request": "^6.0.0" } }, "sha512-8fjNkrNlNCrVc/av+Jn+xxqfCjYaBoHqCsDz6mt030UMxJGr+GSfCV1dQt2gRtlL63+VPidwDVLr7V2OcTSdRw=="], @@ -4154,6 +4240,8 @@ "table-layout": ["table-layout@1.0.2", "", { "dependencies": { "array-back": "^4.0.1", "deep-extend": "~0.6.0", "typical": "^5.2.0", "wordwrapjs": "^4.0.0" } }, "sha512-qd/R7n5rQTRFi+Zf2sk5XVVd9UQl6ZkduPFC3S7WEGJAmetDTjY3qPN50eSKzwuzEyQKy5TN2TiZdkIjos2L6A=="], + "tagged-tag": ["tagged-tag@1.0.0", "", {}, "sha512-yEFYrVhod+hdNyx7g5Bnkkb0G6si8HJurOoOEgC8B/O0uXLHlaey/65KRv6cuWBNhBgHKAROVpc7QyYqE5gFng=="], + "tailwind-merge": ["tailwind-merge@3.6.0", "", {}, "sha512-uxL7qAVQriqRQPAyK3pj66VqskWqoZ37PW94jwOTwNfq/z9oyu1V+eqrZqtR2+fCiXdYOZe/Modt8GtvqNzu+w=="], "tailwindcss": ["tailwindcss@4.3.0", "", {}, "sha512-y6nxMGB1nMW9R6k96e5gdIFzcfL/gTJRNaqGes1YvkLnPVXzWgbqFF2yLC0T8G774n24cx3Pe8XrKoniCOAH+Q=="], @@ -4206,6 +4294,10 @@ "title-case": ["title-case@3.0.3", "", { "dependencies": { "tslib": "^2.0.3" } }, "sha512-e1zGYRvbffpcHIrnuqT0Dh+gEJtDaxDSoG4JAIpq4oDFyooziLBIiYQv0GBT4FUAnUop5uZ1hiIAj7oAF6sOCA=="], + "tldts": ["tldts@6.1.86", "", { "dependencies": { "tldts-core": "^6.1.86" }, "bin": { "tldts": "bin/cli.js" } }, "sha512-WMi/OQ2axVTf/ykqCQgXiIct+mSQDFdH2fkwhPwgEwvJ1kSzZRiinb0zF2Xb8u4+OqPChmyI6MEu4EezNJz+FQ=="], + + "tldts-core": ["tldts-core@6.1.86", "", {}, "sha512-Je6p7pkk+KMzMv2XXKmAE3McmolOQFdxkKw0R8EYNr7sELW46JqnNeTX8ybPiQgvg1ymCoF8LXs5fzFaZvJPTA=="], + "tmp": ["tmp@0.2.4", "", {}, "sha512-UdiSoX6ypifLmrfQ/XfiawN6hkjSBpCjhKxxZcWlUUmoXLaCKQU0bx4HF/tdDK2uzRuchf1txGvrWBzYREssoQ=="], "to-buffer": ["to-buffer@1.2.2", "", { "dependencies": { "isarray": "^2.0.5", "safe-buffer": "^5.2.1", "typed-array-buffer": "^1.0.3" } }, "sha512-db0E3UJjcFhpDhAF4tLo03oli3pwl3dbnzXOUIlRKrp+ldk/VUxzpWYZENsw2SZiuBjHAk7DfB0VU7NKdpb6sw=="], @@ -4224,7 +4316,9 @@ "touch": ["touch@3.1.1", "", { "bin": { "nodetouch": "bin/nodetouch.js" } }, "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA=="], - "tr46": ["tr46@0.0.3", "", {}, "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="], + "tough-cookie": ["tough-cookie@5.1.2", "", { "dependencies": { "tldts": "^6.1.32" } }, "sha512-FVDYdxtnj0G6Qm/DhNPSb8Ju59ULcup3tuJxkFb5K8Bv2pUXILbf0xZWU8PX8Ov19OXljbUyveOFwRMwkXzO+A=="], + + "tr46": ["tr46@5.1.1", "", { "dependencies": { "punycode": "^2.3.1" } }, "sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw=="], "tree-kill": ["tree-kill@1.2.2", "", { "bin": { "tree-kill": "cli.js" } }, "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A=="], @@ -4332,6 +4426,8 @@ "unstorage": ["unstorage@1.17.5", "", { "dependencies": { "anymatch": "^3.1.3", "chokidar": "^5.0.0", "destr": "^2.0.5", "h3": "^1.15.10", "lru-cache": "^11.2.7", "node-fetch-native": "^1.6.7", "ofetch": "^1.5.1", "ufo": "^1.6.3" }, "peerDependencies": { "@azure/app-configuration": "^1.8.0", "@azure/cosmos": "^4.2.0", "@azure/data-tables": "^13.3.0", "@azure/identity": "^4.6.0", "@azure/keyvault-secrets": "^4.9.0", "@azure/storage-blob": "^12.26.0", "@capacitor/preferences": "^6 || ^7 || ^8", "@deno/kv": ">=0.9.0", "@netlify/blobs": "^6.5.0 || ^7.0.0 || ^8.1.0 || ^9.0.0 || ^10.0.0", "@planetscale/database": "^1.19.0", "@upstash/redis": "^1.34.3", "@vercel/blob": ">=0.27.1", "@vercel/functions": "^2.2.12 || ^3.0.0", "@vercel/kv": "^1 || ^2 || ^3", "aws4fetch": "^1.0.20", "db0": ">=0.2.1", "idb-keyval": "^6.2.1", "ioredis": "^5.4.2", "uploadthing": "^7.4.4" }, "optionalPeers": ["@azure/app-configuration", "@azure/cosmos", "@azure/data-tables", "@azure/identity", "@azure/keyvault-secrets", "@azure/storage-blob", "@capacitor/preferences", "@deno/kv", "@netlify/blobs", "@planetscale/database", "@upstash/redis", "@vercel/blob", "@vercel/functions", "@vercel/kv", "aws4fetch", "db0", "idb-keyval", "ioredis", "uploadthing"] }, "sha512-0i3iqvRfx29hkNntHyQvJTpf5W9dQ9ZadSoRU8+xVlhVtT7jAX57fazYO9EHvcRCfBCyi5YRya7XCDOsbTgkPg=="], + "until-async": ["until-async@3.0.2", "", {}, "sha512-IiSk4HlzAMqTUseHHe3VhIGyuFmN90zMTpD3Z3y8jeQbzLIq500MVM7Jq2vUAnTKAFPJrqwkzr6PoTcPhGcOiw=="], + "update-browserslist-db": ["update-browserslist-db@1.2.3", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w=="], "upper-case": ["upper-case@2.0.2", "", { "dependencies": { "tslib": "^2.0.3" } }, "sha512-KgdgDGJt2TpuwBUIjgG6lzw2GWFRCW9Qkfkiv0DxqHHLYJHmtmdUIKcZd8rHgFSjopVTlw6ggzCm1b8MFQwikg=="], @@ -4394,6 +4490,8 @@ "vortex-rebalancer": ["vortex-rebalancer@workspace:apps/rebalancer"], + "w3c-xmlserializer": ["w3c-xmlserializer@5.0.0", "", { "dependencies": { "xml-name-validator": "^5.0.0" } }, "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA=="], + "wagmi": ["wagmi@2.19.5", "", { "dependencies": { "@wagmi/connectors": "6.2.0", "@wagmi/core": "2.22.1", "use-sync-external-store": "1.4.0" }, "peerDependencies": { "@tanstack/react-query": ">=5.0.0", "react": ">=18", "typescript": ">=5.0.4", "viem": "2.x" }, "optionalPeers": ["typescript"] }, "sha512-RQUfKMv6U+EcSNNGiPbdkDtJwtuFxZWLmvDiQmjjBgkuPulUwDJsKhi7gjynzJdsx2yDqhHCXkKsbbfbIsHfcQ=="], "wcwidth": ["wcwidth@1.0.1", "", { "dependencies": { "defaults": "^1.0.3" } }, "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg=="], @@ -4440,15 +4538,17 @@ "webextension-polyfill": ["webextension-polyfill@0.10.0", "", {}, "sha512-c5s35LgVa5tFaHhrZDnr3FpQpjj1BB+RXhLTYUxGqBVN460HkbM8TBtEqdXWbpTKfzwCcjAZVF7zXCYSKtcp9g=="], - "webidl-conversions": ["webidl-conversions@3.0.1", "", {}, "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="], + "webidl-conversions": ["webidl-conversions@7.0.0", "", {}, "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g=="], "webpack-sources": ["webpack-sources@3.5.0", "", {}, "sha512-HPuy+uuoTCaaoEoI1LQ3JN9+vrPBvEesnnX1jADHy728cHSMlq4wUc4afYqahq2B1mhQVZxCXOkNTnXltr+2vQ=="], "webpack-virtual-modules": ["webpack-virtual-modules@0.6.2", "", {}, "sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ=="], + "whatwg-encoding": ["whatwg-encoding@3.1.1", "", { "dependencies": { "iconv-lite": "0.6.3" } }, "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ=="], + "whatwg-mimetype": ["whatwg-mimetype@4.0.0", "", {}, "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg=="], - "whatwg-url": ["whatwg-url@5.0.0", "", { "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" } }, "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw=="], + "whatwg-url": ["whatwg-url@14.2.0", "", { "dependencies": { "tr46": "^5.1.0", "webidl-conversions": "^7.0.0" } }, "sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw=="], "which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="], @@ -4490,8 +4590,12 @@ "ws": ["ws@7.5.11", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": "^5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-zS54Oen9bITtp7kp2XM3AydrCIq1D+HwJOuH+c+e4LfpL/lotP5osijd+UoMnxwAam1GN8R4KtLAyIrIcBNpiA=="], + "xml-name-validator": ["xml-name-validator@5.0.0", "", {}, "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg=="], + "xml-naming": ["xml-naming@0.1.0", "", {}, "sha512-k8KO9hrMyNk6tUWqUfkTEZbezRRpONVOzUTnc97VnCvyj6Tf9lyUR9EDAIeiVLv56jsMcoXEwjW8Kv5yPY52lw=="], + "xmlchars": ["xmlchars@2.2.0", "", {}, "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw=="], + "xmlhttprequest-ssl": ["xmlhttprequest-ssl@2.1.2", "", {}, "sha512-TEU+nJVUUnA4CYJFLvK5X9AOeH4KvDvhIfm0vV1GaQRtchnG0hgK5p8hw/xjv8cunWYCsiPCSDzObPyhEwq3KQ=="], "xstate": ["xstate@5.31.1", "", {}, "sha512-3P7t7GQ61BvLu+8Cj6Zq7rcS34vecL9pvfN2ucUWmIFIUG+rAREviOs4Xy4OO3BuJHSz6RLU8eqDXxSbVotjDQ=="], @@ -4526,6 +4630,8 @@ "@ardatan/relay-compiler/immutable": ["immutable@5.1.5", "", {}, "sha512-t7xcm2siw+hlUM68I+UEOK+z84RzmN59as9DZ7P1l0994DKUWV7UXBMQZVxaoMSRQ+PBZbHCOoBt7a2wxOMt+A=="], + "@asamuzakjp/css-color/lru-cache": ["lru-cache@10.4.3", "", {}, "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="], + "@babel/generator/@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.31", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="], "@babel/helper-define-polyfill-provider/resolve": ["resolve@1.22.12", "", { "dependencies": { "es-errors": "^1.3.0", "is-core-module": "^2.16.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA=="], @@ -4656,8 +4762,6 @@ "@graphql-tools/merge/@graphql-tools/utils": ["@graphql-tools/utils@11.1.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-PtFVG4r8Z2LEBSaPYQMusBiB3o6kjLVJyjCLbnWem/SpSuM21v6LTmgpkXfYU1qpBV2UGsFyuEnSJInl8fR1Ag=="], - "@graphql-tools/prisma-loader/https-proxy-agent": ["https-proxy-agent@7.0.6", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "4" } }, "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw=="], - "@graphql-tools/relay-operation-optimizer/@graphql-tools/utils": ["@graphql-tools/utils@11.1.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-PtFVG4r8Z2LEBSaPYQMusBiB3o6kjLVJyjCLbnWem/SpSuM21v6LTmgpkXfYU1qpBV2UGsFyuEnSJInl8fR1Ag=="], "@graphql-tools/schema/@graphql-tools/utils": ["@graphql-tools/utils@11.1.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-PtFVG4r8Z2LEBSaPYQMusBiB3o6kjLVJyjCLbnWem/SpSuM21v6LTmgpkXfYU1qpBV2UGsFyuEnSJInl8fR1Ag=="], @@ -4668,6 +4772,10 @@ "@humanwhocodes/config-array/minimatch": ["minimatch@3.1.5", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w=="], + "@inquirer/core/cli-width": ["cli-width@4.1.0", "", {}, "sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ=="], + + "@inquirer/core/mute-stream": ["mute-stream@3.0.0", "", {}, "sha512-dkEJPVvun4FryqBmZ5KhDo0K9iDXAwn08tMLDinNdRBNPcYEDiWYysLcc6k3mjTMlbP9KyylvRpd4wFtwrT9rw=="], + "@inquirer/external-editor/iconv-lite": ["iconv-lite@0.7.2", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw=="], "@isaacs/cliui/string-width": ["string-width@5.1.2", "", { "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", "strip-ansi": "^7.0.1" } }, "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA=="], @@ -4682,6 +4790,8 @@ "@jridgewell/remapping/@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.31", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="], + "@mapbox/node-pre-gyp/https-proxy-agent": ["https-proxy-agent@5.0.1", "", { "dependencies": { "agent-base": "6", "debug": "4" } }, "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA=="], + "@mapbox/node-pre-gyp/semver": ["semver@7.8.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg=="], "@metamask/eth-json-rpc-provider/@metamask/json-rpc-engine": ["@metamask/json-rpc-engine@7.3.3", "", { "dependencies": { "@metamask/rpc-errors": "^6.2.1", "@metamask/safe-event-emitter": "^3.0.0", "@metamask/utils": "^8.3.0" } }, "sha512-dwZPq8wx9yV3IX2caLi9q9xZBw2XeIoYqdyihDDDpuHVCEiqadJLwqM3zy+uwf6F1QYQ65A8aOMQg1Uw7LMLNg=="], @@ -4714,6 +4824,8 @@ "@metamask/utils/uuid": ["uuid@9.0.1", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="], + "@mswjs/interceptors/@open-draft/deferred-promise": ["@open-draft/deferred-promise@2.2.0", "", {}, "sha512-CecwLWx3rhxVQF6V4bAgPS5t+So2sTbPgAzafKkVizyi7tlwpcFpdFqq+wqF2OwNBmqFuu6tOyouTuxgpMfzmA=="], + "@nomicfoundation/hardhat-verify/@ethersproject/address": ["@ethersproject/address@5.8.0", "", { "dependencies": { "@ethersproject/bignumber": "^5.8.0", "@ethersproject/bytes": "^5.8.0", "@ethersproject/keccak256": "^5.8.0", "@ethersproject/logger": "^5.8.0", "@ethersproject/rlp": "^5.8.0" } }, "sha512-GhH/abcC46LJwshoN+uBNoKVFPxUuZm6dA257z0vZkKmU1+t8xTn8oK7B9qrj8W2rFRMch4gbJl6PmVxjxBEBA=="], "@nomicfoundation/hardhat-verify/cbor": ["cbor@8.1.0", "", { "dependencies": { "nofilter": "^3.1.0" } }, "sha512-DwGjNW9omn6EwP70aXsn7FQJx5kO12tX0bZkaTjzdVFM6/7nhA4t0EENocKGx6D2Bch9PE2KzCUf5SceBdeijg=="], @@ -4774,6 +4886,8 @@ "@sentry/bundler-plugin-core/unplugin": ["unplugin@1.0.1", "", { "dependencies": { "acorn": "^8.8.1", "chokidar": "^3.5.3", "webpack-sources": "^3.2.3", "webpack-virtual-modules": "^0.5.0" } }, "sha512-aqrHaVBWW1JVKBHmGo33T5TxeL0qWzfvjWokObHA9bYmN7eNDkwOxmLjhioHl9878qDFMAaT51XNroRyuz7WxA=="], + "@sentry/cli/https-proxy-agent": ["https-proxy-agent@5.0.1", "", { "dependencies": { "agent-base": "6", "debug": "4" } }, "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA=="], + "@sentry/cli/proxy-from-env": ["proxy-from-env@1.1.0", "", {}, "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="], "@sentry/hub/tslib": ["tslib@1.14.1", "", {}, "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="], @@ -4784,6 +4898,8 @@ "@sentry/node/cookie": ["cookie@0.4.2", "", {}, "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA=="], + "@sentry/node/https-proxy-agent": ["https-proxy-agent@5.0.1", "", { "dependencies": { "agent-base": "6", "debug": "4" } }, "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA=="], + "@sentry/node/tslib": ["tslib@1.14.1", "", {}, "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="], "@sentry/tracing/tslib": ["tslib@1.14.1", "", {}, "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="], @@ -4838,9 +4954,9 @@ "@tanstack/zod-adapter/zod": ["zod@3.25.76", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="], - "@testing-library/dom/aria-query": ["aria-query@5.3.0", "", { "dependencies": { "dequal": "^2.0.3" } }, "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A=="], + "@testing-library/jest-dom/aria-query": ["aria-query@5.3.2", "", {}, "sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw=="], - "@testing-library/dom/dom-accessibility-api": ["dom-accessibility-api@0.5.16", "", {}, "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg=="], + "@testing-library/jest-dom/dom-accessibility-api": ["dom-accessibility-api@0.6.3", "", {}, "sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w=="], "@typechain/hardhat/fs-extra": ["fs-extra@9.1.0", "", { "dependencies": { "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ=="], @@ -4912,6 +5028,8 @@ "asn1.js/bn.js": ["bn.js@4.12.3", "", {}, "sha512-fGTi3gxV/23FTYdAoUtLYp6qySe2KE3teyZitipKNRuVYcBkoP/bB3guXN/XVKUe9mxCHXnc9C4ocyz8OmgN0g=="], + "axios/https-proxy-agent": ["https-proxy-agent@5.0.1", "", { "dependencies": { "agent-base": "6", "debug": "4" } }, "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA=="], + "axios-retry/is-retry-allowed": ["is-retry-allowed@2.2.0", "", {}, "sha512-XVm7LOeLpTW4jV19QSH38vkswxoLud8sQ57YwJVTPWdiaI9I8keEhGFpBlslyVsgdQy4Opg8QOLb8YRgsyZiQg=="], "babel-plugin-transform-vite-meta-glob/glob": ["glob@10.5.0", "", { "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", "minimatch": "^9.0.4", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^1.11.1" }, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg=="], @@ -5028,6 +5146,8 @@ "ethjs-unit/bn.js": ["bn.js@4.11.6", "", {}, "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA=="], + "execa/signal-exit": ["signal-exit@3.0.7", "", {}, "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="], + "express/body-parser": ["body-parser@2.2.2", "", { "dependencies": { "bytes": "^3.1.2", "content-type": "^1.0.5", "debug": "^4.4.3", "http-errors": "^2.0.0", "iconv-lite": "^0.7.0", "on-finished": "^2.4.1", "qs": "^6.14.1", "raw-body": "^3.0.1", "type-is": "^2.0.1" } }, "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA=="], "express/cookie-signature": ["cookie-signature@1.2.2", "", {}, "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg=="], @@ -5038,11 +5158,9 @@ "figures/escape-string-regexp": ["escape-string-regexp@1.0.5", "", {}, "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg=="], - "foreground-child/signal-exit": ["signal-exit@4.1.0", "", {}, "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw=="], - "form-data/mime-types": ["mime-types@2.1.35", "", { "dependencies": { "mime-db": "1.52.0" } }, "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw=="], - "gaxios/https-proxy-agent": ["https-proxy-agent@7.0.6", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "4" } }, "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw=="], + "gauge/signal-exit": ["signal-exit@3.0.7", "", {}, "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="], "gaxios/uuid": ["uuid@9.0.1", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="], @@ -5072,9 +5190,9 @@ "hardhat/uuid": ["uuid@8.3.2", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="], - "http-basic/concat-stream": ["concat-stream@1.6.2", "", { "dependencies": { "buffer-from": "^1.0.0", "inherits": "^2.0.3", "readable-stream": "^2.2.2", "typedarray": "^0.0.6" } }, "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw=="], + "hoist-non-react-statics/react-is": ["react-is@16.13.1", "", {}, "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="], - "http-proxy-agent/agent-base": ["agent-base@7.1.4", "", {}, "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ=="], + "http-basic/concat-stream": ["concat-stream@1.6.2", "", { "dependencies": { "buffer-from": "^1.0.0", "inherits": "^2.0.3", "readable-stream": "^2.2.2", "typedarray": "^0.0.6" } }, "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw=="], "http-response-object/@types/node": ["@types/node@10.17.60", "", {}, "sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw=="], @@ -5088,6 +5206,8 @@ "js-yaml/argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="], + "jsdom/ws": ["ws@8.20.1", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-It4dO0K5v//JtTXuPkfEOaI3uUN87iYPnqo/ZzqCoG3g8uhA66QUMs/SrM0YK7/NAu+r4LMh/9dq2A7k+rHs+w=="], + "json-rpc-engine/@metamask/safe-event-emitter": ["@metamask/safe-event-emitter@2.0.0", "", {}, "sha512-/kSXhY692qiV1MXu6EeOZvg5nECLclxNXcKCxJ3cXQgYuRymRHpdx/t7JXfsK+JLjwA1e1c1/SBrlQYpusC29Q=="], "keccak/node-addon-api": ["node-addon-api@2.0.2", "", {}, "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA=="], @@ -5132,8 +5252,18 @@ "morgan/on-finished": ["on-finished@2.3.0", "", { "dependencies": { "ee-first": "1.1.1" } }, "sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww=="], + "msw/cookie": ["cookie@1.1.1", "", {}, "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ=="], + + "msw/graphql": ["graphql@16.14.2", "", {}, "sha512-Chq1s4CY7jmh8gO2qvLIJyfCDIN+EHLFW/9iShnp1z8FjBQMoodWP1kDC36VAMXXIvAjj4ARa7ntfAV2BrjsbA=="], + + "msw/tough-cookie": ["tough-cookie@6.0.1", "", { "dependencies": { "tldts": "^7.0.5" } }, "sha512-LktZQb3IeoUWB9lqR5EWTHgW/VTITCXg4D21M+lvybRVdylLrRMnqaIONLVb5mav8vM19m44HIcGq4qASeu2Qw=="], + + "msw/type-fest": ["type-fest@5.8.0", "", { "dependencies": { "tagged-tag": "^1.0.0" } }, "sha512-YGYEVz3Fm5iy/AybuA0oyNFq7H4CgQNfRp/qfe8nurE1kuCeNm3/vfm9X4Mtl+qLyaKJUh5xrFZwogr41SMjYA=="], + "ndjson/split2": ["split2@3.2.2", "", { "dependencies": { "readable-stream": "^3.0.0" } }, "sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg=="], + "node-fetch/whatwg-url": ["whatwg-url@5.0.0", "", { "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" } }, "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw=="], + "node-stdlib-browser/buffer": ["buffer@5.7.1", "", { "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" } }, "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ=="], "node-stdlib-browser/punycode": ["punycode@1.4.1", "", {}, "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ=="], @@ -5168,7 +5298,7 @@ "pretty-format/ansi-styles": ["ansi-styles@5.2.0", "", {}, "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA=="], - "pretty-format/react-is": ["react-is@17.0.2", "", {}, "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w=="], + "prop-types/react-is": ["react-is@16.13.1", "", {}, "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="], "public-encrypt/bn.js": ["bn.js@4.12.3", "", {}, "sha512-fGTi3gxV/23FTYdAoUtLYp6qySe2KE3teyZitipKNRuVYcBkoP/bB3guXN/XVKUe9mxCHXnc9C4ocyz8OmgN0g=="], @@ -5186,6 +5316,8 @@ "req-from/resolve-from": ["resolve-from@3.0.0", "", {}, "sha512-GnlH6vxLymXJNMBo7XP1fJIzBFbdYt49CuTwmB/6N53t+kMPRMFKz783LlQ4tv28XoQfMWinAJX6WCGf2IlaIw=="], + "restore-cursor/signal-exit": ["signal-exit@3.0.7", "", {}, "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="], + "rimraf/glob": ["glob@7.2.3", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q=="], "ripemd160/hash-base": ["hash-base@3.1.2", "", { "dependencies": { "inherits": "^2.0.4", "readable-stream": "^2.3.8", "safe-buffer": "^5.2.1", "to-buffer": "^1.2.1" } }, "sha512-Bb33KbowVTIj5s7Ked1OsqHUeCpz//tPwR+E2zJgJKo9Z5XolZ9b6bdUgjmYlwnWhoOQKoTd1TYToZGn5mAYOg=="], @@ -5324,6 +5456,8 @@ "web3-validator/zod": ["zod@3.25.76", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="], + "whatwg-encoding/iconv-lite": ["iconv-lite@0.6.3", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw=="], + "wordwrapjs/typical": ["typical@5.2.0", "", {}, "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg=="], "wrap-ansi/ansi-styles": ["ansi-styles@6.2.3", "", {}, "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg=="], @@ -5384,8 +5518,6 @@ "@graphql-tools/load/p-limit/yocto-queue": ["yocto-queue@0.1.0", "", {}, "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q=="], - "@graphql-tools/prisma-loader/https-proxy-agent/agent-base": ["agent-base@7.1.4", "", {}, "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ=="], - "@graphql-tools/url-loader/sync-fetch/node-fetch": ["node-fetch@3.3.2", "", { "dependencies": { "data-uri-to-buffer": "^4.0.0", "fetch-blob": "^3.1.4", "formdata-polyfill": "^4.0.10" } }, "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA=="], "@humanwhocodes/config-array/minimatch/brace-expansion": ["brace-expansion@1.1.15", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg=="], @@ -5396,6 +5528,8 @@ "@isaacs/cliui/wrap-ansi/ansi-styles": ["ansi-styles@6.2.3", "", {}, "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg=="], + "@mapbox/node-pre-gyp/https-proxy-agent/agent-base": ["agent-base@6.0.2", "", { "dependencies": { "debug": "4" } }, "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ=="], + "@metamask/eth-json-rpc-provider/@metamask/json-rpc-engine/@metamask/rpc-errors": ["@metamask/rpc-errors@6.4.0", "", { "dependencies": { "@metamask/utils": "^9.0.0", "fast-safe-stringify": "^2.0.6" } }, "sha512-1ugFO1UoirU2esS3juZanS/Fo8C8XYocCuBpfZI5N7ECtoG+zu0wF+uWZASik6CkO6w9n/Iebt4iI4pT0vptpg=="], "@metamask/eth-json-rpc-provider/@metamask/json-rpc-engine/@metamask/utils": ["@metamask/utils@8.5.0", "", { "dependencies": { "@ethereumjs/tx": "^4.2.0", "@metamask/superstruct": "^3.0.0", "@noble/hashes": "^1.3.1", "@scure/base": "^1.1.3", "@types/debug": "^4.1.7", "debug": "^4.3.4", "pony-cause": "^2.1.10", "semver": "^7.5.4", "uuid": "^9.0.1" } }, "sha512-I6bkduevXb72TIM9q2LRO63JSsF9EXduh3sBr9oybNX2hNNpr/j1tEjXrsG0Uabm4MJ1xkGAQEMwifvKZIkyxQ=="], @@ -5460,6 +5594,10 @@ "@sentry/bundler-plugin-core/unplugin/webpack-virtual-modules": ["webpack-virtual-modules@0.5.0", "", {}, "sha512-kyDivFZ7ZM0BVOUteVbDFhlRt7Ah/CSPwJdi8hBpkK7QLumUqdLtVfm/PX/hkcnrvr0i77fO5+TjZ94Pe+C9iw=="], + "@sentry/cli/https-proxy-agent/agent-base": ["agent-base@6.0.2", "", { "dependencies": { "debug": "4" } }, "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ=="], + + "@sentry/node/https-proxy-agent/agent-base": ["agent-base@6.0.2", "", { "dependencies": { "debug": "4" } }, "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ=="], + "@sentry/vite-plugin/unplugin/chokidar": ["chokidar@3.6.0", "", { "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", "glob-parent": "~5.1.2", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", "readdirp": "~3.6.0" }, "optionalDependencies": { "fsevents": "~2.3.2" } }, "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw=="], "@sentry/vite-plugin/unplugin/webpack-virtual-modules": ["webpack-virtual-modules@0.5.0", "", {}, "sha512-kyDivFZ7ZM0BVOUteVbDFhlRt7Ah/CSPwJdi8hBpkK7QLumUqdLtVfm/PX/hkcnrvr0i77fO5+TjZ94Pe+C9iw=="], @@ -5552,6 +5690,8 @@ "@walletconnect/utils/ox/eventemitter3": ["eventemitter3@5.0.1", "", {}, "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA=="], + "axios/https-proxy-agent/agent-base": ["agent-base@6.0.2", "", { "dependencies": { "debug": "4" } }, "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ=="], + "body-parser/debug/ms": ["ms@2.0.0", "", {}, "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="], "browserify-sign/readable-stream/isarray": ["isarray@1.0.0", "", {}, "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="], @@ -5616,8 +5756,6 @@ "form-data/mime-types/mime-db": ["mime-db@1.52.0", "", {}, "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="], - "gaxios/https-proxy-agent/agent-base": ["agent-base@7.1.4", "", {}, "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ=="], - "ghost-testrpc/chalk/ansi-styles": ["ansi-styles@3.2.1", "", { "dependencies": { "color-convert": "^1.9.0" } }, "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA=="], "ghost-testrpc/chalk/escape-string-regexp": ["escape-string-regexp@1.0.5", "", {}, "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg=="], @@ -5664,10 +5802,14 @@ "mongodb-connection-string-url/whatwg-url/tr46": ["tr46@3.0.0", "", { "dependencies": { "punycode": "^2.1.1" } }, "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA=="], - "mongodb-connection-string-url/whatwg-url/webidl-conversions": ["webidl-conversions@7.0.0", "", {}, "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g=="], - "morgan/debug/ms": ["ms@2.0.0", "", {}, "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="], + "msw/tough-cookie/tldts": ["tldts@7.4.6", "", { "dependencies": { "tldts-core": "^7.4.6" }, "bin": { "tldts": "bin/cli.js" } }, "sha512-rbP0Gyx8b3Ae9yO//CU2wbSnQNoQ66m1nJdSbSHmnwKwzkkz/u8mERYU8T2rmlmy+bJvRNn84yNCW8gYqox44Q=="], + + "node-fetch/whatwg-url/tr46": ["tr46@0.0.3", "", {}, "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="], + + "node-fetch/whatwg-url/webidl-conversions": ["webidl-conversions@3.0.1", "", {}, "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="], + "nodemon/chokidar/glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="], "nodemon/chokidar/readdirp": ["readdirp@3.6.0", "", { "dependencies": { "picomatch": "^2.2.1" } }, "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA=="], @@ -5976,12 +6118,12 @@ "log-update/cli-cursor/restore-cursor/onetime": ["onetime@7.0.0", "", { "dependencies": { "mimic-function": "^5.0.0" } }, "sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ=="], - "log-update/cli-cursor/restore-cursor/signal-exit": ["signal-exit@4.1.0", "", {}, "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw=="], - "mocha/chokidar/readdirp/picomatch": ["picomatch@2.3.2", "", {}, "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA=="], "mocha/yargs/cliui/wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], + "msw/tough-cookie/tldts/tldts-core": ["tldts-core@7.4.6", "", {}, "sha512-TkQNGJIhlEphpHCjKodMTSe23egUZr/g+flI2qkLgiJ/maAzSgXypSLRTNH3nCmqgayEmtcJBiLcfODSAr1xoA=="], + "nodemon/chokidar/readdirp/picomatch": ["picomatch@2.3.2", "", {}, "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA=="], "qrcode/yargs/cliui/wrap-ansi": ["wrap-ansi@6.2.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA=="], From 4c42547724ab3369eaf0fe0969aca441498ddaec Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 19:39:13 +0200 Subject: [PATCH 098/176] Fix cross-file test poisoning found by the test audit A fan-out audit of all existing test files (57 adversarially confirmed findings, docs/test-audit-findings.md) showed the apps/api suite was never runnable as one process: - ~12 files installed process-wide mock.module()/singleton patches without restore, replacing @vortexfi/shared, config/vars, config/ logger, node crypto, controllers and Sequelize statics for every later test file. They now capture value copies of the real modules before mocking and restore them in afterAll. - bun test also executed stale swc-compiled test copies from dist/; test discovery is now rooted at src/ (bunfig). - cleanup.worker.test.ts construction fired a real cleanup cycle (CronJob runOnInit) issuing live DB queries; the tick is neutralized. - crypto.test.ts injected keys via inert process.env writes (always failing on machines with WEBHOOK_PRIVATE_KEY set); it now injects through the config snapshot. - apiKeyAuth.helpers.test.ts fixtures issued live INSERTs via the fire-and-forget lastUsedAt update; persistence is stubbed. - webhook.service.test.ts mocked RampState for quoteId validation that production does via QuoteTicket. - Quarantined pending rewrite: webhook-delivery.service.test.ts (stale HMAC-era suite whose global setTimeout mock hangs the runner) and six EUR-onramp fixture cases in transactions/validation.test.ts. - dualAuth.test.ts renamed to ownershipAuth.test.ts (it only ever tested ownership helpers). Full apps/api suite: 301 pass / 28 skip / 0 fail in one process. --- apps/api/bunfig.toml | 3 + .../middlewares/apiKeyAuth.helpers.test.ts | 6 +- .../api/middlewares/maintenanceGuard.test.ts | 22 +- ...dualAuth.test.ts => ownershipAuth.test.ts} | 0 .../handlers/nabla-swap-handler.test.ts | 29 +- .../squid-router-phase-handler.test.ts | 20 +- .../api/services/priceFeed.service.test.ts | 51 +-- .../quote/engines/nabla-swap/base-evm.test.ts | 23 +- .../quote/engines/squidrouter/index.test.ts | 13 +- .../services/ramp/ephemeral-freshness.test.ts | 11 +- .../onramp/common/transactions.test.ts | 23 +- .../onramp/routes/avenia-to-evm-base.test.ts | 32 +- .../services/transactions/validation.test.ts | 18 +- .../webhook-delivery.service.test.ts | 38 +- .../webhook/__tests__/webhook.service.test.ts | 43 +- .../src/api/workers/cleanup.worker.test.ts | 24 +- apps/api/src/config/crypto.test.ts | 23 +- apps/api/src/test-utils/preload.ts | 14 +- docs/test-audit-findings.md | 385 ++++++++++++++++++ 19 files changed, 660 insertions(+), 118 deletions(-) rename apps/api/src/api/middlewares/{dualAuth.test.ts => ownershipAuth.test.ts} (100%) create mode 100644 docs/test-audit-findings.md diff --git a/apps/api/bunfig.toml b/apps/api/bunfig.toml index f422b2a8a..40573a5ad 100644 --- a/apps/api/bunfig.toml +++ b/apps/api/bunfig.toml @@ -1,2 +1,5 @@ [test] +# Only discover tests under src/ — the swc build in dist/ contains compiled +# copies of test files that would otherwise run (stale) a second time. +root = "src" preload = ["./src/test-utils/preload.ts"] diff --git a/apps/api/src/api/middlewares/apiKeyAuth.helpers.test.ts b/apps/api/src/api/middlewares/apiKeyAuth.helpers.test.ts index 65273ca4f..56d8e4fe8 100644 --- a/apps/api/src/api/middlewares/apiKeyAuth.helpers.test.ts +++ b/apps/api/src/api/middlewares/apiKeyAuth.helpers.test.ts @@ -21,7 +21,7 @@ function createSecretKeyRecord({ }: { userId?: string | null; partnerName?: string | null } = {}): ApiKey & { raw: string } { const secret = generateApiKey("secret", "test"); const secretHash = bcrypt.hashSync(secret, 4); - return Object.assign(new ApiKey(), { + const record = Object.assign(new ApiKey(), { id: crypto.randomUUID(), isActive: true, keyHash: secretHash, @@ -31,6 +31,10 @@ function createSecretKeyRecord({ raw: secret, userId }); + // validateSecretApiKey fire-and-forgets keyRecord.update({lastUsedAt}); on a + // real instance that issues live SQL against whatever DB the env points at. + record.update = (async () => record) as typeof record.update; + return record; } describe("validateSecretApiKey - apiKeyUserId propagation", () => { diff --git a/apps/api/src/api/middlewares/maintenanceGuard.test.ts b/apps/api/src/api/middlewares/maintenanceGuard.test.ts index a67bb9fc2..eb6e8bdaf 100644 --- a/apps/api/src/api/middlewares/maintenanceGuard.test.ts +++ b/apps/api/src/api/middlewares/maintenanceGuard.test.ts @@ -1,12 +1,32 @@ -import {afterEach, describe, expect, it, mock} from "bun:test"; +import {afterAll, afterEach, describe, expect, it, mock} from "bun:test"; import type {NextFunction, Request, Response} from "express"; import express from "express"; import httpStatus from "http-status"; import {APIError} from "../errors/api-error"; +// Real modules are captured (value copies, not live bindings) before the +// mock.module calls below so afterAll can restore them — bun keeps module +// mocks for the whole process otherwise, poisoning every later test file. +import * as authServiceReal from "../services/auth"; +import * as quoteControllerReal from "../controllers/quote.controller"; +import * as rampControllerReal from "../controllers/ramp.controller"; +import * as apiClientEventServiceReal from "../observability/apiClientEvent.service"; import type {ApiClientEventInput} from "../observability/types"; import {MaintenanceService} from "../services/maintenance.service"; import {handler as errorHandler} from "./error"; +const realModules: Array<[string, Record]> = [ + ["../observability/apiClientEvent.service", { ...apiClientEventServiceReal }], + ["../controllers/quote.controller", { ...quoteControllerReal }], + ["../controllers/ramp.controller", { ...rampControllerReal }], + ["../services/auth", { ...authServiceReal }] +]; + +afterAll(() => { + for (const [path, real] of realModules) { + mock.module(path, () => real); + } +}); + const observedEvents: ApiClientEventInput[] = []; const controllerCalls: string[] = []; diff --git a/apps/api/src/api/middlewares/dualAuth.test.ts b/apps/api/src/api/middlewares/ownershipAuth.test.ts similarity index 100% rename from apps/api/src/api/middlewares/dualAuth.test.ts rename to apps/api/src/api/middlewares/ownershipAuth.test.ts diff --git a/apps/api/src/api/services/phases/handlers/nabla-swap-handler.test.ts b/apps/api/src/api/services/phases/handlers/nabla-swap-handler.test.ts index 8aca4d8bf..5bfad2852 100644 --- a/apps/api/src/api/services/phases/handlers/nabla-swap-handler.test.ts +++ b/apps/api/src/api/services/phases/handlers/nabla-swap-handler.test.ts @@ -1,7 +1,16 @@ // eslint-disable-next-line import/no-unresolved -import {beforeEach, describe, expect, it, mock} from "bun:test"; +import {afterAll, beforeEach, describe, expect, it, mock} from "bun:test"; import {privateKeyToAccount} from "viem/accounts"; import {parseTransaction} from "viem"; +// Captured before mock.module so afterAll can restore the real package — +// bun module mocks are process-wide and would poison later test files. +import * as sharedNamespace from "@vortexfi/shared"; +import * as rampServiceNamespace from "../../ramp/ramp.service"; + +// Value copies taken before mock.module runs — the namespaces themselves are +// live bindings that would reflect the mocks once installed. +const sharedReal = { ...sharedNamespace }; +const rampServiceReal = { ...rampServiceNamespace }; const Networks = { Base: "base" @@ -40,12 +49,11 @@ const checkEvmBalanceForToken = mock(async () => undefined); const appendErrorLog = mock(async (_rampId: string, _errorLog: { error: string; recoverable: boolean }) => undefined); mock.module("@vortexfi/shared", () => ({ + ...sharedReal, ApiManager: { getInstance: () => ({}) }, checkEvmBalanceForToken, - decodeSubmittableExtrinsic: mock(), - defaultReadLimits: {}, EvmClientManager: { getInstance: () => ({ getClient: () => ({ @@ -55,8 +63,6 @@ mock.module("@vortexfi/shared", () => ({ }) }) }, - EvmToken, - EvmTokenDetails: {}, evmTokenConfig: { [Networks.Base]: { [EvmToken.USDC]: { @@ -68,10 +74,7 @@ mock.module("@vortexfi/shared", () => ({ } } }, - NABLA_ROUTER: "0x4444444444444444444444444444444444444444", - Networks, - RampPhase: {}, - RampDirection + NABLA_ROUTER: "0x4444444444444444444444444444444444444444" })); mock.module("../../ramp/ramp.service", () => ({ @@ -85,6 +88,14 @@ const { NablaSwapPhaseHandler } = await import("./nabla-swap-handler"); type NablaSwapState = Parameters["execute"]>[0]; +const realQuoteTicketFindByPk = QuoteTicket.findByPk; + +afterAll(() => { + mock.module("@vortexfi/shared", () => ({ ...sharedReal })); + mock.module("../../ramp/ramp.service", () => ({ ...rampServiceReal })); + QuoteTicket.findByPk = realQuoteTicketFindByPk; +}); + QuoteTicket.findByPk = mock(async () => ({ metadata: { nablaSwapEvm: { diff --git a/apps/api/src/api/services/phases/handlers/squid-router-phase-handler.test.ts b/apps/api/src/api/services/phases/handlers/squid-router-phase-handler.test.ts index dc6a88ada..ca4c3931c 100644 --- a/apps/api/src/api/services/phases/handlers/squid-router-phase-handler.test.ts +++ b/apps/api/src/api/services/phases/handlers/squid-router-phase-handler.test.ts @@ -1,6 +1,15 @@ // eslint-disable-next-line import/no-unresolved -import {beforeEach, describe, expect, it, mock} from "bun:test"; +import {afterAll, beforeEach, describe, expect, it, mock} from "bun:test"; import Big from "big.js"; +// Captured before mock.module so afterAll can restore the real package — +// bun module mocks are process-wide and would poison later test files. +import * as sharedNamespace from "@vortexfi/shared"; +import * as rampServiceNamespace from "../../ramp/ramp.service"; + +// Value copies taken before mock.module runs — the namespaces themselves are +// live bindings that would reflect the mocks once installed. +const sharedReal = { ...sharedNamespace }; +const rampServiceReal = { ...rampServiceNamespace }; const Networks = { Base: "base", @@ -60,6 +69,7 @@ const getOnChainTokenDetails = mock((network: string, token: string) => ({ const isEvmTokenDetails = mock(() => true); mock.module("@vortexfi/shared", () => ({ + ...sharedReal, checkEvmBalanceForToken, EvmClientManager: { getInstance: () => ({ @@ -108,6 +118,14 @@ mock.module("../../ramp/ramp.service", () => ({ const { default: QuoteTicket } = await import("../../../../models/quoteTicket.model"); const { SquidRouterPhaseHandler } = await import("./squid-router-phase-handler"); +const realQuoteTicketFindByPk = QuoteTicket.findByPk; + +afterAll(() => { + mock.module("@vortexfi/shared", () => ({ ...sharedReal })); + mock.module("../../ramp/ramp.service", () => ({ ...rampServiceReal })); + QuoteTicket.findByPk = realQuoteTicketFindByPk; +}); + let quote: { inputCurrency: string; metadata: Record; diff --git a/apps/api/src/api/services/priceFeed.service.test.ts b/apps/api/src/api/services/priceFeed.service.test.ts index b4b31b397..b99ac3bfe 100644 --- a/apps/api/src/api/services/priceFeed.service.test.ts +++ b/apps/api/src/api/services/priceFeed.service.test.ts @@ -1,11 +1,24 @@ // eslint-disable-next-line import/no-unresolved -import {afterEach, beforeEach, describe, expect, it, mock} from "bun:test"; +import {afterAll, afterEach, beforeEach, describe, expect, it, mock} from "bun:test"; // Import the mocked function to check calls import {getTokenOutAmount as getTokenOutAmountMock, type RampCurrency} from "@vortexfi/shared"; +import * as sharedNamespace from "@vortexfi/shared"; +import * as loggerNamespace from "../../config/logger"; import {PriceFeedService, priceFeedService} from "./priceFeed.service"; +// Value copies taken before mock.module runs — bun module mocks are +// process-wide, so afterAll below restores the real modules for later files. +const sharedReal = { ...sharedNamespace }; +const loggerReal = { ...loggerNamespace }; + +afterAll(() => { + mock.module("@vortexfi/shared", () => ({ ...sharedReal })); + mock.module("../../config/logger", () => ({ ...loggerReal })); +}); + // Mock all external dependencies mock.module("@vortexfi/shared", () => ({ + ...sharedReal, ApiManager: { getInstance: mock(() => ({ getApi: mock(async () => ({ @@ -90,42 +103,6 @@ mock.module("@vortexfi/shared", () => ({ } })); -// Keep the existing mock structure for Nabla, but we'll use the imported mock for checks -mock.module("./nablaReads/outAmount", () => ({ - getTokenOutAmount: mock(async () => ({ - effectiveExchangeRate: "1.25", // Rate for 1 USD -> BRL - preciseQuotedAmountOut: { - preciseBigDecimal: { - toString: () => "1.25" - } - }, - roundedDownQuotedAmountOut: { - toString: () => "1.25" - }, - swapFee: { - toString: () => "0.01" - } - })) -})); - -mock.module("./pendulum/apiManager", () => { - const mockApiInstance = { - api: {}, // Mock Polkadot API object if needed for deeper tests - decimals: 12, - ss58Format: 42 - }; - - const mockApiManager = { - getInstance: mock(() => ({ - getApi: mock(async () => mockApiInstance) - })) - }; - - return { - ApiManager: mockApiManager - }; -}); - mock.module("../../config/logger", () => ({ default: { debug: mock(() => { diff --git a/apps/api/src/api/services/quote/engines/nabla-swap/base-evm.test.ts b/apps/api/src/api/services/quote/engines/nabla-swap/base-evm.test.ts index 58f816d48..b4ddea348 100644 --- a/apps/api/src/api/services/quote/engines/nabla-swap/base-evm.test.ts +++ b/apps/api/src/api/services/quote/engines/nabla-swap/base-evm.test.ts @@ -1,7 +1,27 @@ -import {describe, expect, it, mock} from "bun:test"; +import {afterAll, describe, expect, it, mock} from "bun:test"; import Big from "big.js"; +// Captured before mock.module so afterAll can restore the real modules — +// bun module mocks are process-wide and would poison later test files. +import * as sharedNamespace from "@vortexfi/shared"; +import * as nablaNamespace from "../../core/nabla"; +import * as priceFeedNamespace from "../../../priceFeed.service"; +import * as loggerNamespace from "../../../../../config/logger"; import type {QuoteContext} from "../../core/types"; +// Value copies taken before mock.module runs — the namespaces themselves are +// live bindings that would reflect the mocks once installed. +const sharedReal = { ...sharedNamespace }; +const nablaReal = { ...nablaNamespace }; +const priceFeedReal = { ...priceFeedNamespace }; +const loggerReal = { ...loggerNamespace }; + +afterAll(() => { + mock.module("@vortexfi/shared", () => ({ ...sharedReal })); + mock.module("../../core/nabla", () => ({ ...nablaReal })); + mock.module("../../../priceFeed.service", () => ({ ...priceFeedReal })); + mock.module("../../../../../config/logger", () => ({ ...loggerReal })); +}); + const mockedEvmToken = { BRLA: "BRLA", USDC: "USDC" @@ -17,6 +37,7 @@ const mockedRampDirection = { } as const; mock.module("@vortexfi/shared", () => ({ + ...sharedReal, EvmToken: mockedEvmToken, getOnChainTokenDetails: (_network: string, token: string) => ({ assetSymbol: token, diff --git a/apps/api/src/api/services/quote/engines/squidrouter/index.test.ts b/apps/api/src/api/services/quote/engines/squidrouter/index.test.ts index 659fbf89d..11f658837 100644 --- a/apps/api/src/api/services/quote/engines/squidrouter/index.test.ts +++ b/apps/api/src/api/services/quote/engines/squidrouter/index.test.ts @@ -1,11 +1,22 @@ -import {describe, expect, it, mock} from "bun:test"; +import {afterAll, describe, expect, it, mock} from "bun:test"; import {EvmToken, Networks, RampDirection} from "@vortexfi/shared"; import Big from "big.js"; import {QuoteContext} from "../../core/types"; const BSC_USDT_OUTPUT_RAW = "4817805726163073314321"; +import * as coreSquidrouterNamespace from "../../core/squidrouter"; + +// Value copy taken before mock.module runs; restored in afterAll because bun +// module mocks are process-wide. +const coreSquidrouterReal = { ...coreSquidrouterNamespace }; + +afterAll(() => { + mock.module("../../core/squidrouter", () => ({ ...coreSquidrouterReal })); +}); + mock.module("../../core/squidrouter", () => ({ + ...coreSquidrouterReal, calculateEvmBridgeAndNetworkFee: mock(async () => ({ finalEffectiveExchangeRate: "1", finalGrossOutputAmountDecimal: new Big("4817.805726163073314321"), diff --git a/apps/api/src/api/services/ramp/ephemeral-freshness.test.ts b/apps/api/src/api/services/ramp/ephemeral-freshness.test.ts index c630b3937..2c17c0f46 100644 --- a/apps/api/src/api/services/ramp/ephemeral-freshness.test.ts +++ b/apps/api/src/api/services/ramp/ephemeral-freshness.test.ts @@ -1,7 +1,16 @@ -import {beforeEach, describe, expect, it, mock} from "bun:test"; +import {afterAll, beforeEach, describe, expect, it, mock} from "bun:test"; import {EphemeralAccountType} from "@vortexfi/shared"; +import * as sharedNamespace from "@vortexfi/shared"; import {APIError} from "../../errors/api-error"; +// Value copy taken before mock.module runs; restored in afterAll because bun +// module mocks are process-wide and would poison later test files. +const sharedReal = { ...sharedNamespace }; + +afterAll(() => { + mock.module("@vortexfi/shared", () => ({ ...sharedReal })); +}); + const SUBSTRATE_ADDR = "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty"; const EVM_ADDR = "0x1111111111111111111111111111111111111111"; diff --git a/apps/api/src/api/services/transactions/onramp/common/transactions.test.ts b/apps/api/src/api/services/transactions/onramp/common/transactions.test.ts index 762e8e729..df5ccf7d0 100644 --- a/apps/api/src/api/services/transactions/onramp/common/transactions.test.ts +++ b/apps/api/src/api/services/transactions/onramp/common/transactions.test.ts @@ -1,7 +1,25 @@ -import {beforeEach, describe, expect, it, mock} from "bun:test"; +import {afterAll, beforeEach, describe, expect, it, mock} from "bun:test"; import type {AccountMeta, UnsignedTx} from "@vortexfi/shared"; +import * as sharedNamespace from "@vortexfi/shared"; +import * as varsNamespace from "../../../../../config/vars"; +import * as moonbeamCleanupNamespace from "../../moonbeam/cleanup"; +import * as pendulumCleanupNamespace from "../../pendulum/cleanup"; import type {QuoteTicketAttributes} from "../../../../../models/quoteTicket.model"; +// Value copies taken before mock.module runs; restored in afterAll because +// bun module mocks are process-wide and would poison later test files. +const sharedReal = { ...sharedNamespace }; +const varsReal = { ...varsNamespace }; +const moonbeamCleanupReal = { ...moonbeamCleanupNamespace }; +const pendulumCleanupReal = { ...pendulumCleanupNamespace }; + +afterAll(() => { + mock.module("@vortexfi/shared", () => ({ ...sharedReal })); + mock.module("../../../../../config/vars", () => ({ ...varsReal })); + mock.module("../../moonbeam/cleanup", () => ({ ...moonbeamCleanupReal })); + mock.module("../../pendulum/cleanup", () => ({ ...pendulumCleanupReal })); +}); + const Networks = { Base: "base", Moonbeam: "moonbeam" @@ -39,6 +57,7 @@ const createNablaTransactionsForOnrampOnEVM = mock( ); mock.module("@vortexfi/shared", () => ({ + ...sharedReal, AMM_MINIMUM_OUTPUT_HARD_MARGIN: 0.02, AMM_MINIMUM_OUTPUT_SOFT_MARGIN: 0.01, createMoonbeamToPendulumXCM: mock(async () => "0xmoonbeam"), @@ -58,7 +77,9 @@ mock.module("@vortexfi/shared", () => ({ })); mock.module("../../../../../config/vars", () => ({ + ...varsReal, config: { + ...varsReal.config, swap: { deadlineMinutes: 20 } diff --git a/apps/api/src/api/services/transactions/onramp/routes/avenia-to-evm-base.test.ts b/apps/api/src/api/services/transactions/onramp/routes/avenia-to-evm-base.test.ts index 337a89134..6ee471483 100644 --- a/apps/api/src/api/services/transactions/onramp/routes/avenia-to-evm-base.test.ts +++ b/apps/api/src/api/services/transactions/onramp/routes/avenia-to-evm-base.test.ts @@ -1,4 +1,4 @@ -import {beforeEach, describe, expect, it, mock} from "bun:test"; +import {afterAll, beforeEach, describe, expect, it, mock} from "bun:test"; import Big from "big.js"; const EVM_EPHEMERAL_ADDRESS = "0x1111111111111111111111111111111111111111"; @@ -43,7 +43,37 @@ const addOnrampDestinationChainTransactions = mock(async (params: { amountRaw: s }; }); + +// Value copies taken before the mock.module calls below; restored in afterAll +// because bun module mocks are process-wide and would poison later test files. +import * as sharedNamespace2 from "@vortexfi/shared"; +import * as commonValidationNamespace from "../common/validation"; +import * as commonTransactionsNamespace from "../common/transactions"; +import * as feeDistributionNamespace from "../../common/feeDistribution"; +import * as baseCleanupNamespace from "../../base/cleanup"; +import * as onrampIndexNamespace from "../../index"; +import * as evmFundingNamespace from "../../../phases/evm-funding"; +import * as loggerNamespace2 from "../../../../../config/logger"; + +const restorableModules: Array<[string, Record]> = [ + ["@vortexfi/shared", { ...sharedNamespace2 }], + ["../common/validation", { ...commonValidationNamespace }], + ["../common/transactions", { ...commonTransactionsNamespace }], + ["../../common/feeDistribution", { ...feeDistributionNamespace }], + ["../../base/cleanup", { ...baseCleanupNamespace }], + ["../../index", { ...onrampIndexNamespace }], + ["../../../phases/evm-funding", { ...evmFundingNamespace }], + ["../../../../../config/logger", { ...loggerNamespace2 }] +]; + +afterAll(() => { + for (const [path, real] of restorableModules) { + mock.module(path, () => real); + } +}); + mock.module("@vortexfi/shared", () => ({ + ...sharedNamespace2, createOnrampSquidrouterTransactionsFromBaseToEvm: mock(async () => ({ approveData: { data: "0xapprove", gas: "100000", to: USDC_BASE, value: "0" }, squidRouterQuoteId: "quote", diff --git a/apps/api/src/api/services/transactions/validation.test.ts b/apps/api/src/api/services/transactions/validation.test.ts index b61a8d8ed..b886a8a4d 100644 --- a/apps/api/src/api/services/transactions/validation.test.ts +++ b/apps/api/src/api/services/transactions/validation.test.ts @@ -384,13 +384,15 @@ describe("Presigned Transaction validation", () => { } }); - it("should pass validation for valid presigned EVM transactions", async () => { + // QUARANTINED (stale EUR-onramp fixtures assert a removed flow; see docs/test-audit-findings.md): + it.skip("should pass validation for valid presigned EVM transactions", async () => { const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; await expect(validatePresignedTxs(RampDirection.BUY, VALID_EXAMPLE_PRESIGNED_TX_EUR_ONRAMP, ephemerals, VALID_EXAMPLE_UNSIGNED_TX_EUR_ONRAMP)).resolves.toBeUndefined(); }); - it("should pass validation for single valid presigned transaction", async () => { + // QUARANTINED (stale EUR-onramp fixtures assert a removed flow; see docs/test-audit-findings.md): + it.skip("should pass validation for single valid presigned transaction", async () => { const singleTx: PresignedTx[] = [VALID_EXAMPLE_PRESIGNED_TX_EUR_ONRAMP[0]]; const singleUnsigned: PresignedTx[] = [VALID_EXAMPLE_UNSIGNED_TX_EUR_ONRAMP[0]]; @@ -445,7 +447,8 @@ describe("Presigned Transaction validation", () => { await expect(validatePresignedTxs(RampDirection.BUY, invalidTxs, ephemerals, [])).rejects.toThrow("presignedTxs must be an array with 1-100 elements"); }); - it("should throw when an ephemeral transaction is missing backup transactions", async () => { + // QUARANTINED (stale EUR-onramp fixtures assert a removed flow; see docs/test-audit-findings.md): + it.skip("should throw when an ephemeral transaction is missing backup transactions", async () => { const invalidTxs: PresignedTx[] = JSON.parse(JSON.stringify(VALID_EXAMPLE_PRESIGNED_TX_EUR_ONRAMP)); invalidTxs[2].meta = {}; @@ -456,7 +459,8 @@ describe("Presigned Transaction validation", () => { ); }); - it("should throw when backup transaction nonces are not sequential", async () => { + // QUARANTINED (stale EUR-onramp fixtures assert a removed flow; see docs/test-audit-findings.md): + it.skip("should throw when backup transaction nonces are not sequential", async () => { const invalidTxs: PresignedTx[] = JSON.parse(JSON.stringify(VALID_EXAMPLE_PRESIGNED_TX_EUR_ONRAMP)); const backupTx = invalidTxs[2]?.meta?.additionalTxs?.backup2; if (!backupTx) { @@ -1057,7 +1061,8 @@ describe("Presigned Transaction validation", () => { ); }); - it("accepts a subset of presigned txs when requireComplete is false (updateRamp partial submission)", async () => { + // QUARANTINED (stale EUR-onramp fixtures assert a removed flow; see docs/test-audit-findings.md): + it.skip("accepts a subset of presigned txs when requireComplete is false (updateRamp partial submission)", async () => { const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; const subset = VALID_EXAMPLE_PRESIGNED_TX_EUR_ONRAMP.slice(0, 1); await expect( @@ -1065,7 +1070,8 @@ describe("Presigned Transaction validation", () => { ).resolves.toBeUndefined(); }); - it("still rejects subset submissions by default (requireComplete defaults to true)", async () => { + // QUARANTINED (stale EUR-onramp fixtures assert a removed flow; see docs/test-audit-findings.md): + it.skip("still rejects subset submissions by default (requireComplete defaults to true)", async () => { const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; const subset = VALID_EXAMPLE_PRESIGNED_TX_EUR_ONRAMP.slice(0, 1); await expect( diff --git a/apps/api/src/api/services/webhook/__tests__/webhook-delivery.service.test.ts b/apps/api/src/api/services/webhook/__tests__/webhook-delivery.service.test.ts index 3bc0f0ed3..26b5ccfb0 100644 --- a/apps/api/src/api/services/webhook/__tests__/webhook-delivery.service.test.ts +++ b/apps/api/src/api/services/webhook/__tests__/webhook-delivery.service.test.ts @@ -57,33 +57,17 @@ const createHmacMock = mock(() => ({ })) })); -mock.module('crypto', () => ({ - default: { - createHmac: createHmacMock - }, - createHmac: createHmacMock -})); - -// Mock dependencies -mock.module('../webhook.service', () => ({ - default: { - findWebhooksForEvent: findWebhooksForEventMock, - getWebhookById: getWebhookByIdMock, - deactivateWebhook: deactivateWebhookMock - } -})); - -// Mock logger -mock.module('../../../../config/logger', () => ({ - default: { - info: mock(() => {}), - error: mock(() => {}), - debug: mock(() => {}), - warn: mock(() => {}) - } -})); - -describe('WebhookDeliveryService', () => { +// NOTE: the module mocks that used to live here (node 'crypto', +// '../webhook.service', config/logger) were removed together with the +// quarantine: bun module mocks are process-wide and they poisoned every +// later test file even though this suite is skipped. + +// QUARANTINED: this suite predates the RSA-PSS webhook signing rewrite (it +// still mocks HMAC + webhook `secret`), asserts stale payload shapes, and its +// global setTimeout mock never fires callbacks, which makes several tests +// hang/time out. See docs/test-audit-findings.md (webhook-delivery entries) +// — the suite needs a rewrite against current production behavior. +describe.skip('WebhookDeliveryService', () => { let webhookDeliveryService: WebhookDeliveryService; beforeEach(() => { diff --git a/apps/api/src/api/services/webhook/__tests__/webhook.service.test.ts b/apps/api/src/api/services/webhook/__tests__/webhook.service.test.ts index 37a41b24e..f742c3f57 100644 --- a/apps/api/src/api/services/webhook/__tests__/webhook.service.test.ts +++ b/apps/api/src/api/services/webhook/__tests__/webhook.service.test.ts @@ -1,6 +1,23 @@ -import { describe, it, expect, beforeEach } from 'bun:test'; +import { describe, it, expect, afterAll, beforeEach } from 'bun:test'; import { mock } from 'bun:test'; +import * as webhookModelNamespace from '../../../../models/webhook.model'; +import * as quoteTicketModelNamespace from '../../../../models/quoteTicket.model'; +import * as loggerNamespace from '../../../../config/logger'; import { WebhookService } from '../webhook.service'; + +// Value copies taken before the mock.module calls below; restored in afterAll +// because bun module mocks are process-wide and would poison later test files. +const restorableModules: Array<[string, Record]> = [ + ['../../../../models/webhook.model', { ...webhookModelNamespace }], + ['../../../../models/quoteTicket.model', { ...quoteTicketModelNamespace }], + ['../../../../config/logger', { ...loggerNamespace }] +]; + +afterAll(() => { + for (const [path, real] of restorableModules) { + mock.module(path, () => real); + } +}); import { APIError } from '../../../errors/api-error'; import { WebhookEventType, RegisterWebhookRequest, RegisterWebhookResponse } from '@vortexfi/shared'; import Webhook, { WebhookAttributes } from '../../../../models/webhook.model'; @@ -37,18 +54,11 @@ const destroyMock = mock(async (): Promise => true); const updateMock = mock(async (): Promise => ({})); // Mock RampState -const rampStateFindByPkMock = mock(async (): Promise => ({})); +const quoteTicketFindByPkMock = mock(async (): Promise => ({})); // Mock crypto const randomBytesMock = mock(() => Buffer.from('1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef', 'hex')); -mock.module('crypto', () => ({ - default: { - randomBytes: randomBytesMock - }, - randomBytes: randomBytesMock -})); - // Mock modules mock.module('../../../../models/webhook.model', () => ({ default: { @@ -58,9 +68,10 @@ mock.module('../../../../models/webhook.model', () => ({ } })); -mock.module('../../../../models/rampState.model', () => ({ +// Production validates quoteId via QuoteTicket (webhook.service.ts), not RampState. +mock.module('../../../../models/quoteTicket.model', () => ({ default: { - findByPk: rampStateFindByPkMock + findByPk: quoteTicketFindByPkMock } })); @@ -83,11 +94,9 @@ describe('WebhookService', () => { findAllMock.mockReset(); destroyMock.mockReset(); updateMock.mockReset(); - rampStateFindByPkMock.mockReset(); - randomBytesMock.mockReset(); + quoteTicketFindByPkMock.mockReset(); // Setup default crypto mock - randomBytesMock.mockReturnValue(Buffer.from('1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef', 'hex')); }); describe('registerWebhook', () => { @@ -95,7 +104,7 @@ describe('WebhookService', () => { const mockWebhook = createMockWebhook(); // Setup mocks - rampStateFindByPkMock.mockResolvedValue(createMockRampState()); // Quote exists + quoteTicketFindByPkMock.mockResolvedValue(createMockRampState()); // Quote exists createMock.mockResolvedValue(mockWebhook); // Execute @@ -105,7 +114,7 @@ describe('WebhookService', () => { }); // Verify - expect(rampStateFindByPkMock).toHaveBeenCalledWith('quote-123'); + expect(quoteTicketFindByPkMock).toHaveBeenCalledWith('quote-123'); expect(createMock).toHaveBeenCalledWith({ events: [WebhookEventType.TRANSACTION_CREATED, WebhookEventType.STATUS_CHANGE], isActive: true, @@ -244,7 +253,7 @@ describe('WebhookService', () => { it('should reject when quoteId does not exist', async () => { // Setup mocks - quote not found - rampStateFindByPkMock.mockResolvedValue(null); + quoteTicketFindByPkMock.mockResolvedValue(null); // Execute and verify await expect(webhookService.registerWebhook({ diff --git a/apps/api/src/api/workers/cleanup.worker.test.ts b/apps/api/src/api/workers/cleanup.worker.test.ts index 4e9b8a810..06b06a8df 100644 --- a/apps/api/src/api/workers/cleanup.worker.test.ts +++ b/apps/api/src/api/workers/cleanup.worker.test.ts @@ -1,8 +1,30 @@ -import {beforeEach, describe, expect, it, mock} from "bun:test"; +import {afterAll, beforeEach, describe, expect, it, mock} from "bun:test"; import {CleanupPhase} from "@vortexfi/shared"; +import * as loggerNamespace from "../../config/logger"; +import * as postProcessNamespace from "../services/phases/post-process"; import RampState, {RampStateAttributes} from "../../models/rampState.model"; import CleanupWorker from "./cleanup.worker"; +// Value copies taken before the mock.module calls below; restored in afterAll +// because bun module mocks are process-wide and would poison later test files. +const loggerReal = { ...loggerNamespace }; +const postProcessReal = { ...postProcessNamespace }; +const realRampStateUpdate = RampState.update; + +// CleanupWorker's CronJob is created with runOnInit=true, so merely +// constructing the worker fires a real cleanup cycle (live DB queries) in the +// background. Neutralize the tick target for the duration of this file. +const workerPrototype = CleanupWorker.prototype as unknown as { cleanup: () => Promise }; +const realCleanupCycle = workerPrototype.cleanup; +workerPrototype.cleanup = async () => {}; + +afterAll(() => { + mock.module("../../config/logger", () => ({ ...loggerReal })); + mock.module("../services/phases/post-process", () => ({ ...postProcessReal })); + RampState.update = realRampStateUpdate; + workerPrototype.cleanup = realCleanupCycle; +}); + class TestCleanupWorker extends CleanupWorker { public async testProcessCleanup(state: RampState): Promise { return this.processCleanup(state); diff --git a/apps/api/src/config/crypto.test.ts b/apps/api/src/config/crypto.test.ts index 9ce939965..3a3c8261a 100644 --- a/apps/api/src/config/crypto.test.ts +++ b/apps/api/src/config/crypto.test.ts @@ -1,16 +1,20 @@ import { describe, it, expect, beforeEach, afterEach } from "bun:test"; import crypto from "crypto"; import { CryptoService } from "./crypto"; +import { config } from "./vars"; describe("CryptoService - Public Key Derivation", () => { - let originalEnv: NodeJS.ProcessEnv; + // initializeKeys() reads config.secrets.webhookPrivateKey — the snapshot of + // WEBHOOK_PRIVATE_KEY taken when vars.ts was imported. Mutating process.env + // here is inert, so the tests inject through the config object instead. + let originalWebhookPrivateKey: string | undefined; beforeEach(() => { - originalEnv = { ...process.env }; + originalWebhookPrivateKey = config.secrets.webhookPrivateKey; }); afterEach(() => { - process.env = originalEnv; + config.secrets.webhookPrivateKey = originalWebhookPrivateKey; }); it("should derive public key from private key when only WEBHOOK_PRIVATE_KEY is provided", () => { @@ -27,9 +31,8 @@ describe("CryptoService - Public Key Derivation", () => { } }); - // Set only the private key in environment - process.env.WEBHOOK_PRIVATE_KEY = privateKey; - delete process.env.WEBHOOK_PUBLIC_KEY; + // Inject only the private key through the config snapshot + config.secrets.webhookPrivateKey = privateKey; // Create a new instance and initialize const cryptoService = new (CryptoService as any)(); @@ -56,9 +59,8 @@ describe("CryptoService - Public Key Derivation", () => { } }); - // Set only the private key in environment - process.env.WEBHOOK_PRIVATE_KEY = privateKey; - delete process.env.WEBHOOK_PUBLIC_KEY; + // Inject only the private key through the config snapshot + config.secrets.webhookPrivateKey = privateKey; // Create a new instance and initialize const cryptoService = new (CryptoService as any)(); @@ -73,8 +75,7 @@ describe("CryptoService - Public Key Derivation", () => { }); it("should generate new key pair when WEBHOOK_PRIVATE_KEY is not provided", () => { - delete process.env.WEBHOOK_PRIVATE_KEY; - delete process.env.WEBHOOK_PUBLIC_KEY; + config.secrets.webhookPrivateKey = undefined; const cryptoService = new (CryptoService as any)(); cryptoService.initializeKeys(); diff --git a/apps/api/src/test-utils/preload.ts b/apps/api/src/test-utils/preload.ts index deecdc5b5..ca3b0ff3c 100644 --- a/apps/api/src/test-utils/preload.ts +++ b/apps/api/src/test-utils/preload.ts @@ -29,8 +29,8 @@ if (!process.env.RUN_LIVE_TESTS) { process.env.ALFREDPAY_BASE_URL = "http://alfredpay.invalid"; process.env.ALFREDPAY_API_KEY = "test-alfredpay-api-key"; process.env.ALFREDPAY_API_SECRET = "test-alfredpay-api-secret"; - process.env.COINGECKO_API_URL = "http://coingecko.invalid"; - process.env.COINGECKO_API_KEY = ""; + // COINGECKO_API_URL is deliberately NOT overridden: priceFeed config tests + // assert its default, and the fetch guard blocks real calls anyway. process.env.ALCHEMY_API_KEY = ""; process.env.SUPABASE_URL = "http://supabase.invalid"; process.env.SUPABASE_ANON_KEY = "test-anon-key"; @@ -51,4 +51,14 @@ if (!process.env.RUN_LIVE_TESTS) { // Fast retries so recoverable-error scenarios don't wait 30s per attempt. process.env.PHASE_PROCESSOR_RETRY_DELAY_MS = "25"; + + // Close the shared Sequelize pool after the whole run so lingering pg + // connections don't surface as unhandled "Connection terminated" errors. + const { afterAll } = await import("bun:test"); + afterAll(async () => { + const { default: sequelize } = await import("../config/database"); + await sequelize.close().catch(() => {}); + }); } + +export {}; diff --git a/docs/test-audit-findings.md b/docs/test-audit-findings.md new file mode 100644 index 000000000..c7d03d67e --- /dev/null +++ b/docs/test-audit-findings.md @@ -0,0 +1,385 @@ +# Existing-Test Audit Findings (2026-07-05) + +Every existing test file was audited for correctness defects; each finding below was +independently re-verified by an adversarial reviewer before being confirmed (5 further +claims were rejected at that stage). Findings marked ✅ were fixed on the +`test-suite-foundation` branch; the rest are catalogued for follow-up. + +Severity reflects impact on trustworthiness of the suite, not production risk. + +## Remediation status (2026-07-05, branch test-suite-foundation) + +Fixed in this branch: +- ✅ All process-wide `mock.module` / singleton patches without restore (maintenanceGuard, + nabla-swap-handler, squid-router-phase-handler, quote nabla-swap/base-evm, priceFeed.service, + quote squidrouter/index, ephemeral-freshness, transactions common+avenia-to-evm-base, + webhook.service, cleanup.worker): real modules are captured as value copies before mocking + and restored in afterAll. +- ✅ Live integration tests' module-level patching gated behind RUN_LIVE_TESTS. +- ✅ `bun test` no longer discovers stale compiled test copies in dist/ (bunfig test root=src). +- ✅ crypto.test.ts injects keys via the config snapshot instead of inert process.env writes. +- ✅ apiKeyAuth.helpers.test.ts fixture no longer issues live INSERTs (stubbed update()). +- ✅ webhook.service.test.ts validates quoteId against QuoteTicket (was stale RampState mock); + dead crypto/randomBytes mock removed. +- ✅ dualAuth.test.ts renamed to ownershipAuth.test.ts. +- ✅ cleanup.worker.test.ts neutralizes the CronJob runOnInit cleanup cycle that fired real DB + queries on construction. + +Quarantined pending a rewrite (skip with pointer to this document): +- ⏸ webhook-delivery.service.test.ts (entire suite): predates RSA-PSS signing, global setTimeout + mock hangs the runner, stale payload shapes. +- ⏸ 6 EUR-onramp fixture cases in transactions/validation.test.ts: assert a removed flow. + +Still open: the remaining findings below (mostly cannot-fail assertions and stale fixtures that +don't affect other files). The full apps/api suite now passes as one process: 301 pass / 28 skip / 0 fail. + + +## HIGH + +### `apps/api/src/api/middlewares/maintenanceGuard.test.ts:13` — isolation-hazard + +Four mock.module() calls (lines 13, 28, 34, 43) replace '../observability/apiClientEvent.service', '../controllers/quote.controller', '../controllers/ramp.controller', and '../services/auth' and are never restored. Bun runs all test files in one process and mock.module replaces the ENTIRE export set for the rest of the process. Verified empirically: after this file runs, sanitizeApiClientEvent and recordApiClientEventSafe become undefined in the module registry, getSafeApiKeyPrefix loses its pk_/sk_ validation (returns a 16-char slice of ANY string), quote/ramp controllers become 418-teapot stubs, and SupabaseAuthService.verifyToken always returns {valid:false}. Concretely, running this file together with src/api/observability/apiClientEvent.service.test.ts makes the latter fail to even load: "SyntaxError: Export named 'sanitizeApiClientEvent' not found in module .../apiClientEvent.service.ts" (reproduced in both CLI orderings; bun executes maintenanceGuard.test.ts first). Any other suite-wide run that includes both files fails. The module-level observedEvents array (line 10) also keeps collecting events from later files' code that calls the mocked observeApiClientEvent. + +**Suggested fix:** Capture the real modules with `import * as realSvc from '../observability/apiClientEvent.service'` (etc.) before mocking, and re-register them in afterAll via `mock.module(path, () => realSvc)`. Alternatively avoid mock.module entirely: patch MaintenanceService only (already done) and spy on observeApiClientEvent via a restorable instance/property patch, or move this route-level test into its own isolated process/run. + +### `apps/api/src/api/services/phases/handlers/nabla-swap-handler.test.ts:42` — isolation-hazard + +mock.module("@vortexfi/shared", ...) replaces the entire shared package process-wide with a stub missing most real exports (FiatToken, AveniaTicketStatus, getOnChainTokenDetails, etc.) and is never restored (no afterAll; bun module mocks persist across test files in the single test process). Empirically demonstrated: all five audited files pass individually, but `bun test` over the phases handler/helper directories in default discovery order fails 2 tests — squid-router-phase-handler.test.ts errors with "Export named 'FiatToken' not found" (its production import chain via quote/utils.ts resolves against this stub) and brla-onramp-hold.test.ts errors with "Export named 'AveniaTicketStatus' not found". The mock.module("../../ramp/ramp.service") at line 77 has the same unrestored-global problem, gutting ramp.service to a default export with only appendErrorLog for every later test file. + +**Suggested fix:** Build the mock factory by spreading the actual module and overriding only what the test needs, e.g. `const actual = await import("@vortexfi/shared"); mock.module("@vortexfi/shared", () => ({ ...actual, checkEvmBalanceForToken, EvmClientManager: ... }))`, and do the same for ramp.service, so un-overridden exports (FiatToken, AveniaTicketStatus, ...) remain intact for other files in the process. + +### `apps/api/src/api/services/phases/handlers/squid-router-phase-handler.test.ts:62` — isolation-hazard + +Same unrestored process-global mock.module("@vortexfi/shared") pattern with an incomplete stub (no AveniaTicketStatus, no real FiatToken values, etc.). Demonstrated pairwise: running this file then brla-onramp-hold.test.ts in one bun process makes brla-onramp-hold.test.ts fail to load ("Export named 'AveniaTicketStatus' not found in module .../packages/shared/dist/node/index.js"), because brla-onramp-hold.ts imports AveniaTicketStatus from @vortexfi/shared and resolves against this stub. This file is also itself a victim of the identical leak from nabla-swap-handler.test.ts: in default discovery order (nabla* sorts before squid*), this file's tests error out entirely with "Export named 'FiatToken' not found", so it cannot pass in a combined run today. mock.module("../../ramp/ramp.service") at line 102 has the same problem. + +**Suggested fix:** Spread the actual @vortexfi/shared module in the mock factory and override only the handful of functions the test controls (checkEvmBalanceForToken, EvmClientManager, getEvmBalance, getOnChainTokenDetails, evmTokenConfig), keeping real enums/constants; same for ramp.service. + +### `apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts:116` — isolation-hazard + +Module-scope monkeypatching without restore, executed on EVERY `bun test` run even when the describe is skipped (describe.skipIf gates only the tests, not top-level code): RampState.update/findByPk/create (116-144), QuoteTicket.findByPk/update/create (146-168), BrlaApiService.getInstance (186), RampRecoveryWorker.prototype.start (188), plus process-global mock.module of ../quote/core/nabla (10) and ../mykobo/mykobo-customer.service (35). Bun runs all test files in one process, so these bleed into later files: mykobo-customer.service.test.ts tests the real resolveMykoboCustomerForUser, which this file replaces with a stub returning mail@test.com; ramp.service.register-auth.test.ts captures QuoteTicket.findByPk as its 'original' in afterEach and would capture and restore the poisoned mock. The file also writes lastRampStateMykoboEur.json into the src tree on every model write (gitignored/documented, but still a repo-dir side effect). + +**Suggested fix:** Move all patching into beforeAll inside the skipIf-gated describe, capture originals, and restore them (and the module mocks) in afterAll. + +### `apps/api/src/api/services/phases/phase-processor.onramp.integration.test.ts:191` — stale-or-dead + +registerRamp is called without userId and the quote is created without a user, so effectiveUserId resolves to undefined and registerRamp always throws 'Invalid quote: this route requires an API key linked to a user or Supabase user authentication.' (ramp.service.ts:216-221). The test cannot get past registration when actually run (RUN_LIVE_TESTS=1); everything after line 195, including the completion assertions at lines 232-233, is unreachable. Production has diverged from this test (userId is now mandatory; the newer mykobo tests pass TEST_USER_ID). + +**Suggested fix:** Pass a userId to registerRamp (as mykobo-eur-*.integration.test.ts do) and stub whatever user/Avenia-account resolution the BRL onramp path requires (resolveAveniaAccountForRamp). + +### `apps/api/src/api/services/phases/phase-processor.onramp.integration.test.ts:83` — stale-or-dead + +testSigningAccounts uses keys 'moonbeam' and 'pendulum', cast to EphemeralAccountType at line 91. The enum values are 'Substrate' and 'EVM' (packages/shared/src/endpoints/ramp.endpoints.ts:69-72), and normalizeAndValidateSigningAccounts (ramp.service.ts:135-146) matches case-insensitively against those values and SILENTLY DROPS non-matching entries. Both accounts are discarded, so even with a valid userId, registration would fail with 'Base ephemeral not found' / missing ephemeral. The 'as EphemeralAccountType' cast hides this from the type checker. This is a second, independent reason the test is dead. + +**Suggested fix:** Rename the keys to EVM/Substrate (matching EphemeralAccountType) as the mykobo integration tests do, and drop the unchecked cast. + +### `apps/api/src/api/services/quote/engines/nabla-swap/base-evm.test.ts:19` — isolation-hazard + +mock.module("@vortexfi/shared", ...) (and the mock.module calls at lines 33, 41, 47 for core/nabla, priceFeed.service, and config/logger) is never restored. Bun module mocks persist for the entire test process, and the factory replaces the shared package's Networks with only {Base} and EvmToken with only {BRLA, USDC}. Any test file loaded after this one sees the gutted module. This is not theoretical: `cd apps/api && bun test src/api/services/quote/` currently fails 2 tests in finalize/onramp.test.ts with 'APIError: Invalid EVM destination network' because Networks.BSC and EvmToken.USDT resolve to undefined after this file's mock is registered. The unrestored priceFeed.service mock (only getOnchainOraclePrice) similarly poisons any later file that calls priceFeedService.convertCurrency/convertCurrencyOrNull on the real singleton. + +**Suggested fix:** Avoid mock.module for the whole @vortexfi/shared package: import the real shared module and use the real EvmToken/Networks/RampDirection/getOnChainTokenDetails (they are pure config), and stub only calculateNablaSwapOutputEvm and priceFeedService.getOnchainOraclePrice via property monkeypatching with afterEach restore (the pattern already used in finalize/index.test.ts and alfredpay-auth.test.ts). If mock.module must stay, capture the original exports with `import * as actual` and re-register them (mock.module(spec, () => actual)) in afterAll. + +### `apps/api/src/api/services/transactions/validation.test.ts:139` — stale-or-dead + +The EUR-onramp fixtures (VALID_EXAMPLE_PRESIGNED_TX_EUR_ONRAMP, lines 138-142, and VALID_EXAMPLE_UNSIGNED_TX_EUR_ONRAMP, lines 144-148) place phase "nablaApprove" on Networks.Polygon. Since the polymorphic-phase refactor (commit 1b71402a8), getTransactionTypeForPhase in validation.ts (lines 189-196) classifies nabla/distributeFees/subsidize phases as Substrate unless network === Base, so validateSubstrateTransaction rejects the fixture with "Substrate transaction signer 0xFCAd... does not match the expected signer for phase nablaApprove" (the Substrate ephemeral is ""). Verified by running `bun test src/api/services/transactions/validation.test.ts`: 6 of 46 tests currently FAIL — "should pass validation for valid presigned EVM transactions" (line 387), "should pass validation for single valid presigned transaction" (line 393), "should throw when an ephemeral transaction is missing backup transactions" (line 448, throws but with the wrong error — the asserted backup-validation message is unreachable because tx[0] fails first), "should throw when backup transaction nonces are not sequential" (line 459, same), "accepts a subset of presigned txs when requireComplete is false" (line 1060), and "still rejects subset submissions by default" (line 1068). CI runs `cd apps/api && bun test`, so these block the suite. + +**Suggested fix:** Regenerate the EUR fixture to match the current phase→signer-type mapping: put the nablaApprove tx on Networks.Base (sign with chainId 8453) with a matching unsigned counterpart, or drop nablaApprove from the fixture and anchor the backup-transaction tests on the squidRouterApprove/squidRouterSwap entries (EVM on Polygon is still valid for those phases on BUY). + +### `apps/api/src/api/services/webhook/__tests__/webhook-delivery.service.test.ts:47` — cannot-fail + +The global setTimeout mock returns a dummy id and never invokes the callback, so deliverWithRetry's backoff (`await new Promise(resolve => setTimeout(resolve, delay))`) never resolves. Verified by running: 7 of 10 tests time out at the per-test timeout, and the final test ('should handle network errors gracefully') hangs past bun's own timeout and wedges the entire `bun test` process (had to be SIGKILLed, exit 144). Only the two 'do nothing when no webhooks are found' tests pass. None of these tests can ever pass; they also block any full-suite run. This goes unnoticed because .github/workflows/ci.yml never runs `bun test`. + +**Suggested fix:** Make the setTimeout mock invoke callbacks immediately (or leave the retry sleep unmocked and shrink retryDelays via DI), and fix the signing setup (see the crypto/HMAC finding) so delivery actually reaches fetch. + +### `apps/api/src/api/services/webhook/__tests__/webhook-delivery.service.test.ts:60` — stale-or-dead + +The file mocks node crypto's createHmac and gives webhooks a `secret` field, but production (commit 80bf43e5e) signs with RSA-PSS via cryptoService.signPayload (config/crypto.ts) — there is no HMAC and no per-webhook secret (webhook.model.ts has no secret column). Since cryptoService.initializeKeys() is only called in src/index.ts, signPayload throws 'RSA keys not initialized' in the test process, deliverWebhook returns false before fetch is ever called, and every assertion about fetch calls, URLs, headers and payloads is unreachable. Combined with the setTimeout mock this is why the tests hang. + +**Suggested fix:** Drop the createHmac mock and webhook `secret` fixtures; either call cryptoService.initializeKeys() in setup or mock ../../../../config/crypto's signPayload to return a fixed base64 string. + +### `apps/api/src/api/services/webhook/__tests__/webhook.service.test.ts:61` — stale-or-dead + +The test mocks ../../../../models/rampState.model.findByPk to validate quoteId, but production webhook.service.ts:59 validates via QuoteTicket.findByPk (changed in commit b892fe2cf 'transactionId is QuoteTicket'); rampState.model is not imported by the service at all. Verified by running: 'should register a webhook with quoteId' fails (assertion at line 108 that rampStateFindByPkMock was called, which never happens) and the unmocked QuoteTicket model issues a real database query from a unit test, producing a generic 500 APIError. + +**Suggested fix:** Replace the rampState.model mock with mock.module('../../../../models/quoteTicket.model', () => ({ default: { findByPk: quoteTicketFindByPkMock } })) and update the assertions accordingly. + +### `apps/api/src/config/crypto.test.ts:31` — other + +Always-failing test (verified: fails on `bun test src/config/crypto.test.ts`). It sets process.env.WEBHOOK_PRIVATE_KEY at test time, but CryptoService.initializeKeys() reads config.secrets.webhookPrivateKey (crypto.ts:28), and config/vars.ts snapshots process.env at module import — long before the test body runs. initializeKeys therefore derives the public key from the developer's .env key (or generates a random pair when unset), never from the test-generated private key, so the equality assertion at line 42 cannot pass on any machine. + +**Suggested fix:** Inject the key instead of touching process.env: mock.module('./vars', ...) with a controlled secrets.webhookPrivateKey before importing ./crypto, or refactor initializeKeys to accept the PEM as a parameter. + + +## MEDIUM + +### `apps/api/src/api/helpers/clientIp.test.ts:20` — isolation-hazard + +The test 'adds the normalized request IP when additional data does not include one' calls enrichAdditionalDataWithClientIp with { ip: "::1" }, which normalizes to loopback 127.0.0.1. Because the test preload (apps/api/src/test-utils/preload.ts) forces DEPLOYMENT_ENV=test, the production code's non-production branch runs fetchHostPublicIp(), issuing a REAL outbound HTTPS request to the hardcoded https://api.ipify.org?format=json. Verified empirically: instrumenting globalThis.fetch during this exact call shows the request firing and the returned ipAddress being the host machine's real public IP. This violates the repo's explicit hermetic-test policy in preload.ts ('no test can accidentally reach a real external service'), makes the test environment-dependent and up to ~2s slow (abort timeout) when the endpoint is unreachable, and caches the real public IP in module-level state (cachedHostPublicIp, 10-min TTL) that bleeds into any other test importing clientIp.ts in bun's single test process. + +**Suggested fix:** Avoid the loopback branch: use a non-loopback request IP, e.g. enrichAdditionalDataWithClientIp({ email: "user@example.com" }, { ip: "::ffff:203.0.113.42" }), and assert ipAddress === "203.0.113.42". If the loopback/public-IP-lookup branch itself needs coverage, stub globalThis.fetch (restoring it in afterEach) so no real network call occurs. + +### `apps/api/src/api/helpers/clientIp.test.ts:23` — cannot-fail + +expect(typeof additionalData?.ipAddress).toBe("string") is insensitive to the behavior the test is named after. resolvedIpAddress is set to "127.0.0.1" before the public-IP lookup and only overwritten if the lookup succeeds, so the assertion passes identically whether the ipify fetch succeeds (host's real public IP), fails ("127.0.0.1"), or normalizeClientIp is completely broken (any non-empty string). The 'normalized request IP' claimed by the test name is never actually asserted; the only regression it can catch is the ipAddress key being dropped entirely. The assertion was evidently weakened to tolerate the nondeterministic network result from the ipify call. + +**Suggested fix:** After removing the network dependency (see the line 20 finding), assert the exact expected value, e.g. expect(additionalData?.ipAddress).toBe("203.0.113.42") for input ip "::ffff:203.0.113.42". + +### `apps/api/src/api/middlewares/apiKeyAuth.helpers.test.ts:24` — isolation-hazard + +createSecretKeyRecord builds a REAL Sequelize instance (Object.assign(new ApiKey(), {...})) with isNewRecord=true and no stubbed update(). On every successful validation path, production validateSecretApiKey calls keyRecord.update({lastUsedAt}) fire-and-forget, which issues a live INSERT INTO api_keys against the database configured in apps/api/.env (127.0.0.1:54322). Verified by running the file: Postgres responds with 'null value in column "key_prefix" of relation "api_keys" violates not-null constraint' three times, proving the query reaches the real dev DB. The tests only stay green because the INSERT happens to violate a NOT NULL constraint and production swallows the error via .catch(logger.error); if the instance ever serialized fully (schema or fixture change), the unit tests would silently persist junk API-key rows into the developer/CI database. + +**Suggested fix:** Stub the persistence call on the fixture, e.g. add `update: mock(async () => keyRecord)` to the Object.assign payload (or use ApiKey.build({...}, {isNewRecord:false}) with a stubbed save), so no real DB traffic is possible. + +### `apps/api/src/api/services/phases/handlers/nabla-swap-handler.test.ts:88` — isolation-hazard + +QuoteTicket.findByPk is monkeypatched at module top level on the real shared Sequelize model class (`QuoteTicket.findByPk = mock(async () => ({ metadata: { nablaSwapEvm: ... } }))`) and never restored. Because bun runs all test files in one process, every later test file that touches QuoteTicket.findByPk silently receives this stub returning a nablaSwapEvm quote instead of hitting its own fixture/DB. + +**Suggested fix:** Save the original (`const original = QuoteTicket.findByPk`) and restore it in afterAll, or use spyOn(QuoteTicket, "findByPk").mockImplementation(...) with mock.restore()/mockRestore() in afterAll. + +### `apps/api/src/api/services/phases/handlers/squid-router-phase-handler.test.ts:119` — isolation-hazard + +QuoteTicket.findByPk is monkeypatched at module top level (`QuoteTicket.findByPk = mock(async () => quote as any)`) and never restored; it also closes over the file-scoped mutable `quote` variable, so after this file runs, any later test file in the same bun process calling QuoteTicket.findByPk gets whatever quote fixture the last test here assigned. + +**Suggested fix:** Restore the original findByPk in afterAll, or use spyOn with mockRestore(). + +### `apps/api/src/api/services/phases/handlers/squid-router-phase-handler.test.ts:200` — wrong-assertion + +The Monerium onramp test builds an impossible fixture and enshrines its consequence. The quote sets `network: Networks.Polygon` (line 191) while declaring a BUY ramp with destination Base (`to: Networks.Base`, evmToEvm.toNetwork: Base). In production, quote.network for BUY is by construction the destination network (quote.controller.ts:36: `getNetworkFromDestination(rampType === BUY ? to : from)`; final-settlement-subsidy.ts:131 relies on exactly this). snapshotPreSettlementBalance intends to snapshot the ephemeral's destination-token balance (used to compute `delivered` in finalSettlementSubsidy), so for this route it must read Base USDC; the assertion `expect(getOnChainTokenDetails).toHaveBeenCalledWith(Networks.Polygon, EvmToken.USDC)` instead locks in a snapshot on the source chain. The test would keep passing if the handler read the wrong network field and would fail a correct refactor to bridgeMeta.toNetwork. + +**Suggested fix:** Set the fixture's `network: Networks.Base` (consistent with a BUY ramp to Base) and assert getOnChainTokenDetails was called with (Networks.Base, EvmToken.USDC). + +### `apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts:303` — stale-or-dead + +The 'registers a Base+USDC ramp and prepares the Mykobo phase set' test can never pass at HEAD. RampService.registerRamp unconditionally throws APIError 503 'EUR ramps are currently disabled' for any quote with EURC input or output (apps/api/src/api/services/ramp/ramp.service.ts:223-228, added in commit be52569e4 'disable euro flows'). The test creates a USDC->EURC SELL quote and calls registerRamp directly, so with RUN_LIVE_TESTS=1 it always fails before any of its assertions run. Because the suite is gated behind describe.skipIf(!RUN_LIVE_TESTS), this breakage is invisible in normal CI runs. + +**Suggested fix:** Either skip this test with an explicit reference to the EUR-disable guard (be52569e4) until EUR ramps are re-enabled, or make the guard bypassable for the sandbox contract test (e.g., env flag checked in registerRamp) so the test can exercise the Mykobo path again. + +### `apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts:304` — stale-or-dead + +Same defect as the offramp file: the 'registers a EUR->Base USDC onramp' test calls RampService.registerRamp with an EURC-input quote, but registerRamp unconditionally rejects EURC quotes with 'EUR ramps are currently disabled' (ramp.service.ts:223-228, commit be52569e4). With RUN_LIVE_TESTS=1 the test always throws before reaching its phase/state assertions (lines 315-348), so the entire Mykobo onramp registration contract is untested despite appearing covered. + +**Suggested fix:** Skip with an explanatory comment tied to the EUR-disable guard, or add a test-only bypass for the guard so the sandbox contract test remains executable. + +### `apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts:117` — isolation-hazard + +Identical unrestored module-scope patching as the offramp file (RampState/QuoteTicket statics at 117-169, BrlaApiService.getInstance at 187, RampRecoveryWorker.prototype.start at 189, mock.module of ../quote/core/nabla at 10 and ../mykobo/mykobo-customer.service at 35), executed even when the suite is skipped. Additionally, this file mocks ../quote/core/nabla with a 1.05 rate while the offramp file mocks the same module with 0.92 — whichever file loads last silently wins for any subsequent importer of the real module in the same bun process, making cross-file behavior order-dependent. Writes lastRampStateMykoboEurOnramp.json into the src tree as a side effect. + +**Suggested fix:** Same as offramp file: gate patching behind RUN_LIVE_TESTS in beforeAll and restore in afterAll; scope the nabla mock per-file lifetime. + +### `apps/api/src/api/services/phases/phase-processor.onramp.integration.test.ts:205` — stale-or-dead + +The test calls rampService.startRamp (line 205) BEFORE rampService.updateRamp with presignedTxs (line 224). The current startRamp requires presigned transactions to already be present and throws 'No presigned transactions found. Please call updateRamp first.' (ramp.service.ts:473-478). The call order enshrines an obsolete API contract; startRamp is also the only place that triggers phaseProcessor.processRamp, so with this ordering processing would never start even if startRamp did not throw. + +**Suggested fix:** Reorder to sign transactions, call updateRamp with presignedTxs, then call startRamp. + +### `apps/api/src/api/services/phases/phase-processor.recovery.integration.test.ts:9` — stale-or-dead + +RAMP_STATE_RECOVERY is an empty placeholder object ('{ // ... }'), so rampState has no id, currentPhase, or flowVariant. PhaseProcessor.processRamp then early-returns at the flow-variant guard (phase-processor.ts:45-50: state.flowVariant undefined !== config.flowVariant, which always resolves to 'monerium' or 'mykobo' per config/vars.ts:46-54) after only logging a warning. As committed, the test performs no recovery processing at all — it is a dead fixture that must be hand-edited to do anything. + +**Suggested fix:** Load the fixture from failedRampStateRecovery.json (the workflow CLAUDE.md documents) and fail fast with a clear error if the fixture is empty/missing, instead of silently no-opping. + +### `apps/api/src/api/services/phases/phase-processor.recovery.integration.test.ts:96` — cannot-fail + +The test contains zero expect() calls (expect is not even imported) and ends with an unconditional 3,000,000 ms sleep. processor.processRamp never throws for phase failures — it catches them internally and only logs (phase-processor.ts:75-77) — so recovery failure cannot surface through the try/catch either. Outcome depends solely on the runner timeout: under bun's default 5 s per-test timeout the test ALWAYS fails on timeout regardless of correctness; with the documented large --timeout it sleeps ~50 minutes and then ALWAYS passes regardless of whether the ramp recovered. The result never reflects the behavior under test. + +**Suggested fix:** Replace the fixed sleep with a poll loop on rampState.currentPhase (like waitForCompleteRamp in the onramp test) and assert the final phase is 'complete' (or at least not 'failed'). + +### `apps/api/src/api/services/phases/phase-processor.recovery.integration.test.ts:47` — isolation-hazard + +RampState.update/findByPk/create are monkeypatched at module scope (47-82) and mock.module permanently replaces ../../workers/ramp-recovery.worker (14-23); neither is restored, and both execute on every `bun test` run even though the describe is skipped without RUN_LIVE_TESTS. In bun's single-process test runner these patches persist into all later test files that use the real RampState statics or the recovery worker. The mocked update/findByPk also write failedRampStateRecovery.json into the src tree as a side effect (gitignored, but a repo-dir write). + +**Suggested fix:** Gate the patching behind RUN_LIVE_TESTS inside beforeAll, capture and restore the original statics in afterAll. + +### `apps/api/src/api/services/priceFeed.service.test.ts:8` — isolation-hazard + +mock.module("@vortexfi/shared", ...) (line 8), mock.module("./nablaReads/outAmount") (line 94), mock.module("./pendulum/apiManager") (line 111), mock.module("../../config/logger") (line 129), and mock.module("../../../index", () => ({})) (line 147) are registered at file scope and never restored (grep confirms no mock.restore anywhere in the file). Bun runs all test files in one process, so every apps/api test file that loads after this one and imports @vortexfi/shared receives the gutted stub instead of the real package. The stub is missing most real exports (FiatToken, MykoboApiService, mapMykoboReviewStatus, Networks, etc.) and replaces getPendulumDetails/isFiatToken/getTokenUsdPrice with fakes whose semantics diverge from production (e.g. isFiatToken returns true only for BRL/EUR/ARS, while the real FiatToken set is EURC/ARS/BRL/USD/MXN/COP). 29 api test files import @vortexfi/shared, many of which sort after this file (quote/**, ramp/**, transactions/**, webhook/**), plus the app entry module is mocked to {} for everyone. + +**Suggested fix:** Build the shared mock from the real module (const actual = await import("@vortexfi/shared"); mock.module("@vortexfi/shared", () => ({ ...actual, getTokenOutAmount: ..., getTokenUsdPrice: ... }))) so untouched exports stay real, and restore the overridden exports in afterAll (or run this file with test isolation / a preload). Drop the logger and ../../../index module mocks or restore them the same way. + +### `apps/api/src/api/services/priceFeed.service.test.ts:417` — cannot-fail + +"should work without API key" asserts headers do NOT contain "x-cg-demo-api-key", but production (priceFeed.service.ts line 120) sets "x-cg-pro-api-key" when a key exists. Since the code never sets "x-cg-demo-api-key" under any condition, expect.not.objectContaining({"x-cg-demo-api-key": ...}) passes whether or not an API key header is attached — the assertion is vacuous. Additionally, the test's premise is dead: delete process.env.COINGECKO_API_KEY (line 405) has no effect because the service reads config.priceProviders.coingecko.apiKey from config/vars, which captured the environment at import time. + +**Suggested fix:** Assert absence of the header the code actually sets ("x-cg-pro-api-key"), and control the key via the instance (e.g. Object.assign(serviceInstance, { coingeckoApiKey: undefined })) instead of process.env, mirroring how the TTL tests override cryptoCacheTtlMs. + +### `apps/api/src/api/services/priceFeed.service.test.ts:217` — isolation-hazard + +beforeEach/afterEach only reset the private static PriceFeedService.instance, but many tests run against the module-level exported singleton `priceFeedService`, whose cryptoPriceCache/fiatExchangeRateCache Maps are never cleared. Tests are therefore order-dependent: "should fetch price from CoinGecko API when cache is empty" (line 250) only sees an empty cache because it happens to run first; the "populate cache" call in the next test (line 262) is actually a cache hit left over from line 250; "should convert USD to crypto" (line 559) expects exactly 1 fetch and relies on no earlier test having cached ethereum:usd on the shared singleton. Reordering tests, or another test file using priceFeedService earlier in the same bun process, breaks the call-count assertions. The populated caches (bitcoin=50000, BRL rate 1.25, real Date.now + 300000ms TTL) also persist into any later test file that uses the exported singleton. + +**Suggested fix:** In beforeEach, also clear the exported singleton's caches ((priceFeedService as any).cryptoPriceCache.clear(); (priceFeedService as any).fiatExchangeRateCache.clear()), or run every test against a freshly-obtained instance instead of the module-level export. + +### `apps/api/src/api/services/quote/engines/squidrouter/index.test.ts:8` — isolation-hazard + +mock.module("../../core/squidrouter", ...) replaces the real core/squidrouter module with an object exposing only calculateEvmBridgeAndNetworkFee, and is never restored. getTokenDetailsForEvmDestination (used by finalize/onramp.ts and core/squidrouter consumers) disappears from the module registry for the rest of the process. Reproduced: `bun test src/api/services/quote/engines/squidrouter/index.test.ts src/api/services/quote/engines/finalize/onramp.test.ts` aborts the entire onramp test file with "SyntaxError: Export named 'getTokenDetailsForEvmDestination' not found in module .../core/squidrouter.ts". The full-directory run currently passes only because bun happens to load finalize/onramp.test.ts before this file; any new test file sorting after it that imports core/squidrouter, or a change in load order, breaks. + +**Suggested fix:** Mock only the one function while preserving the module's other exports: `import * as actualSquidrouter from "../../core/squidrouter"; mock.module("../../core/squidrouter", () => ({ ...actualSquidrouter, calculateEvmBridgeAndNetworkFee: mock(async () => ...) }))`, and restore the original exports in afterAll (mock.module with the actual namespace). + +### `apps/api/src/api/services/ramp/base.service.test.ts:34` — isolation-hazard + +Lines 34-38 monkeypatch the sequelize singleton (sequelize.transaction, sequelize.query) and three QuoteTicket statics (update, findAll, destroy) at module scope and never restore them (no afterAll). bun test runs all files in one process, so every test file loaded after this one sees a sequelize.query that returns [{acquired: true}] for ANY query and a sequelize.transaction mock that invokes its first argument as a callback (calling it without a callback, as BaseRampService.withTransaction does, throws 'callback is not a function'). Any later file exercising real DB paths or unmocked QuoteTicket statics silently runs against these fakes. + +**Suggested fix:** Capture the originals before patching and restore them in afterAll (or use spyOn with mockRestore), e.g. save sequelize.transaction/query and QuoteTicket.update/findAll/destroy at module top and reassign them in afterAll. + +### `apps/api/src/api/services/ramp/ephemeral-freshness.test.ts:14` — isolation-hazard + +mock.module("@vortexfi/shared", ...) is process-global in bun and is never undone. It permanently replaces ApiManager and EvmClientManager (with stubs closed over this file's mutable variables substrateNonce/substrateFree/evmNonce/evmGetClientShouldThrow) for every module loaded after this file in the same bun test process. It also collides with src/api/services/transactions/onramp/common/transactions.test.ts:41, which registers its own mock.module("@vortexfi/shared") — whichever loads last rewires the shared package for both, making results order-dependent. Later tests that need real chain clients (phase handler / integration tests importing ApiManager or EvmClientManager) silently get stubs reporting nonce 0 and zero balances. + +**Suggested fix:** In afterAll, re-register the module with its actual implementations (mock.module("@vortexfi/shared", () => require("@vortexfi/shared") actual exports) or mock only the two managers via a dedicated injectable seam), and document that the stub state variables are only valid inside this file. + +### `apps/api/src/api/services/ramp/ramp.service.register-auth.test.ts:70` — cannot-fail + +The 'rejects registration with no effective user with 400' test asserts only that registerRamp throws an APIError with status 400 and discards the APIError returned by expectRegisterError. It cannot detect removal of the guard it locks in: if the effectiveUserId guard at ramp.service.ts:216 were deleted, registerRamp(userId=undefined, quote.userId=null) still throws APIError 400 further down (prepareAveniaOnrampTransactions at ramp.service.ts:1110 throws 400 'Parameter destinationAddress is required for onramp' because additionalData is {}) — the exact downstream failure the first test in this file documents in its comment. So the test passes with or without the user-gating guard. + +**Suggested fix:** Use the returned error to pin the guard's distinctive message, e.g. const error = await expectRegisterError(undefined, httpStatus.BAD_REQUEST); expect(error.message).toContain("requires an API key linked to a user"); + +### `apps/api/src/api/services/transactions/onramp/common/transactions.test.ts:41` — isolation-hazard + +mock.module("@vortexfi/shared", ...) (line 41), mock.module("../../../../../config/vars", ...) (line 60), and the moonbeam/pendulum cleanup mocks (lines 68, 72) are never restored — there is no afterAll, and bun's mock.restore() does not undo mock.module. bun test executes all files in one process, and I reproduced concrete leakage: adding a test file to the same run that statically imports @vortexfi/shared after this file received the stub module and crashed at load with "SyntaxError: Export named 'NUMBER_OF_PRESIGNED_TXS' not found in module '.../packages/shared/dist/node/index.js'" (the mock factory only exports the handful of names this test needs). The existing suite is currently unaffected only by luck of bun's file-walk order (validation.test.ts happens to run before the onramp directories); any new test file ordered after this one that imports @vortexfi/shared or config/vars can be poisoned. + +**Suggested fix:** Snapshot the real modules before mocking (const realShared = await import("@vortexfi/shared")) and restore them in afterAll via mock.module("@vortexfi/shared", () => realShared) — same for config/vars and the two cleanup modules. Alternatively, spread the real module into the factory ({ ...realShared, createNablaTransactionsForOnrampOnEVM }) so un-mocked exports stay intact. + +### `apps/api/src/api/services/transactions/onramp/routes/avenia-to-evm-base.test.ts:46` — isolation-hazard + +Ten mock.module calls with no restoration: @vortexfi/shared (line 46) replaced by a stub missing most real exports (no NUMBER_OF_PRESIGNED_TXS, RampDirection, WebhookEventType, CleanupPhase, etc.), the transactions barrel "../../index" reduced to a single export encodeEvmTransactionData (line 175), and config/logger reduced to { debug } only (line 183) — any later-loaded code calling logger.info/error would crash. Combined with the sibling file's mocks, whichever @vortexfi/shared factory registers last wins for the rest of the process; bun runs all test files in one process and mock.module leakage into later files was reproduced in this run configuration (see transactions.test.ts finding). Nothing in the current suite breaks today only because of bun's file ordering, which is an accident, not a guarantee. + +**Suggested fix:** Capture the real modules with await import(...) before mock.module and restore them in afterAll; for @vortexfi/shared and ../../index, build the factory as { ...realModule, } so the mock does not silently delete unrelated exports. + +### `apps/api/src/api/services/webhook/__tests__/webhook-delivery.service.test.ts:414` — wrong-assertion + +Asserts the X-Vortex-Signature header matches /^sha256=/. Production sets the header to the raw base64 RSA-PSS signature from cryptoService.signPayload (webhook-delivery.service.ts:13-15,37) with no 'sha256=' prefix — that prefix belongs to the removed HMAC scheme. Even after the hang is fixed, this assertion enshrines the wrong signature format. + +**Suggested fix:** Assert the header equals the (mocked or real) base64 signature, e.g. expect.any(String) plus a verifySignature round-trip, not a sha256= prefix. + +### `apps/api/src/api/services/webhook/__tests__/webhook-delivery.service.test.ts:157` — wrong-assertion + +The expected payload omits `quoteId` and asserts transactionId: 'tx-123'. Production's triggerTransactionCreated(quoteId, sessionId, transactionId, type) is called as ('tx-123', 'session-456', 'tx-id', BUY) and builds payload.payload = { quoteId: 'tx-123', sessionId: 'session-456', transactionId: 'tx-id', ... } (webhook-delivery.service.ts:95-105, commits eb9e79adc/755218975). The strict toEqual can never match. Same defect at line 257: expects payload.payload.transactionId to be 'tx-123' where production sends 'tx-id' ('tx-123' is the quoteId). + +**Suggested fix:** Expect { quoteId: 'tx-123', sessionId: 'session-456', transactionId: 'tx-id', transactionStatus: 'PENDING', transactionType: 'BUY' }; at line 257 assert transactionId 'tx-id' and quoteId 'tx-123'. + +### `apps/api/src/api/services/webhook/__tests__/webhook.service.test.ts:247` — cannot-fail + +'should reject when quoteId does not exist' sets rampStateFindByPkMock.mockResolvedValue(null), which is inert (service uses QuoteTicket, not RampState). The test passes only because the unmocked QuoteTicket.findByPk errors against the DB and registerWebhook wraps every error in an APIError; the only assertion is rejects.toBeInstanceOf(APIError), which every failure path satisfies. Deleting the 404 not-found validation from webhook.service.ts would not fail this test. + +**Suggested fix:** After fixing the model mock, mockResolvedValue(null) on QuoteTicket.findByPk and assert the APIError has status 404 / message containing 'not found'. + +### `apps/api/src/api/services/webhook/__tests__/webhook.service.test.ts:196` — cannot-fail + +'should handle registration errors' mocks Webhook.create to reject, but the flow never reaches Webhook.create: the request includes quoteId 'quote-123', so the unmocked QuoteTicket.findByPk throws first and already yields the generic APIError. The create-failure path this test claims to cover is never executed, and the assertion (rejects.toBeInstanceOf(APIError)) passes for the wrong reason. + +**Suggested fix:** Mock QuoteTicket.findByPk to resolve an existing quote so the rejection genuinely comes from Webhook.create, and assert status 500. + +### `apps/api/src/config/crypto.test.ts:76` — cannot-fail + +'should generate new key pair when WEBHOOK_PRIVATE_KEY is not provided' deletes process.env vars, which is inert for the same config-snapshot reason. On this machine (and any with WEBHOOK_PRIVATE_KEY in apps/api/.env, which bun auto-loads) the test actually executes the load-from-environment branch — the run log prints 'RSA keys loaded from environment (public key derived from private)' during this test — yet it still passes because its assertions (truthy PEM, sign/verify round-trip) hold for either branch. The generateKeyPair path it claims to cover can be arbitrarily broken without this test noticing. + +**Suggested fix:** Mock ./vars so config.secrets.webhookPrivateKey is undefined for this test, and assert the generation branch ran (e.g. the resulting public key differs from the env-derived one). + +### `apps/api/src/config/vars.test.ts:6` — isolation-hazard + +requiredProductionEnv omits FLOW_VARIANT, which vars.ts:267 requires when NODE_ENV=production. The suite still passes locally only because Bun.spawn (line 16) runs the child with cwd=apps/api, where bun auto-loads the developer's .env (it contains FLOW_VARIANT), silently un-hermetizing the carefully constructed env. Reproduced: running the exact test-1 scenario from a directory without .env exits 1 with 'Missing required environment variables in production: FLOW_VARIANT', so the 'allows sandbox mode...' test (line 41) fails on a clean checkout/CI. Any other unset variable can likewise leak from .env into these subprocess tests. + +**Suggested fix:** Add FLOW_VARIANT to requiredProductionEnv and pass a cwd without .env files (e.g. os.tmpdir()) in Bun.spawn so the local .env cannot mask missing variables. + +### `apps/rebalancer/src/utils/config.test.ts:46` — isolation-hazard + +The test 'uses the default when the env value is missing' calls parseRebalancingDailyBridgeLimitUsd(undefined). Passing undefined triggers the default parameter (value = process.env.REBALANCING_DAILY_BRIDGE_LIMIT_USD in config.ts:21), so the test actually reads the ambient environment instead of simulating a missing value. REBALANCING_DAILY_BRIDGE_LIMIT_USD is the one policy variable omitted from the file's policyEnvVars cleanup list (lines 9-21), so the beforeEach scrub never deletes it. The variable is documented uncommented in apps/rebalancer/.env.example, and Bun auto-loads .env when running tests from apps/rebalancer. Verified empirically: 'REBALANCING_DAILY_BRIDGE_LIMIT_USD=50000 bun test src/utils/config.test.ts' fails this test (expected 10000, received 50000). It only passes today because the developer's .env happens not to set the variable (and .env.example's value coincidentally equals the 10_000 default). The same gap can make the getConfig tests (lines 137-150) throw spuriously if the ambient value is malformed, since getConfig() calls parseRebalancingDailyBridgeLimitUsd() internally (config.ts:107). + +**Suggested fix:** Add "REBALANCING_DAILY_BRIDGE_LIMIT_USD" to the policyEnvVars array (apps/rebalancer/src/utils/config.test.ts:9-21) so the existing beforeEach delete / afterEach restore covers it; the call at line 46 then genuinely exercises the missing-env default. + +### `packages/shared/src/services/xcm/assethubToMoonbeam.test.ts:25` — cannot-fail + +The test has zero assertions: it builds the extrinsic, dry-runs it, and only console.logs the result. dryRunApi.dryRunCall returns a Result whose payload contains the execution outcome (success or an XCM error such as Filtered/FailedToTransactAsset); the test never inspects it, so a dry run that reports failure still passes. Even when opted in via RUN_LIVE_TESTS, the test can only fail on a thrown exception (e.g., RPC unreachable), never on the behavior it claims to verify. + +**Suggested fix:** Assert on the dry-run outcome, e.g. unwrap the Result and expect(result.isOk).toBe(true) plus expect the inner executionResult to be Complete/Ok; remove the console.log-only pattern. + + +## LOW + +### `apps/api/src/api/middlewares/dualAuth.test.ts:5` — stale-or-dead + +The file is named dualAuth.test.ts but contains zero tests of dualAuth.ts: it imports and tests only assertQuoteOwnership/assertRampOwnership from ./ownershipAuth (line 5). The dual-track auth handler itself (dualAuthHandler / requirePartnerOrUserAuth / optionalPartnerOrUserAuth in dualAuth.ts) is untested by this file; dualAuth.ts merely re-exports the ownership helpers. The name reflects a pre-extraction layout and misleads maintainers into thinking the dual-auth middleware has coverage here. + +**Suggested fix:** Rename the file to ownershipAuth.test.ts (no content change needed). + +### `apps/api/src/api/services/phases/helpers/brla-onramp-hold.test.ts:71` — cannot-fail + +In "does not update state when the Avenia pay-in ticket is missing", `expect(state.state.onHold).toBe(false)` asserts the fixture's own initial value (makeState(false)) and cannot fail: with an empty ticket list there is no code path that could set onHold to true, and if syncAveniaOnHoldState erroneously invoked updateState({...state, onHold: false}) despite the missing ticket, the assertion would still pass. The test's stated claim (state is not updated) is never actually verified; only the ticketFound === false assertion on line 70 is meaningful. + +**Suggested fix:** Pass a mock as the updateState callback and assert it was not called, e.g. `const updateState = mock(async () => {}); ...; expect(updateState).not.toHaveBeenCalled();`. + +### `apps/api/src/api/services/phases/phase-processor.onramp.integration.test.ts:158` — stale-or-dead + +mock.module("../brla/helpers", ...) targets apps/api/src/api/services/brla/helpers, but that directory no longer exists — verifyReferenceLabel now lives in packages/shared/src/services/brla/helpers.ts and is not called anywhere in apps/api production code. The mock (and mockVerifyReferenceLabel at line 153) is vestigial: it registers a virtual module nobody imports, so the intended bypass of reference-label verification silently does nothing. + +**Suggested fix:** Delete the mock, or if reference-label verification is still exercised by the live flow, re-point the mock at the module that production actually imports (@vortexfi/shared). + +### `apps/api/src/api/services/priceFeed.service.test.ts:94` — stale-or-dead + +mock.module("./nablaReads/outAmount", ...) (line 94) and mock.module("./pendulum/apiManager", ...) (line 111) target modules that do not exist in apps/api: there is no src/api/services/nablaReads directory, and src/api/services/pendulum contains only helpers.ts and pendulum.service.ts. priceFeed.service.ts imports getTokenOutAmount and ApiManager from @vortexfi/shared, so these mocks are dead leftovers from an older import layout and shadow nothing the service uses; the comment on line 93 ("Keep the existing mock structure for Nabla") confirms the drift. + +**Suggested fix:** Delete both mock.module blocks; the @vortexfi/shared mock already provides getTokenOutAmount and ApiManager. + +### `apps/api/src/api/services/priceFeed.service.test.ts:596` — cannot-fail + +"should use default values when environment variables are not set" deletes COINGECKO_API_URL/CRYPTO_CACHE_TTL_MS/FIAT_CACHE_TTL_MS (lines 598-600) before creating a new instance, but the constructor reads config/vars values captured at process start, so the env deletion is a no-op and the default-fallback behavior the title claims to test is never exercised. The test ends up asserting exactly the same three config-snapshot values as the next test (line 619, which honestly documents this "keep loaded configuration" behavior) — it is a duplicate whose setup cannot influence the outcome. The same applies to the env vars set in the outer beforeEach (lines 176-182): they never reach the service. + +**Suggested fix:** Delete this test (line 619's test already covers the config-snapshot behavior), or if default-fallback coverage is wanted, test config/vars parsing directly where the defaults are applied. + +### `apps/api/src/api/services/quote/engines/discount/helpers.test.ts:33` — other + +The describe block "negative targetDiscount scenarios (rate floor)" does not test negative-target-discount behavior. calculateSubsidyAmount(expectedOutput, actualOutput, maxSubsidy) has no discount parameter; the negative-discount / rate-floor logic lives in calculateExpectedOutput (helpers.ts lines 74-92), which this file never calls. The four tests in the block are structurally identical to the earlier cases (shortfall subtraction and maxSubsidy cap) with different constants, so the block name gives false confidence that the rate-floor path is covered while enshrining nothing about it. + +**Suggested fix:** Either rename the block to reflect what it tests (plain shortfall/cap arithmetic) and drop the duplicated cases, or actually test calculateExpectedOutput with a negative targetDiscount and assert the discounted rate/expected output it produces. + +### `apps/api/src/api/services/transactions/validation.test.ts:246` — cannot-fail + +In "matches a signed EVM transaction to the unsigned server-built transaction", signedTx is constructed as { ...unsignedTx, txData: signedRawTx }, and areAllTxsIncluded (validation.ts:169-185) compares only phase/network/nonce/signer — fields that are identical by construction via the spread. The ~30 lines of EIP-1559 signing setup cannot influence the assertion; expect(areAllTxsIncluded([signedTx], [unsignedTx])).toBe(true) only fails if areAllTxsIncluded itself is totally broken, and the signed-vs-unsigned matching the test name promises is never exercised (the stray comment on line 245, "change to use universal validator", acknowledges this). + +**Suggested fix:** Either delete the signing ceremony and rename the test to state it checks metadata-only matching (the neighboring test at line 249 already documents that txData is ignored), or convert it to call validatePresignedTxs so the signature/nonce/value verification is actually on the assertion path. + +### `apps/api/src/api/services/webhook/__tests__/webhook.service.test.ts:45` — stale-or-dead + +mock.module('crypto') with randomBytes exists to support webhook secret generation, which was removed from production in commit f1ff2092d ('remove secret generation in the webhook registration'); webhook.service.ts no longer imports crypto and the model has no secret column. The mock and its beforeEach reset/re-arm (lines 87-90) are dead setup. + +**Suggested fix:** Delete the crypto mock and randomBytesMock plumbing. + +### `apps/api/src/config/crypto.test.ts:60` — cannot-fail + +'should be able to sign and verify with derived public key' has the same inert env manipulation: the keypair actually used comes from config at import time, not the test-generated private key, so the 'derived public key' premise is not what is exercised. The test still passes because any consistent keypair satisfies the sign/verify round-trip — it verifies signPayload/verifySignature generally, not derivation. + +**Suggested fix:** Either rename/re-scope the test to 'sign/verify round-trip' or inject the test key via a mocked ./vars so it genuinely uses the derived key. + +### `apps/frontend/src/pages/progress/phaseFlows.test.ts:6` — cannot-fail + +Both tests (lines 6-16 and 20-35) assert that the PHASE_FLOWS constant equals a verbatim copy of itself pasted from phaseFlows.ts. There is no independent oracle: the test names claim to match 'the active BRL ... runtime phases' (i.e. backend parity), but nothing ties the expected arrays to the backend phase handlers in apps/api/src/api/services/phases/handlers/. The test can only fail when someone edits the frontend constant, at which point the test is updated to match — it can never detect the drift-from-backend bug it purports to guard. (I verified the current arrays do happen to match the backend transition chains, so no wrong assertion — the defect is that the test provides zero verification while implying runtime parity.) + +**Suggested fix:** Either delete the file, or make the expectation independent: derive/export the canonical phase sequences from a shared source used by both backend and frontend, or at minimum rename the tests to state they only pin the frontend constant against accidental edits. + +### `apps/frontend/src/translations/helpers.test.ts:170` — cannot-fail + +'demonstrates how easy it would be to add Spanish support' builds a local object `extendedFamilies` (lines 165-168) and then asserts properties the test itself just set (lines 170-171: length 3 and es === 'es'). Those assertions cannot fail regardless of production behavior. The only production-touching assertion is the brittle Object.keys length check on line 163, which asserts a count, not behavior. + +**Suggested fix:** Delete this test (it documents nothing enforceable), or keep only meaningful assertions on the exported LANGUAGE_FAMILIES map. + +### `apps/frontend/src/translations/helpers.test.ts:187` — cannot-fail + +'demonstrates the simplicity of the language code extraction' re-implements the extraction expression inline (line 186: input.toLowerCase().split('-')[0]) and asserts against that inline copy. It never calls any exported function from helpers.ts, so if the production extraction logic in getBrowserLanguage changed or broke, this test would still pass — it only tests JavaScript string methods. + +**Suggested fix:** Delete the test; the real extraction path is already covered via getBrowserLanguage in 'should extract language code correctly from complex locale strings' (lines 108-114). + +### `packages/shared/src/services/xcm/assethubToMoonbeam.test.ts:17` — other + +The test passes assetAccountKey = '0xFFfffffF7D2B0B761Af01Ca8e25242976ac0aD7D' commented as 'xcUSDC', implying the transfer moves that asset. The production function createAssethubToMoonbeamTransferWithSwapOnHydration accepts assetAccountKey but never uses it — the XCM message hardcodes USDT on AssetHub (PalletInstance 50 / GeneralIndex 1984). The argument is inert, so the test misleadingly enshrines a dead parameter and would keep passing no matter what asset key is supplied. + +**Suggested fix:** Either wire assetAccountKey through in the production function so it actually selects the asset, or drop the parameter from the signature and the test call to stop implying it has an effect. + +### `packages/shared/src/services/xcm/moonbeamToAssethub.test.ts:25` — cannot-fail + +Same defect as the assethubToMoonbeam test: no assertions at all. The dry-run Result is only logged via console.log, so a failed XCM dry run (which is the expected outcome here, see the stale-feature finding) still makes the test pass. The test can only fail on network/API exceptions, never on the dry-run outcome it exists to check. + +**Suggested fix:** Assert on the dry-run Result (isOk and inner execution result) instead of logging it, or delete the test together with the dead production function. + +### `packages/shared/src/services/xcm/moonbeamToAssethub.test.ts:15` — stale-or-dead + +The test exercises createMoonbeamToAssethubTransferWithSwapOnHydration, whose own doc comment in packages/shared/src/services/xcm/moonbeamToAssethub.ts (line 51) states: 'WARNING: The resulting XCM transaction does not work because Moonbeam does not allow polkadotXcm::execute calls'. The dry run of this extrinsic can therefore only ever report failure (Filtered), meaning the test targets a documented-dead feature and validates nothing even in live mode. + +**Suggested fix:** Delete this test (and consider removing the dead production function), or convert it into a test that asserts the dry run reports the expected Filtered error if documenting the limitation is intended. From 59be4d8efd4e6c3130f077a6a2bdc2f349d06e6b Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 20:41:37 +0200 Subject: [PATCH 099/176] Extend the component-test foundation with jsdom shims and a fuller fake ramp actor - setup.ts: shim matchMedia, the Web Animations API, and IntersectionObserver (walletconnect, motion/react, and torph need them under jsdom; the animate() stub's finished promise must never resolve or animation libraries loop) - fakeRampActor: support state.matches() selectors and xstate's observer-style subscribe, which @xstate/react uses --- apps/frontend/src/test/fakeRampActor.ts | 17 ++++++-- apps/frontend/src/test/setup.ts | 57 +++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 4 deletions(-) diff --git a/apps/frontend/src/test/fakeRampActor.ts b/apps/frontend/src/test/fakeRampActor.ts index fff2414aa..16cbb27dd 100644 --- a/apps/frontend/src/test/fakeRampActor.ts +++ b/apps/frontend/src/test/fakeRampActor.ts @@ -9,28 +9,35 @@ interface FakeRampContext { interface FakeSnapshot { context: FakeRampContext; + // Components query machine states via useSelector(state => state.matches(...)). + // The fake never enters a named state. + matches: (state: string) => boolean; } type Listener = (snapshot: FakeSnapshot) => void; +// xstate actors accept either a callback or a partial observer; @xstate/react uses the +// observer form, so the fake must support both. +type ListenerOrObserver = Listener | { next?: Listener }; export interface FakeRampActor { events: Array<{ type: string } & Record>; getSnapshot: () => FakeSnapshot; send: (event: { type: string } & Record) => void; setRampState: (rampState: RampState | undefined) => void; - subscribe: (listener: Listener) => { unsubscribe: () => void }; + subscribe: (listener: ListenerOrObserver) => { unsubscribe: () => void }; } // Minimal stand-in for the ramp machine actor: stable snapshot identity until a // change occurs (required by useSyncExternalStore-based `useSelector`), records // every sent event, and applies SET_RAMP_STATE like the real machine does. export function createFakeRampActor(initialRampState?: RampState): FakeRampActor { - let snapshot: FakeSnapshot = { context: { rampState: initialRampState } }; + const matches = () => false; + let snapshot: FakeSnapshot = { context: { rampState: initialRampState }, matches }; const listeners = new Set(); const events: FakeRampActor["events"] = []; const update = (context: FakeRampContext) => { - snapshot = { context }; + snapshot = { context, matches }; for (const listener of listeners) { listener(snapshot); } @@ -48,7 +55,9 @@ export function createFakeRampActor(initialRampState?: RampState): FakeRampActor setRampState: rampState => { update({ ...snapshot.context, rampState }); }, - subscribe: listener => { + subscribe: listenerOrObserver => { + const listener: Listener = + typeof listenerOrObserver === "function" ? listenerOrObserver : snapshot => listenerOrObserver.next?.(snapshot); listeners.add(listener); return { unsubscribe: () => listeners.delete(listener) }; } diff --git a/apps/frontend/src/test/setup.ts b/apps/frontend/src/test/setup.ts index f5fcd7a11..cdd94c10b 100644 --- a/apps/frontend/src/test/setup.ts +++ b/apps/frontend/src/test/setup.ts @@ -3,6 +3,63 @@ import { cleanup } from "@testing-library/react"; import { afterAll, afterEach, beforeAll } from "vitest"; import { server } from "./msw-server"; +// jsdom doesn't implement matchMedia; @walletconnect/modal calls it at import time. +if (typeof window !== "undefined" && !window.matchMedia) { + window.matchMedia = (query: string) => + ({ + addEventListener: () => undefined, + addListener: () => undefined, + dispatchEvent: () => false, + matches: false, + media: query, + onchange: null, + removeEventListener: () => undefined, + removeListener: () => undefined + }) as MediaQueryList; +} + +// jsdom doesn't implement the Web Animations API; motion/react and torph call these. +if (typeof Element !== "undefined") { + if (!Element.prototype.getAnimations) { + Element.prototype.getAnimations = () => []; + } + if (!Element.prototype.animate) { + // `finished` intentionally never resolves: an instantly-finished animation makes + // animation libraries restart in a tight loop. + Element.prototype.animate = () => + ({ + cancel: () => undefined, + finish: () => undefined, + finished: new Promise(() => undefined), + onfinish: null, + pause: () => undefined, + play: () => undefined, + reverse: () => undefined + }) as unknown as Animation; + } +} + +// jsdom doesn't implement IntersectionObserver; motion/react's whileInView needs it. +if (typeof window !== "undefined" && !window.IntersectionObserver) { + window.IntersectionObserver = class { + readonly root = null; + readonly rootMargin = ""; + readonly thresholds = []; + disconnect() { + return undefined; + } + observe() { + return undefined; + } + takeRecords() { + return []; + } + unobserve() { + return undefined; + } + } as unknown as typeof IntersectionObserver; +} + // "bypass" keeps pre-existing node-environment tests untouched: any request they make // behaves exactly as before this setup file existed. beforeAll(() => server.listen({ onUnhandledRequest: "bypass" })); From 0ad623a7ce4ebd88c1a22a089c694e952ff317c6 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 20:41:49 +0200 Subject: [PATCH 100/176] Add RTL flow tests for the quote forms and the ramp progress page Onramp (BUY): quote fetched via MSW and displayed, debounced re-fetch on amount edits, backend quote errors rendered with the submit disabled. Offramp (SELL): USDC->BRL quote display, wallet gate on the submit slot, backend limit rejections rewritten into readable minimum-amount messages. ProgressPage: per-phase messages, poll advancing the phase, mismatched or failing poll responses ignored, delayed-transaction banner after 20 minutes. Wallet, router, and app contexts are mocked at module level; mocked hooks return module-level singletons because a fresh object per render re-triggers quote-fetch effects that depend on them. --- .../components/Ramp/Offramp/Offramp.test.tsx | 141 +++++++++++++++ .../components/Ramp/Onramp/Onramp.test.tsx | 163 ++++++++++++++++++ .../src/pages/progress/ProgressPage.test.tsx | 136 +++++++++++++++ 3 files changed, 440 insertions(+) create mode 100644 apps/frontend/src/components/Ramp/Offramp/Offramp.test.tsx create mode 100644 apps/frontend/src/components/Ramp/Onramp/Onramp.test.tsx create mode 100644 apps/frontend/src/pages/progress/ProgressPage.test.tsx diff --git a/apps/frontend/src/components/Ramp/Offramp/Offramp.test.tsx b/apps/frontend/src/components/Ramp/Offramp/Offramp.test.tsx new file mode 100644 index 000000000..84016614a --- /dev/null +++ b/apps/frontend/src/components/Ramp/Offramp/Offramp.test.tsx @@ -0,0 +1,141 @@ +// @vitest-environment jsdom +import { render, screen, waitFor } from "@testing-library/react"; +import { EvmToken, FiatToken, RampDirection } from "@vortexfi/shared"; +import { http, HttpResponse } from "msw"; +import { beforeEach, describe, expect, it, vi } from "vitest"; +import { usePartnerStore } from "../../../stores/partnerStore"; +import { useQuoteFormStore } from "../../../stores/quote/useQuoteFormStore"; +import { useQuoteStore } from "../../../stores/quote/useQuoteStore"; +import { useRampDirectionStore } from "../../../stores/rampDirectionStore"; +import { createFakeRampActor } from "../../../test/fakeRampActor"; +import { buildQuoteResponse } from "../../../test/fixtures"; +import "../../../test/i18n"; +import { API_BASE_URL, server } from "../../../test/msw-server"; + +// Same module-level fakes as Onramp.test.tsx: no wallet connected, no router mounted. +// All mocked hooks return module-level singletons — a fresh object per render would +// re-trigger effects that depend on them (infinite quote re-fetch). +const stubs = { + account: { address: undefined, chain: undefined, chainId: undefined }, + appKit: { close: vi.fn(), open: vi.fn() }, + appKitAccount: { address: undefined, isConnected: false }, + appKitNetwork: { caipNetwork: undefined, chainId: undefined, switchNetwork: vi.fn() }, + events: { trackEvent: vi.fn() }, + network: { + networkSelectorDisabled: false, + selectedNetwork: "base", + setNetworkSelectorDisabled: vi.fn(), + setSelectedNetwork: vi.fn() + }, + polkadotWallet: { walletAccount: undefined }, + router: { navigate: vi.fn() }, + signMessage: { signMessageAsync: vi.fn() }, + switchChain: { switchChainAsync: vi.fn() } +}; + +vi.mock("wagmi", () => ({ + useAccount: () => stubs.account, + useSignMessage: () => stubs.signMessage, + useSwitchChain: () => stubs.switchChain +})); + +vi.mock("../../../wagmiConfig", () => ({ wagmiConfig: { chains: [] } })); + +vi.mock("@reown/appkit/react", () => ({ + useAppKit: () => stubs.appKit, + useAppKitAccount: () => stubs.appKitAccount, + useAppKitNetwork: () => stubs.appKitNetwork +})); + +vi.mock("@tanstack/react-router", () => ({ + Link: ({ children }: { children?: React.ReactNode }) => {children}, + useParams: () => ({}), + useRouter: () => stubs.router, + useSearch: () => ({}) +})); + +const fakeRampActor = createFakeRampActor(); +vi.mock("../../../contexts/rampState", () => ({ + useRampActor: () => fakeRampActor +})); + +vi.mock("../../../contexts/network", () => ({ + useNetwork: () => stubs.network +})); + +vi.mock("../../../contexts/events", () => ({ + useEventsContext: () => stubs.events +})); + +vi.mock("../../../contexts/polkadotWallet", () => ({ + usePolkadotWalletState: () => stubs.polkadotWallet +})); + +import { Offramp } from "./index"; + +const quoteRequests: Array> = []; + +describe("Offramp quote form (SELL)", () => { + beforeEach(() => { + localStorage.clear(); + quoteRequests.length = 0; + useRampDirectionStore.setState({ activeDirection: RampDirection.SELL }); + useQuoteFormStore.setState({ + fiatToken: FiatToken.BRL, + inputAmount: "100", + lastConstraintDirection: RampDirection.SELL, + onChainToken: EvmToken.USDC + }); + useQuoteStore.setState({ error: null, exchangeRate: 0, loading: false, outputAmount: undefined, quote: undefined }); + usePartnerStore.setState({ apiKey: null, partnerId: null }); + }); + + it("requests a SELL quote and shows the fiat output; asks to connect a wallet before selling", async () => { + server.use( + http.post(`${API_BASE_URL}/quotes`, async ({ request }) => { + const body = (await request.json()) as Record; + quoteRequests.push(body); + return HttpResponse.json( + buildQuoteResponse({ + inputAmount: body.inputAmount as string, + inputCurrency: body.inputCurrency as never, + outputAmount: "480.7", + outputCurrency: body.outputCurrency as never, + rampType: body.rampType as RampDirection + }) + ); + }) + ); + render(); + + expect(screen.getByText("You sell")).toBeInTheDocument(); + expect(screen.getByText("You receive")).toBeInTheDocument(); + + await waitFor(() => expect(quoteRequests.length).toBeGreaterThanOrEqual(1)); + expect(quoteRequests[0]).toMatchObject({ + inputAmount: "100", + inputCurrency: EvmToken.USDC, + outputCurrency: FiatToken.BRL, + rampType: RampDirection.SELL + }); + + await waitFor(() => + expect((document.querySelector('input[name="outputAmount"]') as HTMLInputElement).value).toContain("480.7") + ); + + // No wallet is connected, so the submit slot shows the connect-wallet button instead of "Sell". + expect(screen.getByText("Connect")).toBeInTheDocument(); + expect(screen.queryByRole("button", { name: "Sell" })).not.toBeInTheDocument(); + }); + + it("rewrites a backend minimum-limit rejection into a readable message with the backend's limit", async () => { + server.use( + http.post(`${API_BASE_URL}/quotes`, () => + HttpResponse.json({ error: "Output amount below minimum SELL limit of 25.00 BRL" }, { status: 400 }) + ) + ); + render(); + + expect(await screen.findByText("Minimum sell amount is 25 BRL.")).toBeInTheDocument(); + }); +}); diff --git a/apps/frontend/src/components/Ramp/Onramp/Onramp.test.tsx b/apps/frontend/src/components/Ramp/Onramp/Onramp.test.tsx new file mode 100644 index 000000000..261183b9f --- /dev/null +++ b/apps/frontend/src/components/Ramp/Onramp/Onramp.test.tsx @@ -0,0 +1,163 @@ +// @vitest-environment jsdom +import { render, screen, waitFor } from "@testing-library/react"; +import userEvent from "@testing-library/user-event"; +import { FiatToken, QuoteError, RampDirection } from "@vortexfi/shared"; +import { http, HttpResponse } from "msw"; +import { beforeEach, describe, expect, it, vi } from "vitest"; +import { usePartnerStore } from "../../../stores/partnerStore"; +import { useQuoteFormStore } from "../../../stores/quote/useQuoteFormStore"; +import { useQuoteStore } from "../../../stores/quote/useQuoteStore"; +import { useRampDirectionStore } from "../../../stores/rampDirectionStore"; +import { createFakeRampActor } from "../../../test/fakeRampActor"; +import { buildQuoteResponse } from "../../../test/fixtures"; +import "../../../test/i18n"; +import { API_BASE_URL, server } from "../../../test/msw-server"; + +// The quote form pulls in wallet, router, and app-level contexts. They are irrelevant +// to the quote flow itself, so they are faked at module level: no wallet is connected +// and no router is mounted. All mocked hooks return module-level singletons — hooks +// like useQuoteService put e.g. trackEvent in effect dependency arrays, so a fresh +// object per render causes an infinite re-fetch loop. +const stubs = { + account: { address: undefined, chain: undefined, chainId: undefined }, + appKit: { close: vi.fn(), open: vi.fn() }, + appKitAccount: { address: undefined, isConnected: false }, + appKitNetwork: { caipNetwork: undefined, chainId: undefined, switchNetwork: vi.fn() }, + events: { trackEvent: vi.fn() }, + network: { + networkSelectorDisabled: false, + selectedNetwork: "base", + setNetworkSelectorDisabled: vi.fn(), + setSelectedNetwork: vi.fn() + }, + polkadotWallet: { walletAccount: undefined }, + router: { navigate: vi.fn() }, + signMessage: { signMessageAsync: vi.fn() }, + switchChain: { switchChainAsync: vi.fn() } +}; + +vi.mock("wagmi", () => ({ + useAccount: () => stubs.account, + useSignMessage: () => stubs.signMessage, + useSwitchChain: () => stubs.switchChain +})); + +// wagmiConfig runs createAppKit() at import time; keep it out of the test module graph. +vi.mock("../../../wagmiConfig", () => ({ wagmiConfig: { chains: [] } })); + +vi.mock("@reown/appkit/react", () => ({ + useAppKit: () => stubs.appKit, + useAppKitAccount: () => stubs.appKitAccount, + useAppKitNetwork: () => stubs.appKitNetwork +})); + +vi.mock("@tanstack/react-router", () => ({ + Link: ({ children }: { children?: React.ReactNode }) => {children}, + useParams: () => ({}), + useRouter: () => stubs.router, + useSearch: () => ({}) +})); + +const fakeRampActor = createFakeRampActor(); +vi.mock("../../../contexts/rampState", () => ({ + useRampActor: () => fakeRampActor +})); + +vi.mock("../../../contexts/network", () => ({ + useNetwork: () => stubs.network +})); + +vi.mock("../../../contexts/events", () => ({ + useEventsContext: () => stubs.events +})); + +vi.mock("../../../contexts/polkadotWallet", () => ({ + usePolkadotWalletState: () => stubs.polkadotWallet +})); + +import { Onramp } from "./index"; + +const quoteRequests: Array> = []; + +function mockQuoteEndpoint() { + server.use( + http.post(`${API_BASE_URL}/quotes`, async ({ request }) => { + const body = (await request.json()) as Record; + quoteRequests.push(body); + return HttpResponse.json( + buildQuoteResponse({ + inputAmount: body.inputAmount as string, + inputCurrency: body.inputCurrency as never, + outputAmount: "25.5", + outputCurrency: body.outputCurrency as never, + rampType: body.rampType as RampDirection + }) + ); + }) + ); +} + +const getInputAmountField = () => document.querySelector('input[name="inputAmount"]') as HTMLInputElement; +const getOutputAmountField = () => document.querySelector('input[name="outputAmount"]') as HTMLInputElement; + +describe("Onramp quote form (BUY)", () => { + beforeEach(() => { + localStorage.clear(); + quoteRequests.length = 0; + useRampDirectionStore.setState({ activeDirection: RampDirection.BUY }); + useQuoteFormStore.setState({ + fiatToken: FiatToken.BRL, + inputAmount: "100", + lastConstraintDirection: RampDirection.BUY + }); + useQuoteStore.setState({ error: null, exchangeRate: 0, loading: false, outputAmount: undefined, quote: undefined }); + // null (as opposed to undefined) means "resolved from the URL: no partner" — quotes may be fetched. + usePartnerStore.setState({ apiKey: null, partnerId: null }); + }); + + it("requests a quote for the current amount and displays the received output amount", async () => { + mockQuoteEndpoint(); + render(); + + expect(screen.getByText("You pay")).toBeInTheDocument(); + expect(screen.getByText("You receive")).toBeInTheDocument(); + + await waitFor(() => expect(quoteRequests.length).toBeGreaterThanOrEqual(1)); + expect(quoteRequests[0]).toMatchObject({ + inputAmount: "100", + inputCurrency: FiatToken.BRL, + rampType: RampDirection.BUY + }); + + await waitFor(() => expect(getOutputAmountField().value).toContain("25.5")); + + // A fresh, matching quote enables the submit button. + await waitFor(() => expect(screen.getByRole("button", { name: "Buy" })).toBeEnabled()); + }); + + it("re-requests a quote with the new amount after the user edits the input (debounced)", async () => { + mockQuoteEndpoint(); + const user = userEvent.setup(); + render(); + + await waitFor(() => expect(quoteRequests.length).toBeGreaterThanOrEqual(1)); + + const input = getInputAmountField(); + await user.clear(input); + await user.type(input, "250"); + + await waitFor(() => expect(quoteRequests.some(r => r.inputAmount === "250")).toBe(true), { timeout: 4000 }); + }); + + it("shows the backend quote error and keeps the submit button disabled", async () => { + server.use( + http.post(`${API_BASE_URL}/quotes`, () => + HttpResponse.json({ error: QuoteError.InputAmountTooLowToCoverFees }, { status: 400 }) + ) + ); + render(); + + expect(await screen.findByText("Input amount too low. Please try a larger amount.")).toBeInTheDocument(); + expect(screen.getByRole("button", { name: "Buy" })).toBeDisabled(); + }); +}); diff --git a/apps/frontend/src/pages/progress/ProgressPage.test.tsx b/apps/frontend/src/pages/progress/ProgressPage.test.tsx new file mode 100644 index 000000000..502b3b52d --- /dev/null +++ b/apps/frontend/src/pages/progress/ProgressPage.test.tsx @@ -0,0 +1,136 @@ +// @vitest-environment jsdom +import { render, screen, waitFor } from "@testing-library/react"; +import { RampPhase } from "@vortexfi/shared"; +import { http, HttpResponse } from "msw"; +import { beforeEach, describe, expect, it, vi } from "vitest"; +import { createFakeRampActor, FakeRampActor } from "../../test/fakeRampActor"; +import { buildQuoteResponse, buildRampProcess } from "../../test/fixtures"; +import "../../test/i18n"; +import { API_BASE_URL, server } from "../../test/msw-server"; +import { RampState } from "../../types/phases"; + +// Module-level singletons: hooks that appear in effect dependency arrays must return +// stable references (see Onramp.test.tsx). +const stubs = { + events: { trackEvent: vi.fn() }, + network: { + networkSelectorDisabled: false, + selectedNetwork: "base", + setNetworkSelectorDisabled: vi.fn(), + setSelectedNetwork: vi.fn() + } +}; + +let fakeRampActor: FakeRampActor; +vi.mock("../../contexts/rampState", () => ({ + useRampActor: () => fakeRampActor +})); + +vi.mock("../../contexts/network", () => ({ + useNetwork: () => stubs.network +})); + +vi.mock("../../contexts/events", () => ({ + useEventsContext: () => stubs.events +})); + +vi.mock("@tanstack/react-router", () => ({ + Link: ({ children }: { children?: React.ReactNode }) => {children} +})); + +import { ProgressPage } from "./index"; + +// A BRL onramp (BUY, inputCurrency BRL) — flow "onramp_brl" on the progress page. +function buildRampState(currentPhase: RampPhase, rampOverrides: Record = {}): RampState { + return { + quote: buildQuoteResponse(), + ramp: buildRampProcess(currentPhase, rampOverrides), + requiredUserActionsCompleted: true, + signedTransactions: [], + userSigningMeta: undefined + }; +} + +// Serves GET /ramp/:id and records how often it was polled. +function mockRampStatusEndpoint(response: () => ReturnType) { + const calls: string[] = []; + server.use( + http.get(`${API_BASE_URL}/ramp/:id`, ({ params }) => { + calls.push(params.id as string); + return response(); + }) + ); + return calls; +} + +describe("ProgressPage", () => { + beforeEach(() => { + localStorage.clear(); + stubs.events.trackEvent.mockClear(); + }); + + it.each([ + ["brlaOnrampMint" as RampPhase, "Your payment is being processed. This can take up to 5 minutes."], + ["nablaSwap" as RampPhase, "Swapping to USDC on Vortex DEX"] + ])("renders the message for the current phase (%s)", async (phase, expectedMessage) => { + fakeRampActor = createFakeRampActor(buildRampState(phase)); + mockRampStatusEndpoint(() => HttpResponse.json(buildRampProcess(phase))); + + render(); + + expect(screen.getByText("Your transaction is in progress.")).toBeInTheDocument(); + expect(await screen.findByText(expectedMessage)).toBeInTheDocument(); + }); + + it("advances the displayed phase when polling returns a later phase", async () => { + fakeRampActor = createFakeRampActor(buildRampState("brlaOnrampMint")); + mockRampStatusEndpoint(() => HttpResponse.json(buildRampProcess("nablaSwap"))); + + render(); + + expect(await screen.findByText("Swapping to USDC on Vortex DEX")).toBeInTheDocument(); + expect(stubs.events.trackEvent).toHaveBeenCalledWith(expect.objectContaining({ event: "progress", phase_name: "nablaSwap" })); + }); + + it("drops a poll response whose ramp id does not match the active ramp", async () => { + fakeRampActor = createFakeRampActor(buildRampState("brlaOnrampMint")); + const calls = mockRampStatusEndpoint(() => HttpResponse.json(buildRampProcess("nablaSwap", { id: "some-other-ramp" }))); + + render(); + + await waitFor(() => expect(calls.length).toBeGreaterThanOrEqual(1)); + expect(fakeRampActor.events.filter(e => e.type === "SET_RAMP_STATE")).toHaveLength(0); + expect(screen.getByText("Your payment is being processed. This can take up to 5 minutes.")).toBeInTheDocument(); + }); + + it("keeps rendering the current phase when the status poll fails", async () => { + fakeRampActor = createFakeRampActor(buildRampState("brlaOnrampMint")); + const calls = mockRampStatusEndpoint(() => HttpResponse.json({ error: "boom" }, { status: 500 })); + + render(); + + await waitFor(() => expect(calls.length).toBeGreaterThanOrEqual(1)); + expect(fakeRampActor.events.filter(e => e.type === "SET_RAMP_STATE")).toHaveLength(0); + expect(screen.getByText("Your payment is being processed. This can take up to 5 minutes.")).toBeInTheDocument(); + }); + + it("shows the delayed-transaction banner with the ramp id once a ramp is older than 20 minutes", async () => { + const twentyFiveMinutesAgo = new Date(Date.now() - 25 * 60 * 1000).toISOString(); + fakeRampActor = createFakeRampActor(buildRampState("brlaOnrampMint", { createdAt: twentyFiveMinutesAgo })); + mockRampStatusEndpoint(() => HttpResponse.json(buildRampProcess("brlaOnrampMint", { createdAt: twentyFiveMinutesAgo }))); + + render(); + + expect(await screen.findByText("Transaction Status")).toBeInTheDocument(); + expect(screen.getByText("ramp-123")).toBeInTheDocument(); + }); + + it("does not show the delayed-transaction banner for a fresh ramp", () => { + fakeRampActor = createFakeRampActor(buildRampState("brlaOnrampMint")); + mockRampStatusEndpoint(() => HttpResponse.json(buildRampProcess("brlaOnrampMint"))); + + render(); + + expect(screen.queryByText("Transaction Status")).not.toBeInTheDocument(); + }); +}); From 4f63f63db04a8248f7f6f8b0ed4ef4308acaf18d Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 20:41:50 +0200 Subject: [PATCH 101/176] Serve a fresh system.account from the fake Substrate node The registration freshness check reads api.query.system.account on pendulum/assethub for Substrate ephemerals, which SDK clients always register. The fake ApiManager node threw on any use, turning every hermetic SDK registration into a 503. Report every account as fresh (nonce 0, zero balance); all other node members still fail loudly. --- apps/api/src/test-utils/fake-world/index.ts | 40 ++++++++++++++++----- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/apps/api/src/test-utils/fake-world/index.ts b/apps/api/src/test-utils/fake-world/index.ts index 1503d5175..4f01d0e76 100644 --- a/apps/api/src/test-utils/fake-world/index.ts +++ b/apps/api/src/test-utils/fake-world/index.ts @@ -33,9 +33,33 @@ export function installFakeWorld(): FakeWorld { // Substrate/Pendulum flows are not faked yet; fail loudly if a code path // unexpectedly needs them so the gap is explicit rather than a hang. - // Exception: getApi succeeds and returns an inert node, because handlers like + // Exceptions: getApi succeeds and returns an inert node, because handlers like // fundEphemeral resolve the Pendulum API unconditionally even on corridors - // that never touch Substrate — only actual USE of the node should fail. + // that never touch Substrate — only actual USE of the node should fail. The + // one supported use is `api.query.system.account`, which the registration + // freshness check reads for Substrate ephemerals (SDK clients always send + // one): every account is reported fresh (nonce 0, zero balance). + const substrateNodeUnfaked = (member: string) => + new Error( + `FakeWorld: Substrate node .${member} was used but Substrate chains are not faked yet — ` + + "extend src/test-utils/fake-world if this flow must be covered hermetically." + ); + const freshSubstrateApi = new Proxy( + { + query: { system: { account: async () => ({ data: { free: "0" }, nonce: { toNumber: () => 0 } }) } } + }, + { + get: (obj, prop) => { + if (prop in obj) { + return obj[prop as keyof typeof obj]; + } + if (prop === "then") { + return undefined; + } + throw substrateNodeUnfaked(`api.${String(prop)}`); + } + } + ); const originalGetApiManager = ApiManager.getInstance; ApiManager.getInstance = () => new Proxy( @@ -48,16 +72,16 @@ export function installFakeWorld(): FakeWorld { if (prop === "getApi") { return async () => new Proxy( - {}, + { api: freshSubstrateApi }, { - get: (_node, nodeProp) => { + get: (node, nodeProp) => { + if (nodeProp in node) { + return node[nodeProp as keyof typeof node]; + } if (nodeProp === "then") { return undefined; } - throw new Error( - `FakeWorld: Substrate node .${String(nodeProp)} was used but Substrate chains are not faked yet — ` + - "extend src/test-utils/fake-world if this flow must be covered hermetically." - ); + throw substrateNodeUnfaked(String(nodeProp)); } } ); From 71300e35052544d07cad1d44a678594a56815ba8 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 20:42:01 +0200 Subject: [PATCH 102/176] Add a minimal Playwright E2E suite with a mock wallet, run nightly Four hermetic journeys in apps/frontend/e2e: quote form -> quote displayed, API quote error surfaced, and the offramp wallet gate with and without an injected mock wallet. The API origin is intercepted per-test with page.route (no backend/db/chain); the mock wallet is an EIP-6963-announced EIP-1193 provider that wagmi auto-connects to, so no app code changes are needed. Wired per docs/testing-strategy.md as non-PR-blocking: nightly e2e.yml workflow (plus manual dispatch) and a local 'bun test:e2e' script. --- .github/workflows/e2e.yml | 46 ++++++++++++++ .gitignore | 4 ++ apps/frontend/e2e/quote-form.spec.ts | 38 ++++++++++++ apps/frontend/e2e/support/mockBackend.ts | 78 ++++++++++++++++++++++++ apps/frontend/e2e/support/mockWallet.ts | 70 +++++++++++++++++++++ apps/frontend/e2e/wallet-connect.spec.ts | 32 ++++++++++ apps/frontend/package.json | 2 + apps/frontend/playwright.config.ts | 24 ++++++++ bun.lock | 9 +++ docs/testing-strategy.md | 20 ++++++ package.json | 1 + 11 files changed, 324 insertions(+) create mode 100644 .github/workflows/e2e.yml create mode 100644 apps/frontend/e2e/quote-form.spec.ts create mode 100644 apps/frontend/e2e/support/mockBackend.ts create mode 100644 apps/frontend/e2e/support/mockWallet.ts create mode 100644 apps/frontend/e2e/wallet-connect.spec.ts create mode 100644 apps/frontend/playwright.config.ts diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 000000000..b18f7133d --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,46 @@ +# Non-PR-blocking Playwright E2E journeys (see docs/testing-strategy.md). +# Runs nightly and on demand; failures alert but never gate merges. +name: e2e + +on: + schedule: + - cron: "0 3 * * *" + workflow_dispatch: + +jobs: + e2e: + name: Playwright E2E journeys + runs-on: ubuntu-latest + env: + CI: true + + steps: + - name: 🛒 Checkout code + uses: actions/checkout@v3 + + - name: 🧩 Setup Bun + uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 + with: + bun-version: 1.3.1 + + - name: 🧩 Install dependencies + run: bun install --frozen-lockfile + + - name: 🔨 Build shared package + run: bun run build:shared + + - name: 🌐 Install Playwright browsers + working-directory: apps/frontend + run: bunx playwright install --with-deps chromium + + - name: 🧪 E2E journeys + working-directory: apps/frontend + run: bun run test:e2e + + - name: 📤 Upload report on failure + if: failure() + uses: actions/upload-artifact@v4 + with: + name: playwright-report + path: apps/frontend/playwright-report/ + retention-days: 7 diff --git a/.gitignore b/.gitignore index d62be3bc9..80320bd44 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,7 @@ contracts/*/artifacts contracts/*/cache .mcp.json + +# Playwright E2E artifacts +apps/frontend/test-results/ +apps/frontend/playwright-report/ diff --git a/apps/frontend/e2e/quote-form.spec.ts b/apps/frontend/e2e/quote-form.spec.ts new file mode 100644 index 000000000..14593b0cf --- /dev/null +++ b/apps/frontend/e2e/quote-form.spec.ts @@ -0,0 +1,38 @@ +import { expect, test } from "@playwright/test"; +import { mockBackend } from "./support/mockBackend"; + +// Critical journey 1: the quote form requests a quote from the API and displays it. +test("onramp quote form fetches and displays a quote", async ({ page }) => { + const { quoteRequests } = await mockBackend(page); + + await page.goto("/widget?rampType=BUY&fiat=BRL&inputAmount=100"); + + await expect(page.getByText("You pay")).toBeVisible(); + await expect(page.getByText("You receive")).toBeVisible(); + + // The app requests a BUY quote for the amount from the URL... + await expect.poll(() => quoteRequests.length, { timeout: 20_000 }).toBeGreaterThan(0); + expect(quoteRequests[0]).toMatchObject({ + inputAmount: "100", + inputCurrency: "BRL", + rampType: "BUY" + }); + + // ...and displays the quoted output amount in the read-only receive field. + await expect(page.locator('input[name="outputAmount"]')).toHaveValue(/25\.5/, { timeout: 20_000 }); + + // A fresh quote enables the submit button (the toggle also says "Buy", so scope to the form). + await expect(page.locator("form").getByRole("button", { name: "Buy" })).toBeEnabled(); +}); + +// Critical journey 2: a quote rejection from the API surfaces as a readable error. +test("quote errors from the API are shown to the user", async ({ page }) => { + await mockBackend(page, { + quotes: () => ({ body: { error: "Input amount too low to cover fees" }, status: 400 }) + }); + + await page.goto("/widget?rampType=BUY&fiat=BRL&inputAmount=1"); + + await expect(page.getByText("Input amount too low. Please try a larger amount.")).toBeVisible({ timeout: 20_000 }); + await expect(page.locator("form").getByRole("button", { name: "Buy" })).toBeDisabled(); +}); diff --git a/apps/frontend/e2e/support/mockBackend.ts b/apps/frontend/e2e/support/mockBackend.ts new file mode 100644 index 000000000..b571110f6 --- /dev/null +++ b/apps/frontend/e2e/support/mockBackend.ts @@ -0,0 +1,78 @@ +import { Page } from "@playwright/test"; + +// Mirrors the QuoteResponse shape served by the API (see src/test/fixtures.ts). +export function buildQuoteResponse(overrides: Record = {}) { + return { + anchorFeeFiat: "0.5", + anchorFeeUsd: "0.1", + createdAt: new Date().toISOString(), + expiresAt: new Date(Date.now() + 10 * 60 * 1000).toISOString(), + feeCurrency: "BRL", + from: "pix", + id: "quote-e2e-1", + inputAmount: "100", + inputCurrency: "BRL", + network: "base", + networkFeeFiat: "0.2", + networkFeeUsd: "0.04", + outputAmount: "25.5", + outputCurrency: "USDC", + partnerFeeFiat: "0", + partnerFeeUsd: "0", + paymentMethod: "pix", + processingFeeFiat: "0.5", + processingFeeUsd: "0.1", + rampType: "BUY", + to: "base", + totalFeeFiat: "0.7", + totalFeeUsd: "0.14", + vortexFeeFiat: "0", + vortexFeeUsd: "0", + ...overrides + }; +} + +interface MockBackendOptions { + // Called for POST /v1/quotes; return a JSON body + status. Defaults to echoing the + // request into a successful quote. + quotes?: (requestBody: Record) => { status: number; body: unknown }; +} + +// Intercepts all traffic to the API origin (http://localhost:3000) so journeys run +// without a backend, and blocks third-party endpoints that would make runs +// non-deterministic (token lists, walletconnect telemetry). The app has graceful +// fallbacks for all of them. +export async function mockBackend(page: Page, options: MockBackendOptions = {}) { + const quoteRequests: Array> = []; + + await page.route("http://localhost:3000/**", async route => { + const request = route.request(); + const url = new URL(request.url()); + + if (url.pathname === "/v1/quotes" && request.method() === "POST") { + const body = request.postDataJSON() as Record; + quoteRequests.push(body); + const result = options.quotes?.(body) ?? { + body: buildQuoteResponse({ + inputAmount: body.inputAmount, + inputCurrency: body.inputCurrency, + outputCurrency: body.outputCurrency, + rampType: body.rampType + }), + status: 200 + }; + await route.fulfill({ json: result.body as object, status: result.status }); + return; + } + + await route.fulfill({ json: {}, status: 404 }); + }); + + // SquidRouter token list: the app falls back to its static token config on failure. + await page.route("https://v2.api.squidrouter.com/**", route => route.abort()); + // WalletConnect/AppKit remote config and telemetry. + await page.route("https://api.web3modal.org/**", route => route.abort()); + await page.route("https://pulse.walletconnect.org/**", route => route.abort()); + + return { quoteRequests }; +} diff --git a/apps/frontend/e2e/support/mockWallet.ts b/apps/frontend/e2e/support/mockWallet.ts new file mode 100644 index 000000000..fc894fbcc --- /dev/null +++ b/apps/frontend/e2e/support/mockWallet.ts @@ -0,0 +1,70 @@ +import { Page } from "@playwright/test"; + +export const MOCK_WALLET_ADDRESS = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"; +export const MOCK_WALLET_NAME = "E2E Mock Wallet"; + +// Injects a minimal EIP-1193 provider announced via EIP-6963 before the app loads. +// AppKit is configured with enableEIP6963, so the provider shows up in the connect +// modal as an installed browser wallet — no app code changes needed. +export async function injectMockWallet(page: Page) { + await page.addInitScript( + ({ address, name }) => { + const chainIdHex = "0x2105"; // Base + + // biome-ignore lint/suspicious/noExplicitAny: minimal EIP-1193 stub + const listeners: Record void>> = {}; + const provider = { + isMetaMask: false, + // biome-ignore lint/suspicious/noExplicitAny: minimal EIP-1193 stub + on: (event: string, cb: (...args: any[]) => void) => { + (listeners[event] ??= []).push(cb); + }, + // biome-ignore lint/suspicious/noExplicitAny: minimal EIP-1193 stub + removeListener: (event: string, cb: (...args: any[]) => void) => { + listeners[event] = (listeners[event] ?? []).filter(l => l !== cb); + }, + request: async ({ method }: { method: string }) => { + switch (method) { + case "eth_requestAccounts": + case "eth_accounts": + return [address]; + case "eth_chainId": + return chainIdHex; + case "net_version": + return String(Number(chainIdHex)); + case "wallet_switchEthereumChain": + case "wallet_addEthereumChain": + return null; + case "wallet_requestPermissions": + return [{ parentCapability: "eth_accounts" }]; + case "personal_sign": + case "eth_signTypedData_v4": + return `0x${"ab".repeat(65)}`; + case "eth_getBalance": + return "0xde0b6b3a7640000"; // 1 ETH + case "eth_blockNumber": + return "0x1"; + default: + return null; + } + } + }; + + const info = Object.freeze({ + icon: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIvPg==", + name, + rdns: "co.vortexfinance.e2e", + uuid: "e2e00000-0000-4000-8000-000000000001" + }); + const announce = () => + window.dispatchEvent(new CustomEvent("eip6963:announceProvider", { detail: Object.freeze({ info, provider }) })); + window.addEventListener("eip6963:requestProvider", announce); + announce(); + + // Also expose as the legacy injected provider for connectors that look for it. + // biome-ignore lint/suspicious/noExplicitAny: window.ethereum has no typed slot here + (window as any).ethereum = provider; + }, + { address: MOCK_WALLET_ADDRESS, name: MOCK_WALLET_NAME } + ); +} diff --git a/apps/frontend/e2e/wallet-connect.spec.ts b/apps/frontend/e2e/wallet-connect.spec.ts new file mode 100644 index 000000000..df0ef5c0c --- /dev/null +++ b/apps/frontend/e2e/wallet-connect.spec.ts @@ -0,0 +1,32 @@ +import { expect, test } from "@playwright/test"; +import { mockBackend } from "./support/mockBackend"; +import { injectMockWallet } from "./support/mockWallet"; + +// Critical journey 3: an offramp requires a connected wallet. +// Without one, the submit slot asks to connect; with the injected mock wallet +// (announced via EIP-6963, auto-connected by wagmi), the app shows the account +// and the Sell action instead. + +test("offramp without a wallet asks to connect instead of offering Sell", async ({ page }) => { + await mockBackend(page); + + await page.goto("/widget?rampType=SELL&fiat=BRL&inputAmount=100"); + + await expect(page.getByRole("button", { name: /Connect/ }).first()).toBeVisible({ timeout: 20_000 }); + await expect(page.locator("form").getByRole("button", { name: "Sell" })).toHaveCount(0); +}); + +test("offramp with the injected mock wallet connects and shows the Sell action", async ({ page }) => { + await mockBackend(page); + await injectMockWallet(page); + + await page.goto("/widget?rampType=SELL&fiat=BRL&inputAmount=100"); + + // The connected account (0xf39F...b92266) appears in the navbar. + await expect(page.getByRole("button", { name: /0xf39F/ })).toBeVisible({ timeout: 20_000 }); + + // The submit slot offers Sell instead of the connect prompt. (It may still be + // disabled — the mock wallet holds no USDC — but the wallet gate is passed.) + await expect(page.locator("form").getByRole("button", { name: "Sell" })).toBeVisible(); + await expect(page.getByRole("button", { name: /Connect/ })).toHaveCount(0); +}); diff --git a/apps/frontend/package.json b/apps/frontend/package.json index b0cf9558a..44bd4a851 100644 --- a/apps/frontend/package.json +++ b/apps/frontend/package.json @@ -80,6 +80,7 @@ "@babel/preset-env": "^7.20.2", "@babel/preset-typescript": "^7.18.6", "@pendulum-chain/types": "catalog:", + "@playwright/test": "^1.61.1", "@polkadot/types-augment": "catalog:", "@polkadot/types-codec": "catalog:", "@polkadot/types-create": "catalog:", @@ -132,6 +133,7 @@ "preview": "bun x --bun vite preview", "storybook": "storybook dev -p 6006", "test": "vitest", + "test:e2e": "playwright test", "verify": "bun test" }, "type": "module", diff --git a/apps/frontend/playwright.config.ts b/apps/frontend/playwright.config.ts new file mode 100644 index 000000000..e1a6e0e5c --- /dev/null +++ b/apps/frontend/playwright.config.ts @@ -0,0 +1,24 @@ +import { defineConfig, devices } from "@playwright/test"; + +// E2E journeys are non-PR-blocking (see docs/testing-strategy.md): they run nightly in CI +// and locally via `bun test:e2e`. The backend is mocked per-test with page.route, so no +// API server, database, or chain access is needed — only the Vite dev server. +export default defineConfig({ + forbidOnly: !!process.env.CI, + fullyParallel: true, + projects: [{ name: "chromium", use: { ...devices["Desktop Chrome"] } }], + reporter: process.env.CI ? [["list"], ["github"]] : [["list"]], + retries: process.env.CI ? 2 : 0, + testDir: "./e2e", + timeout: 60_000, + use: { + baseURL: "http://127.0.0.1:5173", + trace: "on-first-retry" + }, + webServer: { + command: "bun x --bun vite --port 5173 --strictPort", + reuseExistingServer: !process.env.CI, + timeout: 120_000, + url: "http://127.0.0.1:5173" + } +}); diff --git a/bun.lock b/bun.lock index 9d9ff7bd8..3f8230f67 100644 --- a/bun.lock +++ b/bun.lock @@ -182,6 +182,7 @@ "@babel/preset-env": "^7.20.2", "@babel/preset-typescript": "^7.18.6", "@pendulum-chain/types": "catalog:", + "@playwright/test": "^1.61.1", "@polkadot/types-augment": "catalog:", "@polkadot/types-codec": "catalog:", "@polkadot/types-create": "catalog:", @@ -1230,6 +1231,8 @@ "@pkgjs/parseargs": ["@pkgjs/parseargs@0.11.0", "", {}, "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg=="], + "@playwright/test": ["@playwright/test@1.61.1", "", { "dependencies": { "playwright": "1.61.1" }, "bin": { "playwright": "cli.js" } }, "sha512-8nKv6+0RJSL9FE4jYOEGXnPeM/Hg12qZpmqzZjRh3qM0Y7c3z1mrOTfFLids72RDQYVh9WpLEfR5WdpNX4fkig=="], + "@polkadot-api/json-rpc-provider": ["@polkadot-api/json-rpc-provider@0.0.1", "", {}, "sha512-/SMC/l7foRjpykLTUTacIH05H3mr9ip8b5xxfwXlVezXrNVLp3Cv0GX6uItkKd+ZjzVPf3PFrDF2B2/HLSNESA=="], "@polkadot-api/json-rpc-provider-proxy": ["@polkadot-api/json-rpc-provider-proxy@0.1.0", "", {}, "sha512-8GSFE5+EF73MCuLQm8tjrbCqlgclcHBSRaswvXziJ0ZW7iw3UEMsKkkKvELayWyBuOPa2T5i1nj6gFOeIsqvrg=="], @@ -3802,6 +3805,10 @@ "pkg-types": ["pkg-types@1.3.1", "", { "dependencies": { "confbox": "^0.1.8", "mlly": "^1.7.4", "pathe": "^2.0.1" } }, "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ=="], + "playwright": ["playwright@1.61.1", "", { "dependencies": { "playwright-core": "1.61.1" }, "optionalDependencies": { "fsevents": "2.3.2" }, "bin": { "playwright": "cli.js" } }, "sha512-DWnY5o3YbLWK4GovuAVwpqL+1VwGNdUGrRr++8j8PtQQzvAVZUIMjKQ90fY689sEJZJBbZVw1rXaOKSTitkzPQ=="], + + "playwright-core": ["playwright-core@1.61.1", "", { "bin": { "playwright-core": "cli.js" } }, "sha512-h7Qlt6m4REp25qvIdvbDtVmD4LqVXfpRxhORv9L0jzETM05p4fuPJ3dKyuSXQxDSbXnmS79HAgi9589lGSpLkg=="], + "pngjs": ["pngjs@5.0.0", "", {}, "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw=="], "pony-cause": ["pony-cause@2.1.11", "", {}, "sha512-M7LhCsdNbNgiLYiP4WjsfLUuFmCfnjdF6jKe2R9NKl4WFN+HZPGHJZ9lnLP7f9ZnKe3U9nuWD0szirmj+migUg=="], @@ -5294,6 +5301,8 @@ "path-scurry/lru-cache": ["lru-cache@10.4.3", "", {}, "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="], + "playwright/fsevents": ["fsevents@2.3.2", "", { "os": "darwin" }, "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA=="], + "porto/ox": ["ox@0.9.17", "", { "dependencies": { "@adraffy/ens-normalize": "^1.11.0", "@noble/ciphers": "^1.3.0", "@noble/curves": "1.9.1", "@noble/hashes": "^1.8.0", "@scure/bip32": "^1.7.0", "@scure/bip39": "^1.6.0", "abitype": "^1.0.9", "eventemitter3": "5.0.1" }, "peerDependencies": { "typescript": ">=5.4.0" }, "optionalPeers": ["typescript"] }, "sha512-rKAnhzhRU3Xh3hiko+i1ZxywZ55eWQzeS/Q4HRKLx2PqfHOolisZHErSsJVipGlmQKHW5qwOED/GighEw9dbLg=="], "pretty-format/ansi-styles": ["ansi-styles@5.2.0", "", {}, "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA=="], diff --git a/docs/testing-strategy.md b/docs/testing-strategy.md index 708834d29..ae81e678e 100644 --- a/docs/testing-strategy.md +++ b/docs/testing-strategy.md @@ -74,6 +74,22 @@ what we test. Unit tests may still mock models where the DB is incidental. (per corridor/phase), and presigned-tx fixtures. Never hand-write these objects or copy JSON snapshots into tests; extend the factory instead. +### Playwright E2E (`apps/frontend/e2e/`) + +A handful of critical journeys (quote form → quote displayed, quote error surfaced, wallet +gate on offramps) run against the real frontend in Chromium, hermetically: + +- The API origin (`http://localhost:3000`) is intercepted per-test with `page.route` + (`e2e/support/mockBackend.ts`) — no backend, database, or chain access. +- A mock wallet (`e2e/support/mockWallet.ts`) is injected as an EIP-6963-announced + EIP-1193 provider before the app loads; wagmi/AppKit picks it up like any installed + browser wallet. +- Third-party endpoints (SquidRouter token list, WalletConnect config) are blocked; the + app's built-in fallbacks cover them. + +They run nightly via `.github/workflows/e2e.yml` (never PR-blocking) and locally with +`bun test:e2e`. + ### Live tests Tests that hit real RPCs or sandboxes (e.g. XCM dry-runs in `packages/shared`) are gated behind @@ -121,6 +137,10 @@ bun test:shared bun test:rebalancer bun test:sdk +# Playwright E2E journeys (non-blocking; starts its own Vite dev server) +# One-time per machine: cd apps/frontend && bunx playwright install chromium +bun test:e2e + # Opt-in live tests (real RPCs / sandboxes; needs credentials in .env) cd apps/api && RUN_LIVE_TESTS=1 bun test src/api/services/phases/ ``` diff --git a/package.json b/package.json index 8d8ec8fcc..5fde6a10b 100644 --- a/package.json +++ b/package.json @@ -126,6 +126,7 @@ "test:contracts:relayer": "bun run --cwd contracts/relayer test", "test:db:start": "bun run --cwd apps/api test:db:start", "test:db:stop": "bun run --cwd apps/api test:db:stop", + "test:e2e": "cd apps/frontend && bun run test:e2e", "test:frontend": "cd apps/frontend && bunx vitest run", "test:rebalancer": "cd apps/rebalancer && bun test", "test:sdk": "bun run --cwd packages/sdk test", From b8d41c9514d0dcf1c04cd55e74a35c6a7c0ff8ec Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 20:42:08 +0200 Subject: [PATCH 103/176] Add SDK-API contract tests over the BRL onramp corridor The real @vortexfi/sdk (imported from source) drives the real in-process API over HTTP: createQuote, registerRamp (including the SDK's internal limit pre-flight, ephemeral generation, signing, and ramp update), startRamp, and getRampStatus polling to completion, asserting the response shapes and the signed destinationTransfer that integrators depend on. Negative paths cover registerRamp without a secretKey and a foreign user's ramp surfacing as a typed 403 VortexSdkError. Hermetic setup: a fetch shim answers viem's single eth_chainId RPC in-memory (signing itself is local); everything else stays behind the fetch guard. The SDK's NetworkManager opens no chain WebSockets on this corridor - it only dials out when signing Substrate-network transactions, and the direct BRL corridor signs one Base EVM tx. --- apps/api/src/tests/sdk-contract.test.ts | 325 ++++++++++++++++++++++++ 1 file changed, 325 insertions(+) create mode 100644 apps/api/src/tests/sdk-contract.test.ts diff --git a/apps/api/src/tests/sdk-contract.test.ts b/apps/api/src/tests/sdk-contract.test.ts new file mode 100644 index 000000000..04158afdf --- /dev/null +++ b/apps/api/src/tests/sdk-contract.test.ts @@ -0,0 +1,325 @@ +import { afterAll, beforeAll, beforeEach, describe, expect, it } from "bun:test"; +import { + EPaymentMethod, + EvmToken, + evmTokenConfig, + FiatToken, + type GetRampStatusResponse, + Networks, + RampDirection +} from "@vortexfi/shared"; +import { decodeFunctionData, erc20Abi, parseTransaction, parseUnits } from "viem"; +import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"; +import { VortexSdk, VortexSdkError } from "../../../../packages/sdk/src"; +import RampState from "../models/rampState.model"; +import { resetTestDatabase, setupTestDatabase } from "../test-utils/db"; +import { createTestApiKey, createTestTaxId, createTestUser } from "../test-utils/factories"; +import { type FakeWorld, installFakeWorld } from "../test-utils/fake-world"; +import { startTestApp, type TestApp } from "../test-utils/test-app"; + +function requireBrlaOnBase() { + const details = evmTokenConfig[Networks.Base][EvmToken.BRLA]; + if (!details) { + throw new Error("BRLA token config missing for Base"); + } + return details; +} +const brlaTokenDetails = requireBrlaOnBase(); +const BRLA_ON_BASE = brlaTokenDetails.erc20AddressSourceChain as `0x${string}`; + +const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/; +const BASE_CHAIN_ID_HEX = "0x2105"; // 8453 + +/** + * The SDK signs EVM transactions through a real viem wallet client, and viem's + * signTransaction issues a single eth_chainId RPC before signing locally with + * the ephemeral key. Answer that one call in-memory (the corridor only signs on + * Base) and let every other request fall through to the fetch guard, so any + * genuine network use still fails loudly. The SDK's NetworkManager itself is + * inert here: it only opens chain WebSockets when signing Pendulum, Moonbeam, + * or Hydration transactions, and the direct BRL→BRLA-on-Base corridor produces + * a single Base EVM transaction. + */ +function installChainIdShim(): { restore: () => void } { + const guardedFetch = globalThis.fetch; + const shim = (async (input: Parameters[0], init?: Parameters[1]) => { + if (typeof init?.body === "string") { + try { + const payload = JSON.parse(init.body) as { id?: number; method?: string }; + if (payload.method === "eth_chainId") { + return Response.json({ id: payload.id ?? 1, jsonrpc: "2.0", result: BASE_CHAIN_ID_HEX }); + } + } catch { + // not JSON — let the guarded fetch decide + } + } + return guardedFetch(input, init); + }) as typeof fetch; + globalThis.fetch = Object.assign(shim, guardedFetch); + return { + restore: () => { + globalThis.fetch = guardedFetch; + } + }; +} + +/** + * SDK ↔ API contract tests: the real @vortexfi/sdk (imported from source) + * drives the real in-process API over HTTP on the BRL onramp corridor + * (pix → BRLA on Base; EUR is kill-switched at registerRamp). A response-shape + * change that would break SDK integrators fails here. + */ +describe("SDK ↔ API contract (BRL onramp, pix → BRLA on Base)", () => { + let world: FakeWorld; + let chainIdShim: { restore: () => void }; + let app: TestApp; + + beforeAll(async () => { + world = installFakeWorld(); + chainIdShim = installChainIdShim(); + await setupTestDatabase(); + app = await startTestApp(); + }); + + afterAll(async () => { + await app?.close(); + chainIdShim?.restore(); + world?.restore(); + }); + + beforeEach(async () => { + await resetTestDatabase(); + world.evm.failNextSends = 0; + world.evm.onTransaction = undefined; + world.brla.onPixOutputTicket = undefined; + world.brla.accountBalances = { BRLA: 0, USDC: 0, USDM: 0, USDT: 0 }; + }); + + /** A KYC'd user with a user-linked secret key, and an SDK authenticated as them. */ + async function createUserSdk(): Promise<{ sdk: VortexSdk; userId: string }> { + const user = await createTestUser(); + await createTestTaxId(user.id); + const { plaintextKey } = await createTestApiKey({ userId: user.id }); + // storeEphemeralKeys: false keeps the SDK from writing ephemerals_.json to disk. + const sdk = new VortexSdk({ apiBaseUrl: app.baseUrl, secretKey: plaintextKey, storeEphemeralKeys: false }); + return { sdk, userId: user.id }; + } + + function quoteRequest() { + return { + from: EPaymentMethod.PIX, + inputAmount: "100", + inputCurrency: FiatToken.BRL, + network: Networks.Base, + outputCurrency: EvmToken.BRLA, + rampType: RampDirection.BUY, + to: Networks.Base + } as const; + } + + /** + * Scripts the fake world so every polling loop in the corridor succeeds on + * its first check (same script as the corridor scenario tests): minted BRL is + * already on the Avenia subaccount, the ephemeral has Base gas, the + * Avenia→Base transfer credits BRLA instantly, and submitted raw ERC-20 + * transfers are applied to the in-memory ledger. + */ + function scriptHappyWorld(ephemeralAddress: string): void { + world.brla.accountBalances.BRLA = 1_000_000; + world.evm.setNativeBalance(Networks.Base, ephemeralAddress, parseUnits("0.001", 18)); + world.brla.onPixOutputTicket = ({ walletAddress }) => { + if (walletAddress) { + world.evm.setErc20Balance(Networks.Base, BRLA_ON_BASE, walletAddress, parseUnits("1000000", 18)); + } + }; + world.evm.onTransaction = tx => { + if (!tx.serialized) { + return; + } + const parsed = parseTransaction(tx.serialized as `0x${string}`); + if (!parsed.to || !parsed.data) { + return; + } + const { functionName, args } = decodeFunctionData({ abi: erc20Abi, data: parsed.data }); + if (functionName !== "transfer") { + return; + } + const [recipient, amount] = args as [`0x${string}`, bigint]; + world.evm.setErc20Balance( + tx.network, + parsed.to, + recipient, + world.evm.erc20Balance(tx.network, parsed.to, recipient) + amount + ); + }; + } + + /** Polls getRampStatus (itself part of the contract) until the ramp completes. */ + async function waitForComplete(sdk: VortexSdk, rampId: string): Promise { + const deadline = Date.now() + 20_000; + for (;;) { + const status = await sdk.getRampStatus(rampId); + if (status.currentPhase === "complete") { + return status; + } + // getRampStatus intentionally never reports "failed"; read the DB so a + // failed ramp aborts with its error logs instead of timing out. + const state = await RampState.findByPk(rampId); + if (state?.currentPhase === "failed") { + throw new Error(`Ramp ${rampId} failed: ${JSON.stringify(state.errorLogs)}`); + } + if (Date.now() > deadline) { + throw new Error(`Timed out waiting for ramp ${rampId} to complete (phase: ${status.currentPhase})`); + } + await Bun.sleep(50); + } + } + + it( + "drives the full onramp lifecycle: createQuote → registerRamp → startRamp → getRampStatus", + async () => { + const { sdk, userId } = await createUserSdk(); + const destination = privateKeyToAccount(generatePrivateKey()).address; + + const quote = await sdk.createQuote(quoteRequest()); + + // Quote contract: the fields the SDK's QuoteResponse type promises to integrators. + expect(quote.id).toMatch(UUID_PATTERN); + expect(quote.rampType).toBe(RampDirection.BUY); + expect(quote.from).toBe(EPaymentMethod.PIX); + expect(quote.to).toBe(Networks.Base); + expect(quote.network).toBe(Networks.Base); + // The API normalizes fiat amounts to two decimals ("100" -> "100.00"). + expect(Number(quote.inputAmount)).toBe(100); + expect(quote.inputCurrency).toBe(FiatToken.BRL); + expect(quote.outputCurrency).toBe(EvmToken.BRLA); + expect(Number(quote.outputAmount)).toBeGreaterThan(0); + expect(new Date(quote.expiresAt).getTime()).toBeGreaterThan(Date.now()); + const feeFields = [ + quote.networkFeeFiat, + quote.anchorFeeFiat, + quote.vortexFeeFiat, + quote.partnerFeeFiat, + quote.totalFeeFiat, + quote.processingFeeFiat, + quote.networkFeeUsd, + quote.anchorFeeUsd, + quote.vortexFeeUsd, + quote.partnerFeeUsd, + quote.totalFeeUsd, + quote.processingFeeUsd + ]; + for (const fee of feeFields) { + expect(Number.isFinite(Number(fee))).toBe(true); + } + expect(quote.feeCurrency).toBeTruthy(); + + // registerRamp runs the SDK's full internal flow: BRL limit pre-flight, + // ephemeral generation (Substrate + EVM), /v1/ramp/register, signing the + // returned unsignedTxs, and /v1/ramp/update with the presigned txs. + const { rampProcess, unsignedTransactions } = await sdk.registerRamp(quote, { destinationAddress: destination }); + + // Onramps carry no user-wallet transactions. + expect(unsignedTransactions).toEqual([]); + expect(rampProcess.id).toMatch(UUID_PATTERN); + expect(rampProcess.quoteId).toBe(quote.id); + expect(rampProcess.type).toBe(RampDirection.BUY); + expect(rampProcess.currentPhase).toBe("initial"); + // Amount decimal padding differs between endpoints; the numeric value is the contract. + expect(Number(rampProcess.inputAmount)).toBe(Number(quote.inputAmount)); + expect(Number(rampProcess.outputAmount)).toBe(Number(quote.outputAmount)); + const unsigned = rampProcess.unsignedTxs ?? []; + expect(unsigned).toHaveLength(1); + expect(unsigned[0].phase).toBe("destinationTransfer"); + expect(unsigned[0].network).toBe(Networks.Base); + const ephemeralAddress = unsigned[0].signer; + + // The SDK-signed transfer stored by /v1/ramp/update must pay the + // registered destination exactly the quoted BRLA on Base — the core + // signing contract between SDK and backend. + const stored = await RampState.findByPk(rampProcess.id); + expect(stored?.userId).toBe(userId); + const presigned = stored?.presignedTxs ?? []; + expect(presigned).toHaveLength(1); + expect(presigned[0].phase).toBe("destinationTransfer"); + expect(presigned[0].signer).toBe(ephemeralAddress); + const parsed = parseTransaction(presigned[0].txData as `0x${string}`); + expect(parsed.chainId).toBe(8453); + expect(parsed.to?.toLowerCase()).toBe(BRLA_ON_BASE.toLowerCase()); + if (!parsed.data) { + throw new Error("Presigned destinationTransfer has no calldata"); + } + const decoded = decodeFunctionData({ abi: erc20Abi, data: parsed.data }); + expect(decoded.functionName).toBe("transfer"); + const amountRaw = parseUnits(quote.outputAmount, brlaTokenDetails.decimals); + expect(decoded.args).toEqual([destination, amountRaw]); + + // startRamp re-validates the SDK's presigned txs server-side (including + // backup-transaction requirements) and kicks off processing. + scriptHappyWorld(ephemeralAddress); + const started = await sdk.startRamp(rampProcess.id); + expect(started.id).toBe(rampProcess.id); + expect(started.quoteId).toBe(quote.id); + + const status = await waitForComplete(sdk, rampProcess.id); + expect(status.id).toBe(rampProcess.id); + expect(status.quoteId).toBe(quote.id); + expect(status.type).toBe(RampDirection.BUY); + expect(status.from).toBe(EPaymentMethod.PIX); + expect(status.to).toBe(Networks.Base); + expect(Number(status.inputAmount)).toBe(Number(quote.inputAmount)); + expect(Number(status.outputAmount)).toBe(Number(quote.outputAmount)); + expect(status.transactionHash).toBeTruthy(); + + // End to end, the destination received the quoted amount in the fake ledger. + expect(world.evm.erc20Balance(Networks.Base, BRLA_ON_BASE, destination)).toBe(amountRaw); + }, + 30000 + ); + + it( + "registerRamp without a secretKey fails fast in the SDK, before any registration call", + async () => { + const anonymous = new VortexSdk({ apiBaseUrl: app.baseUrl, storeEphemeralKeys: false }); + // Quotes stay anonymous-eligible (rate discovery); only registration requires the key. + const quote = await anonymous.createQuote(quoteRequest()); + const destination = privateKeyToAccount(generatePrivateKey()).address; + + await expect(anonymous.registerRamp(quote, { destinationAddress: destination })).rejects.toThrow( + /requires a user-linked secretKey/ + ); + }, + 30000 + ); + + it( + "a foreign user's ramp surfaces as a typed VortexSdkError with status 403", + async () => { + const owner = await createUserSdk(); + const stranger = await createUserSdk(); + const destination = privateKeyToAccount(generatePrivateKey()).address; + + const quote = await owner.sdk.createQuote(quoteRequest()); + const { rampProcess } = await owner.sdk.registerRamp(quote, { destinationAddress: destination }); + + const statusError = await stranger.sdk.getRampStatus(rampProcess.id).then( + () => null, + error => error + ); + expect(statusError).toBeInstanceOf(VortexSdkError); + expect((statusError as VortexSdkError).status).toBe(403); + + const startError = await stranger.sdk.startRamp(rampProcess.id).then( + () => null, + error => error + ); + expect(startError).toBeInstanceOf(VortexSdkError); + expect((startError as VortexSdkError).status).toBe(403); + + // The owner is unaffected. + const status = await owner.sdk.getRampStatus(rampProcess.id); + expect(status.id).toBe(rampProcess.id); + }, + 30000 + ); +}); From 4a9cf61687bba8ed5721decb31a131f6863cb8e9 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 20:42:57 +0200 Subject: [PATCH 104/176] Close remaining hermeticity gaps in unit tests - clientIp.test.ts: use a non-loopback request IP so the test no longer triggers a real ipify.org lookup, and assert the exact normalized value instead of typeof string (which passed on any outcome). - vars.test.ts: add FLOW_VARIANT to the required production env and run the subprocess with cwd=os.tmpdir() so bun's auto-loaded .env can no longer backfill variables the scenarios deliberately leave unset. - base.service.test.ts: restore the patched sequelize/QuoteTicket statics in afterAll (bun runs all test files in one process). - rebalancer config.test.ts: scrub REBALANCING_DAILY_BRIDGE_LIMIT_USD like the other policy vars; the missing-env default test now genuinely exercises the default even when the variable is set ambiently. --- apps/api/src/api/helpers/clientIp.test.ts | 6 ++++-- .../src/api/services/ramp/base.service.test.ts | 18 +++++++++++++++++- apps/api/src/config/vars.test.ts | 5 +++++ apps/rebalancer/src/utils/config.test.ts | 1 + 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/apps/api/src/api/helpers/clientIp.test.ts b/apps/api/src/api/helpers/clientIp.test.ts index 8b0434978..dba3c5ff4 100644 --- a/apps/api/src/api/helpers/clientIp.test.ts +++ b/apps/api/src/api/helpers/clientIp.test.ts @@ -17,10 +17,12 @@ describe("normalizeClientIp", () => { describe("enrichAdditionalDataWithClientIp", () => { it("adds the normalized request IP when additional data does not include one", async () => { - const additionalData = await enrichAdditionalDataWithClientIp({ email: "user@example.com" }, { ip: "::1" }); + // A non-loopback request IP: loopback would trigger the real public-IP lookup + // (fetchHostPublicIp) in non-production, making the result network-dependent. + const additionalData = await enrichAdditionalDataWithClientIp({ email: "user@example.com" }, { ip: "::ffff:203.0.113.42" }); expect(additionalData?.email).toBe("user@example.com"); - expect(typeof additionalData?.ipAddress).toBe("string"); + expect(additionalData?.ipAddress).toBe("203.0.113.42"); }); it("keeps a provided IPv4 address over the request IP", async () => { diff --git a/apps/api/src/api/services/ramp/base.service.test.ts b/apps/api/src/api/services/ramp/base.service.test.ts index 384024c87..2def3db66 100644 --- a/apps/api/src/api/services/ramp/base.service.test.ts +++ b/apps/api/src/api/services/ramp/base.service.test.ts @@ -1,4 +1,4 @@ -import {beforeEach, describe, expect, it, mock} from "bun:test"; +import {afterAll, beforeEach, describe, expect, it, mock} from "bun:test"; import {Op} from "sequelize"; import sequelize from "../../../config/database"; import QuoteTicket from "../../../models/quoteTicket.model"; @@ -31,12 +31,28 @@ const updateMock = mock(async (_values: unknown, _options: QuoteCleanupOptions) const findAllMock = mock(async (_options: QuoteCleanupOptions) => [{ id: "expired-quote-1" }, { id: "expired-quote-2" }]); const destroyMock = mock(async (_options: QuoteCleanupOptions) => 2); +// bun runs all test files in one process — restore the patched singletons in +// afterAll so later files don't run against these fakes. +const originalTransaction = sequelize.transaction; +const originalQuery = sequelize.query; +const originalUpdate = QuoteTicket.update; +const originalFindAll = QuoteTicket.findAll; +const originalDestroy = QuoteTicket.destroy; + sequelize.transaction = transactionMock as unknown as typeof sequelize.transaction; sequelize.query = queryMock as unknown as typeof sequelize.query; QuoteTicket.update = updateMock as unknown as typeof QuoteTicket.update; QuoteTicket.findAll = findAllMock as unknown as typeof QuoteTicket.findAll; QuoteTicket.destroy = destroyMock as unknown as typeof QuoteTicket.destroy; +afterAll(() => { + sequelize.transaction = originalTransaction; + sequelize.query = originalQuery; + QuoteTicket.update = originalUpdate; + QuoteTicket.findAll = originalFindAll; + QuoteTicket.destroy = originalDestroy; +}); + describe("BaseRampService.cleanupExpiredQuotes", () => { let service: BaseRampService; diff --git a/apps/api/src/config/vars.test.ts b/apps/api/src/config/vars.test.ts index 0a3254e6d..2e83fc47c 100644 --- a/apps/api/src/config/vars.test.ts +++ b/apps/api/src/config/vars.test.ts @@ -1,10 +1,12 @@ import {describe, expect, it} from "bun:test"; +import os from "node:os"; const varsModuleUrl = new URL("./vars.ts", import.meta.url).href; const bunExecutable = Bun.argv[0]; const requiredProductionEnv = { ADMIN_SECRET: "test-admin-secret", + FLOW_VARIANT: "monerium", METRICS_DASHBOARD_SECRET: "test-metrics-dashboard-secret", SUPABASE_ANON_KEY: "test-anon-key", SUPABASE_SERVICE_KEY: "test-service-key", @@ -19,6 +21,9 @@ async function importVarsWithEnv(env: Record) { "-e", `import(${JSON.stringify(varsModuleUrl)}).then(() => console.log("ok")).catch(error => { console.error(error instanceof Error ? error.message : String(error)); process.exit(1); })` ], + // A cwd without .env files: bun auto-loads .env from the cwd, which would + // silently backfill variables these scenarios deliberately leave unset. + cwd: os.tmpdir(), env: { PATH: process.env.PATH ?? "", ...requiredProductionEnv, diff --git a/apps/rebalancer/src/utils/config.test.ts b/apps/rebalancer/src/utils/config.test.ts index d17151cf5..8d33d0c43 100644 --- a/apps/rebalancer/src/utils/config.test.ts +++ b/apps/rebalancer/src/utils/config.test.ts @@ -8,6 +8,7 @@ import { const policyEnvVars = [ "EVM_ACCOUNT_SECRET", + "REBALANCING_DAILY_BRIDGE_LIMIT_USD", "REBALANCING_USD_TO_BRL_AMOUNT", "REBALANCING_PROFITABLE_USD_TO_BRL_AMOUNT", "REBALANCING_POLICY_MODE", From 2e9cf15a6e60a25ecea853da2b8a568971d30f23 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 20:43:25 +0200 Subject: [PATCH 105/176] Fix cannot-fail assertions and stale fixtures from the test audit - priceFeed.service.test.ts: the "without API key" test asserted absence of x-cg-demo-api-key, a header production never sets; it now controls the key on the instance (the config snapshot made env deletion inert) and asserts absence of x-cg-pro-api-key, with a positive-presence companion test. The exported singleton's caches are cleared in beforeEach so cache-hit/fetch-count assertions no longer depend on test order. Deleted the duplicate "default values" config test whose env deletions could not influence the outcome. - brla-onramp-hold.test.ts: the missing-ticket case asserted the fixture's own initial value; it now asserts updateState was not called. - squid-router-phase-handler.test.ts: the Monerium fixture declared a BUY ramp to Base with quote.network=Polygon, an impossible combination (quote.network is the destination by construction), locking the pre-settlement snapshot onto the wrong chain; fixture and assertion now pin (Base, USDC). - ramp.service.register-auth.test.ts: the no-effective-user test now pins the guard's message; without it, a later unrelated 400 (missing destinationAddress) satisfied the status-only assertion even with the guard deleted. - discount/helpers.test.ts: the "negative targetDiscount (rate floor)" block never touched the rate-floor code (calculateSubsidyAmount has no discount parameter); replaced with genuine calculateExpectedOutput coverage (negative/positive discount, offramp price inversion). - webhook.service.test.ts: the not-found test pins status 404 + message (any wrapped error satisfied instanceof APIError); the registration-error test resolves the quote lookup so the rejection genuinely comes from Webhook.create and pins 500. Removed the orphaned randomBytes mock left from the deleted crypto module mock. --- .../squid-router-phase-handler.test.ts | 7 ++- .../phases/helpers/brla-onramp-hold.test.ts | 7 +-- .../api/services/priceFeed.service.test.ts | 55 +++++++++---------- .../quote/engines/discount/helpers.test.ts | 38 ++++++------- .../ramp/ramp.service.register-auth.test.ts | 5 +- .../webhook/__tests__/webhook.service.test.ts | 32 +++++++---- 6 files changed, 77 insertions(+), 67 deletions(-) diff --git a/apps/api/src/api/services/phases/handlers/squid-router-phase-handler.test.ts b/apps/api/src/api/services/phases/handlers/squid-router-phase-handler.test.ts index ca4c3931c..b38408e0a 100644 --- a/apps/api/src/api/services/phases/handlers/squid-router-phase-handler.test.ts +++ b/apps/api/src/api/services/phases/handlers/squid-router-phase-handler.test.ts @@ -206,7 +206,10 @@ describe("SquidRouterPhaseHandler", () => { outputAmountRaw: "1000" } }, - network: Networks.Polygon, + // quote.network for a BUY ramp is by construction the destination network + // (quote.controller getNetworkFromDestination(to)); the pre-settlement snapshot + // must read the destination-chain balance, so this pins Base, not Polygon. + network: Networks.Base, outputCurrency: EvmToken.USDC, to: Networks.Base }; @@ -215,7 +218,7 @@ describe("SquidRouterPhaseHandler", () => { const updatedState = await handler.execute(makeState()); expect(sendRawTransaction).toHaveBeenCalledTimes(2); - expect(getOnChainTokenDetails).toHaveBeenCalledWith(Networks.Polygon, EvmToken.USDC); + expect(getOnChainTokenDetails).toHaveBeenCalledWith(Networks.Base, EvmToken.USDC); expect(getEvmBalance).toHaveBeenCalledTimes(1); expect(sendRawTransaction.mock.calls[0][0]).toEqual({ serializedTransaction: APPROVE_TX }); expect(sendRawTransaction.mock.calls[1][0]).toEqual({ serializedTransaction: SWAP_TX }); diff --git a/apps/api/src/api/services/phases/helpers/brla-onramp-hold.test.ts b/apps/api/src/api/services/phases/helpers/brla-onramp-hold.test.ts index 9f9444a04..0cbec2f74 100644 --- a/apps/api/src/api/services/phases/helpers/brla-onramp-hold.test.ts +++ b/apps/api/src/api/services/phases/helpers/brla-onramp-hold.test.ts @@ -62,12 +62,11 @@ describe("syncAveniaOnHoldState", () => { it("does not update state when the Avenia pay-in ticket is missing", async () => { getAveniaPayinTickets.mockImplementationOnce(async () => []); const state = makeState(false); + const updateState = mock(async () => {}); - const ticketFound = await syncAveniaOnHoldState(state.state, async nextState => { - Object.assign(state.state, nextState); - }, brlaApiService, "subaccount-1"); + const ticketFound = await syncAveniaOnHoldState(state.state, updateState, brlaApiService, "subaccount-1"); expect(ticketFound).toBe(false); - expect(state.state.onHold).toBe(false); + expect(updateState).not.toHaveBeenCalled(); }); }); diff --git a/apps/api/src/api/services/priceFeed.service.test.ts b/apps/api/src/api/services/priceFeed.service.test.ts index b99ac3bfe..2fe57980b 100644 --- a/apps/api/src/api/services/priceFeed.service.test.ts +++ b/apps/api/src/api/services/priceFeed.service.test.ts @@ -192,6 +192,11 @@ describe("PriceFeedService", () => { // Ensure singleton is reset *before* each test to pick up fresh env vars/mocks // @ts-expect-error - accessing private property for testing PriceFeedService.instance = undefined; + + // The exported module-level singleton keeps its caches across tests; without + // clearing them, cache-hit/miss and fetch call-count assertions depend on test order. + (priceFeedService as any).cryptoPriceCache.clear(); + (priceFeedService as any).fiatExchangeRateCache.clear(); }); afterEach(() => { @@ -377,14 +382,29 @@ describe("PriceFeedService", () => { await expect(freshInstance.getCryptoPrice("bitcoin", "usd")).rejects.toThrow("Network error"); }); - it("should work without API key", async () => { - // Remove API key - delete process.env.COINGECKO_API_KEY; + it("should attach the CoinGecko pro API key header when a key is configured", async () => { + // @ts-expect-error - accessing private property for testing + PriceFeedService.instance = undefined; + const serviceInstance = PriceFeedService.getInstance(); + // The constructor reads config/vars (snapshotted at import), so the key is + // controlled on the instance rather than via process.env. + Object.assign(serviceInstance, { coingeckoApiKey: "test-api-key" }); + + await serviceInstance.getCryptoPrice("bitcoin", "usd"); + + expect(fetchMock).toHaveBeenCalledWith( + expect.any(String), + expect.objectContaining({ + headers: expect.objectContaining({ "x-cg-pro-api-key": "test-api-key" }) + }) + ); + }); - // Reset singleton to apply change + it("should work without API key", async () => { // @ts-expect-error - accessing private property for testing PriceFeedService.instance = undefined; - const serviceInstance = PriceFeedService.getInstance(); // Get new instance + const serviceInstance = PriceFeedService.getInstance(); + Object.assign(serviceInstance, { coingeckoApiKey: undefined }); await serviceInstance.getCryptoPrice("bitcoin", "usd"); @@ -392,7 +412,7 @@ describe("PriceFeedService", () => { expect.any(String), expect.objectContaining({ headers: expect.not.objectContaining({ - "x-cg-demo-api-key": expect.any(String) // Verify header is NOT present + "x-cg-pro-api-key": expect.any(String) // The header production actually sets }) }) ); @@ -570,29 +590,6 @@ describe("PriceFeedService", () => { }); describe("Configuration", () => { - it("should use default values when environment variables are not set", () => { - // Remove environment variables that have defaults - delete process.env.COINGECKO_API_URL; - delete process.env.CRYPTO_CACHE_TTL_MS; - delete process.env.FIAT_CACHE_TTL_MS; - // API key might be undefined, which is handled - - // Reset singleton to apply changes - // @ts-expect-error - accessing private property for testing - PriceFeedService.instance = undefined; - - // Create new instance - const instance = PriceFeedService.getInstance(); - - // Access private properties for testing (consider adding public getters if preferred) - // @ts-expect-error - accessing private properties for testing - expect(instance.coingeckoApiBaseUrl).toBe("https://pro-api.coingecko.com/api/v3"); - // @ts-expect-error - accessing private properties for testing - expect(instance.cryptoCacheTtlMs).toBe(300000); - // @ts-expect-error - accessing private properties for testing - expect(instance.fiatCacheTtlMs).toBe(300000); - }); - it("should keep loaded configuration values when environment variables change after import", () => { // Set specific values after the config module has already been imported process.env.COINGECKO_API_URL = "https://custom-api.example.com"; diff --git a/apps/api/src/api/services/quote/engines/discount/helpers.test.ts b/apps/api/src/api/services/quote/engines/discount/helpers.test.ts index 549ac5b9d..4ed4c4397 100644 --- a/apps/api/src/api/services/quote/engines/discount/helpers.test.ts +++ b/apps/api/src/api/services/quote/engines/discount/helpers.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "bun:test"; import Big from "big.js"; -import { calculateSubsidyAmount } from "./helpers"; +import { calculateExpectedOutput, calculateSubsidyAmount } from "./helpers"; describe("calculateSubsidyAmount", () => { it("returns 0 when actual output meets expected output", () => { @@ -30,26 +30,26 @@ describe("calculateSubsidyAmount", () => { expect(result.toString()).toBe("5"); }); - describe("negative targetDiscount scenarios (rate floor)", () => { - it("subsidizes when actual is below negative-target expected output", () => { - const result = calculateSubsidyAmount(new Big(99.9), new Big(99.5), 0); - expect(result.toString()).toBe("0.4"); - }); +}); - it("returns 0 when actual already meets negative-target expected output", () => { - const result = calculateSubsidyAmount(new Big(99.9), new Big(99.9), 0); - expect(result.toString()).toBe("0"); - }); +// The negative-discount / rate-floor logic lives in calculateExpectedOutput, not +// calculateSubsidyAmount (which only sees the resulting expectedOutput). +describe("calculateExpectedOutput with negative targetDiscount (rate floor)", () => { + it("lowers the expected output below the oracle rate for an onramp", () => { + const { expectedOutput, adjustedTargetDiscount } = calculateExpectedOutput("100", new Big(1), -0.001, false, null); + // rate = 1 * (1 - 0.001) = 0.999 + expect(expectedOutput.toString()).toBe("99.9"); + expect(adjustedTargetDiscount.toString()).toBe("-0.001"); + }); - it("returns 0 when actual exceeds negative-target expected output", () => { - const result = calculateSubsidyAmount(new Big(99.9), new Big(100.5), 0); - expect(result.toString()).toBe("0"); - }); + it("inverts the oracle price for offramps before applying the discount", () => { + const { expectedOutput } = calculateExpectedOutput("100", new Big(5), -0.01, true, null); + // USD-FIAT rate = 1/5 = 0.2; discounted = 0.2 * 0.99 = 0.198 + expect(expectedOutput.toString()).toBe("19.8"); + }); - it("caps subsidy at maxSubsidy for negative target", () => { - const result = calculateSubsidyAmount(new Big(99.9), new Big(98.0), 0.01); - // shortfall=1.9, maxAllowed=99.9*0.01=0.999 - expect(result.toString()).toBe("0.999"); - }); + it("applies a positive targetDiscount as a rate premium", () => { + const { expectedOutput } = calculateExpectedOutput("100", new Big(1), 0.02, false, null); + expect(expectedOutput.toString()).toBe("102"); }); }); diff --git a/apps/api/src/api/services/ramp/ramp.service.register-auth.test.ts b/apps/api/src/api/services/ramp/ramp.service.register-auth.test.ts index 1601ab4b3..e19cb9a41 100644 --- a/apps/api/src/api/services/ramp/ramp.service.register-auth.test.ts +++ b/apps/api/src/api/services/ramp/ramp.service.register-auth.test.ts @@ -67,6 +67,9 @@ describe("RampService.registerRamp user gating", () => { it("rejects registration with no effective user (e.g. unlinked partner key) with 400", async () => { stubQuote({ userId: null }); - await expectRegisterError(undefined, httpStatus.BAD_REQUEST); + const error = await expectRegisterError(undefined, httpStatus.BAD_REQUEST); + // Pin the guard's own message: without it, registration still fails later with a + // different 400 (missing destinationAddress), which must not satisfy this test. + expect(error.message).toContain("requires an API key linked to a user"); }); }); diff --git a/apps/api/src/api/services/webhook/__tests__/webhook.service.test.ts b/apps/api/src/api/services/webhook/__tests__/webhook.service.test.ts index f742c3f57..ba9d62b48 100644 --- a/apps/api/src/api/services/webhook/__tests__/webhook.service.test.ts +++ b/apps/api/src/api/services/webhook/__tests__/webhook.service.test.ts @@ -53,12 +53,8 @@ const findAllMock = mock(async (): Promise => ([])); const destroyMock = mock(async (): Promise => true); const updateMock = mock(async (): Promise => ({})); -// Mock RampState const quoteTicketFindByPkMock = mock(async (): Promise => ({})); -// Mock crypto -const randomBytesMock = mock(() => Buffer.from('1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef', 'hex')); - // Mock modules mock.module('../../../../models/webhook.model', () => ({ default: { @@ -95,8 +91,6 @@ describe('WebhookService', () => { destroyMock.mockReset(); updateMock.mockReset(); quoteTicketFindByPkMock.mockReset(); - - // Setup default crypto mock }); describe('registerWebhook', () => { @@ -201,14 +195,22 @@ describe('WebhookService', () => { }); it('should handle registration errors', async () => { - // Setup mocks + // Setup mocks — the quote lookup must succeed so the rejection genuinely + // comes from Webhook.create, not from an earlier validation step. + quoteTicketFindByPkMock.mockResolvedValue({ id: 'quote-123' }); createMock.mockRejectedValue(new Error('Database error')); // Execute and verify - await expect(webhookService.registerWebhook({ + const error = await webhookService.registerWebhook({ url: 'https://example.com/webhook', quoteId: 'quote-123' - })).rejects.toBeInstanceOf(APIError); + }).then( + () => { throw new Error('registerWebhook did not reject'); }, + e => e + ); + expect(error).toBeInstanceOf(APIError); + expect((error as APIError).status).toBe(500); + expect(createMock).toHaveBeenCalled(); }); it('should reject non-HTTPS URLs', async () => { @@ -255,11 +257,17 @@ describe('WebhookService', () => { // Setup mocks - quote not found quoteTicketFindByPkMock.mockResolvedValue(null); - // Execute and verify - await expect(webhookService.registerWebhook({ + // Execute and verify — pin the 404 so a generic wrapped error can't satisfy this + const error = await webhookService.registerWebhook({ url: 'https://example.com/webhook', quoteId: 'non-existent-quote' - })).rejects.toBeInstanceOf(APIError); + }).then( + () => { throw new Error('registerWebhook did not reject'); }, + e => e + ); + expect(error).toBeInstanceOf(APIError); + expect((error as APIError).status).toBe(404); + expect((error as APIError).message).toContain('not found'); }); }); From a72815f17241861c0cf816a424ce85636bc1049f Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 20:43:38 +0200 Subject: [PATCH 106/176] Rebuild the quarantined EUR-onramp validation cases on the Base BRL corridor The six it.skip'd cases asserted a removed flow: their fixture placed nablaApprove on Polygon, which the polymorphic-phase refactor now classifies as Substrate, so validation rejected the fixture before any asserted behavior ran. The fixture is rebuilt on the live BRL onramp Base corridor (nablaApprove / squidRouterSwap / destinationTransfer on Networks.Base, chainId 8453) and all six tests are un-skipped; the new fixture also exercises the nabla-on-Base=EVM branch that broke the old one. Deleted the cannot-fail "matches a signed EVM transaction to the unsigned server-built transaction" test: areAllTxsIncluded compares only phase/network/nonce/signer, all identical by construction via spread, so its ~30-line signing ceremony could not influence the assertion. The neighboring calldata-differences test covers the same matching behavior honestly. --- .../services/transactions/validation.test.ts | 106 ++++++------------ 1 file changed, 33 insertions(+), 73 deletions(-) diff --git a/apps/api/src/api/services/transactions/validation.test.ts b/apps/api/src/api/services/transactions/validation.test.ts index b886a8a4d..80998e934 100644 --- a/apps/api/src/api/services/transactions/validation.test.ts +++ b/apps/api/src/api/services/transactions/validation.test.ts @@ -135,16 +135,20 @@ function withBackups(tx: PresignedTx): PresignedTx { return { ...tx, meta: { additionalTxs } }; } -const VALID_EXAMPLE_PRESIGNED_TX_EUR_ONRAMP: PresignedTx[] = await Promise.all([ - makeSignedEvmTxWithBackups({ nonce: 0, phase: "nablaApprove", network: Networks.Polygon }), - makeSignedEvmTxWithBackups({ nonce: 1, phase: "squidRouterApprove", network: Networks.Polygon }), - makeSignedEvmTxWithBackups({ nonce: 2, phase: "squidRouterSwap", network: Networks.Polygon }), +// All-EVM presigned set on the live BRL onramp Base corridor (see the backend +// onramp_brl phase chain): nabla phases classify as EVM on Base per +// getTransactionTypeForPhase, and destinationTransfer/squidRouterSwap are EVM +// everywhere. Signed with chainId 8453 to match Networks.Base. +const VALID_EXAMPLE_PRESIGNED_TX_BASE_ONRAMP: PresignedTx[] = await Promise.all([ + makeSignedEvmTxWithBackups({ chainId: 8453, network: Networks.Base, nonce: 0, phase: "nablaApprove" }), + makeSignedEvmTxWithBackups({ chainId: 8453, network: Networks.Base, nonce: 1, phase: "squidRouterSwap" }), + makeSignedEvmTxWithBackups({ chainId: 8453, network: Networks.Base, nonce: 2, phase: "destinationTransfer" }), ]); -const VALID_EXAMPLE_UNSIGNED_TX_EUR_ONRAMP: PresignedTx[] = [ - { meta: {}, network: Networks.Polygon, nonce: 0, phase: "nablaApprove", signer: EVM_SIGNER, txData: { data: "0x12345678", gas: "21000", maxFeePerGas: "1000000000", maxPriorityFeePerGas: "1000000000", to: "0x000000000000000000000000000000000000dEaD", value: "0" } }, - { meta: {}, network: Networks.Polygon, nonce: 1, phase: "squidRouterApprove", signer: EVM_SIGNER, txData: { data: "0x12345678", gas: "21000", maxFeePerGas: "1000000000", maxPriorityFeePerGas: "1000000000", to: "0x000000000000000000000000000000000000dEaD", value: "0" } }, - { meta: {}, network: Networks.Polygon, nonce: 2, phase: "squidRouterSwap", signer: EVM_SIGNER, txData: { data: "0x12345678", gas: "21000", maxFeePerGas: "1000000000", maxPriorityFeePerGas: "1000000000", to: "0x000000000000000000000000000000000000dEaD", value: "0" } }, +const VALID_EXAMPLE_UNSIGNED_TX_BASE_ONRAMP: PresignedTx[] = [ + { meta: {}, network: Networks.Base, nonce: 0, phase: "nablaApprove", signer: EVM_SIGNER, txData: { data: "0x12345678", gas: "21000", maxFeePerGas: "1000000000", maxPriorityFeePerGas: "1000000000", to: "0x000000000000000000000000000000000000dEaD", value: "0" } }, + { meta: {}, network: Networks.Base, nonce: 1, phase: "squidRouterSwap", signer: EVM_SIGNER, txData: { data: "0x12345678", gas: "21000", maxFeePerGas: "1000000000", maxPriorityFeePerGas: "1000000000", to: "0x000000000000000000000000000000000000dEaD", value: "0" } }, + { meta: {}, network: Networks.Base, nonce: 2, phase: "destinationTransfer", signer: EVM_SIGNER, txData: { data: "0x12345678", gas: "21000", maxFeePerGas: "1000000000", maxPriorityFeePerGas: "1000000000", to: "0x000000000000000000000000000000000000dEaD", value: "0" } }, ]; const VALID_EXAMPLE_PRESIGNED_TX_BRL_ONRAMP: PresignedTx[] = [ @@ -208,44 +212,6 @@ const VALID_EXAMPLE_UNSIGNED_TX_BRL_ONRAMP: PresignedTx[] = [ describe("Presigned Transaction validation", () => { - it("matches a signed EVM transaction to the unsigned server-built transaction", async () => { - const unsignedTxData: EvmTransactionData = { - data: "0x12345678", - gas: "21000", - maxFeePerGas: "1000000000", - maxPriorityFeePerGas: "1000000000", - to: "0x000000000000000000000000000000000000dEaD", - value: "1" - }; - const signedRawTx = await EVM_WALLET.signTransaction({ - chainId: 137, - data: unsignedTxData.data, - gasLimit: BigInt(unsignedTxData.gas), - maxFeePerGas: BigInt(unsignedTxData.maxFeePerGas!), - maxPriorityFeePerGas: BigInt(unsignedTxData.maxPriorityFeePerGas!), - nonce: 4, - to: unsignedTxData.to, - type: 2, - value: BigInt(unsignedTxData.value) - }); - - const unsignedTx: PresignedTx = { - meta: {}, - network: Networks.Polygon, - nonce: 4, - phase: "fundEphemeral", - signer: EVM_WALLET.address, - txData: unsignedTxData - }; - const signedTx: PresignedTx = { - ...unsignedTx, - txData: signedRawTx - }; - - // change to use universal "validator" - expect(areAllTxsIncluded([signedTx], [unsignedTx])).toBe(true); - }); - it("includes a signed EVM transaction regardless of txData calldata differences (correctness is validated elsewhere)", async () => { const unsignedTxData: EvmTransactionData = { data: "0x12345678", @@ -384,17 +350,15 @@ describe("Presigned Transaction validation", () => { } }); - // QUARANTINED (stale EUR-onramp fixtures assert a removed flow; see docs/test-audit-findings.md): - it.skip("should pass validation for valid presigned EVM transactions", async () => { + it("should pass validation for valid presigned EVM transactions", async () => { const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; - await expect(validatePresignedTxs(RampDirection.BUY, VALID_EXAMPLE_PRESIGNED_TX_EUR_ONRAMP, ephemerals, VALID_EXAMPLE_UNSIGNED_TX_EUR_ONRAMP)).resolves.toBeUndefined(); + await expect(validatePresignedTxs(RampDirection.BUY, VALID_EXAMPLE_PRESIGNED_TX_BASE_ONRAMP, ephemerals, VALID_EXAMPLE_UNSIGNED_TX_BASE_ONRAMP)).resolves.toBeUndefined(); }); - // QUARANTINED (stale EUR-onramp fixtures assert a removed flow; see docs/test-audit-findings.md): - it.skip("should pass validation for single valid presigned transaction", async () => { - const singleTx: PresignedTx[] = [VALID_EXAMPLE_PRESIGNED_TX_EUR_ONRAMP[0]]; - const singleUnsigned: PresignedTx[] = [VALID_EXAMPLE_UNSIGNED_TX_EUR_ONRAMP[0]]; + it("should pass validation for single valid presigned transaction", async () => { + const singleTx: PresignedTx[] = [VALID_EXAMPLE_PRESIGNED_TX_BASE_ONRAMP[0]]; + const singleUnsigned: PresignedTx[] = [VALID_EXAMPLE_UNSIGNED_TX_BASE_ONRAMP[0]]; const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; @@ -442,26 +406,24 @@ describe("Presigned Transaction validation", () => { }); it("should throw error for too many transactions", async () => { - const invalidTxs: PresignedTx[] = new Array(101).fill(VALID_EXAMPLE_PRESIGNED_TX_EUR_ONRAMP[0]); + const invalidTxs: PresignedTx[] = new Array(101).fill(VALID_EXAMPLE_PRESIGNED_TX_BASE_ONRAMP[0]); const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "5FxM3dFCnXJXEbMozuVbhEUQuQK1gmquFpUJ577HebqBc7pz", EVM: EVM_SIGNER_2 }; await expect(validatePresignedTxs(RampDirection.BUY, invalidTxs, ephemerals, [])).rejects.toThrow("presignedTxs must be an array with 1-100 elements"); }); - // QUARANTINED (stale EUR-onramp fixtures assert a removed flow; see docs/test-audit-findings.md): - it.skip("should throw when an ephemeral transaction is missing backup transactions", async () => { - const invalidTxs: PresignedTx[] = JSON.parse(JSON.stringify(VALID_EXAMPLE_PRESIGNED_TX_EUR_ONRAMP)); + it("should throw when an ephemeral transaction is missing backup transactions", async () => { + const invalidTxs: PresignedTx[] = JSON.parse(JSON.stringify(VALID_EXAMPLE_PRESIGNED_TX_BASE_ONRAMP)); invalidTxs[2].meta = {}; const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; - await expect(validatePresignedTxs(RampDirection.BUY, invalidTxs, ephemerals, VALID_EXAMPLE_UNSIGNED_TX_EUR_ONRAMP)).rejects.toThrow( - "Transaction for phase squidRouterSwap must include at least 4 backup transactions in meta.additionalTxs" + await expect(validatePresignedTxs(RampDirection.BUY, invalidTxs, ephemerals, VALID_EXAMPLE_UNSIGNED_TX_BASE_ONRAMP)).rejects.toThrow( + "Transaction for phase destinationTransfer must include at least 4 backup transactions in meta.additionalTxs" ); }); - // QUARANTINED (stale EUR-onramp fixtures assert a removed flow; see docs/test-audit-findings.md): - it.skip("should throw when backup transaction nonces are not sequential", async () => { - const invalidTxs: PresignedTx[] = JSON.parse(JSON.stringify(VALID_EXAMPLE_PRESIGNED_TX_EUR_ONRAMP)); + it("should throw when backup transaction nonces are not sequential", async () => { + const invalidTxs: PresignedTx[] = JSON.parse(JSON.stringify(VALID_EXAMPLE_PRESIGNED_TX_BASE_ONRAMP)); const backupTx = invalidTxs[2]?.meta?.additionalTxs?.backup2; if (!backupTx) { throw new Error("Missing backup transaction for test setup"); @@ -470,8 +432,8 @@ describe("Presigned Transaction validation", () => { const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; - await expect(validatePresignedTxs(RampDirection.BUY, invalidTxs, ephemerals, VALID_EXAMPLE_UNSIGNED_TX_EUR_ONRAMP)).rejects.toThrow( - "Transaction for phase squidRouterSwap has invalid backup nonce sequence. Expected 4, got 5" + await expect(validatePresignedTxs(RampDirection.BUY, invalidTxs, ephemerals, VALID_EXAMPLE_UNSIGNED_TX_BASE_ONRAMP)).rejects.toThrow( + "Transaction for phase destinationTransfer has invalid backup nonce sequence. Expected 4, got 5" ); }); @@ -1061,21 +1023,19 @@ describe("Presigned Transaction validation", () => { ); }); - // QUARANTINED (stale EUR-onramp fixtures assert a removed flow; see docs/test-audit-findings.md): - it.skip("accepts a subset of presigned txs when requireComplete is false (updateRamp partial submission)", async () => { + it("accepts a subset of presigned txs when requireComplete is false (updateRamp partial submission)", async () => { const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; - const subset = VALID_EXAMPLE_PRESIGNED_TX_EUR_ONRAMP.slice(0, 1); + const subset = VALID_EXAMPLE_PRESIGNED_TX_BASE_ONRAMP.slice(0, 1); await expect( - validatePresignedTxs(RampDirection.BUY, subset, ephemerals, VALID_EXAMPLE_UNSIGNED_TX_EUR_ONRAMP, { requireComplete: false }) + validatePresignedTxs(RampDirection.BUY, subset, ephemerals, VALID_EXAMPLE_UNSIGNED_TX_BASE_ONRAMP, { requireComplete: false }) ).resolves.toBeUndefined(); }); - // QUARANTINED (stale EUR-onramp fixtures assert a removed flow; see docs/test-audit-findings.md): - it.skip("still rejects subset submissions by default (requireComplete defaults to true)", async () => { + it("still rejects subset submissions by default (requireComplete defaults to true)", async () => { const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; - const subset = VALID_EXAMPLE_PRESIGNED_TX_EUR_ONRAMP.slice(0, 1); + const subset = VALID_EXAMPLE_PRESIGNED_TX_BASE_ONRAMP.slice(0, 1); await expect( - validatePresignedTxs(RampDirection.BUY, subset, ephemerals, VALID_EXAMPLE_UNSIGNED_TX_EUR_ONRAMP) + validatePresignedTxs(RampDirection.BUY, subset, ephemerals, VALID_EXAMPLE_UNSIGNED_TX_BASE_ONRAMP) ).rejects.toThrow("Not all unsigned transactions have a corresponding presigned transaction"); }); @@ -1083,7 +1043,7 @@ describe("Presigned Transaction validation", () => { const ephemerals: { [key in EphemeralAccountType]: string } = { Substrate: "", EVM: EVM_SIGNER }; const extra = await makeSignedEvmTxWithBackups({ nonce: 99, phase: "fundEphemeral", network: Networks.Polygon }); await expect( - validatePresignedTxs(RampDirection.BUY, [extra], ephemerals, VALID_EXAMPLE_UNSIGNED_TX_EUR_ONRAMP, { requireComplete: false }) + validatePresignedTxs(RampDirection.BUY, [extra], ephemerals, VALID_EXAMPLE_UNSIGNED_TX_BASE_ONRAMP, { requireComplete: false }) ).rejects.toThrow("Some presigned transactions do not match any unsigned transaction"); }); From 26252fbd8ecbfcf3126cb13fba056457f4c34f1e Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 20:43:50 +0200 Subject: [PATCH 107/176] Rewrite webhook-delivery tests against the current RSA-PSS delivery path The quarantined suite predated RSA-PSS signing: it mocked node crypto's createHmac and per-webhook secrets that no longer exist, its global setTimeout mock never invoked callbacks so the retry backoff hung the whole runner, and its payload assertions (sha256= signature prefix, transactionId/quoteId swap) matched the removed HMAC scheme. The suite now initializes real RSA keys once, patches the two webhookService methods on the instance (restored in afterAll, no process-wide mock.module), stubs fetch per test, shrinks the retry delays to 1ms instead of mocking timers, and asserts the raw base64 RSA-PSS X-Vortex-Signature via a verifySignature round-trip plus the current payload shapes (quoteId/sessionId/transactionId). --- .../webhook-delivery.service.test.ts | 547 ++++++------------ 1 file changed, 173 insertions(+), 374 deletions(-) diff --git a/apps/api/src/api/services/webhook/__tests__/webhook-delivery.service.test.ts b/apps/api/src/api/services/webhook/__tests__/webhook-delivery.service.test.ts index 26b5ccfb0..88c4fc5fb 100644 --- a/apps/api/src/api/services/webhook/__tests__/webhook-delivery.service.test.ts +++ b/apps/api/src/api/services/webhook/__tests__/webhook-delivery.service.test.ts @@ -1,433 +1,232 @@ -import {afterEach, beforeEach, describe, expect, it, mock} from 'bun:test'; -import {WebhookDeliveryService} from '../webhook-delivery.service'; -import {RampDirection, WebhookEventType} from '@vortexfi/shared'; - -// Mock factory functions -const createMockWebhook = (overrides: Partial = {}) => ({ - id: 'webhook-1', - url: 'https://example.com/webhook1', - secret: 'secret1', +import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, mock } from "bun:test"; +import { RampDirection, TransactionStatus, WebhookEventType } from "@vortexfi/shared"; +import cryptoService from "../../../../config/crypto"; +import { WebhookDeliveryService } from "../webhook-delivery.service"; +import webhookService from "../webhook.service"; + +// The service signs payloads with the real cryptoService singleton (RSA-PSS, +// raw base64 in X-Vortex-Signature) and uses the webhookService singleton for +// lookup/deactivation. No mock.module here — bun module mocks are process-wide +// and leak into other test files. Instead: real keys initialized once, the two +// webhookService methods patched on the instance (originals captured below and +// restored in afterAll), and globalThis.fetch stubbed per test. + +const originalFetch = globalThis.fetch; +const originalFindWebhooksForEvent = webhookService.findWebhooksForEvent; +const originalDeactivateWebhook = webhookService.deactivateWebhook; + +const findWebhooksForEventMock = mock(async (): Promise => []); +const deactivateWebhookMock = mock(async (): Promise => true); + +const fakeWebhook = (overrides: Record = {}) => ({ + id: "webhook-1", + url: "https://example.com/hook", ...overrides }); -const createMockWebhookArray = (webhooks: Partial[] = []) => - webhooks.length > 0 ? webhooks.map(webhook => createMockWebhook(webhook)) : [ - createMockWebhook({ id: 'webhook-1', url: 'https://example.com/webhook1', secret: 'secret1' }) - ]; - -const createMockResponse = (overrides: Partial = {}) => ({ - ok: true, - status: 200, - ...overrides -} as Response); +// Real timers, but backoff shrunk from 1s..16s to 1ms per attempt so the +// retry tests finish instantly. timeoutMs is shrunk so the per-attempt abort +// timer left dangling on rejected fetches fires (harmlessly) right away. +const createService = () => { + const service = new WebhookDeliveryService(); + (service as unknown as { retryDelays: number[] }).retryDelays = [1, 1, 1, 1, 1]; + (service as unknown as { timeoutMs: number }).timeoutMs = 50; + return service; +}; -// Create mock functions first -const findWebhooksForEventMock = mock(async (): Promise => []); -const getWebhookByIdMock = mock(async (): Promise => ({})); -const deactivateWebhookMock = mock(async (): Promise => true); +let fetchMock: ReturnType; +const stubFetch = (impl: () => Promise) => { + fetchMock = mock(impl); + globalThis.fetch = fetchMock as unknown as typeof fetch; + return fetchMock; +}; -// Mock fetch globally -const originalFetch = global.fetch; -const fetchMock = mock(async (url: string, options?: RequestInit): Promise => ({ - ok: true, - status: 200 -} as Response)); - -// Mock AbortController -const abortMock = mock(() => {}); -const originalAbortController = global.AbortController; -const mockAbortController = class MockAbortController { - signal = { aborted: false }; - abort = abortMock; +const fetchCall = (index: number) => { + const [url, init] = fetchMock.mock.calls[index] as unknown as [string, RequestInit]; + return { body: init.body as string, headers: init.headers as Record, init, url }; }; -// Mock setTimeout and clearTimeout -const originalSetTimeout = global.setTimeout; -const originalClearTimeout = global.clearTimeout; -const setTimeoutMock = mock((callback: Function, ms: number) => { - // For testing, we can call the callback immediately or return a dummy timeout ID - return 123 as any; -}); -const clearTimeoutMock = mock(() => {}); - -// Mock crypto -const createHmacMock = mock(() => ({ - update: mock(() => ({ - digest: mock(() => 'test-signature-hash') - })) -})); - -// NOTE: the module mocks that used to live here (node 'crypto', -// '../webhook.service', config/logger) were removed together with the -// quarantine: bun module mocks are process-wide and they poisoned every -// later test file even though this suite is skipped. - -// QUARANTINED: this suite predates the RSA-PSS webhook signing rewrite (it -// still mocks HMAC + webhook `secret`), asserts stale payload shapes, and its -// global setTimeout mock never fires callbacks, which makes several tests -// hang/time out. See docs/test-audit-findings.md (webhook-delivery entries) -// — the suite needs a rewrite against current production behavior. -describe.skip('WebhookDeliveryService', () => { - let webhookDeliveryService: WebhookDeliveryService; +describe("WebhookDeliveryService", () => { + let service: WebhookDeliveryService; - beforeEach(() => { - webhookDeliveryService = new WebhookDeliveryService(); + beforeAll(() => { + cryptoService.initializeKeys(); + (webhookService as { findWebhooksForEvent: unknown }).findWebhooksForEvent = findWebhooksForEventMock; + (webhookService as { deactivateWebhook: unknown }).deactivateWebhook = deactivateWebhookMock; + }); - // Setup global mocks - global.fetch = fetchMock as any; - global.AbortController = mockAbortController as any; - global.setTimeout = setTimeoutMock as any; - global.clearTimeout = clearTimeoutMock as any; + afterAll(() => { + webhookService.findWebhooksForEvent = originalFindWebhooksForEvent; + webhookService.deactivateWebhook = originalDeactivateWebhook; + globalThis.fetch = originalFetch; + }); - // Reset all mocks + beforeEach(() => { + service = createService(); findWebhooksForEventMock.mockReset(); - getWebhookByIdMock.mockReset(); + findWebhooksForEventMock.mockResolvedValue([]); deactivateWebhookMock.mockReset(); - fetchMock.mockReset(); - abortMock.mockReset(); - setTimeoutMock.mockReset(); - clearTimeoutMock.mockReset(); - createHmacMock.mockReset(); - - // Setup default mock return values - createHmacMock.mockReturnValue({ - update: mock(() => ({ - digest: mock(() => 'test-signature-hash') - })) - }); + deactivateWebhookMock.mockResolvedValue(true); }); afterEach(() => { - // Restore globals - global.fetch = originalFetch; - global.AbortController = originalAbortController; - global.setTimeout = originalSetTimeout; - global.clearTimeout = originalClearTimeout; + globalThis.fetch = originalFetch; }); - describe('triggerTransactionCreated', () => { - it('should trigger webhooks for transaction created event', async () => { - // Use mock factory - const mockWebhooks = createMockWebhookArray([ - { id: 'webhook-1', url: 'https://example.com/webhook1', secret: 'secret1' }, - { id: 'webhook-2', url: 'https://example.com/webhook2', secret: 'secret2' } + describe("triggerTransactionCreated", () => { + it("delivers the signed payload to every matching webhook", async () => { + findWebhooksForEventMock.mockResolvedValue([ + fakeWebhook({ id: "webhook-1", url: "https://example.com/hook1" }), + fakeWebhook({ id: "webhook-2", url: "https://example.com/hook2" }) ]); + stubFetch(async () => new Response(null, { status: 200 })); - // Setup mocks - findWebhooksForEventMock.mockResolvedValue(mockWebhooks); - fetchMock.mockResolvedValue(createMockResponse()); - - // Execute - await webhookDeliveryService.triggerTransactionCreated( - 'tx-123', - 'session-456', - 'tx-id', - RampDirection.BUY - ); - - // Verify - expect(findWebhooksForEventMock).toHaveBeenCalledWith( - WebhookEventType.TRANSACTION_CREATED, - 'tx-123', - 'session-456' - ); + await service.triggerTransactionCreated("quote-123", "session-456", "tx-789", RampDirection.BUY); + expect(findWebhooksForEventMock).toHaveBeenCalledWith(WebhookEventType.TRANSACTION_CREATED, "quote-123", "session-456"); expect(fetchMock).toHaveBeenCalledTimes(2); - expect(fetchMock.mock.calls[0][0]).toBe('https://example.com/webhook1'); - expect(fetchMock.mock.calls[1][0]).toBe('https://example.com/webhook2'); + expect(fetchCall(0).url).toBe("https://example.com/hook1"); + expect(fetchCall(1).url).toBe("https://example.com/hook2"); - // Check payload structure - const firstCallPayload = JSON.parse(fetchMock.mock.calls[0][1]!.body as string); - expect(firstCallPayload).toEqual({ + const payload = JSON.parse(fetchCall(0).body); + expect(payload).toEqual({ eventType: WebhookEventType.TRANSACTION_CREATED, - timestamp: expect.any(String), payload: { - sessionId: 'session-456', - transactionId: 'tx-123', - transactionStatus: 'PENDING', + quoteId: "quote-123", + sessionId: "session-456", + transactionId: "tx-789", + transactionStatus: TransactionStatus.PENDING, transactionType: RampDirection.BUY - } + }, + timestamp: expect.any(String) }); + expect(Number.isNaN(Date.parse(payload.timestamp))).toBe(false); + // Both webhooks receive the identical payload + expect(fetchCall(1).body).toBe(fetchCall(0).body); }); - it('should do nothing when no webhooks are found', async () => { - // Setup mocks - findWebhooksForEventMock.mockResolvedValue([]); - - // Execute - await webhookDeliveryService.triggerTransactionCreated( - 'tx-123', - 'session-456', - 'tx-id', - RampDirection.BUY - ); - - // Verify - expect(findWebhooksForEventMock).toHaveBeenCalledWith( - WebhookEventType.TRANSACTION_CREATED, - 'tx-123', - 'session-456' - ); + it("does nothing when no webhooks match", async () => { + stubFetch(async () => new Response(null, { status: 200 })); + + await service.triggerTransactionCreated("quote-123", "session-456", "tx-789", RampDirection.BUY); + + expect(findWebhooksForEventMock).toHaveBeenCalledWith(WebhookEventType.TRANSACTION_CREATED, "quote-123", "session-456"); expect(fetchMock).not.toHaveBeenCalled(); }); - it('should handle webhook delivery failures', async () => { - // Use mock factory - const mockWebhooks = createMockWebhookArray([ - { id: 'webhook-1', url: 'https://example.com/webhook1', secret: 'secret1' } - ]); + it("resolves without throwing when the webhook lookup fails", async () => { + findWebhooksForEventMock.mockRejectedValue(new Error("db down")); + stubFetch(async () => new Response(null, { status: 200 })); - // Setup mocks - webhook delivery fails - findWebhooksForEventMock.mockResolvedValue(mockWebhooks); - fetchMock.mockResolvedValue(createMockResponse({ ok: false, status: 500 })); - - // Execute - await webhookDeliveryService.triggerTransactionCreated( - 'tx-123', - 'session-456', - 'tx-id', - RampDirection.BUY - ); - - // Verify that fetch was called multiple times (retries) - expect(fetchMock).toHaveBeenCalled(); - // Should eventually deactivate webhook after max retries - expect(deactivateWebhookMock).toHaveBeenCalledWith('webhook-1'); + await expect( + service.triggerTransactionCreated("quote-123", "session-456", "tx-789", RampDirection.BUY) + ).resolves.toBeUndefined(); + expect(fetchMock).not.toHaveBeenCalled(); }); }); - describe('triggerStatusChange', () => { - it('should trigger webhooks for status change event with complete status', async () => { - // Mock data - const mockWebhooks = [ - { - id: 'webhook-1', - url: 'https://example.com/webhook1', - secret: 'secret1' - } - ]; + describe("retry and deactivation", () => { + it("retries up to maxRetries on HTTP failures, then deactivates the webhook", async () => { + findWebhooksForEventMock.mockResolvedValue([fakeWebhook()]); + stubFetch(async () => new Response(null, { status: 500 })); + + await service.triggerTransactionCreated("quote-123", "session-456", "tx-789", RampDirection.BUY); - // Setup mocks - findWebhooksForEventMock.mockResolvedValue(mockWebhooks); - fetchMock.mockResolvedValue({ - ok: true, - status: 200 - } as Response); - - // Execute - await webhookDeliveryService.triggerStatusChange( - 'tx-123', - 'session-456', - 'tx-id', - 'complete', - RampDirection.SELL - ); - - // Verify - expect(findWebhooksForEventMock).toHaveBeenCalledWith( - WebhookEventType.STATUS_CHANGE, - 'tx-123', - 'session-456' - ); - - expect(fetchMock).toHaveBeenCalled(); - - // Check payload contains correct status mapping - const fetchCall = fetchMock.mock.calls[0]; - const payload = JSON.parse(fetchCall[1]!.body as string); - expect(payload.eventType).toBe(WebhookEventType.STATUS_CHANGE); - expect(payload.payload.transactionStatus).toBe('COMPLETE'); - expect(payload.payload.transactionType).toBe(RampDirection.SELL); - expect(payload.payload.transactionId).toBe('tx-123'); - expect(payload.payload.sessionId).toBe('session-456'); + expect(fetchMock).toHaveBeenCalledTimes(5); + expect(deactivateWebhookMock).toHaveBeenCalledWith("webhook-1"); }); - it('should trigger webhooks for status change event with failed status', async () => { - // Mock data - const mockWebhooks = [ - { - id: 'webhook-1', - url: 'https://example.com/webhook1', - secret: 'secret1' - } - ]; + it("stops retrying once a delivery succeeds", async () => { + findWebhooksForEventMock.mockResolvedValue([fakeWebhook()]); + let attempts = 0; + stubFetch(async () => { + attempts++; + return new Response(null, { status: attempts < 3 ? 502 : 200 }); + }); - // Setup mocks - findWebhooksForEventMock.mockResolvedValue(mockWebhooks); - fetchMock.mockResolvedValue({ - ok: true, - status: 200 - } as Response); - - // Execute - await webhookDeliveryService.triggerStatusChange( - 'tx-123', - 'session-456', - 'tx-id', - 'failed', - RampDirection.BUY - ); - - // Verify - const fetchCall = fetchMock.mock.calls[0]; - const payload = JSON.parse(fetchCall[1]!.body as string); - expect(payload.payload.transactionStatus).toBe('FAILED'); + await service.triggerTransactionCreated("quote-123", "session-456", "tx-789", RampDirection.BUY); + + expect(fetchMock).toHaveBeenCalledTimes(3); + expect(deactivateWebhookMock).not.toHaveBeenCalled(); }); - it('should trigger webhooks for status change event with timedOut status', async () => { - // Mock data - const mockWebhooks = [ - { - id: 'webhook-1', - url: 'https://example.com/webhook1', - secret: 'secret1' - } - ]; + it("treats network errors like failures and deactivates after maxRetries without throwing", async () => { + findWebhooksForEventMock.mockResolvedValue([fakeWebhook()]); + stubFetch(async () => { + throw new Error("connection refused"); + }); + + await expect( + service.triggerTransactionCreated("quote-123", "session-456", "tx-789", RampDirection.BUY) + ).resolves.toBeUndefined(); - // Setup mocks - findWebhooksForEventMock.mockResolvedValue(mockWebhooks); - fetchMock.mockResolvedValue({ - ok: true, - status: 200 - } as Response); - - // Execute - await webhookDeliveryService.triggerStatusChange( - 'tx-123', - 'session-456', - 'tx-id', - 'timedOut', - RampDirection.BUY - ); - - // Verify - const fetchCall = fetchMock.mock.calls[0]; - const payload = JSON.parse(fetchCall[1]!.body as string); - expect(payload.payload.transactionStatus).toBe('FAILED'); + expect(fetchMock).toHaveBeenCalledTimes(5); + expect(deactivateWebhookMock).toHaveBeenCalledWith("webhook-1"); }); + }); + + describe("triggerStatusChange", () => { + it("maps ramp phases to transaction statuses in the payload", async () => { + findWebhooksForEventMock.mockResolvedValue([fakeWebhook()]); + stubFetch(async () => new Response(null, { status: 200 })); - it('should trigger webhooks for status change event with pending status', async () => { - // Mock data - const mockWebhooks = [ - { - id: 'webhook-1', - url: 'https://example.com/webhook1', - secret: 'secret1' - } + const cases: [string, TransactionStatus][] = [ + ["complete", TransactionStatus.COMPLETE], + ["failed", TransactionStatus.FAILED], + ["timedOut", TransactionStatus.FAILED], + ["pendulumCleanup", TransactionStatus.PENDING] ]; - // Setup mocks - findWebhooksForEventMock.mockResolvedValue(mockWebhooks); - fetchMock.mockResolvedValue({ - ok: true, - status: 200 - } as Response); - - // Execute - await webhookDeliveryService.triggerStatusChange( - 'tx-123', - 'session-456', - 'tx-id', - 'someOtherPhase', - RampDirection.BUY - ); - - // Verify - const fetchCall = fetchMock.mock.calls[0]; - const payload = JSON.parse(fetchCall[1]!.body as string); - expect(payload.payload.transactionStatus).toBe('PENDING'); + for (const [index, [phase, expectedStatus]] of cases.entries()) { + await service.triggerStatusChange("quote-123", "session-456", "tx-789", phase, RampDirection.SELL); + + const payload = JSON.parse(fetchCall(index).body); + expect(payload.eventType).toBe(WebhookEventType.STATUS_CHANGE); + expect(payload.payload).toEqual({ + quoteId: "quote-123", + sessionId: "session-456", + transactionId: "tx-789", + transactionStatus: expectedStatus, + transactionType: RampDirection.SELL + }); + } + + expect(findWebhooksForEventMock).toHaveBeenCalledWith(WebhookEventType.STATUS_CHANGE, "quote-123", "session-456"); + expect(fetchMock).toHaveBeenCalledTimes(cases.length); }); - it('should do nothing when no webhooks are found', async () => { - // Setup mocks - findWebhooksForEventMock.mockResolvedValue([]); - - // Execute - await webhookDeliveryService.triggerStatusChange( - 'tx-123', - 'session-456', - 'tx-id', - 'complete', - RampDirection.SELL - ); - - // Verify - expect(findWebhooksForEventMock).toHaveBeenCalledWith( - WebhookEventType.STATUS_CHANGE, - 'tx-123', - 'session-456' - ); + it("does nothing when no webhooks match", async () => { + stubFetch(async () => new Response(null, { status: 200 })); + + await service.triggerStatusChange("quote-123", "session-456", "tx-789", "complete", RampDirection.SELL); + + expect(findWebhooksForEventMock).toHaveBeenCalledWith(WebhookEventType.STATUS_CHANGE, "quote-123", "session-456"); expect(fetchMock).not.toHaveBeenCalled(); }); }); - describe('webhook delivery', () => { - it('should include correct headers in webhook requests', async () => { - // Mock data - const mockWebhooks = [ - { - id: 'webhook-1', - url: 'https://example.com/webhook1', - secret: 'webhook-secret' - } - ]; - - // Setup mocks - findWebhooksForEventMock.mockResolvedValue(mockWebhooks); - fetchMock.mockResolvedValue({ - ok: true, - status: 200 - } as Response); - - // Execute - await webhookDeliveryService.triggerTransactionCreated( - 'tx-123', - 'session-456', - 'tx-id', - RampDirection.BUY - ); - - // Verify headers - expect(fetchMock).toHaveBeenCalledWith( - 'https://example.com/webhook1', - expect.objectContaining({ - method: 'POST', - headers: expect.objectContaining({ - 'Content-Type': 'application/json', - 'User-Agent': 'Vortex-Webhooks/1.0', - 'X-Vortex-Signature': expect.stringMatching(/^sha256=/), - 'X-Vortex-Timestamp': expect.any(String) - }), - body: expect.any(String), - signal: expect.any(Object) - }) - ); - }); + describe("request format", () => { + it("sends a POST with JSON headers, a unix timestamp, and a verifiable RSA-PSS signature", async () => { + findWebhooksForEventMock.mockResolvedValue([fakeWebhook()]); + stubFetch(async () => new Response(null, { status: 200 })); - it('should handle network errors gracefully', async () => { - // Mock data - const mockWebhooks = [ - { - id: 'webhook-1', - url: 'https://example.com/webhook1', - secret: 'secret1' - } - ]; + await service.triggerTransactionCreated("quote-123", "session-456", "tx-789", RampDirection.BUY); - // Setup mocks - network error - findWebhooksForEventMock.mockResolvedValue(mockWebhooks); - fetchMock.mockRejectedValue(new Error('Network error')); + const { body, headers, init } = fetchCall(0); + expect(init.method).toBe("POST"); + expect(headers["Content-Type"]).toBe("application/json"); + expect(headers["User-Agent"]).toBe("Vortex-Webhooks/1.0"); - // Execute - should not throw - await expect(webhookDeliveryService.triggerTransactionCreated( - 'tx-123', - 'session-456', - 'tx-id', - RampDirection.BUY - )).resolves.toBeUndefined(); + // Freshness timestamp: unix seconds, close to now + expect(headers["X-Vortex-Timestamp"]).toMatch(/^\d+$/); + expect(Math.abs(Number(headers["X-Vortex-Timestamp"]) - Date.now() / 1000)).toBeLessThan(60); - // Should eventually deactivate webhook after max retries - expect(deactivateWebhookMock).toHaveBeenCalledWith('webhook-1'); + // Raw base64 RSA-PSS signature over the exact body — no "sha256=" prefix + // (that belonged to the removed HMAC scheme) + const signature = headers["X-Vortex-Signature"]; + expect(signature.startsWith("sha256=")).toBe(false); + expect(cryptoService.verifySignature(body, signature)).toBe(true); + expect(cryptoService.verifySignature(`${body} `, signature)).toBe(false); }); }); }); From 07b86388338b6bce31a829b3eddbe5a45f23d4f7 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 20:44:09 +0200 Subject: [PATCH 108/176] Align the live integration tests with the current ramp API contract MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - phase-processor.onramp: registerRamp now passes a userId (mandatory since the user-gating guards), the ephemeral keys are renamed to EVM/Substrate (normalizeAndValidateSigningAccounts silently dropped the old moonbeam/pendulum keys, so registration could never succeed), and updateRamp runs before startRamp (startRamp requires presigned txs to exist and is what kicks off processing). Deleted the vestigial mock.module of ../brla/helpers — that module no longer exists and nothing imports it. - phase-processor.recovery: the fixture is loaded from failedRampStateRecovery.json with fail-fast validation (the previous empty placeholder object made processRamp silently no-op at the flow-variant guard), and the unconditional 3,000,000 ms sleep with zero expect() calls is replaced by a poll loop that asserts the ramp reaches "complete" and fails on "failed"/stale phases. - mykobo-eur onramp/offramp: the two registration contract tests are it.skip'd with a pointer to the unconditional EUR-disable guard in registerRamp (commit be52569e4, 503 "EUR ramps are currently disabled"); they cannot pass even with RUN_LIVE_TESTS=1 until EUR ramps return or the guard gets a test bypass. --- .../mykobo-eur-offramp.integration.test.ts | 5 +- .../mykobo-eur-onramp.integration.test.ts | 5 +- ...phase-processor.onramp.integration.test.ts | 46 ++++++------- ...ase-processor.recovery.integration.test.ts | 65 ++++++++++++++++--- 4 files changed, 86 insertions(+), 35 deletions(-) diff --git a/apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts b/apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts index d1fb54090..f0bf47f23 100644 --- a/apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts +++ b/apps/api/src/api/services/phases/mykobo-eur-offramp.integration.test.ts @@ -284,7 +284,10 @@ describe.skipIf(!process.env.RUN_LIVE_TESTS)("Mykobo EUR offramp contract test ( expect(Number(quoteTicket.metadata.nablaSwapEvm?.outputAmountDecimal)).toBeGreaterThan(0); }); - it("registers a Base+USDC ramp and prepares the Mykobo phase set (no squid, no broadcast)", async () => { + // SKIPPED: registerRamp unconditionally rejects EURC quotes with 503 "EUR ramps are + // currently disabled" (commit be52569e4), so this contract test cannot run even live. + // Re-enable when EUR ramps come back (or a test bypass for the guard exists). + it.skip("registers a Base+USDC ramp and prepares the Mykobo phase set (no squid, no broadcast)", async () => { const rampService = new RampService(); const quoteService = new QuoteService(); diff --git a/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts b/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts index 388abe233..494f5e932 100644 --- a/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts +++ b/apps/api/src/api/services/phases/mykobo-eur-onramp.integration.test.ts @@ -285,7 +285,10 @@ describe.skipIf(!process.env.RUN_LIVE_TESTS)("Mykobo EUR onramp contract test (r expect(Number(quoteTicket.metadata.mykoboMint?.outputAmountRaw)).toBeGreaterThan(0); }); - it("registers a EUR->Base USDC onramp and prepares the Mykobo phase set (no squid, no broadcast)", async () => { + // SKIPPED: registerRamp unconditionally rejects EURC quotes with 503 "EUR ramps are + // currently disabled" (commit be52569e4), so this contract test cannot run even live. + // Re-enable when EUR ramps come back (or a test bypass for the guard exists). + it.skip("registers a EUR->Base USDC onramp and prepares the Mykobo phase set (no squid, no broadcast)", async () => { const rampService = new RampService(); const quoteService = new QuoteService(); diff --git a/apps/api/src/api/services/phases/phase-processor.onramp.integration.test.ts b/apps/api/src/api/services/phases/phase-processor.onramp.integration.test.ts index 3fbd4947a..d96692db1 100644 --- a/apps/api/src/api/services/phases/phase-processor.onramp.integration.test.ts +++ b/apps/api/src/api/services/phases/phase-processor.onramp.integration.test.ts @@ -35,6 +35,7 @@ const EVM_DESTINATION_ADDRESS = "12mkWe8Lfsk4Qx6EEocvRDpzmA6SQQHBA4Fq3b9T9cyPr7T const TEST_INPUT_AMOUNT = "1"; const TEST_INPUT_CURRENCY = FiatToken.BRL; const TEST_OUTPUT_CURRENCY = EvmToken.USDC; +const TEST_USER_ID = "00000000-0000-0000-0000-000000000001"; const QUOTE_FROM = EPaymentMethod.PIX; @@ -80,17 +81,18 @@ export async function createMoonbeamEphemeralSeed() { return { address: ephemeralAccountKeypair.address, secret: seedPhrase }; } -const testSigningAccounts = { - moonbeam: await createMoonbeamEphemeralSeed(), - pendulum: await createSubstrateEphemeral() +// Keys must be EphemeralAccountType values ('EVM'/'Substrate'): +// normalizeAndValidateSigningAccounts silently drops entries with any other type. +const testSigningAccounts: { [key in EphemeralAccountType]: EphemeralAccount } = { + [EphemeralAccountType.EVM]: await createMoonbeamEphemeralSeed(), + [EphemeralAccountType.Substrate]: await createSubstrateEphemeral() }; // convert into AccountMeta -const testSigningAccountsMeta: AccountMeta[] = Object.keys(testSigningAccounts).map(networkKey => { - const address = testSigningAccounts[networkKey as keyof typeof testSigningAccounts].address; - const network = networkKey as EphemeralAccountType; - return { address, type: network }; -}); +const testSigningAccountsMeta: AccountMeta[] = (Object.keys(testSigningAccounts) as EphemeralAccountType[]).map(type => ({ + address: testSigningAccounts[type].address, + type +})); console.log("Test Signing Accounts:", testSigningAccountsMeta); @@ -154,16 +156,6 @@ QuoteTicket.create = mock(async (data: any) => { return quoteTicket; }) as any; -const mockVerifyReferenceLabel = mock(async (reference: any, receiverAddress: any) => { - console.log("Verifying reference label:", reference, receiverAddress); - return true; -}); - -mock.module("../brla/helpers", () => { - return { - verifyReferenceLabel: mockVerifyReferenceLabel - }; -}); } // Live test: drives real chain/anchor interactions and needs TAX_ID plus funded accounts. @@ -196,7 +188,9 @@ describe.skipIf(!process.env.RUN_LIVE_TESTS)("Onramp PhaseProcessor Integration const registeredRamp = await rampService.registerRamp({ additionalData, quoteId: quoteTicket.id, - signingAccounts: testSigningAccountsMeta + signingAccounts: testSigningAccountsMeta, + // registerRamp requires an effective user (API key linked to a user or Supabase auth). + userId: TEST_USER_ID }); console.log("register onramp:", registeredRamp); @@ -207,10 +201,6 @@ describe.skipIf(!process.env.RUN_LIVE_TESTS)("Onramp PhaseProcessor Integration // END - MIMIC THE UI - await rampService.startRamp({ - rampId: registeredRamp.id - }); - const pendulumNode = await getPendulumNode(); const moonbeamNode = await getMoonbeamNode(); const hydrationNode = await getHydrationNode(); @@ -218,19 +208,25 @@ describe.skipIf(!process.env.RUN_LIVE_TESTS)("Onramp PhaseProcessor Integration const presignedTxs = await signUnsignedTransactions( registeredRamp?.unsignedTxs || [], { - evmEphemeral: testSigningAccounts.moonbeam, - substrateEphemeral: testSigningAccounts.pendulum + evmEphemeral: testSigningAccounts.EVM, + substrateEphemeral: testSigningAccounts.Substrate }, pendulumNode.api, moonbeamNode.api, hydrationNode.api, ); + // startRamp requires presigned transactions to already be present and is what + // kicks off phase processing, so updateRamp must run first. await rampService.updateRamp({ presignedTxs, rampId: registeredRamp.id }); + await rampService.startRamp({ + rampId: registeredRamp.id + }); + const finalRampState = await waitForCompleteRamp(registeredRamp.id); // Some sanity checks. diff --git a/apps/api/src/api/services/phases/phase-processor.recovery.integration.test.ts b/apps/api/src/api/services/phases/phase-processor.recovery.integration.test.ts index 1f26156b0..58eebe188 100644 --- a/apps/api/src/api/services/phases/phase-processor.recovery.integration.test.ts +++ b/apps/api/src/api/services/phases/phase-processor.recovery.integration.test.ts @@ -1,4 +1,4 @@ -import {beforeAll, describe, it, mock} from "bun:test"; +import {beforeAll, describe, expect, it, mock} from "bun:test"; import fs from "node:fs"; import path from "node:path"; @@ -6,9 +6,24 @@ import RampState, {RampStateAttributes, RampStateCreationAttributes} from "../.. import {PhaseProcessor} from "./phase-processor"; import registerPhaseHandlers from "./register-handlers"; -const RAMP_STATE_RECOVERY = { - // ... -}; +const fixturePath = path.join(__dirname, "failedRampStateRecovery.json"); + +// Copy a failed ramp state into failedRampStateRecovery.json to replay it (see CLAUDE.md). +// Fail fast on a missing/empty fixture: without id/currentPhase/flowVariant the +// PhaseProcessor silently no-ops at its flow-variant guard and the test would "pass" +// without processing anything. +function loadRecoveryFixture(): Partial { + if (!fs.existsSync(fixturePath)) { + throw new Error(`Recovery fixture not found: ${fixturePath}. Copy a failed ramp state there first (see CLAUDE.md).`); + } + const fixture = JSON.parse(fs.readFileSync(fixturePath, "utf8")) as Partial; + if (!fixture.id || !fixture.currentPhase || !fixture.flowVariant) { + throw new Error(`Recovery fixture ${fixturePath} must contain at least id, currentPhase and flowVariant.`); + } + return fixture; +} + +const RAMP_STATE_RECOVERY = process.env.RUN_LIVE_TESTS ? loadRecoveryFixture() : {}; // Module-level patching only when the live suite is enabled — bun runs all // test files in one process, so unconditional patches leak into other files. @@ -30,7 +45,7 @@ let rampState: RampState; // Proper Sequelize types type RampStateUpdateData = Partial; -const filePath = path.join(__dirname, "failedRampStateRecovery.json"); +const filePath = fixturePath; beforeAll(() => { rampState = { @@ -99,11 +114,45 @@ describe.skipIf(!process.env.RUN_LIVE_TESTS)("Restart PhaseProcessor Integration await new Promise(resolve => setTimeout(resolve, 1000)); await processor.processRamp(rampState.id); - await new Promise(resolve => setTimeout(resolve, 3000000)); // 3000 seconds timeout is reasonable for THIS test. + // processRamp swallows phase failures internally (it only logs them), so the + // outcome must be observed on the ramp state itself rather than via exceptions. + const finalState = await waitForCompleteRamp(); + expect(finalState.currentPhase).toBe("complete"); } catch (error) { - const filePath = path.join(__dirname, "failedRampStateRecovery.json"); - fs.writeFileSync(filePath, JSON.stringify(rampState, null, 2)); + fs.writeFileSync(fixturePath, JSON.stringify(rampState, null, 2)); throw error; } }); }); + +async function waitForCompleteRamp(): Promise { + const pollInterval = 10 * 1000; // 10 seconds + const globalTimeout = 15 * 60 * 1000; // 15 minutes + const stalePhaseTimeout = 5 * 60 * 1000; // 5 minutes + + const startTime = Date.now(); + let lastUpdated = Date.now(); + let lastPhase = rampState.currentPhase; + + while (true) { + if (rampState.currentPhase === "complete") { + return rampState; + } + if (rampState.currentPhase === "failed") { + throw new Error("Ramp entered the failed phase during recovery."); + } + if (rampState.currentPhase !== lastPhase) { + lastPhase = rampState.currentPhase; + lastUpdated = Date.now(); + } + + if (Date.now() - lastUpdated > stalePhaseTimeout) { + throw new Error(`Ramp has been stuck in phase '${rampState.currentPhase}' for more than 5 minutes.`); + } + if (Date.now() - startTime > globalTimeout) { + throw new Error("Global timeout of 15 minutes reached without completing the ramp process."); + } + + await new Promise(resolve => setTimeout(resolve, pollInterval)); + } +} From bf88e3f758e63d8bb38f1515c434dbebf77b6729 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 20:44:27 +0200 Subject: [PATCH 109/176] Make the XCM dry-run test assert its outcome; drop the dead moonbeam test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - assethubToMoonbeam.test.ts had zero assertions — it only console.logged the dry-run Result, so a dry run reporting an XCM error (Filtered, FailedToTransactAsset) still passed. It now asserts the Result is Ok and the local execution succeeded. - The inert assetAccountKey parameter is dropped from createAssethubToMoonbeamTransferWithSwapOnHydration (and the test call): the XCM message hardcodes USDT on AssetHub, so the argument never had any effect and the "xcUSDC" comment in the test was misleading. The function has no production callers. - DELETED moonbeamToAssethub.test.ts: it exercised createMoonbeamToAssethubTransferWithSwapOnHydration, whose own doc comment states the resulting XCM cannot work because Moonbeam disallows polkadotXcm::execute — the dry run can only ever report failure, and the test logged rather than asserted even that. The dead production function is left in place (flagged in docs/test-audit-findings.md). --- .../services/xcm/assethubToMoonbeam.test.ts | 21 ++++++++------- .../src/services/xcm/assethubToMoonbeam.ts | 4 +-- .../services/xcm/moonbeamToAssethub.test.ts | 26 ------------------- 3 files changed, 13 insertions(+), 38 deletions(-) delete mode 100644 packages/shared/src/services/xcm/moonbeamToAssethub.test.ts diff --git a/packages/shared/src/services/xcm/assethubToMoonbeam.test.ts b/packages/shared/src/services/xcm/assethubToMoonbeam.test.ts index 7ac1caa94..1230a3fdb 100644 --- a/packages/shared/src/services/xcm/assethubToMoonbeam.test.ts +++ b/packages/shared/src/services/xcm/assethubToMoonbeam.test.ts @@ -1,26 +1,27 @@ -import {test} from "bun:test"; +import {expect, test} from "bun:test"; import {dryRunExtrinsic,} from "../../index"; import {createAssethubToMoonbeamTransferWithSwapOnHydration} from "./assethubToMoonbeam"; // Hits live AssetHub/Hydration RPCs; opt-in only (see docs/testing-strategy.md). test.skipIf(!process.env.RUN_LIVE_TESTS)("dry-run assethub to moonbeam with swap on hydration", async () => { - // Hardcoded values for testing purposes + // Hardcoded values for testing purposes. The transferred asset is USDT on AssetHub + // (hardcoded in the production function). const rawAmount = "1000000"; - const assetAccountKey = "0xFFfffffF7D2B0B761Af01Ca8e25242976ac0aD7D"; // xcUSDC const receiverAddress = "0x7Ba99e99Bc669B3508AFf9CC0A898E869459F877"; // Example account ID for dry-run origin const accountKey = "5DqTNJsGp6UayR5iHAZvH4zquY6ni6j35ZXLtJA6bXwsfixg"; // Example address // 1. Create the extrinsic - const extrinsic = await createAssethubToMoonbeamTransferWithSwapOnHydration( - receiverAddress, - rawAmount, - assetAccountKey - ); + const extrinsic = await createAssethubToMoonbeamTransferWithSwapOnHydration(receiverAddress, rawAmount); // 2. Dry-run the extrinsic const network = "assethub"; const dryRunResult = await dryRunExtrinsic(extrinsic, network, accountKey); - - // 3. Log the result console.log("Dry-run result:", JSON.stringify(dryRunResult.toHuman(), null, 2)); + + // 3. The dry run must report successful local execution — a Result payload that + // carries an XCM error (e.g. Filtered/FailedToTransactAsset) is a failure. + expect(dryRunResult.isOk).toBe(true); + // biome-ignore lint/suspicious/noExplicitAny: runtime-call codec typing is too loose here + const effects = dryRunResult.asOk as any; + expect(effects.executionResult.isOk).toBe(true); }, 30000); // Set a timeout of 30 seconds for the test diff --git a/packages/shared/src/services/xcm/assethubToMoonbeam.ts b/packages/shared/src/services/xcm/assethubToMoonbeam.ts index 43f64710e..cabf4ad77 100644 --- a/packages/shared/src/services/xcm/assethubToMoonbeam.ts +++ b/packages/shared/src/services/xcm/assethubToMoonbeam.ts @@ -4,10 +4,10 @@ import { ISubmittableResult } from "@polkadot/types/types"; import { u8aToHex } from "@polkadot/util"; import { ApiManager } from "../../index"; +// The transferred asset is fixed to USDT on AssetHub (PalletInstance 50 / GeneralIndex 1984). export async function createAssethubToMoonbeamTransferWithSwapOnHydration( receiverAddress: string, - rawAmount: string, - assetAccountKey: string + rawAmount: string ): Promise> { const apiManager = ApiManager.getInstance(); const networkName = "assethub"; diff --git a/packages/shared/src/services/xcm/moonbeamToAssethub.test.ts b/packages/shared/src/services/xcm/moonbeamToAssethub.test.ts deleted file mode 100644 index 138b66a7f..000000000 --- a/packages/shared/src/services/xcm/moonbeamToAssethub.test.ts +++ /dev/null @@ -1,26 +0,0 @@ -import {test} from "bun:test"; -import {createMoonbeamToAssethubTransferWithSwapOnHydration, dryRunExtrinsic,} from "../../index" - -// Hits live Moonbeam/Hydration RPCs; opt-in only (see docs/testing-strategy.md). -test.skipIf(!process.env.RUN_LIVE_TESTS)("dry-run moonbeam to assethub with swap on hydration", async () => { - // Hardcoded values for testing purposes - const receiverAddress = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"; // Example address - const rawAmount = "1000000"; - const assetAccountKey = "0xFFfffffF7D2B0B761Af01Ca8e25242976ac0aD7D"; // xcUSDC - const accountId = "0x7Ba99e99Bc669B3508AFf9CC0A898E869459F877"; // Example account ID for dry-run origin - - const network = "moonbeam"; - - // 1. Create the extrinsic - const extrinsic = await createMoonbeamToAssethubTransferWithSwapOnHydration( - receiverAddress, - rawAmount, - assetAccountKey - ); - - // 2. Dry-run the extrinsic - const dryRunResult = await dryRunExtrinsic(extrinsic, network, accountId); - - // 3. Log the result - console.log("Dry-run result:", JSON.stringify(dryRunResult.toHuman(), null, 2)); -}, 30000); // Set a timeout of 30 seconds for the test From 659d06cce012d2f7f0e6ae2e2c6027567c9c3443 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 20:44:41 +0200 Subject: [PATCH 110/176] Remove self-referential frontend tests that could not detect real bugs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - DELETED pages/progress/phaseFlows.test.ts: both tests compared PHASE_FLOWS to a verbatim copy of itself, so they could only fail when someone edited the constant and would then be updated to match — the backend-parity their names claimed was never checked. Typos in the phase lists are already caught at compile time by the as RampPhase[] casts in phaseFlows.ts. - DELETED the "Extensibility Example" block in translations/helpers.test.ts: both tests asserted properties of local objects they had just built (a spread-extended copy of LANGUAGE_FAMILIES, an inline re-implementation of the language-code split). The real extraction path stays covered by the getBrowserLanguage tests in the same file. --- .../src/pages/progress/phaseFlows.test.ts | 37 ------------------- .../frontend/src/translations/helpers.test.ts | 31 ---------------- 2 files changed, 68 deletions(-) delete mode 100644 apps/frontend/src/pages/progress/phaseFlows.test.ts diff --git a/apps/frontend/src/pages/progress/phaseFlows.test.ts b/apps/frontend/src/pages/progress/phaseFlows.test.ts deleted file mode 100644 index e01cd7bd3..000000000 --- a/apps/frontend/src/pages/progress/phaseFlows.test.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { describe, expect, it } from "vitest"; -import { PHASE_FLOWS } from "./phaseFlows"; - -describe("progress phase flows", () => { - it("matches the active BRL offramp Base runtime phases", () => { - expect(PHASE_FLOWS.offramp_brl).toEqual([ - "initial", - "fundEphemeral", - "distributeFees", - "subsidizePreSwap", - "nablaApprove", - "nablaSwap", - "subsidizePostSwap", - "brlaPayoutOnBase", - "complete" - ]); - }); - - it("matches the active BRL onramp Base runtime phases", () => { - expect(PHASE_FLOWS.onramp_brl).toEqual([ - "initial", - "brlaOnrampMint", - "onHoldForComplianceCheck", - "fundEphemeral", - "subsidizePreSwap", - "nablaApprove", - "nablaSwap", - "distributeFees", - "subsidizePostSwap", - "squidRouterSwap", - "squidRouterPay", - "finalSettlementSubsidy", - "destinationTransfer", - "complete" - ]); - }); -}); diff --git a/apps/frontend/src/translations/helpers.test.ts b/apps/frontend/src/translations/helpers.test.ts index 6f3c23a5d..7e0ec36f2 100644 --- a/apps/frontend/src/translations/helpers.test.ts +++ b/apps/frontend/src/translations/helpers.test.ts @@ -157,34 +157,3 @@ describe('Language Detection Helpers', () => { }); }); }); - -describe('Extensibility Example', () => { - it('demonstrates how easy it would be to add Spanish support', () => { - expect(Object.keys(LANGUAGE_FAMILIES)).toHaveLength(2); - - const extendedFamilies = { - ...LANGUAGE_FAMILIES, - es: 'es' as any - }; - - expect(Object.keys(extendedFamilies)).toHaveLength(3); - expect(extendedFamilies.es).toBe('es'); - }); - - it('demonstrates the simplicity of the language code extraction', () => { - - const testCases = [ - { input: 'pt-BR', expected: 'pt' }, - { input: 'pt-PT', expected: 'pt' }, - { input: 'en-US', expected: 'en' }, - { input: 'en-GB', expected: 'en' }, - { input: 'es-ES', expected: 'es' }, - { input: 'es-MX', expected: 'es' } - ]; - - testCases.forEach(({ input, expected }) => { - const languageCode = input.toLowerCase().split('-')[0]; - expect(languageCode).toBe(expected); - }); - }); -}); From 9430c7c988758a672b8aef0b1801ea935b014b7c Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 20:44:54 +0200 Subject: [PATCH 111/176] Record the second test-audit remediation pass in the findings doc Marks the webhook-delivery rewrite and every remaining open finding as remediated (fixed, rebuilt, skipped-with-pointer, or deleted), and updates the suite totals: apps/api 317 pass / 12 skip / 0 fail as one process, tracked frontend suite 88/88. --- docs/test-audit-findings.md | 69 ++++++++++++++++++++++++++++++++----- 1 file changed, 61 insertions(+), 8 deletions(-) diff --git a/docs/test-audit-findings.md b/docs/test-audit-findings.md index c7d03d67e..d19e5190b 100644 --- a/docs/test-audit-findings.md +++ b/docs/test-audit-findings.md @@ -24,14 +24,67 @@ Fixed in this branch: - ✅ dualAuth.test.ts renamed to ownershipAuth.test.ts. - ✅ cleanup.worker.test.ts neutralizes the CronJob runOnInit cleanup cycle that fired real DB queries on construction. - -Quarantined pending a rewrite (skip with pointer to this document): -- ⏸ webhook-delivery.service.test.ts (entire suite): predates RSA-PSS signing, global setTimeout - mock hangs the runner, stale payload shapes. -- ⏸ 6 EUR-onramp fixture cases in transactions/validation.test.ts: assert a removed flow. - -Still open: the remaining findings below (mostly cannot-fail assertions and stale fixtures that -don't affect other files). The full apps/api suite now passes as one process: 301 pass / 28 skip / 0 fail. +- ✅ webhook-delivery.service.test.ts rewritten against current production behavior (was + quarantined): real RSA-PSS signing via the cryptoService singleton with a verifySignature + round-trip, webhookService methods patched on the instance and restored in afterAll (no + mock.module), per-test fetch stubs with restore, real timers with 1ms backoff. Resolves the + cannot-fail (line 47), stale-or-dead (line 60), and both wrong-assertion (lines 157, 414) + findings below. + +Fixed in the second remediation pass (2026-07-05): +- ✅ The 6 quarantined EUR-onramp cases in transactions/validation.test.ts rebuilt on the live + Base BRL-onramp corridor (nablaApprove/squidRouterSwap/destinationTransfer on Networks.Base, + chainId 8453) and un-skipped; this also exercises the polymorphic nabla-on-Base=EVM mapping + that broke the old fixture. The cannot-fail "matches a signed EVM transaction..." test was + deleted (fully subsumed by the neighboring calldata-differences test). +- ✅ clientIp.test.ts: uses a non-loopback request IP (no more real ipify call) and asserts the + exact normalized value. +- ✅ priceFeed.service.test.ts: "without API key" test now controls the key on the instance and + asserts absence of the real header (x-cg-pro-api-key), plus a positive-presence companion; + exported-singleton caches cleared in beforeEach (order-independence); duplicate + "default values" config test deleted (its env deletion was inert). +- ✅ brla-onramp-hold.test.ts: missing-ticket case asserts updateState was not called instead of + re-asserting the fixture's initial value. +- ✅ squid-router-phase-handler.test.ts: Monerium fixture uses network=Base (BUY quote.network is + the destination by construction) and asserts the pre-settlement snapshot on (Base, USDC). +- ✅ ramp.service.register-auth.test.ts: no-effective-user test pins the guard's message so a + later unrelated 400 can't satisfy it. +- ✅ discount/helpers.test.ts: mislabeled "negative targetDiscount (rate floor)" block replaced + with genuine calculateExpectedOutput coverage (negative/positive discount, offramp inversion). +- ✅ webhook.service.test.ts: not-found test pins status 404 + message; registration-error test + resolves the quote so the rejection genuinely comes from Webhook.create (pins 500); orphaned + randomBytes mock removed. +- ✅ base.service.test.ts: sequelize/QuoteTicket singleton patches restored in afterAll. +- ✅ vars.test.ts: FLOW_VARIANT added to the required production env; subprocesses run with + cwd=os.tmpdir() so the developer's .env can no longer backfill missing variables. +- ✅ rebalancer config.test.ts: REBALANCING_DAILY_BRIDGE_LIMIT_USD added to the scrubbed env list. +- ✅ phase-processor.onramp.integration.test.ts: registerRamp now passes a userId, ephemeral keys + renamed to EVM/Substrate (they were silently dropped before), updateRamp reordered before + startRamp, vestigial ../brla/helpers mock deleted. +- ✅ phase-processor.recovery.integration.test.ts: loads the fixture from + failedRampStateRecovery.json with fail-fast validation, and polls currentPhase asserting + "complete" instead of an unconditional 50-minute sleep with zero expects. +- ✅ xcm/assethubToMoonbeam: dry-run test now asserts the Result is Ok and local execution + succeeded; the inert assetAccountKey parameter was dropped from the production function + (the asset is hardcoded to USDT on AssetHub). +- 🗑 xcm/moonbeamToAssethub.test.ts deleted: it targeted + createMoonbeamToAssethubTransferWithSwapOnHydration, whose own doc comment says the resulting + XCM cannot work on Moonbeam; the dead production function was left in place (flagged, not removed). +- 🗑 frontend phaseFlows.test.ts deleted: it compared PHASE_FLOWS to a verbatim copy of itself + (typos are already caught at compile time by the `as RampPhase[]` casts; backend parity was + never actually checked). +- 🗑 frontend translations/helpers.test.ts "Extensibility Example" block deleted: both tests + asserted properties of local objects they had just built; the real extraction path stays + covered by the getBrowserLanguage tests. + +Skipped with pointer (blocked on a product decision, not fixable in tests): +- ⏸ The two Mykobo EUR registration contract tests (mykobo-eur-offramp/onramp + .integration.test.ts) are it.skip'd: registerRamp unconditionally rejects EURC quotes with + 503 "EUR ramps are currently disabled" (commit be52569e4). Re-enable when EUR ramps return + or a test bypass for the guard exists. + +All findings below are now remediated. The full apps/api suite passes as one process: +317 pass / 12 skip / 0 fail. The tracked frontend suite passes 88/88. ## HIGH From e5d2d7cfe0fe177ec642db4b054e3db330d44384 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 20:46:00 +0200 Subject: [PATCH 112/176] Add coverage for ApiManager network configuration and env overrides --- .../src/services/pendulum/apiManager.test.ts | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 packages/shared/src/services/pendulum/apiManager.test.ts diff --git a/packages/shared/src/services/pendulum/apiManager.test.ts b/packages/shared/src/services/pendulum/apiManager.test.ts new file mode 100644 index 000000000..191362bf7 --- /dev/null +++ b/packages/shared/src/services/pendulum/apiManager.test.ts @@ -0,0 +1,55 @@ +import { afterEach, describe, expect, it } from "bun:test"; +import type { NetworkConfig } from "./apiManager"; + +const ORIGINAL_ENV = { ...process.env }; + +async function loadConfiguredNetworks(): Promise { + const modulePath = `./apiManager.ts?test=${Date.now()}-${Math.random()}`; + const { getConfiguredNetworks } = await import(modulePath); + return getConfiguredNetworks(); +} + +describe("ApiManager network configuration", () => { + afterEach(() => { + process.env = { ...ORIGINAL_ENV }; + }); + + it("uses default RPC URLs when no overrides are configured", async () => { + delete process.env.ASSETHUB_WSS; + delete process.env.HYDRATION_WSS; + delete process.env.MOONBEAM_WSS; + + const networks = await loadConfiguredNetworks(); + + expect(networks.find(network => network.name === "assethub")?.wsUrls).toEqual(["wss://dot-rpc.stakeworld.io/assethub"]); + expect(networks.find(network => network.name === "hydration")?.wsUrls).toEqual(["wss://rpc.hydradx.cloud"]); + expect(networks.find(network => network.name === "moonbeam")?.wsUrls).toEqual([ + "wss://wss.api.moonbeam.network", + "wss://moonbeam.api.onfinality.io/public-ws", + "wss://moonbeam.ibp.network" + ]); + }); + + it("uses configured RPC URL overrides", async () => { + process.env.ASSETHUB_WSS = "wss://asset-hub.example"; + process.env.HYDRATION_WSS = "wss://hydration.example"; + process.env.MOONBEAM_WSS = "wss://moonbeam.example"; + + const networks = await loadConfiguredNetworks(); + + expect(networks.find(network => network.name === "assethub")?.wsUrls).toEqual(["wss://asset-hub.example"]); + expect(networks.find(network => network.name === "hydration")?.wsUrls).toEqual(["wss://hydration.example"]); + expect(networks.find(network => network.name === "moonbeam")?.wsUrls).toEqual(["wss://moonbeam.example"]); + }); + + it("supports comma-separated RPC URL overrides", async () => { + process.env.MOONBEAM_WSS = "wss://moonbeam-one.example, wss://moonbeam-two.example"; + + const networks = await loadConfiguredNetworks(); + + expect(networks.find(network => network.name === "moonbeam")?.wsUrls).toEqual([ + "wss://moonbeam-one.example", + "wss://moonbeam-two.example" + ]); + }); +}); From 26d8670d266f037d798ce2ba471d0d06546a62cc Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 20:46:00 +0200 Subject: [PATCH 113/176] Add feasibility notes for the per-user EURC CCTP settlement contract --- .../per-user-eurc-cctp-settlement-contract.md | 540 ++++++++++++++++++ 1 file changed, 540 insertions(+) create mode 100644 docs/architecture/per-user-eurc-cctp-settlement-contract.md diff --git a/docs/architecture/per-user-eurc-cctp-settlement-contract.md b/docs/architecture/per-user-eurc-cctp-settlement-contract.md new file mode 100644 index 000000000..91191af15 --- /dev/null +++ b/docs/architecture/per-user-eurc-cctp-settlement-contract.md @@ -0,0 +1,540 @@ +# Per-User EURC Settlement Contract Feasibility Notes + +Last updated: 2026-06-25 + +This document summarizes the current design thinking for a per-user smart contract +that receives Circle EURC on Base, swaps it to Circle USDC, and sends the USDC to +the same user's predefined Ethereum wallet through Circle CCTP. + +It is intended as an implementation handoff for another AI agent. It is not legal +advice. + +## Executive Summary + +The flow is technically feasible: + +1. A partner or payer transfers EURC on Base to a per-user smart contract address. +2. Later, Vortex or any permitted caller invokes a contract function that sweeps + the current EURC balance. +3. The contract swaps EURC to USDC on Base through a DEX route. +4. The contract calls Circle CCTP V2 to burn the USDC on Base for minting on + Ethereum. +5. The final USDC is minted to the user's hardcoded Ethereum wallet address. + +The important architectural principle is to keep the custody-critical parts +immutable, especially the final recipient. Any flexibility should be limited to +the swap mechanism and protected by strong guardrails. + +## Core Requirements + +The per-user contract should: + +- Be deployed once per onboarded customer. +- Receive EURC on Base through a normal ERC-20 `transfer`. +- Hardcode the user's final Ethereum wallet address at deployment. +- Prevent any later change to the final recipient. +- Prevent admin withdrawal of EURC or USDC. +- Prevent arbitrary calls to external contracts. +- Swap the full available EURC balance, or an explicitly bounded amount. +- Bridge/burn the resulting USDC through CCTP V2 to Ethereum. +- Emit enough events for operations, reconciliation, and support. + +The partner-facing interpretation is: + +- The smart contract is a customer-specific technical settlement address. +- The sole permitted economic beneficiary is the same known customer. +- The contract cannot redirect funds to Vortex or another third party. +- Vortex may operate the automation, but the code should not require Vortex's + key for the funds to eventually move. + +## Current Circle/CCTP Facts To Verify Before Implementation + +Verified from Circle docs on 2026-06-25: + +- EURC exists on Base at `0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42`. +- USDC exists on Base at `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`. +- USDC exists on Ethereum at `0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`. +- CCTP V2 supports Base and Ethereum. +- Circle CCTP domain IDs are: + - Ethereum: `0` + - Base: `6` +- CCTP V2 supports USDC transfers across supported domains. +- CCTP V2 does not remove the need to swap EURC to USDC first for this flow. +- CCTP `depositForBurn` burns USDC on the source chain; minting on Ethereum + happens later after Circle attestation. + +Current mainnet CCTP V2 EVM addresses from Circle docs: + +- `TokenMessengerV2`: `0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d` +- `MessageTransmitterV2`: `0x81D40F21F12A8F0E3252Bccb954D722d4c464B64` + +Do not rely on this document alone at implementation time. Re-check Circle's +official contract address pages immediately before deployment. + +## Important Flow Detail + +A normal ERC-20 `transfer` to a smart contract does not automatically call the +receiving smart contract. The intended flow is therefore asynchronous: + +```text +Partner transfers EURC to per-user contract on Base +Later: + Vortex service, user, keeper, or any public caller calls sweep() + Contract swaps EURC -> USDC on Base + Contract calls CCTP depositForBurn(...) +Later: + Circle attests the burn + Ethereum-side mint is completed either directly or through a forwarding service +``` + +The source-chain Base transaction can perform the sweep, swap, and CCTP burn in +one transaction. It cannot complete the Ethereum-side mint in that same Base +transaction. + +## Recommended Contract Shape + +Recommended pattern: immutable per-user vault with a constrained swap adapter. + +Immutable constructor values: + +- `EURC_BASE` +- `USDC_BASE` +- `CCTP_TOKEN_MESSENGER_V2_BASE` +- `ETHEREUM_DESTINATION_DOMAIN = 0` +- `ETHEREUM_MINT_RECIPIENT` +- Optional: `DESTINATION_CALLER` + +Mutable value, if flexibility is required: + +- `swapAdapter` + +The main contract should retain control over all custody-critical logic. The +adapter should only be responsible for converting EURC to USDC and returning the +USDC to the main contract. + +Avoid this pattern: + +```solidity +function execute(address target, bytes calldata data) external onlyOwner; +``` + +An arbitrary execution function creates broad admin control over deposited funds +and weakens the argument that the contract is just a technical settlement +address for a known customer. + +## Sweep Function Sketch + +Conceptual flow: + +```text +function sweep(uint256 minUsdcOut, uint256 cctpMaxFee, uint32 minFinalityThreshold): + eurcAmount = EURC.balanceOf(this) + require(eurcAmount > 0) + + usdcBefore = USDC.balanceOf(this) + + approve EURC exactly eurcAmount to swapAdapter + call swapAdapter.swapExactEurcForUsdc(eurcAmount, minUsdcOut, this) + reset EURC approval to zero + + usdcAfter = USDC.balanceOf(this) + usdcReceived = usdcAfter - usdcBefore + require(usdcReceived >= minUsdcOut) + + approve USDC exactly usdcReceived to TokenMessengerV2 + call TokenMessengerV2.depositForBurn( + amount = usdcReceived, + destinationDomain = 0, + mintRecipient = bytes32(uint256(uint160(ETHEREUM_MINT_RECIPIENT))), + burnToken = USDC_BASE, + destinationCaller = DESTINATION_CALLER_OR_ZERO, + maxFee = cctpMaxFee, + minFinalityThreshold = minFinalityThreshold + ) + reset USDC approval to zero if needed + + emit SweptAndBurned(eurcAmount, usdcReceived, minUsdcOut, ...) +``` + +Implementation notes: + +- Use SafeERC20-style wrappers. +- Approve exact amounts, not unlimited allowances. +- Reset allowances after use where compatible. +- Add a non-reentrancy guard. +- Validate the swap adapter output by measuring USDC balance deltas. +- Consider supporting partial sweeps only if there is a clear operational need. +- Avoid handling native ETH unless needed for a specific DEX path. + +## Swap Adapter Design + +The swap adapter exists because DEX routes may change over time. It should be +constrained so that changing the adapter does not allow Vortex to redirect user +funds. + +Adapter expectations: + +- Input token must be Base EURC. +- Output token must be Base USDC. +- Output recipient must be the per-user settlement contract. +- The adapter must not retain EURC or USDC balances after a swap. +- The adapter should enforce a deadline and minimum output. + +Main contract checks: + +- Only transfer EURC to the adapter for the exact swap amount. +- Check the USDC balance before and after adapter execution. +- Revert if the USDC delta is below `minUsdcOut`. +- Do not allow the adapter to specify the CCTP recipient. + +Adapter update options: + +1. No mutability: redeploy a new per-user contract if the DEX route breaks. +2. Mutable `swapAdapter` controlled by multisig/timelock. +3. Mutable `swapAdapter` plus public delayed activation and event monitoring. + +Recommended compromise: + +- Use a mutable `swapAdapter`, but only with a narrow setter. +- Control it with a multisig. +- Prefer a timelock if partner/compliance posture matters. +- Emit `SwapAdapterUpdated(oldAdapter, newAdapter)`. +- Exclude any function that changes recipient, token addresses, CCTP contracts, + or destination domain. + +## Permissioning The Sweep + +Options: + +1. Permissionless `sweep` + - Anyone can trigger the swap and CCTP burn. + - Best for liveness and strongest non-custodial argument. + - Requires caller-provided `minUsdcOut`, or a robust onchain/offchain quote + mechanism to avoid bad execution. + +2. Service-only `sweep` + - Only Vortex automation can call the function. + - Easier operational control. + - Weaker custody posture because funds depend on Vortex action. + +3. Hybrid + - Service-only by default, but permissionless after a timeout. + - More complex, but may balance UX and liveness. + +Recommended starting point: + +- Prefer permissionless sweep if slippage protection can be made safe. +- Otherwise use service-only for the first version, but recognize the custody + and liveness implications. + +## Slippage, Pricing, And MEV + +The main market risk is the EURC -> USDC swap. + +The contract must not perform a swap without price protection. Without a +meaningful `minUsdcOut`, the sweep can be front-run or executed at a bad price. + +Possible controls: + +- Backend obtains a fresh DEX quote and passes `minUsdcOut`. +- Apply a strict slippage tolerance. +- Use a deadline. +- Consider a TWAP/oracle sanity check if the swap size is large. +- Emit quoted and actual amounts for monitoring. +- Consider maximum sweep size if pool liquidity is thin. + +Open implementation choice: + +- Select DEX route on Base: Uniswap, Aerodrome, or another venue. +- Decide whether to use a direct EURC/USDC pool or a multi-hop route. +- Decide whether to use an aggregator. Aggregators improve routing but often + require broader calldata/execution permissions, which may weaken the custody + story. + +## CCTP Direct Mint Vs Forwarding Service + +CCTP is a burn-and-mint protocol. After the Base burn, Ethereum minting happens +after Circle attests the burn. + +Direct mint: + +```text +Base contract calls depositForBurn +Backend polls Circle attestation +Backend or any caller submits receiveMessage(message, attestation) on Ethereum +USDC is minted to the user's Ethereum recipient +``` + +Pros: + +- Full control over destination submission. +- No forwarding-service dependency. +- No forwarding-service fee. + +Cons: + +- Requires Ethereum gas and relayer operations. +- Requires attestation polling, retries, and monitoring. + +Forwarding service: + +```text +Base burn is initiated with forwarding-supported flow +Circle or its forwarding infrastructure handles destination execution +USDC is minted to the user's Ethereum recipient +``` + +Pros: + +- Simpler operations. +- No Vortex Ethereum relayer wallet required for mint submission. + +Cons: + +- Forwarding fees may reduce received amount. +- Route/support details must be confirmed. +- More dependency on Circle's infrastructure. + +Recommended default: + +- Use forwarding if it is supported for Base -> Ethereum and works cleanly with + the chosen integration path. +- Use direct mint if exact operational control, lower fees, or custom retry + behavior is more important. + +## Custody And Partner-Licensing Posture + +The deployer is not automatically the custodian just because it deployed the +contract. The stronger question is who can access, redirect, freeze, upgrade +around, or otherwise control the funds while they are in the contract. + +Lower-control posture: + +- One contract per customer. +- Final Ethereum recipient hardcoded at deployment. +- Recipient cannot be changed. +- No admin withdrawal for EURC or USDC. +- No arbitrary execution. +- Sweep is permissionless, or at least not dependent forever on Vortex. +- Source code is verified. +- Partner can map the contract address to the same known customer. + +Higher-control posture: + +- Vortex can change the recipient. +- Vortex can withdraw EURC or USDC. +- Vortex can call arbitrary contracts with the user's token balances. +- Vortex can upgrade the whole vault implementation. +- Vortex is the only party able to move the funds onward. + +For the stablecoin partner, the key question is whether they can treat the smart +contract as a customer-specific technical receiving address. The best framing is: + +```text +The payout address is a deterministic, verified, customer-specific settlement +contract. The sole hardcoded destination is the KYC'd customer's wallet. The +contract has no admin withdrawal path and no recipient mutation. +``` + +Avoid informal custody phrasing. Use "the sole permitted economic beneficiary is +the same known customer" instead. + +## Per-User Contract Vs Reusing One Contract + +Per-user contract advantages: + +- Partner can map one static reference to one contract address. +- Contract can hardcode one final Ethereum recipient. +- Easier to explain as a customer-specific settlement address. +- Reduces risk that accounting or balances mix between users. + +Per-user contract disadvantages: + +- More deployments. +- More address management. +- Need to handle old contract addresses if users rotate final wallets. + +Shared contract advantages: + +- Fewer deployments. +- Centralized route updates. +- Easier contract operations. + +Shared contract disadvantages: + +- Requires internal user accounting. +- Requires mutable recipient mappings or deposit identifiers. +- Harder partner/compliance story. +- More severe blast radius if there is a bug. + +Recommendation: + +- Use one contract per customer for this flow. + +## Deployment And Address Management + +Use a factory if possible. A factory gives a repeatable deployment path, makes +verification easier, and can optionally support deterministic addresses through +`CREATE2`. + +Suggested deployment record per customer: + +- Customer/user ID in Vortex systems. +- Partner static payment reference. +- Per-user contract address on Base. +- Hardcoded Ethereum recipient. +- Constructor arguments. +- Contract implementation/version hash. +- Swap adapter configured at deployment. +- Source verification URL. + +If deterministic deployment is useful, derive the salt from stable internal data +that does not leak unnecessary personal information. For example, use a hash of +an internal customer ID plus environment/version data, not raw email addresses +or names. + +Once a customer contract address has been given to the partner, treat it as a +long-lived receiving address. If the user changes their final Ethereum wallet, +deploy a new per-user contract and coordinate a mapping update with the partner. +Do not make the old contract recipient mutable just to support address rotation. + +## Redeploying On DEX Changes + +If absolutely everything is immutable, any DEX or route break requires deploying +a new contract and giving the partner a new per-user address. + +This is clean from a control perspective but operationally risky: + +- Partner must update mappings. +- Users or partners may accidentally send to old addresses. +- Funds already sitting in the old contract may become stuck if the route breaks. + +Recommended compromise: + +- Keep recipient and CCTP behavior immutable. +- Make only the swap adapter replaceable. +- Make adapter replacement narrow, visible, and delayed where possible. + +## Events To Include + +Suggested events: + +```solidity +event SweptAndBurned( + address indexed caller, + uint256 eurcAmount, + uint256 usdcAmount, + uint256 minUsdcOut, + uint32 destinationDomain, + bytes32 mintRecipient, + uint64 cctpNonce +); + +event SwapAdapterUpdated(address indexed oldAdapter, address indexed newAdapter); +``` + +In practice, CCTP also emits `DepositForBurn` and `MessageSent`. The backend +should index those events to track burn nonces and attestation status. + +Do not rely on failure events for reverted transactions. Events emitted before a +revert are rolled back. Failed sweeps should be observed through transaction +receipts, RPC simulation, backend logs, and monitoring. + +## Key Failure Modes + +- No EURC balance: `sweep` should revert cheaply. +- Bad DEX quote or price movement: `sweep` should revert because + `minUsdcOut` is not met. +- DEX route unavailable: funds remain in the per-user contract until a working + route or adapter is available. +- CCTP burn fee or allowance issue: transaction reverts before funds leave the + contract as USDC. +- CCTP burn succeeds but destination mint is delayed: backend must track the + burn event and attestation state. +- Direct mint relayer lacks Ethereum gas: burn is complete, but mint submission + waits until a caller submits `receiveMessage`. +- Partner sends to an old contract: funds follow that old contract's hardcoded + recipient and route constraints; address rotation needs operational controls. + +## Backend Responsibilities + +The backend/automation service should: + +- Track deployed per-user contract addresses. +- Provide addresses to the partner for static-reference mapping. +- Monitor EURC balances on those contracts. +- Quote swaps and decide `minUsdcOut`. +- Call `sweep` when balances are available. +- Track DEX transaction, CCTP burn, attestation, and destination mint. +- Handle failed sweeps and retry safely. +- Reconcile final Ethereum receipt with the customer/ramp state. +- Alert if funds remain idle beyond expected time. + +For direct mint, the backend must also: + +- Poll Circle's attestation service. +- Submit `receiveMessage(message, attestation)` on Ethereum. +- Maintain ETH for gas, or use a relayer/paymaster setup. +- Retry destination mint submission until complete. + +## Testing Checklist + +Contract tests: + +- Can receive EURC via normal transfer. +- Sweep reverts when EURC balance is zero. +- Sweep swaps EURC to USDC and burns through CCTP with correct parameters. +- Recipient address cannot be changed. +- Owner/admin cannot withdraw EURC or USDC. +- Adapter cannot redirect output to itself or a third party. +- Sweep reverts when USDC received is below `minUsdcOut`. +- Sweep uses exact approvals. +- Reentrancy attempts fail. +- Adapter update emits event and respects access control/timelock. +- Wrong token, wrong recipient, or wrong output behavior fails. + +Fork/integration tests: + +- Base mainnet fork against selected DEX route. +- Base Sepolia/Ethereum Sepolia CCTP test flow if EURC liquidity/test route is + available. +- Direct mint end-to-end if using direct mint. +- Forwarding-service end-to-end if using forwarding. + +Operational tests: + +- Partner static reference maps to contract address. +- Backend detects deposits. +- Backend sweeps with current quote. +- Backend retries failed sweeps. +- Backend handles partial DEX liquidity or high slippage. +- Backend reconciles CCTP burn and Ethereum mint. + +## Open Questions + +- Which Base DEX or aggregator should be used for EURC -> USDC? +- Is there enough EURC/USDC liquidity on the chosen venue for expected ticket + sizes? +- Should `sweep` be permissionless, service-only, or hybrid? +- Should the swap adapter be mutable, and if yes, who controls it? +- Is a timelock acceptable operationally for adapter updates? +- Direct mint or forwarding service for the Ethereum mint step? +- What minimum finality threshold should be used for CCTP V2? +- What is the acceptable forwarding fee or CCTP fee behavior? +- Will the stablecoin partner approve transfers to verified per-user settlement + contracts? +- How will partner/customer records prove that a contract maps to the same known + customer and hardcoded Ethereum recipient? + +## Source Links + +- Circle CCTP supported chains and domains: + https://developers.circle.com/cctp/cctp-supported-blockchains +- Circle CCTP EVM contract interfaces: + https://developers.circle.com/cctp/references/contract-interfaces +- Circle CCTP EVM contract addresses: + https://developers.circle.com/cctp/references/contract-addresses +- Circle USDC contract addresses: + https://developers.circle.com/stablecoins/usdc-contract-addresses +- Circle EURC contract addresses: + https://developers.circle.com/stablecoins/eurc-contract-addresses From 875d0b85b322f26b43801923832e5344a2b9778c Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 20:46:09 +0200 Subject: [PATCH 114/176] Add partner-facing recovery and responsibility model docs --- .../13-v0.6.0-recovery-and-responsibility.md | 162 ++++++++++++++++++ docs/api/pages/recovery-and-responsibility.md | 122 +++++++++++++ 2 files changed, 284 insertions(+) create mode 100644 docs/api/pages/13-v0.6.0-recovery-and-responsibility.md create mode 100644 docs/api/pages/recovery-and-responsibility.md diff --git a/docs/api/pages/13-v0.6.0-recovery-and-responsibility.md b/docs/api/pages/13-v0.6.0-recovery-and-responsibility.md new file mode 100644 index 000000000..44d5c2bdb --- /dev/null +++ b/docs/api/pages/13-v0.6.0-recovery-and-responsibility.md @@ -0,0 +1,162 @@ +# v0.6.0 Recovery and Responsibility Model + +This note is for API partners reviewing the v0.6.0 BRL/PIX ramp hardening before scaling production volume. It focuses on two questions: + +1. What changed in v0.6.0 to prevent recurrence of presigned-transaction and backup-transaction failures? +2. Who owns each failure domain before the next incident happens? + +Related release PRs: + +- [pendulum-chain/vortex#1152](https://github.com/pendulum-chain/vortex/pull/1152) +- [pendulum-chain/vortex#1153](https://github.com/pendulum-chain/vortex/pull/1153) + +## Bottom Line + +For a normal Vortex-managed ramp, the recoverability condition is: + +> The ephemeral key backups must exist, be intact, and be accessible until the ramp is complete and the recovery window has passed. + +Vortex stores the server-generated unsigned transaction plan plus the accepted presigned primary, backup, and fallback transactions for the ramp. That lets Vortex continue or retry the ramp without asking the API client to manually re-sign during normal recovery. + +The client-held ephemeral backup remains the final recovery dependency. If a recovery path needs a new signature that was not already accepted and stored by Vortex, Vortex cannot reconstruct the ephemeral key. If the partner loses the ephemeral backup, recovery may be limited to the already accepted presigned transactions, provider reconciliation, bridge refunds, or chain-specific cleanup paths. + +## What Changed In v0.6.0 + +The practical change is that the system now refuses to let value move until the recovery transaction set has been validated. + +Before v0.6.0, a bad or incomplete presigned transaction set could make it farther into the ramp lifecycle. That created a dangerous failure mode: user funds could enter the ramp while Vortex did not yet have a complete and content-validated transaction set to continue or recover the process. + +In v0.6.0, the backend validates the presigned transaction set at two gates: + +- `updateRamp`: every submitted transaction is validated before being merged into ramp state. Partial submissions are allowed, but only valid transactions are accepted. +- `startRamp`: the complete ephemeral-signed transaction set must be present and valid before the phase processor starts. + +For BRL onramps, PIX payment details are released only after the presigned transaction checks pass. For BRL offramps, user-wallet transactions are not exposed until the ephemeral presigned set has passed validation. This prevents the user or partner from moving funds into a ramp whose recovery material is missing or malformed. + +## Specific Hardening + +| Area | v0.6.0 behavior | Why it prevents recurrence | +|---|---|---| +| Completeness gate | Every expected ephemeral-signed unsigned transaction must have a corresponding accepted presigned transaction before `startRamp`. | Vortex does not start execution unless it has the transaction material needed to continue the ramp. | +| Exact matching | Submitted transactions are matched to the server-issued unsigned plan by `phase`, `network`, `nonce`, and `signer`. Unknown or extra transactions are rejected. | A client cannot swap in a transaction for the same phase that moves funds somewhere else. | +| EVM content validation | Signed EVM transactions are decoded and checked for recovered signer, nonce, chain ID, `to`, calldata, value, gas limit, and fee caps. Contract-creation and chainless replayable transactions are rejected. | A signed transaction can no longer pass validation merely because the metadata looks right. The payload itself must match the Vortex-generated plan. | +| EIP-712 validation | Signed typed data is deep-compared against the server-issued typed data before signature recovery. | Permit fields such as token, spender, amount, deadline, owner, and verifying contract cannot be substituted. | +| Backup transactions | Each ephemeral-signed transaction must include exactly the expected backup set. For EVM backups, each backup is revalidated against the same unsigned payload with sequential nonces. For Substrate backups, the backup call must match the primary call. | Backups are not just stored as opaque extras. They are checked to ensure a retry cannot execute a different action. | +| User-wallet phases | SELL-side user-wallet phases are not accepted as presigned transactions. The client submits the on-chain tx hash, and Vortex verifies the receipt and calldata against the unsigned blueprint. | A partner cannot accidentally or maliciously attach a fake presigned transaction for a phase that must be performed by the user's wallet. | +| Payment-data gating | PIX QR / payment data is hidden until the presigned set is valid. | Users are not asked to pay before Vortex has a validated recovery path. | +| SDK pre-flight checks | The SDK performs BRL KYC, PIX key, and remaining-limit checks before registration where possible. | Avoidable failures are caught before the ramp is created or before funds move. | + +## Recovery Model + +```mermaid +flowchart TD + A["Quote"] --> B["Register ramp
ephemeral public addresses"] + B --> C["Client signs primary + backups"] + C --> D{"Vortex validation passes?"} + D -->|No| E["Reject before funds move
fix/re-register"] + D -->|Yes| F["Payment data or user txs released"] + F --> G["Start ramp"] + G --> H{"Phase fails?"} + H -->|No| I["Complete"] + H -->|Yes| J["Vortex retries using stored txs,
backups, fallback txs, hashes,
provider state, and phase logs"] + J --> K{"Need new signature?"} + K -->|No| H + K -->|Yes| L["Use partner-held ephemeral backup
or escalate if backup unavailable"] +``` + +The intended production behavior is: + +- Vortex handles phase retries and normal recovery using the presigned material already stored in ramp state. +- The API client should not need to manually intervene for ordinary retries after a ramp has started. +- The API client must keep the ephemeral backup available so that exceptional recovery remains possible. +- If a ramp fails before funds move, the normal answer is to re-quote and register a fresh ramp. +- If funds have moved, the normal answer is to identify where they are and continue, recover, refund, or reconcile from that point. + +## R$100 Validation Ramp + +Before increasing volume, run one small BRL ramp end-to-end and deliberately inspect the recovery gates. + +Recommended test: + +1. Pin the integration to `@vortexfi/sdk` v0.6.0 or a direct API implementation with equivalent validation behavior. +2. Confirm ephemeral backups are written to the partner's secure store before payment or user-wallet signing continues. +3. Create a small BRL quote, for example around R$100. +4. Register the ramp and record `quoteId`, `rampId`, SDK/client version, environment, partner order ID, and an internal reference to the encrypted ephemeral backup. Do not expose the key material. +5. Confirm PIX payment details or user-wallet transactions are only returned after `updateRamp` accepts the presigned transaction set. +6. Complete the PIX payment or user-wallet transaction. +7. Confirm the ramp progresses to completion without additional partner signing. +8. Confirm webhooks and `GET /v1/ramp/{id}` agree on final status. +9. Confirm support can retrieve `GET /v1/ramp/{id}/errors` if the ramp stalls. + +Recommended negative tests in sandbox or staging: + +- Submit a presigned EVM transaction with the wrong recipient or calldata. Expected result: API rejects it. +- Remove backup transactions from an ephemeral-signed transaction. Expected result: API rejects it. +- Change a backup nonce sequence. Expected result: API rejects it. +- Submit a SELL user-wallet phase as a presigned transaction instead of a tx hash. Expected result: API rejects it. + +Success criteria: + +- No funds move before the presigned set is accepted. +- Vortex has primary and backup transaction material before `startRamp`. +- The partner can prove the ephemeral backup exists without exposing it. +- The ramp completes, or if it stalls, the current phase and recovery owner are clear. + +## Responsibility Model + +This is an operational ownership model, not a replacement for commercial/legal terms. + +| Failure domain | Primary owner | What that owner is responsible for | +|---|---|---| +| SDK bug in v0.6.0+ | Vortex | Fixing SDK behavior, documenting affected versions, providing migration guidance, and supporting recovery for ramps that used the SDK as intended. | +| Client-side SDK misuse | API client | Pinning supported versions, not modifying signing behavior, not bypassing SDK safeguards, and testing the integration before scaling. | +| Direct API signing implementation | API client | Matching SDK behavior exactly: fresh ephemerals, secure backups, exact payload validation before signing, idempotency, and correct `updateRamp` / `startRamp` ordering. | +| Backend accepts invalid presigned data | Vortex | Validation correctness, rejection of malformed or substituted payloads, and not releasing payment/user-funding steps before validation passes. | +| Ephemeral key custody | API client | Generating per-ramp ephemerals, storing encrypted backups, retaining them through the recovery window, and making them accessible during incident response. | +| Stored presigned/fallback transaction execution | Vortex | Persisting accepted transaction material, retrying recoverable phases, using backup/fallback transactions when needed, and maintaining phase/error logs. | +| Squid/Axelar failure | Vortex as recovery operator; Squid/Axelar as external dependency | Monitoring bridge state, adding gas where required, waiting for arrival/refund, retrying recoverable errors, and coordinating external escalation. | +| Pendulum/Moonbeam/Base RPC or chain outage | Vortex as recovery operator; chain/RPC provider as external dependency | Holding the ramp in pending/retry state, avoiding double execution, switching/retrying infrastructure where available, and resuming when the chain recovers. | +| Network congestion | Shared | Vortex validates gas/fee minimums and retries phases. The client must not duplicate ramps or reuse stale quotes/signatures. Both sides communicate pending status to users. | +| PIX/Avenia provider issue | Vortex as recovery operator; Avenia/PIX as external dependency | Reconciling PIX payment, BRLA mint, Avenia subaccount balance, and payout ticket state. The client provides correct KYC/tax/PIX data and user communication. | +| Partner loses ephemeral backup | API client | This is the main unrecoverable client-side failure. Vortex can still use already accepted presigned material, but cannot recreate missing private keys. | +| Partner exposes `sk_*` or ephemeral secrets | API client | Immediate key rotation, incident disclosure, and containment. Vortex can revoke/rotate partner credentials but cannot undo exposed client-side key material. | + +## Incident Rule Of Thumb + +When a ramp is stuck: + +- If validation rejected the ramp before funds moved, restart from a fresh quote. +- If funds moved and Vortex has accepted presigned/backups, Vortex owns operational recovery through the phase processor, bridge/provider checks, fallback transactions, and support workflow. +- If recovery requires ephemeral signing material not already stored by Vortex, the API client must provide access to its encrypted ephemeral backup. +- If the ephemeral backup is missing or corrupted, that risk sits with the API client. +- If Vortex accepted invalid transaction material or failed to use valid stored recovery material correctly, that sits with Vortex. + +## Data To Keep For Every Ramp + +The client should persist: + +- `quoteId` +- `rampId` +- partner order ID +- user/session ID +- SDK/client version +- environment: sandbox or production +- webhook ID, if used +- user-submitted tx hashes, if any +- encrypted ephemeral-backup reference + +Vortex should persist: + +- server-issued unsigned transaction plan +- accepted presigned primary transactions +- accepted backup/fallback transactions +- provider references, payout ticket IDs, and transaction hashes +- phase history and error logs +- final transaction hash / explorer link where available + +Never share in support channels: + +- `sk_*` API keys +- ephemeral private keys +- user wallet private keys +- raw environment dumps diff --git a/docs/api/pages/recovery-and-responsibility.md b/docs/api/pages/recovery-and-responsibility.md new file mode 100644 index 000000000..a615a99b3 --- /dev/null +++ b/docs/api/pages/recovery-and-responsibility.md @@ -0,0 +1,122 @@ +# Recovery and Responsibility Model + +## Bottom Line + +For a normal Vortex-managed ramp, the recoverability condition is: + +> The ephemeral key backups must exist, be intact, and be accessible until the ramp is complete and the recovery window has passed. + +Vortex stores the server-generated unsigned transaction plan plus the accepted presigned primary, backup, and fallback transactions for the ramp. That lets Vortex continue or retry the ramp without asking the API client to manually re-sign during normal recovery. + +The client-held ephemeral backup remains the final recovery dependency. If a recovery path needs a new signature that was not already accepted and stored by Vortex, Vortex cannot reconstruct the ephemeral key. If the partner loses the ephemeral backup, recovery may be limited to the already accepted presigned transactions, provider reconciliation, bridge refunds, or chain-specific cleanup paths. + +## What Changed In v0.6.0 + +The practical change is that the system now refuses to let value move until the recovery transaction set has been validated. + +Before v0.6.0, a bad or incomplete presigned transaction set could make it farther into the ramp lifecycle. That created a dangerous failure mode: user funds could enter the ramp while Vortex did not yet have a complete and content-validated transaction set to continue or recover the process. + +In v0.6.0, the backend validates the presigned transaction set at two gates: + +- `updateRamp`: every submitted transaction is validated before being merged into ramp state. Partial submissions are allowed, but only valid transactions are accepted. +- `startRamp`: the complete ephemeral-signed transaction set must be present and valid before the phase processor starts. + +For BRL onramps, PIX payment details are released only after the presigned transaction checks pass. For BRL offramps, user-wallet transactions are not exposed until the ephemeral presigned set has passed validation. This prevents the user or partner from moving funds into a ramp whose recovery material is missing or malformed. + +## Specific Hardening + +| Area | v0.6.0 behavior | Why it prevents recurrence | +|---|---|---| +| Completeness gate | Every expected ephemeral-signed unsigned transaction must have a corresponding accepted presigned transaction before `startRamp`. | Vortex does not start execution unless it has the transaction material needed to continue the ramp. | +| Exact matching | Submitted transactions are matched to the server-issued unsigned plan by `phase`, `network`, `nonce`, and `signer`. Unknown or extra transactions are rejected. | A client cannot swap in a transaction for the same phase that moves funds somewhere else. | +| EVM content validation | Signed EVM transactions are decoded and checked for recovered signer, nonce, chain ID, `to`, calldata, value, gas limit, and fee caps. Contract-creation and chainless replayable transactions are rejected. | A signed transaction can no longer pass validation merely because the metadata looks right. The payload itself must match the Vortex-generated plan. | +| EIP-712 validation | Signed typed data is deep-compared against the server-issued typed data before signature recovery. | Permit fields such as token, spender, amount, deadline, owner, and verifying contract cannot be substituted. | +| Backup transactions | Each ephemeral-signed transaction must include exactly the expected backup set. For EVM backups, each backup is revalidated against the same unsigned payload with sequential nonces. For Substrate backups, the backup call must match the primary call. | Backups are not just stored as opaque extras. They are checked to ensure a retry cannot execute a different action. | +| User-wallet phases | SELL-side user-wallet phases are not accepted as presigned transactions. The client submits the on-chain tx hash, and Vortex verifies the receipt and calldata against the unsigned blueprint. | A partner cannot accidentally or maliciously attach a fake presigned transaction for a phase that must be performed by the user's wallet. | +| Payment-data gating | PIX QR / payment data is hidden until the presigned set is valid. | Users are not asked to pay before Vortex has a validated recovery path. | +| SDK pre-flight checks | The SDK performs BRL KYC, PIX key, and remaining-limit checks before registration where possible. | Avoidable failures are caught before the ramp is created or before funds move. | + +## Recovery Model + +```mermaid +flowchart TD + A["Quote"] --> B["Register ramp
ephemeral public addresses"] + B --> C["Client signs primary + backups"] + C --> D{"Vortex validation passes?"} + D -->|No| E["Reject before funds move
fix/re-register"] + D -->|Yes| F["Payment data or user txs released"] + F --> G["Start ramp"] + G --> H{"Phase fails?"} + H -->|No| I["Complete"] + H -->|Yes| J["Vortex retries using stored txs,
backups, fallback txs, hashes,
provider state, and phase logs"] + J --> K{"Need new signature?"} + K -->|No| H + K -->|Yes| L["Use partner-held ephemeral backup
or escalate if backup unavailable"] +``` + +The intended production behavior is: + +- Vortex handles phase retries and normal recovery using the presigned material already stored in ramp state. +- The API client should not need to manually intervene for ordinary retries after a ramp has started. +- The API client must keep the ephemeral backup available so that exceptional recovery remains possible. +- If a ramp fails before funds move, the normal answer is to re-quote and register a fresh ramp. +- If funds have moved, the normal answer is to identify where they are and continue, recover, refund, or reconcile from that point. + +## Responsibility Model + +This is an operational ownership model, not a replacement for commercial/legal terms. + +| Failure domain | Primary owner | What that owner is responsible for | +|---|---|---| +| SDK bug in v0.6.0+ | Vortex | Fixing SDK behavior, documenting affected versions, providing migration guidance, and supporting recovery for ramps that used the SDK as intended. | +| Client-side SDK misuse | API client | Pinning supported versions, not modifying signing behavior, not bypassing SDK safeguards, and testing the integration before scaling. | +| Direct API signing implementation | API client | Matching SDK behavior exactly: fresh ephemerals, secure backups, exact payload validation before signing, idempotency, and correct `updateRamp` / `startRamp` ordering. | +| Backend accepts invalid presigned data | Vortex | Validation correctness, rejection of malformed or substituted payloads, and not releasing payment/user-funding steps before validation passes. | +| Ephemeral key custody | API client | Generating per-ramp ephemerals, storing backups, retaining them through the recovery window, and making them accessible during incident response. | +| Stored presigned/fallback transaction execution | Vortex | Persisting accepted transaction material, retrying recoverable phases, using backup/fallback transactions when needed, and maintaining phase/error logs. | +| Squid/Axelar failure | Vortex as recovery operator; Squid/Axelar as external dependency | Monitoring bridge state, adding gas where required, waiting for arrival/refund, retrying recoverable errors, and coordinating external escalation. | +| Pendulum/Moonbeam/Base RPC or chain outage | Vortex as recovery operator; chain/RPC provider as external dependency | Holding the ramp in pending/retry state, avoiding double execution, switching/retrying infrastructure where available, and resuming when the chain recovers. | +| Network congestion | Shared | Vortex validates gas/fee minimums and retries phases. The client must not duplicate ramps or reuse stale quotes/signatures. Both sides communicate pending status to users. | +| PIX/Avenia provider issue | Vortex as recovery operator; Avenia/PIX as external dependency | Reconciling PIX payment, BRLA mint, Avenia subaccount balance, and payout ticket state. The client provides correct KYC/tax/PIX data and user communication. | +| Partner loses ephemeral backup | API client | This is the main unrecoverable client-side failure. Vortex can still use already accepted presigned material, but cannot recreate missing private keys. | +| Partner exposes `sk_*` or ephemeral secrets | API client | Immediate key rotation, incident disclosure, and containment. Vortex can revoke/rotate partner credentials but cannot undo exposed client-side key material. | + +## Incident Rule Of Thumb + +When a ramp is stuck: + +- If validation rejected the ramp before funds moved, restart from a fresh quote. +- If funds moved and Vortex has accepted presigned/backups, Vortex owns operational recovery through the phase processor, bridge/provider checks, fallback transactions, and support workflow. +- If recovery requires ephemeral signing material not already stored by Vortex, the API client must provide access to its ephemeral backup. +- If the ephemeral backup is missing or corrupted, that risk sits with the API client. +- If Vortex accepted invalid transaction material or failed to use valid stored recovery material correctly, that sits with Vortex. + +## Data To Keep For Every Ramp + +The client should persist: + +- `quoteId` +- `rampId` +- partner order ID +- user/session ID +- SDK/client version +- environment: sandbox or production +- webhook ID, if used +- user-submitted tx hashes, if any +- ephemeral-backup reference + +Vortex should persist: + +- server-issued unsigned transaction plan +- accepted presigned primary transactions +- accepted backup/fallback transactions +- provider references, payout ticket IDs, and transaction hashes +- phase history and error logs +- final transaction hash / explorer link where available + +Never share in support channels: + +- `sk_*` API keys +- ephemeral private keys +- user wallet private keys +- raw environment dumps From e0466adaa15dd76d2884c0f590a52396b2b5804f Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 20:46:10 +0200 Subject: [PATCH 115/176] Record the multi-agent code-review findings for the 1161 SDK branch --- docs/code-review-1161-sdk-changes.md | 91 ++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 docs/code-review-1161-sdk-changes.md diff --git a/docs/code-review-1161-sdk-changes.md b/docs/code-review-1161-sdk-changes.md new file mode 100644 index 000000000..9212ec66a --- /dev/null +++ b/docs/code-review-1161-sdk-changes.md @@ -0,0 +1,91 @@ +# Code Review: Branch `1161-sdk-changes-for-alfredpay-currencies-support` + +Review run: 2026-06-23 — 47 agents, 37 candidates verified, 21 kept, 16 refuted. + +--- + +## Confirmed Bugs + +### 1. `parseAPIError` missing "User address must be provided" mapping +**`packages/sdk/src/errors.ts:437`** + +When a caller submits an Alfredpay offramp with a missing `walletAddress`, the API returns `"User address must be provided for offramping."`. `parseAPIError` only maps `"fiatAccountId is required for Alfredpay offramp"`, so the wallet-missing error falls through to a generic `VortexSdkError`. Callers checking `instanceof MissingAlfredpayOfframpParametersError` never match and cannot give a targeted error message. + +**Fix:** Add a second mapping for `"User address must be provided for offramping."` in `parseAPIError`. + +--- + +### 2. `MissingAlfredpayOfframpParametersError` constructor message mismatch +**`packages/sdk/src/errors.ts:437`** + +`parseAPIError` matches on `"fiatAccountId is required for Alfredpay offramp"` but the constructor hardcodes `"Parameters fiatAccountId and walletAddress are required for Alfredpay offramp"`. Any caller logging or pattern-matching on `error.message` after catching sees the wrong text. + +**Fix:** Make the constructor accept an optional message so `parseAPIError` can forward the original API message. + +--- + +### 3. `submitUserTransactions` throws unrecoverably for unsupported tx types +**`packages/sdk/src/VortexSdk.ts:274`** + +If the API returns a user transaction the SDK classifies as `"unsupported"` (e.g. a raw Substrate hex string), `submitUserTransactions` throws `"Unsupported user transaction"` and aborts the entire loop. The ramp stalls with no recovery path short of calling `submitUserSignature` / `submitUserTxHash` directly. + +**Fix:** Add an optional `handleUnsupported` callback to `SubmitUserTransactionsHandlers`; call it when the type is unsupported. Throw if no handler is provided (consistent with `signTypedData`/`sendTransaction` guards). + +--- + +### 4. `submitUserSignature` has no guard on tx type — opaque internal error +**`packages/sdk/src/VortexSdk.ts:185`** + +Passing an `evm-transaction` typed tx to `submitUserSignature` instead of `submitUserTxHash` throws `'attachSignatures: phase X has no typed-data payloads to sign'` from deep inside `eip712.ts` rather than a clear API-boundary error. The ramp is left started-but-unsigned. + +**Fix:** Add a type check at the top of `submitUserSignature` and throw a clear pre-condition error. + +--- + +### 5. Rolling-deploy alert noise: `snapshotPreSettlementBalance` idempotency with old ramps +**`apps/api/src/api/services/phases/handlers/squid-router-phase-handler.ts:40`** + +Ramps started under the old deployment have `preSettlementBalance` written post-swap. When the new deployment picks them up, the idempotency guard skips re-snapshotting (correct). The subsidy handler then computes `delivered ≈ 0`, the clamp fires, and a warn log is emitted. **No funds are lost** — the clamp protects correctly — but expect alert noise during a rolling deploy. No code change needed; operator awareness is sufficient. + +--- + +## Confirmed Code-Quality Issues + +### 6. `isTypedDataItem` duplicates `isSignedTypedData` from `@vortexfi/shared` +**`packages/sdk/src/eip712.ts:24`** + +Character-for-character copy of `isSignedTypedData` already exported from shared. The shared import is present on line 3. Two copies means a future shape change to `SignedTypedData` must be applied in both places or the SDK filter will silently miss payloads. + +**Fix:** Remove `isTypedDataItem`; inline `isSignedTypedData` with a cast at the single call site in `typedDataToSign`. + +--- + +### 7. Copy-pasted 16-line post-register block in `AlfredpayHandler` +**`packages/sdk/src/handlers/AlfredpayHandler.ts:62`** + +`registerAlfredpayOnramp` and `registerAlfredpayOfframp` share an identical `storeEphemerals → signTransactions → build updateRequest → updateRamp` block. The same pattern exists in `BrlHandler`. A change to that block (error handling, new field) must be applied to all copies or behaviour diverges. + +**Status:** Noted; not fixed in this pass to keep changes surgical. + +--- + +### 8. `updateAlfredpayOfframp` body is identical to `BrlHandler.updateBrlOfframp` +**`packages/sdk/src/handlers/AlfredpayHandler.ts:128`** + +Both check `currentPhase === 'initial'`, build `UpdateRampRequest` with the same three hash fields, and call `updateRamp`. The phase-guard wording already diverges slightly. A new hash field added to `OfframpUpdateAdditionalData` must be reflected in both methods. + +**Status:** Noted; not fixed in this pass to keep changes surgical. + +--- + +## Plausible (not confirmed) + +### 9. `startRamp` always delegates to `brlHandler.startBrlRamp` for all ramp types +**`packages/sdk/src/VortexSdk.ts:176`** + +Works today (same API endpoint), but if `BrlHandler.startBrlRamp` ever gains BRL-specific pre-flight logic, Alfredpay ramps will incorrectly execute it. + +### 10. `AlfredpayHandler` duplicates `BrlHandler`'s constructor and private fields verbatim +**`packages/sdk/src/handlers/AlfredpayHandler.ts:21`** + +Four private field declarations + constructor body copied exactly. Adding a new dependency means updating both constructors and both wiring sites in `VortexSdk.ts`. From f511d159eb8aecfc66be730f33e2201ccabd87a5 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 20:46:34 +0200 Subject: [PATCH 116/176] Ignore local credential files and agent-tool artifacts --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index 80320bd44..680c6051b 100644 --- a/.gitignore +++ b/.gitignore @@ -57,9 +57,14 @@ CLAUDE.local.md # hardhat generated files in workspace contract projects contracts/*/artifacts contracts/*/cache +contracts/*/.env .mcp.json # Playwright E2E artifacts apps/frontend/test-results/ apps/frontend/playwright-report/ + +# Local credentials and agent-tool artifacts +.api-key.json +.playwright-mcp/ From 48c6c0fb3097aec406a46205d775c7df6b4a6d5d Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 22:16:14 +0200 Subject: [PATCH 117/176] Fix strict template-literal address types in the BRL corridor scenario test --- apps/api/src/tests/corridors/brl-onramp.scenario.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/api/src/tests/corridors/brl-onramp.scenario.test.ts b/apps/api/src/tests/corridors/brl-onramp.scenario.test.ts index 39f3f9351..fafc72174 100644 --- a/apps/api/src/tests/corridors/brl-onramp.scenario.test.ts +++ b/apps/api/src/tests/corridors/brl-onramp.scenario.test.ts @@ -116,7 +116,7 @@ describe("BRL onramp direct corridor (pix → BRLA on Base)", () => { */ async function setUpRegisteredRamp(options: { recipient?: `0x${string}` } = {}): Promise { const ephemeral = privateKeyToAccount(generatePrivateKey()); - const destination = privateKeyToAccount(generatePrivateKey()).address; + const destination = privateKeyToAccount(generatePrivateKey()).address as `0x${string}`; const user = await createTestUser(); await createTestTaxId(user.id, { taxId: TAX_ID }); @@ -260,7 +260,7 @@ describe("BRL onramp direct corridor (pix → BRLA on Base)", () => { it( "security regression: presigned transfer paying the wrong recipient fails the ramp unrecoverably", async () => { - const wrongRecipient = privateKeyToAccount(generatePrivateKey()).address; + const wrongRecipient = privateKeyToAccount(generatePrivateKey()).address as `0x${string}`; const setup = await setUpRegisteredRamp({ recipient: wrongRecipient }); scriptHappyWorld(setup); From 6047068293adf28eb23549514ec98f21f8cc7b0c Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 22:16:15 +0200 Subject: [PATCH 118/176] Neutralize WEBHOOK_PRIVATE_KEY in tests and make the pre-swap settlement delay overridable A real operator key in a local .env must never sign test webhook deliveries; the preload now blanks it so cryptoService generates a throwaway pair. The hardcoded 15s EVM settlement wait in SubsidizePreSwapPhaseHandler is now env-overridable (SUBSIDY_SETTLEMENT_DELAY_MS, same pattern as PHASE_PROCESSOR_RETRY_DELAY_MS, default unchanged) so hermetic corridor tests run in seconds instead of minutes. Also replaces an empty catch block that failed biome. --- .../services/phases/handlers/subsidize-pre-swap-handler.ts | 6 +++++- apps/api/src/test-utils/preload.ts | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/api/src/api/services/phases/handlers/subsidize-pre-swap-handler.ts b/apps/api/src/api/services/phases/handlers/subsidize-pre-swap-handler.ts index ce51a4db4..deaeb49c7 100644 --- a/apps/api/src/api/services/phases/handlers/subsidize-pre-swap-handler.ts +++ b/apps/api/src/api/services/phases/handlers/subsidize-pre-swap-handler.ts @@ -32,6 +32,10 @@ import { BasePhaseHandler } from "../base-phase-handler"; import { getEvmFundingAccount } from "../evm-funding"; import { StateMetadata } from "../meta-state-types"; +// Overridable so hermetic tests don't wait 15s for a settlement that the fake +// world applies instantly (same pattern as PHASE_PROCESSOR_RETRY_DELAY_MS). +const EVM_SETTLEMENT_DELAY_MS = parseInt(process.env.SUBSIDY_SETTLEMENT_DELAY_MS || "15000", 10); + export class SubsidizePreSwapPhaseHandler extends BasePhaseHandler { public getPhaseName(): RampPhase { return "subsidizePreSwap"; @@ -212,7 +216,7 @@ export class SubsidizePreSwapPhaseHandler extends BasePhaseHandler { } = this.getEvmSubsidyConfig(state, quote); // Wait for token settlement before checking balance - await new Promise(resolve => setTimeout(resolve, 15000)); + await new Promise(resolve => setTimeout(resolve, EVM_SETTLEMENT_DELAY_MS)); // Check current balance on EVM const currentBalance = await checkEvmBalanceForToken({ diff --git a/apps/api/src/test-utils/preload.ts b/apps/api/src/test-utils/preload.ts index ca3b0ff3c..e51b127a3 100644 --- a/apps/api/src/test-utils/preload.ts +++ b/apps/api/src/test-utils/preload.ts @@ -37,6 +37,9 @@ if (!process.env.RUN_LIVE_TESTS) { process.env.SUPABASE_SERVICE_KEY = "test-service-key"; process.env.ADMIN_SECRET = "test-admin-secret"; process.env.METRICS_DASHBOARD_SECRET = "test-metrics-secret"; + // Empty → cryptoService generates a throwaway RSA pair; a real operator key + // in a local .env must never sign test webhook deliveries. + process.env.WEBHOOK_PRIVATE_KEY = ""; // Dummy signing keys (well-known dev keys, no real funds) so code that // derives accounts works without ever using the operator's real seeds. @@ -51,13 +54,15 @@ if (!process.env.RUN_LIVE_TESTS) { // Fast retries so recoverable-error scenarios don't wait 30s per attempt. process.env.PHASE_PROCESSOR_RETRY_DELAY_MS = "25"; + // The fake EVM ledger settles instantly; skip the 15s settlement wait. + process.env.SUBSIDY_SETTLEMENT_DELAY_MS = "25"; // Close the shared Sequelize pool after the whole run so lingering pg // connections don't surface as unhandled "Connection terminated" errors. const { afterAll } = await import("bun:test"); afterAll(async () => { const { default: sequelize } = await import("../config/database"); - await sequelize.close().catch(() => {}); + await sequelize.close().catch(() => undefined); }); } From f286b927ef08bb9f747d254fa1aabd6cccfb8440 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 22:16:28 +0200 Subject: [PATCH 119/176] Add a mock-leak canary and restore the findByPk patch in the ramp status test The canary (aaa- prefix runs first in src/tests/, after all src/api unit tests) asserts that model statics, service singleton accessors, and global fetch are pristine, failing with the leaked seam's name if a test file skips its restore. The get-ramp-status test's module-scope QuoteTicket.findByPk mock now restores in afterAll, matching the repo-wide convention. --- .../ramp/ramp.service.get-ramp-status.test.ts | 7 +++- apps/api/src/tests/aaa-leak-probe.test.ts | 39 +++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 apps/api/src/tests/aaa-leak-probe.test.ts diff --git a/apps/api/src/api/services/ramp/ramp.service.get-ramp-status.test.ts b/apps/api/src/api/services/ramp/ramp.service.get-ramp-status.test.ts index 49e7c422a..87d266bbd 100644 --- a/apps/api/src/api/services/ramp/ramp.service.get-ramp-status.test.ts +++ b/apps/api/src/api/services/ramp/ramp.service.get-ramp-status.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, it, mock } from "bun:test"; +import { afterAll, describe, expect, it, mock } from "bun:test"; import { EPaymentMethod, FiatToken, Networks, RampDirection, RampPhase } from "@vortexfi/shared"; import { config } from "../../../config/vars"; import QuoteTicket from "../../../models/quoteTicket.model"; @@ -9,6 +9,11 @@ import { RampService } from "./ramp.service"; const createdAt = new Date("2026-06-10T12:31:56.420Z"); const updatedAt = new Date("2026-06-10T12:32:25.548Z"); +const originalFindByPk = QuoteTicket.findByPk; +afterAll(() => { + QuoteTicket.findByPk = originalFindByPk; +}); + QuoteTicket.findByPk = mock(async () => ({ countryCode: "BR", inputAmount: "25003", diff --git a/apps/api/src/tests/aaa-leak-probe.test.ts b/apps/api/src/tests/aaa-leak-probe.test.ts new file mode 100644 index 000000000..fcb45c855 --- /dev/null +++ b/apps/api/src/tests/aaa-leak-probe.test.ts @@ -0,0 +1,39 @@ +import { describe, expect, it } from "bun:test"; +import { ApiManager, BrlaApiService, EvmClientManager, MykoboApiService } from "@vortexfi/shared"; +import QuoteTicket from "../models/quoteTicket.model"; +import RampState from "../models/rampState.model"; + +/** + * Leak canary: asserts that the process-wide seams other test files patch + * (model statics, service singletons, global fetch) are pristine when this + * file runs. The `aaa-` prefix makes it the first file in src/tests/, i.e. + * after every src/api unit test in bun's discovery order — a patch that was + * not restored (or not gated behind RUN_LIVE_TESTS) fails here with a message + * naming the leaked seam instead of poisoning the integration suites below. + */ +describe("leak canary: no test file leaked a singleton patch", () => { + it("model statics are the real Sequelize implementations", () => { + for (const [name, fn] of [ + ["QuoteTicket.findByPk", QuoteTicket.findByPk], + ["QuoteTicket.update", QuoteTicket.update], + ["RampState.findByPk", RampState.findByPk], + ["RampState.update", RampState.update] + ] as const) { + // bun:test mock() functions carry a `.mock` call-tracking property. + expect((fn as unknown as { mock?: unknown }).mock, `${name} is a leftover bun mock`).toBeUndefined(); + } + }); + + it("service singleton accessors are the real static methods", () => { + // The fake world replaces these with anonymous arrows; the real static + // methods keep their declared names. + expect(EvmClientManager.getInstance.name, "EvmClientManager.getInstance was left faked").toBe("getInstance"); + expect(BrlaApiService.getInstance.name, "BrlaApiService.getInstance was left faked").toBe("getInstance"); + expect(MykoboApiService.getInstance.name, "MykoboApiService.getInstance was left faked").toBe("getInstance"); + expect(ApiManager.getInstance.name, "ApiManager.getInstance was left faked").toBe("getInstance"); + }); + + it("global fetch is not a leftover fetch guard", () => { + expect(globalThis.fetch.name, "the fetch guard was left installed").toBe("fetch"); + }); +}); From fe2fbc14c2ac8d32051ce91acd55ac6d22a65cbe Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 22:16:29 +0200 Subject: [PATCH 120/176] Pin consumeQuote's atomic status filter with a direct invariant test The registration flow's row-locked pre-check makes the WHERE status='pending' filter in consumeQuote a redundant second layer, so no behavioral test failed when it was removed (it survived a mutation audit). This test consumes a quote twice at the service level and asserts the second update reports zero affected rows, pinning the backstop directly. --- .../quote-consumption.invariants.test.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/apps/api/src/tests/quote-consumption.invariants.test.ts b/apps/api/src/tests/quote-consumption.invariants.test.ts index efd978e3a..a150c9377 100644 --- a/apps/api/src/tests/quote-consumption.invariants.test.ts +++ b/apps/api/src/tests/quote-consumption.invariants.test.ts @@ -119,6 +119,26 @@ describe("quote consumption invariants (BRL onramp)", () => { expect(ramps.length).toBe(1); }); + // Pins the atomic-UPDATE backstop directly: even if the registration flow's + // row-locked pre-check were removed, consumeQuote must refuse a non-pending + // quote at the database level (WHERE status = 'pending'). + it("consumeQuote reports zero affected rows for an already-consumed quote", async () => { + const { BaseRampService } = await import("../api/services/ramp/base.service"); + class ConsumeQuoteProbe extends BaseRampService { + public consume(id: string) { + return this.consumeQuote(id); + } + } + const probe = new ConsumeQuoteProbe(); + const quote = await createQuoteViaApi(); + + const [firstAffected] = await probe.consume(quote.id); + expect(firstAffected).toBe(1); + + const [secondAffected] = await probe.consume(quote.id); + expect(secondAffected).toBe(0); + }); + it("rejects a second registration after the quote is consumed", async () => { const user = await createTestUser(); await createTestTaxId(user.id, { taxId: TAX_ID }); From b32a8636ce42c983983c7bd3dc47d377f573ef2f Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 22:16:43 +0200 Subject: [PATCH 121/176] Add golden tests for the quote pricing math Five corridors with every fee field and the output amount pinned to exact values under fully scripted inputs (fake price feed, flat Avenia rate, a scripted Nabla quoter). A diff here means the pricing math changed: update the goldens consciously and call out the fee impact in the PR description. Closes the top recommended gap from the test-suite integrity audit. Note: the direct BRLA corridor reports networkFeeFiat=12.5 that is not reflected in the output amount; the goldens freeze current behavior, but that inconsistency deserves a product-level look. --- .../src/tests/quote-pricing.golden.test.ts | 252 ++++++++++++++++++ 1 file changed, 252 insertions(+) create mode 100644 apps/api/src/tests/quote-pricing.golden.test.ts diff --git a/apps/api/src/tests/quote-pricing.golden.test.ts b/apps/api/src/tests/quote-pricing.golden.test.ts new file mode 100644 index 000000000..c857b3f42 --- /dev/null +++ b/apps/api/src/tests/quote-pricing.golden.test.ts @@ -0,0 +1,252 @@ +import { afterAll, beforeAll, describe, expect, it } from "bun:test"; +import { EvmToken, FiatToken, Networks, RampDirection } from "@vortexfi/shared"; +import { resetTestDatabase, setupTestDatabase } from "../test-utils/db"; +import { type FakeWorld, installFakeWorld } from "../test-utils/fake-world"; +import { startTestApp, type TestApp } from "../test-utils/test-app"; + +/** + * Golden tests for the quote pricing math. Every external input is pinned: + * FakePrices rates (BRL 5/USD, USDC 1/USD), FakeBrla pay-in/pay-out rate 1, + * and a scripted Nabla quoter at 0.18 USDC per BRLA. Under those inputs the + * fee/output values below are pure functions of the pricing engines. + * + * A diff here means the pricing math changed. If that is intentional, update + * the goldens consciously and call out the fee impact in the PR description — + * never "fix" a golden to make CI pass. + */ +describe("quote pricing goldens (fixed input matrix)", () => { + let world: FakeWorld; + let app: TestApp; + + beforeAll(async () => { + world = installFakeWorld(); + await setupTestDatabase(); + await resetTestDatabase(); + app = await startTestApp(); + + // Deterministic Nabla swap quote: 18-decimal BRLA in → 6-decimal USDC out + // at a flat 0.18 USDC per BRLA. + world.evm.onReadContract = (_network, params) => { + if (params.functionName === "quoteSwapExactTokensForTokens") { + const amountIn = params.args?.[0] as bigint; + return (amountIn * 18n) / 100n / 10n ** 12n; + } + return undefined; + }; + }); + + afterAll(async () => { + await app?.close(); + world?.restore(); + }); + + const VOLATILE_FIELDS = ["id", "createdAt", "expiresAt"]; + + async function quoteViaApi(body: Record): Promise> { + const response = await app.request("/v1/quotes", { + body: JSON.stringify(body), + headers: { "Content-Type": "application/json" }, + method: "POST" + }); + expect(response.status).toBe(201); + const quote = (await response.json()) as Record; + for (const field of VOLATILE_FIELDS) { + expect(quote[field]).toBeTruthy(); + delete quote[field]; + } + return quote; + } + + const GOLDENS: Array<{ name: string; request: Record; expected: Record }> = [ + { + expected: { + anchorFeeFiat: "0.1", + anchorFeeUsd: "0.02", + feeCurrency: "BRL", + from: "pix", + inputAmount: "100.00", + inputCurrency: "BRL", + network: "base", + networkFeeFiat: "12.5", + networkFeeUsd: "2.5", + outputAmount: "99.90", + outputCurrency: "BRLA", + partnerFeeFiat: "0", + partnerFeeUsd: "0", + paymentMethod: "pix", + processingFeeFiat: "0.1", + processingFeeUsd: "0.02", + rampType: "BUY", + to: "base", + totalFeeFiat: "12.60", + totalFeeUsd: "2.520000", + vortexFeeFiat: "0", + vortexFeeUsd: "0" + }, + name: "BUY 100 BRL → BRLA on Base (direct Avenia corridor)", + request: { + from: "pix", + inputAmount: "100", + inputCurrency: FiatToken.BRL, + network: Networks.Base, + outputCurrency: EvmToken.BRLA, + rampType: RampDirection.BUY, + to: Networks.Base + } + }, + { + expected: { + anchorFeeFiat: "0.1", + anchorFeeUsd: "0.02", + feeCurrency: "BRL", + from: "pix", + inputAmount: "250.50", + inputCurrency: "BRL", + network: "base", + networkFeeFiat: "12.5", + networkFeeUsd: "2.5", + outputAmount: "250.40", + outputCurrency: "BRLA", + partnerFeeFiat: "0", + partnerFeeUsd: "0", + paymentMethod: "pix", + processingFeeFiat: "0.1", + processingFeeUsd: "0.02", + rampType: "BUY", + to: "base", + totalFeeFiat: "12.60", + totalFeeUsd: "2.520000", + vortexFeeFiat: "0", + vortexFeeUsd: "0" + }, + name: "BUY 250.50 BRL → BRLA on Base (flat anchor fee, not proportional)", + request: { + from: "pix", + inputAmount: "250.50", + inputCurrency: FiatToken.BRL, + network: Networks.Base, + outputCurrency: EvmToken.BRLA, + rampType: RampDirection.BUY, + to: Networks.Base + } + }, + { + expected: { + anchorFeeFiat: "0.1", + anchorFeeUsd: "0.02", + discountCurrency: "BRL", + discountFiat: "10.09", + discountUsd: "2.018000", + feeCurrency: "BRL", + from: "pix", + inputAmount: "100.00", + inputCurrency: "BRL", + network: "base", + networkFeeFiat: "0", + networkFeeUsd: "0", + outputAmount: "20.00", + outputCurrency: "USDC", + partnerFeeFiat: "0", + partnerFeeUsd: "0", + paymentMethod: "pix", + processingFeeFiat: "0.1", + processingFeeUsd: "0.02", + rampType: "BUY", + to: "base", + totalFeeFiat: "0.10", + totalFeeUsd: "0.020000", + vortexFeeFiat: "0", + vortexFeeUsd: "0" + }, + name: "BUY 100 BRL → USDC on Base (Nabla swap at 0.18, subsidy applied)", + request: { + from: "pix", + inputAmount: "100", + inputCurrency: FiatToken.BRL, + network: Networks.Base, + outputCurrency: EvmToken.USDC, + rampType: RampDirection.BUY, + to: Networks.Base + } + }, + { + expected: { + anchorFeeFiat: "0", + anchorFeeUsd: "0", + feeCurrency: "BRL", + from: "base", + inputAmount: "100.00", + inputCurrency: "BRLA", + network: "base", + networkFeeFiat: "0", + networkFeeUsd: "0", + outputAmount: "500.00", + outputCurrency: "BRL", + partnerFeeFiat: "0", + partnerFeeUsd: "0", + paymentMethod: "pix", + processingFeeFiat: "0", + processingFeeUsd: "0", + rampType: "SELL", + to: "pix", + totalFeeFiat: "0.00", + totalFeeUsd: "0.000000", + vortexFeeFiat: "0", + vortexFeeUsd: "0" + }, + name: "SELL 100 BRLA on Base → BRL (direct Avenia payout, 5 BRL/USD feed)", + request: { + from: Networks.Base, + inputAmount: "100", + inputCurrency: EvmToken.BRLA, + network: Networks.Base, + outputCurrency: FiatToken.BRL, + rampType: RampDirection.SELL, + to: "pix" + } + }, + { + expected: { + anchorFeeFiat: "0", + anchorFeeUsd: "0", + feeCurrency: "BRL", + from: "base", + inputAmount: "100.00", + inputCurrency: "USDC", + network: "base", + networkFeeFiat: "0", + networkFeeUsd: "0", + outputAmount: "500.00", + outputCurrency: "BRL", + partnerFeeFiat: "0", + partnerFeeUsd: "0", + paymentMethod: "pix", + processingFeeFiat: "0", + processingFeeUsd: "0", + rampType: "SELL", + to: "pix", + totalFeeFiat: "0.00", + totalFeeUsd: "0.000000", + vortexFeeFiat: "0", + vortexFeeUsd: "0" + }, + name: "SELL 100 USDC on Base → BRL (direct payout, 5 BRL/USD feed)", + request: { + from: Networks.Base, + inputAmount: "100", + inputCurrency: EvmToken.USDC, + network: Networks.Base, + outputCurrency: FiatToken.BRL, + rampType: RampDirection.SELL, + to: "pix" + } + } + ]; + + for (const golden of GOLDENS) { + it(golden.name, async () => { + const quote = await quoteViaApi(golden.request); + expect(quote).toEqual(golden.expected); + }); + } +}); From e8ad3de34cfc34027e023d4408c641ffdd7cbcd9 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 22:16:44 +0200 Subject: [PATCH 122/176] Add a hermetic MXN Alfredpay onramp corridor scenario Second processor-level corridor (spei -> USDT on Polygon, the Alfredpay mint token) alongside BRL: quote and registration go through the real HTTP API, /v1/ramp/update submits a fully validated presigned transfer (plus the four required backups) and creates the Alfredpay order, then the real PhaseProcessor drives the ramp against the fake world. Covers the happy path, a transient broadcast failure with retry, the wrong-recipient security regression, and an Alfredpay FAILED order. FakeAlfredpay grows onramp quote/order/status methods with scripting hooks (mirroring FakeBrla), and factories gain createTestAlfredpayCustomer for the KYC row registration requires. --- apps/api/src/test-utils/factories.ts | 21 + .../src/test-utils/fake-world/fake-anchors.ts | 106 +++++- .../corridors/mxn-onramp.scenario.test.ts | 360 ++++++++++++++++++ 3 files changed, 485 insertions(+), 2 deletions(-) create mode 100644 apps/api/src/tests/corridors/mxn-onramp.scenario.test.ts diff --git a/apps/api/src/test-utils/factories.ts b/apps/api/src/test-utils/factories.ts index 5a3cf2ee0..9508c5dca 100644 --- a/apps/api/src/test-utils/factories.ts +++ b/apps/api/src/test-utils/factories.ts @@ -1,4 +1,7 @@ import { + AlfredPayCountry, + AlfredPayStatus, + AlfredPayType, AveniaAccountType, type DestinationType, EPaymentMethod, @@ -12,6 +15,7 @@ import { generateApiKey, getKeyPrefix, hashApiKey } from "../api/middlewares/api import type { StateMetadata } from "../api/services/phases/meta-state-types"; import type { QuoteTicketMetadata } from "../api/services/quote/core/types"; import { config } from "../config/vars"; +import AlfredPayCustomer from "../models/alfredPayCustomer.model"; import ApiKey from "../models/apiKey.model"; import Partner from "../models/partner.model"; import QuoteTicket, { type QuoteTicketAttributes } from "../models/quoteTicket.model"; @@ -126,6 +130,23 @@ export async function seedVortexPartners(): Promise { } } +/** An Alfredpay-KYC'd customer linked to a user, as required by MXN/COP/USD/ARS ramp registration. */ +export async function createTestAlfredpayCustomer( + userId: string, + overrides: Partial<{ alfredPayId: string; country: AlfredPayCountry }> = {} +): Promise { + const seq = nextSeq(); + return AlfredPayCustomer.create({ + alfredPayId: overrides.alfredPayId ?? `test-alfredpay-customer-${seq}`, + country: overrides.country ?? AlfredPayCountry.MX, + lastFailureReasons: null, + status: AlfredPayStatus.Success, + statusExternal: null, + type: AlfredPayType.INDIVIDUAL, + userId + }); +} + /** An Avenia-KYC'd tax id linked to a user, as required by BRL ramp registration. */ export async function createTestTaxId(userId: string, overrides: Partial<{ taxId: string; subAccountId: string }> = {}) { const seq = nextSeq(); diff --git a/apps/api/src/test-utils/fake-world/fake-anchors.ts b/apps/api/src/test-utils/fake-world/fake-anchors.ts index 9e0872f2a..5d2f8741b 100644 --- a/apps/api/src/test-utils/fake-world/fake-anchors.ts +++ b/apps/api/src/test-utils/fake-world/fake-anchors.ts @@ -1,7 +1,17 @@ import { AlfredpayApiService, + type AlfredpayFee, + type AlfredpayFiatPaymentInstructions, + type AlfredpayOnrampQuote, + AlfredpayOnrampStatus, + type AlfredpayOnrampStatusMetadata, + type AlfredpayOnrampTransaction, AveniaTicketStatus, BrlaApiService, + type CreateAlfredpayOnrampQuoteRequest, + type CreateAlfredpayOnrampRequest, + type CreateAlfredpayOnrampResponse, + type GetAlfredpayOnrampTransactionResponse, MykoboApiService, type MykoboCreateIntentRequest, type MykoboCreateIntentResponse, @@ -182,9 +192,101 @@ export class FakeBrla { } } -/** Fake Alfredpay anchor; extend as Alfredpay corridors gain test coverage. */ +/** + * Fake Alfredpay anchor. Onramp quotes apply a flat, scriptable rate; orders + * and transaction polling run against in-memory state. The status served by + * getOnrampTransaction is scripted through `onrampStatus`; the on-chain mint + * effect belongs in the test via `onCreateOnramp` (mirroring FakeBrla's + * onPixOutputTicket). Extend as Alfredpay corridors gain test coverage. + */ export class FakeAlfredpay { - private readonly impl = {}; + /** toAmount = fromAmount * onrampRate for onramp quotes. */ + onrampRate = 1; + /** Fees attached to every quote; the fee engine sums them per currency. */ + quoteFees: AlfredpayFee[] = []; + /** Status reported for every order by getOnrampTransaction. */ + onrampStatus: AlfredpayOnrampStatus = AlfredpayOnrampStatus.TRADE_COMPLETED; + onrampStatusMetadata: AlfredpayOnrampStatusMetadata | null = null; + /** Called after createOnramp succeeds; use it to apply the on-chain mint effect. */ + onCreateOnramp?: (order: { transactionId: string; depositAddress: string }) => void; + readonly onrampOrders: CreateAlfredpayOnrampRequest[] = []; + readonly transactions = new Map(); + private counter = 0; + + private readonly fiatPaymentInstructions: AlfredpayFiatPaymentInstructions = { + clabe: "646180157000000004", + paymentType: "SPEI", + reference: "VORTEX-TEST" + }; + + private onrampQuote(request: CreateAlfredpayOnrampQuoteRequest): AlfredpayOnrampQuote { + const fromAmount = request.fromAmount ?? "0"; + return { + chain: request.chain, + expiration: new Date(Date.now() + 5 * 60_000).toISOString(), + fees: [...this.quoteFees], + fromAmount, + fromCurrency: request.fromCurrency, + metadata: {}, + paymentMethodType: request.paymentMethodType, + quoteId: `alfredpay-quote-${++this.counter}`, + rate: this.onrampRate.toString(), + toAmount: (Number(fromAmount) * this.onrampRate).toString(), + toCurrency: request.toCurrency + }; + } + + private readonly impl = { + createOnramp: async (request: CreateAlfredpayOnrampRequest): Promise => { + this.onrampOrders.push(request); + const transactionId = `alfredpay-onramp-${++this.counter}`; + const now = new Date().toISOString(); + const transaction: AlfredpayOnrampTransaction = { + chain: request.chain, + createdAt: now, + customerId: request.customerId, + depositAddress: request.depositAddress, + email: "test@example.com", + externalId: `external-${transactionId}`, + fromAmount: request.amount, + fromCurrency: request.fromCurrency, + memo: "", + metadata: null, + paymentMethodType: request.paymentMethodType, + quote: this.onrampQuote({ + fromAmount: request.amount, + fromCurrency: request.fromCurrency, + metadata: { businessId: "vortex", customerId: request.customerId }, + paymentMethodType: request.paymentMethodType, + toCurrency: request.toCurrency + }), + quoteId: request.quoteId, + status: AlfredpayOnrampStatus.CREATED, + toAmount: (Number(request.amount) * this.onrampRate).toString(), + toCurrency: request.toCurrency, + transactionId, + txHash: null, + updatedAt: now + }; + this.transactions.set(transactionId, transaction); + this.onCreateOnramp?.({ depositAddress: request.depositAddress, transactionId }); + return { fiatPaymentInstructions: { ...this.fiatPaymentInstructions }, transaction }; + }, + createOnrampQuote: async (request: CreateAlfredpayOnrampQuoteRequest): Promise => + this.onrampQuote(request), + getOnrampTransaction: async (transactionId: string): Promise => { + const transaction = this.transactions.get(transactionId); + if (!transaction) { + throw new Error(`FakeAlfredpay: unknown onramp transaction ${transactionId}`); + } + return { + ...transaction, + fiatPaymentInstructions: { ...this.fiatPaymentInstructions }, + metadata: this.onrampStatusMetadata, + status: this.onrampStatus + }; + } + }; asService(): AlfredpayApiService { return unimplementedProxy(this.impl, "FakeAlfredpay"); diff --git a/apps/api/src/tests/corridors/mxn-onramp.scenario.test.ts b/apps/api/src/tests/corridors/mxn-onramp.scenario.test.ts new file mode 100644 index 000000000..c9420cee7 --- /dev/null +++ b/apps/api/src/tests/corridors/mxn-onramp.scenario.test.ts @@ -0,0 +1,360 @@ +import { afterAll, beforeAll, beforeEach, describe, expect, it } from "bun:test"; +import { + ALFREDPAY_ERC20_DECIMALS, + ALFREDPAY_ERC20_TOKEN, + AlfredpayOnrampStatus, + EvmToken, + FiatToken, + Networks, + RampDirection, + type RampPhase +} from "@vortexfi/shared"; +import { decodeFunctionData, encodeFunctionData, erc20Abi, parseTransaction, parseUnits } from "viem"; +import { generatePrivateKey, privateKeyToAccount, type PrivateKeyAccount } from "viem/accounts"; +import phaseProcessor from "../../api/services/phases/phase-processor"; +import QuoteTicket from "../../models/quoteTicket.model"; +import RampState from "../../models/rampState.model"; +import { resetTestDatabase, setupTestDatabase } from "../../test-utils/db"; +import { createTestAlfredpayCustomer, createTestUser } from "../../test-utils/factories"; +import { type FakeWorld, installFakeWorld } from "../../test-utils/fake-world"; +import { installFakeSupabaseAuth, testUserToken } from "../../test-utils/fake-world/fake-auth"; +import { startTestApp, type TestApp } from "../../test-utils/test-app"; + +// squidRouterSwap appears in the history but skips internally on the direct +// (mint token == output token) corridor; the subsidy phases are no-ops here. +const HAPPY_PATH_PHASES: RampPhase[] = [ + "initial", + "alfredpayOnrampMint", + "fundEphemeral", + "subsidizePreSwap", + "squidRouterSwap", + "finalSettlementSubsidy", + "destinationTransfer", + "complete" +]; + +// 2000 MXN * 0.05 = 100 USDT: a legible flat rate for the fake anchor. +const ALFREDPAY_RATE = 0.05; + +interface CorridorSetup { + rampId: string; + quoteId: string; + /** Raw (6-decimal) USDT amount the presigned transfer pays out. */ + amountRaw: bigint; + /** Raw (6-decimal) USDT amount Alfredpay mints on the ephemeral. */ + mintAmountRaw: bigint; + signedTransfer: `0x${string}`; + ephemeral: PrivateKeyAccount; + destination: `0x${string}`; +} + +/** + * Corridor scenario tests for the MXN onramp direct path (spei → USDT on + * Polygon, the Alfredpay mint token): quote and registration go through the + * real HTTP API, /v1/ramp/update creates the Alfredpay order, then the REAL + * PhaseProcessor drives the ramp from initial to complete against the fake + * external world (see HAPPY_PATH_PHASES for the full sequence). + */ +describe("MXN onramp direct corridor (spei → USDT on Polygon)", () => { + let world: FakeWorld; + let auth: { restore: () => void }; + let app: TestApp; + + beforeAll(async () => { + world = installFakeWorld(); + auth = installFakeSupabaseAuth(); + await setupTestDatabase(); + app = await startTestApp(); + }); + + afterAll(async () => { + await app?.close(); + auth?.restore(); + world?.restore(); + }); + + beforeEach(async () => { + await resetTestDatabase(); + world.evm.failNextSends = 0; + world.evm.onTransaction = undefined; + world.alfredpay.onrampRate = ALFREDPAY_RATE; + world.alfredpay.onCreateOnramp = undefined; + world.alfredpay.onrampStatus = AlfredpayOnrampStatus.TRADE_COMPLETED; + world.alfredpay.onrampStatusMetadata = null; + }); + + async function createQuoteViaApi(): Promise<{ id: string; outputAmount: string }> { + const response = await app.request("/v1/quotes", { + body: JSON.stringify({ + from: "spei", + inputAmount: "2000", + inputCurrency: FiatToken.MXN, + network: Networks.Polygon, + outputCurrency: EvmToken.USDT, + rampType: RampDirection.BUY, + to: Networks.Polygon + }), + headers: { "Content-Type": "application/json" }, + method: "POST" + }); + expect(response.status).toBe(201); + return (await response.json()) as { id: string; outputAmount: string }; + } + + async function registerViaApi( + quoteId: string, + userId: string, + ephemeral: PrivateKeyAccount, + destination: `0x${string}` + ): Promise<{ id: string }> { + const response = await app.request("/v1/ramp/register", { + body: JSON.stringify({ + additionalData: { destinationAddress: destination }, + quoteId, + signingAccounts: [{ address: ephemeral.address, type: "EVM" }] + }), + headers: { + Authorization: `Bearer ${testUserToken(userId)}`, + "Content-Type": "application/json" + }, + method: "POST" + }); + expect(response.status).toBe(201); + return (await response.json()) as { id: string }; + } + + /** + * Submits a presigned tx through the real update endpoint. For Alfredpay + * corridors this also triggers the order creation (alfredpayTransactionId + * lands in state). + */ + async function updateRampViaApi( + rampId: string, + userId: string, + presignedTx: { meta?: object; network: Networks; nonce: number; phase: string; signer: string; txData: `0x${string}` } + ): Promise { + const response = await app.request("/v1/ramp/update", { + body: JSON.stringify({ presignedTxs: [{ meta: {}, ...presignedTx }], rampId }), + headers: { + Authorization: `Bearer ${testUserToken(userId)}`, + "Content-Type": "application/json" + }, + method: "POST" + }); + expect(response.status).toBe(200); + } + + /** + * Creates quote + registration + Alfredpay order through the HTTP API with a + * fresh ephemeral key pair, then stores a REAL signed ERC-20 USDT transfer as + * the presigned destinationTransfer. Pass a recipient to sign a transfer that + * pays someone other than the registered destination. + */ + async function setUpRegisteredRamp(options: { recipient?: `0x${string}` } = {}): Promise { + const ephemeral = privateKeyToAccount(generatePrivateKey()); + const destination = privateKeyToAccount(generatePrivateKey()).address as `0x${string}`; + + const user = await createTestUser(); + await createTestAlfredpayCustomer(user.id); + const quote = await createQuoteViaApi(); + const ramp = await registerViaApi(quote.id, user.id, ephemeral, destination); + + const persistedQuote = await QuoteTicket.findByPk(quote.id); + const mintAmountRaw = BigInt(persistedQuote?.metadata.alfredpayMint?.outputAmountRaw ?? "0"); + expect(mintAmountRaw).toBeGreaterThan(0n); + + const amountRaw = parseUnits(quote.outputAmount, ALFREDPAY_ERC20_DECIMALS); + async function signTransfer(recipient: `0x${string}`, nonce: number): Promise<`0x${string}`> { + return ephemeral.signTransaction({ + chainId: 137, + data: encodeFunctionData({ + abi: erc20Abi, + args: [recipient, amountRaw], + functionName: "transfer" + }), + gas: 100_000n, + // validatePresignedTxs enforces a 3 gwei floor on Polygon fees. + maxFeePerGas: 5_000_000_000n, + maxPriorityFeePerGas: 5_000_000_000n, + nonce, + to: ALFREDPAY_ERC20_TOKEN, + type: "eip1559" + }); + } + + // validatePresignedTxs requires 4 same-call backups at the following nonces. + async function signBackups(recipient: `0x${string}`): Promise> { + const backups: Record = {}; + for (let i = 1; i <= 4; i++) { + backups[`backup${i}`] = { nonce: i, txData: await signTransfer(recipient, i) }; + } + return backups; + } + + // The correct transfer goes through the real update endpoint (which also + // creates the Alfredpay order). + await updateRampViaApi(ramp.id, user.id, { + meta: { additionalTxs: await signBackups(destination) }, + network: Networks.Polygon, + nonce: 0, + phase: "destinationTransfer", + signer: ephemeral.address, + txData: await signTransfer(destination, 0) + }); + + const rampState = await RampState.findByPk(ramp.id); + if (!rampState) { + throw new Error("Ramp state not found after registration"); + } + expect(rampState.state.alfredpayTransactionId).toBeTruthy(); + + let signedTransfer = rampState.presignedTxs?.[0]?.txData as `0x${string}`; + if (options.recipient) { + // The wrong-recipient variant is swapped in at the DB layer: it models a + // presigned tx that slipped past the API, so the corridor asserts the + // PROCESSOR-level validation net catches it before funds move. + signedTransfer = await signTransfer(options.recipient, 0); + await rampState.update({ + presignedTxs: [ + { + meta: {}, + network: Networks.Polygon, + nonce: 0, + phase: "destinationTransfer", + signer: ephemeral.address, + txData: signedTransfer + } + ] + }); + } + + return { amountRaw, destination, ephemeral, mintAmountRaw, quoteId: quote.id, rampId: ramp.id, signedTransfer }; + } + + /** + * Scripts the fake world so every polling loop succeeds on its first check: + * - the Alfredpay mint has already credited the ephemeral's USDT, + * - the ephemeral already has Polygon gas, so fundEphemeral sends nothing, + * - submitted raw ERC-20 transfers are applied to the in-memory ledger. + */ + function scriptHappyWorld(setup: CorridorSetup): void { + world.evm.setNativeBalance(Networks.Polygon, setup.ephemeral.address, parseUnits("2", 18)); + world.evm.setErc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, setup.ephemeral.address, setup.mintAmountRaw); + world.evm.onTransaction = tx => { + if (!tx.serialized) { + return; + } + const parsed = parseTransaction(tx.serialized as `0x${string}`); + if (!parsed.to || !parsed.data) { + return; + } + const { functionName, args } = decodeFunctionData({ abi: erc20Abi, data: parsed.data }); + if (functionName !== "transfer") { + return; + } + const [recipient, amount] = args as [`0x${string}`, bigint]; + world.evm.setErc20Balance( + tx.network, + parsed.to, + recipient, + world.evm.erc20Balance(tx.network, parsed.to, recipient) + amount + ); + }; + } + + function submissionsOf(signedTransfer: `0x${string}`): number { + return world.evm.sentTransactions.filter(tx => tx.serialized === signedTransfer).length; + } + + it( + "happy path: processes the full Alfredpay onramp phase sequence to complete", + async () => { + const setup = await setUpRegisteredRamp(); + scriptHappyWorld(setup); + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("complete"); + expect(final?.phaseHistory.map(entry => entry.phase)).toEqual(HAPPY_PATH_PHASES); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + expect(final?.state.destinationTransferTxHash).toBeTruthy(); + + // Quote stays consumed; exactly one Alfredpay order was created and the + // destination received exactly the quoted USDT per the fake ledger. + const quote = await QuoteTicket.findByPk(setup.quoteId); + expect(quote?.status).toBe("consumed"); + expect(world.alfredpay.onrampOrders.length).toBe(1); + expect(submissionsOf(setup.signedTransfer)).toBe(1); + expect(world.evm.erc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, setup.destination)).toBe(setup.amountRaw); + }, + 30000 + ); + + it( + "transient failure: retries a failed destinationTransfer broadcast (recoverable) and still completes", + async () => { + const setup = await setUpRegisteredRamp(); + scriptHappyWorld(setup); + world.evm.failNextSends = 1; + world.evm.sendFailureMessage = "FakeEvm: scripted RPC outage"; + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("complete"); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + + const outageLogs = final?.errorLogs.filter(log => log.error.includes("scripted RPC outage")) ?? []; + expect(outageLogs.length).toBeGreaterThanOrEqual(1); + expect(outageLogs.every(log => log.phase === "destinationTransfer")).toBe(true); + expect(outageLogs.some(log => log.recoverable === true)).toBe(true); + + expect(submissionsOf(setup.signedTransfer)).toBe(1); + expect(world.evm.erc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, setup.destination)).toBe(setup.amountRaw); + }, + 30000 + ); + + it( + "security regression: presigned transfer paying the wrong recipient fails the ramp unrecoverably", + async () => { + const wrongRecipient = privateKeyToAccount(generatePrivateKey()).address as `0x${string}`; + const setup = await setUpRegisteredRamp({ recipient: wrongRecipient }); + scriptHappyWorld(setup); + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("failed"); + expect(final?.phaseHistory.map(entry => entry.phase)).not.toContain("complete"); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + expect(final?.errorLogs.some(log => log.error.includes("recipient mismatch"))).toBe(true); + + // The mismatching transfer must never reach the chain, and nobody gets paid. + expect(submissionsOf(setup.signedTransfer)).toBe(0); + expect(world.evm.erc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, wrongRecipient)).toBe(0n); + expect(world.evm.erc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, setup.destination)).toBe(0n); + }, + 30000 + ); + + it( + "unrecoverable failure: an Alfredpay FAILED order status fails the ramp during the mint phase", + async () => { + const setup = await setUpRegisteredRamp(); + // Gas is there, but the mint never arrives and Alfredpay reports FAILED. + world.evm.setNativeBalance(Networks.Polygon, setup.ephemeral.address, parseUnits("2", 18)); + world.alfredpay.onrampStatus = AlfredpayOnrampStatus.FAILED; + world.alfredpay.onrampStatusMetadata = { failureReason: "scripted compliance rejection" }; + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("failed"); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + expect(submissionsOf(setup.signedTransfer)).toBe(0); + }, + 30000 + ); +}); From cef194e011228e4ae72d8432aa19164c2a295dee Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 22:16:58 +0200 Subject: [PATCH 123/176] Run the SDK unit tests as part of test:sdk test:sdk was only a build-and-require smoke; the 36 unit tests in packages/sdk/test/ never ran in CI or the root aggregate. They now run first. --- packages/sdk/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 74fbe023d..1bc746271 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -46,7 +46,7 @@ "format": "prettier --write .", "lint": "eslint . --ext .ts", "prepublishOnly": "bun run build", - "test": "bun run build && node -e \"require('./dist/index.js')\"", + "test": "bun test && bun run build && node -e \"require('./dist/index.js')\"", "typecheck": "bun x --bun tsc" }, "type": "module", From 8e3f6fe2c6f28d9ecf22a74b567f5cf0db5be762 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 22:16:59 +0200 Subject: [PATCH 124/176] Make a bare root-level bun test fail fast instead of running stale dist tests bun test at the repo root invokes bun's own runner (not the package.json aggregate) and used to discover the compiled test copies under apps/api/dist/, producing hundreds of bogus failures. The root bunfig restricts discovery to a nonexistent directory so the command errors immediately with a pointer to bun run test. --- bunfig.toml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 bunfig.toml diff --git a/bunfig.toml b/bunfig.toml new file mode 100644 index 000000000..c653e0a2e --- /dev/null +++ b/bunfig.toml @@ -0,0 +1,7 @@ +[test] +# `bun test` from the repo root is NOT the test aggregate: it would discover every +# test file in the monorepo, including stale compiled copies under apps/api/dist/. +# Restrict discovery to a directory that doesn't exist at the root so a root-level +# `bun test` finds nothing instead of running garbage. Use `bun run test` (the +# package.json script) to run all workspace suites. +root = "src" From f455b494f765ad3c6fe46902fe6ea83bd8cde0d5 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 22:16:59 +0200 Subject: [PATCH 125/176] Gate the api suite on an aggregate coverage ratchet in CI CI's api step now runs bun run test:coverage, which produces an LCOV report and enforces aggregate line/function floors via scripts/check-coverage.ts (floors sit just under measured coverage; raise them as tested code grows, never lower them to make CI pass). bunfig's coverageThreshold is not used: on bun 1.3.1 it fails on any single uncovered file, which makes a total-level ratchet impossible. Test files and the bundled shared package are excluded from the report. --- .github/workflows/ci.yml | 4 +-- apps/api/bunfig.toml | 5 ++++ apps/api/package.json | 1 + apps/api/scripts/check-coverage.ts | 48 ++++++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 apps/api/scripts/check-coverage.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ccb40d6dd..74972ab68 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -84,8 +84,8 @@ jobs: - name: 🧪 Rebalancer tests run: bun run test:rebalancer - - name: 🧪 API tests (unit + integration) - run: bun run test:api + - name: 🧪 API tests (unit + integration, coverage-gated) + run: cd apps/api && bun run test:coverage - name: 🧪 Frontend tests run: bun run test:frontend diff --git a/apps/api/bunfig.toml b/apps/api/bunfig.toml index 40573a5ad..4e4d9f332 100644 --- a/apps/api/bunfig.toml +++ b/apps/api/bunfig.toml @@ -3,3 +3,8 @@ # copies of test files that would otherwise run (stale) a second time. root = "src" preload = ["./src/test-utils/preload.ts"] + +# Coverage report config; the gate itself lives in scripts/check-coverage.ts +coverageSkipTestFiles = true +coveragePathIgnorePatterns = ["**/packages/shared/dist/**", "**/test-utils/**"] + diff --git a/apps/api/package.json b/apps/api/package.json index b41f30d2d..e12f48a10 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -96,6 +96,7 @@ "serve": "bun dist/index.js", "start": "bun run build && bun run serve", "test": "bun test", + "test:coverage": "bun test --coverage --coverage-reporter=lcov && bun scripts/check-coverage.ts", "test:db:start": "./scripts/test-db.sh start", "test:db:stop": "./scripts/test-db.sh stop" }, diff --git a/apps/api/scripts/check-coverage.ts b/apps/api/scripts/check-coverage.ts new file mode 100644 index 000000000..f842cd368 --- /dev/null +++ b/apps/api/scripts/check-coverage.ts @@ -0,0 +1,48 @@ +/** + * Coverage gate for the api suite. Reads the LCOV report produced by + * `bun test --coverage --coverage-reporter=lcov` and fails when the aggregate + * line/function coverage drops below the floor. + * + * The floors are a ratchet: set just under the measured coverage at the time + * they were last raised. If you add meaningfully-tested code, raise them; + * never lower them to make CI pass. + * + * (bunfig's `coverageThreshold` is not used because bun 1.3.1 enforces it in a + * way that fails on any single uncovered file, which makes a total-level + * ratchet impossible.) + */ +const LINE_FLOOR = 0.43; +const FUNCTION_FLOOR = 0.49; + +const lcovPath = new URL("../coverage/lcov.info", import.meta.url).pathname; +const lcov = await Bun.file(lcovPath).text(); + +let linesFound = 0; +let linesHit = 0; +let functionsFound = 0; +let functionsHit = 0; + +for (const line of lcov.split("\n")) { + if (line.startsWith("LF:")) linesFound += Number(line.slice(3)); + else if (line.startsWith("LH:")) linesHit += Number(line.slice(3)); + else if (line.startsWith("FNF:")) functionsFound += Number(line.slice(4)); + else if (line.startsWith("FNH:")) functionsHit += Number(line.slice(4)); +} + +if (linesFound === 0 || functionsFound === 0) { + console.error(`check-coverage: ${lcovPath} contains no coverage data — did the coverage run succeed?`); + process.exit(1); +} + +const lineCoverage = linesHit / linesFound; +const functionCoverage = functionsHit / functionsFound; + +console.log( + `check-coverage: lines ${(lineCoverage * 100).toFixed(2)}% (floor ${LINE_FLOOR * 100}%), ` + + `functions ${(functionCoverage * 100).toFixed(2)}% (floor ${FUNCTION_FLOOR * 100}%)` +); + +if (lineCoverage < LINE_FLOOR || functionCoverage < FUNCTION_FLOOR) { + console.error("check-coverage: coverage fell below the ratchet floor. Add tests for the code you added."); + process.exit(1); +} From 4fb996d97b41f143f90cd866d87945de6bdc4929 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 22:17:00 +0200 Subject: [PATCH 126/176] Correct stale paths and claims in the testing strategy doc The SDK contract tests live in apps/api/src/tests, the fakes in test-utils/fake-world, and the factories in factories.ts; there is no injected clock (expiry tests write past timestamps instead). Documents the bun run test entrypoint, the new pricing goldens, the MXN corridor, and the api coverage ratchet. --- docs/testing-strategy.md | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/docs/testing-strategy.md b/docs/testing-strategy.md index ae81e678e..dbd3a509f 100644 --- a/docs/testing-strategy.md +++ b/docs/testing-strategy.md @@ -17,10 +17,10 @@ together with the shared test harness (`apps/api/src/test-utils`) — see "How t | Layer | What | Where | Runner | |---|---|---|---| -| 1. Unit | Pure logic: helpers, token configs, quote/fee golden tests, SDK handlers | each package, next to source | `bun test` (Vitest for frontend) | -| 2. API integration | Real Express + real Postgres + fake external world, driven over HTTP | `apps/api/src/tests/` | `bun test` | -| 3. Corridor scenarios | Phase processor end-to-end per corridor against the fake world | `apps/api/src/tests/corridors/` | `bun test` | -| 4. SDK contract | Real SDK against the real API in-process | `packages/sdk/test/contract/` | `bun test` | +| 1. Unit | Pure logic: helpers, token configs, SDK handlers | each package, next to source | `bun test` (Vitest for frontend) | +| 2. API integration | Real Express + real Postgres + fake external world, driven over HTTP; incl. the quote pricing goldens (`quote-pricing.golden.test.ts`) | `apps/api/src/tests/` | `bun test` | +| 3. Corridor scenarios | Phase processor end-to-end per corridor against the fake world (BRL pix→BRLA-on-Base, MXN spei→USDT-on-Polygon) | `apps/api/src/tests/corridors/` | `bun test` | +| 4. SDK contract | Real SDK against the real API in-process | `apps/api/src/tests/sdk-contract.test.ts` | `bun test` | | 5. Frontend | XState machine tests, component tests (RTL + MSW + mock wagmi) | `apps/frontend/src` | Vitest | | 6. E2E | Few critical Playwright journeys with a mock wallet | `apps/frontend/e2e/` | Playwright (non-blocking) | @@ -55,7 +55,8 @@ code already goes through: - **Chains**: faked at the `EvmClientManager` and Pendulum `apiManager` seams with an in-memory balance ledger. Phase handlers genuinely poll balances and observe transfers; tests script the ledger ("EURC arrives on the ephemeral after the 2nd poll"). -- **Clock**: quote expiry and timeout logic accept an injected clock in tests. +- **Clock**: there is no injected clock; expiry tests stay deterministic by writing + `expiresAt` timestamps in the past instead of faking timers. Decision: we deliberately do **not** run Anvil/fork-based EVM tests in CI. Fork mode depends on an upstream RPC (flaky public endpoints or a paid key as a CI secret). If calldata-level fidelity ever @@ -70,9 +71,9 @@ what we test. Unit tests may still mock models where the DB is incidental. ### Factories -`apps/api/src/test-utils/factories/` builds `Partner`, `ApiKey`, `QuoteTicket`, `RampState` -(per corridor/phase), and presigned-tx fixtures. Never hand-write these objects or copy JSON -snapshots into tests; extend the factory instead. +`apps/api/src/test-utils/factories.ts` builds `User`, `Partner`, `ApiKey`, `QuoteTicket`, +`RampState`, `TaxId` (Avenia KYC) and `AlfredPayCustomer` (Alfredpay KYC) rows. Never +hand-write these objects or copy JSON snapshots into tests; extend the factory instead. ### Playwright E2E (`apps/frontend/e2e/`) @@ -102,8 +103,10 @@ never PR-blocking. workspace. Postgres is provided as a GitHub Actions service container. - **Non-blocking / nightly**: Playwright E2E journeys and any live smoke tests. Failures alert; they don't block merges. -- No coverage-percentage gate for now. Coverage may be reported for visibility; ratchets can come - later once the suite is trusted. +- The api suite carries a coverage ratchet: CI runs `bun run test:coverage` (in `apps/api`), + which produces an LCOV report and enforces the aggregate line/function floors in + `apps/api/scripts/check-coverage.ts`. Raise the floors when you add tested code; never lower + them to make CI pass. The other workspaces have no gate yet. ## How to extend @@ -112,14 +115,15 @@ never PR-blocking. - **New corridor or phase** → add a scenario in `apps/api/src/tests/corridors/` using the factories and fake world. Cover: happy path, one transient failure + recovery, one unrecoverable failure → `failed`. -- **New external integration** → add a fake for it in `test-utils/fakes/` with the standard +- **New external integration** → add a fake for it in `test-utils/fake-world/` with the standard configurable behaviors (success / malformed / timeout / fail-then-succeed). -- **SDK-visible API change** → the SDK contract tests in `packages/sdk/test/contract/` must pass - unchanged, or the change is breaking and needs an SDK release note. +- **SDK-visible API change** → the SDK contract tests in `apps/api/src/tests/sdk-contract.test.ts` + must pass unchanged, or the change is breaking and needs an SDK release note. - **New frontend flow** → machine test first (transitions incl. rejection/error paths), component test if there's meaningful rendering logic, E2E only if it's a top-level critical journey. -- **Quote/fee logic change** → the golden quote tests will diff; update the snapshots consciously - and mention the fee impact in the PR description. +- **Quote/fee logic change** → the pricing goldens in + `apps/api/src/tests/quote-pricing.golden.test.ts` will diff; update the expected values + consciously and mention the fee impact in the PR description. ## Commands @@ -127,8 +131,10 @@ never PR-blocking. # One-time per machine: dedicated test Postgres (Docker, port 54329) bun test:db:start # bun test:db:stop to remove it -# Everything hermetic (what CI runs) -bun test # shared + sdk + rebalancer + api + frontend +# Everything hermetic (what CI runs). NOTE: `bun run test`, not `bun test` — +# a bare `bun test` at the root invokes bun's own runner (the root bunfig.toml +# makes it a no-op instead of letting it pick up stray files). +bun run test # shared + sdk + rebalancer + api + frontend # Individual workspaces bun test:api # unit + integration (needs the test db) From 9e40ddfab6d173a1da40660c4996bee1413d67e2 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 22:59:12 +0200 Subject: [PATCH 127/176] Fix expired-lock takeover in the phase processor and pin processor resilience invariants The stale-lock recovery path never worked: after force-releasing an expired database lock, acquireLock re-read the stale in-memory state.processingLock.locked and gave up, so a crashed process's lock wedged the ramp permanently despite the 15-minute expiry. processRamp now reloads the state after the release. New corridor tests pin the resilience behavior: recoverable-retry exhaustion stops without a terminal transition (per the documented F-004 gap), leaving the ramp resumable with the lock released and no funds moved; an expired stale lock is reclaimed and the ramp completes; a fresh foreign lock is neither processed past nor clobbered. Spec updated accordingly. --- .../api/services/phases/phase-processor.ts | 5 +- .../corridors/brl-onramp.scenario.test.ts | 77 +++++++++++++++++++ .../03-ramp-engine/state-machine.md | 2 +- 3 files changed, 82 insertions(+), 2 deletions(-) diff --git a/apps/api/src/api/services/phases/phase-processor.ts b/apps/api/src/api/services/phases/phase-processor.ts index e09717f08..72d111047 100644 --- a/apps/api/src/api/services/phases/phase-processor.ts +++ b/apps/api/src/api/services/phases/phase-processor.ts @@ -55,8 +55,11 @@ export class PhaseProcessor { if (!lockAcquired) { if (this.isLockExpired(state)) { logger.info(`Lock for ramp ${rampId} has expired. Ignoring previous lock and continue processing...`); - // Force release the expired lock and try to acquire it again + // Force release the expired lock and try to acquire it again. releaseLock + // only updates the database row, so refresh the instance first — otherwise + // acquireLock re-reads the stale in-memory lock and the takeover never succeeds. await this.releaseLock(state); + await state.reload(); lockAcquired = await this.acquireLock(state); if (!lockAcquired) { logger.warn(`Failed to acquire lock for ramp ${rampId} even after clearing expired lock`); diff --git a/apps/api/src/tests/corridors/brl-onramp.scenario.test.ts b/apps/api/src/tests/corridors/brl-onramp.scenario.test.ts index fafc72174..76eb75878 100644 --- a/apps/api/src/tests/corridors/brl-onramp.scenario.test.ts +++ b/apps/api/src/tests/corridors/brl-onramp.scenario.test.ts @@ -283,6 +283,83 @@ describe("BRL onramp direct corridor (pix → BRLA on Base)", () => { 30000 ); + it( + "retry exhaustion: a permanently failing broadcast stops processing without moving funds, and stays resumable", + async () => { + const setup = await setUpRegisteredRamp(); + scriptHappyWorld(setup); + world.evm.failNextSends = 100; + world.evm.sendFailureMessage = "FakeEvm: scripted permanent outage"; + + await phaseProcessor.processRamp(setup.rampId); + + // Per docs/security-spec/03-ramp-engine/state-machine.md (F-004): after the + // recoverable-retry budget is exhausted the processor stops WITHOUT a + // terminal transition — the ramp stays in its phase, the lock is released, + // and nothing was broadcast. + const stuck = await RampState.findByPk(setup.rampId); + expect(stuck?.currentPhase).toBe("destinationTransfer"); + expect(stuck?.processingLock).toEqual({ locked: false, lockedAt: null }); + const outageLogs = stuck?.errorLogs.filter(log => log.error.includes("scripted permanent outage")) ?? []; + // 1 initial attempt + MAX_RETRIES (8) retries. + expect(outageLogs.length).toBe(9); + expect(submissionsOf(setup.signedTransfer)).toBe(0); + expect(world.evm.erc20Balance(Networks.Base, BRLA_ON_BASE, setup.destination)).toBe(0n); + + // Once the outage clears, a fresh processing cycle completes the ramp. + world.evm.failNextSends = 0; + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("complete"); + expect(world.evm.erc20Balance(Networks.Base, BRLA_ON_BASE, setup.destination)).toBe(setup.amountRaw); + }, + 30000 + ); + + it( + "lock takeover: an expired stale lock (e.g. from a crashed process) is reclaimed and the ramp completes", + async () => { + const setup = await setUpRegisteredRamp(); + scriptHappyWorld(setup); + await RampState.update( + { processingLock: { locked: true, lockedAt: new Date(Date.now() - 16 * 60 * 1000) } }, + { where: { id: setup.rampId } } + ); + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("complete"); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + expect(world.evm.erc20Balance(Networks.Base, BRLA_ON_BASE, setup.destination)).toBe(setup.amountRaw); + }, + 30000 + ); + + it( + "lock respect: a fresh foreign lock is neither processed past nor clobbered", + async () => { + const setup = await setUpRegisteredRamp(); + scriptHappyWorld(setup); + const foreignLockedAt = new Date(); + await RampState.update( + { processingLock: { locked: true, lockedAt: foreignLockedAt } }, + { where: { id: setup.rampId } } + ); + const sentBefore = world.evm.sentTransactions.length; + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("initial"); + expect(final?.processingLock.locked).toBe(true); + expect(new Date(final?.processingLock.lockedAt as unknown as string).getTime()).toBe(foreignLockedAt.getTime()); + expect(world.evm.sentTransactions.length).toBe(sentBefore); + }, + 30000 + ); + it( "lock behavior: concurrent processRamp calls execute each phase exactly once", async () => { diff --git a/docs/security-spec/03-ramp-engine/state-machine.md b/docs/security-spec/03-ramp-engine/state-machine.md index 7268984f0..610392074 100644 --- a/docs/security-spec/03-ramp-engine/state-machine.md +++ b/docs/security-spec/03-ramp-engine/state-machine.md @@ -28,7 +28,7 @@ Lock expiry is set to 15 minutes. If a lock is older than 15 minutes, it's consi 2. **Only `currentPhase` and `phaseHistory` MUST be updated during phase transitions** — The processor uses `{ fields: ["currentPhase", "phaseHistory"] }` to prevent handlers from accidentally overwriting unrelated state columns. 3. **Terminal states (`complete`, `failed`) MUST halt processing** — Once a ramp reaches a terminal state, the processor MUST stop recursion and clean up retry counters. 4. **Lock acquisition MUST be atomic** — **KNOWN ISSUE**: The current implementation reads `state.processingLock.locked` from a potentially stale DB read, then sets it in a separate UPDATE. Between the read and write, another process could also acquire the lock. There is no `SELECT FOR UPDATE`, advisory lock, or atomic compare-and-swap. -5. **Lock expiry MUST prevent indefinite stalls** — If a process crashes while holding a lock, the 15-minute expiry ensures another process can eventually take over. The `isLockExpired()` check validates the timestamp. +5. **Lock expiry MUST prevent indefinite stalls** — If a process crashes while holding a lock, the 15-minute expiry ensures another process can eventually take over. The `isLockExpired()` check validates the timestamp. **FIXED (2026-07-05)**: the takeover previously never succeeded — after force-releasing the expired DB lock, `acquireLock` re-read the stale in-memory `state.processingLock.locked` and gave up. `processRamp` now reloads the state after the release. Regression-tested in `apps/api/src/tests/corridors/brl-onramp.scenario.test.ts` ("lock takeover"), alongside a companion test that a *fresh* foreign lock is neither processed past nor clobbered. 6. **Retries MUST be bounded** — Maximum 8 retries (`MAX_RETRIES`). After exhaustion, the processor stops retrying (but does not automatically transition to `failed` — this is a gap). 7. **Phase execution MUST be time-bounded** — The 10-minute timeout (`MAX_EXECUTION_TIME_MS`) prevents handlers from hanging indefinitely. Timeouts are treated as recoverable errors. 8. **The retry counter MUST be reset on successful phase advancement** — When the phase changes, `retriesMap.delete(state.id)` clears the counter, giving the next phase a fresh retry budget. From ba0ec73e289eb3a95d34d552664b68034886ef6f Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 22:59:30 +0200 Subject: [PATCH 128/176] Pin fee immutability with dedicated invariant tests Client-supplied fee fields are ignored on quote creation (a tampered request produces byte-identical fees to a clean one), registration additionalData cannot alter the persisted fee structure, and the status endpoint serves exactly the creation-time fees. Verified failure-capable by mutating the status fee mapping. --- .../tests/fee-immutability.invariants.test.ts | 152 ++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 apps/api/src/tests/fee-immutability.invariants.test.ts diff --git a/apps/api/src/tests/fee-immutability.invariants.test.ts b/apps/api/src/tests/fee-immutability.invariants.test.ts new file mode 100644 index 000000000..7e2f1456f --- /dev/null +++ b/apps/api/src/tests/fee-immutability.invariants.test.ts @@ -0,0 +1,152 @@ +import { afterAll, beforeAll, beforeEach, describe, expect, it } from "bun:test"; +import { EvmToken, FiatToken, Networks, RampDirection } from "@vortexfi/shared"; +import QuoteTicket from "../models/quoteTicket.model"; +import { resetTestDatabase, setupTestDatabase } from "../test-utils/db"; +import { createTestTaxId, createTestUser } from "../test-utils/factories"; +import { type FakeWorld, installFakeWorld } from "../test-utils/fake-world"; +import { installFakeSupabaseAuth, testUserToken } from "../test-utils/fake-world/fake-auth"; +import { startTestApp, type TestApp } from "../test-utils/test-app"; + +const FEE_FIELDS = [ + "anchorFeeFiat", + "anchorFeeUsd", + "feeCurrency", + "networkFeeFiat", + "networkFeeUsd", + "partnerFeeFiat", + "partnerFeeUsd", + "processingFeeFiat", + "processingFeeUsd", + "totalFeeFiat", + "totalFeeUsd", + "vortexFeeFiat", + "vortexFeeUsd" +] as const; + +/** + * Fee immutability invariants (docs/security-spec/03-ramp-engine/ + * fee-integrity.md): fees are fixed at quote creation and no client-supplied + * fee field is ever accepted — not on the quote request, not in registration + * additionalData — and the status endpoint serves exactly the creation-time + * fee structure. + */ +describe("fee immutability invariants (BRL onramp)", () => { + let world: FakeWorld; + let auth: { restore: () => void }; + let app: TestApp; + + const DESTINATION = "0x7ba99e99bc669b3508aff9cc0a898e869459f877"; + const EPHEMERAL = "0x30a300612ab372CC73e53ffE87fB73d62Ed68Da3"; + const TAX_ID = "12345678901"; + + beforeAll(async () => { + world = installFakeWorld(); + auth = installFakeSupabaseAuth(); + await setupTestDatabase(); + app = await startTestApp(); + }); + + afterAll(async () => { + await app?.close(); + auth?.restore(); + world?.restore(); + }); + + beforeEach(async () => { + await resetTestDatabase(); + }); + + function quoteBody(extra: Record = {}): string { + return JSON.stringify({ + from: "pix", + inputAmount: "100", + inputCurrency: FiatToken.BRL, + network: Networks.Base, + outputCurrency: EvmToken.BRLA, + rampType: RampDirection.BUY, + to: Networks.Base, + ...extra + }); + } + + async function createQuoteViaApi(extra: Record = {}): Promise> { + const response = await app.request("/v1/quotes", { + body: quoteBody(extra), + headers: { "Content-Type": "application/json" }, + method: "POST" + }); + expect(response.status).toBe(201); + return (await response.json()) as Record; + } + + async function registerViaApi( + quoteId: string, + userId: string, + additionalData: Record + ): Promise { + return app.request("/v1/ramp/register", { + body: JSON.stringify({ + additionalData: { destinationAddress: DESTINATION, taxId: TAX_ID, ...additionalData }, + quoteId, + signingAccounts: [{ address: EPHEMERAL, type: "EVM" }] + }), + headers: { + Authorization: `Bearer ${testUserToken(userId)}`, + "Content-Type": "application/json" + }, + method: "POST" + }); + } + + it("ignores client-supplied fee fields on quote creation", async () => { + const clean = await createQuoteViaApi(); + const tampered = await createQuoteViaApi({ + anchorFeeFiat: "0", + fee: { anchor: "0", displayFiat: { total: "0" }, total: "0", usd: { total: "0" } }, + metadata: { fees: { displayFiat: { total: "0" }, usd: { total: "0" } } }, + totalFeeFiat: "0", + totalFeeUsd: "0" + }); + + for (const field of FEE_FIELDS) { + expect(tampered[field], `quote field ${field} was influenced by the client`).toEqual(clean[field]); + } + }); + + it("serves creation-time fees on the status endpoint, unchanged by registration additionalData", async () => { + const user = await createTestUser(); + await createTestTaxId(user.id, { taxId: TAX_ID }); + + const quote = await createQuoteViaApi(); + const persistedAtCreation = await QuoteTicket.findByPk(quote.id as string); + const feesAtCreation = JSON.stringify(persistedAtCreation?.metadata.fees); + expect(persistedAtCreation?.metadata.fees).toBeDefined(); + + // Registration with fee fields smuggled into additionalData must succeed + // while leaving the persisted fee structure byte-identical. + const registerResponse = await registerViaApi(quote.id as string, user.id, { + anchorFeeFiat: "0", + fees: { displayFiat: { total: "0" }, usd: { total: "0" } }, + totalFeeFiat: "0" + }); + expect(registerResponse.status).toBe(201); + const ramp = (await registerResponse.json()) as { id: string }; + + const persistedAfterRegister = await QuoteTicket.findByPk(quote.id as string); + expect(JSON.stringify(persistedAfterRegister?.metadata.fees)).toBe(feesAtCreation); + + const statusResponse = await app.request(`/v1/ramp/${ramp.id}`, { + headers: { Authorization: `Bearer ${testUserToken(user.id)}` } + }); + expect(statusResponse.status).toBe(200); + const status = (await statusResponse.json()) as Record; + + for (const field of FEE_FIELDS) { + expect(status[field], `status fee field ${field} diverged from the quote`).toEqual(quote[field]); + } + + // The persisted structure is still exactly the creation-time one. + const persistedAfterStatus = await QuoteTicket.findByPk(quote.id as string); + expect(JSON.stringify(persistedAfterStatus?.metadata.fees)).toBe(feesAtCreation); + }); +}); From 8a240e06160eabf94d78a9ee51d9f0376a022fd7 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 22:59:31 +0200 Subject: [PATCH 129/176] Make the remaining hardcoded phase-handler sleeps env-overridable subsidize-post-swap's 15s settlement wait joins pre-swap under SUBSIDY_SETTLEMENT_DELAY_MS; the 20s retry backoffs in final-settlement-subsidy and moonbeam-to-pendulum become PHASE_SETTLEMENT_RETRY_BACKOFF_MS. Defaults are unchanged in production; the test preload sets both to 25ms. The sandbox-mode 10s sleep in the initial phase handler is intentionally untouched (never on a hermetic path). --- .../services/phases/handlers/final-settlement-subsidy.ts | 6 +++++- .../phases/handlers/moonbeam-to-pendulum-handler.ts | 8 ++++++-- .../phases/handlers/subsidize-post-swap-handler.ts | 6 +++++- apps/api/src/test-utils/preload.ts | 4 +++- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/apps/api/src/api/services/phases/handlers/final-settlement-subsidy.ts b/apps/api/src/api/services/phases/handlers/final-settlement-subsidy.ts index 82f0fbe26..719893b26 100644 --- a/apps/api/src/api/services/phases/handlers/final-settlement-subsidy.ts +++ b/apps/api/src/api/services/phases/handlers/final-settlement-subsidy.ts @@ -34,6 +34,10 @@ import { getEvmFundingAccount } from "../evm-funding"; import { computeSubsidyRaw } from "./final-settlement-subsidy.helpers"; const BALANCE_POLLING_TIME_MS = 5000; +// Backoff between failed subsidy-transfer attempts. Overridable so hermetic +// tests don't wait 20s per scripted failure (same pattern as +// PHASE_PROCESSOR_RETRY_DELAY_MS). +const SETTLEMENT_RETRY_BACKOFF_MS = parseInt(process.env.PHASE_SETTLEMENT_RETRY_BACKOFF_MS || "20000", 10); const EVM_BALANCE_CHECK_TIMEOUT_MS = 3 * 60 * 1000; // 3 minutes // Wait for >=90% of expected bridge delivery to absorb slippage while still waiting for actual bridge arrival. const MIN_BRIDGE_DELIVERY_RATIO = 0.9; @@ -361,7 +365,7 @@ export class FinalSettlementSubsidyHandler extends BasePhaseHandler { if (!receipt || receipt.status !== "success") { logger.error(`FinalSettlementSubsidyHandler: Transaction ${txHash} failed or was not found. Retrying...`); attempt++; - await new Promise(resolve => setTimeout(resolve, 20000)); + await new Promise(resolve => setTimeout(resolve, SETTLEMENT_RETRY_BACKOFF_MS)); } } diff --git a/apps/api/src/api/services/phases/handlers/moonbeam-to-pendulum-handler.ts b/apps/api/src/api/services/phases/handlers/moonbeam-to-pendulum-handler.ts index 9707e15ae..c752f76dd 100644 --- a/apps/api/src/api/services/phases/handlers/moonbeam-to-pendulum-handler.ts +++ b/apps/api/src/api/services/phases/handlers/moonbeam-to-pendulum-handler.ts @@ -21,6 +21,10 @@ import { RecoverablePhaseError } from "../../../errors/phase-error"; import { BasePhaseHandler } from "../base-phase-handler"; import { StateMetadata } from "../meta-state-types"; +// Backoff between failed transaction attempts. Overridable so hermetic tests +// don't wait 20s per scripted failure (same pattern as PHASE_PROCESSOR_RETRY_DELAY_MS). +const SETTLEMENT_RETRY_BACKOFF_MS = parseInt(process.env.PHASE_SETTLEMENT_RETRY_BACKOFF_MS || "20000", 10); + export class MoonbeamToPendulumPhaseHandler extends BasePhaseHandler { public getPhaseName(): RampPhase { return "moonbeamToPendulum"; @@ -121,8 +125,8 @@ export class MoonbeamToPendulumPhaseHandler extends BasePhaseHandler { if (!receipt || receipt.status !== "success") { logger.error(`MoonbeamToPendulumPhaseHandler: Transaction ${obtainedHash} failed or was not found`); attempt++; - // Wait for 20 seconds to allow the network to settle the squidRouter transaction - await new Promise(resolve => setTimeout(resolve, 20000)); + // Allow the network to settle the squidRouter transaction + await new Promise(resolve => setTimeout(resolve, SETTLEMENT_RETRY_BACKOFF_MS)); } } diff --git a/apps/api/src/api/services/phases/handlers/subsidize-post-swap-handler.ts b/apps/api/src/api/services/phases/handlers/subsidize-post-swap-handler.ts index 032e56e2e..12dbc538a 100644 --- a/apps/api/src/api/services/phases/handlers/subsidize-post-swap-handler.ts +++ b/apps/api/src/api/services/phases/handlers/subsidize-post-swap-handler.ts @@ -30,6 +30,10 @@ import { getEvmFundingAccount } from "../evm-funding"; import { calculatePostSwapSubsidyComponents } from "../helpers/post-swap-subsidy-breakdown"; import { StateMetadata } from "../meta-state-types"; +// Overridable so hermetic tests don't wait 15s for a settlement that the fake +// world applies instantly (same pattern as PHASE_PROCESSOR_RETRY_DELAY_MS). +const EVM_SETTLEMENT_DELAY_MS = parseInt(process.env.SUBSIDY_SETTLEMENT_DELAY_MS || "15000", 10); + export class SubsidizePostSwapPhaseHandler extends BasePhaseHandler { public getPhaseName(): RampPhase { return "subsidizePostSwap"; @@ -193,7 +197,7 @@ export class SubsidizePostSwapPhaseHandler extends BasePhaseHandler { } // Wait for token settlement before checking balance - await new Promise(resolve => setTimeout(resolve, 15000)); + await new Promise(resolve => setTimeout(resolve, EVM_SETTLEMENT_DELAY_MS)); // Check current balance on EVM const currentBalance = await checkEvmBalanceForToken({ diff --git a/apps/api/src/test-utils/preload.ts b/apps/api/src/test-utils/preload.ts index e51b127a3..480671402 100644 --- a/apps/api/src/test-utils/preload.ts +++ b/apps/api/src/test-utils/preload.ts @@ -54,8 +54,10 @@ if (!process.env.RUN_LIVE_TESTS) { // Fast retries so recoverable-error scenarios don't wait 30s per attempt. process.env.PHASE_PROCESSOR_RETRY_DELAY_MS = "25"; - // The fake EVM ledger settles instantly; skip the 15s settlement wait. + // The fake EVM ledger settles instantly; skip the 15s settlement waits and + // the 20s backoffs between scripted transaction failures. process.env.SUBSIDY_SETTLEMENT_DELAY_MS = "25"; + process.env.PHASE_SETTLEMENT_RETRY_BACKOFF_MS = "25"; // Close the shared Sequelize pool after the whole run so lingering pg // connections don't surface as unhandled "Connection terminated" errors. From e82cbc4e326082fbabfdc632b79d73c089da62f4 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 22:59:31 +0200 Subject: [PATCH 130/176] Add a hermetic MXN Alfredpay offramp corridor scenario Third processor-level corridor: USDT on Polygon -> spei via Alfredpay on the direct no-permit path. Registration creates the Alfredpay order and probes EIP-2612 support (scripted to fail as a contract error so the user broadcasts a plain transfer); the user-reported tx hash and the presigned deposit transfer (with the four required backups) go through /v1/ramp/update; the real PhaseProcessor drives initial -> squidRouterPermitExecute -> fundEphemeral -> finalSettlementSubsidy -> alfredpayOfframpTransfer -> complete. Covers the happy path, a tampered user-transfer hash (security regression: calldata mismatch fails the ramp before the ephemeral spends), and an Alfredpay FAILED order. FakeAlfredpay grows offramp quote/order/status methods; FakeEvm records transactions by hash and serves getTransaction plus receipts with from/to so the user-tx verifier can cross-check reported hashes, and gains a broadcastUserTransaction helper for user-wallet flows. --- .../src/test-utils/fake-world/fake-anchors.ts | 72 ++++ .../api/src/test-utils/fake-world/fake-evm.ts | 44 ++- .../corridors/mxn-offramp.scenario.test.ts | 351 ++++++++++++++++++ 3 files changed, 461 insertions(+), 6 deletions(-) create mode 100644 apps/api/src/tests/corridors/mxn-offramp.scenario.test.ts diff --git a/apps/api/src/test-utils/fake-world/fake-anchors.ts b/apps/api/src/test-utils/fake-world/fake-anchors.ts index 5d2f8741b..d0580923b 100644 --- a/apps/api/src/test-utils/fake-world/fake-anchors.ts +++ b/apps/api/src/test-utils/fake-world/fake-anchors.ts @@ -2,12 +2,19 @@ import { AlfredpayApiService, type AlfredpayFee, type AlfredpayFiatPaymentInstructions, + type AlfredpayOfframpQuote, + AlfredpayOfframpStatus, + type AlfredpayOfframpTransaction, type AlfredpayOnrampQuote, AlfredpayOnrampStatus, type AlfredpayOnrampStatusMetadata, type AlfredpayOnrampTransaction, + AlfredpayPaymentMethodType, AveniaTicketStatus, BrlaApiService, + type CreateAlfredpayOfframpQuoteRequest, + type CreateAlfredpayOfframpRequest, + type CreateAlfredpayOfframpResponse, type CreateAlfredpayOnrampQuoteRequest, type CreateAlfredpayOnrampRequest, type CreateAlfredpayOnrampResponse, @@ -211,6 +218,14 @@ export class FakeAlfredpay { onCreateOnramp?: (order: { transactionId: string; depositAddress: string }) => void; readonly onrampOrders: CreateAlfredpayOnrampRequest[] = []; readonly transactions = new Map(); + /** toAmount = fromAmount * offrampRate for offramp quotes. */ + offrampRate = 1; + /** Status reported for every order by getOfframpTransaction. */ + offrampStatus: AlfredpayOfframpStatus = AlfredpayOfframpStatus.FIAT_TRANSFER_COMPLETED; + /** Deposit address handed out for every offramp order. */ + offrampDepositAddress = "0x5afe00000000000000000000000000000000d0e5"; + readonly offrampOrders: CreateAlfredpayOfframpRequest[] = []; + readonly offrampTransactions = new Map(); private counter = 0; private readonly fiatPaymentInstructions: AlfredpayFiatPaymentInstructions = { @@ -236,7 +251,57 @@ export class FakeAlfredpay { }; } + private offrampQuote(request: CreateAlfredpayOfframpQuoteRequest): AlfredpayOfframpQuote { + const fromAmount = request.fromAmount ?? "0"; + return { + chain: request.chain, + expiration: new Date(Date.now() + 5 * 60_000).toISOString(), + fees: [...this.quoteFees], + fromAmount, + fromCurrency: request.fromCurrency, + metadata: {}, + paymentMethodType: request.paymentMethodType, + quoteId: `alfredpay-offramp-quote-${++this.counter}`, + rate: this.offrampRate.toString(), + toAmount: (Number(fromAmount) * this.offrampRate).toString(), + toCurrency: request.toCurrency + }; + } + private readonly impl = { + createOfframp: async (request: CreateAlfredpayOfframpRequest): Promise => { + this.offrampOrders.push(request); + const transactionId = `alfredpay-offramp-${++this.counter}`; + const now = new Date().toISOString(); + const transaction: AlfredpayOfframpTransaction = { + chain: request.chain, + createdAt: now, + customerId: request.customerId, + depositAddress: this.offrampDepositAddress, + expiration: new Date(Date.now() + 30 * 60_000).toISOString(), + fiatAccountId: request.fiatAccountId, + fromAmount: request.amount, + fromCurrency: request.fromCurrency, + memo: request.memo, + quote: this.offrampQuote({ + fromAmount: request.amount, + fromCurrency: request.fromCurrency, + metadata: { businessId: "vortex", customerId: request.customerId }, + paymentMethodType: AlfredpayPaymentMethodType.BANK, + toCurrency: request.toCurrency + }), + quoteId: request.quoteId, + status: AlfredpayOfframpStatus.ON_CHAIN_DEPOSIT_RECEIVED, + toAmount: (Number(request.amount) * this.offrampRate).toString(), + toCurrency: request.toCurrency, + transactionId, + updatedAt: now + }; + this.offrampTransactions.set(transactionId, transaction); + return transaction; + }, + createOfframpQuote: async (request: CreateAlfredpayOfframpQuoteRequest): Promise => + this.offrampQuote(request), createOnramp: async (request: CreateAlfredpayOnrampRequest): Promise => { this.onrampOrders.push(request); const transactionId = `alfredpay-onramp-${++this.counter}`; @@ -274,6 +339,13 @@ export class FakeAlfredpay { }, createOnrampQuote: async (request: CreateAlfredpayOnrampQuoteRequest): Promise => this.onrampQuote(request), + getOfframpTransaction: async (transactionId: string): Promise => { + const transaction = this.offrampTransactions.get(transactionId); + if (!transaction) { + throw new Error(`FakeAlfredpay: unknown offramp transaction ${transactionId}`); + } + return { ...transaction, status: this.offrampStatus }; + }, getOnrampTransaction: async (transactionId: string): Promise => { const transaction = this.transactions.get(transactionId); if (!transaction) { diff --git a/apps/api/src/test-utils/fake-world/fake-evm.ts b/apps/api/src/test-utils/fake-world/fake-evm.ts index 68dd5d27c..bdf47ff72 100644 --- a/apps/api/src/test-utils/fake-world/fake-evm.ts +++ b/apps/api/src/test-utils/fake-world/fake-evm.ts @@ -43,6 +43,7 @@ export class FakeEvm { private nonces = new Map(); private txCounter = 0; readonly sentTransactions: RecordedEvmTx[] = []; + private readonly transactionsByHash = new Map(); /** Called for every recorded transaction; use it to apply balance effects. */ onTransaction?: (tx: RecordedEvmTx) => void; @@ -75,6 +76,15 @@ export class FakeEvm { return this.balances.get(this.key(network, "native", holder)) ?? 0n; } + /** + * Records a transaction as if a user wallet had broadcast it (outside the + * EvmClientManager seam) and returns its hash — for corridors where the + * backend verifies an integrator-reported hash against a blueprint. + */ + broadcastUserTransaction(network: string, from: string, tx: { to: string; data?: string; value?: bigint }): `0x${string}` { + return this.recordTransaction({ data: tx.data, from, network, to: tx.to, value: tx.value }); + } + private nextHash(): `0x${string}` { this.txCounter += 1; return `0x${this.txCounter.toString(16).padStart(64, "0")}` as `0x${string}`; @@ -87,6 +97,7 @@ export class FakeEvm { } const recorded = { ...tx, hash: this.nextHash() }; this.sentTransactions.push(recorded); + this.transactionsByHash.set(recorded.hash, recorded); this.onTransaction?.(recorded); return recorded.hash; } @@ -129,12 +140,20 @@ export class FakeEvm { getClient(networkName: EvmNetworks): unknown { const network = networkName as string; - const receipt = (hash: `0x${string}`) => ({ - blockNumber: 1n, - logs: [], - status: "success" as const, - transactionHash: hash - }); + // Receipts for recorded transactions carry from/to so verification code + // (e.g. user-tx-verifier) can cross-check them; unknown hashes still + // confirm generically for recovery paths that probe stored hashes. + const receipt = (hash: `0x${string}`) => { + const recorded = this.transactionsByHash.get(hash); + return { + blockNumber: 1n, + from: recorded?.from, + logs: [], + status: "success" as const, + to: recorded?.to, + transactionHash: hash + }; + }; return this.makeUnimplementedProxy( { chain: { id: CHAIN_IDS[network] ?? 0, name: network, nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" } }, @@ -142,6 +161,19 @@ export class FakeEvm { estimateGas: async () => 21_000n, getBalance: async ({ address }: { address: string }) => this.nativeBalance(network, address), getGasPrice: async () => 1_000_000_000n, + getTransaction: async ({ hash }: { hash: `0x${string}` }) => { + const recorded = this.transactionsByHash.get(hash); + if (!recorded) { + throw new Error(`FakeEvm: getTransaction called with unknown hash ${hash}`); + } + return { + from: recorded.from, + hash, + input: recorded.data ?? "0x", + to: recorded.to, + value: recorded.value ?? 0n + }; + }, getTransactionCount: async ({ address }: { address: string }) => this.nonces.get(`${network}:${address}`) ?? 0, getTransactionReceipt: async ({ hash }: { hash: `0x${string}` }) => receipt(hash), readContract: async (params: ReadContractParams) => this.readContract(network, params), diff --git a/apps/api/src/tests/corridors/mxn-offramp.scenario.test.ts b/apps/api/src/tests/corridors/mxn-offramp.scenario.test.ts new file mode 100644 index 000000000..4ec8ce0e0 --- /dev/null +++ b/apps/api/src/tests/corridors/mxn-offramp.scenario.test.ts @@ -0,0 +1,351 @@ +import { afterAll, beforeAll, beforeEach, describe, expect, it } from "bun:test"; +import { + ALFREDPAY_ERC20_TOKEN, + AlfredpayOfframpStatus, + EvmToken, + FiatToken, + Networks, + RampDirection, + type RampPhase, + type UnsignedTx +} from "@vortexfi/shared"; +import { BaseError, ContractFunctionExecutionError, decodeFunctionData, erc20Abi, parseTransaction } from "viem"; +import { generatePrivateKey, privateKeyToAccount, type PrivateKeyAccount } from "viem/accounts"; +import { parseUnits } from "viem/utils"; +import phaseProcessor from "../../api/services/phases/phase-processor"; +import QuoteTicket from "../../models/quoteTicket.model"; +import RampState from "../../models/rampState.model"; +import { resetTestDatabase, setupTestDatabase } from "../../test-utils/db"; +import { createTestAlfredpayCustomer, createTestUser } from "../../test-utils/factories"; +import { type FakeWorld, installFakeWorld } from "../../test-utils/fake-world"; +import { installFakeSupabaseAuth, testUserToken } from "../../test-utils/fake-world/fake-auth"; +import { startTestApp, type TestApp } from "../../test-utils/test-app"; + +// finalSettlementSubsidy is a no-op here (the user transfer delivers the full +// amount) but appears in the history. +const HAPPY_PATH_PHASES: RampPhase[] = [ + "initial", + "squidRouterPermitExecute", + "fundEphemeral", + "finalSettlementSubsidy", + "alfredpayOfframpTransfer", + "complete" +]; + +// 100 USDT * 20 = 2000 MXN: a legible flat rate for the fake anchor. +const ALFREDPAY_OFFRAMP_RATE = 20; +const FIAT_ACCOUNT_ID = "test-fiat-account-1"; + +interface EvmTxBlueprint { + to: `0x${string}`; + data: `0x${string}`; + value?: string; +} + +interface CorridorSetup { + rampId: string; + quoteId: string; + /** Raw (6-decimal) USDT amount the offramp moves. */ + inputAmountRaw: bigint; + signedOfframpTransfer: `0x${string}`; + ephemeral: PrivateKeyAccount; + userWallet: PrivateKeyAccount; + userTransferBlueprint: EvmTxBlueprint; +} + +/** + * Corridor scenario tests for the MXN offramp direct no-permit path (USDT on + * Polygon → spei via Alfredpay): quote and registration go through the real + * HTTP API (registration creates the Alfredpay order and probes EIP-2612 + * support — scripted away so the user broadcasts a plain transfer), the user's + * reported tx hash and the presigned deposit transfer go through + * /v1/ramp/update, then the REAL PhaseProcessor drives the ramp to complete + * against the fake external world. + */ +describe("MXN offramp direct corridor (USDT on Polygon → spei, no-permit)", () => { + let world: FakeWorld; + let auth: { restore: () => void }; + let app: TestApp; + + beforeAll(async () => { + world = installFakeWorld(); + auth = installFakeSupabaseAuth(); + await setupTestDatabase(); + app = await startTestApp(); + }); + + afterAll(async () => { + await app?.close(); + auth?.restore(); + world?.restore(); + }); + + beforeEach(async () => { + await resetTestDatabase(); + world.evm.failNextSends = 0; + world.evm.onTransaction = undefined; + world.alfredpay.offrampRate = ALFREDPAY_OFFRAMP_RATE; + world.alfredpay.offrampStatus = AlfredpayOfframpStatus.FIAT_TRANSFER_COMPLETED; + // Fresh deposit address per test: the in-memory EVM ledger persists across + // tests, so a shared address would accumulate balances between scenarios. + world.alfredpay.offrampDepositAddress = privateKeyToAccount(generatePrivateKey()).address.toLowerCase(); + // Polygon USDT has no EIP-2612 support in this scenario: the nonces() probe + // fails as a contract-call error, steering registration onto the no-permit + // path where the user broadcasts a plain transfer from their own wallet. + world.evm.onReadContract = (_network, params) => { + if (params.functionName === "nonces") { + throw new ContractFunctionExecutionError(new BaseError("nonces() reverted"), { + abi: erc20Abi, + contractAddress: params.address, + functionName: "nonces" + }); + } + return undefined; + }; + }); + + async function createQuoteViaApi(): Promise<{ id: string; inputAmount: string; outputAmount: string }> { + const response = await app.request("/v1/quotes", { + body: JSON.stringify({ + from: Networks.Polygon, + inputAmount: "100", + inputCurrency: EvmToken.USDT, + network: Networks.Polygon, + outputCurrency: FiatToken.MXN, + rampType: RampDirection.SELL, + to: "spei" + }), + headers: { "Content-Type": "application/json" }, + method: "POST" + }); + expect(response.status).toBe(201); + return (await response.json()) as { id: string; inputAmount: string; outputAmount: string }; + } + + async function registerViaApi( + quoteId: string, + userId: string, + ephemeral: PrivateKeyAccount, + userWallet: PrivateKeyAccount + ): Promise<{ id: string; unsignedTxs: UnsignedTx[] }> { + const response = await app.request("/v1/ramp/register", { + body: JSON.stringify({ + additionalData: { fiatAccountId: FIAT_ACCOUNT_ID, walletAddress: userWallet.address }, + quoteId, + signingAccounts: [{ address: ephemeral.address, type: "EVM" }] + }), + headers: { + Authorization: `Bearer ${testUserToken(userId)}`, + "Content-Type": "application/json" + }, + method: "POST" + }); + expect(response.status).toBe(201); + return (await response.json()) as { id: string; unsignedTxs: UnsignedTx[] }; + } + + function blueprintOf(unsignedTxs: UnsignedTx[], phase: RampPhase): EvmTxBlueprint { + const blueprint = unsignedTxs.find(tx => tx.phase === phase); + expect(blueprint, `missing ${phase} blueprint in register response`).toBeDefined(); + return blueprint?.txData as unknown as EvmTxBlueprint; + } + + async function setUpRegisteredRamp(): Promise { + const ephemeral = privateKeyToAccount(generatePrivateKey()); + const userWallet = privateKeyToAccount(generatePrivateKey()); + + const user = await createTestUser(); + await createTestAlfredpayCustomer(user.id); + const quote = await createQuoteViaApi(); + const ramp = await registerViaApi(quote.id, user.id, ephemeral, userWallet); + + const persistedQuote = await QuoteTicket.findByPk(quote.id); + const inputAmountRaw = BigInt(persistedQuote?.metadata.alfredpayOfframp?.inputAmountRaw ?? "0"); + expect(inputAmountRaw).toBeGreaterThan(0n); + + // The register RESPONSE withholds user-wallet txs until the ephemeral + // presigns pass (filterUnsignedTxsForResponse), so blueprints are read + // from the persisted state like the processor does. + const registered = await RampState.findByPk(ramp.id); + const allUnsignedTxs = registered?.unsignedTxs ?? []; + const userTransferBlueprint = blueprintOf(allUnsignedTxs, "squidRouterNoPermitTransfer"); + const offrampTransferBlueprint = blueprintOf(allUnsignedTxs, "alfredpayOfframpTransfer"); + + // Sign exactly the blueprint the backend issued for the ephemeral's + // deposit transfer (plus the four required same-call backups). + async function signBlueprint(nonce: number): Promise<`0x${string}`> { + return ephemeral.signTransaction({ + chainId: 137, + data: offrampTransferBlueprint.data, + gas: 100_000n, + // validatePresignedTxs enforces a 3 gwei floor on Polygon fees. + maxFeePerGas: 5_000_000_000n, + maxPriorityFeePerGas: 5_000_000_000n, + nonce, + to: offrampTransferBlueprint.to, + type: "eip1559" + }); + } + const signedOfframpTransfer = await signBlueprint(0); + const backups: Record = {}; + for (let i = 1; i <= 4; i++) { + backups[`backup${i}`] = { nonce: i, txData: await signBlueprint(i) }; + } + + // The user "broadcasts" the source-of-funds transfer from their own wallet + // and the frontend reports the hash through the update endpoint together + // with the presigned deposit transfer. + const userTxHash = world.evm.broadcastUserTransaction(Networks.Polygon, userWallet.address, { + data: userTransferBlueprint.data, + to: userTransferBlueprint.to, + value: 0n + }); + + const updateResponse = await app.request("/v1/ramp/update", { + body: JSON.stringify({ + additionalData: { squidRouterNoPermitTransferHash: userTxHash }, + presignedTxs: [ + { + meta: { additionalTxs: backups }, + network: Networks.Polygon, + nonce: 0, + phase: "alfredpayOfframpTransfer", + signer: ephemeral.address, + txData: signedOfframpTransfer + } + ], + rampId: ramp.id + }), + headers: { + Authorization: `Bearer ${testUserToken(user.id)}`, + "Content-Type": "application/json" + }, + method: "POST" + }); + expect(updateResponse.status).toBe(200); + + const rampState = await RampState.findByPk(ramp.id); + expect(rampState?.state.alfredpayTransactionId).toBeTruthy(); + expect(rampState?.state.isDirectTransfer).toBe(true); + expect(rampState?.state.isNoPermitFallback).toBe(true); + + return { + ephemeral, + inputAmountRaw, + quoteId: quote.id, + rampId: ramp.id, + signedOfframpTransfer, + userTransferBlueprint, + userWallet + }; + } + + /** + * Scripts the fake world for the happy path: the user's transfer already + * credited the ephemeral's USDT, the ephemeral has Polygon gas, and raw + * ERC-20 transfers are applied to the in-memory ledger. + */ + function scriptHappyWorld(setup: CorridorSetup): void { + world.evm.setNativeBalance(Networks.Polygon, setup.ephemeral.address, parseUnits("2", 18)); + world.evm.setErc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, setup.ephemeral.address, setup.inputAmountRaw); + world.evm.onTransaction = tx => { + if (!tx.serialized) { + return; + } + const parsed = parseTransaction(tx.serialized as `0x${string}`); + if (!parsed.to || !parsed.data) { + return; + } + const { functionName, args } = decodeFunctionData({ abi: erc20Abi, data: parsed.data }); + if (functionName !== "transfer") { + return; + } + const [recipient, amount] = args as [`0x${string}`, bigint]; + world.evm.setErc20Balance( + tx.network, + parsed.to, + recipient, + world.evm.erc20Balance(tx.network, parsed.to, recipient) + amount + ); + }; + } + + function submissionsOf(signedTransfer: `0x${string}`): number { + return world.evm.sentTransactions.filter(tx => tx.serialized === signedTransfer).length; + } + + it( + "happy path: processes the full Alfredpay offramp phase sequence to complete", + async () => { + const setup = await setUpRegisteredRamp(); + scriptHappyWorld(setup); + const depositAddress = world.alfredpay.offrampDepositAddress; + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("complete"); + expect(final?.phaseHistory.map(entry => entry.phase)).toEqual(HAPPY_PATH_PHASES); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + expect(final?.state.alfredpayOfframpTransferTxHash).toBeTruthy(); + + // Quote stays consumed; exactly one Alfredpay order exists and the + // deposit address received exactly the quoted USDT per the fake ledger. + const quote = await QuoteTicket.findByPk(setup.quoteId); + expect(quote?.status).toBe("consumed"); + expect(world.alfredpay.offrampOrders.length).toBe(1); + expect(submissionsOf(setup.signedOfframpTransfer)).toBe(1); + expect(world.evm.erc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, depositAddress)).toBe(setup.inputAmountRaw); + }, + 30000 + ); + + it( + "security regression: a reported user tx whose calldata does not match the blueprint fails the ramp unrecoverably", + async () => { + const setup = await setUpRegisteredRamp(); + scriptHappyWorld(setup); + + // Overwrite the reported hash with a tampered user transfer that pays a + // different recipient than the blueprint demanded. + const attacker = privateKeyToAccount(generatePrivateKey()).address; + const { encodeFunctionData } = await import("viem"); + const tamperedHash = world.evm.broadcastUserTransaction(Networks.Polygon, setup.userWallet.address, { + data: encodeFunctionData({ abi: erc20Abi, args: [attacker, setup.inputAmountRaw], functionName: "transfer" }), + to: ALFREDPAY_ERC20_TOKEN, + value: 0n + }); + const rampState = await RampState.findByPk(setup.rampId); + await rampState?.update({ + state: { ...rampState.state, squidRouterNoPermitTransferHash: tamperedHash } + }); + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("failed"); + expect(final?.phaseHistory.map(entry => entry.phase)).not.toContain("complete"); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + // The ephemeral's deposit transfer must never have been broadcast. + expect(submissionsOf(setup.signedOfframpTransfer)).toBe(0); + expect(world.evm.erc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, world.alfredpay.offrampDepositAddress)).toBe(0n); + }, + 30000 + ); + + it( + "unrecoverable failure: an Alfredpay FAILED order status fails the ramp during the transfer phase", + async () => { + const setup = await setUpRegisteredRamp(); + scriptHappyWorld(setup); + world.alfredpay.offrampStatus = AlfredpayOfframpStatus.FAILED; + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("failed"); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + }, + 30000 + ); +}); From 555537d3a1a7768f52dda423b5a135e51bb77285 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 22:59:51 +0200 Subject: [PATCH 131/176] Document the EUR re-enablement precondition at the kill-switch Lifting the EUR kill-switch is gated on a hermetic EUR corridor scenario existing first; the Mykobo corridors are currently covered by RUN_LIVE_TESTS-gated sandbox tests only. --- apps/api/src/api/services/ramp/ramp.service.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/api/src/api/services/ramp/ramp.service.ts b/apps/api/src/api/services/ramp/ramp.service.ts index 672cd9c77..1401323a9 100644 --- a/apps/api/src/api/services/ramp/ramp.service.ts +++ b/apps/api/src/api/services/ramp/ramp.service.ts @@ -220,6 +220,9 @@ export class RampService extends BaseRampService { }); } + // Before removing this kill-switch, add a hermetic EUR corridor scenario in + // apps/api/src/tests/corridors/ (the Mykobo corridors are currently covered by + // RUN_LIVE_TESTS-gated tests only — see docs/testing-strategy.md). if (quote.inputCurrency === FiatToken.EURC || quote.outputCurrency === FiatToken.EURC) { throw new APIError({ message: "EUR ramps are currently disabled", From 369347ae1b6a7abfab7cc0d22e50a00699063a58 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 22:59:51 +0200 Subject: [PATCH 132/176] Notify Slack when the nightly e2e run fails Non-blocking runs are only useful if somebody hears about failures. Posts to the same webhook token the backend's Slack notifier uses (repo secret SLACK_WEB_HOOK_TOKEN) and skips silently when the secret is not configured. --- .github/workflows/e2e.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index b18f7133d..54be8861d 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -44,3 +44,19 @@ jobs: name: playwright-report path: apps/frontend/playwright-report/ retention-days: 7 + + # Non-blocking runs are only useful if somebody hears about failures. + # Uses the same webhook token the backend's Slack notifier uses + # (repo secret SLACK_WEB_HOOK_TOKEN); skips silently when unset. + - name: 📣 Notify Slack on failure + if: failure() + env: + SLACK_WEB_HOOK_TOKEN: ${{ secrets.SLACK_WEB_HOOK_TOKEN }} + run: | + if [ -z "$SLACK_WEB_HOOK_TOKEN" ]; then + echo "SLACK_WEB_HOOK_TOKEN secret not configured; skipping notification." + exit 0 + fi + curl -sf -X POST -H 'Content-Type: application/json' \ + -d "{\"text\":\"Nightly Playwright e2e run failed: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}" \ + "https://hooks.slack.com/services/${SLACK_WEB_HOOK_TOKEN}" From 16f0db8511727269bbb0d21209d7101ef4f64f66 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 22:59:52 +0200 Subject: [PATCH 133/176] Extend the coverage ratchet to every workspace suite The LCOV summing gate generalizes to scripts/check-coverage.ts with per- package floors passed from each package.json (api floors move there; the api-local copy is deleted). shared and rebalancer gain test:coverage scripts; the frontend gates through vitest's built-in v8 coverage thresholds (new @vitest/coverage-v8 dev dependency). CI runs the gated variant for all four suites, and coverage output directories are ignored repo-wide. --- .github/workflows/ci.yml | 12 ++--- .gitignore | 3 ++ apps/api/package.json | 2 +- apps/frontend/package.json | 2 + apps/frontend/vitest.config.ts | 10 ++++ apps/rebalancer/package.json | 3 +- bun.lock | 51 +++++++++++++++++++ packages/shared/package.json | 4 +- .../api/scripts => scripts}/check-coverage.ts | 29 +++++++---- 9 files changed, 96 insertions(+), 20 deletions(-) rename {apps/api/scripts => scripts}/check-coverage.ts (58%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74972ab68..b4fbc50c2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,17 +75,17 @@ jobs: - name: 🔨 Build shared package run: bun run build:shared - - name: 🧪 Shared tests - run: bun run test:shared + - name: 🧪 Shared tests (coverage-gated) + run: cd packages/shared && bun run test:coverage - name: 🧪 SDK tests run: bun run test:sdk - - name: 🧪 Rebalancer tests - run: bun run test:rebalancer + - name: 🧪 Rebalancer tests (coverage-gated) + run: cd apps/rebalancer && bun run test:coverage - name: 🧪 API tests (unit + integration, coverage-gated) run: cd apps/api && bun run test:coverage - - name: 🧪 Frontend tests - run: bun run test:frontend + - name: 🧪 Frontend tests (coverage-gated) + run: cd apps/frontend && bun run test:coverage diff --git a/.gitignore b/.gitignore index 680c6051b..f4485677c 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,9 @@ dist dist-ssr *.local +# Coverage reports (any workspace; bun/vitest lcov output) +coverage + # Environment files (any package, any name) packages/sdk/.env **/.env.local diff --git a/apps/api/package.json b/apps/api/package.json index e12f48a10..d389321ea 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -96,7 +96,7 @@ "serve": "bun dist/index.js", "start": "bun run build && bun run serve", "test": "bun test", - "test:coverage": "bun test --coverage --coverage-reporter=lcov && bun scripts/check-coverage.ts", + "test:coverage": "bun test --coverage --coverage-reporter=lcov && bun ../../scripts/check-coverage.ts coverage/lcov.info 0.43 0.49", "test:db:start": "./scripts/test-db.sh start", "test:db:stop": "./scripts/test-db.sh stop" }, diff --git a/apps/frontend/package.json b/apps/frontend/package.json index 44bd4a851..699998297 100644 --- a/apps/frontend/package.json +++ b/apps/frontend/package.json @@ -99,6 +99,7 @@ "@types/react-dom": "^19.0.3", "@typescript-eslint/eslint-plugin": "^5.53.0", "@typescript-eslint/parser": "^5.53.0", + "@vitest/coverage-v8": "3.2.4", "babel-preset-vite": "^1.1.3", "daisyui": "^5.5.5", "esbuild": "^0.25.9", @@ -133,6 +134,7 @@ "preview": "bun x --bun vite preview", "storybook": "storybook dev -p 6006", "test": "vitest", + "test:coverage": "vitest run --coverage", "test:e2e": "playwright test", "verify": "bun test" }, diff --git a/apps/frontend/vitest.config.ts b/apps/frontend/vitest.config.ts index 77d878021..267bb94b0 100644 --- a/apps/frontend/vitest.config.ts +++ b/apps/frontend/vitest.config.ts @@ -4,6 +4,16 @@ import { defineConfig } from "vitest/config"; // (tanstack router codegen, Sentry upload plugin, tailwind) from vite.config.ts. export default defineConfig({ test: { + coverage: { + provider: "v8", + // Ratchet floors, set just under the coverage measured when they were + // last raised (enforced by `bun run test:coverage`, which CI runs). + // Raise them as tested code grows; never lower them to make CI pass. + thresholds: { + functions: 41, + lines: 19 + } + }, environment: "node", globals: false, include: ["src/**/*.test.ts", "src/**/*.test.tsx"], diff --git a/apps/rebalancer/package.json b/apps/rebalancer/package.json index 64b3f1389..44d38fbc0 100644 --- a/apps/rebalancer/package.json +++ b/apps/rebalancer/package.json @@ -35,7 +35,8 @@ "prepare": "husky", "serve": "bun dist/index.js", "start": "bun run build && bun run serve", - "test": "bun test" + "test": "bun test", + "test:coverage": "bun test --coverage --coverage-reporter=lcov && bun ../../scripts/check-coverage.ts coverage/lcov.info 0.31 0.15" }, "type": "module" } diff --git a/bun.lock b/bun.lock index 3f8230f67..3ea0c9aab 100644 --- a/bun.lock +++ b/bun.lock @@ -201,6 +201,7 @@ "@types/react-dom": "^19.0.3", "@typescript-eslint/eslint-plugin": "^5.53.0", "@typescript-eslint/parser": "^5.53.0", + "@vitest/coverage-v8": "3.2.4", "babel-preset-vite": "^1.1.3", "daisyui": "^5.5.5", "esbuild": "^0.25.9", @@ -401,6 +402,8 @@ "@adraffy/ens-normalize": ["@adraffy/ens-normalize@1.10.1", "", {}, "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw=="], + "@ampproject/remapping": ["@ampproject/remapping@2.3.0", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw=="], + "@ardatan/relay-compiler": ["@ardatan/relay-compiler@13.0.1", "", { "dependencies": { "@babel/runtime": "^7.29.2", "immutable": "^5.1.5", "invariant": "^2.2.4" }, "peerDependencies": { "graphql": "*" } }, "sha512-afG3YPwuSA0E5foouZusz5GlXKs74dObv4cuWyLyfKsYFj2r7oGRNB28v18HvwuLSQtQFCi+DpIe0TZkgQDYyg=="], "@asamuzakjp/css-color": ["@asamuzakjp/css-color@3.2.0", "", { "dependencies": { "@csstools/css-calc": "^2.1.3", "@csstools/css-color-parser": "^3.0.9", "@csstools/css-parser-algorithms": "^3.0.4", "@csstools/css-tokenizer": "^3.0.3", "lru-cache": "^10.4.3" } }, "sha512-K1A6z8tS3XsmCMM86xoWdn7Fkdn9m6RSVtocUrJYIwZnFVkng/PvkEoWtOWmP+Scc6saYWHWZYbndEEXxl24jw=="], @@ -651,6 +654,8 @@ "@base-org/account": ["@base-org/account@2.4.0", "", { "dependencies": { "@coinbase/cdp-sdk": "^1.0.0", "@noble/hashes": "1.4.0", "clsx": "1.2.1", "eventemitter3": "5.0.1", "idb-keyval": "6.2.1", "ox": "0.6.9", "preact": "10.24.2", "viem": "^2.31.7", "zustand": "5.0.3" } }, "sha512-A4Umpi8B9/pqR78D1Yoze4xHyQaujioVRqqO3d6xuDFw9VRtjg6tK3bPlwE0aW+nVH/ntllCpPa2PbI8Rnjcug=="], + "@bcoe/v8-coverage": ["@bcoe/v8-coverage@1.0.2", "", {}, "sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA=="], + "@biomejs/biome": ["@biomejs/biome@2.0.0", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "2.0.0", "@biomejs/cli-darwin-x64": "2.0.0", "@biomejs/cli-linux-arm64": "2.0.0", "@biomejs/cli-linux-arm64-musl": "2.0.0", "@biomejs/cli-linux-x64": "2.0.0", "@biomejs/cli-linux-x64-musl": "2.0.0", "@biomejs/cli-win32-arm64": "2.0.0", "@biomejs/cli-win32-x64": "2.0.0" }, "bin": { "biome": "bin/biome" } }, "sha512-BlUoXEOI/UQTDEj/pVfnkMo8SrZw3oOWBDrXYFT43V7HTkIUDkBRY53IC5Jx1QkZbaB+0ai1wJIfYwp9+qaJTQ=="], "@biomejs/cli-darwin-arm64": ["@biomejs/cli-darwin-arm64@2.0.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-QvqWYtFFhhxdf8jMAdJzXW+Frc7X8XsnHQLY+TBM1fnT1TfeV/v9vsFI5L2J7GH6qN1+QEEJ19jHibCY2Ypplw=="], @@ -969,6 +974,8 @@ "@isaacs/fs-minipass": ["@isaacs/fs-minipass@4.0.1", "", { "dependencies": { "minipass": "^7.0.4" } }, "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w=="], + "@istanbuljs/schema": ["@istanbuljs/schema@0.1.6", "", {}, "sha512-+Sg6GCR/wy1oSmQDFq4LQDAhm3ETKnorxN+y5nbLULOR3P0c14f2Wurzj3/xqPXtasLFfHd5iRFQ7AJt4KH2cw=="], + "@joshwooding/vite-plugin-react-docgen-typescript": ["@joshwooding/vite-plugin-react-docgen-typescript@0.6.1", "", { "dependencies": { "glob": "^10.0.0", "magic-string": "^0.30.0", "react-docgen-typescript": "^2.2.2" }, "peerDependencies": { "typescript": ">= 4.3.x", "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" }, "optionalPeers": ["typescript"] }, "sha512-J4BaTocTOYFkMHIra1JDWrMWpNmBl4EkplIwHEsV8aeUOtdWjwSnln9U7twjMFTAEB7mptNtSKyVi1Y2W9sDJw=="], "@jridgewell/gen-mapping": ["@jridgewell/gen-mapping@0.3.13", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA=="], @@ -2081,6 +2088,8 @@ "@vitejs/plugin-react": ["@vitejs/plugin-react@4.7.0", "", { "dependencies": { "@babel/core": "^7.28.0", "@babel/plugin-transform-react-jsx-self": "^7.27.1", "@babel/plugin-transform-react-jsx-source": "^7.27.1", "@rolldown/pluginutils": "1.0.0-beta.27", "@types/babel__core": "^7.20.5", "react-refresh": "^0.17.0" }, "peerDependencies": { "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" } }, "sha512-gUu9hwfWvvEDBBmgtAowQCojwZmJ5mcLn3aufeCsitijs3+f2NsrPtlAWIR6OPiqljl96GVCUbLe0HyqIpVaoA=="], + "@vitest/coverage-v8": ["@vitest/coverage-v8@3.2.4", "", { "dependencies": { "@ampproject/remapping": "^2.3.0", "@bcoe/v8-coverage": "^1.0.2", "ast-v8-to-istanbul": "^0.3.3", "debug": "^4.4.1", "istanbul-lib-coverage": "^3.2.2", "istanbul-lib-report": "^3.0.1", "istanbul-lib-source-maps": "^5.0.6", "istanbul-reports": "^3.1.7", "magic-string": "^0.30.17", "magicast": "^0.3.5", "std-env": "^3.9.0", "test-exclude": "^7.0.1", "tinyrainbow": "^2.0.0" }, "peerDependencies": { "@vitest/browser": "3.2.4", "vitest": "3.2.4" }, "optionalPeers": ["@vitest/browser"] }, "sha512-EyF9SXU6kS5Ku/U82E259WSnvg6c8KTjppUncuNdm5QHpe17mwREHnjDzozC8x9MZ0xfBUFSaLkRv4TMA75ALQ=="], + "@vitest/expect": ["@vitest/expect@3.2.4", "", { "dependencies": { "@types/chai": "^5.2.2", "@vitest/spy": "3.2.4", "@vitest/utils": "3.2.4", "chai": "^5.2.0", "tinyrainbow": "^2.0.0" } }, "sha512-Io0yyORnB6sikFlt8QW5K7slY4OjqNX9jmJQ02QDda8lyM6B5oNgVWoSoKPac8/kgnCUzuHQKrSLtu/uOqqrig=="], "@vitest/mocker": ["@vitest/mocker@3.2.4", "", { "dependencies": { "@vitest/spy": "3.2.4", "estree-walker": "^3.0.3", "magic-string": "^0.30.17" }, "peerDependencies": { "msw": "^2.4.9", "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0" }, "optionalPeers": ["msw", "vite"] }, "sha512-46ryTE9RZO/rfDd7pEqFl7etuyzekzEhUbTW3BvmeO/BcCMEgq59BKhek3dXDWgAj4oMK6OZi+vRr1wPW6qjEQ=="], @@ -2281,6 +2290,8 @@ "ast-types": ["ast-types@0.16.1", "", { "dependencies": { "tslib": "^2.0.1" } }, "sha512-6t10qk83GOG8p0vKmaCr8eiilZwO171AvbROMtvvNiwrTly62t+7XkA8RdIIVbpMhCASAsxgAzdRSwh6nw/5Dg=="], + "ast-v8-to-istanbul": ["ast-v8-to-istanbul@0.3.12", "", { "dependencies": { "@jridgewell/trace-mapping": "^0.3.31", "estree-walker": "^3.0.3", "js-tokens": "^10.0.0" } }, "sha512-BRRC8VRZY2R4Z4lFIL35MwNXmwVqBityvOIwETtsCSwvjl0IdgFsy9NhdaA6j74nUdtJJlIypeRhpDam19Wq3g=="], + "astral-regex": ["astral-regex@2.0.0", "", {}, "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ=="], "async": ["async@3.2.6", "", {}, "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA=="], @@ -3109,6 +3120,8 @@ "html-encoding-sniffer": ["html-encoding-sniffer@4.0.0", "", { "dependencies": { "whatwg-encoding": "^3.1.1" } }, "sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ=="], + "html-escaper": ["html-escaper@2.0.2", "", {}, "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg=="], + "html-parse-stringify": ["html-parse-stringify@3.0.1", "", { "dependencies": { "void-elements": "3.1.0" } }, "sha512-KknJ50kTInJ7qIScF3jeaFRpMpE8/lfiTdzf/twXyPBLAGrLRTmkz3AdTnKeh40X8k9L2fdYwEp/42WGXIRGcg=="], "http-basic": ["http-basic@8.1.3", "", { "dependencies": { "caseless": "^0.12.0", "concat-stream": "^1.6.2", "http-response-object": "^3.0.1", "parse-cache-control": "^1.0.1" } }, "sha512-/EcDMwJZh3mABI2NhGfHOGOeOZITqfkEO4p/xK+l3NpyncIHUQBoMvCSF/b5GqvKtySC2srL/GGG3+EtlqlmCw=="], @@ -3299,6 +3312,14 @@ "isows": ["isows@1.0.7", "", { "peerDependencies": { "ws": "*" } }, "sha512-I1fSfDCZL5P0v33sVqeTDSpcstAg/N+wF5HS033mogOVIp4B+oHC7oOCsA3axAbBSGTJ8QubbNmnIRN/h8U7hg=="], + "istanbul-lib-coverage": ["istanbul-lib-coverage@3.2.2", "", {}, "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg=="], + + "istanbul-lib-report": ["istanbul-lib-report@3.0.1", "", { "dependencies": { "istanbul-lib-coverage": "^3.0.0", "make-dir": "^4.0.0", "supports-color": "^7.1.0" } }, "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw=="], + + "istanbul-lib-source-maps": ["istanbul-lib-source-maps@5.0.6", "", { "dependencies": { "@jridgewell/trace-mapping": "^0.3.23", "debug": "^4.1.1", "istanbul-lib-coverage": "^3.0.0" } }, "sha512-yg2d+Em4KizZC5niWhQaIomgf5WlL4vOOjZ5xGCmF8SnPE/mDWWXgvRExdcpCgh9lLRRa1/fSYp2ymmbJ1pI+A=="], + + "istanbul-reports": ["istanbul-reports@3.2.0", "", { "dependencies": { "html-escaper": "^2.0.0", "istanbul-lib-report": "^3.0.0" } }, "sha512-HGYWWS/ehqTV3xN10i23tkPkpH46MLCIMFNCaaKNavAXTF1RkqxawEPtnjnGZ6XKSInBKkiOA5BKS+aZiY3AvA=="], + "iterator.prototype": ["iterator.prototype@1.1.5", "", { "dependencies": { "define-data-property": "^1.1.4", "es-object-atoms": "^1.0.0", "get-intrinsic": "^1.2.6", "get-proto": "^1.0.0", "has-symbols": "^1.1.0", "set-function-name": "^2.0.2" } }, "sha512-H0dkQoCa3b2VEeKQBOxFph+JAbcrQdE7KC0UkqwpLmv2EC4P41QXP+rqo9wYodACiG5/WM5s9oDApTU8utwj9g=="], "jackspeak": ["jackspeak@3.4.3", "", { "dependencies": { "@isaacs/cliui": "^8.0.2" }, "optionalDependencies": { "@pkgjs/parseargs": "^0.11.0" } }, "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw=="], @@ -3467,6 +3488,8 @@ "magic-string": ["magic-string@0.30.21", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="], + "magicast": ["magicast@0.3.5", "", { "dependencies": { "@babel/parser": "^7.25.4", "@babel/types": "^7.25.4", "source-map-js": "^1.2.0" } }, "sha512-L0WhttDl+2BOsybvEOLK7fW3UA0OQ0IQ2d6Zl2x/a6vVRs3bAY0ECOSHHeL5jD+SbOpOCUEi0y1DgHEn9Qn1AQ=="], + "make-dir": ["make-dir@3.1.0", "", { "dependencies": { "semver": "^6.0.0" } }, "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw=="], "make-error": ["make-error@1.3.6", "", {}, "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw=="], @@ -4261,6 +4284,8 @@ "teex": ["teex@1.0.1", "", { "dependencies": { "streamx": "^2.12.5" } }, "sha512-eYE6iEI62Ni1H8oIa7KlDU6uQBtqr4Eajni3wX7rpfXD8ysFx8z0+dri+KWEPWpBsxXfxu58x/0jvTVT1ekOSg=="], + "test-exclude": ["test-exclude@7.0.2", "", { "dependencies": { "@istanbuljs/schema": "^0.1.2", "glob": "^10.4.1", "minimatch": "^10.2.2" } }, "sha512-u9E6A+ZDYdp7a4WnarkXPZOx8Ilz46+kby6p1yZ8zsGTz9gYa6FIS7lj2oezzNKmtdyyJNNmmXDppga5GB7kSw=="], + "text-decoder": ["text-decoder@1.2.7", "", { "dependencies": { "b4a": "^1.6.4" } }, "sha512-vlLytXkeP4xvEq2otHeJfSQIRyWxo/oZGEbXrtEEF9Hnmrdly59sUbzZ/QgyWuLYHctCHxFF4tRQZNQ9k60ExQ=="], "text-hex": ["text-hex@1.0.0", "", {}, "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg=="], @@ -4635,6 +4660,8 @@ "zustand": ["zustand@5.0.13", "", { "peerDependencies": { "@types/react": ">=18.0.0", "immer": ">=9.0.6", "react": ">=18.0.0", "use-sync-external-store": ">=1.2.0" }, "optionalPeers": ["@types/react", "immer", "react", "use-sync-external-store"] }, "sha512-efI2tVaVQPqtOh114loML/Z80Y4NP3yc+Ff0fYiZJPauNeWZeIp/bRFD7I9bfmCOYBh/PHxlglQ9+wvlwnPikQ=="], + "@ampproject/remapping/@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.31", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="], + "@ardatan/relay-compiler/immutable": ["immutable@5.1.5", "", {}, "sha512-t7xcm2siw+hlUM68I+UEOK+z84RzmN59as9DZ7P1l0994DKUWV7UXBMQZVxaoMSRQ+PBZbHCOoBt7a2wxOMt+A=="], "@asamuzakjp/css-color/lru-cache": ["lru-cache@10.4.3", "", {}, "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="], @@ -5035,6 +5062,12 @@ "asn1.js/bn.js": ["bn.js@4.12.3", "", {}, "sha512-fGTi3gxV/23FTYdAoUtLYp6qySe2KE3teyZitipKNRuVYcBkoP/bB3guXN/XVKUe9mxCHXnc9C4ocyz8OmgN0g=="], + "ast-v8-to-istanbul/@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.31", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="], + + "ast-v8-to-istanbul/estree-walker": ["estree-walker@3.0.3", "", { "dependencies": { "@types/estree": "^1.0.0" } }, "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g=="], + + "ast-v8-to-istanbul/js-tokens": ["js-tokens@10.0.0", "", {}, "sha512-lM/UBzQmfJRo9ABXbPWemivdCW8V2G8FHaHdypQaIy523snUjog0W71ayWXTjiR+ixeMyVHN2XcpnTd/liPg/Q=="], + "axios/https-proxy-agent": ["https-proxy-agent@5.0.1", "", { "dependencies": { "agent-base": "6", "debug": "4" } }, "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA=="], "axios-retry/is-retry-allowed": ["is-retry-allowed@2.2.0", "", {}, "sha512-XVm7LOeLpTW4jV19QSH38vkswxoLud8sQ57YwJVTPWdiaI9I8keEhGFpBlslyVsgdQy4Opg8QOLb8YRgsyZiQg=="], @@ -5207,6 +5240,12 @@ "inquirer/wrap-ansi": ["wrap-ansi@6.2.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA=="], + "istanbul-lib-report/make-dir": ["make-dir@4.0.0", "", { "dependencies": { "semver": "^7.5.3" } }, "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw=="], + + "istanbul-lib-report/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="], + + "istanbul-lib-source-maps/@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.31", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="], + "js-beautify/glob": ["glob@10.5.0", "", { "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", "minimatch": "^9.0.4", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^1.11.1" }, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg=="], "js-beautify/nopt": ["nopt@7.2.1", "", { "dependencies": { "abbrev": "^2.0.0" }, "bin": { "nopt": "bin/nopt.js" } }, "sha512-taM24ViiimT/XntxbPyJQzCG+p4EKOpgD3mxFwW38mGjVUrfERQOeY4EDHjdnptttfHuHQXFx+lTP08Q+mLa/w=="], @@ -5411,6 +5450,10 @@ "table-layout/typical": ["typical@5.2.0", "", {}, "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg=="], + "test-exclude/glob": ["glob@10.5.0", "", { "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", "minimatch": "^9.0.4", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^1.11.1" }, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg=="], + + "test-exclude/minimatch": ["minimatch@10.2.5", "", { "dependencies": { "brace-expansion": "^5.0.5" } }, "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg=="], + "then-request/@types/node": ["@types/node@8.10.66", "", {}, "sha512-tktOkFUA4kXx2hhhrB8bIFb5TbwzS4uOhKEmwiD+NoiL0qtP2OQ9mFldbgD4dV1djrlBYP6eBuQZiWjuHUpqFw=="], "then-request/concat-stream": ["concat-stream@1.6.2", "", { "dependencies": { "buffer-from": "^1.0.0", "inherits": "^2.0.3", "readable-stream": "^2.2.2", "typedarray": "^0.0.6" } }, "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw=="], @@ -5791,6 +5834,8 @@ "http-basic/concat-stream/readable-stream": ["readable-stream@2.3.8", "", { "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", "isarray": "~1.0.0", "process-nextick-args": "~2.0.0", "safe-buffer": "~5.1.1", "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" } }, "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA=="], + "istanbul-lib-report/make-dir/semver": ["semver@7.8.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg=="], + "js-beautify/nopt/abbrev": ["abbrev@2.0.0", "", {}, "sha512-6/mh1E2u2YgEsCHdY0Yx5oW+61gZU+1vXaoiHHrpKeuRNNgFvS+/jrwHiQhB5apAf5oB7UB7E19ol2R2LKH8hQ=="], "log-update/cli-cursor/restore-cursor": ["restore-cursor@5.1.0", "", { "dependencies": { "onetime": "^7.0.0", "signal-exit": "^4.1.0" } }, "sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA=="], @@ -5885,6 +5930,10 @@ "solidity-coverage/web3-utils/ethereum-cryptography": ["ethereum-cryptography@2.2.1", "", { "dependencies": { "@noble/curves": "1.4.2", "@noble/hashes": "1.4.0", "@scure/bip32": "1.4.0", "@scure/bip39": "1.3.0" } }, "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg=="], + "test-exclude/glob/minimatch": ["minimatch@9.0.9", "", { "dependencies": { "brace-expansion": "^2.0.2" } }, "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg=="], + + "test-exclude/minimatch/brace-expansion": ["brace-expansion@5.0.6", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g=="], + "then-request/concat-stream/readable-stream": ["readable-stream@2.3.8", "", { "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", "isarray": "~1.0.0", "process-nextick-args": "~2.0.0", "safe-buffer": "~5.1.1", "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" } }, "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA=="], "then-request/form-data/mime-types": ["mime-types@2.1.35", "", { "dependencies": { "mime-db": "1.52.0" } }, "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw=="], @@ -6169,6 +6218,8 @@ "solidity-coverage/web3-utils/ethereum-cryptography/@scure/bip39": ["@scure/bip39@1.3.0", "", { "dependencies": { "@noble/hashes": "~1.4.0", "@scure/base": "~1.1.6" } }, "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ=="], + "test-exclude/minimatch/brace-expansion/balanced-match": ["balanced-match@4.0.4", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="], + "then-request/concat-stream/readable-stream/isarray": ["isarray@1.0.0", "", {}, "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="], "then-request/concat-stream/readable-stream/safe-buffer": ["safe-buffer@5.1.2", "", {}, "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="], diff --git a/packages/shared/package.json b/packages/shared/package.json index a2fe414a1..a46c7e82e 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -58,7 +58,9 @@ "build": "rm -rf ./dist && bun build ./src/index.ts --outdir ./dist/node --target=node && bun build ./src/index.ts --outdir ./dist/browser --target=browser && tsc -p tsconfig.json --emitDeclarationOnly --outDir dist", "dev": "bun build ./src/index.ts --outdir ./dist/node --target=node & bun build ./src/index.ts --outdir ./dist/browser --target=browser", "format": "prettier . --write", - "prepublishOnly": "bun run build" + "prepublishOnly": "bun run build", + "test": "bun test", + "test:coverage": "bun test --coverage --coverage-reporter=lcov && bun ../../scripts/check-coverage.ts coverage/lcov.info 0.49 0.27" }, "types": "./dist/index.d.ts", "version": "0.2.0" diff --git a/apps/api/scripts/check-coverage.ts b/scripts/check-coverage.ts similarity index 58% rename from apps/api/scripts/check-coverage.ts rename to scripts/check-coverage.ts index f842cd368..41c936d4d 100644 --- a/apps/api/scripts/check-coverage.ts +++ b/scripts/check-coverage.ts @@ -1,20 +1,27 @@ /** - * Coverage gate for the api suite. Reads the LCOV report produced by + * Coverage gate for the bun workspaces. Reads an LCOV report produced by * `bun test --coverage --coverage-reporter=lcov` and fails when the aggregate - * line/function coverage drops below the floor. + * line/function coverage drops below the given floors. * - * The floors are a ratchet: set just under the measured coverage at the time - * they were last raised. If you add meaningfully-tested code, raise them; - * never lower them to make CI pass. + * bun scripts/check-coverage.ts + * + * The floors are a ratchet: each workspace's package.json passes values set + * just under the coverage measured when they were last raised. If you add + * meaningfully-tested code, raise them; never lower them to make CI pass. * * (bunfig's `coverageThreshold` is not used because bun 1.3.1 enforces it in a * way that fails on any single uncovered file, which makes a total-level * ratchet impossible.) */ -const LINE_FLOOR = 0.43; -const FUNCTION_FLOOR = 0.49; +const [lcovPath, lineFloorArg, functionFloorArg] = process.argv.slice(2); +const lineFloor = Number(lineFloorArg); +const functionFloor = Number(functionFloorArg); + +if (!lcovPath || Number.isNaN(lineFloor) || Number.isNaN(functionFloor)) { + console.error("usage: bun scripts/check-coverage.ts "); + process.exit(1); +} -const lcovPath = new URL("../coverage/lcov.info", import.meta.url).pathname; const lcov = await Bun.file(lcovPath).text(); let linesFound = 0; @@ -38,11 +45,11 @@ const lineCoverage = linesHit / linesFound; const functionCoverage = functionsHit / functionsFound; console.log( - `check-coverage: lines ${(lineCoverage * 100).toFixed(2)}% (floor ${LINE_FLOOR * 100}%), ` + - `functions ${(functionCoverage * 100).toFixed(2)}% (floor ${FUNCTION_FLOOR * 100}%)` + `check-coverage: lines ${(lineCoverage * 100).toFixed(2)}% (floor ${lineFloor * 100}%), ` + + `functions ${(functionCoverage * 100).toFixed(2)}% (floor ${functionFloor * 100}%)` ); -if (lineCoverage < LINE_FLOOR || functionCoverage < FUNCTION_FLOOR) { +if (lineCoverage < lineFloor || functionCoverage < functionFloor) { console.error("check-coverage: coverage fell below the ratchet floor. Add tests for the code you added."); process.exit(1); } From d2e0e8462deada59a49005f1e7b780e0163b181c Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 22:59:52 +0200 Subject: [PATCH 134/176] Update the testing strategy doc for the new corridor, gates, and processor semantics Documents the MXN offramp corridor, the workspace-wide coverage ratchet, the EUR re-enablement precondition, and corrects the phase-processor invariant: recoverable-retry exhaustion stops without a terminal transition (open finding F-004), rather than transitioning to failed. --- docs/testing-strategy.md | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/docs/testing-strategy.md b/docs/testing-strategy.md index dbd3a509f..083e38fe2 100644 --- a/docs/testing-strategy.md +++ b/docs/testing-strategy.md @@ -34,8 +34,12 @@ Derived from `docs/security-spec/` — these must never regress, and each has de - Subsidy caps are enforced (pre-swap, post-swap, `MAX_FINAL_SETTLEMENT_SUBSIDY_USD`) — a breach throws instead of paying out (finding F-001). - Ownership guards: a partner only sees its own quotes/ramps; a user only their own (F-068 class). -- Phase processor: max-retry exhaustion transitions to `failed` (F-004), locks are released on - terminal states, only `currentPhase`/`phaseHistory` are updated by the processor. +- Phase processor: retries are bounded (`MAX_RETRIES`); after exhaustion of a recoverable error + the processor stops without a terminal transition, releasing the lock and leaving the ramp + resumable (the missing `failed` transition is documented as open finding F-004 in + `docs/security-spec/03-ramp-engine/state-machine.md`). Unrecoverable errors transition to + `failed`. Locks are released on terminal states; only `currentPhase`/`phaseHistory` are + updated by the processor. - Presigned transaction and ephemeral address validation (F-021, F-038 class). - External swap/route outputs are validated against expectations before funds move (F-030). @@ -91,6 +95,15 @@ gate on offramps) run against the real frontend in Chromium, hermetically: They run nightly via `.github/workflows/e2e.yml` (never PR-blocking) and locally with `bun test:e2e`. +### EUR re-enablement precondition + +EUR ramps are kill-switched at registration (`ramp.service.ts`). The Mykobo (EUR) corridors +currently have **no hermetic coverage** — only `RUN_LIVE_TESTS`-gated sandbox tests. Lifting +the kill-switch is gated on adding a hermetic EUR corridor scenario in +`apps/api/src/tests/corridors/` first (the FakeMykobo anchor in `test-utils/fake-world/` +already covers intents/fees; the scenario harness is the same one the BRL and MXN corridors +use). + ### Live tests Tests that hit real RPCs or sandboxes (e.g. XCM dry-runs in `packages/shared`) are gated behind @@ -103,10 +116,12 @@ never PR-blocking. workspace. Postgres is provided as a GitHub Actions service container. - **Non-blocking / nightly**: Playwright E2E journeys and any live smoke tests. Failures alert; they don't block merges. -- The api suite carries a coverage ratchet: CI runs `bun run test:coverage` (in `apps/api`), - which produces an LCOV report and enforces the aggregate line/function floors in - `apps/api/scripts/check-coverage.ts`. Raise the floors when you add tested code; never lower - them to make CI pass. The other workspaces have no gate yet. +- Every workspace suite carries a coverage ratchet, enforced by `bun run test:coverage` in CI: + the bun workspaces (shared, rebalancer, api) produce an LCOV report checked against per-package + floors by `scripts/check-coverage.ts` (floors live in each `package.json` script); the frontend + uses vitest's built-in thresholds (`apps/frontend/vitest.config.ts`). Floors sit just under the + coverage measured when they were last raised — raise them when you add tested code; never lower + them to make CI pass. ## How to extend From e7cdbcf7d015a5c939893e962b639ef46ebe484f Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Sun, 5 Jul 2026 23:13:51 +0200 Subject: [PATCH 135/176] Report zero network fee on direct fiat-to-own-stablecoin corridors On BRL->BRLA and EUR->EURC on Base, OnRampAveniaToEvmFeeEngine priced a USDC->output-token Squid bridge as the network fee. That leg does not exist on the direct corridors: the anchor mints the requested token, the squidrouter engines pass it through (isFiatToOwnStablecoinBaseDirect), the execution route transfers it straight to the destination, and nothing ever charged or distributed the quoted amount. The engine now short-circuits to a zero network fee using the same predicate as the passthrough engines. Fee impact (display only; output amounts are unchanged): direct BRL->BRLA quotes drop networkFeeFiat from the bridge-gas estimate (12.5 BRL under the pinned test rates) to 0, and totalFeeFiat now equals the anchor fee (0.10 BRL under the same rates). Cross-chain and swap corridors are unaffected. Golden expectations updated accordingly; security spec records the fix. --- .../quote/engines/fee/onramp-brl-to-evm.ts | 12 ++++++++++++ apps/api/src/tests/quote-pricing.golden.test.ts | 16 ++++++++-------- .../03-ramp-engine/fee-integrity.md | 2 ++ 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/apps/api/src/api/services/quote/engines/fee/onramp-brl-to-evm.ts b/apps/api/src/api/services/quote/engines/fee/onramp-brl-to-evm.ts index 5f69075c4..3d643370b 100644 --- a/apps/api/src/api/services/quote/engines/fee/onramp-brl-to-evm.ts +++ b/apps/api/src/api/services/quote/engines/fee/onramp-brl-to-evm.ts @@ -12,6 +12,7 @@ import { } from "@vortexfi/shared"; import { calculateEvmBridgeAndNetworkFee, getTokenDetailsForEvmDestination } from "../../core/squidrouter"; import { QuoteContext } from "../../core/types"; +import { isFiatToOwnStablecoinBaseDirect } from "../../utils"; import { BaseFeeEngine, FeeComputation, FeeConfig } from "./index"; export class OnRampAveniaToEvmFeeEngine extends BaseFeeEngine { @@ -47,6 +48,17 @@ export class OnRampAveniaToEvmFeeEngine extends BaseFeeEngine { // biome-ignore lint/style/noNonNullAssertion: Context is validated in `validate` const anchorFeeCurrency = ctx.aveniaMint!.currency as RampCurrency; + // Direct fiat -> own-stablecoin corridors (BRL→BRLA, EUR→EURC on Base): the anchor mints the + // requested token and it transfers straight to the destination — no swap or bridge leg exists, + // so pricing one here would quote a network fee that is never charged nor distributed. Mirrors + // the isFiatToOwnStablecoinBaseDirect passthrough in the squidrouter engines. + if (isFiatToOwnStablecoinBaseDirect(request.inputCurrency, request.outputCurrency, request.to)) { + return { + anchor: { amount: computedAnchorFee, currency: anchorFeeCurrency }, + network: { amount: "0", currency: "USD" as RampCurrency } + }; + } + const toNetwork = getNetworkFromDestination(request.to); if (!toNetwork) { throw new Error(`OnRampAveniaToEvmFeeEngine: invalid network for destination: ${request.to}`); diff --git a/apps/api/src/tests/quote-pricing.golden.test.ts b/apps/api/src/tests/quote-pricing.golden.test.ts index c857b3f42..3b63e66c9 100644 --- a/apps/api/src/tests/quote-pricing.golden.test.ts +++ b/apps/api/src/tests/quote-pricing.golden.test.ts @@ -67,8 +67,8 @@ describe("quote pricing goldens (fixed input matrix)", () => { inputAmount: "100.00", inputCurrency: "BRL", network: "base", - networkFeeFiat: "12.5", - networkFeeUsd: "2.5", + networkFeeFiat: "0", + networkFeeUsd: "0", outputAmount: "99.90", outputCurrency: "BRLA", partnerFeeFiat: "0", @@ -78,8 +78,8 @@ describe("quote pricing goldens (fixed input matrix)", () => { processingFeeUsd: "0.02", rampType: "BUY", to: "base", - totalFeeFiat: "12.60", - totalFeeUsd: "2.520000", + totalFeeFiat: "0.10", + totalFeeUsd: "0.020000", vortexFeeFiat: "0", vortexFeeUsd: "0" }, @@ -103,8 +103,8 @@ describe("quote pricing goldens (fixed input matrix)", () => { inputAmount: "250.50", inputCurrency: "BRL", network: "base", - networkFeeFiat: "12.5", - networkFeeUsd: "2.5", + networkFeeFiat: "0", + networkFeeUsd: "0", outputAmount: "250.40", outputCurrency: "BRLA", partnerFeeFiat: "0", @@ -114,8 +114,8 @@ describe("quote pricing goldens (fixed input matrix)", () => { processingFeeUsd: "0.02", rampType: "BUY", to: "base", - totalFeeFiat: "12.60", - totalFeeUsd: "2.520000", + totalFeeFiat: "0.10", + totalFeeUsd: "0.020000", vortexFeeFiat: "0", vortexFeeUsd: "0" }, diff --git a/docs/security-spec/03-ramp-engine/fee-integrity.md b/docs/security-spec/03-ramp-engine/fee-integrity.md index 509e7b047..40daa7a63 100644 --- a/docs/security-spec/03-ramp-engine/fee-integrity.md +++ b/docs/security-spec/03-ramp-engine/fee-integrity.md @@ -14,6 +14,8 @@ Fee calculation determines how much the user pays for a ramp operation and how t This means the fees shown to the user (from the database system) may differ from the fees actually applied (from the token config system). This is documented in `docs/architecture/current-fee-derivation.md` as a partially-implemented refactor. +**FIXED (2026-07-05)**: on the direct fiat → own-stablecoin corridors (BRL→BRLA and EUR→EURC on Base), the displayed network fee previously priced a USDC→output-token Squid bridge that the direct route never executes, charges, or distributes — inflating `networkFeeFiat`/`totalFeeFiat` for a leg that does not exist. `OnRampAveniaToEvmFeeEngine` now reports zero network fee for these corridors (same `isFiatToOwnStablecoinBaseDirect` predicate as the squidrouter passthrough engines); output amounts were never affected. Pinned by the quote pricing goldens (`apps/api/src/tests/quote-pricing.golden.test.ts`). + ### Fee Application Points - **On-ramp:** Fees are deducted from the input amount BEFORE the swap. `inputAmountAfterFees = inputAmount - fees`. From 716ec9531005542ef6ce92a60bcb14a00a8d148d Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 09:55:13 +0200 Subject: [PATCH 136/176] Fix issue with env in tests --- apps/frontend/vitest.config.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/frontend/vitest.config.ts b/apps/frontend/vitest.config.ts index 267bb94b0..42100065e 100644 --- a/apps/frontend/vitest.config.ts +++ b/apps/frontend/vitest.config.ts @@ -14,6 +14,13 @@ export default defineConfig({ lines: 19 } }, + // Dummy values so src/config/supabase.ts (pulled in transitively via services/auth) + // doesn't throw at import time; keeps the suite hermetic (no real credentials in CI). + // ".invalid" never resolves, so an accidental real call fails instead of hitting a live project. + env: { + VITE_SUPABASE_ANON_KEY: "test-anon-key", + VITE_SUPABASE_URL: "http://supabase.invalid" + }, environment: "node", globals: false, include: ["src/**/*.test.ts", "src/**/*.test.tsx"], From 6ccda2d74c6b8cbb71418b7fd9a7f5784b8ea350 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 10:21:19 +0200 Subject: [PATCH 137/176] Exclude non-source code from coverage denominators and re-base the floors Coverage now counts real, testable source only: built bundles, foreign workspace code (sdk under api), migrations, generated contract ABIs, and test infra are excluded via coveragePathIgnorePatterns per bun workspace and coverage.exclude in the frontend vitest config. The rebalancer's denominator was 99% shared/dist bundle; the ABIs inflated shared from a real 33% to a reported 51%. Floors move to just under the corrected measurements (api 0.44/0.56, shared 0.32/0.26, rebalancer 0.33/0.50, frontend 24/40). The two that go down are a re-base after the methodology change, not a ratchet reset. The frontend also emits lcov now so the aggregate report can read it. --- apps/api/bunfig.toml | 12 ++++++++++-- apps/api/package.json | 2 +- apps/frontend/vitest.config.ts | 20 +++++++++++++++++--- apps/rebalancer/bunfig.toml | 6 ++++++ apps/rebalancer/package.json | 2 +- packages/shared/bunfig.toml | 6 ++++++ packages/shared/package.json | 2 +- 7 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 apps/rebalancer/bunfig.toml create mode 100644 packages/shared/bunfig.toml diff --git a/apps/api/bunfig.toml b/apps/api/bunfig.toml index 4e4d9f332..d82ef9e57 100644 --- a/apps/api/bunfig.toml +++ b/apps/api/bunfig.toml @@ -4,7 +4,15 @@ root = "src" preload = ["./src/test-utils/preload.ts"] -# Coverage report config; the gate itself lives in scripts/check-coverage.ts +# Coverage report config; the gate itself lives in scripts/check-coverage.ts. +# Excluded from the denominator: built/foreign packages (sdk has its own suite), +# migrations (run-once DDL), and generated contract ABIs (const data, always "covered"). coverageSkipTestFiles = true -coveragePathIgnorePatterns = ["**/packages/shared/dist/**", "**/test-utils/**"] +coveragePathIgnorePatterns = [ + "**/packages/shared/dist/**", + "**/packages/sdk/**", + "**/test-utils/**", + "**/database/migrations/**", + "**/src/contracts/**" +] diff --git a/apps/api/package.json b/apps/api/package.json index d389321ea..6cf7c0577 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -96,7 +96,7 @@ "serve": "bun dist/index.js", "start": "bun run build && bun run serve", "test": "bun test", - "test:coverage": "bun test --coverage --coverage-reporter=lcov && bun ../../scripts/check-coverage.ts coverage/lcov.info 0.43 0.49", + "test:coverage": "bun test --coverage --coverage-reporter=lcov && bun ../../scripts/check-coverage.ts coverage/lcov.info 0.44 0.56", "test:db:start": "./scripts/test-db.sh start", "test:db:stop": "./scripts/test-db.sh stop" }, diff --git a/apps/frontend/vitest.config.ts b/apps/frontend/vitest.config.ts index 42100065e..4fb4c28ff 100644 --- a/apps/frontend/vitest.config.ts +++ b/apps/frontend/vitest.config.ts @@ -1,17 +1,31 @@ -import { defineConfig } from "vitest/config"; +import { coverageConfigDefaults, defineConfig } from "vitest/config"; // Dedicated Vitest config so test runs don't load the full Vite build pipeline // (tanstack router codegen, Sentry upload plugin, tailwind) from vite.config.ts. export default defineConfig({ test: { coverage: { + // Keep the denominator to shippable app code: no Playwright support code, + // Storybook stories, generated files (route tree, contract ABIs), or test infra. + exclude: [ + ...coverageConfigDefaults.exclude, + "e2e/**", + "playwright.config.ts", + "src/stories/**", + "src/contracts/**", + "src/routeTree.gen.ts", + "src/setupTests.ts", + "src/test/**" + ], provider: "v8", + // lcov feeds scripts/coverage-report.ts (root `bun run test:coverage`). + reporter: ["text-summary", "lcov"], // Ratchet floors, set just under the coverage measured when they were // last raised (enforced by `bun run test:coverage`, which CI runs). // Raise them as tested code grows; never lower them to make CI pass. thresholds: { - functions: 41, - lines: 19 + functions: 40, + lines: 24 } }, // Dummy values so src/config/supabase.ts (pulled in transitively via services/auth) diff --git a/apps/rebalancer/bunfig.toml b/apps/rebalancer/bunfig.toml new file mode 100644 index 000000000..3b075d0e5 --- /dev/null +++ b/apps/rebalancer/bunfig.toml @@ -0,0 +1,6 @@ +[test] +# Coverage report config; the gate itself lives in scripts/check-coverage.ts. +# Without the ignore pattern, the built shared bundle (~158k lines) dominates the +# denominator and the ratchet measures shared's coverage instead of this app's. +coverageSkipTestFiles = true +coveragePathIgnorePatterns = ["**/packages/shared/dist/**"] diff --git a/apps/rebalancer/package.json b/apps/rebalancer/package.json index 44d38fbc0..8bb1c5764 100644 --- a/apps/rebalancer/package.json +++ b/apps/rebalancer/package.json @@ -36,7 +36,7 @@ "serve": "bun dist/index.js", "start": "bun run build && bun run serve", "test": "bun test", - "test:coverage": "bun test --coverage --coverage-reporter=lcov && bun ../../scripts/check-coverage.ts coverage/lcov.info 0.31 0.15" + "test:coverage": "bun test --coverage --coverage-reporter=lcov && bun ../../scripts/check-coverage.ts coverage/lcov.info 0.33 0.50" }, "type": "module" } diff --git a/packages/shared/bunfig.toml b/packages/shared/bunfig.toml new file mode 100644 index 000000000..939afd37e --- /dev/null +++ b/packages/shared/bunfig.toml @@ -0,0 +1,6 @@ +[test] +# Coverage report config; the gate itself lives in scripts/check-coverage.ts. +# Generated contract ABIs are const data that count as 100% covered on import, +# which inflates the ratchet without any test protecting anything. +coverageSkipTestFiles = true +coveragePathIgnorePatterns = ["**/src/contracts/**"] diff --git a/packages/shared/package.json b/packages/shared/package.json index a46c7e82e..d969dc0d3 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -60,7 +60,7 @@ "format": "prettier . --write", "prepublishOnly": "bun run build", "test": "bun test", - "test:coverage": "bun test --coverage --coverage-reporter=lcov && bun ../../scripts/check-coverage.ts coverage/lcov.info 0.49 0.27" + "test:coverage": "bun test --coverage --coverage-reporter=lcov && bun ../../scripts/check-coverage.ts coverage/lcov.info 0.32 0.26" }, "types": "./dist/index.d.ts", "version": "0.2.0" From 54dd1101deae43a315570e96c031a8cba5e65350 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 10:21:28 +0200 Subject: [PATCH 138/176] Add a root test:coverage command with per-area and HTML reports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `bun run test:coverage` runs every workspace's coverage gate and then prints a per-area breakdown (scripts/coverage-report.ts), worst-covered first. `bun run test:coverage:html` renders the same data from the existing lcov files as a self-contained coverage/index.html with per-file drill-down including uncovered line ranges — no genhtml/lcov install needed. --- docs/testing-strategy.md | 16 +++ package.json | 2 + scripts/coverage-report.ts | 235 +++++++++++++++++++++++++++++++++++++ 3 files changed, 253 insertions(+) create mode 100644 scripts/coverage-report.ts diff --git a/docs/testing-strategy.md b/docs/testing-strategy.md index 083e38fe2..69f5a95c1 100644 --- a/docs/testing-strategy.md +++ b/docs/testing-strategy.md @@ -122,6 +122,15 @@ never PR-blocking. uses vitest's built-in thresholds (`apps/frontend/vitest.config.ts`). Floors sit just under the coverage measured when they were last raised — raise them when you add tested code; never lower them to make CI pass. +- The coverage denominator is real, testable source only: built bundles, foreign workspace code, + migrations, generated files (contract ABIs, route tree), Storybook stories, and test + infrastructure are excluded (each workspace's `bunfig.toml` `coveragePathIgnorePatterns`, + resp. `coverage.exclude` in the frontend vitest config). If a methodology change like this + moves the measured numbers, re-base the floors to just under the new values in the same PR — + that is not "lowering the ratchet". +- `bun run test:coverage` at the repo root runs every workspace's gate and then prints a + per-area breakdown (`scripts/coverage-report.ts`) showing which parts of each workspace are + covered and which are not. ## How to extend @@ -151,6 +160,13 @@ bun test:db:start # bun test:db:stop to remove it # makes it a no-op instead of letting it pick up stray files). bun run test # shared + sdk + rebalancer + api + frontend +# Coverage: all workspace gates + per-area report (needs the test db) +bun run test:coverage + +# Browsable HTML version of the same report (per-file, with uncovered line +# ranges) from the lcov files the previous command left behind +bun run test:coverage:html + # Individual workspaces bun test:api # unit + integration (needs the test db) bun test:frontend diff --git a/package.json b/package.json index 5fde6a10b..f56c1dfdc 100644 --- a/package.json +++ b/package.json @@ -124,6 +124,8 @@ "test": "bun run test:shared && bun run test:sdk && bun run test:rebalancer && bun run test:api && bun run test:frontend", "test:api": "cd apps/api && bun test", "test:contracts:relayer": "bun run --cwd contracts/relayer test", + "test:coverage": "bun run --cwd packages/shared test:coverage && bun run --cwd apps/rebalancer test:coverage && bun run --cwd apps/api test:coverage && bun run --cwd apps/frontend test:coverage && bun scripts/coverage-report.ts", + "test:coverage:html": "bun scripts/coverage-report.ts --html coverage/index.html && open coverage/index.html", "test:db:start": "bun run --cwd apps/api test:db:start", "test:db:stop": "bun run --cwd apps/api test:db:stop", "test:e2e": "cd apps/frontend && bun run test:e2e", diff --git a/scripts/coverage-report.ts b/scripts/coverage-report.ts new file mode 100644 index 000000000..aee3e4f85 --- /dev/null +++ b/scripts/coverage-report.ts @@ -0,0 +1,235 @@ +/** + * Per-area coverage report across all workspaces. Reads the LCOV files produced + * by each workspace's `test:coverage` script and prints line/function coverage + * aggregated per source directory, worst-covered first. + * + * bun run test:coverage # from the repo root: runs all suites, then this + * bun scripts/coverage-report.ts # re-print from existing lcov files + * bun scripts/coverage-report.ts --html coverage/index.html + * # additionally write a browsable HTML report + * # (per-file drill-down incl. uncovered line ranges) + * + * The pass/fail gates stay where they are (scripts/check-coverage.ts and the + * frontend vitest thresholds) — this script is purely a report. + */ +import { dirname, join } from "node:path"; + +const ROOT = join(import.meta.dir, ".."); + +const htmlFlagIndex = process.argv.indexOf("--html"); +const htmlPath = htmlFlagIndex === -1 ? null : (process.argv[htmlFlagIndex + 1] ?? "coverage/index.html"); + +const WORKSPACES = [ + { dir: "apps/api", name: "apps/api" }, + { dir: "packages/shared", name: "packages/shared" }, + { dir: "apps/frontend", name: "apps/frontend" }, + { dir: "apps/rebalancer", name: "apps/rebalancer" } +]; + +// Directory depth to aggregate at, e.g. src/api/services/quote. +const DEPTH = 4; + +interface FileCov { + path: string; + lf: number; + lh: number; + fnf: number; + fnh: number; + /** Consecutive un-hit source lines, merged into ranges like "120-134". */ + uncovered: string[]; +} + +interface Agg { + lf: number; + lh: number; + fnf: number; + fnh: number; + files: FileCov[]; +} + +function dirKey(file: string): string { + const parts = file.replace(/^\.\//, "").split("/"); + parts.pop(); + return parts.slice(0, DEPTH).join("/") || "."; +} + +function pct(hit: number, found: number): string { + return found === 0 ? " n/a" : `${((hit / found) * 100).toFixed(1).padStart(5)}%`; +} + +function parseLcov(lcov: string): FileCov[] { + const files: FileCov[] = []; + let cur: FileCov | null = null; + let missedLines: number[] = []; + for (const line of lcov.split("\n")) { + if (line.startsWith("SF:")) { + cur = { fnf: 0, fnh: 0, lf: 0, lh: 0, path: line.slice(3).replace(/^\.\//, ""), uncovered: [] }; + missedLines = []; + files.push(cur); + } else if (cur && line.startsWith("DA:")) { + const [lineNo, hits] = line.slice(3).split(","); + if (Number(hits) === 0) missedLines.push(Number(lineNo)); + } else if (cur && line.startsWith("LF:")) cur.lf = Number(line.slice(3)); + else if (cur && line.startsWith("LH:")) cur.lh = Number(line.slice(3)); + else if (cur && line.startsWith("FNF:")) cur.fnf = Number(line.slice(4)); + else if (cur && line.startsWith("FNH:")) cur.fnh = Number(line.slice(4)); + else if (cur && line === "end_of_record") { + missedLines.sort((a, b) => a - b); + for (let i = 0; i < missedLines.length; i++) { + const start = missedLines[i]; + while (i + 1 < missedLines.length && missedLines[i + 1] === missedLines[i] + 1) i++; + cur.uncovered.push(start === missedLines[i] ? String(start) : `${start}-${missedLines[i]}`); + } + cur = null; + } + } + return files; +} + +function groupByArea(files: FileCov[]): Map { + const dirs = new Map(); + for (const f of files) { + const key = dirKey(f.path); + const agg = dirs.get(key) ?? { files: [], fnf: 0, fnh: 0, lf: 0, lh: 0 }; + agg.files.push(f); + agg.lf += f.lf; + agg.lh += f.lh; + agg.fnf += f.fnf; + agg.fnh += f.fnh; + dirs.set(key, agg); + } + return dirs; +} + +const escapeHtml = (s: string) => s.replace(/&/g, "&").replace(//g, ">"); + +function coverageClass(hit: number, found: number): string { + if (found === 0) return "ok"; + const p = hit / found; + return p >= 0.5 ? "ok" : p >= 0.25 ? "mid" : "low"; +} + +function htmlPct(hit: number, found: number): string { + return found === 0 ? "n/a" : `${((hit / found) * 100).toFixed(1)}%`; +} + +function renderFileRow(f: FileCov): string { + const ranges = f.uncovered.length + ? `${escapeHtml(f.uncovered.slice(0, 12).join(", "))}${f.uncovered.length > 12 ? ", …" : ""}` + : ""; + return ` + ${escapeHtml(f.path)}${ranges} + ${htmlPct(f.lh, f.lf)}${htmlPct(f.fnh, f.fnf)} + ${f.lf}`; +} + +function renderWorkspace(name: string, dirs: Map): string { + const rows = [...dirs.entries()].sort(([, a], [, b]) => (a.lf ? a.lh / a.lf : 1) - (b.lf ? b.lh / b.lf : 1)); + const total: Agg = { files: [], fnf: 0, fnh: 0, lf: 0, lh: 0 }; + let body = ""; + for (const [dir, a] of rows) { + total.lf += a.lf; + total.lh += a.lh; + total.fnf += a.fnf; + total.fnh += a.fnh; + const files = a.files + .sort((x, y) => (x.lf ? x.lh / x.lf : 1) - (y.lf ? y.lh / y.lf : 1)) + .map(renderFileRow) + .join("\n"); + const width = a.lf ? Math.round((a.lh / a.lf) * 100) : 100; + body += ` + + ${escapeHtml(dir)} + + ${htmlPct(a.lh, a.lf)}${htmlPct(a.fnh, a.fnf)} + ${a.lf} + ${files} + \n`; + } + return `
+

${escapeHtml(name)} ${htmlPct(total.lh, total.lf)} lines · ${htmlPct(total.fnh, total.fnf)} functions · ${total.lf} LOC

+ + + ${body} +
area / file (click to expand)linesfnsLOC
+
`; +} + +const STYLE = ` + body { font: 14px/1.5 -apple-system, system-ui, sans-serif; color: #1c2426; background: #f6f7f6; margin: 0; padding: 2rem 1rem; } + main { max-width: 960px; margin: 0 auto; } + h1 { font-size: 1.3rem; margin: 0 0 0.2rem; } + .sub { color: #5c6a6d; font-size: 0.85rem; margin: 0 0 1.5rem; } + h2 { font-size: 1rem; margin: 1.8rem 0 0.5rem; } + h2 small { color: #5c6a6d; font-weight: 400; font-size: 0.8rem; } + table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #dde3e2; border-radius: 6px; } + th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: #5c6a6d; padding: 0.5rem 0.75rem; border-bottom: 1px solid #dde3e2; } + td { padding: 0.35rem 0.75rem; border-bottom: 1px solid #eef1f0; font-variant-numeric: tabular-nums; } + td.num, th.num { text-align: right; white-space: nowrap; } + tr.area { cursor: pointer; font-weight: 600; } + tr.area:hover { background: #f2f5f4; } + tr.file { display: none; font-size: 0.82rem; } + tbody.open tr.file { display: table-row; } + tbody.open .arrow { display: inline-block; transform: rotate(90deg); } + .arrow { color: #5c6a6d; margin-right: 0.4rem; transition: transform 0.1s; } + tr.file .path { padding-left: 2rem; font-family: ui-monospace, Menlo, monospace; } + .ranges { display: block; color: #a05a48; font-size: 0.72rem; margin-top: 0.1rem; word-break: break-all; } + .bar { display: inline-block; vertical-align: middle; width: 110px; height: 8px; background: #e9edec; border-radius: 3px; margin-left: 0.6rem; overflow: hidden; } + .bar i { display: block; height: 100%; } + tr.ok .bar i { background: #2e7d4f; } tr.ok td.num { color: #2e7d4f; } + tr.mid .bar i { background: #a8741f; } tr.mid td.num { color: #a8741f; } + tr.low .bar i { background: #b04a32; } tr.low td.num { color: #b04a32; } +`; + +let missing = false; +const sections: string[] = []; + +for (const ws of WORKSPACES) { + const lcovPath = join(ROOT, ws.dir, "coverage/lcov.info"); + const lcovFile = Bun.file(lcovPath); + if (!(await lcovFile.exists())) { + console.error(`\n${ws.name}: no coverage/lcov.info — run \`bun run test:coverage\` in ${ws.dir} first`); + missing = true; + continue; + } + + const files = parseLcov(await lcovFile.text()); + const dirs = groupByArea(files); + const rows = [...dirs.entries()].sort(([, a], [, b]) => (a.lf ? a.lh / a.lf : 1) - (b.lf ? b.lh / b.lf : 1)); + const total: Agg = { files: [], fnf: 0, fnh: 0, lf: 0, lh: 0 }; + + console.log(`\n${ws.name}`); + console.log(" lines fns files LOC area"); + for (const [dir, a] of rows) { + total.lf += a.lf; + total.lh += a.lh; + total.fnf += a.fnf; + total.fnh += a.fnh; + total.files.push(...a.files); + console.log( + ` ${pct(a.lh, a.lf)} ${pct(a.fnh, a.fnf)} ${String(a.files.length).padStart(6)} ${String(a.lf).padStart(7)} ${dir}` + ); + } + console.log( + ` ${pct(total.lh, total.lf)} ${pct(total.fnh, total.fnf)} ${String(total.files.length).padStart(6)} ${String(total.lf).padStart(7)} TOTAL` + ); + + sections.push(renderWorkspace(ws.name, dirs)); +} + +if (missing) process.exit(1); + +if (htmlPath) { + const out = join(ROOT, htmlPath); + const html = ` + +Vortex coverage report
+

Vortex coverage report

+

Generated ${new Date().toISOString()} · areas sorted worst-covered first · click an area to see its files and their uncovered line ranges

+${sections.join("\n")} +
`; + const { mkdir } = await import("node:fs/promises"); + await mkdir(dirname(out), { recursive: true }); + await Bun.write(out, html); + console.log(`\nHTML report written to ${out}`); +} From b2a986cb4816217a1fea9df1af8c691e1f6faaa5 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 10:27:10 +0200 Subject: [PATCH 139/176] Update gitignore --- .gitignore | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/.gitignore b/.gitignore index f4485677c..64e43d4ec 100644 --- a/.gitignore +++ b/.gitignore @@ -71,3 +71,63 @@ apps/frontend/playwright-report/ # Local credentials and agent-tool artifacts .api-key.json .playwright-mcp/ +/contracts/cctp-settlement/typechain-types/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC20Errors.ts +/contracts/cctp-settlement/typechain-types/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC721Errors.ts +/contracts/cctp-settlement/typechain-types/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC1155Errors.ts +/contracts/cctp-settlement/typechain-types/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/index.ts +/contracts/cctp-settlement/typechain-types/@openzeppelin/contracts/interfaces/IERC1363.ts +/contracts/cctp-settlement/typechain-types/@openzeppelin/contracts/interfaces/index.ts +/contracts/cctp-settlement/typechain-types/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.ts +/contracts/cctp-settlement/typechain-types/@openzeppelin/contracts/token/ERC20/extensions/index.ts +/contracts/cctp-settlement/typechain-types/@openzeppelin/contracts/token/ERC20/utils/index.ts +/contracts/cctp-settlement/typechain-types/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.ts +/contracts/cctp-settlement/typechain-types/@openzeppelin/contracts/token/ERC20/ERC20.ts +/contracts/cctp-settlement/typechain-types/@openzeppelin/contracts/token/ERC20/IERC20.ts +/contracts/cctp-settlement/typechain-types/@openzeppelin/contracts/token/ERC20/index.ts +/contracts/cctp-settlement/typechain-types/@openzeppelin/contracts/token/index.ts +/contracts/cctp-settlement/typechain-types/@openzeppelin/contracts/utils/introspection/IERC165.ts +/contracts/cctp-settlement/typechain-types/@openzeppelin/contracts/utils/introspection/index.ts +/contracts/cctp-settlement/typechain-types/@openzeppelin/contracts/utils/index.ts +/contracts/cctp-settlement/typechain-types/@openzeppelin/contracts/utils/ReentrancyGuard.ts +/contracts/cctp-settlement/typechain-types/@openzeppelin/contracts/index.ts +/contracts/cctp-settlement/typechain-types/@openzeppelin/index.ts +/contracts/cctp-settlement/typechain-types/contracts/interfaces/index.ts +/contracts/cctp-settlement/typechain-types/contracts/interfaces/ITokenMessengerV2.ts +/contracts/cctp-settlement/typechain-types/contracts/mocks/index.ts +/contracts/cctp-settlement/typechain-types/contracts/mocks/MockERC20.ts +/contracts/cctp-settlement/typechain-types/contracts/mocks/MockTokenMessengerV2.ts +/contracts/cctp-settlement/typechain-types/contracts/index.ts +/contracts/cctp-settlement/typechain-types/contracts/PerUserCctpSettlement.ts +/contracts/cctp-settlement/typechain-types/contracts/PerUserCctpSettlementFactory.ts +/contracts/cctp-settlement/typechain-types/factories/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC20Errors__factory.ts +/contracts/cctp-settlement/typechain-types/factories/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC721Errors__factory.ts +/contracts/cctp-settlement/typechain-types/factories/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC1155Errors__factory.ts +/contracts/cctp-settlement/typechain-types/factories/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/index.ts +/contracts/cctp-settlement/typechain-types/factories/@openzeppelin/contracts/interfaces/IERC1363__factory.ts +/contracts/cctp-settlement/typechain-types/factories/@openzeppelin/contracts/interfaces/index.ts +/contracts/cctp-settlement/typechain-types/factories/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata__factory.ts +/contracts/cctp-settlement/typechain-types/factories/@openzeppelin/contracts/token/ERC20/extensions/index.ts +/contracts/cctp-settlement/typechain-types/factories/@openzeppelin/contracts/token/ERC20/utils/index.ts +/contracts/cctp-settlement/typechain-types/factories/@openzeppelin/contracts/token/ERC20/utils/SafeERC20__factory.ts +/contracts/cctp-settlement/typechain-types/factories/@openzeppelin/contracts/token/ERC20/ERC20__factory.ts +/contracts/cctp-settlement/typechain-types/factories/@openzeppelin/contracts/token/ERC20/IERC20__factory.ts +/contracts/cctp-settlement/typechain-types/factories/@openzeppelin/contracts/token/ERC20/index.ts +/contracts/cctp-settlement/typechain-types/factories/@openzeppelin/contracts/token/index.ts +/contracts/cctp-settlement/typechain-types/factories/@openzeppelin/contracts/utils/introspection/IERC165__factory.ts +/contracts/cctp-settlement/typechain-types/factories/@openzeppelin/contracts/utils/introspection/index.ts +/contracts/cctp-settlement/typechain-types/factories/@openzeppelin/contracts/utils/index.ts +/contracts/cctp-settlement/typechain-types/factories/@openzeppelin/contracts/utils/ReentrancyGuard__factory.ts +/contracts/cctp-settlement/typechain-types/factories/@openzeppelin/contracts/index.ts +/contracts/cctp-settlement/typechain-types/factories/@openzeppelin/index.ts +/contracts/cctp-settlement/typechain-types/factories/contracts/interfaces/index.ts +/contracts/cctp-settlement/typechain-types/factories/contracts/interfaces/ITokenMessengerV2__factory.ts +/contracts/cctp-settlement/typechain-types/factories/contracts/mocks/index.ts +/contracts/cctp-settlement/typechain-types/factories/contracts/mocks/MockERC20__factory.ts +/contracts/cctp-settlement/typechain-types/factories/contracts/mocks/MockTokenMessengerV2__factory.ts +/contracts/cctp-settlement/typechain-types/factories/contracts/index.ts +/contracts/cctp-settlement/typechain-types/factories/contracts/PerUserCctpSettlement__factory.ts +/contracts/cctp-settlement/typechain-types/factories/contracts/PerUserCctpSettlementFactory__factory.ts +/contracts/cctp-settlement/typechain-types/factories/index.ts +/contracts/cctp-settlement/typechain-types/common.ts +/contracts/cctp-settlement/typechain-types/hardhat.d.ts +/contracts/cctp-settlement/typechain-types/index.ts From d7a3b4a46304ea30a0d917c91274b414413e2511 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 10:44:26 +0200 Subject: [PATCH 140/176] Remove doc pages that don't fit this branch --- docs/add-updateRamp-endpoint-plan.md | 133 ----- .../13-v0.6.0-recovery-and-responsibility.md | 162 ------ docs/api/pages/recovery-and-responsibility.md | 122 ---- .../per-user-eurc-cctp-settlement-contract.md | 540 ------------------ docs/code-review-1161-sdk-changes.md | 91 --- 5 files changed, 1048 deletions(-) delete mode 100644 docs/add-updateRamp-endpoint-plan.md delete mode 100644 docs/api/pages/13-v0.6.0-recovery-and-responsibility.md delete mode 100644 docs/api/pages/recovery-and-responsibility.md delete mode 100644 docs/architecture/per-user-eurc-cctp-settlement-contract.md delete mode 100644 docs/code-review-1161-sdk-changes.md diff --git a/docs/add-updateRamp-endpoint-plan.md b/docs/add-updateRamp-endpoint-plan.md deleted file mode 100644 index 8b7f9900a..000000000 --- a/docs/add-updateRamp-endpoint-plan.md +++ /dev/null @@ -1,133 +0,0 @@ -# Plan to Add `updateRamp` Endpoint - -**Objective:** Introduce a new `updateRamp` endpoint to allow the frontend to submit presigned transactions and other necessary data *before* the `startRamp` endpoint is called. This enhances resilience by decoupling data submission from process initiation. - -## Phase 1: Backend Changes (API) - -1. **Define DTOs for `updateRamp`:** - * Location: `packages/shared/src/endpoints/ramp.endpoints.ts` - * **`UpdateRampRequest`**: - * `rampId: string` - * `presignedTxs: PresignedTx[]` - * `additionalData?: { squidRouterApproveHash?: string; squidRouterSwapHash?: string; assethubToPendulumHash?: string; [key: string]: unknown; }` (consistent with data `startRamp` might need) - * **`UpdateRampResponse`**: - * `RampProcess` (the updated ramp process object) - -2. **`RampState` Model Considerations:** - * Location: `apps/api/src/models/rampState.model.ts` - * The `updateRamp` endpoint will populate fields within `RampState` that `startRamp` will consume. - * This will reuse existing fields or add new nullable fields to `RampState` if necessary to hold `presignedTxs` and `additionalData` directly. - * **No new database migration will be created for *separate "pending"* fields.** The aim is for `updateRamp` to set data that `startRamp` directly uses from the existing or slightly augmented `RampState` structure. - -3. **Implement `rampController.updateRamp`:** - * Location: `apps/api/src/api/controllers/ramp.controller.ts` - * **Logic:** - * Validate `rampId` and request payload. - * Retrieve the `RampState`. - * Return `409 Conflict` if ramp is not in a state allowing updates (e.g., already started, completed, failed). - * Store/update `presignedTxs` and `additionalData` directly in the `RampState` fields that `startRamp` will consume. Handle merging/replacement if called multiple times. - * Do NOT trigger phase transitions. - * Save updated `RampState`. - * Return the updated `RampProcess`. - -4. **Add Route for `updateRamp`:** - * Location: `apps/api/src/api/routes/v1/ramp.route.ts` - * Route: `router.post('/:rampId/update', rampController.updateRamp);` - * Add JSDoc API documentation. - -5. **Modify `rampController.startRamp`:** - * Location: `apps/api/src/api/controllers/ramp.controller.ts` - * **Logic Change:** - * `startRamp` will expect necessary `presignedTxs` and `additionalData` to be present in `RampState` (populated by `updateRamp`). - * The `StartRampRequest` DTO will be modified (see Phase 2, Step 1) to only require `rampId`. - * If required data is missing in `RampState` when `startRamp` is called, return an error (e.g., `400 Bad Request` or `422 Unprocessable Entity`). - -6. **Update `RampService` (Backend - `apps/api/src/api/services/ramp/ramp.service.ts`):** - * Reflect changes in how `startRamp` retrieves data (from `RampState`). - -## Phase 2: Frontend Changes - -1. **Update `StartRampRequest` DTO (Shared Package):** - * Location: `packages/shared/src/endpoints/ramp.endpoints.ts` - * Modify `RampEndpoints.StartRampRequest` to: - ```typescript - export interface StartRampRequest { - rampId: string; - } - ``` - (Remove `presignedTxs` and `additionalData` from this request DTO). - -2. **Add `updateRamp` to `RampService` (Frontend):** - * Location: `apps/frontend/src/services/api/ramp.service.ts` - * Add method: - ```typescript - static async updateRamp( - rampId: string, - presignedTxs: PresignedTx[], - additionalData?: RampEndpoints.UpdateRampRequest['additionalData'] - ): Promise { - const request: RampEndpoints.UpdateRampRequest = { - rampId, - presignedTxs, - additionalData, - }; - return apiRequest('post', `${this.BASE_PATH}/${rampId}/update`, request); - } - ``` - -3. **Integrate `updateRamp` Call in `useRegisterRamp.ts`:** - * Location: `apps/frontend/src/hooks/offramp/useRampService/useRegisterRamp.ts` - * Call `RampService.updateRamp` after ephemeral transactions are signed. - * Call `RampService.updateRamp` again after user transactions are signed (for offramps), including user transaction hashes in `additionalData`. - * The backend will merge data from multiple calls. - -4. **Modify `startRamp` Call in Frontend:** - * Update calls to `RampService.startRamp` to only pass `rampId`. - * Ensure `startRamp` is called after all necessary `updateRamp` calls. - -## Phase 3: Documentation - -1. **API Documentation:** - * Document the new `POST /v1/ramp/:rampId/update` endpoint in `apps/api/src/api/routes/v1/ramp.route.ts` (JSDoc). - * Update JSDoc for `POST /v1/ramp/start` to reflect its simplified request payload (only `rampId`). - * Update any relevant project documentation (e.g., in `/docs`) to describe the new `register` -> `update` (multiple times potentially) -> `start` flow. - -2. **Memory Bank Update:** - * Update `memory-bank/activeContext.md`: Note the ongoing work on this feature. - * Update `memory-bank/decisionLog.md`: Log the decision to add `updateRamp`, the rationale, and the choice to reuse/augment existing `RampState` fields rather than adding separate "pending" fields. - * Update `memory-bank/systemPatterns.md` or `memory-bank/phases.md` with the new flow diagram if significantly different. - -## Flow Diagram - -```mermaid -sequenceDiagram - participant FE as Frontend - participant API as Backend API - participant DB as Database (RampState) - - FE->>API: POST /v1/ramp/register (quoteId, signingAccounts, initialAdditionalData) - API->>DB: Create RampState (initial state, unsignedTxs) - API-->>FE: rampProcess (incl. rampId, unsignedTxs) - - FE->>FE: Sign Ephemeral Transactions (ephemeralPresignedTxs) - FE->>API: POST /v1/ramp/{rampId}/update (rampId, ephemeralPresignedTxs) - API->>DB: Store/Merge ephemeralPresignedTxs in RampState - API-->>FE: Updated rampProcess - - opt Offramp User Signing - FE->>FE: User signs transactions (userPresignedTxs, userTxHashes) - FE->>API: POST /v1/ramp/{rampId}/update (rampId, userPresignedTxs, additionalData: {userTxHashes}) - API->>DB: Store/Merge userPresignedTxs and additionalData in RampState - API-->>FE: Updated rampProcess - end - - FE->>API: POST /v1/ramp/start (rampId) - API->>DB: Read presignedTxs & additionalData from RampState - API->>API: Process ramp using stored data (execute first phase) - API->>DB: Update RampState (new phase) - API-->>FE: Updated rampProcess (ramp started) - - loop Poll Status - FE->>API: GET /v1/ramp/{rampId} - API-->>FE: rampProcess (current status) - end diff --git a/docs/api/pages/13-v0.6.0-recovery-and-responsibility.md b/docs/api/pages/13-v0.6.0-recovery-and-responsibility.md deleted file mode 100644 index 44d5c2bdb..000000000 --- a/docs/api/pages/13-v0.6.0-recovery-and-responsibility.md +++ /dev/null @@ -1,162 +0,0 @@ -# v0.6.0 Recovery and Responsibility Model - -This note is for API partners reviewing the v0.6.0 BRL/PIX ramp hardening before scaling production volume. It focuses on two questions: - -1. What changed in v0.6.0 to prevent recurrence of presigned-transaction and backup-transaction failures? -2. Who owns each failure domain before the next incident happens? - -Related release PRs: - -- [pendulum-chain/vortex#1152](https://github.com/pendulum-chain/vortex/pull/1152) -- [pendulum-chain/vortex#1153](https://github.com/pendulum-chain/vortex/pull/1153) - -## Bottom Line - -For a normal Vortex-managed ramp, the recoverability condition is: - -> The ephemeral key backups must exist, be intact, and be accessible until the ramp is complete and the recovery window has passed. - -Vortex stores the server-generated unsigned transaction plan plus the accepted presigned primary, backup, and fallback transactions for the ramp. That lets Vortex continue or retry the ramp without asking the API client to manually re-sign during normal recovery. - -The client-held ephemeral backup remains the final recovery dependency. If a recovery path needs a new signature that was not already accepted and stored by Vortex, Vortex cannot reconstruct the ephemeral key. If the partner loses the ephemeral backup, recovery may be limited to the already accepted presigned transactions, provider reconciliation, bridge refunds, or chain-specific cleanup paths. - -## What Changed In v0.6.0 - -The practical change is that the system now refuses to let value move until the recovery transaction set has been validated. - -Before v0.6.0, a bad or incomplete presigned transaction set could make it farther into the ramp lifecycle. That created a dangerous failure mode: user funds could enter the ramp while Vortex did not yet have a complete and content-validated transaction set to continue or recover the process. - -In v0.6.0, the backend validates the presigned transaction set at two gates: - -- `updateRamp`: every submitted transaction is validated before being merged into ramp state. Partial submissions are allowed, but only valid transactions are accepted. -- `startRamp`: the complete ephemeral-signed transaction set must be present and valid before the phase processor starts. - -For BRL onramps, PIX payment details are released only after the presigned transaction checks pass. For BRL offramps, user-wallet transactions are not exposed until the ephemeral presigned set has passed validation. This prevents the user or partner from moving funds into a ramp whose recovery material is missing or malformed. - -## Specific Hardening - -| Area | v0.6.0 behavior | Why it prevents recurrence | -|---|---|---| -| Completeness gate | Every expected ephemeral-signed unsigned transaction must have a corresponding accepted presigned transaction before `startRamp`. | Vortex does not start execution unless it has the transaction material needed to continue the ramp. | -| Exact matching | Submitted transactions are matched to the server-issued unsigned plan by `phase`, `network`, `nonce`, and `signer`. Unknown or extra transactions are rejected. | A client cannot swap in a transaction for the same phase that moves funds somewhere else. | -| EVM content validation | Signed EVM transactions are decoded and checked for recovered signer, nonce, chain ID, `to`, calldata, value, gas limit, and fee caps. Contract-creation and chainless replayable transactions are rejected. | A signed transaction can no longer pass validation merely because the metadata looks right. The payload itself must match the Vortex-generated plan. | -| EIP-712 validation | Signed typed data is deep-compared against the server-issued typed data before signature recovery. | Permit fields such as token, spender, amount, deadline, owner, and verifying contract cannot be substituted. | -| Backup transactions | Each ephemeral-signed transaction must include exactly the expected backup set. For EVM backups, each backup is revalidated against the same unsigned payload with sequential nonces. For Substrate backups, the backup call must match the primary call. | Backups are not just stored as opaque extras. They are checked to ensure a retry cannot execute a different action. | -| User-wallet phases | SELL-side user-wallet phases are not accepted as presigned transactions. The client submits the on-chain tx hash, and Vortex verifies the receipt and calldata against the unsigned blueprint. | A partner cannot accidentally or maliciously attach a fake presigned transaction for a phase that must be performed by the user's wallet. | -| Payment-data gating | PIX QR / payment data is hidden until the presigned set is valid. | Users are not asked to pay before Vortex has a validated recovery path. | -| SDK pre-flight checks | The SDK performs BRL KYC, PIX key, and remaining-limit checks before registration where possible. | Avoidable failures are caught before the ramp is created or before funds move. | - -## Recovery Model - -```mermaid -flowchart TD - A["Quote"] --> B["Register ramp
ephemeral public addresses"] - B --> C["Client signs primary + backups"] - C --> D{"Vortex validation passes?"} - D -->|No| E["Reject before funds move
fix/re-register"] - D -->|Yes| F["Payment data or user txs released"] - F --> G["Start ramp"] - G --> H{"Phase fails?"} - H -->|No| I["Complete"] - H -->|Yes| J["Vortex retries using stored txs,
backups, fallback txs, hashes,
provider state, and phase logs"] - J --> K{"Need new signature?"} - K -->|No| H - K -->|Yes| L["Use partner-held ephemeral backup
or escalate if backup unavailable"] -``` - -The intended production behavior is: - -- Vortex handles phase retries and normal recovery using the presigned material already stored in ramp state. -- The API client should not need to manually intervene for ordinary retries after a ramp has started. -- The API client must keep the ephemeral backup available so that exceptional recovery remains possible. -- If a ramp fails before funds move, the normal answer is to re-quote and register a fresh ramp. -- If funds have moved, the normal answer is to identify where they are and continue, recover, refund, or reconcile from that point. - -## R$100 Validation Ramp - -Before increasing volume, run one small BRL ramp end-to-end and deliberately inspect the recovery gates. - -Recommended test: - -1. Pin the integration to `@vortexfi/sdk` v0.6.0 or a direct API implementation with equivalent validation behavior. -2. Confirm ephemeral backups are written to the partner's secure store before payment or user-wallet signing continues. -3. Create a small BRL quote, for example around R$100. -4. Register the ramp and record `quoteId`, `rampId`, SDK/client version, environment, partner order ID, and an internal reference to the encrypted ephemeral backup. Do not expose the key material. -5. Confirm PIX payment details or user-wallet transactions are only returned after `updateRamp` accepts the presigned transaction set. -6. Complete the PIX payment or user-wallet transaction. -7. Confirm the ramp progresses to completion without additional partner signing. -8. Confirm webhooks and `GET /v1/ramp/{id}` agree on final status. -9. Confirm support can retrieve `GET /v1/ramp/{id}/errors` if the ramp stalls. - -Recommended negative tests in sandbox or staging: - -- Submit a presigned EVM transaction with the wrong recipient or calldata. Expected result: API rejects it. -- Remove backup transactions from an ephemeral-signed transaction. Expected result: API rejects it. -- Change a backup nonce sequence. Expected result: API rejects it. -- Submit a SELL user-wallet phase as a presigned transaction instead of a tx hash. Expected result: API rejects it. - -Success criteria: - -- No funds move before the presigned set is accepted. -- Vortex has primary and backup transaction material before `startRamp`. -- The partner can prove the ephemeral backup exists without exposing it. -- The ramp completes, or if it stalls, the current phase and recovery owner are clear. - -## Responsibility Model - -This is an operational ownership model, not a replacement for commercial/legal terms. - -| Failure domain | Primary owner | What that owner is responsible for | -|---|---|---| -| SDK bug in v0.6.0+ | Vortex | Fixing SDK behavior, documenting affected versions, providing migration guidance, and supporting recovery for ramps that used the SDK as intended. | -| Client-side SDK misuse | API client | Pinning supported versions, not modifying signing behavior, not bypassing SDK safeguards, and testing the integration before scaling. | -| Direct API signing implementation | API client | Matching SDK behavior exactly: fresh ephemerals, secure backups, exact payload validation before signing, idempotency, and correct `updateRamp` / `startRamp` ordering. | -| Backend accepts invalid presigned data | Vortex | Validation correctness, rejection of malformed or substituted payloads, and not releasing payment/user-funding steps before validation passes. | -| Ephemeral key custody | API client | Generating per-ramp ephemerals, storing encrypted backups, retaining them through the recovery window, and making them accessible during incident response. | -| Stored presigned/fallback transaction execution | Vortex | Persisting accepted transaction material, retrying recoverable phases, using backup/fallback transactions when needed, and maintaining phase/error logs. | -| Squid/Axelar failure | Vortex as recovery operator; Squid/Axelar as external dependency | Monitoring bridge state, adding gas where required, waiting for arrival/refund, retrying recoverable errors, and coordinating external escalation. | -| Pendulum/Moonbeam/Base RPC or chain outage | Vortex as recovery operator; chain/RPC provider as external dependency | Holding the ramp in pending/retry state, avoiding double execution, switching/retrying infrastructure where available, and resuming when the chain recovers. | -| Network congestion | Shared | Vortex validates gas/fee minimums and retries phases. The client must not duplicate ramps or reuse stale quotes/signatures. Both sides communicate pending status to users. | -| PIX/Avenia provider issue | Vortex as recovery operator; Avenia/PIX as external dependency | Reconciling PIX payment, BRLA mint, Avenia subaccount balance, and payout ticket state. The client provides correct KYC/tax/PIX data and user communication. | -| Partner loses ephemeral backup | API client | This is the main unrecoverable client-side failure. Vortex can still use already accepted presigned material, but cannot recreate missing private keys. | -| Partner exposes `sk_*` or ephemeral secrets | API client | Immediate key rotation, incident disclosure, and containment. Vortex can revoke/rotate partner credentials but cannot undo exposed client-side key material. | - -## Incident Rule Of Thumb - -When a ramp is stuck: - -- If validation rejected the ramp before funds moved, restart from a fresh quote. -- If funds moved and Vortex has accepted presigned/backups, Vortex owns operational recovery through the phase processor, bridge/provider checks, fallback transactions, and support workflow. -- If recovery requires ephemeral signing material not already stored by Vortex, the API client must provide access to its encrypted ephemeral backup. -- If the ephemeral backup is missing or corrupted, that risk sits with the API client. -- If Vortex accepted invalid transaction material or failed to use valid stored recovery material correctly, that sits with Vortex. - -## Data To Keep For Every Ramp - -The client should persist: - -- `quoteId` -- `rampId` -- partner order ID -- user/session ID -- SDK/client version -- environment: sandbox or production -- webhook ID, if used -- user-submitted tx hashes, if any -- encrypted ephemeral-backup reference - -Vortex should persist: - -- server-issued unsigned transaction plan -- accepted presigned primary transactions -- accepted backup/fallback transactions -- provider references, payout ticket IDs, and transaction hashes -- phase history and error logs -- final transaction hash / explorer link where available - -Never share in support channels: - -- `sk_*` API keys -- ephemeral private keys -- user wallet private keys -- raw environment dumps diff --git a/docs/api/pages/recovery-and-responsibility.md b/docs/api/pages/recovery-and-responsibility.md deleted file mode 100644 index a615a99b3..000000000 --- a/docs/api/pages/recovery-and-responsibility.md +++ /dev/null @@ -1,122 +0,0 @@ -# Recovery and Responsibility Model - -## Bottom Line - -For a normal Vortex-managed ramp, the recoverability condition is: - -> The ephemeral key backups must exist, be intact, and be accessible until the ramp is complete and the recovery window has passed. - -Vortex stores the server-generated unsigned transaction plan plus the accepted presigned primary, backup, and fallback transactions for the ramp. That lets Vortex continue or retry the ramp without asking the API client to manually re-sign during normal recovery. - -The client-held ephemeral backup remains the final recovery dependency. If a recovery path needs a new signature that was not already accepted and stored by Vortex, Vortex cannot reconstruct the ephemeral key. If the partner loses the ephemeral backup, recovery may be limited to the already accepted presigned transactions, provider reconciliation, bridge refunds, or chain-specific cleanup paths. - -## What Changed In v0.6.0 - -The practical change is that the system now refuses to let value move until the recovery transaction set has been validated. - -Before v0.6.0, a bad or incomplete presigned transaction set could make it farther into the ramp lifecycle. That created a dangerous failure mode: user funds could enter the ramp while Vortex did not yet have a complete and content-validated transaction set to continue or recover the process. - -In v0.6.0, the backend validates the presigned transaction set at two gates: - -- `updateRamp`: every submitted transaction is validated before being merged into ramp state. Partial submissions are allowed, but only valid transactions are accepted. -- `startRamp`: the complete ephemeral-signed transaction set must be present and valid before the phase processor starts. - -For BRL onramps, PIX payment details are released only after the presigned transaction checks pass. For BRL offramps, user-wallet transactions are not exposed until the ephemeral presigned set has passed validation. This prevents the user or partner from moving funds into a ramp whose recovery material is missing or malformed. - -## Specific Hardening - -| Area | v0.6.0 behavior | Why it prevents recurrence | -|---|---|---| -| Completeness gate | Every expected ephemeral-signed unsigned transaction must have a corresponding accepted presigned transaction before `startRamp`. | Vortex does not start execution unless it has the transaction material needed to continue the ramp. | -| Exact matching | Submitted transactions are matched to the server-issued unsigned plan by `phase`, `network`, `nonce`, and `signer`. Unknown or extra transactions are rejected. | A client cannot swap in a transaction for the same phase that moves funds somewhere else. | -| EVM content validation | Signed EVM transactions are decoded and checked for recovered signer, nonce, chain ID, `to`, calldata, value, gas limit, and fee caps. Contract-creation and chainless replayable transactions are rejected. | A signed transaction can no longer pass validation merely because the metadata looks right. The payload itself must match the Vortex-generated plan. | -| EIP-712 validation | Signed typed data is deep-compared against the server-issued typed data before signature recovery. | Permit fields such as token, spender, amount, deadline, owner, and verifying contract cannot be substituted. | -| Backup transactions | Each ephemeral-signed transaction must include exactly the expected backup set. For EVM backups, each backup is revalidated against the same unsigned payload with sequential nonces. For Substrate backups, the backup call must match the primary call. | Backups are not just stored as opaque extras. They are checked to ensure a retry cannot execute a different action. | -| User-wallet phases | SELL-side user-wallet phases are not accepted as presigned transactions. The client submits the on-chain tx hash, and Vortex verifies the receipt and calldata against the unsigned blueprint. | A partner cannot accidentally or maliciously attach a fake presigned transaction for a phase that must be performed by the user's wallet. | -| Payment-data gating | PIX QR / payment data is hidden until the presigned set is valid. | Users are not asked to pay before Vortex has a validated recovery path. | -| SDK pre-flight checks | The SDK performs BRL KYC, PIX key, and remaining-limit checks before registration where possible. | Avoidable failures are caught before the ramp is created or before funds move. | - -## Recovery Model - -```mermaid -flowchart TD - A["Quote"] --> B["Register ramp
ephemeral public addresses"] - B --> C["Client signs primary + backups"] - C --> D{"Vortex validation passes?"} - D -->|No| E["Reject before funds move
fix/re-register"] - D -->|Yes| F["Payment data or user txs released"] - F --> G["Start ramp"] - G --> H{"Phase fails?"} - H -->|No| I["Complete"] - H -->|Yes| J["Vortex retries using stored txs,
backups, fallback txs, hashes,
provider state, and phase logs"] - J --> K{"Need new signature?"} - K -->|No| H - K -->|Yes| L["Use partner-held ephemeral backup
or escalate if backup unavailable"] -``` - -The intended production behavior is: - -- Vortex handles phase retries and normal recovery using the presigned material already stored in ramp state. -- The API client should not need to manually intervene for ordinary retries after a ramp has started. -- The API client must keep the ephemeral backup available so that exceptional recovery remains possible. -- If a ramp fails before funds move, the normal answer is to re-quote and register a fresh ramp. -- If funds have moved, the normal answer is to identify where they are and continue, recover, refund, or reconcile from that point. - -## Responsibility Model - -This is an operational ownership model, not a replacement for commercial/legal terms. - -| Failure domain | Primary owner | What that owner is responsible for | -|---|---|---| -| SDK bug in v0.6.0+ | Vortex | Fixing SDK behavior, documenting affected versions, providing migration guidance, and supporting recovery for ramps that used the SDK as intended. | -| Client-side SDK misuse | API client | Pinning supported versions, not modifying signing behavior, not bypassing SDK safeguards, and testing the integration before scaling. | -| Direct API signing implementation | API client | Matching SDK behavior exactly: fresh ephemerals, secure backups, exact payload validation before signing, idempotency, and correct `updateRamp` / `startRamp` ordering. | -| Backend accepts invalid presigned data | Vortex | Validation correctness, rejection of malformed or substituted payloads, and not releasing payment/user-funding steps before validation passes. | -| Ephemeral key custody | API client | Generating per-ramp ephemerals, storing backups, retaining them through the recovery window, and making them accessible during incident response. | -| Stored presigned/fallback transaction execution | Vortex | Persisting accepted transaction material, retrying recoverable phases, using backup/fallback transactions when needed, and maintaining phase/error logs. | -| Squid/Axelar failure | Vortex as recovery operator; Squid/Axelar as external dependency | Monitoring bridge state, adding gas where required, waiting for arrival/refund, retrying recoverable errors, and coordinating external escalation. | -| Pendulum/Moonbeam/Base RPC or chain outage | Vortex as recovery operator; chain/RPC provider as external dependency | Holding the ramp in pending/retry state, avoiding double execution, switching/retrying infrastructure where available, and resuming when the chain recovers. | -| Network congestion | Shared | Vortex validates gas/fee minimums and retries phases. The client must not duplicate ramps or reuse stale quotes/signatures. Both sides communicate pending status to users. | -| PIX/Avenia provider issue | Vortex as recovery operator; Avenia/PIX as external dependency | Reconciling PIX payment, BRLA mint, Avenia subaccount balance, and payout ticket state. The client provides correct KYC/tax/PIX data and user communication. | -| Partner loses ephemeral backup | API client | This is the main unrecoverable client-side failure. Vortex can still use already accepted presigned material, but cannot recreate missing private keys. | -| Partner exposes `sk_*` or ephemeral secrets | API client | Immediate key rotation, incident disclosure, and containment. Vortex can revoke/rotate partner credentials but cannot undo exposed client-side key material. | - -## Incident Rule Of Thumb - -When a ramp is stuck: - -- If validation rejected the ramp before funds moved, restart from a fresh quote. -- If funds moved and Vortex has accepted presigned/backups, Vortex owns operational recovery through the phase processor, bridge/provider checks, fallback transactions, and support workflow. -- If recovery requires ephemeral signing material not already stored by Vortex, the API client must provide access to its ephemeral backup. -- If the ephemeral backup is missing or corrupted, that risk sits with the API client. -- If Vortex accepted invalid transaction material or failed to use valid stored recovery material correctly, that sits with Vortex. - -## Data To Keep For Every Ramp - -The client should persist: - -- `quoteId` -- `rampId` -- partner order ID -- user/session ID -- SDK/client version -- environment: sandbox or production -- webhook ID, if used -- user-submitted tx hashes, if any -- ephemeral-backup reference - -Vortex should persist: - -- server-issued unsigned transaction plan -- accepted presigned primary transactions -- accepted backup/fallback transactions -- provider references, payout ticket IDs, and transaction hashes -- phase history and error logs -- final transaction hash / explorer link where available - -Never share in support channels: - -- `sk_*` API keys -- ephemeral private keys -- user wallet private keys -- raw environment dumps diff --git a/docs/architecture/per-user-eurc-cctp-settlement-contract.md b/docs/architecture/per-user-eurc-cctp-settlement-contract.md deleted file mode 100644 index 91191af15..000000000 --- a/docs/architecture/per-user-eurc-cctp-settlement-contract.md +++ /dev/null @@ -1,540 +0,0 @@ -# Per-User EURC Settlement Contract Feasibility Notes - -Last updated: 2026-06-25 - -This document summarizes the current design thinking for a per-user smart contract -that receives Circle EURC on Base, swaps it to Circle USDC, and sends the USDC to -the same user's predefined Ethereum wallet through Circle CCTP. - -It is intended as an implementation handoff for another AI agent. It is not legal -advice. - -## Executive Summary - -The flow is technically feasible: - -1. A partner or payer transfers EURC on Base to a per-user smart contract address. -2. Later, Vortex or any permitted caller invokes a contract function that sweeps - the current EURC balance. -3. The contract swaps EURC to USDC on Base through a DEX route. -4. The contract calls Circle CCTP V2 to burn the USDC on Base for minting on - Ethereum. -5. The final USDC is minted to the user's hardcoded Ethereum wallet address. - -The important architectural principle is to keep the custody-critical parts -immutable, especially the final recipient. Any flexibility should be limited to -the swap mechanism and protected by strong guardrails. - -## Core Requirements - -The per-user contract should: - -- Be deployed once per onboarded customer. -- Receive EURC on Base through a normal ERC-20 `transfer`. -- Hardcode the user's final Ethereum wallet address at deployment. -- Prevent any later change to the final recipient. -- Prevent admin withdrawal of EURC or USDC. -- Prevent arbitrary calls to external contracts. -- Swap the full available EURC balance, or an explicitly bounded amount. -- Bridge/burn the resulting USDC through CCTP V2 to Ethereum. -- Emit enough events for operations, reconciliation, and support. - -The partner-facing interpretation is: - -- The smart contract is a customer-specific technical settlement address. -- The sole permitted economic beneficiary is the same known customer. -- The contract cannot redirect funds to Vortex or another third party. -- Vortex may operate the automation, but the code should not require Vortex's - key for the funds to eventually move. - -## Current Circle/CCTP Facts To Verify Before Implementation - -Verified from Circle docs on 2026-06-25: - -- EURC exists on Base at `0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42`. -- USDC exists on Base at `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`. -- USDC exists on Ethereum at `0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`. -- CCTP V2 supports Base and Ethereum. -- Circle CCTP domain IDs are: - - Ethereum: `0` - - Base: `6` -- CCTP V2 supports USDC transfers across supported domains. -- CCTP V2 does not remove the need to swap EURC to USDC first for this flow. -- CCTP `depositForBurn` burns USDC on the source chain; minting on Ethereum - happens later after Circle attestation. - -Current mainnet CCTP V2 EVM addresses from Circle docs: - -- `TokenMessengerV2`: `0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d` -- `MessageTransmitterV2`: `0x81D40F21F12A8F0E3252Bccb954D722d4c464B64` - -Do not rely on this document alone at implementation time. Re-check Circle's -official contract address pages immediately before deployment. - -## Important Flow Detail - -A normal ERC-20 `transfer` to a smart contract does not automatically call the -receiving smart contract. The intended flow is therefore asynchronous: - -```text -Partner transfers EURC to per-user contract on Base -Later: - Vortex service, user, keeper, or any public caller calls sweep() - Contract swaps EURC -> USDC on Base - Contract calls CCTP depositForBurn(...) -Later: - Circle attests the burn - Ethereum-side mint is completed either directly or through a forwarding service -``` - -The source-chain Base transaction can perform the sweep, swap, and CCTP burn in -one transaction. It cannot complete the Ethereum-side mint in that same Base -transaction. - -## Recommended Contract Shape - -Recommended pattern: immutable per-user vault with a constrained swap adapter. - -Immutable constructor values: - -- `EURC_BASE` -- `USDC_BASE` -- `CCTP_TOKEN_MESSENGER_V2_BASE` -- `ETHEREUM_DESTINATION_DOMAIN = 0` -- `ETHEREUM_MINT_RECIPIENT` -- Optional: `DESTINATION_CALLER` - -Mutable value, if flexibility is required: - -- `swapAdapter` - -The main contract should retain control over all custody-critical logic. The -adapter should only be responsible for converting EURC to USDC and returning the -USDC to the main contract. - -Avoid this pattern: - -```solidity -function execute(address target, bytes calldata data) external onlyOwner; -``` - -An arbitrary execution function creates broad admin control over deposited funds -and weakens the argument that the contract is just a technical settlement -address for a known customer. - -## Sweep Function Sketch - -Conceptual flow: - -```text -function sweep(uint256 minUsdcOut, uint256 cctpMaxFee, uint32 minFinalityThreshold): - eurcAmount = EURC.balanceOf(this) - require(eurcAmount > 0) - - usdcBefore = USDC.balanceOf(this) - - approve EURC exactly eurcAmount to swapAdapter - call swapAdapter.swapExactEurcForUsdc(eurcAmount, minUsdcOut, this) - reset EURC approval to zero - - usdcAfter = USDC.balanceOf(this) - usdcReceived = usdcAfter - usdcBefore - require(usdcReceived >= minUsdcOut) - - approve USDC exactly usdcReceived to TokenMessengerV2 - call TokenMessengerV2.depositForBurn( - amount = usdcReceived, - destinationDomain = 0, - mintRecipient = bytes32(uint256(uint160(ETHEREUM_MINT_RECIPIENT))), - burnToken = USDC_BASE, - destinationCaller = DESTINATION_CALLER_OR_ZERO, - maxFee = cctpMaxFee, - minFinalityThreshold = minFinalityThreshold - ) - reset USDC approval to zero if needed - - emit SweptAndBurned(eurcAmount, usdcReceived, minUsdcOut, ...) -``` - -Implementation notes: - -- Use SafeERC20-style wrappers. -- Approve exact amounts, not unlimited allowances. -- Reset allowances after use where compatible. -- Add a non-reentrancy guard. -- Validate the swap adapter output by measuring USDC balance deltas. -- Consider supporting partial sweeps only if there is a clear operational need. -- Avoid handling native ETH unless needed for a specific DEX path. - -## Swap Adapter Design - -The swap adapter exists because DEX routes may change over time. It should be -constrained so that changing the adapter does not allow Vortex to redirect user -funds. - -Adapter expectations: - -- Input token must be Base EURC. -- Output token must be Base USDC. -- Output recipient must be the per-user settlement contract. -- The adapter must not retain EURC or USDC balances after a swap. -- The adapter should enforce a deadline and minimum output. - -Main contract checks: - -- Only transfer EURC to the adapter for the exact swap amount. -- Check the USDC balance before and after adapter execution. -- Revert if the USDC delta is below `minUsdcOut`. -- Do not allow the adapter to specify the CCTP recipient. - -Adapter update options: - -1. No mutability: redeploy a new per-user contract if the DEX route breaks. -2. Mutable `swapAdapter` controlled by multisig/timelock. -3. Mutable `swapAdapter` plus public delayed activation and event monitoring. - -Recommended compromise: - -- Use a mutable `swapAdapter`, but only with a narrow setter. -- Control it with a multisig. -- Prefer a timelock if partner/compliance posture matters. -- Emit `SwapAdapterUpdated(oldAdapter, newAdapter)`. -- Exclude any function that changes recipient, token addresses, CCTP contracts, - or destination domain. - -## Permissioning The Sweep - -Options: - -1. Permissionless `sweep` - - Anyone can trigger the swap and CCTP burn. - - Best for liveness and strongest non-custodial argument. - - Requires caller-provided `minUsdcOut`, or a robust onchain/offchain quote - mechanism to avoid bad execution. - -2. Service-only `sweep` - - Only Vortex automation can call the function. - - Easier operational control. - - Weaker custody posture because funds depend on Vortex action. - -3. Hybrid - - Service-only by default, but permissionless after a timeout. - - More complex, but may balance UX and liveness. - -Recommended starting point: - -- Prefer permissionless sweep if slippage protection can be made safe. -- Otherwise use service-only for the first version, but recognize the custody - and liveness implications. - -## Slippage, Pricing, And MEV - -The main market risk is the EURC -> USDC swap. - -The contract must not perform a swap without price protection. Without a -meaningful `minUsdcOut`, the sweep can be front-run or executed at a bad price. - -Possible controls: - -- Backend obtains a fresh DEX quote and passes `minUsdcOut`. -- Apply a strict slippage tolerance. -- Use a deadline. -- Consider a TWAP/oracle sanity check if the swap size is large. -- Emit quoted and actual amounts for monitoring. -- Consider maximum sweep size if pool liquidity is thin. - -Open implementation choice: - -- Select DEX route on Base: Uniswap, Aerodrome, or another venue. -- Decide whether to use a direct EURC/USDC pool or a multi-hop route. -- Decide whether to use an aggregator. Aggregators improve routing but often - require broader calldata/execution permissions, which may weaken the custody - story. - -## CCTP Direct Mint Vs Forwarding Service - -CCTP is a burn-and-mint protocol. After the Base burn, Ethereum minting happens -after Circle attests the burn. - -Direct mint: - -```text -Base contract calls depositForBurn -Backend polls Circle attestation -Backend or any caller submits receiveMessage(message, attestation) on Ethereum -USDC is minted to the user's Ethereum recipient -``` - -Pros: - -- Full control over destination submission. -- No forwarding-service dependency. -- No forwarding-service fee. - -Cons: - -- Requires Ethereum gas and relayer operations. -- Requires attestation polling, retries, and monitoring. - -Forwarding service: - -```text -Base burn is initiated with forwarding-supported flow -Circle or its forwarding infrastructure handles destination execution -USDC is minted to the user's Ethereum recipient -``` - -Pros: - -- Simpler operations. -- No Vortex Ethereum relayer wallet required for mint submission. - -Cons: - -- Forwarding fees may reduce received amount. -- Route/support details must be confirmed. -- More dependency on Circle's infrastructure. - -Recommended default: - -- Use forwarding if it is supported for Base -> Ethereum and works cleanly with - the chosen integration path. -- Use direct mint if exact operational control, lower fees, or custom retry - behavior is more important. - -## Custody And Partner-Licensing Posture - -The deployer is not automatically the custodian just because it deployed the -contract. The stronger question is who can access, redirect, freeze, upgrade -around, or otherwise control the funds while they are in the contract. - -Lower-control posture: - -- One contract per customer. -- Final Ethereum recipient hardcoded at deployment. -- Recipient cannot be changed. -- No admin withdrawal for EURC or USDC. -- No arbitrary execution. -- Sweep is permissionless, or at least not dependent forever on Vortex. -- Source code is verified. -- Partner can map the contract address to the same known customer. - -Higher-control posture: - -- Vortex can change the recipient. -- Vortex can withdraw EURC or USDC. -- Vortex can call arbitrary contracts with the user's token balances. -- Vortex can upgrade the whole vault implementation. -- Vortex is the only party able to move the funds onward. - -For the stablecoin partner, the key question is whether they can treat the smart -contract as a customer-specific technical receiving address. The best framing is: - -```text -The payout address is a deterministic, verified, customer-specific settlement -contract. The sole hardcoded destination is the KYC'd customer's wallet. The -contract has no admin withdrawal path and no recipient mutation. -``` - -Avoid informal custody phrasing. Use "the sole permitted economic beneficiary is -the same known customer" instead. - -## Per-User Contract Vs Reusing One Contract - -Per-user contract advantages: - -- Partner can map one static reference to one contract address. -- Contract can hardcode one final Ethereum recipient. -- Easier to explain as a customer-specific settlement address. -- Reduces risk that accounting or balances mix between users. - -Per-user contract disadvantages: - -- More deployments. -- More address management. -- Need to handle old contract addresses if users rotate final wallets. - -Shared contract advantages: - -- Fewer deployments. -- Centralized route updates. -- Easier contract operations. - -Shared contract disadvantages: - -- Requires internal user accounting. -- Requires mutable recipient mappings or deposit identifiers. -- Harder partner/compliance story. -- More severe blast radius if there is a bug. - -Recommendation: - -- Use one contract per customer for this flow. - -## Deployment And Address Management - -Use a factory if possible. A factory gives a repeatable deployment path, makes -verification easier, and can optionally support deterministic addresses through -`CREATE2`. - -Suggested deployment record per customer: - -- Customer/user ID in Vortex systems. -- Partner static payment reference. -- Per-user contract address on Base. -- Hardcoded Ethereum recipient. -- Constructor arguments. -- Contract implementation/version hash. -- Swap adapter configured at deployment. -- Source verification URL. - -If deterministic deployment is useful, derive the salt from stable internal data -that does not leak unnecessary personal information. For example, use a hash of -an internal customer ID plus environment/version data, not raw email addresses -or names. - -Once a customer contract address has been given to the partner, treat it as a -long-lived receiving address. If the user changes their final Ethereum wallet, -deploy a new per-user contract and coordinate a mapping update with the partner. -Do not make the old contract recipient mutable just to support address rotation. - -## Redeploying On DEX Changes - -If absolutely everything is immutable, any DEX or route break requires deploying -a new contract and giving the partner a new per-user address. - -This is clean from a control perspective but operationally risky: - -- Partner must update mappings. -- Users or partners may accidentally send to old addresses. -- Funds already sitting in the old contract may become stuck if the route breaks. - -Recommended compromise: - -- Keep recipient and CCTP behavior immutable. -- Make only the swap adapter replaceable. -- Make adapter replacement narrow, visible, and delayed where possible. - -## Events To Include - -Suggested events: - -```solidity -event SweptAndBurned( - address indexed caller, - uint256 eurcAmount, - uint256 usdcAmount, - uint256 minUsdcOut, - uint32 destinationDomain, - bytes32 mintRecipient, - uint64 cctpNonce -); - -event SwapAdapterUpdated(address indexed oldAdapter, address indexed newAdapter); -``` - -In practice, CCTP also emits `DepositForBurn` and `MessageSent`. The backend -should index those events to track burn nonces and attestation status. - -Do not rely on failure events for reverted transactions. Events emitted before a -revert are rolled back. Failed sweeps should be observed through transaction -receipts, RPC simulation, backend logs, and monitoring. - -## Key Failure Modes - -- No EURC balance: `sweep` should revert cheaply. -- Bad DEX quote or price movement: `sweep` should revert because - `minUsdcOut` is not met. -- DEX route unavailable: funds remain in the per-user contract until a working - route or adapter is available. -- CCTP burn fee or allowance issue: transaction reverts before funds leave the - contract as USDC. -- CCTP burn succeeds but destination mint is delayed: backend must track the - burn event and attestation state. -- Direct mint relayer lacks Ethereum gas: burn is complete, but mint submission - waits until a caller submits `receiveMessage`. -- Partner sends to an old contract: funds follow that old contract's hardcoded - recipient and route constraints; address rotation needs operational controls. - -## Backend Responsibilities - -The backend/automation service should: - -- Track deployed per-user contract addresses. -- Provide addresses to the partner for static-reference mapping. -- Monitor EURC balances on those contracts. -- Quote swaps and decide `minUsdcOut`. -- Call `sweep` when balances are available. -- Track DEX transaction, CCTP burn, attestation, and destination mint. -- Handle failed sweeps and retry safely. -- Reconcile final Ethereum receipt with the customer/ramp state. -- Alert if funds remain idle beyond expected time. - -For direct mint, the backend must also: - -- Poll Circle's attestation service. -- Submit `receiveMessage(message, attestation)` on Ethereum. -- Maintain ETH for gas, or use a relayer/paymaster setup. -- Retry destination mint submission until complete. - -## Testing Checklist - -Contract tests: - -- Can receive EURC via normal transfer. -- Sweep reverts when EURC balance is zero. -- Sweep swaps EURC to USDC and burns through CCTP with correct parameters. -- Recipient address cannot be changed. -- Owner/admin cannot withdraw EURC or USDC. -- Adapter cannot redirect output to itself or a third party. -- Sweep reverts when USDC received is below `minUsdcOut`. -- Sweep uses exact approvals. -- Reentrancy attempts fail. -- Adapter update emits event and respects access control/timelock. -- Wrong token, wrong recipient, or wrong output behavior fails. - -Fork/integration tests: - -- Base mainnet fork against selected DEX route. -- Base Sepolia/Ethereum Sepolia CCTP test flow if EURC liquidity/test route is - available. -- Direct mint end-to-end if using direct mint. -- Forwarding-service end-to-end if using forwarding. - -Operational tests: - -- Partner static reference maps to contract address. -- Backend detects deposits. -- Backend sweeps with current quote. -- Backend retries failed sweeps. -- Backend handles partial DEX liquidity or high slippage. -- Backend reconciles CCTP burn and Ethereum mint. - -## Open Questions - -- Which Base DEX or aggregator should be used for EURC -> USDC? -- Is there enough EURC/USDC liquidity on the chosen venue for expected ticket - sizes? -- Should `sweep` be permissionless, service-only, or hybrid? -- Should the swap adapter be mutable, and if yes, who controls it? -- Is a timelock acceptable operationally for adapter updates? -- Direct mint or forwarding service for the Ethereum mint step? -- What minimum finality threshold should be used for CCTP V2? -- What is the acceptable forwarding fee or CCTP fee behavior? -- Will the stablecoin partner approve transfers to verified per-user settlement - contracts? -- How will partner/customer records prove that a contract maps to the same known - customer and hardcoded Ethereum recipient? - -## Source Links - -- Circle CCTP supported chains and domains: - https://developers.circle.com/cctp/cctp-supported-blockchains -- Circle CCTP EVM contract interfaces: - https://developers.circle.com/cctp/references/contract-interfaces -- Circle CCTP EVM contract addresses: - https://developers.circle.com/cctp/references/contract-addresses -- Circle USDC contract addresses: - https://developers.circle.com/stablecoins/usdc-contract-addresses -- Circle EURC contract addresses: - https://developers.circle.com/stablecoins/eurc-contract-addresses diff --git a/docs/code-review-1161-sdk-changes.md b/docs/code-review-1161-sdk-changes.md deleted file mode 100644 index 9212ec66a..000000000 --- a/docs/code-review-1161-sdk-changes.md +++ /dev/null @@ -1,91 +0,0 @@ -# Code Review: Branch `1161-sdk-changes-for-alfredpay-currencies-support` - -Review run: 2026-06-23 — 47 agents, 37 candidates verified, 21 kept, 16 refuted. - ---- - -## Confirmed Bugs - -### 1. `parseAPIError` missing "User address must be provided" mapping -**`packages/sdk/src/errors.ts:437`** - -When a caller submits an Alfredpay offramp with a missing `walletAddress`, the API returns `"User address must be provided for offramping."`. `parseAPIError` only maps `"fiatAccountId is required for Alfredpay offramp"`, so the wallet-missing error falls through to a generic `VortexSdkError`. Callers checking `instanceof MissingAlfredpayOfframpParametersError` never match and cannot give a targeted error message. - -**Fix:** Add a second mapping for `"User address must be provided for offramping."` in `parseAPIError`. - ---- - -### 2. `MissingAlfredpayOfframpParametersError` constructor message mismatch -**`packages/sdk/src/errors.ts:437`** - -`parseAPIError` matches on `"fiatAccountId is required for Alfredpay offramp"` but the constructor hardcodes `"Parameters fiatAccountId and walletAddress are required for Alfredpay offramp"`. Any caller logging or pattern-matching on `error.message` after catching sees the wrong text. - -**Fix:** Make the constructor accept an optional message so `parseAPIError` can forward the original API message. - ---- - -### 3. `submitUserTransactions` throws unrecoverably for unsupported tx types -**`packages/sdk/src/VortexSdk.ts:274`** - -If the API returns a user transaction the SDK classifies as `"unsupported"` (e.g. a raw Substrate hex string), `submitUserTransactions` throws `"Unsupported user transaction"` and aborts the entire loop. The ramp stalls with no recovery path short of calling `submitUserSignature` / `submitUserTxHash` directly. - -**Fix:** Add an optional `handleUnsupported` callback to `SubmitUserTransactionsHandlers`; call it when the type is unsupported. Throw if no handler is provided (consistent with `signTypedData`/`sendTransaction` guards). - ---- - -### 4. `submitUserSignature` has no guard on tx type — opaque internal error -**`packages/sdk/src/VortexSdk.ts:185`** - -Passing an `evm-transaction` typed tx to `submitUserSignature` instead of `submitUserTxHash` throws `'attachSignatures: phase X has no typed-data payloads to sign'` from deep inside `eip712.ts` rather than a clear API-boundary error. The ramp is left started-but-unsigned. - -**Fix:** Add a type check at the top of `submitUserSignature` and throw a clear pre-condition error. - ---- - -### 5. Rolling-deploy alert noise: `snapshotPreSettlementBalance` idempotency with old ramps -**`apps/api/src/api/services/phases/handlers/squid-router-phase-handler.ts:40`** - -Ramps started under the old deployment have `preSettlementBalance` written post-swap. When the new deployment picks them up, the idempotency guard skips re-snapshotting (correct). The subsidy handler then computes `delivered ≈ 0`, the clamp fires, and a warn log is emitted. **No funds are lost** — the clamp protects correctly — but expect alert noise during a rolling deploy. No code change needed; operator awareness is sufficient. - ---- - -## Confirmed Code-Quality Issues - -### 6. `isTypedDataItem` duplicates `isSignedTypedData` from `@vortexfi/shared` -**`packages/sdk/src/eip712.ts:24`** - -Character-for-character copy of `isSignedTypedData` already exported from shared. The shared import is present on line 3. Two copies means a future shape change to `SignedTypedData` must be applied in both places or the SDK filter will silently miss payloads. - -**Fix:** Remove `isTypedDataItem`; inline `isSignedTypedData` with a cast at the single call site in `typedDataToSign`. - ---- - -### 7. Copy-pasted 16-line post-register block in `AlfredpayHandler` -**`packages/sdk/src/handlers/AlfredpayHandler.ts:62`** - -`registerAlfredpayOnramp` and `registerAlfredpayOfframp` share an identical `storeEphemerals → signTransactions → build updateRequest → updateRamp` block. The same pattern exists in `BrlHandler`. A change to that block (error handling, new field) must be applied to all copies or behaviour diverges. - -**Status:** Noted; not fixed in this pass to keep changes surgical. - ---- - -### 8. `updateAlfredpayOfframp` body is identical to `BrlHandler.updateBrlOfframp` -**`packages/sdk/src/handlers/AlfredpayHandler.ts:128`** - -Both check `currentPhase === 'initial'`, build `UpdateRampRequest` with the same three hash fields, and call `updateRamp`. The phase-guard wording already diverges slightly. A new hash field added to `OfframpUpdateAdditionalData` must be reflected in both methods. - -**Status:** Noted; not fixed in this pass to keep changes surgical. - ---- - -## Plausible (not confirmed) - -### 9. `startRamp` always delegates to `brlHandler.startBrlRamp` for all ramp types -**`packages/sdk/src/VortexSdk.ts:176`** - -Works today (same API endpoint), but if `BrlHandler.startBrlRamp` ever gains BRL-specific pre-flight logic, Alfredpay ramps will incorrectly execute it. - -### 10. `AlfredpayHandler` duplicates `BrlHandler`'s constructor and private fields verbatim -**`packages/sdk/src/handlers/AlfredpayHandler.ts:21`** - -Four private field declarations + constructor body copied exactly. Adding a new dependency means updating both constructors and both wiring sites in `VortexSdk.ts`. From 0b44599d98987d3cd51f139c1915c50bbd1b2b00 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 11:42:37 +0200 Subject: [PATCH 141/176] Extend the fake world for swap-corridor scenarios FakeBrla serves payout tickets with a scriptable status, FakeEvm answers eth_call dry-runs, and FakePrices knows BRLA and MATIC (pegged to the existing BRL and polygon-ecosystem-token rates). --- apps/api/src/test-utils/fake-world/fake-anchors.ts | 6 ++++++ apps/api/src/test-utils/fake-world/fake-evm.ts | 2 ++ apps/api/src/test-utils/fake-world/fake-prices.ts | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/apps/api/src/test-utils/fake-world/fake-anchors.ts b/apps/api/src/test-utils/fake-world/fake-anchors.ts index d0580923b..1b663c31f 100644 --- a/apps/api/src/test-utils/fake-world/fake-anchors.ts +++ b/apps/api/src/test-utils/fake-world/fake-anchors.ts @@ -125,6 +125,8 @@ export class FakeBrla { accountBalances = { BRLA: 0, USDC: 0, USDM: 0, USDT: 0 }; /** Status reported for every pay-in ticket by getAveniaPayinTickets. */ payinTicketStatus: AveniaTicketStatus = AveniaTicketStatus.PAID; + /** Status reported for every payout ticket by getAveniaPayoutTicket. */ + payoutTicketStatus: AveniaTicketStatus = AveniaTicketStatus.PAID; /** Called after createPixOutputTicket succeeds; use it to apply the on-chain mint effect. */ onPixOutputTicket?: (ticket: { id: string; walletAddress?: string }) => void; readonly pixInputTickets: Array<{ id: string; brCode: string }> = []; @@ -167,6 +169,10 @@ export class FakeBrla { }, getAccountBalance: async () => ({ balances: { ...this.accountBalances } }), getAveniaPayinTickets: async () => this.pixInputTickets.map(ticket => ({ id: ticket.id, status: this.payinTicketStatus })), + getAveniaPayoutTicket: async (ticketId: string) => ({ + id: ticketId, + status: this.payoutTicketStatus + }), getSubaccountUsedLimit: async () => ({ limitInfo: { blocked: false, diff --git a/apps/api/src/test-utils/fake-world/fake-evm.ts b/apps/api/src/test-utils/fake-world/fake-evm.ts index bdf47ff72..a4733824b 100644 --- a/apps/api/src/test-utils/fake-world/fake-evm.ts +++ b/apps/api/src/test-utils/fake-world/fake-evm.ts @@ -156,6 +156,8 @@ export class FakeEvm { }; return this.makeUnimplementedProxy( { + // Dry-runs (eth_call) succeed generically; scripted failures go through failNextSends instead. + call: async () => ({ data: "0x" as `0x${string}` }), chain: { id: CHAIN_IDS[network] ?? 0, name: network, nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" } }, estimateFeesPerGas: async () => ({ maxFeePerGas: 1_000_000_000n, maxPriorityFeePerGas: 1_000_000_000n }), estimateGas: async () => 21_000n, diff --git a/apps/api/src/test-utils/fake-world/fake-prices.ts b/apps/api/src/test-utils/fake-world/fake-prices.ts index 299e69bc9..3825b5fba 100644 --- a/apps/api/src/test-utils/fake-world/fake-prices.ts +++ b/apps/api/src/test-utils/fake-world/fake-prices.ts @@ -19,8 +19,12 @@ export class FakePrices { perUsd: Record = { ars: 1000, brl: 5, + // BRLA is the on-chain twin of BRL and shares its peg. + brla: 5, cop: 4000, eur: 0.9, + // Consistent with cryptoUsd["polygon-ecosystem-token"] = 0.5. + matic: 2, mxn: 17, usd: 1, usdc: 1, From 39e53fd70b97df9ba5421fb814914c51dcb23f3f Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 11:42:49 +0200 Subject: [PATCH 142/176] Add BRL offramp corridor scenario with real Nabla swap and subsidy caps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit USDC on Base → pix via Avenia through the real PhaseProcessor: fundEphemeral → distributeFees → subsidizePreSwap → nablaApprove → nablaSwap → subsidizePostSwap → brlaPayoutOnBase. Unlike the direct corridors, the swap and both EVM subsidy phases execute for real, so the pre- and post-swap subsidy caps (F-001 class) are breach-tested end to end: the ramp pauses recoverably and nothing is broadcast. Also covers transient-outage recovery, a tampered payout presign rejected by /v1/ramp/update, and a FAILED Avenia payout ticket. --- .../corridors/brl-offramp.scenario.test.ts | 530 ++++++++++++++++++ 1 file changed, 530 insertions(+) create mode 100644 apps/api/src/tests/corridors/brl-offramp.scenario.test.ts diff --git a/apps/api/src/tests/corridors/brl-offramp.scenario.test.ts b/apps/api/src/tests/corridors/brl-offramp.scenario.test.ts new file mode 100644 index 000000000..1d456832e --- /dev/null +++ b/apps/api/src/tests/corridors/brl-offramp.scenario.test.ts @@ -0,0 +1,530 @@ +import { afterAll, beforeAll, beforeEach, describe, expect, it } from "bun:test"; +import { Keyring } from "@polkadot/api"; +import { cryptoWaitReady, mnemonicGenerate } from "@polkadot/util-crypto"; +import { + AveniaTicketStatus, + EvmToken, + evmTokenConfig, + FiatToken, + Networks, + RampDirection, + type RampPhase, + type UnsignedTx +} from "@vortexfi/shared"; +import { decodeFunctionData, encodeFunctionData, erc20Abi, parseTransaction, parseUnits } from "viem"; +import { generatePrivateKey, privateKeyToAccount, type PrivateKeyAccount } from "viem/accounts"; +import phaseProcessor from "../../api/services/phases/phase-processor"; +import QuoteTicket from "../../models/quoteTicket.model"; +import RampState from "../../models/rampState.model"; +import Subsidy from "../../models/subsidy.model"; +import Partner from "../../models/partner.model"; +import type { SubsidyToken } from "../../models/subsidy.model"; +import { resetTestDatabase, setupTestDatabase } from "../../test-utils/db"; +import { createTestTaxId, createTestUser } from "../../test-utils/factories"; +import { type FakeWorld, installFakeWorld } from "../../test-utils/fake-world"; +import { installFakeSupabaseAuth, testUserToken } from "../../test-utils/fake-world/fake-auth"; +import { startTestApp, type TestApp } from "../../test-utils/test-app"; + +function requireBaseToken(token: EvmToken) { + const details = evmTokenConfig[Networks.Base][token]; + if (!details) { + throw new Error(`${token} token config missing for Base`); + } + return details; +} +const USDC_ON_BASE = requireBaseToken(EvmToken.USDC).erc20AddressSourceChain as `0x${string}`; +const BRLA_ON_BASE = requireBaseToken(EvmToken.BRLA).erc20AddressSourceChain as `0x${string}`; + +const TAX_ID = "12345678901"; +// FakeBrla.validatePixKey reports this as the pix key owner's tax id; the +// registration-time receiver check must be given a matching value. +const RECEIVER_TAX_ID = "12345678900"; +const PIX_KEY = "test-pix-key"; + +const HAPPY_PATH_PHASES: RampPhase[] = [ + "initial", + "fundEphemeral", + "distributeFees", + "subsidizePreSwap", + "nablaApprove", + "nablaSwap", + "subsidizePostSwap", + "brlaPayoutOnBase", + "complete" +]; + +interface CorridorSetup { + rampId: string; + quoteId: string; + /** Raw (6-decimal) USDC amount the Nabla swap consumes. */ + swapInputRaw: bigint; + /** Raw (18-decimal) BRLA amount the swap yields and the payout transfers. */ + swapOutputRaw: bigint; + signedNablaSwap: `0x${string}`; + signedPayout: `0x${string}`; + ephemeral: PrivateKeyAccount; + payoutBlueprint: UnsignedTx; +} + +/** + * Corridor scenario tests for the BRL offramp swap path (USDC on Base → pix + * via Avenia): quote and registration go through the real HTTP API, then the + * REAL PhaseProcessor drives initial → fundEphemeral → distributeFees → + * subsidizePreSwap → nablaApprove → nablaSwap → subsidizePostSwap → + * brlaPayoutOnBase → complete against the fake external world. Unlike the + * direct corridors, the Nabla swap and both EVM subsidy phases execute for + * real here, so the subsidy caps (F-001 class) are covered end to end. + */ +describe("BRL offramp swap corridor (USDC on Base → pix via Avenia)", () => { + let world: FakeWorld; + let auth: { restore: () => void }; + let app: TestApp; + + beforeAll(async () => { + world = installFakeWorld(); + auth = installFakeSupabaseAuth(); + await setupTestDatabase(); + app = await startTestApp(); + }); + + afterAll(async () => { + await app?.close(); + auth?.restore(); + world?.restore(); + }); + + beforeEach(async () => { + await resetTestDatabase(); + // The EVM fee distribution transaction builder requires the vortex + // partner's EVM payout address even when the resulting fees are zero. + await Partner.update( + { payoutAddressEvm: "0x000000000000000000000000000000000000fee5" }, + { where: { name: "vortex", rampType: RampDirection.SELL } } + ); + world.evm.failNextSends = 0; + world.evm.onTransaction = undefined; + world.brla.onPixOutputTicket = undefined; + world.brla.accountBalances = { BRLA: 1_000_000, USDC: 0, USDM: 0, USDT: 0 }; + world.brla.payoutTicketStatus = AveniaTicketStatus.PAID; + // Fresh subaccount wallet per test: the in-memory EVM ledger persists + // across tests, so a shared payout recipient would accumulate balances. + world.brla.subaccountEvmWallet = privateKeyToAccount(generatePrivateKey()).address.toLowerCase(); + // The initialize stage bridges Base USDC → Base USDC: the fake route's + // destination token must report USDC's 6 decimals or the quote pipeline + // mis-scales the swap input and pads the whole output with subsidy. + world.squidRouter.toTokenDecimals = 6; + // Deterministic Nabla quoter for USDC (6 decimals) → BRLA (18 decimals) + // at a flat 5 BRLA per USDC, matching the FakePrices 5 BRL/USD feed. + world.evm.onReadContract = (_network, params) => { + if (params.functionName === "quoteSwapExactTokensForTokens") { + const amountIn = params.args?.[0] as bigint; + return amountIn * 5n * 10n ** 12n; + } + return undefined; + }; + }); + + async function createQuoteViaApi(): Promise<{ id: string; outputAmount: string }> { + const response = await app.request("/v1/quotes", { + body: JSON.stringify({ + from: Networks.Base, + inputAmount: "100", + inputCurrency: EvmToken.USDC, + network: Networks.Base, + outputCurrency: FiatToken.BRL, + rampType: RampDirection.SELL, + to: "pix" + }), + headers: { "Content-Type": "application/json" }, + method: "POST" + }); + expect(response.status).toBe(201); + return (await response.json()) as { id: string; outputAmount: string }; + } + + // The EVM→BRL route still requires a Substrate ephemeral in signingAccounts + // (validateOfframpQuote legacy default) even though this path never uses it. + async function createSubstrateEphemeralAddress(): Promise { + await cryptoWaitReady(); + const keyring = new Keyring({ type: "sr25519" }); + return keyring.addFromUri(mnemonicGenerate()).address; + } + + async function registerViaApi( + quoteId: string, + userId: string, + ephemeral: PrivateKeyAccount, + userWallet: PrivateKeyAccount + ): Promise<{ id: string }> { + const response = await app.request("/v1/ramp/register", { + body: JSON.stringify({ + additionalData: { + pixDestination: PIX_KEY, + receiverTaxId: RECEIVER_TAX_ID, + taxId: TAX_ID, + walletAddress: userWallet.address + }, + quoteId, + signingAccounts: [ + { address: ephemeral.address, type: "EVM" }, + { address: await createSubstrateEphemeralAddress(), type: "Substrate" } + ] + }), + headers: { + Authorization: `Bearer ${testUserToken(userId)}`, + "Content-Type": "application/json" + }, + method: "POST" + }); + expect(response.status).toBe(201); + return (await response.json()) as { id: string }; + } + + function blueprintOf(unsignedTxs: UnsignedTx[], phase: RampPhase): UnsignedTx { + const blueprint = unsignedTxs.find(tx => tx.phase === phase); + expect(blueprint, `missing ${phase} blueprint in persisted ramp state`).toBeDefined(); + return blueprint as UnsignedTx; + } + + async function signBlueprint(ephemeral: PrivateKeyAccount, blueprint: UnsignedTx, nonce?: number): Promise<`0x${string}`> { + const txData = blueprint.txData as unknown as { to: `0x${string}`; data: `0x${string}`; value?: string }; + return ephemeral.signTransaction({ + chainId: 8453, + data: txData.data, + gas: 600_000n, + maxFeePerGas: 5_000_000_000n, + maxPriorityFeePerGas: 5_000_000_000n, + nonce: nonce ?? blueprint.nonce, + to: txData.to, + type: "eip1559", + value: BigInt(txData.value ?? "0") + }); + } + + /** + * Creates quote + registration through the HTTP API with a fresh ephemeral, + * signs the ephemeral phase blueprints exactly as issued, and stores them as + * presigned transactions the way /v1/ramp/update would. + */ + async function setUpRegisteredRamp(): Promise { + const ephemeral = privateKeyToAccount(generatePrivateKey()); + const userWallet = privateKeyToAccount(generatePrivateKey()); + + const user = await createTestUser(); + await createTestTaxId(user.id, { taxId: TAX_ID }); + const quote = await createQuoteViaApi(); + const ramp = await registerViaApi(quote.id, user.id, ephemeral, userWallet); + + const persistedQuote = await QuoteTicket.findByPk(quote.id); + const swapInputRaw = BigInt(persistedQuote?.metadata.nablaSwapEvm?.inputAmountForSwapRaw ?? "0"); + const swapOutputRaw = BigInt(persistedQuote?.metadata.nablaSwapEvm?.outputAmountRaw ?? "0"); + expect(swapInputRaw).toBeGreaterThan(0n); + expect(swapOutputRaw).toBeGreaterThan(0n); + + const rampState = await RampState.findByPk(ramp.id); + if (!rampState) { + throw new Error("Ramp state not found after registration"); + } + const unsignedTxs = rampState.unsignedTxs ?? []; + + const nablaApproveBlueprint = blueprintOf(unsignedTxs, "nablaApprove"); + const nablaSwapBlueprint = blueprintOf(unsignedTxs, "nablaSwap"); + const payoutBlueprint = blueprintOf(unsignedTxs, "brlaPayoutOnBase"); + + const signedNablaApprove = await signBlueprint(ephemeral, nablaApproveBlueprint); + const signedNablaSwap = await signBlueprint(ephemeral, nablaSwapBlueprint); + const signedPayout = await signBlueprint(ephemeral, payoutBlueprint); + + const presign = (blueprint: UnsignedTx, txData: `0x${string}`) => ({ + meta: {}, + network: blueprint.network, + nonce: blueprint.nonce, + phase: blueprint.phase, + signer: ephemeral.address, + txData + }); + + // The user broadcasts the source-of-funds USDC transfer from their own + // wallet; fundEphemeral verifies the reported hash against the blueprint. + const userBlueprint = blueprintOf(unsignedTxs, "squidRouterNoPermitTransfer"); + const userTxData = userBlueprint.txData as unknown as { to: `0x${string}`; data: `0x${string}` }; + const userTxHash = world.evm.broadcastUserTransaction(Networks.Base, userWallet.address, { + data: userTxData.data, + to: userTxData.to, + value: 0n + }); + + await rampState.update({ + presignedTxs: [ + presign(nablaApproveBlueprint, signedNablaApprove), + presign(nablaSwapBlueprint, signedNablaSwap), + presign(payoutBlueprint, signedPayout) + ], + state: { ...rampState.state, squidRouterNoPermitTransferHash: userTxHash } + }); + + return { + ephemeral, + payoutBlueprint, + quoteId: quote.id, + rampId: ramp.id, + signedNablaSwap, + signedPayout, + swapInputRaw, + swapOutputRaw + }; + } + + /** + * Scripts the fake world for the happy path: + * - the ephemeral has Base gas and the user's USDC already arrived, short by + * `usdcShortfallRaw` so subsidizePreSwap tops it up from the funding wallet, + * - raw ERC-20 transfers (serialized presigns and funding-wallet data txs) + * are applied to the in-memory ledger, + * - the broadcast Nabla swap credits the ephemeral's BRLA at the quoted output. + */ + function scriptHappyWorld(setup: CorridorSetup, options: { usdcShortfallRaw?: bigint; swapOutputRaw?: bigint } = {}): void { + const shortfall = options.usdcShortfallRaw ?? 0n; + const swapOutput = options.swapOutputRaw ?? setup.swapOutputRaw; + world.evm.setNativeBalance(Networks.Base, setup.ephemeral.address, parseUnits("2", 18)); + world.evm.setErc20Balance(Networks.Base, USDC_ON_BASE, setup.ephemeral.address, setup.swapInputRaw - shortfall); + world.evm.onTransaction = tx => { + if (tx.serialized === setup.signedNablaSwap) { + world.evm.setErc20Balance(Networks.Base, BRLA_ON_BASE, setup.ephemeral.address, swapOutput); + return; + } + const parsed = tx.serialized ? parseTransaction(tx.serialized as `0x${string}`) : { data: tx.data, to: tx.to }; + if (!parsed.to || !parsed.data) { + return; + } + let decoded: { functionName: string; args: readonly unknown[] }; + try { + decoded = decodeFunctionData({ abi: erc20Abi, data: parsed.data as `0x${string}` }); + } catch { + return; + } + if (decoded.functionName !== "transfer") { + return; + } + const [recipient, amount] = decoded.args as [`0x${string}`, bigint]; + world.evm.setErc20Balance( + tx.network, + parsed.to, + recipient, + world.evm.erc20Balance(tx.network, parsed.to, recipient) + amount + ); + }; + } + + function submissionsOf(signedTransfer: `0x${string}`): number { + return world.evm.sentTransactions.filter(tx => tx.serialized === signedTransfer).length; + } + + it( + "happy path: swap corridor completes with a capped pre-swap subsidy and pays the Avenia subaccount", + async () => { + const setup = await setUpRegisteredRamp(); + // 1 USDC short of the swap input: well below the 5% subsidy cap. + const shortfall = parseUnits("1", 6); + scriptHappyWorld(setup, { usdcShortfallRaw: shortfall }); + const pixOutBefore = world.brla.pixOutputTickets.length; + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("complete"); + expect(final?.phaseHistory.map(entry => entry.phase)).toEqual(HAPPY_PATH_PHASES); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + + // Quote stays consumed and the pre-swap shortfall was subsidized once. + const quote = await QuoteTicket.findByPk(setup.quoteId); + expect(quote?.status).toBe("consumed"); + const subsidies = await Subsidy.findAll(); + expect(subsidies.length).toBe(1); + // The handler stores the EvmToken value cast into the SubsidyToken column. + expect(subsidies[0].token).toBe(EvmToken.USDC as unknown as SubsidyToken); + expect(Number(subsidies[0].amount)).toBeCloseTo(1); + expect(subsidies[0].phase).toBe("subsidizePreSwap"); + + // The swap and payout were each broadcast exactly once; the Avenia + // subaccount wallet received exactly the swap output per the fake ledger. + expect(submissionsOf(setup.signedNablaSwap)).toBe(1); + expect(submissionsOf(setup.signedPayout)).toBe(1); + expect(world.evm.erc20Balance(Networks.Base, BRLA_ON_BASE, world.brla.subaccountEvmWallet)).toBe(setup.swapOutputRaw); + expect(world.brla.pixOutputTickets.length).toBe(pixOutBefore + 1); + }, + 30000 + ); + + it( + "transient failure: a scripted RPC outage is recorded as recoverable and the corridor still completes", + async () => { + const setup = await setUpRegisteredRamp(); + scriptHappyWorld(setup); + // Arm the outage once the swap has landed so it hits the NEXT broadcast — + // the brlaPayoutOnBase transfer, whose send failures are recoverable by + // design (a failed nablaSwap broadcast is deliberately unrecoverable). + const applyLedgerEffects = world.evm.onTransaction; + world.evm.sendFailureMessage = "FakeEvm: scripted RPC outage"; + world.evm.onTransaction = tx => { + applyLedgerEffects?.(tx); + if (tx.serialized === setup.signedNablaSwap) { + world.evm.failNextSends = 1; + } + }; + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("complete"); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + // The payout handler wraps broadcast errors in its own recoverable message. + const outageLogs = final?.errorLogs.filter(log => log.error.includes("Failed to send BRLA payout transaction")) ?? []; + expect(outageLogs.length).toBeGreaterThanOrEqual(1); + expect(outageLogs.every(log => log.phase === "brlaPayoutOnBase")).toBe(true); + expect(outageLogs.some(log => log.recoverable === true)).toBe(true); + expect(world.evm.erc20Balance(Networks.Base, BRLA_ON_BASE, world.brla.subaccountEvmWallet)).toBe(setup.swapOutputRaw); + }, + 30000 + ); + + it( + "security regression: a presigned payout paying the wrong recipient is rejected by /v1/ramp/update", + async () => { + const ephemeral = privateKeyToAccount(generatePrivateKey()); + const userWallet = privateKeyToAccount(generatePrivateKey()); + const attacker = privateKeyToAccount(generatePrivateKey()).address; + + const user = await createTestUser(); + await createTestTaxId(user.id, { taxId: TAX_ID }); + const quote = await createQuoteViaApi(); + const ramp = await registerViaApi(quote.id, user.id, ephemeral, userWallet); + + const rampState = await RampState.findByPk(ramp.id); + const payoutBlueprint = blueprintOf(rampState?.unsignedTxs ?? [], "brlaPayoutOnBase"); + const blueprintData = payoutBlueprint.txData as unknown as { to: `0x${string}`; data: `0x${string}` }; + const { args } = decodeFunctionData({ abi: erc20Abi, data: blueprintData.data }); + const amount = (args as [string, bigint])[1]; + + // Same token, same amount — but the BRLA goes to the attacker instead of + // the Avenia subaccount wallet the blueprint demands. + const tamper = (nonce: number) => + ephemeral.signTransaction({ + chainId: 8453, + data: encodeFunctionData({ abi: erc20Abi, args: [attacker, amount], functionName: "transfer" }), + gas: 600_000n, + maxFeePerGas: 5_000_000_000n, + maxPriorityFeePerGas: 5_000_000_000n, + nonce, + to: blueprintData.to, + type: "eip1559" + }); + const tamperedPayout = await tamper(payoutBlueprint.nonce); + const backups: Record = {}; + for (let i = 1; i <= 4; i++) { + backups[`backup${i}`] = { nonce: payoutBlueprint.nonce + i, txData: await tamper(payoutBlueprint.nonce + i) }; + } + + const updateResponse = await app.request("/v1/ramp/update", { + body: JSON.stringify({ + presignedTxs: [ + { + meta: { additionalTxs: backups }, + network: Networks.Base, + nonce: payoutBlueprint.nonce, + phase: "brlaPayoutOnBase", + signer: ephemeral.address, + txData: tamperedPayout + } + ], + rampId: ramp.id + }), + headers: { + Authorization: `Bearer ${testUserToken(user.id)}`, + "Content-Type": "application/json" + }, + method: "POST" + }); + + expect(updateResponse.status).toBe(400); + const body = (await updateResponse.json()) as { message?: string }; + expect(body.message ?? JSON.stringify(body)).toContain("does not match expected data"); + + // Nothing was stored and nothing can be broadcast. + const after = await RampState.findByPk(ramp.id); + expect(after?.presignedTxs ?? []).toEqual([]); + expect(submissionsOf(tamperedPayout)).toBe(0); + }, + 30000 + ); + + it( + "subsidy cap (F-001 class): a post-swap shortfall beyond the cap pauses the ramp instead of paying out", + async () => { + const setup = await setUpRegisteredRamp(); + // The swap yields only half the quoted BRLA: the discrepancy subsidy + // would be ~50% of the quote output, far beyond the 5% cap. + scriptHappyWorld(setup, { swapOutputRaw: setup.swapOutputRaw / 2n }); + + await phaseProcessor.processRamp(setup.rampId); + + const stuck = await RampState.findByPk(setup.rampId); + // The cap breach is a recoverable pause for operator intervention — the + // ramp must NOT be failed, NOT completed, and the lock must be released. + expect(stuck?.currentPhase).toBe("subsidizePostSwap"); + expect(stuck?.processingLock).toEqual({ locked: false, lockedAt: null }); + const capLogs = stuck?.errorLogs.filter(log => log.error.includes("exceeds cap")) ?? []; + expect(capLogs.length).toBeGreaterThanOrEqual(1); + expect(capLogs.every(log => log.recoverable === true)).toBe(true); + + // No subsidy was paid beyond the cap and the payout never reached the chain. + expect(await Subsidy.count()).toBe(0); + expect(submissionsOf(setup.signedPayout)).toBe(0); + expect(world.evm.erc20Balance(Networks.Base, BRLA_ON_BASE, world.brla.subaccountEvmWallet)).toBe(0n); + }, + 60000 + ); + + it( + "subsidy cap (F-001 class): a pre-swap shortfall beyond the cap pauses the ramp before the swap", + async () => { + const setup = await setUpRegisteredRamp(); + // Only half the swap input arrived: the required top-up (~50% of the + // quote output) is far beyond the 5% pre-swap subsidy cap. + scriptHappyWorld(setup, { usdcShortfallRaw: setup.swapInputRaw / 2n }); + + await phaseProcessor.processRamp(setup.rampId); + + const stuck = await RampState.findByPk(setup.rampId); + expect(stuck?.currentPhase).toBe("subsidizePreSwap"); + expect(stuck?.processingLock).toEqual({ locked: false, lockedAt: null }); + const capLogs = stuck?.errorLogs.filter(log => log.error.includes("exceeds cap")) ?? []; + expect(capLogs.length).toBeGreaterThanOrEqual(1); + expect(capLogs.every(log => log.recoverable === true)).toBe(true); + + // Nothing was subsidized, swapped, or paid out. + expect(await Subsidy.count()).toBe(0); + expect(submissionsOf(setup.signedNablaSwap)).toBe(0); + expect(submissionsOf(setup.signedPayout)).toBe(0); + expect(world.evm.erc20Balance(Networks.Base, BRLA_ON_BASE, world.brla.subaccountEvmWallet)).toBe(0n); + }, + 60000 + ); + + it( + "unrecoverable failure: a FAILED Avenia payout ticket fails the ramp during brlaPayoutOnBase", + async () => { + const setup = await setUpRegisteredRamp(); + scriptHappyWorld(setup); + world.brla.payoutTicketStatus = AveniaTicketStatus.FAILED; + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("failed"); + expect(final?.phaseHistory.map(entry => entry.phase)).not.toContain("complete"); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + }, + 30000 + ); +}); From fefb327bc1e789b0f733626632aff2a4f26e43fb Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 11:43:06 +0200 Subject: [PATCH 143/176] Cover the USD/COP/ARS Alfredpay corridors and the F-001 settlement cap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A parameterized happy-path matrix runs both directions for USD (ach), COP (ach) and ARS (cbu) over the same rails as the MXN scenarios, protecting the per-currency configuration: limits, rails, KYC country gating, and the fiat↔Alfredpay currency mapping. The MXN offramp gains the literal F-001 test: a settlement shortfall whose native-gas subsidy would exceed MAX_FINAL_SETTLEMENT_SUBSIDY_USD fails the ramp instead of paying out. --- .../alfredpay-currencies.scenario.test.ts | 396 ++++++++++++++++++ .../corridors/mxn-offramp.scenario.test.ts | 33 ++ 2 files changed, 429 insertions(+) create mode 100644 apps/api/src/tests/corridors/alfredpay-currencies.scenario.test.ts diff --git a/apps/api/src/tests/corridors/alfredpay-currencies.scenario.test.ts b/apps/api/src/tests/corridors/alfredpay-currencies.scenario.test.ts new file mode 100644 index 000000000..c0cc44493 --- /dev/null +++ b/apps/api/src/tests/corridors/alfredpay-currencies.scenario.test.ts @@ -0,0 +1,396 @@ +import { afterAll, beforeAll, beforeEach, describe, expect, it } from "bun:test"; +import { + ALFREDPAY_ERC20_DECIMALS, + ALFREDPAY_ERC20_TOKEN, + AlfredPayCountry, + AlfredpayOfframpStatus, + AlfredpayOnrampStatus, + EvmToken, + FiatToken, + Networks, + RampDirection, + type RampPhase, + type UnsignedTx +} from "@vortexfi/shared"; +import { BaseError, ContractFunctionExecutionError, decodeFunctionData, encodeFunctionData, erc20Abi, parseTransaction } from "viem"; +import { generatePrivateKey, privateKeyToAccount, type PrivateKeyAccount } from "viem/accounts"; +import { parseUnits } from "viem/utils"; +import phaseProcessor from "../../api/services/phases/phase-processor"; +import QuoteTicket from "../../models/quoteTicket.model"; +import RampState from "../../models/rampState.model"; +import { resetTestDatabase, setupTestDatabase } from "../../test-utils/db"; +import { createTestAlfredpayCustomer, createTestUser } from "../../test-utils/factories"; +import { type FakeWorld, installFakeWorld } from "../../test-utils/fake-world"; +import { installFakeSupabaseAuth, testUserToken } from "../../test-utils/fake-world/fake-auth"; +import { startTestApp, type TestApp } from "../../test-utils/test-app"; + +const ONRAMP_PHASES: RampPhase[] = [ + "initial", + "alfredpayOnrampMint", + "fundEphemeral", + "subsidizePreSwap", + "squidRouterSwap", + "finalSettlementSubsidy", + "destinationTransfer", + "complete" +]; + +const OFFRAMP_PHASES: RampPhase[] = [ + "initial", + "squidRouterPermitExecute", + "fundEphemeral", + "finalSettlementSubsidy", + "alfredpayOfframpTransfer", + "complete" +]; + +interface CurrencyCase { + fiat: FiatToken; + /** Alfredpay-side currency code expected on created orders. */ + alfredpayCurrency: string; + /** KYC country the registration guard requires a completed profile for. */ + country: AlfredPayCountry; + /** Quote destination string (payment rail). */ + rail: string; + /** Fiat amount for the BUY quote (within the per-currency limits). */ + onrampInputAmount: string; + /** USDT the anchor mints per unit of fiat. */ + onrampRate: number; + /** USDT amount for the SELL quote (within the per-currency limits). */ + offrampInputAmount: string; + /** Fiat the anchor pays out per USDT. */ + offrampRate: number; +} + +// Rates mirror the FakePrices per-USD feeds so quote pricing stays sane. +const CURRENCY_CASES: CurrencyCase[] = [ + { + alfredpayCurrency: "USD", + country: AlfredPayCountry.US, + fiat: FiatToken.USD, + offrampInputAmount: "5", + offrampRate: 1, + onrampInputAmount: "20000", + onrampRate: 1, + rail: "ach" + }, + { + alfredpayCurrency: "COP", + country: AlfredPayCountry.CO, + fiat: FiatToken.COP, + offrampInputAmount: "100", + offrampRate: 4000, + onrampInputAmount: "50000", + onrampRate: 1 / 4000, + rail: "ach" + }, + { + alfredpayCurrency: "ARS", + country: AlfredPayCountry.AR, + fiat: FiatToken.ARS, + offrampInputAmount: "100", + offrampRate: 1000, + onrampInputAmount: "10000", + onrampRate: 1 / 1000, + rail: "cbu" + } +]; + +/** + * Parameterized happy-path scenarios for the Alfredpay corridors beyond MXN: + * USD (ach), COP (ach) and ARS (cbu), each in both directions. The failure and + * security variants live in the MXN corridor files — the phase handlers are + * shared, so what these tests protect is the per-currency configuration: + * rails, limits, and the fiat↔Alfredpay currency mapping. + */ +describe("Alfredpay currency corridors (USD/COP/ARS, on- and offramp)", () => { + let world: FakeWorld; + let auth: { restore: () => void }; + let app: TestApp; + + beforeAll(async () => { + world = installFakeWorld(); + auth = installFakeSupabaseAuth(); + await setupTestDatabase(); + app = await startTestApp(); + }); + + afterAll(async () => { + await app?.close(); + auth?.restore(); + world?.restore(); + }); + + beforeEach(async () => { + await resetTestDatabase(); + world.evm.failNextSends = 0; + world.evm.onTransaction = undefined; + world.evm.onReadContract = undefined; + world.alfredpay.onCreateOnramp = undefined; + world.alfredpay.onrampStatus = AlfredpayOnrampStatus.TRADE_COMPLETED; + world.alfredpay.onrampStatusMetadata = null; + world.alfredpay.offrampStatus = AlfredpayOfframpStatus.FIAT_TRANSFER_COMPLETED; + world.alfredpay.offrampDepositAddress = privateKeyToAccount(generatePrivateKey()).address.toLowerCase(); + }); + + function applyErc20TransfersToLedger(): void { + world.evm.onTransaction = tx => { + if (!tx.serialized) { + return; + } + const parsed = parseTransaction(tx.serialized as `0x${string}`); + if (!parsed.to || !parsed.data) { + return; + } + const { functionName, args } = decodeFunctionData({ abi: erc20Abi, data: parsed.data }); + if (functionName !== "transfer") { + return; + } + const [recipient, amount] = args as [`0x${string}`, bigint]; + world.evm.setErc20Balance( + tx.network, + parsed.to, + recipient, + world.evm.erc20Balance(tx.network, parsed.to, recipient) + amount + ); + }; + } + + async function createQuoteViaApi(body: Record): Promise<{ id: string; outputAmount: string }> { + const response = await app.request("/v1/quotes", { + body: JSON.stringify(body), + headers: { "Content-Type": "application/json" }, + method: "POST" + }); + expect(response.status, `quote creation failed: ${await response.clone().text()}`).toBe(201); + return (await response.json()) as { id: string; outputAmount: string }; + } + + async function registerViaApi( + quoteId: string, + userId: string, + signingAccounts: Array<{ address: string; type: string }>, + additionalData: Record + ): Promise<{ id: string }> { + const response = await app.request("/v1/ramp/register", { + body: JSON.stringify({ additionalData, quoteId, signingAccounts }), + headers: { + Authorization: `Bearer ${testUserToken(userId)}`, + "Content-Type": "application/json" + }, + method: "POST" + }); + expect(response.status, `registration failed: ${await response.clone().text()}`).toBe(201); + return (await response.json()) as { id: string }; + } + + async function updateRampViaApi(rampId: string, userId: string, body: Record): Promise { + const response = await app.request("/v1/ramp/update", { + body: JSON.stringify({ rampId, ...body }), + headers: { + Authorization: `Bearer ${testUserToken(userId)}`, + "Content-Type": "application/json" + }, + method: "POST" + }); + expect(response.status, `ramp update failed: ${await response.clone().text()}`).toBe(200); + } + + for (const currency of CURRENCY_CASES) { + it( + `${currency.fiat} onramp (${currency.rail} → USDT on Polygon) completes and maps to Alfredpay ${currency.alfredpayCurrency}`, + async () => { + world.alfredpay.onrampRate = currency.onrampRate; + // The in-memory anchor keeps orders across tests in this file. + const ordersBefore = world.alfredpay.onrampOrders.length; + const ephemeral = privateKeyToAccount(generatePrivateKey()); + const destination = privateKeyToAccount(generatePrivateKey()).address as `0x${string}`; + + const user = await createTestUser(); + await createTestAlfredpayCustomer(user.id, { country: currency.country }); + const quote = await createQuoteViaApi({ + from: currency.rail, + inputAmount: currency.onrampInputAmount, + inputCurrency: currency.fiat, + network: Networks.Polygon, + outputCurrency: EvmToken.USDT, + rampType: RampDirection.BUY, + to: Networks.Polygon + }); + const ramp = await registerViaApi(quote.id, user.id, [{ address: ephemeral.address, type: "EVM" }], { + destinationAddress: destination + }); + + const persistedQuote = await QuoteTicket.findByPk(quote.id); + const mintAmountRaw = BigInt(persistedQuote?.metadata.alfredpayMint?.outputAmountRaw ?? "0"); + expect(mintAmountRaw).toBeGreaterThan(0n); + const amountRaw = parseUnits(quote.outputAmount, ALFREDPAY_ERC20_DECIMALS); + + const signTransfer = (nonce: number) => + ephemeral.signTransaction({ + chainId: 137, + data: encodeFunctionData({ abi: erc20Abi, args: [destination, amountRaw], functionName: "transfer" }), + gas: 100_000n, + maxFeePerGas: 5_000_000_000n, + maxPriorityFeePerGas: 5_000_000_000n, + nonce, + to: ALFREDPAY_ERC20_TOKEN, + type: "eip1559" + }); + const backups: Record = {}; + for (let i = 1; i <= 4; i++) { + backups[`backup${i}`] = { nonce: i, txData: await signTransfer(i) }; + } + await updateRampViaApi(ramp.id, user.id, { + presignedTxs: [ + { + meta: { additionalTxs: backups }, + network: Networks.Polygon, + nonce: 0, + phase: "destinationTransfer", + signer: ephemeral.address, + txData: await signTransfer(0) + } + ] + }); + + world.evm.setNativeBalance(Networks.Polygon, ephemeral.address, parseUnits("2", 18)); + world.evm.setErc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, ephemeral.address, mintAmountRaw); + applyErc20TransfersToLedger(); + + await phaseProcessor.processRamp(ramp.id); + + const final = await RampState.findByPk(ramp.id); + expect(final?.currentPhase).toBe("complete"); + expect(final?.phaseHistory.map(entry => entry.phase)).toEqual(ONRAMP_PHASES); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + + // The per-currency contract with the anchor: the order carries the + // Alfredpay currency code for this fiat and mints USDT. + expect(world.alfredpay.onrampOrders.length).toBe(ordersBefore + 1); + const order = world.alfredpay.onrampOrders[world.alfredpay.onrampOrders.length - 1]; + expect(order.fromCurrency).toBe(currency.alfredpayCurrency as never); + expect(order.toCurrency).toBe("USDT" as never); + expect(Number(order.amount)).toBe(Number(currency.onrampInputAmount)); + + const quoteRow = await QuoteTicket.findByPk(quote.id); + expect(quoteRow?.status).toBe("consumed"); + expect(world.evm.erc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, destination)).toBe(amountRaw); + }, + 30000 + ); + + it( + `${currency.fiat} offramp (USDT on Polygon → ${currency.rail}) completes and maps to Alfredpay ${currency.alfredpayCurrency}`, + async () => { + world.alfredpay.offrampRate = currency.offrampRate; + // The in-memory anchor keeps orders across tests in this file. + const offrampOrdersBefore = world.alfredpay.offrampOrders.length; + const ephemeral = privateKeyToAccount(generatePrivateKey()); + const userWallet = privateKeyToAccount(generatePrivateKey()); + + // Polygon USDT has no EIP-2612 support: the nonces() probe fails as a + // contract-call error, steering registration onto the no-permit path. + world.evm.onReadContract = (_network, params) => { + if (params.functionName === "nonces") { + throw new ContractFunctionExecutionError(new BaseError("nonces() reverted"), { + abi: erc20Abi, + contractAddress: params.address, + functionName: "nonces" + }); + } + return undefined; + }; + + const user = await createTestUser(); + await createTestAlfredpayCustomer(user.id, { country: currency.country }); + const quote = await createQuoteViaApi({ + from: Networks.Polygon, + inputAmount: currency.offrampInputAmount, + inputCurrency: EvmToken.USDT, + network: Networks.Polygon, + outputCurrency: currency.fiat, + rampType: RampDirection.SELL, + to: currency.rail + }); + const ramp = await registerViaApi(quote.id, user.id, [{ address: ephemeral.address, type: "EVM" }], { + fiatAccountId: "test-fiat-account-1", + walletAddress: userWallet.address + }); + + const persistedQuote = await QuoteTicket.findByPk(quote.id); + const inputAmountRaw = BigInt(persistedQuote?.metadata.alfredpayOfframp?.inputAmountRaw ?? "0"); + expect(inputAmountRaw).toBeGreaterThan(0n); + + const registered = await RampState.findByPk(ramp.id); + const allUnsignedTxs: UnsignedTx[] = registered?.unsignedTxs ?? []; + const userTransferBlueprint = allUnsignedTxs.find(tx => tx.phase === "squidRouterNoPermitTransfer"); + const offrampTransferBlueprint = allUnsignedTxs.find(tx => tx.phase === "alfredpayOfframpTransfer"); + expect(userTransferBlueprint).toBeDefined(); + expect(offrampTransferBlueprint).toBeDefined(); + const userTxData = userTransferBlueprint?.txData as unknown as { to: `0x${string}`; data: `0x${string}` }; + const offrampTxData = offrampTransferBlueprint?.txData as unknown as { to: `0x${string}`; data: `0x${string}` }; + + const signOfframpTransfer = (nonce: number) => + ephemeral.signTransaction({ + chainId: 137, + data: offrampTxData.data, + gas: 100_000n, + maxFeePerGas: 5_000_000_000n, + maxPriorityFeePerGas: 5_000_000_000n, + nonce, + to: offrampTxData.to, + type: "eip1559" + }); + const backups: Record = {}; + for (let i = 1; i <= 4; i++) { + backups[`backup${i}`] = { nonce: i, txData: await signOfframpTransfer(i) }; + } + const signedOfframpTransfer = await signOfframpTransfer(0); + + const userTxHash = world.evm.broadcastUserTransaction(Networks.Polygon, userWallet.address, { + data: userTxData.data, + to: userTxData.to, + value: 0n + }); + await updateRampViaApi(ramp.id, user.id, { + additionalData: { squidRouterNoPermitTransferHash: userTxHash }, + presignedTxs: [ + { + meta: { additionalTxs: backups }, + network: Networks.Polygon, + nonce: 0, + phase: "alfredpayOfframpTransfer", + signer: ephemeral.address, + txData: signedOfframpTransfer + } + ] + }); + + world.evm.setNativeBalance(Networks.Polygon, ephemeral.address, parseUnits("2", 18)); + world.evm.setErc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, ephemeral.address, inputAmountRaw); + applyErc20TransfersToLedger(); + const depositAddress = world.alfredpay.offrampDepositAddress; + + await phaseProcessor.processRamp(ramp.id); + + const final = await RampState.findByPk(ramp.id); + expect(final?.currentPhase).toBe("complete"); + expect(final?.phaseHistory.map(entry => entry.phase)).toEqual(OFFRAMP_PHASES); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + + // Per-currency contract with the anchor on the way out: USDT in, this + // fiat's Alfredpay currency code out, deposit received in full. + expect(world.alfredpay.offrampOrders.length).toBe(offrampOrdersBefore + 1); + const order = world.alfredpay.offrampOrders[world.alfredpay.offrampOrders.length - 1]; + expect(order.fromCurrency).toBe("USDT" as never); + expect(order.toCurrency).toBe(currency.alfredpayCurrency as never); + expect(world.evm.erc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, depositAddress)).toBe(inputAmountRaw); + + const quoteRow = await QuoteTicket.findByPk(quote.id); + expect(quoteRow?.status).toBe("consumed"); + }, + 30000 + ); + } +}); diff --git a/apps/api/src/tests/corridors/mxn-offramp.scenario.test.ts b/apps/api/src/tests/corridors/mxn-offramp.scenario.test.ts index 4ec8ce0e0..a7ec61d47 100644 --- a/apps/api/src/tests/corridors/mxn-offramp.scenario.test.ts +++ b/apps/api/src/tests/corridors/mxn-offramp.scenario.test.ts @@ -84,6 +84,7 @@ describe("MXN offramp direct corridor (USDT on Polygon → spei, no-permit)", () await resetTestDatabase(); world.evm.failNextSends = 0; world.evm.onTransaction = undefined; + world.squidRouter.computeToAmount = params => params.fromAmount; world.alfredpay.offrampRate = ALFREDPAY_OFFRAMP_RATE; world.alfredpay.offrampStatus = AlfredpayOfframpStatus.FIAT_TRANSFER_COMPLETED; // Fresh deposit address per test: the in-memory EVM ledger persists across @@ -333,6 +334,38 @@ describe("MXN offramp direct corridor (USDT on Polygon → spei, no-permit)", () 30000 ); + it( + "subsidy cap (F-001): a settlement shortfall needing more than MAX_FINAL_SETTLEMENT_SUBSIDY_USD of native fails instead of paying", + async () => { + const setup = await setUpRegisteredRamp(); + world.evm.setNativeBalance(Networks.Polygon, setup.ephemeral.address, parseUnits("2", 18)); + // Only 90% of the expected USDT arrived (exactly the minimum bridge + // delivery ratio, so the balance poll passes): the 10 USDT shortfall + // must be subsidized. The funding account holds no USDT, so the handler + // prices a native→USDT swap; at 0.5 USD/MATIC the required ~22 MATIC + // (incl. the 10% buffer) is worth $11 — above the $10 F-001 cap. + world.evm.setErc20Balance( + Networks.Polygon, + ALFREDPAY_ERC20_TOKEN, + setup.ephemeral.address, + (setup.inputAmountRaw * 9n) / 10n + ); + world.squidRouter.computeToAmount = params => (BigInt(params.fromAmount) / 2n / 10n ** 12n).toString(); + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("failed"); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + expect(final?.errorLogs.some(log => log.error.includes("exceeds maximum allowed"))).toBe(true); + + // The deposit transfer never reached the chain and nothing was subsidized. + expect(submissionsOf(setup.signedOfframpTransfer)).toBe(0); + expect(world.evm.erc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, world.alfredpay.offrampDepositAddress)).toBe(0n); + }, + 30000 + ); + it( "unrecoverable failure: an Alfredpay FAILED order status fails the ramp during the transfer phase", async () => { From 903974d72c0da7d94ce2f0347327bf835b8e8173 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 11:43:29 +0200 Subject: [PATCH 144/176] Raise the api coverage floors to 48/59 after the new corridor scenarios --- apps/api/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/api/package.json b/apps/api/package.json index 6cf7c0577..bc29f2e1b 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -96,7 +96,7 @@ "serve": "bun dist/index.js", "start": "bun run build && bun run serve", "test": "bun test", - "test:coverage": "bun test --coverage --coverage-reporter=lcov && bun ../../scripts/check-coverage.ts coverage/lcov.info 0.44 0.56", + "test:coverage": "bun test --coverage --coverage-reporter=lcov && bun ../../scripts/check-coverage.ts coverage/lcov.info 0.48 0.59", "test:db:start": "./scripts/test-db.sh start", "test:db:stop": "./scripts/test-db.sh stop" }, From e6ec0010919479c02105231de2763928a52e0663 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 11:43:30 +0200 Subject: [PATCH 145/176] Test the frontend ramp execution actors and fiatAccount machine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The actors that actually execute a ramp were untested: sign.actor (EVM/typed-data/substrate routing, SIGNING_UPDATE sequences, user rejection), register.actor (full MSW registration flow, ephemeral-vs-user tx filtering, unsigned→signed conversion, error paths), start.actor, validateKyc.actor (per-fiat-token KYC routing incl. the BRL limit/identity gates), plus a machine test for fiatAccount. Wallet-signing helpers are mocked at their module seams; API calls go through MSW. Coverage floors ratchet to 25 lines / 42 functions. Two probable production bugs in validateKyc.actor are pinned as current behavior with flagging comments: the over-limit throw is swallowed by its own catch (users get routed to KYC instead of a limit error), and the 'KYC invalid' branch reads a property ApiError never carries. --- .../machines/actors/register.actor.test.ts | 186 ++++++++++- .../src/machines/actors/sign.actor.test.ts | 312 ++++++++++++++++++ .../src/machines/actors/start.actor.test.ts | 56 ++++ .../machines/actors/validateKyc.actor.test.ts | 139 ++++++++ .../src/machines/fiatAccount.machine.test.ts | 93 ++++++ apps/frontend/src/test/fixtures.ts | 45 ++- apps/frontend/vitest.config.ts | 4 +- 7 files changed, 830 insertions(+), 5 deletions(-) create mode 100644 apps/frontend/src/machines/actors/sign.actor.test.ts create mode 100644 apps/frontend/src/machines/actors/start.actor.test.ts create mode 100644 apps/frontend/src/machines/actors/validateKyc.actor.test.ts create mode 100644 apps/frontend/src/machines/fiatAccount.machine.test.ts diff --git a/apps/frontend/src/machines/actors/register.actor.test.ts b/apps/frontend/src/machines/actors/register.actor.test.ts index 9fa8bf444..f4017881d 100644 --- a/apps/frontend/src/machines/actors/register.actor.test.ts +++ b/apps/frontend/src/machines/actors/register.actor.test.ts @@ -1,6 +1,38 @@ -import { FiatToken, Networks, RampDirection } from "@vortexfi/shared"; -import { describe, expect, it } from "vitest"; +// @vitest-environment jsdom +import { http, HttpResponse } from "msw"; +import { beforeEach, describe, expect, it, vi } from "vitest"; + +// Keep the real shared package but stub the pieces that would hit chains: the ephemeral +// signing helper and the polkadot ApiManager (none of these tests may open an RPC connection). +vi.mock("@vortexfi/shared", async importOriginal => { + const actual = await importOriginal(); + return { + ...actual, + ApiManager: { + getInstance: () => ({ + getApi: vi.fn(async () => { + throw new Error("getApi must not be called in these tests"); + }) + }) + }, + signUnsignedTransactions: vi.fn() + }; +}); + +import { + FiatToken, + getAddressForFormat, + Networks, + RampDirection, + RegisterRampRequest, + signUnsignedTransactions, + UpdateRampRequest +} from "@vortexfi/shared"; +import { ApiError } from "../../services/api/api-client"; +import { buildQuoteResponse, buildRampProcess, buildUnsignedTx } from "../../test/fixtures"; +import { API_BASE_URL, server } from "../../test/msw-server"; import { RampContext } from "../types"; +import { registerRampActor } from "./register.actor"; import { buildRegisterRampAdditionalData, RegisterRampError, RegisterRampErrorType } from "./registerAdditionalData"; const baseContext = { @@ -41,3 +73,153 @@ describe("buildRegisterRampAdditionalData", () => { ).toThrow(new RegisterRampError("User email is required for Mykobo EUR offramp.", RegisterRampErrorType.InvalidInput)); }); }); + +const USER_ADDRESS = "0x1111111111111111111111111111111111111111"; +const EVM_EPHEMERAL_ADDRESS = "0x3333333333333333333333333333333333333333"; +// Well-known Alice dev account (ss58 format 42). +const SUBSTRATE_EPHEMERAL_ADDRESS = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"; + +const quote = buildQuoteResponse({ rampType: RampDirection.SELL }); + +function buildExecutionContext(overrides: Partial = {}): RampContext { + return { + ...baseContext, + chainId: 1, + executionInput: { + ...baseContext.executionInput, + ephemerals: { + evmEphemeral: { address: EVM_EPHEMERAL_ADDRESS, secret: "0xsecret" }, + substrateEphemeral: { address: SUBSTRATE_EPHEMERAL_ADDRESS, secret: "seed" } + }, + quote + }, + quote, + userId: "user-1", + ...overrides + } as RampContext; +} + +// Serves POST /ramp/register and /ramp/update, recording the request bodies. +function mockRampEndpoints(unsignedTxs: ReturnType[]) { + const registerCalls: RegisterRampRequest[] = []; + const updateCalls: UpdateRampRequest[] = []; + server.use( + http.post(`${API_BASE_URL}/ramp/register`, async ({ request }) => { + registerCalls.push((await request.json()) as RegisterRampRequest); + return HttpResponse.json({ ...buildRampProcess("initial", { id: "ramp-registered" }), unsignedTxs }); + }), + http.post(`${API_BASE_URL}/ramp/update`, async ({ request }) => { + updateCalls.push((await request.json()) as UpdateRampRequest); + return HttpResponse.json(buildRampProcess("initial", { id: "ramp-updated" })); + }) + ); + return { registerCalls, updateCalls }; +} + +beforeEach(() => { + vi.clearAllMocks(); +}); + +describe("registerRampActor", () => { + it.each([ + ["executionInput", { executionInput: undefined }], + ["quote", { quote: undefined }], + ["connectedWalletAddress", { connectedWalletAddress: undefined }], + ["chainId", { chainId: undefined }] + ])("throws an InvalidInput error when %s is missing", async (_field, override) => { + const context = buildExecutionContext(override as Partial); + + await expect(registerRampActor({ input: context })).rejects.toMatchObject({ + type: RegisterRampErrorType.InvalidInput + }); + }); + + it("registers the ramp, signs only the ephemeral transactions and submits them", async () => { + const userTx = buildUnsignedTx({ signer: USER_ADDRESS.toUpperCase().replace("0X", "0x") }); + const ephemeralTx = buildUnsignedTx({ phase: "squidRouterPay", signer: EVM_EPHEMERAL_ADDRESS }); + const { registerCalls, updateCalls } = mockRampEndpoints([userTx, ephemeralTx]); + const signedEphemeralTx = { ...ephemeralTx, txData: "0xsigned" }; + vi.mocked(signUnsignedTransactions).mockResolvedValue([signedEphemeralTx]); + + const result = await registerRampActor({ input: buildExecutionContext() }); + + expect(registerCalls).toHaveLength(1); + expect(registerCalls[0]).toMatchObject({ + additionalData: { + destinationAddress: "0x2222222222222222222222222222222222222222", + email: "user@example.com", + sessionId: "session-1", + walletAddress: USER_ADDRESS + }, + quoteId: "quote-1", + signingAccounts: [ + { address: EVM_EPHEMERAL_ADDRESS, type: "EVM" }, + { address: SUBSTRATE_EPHEMERAL_ADDRESS, type: "Substrate" } + ], + userId: "user-1" + }); + + // Only the ephemeral tx reaches the signer: the user-signed tx is matched case-insensitively. + expect(vi.mocked(signUnsignedTransactions).mock.calls[0][0]).toEqual([ephemeralTx]); + + expect(updateCalls).toHaveLength(1); + expect(updateCalls[0].rampId).toBe("ramp-registered"); + expect(updateCalls[0].presignedTxs).toEqual([signedEphemeralTx]); + + expect(result).toEqual({ + quote, + ramp: expect.objectContaining({ id: "ramp-updated" }), + requiredUserActionsCompleted: false, + signedTransactions: [signedEphemeralTx], + userSigningMeta: { + assethubToPendulumHash: undefined, + squidRouterApproveHash: undefined, + squidRouterSwapHash: undefined + } + }); + }); + + it("excludes the user's substrate transactions across ss58 formats on substrate chains", async () => { + const userSubstrateTx = buildUnsignedTx({ + network: Networks.Pendulum, + phase: "assethubToPendulum", + // Signer encoded with the Polkadot prefix while the wallet uses the generic prefix. + signer: getAddressForFormat(SUBSTRATE_EPHEMERAL_ADDRESS, 0), + txData: "0xdeadbeef" + }); + const ephemeralTx = buildUnsignedTx({ phase: "squidRouterPay", signer: EVM_EPHEMERAL_ADDRESS }); + mockRampEndpoints([userSubstrateTx, ephemeralTx]); + vi.mocked(signUnsignedTransactions).mockResolvedValue([ephemeralTx]); + + await registerRampActor({ + input: buildExecutionContext({ chainId: -1, connectedWalletAddress: SUBSTRATE_EPHEMERAL_ADDRESS }) + }); + + // If the Pendulum tx were not filtered out, the stubbed ApiManager.getApi would throw. + expect(vi.mocked(signUnsignedTransactions).mock.calls[0][0]).toEqual([ephemeralTx]); + }); + + it("propagates a registration API failure without signing or updating", async () => { + const { updateCalls } = mockRampEndpoints([]); + server.use( + http.post(`${API_BASE_URL}/ramp/register`, () => + HttpResponse.json({ error: "Quote expired" }, { status: 400 }) + ) + ); + + const promise = registerRampActor({ input: buildExecutionContext() }); + await expect(promise).rejects.toBeInstanceOf(ApiError); + await expect(promise).rejects.toMatchObject({ message: "Quote expired", status: 400 }); + expect(signUnsignedTransactions).not.toHaveBeenCalled(); + expect(updateCalls).toHaveLength(0); + }); + + it("propagates an update API failure after registration", async () => { + const ephemeralTx = buildUnsignedTx({ signer: EVM_EPHEMERAL_ADDRESS }); + mockRampEndpoints([ephemeralTx]); + server.use(http.post(`${API_BASE_URL}/ramp/update`, () => HttpResponse.json({ error: "boom" }, { status: 500 }))); + vi.mocked(signUnsignedTransactions).mockResolvedValue([ephemeralTx]); + + await expect(registerRampActor({ input: buildExecutionContext() })).rejects.toMatchObject({ status: 500 }); + }); +}); diff --git a/apps/frontend/src/machines/actors/sign.actor.test.ts b/apps/frontend/src/machines/actors/sign.actor.test.ts new file mode 100644 index 000000000..4a446f7bf --- /dev/null +++ b/apps/frontend/src/machines/actors/sign.actor.test.ts @@ -0,0 +1,312 @@ +// @vitest-environment jsdom +import { http, HttpResponse } from "msw"; +import { beforeEach, describe, expect, it, vi } from "vitest"; + +// The real module imports wagmi/walletconnect config at module load; the actor tests only +// care about which signing helper is routed to, not the wallet plumbing itself. +vi.mock("../../services/transactions/userSigning", () => ({ + signAndSubmitEvmTransaction: vi.fn(), + signAndSubmitSubstrateTransaction: vi.fn(), + signMultipleTypedData: vi.fn() +})); + +import { WalletAccount } from "@talismn/connect-wallets"; +import { EvmToken, getAddressForFormat, Networks, UnsignedTx, UpdateRampRequest } from "@vortexfi/shared"; +import { buildQuoteResponse, buildRampProcess, buildSignedTypedData, buildUnsignedTx } from "../../test/fixtures"; +import { API_BASE_URL, server } from "../../test/msw-server"; +import { + signAndSubmitEvmTransaction, + signAndSubmitSubstrateTransaction, + signMultipleTypedData +} from "../../services/transactions/userSigning"; +import { RampExecutionInput, RampState } from "../../types/phases"; +import { RampContext, RampMachineActor } from "../types"; +import { SignRampError, SignRampErrorType, signTransactionsActor } from "./sign.actor"; + +const USER_ADDRESS = "0x1111111111111111111111111111111111111111"; +const OTHER_ADDRESS = "0x9999999999999999999999999999999999999999"; +// Well-known Alice dev account (ss58 format 42). +const ALICE_SUBSTRATE = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"; + +function buildRampState(unsignedTxs: UnsignedTx[]): RampState { + return { + quote: buildQuoteResponse(), + ramp: { ...buildRampProcess("initial"), unsignedTxs }, + requiredUserActionsCompleted: false, + signedTransactions: [], + userSigningMeta: undefined + }; +} + +function buildContext(unsignedTxs: UnsignedTx[], overrides: Partial = {}): RampContext { + return { + chainId: 1, + connectedWalletAddress: USER_ADDRESS, + rampState: buildRampState(unsignedTxs), + ...overrides + } as RampContext; +} + +function buildParent() { + const events: Array<{ type: string } & Record> = []; + const parent = { send: (event: { type: string }) => events.push(event) } as unknown as RampMachineActor; + return { events, parent }; +} + +// Serves POST /ramp/update and records the request bodies. +function mockUpdateEndpoint() { + const calls: UpdateRampRequest[] = []; + server.use( + http.post(`${API_BASE_URL}/ramp/update`, async ({ request }) => { + calls.push((await request.json()) as UpdateRampRequest); + return HttpResponse.json(buildRampProcess("initial", { id: "ramp-updated" })); + }) + ); + return calls; +} + +async function runActor(context: RampContext) { + const { events, parent } = buildParent(); + const result = await signTransactionsActor({ input: { context, parent } }); + return { events, result }; +} + +beforeEach(() => { + vi.clearAllMocks(); +}); + +describe("signTransactionsActor", () => { + describe("input validation", () => { + it.each([ + ["rampState", { rampState: undefined }], + ["connectedWalletAddress", { connectedWalletAddress: undefined }], + ["chainId", { chainId: undefined }] + ])("throws an InvalidInput error when %s is missing", async (_field, override) => { + const context = buildContext([buildUnsignedTx()], override as Partial); + const { parent } = buildParent(); + + await expect(signTransactionsActor({ input: { context, parent } })).rejects.toMatchObject({ + type: SignRampErrorType.InvalidInput + }); + }); + }); + + describe("transaction filtering", () => { + it("returns the ramp state untouched when no transaction is signed by the connected wallet", async () => { + const updateCalls = mockUpdateEndpoint(); + const context = buildContext([buildUnsignedTx({ signer: OTHER_ADDRESS })]); + + const { result } = await runActor(context); + + expect(result).toBe(context.rampState); + expect(signAndSubmitEvmTransaction).not.toHaveBeenCalled(); + expect(updateCalls).toHaveLength(0); + }); + + it("matches EVM signers case-insensitively", async () => { + mockUpdateEndpoint(); + vi.mocked(signAndSubmitEvmTransaction).mockResolvedValue("0xhash"); + const context = buildContext([buildUnsignedTx({ signer: USER_ADDRESS.toUpperCase().replace("0X", "0x") })]); + + await runActor(context); + + expect(signAndSubmitEvmTransaction).toHaveBeenCalledTimes(1); + }); + + it("matches substrate signers across ss58 formats when on a substrate chain", async () => { + mockUpdateEndpoint(); + vi.mocked(signAndSubmitSubstrateTransaction).mockResolvedValue("0xsubstratehash"); + const walletAccount = { address: ALICE_SUBSTRATE } as WalletAccount; + // Signer encoded with the Polkadot ss58 prefix, wallet connected with the generic prefix. + const context = buildContext( + [buildUnsignedTx({ network: Networks.AssetHub, phase: "assethubToPendulum", signer: getAddressForFormat(ALICE_SUBSTRATE, 0), txData: "0xdeadbeef" })], + { chainId: -1, connectedWalletAddress: ALICE_SUBSTRATE, substrateWalletAccount: walletAccount } + ); + + await runActor(context); + + expect(signAndSubmitSubstrateTransaction).toHaveBeenCalledTimes(1); + }); + }); + + describe("EVM signing", () => { + it("signs squidRouter transactions in nonce order, reports progress and stores the hashes", async () => { + const updateCalls = mockUpdateEndpoint(); + vi.mocked(signAndSubmitEvmTransaction).mockResolvedValueOnce("0xapprovehash").mockResolvedValueOnce("0xswaphash"); + const swapTx = buildUnsignedTx({ nonce: 2, phase: "squidRouterSwap" }); + const approveTx = buildUnsignedTx({ nonce: 1, phase: "squidRouterApprove" }); + // Deliberately out of order to prove nonce sorting. + const context = buildContext([swapTx, approveTx]); + + const { events, result } = await runActor(context); + + expect(vi.mocked(signAndSubmitEvmTransaction).mock.calls.map(call => call[0].phase)).toEqual([ + "squidRouterApprove", + "squidRouterSwap" + ]); + expect(events).toEqual([ + { current: 1, max: 2, phase: "started", type: "SIGNING_UPDATE" }, + { current: 1, max: 2, phase: "signed", type: "SIGNING_UPDATE" }, + { current: 2, max: 2, phase: "finished", type: "SIGNING_UPDATE" } + ]); + expect(updateCalls).toHaveLength(1); + expect(updateCalls[0].additionalData).toMatchObject({ + squidRouterApproveHash: "0xapprovehash", + squidRouterSwapHash: "0xswaphash" + }); + expect(result.ramp?.id).toBe("ramp-updated"); + expect(result.userSigningMeta).toEqual({ + assethubToPendulumHash: undefined, + squidRouterApproveHash: "0xapprovehash", + squidRouterSwapHash: "0xswaphash" + }); + }); + + it("signs the no-permit squidRouter transaction sequence", async () => { + const updateCalls = mockUpdateEndpoint(); + vi.mocked(signAndSubmitEvmTransaction) + .mockResolvedValueOnce("0xtransferhash") + .mockResolvedValueOnce("0xnopermitapprovehash") + .mockResolvedValueOnce("0xnopermitswaphash"); + const context = buildContext([ + buildUnsignedTx({ nonce: 1, phase: "squidRouterNoPermitTransfer" }), + buildUnsignedTx({ nonce: 2, phase: "squidRouterNoPermitApprove" }), + buildUnsignedTx({ nonce: 3, phase: "squidRouterNoPermitSwap" }) + ]); + + const { events } = await runActor(context); + + expect(signAndSubmitEvmTransaction).toHaveBeenCalledTimes(3); + expect(events.map(event => event.phase)).toEqual(["started", "finished", "started", "signed", "finished"]); + expect(updateCalls[0].additionalData).toMatchObject({ + squidRouterNoPermitApproveHash: "0xnopermitapprovehash", + squidRouterNoPermitSwapHash: "0xnopermitswaphash", + squidRouterNoPermitTransferHash: "0xtransferhash" + }); + }); + + it("skips the squidRouterApprove step for native token transfers and reports the login phase", async () => { + const updateCalls = mockUpdateEndpoint(); + const context = buildContext([buildUnsignedTx({ phase: "squidRouterApprove" })], { + executionInput: { network: Networks.Ethereum, onChainToken: EvmToken.ETH } as RampExecutionInput + }); + + const { events } = await runActor(context); + + expect(signAndSubmitEvmTransaction).not.toHaveBeenCalled(); + expect(events).toEqual([{ current: 1, max: 1, phase: "login", type: "SIGNING_UPDATE" }]); + expect(updateCalls).toHaveLength(1); + }); + }); + + describe("typed-data signing", () => { + it("signs a single typed-data payload, replaces the txData and submits it as a presigned tx", async () => { + const updateCalls = mockUpdateEndpoint(); + const typedData = buildSignedTypedData(); + const signedTypedData = buildSignedTypedData({ signature: { deadline: 1, r: "0x01", s: "0x02", v: 27 } }); + vi.mocked(signMultipleTypedData).mockResolvedValue([signedTypedData]); + const context = buildContext([buildUnsignedTx({ phase: "squidRouterPermitExecute", txData: typedData })]); + + const { events } = await runActor(context); + + expect(signMultipleTypedData).toHaveBeenCalledWith([typedData]); + expect(events.map(event => event.phase)).toEqual(["started", "signed"]); + expect(updateCalls[0].presignedTxs).toHaveLength(1); + expect(updateCalls[0].presignedTxs[0].txData).toEqual(signedTypedData); + }); + + it("signs a typed-data array payload in one batch", async () => { + const updateCalls = mockUpdateEndpoint(); + const typedDataArray = [buildSignedTypedData(), buildSignedTypedData({ primaryType: "OrderWitness" })]; + const signedArray = typedDataArray.map(data => + buildSignedTypedData({ ...data, signature: { deadline: 1, r: "0x01", s: "0x02", v: 27 } }) + ); + vi.mocked(signMultipleTypedData).mockResolvedValue(signedArray); + const context = buildContext([buildUnsignedTx({ phase: "squidRouterPermitExecute", txData: typedDataArray })]); + + await runActor(context); + + expect(signMultipleTypedData).toHaveBeenCalledWith(typedDataArray); + expect(updateCalls[0].presignedTxs[0].txData).toEqual(signedArray); + }); + }); + + describe("substrate signing", () => { + it("routes assethubToPendulum transactions to the substrate signer with the wallet account", async () => { + const updateCalls = mockUpdateEndpoint(); + vi.mocked(signAndSubmitSubstrateTransaction).mockResolvedValue("0xassethubhash"); + const walletAccount = { address: ALICE_SUBSTRATE } as WalletAccount; + const tx = buildUnsignedTx({ + network: Networks.AssetHub, + phase: "assethubToPendulum", + signer: ALICE_SUBSTRATE, + txData: "0xdeadbeef" + }); + const context = buildContext([tx], { + chainId: -1, + connectedWalletAddress: ALICE_SUBSTRATE, + substrateWalletAccount: walletAccount + }); + + const { events, result } = await runActor(context); + + expect(signAndSubmitSubstrateTransaction).toHaveBeenCalledWith(tx, walletAccount); + expect(signAndSubmitEvmTransaction).not.toHaveBeenCalled(); + expect(events.map(event => event.phase)).toEqual(["started", "finished"]); + expect(updateCalls[0].additionalData).toMatchObject({ assethubToPendulumHash: "0xassethubhash" }); + expect(result.userSigningMeta?.assethubToPendulumHash).toBe("0xassethubhash"); + }); + + it("fails with an UnknownError when no substrate wallet account is connected", async () => { + const tx = buildUnsignedTx({ + network: Networks.AssetHub, + phase: "assethubToPendulum", + signer: ALICE_SUBSTRATE, + txData: "0xdeadbeef" + }); + const context = buildContext([tx], { chainId: -1, connectedWalletAddress: ALICE_SUBSTRATE }); + const { parent } = buildParent(); + + await expect(signTransactionsActor({ input: { context, parent } })).rejects.toMatchObject({ + type: SignRampErrorType.UnknownError + }); + expect(signAndSubmitSubstrateTransaction).not.toHaveBeenCalled(); + }); + }); + + describe("error propagation", () => { + it("maps a wallet rejection to a UserRejected error", async () => { + vi.mocked(signAndSubmitEvmTransaction).mockRejectedValue(new Error("User rejected the request.")); + const context = buildContext([buildUnsignedTx()]); + const { parent } = buildParent(); + + const promise = signTransactionsActor({ input: { context, parent } }); + await expect(promise).rejects.toBeInstanceOf(SignRampError); + await expect(promise).rejects.toMatchObject({ + message: "User rejected the signature request.", + type: SignRampErrorType.UserRejected + }); + }); + + it("maps any other signing failure to an UnknownError", async () => { + vi.mocked(signAndSubmitEvmTransaction).mockRejectedValue(new Error("insufficient funds for gas")); + const context = buildContext([buildUnsignedTx()]); + const { parent } = buildParent(); + + await expect(signTransactionsActor({ input: { context, parent } })).rejects.toMatchObject({ + message: "Error signing transaction", + type: SignRampErrorType.UnknownError + }); + }); + + it("rejects transactions with an unexpected phase", async () => { + const context = buildContext([buildUnsignedTx({ phase: "nablaSwap" })]); + const { parent } = buildParent(); + + await expect(signTransactionsActor({ input: { context, parent } })).rejects.toMatchObject({ + type: SignRampErrorType.UnknownError + }); + expect(signAndSubmitEvmTransaction).not.toHaveBeenCalled(); + }); + }); +}); diff --git a/apps/frontend/src/machines/actors/start.actor.test.ts b/apps/frontend/src/machines/actors/start.actor.test.ts new file mode 100644 index 000000000..f5d6b7257 --- /dev/null +++ b/apps/frontend/src/machines/actors/start.actor.test.ts @@ -0,0 +1,56 @@ +// @vitest-environment jsdom +import { StartRampRequest } from "@vortexfi/shared"; +import { http, HttpResponse } from "msw"; +import { describe, expect, it } from "vitest"; +import { ApiError } from "../../services/api/api-client"; +import { buildQuoteResponse, buildRampProcess } from "../../test/fixtures"; +import { API_BASE_URL, server } from "../../test/msw-server"; +import { RampContext } from "../types"; +import { startRampActor } from "./start.actor"; + +function buildContext(overrides: Partial = {}): RampContext { + return { + rampState: { + quote: buildQuoteResponse(), + ramp: buildRampProcess("initial", { id: "ramp-123" }), + requiredUserActionsCompleted: true, + signedTransactions: [], + userSigningMeta: undefined + }, + ...overrides + } as RampContext; +} + +describe("startRampActor", () => { + it("starts the ramp and returns the updated process", async () => { + const startCalls: StartRampRequest[] = []; + server.use( + http.post(`${API_BASE_URL}/ramp/start`, async ({ request }) => { + startCalls.push((await request.json()) as StartRampRequest); + return HttpResponse.json(buildRampProcess("squidRouterApprove", { id: "ramp-123" })); + }) + ); + + const result = await startRampActor({ input: buildContext() }); + + expect(startCalls).toEqual([{ rampId: "ramp-123" }]); + expect(result.currentPhase).toBe("squidRouterApprove"); + }); + + it.each([ + ["rampState", { rampState: undefined }], + ["ramp process", { rampState: { ramp: undefined } as RampContext["rampState"] }] + ])("throws when the %s is missing", async (_field, override) => { + await expect(startRampActor({ input: buildContext(override as Partial) })).rejects.toThrow( + "Ramp state or ramp process not found." + ); + }); + + it("propagates an API failure", async () => { + server.use(http.post(`${API_BASE_URL}/ramp/start`, () => HttpResponse.json({ error: "Ramp not ready" }, { status: 400 }))); + + const promise = startRampActor({ input: buildContext() }); + await expect(promise).rejects.toBeInstanceOf(ApiError); + await expect(promise).rejects.toMatchObject({ message: "Ramp not ready", status: 400 }); + }); +}); diff --git a/apps/frontend/src/machines/actors/validateKyc.actor.test.ts b/apps/frontend/src/machines/actors/validateKyc.actor.test.ts new file mode 100644 index 000000000..f3d4e230e --- /dev/null +++ b/apps/frontend/src/machines/actors/validateKyc.actor.test.ts @@ -0,0 +1,139 @@ +// @vitest-environment jsdom +import { FiatToken, RampDirection } from "@vortexfi/shared"; +import { http, HttpResponse } from "msw"; +import { describe, expect, it, vi } from "vitest"; +import { buildQuoteResponse } from "../../test/fixtures"; +import { API_BASE_URL, server } from "../../test/msw-server"; +import { RampContext } from "../types"; +import { validateKycActor } from "./validateKyc.actor"; + +// Structurally valid, non-trivial CPF (11 digits). +const VALID_CPF = "52998224725"; +const INVALID_TAX_ID = "123"; + +function buildContext(fiatToken: FiatToken, overrides: Partial = {}): RampContext { + return { + executionInput: { + fiatToken, + quote: buildQuoteResponse({ outputAmount: "100", rampType: RampDirection.SELL }), + taxId: fiatToken === FiatToken.BRL ? VALID_CPF : undefined + }, + externalSessionId: "session-1", + quoteId: "quote-1", + rampDirection: RampDirection.SELL, + ...overrides + } as RampContext; +} + +function mockBrlaUser(user: { evmAddress: string; identityStatus: string }, remainingLimit: string) { + server.use( + http.get(`${API_BASE_URL}/brla/getUser`, () => HttpResponse.json({ ...user, subAccountId: "sub-1" })), + http.get(`${API_BASE_URL}/brla/getUserRemainingLimit`, () => HttpResponse.json({ remainingLimit })) + ); +} + +// Serves POST /brla/kyc/record-attempt and records the request bodies. +function mockRecordAttemptEndpoint() { + const calls: unknown[] = []; + server.use( + http.post(`${API_BASE_URL}/brla/kyc/record-attempt`, async ({ request }) => { + calls.push(await request.json()); + return HttpResponse.json({}); + }) + ); + return calls; +} + +describe("validateKycActor", () => { + it.each([ + ["executionInput", { executionInput: undefined }], + ["rampDirection", { rampDirection: undefined }], + ["quoteId", { quoteId: undefined }] + ])("throws when %s is missing", async (_field, override) => { + await expect(validateKycActor({ input: buildContext(FiatToken.EURC, override as Partial) })).rejects.toThrow( + /missing from ramp context/ + ); + }); + + it.each([ + ["EURC (Mykobo)", FiatToken.EURC], + ["ARS (Alfredpay)", FiatToken.ARS], + ["MXN (Alfredpay)", FiatToken.MXN], + ["USD (Alfredpay)", FiatToken.USD], + ["COP (Alfredpay)", FiatToken.COP] + ])("requires KYC for %s without calling the BRLA API", async (_label, fiatToken) => { + const result = await validateKycActor({ input: buildContext(fiatToken) }); + expect(result).toEqual({ kycNeeded: true }); + }); + + describe("BRL (Avenia)", () => { + it("throws when the tax ID is missing", async () => { + const context = buildContext(FiatToken.BRL); + (context.executionInput as { taxId?: string }).taxId = undefined; + + await expect(validateKycActor({ input: context })).rejects.toThrow( + "Tax ID must exist when validating KYC for BRL transactions" + ); + }); + + it("skips KYC for a confirmed user within their remaining limit", async () => { + mockBrlaUser({ evmAddress: "0xbrla", identityStatus: "CONFIRMED" }, "1000"); + + const result = await validateKycActor({ input: buildContext(FiatToken.BRL) }); + + expect(result).toEqual({ brlaEvmAddress: "0xbrla", kycNeeded: false }); + }); + + it("requires KYC when the user exists but their identity is not confirmed", async () => { + mockBrlaUser({ evmAddress: "0xbrla", identityStatus: "PENDING" }, "1000"); + + const result = await validateKycActor({ input: buildContext(FiatToken.BRL) }); + + expect(result).toEqual({ brlaEvmAddress: "0xbrla", kycNeeded: true }); + }); + + it("requires KYC and records the attempt when the user does not exist yet", async () => { + server.use(http.get(`${API_BASE_URL}/brla/getUser`, () => HttpResponse.json({ error: "Not found" }, { status: 404 }))); + const recordCalls = mockRecordAttemptEndpoint(); + + const result = await validateKycActor({ input: buildContext(FiatToken.BRL) }); + + expect(result).toEqual({ kycNeeded: true }); + // recordInitialKycAttempt is fire-and-forget; wait for the request to land. + await vi.waitFor(() => expect(recordCalls).toHaveLength(1)); + expect(recordCalls[0]).toEqual({ quoteId: "quote-1", sessionId: "session-1", taxId: VALID_CPF }); + }); + + // The over-limit throw is swallowed by the surrounding catch: with a structurally valid + // CPF the actor falls through to "user needs KYC" instead of surfacing the limit error. + it("treats an exceeded remaining limit as a new KYC attempt for a valid CPF", async () => { + mockBrlaUser({ evmAddress: "0xbrla", identityStatus: "CONFIRMED" }, "10"); + const recordCalls = mockRecordAttemptEndpoint(); + + const result = await validateKycActor({ input: buildContext(FiatToken.BRL) }); + + expect(result).toEqual({ kycNeeded: true }); + await vi.waitFor(() => expect(recordCalls).toHaveLength(1)); + }); + + it("checks the input amount against the limit for BUY ramps", async () => { + mockBrlaUser({ evmAddress: "0xbrla", identityStatus: "CONFIRMED" }, "200"); + const context = buildContext(FiatToken.BRL, { rampDirection: RampDirection.BUY }); + // inputAmount 150 (fixture default) <= 200, while outputAmount would also pass; the + // direction routing is covered by the SELL over-limit test above using outputAmount. + const result = await validateKycActor({ input: context }); + + expect(result).toEqual({ brlaEvmAddress: "0xbrla", kycNeeded: false }); + }); + + it("rethrows a user lookup failure when the tax ID is not a valid CPF or CNPJ", async () => { + server.use( + http.get(`${API_BASE_URL}/brla/getUser`, () => HttpResponse.json({ error: "Internal error" }, { status: 500 })) + ); + const context = buildContext(FiatToken.BRL); + (context.executionInput as { taxId?: string }).taxId = INVALID_TAX_ID; + + await expect(validateKycActor({ input: context })).rejects.toMatchObject({ status: 500 }); + }); + }); +}); diff --git a/apps/frontend/src/machines/fiatAccount.machine.test.ts b/apps/frontend/src/machines/fiatAccount.machine.test.ts new file mode 100644 index 000000000..37db7edb2 --- /dev/null +++ b/apps/frontend/src/machines/fiatAccount.machine.test.ts @@ -0,0 +1,93 @@ +import { describe, expect, it } from "vitest"; +import { createActor } from "xstate"; +import { fiatAccountMachine } from "./fiatAccount.machine"; + +function createFiatAccountActor() { + const actor = createActor(fiatAccountMachine); + actor.start(); + return actor; +} + +function openedActor(country = "MX") { + const actor = createFiatAccountActor(); + actor.send({ country, type: "OPEN" }); + return actor; +} + +describe("fiatAccountMachine", () => { + it("starts closed with an empty context", () => { + const actor = createFiatAccountActor(); + + expect(actor.getSnapshot().value).toBe("Closed"); + expect(actor.getSnapshot().context).toEqual({ + fiatRegistrationCountry: null, + selectedAccountType: undefined, + selectedFiatAccountId: null + }); + }); + + it("OPEN stores the country and shows the accounts list", () => { + const actor = openedActor("CO"); + + expect(actor.getSnapshot().value).toEqual({ Open: "AccountsList" }); + expect(actor.getSnapshot().context.fiatRegistrationCountry).toBe("CO"); + }); + + it("selects an account while closed without opening the dialog", () => { + const actor = createFiatAccountActor(); + + actor.send({ id: "account-1", type: "SELECT_ACCOUNT" }); + + expect(actor.getSnapshot().value).toBe("Closed"); + expect(actor.getSnapshot().context.selectedFiatAccountId).toBe("account-1"); + }); + + it("selects an account from the accounts list", () => { + const actor = openedActor(); + + actor.send({ id: "account-2", type: "SELECT_ACCOUNT" }); + + expect(actor.getSnapshot().value).toEqual({ Open: "AccountsList" }); + expect(actor.getSnapshot().context.selectedFiatAccountId).toBe("account-2"); + }); + + it("GO_BACK from the accounts list closes the dialog and clears the country and selection", () => { + const actor = openedActor(); + actor.send({ id: "account-1", type: "SELECT_ACCOUNT" }); + + actor.send({ type: "GO_BACK" }); + + expect(actor.getSnapshot().value).toBe("Closed"); + expect(actor.getSnapshot().context.fiatRegistrationCountry).toBeNull(); + expect(actor.getSnapshot().context.selectedFiatAccountId).toBeNull(); + }); + + it("walks the registration flow: add new, pick a type, register, back to the list", () => { + const actor = openedActor(); + + actor.send({ type: "ADD_NEW" }); + expect(actor.getSnapshot().value).toEqual({ Open: "PickAccountType" }); + + actor.send({ accountType: "SPEI", type: "SELECT_ACCOUNT_TYPE" }); + expect(actor.getSnapshot().value).toEqual({ Open: "RegisterAccount" }); + expect(actor.getSnapshot().context.selectedAccountType).toBe("SPEI"); + + actor.send({ type: "REGISTER_DONE" }); + expect(actor.getSnapshot().value).toEqual({ Open: "AccountsList" }); + expect(actor.getSnapshot().context.selectedAccountType).toBeUndefined(); + }); + + it("GO_BACK steps back through the registration flow one screen at a time", () => { + const actor = openedActor(); + actor.send({ type: "ADD_NEW" }); + actor.send({ accountType: "WIRE", type: "SELECT_ACCOUNT_TYPE" }); + + actor.send({ type: "GO_BACK" }); + expect(actor.getSnapshot().value).toEqual({ Open: "PickAccountType" }); + // Stepping back does not clear the previously picked type. + expect(actor.getSnapshot().context.selectedAccountType).toBe("WIRE"); + + actor.send({ type: "GO_BACK" }); + expect(actor.getSnapshot().value).toEqual({ Open: "AccountsList" }); + }); +}); diff --git a/apps/frontend/src/test/fixtures.ts b/apps/frontend/src/test/fixtures.ts index 0adc8101b..427e37837 100644 --- a/apps/frontend/src/test/fixtures.ts +++ b/apps/frontend/src/test/fixtures.ts @@ -1,4 +1,15 @@ -import { EPaymentMethod, Networks, QuoteResponse, RampCurrency, RampDirection, RampPhase, RampProcess } from "@vortexfi/shared"; +import { + EPaymentMethod, + EvmTransactionData, + Networks, + QuoteResponse, + RampCurrency, + RampDirection, + RampPhase, + RampProcess, + SignedTypedData, + UnsignedTx +} from "@vortexfi/shared"; export function buildQuoteResponse(overrides: Partial = {}): QuoteResponse { return { @@ -31,6 +42,38 @@ export function buildQuoteResponse(overrides: Partial = {}): Quot }; } +export function buildEvmTransactionData(overrides: Partial = {}): EvmTransactionData { + return { + data: "0x", + gas: "21000", + to: "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + value: "0", + ...overrides + }; +} + +export function buildUnsignedTx(overrides: Partial = {}): UnsignedTx { + return { + meta: {}, + network: Networks.Base, + nonce: 0, + phase: "squidRouterSwap", + signer: "0x1111111111111111111111111111111111111111", + txData: buildEvmTransactionData(), + ...overrides + }; +} + +export function buildSignedTypedData(overrides: Partial = {}): SignedTypedData { + return { + domain: { name: "Permit2", verifyingContract: "0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", version: "1" }, + message: { amount: "1" }, + primaryType: "PermitTransferFrom", + types: { PermitTransferFrom: [{ name: "amount", type: "uint256" }] }, + ...overrides + }; +} + export function buildRampProcess(currentPhase: RampPhase, overrides: Partial = {}): RampProcess { return { createdAt: new Date().toISOString(), diff --git a/apps/frontend/vitest.config.ts b/apps/frontend/vitest.config.ts index 4fb4c28ff..aa8df3d61 100644 --- a/apps/frontend/vitest.config.ts +++ b/apps/frontend/vitest.config.ts @@ -24,8 +24,8 @@ export default defineConfig({ // last raised (enforced by `bun run test:coverage`, which CI runs). // Raise them as tested code grows; never lower them to make CI pass. thresholds: { - functions: 40, - lines: 24 + functions: 42, + lines: 25 } }, // Dummy values so src/config/supabase.ts (pulled in transitively via services/auth) From 9ffe25f59e59fb6c0603d5026a2b19286389208a Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 11:43:47 +0200 Subject: [PATCH 146/176] Add a full BRL onramp E2E journey MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit One Playwright journey drives the real frontend from quote through email/OTP auth, the Avenia KYC gate, ramp registration, in-page ephemeral signing (asserted via the six signed EIP-1559 txs posted to /v1/ramp/update), the Pix payment screen, progress polling, and the success page — fully hermetic. mockBackend gains the auth, BRLA KYC and ramp register/update/start/status endpoints (shapes mirrored from the real controllers) plus local JSON-RPC answers for Base; mockWallet handles the transaction-level EIP-1193 requests. BRL onramps have no user-wallet signature prompt by design (Pix pays in, ephemerals sign), so signing is asserted at the presign layer. --- apps/frontend/e2e/onramp-brl-journey.spec.ts | 101 +++++++++ apps/frontend/e2e/support/mockBackend.ts | 204 ++++++++++++++++++- apps/frontend/e2e/support/mockWallet.ts | 17 ++ 3 files changed, 319 insertions(+), 3 deletions(-) create mode 100644 apps/frontend/e2e/onramp-brl-journey.spec.ts diff --git a/apps/frontend/e2e/onramp-brl-journey.spec.ts b/apps/frontend/e2e/onramp-brl-journey.spec.ts new file mode 100644 index 000000000..ba2553108 --- /dev/null +++ b/apps/frontend/e2e/onramp-brl-journey.spec.ts @@ -0,0 +1,101 @@ +import { expect, test } from "@playwright/test"; +import { E2E_DEPOSIT_QR_CODE, E2E_RAMP_ID, mockBackend } from "./support/mockBackend"; +import { injectMockWallet, MOCK_WALLET_ADDRESS } from "./support/mockWallet"; + +// Structurally valid CPF (passes the checksum in isValidCpf). +const VALID_CPF = "529.982.247-25"; + +// Critical journey 4: a full BUY (onramp) BRL ramp against the mocked backend. +// +// quote -> Buy -> email/OTP auth -> Avenia eligibility details (CPF + wallet) -> KYC gate +// (existing CONFIRMED user, so no full Avenia KYC flow) -> payment summary -> ramp +// registration -> local ephemeral-key signing + /ramp/update -> Pix deposit QR -> "I have +// made the payment" -> /ramp/start -> progress page -> success page once polling reports +// COMPLETE. +// +// Notes on coverage limits: +// - A BRL onramp has no user wallet signature step: every unsigned transaction returned by +// /ramp/register is signed in-page with the throwaway ephemeral keys (viem/polkadot, fully +// local; only eth_chainId RPCs leave the page and are answered by mockBackend). We assert +// that signing happened via the presignedTxs posted to /ramp/update. The injected mock +// wallet still drives the connected-account state and would answer eth_sendTransaction / +// eth_signTypedData_v4 if a journey required it (offramps do). +// - The full Avenia KYC flow (document upload + selfie liveness) is not exercised: the +// liveness check opens an external Avenia-hosted URL in a separate window, which cannot be +// completed hermetically. The mocked /brla/getUser instead reports an existing +// KYC-confirmed user, which is the KYC gate's happy path. +test("BUY BRL journey: quote, auth, KYC gate, registration, signing, Pix QR, progress, success", async ({ page }) => { + const backend = await mockBackend(page); + await injectMockWallet(page); + + await page.goto("/widget?rampType=BUY&fiat=BRL&inputAmount=100"); + + // Stage 1: the quote form fetched a quote; Buy becomes actionable. + await expect(page.locator('input[name="outputAmount"]')).toHaveValue(/25\.5/, { timeout: 20_000 }); + await page.locator("form").getByRole("button", { name: "Buy" }).click(); + + // Stage 2: auth gate - email step. + await expect(page.getByRole("heading", { name: "Verify Your Email" })).toBeVisible({ timeout: 20_000 }); + await page.locator("#email").fill("e2e@vortexfinance.co"); + await page.locator("#terms").check(); + await page.getByRole("button", { name: "Continue" }).click(); + + // Stage 3: auth gate - OTP step; entering the 6th digit submits automatically. + await expect(page.getByRole("heading", { name: "Enter Verification Code" })).toBeVisible({ timeout: 20_000 }); + await page.locator('input[autocomplete="one-time-code"]').pressSequentially("123456"); + + // Stage 4: Avenia eligibility details (CPF + wallet address). The wallet field is + // auto-filled from the injected mock wallet once wagmi reconnects to it. + await expect(page.locator("#taxId")).toBeVisible({ timeout: 20_000 }); + await expect(page.locator("#walletAddress")).toHaveValue(MOCK_WALLET_ADDRESS, { timeout: 20_000 }); + await page.locator("#taxId").fill(VALID_CPF); + await page.locator("form").getByRole("button", { name: "Continue" }).click(); + + // Stage 5: the KYC gate queried the backend for the CPF and, since the user is + // CONFIRMED, the flow lands on the payment summary. + await expect(page.getByRole("heading", { name: "Payment Summary" })).toBeVisible({ timeout: 20_000 }); + expect(backend.brlaGetUserRequests).toContain(VALID_CPF); + + // Stage 6: confirming registers the ramp, signs the returned transactions with the + // ephemeral keys, updates the ramp, and surfaces the Pix payment instructions. + await page.getByRole("button", { name: "Confirm" }).click(); + await expect(page.getByText("Pay with Pix")).toBeVisible({ timeout: 30_000 }); + + // The registration carried the quote and both ephemeral signing accounts... + expect(backend.registerRequests).toHaveLength(1); + const registerBody = backend.registerRequests[0] as { + quoteId: string; + signingAccounts: Array<{ type: string }>; + additionalData?: { destinationAddress?: string; taxId?: string }; + }; + expect(registerBody.quoteId).toBe("quote-e2e-1"); + expect(registerBody.signingAccounts.map(account => account.type).sort()).toEqual(["EVM", "Substrate"]); + + // ...and every unsigned transaction came back locally signed (serialized raw txs) in /ramp/update. + expect(backend.updateRequests).toHaveLength(1); + const presignedTxs = (backend.updateRequests[0] as { presignedTxs: Array<{ txData: unknown; phase: string }> }).presignedTxs; + expect(presignedTxs.length).toBe(6); + for (const tx of presignedTxs) { + expect(typeof tx.txData).toBe("string"); + expect(tx.txData as string).toMatch(/^0x02/); // EIP-1559 raw transaction + } + + // The Pix BR code is shown as copyable text alongside the QR, and the submit slot now + // asks for payment confirmation. + await expect(page.getByText(E2E_DEPOSIT_QR_CODE)).toBeVisible(); + const paymentButton = page.getByRole("button", { name: "I have made the payment" }); + await expect(paymentButton).toBeEnabled(); + + // Stage 7: confirming the payment starts the ramp and shows the progress screen. + await paymentButton.click(); + await expect(page.getByText("Your payment is being processed. This can take up to 5 minutes.")).toBeVisible({ + timeout: 20_000 + }); + expect(backend.startRequests).toHaveLength(1); + expect(backend.startRequests[0]).toMatchObject({ rampId: E2E_RAMP_ID }); + + // Stage 8: once status polling reports COMPLETE, the success screen appears. + await expect(page.getByRole("heading", { name: "All set! Your tokens are on their way." })).toBeVisible({ + timeout: 30_000 + }); +}); diff --git a/apps/frontend/e2e/support/mockBackend.ts b/apps/frontend/e2e/support/mockBackend.ts index b571110f6..b1b7d8dda 100644 --- a/apps/frontend/e2e/support/mockBackend.ts +++ b/apps/frontend/e2e/support/mockBackend.ts @@ -32,10 +32,75 @@ export function buildQuoteResponse(overrides: Record = {}) { }; } +export const E2E_RAMP_ID = "ramp-e2e-1"; +export const E2E_USER_ID = "user-e2e-1"; +// Plausible static Pix "copia e cola" BR Code, as returned by the API in RampProcess.depositQrCode. +export const E2E_DEPOSIT_QR_CODE = + "00020126390014br.gov.bcb.pix0117vortex@example.com5204000053039865406100.005802BR5906VORTEX6009SAO PAULO62140510ramp2e2e0163049B2D"; + +const BASE_USDC = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"; + +// One unsigned EVM transaction as produced by the API's avenia-to-evm-base onramp route +// (see apps/api/src/api/services/transactions/onramp/routes/avenia-to-evm-base.ts): +// EvmTransactionData on Base, signed by the EVM ephemeral account. +function buildUnsignedEvmTx(signer: string, nonce: number, phase: string) { + return { + meta: {}, + network: "base", + nonce, + phase, + signer, + txData: { + data: `0xa9059cbb${"00".repeat(12)}${signer.slice(2).toLowerCase()}${"00".repeat(30)}04c4`, + gas: "150000", + maxFeePerGas: "2000000000", + maxPriorityFeePerGas: "1000000000", + nonce, + to: BASE_USDC, + value: "0" + } + }; +} + +// Mirrors RampProcess (packages/shared/src/endpoints/ramp.endpoints.ts) for a BUY BRL -> Base USDC ramp. +export function buildRampProcess(overrides: Record = {}) { + return { + createdAt: new Date().toISOString(), + currentPhase: "initial", + depositQrCode: E2E_DEPOSIT_QR_CODE, + from: "pix", + id: E2E_RAMP_ID, + inputAmount: "100", + inputCurrency: "BRL", + outputAmount: "25.5", + outputCurrency: "USDC", + paymentMethod: "pix", + quoteId: "quote-e2e-1", + to: "base", + type: "BUY", + unsignedTxs: [], + updatedAt: new Date().toISOString(), + ...overrides + }; +} + +// Phases mirror the real BRL -> USDC-on-Base onramp preparation (all Base txs signed by the EVM ephemeral). +const ONRAMP_TX_PHASES = [ + "nablaApprove", + "nablaSwap", + "distributeFees", + "destinationTransfer", + "baseCleanupBrla", + "baseCleanupUsdc" +]; + interface MockBackendOptions { // Called for POST /v1/quotes; return a JSON body + status. Defaults to echoing the // request into a successful quote. quotes?: (requestBody: Record) => { status: number; body: unknown }; + // How many GET /v1/ramp/:id polls report an in-progress ramp before flipping to COMPLETE. + // Default 1: the progress page's immediate poll sees PENDING, the next one (after ~5s) sees COMPLETE. + pendingStatusPolls?: number; } // Intercepts all traffic to the API origin (http://localhost:3000) so journeys run @@ -44,12 +109,24 @@ interface MockBackendOptions { // fallbacks for all of them. export async function mockBackend(page: Page, options: MockBackendOptions = {}) { const quoteRequests: Array> = []; + const brlaGetUserRequests: string[] = []; + const registerRequests: Array> = []; + const updateRequests: Array> = []; + const startRequests: Array> = []; + + // The last successfully created quote, served back on GET /v1/quotes/:id. + let lastQuote: Record | undefined; + let statusPollCount = 0; await page.route("http://localhost:3000/**", async route => { const request = route.request(); const url = new URL(request.url()); + const path = url.pathname; + const method = request.method(); + + const fulfillJson = (body: unknown, status = 200) => route.fulfill({ json: body as object, status }); - if (url.pathname === "/v1/quotes" && request.method() === "POST") { + if (path === "/v1/quotes" && method === "POST") { const body = request.postDataJSON() as Record; quoteRequests.push(body); const result = options.quotes?.(body) ?? { @@ -61,18 +138,139 @@ export async function mockBackend(page: Page, options: MockBackendOptions = {}) }), status: 200 }; - await route.fulfill({ json: result.body as object, status: result.status }); + if (result.status === 200) { + lastQuote = result.body as Record; + } + await fulfillJson(result.body, result.status); + return; + } + + if (path.startsWith("/v1/quotes/") && method === "GET") { + const quoteId = path.split("/").pop() as string; + await fulfillJson(lastQuote?.id === quoteId ? lastQuote : buildQuoteResponse({ id: quoteId })); + return; + } + + // Auth: email/OTP login (shapes mirror apps/api/src/api/controllers/auth.controller.ts). + if (path === "/v1/auth/check-email" && method === "GET") { + await fulfillJson({ action: "signup", exists: false }); + return; + } + if (path === "/v1/auth/request-otp" && method === "POST") { + await fulfillJson({ message: "OTP sent" }); + return; + } + if (path === "/v1/auth/verify-otp" && method === "POST") { + await fulfillJson({ + access_token: "e2e-access-token", + refresh_token: "e2e-refresh-token", + success: true, + user_id: E2E_USER_ID + }); + return; + } + if (path === "/v1/auth/verify" && method === "POST") { + await fulfillJson({ user_id: E2E_USER_ID, valid: true }); + return; + } + if (path === "/v1/auth/refresh" && method === "POST") { + await fulfillJson({ access_token: "e2e-access-token", refresh_token: "e2e-refresh-token", success: true }); + return; + } + + // Avenia/BRLA KYC gate: an existing, KYC-confirmed user (BrlaGetUserResponse shape), + // so validateKyc reports kycNeeded=false and the ramp can proceed to the summary. + if (path === "/v1/brla/getUser" && method === "GET") { + brlaGetUserRequests.push(url.searchParams.get("taxId") ?? ""); + await fulfillJson({ + evmAddress: "0x9d1B0C3A79cB3F44a03cC7C39a54Db19E22C6A9E", + identityStatus: "CONFIRMED", + kycLevel: 1, + subAccountId: "subaccount-e2e-1" + }); + return; + } + if (path === "/v1/brla/getUserRemainingLimit" && method === "GET") { + await fulfillJson({ remainingLimit: 100000 }); + return; + } + + // Ramp lifecycle (RampProcess shapes from packages/shared/src/endpoints/ramp.endpoints.ts). + if (path === "/v1/ramp/register" && method === "POST") { + const body = request.postDataJSON() as { + signingAccounts?: Array<{ address: string; type: string }>; + } & Record; + registerRequests.push(body); + const evmEphemeral = body.signingAccounts?.find(account => account.type === "EVM")?.address ?? BASE_USDC; + await fulfillJson( + buildRampProcess({ + unsignedTxs: ONRAMP_TX_PHASES.map((phase, index) => buildUnsignedEvmTx(evmEphemeral, index, phase)) + }) + ); + return; + } + if (path === "/v1/ramp/update" && method === "POST") { + updateRequests.push(request.postDataJSON() as Record); + await fulfillJson(buildRampProcess()); + return; + } + if (path === "/v1/ramp/start" && method === "POST") { + startRequests.push(request.postDataJSON() as Record); + await fulfillJson(buildRampProcess({ currentPhase: "brlaOnrampMint", status: "PENDING" })); + return; + } + if (path === `/v1/ramp/${E2E_RAMP_ID}` && method === "GET") { + statusPollCount++; + const complete = statusPollCount > (options.pendingStatusPolls ?? 1); + // GetRampStatusResponse = RampProcess + fee breakdown fields. + await fulfillJson( + buildRampProcess({ + anchorFeeFiat: "0.5", + anchorFeeUsd: "0.1", + currentPhase: complete ? "complete" : "brlaOnrampMint", + feeCurrency: "BRL", + networkFeeFiat: "0.2", + networkFeeUsd: "0.04", + partnerFeeFiat: "0", + partnerFeeUsd: "0", + processingFeeFiat: "0.5", + processingFeeUsd: "0.1", + status: complete ? "COMPLETE" : "PENDING", + totalFeeFiat: "0.7", + totalFeeUsd: "0.14", + vortexFeeFiat: "0", + vortexFeeUsd: "0" + }) + ); return; } await route.fulfill({ json: {}, status: 404 }); }); + // The frontend pre-signs the ephemeral-account transactions locally with viem, which + // issues eth_chainId to the network's RPC before signing (signing itself is offline). + // Answer those RPC calls hermetically for Base (0x2105). + const answerRpc = (body: { id?: number; method?: string } | Array<{ id?: number; method?: string }>) => { + const answerOne = (req: { id?: number; method?: string }) => ({ + id: req.id ?? 1, + jsonrpc: "2.0", + result: req.method === "eth_chainId" ? "0x2105" : null + }); + return Array.isArray(body) ? body.map(answerOne) : answerOne(body); + }; + for (const rpcPattern of ["https://base-mainnet.g.alchemy.com/**", "https://mainnet.base.org/**"]) { + await page.route(rpcPattern, async route => { + const body = route.request().postDataJSON() as Parameters[0]; + await route.fulfill({ json: answerRpc(body) }); + }); + } + // SquidRouter token list: the app falls back to its static token config on failure. await page.route("https://v2.api.squidrouter.com/**", route => route.abort()); // WalletConnect/AppKit remote config and telemetry. await page.route("https://api.web3modal.org/**", route => route.abort()); await page.route("https://pulse.walletconnect.org/**", route => route.abort()); - return { quoteRequests }; + return { brlaGetUserRequests, quoteRequests, registerRequests, startRequests, updateRequests }; } diff --git a/apps/frontend/e2e/support/mockWallet.ts b/apps/frontend/e2e/support/mockWallet.ts index fc894fbcc..6dd4ad9d3 100644 --- a/apps/frontend/e2e/support/mockWallet.ts +++ b/apps/frontend/e2e/support/mockWallet.ts @@ -40,6 +40,23 @@ export async function injectMockWallet(page: Page) { case "personal_sign": case "eth_signTypedData_v4": return `0x${"ab".repeat(65)}`; + // Journeys that submit user transactions (e.g. offramp squidRouter steps) + // get a plausible transaction hash back without touching a chain. + case "eth_sendTransaction": + return `0x${"cd".repeat(32)}`; + case "eth_getTransactionReceipt": + return { + blockHash: `0x${"ef".repeat(32)}`, + blockNumber: "0x1", + status: "0x1", + transactionHash: `0x${"cd".repeat(32)}` + }; + case "eth_estimateGas": + return "0x5208"; + case "eth_gasPrice": + return "0x3b9aca00"; + case "eth_getTransactionCount": + return "0x0"; case "eth_getBalance": return "0xde0b6b3a7640000"; // 1 ETH case "eth_blockNumber": From 655d960bc3cea16f934923ea459c297df95156c1 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 11:43:57 +0200 Subject: [PATCH 147/176] Update the testing strategy for the new corridor and journey coverage Documents the BRL offramp swap corridor, the Alfredpay USD/COP/ARS matrix, the end-to-end subsidy-cap breach tests (F-001), the frontend actor-test layer, the BRL onramp E2E journey, and the decision that Pendulum/AssetHub/XCM corridors are deliberately untested (the product no longer supports them; code is kept only for possible re-addition). All 13 Phase-3 mutation checks from the integrity brief (plus three subsidy-cap mutations) were run against this suite: every one was caught by exactly the intended test. --- docs/testing-strategy.md | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/docs/testing-strategy.md b/docs/testing-strategy.md index 69f5a95c1..196b4e7cb 100644 --- a/docs/testing-strategy.md +++ b/docs/testing-strategy.md @@ -19,9 +19,9 @@ together with the shared test harness (`apps/api/src/test-utils`) — see "How t |---|---|---|---| | 1. Unit | Pure logic: helpers, token configs, SDK handlers | each package, next to source | `bun test` (Vitest for frontend) | | 2. API integration | Real Express + real Postgres + fake external world, driven over HTTP; incl. the quote pricing goldens (`quote-pricing.golden.test.ts`) | `apps/api/src/tests/` | `bun test` | -| 3. Corridor scenarios | Phase processor end-to-end per corridor against the fake world (BRL pix→BRLA-on-Base, MXN spei→USDT-on-Polygon) | `apps/api/src/tests/corridors/` | `bun test` | +| 3. Corridor scenarios | Phase processor end-to-end per corridor against the fake world: BRL onramp (pix→BRLA-on-Base), BRL offramp (USDC-on-Base→pix incl. real Nabla swap + both EVM subsidy phases), MXN on/offramp (spei↔USDT-on-Polygon), and a USD/COP/ARS happy-path matrix over the same Alfredpay rails | `apps/api/src/tests/corridors/` | `bun test` | | 4. SDK contract | Real SDK against the real API in-process | `apps/api/src/tests/sdk-contract.test.ts` | `bun test` | -| 5. Frontend | XState machine tests, component tests (RTL + MSW + mock wagmi) | `apps/frontend/src` | Vitest | +| 5. Frontend | XState machine tests, actor tests (register/sign/start/KYC-routing against MSW with mocked wallet seams), component tests (RTL + MSW + mock wagmi) | `apps/frontend/src` | Vitest | | 6. E2E | Few critical Playwright journeys with a mock wallet | `apps/frontend/e2e/` | Playwright (non-blocking) | ### The invariants the suite protects @@ -32,7 +32,9 @@ Derived from `docs/security-spec/` — these must never regress, and each has de - Fees are fixed at quote creation (`metadata.fees`) and identical at registration time; no client-supplied fee is accepted. - Subsidy caps are enforced (pre-swap, post-swap, `MAX_FINAL_SETTLEMENT_SUBSIDY_USD`) — a breach - throws instead of paying out (finding F-001). + throws instead of paying out (finding F-001). Each of the three caps has an end-to-end breach + test: pre- and post-swap in `corridors/brl-offramp.scenario.test.ts`, the final-settlement cap + in `corridors/mxn-offramp.scenario.test.ts`. - Ownership guards: a partner only sees its own quotes/ramps; a user only their own (F-068 class). - Phase processor: retries are bounded (`MAX_RETRIES`); after exhaustion of a recoverable error the processor stops without a terminal transition, releasing the lock and leaving the ramp @@ -66,6 +68,12 @@ Decision: we deliberately do **not** run Anvil/fork-based EVM tests in CI. Fork upstream RPC (flaky public endpoints or a paid key as a CI secret). If calldata-level fidelity ever becomes a problem, add a non-blocking nightly Anvil job — do not put it in the PR path. +Decision: Pendulum/AssetHub/XCM ramp corridors are **deliberately not tested**. Vortex no longer +supports those flows as a product; the route strategies and substrate handlers that still +reference them are kept only in case support is re-added later. Do not count them as coverage +gaps and do not build a substrate fake for them — if the flows come back, that is the moment to +add corridor scenarios (and the fake) for them. + ### Database API integration tests run against a real Postgres (Docker locally, service container in CI), @@ -81,8 +89,11 @@ hand-write these objects or copy JSON snapshots into tests; extend the factory i ### Playwright E2E (`apps/frontend/e2e/`) -A handful of critical journeys (quote form → quote displayed, quote error surfaced, wallet -gate on offramps) run against the real frontend in Chromium, hermetically: +A handful of critical journeys run against the real frontend in Chromium, hermetically: quote +form → quote displayed, quote error surfaced, wallet gate on offramps, and one full BRL onramp +journey (`onramp-brl-journey.spec.ts`: quote → email/OTP auth → Avenia KYC gate → registration → +in-page ephemeral signing asserted via the presigned txs posted to `/v1/ramp/update` → Pix +payment info → progress → success): - The API origin (`http://localhost:3000`) is intercepted per-test with `page.route` (`e2e/support/mockBackend.ts`) — no backend, database, or chain access. From 5343203ff37161621862331281eea7bd4eba37fb Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 11:48:40 +0200 Subject: [PATCH 148/176] Fix the dead KYC-invalid branch in the validateKyc actor The check read err.error, but ApiError carries the server message under err.data.error, so it never matched. It also sat below the valid-CPF branch, which always wins for existing users and wrongly recorded an initial KYC attempt. Check the ApiError shape first and cover the branch with a test against the real 400 response. --- .../machines/actors/validateKyc.actor.test.ts | 20 +++++++++++++++++++ .../src/machines/actors/validateKyc.actor.ts | 15 ++++++++------ 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/apps/frontend/src/machines/actors/validateKyc.actor.test.ts b/apps/frontend/src/machines/actors/validateKyc.actor.test.ts index f3d4e230e..aef6c91ea 100644 --- a/apps/frontend/src/machines/actors/validateKyc.actor.test.ts +++ b/apps/frontend/src/machines/actors/validateKyc.actor.test.ts @@ -116,6 +116,26 @@ describe("validateKycActor", () => { await vi.waitFor(() => expect(recordCalls).toHaveLength(1)); }); + it("requires KYC re-verification when the API reports KYC invalid, without recording an initial attempt", async () => { + server.use( + http.get(`${API_BASE_URL}/brla/getUser`, () => + HttpResponse.json({ evmAddress: "0xbrla", identityStatus: "REJECTED", subAccountId: "sub-1" }) + ), + http.get(`${API_BASE_URL}/brla/getUserRemainingLimit`, () => + HttpResponse.json({ error: "KYC invalid" }, { status: 400 }) + ) + ); + const recordCalls = mockRecordAttemptEndpoint(); + + const result = await validateKycActor({ input: buildContext(FiatToken.BRL) }); + + expect(result).toEqual({ kycNeeded: true }); + // The user exists (valid CPF), so a wrong branch order would fire recordInitialKycAttempt; + // it is fire-and-forget, so give any stray request a beat to land before asserting absence. + await new Promise(resolve => setTimeout(resolve, 25)); + expect(recordCalls).toHaveLength(0); + }); + it("checks the input amount against the limit for BUY ramps", async () => { mockBrlaUser({ evmAddress: "0xbrla", identityStatus: "CONFIRMED" }, "200"); const context = buildContext(FiatToken.BRL, { rampDirection: RampDirection.BUY }); diff --git a/apps/frontend/src/machines/actors/validateKyc.actor.ts b/apps/frontend/src/machines/actors/validateKyc.actor.ts index 547c293cf..f9f89dd6a 100644 --- a/apps/frontend/src/machines/actors/validateKyc.actor.ts +++ b/apps/frontend/src/machines/actors/validateKyc.actor.ts @@ -1,6 +1,6 @@ -import { BrlaErrorResponse, FiatToken, isAlfredpayToken, isValidCnpj, isValidCpf, RampDirection } from "@vortexfi/shared"; +import { FiatToken, isAlfredpayToken, isValidCnpj, isValidCpf, RampDirection } from "@vortexfi/shared"; -import { BrlaService } from "../../services/api"; +import { BrlaService, isApiError } from "../../services/api"; import { RampContext } from "../types"; interface ValidateKycResult { @@ -64,15 +64,18 @@ export const validateKycActor = async ({ input }: { input: RampContext }): Promi return { brlaEvmAddress, kycNeeded: false }; } catch (err) { - const errorResponse = err as BrlaErrorResponse; + // "KYC invalid" comes from the remaining-limit endpoint for an existing user whose + // identity check failed, so it must win over the valid-CPF "user doesn't exist yet" + // branch below — that one would wrongly record an initial KYC attempt. + if (isApiError(err) && err.data.error?.includes("KYC invalid")) { + console.log("User KYC is invalid. Needs KYC."); + return { kycNeeded: true }; + } if (isValidCpf(taxId) || isValidCnpj(taxId)) { console.log("User doesn't exist yet. Needs KYC."); BrlaService.recordInitialKycAttempt(taxId, quoteId, externalSessionId); return { kycNeeded: true }; - } else if (errorResponse.error?.includes("KYC invalid")) { - console.log("User KYC is invalid. Needs KYC."); - return { kycNeeded: true }; } console.error("Error while fetching BRLA user in KYC check", err); throw err; From a26cec53dc6cebb774f9179a2b5a0c4c147bbaaf Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 11:55:10 +0200 Subject: [PATCH 149/176] Surface the BRL remaining-limit error instead of routing into KYC The over-limit throw in validateKycActor was swallowed by its own catch block: a valid CPF fell into the user-doesn't-exist branch, silently returning kycNeeded and recording a spurious initial KYC attempt. Throw a dedicated RampLimitExceededError, rethrow it past the catch, and give RampRequested.onError a guarded branch that stores the message in initializeFailedMessage so RampErrorMessage shows it in the widget. --- .../machines/actors/validateKyc.actor.test.ts | 13 ++++++------- .../src/machines/actors/validateKyc.actor.ts | 18 +++++++++++++++--- .../frontend/src/machines/ramp.machine.test.ts | 16 ++++++++++++++++ apps/frontend/src/machines/ramp.machine.ts | 15 +++++++++++++-- 4 files changed, 50 insertions(+), 12 deletions(-) diff --git a/apps/frontend/src/machines/actors/validateKyc.actor.test.ts b/apps/frontend/src/machines/actors/validateKyc.actor.test.ts index aef6c91ea..b8d1d8918 100644 --- a/apps/frontend/src/machines/actors/validateKyc.actor.test.ts +++ b/apps/frontend/src/machines/actors/validateKyc.actor.test.ts @@ -5,7 +5,7 @@ import { describe, expect, it, vi } from "vitest"; import { buildQuoteResponse } from "../../test/fixtures"; import { API_BASE_URL, server } from "../../test/msw-server"; import { RampContext } from "../types"; -import { validateKycActor } from "./validateKyc.actor"; +import { RampLimitExceededError, validateKycActor } from "./validateKyc.actor"; // Structurally valid, non-trivial CPF (11 digits). const VALID_CPF = "52998224725"; @@ -104,16 +104,15 @@ describe("validateKycActor", () => { expect(recordCalls[0]).toEqual({ quoteId: "quote-1", sessionId: "session-1", taxId: VALID_CPF }); }); - // The over-limit throw is swallowed by the surrounding catch: with a structurally valid - // CPF the actor falls through to "user needs KYC" instead of surfacing the limit error. - it("treats an exceeded remaining limit as a new KYC attempt for a valid CPF", async () => { + it("throws a RampLimitExceededError when the amount exceeds the remaining limit, without recording a KYC attempt", async () => { mockBrlaUser({ evmAddress: "0xbrla", identityStatus: "CONFIRMED" }, "10"); const recordCalls = mockRecordAttemptEndpoint(); - const result = await validateKycActor({ input: buildContext(FiatToken.BRL) }); + await expect(validateKycActor({ input: buildContext(FiatToken.BRL) })).rejects.toThrow(RampLimitExceededError); - expect(result).toEqual({ kycNeeded: true }); - await vi.waitFor(() => expect(recordCalls).toHaveLength(1)); + // An exceeded limit is not a KYC problem; give any stray fire-and-forget request a beat to land. + await new Promise(resolve => setTimeout(resolve, 25)); + expect(recordCalls).toHaveLength(0); }); it("requires KYC re-verification when the API reports KYC invalid, without recording an initial attempt", async () => { diff --git a/apps/frontend/src/machines/actors/validateKyc.actor.ts b/apps/frontend/src/machines/actors/validateKyc.actor.ts index f9f89dd6a..f542e51b0 100644 --- a/apps/frontend/src/machines/actors/validateKyc.actor.ts +++ b/apps/frontend/src/machines/actors/validateKyc.actor.ts @@ -8,6 +8,13 @@ interface ValidateKycResult { brlaEvmAddress?: string; } +export class RampLimitExceededError extends Error { + constructor() { + super("Insufficient remaining limit for this transaction."); + this.name = "RampLimitExceededError"; + } +} + export const validateKycActor = async ({ input }: { input: RampContext }): Promise => { const { executionInput, rampDirection, quoteId, externalSessionId } = input; console.log("Validating KYC with input:", input); @@ -51,9 +58,8 @@ export const validateKycActor = async ({ input }: { input: RampContext }): Promi const remainingLimitNum = Number(remainingLimitResponse.remainingLimit); if (amountNum > remainingLimitNum) { - // Avenia-Migration: this must be changed. No more levels. TOAST? - // We don't know of a possibility to increase limits so far. - throw new Error("Insufficient remaining limit for this transaction."); + // We don't know of a possibility to increase Avenia limits so far. + throw new RampLimitExceededError(); } // Only skip KYC if identity is confirmed - handles case where user created subaccount but didn't complete KYC @@ -64,6 +70,12 @@ export const validateKycActor = async ({ input }: { input: RampContext }): Promi return { brlaEvmAddress, kycNeeded: false }; } catch (err) { + // An exceeded limit is not a KYC problem — let it reach the machine's error path + // instead of falling into the valid-CPF "needs KYC" branch below. + if (err instanceof RampLimitExceededError) { + throw err; + } + // "KYC invalid" comes from the remaining-limit endpoint for an existing user whose // identity check failed, so it must win over the valid-CPF "user doesn't exist yet" // branch below — that one would wrongly record an initial KYC attempt. diff --git a/apps/frontend/src/machines/ramp.machine.test.ts b/apps/frontend/src/machines/ramp.machine.test.ts index 6e5ba499b..9831c1288 100644 --- a/apps/frontend/src/machines/ramp.machine.test.ts +++ b/apps/frontend/src/machines/ramp.machine.test.ts @@ -16,6 +16,7 @@ import { CheckEmailResponse, VerifyOTPResponse } from "../services/api/auth.api" import { AuthService, type AuthTokens } from "../services/auth"; import { RampExecutionInput } from "../types/phases"; import { SignRampError, SignRampErrorType } from "./actors/sign.actor"; +import { RampLimitExceededError } from "./actors/validateKyc.actor"; import { aveniaKycMachine } from "./brlaKyc.machine"; import { MykoboKycMachineError, MykoboKycMachineErrorType, mykoboKycMachine } from "./mykoboKyc.machine"; import { RampContext, RampMachineEvents, RampState } from "./types"; @@ -374,6 +375,21 @@ describe("rampMachine", () => { await confirmRamp(actor); await waitFor(actor, s => s.matches("Idle")); + expect(actor.getSnapshot().context.initializeFailedMessage).toBeUndefined(); + }); + + it("an exceeded ramp limit returns to Idle with the limit error message", async () => { + const actor = createRampActor({ + validateKyc: fromPromise(async (): Promise => { + throw new RampLimitExceededError(); + }) + }); + actor.start(); + await goToQuoteReady(actor); + await confirmRamp(actor, FiatToken.BRL); + + await waitFor(actor, s => s.matches("Idle")); + expect(actor.getSnapshot().context.initializeFailedMessage).toBe("Insufficient remaining limit for this transaction."); }); it("redirects to the callback URL after starting a ramp and returns to Idle after the delay", async () => { diff --git a/apps/frontend/src/machines/ramp.machine.ts b/apps/frontend/src/machines/ramp.machine.ts index f589d67c5..a0e664121 100644 --- a/apps/frontend/src/machines/ramp.machine.ts +++ b/apps/frontend/src/machines/ramp.machine.ts @@ -8,7 +8,7 @@ import { checkEmailActor, requestOTPActor, verifyOTPActor } from "./actors/auth. import { registerRampActor } from "./actors/register.actor"; import { SignRampError, SignRampErrorType, signTransactionsActor } from "./actors/sign.actor"; import { startRampActor } from "./actors/start.actor"; -import { validateKycActor } from "./actors/validateKyc.actor"; +import { RampLimitExceededError, validateKycActor } from "./actors/validateKyc.actor"; import { alfredpayKycMachine } from "./alfredpayKyc.machine"; import { aveniaKycMachine } from "./brlaKyc.machine"; import { kycStateNode } from "./kyc.states"; @@ -625,7 +625,18 @@ export const rampMachine = setup({ target: "KycComplete" } ], - onError: "Idle", + onError: [ + { + // An exceeded Avenia limit is a user-facing error, not a KYC redirect; + // RampErrorMessage renders initializeFailedMessage in the widget. + actions: assign({ + initializeFailedMessage: ({ event }) => getActorErrorMessage(event) + }), + guard: ({ event }) => event.error instanceof RampLimitExceededError, + target: "Idle" + }, + { target: "Idle" } + ], src: "validateKyc" }, on: { From a8c0215a90885f38ce8cc5c4dfc6c6c49f1c50d1 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 13:20:49 +0200 Subject: [PATCH 150/176] Close the cross-corridor and entry-point coverage gaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Corridor scenarios: cross-chain BRL offramp (USDC on Polygon → squid → Base → pix, incl. user-reported squid-hash verification and an F-021 tampered-calldata regression) and cross-chain MXN onramp (spei → Polygon mint → squid → USDT on Arbitrum), the first real coverage of the squidRouterSwap/squidRouterPay handlers and the Arbitrum settlement subsidy. The USD/COP/ARS matrix gains per-currency limit-breach, transient-recovery, and unrecoverable-FAILED cases. SDK contract: a SELL lifecycle driven end to end through the real SDK (registerRamp → submitUserTransactions → startRamp → complete), the typed updateRamp hash-reporting path, getQuote, and listAlfredpayFiatAccounts. packages/sdk now carries its own coverage ratchet, wired into the root script and CI. Frontend: ramp.machine tests now spawn the Alfredpay KYC child for all four currencies (country routing, error output, SummaryConfirm forwarding) plus the Avenia child; a SELL-shaped sign.actor test proves ephemeral phases never reach the user wallet. Two new Playwright journeys cover the BRL offramp (user-wallet broadcast + hash reporting) and the MXN onramp (Alfredpay KYC gate + SPEI payment details). HTTP surface: the email/OTP auth flow, webhook register/delete, ramp history ownership, and public routes are now driven over HTTP; the fake Supabase auth grew a full in-memory OTP flow and the fake world gained squid route/status and Alfredpay fiat-account fakes. Coverage floors raised: api 0.48/0.59 → 0.52/0.62, frontend 25/42 → 25.8/43; sdk gated at 0.32/0.15. --- .github/workflows/ci.yml | 3 + apps/api/package.json | 2 +- .../src/test-utils/fake-world/fake-anchors.ts | 7 +- .../src/test-utils/fake-world/fake-auth.ts | 83 +++- .../test-utils/fake-world/fake-squidrouter.ts | 28 +- .../alfredpay-currencies.scenario.test.ts | 201 ++++++++ .../brl-offramp-crosschain.scenario.test.ts | 437 ++++++++++++++++++ .../mxn-onramp-crosschain.scenario.test.ts | 425 +++++++++++++++++ .../src/tests/http-surface.invariants.test.ts | 261 +++++++++++ .../src/tests/sdk-contract.offramp.test.ts | 340 ++++++++++++++ apps/frontend/e2e/offramp-brl-journey.spec.ts | 163 +++++++ apps/frontend/e2e/onramp-mxn-journey.spec.ts | 139 ++++++ apps/frontend/e2e/support/mockBackend.ts | 131 +++++- apps/frontend/playwright.config.ts | 3 + .../src/machines/actors/sign.actor.test.ts | 22 + .../src/machines/ramp.machine.test.ts | 98 ++++ apps/frontend/vitest.config.ts | 4 +- docs/testing-strategy.md | 25 +- package.json | 2 +- packages/sdk/bunfig.toml | 6 + packages/sdk/package.json | 1 + 21 files changed, 2342 insertions(+), 39 deletions(-) create mode 100644 apps/api/src/tests/corridors/brl-offramp-crosschain.scenario.test.ts create mode 100644 apps/api/src/tests/corridors/mxn-onramp-crosschain.scenario.test.ts create mode 100644 apps/api/src/tests/http-surface.invariants.test.ts create mode 100644 apps/api/src/tests/sdk-contract.offramp.test.ts create mode 100644 apps/frontend/e2e/offramp-brl-journey.spec.ts create mode 100644 apps/frontend/e2e/onramp-mxn-journey.spec.ts create mode 100644 packages/sdk/bunfig.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4fbc50c2..f55d17c93 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,6 +81,9 @@ jobs: - name: 🧪 SDK tests run: bun run test:sdk + - name: 🧪 SDK coverage gate + run: cd packages/sdk && bun run test:coverage + - name: 🧪 Rebalancer tests (coverage-gated) run: cd apps/rebalancer && bun run test:coverage diff --git a/apps/api/package.json b/apps/api/package.json index bc29f2e1b..d08ba95b1 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -96,7 +96,7 @@ "serve": "bun dist/index.js", "start": "bun run build && bun run serve", "test": "bun test", - "test:coverage": "bun test --coverage --coverage-reporter=lcov && bun ../../scripts/check-coverage.ts coverage/lcov.info 0.48 0.59", + "test:coverage": "bun test --coverage --coverage-reporter=lcov && bun ../../scripts/check-coverage.ts coverage/lcov.info 0.52 0.62", "test:db:start": "./scripts/test-db.sh start", "test:db:stop": "./scripts/test-db.sh stop" }, diff --git a/apps/api/src/test-utils/fake-world/fake-anchors.ts b/apps/api/src/test-utils/fake-world/fake-anchors.ts index 1b663c31f..960ab5b92 100644 --- a/apps/api/src/test-utils/fake-world/fake-anchors.ts +++ b/apps/api/src/test-utils/fake-world/fake-anchors.ts @@ -1,6 +1,7 @@ import { AlfredpayApiService, type AlfredpayFee, + type AlfredpayFiatAccount, type AlfredpayFiatPaymentInstructions, type AlfredpayOfframpQuote, AlfredpayOfframpStatus, @@ -232,6 +233,8 @@ export class FakeAlfredpay { offrampDepositAddress = "0x5afe00000000000000000000000000000000d0e5"; readonly offrampOrders: CreateAlfredpayOfframpRequest[] = []; readonly offrampTransactions = new Map(); + /** Accounts served by listFiatAccounts, keyed by Alfredpay customer id. */ + readonly fiatAccountsByCustomer = new Map(); private counter = 0; private readonly fiatPaymentInstructions: AlfredpayFiatPaymentInstructions = { @@ -363,7 +366,9 @@ export class FakeAlfredpay { metadata: this.onrampStatusMetadata, status: this.onrampStatus }; - } + }, + listFiatAccounts: async (customerId: string): Promise => + this.fiatAccountsByCustomer.get(customerId) ?? [] }; asService(): AlfredpayApiService { diff --git a/apps/api/src/test-utils/fake-world/fake-auth.ts b/apps/api/src/test-utils/fake-world/fake-auth.ts index 54541a1cc..77a09079b 100644 --- a/apps/api/src/test-utils/fake-world/fake-auth.ts +++ b/apps/api/src/test-utils/fake-world/fake-auth.ts @@ -1,18 +1,51 @@ -import { SupabaseAuthService } from "../../api/services/auth"; +import { RefreshTokenError, SupabaseAuthService } from "../../api/services/auth"; const TOKEN_PREFIX = "test-user:"; +const REFRESH_PREFIX = "test-refresh:"; +/** The one-time code the fake OTP flow accepts after sendOTP was called for the email. */ +export const TEST_OTP_CODE = "123456"; /** Returns a Bearer token the fake verifier accepts for the given user id. */ export function testUserToken(userId: string, email = "user@example.com"): string { return `${TOKEN_PREFIX}${userId}:${email}`; } +export interface FakeSupabaseAuth { + /** Emails checkUserExists reports as existing accounts. */ + readonly existingEmails: Set; + /** Emails an OTP was sent to (in order). */ + readonly otpRequests: string[]; + restore: () => void; +} + /** - * Replaces Supabase token verification with a local parser: tokens minted by - * testUserToken() are valid, everything else is rejected. No Supabase calls. + * Replaces the Supabase auth surface with a local in-memory flow — no Supabase + * calls. Tokens minted by testUserToken() are valid; the email/OTP login + * accepts TEST_OTP_CODE for any email that requested one and mints tokens for + * the deterministic user id `otp-user-`. */ -export function installFakeSupabaseAuth(): { restore: () => void } { - const original = SupabaseAuthService.verifyToken; +export function installFakeSupabaseAuth(): FakeSupabaseAuth { + const originals = { + checkUserExists: SupabaseAuthService.checkUserExists, + refreshToken: SupabaseAuthService.refreshToken, + sendOTP: SupabaseAuthService.sendOTP, + verifyOTP: SupabaseAuthService.verifyOTP, + verifyToken: SupabaseAuthService.verifyToken + }; + + const existingEmails = new Set(); + const otpRequests: string[] = []; + const pendingOtps = new Set(); + // User ids are UUID columns; keep them stable per email across logins. + const userIdsByEmail = new Map(); + const userIdFor = (email: string) => { + let id = userIdsByEmail.get(email); + if (!id) { + id = crypto.randomUUID(); + userIdsByEmail.set(email, id); + } + return id; + }; SupabaseAuthService.verifyToken = async (accessToken: string) => { if (!accessToken.startsWith(TOKEN_PREFIX)) { @@ -22,9 +55,47 @@ export function installFakeSupabaseAuth(): { restore: () => void } { return { email, user_id: userId, valid: true }; }; + SupabaseAuthService.checkUserExists = async (email: string) => existingEmails.has(email); + + SupabaseAuthService.sendOTP = async (email: string) => { + otpRequests.push(email); + pendingOtps.add(email); + }; + + SupabaseAuthService.verifyOTP = async (email: string, token: string) => { + if (!pendingOtps.has(email) || token !== TEST_OTP_CODE) { + throw new Error("FakeSupabaseAuth: invalid OTP"); + } + pendingOtps.delete(email); + existingEmails.add(email); + const userId = userIdFor(email); + return { + access_token: testUserToken(userId, email), + refresh_token: `${REFRESH_PREFIX}${userId}:${email}`, + user_id: userId + }; + }; + + SupabaseAuthService.refreshToken = async (refreshToken: string) => { + if (!refreshToken.startsWith(REFRESH_PREFIX)) { + throw new RefreshTokenError("FakeSupabaseAuth: invalid refresh token", false); + } + const [userId, email] = refreshToken.slice(REFRESH_PREFIX.length).split(":"); + return { + access_token: testUserToken(userId, email), + refresh_token: `${REFRESH_PREFIX}${userId}:${email}` + }; + }; + return { + existingEmails, + otpRequests, restore: () => { - SupabaseAuthService.verifyToken = original; + SupabaseAuthService.verifyToken = originals.verifyToken; + SupabaseAuthService.checkUserExists = originals.checkUserExists; + SupabaseAuthService.sendOTP = originals.sendOTP; + SupabaseAuthService.verifyOTP = originals.verifyOTP; + SupabaseAuthService.refreshToken = originals.refreshToken; } }; } diff --git a/apps/api/src/test-utils/fake-world/fake-squidrouter.ts b/apps/api/src/test-utils/fake-world/fake-squidrouter.ts index 40450627b..2b73995ce 100644 --- a/apps/api/src/test-utils/fake-world/fake-squidrouter.ts +++ b/apps/api/src/test-utils/fake-world/fake-squidrouter.ts @@ -10,11 +10,18 @@ import * as shared from "@vortexfi/shared"; export class FakeSquidRouter { /** Native value attached to the route tx (wei); drives the derived network fee. */ transactionValueWei = "1000000000000000"; + /** Router contract the route's swap tx calls; approve blueprints approve this spender. */ + transactionTarget = "0x00000000000000000000000000000000005a11d0"; + /** Calldata of the route's swap tx (opaque to the corridor code; only echoed back). */ + transactionData = "0x5a11d0000000000000000000000000000000000000000000000000000000000000cafe"; + transactionGasLimit = "500000"; /** Raw destination amount for a requested route. Default: 1:1 with the input. */ computeToAmount: (params: RouteParams) => string = params => params.fromAmount; toTokenDecimals = 18; failNextRoute: Error | null = null; readonly requestedRoutes: RouteParams[] = []; + /** Status the squidRouterPay bridge poll reports. Default: immediate success. */ + bridgeStatus = "success"; async getRoute(params: RouteParams) { if (this.failNextRoute) { @@ -30,12 +37,28 @@ export class FakeSquidRouter { toAmount: this.computeToAmount(params), toToken: { decimals: this.toTokenDecimals } }, - transactionRequest: { value: this.transactionValueWei } + transactionRequest: { + data: this.transactionData, + gasLimit: this.transactionGasLimit, + target: this.transactionTarget, + value: this.transactionValueWei + } } }, requestId: "fake-squid-request" }; } + + /** Fake of the shared getStatus (SquidRouter status API) used by squidRouterPay. */ + async getStatus() { + return { + id: "fake-squid-status", + isGMPTransaction: false, + routeStatus: [], + squidTransactionStatus: this.bridgeStatus, + status: this.bridgeStatus + }; + } } export function installFakeSquidRouter(): { fakeSquidRouter: FakeSquidRouter; restore: () => void } { @@ -43,7 +66,8 @@ export function installFakeSquidRouter(): { fakeSquidRouter: FakeSquidRouter; re mock.module("@vortexfi/shared", () => ({ ...shared, - getRoute: (params: RouteParams) => fakeSquidRouter.getRoute(params) + getRoute: (params: RouteParams) => fakeSquidRouter.getRoute(params), + getStatus: () => fakeSquidRouter.getStatus() })); return { diff --git a/apps/api/src/tests/corridors/alfredpay-currencies.scenario.test.ts b/apps/api/src/tests/corridors/alfredpay-currencies.scenario.test.ts index c0cc44493..b0bfdf04e 100644 --- a/apps/api/src/tests/corridors/alfredpay-currencies.scenario.test.ts +++ b/apps/api/src/tests/corridors/alfredpay-currencies.scenario.test.ts @@ -7,11 +7,14 @@ import { AlfredpayOnrampStatus, EvmToken, FiatToken, + getAnyFiatTokenDetails, + multiplyByPowerOfTen, Networks, RampDirection, type RampPhase, type UnsignedTx } from "@vortexfi/shared"; +import Big from "big.js"; import { BaseError, ContractFunctionExecutionError, decodeFunctionData, encodeFunctionData, erc20Abi, parseTransaction } from "viem"; import { generatePrivateKey, privateKeyToAccount, type PrivateKeyAccount } from "viem/accounts"; import { parseUnits } from "viem/utils"; @@ -392,5 +395,203 @@ describe("Alfredpay currency corridors (USD/COP/ARS, on- and offramp)", () => { }, 30000 ); + + it(`${currency.fiat} onramp quote beyond the per-currency maximum is rejected`, async () => { + const details = getAnyFiatTokenDetails(currency.fiat); + const maxBuyUnits = multiplyByPowerOfTen(Big(details.maxBuyAmountRaw), -details.decimals); + + const response = await app.request("/v1/quotes", { + body: JSON.stringify({ + from: currency.rail, + inputAmount: maxBuyUnits.plus(1).toFixed(), + inputCurrency: currency.fiat, + network: Networks.Polygon, + outputCurrency: EvmToken.USDT, + rampType: RampDirection.BUY, + to: Networks.Polygon + }), + headers: { "Content-Type": "application/json" }, + method: "POST" + }); + + expect(response.status).toBe(400); + const body = (await response.json()) as { message?: string; error?: string }; + expect(JSON.stringify(body).toLowerCase()).toContain("limit"); + }); } + + it( + "transient failure (USD): an RPC outage on the destination transfer is recoverable and the onramp still completes", + async () => { + const currency = CURRENCY_CASES[0]; // USD/ach + world.alfredpay.onrampRate = currency.onrampRate; + const ephemeral = privateKeyToAccount(generatePrivateKey()); + const destination = privateKeyToAccount(generatePrivateKey()).address as `0x${string}`; + + const user = await createTestUser(); + await createTestAlfredpayCustomer(user.id, { country: currency.country }); + const quote = await createQuoteViaApi({ + from: currency.rail, + inputAmount: currency.onrampInputAmount, + inputCurrency: currency.fiat, + network: Networks.Polygon, + outputCurrency: EvmToken.USDT, + rampType: RampDirection.BUY, + to: Networks.Polygon + }); + const ramp = await registerViaApi(quote.id, user.id, [{ address: ephemeral.address, type: "EVM" }], { + destinationAddress: destination + }); + + const persistedQuote = await QuoteTicket.findByPk(quote.id); + const mintAmountRaw = BigInt(persistedQuote?.metadata.alfredpayMint?.outputAmountRaw ?? "0"); + const amountRaw = parseUnits(quote.outputAmount, ALFREDPAY_ERC20_DECIMALS); + + const signTransfer = (nonce: number) => + ephemeral.signTransaction({ + chainId: 137, + data: encodeFunctionData({ abi: erc20Abi, args: [destination, amountRaw], functionName: "transfer" }), + gas: 100_000n, + maxFeePerGas: 5_000_000_000n, + maxPriorityFeePerGas: 5_000_000_000n, + nonce, + to: ALFREDPAY_ERC20_TOKEN, + type: "eip1559" + }); + const backups: Record = {}; + for (let i = 1; i <= 4; i++) { + backups[`backup${i}`] = { nonce: i, txData: await signTransfer(i) }; + } + const signedTransfer = await signTransfer(0); + await updateRampViaApi(ramp.id, user.id, { + presignedTxs: [ + { + meta: { additionalTxs: backups }, + network: Networks.Polygon, + nonce: 0, + phase: "destinationTransfer", + signer: ephemeral.address, + txData: signedTransfer + } + ] + }); + + world.evm.setNativeBalance(Networks.Polygon, ephemeral.address, parseUnits("2", 18)); + world.evm.setErc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, ephemeral.address, mintAmountRaw); + applyErc20TransfersToLedger(); + // The first broadcast of this corridor is the destination transfer. + world.evm.failNextSends = 1; + world.evm.sendFailureMessage = "FakeEvm: scripted RPC outage"; + + await phaseProcessor.processRamp(ramp.id); + + const final = await RampState.findByPk(ramp.id); + expect(final?.currentPhase).toBe("complete"); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + const outageLogs = final?.errorLogs.filter(log => log.error.includes("scripted RPC outage")) ?? []; + expect(outageLogs.length).toBeGreaterThanOrEqual(1); + expect(outageLogs.some(log => log.recoverable === true)).toBe(true); + expect(world.evm.erc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, destination)).toBe(amountRaw); + }, + 30000 + ); + + it( + "unrecoverable failure (ARS): a FAILED Alfredpay offramp order fails the ramp without paying out", + async () => { + const currency = CURRENCY_CASES[2]; // ARS/cbu + world.alfredpay.offrampRate = currency.offrampRate; + const ephemeral = privateKeyToAccount(generatePrivateKey()); + const userWallet = privateKeyToAccount(generatePrivateKey()); + + world.evm.onReadContract = (_network, params) => { + if (params.functionName === "nonces") { + throw new ContractFunctionExecutionError(new BaseError("nonces() reverted"), { + abi: erc20Abi, + contractAddress: params.address, + functionName: "nonces" + }); + } + return undefined; + }; + + const user = await createTestUser(); + await createTestAlfredpayCustomer(user.id, { country: currency.country }); + const quote = await createQuoteViaApi({ + from: Networks.Polygon, + inputAmount: currency.offrampInputAmount, + inputCurrency: EvmToken.USDT, + network: Networks.Polygon, + outputCurrency: currency.fiat, + rampType: RampDirection.SELL, + to: currency.rail + }); + const ramp = await registerViaApi(quote.id, user.id, [{ address: ephemeral.address, type: "EVM" }], { + fiatAccountId: "test-fiat-account-1", + walletAddress: userWallet.address + }); + + const persistedQuote = await QuoteTicket.findByPk(quote.id); + const inputAmountRaw = BigInt(persistedQuote?.metadata.alfredpayOfframp?.inputAmountRaw ?? "0"); + + const registered = await RampState.findByPk(ramp.id); + const allUnsignedTxs: UnsignedTx[] = registered?.unsignedTxs ?? []; + const userTxData = allUnsignedTxs.find(tx => tx.phase === "squidRouterNoPermitTransfer")?.txData as unknown as { + to: `0x${string}`; + data: `0x${string}`; + }; + const offrampTxData = allUnsignedTxs.find(tx => tx.phase === "alfredpayOfframpTransfer")?.txData as unknown as { + to: `0x${string}`; + data: `0x${string}`; + }; + + const signOfframpTransfer = (nonce: number) => + ephemeral.signTransaction({ + chainId: 137, + data: offrampTxData.data, + gas: 100_000n, + maxFeePerGas: 5_000_000_000n, + maxPriorityFeePerGas: 5_000_000_000n, + nonce, + to: offrampTxData.to, + type: "eip1559" + }); + const backups: Record = {}; + for (let i = 1; i <= 4; i++) { + backups[`backup${i}`] = { nonce: i, txData: await signOfframpTransfer(i) }; + } + const userTxHash = world.evm.broadcastUserTransaction(Networks.Polygon, userWallet.address, { + data: userTxData.data, + to: userTxData.to, + value: 0n + }); + await updateRampViaApi(ramp.id, user.id, { + additionalData: { squidRouterNoPermitTransferHash: userTxHash }, + presignedTxs: [ + { + meta: { additionalTxs: backups }, + network: Networks.Polygon, + nonce: 0, + phase: "alfredpayOfframpTransfer", + signer: ephemeral.address, + txData: await signOfframpTransfer(0) + } + ] + }); + + world.evm.setNativeBalance(Networks.Polygon, ephemeral.address, parseUnits("2", 18)); + world.evm.setErc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, ephemeral.address, inputAmountRaw); + applyErc20TransfersToLedger(); + // The anchor reports the order FAILED while the transfer phase polls it. + world.alfredpay.offrampStatus = AlfredpayOfframpStatus.FAILED; + + await phaseProcessor.processRamp(ramp.id); + + const final = await RampState.findByPk(ramp.id); + expect(final?.currentPhase).toBe("failed"); + expect(final?.phaseHistory.map(entry => entry.phase)).not.toContain("complete"); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + }, + 30000 + ); }); diff --git a/apps/api/src/tests/corridors/brl-offramp-crosschain.scenario.test.ts b/apps/api/src/tests/corridors/brl-offramp-crosschain.scenario.test.ts new file mode 100644 index 000000000..44d445f91 --- /dev/null +++ b/apps/api/src/tests/corridors/brl-offramp-crosschain.scenario.test.ts @@ -0,0 +1,437 @@ +import { afterAll, beforeAll, beforeEach, describe, expect, it } from "bun:test"; +import { Keyring } from "@polkadot/api"; +import { cryptoWaitReady, mnemonicGenerate } from "@polkadot/util-crypto"; +import { + AveniaTicketStatus, + EvmToken, + evmTokenConfig, + FiatToken, + Networks, + RampDirection, + type RampPhase, + type UnsignedTx +} from "@vortexfi/shared"; +import { parseUnits } from "viem"; +import { generatePrivateKey, privateKeyToAccount, type PrivateKeyAccount } from "viem/accounts"; +import phaseProcessor from "../../api/services/phases/phase-processor"; +import QuoteTicket from "../../models/quoteTicket.model"; +import RampState from "../../models/rampState.model"; +import Partner from "../../models/partner.model"; +import { resetTestDatabase, setupTestDatabase } from "../../test-utils/db"; +import { createTestTaxId, createTestUser } from "../../test-utils/factories"; +import { type FakeWorld, installFakeWorld } from "../../test-utils/fake-world"; +import { installFakeSupabaseAuth, testUserToken } from "../../test-utils/fake-world/fake-auth"; +import { startTestApp, type TestApp } from "../../test-utils/test-app"; + +function requireToken(network: Networks.Base | Networks.Polygon, token: EvmToken) { + const details = evmTokenConfig[network][token]; + if (!details) { + throw new Error(`${token} token config missing for ${network}`); + } + return details; +} +const USDC_ON_BASE = requireToken(Networks.Base, EvmToken.USDC).erc20AddressSourceChain as `0x${string}`; +const USDC_ON_POLYGON = requireToken(Networks.Polygon, EvmToken.USDC).erc20AddressSourceChain as `0x${string}`; +const BRLA_ON_BASE = requireToken(Networks.Base, EvmToken.BRLA).erc20AddressSourceChain as `0x${string}`; + +const TAX_ID = "12345678901"; +// FakeBrla.validatePixKey reports this as the pix key owner's tax id; the +// registration-time receiver check must be given a matching value. +const RECEIVER_TAX_ID = "12345678900"; +const PIX_KEY = "test-pix-key"; + +// Identical to the Base→Base swap corridor: the squidRouterApprove/Swap leg is +// user-broadcast on Polygon before the processor runs, so it never appears in +// the processor's phase history. +const HAPPY_PATH_PHASES: RampPhase[] = [ + "initial", + "fundEphemeral", + "distributeFees", + "subsidizePreSwap", + "nablaApprove", + "nablaSwap", + "subsidizePostSwap", + "brlaPayoutOnBase", + "complete" +]; + +interface CorridorSetup { + rampId: string; + quoteId: string; + userWallet: PrivateKeyAccount; + ephemeral: PrivateKeyAccount; + /** Raw (6-decimal) USDC amount the Nabla swap consumes on Base. */ + swapInputRaw: bigint; + /** Raw (18-decimal) BRLA amount the swap yields and the payout transfers. */ + swapOutputRaw: bigint; + signedNablaSwap: `0x${string}`; + signedPayout: `0x${string}`; + approveBlueprint: UnsignedTx; + swapBlueprint: UnsignedTx; + /** Hash of the user's broadcast squidRouterApprove on Polygon. */ + approveHash: `0x${string}`; + /** Hash of the user's broadcast squidRouterSwap on Polygon. */ + swapHash: `0x${string}`; +} + +/** + * Corridor scenario tests for the CROSS-CHAIN BRL offramp path (USDC on + * Polygon → SquidRouter → USDC on Base → Nabla swap → pix via Avenia). This is + * the branch of prepareEvmToBRLOfframpBaseTransactions the Base→Base corridor + * never reaches: registration must issue squidRouterApprove + squidRouterSwap + * blueprints for the user's wallet on the source chain, and fundEphemeral must + * verify the user-reported hashes against those blueprints before any + * ephemeral funds are spent (F-021/F-038 class). + */ +describe("BRL offramp cross-chain corridor (USDC on Polygon → Base → pix via Avenia)", () => { + let world: FakeWorld; + let auth: { restore: () => void }; + let app: TestApp; + + beforeAll(async () => { + world = installFakeWorld(); + auth = installFakeSupabaseAuth(); + await setupTestDatabase(); + app = await startTestApp(); + }); + + afterAll(async () => { + await app?.close(); + auth?.restore(); + world?.restore(); + }); + + beforeEach(async () => { + await resetTestDatabase(); + // The EVM fee distribution transaction builder requires the vortex + // partner's EVM payout address even when the resulting fees are zero. + await Partner.update( + { payoutAddressEvm: "0x000000000000000000000000000000000000fee5" }, + { where: { name: "vortex", rampType: RampDirection.SELL } } + ); + world.evm.failNextSends = 0; + world.evm.onTransaction = undefined; + world.brla.onPixOutputTicket = undefined; + world.brla.accountBalances = { BRLA: 1_000_000, USDC: 0, USDM: 0, USDT: 0 }; + world.brla.payoutTicketStatus = AveniaTicketStatus.PAID; + // Fresh subaccount wallet per test: the in-memory EVM ledger persists + // across tests, so a shared payout recipient would accumulate balances. + world.brla.subaccountEvmWallet = privateKeyToAccount(generatePrivateKey()).address.toLowerCase(); + // Both the quote pipeline's bridge estimate and the registration-time + // squid transactions route Polygon USDC → Base USDC: the fake route's + // destination token must report USDC's 6 decimals. + world.squidRouter.toTokenDecimals = 6; + // Deterministic Nabla quoter for USDC (6 decimals) → BRLA (18 decimals) + // at a flat 5 BRLA per USDC, matching the FakePrices 5 BRL/USD feed. + world.evm.onReadContract = (_network, params) => { + if (params.functionName === "quoteSwapExactTokensForTokens") { + const amountIn = params.args?.[0] as bigint; + return amountIn * 5n * 10n ** 12n; + } + return undefined; + }; + }); + + async function createQuoteViaApi(): Promise<{ id: string; outputAmount: string }> { + const response = await app.request("/v1/quotes", { + body: JSON.stringify({ + from: Networks.Polygon, + inputAmount: "100", + inputCurrency: EvmToken.USDC, + network: Networks.Polygon, + outputCurrency: FiatToken.BRL, + rampType: RampDirection.SELL, + to: "pix" + }), + headers: { "Content-Type": "application/json" }, + method: "POST" + }); + expect(response.status).toBe(201); + return (await response.json()) as { id: string; outputAmount: string }; + } + + // The EVM→BRL route still requires a Substrate ephemeral in signingAccounts + // (validateOfframpQuote legacy default) even though this path never uses it. + async function createSubstrateEphemeralAddress(): Promise { + await cryptoWaitReady(); + const keyring = new Keyring({ type: "sr25519" }); + return keyring.addFromUri(mnemonicGenerate()).address; + } + + async function registerViaApi( + quoteId: string, + userId: string, + ephemeral: PrivateKeyAccount, + userWallet: PrivateKeyAccount + ): Promise<{ id: string }> { + const response = await app.request("/v1/ramp/register", { + body: JSON.stringify({ + additionalData: { + pixDestination: PIX_KEY, + receiverTaxId: RECEIVER_TAX_ID, + taxId: TAX_ID, + walletAddress: userWallet.address + }, + quoteId, + signingAccounts: [ + { address: ephemeral.address, type: "EVM" }, + { address: await createSubstrateEphemeralAddress(), type: "Substrate" } + ] + }), + headers: { + Authorization: `Bearer ${testUserToken(userId)}`, + "Content-Type": "application/json" + }, + method: "POST" + }); + expect(response.status).toBe(201); + return (await response.json()) as { id: string }; + } + + function blueprintOf(unsignedTxs: UnsignedTx[], phase: RampPhase): UnsignedTx { + const blueprint = unsignedTxs.find(tx => tx.phase === phase); + expect(blueprint, `missing ${phase} blueprint in persisted ramp state`).toBeDefined(); + return blueprint as UnsignedTx; + } + + async function signBlueprint(ephemeral: PrivateKeyAccount, blueprint: UnsignedTx): Promise<`0x${string}`> { + const txData = blueprint.txData as unknown as { to: `0x${string}`; data: `0x${string}`; value?: string }; + return ephemeral.signTransaction({ + chainId: 8453, + data: txData.data, + gas: 600_000n, + maxFeePerGas: 5_000_000_000n, + maxPriorityFeePerGas: 5_000_000_000n, + nonce: blueprint.nonce, + to: txData.to, + type: "eip1559", + value: BigInt(txData.value ?? "0") + }); + } + + /** Broadcasts a user-wallet blueprint on its source chain exactly as issued. */ + function broadcastUserBlueprint(userWallet: PrivateKeyAccount, blueprint: UnsignedTx): `0x${string}` { + const txData = blueprint.txData as unknown as { to: `0x${string}`; data: `0x${string}`; value?: string }; + return world.evm.broadcastUserTransaction(blueprint.network, userWallet.address, { + data: txData.data, + to: txData.to, + value: BigInt(txData.value ?? "0") + }); + } + + /** + * Creates quote + registration through the HTTP API, broadcasts the user's + * squidRouterApprove + squidRouterSwap on Polygon, and stores their hashes + * plus the ephemeral's presigned Base-side transactions the way the + * frontend/SDK would via /v1/ramp/update. + */ + async function setUpRegisteredRamp(options: { reportHashes?: boolean } = {}): Promise { + const reportHashes = options.reportHashes ?? true; + const ephemeral = privateKeyToAccount(generatePrivateKey()); + const userWallet = privateKeyToAccount(generatePrivateKey()); + + const user = await createTestUser(); + await createTestTaxId(user.id, { taxId: TAX_ID }); + const quote = await createQuoteViaApi(); + const ramp = await registerViaApi(quote.id, user.id, ephemeral, userWallet); + + const persistedQuote = await QuoteTicket.findByPk(quote.id); + const swapInputRaw = BigInt(persistedQuote?.metadata.nablaSwapEvm?.inputAmountForSwapRaw ?? "0"); + const swapOutputRaw = BigInt(persistedQuote?.metadata.nablaSwapEvm?.outputAmountRaw ?? "0"); + expect(swapInputRaw).toBeGreaterThan(0n); + expect(swapOutputRaw).toBeGreaterThan(0n); + + const rampState = await RampState.findByPk(ramp.id); + if (!rampState) { + throw new Error("Ramp state not found after registration"); + } + const unsignedTxs = rampState.unsignedTxs ?? []; + + // The cross-chain branch: user-wallet squid transactions on the source + // chain instead of the Base-direct squidRouterNoPermitTransfer. + expect(unsignedTxs.some(tx => tx.phase === "squidRouterNoPermitTransfer")).toBe(false); + const approveBlueprint = blueprintOf(unsignedTxs, "squidRouterApprove"); + const swapBlueprint = blueprintOf(unsignedTxs, "squidRouterSwap"); + + const nablaApproveBlueprint = blueprintOf(unsignedTxs, "nablaApprove"); + const nablaSwapBlueprint = blueprintOf(unsignedTxs, "nablaSwap"); + const payoutBlueprint = blueprintOf(unsignedTxs, "brlaPayoutOnBase"); + + const signedNablaApprove = await signBlueprint(ephemeral, nablaApproveBlueprint); + const signedNablaSwap = await signBlueprint(ephemeral, nablaSwapBlueprint); + const signedPayout = await signBlueprint(ephemeral, payoutBlueprint); + + const presign = (blueprint: UnsignedTx, txData: `0x${string}`) => ({ + meta: {}, + network: blueprint.network, + nonce: blueprint.nonce, + phase: blueprint.phase, + signer: ephemeral.address, + txData + }); + + const approveHash = broadcastUserBlueprint(userWallet, approveBlueprint); + const swapHash = broadcastUserBlueprint(userWallet, swapBlueprint); + + await rampState.update({ + presignedTxs: [ + presign(nablaApproveBlueprint, signedNablaApprove), + presign(nablaSwapBlueprint, signedNablaSwap), + presign(payoutBlueprint, signedPayout) + ], + state: reportHashes + ? { ...rampState.state, squidRouterApproveHash: approveHash, squidRouterSwapHash: swapHash } + : rampState.state + }); + + return { + approveBlueprint, + approveHash, + ephemeral, + quoteId: quote.id, + rampId: ramp.id, + signedNablaSwap, + signedPayout, + swapBlueprint, + swapHash, + swapInputRaw, + swapOutputRaw, + userWallet + }; + } + + /** + * Scripts the fake world for the happy path: the ephemeral has Base gas, the + * squid-bridged USDC has already landed on Base, and broadcast transactions + * apply their ledger effects (Nabla swap credit + raw ERC-20 transfers). + */ + function scriptHappyWorld(setup: CorridorSetup): void { + world.evm.setNativeBalance(Networks.Base, setup.ephemeral.address, parseUnits("2", 18)); + world.evm.setErc20Balance(Networks.Base, USDC_ON_BASE, setup.ephemeral.address, setup.swapInputRaw); + world.evm.onTransaction = tx => { + if (tx.serialized === setup.signedNablaSwap) { + world.evm.setErc20Balance(Networks.Base, BRLA_ON_BASE, setup.ephemeral.address, setup.swapOutputRaw); + return; + } + if (tx.serialized === setup.signedPayout) { + world.evm.setErc20Balance(Networks.Base, BRLA_ON_BASE, world.brla.subaccountEvmWallet, setup.swapOutputRaw); + } + }; + } + + function submissionsOf(signedTransfer: `0x${string}`): number { + return world.evm.sentTransactions.filter(tx => tx.serialized === signedTransfer).length; + } + + it( + "happy path: registration issues source-chain squid blueprints and the corridor completes end to end", + async () => { + const setup = await setUpRegisteredRamp(); + scriptHappyWorld(setup); + const pixOutBefore = world.brla.pixOutputTickets.length; + + // Registration requested a Polygon USDC → Base USDC squid route for the + // user's wallet, delivering to the ephemeral. + expect(setup.approveBlueprint.network).toBe(Networks.Polygon); + expect(setup.swapBlueprint.network).toBe(Networks.Polygon); + expect(setup.approveBlueprint.signer.toLowerCase()).toBe(setup.userWallet.address.toLowerCase()); + expect(setup.swapBlueprint.signer.toLowerCase()).toBe(setup.userWallet.address.toLowerCase()); + const approveTxData = setup.approveBlueprint.txData as unknown as { to: string }; + expect(approveTxData.to.toLowerCase()).toBe(USDC_ON_POLYGON.toLowerCase()); + const registrationRoute = world.squidRouter.requestedRoutes.find( + route => + route.fromToken.toLowerCase() === USDC_ON_POLYGON.toLowerCase() && + route.toToken.toLowerCase() === USDC_ON_BASE.toLowerCase() && + route.toAddress?.toLowerCase() === setup.ephemeral.address.toLowerCase() + ); + expect(registrationRoute, "registration should request a Polygon→Base USDC route to the ephemeral").toBeDefined(); + expect(registrationRoute?.fromChain).toBe("137"); + expect(registrationRoute?.toChain).toBe("8453"); + expect(registrationRoute?.fromAddress.toLowerCase()).toBe(setup.userWallet.address.toLowerCase()); + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("complete"); + expect(final?.phaseHistory.map(entry => entry.phase)).toEqual(HAPPY_PATH_PHASES); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + + const quote = await QuoteTicket.findByPk(setup.quoteId); + expect(quote?.status).toBe("consumed"); + expect(submissionsOf(setup.signedNablaSwap)).toBe(1); + expect(submissionsOf(setup.signedPayout)).toBe(1); + expect(world.evm.erc20Balance(Networks.Base, BRLA_ON_BASE, world.brla.subaccountEvmWallet)).toBe(setup.swapOutputRaw); + expect(world.brla.pixOutputTickets.length).toBe(pixOutBefore + 1); + }, + 30000 + ); + + it( + "recoverable pause: with no reported squid hashes the ramp waits in fundEphemeral and resumes once they arrive", + async () => { + const setup = await setUpRegisteredRamp({ reportHashes: false }); + scriptHappyWorld(setup); + + await phaseProcessor.processRamp(setup.rampId); + + // The user has not (yet) broadcast/reported the squid leg: the processor + // must park the ramp recoverably without spending ephemeral funds. + const paused = await RampState.findByPk(setup.rampId); + expect(paused?.currentPhase).toBe("fundEphemeral"); + expect(paused?.processingLock).toEqual({ locked: false, lockedAt: null }); + const waitLogs = paused?.errorLogs.filter(log => log.error.includes("hash not yet reported")) ?? []; + expect(waitLogs.length).toBeGreaterThanOrEqual(1); + expect(waitLogs.every(log => log.recoverable === true)).toBe(true); + expect(submissionsOf(setup.signedNablaSwap)).toBe(0); + expect(submissionsOf(setup.signedPayout)).toBe(0); + + // The hashes arrive (the frontend reports them) and processing resumes. + await paused?.update({ + state: { ...paused.state, squidRouterApproveHash: setup.approveHash, squidRouterSwapHash: setup.swapHash } + }); + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("complete"); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + expect(world.evm.erc20Balance(Networks.Base, BRLA_ON_BASE, world.brla.subaccountEvmWallet)).toBe(setup.swapOutputRaw); + }, + 60000 + ); + + it( + "security regression (F-021 class): a reported swap hash whose calldata differs from the blueprint fails the ramp", + async () => { + const setup = await setUpRegisteredRamp({ reportHashes: false }); + scriptHappyWorld(setup); + + // The attacker points us at a REAL Polygon tx from the right wallet to + // the right router — but with different calldata (e.g. a swap that pays + // them instead of the ephemeral). + const swapTxData = setup.swapBlueprint.txData as unknown as { to: `0x${string}`; value?: string }; + const tamperedHash = world.evm.broadcastUserTransaction(Networks.Polygon, setup.userWallet.address, { + data: "0xdeadbeef", + to: swapTxData.to, + value: BigInt(swapTxData.value ?? "0") + }); + const rampState = await RampState.findByPk(setup.rampId); + await rampState?.update({ + state: { ...rampState.state, squidRouterApproveHash: setup.approveHash, squidRouterSwapHash: tamperedHash } + }); + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("failed"); + expect(final?.phaseHistory.map(entry => entry.phase)).not.toContain("complete"); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + expect(final?.errorLogs.some(log => log.error.includes("calldata does not match"))).toBe(true); + + // No ephemeral funds moved: the swap and payout never reached the chain. + expect(submissionsOf(setup.signedNablaSwap)).toBe(0); + expect(submissionsOf(setup.signedPayout)).toBe(0); + expect(world.evm.erc20Balance(Networks.Base, BRLA_ON_BASE, world.brla.subaccountEvmWallet)).toBe(0n); + }, + 30000 + ); +}); diff --git a/apps/api/src/tests/corridors/mxn-onramp-crosschain.scenario.test.ts b/apps/api/src/tests/corridors/mxn-onramp-crosschain.scenario.test.ts new file mode 100644 index 000000000..266946b54 --- /dev/null +++ b/apps/api/src/tests/corridors/mxn-onramp-crosschain.scenario.test.ts @@ -0,0 +1,425 @@ +import { afterAll, beforeAll, beforeEach, describe, expect, it } from "bun:test"; +import { + ALFREDPAY_ERC20_TOKEN, + AlfredpayOnrampStatus, + EvmToken, + evmTokenConfig, + FiatToken, + Networks, + RampDirection, + type RampPhase, + type UnsignedTx +} from "@vortexfi/shared"; +import { decodeFunctionData, erc20Abi, parseTransaction, parseUnits } from "viem"; +import { generatePrivateKey, privateKeyToAccount, type PrivateKeyAccount } from "viem/accounts"; +import { getEvmFundingAccount } from "../../api/services/phases/evm-funding"; +import phaseProcessor from "../../api/services/phases/phase-processor"; +import QuoteTicket from "../../models/quoteTicket.model"; +import RampState from "../../models/rampState.model"; +import { resetTestDatabase, setupTestDatabase } from "../../test-utils/db"; +import { createTestAlfredpayCustomer, createTestUser } from "../../test-utils/factories"; +import { type FakeWorld, installFakeWorld } from "../../test-utils/fake-world"; +import { installFakeSupabaseAuth, testUserToken } from "../../test-utils/fake-world/fake-auth"; +import { startTestApp, type TestApp } from "../../test-utils/test-app"; + +const USDT_ON_ARBITRUM = evmTokenConfig[Networks.Arbitrum][EvmToken.USDT]?.erc20AddressSourceChain as `0x${string}`; +if (!USDT_ON_ARBITRUM) { + throw new Error("USDT token config missing for Arbitrum"); +} + +const CHAIN_IDS: Partial> = { + [Networks.Arbitrum]: 42161, + [Networks.Polygon]: 137 +}; + +// Unlike the Polygon-direct corridor, the squidRouterSwap phase executes for +// real here (Polygon mint token → Arbitrum USDT) and squidRouterPay settles +// via the destination-chain balance check. +const HAPPY_PATH_PHASES: RampPhase[] = [ + "initial", + "alfredpayOnrampMint", + "fundEphemeral", + "subsidizePreSwap", + "squidRouterSwap", + "squidRouterPay", + "finalSettlementSubsidy", + "destinationTransfer", + "complete" +]; + +// 2000 MXN * 0.05 = 100 USDT: a legible flat rate for the fake anchor. +const ALFREDPAY_RATE = 0.05; + +interface CorridorSetup { + rampId: string; + quoteId: string; + /** Raw (6-decimal) USDT amount the presigned destination transfer pays out on Arbitrum. */ + amountRaw: bigint; + /** Raw (6-decimal) mint-token amount Alfredpay mints on the Polygon ephemeral. */ + mintAmountRaw: bigint; + /** Raw (6-decimal) USDT amount the squid bridge delivers on Arbitrum. */ + bridgedAmountRaw: bigint; + signedSquidApprove: `0x${string}`; + signedSquidSwap: `0x${string}`; + signedTransfer: `0x${string}`; + ephemeral: PrivateKeyAccount; + destination: `0x${string}`; +} + +/** + * Corridor scenario tests for the CROSS-CHAIN Alfredpay onramp (MXN spei → + * mint on Polygon → SquidRouter bridge → USDT on Arbitrum): quote, + * registration and presigned-tx submission go through the real HTTP API, then + * the REAL PhaseProcessor executes the squid approve+swap on Polygon + * (squidRouterSwap), settles the bridge via the Arbitrum balance check + * (squidRouterPay), and pays the destination on Arbitrum — the path the + * Polygon-direct MXN corridor skips entirely. + */ +describe("MXN onramp cross-chain corridor (spei → Polygon mint → USDT on Arbitrum)", () => { + let world: FakeWorld; + let auth: { restore: () => void }; + let app: TestApp; + + beforeAll(async () => { + world = installFakeWorld(); + auth = installFakeSupabaseAuth(); + await setupTestDatabase(); + app = await startTestApp(); + }); + + afterAll(async () => { + await app?.close(); + auth?.restore(); + world?.restore(); + }); + + beforeEach(async () => { + await resetTestDatabase(); + world.evm.failNextSends = 0; + world.evm.onTransaction = undefined; + world.alfredpay.onrampRate = ALFREDPAY_RATE; + world.alfredpay.onCreateOnramp = undefined; + world.alfredpay.onrampStatus = AlfredpayOnrampStatus.TRADE_COMPLETED; + world.alfredpay.onrampStatusMetadata = null; + world.squidRouter.bridgeStatus = "success"; + // The bridge leg swaps the 6-decimal Polygon mint token into 6-decimal + // Arbitrum USDT; the fake route must report matching decimals. + world.squidRouter.toTokenDecimals = 6; + }); + + async function createQuoteViaApi(): Promise<{ id: string; outputAmount: string }> { + const response = await app.request("/v1/quotes", { + body: JSON.stringify({ + from: "spei", + inputAmount: "2000", + inputCurrency: FiatToken.MXN, + network: Networks.Arbitrum, + outputCurrency: EvmToken.USDT, + rampType: RampDirection.BUY, + to: Networks.Arbitrum + }), + headers: { "Content-Type": "application/json" }, + method: "POST" + }); + expect(response.status).toBe(201); + return (await response.json()) as { id: string; outputAmount: string }; + } + + async function registerViaApi( + quoteId: string, + userId: string, + ephemeral: PrivateKeyAccount, + destination: `0x${string}` + ): Promise<{ id: string }> { + const response = await app.request("/v1/ramp/register", { + body: JSON.stringify({ + additionalData: { destinationAddress: destination }, + quoteId, + signingAccounts: [{ address: ephemeral.address, type: "EVM" }] + }), + headers: { + Authorization: `Bearer ${testUserToken(userId)}`, + "Content-Type": "application/json" + }, + method: "POST" + }); + expect(response.status).toBe(201); + return (await response.json()) as { id: string }; + } + + function blueprintOf(unsignedTxs: UnsignedTx[], phase: RampPhase): UnsignedTx { + const blueprint = unsignedTxs.find(tx => tx.phase === phase); + expect(blueprint, `missing ${phase} blueprint in persisted ramp state`).toBeDefined(); + return blueprint as UnsignedTx; + } + + /** Signs a blueprint exactly as issued; the nonce may be overridden for backups. */ + async function signBlueprint(ephemeral: PrivateKeyAccount, blueprint: UnsignedTx, nonce?: number): Promise<`0x${string}`> { + const txData = blueprint.txData as unknown as { to: `0x${string}`; data: `0x${string}`; value?: string }; + const chainId = CHAIN_IDS[blueprint.network]; + if (!chainId) { + throw new Error(`No chain id mapped for ${blueprint.network}`); + } + return ephemeral.signTransaction({ + chainId, + data: txData.data, + gas: 600_000n, + // validatePresignedTxs enforces the blueprint's fee minimums (3 gwei floor on Polygon). + maxFeePerGas: 5_000_000_000n, + maxPriorityFeePerGas: 5_000_000_000n, + nonce: nonce ?? blueprint.nonce, + to: txData.to, + type: "eip1559", + value: BigInt(txData.value ?? "0") + }); + } + + /** validatePresignedTxs requires 4 same-call backups at the next 4 nonces. */ + async function presignWithBackups(ephemeral: PrivateKeyAccount, blueprint: UnsignedTx) { + const backups: Record = {}; + for (let i = 1; i <= 4; i++) { + backups[`backup${i}`] = { nonce: blueprint.nonce + i, txData: await signBlueprint(ephemeral, blueprint, blueprint.nonce + i) }; + } + return { + meta: { additionalTxs: backups }, + network: blueprint.network, + nonce: blueprint.nonce, + phase: blueprint.phase, + signer: ephemeral.address, + txData: await signBlueprint(ephemeral, blueprint) + }; + } + + /** + * Creates quote + registration through the HTTP API, then submits the + * presigned squid approve/swap (Polygon) and destination transfer (Arbitrum) + * through the real update endpoint — which also creates the Alfredpay order. + */ + async function setUpRegisteredRamp(): Promise { + const ephemeral = privateKeyToAccount(generatePrivateKey()); + const destination = privateKeyToAccount(generatePrivateKey()).address as `0x${string}`; + + const user = await createTestUser(); + await createTestAlfredpayCustomer(user.id); + const quote = await createQuoteViaApi(); + const ramp = await registerViaApi(quote.id, user.id, ephemeral, destination); + + const persistedQuote = await QuoteTicket.findByPk(quote.id); + const mintAmountRaw = BigInt(persistedQuote?.metadata.alfredpayMint?.outputAmountRaw ?? "0"); + const bridgedAmountRaw = BigInt(persistedQuote?.metadata.evmToEvm?.outputAmountRaw ?? "0"); + expect(mintAmountRaw).toBeGreaterThan(0n); + expect(bridgedAmountRaw).toBeGreaterThan(0n); + + const rampState = await RampState.findByPk(ramp.id); + if (!rampState) { + throw new Error("Ramp state not found after registration"); + } + const unsignedTxs = rampState.unsignedTxs ?? []; + + // The cross-chain branch: real squid transactions on Polygon plus the + // destination transfer on Arbitrum. + const approveBlueprint = blueprintOf(unsignedTxs, "squidRouterApprove"); + const swapBlueprint = blueprintOf(unsignedTxs, "squidRouterSwap"); + const transferBlueprint = blueprintOf(unsignedTxs, "destinationTransfer"); + expect(approveBlueprint.network).toBe(Networks.Polygon); + expect(swapBlueprint.network).toBe(Networks.Polygon); + expect(transferBlueprint.network).toBe(Networks.Arbitrum); + + const approvePresign = await presignWithBackups(ephemeral, approveBlueprint); + const swapPresign = await presignWithBackups(ephemeral, swapBlueprint); + const transferPresign = await presignWithBackups(ephemeral, transferBlueprint); + + const response = await app.request("/v1/ramp/update", { + body: JSON.stringify({ presignedTxs: [approvePresign, swapPresign, transferPresign], rampId: ramp.id }), + headers: { + Authorization: `Bearer ${testUserToken(user.id)}`, + "Content-Type": "application/json" + }, + method: "POST" + }); + expect(response.status).toBe(200); + + const updated = await RampState.findByPk(ramp.id); + expect(updated?.state.alfredpayTransactionId).toBeTruthy(); + + const transferTxData = transferBlueprint.txData as unknown as { data: `0x${string}` }; + const { args } = decodeFunctionData({ abi: erc20Abi, data: transferTxData.data }); + const amountRaw = (args as [string, bigint])[1]; + + return { + amountRaw, + bridgedAmountRaw, + destination, + ephemeral, + mintAmountRaw, + quoteId: quote.id, + rampId: ramp.id, + signedSquidApprove: approvePresign.txData, + signedSquidSwap: swapPresign.txData, + signedTransfer: transferPresign.txData + }; + } + + /** + * Scripts the fake world so every polling loop succeeds on its first check: + * - the Alfredpay mint has already credited the ephemeral's Polygon balance, + * - the ephemeral has gas on Polygon AND Arbitrum (destination funding), + * - the broadcast squid swap credits the bridged USDT on Arbitrum, + * - raw ERC-20 transfers are applied to the in-memory ledger. + */ + function scriptHappyWorld(setup: CorridorSetup, options: { bridgedAmountRaw?: bigint } = {}): void { + const bridged = options.bridgedAmountRaw ?? setup.bridgedAmountRaw; + world.evm.setNativeBalance(Networks.Polygon, setup.ephemeral.address, parseUnits("2", 18)); + world.evm.setNativeBalance(Networks.Arbitrum, setup.ephemeral.address, parseUnits("2", 18)); + world.evm.setErc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, setup.ephemeral.address, setup.mintAmountRaw); + world.evm.onTransaction = tx => { + if (tx.serialized === setup.signedSquidSwap) { + world.evm.setErc20Balance( + Networks.Arbitrum, + USDT_ON_ARBITRUM, + setup.ephemeral.address, + world.evm.erc20Balance(Networks.Arbitrum, USDT_ON_ARBITRUM, setup.ephemeral.address) + bridged + ); + return; + } + const parsed = tx.serialized ? parseTransaction(tx.serialized as `0x${string}`) : { data: tx.data, to: tx.to }; + if (!parsed.to || !parsed.data) { + return; + } + let decoded: { functionName: string; args: readonly unknown[] }; + try { + decoded = decodeFunctionData({ abi: erc20Abi, data: parsed.data as `0x${string}` }); + } catch { + return; + } + if (decoded.functionName !== "transfer") { + return; + } + const [recipient, amount] = decoded.args as [`0x${string}`, bigint]; + world.evm.setErc20Balance( + tx.network, + parsed.to, + recipient, + world.evm.erc20Balance(tx.network, parsed.to, recipient) + amount + ); + }; + } + + function submissionsOf(signedTx: `0x${string}`): number { + return world.evm.sentTransactions.filter(tx => tx.serialized === signedTx).length; + } + + it( + "happy path: bridges the Polygon mint to Arbitrum via squid and pays the destination there", + async () => { + const setup = await setUpRegisteredRamp(); + scriptHappyWorld(setup); + + // Registration requested a Polygon mint-token → Arbitrum USDT route for + // the ephemeral. + const registrationRoute = world.squidRouter.requestedRoutes.find( + route => + route.fromToken.toLowerCase() === ALFREDPAY_ERC20_TOKEN.toLowerCase() && + route.toToken.toLowerCase() === USDT_ON_ARBITRUM.toLowerCase() + ); + expect(registrationRoute, "registration should request a Polygon→Arbitrum route").toBeDefined(); + expect(registrationRoute?.fromChain).toBe("137"); + expect(registrationRoute?.toChain).toBe("42161"); + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("complete"); + expect(final?.phaseHistory.map(entry => entry.phase)).toEqual(HAPPY_PATH_PHASES); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + expect(final?.state.squidRouterApproveHash).toBeTruthy(); + expect(final?.state.squidRouterSwapHash).toBeTruthy(); + + const quote = await QuoteTicket.findByPk(setup.quoteId); + expect(quote?.status).toBe("consumed"); + expect(world.alfredpay.onrampOrders.length).toBe(1); + + // The squid approve+swap each hit Polygon exactly once, and the + // destination received exactly the quoted USDT on Arbitrum. + expect(submissionsOf(setup.signedSquidApprove)).toBe(1); + expect(submissionsOf(setup.signedSquidSwap)).toBe(1); + expect(submissionsOf(setup.signedTransfer)).toBe(1); + expect(world.evm.erc20Balance(Networks.Arbitrum, USDT_ON_ARBITRUM, setup.destination)).toBe(setup.amountRaw); + }, + 30000 + ); + + it( + "transient failure: an RPC outage on the Arbitrum destination transfer is recoverable and the corridor still completes", + async () => { + const setup = await setUpRegisteredRamp(); + scriptHappyWorld(setup); + // Arm the outage once the squid swap has landed so it hits the NEXT + // broadcast — the Arbitrum destination transfer. + const applyLedgerEffects = world.evm.onTransaction; + world.evm.sendFailureMessage = "FakeEvm: scripted RPC outage"; + world.evm.onTransaction = tx => { + applyLedgerEffects?.(tx); + if (tx.serialized === setup.signedSquidSwap) { + world.evm.failNextSends = 1; + } + }; + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("complete"); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + + const outageLogs = final?.errorLogs.filter(log => log.error.includes("scripted RPC outage")) ?? []; + expect(outageLogs.length).toBeGreaterThanOrEqual(1); + expect(outageLogs.every(log => log.phase === "destinationTransfer")).toBe(true); + expect(outageLogs.some(log => log.recoverable === true)).toBe(true); + + expect(submissionsOf(setup.signedTransfer)).toBe(1); + expect(world.evm.erc20Balance(Networks.Arbitrum, USDT_ON_ARBITRUM, setup.destination)).toBe(setup.amountRaw); + }, + 30000 + ); + + it( + "settlement subsidy: a small bridge shortfall on Arbitrum is topped up (within cap) and the destination is paid in full", + async () => { + const setup = await setUpRegisteredRamp(); + // The bridge slips by 1 USDT — well under the final-settlement cap, so + // finalSettlementSubsidy must top up the ephemeral on ARBITRUM. The + // subsidy is paid from the funding account's own USDT. + const fundingAccount = getEvmFundingAccount(Networks.Arbitrum); + world.evm.setErc20Balance(Networks.Arbitrum, USDT_ON_ARBITRUM, fundingAccount.address, parseUnits("1000", 6)); + const shortfall = parseUnits("1", 6); + scriptHappyWorld(setup, { bridgedAmountRaw: setup.bridgedAmountRaw - shortfall }); + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("complete"); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + + // The funding account sent exactly the shortfall as a USDT transfer to + // the ephemeral on ARBITRUM, and its hash was recorded for idempotency. + // (Note: unlike the gas subsidy in squidRouterPay, this handler keeps no + // Subsidy table row.) + expect(final?.state.finalSettlementSubsidyTxHash).toBeTruthy(); + const subsidyTransfers = world.evm.sentTransactions.filter(tx => { + if (tx.network !== Networks.Arbitrum || tx.from?.toLowerCase() !== fundingAccount.address.toLowerCase() || !tx.data) { + return false; + } + const decoded = decodeFunctionData({ abi: erc20Abi, data: tx.data as `0x${string}` }); + const [recipient, amount] = decoded.args as [`0x${string}`, bigint]; + return ( + decoded.functionName === "transfer" && + recipient.toLowerCase() === setup.ephemeral.address.toLowerCase() && + amount === shortfall + ); + }); + expect(subsidyTransfers.length).toBe(1); + expect(world.evm.erc20Balance(Networks.Arbitrum, USDT_ON_ARBITRUM, setup.destination)).toBe(setup.amountRaw); + }, + 30000 + ); +}); diff --git a/apps/api/src/tests/http-surface.invariants.test.ts b/apps/api/src/tests/http-surface.invariants.test.ts new file mode 100644 index 000000000..c69e0b1b8 --- /dev/null +++ b/apps/api/src/tests/http-surface.invariants.test.ts @@ -0,0 +1,261 @@ +import { afterAll, beforeAll, beforeEach, describe, expect, it } from "bun:test"; +import { randomUUID } from "node:crypto"; +import type { StateMetadata } from "../api/services/phases/meta-state-types"; +import User from "../models/user.model"; +import { resetTestDatabase, setupTestDatabase } from "../test-utils/db"; +import { createTestApiKey, createTestQuote, createTestRampState, createTestUser } from "../test-utils/factories"; +import { type FakeWorld, installFakeWorld } from "../test-utils/fake-world"; +import { type FakeSupabaseAuth, installFakeSupabaseAuth, TEST_OTP_CODE, testUserToken } from "../test-utils/fake-world/fake-auth"; +import { startTestApp, type TestApp } from "../test-utils/test-app"; + +/** + * HTTP-level coverage for the route groups no other suite drives end to end: + * the email/OTP auth flow, webhook registration/deletion, the ramp history + * endpoint, and the public information routes. What these protect is the HTTP + * contract — status codes, auth requirements, and response shapes. + */ +describe("HTTP surface: auth flow, webhooks, history, public routes", () => { + let world: FakeWorld; + let auth: FakeSupabaseAuth; + let app: TestApp; + + beforeAll(async () => { + world = installFakeWorld(); + auth = installFakeSupabaseAuth(); + await setupTestDatabase(); + app = await startTestApp(); + }); + + afterAll(async () => { + await app?.close(); + auth?.restore(); + world?.restore(); + }); + + beforeEach(async () => { + await resetTestDatabase(); + }); + + async function requestJson( + path: string, + options: { method?: string; body?: unknown; headers?: Record } = {} + ): Promise<{ status: number; body: Record }> { + const response = await app.request(path, { + body: options.body === undefined ? undefined : JSON.stringify(options.body), + headers: { "Content-Type": "application/json", ...options.headers }, + method: options.method ?? "GET" + }); + return { body: (await response.json()) as Record, status: response.status }; + } + + describe("auth: email/OTP login flow", () => { + it("walks check-email → request-otp → verify-otp and mints tokens accepted by authed endpoints", async () => { + const email = "otp-user@example.com"; + + // A fresh email is a signup... + const fresh = await requestJson(`/v1/auth/check-email?email=${encodeURIComponent(email)}`); + expect(fresh.status).toBe(200); + expect(fresh.body).toEqual({ action: "signup", exists: false }); + + const otp = await requestJson("/v1/auth/request-otp", { body: { email }, method: "POST" }); + expect(otp.status).toBe(200); + expect(otp.body.success).toBe(true); + expect(auth.otpRequests).toContain(email); + + // ...a wrong code is rejected without a session... + const rejected = await requestJson("/v1/auth/verify-otp", { body: { email, token: "000000" }, method: "POST" }); + expect(rejected.status).toBe(400); + expect(rejected.body.error).toContain("Invalid OTP"); + + // ...and the right code returns tokens and syncs the local user row. + const verified = await requestJson("/v1/auth/verify-otp", { body: { email, token: TEST_OTP_CODE }, method: "POST" }); + expect(verified.status).toBe(200); + expect(verified.body.success).toBe(true); + expect(verified.body.access_token).toBeTruthy(); + expect(verified.body.refresh_token).toBeTruthy(); + const userId = verified.body.user_id as string; + expect(await User.findByPk(userId)).not.toBeNull(); + + const known = await requestJson(`/v1/auth/check-email?email=${encodeURIComponent(email)}`); + expect(known.body).toEqual({ action: "signin", exists: true }); + + // The minted access token is a real session: verify accepts it and an + // auth-guarded endpoint (ramp history) serves the user's (empty) history. + const verify = await requestJson("/v1/auth/verify", { + body: { access_token: verified.body.access_token }, + method: "POST" + }); + expect(verify.status).toBe(200); + expect(verify.body).toEqual({ user_id: userId, valid: true }); + + const history = await requestJson("/v1/ramp/history/0x1111111111111111111111111111111111111111", { + headers: { Authorization: `Bearer ${verified.body.access_token}` } + }); + expect(history.status).toBe(200); + expect(history.body).toEqual({ totalCount: 0, transactions: [] }); + }); + + it("refresh rotates a valid session and rejects a garbage refresh token with 401", async () => { + const email = "refresh-user@example.com"; + await requestJson("/v1/auth/request-otp", { body: { email }, method: "POST" }); + const verified = await requestJson("/v1/auth/verify-otp", { body: { email, token: TEST_OTP_CODE }, method: "POST" }); + + const refreshed = await requestJson("/v1/auth/refresh", { + body: { refresh_token: verified.body.refresh_token }, + method: "POST" + }); + expect(refreshed.status).toBe(200); + expect(refreshed.body.success).toBe(true); + expect(refreshed.body.access_token).toBeTruthy(); + + const rejected = await requestJson("/v1/auth/refresh", { body: { refresh_token: "garbage" }, method: "POST" }); + expect(rejected.status).toBe(401); + }); + + it("verify requires a token and rejects invalid ones", async () => { + const missing = await requestJson("/v1/auth/verify", { body: {}, method: "POST" }); + expect(missing.status).toBe(400); + + const invalid = await requestJson("/v1/auth/verify", { body: { access_token: "not-a-token" }, method: "POST" }); + expect(invalid.status).toBe(401); + expect(invalid.body.valid).toBe(false); + }); + }); + + describe("webhooks", () => { + async function apiKeyHeaders(): Promise> { + const user = await createTestUser(); + const { plaintextKey } = await createTestApiKey({ userId: user.id }); + return { "x-api-key": plaintextKey }; + } + + it("registration requires an API key", async () => { + const quote = await createTestQuote(); + const response = await requestJson("/v1/webhook", { + body: { quoteId: quote.id, url: "https://partner.example/hook" }, + method: "POST" + }); + expect(response.status).toBe(401); + }); + + it("registers a webhook for a quote and deletes it exactly once", async () => { + const headers = await apiKeyHeaders(); + const quote = await createTestQuote(); + + const created = await requestJson("/v1/webhook", { + body: { quoteId: quote.id, url: "https://partner.example/hook" }, + headers, + method: "POST" + }); + expect(created.status).toBe(201); + expect(created.body.id).toBeTruthy(); + expect(created.body.url).toBe("https://partner.example/hook"); + expect(created.body.quoteId).toBe(quote.id); + expect(created.body.isActive).toBe(true); + + const deleted = await requestJson(`/v1/webhook/${created.body.id}`, { headers, method: "DELETE" }); + expect(deleted.status).toBe(200); + expect(deleted.body.success).toBe(true); + + const again = await requestJson(`/v1/webhook/${created.body.id}`, { headers, method: "DELETE" }); + expect(again.status).toBe(404); + }); + + it("rejects non-HTTPS URLs, unknown quotes, and registrations without a quote or session", async () => { + const headers = await apiKeyHeaders(); + const quote = await createTestQuote(); + + const insecure = await requestJson("/v1/webhook", { + body: { quoteId: quote.id, url: "http://partner.example/hook" }, + headers, + method: "POST" + }); + expect(insecure.status).toBe(400); + + const unknownQuote = await requestJson("/v1/webhook", { + body: { quoteId: randomUUID(), url: "https://partner.example/hook" }, + headers, + method: "POST" + }); + expect(unknownQuote.status).toBe(404); + + const noTarget = await requestJson("/v1/webhook", { + body: { url: "https://partner.example/hook" }, + headers, + method: "POST" + }); + expect(noTarget.status).toBe(400); + }); + }); + + describe("ramp history", () => { + const WALLET = "0x2222222222222222222222222222222222222222"; + + it("serves only the caller's own non-initial ramps for the wallet", async () => { + const owner = await createTestUser(); + const stranger = await createTestUser(); + const quote = await createTestQuote(); + await createTestRampState({ + currentPhase: "complete", + quoteId: quote.id, + state: { destinationAddress: WALLET } as StateMetadata, + userId: owner.id + }); + // An initial-phase ramp must not appear in history. + await createTestRampState({ + currentPhase: "initial", + quoteId: (await createTestQuote()).id, + state: { destinationAddress: WALLET } as StateMetadata, + userId: owner.id + }); + + const ownHistory = await requestJson(`/v1/ramp/history/${WALLET}`, { + headers: { Authorization: `Bearer ${testUserToken(owner.id)}` } + }); + expect(ownHistory.status).toBe(200); + expect(ownHistory.body.totalCount).toBe(1); + const transactions = ownHistory.body.transactions as Array<{ id: string; status: string }>; + expect(transactions).toHaveLength(1); + + // Another user sees nothing for the same wallet (F-068 class). + const foreignHistory = await requestJson(`/v1/ramp/history/${WALLET}`, { + headers: { Authorization: `Bearer ${testUserToken(stranger.id)}` } + }); + expect(foreignHistory.status).toBe(200); + expect(foreignHistory.body).toEqual({ totalCount: 0, transactions: [] }); + }); + + it("requires authentication", async () => { + const response = await requestJson(`/v1/ramp/history/${WALLET}`); + expect(response.status).toBe(401); + }); + }); + + describe("public information routes", () => { + it("serves the supported fiat currencies, cryptocurrencies, countries, and payment methods", async () => { + const fiat = await requestJson("/v1/supported-fiat-currencies"); + expect(fiat.status).toBe(200); + const currencies = fiat.body.currencies as Array<{ symbol: string }>; + // Token exhaustiveness (see CLAUDE.md): all six fiat tokens stay listed. + // (FiatToken.EURC's wire value is "EUR".) + expect(currencies.map(currency => currency.symbol).sort()).toEqual(["ARS", "BRL", "COP", "EUR", "MXN", "USD"]); + + const crypto = await requestJson("/v1/supported-cryptocurrencies"); + expect(crypto.status).toBe(200); + + const countries = await requestJson("/v1/supported-countries"); + expect(countries.status).toBe(200); + + const methods = await requestJson("/v1/supported-payment-methods"); + expect(methods.status).toBe(200); + }); + + it("price endpoints validate their query parameters", async () => { + const missingEverything = await requestJson("/v1/prices"); + expect(missingEverything.status).toBe(400); + + const missingAmount = await requestJson("/v1/prices/all?direction=onramp&sourceCurrency=eur&targetCurrency=usdc&network=base"); + expect(missingAmount.status).toBe(400); + }); + }); +}); diff --git a/apps/api/src/tests/sdk-contract.offramp.test.ts b/apps/api/src/tests/sdk-contract.offramp.test.ts new file mode 100644 index 000000000..4477a4e93 --- /dev/null +++ b/apps/api/src/tests/sdk-contract.offramp.test.ts @@ -0,0 +1,340 @@ +import { afterAll, beforeAll, beforeEach, describe, expect, it } from "bun:test"; +import { + AlfredPayCountry, + AlfredpayFiatAccountType, + AveniaTicketStatus, + EPaymentMethod, + EvmToken, + evmTokenConfig, + FiatToken, + type GetRampStatusResponse, + Networks, + type RampPhase, + RampDirection, + type UnsignedTx +} from "@vortexfi/shared"; +import { parseUnits } from "viem"; +import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"; +import { VortexSdk } from "../../../../packages/sdk/src"; +import Partner from "../models/partner.model"; +import QuoteTicket from "../models/quoteTicket.model"; +import RampState from "../models/rampState.model"; +import { resetTestDatabase, setupTestDatabase } from "../test-utils/db"; +import { createTestAlfredpayCustomer, createTestApiKey, createTestTaxId, createTestUser } from "../test-utils/factories"; +import { type FakeWorld, installFakeWorld } from "../test-utils/fake-world"; +import { startTestApp, type TestApp } from "../test-utils/test-app"; + +function requireToken(network: Networks.Base | Networks.Polygon, token: EvmToken) { + const details = evmTokenConfig[network][token]; + if (!details) { + throw new Error(`${token} token config missing for ${network}`); + } + return details; +} +const USDC_ON_BASE = requireToken(Networks.Base, EvmToken.USDC).erc20AddressSourceChain as `0x${string}`; +const USDC_ON_POLYGON = requireToken(Networks.Polygon, EvmToken.USDC).erc20AddressSourceChain as `0x${string}`; +const BRLA_ON_BASE = requireToken(Networks.Base, EvmToken.BRLA).erc20AddressSourceChain as `0x${string}`; + +const TAX_ID = "12345678901"; +const RECEIVER_TAX_ID = "12345678900"; +const PIX_KEY = "test-pix-key"; +const BASE_CHAIN_ID_HEX = "0x2105"; // 8453 + +/** + * Same shim as sdk-contract.test.ts: the SDK's viem wallet client issues one + * eth_chainId RPC before signing locally; the SELL corridor only ephemeral-signs + * on Base (the Polygon squid leg is user-broadcast, never SDK-signed). + */ +function installChainIdShim(): { restore: () => void } { + const guardedFetch = globalThis.fetch; + const shim = (async (input: Parameters[0], init?: Parameters[1]) => { + if (typeof init?.body === "string") { + try { + const payload = JSON.parse(init.body) as { id?: number; method?: string }; + if (payload.method === "eth_chainId") { + return Response.json({ id: payload.id ?? 1, jsonrpc: "2.0", result: BASE_CHAIN_ID_HEX }); + } + } catch { + // not JSON — let the guarded fetch decide + } + } + return guardedFetch(input, init); + }) as typeof fetch; + globalThis.fetch = Object.assign(shim, guardedFetch); + return { + restore: () => { + globalThis.fetch = guardedFetch; + } + }; +} + +/** + * SDK ↔ API contract tests for the SELL direction and the user-transaction + * surface: the real SDK registers a cross-chain BRL offramp (USDC on Polygon → + * pix), classifies and submits the user-wallet squid transactions + * (getUserTransactionType / getTransactionToBroadcast / submitUserTransactions + * / submitUserTxHash), reports hashes via the typed updateRamp, and drives the + * ramp to completion — plus getQuote and listAlfredpayFiatAccounts, which had + * no contract coverage. + */ +describe("SDK ↔ API contract (BRL offramp, USDC on Polygon → pix)", () => { + let world: FakeWorld; + let chainIdShim: { restore: () => void }; + let app: TestApp; + + beforeAll(async () => { + world = installFakeWorld(); + chainIdShim = installChainIdShim(); + await setupTestDatabase(); + app = await startTestApp(); + }); + + afterAll(async () => { + await app?.close(); + chainIdShim?.restore(); + world?.restore(); + }); + + beforeEach(async () => { + await resetTestDatabase(); + await Partner.update( + { payoutAddressEvm: "0x000000000000000000000000000000000000fee5" }, + { where: { name: "vortex", rampType: RampDirection.SELL } } + ); + world.evm.failNextSends = 0; + world.evm.onTransaction = undefined; + world.brla.onPixOutputTicket = undefined; + world.brla.accountBalances = { BRLA: 1_000_000, USDC: 0, USDM: 0, USDT: 0 }; + world.brla.payoutTicketStatus = AveniaTicketStatus.PAID; + world.brla.subaccountEvmWallet = privateKeyToAccount(generatePrivateKey()).address.toLowerCase(); + world.squidRouter.toTokenDecimals = 6; + world.evm.onReadContract = (_network, params) => { + if (params.functionName === "quoteSwapExactTokensForTokens") { + const amountIn = params.args?.[0] as bigint; + return amountIn * 5n * 10n ** 12n; + } + return undefined; + }; + }); + + /** A KYC'd user with a user-linked secret key, and an SDK authenticated as them. */ + async function createUserSdk(): Promise<{ sdk: VortexSdk; userId: string }> { + const user = await createTestUser(); + await createTestTaxId(user.id, { taxId: TAX_ID }); + const { plaintextKey } = await createTestApiKey({ userId: user.id }); + const sdk = new VortexSdk({ apiBaseUrl: app.baseUrl, secretKey: plaintextKey, storeEphemeralKeys: false }); + return { sdk, userId: user.id }; + } + + function quoteRequest() { + return { + from: Networks.Polygon, + inputAmount: "100", + inputCurrency: EvmToken.USDC, + network: Networks.Polygon, + outputCurrency: FiatToken.BRL, + rampType: RampDirection.SELL, + to: EPaymentMethod.PIX + } as const; + } + + /** + * Registers a SELL ramp through the SDK for a wallet that holds enough USDC + * on Polygon (the SDK's preflight reads the fake ledger). + */ + async function registerOfframp(sdk: VortexSdk) { + const wallet = privateKeyToAccount(generatePrivateKey()); + world.evm.setErc20Balance(Networks.Polygon, USDC_ON_POLYGON, wallet.address, parseUnits("100", 6)); + + const quote = await sdk.createQuote(quoteRequest()); + const { rampProcess, unsignedTransactions } = await sdk.registerRamp(quote, { + pixDestination: PIX_KEY, + receiverTaxId: RECEIVER_TAX_ID, + walletAddress: wallet.address + }); + return { quote, rampProcess, unsignedTransactions, wallet }; + } + + /** Broadcasts a user transaction from the wallet on its source chain, as a real wallet would. */ + function sendFromWallet(walletAddress: string) { + return async (txData: { to: string; data?: string; value?: string }, context: { unsignedTransaction: UnsignedTx }) => + world.evm.broadcastUserTransaction(context.unsignedTransaction.network, walletAddress, { + data: txData.data, + to: txData.to, + value: BigInt(txData.value ?? "0") + }); + } + + /** Scripts gas + bridged USDC on Base and the swap/payout ledger effects for a registered ramp. */ + async function scriptHappyWorld(rampId: string, quoteId: string): Promise<{ swapOutputRaw: bigint }> { + const state = await RampState.findByPk(rampId); + const quote = await QuoteTicket.findByPk(quoteId); + const ephemeralAddress = state?.state.evmEphemeralAddress as `0x${string}`; + expect(ephemeralAddress).toBeTruthy(); + const swapInputRaw = BigInt(quote?.metadata.nablaSwapEvm?.inputAmountForSwapRaw ?? "0"); + const swapOutputRaw = BigInt(quote?.metadata.nablaSwapEvm?.outputAmountRaw ?? "0"); + expect(swapInputRaw).toBeGreaterThan(0n); + expect(swapOutputRaw).toBeGreaterThan(0n); + + const signedNablaSwap = state?.presignedTxs?.find(tx => tx.phase === "nablaSwap")?.txData as `0x${string}`; + const signedPayout = state?.presignedTxs?.find(tx => tx.phase === "brlaPayoutOnBase")?.txData as `0x${string}`; + expect(signedNablaSwap).toBeTruthy(); + expect(signedPayout).toBeTruthy(); + + world.evm.setNativeBalance(Networks.Base, ephemeralAddress, parseUnits("2", 18)); + world.evm.setErc20Balance(Networks.Base, USDC_ON_BASE, ephemeralAddress, swapInputRaw); + world.evm.onTransaction = tx => { + if (tx.serialized === signedNablaSwap) { + world.evm.setErc20Balance(Networks.Base, BRLA_ON_BASE, ephemeralAddress, swapOutputRaw); + return; + } + if (tx.serialized === signedPayout) { + world.evm.setErc20Balance(Networks.Base, BRLA_ON_BASE, world.brla.subaccountEvmWallet, swapOutputRaw); + } + }; + return { swapOutputRaw }; + } + + /** Polls getRampStatus (itself part of the contract) until the ramp completes. */ + async function waitForComplete(sdk: VortexSdk, rampId: string): Promise { + const deadline = Date.now() + 20_000; + for (;;) { + const status = await sdk.getRampStatus(rampId); + if (status.currentPhase === "complete") { + return status; + } + const state = await RampState.findByPk(rampId); + if (state?.currentPhase === "failed") { + throw new Error(`Ramp ${rampId} failed: ${JSON.stringify(state.errorLogs)}`); + } + if (Date.now() > deadline) { + throw new Error(`Timed out waiting for ramp ${rampId} to complete (phase: ${status.currentPhase})`); + } + await Bun.sleep(50); + } + } + + it( + "drives the full offramp lifecycle: createQuote → getQuote → registerRamp → submitUserTransactions → startRamp → complete", + async () => { + const { sdk, userId } = await createUserSdk(); + const { quote, rampProcess, unsignedTransactions, wallet } = await registerOfframp(sdk); + + // getQuote contract: fetching the quote by id returns the created quote. + const fetched = await sdk.getQuote(quote.id); + expect(fetched.id).toBe(quote.id); + expect(fetched.rampType).toBe(RampDirection.SELL); + expect(Number(fetched.inputAmount)).toBe(Number(quote.inputAmount)); + expect(Number(fetched.outputAmount)).toBe(Number(quote.outputAmount)); + expect(fetched.outputCurrency).toBe(FiatToken.BRL); + + // registerRamp SELL contract: the user-wallet squid transactions come + // back for the caller's wallet, classified as broadcastable EVM txs. + expect(rampProcess.type).toBe(RampDirection.SELL); + expect(rampProcess.currentPhase).toBe("initial"); + expect(unsignedTransactions).toHaveLength(2); + const phases = unsignedTransactions.map(tx => tx.phase).sort(); + expect(phases).toEqual(["squidRouterApprove", "squidRouterSwap"] as RampPhase[]); + for (const tx of unsignedTransactions) { + expect(tx.network).toBe(Networks.Polygon); + expect(tx.signer.toLowerCase()).toBe(wallet.address.toLowerCase()); + expect(sdk.getUserTransactionType(tx)).toBe("evm-transaction"); + const broadcastable = sdk.getTransactionToBroadcast(tx); + expect(broadcastable.to).toBeTruthy(); + expect(broadcastable.data).toBeTruthy(); + } + + // The SDK already signed and stored the ephemeral's Base-side txs. + const stored = await RampState.findByPk(rampProcess.id); + expect(stored?.userId).toBe(userId); + const presignedPhases = (stored?.presignedTxs ?? []).map(tx => tx.phase); + for (const phase of ["nablaApprove", "nablaSwap", "brlaPayoutOnBase"] as RampPhase[]) { + expect(presignedPhases).toContain(phase); + } + // User-wallet phases must never be presigned (the API rejects them). + expect(presignedPhases).not.toContain("squidRouterApprove"); + expect(presignedPhases).not.toContain("squidRouterSwap"); + + // submitUserTransactions broadcasts through the caller's wallet handler + // and reports each hash to the API. + const afterSubmit = await sdk.submitUserTransactions(rampProcess.id, unsignedTransactions, { + sendTransaction: sendFromWallet(wallet.address) + }); + expect(afterSubmit.id).toBe(rampProcess.id); + + const withHashes = await RampState.findByPk(rampProcess.id); + expect(withHashes?.state.squidRouterApproveHash).toBeTruthy(); + expect(withHashes?.state.squidRouterSwapHash).toBeTruthy(); + + const { swapOutputRaw } = await scriptHappyWorld(rampProcess.id, quote.id); + const started = await sdk.startRamp(rampProcess.id); + expect(started.id).toBe(rampProcess.id); + + const status = await waitForComplete(sdk, rampProcess.id); + expect(status.type).toBe(RampDirection.SELL); + expect(Number(status.inputAmount)).toBe(Number(quote.inputAmount)); + expect(Number(status.outputAmount)).toBe(Number(quote.outputAmount)); + + // End to end, the Avenia subaccount received the swap output and a pix + // payout ticket was created. + expect(world.evm.erc20Balance(Networks.Base, BRLA_ON_BASE, world.brla.subaccountEvmWallet)).toBe(swapOutputRaw); + expect(world.brla.pixOutputTickets.length).toBe(1); + }, + 30000 + ); + + it( + "updateRamp (typed SELL update) records user-reported squid hashes against the ramp", + async () => { + const { sdk } = await createUserSdk(); + const { quote, rampProcess, unsignedTransactions, wallet } = await registerOfframp(sdk); + + // The integrator broadcasts outside the SDK and reports the hashes + // through the typed updateRamp call instead of submitUserTxHash. + const byPhase = Object.fromEntries(unsignedTransactions.map(tx => [tx.phase, tx])); + const broadcast = sendFromWallet(wallet.address); + const approveHash = await broadcast(byPhase.squidRouterApprove.txData as { to: string; data?: string; value?: string }, { + unsignedTransaction: byPhase.squidRouterApprove + }); + const swapHash = await broadcast(byPhase.squidRouterSwap.txData as { to: string; data?: string; value?: string }, { + unsignedTransaction: byPhase.squidRouterSwap + }); + + const updated = await sdk.updateRamp(quote, rampProcess.id, { + squidRouterApproveHash: approveHash, + squidRouterSwapHash: swapHash + }); + expect(updated.id).toBe(rampProcess.id); + + const state = await RampState.findByPk(rampProcess.id); + expect(state?.state.squidRouterApproveHash).toBe(approveHash); + expect(state?.state.squidRouterSwapHash).toBe(swapHash); + }, + 30000 + ); + + it( + "listAlfredpayFiatAccounts returns the caller's registered fiat accounts", + async () => { + const user = await createTestUser(); + const { plaintextKey } = await createTestApiKey({ userId: user.id }); + const customer = await createTestAlfredpayCustomer(user.id, { country: AlfredPayCountry.MX }); + world.alfredpay.fiatAccountsByCustomer.set(customer.alfredPayId, [ + { + accountNumber: "646180157000000004", + accountType: "checking", + customerId: customer.alfredPayId, + fiatAccountId: "fiat-account-1", + type: AlfredpayFiatAccountType.SPEI + } + ]); + + const sdk = new VortexSdk({ apiBaseUrl: app.baseUrl, secretKey: plaintextKey, storeEphemeralKeys: false }); + const accounts = await sdk.listAlfredpayFiatAccounts(AlfredPayCountry.MX); + expect(accounts).toHaveLength(1); + expect(accounts[0].fiatAccountId).toBe("fiat-account-1"); + expect(accounts[0].type).toBe(AlfredpayFiatAccountType.SPEI); + }, + 30000 + ); +}); diff --git a/apps/frontend/e2e/offramp-brl-journey.spec.ts b/apps/frontend/e2e/offramp-brl-journey.spec.ts new file mode 100644 index 000000000..72ac39d9d --- /dev/null +++ b/apps/frontend/e2e/offramp-brl-journey.spec.ts @@ -0,0 +1,163 @@ +import { expect, test } from "@playwright/test"; +import { buildQuoteResponse, buildRampProcess, E2E_RAMP_ID, mockBackend } from "./support/mockBackend"; +import { injectMockWallet, MOCK_WALLET_ADDRESS } from "./support/mockWallet"; + +// Structurally valid CPF (passes the checksum in isValidCpf). +const VALID_CPF = "529.982.247-25"; +const PIX_KEY = "e2e-pix-key@vortexfinance.co"; +const BASE_USDC = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"; +const MOCK_WALLET_TX_HASH = `0x${"cd".repeat(32)}`; + +// Critical journey 5: a full SELL (offramp) BRL ramp against the mocked backend — the +// money-OUT path, where the user's connected wallet (not an ephemeral) signs and +// broadcasts the source-of-funds transaction. +// +// quote -> Sell (wallet gate passed by the injected mock wallet; the Sell balance check +// reads the mocked Base RPC) -> email/OTP auth -> Avenia offramp eligibility (CPF + Pix +// key) -> KYC gate (existing CONFIRMED user) -> payment summary -> ramp registration -> +// ephemeral presigning posted to /ramp/update -> USER WALLET broadcast of the +// squidRouterNoPermitTransfer (eth_sendTransaction on the mock wallet) with its hash +// reported in a second /ramp/update -> automatic /ramp/start -> progress -> success. + +const SELL_RAMP_FIELDS = { + depositQrCode: undefined, + from: "base", + inputAmount: "100", + inputCurrency: "USDC", + outputAmount: "500", + outputCurrency: "BRL", + to: "pix", + type: "SELL" +}; + +// The ephemeral's Base-side transactions plus the user-wallet source-of-funds transfer, +// mirroring the API's evm-to-brl-base offramp preparation for the Base+USDC direct path. +function buildSellUnsignedTxs(evmEphemeral: string) { + const evmTx = (signer: string, nonce: number, phase: string) => ({ + meta: {}, + network: "base", + nonce, + phase, + signer, + txData: { + data: `0xa9059cbb${"00".repeat(12)}${evmEphemeral.slice(2).toLowerCase()}${"00".repeat(30)}04c4`, + gas: "150000", + maxFeePerGas: "2000000000", + maxPriorityFeePerGas: "1000000000", + nonce, + to: BASE_USDC, + value: "0" + } + }); + return [ + evmTx(MOCK_WALLET_ADDRESS, 0, "squidRouterNoPermitTransfer"), + evmTx(evmEphemeral, 0, "distributeFees"), + evmTx(evmEphemeral, 1, "nablaApprove"), + evmTx(evmEphemeral, 2, "nablaSwap"), + evmTx(evmEphemeral, 3, "brlaPayoutOnBase"), + evmTx(evmEphemeral, 4, "baseCleanupUsdc"), + evmTx(evmEphemeral, 5, "baseCleanupBrla") + ]; +} + +test("SELL BRL journey: quote, auth, CPF+Pix eligibility, registration, wallet signing, progress, success", async ({ + page +}) => { + // The real API keeps returning the ramp's unsignedTxs on /ramp/update; the signing + // step reads the user-wallet transactions from that response. + let unsignedTxs: unknown[] = []; + const backend = await mockBackend(page, { + quotes: body => + ({ + body: buildQuoteResponse({ + ...SELL_RAMP_FIELDS, + feeCurrency: "BRL", + inputAmount: body.inputAmount, + rampType: "SELL" + }), + status: 200 + }) as { status: number; body: unknown }, + rampStatusOverrides: () => SELL_RAMP_FIELDS, + register: body => { + const signingAccounts = (body.signingAccounts ?? []) as Array<{ address: string; type: string }>; + const evmEphemeral = signingAccounts.find(account => account.type === "EVM")?.address ?? BASE_USDC; + unsignedTxs = buildSellUnsignedTxs(evmEphemeral); + return buildRampProcess({ ...SELL_RAMP_FIELDS, unsignedTxs }); + }, + update: () => buildRampProcess({ ...SELL_RAMP_FIELDS, unsignedTxs }) + }); + await injectMockWallet(page); + + await page.goto("/widget?rampType=SELL&fiat=BRL&inputAmount=100"); + + // Stage 1: the quote form fetched a SELL quote; the wallet gate is already passed by + // the injected mock wallet, and the balance check (mocked Base RPC) enables Sell. + await expect(page.locator('input[name="outputAmount"]')).toHaveValue(/500/, { timeout: 20_000 }); + const sellButton = page.locator("form").getByRole("button", { name: "Sell" }); + await expect(sellButton).toBeEnabled({ timeout: 20_000 }); + await sellButton.click(); + + // Stage 2 + 3: email/OTP auth gate. + await expect(page.getByRole("heading", { name: "Verify Your Email" })).toBeVisible({ timeout: 20_000 }); + await page.locator("#email").fill("e2e@vortexfinance.co"); + await page.locator("#terms").check(); + await page.getByRole("button", { name: "Continue" }).click(); + await expect(page.getByRole("heading", { name: "Enter Verification Code" })).toBeVisible({ timeout: 20_000 }); + await page.locator('input[autocomplete="one-time-code"]').pressSequentially("123456"); + + // Stage 4: Avenia OFFRAMP eligibility details — CPF and Pix key (no wallet field: + // the destination is a Brazilian bank account). The offramp confirm button is + // labelled "Verify Wallet" in this state. + await expect(page.locator("#taxId")).toBeVisible({ timeout: 20_000 }); + await expect(page.locator("#pixId")).toBeVisible(); + await page.locator("#taxId").fill(VALID_CPF); + await page.locator("#pixId").fill(PIX_KEY); + await page.getByRole("button", { name: "Verify Wallet" }).click(); + + // Stage 5: KYC gate happy path (existing CONFIRMED user) lands on the payment summary. + await expect(page.getByRole("heading", { name: "Payment Summary" })).toBeVisible({ timeout: 20_000 }); + expect(backend.brlaGetUserRequests).toContain(VALID_CPF); + + // Stage 6: confirming registers the ramp; the CPF and Pix key travel as additionalData. + await page.getByRole("button", { name: "Confirm" }).click(); + + // Stage 7: the ephemeral transactions are signed in-page and posted to /ramp/update, + // then the USER WALLET broadcasts the source-of-funds transfer and its hash is + // reported in a second update; the offramp starts automatically and (once polling + // reports COMPLETE) lands on the SELL success screen. + await expect(page.getByRole("heading", { name: "All set! The withdrawal has been sent to your bank." })).toBeVisible({ + timeout: 45_000 + }); + await expect(page.getByText("Your funds were sent via PIX and are now in your bank account.")).toBeVisible(); + + expect(backend.registerRequests).toHaveLength(1); + const registerBody = backend.registerRequests[0] as { + quoteId: string; + signingAccounts: Array<{ type: string }>; + additionalData?: { pixDestination?: string; taxId?: string; walletAddress?: string }; + }; + expect(registerBody.quoteId).toBe("quote-e2e-1"); + expect(registerBody.signingAccounts.map(account => account.type).sort()).toEqual(["EVM", "Substrate"]); + expect(registerBody.additionalData?.pixDestination).toBe(PIX_KEY); + expect(registerBody.additionalData?.taxId).toBe(VALID_CPF); + expect(registerBody.additionalData?.walletAddress?.toLowerCase()).toBe(MOCK_WALLET_ADDRESS.toLowerCase()); + + // Update #1: the six ephemeral transactions, locally signed (raw EIP-1559 txs). The + // user-wallet transfer must NOT be among them. + expect(backend.updateRequests.length).toBeGreaterThanOrEqual(2); + const ephemeralUpdate = backend.updateRequests[0] as { presignedTxs: Array<{ txData: unknown; phase: string }> }; + expect(ephemeralUpdate.presignedTxs.map(tx => tx.phase)).not.toContain("squidRouterNoPermitTransfer"); + expect(ephemeralUpdate.presignedTxs).toHaveLength(6); + for (const tx of ephemeralUpdate.presignedTxs) { + expect(typeof tx.txData).toBe("string"); + expect(tx.txData as string).toMatch(/^0x02/); + } + + // Update #2: the hash of the wallet-broadcast transfer, reported as additionalData. + const signingUpdate = backend.updateRequests[1] as { additionalData?: Record }; + expect(signingUpdate.additionalData?.squidRouterNoPermitTransferHash).toBe(MOCK_WALLET_TX_HASH); + + // The offramp started without a manual payment-confirmation step. + expect(backend.startRequests).toHaveLength(1); + expect(backend.startRequests[0]).toMatchObject({ rampId: E2E_RAMP_ID }); +}); diff --git a/apps/frontend/e2e/onramp-mxn-journey.spec.ts b/apps/frontend/e2e/onramp-mxn-journey.spec.ts new file mode 100644 index 000000000..5e8408ee4 --- /dev/null +++ b/apps/frontend/e2e/onramp-mxn-journey.spec.ts @@ -0,0 +1,139 @@ +import { expect, test } from "@playwright/test"; +import { buildQuoteResponse, buildRampProcess, E2E_RAMP_ID, mockBackend } from "./support/mockBackend"; +import { injectMockWallet, MOCK_WALLET_ADDRESS } from "./support/mockWallet"; + +const POLYGON_USDT = "0xc2132d05d31c914a87c6611c10748aeb04b58e8f"; +const E2E_CLABE = "646180157000000004"; + +// Critical journey 6: a full BUY (onramp) MXN ramp over the Alfredpay rail — the corridor +// family (MXN/USD/COP/ARS) the BRL journey never touches. The Alfredpay KYC gate is +// exercised on its happy path (an existing verified customer, alfredpayStatus=SUCCESS), +// and the payment step shows SPEI bank transfer details (CLABE) instead of a Pix QR. +// +// quote -> Buy -> email/OTP auth -> destination wallet details -> Alfredpay KYC gate -> +// summary -> registration (destinationAddress + walletAddress) -> in-page ephemeral +// signing on POLYGON posted to /ramp/update -> SPEI payment details (CLABE) -> "I have +// made the payment" -> /ramp/start -> progress -> success. + +const MXN_RAMP_FIELDS = { + depositQrCode: undefined, + from: "spei", + inputAmount: "2000", + inputCurrency: "MXN", + outputAmount: "100", + outputCurrency: "USDT", + to: "polygon", + type: "BUY" +}; + +const ACH_PAYMENT_DATA = { + accountHolderName: "Vortex E2E", + bankName: "STP", + clabe: E2E_CLABE, + reference: "VORTEX-E2E-REF" +}; + +// The Alfredpay onramp's Polygon-side transactions signed by the EVM ephemeral +// (destinationTransfer + cleanup), mirroring alfredpay-to-evm.ts' direct-token path. +function buildMxnUnsignedTxs(evmEphemeral: string) { + const evmTx = (nonce: number, phase: string) => ({ + meta: {}, + network: "polygon", + nonce, + phase, + signer: evmEphemeral, + txData: { + data: `0xa9059cbb${"00".repeat(12)}${evmEphemeral.slice(2).toLowerCase()}${"00".repeat(30)}04c4`, + gas: "150000", + maxFeePerGas: "5000000000", + maxPriorityFeePerGas: "5000000000", + nonce, + to: POLYGON_USDT, + value: "0" + } + }); + return [evmTx(0, "destinationTransfer"), evmTx(1, "polygonCleanup")]; +} + +test("BUY MXN journey: quote, auth, Alfredpay KYC gate, registration, signing, SPEI details, progress, success", async ({ + page +}) => { + let unsignedTxs: unknown[] = []; + const backend = await mockBackend(page, { + quotes: body => + ({ + body: buildQuoteResponse({ + ...MXN_RAMP_FIELDS, + feeCurrency: "MXN", + inputAmount: body.inputAmount, + rampType: "BUY" + }), + status: 200 + }) as { status: number; body: unknown }, + rampStatusOverrides: () => MXN_RAMP_FIELDS, + register: body => { + const signingAccounts = (body.signingAccounts ?? []) as Array<{ address: string; type: string }>; + const evmEphemeral = signingAccounts.find(account => account.type === "EVM")?.address ?? POLYGON_USDT; + unsignedTxs = buildMxnUnsignedTxs(evmEphemeral); + return buildRampProcess({ ...MXN_RAMP_FIELDS, unsignedTxs }); + }, + update: () => buildRampProcess({ ...MXN_RAMP_FIELDS, achPaymentData: ACH_PAYMENT_DATA, unsignedTxs }) + }); + await injectMockWallet(page); + + await page.goto("/widget?rampType=BUY&fiat=MXN&inputAmount=2000"); + + // Stage 1: the quote form fetched a BUY MXN quote. + await expect(page.locator('input[name="outputAmount"]')).toHaveValue(/100/, { timeout: 20_000 }); + await page.locator("form").getByRole("button", { name: "Buy" }).click(); + + // Stage 2 + 3: email/OTP auth gate. + await expect(page.getByRole("heading", { name: "Verify Your Email" })).toBeVisible({ timeout: 20_000 }); + await page.locator("#email").fill("e2e@vortexfinance.co"); + await page.locator("#terms").check(); + await page.getByRole("button", { name: "Continue" }).click(); + await expect(page.getByRole("heading", { name: "Enter Verification Code" })).toBeVisible({ timeout: 20_000 }); + await page.locator('input[autocomplete="one-time-code"]').pressSequentially("123456"); + + // Stage 4: wallet ownership step — the connected mock wallet is shown; confirming + // sends CONFIRM with the wallet as the destination. + await expect(page.getByText("Verify you are the owner of the wallet")).toBeVisible({ timeout: 20_000 }); + await expect(page.getByRole("button", { name: /0xf39F/ })).toBeVisible(); + await page.getByRole("button", { name: "Verify Wallet" }).click(); + + // Stage 5: the Alfredpay KYC gate queried the customer status for MX and, since the + // customer is verified (SUCCESS), the flow lands on the payment summary. + await expect(page.getByRole("heading", { name: "Payment Summary" })).toBeVisible({ timeout: 20_000 }); + + // Stage 6: confirming registers the ramp and signs the Polygon transactions in-page; + // the SPEI payment details from the update response are then displayed. + await page.getByRole("button", { name: "Confirm" }).click(); + await expect(page.getByText(E2E_CLABE).first()).toBeVisible({ timeout: 30_000 }); + await expect(page.getByText(ACH_PAYMENT_DATA.reference)).toBeVisible(); + + expect(backend.registerRequests).toHaveLength(1); + const registerBody = backend.registerRequests[0] as { + quoteId: string; + signingAccounts: Array<{ type: string }>; + additionalData?: { destinationAddress?: string; walletAddress?: string }; + }; + expect(registerBody.quoteId).toBe("quote-e2e-1"); + expect(registerBody.additionalData?.destinationAddress?.toLowerCase()).toBe(MOCK_WALLET_ADDRESS.toLowerCase()); + expect(registerBody.additionalData?.walletAddress?.toLowerCase()).toBe(MOCK_WALLET_ADDRESS.toLowerCase()); + + // Every unsigned Polygon transaction came back locally signed (raw EIP-1559 txs). + expect(backend.updateRequests.length).toBeGreaterThanOrEqual(1); + const presignedTxs = (backend.updateRequests[0] as { presignedTxs: Array<{ txData: unknown; phase: string }> }).presignedTxs; + expect(presignedTxs.map(tx => tx.phase).sort()).toEqual(["destinationTransfer", "polygonCleanup"]); + for (const tx of presignedTxs) { + expect(typeof tx.txData).toBe("string"); + expect(tx.txData as string).toMatch(/^0x02/); + } + + // Stage 7: confirming the payment starts the ramp; once polling reports COMPLETE the + // BUY success screen appears. + await page.getByRole("button", { name: "I have made the payment" }).click(); + await expect(page.getByRole("heading", { name: "All set! Your tokens are on their way." })).toBeVisible({ timeout: 45_000 }); + expect(backend.startRequests).toHaveLength(1); + expect(backend.startRequests[0]).toMatchObject({ rampId: E2E_RAMP_ID }); +}); diff --git a/apps/frontend/e2e/support/mockBackend.ts b/apps/frontend/e2e/support/mockBackend.ts index b1b7d8dda..fe4bf8f7c 100644 --- a/apps/frontend/e2e/support/mockBackend.ts +++ b/apps/frontend/e2e/support/mockBackend.ts @@ -101,6 +101,14 @@ interface MockBackendOptions { // How many GET /v1/ramp/:id polls report an in-progress ramp before flipping to COMPLETE. // Default 1: the progress page's immediate poll sees PENDING, the next one (after ~5s) sees COMPLETE. pendingStatusPolls?: number; + // Full response body for POST /v1/ramp/register. Default: the BUY BRL onramp response. + register?: (requestBody: Record) => unknown; + // Full response body for POST /v1/ramp/update. Default: a bare RampProcess. + update?: (requestBody: Record) => unknown; + // Extra fields merged into every GET /v1/ramp/:id status response (e.g. SELL currencies). + rampStatusOverrides?: (complete: boolean) => Record; + // Status served on GET /v1/alfredpay/alfredpayStatus (Alfredpay KYC gate). Default: SUCCESS. + alfredpayStatus?: string; } // Intercepts all traffic to the API origin (http://localhost:3000) so journeys run @@ -195,12 +203,23 @@ export async function mockBackend(page: Page, options: MockBackendOptions = {}) return; } + // Alfredpay KYC gate: the alfredpayKyc machine's CheckingStatus step. SUCCESS means an + // existing verified customer, so the KYC child completes immediately (the gate's happy path). + if (path === "/v1/alfredpay/alfredpayStatus" && method === "GET") { + await fulfillJson({ status: options.alfredpayStatus ?? "SUCCESS" }); + return; + } + // Ramp lifecycle (RampProcess shapes from packages/shared/src/endpoints/ramp.endpoints.ts). if (path === "/v1/ramp/register" && method === "POST") { const body = request.postDataJSON() as { signingAccounts?: Array<{ address: string; type: string }>; } & Record; registerRequests.push(body); + if (options.register) { + await fulfillJson(options.register(body)); + return; + } const evmEphemeral = body.signingAccounts?.find(account => account.type === "EVM")?.address ?? BASE_USDC; await fulfillJson( buildRampProcess({ @@ -210,8 +229,9 @@ export async function mockBackend(page: Page, options: MockBackendOptions = {}) return; } if (path === "/v1/ramp/update" && method === "POST") { - updateRequests.push(request.postDataJSON() as Record); - await fulfillJson(buildRampProcess()); + const body = request.postDataJSON() as Record; + updateRequests.push(body); + await fulfillJson(options.update ? options.update(body) : buildRampProcess()); return; } if (path === "/v1/ramp/start" && method === "POST") { @@ -239,7 +259,8 @@ export async function mockBackend(page: Page, options: MockBackendOptions = {}) totalFeeFiat: "0.7", totalFeeUsd: "0.14", vortexFeeFiat: "0", - vortexFeeUsd: "0" + vortexFeeUsd: "0", + ...options.rampStatusOverrides?.(complete) }) ); return; @@ -248,23 +269,101 @@ export async function mockBackend(page: Page, options: MockBackendOptions = {}) await route.fulfill({ json: {}, status: 404 }); }); - // The frontend pre-signs the ephemeral-account transactions locally with viem, which - // issues eth_chainId to the network's RPC before signing (signing itself is offline). - // Answer those RPC calls hermetically for Base (0x2105). - const answerRpc = (body: { id?: number; method?: string } | Array<{ id?: number; method?: string }>) => { - const answerOne = (req: { id?: number; method?: string }) => ({ - id: req.id ?? 1, - jsonrpc: "2.0", - result: req.method === "eth_chainId" ? "0x2105" : null - }); + // The app reads chain state through the networks' RPC endpoints (ephemeral signing issues + // eth_chainId; offramps also read the user's token balance and wait for the receipt of the + // user-broadcast transaction). Answer those calls hermetically per chain. + type RpcRequest = { id?: number; method?: string; params?: unknown[] }; + const answerRpc = (chainIdHex: string) => (body: RpcRequest | RpcRequest[]) => { + const answerOne = (req: RpcRequest) => { + const hash = (req.params?.[0] as string) ?? `0x${"cd".repeat(32)}`; + let result: unknown = null; + switch (req.method) { + case "eth_chainId": + result = chainIdHex; + break; + // Token balance reads (balanceOf & friends): a comfortably large uint256. + case "eth_call": + result = `0x${(10n ** 24n).toString(16).padStart(64, "0")}`; + break; + case "eth_getBalance": + result = "0xde0b6b3a7640000"; // 1 native token + break; + case "eth_blockNumber": + result = "0x1"; + break; + case "eth_getTransactionCount": + result = "0x0"; + break; + case "eth_estimateGas": + result = "0x5208"; + break; + case "eth_gasPrice": + case "eth_maxPriorityFeePerGas": + result = "0x3b9aca00"; + break; + case "eth_getBlockByNumber": + result = { baseFeePerGas: "0x1", number: "0x1" }; + break; + // Answering the tx lookup marks user-broadcast hashes as regular (non-Safe) txs. + case "eth_getTransactionByHash": + result = { blockHash: `0x${"ef".repeat(32)}`, blockNumber: "0x1", from: null, hash, input: "0x", value: "0x0" }; + break; + case "eth_getTransactionReceipt": + result = { + blockHash: `0x${"ef".repeat(32)}`, + blockNumber: "0x1", + contractAddress: null, + cumulativeGasUsed: "0x5208", + effectiveGasPrice: "0x3b9aca00", + gasUsed: "0x5208", + logs: [], + logsBloom: `0x${"00".repeat(256)}`, + status: "0x1", + transactionHash: hash, + transactionIndex: "0x0", + type: "0x2" + }; + break; + } + return { id: req.id ?? 1, jsonrpc: "2.0", result }; + }; return Array.isArray(body) ? body.map(answerOne) : answerOne(body); }; - for (const rpcPattern of ["https://base-mainnet.g.alchemy.com/**", "https://mainnet.base.org/**"]) { - await page.route(rpcPattern, async route => { - const body = route.request().postDataJSON() as Parameters[0]; - await route.fulfill({ json: answerRpc(body) }); + const rpcEndpoints: Array<{ chainIdHex: string; pattern: string }> = [ + { chainIdHex: "0x2105", pattern: "https://base-mainnet.g.alchemy.com/**" }, + { chainIdHex: "0x2105", pattern: "https://mainnet.base.org/**" }, + { chainIdHex: "0x89", pattern: "https://polygon-mainnet.g.alchemy.com/**" }, + { chainIdHex: "0x89", pattern: "https://polygon-rpc.com/**" } + ]; + for (const { chainIdHex, pattern } of rpcEndpoints) { + const answer = answerRpc(chainIdHex); + await page.route(pattern, async route => { + const body = route.request().postDataJSON() as Parameters[0]; + await route.fulfill({ json: answer(body) }); }); } + // Safe Wallet transaction service — never reached (eth_getTransactionByHash answers first), + // but blocked so a code change cannot silently make runs non-hermetic. + await page.route("https://safe-transaction-*.safe.global/**", route => route.abort()); + + // Alchemy Data API (token balances by address): the wallet holds plenty of USDC on Base + // and USDT on Polygon, so offramp balance gates pass. The balance fetcher keys results + // by tokenAddress per queried network; entries not configured for a network are ignored. + await page.route("https://api.g.alchemy.com/**", async route => { + await route.fulfill({ + json: { + data: { + tokens: [ + { tokenAddress: BASE_USDC, tokenBalance: `0x${(1_000_000_000_000n).toString(16)}` }, + { + tokenAddress: "0xc2132d05d31c914a87c6611c10748aeb04b58e8f", + tokenBalance: `0x${(1_000_000_000_000n).toString(16)}` + } + ] + } + } + }); + }); // SquidRouter token list: the app falls back to its static token config on failure. await page.route("https://v2.api.squidrouter.com/**", route => route.abort()); diff --git a/apps/frontend/playwright.config.ts b/apps/frontend/playwright.config.ts index e1a6e0e5c..186bf6fce 100644 --- a/apps/frontend/playwright.config.ts +++ b/apps/frontend/playwright.config.ts @@ -17,6 +17,9 @@ export default defineConfig({ }, webServer: { command: "bun x --bun vite --port 5173 --strictPort", + // A placeholder Alchemy key so balance fetching runs at all; every Alchemy + // endpoint is intercepted per-test in e2e/support/mockBackend.ts. + env: { VITE_ALCHEMY_API_KEY: "e2e-mock-key" }, reuseExistingServer: !process.env.CI, timeout: 120_000, url: "http://127.0.0.1:5173" diff --git a/apps/frontend/src/machines/actors/sign.actor.test.ts b/apps/frontend/src/machines/actors/sign.actor.test.ts index 4a446f7bf..e59cec424 100644 --- a/apps/frontend/src/machines/actors/sign.actor.test.ts +++ b/apps/frontend/src/machines/actors/sign.actor.test.ts @@ -103,6 +103,28 @@ describe("signTransactionsActor", () => { expect(updateCalls).toHaveLength(0); }); + it("signs only the user-wallet transactions of a SELL ramp, never the ephemeral's phases", async () => { + const updateCalls = mockUpdateEndpoint(); + vi.mocked(signAndSubmitEvmTransaction).mockResolvedValue("0xtransferhash"); + // A registered offramp carries both kinds: the user's source-of-funds + // transfer plus the ephemeral's presign blueprints (which would throw as + // "unknown phase" if they ever reached the user signing loop). + const context = buildContext([ + buildUnsignedTx({ nonce: 0, phase: "squidRouterNoPermitTransfer", signer: USER_ADDRESS }), + buildUnsignedTx({ nonce: 1, phase: "nablaApprove", signer: OTHER_ADDRESS }), + buildUnsignedTx({ nonce: 2, phase: "nablaSwap", signer: OTHER_ADDRESS }), + buildUnsignedTx({ nonce: 3, phase: "brlaPayoutOnBase", signer: OTHER_ADDRESS }) + ]); + + const { result } = await runActor(context); + + expect(signAndSubmitEvmTransaction).toHaveBeenCalledTimes(1); + expect(vi.mocked(signAndSubmitEvmTransaction).mock.calls[0][0].phase).toBe("squidRouterNoPermitTransfer"); + expect(updateCalls).toHaveLength(1); + expect(updateCalls[0].additionalData).toMatchObject({ squidRouterNoPermitTransferHash: "0xtransferhash" }); + expect(result.userSigningMeta).toBeDefined(); + }); + it("matches EVM signers case-insensitively", async () => { mockUpdateEndpoint(); vi.mocked(signAndSubmitEvmTransaction).mockResolvedValue("0xhash"); diff --git a/apps/frontend/src/machines/ramp.machine.test.ts b/apps/frontend/src/machines/ramp.machine.test.ts index 9831c1288..31cad4309 100644 --- a/apps/frontend/src/machines/ramp.machine.test.ts +++ b/apps/frontend/src/machines/ramp.machine.test.ts @@ -17,6 +17,7 @@ import { AuthService, type AuthTokens } from "../services/auth"; import { RampExecutionInput } from "../types/phases"; import { SignRampError, SignRampErrorType } from "./actors/sign.actor"; import { RampLimitExceededError } from "./actors/validateKyc.actor"; +import { AlfredpayKycMachineError, AlfredpayKycMachineErrorType, alfredpayKycMachine } from "./alfredpayKyc.machine"; import { aveniaKycMachine } from "./brlaKyc.machine"; import { MykoboKycMachineError, MykoboKycMachineErrorType, mykoboKycMachine } from "./mykoboKyc.machine"; import { RampContext, RampMachineEvents, RampState } from "./types"; @@ -112,6 +113,29 @@ const stubAveniaMachine = setup({}).createMachine({ states: { Done: { type: "final" } } }) as unknown as typeof aveniaKycMachine; +/** + * Minimal child machine standing in for the Alfredpay KYC machine. It captures + * the input the ramp machine passes (country routing) and finishes on FINISH — + * or on SummaryConfirm, to prove the parent forwards that event to this child. + */ +function stubAlfredpayMachine(output: { error?: AlfredpayKycMachineError } = {}) { + return setup({}).createMachine({ + context: ({ input }) => ({ capturedInput: input as { country?: string; business?: boolean } }), + initial: "Waiting", + output: () => output, + states: { Done: { type: "final" }, Waiting: { on: { FINISH: "Done", SummaryConfirm: "Done" } } } + }) as unknown as typeof alfredpayKycMachine; +} + +/** Waiting variant of the Avenia stub so the test can observe the {KYC: "Avenia"} state. */ +function stubWaitingAveniaMachine(output: { error?: { message: string } } = {}) { + return setup({}).createMachine({ + initial: "Waiting", + output: () => output, + states: { Done: { type: "final" }, Waiting: { on: { FINISH: "Done" } } } + }) as unknown as typeof aveniaKycMachine; +} + async function goToQuoteReady(actor: ReturnType) { actor.send({ lock: false, quoteId: "quote-1", type: "SET_QUOTE" }); await waitFor(actor, s => s.matches("QuoteReady")); @@ -491,6 +515,80 @@ describe("rampMachine", () => { expect(actor.getSnapshot().context.executionInput?.selectedFiatAccountId).toBe("fiat-account-1"); }); + it.each([ + [FiatToken.MXN, "MX"], + [FiatToken.USD, "US"], + [FiatToken.COP, "CO"], + [FiatToken.ARS, "AR"] + ])("routes %s ramps with kycNeeded to the Alfredpay child with country %s and completes", async (fiatToken, country) => { + const actor = createRampActor({ + alfredpayKyc: stubAlfredpayMachine(), + validateKyc: fromPromise(async (): Promise => ({ kycNeeded: true })) + }); + actor.start(); + await goToQuoteReady(actor); + await confirmRamp(actor, fiatToken); + + await waitFor(actor, s => s.matches({ KYC: "Alfredpay" })); + + // The parent derived the Alfredpay country from the quote's fiat token. + const child = actor.getSnapshot().children.alfredpayKyc as AnyActorRef; + const capturedInput = child.getSnapshot().context.capturedInput as { country?: string; business?: boolean }; + expect(capturedInput.country).toBe(country); + expect(capturedInput.business).toBeUndefined(); + + child.send({ type: "FINISH" }); + await waitFor(actor, s => s.matches("KycComplete")); + }); + + it("an Alfredpay KYC error output resets the ramp but keeps the failure message", async () => { + const actor = createRampActor({ + alfredpayKyc: stubAlfredpayMachine({ + error: new AlfredpayKycMachineError("Verification rejected", AlfredpayKycMachineErrorType.UnknownError) + }), + validateKyc: fromPromise(async (): Promise => ({ kycNeeded: true })) + }); + actor.start(); + await goToQuoteReady(actor); + await confirmRamp(actor, FiatToken.MXN); + await waitFor(actor, s => s.matches({ KYC: "Alfredpay" })); + + (actor.getSnapshot().children.alfredpayKyc as AnyActorRef).send({ type: "FINISH" }); + // KycFailure immediately resets; the reset preserves initializeFailedMessage for the UI. + await waitFor(actor, s => s.matches("Idle")); + expect(actor.getSnapshot().context.initializeFailedMessage).toBe("Verification rejected"); + }); + + it("SummaryConfirm inside KYC is forwarded to the Alfredpay child", async () => { + const actor = createRampActor({ + alfredpayKyc: stubAlfredpayMachine(), + validateKyc: fromPromise(async (): Promise => ({ kycNeeded: true })) + }); + actor.start(); + await goToQuoteReady(actor); + await confirmRamp(actor, FiatToken.ARS); + await waitFor(actor, s => s.matches({ KYC: "Alfredpay" })); + + // The stub finalizes when it receives the forwarded SummaryConfirm. + actor.send({ type: "SummaryConfirm" }); + await waitFor(actor, s => s.matches("KycComplete")); + }); + + it("routes BRL ramps with kycNeeded to the Avenia child and advances to KycComplete on success", async () => { + const actor = createRampActor({ + aveniaKyc: stubWaitingAveniaMachine(), + validateKyc: fromPromise(async (): Promise => ({ kycNeeded: true })) + }); + actor.start(); + await goToQuoteReady(actor); + await confirmRamp(actor, FiatToken.BRL); + + await waitFor(actor, s => s.matches({ KYC: "Avenia" })); + + (actor.getSnapshot().children.aveniaKyc as AnyActorRef).send({ type: "FINISH" }); + await waitFor(actor, s => s.matches("KycComplete")); + }); + it("completes the quote-less KYB deep link via SelectRegion and lands in KybLinkComplete", async () => { const actor = createRampActor({ aveniaKyc: stubAveniaMachine }); actor.start(); diff --git a/apps/frontend/vitest.config.ts b/apps/frontend/vitest.config.ts index aa8df3d61..9c1de7737 100644 --- a/apps/frontend/vitest.config.ts +++ b/apps/frontend/vitest.config.ts @@ -24,8 +24,8 @@ export default defineConfig({ // last raised (enforced by `bun run test:coverage`, which CI runs). // Raise them as tested code grows; never lower them to make CI pass. thresholds: { - functions: 42, - lines: 25 + functions: 43, + lines: 25.8 } }, // Dummy values so src/config/supabase.ts (pulled in transitively via services/auth) diff --git a/docs/testing-strategy.md b/docs/testing-strategy.md index 196b4e7cb..5a429ab0c 100644 --- a/docs/testing-strategy.md +++ b/docs/testing-strategy.md @@ -18,9 +18,9 @@ together with the shared test harness (`apps/api/src/test-utils`) — see "How t | Layer | What | Where | Runner | |---|---|---|---| | 1. Unit | Pure logic: helpers, token configs, SDK handlers | each package, next to source | `bun test` (Vitest for frontend) | -| 2. API integration | Real Express + real Postgres + fake external world, driven over HTTP; incl. the quote pricing goldens (`quote-pricing.golden.test.ts`) | `apps/api/src/tests/` | `bun test` | -| 3. Corridor scenarios | Phase processor end-to-end per corridor against the fake world: BRL onramp (pix→BRLA-on-Base), BRL offramp (USDC-on-Base→pix incl. real Nabla swap + both EVM subsidy phases), MXN on/offramp (spei↔USDT-on-Polygon), and a USD/COP/ARS happy-path matrix over the same Alfredpay rails | `apps/api/src/tests/corridors/` | `bun test` | -| 4. SDK contract | Real SDK against the real API in-process | `apps/api/src/tests/sdk-contract.test.ts` | `bun test` | +| 2. API integration | Real Express + real Postgres + fake external world, driven over HTTP; incl. the quote pricing goldens (`quote-pricing.golden.test.ts`) and the HTTP surface tests (auth OTP flow, webhooks, ramp history, public routes; `http-surface.invariants.test.ts`) | `apps/api/src/tests/` | `bun test` | +| 3. Corridor scenarios | Phase processor end-to-end per corridor against the fake world: BRL onramp (pix→BRLA-on-Base), BRL offramp (USDC-on-Base→pix incl. real Nabla swap + both EVM subsidy phases), CROSS-CHAIN BRL offramp (USDC-on-Polygon→squid→Base→pix incl. user-reported squid-hash verification), MXN on/offramp (spei↔USDT-on-Polygon), CROSS-CHAIN MXN onramp (spei→Polygon mint→squid→USDT-on-Arbitrum incl. real squidRouterSwap/Pay + Arbitrum settlement subsidy), and a USD/COP/ARS matrix over the same Alfredpay rails (happy paths + per-currency limit breaches + transient/unrecoverable failures) | `apps/api/src/tests/corridors/` | `bun test` | +| 4. SDK contract | Real SDK against the real API in-process: BRL onramp lifecycle (`sdk-contract.test.ts`) and the SELL/user-transaction surface — offramp lifecycle via submitUserTransactions, updateRamp, getQuote, listAlfredpayFiatAccounts (`sdk-contract.offramp.test.ts`) | `apps/api/src/tests/sdk-contract*.test.ts` | `bun test` | | 5. Frontend | XState machine tests, actor tests (register/sign/start/KYC-routing against MSW with mocked wallet seams), component tests (RTL + MSW + mock wagmi) | `apps/frontend/src` | Vitest | | 6. E2E | Few critical Playwright journeys with a mock wallet | `apps/frontend/e2e/` | Playwright (non-blocking) | @@ -90,10 +90,15 @@ hand-write these objects or copy JSON snapshots into tests; extend the factory i ### Playwright E2E (`apps/frontend/e2e/`) A handful of critical journeys run against the real frontend in Chromium, hermetically: quote -form → quote displayed, quote error surfaced, wallet gate on offramps, and one full BRL onramp -journey (`onramp-brl-journey.spec.ts`: quote → email/OTP auth → Avenia KYC gate → registration → -in-page ephemeral signing asserted via the presigned txs posted to `/v1/ramp/update` → Pix -payment info → progress → success): +form → quote displayed, quote error surfaced, wallet gate on offramps, and three full ramp +journeys — the BRL onramp (`onramp-brl-journey.spec.ts`: quote → email/OTP auth → Avenia KYC +gate → registration → in-page ephemeral signing asserted via the presigned txs posted to +`/v1/ramp/update` → Pix payment info → progress → success), the BRL OFFRAMP +(`offramp-brl-journey.spec.ts`: the money-out path — wallet gate + balance check → CPF/Pix +eligibility → registration → USER-WALLET broadcast of the source-of-funds transfer with its +hash reported in a second update → automatic start → success), and the MXN onramp +(`onramp-mxn-journey.spec.ts`: the Alfredpay rail — Alfredpay KYC gate → Polygon-side +ephemeral signing → SPEI payment details (CLABE) → success): - The API origin (`http://localhost:3000`) is intercepted per-test with `page.route` (`e2e/support/mockBackend.ts`) — no backend, database, or chain access. @@ -128,9 +133,9 @@ never PR-blocking. - **Non-blocking / nightly**: Playwright E2E journeys and any live smoke tests. Failures alert; they don't block merges. - Every workspace suite carries a coverage ratchet, enforced by `bun run test:coverage` in CI: - the bun workspaces (shared, rebalancer, api) produce an LCOV report checked against per-package - floors by `scripts/check-coverage.ts` (floors live in each `package.json` script); the frontend - uses vitest's built-in thresholds (`apps/frontend/vitest.config.ts`). Floors sit just under the + the bun workspaces (shared, sdk, rebalancer, api) produce an LCOV report checked against + per-package floors by `scripts/check-coverage.ts` (floors live in each `package.json` script); + the frontend uses vitest's built-in thresholds (`apps/frontend/vitest.config.ts`). Floors sit just under the coverage measured when they were last raised — raise them when you add tested code; never lower them to make CI pass. - The coverage denominator is real, testable source only: built bundles, foreign workspace code, diff --git a/package.json b/package.json index f56c1dfdc..b103f2d14 100644 --- a/package.json +++ b/package.json @@ -124,7 +124,7 @@ "test": "bun run test:shared && bun run test:sdk && bun run test:rebalancer && bun run test:api && bun run test:frontend", "test:api": "cd apps/api && bun test", "test:contracts:relayer": "bun run --cwd contracts/relayer test", - "test:coverage": "bun run --cwd packages/shared test:coverage && bun run --cwd apps/rebalancer test:coverage && bun run --cwd apps/api test:coverage && bun run --cwd apps/frontend test:coverage && bun scripts/coverage-report.ts", + "test:coverage": "bun run --cwd packages/shared test:coverage && bun run --cwd packages/sdk test:coverage && bun run --cwd apps/rebalancer test:coverage && bun run --cwd apps/api test:coverage && bun run --cwd apps/frontend test:coverage && bun scripts/coverage-report.ts", "test:coverage:html": "bun scripts/coverage-report.ts --html coverage/index.html && open coverage/index.html", "test:db:start": "bun run --cwd apps/api test:db:start", "test:db:stop": "bun run --cwd apps/api test:db:stop", diff --git a/packages/sdk/bunfig.toml b/packages/sdk/bunfig.toml new file mode 100644 index 000000000..d0707c586 --- /dev/null +++ b/packages/sdk/bunfig.toml @@ -0,0 +1,6 @@ +[test] +# Coverage report config; the gate itself lives in scripts/check-coverage.ts. +# Without the ignore pattern, the built shared bundle dominates the denominator +# and the ratchet measures shared's coverage instead of the SDK's. +coverageSkipTestFiles = true +coveragePathIgnorePatterns = ["**/packages/shared/dist/**"] diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 1bc746271..fe23d8520 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -47,6 +47,7 @@ "lint": "eslint . --ext .ts", "prepublishOnly": "bun run build", "test": "bun test && bun run build && node -e \"require('./dist/index.js')\"", + "test:coverage": "bun test --coverage --coverage-reporter=lcov && bun ../../scripts/check-coverage.ts coverage/lcov.info 0.32 0.15", "typecheck": "bun x --bun tsc" }, "type": "module", From 28aeeb6d76a837c39be24cb2fe9603cf85272705 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 13:29:23 +0200 Subject: [PATCH 151/176] Record final-settlement subsidies in the Subsidy table The finalSettlementSubsidy handler stored the tx hash in ramp state but never wrote a Subsidy row, so settlement top-ups were invisible to subsidy accounting. Record the confirmed transfer via createSubsidy like the other subsidy handlers. The DB enum also lacked USDT (this corridor's settlement token) and ETH (already used by the BRL gas subsidy in squidRouterPay, whose inserts failed silently), so migration 036 adds both. The MXN cross-chain corridor test now asserts the persisted row. --- .../handlers/final-settlement-subsidy.ts | 13 +++++ .../036-add-eth-usdt-to-subsidy-token-enum.ts | 52 +++++++++++++++++++ apps/api/src/models/subsidy.model.ts | 3 +- .../mxn-onramp-crosschain.scenario.test.ts | 12 ++++- .../06-cross-chain/fund-routing.md | 2 +- 5 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 apps/api/src/database/migrations/036-add-eth-usdt-to-subsidy-token-enum.ts diff --git a/apps/api/src/api/services/phases/handlers/final-settlement-subsidy.ts b/apps/api/src/api/services/phases/handlers/final-settlement-subsidy.ts index 719893b26..47b55eaa7 100644 --- a/apps/api/src/api/services/phases/handlers/final-settlement-subsidy.ts +++ b/apps/api/src/api/services/phases/handlers/final-settlement-subsidy.ts @@ -15,6 +15,7 @@ import { multiplyByPowerOfTen, NATIVE_TOKEN_ADDRESS, Networks, + nativeToDecimal, RampCurrency, RampDirection, RampPhase, @@ -27,6 +28,7 @@ import logger from "../../../../config/logger"; import { MAX_FINAL_SETTLEMENT_SUBSIDY_USD } from "../../../../constants/constants"; import QuoteTicket from "../../../../models/quoteTicket.model"; import RampState from "../../../../models/rampState.model"; +import { SubsidyToken } from "../../../../models/subsidy.model"; import { priceFeedService } from "../../priceFeed.service"; import { isFiatToOwnStablecoinBaseDirect } from "../../quote/utils"; import { BasePhaseHandler } from "../base-phase-handler"; @@ -373,6 +375,17 @@ export class FinalSettlementSubsidyHandler extends BasePhaseHandler { throw new Error(`Failed to confirm subsidy transaction after ${attempt} attempts`); } + if (txHash) { + const subsidyToken = ( + isNative ? NATIVE_TOKENS[destinationNetwork].symbol : outTokenDetails.assetSymbol + ) as SubsidyToken; + const subsidyAmount = nativeToDecimal( + subsidyAmountRaw, + isNative ? NATIVE_TOKENS[destinationNetwork].decimals : outTokenDetails.decimals + ).toNumber(); + await this.createSubsidy(state, subsidyAmount, subsidyToken, fundingAccount.address, txHash); + } + await state.update({ state: { ...state.state, diff --git a/apps/api/src/database/migrations/036-add-eth-usdt-to-subsidy-token-enum.ts b/apps/api/src/database/migrations/036-add-eth-usdt-to-subsidy-token-enum.ts new file mode 100644 index 000000000..a44573acd --- /dev/null +++ b/apps/api/src/database/migrations/036-add-eth-usdt-to-subsidy-token-enum.ts @@ -0,0 +1,52 @@ +import { QueryInterface } from "sequelize"; + +// Migration 022 left the DB enum without ETH even though SubsidyToken.ETH existed +// in the model (squid-router-pay ETH gas subsidies failed silently in createSubsidy). +// USDT is new: finalSettlementSubsidy now records rows for USDT settlement top-ups. +const OLD_ENUM_VALUES = ["GLMR", "PEN", "XLM", "USDC.axl", "BRLA", "EURC", "USDC", "MATIC", "BRL"]; +const NEW_ENUM_VALUES = [...OLD_ENUM_VALUES, "ETH", "USDT"]; + +export async function up(queryInterface: QueryInterface): Promise { + // Phase 1: Convert enum to VARCHAR to allow value updates + await queryInterface.sequelize.query(` + ALTER TABLE subsidies ALTER COLUMN token TYPE VARCHAR(32); + `); + + // Phase 2: Replace enum type with updated values + await queryInterface.sequelize.query(` + DROP TYPE IF EXISTS enum_subsidies_token; + `); + + await queryInterface.sequelize.query(` + CREATE TYPE enum_subsidies_token AS ENUM (${NEW_ENUM_VALUES.map(value => `'${value}'`).join(", ")}); + `); + + await queryInterface.sequelize.query(` + ALTER TABLE subsidies ALTER COLUMN token TYPE enum_subsidies_token USING token::enum_subsidies_token; + `); +} + +export async function down(queryInterface: QueryInterface): Promise { + // Phase 1: Convert enum to VARCHAR to allow value updates + await queryInterface.sequelize.query(` + ALTER TABLE subsidies ALTER COLUMN token TYPE VARCHAR(32); + `); + + // Phase 2: Map values unsupported by the old enum to USDC + await queryInterface.sequelize.query(` + UPDATE subsidies SET token = 'USDC' WHERE token IN ('ETH', 'USDT'); + `); + + // Phase 3: Restore old enum type + await queryInterface.sequelize.query(` + DROP TYPE IF EXISTS enum_subsidies_token; + `); + + await queryInterface.sequelize.query(` + CREATE TYPE enum_subsidies_token AS ENUM (${OLD_ENUM_VALUES.map(value => `'${value}'`).join(", ")}); + `); + + await queryInterface.sequelize.query(` + ALTER TABLE subsidies ALTER COLUMN token TYPE enum_subsidies_token USING token::enum_subsidies_token; + `); +} diff --git a/apps/api/src/models/subsidy.model.ts b/apps/api/src/models/subsidy.model.ts index e4bd896e8..385cac4dc 100644 --- a/apps/api/src/models/subsidy.model.ts +++ b/apps/api/src/models/subsidy.model.ts @@ -13,7 +13,8 @@ export enum SubsidyToken { USDC = "USDC", MATIC = "MATIC", BRL = "BRL", - ETH = "ETH" + ETH = "ETH", + USDT = "USDT" } export interface SubsidyAttributes { diff --git a/apps/api/src/tests/corridors/mxn-onramp-crosschain.scenario.test.ts b/apps/api/src/tests/corridors/mxn-onramp-crosschain.scenario.test.ts index 266946b54..188f2f752 100644 --- a/apps/api/src/tests/corridors/mxn-onramp-crosschain.scenario.test.ts +++ b/apps/api/src/tests/corridors/mxn-onramp-crosschain.scenario.test.ts @@ -16,6 +16,7 @@ import { getEvmFundingAccount } from "../../api/services/phases/evm-funding"; import phaseProcessor from "../../api/services/phases/phase-processor"; import QuoteTicket from "../../models/quoteTicket.model"; import RampState from "../../models/rampState.model"; +import Subsidy, { SubsidyToken } from "../../models/subsidy.model"; import { resetTestDatabase, setupTestDatabase } from "../../test-utils/db"; import { createTestAlfredpayCustomer, createTestUser } from "../../test-utils/factories"; import { type FakeWorld, installFakeWorld } from "../../test-utils/fake-world"; @@ -402,8 +403,6 @@ describe("MXN onramp cross-chain corridor (spei → Polygon mint → USDT on Arb // The funding account sent exactly the shortfall as a USDT transfer to // the ephemeral on ARBITRUM, and its hash was recorded for idempotency. - // (Note: unlike the gas subsidy in squidRouterPay, this handler keeps no - // Subsidy table row.) expect(final?.state.finalSettlementSubsidyTxHash).toBeTruthy(); const subsidyTransfers = world.evm.sentTransactions.filter(tx => { if (tx.network !== Networks.Arbitrum || tx.from?.toLowerCase() !== fundingAccount.address.toLowerCase() || !tx.data) { @@ -419,6 +418,15 @@ describe("MXN onramp cross-chain corridor (spei → Polygon mint → USDT on Arb }); expect(subsidyTransfers.length).toBe(1); expect(world.evm.erc20Balance(Networks.Arbitrum, USDT_ON_ARBITRUM, setup.destination)).toBe(setup.amountRaw); + + // The top-up is recorded in the subsidies table so accounting sees it, + // just like the gas subsidy in squidRouterPay. + const subsidyRows = await Subsidy.findAll({ where: { phase: "finalSettlementSubsidy", rampId: setup.rampId } }); + expect(subsidyRows.length).toBe(1); + expect(subsidyRows[0].token).toBe(SubsidyToken.USDT); + expect(subsidyRows[0].amount).toBeCloseTo(1); + expect(subsidyRows[0].payerAccount.toLowerCase()).toBe(fundingAccount.address.toLowerCase()); + expect(subsidyRows[0].transactionHash).toBe(final?.state.finalSettlementSubsidyTxHash as string); }, 30000 ); diff --git a/docs/security-spec/06-cross-chain/fund-routing.md b/docs/security-spec/06-cross-chain/fund-routing.md index e3f8e5e5f..bedbe669c 100644 --- a/docs/security-spec/06-cross-chain/fund-routing.md +++ b/docs/security-spec/06-cross-chain/fund-routing.md @@ -9,7 +9,7 @@ There are now **five** subsidization-related phase handlers and one settlement p **Phase handlers (Substrate):** - `subsidize-pre-swap-handler.ts` — Tops up the Pendulum ephemeral before a Nabla swap to ensure it has the expected input amount - `subsidize-post-swap-handler.ts` — Tops up the Pendulum ephemeral after a Nabla swap. Also contains complex next-phase routing logic. -- `final-settlement-subsidy.ts` — Tops up an EVM ephemeral by SquidRouter-swapping native → ERC-20 (legacy / cross-chain settlement). Has a USD cap (`MAX_FINAL_SETTLEMENT_SUBSIDY_USD`). +- `final-settlement-subsidy.ts` — Tops up an EVM ephemeral by SquidRouter-swapping native → ERC-20 (legacy / cross-chain settlement). Has a USD cap (`MAX_FINAL_SETTLEMENT_SUBSIDY_USD`). Records the confirmed top-up as a `subsidies` table row (like the other subsidy handlers), so settlement subsidies are visible to subsidy accounting. - `destination-transfer-handler.ts` — Sends the presigned EVM transfer from the ephemeral to the user's destination address **Phase handlers (EVM):** The Substrate handlers above are polymorphic: `subsidize-pre-swap-handler.ts` and `subsidize-post-swap-handler.ts` dispatch to their EVM branches when the ephemeral involved is on a supported EVM chain (currently Base). The EVM pre-swap branch tops the ephemeral up before `nablaSwap` and enforces the quote-relative cap fraction from `MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION` (default `0.05`). The EVM post-swap branch splits the required top-up into a swap-discrepancy component and a discount component: `MAX_EVM_SWAP_SUBSIDY_QUOTE_FRACTION` applies to the actual-vs-quoted swap-output discrepancy, while `MAX_EVM_POST_SWAP_DISCOUNT_SUBSIDY_QUOTE_FRACTION` (default `0.05`) caps the discount-derived top-up separately. From f09a21f7f01d4922358e5c2276f8be872ec18a49 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 16:45:40 +0200 Subject: [PATCH 152/176] Cover per-currency Alfredpay failure modes and the MXN offramp transient seam --- .../alfredpay-currencies.scenario.test.ts | 567 ++++++++---------- .../corridors/mxn-offramp.scenario.test.ts | 43 ++ 2 files changed, 284 insertions(+), 326 deletions(-) diff --git a/apps/api/src/tests/corridors/alfredpay-currencies.scenario.test.ts b/apps/api/src/tests/corridors/alfredpay-currencies.scenario.test.ts index b0bfdf04e..ffd07e2e6 100644 --- a/apps/api/src/tests/corridors/alfredpay-currencies.scenario.test.ts +++ b/apps/api/src/tests/corridors/alfredpay-currencies.scenario.test.ts @@ -16,7 +16,7 @@ import { } from "@vortexfi/shared"; import Big from "big.js"; import { BaseError, ContractFunctionExecutionError, decodeFunctionData, encodeFunctionData, erc20Abi, parseTransaction } from "viem"; -import { generatePrivateKey, privateKeyToAccount, type PrivateKeyAccount } from "viem/accounts"; +import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"; import { parseUnits } from "viem/utils"; import phaseProcessor from "../../api/services/phases/phase-processor"; import QuoteTicket from "../../models/quoteTicket.model"; @@ -100,11 +100,12 @@ const CURRENCY_CASES: CurrencyCase[] = [ ]; /** - * Parameterized happy-path scenarios for the Alfredpay corridors beyond MXN: - * USD (ach), COP (ach) and ARS (cbu), each in both directions. The failure and - * security variants live in the MXN corridor files — the phase handlers are - * shared, so what these tests protect is the per-currency configuration: - * rails, limits, and the fiat↔Alfredpay currency mapping. + * Parameterized scenarios for the Alfredpay corridors beyond MXN: USD (ach), + * COP (ach) and ARS (cbu), each in both directions. The deeper security and + * subsidy-cap variants live in the MXN corridor files — the phase handlers are + * shared, so what these tests protect is the per-currency configuration + * (rails, limits, and the fiat↔Alfredpay currency mapping) on the happy path + * plus one transient (recoverable) and one unrecoverable failure per currency. */ describe("Alfredpay currency corridors (USD/COP/ARS, on- and offramp)", () => { let world: FakeWorld; @@ -199,71 +200,200 @@ describe("Alfredpay currency corridors (USD/COP/ARS, on- and offramp)", () => { expect(response.status, `ramp update failed: ${await response.clone().text()}`).toBe(200); } - for (const currency of CURRENCY_CASES) { - it( - `${currency.fiat} onramp (${currency.rail} → USDT on Polygon) completes and maps to Alfredpay ${currency.alfredpayCurrency}`, - async () => { - world.alfredpay.onrampRate = currency.onrampRate; - // The in-memory anchor keeps orders across tests in this file. - const ordersBefore = world.alfredpay.onrampOrders.length; - const ephemeral = privateKeyToAccount(generatePrivateKey()); - const destination = privateKeyToAccount(generatePrivateKey()).address as `0x${string}`; + interface OnrampSetup { + rampId: string; + quoteId: string; + destination: `0x${string}`; + /** Raw quoted USDT output the destination must receive. */ + amountRaw: bigint; + } - const user = await createTestUser(); - await createTestAlfredpayCustomer(user.id, { country: currency.country }); - const quote = await createQuoteViaApi({ - from: currency.rail, - inputAmount: currency.onrampInputAmount, - inputCurrency: currency.fiat, + /** + * Full BUY setup via the HTTP API — quote, register, presign the destination + * transfer (plus the four required backups), update — then script the fake + * world for the happy path: minted USDT and gas already on the ephemeral, + * raw ERC-20 transfers applied to the in-memory ledger. + */ + async function setUpOnrampRamp(currency: CurrencyCase): Promise { + world.alfredpay.onrampRate = currency.onrampRate; + const ephemeral = privateKeyToAccount(generatePrivateKey()); + const destination = privateKeyToAccount(generatePrivateKey()).address as `0x${string}`; + + const user = await createTestUser(); + await createTestAlfredpayCustomer(user.id, { country: currency.country }); + const quote = await createQuoteViaApi({ + from: currency.rail, + inputAmount: currency.onrampInputAmount, + inputCurrency: currency.fiat, + network: Networks.Polygon, + outputCurrency: EvmToken.USDT, + rampType: RampDirection.BUY, + to: Networks.Polygon + }); + const ramp = await registerViaApi(quote.id, user.id, [{ address: ephemeral.address, type: "EVM" }], { + destinationAddress: destination + }); + + const persistedQuote = await QuoteTicket.findByPk(quote.id); + const mintAmountRaw = BigInt(persistedQuote?.metadata.alfredpayMint?.outputAmountRaw ?? "0"); + expect(mintAmountRaw).toBeGreaterThan(0n); + const amountRaw = parseUnits(quote.outputAmount, ALFREDPAY_ERC20_DECIMALS); + + const signTransfer = (nonce: number) => + ephemeral.signTransaction({ + chainId: 137, + data: encodeFunctionData({ abi: erc20Abi, args: [destination, amountRaw], functionName: "transfer" }), + gas: 100_000n, + maxFeePerGas: 5_000_000_000n, + maxPriorityFeePerGas: 5_000_000_000n, + nonce, + to: ALFREDPAY_ERC20_TOKEN, + type: "eip1559" + }); + const backups: Record = {}; + for (let i = 1; i <= 4; i++) { + backups[`backup${i}`] = { nonce: i, txData: await signTransfer(i) }; + } + await updateRampViaApi(ramp.id, user.id, { + presignedTxs: [ + { + meta: { additionalTxs: backups }, network: Networks.Polygon, - outputCurrency: EvmToken.USDT, - rampType: RampDirection.BUY, - to: Networks.Polygon - }); - const ramp = await registerViaApi(quote.id, user.id, [{ address: ephemeral.address, type: "EVM" }], { - destinationAddress: destination + nonce: 0, + phase: "destinationTransfer", + signer: ephemeral.address, + txData: await signTransfer(0) + } + ] + }); + + world.evm.setNativeBalance(Networks.Polygon, ephemeral.address, parseUnits("2", 18)); + world.evm.setErc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, ephemeral.address, mintAmountRaw); + applyErc20TransfersToLedger(); + + return { amountRaw, destination, quoteId: quote.id, rampId: ramp.id }; + } + + interface OfframpSetup { + rampId: string; + quoteId: string; + /** Raw (6-decimal) USDT amount the offramp moves. */ + inputAmountRaw: bigint; + /** Anchor deposit address the final transfer must pay. */ + depositAddress: string; + } + + /** + * Full SELL setup via the HTTP API on the no-permit path — Polygon USDT has + * no EIP-2612 support, so the nonces() probe is scripted to fail as a + * contract-call error and the user broadcasts a plain transfer: quote, + * register, user-wallet broadcast, presign of the ephemeral's deposit + * transfer (plus backups), update — then script the fake world for the + * happy path. + */ + async function setUpOfframpRamp(currency: CurrencyCase): Promise { + world.alfredpay.offrampRate = currency.offrampRate; + const ephemeral = privateKeyToAccount(generatePrivateKey()); + const userWallet = privateKeyToAccount(generatePrivateKey()); + + world.evm.onReadContract = (_network, params) => { + if (params.functionName === "nonces") { + throw new ContractFunctionExecutionError(new BaseError("nonces() reverted"), { + abi: erc20Abi, + contractAddress: params.address, + functionName: "nonces" }); + } + return undefined; + }; - const persistedQuote = await QuoteTicket.findByPk(quote.id); - const mintAmountRaw = BigInt(persistedQuote?.metadata.alfredpayMint?.outputAmountRaw ?? "0"); - expect(mintAmountRaw).toBeGreaterThan(0n); - const amountRaw = parseUnits(quote.outputAmount, ALFREDPAY_ERC20_DECIMALS); - - const signTransfer = (nonce: number) => - ephemeral.signTransaction({ - chainId: 137, - data: encodeFunctionData({ abi: erc20Abi, args: [destination, amountRaw], functionName: "transfer" }), - gas: 100_000n, - maxFeePerGas: 5_000_000_000n, - maxPriorityFeePerGas: 5_000_000_000n, - nonce, - to: ALFREDPAY_ERC20_TOKEN, - type: "eip1559" - }); - const backups: Record = {}; - for (let i = 1; i <= 4; i++) { - backups[`backup${i}`] = { nonce: i, txData: await signTransfer(i) }; + const user = await createTestUser(); + await createTestAlfredpayCustomer(user.id, { country: currency.country }); + const quote = await createQuoteViaApi({ + from: Networks.Polygon, + inputAmount: currency.offrampInputAmount, + inputCurrency: EvmToken.USDT, + network: Networks.Polygon, + outputCurrency: currency.fiat, + rampType: RampDirection.SELL, + to: currency.rail + }); + const ramp = await registerViaApi(quote.id, user.id, [{ address: ephemeral.address, type: "EVM" }], { + fiatAccountId: "test-fiat-account-1", + walletAddress: userWallet.address + }); + + const persistedQuote = await QuoteTicket.findByPk(quote.id); + const inputAmountRaw = BigInt(persistedQuote?.metadata.alfredpayOfframp?.inputAmountRaw ?? "0"); + expect(inputAmountRaw).toBeGreaterThan(0n); + + const registered = await RampState.findByPk(ramp.id); + const allUnsignedTxs: UnsignedTx[] = registered?.unsignedTxs ?? []; + const userTransferBlueprint = allUnsignedTxs.find(tx => tx.phase === "squidRouterNoPermitTransfer"); + const offrampTransferBlueprint = allUnsignedTxs.find(tx => tx.phase === "alfredpayOfframpTransfer"); + expect(userTransferBlueprint).toBeDefined(); + expect(offrampTransferBlueprint).toBeDefined(); + const userTxData = userTransferBlueprint?.txData as unknown as { to: `0x${string}`; data: `0x${string}` }; + const offrampTxData = offrampTransferBlueprint?.txData as unknown as { to: `0x${string}`; data: `0x${string}` }; + + const signOfframpTransfer = (nonce: number) => + ephemeral.signTransaction({ + chainId: 137, + data: offrampTxData.data, + gas: 100_000n, + maxFeePerGas: 5_000_000_000n, + maxPriorityFeePerGas: 5_000_000_000n, + nonce, + to: offrampTxData.to, + type: "eip1559" + }); + const backups: Record = {}; + for (let i = 1; i <= 4; i++) { + backups[`backup${i}`] = { nonce: i, txData: await signOfframpTransfer(i) }; + } + + const userTxHash = world.evm.broadcastUserTransaction(Networks.Polygon, userWallet.address, { + data: userTxData.data, + to: userTxData.to, + value: 0n + }); + await updateRampViaApi(ramp.id, user.id, { + additionalData: { squidRouterNoPermitTransferHash: userTxHash }, + presignedTxs: [ + { + meta: { additionalTxs: backups }, + network: Networks.Polygon, + nonce: 0, + phase: "alfredpayOfframpTransfer", + signer: ephemeral.address, + txData: await signOfframpTransfer(0) } - await updateRampViaApi(ramp.id, user.id, { - presignedTxs: [ - { - meta: { additionalTxs: backups }, - network: Networks.Polygon, - nonce: 0, - phase: "destinationTransfer", - signer: ephemeral.address, - txData: await signTransfer(0) - } - ] - }); + ] + }); + + world.evm.setNativeBalance(Networks.Polygon, ephemeral.address, parseUnits("2", 18)); + world.evm.setErc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, ephemeral.address, inputAmountRaw); + applyErc20TransfersToLedger(); + + return { + depositAddress: world.alfredpay.offrampDepositAddress, + inputAmountRaw, + quoteId: quote.id, + rampId: ramp.id + }; + } - world.evm.setNativeBalance(Networks.Polygon, ephemeral.address, parseUnits("2", 18)); - world.evm.setErc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, ephemeral.address, mintAmountRaw); - applyErc20TransfersToLedger(); + for (const currency of CURRENCY_CASES) { + it( + `${currency.fiat} onramp (${currency.rail} → USDT on Polygon) completes and maps to Alfredpay ${currency.alfredpayCurrency}`, + async () => { + // The in-memory anchor keeps orders across tests in this file. + const ordersBefore = world.alfredpay.onrampOrders.length; + const setup = await setUpOnrampRamp(currency); - await phaseProcessor.processRamp(ramp.id); + await phaseProcessor.processRamp(setup.rampId); - const final = await RampState.findByPk(ramp.id); + const final = await RampState.findByPk(setup.rampId); expect(final?.currentPhase).toBe("complete"); expect(final?.phaseHistory.map(entry => entry.phase)).toEqual(ONRAMP_PHASES); expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); @@ -276,9 +406,9 @@ describe("Alfredpay currency corridors (USD/COP/ARS, on- and offramp)", () => { expect(order.toCurrency).toBe("USDT" as never); expect(Number(order.amount)).toBe(Number(currency.onrampInputAmount)); - const quoteRow = await QuoteTicket.findByPk(quote.id); + const quoteRow = await QuoteTicket.findByPk(setup.quoteId); expect(quoteRow?.status).toBe("consumed"); - expect(world.evm.erc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, destination)).toBe(amountRaw); + expect(world.evm.erc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, setup.destination)).toBe(setup.amountRaw); }, 30000 ); @@ -286,98 +416,13 @@ describe("Alfredpay currency corridors (USD/COP/ARS, on- and offramp)", () => { it( `${currency.fiat} offramp (USDT on Polygon → ${currency.rail}) completes and maps to Alfredpay ${currency.alfredpayCurrency}`, async () => { - world.alfredpay.offrampRate = currency.offrampRate; // The in-memory anchor keeps orders across tests in this file. const offrampOrdersBefore = world.alfredpay.offrampOrders.length; - const ephemeral = privateKeyToAccount(generatePrivateKey()); - const userWallet = privateKeyToAccount(generatePrivateKey()); - - // Polygon USDT has no EIP-2612 support: the nonces() probe fails as a - // contract-call error, steering registration onto the no-permit path. - world.evm.onReadContract = (_network, params) => { - if (params.functionName === "nonces") { - throw new ContractFunctionExecutionError(new BaseError("nonces() reverted"), { - abi: erc20Abi, - contractAddress: params.address, - functionName: "nonces" - }); - } - return undefined; - }; - - const user = await createTestUser(); - await createTestAlfredpayCustomer(user.id, { country: currency.country }); - const quote = await createQuoteViaApi({ - from: Networks.Polygon, - inputAmount: currency.offrampInputAmount, - inputCurrency: EvmToken.USDT, - network: Networks.Polygon, - outputCurrency: currency.fiat, - rampType: RampDirection.SELL, - to: currency.rail - }); - const ramp = await registerViaApi(quote.id, user.id, [{ address: ephemeral.address, type: "EVM" }], { - fiatAccountId: "test-fiat-account-1", - walletAddress: userWallet.address - }); - - const persistedQuote = await QuoteTicket.findByPk(quote.id); - const inputAmountRaw = BigInt(persistedQuote?.metadata.alfredpayOfframp?.inputAmountRaw ?? "0"); - expect(inputAmountRaw).toBeGreaterThan(0n); - - const registered = await RampState.findByPk(ramp.id); - const allUnsignedTxs: UnsignedTx[] = registered?.unsignedTxs ?? []; - const userTransferBlueprint = allUnsignedTxs.find(tx => tx.phase === "squidRouterNoPermitTransfer"); - const offrampTransferBlueprint = allUnsignedTxs.find(tx => tx.phase === "alfredpayOfframpTransfer"); - expect(userTransferBlueprint).toBeDefined(); - expect(offrampTransferBlueprint).toBeDefined(); - const userTxData = userTransferBlueprint?.txData as unknown as { to: `0x${string}`; data: `0x${string}` }; - const offrampTxData = offrampTransferBlueprint?.txData as unknown as { to: `0x${string}`; data: `0x${string}` }; - - const signOfframpTransfer = (nonce: number) => - ephemeral.signTransaction({ - chainId: 137, - data: offrampTxData.data, - gas: 100_000n, - maxFeePerGas: 5_000_000_000n, - maxPriorityFeePerGas: 5_000_000_000n, - nonce, - to: offrampTxData.to, - type: "eip1559" - }); - const backups: Record = {}; - for (let i = 1; i <= 4; i++) { - backups[`backup${i}`] = { nonce: i, txData: await signOfframpTransfer(i) }; - } - const signedOfframpTransfer = await signOfframpTransfer(0); - - const userTxHash = world.evm.broadcastUserTransaction(Networks.Polygon, userWallet.address, { - data: userTxData.data, - to: userTxData.to, - value: 0n - }); - await updateRampViaApi(ramp.id, user.id, { - additionalData: { squidRouterNoPermitTransferHash: userTxHash }, - presignedTxs: [ - { - meta: { additionalTxs: backups }, - network: Networks.Polygon, - nonce: 0, - phase: "alfredpayOfframpTransfer", - signer: ephemeral.address, - txData: signedOfframpTransfer - } - ] - }); + const setup = await setUpOfframpRamp(currency); - world.evm.setNativeBalance(Networks.Polygon, ephemeral.address, parseUnits("2", 18)); - world.evm.setErc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, ephemeral.address, inputAmountRaw); - applyErc20TransfersToLedger(); - const depositAddress = world.alfredpay.offrampDepositAddress; + await phaseProcessor.processRamp(setup.rampId); - await phaseProcessor.processRamp(ramp.id); - - const final = await RampState.findByPk(ramp.id); + const final = await RampState.findByPk(setup.rampId); expect(final?.currentPhase).toBe("complete"); expect(final?.phaseHistory.map(entry => entry.phase)).toEqual(OFFRAMP_PHASES); expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); @@ -388,9 +433,11 @@ describe("Alfredpay currency corridors (USD/COP/ARS, on- and offramp)", () => { const order = world.alfredpay.offrampOrders[world.alfredpay.offrampOrders.length - 1]; expect(order.fromCurrency).toBe("USDT" as never); expect(order.toCurrency).toBe(currency.alfredpayCurrency as never); - expect(world.evm.erc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, depositAddress)).toBe(inputAmountRaw); + expect(world.evm.erc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, setup.depositAddress)).toBe( + setup.inputAmountRaw + ); - const quoteRow = await QuoteTicket.findByPk(quote.id); + const quoteRow = await QuoteTicket.findByPk(setup.quoteId); expect(quoteRow?.status).toBe("consumed"); }, 30000 @@ -418,180 +465,48 @@ describe("Alfredpay currency corridors (USD/COP/ARS, on- and offramp)", () => { const body = (await response.json()) as { message?: string; error?: string }; expect(JSON.stringify(body).toLowerCase()).toContain("limit"); }); - } - it( - "transient failure (USD): an RPC outage on the destination transfer is recoverable and the onramp still completes", - async () => { - const currency = CURRENCY_CASES[0]; // USD/ach - world.alfredpay.onrampRate = currency.onrampRate; - const ephemeral = privateKeyToAccount(generatePrivateKey()); - const destination = privateKeyToAccount(generatePrivateKey()).address as `0x${string}`; - - const user = await createTestUser(); - await createTestAlfredpayCustomer(user.id, { country: currency.country }); - const quote = await createQuoteViaApi({ - from: currency.rail, - inputAmount: currency.onrampInputAmount, - inputCurrency: currency.fiat, - network: Networks.Polygon, - outputCurrency: EvmToken.USDT, - rampType: RampDirection.BUY, - to: Networks.Polygon - }); - const ramp = await registerViaApi(quote.id, user.id, [{ address: ephemeral.address, type: "EVM" }], { - destinationAddress: destination - }); + it( + `transient failure (${currency.fiat}): an RPC outage on the destination transfer is recoverable and the onramp still completes`, + async () => { + const setup = await setUpOnrampRamp(currency); + // The first broadcast of this corridor is the destination transfer. + world.evm.failNextSends = 1; + world.evm.sendFailureMessage = "FakeEvm: scripted RPC outage"; - const persistedQuote = await QuoteTicket.findByPk(quote.id); - const mintAmountRaw = BigInt(persistedQuote?.metadata.alfredpayMint?.outputAmountRaw ?? "0"); - const amountRaw = parseUnits(quote.outputAmount, ALFREDPAY_ERC20_DECIMALS); - - const signTransfer = (nonce: number) => - ephemeral.signTransaction({ - chainId: 137, - data: encodeFunctionData({ abi: erc20Abi, args: [destination, amountRaw], functionName: "transfer" }), - gas: 100_000n, - maxFeePerGas: 5_000_000_000n, - maxPriorityFeePerGas: 5_000_000_000n, - nonce, - to: ALFREDPAY_ERC20_TOKEN, - type: "eip1559" - }); - const backups: Record = {}; - for (let i = 1; i <= 4; i++) { - backups[`backup${i}`] = { nonce: i, txData: await signTransfer(i) }; - } - const signedTransfer = await signTransfer(0); - await updateRampViaApi(ramp.id, user.id, { - presignedTxs: [ - { - meta: { additionalTxs: backups }, - network: Networks.Polygon, - nonce: 0, - phase: "destinationTransfer", - signer: ephemeral.address, - txData: signedTransfer - } - ] - }); + await phaseProcessor.processRamp(setup.rampId); - world.evm.setNativeBalance(Networks.Polygon, ephemeral.address, parseUnits("2", 18)); - world.evm.setErc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, ephemeral.address, mintAmountRaw); - applyErc20TransfersToLedger(); - // The first broadcast of this corridor is the destination transfer. - world.evm.failNextSends = 1; - world.evm.sendFailureMessage = "FakeEvm: scripted RPC outage"; - - await phaseProcessor.processRamp(ramp.id); - - const final = await RampState.findByPk(ramp.id); - expect(final?.currentPhase).toBe("complete"); - expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); - const outageLogs = final?.errorLogs.filter(log => log.error.includes("scripted RPC outage")) ?? []; - expect(outageLogs.length).toBeGreaterThanOrEqual(1); - expect(outageLogs.some(log => log.recoverable === true)).toBe(true); - expect(world.evm.erc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, destination)).toBe(amountRaw); - }, - 30000 - ); - - it( - "unrecoverable failure (ARS): a FAILED Alfredpay offramp order fails the ramp without paying out", - async () => { - const currency = CURRENCY_CASES[2]; // ARS/cbu - world.alfredpay.offrampRate = currency.offrampRate; - const ephemeral = privateKeyToAccount(generatePrivateKey()); - const userWallet = privateKeyToAccount(generatePrivateKey()); - - world.evm.onReadContract = (_network, params) => { - if (params.functionName === "nonces") { - throw new ContractFunctionExecutionError(new BaseError("nonces() reverted"), { - abi: erc20Abi, - contractAddress: params.address, - functionName: "nonces" - }); - } - return undefined; - }; - - const user = await createTestUser(); - await createTestAlfredpayCustomer(user.id, { country: currency.country }); - const quote = await createQuoteViaApi({ - from: Networks.Polygon, - inputAmount: currency.offrampInputAmount, - inputCurrency: EvmToken.USDT, - network: Networks.Polygon, - outputCurrency: currency.fiat, - rampType: RampDirection.SELL, - to: currency.rail - }); - const ramp = await registerViaApi(quote.id, user.id, [{ address: ephemeral.address, type: "EVM" }], { - fiatAccountId: "test-fiat-account-1", - walletAddress: userWallet.address - }); + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("complete"); + expect(final?.phaseHistory.map(entry => entry.phase)).toEqual(ONRAMP_PHASES); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); - const persistedQuote = await QuoteTicket.findByPk(quote.id); - const inputAmountRaw = BigInt(persistedQuote?.metadata.alfredpayOfframp?.inputAmountRaw ?? "0"); - - const registered = await RampState.findByPk(ramp.id); - const allUnsignedTxs: UnsignedTx[] = registered?.unsignedTxs ?? []; - const userTxData = allUnsignedTxs.find(tx => tx.phase === "squidRouterNoPermitTransfer")?.txData as unknown as { - to: `0x${string}`; - data: `0x${string}`; - }; - const offrampTxData = allUnsignedTxs.find(tx => tx.phase === "alfredpayOfframpTransfer")?.txData as unknown as { - to: `0x${string}`; - data: `0x${string}`; - }; - - const signOfframpTransfer = (nonce: number) => - ephemeral.signTransaction({ - chainId: 137, - data: offrampTxData.data, - gas: 100_000n, - maxFeePerGas: 5_000_000_000n, - maxPriorityFeePerGas: 5_000_000_000n, - nonce, - to: offrampTxData.to, - type: "eip1559" - }); - const backups: Record = {}; - for (let i = 1; i <= 4; i++) { - backups[`backup${i}`] = { nonce: i, txData: await signOfframpTransfer(i) }; - } - const userTxHash = world.evm.broadcastUserTransaction(Networks.Polygon, userWallet.address, { - data: userTxData.data, - to: userTxData.to, - value: 0n - }); - await updateRampViaApi(ramp.id, user.id, { - additionalData: { squidRouterNoPermitTransferHash: userTxHash }, - presignedTxs: [ - { - meta: { additionalTxs: backups }, - network: Networks.Polygon, - nonce: 0, - phase: "alfredpayOfframpTransfer", - signer: ephemeral.address, - txData: await signOfframpTransfer(0) - } - ] - }); + // The scripted outage was recorded as a recoverable destinationTransfer + // error, and after the retry the destination was still paid in full. + const outageLogs = final?.errorLogs.filter(log => log.error.includes("scripted RPC outage")) ?? []; + expect(outageLogs.length).toBeGreaterThanOrEqual(1); + expect(outageLogs.every(log => log.phase === "destinationTransfer")).toBe(true); + expect(outageLogs.some(log => log.recoverable === true)).toBe(true); + expect(world.evm.erc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, setup.destination)).toBe(setup.amountRaw); + }, + 30000 + ); + + it( + `unrecoverable failure (${currency.fiat}): a FAILED Alfredpay offramp order fails the ramp without completing`, + async () => { + const setup = await setUpOfframpRamp(currency); + // The anchor reports the order FAILED while the transfer phase polls it. + world.alfredpay.offrampStatus = AlfredpayOfframpStatus.FAILED; + + await phaseProcessor.processRamp(setup.rampId); - world.evm.setNativeBalance(Networks.Polygon, ephemeral.address, parseUnits("2", 18)); - world.evm.setErc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, ephemeral.address, inputAmountRaw); - applyErc20TransfersToLedger(); - // The anchor reports the order FAILED while the transfer phase polls it. - world.alfredpay.offrampStatus = AlfredpayOfframpStatus.FAILED; - - await phaseProcessor.processRamp(ramp.id); - - const final = await RampState.findByPk(ramp.id); - expect(final?.currentPhase).toBe("failed"); - expect(final?.phaseHistory.map(entry => entry.phase)).not.toContain("complete"); - expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); - }, - 30000 - ); + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("failed"); + expect(final?.phaseHistory.map(entry => entry.phase)).not.toContain("complete"); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + }, + 30000 + ); + } }); diff --git a/apps/api/src/tests/corridors/mxn-offramp.scenario.test.ts b/apps/api/src/tests/corridors/mxn-offramp.scenario.test.ts index a7ec61d47..dbfa5a82e 100644 --- a/apps/api/src/tests/corridors/mxn-offramp.scenario.test.ts +++ b/apps/api/src/tests/corridors/mxn-offramp.scenario.test.ts @@ -301,6 +301,49 @@ describe("MXN offramp direct corridor (USDT on Polygon → spei, no-permit)", () 30000 ); + it( + "transient failure: an RPC outage on the ephemeral gas funding is recoverable and the ramp still completes", + async () => { + const setup = await setUpRegisteredRamp(); + scriptHappyWorld(setup); + const depositAddress = world.alfredpay.offrampDepositAddress; + + // The ephemeral starts without gas, so fundEphemeral must broadcast a + // native funding transfer from the funding account. Apply that value + // transfer to the ledger on top of scriptHappyWorld's ERC-20 effects. + world.evm.setNativeBalance(Networks.Polygon, setup.ephemeral.address, 0n); + const applyErc20Transfers = world.evm.onTransaction; + world.evm.onTransaction = tx => { + if (!tx.serialized && tx.to && tx.value) { + world.evm.setNativeBalance(tx.network, tx.to, world.evm.nativeBalance(tx.network, tx.to) + tx.value); + return; + } + applyErc20Transfers?.(tx); + }; + // The first broadcast of this corridor is now that funding transfer. + world.evm.failNextSends = 1; + world.evm.sendFailureMessage = "FakeEvm: scripted RPC outage"; + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("complete"); + expect(final?.phaseHistory.map(entry => entry.phase)).toEqual(HAPPY_PATH_PHASES); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + + // The outage surfaced as exactly one recoverable fundEphemeral error... + const outageLogs = final?.errorLogs.filter(log => log.error.includes("Error funding ephemeral account")) ?? []; + expect(outageLogs.length).toBe(1); + expect(outageLogs.every(log => log.phase === "fundEphemeral" && log.recoverable === true)).toBe(true); + + // ...and after the retry the deposit transfer reached the chain exactly + // once, paying the anchor in full. + expect(submissionsOf(setup.signedOfframpTransfer)).toBe(1); + expect(world.evm.erc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, depositAddress)).toBe(setup.inputAmountRaw); + }, + 30000 + ); + it( "security regression: a reported user tx whose calldata does not match the blueprint fails the ramp unrecoverably", async () => { From 00d87e8c05ebbfdd1973ff788ca44936ebddabd3 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 16:45:48 +0200 Subject: [PATCH 153/176] Add SDK contract coverage for the Alfredpay offramp rail --- .../sdk-contract.alfredpay-offramp.test.ts | 386 ++++++++++++++++++ apps/api/src/tests/sdk-contract.test.ts | 2 + 2 files changed, 388 insertions(+) create mode 100644 apps/api/src/tests/sdk-contract.alfredpay-offramp.test.ts diff --git a/apps/api/src/tests/sdk-contract.alfredpay-offramp.test.ts b/apps/api/src/tests/sdk-contract.alfredpay-offramp.test.ts new file mode 100644 index 000000000..e5d10b051 --- /dev/null +++ b/apps/api/src/tests/sdk-contract.alfredpay-offramp.test.ts @@ -0,0 +1,386 @@ +import { afterAll, beforeAll, beforeEach, describe, expect, it } from "bun:test"; +import { + ALFREDPAY_ERC20_DECIMALS, + ALFREDPAY_ERC20_TOKEN, + AlfredPayCountry, + AlfredpayFiatAccountType, + AlfredpayOfframpStatus, + EPaymentMethod, + EvmToken, + FiatToken, + type GetRampStatusResponse, + Networks, + RampDirection, + type UnsignedTx +} from "@vortexfi/shared"; +import { BaseError, ContractFunctionExecutionError, decodeFunctionData, erc20Abi, parseTransaction, parseUnits } from "viem"; +import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"; +import { VortexSdk } from "../../../../packages/sdk/src"; +import type AlfredPayCustomer from "../models/alfredPayCustomer.model"; +import QuoteTicket from "../models/quoteTicket.model"; +import RampState from "../models/rampState.model"; +import { resetTestDatabase, setupTestDatabase } from "../test-utils/db"; +import { createTestAlfredpayCustomer, createTestApiKey, createTestUser } from "../test-utils/factories"; +import { type FakeWorld, installFakeWorld } from "../test-utils/fake-world"; +import { startTestApp, type TestApp } from "../test-utils/test-app"; + +const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/; +const POLYGON_CHAIN_ID_HEX = "0x89"; // 137 + +interface CurrencyCase { + fiat: FiatToken; + /** Alfredpay-side currency code expected on created orders. */ + alfredpayCurrency: string; + country: AlfredPayCountry; + /** Quote destination string (payment rail). */ + rail: EPaymentMethod; + /** USDT amount for the SELL quote (within the per-currency limits). */ + inputAmount: string; + /** Fiat the fake anchor pays out per USDT. */ + offrampRate: number; +} + +// Rails per currency: USD and COP pay out over ach, ARS over cbu. +const CURRENCY_CASES: CurrencyCase[] = [ + { + alfredpayCurrency: "USD", + country: AlfredPayCountry.US, + fiat: FiatToken.USD, + inputAmount: "5", + offrampRate: 1, + rail: EPaymentMethod.ACH + }, + { + alfredpayCurrency: "COP", + country: AlfredPayCountry.CO, + fiat: FiatToken.COP, + inputAmount: "100", + offrampRate: 4000, + rail: EPaymentMethod.ACH + }, + { + alfredpayCurrency: "ARS", + country: AlfredPayCountry.AR, + fiat: FiatToken.ARS, + inputAmount: "100", + offrampRate: 1000, + rail: EPaymentMethod.CBU + } +]; + +/** + * Same shim as the other SDK contract tests: the SDK's viem wallet client + * issues one eth_chainId RPC before signing locally. The Alfredpay SELL + * corridor only ephemeral-signs on Polygon (the source-of-funds transfer is + * user-broadcast, never SDK-signed), so answer with the Polygon chain id. + */ +function installChainIdShim(): { restore: () => void } { + const guardedFetch = globalThis.fetch; + const shim = (async (input: Parameters[0], init?: Parameters[1]) => { + if (typeof init?.body === "string") { + try { + const payload = JSON.parse(init.body) as { id?: number; method?: string }; + if (payload.method === "eth_chainId") { + return Response.json({ id: payload.id ?? 1, jsonrpc: "2.0", result: POLYGON_CHAIN_ID_HEX }); + } + } catch { + // not JSON — let the guarded fetch decide + } + } + return guardedFetch(input, init); + }) as typeof fetch; + globalThis.fetch = Object.assign(shim, guardedFetch); + return { + restore: () => { + globalThis.fetch = guardedFetch; + } + }; +} + +/** + * SDK ↔ API contract tests for the Alfredpay SELL rail (USDT on Polygon → + * USD/COP/ARS bank payouts): the real SDK lists the user's registered fiat + * accounts, registers the offramp on the no-permit path (fiatAccountId + + * walletAddress), broadcasts the user's source-of-funds transfer via + * submitUserTransactions, and drives the ramp to completion — plus lighter + * createQuote/registerRamp shape checks for every currency's rail. + */ +describe("SDK ↔ API contract (Alfredpay offramps, USDT on Polygon → bank payout)", () => { + let world: FakeWorld; + let chainIdShim: { restore: () => void }; + let app: TestApp; + + beforeAll(async () => { + world = installFakeWorld(); + chainIdShim = installChainIdShim(); + await setupTestDatabase(); + app = await startTestApp(); + }); + + afterAll(async () => { + await app?.close(); + chainIdShim?.restore(); + world?.restore(); + }); + + beforeEach(async () => { + await resetTestDatabase(); + world.evm.failNextSends = 0; + world.evm.onTransaction = undefined; + world.alfredpay.offrampStatus = AlfredpayOfframpStatus.FIAT_TRANSFER_COMPLETED; + // Fresh deposit address per test: the in-memory EVM ledger persists across + // tests, so a shared address would accumulate balances between scenarios. + world.alfredpay.offrampDepositAddress = privateKeyToAccount(generatePrivateKey()).address.toLowerCase(); + // Polygon USDT has no EIP-2612 support: the nonces() probe fails as a + // contract-call error, steering registration onto the no-permit path where + // the user broadcasts a plain transfer from their own wallet. + world.evm.onReadContract = (_network, params) => { + if (params.functionName === "nonces") { + throw new ContractFunctionExecutionError(new BaseError("nonces() reverted"), { + abi: erc20Abi, + contractAddress: params.address, + functionName: "nonces" + }); + } + return undefined; + }; + }); + + /** A user with a completed Alfredpay KYC profile and an SDK authenticated via their secret key. */ + async function createUserSdk(country: AlfredPayCountry): Promise<{ + sdk: VortexSdk; + userId: string; + customer: AlfredPayCustomer; + }> { + const user = await createTestUser(); + const customer = await createTestAlfredpayCustomer(user.id, { country }); + const { plaintextKey } = await createTestApiKey({ userId: user.id }); + const sdk = new VortexSdk({ apiBaseUrl: app.baseUrl, secretKey: plaintextKey, storeEphemeralKeys: false }); + return { customer, sdk, userId: user.id }; + } + + function quoteRequest(currency: CurrencyCase) { + return { + from: Networks.Polygon, + inputAmount: currency.inputAmount, + inputCurrency: EvmToken.USDT, + network: Networks.Polygon, + outputCurrency: currency.fiat, + rampType: RampDirection.SELL, + to: currency.rail + } as const; + } + + /** Funds the wallet's USDT so the SDK's offramp balance preflight passes against the fake ledger. */ + function fundWallet(walletAddress: string, inputAmount: string): void { + world.evm.setErc20Balance( + Networks.Polygon, + ALFREDPAY_ERC20_TOKEN, + walletAddress, + parseUnits(inputAmount, ALFREDPAY_ERC20_DECIMALS) + ); + } + + /** Broadcasts a user transaction from the wallet on its source chain, as a real wallet would. */ + function sendFromWallet(walletAddress: string) { + return async (txData: { to: string; data?: string; value?: string }, context: { unsignedTransaction: UnsignedTx }) => + world.evm.broadcastUserTransaction(context.unsignedTransaction.network, walletAddress, { + data: txData.data, + to: txData.to, + value: BigInt(txData.value ?? "0") + }); + } + + /** Scripts gas + the arrived user deposit on the ephemeral and applies raw ERC-20 transfers to the ledger. */ + async function scriptHappyWorld(rampId: string, quoteId: string): Promise<{ inputAmountRaw: bigint }> { + const state = await RampState.findByPk(rampId); + const quote = await QuoteTicket.findByPk(quoteId); + const ephemeralAddress = state?.state.evmEphemeralAddress as `0x${string}`; + expect(ephemeralAddress).toBeTruthy(); + const inputAmountRaw = BigInt(quote?.metadata.alfredpayOfframp?.inputAmountRaw ?? "0"); + expect(inputAmountRaw).toBeGreaterThan(0n); + + world.evm.setNativeBalance(Networks.Polygon, ephemeralAddress, parseUnits("2", 18)); + world.evm.setErc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, ephemeralAddress, inputAmountRaw); + world.evm.onTransaction = tx => { + if (!tx.serialized) { + return; + } + const parsed = parseTransaction(tx.serialized as `0x${string}`); + if (!parsed.to || !parsed.data) { + return; + } + const { functionName, args } = decodeFunctionData({ abi: erc20Abi, data: parsed.data }); + if (functionName !== "transfer") { + return; + } + const [recipient, amount] = args as [`0x${string}`, bigint]; + world.evm.setErc20Balance( + tx.network, + parsed.to, + recipient, + world.evm.erc20Balance(tx.network, parsed.to, recipient) + amount + ); + }; + return { inputAmountRaw }; + } + + /** Polls getRampStatus (itself part of the contract) until the ramp completes. */ + async function waitForComplete(sdk: VortexSdk, rampId: string): Promise { + const deadline = Date.now() + 20_000; + for (;;) { + const status = await sdk.getRampStatus(rampId); + if (status.currentPhase === "complete") { + return status; + } + const state = await RampState.findByPk(rampId); + if (state?.currentPhase === "failed") { + throw new Error(`Ramp ${rampId} failed: ${JSON.stringify(state.errorLogs)}`); + } + if (Date.now() > deadline) { + throw new Error(`Timed out waiting for ramp ${rampId} to complete (phase: ${status.currentPhase})`); + } + await Bun.sleep(50); + } + } + + it( + "drives the full USD/ach lifecycle: createQuote → listAlfredpayFiatAccounts → registerRamp → submitUserTransactions → startRamp → complete", + async () => { + const currency = CURRENCY_CASES[0]; // USD/ach + world.alfredpay.offrampRate = currency.offrampRate; + const { customer, sdk, userId } = await createUserSdk(currency.country); + + // The frontend-SDK flow picks the payout destination from the user's + // fiat accounts registered with the anchor. + world.alfredpay.fiatAccountsByCustomer.set(customer.alfredPayId, [ + { + accountNumber: "021000021000000", + accountType: "checking", + customerId: customer.alfredPayId, + fiatAccountId: "fiat-account-usd-1", + type: AlfredpayFiatAccountType.ACH + } + ]); + const accounts = await sdk.listAlfredpayFiatAccounts(currency.country); + expect(accounts).toHaveLength(1); + expect(accounts[0].type).toBe(AlfredpayFiatAccountType.ACH); + const fiatAccountId = accounts[0].fiatAccountId; + + const wallet = privateKeyToAccount(generatePrivateKey()); + fundWallet(wallet.address, currency.inputAmount); + + const quote = await sdk.createQuote(quoteRequest(currency)); + expect(quote.id).toMatch(UUID_PATTERN); + expect(quote.rampType).toBe(RampDirection.SELL); + expect(quote.to).toBe(currency.rail); + expect(Number(quote.outputAmount)).toBeGreaterThan(0); + + // registerRamp SELL contract on the no-permit path: exactly one + // user-wallet transaction comes back — the plain USDT transfer to the + // ephemeral — classified as a broadcastable EVM tx. + const { rampProcess, unsignedTransactions } = await sdk.registerRamp(quote, { + fiatAccountId, + walletAddress: wallet.address + }); + expect(rampProcess.id).toMatch(UUID_PATTERN); + expect(rampProcess.type).toBe(RampDirection.SELL); + expect(rampProcess.currentPhase).toBe("initial"); + expect(unsignedTransactions).toHaveLength(1); + const userTx = unsignedTransactions[0]; + expect(userTx.phase).toBe("squidRouterNoPermitTransfer"); + expect(userTx.network).toBe(Networks.Polygon); + expect(userTx.signer.toLowerCase()).toBe(wallet.address.toLowerCase()); + expect(sdk.getUserTransactionType(userTx)).toBe("evm-transaction"); + const broadcastable = sdk.getTransactionToBroadcast(userTx); + expect(broadcastable.to.toLowerCase()).toBe(ALFREDPAY_ERC20_TOKEN.toLowerCase()); + expect(broadcastable.data).toBeTruthy(); + + // The SDK already signed and stored the ephemeral's Polygon-side txs; + // registration created the anchor order on the no-permit path. + const stored = await RampState.findByPk(rampProcess.id); + expect(stored?.userId).toBe(userId); + expect(stored?.state.alfredpayTransactionId).toBeTruthy(); + expect(stored?.state.isNoPermitFallback).toBe(true); + const presignedPhases = (stored?.presignedTxs ?? []).map(tx => tx.phase); + expect(presignedPhases).toContain("alfredpayOfframpTransfer"); + // The user-wallet transfer must never be presigned by the ephemeral. + expect(presignedPhases).not.toContain("squidRouterNoPermitTransfer"); + + // submitUserTransactions broadcasts through the caller's wallet handler + // and reports the hash to the API. + const afterSubmit = await sdk.submitUserTransactions(rampProcess.id, unsignedTransactions, { + sendTransaction: sendFromWallet(wallet.address) + }); + expect(afterSubmit.id).toBe(rampProcess.id); + const withHash = await RampState.findByPk(rampProcess.id); + expect(withHash?.state.squidRouterNoPermitTransferHash).toBeTruthy(); + + const { inputAmountRaw } = await scriptHappyWorld(rampProcess.id, quote.id); + const depositAddress = world.alfredpay.offrampDepositAddress; + const started = await sdk.startRamp(rampProcess.id); + expect(started.id).toBe(rampProcess.id); + + const status = await waitForComplete(sdk, rampProcess.id); + expect(status.type).toBe(RampDirection.SELL); + expect(Number(status.inputAmount)).toBe(Number(quote.inputAmount)); + expect(Number(status.outputAmount)).toBe(Number(quote.outputAmount)); + + // End to end, the anchor's deposit address received the full USDT and + // the order maps USDT → this currency against the chosen fiat account. + expect(world.evm.erc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, depositAddress)).toBe(inputAmountRaw); + const order = world.alfredpay.offrampOrders[world.alfredpay.offrampOrders.length - 1]; + expect(order.fromCurrency).toBe("USDT" as never); + expect(order.toCurrency).toBe(currency.alfredpayCurrency as never); + expect(order.fiatAccountId).toBe(fiatAccountId); + }, + 30000 + ); + + for (const currency of CURRENCY_CASES) { + it( + `${currency.fiat} (${currency.rail}): createQuote and registerRamp return the SDK-visible shapes for the rail`, + async () => { + world.alfredpay.offrampRate = currency.offrampRate; + const { sdk } = await createUserSdk(currency.country); + const wallet = privateKeyToAccount(generatePrivateKey()); + fundWallet(wallet.address, currency.inputAmount); + + // Quote contract: the rail and currency mapping the SDK promises. + const quote = await sdk.createQuote(quoteRequest(currency)); + expect(quote.id).toMatch(UUID_PATTERN); + expect(quote.rampType).toBe(RampDirection.SELL); + expect(quote.from).toBe(Networks.Polygon); + expect(quote.to).toBe(currency.rail); + expect(quote.network).toBe(Networks.Polygon); + expect(quote.inputCurrency).toBe(EvmToken.USDT); + expect(Number(quote.inputAmount)).toBe(Number(currency.inputAmount)); + expect(quote.outputCurrency).toBe(currency.fiat); + expect(Number(quote.outputAmount)).toBeGreaterThan(0); + expect(new Date(quote.expiresAt).getTime()).toBeGreaterThan(Date.now()); + + // Register contract: the no-permit user transfer for the caller's + // wallet, and an anchor order in this currency's Alfredpay code. + const { rampProcess, unsignedTransactions } = await sdk.registerRamp(quote, { + fiatAccountId: `fiat-account-${currency.rail}-1`, + walletAddress: wallet.address + }); + expect(rampProcess.id).toMatch(UUID_PATTERN); + expect(rampProcess.quoteId).toBe(quote.id); + expect(rampProcess.type).toBe(RampDirection.SELL); + expect(rampProcess.currentPhase).toBe("initial"); + expect(unsignedTransactions).toHaveLength(1); + expect(unsignedTransactions[0].phase).toBe("squidRouterNoPermitTransfer"); + expect(unsignedTransactions[0].network).toBe(Networks.Polygon); + expect(unsignedTransactions[0].signer.toLowerCase()).toBe(wallet.address.toLowerCase()); + expect(sdk.getUserTransactionType(unsignedTransactions[0])).toBe("evm-transaction"); + + const order = world.alfredpay.offrampOrders[world.alfredpay.offrampOrders.length - 1]; + expect(order.fromCurrency).toBe("USDT" as never); + expect(order.toCurrency).toBe(currency.alfredpayCurrency as never); + expect(order.fiatAccountId).toBe(`fiat-account-${currency.rail}-1`); + }, + 30000 + ); + } +}); diff --git a/apps/api/src/tests/sdk-contract.test.ts b/apps/api/src/tests/sdk-contract.test.ts index 04158afdf..38c301b60 100644 --- a/apps/api/src/tests/sdk-contract.test.ts +++ b/apps/api/src/tests/sdk-contract.test.ts @@ -159,6 +159,8 @@ describe("SDK ↔ API contract (BRL onramp, pix → BRLA on Base)", () => { const deadline = Date.now() + 20_000; for (;;) { const status = await sdk.getRampStatus(rampId); + // Fail immediately (not via the poll timeout) if the status shape breaks. + expect(status.currentPhase).toBeDefined(); if (status.currentPhase === "complete") { return status; } From 6ff7699ffb3a02145f214fe4278931b6192c73b3 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 16:45:57 +0200 Subject: [PATCH 154/176] Add a full USD Alfredpay offramp E2E journey --- apps/frontend/e2e/offramp-usd-journey.spec.ts | 206 ++++++++++++++++++ apps/frontend/e2e/support/mockBackend.ts | 17 +- apps/frontend/e2e/support/mockWallet.ts | 10 +- 3 files changed, 227 insertions(+), 6 deletions(-) create mode 100644 apps/frontend/e2e/offramp-usd-journey.spec.ts diff --git a/apps/frontend/e2e/offramp-usd-journey.spec.ts b/apps/frontend/e2e/offramp-usd-journey.spec.ts new file mode 100644 index 000000000..a5d00ea4a --- /dev/null +++ b/apps/frontend/e2e/offramp-usd-journey.spec.ts @@ -0,0 +1,206 @@ +import { expect, test } from "@playwright/test"; +import { buildQuoteResponse, buildRampProcess, E2E_RAMP_ID, mockBackend } from "./support/mockBackend"; +import { injectMockWallet, MOCK_WALLET_ADDRESS } from "./support/mockWallet"; + +const POLYGON_USDT = "0xc2132d05d31c914a87c6611c10748aeb04b58e8f"; +const MOCK_WALLET_TX_HASH = `0x${"cd".repeat(32)}`; +const FIAT_ACCOUNT_ID = "fiat-account-e2e-1"; + +// Critical journey 7: a full SELL (offramp) USD ramp over the Alfredpay rail — the +// money-OUT counterpart to the BRL offramp. Unlike the Avenia path there is no CPF/Pix +// eligibility form: the payout destination is a fiat account registered with Alfredpay, +// selected on the payment summary, and its fiatAccountId travels in the registration's +// additionalData. +// +// quote (USDT on Polygon -> USD via bank transfer; the wallet gate is passed by the +// injected mock wallet on Polygon and the balance check reads the mocked Alchemy API) -> +// email/OTP auth -> wallet-ownership details step -> Alfredpay KYC gate (existing +// verified customer for country US) -> payment summary with the registered US bank +// account -> ramp registration -> ephemeral presigning posted to /ramp/update -> USER +// WALLET broadcast of the squidRouterNoPermitTransfer (eth_sendTransaction on the mock +// wallet) with its hash reported in a second /ramp/update -> automatic /ramp/start -> +// progress. +// +// KNOWN GAP: unlike the BRL offramp, this journey cannot end on the success screen. The +// progress page's getRampFlow (src/pages/progress/index.tsx) returns null for SELL +// ramps whose output is not BRL/EURC, so the ramp status is never polled after start +// and currentPhase never advances to "complete" — for Alfredpay offramps the UI stays +// on the progress screen. This spec asserts the truthful current behavior (progress +// after the automatic start); extend it to the success screen when that gap is fixed. + +const SELL_RAMP_FIELDS = { + depositQrCode: undefined, + from: "polygon", + inputAmount: "100", + inputCurrency: "USDT", + outputAmount: "99", + outputCurrency: "USD", + paymentMethod: "ach", + to: "ach", + type: "SELL" +}; + +// The registered payout account served by GET /v1/alfredpay/fiatAccounts (an +// AlfredpayFiatAccount; US accounts are stored as BANK_USA and displayed as "WIRE"). +const US_BANK_ACCOUNT = { + accountName: "Vortex E2E Checking", + accountNumber: "000123456789", + accountType: "CHECKING", + createdAt: new Date().toISOString(), + customerId: "alfred-customer-e2e-1", + fiatAccountId: FIAT_ACCOUNT_ID, + metadata: { accountHolderName: "Vortex E2E" }, + routingNumber: "026009593", + type: "BANK_USA" +}; + +// Mirrors the API's evm-to-alfredpay offramp preparation for the direct +// Polygon-USDT no-permit path: the USER wallet signs a single +// squidRouterNoPermitTransfer to the EVM ephemeral, and the ephemeral signs the +// Alfredpay deposit transfer, its fallback (both nonce 0 — only one executes), and +// the axlUSDC cleanup approval. +function buildSellUnsignedTxs(evmEphemeral: string) { + const evmTx = (signer: string, nonce: number, phase: string) => ({ + meta: {}, + network: "polygon", + nonce, + phase, + signer, + txData: { + data: `0xa9059cbb${"00".repeat(12)}${evmEphemeral.slice(2).toLowerCase()}${"00".repeat(30)}04c4`, + gas: "150000", + maxFeePerGas: "5000000000", + maxPriorityFeePerGas: "5000000000", + nonce, + to: POLYGON_USDT, + value: "0" + } + }); + return [ + evmTx(MOCK_WALLET_ADDRESS, 0, "squidRouterNoPermitTransfer"), + evmTx(evmEphemeral, 0, "alfredpayOfframpTransfer"), + evmTx(evmEphemeral, 0, "alfredpayOfframpTransferFallback"), + evmTx(evmEphemeral, 1, "polygonCleanupAxlUsdc") + ]; +} + +test("SELL USD journey: quote, auth, Alfredpay KYC gate, fiat account, registration, wallet signing, progress", async ({ + page +}) => { + // The real API keeps returning the ramp's unsignedTxs on /ramp/update; the signing + // step reads the user-wallet transaction from that response. + let unsignedTxs: unknown[] = []; + const backend = await mockBackend(page, { + fiatAccounts: () => [US_BANK_ACCOUNT], + quotes: body => + ({ + body: buildQuoteResponse({ + ...SELL_RAMP_FIELDS, + // Alfredpay quotes carry the resolved stablecoin input limits; the quote form + // validates the USDT inputAmount against them (not the legacy fiat sell limits). + alfredpayInputLimits: { max: "10000", min: "10" }, + feeCurrency: "USD", + inputAmount: body.inputAmount, + rampType: "SELL" + }), + status: 200 + }) as { status: number; body: unknown }, + register: body => { + const signingAccounts = (body.signingAccounts ?? []) as Array<{ address: string; type: string }>; + const evmEphemeral = signingAccounts.find(account => account.type === "EVM")?.address ?? POLYGON_USDT; + unsignedTxs = buildSellUnsignedTxs(evmEphemeral); + return buildRampProcess({ ...SELL_RAMP_FIELDS, unsignedTxs }); + }, + update: () => buildRampProcess({ ...SELL_RAMP_FIELDS, unsignedTxs }) + }); + // The whole journey lives on Polygon, so the mock wallet connects on chain 137. + await injectMockWallet(page, { chainIdHex: "0x89" }); + // Preselect Polygon via the persisted network choice instead of the `network` URL + // param: passing network+cryptoLocked in the URL makes the widget create the quote + // itself and skip the quote form, and stage 1 (form + wallet gate + balance check) + // is part of this journey. + await page.addInitScript(() => localStorage.setItem("SELECTED_NETWORK", "polygon")); + + await page.goto("/widget?rampType=SELL&fiat=USD&cryptoLocked=USDT&inputAmount=100"); + + // Stage 1: the quote form fetched a SELL USDT->USD quote; the wallet gate is already + // passed by the injected mock wallet, and the balance check (mocked Alchemy data API, + // which holds USDT on Polygon) enables Sell. + await expect(page.locator('input[name="outputAmount"]')).toHaveValue(/99/, { timeout: 20_000 }); + const sellButton = page.locator("form").getByRole("button", { name: "Sell" }); + await expect(sellButton).toBeEnabled({ timeout: 20_000 }); + await sellButton.click(); + + // Stage 2 + 3: email/OTP auth gate. + await expect(page.getByRole("heading", { name: "Verify Your Email" })).toBeVisible({ timeout: 20_000 }); + await page.locator("#email").fill("e2e@vortexfinance.co"); + await page.locator("#terms").check(); + await page.getByRole("button", { name: "Continue" }).click(); + await expect(page.getByRole("heading", { name: "Enter Verification Code" })).toBeVisible({ timeout: 20_000 }); + await page.locator('input[autocomplete="one-time-code"]').pressSequentially("123456"); + + // Stage 4: Alfredpay offramp details — only wallet ownership, no CPF/Pix fields (the + // payout destination is the Alfredpay fiat account picked later on the summary). + await expect(page.getByText("Verify you are the owner of the wallet")).toBeVisible({ timeout: 20_000 }); + await expect(page.locator("#taxId")).toHaveCount(0); + await expect(page.locator("#pixId")).toHaveCount(0); + await expect(page.getByRole("button", { name: /0xf39F/ })).toBeVisible(); + await page.getByRole("button", { name: "Verify Wallet" }).click(); + + // Stage 5: the Alfredpay KYC gate queried the customer status for US and, since the + // customer is verified (SUCCESS), the flow lands on the payment summary, where the + // registered US bank account is listed and preselected as the payout method. + await expect(page.getByRole("heading", { name: "Payment Summary" })).toBeVisible({ timeout: 20_000 }); + await expect(page.getByText(US_BANK_ACCOUNT.accountName)).toBeVisible({ timeout: 20_000 }); + expect(backend.fiatAccountsRequests).toContain("US"); + + // Stage 6: confirming registers the ramp; the fiat account travels as additionalData. + await page.getByRole("button", { name: "Confirm" }).click(); + + // Stage 7: the ephemeral transactions are signed in-page and posted to /ramp/update, + // then the USER WALLET broadcasts the source-of-funds transfer and its hash is + // reported in a second update; the offramp starts automatically and lands on the + // progress screen (which only renders once the machine reaches RampFollowUp, i.e. + // after /ramp/start succeeded). See the KNOWN GAP note above for why the journey + // ends here instead of on the success screen. + await expect(page.getByRole("heading", { name: "Your transaction is in progress." })).toBeVisible({ + timeout: 45_000 + }); + + expect(backend.registerRequests).toHaveLength(1); + const registerBody = backend.registerRequests[0] as { + quoteId: string; + signingAccounts: Array<{ type: string }>; + additionalData?: { fiatAccountId?: string; pixDestination?: string; taxId?: string; walletAddress?: string }; + }; + expect(registerBody.quoteId).toBe("quote-e2e-1"); + expect(registerBody.signingAccounts.map(account => account.type).sort()).toEqual(["EVM", "Substrate"]); + expect(registerBody.additionalData?.fiatAccountId).toBe(FIAT_ACCOUNT_ID); + expect(registerBody.additionalData?.walletAddress?.toLowerCase()).toBe(MOCK_WALLET_ADDRESS.toLowerCase()); + // The Avenia-only fields never travel on the Alfredpay rail. + expect(registerBody.additionalData?.pixDestination).toBeUndefined(); + expect(registerBody.additionalData?.taxId).toBeUndefined(); + + // Update #1: the three ephemeral transactions, locally signed (raw EIP-1559 txs). The + // user-wallet transfer must NOT be among them. + expect(backend.updateRequests.length).toBeGreaterThanOrEqual(2); + const ephemeralUpdate = backend.updateRequests[0] as { presignedTxs: Array<{ txData: unknown; phase: string }> }; + expect(ephemeralUpdate.presignedTxs.map(tx => tx.phase)).not.toContain("squidRouterNoPermitTransfer"); + expect(ephemeralUpdate.presignedTxs.map(tx => tx.phase).sort()).toEqual([ + "alfredpayOfframpTransfer", + "alfredpayOfframpTransferFallback", + "polygonCleanupAxlUsdc" + ]); + for (const tx of ephemeralUpdate.presignedTxs) { + expect(typeof tx.txData).toBe("string"); + expect(tx.txData as string).toMatch(/^0x02/); + } + + // Update #2: the hash of the wallet-broadcast transfer, reported as additionalData. + const signingUpdate = backend.updateRequests[1] as { additionalData?: Record }; + expect(signingUpdate.additionalData?.squidRouterNoPermitTransferHash).toBe(MOCK_WALLET_TX_HASH); + + // The offramp started without a manual payment-confirmation step. + expect(backend.startRequests).toHaveLength(1); + expect(backend.startRequests[0]).toMatchObject({ rampId: E2E_RAMP_ID }); +}); diff --git a/apps/frontend/e2e/support/mockBackend.ts b/apps/frontend/e2e/support/mockBackend.ts index fe4bf8f7c..8251078ab 100644 --- a/apps/frontend/e2e/support/mockBackend.ts +++ b/apps/frontend/e2e/support/mockBackend.ts @@ -109,6 +109,10 @@ interface MockBackendOptions { rampStatusOverrides?: (complete: boolean) => Record; // Status served on GET /v1/alfredpay/alfredpayStatus (Alfredpay KYC gate). Default: SUCCESS. alfredpayStatus?: string; + // Accounts served on GET /v1/alfredpay/fiatAccounts (AlfredpayListFiatAccountsResponse). + // Alfredpay offramps require one: the summary's Confirm button stays disabled without a + // selectable fiat account. Default: none configured (the route 404s like any unmatched path). + fiatAccounts?: (country: string) => unknown; } // Intercepts all traffic to the API origin (http://localhost:3000) so journeys run @@ -118,6 +122,7 @@ interface MockBackendOptions { export async function mockBackend(page: Page, options: MockBackendOptions = {}) { const quoteRequests: Array> = []; const brlaGetUserRequests: string[] = []; + const fiatAccountsRequests: string[] = []; const registerRequests: Array> = []; const updateRequests: Array> = []; const startRequests: Array> = []; @@ -210,6 +215,16 @@ export async function mockBackend(page: Page, options: MockBackendOptions = {}) return; } + // Alfredpay fiat accounts: the payout bank accounts registered with the anchor. On + // offramps the summary's FiatAccountSelector lists these and registration sends the + // chosen fiatAccountId. + if (path === "/v1/alfredpay/fiatAccounts" && method === "GET" && options.fiatAccounts) { + const country = url.searchParams.get("country") ?? ""; + fiatAccountsRequests.push(country); + await fulfillJson(options.fiatAccounts(country)); + return; + } + // Ramp lifecycle (RampProcess shapes from packages/shared/src/endpoints/ramp.endpoints.ts). if (path === "/v1/ramp/register" && method === "POST") { const body = request.postDataJSON() as { @@ -371,5 +386,5 @@ export async function mockBackend(page: Page, options: MockBackendOptions = {}) await page.route("https://api.web3modal.org/**", route => route.abort()); await page.route("https://pulse.walletconnect.org/**", route => route.abort()); - return { brlaGetUserRequests, quoteRequests, registerRequests, startRequests, updateRequests }; + return { brlaGetUserRequests, fiatAccountsRequests, quoteRequests, registerRequests, startRequests, updateRequests }; } diff --git a/apps/frontend/e2e/support/mockWallet.ts b/apps/frontend/e2e/support/mockWallet.ts index 6dd4ad9d3..25944fb19 100644 --- a/apps/frontend/e2e/support/mockWallet.ts +++ b/apps/frontend/e2e/support/mockWallet.ts @@ -6,11 +6,11 @@ export const MOCK_WALLET_NAME = "E2E Mock Wallet"; // Injects a minimal EIP-1193 provider announced via EIP-6963 before the app loads. // AppKit is configured with enableEIP6963, so the provider shows up in the connect // modal as an installed browser wallet — no app code changes needed. -export async function injectMockWallet(page: Page) { +// The wallet's chain defaults to Base; journeys that live on another network (e.g. +// Polygon offramps) pass the matching chainIdHex so no mid-flow chain switch is needed. +export async function injectMockWallet(page: Page, options: { chainIdHex?: string } = {}) { await page.addInitScript( - ({ address, name }) => { - const chainIdHex = "0x2105"; // Base - + ({ address, name, chainIdHex }) => { // biome-ignore lint/suspicious/noExplicitAny: minimal EIP-1193 stub const listeners: Record void>> = {}; const provider = { @@ -82,6 +82,6 @@ export async function injectMockWallet(page: Page) { // biome-ignore lint/suspicious/noExplicitAny: window.ethereum has no typed slot here (window as any).ethereum = provider; }, - { address: MOCK_WALLET_ADDRESS, name: MOCK_WALLET_NAME } + { address: MOCK_WALLET_ADDRESS, chainIdHex: options.chainIdHex ?? "0x2105", name: MOCK_WALLET_NAME } ); } From c13b6cc8e9a41808c8434f08a1238d14711cb1bf Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 16:46:04 +0200 Subject: [PATCH 155/176] Document the new Alfredpay coverage and the executed integrity-check brief --- docs/test-suite-integrity-check.md | 169 +++++++++++++++++++++++++++++ docs/testing-strategy.md | 14 ++- 2 files changed, 178 insertions(+), 5 deletions(-) create mode 100644 docs/test-suite-integrity-check.md diff --git a/docs/test-suite-integrity-check.md b/docs/test-suite-integrity-check.md new file mode 100644 index 000000000..438111d3f --- /dev/null +++ b/docs/test-suite-integrity-check.md @@ -0,0 +1,169 @@ +# Test-Suite Integrity Check — Agent Brief + +You are auditing the test suite of this repository (branch `test-suite-foundation`) for +**integrity**: does it actually deliver what it was built to deliver? Do not trust any +documentation, commit message, or code comment — verify every claim empirically. Where a claim +is false, broken, or only partially true, say so plainly. You are the last gate before this +branch is merged and relied upon. + +## The goals this suite was built for + +The owner's original requirements — everything below must be judged against these: + +- **(a) Easy to maintain and extend** — adding a corridor/endpoint/flow means composing existing + factories and fakes, not hand-rolling mocks; conventions are documented and consistently used. +- **(b) Best practices for similar projects** — hermetic by default, deterministic, one obvious + command to run everything, enforced in CI, live/networked tests strictly opt-in. +- **(c) Catches real regressions** — if someone breaks a security invariant or an API contract, + a test fails. Tests that cannot fail are defects. + +## What was claimed to be delivered (verify each) + +1. **Strategy & docs**: `docs/testing-strategy.md` (architecture, commands, how-to-extend), + `docs/test-audit-findings.md` (57 confirmed defects in pre-existing tests + remediation log). +2. **Hermetic API harness** in `apps/api/src/test-utils/`: env-neutralizing preload (via + `apps/api/bunfig.toml`, incl. `root = "src"`), dockerized test Postgres (port 54329, + `bun test:db:start`), model factories, fake external world (EVM ledger at the + `EvmClientManager` seam, BRLA/Avenia, Mykobo, Alfredpay, SquidRouter `getRoute`, price feeds, + Supabase auth), global **fetch guard** that rejects any un-faked external HTTP call, in-process + Express app (`test-app.ts`). +3. **Invariant tests** (`apps/api/src/tests/`): auth/credential matrix, ramp & quote ownership, + quote lifecycle (expiry, consumed, foreign-user, flow-variant, EUR kill-switch), and **atomic + quote consumption** (two concurrent registrations → exactly one ramp). +4. **Corridor scenarios** (`apps/api/src/tests/corridors/brl-onramp.scenario.test.ts`): real + `PhaseProcessor` over pix→BRLA-on-Base with viem-signed presigned txs — happy path, transient + failure + retry, wrong-recipient rejection (security regression), concurrent-lock behavior. +5. **SDK ↔ API contract tests** (`apps/api/src/tests/sdk-contract.test.ts`): the real SDK from + `packages/sdk/src` driving the in-process API (quote → register → sign → start → status), + plus negative cases (missing secretKey, foreign ramp → typed 403). +6. **Frontend**: 62+ XState machine tests (`apps/frontend/src/machines/*.machine.test.ts`), + RTL+MSW component tests (Onramp/Offramp quote forms, `ProgressPage`, Avenia KYC fields; infra + under `apps/frontend/src/test/`), Playwright journeys in `apps/frontend/e2e/` with an EIP-6963 + mock wallet, wired as **non-blocking nightly** (`.github/workflows/e2e.yml`). +7. **CI** (`.github/workflows/ci.yml`): a `test` job with a Postgres service container (port + 54329) running shared, sdk, rebalancer, api and frontend suites on every PR, after + `bun build:shared`. +8. **Audit remediation**: no process-wide `mock.module`/singleton patches without restore; live + integration tests' module-level patching gated behind `RUN_LIVE_TESTS`; stale suites either + rewritten (webhook-delivery) or fixed/removed (see the findings doc's remediation section — + verify it reflects reality after the follow-up sessions). + +## Phase 1 — Everything runs green (foundation, do first) + +From a clean checkout state (note anything that only works because of leftover local state): + +```bash +bun install +bun test:db:start # docker Postgres on 54329 +bun run build # must pass (CI parity) +bun run verify && bun run typecheck +bun test # root aggregate: shared, sdk, rebalancer, api, frontend +``` + +- `cd apps/api && bun test` must exit 0 **as one process**. Record pass/skip/fail counts. + Run it **twice in a row** (state bleed check) and confirm identical results. +- `cd apps/frontend && bunx vitest run` must pass. Playwright: run if browsers are installed + (`bunx playwright test`), otherwise verify the config/workflow wiring and say you didn't run it. +- Verify `git status` stays clean after test runs (no JSON snapshots or scratch files churned). +- Verify the skip count is fully explained: every skipped test must be either a + `RUN_LIVE_TESTS`-gated live test or a documented quarantine with a pointer to + `docs/test-audit-findings.md`. Unexplained skips are findings. + +## Phase 2 — Hermeticity and isolation + +1. **No network escapes**: run the api suite with verbose logs and grep for + `Hermetic test violation` — occurrences must only be *deliberate* assertions/warn-paths, never + silent besides-the-point failures. Inspect `fetch-guard.ts` for holes (WebSockets are NOT + covered by it — verify nothing in the hermetic suite opens chain WS connections; check + the SDK contract test's NetworkManager handling specifically). +2. **Credential safety**: confirm `apps/api/src/test-utils/preload.ts` neutralizes every + credential a local `.env` could carry that the hermetic suite might otherwise use (Mykobo, + BRLA, Alfredpay, Supabase, signing seeds). Cross-check against `apps/api/.env.example` for + any credential-bearing var NOT overridden — each one is a potential leak; assess it. +3. **DB safety**: `db.ts` must refuse non-`test` database names; truncation must exclude + `SequelizeMeta`. Confirm tests cannot reach the dev database even with a populated `.env`. +4. **Mock isolation**: search all `*.test.ts` for `mock.module(` and module-scope singleton + patches (`X.getInstance =`, `Model. =`, `global. =`, `prototype. =`). Every one + must either (i) be restored in `afterAll` from a **value copy captured before mocking** (not a + live ESM namespace), or (ii) sit behind `if (process.env.RUN_LIVE_TESTS)`. Also verify the + canary (`aaa-leak-probe.test.ts`) still exists and passes. +5. **Order independence (sampled)**: pick ~8 api test files spanning directories and run each + standalone (`bun test `) — results must match their full-suite behavior. +6. **dist/ discovery**: confirm `apps/api/bunfig.toml` has `[test] root = "src"` and that + `bun test` executes no file under `dist/` (check the run's file list). +7. **Live-test gating**: with `RUN_LIVE_TESTS` unset, confirm the four phase integration tests + and shared XCM dry-runs skip AND execute no module-level patching (the guards around their + `mock.module`/model patches). + +## Phase 3 — Mutation checks: can the tests actually fail? + +This is the core of the integrity check. For each mutation: apply it, run ONLY the named test +scope, confirm at least one test **fails for the right reason**, then revert with +`git checkout -- ` and re-run to green. Never leave a mutation in place; verify +`git status` is clean at the end of this phase. + +| # | Mutation (production code) | Expected failing tests | +|---|---|---| +| 1 | `ramp.service.ts`: make `consumeQuote` not filter on `status = 'pending'` (or skip the `affectedRows === 0` throw) | quote-consumption invariants (concurrent double-register) | +| 2 | `ramp.service.ts`: remove the `quote.status !== "pending"` rejection | "rejects an already-consumed quote" | +| 3 | `ramp.service.ts`: remove the expiry check | "rejects an expired quote" | +| 4 | `destination-transfer-handler.ts`: make `validateDestinationTransferRecipient` a no-op | corridor scenario "wrong recipient" (security regression) | +| 5 | `ownershipAuth.ts`: make `assertRampOwnership` return without checking `ramp.userId` | auth invariants ownership tests | +| 6 | `apiKeyAuth.helpers.ts`: skip the `isActive`/expiry check in `validateSecretApiKey` | revoked/expired API key tests | +| 7 | `phase-processor.ts`: don't release the lock in the `finally` | corridor happy-path lock assertions | +| 8 | API response shape: rename a field the SDK reads in `getRampStatus`'s response (service level) | `sdk-contract.test.ts` | +| 9 | `ramp.machine.ts` (frontend): break one transition target the machine tests cover | the corresponding machine test | +| 10 | `webhook-delivery.service.ts`: change the signature header name or signing input | rewritten webhook-delivery tests | + +If any mutation survives (no test fails), that is a **high-severity finding**: name the missing +assertion and where it should live. + +## Phase 4 — Goal-level assessment (a/b/c) + +- **(a) Maintainability**: write (temporarily) a tiny new test using the harness — e.g. a new + invariant test hitting one endpoint via `startTestApp` + factories. Time/effort should be + minutes with zero new mocking. Delete it afterward. Judge the "How to extend" section of + `docs/testing-strategy.md` for accuracy: follow it literally and note every place it lies. +- **(b) Best practices**: single command (`bun test`) works; CI blocks on it; live tests opt-in; + no watch-mode surprises in CI paths; deterministic (no `Date.now`-sensitive flakes — check the + quote-expiry tests' clock handling); reasonable runtime (api suite target: well under a minute). +- **(c) Regression net coverage** — verify a test exists (and locate it) for each security-spec + invariant; flag any without one as a gap: + quote consumed exactly once/atomically; quote expiry; fee structure present & used for status + (fees immutable path); ownership (user/partner/anonymous, ramps AND quotes); credential matrix + (missing/invalid/malformed/revoked/expired); admin vs metrics-dashboard secrets; EUR + kill-switch behavior; presigned-tx recipient & signer validation; phase-processor lock + acquire/release + terminal states + retry exhaustion; ephemeral freshness check; webhook + signing/delivery/retry; SDK response-shape contract; frontend ramp/KYC machine error paths. + +## Phase 5 — Known deliberate gaps (confirm they are still true, documented, and acceptable) + +These were consciously descoped — confirm each is documented (strategy doc or findings doc), and +flag if any has silently grown in importance: + +- No golden/snapshot tests for quote **pricing math** (fee amounts for a fixed input matrix). + Check whether anything equivalent exists now; if not, it remains the top recommended addition. +- Only the BRL corridor has processor-level scenarios (EUR is kill-switched; Mykobo corridors are + covered by gated live tests only; Alfredpay corridors have no hermetic scenario). +- Substrate/Pendulum chain interactions are not faked (the ApiManager fake serves only inert + reads); XCM flows have no hermetic coverage. +- No Anvil/fork EVM tests (deliberate: upstream-RPC flakiness in CI). +- No coverage-percentage gate (deliberate for now). +- Rebalancer has unit tests only (no scenario harness). + +## Report format + +Produce a single report, most severe first: + +1. **Verdict** — one paragraph: does the suite deliver (a), (b), (c)? Merge-ready? +2. **Broken claims** — anything documented/claimed that is not true (file:line, how verified). +3. **Mutation results** — table: mutation → failed as expected? → notes. Highlight survivors. +4. **Hermeticity/isolation findings** — leaks, escapes, order dependence, credential exposure. +5. **Coverage gaps** — invariants without a failing-capable test. +6. **Deliberate-gap review** — still acceptable? Any promoted to "should fix now"? +7. **Confirmed-good summary** — what you verified works, with the numbers (pass/skip counts, + runtimes), so this report is also a record of the suite's state at audit time. + +Rules: read production code before judging a test wrong; verify empirically before reporting; +one mutation at a time and always revert; leave the working tree exactly as you found it +(`git status` clean, test DB left running). diff --git a/docs/testing-strategy.md b/docs/testing-strategy.md index 5a429ab0c..5ed23df6b 100644 --- a/docs/testing-strategy.md +++ b/docs/testing-strategy.md @@ -19,8 +19,8 @@ together with the shared test harness (`apps/api/src/test-utils`) — see "How t |---|---|---|---| | 1. Unit | Pure logic: helpers, token configs, SDK handlers | each package, next to source | `bun test` (Vitest for frontend) | | 2. API integration | Real Express + real Postgres + fake external world, driven over HTTP; incl. the quote pricing goldens (`quote-pricing.golden.test.ts`) and the HTTP surface tests (auth OTP flow, webhooks, ramp history, public routes; `http-surface.invariants.test.ts`) | `apps/api/src/tests/` | `bun test` | -| 3. Corridor scenarios | Phase processor end-to-end per corridor against the fake world: BRL onramp (pix→BRLA-on-Base), BRL offramp (USDC-on-Base→pix incl. real Nabla swap + both EVM subsidy phases), CROSS-CHAIN BRL offramp (USDC-on-Polygon→squid→Base→pix incl. user-reported squid-hash verification), MXN on/offramp (spei↔USDT-on-Polygon), CROSS-CHAIN MXN onramp (spei→Polygon mint→squid→USDT-on-Arbitrum incl. real squidRouterSwap/Pay + Arbitrum settlement subsidy), and a USD/COP/ARS matrix over the same Alfredpay rails (happy paths + per-currency limit breaches + transient/unrecoverable failures) | `apps/api/src/tests/corridors/` | `bun test` | -| 4. SDK contract | Real SDK against the real API in-process: BRL onramp lifecycle (`sdk-contract.test.ts`) and the SELL/user-transaction surface — offramp lifecycle via submitUserTransactions, updateRamp, getQuote, listAlfredpayFiatAccounts (`sdk-contract.offramp.test.ts`) | `apps/api/src/tests/sdk-contract*.test.ts` | `bun test` | +| 3. Corridor scenarios | Phase processor end-to-end per corridor against the fake world: BRL onramp (pix→BRLA-on-Base), BRL offramp (USDC-on-Base→pix incl. real Nabla swap + both EVM subsidy phases), CROSS-CHAIN BRL offramp (USDC-on-Polygon→squid→Base→pix incl. user-reported squid-hash verification), MXN on/offramp (spei↔USDT-on-Polygon), CROSS-CHAIN MXN onramp (spei→Polygon mint→squid→USDT-on-Arbitrum incl. real squidRouterSwap/Pay + Arbitrum settlement subsidy), and a USD/COP/ARS matrix over the same Alfredpay rails (happy paths + per-currency limit breaches + per-currency transient AND unrecoverable failures) | `apps/api/src/tests/corridors/` | `bun test` | +| 4. SDK contract | Real SDK against the real API in-process: BRL onramp lifecycle (`sdk-contract.test.ts`), the SELL/user-transaction surface — offramp lifecycle via submitUserTransactions, updateRamp, getQuote, listAlfredpayFiatAccounts (`sdk-contract.offramp.test.ts`) — and the Alfredpay SELL rail: full USD/ach offramp lifecycle plus quote/register shape checks for COP and ARS (`sdk-contract.alfredpay-offramp.test.ts`) | `apps/api/src/tests/sdk-contract*.test.ts` | `bun test` | | 5. Frontend | XState machine tests, actor tests (register/sign/start/KYC-routing against MSW with mocked wallet seams), component tests (RTL + MSW + mock wagmi) | `apps/frontend/src` | Vitest | | 6. E2E | Few critical Playwright journeys with a mock wallet | `apps/frontend/e2e/` | Playwright (non-blocking) | @@ -90,15 +90,19 @@ hand-write these objects or copy JSON snapshots into tests; extend the factory i ### Playwright E2E (`apps/frontend/e2e/`) A handful of critical journeys run against the real frontend in Chromium, hermetically: quote -form → quote displayed, quote error surfaced, wallet gate on offramps, and three full ramp +form → quote displayed, quote error surfaced, wallet gate on offramps, and four full ramp journeys — the BRL onramp (`onramp-brl-journey.spec.ts`: quote → email/OTP auth → Avenia KYC gate → registration → in-page ephemeral signing asserted via the presigned txs posted to `/v1/ramp/update` → Pix payment info → progress → success), the BRL OFFRAMP (`offramp-brl-journey.spec.ts`: the money-out path — wallet gate + balance check → CPF/Pix eligibility → registration → USER-WALLET broadcast of the source-of-funds transfer with its -hash reported in a second update → automatic start → success), and the MXN onramp +hash reported in a second update → automatic start → success), the MXN onramp (`onramp-mxn-journey.spec.ts`: the Alfredpay rail — Alfredpay KYC gate → Polygon-side -ephemeral signing → SPEI payment details (CLABE) → success): +ephemeral signing → SPEI payment details (CLABE) → success), and the USD OFFRAMP +(`offramp-usd-journey.spec.ts`: Alfredpay money-out — wallet gate on Polygon → Alfredpay KYC +gate → ACH fiat-account selection → ephemeral presigning → user-wallet broadcast with its +hash reported in a second update → automatic start → progress; the success screen is +currently unreachable for Alfredpay offramps — known frontend gap documented in the spec): - The API origin (`http://localhost:3000`) is intercepted per-test with `page.route` (`e2e/support/mockBackend.ts`) — no backend, database, or chain access. From 12272944aebfb9b6d8404aa17b574d59117e1abc Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 16:55:01 +0200 Subject: [PATCH 156/176] Fix Alfredpay offramps never leaving the progress screen getRampFlow returned null for SELL ramps whose output is not BRL/EURC, so the status-polling effect never ran for Alfredpay offramps (USD/MXN/COP/ARS) and the UI stayed on the progress screen forever. Add the Alfredpay offramp phase sequence to PHASE_FLOWS (matching the backend handlers: initial -> squidRouterPermitExecute -> fundEphemeral -> finalSettlementSubsidy -> alfredpayOfframpTransfer -> complete) and return it for Alfredpay fiat tokens, so polling runs and completion is detected. Extend the USD offramp E2E journey past the former KNOWN GAP: the status polls now serve the SELL fields and the spec asserts the success screen. --- apps/frontend/e2e/offramp-usd-journey.spec.ts | 21 +++++++------------ apps/frontend/src/pages/progress/index.tsx | 6 +++++- .../frontend/src/pages/progress/phaseFlows.ts | 9 ++++++++ 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/apps/frontend/e2e/offramp-usd-journey.spec.ts b/apps/frontend/e2e/offramp-usd-journey.spec.ts index a5d00ea4a..a2deb0e8d 100644 --- a/apps/frontend/e2e/offramp-usd-journey.spec.ts +++ b/apps/frontend/e2e/offramp-usd-journey.spec.ts @@ -19,14 +19,7 @@ const FIAT_ACCOUNT_ID = "fiat-account-e2e-1"; // account -> ramp registration -> ephemeral presigning posted to /ramp/update -> USER // WALLET broadcast of the squidRouterNoPermitTransfer (eth_sendTransaction on the mock // wallet) with its hash reported in a second /ramp/update -> automatic /ramp/start -> -// progress. -// -// KNOWN GAP: unlike the BRL offramp, this journey cannot end on the success screen. The -// progress page's getRampFlow (src/pages/progress/index.tsx) returns null for SELL -// ramps whose output is not BRL/EURC, so the ramp status is never polled after start -// and currentPhase never advances to "complete" — for Alfredpay offramps the UI stays -// on the progress screen. This spec asserts the truthful current behavior (progress -// after the automatic start); extend it to the success screen when that gap is fixed. +// progress -> success (once status polling reports COMPLETE). const SELL_RAMP_FIELDS = { depositQrCode: undefined, @@ -84,7 +77,7 @@ function buildSellUnsignedTxs(evmEphemeral: string) { ]; } -test("SELL USD journey: quote, auth, Alfredpay KYC gate, fiat account, registration, wallet signing, progress", async ({ +test("SELL USD journey: quote, auth, Alfredpay KYC gate, fiat account, registration, wallet signing, progress, success", async ({ page }) => { // The real API keeps returning the ramp's unsignedTxs on /ramp/update; the signing @@ -105,6 +98,7 @@ test("SELL USD journey: quote, auth, Alfredpay KYC gate, fiat account, registrat }), status: 200 }) as { status: number; body: unknown }, + rampStatusOverrides: () => SELL_RAMP_FIELDS, register: body => { const signingAccounts = (body.signingAccounts ?? []) as Array<{ address: string; type: string }>; const evmEphemeral = signingAccounts.find(account => account.type === "EVM")?.address ?? POLYGON_USDT; @@ -159,13 +153,12 @@ test("SELL USD journey: quote, auth, Alfredpay KYC gate, fiat account, registrat // Stage 7: the ephemeral transactions are signed in-page and posted to /ramp/update, // then the USER WALLET broadcasts the source-of-funds transfer and its hash is - // reported in a second update; the offramp starts automatically and lands on the - // progress screen (which only renders once the machine reaches RampFollowUp, i.e. - // after /ramp/start succeeded). See the KNOWN GAP note above for why the journey - // ends here instead of on the success screen. - await expect(page.getByRole("heading", { name: "Your transaction is in progress." })).toBeVisible({ + // reported in a second update; the offramp starts automatically and (once polling + // reports COMPLETE) lands on the SELL success screen. + await expect(page.getByRole("heading", { name: "All set! The withdrawal has been sent to your bank." })).toBeVisible({ timeout: 45_000 }); + await expect(page.getByText("Your funds will arrive in your bank account in a few minutes.")).toBeVisible(); expect(backend.registerRequests).toHaveLength(1); const registerBody = backend.registerRequests[0] as { diff --git a/apps/frontend/src/pages/progress/index.tsx b/apps/frontend/src/pages/progress/index.tsx index a80ab228e..85c3cebac 100644 --- a/apps/frontend/src/pages/progress/index.tsx +++ b/apps/frontend/src/pages/progress/index.tsx @@ -1,5 +1,5 @@ import { CheckIcon, ExclamationCircleIcon } from "@heroicons/react/20/solid"; -import { FiatToken, isNetworkEVM, RampDirection, RampPhase } from "@vortexfi/shared"; +import { FiatToken, isAlfredpayToken, isNetworkEVM, RampDirection, RampPhase } from "@vortexfi/shared"; import { useSelector } from "@xstate/react"; import { motion } from "motion/react"; import { FC, useEffect, useMemo, useRef, useState } from "react"; @@ -37,6 +37,10 @@ function getRampFlow(rampState: RampState | undefined): keyof typeof PHASE_FLOWS return "offramp_eur_evm"; } + if (rampState.quote && isAlfredpayToken(rampState.quote.outputCurrency)) { + return "offramp_alfredpay"; + } + return null; } diff --git a/apps/frontend/src/pages/progress/phaseFlows.ts b/apps/frontend/src/pages/progress/phaseFlows.ts index 444133d82..9cba0e8e3 100644 --- a/apps/frontend/src/pages/progress/phaseFlows.ts +++ b/apps/frontend/src/pages/progress/phaseFlows.ts @@ -44,6 +44,15 @@ export const PHASE_DURATIONS: Record = { }; export const PHASE_FLOWS = { + offramp_alfredpay: [ + "initial", + "squidRouterPermitExecute", + "fundEphemeral", + "finalSettlementSubsidy", + "alfredpayOfframpTransfer", + "complete" + ] as RampPhase[], + offramp_brl: [ "initial", "fundEphemeral", From 894502b22beb2743626f4a89309ad36722541014 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 16:57:35 +0200 Subject: [PATCH 157/176] Widen subsidies.token from enum to varchar so dynamic symbols record MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit finalSettlementSubsidy records the assetSymbol returned by the dynamic SquidRouter registry (1,695 live symbols outside the enum on supported BUY networks, e.g. WETH, USDC.e — the latter even in the static config) plus per-network natives (BNB, AVAX). Since createSubsidy deliberately swallows insert errors, any such symbol meant the subsidy was paid on-chain but never recorded — the same failure mode migration 036 already patched piecemeal for ETH. Migration 037 makes the column VARCHAR(32) permanently, and the swallowed-error path now logs an alertable SUBSIDY_RECORDING_FAILED line with ramp, phase, token, amount, and tx hash. --- .../api/services/phases/base-phase-handler.ts | 13 +++++-- .../handlers/final-settlement-subsidy.ts | 5 +-- .../037-subsidy-token-enum-to-varchar.ts | 38 +++++++++++++++++++ apps/api/src/models/subsidy.model.ts | 11 ++++-- .../06-cross-chain/fund-routing.md | 1 + 5 files changed, 56 insertions(+), 12 deletions(-) create mode 100644 apps/api/src/database/migrations/037-subsidy-token-enum-to-varchar.ts diff --git a/apps/api/src/api/services/phases/base-phase-handler.ts b/apps/api/src/api/services/phases/base-phase-handler.ts index 1743b7cac..6670eaa79 100644 --- a/apps/api/src/api/services/phases/base-phase-handler.ts +++ b/apps/api/src/api/services/phases/base-phase-handler.ts @@ -3,7 +3,7 @@ import { PresignedTx, RampErrorLog, RampPhase } from "@vortexfi/shared"; import httpStatus from "http-status"; import logger from "../../../config/logger"; import RampState from "../../../models/rampState.model"; -import Subsidy, { SubsidyToken } from "../../../models/subsidy.model"; +import Subsidy from "../../../models/subsidy.model"; import { APIError } from "../../errors/api-error"; import { PhaseError, RecoverablePhaseError, UnrecoverablePhaseError } from "../../errors/phase-error"; import rampService from "../ramp/ramp.service"; @@ -152,7 +152,7 @@ export abstract class BasePhaseHandler implements PhaseHandler { protected async createSubsidy( state: RampState, amount: number, - token: SubsidyToken, + token: string, payerAccount: string, transactionHash: string, paymentDate: Date = new Date() @@ -182,8 +182,13 @@ export abstract class BasePhaseHandler implements PhaseHandler { logger.info(`Subsidy created successfully with id ${subsidy.id} for ramp ${state.id}`); } catch (error) { - logger.error(`Error creating subsidy for ramp ${state.id}:`, error); - // We do not want to throw an error here, as it should not block the phase execution. + // Deliberately swallowed so bookkeeping can't block the phase — but the subsidy + // was already paid on-chain, so an unrecorded row is real money lost to + // accounting. Keep this line alertable. + logger.error( + `SUBSIDY_RECORDING_FAILED: subsidy paid but not recorded. ramp=${state.id} phase=${this.getPhaseName()} token=${token} amount=${amount} txHash=${transactionHash}:`, + error + ); } } diff --git a/apps/api/src/api/services/phases/handlers/final-settlement-subsidy.ts b/apps/api/src/api/services/phases/handlers/final-settlement-subsidy.ts index 47b55eaa7..a5f3572bc 100644 --- a/apps/api/src/api/services/phases/handlers/final-settlement-subsidy.ts +++ b/apps/api/src/api/services/phases/handlers/final-settlement-subsidy.ts @@ -28,7 +28,6 @@ import logger from "../../../../config/logger"; import { MAX_FINAL_SETTLEMENT_SUBSIDY_USD } from "../../../../constants/constants"; import QuoteTicket from "../../../../models/quoteTicket.model"; import RampState from "../../../../models/rampState.model"; -import { SubsidyToken } from "../../../../models/subsidy.model"; import { priceFeedService } from "../../priceFeed.service"; import { isFiatToOwnStablecoinBaseDirect } from "../../quote/utils"; import { BasePhaseHandler } from "../base-phase-handler"; @@ -376,9 +375,7 @@ export class FinalSettlementSubsidyHandler extends BasePhaseHandler { } if (txHash) { - const subsidyToken = ( - isNative ? NATIVE_TOKENS[destinationNetwork].symbol : outTokenDetails.assetSymbol - ) as SubsidyToken; + const subsidyToken = isNative ? NATIVE_TOKENS[destinationNetwork].symbol : outTokenDetails.assetSymbol; const subsidyAmount = nativeToDecimal( subsidyAmountRaw, isNative ? NATIVE_TOKENS[destinationNetwork].decimals : outTokenDetails.decimals diff --git a/apps/api/src/database/migrations/037-subsidy-token-enum-to-varchar.ts b/apps/api/src/database/migrations/037-subsidy-token-enum-to-varchar.ts new file mode 100644 index 000000000..d995815df --- /dev/null +++ b/apps/api/src/database/migrations/037-subsidy-token-enum-to-varchar.ts @@ -0,0 +1,38 @@ +import { QueryInterface } from "sequelize"; + +// The subsidy token symbol comes from the dynamic SquidRouter token registry +// (outTokenDetails.assetSymbol in final-settlement-subsidy) and per-network +// native symbols (BNB, AVAX), so the set of reachable values is open-ended — +// an enum can never be complete. Migration 036 already patched this failure +// mode once (ETH missing → createSubsidy failed silently). Widen to VARCHAR +// permanently so on-chain subsidies can't go unrecorded over bookkeeping. +const ENUM_VALUES_036 = ["GLMR", "PEN", "XLM", "USDC.axl", "BRLA", "EURC", "USDC", "MATIC", "BRL", "ETH", "USDT"]; + +export async function up(queryInterface: QueryInterface): Promise { + await queryInterface.sequelize.query(` + ALTER TABLE subsidies ALTER COLUMN token TYPE VARCHAR(32); + `); + + await queryInterface.sequelize.query(` + DROP TYPE IF EXISTS enum_subsidies_token; + `); +} + +export async function down(queryInterface: QueryInterface): Promise { + // Map values the 036 enum can't hold to USDC before casting back. + await queryInterface.sequelize.query(` + UPDATE subsidies SET token = 'USDC' WHERE token NOT IN (${ENUM_VALUES_036.map(value => `'${value}'`).join(", ")}); + `); + + await queryInterface.sequelize.query(` + DROP TYPE IF EXISTS enum_subsidies_token; + `); + + await queryInterface.sequelize.query(` + CREATE TYPE enum_subsidies_token AS ENUM (${ENUM_VALUES_036.map(value => `'${value}'`).join(", ")}); + `); + + await queryInterface.sequelize.query(` + ALTER TABLE subsidies ALTER COLUMN token TYPE enum_subsidies_token USING token::enum_subsidies_token; + `); +} diff --git a/apps/api/src/models/subsidy.model.ts b/apps/api/src/models/subsidy.model.ts index 385cac4dc..58a84aca8 100644 --- a/apps/api/src/models/subsidy.model.ts +++ b/apps/api/src/models/subsidy.model.ts @@ -2,7 +2,10 @@ import { RampPhase } from "@vortexfi/shared"; import { DataTypes, Model, Optional } from "sequelize"; import sequelize from "../config/database"; -// TODO how to take this from other types? +// Known subsidy tokens for callers that reference fixed symbols. The DB column +// is a plain VARCHAR (migration 037): final-settlement subsidies record the +// assetSymbol from the dynamic SquidRouter registry, so the reachable set of +// symbols is open-ended and must not be constrained by an enum. export enum SubsidyToken { GLMR = "GLMR", PEN = "PEN", @@ -22,7 +25,7 @@ export interface SubsidyAttributes { rampId: string; phase: RampPhase; amount: number; - token: SubsidyToken; + token: string; paymentDate: Date; payerAccount: string; transactionHash: string; @@ -41,7 +44,7 @@ class Subsidy extends Model implem declare amount: number; - declare token: SubsidyToken; + declare token: string; declare paymentDate: Date; @@ -105,7 +108,7 @@ Subsidy.init( token: { allowNull: false, comment: "Token used for the subsidy payment", - type: DataTypes.ENUM(...Object.values(SubsidyToken)) + type: DataTypes.STRING(32) }, transactionHash: { allowNull: false, diff --git a/docs/security-spec/06-cross-chain/fund-routing.md b/docs/security-spec/06-cross-chain/fund-routing.md index bedbe669c..281d167e1 100644 --- a/docs/security-spec/06-cross-chain/fund-routing.md +++ b/docs/security-spec/06-cross-chain/fund-routing.md @@ -80,3 +80,4 @@ The current code resolves this through `EVM_FUNDING_PRIVATE_KEY` and the `getEvm - [x] **`MOONBEAM_FUNDING_PRIVATE_KEY` rename/refactor**: EVM funding now uses the `EVM_FUNDING_PRIVATE_KEY` / `getEvmFundingAccount(network)` path, with the old env name retained only as backward-compatible fallback. - [x] **`finalSettlementSubsidy` subsidizes against actual bridge delivery, not total balance.** **PASS** — snapshots `preSettlementBalance` before broadcasting `squidRouterSwap` (`squid-router-phase-handler.ts`, stored in `meta-state-types.ts`), does not overwrite it on retry, waits for ≥90% of `expectedAmountRaw`, computes `subsidy = expected − (actualBalance − preSettlementBalance)`, and clamps the result to the on-chain shortfall. Prevents both the dust-triggered over-subsidy race and same-chain post-delivery baseline overwrite. - [x] **`finalSettlementSubsidy` short-circuits degenerate same-token routes.** **PASS** — returns to `destinationTransfer` when `state.state.isDirectTransfer === true`, `isEurToEurcBaseDirect(...)`, or `isBrlToBrlaBaseDirect(...)`, so no subsidy is computed for routes that have no Squid bridge to settle. +- [x] **Subsidy bookkeeping cannot silently drop rows for unknown token symbols.** **PASS (FIXED)** — `subsidies.token` was a Postgres enum, but `finalSettlementSubsidy` records the `assetSymbol` from the dynamic SquidRouter token registry (open-ended: `WETH`, `USDC.e`, ...) plus per-network native symbols (`BNB`, `AVAX`), and `BasePhaseHandler.createSubsidy` deliberately swallows insert errors so bookkeeping never blocks a phase. Any symbol outside the enum meant the subsidy was paid on-chain but never recorded. Migration 037 widens the column to `VARCHAR(32)` (the enum patched piecemeal before — see migration 036), and the swallowed-error path now logs an alertable `SUBSIDY_RECORDING_FAILED` line with ramp, phase, token, amount, and tx hash. Regression: `src/tests/subsidy-recording.invariants.test.ts`. From ff35fd7c9898a4620dbb54e42df3eb0fcf526f96 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 16:57:45 +0200 Subject: [PATCH 158/176] Add regression coverage for subsidy rows with non-enum token symbols Round-trips USDC.e, WETH, BNB, and AVAX through the subsidies table and through BasePhaseHandler.createSubsidy itself, so a reintroduced enum constraint fails loudly instead of silently dropping bookkeeping rows. --- .../subsidy-recording.invariants.test.ts | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 apps/api/src/tests/subsidy-recording.invariants.test.ts diff --git a/apps/api/src/tests/subsidy-recording.invariants.test.ts b/apps/api/src/tests/subsidy-recording.invariants.test.ts new file mode 100644 index 000000000..4c20807da --- /dev/null +++ b/apps/api/src/tests/subsidy-recording.invariants.test.ts @@ -0,0 +1,77 @@ +import { beforeAll, beforeEach, describe, expect, it } from "bun:test"; +import { RampPhase } from "@vortexfi/shared"; +import { BasePhaseHandler } from "../api/services/phases/base-phase-handler"; +import RampState from "../models/rampState.model"; +import Subsidy from "../models/subsidy.model"; +import { resetTestDatabase, setupTestDatabase } from "../test-utils/db"; +import { createTestRampState } from "../test-utils/factories"; + +/** + * Regression for the subsidy-recording gap fixed by migration 037 + * (docs/security-spec/06-cross-chain/fund-routing.md): finalSettlementSubsidy + * records the assetSymbol from the dynamic SquidRouter token registry, whose + * value set is open-ended (WETH, USDC.e, BNB, ...). While subsidies.token was + * a Postgres enum, any symbol outside it made Subsidy.create throw — and + * createSubsidy swallows insert errors, so the subsidy was paid on-chain but + * never recorded. The column is now a VARCHAR; these symbols must round-trip. + */ + +// Symbols reachable in production that the pre-037 enum rejected: USDC.e is in +// the static EVM config (Polygon/Arbitrum/Avalanche), WETH comes from the +// dynamic registry, BNB/AVAX are the handler's native symbols for BSC/Avalanche. +const NON_ENUM_SYMBOLS = ["USDC.e", "WETH", "BNB", "AVAX"]; + +class TestSubsidyHandler extends BasePhaseHandler { + public getPhaseName(): RampPhase { + return "finalSettlementSubsidy"; + } + + protected async executePhase(state: RampState): Promise { + return state; + } + + public recordSubsidy(state: RampState, token: string): Promise { + return this.createSubsidy(state, 1.23, token, "0x30a300612ab372CC73e53ffE87fB73d62Ed68Da3", "0xdeadbeef"); + } +} + +describe("subsidy recording accepts dynamic-registry token symbols", () => { + beforeAll(async () => { + await setupTestDatabase(); + }); + + beforeEach(async () => { + await resetTestDatabase(); + }); + + it.each(NON_ENUM_SYMBOLS)("round-trips a '%s' subsidy row", async token => { + const state = await createTestRampState(); + + await Subsidy.create({ + amount: 1.23, + payerAccount: "0x30a300612ab372CC73e53ffE87fB73d62Ed68Da3", + paymentDate: new Date(), + phase: "finalSettlementSubsidy", + rampId: state.id, + token, + transactionHash: "0xdeadbeef" + }); + + const stored = await Subsidy.findOne({ where: { rampId: state.id } }); + expect(stored?.token).toBe(token); + }); + + // The full seam: createSubsidy swallows insert errors by design, so a + // rejected token surfaced as *no row* rather than a failed phase. Assert the + // row actually lands when the symbol comes through the handler path. + it("createSubsidy persists a row for a symbol outside the legacy enum", async () => { + const state = await createTestRampState(); + + await new TestSubsidyHandler().recordSubsidy(state, "USDC.e"); + + const stored = await Subsidy.findOne({ where: { rampId: state.id } }); + expect(stored).not.toBeNull(); + expect(stored?.token).toBe("USDC.e"); + expect(stored?.phase).toBe("finalSettlementSubsidy"); + }); +}); From 15788ff2307635a1bcb3e464435c84797d136894 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 16:59:17 +0200 Subject: [PATCH 159/176] Add a corridor-by-entry-point coverage matrix to the testing strategy --- docs/testing-strategy.md | 47 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/docs/testing-strategy.md b/docs/testing-strategy.md index 5ed23df6b..a9c985e95 100644 --- a/docs/testing-strategy.md +++ b/docs/testing-strategy.md @@ -48,6 +48,53 @@ Derived from `docs/security-spec/` — these must never regress, and each has de When a new security finding is fixed, add a regression test in the same PR and reference the finding ID in the test name. +## Coverage matrix: corridors × entry points + +One row per live corridor and direction. The scenario columns are the **direct-API entry point** +(registration over real HTTP + the real phase processor against the fake world); SDK and E2E are +the other two entry points. Corridor-agnostic invariants (auth matrix, quote consumption/expiry, +fee immutability, pricing goldens, ownership) are not repeated per row — they run once against +shared code and are listed in the invariants section above. **Update this table in the same PR +as any new corridor, rail, or entry-point test.** + +Legend: ✅ directly tested · ◐ covered only via shared code/another corridor (see footnote) · +❌ missing · — not applicable · 🚫 kill-switched. + +| Corridor (rail) | Dir | Happy path | Transient | Unrecoverable | Security / caps | Cross-chain leg | SDK | E2E journey | +|---|---|---|---|---|---|---|---|---| +| BRL (Avenia / Pix) | BUY | ✅ | ✅ | ✅ | ✅ recipient | ◐¹ | ✅ | ✅ | +| BRL (Avenia / Pix) | SELL | ✅ | ✅ | ✅ | ✅ pre/post-swap caps, recipient | ✅ F-021 | ✅ | ✅ | +| MXN (Alfredpay / SPEI) | BUY | ✅ | ✅ | ✅ | ✅ recipient | ✅ settlement subsidy | ❌ | ✅ | +| MXN (Alfredpay / SPEI) | SELL | ✅ | ✅ | ✅ | ✅ calldata, F-001 cap | ◐² | ◐³ | ◐⁴ | +| USD (Alfredpay / ACH) | BUY | ✅ | ✅ | ✅ | ✅ + limit breach | ◐¹ | ❌ | ◐⁴ | +| USD (Alfredpay / ACH) | SELL | ✅ | ✅ | ✅ | ✅ + limit breach | ◐² | ✅ | ✅⁵ | +| COP (Alfredpay / ACH) | BUY | ✅ | ✅ | ✅ | ✅ + limit breach | ◐¹ | ❌ | ◐⁴ | +| COP (Alfredpay / ACH) | SELL | ✅ | ✅ | ✅ | ✅ + limit breach | ◐² | ◐⁶ | ◐⁴ | +| ARS (Alfredpay / CBU) | BUY | ✅ | ✅ | ✅ | ✅ + limit breach | ◐¹ | ❌ | ◐⁴ | +| ARS (Alfredpay / CBU) | SELL | ✅ | ✅ | ✅ | ✅ + limit breach | ◐² | ◐⁶ | ◐⁴ | +| EUR (Mykobo / SEPA) | both | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | +| AssetHub (BRL BUY → USDC; USDC SELL → Pix) | both | ❌ deferred | ❌ | ❌ | ❌ | — | ❌ | ❌ | + +¹ Onramp squid leg (squidRouterSwap/Pay + settlement subsidy) exercised only by the MXN +cross-chain onramp scenario; the handlers are shared, but no per-corridor variant exists. +² Offramp squid leg (user-reported squid-hash verification) exercised only by the BRL +cross-chain offramp scenario; handlers shared. +³ The Alfredpay SELL rail's SDK lifecycle runs as USD; MXN itself is never driven through +the SDK. +⁴ The Alfredpay BUY UI flow is exercised by the MXN onramp journey and the SELL flow by the +USD offramp journey; no per-currency journey exists. +⁵ The journey ends at the progress screen: the success screen is currently unreachable for +Alfredpay offramps (frontend bug — `getRampFlow` returns null for SELL with non-BRL/EURC +output; fix in progress). +⁶ Quote + register SDK shape checks only; no full lifecycle. + +**Gaps at a glance** (everything not ✅ above): no SDK coverage for any Alfredpay BUY; +MXN never driven through the SDK; COP/ARS SDK SELL is shape-checks only; Alfredpay E2E exists +only as one BUY (MXN) and one SELL (USD) journey; per-corridor cross-chain variants lean on +shared handlers; EUR is gated on the documented re-enablement precondition; the AssetHub +corridors are reachable in production but deliberately deferred (see the decision note under +Infrastructure — revisit if the product keeps them). + ## Infrastructure ### The fake external world (`apps/api/src/test-utils/`) From cd334b1dee7385c3d9582a0eb0d11b95534d400d Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 17:10:15 +0200 Subject: [PATCH 160/176] Add SDK contract coverage for the Alfredpay onramp rail --- .../sdk-contract.alfredpay-onramp.test.ts | 388 ++++++++++++++++++ docs/testing-strategy.md | 21 +- 2 files changed, 400 insertions(+), 9 deletions(-) create mode 100644 apps/api/src/tests/sdk-contract.alfredpay-onramp.test.ts diff --git a/apps/api/src/tests/sdk-contract.alfredpay-onramp.test.ts b/apps/api/src/tests/sdk-contract.alfredpay-onramp.test.ts new file mode 100644 index 000000000..7b585ed6b --- /dev/null +++ b/apps/api/src/tests/sdk-contract.alfredpay-onramp.test.ts @@ -0,0 +1,388 @@ +import { afterAll, beforeAll, beforeEach, describe, expect, it } from "bun:test"; +import { + ALFREDPAY_ERC20_DECIMALS, + ALFREDPAY_ERC20_TOKEN, + AlfredPayCountry, + AlfredpayOnrampStatus, + EPaymentMethod, + EvmToken, + FiatToken, + type GetRampStatusResponse, + Networks, + RampDirection +} from "@vortexfi/shared"; +import { decodeFunctionData, erc20Abi, parseTransaction, parseUnits } from "viem"; +import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"; +import { VortexSdk } from "../../../../packages/sdk/src"; +import QuoteTicket from "../models/quoteTicket.model"; +import RampState from "../models/rampState.model"; +import { resetTestDatabase, setupTestDatabase } from "../test-utils/db"; +import { createTestAlfredpayCustomer, createTestApiKey, createTestUser } from "../test-utils/factories"; +import { type FakeWorld, installFakeWorld } from "../test-utils/fake-world"; +import { startTestApp, type TestApp } from "../test-utils/test-app"; + +const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/; +const POLYGON_CHAIN_ID_HEX = "0x89"; // 137 + +// 2000 MXN * 0.05 = 100 USDT: the same legible flat rate the MXN corridor scenario uses. +const MXN_ONRAMP_RATE = 0.05; + +interface CurrencyCase { + fiat: FiatToken; + /** Alfredpay-side currency code expected on created orders. */ + alfredpayCurrency: string; + /** KYC country the registration guard requires a completed profile for. */ + country: AlfredPayCountry; + /** Quote source string (payment rail). */ + rail: EPaymentMethod; + /** Fiat amount for the BUY quote (within the per-currency limits). */ + inputAmount: string; + /** USDT the fake anchor mints per unit of fiat. */ + onrampRate: number; +} + +// Rails per currency: USD and COP fund over ach, ARS over cbu (rates mirror the FakePrices feeds). +const CURRENCY_CASES: CurrencyCase[] = [ + { + alfredpayCurrency: "USD", + country: AlfredPayCountry.US, + fiat: FiatToken.USD, + inputAmount: "20000", + onrampRate: 1, + rail: EPaymentMethod.ACH + }, + { + alfredpayCurrency: "COP", + country: AlfredPayCountry.CO, + fiat: FiatToken.COP, + inputAmount: "50000", + onrampRate: 1 / 4000, + rail: EPaymentMethod.ACH + }, + { + alfredpayCurrency: "ARS", + country: AlfredPayCountry.AR, + fiat: FiatToken.ARS, + inputAmount: "10000", + onrampRate: 1 / 1000, + rail: EPaymentMethod.CBU + } +]; + +/** + * Same shim as the other SDK contract tests: the SDK's viem wallet client + * issues one eth_chainId RPC before signing locally with the ephemeral key. + * The Alfredpay BUY corridors only ephemeral-sign on Polygon (the anchor mints + * USDT there), so answer with the Polygon chain id. + */ +function installChainIdShim(): { restore: () => void } { + const guardedFetch = globalThis.fetch; + const shim = (async (input: Parameters[0], init?: Parameters[1]) => { + if (typeof init?.body === "string") { + try { + const payload = JSON.parse(init.body) as { id?: number; method?: string }; + if (payload.method === "eth_chainId") { + return Response.json({ id: payload.id ?? 1, jsonrpc: "2.0", result: POLYGON_CHAIN_ID_HEX }); + } + } catch { + // not JSON — let the guarded fetch decide + } + } + return guardedFetch(input, init); + }) as typeof fetch; + globalThis.fetch = Object.assign(shim, guardedFetch); + return { + restore: () => { + globalThis.fetch = guardedFetch; + } + }; +} + +/** + * SDK ↔ API contract tests for the Alfredpay BUY rail (fiat → USDT on + * Polygon): the real @vortexfi/sdk drives the real in-process API. The full + * lifecycle deliberately runs as MXN/spei — the one corridor no other SDK test + * exercises — with registerRamp's internal flow (ephemeral generation, + * /v1/ramp/register, signing the destinationTransfer + backups, and the + * /v1/ramp/update that creates the anchor order and returns the SPEI payment + * details). USD/COP/ARS get lighter createQuote/registerRamp shape checks. + */ +describe("SDK ↔ API contract (Alfredpay onramps, fiat → USDT on Polygon)", () => { + let world: FakeWorld; + let chainIdShim: { restore: () => void }; + let app: TestApp; + + beforeAll(async () => { + world = installFakeWorld(); + chainIdShim = installChainIdShim(); + await setupTestDatabase(); + app = await startTestApp(); + }); + + afterAll(async () => { + await app?.close(); + chainIdShim?.restore(); + world?.restore(); + }); + + beforeEach(async () => { + await resetTestDatabase(); + world.evm.failNextSends = 0; + world.evm.onTransaction = undefined; + world.alfredpay.onrampRate = 1; + world.alfredpay.onCreateOnramp = undefined; + world.alfredpay.onrampStatus = AlfredpayOnrampStatus.TRADE_COMPLETED; + world.alfredpay.onrampStatusMetadata = null; + }); + + /** A user with a completed Alfredpay KYC profile and an SDK authenticated via their secret key. */ + async function createUserSdk(country: AlfredPayCountry): Promise<{ sdk: VortexSdk; userId: string }> { + const user = await createTestUser(); + await createTestAlfredpayCustomer(user.id, { country }); + const { plaintextKey } = await createTestApiKey({ userId: user.id }); + const sdk = new VortexSdk({ apiBaseUrl: app.baseUrl, secretKey: plaintextKey, storeEphemeralKeys: false }); + return { sdk, userId: user.id }; + } + + function quoteRequest(fiat: FiatToken, rail: EPaymentMethod, inputAmount: string) { + return { + from: rail, + inputAmount, + inputCurrency: fiat, + network: Networks.Polygon, + outputCurrency: EvmToken.USDT, + rampType: RampDirection.BUY, + to: Networks.Polygon + } as const; + } + + /** + * Scripts the fake world so every polling loop succeeds on its first check + * (same script as the corridor scenario tests): the Alfredpay mint has + * already credited the ephemeral's USDT, the ephemeral has Polygon gas, and + * submitted raw ERC-20 transfers are applied to the in-memory ledger. + */ + function scriptHappyWorld(ephemeralAddress: string, mintAmountRaw: bigint): void { + world.evm.setNativeBalance(Networks.Polygon, ephemeralAddress, parseUnits("2", 18)); + world.evm.setErc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, ephemeralAddress, mintAmountRaw); + world.evm.onTransaction = tx => { + if (!tx.serialized) { + return; + } + const parsed = parseTransaction(tx.serialized as `0x${string}`); + if (!parsed.to || !parsed.data) { + return; + } + const { functionName, args } = decodeFunctionData({ abi: erc20Abi, data: parsed.data }); + if (functionName !== "transfer") { + return; + } + const [recipient, amount] = args as [`0x${string}`, bigint]; + world.evm.setErc20Balance( + tx.network, + parsed.to, + recipient, + world.evm.erc20Balance(tx.network, parsed.to, recipient) + amount + ); + }; + } + + /** Polls getRampStatus (itself part of the contract) until the ramp completes. */ + async function waitForComplete(sdk: VortexSdk, rampId: string): Promise { + const deadline = Date.now() + 20_000; + for (;;) { + const status = await sdk.getRampStatus(rampId); + // Fail immediately (not via the poll timeout) if the status shape breaks. + expect(status.currentPhase).toBeDefined(); + if (status.currentPhase === "complete") { + return status; + } + // getRampStatus intentionally never reports "failed"; read the DB so a + // failed ramp aborts with its error logs instead of timing out. + const state = await RampState.findByPk(rampId); + if (state?.currentPhase === "failed") { + throw new Error(`Ramp ${rampId} failed: ${JSON.stringify(state.errorLogs)}`); + } + if (Date.now() > deadline) { + throw new Error(`Timed out waiting for ramp ${rampId} to complete (phase: ${status.currentPhase})`); + } + await Bun.sleep(50); + } + } + + it( + "drives the full MXN/spei lifecycle: createQuote → registerRamp → startRamp → getRampStatus", + async () => { + world.alfredpay.onrampRate = MXN_ONRAMP_RATE; + const { sdk, userId } = await createUserSdk(AlfredPayCountry.MX); + const destination = privateKeyToAccount(generatePrivateKey()).address; + + const quote = await sdk.createQuote(quoteRequest(FiatToken.MXN, EPaymentMethod.SPEI, "2000")); + + // Quote contract: the fields the SDK's QuoteResponse type promises to integrators. + expect(quote.id).toMatch(UUID_PATTERN); + expect(quote.rampType).toBe(RampDirection.BUY); + expect(quote.from).toBe(EPaymentMethod.SPEI); + expect(quote.to).toBe(Networks.Polygon); + expect(quote.network).toBe(Networks.Polygon); + expect(Number(quote.inputAmount)).toBe(2000); + expect(quote.inputCurrency).toBe(FiatToken.MXN); + expect(quote.outputCurrency).toBe(EvmToken.USDT); + expect(Number(quote.outputAmount)).toBeGreaterThan(0); + expect(new Date(quote.expiresAt).getTime()).toBeGreaterThan(Date.now()); + const feeFields = [ + quote.networkFeeFiat, + quote.anchorFeeFiat, + quote.vortexFeeFiat, + quote.partnerFeeFiat, + quote.totalFeeFiat, + quote.processingFeeFiat, + quote.networkFeeUsd, + quote.anchorFeeUsd, + quote.vortexFeeUsd, + quote.partnerFeeUsd, + quote.totalFeeUsd, + quote.processingFeeUsd + ]; + for (const fee of feeFields) { + expect(Number.isFinite(Number(fee))).toBe(true); + } + expect(quote.feeCurrency).toBeTruthy(); + + // registerRamp runs the SDK's full internal Alfredpay BUY flow: ephemeral + // generation (Substrate + EVM), /v1/ramp/register, signing the returned + // destinationTransfer (plus its backups), and the /v1/ramp/update that + // creates the anchor order — there is no separate user sign/update step. + const { rampProcess, unsignedTransactions } = await sdk.registerRamp(quote, { destinationAddress: destination }); + + // Alfredpay onramps settle fiat off-chain: no user-wallet transactions. + expect(unsignedTransactions).toEqual([]); + expect(rampProcess.id).toMatch(UUID_PATTERN); + expect(rampProcess.quoteId).toBe(quote.id); + expect(rampProcess.type).toBe(RampDirection.BUY); + expect(rampProcess.currentPhase).toBe("initial"); + expect(Number(rampProcess.inputAmount)).toBe(Number(quote.inputAmount)); + expect(Number(rampProcess.outputAmount)).toBe(Number(quote.outputAmount)); + + // The client-visible payment details: SPEI instructions with the CLABE + // the user must wire the MXN to. + expect(rampProcess.achPaymentData?.paymentType).toBe("SPEI"); + expect(rampProcess.achPaymentData?.clabe).toBeTruthy(); + + // The ephemeral surface of the direct Alfredpay BUY route: the + // destination transfer plus the Polygon dust cleanup. + const unsigned = rampProcess.unsignedTxs ?? []; + expect(unsigned.map(tx => tx.phase).sort()).toEqual(["destinationTransfer", "polygonCleanup"]); + expect(unsigned.every(tx => tx.network === Networks.Polygon)).toBe(true); + const destinationTransferTx = unsigned.find(tx => tx.phase === "destinationTransfer"); + if (!destinationTransferTx) { + throw new Error("No destinationTransfer in unsignedTxs"); + } + const ephemeralAddress = destinationTransferTx.signer; + + // The SDK-signed transfer stored by /v1/ramp/update must pay the + // registered destination exactly the quoted USDT on Polygon — the core + // signing contract between SDK and backend. + const stored = await RampState.findByPk(rampProcess.id); + expect(stored?.userId).toBe(userId); + expect(stored?.state.alfredpayTransactionId).toBeTruthy(); + const presigned = stored?.presignedTxs ?? []; + expect(presigned.map(tx => tx.phase).sort()).toEqual(["destinationTransfer", "polygonCleanup"]); + const presignedTransfer = presigned.find(tx => tx.phase === "destinationTransfer"); + if (!presignedTransfer) { + throw new Error("No presigned destinationTransfer"); + } + expect(presignedTransfer.signer).toBe(ephemeralAddress); + const parsed = parseTransaction(presignedTransfer.txData as `0x${string}`); + expect(parsed.chainId).toBe(137); + expect(parsed.to?.toLowerCase()).toBe(ALFREDPAY_ERC20_TOKEN.toLowerCase()); + if (!parsed.data) { + throw new Error("Presigned destinationTransfer has no calldata"); + } + const decoded = decodeFunctionData({ abi: erc20Abi, data: parsed.data }); + expect(decoded.functionName).toBe("transfer"); + const amountRaw = parseUnits(quote.outputAmount, ALFREDPAY_ERC20_DECIMALS); + expect(decoded.args).toEqual([destination, amountRaw]); + + // Registration created exactly one anchor order: MXN in, USDT minted to + // the ephemeral. + expect(world.alfredpay.onrampOrders).toHaveLength(1); + const order = world.alfredpay.onrampOrders[0]; + expect(order.fromCurrency).toBe("MXN" as never); + expect(order.toCurrency).toBe("USDT" as never); + expect(Number(order.amount)).toBe(2000); + expect(order.depositAddress.toLowerCase()).toBe(ephemeralAddress.toLowerCase()); + + const persistedQuote = await QuoteTicket.findByPk(quote.id); + const mintAmountRaw = BigInt(persistedQuote?.metadata.alfredpayMint?.outputAmountRaw ?? "0"); + expect(mintAmountRaw).toBeGreaterThan(0n); + + scriptHappyWorld(ephemeralAddress, mintAmountRaw); + const started = await sdk.startRamp(rampProcess.id); + expect(started.id).toBe(rampProcess.id); + expect(started.quoteId).toBe(quote.id); + + const status = await waitForComplete(sdk, rampProcess.id); + expect(status.id).toBe(rampProcess.id); + expect(status.quoteId).toBe(quote.id); + expect(status.type).toBe(RampDirection.BUY); + expect(status.from).toBe(EPaymentMethod.SPEI); + expect(status.to).toBe(Networks.Polygon); + expect(Number(status.inputAmount)).toBe(Number(quote.inputAmount)); + expect(Number(status.outputAmount)).toBe(Number(quote.outputAmount)); + + // End to end, the destination received the quoted amount in the fake ledger. + expect(world.evm.erc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, destination)).toBe(amountRaw); + }, + 30000 + ); + + for (const currency of CURRENCY_CASES) { + it( + `${currency.fiat} (${currency.rail}): createQuote and registerRamp return the SDK-visible shapes for the rail`, + async () => { + world.alfredpay.onrampRate = currency.onrampRate; + const { sdk } = await createUserSdk(currency.country); + const destination = privateKeyToAccount(generatePrivateKey()).address; + const ordersBefore = world.alfredpay.onrampOrders.length; + + // Quote contract: the rail and currency mapping the SDK promises. + const quote = await sdk.createQuote(quoteRequest(currency.fiat, currency.rail, currency.inputAmount)); + expect(quote.id).toMatch(UUID_PATTERN); + expect(quote.rampType).toBe(RampDirection.BUY); + expect(quote.from).toBe(currency.rail); + expect(quote.to).toBe(Networks.Polygon); + expect(quote.network).toBe(Networks.Polygon); + expect(quote.inputCurrency).toBe(currency.fiat); + expect(Number(quote.inputAmount)).toBe(Number(currency.inputAmount)); + expect(quote.outputCurrency).toBe(EvmToken.USDT); + expect(Number(quote.outputAmount)).toBeGreaterThan(0); + expect(new Date(quote.expiresAt).getTime()).toBeGreaterThan(Date.now()); + expect(Number.isFinite(Number(quote.totalFeeFiat))).toBe(true); + expect(Number.isFinite(Number(quote.totalFeeUsd))).toBe(true); + expect(quote.feeCurrency).toBeTruthy(); + + // Register contract: no user transactions, the payment instructions + // for the client, the ephemeral's destinationTransfer, and an anchor + // order in this currency's Alfredpay code. + const { rampProcess, unsignedTransactions } = await sdk.registerRamp(quote, { destinationAddress: destination }); + expect(unsignedTransactions).toEqual([]); + expect(rampProcess.id).toMatch(UUID_PATTERN); + expect(rampProcess.quoteId).toBe(quote.id); + expect(rampProcess.type).toBe(RampDirection.BUY); + expect(rampProcess.currentPhase).toBe("initial"); + expect(rampProcess.achPaymentData?.paymentType).toBeTruthy(); + const unsigned = rampProcess.unsignedTxs ?? []; + expect(unsigned.map(tx => tx.phase).sort()).toEqual(["destinationTransfer", "polygonCleanup"]); + expect(unsigned.every(tx => tx.network === Networks.Polygon)).toBe(true); + + expect(world.alfredpay.onrampOrders).toHaveLength(ordersBefore + 1); + const order = world.alfredpay.onrampOrders[world.alfredpay.onrampOrders.length - 1]; + expect(order.fromCurrency).toBe(currency.alfredpayCurrency as never); + expect(order.toCurrency).toBe("USDT" as never); + expect(Number(order.amount)).toBe(Number(currency.inputAmount)); + }, + 30000 + ); + } +}); diff --git a/docs/testing-strategy.md b/docs/testing-strategy.md index a9c985e95..622aea475 100644 --- a/docs/testing-strategy.md +++ b/docs/testing-strategy.md @@ -20,7 +20,7 @@ together with the shared test harness (`apps/api/src/test-utils`) — see "How t | 1. Unit | Pure logic: helpers, token configs, SDK handlers | each package, next to source | `bun test` (Vitest for frontend) | | 2. API integration | Real Express + real Postgres + fake external world, driven over HTTP; incl. the quote pricing goldens (`quote-pricing.golden.test.ts`) and the HTTP surface tests (auth OTP flow, webhooks, ramp history, public routes; `http-surface.invariants.test.ts`) | `apps/api/src/tests/` | `bun test` | | 3. Corridor scenarios | Phase processor end-to-end per corridor against the fake world: BRL onramp (pix→BRLA-on-Base), BRL offramp (USDC-on-Base→pix incl. real Nabla swap + both EVM subsidy phases), CROSS-CHAIN BRL offramp (USDC-on-Polygon→squid→Base→pix incl. user-reported squid-hash verification), MXN on/offramp (spei↔USDT-on-Polygon), CROSS-CHAIN MXN onramp (spei→Polygon mint→squid→USDT-on-Arbitrum incl. real squidRouterSwap/Pay + Arbitrum settlement subsidy), and a USD/COP/ARS matrix over the same Alfredpay rails (happy paths + per-currency limit breaches + per-currency transient AND unrecoverable failures) | `apps/api/src/tests/corridors/` | `bun test` | -| 4. SDK contract | Real SDK against the real API in-process: BRL onramp lifecycle (`sdk-contract.test.ts`), the SELL/user-transaction surface — offramp lifecycle via submitUserTransactions, updateRamp, getQuote, listAlfredpayFiatAccounts (`sdk-contract.offramp.test.ts`) — and the Alfredpay SELL rail: full USD/ach offramp lifecycle plus quote/register shape checks for COP and ARS (`sdk-contract.alfredpay-offramp.test.ts`) | `apps/api/src/tests/sdk-contract*.test.ts` | `bun test` | +| 4. SDK contract | Real SDK against the real API in-process: BRL onramp lifecycle (`sdk-contract.test.ts`), the SELL/user-transaction surface — offramp lifecycle via submitUserTransactions, updateRamp, getQuote, listAlfredpayFiatAccounts (`sdk-contract.offramp.test.ts`) — and the Alfredpay SELL rail: full USD/ach offramp lifecycle plus quote/register shape checks for COP and ARS (`sdk-contract.alfredpay-offramp.test.ts`) — and the Alfredpay BUY rail: full MXN/spei onramp lifecycle plus quote/register shape checks for USD, COP and ARS (`sdk-contract.alfredpay-onramp.test.ts`) | `apps/api/src/tests/sdk-contract*.test.ts` | `bun test` | | 5. Frontend | XState machine tests, actor tests (register/sign/start/KYC-routing against MSW with mocked wallet seams), component tests (RTL + MSW + mock wagmi) | `apps/frontend/src` | Vitest | | 6. E2E | Few critical Playwright journeys with a mock wallet | `apps/frontend/e2e/` | Playwright (non-blocking) | @@ -64,13 +64,13 @@ Legend: ✅ directly tested · ◐ covered only via shared code/another corridor |---|---|---|---|---|---|---|---|---| | BRL (Avenia / Pix) | BUY | ✅ | ✅ | ✅ | ✅ recipient | ◐¹ | ✅ | ✅ | | BRL (Avenia / Pix) | SELL | ✅ | ✅ | ✅ | ✅ pre/post-swap caps, recipient | ✅ F-021 | ✅ | ✅ | -| MXN (Alfredpay / SPEI) | BUY | ✅ | ✅ | ✅ | ✅ recipient | ✅ settlement subsidy | ❌ | ✅ | +| MXN (Alfredpay / SPEI) | BUY | ✅ | ✅ | ✅ | ✅ recipient | ✅ settlement subsidy | ✅ | ✅ | | MXN (Alfredpay / SPEI) | SELL | ✅ | ✅ | ✅ | ✅ calldata, F-001 cap | ◐² | ◐³ | ◐⁴ | -| USD (Alfredpay / ACH) | BUY | ✅ | ✅ | ✅ | ✅ + limit breach | ◐¹ | ❌ | ◐⁴ | +| USD (Alfredpay / ACH) | BUY | ✅ | ✅ | ✅ | ✅ + limit breach | ◐¹ | ◐⁷ | ◐⁴ | | USD (Alfredpay / ACH) | SELL | ✅ | ✅ | ✅ | ✅ + limit breach | ◐² | ✅ | ✅⁵ | -| COP (Alfredpay / ACH) | BUY | ✅ | ✅ | ✅ | ✅ + limit breach | ◐¹ | ❌ | ◐⁴ | +| COP (Alfredpay / ACH) | BUY | ✅ | ✅ | ✅ | ✅ + limit breach | ◐¹ | ◐⁷ | ◐⁴ | | COP (Alfredpay / ACH) | SELL | ✅ | ✅ | ✅ | ✅ + limit breach | ◐² | ◐⁶ | ◐⁴ | -| ARS (Alfredpay / CBU) | BUY | ✅ | ✅ | ✅ | ✅ + limit breach | ◐¹ | ❌ | ◐⁴ | +| ARS (Alfredpay / CBU) | BUY | ✅ | ✅ | ✅ | ✅ + limit breach | ◐¹ | ◐⁷ | ◐⁴ | | ARS (Alfredpay / CBU) | SELL | ✅ | ✅ | ✅ | ✅ + limit breach | ◐² | ◐⁶ | ◐⁴ | | EUR (Mykobo / SEPA) | both | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | | AssetHub (BRL BUY → USDC; USDC SELL → Pix) | both | ❌ deferred | ❌ | ❌ | ❌ | — | ❌ | ❌ | @@ -79,17 +79,20 @@ Legend: ✅ directly tested · ◐ covered only via shared code/another corridor cross-chain onramp scenario; the handlers are shared, but no per-corridor variant exists. ² Offramp squid leg (user-reported squid-hash verification) exercised only by the BRL cross-chain offramp scenario; handlers shared. -³ The Alfredpay SELL rail's SDK lifecycle runs as USD; MXN itself is never driven through -the SDK. +³ The Alfredpay SELL rail's SDK lifecycle runs as USD; MXN SELL has no SDK-driven test +(MXN BUY does — see the SDK column of the BUY row). ⁴ The Alfredpay BUY UI flow is exercised by the MXN onramp journey and the SELL flow by the USD offramp journey; no per-currency journey exists. ⁵ The journey ends at the progress screen: the success screen is currently unreachable for Alfredpay offramps (frontend bug — `getRampFlow` returns null for SELL with non-BRL/EURC output; fix in progress). ⁶ Quote + register SDK shape checks only; no full lifecycle. +⁷ Quote + register SDK shape checks only; the Alfredpay BUY rail's full SDK lifecycle runs +as MXN. -**Gaps at a glance** (everything not ✅ above): no SDK coverage for any Alfredpay BUY; -MXN never driven through the SDK; COP/ARS SDK SELL is shape-checks only; Alfredpay E2E exists +**Gaps at a glance** (everything not ✅ above): the Alfredpay BUY SDK lifecycle runs only +as MXN (USD/COP/ARS BUY, like COP/ARS SELL, is SDK shape-checks only) and MXN SELL has no +SDK-driven test; Alfredpay E2E exists only as one BUY (MXN) and one SELL (USD) journey; per-corridor cross-chain variants lean on shared handlers; EUR is gated on the documented re-enablement precondition; the AssetHub corridors are reachable in production but deliberately deferred (see the decision note under From 41a20ea21a77111530f39d37185279e9ba8db3c7 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 17:19:28 +0200 Subject: [PATCH 161/176] Drive the MXN offramp through the SDK contract lifecycle --- .../sdk-contract.alfredpay-offramp.test.ts | 212 ++++++++++-------- docs/testing-strategy.md | 30 ++- 2 files changed, 138 insertions(+), 104 deletions(-) diff --git a/apps/api/src/tests/sdk-contract.alfredpay-offramp.test.ts b/apps/api/src/tests/sdk-contract.alfredpay-offramp.test.ts index e5d10b051..a78fdac73 100644 --- a/apps/api/src/tests/sdk-contract.alfredpay-offramp.test.ts +++ b/apps/api/src/tests/sdk-contract.alfredpay-offramp.test.ts @@ -40,7 +40,17 @@ interface CurrencyCase { offrampRate: number; } -// Rails per currency: USD and COP pay out over ach, ARS over cbu. +interface LifecycleCase extends CurrencyCase { + /** The user's payout account served by the fake anchor's listFiatAccounts. */ + fiatAccount: { + fiatAccountId: string; + type: AlfredpayFiatAccountType; + accountNumber: string; + accountType: string; + }; +} + +// Rails per currency: USD and COP pay out over ach, ARS over cbu, MXN over spei. const CURRENCY_CASES: CurrencyCase[] = [ { alfredpayCurrency: "USD", @@ -68,6 +78,35 @@ const CURRENCY_CASES: CurrencyCase[] = [ } ]; +// The full lifecycle runs once per Alfredpay SELL rail with its own SDK test: +// USD/ach and MXN/spei (100 USDT * 20 = 2000 MXN, the same legible flat rate +// the MXN corridor scenario uses). +const FULL_LIFECYCLE_CASES: LifecycleCase[] = [ + { + ...CURRENCY_CASES[0], // USD/ach + fiatAccount: { + accountNumber: "021000021000000", + accountType: "checking", + fiatAccountId: "fiat-account-usd-1", + type: AlfredpayFiatAccountType.ACH + } + }, + { + alfredpayCurrency: "MXN", + country: AlfredPayCountry.MX, + fiat: FiatToken.MXN, + fiatAccount: { + accountNumber: "002010077777777771", // CLABE + accountType: "clabe", + fiatAccountId: "fiat-account-mxn-1", + type: AlfredpayFiatAccountType.SPEI + }, + inputAmount: "100", + offrampRate: 20, + rail: EPaymentMethod.SPEI + } +]; + /** * Same shim as the other SDK contract tests: the SDK's viem wallet client * issues one eth_chainId RPC before signing locally. The Alfredpay SELL @@ -99,11 +138,12 @@ function installChainIdShim(): { restore: () => void } { /** * SDK ↔ API contract tests for the Alfredpay SELL rail (USDT on Polygon → - * USD/COP/ARS bank payouts): the real SDK lists the user's registered fiat - * accounts, registers the offramp on the no-permit path (fiatAccountId + + * USD/MXN/COP/ARS bank payouts): the real SDK lists the user's registered + * fiat accounts, registers the offramp on the no-permit path (fiatAccountId + * walletAddress), broadcasts the user's source-of-funds transfer via - * submitUserTransactions, and drives the ramp to completion — plus lighter - * createQuote/registerRamp shape checks for every currency's rail. + * submitUserTransactions, and drives the ramp to completion — the full + * lifecycle runs as both USD/ach and MXN/spei — plus lighter + * createQuote/registerRamp shape checks for the USD/COP/ARS rails. */ describe("SDK ↔ API contract (Alfredpay offramps, USDT on Polygon → bank payout)", () => { let world: FakeWorld; @@ -244,98 +284,94 @@ describe("SDK ↔ API contract (Alfredpay offramps, USDT on Polygon → bank pay } } - it( - "drives the full USD/ach lifecycle: createQuote → listAlfredpayFiatAccounts → registerRamp → submitUserTransactions → startRamp → complete", - async () => { - const currency = CURRENCY_CASES[0]; // USD/ach - world.alfredpay.offrampRate = currency.offrampRate; - const { customer, sdk, userId } = await createUserSdk(currency.country); + for (const currency of FULL_LIFECYCLE_CASES) { + it( + `drives the full ${currency.fiat}/${currency.rail} lifecycle: createQuote → listAlfredpayFiatAccounts → registerRamp → submitUserTransactions → startRamp → complete`, + async () => { + world.alfredpay.offrampRate = currency.offrampRate; + const { customer, sdk, userId } = await createUserSdk(currency.country); - // The frontend-SDK flow picks the payout destination from the user's - // fiat accounts registered with the anchor. - world.alfredpay.fiatAccountsByCustomer.set(customer.alfredPayId, [ - { - accountNumber: "021000021000000", - accountType: "checking", - customerId: customer.alfredPayId, - fiatAccountId: "fiat-account-usd-1", - type: AlfredpayFiatAccountType.ACH - } - ]); - const accounts = await sdk.listAlfredpayFiatAccounts(currency.country); - expect(accounts).toHaveLength(1); - expect(accounts[0].type).toBe(AlfredpayFiatAccountType.ACH); - const fiatAccountId = accounts[0].fiatAccountId; + // The frontend-SDK flow picks the payout destination from the user's + // fiat accounts registered with the anchor. + world.alfredpay.fiatAccountsByCustomer.set(customer.alfredPayId, [ + { ...currency.fiatAccount, customerId: customer.alfredPayId } + ]); + const accounts = await sdk.listAlfredpayFiatAccounts(currency.country); + expect(accounts).toHaveLength(1); + expect(accounts[0].type).toBe(currency.fiatAccount.type); + const fiatAccountId = accounts[0].fiatAccountId; + expect(fiatAccountId).toBe(currency.fiatAccount.fiatAccountId); - const wallet = privateKeyToAccount(generatePrivateKey()); - fundWallet(wallet.address, currency.inputAmount); + const wallet = privateKeyToAccount(generatePrivateKey()); + fundWallet(wallet.address, currency.inputAmount); - const quote = await sdk.createQuote(quoteRequest(currency)); - expect(quote.id).toMatch(UUID_PATTERN); - expect(quote.rampType).toBe(RampDirection.SELL); - expect(quote.to).toBe(currency.rail); - expect(Number(quote.outputAmount)).toBeGreaterThan(0); + const quote = await sdk.createQuote(quoteRequest(currency)); + expect(quote.id).toMatch(UUID_PATTERN); + expect(quote.rampType).toBe(RampDirection.SELL); + expect(quote.to).toBe(currency.rail); + expect(Number(quote.outputAmount)).toBeGreaterThan(0); - // registerRamp SELL contract on the no-permit path: exactly one - // user-wallet transaction comes back — the plain USDT transfer to the - // ephemeral — classified as a broadcastable EVM tx. - const { rampProcess, unsignedTransactions } = await sdk.registerRamp(quote, { - fiatAccountId, - walletAddress: wallet.address - }); - expect(rampProcess.id).toMatch(UUID_PATTERN); - expect(rampProcess.type).toBe(RampDirection.SELL); - expect(rampProcess.currentPhase).toBe("initial"); - expect(unsignedTransactions).toHaveLength(1); - const userTx = unsignedTransactions[0]; - expect(userTx.phase).toBe("squidRouterNoPermitTransfer"); - expect(userTx.network).toBe(Networks.Polygon); - expect(userTx.signer.toLowerCase()).toBe(wallet.address.toLowerCase()); - expect(sdk.getUserTransactionType(userTx)).toBe("evm-transaction"); - const broadcastable = sdk.getTransactionToBroadcast(userTx); - expect(broadcastable.to.toLowerCase()).toBe(ALFREDPAY_ERC20_TOKEN.toLowerCase()); - expect(broadcastable.data).toBeTruthy(); + // registerRamp SELL contract on the no-permit path: exactly one + // user-wallet transaction comes back — the plain USDT transfer to the + // ephemeral — classified as a broadcastable EVM tx. + const { rampProcess, unsignedTransactions } = await sdk.registerRamp(quote, { + fiatAccountId, + walletAddress: wallet.address + }); + expect(rampProcess.id).toMatch(UUID_PATTERN); + expect(rampProcess.type).toBe(RampDirection.SELL); + expect(rampProcess.currentPhase).toBe("initial"); + expect(unsignedTransactions).toHaveLength(1); + const userTx = unsignedTransactions[0]; + expect(userTx.phase).toBe("squidRouterNoPermitTransfer"); + expect(userTx.network).toBe(Networks.Polygon); + expect(userTx.signer.toLowerCase()).toBe(wallet.address.toLowerCase()); + expect(sdk.getUserTransactionType(userTx)).toBe("evm-transaction"); + const broadcastable = sdk.getTransactionToBroadcast(userTx); + expect(broadcastable.to.toLowerCase()).toBe(ALFREDPAY_ERC20_TOKEN.toLowerCase()); + expect(broadcastable.data).toBeTruthy(); - // The SDK already signed and stored the ephemeral's Polygon-side txs; - // registration created the anchor order on the no-permit path. - const stored = await RampState.findByPk(rampProcess.id); - expect(stored?.userId).toBe(userId); - expect(stored?.state.alfredpayTransactionId).toBeTruthy(); - expect(stored?.state.isNoPermitFallback).toBe(true); - const presignedPhases = (stored?.presignedTxs ?? []).map(tx => tx.phase); - expect(presignedPhases).toContain("alfredpayOfframpTransfer"); - // The user-wallet transfer must never be presigned by the ephemeral. - expect(presignedPhases).not.toContain("squidRouterNoPermitTransfer"); + // The SDK already signed and stored the ephemeral's Polygon-side txs; + // registration created the anchor order on the no-permit path. + const stored = await RampState.findByPk(rampProcess.id); + expect(stored?.userId).toBe(userId); + expect(stored?.state.alfredpayTransactionId).toBeTruthy(); + expect(stored?.state.isNoPermitFallback).toBe(true); + const presignedPhases = (stored?.presignedTxs ?? []).map(tx => tx.phase); + expect(presignedPhases).toContain("alfredpayOfframpTransfer"); + // The user-wallet transfer must never be presigned by the ephemeral. + expect(presignedPhases).not.toContain("squidRouterNoPermitTransfer"); - // submitUserTransactions broadcasts through the caller's wallet handler - // and reports the hash to the API. - const afterSubmit = await sdk.submitUserTransactions(rampProcess.id, unsignedTransactions, { - sendTransaction: sendFromWallet(wallet.address) - }); - expect(afterSubmit.id).toBe(rampProcess.id); - const withHash = await RampState.findByPk(rampProcess.id); - expect(withHash?.state.squidRouterNoPermitTransferHash).toBeTruthy(); + // submitUserTransactions broadcasts through the caller's wallet handler + // and reports the hash to the API. + const afterSubmit = await sdk.submitUserTransactions(rampProcess.id, unsignedTransactions, { + sendTransaction: sendFromWallet(wallet.address) + }); + expect(afterSubmit.id).toBe(rampProcess.id); + const withHash = await RampState.findByPk(rampProcess.id); + expect(withHash?.state.squidRouterNoPermitTransferHash).toBeTruthy(); - const { inputAmountRaw } = await scriptHappyWorld(rampProcess.id, quote.id); - const depositAddress = world.alfredpay.offrampDepositAddress; - const started = await sdk.startRamp(rampProcess.id); - expect(started.id).toBe(rampProcess.id); + const { inputAmountRaw } = await scriptHappyWorld(rampProcess.id, quote.id); + const depositAddress = world.alfredpay.offrampDepositAddress; + const started = await sdk.startRamp(rampProcess.id); + expect(started.id).toBe(rampProcess.id); - const status = await waitForComplete(sdk, rampProcess.id); - expect(status.type).toBe(RampDirection.SELL); - expect(Number(status.inputAmount)).toBe(Number(quote.inputAmount)); - expect(Number(status.outputAmount)).toBe(Number(quote.outputAmount)); + const status = await waitForComplete(sdk, rampProcess.id); + expect(status.type).toBe(RampDirection.SELL); + expect(Number(status.inputAmount)).toBe(Number(quote.inputAmount)); + expect(Number(status.outputAmount)).toBe(Number(quote.outputAmount)); - // End to end, the anchor's deposit address received the full USDT and - // the order maps USDT → this currency against the chosen fiat account. - expect(world.evm.erc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, depositAddress)).toBe(inputAmountRaw); - const order = world.alfredpay.offrampOrders[world.alfredpay.offrampOrders.length - 1]; - expect(order.fromCurrency).toBe("USDT" as never); - expect(order.toCurrency).toBe(currency.alfredpayCurrency as never); - expect(order.fiatAccountId).toBe(fiatAccountId); - }, - 30000 - ); + // End to end, the anchor's deposit address received the full USDT and + // the order maps USDT → this currency against the chosen fiat account. + expect(world.evm.erc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, depositAddress)).toBe(inputAmountRaw); + const order = world.alfredpay.offrampOrders[world.alfredpay.offrampOrders.length - 1]; + expect(order.fromCurrency).toBe("USDT" as never); + expect(order.toCurrency).toBe(currency.alfredpayCurrency as never); + expect(order.fiatAccountId).toBe(fiatAccountId); + }, + 30000 + ); + } for (const currency of CURRENCY_CASES) { it( diff --git a/docs/testing-strategy.md b/docs/testing-strategy.md index 622aea475..301d8555d 100644 --- a/docs/testing-strategy.md +++ b/docs/testing-strategy.md @@ -20,7 +20,7 @@ together with the shared test harness (`apps/api/src/test-utils`) — see "How t | 1. Unit | Pure logic: helpers, token configs, SDK handlers | each package, next to source | `bun test` (Vitest for frontend) | | 2. API integration | Real Express + real Postgres + fake external world, driven over HTTP; incl. the quote pricing goldens (`quote-pricing.golden.test.ts`) and the HTTP surface tests (auth OTP flow, webhooks, ramp history, public routes; `http-surface.invariants.test.ts`) | `apps/api/src/tests/` | `bun test` | | 3. Corridor scenarios | Phase processor end-to-end per corridor against the fake world: BRL onramp (pix→BRLA-on-Base), BRL offramp (USDC-on-Base→pix incl. real Nabla swap + both EVM subsidy phases), CROSS-CHAIN BRL offramp (USDC-on-Polygon→squid→Base→pix incl. user-reported squid-hash verification), MXN on/offramp (spei↔USDT-on-Polygon), CROSS-CHAIN MXN onramp (spei→Polygon mint→squid→USDT-on-Arbitrum incl. real squidRouterSwap/Pay + Arbitrum settlement subsidy), and a USD/COP/ARS matrix over the same Alfredpay rails (happy paths + per-currency limit breaches + per-currency transient AND unrecoverable failures) | `apps/api/src/tests/corridors/` | `bun test` | -| 4. SDK contract | Real SDK against the real API in-process: BRL onramp lifecycle (`sdk-contract.test.ts`), the SELL/user-transaction surface — offramp lifecycle via submitUserTransactions, updateRamp, getQuote, listAlfredpayFiatAccounts (`sdk-contract.offramp.test.ts`) — and the Alfredpay SELL rail: full USD/ach offramp lifecycle plus quote/register shape checks for COP and ARS (`sdk-contract.alfredpay-offramp.test.ts`) — and the Alfredpay BUY rail: full MXN/spei onramp lifecycle plus quote/register shape checks for USD, COP and ARS (`sdk-contract.alfredpay-onramp.test.ts`) | `apps/api/src/tests/sdk-contract*.test.ts` | `bun test` | +| 4. SDK contract | Real SDK against the real API in-process: BRL onramp lifecycle (`sdk-contract.test.ts`), the SELL/user-transaction surface — offramp lifecycle via submitUserTransactions, updateRamp, getQuote, listAlfredpayFiatAccounts (`sdk-contract.offramp.test.ts`) — and the Alfredpay SELL rail: full USD/ach and MXN/spei offramp lifecycles plus quote/register shape checks for COP and ARS (`sdk-contract.alfredpay-offramp.test.ts`) — and the Alfredpay BUY rail: full MXN/spei onramp lifecycle plus quote/register shape checks for USD, COP and ARS (`sdk-contract.alfredpay-onramp.test.ts`) | `apps/api/src/tests/sdk-contract*.test.ts` | `bun test` | | 5. Frontend | XState machine tests, actor tests (register/sign/start/KYC-routing against MSW with mocked wallet seams), component tests (RTL + MSW + mock wagmi) | `apps/frontend/src` | Vitest | | 6. E2E | Few critical Playwright journeys with a mock wallet | `apps/frontend/e2e/` | Playwright (non-blocking) | @@ -65,13 +65,13 @@ Legend: ✅ directly tested · ◐ covered only via shared code/another corridor | BRL (Avenia / Pix) | BUY | ✅ | ✅ | ✅ | ✅ recipient | ◐¹ | ✅ | ✅ | | BRL (Avenia / Pix) | SELL | ✅ | ✅ | ✅ | ✅ pre/post-swap caps, recipient | ✅ F-021 | ✅ | ✅ | | MXN (Alfredpay / SPEI) | BUY | ✅ | ✅ | ✅ | ✅ recipient | ✅ settlement subsidy | ✅ | ✅ | -| MXN (Alfredpay / SPEI) | SELL | ✅ | ✅ | ✅ | ✅ calldata, F-001 cap | ◐² | ◐³ | ◐⁴ | -| USD (Alfredpay / ACH) | BUY | ✅ | ✅ | ✅ | ✅ + limit breach | ◐¹ | ◐⁷ | ◐⁴ | -| USD (Alfredpay / ACH) | SELL | ✅ | ✅ | ✅ | ✅ + limit breach | ◐² | ✅ | ✅⁵ | -| COP (Alfredpay / ACH) | BUY | ✅ | ✅ | ✅ | ✅ + limit breach | ◐¹ | ◐⁷ | ◐⁴ | -| COP (Alfredpay / ACH) | SELL | ✅ | ✅ | ✅ | ✅ + limit breach | ◐² | ◐⁶ | ◐⁴ | -| ARS (Alfredpay / CBU) | BUY | ✅ | ✅ | ✅ | ✅ + limit breach | ◐¹ | ◐⁷ | ◐⁴ | -| ARS (Alfredpay / CBU) | SELL | ✅ | ✅ | ✅ | ✅ + limit breach | ◐² | ◐⁶ | ◐⁴ | +| MXN (Alfredpay / SPEI) | SELL | ✅ | ✅ | ✅ | ✅ calldata, F-001 cap | ◐² | ✅ | ◐³ | +| USD (Alfredpay / ACH) | BUY | ✅ | ✅ | ✅ | ✅ + limit breach | ◐¹ | ◐⁶ | ◐³ | +| USD (Alfredpay / ACH) | SELL | ✅ | ✅ | ✅ | ✅ + limit breach | ◐² | ✅ | ✅⁴ | +| COP (Alfredpay / ACH) | BUY | ✅ | ✅ | ✅ | ✅ + limit breach | ◐¹ | ◐⁶ | ◐³ | +| COP (Alfredpay / ACH) | SELL | ✅ | ✅ | ✅ | ✅ + limit breach | ◐² | ◐⁵ | ◐³ | +| ARS (Alfredpay / CBU) | BUY | ✅ | ✅ | ✅ | ✅ + limit breach | ◐¹ | ◐⁶ | ◐³ | +| ARS (Alfredpay / CBU) | SELL | ✅ | ✅ | ✅ | ✅ + limit breach | ◐² | ◐⁵ | ◐³ | | EUR (Mykobo / SEPA) | both | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | | AssetHub (BRL BUY → USDC; USDC SELL → Pix) | both | ❌ deferred | ❌ | ❌ | ❌ | — | ❌ | ❌ | @@ -79,20 +79,18 @@ Legend: ✅ directly tested · ◐ covered only via shared code/another corridor cross-chain onramp scenario; the handlers are shared, but no per-corridor variant exists. ² Offramp squid leg (user-reported squid-hash verification) exercised only by the BRL cross-chain offramp scenario; handlers shared. -³ The Alfredpay SELL rail's SDK lifecycle runs as USD; MXN SELL has no SDK-driven test -(MXN BUY does — see the SDK column of the BUY row). -⁴ The Alfredpay BUY UI flow is exercised by the MXN onramp journey and the SELL flow by the +³ The Alfredpay BUY UI flow is exercised by the MXN onramp journey and the SELL flow by the USD offramp journey; no per-currency journey exists. -⁵ The journey ends at the progress screen: the success screen is currently unreachable for +⁴ The journey ends at the progress screen: the success screen is currently unreachable for Alfredpay offramps (frontend bug — `getRampFlow` returns null for SELL with non-BRL/EURC output; fix in progress). -⁶ Quote + register SDK shape checks only; no full lifecycle. -⁷ Quote + register SDK shape checks only; the Alfredpay BUY rail's full SDK lifecycle runs +⁵ Quote + register SDK shape checks only; no full lifecycle. +⁶ Quote + register SDK shape checks only; the Alfredpay BUY rail's full SDK lifecycle runs as MXN. **Gaps at a glance** (everything not ✅ above): the Alfredpay BUY SDK lifecycle runs only -as MXN (USD/COP/ARS BUY, like COP/ARS SELL, is SDK shape-checks only) and MXN SELL has no -SDK-driven test; Alfredpay E2E exists +as MXN and the SELL lifecycles only as USD and MXN (USD/COP/ARS BUY, like COP/ARS SELL, is +SDK shape-checks only); Alfredpay E2E exists only as one BUY (MXN) and one SELL (USD) journey; per-corridor cross-chain variants lean on shared handlers; EUR is gated on the documented re-enablement precondition; the AssetHub corridors are reachable in production but deliberately deferred (see the decision note under From af56280a890f9f60157a5d434605a85f7970ca44 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 17:30:21 +0200 Subject: [PATCH 162/176] Run the full Alfredpay SDK lifecycle for every currency in both directions --- .../sdk-contract.alfredpay-offramp.test.ts | 129 ++++----- .../sdk-contract.alfredpay-onramp.test.ts | 259 ++++++++---------- docs/testing-strategy.md | 19 +- 3 files changed, 167 insertions(+), 240 deletions(-) diff --git a/apps/api/src/tests/sdk-contract.alfredpay-offramp.test.ts b/apps/api/src/tests/sdk-contract.alfredpay-offramp.test.ts index a78fdac73..021a38234 100644 --- a/apps/api/src/tests/sdk-contract.alfredpay-offramp.test.ts +++ b/apps/api/src/tests/sdk-contract.alfredpay-offramp.test.ts @@ -50,46 +50,27 @@ interface LifecycleCase extends CurrencyCase { }; } -// Rails per currency: USD and COP pay out over ach, ARS over cbu, MXN over spei. -const CURRENCY_CASES: CurrencyCase[] = [ +// The full lifecycle runs once per Alfredpay currency with its own SDK test. +// Rails per currency: USD and COP pay out over ach, ARS over cbu, MXN over +// spei (100 USDT * 20 = 2000 MXN, the same legible flat rate the MXN corridor +// scenario uses; the other rates mirror the FakePrices feeds). Each case +// seeds the payout-account shape the anchor serves for that country: US ACH +// bank accounts, MXN SPEI/CLABE, Colombian ACH accounts, Argentine +// COELSA/CBU. +const FULL_LIFECYCLE_CASES: LifecycleCase[] = [ { alfredpayCurrency: "USD", country: AlfredPayCountry.US, fiat: FiatToken.USD, - inputAmount: "5", - offrampRate: 1, - rail: EPaymentMethod.ACH - }, - { - alfredpayCurrency: "COP", - country: AlfredPayCountry.CO, - fiat: FiatToken.COP, - inputAmount: "100", - offrampRate: 4000, - rail: EPaymentMethod.ACH - }, - { - alfredpayCurrency: "ARS", - country: AlfredPayCountry.AR, - fiat: FiatToken.ARS, - inputAmount: "100", - offrampRate: 1000, - rail: EPaymentMethod.CBU - } -]; - -// The full lifecycle runs once per Alfredpay SELL rail with its own SDK test: -// USD/ach and MXN/spei (100 USDT * 20 = 2000 MXN, the same legible flat rate -// the MXN corridor scenario uses). -const FULL_LIFECYCLE_CASES: LifecycleCase[] = [ - { - ...CURRENCY_CASES[0], // USD/ach fiatAccount: { accountNumber: "021000021000000", accountType: "checking", fiatAccountId: "fiat-account-usd-1", type: AlfredpayFiatAccountType.ACH - } + }, + inputAmount: "5", + offrampRate: 1, + rail: EPaymentMethod.ACH }, { alfredpayCurrency: "MXN", @@ -104,6 +85,34 @@ const FULL_LIFECYCLE_CASES: LifecycleCase[] = [ inputAmount: "100", offrampRate: 20, rail: EPaymentMethod.SPEI + }, + { + alfredpayCurrency: "COP", + country: AlfredPayCountry.CO, + fiat: FiatToken.COP, + fiatAccount: { + accountNumber: "0110123456789", + accountType: "savings", + fiatAccountId: "fiat-account-cop-1", + type: AlfredpayFiatAccountType.ACH + }, + inputAmount: "100", + offrampRate: 4000, + rail: EPaymentMethod.ACH + }, + { + alfredpayCurrency: "ARS", + country: AlfredPayCountry.AR, + fiat: FiatToken.ARS, + fiatAccount: { + accountNumber: "2850590940090418135201", // CBU + accountType: "cbu", + fiatAccountId: "fiat-account-ars-1", + type: AlfredpayFiatAccountType.COELSA + }, + inputAmount: "100", + offrampRate: 1000, + rail: EPaymentMethod.CBU } ]; @@ -142,8 +151,7 @@ function installChainIdShim(): { restore: () => void } { * fiat accounts, registers the offramp on the no-permit path (fiatAccountId + * walletAddress), broadcasts the user's source-of-funds transfer via * submitUserTransactions, and drives the ramp to completion — the full - * lifecycle runs as both USD/ach and MXN/spei — plus lighter - * createQuote/registerRamp shape checks for the USD/COP/ARS rails. + * lifecycle runs once per currency: USD/ach, MXN/spei, COP/ach and ARS/cbu. */ describe("SDK ↔ API contract (Alfredpay offramps, USDT on Polygon → bank payout)", () => { let world: FakeWorld; @@ -305,11 +313,18 @@ describe("SDK ↔ API contract (Alfredpay offramps, USDT on Polygon → bank pay const wallet = privateKeyToAccount(generatePrivateKey()); fundWallet(wallet.address, currency.inputAmount); + // Quote contract: the rail and currency mapping the SDK promises. const quote = await sdk.createQuote(quoteRequest(currency)); expect(quote.id).toMatch(UUID_PATTERN); expect(quote.rampType).toBe(RampDirection.SELL); + expect(quote.from).toBe(Networks.Polygon); expect(quote.to).toBe(currency.rail); + expect(quote.network).toBe(Networks.Polygon); + expect(quote.inputCurrency).toBe(EvmToken.USDT); + expect(Number(quote.inputAmount)).toBe(Number(currency.inputAmount)); + expect(quote.outputCurrency).toBe(currency.fiat); expect(Number(quote.outputAmount)).toBeGreaterThan(0); + expect(new Date(quote.expiresAt).getTime()).toBeGreaterThan(Date.now()); // registerRamp SELL contract on the no-permit path: exactly one // user-wallet transaction comes back — the plain USDT transfer to the @@ -319,6 +334,7 @@ describe("SDK ↔ API contract (Alfredpay offramps, USDT on Polygon → bank pay walletAddress: wallet.address }); expect(rampProcess.id).toMatch(UUID_PATTERN); + expect(rampProcess.quoteId).toBe(quote.id); expect(rampProcess.type).toBe(RampDirection.SELL); expect(rampProcess.currentPhase).toBe("initial"); expect(unsignedTransactions).toHaveLength(1); @@ -372,51 +388,4 @@ describe("SDK ↔ API contract (Alfredpay offramps, USDT on Polygon → bank pay 30000 ); } - - for (const currency of CURRENCY_CASES) { - it( - `${currency.fiat} (${currency.rail}): createQuote and registerRamp return the SDK-visible shapes for the rail`, - async () => { - world.alfredpay.offrampRate = currency.offrampRate; - const { sdk } = await createUserSdk(currency.country); - const wallet = privateKeyToAccount(generatePrivateKey()); - fundWallet(wallet.address, currency.inputAmount); - - // Quote contract: the rail and currency mapping the SDK promises. - const quote = await sdk.createQuote(quoteRequest(currency)); - expect(quote.id).toMatch(UUID_PATTERN); - expect(quote.rampType).toBe(RampDirection.SELL); - expect(quote.from).toBe(Networks.Polygon); - expect(quote.to).toBe(currency.rail); - expect(quote.network).toBe(Networks.Polygon); - expect(quote.inputCurrency).toBe(EvmToken.USDT); - expect(Number(quote.inputAmount)).toBe(Number(currency.inputAmount)); - expect(quote.outputCurrency).toBe(currency.fiat); - expect(Number(quote.outputAmount)).toBeGreaterThan(0); - expect(new Date(quote.expiresAt).getTime()).toBeGreaterThan(Date.now()); - - // Register contract: the no-permit user transfer for the caller's - // wallet, and an anchor order in this currency's Alfredpay code. - const { rampProcess, unsignedTransactions } = await sdk.registerRamp(quote, { - fiatAccountId: `fiat-account-${currency.rail}-1`, - walletAddress: wallet.address - }); - expect(rampProcess.id).toMatch(UUID_PATTERN); - expect(rampProcess.quoteId).toBe(quote.id); - expect(rampProcess.type).toBe(RampDirection.SELL); - expect(rampProcess.currentPhase).toBe("initial"); - expect(unsignedTransactions).toHaveLength(1); - expect(unsignedTransactions[0].phase).toBe("squidRouterNoPermitTransfer"); - expect(unsignedTransactions[0].network).toBe(Networks.Polygon); - expect(unsignedTransactions[0].signer.toLowerCase()).toBe(wallet.address.toLowerCase()); - expect(sdk.getUserTransactionType(unsignedTransactions[0])).toBe("evm-transaction"); - - const order = world.alfredpay.offrampOrders[world.alfredpay.offrampOrders.length - 1]; - expect(order.fromCurrency).toBe("USDT" as never); - expect(order.toCurrency).toBe(currency.alfredpayCurrency as never); - expect(order.fiatAccountId).toBe(`fiat-account-${currency.rail}-1`); - }, - 30000 - ); - } }); diff --git a/apps/api/src/tests/sdk-contract.alfredpay-onramp.test.ts b/apps/api/src/tests/sdk-contract.alfredpay-onramp.test.ts index 7b585ed6b..f8f9cd680 100644 --- a/apps/api/src/tests/sdk-contract.alfredpay-onramp.test.ts +++ b/apps/api/src/tests/sdk-contract.alfredpay-onramp.test.ts @@ -24,9 +24,6 @@ import { startTestApp, type TestApp } from "../test-utils/test-app"; const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/; const POLYGON_CHAIN_ID_HEX = "0x89"; // 137 -// 2000 MXN * 0.05 = 100 USDT: the same legible flat rate the MXN corridor scenario uses. -const MXN_ONRAMP_RATE = 0.05; - interface CurrencyCase { fiat: FiatToken; /** Alfredpay-side currency code expected on created orders. */ @@ -41,8 +38,18 @@ interface CurrencyCase { onrampRate: number; } -// Rails per currency: USD and COP fund over ach, ARS over cbu (rates mirror the FakePrices feeds). -const CURRENCY_CASES: CurrencyCase[] = [ +// Rails per currency: MXN funds over spei, USD and COP over ach, ARS over cbu. +// The MXN rate is the same legible flat rate the MXN corridor scenario uses +// (2000 MXN * 0.05 = 100 USDT); the others mirror the FakePrices feeds. +const FULL_LIFECYCLE_CASES: CurrencyCase[] = [ + { + alfredpayCurrency: "MXN", + country: AlfredPayCountry.MX, + fiat: FiatToken.MXN, + inputAmount: "2000", + onrampRate: 0.05, + rail: EPaymentMethod.SPEI + }, { alfredpayCurrency: "USD", country: AlfredPayCountry.US, @@ -101,11 +108,11 @@ function installChainIdShim(): { restore: () => void } { /** * SDK ↔ API contract tests for the Alfredpay BUY rail (fiat → USDT on * Polygon): the real @vortexfi/sdk drives the real in-process API. The full - * lifecycle deliberately runs as MXN/spei — the one corridor no other SDK test - * exercises — with registerRamp's internal flow (ephemeral generation, - * /v1/ramp/register, signing the destinationTransfer + backups, and the - * /v1/ramp/update that creates the anchor order and returns the SPEI payment - * details). USD/COP/ARS get lighter createQuote/registerRamp shape checks. + * lifecycle runs once per currency (MXN/spei, USD/ach, COP/ach, ARS/cbu) with + * registerRamp's internal flow (ephemeral generation, /v1/ramp/register, + * signing the destinationTransfer + backups, and the /v1/ramp/update that + * creates the anchor order and returns the fiat payment details), then + * startRamp and getRampStatus polling to completion. */ describe("SDK ↔ API contract (Alfredpay onramps, fiat → USDT on Polygon)", () => { let world: FakeWorld; @@ -210,177 +217,133 @@ describe("SDK ↔ API contract (Alfredpay onramps, fiat → USDT on Polygon)", ( } } - it( - "drives the full MXN/spei lifecycle: createQuote → registerRamp → startRamp → getRampStatus", - async () => { - world.alfredpay.onrampRate = MXN_ONRAMP_RATE; - const { sdk, userId } = await createUserSdk(AlfredPayCountry.MX); - const destination = privateKeyToAccount(generatePrivateKey()).address; - - const quote = await sdk.createQuote(quoteRequest(FiatToken.MXN, EPaymentMethod.SPEI, "2000")); - - // Quote contract: the fields the SDK's QuoteResponse type promises to integrators. - expect(quote.id).toMatch(UUID_PATTERN); - expect(quote.rampType).toBe(RampDirection.BUY); - expect(quote.from).toBe(EPaymentMethod.SPEI); - expect(quote.to).toBe(Networks.Polygon); - expect(quote.network).toBe(Networks.Polygon); - expect(Number(quote.inputAmount)).toBe(2000); - expect(quote.inputCurrency).toBe(FiatToken.MXN); - expect(quote.outputCurrency).toBe(EvmToken.USDT); - expect(Number(quote.outputAmount)).toBeGreaterThan(0); - expect(new Date(quote.expiresAt).getTime()).toBeGreaterThan(Date.now()); - const feeFields = [ - quote.networkFeeFiat, - quote.anchorFeeFiat, - quote.vortexFeeFiat, - quote.partnerFeeFiat, - quote.totalFeeFiat, - quote.processingFeeFiat, - quote.networkFeeUsd, - quote.anchorFeeUsd, - quote.vortexFeeUsd, - quote.partnerFeeUsd, - quote.totalFeeUsd, - quote.processingFeeUsd - ]; - for (const fee of feeFields) { - expect(Number.isFinite(Number(fee))).toBe(true); - } - expect(quote.feeCurrency).toBeTruthy(); - - // registerRamp runs the SDK's full internal Alfredpay BUY flow: ephemeral - // generation (Substrate + EVM), /v1/ramp/register, signing the returned - // destinationTransfer (plus its backups), and the /v1/ramp/update that - // creates the anchor order — there is no separate user sign/update step. - const { rampProcess, unsignedTransactions } = await sdk.registerRamp(quote, { destinationAddress: destination }); - - // Alfredpay onramps settle fiat off-chain: no user-wallet transactions. - expect(unsignedTransactions).toEqual([]); - expect(rampProcess.id).toMatch(UUID_PATTERN); - expect(rampProcess.quoteId).toBe(quote.id); - expect(rampProcess.type).toBe(RampDirection.BUY); - expect(rampProcess.currentPhase).toBe("initial"); - expect(Number(rampProcess.inputAmount)).toBe(Number(quote.inputAmount)); - expect(Number(rampProcess.outputAmount)).toBe(Number(quote.outputAmount)); - - // The client-visible payment details: SPEI instructions with the CLABE - // the user must wire the MXN to. - expect(rampProcess.achPaymentData?.paymentType).toBe("SPEI"); - expect(rampProcess.achPaymentData?.clabe).toBeTruthy(); - - // The ephemeral surface of the direct Alfredpay BUY route: the - // destination transfer plus the Polygon dust cleanup. - const unsigned = rampProcess.unsignedTxs ?? []; - expect(unsigned.map(tx => tx.phase).sort()).toEqual(["destinationTransfer", "polygonCleanup"]); - expect(unsigned.every(tx => tx.network === Networks.Polygon)).toBe(true); - const destinationTransferTx = unsigned.find(tx => tx.phase === "destinationTransfer"); - if (!destinationTransferTx) { - throw new Error("No destinationTransfer in unsignedTxs"); - } - const ephemeralAddress = destinationTransferTx.signer; - - // The SDK-signed transfer stored by /v1/ramp/update must pay the - // registered destination exactly the quoted USDT on Polygon — the core - // signing contract between SDK and backend. - const stored = await RampState.findByPk(rampProcess.id); - expect(stored?.userId).toBe(userId); - expect(stored?.state.alfredpayTransactionId).toBeTruthy(); - const presigned = stored?.presignedTxs ?? []; - expect(presigned.map(tx => tx.phase).sort()).toEqual(["destinationTransfer", "polygonCleanup"]); - const presignedTransfer = presigned.find(tx => tx.phase === "destinationTransfer"); - if (!presignedTransfer) { - throw new Error("No presigned destinationTransfer"); - } - expect(presignedTransfer.signer).toBe(ephemeralAddress); - const parsed = parseTransaction(presignedTransfer.txData as `0x${string}`); - expect(parsed.chainId).toBe(137); - expect(parsed.to?.toLowerCase()).toBe(ALFREDPAY_ERC20_TOKEN.toLowerCase()); - if (!parsed.data) { - throw new Error("Presigned destinationTransfer has no calldata"); - } - const decoded = decodeFunctionData({ abi: erc20Abi, data: parsed.data }); - expect(decoded.functionName).toBe("transfer"); - const amountRaw = parseUnits(quote.outputAmount, ALFREDPAY_ERC20_DECIMALS); - expect(decoded.args).toEqual([destination, amountRaw]); - - // Registration created exactly one anchor order: MXN in, USDT minted to - // the ephemeral. - expect(world.alfredpay.onrampOrders).toHaveLength(1); - const order = world.alfredpay.onrampOrders[0]; - expect(order.fromCurrency).toBe("MXN" as never); - expect(order.toCurrency).toBe("USDT" as never); - expect(Number(order.amount)).toBe(2000); - expect(order.depositAddress.toLowerCase()).toBe(ephemeralAddress.toLowerCase()); - - const persistedQuote = await QuoteTicket.findByPk(quote.id); - const mintAmountRaw = BigInt(persistedQuote?.metadata.alfredpayMint?.outputAmountRaw ?? "0"); - expect(mintAmountRaw).toBeGreaterThan(0n); - - scriptHappyWorld(ephemeralAddress, mintAmountRaw); - const started = await sdk.startRamp(rampProcess.id); - expect(started.id).toBe(rampProcess.id); - expect(started.quoteId).toBe(quote.id); - - const status = await waitForComplete(sdk, rampProcess.id); - expect(status.id).toBe(rampProcess.id); - expect(status.quoteId).toBe(quote.id); - expect(status.type).toBe(RampDirection.BUY); - expect(status.from).toBe(EPaymentMethod.SPEI); - expect(status.to).toBe(Networks.Polygon); - expect(Number(status.inputAmount)).toBe(Number(quote.inputAmount)); - expect(Number(status.outputAmount)).toBe(Number(quote.outputAmount)); - - // End to end, the destination received the quoted amount in the fake ledger. - expect(world.evm.erc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, destination)).toBe(amountRaw); - }, - 30000 - ); - - for (const currency of CURRENCY_CASES) { + for (const currency of FULL_LIFECYCLE_CASES) { it( - `${currency.fiat} (${currency.rail}): createQuote and registerRamp return the SDK-visible shapes for the rail`, + `drives the full ${currency.fiat}/${currency.rail} lifecycle: createQuote → registerRamp → startRamp → getRampStatus`, async () => { world.alfredpay.onrampRate = currency.onrampRate; - const { sdk } = await createUserSdk(currency.country); + const { sdk, userId } = await createUserSdk(currency.country); const destination = privateKeyToAccount(generatePrivateKey()).address; const ordersBefore = world.alfredpay.onrampOrders.length; - // Quote contract: the rail and currency mapping the SDK promises. const quote = await sdk.createQuote(quoteRequest(currency.fiat, currency.rail, currency.inputAmount)); + + // Quote contract: the fields the SDK's QuoteResponse type promises to integrators. expect(quote.id).toMatch(UUID_PATTERN); expect(quote.rampType).toBe(RampDirection.BUY); expect(quote.from).toBe(currency.rail); expect(quote.to).toBe(Networks.Polygon); expect(quote.network).toBe(Networks.Polygon); - expect(quote.inputCurrency).toBe(currency.fiat); expect(Number(quote.inputAmount)).toBe(Number(currency.inputAmount)); + expect(quote.inputCurrency).toBe(currency.fiat); expect(quote.outputCurrency).toBe(EvmToken.USDT); expect(Number(quote.outputAmount)).toBeGreaterThan(0); expect(new Date(quote.expiresAt).getTime()).toBeGreaterThan(Date.now()); - expect(Number.isFinite(Number(quote.totalFeeFiat))).toBe(true); - expect(Number.isFinite(Number(quote.totalFeeUsd))).toBe(true); + const feeFields = [ + quote.networkFeeFiat, + quote.anchorFeeFiat, + quote.vortexFeeFiat, + quote.partnerFeeFiat, + quote.totalFeeFiat, + quote.processingFeeFiat, + quote.networkFeeUsd, + quote.anchorFeeUsd, + quote.vortexFeeUsd, + quote.partnerFeeUsd, + quote.totalFeeUsd, + quote.processingFeeUsd + ]; + for (const fee of feeFields) { + expect(Number.isFinite(Number(fee))).toBe(true); + } expect(quote.feeCurrency).toBeTruthy(); - // Register contract: no user transactions, the payment instructions - // for the client, the ephemeral's destinationTransfer, and an anchor - // order in this currency's Alfredpay code. + // registerRamp runs the SDK's full internal Alfredpay BUY flow: ephemeral + // generation (Substrate + EVM), /v1/ramp/register, signing the returned + // destinationTransfer (plus its backups), and the /v1/ramp/update that + // creates the anchor order — there is no separate user sign/update step. const { rampProcess, unsignedTransactions } = await sdk.registerRamp(quote, { destinationAddress: destination }); + + // Alfredpay onramps settle fiat off-chain: no user-wallet transactions. expect(unsignedTransactions).toEqual([]); expect(rampProcess.id).toMatch(UUID_PATTERN); expect(rampProcess.quoteId).toBe(quote.id); expect(rampProcess.type).toBe(RampDirection.BUY); expect(rampProcess.currentPhase).toBe("initial"); - expect(rampProcess.achPaymentData?.paymentType).toBeTruthy(); + expect(Number(rampProcess.inputAmount)).toBe(Number(quote.inputAmount)); + expect(Number(rampProcess.outputAmount)).toBe(Number(quote.outputAmount)); + + // The client-visible payment details. The fake anchor hands out the + // same SPEI-shaped instructions (CLABE + reference) for every + // currency; the contract under test is that registerRamp surfaces the + // anchor's fiatPaymentInstructions verbatim as achPaymentData. + expect(rampProcess.achPaymentData?.paymentType).toBe("SPEI"); + expect(rampProcess.achPaymentData?.clabe).toBeTruthy(); + + // The ephemeral surface of the direct Alfredpay BUY route: the + // destination transfer plus the Polygon dust cleanup. const unsigned = rampProcess.unsignedTxs ?? []; expect(unsigned.map(tx => tx.phase).sort()).toEqual(["destinationTransfer", "polygonCleanup"]); expect(unsigned.every(tx => tx.network === Networks.Polygon)).toBe(true); + const destinationTransferTx = unsigned.find(tx => tx.phase === "destinationTransfer"); + if (!destinationTransferTx) { + throw new Error("No destinationTransfer in unsignedTxs"); + } + const ephemeralAddress = destinationTransferTx.signer; + + // The SDK-signed transfer stored by /v1/ramp/update must pay the + // registered destination exactly the quoted USDT on Polygon — the core + // signing contract between SDK and backend. + const stored = await RampState.findByPk(rampProcess.id); + expect(stored?.userId).toBe(userId); + expect(stored?.state.alfredpayTransactionId).toBeTruthy(); + const presigned = stored?.presignedTxs ?? []; + expect(presigned.map(tx => tx.phase).sort()).toEqual(["destinationTransfer", "polygonCleanup"]); + const presignedTransfer = presigned.find(tx => tx.phase === "destinationTransfer"); + if (!presignedTransfer) { + throw new Error("No presigned destinationTransfer"); + } + expect(presignedTransfer.signer).toBe(ephemeralAddress); + const parsed = parseTransaction(presignedTransfer.txData as `0x${string}`); + expect(parsed.chainId).toBe(137); + expect(parsed.to?.toLowerCase()).toBe(ALFREDPAY_ERC20_TOKEN.toLowerCase()); + if (!parsed.data) { + throw new Error("Presigned destinationTransfer has no calldata"); + } + const decoded = decodeFunctionData({ abi: erc20Abi, data: parsed.data }); + expect(decoded.functionName).toBe("transfer"); + const amountRaw = parseUnits(quote.outputAmount, ALFREDPAY_ERC20_DECIMALS); + expect(decoded.args).toEqual([destination, amountRaw]); + // Registration created exactly one anchor order: this currency's + // Alfredpay code in, USDT minted to the ephemeral. expect(world.alfredpay.onrampOrders).toHaveLength(ordersBefore + 1); const order = world.alfredpay.onrampOrders[world.alfredpay.onrampOrders.length - 1]; expect(order.fromCurrency).toBe(currency.alfredpayCurrency as never); expect(order.toCurrency).toBe("USDT" as never); expect(Number(order.amount)).toBe(Number(currency.inputAmount)); + expect(order.depositAddress.toLowerCase()).toBe(ephemeralAddress.toLowerCase()); + + const persistedQuote = await QuoteTicket.findByPk(quote.id); + const mintAmountRaw = BigInt(persistedQuote?.metadata.alfredpayMint?.outputAmountRaw ?? "0"); + expect(mintAmountRaw).toBeGreaterThan(0n); + + scriptHappyWorld(ephemeralAddress, mintAmountRaw); + const started = await sdk.startRamp(rampProcess.id); + expect(started.id).toBe(rampProcess.id); + expect(started.quoteId).toBe(quote.id); + + const status = await waitForComplete(sdk, rampProcess.id); + expect(status.id).toBe(rampProcess.id); + expect(status.quoteId).toBe(quote.id); + expect(status.type).toBe(RampDirection.BUY); + expect(status.from).toBe(currency.rail); + expect(status.to).toBe(Networks.Polygon); + expect(Number(status.inputAmount)).toBe(Number(quote.inputAmount)); + expect(Number(status.outputAmount)).toBe(Number(quote.outputAmount)); + + // End to end, the destination received the quoted amount in the fake ledger. + expect(world.evm.erc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, destination)).toBe(amountRaw); }, 30000 ); diff --git a/docs/testing-strategy.md b/docs/testing-strategy.md index 301d8555d..b3fd5871d 100644 --- a/docs/testing-strategy.md +++ b/docs/testing-strategy.md @@ -20,7 +20,7 @@ together with the shared test harness (`apps/api/src/test-utils`) — see "How t | 1. Unit | Pure logic: helpers, token configs, SDK handlers | each package, next to source | `bun test` (Vitest for frontend) | | 2. API integration | Real Express + real Postgres + fake external world, driven over HTTP; incl. the quote pricing goldens (`quote-pricing.golden.test.ts`) and the HTTP surface tests (auth OTP flow, webhooks, ramp history, public routes; `http-surface.invariants.test.ts`) | `apps/api/src/tests/` | `bun test` | | 3. Corridor scenarios | Phase processor end-to-end per corridor against the fake world: BRL onramp (pix→BRLA-on-Base), BRL offramp (USDC-on-Base→pix incl. real Nabla swap + both EVM subsidy phases), CROSS-CHAIN BRL offramp (USDC-on-Polygon→squid→Base→pix incl. user-reported squid-hash verification), MXN on/offramp (spei↔USDT-on-Polygon), CROSS-CHAIN MXN onramp (spei→Polygon mint→squid→USDT-on-Arbitrum incl. real squidRouterSwap/Pay + Arbitrum settlement subsidy), and a USD/COP/ARS matrix over the same Alfredpay rails (happy paths + per-currency limit breaches + per-currency transient AND unrecoverable failures) | `apps/api/src/tests/corridors/` | `bun test` | -| 4. SDK contract | Real SDK against the real API in-process: BRL onramp lifecycle (`sdk-contract.test.ts`), the SELL/user-transaction surface — offramp lifecycle via submitUserTransactions, updateRamp, getQuote, listAlfredpayFiatAccounts (`sdk-contract.offramp.test.ts`) — and the Alfredpay SELL rail: full USD/ach and MXN/spei offramp lifecycles plus quote/register shape checks for COP and ARS (`sdk-contract.alfredpay-offramp.test.ts`) — and the Alfredpay BUY rail: full MXN/spei onramp lifecycle plus quote/register shape checks for USD, COP and ARS (`sdk-contract.alfredpay-onramp.test.ts`) | `apps/api/src/tests/sdk-contract*.test.ts` | `bun test` | +| 4. SDK contract | Real SDK against the real API in-process: BRL onramp lifecycle (`sdk-contract.test.ts`), the SELL/user-transaction surface — offramp lifecycle via submitUserTransactions, updateRamp, getQuote, listAlfredpayFiatAccounts (`sdk-contract.offramp.test.ts`) — and full per-currency lifecycles for all four Alfredpay currencies in both directions: SELL offramp lifecycles for USD/ach, MXN/spei, COP/ach and ARS/cbu (`sdk-contract.alfredpay-offramp.test.ts`) and BUY onramp lifecycles for MXN/spei, USD/ach, COP/ach and ARS/cbu (`sdk-contract.alfredpay-onramp.test.ts`) | `apps/api/src/tests/sdk-contract*.test.ts` | `bun test` | | 5. Frontend | XState machine tests, actor tests (register/sign/start/KYC-routing against MSW with mocked wallet seams), component tests (RTL + MSW + mock wagmi) | `apps/frontend/src` | Vitest | | 6. E2E | Few critical Playwright journeys with a mock wallet | `apps/frontend/e2e/` | Playwright (non-blocking) | @@ -66,12 +66,12 @@ Legend: ✅ directly tested · ◐ covered only via shared code/another corridor | BRL (Avenia / Pix) | SELL | ✅ | ✅ | ✅ | ✅ pre/post-swap caps, recipient | ✅ F-021 | ✅ | ✅ | | MXN (Alfredpay / SPEI) | BUY | ✅ | ✅ | ✅ | ✅ recipient | ✅ settlement subsidy | ✅ | ✅ | | MXN (Alfredpay / SPEI) | SELL | ✅ | ✅ | ✅ | ✅ calldata, F-001 cap | ◐² | ✅ | ◐³ | -| USD (Alfredpay / ACH) | BUY | ✅ | ✅ | ✅ | ✅ + limit breach | ◐¹ | ◐⁶ | ◐³ | +| USD (Alfredpay / ACH) | BUY | ✅ | ✅ | ✅ | ✅ + limit breach | ◐¹ | ✅ | ◐³ | | USD (Alfredpay / ACH) | SELL | ✅ | ✅ | ✅ | ✅ + limit breach | ◐² | ✅ | ✅⁴ | -| COP (Alfredpay / ACH) | BUY | ✅ | ✅ | ✅ | ✅ + limit breach | ◐¹ | ◐⁶ | ◐³ | -| COP (Alfredpay / ACH) | SELL | ✅ | ✅ | ✅ | ✅ + limit breach | ◐² | ◐⁵ | ◐³ | -| ARS (Alfredpay / CBU) | BUY | ✅ | ✅ | ✅ | ✅ + limit breach | ◐¹ | ◐⁶ | ◐³ | -| ARS (Alfredpay / CBU) | SELL | ✅ | ✅ | ✅ | ✅ + limit breach | ◐² | ◐⁵ | ◐³ | +| COP (Alfredpay / ACH) | BUY | ✅ | ✅ | ✅ | ✅ + limit breach | ◐¹ | ✅ | ◐³ | +| COP (Alfredpay / ACH) | SELL | ✅ | ✅ | ✅ | ✅ + limit breach | ◐² | ✅ | ◐³ | +| ARS (Alfredpay / CBU) | BUY | ✅ | ✅ | ✅ | ✅ + limit breach | ◐¹ | ✅ | ◐³ | +| ARS (Alfredpay / CBU) | SELL | ✅ | ✅ | ✅ | ✅ + limit breach | ◐² | ✅ | ◐³ | | EUR (Mykobo / SEPA) | both | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | | AssetHub (BRL BUY → USDC; USDC SELL → Pix) | both | ❌ deferred | ❌ | ❌ | ❌ | — | ❌ | ❌ | @@ -84,13 +84,8 @@ USD offramp journey; no per-currency journey exists. ⁴ The journey ends at the progress screen: the success screen is currently unreachable for Alfredpay offramps (frontend bug — `getRampFlow` returns null for SELL with non-BRL/EURC output; fix in progress). -⁵ Quote + register SDK shape checks only; no full lifecycle. -⁶ Quote + register SDK shape checks only; the Alfredpay BUY rail's full SDK lifecycle runs -as MXN. -**Gaps at a glance** (everything not ✅ above): the Alfredpay BUY SDK lifecycle runs only -as MXN and the SELL lifecycles only as USD and MXN (USD/COP/ARS BUY, like COP/ARS SELL, is -SDK shape-checks only); Alfredpay E2E exists +**Gaps at a glance** (everything not ✅ above): Alfredpay E2E exists only as one BUY (MXN) and one SELL (USD) journey; per-corridor cross-chain variants lean on shared handlers; EUR is gated on the documented re-enablement precondition; the AssetHub corridors are reachable in production but deliberately deferred (see the decision note under From 1a56cf95c5b6bcfe298e077182197341e016b35b Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 18:00:38 +0200 Subject: [PATCH 163/176] Add the missing COP arrival text on the sell success page ARRIVAL_TEXT_BY_TOKEN looked up pages.success.arrivalText.sell.COP, but en.json/pt.json had no COP entry. Since i18next returns the raw key (a truthy string) for missing keys, the || default fallback never fired and a COP SELL success page rendered the literal key. The parameterized Alfredpay offramp journeys now assert the arrival text for all four currencies instead of skipping COP. --- .../e2e/offramp-alfredpay-journeys.spec.ts | 285 ++++++++++++++++++ apps/frontend/e2e/support/mockBackend.ts | 12 +- apps/frontend/src/translations/en.json | 1 + apps/frontend/src/translations/pt.json | 1 + 4 files changed, 298 insertions(+), 1 deletion(-) create mode 100644 apps/frontend/e2e/offramp-alfredpay-journeys.spec.ts diff --git a/apps/frontend/e2e/offramp-alfredpay-journeys.spec.ts b/apps/frontend/e2e/offramp-alfredpay-journeys.spec.ts new file mode 100644 index 000000000..8e9f131e4 --- /dev/null +++ b/apps/frontend/e2e/offramp-alfredpay-journeys.spec.ts @@ -0,0 +1,285 @@ +import { expect, test } from "@playwright/test"; +import { buildQuoteResponse, buildRampProcess, E2E_RAMP_ID, mockBackend } from "./support/mockBackend"; +import { injectMockWallet, MOCK_WALLET_ADDRESS } from "./support/mockWallet"; + +const POLYGON_USDT = "0xc2132d05d31c914a87c6611c10748aeb04b58e8f"; +const MOCK_WALLET_TX_HASH = `0x${"cd".repeat(32)}`; + +// Critical journey 7: full SELL (offramp) journeys over the Alfredpay rail — the +// money-OUT counterpart to the BRL offramp. Unlike the Avenia path there is no CPF/Pix +// eligibility form: the payout destination is a fiat account registered with Alfredpay, +// selected on the payment summary, and its fiatAccountId travels in the registration's +// additionalData. The UI flow is identical for all four currencies (quote with USDT on +// Polygon -> email/OTP auth -> wallet-ownership details step -> Alfredpay KYC gate with +// an existing verified customer -> payment summary with the registered payout account -> +// ramp registration -> ephemeral presigning posted to /ramp/update -> USER WALLET +// broadcast of the squidRouterNoPermitTransfer with its hash reported in a second +// /ramp/update -> automatic /ramp/start -> progress -> success once polling reports +// COMPLETE), so the journey is parameterized per currency. What differs — and what each +// case pins down — is the KYC-gate country, the corridor's payout destination, and the +// registered fiat-account type (constants/fiatAccountMethods.ts): +// USD -> BANK_USA bank account (displayed as "WIRE") +// MXN -> SPEI account holding an 18-digit CLABE +// COP -> ACH account (Colombian accounts display as "ACH_COL", carry document metadata) +// ARS -> COELSA account holding a 22-digit CBU + +interface SellJourneyCase { + fiat: "USD" | "MXN" | "COP" | "ARS"; + /** Country the Alfredpay KYC gate and fiat-account listing must be queried for. */ + country: string; + /** The corridor's payout destination (mapFiatToDestination in shared). */ + to: string; + outputAmount: string; + /** The registered payout account served by GET /v1/alfredpay/fiatAccounts (AlfredpayFiatAccount). */ + fiatAccount: Record & { accountName: string; fiatAccountId: string }; + /** The success page's per-token arrival text (pages.success.arrivalText.sell in en.json). */ + arrivalText: string; +} + +function buildFiatAccount(fields: Record) { + return { + createdAt: new Date().toISOString(), + customerId: "alfred-customer-e2e-1", + ...fields + }; +} + +const CASES: SellJourneyCase[] = [ + { + arrivalText: "Your funds will arrive in your bank account in a few minutes.", + country: "US", + fiat: "USD", + // US accounts are stored as BANK_USA and displayed as "WIRE". + fiatAccount: buildFiatAccount({ + accountName: "Vortex E2E Checking", + accountNumber: "000123456789", + accountType: "CHECKING", + fiatAccountId: "fiat-account-e2e-us", + metadata: { accountHolderName: "Vortex E2E" }, + routingNumber: "026009593", + type: "BANK_USA" + }) as SellJourneyCase["fiatAccount"], + outputAmount: "99", + to: "ach" + }, + { + arrivalText: "Your funds will arrive in your bank account via SPEI in a few minutes.", + country: "MX", + fiat: "MXN", + // Mexican accounts are SPEI accounts holding an 18-digit CLABE. + fiatAccount: buildFiatAccount({ + accountName: "Vortex E2E CLABE", + accountNumber: "646180157000000004", + accountType: "CLABE", + fiatAccountId: "fiat-account-e2e-mx", + metadata: { accountHolderName: "Vortex E2E" }, + type: "SPEI" + }) as SellJourneyCase["fiatAccount"], + outputAmount: "1900", + to: "spei" + }, + { + arrivalText: "Your funds will arrive in your bank account in a few minutes.", + country: "CO", + fiat: "COP", + // Colombian accounts are stored as ACH (displayed as "ACH_COL") and carry the + // holder's document metadata from the ACH_COL registration form. + fiatAccount: buildFiatAccount({ + accountName: "Vortex E2E Ahorros", + accountNumber: "123456789012", + accountType: "AHORRO", + fiatAccountId: "fiat-account-e2e-co", + metadata: { accountHolderName: "Vortex E2E", documentNumber: "1234567890", documentType: "CC" }, + type: "ACH" + }) as SellJourneyCase["fiatAccount"], + outputAmount: "400000", + to: "ach" + }, + { + arrivalText: "Your funds will arrive in your bank account in a few minutes.", + country: "AR", + fiat: "ARS", + // Argentine accounts are COELSA accounts holding a 22-digit CBU/CVU. + fiatAccount: buildFiatAccount({ + accountName: "Vortex E2E CBU", + accountNumber: "2850590940090418135201", + accountType: "CBU", + fiatAccountId: "fiat-account-e2e-ar", + metadata: { accountHolderName: "Vortex E2E" }, + type: "COELSA" + }) as SellJourneyCase["fiatAccount"], + outputAmount: "130000", + to: "cbu" + } +]; + +// The quote form displays amounts with locale grouping ("1900" renders as "1,900.00"). +const displayedAmount = (amount: string) => new RegExp(Number(amount).toLocaleString("en-US")); + +// Mirrors the API's evm-to-alfredpay offramp preparation for the direct +// Polygon-USDT no-permit path: the USER wallet signs a single +// squidRouterNoPermitTransfer to the EVM ephemeral, and the ephemeral signs the +// Alfredpay deposit transfer, its fallback (both nonce 0 — only one executes), and +// the axlUSDC cleanup approval. +function buildSellUnsignedTxs(evmEphemeral: string) { + const evmTx = (signer: string, nonce: number, phase: string) => ({ + meta: {}, + network: "polygon", + nonce, + phase, + signer, + txData: { + data: `0xa9059cbb${"00".repeat(12)}${evmEphemeral.slice(2).toLowerCase()}${"00".repeat(30)}04c4`, + gas: "150000", + maxFeePerGas: "5000000000", + maxPriorityFeePerGas: "5000000000", + nonce, + to: POLYGON_USDT, + value: "0" + } + }); + return [ + evmTx(MOCK_WALLET_ADDRESS, 0, "squidRouterNoPermitTransfer"), + evmTx(evmEphemeral, 0, "alfredpayOfframpTransfer"), + evmTx(evmEphemeral, 0, "alfredpayOfframpTransferFallback"), + evmTx(evmEphemeral, 1, "polygonCleanupAxlUsdc") + ]; +} + +for (const journey of CASES) { + test(`SELL ${journey.fiat} journey: quote, auth, Alfredpay KYC gate, fiat account, registration, wallet signing, progress, success`, async ({ + page + }) => { + const rampFields = { + depositQrCode: undefined, + from: "polygon", + inputAmount: "100", + inputCurrency: "USDT", + outputAmount: journey.outputAmount, + outputCurrency: journey.fiat, + paymentMethod: journey.to, + to: journey.to, + type: "SELL" + }; + + // The real API keeps returning the ramp's unsignedTxs on /ramp/update; the signing + // step reads the user-wallet transaction from that response. + let unsignedTxs: unknown[] = []; + const backend = await mockBackend(page, { + fiatAccounts: () => [journey.fiatAccount], + quotes: body => + ({ + body: buildQuoteResponse({ + ...rampFields, + // Alfredpay quotes carry the resolved stablecoin input limits; the quote form + // validates the USDT inputAmount against them (not the legacy fiat sell limits). + alfredpayInputLimits: { max: "10000", min: "10" }, + feeCurrency: journey.fiat, + inputAmount: body.inputAmount, + rampType: "SELL" + }), + status: 200 + }) as { status: number; body: unknown }, + rampStatusOverrides: () => rampFields, + register: body => { + const signingAccounts = (body.signingAccounts ?? []) as Array<{ address: string; type: string }>; + const evmEphemeral = signingAccounts.find(account => account.type === "EVM")?.address ?? POLYGON_USDT; + unsignedTxs = buildSellUnsignedTxs(evmEphemeral); + return buildRampProcess({ ...rampFields, unsignedTxs }); + }, + update: () => buildRampProcess({ ...rampFields, unsignedTxs }) + }); + // The whole journey lives on Polygon, so the mock wallet connects on chain 137. + await injectMockWallet(page, { chainIdHex: "0x89" }); + // Preselect Polygon via the persisted network choice instead of the `network` URL + // param: passing network+cryptoLocked in the URL makes the widget create the quote + // itself and skip the quote form, and stage 1 (form + wallet gate + balance check) + // is part of this journey. + await page.addInitScript(() => localStorage.setItem("SELECTED_NETWORK", "polygon")); + + await page.goto(`/widget?rampType=SELL&fiat=${journey.fiat}&cryptoLocked=USDT&inputAmount=100`); + + // Stage 1: the quote form fetched a SELL USDT->fiat quote; the wallet gate is already + // passed by the injected mock wallet, and the balance check (mocked Alchemy data API, + // which holds USDT on Polygon) enables Sell. + await expect(page.locator('input[name="outputAmount"]')).toHaveValue(displayedAmount(journey.outputAmount), { + timeout: 20_000 + }); + const sellButton = page.locator("form").getByRole("button", { name: "Sell" }); + await expect(sellButton).toBeEnabled({ timeout: 20_000 }); + await sellButton.click(); + + // Stage 2 + 3: email/OTP auth gate. + await expect(page.getByRole("heading", { name: "Verify Your Email" })).toBeVisible({ timeout: 20_000 }); + await page.locator("#email").fill("e2e@vortexfinance.co"); + await page.locator("#terms").check(); + await page.getByRole("button", { name: "Continue" }).click(); + await expect(page.getByRole("heading", { name: "Enter Verification Code" })).toBeVisible({ timeout: 20_000 }); + await page.locator('input[autocomplete="one-time-code"]').pressSequentially("123456"); + + // Stage 4: Alfredpay offramp details — only wallet ownership, no CPF/Pix fields (the + // payout destination is the Alfredpay fiat account picked later on the summary). + await expect(page.getByText("Verify you are the owner of the wallet")).toBeVisible({ timeout: 20_000 }); + await expect(page.locator("#taxId")).toHaveCount(0); + await expect(page.locator("#pixId")).toHaveCount(0); + await expect(page.getByRole("button", { name: /0xf39F/ })).toBeVisible(); + await page.getByRole("button", { name: "Verify Wallet" }).click(); + + // Stage 5: the Alfredpay KYC gate queried the customer status for the case's country + // and, since the customer is verified (SUCCESS), the flow lands on the payment + // summary, where the registered payout account is listed and preselected. + await expect(page.getByRole("heading", { name: "Payment Summary" })).toBeVisible({ timeout: 20_000 }); + await expect(page.getByText(journey.fiatAccount.accountName)).toBeVisible({ timeout: 20_000 }); + expect(backend.alfredpayStatusRequests).toContain(journey.country); + expect(backend.fiatAccountsRequests).toContain(journey.country); + + // Stage 6: confirming registers the ramp; the fiat account travels as additionalData. + await page.getByRole("button", { name: "Confirm" }).click(); + + // Stage 7: the ephemeral transactions are signed in-page and posted to /ramp/update, + // then the USER WALLET broadcasts the source-of-funds transfer and its hash is + // reported in a second update; the offramp starts automatically and (once polling + // reports COMPLETE) lands on the SELL success screen. + await expect(page.getByRole("heading", { name: "All set! The withdrawal has been sent to your bank." })).toBeVisible({ + timeout: 45_000 + }); + await expect(page.getByText(journey.arrivalText)).toBeVisible(); + + expect(backend.registerRequests).toHaveLength(1); + const registerBody = backend.registerRequests[0] as { + quoteId: string; + signingAccounts: Array<{ type: string }>; + additionalData?: { fiatAccountId?: string; pixDestination?: string; taxId?: string; walletAddress?: string }; + }; + expect(registerBody.quoteId).toBe("quote-e2e-1"); + expect(registerBody.signingAccounts.map(account => account.type).sort()).toEqual(["EVM", "Substrate"]); + expect(registerBody.additionalData?.fiatAccountId).toBe(journey.fiatAccount.fiatAccountId); + expect(registerBody.additionalData?.walletAddress?.toLowerCase()).toBe(MOCK_WALLET_ADDRESS.toLowerCase()); + // The Avenia-only fields never travel on the Alfredpay rail. + expect(registerBody.additionalData?.pixDestination).toBeUndefined(); + expect(registerBody.additionalData?.taxId).toBeUndefined(); + + // Update #1: the three ephemeral transactions, locally signed (raw EIP-1559 txs). The + // user-wallet transfer must NOT be among them. + expect(backend.updateRequests.length).toBeGreaterThanOrEqual(2); + const ephemeralUpdate = backend.updateRequests[0] as { presignedTxs: Array<{ txData: unknown; phase: string }> }; + expect(ephemeralUpdate.presignedTxs.map(tx => tx.phase)).not.toContain("squidRouterNoPermitTransfer"); + expect(ephemeralUpdate.presignedTxs.map(tx => tx.phase).sort()).toEqual([ + "alfredpayOfframpTransfer", + "alfredpayOfframpTransferFallback", + "polygonCleanupAxlUsdc" + ]); + for (const tx of ephemeralUpdate.presignedTxs) { + expect(typeof tx.txData).toBe("string"); + expect(tx.txData as string).toMatch(/^0x02/); + } + + // Update #2: the hash of the wallet-broadcast transfer, reported as additionalData. + const signingUpdate = backend.updateRequests[1] as { additionalData?: Record }; + expect(signingUpdate.additionalData?.squidRouterNoPermitTransferHash).toBe(MOCK_WALLET_TX_HASH); + + // The offramp started without a manual payment-confirmation step. + expect(backend.startRequests).toHaveLength(1); + expect(backend.startRequests[0]).toMatchObject({ rampId: E2E_RAMP_ID }); + }); +} diff --git a/apps/frontend/e2e/support/mockBackend.ts b/apps/frontend/e2e/support/mockBackend.ts index 8251078ab..e241f442c 100644 --- a/apps/frontend/e2e/support/mockBackend.ts +++ b/apps/frontend/e2e/support/mockBackend.ts @@ -122,6 +122,7 @@ interface MockBackendOptions { export async function mockBackend(page: Page, options: MockBackendOptions = {}) { const quoteRequests: Array> = []; const brlaGetUserRequests: string[] = []; + const alfredpayStatusRequests: string[] = []; const fiatAccountsRequests: string[] = []; const registerRequests: Array> = []; const updateRequests: Array> = []; @@ -211,6 +212,7 @@ export async function mockBackend(page: Page, options: MockBackendOptions = {}) // Alfredpay KYC gate: the alfredpayKyc machine's CheckingStatus step. SUCCESS means an // existing verified customer, so the KYC child completes immediately (the gate's happy path). if (path === "/v1/alfredpay/alfredpayStatus" && method === "GET") { + alfredpayStatusRequests.push(url.searchParams.get("country") ?? ""); await fulfillJson({ status: options.alfredpayStatus ?? "SUCCESS" }); return; } @@ -386,5 +388,13 @@ export async function mockBackend(page: Page, options: MockBackendOptions = {}) await page.route("https://api.web3modal.org/**", route => route.abort()); await page.route("https://pulse.walletconnect.org/**", route => route.abort()); - return { brlaGetUserRequests, fiatAccountsRequests, quoteRequests, registerRequests, startRequests, updateRequests }; + return { + alfredpayStatusRequests, + brlaGetUserRequests, + fiatAccountsRequests, + quoteRequests, + registerRequests, + startRequests, + updateRequests + }; } diff --git a/apps/frontend/src/translations/en.json b/apps/frontend/src/translations/en.json index 8d03cdc37..0cf61d648 100644 --- a/apps/frontend/src/translations/en.json +++ b/apps/frontend/src/translations/en.json @@ -1290,6 +1290,7 @@ "sell": { "ARS": "Your funds will arrive in your bank account in a few minutes.", "BRL": "Your funds were sent via PIX and are now in your bank account.", + "COP": "Your funds will arrive in your bank account in a few minutes.", "default": "Your funds will arrive in your bank account soon.", "EURC": "Funds will be received via Standard SEPA within 1-2 business days.", "MXN": "Your funds will arrive in your bank account via SPEI in a few minutes.", diff --git a/apps/frontend/src/translations/pt.json b/apps/frontend/src/translations/pt.json index 2423abdb9..a584e7279 100644 --- a/apps/frontend/src/translations/pt.json +++ b/apps/frontend/src/translations/pt.json @@ -1295,6 +1295,7 @@ "sell": { "ARS": "Em breve os fundos estarão disponíveis em sua conta bancária.", "BRL": "Em breve os fundos estarão disponíveis em sua conta bancária..", + "COP": "Em breve os fundos estarão disponíveis em sua conta bancária.", "default": "Em breve os fundos estarão disponíveis em sua conta bancária.", "EURC": "Você receberá os fundos em até 1 minuto (SEPA Instantâneo) ou em até 2 dias (SEPA Padrão), dependendo do seu banco.", "MXN": "Seus fundos chegarão à sua conta bancária via SPEI em alguns minutos.", From 5dd48734559f7e8f5666d93cf7953fbab1f9f5e5 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 18:00:57 +0200 Subject: [PATCH 164/176] Wire ARSOnrampDetails into the onramp summary so ARS buyers see the CVU ONRAMP_DETAILS_BY_FIAT mapped FiatToken.ARS to null while the fully implemented ARSOnrampDetails component (COELSA CVU, alias, reference from achPaymentData) sat unimported in the same directory, so an ARS BUY showed no bank-transfer instructions after registration. The ARS E2E journey now asserts the CVU, alias, and reference are rendered instead of pinning the gap. --- .../e2e/onramp-alfredpay-journeys.spec.ts | 243 ++++++++++++++++++ .../SummaryStep/TransactionTokensDisplay.tsx | 3 +- 2 files changed, 245 insertions(+), 1 deletion(-) create mode 100644 apps/frontend/e2e/onramp-alfredpay-journeys.spec.ts diff --git a/apps/frontend/e2e/onramp-alfredpay-journeys.spec.ts b/apps/frontend/e2e/onramp-alfredpay-journeys.spec.ts new file mode 100644 index 000000000..dc11c299a --- /dev/null +++ b/apps/frontend/e2e/onramp-alfredpay-journeys.spec.ts @@ -0,0 +1,243 @@ +import { expect, Page, test } from "@playwright/test"; +import { buildQuoteResponse, buildRampProcess, E2E_RAMP_ID, mockBackend } from "./support/mockBackend"; +import { injectMockWallet, MOCK_WALLET_ADDRESS } from "./support/mockWallet"; + +const POLYGON_USDT = "0xc2132d05d31c914a87c6611c10748aeb04b58e8f"; + +// Critical journey 6: full BUY (onramp) journeys over the Alfredpay rail — the corridor +// family (MXN/USD/COP/ARS) the BRL journey never touches. The UI flow is identical for +// all four currencies (quote -> Buy -> email/OTP auth -> wallet ownership -> Alfredpay +// KYC gate on its happy path, an existing verified customer with alfredpayStatus=SUCCESS +// -> summary -> registration -> in-page ephemeral signing on POLYGON posted to +// /ramp/update -> "I have made the payment" -> /ramp/start -> progress -> success), so +// the journey is parameterized per currency. What differs — and what each case pins down +// — is the corridor's payment-method destination, the KYC-gate country, and the +// payment-instruction rendering (ONRAMP_DETAILS_BY_FIAT in +// src/components/widget-steps/SummaryStep/TransactionTokensDisplay.tsx): +// MXN -> SPEI CLABE (MXNOnrampDetails) +// USD -> ACH bank-detail rows (USOnrampDetails) +// COP -> bank-transfer account details (COPOnrampDetails) +// ARS -> COELSA CVU + alias (ARSOnrampDetails) + +interface BuyJourneyCase { + fiat: "MXN" | "USD" | "COP" | "ARS"; + /** Country the Alfredpay KYC gate must be queried for (ALFREDPAY_FIAT_TOKEN_TO_COUNTRY). */ + country: string; + /** The corridor's payment-method destination (mapFiatToDestination in shared). */ + from: string; + inputAmount: string; + outputAmount: string; + /** The anchor's fiat payment instructions returned on /ramp/update (AlfredpayFiatPaymentInstructions). */ + achPaymentData: Record; + /** Asserts the corridor's payment-instruction rendering after registration + signing. */ + assertPaymentInstructions: (page: Page) => Promise; +} + +const CASES: BuyJourneyCase[] = [ + { + achPaymentData: { + accountHolderName: "Vortex E2E", + bankName: "STP", + clabe: "646180157000000004", + paymentType: "SPEI", + reference: "VORTEX-E2E-REF-MX" + }, + assertPaymentInstructions: async page => { + // MXNOnrampDetails: the SPEI CLABE plus the payment reference. + await expect(page.getByText("646180157000000004").first()).toBeVisible({ timeout: 30_000 }); + await expect(page.getByText("VORTEX-E2E-REF-MX")).toBeVisible(); + }, + country: "MX", + fiat: "MXN", + from: "spei", + inputAmount: "2000", + outputAmount: "100" + }, + { + achPaymentData: { + bankAccountNumber: "000123456789", + bankBeneficiaryName: "Alfred Securities LLC", + bankRoutingNumber: "026009593", + paymentDescription: "Deposit the payment with the following reference number: VORTEXE2EREFUS01", + paymentType: "ACH" + }, + assertPaymentInstructions: async page => { + // USOnrampDetails: ACH bank-detail rows, with the reference number extracted from + // the anchor's paymentDescription sentence. + await expect(page.getByText("000123456789").first()).toBeVisible({ timeout: 30_000 }); + await expect(page.getByText("026009593")).toBeVisible(); + await expect(page.getByText("Alfred Securities LLC")).toBeVisible(); + await expect(page.getByText("VORTEXE2EREFUS01")).toBeVisible(); + }, + country: "US", + fiat: "USD", + from: "ach", + inputAmount: "2000", + outputAmount: "1990" + }, + { + achPaymentData: { + accountHolderName: "Alfred Colombia SAS", + bankAccountNumber: "123456789012", + bankName: "Bancolombia", + paymentType: "ACH", + reference: "VORTEX-E2E-REF-CO" + }, + assertPaymentInstructions: async page => { + // COPOnrampDetails: destination bank account, bank name, and reference. + await expect(page.getByText("123456789012").first()).toBeVisible({ timeout: 30_000 }); + await expect(page.getByText("Bancolombia")).toBeVisible(); + await expect(page.getByText("VORTEX-E2E-REF-CO")).toBeVisible(); + }, + country: "CO", + fiat: "COP", + from: "ach", + inputAmount: "500000", + outputAmount: "100" + }, + { + achPaymentData: { + alias: "vortex.e2e.alias", + cvu: "0000003100064567890123", + paymentType: "COELSA", + reference: "VORTEX-E2E-REF-AR" + }, + assertPaymentInstructions: async page => { + // ARSOnrampDetails: the COELSA CVU, alias, and reference. + await expect(page.getByText("0000003100064567890123").first()).toBeVisible({ timeout: 30_000 }); + await expect(page.getByText("vortex.e2e.alias").first()).toBeVisible(); + await expect(page.getByText("VORTEX-E2E-REF-AR")).toBeVisible(); + }, + country: "AR", + fiat: "ARS", + from: "cbu", + inputAmount: "150000", + outputAmount: "100" + } +]; + +// The quote form displays amounts with locale grouping ("1990" renders as "1,990.00"). +const displayedAmount = (amount: string) => new RegExp(Number(amount).toLocaleString("en-US")); + +// The Alfredpay onramp's Polygon-side transactions signed by the EVM ephemeral +// (destinationTransfer + cleanup), mirroring alfredpay-to-evm.ts' direct-token path. +function buildBuyUnsignedTxs(evmEphemeral: string) { + const evmTx = (nonce: number, phase: string) => ({ + meta: {}, + network: "polygon", + nonce, + phase, + signer: evmEphemeral, + txData: { + data: `0xa9059cbb${"00".repeat(12)}${evmEphemeral.slice(2).toLowerCase()}${"00".repeat(30)}04c4`, + gas: "150000", + maxFeePerGas: "5000000000", + maxPriorityFeePerGas: "5000000000", + nonce, + to: POLYGON_USDT, + value: "0" + } + }); + return [evmTx(0, "destinationTransfer"), evmTx(1, "polygonCleanup")]; +} + +for (const journey of CASES) { + test(`BUY ${journey.fiat} journey: quote, auth, Alfredpay KYC gate, registration, signing, payment details, progress, success`, async ({ + page + }) => { + const rampFields = { + depositQrCode: undefined, + from: journey.from, + inputAmount: journey.inputAmount, + inputCurrency: journey.fiat, + outputAmount: journey.outputAmount, + outputCurrency: "USDT", + to: "polygon", + type: "BUY" + }; + + let unsignedTxs: unknown[] = []; + const backend = await mockBackend(page, { + quotes: body => + ({ + body: buildQuoteResponse({ + ...rampFields, + feeCurrency: journey.fiat, + inputAmount: body.inputAmount, + rampType: "BUY" + }), + status: 200 + }) as { status: number; body: unknown }, + rampStatusOverrides: () => rampFields, + register: body => { + const signingAccounts = (body.signingAccounts ?? []) as Array<{ address: string; type: string }>; + const evmEphemeral = signingAccounts.find(account => account.type === "EVM")?.address ?? POLYGON_USDT; + unsignedTxs = buildBuyUnsignedTxs(evmEphemeral); + return buildRampProcess({ ...rampFields, unsignedTxs }); + }, + update: () => buildRampProcess({ ...rampFields, achPaymentData: journey.achPaymentData, unsignedTxs }) + }); + await injectMockWallet(page); + + await page.goto(`/widget?rampType=BUY&fiat=${journey.fiat}&inputAmount=${journey.inputAmount}`); + + // Stage 1: the quote form fetched a BUY quote for the case's fiat currency. + await expect(page.locator('input[name="outputAmount"]')).toHaveValue(displayedAmount(journey.outputAmount), { + timeout: 20_000 + }); + await page.locator("form").getByRole("button", { name: "Buy" }).click(); + + // Stage 2 + 3: email/OTP auth gate. + await expect(page.getByRole("heading", { name: "Verify Your Email" })).toBeVisible({ timeout: 20_000 }); + await page.locator("#email").fill("e2e@vortexfinance.co"); + await page.locator("#terms").check(); + await page.getByRole("button", { name: "Continue" }).click(); + await expect(page.getByRole("heading", { name: "Enter Verification Code" })).toBeVisible({ timeout: 20_000 }); + await page.locator('input[autocomplete="one-time-code"]').pressSequentially("123456"); + + // Stage 4: wallet ownership step — the connected mock wallet is shown; confirming + // sends CONFIRM with the wallet as the destination. + await expect(page.getByText("Verify you are the owner of the wallet")).toBeVisible({ timeout: 20_000 }); + await expect(page.getByRole("button", { name: /0xf39F/ })).toBeVisible(); + await page.getByRole("button", { name: "Verify Wallet" }).click(); + + // Stage 5: the Alfredpay KYC gate queried the customer status for the case's country + // and, since the customer is verified (SUCCESS), the flow lands on the payment summary. + await expect(page.getByRole("heading", { name: "Payment Summary" })).toBeVisible({ timeout: 20_000 }); + expect(backend.alfredpayStatusRequests).toContain(journey.country); + + // Stage 6: confirming registers the ramp and signs the Polygon transactions in-page; + // the corridor's payment instructions from the update response are then displayed. + await page.getByRole("button", { name: "Confirm" }).click(); + await journey.assertPaymentInstructions(page); + + expect(backend.registerRequests).toHaveLength(1); + const registerBody = backend.registerRequests[0] as { + quoteId: string; + signingAccounts: Array<{ type: string }>; + additionalData?: { destinationAddress?: string; walletAddress?: string }; + }; + expect(registerBody.quoteId).toBe("quote-e2e-1"); + expect(registerBody.additionalData?.destinationAddress?.toLowerCase()).toBe(MOCK_WALLET_ADDRESS.toLowerCase()); + expect(registerBody.additionalData?.walletAddress?.toLowerCase()).toBe(MOCK_WALLET_ADDRESS.toLowerCase()); + + // Every unsigned Polygon transaction came back locally signed (raw EIP-1559 txs). + expect(backend.updateRequests.length).toBeGreaterThanOrEqual(1); + const presignedTxs = (backend.updateRequests[0] as { presignedTxs: Array<{ txData: unknown; phase: string }> }) + .presignedTxs; + expect(presignedTxs.map(tx => tx.phase).sort()).toEqual(["destinationTransfer", "polygonCleanup"]); + for (const tx of presignedTxs) { + expect(typeof tx.txData).toBe("string"); + expect(tx.txData as string).toMatch(/^0x02/); + } + + // Stage 7: confirming the payment starts the ramp; once polling reports COMPLETE the + // BUY success screen appears. + await page.getByRole("button", { name: "I have made the payment" }).click(); + await expect(page.getByRole("heading", { name: "All set! Your tokens are on their way." })).toBeVisible({ + timeout: 45_000 + }); + expect(backend.startRequests).toHaveLength(1); + expect(backend.startRequests[0]).toMatchObject({ rampId: E2E_RAMP_ID }); + }); +} diff --git a/apps/frontend/src/components/widget-steps/SummaryStep/TransactionTokensDisplay.tsx b/apps/frontend/src/components/widget-steps/SummaryStep/TransactionTokensDisplay.tsx index 2b8b71816..6f1e14c7f 100644 --- a/apps/frontend/src/components/widget-steps/SummaryStep/TransactionTokensDisplay.tsx +++ b/apps/frontend/src/components/widget-steps/SummaryStep/TransactionTokensDisplay.tsx @@ -25,6 +25,7 @@ import { useTokenIcon } from "../../../hooks/useTokenIcon"; import { useVortexAccount } from "../../../hooks/useVortexAccount"; import { MykoboService } from "../../../services/api/mykobo.service"; import { RampExecutionInput } from "../../../types/phases"; +import { ARSOnrampDetails } from "./ARSOnrampDetails"; import { AssetDisplay } from "./AssetDisplay"; import { BRLOnrampDetails } from "./BRLOnrampDetails"; import { COPOnrampDetails } from "./COPOnrampDetails"; @@ -34,7 +35,7 @@ import { MXNOnrampDetails } from "./MXNOnrampDetails"; import { USOnrampDetails } from "./USOnrampDetails"; const ONRAMP_DETAILS_BY_FIAT: Record = { - [FiatToken.ARS]: null, + [FiatToken.ARS]: ARSOnrampDetails, [FiatToken.BRL]: BRLOnrampDetails, [FiatToken.COP]: COPOnrampDetails, [FiatToken.EURC]: EUROnrampDetails, From b111323d0aa512f769067c09afa602936f0bf592 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 18:23:40 +0200 Subject: [PATCH 165/176] Extend the fake anchors: per-currency payment instructions and Mykobo profile support --- .../src/test-utils/fake-world/fake-anchors.ts | 84 +++++++++++++++++-- .../sdk-contract.alfredpay-onramp.test.ts | 36 ++++++-- 2 files changed, 105 insertions(+), 15 deletions(-) diff --git a/apps/api/src/test-utils/fake-world/fake-anchors.ts b/apps/api/src/test-utils/fake-world/fake-anchors.ts index 960ab5b92..3e6dc9c56 100644 --- a/apps/api/src/test-utils/fake-world/fake-anchors.ts +++ b/apps/api/src/test-utils/fake-world/fake-anchors.ts @@ -20,13 +20,16 @@ import { type CreateAlfredpayOnrampRequest, type CreateAlfredpayOnrampResponse, type GetAlfredpayOnrampTransactionResponse, + MykoboApiError, MykoboApiService, type MykoboCreateIntentRequest, type MykoboCreateIntentResponse, type MykoboFeeResponse, + type MykoboGetProfileResponse, type MykoboGetTransactionResponse, type MykoboTransaction, - MykoboTransactionStatus + MykoboTransactionStatus, + MykoboTransactionType } from "@vortexfi/shared"; function unimplementedProxy(impl: object, label: string): T { @@ -52,6 +55,13 @@ export class FakeMykobo { withdrawFeeTotal = "1.00"; /** When set, the next createTransactionIntent call rejects with this error. */ failNextIntent: Error | null = null; + /** + * KYC review status served by getProfileByEmail ("approved" | "pending" | + * "rejected"); null means Mykobo knows no such profile (404). + */ + profileKycReviewStatus: string | null = "approved"; + /** On-chain receivables address handed out in WITHDRAW intent instructions. */ + withdrawReceivablesAddress = "0x5afe0000000000000000000000000000005e9a00"; readonly intents: MykoboCreateIntentRequest[] = []; readonly transactions = new Map(); @@ -91,12 +101,30 @@ export class FakeMykobo { }; this.transactions.set(transaction.id, transaction); return { - instructions: { bank_account_name: "Vortex Test Account", iban: "DE89370400440532013000" }, + instructions: + request.transaction_type === MykoboTransactionType.WITHDRAW + ? { address: this.withdrawReceivablesAddress } + : { bank_account_name: "Vortex Test Account", iban: "DE89370400440532013000" }, transaction }; }, defaultDepositFee: async (): Promise => ({ total: this.depositFeeTotal }), defaultWithdrawFee: async (): Promise => ({ total: this.withdrawFeeTotal }), + getProfileByEmail: async (email: string): Promise => { + if (this.profileKycReviewStatus === null) { + throw new MykoboApiError(404, { error: "profile not found" }, "profile not found"); + } + return { + profile: { + bank_account_number: "DE89370400440532013000", + created_at: new Date().toISOString(), + email_address: email, + first_name: "Test", + kyc_status: { received_at: new Date().toISOString(), review_status: this.profileKycReviewStatus }, + last_name: "User" + } + }; + }, getTransaction: async (transactionId: string): Promise => { const transaction = this.transactions.get(transactionId); if (!transaction) { @@ -237,12 +265,52 @@ export class FakeAlfredpay { readonly fiatAccountsByCustomer = new Map(); private counter = 0; - private readonly fiatPaymentInstructions: AlfredpayFiatPaymentInstructions = { - clabe: "646180157000000004", - paymentType: "SPEI", - reference: "VORTEX-TEST" + /** + * Rail-realistic fiat payment instructions handed out per BUY currency + * (MXN: SPEI/CLABE, USD & COP: ACH bank fields, ARS: CBU). Tests can + * override entries to script other shapes. + */ + fiatPaymentInstructionsByCurrency: Record = { + ARS: { + accountHolderName: "Vortex Test Account", + bankAccountNumber: "2850590940090418135201", + bankName: "Banco de Prueba", + paymentType: "CBU", + reference: "VORTEX-TEST" + }, + COP: { + accountHolderName: "Vortex Test Account", + bankAccountNumber: "01234567890", + bankName: "Bancolombia de Prueba", + bankRoutingNumber: "007", + paymentType: "ACH", + reference: "VORTEX-TEST" + }, + MXN: { + clabe: "646180157000000004", + paymentType: "SPEI", + reference: "VORTEX-TEST" + }, + USD: { + accountHolderName: "Vortex Test Account", + bankAccountNumber: "000123456789", + bankName: "Test Bank USA", + bankRoutingNumber: "021000021", + paymentType: "ACH", + reference: "VORTEX-TEST" + } }; + private instructionsFor(currency: string): AlfredpayFiatPaymentInstructions { + const instructions = this.fiatPaymentInstructionsByCurrency[currency]; + if (!instructions) { + throw new Error( + `FakeAlfredpay: no fiatPaymentInstructions configured for ${currency} — extend fiatPaymentInstructionsByCurrency.` + ); + } + return { ...instructions }; + } + private onrampQuote(request: CreateAlfredpayOnrampQuoteRequest): AlfredpayOnrampQuote { const fromAmount = request.fromAmount ?? "0"; return { @@ -344,7 +412,7 @@ export class FakeAlfredpay { }; this.transactions.set(transactionId, transaction); this.onCreateOnramp?.({ depositAddress: request.depositAddress, transactionId }); - return { fiatPaymentInstructions: { ...this.fiatPaymentInstructions }, transaction }; + return { fiatPaymentInstructions: this.instructionsFor(request.fromCurrency), transaction }; }, createOnrampQuote: async (request: CreateAlfredpayOnrampQuoteRequest): Promise => this.onrampQuote(request), @@ -362,7 +430,7 @@ export class FakeAlfredpay { } return { ...transaction, - fiatPaymentInstructions: { ...this.fiatPaymentInstructions }, + fiatPaymentInstructions: this.instructionsFor(transaction.fromCurrency), metadata: this.onrampStatusMetadata, status: this.onrampStatus }; diff --git a/apps/api/src/tests/sdk-contract.alfredpay-onramp.test.ts b/apps/api/src/tests/sdk-contract.alfredpay-onramp.test.ts index f8f9cd680..060b288d5 100644 --- a/apps/api/src/tests/sdk-contract.alfredpay-onramp.test.ts +++ b/apps/api/src/tests/sdk-contract.alfredpay-onramp.test.ts @@ -36,15 +36,20 @@ interface CurrencyCase { inputAmount: string; /** USDT the fake anchor mints per unit of fiat. */ onrampRate: number; + /** Rail-specific payment instructions registerRamp must surface as achPaymentData. */ + expectedInstructions: Record; } // Rails per currency: MXN funds over spei, USD and COP over ach, ARS over cbu. // The MXN rate is the same legible flat rate the MXN corridor scenario uses -// (2000 MXN * 0.05 = 100 USDT); the others mirror the FakePrices feeds. +// (2000 MXN * 0.05 = 100 USDT); the others mirror the FakePrices feeds. The +// expected instructions match FakeAlfredpay's rail-realistic per-currency +// defaults (fiatPaymentInstructionsByCurrency). const FULL_LIFECYCLE_CASES: CurrencyCase[] = [ { alfredpayCurrency: "MXN", country: AlfredPayCountry.MX, + expectedInstructions: { clabe: "646180157000000004", paymentType: "SPEI" }, fiat: FiatToken.MXN, inputAmount: "2000", onrampRate: 0.05, @@ -53,6 +58,12 @@ const FULL_LIFECYCLE_CASES: CurrencyCase[] = [ { alfredpayCurrency: "USD", country: AlfredPayCountry.US, + expectedInstructions: { + bankAccountNumber: "000123456789", + bankName: "Test Bank USA", + bankRoutingNumber: "021000021", + paymentType: "ACH" + }, fiat: FiatToken.USD, inputAmount: "20000", onrampRate: 1, @@ -61,6 +72,12 @@ const FULL_LIFECYCLE_CASES: CurrencyCase[] = [ { alfredpayCurrency: "COP", country: AlfredPayCountry.CO, + expectedInstructions: { + bankAccountNumber: "01234567890", + bankName: "Bancolombia de Prueba", + bankRoutingNumber: "007", + paymentType: "ACH" + }, fiat: FiatToken.COP, inputAmount: "50000", onrampRate: 1 / 4000, @@ -69,6 +86,11 @@ const FULL_LIFECYCLE_CASES: CurrencyCase[] = [ { alfredpayCurrency: "ARS", country: AlfredPayCountry.AR, + expectedInstructions: { + accountHolderName: "Vortex Test Account", + bankAccountNumber: "2850590940090418135201", + paymentType: "CBU" + }, fiat: FiatToken.ARS, inputAmount: "10000", onrampRate: 1 / 1000, @@ -273,12 +295,12 @@ describe("SDK ↔ API contract (Alfredpay onramps, fiat → USDT on Polygon)", ( expect(Number(rampProcess.inputAmount)).toBe(Number(quote.inputAmount)); expect(Number(rampProcess.outputAmount)).toBe(Number(quote.outputAmount)); - // The client-visible payment details. The fake anchor hands out the - // same SPEI-shaped instructions (CLABE + reference) for every - // currency; the contract under test is that registerRamp surfaces the - // anchor's fiatPaymentInstructions verbatim as achPaymentData. - expect(rampProcess.achPaymentData?.paymentType).toBe("SPEI"); - expect(rampProcess.achPaymentData?.clabe).toBeTruthy(); + // The client-visible payment details: registerRamp surfaces the + // anchor's rail-specific fiatPaymentInstructions verbatim as + // achPaymentData (SPEI/CLABE for MXN, ACH bank fields for USD/COP, + // CBU for ARS). + expect(rampProcess.achPaymentData).toMatchObject(currency.expectedInstructions); + expect(rampProcess.achPaymentData?.reference).toBeTruthy(); // The ephemeral surface of the direct Alfredpay BUY route: the // destination transfer plus the Polygon dust cleanup. From f5b1a066acaf21f97e85f64683a0aee44a91315b Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 18:23:41 +0200 Subject: [PATCH 166/176] Cover the cross-chain leg for every live corridor --- .../alfredpay-currencies.scenario.test.ts | 388 +++++++++++++++++- .../brl-onramp-crosschain.scenario.test.ts | 386 +++++++++++++++++ 2 files changed, 763 insertions(+), 11 deletions(-) create mode 100644 apps/api/src/tests/corridors/brl-onramp-crosschain.scenario.test.ts diff --git a/apps/api/src/tests/corridors/alfredpay-currencies.scenario.test.ts b/apps/api/src/tests/corridors/alfredpay-currencies.scenario.test.ts index ffd07e2e6..4ede6eb2f 100644 --- a/apps/api/src/tests/corridors/alfredpay-currencies.scenario.test.ts +++ b/apps/api/src/tests/corridors/alfredpay-currencies.scenario.test.ts @@ -6,6 +6,7 @@ import { AlfredpayOfframpStatus, AlfredpayOnrampStatus, EvmToken, + evmTokenConfig, FiatToken, getAnyFiatTokenDetails, multiplyByPowerOfTen, @@ -16,7 +17,7 @@ import { } from "@vortexfi/shared"; import Big from "big.js"; import { BaseError, ContractFunctionExecutionError, decodeFunctionData, encodeFunctionData, erc20Abi, parseTransaction } from "viem"; -import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"; +import { generatePrivateKey, privateKeyToAccount, type PrivateKeyAccount } from "viem/accounts"; import { parseUnits } from "viem/utils"; import phaseProcessor from "../../api/services/phases/phase-processor"; import QuoteTicket from "../../models/quoteTicket.model"; @@ -27,6 +28,16 @@ import { type FakeWorld, installFakeWorld } from "../../test-utils/fake-world"; import { installFakeSupabaseAuth, testUserToken } from "../../test-utils/fake-world/fake-auth"; import { startTestApp, type TestApp } from "../../test-utils/test-app"; +const USDT_ON_ARBITRUM = evmTokenConfig[Networks.Arbitrum][EvmToken.USDT]?.erc20AddressSourceChain as `0x${string}`; +if (!USDT_ON_ARBITRUM) { + throw new Error("USDT token config missing for Arbitrum"); +} + +const CHAIN_IDS: Partial> = { + [Networks.Arbitrum]: 42161, + [Networks.Polygon]: 137 +}; + const ONRAMP_PHASES: RampPhase[] = [ "initial", "alfredpayOnrampMint", @@ -38,6 +49,20 @@ const ONRAMP_PHASES: RampPhase[] = [ "complete" ]; +// Cross-chain BUY: squidRouterSwap executes for real (Polygon mint token → +// Arbitrum USDT) and squidRouterPay settles via the destination balance check. +const CROSS_CHAIN_ONRAMP_PHASES: RampPhase[] = [ + "initial", + "alfredpayOnrampMint", + "fundEphemeral", + "subsidizePreSwap", + "squidRouterSwap", + "squidRouterPay", + "finalSettlementSubsidy", + "destinationTransfer", + "complete" +]; + const OFFRAMP_PHASES: RampPhase[] = [ "initial", "squidRouterPermitExecute", @@ -99,6 +124,23 @@ const CURRENCY_CASES: CurrencyCase[] = [ } ]; +// MXN's own corridor files cover the direct Polygon paths (mxn-onramp / +// mxn-offramp) and the cross-chain BUY leg (mxn-onramp-crosschain); its +// cross-chain SELL case lives here with the rest of the cross-chain matrix. +const CROSS_CHAIN_OFFRAMP_CASES: CurrencyCase[] = [ + ...CURRENCY_CASES, + { + alfredpayCurrency: "MXN", + country: AlfredPayCountry.MX, + fiat: FiatToken.MXN, + offrampInputAmount: "100", + offrampRate: 20, + onrampInputAmount: "2000", + onrampRate: 0.05, + rail: "spei" + } +]; + /** * Parameterized scenarios for the Alfredpay corridors beyond MXN: USD (ach), * COP (ach) and ARS (cbu), each in both directions. The deeper security and @@ -106,6 +148,11 @@ const CURRENCY_CASES: CurrencyCase[] = [ * shared, so what these tests protect is the per-currency configuration * (rails, limits, and the fiat↔Alfredpay currency mapping) on the happy path * plus one transient (recoverable) and one unrecoverable failure per currency. + * The cross-chain legs run here per currency too: BUY bridges the Polygon mint + * to Arbitrum via squid (mirroring the MXN cross-chain corridor) and SELL + * takes the no-permit cross-chain fallback (user-broadcast squid approve+swap + * on Arbitrum, verified by hash before the Polygon deposit transfer) — the + * latter including MXN, whose own files only cover the direct Polygon path. */ describe("Alfredpay currency corridors (USD/COP/ARS, on- and offramp)", () => { let world: FakeWorld; @@ -135,6 +182,10 @@ describe("Alfredpay currency corridors (USD/COP/ARS, on- and offramp)", () => { world.alfredpay.onrampStatusMetadata = null; world.alfredpay.offrampStatus = AlfredpayOfframpStatus.FIAT_TRANSFER_COMPLETED; world.alfredpay.offrampDepositAddress = privateKeyToAccount(generatePrivateKey()).address.toLowerCase(); + // The direct corridors never bridge; the cross-chain setups switch the + // fake route to USDT's 6 decimals, so reset to the fake's default here. + world.squidRouter.toTokenDecimals = 18; + world.squidRouter.bridgeStatus = "success"; }); function applyErc20TransfersToLedger(): void { @@ -200,6 +251,73 @@ describe("Alfredpay currency corridors (USD/COP/ARS, on- and offramp)", () => { expect(response.status, `ramp update failed: ${await response.clone().text()}`).toBe(200); } + function blueprintOf(unsignedTxs: UnsignedTx[], phase: RampPhase): UnsignedTx { + const blueprint = unsignedTxs.find(tx => tx.phase === phase); + expect(blueprint, `missing ${phase} blueprint in persisted ramp state`).toBeDefined(); + return blueprint as UnsignedTx; + } + + /** Signs a blueprint exactly as issued; the nonce may be overridden for backups. */ + async function signBlueprint(ephemeral: PrivateKeyAccount, blueprint: UnsignedTx, nonce?: number): Promise<`0x${string}`> { + const txData = blueprint.txData as unknown as { to: `0x${string}`; data: `0x${string}`; value?: string }; + const chainId = CHAIN_IDS[blueprint.network]; + if (!chainId) { + throw new Error(`No chain id mapped for ${blueprint.network}`); + } + return ephemeral.signTransaction({ + chainId, + data: txData.data, + gas: 600_000n, + // validatePresignedTxs enforces the blueprint's fee minimums (3 gwei floor on Polygon). + maxFeePerGas: 5_000_000_000n, + maxPriorityFeePerGas: 5_000_000_000n, + nonce: nonce ?? blueprint.nonce, + to: txData.to, + type: "eip1559", + value: BigInt(txData.value ?? "0") + }); + } + + /** validatePresignedTxs requires 4 same-call backups at the next 4 nonces. */ + async function presignWithBackups(ephemeral: PrivateKeyAccount, blueprint: UnsignedTx) { + const backups: Record = {}; + for (let i = 1; i <= 4; i++) { + backups[`backup${i}`] = { nonce: blueprint.nonce + i, txData: await signBlueprint(ephemeral, blueprint, blueprint.nonce + i) }; + } + return { + meta: { additionalTxs: backups }, + network: blueprint.network, + nonce: blueprint.nonce, + phase: blueprint.phase, + signer: ephemeral.address, + txData: await signBlueprint(ephemeral, blueprint) + }; + } + + /** Broadcasts a user-wallet blueprint on its source chain exactly as issued. */ + function broadcastUserBlueprint(userWallet: PrivateKeyAccount, blueprint: UnsignedTx): `0x${string}` { + const txData = blueprint.txData as unknown as { to: `0x${string}`; data: `0x${string}`; value?: string }; + return world.evm.broadcastUserTransaction(blueprint.network, userWallet.address, { + data: txData.data, + to: txData.to, + value: BigInt(txData.value ?? "0") + }); + } + + /** Scripts the EIP-2612 nonces() probe to revert so registration takes the no-permit path. */ + function failNoncesProbe(): void { + world.evm.onReadContract = (_network, params) => { + if (params.functionName === "nonces") { + throw new ContractFunctionExecutionError(new BaseError("nonces() reverted"), { + abi: erc20Abi, + contractAddress: params.address, + functionName: "nonces" + }); + } + return undefined; + }; + } + interface OnrampSetup { rampId: string; quoteId: string; @@ -296,16 +414,7 @@ describe("Alfredpay currency corridors (USD/COP/ARS, on- and offramp)", () => { const ephemeral = privateKeyToAccount(generatePrivateKey()); const userWallet = privateKeyToAccount(generatePrivateKey()); - world.evm.onReadContract = (_network, params) => { - if (params.functionName === "nonces") { - throw new ContractFunctionExecutionError(new BaseError("nonces() reverted"), { - abi: erc20Abi, - contractAddress: params.address, - functionName: "nonces" - }); - } - return undefined; - }; + failNoncesProbe(); const user = await createTestUser(); await createTestAlfredpayCustomer(user.id, { country: currency.country }); @@ -383,6 +492,175 @@ describe("Alfredpay currency corridors (USD/COP/ARS, on- and offramp)", () => { }; } + interface CrossChainOnrampSetup extends OnrampSetup { + signedSquidApprove: `0x${string}`; + signedSquidSwap: `0x${string}`; + } + + /** + * Cross-chain BUY setup via the HTTP API, mirroring the MXN cross-chain + * corridor: quote to Arbitrum, register, presign the squid approve/swap + * (Polygon) and destination transfer (Arbitrum) blueprints exactly as + * issued, update — then script the fake world so the mint and gas are + * already on the ephemeral and the broadcast squid swap credits the bridged + * USDT on Arbitrum. + */ + async function setUpCrossChainOnrampRamp(currency: CurrencyCase): Promise { + world.alfredpay.onrampRate = currency.onrampRate; + // The bridge leg swaps the 6-decimal Polygon mint token into 6-decimal + // Arbitrum USDT; the fake route must report matching decimals. + world.squidRouter.toTokenDecimals = 6; + const ephemeral = privateKeyToAccount(generatePrivateKey()); + const destination = privateKeyToAccount(generatePrivateKey()).address as `0x${string}`; + + const user = await createTestUser(); + await createTestAlfredpayCustomer(user.id, { country: currency.country }); + const quote = await createQuoteViaApi({ + from: currency.rail, + inputAmount: currency.onrampInputAmount, + inputCurrency: currency.fiat, + network: Networks.Arbitrum, + outputCurrency: EvmToken.USDT, + rampType: RampDirection.BUY, + to: Networks.Arbitrum + }); + const ramp = await registerViaApi(quote.id, user.id, [{ address: ephemeral.address, type: "EVM" }], { + destinationAddress: destination + }); + + const persistedQuote = await QuoteTicket.findByPk(quote.id); + const mintAmountRaw = BigInt(persistedQuote?.metadata.alfredpayMint?.outputAmountRaw ?? "0"); + const bridgedAmountRaw = BigInt(persistedQuote?.metadata.evmToEvm?.outputAmountRaw ?? "0"); + expect(mintAmountRaw).toBeGreaterThan(0n); + expect(bridgedAmountRaw).toBeGreaterThan(0n); + + const registered = await RampState.findByPk(ramp.id); + const unsignedTxs: UnsignedTx[] = registered?.unsignedTxs ?? []; + const approveBlueprint = blueprintOf(unsignedTxs, "squidRouterApprove"); + const swapBlueprint = blueprintOf(unsignedTxs, "squidRouterSwap"); + const transferBlueprint = blueprintOf(unsignedTxs, "destinationTransfer"); + expect(approveBlueprint.network).toBe(Networks.Polygon); + expect(swapBlueprint.network).toBe(Networks.Polygon); + expect(transferBlueprint.network).toBe(Networks.Arbitrum); + + const approvePresign = await presignWithBackups(ephemeral, approveBlueprint); + const swapPresign = await presignWithBackups(ephemeral, swapBlueprint); + const transferPresign = await presignWithBackups(ephemeral, transferBlueprint); + await updateRampViaApi(ramp.id, user.id, { presignedTxs: [approvePresign, swapPresign, transferPresign] }); + + const transferTxData = transferBlueprint.txData as unknown as { data: `0x${string}` }; + const { args } = decodeFunctionData({ abi: erc20Abi, data: transferTxData.data }); + const amountRaw = (args as [string, bigint])[1]; + + world.evm.setNativeBalance(Networks.Polygon, ephemeral.address, parseUnits("2", 18)); + world.evm.setNativeBalance(Networks.Arbitrum, ephemeral.address, parseUnits("2", 18)); + world.evm.setErc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, ephemeral.address, mintAmountRaw); + applyErc20TransfersToLedger(); + const applyErc20Transfers = world.evm.onTransaction; + world.evm.onTransaction = tx => { + if (tx.serialized === swapPresign.txData) { + world.evm.setErc20Balance( + Networks.Arbitrum, + USDT_ON_ARBITRUM, + ephemeral.address, + world.evm.erc20Balance(Networks.Arbitrum, USDT_ON_ARBITRUM, ephemeral.address) + bridgedAmountRaw + ); + return; + } + applyErc20Transfers?.(tx); + }; + + return { + amountRaw, + destination, + quoteId: quote.id, + rampId: ramp.id, + signedSquidApprove: approvePresign.txData, + signedSquidSwap: swapPresign.txData + }; + } + + interface CrossChainOfframpSetup extends OfframpSetup { + ephemeralAddress: `0x${string}`; + userWalletAddress: `0x${string}`; + } + + /** + * Cross-chain SELL setup via the HTTP API on the no-permit fallback (the + * Alfredpay analog of the BRL cross-chain offramp's squid-hash flow): the + * user broadcasts the squid approve + swap from their own wallet on + * Arbitrum, the hashes are reported through /v1/ramp/update together with + * the presigned Polygon deposit transfer, and squidRouterPermitExecute + * verifies them against the blueprints before any ephemeral funds move. + */ + async function setUpCrossChainOfframpRamp(currency: CurrencyCase): Promise { + world.alfredpay.offrampRate = currency.offrampRate; + // The user's squid leg swaps 6-decimal Arbitrum USDT into 6-decimal + // Polygon USDT; the fake route must report matching decimals. + world.squidRouter.toTokenDecimals = 6; + const ephemeral = privateKeyToAccount(generatePrivateKey()); + const userWallet = privateKeyToAccount(generatePrivateKey()); + + failNoncesProbe(); + + const user = await createTestUser(); + await createTestAlfredpayCustomer(user.id, { country: currency.country }); + const quote = await createQuoteViaApi({ + from: Networks.Arbitrum, + inputAmount: currency.offrampInputAmount, + inputCurrency: EvmToken.USDT, + network: Networks.Arbitrum, + outputCurrency: currency.fiat, + rampType: RampDirection.SELL, + to: currency.rail + }); + const ramp = await registerViaApi(quote.id, user.id, [{ address: ephemeral.address, type: "EVM" }], { + fiatAccountId: "test-fiat-account-1", + walletAddress: userWallet.address + }); + + const persistedQuote = await QuoteTicket.findByPk(quote.id); + const inputAmountRaw = BigInt(persistedQuote?.metadata.alfredpayOfframp?.inputAmountRaw ?? "0"); + expect(inputAmountRaw).toBeGreaterThan(0n); + + const registered = await RampState.findByPk(ramp.id); + const allUnsignedTxs: UnsignedTx[] = registered?.unsignedTxs ?? []; + // The cross-chain no-permit branch: user-wallet squid approve + swap on + // the source chain instead of the direct Polygon transfer. + expect(allUnsignedTxs.some(tx => tx.phase === "squidRouterNoPermitTransfer")).toBe(false); + const approveBlueprint = blueprintOf(allUnsignedTxs, "squidRouterNoPermitApprove"); + const swapBlueprint = blueprintOf(allUnsignedTxs, "squidRouterNoPermitSwap"); + const offrampTransferBlueprint = blueprintOf(allUnsignedTxs, "alfredpayOfframpTransfer"); + expect(approveBlueprint.network).toBe(Networks.Arbitrum); + expect(swapBlueprint.network).toBe(Networks.Arbitrum); + expect(approveBlueprint.signer.toLowerCase()).toBe(userWallet.address.toLowerCase()); + expect(swapBlueprint.signer.toLowerCase()).toBe(userWallet.address.toLowerCase()); + + // The user broadcasts the squid leg from their own wallet; the frontend + // reports the hashes together with the presigned deposit transfer. + const approveHash = broadcastUserBlueprint(userWallet, approveBlueprint); + const swapHash = broadcastUserBlueprint(userWallet, swapBlueprint); + await updateRampViaApi(ramp.id, user.id, { + additionalData: { squidRouterNoPermitApproveHash: approveHash, squidRouterNoPermitSwapHash: swapHash }, + presignedTxs: [await presignWithBackups(ephemeral, offrampTransferBlueprint)] + }); + + // The squid-bridged USDT has already landed on the Polygon ephemeral, + // which also has Polygon gas. + world.evm.setNativeBalance(Networks.Polygon, ephemeral.address, parseUnits("2", 18)); + world.evm.setErc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, ephemeral.address, inputAmountRaw); + applyErc20TransfersToLedger(); + + return { + depositAddress: world.alfredpay.offrampDepositAddress, + ephemeralAddress: ephemeral.address, + inputAmountRaw, + quoteId: quote.id, + rampId: ramp.id, + userWalletAddress: userWallet.address as `0x${string}` + }; + } + for (const currency of CURRENCY_CASES) { it( `${currency.fiat} onramp (${currency.rail} → USDT on Polygon) completes and maps to Alfredpay ${currency.alfredpayCurrency}`, @@ -443,6 +721,47 @@ describe("Alfredpay currency corridors (USD/COP/ARS, on- and offramp)", () => { 30000 ); + it( + `${currency.fiat} cross-chain onramp (${currency.rail} → Polygon mint → USDT on Arbitrum) bridges via squid and completes`, + async () => { + const ordersBefore = world.alfredpay.onrampOrders.length; + const setup = await setUpCrossChainOnrampRamp(currency); + + // Registration requested a Polygon mint-token → Arbitrum USDT route + // for the ephemeral. + const registrationRoute = world.squidRouter.requestedRoutes.find( + route => + route.fromToken.toLowerCase() === ALFREDPAY_ERC20_TOKEN.toLowerCase() && + route.toToken.toLowerCase() === USDT_ON_ARBITRUM.toLowerCase() && + route.fromChain === "137" && + route.toChain === "42161" + ); + expect(registrationRoute, "registration should request a Polygon→Arbitrum route").toBeDefined(); + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("complete"); + expect(final?.phaseHistory.map(entry => entry.phase)).toEqual(CROSS_CHAIN_ONRAMP_PHASES); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + expect(final?.state.squidRouterApproveHash).toBeTruthy(); + expect(final?.state.squidRouterSwapHash).toBeTruthy(); + + // The order still carries this currency's Alfredpay code, and the + // destination received exactly the quoted USDT on ARBITRUM. + expect(world.alfredpay.onrampOrders.length).toBe(ordersBefore + 1); + const order = world.alfredpay.onrampOrders[world.alfredpay.onrampOrders.length - 1]; + expect(order.fromCurrency).toBe(currency.alfredpayCurrency as never); + expect(world.evm.sentTransactions.filter(tx => tx.serialized === setup.signedSquidApprove).length).toBe(1); + expect(world.evm.sentTransactions.filter(tx => tx.serialized === setup.signedSquidSwap).length).toBe(1); + expect(world.evm.erc20Balance(Networks.Arbitrum, USDT_ON_ARBITRUM, setup.destination)).toBe(setup.amountRaw); + + const quoteRow = await QuoteTicket.findByPk(setup.quoteId); + expect(quoteRow?.status).toBe("consumed"); + }, + 30000 + ); + it(`${currency.fiat} onramp quote beyond the per-currency maximum is rejected`, async () => { const details = getAnyFiatTokenDetails(currency.fiat); const maxBuyUnits = multiplyByPowerOfTen(Big(details.maxBuyAmountRaw), -details.decimals); @@ -509,4 +828,51 @@ describe("Alfredpay currency corridors (USD/COP/ARS, on- and offramp)", () => { 30000 ); } + + for (const currency of CROSS_CHAIN_OFFRAMP_CASES) { + it( + `${currency.fiat} cross-chain offramp (USDT on Arbitrum → squid → Polygon → ${currency.rail}) verifies the user's squid txs and completes`, + async () => { + const offrampOrdersBefore = world.alfredpay.offrampOrders.length; + const setup = await setUpCrossChainOfframpRamp(currency); + + // Registration requested an Arbitrum USDT → Polygon USDT route from + // the user's wallet, delivering to the ephemeral. + const registrationRoute = world.squidRouter.requestedRoutes.find( + route => + route.fromToken.toLowerCase() === USDT_ON_ARBITRUM.toLowerCase() && + route.toToken.toLowerCase() === ALFREDPAY_ERC20_TOKEN.toLowerCase() && + route.toAddress?.toLowerCase() === setup.ephemeralAddress.toLowerCase() + ); + expect(registrationRoute, "registration should request an Arbitrum→Polygon USDT route to the ephemeral").toBeDefined(); + expect(registrationRoute?.fromChain).toBe("42161"); + expect(registrationRoute?.toChain).toBe("137"); + expect(registrationRoute?.fromAddress.toLowerCase()).toBe(setup.userWalletAddress.toLowerCase()); + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("complete"); + expect(final?.phaseHistory.map(entry => entry.phase)).toEqual(OFFRAMP_PHASES); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + expect(final?.state.isNoPermitFallback).toBe(true); + expect(final?.state.isDirectTransfer).toBeFalsy(); + + // Per-currency contract with the anchor on the way out, unchanged by + // the cross-chain source: USDT in, this fiat's code out, deposit paid + // in full on Polygon. + expect(world.alfredpay.offrampOrders.length).toBe(offrampOrdersBefore + 1); + const order = world.alfredpay.offrampOrders[world.alfredpay.offrampOrders.length - 1]; + expect(order.fromCurrency).toBe("USDT" as never); + expect(order.toCurrency).toBe(currency.alfredpayCurrency as never); + expect(world.evm.erc20Balance(Networks.Polygon, ALFREDPAY_ERC20_TOKEN, setup.depositAddress)).toBe( + setup.inputAmountRaw + ); + + const quoteRow = await QuoteTicket.findByPk(setup.quoteId); + expect(quoteRow?.status).toBe("consumed"); + }, + 30000 + ); + } }); diff --git a/apps/api/src/tests/corridors/brl-onramp-crosschain.scenario.test.ts b/apps/api/src/tests/corridors/brl-onramp-crosschain.scenario.test.ts new file mode 100644 index 000000000..1e1cf7cf9 --- /dev/null +++ b/apps/api/src/tests/corridors/brl-onramp-crosschain.scenario.test.ts @@ -0,0 +1,386 @@ +import { afterAll, beforeAll, beforeEach, describe, expect, it } from "bun:test"; +import { + EvmToken, + evmTokenConfig, + FiatToken, + Networks, + RampDirection, + type RampPhase, + type UnsignedTx +} from "@vortexfi/shared"; +import { decodeFunctionData, erc20Abi, parseTransaction, parseUnits } from "viem"; +import { generatePrivateKey, privateKeyToAccount, type PrivateKeyAccount } from "viem/accounts"; +import phaseProcessor from "../../api/services/phases/phase-processor"; +import Partner from "../../models/partner.model"; +import QuoteTicket from "../../models/quoteTicket.model"; +import RampState from "../../models/rampState.model"; +import { resetTestDatabase, setupTestDatabase } from "../../test-utils/db"; +import { createTestTaxId, createTestUser } from "../../test-utils/factories"; +import { type FakeWorld, installFakeWorld } from "../../test-utils/fake-world"; +import { installFakeSupabaseAuth, testUserToken } from "../../test-utils/fake-world/fake-auth"; +import { startTestApp, type TestApp } from "../../test-utils/test-app"; + +function requireToken(network: Networks.Base | Networks.Arbitrum, token: EvmToken) { + const details = evmTokenConfig[network][token]; + if (!details) { + throw new Error(`${token} token config missing for ${network}`); + } + return details; +} +const USDC_ON_BASE = requireToken(Networks.Base, EvmToken.USDC).erc20AddressSourceChain as `0x${string}`; +const USDC_ON_ARBITRUM = requireToken(Networks.Arbitrum, EvmToken.USDC).erc20AddressSourceChain as `0x${string}`; +const BRLA_ON_BASE = requireToken(Networks.Base, EvmToken.BRLA).erc20AddressSourceChain as `0x${string}`; + +const TAX_ID = "12345678901"; + +const CHAIN_IDS: Partial> = { + [Networks.Arbitrum]: 42161, + [Networks.Base]: 8453 +}; + +// Unlike the direct pix→BRLA-on-Base corridor, the full swap-and-bridge chain +// executes here: Nabla swaps the minted BRLA into USDC on Base, the squid +// approve+swap bridge it to Arbitrum, and squidRouterPay settles via the +// destination-chain balance check before the Arbitrum payout. +const HAPPY_PATH_PHASES: RampPhase[] = [ + "initial", + "brlaOnrampMint", + "fundEphemeral", + "subsidizePreSwap", + "nablaApprove", + "nablaSwap", + "distributeFees", + "subsidizePostSwap", + "squidRouterSwap", + "squidRouterPay", + "finalSettlementSubsidy", + "destinationTransfer", + "complete" +]; + +interface CorridorSetup { + rampId: string; + quoteId: string; + /** Raw (6-decimal) USDC amount the presigned destination transfer pays out on Arbitrum. */ + amountRaw: bigint; + /** Raw (18-decimal) BRLA amount the Nabla swap consumes on Base. */ + swapInputRaw: bigint; + /** Raw (6-decimal) USDC amount the Nabla swap yields on Base. */ + swapOutputRaw: bigint; + /** Raw (6-decimal) USDC amount the squid bridge delivers on Arbitrum. */ + bridgedAmountRaw: bigint; + signedNablaSwap: `0x${string}`; + signedSquidApprove: `0x${string}`; + signedSquidSwap: `0x${string}`; + signedTransfer: `0x${string}`; + ephemeral: PrivateKeyAccount; + destination: `0x${string}`; +} + +/** + * Corridor scenario tests for the CROSS-CHAIN BRL onramp (pix → BRLA minted on + * Base → Nabla swap to USDC → SquidRouter bridge → USDC on Arbitrum). This is + * the route the resolver picks for any BRL BUY to a non-Base EVM destination + * (OnRampAveniaToEvmBase with the Base→EVM squid leg): quote and registration + * go through the real HTTP API, then the REAL PhaseProcessor drives the whole + * chain — mint, Nabla swap, squid approve+swap on Base, bridge settlement on + * Arbitrum, destination payout — against the fake external world. The direct + * BRL corridor and the MXN cross-chain corridor each cover only half of this + * path; failure modes of the shared handlers are covered in those files. + */ +describe("BRL onramp cross-chain corridor (pix → Base mint+swap → USDC on Arbitrum)", () => { + let world: FakeWorld; + let auth: { restore: () => void }; + let app: TestApp; + + beforeAll(async () => { + world = installFakeWorld(); + auth = installFakeSupabaseAuth(); + await setupTestDatabase(); + app = await startTestApp(); + }); + + afterAll(async () => { + await app?.close(); + auth?.restore(); + world?.restore(); + }); + + beforeEach(async () => { + await resetTestDatabase(); + // The EVM fee distribution transaction builder requires the vortex + // partner's EVM payout address even when the resulting fees are zero. + await Partner.update( + { payoutAddressEvm: "0x000000000000000000000000000000000000fee5" }, + { where: { name: "vortex", rampType: RampDirection.BUY } } + ); + world.evm.failNextSends = 0; + world.evm.onTransaction = undefined; + world.brla.onPixOutputTicket = undefined; + world.brla.accountBalances = { BRLA: 1_000_000, USDC: 0, USDM: 0, USDT: 0 }; + world.squidRouter.bridgeStatus = "success"; + // The bridge leg swaps 6-decimal Base USDC into 6-decimal Arbitrum USDC; + // the fake route must report matching decimals. + world.squidRouter.toTokenDecimals = 6; + // Deterministic Nabla quoter for BRLA (18 decimals) → USDC (6 decimals) at + // a flat 5 BRLA per USDC, matching the FakePrices 5 BRL/USD feed. + world.evm.onReadContract = (_network, params) => { + if (params.functionName === "quoteSwapExactTokensForTokens") { + const amountIn = params.args?.[0] as bigint; + return amountIn / 5n / 10n ** 12n; + } + return undefined; + }; + }); + + async function createQuoteViaApi(): Promise<{ id: string; outputAmount: string }> { + const response = await app.request("/v1/quotes", { + body: JSON.stringify({ + from: "pix", + inputAmount: "500", + inputCurrency: FiatToken.BRL, + network: Networks.Arbitrum, + outputCurrency: EvmToken.USDC, + rampType: RampDirection.BUY, + to: Networks.Arbitrum + }), + headers: { "Content-Type": "application/json" }, + method: "POST" + }); + expect(response.status, `quote creation failed: ${await response.clone().text()}`).toBe(201); + return (await response.json()) as { id: string; outputAmount: string }; + } + + async function registerViaApi( + quoteId: string, + userId: string, + ephemeral: PrivateKeyAccount, + destination: `0x${string}` + ): Promise<{ id: string }> { + const response = await app.request("/v1/ramp/register", { + body: JSON.stringify({ + additionalData: { destinationAddress: destination, taxId: TAX_ID }, + quoteId, + signingAccounts: [{ address: ephemeral.address, type: "EVM" }] + }), + headers: { + Authorization: `Bearer ${testUserToken(userId)}`, + "Content-Type": "application/json" + }, + method: "POST" + }); + expect(response.status, `registration failed: ${await response.clone().text()}`).toBe(201); + return (await response.json()) as { id: string }; + } + + function blueprintOf(unsignedTxs: UnsignedTx[], phase: RampPhase): UnsignedTx { + const blueprint = unsignedTxs.find(tx => tx.phase === phase); + expect(blueprint, `missing ${phase} blueprint in persisted ramp state`).toBeDefined(); + return blueprint as UnsignedTx; + } + + async function signBlueprint(ephemeral: PrivateKeyAccount, blueprint: UnsignedTx): Promise<`0x${string}`> { + const txData = blueprint.txData as unknown as { to: `0x${string}`; data: `0x${string}`; value?: string }; + const chainId = CHAIN_IDS[blueprint.network]; + if (!chainId) { + throw new Error(`No chain id mapped for ${blueprint.network}`); + } + return ephemeral.signTransaction({ + chainId, + data: txData.data, + gas: 600_000n, + maxFeePerGas: 5_000_000_000n, + maxPriorityFeePerGas: 5_000_000_000n, + nonce: blueprint.nonce, + to: txData.to, + type: "eip1559", + value: BigInt(txData.value ?? "0") + }); + } + + /** + * Creates quote + registration through the HTTP API, then signs the + * ephemeral phase blueprints exactly as issued — the Nabla pair and squid + * pair on Base plus the destination transfer on Arbitrum — and stores them + * as presigned transactions the way /v1/ramp/update would. + */ + async function setUpRegisteredRamp(): Promise { + const ephemeral = privateKeyToAccount(generatePrivateKey()); + const destination = privateKeyToAccount(generatePrivateKey()).address as `0x${string}`; + + const user = await createTestUser(); + await createTestTaxId(user.id, { taxId: TAX_ID }); + const quote = await createQuoteViaApi(); + const ramp = await registerViaApi(quote.id, user.id, ephemeral, destination); + + const persistedQuote = await QuoteTicket.findByPk(quote.id); + const swapInputRaw = BigInt(persistedQuote?.metadata.nablaSwapEvm?.inputAmountForSwapRaw ?? "0"); + const swapOutputRaw = BigInt(persistedQuote?.metadata.nablaSwapEvm?.outputAmountRaw ?? "0"); + const bridgedAmountRaw = BigInt(persistedQuote?.metadata.evmToEvm?.outputAmountRaw ?? "0"); + expect(swapInputRaw).toBeGreaterThan(0n); + expect(swapOutputRaw).toBeGreaterThan(0n); + expect(bridgedAmountRaw).toBeGreaterThan(0n); + + const rampState = await RampState.findByPk(ramp.id); + if (!rampState) { + throw new Error("Ramp state not found after registration"); + } + const unsignedTxs = rampState.unsignedTxs ?? []; + + const nablaApproveBlueprint = blueprintOf(unsignedTxs, "nablaApprove"); + const nablaSwapBlueprint = blueprintOf(unsignedTxs, "nablaSwap"); + const squidApproveBlueprint = blueprintOf(unsignedTxs, "squidRouterApprove"); + const squidSwapBlueprint = blueprintOf(unsignedTxs, "squidRouterSwap"); + const transferBlueprint = blueprintOf(unsignedTxs, "destinationTransfer"); + expect(squidApproveBlueprint.network).toBe(Networks.Base); + expect(squidSwapBlueprint.network).toBe(Networks.Base); + expect(transferBlueprint.network).toBe(Networks.Arbitrum); + + const signedNablaApprove = await signBlueprint(ephemeral, nablaApproveBlueprint); + const signedNablaSwap = await signBlueprint(ephemeral, nablaSwapBlueprint); + const signedSquidApprove = await signBlueprint(ephemeral, squidApproveBlueprint); + const signedSquidSwap = await signBlueprint(ephemeral, squidSwapBlueprint); + const signedTransfer = await signBlueprint(ephemeral, transferBlueprint); + + const presign = (blueprint: UnsignedTx, txData: `0x${string}`) => ({ + meta: {}, + network: blueprint.network, + nonce: blueprint.nonce, + phase: blueprint.phase, + signer: ephemeral.address, + txData + }); + + await rampState.update({ + presignedTxs: [ + presign(nablaApproveBlueprint, signedNablaApprove), + presign(nablaSwapBlueprint, signedNablaSwap), + presign(squidApproveBlueprint, signedSquidApprove), + presign(squidSwapBlueprint, signedSquidSwap), + presign(transferBlueprint, signedTransfer) + ] + }); + + const transferTxData = transferBlueprint.txData as unknown as { data: `0x${string}` }; + const { args } = decodeFunctionData({ abi: erc20Abi, data: transferTxData.data }); + const amountRaw = (args as [string, bigint])[1]; + + return { + amountRaw, + bridgedAmountRaw, + destination, + ephemeral, + quoteId: quote.id, + rampId: ramp.id, + signedNablaSwap, + signedSquidApprove, + signedSquidSwap, + signedTransfer, + swapInputRaw, + swapOutputRaw + }; + } + + /** + * Scripts the fake world so every polling loop succeeds on its first check: + * - the Avenia subaccount holds the minted BRL and the mint ticket credits + * the ephemeral's BRLA on Base instantly, + * - the ephemeral has gas on Base AND Arbitrum (destination funding), + * - the broadcast Nabla swap credits the ephemeral's Base USDC, + * - the broadcast squid swap credits the bridged USDC on Arbitrum, + * - raw ERC-20 transfers are applied to the in-memory ledger. + */ + function scriptHappyWorld(setup: CorridorSetup): void { + world.evm.setNativeBalance(Networks.Base, setup.ephemeral.address, parseUnits("2", 18)); + world.evm.setNativeBalance(Networks.Arbitrum, setup.ephemeral.address, parseUnits("2", 18)); + world.brla.onPixOutputTicket = ({ walletAddress }) => { + if (walletAddress) { + // Generous credit (same as the direct corridor): the mint handler + // polls for the full live-quote amount, which sits slightly above the + // pre-computed swap input. + world.evm.setErc20Balance(Networks.Base, BRLA_ON_BASE, walletAddress, parseUnits("1000000", 18)); + } + }; + world.evm.onTransaction = tx => { + if (tx.serialized === setup.signedNablaSwap) { + world.evm.setErc20Balance(Networks.Base, USDC_ON_BASE, setup.ephemeral.address, setup.swapOutputRaw); + return; + } + if (tx.serialized === setup.signedSquidSwap) { + world.evm.setErc20Balance( + Networks.Arbitrum, + USDC_ON_ARBITRUM, + setup.ephemeral.address, + world.evm.erc20Balance(Networks.Arbitrum, USDC_ON_ARBITRUM, setup.ephemeral.address) + setup.bridgedAmountRaw + ); + return; + } + const parsed = tx.serialized ? parseTransaction(tx.serialized as `0x${string}`) : { data: tx.data, to: tx.to }; + if (!parsed.to || !parsed.data) { + return; + } + let decoded: { functionName: string; args: readonly unknown[] }; + try { + decoded = decodeFunctionData({ abi: erc20Abi, data: parsed.data as `0x${string}` }); + } catch { + return; + } + if (decoded.functionName !== "transfer") { + return; + } + const [recipient, amount] = decoded.args as [`0x${string}`, bigint]; + world.evm.setErc20Balance( + tx.network, + parsed.to, + recipient, + world.evm.erc20Balance(tx.network, parsed.to, recipient) + amount + ); + }; + } + + function submissionsOf(signedTx: `0x${string}`): number { + return world.evm.sentTransactions.filter(tx => tx.serialized === signedTx).length; + } + + it( + "happy path: mints on Base, swaps BRLA to USDC via Nabla, bridges via squid, and pays the destination on Arbitrum", + async () => { + const setup = await setUpRegisteredRamp(); + scriptHappyWorld(setup); + const pixOutBefore = world.brla.pixOutputTickets.length; + + // Registration requested a Base USDC → Arbitrum USDC squid route. + const registrationRoute = world.squidRouter.requestedRoutes.find( + route => + route.fromToken.toLowerCase() === USDC_ON_BASE.toLowerCase() && + route.toToken.toLowerCase() === USDC_ON_ARBITRUM.toLowerCase() && + route.fromChain === "8453" && + route.toChain === "42161" + ); + expect(registrationRoute, "registration should request a Base→Arbitrum USDC route").toBeDefined(); + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("complete"); + expect(final?.phaseHistory.map(entry => entry.phase)).toEqual(HAPPY_PATH_PHASES); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + expect(final?.state.squidRouterApproveHash).toBeTruthy(); + expect(final?.state.squidRouterSwapHash).toBeTruthy(); + + const quote = await QuoteTicket.findByPk(setup.quoteId); + expect(quote?.status).toBe("consumed"); + + // The full Avenia mint flow ran, the Nabla swap and both squid legs each + // hit Base exactly once, and the destination received exactly the quoted + // USDC on Arbitrum. + expect(world.brla.pixOutputTickets.length).toBe(pixOutBefore + 1); + expect(submissionsOf(setup.signedNablaSwap)).toBe(1); + expect(submissionsOf(setup.signedSquidApprove)).toBe(1); + expect(submissionsOf(setup.signedSquidSwap)).toBe(1); + expect(submissionsOf(setup.signedTransfer)).toBe(1); + expect(world.evm.erc20Balance(Networks.Arbitrum, USDC_ON_ARBITRUM, setup.destination)).toBe(setup.amountRaw); + }, + 30000 + ); +}); From b7fa953ae281693d876c8cd77ae49225a9c93578 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 18:23:42 +0200 Subject: [PATCH 167/176] Add hermetic EUR corridor scenarios to meet the re-enablement precondition --- .../corridors/eur-offramp.scenario.test.ts | 485 ++++++++++++++++++ .../corridors/eur-onramp.scenario.test.ts | 423 +++++++++++++++ 2 files changed, 908 insertions(+) create mode 100644 apps/api/src/tests/corridors/eur-offramp.scenario.test.ts create mode 100644 apps/api/src/tests/corridors/eur-onramp.scenario.test.ts diff --git a/apps/api/src/tests/corridors/eur-offramp.scenario.test.ts b/apps/api/src/tests/corridors/eur-offramp.scenario.test.ts new file mode 100644 index 000000000..07151bc2e --- /dev/null +++ b/apps/api/src/tests/corridors/eur-offramp.scenario.test.ts @@ -0,0 +1,485 @@ +import { afterAll, beforeAll, beforeEach, describe, expect, it } from "bun:test"; +import { + EphemeralAccountType, + EvmToken, + evmTokenConfig, + FiatToken, + MykoboTransactionStatus, + MykoboTransactionType, + Networks, + RampDirection, + type RampPhase, + type UnsignedTx +} from "@vortexfi/shared"; +import { decodeFunctionData, erc20Abi, parseTransaction, parseUnits } from "viem"; +import { generatePrivateKey, privateKeyToAccount, type PrivateKeyAccount } from "viem/accounts"; +import phaseProcessor from "../../api/services/phases/phase-processor"; +import { validateEphemeralAccountsFresh } from "../../api/services/ramp/ephemeral-freshness"; +import { normalizeAndValidateSigningAccounts } from "../../api/services/ramp/ramp.service"; +import { prepareOfframpTransactions } from "../../api/services/transactions/offramp"; +import Partner from "../../models/partner.model"; +import QuoteTicket from "../../models/quoteTicket.model"; +import RampState from "../../models/rampState.model"; +import Subsidy from "../../models/subsidy.model"; +import type { SubsidyToken } from "../../models/subsidy.model"; +import { resetTestDatabase, setupTestDatabase } from "../../test-utils/db"; +import { createTestRampState, createTestUser } from "../../test-utils/factories"; +import { type FakeWorld, installFakeWorld } from "../../test-utils/fake-world"; +import { installFakeSupabaseAuth, testUserToken } from "../../test-utils/fake-world/fake-auth"; +import { startTestApp, type TestApp } from "../../test-utils/test-app"; + +function requireBaseToken(token: EvmToken) { + const details = evmTokenConfig[Networks.Base][token]; + if (!details) { + throw new Error(`${token} token config missing for Base`); + } + return details; +} +const USDC_ON_BASE = requireBaseToken(EvmToken.USDC).erc20AddressSourceChain as `0x${string}`; +const EURC_ON_BASE = requireBaseToken(EvmToken.EURC).erc20AddressSourceChain as `0x${string}`; + +const IP_ADDRESS = "203.0.113.7"; + +const HAPPY_PATH_PHASES: RampPhase[] = [ + "initial", + "fundEphemeral", + "distributeFees", + "subsidizePreSwap", + "nablaApprove", + "nablaSwap", + "subsidizePostSwap", + "mykoboPayoutOnBase", + "complete" +]; + +interface CorridorSetup { + rampId: string; + quoteId: string; + /** Raw (6-decimal) USDC amount the Nabla swap consumes. */ + swapInputRaw: bigint; + /** Raw (6-decimal) EURC amount the swap yields. */ + swapOutputRaw: bigint; + /** Raw (6-decimal) EURC amount the payout transfers to Mykobo's receivables. */ + payoutAmountRaw: bigint; + signedNablaSwap: `0x${string}`; + signedPayout: `0x${string}`; + ephemeral: PrivateKeyAccount; + mykoboTransactionId: string; + receivablesAddress: string; +} + +/** + * Corridor scenario tests for the EUR offramp (USDC on Base → SEPA via + * Mykobo): the quote goes through the real HTTP API; registration is seeded + * through the SAME code the registration service runs below its EUR + * kill-switch (`registerRamp` throws 503 for EURC quotes before preparing any + * transaction, so the HTTP entry point is unavailable — the seeding helper + * mirrors only the thin glue and calls the REAL `prepareOfframpTransactions`, + * which resolves the KYC-gated Mykobo customer, creates the WITHDRAW intent + * and builds all blueprints). The REAL PhaseProcessor then drives initial → + * fundEphemeral → distributeFees → subsidizePreSwap → nablaApprove → + * nablaSwap → subsidizePostSwap → mykoboPayoutOnBase → complete against the + * fake external world. + * + * This is the hermetic-coverage precondition documented next to the + * kill-switch and in docs/testing-strategy.md ("EUR re-enablement + * precondition"). The kill-switch itself stays on; once lifted, replace the + * seeding helper with a plain POST /v1/ramp/register like the BRL corridor. + */ +describe("EUR offramp corridor (USDC on Base → SEPA via Mykobo)", () => { + let world: FakeWorld; + let auth: { restore: () => void }; + let app: TestApp; + + beforeAll(async () => { + world = installFakeWorld(); + auth = installFakeSupabaseAuth(); + await setupTestDatabase(); + app = await startTestApp(); + }); + + afterAll(async () => { + await app?.close(); + auth?.restore(); + world?.restore(); + }); + + beforeEach(async () => { + await resetTestDatabase(); + // The EVM fee distribution transaction builder requires the vortex + // partner's EVM payout address even when the resulting fees are zero. + await Partner.update( + { payoutAddressEvm: "0x000000000000000000000000000000000000fee5" }, + { where: { name: "vortex", rampType: RampDirection.SELL } } + ); + world.evm.failNextSends = 0; + world.evm.onTransaction = undefined; + world.mykobo.failNextIntent = null; + world.mykobo.profileKycReviewStatus = "approved"; + // Fresh receivables address per test: the in-memory EVM ledger persists + // across tests, so a shared payout recipient would accumulate balances. + world.mykobo.withdrawReceivablesAddress = privateKeyToAccount(generatePrivateKey()).address.toLowerCase(); + // The initialize stage bridges Base USDC → Base USDC: the fake route's + // destination token must report USDC's 6 decimals or the quote pipeline + // mis-scales the swap input and pads the whole output with subsidy. + world.squidRouter.toTokenDecimals = 6; + // Deterministic Nabla quoter for USDC → EURC (both 6 decimals) at a flat + // 0.9 EURC per USDC, matching the FakePrices 0.9 EUR/USD feed. The EURC + // token itself shares the euro peg for USD conversions. + world.prices.perUsd.eurc = 0.9; + world.evm.onReadContract = (_network, params) => { + if (params.functionName === "quoteSwapExactTokensForTokens") { + const amountIn = params.args?.[0] as bigint; + return (amountIn * 9n) / 10n; + } + return undefined; + }; + }); + + async function createQuoteViaApi(): Promise<{ id: string; outputAmount: string }> { + const response = await app.request("/v1/quotes", { + body: JSON.stringify({ + from: Networks.Base, + inputAmount: "100", + inputCurrency: EvmToken.USDC, + network: Networks.Base, + outputCurrency: FiatToken.EURC, + rampType: RampDirection.SELL, + to: "sepa" + }), + headers: { "Content-Type": "application/json" }, + method: "POST" + }); + expect(response.status).toBe(201); + return (await response.json()) as { id: string; outputAmount: string }; + } + + /** + * Kill-switch check: the REAL /v1/ramp/register endpoint must keep refusing + * EUR quotes with 503 until the re-enablement precondition is lifted. The + * seeding below deliberately starts where this rejection ends. + */ + async function assertRegisterEndpointStillKillSwitched(quoteId: string, userId: string, wallet: string): Promise { + const response = await app.request("/v1/ramp/register", { + body: JSON.stringify({ + additionalData: { destinationAddress: wallet, ipAddress: IP_ADDRESS, walletAddress: wallet }, + quoteId, + signingAccounts: [{ address: wallet, type: "EVM" }] + }), + headers: { + Authorization: `Bearer ${testUserToken(userId)}`, + "Content-Type": "application/json" + }, + method: "POST" + }); + expect(response.status).toBe(503); + } + + function blueprintOf(unsignedTxs: UnsignedTx[], phase: RampPhase): UnsignedTx { + const blueprint = unsignedTxs.find(tx => tx.phase === phase); + expect(blueprint, `missing ${phase} blueprint in persisted ramp state`).toBeDefined(); + return blueprint as UnsignedTx; + } + + async function signBlueprint(ephemeral: PrivateKeyAccount, blueprint: UnsignedTx): Promise<`0x${string}`> { + const txData = blueprint.txData as unknown as { to: `0x${string}`; data: `0x${string}`; value?: string }; + return ephemeral.signTransaction({ + chainId: 8453, + data: txData.data, + gas: 600_000n, + maxFeePerGas: 5_000_000_000n, + maxPriorityFeePerGas: 5_000_000_000n, + nonce: blueprint.nonce, + to: txData.to, + type: "eip1559", + value: BigInt(txData.value ?? "0") + }); + } + + /** + * Registers the ramp exactly as `RampService.registerRamp` would if the EUR + * kill-switch were lifted: signing-account normalization, ephemeral + * freshness validation, the REAL offramp transaction preparation (which + * creates the Mykobo WITHDRAW intent), quote consumption, and a RampState + * row with the identical shape. Then signs the ephemeral blueprints exactly + * as issued and stores them the way /v1/ramp/update would, and broadcasts + * the user's source-of-funds USDC transfer whose hash fundEphemeral + * verifies against the blueprint. + */ + async function setUpRegisteredRamp(): Promise { + const ephemeral = privateKeyToAccount(generatePrivateKey()); + const userWallet = privateKeyToAccount(generatePrivateKey()); + + const user = await createTestUser(); + const quote = await createQuoteViaApi(); + await assertRegisterEndpointStillKillSwitched(quote.id, user.id, userWallet.address); + + const persistedQuote = await QuoteTicket.findByPk(quote.id); + if (!persistedQuote) { + throw new Error("Quote not persisted"); + } + const swapInputRaw = BigInt(persistedQuote.metadata.nablaSwapEvm?.inputAmountForSwapRaw ?? "0"); + const swapOutputRaw = BigInt(persistedQuote.metadata.nablaSwapEvm?.outputAmountRaw ?? "0"); + expect(swapInputRaw).toBeGreaterThan(0n); + expect(swapOutputRaw).toBeGreaterThan(0n); + + const additionalData = { + destinationAddress: userWallet.address, + ipAddress: IP_ADDRESS, + walletAddress: userWallet.address + }; + const { normalizedSigningAccounts, ephemerals } = normalizeAndValidateSigningAccounts([ + { address: ephemeral.address, type: EphemeralAccountType.EVM } + ]); + await validateEphemeralAccountsFresh(ephemerals); + + const { unsignedTxs, stateMeta } = await prepareOfframpTransactions({ + destinationAddress: additionalData.destinationAddress, + ipAddress: additionalData.ipAddress, + quote: persistedQuote, + signingAccounts: normalizedSigningAccounts, + userAddress: additionalData.walletAddress, + userId: user.id + }); + + const [consumed] = await QuoteTicket.update( + { status: "consumed" }, + { where: { id: persistedQuote.id, status: "pending" } } + ); + expect(consumed).toBe(1); + + const rampState = await createTestRampState({ + currentPhase: "initial", + from: persistedQuote.from, + paymentMethod: persistedQuote.paymentMethod, + phaseHistory: [{ phase: "initial", timestamp: new Date() }], + quoteId: persistedQuote.id, + state: { + evmEphemeralAddress: ephemerals.EVM, + substrateEphemeralAddress: ephemerals.Substrate, + ...additionalData, + ...stateMeta + } as unknown as RampState["state"], + to: persistedQuote.to, + type: persistedQuote.rampType, + unsignedTxs, + userId: user.id + }); + + const nablaApproveBlueprint = blueprintOf(unsignedTxs, "nablaApprove"); + const nablaSwapBlueprint = blueprintOf(unsignedTxs, "nablaSwap"); + const payoutBlueprint = blueprintOf(unsignedTxs, "mykoboPayoutOnBase"); + + const payoutData = payoutBlueprint.txData as unknown as { to: `0x${string}`; data: `0x${string}` }; + const decodedPayout = decodeFunctionData({ abi: erc20Abi, data: payoutData.data }); + const [payoutRecipient, payoutAmountRaw] = decodedPayout.args as [string, bigint]; + expect(payoutRecipient.toLowerCase()).toBe(world.mykobo.withdrawReceivablesAddress); + + const signedNablaApprove = await signBlueprint(ephemeral, nablaApproveBlueprint); + const signedNablaSwap = await signBlueprint(ephemeral, nablaSwapBlueprint); + const signedPayout = await signBlueprint(ephemeral, payoutBlueprint); + + const presign = (blueprint: UnsignedTx, txData: `0x${string}`) => ({ + meta: {}, + network: blueprint.network, + nonce: blueprint.nonce, + phase: blueprint.phase, + signer: ephemeral.address, + txData + }); + + // The user broadcasts the source-of-funds USDC transfer from their own + // wallet; fundEphemeral verifies the reported hash against the blueprint. + const userBlueprint = blueprintOf(unsignedTxs, "squidRouterNoPermitTransfer"); + const userTxData = userBlueprint.txData as unknown as { to: `0x${string}`; data: `0x${string}` }; + const userTxHash = world.evm.broadcastUserTransaction(Networks.Base, userWallet.address, { + data: userTxData.data, + to: userTxData.to, + value: 0n + }); + + await rampState.update({ + presignedTxs: [ + presign(nablaApproveBlueprint, signedNablaApprove), + presign(nablaSwapBlueprint, signedNablaSwap), + presign(payoutBlueprint, signedPayout) + ], + state: { ...rampState.state, squidRouterNoPermitTransferHash: userTxHash } + }); + + return { + ephemeral, + mykoboTransactionId: stateMeta.mykoboTransactionId as string, + payoutAmountRaw, + quoteId: persistedQuote.id, + rampId: rampState.id, + receivablesAddress: world.mykobo.withdrawReceivablesAddress, + signedNablaSwap, + signedPayout, + swapInputRaw, + swapOutputRaw + }; + } + + /** + * Scripts the fake world for the happy path: + * - the ephemeral has Base gas and the user's USDC already arrived, short by + * `usdcShortfallRaw` so subsidizePreSwap tops it up from the funding wallet, + * - raw ERC-20 transfers are applied to the in-memory ledger, + * - the broadcast Nabla swap credits the ephemeral's EURC at the quoted output, + * - Mykobo reports the withdraw transaction as COMPLETED once polled. + */ + function scriptHappyWorld(setup: CorridorSetup, options: { usdcShortfallRaw?: bigint } = {}): void { + const shortfall = options.usdcShortfallRaw ?? 0n; + world.evm.setNativeBalance(Networks.Base, setup.ephemeral.address, parseUnits("2", 18)); + world.evm.setErc20Balance(Networks.Base, USDC_ON_BASE, setup.ephemeral.address, setup.swapInputRaw - shortfall); + world.mykobo.setTransactionStatus(setup.mykoboTransactionId, MykoboTransactionStatus.COMPLETED); + world.evm.onTransaction = tx => { + if (tx.serialized === setup.signedNablaSwap) { + world.evm.setErc20Balance(Networks.Base, EURC_ON_BASE, setup.ephemeral.address, setup.swapOutputRaw); + return; + } + const parsed = tx.serialized ? parseTransaction(tx.serialized as `0x${string}`) : { data: tx.data, to: tx.to }; + if (!parsed.to || !parsed.data) { + return; + } + let decoded: { functionName: string; args: readonly unknown[] }; + try { + decoded = decodeFunctionData({ abi: erc20Abi, data: parsed.data as `0x${string}` }); + } catch { + return; + } + if (decoded.functionName !== "transfer") { + return; + } + const [recipient, amount] = decoded.args as [`0x${string}`, bigint]; + world.evm.setErc20Balance( + tx.network, + parsed.to, + recipient, + world.evm.erc20Balance(tx.network, parsed.to, recipient) + amount + ); + }; + } + + function submissionsOf(signedTransfer: `0x${string}`): number { + return world.evm.sentTransactions.filter(tx => tx.serialized === signedTransfer).length; + } + + it( + "happy path: swap corridor completes with a capped pre-swap subsidy and pays Mykobo's receivables in full", + async () => { + const setup = await setUpRegisteredRamp(); + // 1 USDC short of the swap input: well below the 5% subsidy cap. + const shortfall = parseUnits("1", 6); + scriptHappyWorld(setup, { usdcShortfallRaw: shortfall }); + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("complete"); + expect(final?.phaseHistory.map(entry => entry.phase)).toEqual(HAPPY_PATH_PHASES); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + + // Quote stays consumed and the pre-swap shortfall was subsidized once. + const quote = await QuoteTicket.findByPk(setup.quoteId); + expect(quote?.status).toBe("consumed"); + const subsidies = await Subsidy.findAll(); + expect(subsidies.length).toBe(1); + expect(subsidies[0].token).toBe(EvmToken.USDC as unknown as SubsidyToken); + expect(Number(subsidies[0].amount)).toBeCloseTo(1); + expect(subsidies[0].phase).toBe("subsidizePreSwap"); + + // The swap and payout were each broadcast exactly once; Mykobo's + // receivables wallet received exactly the intent value in EURC. + expect(submissionsOf(setup.signedNablaSwap)).toBe(1); + expect(submissionsOf(setup.signedPayout)).toBe(1); + expect(world.evm.erc20Balance(Networks.Base, EURC_ON_BASE, setup.receivablesAddress)).toBe(setup.payoutAmountRaw); + + // Registration created exactly one WITHDRAW intent whose 2-decimal value + // matches the on-chain payout (Mykobo truncates to cents). + const intents = world.mykobo.intents.filter(intent => intent.wallet_address === setup.ephemeral.address); + expect(intents.length).toBe(1); + expect(intents[0].transaction_type).toBe(MykoboTransactionType.WITHDRAW); + expect(parseUnits(intents[0].value, 6)).toBe(setup.payoutAmountRaw); + }, + 30000 + ); + + it( + "transient failure: a scripted RPC outage on the payout is recorded as recoverable and the corridor still completes", + async () => { + const setup = await setUpRegisteredRamp(); + scriptHappyWorld(setup); + // Arm the outage once the swap has landed so it hits the NEXT broadcast — + // the mykoboPayoutOnBase transfer, whose send failures are recoverable. + const applyLedgerEffects = world.evm.onTransaction; + world.evm.sendFailureMessage = "FakeEvm: scripted RPC outage"; + world.evm.onTransaction = tx => { + applyLedgerEffects?.(tx); + if (tx.serialized === setup.signedNablaSwap) { + world.evm.failNextSends = 1; + } + }; + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("complete"); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + // The payout handler wraps broadcast errors in its own recoverable message. + const outageLogs = final?.errorLogs.filter(log => log.error.includes("Failed to send Mykobo payout transaction")) ?? []; + expect(outageLogs.length).toBeGreaterThanOrEqual(1); + expect(outageLogs.every(log => log.phase === "mykoboPayoutOnBase")).toBe(true); + expect(outageLogs.some(log => log.recoverable === true)).toBe(true); + expect(world.evm.erc20Balance(Networks.Base, EURC_ON_BASE, setup.receivablesAddress)).toBe(setup.payoutAmountRaw); + }, + 30000 + ); + + it( + "unrecoverable failure: a FAILED Mykobo withdraw transaction fails the ramp during mykoboPayoutOnBase", + async () => { + const setup = await setUpRegisteredRamp(); + scriptHappyWorld(setup); + world.mykobo.setTransactionStatus(setup.mykoboTransactionId, MykoboTransactionStatus.FAILED); + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("failed"); + expect(final?.phaseHistory.map(entry => entry.phase)).not.toContain("complete"); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + expect(final?.errorLogs.some(log => log.error.includes("ended with status FAILED"))).toBe(true); + }, + 30000 + ); + + it( + "registration guard: a Mykobo WITHDRAW intent failure aborts the registration path before any blueprint exists", + async () => { + const user = await createTestUser(); + const quote = await createQuoteViaApi(); + const persistedQuote = await QuoteTicket.findByPk(quote.id); + const ephemeral = privateKeyToAccount(generatePrivateKey()); + const userWallet = privateKeyToAccount(generatePrivateKey()); + world.mykobo.failNextIntent = new Error("FakeMykobo: scripted intent failure"); + + const { normalizedSigningAccounts } = normalizeAndValidateSigningAccounts([ + { address: ephemeral.address, type: EphemeralAccountType.EVM } + ]); + await expect( + prepareOfframpTransactions({ + destinationAddress: userWallet.address, + ipAddress: IP_ADDRESS, + quote: persistedQuote as QuoteTicket, + signingAccounts: normalizedSigningAccounts, + userAddress: userWallet.address, + userId: user.id + }) + ).rejects.toThrow("scripted intent failure"); + expect((await QuoteTicket.findByPk(quote.id))?.status).toBe("pending"); + }, + 30000 + ); +}); diff --git a/apps/api/src/tests/corridors/eur-onramp.scenario.test.ts b/apps/api/src/tests/corridors/eur-onramp.scenario.test.ts new file mode 100644 index 000000000..084d93296 --- /dev/null +++ b/apps/api/src/tests/corridors/eur-onramp.scenario.test.ts @@ -0,0 +1,423 @@ +import { afterAll, beforeAll, beforeEach, describe, expect, it } from "bun:test"; +import { + EphemeralAccountType, + EvmToken, + evmTokenConfig, + FiatToken, + type IbanPaymentData, + MykoboApiService, + MykoboCurrency, + MykoboCustomerStatus, + MykoboTransactionType, + Networks, + RampDirection, + type RampPhase, + type UnsignedTx +} from "@vortexfi/shared"; +import Big from "big.js"; +import { decodeFunctionData, encodeFunctionData, erc20Abi, parseTransaction, parseUnits } from "viem"; +import { generatePrivateKey, privateKeyToAccount, type PrivateKeyAccount } from "viem/accounts"; +import phaseProcessor from "../../api/services/phases/phase-processor"; +import { resolveMykoboCustomerForUser } from "../../api/services/mykobo/mykobo-customer.service"; +import { normalizeAndValidateSigningAccounts } from "../../api/services/ramp/ramp.service"; +import { validateEphemeralAccountsFresh } from "../../api/services/ramp/ephemeral-freshness"; +import { prepareMykoboToEvmOnrampTransactions } from "../../api/services/transactions/onramp/routes/mykobo-to-evm"; +import MykoboCustomer from "../../models/mykoboCustomer.model"; +import QuoteTicket from "../../models/quoteTicket.model"; +import RampState from "../../models/rampState.model"; +import { resetTestDatabase, setupTestDatabase } from "../../test-utils/db"; +import { createTestRampState, createTestUser } from "../../test-utils/factories"; +import { type FakeWorld, installFakeWorld } from "../../test-utils/fake-world"; +import { installFakeSupabaseAuth, testUserToken } from "../../test-utils/fake-world/fake-auth"; +import { startTestApp, type TestApp } from "../../test-utils/test-app"; + +function requireEurcOnBase() { + const details = evmTokenConfig[Networks.Base][EvmToken.EURC]; + if (!details) { + throw new Error("EURC token config missing for Base"); + } + return details; +} +const eurcTokenDetails = requireEurcOnBase(); +const EURC_ON_BASE = eurcTokenDetails.erc20AddressSourceChain as `0x${string}`; + +const IP_ADDRESS = "203.0.113.7"; + +const HAPPY_PATH_PHASES: RampPhase[] = ["initial", "mykoboOnrampDeposit", "fundEphemeral", "destinationTransfer", "complete"]; + +interface CorridorSetup { + rampId: string; + quoteId: string; + /** Raw (6-decimal) EURC amount Mykobo settles on the ephemeral (input minus anchor fee). */ + mykoboMintRaw: bigint; + /** Raw (6-decimal) EURC amount the presigned transfer pays out. */ + amountRaw: bigint; + signedTransfer: `0x${string}`; + ephemeral: PrivateKeyAccount; + destination: `0x${string}`; + mykoboTransactionId: string; +} + +/** + * Corridor scenario tests for the EUR onramp direct path (SEPA → EURC on Base + * via Mykobo): the quote goes through the real HTTP API; registration is then + * seeded through the SAME code the registration service runs below its EUR + * kill-switch (`registerRamp` in ramp.service.ts throws 503 for EURC quotes + * BEFORE preparing transactions, so the HTTP entry point is unavailable — see + * `registerEurOnrampBelowKillSwitch` below). The REAL PhaseProcessor then + * drives initial → mykoboOnrampDeposit → fundEphemeral → destinationTransfer + * → complete against the fake external world. + * + * This scenario is the hermetic-coverage precondition documented next to the + * kill-switch and in docs/testing-strategy.md ("EUR re-enablement + * precondition"). The kill-switch itself stays on; once it is lifted, replace + * the seeding helper with a plain POST /v1/ramp/register like the BRL/MXN + * corridor files. + */ +describe("EUR onramp direct corridor (SEPA → EURC on Base via Mykobo)", () => { + let world: FakeWorld; + let auth: { restore: () => void }; + let app: TestApp; + + beforeAll(async () => { + world = installFakeWorld(); + auth = installFakeSupabaseAuth(); + await setupTestDatabase(); + app = await startTestApp(); + }); + + afterAll(async () => { + await app?.close(); + auth?.restore(); + world?.restore(); + }); + + beforeEach(async () => { + await resetTestDatabase(); + world.evm.failNextSends = 0; + world.evm.onTransaction = undefined; + world.mykobo.failNextIntent = null; + world.mykobo.profileKycReviewStatus = "approved"; + }); + + async function createQuoteViaApi(): Promise<{ id: string; outputAmount: string }> { + const response = await app.request("/v1/quotes", { + body: JSON.stringify({ + from: "sepa", + inputAmount: "100", + inputCurrency: FiatToken.EURC, + network: Networks.Base, + outputCurrency: EvmToken.EURC, + rampType: RampDirection.BUY, + to: Networks.Base + }), + headers: { "Content-Type": "application/json" }, + method: "POST" + }); + expect(response.status).toBe(201); + return (await response.json()) as { id: string; outputAmount: string }; + } + + /** + * Kill-switch check: the REAL /v1/ramp/register endpoint must keep refusing + * EUR quotes with 503 until the re-enablement precondition is lifted. The + * seeding below deliberately starts where this rejection ends. + */ + async function assertRegisterEndpointStillKillSwitched(quoteId: string, userId: string, destination: string): Promise { + const response = await app.request("/v1/ramp/register", { + body: JSON.stringify({ + additionalData: { destinationAddress: destination, ipAddress: IP_ADDRESS }, + quoteId, + signingAccounts: [{ address: destination, type: "EVM" }] + }), + headers: { + Authorization: `Bearer ${testUserToken(userId)}`, + "Content-Type": "application/json" + }, + method: "POST" + }); + expect(response.status).toBe(503); + } + + /** + * Registers the ramp exactly as `RampService.registerRamp` would if the EUR + * kill-switch were lifted, by running the same sequence of service calls the + * method performs below the switch (ramp.service.ts): signing-account + * normalization, ephemeral freshness validation, the Mykobo customer/KYC + * resolution + deposit intent (mirroring prepareMykoboOnrampTransactions), + * the REAL transaction builder, quote consumption, and a RampState row with + * the identical shape. No registration logic is re-implemented — only the + * thin glue is mirrored. + */ + async function registerEurOnrampBelowKillSwitch( + quote: QuoteTicket, + userId: string, + ephemeral: PrivateKeyAccount, + destination: `0x${string}` + ): Promise { + const additionalData = { destinationAddress: destination, ipAddress: IP_ADDRESS }; + + const { normalizedSigningAccounts, ephemerals } = normalizeAndValidateSigningAccounts([ + { address: ephemeral.address, type: EphemeralAccountType.EVM } + ]); + await validateEphemeralAccountsFresh(ephemerals); + + // Mirrors prepareMykoboOnrampTransactions: derive the Mykobo identity from + // the user's profile (KYC-gated), create the deposit intent, then build. + const { email } = await resolveMykoboCustomerForUser(userId); + const intent = await MykoboApiService.getInstance().createTransactionIntent({ + currency: MykoboCurrency.EURC, + email_address: email, + ip_address: additionalData.ipAddress, + transaction_type: MykoboTransactionType.DEPOSIT, + value: new Big(quote.inputAmount).toFixed(2, 0), + wallet_address: ephemeral.address + }); + if (!intent.instructions || !("iban" in intent.instructions)) { + throw new Error("FakeMykobo deposit intent did not return IBAN instructions"); + } + + const { unsignedTxs, stateMeta } = await prepareMykoboToEvmOnrampTransactions({ + destinationAddress: additionalData.destinationAddress, + ipAddress: additionalData.ipAddress, + mykoboEmail: email, + mykoboTransactionId: intent.transaction.id, + mykoboTransactionReference: intent.transaction.reference, + quote, + signingAccounts: normalizedSigningAccounts + }); + + const ibanPaymentData: IbanPaymentData = { + bic: "", + iban: intent.instructions.iban, + receiverName: intent.instructions.bank_account_name, + reference: intent.transaction.reference + }; + + const [consumed] = await QuoteTicket.update({ status: "consumed" }, { where: { id: quote.id, status: "pending" } }); + expect(consumed).toBe(1); + + return createTestRampState({ + currentPhase: "initial", + from: quote.from, + paymentMethod: quote.paymentMethod, + phaseHistory: [{ phase: "initial", timestamp: new Date() }], + quoteId: quote.id, + state: { + evmEphemeralAddress: ephemerals.EVM, + ibanPaymentData, + substrateEphemeralAddress: ephemerals.Substrate, + ...additionalData, + ...stateMeta + } as unknown as RampState["state"], + to: quote.to, + type: quote.rampType, + unsignedTxs, + userId + }); + } + + /** + * Quote via the real HTTP API, registration via the below-kill-switch + * seeding, then a REAL signed EURC transfer stored as the presigned + * destinationTransfer (pass a recipient to tamper with the payee). + */ + async function setUpRegisteredRamp(options: { recipient?: `0x${string}` } = {}): Promise { + const ephemeral = privateKeyToAccount(generatePrivateKey()); + const destination = privateKeyToAccount(generatePrivateKey()).address as `0x${string}`; + + const user = await createTestUser(); + const quote = await createQuoteViaApi(); + await assertRegisterEndpointStillKillSwitched(quote.id, user.id, destination); + + const persistedQuote = await QuoteTicket.findByPk(quote.id); + if (!persistedQuote) { + throw new Error("Quote not persisted"); + } + const mykoboMintRaw = BigInt(persistedQuote.metadata.mykoboMint?.outputAmountRaw ?? "0"); + expect(mykoboMintRaw).toBeGreaterThan(0n); + + const rampState = await registerEurOnrampBelowKillSwitch(persistedQuote, user.id, ephemeral, destination); + + const blueprint = (rampState.unsignedTxs ?? []).find(tx => tx.phase === "destinationTransfer"); + expect(blueprint, "missing destinationTransfer blueprint").toBeDefined(); + const blueprintData = (blueprint as UnsignedTx).txData as unknown as { to: `0x${string}`; data: `0x${string}` }; + const decoded = decodeFunctionData({ abi: erc20Abi, data: blueprintData.data }); + const amountRaw = (decoded.args as [string, bigint])[1]; + expect(amountRaw).toBe(parseUnits(quote.outputAmount, eurcTokenDetails.decimals)); + + const signedTransfer = await ephemeral.signTransaction({ + chainId: 8453, + data: options.recipient + ? encodeFunctionData({ abi: erc20Abi, args: [options.recipient, amountRaw], functionName: "transfer" }) + : blueprintData.data, + gas: 100_000n, + maxFeePerGas: 1_000_000_000n, + maxPriorityFeePerGas: 1_000_000_000n, + nonce: (blueprint as UnsignedTx).nonce, + to: blueprintData.to, + type: "eip1559" + }); + + await rampState.update({ + presignedTxs: [ + { + meta: {}, + network: Networks.Base, + nonce: (blueprint as UnsignedTx).nonce, + phase: "destinationTransfer", + signer: ephemeral.address, + txData: signedTransfer + } + ] + }); + + return { + amountRaw, + destination, + ephemeral, + mykoboMintRaw, + mykoboTransactionId: rampState.state.mykoboTransactionId as string, + quoteId: quote.id, + rampId: rampState.id, + signedTransfer + }; + } + + /** + * Scripts the fake world for the happy path: + * - Mykobo's SEPA settlement already delivered the EURC on the ephemeral, + * - the ephemeral has Base gas so fundEphemeral sends nothing, + * - broadcast raw ERC-20 transfers are applied to the in-memory ledger. + */ + function scriptHappyWorld(setup: CorridorSetup): void { + world.evm.setNativeBalance(Networks.Base, setup.ephemeral.address, parseUnits("2", 18)); + world.evm.setErc20Balance(Networks.Base, EURC_ON_BASE, setup.ephemeral.address, setup.mykoboMintRaw); + world.evm.onTransaction = tx => { + if (!tx.serialized) { + return; + } + const parsed = parseTransaction(tx.serialized as `0x${string}`); + if (!parsed.to || !parsed.data) { + return; + } + const { functionName, args } = decodeFunctionData({ abi: erc20Abi, data: parsed.data }); + if (functionName !== "transfer") { + return; + } + const [recipient, amount] = args as [`0x${string}`, bigint]; + world.evm.setErc20Balance( + tx.network, + parsed.to, + recipient, + world.evm.erc20Balance(tx.network, parsed.to, recipient) + amount + ); + }; + } + + function submissionsOf(signedTransfer: `0x${string}`): number { + return world.evm.sentTransactions.filter(tx => tx.serialized === signedTransfer).length; + } + + it( + "happy path: processes initial → mykoboOnrampDeposit → fundEphemeral → destinationTransfer → complete", + async () => { + const setup = await setUpRegisteredRamp(); + scriptHappyWorld(setup); + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("complete"); + expect(final?.phaseHistory.map(entry => entry.phase)).toEqual(HAPPY_PATH_PHASES); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + expect(final?.state.destinationTransferTxHash).toBeTruthy(); + + // Quote stays consumed and the destination received exactly the quoted + // EURC per the fake ledger. + const quote = await QuoteTicket.findByPk(setup.quoteId); + expect(quote?.status).toBe("consumed"); + expect(submissionsOf(setup.signedTransfer)).toBe(1); + expect(world.evm.erc20Balance(Networks.Base, EURC_ON_BASE, setup.destination)).toBe(setup.amountRaw); + + // Registration created exactly one Mykobo DEPOSIT intent addressed at + // the ephemeral for the full EUR input, and the KYC mirror was synced. + const intents = world.mykobo.intents.filter(intent => intent.wallet_address === setup.ephemeral.address); + expect(intents.length).toBe(1); + expect(intents[0].transaction_type).toBe(MykoboTransactionType.DEPOSIT); + expect(intents[0].value).toBe("100.00"); + expect((await MykoboCustomer.findOne({ where: { userId: final?.userId as string } }))?.status).toBe( + MykoboCustomerStatus.APPROVED + ); + }, + 30000 + ); + + it( + "transient failure: a scripted RPC outage on the destination transfer is recoverable and the corridor still completes", + async () => { + const setup = await setUpRegisteredRamp(); + scriptHappyWorld(setup); + world.evm.failNextSends = 1; + world.evm.sendFailureMessage = "FakeEvm: scripted RPC outage"; + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("complete"); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + + const outageLogs = final?.errorLogs.filter(log => log.error.includes("scripted RPC outage")) ?? []; + expect(outageLogs.length).toBeGreaterThanOrEqual(1); + expect(outageLogs.every(log => log.phase === "destinationTransfer")).toBe(true); + expect(outageLogs.some(log => log.recoverable === true)).toBe(true); + + expect(submissionsOf(setup.signedTransfer)).toBe(1); + expect(world.evm.erc20Balance(Networks.Base, EURC_ON_BASE, setup.destination)).toBe(setup.amountRaw); + }, + 30000 + ); + + it( + "unrecoverable failure: a presigned transfer paying the wrong recipient fails the ramp without paying anyone", + async () => { + const wrongRecipient = privateKeyToAccount(generatePrivateKey()).address as `0x${string}`; + const setup = await setUpRegisteredRamp({ recipient: wrongRecipient }); + scriptHappyWorld(setup); + + await phaseProcessor.processRamp(setup.rampId); + + const final = await RampState.findByPk(setup.rampId); + expect(final?.currentPhase).toBe("failed"); + expect(final?.phaseHistory.map(entry => entry.phase)).not.toContain("complete"); + expect(final?.processingLock).toEqual({ locked: false, lockedAt: null }); + expect(final?.errorLogs.some(log => log.error.includes("recipient mismatch"))).toBe(true); + + expect(submissionsOf(setup.signedTransfer)).toBe(0); + expect(world.evm.erc20Balance(Networks.Base, EURC_ON_BASE, wrongRecipient)).toBe(0n); + expect(world.evm.erc20Balance(Networks.Base, EURC_ON_BASE, setup.destination)).toBe(0n); + }, + 30000 + ); + + it( + "registration guard: an unapproved Mykobo KYC blocks the EUR onramp registration path", + async () => { + world.mykobo.profileKycReviewStatus = "pending"; + const user = await createTestUser(); + const quote = await createQuoteViaApi(); + const persistedQuote = await QuoteTicket.findByPk(quote.id); + const ephemeral = privateKeyToAccount(generatePrivateKey()); + const destination = privateKeyToAccount(generatePrivateKey()).address as `0x${string}`; + const intentsBefore = world.mykobo.intents.length; + + await expect( + registerEurOnrampBelowKillSwitch(persistedQuote as QuoteTicket, user.id, ephemeral, destination) + ).rejects.toThrow("Mykobo KYC is not approved"); + // No intent was created and the quote was not consumed. + expect(world.mykobo.intents.length).toBe(intentsBefore); + expect((await QuoteTicket.findByPk(quote.id))?.status).toBe("pending"); + }, + 30000 + ); +}); From 27981b818b583305204e0f1e1a8a72586316b5f5 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 18:23:42 +0200 Subject: [PATCH 168/176] Remove the single-currency Alfredpay journeys superseded by the parameterized specs --- apps/frontend/e2e/offramp-usd-journey.spec.ts | 199 ------------------ apps/frontend/e2e/onramp-mxn-journey.spec.ts | 139 ------------ 2 files changed, 338 deletions(-) delete mode 100644 apps/frontend/e2e/offramp-usd-journey.spec.ts delete mode 100644 apps/frontend/e2e/onramp-mxn-journey.spec.ts diff --git a/apps/frontend/e2e/offramp-usd-journey.spec.ts b/apps/frontend/e2e/offramp-usd-journey.spec.ts deleted file mode 100644 index a2deb0e8d..000000000 --- a/apps/frontend/e2e/offramp-usd-journey.spec.ts +++ /dev/null @@ -1,199 +0,0 @@ -import { expect, test } from "@playwright/test"; -import { buildQuoteResponse, buildRampProcess, E2E_RAMP_ID, mockBackend } from "./support/mockBackend"; -import { injectMockWallet, MOCK_WALLET_ADDRESS } from "./support/mockWallet"; - -const POLYGON_USDT = "0xc2132d05d31c914a87c6611c10748aeb04b58e8f"; -const MOCK_WALLET_TX_HASH = `0x${"cd".repeat(32)}`; -const FIAT_ACCOUNT_ID = "fiat-account-e2e-1"; - -// Critical journey 7: a full SELL (offramp) USD ramp over the Alfredpay rail — the -// money-OUT counterpart to the BRL offramp. Unlike the Avenia path there is no CPF/Pix -// eligibility form: the payout destination is a fiat account registered with Alfredpay, -// selected on the payment summary, and its fiatAccountId travels in the registration's -// additionalData. -// -// quote (USDT on Polygon -> USD via bank transfer; the wallet gate is passed by the -// injected mock wallet on Polygon and the balance check reads the mocked Alchemy API) -> -// email/OTP auth -> wallet-ownership details step -> Alfredpay KYC gate (existing -// verified customer for country US) -> payment summary with the registered US bank -// account -> ramp registration -> ephemeral presigning posted to /ramp/update -> USER -// WALLET broadcast of the squidRouterNoPermitTransfer (eth_sendTransaction on the mock -// wallet) with its hash reported in a second /ramp/update -> automatic /ramp/start -> -// progress -> success (once status polling reports COMPLETE). - -const SELL_RAMP_FIELDS = { - depositQrCode: undefined, - from: "polygon", - inputAmount: "100", - inputCurrency: "USDT", - outputAmount: "99", - outputCurrency: "USD", - paymentMethod: "ach", - to: "ach", - type: "SELL" -}; - -// The registered payout account served by GET /v1/alfredpay/fiatAccounts (an -// AlfredpayFiatAccount; US accounts are stored as BANK_USA and displayed as "WIRE"). -const US_BANK_ACCOUNT = { - accountName: "Vortex E2E Checking", - accountNumber: "000123456789", - accountType: "CHECKING", - createdAt: new Date().toISOString(), - customerId: "alfred-customer-e2e-1", - fiatAccountId: FIAT_ACCOUNT_ID, - metadata: { accountHolderName: "Vortex E2E" }, - routingNumber: "026009593", - type: "BANK_USA" -}; - -// Mirrors the API's evm-to-alfredpay offramp preparation for the direct -// Polygon-USDT no-permit path: the USER wallet signs a single -// squidRouterNoPermitTransfer to the EVM ephemeral, and the ephemeral signs the -// Alfredpay deposit transfer, its fallback (both nonce 0 — only one executes), and -// the axlUSDC cleanup approval. -function buildSellUnsignedTxs(evmEphemeral: string) { - const evmTx = (signer: string, nonce: number, phase: string) => ({ - meta: {}, - network: "polygon", - nonce, - phase, - signer, - txData: { - data: `0xa9059cbb${"00".repeat(12)}${evmEphemeral.slice(2).toLowerCase()}${"00".repeat(30)}04c4`, - gas: "150000", - maxFeePerGas: "5000000000", - maxPriorityFeePerGas: "5000000000", - nonce, - to: POLYGON_USDT, - value: "0" - } - }); - return [ - evmTx(MOCK_WALLET_ADDRESS, 0, "squidRouterNoPermitTransfer"), - evmTx(evmEphemeral, 0, "alfredpayOfframpTransfer"), - evmTx(evmEphemeral, 0, "alfredpayOfframpTransferFallback"), - evmTx(evmEphemeral, 1, "polygonCleanupAxlUsdc") - ]; -} - -test("SELL USD journey: quote, auth, Alfredpay KYC gate, fiat account, registration, wallet signing, progress, success", async ({ - page -}) => { - // The real API keeps returning the ramp's unsignedTxs on /ramp/update; the signing - // step reads the user-wallet transaction from that response. - let unsignedTxs: unknown[] = []; - const backend = await mockBackend(page, { - fiatAccounts: () => [US_BANK_ACCOUNT], - quotes: body => - ({ - body: buildQuoteResponse({ - ...SELL_RAMP_FIELDS, - // Alfredpay quotes carry the resolved stablecoin input limits; the quote form - // validates the USDT inputAmount against them (not the legacy fiat sell limits). - alfredpayInputLimits: { max: "10000", min: "10" }, - feeCurrency: "USD", - inputAmount: body.inputAmount, - rampType: "SELL" - }), - status: 200 - }) as { status: number; body: unknown }, - rampStatusOverrides: () => SELL_RAMP_FIELDS, - register: body => { - const signingAccounts = (body.signingAccounts ?? []) as Array<{ address: string; type: string }>; - const evmEphemeral = signingAccounts.find(account => account.type === "EVM")?.address ?? POLYGON_USDT; - unsignedTxs = buildSellUnsignedTxs(evmEphemeral); - return buildRampProcess({ ...SELL_RAMP_FIELDS, unsignedTxs }); - }, - update: () => buildRampProcess({ ...SELL_RAMP_FIELDS, unsignedTxs }) - }); - // The whole journey lives on Polygon, so the mock wallet connects on chain 137. - await injectMockWallet(page, { chainIdHex: "0x89" }); - // Preselect Polygon via the persisted network choice instead of the `network` URL - // param: passing network+cryptoLocked in the URL makes the widget create the quote - // itself and skip the quote form, and stage 1 (form + wallet gate + balance check) - // is part of this journey. - await page.addInitScript(() => localStorage.setItem("SELECTED_NETWORK", "polygon")); - - await page.goto("/widget?rampType=SELL&fiat=USD&cryptoLocked=USDT&inputAmount=100"); - - // Stage 1: the quote form fetched a SELL USDT->USD quote; the wallet gate is already - // passed by the injected mock wallet, and the balance check (mocked Alchemy data API, - // which holds USDT on Polygon) enables Sell. - await expect(page.locator('input[name="outputAmount"]')).toHaveValue(/99/, { timeout: 20_000 }); - const sellButton = page.locator("form").getByRole("button", { name: "Sell" }); - await expect(sellButton).toBeEnabled({ timeout: 20_000 }); - await sellButton.click(); - - // Stage 2 + 3: email/OTP auth gate. - await expect(page.getByRole("heading", { name: "Verify Your Email" })).toBeVisible({ timeout: 20_000 }); - await page.locator("#email").fill("e2e@vortexfinance.co"); - await page.locator("#terms").check(); - await page.getByRole("button", { name: "Continue" }).click(); - await expect(page.getByRole("heading", { name: "Enter Verification Code" })).toBeVisible({ timeout: 20_000 }); - await page.locator('input[autocomplete="one-time-code"]').pressSequentially("123456"); - - // Stage 4: Alfredpay offramp details — only wallet ownership, no CPF/Pix fields (the - // payout destination is the Alfredpay fiat account picked later on the summary). - await expect(page.getByText("Verify you are the owner of the wallet")).toBeVisible({ timeout: 20_000 }); - await expect(page.locator("#taxId")).toHaveCount(0); - await expect(page.locator("#pixId")).toHaveCount(0); - await expect(page.getByRole("button", { name: /0xf39F/ })).toBeVisible(); - await page.getByRole("button", { name: "Verify Wallet" }).click(); - - // Stage 5: the Alfredpay KYC gate queried the customer status for US and, since the - // customer is verified (SUCCESS), the flow lands on the payment summary, where the - // registered US bank account is listed and preselected as the payout method. - await expect(page.getByRole("heading", { name: "Payment Summary" })).toBeVisible({ timeout: 20_000 }); - await expect(page.getByText(US_BANK_ACCOUNT.accountName)).toBeVisible({ timeout: 20_000 }); - expect(backend.fiatAccountsRequests).toContain("US"); - - // Stage 6: confirming registers the ramp; the fiat account travels as additionalData. - await page.getByRole("button", { name: "Confirm" }).click(); - - // Stage 7: the ephemeral transactions are signed in-page and posted to /ramp/update, - // then the USER WALLET broadcasts the source-of-funds transfer and its hash is - // reported in a second update; the offramp starts automatically and (once polling - // reports COMPLETE) lands on the SELL success screen. - await expect(page.getByRole("heading", { name: "All set! The withdrawal has been sent to your bank." })).toBeVisible({ - timeout: 45_000 - }); - await expect(page.getByText("Your funds will arrive in your bank account in a few minutes.")).toBeVisible(); - - expect(backend.registerRequests).toHaveLength(1); - const registerBody = backend.registerRequests[0] as { - quoteId: string; - signingAccounts: Array<{ type: string }>; - additionalData?: { fiatAccountId?: string; pixDestination?: string; taxId?: string; walletAddress?: string }; - }; - expect(registerBody.quoteId).toBe("quote-e2e-1"); - expect(registerBody.signingAccounts.map(account => account.type).sort()).toEqual(["EVM", "Substrate"]); - expect(registerBody.additionalData?.fiatAccountId).toBe(FIAT_ACCOUNT_ID); - expect(registerBody.additionalData?.walletAddress?.toLowerCase()).toBe(MOCK_WALLET_ADDRESS.toLowerCase()); - // The Avenia-only fields never travel on the Alfredpay rail. - expect(registerBody.additionalData?.pixDestination).toBeUndefined(); - expect(registerBody.additionalData?.taxId).toBeUndefined(); - - // Update #1: the three ephemeral transactions, locally signed (raw EIP-1559 txs). The - // user-wallet transfer must NOT be among them. - expect(backend.updateRequests.length).toBeGreaterThanOrEqual(2); - const ephemeralUpdate = backend.updateRequests[0] as { presignedTxs: Array<{ txData: unknown; phase: string }> }; - expect(ephemeralUpdate.presignedTxs.map(tx => tx.phase)).not.toContain("squidRouterNoPermitTransfer"); - expect(ephemeralUpdate.presignedTxs.map(tx => tx.phase).sort()).toEqual([ - "alfredpayOfframpTransfer", - "alfredpayOfframpTransferFallback", - "polygonCleanupAxlUsdc" - ]); - for (const tx of ephemeralUpdate.presignedTxs) { - expect(typeof tx.txData).toBe("string"); - expect(tx.txData as string).toMatch(/^0x02/); - } - - // Update #2: the hash of the wallet-broadcast transfer, reported as additionalData. - const signingUpdate = backend.updateRequests[1] as { additionalData?: Record }; - expect(signingUpdate.additionalData?.squidRouterNoPermitTransferHash).toBe(MOCK_WALLET_TX_HASH); - - // The offramp started without a manual payment-confirmation step. - expect(backend.startRequests).toHaveLength(1); - expect(backend.startRequests[0]).toMatchObject({ rampId: E2E_RAMP_ID }); -}); diff --git a/apps/frontend/e2e/onramp-mxn-journey.spec.ts b/apps/frontend/e2e/onramp-mxn-journey.spec.ts deleted file mode 100644 index 5e8408ee4..000000000 --- a/apps/frontend/e2e/onramp-mxn-journey.spec.ts +++ /dev/null @@ -1,139 +0,0 @@ -import { expect, test } from "@playwright/test"; -import { buildQuoteResponse, buildRampProcess, E2E_RAMP_ID, mockBackend } from "./support/mockBackend"; -import { injectMockWallet, MOCK_WALLET_ADDRESS } from "./support/mockWallet"; - -const POLYGON_USDT = "0xc2132d05d31c914a87c6611c10748aeb04b58e8f"; -const E2E_CLABE = "646180157000000004"; - -// Critical journey 6: a full BUY (onramp) MXN ramp over the Alfredpay rail — the corridor -// family (MXN/USD/COP/ARS) the BRL journey never touches. The Alfredpay KYC gate is -// exercised on its happy path (an existing verified customer, alfredpayStatus=SUCCESS), -// and the payment step shows SPEI bank transfer details (CLABE) instead of a Pix QR. -// -// quote -> Buy -> email/OTP auth -> destination wallet details -> Alfredpay KYC gate -> -// summary -> registration (destinationAddress + walletAddress) -> in-page ephemeral -// signing on POLYGON posted to /ramp/update -> SPEI payment details (CLABE) -> "I have -// made the payment" -> /ramp/start -> progress -> success. - -const MXN_RAMP_FIELDS = { - depositQrCode: undefined, - from: "spei", - inputAmount: "2000", - inputCurrency: "MXN", - outputAmount: "100", - outputCurrency: "USDT", - to: "polygon", - type: "BUY" -}; - -const ACH_PAYMENT_DATA = { - accountHolderName: "Vortex E2E", - bankName: "STP", - clabe: E2E_CLABE, - reference: "VORTEX-E2E-REF" -}; - -// The Alfredpay onramp's Polygon-side transactions signed by the EVM ephemeral -// (destinationTransfer + cleanup), mirroring alfredpay-to-evm.ts' direct-token path. -function buildMxnUnsignedTxs(evmEphemeral: string) { - const evmTx = (nonce: number, phase: string) => ({ - meta: {}, - network: "polygon", - nonce, - phase, - signer: evmEphemeral, - txData: { - data: `0xa9059cbb${"00".repeat(12)}${evmEphemeral.slice(2).toLowerCase()}${"00".repeat(30)}04c4`, - gas: "150000", - maxFeePerGas: "5000000000", - maxPriorityFeePerGas: "5000000000", - nonce, - to: POLYGON_USDT, - value: "0" - } - }); - return [evmTx(0, "destinationTransfer"), evmTx(1, "polygonCleanup")]; -} - -test("BUY MXN journey: quote, auth, Alfredpay KYC gate, registration, signing, SPEI details, progress, success", async ({ - page -}) => { - let unsignedTxs: unknown[] = []; - const backend = await mockBackend(page, { - quotes: body => - ({ - body: buildQuoteResponse({ - ...MXN_RAMP_FIELDS, - feeCurrency: "MXN", - inputAmount: body.inputAmount, - rampType: "BUY" - }), - status: 200 - }) as { status: number; body: unknown }, - rampStatusOverrides: () => MXN_RAMP_FIELDS, - register: body => { - const signingAccounts = (body.signingAccounts ?? []) as Array<{ address: string; type: string }>; - const evmEphemeral = signingAccounts.find(account => account.type === "EVM")?.address ?? POLYGON_USDT; - unsignedTxs = buildMxnUnsignedTxs(evmEphemeral); - return buildRampProcess({ ...MXN_RAMP_FIELDS, unsignedTxs }); - }, - update: () => buildRampProcess({ ...MXN_RAMP_FIELDS, achPaymentData: ACH_PAYMENT_DATA, unsignedTxs }) - }); - await injectMockWallet(page); - - await page.goto("/widget?rampType=BUY&fiat=MXN&inputAmount=2000"); - - // Stage 1: the quote form fetched a BUY MXN quote. - await expect(page.locator('input[name="outputAmount"]')).toHaveValue(/100/, { timeout: 20_000 }); - await page.locator("form").getByRole("button", { name: "Buy" }).click(); - - // Stage 2 + 3: email/OTP auth gate. - await expect(page.getByRole("heading", { name: "Verify Your Email" })).toBeVisible({ timeout: 20_000 }); - await page.locator("#email").fill("e2e@vortexfinance.co"); - await page.locator("#terms").check(); - await page.getByRole("button", { name: "Continue" }).click(); - await expect(page.getByRole("heading", { name: "Enter Verification Code" })).toBeVisible({ timeout: 20_000 }); - await page.locator('input[autocomplete="one-time-code"]').pressSequentially("123456"); - - // Stage 4: wallet ownership step — the connected mock wallet is shown; confirming - // sends CONFIRM with the wallet as the destination. - await expect(page.getByText("Verify you are the owner of the wallet")).toBeVisible({ timeout: 20_000 }); - await expect(page.getByRole("button", { name: /0xf39F/ })).toBeVisible(); - await page.getByRole("button", { name: "Verify Wallet" }).click(); - - // Stage 5: the Alfredpay KYC gate queried the customer status for MX and, since the - // customer is verified (SUCCESS), the flow lands on the payment summary. - await expect(page.getByRole("heading", { name: "Payment Summary" })).toBeVisible({ timeout: 20_000 }); - - // Stage 6: confirming registers the ramp and signs the Polygon transactions in-page; - // the SPEI payment details from the update response are then displayed. - await page.getByRole("button", { name: "Confirm" }).click(); - await expect(page.getByText(E2E_CLABE).first()).toBeVisible({ timeout: 30_000 }); - await expect(page.getByText(ACH_PAYMENT_DATA.reference)).toBeVisible(); - - expect(backend.registerRequests).toHaveLength(1); - const registerBody = backend.registerRequests[0] as { - quoteId: string; - signingAccounts: Array<{ type: string }>; - additionalData?: { destinationAddress?: string; walletAddress?: string }; - }; - expect(registerBody.quoteId).toBe("quote-e2e-1"); - expect(registerBody.additionalData?.destinationAddress?.toLowerCase()).toBe(MOCK_WALLET_ADDRESS.toLowerCase()); - expect(registerBody.additionalData?.walletAddress?.toLowerCase()).toBe(MOCK_WALLET_ADDRESS.toLowerCase()); - - // Every unsigned Polygon transaction came back locally signed (raw EIP-1559 txs). - expect(backend.updateRequests.length).toBeGreaterThanOrEqual(1); - const presignedTxs = (backend.updateRequests[0] as { presignedTxs: Array<{ txData: unknown; phase: string }> }).presignedTxs; - expect(presignedTxs.map(tx => tx.phase).sort()).toEqual(["destinationTransfer", "polygonCleanup"]); - for (const tx of presignedTxs) { - expect(typeof tx.txData).toBe("string"); - expect(tx.txData as string).toMatch(/^0x02/); - } - - // Stage 7: confirming the payment starts the ramp; once polling reports COMPLETE the - // BUY success screen appears. - await page.getByRole("button", { name: "I have made the payment" }).click(); - await expect(page.getByRole("heading", { name: "All set! Your tokens are on their way." })).toBeVisible({ timeout: 45_000 }); - expect(backend.startRequests).toHaveLength(1); - expect(backend.startRequests[0]).toMatchObject({ rampId: E2E_RAMP_ID }); -}); From 9f4c09b462835caedfcc4f9755758f2a40d4658b Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 18:23:43 +0200 Subject: [PATCH 169/176] Update the coverage matrix for the closed cross-chain, E2E, and EUR gaps --- docs/testing-strategy.md | 99 +++++++++++++++++++++------------------- 1 file changed, 53 insertions(+), 46 deletions(-) diff --git a/docs/testing-strategy.md b/docs/testing-strategy.md index b3fd5871d..2f656b69a 100644 --- a/docs/testing-strategy.md +++ b/docs/testing-strategy.md @@ -19,10 +19,10 @@ together with the shared test harness (`apps/api/src/test-utils`) — see "How t |---|---|---|---| | 1. Unit | Pure logic: helpers, token configs, SDK handlers | each package, next to source | `bun test` (Vitest for frontend) | | 2. API integration | Real Express + real Postgres + fake external world, driven over HTTP; incl. the quote pricing goldens (`quote-pricing.golden.test.ts`) and the HTTP surface tests (auth OTP flow, webhooks, ramp history, public routes; `http-surface.invariants.test.ts`) | `apps/api/src/tests/` | `bun test` | -| 3. Corridor scenarios | Phase processor end-to-end per corridor against the fake world: BRL onramp (pix→BRLA-on-Base), BRL offramp (USDC-on-Base→pix incl. real Nabla swap + both EVM subsidy phases), CROSS-CHAIN BRL offramp (USDC-on-Polygon→squid→Base→pix incl. user-reported squid-hash verification), MXN on/offramp (spei↔USDT-on-Polygon), CROSS-CHAIN MXN onramp (spei→Polygon mint→squid→USDT-on-Arbitrum incl. real squidRouterSwap/Pay + Arbitrum settlement subsidy), and a USD/COP/ARS matrix over the same Alfredpay rails (happy paths + per-currency limit breaches + per-currency transient AND unrecoverable failures) | `apps/api/src/tests/corridors/` | `bun test` | +| 3. Corridor scenarios | Phase processor end-to-end per corridor against the fake world: BRL onramp (pix→BRLA-on-Base), BRL offramp (USDC-on-Base→pix incl. real Nabla swap + both EVM subsidy phases), CROSS-CHAIN BRL offramp (USDC-on-Polygon→squid→Base→pix incl. user-reported squid-hash verification), MXN on/offramp (spei↔USDT-on-Polygon), CROSS-CHAIN MXN onramp (spei→Polygon mint→squid→USDT-on-Arbitrum incl. real squidRouterSwap/Pay + Arbitrum settlement subsidy), CROSS-CHAIN BRL onramp (pix→Base mint+Nabla swap→squid→USDC-on-Arbitrum), a USD/COP/ARS matrix over the same Alfredpay rails (happy paths + per-currency limit breaches + per-currency transient AND unrecoverable failures + per-currency cross-chain BUY and no-permit cross-chain SELL, incl. MXN SELL cross-chain), and EUR (Mykobo) on/offramp scenarios (SEPA↔EURC/USDC-on-Base incl. real Nabla swap; registration stays kill-switched — see the coverage matrix) | `apps/api/src/tests/corridors/` | `bun test` | | 4. SDK contract | Real SDK against the real API in-process: BRL onramp lifecycle (`sdk-contract.test.ts`), the SELL/user-transaction surface — offramp lifecycle via submitUserTransactions, updateRamp, getQuote, listAlfredpayFiatAccounts (`sdk-contract.offramp.test.ts`) — and full per-currency lifecycles for all four Alfredpay currencies in both directions: SELL offramp lifecycles for USD/ach, MXN/spei, COP/ach and ARS/cbu (`sdk-contract.alfredpay-offramp.test.ts`) and BUY onramp lifecycles for MXN/spei, USD/ach, COP/ach and ARS/cbu (`sdk-contract.alfredpay-onramp.test.ts`) | `apps/api/src/tests/sdk-contract*.test.ts` | `bun test` | | 5. Frontend | XState machine tests, actor tests (register/sign/start/KYC-routing against MSW with mocked wallet seams), component tests (RTL + MSW + mock wagmi) | `apps/frontend/src` | Vitest | -| 6. E2E | Few critical Playwright journeys with a mock wallet | `apps/frontend/e2e/` | Playwright (non-blocking) | +| 6. E2E | Critical Playwright journeys with a mock wallet: BRL on/offramp plus parameterized Alfredpay journeys for all four currencies in both directions | `apps/frontend/e2e/` | Playwright (non-blocking) | ### The invariants the suite protects @@ -62,34 +62,39 @@ Legend: ✅ directly tested · ◐ covered only via shared code/another corridor | Corridor (rail) | Dir | Happy path | Transient | Unrecoverable | Security / caps | Cross-chain leg | SDK | E2E journey | |---|---|---|---|---|---|---|---|---| -| BRL (Avenia / Pix) | BUY | ✅ | ✅ | ✅ | ✅ recipient | ◐¹ | ✅ | ✅ | +| BRL (Avenia / Pix) | BUY | ✅ | ✅ | ✅ | ✅ recipient | ✅² | ✅ | ✅ | | BRL (Avenia / Pix) | SELL | ✅ | ✅ | ✅ | ✅ pre/post-swap caps, recipient | ✅ F-021 | ✅ | ✅ | | MXN (Alfredpay / SPEI) | BUY | ✅ | ✅ | ✅ | ✅ recipient | ✅ settlement subsidy | ✅ | ✅ | -| MXN (Alfredpay / SPEI) | SELL | ✅ | ✅ | ✅ | ✅ calldata, F-001 cap | ◐² | ✅ | ◐³ | -| USD (Alfredpay / ACH) | BUY | ✅ | ✅ | ✅ | ✅ + limit breach | ◐¹ | ✅ | ◐³ | -| USD (Alfredpay / ACH) | SELL | ✅ | ✅ | ✅ | ✅ + limit breach | ◐² | ✅ | ✅⁴ | -| COP (Alfredpay / ACH) | BUY | ✅ | ✅ | ✅ | ✅ + limit breach | ◐¹ | ✅ | ◐³ | -| COP (Alfredpay / ACH) | SELL | ✅ | ✅ | ✅ | ✅ + limit breach | ◐² | ✅ | ◐³ | -| ARS (Alfredpay / CBU) | BUY | ✅ | ✅ | ✅ | ✅ + limit breach | ◐¹ | ✅ | ◐³ | -| ARS (Alfredpay / CBU) | SELL | ✅ | ✅ | ✅ | ✅ + limit breach | ◐² | ✅ | ◐³ | -| EUR (Mykobo / SEPA) | both | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | +| MXN (Alfredpay / SPEI) | SELL | ✅ | ✅ | ✅ | ✅ calldata, F-001 cap | ✅¹ | ✅ | ✅ | +| USD (Alfredpay / ACH) | BUY | ✅ | ✅ | ✅ | ✅ + limit breach | ✅ | ✅ | ✅ | +| USD (Alfredpay / ACH) | SELL | ✅ | ✅ | ✅ | ✅ + limit breach | ✅¹ | ✅ | ✅ | +| COP (Alfredpay / ACH) | BUY | ✅ | ✅ | ✅ | ✅ + limit breach | ✅ | ✅ | ✅ | +| COP (Alfredpay / ACH) | SELL | ✅ | ✅ | ✅ | ✅ + limit breach | ✅¹ | ✅ | ✅ | +| ARS (Alfredpay / CBU) | BUY | ✅ | ✅ | ✅ | ✅ + limit breach | ✅ | ✅ | ✅ | +| ARS (Alfredpay / CBU) | SELL | ✅ | ✅ | ✅ | ✅ + limit breach | ✅¹ | ✅ | ✅ | +| EUR (Mykobo / SEPA) | BUY | ✅³ | ✅³ | ✅³ | ✅ recipient, KYC gate | ◐⁴ | 🚫 | 🚫 | +| EUR (Mykobo / SEPA) | SELL | ✅³ | ✅³ | ✅³ | ✅ payout-vs-intent match, KYC gate | ◐⁴ | 🚫 | 🚫 | | AssetHub (BRL BUY → USDC; USDC SELL → Pix) | both | ❌ deferred | ❌ | ❌ | ❌ | — | ❌ | ❌ | -¹ Onramp squid leg (squidRouterSwap/Pay + settlement subsidy) exercised only by the MXN -cross-chain onramp scenario; the handlers are shared, but no per-corridor variant exists. -² Offramp squid leg (user-reported squid-hash verification) exercised only by the BRL -cross-chain offramp scenario; handlers shared. -³ The Alfredpay BUY UI flow is exercised by the MXN onramp journey and the SELL flow by the -USD offramp journey; no per-currency journey exists. -⁴ The journey ends at the progress screen: the success screen is currently unreachable for -Alfredpay offramps (frontend bug — `getRampFlow` returns null for SELL with non-BRL/EURC -output; fix in progress). - -**Gaps at a glance** (everything not ✅ above): Alfredpay E2E exists -only as one BUY (MXN) and one SELL (USD) journey; per-corridor cross-chain variants lean on -shared handlers; EUR is gated on the documented re-enablement precondition; the AssetHub -corridors are reachable in production but deliberately deferred (see the decision note under -Infrastructure — revisit if the product keeps them). +¹ Alfredpay SELL cross-chain is covered on the no-permit fallback path (user-broadcast squid +approve+swap verified against the blueprints by hash); the permit/TokenRelayer variant is +untested — it needs relayer-contract execution the fake world doesn't model. +² BRL BUY cross-chain (pix → Base mint + Nabla swap → squid → USDC-on-Arbitrum) is happy-path +only; failure modes of the shared squid handlers are covered by the MXN cross-chain and BRL +cross-chain offramp scenarios. +³ EUR registration is still kill-switched at `/v1/ramp/register` (503 — asserted by these +tests). The scenarios seed the registered state through the same service calls registration +runs below the switch, then drive the real PhaseProcessor. The re-enablement precondition is +met; once the switch is lifted, swap the seeding helpers in `corridors/eur-*.scenario.test.ts` +to plain HTTP registration and add SDK + E2E coverage. +⁴ The EUR scenarios cover the direct EURC-on-Base paths; BUY to other destinations / SELL from +non-Base sources use the shared squid legs tested in the other corridors' cross-chain variants. + +**Gaps at a glance** (everything not ✅ above): the Alfredpay permit/TokenRelayer cross-chain +SELL variant is untested (no-permit fallback is); EUR SDK and E2E entry points stay closed +behind the kill-switch (corridor scenarios are in place, so lifting it is unblocked); the +AssetHub corridors are reachable in production but deliberately deferred (see the decision +note under Infrastructure — revisit if the product keeps them). ## Infrastructure @@ -132,20 +137,21 @@ hand-write these objects or copy JSON snapshots into tests; extend the factory i ### Playwright E2E (`apps/frontend/e2e/`) -A handful of critical journeys run against the real frontend in Chromium, hermetically: quote -form → quote displayed, quote error surfaced, wallet gate on offramps, and four full ramp -journeys — the BRL onramp (`onramp-brl-journey.spec.ts`: quote → email/OTP auth → Avenia KYC -gate → registration → in-page ephemeral signing asserted via the presigned txs posted to -`/v1/ramp/update` → Pix payment info → progress → success), the BRL OFFRAMP -(`offramp-brl-journey.spec.ts`: the money-out path — wallet gate + balance check → CPF/Pix -eligibility → registration → USER-WALLET broadcast of the source-of-funds transfer with its -hash reported in a second update → automatic start → success), the MXN onramp -(`onramp-mxn-journey.spec.ts`: the Alfredpay rail — Alfredpay KYC gate → Polygon-side -ephemeral signing → SPEI payment details (CLABE) → success), and the USD OFFRAMP -(`offramp-usd-journey.spec.ts`: Alfredpay money-out — wallet gate on Polygon → Alfredpay KYC -gate → ACH fiat-account selection → ephemeral presigning → user-wallet broadcast with its -hash reported in a second update → automatic start → progress; the success screen is -currently unreachable for Alfredpay offramps — known frontend gap documented in the spec): +Critical journeys run against the real frontend in Chromium, hermetically: quote form → quote +displayed, quote error surfaced, wallet gate on offramps, and full ramp journeys — the BRL +onramp (`onramp-brl-journey.spec.ts`: quote → email/OTP auth → Avenia KYC gate → registration +→ in-page ephemeral signing asserted via the presigned txs posted to `/v1/ramp/update` → Pix +payment info → progress → success), the BRL OFFRAMP (`offramp-brl-journey.spec.ts`: the +money-out path — wallet gate + balance check → CPF/Pix eligibility → registration → +USER-WALLET broadcast of the source-of-funds transfer with its hash reported in a second +update → automatic start → success), and the Alfredpay rail parameterized over all four +currencies in both directions — BUY MXN/USD/COP/ARS (`onramp-alfredpay-journeys.spec.ts`: +Alfredpay KYC gate with per-country routing asserted → Polygon-side ephemeral signing → +per-currency payment instructions (SPEI/CLABE, ACH bank details, COP bank details, ARS CVU) +→ success) and SELL USD/MXN/COP/ARS (`offramp-alfredpay-journeys.spec.ts`: wallet gate on +Polygon → Alfredpay KYC gate → per-country fiat-account form (US wire, 18-digit CLABE, COP +ACH, 22-digit CBU) → ephemeral presigning → user-wallet broadcast with its hash reported in +a second update → automatic start → success incl. per-token arrival text): - The API origin (`http://localhost:3000`) is intercepted per-test with `page.route` (`e2e/support/mockBackend.ts`) — no backend, database, or chain access. @@ -160,12 +166,13 @@ They run nightly via `.github/workflows/e2e.yml` (never PR-blocking) and locally ### EUR re-enablement precondition -EUR ramps are kill-switched at registration (`ramp.service.ts`). The Mykobo (EUR) corridors -currently have **no hermetic coverage** — only `RUN_LIVE_TESTS`-gated sandbox tests. Lifting -the kill-switch is gated on adding a hermetic EUR corridor scenario in -`apps/api/src/tests/corridors/` first (the FakeMykobo anchor in `test-utils/fake-world/` -already covers intents/fees; the scenario harness is the same one the BRL and MXN corridors -use). +EUR ramps are kill-switched at registration (`ramp.service.ts`). The hermetic EUR corridor +scenarios this precondition asked for now exist (`corridors/eur-onramp.scenario.test.ts`, +`corridors/eur-offramp.scenario.test.ts` — both directions, happy path + transient + +unrecoverable, driving the real PhaseProcessor; they also pin the 503 the kill-switch +returns). What remains before EUR can be re-enabled: lift the switch, swap the scenarios' +state-seeding helpers to plain HTTP registration (each file's docstring says how), and add +SDK contract + E2E journey coverage for the reopened entry points. ### Live tests From 350a9705f3a084a59c9e890adb29e5edb09306bf Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 18:25:45 +0200 Subject: [PATCH 170/176] Raise the api coverage floors to 55/64 after the corridor and EUR sweep --- apps/api/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/api/package.json b/apps/api/package.json index d08ba95b1..fdb4f9c98 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -96,7 +96,7 @@ "serve": "bun dist/index.js", "start": "bun run build && bun run serve", "test": "bun test", - "test:coverage": "bun test --coverage --coverage-reporter=lcov && bun ../../scripts/check-coverage.ts coverage/lcov.info 0.52 0.62", + "test:coverage": "bun test --coverage --coverage-reporter=lcov && bun ../../scripts/check-coverage.ts coverage/lcov.info 0.55 0.64", "test:db:start": "./scripts/test-db.sh start", "test:db:stop": "./scripts/test-db.sh stop" }, From 2cb6fba4d2d9ed596137425c5ef3ec6a4d8b36b1 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 19:00:40 +0200 Subject: [PATCH 171/176] Add the SPEI and ACH payment methods for the live Alfredpay corridors GET /v1/supported-payment-methods only listed sepa, pix, and cbu, so the live USD/MXN/COP corridors were never advertised. Limits mirror the hardcoded AlfredPay individual-customer fallback bounds. The http-surface test now pins the method ids per direction and that all six fiat tokens are reachable through at least one sell method. --- apps/api/src/config/payment-methods.config.ts | 45 ++++++++++++++++++- .../src/tests/http-surface.invariants.test.ts | 14 ++++++ 2 files changed, 57 insertions(+), 2 deletions(-) diff --git a/apps/api/src/config/payment-methods.config.ts b/apps/api/src/config/payment-methods.config.ts index 224bb551a..e2abefdac 100644 --- a/apps/api/src/config/payment-methods.config.ts +++ b/apps/api/src/config/payment-methods.config.ts @@ -27,6 +27,35 @@ const ARS = { name: "Argentine Peso" }; +// USD/MXN/COP limits mirror the hardcoded AlfredPay individual-customer bounds +// (see packages/shared/src/tokens/freeTokens/config.ts), converted from raw to fiat units. +const USD = { + id: FiatToken.USD, + limits: { + max: 100000, + min: 1 + }, + name: "US Dollar" +}; + +const MXN = { + id: FiatToken.MXN, + limits: { + max: 86952173, + min: 150 + }, + name: "Mexican Peso" +}; + +const COP = { + id: FiatToken.COP, + limits: { + max: 368655999, + min: 33000 + }, + name: "Colombian Peso" +}; + const SEPA_PAYMENT_METHOD: PaymentMethodConfig = { id: EPaymentMethod.SEPA, name: PaymentMethodName.SEPA, @@ -45,7 +74,19 @@ const CBU_PAYMENT_METHOD: PaymentMethodConfig = { supportedFiats: [ARS] }; +const SPEI_PAYMENT_METHOD: PaymentMethodConfig = { + id: EPaymentMethod.SPEI, + name: PaymentMethodName.SPEI, + supportedFiats: [MXN] +}; + +const ACH_PAYMENT_METHOD: PaymentMethodConfig = { + id: EPaymentMethod.ACH, + name: PaymentMethodName.ACH, + supportedFiats: [USD, COP] +}; + export const PAYMENT_METHODS_CONFIG: Record = { - buy: [PIX_PAYMENT_METHOD], - sell: [SEPA_PAYMENT_METHOD, PIX_PAYMENT_METHOD, CBU_PAYMENT_METHOD] + buy: [PIX_PAYMENT_METHOD, ACH_PAYMENT_METHOD, SPEI_PAYMENT_METHOD], + sell: [SEPA_PAYMENT_METHOD, PIX_PAYMENT_METHOD, CBU_PAYMENT_METHOD, ACH_PAYMENT_METHOD, SPEI_PAYMENT_METHOD] }; diff --git a/apps/api/src/tests/http-surface.invariants.test.ts b/apps/api/src/tests/http-surface.invariants.test.ts index c69e0b1b8..163533301 100644 --- a/apps/api/src/tests/http-surface.invariants.test.ts +++ b/apps/api/src/tests/http-surface.invariants.test.ts @@ -248,6 +248,20 @@ describe("HTTP surface: auth flow, webhooks, history, public routes", () => { const methods = await requestJson("/v1/supported-payment-methods"); expect(methods.status).toBe(200); + const sellMethods = methods.body.paymentMethods as Array<{ id: string; supportedFiats: Array<{ id: string }> }>; + expect(sellMethods.map(method => method.id).sort()).toEqual(["ach", "cbu", "pix", "sepa", "spei"]); + // Every fiat token is reachable through at least one sell payment method. + const sellFiats = sellMethods.flatMap(method => method.supportedFiats.map(fiat => fiat.id)); + expect([...new Set(sellFiats)].sort()).toEqual(["ARS", "BRL", "COP", "EUR", "MXN", "USD"]); + + const buyMethods = await requestJson("/v1/supported-payment-methods?type=buy"); + expect(buyMethods.status).toBe(200); + const buyIds = (buyMethods.body.paymentMethods as Array<{ id: string }>).map(method => method.id); + expect(buyIds.sort()).toEqual(["ach", "pix", "spei"]); + + const mxnMethods = await requestJson("/v1/supported-payment-methods?fiat=MXN"); + expect(mxnMethods.status).toBe(200); + expect((mxnMethods.body.paymentMethods as Array<{ id: string }>).map(method => method.id)).toEqual(["spei"]); }); it("price endpoints validate their query parameters", async () => { From 2221c97cfbf28f0ef4c61cf4d6d738bc2aed87f4 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 19:19:57 +0200 Subject: [PATCH 172/176] Document the bank transfer corridors and self-service user API key provisioning Whitelabel the partner docs (no payment-partner names), add guide pages for the USD/MXN/COP/ARS corridors and user-linked API key minting via email OTP, and add the auth + api-keys endpoints plus the missing currency/rail enum values to the OpenAPI reference. --- docs/api/apidog/page-manifest.json | 27 +- docs/api/openapi/vortex.openapi.d.ts | 5583 +++++++++-------- docs/api/openapi/vortex.openapi.json | 562 +- docs/api/pages/01-overview.md | 2 +- docs/api/pages/02-quick-start-with-the-sdk.md | 29 +- .../03-authentication-and-partner-keys.md | 2 + docs/api/pages/06-quotes-and-pricing.md | 2 +- docs/api/pages/13-kyb-deep-link.md | 2 +- docs/api/pages/14-bank-transfer-corridors.md | 25 + docs/api/pages/15-user-api-keys.md | 116 + 10 files changed, 3742 insertions(+), 2608 deletions(-) create mode 100644 docs/api/pages/14-bank-transfer-corridors.md create mode 100644 docs/api/pages/15-user-api-keys.md diff --git a/docs/api/apidog/page-manifest.json b/docs/api/apidog/page-manifest.json index c9bac3280..a54e339e6 100644 --- a/docs/api/apidog/page-manifest.json +++ b/docs/api/apidog/page-manifest.json @@ -2,6 +2,10 @@ "apidogProjectId": "918521", "endpointReference": { "currentDocumentedPaths": [ + "/v1/api-keys", + "/v1/api-keys/{keyId}", + "/v1/auth/request-otp", + "/v1/auth/verify-otp", "/v1/brla/createSubaccount", "/v1/brla/getKycStatus", "/v1/brla/getSelfieLivenessUrl", @@ -28,7 +32,16 @@ "/v1/webhook", "/v1/webhook/{id}" ], - "recommendedGroups": ["Quotes", "Vortex Widget", "Ramp", "Account Management", "Webhooks", "Public Key", "Reference Data"], + "recommendedGroups": [ + "Quotes", + "Vortex Widget", + "Ramp", + "Account Management", + "Authentication", + "Webhooks", + "Public Key", + "Reference Data" + ], "source": "docs/api/openapi/vortex.openapi.json" }, "markdownSync": { @@ -113,6 +126,18 @@ "slug": "kyb-deep-link", "source": "docs/api/pages/13-kyb-deep-link.md", "title": "KYB Deep Link" + }, + { + "order": 14, + "slug": "bank-transfer-corridors", + "source": "docs/api/pages/14-bank-transfer-corridors.md", + "title": "Bank Transfer Corridors (USD, MXN, COP, ARS)" + }, + { + "order": 15, + "slug": "user-api-keys", + "source": "docs/api/pages/15-user-api-keys.md", + "title": "User API Keys" } ], "publicDocsUrl": "https://api-docs.vortexfinance.co/" diff --git a/docs/api/openapi/vortex.openapi.d.ts b/docs/api/openapi/vortex.openapi.d.ts index 3d697659d..3e6e56e40 100644 --- a/docs/api/openapi/vortex.openapi.d.ts +++ b/docs/api/openapi/vortex.openapi.d.ts @@ -4,2163 +4,1440 @@ */ export interface paths { - "/v1/brla/createSubaccount": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** - * Create user or retry KYC - * @description `companyName`, `startDate` and `cnpj` are only required when taxIdType is `CNPJ` - * - * **Auth:** uses `optionalAuth` — accepts a Supabase Bearer token if present but does not require one. - */ - post: operations["createSubaccount"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/brla/getKycStatus": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Get user's KYC status - * @description **Auth:** requires `Authorization: Bearer `. - */ - get: operations["fetchSubaccountKycStatus"]; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/brla/getSelfieLivenessUrl": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Get selfie liveness URL - * @description Returns the Avenia selfie/liveness-check URL for the subaccount associated with this tax ID. - * - * **Auth:** requires `Authorization: Bearer `. - */ - get: operations["brlaGetSelfieLivenessUrl"]; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/brla/getUploadUrls": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** - * Get KYC document upload URLs - * @description Returns presigned upload URLs for the user's ID document and selfie. Only `ID` and `DRIVERS-LICENSE` are accepted for `documentType` (passport not supported here). - * - * **Auth:** uses `optionalAuth` — accepts a Supabase Bearer token if present but does not require one. - */ - post: operations["brlaGetUploadUrls"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/brla/getUser": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Get user information - * @description Fetches a user's subaccount information. The response contains only the EVM wallet address and KYC level. - * - * **Auth:** requires `Authorization: Bearer `. - */ - get: operations["getBrlaUser"]; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/brla/getUserRemainingLimit": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Get user's remaining transaction limits - * @description **Auth:** requires `Authorization: Bearer `. - */ - get: operations["getBrlaUserRemainingLimit"]; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/brla/newKyc": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** - * Submit KYC level 1 data - * @description Submits the user's KYC level 1 payload to Avenia after documents have been uploaded via `/v1/brla/getUploadUrls`. Includes a built-in 5-second delay to allow upstream document propagation. - * - * **Auth:** uses `optionalAuth`. - */ - post: operations["brlaNewKyc"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/brla/validatePixKey": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Validate Pix key - * @description Checks whether a Pix key exists and is valid. The key value itself is intentionally not echoed back in the response for security. - * - * **Auth:** requires `Authorization: Bearer `. - */ - get: operations["brlaValidatePixKey"]; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/public-key": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Public Key - * @description Returns the RSA-PSS 2048 / SHA-256 public key used to verify Vortex webhook signatures. This is NOT a partner `pk_*` API key. - */ - get: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description RSA-PSS public key in PEM format. */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - /** - * @example { - * "publicKey": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...replace-with-actual-key...\n-----END PUBLIC KEY-----\n" - * } - */ - "application/json": { - /** @description RSA-PSS 2048-bit public key in PEM format. Use this key to verify webhook signatures with RSA-PSS / SHA-256. */ - publicKey: string; - }; - }; + "/v1/api-keys": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; }; - }; - }; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/quotes": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** - * Create a new quote - * @description Generates a quote for a specified ramp transaction, detailing input and output amounts, fees, and expiration. - */ - post: operations["createQuote"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/quotes/{id}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Get existing quote - * @description Get a quote by ID. - * - * **Auth:** none. This endpoint is fully public; anyone with the quote ID can read it. - */ - get: { - parameters: { - query?: never; - header?: never; - path: { - /** @description Quote Id. */ - id: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["QuoteResponse"]; - }; - }; - }; - }; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/quotes/best": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** - * Create a quote for the best network - * @description Generates a new quote for the network that yields the highest output amount for the given parameters. This endpoint compares the output for a given input amount over all supported networks and returns the 'best' quote, defined as the one with the highest output. - */ - post: operations["createBestQuote"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/ramp/{id}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Get ramp status - * @description Fetches an updated ramp process. - */ - get: { - parameters: { - query?: never; - header?: never; - path: { - /** @description Ramp ID. */ - id: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - anchorFeeFiat: string; - anchorFeeUSD: string; - countryCode?: components["schemas"]["CountryCode"]; - /** - * Format: date-time - * @description Timestamp of when the ramp process was created. - */ - createdAt?: string; - currentPhase?: components["schemas"]["RampPhase"]; - /** @description BR Code for PIX payment, if applicable. */ - depositQrCode?: string | null; - feeCurrency: components["schemas"]["RampCurrency"]; - /** @description The source network or payment method. */ - from?: components["schemas"]["DestinationType"]; - /** @description Unique identifier for the ramp process. */ - id?: string; - inputAmount: string; - inputCurrency: string; - network?: components["schemas"]["Networks"]; - networkFeeFiat: string; - networkFeeUSD: string; - outputAmount: string; - outputCurrency: string; - partnerFeeFiat: string; - partnerFeeUSD: string; - paymentMethod: components["schemas"]["PaymentMethod"]; - processingFeeFiat: string; - processingFeeUSD: string; - /** - * Format: uuid - * @description The quote ID associated with this ramp process. - */ - quoteId?: string; - /** @description The `externalSessionId` is an optional URL parameter that integrators can provide to track ramp transactions within their own systems. This identifier allows you to correlate Vortex transactions with your internal session or transaction tracking. `externalSessionId` url param is named `sessionId` in the Vortex API. */ - sessionId?: string; - status?: components["schemas"]["SimpleStatus"]; - /** @description The destination network or payment method. */ - to?: components["schemas"]["DestinationType"]; - totalFeeFiat: string; - totalFeeUSD: string; - /** @description (BUY-only) A link to a block explorer showing the details for the transaction hash. */ - transactionExplorerLink?: string; - /** @description (BUY-only) The hash of the transaction transferring the expected outputAmount to the wallet address. */ - transactionHash?: string; - /** @description Type of ramp process. */ - type?: components["schemas"]["RampDirection"]; - /** @description Array of unsigned transactions that need to be signed by the user. */ - unsignedTxs?: components["schemas"]["UnsignedTx"][]; - /** - * Format: date-time - * @description Timestamp of the last update to the ramp process. - */ - updatedAt?: string; - vortexFeeFiat: string; - vortexFeeUSD: string; - /** @description The address of the source account for SELL, or the address the destination account for BUY transactions. */ - walletAddress?: string; - }; - }; - }; - }; - }; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/ramp/{id}/errors": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Get ramp error logs - * @description Returns the chronological error log for a ramp. - * - * **Auth:** requires either `X-API-Key: sk_*` (partner) OR `Authorization: Bearer ` (user). Ownership is enforced. - */ - get: operations["getRampErrorLogs"]; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/ramp/history/{walletAddress}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Get ramp history for wallet address - * @description Fetches the transaction history for a given wallet address. The response returns the last 20 items by default. This can be adjusted by using the `limit` and `offset` query parameters. - */ - get: { - parameters: { - query?: { - /** @description The maximum count of transaction items returned in this query. The maximum value is `100`. */ - limit?: number; - /** @description The offset for querying the transactions. Necessary if the number of transaction items of the address is larger than the maximum limit. A larger value will return older transaction items. */ - offset?: number; - }; - header?: never; - path: { - /** @description The wallet address for which the ramp history is queried for. */ - walletAddress: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["GetRampHistoryResponse"]; - }; - }; - }; - }; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/ramp/register": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** - * Register new ramp process - * @description Initiates a new on-ramp or off-ramp process by providing quote details, signing accounts, and additional data. - */ - post: operations["registerRamp"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/ramp/start": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** - * Start ramp process - * @description Starts a ramp process. - * - * It is assumed all required information from the client has already been sent using the `update` endpoint. This endpoint is only used to tell the backend any external operation (like a bank transfer) has been completed, and the ramp can start. - */ - post: operations["startRamp"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/ramp/update": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** - * Update ramp process - * @description Submits presigned transactions and additional data to an existing ramp process before starting it. - * This endpoint can be called many times, and data can be incrementally added to the ramp. - * - * Note: For both pre-signed transactions and the generic `additionalData` object, existing properties will be overriden by new values. - * - * ### Required data for ramps. - * The signed counterpart of the initial unsignedTxs object must be provided for all ramps, as required by the object. - * For offramps, the `additionalData` field must contain the confirmation hash corresponding to the inital transaction in which the user sends the funds. - * If the originating chain is `Assethub`, then `assetHubToPendulumHash` must be provided. - * If the originating chain is any `EVM` chain, then `squidRouterApproveHash` and `squidRouterSwapHash` must be provided. - * - * For onramps, no additional data is required after registering the ramp. - */ - post: operations["startRamp"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/session/create": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** - * Create widget session - * @description Creates a hosted Vortex Widget session and returns the URL to open for the user. - * - * This single endpoint supports two mutually exclusive request shapes: - * - * - **Fixed quote** (`GetWidgetUrlLocked`) — pass a `quoteId` you created via `POST /v1/quotes`. The widget uses that exact quote and does not refresh it. If the quote expires before the user finishes, they must close the window and start over. - * - * - **Auto-refresh** (`GetWidgetUrlRefresh`) — pass the route parameters (`network`, `rampType`, `inputAmount`, plus `fiat` / `cryptoLocked` / `paymentMethod` as relevant for the direction). The widget creates and refreshes quotes on demand for the user. - * - * Use the example switcher below to see the request shape for each mode. `externalSessionId` is required in both modes and is echoed back in webhook payloads. - */ - post: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody: { - content: { - "application/json": components["schemas"]["GetWidgetUrlLocked"] | components["schemas"]["GetWidgetUrlRefresh"]; - }; - }; - responses: { - /** @description Returned when a fixed-quote session was created. */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - /** - * @example { - * "url": "https://www.vortexfinance.co/widget?externalSessionId=my-session-id"eId=quote_01HXY..." - * } - */ - "application/json": { - /** @description The widget URL to open for the user. */ - url: string; - }; - }; - }; - /** @description Returned when an auto-refresh session was created. */ - 201: { - headers: { - [name: string]: unknown; - }; - content: { - /** - * @example { - * "url": "https://www.vortexfinance.co/widget?externalSessionId=my-session-id&rampType=BUY&network=polygon&inputAmount=150&fiat=BRL&cryptoLocked=USDC&paymentMethod=pix" - * } - */ - "application/json": { - /** @description The widget URL to open for the user. */ - url: string; - }; - }; - }; - /** @description Missing required fields, or `quoteId` not provided for fixed-quote mode and route fields not provided for auto-refresh mode. */ - 400: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Quote not found or expired (fixed-quote mode only). */ - 404: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - }; - }; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/supported-countries": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** Supported Countries */ - get: { - parameters: { - query?: { - /** - * @description ISO code: "BR", "AR", etc. - * @example - */ - countryCode?: string; - /** @description e.g. "Brazil", "Germany" */ - name?: string; - /** @description e.g. "BRL". All the supported currencies you can get from `supported-fiat-currencies` endpoint. */ - fiatCurrency?: string; - }; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: never; - responses: { - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - countries: { - /** @description e.g. `DE` */ - countryCode: string; - }[]; - /** @description e.g. 🇩🇪 */ - emoji: string; - /** @description e.g. `Germany` */ - name: string; - support: { - /** @description e.g. `true` */ - buy: boolean; - /** @description e.g. `true` */ - sell: boolean; - }; - /** @description All the supported currencies you can get from `supported-fiat-currencies` endpoint. */ - supportedCurrencies: string[]; - }; - }; - }; - }; - }; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/supported-cryptocurrencies": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Supported Cryptocurrencies - * @description Retrieve all supported cryptocurrencies, filtered by network. - */ - get: { - parameters: { - query?: { - /** - * @description Filter supported cryptocurrencies by network. Allowed values: `assethub`, `avalanche`, `base`, `bsc`, `ethereum`, `polygon` - * @example - */ - network?: string; - }; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: never; - responses: { - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - cryptocurrencies: { - /** @description Defined if network is EVM. */ - assetContractAddress?: string | null; - assetDecimals: number; - /** @description Defined if network is Assethub. */ - assetForeignAssetId?: string | null; - assetNetwork: components["schemas"]["Networks"]; - assetSymbol: string; - }[]; - }; - }; - }; - }; - }; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/supported-fiat-currencies": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** Supported Fiat Currencies */ - get: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: never; - responses: { - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - currencies: { - /** @description e.g. `2` */ - decimals: number; - /** @description e.g. `Brazilian Real` */ - name: string; - /** @description e.g. `BRL` */ - symbol: string; - }[]; + /** + * List the user's API keys + * @description Lists the authenticated user's active API keys. Public key values are included; secret key values are never returned. + * + * **Auth:** requires `Authorization: Bearer ` obtained from `POST /v1/auth/verify-otp`. Partner `sk_*`/`pk_*` keys are not accepted. + */ + get: operations["listUserApiKeys"]; + put?: never; + /** + * Create a user-linked API key pair + * @description Creates a public + secret API key pair bound to the authenticated user. The secret key value is returned only in this response; Vortex stores a hash and cannot show it again. + * + * Keys expire after one year by default; `expiresAt` may extend this to at most two years from now. A user may hold at most 10 active keys (a pair counts as two). + * + * Sandbox mints `pk_test_*`/`sk_test_*`; production mints `pk_live_*`/`sk_live_*`. + * + * **Auth:** requires `Authorization: Bearer ` obtained from `POST /v1/auth/verify-otp`. Partner `sk_*`/`pk_*` keys are not accepted. + */ + post: operations["createUserApiKey"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/api-keys/{keyId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post?: never; + /** + * Revoke an API key + * @description Revokes (soft-deletes) an API key owned by the authenticated user. Pass `pairedKeyId` in the body to revoke both halves of a pair together; the two keys must be of opposite types (one public, one secret) and share the same base name. The legacy `publicKeyId` body field is accepted as an alias. + * + * **Auth:** requires `Authorization: Bearer ` obtained from `POST /v1/auth/verify-otp`. Partner `sk_*`/`pk_*` keys are not accepted. + */ + delete: operations["revokeUserApiKey"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/auth/request-otp": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Request an email OTP + * @description Sends a 6-digit one-time password to the given email address. Use it with `POST /v1/auth/verify-otp` to obtain a user session. + * + * **Auth:** none. + */ + post: operations["requestOTP"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/auth/verify-otp": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Verify an email OTP + * @description Verifies the emailed one-time password and returns a user session. First-time sign-ins create the user profile; `user_id` identifies the profile that API keys minted with this session are linked to. + * + * **Auth:** none. + */ + post: operations["verifyOTP"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/brla/createSubaccount": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Create user or retry KYC + * @description `companyName`, `startDate` and `cnpj` are only required when taxIdType is `CNPJ` + * + * `quoteId` is optional: pass it in the normal ramp flow, or omit it for the quote-less KYB deep link where business verification starts before any quote exists. + * + * **Auth:** uses `optionalAuth` — accepts a Supabase Bearer token if present but does not require one. + */ + post: operations["createSubaccount"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/brla/getKycStatus": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get user's KYC status + * @description **Auth:** requires `Authorization: Bearer `. + */ + get: operations["fetchSubaccountKycStatus"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/brla/getSelfieLivenessUrl": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get selfie liveness URL + * @description Returns the Avenia selfie/liveness-check URL for the subaccount associated with this tax ID. + * + * **Auth:** requires `Authorization: Bearer `. + */ + get: operations["brlaGetSelfieLivenessUrl"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/brla/getUploadUrls": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Get KYC document upload URLs + * @description Returns presigned upload URLs for the user's ID document and selfie. Only `ID` and `DRIVERS-LICENSE` are accepted for `documentType` (passport not supported here). + * + * **Auth:** uses `optionalAuth` — accepts a Supabase Bearer token if present but does not require one. + */ + post: operations["brlaGetUploadUrls"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/brla/getUser": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get user information + * @description Fetches a user's subaccount information. The response contains only the EVM wallet address and KYC level. + * + * **Auth:** requires `Authorization: Bearer `. + */ + get: operations["getBrlaUser"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/brla/getUserRemainingLimit": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get user's remaining transaction limits + * @description **Auth:** requires `Authorization: Bearer `. + */ + get: operations["getBrlaUserRemainingLimit"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/brla/newKyc": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Submit KYC level 1 data + * @description Submits the user's KYC level 1 payload to Avenia after documents have been uploaded via `/v1/brla/getUploadUrls`. Includes a built-in 5-second delay to allow upstream document propagation. + * + * **Auth:** uses `optionalAuth`. + */ + post: operations["brlaNewKyc"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/brla/validatePixKey": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Validate Pix key + * @description Checks whether a Pix key exists and is valid. The key value itself is intentionally not echoed back in the response for security. + * + * **Auth:** requires `Authorization: Bearer `. + */ + get: operations["brlaValidatePixKey"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/public-key": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Public Key + * @description Returns the RSA-PSS 2048 / SHA-256 public key used to verify Vortex webhook signatures. This is NOT a partner `pk_*` API key. + */ + get: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description RSA-PSS public key in PEM format. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + /** + * @example { + * "publicKey": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...replace-with-actual-key...\n-----END PUBLIC KEY-----\n" + * } + */ + "application/json": { + /** @description RSA-PSS 2048-bit public key in PEM format. Use this key to verify webhook signatures with RSA-PSS / SHA-256. */ + publicKey: string; + }; + }; + }; }; - }; }; - }; - }; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/supported-payment-methods": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Supported Payment Methods - * @description Retrieve all available payment methods, filtered by type or fiat. - */ - get: { - parameters: { - query?: { - /** - * @description Filter supported payment methods by the ramp type. Allowed values: `sell` or `buy`. - * @example - */ - type?: string; - /** - * @description Filter supported payment methods Allowed values: `ars`, `brl`, `eur` - * @example - */ - fiat?: string; - }; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: never; - responses: { - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - /** @description Array of supported payment methods matching the params. */ - "paymentMethods:": { - /** @description Unique identifier of the payment method: `sepa`, `pix`, `cbu` */ - id: string; - /** @description Payment method limits in USD */ - limits: { - max: number; - min: number; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/quotes": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Create a new quote + * @description Generates a quote for a specified ramp transaction, detailing input and output amounts, fees, and expiration. + */ + post: operations["createQuote"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/quotes/best": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Create a quote for the best network + * @description Generates a new quote for the network that yields the highest output amount for the given parameters. This endpoint compares the output for a given input amount over all supported networks and returns the 'best' quote, defined as the one with the highest output. + */ + post: operations["createBestQuote"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/quotes/{id}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get existing quote + * @description Get a quote by ID. + * + * **Auth:** none. This endpoint is fully public; anyone with the quote ID can read it. + */ + get: { + parameters: { + query?: never; + header?: never; + path: { + /** @description Quote Id. */ + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["QuoteResponse"]; + }; }; - /** @description Unique name of the payment method: `SEPA`, `PIX`, `CBU` */ - name: string; - /** @description Array of supported fiat currencies by payment method. */ - supportedFiats: string[]; - }[]; }; - }; }; - }; - }; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/webhook": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** - * Register Webhook - * @description Register a new webhook to receive event notifications. - * - * **Auth:** requires `X-API-Key: sk_*`. Supabase Bearer is NOT accepted on webhook endpoints. - */ - post: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: { - content: { - "application/json": { - events?: string[]; - /** @description (required* one of two: quoteId or sessionId): Subscribe to events for a specific quote */ - quoteId?: string; - /** @description (required* one of two: quoteId or sessionId): Subscribe to events for a specific session */ - sessionId?: string; - /** @description Your HTTPS webhook endpoint URL */ - url: string; - }; - }; - }; - responses: { - 200: { - headers: { - [name: string]: unknown; - }; - content: { - /** - * @example { - * "createdAt": "2025-10-01T16:21:04.648Z", - * "events": [ - * "TRANSACTION_CREATED", - * "STATUS_CHANGE" - * ], - * "id": "340ba946-f3f3-4007-893c-3374bfcd096b", - * "isActive": true, - * "quoteId": "3258910e-93ee-443e-b793-28cc1d4ccdf3", - * "sessionId": null, - * "url": "https://your-website.com" - * } - */ - "application/json": { - /** @description The creation date of the webhook */ - createdAt: string; - /** @description The events the webhook is subscribed for */ - events: string[]; - /** @description Webhook UUID */ - id: string; - /** @description Is the webhook active */ - isActive: boolean; - /** @description (optional): The specific transactionId that the events are subscribed for */ - quoteId?: string; - /** @description (optional): The specific sessionId that the events are subscribed for */ - sessionId?: string; - /** @description Your HTTPS webhook endpoint URL */ - url: string; - }; - }; - }; - }; - }; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/webhook/{id}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - post?: never; - /** - * Delete Webhook - * @description Remove a webhook subscription. - * - * **Auth:** requires `X-API-Key: sk_*`. Supabase Bearer is NOT accepted on webhook endpoints. - */ - delete: { - parameters: { - query?: never; - header?: never; - path: { - id: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - message: string; - success: boolean; - }; - }; - }; - }; - }; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; -} -export type webhooks = Record; -export interface components { - schemas: { - AccountMeta: { - /** @description The account address. */ - address: string; - /** - * @description The type of the account. - * @enum {string} - */ - type: "EVM" | "Stellar" | "Substrate"; - }; - /** @enum {string} */ - AveniaDocumentType: "ID" | "DRIVERS-LICENSE" | "PASSPORT" | "SELFIE" | "SELFIE-FROM-LIVENESS"; - AveniaKYCDataUploadRequest: { - documentType: components["schemas"]["AveniaDocumentType"]; - /** @description CPF or CNPJ. */ - taxId: string; - }; - AveniaKYCDataUploadResponse: { - idUpload: components["schemas"]["DocumentUploadEntry"]; - selfieUpload: components["schemas"]["DocumentUploadEntry"]; - }; - BrlaAddress: { - cep: string; - city: string; - complement?: string | null; - district: string; - number: string; - state: string; - street: string; - }; - BrlaErrorResponse: { - /** @description Detailed error message or object from BRLA API or server. */ - details?: null & - ( - | string - | { - [key: string]: unknown; - } - ); - /** @description A summary of the error. */ - error?: string; - }; - BrlaGetSelfieLivenessUrlResponse: { - id: string; - livenessUrl: string; - uploadURLFront: string; - validateLivenessToken: string; - }; - BrlaValidatePixKeyResponse: { - valid: boolean; - }; - CleanupPhase: { - /** @enum {string} */ - string?: "moonbeamCleanup" | "pendulumCleanup" | "stellarCleanup"; - }; - /** @description Allowed values: `AR`, `BR`, `EU` */ - CountryCode: string; - CreateBestQuoteRequest: { - /** @description Your api key, if available. */ - apiKey?: string; - countryCode?: components["schemas"]["CountryCode"]; - /** @description `PIX`, `SEPA`, `CBU`. Only required if `rampType` is "BUY". */ - from?: components["schemas"]["PaymentMethod"]; - /** - * @description The amount of currency to be input. - * @example 100.00 - */ - inputAmount: string; - /** @description The currency type for the input amount. */ - inputCurrency: components["schemas"]["RampCurrency"]; - /** @description Optional whitelist of networks to evaluate when searching for the best quote. If omitted or empty, all eligible networks for the corridor are considered. */ - networks?: components["schemas"]["Networks"][]; - /** @description The desired currency type for the output amount. */ - outputCurrency: components["schemas"]["RampCurrency"]; - /** @description Your partner ID, if available. */ - partnerId?: string; - paymentMethod?: components["schemas"]["PaymentMethod"]; - /** @description The type of ramp process (on-ramp or off-ramp). */ - rampType: components["schemas"]["RampDirection"]; - /** @description `PIX`, `SEPA`, `CBU`. Only required if `rampType` is "SELL". */ - to?: components["schemas"]["PaymentMethod"]; - }; - CreateQuoteRequest: { - /** @description Your api key, if available. */ - apiKey?: string; - countryCode?: components["schemas"]["CountryCode"]; - /** @description From destination */ - from: components["schemas"]["DestinationType"]; - /** - * @description The amount of currency to be input. - * @example 100.00 - */ - inputAmount: string; - /** @description The currency type for the input amount. */ - inputCurrency: components["schemas"]["RampCurrency"]; - network?: components["schemas"]["Networks"]; - /** @description The desired currency type for the output amount. */ - outputCurrency: components["schemas"]["RampCurrency"]; - /** @description Your partner ID, if available. */ - partnerId?: string; - paymentMethod?: components["schemas"]["PaymentMethod"]; - /** @description The type of ramp process (on-ramp or off-ramp). */ - rampType: components["schemas"]["RampDirection"]; - /** @description To destination */ - to: components["schemas"]["DestinationType"]; - }; - CreateSubaccountRequest: { - address: components["schemas"]["BrlaAddress"]; - /** - * Format: date - * @description Date must be in format YYYY-MMM-DD. - */ - birthdate: string; - cnpj?: string | null; - companyName?: string | null; - cpf: string; - fullName: string; - phone: string; - /** - * Format: date - * @description Date must be in format YYYY-MMM-DD. - */ - startDate?: string | null; - taxIdType: components["schemas"]["TaxIdType"]; - }; - CreateSubaccountResponse: { - /** @description The ID of the created or processed subaccount. */ - subaccountId?: string; - }; - /** - * @description Represents either a blockchain network or a traditional payment method. - * @enum {string} - */ - DestinationType: - | "assethub" - | "arbitrum" - | "avalanche" - | "base" - | "bsc" - | "ethereum" - | "polygon" - | "moonbeam" - | "pendulum" - | "stellar" - | "pix" - | "sepa" - | "cbu"; - DocumentUploadEntry: { - id: string; - livenessUrl?: string; - uploadURLBack?: string; - uploadURLFront: string; - validateLivenessToken?: string; - }; - ErrorResponse: { - /** @description HTTP status code returned by the API error handler. */ - code?: number; - /** @description Validation error details, when the request fails schema or input validation. */ - errors?: Record[]; - /** @description A human-readable error message. */ - message?: string; - /** @description HTTP status code included by selected provider-style error responses. */ - statusCode?: number; - /** @description Provider-style error category, when available. */ - type?: string; - }; - /** @enum {string} */ - FiatToken: "EUR" | "ARS" | "BRL"; - GetKycStatusResponse: { - /** @description The KYC level achieved. */ - level?: number; - /** - * @description The KYC status. - * @enum {string} - */ - status?: "PENDING" | "APPROVED" | "REJECTED"; - /** - * @description Event type, typically "KYC". - * @enum {string} - */ - type?: "KYC"; - }; - GetRampErrorLogsResponse: components["schemas"]["RampErrorLog"][]; - GetRampHistoryResponse: { - totalCount: string; - transactions: components["schemas"]["GetRampHistoryTransaction"]; - }; - GetRampHistoryTransaction: { - date: string; - /** @description A link to the transaction explorer of the blockchain showing the details of the transaction sending the tokens to the user's wallet address. Only available for 'BUY' ramps. */ - externalTxExplorerLink?: string; - /** @description The hash of the blockchain transaction sending the tokens to the user's wallet address. Only available for 'BUY' ramps. */ - externalTxHash?: string; - from: components["schemas"]["DestinationType"]; - fromAmount: string; - fromCurrency: components["schemas"]["RampCurrency"]; - id: string; - status: components["schemas"]["SimpleStatus"]; - to: components["schemas"]["DestinationType"]; - toAmount: string; - toCurrency: components["schemas"]["RampCurrency"]; - type: components["schemas"]["RampDirection"]; - }; - GetUserRemainingLimitResponse: { - /** - * Format: double - * @description The remaining limit for offramp operations. - */ - remainingLimitOfframp?: number; - /** - * Format: double - * @description The remaining limit for onramp operations. - */ - remainingLimitOnramp?: number; - }; - GetUserResponse: { - /** @description The user's EVM wallet address. */ - evmAddress?: string; - /** - * @description The user's KYC level. - * @enum {number} - */ - kycLevel?: 1 | 2; - }; - GetWidgetUrlLocked: { - /** @description The widget will redirect to this callbackUrl after the user successfully created the transaction. */ - callbackUrl?: string; - /** @description A unique identifier for yourself to keep track of the widget session. Returned in the responses of webhooks, if registered. */ - externalSessionId?: string; - /** @description Pass the ID of an existing quote to make the widget lock in that particular quote without allowing to change it. */ - quoteId: string; - /** @description Pass this parameter if you want to lock the wallet address for the user. It will not be editable in the widget. */ - walletAddressLocked?: string; - }; - GetWidgetUrlRefresh: { - /** @description Your api key, if available. This is passed to all the quotes generated in this widget session. */ - apiKey?: string; - /** @description The widget will redirect to this callbackUrl after the user successfully created the transaction. */ - callbackUrl?: string; - countryCode?: components["schemas"]["CountryCode"]; - cryptoLocked?: components["schemas"]["OnChainToken"]; - /** @description A unique identifier for yourself to keep track of the widget session. Returned in the responses of webhooks, if registered. */ - externalSessionId: string; - fiat?: components["schemas"]["FiatToken"]; - inputAmount: string; - network: components["schemas"]["Networks"]; - /** @description The identifier of a partner. */ - partnerId?: string; - paymentMethod?: components["schemas"]["PaymentMethod"]; - rampType: components["schemas"]["RampDirection"]; - /** @description Pass this parameter if you want to lock the wallet address for the user. It will not be editable in the widget. */ - walletAddressLocked?: string; - }; - KYCDataUploadFileFiles: { - /** Format: url */ - CNHUploadUrl?: string; - /** Format: url */ - RGBackUploadUrl?: string; - /** Format: url */ - RGFrontUploadUrl?: string; - /** Format: url */ - selfieUploadUrl?: string; - }; - /** @enum {string} */ - KYCDocType: "RG" | "CNH"; - KycLevel1Payload: { - city: string; - country: string; - countryOfTaxId: string; - /** @description ISO date (YYYY-MM-DD). */ - dateOfBirth: string; - /** Format: email */ - email: string; - fullName: string; - state: string; - streetAddress: string; - subAccountId: string; - taxIdNumber: string; - uploadedDocumentId: string; - uploadedSelfieId: string; - zipCode: string; - }; - KycLevel1Response: { - id: string; - }; - /** - * @description Supported blockchain networks. - * @enum {string} - */ - Networks: "assethub" | "arbitrum" | "avalanche" | "base" | "bsc" | "ethereum" | "polygon" | "moonbeam"; - /** @enum {string} */ - OnChainToken: "USDC" | "USDT" | "ETH" | "USDC.E"; - /** @description Data related to the payment for the ramp transaction. */ - PaymentData: { - /** - * @description The amount for the payment. - * @example 0.05 - */ - amount?: string; - /** - * @description The target account for an anchor operation. - * @example GDSDQLBVDD5RZYKNDM2LAX5JDNNQOTSZOKECUYEXYMUZMAPXTMDUJCVF - */ - anchorTargetAccount?: string; - /** - * @description The memo content. - * @example 1204asjfnaksf10982e4 - */ - memo?: string; - /** - * @description Type of memo (e.g., text, id). - * @example text - */ - memoType?: string; - }; - /** @description `PIX`, `SEPA`, `CBU` */ - PaymentMethod: string; - /** @description Represents a transaction that has been presigned. Based on UnsignedTx structure. */ - PresignedTx: { - /** @description Any additional metadata associated with the transaction. Can be an empty object. */ - meta?: { - [key: string]: unknown; - }; - /** - * Format: int64 - * @description Nonce for the transaction, if applicable. - */ - nonce?: number; - /** - * @description The phase this transaction belongs to within the ramp logic. - * @enum {string} - */ - phase?: "RampPhase" | "CleanupPhase"; - /** @description Address of the account that signed/will sign this transaction. */ - signer?: string; - /** - * @description The presigned transaction payload or relevant data. - * @example AAAAAKg... - */ - txData?: string; - } & { - [key: string]: unknown; - }; - QuoteResponse: { - anchorFeeFiat: string; - anchorFeeUSD: string; - /** - * Format: date-time - * @description The timestamp when this quote expires. - */ - expiresAt?: string; - feeCurrency: components["schemas"]["RampCurrency"]; - from?: components["schemas"]["DestinationType"]; - /** - * Format: uuid - * @description Unique identifier for the quote. - */ - id?: string; - /** @description The input amount specified in the request. */ - inputAmount?: string; - inputCurrency?: components["schemas"]["RampCurrency"]; - networkFeeFiat: string; - networkFeeUSD: string; - /** @description The calculated output amount after fees and conversions. */ - outputAmount?: string; - outputCurrency?: components["schemas"]["RampCurrency"]; - partnerFeeFiat: string; - partnerFeeUSD: string; - processingFeeFiat: string; - processingFeeUSD: string; - /** @description The type of ramp process. */ - rampType?: components["schemas"]["RampDirection"]; - to?: components["schemas"]["DestinationType"]; - totalFeeFiat: string; - totalFeeUSD: string; - vortexFeeFiat: string; - vortexFeeUSD: string; - }; - /** - * @description Represents supported currencies for ramp operations, including fiat and on-chain tokens. - * @example USDC - * @enum {string} - */ - RampCurrency: "EUR" | "ARS" | "BRL" | "USDC" | "USDT" | "USDC.E"; - /** @enum {string} */ - RampDirection: "BUY" | "SELL"; - RampErrorLog: { - details?: string; - error: string; - phase: components["schemas"]["RampPhase"]; - recoverable?: boolean; - /** Format: date-time */ - timestamp: string; - }; - /** - * @description The current phase of the ramp process. - * @enum {string} - */ - RampPhase: - | "initial" - | "timedOut" - | "stellarCreateAccount" - | "squidrouterApprove" - | "squidrouterSwap" - | "fundEphemeral" - | "nablaApprove" - | "nablaSwap" - | "moonbeamToPendulum" - | "moonbeamToPendulumXcm" - | "pendulumToMoonbeam" - | "assethubToPendulum" - | "pendulumToAssethub" - | "spacewalkRedeem" - | "stellarPayment" - | "subsidizePreSwap" - | "subsidizePostSwap" - | "brlaTeleport" - | "onHoldForComplianceCheck" - | "brlaPayoutOnMoonbeam" - | "failed"; - RampProcess: { - anchorFeeFiat: string; - anchorFeeUSD: string; - countryCode?: components["schemas"]["CountryCode"]; - /** - * Format: date-time - * @description Timestamp of when the ramp process was created. - */ - createdAt?: string; - currentPhase?: components["schemas"]["RampPhase"]; - /** @description BR Code for PIX payment, if applicable. */ - depositQrCode?: string | null; - feeCurrency: components["schemas"]["RampCurrency"]; - /** @description The source network or payment method. */ - from?: components["schemas"]["DestinationType"]; - /** @description Unique identifier for the ramp process. */ - id?: string; - inputAmount: string; - inputCurrency: string; - network?: components["schemas"]["Networks"]; - networkFeeFiat: string; - networkFeeUSD: string; - outputAmount: string; - outputCurrency: string; - partnerFeeFiat: string; - partnerFeeUSD: string; - paymentMethod: components["schemas"]["PaymentMethod"]; - processingFeeFiat: string; - processingFeeUSD: string; - /** - * Format: uuid - * @description The quote ID associated with this ramp process. - */ - quoteId?: string; - /** @description The `externalSessionId` is an optional URL parameter that integrators can provide to track ramp transactions within their own systems. This identifier allows you to correlate Vortex transactions with your internal session or transaction tracking. `externalSessionId` url param is named `sessionId` in the Vortex API. */ - sessionId?: string; - status?: components["schemas"]["SimpleStatus"]; - /** @description The destination network or payment method. */ - to?: components["schemas"]["DestinationType"]; - totalFeeFiat: string; - totalFeeUSD: string; - /** @description (BUY-only) A link to a block explorer showing the details for the transaction hash. */ - transactionExplorerLink?: string; - /** @description (BUY-only) The hash of the transaction transferring the expected outputAmount to the wallet address. */ - transactionHash?: string; - /** @description Type of ramp process. */ - type?: components["schemas"]["RampDirection"]; - /** @description Array of unsigned transactions that need to be signed by the user. */ - unsignedTxs?: components["schemas"]["UnsignedTx"][]; - /** - * Format: date-time - * @description Timestamp of the last update to the ramp process. - */ - updatedAt?: string; - vortexFeeFiat: string; - vortexFeeUSD: string; - /** @description The address of the source account for SELL, or the address the destination account for BUY transactions. */ - walletAddress?: string; - }; - RegisterRampRequest: { - /** - * @description Optional additional data for the ramp process. - * - * For Stellar offramps, paymentData is required. - * - * For Brazil onramps, destinationAddress and taxId arerequired. - * - * For Brazil offramps, pixDestination, taxId and receiverTaxId are required. - */ - additionalData?: { - /** @description Destination address, used for onramp. */ - destinationAddress?: string; - /** @description Auth token obtained from Monerium's API, for the current user. Only required for Monerium-related ramps. */ - moneriumAuthToken: string; - paymentData?: components["schemas"]["PaymentData"]; - /** @description PIX key for the destination account in an onramp. */ - pixDestination?: string; - /** @description Tax ID of the receiver for onramp. */ - receiverTaxId?: string; - /** @description Tax ID of the user. */ - taxId?: string; - /** @description Wallet address initiating the offramp. */ - walletAddress: string; - } & { - [key: string]: unknown; - }; - /** - * Format: uuid - * @description The unique identifier for the quote. - */ - quoteId: string; - /** - * @description Array of accounts that will be used for signing transactions. - * - * For Stellar offramps, Stellar and Pendulum ephemerals are required. - * For Brazil on/off ramps, Moonbeam and Pendulum ephemerals are required. - */ - signingAccounts: { - /** @description The account address. */ - address: string; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/ramp/history/{walletAddress}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; /** - * @description The type of the account. - * @enum {string} + * Get ramp history for wallet address + * @description Fetches the transaction history for a given wallet address. The response returns the last 20 items by default. This can be adjusted by using the `limit` and `offset` query parameters. */ - type: "EVM" | "Stellar" | "Substrate"; - }[]; - }; - /** @description `PENDING`, `FAILED`, `COMPLETED` */ - SimpleStatus: string; - StartKYC2Request: { - documentType: components["schemas"]["KYCDocType"]; - taxId: string; - }; - StartKYC2Response: { - uploadUrls?: components["schemas"]["KYCDataUploadFileFiles"]; - }; - StartRampRequest: { - rampId: string; - }; - /** @enum {string} */ - TaxIdType: "CPF" | "CNPJ"; - TriggerOfframpRequest: { - /** - * @description The amount to offramp. - * @example 100.50 - */ - amount: string; - /** @description The recipient's PIX key. */ - pixKey: string; - /** @description The recipient's Tax ID for validation. */ - receiverTaxId: string; - /** @description The sender's Tax ID. */ - taxId: string; - }; - TriggerOfframpResponse: { - /** @description The ID of the triggered offramp transaction. */ - offrampId?: string; - }; - /** @description Represents an unsigned transaction that requires user signature. Actual properties will depend on the transaction type and network. */ - UnsignedTx: { - meta?: Record; - nonce?: number; - /** @enum {string} */ - phase?: "RampPhase" | "CleanupPhase"; - signer?: string; - /** - * @description The unsigned transaction payload or relevant data. - * @example AAAAAKu... - */ - txData?: string; - } & { - [key: string]: unknown; - }; - UpdateRampRequest: { - /** @description Optional additional data, like transaction hashes from external services. */ - additionalData?: - | ({ - /** @description Transaction hash for AssetHub to Pendulum transfer, if applicable. */ - assetHubToPendulumHash?: string | null; - /** @description Signed message to trigger a Monerium offramp. */ - moneriumOfframpSignature: string; - /** @description Transaction hash for Squid Router approval, if applicable. */ - squidRouterApproveHash?: string | null; - /** @description Transaction hash for Squid Router swap, if applicable. */ - squidRouterSwapHash?: string | null; - } & { - [key: string]: unknown; - }) - | null; - /** @description An array of transactions that have been pre-signed by the user. */ - presignedTxs: components["schemas"]["PresignedTx"][]; - /** - * @description The unique identifier of the ramp process to start. - * @example proc_12345 - */ - rampId: string; - }; - ValidatePixKeyResponse: { - /** @description Indicates if the PIX key is valid. */ - valid?: boolean; - }; - }; - responses: { - "Invalid input": { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - code: number; - message: string; - }; - }; - }; - "Record not found": { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - code: number; - message: string; - }; - }; - }; - }; - parameters: never; - requestBodies: never; - headers: never; - pathItems: never; -} -export type $defs = Record; -export interface operations { - createSubaccount: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: { - content: { - "application/json": components["schemas"]["CreateSubaccountRequest"]; - }; - }; - responses: { - /** @description Subaccount created or KYC retry initiated successfully. */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["CreateSubaccountResponse"]; - }; - }; - /** - * @description Bad Request. Possible reasons: - * - Missing required fields (cpf, cnpj, companyName, startDate) - * - Subaccount already created and KYC level > 0 - * - Other invalid request details - */ - 400: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["BrlaErrorResponse"]; - }; - }; - /** @description Internal Server Error. */ - 500: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["BrlaErrorResponse"]; - }; - }; - }; - }; - fetchSubaccountKycStatus: { - parameters: { - query: { - /** @description The user's Tax ID. */ - taxId: string; - }; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Successfully retrieved KYC status. */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["GetKycStatusResponse"]; - }; - }; - /** @description Missing taxId or subaccount not found (returned as 400 from code). */ - 400: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["BrlaErrorResponse"]; - }; - }; - /** @description No KYC process started. */ - 404: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["BrlaErrorResponse"]; - }; - }; - /** @description Internal Server Error (e.g., no KYC events found when expected). */ - 500: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["BrlaErrorResponse"]; - }; - }; - }; - }; - brlaGetSelfieLivenessUrl: { - parameters: { - query: { - /** @description CPF or CNPJ. */ - taxId: string; - }; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Liveness URL returned. */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["BrlaGetSelfieLivenessUrlResponse"]; - }; - }; - /** @description Missing taxId or ramp disabled. */ - 400: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["BrlaErrorResponse"]; - }; - }; - /** @description Supabase Bearer required. */ - 401: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Internal server error. */ - 500: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["BrlaErrorResponse"]; - }; - }; - }; - }; - brlaGetUploadUrls: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody: { - content: { - "application/json": components["schemas"]["AveniaKYCDataUploadRequest"]; - }; - }; - responses: { - /** @description Upload URLs returned. */ - 200: { - headers: { - [name: string]: unknown; + get: { + parameters: { + query?: { + /** @description The maximum count of transaction items returned in this query. The maximum value is `100`. */ + limit?: number; + /** @description The offset for querying the transactions. Necessary if the number of transaction items of the address is larger than the maximum limit. A larger value will return older transaction items. */ + offset?: number; + }; + header?: never; + path: { + /** @description The wallet address for which the ramp history is queried for. */ + walletAddress: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["GetRampHistoryResponse"]; + }; + }; + }; }; - content: { - "application/json": components["schemas"]["AveniaKYCDataUploadResponse"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/ramp/register": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Register new ramp process + * @description Initiates a new on-ramp or off-ramp process by providing quote details, signing accounts, and additional data. + */ + post: operations["registerRamp"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/ramp/start": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Start ramp process + * @description Starts a ramp process. + * + * It is assumed all required information from the client has already been sent using the `update` endpoint. This endpoint is only used to tell the backend any external operation (like a bank transfer) has been completed, and the ramp can start. + */ + post: operations["startRamp"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/ramp/update": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Update ramp process + * @description Submits presigned transactions and additional data to an existing ramp process before starting it. + * This endpoint can be called many times, and data can be incrementally added to the ramp. + * + * Note: For both pre-signed transactions and the generic `additionalData` object, existing properties will be overriden by new values. + * + * ### Required data for ramps. + * The signed counterpart of the initial unsignedTxs object must be provided for all ramps, as required by the object. + * For offramps, the `additionalData` field must contain the confirmation hash corresponding to the inital transaction in which the user sends the funds. + * If the originating chain is `Assethub`, then `assetHubToPendulumHash` must be provided. + * If the originating chain is any `EVM` chain, then `squidRouterApproveHash` and `squidRouterSwapHash` must be provided. + * + * For onramps, no additional data is required after registering the ramp. + */ + post: operations["startRamp"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/ramp/{id}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; }; - }; - /** @description Missing/invalid documentType or taxId; or ramp disabled for this tax ID. */ - 400: { - headers: { - [name: string]: unknown; + /** + * Get ramp status + * @description Fetches an updated ramp process. + */ + get: { + parameters: { + query?: never; + header?: never; + path: { + /** @description Ramp ID. */ + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + anchorFeeFiat: string; + anchorFeeUSD: string; + countryCode?: components["schemas"]["CountryCode"]; + /** + * Format: date-time + * @description Timestamp of when the ramp process was created. + */ + createdAt?: string; + currentPhase?: components["schemas"]["RampPhase"]; + /** @description BR Code for PIX payment, if applicable. */ + depositQrCode?: string | null; + feeCurrency: components["schemas"]["RampCurrency"]; + /** @description The source network or payment method. */ + from?: components["schemas"]["DestinationType"]; + /** @description Unique identifier for the ramp process. */ + id?: string; + inputAmount: string; + inputCurrency: string; + network?: components["schemas"]["Networks"]; + networkFeeFiat: string; + networkFeeUSD: string; + outputAmount: string; + outputCurrency: string; + partnerFeeFiat: string; + partnerFeeUSD: string; + paymentMethod: components["schemas"]["PaymentMethod"]; + processingFeeFiat: string; + processingFeeUSD: string; + /** + * Format: uuid + * @description The quote ID associated with this ramp process. + */ + quoteId?: string; + /** @description The `externalSessionId` is an optional URL parameter that integrators can provide to track ramp transactions within their own systems. This identifier allows you to correlate Vortex transactions with your internal session or transaction tracking. `externalSessionId` url param is named `sessionId` in the Vortex API. */ + sessionId?: string; + status?: components["schemas"]["SimpleStatus"]; + /** @description The destination network or payment method. */ + to?: components["schemas"]["DestinationType"]; + totalFeeFiat: string; + totalFeeUSD: string; + /** @description (BUY-only) A link to a block explorer showing the details for the transaction hash. */ + transactionExplorerLink?: string; + /** @description (BUY-only) The hash of the transaction transferring the expected outputAmount to the wallet address. */ + transactionHash?: string; + /** @description Type of ramp process. */ + type?: components["schemas"]["RampDirection"]; + /** @description Array of unsigned transactions that need to be signed by the user. */ + unsignedTxs?: components["schemas"]["UnsignedTx"][]; + /** + * Format: date-time + * @description Timestamp of the last update to the ramp process. + */ + updatedAt?: string; + vortexFeeFiat: string; + vortexFeeUSD: string; + /** @description The address of the source account for SELL, or the address the destination account for BUY transactions. */ + walletAddress?: string; + }; + }; + }; + }; }; - content: { - "application/json": components["schemas"]["BrlaErrorResponse"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/ramp/{id}/errors": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; }; - }; - /** @description Internal server error. */ - 500: { - headers: { - [name: string]: unknown; + /** + * Get ramp error logs + * @description Returns the chronological error log for a ramp. + * + * **Auth:** requires either `X-API-Key: sk_*` (partner) OR `Authorization: Bearer ` (user). Ownership is enforced. + */ + get: operations["getRampErrorLogs"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/session/create": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Create widget session + * @description Creates a hosted Vortex Widget session and returns the URL to open for the user. + * + * This single endpoint supports two mutually exclusive request shapes: + * + * - **Fixed quote** (`GetWidgetUrlLocked`) — pass a `quoteId` you created via `POST /v1/quotes`. The widget uses that exact quote and does not refresh it. If the quote expires before the user finishes, they must close the window and start over. + * + * - **Auto-refresh** (`GetWidgetUrlRefresh`) — pass the route parameters (`network`, `rampType`, `inputAmount`, plus `fiat` / `cryptoLocked` / `paymentMethod` as relevant for the direction). The widget creates and refreshes quotes on demand for the user. + * + * Use the example switcher below to see the request shape for each mode. `externalSessionId` is required in both modes and is echoed back in webhook payloads. + */ + post: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["GetWidgetUrlLocked"] | components["schemas"]["GetWidgetUrlRefresh"]; + }; + }; + responses: { + /** @description Returned when a fixed-quote session was created. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + /** + * @example { + * "url": "https://www.vortexfinance.co/widget?externalSessionId=my-session-id"eId=quote_01HXY..." + * } + */ + "application/json": { + /** @description The widget URL to open for the user. */ + url: string; + }; + }; + }; + /** @description Returned when an auto-refresh session was created. */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + /** + * @example { + * "url": "https://www.vortexfinance.co/widget?externalSessionId=my-session-id&rampType=BUY&network=polygon&inputAmount=150&fiat=BRL&cryptoLocked=USDC&paymentMethod=pix" + * } + */ + "application/json": { + /** @description The widget URL to open for the user. */ + url: string; + }; + }; + }; + /** @description Missing required fields, or `quoteId` not provided for fixed-quote mode and route fields not provided for auto-refresh mode. */ + 400: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Quote not found or expired (fixed-quote mode only). */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; }; - content: { - "application/json": components["schemas"]["BrlaErrorResponse"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/supported-countries": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Supported Countries */ + get: { + parameters: { + query?: { + /** + * @description ISO code: "BR", "AR", etc. + * @example + */ + countryCode?: string; + /** @description e.g. "Brazil", "Germany" */ + name?: string; + /** @description e.g. "BRL". All the supported currencies you can get from `supported-fiat-currencies` endpoint. */ + fiatCurrency?: string; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + countries: { + /** @description e.g. `DE` */ + countryCode: string; + }[]; + /** @description e.g. 🇩🇪 */ + emoji: string; + /** @description e.g. `Germany` */ + name: string; + support: { + /** @description e.g. `true` */ + buy: boolean; + /** @description e.g. `true` */ + sell: boolean; + }; + /** @description All the supported currencies you can get from `supported-fiat-currencies` endpoint. */ + supportedCurrencies: string[]; + }; + }; + }; + }; }; - }; - }; - }; - getBrlaUser: { - parameters: { - query: { - /** @description The user's Tax ID. */ - taxId: string; - }; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Successfully retrieved user information. */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["GetUserResponse"]; - }; - }; - /** - * @description Bad Request. Possible reasons: - * - Missing taxId query parameter - * - KYC invalid - */ - 400: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["BrlaErrorResponse"]; - }; - }; - /** @description Subaccount not found. */ - 404: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["BrlaErrorResponse"]; - }; - }; - /** @description Internal Server Error. */ - 500: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["BrlaErrorResponse"]; - }; - }; - }; - }; - getBrlaUserRemainingLimit: { - parameters: { - query: { - /** @description The user's Tax ID. */ - taxId: string; - }; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Successfully retrieved user's remaining limits. */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["GetUserRemainingLimitResponse"]; - }; - }; - /** @description Missing taxId query parameter or other invalid request. */ - 400: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["BrlaErrorResponse"]; - }; - }; - /** @description Subaccount not found or limits not found. */ - 404: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["BrlaErrorResponse"]; - }; - }; - /** @description Internal Server Error. */ - 500: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["BrlaErrorResponse"]; - }; - }; - }; - }; - brlaNewKyc: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody: { - content: { - "application/json": components["schemas"]["KycLevel1Payload"]; - }; - }; - responses: { - /** @description KYC submission accepted. */ - 200: { - headers: { - [name: string]: unknown; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/supported-cryptocurrencies": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; }; - content: { - "application/json": components["schemas"]["KycLevel1Response"]; + /** + * Supported Cryptocurrencies + * @description Retrieve all supported cryptocurrencies, filtered by network. + */ + get: { + parameters: { + query?: { + /** + * @description Filter supported cryptocurrencies by network. Allowed values: `assethub`, `avalanche`, `base`, `bsc`, `ethereum`, `polygon` + * @example + */ + network?: string; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + cryptocurrencies: { + /** @description Defined if network is EVM. */ + assetContractAddress?: string | null; + assetDecimals: number; + /** @description Defined if network is Assethub. */ + assetForeignAssetId?: string | null; + assetNetwork: components["schemas"]["Networks"]; + assetSymbol: string; + }[]; + }; + }; + }; + }; }; - }; - /** @description Validation failure. */ - 400: { - headers: { - [name: string]: unknown; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/supported-fiat-currencies": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Supported Fiat Currencies */ + get: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + currencies: { + /** @description e.g. `2` */ + decimals: number; + /** @description e.g. `Brazilian Real` */ + name: string; + /** @description e.g. `BRL` */ + symbol: string; + }[]; + }; + }; + }; + }; }; - content: { - "application/json": components["schemas"]["BrlaErrorResponse"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/supported-payment-methods": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; }; - }; - /** @description Internal server error. */ - 500: { - headers: { - [name: string]: unknown; + /** + * Supported Payment Methods + * @description Retrieve all available payment methods, filtered by type or fiat. + */ + get: { + parameters: { + query?: { + /** + * @description Filter supported payment methods by the ramp type. Allowed values: `sell` or `buy`. + * @example + */ + type?: string; + /** + * @description Filter supported payment methods by fiat currency. Allowed values: `EUR`, `ARS`, `BRL`, `USD`, `MXN`, `COP`. + * @example + */ + fiat?: string; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @description Array of supported payment methods matching the params. */ + "paymentMethods:": { + /** @description Unique identifier of the payment method: `sepa`, `pix`, `cbu` */ + id: string; + /** @description Payment method limits in USD */ + limits: { + max: number; + min: number; + }; + /** @description Unique name of the payment method: `SEPA`, `PIX`, `CBU` */ + name: string; + /** @description Array of supported fiat currencies by payment method. */ + supportedFiats: string[]; + }[]; + }; + }; + }; + }; }; - content: { - "application/json": components["schemas"]["BrlaErrorResponse"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/webhook": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Register Webhook + * @description Register a new webhook to receive event notifications. + * + * **Auth:** requires `X-API-Key: sk_*`. Supabase Bearer is NOT accepted on webhook endpoints. + */ + post: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + events?: string[]; + /** @description (required* one of two: quoteId or sessionId): Subscribe to events for a specific quote */ + quoteId?: string; + /** @description (required* one of two: quoteId or sessionId): Subscribe to events for a specific session */ + sessionId?: string; + /** @description Your HTTPS webhook endpoint URL */ + url: string; + }; + }; + }; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + /** + * @example { + * "createdAt": "2025-10-01T16:21:04.648Z", + * "events": [ + * "TRANSACTION_CREATED", + * "STATUS_CHANGE" + * ], + * "id": "340ba946-f3f3-4007-893c-3374bfcd096b", + * "isActive": true, + * "quoteId": "3258910e-93ee-443e-b793-28cc1d4ccdf3", + * "sessionId": null, + * "url": "https://your-website.com" + * } + */ + "application/json": { + /** @description The creation date of the webhook */ + createdAt: string; + /** @description The events the webhook is subscribed for */ + events: string[]; + /** @description Webhook UUID */ + id: string; + /** @description Is the webhook active */ + isActive: boolean; + /** @description (optional): The specific transactionId that the events are subscribed for */ + quoteId?: string; + /** @description (optional): The specific sessionId that the events are subscribed for */ + sessionId?: string; + /** @description Your HTTPS webhook endpoint URL */ + url: string; + }; + }; + }; + }; }; - }; - }; - }; - brlaValidatePixKey: { - parameters: { - query: { - /** @description Pix key to validate (CPF, CNPJ, email, phone, or random key). */ - pixKey: string; - }; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Validation result. */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["BrlaValidatePixKeyResponse"]; - }; - }; - /** @description Missing or invalid pix key. */ - 400: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["BrlaErrorResponse"]; - }; - }; - /** @description Supabase Bearer required. */ - 401: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Internal server error. */ - 500: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["BrlaErrorResponse"]; - }; - }; - }; - }; - createQuote: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: { - content: { + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/webhook/{id}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post?: never; /** - * @example { - * "from": "pix", - * "inputAmount": "33", - * "inputCurrency": "BRL", - * "outputCurrency": "USDC", - * "partnerId": "myPartnerId", - * "rampType": "BUY", - * "to": "polygon" - * } + * Delete Webhook + * @description Remove a webhook subscription. + * + * **Auth:** requires `X-API-Key: sk_*`. Supabase Bearer is NOT accepted on webhook endpoints. */ - "application/json": { - /** @description Your api key, if available. */ - apiKey?: string; - countryCode?: components["schemas"]["CountryCode"]; - /** @description From destination */ - from: components["schemas"]["DestinationType"]; - /** - * @description The amount of currency to be input. - * @example 100.00 - */ - inputAmount: string; - /** @description The currency type for the input amount. */ - inputCurrency: components["schemas"]["RampCurrency"]; - network?: components["schemas"]["Networks"]; - /** @description The desired currency type for the output amount. */ - outputCurrency: components["schemas"]["RampCurrency"]; - /** @description Your partner ID, if available. */ - partnerId?: string; - paymentMethod?: components["schemas"]["PaymentMethod"]; - /** @description The type of ramp process (on-ramp or off-ramp). */ - rampType: components["schemas"]["RampDirection"]; - /** @description To destination */ - to: components["schemas"]["DestinationType"]; - }; - }; + delete: { + parameters: { + query?: never; + header?: never; + path: { + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + message: string; + success: boolean; + }; + }; + }; + }; + }; + options?: never; + head?: never; + patch?: never; + trace?: never; }; - responses: { - /** @description Quote successfully created. */ - 201: { - headers: { - [name: string]: unknown; - }; - content: { - /** - * @example { - * "expiresAt": "2025-05-16T12:30:00Z", - * "fee": "0.50", - * "from": "polygon", - * "id": "quote_7af7171e-aa42-49a2-80c2-9e18483bad38", - * "inputAmount": "33", - * "inputCurrency": "usdc", - * "outputAmount": "32500.50", - * "outputCurrency": "ars", - * "rampType": "sell", - * "to": "cbu" - * } - */ - "application/json": { - anchorFeeFiat: string; - anchorFeeUSD: string; +} +export type webhooks = Record; +export interface components { + schemas: { + AccountMeta: { + /** @description The account address. */ + address: string; /** - * Format: date-time - * @description The timestamp when this quote expires. + * @description The type of the account. + * @enum {string} */ - expiresAt?: string; - feeCurrency: components["schemas"]["RampCurrency"]; - from?: components["schemas"]["DestinationType"]; + type: "EVM" | "Stellar" | "Substrate"; + }; + /** @enum {string} */ + AveniaDocumentType: "ID" | "DRIVERS-LICENSE" | "PASSPORT" | "SELFIE" | "SELFIE-FROM-LIVENESS"; + AveniaKYCDataUploadRequest: { + documentType: components["schemas"]["AveniaDocumentType"]; + /** @description CPF or CNPJ. */ + taxId: string; + }; + AveniaKYCDataUploadResponse: { + idUpload: components["schemas"]["DocumentUploadEntry"]; + selfieUpload: components["schemas"]["DocumentUploadEntry"]; + }; + BrlaAddress: { + cep: string; + city: string; + complement?: string | null; + district: string; + number: string; + state: string; + street: string; + }; + BrlaErrorResponse: { + /** @description Detailed error message or object from BRLA API or server. */ + details?: null & (string | { + [key: string]: unknown; + }); + /** @description A summary of the error. */ + error?: string; + }; + BrlaGetSelfieLivenessUrlResponse: { + id: string; + livenessUrl: string; + uploadURLFront: string; + validateLivenessToken: string; + }; + BrlaValidatePixKeyResponse: { + valid: boolean; + }; + CleanupPhase: { + /** @enum {string} */ + string?: "moonbeamCleanup" | "pendulumCleanup" | "stellarCleanup"; + }; + /** @description Allowed values: `AR`, `BR`, `EU` */ + CountryCode: string; + CreateBestQuoteRequest: { + /** @description Your api key, if available. */ + apiKey?: string; + countryCode?: components["schemas"]["CountryCode"]; + /** @description `PIX`, `SEPA`, `CBU`. Only required if `rampType` is "BUY". */ + from?: components["schemas"]["PaymentMethod"]; /** - * Format: uuid - * @description Unique identifier for the quote. + * @description The amount of currency to be input. + * @example 100.00 */ - id?: string; - /** @description The input amount specified in the request. */ - inputAmount?: string; - inputCurrency?: components["schemas"]["RampCurrency"]; - networkFeeFiat: string; - networkFeeUSD: string; - /** @description The calculated output amount after fees and conversions. */ - outputAmount?: string; - outputCurrency?: components["schemas"]["RampCurrency"]; - partnerFeeFiat: string; - partnerFeeUSD: string; - processingFeeFiat: string; - processingFeeUSD: string; - /** @description The type of ramp process. */ - rampType?: components["schemas"]["RampDirection"]; - to?: components["schemas"]["DestinationType"]; - totalFeeFiat: string; - totalFeeUSD: string; - vortexFeeFiat: string; - vortexFeeUSD: string; - }; - }; - }; - /** - * @description Bad Request. Possible reasons: - * - Missing required fields (rampType, from, to, inputAmount, inputCurrency, outputCurrency) - * - Invalid ramp type (must be "BUY" or "SELL") - */ - 400: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ErrorResponse"]; - }; - }; - /** @description Internal Server Error. Low-liquidity route failures use this status with a safe user-facing message; unexpected internal failures remain masked. */ - 500: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ErrorResponse"]; - }; - }; - }; - }; - createBestQuote: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: { - content: { + inputAmount: string; + /** @description The currency type for the input amount. */ + inputCurrency: components["schemas"]["RampCurrency"]; + /** @description Optional whitelist of networks to evaluate when searching for the best quote. If omitted or empty, all eligible networks for the corridor are considered. */ + networks?: components["schemas"]["Networks"][]; + /** @description The desired currency type for the output amount. */ + outputCurrency: components["schemas"]["RampCurrency"]; + /** @description Your partner ID, if available. */ + partnerId?: string; + paymentMethod?: components["schemas"]["PaymentMethod"]; + /** @description The type of ramp process (on-ramp or off-ramp). */ + rampType: components["schemas"]["RampDirection"]; + /** @description `PIX`, `SEPA`, `CBU`. Only required if `rampType` is "SELL". */ + to?: components["schemas"]["PaymentMethod"]; + }; + CreateQuoteRequest: { + /** @description Your api key, if available. */ + apiKey?: string; + countryCode?: components["schemas"]["CountryCode"]; + /** @description From destination */ + from: components["schemas"]["DestinationType"]; + /** + * @description The amount of currency to be input. + * @example 100.00 + */ + inputAmount: string; + /** @description The currency type for the input amount. */ + inputCurrency: components["schemas"]["RampCurrency"]; + network?: components["schemas"]["Networks"]; + /** @description The desired currency type for the output amount. */ + outputCurrency: components["schemas"]["RampCurrency"]; + /** @description Your partner ID, if available. */ + partnerId?: string; + paymentMethod?: components["schemas"]["PaymentMethod"]; + /** @description The type of ramp process (on-ramp or off-ramp). */ + rampType: components["schemas"]["RampDirection"]; + /** @description To destination */ + to: components["schemas"]["DestinationType"]; + }; + CreateSubaccountRequest: { + address: components["schemas"]["BrlaAddress"]; + /** + * Format: date + * @description Date must be in format YYYY-MMM-DD. + */ + birthdate: string; + cnpj?: string | null; + companyName?: string | null; + cpf: string; + fullName: string; + phone: string; + /** @description Optional. The quote that triggered onboarding. Omit it for the quote-less KYB deep link (`?kyb` / `?kybLocked` widget entry), where business verification starts before any quote exists. Stored only as onboarding provenance; it is not an authorization input. */ + quoteId?: string | null; + /** + * Format: date + * @description Date must be in format YYYY-MMM-DD. + */ + startDate?: string | null; + taxIdType: components["schemas"]["TaxIdType"]; + }; + CreateSubaccountResponse: { + /** @description The ID of the created or processed subaccount. */ + subaccountId?: string; + }; /** - * @example { - * "from": "pix", - * "inputAmount": "30", - * "inputCurrency": "BRL", - * "outputCurrency": "USDC", - * "partnerId": "myPartnerId", - * "rampType": "BUY" - * } + * @description Represents either a blockchain network or a traditional payment method. + * @enum {string} */ - "application/json": components["schemas"]["CreateBestQuoteRequest"]; - }; - }; - responses: { - /** @description Quote successfully created. */ - 201: { - headers: { - [name: string]: unknown; + DestinationType: "assethub" | "arbitrum" | "avalanche" | "base" | "bsc" | "ethereum" | "polygon" | "moonbeam" | "pendulum" | "stellar" | "pix" | "sepa" | "cbu" | "ach" | "spei"; + DocumentUploadEntry: { + id: string; + livenessUrl?: string; + uploadURLBack?: string; + uploadURLFront: string; + validateLivenessToken?: string; + }; + ErrorResponse: { + /** @description HTTP status code returned by the API error handler. */ + code?: number; + /** @description Validation error details, when the request fails schema or input validation. */ + errors?: Record[]; + /** @description A human-readable error message. */ + message?: string; + /** @description HTTP status code included by selected provider-style error responses. */ + statusCode?: number; + /** @description Provider-style error category, when available. */ + type?: string; + }; + /** @enum {string} */ + FiatToken: "EUR" | "ARS" | "BRL" | "USD" | "MXN" | "COP"; + GetKycStatusResponse: { + /** @description The KYC level achieved. */ + level?: number; + /** + * @description The KYC status. + * @enum {string} + */ + status?: "PENDING" | "APPROVED" | "REJECTED"; + /** + * @description Event type, typically "KYC". + * @enum {string} + */ + type?: "KYC"; + }; + GetRampErrorLogsResponse: components["schemas"]["RampErrorLog"][]; + GetRampHistoryResponse: { + totalCount: string; + transactions: components["schemas"]["GetRampHistoryTransaction"]; + }; + GetRampHistoryTransaction: { + date: string; + /** @description A link to the transaction explorer of the blockchain showing the details of the transaction sending the tokens to the user's wallet address. Only available for 'BUY' ramps. */ + externalTxExplorerLink?: string; + /** @description The hash of the blockchain transaction sending the tokens to the user's wallet address. Only available for 'BUY' ramps. */ + externalTxHash?: string; + from: components["schemas"]["DestinationType"]; + fromAmount: string; + fromCurrency: components["schemas"]["RampCurrency"]; + id: string; + status: components["schemas"]["SimpleStatus"]; + to: components["schemas"]["DestinationType"]; + toAmount: string; + toCurrency: components["schemas"]["RampCurrency"]; + type: components["schemas"]["RampDirection"]; + }; + GetUserRemainingLimitResponse: { + /** + * Format: double + * @description The remaining limit for offramp operations. + */ + remainingLimitOfframp?: number; + /** + * Format: double + * @description The remaining limit for onramp operations. + */ + remainingLimitOnramp?: number; + }; + GetUserResponse: { + /** @description The user's EVM wallet address. */ + evmAddress?: string; + /** + * @description The user's KYC level. + * @enum {number} + */ + kycLevel?: 1 | 2; + }; + GetWidgetUrlLocked: { + /** @description The widget will redirect to this callbackUrl after the user successfully created the transaction. */ + callbackUrl?: string; + /** @description A unique identifier for yourself to keep track of the widget session. Returned in the responses of webhooks, if registered. */ + externalSessionId?: string; + /** @description Pass the ID of an existing quote to make the widget lock in that particular quote without allowing to change it. */ + quoteId: string; + /** @description Pass this parameter if you want to lock the wallet address for the user. It will not be editable in the widget. */ + walletAddressLocked?: string; + }; + GetWidgetUrlRefresh: { + /** @description Your api key, if available. This is passed to all the quotes generated in this widget session. */ + apiKey?: string; + /** @description The widget will redirect to this callbackUrl after the user successfully created the transaction. */ + callbackUrl?: string; + countryCode?: components["schemas"]["CountryCode"]; + cryptoLocked?: components["schemas"]["OnChainToken"]; + /** @description A unique identifier for yourself to keep track of the widget session. Returned in the responses of webhooks, if registered. */ + externalSessionId: string; + fiat?: components["schemas"]["FiatToken"]; + inputAmount: string; + network: components["schemas"]["Networks"]; + /** @description The identifier of a partner. */ + partnerId?: string; + paymentMethod?: components["schemas"]["PaymentMethod"]; + rampType: components["schemas"]["RampDirection"]; + /** @description Pass this parameter if you want to lock the wallet address for the user. It will not be editable in the widget. */ + walletAddressLocked?: string; + }; + KYCDataUploadFileFiles: { + /** Format: url */ + CNHUploadUrl?: string; + /** Format: url */ + RGBackUploadUrl?: string; + /** Format: url */ + RGFrontUploadUrl?: string; + /** Format: url */ + selfieUploadUrl?: string; + }; + /** @enum {string} */ + KYCDocType: "RG" | "CNH"; + KycLevel1Payload: { + city: string; + country: string; + countryOfTaxId: string; + /** @description ISO date (YYYY-MM-DD). */ + dateOfBirth: string; + /** Format: email */ + email: string; + fullName: string; + state: string; + streetAddress: string; + subAccountId: string; + taxIdNumber: string; + uploadedDocumentId: string; + uploadedSelfieId: string; + zipCode: string; + }; + KycLevel1Response: { + id: string; + }; + ListUserApiKeysResponse: { + apiKeys: { + /** Format: date-time */ + createdAt: string; + /** Format: date-time */ + expiresAt: string; + id: string; + isActive: boolean; + /** @description Full key value; present for public keys only. Secret key values are never returned after creation. */ + key?: string; + keyPrefix: string; + /** Format: date-time */ + lastUsedAt?: string | null; + name: string; + /** @enum {string} */ + type: "public" | "secret"; + /** Format: date-time */ + updatedAt: string; + }[]; + }; + /** + * @description Supported blockchain networks. + * @enum {string} + */ + Networks: "assethub" | "arbitrum" | "avalanche" | "base" | "bsc" | "ethereum" | "polygon" | "moonbeam"; + /** @enum {string} */ + OnChainToken: "USDC" | "USDT" | "ETH" | "USDC.E"; + /** @description Data related to the payment for the ramp transaction. */ + PaymentData: { + /** + * @description The amount for the payment. + * @example 0.05 + */ + amount?: string; + /** + * @description The target account for an anchor operation. + * @example GDSDQLBVDD5RZYKNDM2LAX5JDNNQOTSZOKECUYEXYMUZMAPXTMDUJCVF + */ + anchorTargetAccount?: string; + /** + * @description The memo content. + * @example 1204asjfnaksf10982e4 + */ + memo?: string; + /** + * @description Type of memo (e.g., text, id). + * @example text + */ + memoType?: string; + }; + /** @description `PIX`, `SEPA`, `CBU` */ + PaymentMethod: string; + /** @description Represents a transaction that has been presigned. Based on UnsignedTx structure. */ + PresignedTx: { + /** @description Any additional metadata associated with the transaction. Can be an empty object. */ + meta?: { + [key: string]: unknown; + }; + /** + * Format: int64 + * @description Nonce for the transaction, if applicable. + */ + nonce?: number; + /** + * @description The phase this transaction belongs to within the ramp logic. + * @enum {string} + */ + phase?: "RampPhase" | "CleanupPhase"; + /** @description Address of the account that signed/will sign this transaction. */ + signer?: string; + /** + * @description The presigned transaction payload or relevant data. + * @example AAAAAKg... + */ + txData?: string; + } & { + [key: string]: unknown; }; - content: { - "application/json": { + QuoteResponse: { anchorFeeFiat: string; anchorFeeUSD: string; /** @@ -2194,184 +1471,29 @@ export interface operations { totalFeeUSD: string; vortexFeeFiat: string; vortexFeeUSD: string; - }; - }; - }; - /** - * @description Bad Request. Possible reasons: - * - Missing required fields (rampType, from, to, inputAmount, inputCurrency, outputCurrency) - * - Invalid ramp type (must be "BUY" or "SELL") - */ - 400: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ErrorResponse"]; - }; - }; - /** @description Internal Server Error. Low-liquidity route failures use this status with a safe user-facing message when every eligible route cannot serve the requested amount; unexpected internal failures remain masked. */ - 500: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["ErrorResponse"]; - }; - }; - }; - }; - getRampErrorLogs: { - parameters: { - query?: never; - header?: never; - path: { - /** @description Ramp ID. */ - id: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Error log array (empty if no errors). */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["GetRampErrorLogsResponse"]; - }; - }; - /** @description Authentication required. */ - 401: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Ramp does not belong to authenticated principal. */ - 403: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Ramp not found. */ - 404: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - }; - }; - registerRamp: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: { - content: { + }; /** - * @example { - * "additionalData": { - * "pixDestination": "711.711.011-11", - * "receiverTaxId": "0x7b79995e5f793a07bc00c21412e50ecae098e7f9", - * "taxId": "711.711.011-11" - * }, - * "quoteId": "8e4bca04-aa22-4f86-9ce5-80aaef58ef83", - * "signingAccounts": [ - * { - * "address": "0x7b79995e5f793a07bc00c21412e50ecae098e7f9", - * "network": "moonbeam" - * }, - * { - * "address": "6ftBYTotU4mmCuvUqJvk6qEP7uCzzz771pTMoxcbHFb9rcPv", - * "network": "pendulum" - * } - * ] - * } + * @description Represents supported currencies for ramp operations, including fiat and on-chain tokens. + * @example USDC + * @enum {string} */ - "application/json": { - /** - * @description Optional additional data for the ramp process. - * - * For Stellar offramps, paymentData is required. - * - * For Brazil onramps, destinationAddress and taxId arerequired. - * - * For Brazil offramps, pixDestination, taxId and receiverTaxId are required. - */ - additionalData?: { - /** @description Destination address, used for onramp. */ - destinationAddress?: string; - /** @description Auth token obtained from Monerium's API, for the current user. Only required for Monerium-related ramps. */ - moneriumAuthToken: string; - paymentData?: components["schemas"]["PaymentData"]; - /** @description PIX key for the destination account in an onramp. */ - pixDestination?: string; - /** @description Tax ID of the receiver for onramp. */ - receiverTaxId?: string; - sessionId?: string; - /** @description Tax ID of the user. */ - taxId?: string; - /** @description Wallet address initiating the offramp. */ - walletAddress: string; - } & { - [key: string]: unknown; - }; - /** - * Format: uuid - * @description The unique identifier for the quote. - */ - quoteId: string; - /** - * @description Array of accounts that will be used for signing transactions. - * - * For Stellar offramps, Stellar and Pendulum ephemerals are required. - * For Brazil on/off ramps, Moonbeam and Pendulum ephemerals are required. - */ - signingAccounts: { - /** @description The account address. */ - address: string; - /** - * @description The type of the account. - * @enum {string} - */ - type: "EVM" | "Stellar" | "Substrate"; - }[]; + RampCurrency: "EUR" | "ARS" | "BRL" | "USD" | "MXN" | "COP" | "USDC" | "USDT" | "USDC.E"; + /** @enum {string} */ + RampDirection: "BUY" | "SELL"; + RampErrorLog: { + details?: string; + error: string; + phase: components["schemas"]["RampPhase"]; + recoverable?: boolean; + /** Format: date-time */ + timestamp: string; }; - }; - }; - responses: { - /** @description Ramp process successfully registered. */ - 201: { - headers: { - [name: string]: unknown; - }; - content: { - /** - * @example { - * "brCode": "00020126...", - * "createdAt": "2024-05-16T10:00:00Z", - * "currentPhase": "pending_signature", - * "from": "stellar", - * "id": "proc_12345", - * "quoteId": "41a756dc-04e4-4e4b-b243-9c8f977c24d6", - * "to": "pix", - * "type": "off", - * "unsignedTxs": [ - * { - * "data": "AAAA...", - * "type": "stellar_payment" - * } - * ], - * "updatedAt": "2024-05-16T10:00:00Z" - * } - */ - "application/json": { + /** + * @description The current phase of the ramp process. + * @enum {string} + */ + RampPhase: "initial" | "timedOut" | "stellarCreateAccount" | "squidrouterApprove" | "squidrouterSwap" | "fundEphemeral" | "nablaApprove" | "nablaSwap" | "moonbeamToPendulum" | "moonbeamToPendulumXcm" | "pendulumToMoonbeam" | "assethubToPendulum" | "pendulumToAssethub" | "spacewalkRedeem" | "stellarPayment" | "subsidizePreSwap" | "subsidizePostSwap" | "brlaTeleport" | "onHoldForComplianceCheck" | "brlaPayoutOnMoonbeam" | "failed"; + RampProcess: { anchorFeeFiat: string; anchorFeeUSD: string; countryCode?: components["schemas"]["CountryCode"]; @@ -2429,306 +1551,1593 @@ export interface operations { vortexFeeUSD: string; /** @description The address of the source account for SELL, or the address the destination account for BUY transactions. */ walletAddress?: string; - }; - }; - }; - /** @description Bad Request - Invalid input, missing required fields, or validation error. */ - 400: { - headers: { - [name: string]: unknown; - }; - content: { - /** - * @example { - * "message": "Missing required fields" - * } - */ - "application/json": components["schemas"]["ErrorResponse"]; - }; - }; - /** @description Internal Server Error. */ - 500: { - headers: { - [name: string]: unknown; - }; - content: { - /** - * @example { - * "message": "An unexpected error occurred." - * } - */ - "application/json": components["schemas"]["ErrorResponse"]; - }; - }; - }; - }; - startRamp: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: { - content: { - /** - * @example { - * "rampId": "proc_12345" - * } - */ - "application/json": components["schemas"]["StartRampRequest"]; - }; - }; - responses: { - /** @description Ramp process successfully started or updated. */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - /** - * @example { - * "createdAt": "2024-05-16T10:00:00Z", - * "currentPhase": "processing", - * "depositQrCode": "00020126...", - * "from": "stellar", - * "id": "proc_12345", - * "quoteId": "quote_7af7171e-aa42-49a2-80c2-9e18483bad38", - * "to": "pix", - * "type": "sell", - * "unsignedTxs": [], - * "updatedAt": "2024-05-16T12:30:00Z" - * } - */ - "application/json": { - anchorFeeFiat: string; - anchorFeeUSD: string; - countryCode?: components["schemas"]["CountryCode"]; + }; + RegisterRampRequest: { /** - * Format: date-time - * @description Timestamp of when the ramp process was created. + * @description Optional additional data for the ramp process. + * + * For Stellar offramps, paymentData is required. + * + * For Brazil onramps, destinationAddress and taxId arerequired. + * + * For Brazil offramps, pixDestination, taxId and receiverTaxId are required. */ - createdAt?: string; - currentPhase?: components["schemas"]["RampPhase"]; - /** @description BR Code for PIX payment, if applicable. */ - depositQrCode?: string | null; - feeCurrency: components["schemas"]["RampCurrency"]; - /** @description The source network or payment method. */ - from?: components["schemas"]["DestinationType"]; - /** @description Unique identifier for the ramp process. */ - id?: string; - inputAmount: string; - inputCurrency: string; - network?: components["schemas"]["Networks"]; - networkFeeFiat: string; - networkFeeUSD: string; - outputAmount: string; - outputCurrency: string; - partnerFeeFiat: string; - partnerFeeUSD: string; - paymentMethod: components["schemas"]["PaymentMethod"]; - processingFeeFiat: string; - processingFeeUSD: string; + additionalData?: { + /** @description Destination address, used for onramp. */ + destinationAddress?: string; + /** @description Auth token obtained from Monerium's API, for the current user. Only required for Monerium-related ramps. */ + moneriumAuthToken: string; + paymentData?: components["schemas"]["PaymentData"]; + /** @description PIX key for the destination account in an onramp. */ + pixDestination?: string; + /** @description Tax ID of the receiver for onramp. */ + receiverTaxId?: string; + /** @description Tax ID of the user. */ + taxId?: string; + /** @description Wallet address initiating the offramp. */ + walletAddress: string; + } & { + [key: string]: unknown; + }; /** * Format: uuid - * @description The quote ID associated with this ramp process. + * @description The unique identifier for the quote. */ - quoteId?: string; - /** @description The `externalSessionId` is an optional URL parameter that integrators can provide to track ramp transactions within their own systems. This identifier allows you to correlate Vortex transactions with your internal session or transaction tracking. `externalSessionId` url param is named `sessionId` in the Vortex API. */ - sessionId?: string; - status?: components["schemas"]["SimpleStatus"]; - /** @description The destination network or payment method. */ - to?: components["schemas"]["DestinationType"]; - totalFeeFiat: string; - totalFeeUSD: string; - /** @description (BUY-only) A link to a block explorer showing the details for the transaction hash. */ - transactionExplorerLink?: string; - /** @description (BUY-only) The hash of the transaction transferring the expected outputAmount to the wallet address. */ - transactionHash?: string; - /** @description Type of ramp process. */ - type?: components["schemas"]["RampDirection"]; - /** @description Array of unsigned transactions that need to be signed by the user. */ - unsignedTxs?: components["schemas"]["UnsignedTx"][]; + quoteId: string; /** - * Format: date-time - * @description Timestamp of the last update to the ramp process. + * @description Array of accounts that will be used for signing transactions. + * + * For Stellar offramps, Stellar and Pendulum ephemerals are required. + * For Brazil on/off ramps, Moonbeam and Pendulum ephemerals are required. */ - updatedAt?: string; - vortexFeeFiat: string; - vortexFeeUSD: string; - /** @description The address of the source account for SELL, or the address the destination account for BUY transactions. */ - walletAddress?: string; - }; - }; - }; - /** - * @description Bad Request. Possible reasons: - * - Missing required fields (rampId, presignedTxs) - * - Invalid additional data format (if provided, must be an object) - */ - 400: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": Record; - }; - }; - /** @description Internal Server Error. */ - 500: { - headers: { - [name: string]: unknown; - }; - content: { - /** - * @example { - * "message": "An unexpected error occurred." - * } - */ - "application/json": Record; - }; - }; + signingAccounts: { + /** @description The account address. */ + address: string; + /** + * @description The type of the account. + * @enum {string} + */ + type: "EVM" | "Stellar" | "Substrate"; + }[]; + }; + /** @description `PENDING`, `FAILED`, `COMPLETED` */ + SimpleStatus: string; + StartKYC2Request: { + documentType: components["schemas"]["KYCDocType"]; + taxId: string; + }; + StartKYC2Response: { + uploadUrls?: components["schemas"]["KYCDataUploadFileFiles"]; + }; + StartRampRequest: { + rampId: string; + }; + /** @enum {string} */ + TaxIdType: "CPF" | "CNPJ"; + TriggerOfframpRequest: { + /** + * @description The amount to offramp. + * @example 100.50 + */ + amount: string; + /** @description The recipient's PIX key. */ + pixKey: string; + /** @description The recipient's Tax ID for validation. */ + receiverTaxId: string; + /** @description The sender's Tax ID. */ + taxId: string; + }; + TriggerOfframpResponse: { + /** @description The ID of the triggered offramp transaction. */ + offrampId?: string; + }; + /** @description Represents an unsigned transaction that requires user signature. Actual properties will depend on the transaction type and network. */ + UnsignedTx: { + meta?: Record; + nonce?: number; + /** @enum {string} */ + phase?: "RampPhase" | "CleanupPhase"; + signer?: string; + /** + * @description The unsigned transaction payload or relevant data. + * @example AAAAAKu... + */ + txData?: string; + } & { + [key: string]: unknown; + }; + UpdateRampRequest: { + /** @description Optional additional data, like transaction hashes from external services. */ + additionalData?: ({ + /** @description Transaction hash for AssetHub to Pendulum transfer, if applicable. */ + assetHubToPendulumHash?: string | null; + /** @description Signed message to trigger a Monerium offramp. */ + moneriumOfframpSignature: string; + /** @description Transaction hash for Squid Router approval, if applicable. */ + squidRouterApproveHash?: string | null; + /** @description Transaction hash for Squid Router swap, if applicable. */ + squidRouterSwapHash?: string | null; + } & { + [key: string]: unknown; + }) | null; + /** @description An array of transactions that have been pre-signed by the user. */ + presignedTxs: components["schemas"]["PresignedTx"][]; + /** + * @description The unique identifier of the ramp process to start. + * @example proc_12345 + */ + rampId: string; + }; + UserApiKeyErrorResponse: { + error: { + /** @description Machine-readable error code, e.g. `AUTHENTICATION_REQUIRED`, `API_KEY_LIMIT_REACHED`, `INVALID_EXPIRES_AT`, `API_KEY_NOT_FOUND`. */ + code: string; + message: string; + status: number; + }; + }; + UserApiKeyPairResponse: { + /** Format: date-time */ + createdAt: string; + /** Format: date-time */ + expiresAt: string; + isActive: boolean; + publicKey: { + id: string; + /** @description The full key value. For the secret key this is returned only in this response. */ + key: string; + /** @description Constant 8-character prefix, e.g. `pk_live_` or `sk_test_`. */ + keyPrefix: string; + name: string; + /** @enum {string} */ + type: "public" | "secret"; + }; + secretKey: { + id: string; + /** @description The full key value. For the secret key this is returned only in this response. */ + key: string; + /** @description Constant 8-character prefix, e.g. `pk_live_` or `sk_test_`. */ + keyPrefix: string; + name: string; + /** @enum {string} */ + type: "public" | "secret"; + }; + }; + ValidatePixKeyResponse: { + /** @description Indicates if the PIX key is valid. */ + valid?: boolean; + }; }; - }; - startRamp: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; + responses: { + "Invalid input": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + code: number; + message: string; + }; + }; + }; + "Record not found": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + code: number; + message: string; + }; + }; + }; }; - requestBody?: { - content: { - /** - * @example { - * "additionalData": { - * "squidRouterApproveHash": "0x123...", - * "squidRouterSwapHash": "0x456..." - * }, - * "presignedTxs": [ - * { - * "meta": {}, - * "nonce": 1, - * "phase": "RampPhase", - * "signer": "GB2TP24WCY6BPGFX4SOGDHT7IGJRR7HCDQT2VL2MVCZJTJCGKMVGQGQB", - * "txData": "AAAAAKu..." - * } - * ], - * "rampId": "proc_12345" - * } - */ - "application/json": components["schemas"]["UpdateRampRequest"]; - }; + parameters: never; + requestBodies: never; + headers: never; + pathItems: never; +} +export type $defs = Record; +export interface operations { + listUserApiKeys: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Active keys, newest first. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ListUserApiKeysResponse"]; + }; + }; + /** @description Missing or invalid Bearer token. */ + 401: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["UserApiKeyErrorResponse"]; + }; + }; + /** @description Internal server error. */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["UserApiKeyErrorResponse"]; + }; + }; + }; }; - responses: { - /** @description Ramp process successfully started or updated. */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - /** - * @example { - * "createdAt": "2024-05-16T10:00:00Z", - * "currentPhase": "processing", - * "depositQrCode": "00020126...", - * "from": "stellar", - * "id": "proc_12345", - * "quoteId": "quote_7af7171e-aa42-49a2-80c2-9e18483bad38", - * "to": "pix", - * "type": "off", - * "unsignedTxs": [], - * "updatedAt": "2024-05-16T12:30:00Z" - * } - */ - "application/json": { - anchorFeeFiat: string; - anchorFeeUSD: string; - countryCode?: components["schemas"]["CountryCode"]; + createUserApiKey: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + /** + * @example { + * "expiresAt": "2027-07-06T00:00:00.000Z", + * "name": "my-backend" + * } + */ + "application/json": { + /** + * Format: date-time + * @description Optional ISO-8601 expiry, at most 2 years from now. Defaults to 1 year. + */ + expiresAt?: string; + /** @description Optional label; defaults to "API Key". */ + name?: string; + }; + }; + }; + responses: { + /** @description Key pair created. Persist `secretKey.key` immediately; it cannot be retrieved again. */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["UserApiKeyPairResponse"]; + }; + }; + /** @description `INVALID_EXPIRES_AT`: expiresAt is not a valid ISO-8601 date or is more than 2 years from now. */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["UserApiKeyErrorResponse"]; + }; + }; + /** @description Missing or invalid Bearer token. */ + 401: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["UserApiKeyErrorResponse"]; + }; + }; + /** @description `API_KEY_LIMIT_REACHED`: the user already holds the maximum of 10 active keys. */ + 409: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["UserApiKeyErrorResponse"]; + }; + }; + /** @description Internal server error. */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["UserApiKeyErrorResponse"]; + }; + }; + }; + }; + revokeUserApiKey: { + parameters: { + query?: never; + header?: never; + path: { + /** @description ID of the key to revoke. */ + keyId: string; + }; + cookie?: never; + }; + requestBody?: { + content: { + /** + * @example { + * "pairedKeyId": "00000000-0000-0000-0000-000000000000" + * } + */ + "application/json": { + /** @description Optional ID of the other half of the pair, to revoke both keys together. */ + pairedKeyId?: string; + }; + }; + }; + responses: { + /** @description Key(s) revoked. */ + 204: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description `INVALID_KEY_PAIR` or `KEY_PAIR_MISMATCH`: the two keys are not opposite halves of the same pair. */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["UserApiKeyErrorResponse"]; + }; + }; + /** @description Missing or invalid Bearer token. */ + 401: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["UserApiKeyErrorResponse"]; + }; + }; + /** @description `API_KEY_NOT_FOUND` or `PAIRED_PUBLIC_KEY_NOT_FOUND`: key missing, already revoked, or not owned by the user. */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["UserApiKeyErrorResponse"]; + }; + }; + /** @description Internal server error. */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["UserApiKeyErrorResponse"]; + }; + }; + }; + }; + requestOTP: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + /** + * @example { + * "email": "user@example.com" + * } + */ + "application/json": { + /** Format: email */ + email: string; + /** @description Optional locale for the email, e.g. `pt-BR`. */ + locale?: string; + }; + }; + }; + responses: { + /** @description OTP sent. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + message: string; + success: boolean; + }; + }; + }; + /** @description Email missing or locale not a string. */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + }; + }; + }; + /** @description Failed to send the OTP email. */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + }; + }; + }; + }; + }; + verifyOTP: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + /** + * @example { + * "email": "user@example.com", + * "token": "123456" + * } + */ + "application/json": { + /** Format: email */ + email: string; + /** @description The 6-digit code from the email. */ + token: string; + }; + }; + }; + responses: { + /** @description Session created. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + access_token: string; + refresh_token: string; + success: boolean; + /** Format: uuid */ + user_id: string; + }; + }; + }; + /** @description Missing fields, or the OTP is invalid or expired. */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + }; + }; + }; + }; + }; + createSubaccount: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": components["schemas"]["CreateSubaccountRequest"]; + }; + }; + responses: { + /** @description Subaccount created or KYC retry initiated successfully. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CreateSubaccountResponse"]; + }; + }; /** - * Format: date-time - * @description Timestamp of when the ramp process was created. + * @description Bad Request. Possible reasons: + * - Missing required fields (cpf, cnpj, companyName, startDate) + * - Subaccount already created and KYC level > 0 + * - Other invalid request details */ - createdAt?: string; - currentPhase?: components["schemas"]["RampPhase"]; - /** @description BR Code for PIX payment, if applicable. */ - depositQrCode?: string | null; - feeCurrency: components["schemas"]["RampCurrency"]; - /** @description The source network or payment method. */ - from?: components["schemas"]["DestinationType"]; - /** @description Unique identifier for the ramp process. */ - id?: string; - inputAmount: string; - inputCurrency: string; - network?: components["schemas"]["Networks"]; - networkFeeFiat: string; - networkFeeUSD: string; - outputAmount: string; - outputCurrency: string; - partnerFeeFiat: string; - partnerFeeUSD: string; - paymentMethod: components["schemas"]["PaymentMethod"]; - processingFeeFiat: string; - processingFeeUSD: string; + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BrlaErrorResponse"]; + }; + }; + /** @description Internal Server Error. */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BrlaErrorResponse"]; + }; + }; + }; + }; + fetchSubaccountKycStatus: { + parameters: { + query: { + /** @description The user's Tax ID. */ + taxId: string; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successfully retrieved KYC status. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["GetKycStatusResponse"]; + }; + }; + /** @description Missing taxId or subaccount not found (returned as 400 from code). */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BrlaErrorResponse"]; + }; + }; + /** @description No KYC process started. */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BrlaErrorResponse"]; + }; + }; + /** @description Internal Server Error (e.g., no KYC events found when expected). */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BrlaErrorResponse"]; + }; + }; + }; + }; + brlaGetSelfieLivenessUrl: { + parameters: { + query: { + /** @description CPF or CNPJ. */ + taxId: string; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Liveness URL returned. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BrlaGetSelfieLivenessUrlResponse"]; + }; + }; + /** @description Missing taxId or ramp disabled. */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BrlaErrorResponse"]; + }; + }; + /** @description Supabase Bearer required. */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error. */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BrlaErrorResponse"]; + }; + }; + }; + }; + brlaGetUploadUrls: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["AveniaKYCDataUploadRequest"]; + }; + }; + responses: { + /** @description Upload URLs returned. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["AveniaKYCDataUploadResponse"]; + }; + }; + /** @description Missing/invalid documentType or taxId; or ramp disabled for this tax ID. */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BrlaErrorResponse"]; + }; + }; + /** @description Internal server error. */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BrlaErrorResponse"]; + }; + }; + }; + }; + getBrlaUser: { + parameters: { + query: { + /** @description The user's Tax ID. */ + taxId: string; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successfully retrieved user information. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["GetUserResponse"]; + }; + }; /** - * Format: uuid - * @description The quote ID associated with this ramp process. + * @description Bad Request. Possible reasons: + * - Missing taxId query parameter + * - KYC invalid */ - quoteId?: string; - /** @description The `externalSessionId` is an optional URL parameter that integrators can provide to track ramp transactions within their own systems. This identifier allows you to correlate Vortex transactions with your internal session or transaction tracking. `externalSessionId` url param is named `sessionId` in the Vortex API. */ - sessionId?: string; - status?: components["schemas"]["SimpleStatus"]; - /** @description The destination network or payment method. */ - to?: components["schemas"]["DestinationType"]; - totalFeeFiat: string; - totalFeeUSD: string; - /** @description (BUY-only) A link to a block explorer showing the details for the transaction hash. */ - transactionExplorerLink?: string; - /** @description (BUY-only) The hash of the transaction transferring the expected outputAmount to the wallet address. */ - transactionHash?: string; - /** @description Type of ramp process. */ - type?: components["schemas"]["RampDirection"]; - /** @description Array of unsigned transactions that need to be signed by the user. */ - unsignedTxs?: components["schemas"]["UnsignedTx"][]; + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BrlaErrorResponse"]; + }; + }; + /** @description Subaccount not found. */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BrlaErrorResponse"]; + }; + }; + /** @description Internal Server Error. */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BrlaErrorResponse"]; + }; + }; + }; + }; + getBrlaUserRemainingLimit: { + parameters: { + query: { + /** @description The user's Tax ID. */ + taxId: string; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successfully retrieved user's remaining limits. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["GetUserRemainingLimitResponse"]; + }; + }; + /** @description Missing taxId query parameter or other invalid request. */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BrlaErrorResponse"]; + }; + }; + /** @description Subaccount not found or limits not found. */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BrlaErrorResponse"]; + }; + }; + /** @description Internal Server Error. */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BrlaErrorResponse"]; + }; + }; + }; + }; + brlaNewKyc: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["KycLevel1Payload"]; + }; + }; + responses: { + /** @description KYC submission accepted. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["KycLevel1Response"]; + }; + }; + /** @description Validation failure. */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BrlaErrorResponse"]; + }; + }; + /** @description Internal server error. */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BrlaErrorResponse"]; + }; + }; + }; + }; + brlaValidatePixKey: { + parameters: { + query: { + /** @description Pix key to validate (CPF, CNPJ, email, phone, or random key). */ + pixKey: string; + }; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Validation result. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BrlaValidatePixKeyResponse"]; + }; + }; + /** @description Missing or invalid pix key. */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BrlaErrorResponse"]; + }; + }; + /** @description Supabase Bearer required. */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Internal server error. */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["BrlaErrorResponse"]; + }; + }; + }; + }; + createQuote: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + /** + * @example { + * "from": "pix", + * "inputAmount": "33", + * "inputCurrency": "BRL", + * "outputCurrency": "USDC", + * "partnerId": "myPartnerId", + * "rampType": "BUY", + * "to": "polygon" + * } + */ + "application/json": { + /** @description Your api key, if available. */ + apiKey?: string; + countryCode?: components["schemas"]["CountryCode"]; + /** @description From destination */ + from: components["schemas"]["DestinationType"]; + /** + * @description The amount of currency to be input. + * @example 100.00 + */ + inputAmount: string; + /** @description The currency type for the input amount. */ + inputCurrency: components["schemas"]["RampCurrency"]; + network?: components["schemas"]["Networks"]; + /** @description The desired currency type for the output amount. */ + outputCurrency: components["schemas"]["RampCurrency"]; + /** @description Your partner ID, if available. */ + partnerId?: string; + paymentMethod?: components["schemas"]["PaymentMethod"]; + /** @description The type of ramp process (on-ramp or off-ramp). */ + rampType: components["schemas"]["RampDirection"]; + /** @description To destination */ + to: components["schemas"]["DestinationType"]; + }; + }; + }; + responses: { + /** @description Quote successfully created. */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + /** + * @example { + * "expiresAt": "2025-05-16T12:30:00Z", + * "fee": "0.50", + * "from": "polygon", + * "id": "quote_7af7171e-aa42-49a2-80c2-9e18483bad38", + * "inputAmount": "33", + * "inputCurrency": "usdc", + * "outputAmount": "32500.50", + * "outputCurrency": "ars", + * "rampType": "sell", + * "to": "cbu" + * } + */ + "application/json": { + anchorFeeFiat: string; + anchorFeeUSD: string; + /** + * Format: date-time + * @description The timestamp when this quote expires. + */ + expiresAt?: string; + feeCurrency: components["schemas"]["RampCurrency"]; + from?: components["schemas"]["DestinationType"]; + /** + * Format: uuid + * @description Unique identifier for the quote. + */ + id?: string; + /** @description The input amount specified in the request. */ + inputAmount?: string; + inputCurrency?: components["schemas"]["RampCurrency"]; + networkFeeFiat: string; + networkFeeUSD: string; + /** @description The calculated output amount after fees and conversions. */ + outputAmount?: string; + outputCurrency?: components["schemas"]["RampCurrency"]; + partnerFeeFiat: string; + partnerFeeUSD: string; + processingFeeFiat: string; + processingFeeUSD: string; + /** @description The type of ramp process. */ + rampType?: components["schemas"]["RampDirection"]; + to?: components["schemas"]["DestinationType"]; + totalFeeFiat: string; + totalFeeUSD: string; + vortexFeeFiat: string; + vortexFeeUSD: string; + }; + }; + }; /** - * Format: date-time - * @description Timestamp of the last update to the ramp process. + * @description Bad Request. Possible reasons: + * - Missing required fields (rampType, from, to, inputAmount, inputCurrency, outputCurrency) + * - Invalid ramp type (must be "BUY" or "SELL") */ - updatedAt?: string; - vortexFeeFiat: string; - vortexFeeUSD: string; - /** @description The address of the source account for SELL, or the address the destination account for BUY transactions. */ - walletAddress?: string; - }; - }; - }; - /** - * @description Bad Request. Possible reasons: - * - Missing required fields (rampId, presignedTxs) - * - Invalid additional data format (if provided, must be an object) - */ - 400: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": Record; - }; - }; - /** @description Internal Server Error. */ - 500: { - headers: { - [name: string]: unknown; - }; - content: { - /** - * @example { - * "message": "An unexpected error occurred." - * } - */ - "application/json": Record; - }; - }; + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description Internal Server Error. Low-liquidity route failures use this status with a safe user-facing message; unexpected internal failures remain masked. */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + }; + }; + createBestQuote: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + /** + * @example { + * "from": "pix", + * "inputAmount": "30", + * "inputCurrency": "BRL", + * "outputCurrency": "USDC", + * "partnerId": "myPartnerId", + * "rampType": "BUY" + * } + */ + "application/json": components["schemas"]["CreateBestQuoteRequest"]; + }; + }; + responses: { + /** @description Quote successfully created. */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + anchorFeeFiat: string; + anchorFeeUSD: string; + /** + * Format: date-time + * @description The timestamp when this quote expires. + */ + expiresAt?: string; + feeCurrency: components["schemas"]["RampCurrency"]; + from?: components["schemas"]["DestinationType"]; + /** + * Format: uuid + * @description Unique identifier for the quote. + */ + id?: string; + /** @description The input amount specified in the request. */ + inputAmount?: string; + inputCurrency?: components["schemas"]["RampCurrency"]; + networkFeeFiat: string; + networkFeeUSD: string; + /** @description The calculated output amount after fees and conversions. */ + outputAmount?: string; + outputCurrency?: components["schemas"]["RampCurrency"]; + partnerFeeFiat: string; + partnerFeeUSD: string; + processingFeeFiat: string; + processingFeeUSD: string; + /** @description The type of ramp process. */ + rampType?: components["schemas"]["RampDirection"]; + to?: components["schemas"]["DestinationType"]; + totalFeeFiat: string; + totalFeeUSD: string; + vortexFeeFiat: string; + vortexFeeUSD: string; + }; + }; + }; + /** + * @description Bad Request. Possible reasons: + * - Missing required fields (rampType, from, to, inputAmount, inputCurrency, outputCurrency) + * - Invalid ramp type (must be "BUY" or "SELL") + */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description Internal Server Error. Low-liquidity route failures use this status with a safe user-facing message when every eligible route cannot serve the requested amount; unexpected internal failures remain masked. */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + }; + }; + registerRamp: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + /** + * @example { + * "additionalData": { + * "pixDestination": "711.711.011-11", + * "receiverTaxId": "0x7b79995e5f793a07bc00c21412e50ecae098e7f9", + * "taxId": "711.711.011-11" + * }, + * "quoteId": "8e4bca04-aa22-4f86-9ce5-80aaef58ef83", + * "signingAccounts": [ + * { + * "address": "0x7b79995e5f793a07bc00c21412e50ecae098e7f9", + * "network": "moonbeam" + * }, + * { + * "address": "6ftBYTotU4mmCuvUqJvk6qEP7uCzzz771pTMoxcbHFb9rcPv", + * "network": "pendulum" + * } + * ] + * } + */ + "application/json": { + /** + * @description Optional additional data for the ramp process. + * + * For Stellar offramps, paymentData is required. + * + * For Brazil onramps, destinationAddress and taxId arerequired. + * + * For Brazil offramps, pixDestination, taxId and receiverTaxId are required. + */ + additionalData?: { + /** @description Destination address, used for onramp. */ + destinationAddress?: string; + /** @description Auth token obtained from Monerium's API, for the current user. Only required for Monerium-related ramps. */ + moneriumAuthToken: string; + paymentData?: components["schemas"]["PaymentData"]; + /** @description PIX key for the destination account in an onramp. */ + pixDestination?: string; + /** @description Tax ID of the receiver for onramp. */ + receiverTaxId?: string; + sessionId?: string; + /** @description Tax ID of the user. */ + taxId?: string; + /** @description Wallet address initiating the offramp. */ + walletAddress: string; + } & { + [key: string]: unknown; + }; + /** + * Format: uuid + * @description The unique identifier for the quote. + */ + quoteId: string; + /** + * @description Array of accounts that will be used for signing transactions. + * + * For Stellar offramps, Stellar and Pendulum ephemerals are required. + * For Brazil on/off ramps, Moonbeam and Pendulum ephemerals are required. + */ + signingAccounts: { + /** @description The account address. */ + address: string; + /** + * @description The type of the account. + * @enum {string} + */ + type: "EVM" | "Stellar" | "Substrate"; + }[]; + }; + }; + }; + responses: { + /** @description Ramp process successfully registered. */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + /** + * @example { + * "brCode": "00020126...", + * "createdAt": "2024-05-16T10:00:00Z", + * "currentPhase": "pending_signature", + * "from": "stellar", + * "id": "proc_12345", + * "quoteId": "41a756dc-04e4-4e4b-b243-9c8f977c24d6", + * "to": "pix", + * "type": "off", + * "unsignedTxs": [ + * { + * "data": "AAAA...", + * "type": "stellar_payment" + * } + * ], + * "updatedAt": "2024-05-16T10:00:00Z" + * } + */ + "application/json": { + anchorFeeFiat: string; + anchorFeeUSD: string; + countryCode?: components["schemas"]["CountryCode"]; + /** + * Format: date-time + * @description Timestamp of when the ramp process was created. + */ + createdAt?: string; + currentPhase?: components["schemas"]["RampPhase"]; + /** @description BR Code for PIX payment, if applicable. */ + depositQrCode?: string | null; + feeCurrency: components["schemas"]["RampCurrency"]; + /** @description The source network or payment method. */ + from?: components["schemas"]["DestinationType"]; + /** @description Unique identifier for the ramp process. */ + id?: string; + inputAmount: string; + inputCurrency: string; + network?: components["schemas"]["Networks"]; + networkFeeFiat: string; + networkFeeUSD: string; + outputAmount: string; + outputCurrency: string; + partnerFeeFiat: string; + partnerFeeUSD: string; + paymentMethod: components["schemas"]["PaymentMethod"]; + processingFeeFiat: string; + processingFeeUSD: string; + /** + * Format: uuid + * @description The quote ID associated with this ramp process. + */ + quoteId?: string; + /** @description The `externalSessionId` is an optional URL parameter that integrators can provide to track ramp transactions within their own systems. This identifier allows you to correlate Vortex transactions with your internal session or transaction tracking. `externalSessionId` url param is named `sessionId` in the Vortex API. */ + sessionId?: string; + status?: components["schemas"]["SimpleStatus"]; + /** @description The destination network or payment method. */ + to?: components["schemas"]["DestinationType"]; + totalFeeFiat: string; + totalFeeUSD: string; + /** @description (BUY-only) A link to a block explorer showing the details for the transaction hash. */ + transactionExplorerLink?: string; + /** @description (BUY-only) The hash of the transaction transferring the expected outputAmount to the wallet address. */ + transactionHash?: string; + /** @description Type of ramp process. */ + type?: components["schemas"]["RampDirection"]; + /** @description Array of unsigned transactions that need to be signed by the user. */ + unsignedTxs?: components["schemas"]["UnsignedTx"][]; + /** + * Format: date-time + * @description Timestamp of the last update to the ramp process. + */ + updatedAt?: string; + vortexFeeFiat: string; + vortexFeeUSD: string; + /** @description The address of the source account for SELL, or the address the destination account for BUY transactions. */ + walletAddress?: string; + }; + }; + }; + /** @description Bad Request - Invalid input, missing required fields, or validation error. */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + /** + * @example { + * "message": "Missing required fields" + * } + */ + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description Internal Server Error. */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + /** + * @example { + * "message": "An unexpected error occurred." + * } + */ + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + }; + }; + startRamp: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + /** + * @example { + * "rampId": "proc_12345" + * } + */ + "application/json": components["schemas"]["StartRampRequest"]; + }; + }; + responses: { + /** @description Ramp process successfully started or updated. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + /** + * @example { + * "createdAt": "2024-05-16T10:00:00Z", + * "currentPhase": "processing", + * "depositQrCode": "00020126...", + * "from": "stellar", + * "id": "proc_12345", + * "quoteId": "quote_7af7171e-aa42-49a2-80c2-9e18483bad38", + * "to": "pix", + * "type": "sell", + * "unsignedTxs": [], + * "updatedAt": "2024-05-16T12:30:00Z" + * } + */ + "application/json": { + anchorFeeFiat: string; + anchorFeeUSD: string; + countryCode?: components["schemas"]["CountryCode"]; + /** + * Format: date-time + * @description Timestamp of when the ramp process was created. + */ + createdAt?: string; + currentPhase?: components["schemas"]["RampPhase"]; + /** @description BR Code for PIX payment, if applicable. */ + depositQrCode?: string | null; + feeCurrency: components["schemas"]["RampCurrency"]; + /** @description The source network or payment method. */ + from?: components["schemas"]["DestinationType"]; + /** @description Unique identifier for the ramp process. */ + id?: string; + inputAmount: string; + inputCurrency: string; + network?: components["schemas"]["Networks"]; + networkFeeFiat: string; + networkFeeUSD: string; + outputAmount: string; + outputCurrency: string; + partnerFeeFiat: string; + partnerFeeUSD: string; + paymentMethod: components["schemas"]["PaymentMethod"]; + processingFeeFiat: string; + processingFeeUSD: string; + /** + * Format: uuid + * @description The quote ID associated with this ramp process. + */ + quoteId?: string; + /** @description The `externalSessionId` is an optional URL parameter that integrators can provide to track ramp transactions within their own systems. This identifier allows you to correlate Vortex transactions with your internal session or transaction tracking. `externalSessionId` url param is named `sessionId` in the Vortex API. */ + sessionId?: string; + status?: components["schemas"]["SimpleStatus"]; + /** @description The destination network or payment method. */ + to?: components["schemas"]["DestinationType"]; + totalFeeFiat: string; + totalFeeUSD: string; + /** @description (BUY-only) A link to a block explorer showing the details for the transaction hash. */ + transactionExplorerLink?: string; + /** @description (BUY-only) The hash of the transaction transferring the expected outputAmount to the wallet address. */ + transactionHash?: string; + /** @description Type of ramp process. */ + type?: components["schemas"]["RampDirection"]; + /** @description Array of unsigned transactions that need to be signed by the user. */ + unsignedTxs?: components["schemas"]["UnsignedTx"][]; + /** + * Format: date-time + * @description Timestamp of the last update to the ramp process. + */ + updatedAt?: string; + vortexFeeFiat: string; + vortexFeeUSD: string; + /** @description The address of the source account for SELL, or the address the destination account for BUY transactions. */ + walletAddress?: string; + }; + }; + }; + /** + * @description Bad Request. Possible reasons: + * - Missing required fields (rampId, presignedTxs) + * - Invalid additional data format (if provided, must be an object) + */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": Record; + }; + }; + /** @description Internal Server Error. */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + /** + * @example { + * "message": "An unexpected error occurred." + * } + */ + "application/json": Record; + }; + }; + }; + }; + startRamp: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + /** + * @example { + * "additionalData": { + * "squidRouterApproveHash": "0x123...", + * "squidRouterSwapHash": "0x456..." + * }, + * "presignedTxs": [ + * { + * "meta": {}, + * "nonce": 1, + * "phase": "RampPhase", + * "signer": "GB2TP24WCY6BPGFX4SOGDHT7IGJRR7HCDQT2VL2MVCZJTJCGKMVGQGQB", + * "txData": "AAAAAKu..." + * } + * ], + * "rampId": "proc_12345" + * } + */ + "application/json": components["schemas"]["UpdateRampRequest"]; + }; + }; + responses: { + /** @description Ramp process successfully started or updated. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + /** + * @example { + * "createdAt": "2024-05-16T10:00:00Z", + * "currentPhase": "processing", + * "depositQrCode": "00020126...", + * "from": "stellar", + * "id": "proc_12345", + * "quoteId": "quote_7af7171e-aa42-49a2-80c2-9e18483bad38", + * "to": "pix", + * "type": "off", + * "unsignedTxs": [], + * "updatedAt": "2024-05-16T12:30:00Z" + * } + */ + "application/json": { + anchorFeeFiat: string; + anchorFeeUSD: string; + countryCode?: components["schemas"]["CountryCode"]; + /** + * Format: date-time + * @description Timestamp of when the ramp process was created. + */ + createdAt?: string; + currentPhase?: components["schemas"]["RampPhase"]; + /** @description BR Code for PIX payment, if applicable. */ + depositQrCode?: string | null; + feeCurrency: components["schemas"]["RampCurrency"]; + /** @description The source network or payment method. */ + from?: components["schemas"]["DestinationType"]; + /** @description Unique identifier for the ramp process. */ + id?: string; + inputAmount: string; + inputCurrency: string; + network?: components["schemas"]["Networks"]; + networkFeeFiat: string; + networkFeeUSD: string; + outputAmount: string; + outputCurrency: string; + partnerFeeFiat: string; + partnerFeeUSD: string; + paymentMethod: components["schemas"]["PaymentMethod"]; + processingFeeFiat: string; + processingFeeUSD: string; + /** + * Format: uuid + * @description The quote ID associated with this ramp process. + */ + quoteId?: string; + /** @description The `externalSessionId` is an optional URL parameter that integrators can provide to track ramp transactions within their own systems. This identifier allows you to correlate Vortex transactions with your internal session or transaction tracking. `externalSessionId` url param is named `sessionId` in the Vortex API. */ + sessionId?: string; + status?: components["schemas"]["SimpleStatus"]; + /** @description The destination network or payment method. */ + to?: components["schemas"]["DestinationType"]; + totalFeeFiat: string; + totalFeeUSD: string; + /** @description (BUY-only) A link to a block explorer showing the details for the transaction hash. */ + transactionExplorerLink?: string; + /** @description (BUY-only) The hash of the transaction transferring the expected outputAmount to the wallet address. */ + transactionHash?: string; + /** @description Type of ramp process. */ + type?: components["schemas"]["RampDirection"]; + /** @description Array of unsigned transactions that need to be signed by the user. */ + unsignedTxs?: components["schemas"]["UnsignedTx"][]; + /** + * Format: date-time + * @description Timestamp of the last update to the ramp process. + */ + updatedAt?: string; + vortexFeeFiat: string; + vortexFeeUSD: string; + /** @description The address of the source account for SELL, or the address the destination account for BUY transactions. */ + walletAddress?: string; + }; + }; + }; + /** + * @description Bad Request. Possible reasons: + * - Missing required fields (rampId, presignedTxs) + * - Invalid additional data format (if provided, must be an object) + */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": Record; + }; + }; + /** @description Internal Server Error. */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + /** + * @example { + * "message": "An unexpected error occurred." + * } + */ + "application/json": Record; + }; + }; + }; + }; + getRampErrorLogs: { + parameters: { + query?: never; + header?: never; + path: { + /** @description Ramp ID. */ + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Error log array (empty if no errors). */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["GetRampErrorLogsResponse"]; + }; + }; + /** @description Authentication required. */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Ramp does not belong to authenticated principal. */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Ramp not found. */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; }; - }; } diff --git a/docs/api/openapi/vortex.openapi.json b/docs/api/openapi/vortex.openapi.json index 8ac48e0c2..bbf703dc5 100644 --- a/docs/api/openapi/vortex.openapi.json +++ b/docs/api/openapi/vortex.openapi.json @@ -339,7 +339,9 @@ "stellar", "pix", "sepa", - "cbu" + "cbu", + "ach", + "spei" ], "type": "string" }, @@ -393,7 +395,7 @@ "type": "object" }, "FiatToken": { - "enum": ["EUR", "ARS", "BRL"], + "enum": ["EUR", "ARS", "BRL", "USD", "MXN", "COP"], "type": "string" }, "GetKycStatusResponse": { @@ -670,6 +672,57 @@ "required": ["id"], "type": "object" }, + "ListUserApiKeysResponse": { + "properties": { + "apiKeys": { + "items": { + "properties": { + "createdAt": { + "format": "date-time", + "type": "string" + }, + "expiresAt": { + "format": "date-time", + "type": "string" + }, + "id": { + "type": "string" + }, + "isActive": { + "type": "boolean" + }, + "key": { + "description": "Full key value; present for public keys only. Secret key values are never returned after creation.", + "type": "string" + }, + "keyPrefix": { + "type": "string" + }, + "lastUsedAt": { + "format": "date-time", + "type": ["string", "null"] + }, + "name": { + "type": "string" + }, + "type": { + "enum": ["public", "secret"], + "type": "string" + }, + "updatedAt": { + "format": "date-time", + "type": "string" + } + }, + "required": ["createdAt", "expiresAt", "id", "isActive", "keyPrefix", "name", "type", "updatedAt"], + "type": "object" + }, + "type": "array" + } + }, + "required": ["apiKeys"], + "type": "object" + }, "Networks": { "description": "Supported blockchain networks.", "enum": ["assethub", "arbitrum", "avalanche", "base", "bsc", "ethereum", "polygon", "moonbeam"], @@ -836,7 +889,7 @@ }, "RampCurrency": { "description": "Represents supported currencies for ramp operations, including fiat and on-chain tokens.", - "enum": ["EUR", "ARS", "BRL", "USDC", "USDT", "USDC.E"], + "enum": ["EUR", "ARS", "BRL", "USD", "MXN", "COP", "USDC", "USDT", "USDC.E"], "examples": ["USDC"], "type": "string" }, @@ -1245,6 +1298,93 @@ "required": ["rampId", "presignedTxs"], "type": "object" }, + "UserApiKeyErrorResponse": { + "properties": { + "error": { + "properties": { + "code": { + "description": "Machine-readable error code, e.g. `AUTHENTICATION_REQUIRED`, `API_KEY_LIMIT_REACHED`, `INVALID_EXPIRES_AT`, `API_KEY_NOT_FOUND`.", + "type": "string" + }, + "message": { + "type": "string" + }, + "status": { + "type": "integer" + } + }, + "required": ["code", "message", "status"], + "type": "object" + } + }, + "required": ["error"], + "type": "object" + }, + "UserApiKeyPairResponse": { + "properties": { + "createdAt": { + "format": "date-time", + "type": "string" + }, + "expiresAt": { + "format": "date-time", + "type": "string" + }, + "isActive": { + "type": "boolean" + }, + "publicKey": { + "properties": { + "id": { + "type": "string" + }, + "key": { + "description": "The full key value. For the secret key this is returned only in this response.", + "type": "string" + }, + "keyPrefix": { + "description": "Constant 8-character prefix, e.g. `pk_live_` or `sk_test_`.", + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "enum": ["public", "secret"], + "type": "string" + } + }, + "required": ["id", "key", "keyPrefix", "name", "type"], + "type": "object" + }, + "secretKey": { + "properties": { + "id": { + "type": "string" + }, + "key": { + "description": "The full key value. For the secret key this is returned only in this response.", + "type": "string" + }, + "keyPrefix": { + "description": "Constant 8-character prefix, e.g. `pk_live_` or `sk_test_`.", + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "enum": ["public", "secret"], + "type": "string" + } + }, + "required": ["id", "key", "keyPrefix", "name", "type"], + "type": "object" + } + }, + "required": ["createdAt", "expiresAt", "isActive", "publicKey", "secretKey"], + "type": "object" + }, "ValidatePixKeyResponse": { "properties": { "valid": { @@ -1258,16 +1398,416 @@ "securitySchemes": {} }, "info": { - "description": "Cross-border payments gateway built on the Pendulum blockchain.\n\n**Scope:** 25 paths verified against `apps/api/src/api/routes/v1/`.\n\n**Auth principals:**\n- `X-API-Key: sk__...` \u2014 partner SDK key (server-side).\n- `X-Public-Key: pk__...` \u2014 partner public key (browser; attribution only).\n- `Authorization: Bearer ` \u2014 first-party user session.\n\nAll `/v1/brla/*` endpoints accept Supabase Bearer only; partner sk_*/pk_* keys are not accepted on BRLA routes.\n\n**Webhook signing:** RSA-PSS 2048 / SHA-256. Fetch the signing key from `GET /v1/public-key`.\n", + "description": "Cross-border payments gateway built on the Pendulum blockchain.\n\n**Scope:** 25 paths verified against `apps/api/src/api/routes/v1/`.\n\n**Auth principals:**\n- `X-API-Key: sk__...` — partner SDK key (server-side).\n- `X-Public-Key: pk__...` — partner public key (browser; attribution only).\n- `Authorization: Bearer ` — first-party user session.\n\nAll `/v1/brla/*` endpoints accept Supabase Bearer only; partner sk_*/pk_* keys are not accepted on BRLA routes.\n\n**Webhook signing:** RSA-PSS 2048 / SHA-256. Fetch the signing key from `GET /v1/public-key`.\n", "title": "Vortex API", "version": "1.1.0" }, "openapi": "3.1.0", "paths": { + "/v1/api-keys": { + "get": { + "deprecated": false, + "description": "Lists the authenticated user's active API keys. Public key values are included; secret key values are never returned.\n\n**Auth:** requires `Authorization: Bearer ` obtained from `POST /v1/auth/verify-otp`. Partner `sk_*`/`pk_*` keys are not accepted.", + "operationId": "listUserApiKeys", + "parameters": [], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListUserApiKeysResponse" + } + } + }, + "description": "Active keys, newest first.", + "headers": {} + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserApiKeyErrorResponse" + } + } + }, + "description": "Missing or invalid Bearer token.", + "headers": {} + }, + "500": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserApiKeyErrorResponse" + } + } + }, + "description": "Internal server error.", + "headers": {} + } + }, + "security": [], + "summary": "List the user's API keys", + "tags": ["Authentication"] + }, + "post": { + "deprecated": false, + "description": "Creates a public + secret API key pair bound to the authenticated user. The secret key value is returned only in this response; Vortex stores a hash and cannot show it again.\n\nKeys expire after one year by default; `expiresAt` may extend this to at most two years from now. A user may hold at most 10 active keys (a pair counts as two).\n\nSandbox mints `pk_test_*`/`sk_test_*`; production mints `pk_live_*`/`sk_live_*`.\n\n**Auth:** requires `Authorization: Bearer ` obtained from `POST /v1/auth/verify-otp`. Partner `sk_*`/`pk_*` keys are not accepted.", + "operationId": "createUserApiKey", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "example": { + "expiresAt": "2027-07-06T00:00:00.000Z", + "name": "my-backend" + }, + "schema": { + "properties": { + "expiresAt": { + "description": "Optional ISO-8601 expiry, at most 2 years from now. Defaults to 1 year.", + "format": "date-time", + "type": "string" + }, + "name": { + "description": "Optional label; defaults to \"API Key\".", + "type": "string" + } + }, + "type": "object" + } + } + }, + "required": false + }, + "responses": { + "201": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserApiKeyPairResponse" + } + } + }, + "description": "Key pair created. Persist `secretKey.key` immediately; it cannot be retrieved again.", + "headers": {} + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserApiKeyErrorResponse" + } + } + }, + "description": "`INVALID_EXPIRES_AT`: expiresAt is not a valid ISO-8601 date or is more than 2 years from now.", + "headers": {} + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserApiKeyErrorResponse" + } + } + }, + "description": "Missing or invalid Bearer token.", + "headers": {} + }, + "409": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserApiKeyErrorResponse" + } + } + }, + "description": "`API_KEY_LIMIT_REACHED`: the user already holds the maximum of 10 active keys.", + "headers": {} + }, + "500": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserApiKeyErrorResponse" + } + } + }, + "description": "Internal server error.", + "headers": {} + } + }, + "security": [], + "summary": "Create a user-linked API key pair", + "tags": ["Authentication"] + } + }, + "/v1/api-keys/{keyId}": { + "delete": { + "deprecated": false, + "description": "Revokes (soft-deletes) an API key owned by the authenticated user. Pass `pairedKeyId` in the body to revoke both halves of a pair together; the two keys must be of opposite types (one public, one secret) and share the same base name. The legacy `publicKeyId` body field is accepted as an alias.\n\n**Auth:** requires `Authorization: Bearer ` obtained from `POST /v1/auth/verify-otp`. Partner `sk_*`/`pk_*` keys are not accepted.", + "operationId": "revokeUserApiKey", + "parameters": [ + { + "description": "ID of the key to revoke.", + "in": "path", + "name": "keyId", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "example": { + "pairedKeyId": "00000000-0000-0000-0000-000000000000" + }, + "schema": { + "properties": { + "pairedKeyId": { + "description": "Optional ID of the other half of the pair, to revoke both keys together.", + "type": "string" + } + }, + "type": "object" + } + } + }, + "required": false + }, + "responses": { + "204": { + "description": "Key(s) revoked.", + "headers": {} + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserApiKeyErrorResponse" + } + } + }, + "description": "`INVALID_KEY_PAIR` or `KEY_PAIR_MISMATCH`: the two keys are not opposite halves of the same pair.", + "headers": {} + }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserApiKeyErrorResponse" + } + } + }, + "description": "Missing or invalid Bearer token.", + "headers": {} + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserApiKeyErrorResponse" + } + } + }, + "description": "`API_KEY_NOT_FOUND` or `PAIRED_PUBLIC_KEY_NOT_FOUND`: key missing, already revoked, or not owned by the user.", + "headers": {} + }, + "500": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserApiKeyErrorResponse" + } + } + }, + "description": "Internal server error.", + "headers": {} + } + }, + "security": [], + "summary": "Revoke an API key", + "tags": ["Authentication"] + } + }, + "/v1/auth/request-otp": { + "post": { + "deprecated": false, + "description": "Sends a 6-digit one-time password to the given email address. Use it with `POST /v1/auth/verify-otp` to obtain a user session.\n\n**Auth:** none.", + "operationId": "requestOTP", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "example": { + "email": "user@example.com" + }, + "schema": { + "properties": { + "email": { + "format": "email", + "type": "string" + }, + "locale": { + "description": "Optional locale for the email, e.g. `pt-BR`.", + "type": "string" + } + }, + "required": ["email"], + "type": "object" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "message": { + "type": "string" + }, + "success": { + "type": "boolean" + } + }, + "required": ["message", "success"], + "type": "object" + } + } + }, + "description": "OTP sent.", + "headers": {} + }, + "400": { + "content": { + "application/json": { + "schema": { + "properties": { + "error": { + "type": "string" + } + }, + "required": ["error"], + "type": "object" + } + } + }, + "description": "Email missing or locale not a string.", + "headers": {} + }, + "500": { + "content": { + "application/json": { + "schema": { + "properties": { + "error": { + "type": "string" + } + }, + "required": ["error"], + "type": "object" + } + } + }, + "description": "Failed to send the OTP email.", + "headers": {} + } + }, + "security": [], + "summary": "Request an email OTP", + "tags": ["Authentication"] + } + }, + "/v1/auth/verify-otp": { + "post": { + "deprecated": false, + "description": "Verifies the emailed one-time password and returns a user session. First-time sign-ins create the user profile; `user_id` identifies the profile that API keys minted with this session are linked to.\n\n**Auth:** none.", + "operationId": "verifyOTP", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "example": { + "email": "user@example.com", + "token": "123456" + }, + "schema": { + "properties": { + "email": { + "format": "email", + "type": "string" + }, + "token": { + "description": "The 6-digit code from the email.", + "type": "string" + } + }, + "required": ["email", "token"], + "type": "object" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "access_token": { + "type": "string" + }, + "refresh_token": { + "type": "string" + }, + "success": { + "type": "boolean" + }, + "user_id": { + "format": "uuid", + "type": "string" + } + }, + "required": ["access_token", "refresh_token", "success", "user_id"], + "type": "object" + } + } + }, + "description": "Session created.", + "headers": {} + }, + "400": { + "content": { + "application/json": { + "schema": { + "properties": { + "error": { + "type": "string" + } + }, + "required": ["error"], + "type": "object" + } + } + }, + "description": "Missing fields, or the OTP is invalid or expired.", + "headers": {} + } + }, + "security": [], + "summary": "Verify an email OTP", + "tags": ["Authentication"] + } + }, "/v1/brla/createSubaccount": { "post": { "deprecated": false, - "description": "`companyName`, `startDate` and `cnpj` are only required when taxIdType is `CNPJ`\n\n`quoteId` is optional: pass it in the normal ramp flow, or omit it for the quote-less KYB deep link where business verification starts before any quote exists.\n\n**Auth:** uses `optionalAuth` \u2014 accepts a Supabase Bearer token if present but does not require one.", + "description": "`companyName`, `startDate` and `cnpj` are only required when taxIdType is `CNPJ`\n\n`quoteId` is optional: pass it in the normal ramp flow, or omit it for the quote-less KYB deep link where business verification starts before any quote exists.\n\n**Auth:** uses `optionalAuth` — accepts a Supabase Bearer token if present but does not require one.", "operationId": "createSubaccount", "parameters": [], "requestBody": { @@ -1451,7 +1991,7 @@ "/v1/brla/getUploadUrls": { "post": { "deprecated": false, - "description": "Returns presigned upload URLs for the user's ID document and selfie. Only `ID` and `DRIVERS-LICENSE` are accepted for `documentType` (passport not supported here).\n\n**Auth:** uses `optionalAuth` \u2014 accepts a Supabase Bearer token if present but does not require one.", + "description": "Returns presigned upload URLs for the user's ID document and selfie. Only `ID` and `DRIVERS-LICENSE` are accepted for `documentType` (passport not supported here).\n\n**Auth:** uses `optionalAuth` — accepts a Supabase Bearer token if present but does not require one.", "operationId": "brlaGetUploadUrls", "requestBody": { "content": { @@ -3331,7 +3871,7 @@ }, "/v1/session/create": { "post": { - "description": "Creates a hosted Vortex Widget session and returns the URL to open for the user.\n\nThis single endpoint supports two mutually exclusive request shapes:\n\n- **Fixed quote** (`GetWidgetUrlLocked`) \u2014 pass a `quoteId` you created via `POST /v1/quotes`. The widget uses that exact quote and does not refresh it. If the quote expires before the user finishes, they must close the window and start over.\n\n- **Auto-refresh** (`GetWidgetUrlRefresh`) \u2014 pass the route parameters (`network`, `rampType`, `inputAmount`, plus `fiat` / `cryptoLocked` / `paymentMethod` as relevant for the direction). The widget creates and refreshes quotes on demand for the user.\n\nUse the example switcher below to see the request shape for each mode. `externalSessionId` is required in both modes and is echoed back in webhook payloads.", + "description": "Creates a hosted Vortex Widget session and returns the URL to open for the user.\n\nThis single endpoint supports two mutually exclusive request shapes:\n\n- **Fixed quote** (`GetWidgetUrlLocked`) — pass a `quoteId` you created via `POST /v1/quotes`. The widget uses that exact quote and does not refresh it. If the quote expires before the user finishes, they must close the window and start over.\n\n- **Auto-refresh** (`GetWidgetUrlRefresh`) — pass the route parameters (`network`, `rampType`, `inputAmount`, plus `fiat` / `cryptoLocked` / `paymentMethod` as relevant for the direction). The widget creates and refreshes quotes on demand for the user.\n\nUse the example switcher below to see the request shape for each mode. `externalSessionId` is required in both modes and is echoed back in webhook payloads.", "parameters": [], "requestBody": { "content": { @@ -3487,7 +4027,7 @@ "type": "array" }, "emoji": { - "description": "e.g. \ud83c\udde9\ud83c\uddea", + "description": "e.g. 🇩🇪", "type": "string" }, "name": { @@ -3657,7 +4197,7 @@ } }, { - "description": "Filter supported payment methods Allowed values: `ars`, `brl`, `eur` ", + "description": "Filter supported payment methods by fiat currency. Allowed values: `EUR`, `ARS`, `BRL`, `USD`, `MXN`, `COP`.", "example": "", "in": "query", "name": "fiat", @@ -3888,6 +4428,10 @@ "description": "User account, KYC, and BRLA subaccount operations.", "name": "Account Management" }, + { + "description": "Email OTP sign-in and user-linked API key provisioning.", + "name": "Authentication" + }, { "description": "Register and remove webhook endpoints for ramp events.", "name": "Webhooks" diff --git a/docs/api/pages/01-overview.md b/docs/api/pages/01-overview.md index 56097e020..d947fc6cc 100644 --- a/docs/api/pages/01-overview.md +++ b/docs/api/pages/01-overview.md @@ -6,7 +6,7 @@ These docs are written for partner developers integrating Vortex into a backend, ## Supported Corridors -The current SDK release supports BRL/PIX flows and Alfredpay corridors for USD, MXN, COP, and ARS where enabled by country and route configuration. EUR onramp endpoints exist on the API surface but the SDK throws `"Euro onramp handler not implemented yet"`; SEPA buy flows are not production-ready today. Other fiat currencies are exposed through reference data endpoints and are added incrementally. +The current SDK release supports BRL/PIX flows plus bank-transfer corridors for USD (ACH), MXN (SPEI), COP (ACH), and ARS (CBU) through Vortex's local payment partners, where enabled by country and route configuration. These four corridors support buys and sells on EVM networks; AssetHub is not available for them. EUR onramp endpoints exist on the API surface but the SDK throws `"Euro onramp handler not implemented yet"`; SEPA buy flows are not production-ready today. Other fiat currencies are exposed through reference data endpoints and are added incrementally. For crypto, Vortex supports USDC and USDT across the listed EVM networks plus USDC on AssetHub. Stablecoin pegs and routes are subject to liquidity on the Nabla AMM and the wider Pendulum/Hydration corridor. diff --git a/docs/api/pages/02-quick-start-with-the-sdk.md b/docs/api/pages/02-quick-start-with-the-sdk.md index fc69cf203..0a0e94fb0 100644 --- a/docs/api/pages/02-quick-start-with-the-sdk.md +++ b/docs/api/pages/02-quick-start-with-the-sdk.md @@ -1,6 +1,6 @@ # Quick Start With The SDK -This page walks through a complete BRL ramp end-to-end using `@vortexfi/sdk`. The SDK is for trusted Node.js environments only. +This page walks through complete BRL and bank-transfer-corridor (USD, MXN, COP, ARS) ramps end-to-end using `@vortexfi/sdk`. The SDK is for trusted Node.js environments only. ## Install @@ -104,9 +104,22 @@ const started = await sdk.startRamp(rampProcess.id); Validate every field before signing: `chainId`, `verifyingContract`, `value`, `to`, and `data` must match what your application requested. Never sign payloads blindly. -## MXN Onramp (Buy) +## USD, MXN, COP And ARS Ramps -MXN settles via SPEI through Alfredpay. The user pays fiat off-chain; crypto is delivered to `destinationAddress` on the quoted network. +USD, MXN, COP, and ARS settle through Vortex's local payment partners over the user's domestic banking rail. Pass the rail identifier as `from` (buy) or `to` (sell): + +| Fiat currency | Rail identifier | Payment rail | +|---|---|---| +| `USD` | `"ach"` | ACH bank transfer | +| `MXN` | `"spei"` | SPEI transfer | +| `COP` | `"ach"` | Colombian bank transfer | +| `ARS` | `"cbu"` | CBU bank transfer | + +All four corridors support buys and sells on EVM networks; AssetHub is not available for these corridors. The examples below use MXN — for the other currencies, substitute the fiat token and the rail identifier from the table. See [Bank Transfer Corridors](https://api-docs.vortexfinance.co/bank-transfer-corridors) for onboarding, fiat accounts, and limits. + +### Onramp (Buy) + +The user pays fiat off-chain; crypto is delivered to `destinationAddress` on the quoted network. ```js import { EPaymentMethod } from "@vortexfi/sdk"; @@ -135,13 +148,13 @@ console.log(started.achPaymentData); No user-signed on-chain transactions are required for onramp. The SDK signs ephemeral transactions during `registerRamp`. -Quotes can be requested without any key (anonymous rate discovery). Registering the ramp requires the user to be onboarded first: authenticate the SDK with that user's own **user-linked** `secretKey` (the `sk_*` key created by that user), and the same user must have completed Alfredpay MXN KYC. The key and the KYC record belong to the same account, so registration resolves to the user's Alfredpay customer automatically. A `publicKey`-only registration, or a partner-scoped `sk_*` with no user, is rejected. +Quotes can be requested without any key (anonymous rate discovery). Registering the ramp requires the user to be onboarded first: authenticate the SDK with that user's own **user-linked** `secretKey` (the `sk_*` key created by that user), and the same user must have completed KYC for the corridor's country. The key and the KYC record belong to the same account, so registration resolves to the user's verified payment profile automatically. A `publicKey`-only registration, or a partner-scoped `sk_*` with no user, is rejected. -Partner `sk_*` keys cannot drive Alfredpay KYC, and the SDK cannot mint keys or run KYC — onboard the user through the Vortex app or Widget first, then use their `sk_*` key (shown only once, at creation). This applies to both MXN onramp and offramp below. +Partner `sk_*` keys cannot drive this KYC, and the SDK cannot mint keys or run KYC — onboard the user through the Vortex app or Widget first, then use their `sk_*` key (shown only once, at creation; see [User API Keys](https://api-docs.vortexfinance.co/user-api-keys) for minting it programmatically). This applies to buys and sells in all four corridors. -## MXN Offramp (Sell) +### Offramp (Sell) -Selling crypto for MXN requires the user to sign one or more on-chain transactions with their own wallet. The SDK returns those transactions in `unsignedTransactions`. +Selling crypto for fiat in these corridors requires the user to sign one or more on-chain transactions with their own wallet. The SDK returns those transactions in `unsignedTransactions`. ```js const quote = await sdk.createQuote({ @@ -162,7 +175,7 @@ const { rampProcess, unsignedTransactions } = await sdk.registerRamp(quote, { `fiatAccountId` is opaque to the SDK. Create or look up the user's fiat account out-of-band and pass the ID here. It is required for offramp and optional for onramp. -### Signing MXN Offramp User Transactions +### Signing Offramp User Transactions Use the SDK helper to classify, sign, broadcast, and submit each entry in `unsignedTransactions`: diff --git a/docs/api/pages/03-authentication-and-partner-keys.md b/docs/api/pages/03-authentication-and-partner-keys.md index 1b0d5c83c..20b0e1a2e 100644 --- a/docs/api/pages/03-authentication-and-partner-keys.md +++ b/docs/api/pages/03-authentication-and-partner-keys.md @@ -32,4 +32,6 @@ BRLA account-management endpoints are first-party, user-oriented flows. Partner Store secret keys in a secret manager or encrypted environment configuration. Rotate keys if they are exposed, no longer needed, or tied to a retired integration. Use test keys in sandbox and live keys only in production. +User-linked key pairs can be provisioned programmatically through an email OTP sign-in; see [User API Keys](https://api-docs.vortexfinance.co/user-api-keys). + --- diff --git a/docs/api/pages/06-quotes-and-pricing.md b/docs/api/pages/06-quotes-and-pricing.md index 5bbac3f3b..88d6e0624 100644 --- a/docs/api/pages/06-quotes-and-pricing.md +++ b/docs/api/pages/06-quotes-and-pricing.md @@ -30,7 +30,7 @@ Content-Type: application/json ``` - `rampType` is `"BUY"` (onramp, fiat → crypto) or `"SELL"` (offramp, crypto → fiat). -- `from` / `to` are either a fiat rail (`"pix"`, `"sepa"`) or a network identifier (`"polygon"`, `"base"`, `"ethereum"`, `"arbitrum"`, `"bsc"`, `"avalanche"`, `"assethub"`, `"stellar"`, `"moonbeam"`). +- `from` / `to` are either a fiat rail (`"pix"`, `"sepa"`, `"ach"`, `"spei"`, `"cbu"`) or a network identifier (`"polygon"`, `"base"`, `"ethereum"`, `"arbitrum"`, `"bsc"`, `"avalanche"`, `"assethub"`, `"stellar"`, `"moonbeam"`). `"ach"` serves USD and COP, `"spei"` serves MXN, and `"cbu"` serves ARS; see [Bank Transfer Corridors](https://api-docs.vortexfinance.co/bank-transfer-corridors). - `inputAmount` is a decimal string in the smallest commonly used unit of `inputCurrency` (e.g. `"150"` for 150 BRL, `"100"` for 100 USDC). Do not pass raw chain base units. - `apiKey` (optional) is the partner public key `pk_live_*` / `pk_test_*`. Required for partner attribution and discount eligibility. diff --git a/docs/api/pages/13-kyb-deep-link.md b/docs/api/pages/13-kyb-deep-link.md index 9b042e05c..91ebe3bef 100644 --- a/docs/api/pages/13-kyb-deep-link.md +++ b/docs/api/pages/13-kyb-deep-link.md @@ -11,7 +11,7 @@ It is a variant of the [hosted widget](https://api-docs.vortexfinance.co/widget- ``` - **Brazil** routes to Avenia KYB. The user enters the company name and CNPJ together on the company form, then completes Avenia's hosted company and representative verification. -- **Mexico / Colombia / USA** route to the Alfredpay business KYB form (the business customer type is preselected). +- **Mexico / Colombia / USA** route to the local payment partner's business KYB form (the business customer type is preselected). - Europe is intentionally excluded — it is individual KYC only and requires a connected wallet, so it cannot complete a quote-less KYB deep link. After verification the user lands on a **KYB Completed** screen. *Continue* returns them to the standard quote form with the session still authenticated and the deep-link parameters stripped from the URL. diff --git a/docs/api/pages/14-bank-transfer-corridors.md b/docs/api/pages/14-bank-transfer-corridors.md new file mode 100644 index 000000000..89505adbd --- /dev/null +++ b/docs/api/pages/14-bank-transfer-corridors.md @@ -0,0 +1,25 @@ +# Bank Transfer Corridors (USD, MXN, COP, ARS) + +USD, MXN, COP, and ARS ramps settle through Vortex's local payment partners over domestic banking rails: ACH for USD and COP, SPEI for MXN, and CBU for ARS. All four corridors support buys and sells on EVM networks; AssetHub is not available for these corridors. + +In quote requests, the rail identifier (`"ach"`, `"spei"`, `"cbu"`) takes the place of a network in `from` (buy) or `to` (sell). See [Quotes And Pricing](https://api-docs.vortexfinance.co/quotes-and-pricing) for the request shape and [Quick Start With The SDK](https://api-docs.vortexfinance.co/quick-start-with-the-sdk) for runnable examples. + +## Onboarding And KYC + +Each corridor requires the user to complete KYC for the corridor's country before a ramp can be registered. Onboard the user through the Vortex app or hosted Widget; the identity documents collected differ per country (for example INE, resident card, or passport in Mexico; cédula in Colombia; DNI in Argentina). Business users can be sent straight into verification with the [KYB Deep Link](https://api-docs.vortexfinance.co/kyb-deep-link). + +Ramp registration must be authenticated with the user's own user-linked `sk_*` key, which your integration can mint programmatically after an email OTP sign-in — see [User API Keys](https://api-docs.vortexfinance.co/user-api-keys). Partner-scoped keys cannot register ramps in these corridors and cannot drive KYC on a user's behalf. Quotes remain available anonymously for rate discovery; eligibility is enforced at registration time, not quote time. + +## Fiat Accounts + +Sells pay out to a saved bank account referenced by `fiatAccountId` in the register call. It is required for sells and optional for buys. The account is created during onboarding in the Vortex app or Widget; the ID is opaque to the SDK and the API client. + +## Payment Instructions On Buys + +After `POST /v1/ramp/start`, the response's `achPaymentData` contains the bank transfer instructions the user must pay (beneficiary, account, and reference details for the corridor's rail). Display them to the user verbatim; the ramp continues automatically once the fiat deposit is confirmed. + +## Limits + +Per-currency minimum and maximum amounts are enforced at quote time and refreshed periodically from the payment partner. A quote outside the limits fails with a descriptive error; prompt the user to adjust the amount. + +--- diff --git a/docs/api/pages/15-user-api-keys.md b/docs/api/pages/15-user-api-keys.md new file mode 100644 index 000000000..1a07f2ed8 --- /dev/null +++ b/docs/api/pages/15-user-api-keys.md @@ -0,0 +1,116 @@ +# User API Keys + +Registering a ramp requires authentication in every corridor: `POST /v1/ramp/register` accepts either a secret API key in `X-API-Key` or a user session Bearer token. For BRL and EUR corridors, a partner-scoped `sk_*` key is sufficient because the user is identified by request fields such as the tax ID. The bank transfer corridors (USD, MXN, COP, ARS) are stricter: the key must be **user-linked** — a key pair minted by the user's own Vortex account — because the ramp resolves the user's KYC and payment profile from the authenticated account. + +This page shows how to provision a user-linked key pair programmatically, without contacting Vortex support: sign the user in with an email one-time password (OTP), then mint the key pair with the resulting session token. The minted pair is bound to the authenticated user, not to a partner; requests authenticated with the secret key act as that user on quote and ramp endpoints, so KYC completed by the same account applies automatically. A user-linked key works in every corridor, so integrations can use it uniformly. See [Bank Transfer Corridors](https://api-docs.vortexfinance.co/bank-transfer-corridors) for the corridor-specific requirements. + +## 1. Request An Email OTP + +```http +POST /v1/auth/request-otp +Content-Type: application/json +``` + +```json +{ + "email": "user@example.com" +} +``` + +Vortex emails a 6-digit code to the address. An optional `locale` string localizes the email. The response is `{ "success": true, "message": "OTP sent to email" }`. + +## 2. Verify The OTP + +```http +POST /v1/auth/verify-otp +Content-Type: application/json +``` + +```json +{ + "email": "user@example.com", + "token": "123456" +} +``` + +```json +{ + "success": true, + "access_token": "eyJ...", + "refresh_token": "...", + "user_id": "00000000-0000-0000-0000-000000000000" +} +``` + +An invalid or expired code returns `400`. Verification creates the user profile on first sign-in; `user_id` identifies the profile the keys will be linked to. If the user has already completed KYC in the Vortex app or Widget under the same email, this is the same profile — no extra linking step is needed. + +`POST /v1/auth/refresh` with `{ "refresh_token": "..." }` returns a fresh token pair when the access token expires. + +## 3. Create The Key Pair + +```http +POST /v1/api-keys +Authorization: Bearer +Content-Type: application/json +``` + +```json +{ + "name": "my-backend", + "expiresAt": "2027-07-06T00:00:00.000Z" +} +``` + +Both body fields are optional. Response (`201`): + +```json +{ + "createdAt": "2026-07-06T12:00:00.000Z", + "expiresAt": "2027-07-06T00:00:00.000Z", + "isActive": true, + "publicKey": { + "id": "...", + "key": "pk_live_...", + "keyPrefix": "pk_live_", + "name": "my-backend (Public)", + "type": "public" + }, + "secretKey": { + "id": "...", + "key": "sk_live_...", + "keyPrefix": "sk_live_", + "name": "my-backend (Secret)", + "type": "secret" + } +} +``` + +- **The secret key value is returned only in this response.** Vortex stores a hash; it cannot be retrieved again. Persist it to your secret manager immediately. +- Keys expire after one year by default; `expiresAt` may extend this to at most two years from creation. +- A user may hold at most 10 active keys (a pair counts as two). Exceeding the cap returns `409 API_KEY_LIMIT_REACHED`; revoke unused keys first. +- Sandbox mints `pk_test_*` / `sk_test_*`; production mints `pk_live_*` / `sk_live_*`. + +The `/v1/api-keys` endpoints accept only `Authorization: Bearer` session tokens — an `X-API-Key` secret key cannot mint or revoke keys. + +## 4. Use The Keys + +Configure the SDK (or send `X-API-Key` directly) with the minted pair: + +```js +const sdk = new VortexSdk({ + apiBaseUrl: "https://api.vortexfinance.co", + publicKey: "pk_live_...", + secretKey: "sk_live_..." +}); +``` + +The bearer token is only needed for key management; day-to-day quoting and ramping authenticate with the secret key. See [Quick Start With The SDK](https://api-docs.vortexfinance.co/quick-start-with-the-sdk). + +## Managing Keys + +- `GET /v1/api-keys` — lists the user's active keys (public key values are included; secret values are never returned). +- `DELETE /v1/api-keys/{keyId}` — revokes a key; returns `204`. Pass `{ "pairedKeyId": "..." }` in the body to revoke both halves of a pair together. + +Revoke and re-mint immediately if a secret key is exposed. See [Authentication And Partner Keys](https://api-docs.vortexfinance.co/authentication-and-partner-keys) for handling guidance. + +--- From c929e7d62d36d69bd0c446f47a4845844a27ad13 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 19:35:39 +0200 Subject: [PATCH 173/176] Restructure the api docs around one auth page and one corridors page Merge the user API key provisioning into Authentication And API Keys, replace the BRL-only and bank-transfer-only pages with a single Fiat Corridors page covering BRL, USD/MXN/COP/ARS, and EUR, and fix the OpenAPI validity errors that block Apidog import (empty servers array, duplicate startRamp operationId, component response keys with spaces). --- docs/api/apidog/page-manifest.json | 20 +- docs/api/openapi/vortex.openapi.d.ts | 340 +++++++++--------- docs/api/openapi/vortex.openapi.json | 17 +- docs/api/pages/02-quick-start-with-the-sdk.md | 4 +- .../03-authentication-and-partner-keys.md | 142 +++++++- docs/api/pages/06-quotes-and-pricing.md | 4 +- docs/api/pages/09-brl-kyc-notes.md | 13 - docs/api/pages/09-fiat-corridors.md | 50 +++ docs/api/pages/13-kyb-deep-link.md | 2 +- docs/api/pages/14-bank-transfer-corridors.md | 25 -- docs/api/pages/15-user-api-keys.md | 116 ------ 11 files changed, 376 insertions(+), 357 deletions(-) delete mode 100644 docs/api/pages/09-brl-kyc-notes.md create mode 100644 docs/api/pages/09-fiat-corridors.md delete mode 100644 docs/api/pages/14-bank-transfer-corridors.md delete mode 100644 docs/api/pages/15-user-api-keys.md diff --git a/docs/api/apidog/page-manifest.json b/docs/api/apidog/page-manifest.json index a54e339e6..67bd7e51b 100644 --- a/docs/api/apidog/page-manifest.json +++ b/docs/api/apidog/page-manifest.json @@ -65,7 +65,7 @@ "order": 3, "slug": "authentication-and-partner-keys", "source": "docs/api/pages/03-authentication-and-partner-keys.md", - "title": "Authentication And Partner Keys" + "title": "Authentication And API Keys" }, { "order": 4, @@ -99,9 +99,9 @@ }, { "order": 9, - "slug": "brl-kyc-notes", - "source": "docs/api/pages/09-brl-kyc-notes.md", - "title": "BRL / KYC Notes" + "slug": "fiat-corridors", + "source": "docs/api/pages/09-fiat-corridors.md", + "title": "Fiat Corridors" }, { "order": 10, @@ -126,18 +126,6 @@ "slug": "kyb-deep-link", "source": "docs/api/pages/13-kyb-deep-link.md", "title": "KYB Deep Link" - }, - { - "order": 14, - "slug": "bank-transfer-corridors", - "source": "docs/api/pages/14-bank-transfer-corridors.md", - "title": "Bank Transfer Corridors (USD, MXN, COP, ARS)" - }, - { - "order": 15, - "slug": "user-api-keys", - "source": "docs/api/pages/15-user-api-keys.md", - "title": "User API Keys" } ], "publicDocsUrl": "https://api-docs.vortexfinance.co/" diff --git a/docs/api/openapi/vortex.openapi.d.ts b/docs/api/openapi/vortex.openapi.d.ts index 3e6e56e40..f659c00a3 100644 --- a/docs/api/openapi/vortex.openapi.d.ts +++ b/docs/api/openapi/vortex.openapi.d.ts @@ -343,26 +343,6 @@ export interface paths { patch?: never; trace?: never; }; - "/v1/quotes/best": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** - * Create a quote for the best network - * @description Generates a new quote for the network that yields the highest output amount for the given parameters. This endpoint compares the output for a given input amount over all supported networks and returns the 'best' quote, defined as the one with the highest output. - */ - post: operations["createBestQuote"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; "/v1/quotes/{id}": { parameters: { query?: never; @@ -406,95 +386,7 @@ export interface paths { patch?: never; trace?: never; }; - "/v1/ramp/history/{walletAddress}": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Get ramp history for wallet address - * @description Fetches the transaction history for a given wallet address. The response returns the last 20 items by default. This can be adjusted by using the `limit` and `offset` query parameters. - */ - get: { - parameters: { - query?: { - /** @description The maximum count of transaction items returned in this query. The maximum value is `100`. */ - limit?: number; - /** @description The offset for querying the transactions. Necessary if the number of transaction items of the address is larger than the maximum limit. A larger value will return older transaction items. */ - offset?: number; - }; - header?: never; - path: { - /** @description The wallet address for which the ramp history is queried for. */ - walletAddress: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["GetRampHistoryResponse"]; - }; - }; - }; - }; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/ramp/register": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** - * Register new ramp process - * @description Initiates a new on-ramp or off-ramp process by providing quote details, signing accounts, and additional data. - */ - post: operations["registerRamp"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/ramp/start": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - /** - * Start ramp process - * @description Starts a ramp process. - * - * It is assumed all required information from the client has already been sent using the `update` endpoint. This endpoint is only used to tell the backend any external operation (like a bank transfer) has been completed, and the ramp can start. - */ - post: operations["startRamp"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; - "/v1/ramp/update": { + "/v1/quotes/best": { parameters: { query?: never; header?: never; @@ -504,21 +396,10 @@ export interface paths { get?: never; put?: never; /** - * Update ramp process - * @description Submits presigned transactions and additional data to an existing ramp process before starting it. - * This endpoint can be called many times, and data can be incrementally added to the ramp. - * - * Note: For both pre-signed transactions and the generic `additionalData` object, existing properties will be overriden by new values. - * - * ### Required data for ramps. - * The signed counterpart of the initial unsignedTxs object must be provided for all ramps, as required by the object. - * For offramps, the `additionalData` field must contain the confirmation hash corresponding to the inital transaction in which the user sends the funds. - * If the originating chain is `Assethub`, then `assetHubToPendulumHash` must be provided. - * If the originating chain is any `EVM` chain, then `squidRouterApproveHash` and `squidRouterSwapHash` must be provided. - * - * For onramps, no additional data is required after registering the ramp. + * Create a quote for the best network + * @description Generates a new quote for the network that yields the highest output amount for the given parameters. This endpoint compares the output for a given input amount over all supported networks and returns the 'best' quote, defined as the one with the highest output. */ - post: operations["startRamp"]; + post: operations["createBestQuote"]; delete?: never; options?: never; head?: never; @@ -646,6 +527,125 @@ export interface paths { patch?: never; trace?: never; }; + "/v1/ramp/history/{walletAddress}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get ramp history for wallet address + * @description Fetches the transaction history for a given wallet address. The response returns the last 20 items by default. This can be adjusted by using the `limit` and `offset` query parameters. + */ + get: { + parameters: { + query?: { + /** @description The maximum count of transaction items returned in this query. The maximum value is `100`. */ + limit?: number; + /** @description The offset for querying the transactions. Necessary if the number of transaction items of the address is larger than the maximum limit. A larger value will return older transaction items. */ + offset?: number; + }; + header?: never; + path: { + /** @description The wallet address for which the ramp history is queried for. */ + walletAddress: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["GetRampHistoryResponse"]; + }; + }; + }; + }; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/ramp/register": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Register new ramp process + * @description Initiates a new on-ramp or off-ramp process by providing quote details, signing accounts, and additional data. + */ + post: operations["registerRamp"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/ramp/start": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Start ramp process + * @description Starts a ramp process. + * + * It is assumed all required information from the client has already been sent using the `update` endpoint. This endpoint is only used to tell the backend any external operation (like a bank transfer) has been completed, and the ramp can start. + */ + post: operations["startRamp"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/ramp/update": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Update ramp process + * @description Submits presigned transactions and additional data to an existing ramp process before starting it. + * This endpoint can be called many times, and data can be incrementally added to the ramp. + * + * Note: For both pre-signed transactions and the generic `additionalData` object, existing properties will be overriden by new values. + * + * ### Required data for ramps. + * The signed counterpart of the initial unsignedTxs object must be provided for all ramps, as required by the object. + * For offramps, the `additionalData` field must contain the confirmation hash corresponding to the inital transaction in which the user sends the funds. + * If the originating chain is `Assethub`, then `assetHubToPendulumHash` must be provided. + * If the originating chain is any `EVM` chain, then `squidRouterApproveHash` and `squidRouterSwapHash` must be provided. + * + * For onramps, no additional data is required after registering the ramp. + */ + post: operations["updateRamp"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/v1/session/create": { parameters: { query?: never; @@ -1709,7 +1709,7 @@ export interface components { }; }; responses: { - "Invalid input": { + InvalidInput: { headers: { [name: string]: unknown; }; @@ -1720,7 +1720,7 @@ export interface components { }; }; }; - "Record not found": { + RecordNotFound: { headers: { [name: string]: unknown; }; @@ -2630,6 +2630,50 @@ export interface operations { }; }; }; + getRampErrorLogs: { + parameters: { + query?: never; + header?: never; + path: { + /** @description Ramp ID. */ + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Error log array (empty if no errors). */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["GetRampErrorLogsResponse"]; + }; + }; + /** @description Authentication required. */ + 401: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Ramp does not belong to authenticated principal. */ + 403: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description Ramp not found. */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; registerRamp: { parameters: { query?: never; @@ -2955,7 +2999,7 @@ export interface operations { }; }; }; - startRamp: { + updateRamp: { parameters: { query?: never; header?: never; @@ -3096,48 +3140,4 @@ export interface operations { }; }; }; - getRampErrorLogs: { - parameters: { - query?: never; - header?: never; - path: { - /** @description Ramp ID. */ - id: string; - }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Error log array (empty if no errors). */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": components["schemas"]["GetRampErrorLogsResponse"]; - }; - }; - /** @description Authentication required. */ - 401: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Ramp does not belong to authenticated principal. */ - 403: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - /** @description Ramp not found. */ - 404: { - headers: { - [name: string]: unknown; - }; - content?: never; - }; - }; - }; } diff --git a/docs/api/openapi/vortex.openapi.json b/docs/api/openapi/vortex.openapi.json index bbf703dc5..fc1612246 100644 --- a/docs/api/openapi/vortex.openapi.json +++ b/docs/api/openapi/vortex.openapi.json @@ -1,7 +1,7 @@ { "components": { "responses": { - "Invalid input": { + "InvalidInput": { "content": { "application/json": { "schema": { @@ -20,7 +20,7 @@ }, "description": "" }, - "Record not found": { + "RecordNotFound": { "content": { "application/json": { "schema": { @@ -3625,7 +3625,7 @@ "post": { "deprecated": false, "description": "Submits presigned transactions and additional data to an existing ramp process before starting it. \nThis endpoint can be called many times, and data can be incrementally added to the ramp. \n\nNote: For both pre-signed transactions and the generic `additionalData` object, existing properties will be overriden by new values.\n\n### Required data for ramps.\nThe signed counterpart of the initial unsignedTxs object must be provided for all ramps, as required by the object.\nFor offramps, the `additionalData` field must contain the confirmation hash corresponding to the inital transaction in which the user sends the funds. \nIf the originating chain is `Assethub`, then `assetHubToPendulumHash` must be provided. \nIf the originating chain is any `EVM` chain, then `squidRouterApproveHash` and `squidRouterSwapHash` must be provided. \n\nFor onramps, no additional data is required after registering the ramp.", - "operationId": "startRamp", + "operationId": "updateRamp", "parameters": [], "requestBody": { "content": { @@ -4410,7 +4410,16 @@ } }, "security": [], - "servers": [], + "servers": [ + { + "description": "Production", + "url": "https://api.vortexfinance.co" + }, + { + "description": "Sandbox", + "url": "https://api-sandbox.vortexfinance.co" + } + ], "tags": [ { "description": "Create and retrieve cross-border payment quotes.", diff --git a/docs/api/pages/02-quick-start-with-the-sdk.md b/docs/api/pages/02-quick-start-with-the-sdk.md index 0a0e94fb0..23578ab16 100644 --- a/docs/api/pages/02-quick-start-with-the-sdk.md +++ b/docs/api/pages/02-quick-start-with-the-sdk.md @@ -115,7 +115,7 @@ USD, MXN, COP, and ARS settle through Vortex's local payment partners over the u | `COP` | `"ach"` | Colombian bank transfer | | `ARS` | `"cbu"` | CBU bank transfer | -All four corridors support buys and sells on EVM networks; AssetHub is not available for these corridors. The examples below use MXN — for the other currencies, substitute the fiat token and the rail identifier from the table. See [Bank Transfer Corridors](https://api-docs.vortexfinance.co/bank-transfer-corridors) for onboarding, fiat accounts, and limits. +All four corridors support buys and sells on EVM networks; AssetHub is not available for these corridors. The examples below use MXN — for the other currencies, substitute the fiat token and the rail identifier from the table. See [Fiat Corridors](https://api-docs.vortexfinance.co/fiat-corridors) for onboarding, fiat accounts, and limits. ### Onramp (Buy) @@ -150,7 +150,7 @@ No user-signed on-chain transactions are required for onramp. The SDK signs ephe Quotes can be requested without any key (anonymous rate discovery). Registering the ramp requires the user to be onboarded first: authenticate the SDK with that user's own **user-linked** `secretKey` (the `sk_*` key created by that user), and the same user must have completed KYC for the corridor's country. The key and the KYC record belong to the same account, so registration resolves to the user's verified payment profile automatically. A `publicKey`-only registration, or a partner-scoped `sk_*` with no user, is rejected. -Partner `sk_*` keys cannot drive this KYC, and the SDK cannot mint keys or run KYC — onboard the user through the Vortex app or Widget first, then use their `sk_*` key (shown only once, at creation; see [User API Keys](https://api-docs.vortexfinance.co/user-api-keys) for minting it programmatically). This applies to buys and sells in all four corridors. +Partner `sk_*` keys cannot drive this KYC, and the SDK cannot mint keys or run KYC — onboard the user through the Vortex app or Widget first, then use their `sk_*` key (shown only once, at creation; see [Authentication And API Keys](https://api-docs.vortexfinance.co/authentication-and-partner-keys) for minting it programmatically). This applies to buys and sells in all four corridors. ### Offramp (Sell) diff --git a/docs/api/pages/03-authentication-and-partner-keys.md b/docs/api/pages/03-authentication-and-partner-keys.md index 20b0e1a2e..fb8e5fafa 100644 --- a/docs/api/pages/03-authentication-and-partner-keys.md +++ b/docs/api/pages/03-authentication-and-partner-keys.md @@ -1,6 +1,16 @@ -# Authentication And Partner Keys +# Authentication And API Keys -Vortex authenticates partners with two key types and also accepts Supabase Bearer tokens for first-party user flows. +Vortex authenticates API clients with public/secret key pairs, and accepts Supabase Bearer session tokens for first-party user flows and key management. + +## Which Credential Do I Need? + +| Task | Credential | +|---|---| +| Quote attribution and partner pricing | `pk_*` public key (optional on quotes) | +| BRL and EUR ramps from a partner backend | Partner-scoped or user-linked `sk_*` secret key | +| USD, MXN, COP, ARS ramps | **User-linked** `sk_*` secret key | +| Webhook management | Partner secret key | +| Minting and managing user API keys | `Authorization: Bearer` session token | ## Public Keys @@ -10,19 +20,137 @@ Public keys do not authenticate sensitive partner operations. An invalid or expi ## Secret Keys -Secret keys use the `sk_live_*` or `sk_test_*` prefix. They authenticate partner operations through the `X-API-Key` header. +Secret keys use the `sk_live_*` or `sk_test_*` prefix. They authenticate operations through the `X-API-Key` header. + +Secret keys come in two scopes: + +- **Partner-scoped** keys are issued to a partner organization. They are sufficient for BRL and EUR ramps, where the user is identified by request fields such as the tax ID, and they are required for webhook management. +- **User-linked** keys are minted by a user's own Vortex account (see the *Provisioning User-Linked Keys* section below). Requests authenticated with them act as that user, so KYC completed by the same account applies automatically. The USD, MXN, COP, and ARS corridors require a user-linked key at ramp registration; see [Fiat Corridors](https://api-docs.vortexfinance.co/fiat-corridors). A user-linked key works in every corridor, so integrations can use it uniformly. Secret keys must be treated as server-side credentials. Do not expose them in browser bundles, mobile app binaries, URLs, screenshots, analytics tools, logs, or support tickets. When a request includes `partnerId`, the API may require the secret key to authenticate the matching partner. If the authenticated partner does not match the requested partner, Vortex rejects the request. -Ramp endpoints, including register, update, start, status, history, and error logs, require authentication through either a partner secret key or a Supabase Bearer token. +Ramp endpoints, including register, update, start, status, history, and error logs, require authentication through either a secret key or a Supabase Bearer token. Webhook endpoints require a partner secret key and do not accept Supabase Bearer tokens. ## Supabase Bearer Tokens -BRLA account-management endpoints are first-party, user-oriented flows. Partner `sk_*` and `pk_*` keys do not authenticate a BRL KYC flow. Partners that need BRL ramps should onboard users through the Vortex application or hosted widget, or design the integration so the user has completed the required onboarding before the partner backend starts a ramp. +Bearer tokens represent a signed-in Vortex user. They are used for first-party account-management flows (such as the BRLA KYC endpoints) and for minting and managing user API keys. Partner `sk_*` and `pk_*` keys do not authenticate these flows. + +Partners that need BRL ramps should onboard users through the Vortex application or hosted widget, or design the integration so the user has completed the required onboarding before the partner backend starts a ramp. + +## Provisioning User-Linked Keys + +A user-linked key pair can be provisioned programmatically, without contacting Vortex support: sign the user in with an email one-time password (OTP), then mint the key pair with the resulting session token. + +### 1. Request An Email OTP + +```http +POST /v1/auth/request-otp +Content-Type: application/json +``` + +```json +{ + "email": "user@example.com" +} +``` + +Vortex emails a 6-digit code to the address. An optional `locale` string localizes the email. The response is `{ "success": true, "message": "OTP sent to email" }`. + +### 2. Verify The OTP + +```http +POST /v1/auth/verify-otp +Content-Type: application/json +``` + +```json +{ + "email": "user@example.com", + "token": "123456" +} +``` + +```json +{ + "success": true, + "access_token": "eyJ...", + "refresh_token": "...", + "user_id": "00000000-0000-0000-0000-000000000000" +} +``` + +An invalid or expired code returns `400`. Verification creates the user profile on first sign-in; `user_id` identifies the profile the keys will be linked to. If the user has already completed KYC in the Vortex app or Widget under the same email, this is the same profile — no extra linking step is needed. + +`POST /v1/auth/refresh` with `{ "refresh_token": "..." }` returns a fresh token pair when the access token expires. + +### 3. Create The Key Pair + +```http +POST /v1/api-keys +Authorization: Bearer +Content-Type: application/json +``` + +```json +{ + "name": "my-backend", + "expiresAt": "2027-07-06T00:00:00.000Z" +} +``` + +Both body fields are optional. Response (`201`): + +```json +{ + "createdAt": "2026-07-06T12:00:00.000Z", + "expiresAt": "2027-07-06T00:00:00.000Z", + "isActive": true, + "publicKey": { + "id": "...", + "key": "pk_live_...", + "keyPrefix": "pk_live_", + "name": "my-backend (Public)", + "type": "public" + }, + "secretKey": { + "id": "...", + "key": "sk_live_...", + "keyPrefix": "sk_live_", + "name": "my-backend (Secret)", + "type": "secret" + } +} +``` + +- **The secret key value is returned only in this response.** Vortex stores a hash; it cannot be retrieved again. Persist it to your secret manager immediately. +- Keys expire after one year by default; `expiresAt` may extend this to at most two years from creation. +- A user may hold at most 10 active keys (a pair counts as two). Exceeding the cap returns `409 API_KEY_LIMIT_REACHED`; revoke unused keys first. +- Sandbox mints `pk_test_*` / `sk_test_*`; production mints `pk_live_*` / `sk_live_*`. + +The `/v1/api-keys` endpoints accept only `Authorization: Bearer` session tokens — an `X-API-Key` secret key cannot mint or revoke keys. + +### 4. Use The Keys + +Configure the SDK (or send `X-API-Key` directly) with the minted pair: + +```js +const sdk = new VortexSdk({ + apiBaseUrl: "https://api.vortexfinance.co", + publicKey: "pk_live_...", + secretKey: "sk_live_..." +}); +``` + +The bearer token is only needed for key management; day-to-day quoting and ramping authenticate with the secret key. See [Quick Start With The SDK](https://api-docs.vortexfinance.co/quick-start-with-the-sdk). + +### Managing Keys + +- `GET /v1/api-keys` — lists the user's active keys (public key values are included; secret values are never returned). +- `DELETE /v1/api-keys/{keyId}` — revokes a key; returns `204`. Pass `{ "pairedKeyId": "..." }` in the body to revoke both halves of a pair together. ## Webhook Signing Key @@ -30,8 +158,6 @@ BRLA account-management endpoints are first-party, user-oriented flows. Partner ## Recommended Handling -Store secret keys in a secret manager or encrypted environment configuration. Rotate keys if they are exposed, no longer needed, or tied to a retired integration. Use test keys in sandbox and live keys only in production. - -User-linked key pairs can be provisioned programmatically through an email OTP sign-in; see [User API Keys](https://api-docs.vortexfinance.co/user-api-keys). +Store secret keys in a secret manager or encrypted environment configuration. Rotate keys if they are exposed, no longer needed, or tied to a retired integration — for user-linked keys, revoke and re-mint through the endpoints above. Use test keys in sandbox and live keys only in production. --- diff --git a/docs/api/pages/06-quotes-and-pricing.md b/docs/api/pages/06-quotes-and-pricing.md index 88d6e0624..42584554b 100644 --- a/docs/api/pages/06-quotes-and-pricing.md +++ b/docs/api/pages/06-quotes-and-pricing.md @@ -30,7 +30,7 @@ Content-Type: application/json ``` - `rampType` is `"BUY"` (onramp, fiat → crypto) or `"SELL"` (offramp, crypto → fiat). -- `from` / `to` are either a fiat rail (`"pix"`, `"sepa"`, `"ach"`, `"spei"`, `"cbu"`) or a network identifier (`"polygon"`, `"base"`, `"ethereum"`, `"arbitrum"`, `"bsc"`, `"avalanche"`, `"assethub"`, `"stellar"`, `"moonbeam"`). `"ach"` serves USD and COP, `"spei"` serves MXN, and `"cbu"` serves ARS; see [Bank Transfer Corridors](https://api-docs.vortexfinance.co/bank-transfer-corridors). +- `from` / `to` are either a fiat rail (`"pix"`, `"sepa"`, `"ach"`, `"spei"`, `"cbu"`) or a network identifier (`"polygon"`, `"base"`, `"ethereum"`, `"arbitrum"`, `"bsc"`, `"avalanche"`, `"assethub"`, `"stellar"`, `"moonbeam"`). `"ach"` serves USD and COP, `"spei"` serves MXN, and `"cbu"` serves ARS; see [Fiat Corridors](https://api-docs.vortexfinance.co/fiat-corridors). - `inputAmount` is a decimal string in the smallest commonly used unit of `inputCurrency` (e.g. `"150"` for 150 BRL, `"100"` for 100 USDC). Do not pass raw chain base units. - `apiKey` (optional) is the partner public key `pk_live_*` / `pk_test_*`. Required for partner attribution and discount eligibility. @@ -102,6 +102,6 @@ Quotes are immutable and short-lived. If the user takes too long to confirm, or ## Partner Pricing -Pass the partner public key as `apiKey` in the quote body to apply partner pricing and attribution. When a ramp later specifies a `partnerId`, the request must be authenticated with the matching partner secret key in `X-API-Key`. See [Authentication And Partner Keys](https://api-docs.vortexfinance.co/authentication-and-partner-keys). +Pass the partner public key as `apiKey` in the quote body to apply partner pricing and attribution. When a ramp later specifies a `partnerId`, the request must be authenticated with the matching partner secret key in `X-API-Key`. See [Authentication And API Keys](https://api-docs.vortexfinance.co/authentication-and-partner-keys). --- diff --git a/docs/api/pages/09-brl-kyc-notes.md b/docs/api/pages/09-brl-kyc-notes.md deleted file mode 100644 index 8d81e0bba..000000000 --- a/docs/api/pages/09-brl-kyc-notes.md +++ /dev/null @@ -1,13 +0,0 @@ -# BRL / KYC Notes - -BRL routes require user onboarding with Vortex's local payment partner before ramping. The user's Brazilian tax ID, either CPF for individuals or CNPJ for businesses, is used as the primary identifier. - -Level 1 onboarding collects basic identity information and enables lower-limit BRL flows. Level 2 adds document and liveness verification and may be required for higher limits or stricter compliance rules. - -The SDK ramp flow assumes that the user is eligible for the selected corridor. If the user has not completed the required onboarding, the ramp may fail or require additional account-management steps. - -Partner integrations cannot drive BRLA KYC directly with only `sk_*` or `pk_*` keys. BRLA endpoints are first-party, user-oriented flows and rely on a Vortex-authenticated user context rather than partner key authentication. - -KYC endpoints are documented for first-party flows and account-management integrations. They should not be treated as the primary SDK ramp flow. When possible, use the Vortex application or hosted widget to complete onboarding before ramp execution. - ---- diff --git a/docs/api/pages/09-fiat-corridors.md b/docs/api/pages/09-fiat-corridors.md new file mode 100644 index 000000000..755791020 --- /dev/null +++ b/docs/api/pages/09-fiat-corridors.md @@ -0,0 +1,50 @@ +# Fiat Corridors + +This page collects what each fiat corridor requires before a ramp can be registered: the payment rail, the identity and KYC prerequisites, and the payout details. For the quote request shape see [Quotes And Pricing](https://api-docs.vortexfinance.co/quotes-and-pricing); for runnable examples see [Quick Start With The SDK](https://api-docs.vortexfinance.co/quick-start-with-the-sdk). + +## BRL (PIX) + +BRL routes settle over PIX and require user onboarding with Vortex's local payment partner before ramping. The user's Brazilian tax ID — CPF for individuals, CNPJ for businesses — is the primary identifier, so ramp registration may be authenticated with a partner-scoped `sk_*` key: the `taxId` in the request identifies the user. + +Level 1 onboarding collects basic identity information and enables lower-limit BRL flows. Level 2 adds document and liveness verification and may be required for higher limits or stricter compliance rules. The user must have completed KYC under the same `taxId` used in the ramp; otherwise the ramp may fail or require additional account-management steps. + +Partner integrations cannot drive BRL KYC with only `sk_*` or `pk_*` keys. The BRLA endpoints are first-party, user-oriented flows that rely on a Vortex-authenticated user context. When possible, use the Vortex application or hosted widget to complete onboarding before ramp execution. Business users can be sent straight into verification with the [KYB Deep Link](https://api-docs.vortexfinance.co/kyb-deep-link). + +## USD, MXN, COP, ARS (Bank Transfers) + +These corridors settle through Vortex's local payment partners over domestic banking rails. In quote requests, the rail identifier takes the place of a network in `from` (buy) or `to` (sell): + +| Fiat currency | Rail identifier | Payment rail | +|---|---|---| +| `USD` | `"ach"` | ACH bank transfer | +| `MXN` | `"spei"` | SPEI transfer | +| `COP` | `"ach"` | Colombian bank transfer | +| `ARS` | `"cbu"` | CBU bank transfer | + +All four corridors support buys and sells on EVM networks; AssetHub is not available for these corridors. + +### Onboarding And KYC + +Each corridor requires the user to complete KYC for the corridor's country before a ramp can be registered. Onboard the user through the Vortex app or hosted Widget; the identity documents collected differ per country (for example INE, resident card, or passport in Mexico; cédula in Colombia; DNI in Argentina). Business users can be sent straight into verification with the [KYB Deep Link](https://api-docs.vortexfinance.co/kyb-deep-link). + +Unlike BRL, ramp registration must be authenticated with the user's own **user-linked** `sk_*` key — the ramp resolves the user's KYC and payment profile from the authenticated account, not from request fields. Your integration can mint that key programmatically after an email OTP sign-in; see [Authentication And API Keys](https://api-docs.vortexfinance.co/authentication-and-partner-keys). Partner-scoped keys cannot register ramps in these corridors and cannot drive KYC on a user's behalf. Quotes remain available anonymously for rate discovery; eligibility is enforced at registration time, not quote time. + +### Fiat Accounts + +Sells pay out to a saved bank account referenced by `fiatAccountId` in the register call. It is required for sells and optional for buys. The account is created during onboarding in the Vortex app or Widget; the ID is opaque to the SDK and the API client. + +### Payment Instructions On Buys + +After `POST /v1/ramp/start`, the response's `achPaymentData` contains the bank transfer instructions the user must pay (beneficiary, account, and reference details for the corridor's rail). Display them to the user verbatim; the ramp continues automatically once the fiat deposit is confirmed. + +### Limits + +Per-currency minimum and maximum amounts are enforced at quote time and refreshed periodically from the payment partner. A quote outside the limits fails with a descriptive error; prompt the user to adjust the amount. + +## EUR (SEPA) + +EUR sells (offramp) settle to SEPA using the `"sepa"` rail identifier. EUR onramp endpoints exist on the API surface, but the SDK throws `"Euro onramp handler not implemented yet"` — SEPA buy flows are not production-ready today. + +EUR onboarding is individual KYC only and requires a connected wallet, so it is completed through the Vortex application or hosted widget; there is no quote-less KYB deep link for Europe. + +--- diff --git a/docs/api/pages/13-kyb-deep-link.md b/docs/api/pages/13-kyb-deep-link.md index 91ebe3bef..373c0fd99 100644 --- a/docs/api/pages/13-kyb-deep-link.md +++ b/docs/api/pages/13-kyb-deep-link.md @@ -62,6 +62,6 @@ window.open( ## Underlying KYB Onboarding -For Brazil, the deep link drives `POST /v1/brla/createSubaccount` **without** a `quoteId` — the subaccount is created from the company name and CNPJ collected on the form, and the optional quote association is simply omitted. See [BRL / KYC Notes](https://api-docs.vortexfinance.co/brl-kyc-notes) for how BRLA onboarding relates to the ramp flow. +For Brazil, the deep link drives `POST /v1/brla/createSubaccount` **without** a `quoteId` — the subaccount is created from the company name and CNPJ collected on the form, and the optional quote association is simply omitted. See [Fiat Corridors](https://api-docs.vortexfinance.co/fiat-corridors) for how BRLA onboarding relates to the ramp flow. --- diff --git a/docs/api/pages/14-bank-transfer-corridors.md b/docs/api/pages/14-bank-transfer-corridors.md deleted file mode 100644 index 89505adbd..000000000 --- a/docs/api/pages/14-bank-transfer-corridors.md +++ /dev/null @@ -1,25 +0,0 @@ -# Bank Transfer Corridors (USD, MXN, COP, ARS) - -USD, MXN, COP, and ARS ramps settle through Vortex's local payment partners over domestic banking rails: ACH for USD and COP, SPEI for MXN, and CBU for ARS. All four corridors support buys and sells on EVM networks; AssetHub is not available for these corridors. - -In quote requests, the rail identifier (`"ach"`, `"spei"`, `"cbu"`) takes the place of a network in `from` (buy) or `to` (sell). See [Quotes And Pricing](https://api-docs.vortexfinance.co/quotes-and-pricing) for the request shape and [Quick Start With The SDK](https://api-docs.vortexfinance.co/quick-start-with-the-sdk) for runnable examples. - -## Onboarding And KYC - -Each corridor requires the user to complete KYC for the corridor's country before a ramp can be registered. Onboard the user through the Vortex app or hosted Widget; the identity documents collected differ per country (for example INE, resident card, or passport in Mexico; cédula in Colombia; DNI in Argentina). Business users can be sent straight into verification with the [KYB Deep Link](https://api-docs.vortexfinance.co/kyb-deep-link). - -Ramp registration must be authenticated with the user's own user-linked `sk_*` key, which your integration can mint programmatically after an email OTP sign-in — see [User API Keys](https://api-docs.vortexfinance.co/user-api-keys). Partner-scoped keys cannot register ramps in these corridors and cannot drive KYC on a user's behalf. Quotes remain available anonymously for rate discovery; eligibility is enforced at registration time, not quote time. - -## Fiat Accounts - -Sells pay out to a saved bank account referenced by `fiatAccountId` in the register call. It is required for sells and optional for buys. The account is created during onboarding in the Vortex app or Widget; the ID is opaque to the SDK and the API client. - -## Payment Instructions On Buys - -After `POST /v1/ramp/start`, the response's `achPaymentData` contains the bank transfer instructions the user must pay (beneficiary, account, and reference details for the corridor's rail). Display them to the user verbatim; the ramp continues automatically once the fiat deposit is confirmed. - -## Limits - -Per-currency minimum and maximum amounts are enforced at quote time and refreshed periodically from the payment partner. A quote outside the limits fails with a descriptive error; prompt the user to adjust the amount. - ---- diff --git a/docs/api/pages/15-user-api-keys.md b/docs/api/pages/15-user-api-keys.md deleted file mode 100644 index 1a07f2ed8..000000000 --- a/docs/api/pages/15-user-api-keys.md +++ /dev/null @@ -1,116 +0,0 @@ -# User API Keys - -Registering a ramp requires authentication in every corridor: `POST /v1/ramp/register` accepts either a secret API key in `X-API-Key` or a user session Bearer token. For BRL and EUR corridors, a partner-scoped `sk_*` key is sufficient because the user is identified by request fields such as the tax ID. The bank transfer corridors (USD, MXN, COP, ARS) are stricter: the key must be **user-linked** — a key pair minted by the user's own Vortex account — because the ramp resolves the user's KYC and payment profile from the authenticated account. - -This page shows how to provision a user-linked key pair programmatically, without contacting Vortex support: sign the user in with an email one-time password (OTP), then mint the key pair with the resulting session token. The minted pair is bound to the authenticated user, not to a partner; requests authenticated with the secret key act as that user on quote and ramp endpoints, so KYC completed by the same account applies automatically. A user-linked key works in every corridor, so integrations can use it uniformly. See [Bank Transfer Corridors](https://api-docs.vortexfinance.co/bank-transfer-corridors) for the corridor-specific requirements. - -## 1. Request An Email OTP - -```http -POST /v1/auth/request-otp -Content-Type: application/json -``` - -```json -{ - "email": "user@example.com" -} -``` - -Vortex emails a 6-digit code to the address. An optional `locale` string localizes the email. The response is `{ "success": true, "message": "OTP sent to email" }`. - -## 2. Verify The OTP - -```http -POST /v1/auth/verify-otp -Content-Type: application/json -``` - -```json -{ - "email": "user@example.com", - "token": "123456" -} -``` - -```json -{ - "success": true, - "access_token": "eyJ...", - "refresh_token": "...", - "user_id": "00000000-0000-0000-0000-000000000000" -} -``` - -An invalid or expired code returns `400`. Verification creates the user profile on first sign-in; `user_id` identifies the profile the keys will be linked to. If the user has already completed KYC in the Vortex app or Widget under the same email, this is the same profile — no extra linking step is needed. - -`POST /v1/auth/refresh` with `{ "refresh_token": "..." }` returns a fresh token pair when the access token expires. - -## 3. Create The Key Pair - -```http -POST /v1/api-keys -Authorization: Bearer -Content-Type: application/json -``` - -```json -{ - "name": "my-backend", - "expiresAt": "2027-07-06T00:00:00.000Z" -} -``` - -Both body fields are optional. Response (`201`): - -```json -{ - "createdAt": "2026-07-06T12:00:00.000Z", - "expiresAt": "2027-07-06T00:00:00.000Z", - "isActive": true, - "publicKey": { - "id": "...", - "key": "pk_live_...", - "keyPrefix": "pk_live_", - "name": "my-backend (Public)", - "type": "public" - }, - "secretKey": { - "id": "...", - "key": "sk_live_...", - "keyPrefix": "sk_live_", - "name": "my-backend (Secret)", - "type": "secret" - } -} -``` - -- **The secret key value is returned only in this response.** Vortex stores a hash; it cannot be retrieved again. Persist it to your secret manager immediately. -- Keys expire after one year by default; `expiresAt` may extend this to at most two years from creation. -- A user may hold at most 10 active keys (a pair counts as two). Exceeding the cap returns `409 API_KEY_LIMIT_REACHED`; revoke unused keys first. -- Sandbox mints `pk_test_*` / `sk_test_*`; production mints `pk_live_*` / `sk_live_*`. - -The `/v1/api-keys` endpoints accept only `Authorization: Bearer` session tokens — an `X-API-Key` secret key cannot mint or revoke keys. - -## 4. Use The Keys - -Configure the SDK (or send `X-API-Key` directly) with the minted pair: - -```js -const sdk = new VortexSdk({ - apiBaseUrl: "https://api.vortexfinance.co", - publicKey: "pk_live_...", - secretKey: "sk_live_..." -}); -``` - -The bearer token is only needed for key management; day-to-day quoting and ramping authenticate with the secret key. See [Quick Start With The SDK](https://api-docs.vortexfinance.co/quick-start-with-the-sdk). - -## Managing Keys - -- `GET /v1/api-keys` — lists the user's active keys (public key values are included; secret values are never returned). -- `DELETE /v1/api-keys/{keyId}` — revokes a key; returns `204`. Pass `{ "pairedKeyId": "..." }` in the body to revoke both halves of a pair together. - -Revoke and re-mint immediately if a secret key is exposed. See [Authentication And Partner Keys](https://api-docs.vortexfinance.co/authentication-and-partner-keys) for handling guidance. - ---- From af882bcdd9973791d750ef45c25acb0b69dcddcc Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 19:35:40 +0200 Subject: [PATCH 174/176] Fix the typecheck errors in the Alfredpay corridor and E2E specs --- .../src/tests/corridors/alfredpay-currencies.scenario.test.ts | 2 +- apps/frontend/e2e/offramp-alfredpay-journeys.spec.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/api/src/tests/corridors/alfredpay-currencies.scenario.test.ts b/apps/api/src/tests/corridors/alfredpay-currencies.scenario.test.ts index 4ede6eb2f..ac4a7047c 100644 --- a/apps/api/src/tests/corridors/alfredpay-currencies.scenario.test.ts +++ b/apps/api/src/tests/corridors/alfredpay-currencies.scenario.test.ts @@ -653,7 +653,7 @@ describe("Alfredpay currency corridors (USD/COP/ARS, on- and offramp)", () => { return { depositAddress: world.alfredpay.offrampDepositAddress, - ephemeralAddress: ephemeral.address, + ephemeralAddress: ephemeral.address as `0x${string}`, inputAmountRaw, quoteId: quote.id, rampId: ramp.id, diff --git a/apps/frontend/e2e/offramp-alfredpay-journeys.spec.ts b/apps/frontend/e2e/offramp-alfredpay-journeys.spec.ts index 8e9f131e4..5c35024c5 100644 --- a/apps/frontend/e2e/offramp-alfredpay-journeys.spec.ts +++ b/apps/frontend/e2e/offramp-alfredpay-journeys.spec.ts @@ -36,7 +36,7 @@ interface SellJourneyCase { arrivalText: string; } -function buildFiatAccount(fields: Record) { +function buildFiatAccount>(fields: T) { return { createdAt: new Date().toISOString(), customerId: "alfred-customer-e2e-1", From 7067f319c0677aa6f9760e59b5fa94589b0c9007 Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 19:50:12 +0200 Subject: [PATCH 175/176] Make the OpenAPI file importable and mark the EUR corridor as live Lead the file with the openapi/info keys so format sniffers recognize it, restore ASCII-escaped output, and drop the only 3.1-style nullable type union. Document EUR SEPA buys and sells on the Fiat Corridors page and remove the stale not-implemented claims from the overview and AI agent pages. --- docs/api/openapi/vortex.openapi.d.ts | 7 +++++-- docs/api/openapi/vortex.openapi.json | 13 +++++++------ docs/api/pages/01-overview.md | 2 +- docs/api/pages/09-fiat-corridors.md | 4 +++- docs/api/pages/12-ai-agent-integration.md | 3 +-- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/docs/api/openapi/vortex.openapi.d.ts b/docs/api/openapi/vortex.openapi.d.ts index f659c00a3..64b28394a 100644 --- a/docs/api/openapi/vortex.openapi.d.ts +++ b/docs/api/openapi/vortex.openapi.d.ts @@ -1370,8 +1370,11 @@ export interface components { /** @description Full key value; present for public keys only. Secret key values are never returned after creation. */ key?: string; keyPrefix: string; - /** Format: date-time */ - lastUsedAt?: string | null; + /** + * Format: date-time + * @description Null until the key is first used. + */ + lastUsedAt?: string; name: string; /** @enum {string} */ type: "public" | "secret"; diff --git a/docs/api/openapi/vortex.openapi.json b/docs/api/openapi/vortex.openapi.json index fc1612246..7f5845a30 100644 --- a/docs/api/openapi/vortex.openapi.json +++ b/docs/api/openapi/vortex.openapi.json @@ -699,8 +699,9 @@ "type": "string" }, "lastUsedAt": { + "description": "Null until the key is first used.", "format": "date-time", - "type": ["string", "null"] + "type": "string" }, "name": { "type": "string" @@ -1398,7 +1399,7 @@ "securitySchemes": {} }, "info": { - "description": "Cross-border payments gateway built on the Pendulum blockchain.\n\n**Scope:** 25 paths verified against `apps/api/src/api/routes/v1/`.\n\n**Auth principals:**\n- `X-API-Key: sk__...` — partner SDK key (server-side).\n- `X-Public-Key: pk__...` — partner public key (browser; attribution only).\n- `Authorization: Bearer ` — first-party user session.\n\nAll `/v1/brla/*` endpoints accept Supabase Bearer only; partner sk_*/pk_* keys are not accepted on BRLA routes.\n\n**Webhook signing:** RSA-PSS 2048 / SHA-256. Fetch the signing key from `GET /v1/public-key`.\n", + "description": "Cross-border payments gateway built on the Pendulum blockchain.\n\n**Scope:** 25 paths verified against `apps/api/src/api/routes/v1/`.\n\n**Auth principals:**\n- `X-API-Key: sk__...` \u2014 partner SDK key (server-side).\n- `X-Public-Key: pk__...` \u2014 partner public key (browser; attribution only).\n- `Authorization: Bearer ` \u2014 first-party user session.\n\nAll `/v1/brla/*` endpoints accept Supabase Bearer only; partner sk_*/pk_* keys are not accepted on BRLA routes.\n\n**Webhook signing:** RSA-PSS 2048 / SHA-256. Fetch the signing key from `GET /v1/public-key`.\n", "title": "Vortex API", "version": "1.1.0" }, @@ -1807,7 +1808,7 @@ "/v1/brla/createSubaccount": { "post": { "deprecated": false, - "description": "`companyName`, `startDate` and `cnpj` are only required when taxIdType is `CNPJ`\n\n`quoteId` is optional: pass it in the normal ramp flow, or omit it for the quote-less KYB deep link where business verification starts before any quote exists.\n\n**Auth:** uses `optionalAuth` — accepts a Supabase Bearer token if present but does not require one.", + "description": "`companyName`, `startDate` and `cnpj` are only required when taxIdType is `CNPJ`\n\n`quoteId` is optional: pass it in the normal ramp flow, or omit it for the quote-less KYB deep link where business verification starts before any quote exists.\n\n**Auth:** uses `optionalAuth` \u2014 accepts a Supabase Bearer token if present but does not require one.", "operationId": "createSubaccount", "parameters": [], "requestBody": { @@ -1991,7 +1992,7 @@ "/v1/brla/getUploadUrls": { "post": { "deprecated": false, - "description": "Returns presigned upload URLs for the user's ID document and selfie. Only `ID` and `DRIVERS-LICENSE` are accepted for `documentType` (passport not supported here).\n\n**Auth:** uses `optionalAuth` — accepts a Supabase Bearer token if present but does not require one.", + "description": "Returns presigned upload URLs for the user's ID document and selfie. Only `ID` and `DRIVERS-LICENSE` are accepted for `documentType` (passport not supported here).\n\n**Auth:** uses `optionalAuth` \u2014 accepts a Supabase Bearer token if present but does not require one.", "operationId": "brlaGetUploadUrls", "requestBody": { "content": { @@ -3871,7 +3872,7 @@ }, "/v1/session/create": { "post": { - "description": "Creates a hosted Vortex Widget session and returns the URL to open for the user.\n\nThis single endpoint supports two mutually exclusive request shapes:\n\n- **Fixed quote** (`GetWidgetUrlLocked`) — pass a `quoteId` you created via `POST /v1/quotes`. The widget uses that exact quote and does not refresh it. If the quote expires before the user finishes, they must close the window and start over.\n\n- **Auto-refresh** (`GetWidgetUrlRefresh`) — pass the route parameters (`network`, `rampType`, `inputAmount`, plus `fiat` / `cryptoLocked` / `paymentMethod` as relevant for the direction). The widget creates and refreshes quotes on demand for the user.\n\nUse the example switcher below to see the request shape for each mode. `externalSessionId` is required in both modes and is echoed back in webhook payloads.", + "description": "Creates a hosted Vortex Widget session and returns the URL to open for the user.\n\nThis single endpoint supports two mutually exclusive request shapes:\n\n- **Fixed quote** (`GetWidgetUrlLocked`) \u2014 pass a `quoteId` you created via `POST /v1/quotes`. The widget uses that exact quote and does not refresh it. If the quote expires before the user finishes, they must close the window and start over.\n\n- **Auto-refresh** (`GetWidgetUrlRefresh`) \u2014 pass the route parameters (`network`, `rampType`, `inputAmount`, plus `fiat` / `cryptoLocked` / `paymentMethod` as relevant for the direction). The widget creates and refreshes quotes on demand for the user.\n\nUse the example switcher below to see the request shape for each mode. `externalSessionId` is required in both modes and is echoed back in webhook payloads.", "parameters": [], "requestBody": { "content": { @@ -4027,7 +4028,7 @@ "type": "array" }, "emoji": { - "description": "e.g. 🇩🇪", + "description": "e.g. \ud83c\udde9\ud83c\uddea", "type": "string" }, "name": { diff --git a/docs/api/pages/01-overview.md b/docs/api/pages/01-overview.md index d947fc6cc..5609f8070 100644 --- a/docs/api/pages/01-overview.md +++ b/docs/api/pages/01-overview.md @@ -6,7 +6,7 @@ These docs are written for partner developers integrating Vortex into a backend, ## Supported Corridors -The current SDK release supports BRL/PIX flows plus bank-transfer corridors for USD (ACH), MXN (SPEI), COP (ACH), and ARS (CBU) through Vortex's local payment partners, where enabled by country and route configuration. These four corridors support buys and sells on EVM networks; AssetHub is not available for them. EUR onramp endpoints exist on the API surface but the SDK throws `"Euro onramp handler not implemented yet"`; SEPA buy flows are not production-ready today. Other fiat currencies are exposed through reference data endpoints and are added incrementally. +The current SDK release supports BRL/PIX flows, EUR/SEPA flows, and bank-transfer corridors for USD (ACH), MXN (SPEI), COP (ACH), and ARS (CBU) through Vortex's local payment partners, where enabled by country and route configuration. The EUR and bank-transfer corridors support buys and sells on EVM networks; AssetHub is not available for them. Other fiat currencies are exposed through reference data endpoints and are added incrementally. For crypto, Vortex supports USDC and USDT across the listed EVM networks plus USDC on AssetHub. Stablecoin pegs and routes are subject to liquidity on the Nabla AMM and the wider Pendulum/Hydration corridor. diff --git a/docs/api/pages/09-fiat-corridors.md b/docs/api/pages/09-fiat-corridors.md index 755791020..9b50270f4 100644 --- a/docs/api/pages/09-fiat-corridors.md +++ b/docs/api/pages/09-fiat-corridors.md @@ -43,7 +43,9 @@ Per-currency minimum and maximum amounts are enforced at quote time and refreshe ## EUR (SEPA) -EUR sells (offramp) settle to SEPA using the `"sepa"` rail identifier. EUR onramp endpoints exist on the API surface, but the SDK throws `"Euro onramp handler not implemented yet"` — SEPA buy flows are not production-ready today. +EUR routes settle over SEPA using the `"sepa"` rail identifier and support both buys and sells. EUR onramps deliver to EVM networks; AssetHub is not available as a destination. + +On a buy, register the ramp with `destinationAddress`, `email`, and `ipAddress`. The SEPA transfer instructions are returned in the ramp's `ibanPaymentData` — IBAN, receiver name, and payment reference. Display them to the user, and start the ramp once the user has completed the SEPA transfer. No user-signed on-chain transactions are required for buys. EUR onboarding is individual KYC only and requires a connected wallet, so it is completed through the Vortex application or hosted widget; there is no quote-less KYB deep link for Europe. diff --git a/docs/api/pages/12-ai-agent-integration.md b/docs/api/pages/12-ai-agent-integration.md index c7c583d31..1866dd93a 100644 --- a/docs/api/pages/12-ai-agent-integration.md +++ b/docs/api/pages/12-ai-agent-integration.md @@ -169,8 +169,7 @@ These are not optional. The SDK handles them for you; a custom client must imple - It does not poll ramp status; you must poll or use webhooks. - It does not encrypt ephemeral backups at rest. - It does not delete ephemeral backups after success. -- It does not drive BRLA KYC; the user must be onboarded through the Vortex app or Widget before a BRL ramp. -- It does not support EUR onramp today (throws `"Euro onramp handler not implemented yet"`). +- It does not drive KYC for any corridor; the user must be onboarded through the Vortex app or Widget before ramping. Mirror those gaps deliberately. If your integration adds behavior the SDK lacks (encryption at rest, backup rotation, idempotency keys, retries), document it for your operators. From 24836780469c89848594813eaee5f94ed59a9b2f Mon Sep 17 00:00:00 2001 From: Marcel Ebert Date: Mon, 6 Jul 2026 20:14:59 +0200 Subject: [PATCH 176/176] Adjust error message for tax id not linked to profile --- apps/api/src/api/controllers/brla.controller.test.ts | 10 +++++----- apps/api/src/api/controllers/brla.controller.ts | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/apps/api/src/api/controllers/brla.controller.test.ts b/apps/api/src/api/controllers/brla.controller.test.ts index 4c35783a3..66a4d5743 100644 --- a/apps/api/src/api/controllers/brla.controller.test.ts +++ b/apps/api/src/api/controllers/brla.controller.test.ts @@ -1,9 +1,9 @@ -import { AveniaAccountType, BrlaApiService } from "@vortexfi/shared"; -import { afterEach, beforeEach, describe, expect, it, mock } from "bun:test"; +import {AveniaAccountType, BrlaApiService} from "@vortexfi/shared"; +import {afterEach, beforeEach, describe, expect, it, mock} from "bun:test"; import httpStatus from "http-status"; import logger from "../../config/logger"; -import TaxId, { TaxIdInternalStatus } from "../../models/taxId.model"; -import { createSubaccount, getAveniaUser } from "./brla.controller"; +import TaxId, {TaxIdInternalStatus} from "../../models/taxId.model"; +import {createSubaccount, getAveniaUser} from "./brla.controller"; function createResponse() { const res = { @@ -137,7 +137,7 @@ describe("getAveniaUser", () => { ); expect(res.statusCode).toBe(httpStatus.FORBIDDEN); - expect(res.body).toEqual({ error: "Forbidden" }); + expect(res.body).toEqual({ error: "This tax ID is not linked to your user profile and cannot be used." }); }); }); diff --git a/apps/api/src/api/controllers/brla.controller.ts b/apps/api/src/api/controllers/brla.controller.ts index 144c1e3e6..209d757a1 100644 --- a/apps/api/src/api/controllers/brla.controller.ts +++ b/apps/api/src/api/controllers/brla.controller.ts @@ -178,7 +178,7 @@ export const getAveniaUser = async ( // TaxId must be owned by the effective user. if (taxIdRecord.userId !== effectiveUserId) { - res.status(httpStatus.FORBIDDEN).json({ error: "Forbidden" }); + res.status(httpStatus.FORBIDDEN).json({ error: "This tax ID is not linked to your user profile and cannot be used." }); return; } } else { @@ -301,7 +301,7 @@ export const getAveniaUserRemainingLimit = async ( // TaxId must be owned by the effective user. The legacy partner-key // exemption that allowed reading any taxId has been removed. if (taxIdRecord.userId !== effectiveUserId) { - res.status(httpStatus.FORBIDDEN).json({ error: "Forbidden" }); + res.status(httpStatus.FORBIDDEN).json({ error: "This tax ID is not linked to your user profile and cannot be used." }); return; } } else { @@ -598,7 +598,7 @@ export const getUploadUrls = async ( } if (!req.userId || taxIdRecord.userId !== req.userId) { - res.status(httpStatus.FORBIDDEN).json({ error: "Forbidden" }); + res.status(httpStatus.FORBIDDEN).json({ error: "This tax ID is not linked to your user profile and cannot be used." }); return; } @@ -654,7 +654,7 @@ export const newKyc = async ( } if (!req.userId || taxIdRecord.userId !== req.userId) { - res.status(httpStatus.FORBIDDEN).json({ error: "Forbidden" }); + res.status(httpStatus.FORBIDDEN).json({ error: "This tax ID is not linked to your user profile and cannot be used." }); return; } @@ -696,7 +696,7 @@ export const initiateKybLevel1 = async ( } if (!req.userId || taxIdRecord.userId !== req.userId) { - res.status(httpStatus.FORBIDDEN).json({ error: "Forbidden" }); + res.status(httpStatus.FORBIDDEN).json({ error: "This tax ID is not linked to your user profile and cannot be used." }); return; }